@amp-labs/react 2.11.0 → 2.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -0
- package/build/amp-react.cjs.js +14 -14
- package/build/amp-react.cjs.js.map +1 -1
- package/build/amp-react.es.js +4587 -4382
- package/build/amp-react.es.js.map +1 -1
- package/build/index.d.ts +68 -0
- package/package.json +1 -1
package/build/amp-react.cjs.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react/jsx-runtime"),I=require("react");require("react-dom");function Gh(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 H=Gh(I),Xh="https://api.withampersand.com/v1".replace(/\/+$/,"");class Zs{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Xh}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Eu}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 Yh=new Zs,ho=class ho{constructor(t=Yh){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 tm(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?ho.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 ea(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:em(a.body)||a.body instanceof URLSearchParams||Zh(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}};ho.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let an=ho;function Zh(e){return typeof Blob<"u"&&e instanceof Blob}function em(e){return typeof FormData<"u"&&e instanceof FormData}class ea extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class tm extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class ue extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function T(e,t){const n=e[t];return n!=null}function Eu(e,t=""){return Object.keys(e).map(n=>_u(n,e[n],t)).filter(n=>n.length>0).join("&")}function _u(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 _u(e,i,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Eu(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function Qe(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class $e{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class mr{constructor(t){this.raw=t}async value(){}}class Cl{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function nm(e){return rm(e)}function rm(e,t){return e==null?e:{fieldUsed:T(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:T(e,"keyFormat")?e.keyFormat:void 0}}function im(e){return om(e)}function om(e,t){return e==null?e:{name:e.name,valuePrefix:T(e,"valuePrefix")?e.valuePrefix:void 0}}function sm(e){return am(e)}function am(e,t){return e==null?e:{name:e.name}}function lm(e){return cm(e)}function cm(e,t){return e==null?e:{attachmentType:e.attachmentType,query:T(e,"query")?sm(e.query):void 0,header:T(e,"header")?im(e.header):void 0,docsURL:T(e,"docsURL")?e.docsURL:void 0}}function um(e){return dm(e)}function dm(e,t){return e==null?e:{enabled:T(e,"enabled")?e.enabled:void 0,includeFullRecords:T(e,"includeFullRecords")?e.includeFullRecords:void 0}}function fm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,includeFullRecords:e.includeFullRecords}}function pm(e){return hm(e)}function hm(e,t){return e==null?e:{url:e.url,method:T(e,"method")?e.method:void 0,successStatusCodes:T(e,"successStatusCodes")?e.successStatusCodes:void 0}}const Ol={ApiKey:"apiKey",Basic:"basic"};function mm(e){return gm(e)}function gm(e,t){return e}function ym(e){return vm(e)}function vm(e,t){return e==null?e:{days:T(e,"days")?e.days:void 0,fullHistory:T(e,"fullHistory")?e.fullHistory:void 0}}function bm(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Tu(e){return wm(e)}function wm(e,t){return e==null?e:{defaultPeriod:ym(e.defaultPeriod)}}function xm(e){if(e!==void 0)return e===null?null:{defaultPeriod:bm(e.defaultPeriod)}}function Im(e){return Sm(e)}function Sm(e,t){return e==null?e:{days:T(e,"days")?e.days:void 0,fullHistory:T(e,"fullHistory")?e.fullHistory:void 0}}function Cm(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Om(e){return Em(e)}function Em(e,t){return e==null?e:{defaultPeriod:Im(e.defaultPeriod)}}function Nu(e){if(e!==void 0)return e===null?null:{defaultPeriod:Cm(e.defaultPeriod)}}function _m(e){return Tm(e)}function Tm(e,t){return e==null?e:{enabled:T(e,"enabled")?e.enabled:void 0}}function ku(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Nm(e){return km(e)}function km(e,t){return e==null?e:{mappedValue:e.mappedValue,mappedDisplayValue:e.mappedDisplayValue}}function Rm(e){if(e!==void 0)return e===null?null:{mappedValue:e.mappedValue,mappedDisplayValue:e.mappedDisplayValue}}function Am(e){return Fm(e)}function Fm(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:T(e,"mapToDisplayName")?e.mapToDisplayName:void 0,prompt:T(e,"prompt")?e.prompt:void 0,mappedValues:T(e,"mappedValues")?e.mappedValues.map(Nm):void 0,fieldName:T(e,"fieldName")?e.fieldName:void 0}}function Ru(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(Rm),fieldName:e.fieldName}}function Pm(e){return Dm(e)}function Dm(e,t){return e}function Mm(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(Ru),selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:Nu(e.backfill)}}function jm(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Qe(e.objects,Mm)}}function Lm(e){return Bm(e)}function Bm(e,t){return e==null?e:{stringValue:T(e,"stringValue")?e.stringValue:void 0,integerValue:T(e,"integerValue")?e.integerValue:void 0,booleanValue:T(e,"booleanValue")?e.booleanValue:void 0}}function Vm(e){if(e!==void 0)return e===null?null:{stringValue:e.stringValue,integerValue:e.integerValue,booleanValue:e.booleanValue}}const Um={Always:"always",Never:"never"},qm={Always:"always",Never:"never"};function $m(e){return zm(e)}function zm(e,t){return e==null?e:{default:T(e,"default")?Lm(e.default):void 0,writeOnCreate:T(e,"writeOnCreate")?e.writeOnCreate:void 0,writeOnUpdate:T(e,"writeOnUpdate")?e.writeOnUpdate:void 0}}function Au(e){if(e!==void 0)return e===null?null:{default:Vm(e.default),writeOnCreate:e.writeOnCreate,writeOnUpdate:e.writeOnUpdate}}function Km(e){let t=!0;return t=t&&"value"in e,t}function Hm(e,t){return e==null?e:{value:e.value,applyOnUpdate:T(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Jm(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Wm(e){let t=!0;return t=t&&"value"in e,t}function Qm(e,t){return e==null?e:{value:e.value,applyOnUpdate:T(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Gm(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Xm(e){let t=!0;return t=t&&"value"in e,t}function Ym(e,t){return e==null?e:{value:e.value,applyOnUpdate:T(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Zm(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function eg(e){return tg(e)}function tg(e,t){return e==null?e:{...Hm(e),...Qm(e),...Ym(e)}}function Fu(e){if(e!==void 0)return e===null?null:Km(e)?Jm(e):Wm(e)?Gm(e):Xm(e)?Zm(e):{}}function ng(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:Qe(e.selectedValueDefaults,Fu),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:Qe(e.selectedFieldSettings,Au)}}function rg(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Qe(e.objects,ng)}}function ig(e){return og(e)}function og(e,t){return e==null?e:{enabled:e.enabled}}function sg(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function ag(e){return lg(e)}function lg(e,t){return e==null?e:{enabled:e.enabled}}function cg(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function ug(e){return dg(e)}function dg(e,t){return e==null?e:{enabled:e.enabled,watchFieldsAuto:T(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:T(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function fg(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function pg(e){return hg(e)}function hg(e,t){return e==null?e:{apiKeyAsBasic:T(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:T(e,"apiKeyAsBasicOpts")?nm(e.apiKeyAsBasicOpts):void 0,docsURL:T(e,"docsURL")?e.docsURL:void 0}}function mg(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Ni(e){return gg(e)}function gg(e,t){return e==null?e:{supported:e.supported,defaultRecordLimit:T(e,"defaultRecordLimit")?e.defaultRecordLimit:void 0,objectRecordLimits:T(e,"objectRecordLimits")?e.objectRecordLimits:void 0}}function yg(e){return vg(e)}function vg(e,t){return e==null?e:{_delete:Ni(e.delete),create:Ni(e.create),update:Ni(e.update),upsert:Ni(e.upsert)}}function bg(e){return wg(e)}function wg(e,t){return e==null?e:{value:e.value}}function xg(e){return Ig(e)}function Ig(e,t){return e==null?e:{brandingRemoval:T(e,"brandingRemoval")?bg(e.brandingRemoval):void 0}}function ki(e){return Sg(e)}function Sg(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:T(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:T(e,"updateTime")?new Date(e.updateTime):void 0,entitlements:T(e,"entitlements")?xg(e.entitlements):void 0}}function Cg(e){return Og(e)}function Og(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function Eg(e){return _g(e)}function _g(e,t){return e==null?e:{objectName:e.objectName,schedule:T(e,"schedule")?e.schedule:void 0,disabled:T(e,"disabled")?e.disabled:void 0,destination:T(e,"destination")?e.destination:void 0,selectedFields:e.selectedFields,selectedValueMappings:T(e,"selectedValueMappings")?e.selectedValueMappings:void 0,dynamicMappingsInput:T(e,"dynamicMappingsInput")?e.dynamicMappingsInput.map(Am):void 0,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:T(e,"selectedFieldsAuto")?Pm(e.selectedFieldsAuto):void 0,backfill:T(e,"backfill")?Om(e.backfill):void 0}}function Tg(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(Ru),selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:Nu(e.backfill)}}function Ng(e){return kg(e)}function kg(e,t){return e==null?e:{objects:Qe(e.objects,Eg)}}function Rg(e){if(e!==void 0)return e===null?null:{objects:Qe(e.objects,Tg)}}function Ag(e){return Fg(e)}function Fg(e,t){return e==null?e:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:T(e,"createEvent")?ig(e.createEvent):void 0,updateEvent:T(e,"updateEvent")?ug(e.updateEvent):void 0,deleteEvent:T(e,"deleteEvent")?ag(e.deleteEvent):void 0}}function Pg(e){if(e!==void 0)return e===null?null:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:sg(e.createEvent),updateEvent:fg(e.updateEvent),deleteEvent:cg(e.deleteEvent)}}function Dg(e){return Mg(e)}function Mg(e,t){return e==null?e:{objects:Qe(e.objects,Ag)}}function jg(e){if(e!==void 0)return e===null?null:{objects:Qe(e.objects,Pg)}}function Lg(e){return Bg(e)}function Bg(e,t){return e==null?e:{objectName:e.objectName,selectedValueDefaults:T(e,"selectedValueDefaults")?Qe(e.selectedValueDefaults,eg):void 0,selectedFieldSettings:T(e,"selectedFieldSettings")?Qe(e.selectedFieldSettings,$m):void 0}}function Vg(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:Qe(e.selectedValueDefaults,Fu),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:Qe(e.selectedFieldSettings,Au)}}function Ug(e){return qg(e)}function qg(e,t){return e==null?e:{objects:T(e,"objects")?Qe(e.objects,Lg):void 0}}function $g(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Qe(e.objects,Vg)}}function zg(e){return Kg(e)}function Kg(e,t){return e==null?e:{provider:e.provider,read:T(e,"read")?Ng(e.read):void 0,write:T(e,"write")?Ug(e.write):void 0,proxy:T(e,"proxy")?_m(e.proxy):void 0,subscribe:T(e,"subscribe")?Dg(e.subscribe):void 0}}function Hg(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:Rg(e.read),write:$g(e.write),proxy:ku(e.proxy),subscribe:jg(e.subscribe)}}function Jg(e){return Wg(e)}function Wg(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:zg(e.content)}}function Qg(e){return Gg(e)}function Gg(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:T(e,"updateTime")?new Date(e.updateTime):void 0}}function Pu(e){return Xg(e)}function Xg(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:T(e,"updateTime")?new Date(e.updateTime):void 0}}function Yg(e){return Zg(e)}function Zg(e,t){return e==null?e:{token:e.token,issuedAt:T(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:T(e,"expiresAt")?new Date(e.expiresAt):void 0}}function ey(e){return ty(e)}function ty(e,t){return e==null?e:{token:e.token,issuedAt:T(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:T(e,"expiresAt")?new Date(e.expiresAt):void 0}}function ny(e){return ry(e)}function ry(e,t){return e==null?e:{accessToken:T(e,"accessToken")?Yg(e.accessToken):void 0,refreshToken:T(e,"refreshToken")?ey(e.refreshToken):void 0,scopes:T(e,"scopes")?e.scopes:void 0}}function zi(e){return iy(e)}function iy(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:T(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:T(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:T(e,"updateTime")?new Date(e.updateTime):void 0}}function oy(e){return sy(e)}function sy(e,t){return e==null?e:{value:e.value,source:e.source,displayName:T(e,"displayName")?e.displayName:void 0}}function ta(e){if(e!==void 0)return e===null?null:{value:e.value,source:e.source,displayName:e.displayName}}function Kr(e){return ay(e)}function ay(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:T(e,"providerApp")?zi(e.providerApp):void 0,group:Pu(e.group),consumer:Qg(e.consumer),providerWorkspaceRef:T(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerConsumerRef:T(e,"providerConsumerRef")?e.providerConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:T(e,"updateTime")?new Date(e.updateTime):void 0,authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:T(e,"oauth2AuthorizationCode")?ny(e.oauth2AuthorizationCode):void 0,apiKey:T(e,"apiKey")?e.apiKey:void 0,providerMetadata:T(e,"providerMetadata")?Qe(e.providerMetadata,oy):void 0}}function Du(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function Mu(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function ju(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 ly(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 cy(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 Lu(e){if(e!==void 0)return e===null?null:{accessToken:ly(e.accessToken),refreshToken:cy(e.refreshToken),scopes:e.scopes}}function uy(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:Qe(e.providerMetadata,ta),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,customAuth:e.customAuth,basicAuth:Du(e.basicAuth),oauth2ClientCredentials:Mu(e.oauth2ClientCredentials),oauth2PasswordCredentials:ju(e.oauth2PasswordCredentials),oauth2AuthorizationCode:Lu(e.oauth2AuthorizationCode)}}function dy(e){return fy(e)}function fy(e,t){return e==null?e:{enabled:T(e,"enabled")?e.enabled:void 0}}function py(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function hy(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Hg(e.content)}}function my(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:hy(e.config)}}function gy(e){return yy(e)}function yy(e,t){return e==null?e:{enabled:T(e,"enabled")?e.enabled:void 0,useModule:T(e,"useModule")?e.useModule:void 0}}function vy(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,useModule:e.useModule}}function by(e){return wy(e)}function wy(e,t){return e==null?e:{mode:T(e,"mode")?e.mode:void 0,pageSize:T(e,"pageSize")?e.pageSize:void 0}}function xy(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function Iy(e){let t=!0;return t=t&&"fieldName"in e,t}function Sy(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:T(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:T(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Cy(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function Oy(e){let t=!0;return t=t&&"mapToName"in e,t}function Bu(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:T(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:T(e,"default")?e.default:void 0,prompt:T(e,"prompt")?e.prompt:void 0}}function Ey(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function El(e){return _y(e)}function _y(e,t){return e==null?e:{...Sy(e),...Bu(e)}}function _l(e){if(e!==void 0)return e===null?null:Iy(e)?Cy(e):Oy(e)?Ey(e):{}}function Vu(e){return Ty(e)}function Ty(e,t){return e}function Ny(e){return ky(e)}function ky(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:T(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:T(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:T(e,"requiredFields")?e.requiredFields.map(El):void 0,optionalFields:T(e,"optionalFields")?e.optionalFields.map(El):void 0,optionalFieldsAuto:T(e,"optionalFieldsAuto")?Vu(e.optionalFieldsAuto):void 0,backfill:T(e,"backfill")?Tu(e.backfill):void 0,delivery:T(e,"delivery")?by(e.delivery):void 0,enabled:T(e,"enabled")?e.enabled:void 0}}function Ry(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(_l),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(_l),optionalFieldsAuto:e.optionalFieldsAuto,backfill:xm(e.backfill),delivery:xy(e.delivery),enabled:e.enabled}}function Ay(e){return Fy(e)}function Fy(e,t){return e==null?e:{objects:T(e,"objects")?e.objects.map(Ny):void 0}}function Py(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Ry)}}function Dy(e){return My(e)}function My(e,t){return e==null?e:{enabled:T(e,"enabled")?e.enabled:void 0}}function jy(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Ly(e){return By(e)}function By(e,t){return e==null?e:{enabled:T(e,"enabled")?e.enabled:void 0,watchFieldsAuto:T(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:T(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function Vy(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function Uy(e){return qy(e)}function qy(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:T(e,"inheritFieldsAndMapping")?e.inheritFieldsAndMapping:void 0,createEvent:T(e,"createEvent")?dy(e.createEvent):void 0,updateEvent:T(e,"updateEvent")?Ly(e.updateEvent):void 0,deleteEvent:T(e,"deleteEvent")?Dy(e.deleteEvent):void 0,associationChangeEvent:T(e,"associationChangeEvent")?um(e.associationChangeEvent):void 0,otherEvents:T(e,"otherEvents")?e.otherEvents:void 0}}function $y(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:e.inheritFieldsAndMapping,createEvent:py(e.createEvent),updateEvent:Vy(e.updateEvent),deleteEvent:jy(e.deleteEvent),associationChangeEvent:fm(e.associationChangeEvent),otherEvents:e.otherEvents}}function zy(e){return Ky(e)}function Ky(e,t){return e==null?e:{objects:T(e,"objects")?e.objects.map(Uy):void 0}}function Hy(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map($y)}}function Uu(e){return Jy(e)}function Jy(e,t){return e==null?e:{allowAnyFields:T(e,"allowAnyFields")?e.allowAnyFields:void 0}}function Wy(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function Qy(e){return Gy(e)}function Gy(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:T(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:T(e,"valueDefaults")?Uu(e.valueDefaults):void 0}}function Xy(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:Wy(e.valueDefaults)}}function Yy(e){return Zy(e)}function Zy(e,t){return e==null?e:{objects:T(e,"objects")?e.objects.map(Qy):void 0}}function ev(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Xy)}}function tv(e){return nv(e)}function nv(e,t){return e==null?e:{name:e.name,provider:e.provider,displayName:T(e,"displayName")?e.displayName:void 0,module:T(e,"module")?e.module:void 0,read:T(e,"read")?Ay(e.read):void 0,write:T(e,"write")?Yy(e.write):void 0,proxy:T(e,"proxy")?gy(e.proxy):void 0,subscribe:T(e,"subscribe")?zy(e.subscribe):void 0}}function rv(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,displayName:e.displayName,module:e.module,read:Py(e.read),write:ev(e.write),proxy:vy(e.proxy),subscribe:Hy(e.subscribe)}}function iv(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:rv(e.content)}}function ov(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:iv(e.latestRevision)}}function sv(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function av(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 lv(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function cv(e){return uv(e)}function uv(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function dv(e){return fv(e)}function fv(e,t){return e==null?e:{name:e.name,displayName:e.displayName,prompt:T(e,"prompt")?e.prompt:void 0,docsURL:T(e,"docsURL")?e.docsURL:void 0}}function pv(e){return hv(e)}function hv(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function mv(e){return gv(e)}function gv(e,t){return e==null?e:{headers:T(e,"headers")?e.headers.map(cv):void 0,queryParams:T(e,"queryParams")?e.queryParams.map(pv):void 0,inputs:T(e,"inputs")?e.inputs.map(dv):void 0}}function yv(e){return vv(e)}function vv(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function bv(e){return wv(e)}function wv(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,valueType:T(e,"valueType")?e.valueType:void 0,providerType:T(e,"providerType")?e.providerType:void 0,readOnly:T(e,"readOnly")?e.readOnly:void 0,values:T(e,"values")?e.values.map(yv):void 0}}function xv(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:Qe(e.providerMetadata,ta),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,customAuth:e.customAuth,basicAuth:Du(e.basicAuth),oauth2ClientCredentials:Mu(e.oauth2ClientCredentials),oauth2PasswordCredentials:ju(e.oauth2PasswordCredentials),oauth2AuthorizationCode:Lu(e.oauth2AuthorizationCode)}}function Iv(e){return Sv(e)}function Sv(e,t){return e==null?e:{enabled:T(e,"enabled")?e.enabled:void 0,useModule:T(e,"useModule")?e.useModule:void 0}}function Cv(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,mapToName:T(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:T(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Mo(e){return Ov(e)}function Ov(e,t){return e==null?e:{...Cv(e),...Bu(e)}}function Ev(e){return _v(e)}function _v(e,t){return e==null?e:{error:T(e,"error")?e.error:void 0,objectName:e.objectName,displayName:e.displayName,mapToName:T(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:T(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:T(e,"requiredFields")?e.requiredFields.map(Mo):void 0,optionalFields:T(e,"optionalFields")?e.optionalFields.map(Mo):void 0,optionalFieldsAuto:T(e,"optionalFieldsAuto")?Vu(e.optionalFieldsAuto):void 0,allFieldsMetadata:T(e,"allFieldsMetadata")?Qe(e.allFieldsMetadata,bv):void 0,allFields:T(e,"allFields")?e.allFields.map(Mo):void 0,backfill:T(e,"backfill")?Tu(e.backfill):void 0}}function Tv(e){return Nv(e)}function Nv(e,t){return e==null?e:{objects:T(e,"objects")?e.objects.map(Ev):void 0}}function kv(e){return Rv(e)}function Rv(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:T(e,"valueDefaults")?Uu(e.valueDefaults):void 0}}function Av(e){return Fv(e)}function Fv(e,t){return e==null?e:{objects:T(e,"objects")?e.objects.map(kv):void 0}}function Pv(e){return Dv(e)}function Dv(e,t){return e==null?e:{name:e.name,displayName:T(e,"displayName")?e.displayName:void 0,module:T(e,"module")?e.module:void 0,provider:e.provider,read:T(e,"read")?Tv(e.read):void 0,write:T(e,"write")?Av(e.write):void 0,proxy:T(e,"proxy")?Iv(e.proxy):void 0}}function Mv(e){return jv(e)}function jv(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Pv(e.content)}}function Lr(e){return Lv(e)}function Lv(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:T(e,"group")?Pu(e.group):void 0,healthStatus:e.healthStatus,connection:Kr(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:T(e,"updateTime")?new Date(e.updateTime):void 0,config:Jg(e.config)}}function Bv(e){return Vv(e)}function Vv(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:tv(e.content)}}function jo(e){return Uv(e)}function Uv(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:T(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:Bv(e.latestRevision)}}function qv(e){return $v(e)}function $v(e,t){return e==null?e:{iconURL:T(e,"iconURL")?e.iconURL:void 0,logoURL:T(e,"logoURL")?e.logoURL:void 0}}function zv(e){return Kv(e)}function Kv(e,t){return e==null?e:{iconURL:T(e,"iconURL")?e.iconURL:void 0,logoURL:T(e,"logoURL")?e.logoURL:void 0}}function Hv(e){return Jv(e)}function Jv(e,t){return e==null?e:{regular:T(e,"regular")?zv(e.regular):void 0,darkMode:T(e,"darkMode")?qv(e.darkMode):void 0}}function Wv(e){return Qv(e)}function Qv(e,t){return e==null?e:{name:e.name,displayName:T(e,"displayName")?e.displayName:void 0,prompt:T(e,"prompt")?e.prompt:void 0,defaultValue:T(e,"defaultValue")?e.defaultValue:void 0,docsURL:T(e,"docsURL")?e.docsURL:void 0,moduleDependencies:T(e,"moduleDependencies")?e.moduleDependencies:void 0}}function Gv(e){return Xv(e)}function Xv(e,t){return e==null?e:{name:e.name,moduleDependencies:T(e,"moduleDependencies")?e.moduleDependencies:void 0}}function Yv(e){return Zv(e)}function Zv(e,t){return e==null?e:{create:T(e,"create")?e.create:void 0,update:T(e,"update")?e.update:void 0,_delete:T(e,"delete")?e.delete:void 0,passThrough:T(e,"passThrough")?e.passThrough:void 0}}function qu(e){return eb(e)}function eb(e,t){return e==null?e:{bulkWrite:Cg(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write,subscribeSupport:T(e,"subscribeSupport")?Yv(e.subscribeSupport):void 0,batchWrite:T(e,"batchWrite")?yg(e.batchWrite):void 0}}function tb(e){return nb(e)}function nb(e,t){return e==null?e:{displayName:e.displayName,baseURL:e.baseURL,support:qu(e.support)}}function rb(e){return ib(e)}function ib(e,t){return e==null?e:{name:e.name,displayName:e.displayName,path:e.path,capture:T(e,"capture")?e.capture:void 0}}function ob(e){return sb(e)}function sb(e,t){return e==null?e:{workspaceRefField:T(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:T(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:T(e,"scopesField")?e.scopesField:void 0,otherFields:T(e,"otherFields")?e.otherFields.map(rb):void 0}}const Lo={AuthorizationCode:"authorizationCode",AuthorizationCodePkce:"authorizationCodePKCE",ClientCredentials:"clientCredentials"};function ab(e){return lb(e)}function lb(e,t){return e==null?e:{grantType:e.grantType,authURL:T(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:T(e,"audience")?e.audience:void 0,tokenMetadataFields:ob(e.tokenMetadataFields),docsURL:T(e,"docsURL")?e.docsURL:void 0,authURLParams:T(e,"authURLParams")?e.authURLParams:void 0}}function cb(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,ta),providerAppId:e.providerAppId,enableCSRFProtection:e.enableCSRFProtection}}function ub(e){return db(e)}function db(e,t){return e==null?e:{input:T(e,"input")?e.input.map(Wv):void 0,postAuthentication:T(e,"postAuthentication")?e.postAuthentication.map(Gv):void 0}}function fb(e){return pb(e)}function pb(e,t){return e==null?e:{subscriptionScope:e.subscriptionScope,targetURLScope:e.targetURLScope,registrationTiming:e.registrationTiming}}function Tl(e){return hb(e)}function hb(e,t){return e==null?e:{name:e.name,authType:mm(e.authType),baseURL:e.baseURL,defaultModule:e.defaultModule,oauth2Opts:T(e,"oauth2Opts")?ab(e.oauth2Opts):void 0,apiKeyOpts:T(e,"apiKeyOpts")?lm(e.apiKeyOpts):void 0,basicOpts:T(e,"basicOpts")?pg(e.basicOpts):void 0,customOpts:T(e,"customOpts")?mv(e.customOpts):void 0,support:qu(e.support),providerOpts:e.providerOpts,authHealthCheck:T(e,"authHealthCheck")?pm(e.authHealthCheck):void 0,displayName:T(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:T(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:T(e,"media")?Hv(e.media):void 0,labels:T(e,"labels")?e.labels:void 0,subscribeOpts:T(e,"subscribeOpts")?fb(e.subscribeOpts):void 0,modules:T(e,"modules")?Qe(e.modules,tb):void 0,metadata:T(e,"metadata")?ub(e.metadata):void 0}}function mb(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,connection:uy(e.connection)}}function gb(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:jm(e.read),write:rg(e.write),proxy:ku(e.proxy)}}function yb(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:gb(e.content)}}function vb(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:yb(e.config)}}function bb(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:vb(e.installation)}}function wb(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function xb(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:wb(e.project)}}function Ib(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 Sb(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:Ib(e.providerApp)}}class Cb extends an{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ue("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ue("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 mr(o)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ue("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:xv(t.generateConnectionParams)},n);return new $e(o,s=>Kr(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 ue("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ue("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 $e(o,s=>Kr(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 ue("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 $e(o,s=>s.map(Kr))}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 ue("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ue("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling updateConnection.");if(t.updateConnectionRequest===null||t.updateConnectionRequest===void 0)throw new ue("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:mb(t.updateConnectionRequest)},n);return new $e(o,s=>Kr(s))}async updateConnection(t,n){return await(await this.updateConnectionRaw(t,n)).value()}}class Ob extends an{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ue("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ue("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new ue("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:my(t.installation)},n);return new $e(o,s=>Lr(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 ue("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ue("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ue("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 mr(o)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ue("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ue("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ue("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 $e(o,s=>Lr(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 ue("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new ue("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 $e(o,s=>s.map(Lr))}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 ue("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 $e(o,s=>s.map(Lr))}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 ue("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ue("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ue("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new ue("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:bb(t.installationUpdate)},n);return new $e(o,s=>Lr(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class Eb extends an{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ue("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");if(t.batchUpsertIntegrationsRequest===null||t.batchUpsertIntegrationsRequest===void 0)throw new ue("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:mg(t.batchUpsertIntegrationsRequest)},n);return new $e(o,s=>s.map(jo))}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 ue("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new ue("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:ov(t.integration)},n);return new mr(o)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ue("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new ue("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 mr(o)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async getIntegrationRaw(t,n){if(t.integrationIdOrName===null||t.integrationIdOrName===void 0)throw new ue("integrationIdOrName","Required parameter requestParameters.integrationIdOrName was null or undefined when calling getIntegration.");if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ue("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 $e(o,s=>jo(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 ue("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 $e(o,s=>s.map(jo))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class _b extends an{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new ue("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:cb(t.connectOAuthParams)},n);return this.isJsonMime(o.headers.get("content-type"))?new $e(o):new Cl(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 ue("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling oauthUpdate.");if(t.connectionId===null||t.connectionId===void 0)throw new ue("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 $e(o):new Cl(o)}async oauthUpdate(t,n){return await(await this.oauthUpdateRaw(t,n)).value()}}class Tb extends an{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new ue("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:sv(t.project)},n);return new $e(o,s=>ki(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 ue("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 $e(o,s=>ki(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 $e(i,o=>o.map(ki))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ue("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new ue("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:xb(t.projectUpdate)},n);return new $e(o,s=>ki(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class Nb extends an{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new ue("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 $e(o,s=>Tl(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 $e(i,o=>Qe(o,Tl))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class kb extends an{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ue("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new ue("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:av(t.providerApp)},n);return new $e(o,s=>zi(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 ue("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ue("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 mr(o)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ue("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 $e(o,s=>s.map(zi))}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 ue("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ue("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new ue("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:Sb(t.providerAppUpdate)},n);return new $e(o,s=>zi(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class Rb extends an{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ue("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ue("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");if(t.revision===null||t.revision===void 0)throw new ue("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:lv(t.revision)},n);return new mr(o)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ue("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ue("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new ue("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new ue("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 $e(o,s=>Mv(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}var Er=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(){}},Ab={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Fb=class{#e=Ab;#t=!1;setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&this.#t&&e!==this.#e&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:this.#e,provider:e}),this.#e=e,process.env.NODE_ENV!=="production"&&(this.#t=!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&(this.#t=!0),this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&(this.#t=!0),this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},Kn=new Fb;function Pb(e){setTimeout(e,0)}var Wn=typeof window>"u"||"Deno"in globalThis;function St(){}function Db(e,t){return typeof e=="function"?e(t):e}function gs(e){return typeof e=="number"&&e>=0&&e!==1/0}function $u(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Rn(e,t){return typeof e=="function"?e(t):e}function Kt(e,t){return typeof e=="function"?e(t):e}function Nl(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:o,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==na(s,t.options))return!1}else if(!ei(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 kl(e,t){const{exact:n,status:r,predicate:i,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(Qn(t.options.mutationKey)!==Qn(o))return!1}else if(!ei(t.options.mutationKey,o))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function na(e,t){return(t?.queryKeyHashFn||Qn)(e)}function Qn(e){return JSON.stringify(e,(t,n)=>vs(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function ei(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>ei(e[n],t[n])):!1}var Mb=Object.prototype.hasOwnProperty;function ys(e,t){if(e===t)return e;const n=Rl(e)&&Rl(t);if(!n&&!(vs(e)&&vs(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:Mb.call(e,u))&&l++;continue}if(d===null||h===null||typeof d!="object"||typeof h!="object"){a[u]=h;continue}const f=ys(d,h);a[u]=f,f===d&&l++}return i===s&&l===i?e:a}function Gi(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 Rl(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function vs(e){if(!Al(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Al(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Al(e){return Object.prototype.toString.call(e)==="[object Object]"}function jb(e){return new Promise(t=>{Kn.setTimeout(t,e)})}function bs(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 ys(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 ys(e,t)}return t}function Lb(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Bb(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Xi=Symbol();function zu(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Xi&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Xi?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ku(e,t){return typeof e=="function"?e(...t):!!e}var Vb=class extends Er{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!Wn&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},ra=new Vb;function ws(){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 Ub=Pb;function qb(){let e=[],t=0,n=a=>{a()},r=a=>{a()},i=Ub;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 it=qb(),$b=class extends Er{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!Wn&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#e}},Yi=new $b;function zb(e){return Math.min(1e3*2**e,3e4)}function Hu(e){return(e??"online")==="online"?Yi.isOnline():!0}var xs=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Ju(e){let t=!1,n=0,r;const i=ws(),o=()=>i.status!=="pending",s=v=>{if(!o()){const g=new xs(v);h(g),e.onCancel?.(g)}},a=()=>{t=!0},l=()=>{t=!1},c=()=>ra.isFocused()&&(e.networkMode==="always"||Yi.isOnline())&&e.canRun(),u=()=>Hu(e.networkMode)&&e.canRun(),d=v=>{o()||(r?.(),i.resolve(v))},h=v=>{o()||(r?.(),i.reject(v))},f=()=>new Promise(v=>{r=g=>{(o()||c())&&v(g)},e.onPause?.()}).then(()=>{r=void 0,o()||e.onContinue?.()}),y=()=>{if(o())return;let v;const g=n===0?e.initialPromise:void 0;try{v=g??e.fn()}catch(b){v=Promise.reject(b)}Promise.resolve(v).then(d).catch(b=>{if(o())return;const m=e.retry??(Wn?0:3),w=e.retryDelay??zb,C=typeof w=="function"?w(n,b):w,E=m===!0||typeof m=="number"&&n<m||typeof m=="function"&&m(n,b);if(t||!E){h(b);return}n++,e.onFail?.(n,b),jb(C).then(()=>c()?void 0:f()).then(()=>{t?h(b):y()})})};return{promise:i,status:()=>i.status,cancel:s,continue:()=>(r?.(),i),cancelRetry:a,continueRetry:l,canStart:u,start:()=>(u()?y():f().then(y),i)}}var Wu=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),gs(this.gcTime)&&(this.#e=Kn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Wn?1/0:300*1e3))}clearGcTimeout(){this.#e&&(Kn.clearTimeout(this.#e),this.#e=void 0)}},Kb=class extends Wu{#e;#t;#n;#i;#r;#s;#a;constructor(e){super(),this.#a=!1,this.#s=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#n=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=Fl(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#r?.promise}setOptions(e){if(this.options={...this.#s,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=Fl(this.options);t.data!==void 0&&(this.setData(t.data,{updatedAt:t.dataUpdatedAt,manual:!0}),this.#e=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){const n=bs(this.state.data,e,this.options);return this.#o({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#o({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#r?.promise;return this.#r?.cancel(e),t?t.then(St).catch(St):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>Kt(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Xi||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Rn(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!$u(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#r&&(this.#a?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#o({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(e&&this.setOptions(e),!this.options.queryFn){const a=this.observers.find(l=>l.options.queryFn);a&&this.setOptions(a.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 n=new AbortController,r=a=>{Object.defineProperty(a,"signal",{enumerable:!0,get:()=>(this.#a=!0,n.signal)})},i=()=>{const a=zu(this.options,t),c=(()=>{const u={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(u),u})();return this.#a=!1,this.options.persister?this.options.persister(a,c,this):a(c)},s=(()=>{const a={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(a),a})();this.options.behavior?.onFetch(s,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==s.fetchOptions?.meta)&&this.#o({type:"fetch",meta:s.fetchOptions?.meta}),this.#r=Ju({initialPromise:t?.initialPromise,fn:s.fetchFn,onCancel:a=>{a instanceof xs&&a.revert&&this.setState({...this.#t,fetchStatus:"idle"}),n.abort()},onFail:(a,l)=>{this.#o({type:"failed",failureCount:a,error:l})},onPause:()=>{this.#o({type:"pause"})},onContinue:()=>{this.#o({type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0});try{const a=await this.#r.start();if(a===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(a),this.#n.config.onSuccess?.(a,this),this.#n.config.onSettled?.(a,this.state.error,this),a}catch(a){if(a instanceof xs){if(a.silent)return this.#r.promise;if(a.revert){if(this.state.data===void 0)throw a;return this.state.data}}throw this.#o({type:"error",error:a}),this.#n.config.onError?.(a,this),this.#n.config.onSettled?.(this.state.data,a,this),a}finally{this.scheduleGc()}}#o(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...Qu(n.data,this.options),fetchMeta:e.meta??null};case"success":const r={...n,data:e.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?r:void 0,r;case"error":const i=e.error;return{...n,error:i,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),it.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function Qu(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Hu(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Fl(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 Hb=class extends Er{constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.#a=ws(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#i=void 0;#r;#s;#a;#o;#m;#f;#p;#c;#u;#l;#h=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Pl(this.#t,this.options)?this.#d():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Is(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Is(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#w(),this.#x(),this.#t.removeObserver(this)}setOptions(e){const t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Kt(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#I(),this.#t.setOptions(this.options),t._defaulted&&!Gi(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&Dl(this.#t,n,this.options,t)&&this.#d(),this.updateResult(),r&&(this.#t!==n||Kt(this.options.enabled,this.#t)!==Kt(t.enabled,this.#t)||Rn(this.options.staleTime,this.#t)!==Rn(t.staleTime,this.#t))&&this.#g();const i=this.#y();r&&(this.#t!==n||Kt(this.options.enabled,this.#t)!==Kt(t.enabled,this.#t)||i!==this.#l)&&this.#v(i)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Wb(this,n)&&(this.#i=n,this.#s=this.options,this.#r=this.#t.state),n}getCurrentResult(){return this.#i}trackResult(e,t){return new Proxy(e,{get:(n,r)=>(this.trackProp(r),t?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#a.status==="pending"&&this.#a.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,r))})}trackProp(e){this.#h.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#i))}#d(e){this.#I();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(St)),t}#g(){this.#w();const e=Rn(this.options.staleTime,this.#t);if(Wn||this.#i.isStale||!gs(e))return;const n=$u(this.#i.dataUpdatedAt,e)+1;this.#c=Kn.setTimeout(()=>{this.#i.isStale||this.updateResult()},n)}#y(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#l=e,!(Wn||Kt(this.options.enabled,this.#t)===!1||!gs(this.#l)||this.#l===0)&&(this.#u=Kn.setInterval(()=>{(this.options.refetchIntervalInBackground||ra.isFocused())&&this.#d()},this.#l))}#b(){this.#g(),this.#v(this.#y())}#w(){this.#c&&(Kn.clearTimeout(this.#c),this.#c=void 0)}#x(){this.#u&&(Kn.clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const n=this.#t,r=this.options,i=this.#i,o=this.#r,s=this.#s,l=e!==n?e.state:this.#n,{state:c}=e;let u={...c},d=!1,h;if(t._optimisticResults){const k=this.hasListeners(),L=!k&&Pl(e,t),M=k&&Dl(e,n,t,r);(L||M)&&(u={...u,...Qu(c.data,e.options)}),t._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:f,errorUpdatedAt:y,status:v}=u;h=u.data;let g=!1;if(t.placeholderData!==void 0&&h===void 0&&v==="pending"){let k;i?.isPlaceholderData&&t.placeholderData===s?.placeholderData?(k=i.data,g=!0):k=typeof t.placeholderData=="function"?t.placeholderData(this.#p?.state.data,this.#p):t.placeholderData,k!==void 0&&(v="success",h=bs(i?.data,k,t),d=!0)}if(t.select&&h!==void 0&&!g)if(i&&h===o?.data&&t.select===this.#m)h=this.#f;else try{this.#m=t.select,h=t.select(h),h=bs(i?.data,h,t),this.#f=h,this.#o=null}catch(k){this.#o=k}this.#o&&(f=this.#o,h=this.#f,y=Date.now(),v="error");const b=u.fetchStatus==="fetching",m=v==="pending",w=v==="error",C=m&&b,E=h!==void 0,A={status:v,fetchStatus:u.fetchStatus,isPending:m,isSuccess:v==="success",isError:w,isInitialLoading:C,isLoading:C,data:h,dataUpdatedAt:u.dataUpdatedAt,error:f,errorUpdatedAt:y,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>l.dataUpdateCount||u.errorUpdateCount>l.errorUpdateCount,isFetching:b,isRefetching:b&&!m,isLoadingError:w&&!E,isPaused:u.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:w&&E,isStale:ia(e,t),refetch:this.refetch,promise:this.#a,isEnabled:Kt(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const k=F=>{A.status==="error"?F.reject(A.error):A.data!==void 0&&F.resolve(A.data)},L=()=>{const F=this.#a=A.promise=ws();k(F)},M=this.#a;switch(M.status){case"pending":e.queryHash===n.queryHash&&k(M);break;case"fulfilled":(A.status==="error"||A.data!==M.value)&&L();break;case"rejected":(A.status!=="error"||A.error!==M.reason)&&L();break}}return A}updateResult(){const e=this.#i,t=this.createResult(this.#t,this.options);if(this.#r=this.#t.state,this.#s=this.options,this.#r.data!==void 0&&(this.#p=this.#t),Gi(t,e))return;this.#i=t;const n=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!this.#h.size)return!0;const o=new Set(i??this.#h);return this.options.throwOnError&&o.add("error"),Object.keys(this.#i).some(s=>{const a=s;return this.#i[a]!==e[a]&&o.has(a)})};this.#S({listeners:n()})}#I(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#S(e){it.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#i)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function Jb(e,t){return Kt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Pl(e,t){return Jb(e,t)||e.state.data!==void 0&&Is(e,t,t.refetchOnMount)}function Is(e,t,n){if(Kt(t.enabled,e)!==!1&&Rn(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&ia(e,t)}return!1}function Dl(e,t,n,r){return(e!==t||Kt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&ia(e,n)}function ia(e,t){return Kt(t.enabled,e)!==!1&&e.isStaleByTime(Rn(t.staleTime,e))}function Wb(e,t){return!Gi(e.getCurrentResult(),t)}function Ml(e){return{onFetch:(t,n)=>{const r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],s=t.state.data?.pageParams||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let u=!1;const d=y=>{Object.defineProperty(y,"signal",{enumerable:!0,get:()=>(t.signal.aborted?u=!0:t.signal.addEventListener("abort",()=>{u=!0}),t.signal)})},h=zu(t.options,t.fetchOptions),f=async(y,v,g)=>{if(u)return Promise.reject();if(v==null&&y.pages.length)return Promise.resolve(y);const m=(()=>{const _={client:t.client,queryKey:t.queryKey,pageParam:v,direction:g?"backward":"forward",meta:t.options.meta};return d(_),_})(),w=await h(m),{maxPages:C}=t.options,E=g?Bb:Lb;return{pages:E(y.pages,w,C),pageParams:E(y.pageParams,v,C)}};if(i&&o.length){const y=i==="backward",v=y?Qb:jl,g={pages:o,pageParams:s},b=v(r,g);a=await f(g,b,y)}else{const y=e??o.length;do{const v=l===0?s[0]??r.initialPageParam:jl(r,a);if(l>0&&v==null)break;a=await f(a,v),l++}while(l<y)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=c}}}function jl(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 Qb(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Gb=class extends Wu{#e;#t;#n;#i;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Gu(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#i?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#r({type:"continue"})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#i=Ju({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(o,s)=>{this.#r({type:"failed",failureCount:o,error:s})},onPause:()=>{this.#r({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const r=this.state.status==="pending",i=!this.#i.canStart();try{if(r)t();else{this.#r({type:"pending",variables:e,isPaused:i}),await this.#n.config.onMutate?.(e,this,n);const s=await this.options.onMutate?.(e,n);s!==this.state.context&&this.#r({type:"pending",context:s,variables:e,isPaused:i})}const o=await this.#i.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#r({type:"success",data:o}),o}catch(o){try{throw await this.#n.config.onError?.(o,e,this.state.context,this,n),await this.options.onError?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(void 0,o,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(void 0,o,e,this.state.context,n),o}finally{this.#r({type:"error",error:o})}}finally{this.#n.runNext(this)}}#r(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),it.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function Gu(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Xb=class extends Er{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){const r=new Gb({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);const t=Ri(e);if(typeof t=="string"){const n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=Ri(e);if(typeof t=="string"){const n=this.#t.get(t);if(n)if(n.length>1){const r=n.indexOf(e);r!==-1&&n.splice(r,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Ri(e);if(typeof t=="string"){const r=this.#t.get(t)?.find(i=>i.state.status==="pending");return!r||r===e}else return!0}runNext(e){const t=Ri(e);return typeof t=="string"?this.#t.get(t)?.find(r=>r!==e&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){it.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>kl(t,n))}findAll(e={}){return this.getAll().filter(t=>kl(e,t))}notify(e){it.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return it.batch(()=>Promise.all(e.map(t=>t.continue().catch(St))))}};function Ri(e){return e.options.scope?.id}var Yb=class extends Er{#e;#t=void 0;#n;#i;constructor(t,n){super(),this.#e=t,this.setOptions(n),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const n=this.options;this.options=this.#e.defaultMutationOptions(t),Gi(this.options,n)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),n?.mutationKey&&this.options.mutationKey&&Qn(n.mutationKey)!==Qn(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(t){this.#r(),this.#s(t)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#r(),this.#s()}mutate(t,n){return this.#i=n,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(t)}#r(){const t=this.#n?.state??Gu();this.#t={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#s(t){it.batch(()=>{if(this.#i&&this.hasListeners()){const n=this.#t.variables,r=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};t?.type==="success"?(this.#i.onSuccess?.(t.data,n,r,i),this.#i.onSettled?.(t.data,null,n,r,i)):t?.type==="error"&&(this.#i.onError?.(t.error,n,r,i),this.#i.onSettled?.(void 0,t.error,n,r,i))}this.listeners.forEach(n=>{n(this.#t)})})}},Zb=class extends Er{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){const r=t.queryKey,i=t.queryHash??na(r,t);let o=this.get(i);return o||(o=new Kb({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(o)),o}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){it.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>Nl(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>Nl(e,n)):t}notify(e){it.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){it.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){it.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ew=class{#e;#t;#n;#i;#r;#s;#a;#o;constructor(e={}){this.#e=e.queryCache||new Zb,this.#t=e.mutationCache||new Xb,this.#n=e.defaultOptions||{},this.#i=new Map,this.#r=new Map,this.#s=0}mount(){this.#s++,this.#s===1&&(this.#a=ra.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#o=Yi.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#s--,this.#s===0&&(this.#a?.(),this.#a=void 0,this.#o?.(),this.#o=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.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(Rn(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}),o=this.#e.get(r.queryHash)?.state.data,s=Db(t,o);if(s!==void 0)return this.#e.build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return it.batch(()=>this.#e.findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;it.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#e;return it.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=it.batch(()=>this.#e.findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(St).catch(St)}invalidateQueries(e,t={}){return it.batch(()=>(this.#e.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=it.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(St)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(St)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#e.build(this,t);return n.isStaleByTime(Rn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(St).catch(St)}fetchInfiniteQuery(e){return e.behavior=Ml(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(St).catch(St)}ensureInfiniteQueryData(e){return e.behavior=Ml(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Yi.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#i.set(Qn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#i.values()],n={};return t.forEach(r=>{ei(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){this.#r.set(Qn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#r.values()],n={};return t.forEach(r=>{ei(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=na(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===Xi&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Xu=H.createContext(void 0),Ze=e=>{const t=H.useContext(Xu);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},tw=({client:e,children:t})=>(H.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),p.jsx(Xu.Provider,{value:e,children:t})),Yu=H.createContext(!1),nw=()=>H.useContext(Yu);Yu.Provider;function rw(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var iw=H.createContext(rw()),ow=()=>H.useContext(iw),sw=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},aw=e=>{H.useEffect(()=>{e.clearReset()},[e])},lw=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Ku(n,[e.error,r])),cw=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))}},uw=(e,t)=>e.isLoading&&e.isFetching&&!t,dw=(e,t)=>e?.suspense&&t.isPending,Ll=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function fw(e,t,n){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=nw(),i=ow(),o=Ze(),s=o.defaultQueryOptions(e);o.getDefaultOptions().queries?._experimental_beforeQuery?.(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",cw(s),sw(s,i),aw(i);const a=!o.getQueryCache().get(s.queryHash),[l]=H.useState(()=>new t(o,s)),c=l.getOptimisticResult(s),u=!r&&e.subscribed!==!1;if(H.useSyncExternalStore(H.useCallback(d=>{const h=u?l.subscribe(it.batchCalls(d)):St;return l.updateResult(),h},[l,u]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),H.useEffect(()=>{l.setOptions(s)},[s,l]),dw(s,c))throw Ll(s,l,i);if(lw({result:c,errorResetBoundary:i,throwOnError:s.throwOnError,query:o.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw c.error;return o.getDefaultOptions().queries?._experimental_afterQuery?.(s,c),s.experimental_prefetchInRender&&!Wn&&uw(c,r)&&(a?Ll(s,l,i):o.getQueryCache().get(s.queryHash)?.promise)?.catch(St).finally(()=>{l.updateResult()}),s.notifyOnChangeProps?c:l.trackResult(c)}function er(e,t){return fw(e,Hb)}function vn(e,t){const n=Ze(),[r]=H.useState(()=>new Yb(n,e));H.useEffect(()=>{r.setOptions(e)},[r,e]);const i=H.useSyncExternalStore(H.useCallback(s=>r.subscribe(it.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),o=H.useCallback((s,a)=>{r.mutate(s,a).catch(St)},[r]);if(i.error&&Ku(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:o,mutateAsync:i.mutate}}const Zu=I.createContext(null),pw=Zu.Provider,ed=()=>I.useContext(Zu);var Ie=(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))(Ie||{});const td=I.createContext(void 0);function un(){const e=I.useContext(td);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const hw=(()=>{const e={};return Object.values(Ie).forEach(t=>{e[t]={}}),e})();function mw({children:e}){const[t,n]=I.useState(hw),r=I.useCallback((u,d,h=!0)=>{n(f=>{const y={...f};return y[u]=y[u]||{},y[u][d]=h,y})},[n]),i=I.useCallback((u,d)=>!!t[u]?.[d],[t]),o=I.useCallback((u,d)=>t[u]?.[d],[t]),s=I.useCallback((u,d)=>{n(h=>{const f={...h};return delete f[u]?.[d],f})},[n]),a=I.useCallback(u=>{n(d=>{const h={...d};return h[u]={},h})},[n]),l=I.useCallback((u,d)=>{n(h=>{const f={...h};return f[u]=f[u]||{},d.forEach(y=>{f[u][y]=!0}),f})},[n]),c=I.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(td.Provider,{value:c,children:e})}new TextEncoder;const Ss=new TextDecoder;function gw(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 yw(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(typeof e=="string"?e:Ss.decode(e),{alphabet:"base64url"});let t=e;t instanceof Uint8Array&&(t=Ss.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return gw(t)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}}class vw extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(t,n){super(t,n),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}class qn extends vw{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"}function bw(e){return typeof e=="object"&&e!==null}const ww=e=>{if(!bw(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 xw(e){if(typeof e!="string")throw new qn("JWTs must use Compact JWS serialization, JWT must be a string");const{1:t,length:n}=e.split(".");if(n===5)throw new qn("Only JWTs using Compact JWS serialization can be decoded");if(n!==3)throw new qn("Invalid JWT");if(!t)throw new qn("JWTs must contain a payload");let r;try{r=yw(t)}catch{throw new qn("Failed to base64url decode the payload")}let i;try{i=JSON.parse(Ss.decode(r))}catch{throw new qn("Failed to parse the decoded payload as JSON")}if(!ww(i))throw new qn("Invalid JWT Claims Set");return i}const Cs="amp-labs_jwt_",Iw=600*1e3,Bl=(e,t)=>`${e}:${t}`,Vl=e=>`${Cs}${e}`,nd=I.createContext(null),Sw=e=>{try{const t=xw(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 Cw({getTokenCallback:e,children:t}){const[n,r]=I.useState(new Map);I.useEffect(()=>{try{const l=new Map,c=Date.now();Object.keys(sessionStorage).forEach(u=>{if(u.startsWith(Cs)){const d=u.replace(Cs,""),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=I.useCallback((l,c)=>{const u=Bl(l,c),d=Date.now(),h=n.get(u);if(h&&h.expiresAt>d)return h.token;n.delete(u);const f=Vl(u),y=sessionStorage.getItem(f);if(y)try{const v=JSON.parse(y);if(v.expiresAt>d)return r(g=>new Map(g).set(u,v)),v.token;sessionStorage.removeItem(f)}catch{sessionStorage.removeItem(f)}return null},[n]),o=I.useCallback(async(l,c,u)=>{const d=Bl(l,c),f=await Sw(u)||Date.now()+Iw,y={token:u,expiresAt:f};r(v=>new Map(v).set(d,y));try{sessionStorage.setItem(Vl(d),JSON.stringify(y))}catch{console.warn("Failed to store JWT token in sessionStorage")}},[]),s=I.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(nd.Provider,{value:a,children:t})}const Ow=()=>{const e=I.useContext(nd);if(!e)throw new Error("useJwtToken must be used within a JwtTokenProvider");return e},oa=I.createContext(null);function Ke(){const e=I.useContext(oa);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
|
|
2
|
-
component is wrapped with AmpersandProvider`);return e}const Ew=new ew({defaultOptions:{queries:{retry:(e,t)=>{if(t instanceof ea){const n=t.response.status;if(n>=400&&n<500)return!1}return e<3}}}});function _w(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(tw,{client:Ew,children:p.jsx(oa.Provider,{value:a,children:p.jsx(mw,{children:p.jsx(Cw,{getTokenCallback:i||null,children:p.jsx(pw,{value:t||null,children:o})})})})})}var rd=Symbol.for("immer-nothing"),Ul=Symbol.for("immer-draftable"),jt=Symbol.for("immer-state"),Tw=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 _t(e,...t){if(process.env.NODE_ENV!=="production"){const n=Tw[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 ti=Object.getPrototypeOf;function gr(e){return!!e&&!!e[jt]}function Gn(e){return e?id(e)||Array.isArray(e)||!!e[Ul]||!!e.constructor?.[Ul]||ci(e)||go(e):!1}var Nw=Object.prototype.constructor.toString(),ql=new WeakMap;function id(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let r=ql.get(n);return r===void 0&&(r=Function.toString.call(n),ql.set(n,r)),r===Nw}function Zi(e,t,n=!0){mo(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function mo(e){const t=e[jt];return t?t.type_:Array.isArray(e)?1:ci(e)?2:go(e)?3:0}function Os(e,t){return mo(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function od(e,t,n){const r=mo(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function kw(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function ci(e){return e instanceof Map}function go(e){return e instanceof Set}function zn(e){return e.copy_||e.base_}function Es(e,t){if(ci(e))return new Map(e);if(go(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=id(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[jt];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(ti(e),r)}else{const r=ti(e);if(r!==null&&n)return{...e};const i=Object.create(r);return Object.assign(i,e)}}function sa(e,t=!1){return yo(e)||gr(e)||!Gn(e)||(mo(e)>1&&Object.defineProperties(e,{set:Ai,add:Ai,clear:Ai,delete:Ai}),Object.freeze(e),t&&Object.values(e).forEach(n=>sa(n,!0))),e}function Rw(){_t(2)}var Ai={value:Rw};function yo(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var Aw={};function Xn(e){const t=Aw[e];return t||_t(0,e),t}var ni;function sd(){return ni}function Fw(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function $l(e,t){t&&(Xn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function _s(e){Ts(e),e.drafts_.forEach(Pw),e.drafts_=null}function Ts(e){e===ni&&(ni=e.parent_)}function zl(e){return ni=Fw(ni,e)}function Pw(e){const t=e[jt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Kl(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[jt].modified_&&(_s(t),_t(4)),Gn(e)&&(e=eo(t,e),t.parent_||to(t,e)),t.patches_&&Xn("Patches").generateReplacementPatches_(n[jt].base_,e,t.patches_,t.inversePatches_)):e=eo(t,n,[]),_s(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==rd?e:void 0}function eo(e,t,n){if(yo(t))return t;const r=e.immer_.shouldUseStrictIteration(),i=t[jt];if(!i)return Zi(t,(o,s)=>Hl(e,i,t,o,s,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return to(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const o=i.copy_;let s=o,a=!1;i.type_===3&&(s=new Set(o),o.clear(),a=!0),Zi(s,(l,c)=>Hl(e,i,o,l,c,n,a),r),to(e,o,!1),n&&e.patches_&&Xn("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function Hl(e,t,n,r,i,o,s){if(i==null||typeof i!="object"&&!s)return;const a=yo(i);if(!(a&&!s)){if(process.env.NODE_ENV!=="production"&&i===n&&_t(5),gr(i)){const l=o&&t&&t.type_!==3&&!Os(t.assigned_,r)?o.concat(r):void 0,c=eo(e,i,l);if(od(n,r,c),gr(c))e.canAutoFreeze_=!1;else return}else s&&n.add(i);if(Gn(i)&&!a){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&a)return;eo(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(ci(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&to(e,i)}}}function to(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&sa(t,n)}function Dw(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:sd(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,o=aa;n&&(i=[r],o=ri);const{revoke:s,proxy:a}=Proxy.revocable(i,o);return r.draft_=a,r.revoke_=s,a}var aa={get(e,t){if(t===jt)return e;const n=zn(e);if(!Os(n,t))return Mw(e,n,t);const r=n[t];return e.finalized_||!Gn(r)?r:r===Bo(e.base_,t)?(Vo(e),e.copy_[t]=ks(r,e)):r},has(e,t){return t in zn(e)},ownKeys(e){return Reflect.ownKeys(zn(e))},set(e,t,n){const r=ad(zn(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=Bo(zn(e),t),o=i?.[jt];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(kw(n,i)&&(n!==void 0||Os(e.base_,t)))return!0;Vo(e),Ns(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 Bo(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Vo(e),Ns(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=zn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){_t(11)},getPrototypeOf(e){return ti(e.base_)},setPrototypeOf(){_t(12)}},ri={};Zi(aa,(e,t)=>{ri[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});ri.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&_t(13),ri.set.call(this,e,t,void 0)};ri.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&_t(14),aa.set.call(this,e[0],t,n,e[0])};function Bo(e,t){const n=e[jt];return(n?zn(n):e)[t]}function Mw(e,t,n){const r=ad(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}function ad(e,t){if(!(t in e))return;let n=ti(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=ti(n)}}function Ns(e){e.modified_||(e.modified_=!0,e.parent_&&Ns(e.parent_))}function Vo(e){e.copy_||(e.copy_=Es(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var jw=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,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"&&_t(6),r!==void 0&&typeof r!="function"&&_t(7);let i;if(Gn(t)){const o=zl(this),s=ks(t,void 0);let a=!0;try{i=n(s),a=!1}finally{a?_s(o):Ts(o)}return $l(o,r),Kl(i,o)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===rd&&(i=void 0),this.autoFreeze_&&sa(i,!0),r){const o=[],s=[];Xn("Patches").generateReplacementPatches_(t,i,o,s),r(o,s)}return i}else _t(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?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof e?.useStrictIteration=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Gn(e)||_t(8),gr(e)&&(e=Lw(e));const t=zl(this),n=ks(e,void 0);return n[jt].isManual_=!0,Ts(t),n}finishDraft(e,t){const n=e&&e[jt];(!n||!n.isManual_)&&_t(9);const{scope_:r}=n;return $l(r,t),Kl(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}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=Xn("Patches").applyPatches_;return gr(e)?r(e,t):this.produce(e,i=>r(i,t))}};function ks(e,t){const n=ci(e)?Xn("MapSet").proxyMap_(e,t):go(e)?Xn("MapSet").proxySet_(e,t):Dw(e,t);return(t?t.scope_:sd()).drafts_.push(n),n}function Lw(e){return gr(e)||_t(10,e),ld(e)}function ld(e){if(!Gn(e)||yo(e))return e;const t=e[jt];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Es(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Es(e,!0);return Zi(n,(i,o)=>{od(n,i,ld(o))},r),t&&(t.finalized_=!1),n}var Bw=new jw,Ft=Bw.produce,kn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Hr={exports:{}};Hr.exports;var Jl;function Vw(){return Jl||(Jl=1,(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]",v="[object Map]",g="[object Number]",b="[object Null]",m="[object Object]",w="[object Promise]",C="[object Proxy]",E="[object RegExp]",_="[object Set]",A="[object String]",k="[object Symbol]",L="[object Undefined]",M="[object WeakMap]",F="[object ArrayBuffer]",j="[object DataView]",G="[object Float32Array]",P="[object Float64Array]",V="[object Int8Array]",Y="[object Int16Array]",ae="[object Int32Array]",pe="[object Uint8Array]",ge="[object Uint8ClampedArray]",x="[object Uint16Array]",J="[object Uint32Array]",B=/[\\^$.*+?()[\]{}|]/g,S=/^\[object .+?Constructor\]$/,$=/^(?:0|[1-9]\d*)$/,q={};q[G]=q[P]=q[V]=q[Y]=q[ae]=q[pe]=q[ge]=q[x]=q[J]=!0,q[a]=q[l]=q[F]=q[u]=q[j]=q[d]=q[h]=q[f]=q[v]=q[g]=q[m]=q[E]=q[_]=q[A]=q[M]=!1;var X=typeof kn=="object"&&kn&&kn.Object===Object&&kn,ie=typeof self=="object"&&self&&self.Object===Object&&self,ne=X||ie||Function("return this")(),se=t&&!t.nodeType&&t,ee=se&&!0&&e&&!e.nodeType&&e,me=ee&&ee.exports===se,U=me&&X.process,ye=(function(){try{return U&&U.binding&&U.binding("util")}catch{}})(),Z=ye&&ye.isTypedArray;function Be(O,N){for(var z=-1,oe=O==null?0:O.length,Ve=0,ve=[];++z<oe;){var He=O[z];N(He,z,O)&&(ve[Ve++]=He)}return ve}function Fe(O,N){for(var z=-1,oe=N.length,Ve=O.length;++z<oe;)O[Ve+z]=N[z];return O}function Ae(O,N){for(var z=-1,oe=O==null?0:O.length;++z<oe;)if(N(O[z],z,O))return!0;return!1}function We(O,N){for(var z=-1,oe=Array(O);++z<O;)oe[z]=N(z);return oe}function et(O){return function(N){return O(N)}}function tt(O,N){return O.has(N)}function xe(O,N){return O?.[N]}function ot(O){var N=-1,z=Array(O.size);return O.forEach(function(oe,Ve){z[++N]=[Ve,oe]}),z}function bt(O,N){return function(z){return O(N(z))}}function at(O){var N=-1,z=Array(O.size);return O.forEach(function(oe){z[++N]=oe}),z}var Ge=Array.prototype,D=Function.prototype,K=Object.prototype,R=ne["__core-js_shared__"],re=D.toString,le=K.hasOwnProperty,Ue=(function(){var O=/[^.]+$/.exec(R&&R.keys&&R.keys.IE_PROTO||"");return O?"Symbol(src)_1."+O:""})(),wt=K.toString,lt=RegExp("^"+re.call(le).replace(B,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ft=me?ne.Buffer:void 0,Pe=ne.Symbol,Oe=ne.Uint8Array,xt=K.propertyIsEnumerable,ct=Ge.splice,Ct=Pe?Pe.toStringTag:void 0,In=Object.getOwnPropertySymbols,Sn=ft?ft.isBuffer:void 0,Cn=bt(Object.keys,Object),nn=ar(ne,"DataView"),Qt=ar(ne,"Map"),On=ar(ne,"Promise"),qe=ar(ne,"Set"),nt=ar(ne,"WeakMap"),de=ar(Object,"create"),Se=Vn(nn),It=Vn(Qt),hn=Vn(On),te=Vn(qe),fe=Vn(nt),ce=Pe?Pe.prototype:void 0,Ce=ce?ce.valueOf:void 0;function De(O){var N=-1,z=O==null?0:O.length;for(this.clear();++N<z;){var oe=O[N];this.set(oe[0],oe[1])}}function Vt(){this.__data__=de?de(null):{},this.size=0}function Ut(O){var N=this.has(O)&&delete this.__data__[O];return this.size-=N?1:0,N}function ut(O){var N=this.__data__;if(de){var z=N[O];return z===r?void 0:z}return le.call(N,O)?N[O]:void 0}function Ot(O){var N=this.__data__;return de?N[O]!==void 0:le.call(N,O)}function Me(O,N){var z=this.__data__;return this.size+=this.has(O)?0:1,z[O]=de&&N===void 0?r:N,this}De.prototype.clear=Vt,De.prototype.delete=Ut,De.prototype.get=ut,De.prototype.has=Ot,De.prototype.set=Me;function pt(O){var N=-1,z=O==null?0:O.length;for(this.clear();++N<z;){var oe=O[N];this.set(oe[0],oe[1])}}function Fo(){this.__data__=[],this.size=0}function Po(O){var N=this.__data__,z=Ci(N,O);if(z<0)return!1;var oe=N.length-1;return z==oe?N.pop():ct.call(N,z,1),--this.size,!0}function wi(O){var N=this.__data__,z=Ci(N,O);return z<0?void 0:N[z][1]}function xi(O){return Ci(this.__data__,O)>-1}function Ii(O,N){var z=this.__data__,oe=Ci(z,O);return oe<0?(++this.size,z.push([O,N])):z[oe][1]=N,this}pt.prototype.clear=Fo,pt.prototype.delete=Po,pt.prototype.get=wi,pt.prototype.has=xi,pt.prototype.set=Ii;function rn(O){var N=-1,z=O==null?0:O.length;for(this.clear();++N<z;){var oe=O[N];this.set(oe[0],oe[1])}}function Si(){this.size=0,this.__data__={hash:new De,map:new(Qt||pt),string:new De}}function Ee(O){var N=Oi(this,O).delete(O);return this.size-=N?1:0,N}function Gt(O){return Oi(this,O).get(O)}function Pr(O){return Oi(this,O).has(O)}function Bn(O,N){var z=Oi(this,O),oe=z.size;return z.set(O,N),this.size+=z.size==oe?0:1,this}rn.prototype.clear=Si,rn.prototype.delete=Ee,rn.prototype.get=Gt,rn.prototype.has=Pr,rn.prototype.set=Bn;function sr(O){var N=-1,z=O==null?0:O.length;for(this.__data__=new rn;++N<z;)this.add(O[N])}function Dr(O){return this.__data__.set(O,r),this}function Sh(O){return this.__data__.has(O)}sr.prototype.add=sr.prototype.push=Dr,sr.prototype.has=Sh;function En(O){var N=this.__data__=new pt(O);this.size=N.size}function Ch(){this.__data__=new pt,this.size=0}function Oh(O){var N=this.__data__,z=N.delete(O);return this.size=N.size,z}function Eh(O){return this.__data__.get(O)}function _h(O){return this.__data__.has(O)}function Th(O,N){var z=this.__data__;if(z instanceof pt){var oe=z.__data__;if(!Qt||oe.length<n-1)return oe.push([O,N]),this.size=++z.size,this;z=this.__data__=new rn(oe)}return z.set(O,N),this.size=z.size,this}En.prototype.clear=Ch,En.prototype.delete=Oh,En.prototype.get=Eh,En.prototype.has=_h,En.prototype.set=Th;function Nh(O,N){var z=Ei(O),oe=!z&&zh(O),Ve=!z&&!oe&&Do(O),ve=!z&&!oe&&!Ve&&Il(O),He=z||oe||Ve||ve,st=He?We(O.length,String):[],dt=st.length;for(var ze in O)le.call(O,ze)&&!(He&&(ze=="length"||Ve&&(ze=="offset"||ze=="parent")||ve&&(ze=="buffer"||ze=="byteLength"||ze=="byteOffset")||Bh(ze,dt)))&&st.push(ze);return st}function Ci(O,N){for(var z=O.length;z--;)if(vl(O[z][0],N))return z;return-1}function kh(O,N,z){var oe=N(O);return Ei(O)?oe:Fe(oe,z(O))}function Mr(O){return O==null?O===void 0?L:b:Ct&&Ct in Object(O)?jh(O):$h(O)}function hl(O){return jr(O)&&Mr(O)==a}function ml(O,N,z,oe,Ve){return O===N?!0:O==null||N==null||!jr(O)&&!jr(N)?O!==O&&N!==N:Rh(O,N,z,oe,ml,Ve)}function Rh(O,N,z,oe,Ve,ve){var He=Ei(O),st=Ei(N),dt=He?l:_n(O),ze=st?l:_n(N);dt=dt==a?m:dt,ze=ze==a?m:ze;var Rt=dt==m,Xt=ze==m,ht=dt==ze;if(ht&&Do(O)){if(!Do(N))return!1;He=!0,Rt=!1}if(ht&&!Rt)return ve||(ve=new En),He||Il(O)?gl(O,N,z,oe,Ve,ve):Dh(O,N,dt,z,oe,Ve,ve);if(!(z&i)){var qt=Rt&&le.call(O,"__wrapped__"),$t=Xt&&le.call(N,"__wrapped__");if(qt||$t){var Tn=qt?O.value():O,mn=$t?N.value():N;return ve||(ve=new En),Ve(Tn,mn,z,oe,ve)}}return ht?(ve||(ve=new En),Mh(O,N,z,oe,Ve,ve)):!1}function Ah(O){if(!xl(O)||Uh(O))return!1;var N=bl(O)?lt:S;return N.test(Vn(O))}function Fh(O){return jr(O)&&wl(O.length)&&!!q[Mr(O)]}function Ph(O){if(!qh(O))return Cn(O);var N=[];for(var z in Object(O))le.call(O,z)&&z!="constructor"&&N.push(z);return N}function gl(O,N,z,oe,Ve,ve){var He=z&i,st=O.length,dt=N.length;if(st!=dt&&!(He&&dt>st))return!1;var ze=ve.get(O);if(ze&&ve.get(N))return ze==N;var Rt=-1,Xt=!0,ht=z&o?new sr:void 0;for(ve.set(O,N),ve.set(N,O);++Rt<st;){var qt=O[Rt],$t=N[Rt];if(oe)var Tn=He?oe($t,qt,Rt,N,O,ve):oe(qt,$t,Rt,O,N,ve);if(Tn!==void 0){if(Tn)continue;Xt=!1;break}if(ht){if(!Ae(N,function(mn,Un){if(!tt(ht,Un)&&(qt===mn||Ve(qt,mn,z,oe,ve)))return ht.push(Un)})){Xt=!1;break}}else if(!(qt===$t||Ve(qt,$t,z,oe,ve))){Xt=!1;break}}return ve.delete(O),ve.delete(N),Xt}function Dh(O,N,z,oe,Ve,ve,He){switch(z){case j:if(O.byteLength!=N.byteLength||O.byteOffset!=N.byteOffset)return!1;O=O.buffer,N=N.buffer;case F:return!(O.byteLength!=N.byteLength||!ve(new Oe(O),new Oe(N)));case u:case d:case g:return vl(+O,+N);case h:return O.name==N.name&&O.message==N.message;case E:case A:return O==N+"";case v:var st=ot;case _:var dt=oe&i;if(st||(st=at),O.size!=N.size&&!dt)return!1;var ze=He.get(O);if(ze)return ze==N;oe|=o,He.set(O,N);var Rt=gl(st(O),st(N),oe,Ve,ve,He);return He.delete(O),Rt;case k:if(Ce)return Ce.call(O)==Ce.call(N)}return!1}function Mh(O,N,z,oe,Ve,ve){var He=z&i,st=yl(O),dt=st.length,ze=yl(N),Rt=ze.length;if(dt!=Rt&&!He)return!1;for(var Xt=dt;Xt--;){var ht=st[Xt];if(!(He?ht in N:le.call(N,ht)))return!1}var qt=ve.get(O);if(qt&&ve.get(N))return qt==N;var $t=!0;ve.set(O,N),ve.set(N,O);for(var Tn=He;++Xt<dt;){ht=st[Xt];var mn=O[ht],Un=N[ht];if(oe)var Sl=He?oe(Un,mn,ht,N,O,ve):oe(mn,Un,ht,O,N,ve);if(!(Sl===void 0?mn===Un||Ve(mn,Un,z,oe,ve):Sl)){$t=!1;break}Tn||(Tn=ht=="constructor")}if($t&&!Tn){var _i=O.constructor,Ti=N.constructor;_i!=Ti&&"constructor"in O&&"constructor"in N&&!(typeof _i=="function"&&_i instanceof _i&&typeof Ti=="function"&&Ti instanceof Ti)&&($t=!1)}return ve.delete(O),ve.delete(N),$t}function yl(O){return kh(O,Jh,Lh)}function Oi(O,N){var z=O.__data__;return Vh(N)?z[typeof N=="string"?"string":"hash"]:z.map}function ar(O,N){var z=xe(O,N);return Ah(z)?z:void 0}function jh(O){var N=le.call(O,Ct),z=O[Ct];try{O[Ct]=void 0;var oe=!0}catch{}var Ve=wt.call(O);return oe&&(N?O[Ct]=z:delete O[Ct]),Ve}var Lh=In?function(O){return O==null?[]:(O=Object(O),Be(In(O),function(N){return xt.call(O,N)}))}:Wh,_n=Mr;(nn&&_n(new nn(new ArrayBuffer(1)))!=j||Qt&&_n(new Qt)!=v||On&&_n(On.resolve())!=w||qe&&_n(new qe)!=_||nt&&_n(new nt)!=M)&&(_n=function(O){var N=Mr(O),z=N==m?O.constructor:void 0,oe=z?Vn(z):"";if(oe)switch(oe){case Se:return j;case It:return v;case hn:return w;case te:return _;case fe:return M}return N});function Bh(O,N){return N=N??s,!!N&&(typeof O=="number"||$.test(O))&&O>-1&&O%1==0&&O<N}function Vh(O){var N=typeof O;return N=="string"||N=="number"||N=="symbol"||N=="boolean"?O!=="__proto__":O===null}function Uh(O){return!!Ue&&Ue in O}function qh(O){var N=O&&O.constructor,z=typeof N=="function"&&N.prototype||K;return O===z}function $h(O){return wt.call(O)}function Vn(O){if(O!=null){try{return re.call(O)}catch{}try{return O+""}catch{}}return""}function vl(O,N){return O===N||O!==O&&N!==N}var zh=hl((function(){return arguments})())?hl:function(O){return jr(O)&&le.call(O,"callee")&&!xt.call(O,"callee")},Ei=Array.isArray;function Kh(O){return O!=null&&wl(O.length)&&!bl(O)}var Do=Sn||Qh;function Hh(O,N){return ml(O,N)}function bl(O){if(!xl(O))return!1;var N=Mr(O);return N==f||N==y||N==c||N==C}function wl(O){return typeof O=="number"&&O>-1&&O%1==0&&O<=s}function xl(O){var N=typeof O;return O!=null&&(N=="object"||N=="function")}function jr(O){return O!=null&&typeof O=="object"}var Il=Z?et(Z):Fh;function Jh(O){return Kh(O)?Nh(O):Ph(O)}function Wh(){return[]}function Qh(){return!1}e.exports=Hh})(Hr,Hr.exports)),Hr.exports}var Uw=Vw();const cd=_r(Uw),Ye=async(e,t)=>{if(e instanceof ea){const{status:n,statusText:r}=e.response;console.error(n===500?"Internal Server Error (500):":n===400?"Bad Request (400):":`Error (${n}):`,r);try{const o=await e.response.clone().json(),s=o?.causes?.join(`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react/jsx-runtime"),I=require("react");require("react-dom");function Yh(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 H=Yh(I),Zh="https://api.withampersand.com/v1".replace(/\/+$/,"");class Zs{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Zh}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||_u}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 em=new Zs,ho=class ho{constructor(t=em){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 rm(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?ho.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 ea(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:nm(a.body)||a.body instanceof URLSearchParams||tm(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}};ho.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let an=ho;function tm(e){return typeof Blob<"u"&&e instanceof Blob}function nm(e){return typeof FormData<"u"&&e instanceof FormData}class ea extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class rm extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class ae extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function N(e,t){const n=e[t];return n!=null}function _u(e,t=""){return Object.keys(e).map(n=>Nu(n,e[n],t)).filter(n=>n.length>0).join("&")}function Nu(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 Nu(e,i,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?_u(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function Qe(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class Ue{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class gr{constructor(t){this.raw=t}async value(){}}class Ol{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function im(e){return om(e)}function om(e,t){return e==null?e:{name:e.name,valuePrefix:N(e,"valuePrefix")?e.valuePrefix:void 0}}function sm(e){return am(e)}function am(e,t){return e==null?e:{attachmentType:e.attachmentType,header:N(e,"header")?im(e.header):void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0}}function lm(e){return cm(e)}function cm(e,t){return e==null?e:{fieldUsed:N(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:N(e,"keyFormat")?e.keyFormat:void 0}}function um(e){return dm(e)}function dm(e,t){return e==null?e:{name:e.name,valuePrefix:N(e,"valuePrefix")?e.valuePrefix:void 0}}function fm(e){return pm(e)}function pm(e,t){return e==null?e:{name:e.name}}function hm(e){return mm(e)}function mm(e,t){return e==null?e:{attachmentType:e.attachmentType,query:N(e,"query")?fm(e.query):void 0,header:N(e,"header")?um(e.header):void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0}}function gm(e){return ym(e)}function ym(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0,includeFullRecords:N(e,"includeFullRecords")?e.includeFullRecords:void 0}}function vm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,includeFullRecords:e.includeFullRecords}}function bm(e){return wm(e)}function wm(e,t){return e==null?e:{url:e.url,method:N(e,"method")?e.method:void 0,successStatusCodes:N(e,"successStatusCodes")?e.successStatusCodes:void 0}}const El={ApiKey:"apiKey",Basic:"basic"};function xm(e){return Im(e)}function Im(e,t){return e}function Sm(e){return Cm(e)}function Cm(e,t){return e==null?e:{days:N(e,"days")?e.days:void 0,fullHistory:N(e,"fullHistory")?e.fullHistory:void 0}}function Om(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Tu(e){return Em(e)}function Em(e,t){return e==null?e:{defaultPeriod:Sm(e.defaultPeriod)}}function _m(e){if(e!==void 0)return e===null?null:{defaultPeriod:Om(e.defaultPeriod)}}function Nm(e){return Tm(e)}function Tm(e,t){return e==null?e:{days:N(e,"days")?e.days:void 0,fullHistory:N(e,"fullHistory")?e.fullHistory:void 0}}function km(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Rm(e){return Am(e)}function Am(e,t){return e==null?e:{defaultPeriod:Nm(e.defaultPeriod)}}function ku(e){if(e!==void 0)return e===null?null:{defaultPeriod:km(e.defaultPeriod)}}function Fm(e){return Pm(e)}function Pm(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function Ru(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Dm(e){return Mm(e)}function Mm(e,t){return e==null?e:{mappedValue:e.mappedValue,mappedDisplayValue:e.mappedDisplayValue}}function jm(e){if(e!==void 0)return e===null?null:{mappedValue:e.mappedValue,mappedDisplayValue:e.mappedDisplayValue}}function Lm(e){return Bm(e)}function Bm(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0,prompt:N(e,"prompt")?e.prompt:void 0,mappedValues:N(e,"mappedValues")?e.mappedValues.map(Dm):void 0,fieldName:N(e,"fieldName")?e.fieldName:void 0}}function Au(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(jm),fieldName:e.fieldName}}function Vm(e){return Um(e)}function Um(e,t){return e}function qm(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(Au),selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:ku(e.backfill)}}function $m(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Qe(e.objects,qm)}}function zm(e){return Km(e)}function Km(e,t){return e==null?e:{enabled:e.enabled}}function Fu(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Hm(e){return Jm(e)}function Jm(e,t){return e==null?e:{stringValue:N(e,"stringValue")?e.stringValue:void 0,integerValue:N(e,"integerValue")?e.integerValue:void 0,booleanValue:N(e,"booleanValue")?e.booleanValue:void 0}}function Wm(e){if(e!==void 0)return e===null?null:{stringValue:e.stringValue,integerValue:e.integerValue,booleanValue:e.booleanValue}}const Qm={Always:"always",Never:"never"},Gm={Always:"always",Never:"never"};function Xm(e){return Ym(e)}function Ym(e,t){return e==null?e:{default:N(e,"default")?Hm(e.default):void 0,writeOnCreate:N(e,"writeOnCreate")?e.writeOnCreate:void 0,writeOnUpdate:N(e,"writeOnUpdate")?e.writeOnUpdate:void 0}}function Pu(e){if(e!==void 0)return e===null?null:{default:Wm(e.default),writeOnCreate:e.writeOnCreate,writeOnUpdate:e.writeOnUpdate}}function Zm(e){let t=!0;return t=t&&"value"in e,t}function eg(e,t){return e==null?e:{value:e.value,applyOnUpdate:N(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function tg(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function ng(e){let t=!0;return t=t&&"value"in e,t}function rg(e,t){return e==null?e:{value:e.value,applyOnUpdate:N(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function ig(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function og(e){let t=!0;return t=t&&"value"in e,t}function sg(e,t){return e==null?e:{value:e.value,applyOnUpdate:N(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function ag(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function lg(e){return cg(e)}function cg(e,t){return e==null?e:{...eg(e),...rg(e),...sg(e)}}function Du(e){if(e!==void 0)return e===null?null:Zm(e)?tg(e):ng(e)?ig(e):og(e)?ag(e):{}}function ug(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,deletionSettings:Fu(e.deletionSettings),selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:Qe(e.selectedValueDefaults,Du),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:Qe(e.selectedFieldSettings,Pu)}}function dg(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Qe(e.objects,ug)}}function fg(e){return pg(e)}function pg(e,t){return e==null?e:{enabled:e.enabled}}function hg(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function mg(e){return gg(e)}function gg(e,t){return e==null?e:{enabled:e.enabled}}function yg(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function vg(e){return bg(e)}function bg(e,t){return e==null?e:{enabled:e.enabled,watchFieldsAuto:N(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:N(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function wg(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function xg(e){return Ig(e)}function Ig(e,t){return e==null?e:{apiKeyAsBasic:N(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:N(e,"apiKeyAsBasicOpts")?lm(e.apiKeyAsBasicOpts):void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0}}function Sg(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Ti(e){return Cg(e)}function Cg(e,t){return e==null?e:{supported:e.supported,defaultRecordLimit:N(e,"defaultRecordLimit")?e.defaultRecordLimit:void 0,objectRecordLimits:N(e,"objectRecordLimits")?e.objectRecordLimits:void 0}}function Og(e){return Eg(e)}function Eg(e,t){return e==null?e:{_delete:Ti(e.delete),create:Ti(e.create),update:Ti(e.update),upsert:Ti(e.upsert)}}function _g(e){return Ng(e)}function Ng(e,t){return e==null?e:{value:e.value}}function Tg(e){return kg(e)}function kg(e,t){return e==null?e:{brandingRemoval:N(e,"brandingRemoval")?_g(e.brandingRemoval):void 0}}function ki(e){return Rg(e)}function Rg(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:N(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0,entitlements:N(e,"entitlements")?Tg(e.entitlements):void 0}}function Ag(e){return Fg(e)}function Fg(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function Pg(e){return Dg(e)}function Dg(e,t){return e==null?e:{objectName:e.objectName,schedule:N(e,"schedule")?e.schedule:void 0,disabled:N(e,"disabled")?e.disabled:void 0,destination:N(e,"destination")?e.destination:void 0,selectedFields:e.selectedFields,selectedValueMappings:N(e,"selectedValueMappings")?e.selectedValueMappings:void 0,dynamicMappingsInput:N(e,"dynamicMappingsInput")?e.dynamicMappingsInput.map(Lm):void 0,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:N(e,"selectedFieldsAuto")?Vm(e.selectedFieldsAuto):void 0,backfill:N(e,"backfill")?Rm(e.backfill):void 0}}function Mg(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(Au),selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:ku(e.backfill)}}function jg(e){return Lg(e)}function Lg(e,t){return e==null?e:{objects:Qe(e.objects,Pg)}}function Bg(e){if(e!==void 0)return e===null?null:{objects:Qe(e.objects,Mg)}}function Vg(e){return Ug(e)}function Ug(e,t){return e==null?e:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:N(e,"createEvent")?fg(e.createEvent):void 0,updateEvent:N(e,"updateEvent")?vg(e.updateEvent):void 0,deleteEvent:N(e,"deleteEvent")?mg(e.deleteEvent):void 0}}function qg(e){if(e!==void 0)return e===null?null:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:hg(e.createEvent),updateEvent:wg(e.updateEvent),deleteEvent:yg(e.deleteEvent)}}function $g(e){return zg(e)}function zg(e,t){return e==null?e:{objects:Qe(e.objects,Vg)}}function Kg(e){if(e!==void 0)return e===null?null:{objects:Qe(e.objects,qg)}}function Hg(e){return Jg(e)}function Jg(e,t){return e==null?e:{objectName:e.objectName,deletionSettings:N(e,"deletionSettings")?zm(e.deletionSettings):void 0,selectedValueDefaults:N(e,"selectedValueDefaults")?Qe(e.selectedValueDefaults,lg):void 0,selectedFieldSettings:N(e,"selectedFieldSettings")?Qe(e.selectedFieldSettings,Xm):void 0}}function Wg(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,deletionSettings:Fu(e.deletionSettings),selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:Qe(e.selectedValueDefaults,Du),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:Qe(e.selectedFieldSettings,Pu)}}function Qg(e){return Gg(e)}function Gg(e,t){return e==null?e:{objects:N(e,"objects")?Qe(e.objects,Hg):void 0}}function Xg(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Qe(e.objects,Wg)}}function Yg(e){return Zg(e)}function Zg(e,t){return e==null?e:{provider:e.provider,read:N(e,"read")?jg(e.read):void 0,write:N(e,"write")?Qg(e.write):void 0,proxy:N(e,"proxy")?Fm(e.proxy):void 0,subscribe:N(e,"subscribe")?$g(e.subscribe):void 0}}function ey(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:Bg(e.read),write:Xg(e.write),proxy:Ru(e.proxy),subscribe:Kg(e.subscribe)}}function ty(e){return ny(e)}function ny(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:Yg(e.content)}}function ry(e){return iy(e)}function iy(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0}}function Mu(e){return oy(e)}function oy(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0}}function sy(e){return ay(e)}function ay(e,t){return e==null?e:{token:e.token,issuedAt:N(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:N(e,"expiresAt")?new Date(e.expiresAt):void 0}}function ly(e){return cy(e)}function cy(e,t){return e==null?e:{token:e.token,issuedAt:N(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:N(e,"expiresAt")?new Date(e.expiresAt):void 0}}function uy(e){return dy(e)}function dy(e,t){return e==null?e:{accessToken:N(e,"accessToken")?sy(e.accessToken):void 0,refreshToken:N(e,"refreshToken")?ly(e.refreshToken):void 0,scopes:N(e,"scopes")?e.scopes:void 0}}function zi(e){return fy(e)}function fy(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:N(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:N(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0}}function py(e){return hy(e)}function hy(e,t){return e==null?e:{value:e.value,source:e.source,displayName:N(e,"displayName")?e.displayName:void 0}}function ta(e){if(e!==void 0)return e===null?null:{value:e.value,source:e.source,displayName:e.displayName}}function Kr(e){return my(e)}function my(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:N(e,"providerApp")?zi(e.providerApp):void 0,group:Mu(e.group),consumer:ry(e.consumer),providerWorkspaceRef:N(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerConsumerRef:N(e,"providerConsumerRef")?e.providerConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0,authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:N(e,"oauth2AuthorizationCode")?uy(e.oauth2AuthorizationCode):void 0,apiKey:N(e,"apiKey")?e.apiKey:void 0,providerMetadata:N(e,"providerMetadata")?Qe(e.providerMetadata,py):void 0}}function ju(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function Lu(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function Bu(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 gy(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 yy(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 Vu(e){if(e!==void 0)return e===null?null:{accessToken:gy(e.accessToken),refreshToken:yy(e.refreshToken),scopes:e.scopes}}function vy(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:Qe(e.providerMetadata,ta),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,customAuth:e.customAuth,basicAuth:ju(e.basicAuth),oauth2ClientCredentials:Lu(e.oauth2ClientCredentials),oauth2PasswordCredentials:Bu(e.oauth2PasswordCredentials),oauth2AuthorizationCode:Vu(e.oauth2AuthorizationCode)}}function by(e){return wy(e)}function wy(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function xy(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Iy(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:ey(e.content)}}function Sy(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:Iy(e.config)}}function Cy(e){return Oy(e)}function Oy(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0,useModule:N(e,"useModule")?e.useModule:void 0}}function Ey(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,useModule:e.useModule}}function _y(e){return Ny(e)}function Ny(e,t){return e==null?e:{mode:N(e,"mode")?e.mode:void 0,pageSize:N(e,"pageSize")?e.pageSize:void 0}}function Ty(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function ky(e){let t=!0;return t=t&&"fieldName"in e,t}function Ry(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:N(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Ay(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function Fy(e){let t=!0;return t=t&&"mapToName"in e,t}function Uu(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:N(e,"default")?e.default:void 0,prompt:N(e,"prompt")?e.prompt:void 0}}function Py(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function _l(e){return Dy(e)}function Dy(e,t){return e==null?e:{...Ry(e),...Uu(e)}}function Nl(e){if(e!==void 0)return e===null?null:ky(e)?Ay(e):Fy(e)?Py(e):{}}function qu(e){return My(e)}function My(e,t){return e}function jy(e){return Ly(e)}function Ly(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:N(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:N(e,"requiredFields")?e.requiredFields.map(_l):void 0,optionalFields:N(e,"optionalFields")?e.optionalFields.map(_l):void 0,optionalFieldsAuto:N(e,"optionalFieldsAuto")?qu(e.optionalFieldsAuto):void 0,backfill:N(e,"backfill")?Tu(e.backfill):void 0,delivery:N(e,"delivery")?_y(e.delivery):void 0,enabled:N(e,"enabled")?e.enabled:void 0}}function By(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(Nl),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(Nl),optionalFieldsAuto:e.optionalFieldsAuto,backfill:_m(e.backfill),delivery:Ty(e.delivery),enabled:e.enabled}}function Vy(e){return Uy(e)}function Uy(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(jy):void 0}}function qy(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(By)}}function $y(e){return zy(e)}function zy(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function Ky(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Hy(e){return Jy(e)}function Jy(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0,watchFieldsAuto:N(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:N(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function Wy(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function Qy(e){return Gy(e)}function Gy(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:N(e,"inheritFieldsAndMapping")?e.inheritFieldsAndMapping:void 0,createEvent:N(e,"createEvent")?by(e.createEvent):void 0,updateEvent:N(e,"updateEvent")?Hy(e.updateEvent):void 0,deleteEvent:N(e,"deleteEvent")?$y(e.deleteEvent):void 0,associationChangeEvent:N(e,"associationChangeEvent")?gm(e.associationChangeEvent):void 0,otherEvents:N(e,"otherEvents")?e.otherEvents:void 0}}function Xy(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:e.inheritFieldsAndMapping,createEvent:xy(e.createEvent),updateEvent:Wy(e.updateEvent),deleteEvent:Ky(e.deleteEvent),associationChangeEvent:vm(e.associationChangeEvent),otherEvents:e.otherEvents}}function Yy(e){return Zy(e)}function Zy(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(Qy):void 0}}function ev(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Xy)}}function $u(e){return tv(e)}function tv(e,t){return e==null?e:{allowAnyFields:N(e,"allowAnyFields")?e.allowAnyFields:void 0}}function nv(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function rv(e){return iv(e)}function iv(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:N(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:N(e,"valueDefaults")?$u(e.valueDefaults):void 0}}function ov(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:nv(e.valueDefaults)}}function sv(e){return av(e)}function av(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(rv):void 0}}function lv(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(ov)}}function cv(e){return uv(e)}function uv(e,t){return e==null?e:{enabled:e.enabled}}function dv(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function fv(e){return pv(e)}function pv(e,t){return e==null?e:{enabled:e.enabled}}function hv(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function mv(e){return gv(e)}function gv(e,t){return e==null?e:{enabled:e.enabled}}function yv(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function vv(e){return bv(e)}function bv(e,t){return e==null?e:{fieldCreated:N(e,"fieldCreated")?fv(e.fieldCreated):void 0,fieldDeleted:N(e,"fieldDeleted")?mv(e.fieldDeleted):void 0,fieldChanged:N(e,"fieldChanged")?cv(e.fieldChanged):void 0}}function wv(e){if(e!==void 0)return e===null?null:{fieldCreated:hv(e.fieldCreated),fieldDeleted:yv(e.fieldDeleted),fieldChanged:dv(e.fieldChanged)}}function xv(e){return Iv(e)}function Iv(e,t){return e==null?e:{destination:e.destination,schedule:N(e,"schedule")?e.schedule:void 0,allObjects:vv(e.allObjects)}}function Sv(e){if(e!==void 0)return e===null?null:{destination:e.destination,schedule:e.schedule,allObjects:wv(e.allObjects)}}function Cv(e){return Ov(e)}function Ov(e,t){return e==null?e:{name:e.name,provider:e.provider,displayName:N(e,"displayName")?e.displayName:void 0,module:N(e,"module")?e.module:void 0,read:N(e,"read")?Vy(e.read):void 0,write:N(e,"write")?sv(e.write):void 0,proxy:N(e,"proxy")?Cy(e.proxy):void 0,subscribe:N(e,"subscribe")?Yy(e.subscribe):void 0,watchSchema:N(e,"watchSchema")?xv(e.watchSchema):void 0}}function Ev(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,displayName:e.displayName,module:e.module,read:qy(e.read),write:lv(e.write),proxy:Ey(e.proxy),subscribe:ev(e.subscribe),watchSchema:Sv(e.watchSchema)}}function _v(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:Ev(e.content)}}function Nv(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:_v(e.latestRevision)}}function Tv(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function kv(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 Rv(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Av(e){return Fv(e)}function Fv(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function Pv(e){return Dv(e)}function Dv(e,t){return e==null?e:{name:e.name,displayName:e.displayName,prompt:N(e,"prompt")?e.prompt:void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0}}function Mv(e){return jv(e)}function jv(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function Lv(e){return Bv(e)}function Bv(e,t){return e==null?e:{headers:N(e,"headers")?e.headers.map(Av):void 0,queryParams:N(e,"queryParams")?e.queryParams.map(Mv):void 0,inputs:N(e,"inputs")?e.inputs.map(Pv):void 0}}function Vv(e){return Uv(e)}function Uv(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function qv(e){return $v(e)}function $v(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,valueType:N(e,"valueType")?e.valueType:void 0,providerType:N(e,"providerType")?e.providerType:void 0,readOnly:N(e,"readOnly")?e.readOnly:void 0,isCustom:N(e,"isCustom")?e.isCustom:void 0,isRequired:N(e,"isRequired")?e.isRequired:void 0,values:N(e,"values")?e.values.map(Vv):void 0}}function zv(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:Qe(e.providerMetadata,ta),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,customAuth:e.customAuth,basicAuth:ju(e.basicAuth),oauth2ClientCredentials:Lu(e.oauth2ClientCredentials),oauth2PasswordCredentials:Bu(e.oauth2PasswordCredentials),oauth2AuthorizationCode:Vu(e.oauth2AuthorizationCode)}}function Kv(e){return Hv(e)}function Hv(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0,useModule:N(e,"useModule")?e.useModule:void 0}}function Jv(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,mapToName:N(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Mo(e){return Wv(e)}function Wv(e,t){return e==null?e:{...Jv(e),...Uu(e)}}function Qv(e){return Gv(e)}function Gv(e,t){return e==null?e:{error:N(e,"error")?e.error:void 0,objectName:e.objectName,displayName:e.displayName,mapToName:N(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:N(e,"requiredFields")?e.requiredFields.map(Mo):void 0,optionalFields:N(e,"optionalFields")?e.optionalFields.map(Mo):void 0,optionalFieldsAuto:N(e,"optionalFieldsAuto")?qu(e.optionalFieldsAuto):void 0,allFieldsMetadata:N(e,"allFieldsMetadata")?Qe(e.allFieldsMetadata,qv):void 0,allFields:N(e,"allFields")?e.allFields.map(Mo):void 0,backfill:N(e,"backfill")?Tu(e.backfill):void 0}}function Xv(e){return Yv(e)}function Yv(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(Qv):void 0}}function Zv(e){return eb(e)}function eb(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:N(e,"valueDefaults")?$u(e.valueDefaults):void 0}}function tb(e){return nb(e)}function nb(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(Zv):void 0}}function rb(e){return ib(e)}function ib(e,t){return e==null?e:{name:e.name,displayName:N(e,"displayName")?e.displayName:void 0,module:N(e,"module")?e.module:void 0,provider:e.provider,read:N(e,"read")?Xv(e.read):void 0,write:N(e,"write")?tb(e.write):void 0,proxy:N(e,"proxy")?Kv(e.proxy):void 0}}function ob(e){return sb(e)}function sb(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:rb(e.content)}}function lr(e){return ab(e)}function ab(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:N(e,"group")?Mu(e.group):void 0,healthStatus:e.healthStatus,lastOperationStatus:N(e,"lastOperationStatus")?e.lastOperationStatus:void 0,connection:Kr(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0,config:ty(e.config)}}function lb(e){return cb(e)}function cb(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Cv(e.content)}}function jo(e){return ub(e)}function ub(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:lb(e.latestRevision)}}function db(e){if(e!==void 0)return e===null?null:{op:e.op,path:e.path,value:e.value}}function fb(e){return pb(e)}function pb(e,t){return e==null?e:{iconURL:N(e,"iconURL")?e.iconURL:void 0,logoURL:N(e,"logoURL")?e.logoURL:void 0}}function hb(e){return mb(e)}function mb(e,t){return e==null?e:{iconURL:N(e,"iconURL")?e.iconURL:void 0,logoURL:N(e,"logoURL")?e.logoURL:void 0}}function gb(e){return yb(e)}function yb(e,t){return e==null?e:{regular:N(e,"regular")?hb(e.regular):void 0,darkMode:N(e,"darkMode")?fb(e.darkMode):void 0}}function vb(e){return bb(e)}function bb(e,t){return e==null?e:{name:e.name,displayName:N(e,"displayName")?e.displayName:void 0,prompt:N(e,"prompt")?e.prompt:void 0,defaultValue:N(e,"defaultValue")?e.defaultValue:void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0,moduleDependencies:N(e,"moduleDependencies")?e.moduleDependencies:void 0}}function wb(e){return xb(e)}function xb(e,t){return e==null?e:{name:e.name,moduleDependencies:N(e,"moduleDependencies")?e.moduleDependencies:void 0}}function Ib(e){return Sb(e)}function Sb(e,t){return e==null?e:{create:N(e,"create")?e.create:void 0,update:N(e,"update")?e.update:void 0,_delete:N(e,"delete")?e.delete:void 0,passThrough:N(e,"passThrough")?e.passThrough:void 0}}function zu(e){return Cb(e)}function Cb(e,t){return e==null?e:{bulkWrite:Ag(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write,subscribeSupport:N(e,"subscribeSupport")?Ib(e.subscribeSupport):void 0,batchWrite:N(e,"batchWrite")?Og(e.batchWrite):void 0}}function Ob(e){return Eb(e)}function Eb(e,t){return e==null?e:{displayName:e.displayName,baseURL:e.baseURL,support:zu(e.support)}}function _b(e){return Nb(e)}function Nb(e,t){return e==null?e:{name:e.name,displayName:e.displayName,path:e.path,capture:N(e,"capture")?e.capture:void 0}}function Tb(e){return kb(e)}function kb(e,t){return e==null?e:{workspaceRefField:N(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:N(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:N(e,"scopesField")?e.scopesField:void 0,otherFields:N(e,"otherFields")?e.otherFields.map(_b):void 0}}const Lo={AuthorizationCode:"authorizationCode",AuthorizationCodePkce:"authorizationCodePKCE",ClientCredentials:"clientCredentials"};function Rb(e){return Ab(e)}function Ab(e,t){return e==null?e:{grantType:e.grantType,authURL:N(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:N(e,"audience")?e.audience:void 0,scopeMappings:N(e,"scopeMappings")?e.scopeMappings:void 0,tokenMetadataFields:Tb(e.tokenMetadataFields),docsURL:N(e,"docsURL")?e.docsURL:void 0,authURLParams:N(e,"authURLParams")?e.authURLParams:void 0,accessTokenOpts:N(e,"accessTokenOpts")?sm(e.accessTokenOpts):void 0}}function Fb(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,ta),providerAppId:e.providerAppId,enableCSRFProtection:e.enableCSRFProtection}}function Pb(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,action:e.action,changes:e.changes.map(db),installationId:e.installationId}}function Db(e){return Mb(e)}function Mb(e,t){return e==null?e:{input:N(e,"input")?e.input.map(vb):void 0,postAuthentication:N(e,"postAuthentication")?e.postAuthentication.map(wb):void 0}}function jb(e){return Lb(e)}function Lb(e,t){return e==null?e:{subscriptionScope:e.subscriptionScope,targetURLScope:e.targetURLScope,registrationTiming:e.registrationTiming}}function Tl(e){return Bb(e)}function Bb(e,t){return e==null?e:{name:e.name,authType:xm(e.authType),baseURL:e.baseURL,defaultModule:e.defaultModule,oauth2Opts:N(e,"oauth2Opts")?Rb(e.oauth2Opts):void 0,apiKeyOpts:N(e,"apiKeyOpts")?hm(e.apiKeyOpts):void 0,basicOpts:N(e,"basicOpts")?xg(e.basicOpts):void 0,customOpts:N(e,"customOpts")?Lv(e.customOpts):void 0,support:zu(e.support),providerOpts:e.providerOpts,authHealthCheck:N(e,"authHealthCheck")?bm(e.authHealthCheck):void 0,displayName:N(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:N(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:N(e,"media")?gb(e.media):void 0,labels:N(e,"labels")?e.labels:void 0,subscribeOpts:N(e,"subscribeOpts")?jb(e.subscribeOpts):void 0,modules:N(e,"modules")?Qe(e.modules,Ob):void 0,metadata:N(e,"metadata")?Db(e.metadata):void 0}}function Vb(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,connection:vy(e.connection)}}function Ub(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:$m(e.read),write:dg(e.write),proxy:Ru(e.proxy)}}function qb(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Ub(e.content)}}function $b(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:qb(e.config)}}function zb(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:$b(e.installation)}}function Kb(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function Hb(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:Kb(e.project)}}function Jb(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 Wb(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:Jb(e.providerApp)}}class Qb extends an{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ae("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 gr(o)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("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:zv(t.generateConnectionParams)},n);return new Ue(o,s=>Kr(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 ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ae("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 Ue(o,s=>Kr(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 ae("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 Ue(o,s=>s.map(Kr))}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 ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ae("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling updateConnection.");if(t.updateConnectionRequest===null||t.updateConnectionRequest===void 0)throw new ae("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:Vb(t.updateConnectionRequest)},n);return new Ue(o,s=>Kr(s))}async updateConnection(t,n){return await(await this.updateConnectionRaw(t,n)).value()}}class Gb extends an{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new ae("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:Sy(t.installation)},n);return new Ue(o,s=>lr(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 ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ae("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 gr(o)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ae("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 Ue(o,s=>lr(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 ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("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 Ue(o,s=>s.map(lr))}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 ae("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 Ue(o,s=>s.map(lr))}async listInstallationsForProject(t,n){return await(await this.listInstallationsForProjectRaw(t,n)).value()}async patchObjectConfigContentRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling patchObjectConfigContent.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling patchObjectConfigContent.");if(t.objectName===null||t.objectName===void 0)throw new ae("objectName","Required parameter requestParameters.objectName was null or undefined when calling patchObjectConfigContent.");if(t.patchObjectConfigContent===null||t.patchObjectConfigContent===void 0)throw new ae("patchObjectConfigContent","Required parameter requestParameters.patchObjectConfigContent was null or undefined when calling patchObjectConfigContent.");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}/objects/{objectName}/config-content".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{objectName}",encodeURIComponent(String(t.objectName))),method:"PATCH",headers:i,query:r,body:Pb(t.patchObjectConfigContent)},n);return new Ue(o,s=>lr(s))}async patchObjectConfigContent(t,n){return await(await this.patchObjectConfigContentRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ae("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new ae("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 Ue(o,s=>lr(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class Xb extends an{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");if(t.batchUpsertIntegrationsRequest===null||t.batchUpsertIntegrationsRequest===void 0)throw new ae("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:Sg(t.batchUpsertIntegrationsRequest)},n);return new Ue(o,s=>s.map(jo))}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 ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new ae("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:Nv(t.integration)},n);return new gr(o)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("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 gr(o)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async getIntegrationRaw(t,n){if(t.integrationIdOrName===null||t.integrationIdOrName===void 0)throw new ae("integrationIdOrName","Required parameter requestParameters.integrationIdOrName was null or undefined when calling getIntegration.");if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("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 Ue(o,s=>jo(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 ae("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 Ue(o,s=>s.map(jo))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class Yb extends an{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new ae("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:Fb(t.connectOAuthParams)},n);return this.isJsonMime(o.headers.get("content-type"))?new Ue(o):new Ol(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 ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling oauthUpdate.");if(t.connectionId===null||t.connectionId===void 0)throw new ae("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 Ue(o):new Ol(o)}async oauthUpdate(t,n){return await(await this.oauthUpdateRaw(t,n)).value()}}class Zb extends an{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new ae("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:Tv(t.project)},n);return new Ue(o,s=>ki(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 ae("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 Ue(o,s=>ki(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 Ue(i,o=>o.map(ki))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new ae("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:Hb(t.projectUpdate)},n);return new Ue(o,s=>ki(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class ew extends an{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new ae("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 Ue(o,s=>Tl(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 Ue(i,o=>Qe(o,Tl))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class tw extends an{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new ae("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:kv(t.providerApp)},n);return new Ue(o,s=>zi(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 ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ae("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 gr(o)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("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 Ue(o,s=>s.map(zi))}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 ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ae("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new ae("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:Wb(t.providerAppUpdate)},n);return new Ue(o,s=>zi(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class nw extends an{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");if(t.revision===null||t.revision===void 0)throw new ae("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:Rv(t.revision)},n);return new gr(o)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new ae("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new ae("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 Ue(o,s=>ob(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}var _r=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(){}},rw={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},iw=class{#e=rw;#t=!1;setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&this.#t&&e!==this.#e&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:this.#e,provider:e}),this.#e=e,process.env.NODE_ENV!=="production"&&(this.#t=!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&(this.#t=!0),this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&(this.#t=!0),this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},Kn=new iw;function ow(e){setTimeout(e,0)}var Wn=typeof window>"u"||"Deno"in globalThis;function Ct(){}function sw(e,t){return typeof e=="function"?e(t):e}function gs(e){return typeof e=="number"&&e>=0&&e!==1/0}function Ku(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Rn(e,t){return typeof e=="function"?e(t):e}function Kt(e,t){return typeof e=="function"?e(t):e}function kl(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:o,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==na(s,t.options))return!1}else if(!ei(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 Rl(e,t){const{exact:n,status:r,predicate:i,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(Qn(t.options.mutationKey)!==Qn(o))return!1}else if(!ei(t.options.mutationKey,o))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function na(e,t){return(t?.queryKeyHashFn||Qn)(e)}function Qn(e){return JSON.stringify(e,(t,n)=>vs(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function ei(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>ei(e[n],t[n])):!1}var aw=Object.prototype.hasOwnProperty;function ys(e,t){if(e===t)return e;const n=Al(e)&&Al(t);if(!n&&!(vs(e)&&vs(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:aw.call(e,u))&&l++;continue}if(d===null||h===null||typeof d!="object"||typeof h!="object"){a[u]=h;continue}const f=ys(d,h);a[u]=f,f===d&&l++}return i===s&&l===i?e:a}function Gi(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 Al(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function vs(e){if(!Fl(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Fl(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Fl(e){return Object.prototype.toString.call(e)==="[object Object]"}function lw(e){return new Promise(t=>{Kn.setTimeout(t,e)})}function bs(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 ys(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 ys(e,t)}return t}function cw(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function uw(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Xi=Symbol();function Hu(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Xi&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Xi?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ju(e,t){return typeof e=="function"?e(...t):!!e}var dw=class extends _r{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!Wn&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},ra=new dw;function ws(){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 fw=ow;function pw(){let e=[],t=0,n=a=>{a()},r=a=>{a()},i=fw;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 it=pw(),hw=class extends _r{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!Wn&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#e}},Yi=new hw;function mw(e){return Math.min(1e3*2**e,3e4)}function Wu(e){return(e??"online")==="online"?Yi.isOnline():!0}var xs=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Qu(e){let t=!1,n=0,r;const i=ws(),o=()=>i.status!=="pending",s=v=>{if(!o()){const g=new xs(v);h(g),e.onCancel?.(g)}},a=()=>{t=!0},l=()=>{t=!1},c=()=>ra.isFocused()&&(e.networkMode==="always"||Yi.isOnline())&&e.canRun(),u=()=>Wu(e.networkMode)&&e.canRun(),d=v=>{o()||(r?.(),i.resolve(v))},h=v=>{o()||(r?.(),i.reject(v))},f=()=>new Promise(v=>{r=g=>{(o()||c())&&v(g)},e.onPause?.()}).then(()=>{r=void 0,o()||e.onContinue?.()}),y=()=>{if(o())return;let v;const g=n===0?e.initialPromise:void 0;try{v=g??e.fn()}catch(w){v=Promise.reject(w)}Promise.resolve(v).then(d).catch(w=>{if(o())return;const m=e.retry??(Wn?0:3),b=e.retryDelay??mw,C=typeof b=="function"?b(n,w):b,E=m===!0||typeof m=="number"&&n<m||typeof m=="function"&&m(n,w);if(t||!E){h(w);return}n++,e.onFail?.(n,w),lw(C).then(()=>c()?void 0:f()).then(()=>{t?h(w):y()})})};return{promise:i,status:()=>i.status,cancel:s,continue:()=>(r?.(),i),cancelRetry:a,continueRetry:l,canStart:u,start:()=>(u()?y():f().then(y),i)}}var Gu=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),gs(this.gcTime)&&(this.#e=Kn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Wn?1/0:300*1e3))}clearGcTimeout(){this.#e&&(Kn.clearTimeout(this.#e),this.#e=void 0)}},gw=class extends Gu{#e;#t;#n;#i;#r;#s;#a;constructor(e){super(),this.#a=!1,this.#s=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#n=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=Pl(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#r?.promise}setOptions(e){if(this.options={...this.#s,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=Pl(this.options);t.data!==void 0&&(this.setData(t.data,{updatedAt:t.dataUpdatedAt,manual:!0}),this.#e=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){const n=bs(this.state.data,e,this.options);return this.#o({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#o({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#r?.promise;return this.#r?.cancel(e),t?t.then(Ct).catch(Ct):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>Kt(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Xi||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Rn(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!Ku(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#r&&(this.#a?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#o({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(e&&this.setOptions(e),!this.options.queryFn){const a=this.observers.find(l=>l.options.queryFn);a&&this.setOptions(a.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 n=new AbortController,r=a=>{Object.defineProperty(a,"signal",{enumerable:!0,get:()=>(this.#a=!0,n.signal)})},i=()=>{const a=Hu(this.options,t),c=(()=>{const u={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(u),u})();return this.#a=!1,this.options.persister?this.options.persister(a,c,this):a(c)},s=(()=>{const a={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(a),a})();this.options.behavior?.onFetch(s,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==s.fetchOptions?.meta)&&this.#o({type:"fetch",meta:s.fetchOptions?.meta}),this.#r=Qu({initialPromise:t?.initialPromise,fn:s.fetchFn,onCancel:a=>{a instanceof xs&&a.revert&&this.setState({...this.#t,fetchStatus:"idle"}),n.abort()},onFail:(a,l)=>{this.#o({type:"failed",failureCount:a,error:l})},onPause:()=>{this.#o({type:"pause"})},onContinue:()=>{this.#o({type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0});try{const a=await this.#r.start();if(a===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(a),this.#n.config.onSuccess?.(a,this),this.#n.config.onSettled?.(a,this.state.error,this),a}catch(a){if(a instanceof xs){if(a.silent)return this.#r.promise;if(a.revert){if(this.state.data===void 0)throw a;return this.state.data}}throw this.#o({type:"error",error:a}),this.#n.config.onError?.(a,this),this.#n.config.onSettled?.(this.state.data,a,this),a}finally{this.scheduleGc()}}#o(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...Xu(n.data,this.options),fetchMeta:e.meta??null};case"success":const r={...n,data:e.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?r:void 0,r;case"error":const i=e.error;return{...n,error:i,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),it.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function Xu(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Wu(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Pl(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 yw=class extends _r{constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.#a=ws(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#i=void 0;#r;#s;#a;#o;#m;#f;#p;#c;#u;#l;#h=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Dl(this.#t,this.options)?this.#d():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Is(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Is(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#w(),this.#x(),this.#t.removeObserver(this)}setOptions(e){const t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Kt(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#I(),this.#t.setOptions(this.options),t._defaulted&&!Gi(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&Ml(this.#t,n,this.options,t)&&this.#d(),this.updateResult(),r&&(this.#t!==n||Kt(this.options.enabled,this.#t)!==Kt(t.enabled,this.#t)||Rn(this.options.staleTime,this.#t)!==Rn(t.staleTime,this.#t))&&this.#g();const i=this.#y();r&&(this.#t!==n||Kt(this.options.enabled,this.#t)!==Kt(t.enabled,this.#t)||i!==this.#l)&&this.#v(i)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return bw(this,n)&&(this.#i=n,this.#s=this.options,this.#r=this.#t.state),n}getCurrentResult(){return this.#i}trackResult(e,t){return new Proxy(e,{get:(n,r)=>(this.trackProp(r),t?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#a.status==="pending"&&this.#a.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,r))})}trackProp(e){this.#h.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#i))}#d(e){this.#I();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Ct)),t}#g(){this.#w();const e=Rn(this.options.staleTime,this.#t);if(Wn||this.#i.isStale||!gs(e))return;const n=Ku(this.#i.dataUpdatedAt,e)+1;this.#c=Kn.setTimeout(()=>{this.#i.isStale||this.updateResult()},n)}#y(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#l=e,!(Wn||Kt(this.options.enabled,this.#t)===!1||!gs(this.#l)||this.#l===0)&&(this.#u=Kn.setInterval(()=>{(this.options.refetchIntervalInBackground||ra.isFocused())&&this.#d()},this.#l))}#b(){this.#g(),this.#v(this.#y())}#w(){this.#c&&(Kn.clearTimeout(this.#c),this.#c=void 0)}#x(){this.#u&&(Kn.clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const n=this.#t,r=this.options,i=this.#i,o=this.#r,s=this.#s,l=e!==n?e.state:this.#n,{state:c}=e;let u={...c},d=!1,h;if(t._optimisticResults){const k=this.hasListeners(),L=!k&&Dl(e,t),M=k&&Ml(e,n,t,r);(L||M)&&(u={...u,...Xu(c.data,e.options)}),t._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:f,errorUpdatedAt:y,status:v}=u;h=u.data;let g=!1;if(t.placeholderData!==void 0&&h===void 0&&v==="pending"){let k;i?.isPlaceholderData&&t.placeholderData===s?.placeholderData?(k=i.data,g=!0):k=typeof t.placeholderData=="function"?t.placeholderData(this.#p?.state.data,this.#p):t.placeholderData,k!==void 0&&(v="success",h=bs(i?.data,k,t),d=!0)}if(t.select&&h!==void 0&&!g)if(i&&h===o?.data&&t.select===this.#m)h=this.#f;else try{this.#m=t.select,h=t.select(h),h=bs(i?.data,h,t),this.#f=h,this.#o=null}catch(k){this.#o=k}this.#o&&(f=this.#o,h=this.#f,y=Date.now(),v="error");const w=u.fetchStatus==="fetching",m=v==="pending",b=v==="error",C=m&&w,E=h!==void 0,A={status:v,fetchStatus:u.fetchStatus,isPending:m,isSuccess:v==="success",isError:b,isInitialLoading:C,isLoading:C,data:h,dataUpdatedAt:u.dataUpdatedAt,error:f,errorUpdatedAt:y,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>l.dataUpdateCount||u.errorUpdateCount>l.errorUpdateCount,isFetching:w,isRefetching:w&&!m,isLoadingError:b&&!E,isPaused:u.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:b&&E,isStale:ia(e,t),refetch:this.refetch,promise:this.#a,isEnabled:Kt(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const k=F=>{A.status==="error"?F.reject(A.error):A.data!==void 0&&F.resolve(A.data)},L=()=>{const F=this.#a=A.promise=ws();k(F)},M=this.#a;switch(M.status){case"pending":e.queryHash===n.queryHash&&k(M);break;case"fulfilled":(A.status==="error"||A.data!==M.value)&&L();break;case"rejected":(A.status!=="error"||A.error!==M.reason)&&L();break}}return A}updateResult(){const e=this.#i,t=this.createResult(this.#t,this.options);if(this.#r=this.#t.state,this.#s=this.options,this.#r.data!==void 0&&(this.#p=this.#t),Gi(t,e))return;this.#i=t;const n=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!this.#h.size)return!0;const o=new Set(i??this.#h);return this.options.throwOnError&&o.add("error"),Object.keys(this.#i).some(s=>{const a=s;return this.#i[a]!==e[a]&&o.has(a)})};this.#S({listeners:n()})}#I(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#S(e){it.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#i)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function vw(e,t){return Kt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Dl(e,t){return vw(e,t)||e.state.data!==void 0&&Is(e,t,t.refetchOnMount)}function Is(e,t,n){if(Kt(t.enabled,e)!==!1&&Rn(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&ia(e,t)}return!1}function Ml(e,t,n,r){return(e!==t||Kt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&ia(e,n)}function ia(e,t){return Kt(t.enabled,e)!==!1&&e.isStaleByTime(Rn(t.staleTime,e))}function bw(e,t){return!Gi(e.getCurrentResult(),t)}function jl(e){return{onFetch:(t,n)=>{const r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],s=t.state.data?.pageParams||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let u=!1;const d=y=>{Object.defineProperty(y,"signal",{enumerable:!0,get:()=>(t.signal.aborted?u=!0:t.signal.addEventListener("abort",()=>{u=!0}),t.signal)})},h=Hu(t.options,t.fetchOptions),f=async(y,v,g)=>{if(u)return Promise.reject();if(v==null&&y.pages.length)return Promise.resolve(y);const m=(()=>{const _={client:t.client,queryKey:t.queryKey,pageParam:v,direction:g?"backward":"forward",meta:t.options.meta};return d(_),_})(),b=await h(m),{maxPages:C}=t.options,E=g?uw:cw;return{pages:E(y.pages,b,C),pageParams:E(y.pageParams,v,C)}};if(i&&o.length){const y=i==="backward",v=y?ww:Ll,g={pages:o,pageParams:s},w=v(r,g);a=await f(g,w,y)}else{const y=e??o.length;do{const v=l===0?s[0]??r.initialPageParam:Ll(r,a);if(l>0&&v==null)break;a=await f(a,v),l++}while(l<y)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=c}}}function Ll(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 ww(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var xw=class extends Gu{#e;#t;#n;#i;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Yu(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#i?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#r({type:"continue"})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#i=Qu({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(o,s)=>{this.#r({type:"failed",failureCount:o,error:s})},onPause:()=>{this.#r({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const r=this.state.status==="pending",i=!this.#i.canStart();try{if(r)t();else{this.#r({type:"pending",variables:e,isPaused:i}),await this.#n.config.onMutate?.(e,this,n);const s=await this.options.onMutate?.(e,n);s!==this.state.context&&this.#r({type:"pending",context:s,variables:e,isPaused:i})}const o=await this.#i.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#r({type:"success",data:o}),o}catch(o){try{throw await this.#n.config.onError?.(o,e,this.state.context,this,n),await this.options.onError?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(void 0,o,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(void 0,o,e,this.state.context,n),o}finally{this.#r({type:"error",error:o})}}finally{this.#n.runNext(this)}}#r(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),it.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function Yu(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Iw=class extends _r{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){const r=new xw({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);const t=Ri(e);if(typeof t=="string"){const n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=Ri(e);if(typeof t=="string"){const n=this.#t.get(t);if(n)if(n.length>1){const r=n.indexOf(e);r!==-1&&n.splice(r,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Ri(e);if(typeof t=="string"){const r=this.#t.get(t)?.find(i=>i.state.status==="pending");return!r||r===e}else return!0}runNext(e){const t=Ri(e);return typeof t=="string"?this.#t.get(t)?.find(r=>r!==e&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){it.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>Rl(t,n))}findAll(e={}){return this.getAll().filter(t=>Rl(e,t))}notify(e){it.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return it.batch(()=>Promise.all(e.map(t=>t.continue().catch(Ct))))}};function Ri(e){return e.options.scope?.id}var Sw=class extends _r{#e;#t=void 0;#n;#i;constructor(t,n){super(),this.#e=t,this.setOptions(n),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const n=this.options;this.options=this.#e.defaultMutationOptions(t),Gi(this.options,n)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),n?.mutationKey&&this.options.mutationKey&&Qn(n.mutationKey)!==Qn(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(t){this.#r(),this.#s(t)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#r(),this.#s()}mutate(t,n){return this.#i=n,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(t)}#r(){const t=this.#n?.state??Yu();this.#t={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#s(t){it.batch(()=>{if(this.#i&&this.hasListeners()){const n=this.#t.variables,r=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};t?.type==="success"?(this.#i.onSuccess?.(t.data,n,r,i),this.#i.onSettled?.(t.data,null,n,r,i)):t?.type==="error"&&(this.#i.onError?.(t.error,n,r,i),this.#i.onSettled?.(void 0,t.error,n,r,i))}this.listeners.forEach(n=>{n(this.#t)})})}},Cw=class extends _r{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){const r=t.queryKey,i=t.queryHash??na(r,t);let o=this.get(i);return o||(o=new gw({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(o)),o}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){it.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>kl(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>kl(e,n)):t}notify(e){it.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){it.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){it.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ow=class{#e;#t;#n;#i;#r;#s;#a;#o;constructor(e={}){this.#e=e.queryCache||new Cw,this.#t=e.mutationCache||new Iw,this.#n=e.defaultOptions||{},this.#i=new Map,this.#r=new Map,this.#s=0}mount(){this.#s++,this.#s===1&&(this.#a=ra.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#o=Yi.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#s--,this.#s===0&&(this.#a?.(),this.#a=void 0,this.#o?.(),this.#o=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.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(Rn(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}),o=this.#e.get(r.queryHash)?.state.data,s=sw(t,o);if(s!==void 0)return this.#e.build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return it.batch(()=>this.#e.findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;it.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#e;return it.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=it.batch(()=>this.#e.findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(Ct).catch(Ct)}invalidateQueries(e,t={}){return it.batch(()=>(this.#e.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=it.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(Ct)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(Ct)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#e.build(this,t);return n.isStaleByTime(Rn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ct).catch(Ct)}fetchInfiniteQuery(e){return e.behavior=jl(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ct).catch(Ct)}ensureInfiniteQueryData(e){return e.behavior=jl(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Yi.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#i.set(Qn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#i.values()],n={};return t.forEach(r=>{ei(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){this.#r.set(Qn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#r.values()],n={};return t.forEach(r=>{ei(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=na(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===Xi&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Zu=H.createContext(void 0),Ze=e=>{const t=H.useContext(Zu);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Ew=({client:e,children:t})=>(H.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),p.jsx(Zu.Provider,{value:e,children:t})),ed=H.createContext(!1),_w=()=>H.useContext(ed);ed.Provider;function Nw(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Tw=H.createContext(Nw()),kw=()=>H.useContext(Tw),Rw=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Aw=e=>{H.useEffect(()=>{e.clearReset()},[e])},Fw=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Ju(n,[e.error,r])),Pw=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))}},Dw=(e,t)=>e.isLoading&&e.isFetching&&!t,Mw=(e,t)=>e?.suspense&&t.isPending,Bl=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function jw(e,t,n){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=_w(),i=kw(),o=Ze(),s=o.defaultQueryOptions(e);o.getDefaultOptions().queries?._experimental_beforeQuery?.(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",Pw(s),Rw(s,i),Aw(i);const a=!o.getQueryCache().get(s.queryHash),[l]=H.useState(()=>new t(o,s)),c=l.getOptimisticResult(s),u=!r&&e.subscribed!==!1;if(H.useSyncExternalStore(H.useCallback(d=>{const h=u?l.subscribe(it.batchCalls(d)):Ct;return l.updateResult(),h},[l,u]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),H.useEffect(()=>{l.setOptions(s)},[s,l]),Mw(s,c))throw Bl(s,l,i);if(Fw({result:c,errorResetBoundary:i,throwOnError:s.throwOnError,query:o.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw c.error;return o.getDefaultOptions().queries?._experimental_afterQuery?.(s,c),s.experimental_prefetchInRender&&!Wn&&Dw(c,r)&&(a?Bl(s,l,i):o.getQueryCache().get(s.queryHash)?.promise)?.catch(Ct).finally(()=>{l.updateResult()}),s.notifyOnChangeProps?c:l.trackResult(c)}function er(e,t){return jw(e,yw)}function vn(e,t){const n=Ze(),[r]=H.useState(()=>new Sw(n,e));H.useEffect(()=>{r.setOptions(e)},[r,e]);const i=H.useSyncExternalStore(H.useCallback(s=>r.subscribe(it.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),o=H.useCallback((s,a)=>{r.mutate(s,a).catch(Ct)},[r]);if(i.error&&Ju(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:o,mutateAsync:i.mutate}}const td=I.createContext(null),Lw=td.Provider,nd=()=>I.useContext(td);var Ie=(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))(Ie||{});const rd=I.createContext(void 0);function un(){const e=I.useContext(rd);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const Bw=(()=>{const e={};return Object.values(Ie).forEach(t=>{e[t]={}}),e})();function Vw({children:e}){const[t,n]=I.useState(Bw),r=I.useCallback((u,d,h=!0)=>{n(f=>{const y={...f};return y[u]=y[u]||{},y[u][d]=h,y})},[n]),i=I.useCallback((u,d)=>!!t[u]?.[d],[t]),o=I.useCallback((u,d)=>t[u]?.[d],[t]),s=I.useCallback((u,d)=>{n(h=>{const f={...h};return delete f[u]?.[d],f})},[n]),a=I.useCallback(u=>{n(d=>{const h={...d};return h[u]={},h})},[n]),l=I.useCallback((u,d)=>{n(h=>{const f={...h};return f[u]=f[u]||{},d.forEach(y=>{f[u][y]=!0}),f})},[n]),c=I.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(rd.Provider,{value:c,children:e})}new TextEncoder;const Ss=new TextDecoder;function Uw(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 qw(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(typeof e=="string"?e:Ss.decode(e),{alphabet:"base64url"});let t=e;t instanceof Uint8Array&&(t=Ss.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return Uw(t)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}}class $w extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(t,n){super(t,n),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}class qn extends $w{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"}function zw(e){return typeof e=="object"&&e!==null}const Kw=e=>{if(!zw(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 Hw(e){if(typeof e!="string")throw new qn("JWTs must use Compact JWS serialization, JWT must be a string");const{1:t,length:n}=e.split(".");if(n===5)throw new qn("Only JWTs using Compact JWS serialization can be decoded");if(n!==3)throw new qn("Invalid JWT");if(!t)throw new qn("JWTs must contain a payload");let r;try{r=qw(t)}catch{throw new qn("Failed to base64url decode the payload")}let i;try{i=JSON.parse(Ss.decode(r))}catch{throw new qn("Failed to parse the decoded payload as JSON")}if(!Kw(i))throw new qn("Invalid JWT Claims Set");return i}const Cs="amp-labs_jwt_",Jw=600*1e3,Vl=(e,t)=>`${e}:${t}`,Ul=e=>`${Cs}${e}`,id=I.createContext(null),Ww=e=>{try{const t=Hw(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 Qw({getTokenCallback:e,children:t}){const[n,r]=I.useState(new Map);I.useEffect(()=>{try{const l=new Map,c=Date.now();Object.keys(sessionStorage).forEach(u=>{if(u.startsWith(Cs)){const d=u.replace(Cs,""),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=I.useCallback((l,c)=>{const u=Vl(l,c),d=Date.now(),h=n.get(u);if(h&&h.expiresAt>d)return h.token;n.delete(u);const f=Ul(u),y=sessionStorage.getItem(f);if(y)try{const v=JSON.parse(y);if(v.expiresAt>d)return r(g=>new Map(g).set(u,v)),v.token;sessionStorage.removeItem(f)}catch{sessionStorage.removeItem(f)}return null},[n]),o=I.useCallback(async(l,c,u)=>{const d=Vl(l,c),f=await Ww(u)||Date.now()+Jw,y={token:u,expiresAt:f};r(v=>new Map(v).set(d,y));try{sessionStorage.setItem(Ul(d),JSON.stringify(y))}catch{console.warn("Failed to store JWT token in sessionStorage")}},[]),s=I.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(id.Provider,{value:a,children:t})}const Gw=()=>{const e=I.useContext(id);if(!e)throw new Error("useJwtToken must be used within a JwtTokenProvider");return e},oa=I.createContext(null);function Ke(){const e=I.useContext(oa);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
|
|
2
|
+
component is wrapped with AmpersandProvider`);return e}const Xw=new Ow({defaultOptions:{queries:{retry:(e,t)=>{if(t instanceof ea){const n=t.response.status;if(n>=400&&n<500)return!1}return e<3}}}});function Yw(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(Ew,{client:Xw,children:p.jsx(oa.Provider,{value:a,children:p.jsx(Vw,{children:p.jsx(Qw,{getTokenCallback:i||null,children:p.jsx(Lw,{value:t||null,children:o})})})})})}var od=Symbol.for("immer-nothing"),ql=Symbol.for("immer-draftable"),jt=Symbol.for("immer-state"),Zw=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 Nt(e,...t){if(process.env.NODE_ENV!=="production"){const n=Zw[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 ti=Object.getPrototypeOf;function yr(e){return!!e&&!!e[jt]}function Gn(e){return e?sd(e)||Array.isArray(e)||!!e[ql]||!!e.constructor?.[ql]||ci(e)||go(e):!1}var ex=Object.prototype.constructor.toString(),$l=new WeakMap;function sd(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let r=$l.get(n);return r===void 0&&(r=Function.toString.call(n),$l.set(n,r)),r===ex}function Zi(e,t,n=!0){mo(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function mo(e){const t=e[jt];return t?t.type_:Array.isArray(e)?1:ci(e)?2:go(e)?3:0}function Os(e,t){return mo(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ad(e,t,n){const r=mo(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function tx(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function ci(e){return e instanceof Map}function go(e){return e instanceof Set}function zn(e){return e.copy_||e.base_}function Es(e,t){if(ci(e))return new Map(e);if(go(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=sd(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[jt];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(ti(e),r)}else{const r=ti(e);if(r!==null&&n)return{...e};const i=Object.create(r);return Object.assign(i,e)}}function sa(e,t=!1){return yo(e)||yr(e)||!Gn(e)||(mo(e)>1&&Object.defineProperties(e,{set:Ai,add:Ai,clear:Ai,delete:Ai}),Object.freeze(e),t&&Object.values(e).forEach(n=>sa(n,!0))),e}function nx(){Nt(2)}var Ai={value:nx};function yo(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var rx={};function Xn(e){const t=rx[e];return t||Nt(0,e),t}var ni;function ld(){return ni}function ix(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function zl(e,t){t&&(Xn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function _s(e){Ns(e),e.drafts_.forEach(ox),e.drafts_=null}function Ns(e){e===ni&&(ni=e.parent_)}function Kl(e){return ni=ix(ni,e)}function ox(e){const t=e[jt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Hl(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[jt].modified_&&(_s(t),Nt(4)),Gn(e)&&(e=eo(t,e),t.parent_||to(t,e)),t.patches_&&Xn("Patches").generateReplacementPatches_(n[jt].base_,e,t.patches_,t.inversePatches_)):e=eo(t,n,[]),_s(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==od?e:void 0}function eo(e,t,n){if(yo(t))return t;const r=e.immer_.shouldUseStrictIteration(),i=t[jt];if(!i)return Zi(t,(o,s)=>Jl(e,i,t,o,s,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return to(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const o=i.copy_;let s=o,a=!1;i.type_===3&&(s=new Set(o),o.clear(),a=!0),Zi(s,(l,c)=>Jl(e,i,o,l,c,n,a),r),to(e,o,!1),n&&e.patches_&&Xn("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function Jl(e,t,n,r,i,o,s){if(i==null||typeof i!="object"&&!s)return;const a=yo(i);if(!(a&&!s)){if(process.env.NODE_ENV!=="production"&&i===n&&Nt(5),yr(i)){const l=o&&t&&t.type_!==3&&!Os(t.assigned_,r)?o.concat(r):void 0,c=eo(e,i,l);if(ad(n,r,c),yr(c))e.canAutoFreeze_=!1;else return}else s&&n.add(i);if(Gn(i)&&!a){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&a)return;eo(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(ci(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&to(e,i)}}}function to(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&sa(t,n)}function sx(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:ld(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,o=aa;n&&(i=[r],o=ri);const{revoke:s,proxy:a}=Proxy.revocable(i,o);return r.draft_=a,r.revoke_=s,a}var aa={get(e,t){if(t===jt)return e;const n=zn(e);if(!Os(n,t))return ax(e,n,t);const r=n[t];return e.finalized_||!Gn(r)?r:r===Bo(e.base_,t)?(Vo(e),e.copy_[t]=ks(r,e)):r},has(e,t){return t in zn(e)},ownKeys(e){return Reflect.ownKeys(zn(e))},set(e,t,n){const r=cd(zn(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=Bo(zn(e),t),o=i?.[jt];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(tx(n,i)&&(n!==void 0||Os(e.base_,t)))return!0;Vo(e),Ts(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 Bo(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Vo(e),Ts(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=zn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Nt(11)},getPrototypeOf(e){return ti(e.base_)},setPrototypeOf(){Nt(12)}},ri={};Zi(aa,(e,t)=>{ri[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});ri.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Nt(13),ri.set.call(this,e,t,void 0)};ri.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Nt(14),aa.set.call(this,e[0],t,n,e[0])};function Bo(e,t){const n=e[jt];return(n?zn(n):e)[t]}function ax(e,t,n){const r=cd(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}function cd(e,t){if(!(t in e))return;let n=ti(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=ti(n)}}function Ts(e){e.modified_||(e.modified_=!0,e.parent_&&Ts(e.parent_))}function Vo(e){e.copy_||(e.copy_=Es(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var lx=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,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"&&Nt(6),r!==void 0&&typeof r!="function"&&Nt(7);let i;if(Gn(t)){const o=Kl(this),s=ks(t,void 0);let a=!0;try{i=n(s),a=!1}finally{a?_s(o):Ns(o)}return zl(o,r),Hl(i,o)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===od&&(i=void 0),this.autoFreeze_&&sa(i,!0),r){const o=[],s=[];Xn("Patches").generateReplacementPatches_(t,i,o,s),r(o,s)}return i}else Nt(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?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof e?.useStrictIteration=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Gn(e)||Nt(8),yr(e)&&(e=cx(e));const t=Kl(this),n=ks(e,void 0);return n[jt].isManual_=!0,Ns(t),n}finishDraft(e,t){const n=e&&e[jt];(!n||!n.isManual_)&&Nt(9);const{scope_:r}=n;return zl(r,t),Hl(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}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=Xn("Patches").applyPatches_;return yr(e)?r(e,t):this.produce(e,i=>r(i,t))}};function ks(e,t){const n=ci(e)?Xn("MapSet").proxyMap_(e,t):go(e)?Xn("MapSet").proxySet_(e,t):sx(e,t);return(t?t.scope_:ld()).drafts_.push(n),n}function cx(e){return yr(e)||Nt(10,e),ud(e)}function ud(e){if(!Gn(e)||yo(e))return e;const t=e[jt];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Es(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Es(e,!0);return Zi(n,(i,o)=>{ad(n,i,ud(o))},r),t&&(t.finalized_=!1),n}var ux=new lx,St=ux.produce,kn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Nr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Hr={exports:{}};Hr.exports;var Wl;function dx(){return Wl||(Wl=1,(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]",v="[object Map]",g="[object Number]",w="[object Null]",m="[object Object]",b="[object Promise]",C="[object Proxy]",E="[object RegExp]",_="[object Set]",A="[object String]",k="[object Symbol]",L="[object Undefined]",M="[object WeakMap]",F="[object ArrayBuffer]",j="[object DataView]",G="[object Float32Array]",P="[object Float64Array]",V="[object Int8Array]",Y="[object Int16Array]",le="[object Int32Array]",pe="[object Uint8Array]",ge="[object Uint8ClampedArray]",x="[object Uint16Array]",J="[object Uint32Array]",B=/[\\^$.*+?()[\]{}|]/g,S=/^\[object .+?Constructor\]$/,$=/^(?:0|[1-9]\d*)$/,q={};q[G]=q[P]=q[V]=q[Y]=q[le]=q[pe]=q[ge]=q[x]=q[J]=!0,q[a]=q[l]=q[F]=q[u]=q[j]=q[d]=q[h]=q[f]=q[v]=q[g]=q[m]=q[E]=q[_]=q[A]=q[M]=!1;var X=typeof kn=="object"&&kn&&kn.Object===Object&&kn,ie=typeof self=="object"&&self&&self.Object===Object&&self,ne=X||ie||Function("return this")(),se=t&&!t.nodeType&&t,ee=se&&!0&&e&&!e.nodeType&&e,me=ee&&ee.exports===se,U=me&&X.process,ye=(function(){try{return U&&U.binding&&U.binding("util")}catch{}})(),Z=ye&&ye.isTypedArray;function Be(O,T){for(var z=-1,oe=O==null?0:O.length,Ve=0,ve=[];++z<oe;){var He=O[z];T(He,z,O)&&(ve[Ve++]=He)}return ve}function Fe(O,T){for(var z=-1,oe=T.length,Ve=O.length;++z<oe;)O[Ve+z]=T[z];return O}function Ae(O,T){for(var z=-1,oe=O==null?0:O.length;++z<oe;)if(T(O[z],z,O))return!0;return!1}function We(O,T){for(var z=-1,oe=Array(O);++z<O;)oe[z]=T(z);return oe}function et(O){return function(T){return O(T)}}function tt(O,T){return O.has(T)}function xe(O,T){return O?.[T]}function ot(O){var T=-1,z=Array(O.size);return O.forEach(function(oe,Ve){z[++T]=[Ve,oe]}),z}function bt(O,T){return function(z){return O(T(z))}}function at(O){var T=-1,z=Array(O.size);return O.forEach(function(oe){z[++T]=oe}),z}var Ge=Array.prototype,D=Function.prototype,K=Object.prototype,R=ne["__core-js_shared__"],re=D.toString,ce=K.hasOwnProperty,qe=(function(){var O=/[^.]+$/.exec(R&&R.keys&&R.keys.IE_PROTO||"");return O?"Symbol(src)_1."+O:""})(),wt=K.toString,lt=RegExp("^"+re.call(ce).replace(B,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ft=me?ne.Buffer:void 0,Pe=ne.Symbol,Oe=ne.Uint8Array,xt=K.propertyIsEnumerable,ct=Ge.splice,Ot=Pe?Pe.toStringTag:void 0,In=Object.getOwnPropertySymbols,Sn=ft?ft.isBuffer:void 0,Cn=bt(Object.keys,Object),nn=ar(ne,"DataView"),Qt=ar(ne,"Map"),On=ar(ne,"Promise"),$e=ar(ne,"Set"),nt=ar(ne,"WeakMap"),de=ar(Object,"create"),Se=Vn(nn),It=Vn(Qt),hn=Vn(On),te=Vn($e),fe=Vn(nt),ue=Pe?Pe.prototype:void 0,Ce=ue?ue.valueOf:void 0;function De(O){var T=-1,z=O==null?0:O.length;for(this.clear();++T<z;){var oe=O[T];this.set(oe[0],oe[1])}}function Vt(){this.__data__=de?de(null):{},this.size=0}function Ut(O){var T=this.has(O)&&delete this.__data__[O];return this.size-=T?1:0,T}function ut(O){var T=this.__data__;if(de){var z=T[O];return z===r?void 0:z}return ce.call(T,O)?T[O]:void 0}function Et(O){var T=this.__data__;return de?T[O]!==void 0:ce.call(T,O)}function Me(O,T){var z=this.__data__;return this.size+=this.has(O)?0:1,z[O]=de&&T===void 0?r:T,this}De.prototype.clear=Vt,De.prototype.delete=Ut,De.prototype.get=ut,De.prototype.has=Et,De.prototype.set=Me;function pt(O){var T=-1,z=O==null?0:O.length;for(this.clear();++T<z;){var oe=O[T];this.set(oe[0],oe[1])}}function Fo(){this.__data__=[],this.size=0}function Po(O){var T=this.__data__,z=Ci(T,O);if(z<0)return!1;var oe=T.length-1;return z==oe?T.pop():ct.call(T,z,1),--this.size,!0}function wi(O){var T=this.__data__,z=Ci(T,O);return z<0?void 0:T[z][1]}function xi(O){return Ci(this.__data__,O)>-1}function Ii(O,T){var z=this.__data__,oe=Ci(z,O);return oe<0?(++this.size,z.push([O,T])):z[oe][1]=T,this}pt.prototype.clear=Fo,pt.prototype.delete=Po,pt.prototype.get=wi,pt.prototype.has=xi,pt.prototype.set=Ii;function rn(O){var T=-1,z=O==null?0:O.length;for(this.clear();++T<z;){var oe=O[T];this.set(oe[0],oe[1])}}function Si(){this.size=0,this.__data__={hash:new De,map:new(Qt||pt),string:new De}}function Ee(O){var T=Oi(this,O).delete(O);return this.size-=T?1:0,T}function Gt(O){return Oi(this,O).get(O)}function Dr(O){return Oi(this,O).has(O)}function Bn(O,T){var z=Oi(this,O),oe=z.size;return z.set(O,T),this.size+=z.size==oe?0:1,this}rn.prototype.clear=Si,rn.prototype.delete=Ee,rn.prototype.get=Gt,rn.prototype.has=Dr,rn.prototype.set=Bn;function sr(O){var T=-1,z=O==null?0:O.length;for(this.__data__=new rn;++T<z;)this.add(O[T])}function Mr(O){return this.__data__.set(O,r),this}function Oh(O){return this.__data__.has(O)}sr.prototype.add=sr.prototype.push=Mr,sr.prototype.has=Oh;function En(O){var T=this.__data__=new pt(O);this.size=T.size}function Eh(){this.__data__=new pt,this.size=0}function _h(O){var T=this.__data__,z=T.delete(O);return this.size=T.size,z}function Nh(O){return this.__data__.get(O)}function Th(O){return this.__data__.has(O)}function kh(O,T){var z=this.__data__;if(z instanceof pt){var oe=z.__data__;if(!Qt||oe.length<n-1)return oe.push([O,T]),this.size=++z.size,this;z=this.__data__=new rn(oe)}return z.set(O,T),this.size=z.size,this}En.prototype.clear=Eh,En.prototype.delete=_h,En.prototype.get=Nh,En.prototype.has=Th,En.prototype.set=kh;function Rh(O,T){var z=Ei(O),oe=!z&&Hh(O),Ve=!z&&!oe&&Do(O),ve=!z&&!oe&&!Ve&&Sl(O),He=z||oe||Ve||ve,st=He?We(O.length,String):[],dt=st.length;for(var ze in O)ce.call(O,ze)&&!(He&&(ze=="length"||Ve&&(ze=="offset"||ze=="parent")||ve&&(ze=="buffer"||ze=="byteLength"||ze=="byteOffset")||Uh(ze,dt)))&&st.push(ze);return st}function Ci(O,T){for(var z=O.length;z--;)if(bl(O[z][0],T))return z;return-1}function Ah(O,T,z){var oe=T(O);return Ei(O)?oe:Fe(oe,z(O))}function jr(O){return O==null?O===void 0?L:w:Ot&&Ot in Object(O)?Bh(O):Kh(O)}function ml(O){return Lr(O)&&jr(O)==a}function gl(O,T,z,oe,Ve){return O===T?!0:O==null||T==null||!Lr(O)&&!Lr(T)?O!==O&&T!==T:Fh(O,T,z,oe,gl,Ve)}function Fh(O,T,z,oe,Ve,ve){var He=Ei(O),st=Ei(T),dt=He?l:_n(O),ze=st?l:_n(T);dt=dt==a?m:dt,ze=ze==a?m:ze;var At=dt==m,Xt=ze==m,ht=dt==ze;if(ht&&Do(O)){if(!Do(T))return!1;He=!0,At=!1}if(ht&&!At)return ve||(ve=new En),He||Sl(O)?yl(O,T,z,oe,Ve,ve):jh(O,T,dt,z,oe,Ve,ve);if(!(z&i)){var qt=At&&ce.call(O,"__wrapped__"),$t=Xt&&ce.call(T,"__wrapped__");if(qt||$t){var Nn=qt?O.value():O,mn=$t?T.value():T;return ve||(ve=new En),Ve(Nn,mn,z,oe,ve)}}return ht?(ve||(ve=new En),Lh(O,T,z,oe,Ve,ve)):!1}function Ph(O){if(!Il(O)||$h(O))return!1;var T=wl(O)?lt:S;return T.test(Vn(O))}function Dh(O){return Lr(O)&&xl(O.length)&&!!q[jr(O)]}function Mh(O){if(!zh(O))return Cn(O);var T=[];for(var z in Object(O))ce.call(O,z)&&z!="constructor"&&T.push(z);return T}function yl(O,T,z,oe,Ve,ve){var He=z&i,st=O.length,dt=T.length;if(st!=dt&&!(He&&dt>st))return!1;var ze=ve.get(O);if(ze&&ve.get(T))return ze==T;var At=-1,Xt=!0,ht=z&o?new sr:void 0;for(ve.set(O,T),ve.set(T,O);++At<st;){var qt=O[At],$t=T[At];if(oe)var Nn=He?oe($t,qt,At,T,O,ve):oe(qt,$t,At,O,T,ve);if(Nn!==void 0){if(Nn)continue;Xt=!1;break}if(ht){if(!Ae(T,function(mn,Un){if(!tt(ht,Un)&&(qt===mn||Ve(qt,mn,z,oe,ve)))return ht.push(Un)})){Xt=!1;break}}else if(!(qt===$t||Ve(qt,$t,z,oe,ve))){Xt=!1;break}}return ve.delete(O),ve.delete(T),Xt}function jh(O,T,z,oe,Ve,ve,He){switch(z){case j:if(O.byteLength!=T.byteLength||O.byteOffset!=T.byteOffset)return!1;O=O.buffer,T=T.buffer;case F:return!(O.byteLength!=T.byteLength||!ve(new Oe(O),new Oe(T)));case u:case d:case g:return bl(+O,+T);case h:return O.name==T.name&&O.message==T.message;case E:case A:return O==T+"";case v:var st=ot;case _:var dt=oe&i;if(st||(st=at),O.size!=T.size&&!dt)return!1;var ze=He.get(O);if(ze)return ze==T;oe|=o,He.set(O,T);var At=yl(st(O),st(T),oe,Ve,ve,He);return He.delete(O),At;case k:if(Ce)return Ce.call(O)==Ce.call(T)}return!1}function Lh(O,T,z,oe,Ve,ve){var He=z&i,st=vl(O),dt=st.length,ze=vl(T),At=ze.length;if(dt!=At&&!He)return!1;for(var Xt=dt;Xt--;){var ht=st[Xt];if(!(He?ht in T:ce.call(T,ht)))return!1}var qt=ve.get(O);if(qt&&ve.get(T))return qt==T;var $t=!0;ve.set(O,T),ve.set(T,O);for(var Nn=He;++Xt<dt;){ht=st[Xt];var mn=O[ht],Un=T[ht];if(oe)var Cl=He?oe(Un,mn,ht,T,O,ve):oe(mn,Un,ht,O,T,ve);if(!(Cl===void 0?mn===Un||Ve(mn,Un,z,oe,ve):Cl)){$t=!1;break}Nn||(Nn=ht=="constructor")}if($t&&!Nn){var _i=O.constructor,Ni=T.constructor;_i!=Ni&&"constructor"in O&&"constructor"in T&&!(typeof _i=="function"&&_i instanceof _i&&typeof Ni=="function"&&Ni instanceof Ni)&&($t=!1)}return ve.delete(O),ve.delete(T),$t}function vl(O){return Ah(O,Qh,Vh)}function Oi(O,T){var z=O.__data__;return qh(T)?z[typeof T=="string"?"string":"hash"]:z.map}function ar(O,T){var z=xe(O,T);return Ph(z)?z:void 0}function Bh(O){var T=ce.call(O,Ot),z=O[Ot];try{O[Ot]=void 0;var oe=!0}catch{}var Ve=wt.call(O);return oe&&(T?O[Ot]=z:delete O[Ot]),Ve}var Vh=In?function(O){return O==null?[]:(O=Object(O),Be(In(O),function(T){return xt.call(O,T)}))}:Gh,_n=jr;(nn&&_n(new nn(new ArrayBuffer(1)))!=j||Qt&&_n(new Qt)!=v||On&&_n(On.resolve())!=b||$e&&_n(new $e)!=_||nt&&_n(new nt)!=M)&&(_n=function(O){var T=jr(O),z=T==m?O.constructor:void 0,oe=z?Vn(z):"";if(oe)switch(oe){case Se:return j;case It:return v;case hn:return b;case te:return _;case fe:return M}return T});function Uh(O,T){return T=T??s,!!T&&(typeof O=="number"||$.test(O))&&O>-1&&O%1==0&&O<T}function qh(O){var T=typeof O;return T=="string"||T=="number"||T=="symbol"||T=="boolean"?O!=="__proto__":O===null}function $h(O){return!!qe&&qe in O}function zh(O){var T=O&&O.constructor,z=typeof T=="function"&&T.prototype||K;return O===z}function Kh(O){return wt.call(O)}function Vn(O){if(O!=null){try{return re.call(O)}catch{}try{return O+""}catch{}}return""}function bl(O,T){return O===T||O!==O&&T!==T}var Hh=ml((function(){return arguments})())?ml:function(O){return Lr(O)&&ce.call(O,"callee")&&!xt.call(O,"callee")},Ei=Array.isArray;function Jh(O){return O!=null&&xl(O.length)&&!wl(O)}var Do=Sn||Xh;function Wh(O,T){return gl(O,T)}function wl(O){if(!Il(O))return!1;var T=jr(O);return T==f||T==y||T==c||T==C}function xl(O){return typeof O=="number"&&O>-1&&O%1==0&&O<=s}function Il(O){var T=typeof O;return O!=null&&(T=="object"||T=="function")}function Lr(O){return O!=null&&typeof O=="object"}var Sl=Z?et(Z):Dh;function Qh(O){return Jh(O)?Rh(O):Mh(O)}function Gh(){return[]}function Xh(){return!1}e.exports=Wh})(Hr,Hr.exports)),Hr.exports}var fx=dx();const dd=Nr(fx),Ye=async(e,t)=>{if(e instanceof ea){const{status:n,statusText:r}=e.response;console.error(n===500?"Internal Server Error (500):":n===400?"Bad Request (400):":`Error (${n}):`,r);try{const o=await e.response.clone().json(),s=o?.causes?.join(`
|
|
3
3
|
`)||o?.detail;s?(console.error("[Error Message]",s),o?.remedy&&console.error("[Remedy]",o.remedy)):console.error("Unexpected error response:",o);const a=`${s} ${o?.remedy?`
|
|
4
4
|
|
|
5
|
-
[Remedy] ${o.remedy}`:""}`;t&&t(a)}catch(i){console.error("Error parsing error response body:",i)}}else console.error("Unexpected error:",e.message)};function vo(e,t){const n=mt(e,t),{projectIdOrName:r}=Ke(),{setError:i,removeError:o}=un(),s=er({queryKey:["amp","integrations",r],queryFn:async()=>{if(!r)throw new Error("Project ID or name is required");return(await n()).integrationApi.listIntegrations({projectIdOrName:r})},enabled:!!r});return I.useEffect(()=>{s.isError?(Ye(s.error),i(Ie.INTEGRATION_LIST,r)):o(Ie.INTEGRATION_LIST,r)},[s.isError,s.error,r,i,o]),s}const la=(e,t,n)=>{const r=mt(t,n),{projectIdOrName:i}=Ke(),{data:o,isError:s,error:a}=vo(t,n),l=o?.find(u=>u.name===e)?.id,c=er({queryKey:["amp","installations",i,l,t],queryFn:async()=>{if(!i)throw new Error("Project ID is required");if(!l)throw new Error("Integration ID is required");if(!t)throw new Error("Group reference is required");return(await r()).installationApi.listInstallations({projectIdOrName:i,integrationId:l,groupRef:t})},enabled:!s&&!!i&&!!l&&!!t&&!!o&&o.length>0});return{...c,isError:c.isError||s,error:c.error||a}},Mn=()=>{const{setError:e}=un(),t=mt(),{projectIdOrName:n}=Ke(),r=er({queryKey:["project",n],queryFn:async()=>(await t()).projectApi.getProject({projectIdOrName:n})});return I.useEffect(()=>{r.isError&&e(Ie.PROJECT,n)},[r.isError,n,e]),{...r,projectIdOrName:n,appName:r.data?.name,projectId:r.data?.id}};function dn(){const{integrationNameOrId:e,groupRef:t}=jn(),n=la(e,t),{isPending:r,isFetching:i,isError:o,isSuccess:s,error:a,data:l}=n;return{installation:l?.[0],isPending:r,isFetching:i,isError:o,isSuccess:s,error:a}}const tr=e=>{const t=vo(),r=t.data?.find(i=>i.name===e||i.id===e);return{...t,data:r,provider:r?.provider}},ca=()=>{const{groupRef:e,integrationNameOrId:t}=jn(),{provider:n}=tr(t),r=fa({groupRef:e,provider:n}),{isPending:i,isFetching:o,isError:s,isSuccess:a,error:l,data:c}=r;return{connection:c?.[0],error:l,isPending:i,isFetching:o,isError:s,isSuccess:a}},ud=()=>{const e=mt(),{connection:t,isPending:n,isFetching:r}=ca(),{projectIdOrName:i}=Ke(),{integrationNameOrId:o}=jn(),{data:s}=tr(o),a=t?.id,l=s?.id,c=s?.latestRevision?.id;return er({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 bo(){const e=ud(),{isLoading:t,isPending:n,isFetching:r,isError:i,isSuccess:o,error:s,data:a}=e,l=a?.content,c=I.useMemo(()=>({getReadObject:u=>{const d=l?.read?.objects?.find(h=>h.objectName===u);return d?{object:d,getRequiredFields:()=>d.requiredFields??[],getOptionalFields:()=>d.optionalFields??[]}:(console.error(`Object ${u} not found`),{object:null,getRequiredFields:()=>null,getOptionalFields:()=>null})},getWriteObject:u=>{const d=l?.write?.objects?.find(h=>h.objectName===u);return d?{object:d}:(console.error(`Object ${u} not found`),{object:null})},getCustomerFieldsForObject:u=>{const d=l?.read?.objects?.find(h=>h.objectName===u);return d?{allFields:d.allFieldsMetadata??{},getField:h=>{const f=d.allFieldsMetadata?.[h];return f||(console.error(`Field ${h} not found`),null)}}:(console.error(`Object ${u} not found`),{allFields:null,getField:()=>null})}}),[l?.read?.objects,l?.write?.objects]);return{data:a,isLoading:t,isPending:n,isFetching:r,isError:i,isSuccess:o,error:s,...c}}function qw(e){const[t,n]=I.useState(e),r=I.useRef(void 0),{getReadObject:i,data:o}=bo(),{installation:s}=dn(),a=I.useCallback(()=>t,[t]),l=I.useCallback((f,y)=>{y.provider=y.provider||o?.content?.provider||"";const v=y.read||{objects:{}},g=v.objects||{},b=g[f]||{},m=i(f),w={};return m?.getRequiredFields()?.forEach(C=>{"fieldName"in C&&(w[C.fieldName]=!0)}),b.objectName=b.objectName||f,b.selectedFields=b.selectedFields||w,g[f]=b,v.objects=g,y.read=v,{read:v,objects:g,obj:b}},[i,o?.content?.provider]),c=I.useCallback(f=>({object:t.read?.objects?.[f],getSelectedField:y=>!!t.read?.objects?.[f]?.selectedFields?.[y],setSelectedField:({fieldName:y,selected:v})=>{n(g=>Ft(g,b=>{const{obj:m}=l(f,b);m.selectedFields=m.selectedFields||{},m.selectedFields[y]=v,m.selectedFields[y]===!1&&delete m.selectedFields[y]}))},getFieldMapping:y=>t.read?.objects?.[f]?.selectedFieldMappings?.[y],setFieldMapping:({fieldName:y,mapToName:v})=>{n(g=>Ft(g,b=>{const{obj:m}=l(f,b);m.selectedFieldMappings=m.selectedFieldMappings||{},m.selectedFieldMappings[v]=y}))},deleteFieldMapping:y=>{n(v=>Ft(v,g=>{const b=g.read?.objects?.[f]?.selectedFieldMappings;b&&y in b&&delete b[y]}))}}),[t.read?.objects,l]),u=I.useCallback(f=>{const y=t.write?.objects?.[f],v=m=>{const w=m.write||{},C=w.objects||{},E=C[f]||{objectName:f};return C[f]=E,w.objects=C,m.write=w,{write:w,objects:C,obj:E}},g=(m,w)=>y?.selectedFieldSettings?.[m]?.[w],b=(m,w,C)=>{n(E=>Ft(E,_=>{const{obj:A}=v(_);A.selectedFieldSettings={...A.selectedFieldSettings,[m]:{...A.selectedFieldSettings?.[m],[w]:C}}}))};return{object:y,setEnableWrite:()=>{n(m=>Ft(m,w=>{const{obj:C}=v(w);C.objectName=f}))},setDisableWrite:()=>{n(m=>Ft(m,w=>{const{objects:C}=v(w);delete C[f]}))},getWriteObject:()=>t.write?.objects?.[f],getSelectedFieldSettings:m=>y?.selectedFieldSettings?.[m],setSelectedFieldSettings:({fieldName:m,settings:w})=>{n(C=>Ft(C,E=>{const{obj:_}=v(E),A=_.selectedFieldSettings||{};_.selectedFieldSettings={...A,[m]:w},w===void 0&&delete _.selectedFieldSettings[m]}))},getDefaultValues:m=>g(m,"default"),setDefaultValues:({fieldName:m,value:w})=>b(m,"default",w),getWriteOnCreateSetting:m=>g(m,"writeOnCreate"),setWriteOnCreateSetting:({fieldName:m,value:w})=>b(m,"writeOnCreate",w),getWriteOnUpdateSetting:m=>g(m,"writeOnUpdate"),setWriteOnUpdateSetting:({fieldName:m,value:w})=>b(m,"writeOnUpdate",w)}},[t.write?.objects]),d=I.useCallback(()=>({object:t.proxy,setEnableProxy:()=>{n(f=>Ft(f,y=>{y.proxy={enabled:!0}}))},setDisableProxy:()=>{n(f=>Ft(f,y=>{y.proxy={enabled:!1}}))},getProxyEnabled:()=>t.proxy?.enabled||!1}),[t.proxy]),h=I.useCallback(()=>{n(f=>Ft(f,y=>{Object.assign(y,s?.config?.content)}))},[s?.config?.content]);return I.useEffect(()=>{s&&(console.debug("Installation found",{installation:s}),r.current?cd(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 ua=I.createContext(null);function $w({children:e,initialConfig:t}){const n=qw(t);return p.jsx(ua.Provider,{value:n,children:e})}function zw(){const e=I.useContext(ua);if(!e)throw new Error("useLocalConfig must be used within a ConfigProvider / InstallationProvider");return e}function Kw(){console.warn("useConfig is deprecated. Please use useLocalConfig instead.");const e=I.useContext(ua);if(!e)throw new Error("useConfigContext must be used within a ConfigProvider / InstallationProvider");return e}const dd=I.createContext({integrationNameOrId:"",consumerRef:"",consumerName:void 0,groupRef:"",groupName:void 0});function jn(){const e=I.useContext(dd);if(!e)throw new Error("useInstallationProps must be used within an InstallationProvider");return e}function da({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 p.jsx(dd.Provider,{value:s,children:p.jsx($w,{initialConfig:{},children:e})})}class Rs{constructor(t){this.connectionApi=new Cb(t),this.installationApi=new Ob(t),this.integrationApi=new Eb(t),this.oAuthApi=new _b(t),this.projectApi=new Tb(t),this.providerApi=new Nb(t),this.providerAppApi=new kb(t),this.revisionApi=new Rb(t)}}const fd="2.11.0",Hw="v1",Fi="https://api.withampersand.com";function pd(){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 Fi;case"mock":return"http://127.0.0.1:4010";case"":return Fi;default:return e??Fi}}catch{return Fi}}const Jw=(e,t)=>`${e}/${t}`;function Ww(){return Jw(pd(),Hw)}const hd=pd(),md=Ww(),Qw=new Zs({basePath:md,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":fd}});new Rs(Qw);const Gw=e=>({header:"X-Api-Key",value:e}),Xw=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")}},Wl=(e,t)=>new Zs({basePath:md,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":fd,[e]:t}});function mt(e,t){const n=ed(),{getToken:r}=Ow(),i=jn(),o=t||i.consumerRef,s=e||i.groupRef;return I.useCallback(async()=>{if(n){const l=Gw(n),c=Wl(l.header,l.value);return new Rs(c)}if(r){if(!o||!s)throw console.error("Unable to create JWT API service without consumerRef or groupRef.",{consumerRef:o,groupRef:s}),new Error("Unable to create JWT API service without consumerRef or groupRef. Provide via InstallationProvider or useAPI parameters.");const l=await r({consumerRef:o,groupRef:s}),c=Xw(l),u=Wl(c.header,c.value);return new Rs(u)}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.")},[n,r,o,s])}const fa=({groupRef:e,provider:t})=>{const{projectIdOrName:n}=Ke(),r=mt();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 Yw({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 Zw="_box_1p7c5_1",Ql={box:Zw};function bn({children:e,className:t,style:n}){return p.jsx("div",{className:t?`${Ql.box} ${t}`:Ql.box,style:n,children:e})}const ex="_container_1wvzr_1",Gl={container:ex};function Tr({children:e,className:t,style:n}){return p.jsx("div",{className:t?`${Gl.container} ${t}`:Gl.container,style:n,children:e})}const tx="_errorBoxContainer_19655_1",nx="_errorBox_19655_1",rx="_errorIconWrapper_19655_23",ix="_errorText_19655_34",Ki={errorBoxContainer:tx,errorBox:nx,errorIconWrapper:rx,errorText:ix};function gd({message:e}){return p.jsxs(bn,{className:Ki.errorBox,children:[p.jsx("div",{className:Ki.errorIconWrapper,children:p.jsx(Yw,{width:"20",height:"20"})}),p.jsx("p",{className:Ki.errorText,children:e})]})}function yd({message:e,children:t}){return p.jsxs(Tr,{className:Ki.errorBoxContainer,children:[p.jsx(gd,{message:e}),t]})}const ox="_loader_6ubm6_1",sx={loader:ox};function ax(){return p.jsx("span",{className:sx.loader})}function ii(){return p.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:p.jsx(ax,{})})}function vd({children:e}){return p.jsx(Tr,{style:{maxWidth:"55rem"},children:p.jsx(bn,{children:e})})}function Nr(){return p.jsx(vd,{children:p.jsx(ii,{})})}function Tt({message:e,children:t}){return p.jsx(vd,{children:p.jsx(yd,{message:e,children:t})})}function Wt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function lx(e,t){return t?.displayName??Wt(e)}const cx=e=>e.split(`
|
|
6
|
-
`).filter(n=>n.trim()!==""),ux=(e,t)=>t?.length===0||!e?null:t.find(n=>n.name===e)??null;function dx(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 fx=()=>{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}},bd=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 gt(){const e=I.useContext(bd);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function px({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}=vo(),{setError:h,isError:f,removeError:y}=un(),{isIntegrationDeleted:v,setIntegrationDeleted:g,resetIntegrationDeleted:b}=fx(),m=I.useMemo(()=>ux(t,d||[]),[t,d]),{data:w,isLoading:C,isError:E,error:_}=la(t,i),A=w?.[0]||null;I.useEffect(()=>{b()},[t,n,r,i,o,c]),I.useEffect(()=>{m===null&&d?.length&&console.error(`Integration "${t}" not found in integration list`)},[t,m,d]),I.useEffect(()=>{E?(h(Ie.INSTALLATION_LIST,m?.id||""),Ye(_)):y(Ie.INSTALLATION_LIST,m?.id||"")},[E,m,h,y,_]);const k=Ze(),L=I.useCallback(()=>{k.invalidateQueries({queryKey:["amp","installations"]})},[k]),M=I.useCallback(G=>{k.setQueryData(["amp","installations"],[G]),k.invalidateQueries({queryKey:["amp","installations"]})},[k]),F=m?.id||"",j=I.useMemo(()=>({integrationId:m?.id||"",provider:m?.provider||"",integrationObj:m,consumerRef:n,consumerName:r,groupRef:i,groupName:o,installation:A||void 0,setInstallation:M,resetInstallations:L,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:l,isIntegrationDeleted:v,setIntegrationDeleted:g,fieldMapping:c,resetComponent:u}),[m,n,r,i,o,A,M,L,s,a,l,v,g,c,u]);if(C)return p.jsx(Nr,{});if(m===null)return p.jsx(Tt,{message:`Integration "${t}" not found`});if(f(Ie.INSTALLATION_LIST,F)){const G=`Error retrieving installation information for integration "${m?.name||"unknown"}"`;return p.jsx(Tt,{message:G})}return p.jsx(bd.Provider,{value:j,children:e})}const wd=I.createContext({connections:null,isConnectionsLoading:!0,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),fn=()=>{const e=I.useContext(wd);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function xd({groupRef:e,provider:t,children:n}){const r=Ze(),{setError:i,isError:o}=un(),{projectIdOrName:s,isLoading:a}=Mn(),{integrationId:l,groupRef:c}=gt(),{provider:u}=tr(l),{data:d,isLoading:h,isError:f,error:y}=fa({groupRef:e||c,provider:u||t}),v=d?.[0],g=I.useCallback(w=>{r.setQueryData(["amp","connections"],()=>w),r.invalidateQueries({queryKey:["amp","connections"]})},[r]),b=I.useCallback(()=>{r.invalidateQueries({queryKey:["amp","connections"]})},[r]);I.useEffect(()=>{f?(i(Ie.CONNECTION_LIST,s,!0),Ye(y)):i(Ie.CONNECTION_LIST,s,!1)},[f,i,s,y]);const m=I.useMemo(()=>({connections:d||null,isConnectionsLoading:h,selectedConnection:v||null,setConnections:g,setSelectedConnection:b}),[d,h,v,g,b]);if(h||a)return p.jsx(Nr,{});if(s&&o(Ie.PROJECT,s))return p.jsx(Tt,{message:`Error loading project ${s}`});if(s&&o(Ie.CONNECTION_LIST,s))return p.jsx(Tt,{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(wd.Provider,{value:m,children:n})}const Id=()=>{const e=mt(),t=Ze(),[n,r]=I.useState(null);return{...vn({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"),Ye(o,r)}}),errorMsg:n}};function hx(e){return typeof e.provider=="string"}function mx(e){return hx(e)?{data:e}:{error:new Error("Config must have a provider field for creation")}}function Sd(){const{projectIdOrName:e}=Ke(),{groupRef:t,integrationNameOrId:n}=jn(),{data:r}=tr(n),{connection:i}=ca(),{installation:o}=dn(),s=Ze(),{mutate:a,isIdle:l,isPending:c,error:u,errorMsg:d}=Id();return{createInstallation:({config:f,onSuccess:y,onError:v,onSettled:g})=>{if(o){const w=new Error("Installation already created. Try updating instead.");v?.(w),g?.();return}if(!r){const w=new Error("No integration found");v?.(w),g?.();return}const b=mx(f);if(b.error||!b.data){v?.(b.error||new Error("Invalid configuration data")),g?.();return}const m={projectIdOrName:e,integrationId:r?.id,installation:{groupRef:t,connectionId:i?.id,config:{content:b.data}}};return a(m,{onSuccess:w=>{y?.(w)},onError:w=>{v?.(w)},onSettled:()=>{g?.(),s.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:l,isPending:c,error:u,errorMsg:d}}const Cd=()=>{const e=mt(),t=Ze(),[n,r]=I.useState(null);return{...vn({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"),Ye(o,r)}}),errorMsg:n}};function Od(){const{projectIdOrName:e}=Ke(),{integrationNameOrId:t}=jn(),{data:n}=tr(t),{installation:r}=dn(),i=Ze(),{mutate:o,isIdle:s,isPending:a,error:l,errorMsg:c}=Cd();return{updateInstallation:({config:d,onSuccess:h,onError:f,onSettled:y})=>{if(!r){const b=new Error("Installation not created yet. Try creating the installation first.");f?.(b),y?.();return}if(!n){const b=new Error("No integration found");f?.(b),y?.();return}const v=[];if(d?.write?.objects){const b=Object.keys(d.write.objects).length,m=Object.keys(r?.config?.content?.write?.objects||{}).length;(b>0||b===0&&m>0)&&v.push("config.content.write.objects")}if(d?.read?.objects){const b=Object.keys(d.read.objects);v.push(...b.map(m=>`config.content.read.objects.${m}`))}const g={projectIdOrName:e,integrationId:n?.id,installationId:r.id,installationUpdate:{updateMask:v,installation:{config:{content:d}}}};return o(g,{onSuccess:b=>{h?.(b)},onError:b=>{f?.(b)},onSettled:()=>{y?.(),i.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:s,isPending:a,error:l,errorMsg:c}}const gx=()=>{const e=mt(),t=Ze(),[n,r]=I.useState(null);return{...vn({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"),Ye(o,r)}}),errorMsg:n}};function yx(){const{projectIdOrName:e}=Ke(),{integrationNameOrId:t}=jn(),{data:n}=tr(t),{installation:r}=dn(),i=Ze(),{mutate:o,isIdle:s,isPending:a,error:l,errorMsg:c}=gx();return{deleteInstallation:({onSuccess:d,onError:h,onSettled:f})=>{if(!r){const y=new Error("Installation not found. Not able to delete installation.");h?.(y),f?.();return}if(!n){const y=new Error("No integration found");h?.(y),f?.();return}return o({projectIdOrName:e,integrationId:n?.id,installationId:r.id},{onSuccess:()=>{d?.()},onError:y=>{h?.(y)},onSettled:()=>{f?.(),i.invalidateQueries({queryKey:["amp","installations"]}),i.invalidateQueries({queryKey:["amp","connections"]})}})},isIdle:s,isPending:a,error:l,errorMsg:c}}function Ed(){const[e,t]=I.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}var Jr={exports:{}};Jr.exports;var Xl;function vx(){return Xl||(Xl=1,(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 kn=="object"&&kn&&kn.Object===Object&&kn,v=typeof self=="object"&&self&&self.Object===Object&&self,g=y||v||Function("return this")(),b=t&&!t.nodeType&&t,m=b&&!0&&e&&!e.nodeType&&e,w=m&&m.exports===b;function C(R,re){return R?.[re]}function E(R){var re=!1;if(R!=null&&typeof R.toString!="function")try{re=!!(R+"")}catch{}return re}function _(R,re){return function(le){return R(re(le))}}var A=Function.prototype,k=Object.prototype,L=g["__core-js_shared__"],M=(function(){var R=/[^.]+$/.exec(L&&L.keys&&L.keys.IE_PROTO||"");return R?"Symbol(src)_1."+R:""})(),F=A.toString,j=k.hasOwnProperty,G=k.toString,P=RegExp("^"+F.call(j).replace(h,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),V=w?g.Buffer:void 0,Y=k.propertyIsEnumerable,ae=V?V.isBuffer:void 0,pe=_(Object.keys,Object),ge=U(g,"DataView"),x=U(g,"Map"),J=U(g,"Promise"),B=U(g,"Set"),S=U(g,"WeakMap"),$=!Y.call({valueOf:1},"valueOf"),q=Fe(ge),X=Fe(x),ie=Fe(J),ne=Fe(B),se=Fe(S);function ee(R){return G.call(R)}function me(R){if(!Ge(R)||Z(R))return!1;var re=bt(R)||E(R)?P:f;return re.test(Fe(R))}function U(R,re){var le=C(R,re);return me(le)?le:void 0}var ye=ee;(ge&&ye(new ge(new ArrayBuffer(1)))!=d||x&&ye(new x)!=s||J&&ye(J.resolve())!=l||B&&ye(new B)!=c||S&&ye(new S)!=u)&&(ye=function(R){var re=G.call(R),le=re==a?R.constructor:void 0,Ue=le?Fe(le):void 0;if(Ue)switch(Ue){case q:return d;case X:return s;case ie:return l;case ne:return c;case se:return u}return re});function Z(R){return!!M&&M in R}function Be(R){var re=R&&R.constructor,le=typeof re=="function"&&re.prototype||k;return R===le}function Fe(R){if(R!=null){try{return F.call(R)}catch{}try{return R+""}catch{}}return""}function Ae(R){return tt(R)&&j.call(R,"callee")&&(!Y.call(R,"callee")||G.call(R)==r)}var We=Array.isArray;function et(R){return R!=null&&at(R.length)&&!bt(R)}function tt(R){return D(R)&&et(R)}var xe=ae||K;function ot(R){if(et(R)&&(We(R)||typeof R=="string"||typeof R.splice=="function"||xe(R)||Ae(R)))return!R.length;var re=ye(R);if(re==s||re==c)return!R.size;if($||Be(R))return!pe(R).length;for(var le in R)if(j.call(R,le))return!1;return!0}function bt(R){var re=Ge(R)?G.call(R):"";return re==i||re==o}function at(R){return typeof R=="number"&&R>-1&&R%1==0&&R<=n}function Ge(R){var re=typeof R;return!!R&&(re=="object"||re=="function")}function D(R){return!!R&&typeof R=="object"}function K(){return!1}e.exports=ot})(Jr,Jr.exports)),Jr.exports}var bx=vx();const wx=_r(bx),yr="other",no="manage-tab";function kr(e){return!e.fieldName}function _d(e,t){return e?.objects?.find(n=>n.objectName===t)||null}function xx(e){return e?.requiredFields?.filter(n=>kr(n)&&!!n.mapToName)||[]}function Ix(e){return e?.optionalFields?.filter(n=>kr(n)&&!!n.mapToName)||[]}function Td(e){return e?.optionalFields?.filter(t=>!kr(t)&&!!t.fieldName)||null}const Nd=(e,t)=>e?.content?.read?.objects?.[t],kd=(e,t)=>{const n=[];return t.content?.read?.objects?.forEach(r=>{const i=e?Nd(e,r.objectName):void 0;n.push({name:r?.objectName,displayName:r?.mapToDisplayName||r?.displayName||r?.objectName&&Wt(r?.objectName),completed:!!i,disabled:i?.disabled})}),n},Rd=e=>({name:yr,completed:e?!!e?.content?.write:!1});function Sx(e,t){const n=kd(e,t),i=!!t?.content?.write?Rd(e):void 0;return i&&n.push(i),n}function Ad(e,t,n){const r=e?.filter(o=>!t?.[o?.mapToName])||[],i=r.map(o=>o.mapToName);return n(Ie.MAPPING,i),r?.length&&console.error("required fields not met",r.map(o=>o.mapToDisplayName)),{errorList:i}}function Yl(e,t){return wx(e)?!0:Object.values(e).every(t)}function pa(e,t,n){const r=Yl(e,n),i=Yl(t,n);return r&&i?!0:r!==i?!1:cd(e,t)}function Fd(e,t){return pa(e,t,n=>n===!1||n===void 0)}function Pd(e,t){return pa(e,t,n=>!n||n==="")}function Dd(e,t){return pa(e,t,n=>!n||typeof n!="object"?!0:Object.keys(n).length===0)}function Md(e,t){const n=new Set(Object.values(e).map(i=>i?.objectName)),r=new Set(Object.values(t).map(i=>i?.objectName));return n.size===r.size&&[...n].every(i=>r.has(i))}const Cx=(e,t,n)=>{if(!e)return null;const r=_d(e,t),i=r&&Td(r),o=r&&xx(r),s=r&&Ix(r),a=r?.allFields||[],l=r?.allFieldsMetadata||{},c=n?.content,u=c?.read?.objects?.[t]?.selectedValueMappings||{},d=c?.read?.objects?.[t]?.selectedFieldMappings||{},h=ha(n,{content:{read:e}},t);return{allFields:a,allFieldsMetadata:l,optionalFields:i,requiredMapFields:o,optionalMapFields:s,selectedOptionalFields:h,selectedFieldMappings:d,selectedValueMappings:u}},Ox=(e,t)=>{if(!e)return null;const n=t?.content?.write?.objects;return{writeObjects:e?.objects||[],selectedWriteObjects:n||{}}};function jd(e,t,n){const r=e?.content?.read,i=e?.content?.write;return{read:Cx(r,t,n),write:Ox(i,n)}}const Ld=(e,t,n,r)=>{const i=jd(e,n,t);r(n,i)},Ex=(e,t,n)=>{const r=Sx(t,e),i={};r.forEach(({name:o,completed:s})=>{s&&(i[o]=jd(e,o,t))}),n(i)},Bd=e=>{const{selectedOptionalFields:t}=e?.read||{};return t||{}},Vd=e=>{const{selectedFieldMappings:t}=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},Ud=(e,t)=>!t||!t[e]?[]:t[e],qd=e=>{const{selectedValueMappings:t}=e?.read||{};return t},ha=(e,t,n)=>{if(!e||!t)return{};const r=t?.content?.read;if(!r)return{};const i=_d(r,n),o=i&&Td(i),s=new Set(o?.filter(c=>!kr(c)&&!!c.fieldName).map(c=>c.fieldName)||[]),a=e?.content?.read?.objects?.[n]?.selectedFields||{};return Object.entries(a).reduce((c,[u,d])=>(s.has(u)&&(c[u]=d),c),{})},$d=(e,t)=>!e||!t?{}:e?.content?.read?.objects?.[t]?.selectedFieldMappings||{};function zd(e,t){return t[e]||void 0}const _x=(e,t,n,r,i)=>{const o=Bd(e),s=Vd(e),a=Ud(t,i),l=qd(e);return{createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,selectedFields:o,selectedFieldMappings:s,dynamicMappingsInput:a,selectedValueMappings:l||{}}}}}}};function Kd(e){return e.content.proxy?.enabled}const Hd=e=>({...e.write?.selectedWriteObjects}),Tx=e=>e.content.write?.objects,Nx=(e,t,n)=>{if(!Tx(t))return console.error("Error when getting write objects from hydratedRevision"),null;const i=Hd(e),o={createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:i}}};return Kd(t)&&(o.content.proxy={enabled:!0}),o};var Uo={exports:{}};var Zl;function kx(){return Zl||(Zl=1,(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})()})(Uo)),Uo.exports}var Rx=kx();const Jt=_r(Rx),Ax="_button_kwfiu_1",Fx="_danger_kwfiu_42",Px="_ghost_kwfiu_47",qo={button:Ax,danger:Fx,ghost:Px};function Je({className:e,style:t,type:n,children:r,variant:i,...o}){const s=Jt(qo.button,{[qo.danger]:i==="danger",[qo.ghost]:i==="ghost",[e||""]:!!e});return p.jsx("button",{type:n,className:s,style:t,...o,children:r})}const Dx={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 ui({children:e,style:t}){return p.jsx(bn,{style:{...Dx,...t},children:e})}const Jd=e=>{const t=mt(),{provider:n}=gt(),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})},yt=e=>{const t=Jd(e),{data:n}=t,{provider:r}=gt(),i=n&&lx(n?.name,n);return{...t,providerName:i,selectedProvider:e||r}};function wn({error:e}){return e?p.jsx(ui,{style:{marginTop:"2em"},children:e}):null}const Mx="_input_1ymb7_1",jx="_inputError_1ymb7_27",$o={input:Mx,inputError:jx};function Wd({id:e,type:t,className:n,isError:r=!1,...i}){const o=r?Jt($o.inputError,$o.input):$o.input;return p.jsx("input",{id:e,type:t,className:Jt(o,n),...i})}function Lx(){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 Bx(){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 Vx({id:e,name:t,placeholder:n="Password",onChange:r,value:i,className:o,isError:s}){const[a,l]=I.useState(!1),c=()=>l(u=>!u);return p.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[p.jsx(yn.Input,{id:e,name:t,type:a?"text":"password",placeholder:n,onChange:r,value:i,className:o,isError:s}),p.jsx(Je,{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(Bx,{}):p.jsx(Lx,{})})})]})}const Ux="_textarea_18zl4_1",qx="_textareaError_18zl4_14",zo={textarea:Ux,textareaError:qx};function $x({className:e,isError:t=!1,...n}){const r=t?Jt(zo.textareaError,zo.textarea):zo.textarea;return p.jsx("textarea",{className:Jt(e,r),...n})}const yn={Input:Wd,Textarea:$x,PasswordInput:Vx},zx=()=>{const{projectIdOrName:e}=Ke(),t=mt();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 Qd(){const{data:e}=zx();return e?.entitlements?.brandingRemoval?.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 nr({children:e}){return p.jsx(Tr,{children:p.jsxs(bn,{children:[p.jsx("div",{style:{padding:"3rem 2rem"},children:e}),p.jsx(Qd,{})]})})}function rr({children:e}){return p.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function Kx({children:e}){return p.jsx("p",{style:{padding:".5em 0"},children:e})}const Hx="_link_oo2kv_1",Jx={link:Hx};function Gd({href:e,className:t,style:n,label:r,children:i,newTab:o=!1}){return p.jsx("a",{className:Jt(Jx.link,t),style:n,href:e,"aria-label":r||void 0,target:o?"_blank":"_self",rel:o?"noopener noreferrer":void 0,children:i})}function Wx(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Qx=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Gx=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Xx={};function ec(e,t){return(Xx.jsx?Gx:Qx).test(e)}const Yx=/[ \t\n\f\r]/g;function Zx(e){return typeof e=="object"?e.type==="text"?tc(e.value):!1:tc(e)}function tc(e){return e.replace(Yx,"")===""}class di{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}di.prototype.normal={};di.prototype.property={};di.prototype.space=void 0;function Xd(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new di(n,r,t)}function As(e){return e.toLowerCase()}class kt{constructor(t,n){this.attribute=n,this.property=t}}kt.prototype.attribute="";kt.prototype.booleanish=!1;kt.prototype.boolean=!1;kt.prototype.commaOrSpaceSeparated=!1;kt.prototype.commaSeparated=!1;kt.prototype.defined=!1;kt.prototype.mustUseProperty=!1;kt.prototype.number=!1;kt.prototype.overloadedBoolean=!1;kt.prototype.property="";kt.prototype.spaceSeparated=!1;kt.prototype.space=void 0;let eI=0;const be=ir(),Xe=ir(),Fs=ir(),W=ir(),je=ir(),fr=ir(),At=ir();function ir(){return 2**++eI}const Ps=Object.freeze(Object.defineProperty({__proto__:null,boolean:be,booleanish:Xe,commaOrSpaceSeparated:At,commaSeparated:fr,number:W,overloadedBoolean:Fs,spaceSeparated:je},Symbol.toStringTag,{value:"Module"})),Ko=Object.keys(Ps);class ma extends kt{constructor(t,n,r,i){let o=-1;if(super(t,n),nc(this,"space",i),typeof r=="number")for(;++o<Ko.length;){const s=Ko[o];nc(this,Ko[o],(r&Ps[s])===Ps[s])}}}ma.prototype.defined=!0;function nc(e,t,n){n&&(e[t]=n)}function Rr(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const o=new ma(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[As(r)]=r,n[As(o.attribute)]=r}return new di(t,n,e.space)}const Yd=Rr({properties:{ariaActiveDescendant:null,ariaAtomic:Xe,ariaAutoComplete:null,ariaBusy:Xe,ariaChecked:Xe,ariaColCount:W,ariaColIndex:W,ariaColSpan:W,ariaControls:je,ariaCurrent:null,ariaDescribedBy:je,ariaDetails:null,ariaDisabled:Xe,ariaDropEffect:je,ariaErrorMessage:null,ariaExpanded:Xe,ariaFlowTo:je,ariaGrabbed:Xe,ariaHasPopup:null,ariaHidden:Xe,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:je,ariaLevel:W,ariaLive:null,ariaModal:Xe,ariaMultiLine:Xe,ariaMultiSelectable:Xe,ariaOrientation:null,ariaOwns:je,ariaPlaceholder:null,ariaPosInSet:W,ariaPressed:Xe,ariaReadOnly:Xe,ariaRelevant:null,ariaRequired:Xe,ariaRoleDescription:je,ariaRowCount:W,ariaRowIndex:W,ariaRowSpan:W,ariaSelected:Xe,ariaSetSize:W,ariaSort:null,ariaValueMax:W,ariaValueMin:W,ariaValueNow:W,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Zd(e,t){return t in e?e[t]:t}function ef(e,t){return Zd(e,t.toLowerCase())}const tI=Rr({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:fr,acceptCharset:je,accessKey:je,action:null,allow:null,allowFullScreen:be,allowPaymentRequest:be,allowUserMedia:be,alt:null,as:null,async:be,autoCapitalize:null,autoComplete:je,autoFocus:be,autoPlay:be,blocking:je,capture:null,charSet:null,checked:be,cite:null,className:je,cols:W,colSpan:null,content:null,contentEditable:Xe,controls:be,controlsList:je,coords:W|fr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:be,defer:be,dir:null,dirName:null,disabled:be,download:Fs,draggable:Xe,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:be,formTarget:null,headers:je,height:W,hidden:Fs,high:W,href:null,hrefLang:null,htmlFor:je,httpEquiv:je,id:null,imageSizes:null,imageSrcSet:null,inert:be,inputMode:null,integrity:null,is:null,isMap:be,itemId:null,itemProp:je,itemRef:je,itemScope:be,itemType:je,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:be,low:W,manifest:null,max:null,maxLength:W,media:null,method:null,min:null,minLength:W,multiple:be,muted:be,name:null,nonce:null,noModule:be,noValidate:be,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:be,optimum:W,pattern:null,ping:je,placeholder:null,playsInline:be,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:be,referrerPolicy:null,rel:je,required:be,reversed:be,rows:W,rowSpan:W,sandbox:je,scope:null,scoped:be,seamless:be,selected:be,shadowRootClonable:be,shadowRootDelegatesFocus:be,shadowRootMode:null,shape:null,size:W,sizes:null,slot:null,span:W,spellCheck:Xe,src:null,srcDoc:null,srcLang:null,srcSet:null,start:W,step:null,style:null,tabIndex:W,target:null,title:null,translate:null,type:null,typeMustMatch:be,useMap:null,value:Xe,width:W,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:je,axis:null,background:null,bgColor:null,border:W,borderColor:null,bottomMargin:W,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:be,declare:be,event:null,face:null,frame:null,frameBorder:null,hSpace:W,leftMargin:W,link:null,longDesc:null,lowSrc:null,marginHeight:W,marginWidth:W,noResize:be,noHref:be,noShade:be,noWrap:be,object:null,profile:null,prompt:null,rev:null,rightMargin:W,rules:null,scheme:null,scrolling:Xe,standby:null,summary:null,text:null,topMargin:W,valueType:null,version:null,vAlign:null,vLink:null,vSpace:W,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:be,disableRemotePlayback:be,prefix:null,property:null,results:W,security:null,unselectable:null},space:"html",transform:ef}),nI=Rr({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:At,accentHeight:W,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:W,amplitude:W,arabicForm:null,ascent:W,attributeName:null,attributeType:null,azimuth:W,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:W,by:null,calcMode:null,capHeight:W,className:je,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:W,diffuseConstant:W,direction:null,display:null,dur:null,divisor:W,dominantBaseline:null,download:be,dx:null,dy:null,edgeMode:null,editable:null,elevation:W,enableBackground:null,end:null,event:null,exponent:W,externalResourcesRequired:null,fill:null,fillOpacity:W,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:fr,g2:fr,glyphName:fr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:W,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:W,horizOriginX:W,horizOriginY:W,id:null,ideographic:W,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:W,k:W,k1:W,k2:W,k3:W,k4:W,kernelMatrix:At,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:W,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:W,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:W,overlineThickness:W,paintOrder:null,panose1:null,path:null,pathLength:W,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:je,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:W,pointsAtY:W,pointsAtZ:W,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:At,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:At,rev:At,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:At,requiredFeatures:At,requiredFonts:At,requiredFormats:At,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:W,specularExponent:W,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:W,strikethroughThickness:W,string:null,stroke:null,strokeDashArray:At,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:W,strokeOpacity:W,strokeWidth:null,style:null,surfaceScale:W,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:At,tabIndex:W,tableValues:null,target:null,targetX:W,targetY:W,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:At,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:W,underlineThickness:W,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:W,values:null,vAlphabetic:W,vMathematical:W,vectorEffect:null,vHanging:W,vIdeographic:W,version:null,vertAdvY:W,vertOriginX:W,vertOriginY:W,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:W,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Zd}),tf=Rr({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()}}),nf=Rr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:ef}),rf=Rr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),rI={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"},iI=/[A-Z]/g,rc=/-[a-z]/g,oI=/^data[-\w.:]+$/i;function sI(e,t){const n=As(t);let r=t,i=kt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&oI.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(rc,lI);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!rc.test(o)){let s=o.replace(iI,aI);s.charAt(0)!=="-"&&(s="-"+s),t="data"+s}}i=ma}return new i(r,t)}function aI(e){return"-"+e.toLowerCase()}function lI(e){return e.charAt(1).toUpperCase()}const cI=Xd([Yd,tI,tf,nf,rf],"html"),ga=Xd([Yd,nI,tf,nf,rf],"svg");function uI(e){return e.join(" ").trim()}var lr={},Ho,ic;function dI(){if(ic)return Ho;ic=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,s=/^[;\s]*/,a=/^\s+|\s+$/g,l=`
|
|
7
|
-
`,c="/",u="*",d="",h="comment",f="declaration";function y(g,b){if(typeof g!="string")throw new TypeError("First argument must be a string");if(!g)return[];b=b||{};var m=1,w=1;function C(P){var V=P.match(t);V&&(m+=V.length);var Y=P.lastIndexOf(l);w=~Y?P.length-Y:w+P.length}function E(){var P={line:m,column:w};return function(V){return V.position=new _(P),L(),V}}function _(P){this.start=P,this.end={line:m,column:w},this.source=b.source}_.prototype.content=g;function A(P){var V=new Error(b.source+":"+m+":"+w+": "+P);if(V.reason=P,V.filename=b.source,V.line=m,V.column=w,V.source=g,!b.silent)throw V}function k(P){var V=P.exec(g);if(V){var Y=V[0];return C(Y),g=g.slice(Y.length),V}}function L(){k(n)}function M(P){var V;for(P=P||[];V=F();)V!==!1&&P.push(V);return P}function F(){var P=E();if(!(c!=g.charAt(0)||u!=g.charAt(1))){for(var V=2;d!=g.charAt(V)&&(u!=g.charAt(V)||c!=g.charAt(V+1));)++V;if(V+=2,d===g.charAt(V-1))return A("End of comment missing");var Y=g.slice(2,V-2);return w+=2,C(Y),g=g.slice(V),w+=2,P({type:h,comment:Y})}}function j(){var P=E(),V=k(r);if(V){if(F(),!k(i))return A("property missing ':'");var Y=k(o),ae=P({type:f,property:v(V[0].replace(e,d)),value:Y?v(Y[0].replace(e,d)):d});return k(s),ae}}function G(){var P=[];M(P);for(var V;V=j();)V!==!1&&(P.push(V),M(P));return P}return L(),G()}function v(g){return g?g.replace(a,d):d}return Ho=y,Ho}var oc;function fI(){if(oc)return lr;oc=1;var e=lr&&lr.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(lr,"__esModule",{value:!0}),lr.default=n;const t=e(dI());function n(r,i){let o=null;if(!r||typeof r!="string")return o;const s=(0,t.default)(r),a=typeof i=="function";return s.forEach(l=>{if(l.type!=="declaration")return;const{property:c,value:u}=l;a?i(c,u,l):u&&(o=o||{},o[c]=u)}),o}return lr}var Br={},sc;function pI(){if(sc)return Br;sc=1,Object.defineProperty(Br,"__esModule",{value:!0}),Br.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,o=function(c){return!c||n.test(c)||e.test(c)},s=function(c,u){return u.toUpperCase()},a=function(c,u){return"".concat(u,"-")},l=function(c,u){return u===void 0&&(u={}),o(c)?c:(c=c.toLowerCase(),u.reactCompat?c=c.replace(i,a):c=c.replace(r,a),c.replace(t,s))};return Br.camelCase=l,Br}var Vr,ac;function hI(){if(ac)return Vr;ac=1;var e=Vr&&Vr.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(fI()),n=pI();function r(i,o){var s={};return!i||typeof i!="string"||(0,t.default)(i,function(a,l){a&&l&&(s[(0,n.camelCase)(a,o)]=l)}),s}return r.default=r,Vr=r,Vr}var mI=hI();const gI=_r(mI),of=sf("end"),ya=sf("start");function sf(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 yI(e){const t=ya(e),n=of(e);if(t&&n)return{start:t,end:n}}function Wr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?lc(e.position):"start"in e||"end"in e?lc(e):"line"in e||"column"in e?Ds(e):""}function Ds(e){return cc(e&&e.line)+":"+cc(e&&e.column)}function lc(e){return Ds(e&&e.start)+"-"+Ds(e&&e.end)}function cc(e){return e&&typeof e=="number"?e:1}class vt 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=Wr(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}}vt.prototype.file="";vt.prototype.name="";vt.prototype.reason="";vt.prototype.message="";vt.prototype.stack="";vt.prototype.column=void 0;vt.prototype.line=void 0;vt.prototype.ancestors=void 0;vt.prototype.cause=void 0;vt.prototype.fatal=void 0;vt.prototype.place=void 0;vt.prototype.ruleId=void 0;vt.prototype.source=void 0;const va={}.hasOwnProperty,vI=new Map,bI=/[A-Z]/g,wI=new Set(["table","tbody","thead","tfoot","tr"]),xI=new Set(["td","th"]),af="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function II(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=kI(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=NI(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"?ga:cI,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=lf(i,e,void 0);return o&&typeof o!="string"?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function lf(e,t,n){if(t.type==="element")return SI(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return CI(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return EI(e,t,n);if(t.type==="mdxjsEsm")return OI(e,t);if(t.type==="root")return _I(e,t,n);if(t.type==="text")return TI(e,t)}function SI(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=ga,e.schema=i),e.ancestors.push(t);const o=uf(e,t.tagName,!1),s=RI(e,t);let a=wa(e,t);return wI.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!Zx(l):!0})),cf(e,s,o,t),ba(s,a),e.ancestors.pop(),e.schema=r,e.create(t,o,s,n)}function CI(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)}oi(e,t.position)}function OI(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);oi(e,t.position)}function EI(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=ga,e.schema=i),e.ancestors.push(t);const o=t.name===null?e.Fragment:uf(e,t.name,!0),s=AI(e,t),a=wa(e,t);return cf(e,s,o,t),ba(s,a),e.ancestors.pop(),e.schema=r,e.create(t,o,s,n)}function _I(e,t,n){const r={};return ba(r,wa(e,t)),e.create(t,e.Fragment,r,n)}function TI(e,t){return t.value}function cf(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function ba(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function NI(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 kI(e,t){return n;function n(r,i,o,s){const a=Array.isArray(o.children),l=ya(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 RI(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&va.call(t.properties,i)){const o=FI(e,i,t.properties[i]);if(o){const[s,a]=o;e.tableCellAlignToStyle&&s==="align"&&typeof a=="string"&&xI.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 AI(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 oi(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 oi(e,t.position);else o=r.value===null?!0:r.value;n[i]=o}return n}function wa(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:vI;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=lf(e,o,s);a!==void 0&&n.push(a)}return n}function FI(e,t,n){const r=sI(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Wx(n):uI(n)),r.property==="style"){let i=typeof n=="object"?n:PI(e,String(n));return e.stylePropertyNameCase==="css"&&(i=DI(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?rI[r.property]||r.property:r.attribute,n]}}function PI(e,t){try{return gI(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new vt("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=af+"#cannot-parse-style-attribute",i}}function uf(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=ec(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=ec(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return va.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);oi(e)}function oi(e,t){const n=new vt("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=af+"#cannot-handle-mdx-estrees-without-createevaluater",n}function DI(e){const t={};let n;for(n in e)va.call(e,n)&&(t[MI(n)]=e[n]);return t}function MI(e){let t=e.replace(bI,jI);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function jI(e){return"-"+e.toLowerCase()}const Jo={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"]},LI={};function BI(e,t){const n=LI,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return df(e,r,i)}function df(e,t,n){if(VI(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 uc(e.children,t,n)}return Array.isArray(e)?uc(e,t,n):""}function uc(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=df(e[i],t,n);return r.join("")}function VI(e){return!!(e&&typeof e=="object")}const dc=document.createElement("i");function xa(e){const t="&"+e+";";dc.innerHTML=t;const n=dc.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function ln(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 Ht(e,t){return e.length>0?(ln(e,e.length,0,t),e):t}const fc={}.hasOwnProperty;function UI(e){const t={};let n=-1;for(;++n<e.length;)qI(t,e[n]);return t}function qI(e,t){let n;for(n in t){const i=(fc.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let s;if(o)for(s in o){fc.call(i,s)||(i[s]=[]);const a=o[s];$I(i[s],Array.isArray(a)?a:a?[a]:[])}}}function $I(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);ln(e,0,0,r)}function ff(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 pr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const sn=Ln(/[A-Za-z]/),Dt=Ln(/[\dA-Za-z]/),zI=Ln(/[#-'*+\--9=?A-Z^-~]/);function Ms(e){return e!==null&&(e<32||e===127)}const js=Ln(/\d/),KI=Ln(/[\dA-Fa-f]/),HI=Ln(/[!-/:-@[-`{-~]/);function he(e){return e!==null&&e<-2}function Nt(e){return e!==null&&(e<0||e===32)}function _e(e){return e===-2||e===-1||e===32}const JI=Ln(new RegExp("\\p{P}|\\p{S}","u")),WI=Ln(/\s/);function Ln(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ar(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const o=e.charCodeAt(n);let s="";if(o===37&&Dt(e.charCodeAt(n+1))&&Dt(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 Le(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return s;function s(l){return _e(l)?(e.enter(n),a(l)):t(l)}function a(l){return _e(l)&&o++<i?(e.consume(l),a):(e.exit(n),t(l))}}const QI={tokenize:GI};function GI(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"),Le(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 he(a)?(e.consume(a),e.exit("chunkText"),o):(e.consume(a),s)}}const XI={tokenize:YI},pc={tokenize:ZI};function YI(e){const t=this,n=[];let r=0,i,o,s;return a;function a(w){if(r<n.length){const C=n[r];return t.containerState=C[1],e.attempt(C[0].continuation,l,c)(w)}return c(w)}function l(w){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&m();const C=t.events.length;let E=C,_;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){_=t.events[E][1].end;break}b(r);let A=C;for(;A<t.events.length;)t.events[A][1].end={..._},A++;return ln(t.events,E+1,0,t.events.slice(C)),t.events.length=A,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(pc,u,d)(w)}function u(w){return i&&m(),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(pc,f,y)(w)}function f(w){return r++,n.push([t.currentConstruct,t.containerState]),h(w)}function y(w){if(w===null){i&&m(),b(0),e.consume(w);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:o}),v(w)}function v(w){if(w===null){g(e.exit("chunkFlow"),!0),b(0),e.consume(w);return}return he(w)?(e.consume(w),g(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(w),v)}function g(w,C){const E=t.sliceStream(w);if(C&&E.push(null),w.previous=o,o&&(o.next=w),o=w,i.defineSkip(w.start),i.write(E),t.parser.lazy[w.start.line]){let _=i.events.length;for(;_--;)if(i.events[_][1].start.offset<s&&(!i.events[_][1].end||i.events[_][1].end.offset>s))return;const A=t.events.length;let k=A,L,M;for(;k--;)if(t.events[k][0]==="exit"&&t.events[k][1].type==="chunkFlow"){if(L){M=t.events[k][1].end;break}L=!0}for(b(r),_=A;_<t.events.length;)t.events[_][1].end={...M},_++;ln(t.events,k+1,0,t.events.slice(A)),t.events.length=_}}function b(w){let C=n.length;for(;C-- >w;){const E=n[C];t.containerState=E[1],E[0].exit.call(t,e)}n.length=w}function m(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function ZI(e,t,n){return Le(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function hc(e){if(e===null||Nt(e)||WI(e))return 1;if(JI(e))return 2}function Ia(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 Ls={name:"attention",resolveAll:eS,tokenize:tS};function eS(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};mc(d,-l),mc(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=Ht(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=Ht(c,[["enter",i,t],["enter",s,t],["exit",s,t],["enter",o,t]]),c=Ht(c,Ia(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=Ht(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=Ht(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,ln(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 tS(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=hc(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=hc(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 mc(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const nS={name:"autolink",tokenize:rS};function rS(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 sn(f)?(e.consume(f),s):f===64?n(f):c(f)}function s(f){return f===43||f===45||f===46||Dt(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||Dt(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||Ms(f)?n(f):(e.consume(f),l)}function c(f){return f===64?(e.consume(f),u):zI(f)?(e.consume(f),c):n(f)}function u(f){return Dt(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||Dt(f))&&r++<63){const y=f===45?h:d;return e.consume(f),y}return n(f)}}const wo={partial:!0,tokenize:iS};function iS(e,t,n){return r;function r(o){return _e(o)?Le(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||he(o)?t(o):n(o)}}const pf={continuation:{tokenize:sS},exit:aS,name:"blockQuote",tokenize:oS};function oS(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 _e(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function sS(e,t,n){const r=this;return i;function i(s){return _e(s)?Le(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):o(s)}function o(s){return e.attempt(pf,t,n)(s)}}function aS(e){e.exit("blockQuote")}const hf={name:"characterEscape",tokenize:lS};function lS(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 HI(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const mf={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=Dt,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=KI,u):(e.enter("characterReferenceValue"),o=7,s=js,u(d))}function u(d){if(d===59&&i){const h=e.exit("characterReferenceValue");return s===Dt&&!xa(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 gc={partial:!0,tokenize:dS},yc={concrete:!0,name:"codeFenced",tokenize:uS};function uS(e,t,n){const r=this,i={partial:!0,tokenize:E};let o=0,s=0,a;return l;function l(_){return c(_)}function c(_){const A=r.events[r.events.length-1];return o=A&&A[1].type==="linePrefix"?A[2].sliceSerialize(A[1],!0).length:0,a=_,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(_)}function u(_){return _===a?(s++,e.consume(_),u):s<3?n(_):(e.exit("codeFencedFenceSequence"),_e(_)?Le(e,d,"whitespace")(_):d(_))}function d(_){return _===null||he(_)?(e.exit("codeFencedFence"),r.interrupt?t(_):e.check(gc,v,C)(_)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(_))}function h(_){return _===null||he(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(_)):_e(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Le(e,f,"whitespace")(_)):_===96&&_===a?n(_):(e.consume(_),h)}function f(_){return _===null||he(_)?d(_):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),y(_))}function y(_){return _===null||he(_)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(_)):_===96&&_===a?n(_):(e.consume(_),y)}function v(_){return e.attempt(i,C,g)(_)}function g(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),b}function b(_){return o>0&&_e(_)?Le(e,m,"linePrefix",o+1)(_):m(_)}function m(_){return _===null||he(_)?e.check(gc,v,C)(_):(e.enter("codeFlowValue"),w(_))}function w(_){return _===null||he(_)?(e.exit("codeFlowValue"),m(_)):(e.consume(_),w)}function C(_){return e.exit("codeFenced"),t(_)}function E(_,A,k){let L=0;return M;function M(V){return _.enter("lineEnding"),_.consume(V),_.exit("lineEnding"),F}function F(V){return _.enter("codeFencedFence"),_e(V)?Le(_,j,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):j(V)}function j(V){return V===a?(_.enter("codeFencedFenceSequence"),G(V)):k(V)}function G(V){return V===a?(L++,_.consume(V),G):L>=s?(_.exit("codeFencedFenceSequence"),_e(V)?Le(_,P,"whitespace")(V):P(V)):k(V)}function P(V){return V===null||he(V)?(_.exit("codeFencedFence"),A(V)):k(V)}}}function dS(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 Wo={name:"codeIndented",tokenize:pS},fS={partial:!0,tokenize:hS};function pS(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),Le(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):he(c)?e.attempt(fS,s,l)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||he(c)?(e.exit("codeFlowValue"),s(c)):(e.consume(c),a)}function l(c){return e.exit("codeIndented"),t(c)}}function hS(e,t,n){const r=this;return i;function i(s){return r.parser.lazy[r.now().line]?n(s):he(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):Le(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):he(s)?i(s):n(s)}}const mS={name:"codeText",previous:yS,resolve:gS,tokenize:vS};function gS(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 yS(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function vS(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)):he(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||he(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&&Ur(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),Ur(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ur(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);Ur(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ur(this.left,n.reverse())}}}function Ur(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 gf(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,wS(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 ln(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function wS(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,v=0;const g=[v];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&&(v=h+1,g.push(v),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(s.events=[],f?(f._tokenizer=void 0,f.previous=void 0):g.pop(),h=g.length;h--;){const b=a.slice(g[h],g[h+1]),m=o.pop();l.push([m,m+b.length-1]),e.splice(m,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 xS={resolve:SS,tokenize:CS},IS={partial:!0,tokenize:OS};function SS(e){return gf(e),e}function CS(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):he(a)?e.check(IS,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 OS(e,t,n){const r=this;return i;function i(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Le(e,o,"linePrefix")}function o(s){if(s===null||he(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 yf(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||Ms(b)?n(b):(e.enter(r),e.enter(s),e.enter(a),e.enter("chunkString",{contentType:"string"}),v(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||he(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 v(b){return!u&&(b===null||b===41||Nt(b))?(e.exit("chunkString"),e.exit(a),e.exit(s),e.exit(r),t(b)):u<c&&b===40?(e.consume(b),u++,v):b===41?(e.consume(b),u--,v):b===null||b===32||b===40||Ms(b)?n(b):(e.consume(b),b===92?g:v)}function g(b){return b===40||b===41||b===92?(e.consume(b),v):v(b)}}function vf(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):he(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||he(f)||a++>999?(e.exit("chunkString"),u(f)):(e.consume(f),l||(l=!_e(f)),f===92?h:d)}function h(f){return f===91||f===92||f===93?(e.consume(f),a++,d):d(f)}}function bf(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):he(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),Le(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(h))}function u(h){return h===s||h===null||he(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 Qr(e,t){let n;return r;function r(i){return he(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):_e(i)?Le(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const ES={name:"definition",tokenize:TS},_S={partial:!0,tokenize:NS};function TS(e,t,n){const r=this;let i;return o;function o(f){return e.enter("definition"),s(f)}function s(f){return vf.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function a(f){return i=pr(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 Nt(f)?Qr(e,c)(f):c(f)}function c(f){return yf(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function u(f){return e.attempt(_S,d,d)(f)}function d(f){return _e(f)?Le(e,h,"whitespace")(f):h(f)}function h(f){return f===null||he(f)?(e.exit("definition"),r.parser.defined.push(i),t(f)):n(f)}}function NS(e,t,n){return r;function r(a){return Nt(a)?Qr(e,i)(a):n(a)}function i(a){return bf(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function o(a){return _e(a)?Le(e,s,"whitespace")(a):s(a)}function s(a){return a===null||he(a)?t(a):n(a)}}const kS={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 he(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const AS={name:"headingAtx",resolve:FS,tokenize:PS};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"},ln(e,r,n-r+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])),e}function PS(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||Nt(u)?(e.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||he(u)?(e.exit("atxHeading"),t(u)):_e(u)?Le(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||Nt(u)?(e.exit("atxHeadingText"),a(u)):(e.consume(u),c)}}const DS=["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"],vc=["pre","script","style","textarea"],MS={concrete:!0,name:"htmlFlow",resolveTo:BS,tokenize:VS},jS={partial:!0,tokenize:qS},LS={partial:!0,tokenize:US};function BS(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 VS(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,v):S===63?(e.consume(S),i=3,r.interrupt?t:x):sn(S)?(e.consume(S),s=String.fromCharCode(S),g):n(S)}function h(S){return S===45?(e.consume(S),i=2,f):S===91?(e.consume(S),i=5,a=0,y):sn(S)?(e.consume(S),i=4,r.interrupt?t:x):n(S)}function f(S){return S===45?(e.consume(S),r.interrupt?t:x):n(S)}function y(S){const $="CDATA[";return S===$.charCodeAt(a++)?(e.consume(S),a===$.length?r.interrupt?t:j:y):n(S)}function v(S){return sn(S)?(e.consume(S),s=String.fromCharCode(S),g):n(S)}function g(S){if(S===null||S===47||S===62||Nt(S)){const $=S===47,q=s.toLowerCase();return!$&&!o&&vc.includes(q)?(i=1,r.interrupt?t(S):j(S)):DS.includes(s.toLowerCase())?(i=6,$?(e.consume(S),b):r.interrupt?t(S):j(S)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(S):o?m(S):w(S))}return S===45||Dt(S)?(e.consume(S),s+=String.fromCharCode(S),g):n(S)}function b(S){return S===62?(e.consume(S),r.interrupt?t:j):n(S)}function m(S){return _e(S)?(e.consume(S),m):M(S)}function w(S){return S===47?(e.consume(S),M):S===58||S===95||sn(S)?(e.consume(S),C):_e(S)?(e.consume(S),w):M(S)}function C(S){return S===45||S===46||S===58||S===95||Dt(S)?(e.consume(S),C):E(S)}function E(S){return S===61?(e.consume(S),_):_e(S)?(e.consume(S),E):w(S)}function _(S){return S===null||S===60||S===61||S===62||S===96?n(S):S===34||S===39?(e.consume(S),l=S,A):_e(S)?(e.consume(S),_):k(S)}function A(S){return S===l?(e.consume(S),l=null,L):S===null||he(S)?n(S):(e.consume(S),A)}function k(S){return S===null||S===34||S===39||S===47||S===60||S===61||S===62||S===96||Nt(S)?E(S):(e.consume(S),k)}function L(S){return S===47||S===62||_e(S)?w(S):n(S)}function M(S){return S===62?(e.consume(S),F):n(S)}function F(S){return S===null||he(S)?j(S):_e(S)?(e.consume(S),F):n(S)}function j(S){return S===45&&i===2?(e.consume(S),Y):S===60&&i===1?(e.consume(S),ae):S===62&&i===4?(e.consume(S),J):S===63&&i===3?(e.consume(S),x):S===93&&i===5?(e.consume(S),ge):he(S)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(jS,B,G)(S)):S===null||he(S)?(e.exit("htmlFlowData"),G(S)):(e.consume(S),j)}function G(S){return e.check(LS,P,B)(S)}function P(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),V}function V(S){return S===null||he(S)?G(S):(e.enter("htmlFlowData"),j(S))}function Y(S){return S===45?(e.consume(S),x):j(S)}function ae(S){return S===47?(e.consume(S),s="",pe):j(S)}function pe(S){if(S===62){const $=s.toLowerCase();return vc.includes($)?(e.consume(S),J):j(S)}return sn(S)&&s.length<8?(e.consume(S),s+=String.fromCharCode(S),pe):j(S)}function ge(S){return S===93?(e.consume(S),x):j(S)}function x(S){return S===62?(e.consume(S),J):S===45&&i===2?(e.consume(S),x):j(S)}function J(S){return S===null||he(S)?(e.exit("htmlFlowData"),B(S)):(e.consume(S),J)}function B(S){return e.exit("htmlFlow"),t(S)}}function US(e,t,n){const r=this;return i;function i(s){return he(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(wo,t,n)}}const $S={name:"htmlText",tokenize:zS};function zS(e,t,n){const r=this;let i,o,s;return a;function a(x){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(x),l}function l(x){return x===33?(e.consume(x),c):x===47?(e.consume(x),E):x===63?(e.consume(x),w):sn(x)?(e.consume(x),k):n(x)}function c(x){return x===45?(e.consume(x),u):x===91?(e.consume(x),o=0,y):sn(x)?(e.consume(x),m):n(x)}function u(x){return x===45?(e.consume(x),f):n(x)}function d(x){return x===null?n(x):x===45?(e.consume(x),h):he(x)?(s=d,ae(x)):(e.consume(x),d)}function h(x){return x===45?(e.consume(x),f):d(x)}function f(x){return x===62?Y(x):x===45?h(x):d(x)}function y(x){const J="CDATA[";return x===J.charCodeAt(o++)?(e.consume(x),o===J.length?v:y):n(x)}function v(x){return x===null?n(x):x===93?(e.consume(x),g):he(x)?(s=v,ae(x)):(e.consume(x),v)}function g(x){return x===93?(e.consume(x),b):v(x)}function b(x){return x===62?Y(x):x===93?(e.consume(x),b):v(x)}function m(x){return x===null||x===62?Y(x):he(x)?(s=m,ae(x)):(e.consume(x),m)}function w(x){return x===null?n(x):x===63?(e.consume(x),C):he(x)?(s=w,ae(x)):(e.consume(x),w)}function C(x){return x===62?Y(x):w(x)}function E(x){return sn(x)?(e.consume(x),_):n(x)}function _(x){return x===45||Dt(x)?(e.consume(x),_):A(x)}function A(x){return he(x)?(s=A,ae(x)):_e(x)?(e.consume(x),A):Y(x)}function k(x){return x===45||Dt(x)?(e.consume(x),k):x===47||x===62||Nt(x)?L(x):n(x)}function L(x){return x===47?(e.consume(x),Y):x===58||x===95||sn(x)?(e.consume(x),M):he(x)?(s=L,ae(x)):_e(x)?(e.consume(x),L):Y(x)}function M(x){return x===45||x===46||x===58||x===95||Dt(x)?(e.consume(x),M):F(x)}function F(x){return x===61?(e.consume(x),j):he(x)?(s=F,ae(x)):_e(x)?(e.consume(x),F):L(x)}function j(x){return x===null||x===60||x===61||x===62||x===96?n(x):x===34||x===39?(e.consume(x),i=x,G):he(x)?(s=j,ae(x)):_e(x)?(e.consume(x),j):(e.consume(x),P)}function G(x){return x===i?(e.consume(x),i=void 0,V):x===null?n(x):he(x)?(s=G,ae(x)):(e.consume(x),G)}function P(x){return x===null||x===34||x===39||x===60||x===61||x===96?n(x):x===47||x===62||Nt(x)?L(x):(e.consume(x),P)}function V(x){return x===47||x===62||Nt(x)?L(x):n(x)}function Y(x){return x===62?(e.consume(x),e.exit("htmlTextData"),e.exit("htmlText"),t):n(x)}function ae(x){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),pe}function pe(x){return _e(x)?Le(e,ge,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(x):ge(x)}function ge(x){return e.enter("htmlTextData"),s(x)}}const Sa={name:"labelEnd",resolveAll:WS,resolveTo:QS,tokenize:GS},KS={tokenize:XS},HS={tokenize:YS},JS={tokenize:ZS};function WS(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&&ln(e,0,e.length,n),e}function QS(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=Ht(a,e.slice(o+1,o+r+3)),a=Ht(a,[["enter",u,t]]),a=Ht(a,Ia(t.parser.constructs.insideSpan.null,e.slice(o+r+4,s-3),t)),a=Ht(a,[["exit",u,t],e[s-2],e[s-1],["exit",c,t]]),a=Ht(a,e.slice(s+1)),a=Ht(a,[["exit",l,t]]),ln(e,o,e.length,a),e}function GS(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(pr(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(KS,u,s?u:d)(h):h===91?e.attempt(HS,u,s?c:d)(h):s?u(h):d(h)}function c(h){return e.attempt(JS,u,d)(h)}function u(h){return t(h)}function d(h){return o._balanced=!0,n(h)}}function XS(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 Nt(d)?Qr(e,o)(d):o(d)}function o(d){return d===41?u(d):yf(e,s,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function s(d){return Nt(d)?Qr(e,l)(d):u(d)}function a(d){return n(d)}function l(d){return d===34||d===39||d===40?bf(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return Nt(d)?Qr(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 YS(e,t,n){const r=this;return i;function i(a){return vf.call(r,e,o,s,"reference","referenceMarker","referenceString")(a)}function o(a){return r.parser.defined.includes(pr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function s(a){return n(a)}}function ZS(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 eC={name:"labelStartImage",resolveAll:Sa.resolveAll,tokenize:tC};function tC(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 nC={name:"labelStartLink",resolveAll:Sa.resolveAll,tokenize:rC};function rC(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 Qo={name:"lineEnding",tokenize:iC};function iC(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Le(e,t,"linePrefix")}}const Hi={name:"thematicBreak",tokenize:oC};function oC(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||he(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===i?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),_e(c)?Le(e,a,"whitespace")(c):a(c))}}const Et={continuation:{tokenize:cC},exit:dC,name:"list",tokenize:lC},sC={partial:!0,tokenize:fC},aC={partial:!0,tokenize:uC};function lC(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:js(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(Hi,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 js(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(wo,r.interrupt?n:u,e.attempt(sC,h,d))}function u(f){return r.containerState.initialBlankLine=!0,o++,h(f)}function d(f){return _e(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 cC(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(wo,i,o);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Le(e,t,"listItemIndent",r.containerState.size+1)(a)}function o(a){return r.containerState.furtherBlankLines||!_e(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(aC,t,s)(a))}function s(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Le(e,e.attempt(Et,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function uC(e,t,n){const r=this;return Le(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 dC(e){e.exit(this.containerState.type)}function fC(e,t,n){const r=this;return Le(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!_e(o)&&s&&s[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const bc={name:"setextUnderline",resolveTo:pC,tokenize:hC};function pC(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 hC(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"),_e(c)?Le(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||he(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const mC={tokenize:gC};function gC(e){const t=this,n=e.attempt(wo,r,e.attempt(this.parser.constructs.flowInitial,i,Le(e,e.attempt(this.parser.constructs.flow,i,e.attempt(xS,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 yC={resolveAll:xf()},vC=wf("string"),bC=wf("text");function wf(e){return{resolveAll:xf(e==="text"?wC: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 xf(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 wC(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 xC={42:Et,43:Et,45:Et,48:Et,49:Et,50:Et,51:Et,52:Et,53:Et,54:Et,55:Et,56:Et,57:Et,62:pf},IC={91:ES},SC={[-2]:Wo,[-1]:Wo,32:Wo},CC={35:AS,42:Hi,45:[bc,Hi],60:MS,61:bc,95:Hi,96:yc,126:yc},OC={38:mf,92:hf},EC={[-5]:Qo,[-4]:Qo,[-3]:Qo,33:eC,38:mf,42:Ls,60:[nS,$S],91:nC,92:[kS,hf],93:Sa,95:Ls,96:mS},_C={null:[Ls,yC]},TC={null:[42,95]},NC={null:[]},kC=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:TC,contentInitial:IC,disable:NC,document:xC,flow:CC,flowInitial:SC,insideSpan:_C,string:OC,text:EC},Symbol.toStringTag,{value:"Module"}));function RC(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:A(E),check:A(_),consume:m,enter:w,exit:C,interrupt:A(_,{interrupt:!0})},c={code:null,containerState:{},defineSkip:v,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(F){return s=Ht(s,F),g(),s[s.length-1]!==null?[]:(k(t,0),c.events=Ia(o,c.events,c),c.events)}function h(F,j){return FC(f(F),j)}function f(F){return AC(s,F)}function y(){const{_bufferIndex:F,_index:j,line:G,column:P,offset:V}=r;return{_bufferIndex:F,_index:j,line:G,column:P,offset:V}}function v(F){i[F.line]=F.column,M()}function g(){let F;for(;r._index<s.length;){const j=s[r._index];if(typeof j=="string")for(F=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===F&&r._bufferIndex<j.length;)b(j.charCodeAt(r._bufferIndex));else b(j)}}function b(F){u=u(F)}function m(F){he(F)?(r.line++,r.column=1,r.offset+=F===-3?2:1,M()):F!==-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=F}function w(F,j){const G=j||{};return G.type=F,G.start=y(),c.events.push(["enter",G,c]),a.push(G),G}function C(F){const j=a.pop();return j.end=y(),c.events.push(["exit",j,c]),j}function E(F,j){k(F,j.from)}function _(F,j){j.restore()}function A(F,j){return G;function G(P,V,Y){let ae,pe,ge,x;return Array.isArray(P)?B(P):"tokenize"in P?B([P]):J(P);function J(X){return ie;function ie(ne){const se=ne!==null&&X[ne],ee=ne!==null&&X.null,me=[...Array.isArray(se)?se:se?[se]:[],...Array.isArray(ee)?ee:ee?[ee]:[]];return B(me)(ne)}}function B(X){return ae=X,pe=0,X.length===0?Y:S(X[pe])}function S(X){return ie;function ie(ne){return x=L(),ge=X,X.partial||(c.currentConstruct=X),X.name&&c.parser.constructs.disable.null.includes(X.name)?q():X.tokenize.call(j?Object.assign(Object.create(c),j):c,l,$,q)(ne)}}function $(X){return F(ge,x),V}function q(X){return x.restore(),++pe<ae.length?S(ae[pe]):Y}}}function k(F,j){F.resolveAll&&!o.includes(F)&&o.push(F),F.resolve&&ln(c.events,j,c.events.length-j,F.resolve(c.events.slice(j),c)),F.resolveTo&&(c.events=F.resolveTo(c.events,c))}function L(){const F=y(),j=c.previous,G=c.currentConstruct,P=c.events.length,V=Array.from(a);return{from:P,restore:Y};function Y(){r=F,c.previous=j,c.currentConstruct=G,c.events.length=P,a=V,M()}}function M(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function AC(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 FC(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=`
|
|
5
|
+
[Remedy] ${o.remedy}`:""}`;t&&t(a)}catch(i){console.error("Error parsing error response body:",i)}}else console.error("Unexpected error:",e.message)};function vo(e,t){const n=mt(e,t),{projectIdOrName:r}=Ke(),{setError:i,removeError:o}=un(),s=er({queryKey:["amp","integrations",r],queryFn:async()=>{if(!r)throw new Error("Project ID or name is required");return(await n()).integrationApi.listIntegrations({projectIdOrName:r})},enabled:!!r});return I.useEffect(()=>{s.isError?(Ye(s.error),i(Ie.INTEGRATION_LIST,r)):o(Ie.INTEGRATION_LIST,r)},[s.isError,s.error,r,i,o]),s}const la=(e,t,n)=>{const r=mt(t,n),{projectIdOrName:i}=Ke(),{data:o,isError:s,error:a}=vo(t,n),l=o?.find(u=>u.name===e)?.id,c=er({queryKey:["amp","installations",i,l,t],queryFn:async()=>{if(!i)throw new Error("Project ID is required");if(!l)throw new Error("Integration ID is required");if(!t)throw new Error("Group reference is required");return(await r()).installationApi.listInstallations({projectIdOrName:i,integrationId:l,groupRef:t})},enabled:!s&&!!i&&!!l&&!!t&&!!o&&o.length>0});return{...c,isError:c.isError||s,error:c.error||a}},Mn=()=>{const{setError:e}=un(),t=mt(),{projectIdOrName:n}=Ke(),r=er({queryKey:["project",n],queryFn:async()=>(await t()).projectApi.getProject({projectIdOrName:n})});return I.useEffect(()=>{r.isError&&e(Ie.PROJECT,n)},[r.isError,n,e]),{...r,projectIdOrName:n,appName:r.data?.name,projectId:r.data?.id}};function dn(){const{integrationNameOrId:e,groupRef:t}=jn(),n=la(e,t),{isPending:r,isFetching:i,isError:o,isSuccess:s,error:a,data:l}=n;return{installation:l?.[0],isPending:r,isFetching:i,isError:o,isSuccess:s,error:a}}const tr=e=>{const t=vo(),r=t.data?.find(i=>i.name===e||i.id===e);return{...t,data:r,provider:r?.provider}},ca=()=>{const{groupRef:e,integrationNameOrId:t}=jn(),{provider:n}=tr(t),r=fa({groupRef:e,provider:n}),{isPending:i,isFetching:o,isError:s,isSuccess:a,error:l,data:c}=r;return{connection:c?.[0],error:l,isPending:i,isFetching:o,isError:s,isSuccess:a}},fd=()=>{const e=mt(),{connection:t,isPending:n,isFetching:r}=ca(),{projectIdOrName:i}=Ke(),{integrationNameOrId:o}=jn(),{data:s}=tr(o),a=t?.id,l=s?.id,c=s?.latestRevision?.id;return er({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 bo(){const e=fd(),{isLoading:t,isPending:n,isFetching:r,isError:i,isSuccess:o,error:s,data:a}=e,l=a?.content,c=I.useMemo(()=>({getReadObject:u=>{const d=l?.read?.objects?.find(h=>h.objectName===u);return d?{object:d,getRequiredFields:()=>d.requiredFields??[],getOptionalFields:()=>d.optionalFields??[]}:(console.error(`Object ${u} not found`),{object:null,getRequiredFields:()=>null,getOptionalFields:()=>null})},getWriteObject:u=>{const d=l?.write?.objects?.find(h=>h.objectName===u);return d?{object:d}:(console.error(`Object ${u} not found`),{object:null})},getCustomerFieldsForObject:u=>{const d=l?.read?.objects?.find(h=>h.objectName===u);return d?{allFields:d.allFieldsMetadata??{},getField:h=>{const f=d.allFieldsMetadata?.[h];return f||(console.error(`Field ${h} not found`),null)}}:(console.error(`Object ${u} not found`),{allFields:null,getField:()=>null})}}),[l?.read?.objects,l?.write?.objects]);return{data:a,isLoading:t,isPending:n,isFetching:r,isError:i,isSuccess:o,error:s,...c}}function px(e){const[t,n]=I.useState(e),r=I.useRef(void 0),{getReadObject:i,data:o}=bo(),{installation:s}=dn(),a=I.useCallback(()=>t,[t]),l=I.useCallback((f,y)=>{y.provider=y.provider||o?.content?.provider||"";const v=y.read||{objects:{}},g=v.objects||{},w=g[f]||{},m=i(f),b={};return m?.getRequiredFields()?.forEach(C=>{"fieldName"in C&&(b[C.fieldName]=!0)}),w.objectName=w.objectName||f,w.selectedFields=w.selectedFields||b,g[f]=w,v.objects=g,y.read=v,{read:v,objects:g,obj:w}},[i,o?.content?.provider]),c=I.useCallback(f=>({object:t.read?.objects?.[f],getSelectedField:y=>!!t.read?.objects?.[f]?.selectedFields?.[y],setSelectedField:({fieldName:y,selected:v})=>{n(g=>St(g,w=>{const{obj:m}=l(f,w);m.selectedFields=m.selectedFields||{},m.selectedFields[y]=v,m.selectedFields[y]===!1&&delete m.selectedFields[y]}))},getFieldMapping:y=>t.read?.objects?.[f]?.selectedFieldMappings?.[y],setFieldMapping:({fieldName:y,mapToName:v})=>{n(g=>St(g,w=>{const{obj:m}=l(f,w);m.selectedFieldMappings=m.selectedFieldMappings||{},m.selectedFieldMappings[v]=y}))},deleteFieldMapping:y=>{n(v=>St(v,g=>{const w=g.read?.objects?.[f]?.selectedFieldMappings;w&&y in w&&delete w[y]}))}}),[t.read?.objects,l]),u=I.useCallback(f=>{const y=t.write?.objects?.[f],v=m=>{const b=m.write||{},C=b.objects||{},E=C[f]||{objectName:f};return C[f]=E,b.objects=C,m.write=b,{write:b,objects:C,obj:E}},g=(m,b)=>y?.selectedFieldSettings?.[m]?.[b],w=(m,b,C)=>{n(E=>St(E,_=>{const{obj:A}=v(_);A.selectedFieldSettings={...A.selectedFieldSettings,[m]:{...A.selectedFieldSettings?.[m],[b]:C}}}))};return{object:y,setEnableWrite:()=>{n(m=>St(m,b=>{const{obj:C}=v(b);C.objectName=f}))},setDisableWrite:()=>{n(m=>St(m,b=>{const{objects:C}=v(b);delete C[f]}))},getWriteObject:()=>t.write?.objects?.[f],getSelectedFieldSettings:m=>y?.selectedFieldSettings?.[m],setSelectedFieldSettings:({fieldName:m,settings:b})=>{n(C=>St(C,E=>{const{obj:_}=v(E),A=_.selectedFieldSettings||{};_.selectedFieldSettings={...A,[m]:b},b===void 0&&delete _.selectedFieldSettings[m]}))},getDefaultValues:m=>g(m,"default"),setDefaultValues:({fieldName:m,value:b})=>w(m,"default",b),getWriteOnCreateSetting:m=>g(m,"writeOnCreate"),setWriteOnCreateSetting:({fieldName:m,value:b})=>w(m,"writeOnCreate",b),getWriteOnUpdateSetting:m=>g(m,"writeOnUpdate"),setWriteOnUpdateSetting:({fieldName:m,value:b})=>w(m,"writeOnUpdate",b),setEnableDeletion:()=>{n(m=>St(m,b=>{const{obj:C}=v(b);C.deletionSettings={enabled:!0}}))},setDisableDeletion:()=>{n(m=>St(m,b=>{const{obj:C}=v(b);C.deletionSettings={enabled:!1}}))}}},[t.write?.objects]),d=I.useCallback(()=>({object:t.proxy,setEnableProxy:()=>{n(f=>St(f,y=>{y.proxy={enabled:!0}}))},setDisableProxy:()=>{n(f=>St(f,y=>{y.proxy={enabled:!1}}))},getProxyEnabled:()=>t.proxy?.enabled||!1}),[t.proxy]),h=I.useCallback(()=>{n(f=>St(f,y=>{Object.assign(y,s?.config?.content)}))},[s?.config?.content]);return I.useEffect(()=>{s&&(console.debug("Installation found",{installation:s}),r.current?dd(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 ua=I.createContext(null);function hx({children:e,initialConfig:t}){const n=px(t);return p.jsx(ua.Provider,{value:n,children:e})}function mx(){const e=I.useContext(ua);if(!e)throw new Error("useLocalConfig must be used within a ConfigProvider / InstallationProvider");return e}function gx(){console.warn("useConfig is deprecated. Please use useLocalConfig instead.");const e=I.useContext(ua);if(!e)throw new Error("useConfigContext must be used within a ConfigProvider / InstallationProvider");return e}const pd=I.createContext({integrationNameOrId:"",consumerRef:"",consumerName:void 0,groupRef:"",groupName:void 0});function jn(){const e=I.useContext(pd);if(!e)throw new Error("useInstallationProps must be used within an InstallationProvider");return e}function da({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 p.jsx(pd.Provider,{value:s,children:p.jsx(hx,{initialConfig:{},children:e})})}class Rs{constructor(t){this.connectionApi=new Qb(t),this.installationApi=new Gb(t),this.integrationApi=new Xb(t),this.oAuthApi=new Yb(t),this.projectApi=new Zb(t),this.providerApi=new ew(t),this.providerAppApi=new tw(t),this.revisionApi=new nw(t)}}const hd="2.11.2",yx="v1",Fi="https://api.withampersand.com";function md(){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 Fi;case"mock":return"http://127.0.0.1:4010";case"":return Fi;default:return e??Fi}}catch{return Fi}}const vx=(e,t)=>`${e}/${t}`;function bx(){return vx(md(),yx)}const gd=md(),yd=bx(),wx=new Zs({basePath:yd,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":hd}});new Rs(wx);const xx=e=>({header:"X-Api-Key",value:e}),Ix=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")}},Ql=(e,t)=>new Zs({basePath:yd,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":hd,[e]:t}});function mt(e,t){const n=nd(),{getToken:r}=Gw(),i=jn(),o=t||i.consumerRef,s=e||i.groupRef;return I.useCallback(async()=>{if(n){const l=xx(n),c=Ql(l.header,l.value);return new Rs(c)}if(r){if(!o||!s)throw console.error("Unable to create JWT API service without consumerRef or groupRef.",{consumerRef:o,groupRef:s}),new Error("Unable to create JWT API service without consumerRef or groupRef. Provide via InstallationProvider or useAPI parameters.");const l=await r({consumerRef:o,groupRef:s}),c=Ix(l),u=Ql(c.header,c.value);return new Rs(u)}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.")},[n,r,o,s])}const fa=({groupRef:e,provider:t})=>{const{projectIdOrName:n}=Ke(),r=mt();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 Sx({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 Cx="_box_1p7c5_1",Gl={box:Cx};function bn({children:e,className:t,style:n}){return p.jsx("div",{className:t?`${Gl.box} ${t}`:Gl.box,style:n,children:e})}const Ox="_container_1wvzr_1",Xl={container:Ox};function Tr({children:e,className:t,style:n}){return p.jsx("div",{className:t?`${Xl.container} ${t}`:Xl.container,style:n,children:e})}const Ex="_errorBoxContainer_19655_1",_x="_errorBox_19655_1",Nx="_errorIconWrapper_19655_23",Tx="_errorText_19655_34",Ki={errorBoxContainer:Ex,errorBox:_x,errorIconWrapper:Nx,errorText:Tx};function vd({message:e}){return p.jsxs(bn,{className:Ki.errorBox,children:[p.jsx("div",{className:Ki.errorIconWrapper,children:p.jsx(Sx,{width:"20",height:"20"})}),p.jsx("p",{className:Ki.errorText,children:e})]})}function bd({message:e,children:t}){return p.jsxs(Tr,{className:Ki.errorBoxContainer,children:[p.jsx(vd,{message:e}),t]})}const kx="_loader_6ubm6_1",Rx={loader:kx};function Ax(){return p.jsx("span",{className:Rx.loader})}function ii(){return p.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:p.jsx(Ax,{})})}function wd({children:e}){return p.jsx(Tr,{style:{maxWidth:"55rem"},children:p.jsx(bn,{children:e})})}function kr(){return p.jsx(wd,{children:p.jsx(ii,{})})}function Tt({message:e,children:t}){return p.jsx(wd,{children:p.jsx(bd,{message:e,children:t})})}function pa(e,t){try{return process.env[e]}catch{return t}}function Wt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Fx(e,t){return t?.displayName??Wt(e)}const Px=e=>e.split(`
|
|
6
|
+
`).filter(n=>n.trim()!==""),Dx=(e,t)=>t?.length===0||!e?null:t.find(n=>n.name===e)??null;function Mx(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 jx=()=>{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}},xd=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 gt(){const e=I.useContext(xd);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function Lx({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}=vo(),{setError:h,isError:f,removeError:y}=un(),{isIntegrationDeleted:v,setIntegrationDeleted:g,resetIntegrationDeleted:w}=jx(),m=I.useMemo(()=>Dx(t,d||[]),[t,d]),{data:b,isLoading:C,isError:E,error:_}=la(t,i),A=b?.[0]||null;I.useEffect(()=>{w()},[t,n,r,i,o,c]),I.useEffect(()=>{m===null&&d?.length&&console.error(`Integration "${t}" not found in integration list`)},[t,m,d]),I.useEffect(()=>{E?(h(Ie.INSTALLATION_LIST,m?.id||""),Ye(_)):y(Ie.INSTALLATION_LIST,m?.id||"")},[E,m,h,y,_]);const k=Ze(),L=I.useCallback(()=>{k.invalidateQueries({queryKey:["amp","installations"]})},[k]),M=I.useCallback(G=>{k.setQueryData(["amp","installations"],[G]),k.invalidateQueries({queryKey:["amp","installations"]})},[k]),F=m?.id||"",j=I.useMemo(()=>({integrationId:m?.id||"",provider:m?.provider||"",integrationObj:m,consumerRef:n,consumerName:r,groupRef:i,groupName:o,installation:A||void 0,setInstallation:M,resetInstallations:L,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:l,isIntegrationDeleted:v,setIntegrationDeleted:g,fieldMapping:c,resetComponent:u}),[m,n,r,i,o,A,M,L,s,a,l,v,g,c,u]);if(C)return p.jsx(kr,{});if(m===null)return p.jsx(Tt,{message:`Integration "${t}" not found`});if(f(Ie.INSTALLATION_LIST,F)){const G=`Error retrieving installation information for integration "${m?.name||"unknown"}"`;return p.jsx(Tt,{message:G})}return p.jsx(xd.Provider,{value:j,children:e})}const Id=I.createContext({connections:null,isConnectionsLoading:!0,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),fn=()=>{const e=I.useContext(Id);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function Sd({groupRef:e,provider:t,children:n}){const r=Ze(),{setError:i,isError:o}=un(),{projectIdOrName:s,isLoading:a}=Mn(),{integrationId:l,groupRef:c}=gt(),{provider:u}=tr(l),{data:d,isLoading:h,isError:f,error:y}=fa({groupRef:e||c,provider:u||t}),v=d?.[0],g=I.useCallback(b=>{r.setQueryData(["amp","connections"],()=>b),r.invalidateQueries({queryKey:["amp","connections"]})},[r]),w=I.useCallback(()=>{r.invalidateQueries({queryKey:["amp","connections"]})},[r]);I.useEffect(()=>{f?(i(Ie.CONNECTION_LIST,s,!0),Ye(y)):i(Ie.CONNECTION_LIST,s,!1)},[f,i,s,y]);const m=I.useMemo(()=>({connections:d||null,isConnectionsLoading:h,selectedConnection:v||null,setConnections:g,setSelectedConnection:w}),[d,h,v,g,w]);if(h||a)return p.jsx(kr,{});if(s&&o(Ie.PROJECT,s))return p.jsx(Tt,{message:`Error loading project ${s}`});if(s&&o(Ie.CONNECTION_LIST,s))return p.jsx(Tt,{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(Id.Provider,{value:m,children:n})}const Cd=()=>{const e=mt(),t=Ze(),[n,r]=I.useState(null);return{...vn({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"),Ye(o,r)}}),errorMsg:n}};function Bx(e){return typeof e.provider=="string"}function Vx(e){return Bx(e)?{data:e}:{error:new Error("Config must have a provider field for creation")}}function Od(){const{projectIdOrName:e}=Ke(),{groupRef:t,integrationNameOrId:n}=jn(),{data:r}=tr(n),{connection:i}=ca(),{installation:o}=dn(),s=Ze(),{mutate:a,isIdle:l,isPending:c,error:u,errorMsg:d}=Cd();return{createInstallation:({config:f,onSuccess:y,onError:v,onSettled:g})=>{if(o){const b=new Error("Installation already created. Try updating instead.");v?.(b),g?.();return}if(!r){const b=new Error("No integration found");v?.(b),g?.();return}const w=Vx(f);if(w.error||!w.data){v?.(w.error||new Error("Invalid configuration data")),g?.();return}const m={projectIdOrName:e,integrationId:r?.id,installation:{groupRef:t,connectionId:i?.id,config:{content:w.data}}};return a(m,{onSuccess:b=>{y?.(b)},onError:b=>{v?.(b)},onSettled:()=>{g?.(),s.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:l,isPending:c,error:u,errorMsg:d}}const Ed=()=>{const e=mt(),t=Ze(),[n,r]=I.useState(null);return{...vn({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"),Ye(o,r)}}),errorMsg:n}};function _d(){const{projectIdOrName:e}=Ke(),{integrationNameOrId:t}=jn(),{data:n}=tr(t),{installation:r}=dn(),i=Ze(),{mutate:o,isIdle:s,isPending:a,error:l,errorMsg:c}=Ed();return{updateInstallation:({config:d,onSuccess:h,onError:f,onSettled:y})=>{if(!r){const w=new Error("Installation not created yet. Try creating the installation first.");f?.(w),y?.();return}if(!n){const w=new Error("No integration found");f?.(w),y?.();return}const v=[];if(d?.write?.objects){const w=Object.keys(d.write.objects).length,m=Object.keys(r?.config?.content?.write?.objects||{}).length;(w>0||w===0&&m>0)&&v.push("config.content.write.objects")}if(d?.read?.objects){const w=Object.keys(d.read.objects);v.push(...w.map(m=>`config.content.read.objects.${m}`))}const g={projectIdOrName:e,integrationId:n?.id,installationId:r.id,installationUpdate:{updateMask:v,installation:{config:{content:d}}}};return o(g,{onSuccess:w=>{h?.(w)},onError:w=>{f?.(w)},onSettled:()=>{y?.(),i.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:s,isPending:a,error:l,errorMsg:c}}const Ux=()=>{const e=mt(),t=Ze(),[n,r]=I.useState(null);return{...vn({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"),Ye(o,r)}}),errorMsg:n}};function qx(){const{projectIdOrName:e}=Ke(),{integrationNameOrId:t}=jn(),{data:n}=tr(t),{installation:r}=dn(),i=Ze(),{mutate:o,isIdle:s,isPending:a,error:l,errorMsg:c}=Ux();return{deleteInstallation:({onSuccess:d,onError:h,onSettled:f})=>{if(!r){const y=new Error("Installation not found. Not able to delete installation.");h?.(y),f?.();return}if(!n){const y=new Error("No integration found");h?.(y),f?.();return}return o({projectIdOrName:e,integrationId:n?.id,installationId:r.id},{onSuccess:()=>{d?.()},onError:y=>{h?.(y)},onSettled:()=>{f?.(),i.invalidateQueries({queryKey:["amp","installations"]}),i.invalidateQueries({queryKey:["amp","connections"]})}})},isIdle:s,isPending:a,error:l,errorMsg:c}}function Nd(){const[e,t]=I.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}var Jr={exports:{}};Jr.exports;var Yl;function $x(){return Yl||(Yl=1,(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 kn=="object"&&kn&&kn.Object===Object&&kn,v=typeof self=="object"&&self&&self.Object===Object&&self,g=y||v||Function("return this")(),w=t&&!t.nodeType&&t,m=w&&!0&&e&&!e.nodeType&&e,b=m&&m.exports===w;function C(R,re){return R?.[re]}function E(R){var re=!1;if(R!=null&&typeof R.toString!="function")try{re=!!(R+"")}catch{}return re}function _(R,re){return function(ce){return R(re(ce))}}var A=Function.prototype,k=Object.prototype,L=g["__core-js_shared__"],M=(function(){var R=/[^.]+$/.exec(L&&L.keys&&L.keys.IE_PROTO||"");return R?"Symbol(src)_1."+R:""})(),F=A.toString,j=k.hasOwnProperty,G=k.toString,P=RegExp("^"+F.call(j).replace(h,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),V=b?g.Buffer:void 0,Y=k.propertyIsEnumerable,le=V?V.isBuffer:void 0,pe=_(Object.keys,Object),ge=U(g,"DataView"),x=U(g,"Map"),J=U(g,"Promise"),B=U(g,"Set"),S=U(g,"WeakMap"),$=!Y.call({valueOf:1},"valueOf"),q=Fe(ge),X=Fe(x),ie=Fe(J),ne=Fe(B),se=Fe(S);function ee(R){return G.call(R)}function me(R){if(!Ge(R)||Z(R))return!1;var re=bt(R)||E(R)?P:f;return re.test(Fe(R))}function U(R,re){var ce=C(R,re);return me(ce)?ce:void 0}var ye=ee;(ge&&ye(new ge(new ArrayBuffer(1)))!=d||x&&ye(new x)!=s||J&&ye(J.resolve())!=l||B&&ye(new B)!=c||S&&ye(new S)!=u)&&(ye=function(R){var re=G.call(R),ce=re==a?R.constructor:void 0,qe=ce?Fe(ce):void 0;if(qe)switch(qe){case q:return d;case X:return s;case ie:return l;case ne:return c;case se:return u}return re});function Z(R){return!!M&&M in R}function Be(R){var re=R&&R.constructor,ce=typeof re=="function"&&re.prototype||k;return R===ce}function Fe(R){if(R!=null){try{return F.call(R)}catch{}try{return R+""}catch{}}return""}function Ae(R){return tt(R)&&j.call(R,"callee")&&(!Y.call(R,"callee")||G.call(R)==r)}var We=Array.isArray;function et(R){return R!=null&&at(R.length)&&!bt(R)}function tt(R){return D(R)&&et(R)}var xe=le||K;function ot(R){if(et(R)&&(We(R)||typeof R=="string"||typeof R.splice=="function"||xe(R)||Ae(R)))return!R.length;var re=ye(R);if(re==s||re==c)return!R.size;if($||Be(R))return!pe(R).length;for(var ce in R)if(j.call(R,ce))return!1;return!0}function bt(R){var re=Ge(R)?G.call(R):"";return re==i||re==o}function at(R){return typeof R=="number"&&R>-1&&R%1==0&&R<=n}function Ge(R){var re=typeof R;return!!R&&(re=="object"||re=="function")}function D(R){return!!R&&typeof R=="object"}function K(){return!1}e.exports=ot})(Jr,Jr.exports)),Jr.exports}var zx=$x();const Kx=Nr(zx),vr="other",no="manage-tab";function Rr(e){return!e.fieldName}function Td(e,t){return e?.objects?.find(n=>n.objectName===t)||null}function Hx(e){return e?.requiredFields?.filter(n=>Rr(n)&&!!n.mapToName)||[]}function Jx(e){return e?.optionalFields?.filter(n=>Rr(n)&&!!n.mapToName)||[]}function kd(e){return e?.optionalFields?.filter(t=>!Rr(t)&&!!t.fieldName)||null}const Rd=(e,t)=>e?.content?.read?.objects?.[t],Ad=(e,t)=>{const n=[];return t.content?.read?.objects?.forEach(r=>{const i=e?Rd(e,r.objectName):void 0;n.push({name:r?.objectName,displayName:r?.mapToDisplayName||r?.displayName||r?.objectName&&Wt(r?.objectName),completed:!!i,disabled:i?.disabled})}),n},Fd=e=>({name:vr,completed:e?!!e?.content?.write:!1});function Wx(e,t){const n=Ad(e,t),i=!!t?.content?.write?Fd(e):void 0;return i&&n.push(i),n}function Pd(e,t,n){const r=e?.filter(o=>!t?.[o?.mapToName])||[],i=r.map(o=>o.mapToName);return n(Ie.MAPPING,i),r?.length&&console.error("required fields not met",r.map(o=>o.mapToDisplayName)),{errorList:i}}function Zl(e,t){return Kx(e)?!0:Object.values(e).every(t)}function ha(e,t,n){const r=Zl(e,n),i=Zl(t,n);return r&&i?!0:r!==i?!1:dd(e,t)}function Dd(e,t){return ha(e,t,n=>n===!1||n===void 0)}function Md(e,t){return ha(e,t,n=>!n||n==="")}function jd(e,t){return ha(e,t,n=>!n||typeof n!="object"?!0:Object.keys(n).length===0)}function Ld(e,t){const n=new Set(Object.values(e).map(i=>i?.objectName)),r=new Set(Object.values(t).map(i=>i?.objectName));return n.size===r.size&&[...n].every(i=>r.has(i))}const Qx=(e,t,n)=>{if(!e)return null;const r=Td(e,t),i=r&&kd(r),o=r&&Hx(r),s=r&&Jx(r),a=r?.allFields||[],l=r?.allFieldsMetadata||{},c=n?.content,u=c?.read?.objects?.[t]?.selectedValueMappings||{},d=c?.read?.objects?.[t]?.selectedFieldMappings||{},h=ma(n,{content:{read:e}},t);return{allFields:a,allFieldsMetadata:l,optionalFields:i,requiredMapFields:o,optionalMapFields:s,selectedOptionalFields:h,selectedFieldMappings:d,selectedValueMappings:u}},Gx=(e,t)=>{if(!e)return null;const n=t?.content?.write?.objects;return{writeObjects:e?.objects||[],selectedWriteObjects:n||{}}};function Bd(e,t,n){const r=e?.content?.read,i=e?.content?.write;return{read:Qx(r,t,n),write:Gx(i,n)}}const Vd=(e,t,n,r)=>{const i=Bd(e,n,t);r(n,i)},Xx=(e,t,n)=>{const r=Wx(t,e),i={};r.forEach(({name:o,completed:s})=>{s&&(i[o]=Bd(e,o,t))}),n(i)},Ud=e=>{const{selectedOptionalFields:t}=e?.read||{};return t||{}},qd=e=>{const{selectedFieldMappings:t}=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},$d=(e,t)=>!t||!t[e]?[]:t[e],zd=e=>{const{selectedValueMappings:t}=e?.read||{};return t},ma=(e,t,n)=>{if(!e||!t)return{};const r=t?.content?.read;if(!r)return{};const i=Td(r,n),o=i&&kd(i),s=new Set(o?.filter(c=>!Rr(c)&&!!c.fieldName).map(c=>c.fieldName)||[]),a=e?.content?.read?.objects?.[n]?.selectedFields||{};return Object.entries(a).reduce((c,[u,d])=>(s.has(u)&&(c[u]=d),c),{})},Kd=(e,t)=>!e||!t?{}:e?.content?.read?.objects?.[t]?.selectedFieldMappings||{};function Hd(e,t){return t[e]||void 0}const Yx=(e,t,n,r,i)=>{const o=Ud(e),s=qd(e),a=$d(t,i),l=zd(e);return{createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,selectedFields:o,selectedFieldMappings:s,dynamicMappingsInput:a,selectedValueMappings:l||{}}}}}}};function Jd(e){return e.content.proxy?.enabled}const Wd=e=>({...e.write?.selectedWriteObjects}),Zx=e=>e.content.write?.objects,eI=(e,t,n)=>{if(!Zx(t))return console.error("Error when getting write objects from hydratedRevision"),null;const i=Wd(e),o={createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:i}}};return Jd(t)&&(o.content.proxy={enabled:!0}),o};var Uo={exports:{}};var ec;function tI(){return ec||(ec=1,(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})()})(Uo)),Uo.exports}var nI=tI();const Jt=Nr(nI),rI="_button_kwfiu_1",iI="_danger_kwfiu_42",oI="_ghost_kwfiu_47",qo={button:rI,danger:iI,ghost:oI};function Je({className:e,style:t,type:n,children:r,variant:i,...o}){const s=Jt(qo.button,{[qo.danger]:i==="danger",[qo.ghost]:i==="ghost",[e||""]:!!e});return p.jsx("button",{type:n,className:s,style:t,...o,children:r})}const sI={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 ui({children:e,style:t}){return p.jsx(bn,{style:{...sI,...t},children:e})}const Qd=e=>{const t=mt(),{provider:n}=gt(),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})},yt=e=>{const t=Qd(e),{data:n}=t,{provider:r}=gt(),i=n&&Fx(n?.name,n);return{...t,providerName:i,selectedProvider:e||r}};function wn({error:e}){return e?p.jsx(ui,{style:{marginTop:"2em"},children:e}):null}const aI="_input_1ymb7_1",lI="_inputError_1ymb7_27",$o={input:aI,inputError:lI};function Gd({id:e,type:t,className:n,isError:r=!1,...i}){const o=r?Jt($o.inputError,$o.input):$o.input;return p.jsx("input",{id:e,type:t,className:Jt(o,n),...i})}function cI(){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 uI(){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 dI({id:e,name:t,placeholder:n="Password",onChange:r,value:i,className:o,isError:s}){const[a,l]=I.useState(!1),c=()=>l(u=>!u);return p.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[p.jsx(yn.Input,{id:e,name:t,type:a?"text":"password",placeholder:n,onChange:r,value:i,className:o,isError:s}),p.jsx(Je,{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(uI,{}):p.jsx(cI,{})})})]})}const fI="_textarea_18zl4_1",pI="_textareaError_18zl4_14",zo={textarea:fI,textareaError:pI};function hI({className:e,isError:t=!1,...n}){const r=t?Jt(zo.textareaError,zo.textarea):zo.textarea;return p.jsx("textarea",{className:Jt(e,r),...n})}const yn={Input:Gd,Textarea:hI,PasswordInput:dI},mI=()=>{const{projectIdOrName:e}=Ke(),t=mt();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 Xd(){const{data:e}=mI();return e?.entitlements?.brandingRemoval?.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 nr({children:e}){return p.jsx(Tr,{children:p.jsxs(bn,{children:[p.jsx("div",{style:{padding:"3rem 2rem"},children:e}),p.jsx(Xd,{})]})})}function rr({children:e}){return p.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function gI({children:e}){return p.jsx("p",{style:{padding:".5em 0"},children:e})}const yI="_link_oo2kv_1",vI={link:yI};function Yd({href:e,className:t,style:n,label:r,children:i,newTab:o=!1}){return p.jsx("a",{className:Jt(vI.link,t),style:n,href:e,"aria-label":r||void 0,target:o?"_blank":"_self",rel:o?"noopener noreferrer":void 0,children:i})}function bI(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const wI=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,xI=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,II={};function tc(e,t){return(II.jsx?xI:wI).test(e)}const SI=/[ \t\n\f\r]/g;function CI(e){return typeof e=="object"?e.type==="text"?nc(e.value):!1:nc(e)}function nc(e){return e.replace(SI,"")===""}class di{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}di.prototype.normal={};di.prototype.property={};di.prototype.space=void 0;function Zd(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new di(n,r,t)}function As(e){return e.toLowerCase()}class Rt{constructor(t,n){this.attribute=n,this.property=t}}Rt.prototype.attribute="";Rt.prototype.booleanish=!1;Rt.prototype.boolean=!1;Rt.prototype.commaOrSpaceSeparated=!1;Rt.prototype.commaSeparated=!1;Rt.prototype.defined=!1;Rt.prototype.mustUseProperty=!1;Rt.prototype.number=!1;Rt.prototype.overloadedBoolean=!1;Rt.prototype.property="";Rt.prototype.spaceSeparated=!1;Rt.prototype.space=void 0;let OI=0;const be=ir(),Xe=ir(),Fs=ir(),W=ir(),je=ir(),pr=ir(),Ft=ir();function ir(){return 2**++OI}const Ps=Object.freeze(Object.defineProperty({__proto__:null,boolean:be,booleanish:Xe,commaOrSpaceSeparated:Ft,commaSeparated:pr,number:W,overloadedBoolean:Fs,spaceSeparated:je},Symbol.toStringTag,{value:"Module"})),Ko=Object.keys(Ps);class ga extends Rt{constructor(t,n,r,i){let o=-1;if(super(t,n),rc(this,"space",i),typeof r=="number")for(;++o<Ko.length;){const s=Ko[o];rc(this,Ko[o],(r&Ps[s])===Ps[s])}}}ga.prototype.defined=!0;function rc(e,t,n){n&&(e[t]=n)}function Ar(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const o=new ga(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[As(r)]=r,n[As(o.attribute)]=r}return new di(t,n,e.space)}const ef=Ar({properties:{ariaActiveDescendant:null,ariaAtomic:Xe,ariaAutoComplete:null,ariaBusy:Xe,ariaChecked:Xe,ariaColCount:W,ariaColIndex:W,ariaColSpan:W,ariaControls:je,ariaCurrent:null,ariaDescribedBy:je,ariaDetails:null,ariaDisabled:Xe,ariaDropEffect:je,ariaErrorMessage:null,ariaExpanded:Xe,ariaFlowTo:je,ariaGrabbed:Xe,ariaHasPopup:null,ariaHidden:Xe,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:je,ariaLevel:W,ariaLive:null,ariaModal:Xe,ariaMultiLine:Xe,ariaMultiSelectable:Xe,ariaOrientation:null,ariaOwns:je,ariaPlaceholder:null,ariaPosInSet:W,ariaPressed:Xe,ariaReadOnly:Xe,ariaRelevant:null,ariaRequired:Xe,ariaRoleDescription:je,ariaRowCount:W,ariaRowIndex:W,ariaRowSpan:W,ariaSelected:Xe,ariaSetSize:W,ariaSort:null,ariaValueMax:W,ariaValueMin:W,ariaValueNow:W,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function tf(e,t){return t in e?e[t]:t}function nf(e,t){return tf(e,t.toLowerCase())}const EI=Ar({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:pr,acceptCharset:je,accessKey:je,action:null,allow:null,allowFullScreen:be,allowPaymentRequest:be,allowUserMedia:be,alt:null,as:null,async:be,autoCapitalize:null,autoComplete:je,autoFocus:be,autoPlay:be,blocking:je,capture:null,charSet:null,checked:be,cite:null,className:je,cols:W,colSpan:null,content:null,contentEditable:Xe,controls:be,controlsList:je,coords:W|pr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:be,defer:be,dir:null,dirName:null,disabled:be,download:Fs,draggable:Xe,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:be,formTarget:null,headers:je,height:W,hidden:Fs,high:W,href:null,hrefLang:null,htmlFor:je,httpEquiv:je,id:null,imageSizes:null,imageSrcSet:null,inert:be,inputMode:null,integrity:null,is:null,isMap:be,itemId:null,itemProp:je,itemRef:je,itemScope:be,itemType:je,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:be,low:W,manifest:null,max:null,maxLength:W,media:null,method:null,min:null,minLength:W,multiple:be,muted:be,name:null,nonce:null,noModule:be,noValidate:be,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:be,optimum:W,pattern:null,ping:je,placeholder:null,playsInline:be,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:be,referrerPolicy:null,rel:je,required:be,reversed:be,rows:W,rowSpan:W,sandbox:je,scope:null,scoped:be,seamless:be,selected:be,shadowRootClonable:be,shadowRootDelegatesFocus:be,shadowRootMode:null,shape:null,size:W,sizes:null,slot:null,span:W,spellCheck:Xe,src:null,srcDoc:null,srcLang:null,srcSet:null,start:W,step:null,style:null,tabIndex:W,target:null,title:null,translate:null,type:null,typeMustMatch:be,useMap:null,value:Xe,width:W,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:je,axis:null,background:null,bgColor:null,border:W,borderColor:null,bottomMargin:W,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:be,declare:be,event:null,face:null,frame:null,frameBorder:null,hSpace:W,leftMargin:W,link:null,longDesc:null,lowSrc:null,marginHeight:W,marginWidth:W,noResize:be,noHref:be,noShade:be,noWrap:be,object:null,profile:null,prompt:null,rev:null,rightMargin:W,rules:null,scheme:null,scrolling:Xe,standby:null,summary:null,text:null,topMargin:W,valueType:null,version:null,vAlign:null,vLink:null,vSpace:W,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:be,disableRemotePlayback:be,prefix:null,property:null,results:W,security:null,unselectable:null},space:"html",transform:nf}),_I=Ar({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:Ft,accentHeight:W,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:W,amplitude:W,arabicForm:null,ascent:W,attributeName:null,attributeType:null,azimuth:W,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:W,by:null,calcMode:null,capHeight:W,className:je,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:W,diffuseConstant:W,direction:null,display:null,dur:null,divisor:W,dominantBaseline:null,download:be,dx:null,dy:null,edgeMode:null,editable:null,elevation:W,enableBackground:null,end:null,event:null,exponent:W,externalResourcesRequired:null,fill:null,fillOpacity:W,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:pr,g2:pr,glyphName:pr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:W,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:W,horizOriginX:W,horizOriginY:W,id:null,ideographic:W,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:W,k:W,k1:W,k2:W,k3:W,k4:W,kernelMatrix:Ft,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:W,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:W,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:W,overlineThickness:W,paintOrder:null,panose1:null,path:null,pathLength:W,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:je,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:W,pointsAtY:W,pointsAtZ:W,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ft,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ft,rev:Ft,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ft,requiredFeatures:Ft,requiredFonts:Ft,requiredFormats:Ft,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:W,specularExponent:W,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:W,strikethroughThickness:W,string:null,stroke:null,strokeDashArray:Ft,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:W,strokeOpacity:W,strokeWidth:null,style:null,surfaceScale:W,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ft,tabIndex:W,tableValues:null,target:null,targetX:W,targetY:W,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ft,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:W,underlineThickness:W,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:W,values:null,vAlphabetic:W,vMathematical:W,vectorEffect:null,vHanging:W,vIdeographic:W,version:null,vertAdvY:W,vertOriginX:W,vertOriginY:W,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:W,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:tf}),rf=Ar({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()}}),of=Ar({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:nf}),sf=Ar({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),NI={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"},TI=/[A-Z]/g,ic=/-[a-z]/g,kI=/^data[-\w.:]+$/i;function RI(e,t){const n=As(t);let r=t,i=Rt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&kI.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(ic,FI);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!ic.test(o)){let s=o.replace(TI,AI);s.charAt(0)!=="-"&&(s="-"+s),t="data"+s}}i=ga}return new i(r,t)}function AI(e){return"-"+e.toLowerCase()}function FI(e){return e.charAt(1).toUpperCase()}const PI=Zd([ef,EI,rf,of,sf],"html"),ya=Zd([ef,_I,rf,of,sf],"svg");function DI(e){return e.join(" ").trim()}var cr={},Ho,oc;function MI(){if(oc)return Ho;oc=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,s=/^[;\s]*/,a=/^\s+|\s+$/g,l=`
|
|
7
|
+
`,c="/",u="*",d="",h="comment",f="declaration";function y(g,w){if(typeof g!="string")throw new TypeError("First argument must be a string");if(!g)return[];w=w||{};var m=1,b=1;function C(P){var V=P.match(t);V&&(m+=V.length);var Y=P.lastIndexOf(l);b=~Y?P.length-Y:b+P.length}function E(){var P={line:m,column:b};return function(V){return V.position=new _(P),L(),V}}function _(P){this.start=P,this.end={line:m,column:b},this.source=w.source}_.prototype.content=g;function A(P){var V=new Error(w.source+":"+m+":"+b+": "+P);if(V.reason=P,V.filename=w.source,V.line=m,V.column=b,V.source=g,!w.silent)throw V}function k(P){var V=P.exec(g);if(V){var Y=V[0];return C(Y),g=g.slice(Y.length),V}}function L(){k(n)}function M(P){var V;for(P=P||[];V=F();)V!==!1&&P.push(V);return P}function F(){var P=E();if(!(c!=g.charAt(0)||u!=g.charAt(1))){for(var V=2;d!=g.charAt(V)&&(u!=g.charAt(V)||c!=g.charAt(V+1));)++V;if(V+=2,d===g.charAt(V-1))return A("End of comment missing");var Y=g.slice(2,V-2);return b+=2,C(Y),g=g.slice(V),b+=2,P({type:h,comment:Y})}}function j(){var P=E(),V=k(r);if(V){if(F(),!k(i))return A("property missing ':'");var Y=k(o),le=P({type:f,property:v(V[0].replace(e,d)),value:Y?v(Y[0].replace(e,d)):d});return k(s),le}}function G(){var P=[];M(P);for(var V;V=j();)V!==!1&&(P.push(V),M(P));return P}return L(),G()}function v(g){return g?g.replace(a,d):d}return Ho=y,Ho}var sc;function jI(){if(sc)return cr;sc=1;var e=cr&&cr.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(cr,"__esModule",{value:!0}),cr.default=n;const t=e(MI());function n(r,i){let o=null;if(!r||typeof r!="string")return o;const s=(0,t.default)(r),a=typeof i=="function";return s.forEach(l=>{if(l.type!=="declaration")return;const{property:c,value:u}=l;a?i(c,u,l):u&&(o=o||{},o[c]=u)}),o}return cr}var Br={},ac;function LI(){if(ac)return Br;ac=1,Object.defineProperty(Br,"__esModule",{value:!0}),Br.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,o=function(c){return!c||n.test(c)||e.test(c)},s=function(c,u){return u.toUpperCase()},a=function(c,u){return"".concat(u,"-")},l=function(c,u){return u===void 0&&(u={}),o(c)?c:(c=c.toLowerCase(),u.reactCompat?c=c.replace(i,a):c=c.replace(r,a),c.replace(t,s))};return Br.camelCase=l,Br}var Vr,lc;function BI(){if(lc)return Vr;lc=1;var e=Vr&&Vr.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(jI()),n=LI();function r(i,o){var s={};return!i||typeof i!="string"||(0,t.default)(i,function(a,l){a&&l&&(s[(0,n.camelCase)(a,o)]=l)}),s}return r.default=r,Vr=r,Vr}var VI=BI();const UI=Nr(VI),af=lf("end"),va=lf("start");function lf(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 qI(e){const t=va(e),n=af(e);if(t&&n)return{start:t,end:n}}function Wr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?cc(e.position):"start"in e||"end"in e?cc(e):"line"in e||"column"in e?Ds(e):""}function Ds(e){return uc(e&&e.line)+":"+uc(e&&e.column)}function cc(e){return Ds(e&&e.start)+"-"+Ds(e&&e.end)}function uc(e){return e&&typeof e=="number"?e:1}class vt 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=Wr(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}}vt.prototype.file="";vt.prototype.name="";vt.prototype.reason="";vt.prototype.message="";vt.prototype.stack="";vt.prototype.column=void 0;vt.prototype.line=void 0;vt.prototype.ancestors=void 0;vt.prototype.cause=void 0;vt.prototype.fatal=void 0;vt.prototype.place=void 0;vt.prototype.ruleId=void 0;vt.prototype.source=void 0;const ba={}.hasOwnProperty,$I=new Map,zI=/[A-Z]/g,KI=new Set(["table","tbody","thead","tfoot","tr"]),HI=new Set(["td","th"]),cf="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function JI(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=tS(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=eS(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"?ya:PI,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=uf(i,e,void 0);return o&&typeof o!="string"?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function uf(e,t,n){if(t.type==="element")return WI(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return QI(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return XI(e,t,n);if(t.type==="mdxjsEsm")return GI(e,t);if(t.type==="root")return YI(e,t,n);if(t.type==="text")return ZI(e,t)}function WI(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=ya,e.schema=i),e.ancestors.push(t);const o=ff(e,t.tagName,!1),s=nS(e,t);let a=xa(e,t);return KI.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!CI(l):!0})),df(e,s,o,t),wa(s,a),e.ancestors.pop(),e.schema=r,e.create(t,o,s,n)}function QI(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)}oi(e,t.position)}function GI(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);oi(e,t.position)}function XI(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=ya,e.schema=i),e.ancestors.push(t);const o=t.name===null?e.Fragment:ff(e,t.name,!0),s=rS(e,t),a=xa(e,t);return df(e,s,o,t),wa(s,a),e.ancestors.pop(),e.schema=r,e.create(t,o,s,n)}function YI(e,t,n){const r={};return wa(r,xa(e,t)),e.create(t,e.Fragment,r,n)}function ZI(e,t){return t.value}function df(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function wa(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function eS(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 tS(e,t){return n;function n(r,i,o,s){const a=Array.isArray(o.children),l=va(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 nS(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&ba.call(t.properties,i)){const o=iS(e,i,t.properties[i]);if(o){const[s,a]=o;e.tableCellAlignToStyle&&s==="align"&&typeof a=="string"&&HI.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 rS(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 oi(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 oi(e,t.position);else o=r.value===null?!0:r.value;n[i]=o}return n}function xa(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:$I;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=uf(e,o,s);a!==void 0&&n.push(a)}return n}function iS(e,t,n){const r=RI(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?bI(n):DI(n)),r.property==="style"){let i=typeof n=="object"?n:oS(e,String(n));return e.stylePropertyNameCase==="css"&&(i=sS(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?NI[r.property]||r.property:r.attribute,n]}}function oS(e,t){try{return UI(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new vt("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=cf+"#cannot-parse-style-attribute",i}}function ff(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=tc(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=tc(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return ba.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);oi(e)}function oi(e,t){const n=new vt("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=cf+"#cannot-handle-mdx-estrees-without-createevaluater",n}function sS(e){const t={};let n;for(n in e)ba.call(e,n)&&(t[aS(n)]=e[n]);return t}function aS(e){let t=e.replace(zI,lS);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function lS(e){return"-"+e.toLowerCase()}const Jo={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"]},cS={};function uS(e,t){const n=cS,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return pf(e,r,i)}function pf(e,t,n){if(dS(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 dc(e.children,t,n)}return Array.isArray(e)?dc(e,t,n):""}function dc(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=pf(e[i],t,n);return r.join("")}function dS(e){return!!(e&&typeof e=="object")}const fc=document.createElement("i");function Ia(e){const t="&"+e+";";fc.innerHTML=t;const n=fc.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function ln(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 Ht(e,t){return e.length>0?(ln(e,e.length,0,t),e):t}const pc={}.hasOwnProperty;function fS(e){const t={};let n=-1;for(;++n<e.length;)pS(t,e[n]);return t}function pS(e,t){let n;for(n in t){const i=(pc.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let s;if(o)for(s in o){pc.call(i,s)||(i[s]=[]);const a=o[s];hS(i[s],Array.isArray(a)?a:a?[a]:[])}}}function hS(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);ln(e,0,0,r)}function hf(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 hr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const sn=Ln(/[A-Za-z]/),Dt=Ln(/[\dA-Za-z]/),mS=Ln(/[#-'*+\--9=?A-Z^-~]/);function Ms(e){return e!==null&&(e<32||e===127)}const js=Ln(/\d/),gS=Ln(/[\dA-Fa-f]/),yS=Ln(/[!-/:-@[-`{-~]/);function he(e){return e!==null&&e<-2}function kt(e){return e!==null&&(e<0||e===32)}function _e(e){return e===-2||e===-1||e===32}const vS=Ln(new RegExp("\\p{P}|\\p{S}","u")),bS=Ln(/\s/);function Ln(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Fr(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const o=e.charCodeAt(n);let s="";if(o===37&&Dt(e.charCodeAt(n+1))&&Dt(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 Le(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return s;function s(l){return _e(l)?(e.enter(n),a(l)):t(l)}function a(l){return _e(l)&&o++<i?(e.consume(l),a):(e.exit(n),t(l))}}const wS={tokenize:xS};function xS(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"),Le(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 he(a)?(e.consume(a),e.exit("chunkText"),o):(e.consume(a),s)}}const IS={tokenize:SS},hc={tokenize:CS};function SS(e){const t=this,n=[];let r=0,i,o,s;return a;function a(b){if(r<n.length){const C=n[r];return t.containerState=C[1],e.attempt(C[0].continuation,l,c)(b)}return c(b)}function l(b){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&m();const C=t.events.length;let E=C,_;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){_=t.events[E][1].end;break}w(r);let A=C;for(;A<t.events.length;)t.events[A][1].end={..._},A++;return ln(t.events,E+1,0,t.events.slice(C)),t.events.length=A,c(b)}return a(b)}function c(b){if(r===n.length){if(!i)return h(b);if(i.currentConstruct&&i.currentConstruct.concrete)return y(b);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(hc,u,d)(b)}function u(b){return i&&m(),w(r),h(b)}function d(b){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,y(b)}function h(b){return t.containerState={},e.attempt(hc,f,y)(b)}function f(b){return r++,n.push([t.currentConstruct,t.containerState]),h(b)}function y(b){if(b===null){i&&m(),w(0),e.consume(b);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:o}),v(b)}function v(b){if(b===null){g(e.exit("chunkFlow"),!0),w(0),e.consume(b);return}return he(b)?(e.consume(b),g(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(b),v)}function g(b,C){const E=t.sliceStream(b);if(C&&E.push(null),b.previous=o,o&&(o.next=b),o=b,i.defineSkip(b.start),i.write(E),t.parser.lazy[b.start.line]){let _=i.events.length;for(;_--;)if(i.events[_][1].start.offset<s&&(!i.events[_][1].end||i.events[_][1].end.offset>s))return;const A=t.events.length;let k=A,L,M;for(;k--;)if(t.events[k][0]==="exit"&&t.events[k][1].type==="chunkFlow"){if(L){M=t.events[k][1].end;break}L=!0}for(w(r),_=A;_<t.events.length;)t.events[_][1].end={...M},_++;ln(t.events,k+1,0,t.events.slice(A)),t.events.length=_}}function w(b){let C=n.length;for(;C-- >b;){const E=n[C];t.containerState=E[1],E[0].exit.call(t,e)}n.length=b}function m(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function CS(e,t,n){return Le(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function mc(e){if(e===null||kt(e)||bS(e))return 1;if(vS(e))return 2}function Sa(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 Ls={name:"attention",resolveAll:OS,tokenize:ES};function OS(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};gc(d,-l),gc(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=Ht(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=Ht(c,[["enter",i,t],["enter",s,t],["exit",s,t],["enter",o,t]]),c=Ht(c,Sa(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=Ht(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=Ht(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,ln(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 ES(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=mc(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=mc(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 gc(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const _S={name:"autolink",tokenize:NS};function NS(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 sn(f)?(e.consume(f),s):f===64?n(f):c(f)}function s(f){return f===43||f===45||f===46||Dt(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||Dt(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||Ms(f)?n(f):(e.consume(f),l)}function c(f){return f===64?(e.consume(f),u):mS(f)?(e.consume(f),c):n(f)}function u(f){return Dt(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||Dt(f))&&r++<63){const y=f===45?h:d;return e.consume(f),y}return n(f)}}const wo={partial:!0,tokenize:TS};function TS(e,t,n){return r;function r(o){return _e(o)?Le(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||he(o)?t(o):n(o)}}const mf={continuation:{tokenize:RS},exit:AS,name:"blockQuote",tokenize:kS};function kS(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 _e(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function RS(e,t,n){const r=this;return i;function i(s){return _e(s)?Le(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):o(s)}function o(s){return e.attempt(mf,t,n)(s)}}function AS(e){e.exit("blockQuote")}const gf={name:"characterEscape",tokenize:FS};function FS(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 yS(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const yf={name:"characterReference",tokenize:PS};function PS(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=Dt,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=gS,u):(e.enter("characterReferenceValue"),o=7,s=js,u(d))}function u(d){if(d===59&&i){const h=e.exit("characterReferenceValue");return s===Dt&&!Ia(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 yc={partial:!0,tokenize:MS},vc={concrete:!0,name:"codeFenced",tokenize:DS};function DS(e,t,n){const r=this,i={partial:!0,tokenize:E};let o=0,s=0,a;return l;function l(_){return c(_)}function c(_){const A=r.events[r.events.length-1];return o=A&&A[1].type==="linePrefix"?A[2].sliceSerialize(A[1],!0).length:0,a=_,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(_)}function u(_){return _===a?(s++,e.consume(_),u):s<3?n(_):(e.exit("codeFencedFenceSequence"),_e(_)?Le(e,d,"whitespace")(_):d(_))}function d(_){return _===null||he(_)?(e.exit("codeFencedFence"),r.interrupt?t(_):e.check(yc,v,C)(_)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(_))}function h(_){return _===null||he(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(_)):_e(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Le(e,f,"whitespace")(_)):_===96&&_===a?n(_):(e.consume(_),h)}function f(_){return _===null||he(_)?d(_):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),y(_))}function y(_){return _===null||he(_)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(_)):_===96&&_===a?n(_):(e.consume(_),y)}function v(_){return e.attempt(i,C,g)(_)}function g(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),w}function w(_){return o>0&&_e(_)?Le(e,m,"linePrefix",o+1)(_):m(_)}function m(_){return _===null||he(_)?e.check(yc,v,C)(_):(e.enter("codeFlowValue"),b(_))}function b(_){return _===null||he(_)?(e.exit("codeFlowValue"),m(_)):(e.consume(_),b)}function C(_){return e.exit("codeFenced"),t(_)}function E(_,A,k){let L=0;return M;function M(V){return _.enter("lineEnding"),_.consume(V),_.exit("lineEnding"),F}function F(V){return _.enter("codeFencedFence"),_e(V)?Le(_,j,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):j(V)}function j(V){return V===a?(_.enter("codeFencedFenceSequence"),G(V)):k(V)}function G(V){return V===a?(L++,_.consume(V),G):L>=s?(_.exit("codeFencedFenceSequence"),_e(V)?Le(_,P,"whitespace")(V):P(V)):k(V)}function P(V){return V===null||he(V)?(_.exit("codeFencedFence"),A(V)):k(V)}}}function MS(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 Wo={name:"codeIndented",tokenize:LS},jS={partial:!0,tokenize:BS};function LS(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),Le(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):he(c)?e.attempt(jS,s,l)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||he(c)?(e.exit("codeFlowValue"),s(c)):(e.consume(c),a)}function l(c){return e.exit("codeIndented"),t(c)}}function BS(e,t,n){const r=this;return i;function i(s){return r.parser.lazy[r.now().line]?n(s):he(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):Le(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):he(s)?i(s):n(s)}}const VS={name:"codeText",previous:qS,resolve:US,tokenize:$S};function US(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 qS(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function $S(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)):he(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||he(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 zS{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&&Ur(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),Ur(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ur(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);Ur(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ur(this.left,n.reverse())}}}function Ur(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 vf(e){const t={};let n=-1,r,i,o,s,a,l,c;const u=new zS(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,KS(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 ln(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function KS(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,v=0;const g=[v];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&&(v=h+1,g.push(v),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(s.events=[],f?(f._tokenizer=void 0,f.previous=void 0):g.pop(),h=g.length;h--;){const w=a.slice(g[h],g[h+1]),m=o.pop();l.push([m,m+w.length-1]),e.splice(m,2,w)}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 HS={resolve:WS,tokenize:QS},JS={partial:!0,tokenize:GS};function WS(e){return vf(e),e}function QS(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):he(a)?e.check(JS,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 GS(e,t,n){const r=this;return i;function i(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Le(e,o,"linePrefix")}function o(s){if(s===null||he(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 bf(e,t,n,r,i,o,s,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return d;function d(w){return w===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(w),e.exit(o),h):w===null||w===32||w===41||Ms(w)?n(w):(e.enter(r),e.enter(s),e.enter(a),e.enter("chunkString",{contentType:"string"}),v(w))}function h(w){return w===62?(e.enter(o),e.consume(w),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),f(w))}function f(w){return w===62?(e.exit("chunkString"),e.exit(a),h(w)):w===null||w===60||he(w)?n(w):(e.consume(w),w===92?y:f)}function y(w){return w===60||w===62||w===92?(e.consume(w),f):f(w)}function v(w){return!u&&(w===null||w===41||kt(w))?(e.exit("chunkString"),e.exit(a),e.exit(s),e.exit(r),t(w)):u<c&&w===40?(e.consume(w),u++,v):w===41?(e.consume(w),u--,v):w===null||w===32||w===40||Ms(w)?n(w):(e.consume(w),w===92?g:v)}function g(w){return w===40||w===41||w===92?(e.consume(w),v):v(w)}}function wf(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):he(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||he(f)||a++>999?(e.exit("chunkString"),u(f)):(e.consume(f),l||(l=!_e(f)),f===92?h:d)}function h(f){return f===91||f===92||f===93?(e.consume(f),a++,d):d(f)}}function xf(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):he(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),Le(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(h))}function u(h){return h===s||h===null||he(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 Qr(e,t){let n;return r;function r(i){return he(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):_e(i)?Le(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const XS={name:"definition",tokenize:ZS},YS={partial:!0,tokenize:eC};function ZS(e,t,n){const r=this;let i;return o;function o(f){return e.enter("definition"),s(f)}function s(f){return wf.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function a(f){return i=hr(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 kt(f)?Qr(e,c)(f):c(f)}function c(f){return bf(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function u(f){return e.attempt(YS,d,d)(f)}function d(f){return _e(f)?Le(e,h,"whitespace")(f):h(f)}function h(f){return f===null||he(f)?(e.exit("definition"),r.parser.defined.push(i),t(f)):n(f)}}function eC(e,t,n){return r;function r(a){return kt(a)?Qr(e,i)(a):n(a)}function i(a){return xf(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function o(a){return _e(a)?Le(e,s,"whitespace")(a):s(a)}function s(a){return a===null||he(a)?t(a):n(a)}}const tC={name:"hardBreakEscape",tokenize:nC};function nC(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return he(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const rC={name:"headingAtx",resolve:iC,tokenize:oC};function iC(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"},ln(e,r,n-r+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])),e}function oC(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||kt(u)?(e.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||he(u)?(e.exit("atxHeading"),t(u)):_e(u)?Le(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||kt(u)?(e.exit("atxHeadingText"),a(u)):(e.consume(u),c)}}const sC=["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"],bc=["pre","script","style","textarea"],aC={concrete:!0,name:"htmlFlow",resolveTo:uC,tokenize:dC},lC={partial:!0,tokenize:pC},cC={partial:!0,tokenize:fC};function uC(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 dC(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,v):S===63?(e.consume(S),i=3,r.interrupt?t:x):sn(S)?(e.consume(S),s=String.fromCharCode(S),g):n(S)}function h(S){return S===45?(e.consume(S),i=2,f):S===91?(e.consume(S),i=5,a=0,y):sn(S)?(e.consume(S),i=4,r.interrupt?t:x):n(S)}function f(S){return S===45?(e.consume(S),r.interrupt?t:x):n(S)}function y(S){const $="CDATA[";return S===$.charCodeAt(a++)?(e.consume(S),a===$.length?r.interrupt?t:j:y):n(S)}function v(S){return sn(S)?(e.consume(S),s=String.fromCharCode(S),g):n(S)}function g(S){if(S===null||S===47||S===62||kt(S)){const $=S===47,q=s.toLowerCase();return!$&&!o&&bc.includes(q)?(i=1,r.interrupt?t(S):j(S)):sC.includes(s.toLowerCase())?(i=6,$?(e.consume(S),w):r.interrupt?t(S):j(S)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(S):o?m(S):b(S))}return S===45||Dt(S)?(e.consume(S),s+=String.fromCharCode(S),g):n(S)}function w(S){return S===62?(e.consume(S),r.interrupt?t:j):n(S)}function m(S){return _e(S)?(e.consume(S),m):M(S)}function b(S){return S===47?(e.consume(S),M):S===58||S===95||sn(S)?(e.consume(S),C):_e(S)?(e.consume(S),b):M(S)}function C(S){return S===45||S===46||S===58||S===95||Dt(S)?(e.consume(S),C):E(S)}function E(S){return S===61?(e.consume(S),_):_e(S)?(e.consume(S),E):b(S)}function _(S){return S===null||S===60||S===61||S===62||S===96?n(S):S===34||S===39?(e.consume(S),l=S,A):_e(S)?(e.consume(S),_):k(S)}function A(S){return S===l?(e.consume(S),l=null,L):S===null||he(S)?n(S):(e.consume(S),A)}function k(S){return S===null||S===34||S===39||S===47||S===60||S===61||S===62||S===96||kt(S)?E(S):(e.consume(S),k)}function L(S){return S===47||S===62||_e(S)?b(S):n(S)}function M(S){return S===62?(e.consume(S),F):n(S)}function F(S){return S===null||he(S)?j(S):_e(S)?(e.consume(S),F):n(S)}function j(S){return S===45&&i===2?(e.consume(S),Y):S===60&&i===1?(e.consume(S),le):S===62&&i===4?(e.consume(S),J):S===63&&i===3?(e.consume(S),x):S===93&&i===5?(e.consume(S),ge):he(S)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(lC,B,G)(S)):S===null||he(S)?(e.exit("htmlFlowData"),G(S)):(e.consume(S),j)}function G(S){return e.check(cC,P,B)(S)}function P(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),V}function V(S){return S===null||he(S)?G(S):(e.enter("htmlFlowData"),j(S))}function Y(S){return S===45?(e.consume(S),x):j(S)}function le(S){return S===47?(e.consume(S),s="",pe):j(S)}function pe(S){if(S===62){const $=s.toLowerCase();return bc.includes($)?(e.consume(S),J):j(S)}return sn(S)&&s.length<8?(e.consume(S),s+=String.fromCharCode(S),pe):j(S)}function ge(S){return S===93?(e.consume(S),x):j(S)}function x(S){return S===62?(e.consume(S),J):S===45&&i===2?(e.consume(S),x):j(S)}function J(S){return S===null||he(S)?(e.exit("htmlFlowData"),B(S)):(e.consume(S),J)}function B(S){return e.exit("htmlFlow"),t(S)}}function fC(e,t,n){const r=this;return i;function i(s){return he(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 pC(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(wo,t,n)}}const hC={name:"htmlText",tokenize:mC};function mC(e,t,n){const r=this;let i,o,s;return a;function a(x){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(x),l}function l(x){return x===33?(e.consume(x),c):x===47?(e.consume(x),E):x===63?(e.consume(x),b):sn(x)?(e.consume(x),k):n(x)}function c(x){return x===45?(e.consume(x),u):x===91?(e.consume(x),o=0,y):sn(x)?(e.consume(x),m):n(x)}function u(x){return x===45?(e.consume(x),f):n(x)}function d(x){return x===null?n(x):x===45?(e.consume(x),h):he(x)?(s=d,le(x)):(e.consume(x),d)}function h(x){return x===45?(e.consume(x),f):d(x)}function f(x){return x===62?Y(x):x===45?h(x):d(x)}function y(x){const J="CDATA[";return x===J.charCodeAt(o++)?(e.consume(x),o===J.length?v:y):n(x)}function v(x){return x===null?n(x):x===93?(e.consume(x),g):he(x)?(s=v,le(x)):(e.consume(x),v)}function g(x){return x===93?(e.consume(x),w):v(x)}function w(x){return x===62?Y(x):x===93?(e.consume(x),w):v(x)}function m(x){return x===null||x===62?Y(x):he(x)?(s=m,le(x)):(e.consume(x),m)}function b(x){return x===null?n(x):x===63?(e.consume(x),C):he(x)?(s=b,le(x)):(e.consume(x),b)}function C(x){return x===62?Y(x):b(x)}function E(x){return sn(x)?(e.consume(x),_):n(x)}function _(x){return x===45||Dt(x)?(e.consume(x),_):A(x)}function A(x){return he(x)?(s=A,le(x)):_e(x)?(e.consume(x),A):Y(x)}function k(x){return x===45||Dt(x)?(e.consume(x),k):x===47||x===62||kt(x)?L(x):n(x)}function L(x){return x===47?(e.consume(x),Y):x===58||x===95||sn(x)?(e.consume(x),M):he(x)?(s=L,le(x)):_e(x)?(e.consume(x),L):Y(x)}function M(x){return x===45||x===46||x===58||x===95||Dt(x)?(e.consume(x),M):F(x)}function F(x){return x===61?(e.consume(x),j):he(x)?(s=F,le(x)):_e(x)?(e.consume(x),F):L(x)}function j(x){return x===null||x===60||x===61||x===62||x===96?n(x):x===34||x===39?(e.consume(x),i=x,G):he(x)?(s=j,le(x)):_e(x)?(e.consume(x),j):(e.consume(x),P)}function G(x){return x===i?(e.consume(x),i=void 0,V):x===null?n(x):he(x)?(s=G,le(x)):(e.consume(x),G)}function P(x){return x===null||x===34||x===39||x===60||x===61||x===96?n(x):x===47||x===62||kt(x)?L(x):(e.consume(x),P)}function V(x){return x===47||x===62||kt(x)?L(x):n(x)}function Y(x){return x===62?(e.consume(x),e.exit("htmlTextData"),e.exit("htmlText"),t):n(x)}function le(x){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),pe}function pe(x){return _e(x)?Le(e,ge,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(x):ge(x)}function ge(x){return e.enter("htmlTextData"),s(x)}}const Ca={name:"labelEnd",resolveAll:bC,resolveTo:wC,tokenize:xC},gC={tokenize:IC},yC={tokenize:SC},vC={tokenize:CC};function bC(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&&ln(e,0,e.length,n),e}function wC(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=Ht(a,e.slice(o+1,o+r+3)),a=Ht(a,[["enter",u,t]]),a=Ht(a,Sa(t.parser.constructs.insideSpan.null,e.slice(o+r+4,s-3),t)),a=Ht(a,[["exit",u,t],e[s-2],e[s-1],["exit",c,t]]),a=Ht(a,e.slice(s+1)),a=Ht(a,[["exit",l,t]]),ln(e,o,e.length,a),e}function xC(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(hr(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(gC,u,s?u:d)(h):h===91?e.attempt(yC,u,s?c:d)(h):s?u(h):d(h)}function c(h){return e.attempt(vC,u,d)(h)}function u(h){return t(h)}function d(h){return o._balanced=!0,n(h)}}function IC(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 kt(d)?Qr(e,o)(d):o(d)}function o(d){return d===41?u(d):bf(e,s,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function s(d){return kt(d)?Qr(e,l)(d):u(d)}function a(d){return n(d)}function l(d){return d===34||d===39||d===40?xf(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return kt(d)?Qr(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 SC(e,t,n){const r=this;return i;function i(a){return wf.call(r,e,o,s,"reference","referenceMarker","referenceString")(a)}function o(a){return r.parser.defined.includes(hr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function s(a){return n(a)}}function CC(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 OC={name:"labelStartImage",resolveAll:Ca.resolveAll,tokenize:EC};function EC(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 _C={name:"labelStartLink",resolveAll:Ca.resolveAll,tokenize:NC};function NC(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 Qo={name:"lineEnding",tokenize:TC};function TC(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Le(e,t,"linePrefix")}}const Hi={name:"thematicBreak",tokenize:kC};function kC(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||he(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===i?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),_e(c)?Le(e,a,"whitespace")(c):a(c))}}const _t={continuation:{tokenize:PC},exit:MC,name:"list",tokenize:FC},RC={partial:!0,tokenize:jC},AC={partial:!0,tokenize:DC};function FC(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:js(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(Hi,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 js(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(wo,r.interrupt?n:u,e.attempt(RC,h,d))}function u(f){return r.containerState.initialBlankLine=!0,o++,h(f)}function d(f){return _e(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 PC(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(wo,i,o);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Le(e,t,"listItemIndent",r.containerState.size+1)(a)}function o(a){return r.containerState.furtherBlankLines||!_e(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(AC,t,s)(a))}function s(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Le(e,e.attempt(_t,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function DC(e,t,n){const r=this;return Le(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 MC(e){e.exit(this.containerState.type)}function jC(e,t,n){const r=this;return Le(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!_e(o)&&s&&s[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const wc={name:"setextUnderline",resolveTo:LC,tokenize:BC};function LC(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 BC(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"),_e(c)?Le(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||he(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const VC={tokenize:UC};function UC(e){const t=this,n=e.attempt(wo,r,e.attempt(this.parser.constructs.flowInitial,i,Le(e,e.attempt(this.parser.constructs.flow,i,e.attempt(HS,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 qC={resolveAll:Sf()},$C=If("string"),zC=If("text");function If(e){return{resolveAll:Sf(e==="text"?KC: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 Sf(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 KC(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 HC={42:_t,43:_t,45:_t,48:_t,49:_t,50:_t,51:_t,52:_t,53:_t,54:_t,55:_t,56:_t,57:_t,62:mf},JC={91:XS},WC={[-2]:Wo,[-1]:Wo,32:Wo},QC={35:rC,42:Hi,45:[wc,Hi],60:aC,61:wc,95:Hi,96:vc,126:vc},GC={38:yf,92:gf},XC={[-5]:Qo,[-4]:Qo,[-3]:Qo,33:OC,38:yf,42:Ls,60:[_S,hC],91:_C,92:[tC,gf],93:Ca,95:Ls,96:VS},YC={null:[Ls,qC]},ZC={null:[42,95]},e0={null:[]},t0=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ZC,contentInitial:JC,disable:e0,document:HC,flow:QC,flowInitial:WC,insideSpan:YC,string:GC,text:XC},Symbol.toStringTag,{value:"Module"}));function n0(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:A(E),check:A(_),consume:m,enter:b,exit:C,interrupt:A(_,{interrupt:!0})},c={code:null,containerState:{},defineSkip:v,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(F){return s=Ht(s,F),g(),s[s.length-1]!==null?[]:(k(t,0),c.events=Sa(o,c.events,c),c.events)}function h(F,j){return i0(f(F),j)}function f(F){return r0(s,F)}function y(){const{_bufferIndex:F,_index:j,line:G,column:P,offset:V}=r;return{_bufferIndex:F,_index:j,line:G,column:P,offset:V}}function v(F){i[F.line]=F.column,M()}function g(){let F;for(;r._index<s.length;){const j=s[r._index];if(typeof j=="string")for(F=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===F&&r._bufferIndex<j.length;)w(j.charCodeAt(r._bufferIndex));else w(j)}}function w(F){u=u(F)}function m(F){he(F)?(r.line++,r.column=1,r.offset+=F===-3?2:1,M()):F!==-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=F}function b(F,j){const G=j||{};return G.type=F,G.start=y(),c.events.push(["enter",G,c]),a.push(G),G}function C(F){const j=a.pop();return j.end=y(),c.events.push(["exit",j,c]),j}function E(F,j){k(F,j.from)}function _(F,j){j.restore()}function A(F,j){return G;function G(P,V,Y){let le,pe,ge,x;return Array.isArray(P)?B(P):"tokenize"in P?B([P]):J(P);function J(X){return ie;function ie(ne){const se=ne!==null&&X[ne],ee=ne!==null&&X.null,me=[...Array.isArray(se)?se:se?[se]:[],...Array.isArray(ee)?ee:ee?[ee]:[]];return B(me)(ne)}}function B(X){return le=X,pe=0,X.length===0?Y:S(X[pe])}function S(X){return ie;function ie(ne){return x=L(),ge=X,X.partial||(c.currentConstruct=X),X.name&&c.parser.constructs.disable.null.includes(X.name)?q():X.tokenize.call(j?Object.assign(Object.create(c),j):c,l,$,q)(ne)}}function $(X){return F(ge,x),V}function q(X){return x.restore(),++pe<le.length?S(le[pe]):Y}}}function k(F,j){F.resolveAll&&!o.includes(F)&&o.push(F),F.resolve&&ln(c.events,j,c.events.length-j,F.resolve(c.events.slice(j),c)),F.resolveTo&&(c.events=F.resolveTo(c.events,c))}function L(){const F=y(),j=c.previous,G=c.currentConstruct,P=c.events.length,V=Array.from(a);return{from:P,restore:Y};function Y(){r=F,c.previous=j,c.currentConstruct=G,c.events.length=P,a=V,M()}}function M(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function r0(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 i0(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=`
|
|
8
8
|
`;break}case-3:{s=`\r
|
|
9
|
-
`;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 PC(e){const r={constructs:UI([kC,...(e||{}).extensions||[]]),content:i(QI),defined:[],document:i(XI),flow:i(mC),lazy:{},string:i(vC),text:i(bC)};return r;function i(o){return s;function s(a){return RC(r,o,a)}}}function DC(e){for(;!gf(e););return e}const wc=/[\0\t\n\r]/g;function MC(){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(wc.lastIndex=d,c=wc.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 jC=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function LC(e){return e.replace(jC,BC)}function BC(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),o=i===120||i===88;return ff(n.slice(o?2:1),o?16:10)}return xa(n)||e}const If={}.hasOwnProperty;function VC(e,t,n){return typeof t!="string"&&(n=t,t=void 0),UC(n)(DC(PC(n).document().write(MC()(e,t,!0))))}function UC(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(et),autolinkProtocol:L,autolinkEmail:L,atxHeading:o(Be),blockQuote:o(ee),characterEscape:L,characterReference:L,codeFenced:o(me),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:o(me,s),codeText:o(U,s),codeTextData:L,data:L,codeFlowValue:L,definition:o(ye),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:o(Z),hardBreakEscape:o(Fe),hardBreakTrailing:o(Fe),htmlFlow:o(Ae,s),htmlFlowData:L,htmlText:o(Ae,s),htmlTextData:L,image:o(We),label:s,link:o(et),listItem:o(xe),listItemValue:h,listOrdered:o(tt,d),listUnordered:o(tt),paragraph:o(ot),reference:S,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:o(Be),strong:o(bt),thematicBreak:o(Ge)},exit:{atxHeading:l(),atxHeadingSequence:E,autolink:l(),autolinkEmail:se,autolinkProtocol:ne,blockQuote:l(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:q,characterReferenceMarkerNumeric:q,characterReferenceValue:X,characterReference:ie,codeFenced:l(g),codeFencedFence:v,codeFencedFenceInfo:f,codeFencedFenceMeta:y,codeFlowValue:M,codeIndented:l(b),codeText:l(V),codeTextData:M,data:M,definition:l(),definitionDestinationString:C,definitionLabelString:m,definitionTitleString:w,emphasis:l(),hardBreakEscape:l(j),hardBreakTrailing:l(j),htmlFlow:l(G),htmlFlowData:M,htmlText:l(P),htmlTextData:M,image:l(ae),label:ge,labelText:pe,lineEnding:F,link:l(Y),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:$,resourceDestinationString:x,resourceTitleString:J,resource:B,setextHeading:l(k),setextHeadingLineSequence:A,setextHeadingText:_,strong:l(),thematicBreak:l()}};Sf(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(D){let K={type:"root",children:[]};const R={stack:[K],tokenStack:[],config:t,enter:a,exit:c,buffer:s,resume:u,data:n},re=[];let le=-1;for(;++le<D.length;)if(D[le][1].type==="listOrdered"||D[le][1].type==="listUnordered")if(D[le][0]==="enter")re.push(le);else{const Ue=re.pop();le=i(D,Ue,le)}for(le=-1;++le<D.length;){const Ue=t[D[le][0]];If.call(Ue,D[le][1].type)&&Ue[D[le][1].type].call(Object.assign({sliceSerialize:D[le][2].sliceSerialize},R),D[le][1])}if(R.tokenStack.length>0){const Ue=R.tokenStack[R.tokenStack.length-1];(Ue[1]||xc).call(R,void 0,Ue[0])}for(K.position={start:Nn(D.length>0?D[0][1].start:{line:1,column:1,offset:0}),end:Nn(D.length>0?D[D.length-2][1].end:{line:1,column:1,offset:0})},le=-1;++le<t.transforms.length;)K=t.transforms[le](K)||K;return K}function i(D,K,R){let re=K-1,le=-1,Ue=!1,wt,lt,ft,Pe;for(;++re<=R;){const Oe=D[re];switch(Oe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Oe[0]==="enter"?le++:le--,Pe=void 0;break}case"lineEndingBlank":{Oe[0]==="enter"&&(wt&&!Pe&&!le&&!ft&&(ft=re),Pe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Pe=void 0}if(!le&&Oe[0]==="enter"&&Oe[1].type==="listItemPrefix"||le===-1&&Oe[0]==="exit"&&(Oe[1].type==="listUnordered"||Oe[1].type==="listOrdered")){if(wt){let xt=re;for(lt=void 0;xt--;){const ct=D[xt];if(ct[1].type==="lineEnding"||ct[1].type==="lineEndingBlank"){if(ct[0]==="exit")continue;lt&&(D[lt][1].type="lineEndingBlank",Ue=!0),ct[1].type="lineEnding",lt=xt}else if(!(ct[1].type==="linePrefix"||ct[1].type==="blockQuotePrefix"||ct[1].type==="blockQuotePrefixWhitespace"||ct[1].type==="blockQuoteMarker"||ct[1].type==="listItemIndent"))break}ft&&(!lt||ft<lt)&&(wt._spread=!0),wt.end=Object.assign({},lt?D[lt][1].start:Oe[1].end),D.splice(lt||re,0,["exit",wt,Oe[2]]),re++,R++}if(Oe[1].type==="listItemPrefix"){const xt={type:"listItem",_spread:!1,start:Object.assign({},Oe[1].start),end:void 0};wt=xt,D.splice(re,0,["enter",xt,Oe[2]]),re++,R++,ft=void 0,Pe=!0}}}return D[K][1]._spread=Ue,R}function o(D,K){return R;function R(re){a.call(this,D(re),re),K&&K.call(this,re)}}function s(){this.stack.push({type:"fragment",children:[]})}function a(D,K,R){this.stack[this.stack.length-1].children.push(D),this.stack.push(D),this.tokenStack.push([K,R||void 0]),D.position={start:Nn(K.start),end:void 0}}function l(D){return K;function K(R){D&&D.call(this,R),c.call(this,R)}}function c(D,K){const R=this.stack.pop(),re=this.tokenStack.pop();if(re)re[0].type!==D.type&&(K?K.call(this,D,re[0]):(re[1]||xc).call(this,D,re[0]));else throw new Error("Cannot close `"+D.type+"` ("+Wr({start:D.start,end:D.end})+"): it’s not open");R.position.end=Nn(D.end)}function u(){return BI(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function h(D){if(this.data.expectingFirstListItemValue){const K=this.stack[this.stack.length-2];K.start=Number.parseInt(this.sliceSerialize(D),10),this.data.expectingFirstListItemValue=void 0}}function f(){const D=this.resume(),K=this.stack[this.stack.length-1];K.lang=D}function y(){const D=this.resume(),K=this.stack[this.stack.length-1];K.meta=D}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){const D=this.resume(),K=this.stack[this.stack.length-1];K.value=D.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const D=this.resume(),K=this.stack[this.stack.length-1];K.value=D.replace(/(\r?\n|\r)$/g,"")}function m(D){const K=this.resume(),R=this.stack[this.stack.length-1];R.label=K,R.identifier=pr(this.sliceSerialize(D)).toLowerCase()}function w(){const D=this.resume(),K=this.stack[this.stack.length-1];K.title=D}function C(){const D=this.resume(),K=this.stack[this.stack.length-1];K.url=D}function E(D){const K=this.stack[this.stack.length-1];if(!K.depth){const R=this.sliceSerialize(D).length;K.depth=R}}function _(){this.data.setextHeadingSlurpLineEnding=!0}function A(D){const K=this.stack[this.stack.length-1];K.depth=this.sliceSerialize(D).codePointAt(0)===61?1:2}function k(){this.data.setextHeadingSlurpLineEnding=void 0}function L(D){const R=this.stack[this.stack.length-1].children;let re=R[R.length-1];(!re||re.type!=="text")&&(re=at(),re.position={start:Nn(D.start),end:void 0},R.push(re)),this.stack.push(re)}function M(D){const K=this.stack.pop();K.value+=this.sliceSerialize(D),K.position.end=Nn(D.end)}function F(D){const K=this.stack[this.stack.length-1];if(this.data.atHardBreak){const R=K.children[K.children.length-1];R.position.end=Nn(D.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(K.type)&&(L.call(this,D),M.call(this,D))}function j(){this.data.atHardBreak=!0}function G(){const D=this.resume(),K=this.stack[this.stack.length-1];K.value=D}function P(){const D=this.resume(),K=this.stack[this.stack.length-1];K.value=D}function V(){const D=this.resume(),K=this.stack[this.stack.length-1];K.value=D}function Y(){const D=this.stack[this.stack.length-1];if(this.data.inReference){const K=this.data.referenceType||"shortcut";D.type+="Reference",D.referenceType=K,delete D.url,delete D.title}else delete D.identifier,delete D.label;this.data.referenceType=void 0}function ae(){const D=this.stack[this.stack.length-1];if(this.data.inReference){const K=this.data.referenceType||"shortcut";D.type+="Reference",D.referenceType=K,delete D.url,delete D.title}else delete D.identifier,delete D.label;this.data.referenceType=void 0}function pe(D){const K=this.sliceSerialize(D),R=this.stack[this.stack.length-2];R.label=LC(K),R.identifier=pr(K).toLowerCase()}function ge(){const D=this.stack[this.stack.length-1],K=this.resume(),R=this.stack[this.stack.length-1];if(this.data.inReference=!0,R.type==="link"){const re=D.children;R.children=re}else R.alt=K}function x(){const D=this.resume(),K=this.stack[this.stack.length-1];K.url=D}function J(){const D=this.resume(),K=this.stack[this.stack.length-1];K.title=D}function B(){this.data.inReference=void 0}function S(){this.data.referenceType="collapsed"}function $(D){const K=this.resume(),R=this.stack[this.stack.length-1];R.label=K,R.identifier=pr(this.sliceSerialize(D)).toLowerCase(),this.data.referenceType="full"}function q(D){this.data.characterReferenceType=D.type}function X(D){const K=this.sliceSerialize(D),R=this.data.characterReferenceType;let re;R?(re=ff(K,R==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):re=xa(K);const le=this.stack[this.stack.length-1];le.value+=re}function ie(D){const K=this.stack.pop();K.position.end=Nn(D.end)}function ne(D){M.call(this,D);const K=this.stack[this.stack.length-1];K.url=this.sliceSerialize(D)}function se(D){M.call(this,D);const K=this.stack[this.stack.length-1];K.url="mailto:"+this.sliceSerialize(D)}function ee(){return{type:"blockquote",children:[]}}function me(){return{type:"code",lang:null,meta:null,value:""}}function U(){return{type:"inlineCode",value:""}}function ye(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Z(){return{type:"emphasis",children:[]}}function Be(){return{type:"heading",depth:0,children:[]}}function Fe(){return{type:"break"}}function Ae(){return{type:"html",value:""}}function We(){return{type:"image",title:null,url:"",alt:null}}function et(){return{type:"link",title:null,url:"",children:[]}}function tt(D){return{type:"list",ordered:D.type==="listOrdered",start:null,spread:D._spread,children:[]}}function xe(D){return{type:"listItem",spread:D._spread,checked:null,children:[]}}function ot(){return{type:"paragraph",children:[]}}function bt(){return{type:"strong",children:[]}}function at(){return{type:"text",value:""}}function Ge(){return{type:"thematicBreak"}}}function Nn(e){return{line:e.line,column:e.column,offset:e.offset}}function Sf(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Sf(e,r):qC(e,r)}}function qC(e,t){let n;for(n in t)if(If.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 xc(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Wr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Wr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Wr({start:t.start,end:t.end})+") is still open")}function $C(e){const t=this;t.parser=n;function n(r){return VC(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function zC(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 KC(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
10
|
-
`}]}function
|
|
11
|
-
`:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function
|
|
9
|
+
`;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 o0(e){const r={constructs:fS([t0,...(e||{}).extensions||[]]),content:i(wS),defined:[],document:i(IS),flow:i(VC),lazy:{},string:i($C),text:i(zC)};return r;function i(o){return s;function s(a){return n0(r,o,a)}}}function s0(e){for(;!vf(e););return e}const xc=/[\0\t\n\r]/g;function a0(){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(xc.lastIndex=d,c=xc.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 l0=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function c0(e){return e.replace(l0,u0)}function u0(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),o=i===120||i===88;return hf(n.slice(o?2:1),o?16:10)}return Ia(n)||e}const Cf={}.hasOwnProperty;function d0(e,t,n){return typeof t!="string"&&(n=t,t=void 0),f0(n)(s0(o0(n).document().write(a0()(e,t,!0))))}function f0(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(et),autolinkProtocol:L,autolinkEmail:L,atxHeading:o(Be),blockQuote:o(ee),characterEscape:L,characterReference:L,codeFenced:o(me),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:o(me,s),codeText:o(U,s),codeTextData:L,data:L,codeFlowValue:L,definition:o(ye),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:o(Z),hardBreakEscape:o(Fe),hardBreakTrailing:o(Fe),htmlFlow:o(Ae,s),htmlFlowData:L,htmlText:o(Ae,s),htmlTextData:L,image:o(We),label:s,link:o(et),listItem:o(xe),listItemValue:h,listOrdered:o(tt,d),listUnordered:o(tt),paragraph:o(ot),reference:S,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:o(Be),strong:o(bt),thematicBreak:o(Ge)},exit:{atxHeading:l(),atxHeadingSequence:E,autolink:l(),autolinkEmail:se,autolinkProtocol:ne,blockQuote:l(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:q,characterReferenceMarkerNumeric:q,characterReferenceValue:X,characterReference:ie,codeFenced:l(g),codeFencedFence:v,codeFencedFenceInfo:f,codeFencedFenceMeta:y,codeFlowValue:M,codeIndented:l(w),codeText:l(V),codeTextData:M,data:M,definition:l(),definitionDestinationString:C,definitionLabelString:m,definitionTitleString:b,emphasis:l(),hardBreakEscape:l(j),hardBreakTrailing:l(j),htmlFlow:l(G),htmlFlowData:M,htmlText:l(P),htmlTextData:M,image:l(le),label:ge,labelText:pe,lineEnding:F,link:l(Y),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:$,resourceDestinationString:x,resourceTitleString:J,resource:B,setextHeading:l(k),setextHeadingLineSequence:A,setextHeadingText:_,strong:l(),thematicBreak:l()}};Of(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(D){let K={type:"root",children:[]};const R={stack:[K],tokenStack:[],config:t,enter:a,exit:c,buffer:s,resume:u,data:n},re=[];let ce=-1;for(;++ce<D.length;)if(D[ce][1].type==="listOrdered"||D[ce][1].type==="listUnordered")if(D[ce][0]==="enter")re.push(ce);else{const qe=re.pop();ce=i(D,qe,ce)}for(ce=-1;++ce<D.length;){const qe=t[D[ce][0]];Cf.call(qe,D[ce][1].type)&&qe[D[ce][1].type].call(Object.assign({sliceSerialize:D[ce][2].sliceSerialize},R),D[ce][1])}if(R.tokenStack.length>0){const qe=R.tokenStack[R.tokenStack.length-1];(qe[1]||Ic).call(R,void 0,qe[0])}for(K.position={start:Tn(D.length>0?D[0][1].start:{line:1,column:1,offset:0}),end:Tn(D.length>0?D[D.length-2][1].end:{line:1,column:1,offset:0})},ce=-1;++ce<t.transforms.length;)K=t.transforms[ce](K)||K;return K}function i(D,K,R){let re=K-1,ce=-1,qe=!1,wt,lt,ft,Pe;for(;++re<=R;){const Oe=D[re];switch(Oe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Oe[0]==="enter"?ce++:ce--,Pe=void 0;break}case"lineEndingBlank":{Oe[0]==="enter"&&(wt&&!Pe&&!ce&&!ft&&(ft=re),Pe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Pe=void 0}if(!ce&&Oe[0]==="enter"&&Oe[1].type==="listItemPrefix"||ce===-1&&Oe[0]==="exit"&&(Oe[1].type==="listUnordered"||Oe[1].type==="listOrdered")){if(wt){let xt=re;for(lt=void 0;xt--;){const ct=D[xt];if(ct[1].type==="lineEnding"||ct[1].type==="lineEndingBlank"){if(ct[0]==="exit")continue;lt&&(D[lt][1].type="lineEndingBlank",qe=!0),ct[1].type="lineEnding",lt=xt}else if(!(ct[1].type==="linePrefix"||ct[1].type==="blockQuotePrefix"||ct[1].type==="blockQuotePrefixWhitespace"||ct[1].type==="blockQuoteMarker"||ct[1].type==="listItemIndent"))break}ft&&(!lt||ft<lt)&&(wt._spread=!0),wt.end=Object.assign({},lt?D[lt][1].start:Oe[1].end),D.splice(lt||re,0,["exit",wt,Oe[2]]),re++,R++}if(Oe[1].type==="listItemPrefix"){const xt={type:"listItem",_spread:!1,start:Object.assign({},Oe[1].start),end:void 0};wt=xt,D.splice(re,0,["enter",xt,Oe[2]]),re++,R++,ft=void 0,Pe=!0}}}return D[K][1]._spread=qe,R}function o(D,K){return R;function R(re){a.call(this,D(re),re),K&&K.call(this,re)}}function s(){this.stack.push({type:"fragment",children:[]})}function a(D,K,R){this.stack[this.stack.length-1].children.push(D),this.stack.push(D),this.tokenStack.push([K,R||void 0]),D.position={start:Tn(K.start),end:void 0}}function l(D){return K;function K(R){D&&D.call(this,R),c.call(this,R)}}function c(D,K){const R=this.stack.pop(),re=this.tokenStack.pop();if(re)re[0].type!==D.type&&(K?K.call(this,D,re[0]):(re[1]||Ic).call(this,D,re[0]));else throw new Error("Cannot close `"+D.type+"` ("+Wr({start:D.start,end:D.end})+"): it’s not open");R.position.end=Tn(D.end)}function u(){return uS(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function h(D){if(this.data.expectingFirstListItemValue){const K=this.stack[this.stack.length-2];K.start=Number.parseInt(this.sliceSerialize(D),10),this.data.expectingFirstListItemValue=void 0}}function f(){const D=this.resume(),K=this.stack[this.stack.length-1];K.lang=D}function y(){const D=this.resume(),K=this.stack[this.stack.length-1];K.meta=D}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){const D=this.resume(),K=this.stack[this.stack.length-1];K.value=D.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function w(){const D=this.resume(),K=this.stack[this.stack.length-1];K.value=D.replace(/(\r?\n|\r)$/g,"")}function m(D){const K=this.resume(),R=this.stack[this.stack.length-1];R.label=K,R.identifier=hr(this.sliceSerialize(D)).toLowerCase()}function b(){const D=this.resume(),K=this.stack[this.stack.length-1];K.title=D}function C(){const D=this.resume(),K=this.stack[this.stack.length-1];K.url=D}function E(D){const K=this.stack[this.stack.length-1];if(!K.depth){const R=this.sliceSerialize(D).length;K.depth=R}}function _(){this.data.setextHeadingSlurpLineEnding=!0}function A(D){const K=this.stack[this.stack.length-1];K.depth=this.sliceSerialize(D).codePointAt(0)===61?1:2}function k(){this.data.setextHeadingSlurpLineEnding=void 0}function L(D){const R=this.stack[this.stack.length-1].children;let re=R[R.length-1];(!re||re.type!=="text")&&(re=at(),re.position={start:Tn(D.start),end:void 0},R.push(re)),this.stack.push(re)}function M(D){const K=this.stack.pop();K.value+=this.sliceSerialize(D),K.position.end=Tn(D.end)}function F(D){const K=this.stack[this.stack.length-1];if(this.data.atHardBreak){const R=K.children[K.children.length-1];R.position.end=Tn(D.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(K.type)&&(L.call(this,D),M.call(this,D))}function j(){this.data.atHardBreak=!0}function G(){const D=this.resume(),K=this.stack[this.stack.length-1];K.value=D}function P(){const D=this.resume(),K=this.stack[this.stack.length-1];K.value=D}function V(){const D=this.resume(),K=this.stack[this.stack.length-1];K.value=D}function Y(){const D=this.stack[this.stack.length-1];if(this.data.inReference){const K=this.data.referenceType||"shortcut";D.type+="Reference",D.referenceType=K,delete D.url,delete D.title}else delete D.identifier,delete D.label;this.data.referenceType=void 0}function le(){const D=this.stack[this.stack.length-1];if(this.data.inReference){const K=this.data.referenceType||"shortcut";D.type+="Reference",D.referenceType=K,delete D.url,delete D.title}else delete D.identifier,delete D.label;this.data.referenceType=void 0}function pe(D){const K=this.sliceSerialize(D),R=this.stack[this.stack.length-2];R.label=c0(K),R.identifier=hr(K).toLowerCase()}function ge(){const D=this.stack[this.stack.length-1],K=this.resume(),R=this.stack[this.stack.length-1];if(this.data.inReference=!0,R.type==="link"){const re=D.children;R.children=re}else R.alt=K}function x(){const D=this.resume(),K=this.stack[this.stack.length-1];K.url=D}function J(){const D=this.resume(),K=this.stack[this.stack.length-1];K.title=D}function B(){this.data.inReference=void 0}function S(){this.data.referenceType="collapsed"}function $(D){const K=this.resume(),R=this.stack[this.stack.length-1];R.label=K,R.identifier=hr(this.sliceSerialize(D)).toLowerCase(),this.data.referenceType="full"}function q(D){this.data.characterReferenceType=D.type}function X(D){const K=this.sliceSerialize(D),R=this.data.characterReferenceType;let re;R?(re=hf(K,R==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):re=Ia(K);const ce=this.stack[this.stack.length-1];ce.value+=re}function ie(D){const K=this.stack.pop();K.position.end=Tn(D.end)}function ne(D){M.call(this,D);const K=this.stack[this.stack.length-1];K.url=this.sliceSerialize(D)}function se(D){M.call(this,D);const K=this.stack[this.stack.length-1];K.url="mailto:"+this.sliceSerialize(D)}function ee(){return{type:"blockquote",children:[]}}function me(){return{type:"code",lang:null,meta:null,value:""}}function U(){return{type:"inlineCode",value:""}}function ye(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Z(){return{type:"emphasis",children:[]}}function Be(){return{type:"heading",depth:0,children:[]}}function Fe(){return{type:"break"}}function Ae(){return{type:"html",value:""}}function We(){return{type:"image",title:null,url:"",alt:null}}function et(){return{type:"link",title:null,url:"",children:[]}}function tt(D){return{type:"list",ordered:D.type==="listOrdered",start:null,spread:D._spread,children:[]}}function xe(D){return{type:"listItem",spread:D._spread,checked:null,children:[]}}function ot(){return{type:"paragraph",children:[]}}function bt(){return{type:"strong",children:[]}}function at(){return{type:"text",value:""}}function Ge(){return{type:"thematicBreak"}}}function Tn(e){return{line:e.line,column:e.column,offset:e.offset}}function Of(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Of(e,r):p0(e,r)}}function p0(e,t){let n;for(n in t)if(Cf.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 Ic(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Wr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Wr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Wr({start:t.start,end:t.end})+") is still open")}function h0(e){const t=this;t.parser=n;function n(r){return d0(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function m0(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 g0(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
10
|
+
`}]}function y0(e,t){const n=t.value?t.value+`
|
|
11
|
+
`:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function v0(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function b0(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function w0(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=Fr(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 x0(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 I0(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Ef(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 S0(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Ef(e,t);const i={src:Fr(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 C0(e,t){const n={src:Fr(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 O0(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 E0(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Ef(e,t);const i={href:Fr(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 _0(e,t){const n={href:Fr(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 N0(e,t,n){const r=e.all(t),i=n?T0(n):_f(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:`
|
|
12
12
|
`}),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:`
|
|
13
|
-
`});const c={type:"element",tagName:"li",properties:o,children:s};return e.patch(t,c),e.applyData(t,c)}function
|
|
13
|
+
`});const c={type:"element",tagName:"li",properties:o,children:s};return e.patch(t,c),e.applyData(t,c)}function T0(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=_f(n[r])}return t}function _f(e){const t=e.spread;return t??e.children.length>1}function k0(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 R0(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function A0(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function F0(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function P0(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=va(t.children[1]),l=af(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 D0(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 M0(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Sc=9,Cc=32;function j0(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const o=[];for(;r;)o.push(Oc(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return o.push(Oc(t.slice(i),i>0,!1)),o.join("")}function Oc(e,t,n){let r=0,i=e.length;if(t){let o=e.codePointAt(r);for(;o===Sc||o===Cc;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(i-1);for(;o===Sc||o===Cc;)i--,o=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function L0(e,t){const n={type:"text",value:j0(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function B0(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const V0={blockquote:m0,break:g0,code:y0,delete:v0,emphasis:b0,footnoteReference:w0,heading:x0,html:I0,imageReference:S0,image:C0,inlineCode:O0,linkReference:E0,link:_0,listItem:N0,list:k0,paragraph:R0,root:A0,strong:F0,table:P0,tableCell:M0,tableRow:D0,text:L0,thematicBreak:B0,toml:Pi,yaml:Pi,definition:Pi,footnoteDefinition:Pi};function Pi(){}const Nf=-1,xo=0,Gr=1,ro=2,Oa=3,Ea=4,_a=5,Na=6,Tf=7,kf=8,Ec=typeof self=="object"?self:globalThis,U0=(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 xo:case Nf:return n(s,i);case Gr:{const a=n([],i);for(const l of s)a.push(r(l));return a}case ro:{const a=n({},i);for(const[l,c]of s)a[r(l)]=r(c);return a}case Oa:return n(new Date(s),i);case Ea:{const{source:a,flags:l}=s;return n(new RegExp(a,l),i)}case _a:{const a=n(new Map,i);for(const[l,c]of s)a.set(r(l),r(c));return a}case Na:{const a=n(new Set,i);for(const l of s)a.add(r(l));return a}case Tf:{const{name:a,message:l}=s;return n(new Ec[a](l),i)}case kf: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 Ec[o](s),i)};return r},_c=e=>U0(new Map,e)(0),ur="",{toString:q0}={},{keys:$0}=Object,qr=e=>{const t=typeof e;if(t!=="object"||!e)return[xo,t];const n=q0.call(e).slice(8,-1);switch(n){case"Array":return[Gr,ur];case"Object":return[ro,ur];case"Date":return[Oa,ur];case"RegExp":return[Ea,ur];case"Map":return[_a,ur];case"Set":return[Na,ur];case"DataView":return[Gr,n]}return n.includes("Array")?[Gr,n]:n.includes("Error")?[Tf,n]:[ro,n]},Di=([e,t])=>e===xo&&(t==="function"||t==="symbol"),z0=(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]=qr(s);switch(a){case xo:{let u=s;switch(l){case"bigint":a=kf,u=s.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return i([Nf],s)}return i([a,u],s)}case Gr:{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 ro:{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 $0(s))(e||!Di(qr(s[h])))&&u.push([o(h),o(s[h])]);return d}case Oa:return i([a,s.toISOString()],s);case Ea:{const{source:u,flags:d}=s;return i([a,{source:u,flags:d}],s)}case _a:{const u=[],d=i([a,u],s);for(const[h,f]of s)(e||!(Di(qr(h))||Di(qr(f))))&&u.push([o(h),o(f)]);return d}case Na:{const u=[],d=i([a,u],s);for(const h of s)(e||!Di(qr(h)))&&u.push(o(h));return d}}const{message:c}=s;return i([a,{name:l,message:c}],s)};return o},Nc=(e,{json:t,lossy:n}={})=>{const r=[];return z0(!(t||n),!!t,new Map,r)(e),r},io=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?_c(Nc(e,t)):structuredClone(e):(e,t)=>_c(Nc(e,t));function K0(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 H0(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function J0(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||K0,r=e.options.footnoteBackLabel||H0,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=Fr(d.toLowerCase());let f=0;const y=[],v=e.footnoteCounts.get(d);for(;v!==void 0&&++f<=v;){y.length>0&&y.push({type:"text",value:" "});let m=typeof n=="string"?n:n(l,f);typeof m=="string"&&(m={type:"text",value:m}),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(m)?m:[m]})}const g=u[u.length-1];if(g&&g.type==="element"&&g.tagName==="p"){const m=g.children[g.children.length-1];m&&m.type==="text"?m.value+=" ":g.children.push({type:"text",value:" "}),g.children.push(...y)}else u.push(...y);const w={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(u,!0)};e.patch(c,w),a.push(w)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...io(s),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
14
14
|
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
|
|
15
|
-
`}]}}const
|
|
15
|
+
`}]}}const Rf=(function(e){if(e==null)return X0;if(typeof e=="function")return Io(e);if(typeof e=="object")return Array.isArray(e)?W0(e):Q0(e);if(typeof e=="string")return G0(e);throw new Error("Expected function, string, or object as test")});function W0(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Rf(e[n]);return Io(r);function r(...i){let o=-1;for(;++o<t.length;)if(t[o].apply(this,i))return!0;return!1}}function Q0(e){const t=e;return Io(n);function n(r){const i=r;let o;for(o in e)if(i[o]!==t[o])return!1;return!0}}function G0(e){return Io(t);function t(n){return n&&n.type===e}}function Io(e){return t;function t(n,r,i){return!!(Y0(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function X0(){return!0}function Y0(e){return e!==null&&typeof e=="object"&&"type"in e}const Af=[],Z0=!0,Tc=!1,eO="skip";function tO(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const o=Rf(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=Af,y,v,g;if((!t||o(l,c,u[u.length-1]||void 0))&&(f=nO(n(l,u)),f[0]===Tc))return f;if("children"in l&&l.children){const w=l;if(w.children&&f[0]!==eO)for(v=(r?w.children.length:-1)+s,g=u.concat(w);v>-1&&v<w.children.length;){const m=w.children[v];if(y=a(m,v,g)(),y[0]===Tc)return y;v=typeof y[1]=="number"?y[1]:v+s}}return f}}}function nO(e){return Array.isArray(e)?e:typeof e=="number"?[Z0,e]:e==null?Af:[e]}function Ff(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),tO(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 Bs={}.hasOwnProperty,rO={};function iO(e,t){const n=t||rO,r=new Map,i=new Map,o=new Map,s={...V0,...n.handlers},a={all:c,applyData:sO,definitionById:r,footnoteById:i,footnoteCounts:o,footnoteOrder:[],handlers:s,one:l,options:n,patch:oO,wrap:lO};return Ff(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(Bs.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:v,...g}=u,w=io(g);return w.children=a.all(u),w}return io(u)}return(a.options.unknownHandler||aO)(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=kc(y.value)),!Array.isArray(y)&&y.type==="element")){const v=y.children[0];v&&v.type==="text"&&(v.value=kc(v.value))}Array.isArray(y)?d.push(...y):d.push(y)}}}return d}}function oO(e,t){e.position&&(t.position=qI(e))}function sO(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,io(o)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function aO(e,t){const n=t.data||{},r="value"in t&&!(Bs.call(n,"hProperties")||Bs.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 lO(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
16
16
|
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
17
17
|
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
18
|
-
`}),n}function
|
|
19
|
-
`},i),o}function L0(e,t){return e&&"run"in e?async function(n,r){const i=kc(n,{file:r,...t});await e.run(i,r)}:function(n,r){return kc(n,{file:r,...e||t})}}function Rc(e){if(e)throw e}var Go,Ac;function B0(){if(Ac)return Go;Ac=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(c){return typeof Array.isArray=="function"?Array.isArray(c):t.call(c)==="[object Array]"},o=function(c){if(!c||t.call(c)!=="[object Object]")return!1;var u=e.call(c,"constructor"),d=c.constructor&&c.constructor.prototype&&e.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!u&&!d)return!1;var h;for(h in c);return typeof h>"u"||e.call(c,h)},s=function(c,u){n&&u.name==="__proto__"?n(c,u.name,{enumerable:!0,configurable:!0,value:u.newValue,writable:!0}):c[u.name]=u.newValue},a=function(c,u){if(u==="__proto__")if(e.call(c,u)){if(r)return r(c,u).value}else return;return c[u]};return Go=function l(){var c,u,d,h,f,y,v=arguments[0],g=1,b=arguments.length,m=!1;for(typeof v=="boolean"&&(m=v,v=arguments[1]||{},g=2),(v==null||typeof v!="object"&&typeof v!="function")&&(v={});g<b;++g)if(c=arguments[g],c!=null)for(u in c)d=a(v,u),h=a(c,u),v!==h&&(m&&h&&(o(h)||(f=i(h)))?(f?(f=!1,y=d&&i(d)?d:[]):y=d&&o(d)?d:{},s(v,{name:u,newValue:l(m,y,h)})):typeof h<"u"&&s(v,{name:u,newValue:h}));return v},Go}var V0=B0();const Xo=_r(V0);function Vs(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 U0(){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?q0(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 q0(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 on={basename:$0,dirname:z0,extname:K0,join:H0,sep:"/"};function $0(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');fi(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 z0(e){if(fi(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 K0(e){fi(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 H0(...e){let t=-1,n;for(;++t<e.length;)fi(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":J0(n)}function J0(e){fi(e);const t=e.codePointAt(0)===47;let n=W0(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function W0(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 fi(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Q0={cwd:G0};function G0(){return"/"}function Us(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function X0(e){if(typeof e=="string")e=new URL(e);else if(!Us(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 Y0(e)}function Y0(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 Yo=["history","path","basename","stem","extname","dirname"];class Af{constructor(t){let n;t?Us(t)?n={path:t}:typeof t=="string"||Z0(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":Q0.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Yo.length;){const o=Yo[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)Yo.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?on.basename(this.path):void 0}set basename(t){es(t,"basename"),Zo(t,"basename"),this.path=on.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?on.dirname(this.path):void 0}set dirname(t){Fc(this.basename,"dirname"),this.path=on.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?on.extname(this.path):void 0}set extname(t){if(Zo(t,"extname"),Fc(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=on.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Us(t)&&(t=X0(t)),es(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?on.basename(this.path,this.extname):void 0}set stem(t){es(t,"stem"),Zo(t,"stem"),this.path=on.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 vt(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 Zo(e,t){if(e&&e.includes(on.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+on.sep+"`")}function es(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Fc(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Z0(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const eO=(function(e){const r=this.constructor.prototype,i=r[e],o=function(){return i.apply(o,arguments)};return Object.setPrototypeOf(o,r),o}),tO={}.hasOwnProperty;class Ta extends eO{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=U0()}copy(){const t=new Ta;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Xo(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(rs("data",this.frozen),this.namespace[t]=n,this):tO.call(this.namespace,t)&&this.namespace[t]||void 0:t?(rs("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=Mi(t),r=this.parser||this.Parser;return ts("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),ts("process",this.parser||this.Parser),ns("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(o,s){const a=Mi(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);iO(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(),ts("processSync",this.parser||this.Parser),ns("processSync",this.compiler||this.Compiler),this.process(t,i),Dc("processSync","process",n),r;function i(o,s){n=!0,Rc(o),r=s}}run(t,n,r){Pc(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=Mi(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),Dc("runSync","run",r),i;function o(s,a){Rc(s),i=a,r=!0}}stringify(t,n){this.freeze();const r=Mi(n),i=this.compiler||this.Compiler;return ns("stringify",i),Pc(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(rs("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=Xo(!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 v=r[h][1];Vs(v)&&Vs(f)&&(f=Xo(!0,v,f)),r[h]=[c,f,...y]}}}}const nO=new Ta().freeze();function ts(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ns(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function rs(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 Pc(e){if(!Vs(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Dc(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Mi(e){return rO(e)?e:new Af(e)}function rO(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function iO(e){return typeof e=="string"||oO(e)}function oO(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const sO="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Mc=[],jc={allowDangerousHtml:!0},aO=/^(https?|ircs?|mailto|xmpp)$/i,lO=[{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 cO(e){const t=uO(e),n=dO(e);return fO(t.runSync(t.parse(n),n),e)}function uO(e){const t=e.rehypePlugins||Mc,n=e.remarkPlugins||Mc,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...jc}:jc;return nO().use($C).use(n).use(L0,r).use(t)}function dO(e){const t=e.children||"",n=new Af;return typeof t=="string"&&(n.value=t),n}function fO(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,o=t.disallowedElements,s=t.skipHtml,a=t.unwrapDisallowed,l=t.urlTransform||pO;for(const u of lO)Object.hasOwn(t,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+sO+u.id,void 0);return Rf(e,c),II(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 Jo)if(Object.hasOwn(Jo,f)&&Object.hasOwn(u.properties,f)){const y=u.properties[f],v=Jo[f];(v===null||v.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 pO(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||aO.test(e.slice(0,t))?e:""}const hO="_container_r1dnc_1",mO="_code_r1dnc_9",Lc={container:hO,code:mO};function gO({prompt:e}){return p.jsx("div",{className:Lc.container,children:p.jsx(cO,{components:{p:({children:t})=>p.jsx(p.Fragment,{children:t}),code:({children:t})=>p.jsx("code",{className:Lc.code,children:t})},children:e})})}function Na({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(Gd,{href:e,newTab:!0,children:p.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," ","about where to find your ",t," ",n,"."]}),r&&p.jsx(gO,{prompt:r})]})}const vr=Math.min,Jn=Math.max,oo=Math.round,ji=Math.floor,Pn=e=>({x:e,y:e}),yO={left:"right",right:"left",bottom:"top",top:"bottom"},vO={start:"end",end:"start"};function qs(e,t,n){return Jn(e,vr(t,n))}function pi(e,t){return typeof e=="function"?e(t):e}function Yn(e){return e.split("-")[0]}function hi(e){return e.split("-")[1]}function Ff(e){return e==="x"?"y":"x"}function ka(e){return e==="y"?"height":"width"}function br(e){return["top","bottom"].includes(Yn(e))?"y":"x"}function Ra(e){return Ff(br(e))}function bO(e,t,n){n===void 0&&(n=!1);const r=hi(e),i=Ra(e),o=ka(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=so(s)),[s,so(s)]}function wO(e){const t=so(e);return[$s(e),t,$s(t)]}function $s(e){return e.replace(/start|end/g,t=>vO[t])}function xO(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 IO(e,t,n,r){const i=hi(e);let o=xO(Yn(e),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),t&&(o=o.concat(o.map($s)))),o}function so(e){return e.replace(/left|right|bottom|top/g,t=>yO[t])}function SO(e){return{top:0,right:0,bottom:0,left:0,...e}}function Pf(e){return typeof e!="number"?SO(e):{top:e,right:e,bottom:e,left:e}}function ao(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 Bc(e,t,n){let{reference:r,floating:i}=e;const o=br(t),s=Ra(t),a=ka(s),l=Yn(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(hi(t)){case"start":f[s]-=h*(n&&c?-1:1);break;case"end":f[s]+=h*(n&&c?-1:1);break}return f}const CO=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}=Bc(c,r,l),h=r,f={},y=0;for(let v=0;v<a.length;v++){const{name:g,fn:b}=a[v],{x:m,y:w,data:C,reset:E}=await b({x:u,y:d,initialPlacement:r,placement:h,strategy:i,middlewareData:f,rects:c,platform:s,elements:{reference:e,floating:t}});u=m??u,d=w??d,f={...f,[g]:{...f[g],...C}},E&&y<=50&&(y++,typeof E=="object"&&(E.placement&&(h=E.placement),E.rects&&(c=E.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:i}):E.rects),{x:u,y:d}=Bc(c,h,l)),v=-1)}return{x:u,y:d,placement:h,strategy:i,middlewareData:f}};async function Df(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}=pi(t,e),y=Pf(f),g=a[h?d==="floating"?"reference":"floating":d],b=ao(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:c,rootBoundary:u,strategy:l})),m=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)),C=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},E=ao(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:m,offsetParent:w,strategy:l}):m);return{top:(b.top-E.top+y.top)/C.y,bottom:(E.bottom-b.bottom+y.bottom)/C.y,left:(b.left-E.left+y.left)/C.x,right:(E.right-b.right+y.right)/C.x}}const OO=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}=pi(e,t)||{};if(c==null)return{};const d=Pf(u),h={x:n,y:r},f=Ra(i),y=ka(f),v=await s.getDimensions(c),g=f==="y",b=g?"top":"left",m=g?"bottom":"right",w=g?"clientHeight":"clientWidth",C=o.reference[y]+o.reference[f]-h[f]-o.floating[y],E=h[f]-o.reference[f],_=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let A=_?_[w]:0;(!A||!await(s.isElement==null?void 0:s.isElement(_)))&&(A=a.floating[w]||o.floating[y]);const k=C/2-E/2,L=A/2-v[y]/2-1,M=vr(d[b],L),F=vr(d[m],L),j=M,G=A-v[y]-F,P=A/2-v[y]/2+k,V=qs(j,P,G),Y=!l.arrow&&hi(i)!=null&&P!==V&&o.reference[y]/2-(P<j?M:F)-v[y]/2<0,ae=Y?P<j?P-j:P-G:0;return{[f]:h[f]+ae,data:{[f]:V,centerOffset:P-V-ae,...Y&&{alignmentOffset:ae}},reset:Y}}}),EO=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:v=!0,...g}=pi(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const b=Yn(i),m=br(a),w=Yn(a)===a,C=await(l.isRTL==null?void 0:l.isRTL(c.floating)),E=h||(w||!v?[so(a)]:wO(a)),_=y!=="none";!h&&_&&E.push(...IO(a,v,y,C));const A=[a,...E],k=await Df(t,g),L=[];let M=((r=o.flip)==null?void 0:r.overflows)||[];if(u&&L.push(k[b]),d){const P=bO(i,s,C);L.push(k[P[0]],k[P[1]])}if(M=[...M,{placement:i,overflows:L}],!L.every(P=>P<=0)){var F,j;const P=(((F=o.flip)==null?void 0:F.index)||0)+1,V=A[P];if(V)return{data:{index:P,overflows:M},reset:{placement:V}};let Y=(j=M.filter(ae=>ae.overflows[0]<=0).sort((ae,pe)=>ae.overflows[1]-pe.overflows[1])[0])==null?void 0:j.placement;if(!Y)switch(f){case"bestFit":{var G;const ae=(G=M.filter(pe=>{if(_){const ge=br(pe.placement);return ge===m||ge==="y"}return!0}).map(pe=>[pe.placement,pe.overflows.filter(ge=>ge>0).reduce((ge,x)=>ge+x,0)]).sort((pe,ge)=>pe[1]-ge[1])[0])==null?void 0:G[0];ae&&(Y=ae);break}case"initialPlacement":Y=a;break}if(i!==Y)return{reset:{placement:Y}}}return{}}}};async function _O(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=Yn(n),a=hi(n),l=br(n)==="y",c=["left","top"].includes(s)?-1:1,u=o&&l?-1:1,d=pi(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 TO=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 _O(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}}}}},NO=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:b,y:m}=g;return{x:b,y:m}}},...l}=pi(e,t),c={x:n,y:r},u=await Df(t,l),d=br(Yn(i)),h=Ff(d);let f=c[h],y=c[d];if(o){const g=h==="y"?"top":"left",b=h==="y"?"bottom":"right",m=f+u[g],w=f-u[b];f=qs(m,f,w)}if(s){const g=d==="y"?"top":"left",b=d==="y"?"bottom":"right",m=y+u[g],w=y-u[b];y=qs(m,y,w)}const v=a.fn({...t,[h]:f,[d]:y});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[h]:o,[d]:s}}}}}};function So(){return typeof window<"u"}function Fr(e){return Mf(e)?(e.nodeName||"").toLowerCase():"#document"}function Mt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function pn(e){var t;return(t=(Mf(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Mf(e){return So()?e instanceof Node||e instanceof Mt(e).Node:!1}function en(e){return So()?e instanceof Element||e instanceof Mt(e).Element:!1}function cn(e){return So()?e instanceof HTMLElement||e instanceof Mt(e).HTMLElement:!1}function Vc(e){return!So()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Mt(e).ShadowRoot}function mi(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=tn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(i)}function kO(e){return["table","td","th"].includes(Fr(e))}function Co(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Aa(e){const t=Fa(),n=en(e)?tn(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 RO(e){let t=Dn(e);for(;cn(t)&&!wr(t);){if(Aa(t))return t;if(Co(t))return null;t=Dn(t)}return null}function Fa(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function wr(e){return["html","body","#document"].includes(Fr(e))}function tn(e){return Mt(e).getComputedStyle(e)}function Oo(e){return en(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Dn(e){if(Fr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Vc(e)&&e.host||pn(e);return Vc(t)?t.host:t}function jf(e){const t=Dn(e);return wr(t)?e.ownerDocument?e.ownerDocument.body:e.body:cn(t)&&mi(t)?t:jf(t)}function si(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=jf(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),s=Mt(i);if(o){const a=zs(s);return t.concat(s,s.visualViewport||[],mi(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 Lf(e){const t=tn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=cn(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,a=oo(n)!==o||oo(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function Pa(e){return en(e)?e:e.contextElement}function hr(e){const t=Pa(e);if(!cn(t))return Pn(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=Lf(t);let s=(o?oo(n.width):n.width)/r,a=(o?oo(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const AO=Pn(0);function Bf(e){const t=Mt(e);return!Fa()||!t.visualViewport?AO:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function FO(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Mt(e)?!1:t}function Zn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=Pa(e);let s=Pn(1);t&&(r?en(r)&&(s=hr(r)):s=hr(e));const a=FO(o,n,r)?Bf(o):Pn(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=Mt(o),f=r&&en(r)?Mt(r):r;let y=h,v=zs(y);for(;v&&r&&f!==y;){const g=hr(v),b=v.getBoundingClientRect(),m=tn(v),w=b.left+(v.clientLeft+parseFloat(m.paddingLeft))*g.x,C=b.top+(v.clientTop+parseFloat(m.paddingTop))*g.y;l*=g.x,c*=g.y,u*=g.x,d*=g.y,l+=w,c+=C,y=Mt(v),v=zs(y)}}return ao({width:u,height:d,x:l,y:c})}function PO(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",s=pn(r),a=t?Co(t.floating):!1;if(r===s||a&&o)return n;let l={scrollLeft:0,scrollTop:0},c=Pn(1);const u=Pn(0),d=cn(r);if((d||!d&&!o)&&((Fr(r)!=="body"||mi(s))&&(l=Oo(r)),cn(r))){const h=Zn(r);c=hr(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 DO(e){return Array.from(e.getClientRects())}function Ks(e,t){const n=Oo(e).scrollLeft;return t?t.left+n:Zn(pn(e)).left+n}function MO(e){const t=pn(e),n=Oo(e),r=e.ownerDocument.body,i=Jn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=Jn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Ks(e);const a=-n.scrollTop;return tn(r).direction==="rtl"&&(s+=Jn(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}function jO(e,t){const n=Mt(e),r=pn(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=Fa();(!c||c&&t==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:a,y:l}}function LO(e,t){const n=Zn(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=cn(e)?hr(e):Pn(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 Uc(e,t,n){let r;if(t==="viewport")r=jO(e,n);else if(t==="document")r=MO(pn(e));else if(en(t))r=LO(t,n);else{const i=Bf(e);r={...t,x:t.x-i.x,y:t.y-i.y}}return ao(r)}function Vf(e,t){const n=Dn(e);return n===t||!en(n)||wr(n)?!1:tn(n).position==="fixed"||Vf(n,t)}function BO(e,t){const n=t.get(e);if(n)return n;let r=si(e,[],!1).filter(a=>en(a)&&Fr(a)!=="body"),i=null;const o=tn(e).position==="fixed";let s=o?Dn(e):e;for(;en(s)&&!wr(s);){const a=tn(s),l=Aa(s);!l&&a.position==="fixed"&&(i=null),(o?!l&&!i:!l&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||mi(s)&&!l&&Vf(e,s))?r=r.filter(u=>u!==s):i=a,s=Dn(s)}return t.set(e,r),r}function VO(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const s=[...n==="clippingAncestors"?Co(t)?[]:BO(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{const d=Uc(t,u,i);return c.top=Jn(d.top,c.top),c.right=vr(d.right,c.right),c.bottom=vr(d.bottom,c.bottom),c.left=Jn(d.left,c.left),c},Uc(t,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function UO(e){const{width:t,height:n}=Lf(e);return{width:t,height:n}}function qO(e,t,n){const r=cn(t),i=pn(t),o=n==="fixed",s=Zn(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=Pn(0);if(r||!r&&!o)if((Fr(t)!=="body"||mi(i))&&(a=Oo(t)),r){const f=Zn(t,!0,o,t);l.x=f.x+t.clientLeft,l.y=f.y+t.clientTop}else i&&(l.x=Ks(i));let c=0,u=0;if(i&&!r&&!o){const f=i.getBoundingClientRect();u=f.top+a.scrollTop,c=f.left+a.scrollLeft-Ks(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 is(e){return tn(e).position==="static"}function qc(e,t){if(!cn(e)||tn(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return pn(e)===n&&(n=n.ownerDocument.body),n}function Uf(e,t){const n=Mt(e);if(Co(e))return n;if(!cn(e)){let i=Dn(e);for(;i&&!wr(i);){if(en(i)&&!is(i))return i;i=Dn(i)}return n}let r=qc(e,t);for(;r&&kO(r)&&is(r);)r=qc(r,t);return r&&wr(r)&&is(r)&&!Aa(r)?n:r||RO(e)||n}const $O=async function(e){const t=this.getOffsetParent||Uf,n=this.getDimensions,r=await n(e.floating);return{reference:qO(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function zO(e){return tn(e).direction==="rtl"}const KO={convertOffsetParentRelativeRectToViewportRelativeRect:PO,getDocumentElement:pn,getClippingRect:VO,getOffsetParent:Uf,getElementRects:$O,getClientRects:DO,getDimensions:UO,getScale:hr,isElement:en,isRTL:zO};function HO(e,t){let n=null,r;const i=pn(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=ji(u),y=ji(i.clientWidth-(c+d)),v=ji(i.clientHeight-(u+h)),g=ji(c),m={rootMargin:-f+"px "+-y+"px "+-v+"px "+-g+"px",threshold:Jn(0,vr(1,l))||1};let w=!0;function C(E){const _=E[0].intersectionRatio;if(_!==l){if(!w)return s();_?s(!1,_):r=setTimeout(()=>{s(!1,1e-7)},1e3)}w=!1}try{n=new IntersectionObserver(C,{...m,root:i.ownerDocument})}catch{n=new IntersectionObserver(C,m)}n.observe(e)}return s(!0),o}function JO(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=Pa(e),u=i||o?[...c?si(c):[],...si(t)]:[];u.forEach(b=>{i&&b.addEventListener("scroll",n,{passive:!0}),o&&b.addEventListener("resize",n)});const d=c&&a?HO(c,n):null;let h=-1,f=null;s&&(f=new ResizeObserver(b=>{let[m]=b;m&&m.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,v=l?Zn(e):null;l&&g();function g(){const b=Zn(e);v&&(b.x!==v.x||b.y!==v.y||b.width!==v.width||b.height!==v.height)&&n(),v=b,y=requestAnimationFrame(g)}return n(),()=>{var b;u.forEach(m=>{i&&m.removeEventListener("scroll",n),o&&m.removeEventListener("resize",n)}),d?.(),(b=f)==null||b.disconnect(),f=null,l&&cancelAnimationFrame(y)}}const WO=TO,QO=NO,GO=EO,XO=OO,$c=(e,t,n)=>{const r=new Map,i={platform:KO,...n},o={...i.platform,_c:r};return CO(e,t,{...i,platform:o})};const YO="react-tooltip-core-styles",ZO="react-tooltip-base-styles",zc={core:!1,base:!1};function Kc({css:e,id:t=ZO,type:n="base",ref:r}){var i,o;if(!e||typeof document>"u"||zc[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=YO),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)),zc[n]=!0}const Hc=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:i=10,strategy:o="absolute",middlewares:s=[WO(Number(i)),GO({fallbackAxisSideDirection:"start"}),QO({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(XO({element:n,padding:5})),$c(e,t,{placement:r,strategy:o,middleware:c}).then((({x:u,y:d,placement:h,middlewareData:f})=>{var y,v;const g={left:`${u}px`,top:`${d}px`,border:a},{x:b,y:m}=(y=f.arrow)!==null&&y!==void 0?y:{x:0,y:0},w=(v={top:"bottom",right:"left",bottom:"top",left:"right"}[h.split("-")[0]])!==null&&v!==void 0?v:"bottom",C=a&&{borderBottom:a,borderRight:a};let E=0;if(a){const _=`${a}`.match(/(\d+)px/);E=_?.[1]?Number(_[1]):1}return{tooltipStyles:g,tooltipArrowStyles:{left:b!=null?`${b}px`:"",top:m!=null?`${m}px`:"",right:"",bottom:"",...C,[w]:`-${l/2+E}px`},place:h}}))):$c(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})))},Jc=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),Wc=(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},Qc=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",Hs=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every(((i,o)=>Hs(i,t[o])));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Qc(e)||!Qc(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every((i=>Hs(e[i],t[i])))},eE=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"}))},Gc=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(eE(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},tE=typeof window<"u"?I.useLayoutEffect:I.useEffect,zt=e=>{e.current&&(clearTimeout(e.current),e.current=null)},nE="DEFAULT_TOOLTIP_ID",rE={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},iE=I.createContext({getTooltipData:()=>rE});function qf(e=nE){return I.useContext(iE).getTooltipData(e)}var ur={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"},os={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 oE=({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:v=0,float:g=!1,hidden:b=!1,noArrow:m=!1,clickable:w=!1,closeOnEsc:C=!1,closeOnScroll:E=!1,closeOnResize:_=!1,openEvents:A,closeEvents:k,globalCloseEvents:L,imperativeModeOnly:M,style:F,position:j,afterShow:G,afterHide:P,disableTooltip:V,content:Y,contentWrapperRef:ae,isOpen:pe,defaultIsOpen:ge=!1,setIsOpen:x,previousActiveAnchor:J,activeAnchor:B,setActiveAnchor:S,border:$,opacity:q,arrowColor:X,arrowSize:ie=8,role:ne="tooltip"})=>{var se;const ee=I.useRef(null),me=I.useRef(null),U=I.useRef(null),ye=I.useRef(null),Z=I.useRef(null),[Be,Fe]=I.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[Ae,We]=I.useState(!1),[et,tt]=I.useState(!1),[xe,ot]=I.useState(null),bt=I.useRef(!1),at=I.useRef(null),{anchorRefs:Ge,setActiveAnchor:D}=qf(t),K=I.useRef(!1),[R,re]=I.useState([]),le=I.useRef(!1),Ue=u||c.includes("click"),wt=Ue||A?.click||A?.dblclick||A?.mousedown,lt=A?{...A}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!A&&Ue&&Object.assign(lt,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const ft=k?{...k}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!k&&Ue&&Object.assign(ft,{mouseleave:!1,blur:!1,mouseout:!1});const Pe=L?{...L}:{escape:C||!1,scroll:E||!1,resize:_||!1,clickOutsideAnchor:wt||!1};M&&(Object.assign(lt,{mouseover:!1,focus:!1,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(ft,{mouseout:!1,blur:!1,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(Pe,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),tE((()=>(le.current=!0,()=>{le.current=!1})),[]);const Oe=te=>{le.current&&(te&&tt(!0),setTimeout((()=>{le.current&&(x?.(te),pe===void 0&&We(te))}),10))};I.useEffect((()=>{if(t){if(Ae){fe(J);const ce=te(B),Ce=[...new Set([...ce,t])].filter(Boolean).join(" ");B?.setAttribute("aria-describedby",Ce)}else fe(B);return()=>{fe(B),fe(J)}}function te(ce){var Ce;return((Ce=ce?.getAttribute("aria-describedby"))===null||Ce===void 0?void 0:Ce.split(" "))||[]}function fe(ce){const Ce=te(ce).filter((De=>De!==t));Ce.length?ce?.setAttribute("aria-describedby",Ce.join(" ")):ce?.removeAttribute("aria-describedby")}}),[B,Ae,t,J]),I.useEffect((()=>{if(pe===void 0)return()=>null;pe&&tt(!0);const te=setTimeout((()=>{We(pe)}),10);return()=>{clearTimeout(te)}}),[pe]),I.useEffect((()=>{if(Ae!==bt.current)if(zt(Z),bt.current=Ae,Ae)G?.();else{const te=(fe=>{const ce=fe.match(/^([\d.]+)(ms|s)$/);if(!ce)return 0;const[,Ce,De]=ce;return Number(Ce)*(De==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));Z.current=setTimeout((()=>{tt(!1),ot(null),P?.()}),te+25)}}),[Ae]);const xt=te=>{Fe((fe=>Hs(fe,te)?fe:te))},ct=(te=y)=>{zt(U),et?Oe(!0):U.current=setTimeout((()=>{Oe(!0)}),te)},Ct=(te=v)=>{zt(ye),ye.current=setTimeout((()=>{K.current||Oe(!1)}),te)},In=te=>{var fe;if(!te)return;const ce=(fe=te.currentTarget)!==null&&fe!==void 0?fe:te.target;if(!ce?.isConnected)return S(null),void D({current:null});y?ct():Oe(!0),S(ce),D({current:ce}),zt(ye)},Sn=()=>{w?Ct(v||100):v?Ct():Oe(!1),zt(U)},Cn=({x:te,y:fe})=>{var ce;const Ce={getBoundingClientRect:()=>({x:te,y:fe,width:0,height:0,top:fe,left:te,right:te,bottom:fe})};Hc({place:(ce=xe?.place)!==null&&ce!==void 0?ce:a,offset:l,elementReference:Ce,tooltipReference:ee.current,tooltipArrowReference:me.current,strategy:d,middlewares:h,border:$,arrowSize:ie}).then((De=>{xt(De)}))},nn=te=>{if(!te)return;const fe=te,ce={x:fe.clientX,y:fe.clientY};Cn(ce),at.current=ce},Qt=te=>{var fe;if(!Ae)return;const ce=te.target;ce.isConnected&&(!((fe=ee.current)===null||fe===void 0)&&fe.contains(ce)||[document.querySelector(`[id='${o}']`),...R].some((Ce=>Ce?.contains(ce)))||(Oe(!1),zt(U)))},On=Wc(In,50),qe=Wc(Sn,50),nt=te=>{qe.cancel(),On(te)},de=()=>{On.cancel(),qe()},Se=I.useCallback((()=>{var te,fe;const ce=(te=xe?.position)!==null&&te!==void 0?te:j;ce?Cn(ce):g?at.current&&Cn(at.current):B?.isConnected&&Hc({place:(fe=xe?.place)!==null&&fe!==void 0?fe:a,offset:l,elementReference:B,tooltipReference:ee.current,tooltipArrowReference:me.current,strategy:d,middlewares:h,border:$,arrowSize:ie}).then((Ce=>{le.current&&xt(Ce)}))}),[Ae,B,Y,F,a,xe?.place,l,d,j,xe?.position,g,ie]);I.useEffect((()=>{var te,fe;const ce=new Set(Ge);R.forEach((Ee=>{V?.(Ee)||ce.add({current:Ee})}));const Ce=document.querySelector(`[id='${o}']`);Ce&&!V?.(Ce)&&ce.add({current:Ce});const De=()=>{Oe(!1)},Vt=Gc(B),Ut=Gc(ee.current);Pe.scroll&&(window.addEventListener("scroll",De),Vt?.addEventListener("scroll",De),Ut?.addEventListener("scroll",De));let ut=null;Pe.resize?window.addEventListener("resize",De):B&&ee.current&&(ut=JO(B,ee.current,Se,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const Ot=Ee=>{Ee.key==="Escape"&&Oe(!1)};Pe.escape&&window.addEventListener("keydown",Ot),Pe.clickOutsideAnchor&&window.addEventListener("click",Qt);const Me=[],pt=Ee=>!!(Ee?.target&&B?.contains(Ee.target)),Fo=Ee=>{Ae&&pt(Ee)||In(Ee)},Po=Ee=>{Ae&&pt(Ee)&&Sn()},wi=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],xi=["click","dblclick","mousedown","mouseup"];Object.entries(lt).forEach((([Ee,Gt])=>{Gt&&(wi.includes(Ee)?Me.push({event:Ee,listener:nt}):xi.includes(Ee)&&Me.push({event:Ee,listener:Fo}))})),Object.entries(ft).forEach((([Ee,Gt])=>{Gt&&(wi.includes(Ee)?Me.push({event:Ee,listener:de}):xi.includes(Ee)&&Me.push({event:Ee,listener:Po}))})),g&&Me.push({event:"pointermove",listener:nn});const Ii=()=>{K.current=!0},rn=()=>{K.current=!1,Sn()},Si=w&&(ft.mouseout||ft.mouseleave);return Si&&((te=ee.current)===null||te===void 0||te.addEventListener("mouseover",Ii),(fe=ee.current)===null||fe===void 0||fe.addEventListener("mouseout",rn)),Me.forEach((({event:Ee,listener:Gt})=>{ce.forEach((Pr=>{var Bn;(Bn=Pr.current)===null||Bn===void 0||Bn.addEventListener(Ee,Gt)}))})),()=>{var Ee,Gt;Pe.scroll&&(window.removeEventListener("scroll",De),Vt?.removeEventListener("scroll",De),Ut?.removeEventListener("scroll",De)),Pe.resize?window.removeEventListener("resize",De):ut?.(),Pe.clickOutsideAnchor&&window.removeEventListener("click",Qt),Pe.escape&&window.removeEventListener("keydown",Ot),Si&&((Ee=ee.current)===null||Ee===void 0||Ee.removeEventListener("mouseover",Ii),(Gt=ee.current)===null||Gt===void 0||Gt.removeEventListener("mouseout",rn)),Me.forEach((({event:Pr,listener:Bn})=>{ce.forEach((sr=>{var Dr;(Dr=sr.current)===null||Dr===void 0||Dr.removeEventListener(Pr,Bn)}))}))}}),[B,Se,et,Ge,R,A,k,L,Ue,y,v]),I.useEffect((()=>{var te,fe;let ce=(fe=(te=xe?.anchorSelect)!==null&&te!==void 0?te:s)!==null&&fe!==void 0?fe:"";!ce&&t&&(ce=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const Ce=new MutationObserver((De=>{const Vt=[],Ut=[];De.forEach((ut=>{if(ut.type==="attributes"&&ut.attributeName==="data-tooltip-id"&&(ut.target.getAttribute("data-tooltip-id")===t?Vt.push(ut.target):ut.oldValue===t&&Ut.push(ut.target)),ut.type==="childList"){if(B){const Ot=[...ut.removedNodes].filter((Me=>Me.nodeType===1));if(ce)try{Ut.push(...Ot.filter((Me=>Me.matches(ce)))),Ut.push(...Ot.flatMap((Me=>[...Me.querySelectorAll(ce)])))}catch{}Ot.some((Me=>{var pt;return!!(!((pt=Me?.contains)===null||pt===void 0)&&pt.call(Me,B))&&(tt(!1),Oe(!1),S(null),zt(U),zt(ye),!0)}))}if(ce)try{const Ot=[...ut.addedNodes].filter((Me=>Me.nodeType===1));Vt.push(...Ot.filter((Me=>Me.matches(ce)))),Vt.push(...Ot.flatMap((Me=>[...Me.querySelectorAll(ce)])))}catch{}}})),(Vt.length||Ut.length)&&re((ut=>[...ut.filter((Ot=>!Ut.includes(Ot))),...Vt]))}));return Ce.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{Ce.disconnect()}}),[t,s,xe?.anchorSelect,B]),I.useEffect((()=>{Se()}),[Se]),I.useEffect((()=>{if(!ae?.current)return()=>null;const te=new ResizeObserver((()=>{setTimeout((()=>Se()))}));return te.observe(ae.current),()=>{te.disconnect()}}),[Y,ae?.current]),I.useEffect((()=>{var te;const fe=document.querySelector(`[id='${o}']`),ce=[...R,fe];B&&ce.includes(B)||S((te=R[0])!==null&&te!==void 0?te:fe)}),[o,R,B]),I.useEffect((()=>(ge&&Oe(!0),()=>{zt(U),zt(ye)})),[]),I.useEffect((()=>{var te;let fe=(te=xe?.anchorSelect)!==null&&te!==void 0?te:s;if(!fe&&t&&(fe=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),fe)try{const ce=Array.from(document.querySelectorAll(fe));re(ce)}catch{re([])}}),[t,s,xe?.anchorSelect]),I.useEffect((()=>{U.current&&(zt(U),ct(y))}),[y]);const It=(se=xe?.content)!==null&&se!==void 0?se:Y,hn=Ae&&Object.keys(Be.tooltipStyles).length>0;return I.useImperativeHandle(e,(()=>({open:te=>{if(te?.anchorSelect)try{document.querySelector(te.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${te.anchorSelect}" is not a valid CSS selector`)}ot(te??null),te?.delay?ct(te.delay):Oe(!0)},close:te=>{te?.delay?Ct(te.delay):Oe(!1)},activeAnchor:B,place:Be.place,isOpen:!!(et&&!b&&It&&hn)}))),et&&!b&&It?I.createElement(f,{id:t,role:ne,className:Jt("react-tooltip",ur.tooltip,os.tooltip,os[i],n,`react-tooltip__place-${Be.place}`,ur[hn?"show":"closing"],hn?"react-tooltip__show":"react-tooltip__closing",d==="fixed"&&ur.fixed,w&&ur.clickable),onTransitionEnd:te=>{zt(Z),Ae||te.propertyName!=="opacity"||(tt(!1),ot(null),P?.())},style:{...F,...Be.tooltipStyles,opacity:q!==void 0&&hn?q:void 0},ref:ee},It,I.createElement(f,{className:Jt("react-tooltip-arrow",ur.arrow,os.arrow,r,m&&ur.noArrow),style:{...Be.tooltipArrowStyles,background:X?`linear-gradient(to right bottom, transparent 50%, ${X} 50%)`:void 0,"--rt-arrow-size":`${ie}px`},ref:me})):null},sE=({content:e})=>I.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),aE=I.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:v="absolute",middlewares:g,delayShow:b=0,delayHide:m=0,float:w=!1,hidden:C=!1,noArrow:E=!1,clickable:_=!1,closeOnEsc:A=!1,closeOnScroll:k=!1,closeOnResize:L=!1,openEvents:M,closeEvents:F,globalCloseEvents:j,imperativeModeOnly:G=!1,style:P,position:V,isOpen:Y,defaultIsOpen:ae=!1,disableStyleInjection:pe=!1,border:ge,opacity:x,arrowColor:J,arrowSize:B,setIsOpen:S,afterShow:$,afterHide:q,disableTooltip:X,role:ie="tooltip"},ne)=>{const[se,ee]=I.useState(r),[me,U]=I.useState(i),[ye,Z]=I.useState(c),[Be,Fe]=I.useState(l),[Ae,We]=I.useState(u),[et,tt]=I.useState(b),[xe,ot]=I.useState(m),[bt,at]=I.useState(w),[Ge,D]=I.useState(C),[K,R]=I.useState(d),[re,le]=I.useState(f),[Ue,wt]=I.useState(v),[lt,ft]=I.useState(null),[Pe,Oe]=I.useState(null),xt=I.useRef(null),ct=I.useRef(pe),{anchorRefs:Ct,activeAnchor:In}=qf(e),Sn=qe=>qe?.getAttributeNames().reduce(((nt,de)=>{var Se;return de.startsWith("data-tooltip-")&&(nt[de.replace(/^data-tooltip-/,"")]=(Se=qe?.getAttribute(de))!==null&&Se!==void 0?Se:null),nt}),{}),Cn=qe=>{const nt={place:de=>{var Se;Z((Se=de)!==null&&Se!==void 0?Se:c)},content:de=>{ee(de??r)},html:de=>{U(de??i)},variant:de=>{var Se;Fe((Se=de)!==null&&Se!==void 0?Se:l)},offset:de=>{We(de===null?u:Number(de))},wrapper:de=>{var Se;R((Se=de)!==null&&Se!==void 0?Se:d)},events:de=>{const Se=de?.split(" ");le(Se??f)},"position-strategy":de=>{var Se;wt((Se=de)!==null&&Se!==void 0?Se:v)},"delay-show":de=>{tt(de===null?b:Number(de))},"delay-hide":de=>{ot(de===null?m:Number(de))},float:de=>{at(de===null?w:de==="true")},hidden:de=>{D(de===null?C:de==="true")},"class-name":de=>{ft(de)}};Object.values(nt).forEach((de=>de(null))),Object.entries(qe).forEach((([de,Se])=>{var It;(It=nt[de])===null||It===void 0||It.call(nt,Se)}))};I.useEffect((()=>{ee(r)}),[r]),I.useEffect((()=>{U(i)}),[i]),I.useEffect((()=>{Z(c)}),[c]),I.useEffect((()=>{Fe(l)}),[l]),I.useEffect((()=>{We(u)}),[u]),I.useEffect((()=>{tt(b)}),[b]),I.useEffect((()=>{ot(m)}),[m]),I.useEffect((()=>{at(w)}),[w]),I.useEffect((()=>{D(C)}),[C]),I.useEffect((()=>{wt(v)}),[v]),I.useEffect((()=>{ct.current!==pe&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")}),[pe]),I.useEffect((()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:pe==="core",disableBase:pe}}))}),[]),I.useEffect((()=>{var qe;const nt=new Set(Ct);let de=n;if(!de&&e&&(de=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),de)try{document.querySelectorAll(de).forEach((fe=>{nt.add({current:fe})}))}catch{console.warn(`[react-tooltip] "${de}" is not a valid CSS selector`)}const Se=document.querySelector(`[id='${t}']`);if(Se&&nt.add({current:Se}),!nt.size)return()=>null;const It=(qe=Pe??Se)!==null&&qe!==void 0?qe:In.current,hn=new MutationObserver((fe=>{fe.forEach((ce=>{var Ce;if(!It||ce.type!=="attributes"||!(!((Ce=ce.attributeName)===null||Ce===void 0)&&Ce.startsWith("data-tooltip-")))return;const De=Sn(It);Cn(De)}))})),te={attributes:!0,childList:!1,subtree:!1};if(It){const fe=Sn(It);Cn(fe),hn.observe(It,te)}return()=>{hn.disconnect()}}),[Ct,In,Pe,t,n]),I.useEffect((()=>{P?.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),ge&&!Jc("border",`${ge}`)&&console.warn(`[react-tooltip] "${ge}" is not a valid \`border\`.`),P?.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),x&&!Jc("opacity",`${x}`)&&console.warn(`[react-tooltip] "${x}" is not a valid \`opacity\`.`)}),[]);let nn=h;const Qt=I.useRef(null);if(o){const qe=o({content:Pe?.getAttribute("data-tooltip-content")||se||null,activeAnchor:Pe});nn=qe?I.createElement("div",{ref:Qt,className:"react-tooltip-content-wrapper"},qe):null}else se&&(nn=se);me&&(nn=I.createElement(sE,{content:me}));const On={forwardRef:ne,id:e,anchorId:t,anchorSelect:n,className:Jt(s,lt),classNameArrow:a,content:nn,contentWrapperRef:Qt,place:ye,variant:Be,offset:Ae,wrapper:K,events:re,openOnClick:y,positionStrategy:Ue,middlewares:g,delayShow:et,delayHide:xe,float:bt,hidden:Ge,noArrow:E,clickable:_,closeOnEsc:A,closeOnScroll:k,closeOnResize:L,openEvents:M,closeEvents:F,globalCloseEvents:j,imperativeModeOnly:G,style:P,position:V,isOpen:Y,defaultIsOpen:ae,border:ge,opacity:x,arrowColor:J,arrowSize:B,setIsOpen:S,afterShow:$,afterHide:q,disableTooltip:X,activeAnchor:Pe,previousActiveAnchor:xt.current,setActiveAnchor:qe=>{Oe((nt=>(qe?.isSameNode(nt)||(xt.current=nt),qe)))},role:ie};return I.createElement(oE,{...On})}));typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",(e=>{e.detail.disableCore||Kc({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||Kc({css:`
|
|
20
|
-
.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 lE(){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 $f({id:e,tooltipText:t}){return p.jsxs(p.Fragment,{children:[p.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:lE()}),p.jsx(aE,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}function zf({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(Gd,{href:e,newTab:!0,children:p.jsx("span",{style:{textDecoration:"underline"},children:n})}):p.jsx("span",{children:n})," ",t&&p.jsx($f,{id:`docs-helper-text-${dx(n||t?.slice(0,50))}`,tooltipText:t})]})})}const cE="_metadataInputWrapper_1266b_1",uE={metadataInputWrapper:cE};function gi({metadata:e,onChange:t,providerName:n,variant:r="standard"}){return p.jsxs("div",{className:uE.metadataInputWrapper,children:[e.docsURL&&r==="standard"&&p.jsx(Na,{url:e.docsURL,providerDisplayName:n||"",credentialName:e.displayName||Wt(e.name.toLowerCase()),prompt:e.prompt}),r==="header"&&p.jsx(zf,{url:e.docsURL,prompt:e.prompt,inputName:e.displayName||e.name}),p.jsx(yn.Input,{id:e.name,name:e.name,type:"text",placeholder:e.displayName||e.name,onChange:t})]})}function Eo(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 xr(e,t){return e.every(n=>{const r=t[n.name];return r&&r.trim()!==""})}function dE(e,t){const n=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?.name}`}}function fE(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 Kf({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:i,submitButtonType:o,metadataInputs:s}){const[a,l]=I.useState({apiKey:""}),c=b=>{const{name:m,value:w}=b.currentTarget;l(C=>({...C,[m]:w.trim()}))},{apiKey:u}=a,{providerName:d}=yt(e),h=u.length>0,f=xr(s,a),y=r||!h||!f,v=t.apiKeyOpts?.docsURL,g=()=>{const b=Eo(s,a);n({apiKey:u,providerMetadata:b})};return p.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[v&&p.jsx(Na,{url:v,providerDisplayName:d||Wt(e),credentialName:"API key"}),p.jsx(yn.PasswordInput,{id:"apiKey",name:"apiKey",placeholder:"API Key",onChange:c}),s.map(b=>p.jsx(gi,{metadata:b,onChange:c,providerName:d||Wt(e)},b.name)),p.jsx(Je,{style:{marginTop:"1em",width:"100%"},disabled:y,type:o||"submit",onClick:g,variant:i,children:"Next"})]})}function pE({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i,metadataInputs:o}){const{providerName:s}=yt(e);return p.jsxs(nr,{children:[p.jsx(rr,{children:`Set up ${s} integration`}),p.jsx(wn,{error:r}),p.jsx(Kf,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:i||!!r,metadataInputs:o})]})}function hE({...e}){return p.jsx(pE,{...e})}const mE={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 yi({children:e,style:t}){return p.jsx(bn,{style:{...mE,...t},children:e})}const Da=()=>{const e=mt(),t=Ze(),[n,r]=I.useState(null);return{...vn({mutationKey:["updateConnection"],mutationFn:async o=>(await e()).connectionApi.updateConnection(o),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)}}),errorMsg:n}},gE="_divider_1kmoj_1",Xc={divider:gE};function _o({className:e,style:t}){return p.jsx("hr",{className:e?`${Xc.divider} ${e}`:Xc.divider,style:t})}function Lt({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(_o,{style:{width:"100%",marginLeft:"1rem"}})})]})}function yE({provider:e}){const{projectIdOrName:t}=Ke(),{providerName:n,data:r}=yt(e),{selectedConnection:i,isConnectionsLoading:o}=fn(),{mutateAsync:s,isPending:a,error:l}=Da(),[c,u]=I.useState(null),[d,h]=I.useState(!1),f=()=>h(!1),y=()=>{h(!0),u(null)},v=l?.message||c||null,g=async b=>{f(),u(null);try{await s({projectIdOrName:t||"",connectionId:i?.id||"",updateConnectionRequest:{updateMask:["apiKey"],connection:{apiKey:b.apiKey}}},{onError:m=>{console.error("Update connection error:",m),Ye(m,u)},onSuccess:()=>{y()}})}catch(m){console.error("Update connection caught error:",m),Ye(m,u)}};return r?p.jsxs(p.Fragment,{children:[p.jsx(Lt,{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(yi,{children:"Connection updated successfully"}),v&&p.jsx(ui,{children:`Error updating connection ${v}`}),p.jsx(Kf,{provider:r?.name,providerInfo:r,handleSubmit:g,isButtonDisabled:a||o,buttonVariant:"ghost",submitButtonType:"button",metadataInputs:[]})]})]}):null}function Hf({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:i,metadataInputs:o}){const[s,a]=I.useState({username:"",password:""}),{username:l,password:c}=s,{providerName:u}=yt(e),d=g=>{const{name:b,value:m}=g.currentTarget;a(w=>({...w,[b]:m.trim()}))},h=xr(o,s),f=r||!h,y=()=>{const g=Eo(o,s);n({user:l,pass:c,providerMetadata:g})},v=t.basicOpts?.docsURL;return p.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[v&&p.jsx(Na,{url:v,providerDisplayName:u||Wt(e),credentialName:"credentials"}),p.jsx(yn.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:d}),p.jsx(yn.PasswordInput,{id:"password",name:"password",placeholder:"Password",onChange:d}),o.map(g=>p.jsx(gi,{metadata:g,onChange:d,providerName:u||Wt(e)},g.name)),p.jsx(Je,{style:{marginTop:"1em",width:"100%"},disabled:f,type:"button",onClick:y,variant:i,children:"Next"})]})}function vE({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i,metadataInputs:o}){const{providerName:s}=yt(e);return p.jsxs(nr,{children:[p.jsx(rr,{children:`Set up ${s} integration`}),p.jsx(wn,{error:r}),p.jsx(Hf,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:i||!!r,metadataInputs:o})]})}function bE({...e}){return p.jsx(vE,{...e})}function wE({provider:e}){const{projectIdOrName:t}=Ke(),{providerName:n,data:r}=yt(e),{selectedConnection:i,isConnectionsLoading:o}=fn(),{mutateAsync:s,isPending:a,error:l}=Da(),[c,u]=I.useState(null),[d,h]=I.useState(!1),f=()=>h(!1),y=()=>{h(!0),u(null)},v=l?.message||c||null,g=async b=>{f(),u(null);try{await s({projectIdOrName:t||"",connectionId:i?.id||"",updateConnectionRequest:{updateMask:["basicAuth"],connection:{basicAuth:{username:b.user,password:b.pass}}}},{onError:m=>{console.error(m),Ye(m,u)},onSuccess:()=>{y()}})}catch(m){console.error(m),Ye(m,u)}};return r?p.jsxs(p.Fragment,{children:[p.jsx(Lt,{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(yi,{children:"Connection updated successfully"}),v&&p.jsx(ui,{children:`Error updating connection: ${v}`}),p.jsx(Hf,{provider:r?.name,providerInfo:r,handleSubmit:g,isButtonDisabled:a||o,buttonVariant:"ghost",metadataInputs:[]})]})]}):null}function Jf({handleSubmit:e,isButtonDisabled:t,explicitScopesRequired:n,buttonVariant:r,metadataInputs:i,providerName:o}){const[s,a]=I.useState({clientSecret:"",clientId:"",scopes:""}),[l,c]=I.useState(null),u=w=>{const{name:C,value:E}=w.currentTarget;a(_=>({..._,[C]:E.trim()})),c(null)},{clientSecret:d,clientId:h,scopes:f}=s,y=d.length>0,v=h.length>0,g=xr(i,s),b=t||!y||!v||!g,m=()=>{const w=Eo(i,s),C={clientId:h,clientSecret:d,providerMetadata:w};n&&f.length>0&&(C.scopes=cx(f)),e(C)};return p.jsxs(p.Fragment,{children:[p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[p.jsx(yn.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:u}),p.jsx(yn.PasswordInput,{id:"clientSecret",name:"clientSecret",placeholder:"Client Secret",onChange:u}),n&&p.jsx(yn.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:u}),i.map(w=>p.jsx(gi,{metadata:w,onChange:u,providerName:o},w.name))]}),p.jsx(wn,{error:l}),p.jsx("br",{}),p.jsx(Je,{style:{width:"100%"},disabled:b,type:"button",onClick:m,variant:r,children:"Next"})]})}function xE({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,explicitScopesRequired:i,metadataInputs:o}){return p.jsxs(nr,{children:[p.jsx(rr,{children:`Set up ${r} integration`}),p.jsx(wn,{error:t}),p.jsx("br",{}),p.jsx(Jf,{handleSubmit:e,isButtonDisabled:n||!!t,explicitScopesRequired:i,metadataInputs:o,providerName:r})]})}function IE({provider:e}){const{projectIdOrName:t}=Ke(),{selectedConnection:n,isConnectionsLoading:r}=fn(),{providerName:i,data:o}=yt(e),{mutateAsync:s,isPending:a,error:l}=Da(),[c,u]=I.useState(null),[d,h]=I.useState(!1),f=()=>{h(!1)},y=()=>{h(!0),u(null)},v=o?.oauth2Opts?.explicitScopesRequired,g=l?.message||c||null,b=async m=>{f(),u(null);try{await s({projectIdOrName:t||"",connectionId:n?.id||"",updateConnectionRequest:{updateMask:["oauth2ClientCredentials"],connection:{oauth2ClientCredentials:{clientId:m.clientId,clientSecret:m.clientSecret,scopes:m.scopes}}}}),y()}catch(w){Ye(w,u)}};return p.jsxs(p.Fragment,{children:[p.jsx(Lt,{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(yi,{children:"Connection updated successfully"}),g&&p.jsx(ui,{children:`Error updating connection ${g}`}),p.jsx(Jf,{handleSubmit:b,isButtonDisabled:a||r,explicitScopesRequired:v,buttonVariant:"ghost",metadataInputs:[]})]})]})}const Yc=600,Zc=600,SE="AUTHORIZATION_SUCCEEDED",CE="AUTHORIZATION_FAILED";function OE(e,t,n,r){return I.useCallback(()=>{if(!r)return;const i=window.screenX+(window.outerWidth-Yc)/2,o=window.screenY+(window.outerHeight-Zc)/2.5,s=`width=${Yc},height=${Zc},left=${i},top=${o}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function EE(e,t,n,r){const i=Ze();return I.useCallback(o=>{if(o.origin===hd){if(o.data.eventType===SE){const s=o.data.data?.connection;s?(e(s),i.setQueriesData({queryKey:["amp","connections"]},()=>[s]),t?.close(),r?.(),i.invalidateQueries({queryKey:["amp","connections"]})):console.error("Connection ID not found in event data: ",{event:o})}o.data.eventType===CE&&(console.error("OAuth failed: ",{event:o}),n?.(o?.data?.message??"Something went wrong, try refreshing this page, and then try again."))}},[t,n,i,e,r])}function _E({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:i,onSuccessConnect:o,isSuccessConnect:s,onWindowClose:a}){const[l,c]=I.useState(null),[u,d]=I.useState(null),h=Ze(),f=I.useRef(null),y=EE(c,u,r,o),v=OE(n,d,y,t);I.useEffect(()=>{t&&!u&&!l&&!i&&!s&&(r?.(null),v())},[t,u,v,l,i,s,r]);const g=I.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),a?.()},[l,i,r,a,h]);return I.useEffect(()=>{if(u)return f.current=setInterval(()=>{u?.closed&&(f.current&&clearInterval(f.current),f.current=null,g())},500),()=>{f.current&&(clearInterval(f.current),f.current=null),window.removeEventListener("message",y)}},[g,u,y]),p.jsx("div",{children:e})}const TE=()=>{const e=mt(),t=Ze();return vn({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 NE({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(wn,{error:t}),p.jsx(Je,{variant:"ghost",style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function kE({provider:e}){const{selectedConnection:t,isConnectionsLoading:n}=fn(),r=t?.id,i=t?.projectId,{providerName:o}=yt(e),{mutateAsync:s,isPending:a,error:l}=TE(),[c,u]=I.useState(null),[d,h]=I.useState(!1),[f,y]=I.useState(null),v=()=>{h(!1)},g=()=>{h(!0),u(null),y(null)},b=l?.message||c||null,m=async()=>{v(),u(null);try{const C=await s({projectIdOrName:i||"",connectionId:r||""});y(C)}catch(C){Ye(C,u)}},w=I.useCallback(C=>{u(C)},[]);return p.jsxs(p.Fragment,{children:[p.jsx(Lt,{string:"Update connection"}),d&&p.jsx(yi,{children:"Connection updated successfully"}),p.jsx(_E,{windowTitle:`Connect to ${o}`,oauthUrl:f||null,onError:w,error:b,isSuccessConnect:d,onSuccessConnect:g,children:p.jsx(NE,{handleSubmit:m,error:b,providerName:o,isButtonDisabled:a||n||d})})]})}function Ma({provider:e}){const{data:t}=Jd(e);if(t?.authType===Ol.Basic)return p.jsx(wE,{provider:e});if(t?.authType===Ol.ApiKey)return p.jsx(yE,{provider:e});const n=t?.oauth2Opts?.grantType;if(n){if(n===Lo.AuthorizationCode||n===Lo.AuthorizationCodePkce)return p.jsx(kE,{provider:e});if(n===Lo.ClientCredentials)return p.jsx(IE,{provider:e})}return null}const RE=()=>{const e=mt(),t=Ze();return vn({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."),Ye(n)}})};function ja({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const{projectIdOrName:r}=Ke(),{integrationId:i,installation:o,setIntegrationDeleted:s,onUninstallSuccess:a}=gt(),[l,c]=I.useState(!1),u=!r||!i||!o?.id||l,d=RE(),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?.(o?.id),s()},onSettled:()=>c(!1)}))},f=l?"Uninstalling...":e,y=p.jsx(Je,{type:"button",onClick:h,disabled:u,variant:t,style:n,children:f});return o?.id?y:null}const AE=()=>{const e=mt(),t=Ze(),[n,r]=I.useState(null);return{...vn({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"),Ye(o,r)}}),errorMsg:n}};function Wf({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:i,onDisconnectError:o}){const{projectIdOrName:s}=Ke(),{selectedConnection:a}=fn(),{mutate:l,isPending:c}=AE(),u=!s||!a||!a.id||c,d=async()=>{u||(console.warn("deleting connection",{projectIdOrName:s,connectionId:a?.id}),l({projectIdOrName:s,connectionId:a?.id},{onSuccess:()=>{console.warn("successfully deleted connection:",a?.id),r?.(a),i()},onError:y=>{Ye(y,o)}}))},h=c?"Pending...":e;return p.jsx(Je,{type:"button",onClick:d,disabled:u,variant:t,style:n,children:h})}const Qf=I.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),or=()=>{const e=I.useContext(Qf);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e};function FE({children:e,resetComponent:t}){const{integrationId:n,integrationObj:r,installation:i}=gt(),{isError:o,removeError:s,setError:a}=un(),l=r?.name||n,[c,u]=I.useState(null),[d,h]=I.useState(null),{data:f,isLoading:y,isError:v,error:g,isSuccess:b}=bo();I.useEffect(()=>{!b&&!v||(v?(a(Ie.HYDRATED_REVISION,l),g&&Ye(g,u)):(s(Ie.HYDRATED_REVISION,l),u(null),h(null)))},[v,b,l,a,s,g,u]);const m=I.useMemo(()=>({hydratedRevision:f||null,loading:y,readAction:f?.content?.read,writeObjects:f?.content?.write?.objects||[]}),[f,y]),w=r?.provider||"provider",C=r?.name||n||"unknown integration";if(o(Ie.HYDRATED_REVISION,l)){const E=`${c?Wt(c):`Error retrieving objects from ${w} or integration details for ${C}`}`;return p.jsx(Tt,{message:E,children:p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",paddingTop:"1rem",width:"100%"},children:[p.jsx(Ma,{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(gd,{message:d}),i?p.jsx(ja,{buttonText:"Uninstall",buttonVariant:"danger"}):p.jsx(Wf,{buttonText:"Delete Connection",resetComponent:t,buttonVariant:"danger",onDisconnectError:_=>h(_)})]})})}return y?p.jsx(Nr,{}):p.jsx(Qf.Provider,{value:m,children:e})}const Gf=I.createContext(null);function La(){const e=I.useContext(Gf);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const Xf=I.createContext(()=>{});function PE(){const e=I.useContext(Xf);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}const Yf=I.createContext(void 0),DE={};function Ba(){const e=I.useContext(Yf);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function ME({children:e}){const{installation:t}=gt(),{hydratedRevision:n,loading:r}=or(),[i,o]=I.useState(DE),s=t?.config;I.useEffect(()=>{n?.content&&!r&&s&&!(Object.entries(i).length>0)&&Ex(n,s,o)},[n,r,s,i]);const a=I.useCallback((u,d)=>{o(h=>Ft(h,f=>{f[u]=Ft(f[u],d)}))},[o]),l=I.useCallback((u,d)=>{o(h=>Ft(h,f=>{f[u]=d}))},[o]),c=I.useMemo(()=>({objectConfigurationsState:i,setObjectConfigurationsState:o,setConfigureState:a,resetConfigureState:l}),[i,l,a]);return p.jsx(Yf.Provider,{value:c,children:e})}const Bt=()=>{const{appName:e}=Mn(),{objectConfigurationsState:t,setConfigureState:n}=Ba(),{selectedObjectName:r}=La(),i=zd(r||"",t);return{appName:e,configureState:i,setConfigureState:n,selectedObjectName:r}},Zf=()=>{const{hydratedRevision:e}=or(),{selectedObjectName:t}=La(),n=e?.content?.read?.objects?.find(i=>i.objectName===t),r=n?.displayName||t&&Wt(t);return{selectedObject:n,displayName:r}};function ep(){const{projectIdOrName:e}=Ke(),{integrationNameOrId:t}=jn(),{data:n}=tr(t),{installation:r}=dn(),{mutate:i,isIdle:o,isPending:s,error:a,errorMsg:l}=Cd();return{toggleReadingObject:({objectName:u,disabled:d,onSuccess:h,onError:f,onSettled:y})=>{if(!r){const b=new Error("Installation not created yet. Try creating the installation first.");f?.(b),y?.();return}if(!n){const b=new Error("No integration found");f?.(b),y?.();return}if(!r?.config?.content?.read?.objects?.[u]){const b=new Error(`Object "${u}" not found in installation read configuration`);f?.(b),y?.();return}const v=[`config.content.read.objects.${u}.disabled`],g={projectIdOrName:e,integrationId:n.id,installationId:r.id,installationUpdate:{updateMask:v,installation:{config:{content:{read:{objects:{[u]:{disabled:d}}}}}}}};return i(g,{onSuccess:b=>{h?.(b)},onError:b=>{f?.(b)},onSettled:()=>{y?.()}})},isIdle:o,isPending:s,error:a,errorMsg:l}}function jE(){const{installation:e}=dn(),[t,n]=I.useState(!1),{selectedObjectName:r}=Bt(),{displayName:i}=Zf(),{toggleReadingObject:o,isPending:s}=ep(),a=r?e?.config?.content?.read?.objects?.[r]:void 0;if(!a||a.disabled)return null;const c=()=>{r&&o({objectName:r,disabled:!0,onSuccess:()=>{n(!1)},onError:u=>{console.error("Error stopping read from object:",u)}})};return t?p.jsxs(p.Fragment,{children:[p.jsxs("p",{style:{padding:"1rem 0",color:"var(--amp-colors-text-muted)",fontSize:"0.875rem"},children:["Are you sure you want to stop reading from"," ",p.jsx("b",{children:i}),"?"]}),p.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[p.jsx(Je,{type:"button",variant:"ghost",style:{flex:1},onClick:()=>n(!1),children:"Cancel"}),p.jsx(Je,{type:"button",variant:"danger",style:{flex:1},onClick:c,disabled:s,children:s?"Stopping...":"Stop reading"})]})]}):p.jsxs("button",{type:"button",onClick:()=>n(!0),style:{background:"none",border:"none",cursor:"pointer",textDecoration:"underline",paddingTop:"1rem",margin:0,fontFamily:"inherit",color:"var(--amp-colors-text-muted)"},children:["Stop reading from ",p.jsx("b",{children:i})]})}function gn(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 we(){return we=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},we.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 LE(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Js(e,t)}var Li={exports:{}},Bi={exports:{}},Te={};var eu;function BE(){if(eu)return Te;eu=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,v=e?Symbol.for("react.block"):60121,g=e?Symbol.for("react.fundamental"):60117,b=e?Symbol.for("react.responder"):60118,m=e?Symbol.for("react.scope"):60119;function w(E){if(typeof E=="object"&&E!==null){var _=E.$$typeof;switch(_){case t:switch(E=E.type,E){case l:case c:case r:case o:case i:case d:return E;default:switch(E=E&&E.$$typeof,E){case a:case u:case y:case f:case s:return E;default:return _}}case n:return _}}}function C(E){return w(E)===c}return Te.AsyncMode=l,Te.ConcurrentMode=c,Te.ContextConsumer=a,Te.ContextProvider=s,Te.Element=t,Te.ForwardRef=u,Te.Fragment=r,Te.Lazy=y,Te.Memo=f,Te.Portal=n,Te.Profiler=o,Te.StrictMode=i,Te.Suspense=d,Te.isAsyncMode=function(E){return C(E)||w(E)===l},Te.isConcurrentMode=C,Te.isContextConsumer=function(E){return w(E)===a},Te.isContextProvider=function(E){return w(E)===s},Te.isElement=function(E){return typeof E=="object"&&E!==null&&E.$$typeof===t},Te.isForwardRef=function(E){return w(E)===u},Te.isFragment=function(E){return w(E)===r},Te.isLazy=function(E){return w(E)===y},Te.isMemo=function(E){return w(E)===f},Te.isPortal=function(E){return w(E)===n},Te.isProfiler=function(E){return w(E)===o},Te.isStrictMode=function(E){return w(E)===i},Te.isSuspense=function(E){return w(E)===d},Te.isValidElementType=function(E){return typeof E=="string"||typeof E=="function"||E===r||E===c||E===o||E===i||E===d||E===h||typeof E=="object"&&E!==null&&(E.$$typeof===y||E.$$typeof===f||E.$$typeof===s||E.$$typeof===a||E.$$typeof===u||E.$$typeof===g||E.$$typeof===b||E.$$typeof===m||E.$$typeof===v)},Te.typeOf=w,Te}var Ne={};var tu;function VE(){return tu||(tu=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,v=e?Symbol.for("react.block"):60121,g=e?Symbol.for("react.fundamental"):60117,b=e?Symbol.for("react.responder"):60118,m=e?Symbol.for("react.scope"):60119;function w(U){return typeof U=="string"||typeof U=="function"||U===r||U===c||U===o||U===i||U===d||U===h||typeof U=="object"&&U!==null&&(U.$$typeof===y||U.$$typeof===f||U.$$typeof===s||U.$$typeof===a||U.$$typeof===u||U.$$typeof===g||U.$$typeof===b||U.$$typeof===m||U.$$typeof===v)}function C(U){if(typeof U=="object"&&U!==null){var ye=U.$$typeof;switch(ye){case t:var Z=U.type;switch(Z){case l:case c:case r:case o:case i:case d:return Z;default:var Be=Z&&Z.$$typeof;switch(Be){case a:case u:case y:case f:case s:return Be;default:return ye}}case n:return ye}}}var E=l,_=c,A=a,k=s,L=t,M=u,F=r,j=y,G=f,P=n,V=o,Y=i,ae=d,pe=!1;function ge(U){return pe||(pe=!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.")),x(U)||C(U)===l}function x(U){return C(U)===c}function J(U){return C(U)===a}function B(U){return C(U)===s}function S(U){return typeof U=="object"&&U!==null&&U.$$typeof===t}function $(U){return C(U)===u}function q(U){return C(U)===r}function X(U){return C(U)===y}function ie(U){return C(U)===f}function ne(U){return C(U)===n}function se(U){return C(U)===o}function ee(U){return C(U)===i}function me(U){return C(U)===d}Ne.AsyncMode=E,Ne.ConcurrentMode=_,Ne.ContextConsumer=A,Ne.ContextProvider=k,Ne.Element=L,Ne.ForwardRef=M,Ne.Fragment=F,Ne.Lazy=j,Ne.Memo=G,Ne.Portal=P,Ne.Profiler=V,Ne.StrictMode=Y,Ne.Suspense=ae,Ne.isAsyncMode=ge,Ne.isConcurrentMode=x,Ne.isContextConsumer=J,Ne.isContextProvider=B,Ne.isElement=S,Ne.isForwardRef=$,Ne.isFragment=q,Ne.isLazy=X,Ne.isMemo=ie,Ne.isPortal=ne,Ne.isProfiler=se,Ne.isStrictMode=ee,Ne.isSuspense=me,Ne.isValidElementType=w,Ne.typeOf=C})()),Ne}var nu;function tp(){return nu||(nu=1,process.env.NODE_ENV==="production"?Bi.exports=BE():Bi.exports=VE()),Bi.exports}var ss,ru;function UE(){if(ru)return ss;ru=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 ss=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},ss}var as,iu;function Va(){if(iu)return as;iu=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return as=e,as}var ls,ou;function np(){return ou||(ou=1,ls=Function.call.bind(Object.prototype.hasOwnProperty)),ls}var cs,su;function qE(){if(su)return cs;su=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Va(),n={},r=np();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={})},cs=i,cs}var us,au;function $E(){if(au)return us;au=1;var e=tp(),t=UE(),n=Va(),r=np(),i=qE(),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 us=function(a,l){var c=typeof Symbol=="function"&&Symbol.iterator,u="@@iterator";function d(x){var J=x&&(c&&x[c]||x[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:m(),arrayOf:w,element:C(),elementType:E(),instanceOf:_,node:M(),objectOf:k,oneOf:A,oneOfType:L,shape:j,exact:G};function y(x,J){return x===J?x!==0||1/x===1/J:x!==x&&J!==J}function v(x,J){this.message=x,this.data=J&&typeof J=="object"?J:{},this.stack=""}v.prototype=Error.prototype;function g(x){if(process.env.NODE_ENV!=="production")var J={},B=0;function S(q,X,ie,ne,se,ee,me){if(ne=ne||h,ee=ee||ie,me!==n){if(l){var U=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 U.name="Invariant Violation",U}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ye=ne+":"+ie;!J[ye]&&B<3&&(o("You are manually calling a React.PropTypes validation function for the `"+ee+"` prop on `"+ne+"`. 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[ye]=!0,B++)}}return X[ie]==null?q?X[ie]===null?new v("The "+se+" `"+ee+"` is marked as required "+("in `"+ne+"`, but its value is `null`.")):new v("The "+se+" `"+ee+"` is marked as required in "+("`"+ne+"`, but its value is `undefined`.")):null:x(X,ie,ne,se,ee)}var $=S.bind(null,!1);return $.isRequired=S.bind(null,!0),$}function b(x){function J(B,S,$,q,X,ie){var ne=B[S],se=Y(ne);if(se!==x){var ee=ae(ne);return new v("Invalid "+q+" `"+X+"` of type "+("`"+ee+"` supplied to `"+$+"`, expected ")+("`"+x+"`."),{expectedType:x})}return null}return g(J)}function m(){return g(s)}function w(x){function J(B,S,$,q,X){if(typeof x!="function")return new v("Property `"+X+"` of component `"+$+"` has invalid PropType notation inside arrayOf.");var ie=B[S];if(!Array.isArray(ie)){var ne=Y(ie);return new v("Invalid "+q+" `"+X+"` of type "+("`"+ne+"` supplied to `"+$+"`, expected an array."))}for(var se=0;se<ie.length;se++){var ee=x(ie,se,$,q,X+"["+se+"]",n);if(ee instanceof Error)return ee}return null}return g(J)}function C(){function x(J,B,S,$,q){var X=J[B];if(!a(X)){var ie=Y(X);return new v("Invalid "+$+" `"+q+"` of type "+("`"+ie+"` supplied to `"+S+"`, expected a single ReactElement."))}return null}return g(x)}function E(){function x(J,B,S,$,q){var X=J[B];if(!e.isValidElementType(X)){var ie=Y(X);return new v("Invalid "+$+" `"+q+"` of type "+("`"+ie+"` supplied to `"+S+"`, expected a single ReactElement type."))}return null}return g(x)}function _(x){function J(B,S,$,q,X){if(!(B[S]instanceof x)){var ie=x.name||h,ne=ge(B[S]);return new v("Invalid "+q+" `"+X+"` of type "+("`"+ne+"` supplied to `"+$+"`, expected ")+("instance of `"+ie+"`."))}return null}return g(J)}function A(x){if(!Array.isArray(x))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(B,S,$,q,X){for(var ie=B[S],ne=0;ne<x.length;ne++)if(y(ie,x[ne]))return null;var se=JSON.stringify(x,function(me,U){var ye=ae(U);return ye==="symbol"?String(U):U});return new v("Invalid "+q+" `"+X+"` of value `"+String(ie)+"` "+("supplied to `"+$+"`, expected one of "+se+"."))}return g(J)}function k(x){function J(B,S,$,q,X){if(typeof x!="function")return new v("Property `"+X+"` of component `"+$+"` has invalid PropType notation inside objectOf.");var ie=B[S],ne=Y(ie);if(ne!=="object")return new v("Invalid "+q+" `"+X+"` of type "+("`"+ne+"` supplied to `"+$+"`, expected an object."));for(var se in ie)if(r(ie,se)){var ee=x(ie,se,$,q,X+"."+se,n);if(ee instanceof Error)return ee}return null}return g(J)}function L(x){if(!Array.isArray(x))return process.env.NODE_ENV!=="production"&&o("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var J=0;J<x.length;J++){var B=x[J];if(typeof B!="function")return o("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+pe(B)+" at index "+J+"."),s}function S($,q,X,ie,ne){for(var se=[],ee=0;ee<x.length;ee++){var me=x[ee],U=me($,q,X,ie,ne,n);if(U==null)return null;U.data&&r(U.data,"expectedType")&&se.push(U.data.expectedType)}var ye=se.length>0?", expected one of type ["+se.join(", ")+"]":"";return new v("Invalid "+ie+" `"+ne+"` supplied to "+("`"+X+"`"+ye+"."))}return g(S)}function M(){function x(J,B,S,$,q){return P(J[B])?null:new v("Invalid "+$+" `"+q+"` supplied to "+("`"+S+"`, expected a ReactNode."))}return g(x)}function F(x,J,B,S,$){return new v((x||"React class")+": "+J+" type `"+B+"."+S+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+$+"`.")}function j(x){function J(B,S,$,q,X){var ie=B[S],ne=Y(ie);if(ne!=="object")return new v("Invalid "+q+" `"+X+"` of type `"+ne+"` "+("supplied to `"+$+"`, expected `object`."));for(var se in x){var ee=x[se];if(typeof ee!="function")return F($,q,X,se,ae(ee));var me=ee(ie,se,$,q,X+"."+se,n);if(me)return me}return null}return g(J)}function G(x){function J(B,S,$,q,X){var ie=B[S],ne=Y(ie);if(ne!=="object")return new v("Invalid "+q+" `"+X+"` of type `"+ne+"` "+("supplied to `"+$+"`, expected `object`."));var se=t({},B[S],x);for(var ee in se){var me=x[ee];if(r(x,ee)&&typeof me!="function")return F($,q,X,ee,ae(me));if(!me)return new v("Invalid "+q+" `"+X+"` key `"+ee+"` supplied to `"+$+"`.\nBad object: "+JSON.stringify(B[S],null," ")+`
|
|
21
|
-
Valid keys: `+JSON.stringify(Object.keys(x),null," "));var U=me(ie,ee,$,q,X+"."+ee,n);if(U)return U}return null}return g(J)}function P(x){switch(typeof x){case"number":case"string":case"undefined":return!0;case"boolean":return!x;case"object":if(Array.isArray(x))return x.every(P);if(x===null||a(x))return!0;var J=d(x);if(J){var B=J.call(x),S;if(J!==x.entries){for(;!(S=B.next()).done;)if(!P(S.value))return!1}else for(;!(S=B.next()).done;){var $=S.value;if($&&!P($[1]))return!1}}else return!1;return!0;default:return!1}}function V(x,J){return x==="symbol"?!0:J?J["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&J instanceof Symbol:!1}function Y(x){var J=typeof x;return Array.isArray(x)?"array":x instanceof RegExp?"object":V(J,x)?"symbol":J}function ae(x){if(typeof x>"u"||x===null)return""+x;var J=Y(x);if(J==="object"){if(x instanceof Date)return"date";if(x instanceof RegExp)return"regexp"}return J}function pe(x){var J=ae(x);switch(J){case"array":case"object":return"an "+J;case"boolean":case"date":case"regexp":return"a "+J;default:return J}}function ge(x){return!x.constructor||!x.constructor.name?h:x.constructor.name}return f.checkPropTypes=i,f.resetWarningCache=i.resetWarningCache,f.PropTypes=f,f},us}var ds,lu;function zE(){if(lu)return ds;lu=1;var e=Va();function t(){}function n(){}return n.resetWarningCache=t,ds=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},ds}var cu;function KE(){if(cu)return Li.exports;if(cu=1,process.env.NODE_ENV!=="production"){var e=tp(),t=!0;Li.exports=$E()(e.isElement,t)}else Li.exports=zE()();return Li.exports}var HE=KE();const Q=_r(HE);var Vi={exports:{}},ke={};var uu;function JE(){if(uu)return ke;uu=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 v(g){if(typeof g=="object"&&g!==null){var b=g.$$typeof;switch(b){case e:switch(g=g.type,g){case n:case i:case r:case c:case u:return g;default:switch(g=g&&g.$$typeof,g){case a:case s:case l:case h:case d:case o:return g;default:return b}}case t:return b}}}return ke.ContextConsumer=s,ke.ContextProvider=o,ke.Element=e,ke.ForwardRef=l,ke.Fragment=n,ke.Lazy=h,ke.Memo=d,ke.Portal=t,ke.Profiler=i,ke.StrictMode=r,ke.Suspense=c,ke.SuspenseList=u,ke.isAsyncMode=function(){return!1},ke.isConcurrentMode=function(){return!1},ke.isContextConsumer=function(g){return v(g)===s},ke.isContextProvider=function(g){return v(g)===o},ke.isElement=function(g){return typeof g=="object"&&g!==null&&g.$$typeof===e},ke.isForwardRef=function(g){return v(g)===l},ke.isFragment=function(g){return v(g)===n},ke.isLazy=function(g){return v(g)===h},ke.isMemo=function(g){return v(g)===d},ke.isPortal=function(g){return v(g)===t},ke.isProfiler=function(g){return v(g)===i},ke.isStrictMode=function(g){return v(g)===r},ke.isSuspense=function(g){return v(g)===c},ke.isSuspenseList=function(g){return v(g)===u},ke.isValidElementType=function(g){return typeof g=="string"||typeof g=="function"||g===n||g===i||g===r||g===c||g===u||g===f||typeof g=="object"&&g!==null&&(g.$$typeof===h||g.$$typeof===d||g.$$typeof===o||g.$$typeof===s||g.$$typeof===l||g.$$typeof===y||g.getModuleId!==void 0)},ke.typeOf=v,ke}var Re={};var du;function WE(){return du||(du=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,v=!1,g=!1,b=!1,m=!1,w;w=Symbol.for("react.module.reference");function C(Z){return!!(typeof Z=="string"||typeof Z=="function"||Z===n||Z===i||m||Z===r||Z===c||Z===u||b||Z===f||y||v||g||typeof Z=="object"&&Z!==null&&(Z.$$typeof===h||Z.$$typeof===d||Z.$$typeof===o||Z.$$typeof===s||Z.$$typeof===l||Z.$$typeof===w||Z.getModuleId!==void 0))}function E(Z){if(typeof Z=="object"&&Z!==null){var Be=Z.$$typeof;switch(Be){case e:var Fe=Z.type;switch(Fe){case n:case i:case r:case c:case u:return Fe;default:var Ae=Fe&&Fe.$$typeof;switch(Ae){case a:case s:case l:case h:case d:case o:return Ae;default:return Be}}case t:return Be}}}var _=s,A=o,k=e,L=l,M=n,F=h,j=d,G=t,P=i,V=r,Y=c,ae=u,pe=!1,ge=!1;function x(Z){return pe||(pe=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function J(Z){return ge||(ge=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function B(Z){return E(Z)===s}function S(Z){return E(Z)===o}function $(Z){return typeof Z=="object"&&Z!==null&&Z.$$typeof===e}function q(Z){return E(Z)===l}function X(Z){return E(Z)===n}function ie(Z){return E(Z)===h}function ne(Z){return E(Z)===d}function se(Z){return E(Z)===t}function ee(Z){return E(Z)===i}function me(Z){return E(Z)===r}function U(Z){return E(Z)===c}function ye(Z){return E(Z)===u}Re.ContextConsumer=_,Re.ContextProvider=A,Re.Element=k,Re.ForwardRef=L,Re.Fragment=M,Re.Lazy=F,Re.Memo=j,Re.Portal=G,Re.Profiler=P,Re.StrictMode=V,Re.Suspense=Y,Re.SuspenseList=ae,Re.isAsyncMode=x,Re.isConcurrentMode=J,Re.isContextConsumer=B,Re.isContextProvider=S,Re.isElement=$,Re.isForwardRef=q,Re.isFragment=X,Re.isLazy=ie,Re.isMemo=ne,Re.isPortal=se,Re.isProfiler=ee,Re.isStrictMode=me,Re.isSuspense=U,Re.isSuspenseList=ye,Re.isValidElementType=C,Re.typeOf=E})()),Re}var fu;function QE(){return fu||(fu=1,process.env.NODE_ENV==="production"?Vi.exports=JE():Vi.exports=WE()),Vi.exports}var pu=QE();const hu=e=>typeof e=="object"&&e!=null&&e.nodeType===1,mu=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",fs=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return mu(n.overflowY,t)||mu(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},Ui=(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,GE=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},XE=(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:G=>G!==a;if(!hu(e))throw new TypeError("Invalid target");const u=document.scrollingElement||document.documentElement,d=[];let h=e;for(;hu(h)&&c(h);){if(h=GE(h),h===u){d.push(h);break}h!=null&&h===document.body&&fs(h)&&!fs(document.documentElement)||h!=null&&fs(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:v,scrollY:g}=window,{height:b,width:m,top:w,right:C,bottom:E,left:_}=e.getBoundingClientRect(),{top:A,right:k,left:L}=(G=>{const P=window.getComputedStyle(G);return{top:parseFloat(P.scrollMarginTop)||0,right:parseFloat(P.scrollMarginRight)||0,bottom:parseFloat(P.scrollMarginBottom)||0,left:parseFloat(P.scrollMarginLeft)||0}})(e);let M=w-A,F=s==="center"?_+m/2-L+k:s==="end"?C+k:_-L;const j=[];for(let G=0;G<d.length;G++){const P=d[G],{height:V,width:Y,top:ae,right:pe,bottom:ge,left:x}=P.getBoundingClientRect();if(w>=0&&_>=0&&E<=y&&C<=f&&w>=ae&&E<=ge&&_>=x&&C<=pe)return j;const J=getComputedStyle(P),B=parseInt(J.borderLeftWidth,10),S=parseInt(J.borderTopWidth,10),$=parseInt(J.borderRightWidth,10),q=parseInt(J.borderBottomWidth,10);let X=0,ie=0;const ne="offsetWidth"in P?P.offsetWidth-P.clientWidth-B-$:0,se="offsetHeight"in P?P.offsetHeight-P.clientHeight-S-q:0,ee="offsetWidth"in P?P.offsetWidth===0?0:Y/P.offsetWidth:0,me="offsetHeight"in P?P.offsetHeight===0?0:V/P.offsetHeight:0;if(u===P)X=Ui(g,g+y,y,S,q,g+M,g+M+b,b),ie=s==="start"?F:s==="center"?F-f/2:s==="end"?F-f:Ui(v,v+f,f,B,$,v+F,v+F+m,m),X=Math.max(0,X+g),ie=Math.max(0,ie+v);else{X=Ui(ae,ge,V,S,q+se,M,M+b,b),ie=s==="start"?F-x-B:s==="center"?F-(x+Y/2)+ne/2:s==="end"?F-pe+$+ne:Ui(x,pe,Y,B,$+ne,F,F+m,m);const{scrollLeft:U,scrollTop:ye}=P;X=me===0?0:Math.max(0,Math.min(ye+X/me,P.scrollHeight-V/me+se)),ie=ee===0?0:Math.max(0,Math.min(U+ie/ee,P.scrollWidth-Y/ee+ne)),M+=ye-X,F+=U-ie}j.push({el:P,top:X,left:ie})}return j};var Ir=function(){return Ir=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},Ir.apply(this,arguments)};var YE=0;function gu(e){return typeof e=="function"?e:Pt}function Pt(){}function rp(e,t){if(e){var n=XE(e,{boundary:t});n.forEach(function(r){var i=r.el,o=r.top,s=r.left;i.scrollTop=o,i.scrollLeft=s})}}function yu(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function Ua(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 rt(){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 dr(){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 ip(){return String(YE++)}function ZE(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 vu(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function op(e){return typeof e.type=="string"}function sp(e){return e.props}function e1(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var t1=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function qi(e){e===void 0&&(e={});var t={};return t1.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function lo(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,r){return n[r]=co(t,r)?t[r]:e[r],n},{})}function co(e,t){return e[t]!==void 0}function Ws(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function n1(e){return Object.prototype.toString.call(e)==="[object Object]"}function Hn(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=Sr(a,t<0,n,r,i);return l===-1?e>=o?-1:e:l}function Sr(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?Sr(t?o-1:0,t,n,r):-1}function uo(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(i){return i&&(yu(i,e,n)||r&&yu(i,n.document.activeElement,n))})}var qa=Pt;process.env.NODE_ENV!=="production"&&(qa=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 r1=Ua(function(e){ap(e).textContent=""},500);function ap(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 lp(e,t){if(!(!e||!t)){var n=ap(t);n.textContent=e,r1(t)}}function i1(e){var t=e?.getElementById("a11y-status-message");t&&t.remove()}var cp=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,up=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,dp=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,Ji=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,Wi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,fp=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,pp=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,hp=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,mp=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,gp=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,yp=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,vp=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,bp=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,Qs=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,wp=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,xp=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,Ip=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,o1=Object.freeze({__proto__:null,blurButton:wp,blurInput:yp,changeInput:vp,clickButton:Qs,clickItem:gp,controlledPropUpdatedSelectedItem:xp,itemMouseEnter:dp,keyDownArrowDown:Wi,keyDownArrowUp:Ji,keyDownEnd:mp,keyDownEnter:pp,keyDownEscape:fp,keyDownHome:hp,keyDownSpaceButton:bp,mouseUp:up,touchEnd:Ip,unknown:cp}),s1=["refKey","ref"],a1=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],l1=["onKeyDown","onBlur","onChange","onInput","onChangeText"],c1=["refKey","ref"],u1=["onMouseMove","onMouseDown","onClick","onPress","index","item"],d1=(function(){var e=(function(t){function n(i){var o;o=t.call(this,i)||this,o.id=o.props.id||"downshift-"+ip(),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(m){return o.id+"-item-"+m},o.items=[],o.itemCount=null,o.previousResultCount=0,o.timeoutIds=[],o.internalSetTimeout=function(m,w){var C=setTimeout(function(){o.timeoutIds=o.timeoutIds.filter(function(E){return E!==C}),m()},w);o.timeoutIds.push(C)},o.setItemCount=function(m){o.itemCount=m},o.unsetItemCount=function(){o.itemCount=null},o.isItemDisabled=function(m,w){var C=o.getItemNodeFromIndex(w);return C&&C.hasAttribute("disabled")},o.setHighlightedIndex=function(m,w){m===void 0&&(m=o.props.defaultHighlightedIndex),w===void 0&&(w={}),w=qi(w),o.internalSetState(we({highlightedIndex:m},w))},o.clearSelection=function(m){o.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:o.props.defaultHighlightedIndex,isOpen:o.props.defaultIsOpen},m)},o.selectItem=function(m,w,C){w=qi(w),o.internalSetState(we({isOpen:o.props.defaultIsOpen,highlightedIndex:o.props.defaultHighlightedIndex,selectedItem:m,inputValue:o.props.itemToString(m)},w),C)},o.selectItemAtIndex=function(m,w,C){var E=o.items[m];E!=null&&o.selectItem(E,w,C)},o.selectHighlightedItem=function(m,w){return o.selectItemAtIndex(o.getState().highlightedIndex,m,w)},o.internalSetState=function(m,w){var C,E,_={},A=typeof m=="function";return!A&&m.hasOwnProperty("inputValue")&&o.props.onInputValueChange(m.inputValue,we({},o.getStateAndHelpers(),m)),o.setState(function(k){var L;k=o.getState(k);var M=A?m(k):m;M=o.props.stateReducer(k,M),C=M.hasOwnProperty("selectedItem");var F={};return C&&M.selectedItem!==k.selectedItem&&(E=M.selectedItem),(L=M).type||(L.type=cp),Object.keys(M).forEach(function(j){k[j]!==M[j]&&(_[j]=M[j]),j!=="type"&&(M[j],co(o.props,j)||(F[j]=M[j]))}),A&&M.hasOwnProperty("inputValue")&&o.props.onInputValueChange(M.inputValue,we({},o.getStateAndHelpers(),M)),F},function(){gu(w)();var k=Object.keys(_).length>1;k&&o.props.onStateChange(_,o.getStateAndHelpers()),C&&o.props.onSelect(m.selectedItem,o.getStateAndHelpers()),E!==void 0&&o.props.onChange(E,o.getStateAndHelpers()),o.props.onUserAction(_,o.getStateAndHelpers())})},o.rootRef=function(m){return o._rootNode=m},o.getRootProps=function(m,w){var C,E=m===void 0?{}:m,_=E.refKey,A=_===void 0?"ref":_,k=E.ref,L=gn(E,s1),M=w===void 0?{}:w,F=M.suppressRefError,j=F===void 0?!1:F;o.getRootProps.called=!0,o.getRootProps.refKey=A,o.getRootProps.suppressRefError=j;var G=o.getState(),P=G.isOpen;return we((C={},C[A]=dr(k,o.rootRef),C.role="combobox",C["aria-expanded"]=P,C["aria-haspopup"]="listbox",C["aria-owns"]=P?o.menuId:void 0,C["aria-labelledby"]=o.labelId,C),L)},o.keyDownHandlers={ArrowDown:function(w){var C=this;if(w.preventDefault(),this.getState().isOpen){var E=w.shiftKey?5:1;this.moveHighlightedIndex(E,{type:Wi})}else this.internalSetState({isOpen:!0,type:Wi},function(){var _=C.getItemCount();if(_>0){var A=C.getState(),k=A.highlightedIndex,L=Hn(k,1,{length:_},C.isItemDisabled,!0);C.setHighlightedIndex(L,{type:Wi})}})},ArrowUp:function(w){var C=this;if(w.preventDefault(),this.getState().isOpen){var E=w.shiftKey?-5:-1;this.moveHighlightedIndex(E,{type:Ji})}else this.internalSetState({isOpen:!0,type:Ji},function(){var _=C.getItemCount();if(_>0){var A=C.getState(),k=A.highlightedIndex,L=Hn(k,-1,{length:_},C.isItemDisabled,!0);C.setHighlightedIndex(L,{type:Ji})}})},Enter:function(w){if(w.which!==229){var C=this.getState(),E=C.isOpen,_=C.highlightedIndex;if(E&&_!=null){w.preventDefault();var A=this.items[_],k=this.getItemNodeFromIndex(_);if(A==null||k&&k.hasAttribute("disabled"))return;this.selectHighlightedItem({type:pp})}}},Escape:function(w){w.preventDefault(),this.reset(we({type:fp},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},o.buttonKeyDownHandlers=we({},o.keyDownHandlers,{" ":function(w){w.preventDefault(),this.toggleMenu({type:bp})}}),o.inputKeyDownHandlers=we({},o.keyDownHandlers,{Home:function(w){var C=this.getState(),E=C.isOpen;if(E){w.preventDefault();var _=this.getItemCount();if(!(_<=0||!E)){var A=Sr(0,!1,{length:_},this.isItemDisabled);this.setHighlightedIndex(A,{type:hp})}}},End:function(w){var C=this.getState(),E=C.isOpen;if(E){w.preventDefault();var _=this.getItemCount();if(!(_<=0||!E)){var A=Sr(_-1,!0,{length:_},this.isItemDisabled);this.setHighlightedIndex(A,{type:mp})}}}}),o.getToggleButtonProps=function(m){var w=m===void 0?{}:m,C=w.onClick;w.onPress;var E=w.onKeyDown,_=w.onKeyUp,A=w.onBlur,k=gn(w,a1),L=o.getState(),M=L.isOpen,F={onClick:rt(C,o.buttonHandleClick),onKeyDown:rt(E,o.buttonHandleKeyDown),onKeyUp:rt(_,o.buttonHandleKeyUp),onBlur:rt(A,o.buttonHandleBlur)},j=k.disabled?{}:F;return we({type:"button",role:"button","aria-label":M?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},j,k)},o.buttonHandleKeyUp=function(m){m.preventDefault()},o.buttonHandleKeyDown=function(m){var w=Ws(m);o.buttonKeyDownHandlers[w]&&o.buttonKeyDownHandlers[w].call(o,m)},o.buttonHandleClick=function(m){if(m.preventDefault(),o.props.environment){var w=o.props.environment.document,C=w.body,E=w.activeElement;C&&C===E&&m.target.focus()}process.env.NODE_ENV==="test"?o.toggleMenu({type:Qs}):o.internalSetTimeout(function(){return o.toggleMenu({type:Qs})})},o.buttonHandleBlur=function(m){var w=m.target;o.internalSetTimeout(function(){if(!(o.isMouseDown||!o.props.environment)){var C=o.props.environment.document.activeElement;(C==null||C.id!==o.inputId)&&C!==w&&o.reset({type:wp})}})},o.getLabelProps=function(m){return we({htmlFor:o.inputId,id:o.labelId},m)},o.getInputProps=function(m){var w=m===void 0?{}:m,C=w.onKeyDown,E=w.onBlur,_=w.onChange,A=w.onInput;w.onChangeText;var k=gn(w,l1),L,M={};L="onChange";var F=o.getState(),j=F.inputValue,G=F.isOpen,P=F.highlightedIndex;if(!k.disabled){var V;M=(V={},V[L]=rt(_,A,o.inputHandleChange),V.onKeyDown=rt(C,o.inputHandleKeyDown),V.onBlur=rt(E,o.inputHandleBlur),V)}return we({"aria-autocomplete":"list","aria-activedescendant":G&&typeof P=="number"&&P>=0?o.getItemId(P):void 0,"aria-controls":G?o.menuId:void 0,"aria-labelledby":k&&k["aria-label"]?void 0:o.labelId,autoComplete:"off",value:j,id:o.inputId},M,k)},o.inputHandleKeyDown=function(m){var w=Ws(m);w&&o.inputKeyDownHandlers[w]&&o.inputKeyDownHandlers[w].call(o,m)},o.inputHandleChange=function(m){o.internalSetState({type:vp,isOpen:!0,inputValue:m.target.value,highlightedIndex:o.props.defaultHighlightedIndex})},o.inputHandleBlur=function(){o.internalSetTimeout(function(){var m;if(!(o.isMouseDown||!o.props.environment)){var w=o.props.environment.document.activeElement,C=(w==null||(m=w.dataset)==null?void 0:m.toggle)&&o._rootNode&&o._rootNode.contains(w);C||o.reset({type:yp})}})},o.menuRef=function(m){o._menuNode=m},o.getMenuProps=function(m,w){var C,E=m===void 0?{}:m,_=E.refKey,A=_===void 0?"ref":_,k=E.ref,L=gn(E,c1),M=w===void 0?{}:w,F=M.suppressRefError,j=F===void 0?!1:F;return o.getMenuProps.called=!0,o.getMenuProps.refKey=A,o.getMenuProps.suppressRefError=j,we((C={},C[A]=dr(k,o.menuRef),C.role="listbox",C["aria-labelledby"]=L&&L["aria-label"]?void 0:o.labelId,C.id=o.menuId,C),L)},o.getItemProps=function(m){var w,C=m===void 0?{}:m,E=C.onMouseMove,_=C.onMouseDown,A=C.onClick;C.onPress;var k=C.index,L=C.item,M=L===void 0?process.env.NODE_ENV==="production"?void 0:e1("getItemProps","item"):L,F=gn(C,u1);k===void 0?(o.items.push(M),k=o.items.indexOf(M)):o.items[k]=M;var j="onClick",G=A,P=(w={onMouseMove:rt(E,function(){k!==o.getState().highlightedIndex&&(o.setHighlightedIndex(k,{type:dp}),o.avoidScrolling=!0,o.internalSetTimeout(function(){return o.avoidScrolling=!1},250))}),onMouseDown:rt(_,function(Y){Y.preventDefault()})},w[j]=rt(G,function(){o.selectItemAtIndex(k,{type:gp})}),w),V=F.disabled?{onMouseDown:P.onMouseDown}:P;return we({id:o.getItemId(k),role:"option","aria-selected":o.getState().highlightedIndex===k},V,F)},o.clearItems=function(){o.items=[]},o.reset=function(m,w){m===void 0&&(m={}),m=qi(m),o.internalSetState(function(C){var E=C.selectedItem;return we({isOpen:o.props.defaultIsOpen,highlightedIndex:o.props.defaultHighlightedIndex,inputValue:o.props.itemToString(E)},m)},w)},o.toggleMenu=function(m,w){m===void 0&&(m={}),m=qi(m),o.internalSetState(function(C){var E=C.isOpen;return we({isOpen:!E},E&&{highlightedIndex:o.props.defaultHighlightedIndex},m)},function(){var C=o.getState(),E=C.isOpen,_=C.highlightedIndex;E&&o.getItemCount()>0&&typeof _=="number"&&o.setHighlightedIndex(_,m),gu(w)()})},o.openMenu=function(m){o.internalSetState({isOpen:!0},m)},o.closeMenu=function(m){o.internalSetState({isOpen:!1},m)},o.updateStatus=Ua(function(){var m;if((m=o.props)!=null&&(m=m.environment)!=null&&m.document){var w=o.getState(),C=o.items[w.highlightedIndex],E=o.getItemCount(),_=o.props.getA11yStatusMessage(we({itemToString:o.props.itemToString,previousResultCount:o.previousResultCount,resultCount:E,highlightedItem:C},w));o.previousResultCount=E,lp(_,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,v=s.initialSelectedItem,g=v===void 0?null:v,b=o.getState({highlightedIndex:c,isOpen:h,inputValue:y,selectedItem:g});return b.selectedItem!=null&&o.props.initialInputValue===void 0&&(b.inputValue=o.props.itemToString(b.selectedItem)),o.state=b,o}LE(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),lo(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=Hn(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,v=this.getMenuProps,g=this.getInputProps,b=this.getItemProps,m=this.openMenu,w=this.closeMenu,C=this.toggleMenu,E=this.selectItem,_=this.selectItemAtIndex,A=this.selectHighlightedItem,k=this.setHighlightedIndex,L=this.clearSelection,M=this.clearItems,F=this.reset,j=this.setItemCount,G=this.unsetItemCount,P=this.internalSetState;return{getRootProps:h,getToggleButtonProps:f,getLabelProps:y,getMenuProps:v,getInputProps:g,getItemProps:b,reset:F,openMenu:m,closeMenu:w,toggleMenu:C,selectItem:E,selectItemAtIndex:_,selectHighlightedItem:A,setHighlightedIndex:k,clearSelection:L,clearItems:M,setItemCount:j,unsetItemCount:G,setState:P,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&&bu(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=uo(f.target,[o._rootNode,o._menuNode],o.props.environment);!y&&o.getState().isOpen&&o.reset({type:up},function(){return o.props.onOuterClick(o.getStateAndHelpers())})},l=function(){o.isTouchMove=!1},c=function(){o.isTouchMove=!0},u=function(f){var y=uo(f.target,[o._rootNode,o._menuNode],o.props.environment,!1);!o.isTouchMove&&!y&&o.getState().isOpen&&o.reset({type:Ip},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"&&(qa(this.state,o,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&bu(this._menuNode,this.getMenuProps)),co(this.props,"selectedItem")&&this.props.selectedItemChanged(o.selectedItem,this.props.selectedItem)&&this.internalSetState({type:xp,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=vu(this.props.children,Pt);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=vu(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&&f1(s,this.getRootProps),s;if(op(s))return I.cloneElement(s,this.getRootProps(sp(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:ZE,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&n1(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:Pt,onInputValueChange:Pt,onUserAction:Pt,onChange:Pt,onSelect:Pt,onOuterClick:Pt,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:rp},e.stateChangeTypes=o1,e})();process.env.NODE_ENV!=="production"&&(d1.propTypes={children:Q.func,defaultHighlightedIndex:Q.number,defaultIsOpen:Q.bool,initialHighlightedIndex:Q.number,initialSelectedItem:Q.any,initialInputValue:Q.string,initialIsOpen:Q.bool,getA11yStatusMessage:Q.func,itemToString:Q.func,onChange:Q.func,onSelect:Q.func,onStateChange:Q.func,onInputValueChange:Q.func,onUserAction:Q.func,onOuterClick:Q.func,selectedItemChanged:Q.func,stateReducer:Q.func,itemCount:Q.number,id:Q.string,environment:Q.shape({addEventListener:Q.func.isRequired,removeEventListener:Q.func.isRequired,document:Q.shape({createElement:Q.func.isRequired,getElementById:Q.func.isRequired,activeElement:Q.any.isRequired,body:Q.any.isRequired}).isRequired,Node:Q.func.isRequired}),suppressRefError:Q.bool,scrollIntoView:Q.func,selectedItem:Q.any,isOpen:Q.bool,inputValue:Q.string,highlightedIndex:Q.number,labelId:Q.string,inputId:Q.string,menuId:Q.string,getItemId:Q.func});function bu(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 f1(e,t){var n=t.refKey,r=n!=="ref",i=!op(e);i&&!r&&!pu.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+'"'),!pu.isForwardRef(e)&&!sp(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Sp={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function p1(e,t,n){var r=e.props,i=e.type,o={};Object.keys(t).forEach(function(s){h1(s,e,t,n),n[s]!==t[s]&&(o[s]=n[s])}),r.onStateChange&&Object.keys(o).length&&r.onStateChange(we({type:i},o))}function h1(e,t,n,r){var i=t.props,o=t.type,s="on"+$a(e)+"Change";i[s]&&r[e]!==void 0&&r[e]!==n[e]&&i[s](we({type:o},r))}function m1(e,t){return t.changes}var wu=Ua(function(e,t){lp(e,t)},200),g1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?I.useLayoutEffect:I.useEffect,y1="useId"in I?function(t){var n=t.id,r=t.labelId,i=t.menuId,o=t.getItemId,s=t.toggleButtonId,a=t.inputId,l="downshift-"+I.useId();n||(n=l);var c=I.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-"+ip():n,i=t.labelId,o=t.menuId,s=t.getItemId,a=t.toggleButtonId,l=t.inputId,c=I.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 v1(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 $a(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Cp(e){var t=I.useRef(e);return t.current=e,t}function b1(e,t,n,r){var i=I.useRef(),o=I.useRef(),s=I.useCallback(function(f,y){o.current=y,f=lo(f,y.props);var v=e(f,y),g=y.props.stateReducer(f,we({},y,{changes:v}));return g},[e]),a=I.useReducer(s,t,n),l=a[0],c=a[1],u=Cp(t),d=I.useCallback(function(f){return c(we({props:u.current},f))},[u]),h=o.current;return I.useEffect(function(){var f=lo(i.current,h?.props),y=h&&i.current&&!r(f,l);y&&p1(h,f,l),i.current=l},[l,h,r]),[l,d]}var Xr={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:m1,scrollIntoView:rp,environment:typeof window>"u"?void 0:window};function An(e,t,n){n===void 0&&(n=Sp);var r=e["default"+$a(t)];return r!==void 0?r:n[t]}function Yr(e,t,n){n===void 0&&(n=Sp);var r=e[t];if(r!==void 0)return r;var i=e["initial"+$a(t)];return i!==void 0?i:An(e,t,n)}function w1(e){var t=Yr(e,"selectedItem"),n=Yr(e,"isOpen"),r=O1(e),i=Yr(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 Zr(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 x1(e,t,n){var r=I.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return I.useEffect(function(){if(!e)return Pt;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,uo(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&&!uo(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 Op=function(){return Pt};process.env.NODE_ENV!=="production"&&(Op=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 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=I.useCallback(function(s,a,l,c){i.current[s]={suppressRefError:a,refKey:l,elementRef:c}},[]);return o});function I1(e,t,n,r){r===void 0&&(r={});var i=r.document,o=To();I.useEffect(function(){if(!(!e||o||!i)){var s=e(t);wu(s,i)}},n),I.useEffect(function(){return function(){wu.cancel(),i1(i)}},[i])}function S1(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 g1(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(i(t),o))},[t]),a}var Ep=Pt;process.env.NODE_ENV!=="production"&&(Ep=function(t){var n=t.props,r=t.state,i=I.useRef(n),o=To();I.useEffect(function(){o||(qa(r,i.current,n),i.current=n)},[r,n,o])});function xu(e,t,n){var r;n===void 0&&(n=!0);var i=((r=e.items)==null?void 0:r.length)&&t>=0;return we({isOpen:!1,highlightedIndex:-1},i&&we({selectedItem:e.items[t],isOpen:An(e,"isOpen"),highlightedIndex:An(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function C1(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function To(){var e=I.useRef(!0);return I.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function Gs(e){var t=An(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function O1(e){var t=Yr(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var Qi={environment:Q.shape({addEventListener:Q.func.isRequired,removeEventListener:Q.func.isRequired,document:Q.shape({createElement:Q.func.isRequired,getElementById:Q.func.isRequired,activeElement:Q.any.isRequired,body:Q.any.isRequired}).isRequired,Node:Q.func.isRequired}),itemToString:Q.func,itemToKey:Q.func,stateReducer:Q.func},_p=we({},Qi,{getA11yStatusMessage:Q.func,highlightedIndex:Q.number,defaultHighlightedIndex:Q.number,initialHighlightedIndex:Q.number,isOpen:Q.bool,defaultIsOpen:Q.bool,initialIsOpen:Q.bool,selectedItem:Q.any,initialSelectedItem:Q.any,defaultSelectedItem:Q.any,id:Q.string,labelId:Q.string,menuId:Q.string,getItemId:Q.func,toggleButtonId:Q.string,onSelectedItemChange:Q.func,onHighlightedIndexChange:Q.func,onStateChange:Q.func,onIsOpenChange:Q.func,scrollIntoView:Q.func});function E1(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:Zr(i,e,0)};break;case n.FunctionOpenMenu:o={isOpen:!0,highlightedIndex:Zr(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:An(i,"isOpen"),selectedItem:An(i,"selectedItem"),inputValue:An(i,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return we({},e,o)}Ir(Ir({},_p),{items:Q.array.isRequired,isItemDisabled:Q.func});Ir(Ir({},Xr),{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 za=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,Ka=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,Ha=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,Ja=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,Wa=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,Qa=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,Ga=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,Xa=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,Ya=process.env.NODE_ENV!=="production"?"__input_change__":8,fo=process.env.NODE_ENV!=="production"?"__input_blur__":9,Za=process.env.NODE_ENV!=="production"?"__input_click__":10,Tp=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,Np=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,el=process.env.NODE_ENV!=="production"?"__item_click__":13,kp=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,Rp=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,Ap=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,Fp=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,Pp=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,tl=process.env.NODE_ENV!=="production"?"__function_select_item__":19,Dp=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,Mp=process.env.NODE_ENV!=="production"?"__function_reset__":21,nl=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,jp=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:nl,FunctionCloseMenu:Fp,FunctionOpenMenu:Ap,FunctionReset:Mp,FunctionSelectItem:tl,FunctionSetHighlightedIndex:Pp,FunctionSetInputValue:Dp,FunctionToggleMenu:Rp,InputBlur:fo,InputChange:Ya,InputClick:Za,InputKeyDownArrowDown:za,InputKeyDownArrowUp:Ka,InputKeyDownEnd:Wa,InputKeyDownEnter:Xa,InputKeyDownEscape:Ha,InputKeyDownHome:Ja,InputKeyDownPageDown:Ga,InputKeyDownPageUp:Qa,ItemClick:el,ItemMouseMove:Np,MenuMouseLeave:Tp,ToggleButtonClick:kp});function _1(e){var t=w1(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)),we({},t,{inputValue:r})}var T1=we({},_p,{items:Q.array.isRequired,isItemDisabled:Q.func,inputValue:Q.string,defaultInputValue:Q.string,initialInputValue:Q.string,inputId:Q.string,onInputValueChange:Q.func});function N1(e,t,n,r){var i=I.useRef(),o=b1(e,t,n,r),s=o[0],a=o[1],l=To();return I.useEffect(function(){if(co(t,"selectedItem")){if(!l){var c=t.itemToKey(t.selectedItem)!==t.itemToKey(i.current);c&&a({type:nl,inputValue:t.itemToString(t.selectedItem)})}i.current=s.selectedItem===i.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[lo(s,t),a]}var Lp=Pt;process.env.NODE_ENV!=="production"&&(Lp=function(t,n){Q.checkPropTypes(T1,t,"prop",n.name)});var k1=we({},Xr,{isItemDisabled:function(){return!1}});function R1(e,t){var n,r=t.type,i=t.props,o=t.altKey,s;switch(r){case el:s={isOpen:An(i,"isOpen"),highlightedIndex:Gs(i),selectedItem:i.items[t.index],inputValue:i.itemToString(i.items[t.index])};break;case za:e.isOpen?s={highlightedIndex:Hn(e.highlightedIndex,1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:o&&e.selectedItem==null?-1:Zr(i,e,1),isOpen:i.items.length>=0};break;case Ka:e.isOpen?o?s=xu(i,e.highlightedIndex):s={highlightedIndex:Hn(e.highlightedIndex,-1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:Zr(i,e,-1),isOpen:i.items.length>=0};break;case Xa:s=xu(i,e.highlightedIndex);break;case Ha:s=we({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case Qa:s={highlightedIndex:Hn(e.highlightedIndex,-10,i.items,i.isItemDisabled,!0)};break;case Ga:s={highlightedIndex:Hn(e.highlightedIndex,10,i.items,i.isItemDisabled,!0)};break;case Ja:s={highlightedIndex:Sr(0,!1,i.items,i.isItemDisabled)};break;case Wa:s={highlightedIndex:Sr(i.items.length-1,!0,i.items,i.isItemDisabled)};break;case fo:s=we({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 Ya:s={isOpen:!0,highlightedIndex:Gs(i),inputValue:t.inputValue};break;case Za:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Zr(i,e,0)};break;case tl:s={selectedItem:t.selectedItem,inputValue:i.itemToString(t.selectedItem)};break;case nl:s={inputValue:t.inputValue};break;default:return E1(e,t,jp)}return we({},e,s)}var A1=["onMouseLeave","refKey","ref"],F1=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],P1=["onClick","onPress","refKey","ref"],D1=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];rl.stateChangeTypes=jp;function rl(e){e===void 0&&(e={}),Lp(e,rl);var t=we({},k1,e),n=t.items,r=t.scrollIntoView,i=t.environment,o=t.getA11yStatusMessage,s=N1(R1,t,_1,C1),a=s[0],l=s[1],c=a.isOpen,u=a.highlightedIndex,d=a.selectedItem,h=a.inputValue,f=I.useRef(null),y=I.useRef({}),v=I.useRef(null),g=I.useRef(null),b=To(),m=y1(t),w=I.useRef(),C=Cp({state:a,props:t}),E=I.useCallback(function(B){return y.current[m.getItemId(B)]},[m]);I1(o,a,[c,u,d,h],i);var _=S1({menuElement:f.current,highlightedIndex:u,isOpen:c,itemRefs:y,scrollIntoView:r,getItemNodeFromIndex:E});Ep({props:t,state:a}),I.useEffect(function(){var B=Yr(t,"isOpen");B&&v.current&&v.current.focus()},[]),I.useEffect(function(){b||(w.current=n.length)});var A=x1(i,I.useCallback(function(){C.current.state.isOpen&&l({type:fo,selectItem:!1})},[l,C]),I.useMemo(function(){return[f,g,v]},[f.current,g.current,v.current])),k=Op("getInputProps","getMenuProps");I.useEffect(function(){c||(y.current={})},[c]),I.useEffect(function(){var B;!c||!(i!=null&&i.document)||!(v!=null&&(B=v.current)!=null&&B.focus)||i.document.activeElement!==v.current&&v.current.focus()},[c,i]);var L=I.useMemo(function(){return{ArrowDown:function(S){S.preventDefault(),l({type:za,altKey:S.altKey})},ArrowUp:function(S){S.preventDefault(),l({type:Ka,altKey:S.altKey})},Home:function(S){C.current.state.isOpen&&(S.preventDefault(),l({type:Ja}))},End:function(S){C.current.state.isOpen&&(S.preventDefault(),l({type:Wa}))},Escape:function(S){var $=C.current.state;($.isOpen||$.inputValue||$.selectedItem||$.highlightedIndex>-1)&&(S.preventDefault(),l({type:Ha}))},Enter:function(S){var $=C.current.state;!$.isOpen||S.which===229||(S.preventDefault(),l({type:Xa}))},PageUp:function(S){C.current.state.isOpen&&(S.preventDefault(),l({type:Qa}))},PageDown:function(S){C.current.state.isOpen&&(S.preventDefault(),l({type:Ga}))}}},[l,C]),M=I.useCallback(function(B){return we({id:m.labelId,htmlFor:m.inputId},B)},[m]),F=I.useCallback(function(B,S){var $,q=B===void 0?{}:B,X=q.onMouseLeave,ie=q.refKey,ne=ie===void 0?"ref":ie,se=q.ref,ee=gn(q,A1),me=S===void 0?{}:S,U=me.suppressRefError,ye=U===void 0?!1:U;return k("getMenuProps",ye,ne,f),we(($={},$[ne]=dr(se,function(Z){f.current=Z}),$.id=m.menuId,$.role="listbox",$["aria-labelledby"]=ee&&ee["aria-label"]?void 0:""+m.labelId,$.onMouseLeave=rt(X,function(){l({type:Tp})}),$),ee)},[l,k,m]),j=I.useCallback(function(B){var S,$,q=B===void 0?{}:B,X=q.item,ie=q.index,ne=q.refKey,se=ne===void 0?"ref":ne,ee=q.ref,me=q.onMouseMove,U=q.onMouseDown,ye=q.onClick;q.onPress;var Z=q.disabled,Be=gn(q,F1);Z!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var Fe=C.current,Ae=Fe.props,We=Fe.state,et=v1(X,ie,Ae.items,"Pass either item or index to getItemProps!"),tt=et[0],xe=et[1],ot=Ae.isItemDisabled(tt,xe),bt="onClick",at=ye,Ge=function(){A.isTouchEnd||xe===We.highlightedIndex||(_.current=!1,l({type:Np,index:xe,disabled:ot}))},D=function(){l({type:el,index:xe})},K=function(re){return re.preventDefault()};return we((S={},S[se]=dr(ee,function(R){R&&(y.current[m.getItemId(xe)]=R)}),S["aria-disabled"]=ot,S["aria-selected"]=xe===We.highlightedIndex,S.id=m.getItemId(xe),S.role="option",S),!ot&&($={},$[bt]=rt(at,D),$),{onMouseMove:rt(me,Ge),onMouseDown:rt(U,K)},Be)},[l,m,C,A,_]),G=I.useCallback(function(B){var S,$=B===void 0?{}:B,q=$.onClick;$.onPress;var X=$.refKey,ie=X===void 0?"ref":X,ne=$.ref,se=gn($,P1),ee=C.current.state,me=function(){l({type:kp})};return we((S={},S[ie]=dr(ne,function(U){g.current=U}),S["aria-controls"]=m.menuId,S["aria-expanded"]=ee.isOpen,S.id=m.toggleButtonId,S.tabIndex=-1,S),!se.disabled&&we({},{onClick:rt(q,me)}),se)},[l,C,m]),P=I.useCallback(function(B,S){var $,q=B===void 0?{}:B,X=q.onKeyDown,ie=q.onChange,ne=q.onInput,se=q.onBlur;q.onChangeText;var ee=q.onClick,me=q.refKey,U=me===void 0?"ref":me,ye=q.ref,Z=gn(q,D1),Be=S===void 0?{}:S,Fe=Be.suppressRefError,Ae=Fe===void 0?!1:Fe;k("getInputProps",Ae,U,v);var We=C.current.state,et=function(K){var R=Ws(K);R&&L[R]&&L[R](K)},tt=function(K){l({type:Ya,inputValue:K.target.value})},xe=function(K){if(i!=null&&i.document&&We.isOpen&&!A.isMouseDown){var R=K.relatedTarget===null&&i.document.activeElement!==i.document.body;l({type:fo,selectItem:!R})}},ot=function(){l({type:Za})},bt="onChange",at={};if(!Z.disabled){var Ge;at=(Ge={},Ge[bt]=rt(ie,ne,tt),Ge.onKeyDown=rt(X,et),Ge.onBlur=rt(se,xe),Ge.onClick=rt(ee,ot),Ge)}return we(($={},$[U]=dr(ye,function(D){v.current=D}),$["aria-activedescendant"]=We.isOpen&&We.highlightedIndex>-1?m.getItemId(We.highlightedIndex):"",$["aria-autocomplete"]="list",$["aria-controls"]=m.menuId,$["aria-expanded"]=We.isOpen,$["aria-labelledby"]=Z&&Z["aria-label"]?void 0:m.labelId,$.autoComplete="off",$.id=m.inputId,$.role="combobox",$.value=We.inputValue,$),at,Z)},[l,m,i,L,C,A,k]),V=I.useCallback(function(){l({type:Rp})},[l]),Y=I.useCallback(function(){l({type:Fp})},[l]),ae=I.useCallback(function(){l({type:Ap})},[l]),pe=I.useCallback(function(B){l({type:Pp,highlightedIndex:B})},[l]),ge=I.useCallback(function(B){l({type:tl,selectedItem:B})},[l]),x=I.useCallback(function(B){l({type:Dp,inputValue:B})},[l]),J=I.useCallback(function(){l({type:Mp})},[l]);return{getItemProps:j,getLabelProps:M,getMenuProps:F,getInputProps:P,getToggleButtonProps:G,toggleMenu:V,openMenu:ae,closeMenu:Y,setHighlightedIndex:pe,setInputValue:x,selectItem:ge,reset:J,highlightedIndex:u,isOpen:c,selectedItem:d,inputValue:h}}Qi.stateReducer,Qi.itemToKey,Qi.environment,Q.array,Q.array,Q.array,Q.func,Q.number,Q.number,Q.number,Q.func,Q.func,Q.string,Q.string;Xr.itemToKey,Xr.stateReducer,Xr.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 M1="_comboboxContainer_1lcc8_1",j1="_inputContainer_1lcc8_12",L1="_input_1lcc8_12",B1="_toggleButton_1lcc8_33",V1="_menu_1lcc8_39",U1="_menuBottom_1lcc8_55",q1="_menuTop_1lcc8_61",$1="_menuItem_1lcc8_66",z1="_highlighted_1lcc8_73",K1="_selected_1lcc8_77",H1="_hidden_1lcc8_81",Yt={comboboxContainer:M1,inputContainer:j1,input:L1,toggleButton:B1,menu:V1,menuBottom:U1,menuTop:q1,menuItem:$1,highlighted:z1,selected:K1,hidden:H1};function J1(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function Bp({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:i,style:o,menuPosition:s="bottom"}){const[a,l]=I.useState(e),c=I.useRef(null);I.useEffect(()=>l(e),[e]);const u=I.useCallback(_=>{_?.length>0?l(e.filter(J1(_))):l(e)},[e]),{isOpen:d,getToggleButtonProps:h,getMenuProps:f,getInputProps:y,highlightedIndex:v,getItemProps:g,setInputValue:b}=rl({items:a,selectedItem:t?e.find(_=>_.value===t):null,itemToString:_=>_?.label||"",onInputValueChange:({inputValue:_})=>u(_),onSelectedItemChange:({selectedItem:_})=>{n(_),c.current?.blur()}}),m=()=>{b(""),l(e)},w=()=>m(),C=I.useMemo(()=>e.find(_=>_.value===t)?.label,[e,t]),E=()=>{b(t&&C?C:"")};return p.jsxs("div",{style:{position:"relative",...o},children:[p.jsx("div",{className:Yt.comboboxContainer,children:p.jsxs("div",{className:Yt.inputContainer,children:[p.jsx("input",{style:{border:"none"},disabled:i,placeholder:r,className:Yt.input,...y({onFocus:w,onBlur:E,ref:c})}),p.jsx("button",{style:{border:"none"},disabled:i,"aria-label":"toggle menu",className:Yt.toggleButton,type:"button",...h(),children:d?p.jsx(p.Fragment,{children:"↑"}):p.jsx(p.Fragment,{children:"↓"})})]})}),p.jsx("ul",{className:`${Yt.menu} ${d&&e.length?"":Yt.hidden} ${s==="top"?Yt.menuTop:Yt.menuBottom}`,...f(),children:d&&a.map((_,A)=>p.jsx("li",{className:`${Yt.menuItem} ${v===A?Yt.highlighted:""} ${t===_?.value?Yt.selected:""}`,...g({item:_,index:A}),children:p.jsx("span",{children:_.label})},_.id))})]})}function W1(e,t){const n=e?.read?.selectedFieldMappings||{};t.forEach(r=>{const{field:i,value:o}=r;if(o===null){const s=n[i];delete n[i],s&&e?.read?.selectedValueMappings&&e.read.selectedValueMappings[s]&&delete e.read.selectedValueMappings[s]}else{const s=n[i];n[i]=o,s&&s!==o&&e?.read?.selectedValueMappings&&e.read.selectedValueMappings[s]&&delete e.read.selectedValueMappings[s]}})}function ai(e,t,n){t(e,r=>W1(r,n))}const Q1="Each field must be mapped to a unique value";function il({field:e,onSelectChange:t,allFields:n}){const{configureState:r,selectedObjectName:i,setConfigureState:o}=Bt(),[s,a]=I.useState(!0),{isError:l,removeError:c,getError:u}=un(),h=r?.read?.selectedFieldMappings?.[e.mapToName];I.useEffect(()=>{e._default&&!h&&i&&r&&ai(i,o,[{field:e.mapToName,value:e._default}]),a(!1)},[e,o,i,h,r]);const f=I.useMemo(()=>n.map(m=>({id:m.fieldName,label:m.displayName,value:m.fieldName})),[n]),y=p.jsx(Bp,{disabled:s,items:f,selectedValue:h||null,onSelectedItemChange:m=>{t({target:{name:e.mapToName,value:m?.value}})},placeholder:"Please select one",style:{width:"100%"}}),v=I.useCallback(()=>{i&&(ai(i,o,[{field:e.mapToName,value:null}]),l(Ie.MAPPING,i)&&c(Ie.MAPPING,i))},[e.mapToName,i,o,l,c]),{hasDuplicationError:g,errorMessage:b}=I.useMemo(()=>{const m=u(Ie.MAPPING,i),w=Array.isArray(m)&&m.length>0&&m.includes(e.mapToName);return{hasDuplicationError:w,errorMessage:w?Q1:""}},[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?.prompt&&p.jsx($f,{id:`tooltip-id-${e?.prompt}`,tooltipText:e?.prompt})})]}),p.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[y,p.jsx(Je,{type:"button",variant:"ghost",onClick:v,children:"Clear"})]})]},e.mapToName),g&&p.jsxs("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:[" ",b," "]},e.mapToName)]})}const G1="_formControl_9qd8d_1",X1="_formLabel_9qd8d_5",Y1="_formLabelRequired_9qd8d_11",Z1="_formInput_9qd8d_16",e_="_formInputInvalid_9qd8d_20",t_="_formError_9qd8d_24",n_="_disabled_9qd8d_30",$n={formControl:G1,formLabel:X1,formLabelRequired:Y1,formInput:Z1,formInputInvalid:e_,formError:t_,disabled:n_};function No({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:i=!1,errorMessage:o,children:s}){return p.jsxs("div",{className:Jt($n.formControl,{[$n.disabled]:r}),children:[t&&p.jsx("label",{htmlFor:e,className:Jt($n.formLabel,{[$n.formLabelRequired]:n}),children:t}),p.jsx("div",{id:e,className:Jt($n.formInput,{[$n.formInputInvalid]:i}),children:s}),i&&o&&p.jsx("div",{className:$n.formError,role:"alert",children:o})]})}function Vp({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(Ie.MAPPING,t,a),!0}return!1}function r_({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(No,{id:r.mapToName,children:p.jsx(il,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function i_(){const{selectedObjectName:e,configureState:t,setConfigureState:n}=Bt(),{isError:r,removeError:i,setError:o}=un(),s=t?.read?.allFields||[],{fieldMapping:a}=gt(),l=t?.read?.selectedFieldMappings,c=y=>{const{value:v,name:g}=y.target;!v||Vp({selectedFieldMappings:l,selectedObjectName:e,fieldName:g,fieldValue:v,setError:o})||(e&&ai(e,n,[{field:g,value:v}]),r(Ie.MAPPING,g)&&i(Ie.MAPPING,g),e&&r(Ie.MAPPING,e)&&i(Ie.MAPPING,e))},u=I.useMemo(()=>!e||!a?[]:Object.values(a[e]||{}).flat().filter(y=>!y.fieldName),[a,e]),d=I.useMemo(()=>(t?.read?.optionalMapFields||[]).filter(g=>!u.some(b=>b.mapToName===g.mapToName)),[t,u]),h=u.length>0;return d.length>0||h?p.jsxs(p.Fragment,{children:[p.jsx(Lt,{string:"Map the following optional fields"}),p.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:[d?.map(y=>p.jsx(No,{id:y.mapToName,children:p.jsx(il,{allFields:s,field:y,onSelectChange:c})},y.mapToName)),h&&p.jsx(r_,{dynamicFieldMappings:u,onSelectChange:c,allFields:s})]})]}):null}function o_(){const{selectedObjectName:e,configureState:t,setConfigureState:n}=Bt(),{isError:r,removeError:i,setError:o}=un(),s=t?.read?.selectedFieldMappings,a=c=>{const{value:u,name:d}=c.target;!u||Vp({selectedFieldMappings:s,selectedObjectName:e,fieldName:d,fieldValue:u,setError:o})||(e&&ai(e,n,[{field:d,value:u}]),r(Ie.MAPPING,d)&&i(Ie.MAPPING,d),e&&r(Ie.MAPPING,e)&&i(Ie.MAPPING,e))},l=I.useMemo(()=>t?.read?.requiredMapFields||[],[t]);return l?.length?p.jsxs(p.Fragment,{children:[p.jsx(Lt,{string:"Map the following fields"}),p.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:l.map(c=>p.jsx(No,{id:c.mapToName,isInvalid:r(Ie.MAPPING,c.mapToName),errorMessage:"* required",children:p.jsx(il,{allFields:t?.read?.allFields||[],field:c,onSelectChange:a})},c.mapToName))})]}):null}const s_=(e,t)=>e.filter(n=>!t.has(n));function a_(){const{selectedObjectName:e,configureState:t,setConfigureState:n}=Bt(),{fieldMapping:r}=gt(),i=t?.read?.selectedFieldMappings||{},o=Object.keys(i),s=t?.read?.requiredMapFields||[],a=t?.read?.optionalMapFields||[],l=e&&r?Object.values(r[e]||{}).flat().filter(h=>!h.fieldName):[],c=s.concat(l,a).map(h=>h.mapToName),u=new Set(c),d=s_(o,u);I.useEffect(()=>{e&&d.length&&ai(e,n,d.map(h=>({field:h,value:null})))},[e,n,d])}const l_={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function Up({children:e,style:t}){return p.jsx(bn,{style:{...l_,...t},children:e})}function c_(){const{data:e}=Mn(),{hydratedRevision:t}=or(),{selectedObjectName:n}=Bt(),{providerName:r}=yt(),i=e?.appName,o=t?.content?.read?.objects?.find(c=>c.objectName===n),s=o?.displayName||n&&Wt(n),a=o?.mapToName,l=o?.mapToDisplayName||a&&Wt(a);return l&&i&&r?p.jsx(Up,{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 Iu(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function qp(...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 Cr(...e){return H.useCallback(qp(...e),e)}function ko(e,t=[]){let n=[];function r(o,s){const a=H.createContext(s),l=n.length;n=[...n,s];const c=d=>{const{scope:h,children:f,...y}=d,v=h?.[e]?.[l]||a,g=H.useMemo(()=>y,Object.values(y));return p.jsx(v.Provider,{value:g,children:f})};c.displayName=o+"Provider";function u(d,h){const f=h?.[e]?.[l]||a,y=H.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=>H.createContext(s));return function(a){const l=a?.[e]||o;return H.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,u_(i,...t)]}function u_(...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 H.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Zt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e?.(i),n===!1||!i.defaultPrevented)return t?.(i)}}var li=globalThis?.document?H.useLayoutEffect:()=>{},d_=H[" useInsertionEffect ".trim().toString()]||li;function ol({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,o,s]=f_({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:i;{const u=H.useRef(e!==void 0);H.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=H.useCallback(u=>{if(a){const d=p_(u)?u(e):u;d!==e&&s.current?.(d)}else o(u)},[a,e,o,s]);return[l,c]}function f_({defaultProp:e,onChange:t}){const[n,r]=H.useState(e),i=H.useRef(n),o=H.useRef(t);return d_(()=>{o.current=t},[t]),H.useEffect(()=>{i.current!==n&&(o.current?.(n),i.current=n)},[n,i]),[n,r,o]}function p_(e){return typeof e=="function"}function h_(e){const t=H.useRef({value:e,previous:e});return H.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function m_(e){const[t,n]=H.useState(void 0);return li(()=>{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 g_(e,t){return H.useReducer((n,r)=>t[n][r]??n,e)}var sl=e=>{const{present:t,children:n}=e,r=y_(t),i=typeof n=="function"?n({present:r.isPresent}):H.Children.only(n),o=Cr(r.ref,v_(i));return typeof n=="function"||r.isPresent?H.cloneElement(i,{ref:o}):null};sl.displayName="Presence";function y_(e){const[t,n]=H.useState(),r=H.useRef(null),i=H.useRef(e),o=H.useRef("none"),s=e?"mounted":"unmounted",[a,l]=g_(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return H.useEffect(()=>{const c=$i(r.current);o.current=a==="mounted"?c:"none"},[a]),li(()=>{const c=r.current,u=i.current;if(u!==e){const h=o.current,f=$i(c);e?l("MOUNT"):f==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),li(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,d=f=>{const v=$i(r.current).includes(CSS.escape(f.animationName));if(f.target===t&&v&&(l("ANIMATION_END"),!i.current)){const g=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=g)})}},h=f=>{f.target===t&&(o.current=$i(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:H.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function $i(e){return e?.animationName||"none"}function v_(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Xs(e){const t=b_(e),n=H.forwardRef((r,i)=>{const{children:o,...s}=r,a=H.Children.toArray(o),l=a.find(x_);if(l){const c=l.props.children,u=a.map(d=>d===l?H.Children.count(c)>1?H.Children.only(null):H.isValidElement(c)?c.props.children:null:d);return p.jsx(t,{...s,ref:i,children:H.isValidElement(c)?H.cloneElement(c,void 0,u):null})}return p.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function b_(e){const t=H.forwardRef((n,r)=>{const{children:i,...o}=n;if(H.isValidElement(i)){const s=S_(i),a=I_(o,i.props);return i.type!==H.Fragment&&(a.ref=r?qp(r,s):s),H.cloneElement(i,a)}return H.Children.count(i)>1?H.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var w_=Symbol("radix.slottable");function x_(e){return H.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===w_}function I_(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 S_(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var C_=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],xn=C_.reduce((e,t)=>{const n=Xs(`Primitive.${t}`),r=H.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}},{}),Ro="Checkbox",[O_]=ko(Ro),[E_,al]=O_(Ro);function __(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]=ol({prop:n,defaultProp:i??!1,onChange:l,caller:Ro}),[y,v]=H.useState(null),[g,b]=H.useState(null),m=H.useRef(!1),w=y?!!s||!!y.closest("form"):!0,C={checked:h,disabled:o,setChecked:f,control:y,setControl:v,name:a,form:s,value:u,hasConsumerStoppedPropagationRef:m,required:c,defaultChecked:Fn(i)?!1:i,isFormControl:w,bubbleInput:g,setBubbleInput:b};return p.jsx(E_,{scope:t,...C,children:T_(d)?d(C):r})}var $p="CheckboxTrigger",zp=H.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}=al($p,e),v=Cr(i,u),g=H.useRef(l);return H.useEffect(()=>{const b=o?.form;if(b){const m=()=>d(g.current);return b.addEventListener("reset",m),()=>b.removeEventListener("reset",m)}},[o,d]),p.jsx(xn.button,{type:"button",role:"checkbox","aria-checked":Fn(l)?"mixed":l,"aria-required":c,"data-state":Wp(l),"data-disabled":a?"":void 0,disabled:a,value:s,...r,ref:v,onKeyDown:Zt(t,b=>{b.key==="Enter"&&b.preventDefault()}),onClick:Zt(n,b=>{d(m=>Fn(m)?!0:!m),y&&f&&(h.current=b.isPropagationStopped(),h.current||b.stopPropagation())})})});zp.displayName=$p;var ll=H.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(__,{__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(zp,{...d,ref:t,__scopeCheckbox:n}),h&&p.jsx(Jp,{__scopeCheckbox:n})]})})});ll.displayName=Ro;var Kp="CheckboxIndicator",cl=H.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,o=al(Kp,n);return p.jsx(sl,{present:r||Fn(o.checked)||o.checked===!0,children:p.jsx(xn.span,{"data-state":Wp(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});cl.displayName=Kp;var Hp="CheckboxBubbleInput",Jp=H.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}=al(Hp,e),y=Cr(n,f),v=h_(o),g=m_(r);H.useEffect(()=>{const m=h;if(!m)return;const w=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(w,"checked").set,_=!i.current;if(v!==o&&E){const A=new Event("click",{bubbles:_});m.indeterminate=Fn(o),E.call(m,Fn(o)?!1:o),m.dispatchEvent(A)}},[h,v,o,i]);const b=H.useRef(Fn(o)?!1:o);return p.jsx(xn.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,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Jp.displayName=Hp;function T_(e){return typeof e=="function"}function Fn(e){return e==="indeterminate"}function Wp(e){return Fn(e)?"indeterminate":e?"checked":"unchecked"}function ul(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 N_=["color"],Qp=I.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=ul(e,N_);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"}))}),k_=["color"],R_=I.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=ul(e,k_);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"}))}),A_=["color"],Gp=I.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=ul(e,A_);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 F_="_checkboxGroupContainer_hqfeu_1",P_="_stack_hqfeu_6",D_="_selectAllContainer_hqfeu_10",M_="_fieldContainer_hqfeu_17",j_="_checkbox_hqfeu_1",Or={checkboxGroupContainer:F_,stack:P_,selectAllContainer:D_,fieldContainer:M_,checkbox:j_};function L_({id:e,isChecked:t,label:n,onCheckedChange:r}){return p.jsxs("div",{className:Or.fieldContainer,children:[p.jsx(ll,{className:Or.checkbox,id:e,onCheckedChange:r,checked:t,children:p.jsx(cl,{children:p.jsx(Qp,{})})}),p.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function B_({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:i}){return p.jsxs("div",{className:Or.selectAllContainer,children:[p.jsx(ll,{className:Or.checkbox,id:e,onCheckedChange:r,checked:i?"indeterminate":t,children:p.jsxs(cl,{children:[i&&p.jsx(R_,{}),t===!0&&p.jsx(Qp,{})]})}),p.jsx("label",{htmlFor:e,children:n})]})}function V_({children:e}){return p.jsx("div",{className:Or.checkboxGroupContainer,children:e})}function U_({children:e}){return p.jsx("div",{className:Or.stack,children:e})}const q_="_paginationContainer_1p51x_1",$_="_pageInfo_1p51x_7",z_="_searchContainer_1p51x_13",K_="_searchInput_1p51x_17",H_="_noResults_1p51x_21",$r={paginationContainer:q_,pageInfo:$_,searchContainer:z_,searchInput:K_,noResults:H_};function Xp({items:e,onItemChange:t,itemsPerPage:n=8,showSelectAll:r=!0,showSearch:i=!0,searchPlaceholder:o="Search fields...",itemName:s="fields"}){const[a,l]=I.useState(1),[c,u]=I.useState(""),d=e.filter(C=>C.label.toLowerCase().includes(c.toLowerCase())),h=Math.ceil(d.length/n),f=(a-1)*n,y=f+n,v=d.slice(f,y),g=C=>{u(C),l(1)},b=C=>{d.forEach(E=>{t(E.id,C)})},m=d.length>0&&d.every(C=>C.isChecked),w=d.some(C=>C.isChecked);return p.jsxs(V_,{children:[i&&p.jsx("div",{className:$r.searchContainer,children:p.jsx(Wd,{id:"field-search",type:"text",placeholder:o,value:c,onChange:C=>g(C.target.value),className:$r.searchInput})}),r&&e.length>=2&&p.jsx(B_,{id:"select-all-fields",isChecked:m,label:`Select all ${d.length} ${c?"matching ":""}${s}`,onCheckedChange:b,isIndeterminate:w&&!m}),p.jsx(U_,{children:v.map(C=>p.jsx(L_,{id:C.id,isChecked:C.isChecked,label:C.label,onCheckedChange:E=>t(C.id,E===!0)},C.id))}),h>1&&p.jsxs("div",{className:$r.paginationContainer,children:[p.jsx(Je,{type:"button",onClick:()=>l(C=>Math.max(1,C-1)),disabled:a===1,variant:"ghost",children:"<"}),p.jsxs("span",{className:$r.pageInfo,children:[a," of ",h]}),p.jsx(Je,{type:"button",onClick:()=>l(C=>Math.min(h,C+1)),disabled:a===h,variant:"ghost",children:">"})]}),d.length===0&&c&&p.jsxs("div",{className:$r.noResults,children:["No ",s,' found matching "',c,'"']})]})}function J_(e,t,n){const r=e?.read?.selectedOptionalFields||{};r[t]=n,n||delete r[t]}function W_(e,t,n,r){t(e,i=>J_(i,n,r))}function Q_(){const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=Bt(),i=t?.read?.selectedOptionalFields,o=t?.read?.optionalFields,s=(c,u)=>{r&&t&&W_(r,n,c,u)},a=I.useMemo(()=>o?.filter(c=>!kr(c)&&"fieldName"in c&&"displayName"in c).map(c=>({id:c.fieldName,label:c.displayName,isChecked:!!i?.[c.fieldName]})).sort((c,u)=>c.label.localeCompare(u.label))||[],[o,i]);return!!(o&&o.length>0)&&p.jsxs(p.Fragment,{children:[p.jsx(Lt,{string:`${e} reads the following optional fields`}),p.jsx(Xp,{items:a,onItemChange:s,showSelectAll:a.length>=2},`${r}-${o?.length}`)]})}function G_(){return p.jsx(Q_,{})}function X_(){const{installation:e}=dn(),{selectedObjectName:t}=Bt(),{displayName:n}=Zf(),{toggleReadingObject:r,isPending:i}=ep(),o=t?e?.config?.content?.read?.objects?.[t]:void 0;if(!o)return null;if(!o.disabled)return p.jsx(yi,{children:p.jsxs("p",{children:["Reading from ",n," is enabled."]})});const a=()=>{t&&r({objectName:t,disabled:!1,onError:l=>{console.error("Error re-enabling read object:",l)}})};return p.jsx(p.Fragment,{children:p.jsxs(Up,{style:{backgroundColor:"var(--amp-colors-status-critical-muted)"},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[p.jsx(Gp,{style:{width:"16px",height:"16px",flexShrink:0}}),p.jsx("span",{style:{fontWeight:600},children:"Reading is currently disabled"})]}),p.jsxs("p",{style:{marginTop:"0.5rem",fontSize:"0.875rem"},children:["This object is not being synced. Click below to re-enable reading from"," ",p.jsx("b",{children:n}),"."]}),p.jsx(Je,{type:"button",onClick:a,variant:"ghost",style:{marginTop:"1rem",width:"100%"},disabled:i,children:i?"Re-enabling...":`Re-enable reading from ${n}`})]})})}const Y_={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 Z_({children:e,style:t,...n}){return p.jsx("span",{style:{...Y_,...t},...n,children:e})}const eT="_errorAlert_1tcao_1",tT="_errorHeader_1tcao_11",nT="_errorIcon_1tcao_17",rT="_errorTitle_1tcao_24",iT="_errorMessage_1tcao_30",zr={errorAlert:eT,errorHeader:tT,errorIcon:nT,errorTitle:rT,errorMessage:iT};function oT({error:e}){return p.jsxs("div",{className:zr.errorAlert,children:[p.jsxs("div",{className:zr.errorHeader,children:[p.jsx(Gp,{className:zr.errorIcon}),p.jsx("span",{className:zr.errorTitle,children:"Unable to load object"})]}),p.jsx("div",{className:zr.errorMessage,children:e})]})}function sT(){const{data:e}=bo(),{selectedObjectName:t}=Bt(),{appName:n}=Mn(),r=e?.content?.read?.objects?.find(s=>s.objectName===t),i=r?.error,o=r?.requiredFields;return i?p.jsx(oT,{error:i}):p.jsxs(p.Fragment,{children:[p.jsx(Lt,{string:`${n} reads the following fields`}),p.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:o?.length?o.map(s=>kr(s)?null:p.jsx(Z_,{children:s.displayName},s.fieldName)):"There are no required fields."})]})}function aT(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 Yp(e,t,n,r,i){t(e,o=>aT(o,e,n,r,i))}function ps(e){return e.mapToDisplayName||e.mapToName||e.fieldName||""}function lT(e,t){if(!e.fieldName)return{isValid:!1,errorMessage:"Field name is missing"};const n=t?.valueType;if(!["singleSelect","multiSelect"].includes(n||""))return{isValid:!1,errorMessage:"fieldName is not a singleSelect or multiSelect"};const r=t?.values;if(!r)return{isValid:!1,errorMessage:"Field values array is missing"};const i=Object.keys(r).length,o=Object.keys(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 cT(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 uT({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(_o,{style:{width:"100%",marginLeft:"1rem"}})})]})}function dT({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r}){const{configureState:i,selectedObjectName:o,setConfigureState:s}=Bt(),a=I.useMemo(()=>i?.read?.selectedValueMappings?.[n]||{},[i?.read?.selectedValueMappings,n]),l=I.useMemo(()=>a?.[e.mappedValue],[a,e.mappedValue]),c=I.useMemo(()=>r.map(f=>({id:f.value,label:f.displayValue,value:f.value})),[r]),u=I.useCallback(f=>{f&&t({target:{name:e.mappedValue,value:f.value,fieldName:n}})},[t,n,e.mappedValue]),d=I.useMemo(()=>p.jsx(Bp,{items:c,selectedValue:l||null,onSelectedItemChange:u,placeholder:"Please select one",style:{borderRadius:"8px",width:"100%"}},l),[l,c,u]),h=I.useCallback(()=>{o&&Yp(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(Je,{type:"button",variant:"ghost",onClick:h,children:"Clear"})]})]},e.mappedValue)}function fT(){const{fieldMapping:e}=gt(),{selectedObjectName:t,configureState:n,setConfigureState:r}=Bt(),i=n?.read?.selectedFieldMappings,o=n?.read?.selectedValueMappings,s=I.useMemo(()=>{const l=t&&e?Object.values(e[t]||{}).flat().filter(c=>c.mappedValues).map(c=>({...c})):[];if(i)for(let c=0;c<l.length;c+=1){const{mapToName:u}=l[c];i?.[u]&&(l[c].fieldName=i[u])}return l},[t,e,i]),a=I.useCallback(l=>{const{value:c,name:u,fieldName:d}=l.target;c&&t&&Yp(t,r,u,c,d)},[t,r]);return s?.length?p.jsx(p.Fragment,{children:s.map(l=>{const c=n?.read?.allFieldsMetadata?.[l.fieldName],u=lT(l,c);return u.isValid?p.jsxs(p.Fragment,{children:[p.jsx(uT,{string:"Map the values for ",fieldName:ps(l)}),p.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:p.jsx(No,{id:ps(l),children:l?.mappedValues?.map(d=>{const h=c?.values||[],f=o?.[l.fieldName]||{},y=cT(h,f,d.mappedValue);return p.jsx(dT,{allValueOptions:y,mappedValue:d,onSelectChange:a,fieldName:l?.fieldName||""},`${d.mappedValue}-${l.fieldName}`)})},ps(l))})]}):(console.error(u.errorMessage,l),null)})}):null}function pT(){return a_(),p.jsxs(p.Fragment,{children:[p.jsx(X_,{}),p.jsx(c_,{}),p.jsx(sT,{}),p.jsx(o_,{}),p.jsx(i_,{}),p.jsx(fT,{}),p.jsx(G_,{}),p.jsx(jE,{})]})}function hT(e,t,n){if(e?.write?.selectedWriteObjects===null&&(e.write.selectedWriteObjects={}),e?.write){const r=e.write.selectedWriteObjects;n&&(r[t]={objectName:t}),n||delete r[t]}}function mT(e,t,n,r){t(e,i=>{hT(i,n,r)})}function gT(){const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=Bt(),i=n?.write?.selectedWriteObjects,o=n?.write?.writeObjects,s=(c,u)=>{t&&n&&mT(t,r,c,u)},a=!!o,l=o?.map(c=>({id:c.objectName,label:c.displayName,isChecked:!!i?.[c.objectName]}))||[];return a&&p.jsxs(p.Fragment,{children:[p.jsx(Lt,{string:`Allow ${e} to write to these objects`}),p.jsx(Xp,{items:l,onItemChange:s,showSelectAll:o.length>=2,searchPlaceholder:"Search objects...",itemName:"objects"})]})}function yT(){return p.jsx(p.Fragment,{children:p.jsx(gT,{})})}function Zp({resetComponent:e,onDisconnectSuccess:t}){return p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[p.jsx(Lt,{string:"Remove connection"}),p.jsx("p",{children:"Click to disconnect your connection from the provider."}),p.jsx(Wf,{resetComponent:e,onDisconnectSuccess:t,buttonText:"Remove connection",buttonVariant:"danger",buttonStyle:{fontSize:"13px",width:"100%"}})]})}const vT="_authenticationRow_1g2ms_1",bT="_field_1g2ms_8",wT="_value_1g2ms_12",hs={authenticationRow:vT,field:bT,value:wT};function Su({label:e,value:t}){return p.jsxs("div",{className:hs.authenticationRow,children:[p.jsx("div",{className:hs.field,children:e}),p.jsx("div",{className:hs.value,children:t})]})}function xT(){const{selectedConnection:e}=fn(),{providerName:t}=yt(),r=e?.provider==="salesforce"?"subdomain":"workspace",i=`${t} ${r}`;return p.jsxs(p.Fragment,{children:[p.jsx(Lt,{string:"Connection details"}),p.jsxs("div",{style:{paddingBottom:"1rem"},children:[p.jsx(Su,{label:i,value:e?.providerWorkspaceRef}),p.jsx(Su,{label:"Status",value:Wt(e?.status||"")})]})]})}function IT(){const{installation:e}=gt(),{providerName:t}=yt();return e?p.jsxs(p.Fragment,{children:[p.jsx(Lt,{string:"Uninstall entire integration"}),p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",padding:"1rem 0"},children:[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(ja,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})]}):null}function ST(){const{installation:e,resetComponent:t}=gt();return p.jsxs(p.Fragment,{children:[p.jsx(xT,{}),p.jsx(Ma,{}),e&&p.jsx(IT,{}),!e&&p.jsx(Zp,{resetComponent:t})]})}function eh({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:i}){const{installation:o}=dn(),{hydratedRevision:s,loading:a}=or(),{configureState:l,selectedObjectName:c}=Bt(),u=o?.config,d=u&&c&&!!Nd(u,c)||!1,h=c?$d(u,c):void 0,f=l?.read?.selectedFieldMappings,y=!Pd(h,f),v=s&&c?ha(u,s,c):void 0,g=l?.read?.selectedOptionalFields,b=!Fd(v,g),m=c?u?.content?.read?.objects?.[c]?.selectedValueMappings:void 0,w=l?.read?.selectedValueMappings,C=!Dd(m,w),E=u?.content?.write?.objects,_=l?.write?.selectedWriteObjects,A=!Md(E||{},_||{}),F=b||y||C||A||r||c!==yr&&!d,j=!!s?.content?.read?.objects?.find(pe=>pe.objectName===c)?.error,G=a||n||!l||!c||!F||j,P=c===yr,V=c===no,Y=p.jsx(Je,{type:"submit",disabled:G,children:r?"Install":"Save"}),ae=p.jsx(Je,{type:"button",onClick:t,disabled:G,variant:"ghost",children:"Reset"});return n?p.jsx(ii,{}):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:!V&&p.jsxs(p.Fragment,{children:[Y,ae]})}),p.jsxs(bn,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[i&&p.jsx(ui,{children:typeof i=="string"?i:"Installation Failed."}),a&&p.jsx(ii,{}),s&&!P&&!V&&p.jsx(pT,{}),s&&P&&!V&&p.jsx(yT,{}),!a&&V&&p.jsx(ST,{})]})]})}const th=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:i,onUpdateSuccess:o,fieldMapping:s}=gt(),{hydratedRevision:a,loading:l}=or(),{selectedObjectName:c}=La(),{selectedConnection:u}=fn(),d=ed(),{projectIdOrName:h}=Ke(),{resetBoundary:f,setErrors:y,setError:v,getError:g}=un(),{resetConfigureState:b,objectConfigurationsState:m}=Ba(),w=zd(c||"",m),{onNextIncompleteTab:C}=PE(),E=I.useCallback(()=>{f(Ie.INSTALLATION_MUTATION)},[f]),_=I.useCallback(k=>k?L=>{v(Ie.INSTALLATION_MUTATION,k,L)}:L=>{console.error("objectName is required to set installation error: ",L)},[v]),A=I.useCallback(k=>k?g(Ie.INSTALLATION_MUTATION,k):"",[g]);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:_,getMutateInstallationError:A,resetMutateInstallationErrorState:E,resetConfigureState:b,objectConfigurationsState:m,configureState:w,onInstallSuccess:i,onUpdateSuccess:o,onNextIncompleteTab:C,fieldMapping:s}},CT=void 0;function OT(){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:v,fieldMapping:g}=th(),[b,m]=I.useState(!1),{createInstallation:w}=Sd(),C=i===yr,E=c(i),_=I.useCallback(()=>{s(Ie.MAPPING),n?.content&&!r&&i&&Ld(n,CT,i,d)},[s,n,r,i,d]);I.useEffect(()=>{!f&&n?.content&&!r&&_()},[f,h,n,r,_]);const A=()=>{u();const{requiredMapFields:M,selectedFieldMappings:F}=f?.read||{},{errorList:j}=Ad(M,F,a);if(!(j.length>0))if(i&&o?.id&&e&&n){m(!0);const G=_x(f,i,n,e,g);if(!G){console.error("Error when generating createConfig from configureState"),m(!1);return}w({config:G.content,onSuccess:P=>{t(P),y?.(P.id,P.config),m(!1),v()},onError:P=>{l(i)(P.message),m(!1)}})}else console.error("CreateInstallallation - onSaveReadCreate: missing required props")},k=()=>{if(u(),i&&o?.id&&e&&n){m(!0);const M=Nx(f,n,e);if(!M){console.error("Error when generating createConfig from configureState"),m(!1);return}w({config:M.content,onSuccess:F=>{t(F),y?.(F.id,F.config),m(!1),v()},onError:F=>{l(i)(F.message),m(!1)}})}else console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},L=M=>{M.preventDefault(),C?k():A()};return p.jsx(eh,{errorMsg:E,isCreateMode:!0,isLoading:b,onSave:L,onReset:_})}const ET=(e,t,n)=>{const r=Bd(e),i=Vd(e),o=Ud(t,n),s=qd(e);return{content:{read:{objects:{[t]:{objectName:t,selectedFields:r,selectedFieldMappings:i,dynamicMappingsInput:o,selectedValueMappings:s||{}}}}}}},_T=e=>({content:{write:{objects:Hd(e)}}});function TT({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}=th(),{updateInstallation:y}=Od(),[v,g]=I.useState(!1),b=i===yr,m=l(i),{config:w}=e,C=I.useCallback(()=>{o(Ie.MAPPING),n?.content&&!r&&i&&Ld(n,w,i,c)},[o,n,r,i,w,c]);I.useEffect(()=>{u||C()},[u,C]);const E=I.useMemo(()=>n?.content?.read?.objects?.find(M=>M?.objectName===i),[n,i]),_=()=>{const{requiredMapFields:L,selectedFieldMappings:M}=u?.read||{},{errorList:F}=Ad(L,M,s);if(!(F.length>0))if(n&&u&&i&&E){g(!0);const j=ET(u,i,f);if(!j){console.error("Error when generating updateConfig from configureState"),g(!1);return}y({config:j.content,onSuccess:G=>{t(G),d?.(G.id,G.config),g(!1),h()},onError:G=>{a(i)(G.message),g(!1)}})}else console.error("UpdateInstallation - onSaveRead missing required props")},A=()=>{if(u&&n){g(!0);const L=_T(u);if(!L){console.error("Error when generating write updateConfig from configureState"),g(!1);return}y({config:L.content,onSuccess:M=>{t(M),d?.(M.id,M.config),g(!1),h()},onError:M=>{a(i)(M.message),g(!1)}})}else console.error("UpdateInstallation - onSaveWrite missing required props")},k=L=>{L.preventDefault(),b?A():_()};return p.jsx(eh,{errorMsg:m,onSave:k,onReset:C,isLoading:v})}function NT(){const{integrationObj:e,installation:t}=gt();return e?t&&e?p.jsx(TT,{installation:t}):p.jsx(OT,{}):p.jsx(yd,{message:"We can't load the integration"})}class dl extends I.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("Ampersand Error Boundary caught an error:",t),console.error("[Error Info]:",n),this.props.onError?.(t,n)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:p.jsx(Tt,{message:this.state.error?.message||"Something went wrong. Please try again later."}):this.props.children}}function kT(){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 fl({text:e,children:t}){return p.jsx(Tr,{children:p.jsxs(bn,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[p.jsx(kT,{}),p.jsx("p",{children:e}),t]})})}function RT({provider:e}){const{providerName:t}=yt(e),n=`You have successfully installed your ${t} integration.`;return p.jsx(fl,{text:n,children:p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:p.jsx(ja,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const AT=e=>{const{read:t,write:n}=e?.content??{};return!t&&!n};function FT({children:e}){const t=I.useRef(!1),{projectIdOrName:n}=Ke(),{hydratedRevision:r,loading:i}=or(),{integrationObj:o,installation:s,groupRef:a,consumerRef:l,onInstallSuccess:c,isIntegrationDeleted:u}=gt(),{mutate:d,isIdle:h,isPending:f,error:y,errorMsg:v}=Id(),{selectedConnection:g,isConnectionsLoading:b}=fn(),m=i||f||b,w=r?.content?.provider,C=AT(r);return I.useEffect(()=>{if(!m&&!b&&r&&C&&!s&&g&&o?.id&&!u&&w){const E={projectIdOrName:n,integrationId:o?.id,installation:{groupRef:a,connectionId:g?.id,config:{content:{provider:w}}}};Kd(r)===!0&&(E.installation.config.content.proxy=r?.content?.proxy),h&&!t.current&&d(E,{onSuccess:_=>{t.current||(c?.(_?.id,_.config),t.current=!0)}})}},[r,C,s,g,n,o?.id,a,l,m,c,u,b,w,d,h]),C&&w&&s?p.jsx(RT,{provider:w}):y?p.jsx(Tt,{message:v??"Create installation failed"}):o?m?p.jsx(Nr,{}):p.jsx("div",{children:e}):p.jsx(Tt,{message:"We can't load the integration"})}function vi(){const e=mt(),t=Ze();return vn({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"),Ye(n)}})}function PT({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:a,metadataInputs:l,moduleError:c}){const{projectIdOrName:u}=Ke(),d=vi(),h=I.useCallback(f=>{const{apiKey:y,providerMetadata:v}=f,g={projectIdOrName:u,generateConnectionParams:{providerWorkspaceRef:v?.workspace?.value,groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,apiKey:y,...v&&{providerMetadata:v}}};d.mutate(g)},[u,o,i,r,n,e,d]);return a===null?p.jsx(hE,{provider:e,providerInfo:t,handleSubmit:h,error:c||null,metadataInputs:l}):s}function DT({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:a,metadataInputs:l,moduleError:c}){const{projectIdOrName:u}=Ke(),d=vi(),h=I.useCallback(f=>{const{user:y,pass:v,providerMetadata:g}=f,b={projectIdOrName:u,generateConnectionParams:{providerWorkspaceRef:g?.workspace?.value,groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:y,password:v},...g&&{providerMetadata:g}}};d.mutate(b)},[u,o,i,r,n,e,d]);return a===null?p.jsx(bE,{provider:e,providerInfo:t,handleSubmit:h,error:c||null,metadataInputs:l}):s}function MT({providerInfo:e,handleSubmit:t,isButtonDisabled:n,buttonVariant:r,metadataInputs:i}){const[o,s]=I.useState({}),a=h=>{const{name:f,value:y}=h.currentTarget;s(v=>({...v,[f]:y.trim()}))},l=xr(i,o),c=n||!l,u=e.customOpts?.inputs||[],d=()=>{const h=Eo(i,o),f=Object.fromEntries(u.map(y=>[y.name,o[y.name]]));t({customAuth:f,providerMetadata:h})};return p.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[u.map(h=>p.jsxs("div",{children:[p.jsx(zf,{url:h.docsURL,prompt:h.prompt,inputName:h.displayName}),p.jsx(yn.PasswordInput,{id:h.name,name:h.name,onChange:a,placeholder:""})]},h.name)),i.map(h=>p.jsx(gi,{metadata:h,onChange:a,variant:"header"},h.name)),p.jsx(Je,{style:{marginTop:"1em",width:"100%"},disabled:c,type:"submit",onClick:d,variant:r,children:"Next"})]})}function jT({providerInfo:e,handleSubmit:t,error:n,isButtonDisabled:r,metadataInputs:i}){return p.jsxs(nr,{children:[p.jsx(rr,{children:`Set up ${e.displayName} integration`}),p.jsx(wn,{error:n}),p.jsx(MT,{providerInfo:e,handleSubmit:t,isButtonDisabled:r||!!n,metadataInputs:i})]})}function LT({providerInfo:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,selectedConnection:s,metadataInputs:a,moduleError:l}){const{projectIdOrName:c}=Ke(),u=vi(),[d,h]=I.useState(l||null),f=I.useCallback(y=>{const{customAuth:v,providerMetadata:g}=y;h(null);const b={projectIdOrName:c,generateConnectionParams:{providerWorkspaceRef:g?.workspace?.value,groupName:i,groupRef:r,consumerName:n,consumerRef:t,provider:e.name,customAuth:v,...g&&{providerMetadata:g}}};u.mutate(b,{onError:m=>{Ye(m,h)},onSuccess:()=>{h(null)}})},[c,i,r,n,t,e.name,u]);return s===null?p.jsx(jT,{providerInfo:e,handleSubmit:f,error:d,metadataInputs:a}):o}function BT({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(nr,{children:[p.jsx(rr,{children:o||`Set up ${r} integration`}),p.jsx(wn,{error:t}),i,p.jsx(Je,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function VT({...e}){return p.jsx(BT,{...e})}function UT({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,selectedConnection:s,providerName:a,moduleError:l}){const{projectIdOrName:c}=Ke(),u=vi(),d=I.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(VT,{handleSubmit:d,error:l||null,providerName:a}):o}const qT=()=>{const e=mt(),t=Ze();return vn({mutationKey:["createOauthConnection"],mutationFn:async n=>(await e()).oAuthApi.oauthConnect(n),onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})};function $T({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return p.jsxs(nr,{children:[p.jsx(rr,{children:`Set up ${r} integration`}),p.jsx(Kx,{children:`Click Next to sign into the ${r} account you'd like to sync.`}),p.jsx(wn,{error:t}),p.jsx(Je,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:n&&!t?"Loading...":"Next"})]})}function zT({handleSubmit:e,setFormData:t,error:n,isButtonDisabled:r,providerName:i,metadataInputs:o}){return p.jsxs(nr,{children:[p.jsxs(rr,{children:["Enter your ",i," workspace"]}),p.jsx(wn,{error:n}),p.jsx("br",{}),o.map(s=>p.jsx(gi,{metadata:s,onChange:a=>t(s.name,a.currentTarget.value),providerName:i},s.name)),p.jsx(Je,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const Cu=600,Ou=600;function KT({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,providerName:o,metadataInputs:s,moduleError:a}){const{projectId:l}=Mn(),c=Ze(),u=I.useRef(null),[d,h]=I.useState(a||null),[f,y]=I.useState({}),[v,g]=I.useState({}),{mutateAsync:b,isPending:m}=qT(),{isFetching:w,refetch:C}=fa({groupRef:r,provider:e});I.useEffect(()=>{const k=L=>{L.origin===hd&&(L.data?.eventType==="AUTHORIZATION_SUCCEEDED"?(h(null),console.debug("New connection:",L.data.data.connection),c.invalidateQueries({queryKey:["amp","connections"]})):L.data?.eventType==="AUTHORIZATION_FAILED"&&(console.error("OAuth failed:",L.data.data.error),c.invalidateQueries({queryKey:["amp","connections"]}),h(L.data.data.error||"An error occurred. Please try again.")),u.current?.close())};return window.addEventListener("message",k),()=>window.removeEventListener("message",k)},[c]);const E=(k,L)=>{y(M=>({...M,[k]:L})),g(M=>({...M,[k]:{value:L,source:"input"}}))},_=async()=>{h(null);try{const{data:k}=await C();if(k&&k.length>0){console.debug("connections found");return}}catch{console.debug("error with fetching connections")}if(s.length>0&&!xr(s,f)){h("Please fill in all required fields");return}try{const k=await b({connectOAuthParams:{provider:e,consumerRef:t,groupRef:r,projectId:l||"",consumerName:n,groupName:i,providerWorkspaceRef:v?.workspace?.value,providerMetadata:v}});if(k){const L=window.screenX+(window.outerWidth-Cu)/2,M=window.screenY+(window.outerHeight-Ou)/2.5,F=`width=${Cu},height=${Ou},left=${L},top=${M}`;u.current=window.open(k,"OAuthPopup",F)}}catch(k){console.error(k),h(k instanceof Error?k.message:String(k)||"An error occurred. Please try again.")}},A=s.length>0?p.jsx(zT,{handleSubmit:_,setFormData:E,error:d,isButtonDisabled:!xr(s,f)||m||w||!!d,providerName:o,metadataInputs:s}):p.jsx($T,{handleSubmit:_,error:d,providerName:o,isButtonDisabled:m||w||!!d});return p.jsx("div",{children:A})}function HT({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,explicitScopesRequired:s,selectedConnection:a,metadataInputs:l,moduleError:c}){const{projectIdOrName:u}=Ke(),d=vi(),[h,f]=I.useState(c||null),y=I.useCallback(v=>{f(null);const g={projectIdOrName:u,generateConnectionParams:{groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:v.providerMetadata?.workspace?.value,oauth2ClientCredentials:{clientId:v.clientId,clientSecret:v.clientSecret,scopes:v.scopes},...v.providerMetadata&&{providerMetadata:v.providerMetadata}}};d.mutate(g,{onError:()=>f("Error loading provider info")})},[u,o,i,r,n,e,d]);return a===null?p.jsx(xE,{providerName:t,handleSubmit:y,error:h,explicitScopesRequired:s,metadataInputs:l}):p.jsx(ii,{})}function JT({...e}){return p.jsx(HT,{...e})}const WT="authorizationCode",QT="authorizationCodePKCE",GT="clientCredentials";function XT({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,selectedConnection:s,setSelectedConnection:a,metadataInputs:l,moduleError:c}){const{providerName:u}=yt(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===WT||d===QT?p.jsx(KT,{...f}):d===GT?p.jsx(JT,{...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 YT(e){const{selectedConnection:t}=fn();I.useEffect(()=>{e&&t&&e(t)},[e,t])}function ZT({onSuccess:e}){YT(e)}function nh({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,onSuccess:s,onDisconnectSuccess:a,resetComponent:l}){const{data:c,isLoading:u,isError:d,error:h,providerName:f,selectedProvider:y}=yt(e),{provider:v,isIntegrationDeleted:g,integrationObj:b}=gt(),{selectedConnection:m,setSelectedConnection:w}=fn();ZT({onSuccess:s});const C=Ze(),E=c,_=b?.latestRevision?.content?.module,{module:A,error:k}=dE(_,E),L=E?.metadata?.input||[],M=fE(L,A);I.useEffect(()=>{d&&(console.error("Error loading provider info."),Ye(h))},[d,h]);const F=I.useCallback(()=>{C.clear(),l()},[l,C]);if(!e&&!v)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(g)return p.jsx(fl,{text:"Integration successfully uninstalled.",children:p.jsx(Je,{type:"button",onClick:F,style:{width:"100%"},children:"Reinstall Integration"})});if(m)return o;if(u)return p.jsx(Nr,{});if(E==null)return p.jsx(Tt,{message:"Provider info was not found."});const j={provider:y,consumerRef:t,consumerName:n,groupRef:r,groupName:i,selectedConnection:m,setSelectedConnection:w,providerName:f,providerInfo:E,onDisconnectSuccess:a,metadataInputs:M,moduleError:k};return E.authType==="none"?p.jsx(UT,{...j,children:o}):E.authType==="basic"?p.jsx(DT,{...j,children:o}):E.authType==="apiKey"?p.jsx(PT,{...j,children:o}):E.authType==="custom"?p.jsx(LT,{...j,children:o}):p.jsx(XT,{...j})}function eN(e){const t=e+"CollectionProvider",[n,r]=ko(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=v=>{const{scope:g,children:b}=v,m=I.useRef(null),w=I.useRef(new Map).current;return p.jsx(i,{scope:g,itemMap:w,collectionRef:m,children:b})};s.displayName=t;const a=e+"CollectionSlot",l=Xs(a),c=I.forwardRef((v,g)=>{const{scope:b,children:m}=v,w=o(a,b),C=Cr(g,w.collectionRef);return p.jsx(l,{ref:C,children:m})});c.displayName=a;const u=e+"CollectionItemSlot",d="data-radix-collection-item",h=Xs(u),f=I.forwardRef((v,g)=>{const{scope:b,children:m,...w}=v,C=I.useRef(null),E=Cr(g,C),_=o(u,b);return I.useEffect(()=>(_.itemMap.set(C,{ref:C,...w}),()=>{_.itemMap.delete(C)})),p.jsx(h,{[d]:"",ref:E,children:m})});f.displayName=u;function y(v){const g=o(e+"CollectionConsumer",v);return I.useCallback(()=>{const m=g.collectionRef.current;if(!m)return[];const w=Array.from(m.querySelectorAll(`[${d}]`));return Array.from(g.itemMap.values()).sort((_,A)=>w.indexOf(_.ref.current)-w.indexOf(A.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:s,Slot:c,ItemSlot:f},y,r]}var tN=H[" useId ".trim().toString()]||(()=>{}),nN=0;function rh(e){const[t,n]=H.useState(tN());return li(()=>{n(r=>r??String(nN++))},[e]),e||(t?`radix-${t}`:"")}function rN(e){const t=H.useRef(e);return H.useEffect(()=>{t.current=e}),H.useMemo(()=>(...n)=>t.current?.(...n),[])}var iN=H.createContext(void 0);function ih(e){const t=H.useContext(iN);return e||t||"ltr"}var ms="rovingFocusGroup.onEntryFocus",oN={bubbles:!1,cancelable:!0},bi="RovingFocusGroup",[Ys,oh,sN]=eN(bi),[aN,sh]=ko(bi,[sN]),[lN,cN]=aN(bi),ah=H.forwardRef((e,t)=>p.jsx(Ys.Provider,{scope:e.__scopeRovingFocusGroup,children:p.jsx(Ys.Slot,{scope:e.__scopeRovingFocusGroup,children:p.jsx(uN,{...e,ref:t})})}));ah.displayName=bi;var uN=H.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=H.useRef(null),f=Cr(t,h),y=ih(o),[v,g]=ol({prop:s,defaultProp:a??null,onChange:l,caller:bi}),[b,m]=H.useState(!1),w=rN(c),C=oh(n),E=H.useRef(!1),[_,A]=H.useState(0);return H.useEffect(()=>{const k=h.current;if(k)return k.addEventListener(ms,w),()=>k.removeEventListener(ms,w)},[w]),p.jsx(lN,{scope:n,orientation:r,dir:y,loop:i,currentTabStopId:v,onItemFocus:H.useCallback(k=>g(k),[g]),onItemShiftTab:H.useCallback(()=>m(!0),[]),onFocusableItemAdd:H.useCallback(()=>A(k=>k+1),[]),onFocusableItemRemove:H.useCallback(()=>A(k=>k-1),[]),children:p.jsx(xn.div,{tabIndex:b||_===0?-1:0,"data-orientation":r,...d,ref:f,style:{outline:"none",...e.style},onMouseDown:Zt(e.onMouseDown,()=>{E.current=!0}),onFocus:Zt(e.onFocus,k=>{const L=!E.current;if(k.target===k.currentTarget&&L&&!b){const M=new CustomEvent(ms,oN);if(k.currentTarget.dispatchEvent(M),!M.defaultPrevented){const F=C().filter(Y=>Y.focusable),j=F.find(Y=>Y.active),G=F.find(Y=>Y.id===v),V=[j,G,...F].filter(Boolean).map(Y=>Y.ref.current);uh(V,u)}}E.current=!1}),onBlur:Zt(e.onBlur,()=>m(!1))})})}),lh="RovingFocusGroupItem",ch=H.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,children:s,...a}=e,l=rh(),c=o||l,u=cN(lh,n),d=u.currentTabStopId===c,h=oh(n),{onFocusableItemAdd:f,onFocusableItemRemove:y,currentTabStopId:v}=u;return H.useEffect(()=>{if(r)return f(),()=>y()},[r,f,y]),p.jsx(Ys.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:p.jsx(xn.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...a,ref:t,onMouseDown:Zt(e.onMouseDown,g=>{r?u.onItemFocus(c):g.preventDefault()}),onFocus:Zt(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:Zt(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){u.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const b=pN(g,u.orientation,u.dir);if(b!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let w=h().filter(C=>C.focusable).map(C=>C.ref.current);if(b==="last")w.reverse();else if(b==="prev"||b==="next"){b==="prev"&&w.reverse();const C=w.indexOf(g.currentTarget);w=u.loop?hN(w,C+1):w.slice(C+1)}setTimeout(()=>uh(w))}}),children:typeof s=="function"?s({isCurrentTabStop:d,hasTabStop:v!=null}):s})})});ch.displayName=lh;var dN={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function fN(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function pN(e,t,n){const r=fN(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return dN[r]}function uh(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function hN(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var mN=ah,gN=ch,Ao="Tabs",[yN]=ko(Ao,[sh]),dh=sh(),[vN,pl]=yN(Ao),fh=H.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:a,activationMode:l="automatic",...c}=e,u=ih(a),[d,h]=ol({prop:r,onChange:i,defaultProp:o??"",caller:Ao});return p.jsx(vN,{scope:n,baseId:rh(),value:d,onValueChange:h,orientation:s,dir:u,activationMode:l,children:p.jsx(xn.div,{dir:u,"data-orientation":s,...c,ref:t})})});fh.displayName=Ao;var ph="TabsList",hh=H.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,o=pl(ph,n),s=dh(n);return p.jsx(mN,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:r,children:p.jsx(xn.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:t})})});hh.displayName=ph;var mh="TabsTrigger",gh=H.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=e,s=pl(mh,n),a=dh(n),l=vh(s.baseId,r),c=bh(s.baseId,r),u=r===s.value;return p.jsx(gN,{asChild:!0,...a,focusable:!i,active:u,children:p.jsx(xn.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:Zt(e.onMouseDown,d=>{!i&&d.button===0&&d.ctrlKey===!1?s.onValueChange(r):d.preventDefault()}),onKeyDown:Zt(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&s.onValueChange(r)}),onFocus:Zt(e.onFocus,()=>{const d=s.activationMode!=="manual";!u&&!i&&d&&s.onValueChange(r)})})})});gh.displayName=mh;var yh="TabsContent",bN=H.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=e,a=pl(yh,n),l=vh(a.baseId,r),c=bh(a.baseId,r),u=r===a.value,d=H.useRef(u);return H.useEffect(()=>{const h=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(h)},[]),p.jsx(sl,{present:i||u,children:({present:h})=>p.jsx(xn.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})})});bN.displayName=yh;function vh(e,t){return`${e}-trigger-${t}`}function bh(e,t){return`${e}-content-${t}`}var wN=fh,xN=hh,wh=gh;const IN=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 SN(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?IN: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 CN(){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 ON="_tabsRoot_ktpr0_1",EN="_tabsList_ktpr0_6",_N="_tabTrigger_ktpr0_12",po={tabsRoot:ON,tabsList:EN,tabTrigger:_N};function TN(){return p.jsxs(p.Fragment,{children:[p.jsx(_o,{style:{margin:"1rem 0"}}),p.jsx(wh,{value:no,className:po.tabTrigger,children:p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[p.jsx(CN,{}),p.jsx("span",{children:"Manage"})]})})]})}function xh({objectName:e,completed:t,pending:n,displayName:r,disabled:i}){return p.jsx(wh,{value:e,className:po.tabTrigger,children:p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[SN(!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 NN({completed:e,pending:t,displayName:n}){return p.jsxs(p.Fragment,{children:[p.jsx(_o,{style:{margin:"1rem 0"}}),p.jsx(xh,{objectName:yr,completed:e,pending:t,displayName:n},"other-write")]})}function kN({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:i}){const{data:o}=ud(),{installation:s}=dn(),a=s?.config,l=a?.content?.write?.objects,c=r?.other?.write?.selectedWriteObjects;return p.jsx(wN,{value:e,className:po.tabsRoot,onValueChange:n,children:p.jsxs(xN,{className:po.tabsList,children:[t.map(u=>{const d=a?.content?.read?.objects?.[u.name],h=r?.[u.name],f=$d(a,u.name),y=h?.read?.selectedFieldMappings,v=!Pd(f,y),g=o?ha(a,o,u.name):void 0,b=h?.read?.selectedOptionalFields,m=!Fd(g,b),w=d?.selectedValueMappings,C=h?.read?.selectedValueMappings,E=!Dd(w,C),_=m||v||E||!1;return p.jsx(xh,{objectName:u.name,displayName:u.displayName,completed:u.completed,disabled:u.disabled,pending:_},u.name)}),i&&(()=>{const u=!Md(l||{},c||{});return p.jsx(NN,{completed:i.completed,pending:u,displayName:"Write"})})(),p.jsx(TN,{})]})})}function RN(e,t){return t===no?{name:no,completed:!1}:e.find(n=>n.name===t)}function AN({children:e}){const{data:t}=Mn(),{installation:n}=gt(),{providerName:r}=yt(),{hydratedRevision:i}=or(),{objectConfigurationsState:o}=Ba(),[s,a]=I.useState(""),l=t?.appName||"",c=n?.config,u=i&&kd(c,i),d=u!==null,h=!!i?.content?.write,f=h?Rd(c):void 0,y=I.useMemo(()=>{const b=[...u||[]];return f&&h&&b.push(f),b},[u,f,h]),v=RN(y,s),g=I.useCallback(()=>{const b=y.find(m=>v!==m&&!m.completed);b&&a(b.name)},[y,v]);return I.useEffect(()=>{!s&&y.length>0&&a(y[0].name)},[y,s,g]),p.jsx(Xf.Provider,{value:g,children:p.jsx(Gf.Provider,{value:v?.name,children:p.jsxs(Tr,{style:{maxWidth:"55rem"},children:[p.jsxs(bn,{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(kN,{value:s,readNavObjects:u,onValueChange:b=>a(b),objectConfigurationsState:o,writeNavObject:f})]}),e]}),p.jsx(Qd,{})]})})})}function FN({...e}){return p.jsx(AN,{...e})}const PN="_resetContainer_lkwv9_4",Ih={resetContainer:PN},DN=({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:l})=>{const{projectIdOrName:c,isLoading:u}=Mn(),{isLoading:d}=vo(),{isError:h,errorState:f}=un(),{seed:y,reset:v}=Ed();return u||d?p.jsx(Nr,{}):h(Ie.PROJECT,c)?p.jsx(Tt,{message:`Error loading project ${c}`}):h(Ie.INTEGRATION_LIST,c)?p.jsx(Tt,{message:"Error retrieving integrations for the project, double check the API key"}):f[Ie.INTEGRATION_LIST]?.apiError?p.jsx(Tt,{message:"Something went wrong, couldn't find integration information"}):p.jsx("div",{className:Ih.resetContainer,children:p.jsx(px,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:l,resetComponent:v,children:p.jsx(xd,{children:p.jsx(nh,{consumerRef:t,consumerName:n,groupRef:r,groupName:i,resetComponent:v,children:p.jsx(FE,{resetComponent:v,children:p.jsx(FT,{children:p.jsx(ME,{children:p.jsx(FN,{children:p.jsx(NT,{})})})})})})})},y)})};function MN({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(dl,{fallback:p.jsx(Tt,{message:"Something went wrong, couldn't find integration information"}),children:p.jsx(da,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:p.jsx(DN,{...c})})})}function jN(){return p.jsxs(Tr,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[p.jsx(ii,{}),p.jsx("p",{children:"Redirecting"})]})}function LN({redirectURL:e,children:t}){return I.useEffect(()=>{e&&window.location.replace(e)},[e]),e?p.jsx(jN,{}):t}function BN({resetComponent:e,onDisconnectSuccess:t,provider:n}){const[r,i]=I.useState(!1);return p.jsxs(p.Fragment,{children:[r===!1&&p.jsxs(p.Fragment,{children:[p.jsx(Lt,{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(Je,{type:"button",onClick:()=>i(!0),variant:"ghost",style:{fontSize:"13px"},children:"Update connection"})]})]}),r===!0&&p.jsxs(p.Fragment,{children:[p.jsx(Ma,{provider:n}),p.jsx(Zp,{resetComponent:e,onDisconnectSuccess:t})]})]})}function VN({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=Mn(),{providerName:i}=yt(e),o=`You have successfully connected your ${i} account to ${r}.`;return p.jsx(fl,{text:o,children:p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"},children:p.jsx(BN,{resetComponent:n,onDisconnectSuccess:t,provider:e})})})}function UN({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,redirectUrl:o,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:l}){const{seed:c,reset:u}=Ed(),d=I.useCallback(h=>{s?s(h.id):l&&l(h)},[s,l]);return p.jsx(dl,{fallback:p.jsx(Tt,{message:"Something went wrong with the connection. Please try again."}),children:p.jsx("div",{className:Ih.resetContainer,children:p.jsx(da,{integration:"connect-provider-dummy-string",consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:p.jsx(xd,{groupRef:r,provider:e,children:p.jsx(nh,{resetComponent:u,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onSuccess:d,onDisconnectSuccess:a,children:p.jsx(LN,{redirectURL:o,children:p.jsx(VN,{resetComponent:u,provider:e,onDisconnectSuccess:a})})})})})},c)})}const qN=(e,t,n)=>{const{data:r,isLoading:i,isError:o,error:s}=la(e,t,n),a=(r?.length||0)>0,l=!!r&&!i,u=r?.[0]?.config;return I.useEffect(()=>{o&&Ye(s)},[o,s]),{isLoaded:l,isIntegrationInstalled:a,isLoading:i,config:u,isError:o,error:s}};exports.AmpersandContext=oa;exports.AmpersandErrorBoundary=dl;exports.AmpersandProvider=_w;exports.ConnectProvider=UN;exports.FieldSettingWriteOnCreateEnum=Um;exports.FieldSettingWriteOnUpdateEnum=qm;exports.InstallIntegration=MN;exports.InstallationProvider=da;exports.useAmpersandProviderProps=Ke;exports.useConfig=Kw;exports.useConnection=ca;exports.useCreateInstallation=Sd;exports.useDeleteInstallation=yx;exports.useInstallation=dn;exports.useIsIntegrationInstalled=qN;exports.useLocalConfig=zw;exports.useManifest=bo;exports.useUpdateInstallation=Od;
|
|
18
|
+
`}),n}function kc(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Rc(e,t){const n=iO(e,t),r=n.one(e,void 0),i=J0(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&o.children.push({type:"text",value:`
|
|
19
|
+
`},i),o}function cO(e,t){return e&&"run"in e?async function(n,r){const i=Rc(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Rc(n,{file:r,...e||t})}}function Ac(e){if(e)throw e}var Go,Fc;function uO(){if(Fc)return Go;Fc=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(c){return typeof Array.isArray=="function"?Array.isArray(c):t.call(c)==="[object Array]"},o=function(c){if(!c||t.call(c)!=="[object Object]")return!1;var u=e.call(c,"constructor"),d=c.constructor&&c.constructor.prototype&&e.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!u&&!d)return!1;var h;for(h in c);return typeof h>"u"||e.call(c,h)},s=function(c,u){n&&u.name==="__proto__"?n(c,u.name,{enumerable:!0,configurable:!0,value:u.newValue,writable:!0}):c[u.name]=u.newValue},a=function(c,u){if(u==="__proto__")if(e.call(c,u)){if(r)return r(c,u).value}else return;return c[u]};return Go=function l(){var c,u,d,h,f,y,v=arguments[0],g=1,w=arguments.length,m=!1;for(typeof v=="boolean"&&(m=v,v=arguments[1]||{},g=2),(v==null||typeof v!="object"&&typeof v!="function")&&(v={});g<w;++g)if(c=arguments[g],c!=null)for(u in c)d=a(v,u),h=a(c,u),v!==h&&(m&&h&&(o(h)||(f=i(h)))?(f?(f=!1,y=d&&i(d)?d:[]):y=d&&o(d)?d:{},s(v,{name:u,newValue:l(m,y,h)})):typeof h<"u"&&s(v,{name:u,newValue:h}));return v},Go}var dO=uO();const Xo=Nr(dO);function Vs(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 fO(){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?pO(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 pO(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 on={basename:hO,dirname:mO,extname:gO,join:yO,sep:"/"};function hO(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');fi(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 mO(e){if(fi(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 gO(e){fi(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 yO(...e){let t=-1,n;for(;++t<e.length;)fi(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":vO(n)}function vO(e){fi(e);const t=e.codePointAt(0)===47;let n=bO(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function bO(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 fi(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const wO={cwd:xO};function xO(){return"/"}function Us(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function IO(e){if(typeof e=="string")e=new URL(e);else if(!Us(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 SO(e)}function SO(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 Yo=["history","path","basename","stem","extname","dirname"];class Pf{constructor(t){let n;t?Us(t)?n={path:t}:typeof t=="string"||CO(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":wO.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Yo.length;){const o=Yo[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)Yo.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?on.basename(this.path):void 0}set basename(t){es(t,"basename"),Zo(t,"basename"),this.path=on.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?on.dirname(this.path):void 0}set dirname(t){Pc(this.basename,"dirname"),this.path=on.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?on.extname(this.path):void 0}set extname(t){if(Zo(t,"extname"),Pc(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=on.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Us(t)&&(t=IO(t)),es(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?on.basename(this.path,this.extname):void 0}set stem(t){es(t,"stem"),Zo(t,"stem"),this.path=on.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 vt(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 Zo(e,t){if(e&&e.includes(on.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+on.sep+"`")}function es(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Pc(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function CO(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const OO=(function(e){const r=this.constructor.prototype,i=r[e],o=function(){return i.apply(o,arguments)};return Object.setPrototypeOf(o,r),o}),EO={}.hasOwnProperty;class Ta extends OO{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=fO()}copy(){const t=new Ta;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Xo(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(rs("data",this.frozen),this.namespace[t]=n,this):EO.call(this.namespace,t)&&this.namespace[t]||void 0:t?(rs("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=Mi(t),r=this.parser||this.Parser;return ts("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),ts("process",this.parser||this.Parser),ns("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(o,s){const a=Mi(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);TO(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(),ts("processSync",this.parser||this.Parser),ns("processSync",this.compiler||this.Compiler),this.process(t,i),Mc("processSync","process",n),r;function i(o,s){n=!0,Ac(o),r=s}}run(t,n,r){Dc(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=Mi(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),Mc("runSync","run",r),i;function o(s,a){Ac(s),i=a,r=!0}}stringify(t,n){this.freeze();const r=Mi(n),i=this.compiler||this.Compiler;return ns("stringify",i),Dc(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(rs("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=Xo(!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 v=r[h][1];Vs(v)&&Vs(f)&&(f=Xo(!0,v,f)),r[h]=[c,f,...y]}}}}const _O=new Ta().freeze();function ts(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ns(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function rs(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 Dc(e){if(!Vs(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Mc(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Mi(e){return NO(e)?e:new Pf(e)}function NO(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function TO(e){return typeof e=="string"||kO(e)}function kO(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const RO="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",jc=[],Lc={allowDangerousHtml:!0},AO=/^(https?|ircs?|mailto|xmpp)$/i,FO=[{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 PO(e){const t=DO(e),n=MO(e);return jO(t.runSync(t.parse(n),n),e)}function DO(e){const t=e.rehypePlugins||jc,n=e.remarkPlugins||jc,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Lc}:Lc;return _O().use(h0).use(n).use(cO,r).use(t)}function MO(e){const t=e.children||"",n=new Pf;return typeof t=="string"&&(n.value=t),n}function jO(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,o=t.disallowedElements,s=t.skipHtml,a=t.unwrapDisallowed,l=t.urlTransform||LO;for(const u of FO)Object.hasOwn(t,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+RO+u.id,void 0);return Ff(e,c),JI(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 Jo)if(Object.hasOwn(Jo,f)&&Object.hasOwn(u.properties,f)){const y=u.properties[f],v=Jo[f];(v===null||v.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 LO(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||AO.test(e.slice(0,t))?e:""}const BO="_container_r1dnc_1",VO="_code_r1dnc_9",Bc={container:BO,code:VO};function UO({prompt:e}){return p.jsx("div",{className:Bc.container,children:p.jsx(PO,{components:{p:({children:t})=>p.jsx(p.Fragment,{children:t}),code:({children:t})=>p.jsx("code",{className:Bc.code,children:t})},children:e})})}function ka({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(Yd,{href:e,newTab:!0,children:p.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," ","about where to find your ",t," ",n,"."]}),r&&p.jsx(UO,{prompt:r})]})}const br=Math.min,Jn=Math.max,oo=Math.round,ji=Math.floor,Pn=e=>({x:e,y:e}),qO={left:"right",right:"left",bottom:"top",top:"bottom"},$O={start:"end",end:"start"};function qs(e,t,n){return Jn(e,br(t,n))}function pi(e,t){return typeof e=="function"?e(t):e}function Yn(e){return e.split("-")[0]}function hi(e){return e.split("-")[1]}function Df(e){return e==="x"?"y":"x"}function Ra(e){return e==="y"?"height":"width"}function wr(e){return["top","bottom"].includes(Yn(e))?"y":"x"}function Aa(e){return Df(wr(e))}function zO(e,t,n){n===void 0&&(n=!1);const r=hi(e),i=Aa(e),o=Ra(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=so(s)),[s,so(s)]}function KO(e){const t=so(e);return[$s(e),t,$s(t)]}function $s(e){return e.replace(/start|end/g,t=>$O[t])}function HO(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 JO(e,t,n,r){const i=hi(e);let o=HO(Yn(e),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),t&&(o=o.concat(o.map($s)))),o}function so(e){return e.replace(/left|right|bottom|top/g,t=>qO[t])}function WO(e){return{top:0,right:0,bottom:0,left:0,...e}}function Mf(e){return typeof e!="number"?WO(e):{top:e,right:e,bottom:e,left:e}}function ao(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 Vc(e,t,n){let{reference:r,floating:i}=e;const o=wr(t),s=Aa(t),a=Ra(s),l=Yn(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(hi(t)){case"start":f[s]-=h*(n&&c?-1:1);break;case"end":f[s]+=h*(n&&c?-1:1);break}return f}const QO=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}=Vc(c,r,l),h=r,f={},y=0;for(let v=0;v<a.length;v++){const{name:g,fn:w}=a[v],{x:m,y:b,data:C,reset:E}=await w({x:u,y:d,initialPlacement:r,placement:h,strategy:i,middlewareData:f,rects:c,platform:s,elements:{reference:e,floating:t}});u=m??u,d=b??d,f={...f,[g]:{...f[g],...C}},E&&y<=50&&(y++,typeof E=="object"&&(E.placement&&(h=E.placement),E.rects&&(c=E.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:i}):E.rects),{x:u,y:d}=Vc(c,h,l)),v=-1)}return{x:u,y:d,placement:h,strategy:i,middlewareData:f}};async function jf(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}=pi(t,e),y=Mf(f),g=a[h?d==="floating"?"reference":"floating":d],w=ao(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:c,rootBoundary:u,strategy:l})),m=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)),C=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},E=ao(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:m,offsetParent:b,strategy:l}):m);return{top:(w.top-E.top+y.top)/C.y,bottom:(E.bottom-w.bottom+y.bottom)/C.y,left:(w.left-E.left+y.left)/C.x,right:(E.right-w.right+y.right)/C.x}}const GO=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}=pi(e,t)||{};if(c==null)return{};const d=Mf(u),h={x:n,y:r},f=Aa(i),y=Ra(f),v=await s.getDimensions(c),g=f==="y",w=g?"top":"left",m=g?"bottom":"right",b=g?"clientHeight":"clientWidth",C=o.reference[y]+o.reference[f]-h[f]-o.floating[y],E=h[f]-o.reference[f],_=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let A=_?_[b]:0;(!A||!await(s.isElement==null?void 0:s.isElement(_)))&&(A=a.floating[b]||o.floating[y]);const k=C/2-E/2,L=A/2-v[y]/2-1,M=br(d[w],L),F=br(d[m],L),j=M,G=A-v[y]-F,P=A/2-v[y]/2+k,V=qs(j,P,G),Y=!l.arrow&&hi(i)!=null&&P!==V&&o.reference[y]/2-(P<j?M:F)-v[y]/2<0,le=Y?P<j?P-j:P-G:0;return{[f]:h[f]+le,data:{[f]:V,centerOffset:P-V-le,...Y&&{alignmentOffset:le}},reset:Y}}}),XO=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:v=!0,...g}=pi(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const w=Yn(i),m=wr(a),b=Yn(a)===a,C=await(l.isRTL==null?void 0:l.isRTL(c.floating)),E=h||(b||!v?[so(a)]:KO(a)),_=y!=="none";!h&&_&&E.push(...JO(a,v,y,C));const A=[a,...E],k=await jf(t,g),L=[];let M=((r=o.flip)==null?void 0:r.overflows)||[];if(u&&L.push(k[w]),d){const P=zO(i,s,C);L.push(k[P[0]],k[P[1]])}if(M=[...M,{placement:i,overflows:L}],!L.every(P=>P<=0)){var F,j;const P=(((F=o.flip)==null?void 0:F.index)||0)+1,V=A[P];if(V)return{data:{index:P,overflows:M},reset:{placement:V}};let Y=(j=M.filter(le=>le.overflows[0]<=0).sort((le,pe)=>le.overflows[1]-pe.overflows[1])[0])==null?void 0:j.placement;if(!Y)switch(f){case"bestFit":{var G;const le=(G=M.filter(pe=>{if(_){const ge=wr(pe.placement);return ge===m||ge==="y"}return!0}).map(pe=>[pe.placement,pe.overflows.filter(ge=>ge>0).reduce((ge,x)=>ge+x,0)]).sort((pe,ge)=>pe[1]-ge[1])[0])==null?void 0:G[0];le&&(Y=le);break}case"initialPlacement":Y=a;break}if(i!==Y)return{reset:{placement:Y}}}return{}}}};async function YO(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=Yn(n),a=hi(n),l=wr(n)==="y",c=["left","top"].includes(s)?-1:1,u=o&&l?-1:1,d=pi(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 ZO=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 YO(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}}}}},eE=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:w,y:m}=g;return{x:w,y:m}}},...l}=pi(e,t),c={x:n,y:r},u=await jf(t,l),d=wr(Yn(i)),h=Df(d);let f=c[h],y=c[d];if(o){const g=h==="y"?"top":"left",w=h==="y"?"bottom":"right",m=f+u[g],b=f-u[w];f=qs(m,f,b)}if(s){const g=d==="y"?"top":"left",w=d==="y"?"bottom":"right",m=y+u[g],b=y-u[w];y=qs(m,y,b)}const v=a.fn({...t,[h]:f,[d]:y});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[h]:o,[d]:s}}}}}};function So(){return typeof window<"u"}function Pr(e){return Lf(e)?(e.nodeName||"").toLowerCase():"#document"}function Mt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function pn(e){var t;return(t=(Lf(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Lf(e){return So()?e instanceof Node||e instanceof Mt(e).Node:!1}function en(e){return So()?e instanceof Element||e instanceof Mt(e).Element:!1}function cn(e){return So()?e instanceof HTMLElement||e instanceof Mt(e).HTMLElement:!1}function Uc(e){return!So()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Mt(e).ShadowRoot}function mi(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=tn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(i)}function tE(e){return["table","td","th"].includes(Pr(e))}function Co(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Fa(e){const t=Pa(),n=en(e)?tn(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 nE(e){let t=Dn(e);for(;cn(t)&&!xr(t);){if(Fa(t))return t;if(Co(t))return null;t=Dn(t)}return null}function Pa(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function xr(e){return["html","body","#document"].includes(Pr(e))}function tn(e){return Mt(e).getComputedStyle(e)}function Oo(e){return en(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Dn(e){if(Pr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Uc(e)&&e.host||pn(e);return Uc(t)?t.host:t}function Bf(e){const t=Dn(e);return xr(t)?e.ownerDocument?e.ownerDocument.body:e.body:cn(t)&&mi(t)?t:Bf(t)}function si(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=Bf(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),s=Mt(i);if(o){const a=zs(s);return t.concat(s,s.visualViewport||[],mi(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 Vf(e){const t=tn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=cn(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,a=oo(n)!==o||oo(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function Da(e){return en(e)?e:e.contextElement}function mr(e){const t=Da(e);if(!cn(t))return Pn(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=Vf(t);let s=(o?oo(n.width):n.width)/r,a=(o?oo(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const rE=Pn(0);function Uf(e){const t=Mt(e);return!Pa()||!t.visualViewport?rE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function iE(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Mt(e)?!1:t}function Zn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=Da(e);let s=Pn(1);t&&(r?en(r)&&(s=mr(r)):s=mr(e));const a=iE(o,n,r)?Uf(o):Pn(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=Mt(o),f=r&&en(r)?Mt(r):r;let y=h,v=zs(y);for(;v&&r&&f!==y;){const g=mr(v),w=v.getBoundingClientRect(),m=tn(v),b=w.left+(v.clientLeft+parseFloat(m.paddingLeft))*g.x,C=w.top+(v.clientTop+parseFloat(m.paddingTop))*g.y;l*=g.x,c*=g.y,u*=g.x,d*=g.y,l+=b,c+=C,y=Mt(v),v=zs(y)}}return ao({width:u,height:d,x:l,y:c})}function oE(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",s=pn(r),a=t?Co(t.floating):!1;if(r===s||a&&o)return n;let l={scrollLeft:0,scrollTop:0},c=Pn(1);const u=Pn(0),d=cn(r);if((d||!d&&!o)&&((Pr(r)!=="body"||mi(s))&&(l=Oo(r)),cn(r))){const h=Zn(r);c=mr(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 sE(e){return Array.from(e.getClientRects())}function Ks(e,t){const n=Oo(e).scrollLeft;return t?t.left+n:Zn(pn(e)).left+n}function aE(e){const t=pn(e),n=Oo(e),r=e.ownerDocument.body,i=Jn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=Jn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Ks(e);const a=-n.scrollTop;return tn(r).direction==="rtl"&&(s+=Jn(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}function lE(e,t){const n=Mt(e),r=pn(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=Pa();(!c||c&&t==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:a,y:l}}function cE(e,t){const n=Zn(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=cn(e)?mr(e):Pn(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 qc(e,t,n){let r;if(t==="viewport")r=lE(e,n);else if(t==="document")r=aE(pn(e));else if(en(t))r=cE(t,n);else{const i=Uf(e);r={...t,x:t.x-i.x,y:t.y-i.y}}return ao(r)}function qf(e,t){const n=Dn(e);return n===t||!en(n)||xr(n)?!1:tn(n).position==="fixed"||qf(n,t)}function uE(e,t){const n=t.get(e);if(n)return n;let r=si(e,[],!1).filter(a=>en(a)&&Pr(a)!=="body"),i=null;const o=tn(e).position==="fixed";let s=o?Dn(e):e;for(;en(s)&&!xr(s);){const a=tn(s),l=Fa(s);!l&&a.position==="fixed"&&(i=null),(o?!l&&!i:!l&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||mi(s)&&!l&&qf(e,s))?r=r.filter(u=>u!==s):i=a,s=Dn(s)}return t.set(e,r),r}function dE(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const s=[...n==="clippingAncestors"?Co(t)?[]:uE(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{const d=qc(t,u,i);return c.top=Jn(d.top,c.top),c.right=br(d.right,c.right),c.bottom=br(d.bottom,c.bottom),c.left=Jn(d.left,c.left),c},qc(t,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function fE(e){const{width:t,height:n}=Vf(e);return{width:t,height:n}}function pE(e,t,n){const r=cn(t),i=pn(t),o=n==="fixed",s=Zn(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=Pn(0);if(r||!r&&!o)if((Pr(t)!=="body"||mi(i))&&(a=Oo(t)),r){const f=Zn(t,!0,o,t);l.x=f.x+t.clientLeft,l.y=f.y+t.clientTop}else i&&(l.x=Ks(i));let c=0,u=0;if(i&&!r&&!o){const f=i.getBoundingClientRect();u=f.top+a.scrollTop,c=f.left+a.scrollLeft-Ks(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 is(e){return tn(e).position==="static"}function $c(e,t){if(!cn(e)||tn(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return pn(e)===n&&(n=n.ownerDocument.body),n}function $f(e,t){const n=Mt(e);if(Co(e))return n;if(!cn(e)){let i=Dn(e);for(;i&&!xr(i);){if(en(i)&&!is(i))return i;i=Dn(i)}return n}let r=$c(e,t);for(;r&&tE(r)&&is(r);)r=$c(r,t);return r&&xr(r)&&is(r)&&!Fa(r)?n:r||nE(e)||n}const hE=async function(e){const t=this.getOffsetParent||$f,n=this.getDimensions,r=await n(e.floating);return{reference:pE(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function mE(e){return tn(e).direction==="rtl"}const gE={convertOffsetParentRelativeRectToViewportRelativeRect:oE,getDocumentElement:pn,getClippingRect:dE,getOffsetParent:$f,getElementRects:hE,getClientRects:sE,getDimensions:fE,getScale:mr,isElement:en,isRTL:mE};function yE(e,t){let n=null,r;const i=pn(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=ji(u),y=ji(i.clientWidth-(c+d)),v=ji(i.clientHeight-(u+h)),g=ji(c),m={rootMargin:-f+"px "+-y+"px "+-v+"px "+-g+"px",threshold:Jn(0,br(1,l))||1};let b=!0;function C(E){const _=E[0].intersectionRatio;if(_!==l){if(!b)return s();_?s(!1,_):r=setTimeout(()=>{s(!1,1e-7)},1e3)}b=!1}try{n=new IntersectionObserver(C,{...m,root:i.ownerDocument})}catch{n=new IntersectionObserver(C,m)}n.observe(e)}return s(!0),o}function vE(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=Da(e),u=i||o?[...c?si(c):[],...si(t)]:[];u.forEach(w=>{i&&w.addEventListener("scroll",n,{passive:!0}),o&&w.addEventListener("resize",n)});const d=c&&a?yE(c,n):null;let h=-1,f=null;s&&(f=new ResizeObserver(w=>{let[m]=w;m&&m.target===c&&f&&(f.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var b;(b=f)==null||b.observe(t)})),n()}),c&&!l&&f.observe(c),f.observe(t));let y,v=l?Zn(e):null;l&&g();function g(){const w=Zn(e);v&&(w.x!==v.x||w.y!==v.y||w.width!==v.width||w.height!==v.height)&&n(),v=w,y=requestAnimationFrame(g)}return n(),()=>{var w;u.forEach(m=>{i&&m.removeEventListener("scroll",n),o&&m.removeEventListener("resize",n)}),d?.(),(w=f)==null||w.disconnect(),f=null,l&&cancelAnimationFrame(y)}}const bE=ZO,wE=eE,xE=XO,IE=GO,zc=(e,t,n)=>{const r=new Map,i={platform:gE,...n},o={...i.platform,_c:r};return QO(e,t,{...i,platform:o})};const SE="react-tooltip-core-styles",CE="react-tooltip-base-styles",Kc={core:!1,base:!1};function Hc({css:e,id:t=CE,type:n="base",ref:r}){var i,o;if(!e||typeof document>"u"||Kc[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=SE),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)),Kc[n]=!0}const Jc=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:i=10,strategy:o="absolute",middlewares:s=[bE(Number(i)),xE({fallbackAxisSideDirection:"start"}),wE({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(IE({element:n,padding:5})),zc(e,t,{placement:r,strategy:o,middleware:c}).then((({x:u,y:d,placement:h,middlewareData:f})=>{var y,v;const g={left:`${u}px`,top:`${d}px`,border:a},{x:w,y:m}=(y=f.arrow)!==null&&y!==void 0?y:{x:0,y:0},b=(v={top:"bottom",right:"left",bottom:"top",left:"right"}[h.split("-")[0]])!==null&&v!==void 0?v:"bottom",C=a&&{borderBottom:a,borderRight:a};let E=0;if(a){const _=`${a}`.match(/(\d+)px/);E=_?.[1]?Number(_[1]):1}return{tooltipStyles:g,tooltipArrowStyles:{left:w!=null?`${w}px`:"",top:m!=null?`${m}px`:"",right:"",bottom:"",...C,[b]:`-${l/2+E}px`},place:h}}))):zc(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})))},Wc=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),Qc=(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},Gc=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",Hs=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every(((i,o)=>Hs(i,t[o])));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Gc(e)||!Gc(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every((i=>Hs(e[i],t[i])))},OE=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"}))},Xc=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(OE(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},EE=typeof window<"u"?I.useLayoutEffect:I.useEffect,zt=e=>{e.current&&(clearTimeout(e.current),e.current=null)},_E="DEFAULT_TOOLTIP_ID",NE={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},TE=I.createContext({getTooltipData:()=>NE});function zf(e=_E){return I.useContext(TE).getTooltipData(e)}var dr={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"},os={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 kE=({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:v=0,float:g=!1,hidden:w=!1,noArrow:m=!1,clickable:b=!1,closeOnEsc:C=!1,closeOnScroll:E=!1,closeOnResize:_=!1,openEvents:A,closeEvents:k,globalCloseEvents:L,imperativeModeOnly:M,style:F,position:j,afterShow:G,afterHide:P,disableTooltip:V,content:Y,contentWrapperRef:le,isOpen:pe,defaultIsOpen:ge=!1,setIsOpen:x,previousActiveAnchor:J,activeAnchor:B,setActiveAnchor:S,border:$,opacity:q,arrowColor:X,arrowSize:ie=8,role:ne="tooltip"})=>{var se;const ee=I.useRef(null),me=I.useRef(null),U=I.useRef(null),ye=I.useRef(null),Z=I.useRef(null),[Be,Fe]=I.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[Ae,We]=I.useState(!1),[et,tt]=I.useState(!1),[xe,ot]=I.useState(null),bt=I.useRef(!1),at=I.useRef(null),{anchorRefs:Ge,setActiveAnchor:D}=zf(t),K=I.useRef(!1),[R,re]=I.useState([]),ce=I.useRef(!1),qe=u||c.includes("click"),wt=qe||A?.click||A?.dblclick||A?.mousedown,lt=A?{...A}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!A&&qe&&Object.assign(lt,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const ft=k?{...k}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!k&&qe&&Object.assign(ft,{mouseleave:!1,blur:!1,mouseout:!1});const Pe=L?{...L}:{escape:C||!1,scroll:E||!1,resize:_||!1,clickOutsideAnchor:wt||!1};M&&(Object.assign(lt,{mouseover:!1,focus:!1,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(ft,{mouseout:!1,blur:!1,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(Pe,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),EE((()=>(ce.current=!0,()=>{ce.current=!1})),[]);const Oe=te=>{ce.current&&(te&&tt(!0),setTimeout((()=>{ce.current&&(x?.(te),pe===void 0&&We(te))}),10))};I.useEffect((()=>{if(t){if(Ae){fe(J);const ue=te(B),Ce=[...new Set([...ue,t])].filter(Boolean).join(" ");B?.setAttribute("aria-describedby",Ce)}else fe(B);return()=>{fe(B),fe(J)}}function te(ue){var Ce;return((Ce=ue?.getAttribute("aria-describedby"))===null||Ce===void 0?void 0:Ce.split(" "))||[]}function fe(ue){const Ce=te(ue).filter((De=>De!==t));Ce.length?ue?.setAttribute("aria-describedby",Ce.join(" ")):ue?.removeAttribute("aria-describedby")}}),[B,Ae,t,J]),I.useEffect((()=>{if(pe===void 0)return()=>null;pe&&tt(!0);const te=setTimeout((()=>{We(pe)}),10);return()=>{clearTimeout(te)}}),[pe]),I.useEffect((()=>{if(Ae!==bt.current)if(zt(Z),bt.current=Ae,Ae)G?.();else{const te=(fe=>{const ue=fe.match(/^([\d.]+)(ms|s)$/);if(!ue)return 0;const[,Ce,De]=ue;return Number(Ce)*(De==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));Z.current=setTimeout((()=>{tt(!1),ot(null),P?.()}),te+25)}}),[Ae]);const xt=te=>{Fe((fe=>Hs(fe,te)?fe:te))},ct=(te=y)=>{zt(U),et?Oe(!0):U.current=setTimeout((()=>{Oe(!0)}),te)},Ot=(te=v)=>{zt(ye),ye.current=setTimeout((()=>{K.current||Oe(!1)}),te)},In=te=>{var fe;if(!te)return;const ue=(fe=te.currentTarget)!==null&&fe!==void 0?fe:te.target;if(!ue?.isConnected)return S(null),void D({current:null});y?ct():Oe(!0),S(ue),D({current:ue}),zt(ye)},Sn=()=>{b?Ot(v||100):v?Ot():Oe(!1),zt(U)},Cn=({x:te,y:fe})=>{var ue;const Ce={getBoundingClientRect:()=>({x:te,y:fe,width:0,height:0,top:fe,left:te,right:te,bottom:fe})};Jc({place:(ue=xe?.place)!==null&&ue!==void 0?ue:a,offset:l,elementReference:Ce,tooltipReference:ee.current,tooltipArrowReference:me.current,strategy:d,middlewares:h,border:$,arrowSize:ie}).then((De=>{xt(De)}))},nn=te=>{if(!te)return;const fe=te,ue={x:fe.clientX,y:fe.clientY};Cn(ue),at.current=ue},Qt=te=>{var fe;if(!Ae)return;const ue=te.target;ue.isConnected&&(!((fe=ee.current)===null||fe===void 0)&&fe.contains(ue)||[document.querySelector(`[id='${o}']`),...R].some((Ce=>Ce?.contains(ue)))||(Oe(!1),zt(U)))},On=Qc(In,50),$e=Qc(Sn,50),nt=te=>{$e.cancel(),On(te)},de=()=>{On.cancel(),$e()},Se=I.useCallback((()=>{var te,fe;const ue=(te=xe?.position)!==null&&te!==void 0?te:j;ue?Cn(ue):g?at.current&&Cn(at.current):B?.isConnected&&Jc({place:(fe=xe?.place)!==null&&fe!==void 0?fe:a,offset:l,elementReference:B,tooltipReference:ee.current,tooltipArrowReference:me.current,strategy:d,middlewares:h,border:$,arrowSize:ie}).then((Ce=>{ce.current&&xt(Ce)}))}),[Ae,B,Y,F,a,xe?.place,l,d,j,xe?.position,g,ie]);I.useEffect((()=>{var te,fe;const ue=new Set(Ge);R.forEach((Ee=>{V?.(Ee)||ue.add({current:Ee})}));const Ce=document.querySelector(`[id='${o}']`);Ce&&!V?.(Ce)&&ue.add({current:Ce});const De=()=>{Oe(!1)},Vt=Xc(B),Ut=Xc(ee.current);Pe.scroll&&(window.addEventListener("scroll",De),Vt?.addEventListener("scroll",De),Ut?.addEventListener("scroll",De));let ut=null;Pe.resize?window.addEventListener("resize",De):B&&ee.current&&(ut=vE(B,ee.current,Se,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const Et=Ee=>{Ee.key==="Escape"&&Oe(!1)};Pe.escape&&window.addEventListener("keydown",Et),Pe.clickOutsideAnchor&&window.addEventListener("click",Qt);const Me=[],pt=Ee=>!!(Ee?.target&&B?.contains(Ee.target)),Fo=Ee=>{Ae&&pt(Ee)||In(Ee)},Po=Ee=>{Ae&&pt(Ee)&&Sn()},wi=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],xi=["click","dblclick","mousedown","mouseup"];Object.entries(lt).forEach((([Ee,Gt])=>{Gt&&(wi.includes(Ee)?Me.push({event:Ee,listener:nt}):xi.includes(Ee)&&Me.push({event:Ee,listener:Fo}))})),Object.entries(ft).forEach((([Ee,Gt])=>{Gt&&(wi.includes(Ee)?Me.push({event:Ee,listener:de}):xi.includes(Ee)&&Me.push({event:Ee,listener:Po}))})),g&&Me.push({event:"pointermove",listener:nn});const Ii=()=>{K.current=!0},rn=()=>{K.current=!1,Sn()},Si=b&&(ft.mouseout||ft.mouseleave);return Si&&((te=ee.current)===null||te===void 0||te.addEventListener("mouseover",Ii),(fe=ee.current)===null||fe===void 0||fe.addEventListener("mouseout",rn)),Me.forEach((({event:Ee,listener:Gt})=>{ue.forEach((Dr=>{var Bn;(Bn=Dr.current)===null||Bn===void 0||Bn.addEventListener(Ee,Gt)}))})),()=>{var Ee,Gt;Pe.scroll&&(window.removeEventListener("scroll",De),Vt?.removeEventListener("scroll",De),Ut?.removeEventListener("scroll",De)),Pe.resize?window.removeEventListener("resize",De):ut?.(),Pe.clickOutsideAnchor&&window.removeEventListener("click",Qt),Pe.escape&&window.removeEventListener("keydown",Et),Si&&((Ee=ee.current)===null||Ee===void 0||Ee.removeEventListener("mouseover",Ii),(Gt=ee.current)===null||Gt===void 0||Gt.removeEventListener("mouseout",rn)),Me.forEach((({event:Dr,listener:Bn})=>{ue.forEach((sr=>{var Mr;(Mr=sr.current)===null||Mr===void 0||Mr.removeEventListener(Dr,Bn)}))}))}}),[B,Se,et,Ge,R,A,k,L,qe,y,v]),I.useEffect((()=>{var te,fe;let ue=(fe=(te=xe?.anchorSelect)!==null&&te!==void 0?te:s)!==null&&fe!==void 0?fe:"";!ue&&t&&(ue=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const Ce=new MutationObserver((De=>{const Vt=[],Ut=[];De.forEach((ut=>{if(ut.type==="attributes"&&ut.attributeName==="data-tooltip-id"&&(ut.target.getAttribute("data-tooltip-id")===t?Vt.push(ut.target):ut.oldValue===t&&Ut.push(ut.target)),ut.type==="childList"){if(B){const Et=[...ut.removedNodes].filter((Me=>Me.nodeType===1));if(ue)try{Ut.push(...Et.filter((Me=>Me.matches(ue)))),Ut.push(...Et.flatMap((Me=>[...Me.querySelectorAll(ue)])))}catch{}Et.some((Me=>{var pt;return!!(!((pt=Me?.contains)===null||pt===void 0)&&pt.call(Me,B))&&(tt(!1),Oe(!1),S(null),zt(U),zt(ye),!0)}))}if(ue)try{const Et=[...ut.addedNodes].filter((Me=>Me.nodeType===1));Vt.push(...Et.filter((Me=>Me.matches(ue)))),Vt.push(...Et.flatMap((Me=>[...Me.querySelectorAll(ue)])))}catch{}}})),(Vt.length||Ut.length)&&re((ut=>[...ut.filter((Et=>!Ut.includes(Et))),...Vt]))}));return Ce.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{Ce.disconnect()}}),[t,s,xe?.anchorSelect,B]),I.useEffect((()=>{Se()}),[Se]),I.useEffect((()=>{if(!le?.current)return()=>null;const te=new ResizeObserver((()=>{setTimeout((()=>Se()))}));return te.observe(le.current),()=>{te.disconnect()}}),[Y,le?.current]),I.useEffect((()=>{var te;const fe=document.querySelector(`[id='${o}']`),ue=[...R,fe];B&&ue.includes(B)||S((te=R[0])!==null&&te!==void 0?te:fe)}),[o,R,B]),I.useEffect((()=>(ge&&Oe(!0),()=>{zt(U),zt(ye)})),[]),I.useEffect((()=>{var te;let fe=(te=xe?.anchorSelect)!==null&&te!==void 0?te:s;if(!fe&&t&&(fe=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),fe)try{const ue=Array.from(document.querySelectorAll(fe));re(ue)}catch{re([])}}),[t,s,xe?.anchorSelect]),I.useEffect((()=>{U.current&&(zt(U),ct(y))}),[y]);const It=(se=xe?.content)!==null&&se!==void 0?se:Y,hn=Ae&&Object.keys(Be.tooltipStyles).length>0;return I.useImperativeHandle(e,(()=>({open:te=>{if(te?.anchorSelect)try{document.querySelector(te.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${te.anchorSelect}" is not a valid CSS selector`)}ot(te??null),te?.delay?ct(te.delay):Oe(!0)},close:te=>{te?.delay?Ot(te.delay):Oe(!1)},activeAnchor:B,place:Be.place,isOpen:!!(et&&!w&&It&&hn)}))),et&&!w&&It?I.createElement(f,{id:t,role:ne,className:Jt("react-tooltip",dr.tooltip,os.tooltip,os[i],n,`react-tooltip__place-${Be.place}`,dr[hn?"show":"closing"],hn?"react-tooltip__show":"react-tooltip__closing",d==="fixed"&&dr.fixed,b&&dr.clickable),onTransitionEnd:te=>{zt(Z),Ae||te.propertyName!=="opacity"||(tt(!1),ot(null),P?.())},style:{...F,...Be.tooltipStyles,opacity:q!==void 0&&hn?q:void 0},ref:ee},It,I.createElement(f,{className:Jt("react-tooltip-arrow",dr.arrow,os.arrow,r,m&&dr.noArrow),style:{...Be.tooltipArrowStyles,background:X?`linear-gradient(to right bottom, transparent 50%, ${X} 50%)`:void 0,"--rt-arrow-size":`${ie}px`},ref:me})):null},RE=({content:e})=>I.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),AE=I.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:v="absolute",middlewares:g,delayShow:w=0,delayHide:m=0,float:b=!1,hidden:C=!1,noArrow:E=!1,clickable:_=!1,closeOnEsc:A=!1,closeOnScroll:k=!1,closeOnResize:L=!1,openEvents:M,closeEvents:F,globalCloseEvents:j,imperativeModeOnly:G=!1,style:P,position:V,isOpen:Y,defaultIsOpen:le=!1,disableStyleInjection:pe=!1,border:ge,opacity:x,arrowColor:J,arrowSize:B,setIsOpen:S,afterShow:$,afterHide:q,disableTooltip:X,role:ie="tooltip"},ne)=>{const[se,ee]=I.useState(r),[me,U]=I.useState(i),[ye,Z]=I.useState(c),[Be,Fe]=I.useState(l),[Ae,We]=I.useState(u),[et,tt]=I.useState(w),[xe,ot]=I.useState(m),[bt,at]=I.useState(b),[Ge,D]=I.useState(C),[K,R]=I.useState(d),[re,ce]=I.useState(f),[qe,wt]=I.useState(v),[lt,ft]=I.useState(null),[Pe,Oe]=I.useState(null),xt=I.useRef(null),ct=I.useRef(pe),{anchorRefs:Ot,activeAnchor:In}=zf(e),Sn=$e=>$e?.getAttributeNames().reduce(((nt,de)=>{var Se;return de.startsWith("data-tooltip-")&&(nt[de.replace(/^data-tooltip-/,"")]=(Se=$e?.getAttribute(de))!==null&&Se!==void 0?Se:null),nt}),{}),Cn=$e=>{const nt={place:de=>{var Se;Z((Se=de)!==null&&Se!==void 0?Se:c)},content:de=>{ee(de??r)},html:de=>{U(de??i)},variant:de=>{var Se;Fe((Se=de)!==null&&Se!==void 0?Se:l)},offset:de=>{We(de===null?u:Number(de))},wrapper:de=>{var Se;R((Se=de)!==null&&Se!==void 0?Se:d)},events:de=>{const Se=de?.split(" ");ce(Se??f)},"position-strategy":de=>{var Se;wt((Se=de)!==null&&Se!==void 0?Se:v)},"delay-show":de=>{tt(de===null?w:Number(de))},"delay-hide":de=>{ot(de===null?m:Number(de))},float:de=>{at(de===null?b:de==="true")},hidden:de=>{D(de===null?C:de==="true")},"class-name":de=>{ft(de)}};Object.values(nt).forEach((de=>de(null))),Object.entries($e).forEach((([de,Se])=>{var It;(It=nt[de])===null||It===void 0||It.call(nt,Se)}))};I.useEffect((()=>{ee(r)}),[r]),I.useEffect((()=>{U(i)}),[i]),I.useEffect((()=>{Z(c)}),[c]),I.useEffect((()=>{Fe(l)}),[l]),I.useEffect((()=>{We(u)}),[u]),I.useEffect((()=>{tt(w)}),[w]),I.useEffect((()=>{ot(m)}),[m]),I.useEffect((()=>{at(b)}),[b]),I.useEffect((()=>{D(C)}),[C]),I.useEffect((()=>{wt(v)}),[v]),I.useEffect((()=>{ct.current!==pe&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")}),[pe]),I.useEffect((()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:pe==="core",disableBase:pe}}))}),[]),I.useEffect((()=>{var $e;const nt=new Set(Ot);let de=n;if(!de&&e&&(de=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),de)try{document.querySelectorAll(de).forEach((fe=>{nt.add({current:fe})}))}catch{console.warn(`[react-tooltip] "${de}" is not a valid CSS selector`)}const Se=document.querySelector(`[id='${t}']`);if(Se&&nt.add({current:Se}),!nt.size)return()=>null;const It=($e=Pe??Se)!==null&&$e!==void 0?$e:In.current,hn=new MutationObserver((fe=>{fe.forEach((ue=>{var Ce;if(!It||ue.type!=="attributes"||!(!((Ce=ue.attributeName)===null||Ce===void 0)&&Ce.startsWith("data-tooltip-")))return;const De=Sn(It);Cn(De)}))})),te={attributes:!0,childList:!1,subtree:!1};if(It){const fe=Sn(It);Cn(fe),hn.observe(It,te)}return()=>{hn.disconnect()}}),[Ot,In,Pe,t,n]),I.useEffect((()=>{P?.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),ge&&!Wc("border",`${ge}`)&&console.warn(`[react-tooltip] "${ge}" is not a valid \`border\`.`),P?.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),x&&!Wc("opacity",`${x}`)&&console.warn(`[react-tooltip] "${x}" is not a valid \`opacity\`.`)}),[]);let nn=h;const Qt=I.useRef(null);if(o){const $e=o({content:Pe?.getAttribute("data-tooltip-content")||se||null,activeAnchor:Pe});nn=$e?I.createElement("div",{ref:Qt,className:"react-tooltip-content-wrapper"},$e):null}else se&&(nn=se);me&&(nn=I.createElement(RE,{content:me}));const On={forwardRef:ne,id:e,anchorId:t,anchorSelect:n,className:Jt(s,lt),classNameArrow:a,content:nn,contentWrapperRef:Qt,place:ye,variant:Be,offset:Ae,wrapper:K,events:re,openOnClick:y,positionStrategy:qe,middlewares:g,delayShow:et,delayHide:xe,float:bt,hidden:Ge,noArrow:E,clickable:_,closeOnEsc:A,closeOnScroll:k,closeOnResize:L,openEvents:M,closeEvents:F,globalCloseEvents:j,imperativeModeOnly:G,style:P,position:V,isOpen:Y,defaultIsOpen:le,border:ge,opacity:x,arrowColor:J,arrowSize:B,setIsOpen:S,afterShow:$,afterHide:q,disableTooltip:X,activeAnchor:Pe,previousActiveAnchor:xt.current,setActiveAnchor:$e=>{Oe((nt=>($e?.isSameNode(nt)||(xt.current=nt),$e)))},role:ie};return I.createElement(kE,{...On})}));typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",(e=>{e.detail.disableCore||Hc({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||Hc({css:`
|
|
20
|
+
.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 FE(){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 Kf({id:e,tooltipText:t}){return p.jsxs(p.Fragment,{children:[p.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:FE()}),p.jsx(AE,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}function Hf({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(Yd,{href:e,newTab:!0,children:p.jsx("span",{style:{textDecoration:"underline"},children:n})}):p.jsx("span",{children:n})," ",t&&p.jsx(Kf,{id:`docs-helper-text-${Mx(n||t?.slice(0,50))}`,tooltipText:t})]})})}const PE="_metadataInputWrapper_1266b_1",DE={metadataInputWrapper:PE};function gi({metadata:e,onChange:t,providerName:n,variant:r="standard"}){return p.jsxs("div",{className:DE.metadataInputWrapper,children:[e.docsURL&&r==="standard"&&p.jsx(ka,{url:e.docsURL,providerDisplayName:n||"",credentialName:e.displayName||Wt(e.name.toLowerCase()),prompt:e.prompt}),r==="header"&&p.jsx(Hf,{url:e.docsURL,prompt:e.prompt,inputName:e.displayName||e.name}),p.jsx(yn.Input,{id:e.name,name:e.name,type:"text",placeholder:e.displayName||e.name,onChange:t})]})}function Eo(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 Ir(e,t){return e.every(n=>{const r=t[n.name];return r&&r.trim()!==""})}function ME(e,t){const n=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?.name}`}}function jE(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 Jf({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:i,submitButtonType:o,metadataInputs:s}){const[a,l]=I.useState({apiKey:""}),c=w=>{const{name:m,value:b}=w.currentTarget;l(C=>({...C,[m]:b.trim()}))},{apiKey:u}=a,{providerName:d}=yt(e),h=u.length>0,f=Ir(s,a),y=r||!h||!f,v=t.apiKeyOpts?.docsURL,g=()=>{const w=Eo(s,a);n({apiKey:u,providerMetadata:w})};return p.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[v&&p.jsx(ka,{url:v,providerDisplayName:d||Wt(e),credentialName:"API key"}),p.jsx(yn.PasswordInput,{id:"apiKey",name:"apiKey",placeholder:"API Key",onChange:c}),s.map(w=>p.jsx(gi,{metadata:w,onChange:c,providerName:d||Wt(e)},w.name)),p.jsx(Je,{style:{marginTop:"1em",width:"100%"},disabled:y,type:o||"submit",onClick:g,variant:i,children:"Next"})]})}function LE({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i,metadataInputs:o}){const{providerName:s}=yt(e);return p.jsxs(nr,{children:[p.jsx(rr,{children:`Set up ${s} integration`}),p.jsx(wn,{error:r}),p.jsx(Jf,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:i||!!r,metadataInputs:o})]})}function BE({...e}){return p.jsx(LE,{...e})}const VE={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 yi({children:e,style:t}){return p.jsx(bn,{style:{...VE,...t},children:e})}const Ma=()=>{const e=mt(),t=Ze(),[n,r]=I.useState(null);return{...vn({mutationKey:["updateConnection"],mutationFn:async o=>(await e()).connectionApi.updateConnection(o),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)}}),errorMsg:n}},UE="_divider_1kmoj_1",Yc={divider:UE};function _o({className:e,style:t}){return p.jsx("hr",{className:e?`${Yc.divider} ${e}`:Yc.divider,style:t})}function Lt({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(_o,{style:{width:"100%",marginLeft:"1rem"}})})]})}function qE({provider:e}){const{projectIdOrName:t}=Ke(),{providerName:n,data:r}=yt(e),{selectedConnection:i,isConnectionsLoading:o}=fn(),{mutateAsync:s,isPending:a,error:l}=Ma(),[c,u]=I.useState(null),[d,h]=I.useState(!1),f=()=>h(!1),y=()=>{h(!0),u(null)},v=l?.message||c||null,g=async w=>{f(),u(null);try{await s({projectIdOrName:t||"",connectionId:i?.id||"",updateConnectionRequest:{updateMask:["apiKey"],connection:{apiKey:w.apiKey}}},{onError:m=>{console.error("Update connection error:",m),Ye(m,u)},onSuccess:()=>{y()}})}catch(m){console.error("Update connection caught error:",m),Ye(m,u)}};return r?p.jsxs(p.Fragment,{children:[p.jsx(Lt,{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(yi,{children:"Connection updated successfully"}),v&&p.jsx(ui,{children:`Error updating connection ${v}`}),p.jsx(Jf,{provider:r?.name,providerInfo:r,handleSubmit:g,isButtonDisabled:a||o,buttonVariant:"ghost",submitButtonType:"button",metadataInputs:[]})]})]}):null}function Wf({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:i,metadataInputs:o}){const[s,a]=I.useState({username:"",password:""}),{username:l,password:c}=s,{providerName:u}=yt(e),d=g=>{const{name:w,value:m}=g.currentTarget;a(b=>({...b,[w]:m.trim()}))},h=Ir(o,s),f=r||!h,y=()=>{const g=Eo(o,s);n({user:l,pass:c,providerMetadata:g})},v=t.basicOpts?.docsURL;return p.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[v&&p.jsx(ka,{url:v,providerDisplayName:u||Wt(e),credentialName:"credentials"}),p.jsx(yn.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:d}),p.jsx(yn.PasswordInput,{id:"password",name:"password",placeholder:"Password",onChange:d}),o.map(g=>p.jsx(gi,{metadata:g,onChange:d,providerName:u||Wt(e)},g.name)),p.jsx(Je,{style:{marginTop:"1em",width:"100%"},disabled:f,type:"button",onClick:y,variant:i,children:"Next"})]})}function $E({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i,metadataInputs:o}){const{providerName:s}=yt(e);return p.jsxs(nr,{children:[p.jsx(rr,{children:`Set up ${s} integration`}),p.jsx(wn,{error:r}),p.jsx(Wf,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:i||!!r,metadataInputs:o})]})}function zE({...e}){return p.jsx($E,{...e})}function KE({provider:e}){const{projectIdOrName:t}=Ke(),{providerName:n,data:r}=yt(e),{selectedConnection:i,isConnectionsLoading:o}=fn(),{mutateAsync:s,isPending:a,error:l}=Ma(),[c,u]=I.useState(null),[d,h]=I.useState(!1),f=()=>h(!1),y=()=>{h(!0),u(null)},v=l?.message||c||null,g=async w=>{f(),u(null);try{await s({projectIdOrName:t||"",connectionId:i?.id||"",updateConnectionRequest:{updateMask:["basicAuth"],connection:{basicAuth:{username:w.user,password:w.pass}}}},{onError:m=>{console.error(m),Ye(m,u)},onSuccess:()=>{y()}})}catch(m){console.error(m),Ye(m,u)}};return r?p.jsxs(p.Fragment,{children:[p.jsx(Lt,{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(yi,{children:"Connection updated successfully"}),v&&p.jsx(ui,{children:`Error updating connection: ${v}`}),p.jsx(Wf,{provider:r?.name,providerInfo:r,handleSubmit:g,isButtonDisabled:a||o,buttonVariant:"ghost",metadataInputs:[]})]})]}):null}function Qf({handleSubmit:e,isButtonDisabled:t,explicitScopesRequired:n,buttonVariant:r,metadataInputs:i,providerName:o}){const[s,a]=I.useState({clientSecret:"",clientId:"",scopes:""}),[l,c]=I.useState(null),u=b=>{const{name:C,value:E}=b.currentTarget;a(_=>({..._,[C]:E.trim()})),c(null)},{clientSecret:d,clientId:h,scopes:f}=s,y=d.length>0,v=h.length>0,g=Ir(i,s),w=t||!y||!v||!g,m=()=>{const b=Eo(i,s),C={clientId:h,clientSecret:d,providerMetadata:b};n&&f.length>0&&(C.scopes=Px(f)),e(C)};return p.jsxs(p.Fragment,{children:[p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[p.jsx(yn.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:u}),p.jsx(yn.PasswordInput,{id:"clientSecret",name:"clientSecret",placeholder:"Client Secret",onChange:u}),n&&p.jsx(yn.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:u}),i.map(b=>p.jsx(gi,{metadata:b,onChange:u,providerName:o},b.name))]}),p.jsx(wn,{error:l}),p.jsx("br",{}),p.jsx(Je,{style:{width:"100%"},disabled:w,type:"button",onClick:m,variant:r,children:"Next"})]})}function HE({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,explicitScopesRequired:i,metadataInputs:o}){return p.jsxs(nr,{children:[p.jsx(rr,{children:`Set up ${r} integration`}),p.jsx(wn,{error:t}),p.jsx("br",{}),p.jsx(Qf,{handleSubmit:e,isButtonDisabled:n||!!t,explicitScopesRequired:i,metadataInputs:o,providerName:r})]})}function JE({provider:e}){const{projectIdOrName:t}=Ke(),{selectedConnection:n,isConnectionsLoading:r}=fn(),{providerName:i,data:o}=yt(e),{mutateAsync:s,isPending:a,error:l}=Ma(),[c,u]=I.useState(null),[d,h]=I.useState(!1),f=()=>{h(!1)},y=()=>{h(!0),u(null)},v=o?.oauth2Opts?.explicitScopesRequired,g=l?.message||c||null,w=async m=>{f(),u(null);try{await s({projectIdOrName:t||"",connectionId:n?.id||"",updateConnectionRequest:{updateMask:["oauth2ClientCredentials"],connection:{oauth2ClientCredentials:{clientId:m.clientId,clientSecret:m.clientSecret,scopes:m.scopes}}}}),y()}catch(b){Ye(b,u)}};return p.jsxs(p.Fragment,{children:[p.jsx(Lt,{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(yi,{children:"Connection updated successfully"}),g&&p.jsx(ui,{children:`Error updating connection ${g}`}),p.jsx(Qf,{handleSubmit:w,isButtonDisabled:a||r,explicitScopesRequired:v,buttonVariant:"ghost",metadataInputs:[]})]})]})}const Zc=600,eu=600,WE="AUTHORIZATION_SUCCEEDED",QE="AUTHORIZATION_FAILED";function GE(e,t,n,r){return I.useCallback(()=>{if(!r)return;const i=window.screenX+(window.outerWidth-Zc)/2,o=window.screenY+(window.outerHeight-eu)/2.5,s=`width=${Zc},height=${eu},left=${i},top=${o}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function XE(e,t,n,r){const i=Ze();return I.useCallback(o=>{if(o.origin===gd){if(o.data.eventType===WE){const s=o.data.data?.connection;s?(e(s),i.setQueriesData({queryKey:["amp","connections"]},()=>[s]),t?.close(),r?.(),i.invalidateQueries({queryKey:["amp","connections"]})):console.error("Connection ID not found in event data: ",{event:o})}o.data.eventType===QE&&(console.error("OAuth failed: ",{event:o}),n?.(o?.data?.message??"Something went wrong, try refreshing this page, and then try again."))}},[t,n,i,e,r])}function YE({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:i,onSuccessConnect:o,isSuccessConnect:s,onWindowClose:a}){const[l,c]=I.useState(null),[u,d]=I.useState(null),h=Ze(),f=I.useRef(null),y=XE(c,u,r,o),v=GE(n,d,y,t);I.useEffect(()=>{t&&!u&&!l&&!i&&!s&&(r?.(null),v())},[t,u,v,l,i,s,r]);const g=I.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),a?.()},[l,i,r,a,h]);return I.useEffect(()=>{if(u)return f.current=setInterval(()=>{u?.closed&&(f.current&&clearInterval(f.current),f.current=null,g())},500),()=>{f.current&&(clearInterval(f.current),f.current=null),window.removeEventListener("message",y)}},[g,u,y]),p.jsx("div",{children:e})}const ZE=()=>{const e=mt(),t=Ze();return vn({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 e_({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(wn,{error:t}),p.jsx(Je,{variant:"ghost",style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function t_({provider:e}){const{selectedConnection:t,isConnectionsLoading:n}=fn(),r=t?.id,i=t?.projectId,{providerName:o}=yt(e),{mutateAsync:s,isPending:a,error:l}=ZE(),[c,u]=I.useState(null),[d,h]=I.useState(!1),[f,y]=I.useState(null),v=()=>{h(!1)},g=()=>{h(!0),u(null),y(null)},w=l?.message||c||null,m=async()=>{v(),u(null);try{const C=await s({projectIdOrName:i||"",connectionId:r||""});y(C)}catch(C){Ye(C,u)}},b=I.useCallback(C=>{u(C)},[]);return p.jsxs(p.Fragment,{children:[p.jsx(Lt,{string:"Update connection"}),d&&p.jsx(yi,{children:"Connection updated successfully"}),p.jsx(YE,{windowTitle:`Connect to ${o}`,oauthUrl:f||null,onError:b,error:w,isSuccessConnect:d,onSuccessConnect:g,children:p.jsx(e_,{handleSubmit:m,error:w,providerName:o,isButtonDisabled:a||n||d})})]})}function ja({provider:e}){const{data:t}=Qd(e);if(t?.authType===El.Basic)return p.jsx(KE,{provider:e});if(t?.authType===El.ApiKey)return p.jsx(qE,{provider:e});const n=t?.oauth2Opts?.grantType;if(n){if(n===Lo.AuthorizationCode||n===Lo.AuthorizationCodePkce)return p.jsx(t_,{provider:e});if(n===Lo.ClientCredentials)return p.jsx(JE,{provider:e})}return null}const n_=()=>{const e=mt(),t=Ze();return vn({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."),Ye(n)}})};function La({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const{projectIdOrName:r}=Ke(),{integrationId:i,installation:o,setIntegrationDeleted:s,onUninstallSuccess:a}=gt(),[l,c]=I.useState(!1),u=!r||!i||!o?.id||l,d=n_(),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?.(o?.id),s()},onSettled:()=>c(!1)}))},f=l?"Uninstalling...":e,y=p.jsx(Je,{type:"button",onClick:h,disabled:u,variant:t,style:n,children:f});return o?.id?y:null}const r_=()=>{const e=mt(),t=Ze(),[n,r]=I.useState(null);return{...vn({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"),Ye(o,r)}}),errorMsg:n}};function Gf({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:i,onDisconnectError:o}){const{projectIdOrName:s}=Ke(),{selectedConnection:a}=fn(),{mutate:l,isPending:c}=r_(),u=!s||!a||!a.id||c,d=async()=>{u||(console.warn("deleting connection",{projectIdOrName:s,connectionId:a?.id}),l({projectIdOrName:s,connectionId:a?.id},{onSuccess:()=>{console.warn("successfully deleted connection:",a?.id),r?.(a),i()},onError:y=>{Ye(y,o)}}))},h=c?"Pending...":e;return p.jsx(Je,{type:"button",onClick:d,disabled:u,variant:t,style:n,children:h})}const Xf=I.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),or=()=>{const e=I.useContext(Xf);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e};function i_({children:e,resetComponent:t}){const{integrationId:n,integrationObj:r,installation:i}=gt(),{isError:o,removeError:s,setError:a}=un(),l=r?.name||n,[c,u]=I.useState(null),[d,h]=I.useState(null),{data:f,isLoading:y,isError:v,error:g,isSuccess:w}=bo();I.useEffect(()=>{!w&&!v||(v?(a(Ie.HYDRATED_REVISION,l),g&&Ye(g,u)):(s(Ie.HYDRATED_REVISION,l),u(null),h(null)))},[v,w,l,a,s,g,u]);const m=I.useMemo(()=>({hydratedRevision:f||null,loading:y,readAction:f?.content?.read,writeObjects:f?.content?.write?.objects||[]}),[f,y]),b=r?.provider||"provider",C=r?.name||n||"unknown integration";if(o(Ie.HYDRATED_REVISION,l)){const E=`${c?Wt(c):`Error retrieving objects from ${b} or integration details for ${C}`}`;return p.jsx(Tt,{message:E,children:p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",paddingTop:"1rem",width:"100%"},children:[p.jsx(ja,{provider:b}),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(vd,{message:d}),i?p.jsx(La,{buttonText:"Uninstall",buttonVariant:"danger"}):p.jsx(Gf,{buttonText:"Delete Connection",resetComponent:t,buttonVariant:"danger",onDisconnectError:_=>h(_)})]})})}return y?p.jsx(kr,{}):p.jsx(Xf.Provider,{value:m,children:e})}const Yf=I.createContext(null);function Ba(){const e=I.useContext(Yf);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const Zf=I.createContext(()=>{});function o_(){const e=I.useContext(Zf);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}const ep=I.createContext(void 0),s_={};function Va(){const e=I.useContext(ep);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function a_({children:e}){const{installation:t}=gt(),{hydratedRevision:n,loading:r}=or(),[i,o]=I.useState(s_),s=t?.config;I.useEffect(()=>{n?.content&&!r&&s&&!(Object.entries(i).length>0)&&Xx(n,s,o)},[n,r,s,i]);const a=I.useCallback((u,d)=>{o(h=>St(h,f=>{f[u]=St(f[u],d)}))},[o]),l=I.useCallback((u,d)=>{o(h=>St(h,f=>{f[u]=d}))},[o]),c=I.useMemo(()=>({objectConfigurationsState:i,setObjectConfigurationsState:o,setConfigureState:a,resetConfigureState:l}),[i,l,a]);return p.jsx(ep.Provider,{value:c,children:e})}const Bt=()=>{const{appName:e}=Mn(),{objectConfigurationsState:t,setConfigureState:n}=Va(),{selectedObjectName:r}=Ba(),i=Hd(r||"",t);return{appName:e,configureState:i,setConfigureState:n,selectedObjectName:r}},tp=()=>{const{hydratedRevision:e}=or(),{selectedObjectName:t}=Ba(),n=e?.content?.read?.objects?.find(i=>i.objectName===t),r=n?.displayName||t&&Wt(t);return{selectedObject:n,displayName:r}};function np(){const{projectIdOrName:e}=Ke(),{integrationNameOrId:t}=jn(),{data:n}=tr(t),{installation:r}=dn(),{mutate:i,isIdle:o,isPending:s,error:a,errorMsg:l}=Ed();return{toggleReadingObject:({objectName:u,disabled:d,onSuccess:h,onError:f,onSettled:y})=>{if(!r){const w=new Error("Installation not created yet. Try creating the installation first.");f?.(w),y?.();return}if(!n){const w=new Error("No integration found");f?.(w),y?.();return}if(!r?.config?.content?.read?.objects?.[u]){const w=new Error(`Object "${u}" not found in installation read configuration`);f?.(w),y?.();return}const v=[`config.content.read.objects.${u}.disabled`],g={projectIdOrName:e,integrationId:n.id,installationId:r.id,installationUpdate:{updateMask:v,installation:{config:{content:{read:{objects:{[u]:{disabled:d}}}}}}}};return i(g,{onSuccess:w=>{h?.(w)},onError:w=>{f?.(w)},onSettled:()=>{y?.()}})},isIdle:o,isPending:s,error:a,errorMsg:l}}function l_(){const{installation:e}=dn(),[t,n]=I.useState(!1),{selectedObjectName:r}=Bt(),{displayName:i}=tp(),{toggleReadingObject:o,isPending:s}=np(),a=r?e?.config?.content?.read?.objects?.[r]:void 0;if(!a||a.disabled)return null;const c=()=>{r&&o({objectName:r,disabled:!0,onSuccess:()=>{n(!1)},onError:u=>{console.error("Error stopping read from object:",u)}})};return t?p.jsxs(p.Fragment,{children:[p.jsxs("p",{style:{padding:"1rem 0",color:"var(--amp-colors-text-muted)",fontSize:"0.875rem"},children:["Are you sure you want to stop reading from"," ",p.jsx("b",{children:i}),"?"]}),p.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[p.jsx(Je,{type:"button",variant:"ghost",style:{flex:1},onClick:()=>n(!1),children:"Cancel"}),p.jsx(Je,{type:"button",variant:"danger",style:{flex:1},onClick:c,disabled:s,children:s?"Stopping...":"Stop reading"})]})]}):p.jsxs("button",{type:"button",onClick:()=>n(!0),style:{background:"none",border:"none",cursor:"pointer",textDecoration:"underline",paddingTop:"1rem",margin:0,fontFamily:"inherit",color:"var(--amp-colors-text-muted)"},children:["Stop reading from ",p.jsx("b",{children:i})]})}function gn(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 we(){return we=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},we.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 c_(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Js(e,t)}var Li={exports:{}},Bi={exports:{}},Ne={};var tu;function u_(){if(tu)return Ne;tu=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,v=e?Symbol.for("react.block"):60121,g=e?Symbol.for("react.fundamental"):60117,w=e?Symbol.for("react.responder"):60118,m=e?Symbol.for("react.scope"):60119;function b(E){if(typeof E=="object"&&E!==null){var _=E.$$typeof;switch(_){case t:switch(E=E.type,E){case l:case c:case r:case o:case i:case d:return E;default:switch(E=E&&E.$$typeof,E){case a:case u:case y:case f:case s:return E;default:return _}}case n:return _}}}function C(E){return b(E)===c}return Ne.AsyncMode=l,Ne.ConcurrentMode=c,Ne.ContextConsumer=a,Ne.ContextProvider=s,Ne.Element=t,Ne.ForwardRef=u,Ne.Fragment=r,Ne.Lazy=y,Ne.Memo=f,Ne.Portal=n,Ne.Profiler=o,Ne.StrictMode=i,Ne.Suspense=d,Ne.isAsyncMode=function(E){return C(E)||b(E)===l},Ne.isConcurrentMode=C,Ne.isContextConsumer=function(E){return b(E)===a},Ne.isContextProvider=function(E){return b(E)===s},Ne.isElement=function(E){return typeof E=="object"&&E!==null&&E.$$typeof===t},Ne.isForwardRef=function(E){return b(E)===u},Ne.isFragment=function(E){return b(E)===r},Ne.isLazy=function(E){return b(E)===y},Ne.isMemo=function(E){return b(E)===f},Ne.isPortal=function(E){return b(E)===n},Ne.isProfiler=function(E){return b(E)===o},Ne.isStrictMode=function(E){return b(E)===i},Ne.isSuspense=function(E){return b(E)===d},Ne.isValidElementType=function(E){return typeof E=="string"||typeof E=="function"||E===r||E===c||E===o||E===i||E===d||E===h||typeof E=="object"&&E!==null&&(E.$$typeof===y||E.$$typeof===f||E.$$typeof===s||E.$$typeof===a||E.$$typeof===u||E.$$typeof===g||E.$$typeof===w||E.$$typeof===m||E.$$typeof===v)},Ne.typeOf=b,Ne}var Te={};var nu;function d_(){return nu||(nu=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,v=e?Symbol.for("react.block"):60121,g=e?Symbol.for("react.fundamental"):60117,w=e?Symbol.for("react.responder"):60118,m=e?Symbol.for("react.scope"):60119;function b(U){return typeof U=="string"||typeof U=="function"||U===r||U===c||U===o||U===i||U===d||U===h||typeof U=="object"&&U!==null&&(U.$$typeof===y||U.$$typeof===f||U.$$typeof===s||U.$$typeof===a||U.$$typeof===u||U.$$typeof===g||U.$$typeof===w||U.$$typeof===m||U.$$typeof===v)}function C(U){if(typeof U=="object"&&U!==null){var ye=U.$$typeof;switch(ye){case t:var Z=U.type;switch(Z){case l:case c:case r:case o:case i:case d:return Z;default:var Be=Z&&Z.$$typeof;switch(Be){case a:case u:case y:case f:case s:return Be;default:return ye}}case n:return ye}}}var E=l,_=c,A=a,k=s,L=t,M=u,F=r,j=y,G=f,P=n,V=o,Y=i,le=d,pe=!1;function ge(U){return pe||(pe=!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.")),x(U)||C(U)===l}function x(U){return C(U)===c}function J(U){return C(U)===a}function B(U){return C(U)===s}function S(U){return typeof U=="object"&&U!==null&&U.$$typeof===t}function $(U){return C(U)===u}function q(U){return C(U)===r}function X(U){return C(U)===y}function ie(U){return C(U)===f}function ne(U){return C(U)===n}function se(U){return C(U)===o}function ee(U){return C(U)===i}function me(U){return C(U)===d}Te.AsyncMode=E,Te.ConcurrentMode=_,Te.ContextConsumer=A,Te.ContextProvider=k,Te.Element=L,Te.ForwardRef=M,Te.Fragment=F,Te.Lazy=j,Te.Memo=G,Te.Portal=P,Te.Profiler=V,Te.StrictMode=Y,Te.Suspense=le,Te.isAsyncMode=ge,Te.isConcurrentMode=x,Te.isContextConsumer=J,Te.isContextProvider=B,Te.isElement=S,Te.isForwardRef=$,Te.isFragment=q,Te.isLazy=X,Te.isMemo=ie,Te.isPortal=ne,Te.isProfiler=se,Te.isStrictMode=ee,Te.isSuspense=me,Te.isValidElementType=b,Te.typeOf=C})()),Te}var ru;function rp(){return ru||(ru=1,process.env.NODE_ENV==="production"?Bi.exports=u_():Bi.exports=d_()),Bi.exports}var ss,iu;function f_(){if(iu)return ss;iu=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 ss=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},ss}var as,ou;function Ua(){if(ou)return as;ou=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return as=e,as}var ls,su;function ip(){return su||(su=1,ls=Function.call.bind(Object.prototype.hasOwnProperty)),ls}var cs,au;function p_(){if(au)return cs;au=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Ua(),n={},r=ip();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={})},cs=i,cs}var us,lu;function h_(){if(lu)return us;lu=1;var e=rp(),t=f_(),n=Ua(),r=ip(),i=p_(),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 us=function(a,l){var c=typeof Symbol=="function"&&Symbol.iterator,u="@@iterator";function d(x){var J=x&&(c&&x[c]||x[u]);if(typeof J=="function")return J}var h="<<anonymous>>",f={array:w("array"),bigint:w("bigint"),bool:w("boolean"),func:w("function"),number:w("number"),object:w("object"),string:w("string"),symbol:w("symbol"),any:m(),arrayOf:b,element:C(),elementType:E(),instanceOf:_,node:M(),objectOf:k,oneOf:A,oneOfType:L,shape:j,exact:G};function y(x,J){return x===J?x!==0||1/x===1/J:x!==x&&J!==J}function v(x,J){this.message=x,this.data=J&&typeof J=="object"?J:{},this.stack=""}v.prototype=Error.prototype;function g(x){if(process.env.NODE_ENV!=="production")var J={},B=0;function S(q,X,ie,ne,se,ee,me){if(ne=ne||h,ee=ee||ie,me!==n){if(l){var U=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 U.name="Invariant Violation",U}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ye=ne+":"+ie;!J[ye]&&B<3&&(o("You are manually calling a React.PropTypes validation function for the `"+ee+"` prop on `"+ne+"`. 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[ye]=!0,B++)}}return X[ie]==null?q?X[ie]===null?new v("The "+se+" `"+ee+"` is marked as required "+("in `"+ne+"`, but its value is `null`.")):new v("The "+se+" `"+ee+"` is marked as required in "+("`"+ne+"`, but its value is `undefined`.")):null:x(X,ie,ne,se,ee)}var $=S.bind(null,!1);return $.isRequired=S.bind(null,!0),$}function w(x){function J(B,S,$,q,X,ie){var ne=B[S],se=Y(ne);if(se!==x){var ee=le(ne);return new v("Invalid "+q+" `"+X+"` of type "+("`"+ee+"` supplied to `"+$+"`, expected ")+("`"+x+"`."),{expectedType:x})}return null}return g(J)}function m(){return g(s)}function b(x){function J(B,S,$,q,X){if(typeof x!="function")return new v("Property `"+X+"` of component `"+$+"` has invalid PropType notation inside arrayOf.");var ie=B[S];if(!Array.isArray(ie)){var ne=Y(ie);return new v("Invalid "+q+" `"+X+"` of type "+("`"+ne+"` supplied to `"+$+"`, expected an array."))}for(var se=0;se<ie.length;se++){var ee=x(ie,se,$,q,X+"["+se+"]",n);if(ee instanceof Error)return ee}return null}return g(J)}function C(){function x(J,B,S,$,q){var X=J[B];if(!a(X)){var ie=Y(X);return new v("Invalid "+$+" `"+q+"` of type "+("`"+ie+"` supplied to `"+S+"`, expected a single ReactElement."))}return null}return g(x)}function E(){function x(J,B,S,$,q){var X=J[B];if(!e.isValidElementType(X)){var ie=Y(X);return new v("Invalid "+$+" `"+q+"` of type "+("`"+ie+"` supplied to `"+S+"`, expected a single ReactElement type."))}return null}return g(x)}function _(x){function J(B,S,$,q,X){if(!(B[S]instanceof x)){var ie=x.name||h,ne=ge(B[S]);return new v("Invalid "+q+" `"+X+"` of type "+("`"+ne+"` supplied to `"+$+"`, expected ")+("instance of `"+ie+"`."))}return null}return g(J)}function A(x){if(!Array.isArray(x))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(B,S,$,q,X){for(var ie=B[S],ne=0;ne<x.length;ne++)if(y(ie,x[ne]))return null;var se=JSON.stringify(x,function(me,U){var ye=le(U);return ye==="symbol"?String(U):U});return new v("Invalid "+q+" `"+X+"` of value `"+String(ie)+"` "+("supplied to `"+$+"`, expected one of "+se+"."))}return g(J)}function k(x){function J(B,S,$,q,X){if(typeof x!="function")return new v("Property `"+X+"` of component `"+$+"` has invalid PropType notation inside objectOf.");var ie=B[S],ne=Y(ie);if(ne!=="object")return new v("Invalid "+q+" `"+X+"` of type "+("`"+ne+"` supplied to `"+$+"`, expected an object."));for(var se in ie)if(r(ie,se)){var ee=x(ie,se,$,q,X+"."+se,n);if(ee instanceof Error)return ee}return null}return g(J)}function L(x){if(!Array.isArray(x))return process.env.NODE_ENV!=="production"&&o("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var J=0;J<x.length;J++){var B=x[J];if(typeof B!="function")return o("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+pe(B)+" at index "+J+"."),s}function S($,q,X,ie,ne){for(var se=[],ee=0;ee<x.length;ee++){var me=x[ee],U=me($,q,X,ie,ne,n);if(U==null)return null;U.data&&r(U.data,"expectedType")&&se.push(U.data.expectedType)}var ye=se.length>0?", expected one of type ["+se.join(", ")+"]":"";return new v("Invalid "+ie+" `"+ne+"` supplied to "+("`"+X+"`"+ye+"."))}return g(S)}function M(){function x(J,B,S,$,q){return P(J[B])?null:new v("Invalid "+$+" `"+q+"` supplied to "+("`"+S+"`, expected a ReactNode."))}return g(x)}function F(x,J,B,S,$){return new v((x||"React class")+": "+J+" type `"+B+"."+S+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+$+"`.")}function j(x){function J(B,S,$,q,X){var ie=B[S],ne=Y(ie);if(ne!=="object")return new v("Invalid "+q+" `"+X+"` of type `"+ne+"` "+("supplied to `"+$+"`, expected `object`."));for(var se in x){var ee=x[se];if(typeof ee!="function")return F($,q,X,se,le(ee));var me=ee(ie,se,$,q,X+"."+se,n);if(me)return me}return null}return g(J)}function G(x){function J(B,S,$,q,X){var ie=B[S],ne=Y(ie);if(ne!=="object")return new v("Invalid "+q+" `"+X+"` of type `"+ne+"` "+("supplied to `"+$+"`, expected `object`."));var se=t({},B[S],x);for(var ee in se){var me=x[ee];if(r(x,ee)&&typeof me!="function")return F($,q,X,ee,le(me));if(!me)return new v("Invalid "+q+" `"+X+"` key `"+ee+"` supplied to `"+$+"`.\nBad object: "+JSON.stringify(B[S],null," ")+`
|
|
21
|
+
Valid keys: `+JSON.stringify(Object.keys(x),null," "));var U=me(ie,ee,$,q,X+"."+ee,n);if(U)return U}return null}return g(J)}function P(x){switch(typeof x){case"number":case"string":case"undefined":return!0;case"boolean":return!x;case"object":if(Array.isArray(x))return x.every(P);if(x===null||a(x))return!0;var J=d(x);if(J){var B=J.call(x),S;if(J!==x.entries){for(;!(S=B.next()).done;)if(!P(S.value))return!1}else for(;!(S=B.next()).done;){var $=S.value;if($&&!P($[1]))return!1}}else return!1;return!0;default:return!1}}function V(x,J){return x==="symbol"?!0:J?J["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&J instanceof Symbol:!1}function Y(x){var J=typeof x;return Array.isArray(x)?"array":x instanceof RegExp?"object":V(J,x)?"symbol":J}function le(x){if(typeof x>"u"||x===null)return""+x;var J=Y(x);if(J==="object"){if(x instanceof Date)return"date";if(x instanceof RegExp)return"regexp"}return J}function pe(x){var J=le(x);switch(J){case"array":case"object":return"an "+J;case"boolean":case"date":case"regexp":return"a "+J;default:return J}}function ge(x){return!x.constructor||!x.constructor.name?h:x.constructor.name}return f.checkPropTypes=i,f.resetWarningCache=i.resetWarningCache,f.PropTypes=f,f},us}var ds,cu;function m_(){if(cu)return ds;cu=1;var e=Ua();function t(){}function n(){}return n.resetWarningCache=t,ds=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},ds}var uu;function g_(){if(uu)return Li.exports;if(uu=1,process.env.NODE_ENV!=="production"){var e=rp(),t=!0;Li.exports=h_()(e.isElement,t)}else Li.exports=m_()();return Li.exports}var y_=g_();const Q=Nr(y_);var Vi={exports:{}},ke={};var du;function v_(){if(du)return ke;du=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 v(g){if(typeof g=="object"&&g!==null){var w=g.$$typeof;switch(w){case e:switch(g=g.type,g){case n:case i:case r:case c:case u:return g;default:switch(g=g&&g.$$typeof,g){case a:case s:case l:case h:case d:case o:return g;default:return w}}case t:return w}}}return ke.ContextConsumer=s,ke.ContextProvider=o,ke.Element=e,ke.ForwardRef=l,ke.Fragment=n,ke.Lazy=h,ke.Memo=d,ke.Portal=t,ke.Profiler=i,ke.StrictMode=r,ke.Suspense=c,ke.SuspenseList=u,ke.isAsyncMode=function(){return!1},ke.isConcurrentMode=function(){return!1},ke.isContextConsumer=function(g){return v(g)===s},ke.isContextProvider=function(g){return v(g)===o},ke.isElement=function(g){return typeof g=="object"&&g!==null&&g.$$typeof===e},ke.isForwardRef=function(g){return v(g)===l},ke.isFragment=function(g){return v(g)===n},ke.isLazy=function(g){return v(g)===h},ke.isMemo=function(g){return v(g)===d},ke.isPortal=function(g){return v(g)===t},ke.isProfiler=function(g){return v(g)===i},ke.isStrictMode=function(g){return v(g)===r},ke.isSuspense=function(g){return v(g)===c},ke.isSuspenseList=function(g){return v(g)===u},ke.isValidElementType=function(g){return typeof g=="string"||typeof g=="function"||g===n||g===i||g===r||g===c||g===u||g===f||typeof g=="object"&&g!==null&&(g.$$typeof===h||g.$$typeof===d||g.$$typeof===o||g.$$typeof===s||g.$$typeof===l||g.$$typeof===y||g.getModuleId!==void 0)},ke.typeOf=v,ke}var Re={};var fu;function b_(){return fu||(fu=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,v=!1,g=!1,w=!1,m=!1,b;b=Symbol.for("react.module.reference");function C(Z){return!!(typeof Z=="string"||typeof Z=="function"||Z===n||Z===i||m||Z===r||Z===c||Z===u||w||Z===f||y||v||g||typeof Z=="object"&&Z!==null&&(Z.$$typeof===h||Z.$$typeof===d||Z.$$typeof===o||Z.$$typeof===s||Z.$$typeof===l||Z.$$typeof===b||Z.getModuleId!==void 0))}function E(Z){if(typeof Z=="object"&&Z!==null){var Be=Z.$$typeof;switch(Be){case e:var Fe=Z.type;switch(Fe){case n:case i:case r:case c:case u:return Fe;default:var Ae=Fe&&Fe.$$typeof;switch(Ae){case a:case s:case l:case h:case d:case o:return Ae;default:return Be}}case t:return Be}}}var _=s,A=o,k=e,L=l,M=n,F=h,j=d,G=t,P=i,V=r,Y=c,le=u,pe=!1,ge=!1;function x(Z){return pe||(pe=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function J(Z){return ge||(ge=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function B(Z){return E(Z)===s}function S(Z){return E(Z)===o}function $(Z){return typeof Z=="object"&&Z!==null&&Z.$$typeof===e}function q(Z){return E(Z)===l}function X(Z){return E(Z)===n}function ie(Z){return E(Z)===h}function ne(Z){return E(Z)===d}function se(Z){return E(Z)===t}function ee(Z){return E(Z)===i}function me(Z){return E(Z)===r}function U(Z){return E(Z)===c}function ye(Z){return E(Z)===u}Re.ContextConsumer=_,Re.ContextProvider=A,Re.Element=k,Re.ForwardRef=L,Re.Fragment=M,Re.Lazy=F,Re.Memo=j,Re.Portal=G,Re.Profiler=P,Re.StrictMode=V,Re.Suspense=Y,Re.SuspenseList=le,Re.isAsyncMode=x,Re.isConcurrentMode=J,Re.isContextConsumer=B,Re.isContextProvider=S,Re.isElement=$,Re.isForwardRef=q,Re.isFragment=X,Re.isLazy=ie,Re.isMemo=ne,Re.isPortal=se,Re.isProfiler=ee,Re.isStrictMode=me,Re.isSuspense=U,Re.isSuspenseList=ye,Re.isValidElementType=C,Re.typeOf=E})()),Re}var pu;function w_(){return pu||(pu=1,process.env.NODE_ENV==="production"?Vi.exports=v_():Vi.exports=b_()),Vi.exports}var hu=w_();const mu=e=>typeof e=="object"&&e!=null&&e.nodeType===1,gu=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",fs=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return gu(n.overflowY,t)||gu(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},Ui=(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,x_=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},I_=(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:G=>G!==a;if(!mu(e))throw new TypeError("Invalid target");const u=document.scrollingElement||document.documentElement,d=[];let h=e;for(;mu(h)&&c(h);){if(h=x_(h),h===u){d.push(h);break}h!=null&&h===document.body&&fs(h)&&!fs(document.documentElement)||h!=null&&fs(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:v,scrollY:g}=window,{height:w,width:m,top:b,right:C,bottom:E,left:_}=e.getBoundingClientRect(),{top:A,right:k,left:L}=(G=>{const P=window.getComputedStyle(G);return{top:parseFloat(P.scrollMarginTop)||0,right:parseFloat(P.scrollMarginRight)||0,bottom:parseFloat(P.scrollMarginBottom)||0,left:parseFloat(P.scrollMarginLeft)||0}})(e);let M=b-A,F=s==="center"?_+m/2-L+k:s==="end"?C+k:_-L;const j=[];for(let G=0;G<d.length;G++){const P=d[G],{height:V,width:Y,top:le,right:pe,bottom:ge,left:x}=P.getBoundingClientRect();if(b>=0&&_>=0&&E<=y&&C<=f&&b>=le&&E<=ge&&_>=x&&C<=pe)return j;const J=getComputedStyle(P),B=parseInt(J.borderLeftWidth,10),S=parseInt(J.borderTopWidth,10),$=parseInt(J.borderRightWidth,10),q=parseInt(J.borderBottomWidth,10);let X=0,ie=0;const ne="offsetWidth"in P?P.offsetWidth-P.clientWidth-B-$:0,se="offsetHeight"in P?P.offsetHeight-P.clientHeight-S-q:0,ee="offsetWidth"in P?P.offsetWidth===0?0:Y/P.offsetWidth:0,me="offsetHeight"in P?P.offsetHeight===0?0:V/P.offsetHeight:0;if(u===P)X=Ui(g,g+y,y,S,q,g+M,g+M+w,w),ie=s==="start"?F:s==="center"?F-f/2:s==="end"?F-f:Ui(v,v+f,f,B,$,v+F,v+F+m,m),X=Math.max(0,X+g),ie=Math.max(0,ie+v);else{X=Ui(le,ge,V,S,q+se,M,M+w,w),ie=s==="start"?F-x-B:s==="center"?F-(x+Y/2)+ne/2:s==="end"?F-pe+$+ne:Ui(x,pe,Y,B,$+ne,F,F+m,m);const{scrollLeft:U,scrollTop:ye}=P;X=me===0?0:Math.max(0,Math.min(ye+X/me,P.scrollHeight-V/me+se)),ie=ee===0?0:Math.max(0,Math.min(U+ie/ee,P.scrollWidth-Y/ee+ne)),M+=ye-X,F+=U-ie}j.push({el:P,top:X,left:ie})}return j};var Sr=function(){return Sr=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},Sr.apply(this,arguments)};var S_=0;function yu(e){return typeof e=="function"?e:Pt}function Pt(){}function op(e,t){if(e){var n=I_(e,{boundary:t});n.forEach(function(r){var i=r.el,o=r.top,s=r.left;i.scrollTop=o,i.scrollLeft=s})}}function vu(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function qa(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 rt(){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 sp(){return String(S_++)}function C_(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 bu(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function ap(e){return typeof e.type=="string"}function lp(e){return e.props}function O_(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var E_=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function qi(e){e===void 0&&(e={});var t={};return E_.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function lo(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,r){return n[r]=co(t,r)?t[r]:e[r],n},{})}function co(e,t){return e[t]!==void 0}function Ws(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function __(e){return Object.prototype.toString.call(e)==="[object Object]"}function Hn(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=Cr(a,t<0,n,r,i);return l===-1?e>=o?-1:e:l}function Cr(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?Cr(t?o-1:0,t,n,r):-1}function uo(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(i){return i&&(vu(i,e,n)||r&&vu(i,n.document.activeElement,n))})}var $a=Pt;process.env.NODE_ENV!=="production"&&($a=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 N_=qa(function(e){cp(e).textContent=""},500);function cp(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 up(e,t){if(!(!e||!t)){var n=cp(t);n.textContent=e,N_(t)}}function T_(e){var t=e?.getElementById("a11y-status-message");t&&t.remove()}var dp=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,fp=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,pp=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,Ji=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,Wi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,hp=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,mp=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,gp=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,yp=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,vp=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,bp=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,wp=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,xp=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,Qs=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,Ip=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,Sp=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,Cp=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,k_=Object.freeze({__proto__:null,blurButton:Ip,blurInput:bp,changeInput:wp,clickButton:Qs,clickItem:vp,controlledPropUpdatedSelectedItem:Sp,itemMouseEnter:pp,keyDownArrowDown:Wi,keyDownArrowUp:Ji,keyDownEnd:yp,keyDownEnter:mp,keyDownEscape:hp,keyDownHome:gp,keyDownSpaceButton:xp,mouseUp:fp,touchEnd:Cp,unknown:dp}),R_=["refKey","ref"],A_=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],F_=["onKeyDown","onBlur","onChange","onInput","onChangeText"],P_=["refKey","ref"],D_=["onMouseMove","onMouseDown","onClick","onPress","index","item"],M_=(function(){var e=(function(t){function n(i){var o;o=t.call(this,i)||this,o.id=o.props.id||"downshift-"+sp(),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(m){return o.id+"-item-"+m},o.items=[],o.itemCount=null,o.previousResultCount=0,o.timeoutIds=[],o.internalSetTimeout=function(m,b){var C=setTimeout(function(){o.timeoutIds=o.timeoutIds.filter(function(E){return E!==C}),m()},b);o.timeoutIds.push(C)},o.setItemCount=function(m){o.itemCount=m},o.unsetItemCount=function(){o.itemCount=null},o.isItemDisabled=function(m,b){var C=o.getItemNodeFromIndex(b);return C&&C.hasAttribute("disabled")},o.setHighlightedIndex=function(m,b){m===void 0&&(m=o.props.defaultHighlightedIndex),b===void 0&&(b={}),b=qi(b),o.internalSetState(we({highlightedIndex:m},b))},o.clearSelection=function(m){o.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:o.props.defaultHighlightedIndex,isOpen:o.props.defaultIsOpen},m)},o.selectItem=function(m,b,C){b=qi(b),o.internalSetState(we({isOpen:o.props.defaultIsOpen,highlightedIndex:o.props.defaultHighlightedIndex,selectedItem:m,inputValue:o.props.itemToString(m)},b),C)},o.selectItemAtIndex=function(m,b,C){var E=o.items[m];E!=null&&o.selectItem(E,b,C)},o.selectHighlightedItem=function(m,b){return o.selectItemAtIndex(o.getState().highlightedIndex,m,b)},o.internalSetState=function(m,b){var C,E,_={},A=typeof m=="function";return!A&&m.hasOwnProperty("inputValue")&&o.props.onInputValueChange(m.inputValue,we({},o.getStateAndHelpers(),m)),o.setState(function(k){var L;k=o.getState(k);var M=A?m(k):m;M=o.props.stateReducer(k,M),C=M.hasOwnProperty("selectedItem");var F={};return C&&M.selectedItem!==k.selectedItem&&(E=M.selectedItem),(L=M).type||(L.type=dp),Object.keys(M).forEach(function(j){k[j]!==M[j]&&(_[j]=M[j]),j!=="type"&&(M[j],co(o.props,j)||(F[j]=M[j]))}),A&&M.hasOwnProperty("inputValue")&&o.props.onInputValueChange(M.inputValue,we({},o.getStateAndHelpers(),M)),F},function(){yu(b)();var k=Object.keys(_).length>1;k&&o.props.onStateChange(_,o.getStateAndHelpers()),C&&o.props.onSelect(m.selectedItem,o.getStateAndHelpers()),E!==void 0&&o.props.onChange(E,o.getStateAndHelpers()),o.props.onUserAction(_,o.getStateAndHelpers())})},o.rootRef=function(m){return o._rootNode=m},o.getRootProps=function(m,b){var C,E=m===void 0?{}:m,_=E.refKey,A=_===void 0?"ref":_,k=E.ref,L=gn(E,R_),M=b===void 0?{}:b,F=M.suppressRefError,j=F===void 0?!1:F;o.getRootProps.called=!0,o.getRootProps.refKey=A,o.getRootProps.suppressRefError=j;var G=o.getState(),P=G.isOpen;return we((C={},C[A]=fr(k,o.rootRef),C.role="combobox",C["aria-expanded"]=P,C["aria-haspopup"]="listbox",C["aria-owns"]=P?o.menuId:void 0,C["aria-labelledby"]=o.labelId,C),L)},o.keyDownHandlers={ArrowDown:function(b){var C=this;if(b.preventDefault(),this.getState().isOpen){var E=b.shiftKey?5:1;this.moveHighlightedIndex(E,{type:Wi})}else this.internalSetState({isOpen:!0,type:Wi},function(){var _=C.getItemCount();if(_>0){var A=C.getState(),k=A.highlightedIndex,L=Hn(k,1,{length:_},C.isItemDisabled,!0);C.setHighlightedIndex(L,{type:Wi})}})},ArrowUp:function(b){var C=this;if(b.preventDefault(),this.getState().isOpen){var E=b.shiftKey?-5:-1;this.moveHighlightedIndex(E,{type:Ji})}else this.internalSetState({isOpen:!0,type:Ji},function(){var _=C.getItemCount();if(_>0){var A=C.getState(),k=A.highlightedIndex,L=Hn(k,-1,{length:_},C.isItemDisabled,!0);C.setHighlightedIndex(L,{type:Ji})}})},Enter:function(b){if(b.which!==229){var C=this.getState(),E=C.isOpen,_=C.highlightedIndex;if(E&&_!=null){b.preventDefault();var A=this.items[_],k=this.getItemNodeFromIndex(_);if(A==null||k&&k.hasAttribute("disabled"))return;this.selectHighlightedItem({type:mp})}}},Escape:function(b){b.preventDefault(),this.reset(we({type:hp},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},o.buttonKeyDownHandlers=we({},o.keyDownHandlers,{" ":function(b){b.preventDefault(),this.toggleMenu({type:xp})}}),o.inputKeyDownHandlers=we({},o.keyDownHandlers,{Home:function(b){var C=this.getState(),E=C.isOpen;if(E){b.preventDefault();var _=this.getItemCount();if(!(_<=0||!E)){var A=Cr(0,!1,{length:_},this.isItemDisabled);this.setHighlightedIndex(A,{type:gp})}}},End:function(b){var C=this.getState(),E=C.isOpen;if(E){b.preventDefault();var _=this.getItemCount();if(!(_<=0||!E)){var A=Cr(_-1,!0,{length:_},this.isItemDisabled);this.setHighlightedIndex(A,{type:yp})}}}}),o.getToggleButtonProps=function(m){var b=m===void 0?{}:m,C=b.onClick;b.onPress;var E=b.onKeyDown,_=b.onKeyUp,A=b.onBlur,k=gn(b,A_),L=o.getState(),M=L.isOpen,F={onClick:rt(C,o.buttonHandleClick),onKeyDown:rt(E,o.buttonHandleKeyDown),onKeyUp:rt(_,o.buttonHandleKeyUp),onBlur:rt(A,o.buttonHandleBlur)},j=k.disabled?{}:F;return we({type:"button",role:"button","aria-label":M?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},j,k)},o.buttonHandleKeyUp=function(m){m.preventDefault()},o.buttonHandleKeyDown=function(m){var b=Ws(m);o.buttonKeyDownHandlers[b]&&o.buttonKeyDownHandlers[b].call(o,m)},o.buttonHandleClick=function(m){if(m.preventDefault(),o.props.environment){var b=o.props.environment.document,C=b.body,E=b.activeElement;C&&C===E&&m.target.focus()}process.env.NODE_ENV==="test"?o.toggleMenu({type:Qs}):o.internalSetTimeout(function(){return o.toggleMenu({type:Qs})})},o.buttonHandleBlur=function(m){var b=m.target;o.internalSetTimeout(function(){if(!(o.isMouseDown||!o.props.environment)){var C=o.props.environment.document.activeElement;(C==null||C.id!==o.inputId)&&C!==b&&o.reset({type:Ip})}})},o.getLabelProps=function(m){return we({htmlFor:o.inputId,id:o.labelId},m)},o.getInputProps=function(m){var b=m===void 0?{}:m,C=b.onKeyDown,E=b.onBlur,_=b.onChange,A=b.onInput;b.onChangeText;var k=gn(b,F_),L,M={};L="onChange";var F=o.getState(),j=F.inputValue,G=F.isOpen,P=F.highlightedIndex;if(!k.disabled){var V;M=(V={},V[L]=rt(_,A,o.inputHandleChange),V.onKeyDown=rt(C,o.inputHandleKeyDown),V.onBlur=rt(E,o.inputHandleBlur),V)}return we({"aria-autocomplete":"list","aria-activedescendant":G&&typeof P=="number"&&P>=0?o.getItemId(P):void 0,"aria-controls":G?o.menuId:void 0,"aria-labelledby":k&&k["aria-label"]?void 0:o.labelId,autoComplete:"off",value:j,id:o.inputId},M,k)},o.inputHandleKeyDown=function(m){var b=Ws(m);b&&o.inputKeyDownHandlers[b]&&o.inputKeyDownHandlers[b].call(o,m)},o.inputHandleChange=function(m){o.internalSetState({type:wp,isOpen:!0,inputValue:m.target.value,highlightedIndex:o.props.defaultHighlightedIndex})},o.inputHandleBlur=function(){o.internalSetTimeout(function(){var m;if(!(o.isMouseDown||!o.props.environment)){var b=o.props.environment.document.activeElement,C=(b==null||(m=b.dataset)==null?void 0:m.toggle)&&o._rootNode&&o._rootNode.contains(b);C||o.reset({type:bp})}})},o.menuRef=function(m){o._menuNode=m},o.getMenuProps=function(m,b){var C,E=m===void 0?{}:m,_=E.refKey,A=_===void 0?"ref":_,k=E.ref,L=gn(E,P_),M=b===void 0?{}:b,F=M.suppressRefError,j=F===void 0?!1:F;return o.getMenuProps.called=!0,o.getMenuProps.refKey=A,o.getMenuProps.suppressRefError=j,we((C={},C[A]=fr(k,o.menuRef),C.role="listbox",C["aria-labelledby"]=L&&L["aria-label"]?void 0:o.labelId,C.id=o.menuId,C),L)},o.getItemProps=function(m){var b,C=m===void 0?{}:m,E=C.onMouseMove,_=C.onMouseDown,A=C.onClick;C.onPress;var k=C.index,L=C.item,M=L===void 0?process.env.NODE_ENV==="production"?void 0:O_("getItemProps","item"):L,F=gn(C,D_);k===void 0?(o.items.push(M),k=o.items.indexOf(M)):o.items[k]=M;var j="onClick",G=A,P=(b={onMouseMove:rt(E,function(){k!==o.getState().highlightedIndex&&(o.setHighlightedIndex(k,{type:pp}),o.avoidScrolling=!0,o.internalSetTimeout(function(){return o.avoidScrolling=!1},250))}),onMouseDown:rt(_,function(Y){Y.preventDefault()})},b[j]=rt(G,function(){o.selectItemAtIndex(k,{type:vp})}),b),V=F.disabled?{onMouseDown:P.onMouseDown}:P;return we({id:o.getItemId(k),role:"option","aria-selected":o.getState().highlightedIndex===k},V,F)},o.clearItems=function(){o.items=[]},o.reset=function(m,b){m===void 0&&(m={}),m=qi(m),o.internalSetState(function(C){var E=C.selectedItem;return we({isOpen:o.props.defaultIsOpen,highlightedIndex:o.props.defaultHighlightedIndex,inputValue:o.props.itemToString(E)},m)},b)},o.toggleMenu=function(m,b){m===void 0&&(m={}),m=qi(m),o.internalSetState(function(C){var E=C.isOpen;return we({isOpen:!E},E&&{highlightedIndex:o.props.defaultHighlightedIndex},m)},function(){var C=o.getState(),E=C.isOpen,_=C.highlightedIndex;E&&o.getItemCount()>0&&typeof _=="number"&&o.setHighlightedIndex(_,m),yu(b)()})},o.openMenu=function(m){o.internalSetState({isOpen:!0},m)},o.closeMenu=function(m){o.internalSetState({isOpen:!1},m)},o.updateStatus=qa(function(){var m;if((m=o.props)!=null&&(m=m.environment)!=null&&m.document){var b=o.getState(),C=o.items[b.highlightedIndex],E=o.getItemCount(),_=o.props.getA11yStatusMessage(we({itemToString:o.props.itemToString,previousResultCount:o.previousResultCount,resultCount:E,highlightedItem:C},b));o.previousResultCount=E,up(_,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,v=s.initialSelectedItem,g=v===void 0?null:v,w=o.getState({highlightedIndex:c,isOpen:h,inputValue:y,selectedItem:g});return w.selectedItem!=null&&o.props.initialInputValue===void 0&&(w.inputValue=o.props.itemToString(w.selectedItem)),o.state=w,o}c_(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),lo(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=Hn(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,v=this.getMenuProps,g=this.getInputProps,w=this.getItemProps,m=this.openMenu,b=this.closeMenu,C=this.toggleMenu,E=this.selectItem,_=this.selectItemAtIndex,A=this.selectHighlightedItem,k=this.setHighlightedIndex,L=this.clearSelection,M=this.clearItems,F=this.reset,j=this.setItemCount,G=this.unsetItemCount,P=this.internalSetState;return{getRootProps:h,getToggleButtonProps:f,getLabelProps:y,getMenuProps:v,getInputProps:g,getItemProps:w,reset:F,openMenu:m,closeMenu:b,toggleMenu:C,selectItem:E,selectItemAtIndex:_,selectHighlightedItem:A,setHighlightedIndex:k,clearSelection:L,clearItems:M,setItemCount:j,unsetItemCount:G,setState:P,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&&wu(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=uo(f.target,[o._rootNode,o._menuNode],o.props.environment);!y&&o.getState().isOpen&&o.reset({type:fp},function(){return o.props.onOuterClick(o.getStateAndHelpers())})},l=function(){o.isTouchMove=!1},c=function(){o.isTouchMove=!0},u=function(f){var y=uo(f.target,[o._rootNode,o._menuNode],o.props.environment,!1);!o.isTouchMove&&!y&&o.getState().isOpen&&o.reset({type:Cp},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"&&($a(this.state,o,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&wu(this._menuNode,this.getMenuProps)),co(this.props,"selectedItem")&&this.props.selectedItemChanged(o.selectedItem,this.props.selectedItem)&&this.internalSetState({type:Sp,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=bu(this.props.children,Pt);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=bu(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&&j_(s,this.getRootProps),s;if(ap(s))return I.cloneElement(s,this.getRootProps(lp(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:C_,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&__(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:Pt,onInputValueChange:Pt,onUserAction:Pt,onChange:Pt,onSelect:Pt,onOuterClick:Pt,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:op},e.stateChangeTypes=k_,e})();process.env.NODE_ENV!=="production"&&(M_.propTypes={children:Q.func,defaultHighlightedIndex:Q.number,defaultIsOpen:Q.bool,initialHighlightedIndex:Q.number,initialSelectedItem:Q.any,initialInputValue:Q.string,initialIsOpen:Q.bool,getA11yStatusMessage:Q.func,itemToString:Q.func,onChange:Q.func,onSelect:Q.func,onStateChange:Q.func,onInputValueChange:Q.func,onUserAction:Q.func,onOuterClick:Q.func,selectedItemChanged:Q.func,stateReducer:Q.func,itemCount:Q.number,id:Q.string,environment:Q.shape({addEventListener:Q.func.isRequired,removeEventListener:Q.func.isRequired,document:Q.shape({createElement:Q.func.isRequired,getElementById:Q.func.isRequired,activeElement:Q.any.isRequired,body:Q.any.isRequired}).isRequired,Node:Q.func.isRequired}),suppressRefError:Q.bool,scrollIntoView:Q.func,selectedItem:Q.any,isOpen:Q.bool,inputValue:Q.string,highlightedIndex:Q.number,labelId:Q.string,inputId:Q.string,menuId:Q.string,getItemId:Q.func});function wu(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 j_(e,t){var n=t.refKey,r=n!=="ref",i=!ap(e);i&&!r&&!hu.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+'"'),!hu.isForwardRef(e)&&!lp(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Op={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function L_(e,t,n){var r=e.props,i=e.type,o={};Object.keys(t).forEach(function(s){B_(s,e,t,n),n[s]!==t[s]&&(o[s]=n[s])}),r.onStateChange&&Object.keys(o).length&&r.onStateChange(we({type:i},o))}function B_(e,t,n,r){var i=t.props,o=t.type,s="on"+za(e)+"Change";i[s]&&r[e]!==void 0&&r[e]!==n[e]&&i[s](we({type:o},r))}function V_(e,t){return t.changes}var xu=qa(function(e,t){up(e,t)},200),U_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?I.useLayoutEffect:I.useEffect,q_="useId"in I?function(t){var n=t.id,r=t.labelId,i=t.menuId,o=t.getItemId,s=t.toggleButtonId,a=t.inputId,l="downshift-"+I.useId();n||(n=l);var c=I.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-"+sp():n,i=t.labelId,o=t.menuId,s=t.getItemId,a=t.toggleButtonId,l=t.inputId,c=I.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 $_(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 za(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Ep(e){var t=I.useRef(e);return t.current=e,t}function z_(e,t,n,r){var i=I.useRef(),o=I.useRef(),s=I.useCallback(function(f,y){o.current=y,f=lo(f,y.props);var v=e(f,y),g=y.props.stateReducer(f,we({},y,{changes:v}));return g},[e]),a=I.useReducer(s,t,n),l=a[0],c=a[1],u=Ep(t),d=I.useCallback(function(f){return c(we({props:u.current},f))},[u]),h=o.current;return I.useEffect(function(){var f=lo(i.current,h?.props),y=h&&i.current&&!r(f,l);y&&L_(h,f,l),i.current=l},[l,h,r]),[l,d]}var Xr={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:V_,scrollIntoView:op,environment:typeof window>"u"?void 0:window};function An(e,t,n){n===void 0&&(n=Op);var r=e["default"+za(t)];return r!==void 0?r:n[t]}function Yr(e,t,n){n===void 0&&(n=Op);var r=e[t];if(r!==void 0)return r;var i=e["initial"+za(t)];return i!==void 0?i:An(e,t,n)}function K_(e){var t=Yr(e,"selectedItem"),n=Yr(e,"isOpen"),r=G_(e),i=Yr(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 Zr(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 H_(e,t,n){var r=I.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return I.useEffect(function(){if(!e)return Pt;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,uo(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&&!uo(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 _p=function(){return Pt};process.env.NODE_ENV!=="production"&&(_p=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 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=I.useCallback(function(s,a,l,c){i.current[s]={suppressRefError:a,refKey:l,elementRef:c}},[]);return o});function J_(e,t,n,r){r===void 0&&(r={});var i=r.document,o=No();I.useEffect(function(){if(!(!e||o||!i)){var s=e(t);xu(s,i)}},n),I.useEffect(function(){return function(){xu.cancel(),T_(i)}},[i])}function W_(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 U_(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(i(t),o))},[t]),a}var Np=Pt;process.env.NODE_ENV!=="production"&&(Np=function(t){var n=t.props,r=t.state,i=I.useRef(n),o=No();I.useEffect(function(){o||($a(r,i.current,n),i.current=n)},[r,n,o])});function Iu(e,t,n){var r;n===void 0&&(n=!0);var i=((r=e.items)==null?void 0:r.length)&&t>=0;return we({isOpen:!1,highlightedIndex:-1},i&&we({selectedItem:e.items[t],isOpen:An(e,"isOpen"),highlightedIndex:An(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function Q_(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function No(){var e=I.useRef(!0);return I.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function Gs(e){var t=An(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function G_(e){var t=Yr(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var Qi={environment:Q.shape({addEventListener:Q.func.isRequired,removeEventListener:Q.func.isRequired,document:Q.shape({createElement:Q.func.isRequired,getElementById:Q.func.isRequired,activeElement:Q.any.isRequired,body:Q.any.isRequired}).isRequired,Node:Q.func.isRequired}),itemToString:Q.func,itemToKey:Q.func,stateReducer:Q.func},Tp=we({},Qi,{getA11yStatusMessage:Q.func,highlightedIndex:Q.number,defaultHighlightedIndex:Q.number,initialHighlightedIndex:Q.number,isOpen:Q.bool,defaultIsOpen:Q.bool,initialIsOpen:Q.bool,selectedItem:Q.any,initialSelectedItem:Q.any,defaultSelectedItem:Q.any,id:Q.string,labelId:Q.string,menuId:Q.string,getItemId:Q.func,toggleButtonId:Q.string,onSelectedItemChange:Q.func,onHighlightedIndexChange:Q.func,onStateChange:Q.func,onIsOpenChange:Q.func,scrollIntoView:Q.func});function X_(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:Zr(i,e,0)};break;case n.FunctionOpenMenu:o={isOpen:!0,highlightedIndex:Zr(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:An(i,"isOpen"),selectedItem:An(i,"selectedItem"),inputValue:An(i,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return we({},e,o)}Sr(Sr({},Tp),{items:Q.array.isRequired,isItemDisabled:Q.func});Sr(Sr({},Xr),{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 Ka=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,Ha=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,Ja=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,Wa=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,Qa=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,Ga=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,Xa=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,Ya=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,Za=process.env.NODE_ENV!=="production"?"__input_change__":8,fo=process.env.NODE_ENV!=="production"?"__input_blur__":9,el=process.env.NODE_ENV!=="production"?"__input_click__":10,kp=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,Rp=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,tl=process.env.NODE_ENV!=="production"?"__item_click__":13,Ap=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,Fp=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,Pp=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,Dp=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,Mp=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,nl=process.env.NODE_ENV!=="production"?"__function_select_item__":19,jp=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,Lp=process.env.NODE_ENV!=="production"?"__function_reset__":21,rl=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,Bp=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:rl,FunctionCloseMenu:Dp,FunctionOpenMenu:Pp,FunctionReset:Lp,FunctionSelectItem:nl,FunctionSetHighlightedIndex:Mp,FunctionSetInputValue:jp,FunctionToggleMenu:Fp,InputBlur:fo,InputChange:Za,InputClick:el,InputKeyDownArrowDown:Ka,InputKeyDownArrowUp:Ha,InputKeyDownEnd:Qa,InputKeyDownEnter:Ya,InputKeyDownEscape:Ja,InputKeyDownHome:Wa,InputKeyDownPageDown:Xa,InputKeyDownPageUp:Ga,ItemClick:tl,ItemMouseMove:Rp,MenuMouseLeave:kp,ToggleButtonClick:Ap});function Y_(e){var t=K_(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)),we({},t,{inputValue:r})}var Z_=we({},Tp,{items:Q.array.isRequired,isItemDisabled:Q.func,inputValue:Q.string,defaultInputValue:Q.string,initialInputValue:Q.string,inputId:Q.string,onInputValueChange:Q.func});function e1(e,t,n,r){var i=I.useRef(),o=z_(e,t,n,r),s=o[0],a=o[1],l=No();return I.useEffect(function(){if(co(t,"selectedItem")){if(!l){var c=t.itemToKey(t.selectedItem)!==t.itemToKey(i.current);c&&a({type:rl,inputValue:t.itemToString(t.selectedItem)})}i.current=s.selectedItem===i.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[lo(s,t),a]}var Vp=Pt;process.env.NODE_ENV!=="production"&&(Vp=function(t,n){Q.checkPropTypes(Z_,t,"prop",n.name)});var t1=we({},Xr,{isItemDisabled:function(){return!1}});function n1(e,t){var n,r=t.type,i=t.props,o=t.altKey,s;switch(r){case tl:s={isOpen:An(i,"isOpen"),highlightedIndex:Gs(i),selectedItem:i.items[t.index],inputValue:i.itemToString(i.items[t.index])};break;case Ka:e.isOpen?s={highlightedIndex:Hn(e.highlightedIndex,1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:o&&e.selectedItem==null?-1:Zr(i,e,1),isOpen:i.items.length>=0};break;case Ha:e.isOpen?o?s=Iu(i,e.highlightedIndex):s={highlightedIndex:Hn(e.highlightedIndex,-1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:Zr(i,e,-1),isOpen:i.items.length>=0};break;case Ya:s=Iu(i,e.highlightedIndex);break;case Ja:s=we({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case Ga:s={highlightedIndex:Hn(e.highlightedIndex,-10,i.items,i.isItemDisabled,!0)};break;case Xa:s={highlightedIndex:Hn(e.highlightedIndex,10,i.items,i.isItemDisabled,!0)};break;case Wa:s={highlightedIndex:Cr(0,!1,i.items,i.isItemDisabled)};break;case Qa:s={highlightedIndex:Cr(i.items.length-1,!0,i.items,i.isItemDisabled)};break;case fo:s=we({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 Za:s={isOpen:!0,highlightedIndex:Gs(i),inputValue:t.inputValue};break;case el:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Zr(i,e,0)};break;case nl:s={selectedItem:t.selectedItem,inputValue:i.itemToString(t.selectedItem)};break;case rl:s={inputValue:t.inputValue};break;default:return X_(e,t,Bp)}return we({},e,s)}var r1=["onMouseLeave","refKey","ref"],i1=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],o1=["onClick","onPress","refKey","ref"],s1=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];il.stateChangeTypes=Bp;function il(e){e===void 0&&(e={}),Vp(e,il);var t=we({},t1,e),n=t.items,r=t.scrollIntoView,i=t.environment,o=t.getA11yStatusMessage,s=e1(n1,t,Y_,Q_),a=s[0],l=s[1],c=a.isOpen,u=a.highlightedIndex,d=a.selectedItem,h=a.inputValue,f=I.useRef(null),y=I.useRef({}),v=I.useRef(null),g=I.useRef(null),w=No(),m=q_(t),b=I.useRef(),C=Ep({state:a,props:t}),E=I.useCallback(function(B){return y.current[m.getItemId(B)]},[m]);J_(o,a,[c,u,d,h],i);var _=W_({menuElement:f.current,highlightedIndex:u,isOpen:c,itemRefs:y,scrollIntoView:r,getItemNodeFromIndex:E});Np({props:t,state:a}),I.useEffect(function(){var B=Yr(t,"isOpen");B&&v.current&&v.current.focus()},[]),I.useEffect(function(){w||(b.current=n.length)});var A=H_(i,I.useCallback(function(){C.current.state.isOpen&&l({type:fo,selectItem:!1})},[l,C]),I.useMemo(function(){return[f,g,v]},[f.current,g.current,v.current])),k=_p("getInputProps","getMenuProps");I.useEffect(function(){c||(y.current={})},[c]),I.useEffect(function(){var B;!c||!(i!=null&&i.document)||!(v!=null&&(B=v.current)!=null&&B.focus)||i.document.activeElement!==v.current&&v.current.focus()},[c,i]);var L=I.useMemo(function(){return{ArrowDown:function(S){S.preventDefault(),l({type:Ka,altKey:S.altKey})},ArrowUp:function(S){S.preventDefault(),l({type:Ha,altKey:S.altKey})},Home:function(S){C.current.state.isOpen&&(S.preventDefault(),l({type:Wa}))},End:function(S){C.current.state.isOpen&&(S.preventDefault(),l({type:Qa}))},Escape:function(S){var $=C.current.state;($.isOpen||$.inputValue||$.selectedItem||$.highlightedIndex>-1)&&(S.preventDefault(),l({type:Ja}))},Enter:function(S){var $=C.current.state;!$.isOpen||S.which===229||(S.preventDefault(),l({type:Ya}))},PageUp:function(S){C.current.state.isOpen&&(S.preventDefault(),l({type:Ga}))},PageDown:function(S){C.current.state.isOpen&&(S.preventDefault(),l({type:Xa}))}}},[l,C]),M=I.useCallback(function(B){return we({id:m.labelId,htmlFor:m.inputId},B)},[m]),F=I.useCallback(function(B,S){var $,q=B===void 0?{}:B,X=q.onMouseLeave,ie=q.refKey,ne=ie===void 0?"ref":ie,se=q.ref,ee=gn(q,r1),me=S===void 0?{}:S,U=me.suppressRefError,ye=U===void 0?!1:U;return k("getMenuProps",ye,ne,f),we(($={},$[ne]=fr(se,function(Z){f.current=Z}),$.id=m.menuId,$.role="listbox",$["aria-labelledby"]=ee&&ee["aria-label"]?void 0:""+m.labelId,$.onMouseLeave=rt(X,function(){l({type:kp})}),$),ee)},[l,k,m]),j=I.useCallback(function(B){var S,$,q=B===void 0?{}:B,X=q.item,ie=q.index,ne=q.refKey,se=ne===void 0?"ref":ne,ee=q.ref,me=q.onMouseMove,U=q.onMouseDown,ye=q.onClick;q.onPress;var Z=q.disabled,Be=gn(q,i1);Z!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var Fe=C.current,Ae=Fe.props,We=Fe.state,et=$_(X,ie,Ae.items,"Pass either item or index to getItemProps!"),tt=et[0],xe=et[1],ot=Ae.isItemDisabled(tt,xe),bt="onClick",at=ye,Ge=function(){A.isTouchEnd||xe===We.highlightedIndex||(_.current=!1,l({type:Rp,index:xe,disabled:ot}))},D=function(){l({type:tl,index:xe})},K=function(re){return re.preventDefault()};return we((S={},S[se]=fr(ee,function(R){R&&(y.current[m.getItemId(xe)]=R)}),S["aria-disabled"]=ot,S["aria-selected"]=xe===We.highlightedIndex,S.id=m.getItemId(xe),S.role="option",S),!ot&&($={},$[bt]=rt(at,D),$),{onMouseMove:rt(me,Ge),onMouseDown:rt(U,K)},Be)},[l,m,C,A,_]),G=I.useCallback(function(B){var S,$=B===void 0?{}:B,q=$.onClick;$.onPress;var X=$.refKey,ie=X===void 0?"ref":X,ne=$.ref,se=gn($,o1),ee=C.current.state,me=function(){l({type:Ap})};return we((S={},S[ie]=fr(ne,function(U){g.current=U}),S["aria-controls"]=m.menuId,S["aria-expanded"]=ee.isOpen,S.id=m.toggleButtonId,S.tabIndex=-1,S),!se.disabled&&we({},{onClick:rt(q,me)}),se)},[l,C,m]),P=I.useCallback(function(B,S){var $,q=B===void 0?{}:B,X=q.onKeyDown,ie=q.onChange,ne=q.onInput,se=q.onBlur;q.onChangeText;var ee=q.onClick,me=q.refKey,U=me===void 0?"ref":me,ye=q.ref,Z=gn(q,s1),Be=S===void 0?{}:S,Fe=Be.suppressRefError,Ae=Fe===void 0?!1:Fe;k("getInputProps",Ae,U,v);var We=C.current.state,et=function(K){var R=Ws(K);R&&L[R]&&L[R](K)},tt=function(K){l({type:Za,inputValue:K.target.value})},xe=function(K){if(i!=null&&i.document&&We.isOpen&&!A.isMouseDown){var R=K.relatedTarget===null&&i.document.activeElement!==i.document.body;l({type:fo,selectItem:!R})}},ot=function(){l({type:el})},bt="onChange",at={};if(!Z.disabled){var Ge;at=(Ge={},Ge[bt]=rt(ie,ne,tt),Ge.onKeyDown=rt(X,et),Ge.onBlur=rt(se,xe),Ge.onClick=rt(ee,ot),Ge)}return we(($={},$[U]=fr(ye,function(D){v.current=D}),$["aria-activedescendant"]=We.isOpen&&We.highlightedIndex>-1?m.getItemId(We.highlightedIndex):"",$["aria-autocomplete"]="list",$["aria-controls"]=m.menuId,$["aria-expanded"]=We.isOpen,$["aria-labelledby"]=Z&&Z["aria-label"]?void 0:m.labelId,$.autoComplete="off",$.id=m.inputId,$.role="combobox",$.value=We.inputValue,$),at,Z)},[l,m,i,L,C,A,k]),V=I.useCallback(function(){l({type:Fp})},[l]),Y=I.useCallback(function(){l({type:Dp})},[l]),le=I.useCallback(function(){l({type:Pp})},[l]),pe=I.useCallback(function(B){l({type:Mp,highlightedIndex:B})},[l]),ge=I.useCallback(function(B){l({type:nl,selectedItem:B})},[l]),x=I.useCallback(function(B){l({type:jp,inputValue:B})},[l]),J=I.useCallback(function(){l({type:Lp})},[l]);return{getItemProps:j,getLabelProps:M,getMenuProps:F,getInputProps:P,getToggleButtonProps:G,toggleMenu:V,openMenu:le,closeMenu:Y,setHighlightedIndex:pe,setInputValue:x,selectItem:ge,reset:J,highlightedIndex:u,isOpen:c,selectedItem:d,inputValue:h}}Qi.stateReducer,Qi.itemToKey,Qi.environment,Q.array,Q.array,Q.array,Q.func,Q.number,Q.number,Q.number,Q.func,Q.func,Q.string,Q.string;Xr.itemToKey,Xr.stateReducer,Xr.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 a1="_comboboxContainer_1lcc8_1",l1="_inputContainer_1lcc8_12",c1="_input_1lcc8_12",u1="_toggleButton_1lcc8_33",d1="_menu_1lcc8_39",f1="_menuBottom_1lcc8_55",p1="_menuTop_1lcc8_61",h1="_menuItem_1lcc8_66",m1="_highlighted_1lcc8_73",g1="_selected_1lcc8_77",y1="_hidden_1lcc8_81",Yt={comboboxContainer:a1,inputContainer:l1,input:c1,toggleButton:u1,menu:d1,menuBottom:f1,menuTop:p1,menuItem:h1,highlighted:m1,selected:g1,hidden:y1};function v1(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function Up({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:i,style:o,menuPosition:s="bottom"}){const[a,l]=I.useState(e),c=I.useRef(null);I.useEffect(()=>l(e),[e]);const u=I.useCallback(_=>{_?.length>0?l(e.filter(v1(_))):l(e)},[e]),{isOpen:d,getToggleButtonProps:h,getMenuProps:f,getInputProps:y,highlightedIndex:v,getItemProps:g,setInputValue:w}=il({items:a,selectedItem:t?e.find(_=>_.value===t):null,itemToString:_=>_?.label||"",onInputValueChange:({inputValue:_})=>u(_),onSelectedItemChange:({selectedItem:_})=>{n(_),c.current?.blur()}}),m=()=>{w(""),l(e)},b=()=>m(),C=I.useMemo(()=>e.find(_=>_.value===t)?.label,[e,t]),E=()=>{w(t&&C?C:"")};return p.jsxs("div",{style:{position:"relative",...o},children:[p.jsx("div",{className:Yt.comboboxContainer,children:p.jsxs("div",{className:Yt.inputContainer,children:[p.jsx("input",{style:{border:"none"},disabled:i,placeholder:r,className:Yt.input,...y({onFocus:b,onBlur:E,ref:c})}),p.jsx("button",{style:{border:"none"},disabled:i,"aria-label":"toggle menu",className:Yt.toggleButton,type:"button",...h(),children:d?p.jsx(p.Fragment,{children:"↑"}):p.jsx(p.Fragment,{children:"↓"})})]})}),p.jsx("ul",{className:`${Yt.menu} ${d&&e.length?"":Yt.hidden} ${s==="top"?Yt.menuTop:Yt.menuBottom}`,...f(),children:d&&a.map((_,A)=>p.jsx("li",{className:`${Yt.menuItem} ${v===A?Yt.highlighted:""} ${t===_?.value?Yt.selected:""}`,...g({item:_,index:A}),children:p.jsx("span",{children:_.label})},_.id))})]})}function b1(e,t){const n=e?.read?.selectedFieldMappings||{};t.forEach(r=>{const{field:i,value:o}=r;if(o===null){const s=n[i];delete n[i],s&&e?.read?.selectedValueMappings&&e.read.selectedValueMappings[s]&&delete e.read.selectedValueMappings[s]}else{const s=n[i];n[i]=o,s&&s!==o&&e?.read?.selectedValueMappings&&e.read.selectedValueMappings[s]&&delete e.read.selectedValueMappings[s]}})}function ai(e,t,n){t(e,r=>b1(r,n))}const w1="Each field must be mapped to a unique value";function ol({field:e,onSelectChange:t,allFields:n}){const{configureState:r,selectedObjectName:i,setConfigureState:o}=Bt(),[s,a]=I.useState(!0),{isError:l,removeError:c,getError:u}=un(),h=r?.read?.selectedFieldMappings?.[e.mapToName];I.useEffect(()=>{e._default&&!h&&i&&r&&ai(i,o,[{field:e.mapToName,value:e._default}]),a(!1)},[e,o,i,h,r]);const f=I.useMemo(()=>n.map(m=>({id:m.fieldName,label:m.displayName,value:m.fieldName})),[n]),y=p.jsx(Up,{disabled:s,items:f,selectedValue:h||null,onSelectedItemChange:m=>{t({target:{name:e.mapToName,value:m?.value}})},placeholder:"Please select one",style:{width:"100%"}}),v=I.useCallback(()=>{i&&(ai(i,o,[{field:e.mapToName,value:null}]),l(Ie.MAPPING,i)&&c(Ie.MAPPING,i))},[e.mapToName,i,o,l,c]),{hasDuplicationError:g,errorMessage:w}=I.useMemo(()=>{const m=u(Ie.MAPPING,i),b=Array.isArray(m)&&m.length>0&&m.includes(e.mapToName);return{hasDuplicationError:b,errorMessage:b?w1:""}},[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?.prompt&&p.jsx(Kf,{id:`tooltip-id-${e?.prompt}`,tooltipText:e?.prompt})})]}),p.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[y,p.jsx(Je,{type:"button",variant:"ghost",onClick:v,children:"Clear"})]})]},e.mapToName),g&&p.jsxs("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:[" ",w," "]},e.mapToName)]})}const x1="_formControl_9qd8d_1",I1="_formLabel_9qd8d_5",S1="_formLabelRequired_9qd8d_11",C1="_formInput_9qd8d_16",O1="_formInputInvalid_9qd8d_20",E1="_formError_9qd8d_24",_1="_disabled_9qd8d_30",$n={formControl:x1,formLabel:I1,formLabelRequired:S1,formInput:C1,formInputInvalid:O1,formError:E1,disabled:_1};function To({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:i=!1,errorMessage:o,children:s}){return p.jsxs("div",{className:Jt($n.formControl,{[$n.disabled]:r}),children:[t&&p.jsx("label",{htmlFor:e,className:Jt($n.formLabel,{[$n.formLabelRequired]:n}),children:t}),p.jsx("div",{id:e,className:Jt($n.formInput,{[$n.formInputInvalid]:i}),children:s}),i&&o&&p.jsx("div",{className:$n.formError,role:"alert",children:o})]})}function qp({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(Ie.MAPPING,t,a),!0}return!1}function N1({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(To,{id:r.mapToName,children:p.jsx(ol,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function T1(){const{selectedObjectName:e,configureState:t,setConfigureState:n}=Bt(),{isError:r,removeError:i,setError:o}=un(),s=t?.read?.allFields||[],{fieldMapping:a}=gt(),l=t?.read?.selectedFieldMappings,c=y=>{const{value:v,name:g}=y.target;!v||qp({selectedFieldMappings:l,selectedObjectName:e,fieldName:g,fieldValue:v,setError:o})||(e&&ai(e,n,[{field:g,value:v}]),r(Ie.MAPPING,g)&&i(Ie.MAPPING,g),e&&r(Ie.MAPPING,e)&&i(Ie.MAPPING,e))},u=I.useMemo(()=>!e||!a?[]:Object.values(a[e]||{}).flat().filter(y=>!y.fieldName),[a,e]),d=I.useMemo(()=>(t?.read?.optionalMapFields||[]).filter(g=>!u.some(w=>w.mapToName===g.mapToName)),[t,u]),h=u.length>0;return d.length>0||h?p.jsxs(p.Fragment,{children:[p.jsx(Lt,{string:"Map the following optional fields"}),p.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:[d?.map(y=>p.jsx(To,{id:y.mapToName,children:p.jsx(ol,{allFields:s,field:y,onSelectChange:c})},y.mapToName)),h&&p.jsx(N1,{dynamicFieldMappings:u,onSelectChange:c,allFields:s})]})]}):null}function k1(){const{selectedObjectName:e,configureState:t,setConfigureState:n}=Bt(),{isError:r,removeError:i,setError:o}=un(),s=t?.read?.selectedFieldMappings,a=c=>{const{value:u,name:d}=c.target;!u||qp({selectedFieldMappings:s,selectedObjectName:e,fieldName:d,fieldValue:u,setError:o})||(e&&ai(e,n,[{field:d,value:u}]),r(Ie.MAPPING,d)&&i(Ie.MAPPING,d),e&&r(Ie.MAPPING,e)&&i(Ie.MAPPING,e))},l=I.useMemo(()=>t?.read?.requiredMapFields||[],[t]);return l?.length?p.jsxs(p.Fragment,{children:[p.jsx(Lt,{string:"Map the following fields"}),p.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:l.map(c=>p.jsx(To,{id:c.mapToName,isInvalid:r(Ie.MAPPING,c.mapToName),errorMessage:"* required",children:p.jsx(ol,{allFields:t?.read?.allFields||[],field:c,onSelectChange:a})},c.mapToName))})]}):null}const R1=(e,t)=>e.filter(n=>!t.has(n));function A1(){const{selectedObjectName:e,configureState:t,setConfigureState:n}=Bt(),{fieldMapping:r}=gt(),i=t?.read?.selectedFieldMappings||{},o=Object.keys(i),s=t?.read?.requiredMapFields||[],a=t?.read?.optionalMapFields||[],l=e&&r?Object.values(r[e]||{}).flat().filter(h=>!h.fieldName):[],c=s.concat(l,a).map(h=>h.mapToName),u=new Set(c),d=R1(o,u);I.useEffect(()=>{e&&d.length&&ai(e,n,d.map(h=>({field:h,value:null})))},[e,n,d])}const F1={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function $p({children:e,style:t}){return p.jsx(bn,{style:{...F1,...t},children:e})}function P1(){const{data:e}=Mn(),{hydratedRevision:t}=or(),{selectedObjectName:n}=Bt(),{providerName:r}=yt(),i=e?.appName,o=t?.content?.read?.objects?.find(c=>c.objectName===n),s=o?.displayName||n&&Wt(n),a=o?.mapToName,l=o?.mapToDisplayName||a&&Wt(a);return l&&i&&r?p.jsx($p,{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 Su(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function zp(...e){return t=>{let n=!1;const r=e.map(i=>{const o=Su(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():Su(e[i],null)}}}}function Or(...e){return H.useCallback(zp(...e),e)}function ko(e,t=[]){let n=[];function r(o,s){const a=H.createContext(s),l=n.length;n=[...n,s];const c=d=>{const{scope:h,children:f,...y}=d,v=h?.[e]?.[l]||a,g=H.useMemo(()=>y,Object.values(y));return p.jsx(v.Provider,{value:g,children:f})};c.displayName=o+"Provider";function u(d,h){const f=h?.[e]?.[l]||a,y=H.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=>H.createContext(s));return function(a){const l=a?.[e]||o;return H.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,D1(i,...t)]}function D1(...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 H.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Zt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e?.(i),n===!1||!i.defaultPrevented)return t?.(i)}}var li=globalThis?.document?H.useLayoutEffect:()=>{},M1=H[" useInsertionEffect ".trim().toString()]||li;function sl({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,o,s]=j1({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:i;{const u=H.useRef(e!==void 0);H.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=H.useCallback(u=>{if(a){const d=L1(u)?u(e):u;d!==e&&s.current?.(d)}else o(u)},[a,e,o,s]);return[l,c]}function j1({defaultProp:e,onChange:t}){const[n,r]=H.useState(e),i=H.useRef(n),o=H.useRef(t);return M1(()=>{o.current=t},[t]),H.useEffect(()=>{i.current!==n&&(o.current?.(n),i.current=n)},[n,i]),[n,r,o]}function L1(e){return typeof e=="function"}function B1(e){const t=H.useRef({value:e,previous:e});return H.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function V1(e){const[t,n]=H.useState(void 0);return li(()=>{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 U1(e,t){return H.useReducer((n,r)=>t[n][r]??n,e)}var al=e=>{const{present:t,children:n}=e,r=q1(t),i=typeof n=="function"?n({present:r.isPresent}):H.Children.only(n),o=Or(r.ref,$1(i));return typeof n=="function"||r.isPresent?H.cloneElement(i,{ref:o}):null};al.displayName="Presence";function q1(e){const[t,n]=H.useState(),r=H.useRef(null),i=H.useRef(e),o=H.useRef("none"),s=e?"mounted":"unmounted",[a,l]=U1(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return H.useEffect(()=>{const c=$i(r.current);o.current=a==="mounted"?c:"none"},[a]),li(()=>{const c=r.current,u=i.current;if(u!==e){const h=o.current,f=$i(c);e?l("MOUNT"):f==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),li(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,d=f=>{const v=$i(r.current).includes(CSS.escape(f.animationName));if(f.target===t&&v&&(l("ANIMATION_END"),!i.current)){const g=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=g)})}},h=f=>{f.target===t&&(o.current=$i(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:H.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function $i(e){return e?.animationName||"none"}function $1(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Xs(e){const t=z1(e),n=H.forwardRef((r,i)=>{const{children:o,...s}=r,a=H.Children.toArray(o),l=a.find(H1);if(l){const c=l.props.children,u=a.map(d=>d===l?H.Children.count(c)>1?H.Children.only(null):H.isValidElement(c)?c.props.children:null:d);return p.jsx(t,{...s,ref:i,children:H.isValidElement(c)?H.cloneElement(c,void 0,u):null})}return p.jsx(t,{...s,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function z1(e){const t=H.forwardRef((n,r)=>{const{children:i,...o}=n;if(H.isValidElement(i)){const s=W1(i),a=J1(o,i.props);return i.type!==H.Fragment&&(a.ref=r?zp(r,s):s),H.cloneElement(i,a)}return H.Children.count(i)>1?H.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var K1=Symbol("radix.slottable");function H1(e){return H.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===K1}function J1(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 W1(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Q1=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],xn=Q1.reduce((e,t)=>{const n=Xs(`Primitive.${t}`),r=H.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}},{}),Ro="Checkbox",[G1]=ko(Ro),[X1,ll]=G1(Ro);function Y1(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]=sl({prop:n,defaultProp:i??!1,onChange:l,caller:Ro}),[y,v]=H.useState(null),[g,w]=H.useState(null),m=H.useRef(!1),b=y?!!s||!!y.closest("form"):!0,C={checked:h,disabled:o,setChecked:f,control:y,setControl:v,name:a,form:s,value:u,hasConsumerStoppedPropagationRef:m,required:c,defaultChecked:Fn(i)?!1:i,isFormControl:b,bubbleInput:g,setBubbleInput:w};return p.jsx(X1,{scope:t,...C,children:Z1(d)?d(C):r})}var Kp="CheckboxTrigger",Hp=H.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}=ll(Kp,e),v=Or(i,u),g=H.useRef(l);return H.useEffect(()=>{const w=o?.form;if(w){const m=()=>d(g.current);return w.addEventListener("reset",m),()=>w.removeEventListener("reset",m)}},[o,d]),p.jsx(xn.button,{type:"button",role:"checkbox","aria-checked":Fn(l)?"mixed":l,"aria-required":c,"data-state":Gp(l),"data-disabled":a?"":void 0,disabled:a,value:s,...r,ref:v,onKeyDown:Zt(t,w=>{w.key==="Enter"&&w.preventDefault()}),onClick:Zt(n,w=>{d(m=>Fn(m)?!0:!m),y&&f&&(h.current=w.isPropagationStopped(),h.current||w.stopPropagation())})})});Hp.displayName=Kp;var cl=H.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(Y1,{__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(Hp,{...d,ref:t,__scopeCheckbox:n}),h&&p.jsx(Qp,{__scopeCheckbox:n})]})})});cl.displayName=Ro;var Jp="CheckboxIndicator",ul=H.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,o=ll(Jp,n);return p.jsx(al,{present:r||Fn(o.checked)||o.checked===!0,children:p.jsx(xn.span,{"data-state":Gp(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});ul.displayName=Jp;var Wp="CheckboxBubbleInput",Qp=H.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}=ll(Wp,e),y=Or(n,f),v=B1(o),g=V1(r);H.useEffect(()=>{const m=h;if(!m)return;const b=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(b,"checked").set,_=!i.current;if(v!==o&&E){const A=new Event("click",{bubbles:_});m.indeterminate=Fn(o),E.call(m,Fn(o)?!1:o),m.dispatchEvent(A)}},[h,v,o,i]);const w=H.useRef(Fn(o)?!1:o);return p.jsx(xn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??w.current,required:a,disabled:l,name:c,value:u,form:d,...t,tabIndex:-1,ref:y,style:{...t.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Qp.displayName=Wp;function Z1(e){return typeof e=="function"}function Fn(e){return e==="indeterminate"}function Gp(e){return Fn(e)?"indeterminate":e?"checked":"unchecked"}function dl(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 eN=["color"],Xp=I.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=dl(e,eN);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"}))}),tN=["color"],nN=I.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=dl(e,tN);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"}))}),rN=["color"],Yp=I.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=dl(e,rN);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 iN="_checkboxGroupContainer_hqfeu_1",oN="_stack_hqfeu_6",sN="_selectAllContainer_hqfeu_10",aN="_fieldContainer_hqfeu_17",lN="_checkbox_hqfeu_1",Er={checkboxGroupContainer:iN,stack:oN,selectAllContainer:sN,fieldContainer:aN,checkbox:lN};function cN({id:e,isChecked:t,label:n,onCheckedChange:r}){return p.jsxs("div",{className:Er.fieldContainer,children:[p.jsx(cl,{className:Er.checkbox,id:e,onCheckedChange:r,checked:t,children:p.jsx(ul,{children:p.jsx(Xp,{})})}),p.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function uN({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:i}){return p.jsxs("div",{className:Er.selectAllContainer,children:[p.jsx(cl,{className:Er.checkbox,id:e,onCheckedChange:r,checked:i?"indeterminate":t,children:p.jsxs(ul,{children:[i&&p.jsx(nN,{}),t===!0&&p.jsx(Xp,{})]})}),p.jsx("label",{htmlFor:e,children:n})]})}function dN({children:e}){return p.jsx("div",{className:Er.checkboxGroupContainer,children:e})}function fN({children:e}){return p.jsx("div",{className:Er.stack,children:e})}const pN="_paginationContainer_1p51x_1",hN="_pageInfo_1p51x_7",mN="_searchContainer_1p51x_13",gN="_searchInput_1p51x_17",yN="_noResults_1p51x_21",$r={paginationContainer:pN,pageInfo:hN,searchContainer:mN,searchInput:gN,noResults:yN};function Zp({items:e,onItemChange:t,itemsPerPage:n=8,showSelectAll:r=!0,showSearch:i=!0,searchPlaceholder:o="Search fields...",itemName:s="fields"}){const[a,l]=I.useState(1),[c,u]=I.useState(""),d=e.filter(C=>C.label.toLowerCase().includes(c.toLowerCase())),h=Math.ceil(d.length/n),f=(a-1)*n,y=f+n,v=d.slice(f,y),g=C=>{u(C),l(1)},w=C=>{d.forEach(E=>{t(E.id,C)})},m=d.length>0&&d.every(C=>C.isChecked),b=d.some(C=>C.isChecked);return p.jsxs(dN,{children:[i&&p.jsx("div",{className:$r.searchContainer,children:p.jsx(Gd,{id:"field-search",type:"text",placeholder:o,value:c,onChange:C=>g(C.target.value),className:$r.searchInput})}),r&&e.length>=2&&p.jsx(uN,{id:"select-all-fields",isChecked:m,label:`Select all ${d.length} ${c?"matching ":""}${s}`,onCheckedChange:w,isIndeterminate:b&&!m}),p.jsx(fN,{children:v.map(C=>p.jsx(cN,{id:C.id,isChecked:C.isChecked,label:C.label,onCheckedChange:E=>t(C.id,E===!0)},C.id))}),h>1&&p.jsxs("div",{className:$r.paginationContainer,children:[p.jsx(Je,{type:"button",onClick:()=>l(C=>Math.max(1,C-1)),disabled:a===1,variant:"ghost",children:"<"}),p.jsxs("span",{className:$r.pageInfo,children:[a," of ",h]}),p.jsx(Je,{type:"button",onClick:()=>l(C=>Math.min(h,C+1)),disabled:a===h,variant:"ghost",children:">"})]}),d.length===0&&c&&p.jsxs("div",{className:$r.noResults,children:["No ",s,' found matching "',c,'"']})]})}function vN(e,t,n){const r=e?.read?.selectedOptionalFields||{};r[t]=n,n||delete r[t]}function bN(e,t,n,r){t(e,i=>vN(i,n,r))}function wN(){const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=Bt(),i=t?.read?.selectedOptionalFields,o=t?.read?.optionalFields,s=(c,u)=>{r&&t&&bN(r,n,c,u)},a=I.useMemo(()=>o?.filter(c=>!Rr(c)&&"fieldName"in c&&"displayName"in c).map(c=>({id:c.fieldName,label:c.displayName,isChecked:!!i?.[c.fieldName]})).sort((c,u)=>c.label.localeCompare(u.label))||[],[o,i]);return!!(o&&o.length>0)&&p.jsxs(p.Fragment,{children:[p.jsx(Lt,{string:`${e} reads the following optional fields`}),p.jsx(Zp,{items:a,onItemChange:s,showSelectAll:a.length>=2},`${r}-${o?.length}`)]})}function xN(){return p.jsx(wN,{})}function IN(){const{installation:e}=dn(),{selectedObjectName:t}=Bt(),{displayName:n}=tp(),{toggleReadingObject:r,isPending:i}=np(),o=t?e?.config?.content?.read?.objects?.[t]:void 0;if(!o)return null;if(!o.disabled)return p.jsx(yi,{children:p.jsxs("p",{children:["Reading from ",n," is enabled."]})});const a=()=>{t&&r({objectName:t,disabled:!1,onError:l=>{console.error("Error re-enabling read object:",l)}})};return p.jsx(p.Fragment,{children:p.jsxs($p,{style:{backgroundColor:"var(--amp-colors-status-critical-muted)"},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[p.jsx(Yp,{style:{width:"16px",height:"16px",flexShrink:0}}),p.jsx("span",{style:{fontWeight:600},children:"Reading is currently disabled"})]}),p.jsxs("p",{style:{marginTop:"0.5rem",fontSize:"0.875rem"},children:["This object is not being synced. Click below to re-enable reading from"," ",p.jsx("b",{children:n}),"."]}),p.jsx(Je,{type:"button",onClick:a,variant:"ghost",style:{marginTop:"1rem",width:"100%"},disabled:i,children:i?"Re-enabling...":`Re-enable reading from ${n}`})]})})}const SN={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 CN({children:e,style:t,...n}){return p.jsx("span",{style:{...SN,...t},...n,children:e})}const ON="_errorAlert_1tcao_1",EN="_errorHeader_1tcao_11",_N="_errorIcon_1tcao_17",NN="_errorTitle_1tcao_24",TN="_errorMessage_1tcao_30",zr={errorAlert:ON,errorHeader:EN,errorIcon:_N,errorTitle:NN,errorMessage:TN};function kN({error:e}){return p.jsxs("div",{className:zr.errorAlert,children:[p.jsxs("div",{className:zr.errorHeader,children:[p.jsx(Yp,{className:zr.errorIcon}),p.jsx("span",{className:zr.errorTitle,children:"Unable to load object"})]}),p.jsx("div",{className:zr.errorMessage,children:e})]})}function RN(){const{data:e}=bo(),{selectedObjectName:t}=Bt(),{appName:n}=Mn(),r=e?.content?.read?.objects?.find(s=>s.objectName===t),i=r?.error,o=r?.requiredFields;return i?p.jsx(kN,{error:i}):p.jsxs(p.Fragment,{children:[p.jsx(Lt,{string:`${n} reads the following fields`}),p.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:o?.length?o.map(s=>Rr(s)?null:p.jsx(CN,{children:s.displayName},s.fieldName)):"There are no required fields."})]})}function AN(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 eh(e,t,n,r,i){t(e,o=>AN(o,e,n,r,i))}function ps(e){return e.mapToDisplayName||e.mapToName||e.fieldName||""}function FN(e,t){if(!e.fieldName)return{isValid:!1,errorMessage:"Field name is missing"};const n=t?.valueType;if(!["singleSelect","multiSelect"].includes(n||""))return{isValid:!1,errorMessage:"fieldName is not a singleSelect or multiSelect"};const r=t?.values;if(!r)return{isValid:!1,errorMessage:"Field values array is missing"};const i=Object.keys(r).length,o=Object.keys(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 PN(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 DN({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(_o,{style:{width:"100%",marginLeft:"1rem"}})})]})}function MN({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r}){const{configureState:i,selectedObjectName:o,setConfigureState:s}=Bt(),a=I.useMemo(()=>i?.read?.selectedValueMappings?.[n]||{},[i?.read?.selectedValueMappings,n]),l=I.useMemo(()=>a?.[e.mappedValue],[a,e.mappedValue]),c=I.useMemo(()=>r.map(f=>({id:f.value,label:f.displayValue,value:f.value})),[r]),u=I.useCallback(f=>{f&&t({target:{name:e.mappedValue,value:f.value,fieldName:n}})},[t,n,e.mappedValue]),d=I.useMemo(()=>p.jsx(Up,{items:c,selectedValue:l||null,onSelectedItemChange:u,placeholder:"Please select one",style:{borderRadius:"8px",width:"100%"}},l),[l,c,u]),h=I.useCallback(()=>{o&&eh(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(Je,{type:"button",variant:"ghost",onClick:h,children:"Clear"})]})]},e.mappedValue)}function jN(){const{fieldMapping:e}=gt(),{selectedObjectName:t,configureState:n,setConfigureState:r}=Bt(),i=n?.read?.selectedFieldMappings,o=n?.read?.selectedValueMappings,s=I.useMemo(()=>{const l=t&&e?Object.values(e[t]||{}).flat().filter(c=>c.mappedValues).map(c=>({...c})):[];if(i)for(let c=0;c<l.length;c+=1){const{mapToName:u}=l[c];i?.[u]&&(l[c].fieldName=i[u])}return l},[t,e,i]),a=I.useCallback(l=>{const{value:c,name:u,fieldName:d}=l.target;c&&t&&eh(t,r,u,c,d)},[t,r]);return s?.length?p.jsx(p.Fragment,{children:s.map(l=>{const c=n?.read?.allFieldsMetadata?.[l.fieldName],u=FN(l,c);return u.isValid?p.jsxs(p.Fragment,{children:[p.jsx(DN,{string:"Map the values for ",fieldName:ps(l)}),p.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:p.jsx(To,{id:ps(l),children:l?.mappedValues?.map(d=>{const h=c?.values||[],f=o?.[l.fieldName]||{},y=PN(h,f,d.mappedValue);return p.jsx(MN,{allValueOptions:y,mappedValue:d,onSelectChange:a,fieldName:l?.fieldName||""},`${d.mappedValue}-${l.fieldName}`)})},ps(l))})]}):(console.error(u.errorMessage,l),null)})}):null}function LN(){return A1(),p.jsxs(p.Fragment,{children:[p.jsx(IN,{}),p.jsx(P1,{}),p.jsx(RN,{}),p.jsx(k1,{}),p.jsx(T1,{}),p.jsx(jN,{}),p.jsx(xN,{}),p.jsx(l_,{})]})}function BN(e,t,n){if(e?.write?.selectedWriteObjects===null&&(e.write.selectedWriteObjects={}),e?.write){const r=e.write.selectedWriteObjects;n&&(r[t]={objectName:t}),n||delete r[t]}}function VN(e,t,n,r){t(e,i=>{BN(i,n,r)})}function UN(){const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=Bt(),i=n?.write?.selectedWriteObjects,o=n?.write?.writeObjects,s=(c,u)=>{t&&n&&VN(t,r,c,u)},a=!!o,l=o?.map(c=>({id:c.objectName,label:c.displayName,isChecked:!!i?.[c.objectName]}))||[];return a&&p.jsxs(p.Fragment,{children:[p.jsx(Lt,{string:`Allow ${e} to write to these objects`}),p.jsx(Zp,{items:l,onItemChange:s,showSelectAll:o.length>=2,searchPlaceholder:"Search objects...",itemName:"objects"})]})}function qN(){return p.jsx(p.Fragment,{children:p.jsx(UN,{})})}function th({resetComponent:e,onDisconnectSuccess:t}){return p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[p.jsx(Lt,{string:"Remove connection"}),p.jsx("p",{children:"Click to disconnect your connection from the provider."}),p.jsx(Gf,{resetComponent:e,onDisconnectSuccess:t,buttonText:"Remove connection",buttonVariant:"danger",buttonStyle:{fontSize:"13px",width:"100%"}})]})}const $N="_authenticationRow_1g2ms_1",zN="_field_1g2ms_8",KN="_value_1g2ms_12",hs={authenticationRow:$N,field:zN,value:KN};function Cu({label:e,value:t}){return p.jsxs("div",{className:hs.authenticationRow,children:[p.jsx("div",{className:hs.field,children:e}),p.jsx("div",{className:hs.value,children:t})]})}function HN(){const{selectedConnection:e}=fn(),{providerName:t}=yt(),r=e?.provider==="salesforce"?"subdomain":"workspace",i=`${t} ${r}`;return p.jsxs(p.Fragment,{children:[p.jsx(Lt,{string:"Connection details"}),p.jsxs("div",{style:{paddingBottom:"1rem"},children:[p.jsx(Cu,{label:i,value:e?.providerWorkspaceRef}),p.jsx(Cu,{label:"Status",value:Wt(e?.status||"")})]})]})}function JN(){const{installation:e}=gt(),{providerName:t}=yt();return e?p.jsxs(p.Fragment,{children:[p.jsx(Lt,{string:"Uninstall entire integration"}),p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",padding:"1rem 0"},children:[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(La,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})]}):null}function WN(){const{installation:e,resetComponent:t}=gt();return p.jsxs(p.Fragment,{children:[p.jsx(HN,{}),p.jsx(ja,{}),e&&p.jsx(JN,{}),!e&&p.jsx(th,{resetComponent:t})]})}function nh({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:i}){const{installation:o}=dn(),{hydratedRevision:s,loading:a}=or(),{configureState:l,selectedObjectName:c}=Bt(),u=o?.config,d=u&&c&&!!Rd(u,c)||!1,h=c?Kd(u,c):void 0,f=l?.read?.selectedFieldMappings,y=!Md(h,f),v=s&&c?ma(u,s,c):void 0,g=l?.read?.selectedOptionalFields,w=!Dd(v,g),m=c?u?.content?.read?.objects?.[c]?.selectedValueMappings:void 0,b=l?.read?.selectedValueMappings,C=!jd(m,b),E=u?.content?.write?.objects,_=l?.write?.selectedWriteObjects,A=!Ld(E||{},_||{}),F=w||y||C||A||r||c!==vr&&!d,j=!!s?.content?.read?.objects?.find(pe=>pe.objectName===c)?.error,G=a||n||!l||!c||!F||j,P=c===vr,V=c===no,Y=p.jsx(Je,{type:"submit",disabled:G,children:r?"Install":"Save"}),le=p.jsx(Je,{type:"button",onClick:t,disabled:G,variant:"ghost",children:"Reset"});return n?p.jsx(ii,{}):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:!V&&p.jsxs(p.Fragment,{children:[Y,le]})}),p.jsxs(bn,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[i&&p.jsx(ui,{children:typeof i=="string"?i:"Installation Failed."}),a&&p.jsx(ii,{}),s&&!P&&!V&&p.jsx(LN,{}),s&&P&&!V&&p.jsx(qN,{}),!a&&V&&p.jsx(WN,{})]})]})}const rh=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:i,onUpdateSuccess:o,fieldMapping:s}=gt(),{hydratedRevision:a,loading:l}=or(),{selectedObjectName:c}=Ba(),{selectedConnection:u}=fn(),d=nd(),{projectIdOrName:h}=Ke(),{resetBoundary:f,setErrors:y,setError:v,getError:g}=un(),{resetConfigureState:w,objectConfigurationsState:m}=Va(),b=Hd(c||"",m),{onNextIncompleteTab:C}=o_(),E=I.useCallback(()=>{f(Ie.INSTALLATION_MUTATION)},[f]),_=I.useCallback(k=>k?L=>{v(Ie.INSTALLATION_MUTATION,k,L)}:L=>{console.error("objectName is required to set installation error: ",L)},[v]),A=I.useCallback(k=>k?g(Ie.INSTALLATION_MUTATION,k):"",[g]);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:_,getMutateInstallationError:A,resetMutateInstallationErrorState:E,resetConfigureState:w,objectConfigurationsState:m,configureState:b,onInstallSuccess:i,onUpdateSuccess:o,onNextIncompleteTab:C,fieldMapping:s}},QN=void 0;function GN(){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:v,fieldMapping:g}=rh(),[w,m]=I.useState(!1),{createInstallation:b}=Od(),C=i===vr,E=c(i),_=I.useCallback(()=>{s(Ie.MAPPING),n?.content&&!r&&i&&Vd(n,QN,i,d)},[s,n,r,i,d]);I.useEffect(()=>{!f&&n?.content&&!r&&_()},[f,h,n,r,_]);const A=()=>{u();const{requiredMapFields:M,selectedFieldMappings:F}=f?.read||{},{errorList:j}=Pd(M,F,a);if(!(j.length>0))if(i&&o?.id&&e&&n){m(!0);const G=Yx(f,i,n,e,g);if(!G){console.error("Error when generating createConfig from configureState"),m(!1);return}b({config:G.content,onSuccess:P=>{t(P),y?.(P.id,P.config),m(!1),v()},onError:P=>{l(i)(P.message),m(!1)}})}else console.error("CreateInstallallation - onSaveReadCreate: missing required props")},k=()=>{if(u(),i&&o?.id&&e&&n){m(!0);const M=eI(f,n,e);if(!M){console.error("Error when generating createConfig from configureState"),m(!1);return}b({config:M.content,onSuccess:F=>{t(F),y?.(F.id,F.config),m(!1),v()},onError:F=>{l(i)(F.message),m(!1)}})}else console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},L=M=>{M.preventDefault(),C?k():A()};return p.jsx(nh,{errorMsg:E,isCreateMode:!0,isLoading:w,onSave:L,onReset:_})}const XN=(e,t,n)=>{const r=Ud(e),i=qd(e),o=$d(t,n),s=zd(e);return{content:{read:{objects:{[t]:{objectName:t,selectedFields:r,selectedFieldMappings:i,dynamicMappingsInput:o,selectedValueMappings:s||{}}}}}}},YN=e=>({content:{write:{objects:Wd(e)}}});function ZN({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}=rh(),{updateInstallation:y}=_d(),[v,g]=I.useState(!1),w=i===vr,m=l(i),{config:b}=e,C=I.useCallback(()=>{o(Ie.MAPPING),n?.content&&!r&&i&&Vd(n,b,i,c)},[o,n,r,i,b,c]);I.useEffect(()=>{u||C()},[u,C]);const E=I.useMemo(()=>n?.content?.read?.objects?.find(M=>M?.objectName===i),[n,i]),_=()=>{const{requiredMapFields:L,selectedFieldMappings:M}=u?.read||{},{errorList:F}=Pd(L,M,s);if(!(F.length>0))if(n&&u&&i&&E){g(!0);const j=XN(u,i,f);if(!j){console.error("Error when generating updateConfig from configureState"),g(!1);return}y({config:j.content,onSuccess:G=>{t(G),d?.(G.id,G.config),g(!1),h()},onError:G=>{a(i)(G.message),g(!1)}})}else console.error("UpdateInstallation - onSaveRead missing required props")},A=()=>{if(u&&n){g(!0);const L=YN(u);if(!L){console.error("Error when generating write updateConfig from configureState"),g(!1);return}y({config:L.content,onSuccess:M=>{t(M),d?.(M.id,M.config),g(!1),h()},onError:M=>{a(i)(M.message),g(!1)}})}else console.error("UpdateInstallation - onSaveWrite missing required props")},k=L=>{L.preventDefault(),w?A():_()};return p.jsx(nh,{errorMsg:m,onSave:k,onReset:C,isLoading:v})}function eT(){const{integrationObj:e,installation:t}=gt();return e?t&&e?p.jsx(ZN,{installation:t}):p.jsx(GN,{}):p.jsx(bd,{message:"We can't load the integration"})}class fl extends I.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("Ampersand Error Boundary caught an error:",t),console.error("[Error Info]:",n),this.props.onError?.(t,n)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:p.jsx(Tt,{message:this.state.error?.message||"Something went wrong. Please try again later."}):this.props.children}}function tT(){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 pl({text:e,children:t}){return p.jsx(Tr,{children:p.jsxs(bn,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[p.jsx(tT,{}),p.jsx("p",{children:e}),t]})})}function nT({provider:e}){const{providerName:t}=yt(e),n=`You have successfully installed your ${t} integration.`;return p.jsx(pl,{text:n,children:p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:p.jsx(La,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const rT=e=>{const{read:t,write:n}=e?.content??{};return!t&&!n};function iT({children:e}){const t=I.useRef(!1),{projectIdOrName:n}=Ke(),{hydratedRevision:r,loading:i}=or(),{integrationObj:o,installation:s,groupRef:a,consumerRef:l,onInstallSuccess:c,isIntegrationDeleted:u}=gt(),{mutate:d,isIdle:h,isPending:f,error:y,errorMsg:v}=Cd(),{selectedConnection:g,isConnectionsLoading:w}=fn(),m=i||f||w,b=r?.content?.provider,C=rT(r);return I.useEffect(()=>{if(!m&&!w&&r&&C&&!s&&g&&o?.id&&!u&&b){const E={projectIdOrName:n,integrationId:o?.id,installation:{groupRef:a,connectionId:g?.id,config:{content:{provider:b}}}};Jd(r)===!0&&(E.installation.config.content.proxy=r?.content?.proxy),h&&!t.current&&d(E,{onSuccess:_=>{t.current||(c?.(_?.id,_.config),t.current=!0)}})}},[r,C,s,g,n,o?.id,a,l,m,c,u,w,b,d,h]),C&&b&&s?p.jsx(nT,{provider:b}):y?p.jsx(Tt,{message:v??"Create installation failed"}):o?m?p.jsx(kr,{}):p.jsx("div",{children:e}):p.jsx(Tt,{message:"We can't load the integration"})}function vi(){const e=mt(),t=Ze();return vn({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"),Ye(n)}})}function oT({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:a,metadataInputs:l,moduleError:c}){const{projectIdOrName:u}=Ke(),d=vi(),h=I.useCallback(f=>{const{apiKey:y,providerMetadata:v}=f,g={projectIdOrName:u,generateConnectionParams:{providerWorkspaceRef:v?.workspace?.value,groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,apiKey:y,...v&&{providerMetadata:v}}};d.mutate(g)},[u,o,i,r,n,e,d]);return a===null?p.jsx(BE,{provider:e,providerInfo:t,handleSubmit:h,error:c||null,metadataInputs:l}):s}function sT({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:a,metadataInputs:l,moduleError:c}){const{projectIdOrName:u}=Ke(),d=vi(),h=I.useCallback(f=>{const{user:y,pass:v,providerMetadata:g}=f,w={projectIdOrName:u,generateConnectionParams:{providerWorkspaceRef:g?.workspace?.value,groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:y,password:v},...g&&{providerMetadata:g}}};d.mutate(w)},[u,o,i,r,n,e,d]);return a===null?p.jsx(zE,{provider:e,providerInfo:t,handleSubmit:h,error:c||null,metadataInputs:l}):s}function aT({providerInfo:e,handleSubmit:t,isButtonDisabled:n,buttonVariant:r,metadataInputs:i}){const[o,s]=I.useState({}),a=h=>{const{name:f,value:y}=h.currentTarget;s(v=>({...v,[f]:y.trim()}))},l=Ir(i,o),c=n||!l,u=e.customOpts?.inputs||[],d=()=>{const h=Eo(i,o),f=Object.fromEntries(u.map(y=>[y.name,o[y.name]]));t({customAuth:f,providerMetadata:h})};return p.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[u.map(h=>p.jsxs("div",{children:[p.jsx(Hf,{url:h.docsURL,prompt:h.prompt,inputName:h.displayName}),p.jsx(yn.PasswordInput,{id:h.name,name:h.name,onChange:a,placeholder:""})]},h.name)),i.map(h=>p.jsx(gi,{metadata:h,onChange:a,variant:"header"},h.name)),p.jsx(Je,{style:{marginTop:"1em",width:"100%"},disabled:c,type:"submit",onClick:d,variant:r,children:"Next"})]})}function lT({providerInfo:e,handleSubmit:t,error:n,isButtonDisabled:r,metadataInputs:i}){return p.jsxs(nr,{children:[p.jsx(rr,{children:`Set up ${e.displayName} integration`}),p.jsx(wn,{error:n}),p.jsx(aT,{providerInfo:e,handleSubmit:t,isButtonDisabled:r||!!n,metadataInputs:i})]})}function cT({providerInfo:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,selectedConnection:s,metadataInputs:a,moduleError:l}){const{projectIdOrName:c}=Ke(),u=vi(),[d,h]=I.useState(l||null),f=I.useCallback(y=>{const{customAuth:v,providerMetadata:g}=y;h(null);const w={projectIdOrName:c,generateConnectionParams:{providerWorkspaceRef:g?.workspace?.value,groupName:i,groupRef:r,consumerName:n,consumerRef:t,provider:e.name,customAuth:v,...g&&{providerMetadata:g}}};u.mutate(w,{onError:m=>{Ye(m,h)},onSuccess:()=>{h(null)}})},[c,i,r,n,t,e.name,u]);return s===null?p.jsx(lT,{providerInfo:e,handleSubmit:f,error:d,metadataInputs:a}):o}function uT({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(nr,{children:[p.jsx(rr,{children:o||`Set up ${r} integration`}),p.jsx(wn,{error:t}),i,p.jsx(Je,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function dT({...e}){return p.jsx(uT,{...e})}function fT({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,selectedConnection:s,providerName:a,moduleError:l}){const{projectIdOrName:c}=Ke(),u=vi(),d=I.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(dT,{handleSubmit:d,error:l||null,providerName:a}):o}const pT=()=>{const e=mt(),t=Ze();return vn({mutationKey:["createOauthConnection"],mutationFn:async n=>(await e()).oAuthApi.oauthConnect(n),onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})},hT=pa("VITE_AMP_ENABLE_CSRF",!1),mT=pa("NEXT_AMP_ENABLE_CSRF",!1),gT=pa("REACT_APP_AMP_ENABLE_CSRF",!1),yT=!!hT||!!mT||!!gT;function vT({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return p.jsxs(nr,{children:[p.jsx(rr,{children:`Set up ${r} integration`}),p.jsx(gI,{children:`Click Next to sign into the ${r} account you'd like to sync.`}),p.jsx(wn,{error:t}),p.jsx(Je,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:n&&!t?"Loading...":"Next"})]})}function bT({handleSubmit:e,setFormData:t,error:n,isButtonDisabled:r,providerName:i,metadataInputs:o}){return p.jsxs(nr,{children:[p.jsxs(rr,{children:["Enter your ",i," workspace"]}),p.jsx(wn,{error:n}),p.jsx("br",{}),o.map(s=>p.jsx(gi,{metadata:s,onChange:a=>t(s.name,a.currentTarget.value),providerName:i},s.name)),p.jsx(Je,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const Ou=600,Eu=600;function wT({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,providerName:o,metadataInputs:s,moduleError:a}){const{projectId:l}=Mn(),c=Ze(),u=I.useRef(null),[d,h]=I.useState(a||null),[f,y]=I.useState({}),[v,g]=I.useState({}),{mutateAsync:w,isPending:m}=pT(),{isFetching:b,refetch:C}=fa({groupRef:r,provider:e});I.useEffect(()=>{const k=L=>{L.origin===gd&&(L.data?.eventType==="AUTHORIZATION_SUCCEEDED"?(h(null),console.debug("New connection:",L.data.data.connection),c.invalidateQueries({queryKey:["amp","connections"]})):L.data?.eventType==="AUTHORIZATION_FAILED"&&(console.error("OAuth failed:",L.data.data.error),c.invalidateQueries({queryKey:["amp","connections"]}),h(L.data.data.error||"An error occurred. Please try again.")),u.current?.close())};return window.addEventListener("message",k),()=>window.removeEventListener("message",k)},[c]);const E=(k,L)=>{y(M=>({...M,[k]:L})),g(M=>({...M,[k]:{value:L,source:"input"}}))},_=async()=>{h(null);try{const{data:k}=await C();if(k&&k.length>0){console.debug("connections found");return}}catch{console.debug("error with fetching connections")}if(s.length>0&&!Ir(s,f)){h("Please fill in all required fields");return}try{const k=await w({connectOAuthParams:{provider:e,consumerRef:t,groupRef:r,projectId:l||"",consumerName:n,groupName:i,providerWorkspaceRef:v?.workspace?.value,providerMetadata:v,enableCSRFProtection:yT}});if(k){const L=window.screenX+(window.outerWidth-Ou)/2,M=window.screenY+(window.outerHeight-Eu)/2.5,F=`width=${Ou},height=${Eu},left=${L},top=${M}`;u.current=window.open(k,"OAuthPopup",F)}}catch(k){console.error(k),h(k instanceof Error?k.message:String(k)||"An error occurred. Please try again.")}},A=s.length>0?p.jsx(bT,{handleSubmit:_,setFormData:E,error:d,isButtonDisabled:!Ir(s,f)||m||b||!!d,providerName:o,metadataInputs:s}):p.jsx(vT,{handleSubmit:_,error:d,providerName:o,isButtonDisabled:m||b||!!d});return p.jsx("div",{children:A})}function xT({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,explicitScopesRequired:s,selectedConnection:a,metadataInputs:l,moduleError:c}){const{projectIdOrName:u}=Ke(),d=vi(),[h,f]=I.useState(c||null),y=I.useCallback(v=>{f(null);const g={projectIdOrName:u,generateConnectionParams:{groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:v.providerMetadata?.workspace?.value,oauth2ClientCredentials:{clientId:v.clientId,clientSecret:v.clientSecret,scopes:v.scopes},...v.providerMetadata&&{providerMetadata:v.providerMetadata}}};d.mutate(g,{onError:()=>f("Error loading provider info")})},[u,o,i,r,n,e,d]);return a===null?p.jsx(HE,{providerName:t,handleSubmit:y,error:h,explicitScopesRequired:s,metadataInputs:l}):p.jsx(ii,{})}function IT({...e}){return p.jsx(xT,{...e})}const ST="authorizationCode",CT="authorizationCodePKCE",OT="clientCredentials";function ET({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,selectedConnection:s,setSelectedConnection:a,metadataInputs:l,moduleError:c}){const{providerName:u}=yt(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===ST||d===CT?p.jsx(wT,{...f}):d===OT?p.jsx(IT,{...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 _T(e){const{selectedConnection:t}=fn();I.useEffect(()=>{e&&t&&e(t)},[e,t])}function NT({onSuccess:e}){_T(e)}function ih({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,onSuccess:s,onDisconnectSuccess:a,resetComponent:l}){const{data:c,isLoading:u,isError:d,error:h,providerName:f,selectedProvider:y}=yt(e),{provider:v,isIntegrationDeleted:g,integrationObj:w}=gt(),{selectedConnection:m,setSelectedConnection:b}=fn();NT({onSuccess:s});const C=Ze(),E=c,_=w?.latestRevision?.content?.module,{module:A,error:k}=ME(_,E),L=E?.metadata?.input||[],M=jE(L,A);I.useEffect(()=>{d&&(console.error("Error loading provider info."),Ye(h))},[d,h]);const F=I.useCallback(()=>{C.clear(),l()},[l,C]);if(!e&&!v)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(g)return p.jsx(pl,{text:"Integration successfully uninstalled.",children:p.jsx(Je,{type:"button",onClick:F,style:{width:"100%"},children:"Reinstall Integration"})});if(m)return o;if(u)return p.jsx(kr,{});if(E==null)return p.jsx(Tt,{message:"Provider info was not found."});const j={provider:y,consumerRef:t,consumerName:n,groupRef:r,groupName:i,selectedConnection:m,setSelectedConnection:b,providerName:f,providerInfo:E,onDisconnectSuccess:a,metadataInputs:M,moduleError:k};return E.authType==="none"?p.jsx(fT,{...j,children:o}):E.authType==="basic"?p.jsx(sT,{...j,children:o}):E.authType==="apiKey"?p.jsx(oT,{...j,children:o}):E.authType==="custom"?p.jsx(cT,{...j,children:o}):p.jsx(ET,{...j})}function TT(e){const t=e+"CollectionProvider",[n,r]=ko(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=v=>{const{scope:g,children:w}=v,m=I.useRef(null),b=I.useRef(new Map).current;return p.jsx(i,{scope:g,itemMap:b,collectionRef:m,children:w})};s.displayName=t;const a=e+"CollectionSlot",l=Xs(a),c=I.forwardRef((v,g)=>{const{scope:w,children:m}=v,b=o(a,w),C=Or(g,b.collectionRef);return p.jsx(l,{ref:C,children:m})});c.displayName=a;const u=e+"CollectionItemSlot",d="data-radix-collection-item",h=Xs(u),f=I.forwardRef((v,g)=>{const{scope:w,children:m,...b}=v,C=I.useRef(null),E=Or(g,C),_=o(u,w);return I.useEffect(()=>(_.itemMap.set(C,{ref:C,...b}),()=>{_.itemMap.delete(C)})),p.jsx(h,{[d]:"",ref:E,children:m})});f.displayName=u;function y(v){const g=o(e+"CollectionConsumer",v);return I.useCallback(()=>{const m=g.collectionRef.current;if(!m)return[];const b=Array.from(m.querySelectorAll(`[${d}]`));return Array.from(g.itemMap.values()).sort((_,A)=>b.indexOf(_.ref.current)-b.indexOf(A.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:s,Slot:c,ItemSlot:f},y,r]}var kT=H[" useId ".trim().toString()]||(()=>{}),RT=0;function oh(e){const[t,n]=H.useState(kT());return li(()=>{n(r=>r??String(RT++))},[e]),e||(t?`radix-${t}`:"")}function AT(e){const t=H.useRef(e);return H.useEffect(()=>{t.current=e}),H.useMemo(()=>(...n)=>t.current?.(...n),[])}var FT=H.createContext(void 0);function sh(e){const t=H.useContext(FT);return e||t||"ltr"}var ms="rovingFocusGroup.onEntryFocus",PT={bubbles:!1,cancelable:!0},bi="RovingFocusGroup",[Ys,ah,DT]=TT(bi),[MT,lh]=ko(bi,[DT]),[jT,LT]=MT(bi),ch=H.forwardRef((e,t)=>p.jsx(Ys.Provider,{scope:e.__scopeRovingFocusGroup,children:p.jsx(Ys.Slot,{scope:e.__scopeRovingFocusGroup,children:p.jsx(BT,{...e,ref:t})})}));ch.displayName=bi;var BT=H.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=H.useRef(null),f=Or(t,h),y=sh(o),[v,g]=sl({prop:s,defaultProp:a??null,onChange:l,caller:bi}),[w,m]=H.useState(!1),b=AT(c),C=ah(n),E=H.useRef(!1),[_,A]=H.useState(0);return H.useEffect(()=>{const k=h.current;if(k)return k.addEventListener(ms,b),()=>k.removeEventListener(ms,b)},[b]),p.jsx(jT,{scope:n,orientation:r,dir:y,loop:i,currentTabStopId:v,onItemFocus:H.useCallback(k=>g(k),[g]),onItemShiftTab:H.useCallback(()=>m(!0),[]),onFocusableItemAdd:H.useCallback(()=>A(k=>k+1),[]),onFocusableItemRemove:H.useCallback(()=>A(k=>k-1),[]),children:p.jsx(xn.div,{tabIndex:w||_===0?-1:0,"data-orientation":r,...d,ref:f,style:{outline:"none",...e.style},onMouseDown:Zt(e.onMouseDown,()=>{E.current=!0}),onFocus:Zt(e.onFocus,k=>{const L=!E.current;if(k.target===k.currentTarget&&L&&!w){const M=new CustomEvent(ms,PT);if(k.currentTarget.dispatchEvent(M),!M.defaultPrevented){const F=C().filter(Y=>Y.focusable),j=F.find(Y=>Y.active),G=F.find(Y=>Y.id===v),V=[j,G,...F].filter(Boolean).map(Y=>Y.ref.current);fh(V,u)}}E.current=!1}),onBlur:Zt(e.onBlur,()=>m(!1))})})}),uh="RovingFocusGroupItem",dh=H.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,children:s,...a}=e,l=oh(),c=o||l,u=LT(uh,n),d=u.currentTabStopId===c,h=ah(n),{onFocusableItemAdd:f,onFocusableItemRemove:y,currentTabStopId:v}=u;return H.useEffect(()=>{if(r)return f(),()=>y()},[r,f,y]),p.jsx(Ys.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:p.jsx(xn.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...a,ref:t,onMouseDown:Zt(e.onMouseDown,g=>{r?u.onItemFocus(c):g.preventDefault()}),onFocus:Zt(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:Zt(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){u.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const w=qT(g,u.orientation,u.dir);if(w!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let b=h().filter(C=>C.focusable).map(C=>C.ref.current);if(w==="last")b.reverse();else if(w==="prev"||w==="next"){w==="prev"&&b.reverse();const C=b.indexOf(g.currentTarget);b=u.loop?$T(b,C+1):b.slice(C+1)}setTimeout(()=>fh(b))}}),children:typeof s=="function"?s({isCurrentTabStop:d,hasTabStop:v!=null}):s})})});dh.displayName=uh;var VT={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function UT(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function qT(e,t,n){const r=UT(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return VT[r]}function fh(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function $T(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var zT=ch,KT=dh,Ao="Tabs",[HT]=ko(Ao,[lh]),ph=lh(),[JT,hl]=HT(Ao),hh=H.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:a,activationMode:l="automatic",...c}=e,u=sh(a),[d,h]=sl({prop:r,onChange:i,defaultProp:o??"",caller:Ao});return p.jsx(JT,{scope:n,baseId:oh(),value:d,onValueChange:h,orientation:s,dir:u,activationMode:l,children:p.jsx(xn.div,{dir:u,"data-orientation":s,...c,ref:t})})});hh.displayName=Ao;var mh="TabsList",gh=H.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,o=hl(mh,n),s=ph(n);return p.jsx(zT,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:r,children:p.jsx(xn.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:t})})});gh.displayName=mh;var yh="TabsTrigger",vh=H.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=e,s=hl(yh,n),a=ph(n),l=wh(s.baseId,r),c=xh(s.baseId,r),u=r===s.value;return p.jsx(KT,{asChild:!0,...a,focusable:!i,active:u,children:p.jsx(xn.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:Zt(e.onMouseDown,d=>{!i&&d.button===0&&d.ctrlKey===!1?s.onValueChange(r):d.preventDefault()}),onKeyDown:Zt(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&s.onValueChange(r)}),onFocus:Zt(e.onFocus,()=>{const d=s.activationMode!=="manual";!u&&!i&&d&&s.onValueChange(r)})})})});vh.displayName=yh;var bh="TabsContent",WT=H.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=e,a=hl(bh,n),l=wh(a.baseId,r),c=xh(a.baseId,r),u=r===a.value,d=H.useRef(u);return H.useEffect(()=>{const h=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(h)},[]),p.jsx(al,{present:i||u,children:({present:h})=>p.jsx(xn.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})})});WT.displayName=bh;function wh(e,t){return`${e}-trigger-${t}`}function xh(e,t){return`${e}-content-${t}`}var QT=hh,GT=gh,Ih=vh;const XT=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 YT(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?XT: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 ZT(){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 ek="_tabsRoot_ktpr0_1",tk="_tabsList_ktpr0_6",nk="_tabTrigger_ktpr0_12",po={tabsRoot:ek,tabsList:tk,tabTrigger:nk};function rk(){return p.jsxs(p.Fragment,{children:[p.jsx(_o,{style:{margin:"1rem 0"}}),p.jsx(Ih,{value:no,className:po.tabTrigger,children:p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[p.jsx(ZT,{}),p.jsx("span",{children:"Manage"})]})})]})}function Sh({objectName:e,completed:t,pending:n,displayName:r,disabled:i}){return p.jsx(Ih,{value:e,className:po.tabTrigger,children:p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[YT(!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 ik({completed:e,pending:t,displayName:n}){return p.jsxs(p.Fragment,{children:[p.jsx(_o,{style:{margin:"1rem 0"}}),p.jsx(Sh,{objectName:vr,completed:e,pending:t,displayName:n},"other-write")]})}function ok({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:i}){const{data:o}=fd(),{installation:s}=dn(),a=s?.config,l=a?.content?.write?.objects,c=r?.other?.write?.selectedWriteObjects;return p.jsx(QT,{value:e,className:po.tabsRoot,onValueChange:n,children:p.jsxs(GT,{className:po.tabsList,children:[t.map(u=>{const d=a?.content?.read?.objects?.[u.name],h=r?.[u.name],f=Kd(a,u.name),y=h?.read?.selectedFieldMappings,v=!Md(f,y),g=o?ma(a,o,u.name):void 0,w=h?.read?.selectedOptionalFields,m=!Dd(g,w),b=d?.selectedValueMappings,C=h?.read?.selectedValueMappings,E=!jd(b,C),_=m||v||E||!1;return p.jsx(Sh,{objectName:u.name,displayName:u.displayName,completed:u.completed,disabled:u.disabled,pending:_},u.name)}),i&&(()=>{const u=!Ld(l||{},c||{});return p.jsx(ik,{completed:i.completed,pending:u,displayName:"Write"})})(),p.jsx(rk,{})]})})}function sk(e,t){return t===no?{name:no,completed:!1}:e.find(n=>n.name===t)}function ak({children:e}){const{data:t}=Mn(),{installation:n}=gt(),{providerName:r}=yt(),{hydratedRevision:i}=or(),{objectConfigurationsState:o}=Va(),[s,a]=I.useState(""),l=t?.appName||"",c=n?.config,u=i&&Ad(c,i),d=u!==null,h=!!i?.content?.write,f=h?Fd(c):void 0,y=I.useMemo(()=>{const w=[...u||[]];return f&&h&&w.push(f),w},[u,f,h]),v=sk(y,s),g=I.useCallback(()=>{const w=y.find(m=>v!==m&&!m.completed);w&&a(w.name)},[y,v]);return I.useEffect(()=>{!s&&y.length>0&&a(y[0].name)},[y,s,g]),p.jsx(Zf.Provider,{value:g,children:p.jsx(Yf.Provider,{value:v?.name,children:p.jsxs(Tr,{style:{maxWidth:"55rem"},children:[p.jsxs(bn,{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(ok,{value:s,readNavObjects:u,onValueChange:w=>a(w),objectConfigurationsState:o,writeNavObject:f})]}),e]}),p.jsx(Xd,{})]})})})}function lk({...e}){return p.jsx(ak,{...e})}const ck="_resetContainer_lkwv9_4",Ch={resetContainer:ck},uk=({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:l})=>{const{projectIdOrName:c,isLoading:u}=Mn(),{isLoading:d}=vo(),{isError:h,errorState:f}=un(),{seed:y,reset:v}=Nd();return u||d?p.jsx(kr,{}):h(Ie.PROJECT,c)?p.jsx(Tt,{message:`Error loading project ${c}`}):h(Ie.INTEGRATION_LIST,c)?p.jsx(Tt,{message:"Error retrieving integrations for the project, double check the API key"}):f[Ie.INTEGRATION_LIST]?.apiError?p.jsx(Tt,{message:"Something went wrong, couldn't find integration information"}):p.jsx("div",{className:Ch.resetContainer,children:p.jsx(Lx,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:l,resetComponent:v,children:p.jsx(Sd,{children:p.jsx(ih,{consumerRef:t,consumerName:n,groupRef:r,groupName:i,resetComponent:v,children:p.jsx(i_,{resetComponent:v,children:p.jsx(iT,{children:p.jsx(a_,{children:p.jsx(lk,{children:p.jsx(eT,{})})})})})})})},y)})};function dk({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(fl,{fallback:p.jsx(Tt,{message:"Something went wrong, couldn't find integration information"}),children:p.jsx(da,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:p.jsx(uk,{...c})})})}function fk(){return p.jsxs(Tr,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[p.jsx(ii,{}),p.jsx("p",{children:"Redirecting"})]})}function pk({redirectURL:e,children:t}){return I.useEffect(()=>{e&&window.location.replace(e)},[e]),e?p.jsx(fk,{}):t}function hk({resetComponent:e,onDisconnectSuccess:t,provider:n}){const[r,i]=I.useState(!1);return p.jsxs(p.Fragment,{children:[r===!1&&p.jsxs(p.Fragment,{children:[p.jsx(Lt,{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(Je,{type:"button",onClick:()=>i(!0),variant:"ghost",style:{fontSize:"13px"},children:"Update connection"})]})]}),r===!0&&p.jsxs(p.Fragment,{children:[p.jsx(ja,{provider:n}),p.jsx(th,{resetComponent:e,onDisconnectSuccess:t})]})]})}function mk({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=Mn(),{providerName:i}=yt(e),o=`You have successfully connected your ${i} account to ${r}.`;return p.jsx(pl,{text:o,children:p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"},children:p.jsx(hk,{resetComponent:n,onDisconnectSuccess:t,provider:e})})})}function gk({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,redirectUrl:o,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:l}){const{seed:c,reset:u}=Nd(),d=I.useCallback(h=>{s?s(h.id):l&&l(h)},[s,l]);return p.jsx(fl,{fallback:p.jsx(Tt,{message:"Something went wrong with the connection. Please try again."}),children:p.jsx("div",{className:Ch.resetContainer,children:p.jsx(da,{integration:"connect-provider-dummy-string",consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:p.jsx(Sd,{groupRef:r,provider:e,children:p.jsx(ih,{resetComponent:u,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onSuccess:d,onDisconnectSuccess:a,children:p.jsx(pk,{redirectURL:o,children:p.jsx(mk,{resetComponent:u,provider:e,onDisconnectSuccess:a})})})})})},c)})}const yk=(e,t,n)=>{const{data:r,isLoading:i,isError:o,error:s}=la(e,t,n),a=(r?.length||0)>0,l=!!r&&!i,u=r?.[0]?.config;return I.useEffect(()=>{o&&Ye(s)},[o,s]),{isLoaded:l,isIntegrationInstalled:a,isLoading:i,config:u,isError:o,error:s}};exports.AmpersandContext=oa;exports.AmpersandErrorBoundary=fl;exports.AmpersandProvider=Yw;exports.ConnectProvider=gk;exports.FieldSettingWriteOnCreateEnum=Qm;exports.FieldSettingWriteOnUpdateEnum=Gm;exports.InstallIntegration=dk;exports.InstallationProvider=da;exports.useAmpersandProviderProps=Ke;exports.useConfig=gx;exports.useConnection=ca;exports.useCreateInstallation=Od;exports.useDeleteInstallation=qx;exports.useInstallation=dn;exports.useIsIntegrationInstalled=yk;exports.useLocalConfig=mx;exports.useManifest=bo;exports.useUpdateInstallation=_d;
|
|
22
22
|
//# sourceMappingURL=amp-react.cjs.js.map
|