@amp-labs/react 2.8.4 → 2.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,32 +1,32 @@
1
- "use strict";var $a=e=>{throw TypeError(e)};var Ko=(e,t,n)=>t.has(e)||$a("Cannot "+n);var _=(e,t,n)=>(Ko(e,t,"read from private field"),n?n.call(e):t.get(e)),se=(e,t,n)=>t.has(e)?$a("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),G=(e,t,n,r)=>(Ko(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),pe=(e,t,n)=>(Ko(e,t,"access private method"),n);var Ui=(e,t,n,r)=>({set _(o){G(e,t,o,n)},get _(){return _(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),b=require("react");require("react-dom");function zf(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 k=zf(b);var Qr=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(){}},pr=typeof window>"u"||"Deno"in globalThis;function ft(){}function Qf(e,t){return typeof e=="function"?e(t):e}function ss(e){return typeof e=="number"&&e>=0&&e!==1/0}function dl(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Vn(e,t){return typeof e=="function"?e(t):e}function Jt(e,t){return typeof e=="function"?e(t):e}function Ha(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==Ks(s,t.options))return!1}else if(!di(t.queryKey,s))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||o&&o!==t.state.fetchStatus||i&&!i(t))}function Ba(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(hr(t.options.mutationKey)!==hr(i))return!1}else if(!di(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function Ks(e,t){return((t==null?void 0:t.queryKeyHashFn)||hr)(e)}function hr(e){return JSON.stringify(e,(t,n)=>cs(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function di(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>di(e[n],t[n])):!1}function as(e,t){if(e===t)return e;const n=Ja(e)&&Ja(t);if(n||cs(e)&&cs(t)){const r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),s=i.length,a=n?[]:{},c=new Set(r);let d=0;for(let u=0;u<s;u++){const f=n?u:i[u];(!n&&c.has(f)||n)&&e[f]===void 0&&t[f]===void 0?(a[f]=void 0,d++):(a[f]=as(e[f],t[f]),a[f]===e[f]&&e[f]!==void 0&&d++)}return o===s&&d===o?e:a}return t}function ro(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 Ja(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function cs(e){if(!Wa(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Wa(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Wa(e){return Object.prototype.toString.call(e)==="[object Object]"}function Gf(e){return new Promise(t=>{setTimeout(t,e)})}function ls(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 as(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 as(e,t)}return t}function Xf(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Yf(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var io=Symbol();function fl(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===io&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===io?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function pl(e,t){return typeof e=="function"?e(...t):!!e}var ir,Fn,Or,tl,Zf=(tl=class extends Qr{constructor(){super();se(this,ir);se(this,Fn);se(this,Or);G(this,Or,t=>{if(!pr&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){_(this,Fn)||this.setEventListener(_(this,Or))}onUnsubscribe(){var t;this.hasListeners()||((t=_(this,Fn))==null||t.call(this),G(this,Fn,void 0))}setEventListener(t){var n;G(this,Or,t),(n=_(this,Fn))==null||n.call(this),G(this,Fn,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){_(this,ir)!==t&&(G(this,ir,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof _(this,ir)=="boolean"?_(this,ir):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},ir=new WeakMap,Fn=new WeakMap,Or=new WeakMap,tl),Us=new Zf,_r,Pn,Sr,nl,ep=(nl=class extends Qr{constructor(){super();se(this,_r,!0);se(this,Pn);se(this,Sr);G(this,Sr,t=>{if(!pr&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){_(this,Pn)||this.setEventListener(_(this,Sr))}onUnsubscribe(){var t;this.hasListeners()||((t=_(this,Pn))==null||t.call(this),G(this,Pn,void 0))}setEventListener(t){var n;G(this,Sr,t),(n=_(this,Pn))==null||n.call(this),G(this,Pn,t(this.setOnline.bind(this)))}setOnline(t){_(this,_r)!==t&&(G(this,_r,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return _(this,_r)}},_r=new WeakMap,Pn=new WeakMap,Sr=new WeakMap,nl),oo=new ep;function us(){let e,t;const n=new Promise((o,i)=>{e=o,t=i});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}function tp(e){return Math.min(1e3*2**e,3e4)}function hl(e){return(e??"online")==="online"?oo.isOnline():!0}var ml=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Uo(e){return e instanceof ml}function gl(e){let t=!1,n=0,r=!1,o;const i=us(),s=y=>{var p;r||(m(new ml(y)),(p=e.abort)==null||p.call(e))},a=()=>{t=!0},c=()=>{t=!1},d=()=>Us.isFocused()&&(e.networkMode==="always"||oo.isOnline())&&e.canRun(),u=()=>hl(e.networkMode)&&e.canRun(),f=y=>{var p;r||(r=!0,(p=e.onSuccess)==null||p.call(e,y),o==null||o(),i.resolve(y))},m=y=>{var p;r||(r=!0,(p=e.onError)==null||p.call(e,y),o==null||o(),i.reject(y))},g=()=>new Promise(y=>{var p;o=x=>{(r||d())&&y(x)},(p=e.onPause)==null||p.call(e)}).then(()=>{var y;o=void 0,r||(y=e.onContinue)==null||y.call(e)}),v=()=>{if(r)return;let y;const p=n===0?e.initialPromise:void 0;try{y=p??e.fn()}catch(x){y=Promise.reject(x)}Promise.resolve(y).then(f).catch(x=>{var S;if(r)return;const h=e.retry??(pr?0:3),w=e.retryDelay??tp,I=typeof w=="function"?w(n,x):w,O=h===!0||typeof h=="number"&&n<h||typeof h=="function"&&h(n,x);if(t||!O){m(x);return}n++,(S=e.onFail)==null||S.call(e,n,x),Gf(I).then(()=>d()?void 0:g()).then(()=>{t?m(x):v()})})};return{promise:i,cancel:s,continue:()=>(o==null||o(),i),cancelRetry:a,continueRetry:c,canStart:u,start:()=>(u()?v():g().then(v),i)}}var np=e=>setTimeout(e,0);function rp(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=np;const i=a=>{t?e.push(a):o(()=>{n(a)})},s=()=>{const a=e;e=[],a.length&&o(()=>{r(()=>{a.forEach(c=>{n(c)})})})};return{batch:a=>{let c;t++;try{c=a()}finally{t--,t||s()}return c},batchCalls:a=>(...c)=>{i(()=>{a(...c)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{o=a}}}var Qe=rp(),or,rl,yl=(rl=class{constructor(){se(this,or)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ss(this.gcTime)&&G(this,or,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(pr?1/0:5*60*1e3))}clearGcTimeout(){_(this,or)&&(clearTimeout(_(this,or)),G(this,or,void 0))}},or=new WeakMap,rl),Er,Nr,Ft,sr,ct,vi,ar,Ht,mn,il,ip=(il=class extends yl{constructor(t){super();se(this,Ht);se(this,Er);se(this,Nr);se(this,Ft);se(this,sr);se(this,ct);se(this,vi);se(this,ar);G(this,ar,!1),G(this,vi,t.defaultOptions),this.setOptions(t.options),this.observers=[],G(this,sr,t.client),G(this,Ft,_(this,sr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,G(this,Er,op(this.options)),this.state=t.state??_(this,Er),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=_(this,ct))==null?void 0:t.promise}setOptions(t){this.options={..._(this,vi),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&_(this,Ft).remove(this)}setData(t,n){const r=ls(this.state.data,t,this.options);return pe(this,Ht,mn).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){pe(this,Ht,mn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=_(this,ct))==null?void 0:r.promise;return(o=_(this,ct))==null||o.cancel(t),n?n.then(ft).catch(ft):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(_(this,Er))}isActive(){return this.observers.some(t=>Jt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===io||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Vn(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!dl(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=_(this,ct))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=_(this,ct))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),_(this,Ft).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(_(this,ct)&&(_(this,ar)?_(this,ct).cancel({revert:!0}):_(this,ct).cancelRetry()),this.scheduleGc()),_(this,Ft).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||pe(this,Ht,mn).call(this,{type:"invalidate"})}fetch(t,n){var d,u,f;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(_(this,ct))return _(this,ct).continueRetry(),_(this,ct).promise}if(t&&this.setOptions(t),!this.options.queryFn){const m=this.observers.find(g=>g.options.queryFn);m&&this.setOptions(m.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,o=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(G(this,ar,!0),r.signal)})},i=()=>{const m=fl(this.options,n),v=(()=>{const y={client:_(this,sr),queryKey:this.queryKey,meta:this.meta};return o(y),y})();return G(this,ar,!1),this.options.persister?this.options.persister(m,v,this):m(v)},a=(()=>{const m={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:_(this,sr),state:this.state,fetchFn:i};return o(m),m})();(d=this.options.behavior)==null||d.onFetch(a,this),G(this,Nr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&pe(this,Ht,mn).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta});const c=m=>{var g,v,y,p;Uo(m)&&m.silent||pe(this,Ht,mn).call(this,{type:"error",error:m}),Uo(m)||((v=(g=_(this,Ft).config).onError)==null||v.call(g,m,this),(p=(y=_(this,Ft).config).onSettled)==null||p.call(y,this.state.data,m,this)),this.scheduleGc()};return G(this,ct,gl({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:m=>{var g,v,y,p;if(m===void 0){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}`),c(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(m)}catch(x){c(x);return}(v=(g=_(this,Ft).config).onSuccess)==null||v.call(g,m,this),(p=(y=_(this,Ft).config).onSettled)==null||p.call(y,m,this.state.error,this),this.scheduleGc()},onError:c,onFail:(m,g)=>{pe(this,Ht,mn).call(this,{type:"failed",failureCount:m,error:g})},onPause:()=>{pe(this,Ht,mn).call(this,{type:"pause"})},onContinue:()=>{pe(this,Ht,mn).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0})),_(this,ct).start()}},Er=new WeakMap,Nr=new WeakMap,Ft=new WeakMap,sr=new WeakMap,ct=new WeakMap,vi=new WeakMap,ar=new WeakMap,Ht=new WeakSet,mn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...vl(r.data,this.options),fetchMeta:t.meta??null};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const o=t.error;return Uo(o)&&o.revert&&_(this,Nr)?{..._(this,Nr),fetchStatus:"idle"}:{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Qe.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),_(this,Ft).notify({query:this,type:"updated",action:t})})},il);function vl(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:hl(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function op(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 tn,ol,sp=(ol=class extends Qr{constructor(t={}){super();se(this,tn);this.config=t,G(this,tn,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??Ks(o,n);let s=this.get(i);return s||(s=new ip({client:t,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){_(this,tn).has(t.queryHash)||(_(this,tn).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=_(this,tn).get(t.queryHash);n&&(t.destroy(),n===t&&_(this,tn).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Qe.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return _(this,tn).get(t)}getAll(){return[..._(this,tn).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Ha(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Ha(t,r)):n}notify(t){Qe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Qe.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Qe.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},tn=new WeakMap,ol),nn,ut,cr,rn,An,sl,ap=(sl=class extends yl{constructor(t){super();se(this,rn);se(this,nn);se(this,ut);se(this,cr);this.mutationId=t.mutationId,G(this,ut,t.mutationCache),G(this,nn,[]),this.state=t.state||wl(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){_(this,nn).includes(t)||(_(this,nn).push(t),this.clearGcTimeout(),_(this,ut).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){G(this,nn,_(this,nn).filter(n=>n!==t)),this.scheduleGc(),_(this,ut).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){_(this,nn).length||(this.state.status==="pending"?this.scheduleGc():_(this,ut).remove(this))}continue(){var t;return((t=_(this,cr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,s,a,c,d,u,f,m,g,v,y,p,x,h,w,I,O,S,T,R;const n=()=>{pe(this,rn,An).call(this,{type:"continue"})};G(this,cr,gl({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(A,D)=>{pe(this,rn,An).call(this,{type:"failed",failureCount:A,error:D})},onPause:()=>{pe(this,rn,An).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>_(this,ut).canRun(this)}));const r=this.state.status==="pending",o=!_(this,cr).canStart();try{if(r)n();else{pe(this,rn,An).call(this,{type:"pending",variables:t,isPaused:o}),await((s=(i=_(this,ut).config).onMutate)==null?void 0:s.call(i,t,this));const D=await((c=(a=this.options).onMutate)==null?void 0:c.call(a,t));D!==this.state.context&&pe(this,rn,An).call(this,{type:"pending",context:D,variables:t,isPaused:o})}const A=await _(this,cr).start();return await((u=(d=_(this,ut).config).onSuccess)==null?void 0:u.call(d,A,t,this.state.context,this)),await((m=(f=this.options).onSuccess)==null?void 0:m.call(f,A,t,this.state.context)),await((v=(g=_(this,ut).config).onSettled)==null?void 0:v.call(g,A,null,this.state.variables,this.state.context,this)),await((p=(y=this.options).onSettled)==null?void 0:p.call(y,A,null,t,this.state.context)),pe(this,rn,An).call(this,{type:"success",data:A}),A}catch(A){try{throw await((h=(x=_(this,ut).config).onError)==null?void 0:h.call(x,A,t,this.state.context,this)),await((I=(w=this.options).onError)==null?void 0:I.call(w,A,t,this.state.context)),await((S=(O=_(this,ut).config).onSettled)==null?void 0:S.call(O,void 0,A,this.state.variables,this.state.context,this)),await((R=(T=this.options).onSettled)==null?void 0:R.call(T,void 0,A,t,this.state.context)),A}finally{pe(this,rn,An).call(this,{type:"error",error:A})}}finally{_(this,ut).runNext(this)}}},nn=new WeakMap,ut=new WeakMap,cr=new WeakMap,rn=new WeakSet,An=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Qe.batch(()=>{_(this,nn).forEach(r=>{r.onMutationUpdate(t)}),_(this,ut).notify({mutation:this,type:"updated",action:t})})},sl);function wl(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var gn,Bt,wi,al,cp=(al=class extends Qr{constructor(t={}){super();se(this,gn);se(this,Bt);se(this,wi);this.config=t,G(this,gn,new Set),G(this,Bt,new Map),G(this,wi,0)}build(t,n,r){const o=new ap({mutationCache:this,mutationId:++Ui(this,wi)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){_(this,gn).add(t);const n=Vi(t);if(typeof n=="string"){const r=_(this,Bt).get(n);r?r.push(t):_(this,Bt).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(_(this,gn).delete(t)){const n=Vi(t);if(typeof n=="string"){const r=_(this,Bt).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&_(this,Bt).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Vi(t);if(typeof n=="string"){const r=_(this,Bt).get(n),o=r==null?void 0:r.find(i=>i.state.status==="pending");return!o||o===t}else return!0}runNext(t){var r;const n=Vi(t);if(typeof n=="string"){const o=(r=_(this,Bt).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Qe.batch(()=>{_(this,gn).forEach(t=>{this.notify({type:"removed",mutation:t})}),_(this,gn).clear(),_(this,Bt).clear()})}getAll(){return Array.from(_(this,gn))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Ba(n,r))}findAll(t={}){return this.getAll().filter(n=>Ba(t,n))}notify(t){Qe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Qe.batch(()=>Promise.all(t.map(n=>n.continue().catch(ft))))}},gn=new WeakMap,Bt=new WeakMap,wi=new WeakMap,al);function Vi(e){var t;return(t=e.options.scope)==null?void 0:t.id}function za(e){return{onFetch:(t,n)=>{var u,f,m,g,v;const r=t.options,o=(m=(f=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:f.fetchMore)==null?void 0:m.direction,i=((g=t.state.data)==null?void 0:g.pages)||[],s=((v=t.state.data)==null?void 0:v.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const d=async()=>{let y=!1;const p=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(t.signal.aborted?y=!0:t.signal.addEventListener("abort",()=>{y=!0}),t.signal)})},x=fl(t.options,t.fetchOptions),h=async(w,I,O)=>{if(y)return Promise.reject();if(I==null&&w.pages.length)return Promise.resolve(w);const T=(()=>{const B={client:t.client,queryKey:t.queryKey,pageParam:I,direction:O?"backward":"forward",meta:t.options.meta};return p(B),B})(),R=await x(T),{maxPages:A}=t.options,D=O?Yf:Xf;return{pages:D(w.pages,R,A),pageParams:D(w.pageParams,I,A)}};if(o&&i.length){const w=o==="backward",I=w?lp:Qa,O={pages:i,pageParams:s},S=I(r,O);a=await h(O,S,w)}else{const w=e??i.length;do{const I=c===0?s[0]??r.initialPageParam:Qa(r,a);if(c>0&&I==null)break;a=await h(a,I),c++}while(c<w)}return a};t.options.persister?t.fetchFn=()=>{var y,p;return(p=(y=t.options).persister)==null?void 0:p.call(y,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=d}}}function Qa(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 lp(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var je,Dn,Mn,Tr,Rr,kn,Ar,Fr,cl,up=(cl=class{constructor(e={}){se(this,je);se(this,Dn);se(this,Mn);se(this,Tr);se(this,Rr);se(this,kn);se(this,Ar);se(this,Fr);G(this,je,e.queryCache||new sp),G(this,Dn,e.mutationCache||new cp),G(this,Mn,e.defaultOptions||{}),G(this,Tr,new Map),G(this,Rr,new Map),G(this,kn,0)}mount(){Ui(this,kn)._++,_(this,kn)===1&&(G(this,Ar,Us.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,je).onFocus())})),G(this,Fr,oo.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,je).onOnline())})))}unmount(){var e,t;Ui(this,kn)._--,_(this,kn)===0&&((e=_(this,Ar))==null||e.call(this),G(this,Ar,void 0),(t=_(this,Fr))==null||t.call(this),G(this,Fr,void 0))}isFetching(e){return _(this,je).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return _(this,Dn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=_(this,je).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=_(this,je).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Vn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return _(this,je).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,je).get(r.queryHash),i=o==null?void 0:o.state.data,s=Qf(t,i);if(s!==void 0)return _(this,je).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return Qe.batch(()=>_(this,je).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=_(this,je).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=_(this,je);Qe.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=_(this,je);return Qe.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Qe.batch(()=>_(this,je).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(ft).catch(ft)}invalidateQueries(e,t={}){return Qe.batch(()=>(_(this,je).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Qe.batch(()=>_(this,je).findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(ft)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(ft)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=_(this,je).build(this,t);return n.isStaleByTime(Vn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ft).catch(ft)}fetchInfiniteQuery(e){return e.behavior=za(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ft).catch(ft)}ensureInfiniteQueryData(e){return e.behavior=za(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return oo.isOnline()?_(this,Dn).resumePausedMutations():Promise.resolve()}getQueryCache(){return _(this,je)}getMutationCache(){return _(this,Dn)}getDefaultOptions(){return _(this,Mn)}setDefaultOptions(e){G(this,Mn,e)}setQueryDefaults(e,t){_(this,Tr).set(hr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[..._(this,Tr).values()],n={};return t.forEach(r=>{di(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){_(this,Rr).set(hr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[..._(this,Rr).values()],n={};return t.forEach(r=>{di(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={..._(this,Mn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ks(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===io&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{..._(this,Mn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){_(this,je).clear(),_(this,Dn).clear()}},je=new WeakMap,Dn=new WeakMap,Mn=new WeakMap,Tr=new WeakMap,Rr=new WeakMap,kn=new WeakMap,Ar=new WeakMap,Fr=new WeakMap,cl),yt,ve,bi,dt,lr,Pr,jn,Ln,Ii,Dr,Mr,ur,dr,qn,kr,Se,si,ds,fs,ps,hs,ms,gs,ys,bl,ll,dp=(ll=class extends Qr{constructor(t,n){super();se(this,Se);se(this,yt);se(this,ve);se(this,bi);se(this,dt);se(this,lr);se(this,Pr);se(this,jn);se(this,Ln);se(this,Ii);se(this,Dr);se(this,Mr);se(this,ur);se(this,dr);se(this,qn);se(this,kr,new Set);this.options=n,G(this,yt,t),G(this,Ln,null),G(this,jn,us()),this.options.experimental_prefetchInRender||_(this,jn).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(_(this,ve).addObserver(this),Ga(_(this,ve),this.options)?pe(this,Se,si).call(this):this.updateResult(),pe(this,Se,hs).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return vs(_(this,ve),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return vs(_(this,ve),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,pe(this,Se,ms).call(this),pe(this,Se,gs).call(this),_(this,ve).removeObserver(this)}setOptions(t){const n=this.options,r=_(this,ve);if(this.options=_(this,yt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Jt(this.options.enabled,_(this,ve))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");pe(this,Se,ys).call(this),_(this,ve).setOptions(this.options),n._defaulted&&!ro(this.options,n)&&_(this,yt).getQueryCache().notify({type:"observerOptionsUpdated",query:_(this,ve),observer:this});const o=this.hasListeners();o&&Xa(_(this,ve),r,this.options,n)&&pe(this,Se,si).call(this),this.updateResult(),o&&(_(this,ve)!==r||Jt(this.options.enabled,_(this,ve))!==Jt(n.enabled,_(this,ve))||Vn(this.options.staleTime,_(this,ve))!==Vn(n.staleTime,_(this,ve)))&&pe(this,Se,ds).call(this);const i=pe(this,Se,fs).call(this);o&&(_(this,ve)!==r||Jt(this.options.enabled,_(this,ve))!==Jt(n.enabled,_(this,ve))||i!==_(this,qn))&&pe(this,Se,ps).call(this,i)}getOptimisticResult(t){const n=_(this,yt).getQueryCache().build(_(this,yt),t),r=this.createResult(n,t);return pp(this,r)&&(G(this,dt,r),G(this,Pr,this.options),G(this,lr,_(this,ve).state)),r}getCurrentResult(){return _(this,dt)}trackResult(t,n){return new Proxy(t,{get:(r,o)=>(this.trackProp(o),n==null||n(o),Reflect.get(r,o))})}trackProp(t){_(this,kr).add(t)}getCurrentQuery(){return _(this,ve)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=_(this,yt).defaultQueryOptions(t),r=_(this,yt).getQueryCache().build(_(this,yt),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return pe(this,Se,si).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),_(this,dt)))}createResult(t,n){var A;const r=_(this,ve),o=this.options,i=_(this,dt),s=_(this,lr),a=_(this,Pr),d=t!==r?t.state:_(this,bi),{state:u}=t;let f={...u},m=!1,g;if(n._optimisticResults){const D=this.hasListeners(),B=!D&&Ga(t,n),$=D&&Xa(t,r,n,o);(B||$)&&(f={...f,...vl(u.data,t.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:v,errorUpdatedAt:y,status:p}=f;g=f.data;let x=!1;if(n.placeholderData!==void 0&&g===void 0&&p==="pending"){let D;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(D=i.data,x=!0):D=typeof n.placeholderData=="function"?n.placeholderData((A=_(this,Mr))==null?void 0:A.state.data,_(this,Mr)):n.placeholderData,D!==void 0&&(p="success",g=ls(i==null?void 0:i.data,D,n),m=!0)}if(n.select&&g!==void 0&&!x)if(i&&g===(s==null?void 0:s.data)&&n.select===_(this,Ii))g=_(this,Dr);else try{G(this,Ii,n.select),g=n.select(g),g=ls(i==null?void 0:i.data,g,n),G(this,Dr,g),G(this,Ln,null)}catch(D){G(this,Ln,D)}_(this,Ln)&&(v=_(this,Ln),g=_(this,Dr),y=Date.now(),p="error");const h=f.fetchStatus==="fetching",w=p==="pending",I=p==="error",O=w&&h,S=g!==void 0,R={status:p,fetchStatus:f.fetchStatus,isPending:w,isSuccess:p==="success",isError:I,isInitialLoading:O,isLoading:O,data:g,dataUpdatedAt:f.dataUpdatedAt,error:v,errorUpdatedAt:y,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>d.dataUpdateCount||f.errorUpdateCount>d.errorUpdateCount,isFetching:h,isRefetching:h&&!w,isLoadingError:I&&!S,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:I&&S,isStale:Vs(t,n),refetch:this.refetch,promise:_(this,jn)};if(this.options.experimental_prefetchInRender){const D=L=>{R.status==="error"?L.reject(R.error):R.data!==void 0&&L.resolve(R.data)},B=()=>{const L=G(this,jn,R.promise=us());D(L)},$=_(this,jn);switch($.status){case"pending":t.queryHash===r.queryHash&&D($);break;case"fulfilled":(R.status==="error"||R.data!==$.value)&&B();break;case"rejected":(R.status!=="error"||R.error!==$.reason)&&B();break}}return R}updateResult(){const t=_(this,dt),n=this.createResult(_(this,ve),this.options);if(G(this,lr,_(this,ve).state),G(this,Pr,this.options),_(this,lr).data!==void 0&&G(this,Mr,_(this,ve)),ro(n,t))return;G(this,dt,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:o}=this.options,i=typeof o=="function"?o():o;if(i==="all"||!i&&!_(this,kr).size)return!0;const s=new Set(i??_(this,kr));return this.options.throwOnError&&s.add("error"),Object.keys(_(this,dt)).some(a=>{const c=a;return _(this,dt)[c]!==t[c]&&s.has(c)})};pe(this,Se,bl).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&pe(this,Se,hs).call(this)}},yt=new WeakMap,ve=new WeakMap,bi=new WeakMap,dt=new WeakMap,lr=new WeakMap,Pr=new WeakMap,jn=new WeakMap,Ln=new WeakMap,Ii=new WeakMap,Dr=new WeakMap,Mr=new WeakMap,ur=new WeakMap,dr=new WeakMap,qn=new WeakMap,kr=new WeakMap,Se=new WeakSet,si=function(t){pe(this,Se,ys).call(this);let n=_(this,ve).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(ft)),n},ds=function(){pe(this,Se,ms).call(this);const t=Vn(this.options.staleTime,_(this,ve));if(pr||_(this,dt).isStale||!ss(t))return;const r=dl(_(this,dt).dataUpdatedAt,t)+1;G(this,ur,setTimeout(()=>{_(this,dt).isStale||this.updateResult()},r))},fs=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(_(this,ve)):this.options.refetchInterval)??!1},ps=function(t){pe(this,Se,gs).call(this),G(this,qn,t),!(pr||Jt(this.options.enabled,_(this,ve))===!1||!ss(_(this,qn))||_(this,qn)===0)&&G(this,dr,setInterval(()=>{(this.options.refetchIntervalInBackground||Us.isFocused())&&pe(this,Se,si).call(this)},_(this,qn)))},hs=function(){pe(this,Se,ds).call(this),pe(this,Se,ps).call(this,pe(this,Se,fs).call(this))},ms=function(){_(this,ur)&&(clearTimeout(_(this,ur)),G(this,ur,void 0))},gs=function(){_(this,dr)&&(clearInterval(_(this,dr)),G(this,dr,void 0))},ys=function(){const t=_(this,yt).getQueryCache().build(_(this,yt),this.options);if(t===_(this,ve))return;const n=_(this,ve);G(this,ve,t),G(this,bi,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},bl=function(t){Qe.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(_(this,dt))}),_(this,yt).getQueryCache().notify({query:_(this,ve),type:"observerResultsUpdated"})})},ll);function fp(e,t){return Jt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Ga(e,t){return fp(e,t)||e.state.data!==void 0&&vs(e,t,t.refetchOnMount)}function vs(e,t,n){if(Jt(t.enabled,e)!==!1&&Vn(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Vs(e,t)}return!1}function Xa(e,t,n,r){return(e!==t||Jt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Vs(e,n)}function Vs(e,t){return Jt(t.enabled,e)!==!1&&e.isStaleByTime(Vn(t.staleTime,e))}function pp(e,t){return!ro(e.getCurrentResult(),t)}var Kn,Un,vt,yn,wn,Yi,ws,ul,hp=(ul=class extends Qr{constructor(n,r){super();se(this,wn);se(this,Kn);se(this,Un);se(this,vt);se(this,yn);G(this,Kn,n),this.setOptions(r),this.bindMethods(),pe(this,wn,Yi).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var o;const r=this.options;this.options=_(this,Kn).defaultMutationOptions(n),ro(this.options,r)||_(this,Kn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:_(this,vt),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&hr(r.mutationKey)!==hr(this.options.mutationKey)?this.reset():((o=_(this,vt))==null?void 0:o.state.status)==="pending"&&_(this,vt).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=_(this,vt))==null||n.removeObserver(this)}onMutationUpdate(n){pe(this,wn,Yi).call(this),pe(this,wn,ws).call(this,n)}getCurrentResult(){return _(this,Un)}reset(){var n;(n=_(this,vt))==null||n.removeObserver(this),G(this,vt,void 0),pe(this,wn,Yi).call(this),pe(this,wn,ws).call(this)}mutate(n,r){var o;return G(this,yn,r),(o=_(this,vt))==null||o.removeObserver(this),G(this,vt,_(this,Kn).getMutationCache().build(_(this,Kn),this.options)),_(this,vt).addObserver(this),_(this,vt).execute(n)}},Kn=new WeakMap,Un=new WeakMap,vt=new WeakMap,yn=new WeakMap,wn=new WeakSet,Yi=function(){var r;const n=((r=_(this,vt))==null?void 0:r.state)??wl();G(this,Un,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},ws=function(n){Qe.batch(()=>{var r,o,i,s,a,c,d,u;if(_(this,yn)&&this.hasListeners()){const f=_(this,Un).variables,m=_(this,Un).context;(n==null?void 0:n.type)==="success"?((o=(r=_(this,yn)).onSuccess)==null||o.call(r,n.data,f,m),(s=(i=_(this,yn)).onSettled)==null||s.call(i,n.data,null,f,m)):(n==null?void 0:n.type)==="error"&&((c=(a=_(this,yn)).onError)==null||c.call(a,n.error,f,m),(u=(d=_(this,yn)).onSettled)==null||u.call(d,void 0,n.error,f,m))}this.listeners.forEach(f=>{f(_(this,Un))})})},ul),Il=k.createContext(void 0),qe=e=>{const t=k.useContext(Il);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},mp=({client:e,children:t})=>(k.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(Il.Provider,{value:e,children:t})),Cl=k.createContext(!1),gp=()=>k.useContext(Cl);Cl.Provider;function yp(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var vp=k.createContext(yp()),wp=()=>k.useContext(vp),bp=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Ip=e=>{k.useEffect(()=>{e.clearReset()},[e])},Cp=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||pl(n,[e.error,r])),xp=e=>{if(e.suspense){const t=r=>r==="static"?r:Math.max(r??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...r)=>t(n(...r)):t(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Op=(e,t)=>e.isLoading&&e.isFetching&&!t,_p=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Ya=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Sp(e,t,n){var f,m,g,v,y;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=gp(),o=wp(),i=qe(),s=i.defaultQueryOptions(e);(m=(f=i.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||m.call(f,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",xp(s),bp(s,o),Ip(o);const a=!i.getQueryCache().get(s.queryHash),[c]=k.useState(()=>new t(i,s)),d=c.getOptimisticResult(s),u=!r&&e.subscribed!==!1;if(k.useSyncExternalStore(k.useCallback(p=>{const x=u?c.subscribe(Qe.batchCalls(p)):ft;return c.updateResult(),x},[c,u]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),k.useEffect(()=>{c.setOptions(s)},[s,c]),_p(s,d))throw Ya(s,c,o);if(Cp({result:d,errorResetBoundary:o,throwOnError:s.throwOnError,query:i.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw d.error;if((v=(g=i.getDefaultOptions().queries)==null?void 0:g._experimental_afterQuery)==null||v.call(g,s,d),s.experimental_prefetchInRender&&!pr&&Op(d,r)){const p=a?Ya(s,c,o):(y=i.getQueryCache().get(s.queryHash))==null?void 0:y.promise;p==null||p.catch(ft).finally(()=>{c.updateResult()})}return s.notifyOnChangeProps?d:c.trackResult(d)}function Wn(e,t){return Sp(e,dp)}function In(e,t){const n=qe(),[r]=k.useState(()=>new hp(n,e));k.useEffect(()=>{r.setOptions(e)},[r,e]);const o=k.useSyncExternalStore(k.useCallback(s=>r.subscribe(Qe.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=k.useCallback((s,a)=>{r.mutate(s,a).catch(ft)},[r]);if(o.error&&pl(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:i,mutateAsync:o.mutate}}const xl=b.createContext(null),Ep=xl.Provider,Ol=()=>{const e=b.useContext(xl);if(e===null)throw new Error("useApiKey must be used within an ApiKeyProvider");return e};var ue=(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))(ue||{});const _l=b.createContext(void 0);function Mt(){const e=b.useContext(_l);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const Np=(()=>{const e={};return Object.values(ue).forEach(t=>{e[t]={}}),e})();function Tp({children:e}){const[t,n]=b.useState(Np),r=b.useCallback((u,f,m=!0)=>{n(g=>{const v={...g};return v[u]=v[u]||{},v[u][f]=m,v})},[n]),o=b.useCallback((u,f)=>{var m;return!!((m=t[u])!=null&&m[f])},[t]),i=b.useCallback((u,f)=>{var m;return(m=t[u])==null?void 0:m[f]},[t]),s=b.useCallback((u,f)=>{n(m=>{var v;const g={...m};return(v=g[u])==null||delete v[f],g})},[n]),a=b.useCallback(u=>{n(f=>{const m={...f};return m[u]={},m})},[n]),c=b.useCallback((u,f)=>{n(m=>{const g={...m};return g[u]=g[u]||{},f.forEach(v=>{g[u][v]=!0}),g})},[n]),d=b.useMemo(()=>({errorState:t,setErrorState:n,setError:r,isError:o,removeError:s,resetBoundary:a,setErrors:c,getError:i}),[t,n,r,o,s,a,c,i]);return l.jsx(_l.Provider,{value:d,children:e})}const Rp="https://api.withampersand.com/v1".replace(/\/+$/,"");class $s{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Rp}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||El}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 Ap=new $s,bo=class bo{constructor(t=Ap){this.configuration=t,this.fetchApi=async(n,r)=>{let o={url:n,init:r};for(const s of this.middleware)s.pre&&(o=await s.pre({fetch:this.fetchApi,...o})||o);let i;try{i=await(this.configuration.fetchApi||fetch)(o.url,o.init)}catch(s){for(const a of this.middleware)a.onError&&(i=await a.onError({fetch:this.fetchApi,url:o.url,init:o.init,error:s,response:i?i.clone():void 0})||i);if(i===void 0)throw s instanceof Error?new Dp(s,"The request failed and the interceptors did not return an alternative response"):s}for(const s of this.middleware)s.post&&(i=await s.post({fetch:this.fetchApi,url:o.url,init:o.init,response:i.clone()})||i);return i},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?bo.jsonRegex.test(t):!1}async request(t,n){const{url:r,init:o}=await this.createFetchParams(t,n),i=await this.fetchApi(r,o);if(i&&i.status>=200&&i.status<300)return i;throw new Sl(i,"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 o=Object.assign({},this.configuration.headers,t.headers);Object.keys(o).forEach(d=>o[d]===void 0?delete o[d]:{});const i=typeof n=="function"?n:async()=>n,s={method:t.method,headers:o,body:t.body,credentials:this.configuration.credentials},a={...s,...await i({init:s,context:t})},c={...a,body:Pp(a.body)||a.body instanceof URLSearchParams||Fp(a.body)?a.body:JSON.stringify(a.body)};return{url:r,init:c}}clone(){const t=this.constructor,n=new t(this.configuration);return n.middleware=this.middleware.slice(),n}};bo.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let on=bo;function Fp(e){return typeof Blob<"u"&&e instanceof Blob}function Pp(e){return typeof FormData<"u"&&e instanceof FormData}class Sl extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class Dp extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class ie extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function N(e,t){const n=e[t];return n!=null}function El(e,t=""){return Object.keys(e).map(n=>Nl(n,e[n],t)).filter(n=>n.length>0).join("&")}function Nl(e,t,n=""){const r=n+(n.length?`[${e}]`:e);if(t instanceof Array){const o=t.map(i=>encodeURIComponent(String(i))).join(`&${encodeURIComponent(r)}=`);return`${encodeURIComponent(r)}=${o}`}if(t instanceof Set){const o=Array.from(t);return Nl(e,o,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?El(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function Ue(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class Le{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class jr{constructor(t){this.raw=t}async value(){}}class Za{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function Mp(e){return kp(e)}function kp(e,t){return e==null?e:{fieldUsed:N(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:N(e,"keyFormat")?e.keyFormat:void 0}}function jp(e){return Lp(e)}function Lp(e,t){return e==null?e:{name:e.name,valuePrefix:N(e,"valuePrefix")?e.valuePrefix:void 0}}function qp(e){return Kp(e)}function Kp(e,t){return e==null?e:{name:e.name}}function Up(e){return Vp(e)}function Vp(e,t){return e==null?e:{attachmentType:e.attachmentType,query:N(e,"query")?qp(e.query):void 0,header:N(e,"header")?jp(e.header):void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0}}function $p(e){return Hp(e)}function Hp(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0,includeFullRecords:N(e,"includeFullRecords")?e.includeFullRecords:void 0}}function Bp(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,includeFullRecords:e.includeFullRecords}}function Jp(e){return Wp(e)}function Wp(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 ec={Oauth2:"oauth2",ApiKey:"apiKey",Basic:"basic",Jwt:"jwt",Custom:"custom",None:"none"};function zp(e){return Qp(e)}function Qp(e,t){return e}function Gp(e){return Xp(e)}function Xp(e,t){return e==null?e:{days:N(e,"days")?e.days:void 0,fullHistory:N(e,"fullHistory")?e.fullHistory:void 0}}function Yp(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Tl(e){return Zp(e)}function Zp(e,t){return e==null?e:{defaultPeriod:Gp(e.defaultPeriod)}}function eh(e){if(e!==void 0)return e===null?null:{defaultPeriod:Yp(e.defaultPeriod)}}function th(e){return nh(e)}function nh(e,t){return e==null?e:{days:N(e,"days")?e.days:void 0,fullHistory:N(e,"fullHistory")?e.fullHistory:void 0}}function rh(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function ih(e){return oh(e)}function oh(e,t){return e==null?e:{defaultPeriod:th(e.defaultPeriod)}}function Rl(e){if(e!==void 0)return e===null?null:{defaultPeriod:rh(e.defaultPeriod)}}function sh(e){return ah(e)}function ah(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function Al(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function ch(e){return lh(e)}function lh(e,t){return e}function uh(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:e.selectedValueMappings,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:Rl(e.backfill)}}function dh(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Ue(e.objects,uh)}}function fh(e){return ph(e)}function ph(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 hh(e){if(e!==void 0)return e===null?null:{stringValue:e.stringValue,integerValue:e.integerValue,booleanValue:e.booleanValue}}const mh={Always:"always",Never:"never"},gh={Always:"always",Never:"never"};function yh(e){return vh(e)}function vh(e,t){return e==null?e:{default:N(e,"default")?fh(e.default):void 0,writeOnCreate:N(e,"writeOnCreate")?e.writeOnCreate:void 0,writeOnUpdate:N(e,"writeOnUpdate")?e.writeOnUpdate:void 0}}function Fl(e){if(e!==void 0)return e===null?null:{default:hh(e.default),writeOnCreate:e.writeOnCreate,writeOnUpdate:e.writeOnUpdate}}function wh(e){let t=!0;return t=t&&"value"in e,t}function bh(e,t){return e==null?e:{value:e.value,applyOnUpdate:N(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Ih(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Ch(e){let t=!0;return t=t&&"value"in e,t}function xh(e,t){return e==null?e:{value:e.value,applyOnUpdate:N(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Oh(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function _h(e){let t=!0;return t=t&&"value"in e,t}function Sh(e,t){return e==null?e:{value:e.value,applyOnUpdate:N(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Eh(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Nh(e){return Th(e)}function Th(e,t){return e==null?e:{...bh(e),...xh(e),...Sh(e)}}function Pl(e){if(e!==void 0)return e===null?null:wh(e)?Ih(e):Ch(e)?Oh(e):_h(e)?Eh(e):{}}function Rh(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:Ue(e.selectedValueDefaults,Pl),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:Ue(e.selectedFieldSettings,Fl)}}function Ah(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Ue(e.objects,Rh)}}function Fh(e){return Ph(e)}function Ph(e,t){return e==null?e:{enabled:e.enabled}}function Dh(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Mh(e){return kh(e)}function kh(e,t){return e==null?e:{enabled:e.enabled}}function jh(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Lh(e){return qh(e)}function qh(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 Kh(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function Uh(e){return Vh(e)}function Vh(e,t){return e==null?e:{apiKeyAsBasic:N(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:N(e,"apiKeyAsBasicOpts")?Mp(e.apiKeyAsBasicOpts):void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0}}function $h(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Hh(e){return Bh(e)}function Bh(e,t){return e==null?e:{value:e.value}}function Jh(e){return Wh(e)}function Wh(e,t){return e==null?e:{brandingRemoval:N(e,"brandingRemoval")?Hh(e.brandingRemoval):void 0}}function $i(e){return zh(e)}function zh(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")?Jh(e.entitlements):void 0}}function Qh(e){return Gh(e)}function Gh(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function Xh(e){return Yh(e)}function Yh(e,t){return e==null?e:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:N(e,"selectedValueMappings")?e.selectedValueMappings:void 0,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:N(e,"selectedFieldsAuto")?ch(e.selectedFieldsAuto):void 0,backfill:N(e,"backfill")?ih(e.backfill):void 0}}function Zh(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:e.selectedValueMappings,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:Rl(e.backfill)}}function em(e){return tm(e)}function tm(e,t){return e==null?e:{objects:Ue(e.objects,Xh)}}function nm(e){if(e!==void 0)return e===null?null:{objects:Ue(e.objects,Zh)}}function rm(e){return im(e)}function im(e,t){return e==null?e:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:N(e,"createEvent")?Fh(e.createEvent):void 0,updateEvent:N(e,"updateEvent")?Lh(e.updateEvent):void 0,deleteEvent:N(e,"deleteEvent")?Mh(e.deleteEvent):void 0}}function om(e){if(e!==void 0)return e===null?null:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:Dh(e.createEvent),updateEvent:Kh(e.updateEvent),deleteEvent:jh(e.deleteEvent)}}function sm(e){return am(e)}function am(e,t){return e==null?e:{objects:Ue(e.objects,rm)}}function cm(e){if(e!==void 0)return e===null?null:{objects:Ue(e.objects,om)}}function lm(e){return um(e)}function um(e,t){return e==null?e:{objectName:e.objectName,selectedValueDefaults:N(e,"selectedValueDefaults")?Ue(e.selectedValueDefaults,Nh):void 0,selectedFieldSettings:N(e,"selectedFieldSettings")?Ue(e.selectedFieldSettings,yh):void 0}}function dm(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:Ue(e.selectedValueDefaults,Pl),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:Ue(e.selectedFieldSettings,Fl)}}function fm(e){return pm(e)}function pm(e,t){return e==null?e:{objects:N(e,"objects")?Ue(e.objects,lm):void 0}}function hm(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Ue(e.objects,dm)}}function mm(e){return gm(e)}function gm(e,t){return e==null?e:{provider:e.provider,read:N(e,"read")?em(e.read):void 0,write:N(e,"write")?fm(e.write):void 0,proxy:N(e,"proxy")?sh(e.proxy):void 0,subscribe:N(e,"subscribe")?sm(e.subscribe):void 0}}function ym(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:nm(e.read),write:hm(e.write),proxy:Al(e.proxy),subscribe:cm(e.subscribe)}}function vm(e){return wm(e)}function wm(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:mm(e.content)}}function bm(e){return Im(e)}function Im(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 Dl(e){return Cm(e)}function Cm(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 xm(e){return Om(e)}function Om(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 _m(e){return Sm(e)}function Sm(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 Em(e){return Nm(e)}function Nm(e,t){return e==null?e:{accessToken:N(e,"accessToken")?xm(e.accessToken):void 0,refreshToken:N(e,"refreshToken")?_m(e.refreshToken):void 0,scopes:N(e,"scopes")?e.scopes:void 0}}function Zi(e){return Tm(e)}function Tm(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 Rm(e){return Am(e)}function Am(e,t){return e==null?e:{value:e.value,source:e.source,displayName:N(e,"displayName")?e.displayName:void 0}}function Hs(e){if(e!==void 0)return e===null?null:{value:e.value,source:e.source,displayName:e.displayName}}function ai(e){return Fm(e)}function Fm(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:Dl(e.group),consumer:bm(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")?Em(e.oauth2AuthorizationCode):void 0,apiKey:N(e,"apiKey")?e.apiKey:void 0,providerMetadata:N(e,"providerMetadata")?Ue(e.providerMetadata,Rm):void 0}}function Ml(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function kl(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function jl(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 Pm(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 Dm(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 Ll(e){if(e!==void 0)return e===null?null:{accessToken:Pm(e.accessToken),refreshToken:Dm(e.refreshToken),scopes:e.scopes}}function Mm(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:Ue(e.providerMetadata,Hs),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,customAuth:e.customAuth,basicAuth:Ml(e.basicAuth),oauth2ClientCredentials:kl(e.oauth2ClientCredentials),oauth2PasswordCredentials:jl(e.oauth2PasswordCredentials),oauth2AuthorizationCode:Ll(e.oauth2AuthorizationCode)}}function km(e){return jm(e)}function jm(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function Lm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function qm(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:ym(e.content)}}function Km(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:qm(e.config)}}function Um(e){return Vm(e)}function Vm(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function $m(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Hm(e){return Bm(e)}function Bm(e,t){return e==null?e:{mode:N(e,"mode")?e.mode:void 0,pageSize:N(e,"pageSize")?e.pageSize:void 0}}function Jm(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function Wm(e){let t=!0;return t=t&&"fieldName"in e,t}function zm(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 Qm(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function Gm(e){let t=!0;return t=t&&"mapToName"in e,t}function ql(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 Xm(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function tc(e){return Ym(e)}function Ym(e,t){return e==null?e:{...zm(e),...ql(e)}}function nc(e){if(e!==void 0)return e===null?null:Wm(e)?Qm(e):Gm(e)?Xm(e):{}}function Kl(e){return Zm(e)}function Zm(e,t){return e}function eg(e){return tg(e)}function tg(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(tc):void 0,optionalFields:N(e,"optionalFields")?e.optionalFields.map(tc):void 0,optionalFieldsAuto:N(e,"optionalFieldsAuto")?Kl(e.optionalFieldsAuto):void 0,backfill:N(e,"backfill")?Tl(e.backfill):void 0,delivery:N(e,"delivery")?Hm(e.delivery):void 0}}function ng(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(nc),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(nc),optionalFieldsAuto:e.optionalFieldsAuto,backfill:eh(e.backfill),delivery:Jm(e.delivery)}}function rg(e){return ig(e)}function ig(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(eg):void 0}}function og(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(ng)}}function sg(e){return ag(e)}function ag(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function cg(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function lg(e){return ug(e)}function ug(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 dg(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function fg(e){return pg(e)}function pg(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:N(e,"inheritFieldsAndMapping")?e.inheritFieldsAndMapping:void 0,createEvent:N(e,"createEvent")?km(e.createEvent):void 0,updateEvent:N(e,"updateEvent")?lg(e.updateEvent):void 0,deleteEvent:N(e,"deleteEvent")?sg(e.deleteEvent):void 0,associationChangeEvent:N(e,"associationChangeEvent")?$p(e.associationChangeEvent):void 0,otherEvents:N(e,"otherEvents")?e.otherEvents:void 0}}function hg(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:e.inheritFieldsAndMapping,createEvent:Lm(e.createEvent),updateEvent:dg(e.updateEvent),deleteEvent:cg(e.deleteEvent),associationChangeEvent:Bp(e.associationChangeEvent),otherEvents:e.otherEvents}}function mg(e){return gg(e)}function gg(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(fg):void 0}}function yg(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(hg)}}function Ul(e){return vg(e)}function vg(e,t){return e==null?e:{allowAnyFields:N(e,"allowAnyFields")?e.allowAnyFields:void 0}}function wg(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function bg(e){return Ig(e)}function Ig(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:N(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:N(e,"valueDefaults")?Ul(e.valueDefaults):void 0}}function Cg(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:wg(e.valueDefaults)}}function xg(e){return Og(e)}function Og(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(bg):void 0}}function _g(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Cg)}}function Sg(e){return Eg(e)}function Eg(e,t){return e==null?e:{name:e.name,displayName:N(e,"displayName")?e.displayName:void 0,provider:e.provider,read:N(e,"read")?rg(e.read):void 0,write:N(e,"write")?xg(e.write):void 0,proxy:N(e,"proxy")?Um(e.proxy):void 0,subscribe:N(e,"subscribe")?mg(e.subscribe):void 0}}function Ng(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:og(e.read),write:_g(e.write),proxy:$m(e.proxy),subscribe:yg(e.subscribe)}}function Tg(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:Ng(e.content)}}function Rg(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:Tg(e.latestRevision)}}function Ag(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function Fg(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 Pg(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Dg(e){return Mg(e)}function Mg(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function kg(e){return jg(e)}function jg(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 Lg(e){return qg(e)}function qg(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function Kg(e){return Ug(e)}function Ug(e,t){return e==null?e:{headers:N(e,"headers")?e.headers.map(Dg):void 0,queryParams:N(e,"queryParams")?e.queryParams.map(Lg):void 0,inputs:N(e,"inputs")?e.inputs.map(kg):void 0}}function Vg(e){return $g(e)}function $g(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function Hg(e){return Bg(e)}function Bg(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,values:N(e,"values")?e.values.map(Vg):void 0}}function Jg(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:Ue(e.providerMetadata,Hs),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,customAuth:e.customAuth,basicAuth:Ml(e.basicAuth),oauth2ClientCredentials:kl(e.oauth2ClientCredentials),oauth2PasswordCredentials:jl(e.oauth2PasswordCredentials),oauth2AuthorizationCode:Ll(e.oauth2AuthorizationCode)}}function Wg(e){return zg(e)}function zg(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function Qg(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 Vo(e){return Gg(e)}function Gg(e,t){return e==null?e:{...Qg(e),...ql(e)}}function Xg(e){return Yg(e)}function Yg(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(Vo):void 0,optionalFields:N(e,"optionalFields")?e.optionalFields.map(Vo):void 0,optionalFieldsAuto:N(e,"optionalFieldsAuto")?Kl(e.optionalFieldsAuto):void 0,allFieldsMetadata:N(e,"allFieldsMetadata")?Ue(e.allFieldsMetadata,Hg):void 0,allFields:N(e,"allFields")?e.allFields.map(Vo):void 0,backfill:N(e,"backfill")?Tl(e.backfill):void 0}}function Zg(e){return ey(e)}function ey(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(Xg):void 0}}function ty(e){return ny(e)}function ny(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:N(e,"valueDefaults")?Ul(e.valueDefaults):void 0}}function ry(e){return iy(e)}function iy(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(ty):void 0}}function oy(e){return sy(e)}function sy(e,t){return e==null?e:{name:e.name,displayName:N(e,"displayName")?e.displayName:void 0,provider:e.provider,read:N(e,"read")?Zg(e.read):void 0,write:N(e,"write")?ry(e.write):void 0,proxy:N(e,"proxy")?Wg(e.proxy):void 0}}function ay(e){return cy(e)}function cy(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:oy(e.content)}}function Hi(e){return ly(e)}function ly(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:N(e,"group")?Dl(e.group):void 0,healthStatus:e.healthStatus,connection:ai(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0,config:vm(e.config)}}function uy(e){return dy(e)}function dy(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Sg(e.content)}}function rc(e){return fy(e)}function fy(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:uy(e.latestRevision)}}function py(e){return hy(e)}function hy(e,t){return e==null?e:{iconURL:N(e,"iconURL")?e.iconURL:void 0,logoURL:N(e,"logoURL")?e.logoURL:void 0}}function my(e){return gy(e)}function gy(e,t){return e==null?e:{iconURL:N(e,"iconURL")?e.iconURL:void 0,logoURL:N(e,"logoURL")?e.logoURL:void 0}}function yy(e){return vy(e)}function vy(e,t){return e==null?e:{regular:N(e,"regular")?my(e.regular):void 0,darkMode:N(e,"darkMode")?py(e.darkMode):void 0}}function wy(e){return by(e)}function by(e,t){return e==null?e:{name:e.name,displayName:N(e,"displayName")?e.displayName:void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0,moduleDependencies:N(e,"moduleDependencies")?e.moduleDependencies:void 0}}function Iy(e){return Cy(e)}function Cy(e,t){return e==null?e:{name:e.name,moduleDependencies:N(e,"moduleDependencies")?e.moduleDependencies:void 0}}function xy(e){return Oy(e)}function Oy(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 Vl(e){return _y(e)}function _y(e,t){return e==null?e:{bulkWrite:Qh(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write,subscribeSupport:N(e,"subscribeSupport")?xy(e.subscribeSupport):void 0}}function Sy(e){return Ey(e)}function Ey(e,t){return e==null?e:{displayName:e.displayName,baseURL:e.baseURL,support:Vl(e.support)}}function Ny(e){return Ty(e)}function Ty(e,t){return e==null?e:{name:e.name,displayName:e.displayName,path:e.path,capture:N(e,"capture")?e.capture:void 0}}function Ry(e){return Ay(e)}function Ay(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(Ny):void 0}}const $o={AuthorizationCode:"authorizationCode",AuthorizationCodePkce:"authorizationCodePKCE",ClientCredentials:"clientCredentials",Password:"password"};function Fy(e){return Py(e)}function Py(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,tokenMetadataFields:Ry(e.tokenMetadataFields),docsURL:N(e,"docsURL")?e.docsURL:void 0,authURLParams:N(e,"authURLParams")?e.authURLParams:void 0}}function Dy(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:Ue(e.providerMetadata,Hs),projectId:e.projectId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerAppId:e.providerAppId,provider:e.provider,enableCSRFProtection:e.enableCSRFProtection}}function My(e){return ky(e)}function ky(e,t){return e==null?e:{input:N(e,"input")?e.input.map(wy):void 0,postAuthentication:N(e,"postAuthentication")?e.postAuthentication.map(Iy):void 0}}function jy(e){return Ly(e)}function Ly(e,t){return e==null?e:{subscriptionScope:e.subscriptionScope,targetURLScope:e.targetURLScope,registrationTiming:e.registrationTiming}}function ic(e){return qy(e)}function qy(e,t){return e==null?e:{name:e.name,authType:zp(e.authType),baseURL:e.baseURL,defaultModule:e.defaultModule,oauth2Opts:N(e,"oauth2Opts")?Fy(e.oauth2Opts):void 0,apiKeyOpts:N(e,"apiKeyOpts")?Up(e.apiKeyOpts):void 0,basicOpts:N(e,"basicOpts")?Uh(e.basicOpts):void 0,customOpts:N(e,"customOpts")?Kg(e.customOpts):void 0,support:Vl(e.support),providerOpts:e.providerOpts,authHealthCheck:N(e,"authHealthCheck")?Jp(e.authHealthCheck):void 0,displayName:N(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:N(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:N(e,"media")?yy(e.media):void 0,labels:N(e,"labels")?e.labels:void 0,subscribeOpts:N(e,"subscribeOpts")?jy(e.subscribeOpts):void 0,modules:N(e,"modules")?Ue(e.modules,Sy):void 0,metadata:N(e,"metadata")?My(e.metadata):void 0}}function Ky(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,connection:Mm(e.connection)}}function Uy(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:dh(e.read),write:Ah(e.write),proxy:Al(e.proxy)}}function Vy(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Uy(e.content)}}function $y(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:Vy(e.config)}}function Hy(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:$y(e.installation)}}function By(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function Jy(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:By(e.project)}}function Wy(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 zy(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:Wy(e.providerApp)}}class Qy extends on{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling deleteConnection.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"DELETE",headers:o,query:r},n);return new jr(i)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:Jg(t.generateConnectionParams)},n);return new Le(i,s=>ai(s))}async generateConnection(t,n){return await(await this.generateConnectionRaw(t,n)).value()}async getConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const r={};t.includeCreds!==void 0&&(r.includeCreds=t.includeCreds),t.includeRefreshToken!==void 0&&(r.includeRefreshToken=t.includeRefreshToken),t.refresh!==void 0&&(r.refresh=t.refresh);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"GET",headers:o,query:r},n);return new Le(i,s=>ai(s))}async getConnection(t,n){return await(await this.getConnectionRaw(t,n)).value()}async listConnectionsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const r={};t.provider!==void 0&&(r.provider=t.provider),t.groupRef!==void 0&&(r.groupRef=t.groupRef),t.consumerRef!==void 0&&(r.consumerRef=t.consumerRef);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Le(i,s=>s.map(ai))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}async updateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling updateConnection.");if(t.updateConnectionRequest===null||t.updateConnectionRequest===void 0)throw new ie("updateConnectionRequest","Required parameter requestParameters.updateConnectionRequest was null or undefined when calling updateConnection.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:o,query:r,body:Ky(t.updateConnectionRequest)},n);return new Le(i,s=>ai(s))}async updateConnection(t,n){return await(await this.updateConnectionRaw(t,n)).value()}}class Gy extends on{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new ie("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:r,body:Km(t.installation)},n);return new Le(i,s=>Hi(s))}async createInstallation(t,n){return await(await this.createInstallationRaw(t,n)).value()}async deleteInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=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:o,query:r},n);return new jr(i)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=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:o,query:r},n);return new Le(i,s=>Hi(s))}async getInstallation(t,n){return await(await this.getInstallationRaw(t,n)).value()}async listInstallationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"GET",headers:o,query:r},n);return new Le(i,s=>s.map(Hi))}async listInstallations(t,n){return await(await this.listInstallationsRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new ie("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=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:o,query:r,body:Hy(t.installationUpdate)},n);return new Le(i,s=>Hi(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class Xy extends on{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");if(t.batchUpsertIntegrationsRequest===null||t.batchUpsertIntegrationsRequest===void 0)throw new ie("batchUpsertIntegrationsRequest","Required parameter requestParameters.batchUpsertIntegrationsRequest was null or undefined when calling batchUpsertIntegrations.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:o,query:r,body:$h(t.batchUpsertIntegrationsRequest)},n);return new Le(i,s=>s.map(rc))}async batchUpsertIntegrations(t,n){return await(await this.batchUpsertIntegrationsRaw(t,n)).value()}async createIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new ie("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:Rg(t.integration)},n);return new jr(i)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"DELETE",headers:o,query:r},n);return new jr(i)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Le(i,s=>s.map(rc))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class Yy extends on{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new ie("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/oauth-connect",method:"POST",headers:o,query:r,body:Dy(t.connectOAuthParams)},n);return this.isJsonMime(i.headers.get("content-type"))?new Le(i):new Za(i)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}async oauthUpdateRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling oauthUpdate.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling oauthUpdate.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=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:o,query:r},n);return this.isJsonMime(i.headers.get("content-type"))?new Le(i):new Za(i)}async oauthUpdate(t,n){return await(await this.oauthUpdateRaw(t,n)).value()}}class Zy extends on{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new ie("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects",method:"POST",headers:o,query:r,body:Ag(t.project)},n);return new Le(i,s=>$i(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={};t.includeEntitlements!==void 0&&(r.includeEntitlements=t.includeEntitlements);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Le(i,s=>$i(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects",method:"GET",headers:r,query:n},t);return new Le(o,i=>i.map($i))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new ie("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:o,query:r,body:Jy(t.projectUpdate)},n);return new Le(i,s=>$i(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class ev extends on{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new ie("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:o,query:r},n);return new Le(i,s=>ic(s))}async getProvider(t,n){return await(await this.getProviderRaw(t,n)).value()}async listProvidersRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/providers",method:"GET",headers:r,query:n},t);return new Le(o,i=>Ue(i,ic))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class tv extends on{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new ie("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:Fg(t.providerApp)},n);return new Le(i,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 ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ie("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"DELETE",headers:o,query:r},n);return new jr(i)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Le(i,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 ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ie("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new ie("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"PATCH",headers:o,query:r,body:zy(t.providerAppUpdate)},n);return new Le(i,s=>Zi(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class nv extends on{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");if(t.revision===null||t.revision===void 0)throw new ie("revision","Required parameter requestParameters.revision was null or undefined when calling createRevision.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:r,body:Pg(t.revision)},n);return new jr(i)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new ie("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=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:o,query:r},n);return new Le(i,s=>ay(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class $l{constructor(t){this.connectionApi=new Qy(t),this.installationApi=new Gy(t),this.integrationApi=new Xy(t),this.oAuthApi=new Yy(t),this.projectApi=new Zy(t),this.providerApi=new ev(t),this.providerAppApi=new tv(t),this.revisionApi=new nv(t)}}const Hl="2.8.4",rv="v1",Bi="https://api.withampersand.com";function Bl(){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 Bi;case"mock":return"http://127.0.0.1:4010";case"":return Bi;default:return e??Bi}}catch{return Bi}}const iv=(e,t)=>`${e}/${t}`;function ov(){return iv(Bl(),rv)}const Jl=Bl(),Wl=ov(),sv=new $s({basePath:Wl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Hl}});let av=new $l(sv);const Bs=()=>av;function ot(){const e=Ol();return b.useCallback(async()=>{e||console.error("Unable to create API service without API key.");const n=new $s({basePath:Wl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Hl,"X-Api-Key":e}});return new $l(n)},[e])}const cv=e=>{const t=ot();return Wn({queryKey:["project",e],queryFn:async()=>(await t()).projectApi.getProject({projectIdOrName:e})})},zl=b.createContext({project:null,appName:"",projectId:"",projectIdOrName:"",isLoading:!0}),Ee=()=>{const e=b.useContext(zl);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e};function lv({projectIdOrName:e,children:t}){const{setError:n}=Mt(),{data:r,isLoading:o,isError:i}=cv(e);b.useEffect(()=>{i&&n(ue.PROJECT,e)},[i,e,n]);const s=b.useMemo(()=>({projectId:(r==null?void 0:r.id)||"",projectIdOrName:e,project:r||null,appName:(r==null?void 0:r.appName)||"",isLoading:o}),[e,r,o]);return l.jsx(zl.Provider,{value:s,children:t})}function Ql(){const e=ot(),{projectIdOrName:t}=Ee();return Wn({queryKey:["amp","integrations",t],queryFn:async()=>{if(!t)throw new Error("Project ID or name is required");return(await e()).integrationApi.listIntegrations({projectIdOrName:t})},enabled:!!t})}const Me=async(e,t)=>{var n;if(e instanceof Sl){const{status:r,statusText:o}=e.response;console.error(r===500?"Internal Server Error (500):":r===400?"Bad Request (400):":`Error (${r}):`,o);try{const s=await e.response.clone().json(),a=((n=s==null?void 0:s.causes)==null?void 0:n.join(`
2
- `))||(s==null?void 0:s.detail);a?(console.error("[Error Message]",a),s!=null&&s.remedy&&console.error("[Remedy]",s.remedy)):console.error("Unexpected error response:",s);const c=`${a} ${s!=null&&s.remedy?`
1
+ "use strict";var Ha=e=>{throw TypeError(e)};var Ko=(e,t,n)=>t.has(e)||Ha("Cannot "+n);var _=(e,t,n)=>(Ko(e,t,"read from private field"),n?n.call(e):t.get(e)),se=(e,t,n)=>t.has(e)?Ha("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),G=(e,t,n,r)=>(Ko(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),pe=(e,t,n)=>(Ko(e,t,"access private method"),n);var Ki=(e,t,n,r)=>({set _(o){G(e,t,o,n)},get _(){return _(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),b=require("react");require("react-dom");function Gf(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 k=Gf(b);var zr=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(){}},pr=typeof window>"u"||"Deno"in globalThis;function ft(){}function Xf(e,t){return typeof e=="function"?e(t):e}function ss(e){return typeof e=="number"&&e>=0&&e!==1/0}function pl(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Vn(e,t){return typeof e=="function"?e(t):e}function Jt(e,t){return typeof e=="function"?e(t):e}function Ba(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==Ks(s,t.options))return!1}else if(!ui(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||o&&o!==t.state.fetchStatus||i&&!i(t))}function Ja(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(hr(t.options.mutationKey)!==hr(i))return!1}else if(!ui(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function Ks(e,t){return((t==null?void 0:t.queryKeyHashFn)||hr)(e)}function hr(e){return JSON.stringify(e,(t,n)=>cs(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function ui(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>ui(e[n],t[n])):!1}function as(e,t){if(e===t)return e;const n=Wa(e)&&Wa(t);if(n||cs(e)&&cs(t)){const r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),s=i.length,a=n?[]:{},l=new Set(r);let d=0;for(let u=0;u<s;u++){const f=n?u:i[u];(!n&&l.has(f)||n)&&e[f]===void 0&&t[f]===void 0?(a[f]=void 0,d++):(a[f]=as(e[f],t[f]),a[f]===e[f]&&e[f]!==void 0&&d++)}return o===s&&d===o?e:a}return t}function no(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 Wa(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function cs(e){if(!za(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!za(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function za(e){return Object.prototype.toString.call(e)==="[object Object]"}function Yf(e){return new Promise(t=>{setTimeout(t,e)})}function ls(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 as(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 as(e,t)}return t}function Zf(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function ep(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ro=Symbol();function hl(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===ro&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===ro?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ml(e,t){return typeof e=="function"?e(...t):!!e}var ir,Fn,Or,rl,tp=(rl=class extends zr{constructor(){super();se(this,ir);se(this,Fn);se(this,Or);G(this,Or,t=>{if(!pr&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){_(this,Fn)||this.setEventListener(_(this,Or))}onUnsubscribe(){var t;this.hasListeners()||((t=_(this,Fn))==null||t.call(this),G(this,Fn,void 0))}setEventListener(t){var n;G(this,Or,t),(n=_(this,Fn))==null||n.call(this),G(this,Fn,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){_(this,ir)!==t&&(G(this,ir,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof _(this,ir)=="boolean"?_(this,ir):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},ir=new WeakMap,Fn=new WeakMap,Or=new WeakMap,rl),Us=new tp,_r,Pn,Sr,il,np=(il=class extends zr{constructor(){super();se(this,_r,!0);se(this,Pn);se(this,Sr);G(this,Sr,t=>{if(!pr&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){_(this,Pn)||this.setEventListener(_(this,Sr))}onUnsubscribe(){var t;this.hasListeners()||((t=_(this,Pn))==null||t.call(this),G(this,Pn,void 0))}setEventListener(t){var n;G(this,Sr,t),(n=_(this,Pn))==null||n.call(this),G(this,Pn,t(this.setOnline.bind(this)))}setOnline(t){_(this,_r)!==t&&(G(this,_r,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return _(this,_r)}},_r=new WeakMap,Pn=new WeakMap,Sr=new WeakMap,il),io=new np;function us(){let e,t;const n=new Promise((o,i)=>{e=o,t=i});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}function rp(e){return Math.min(1e3*2**e,3e4)}function gl(e){return(e??"online")==="online"?io.isOnline():!0}var yl=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Uo(e){return e instanceof yl}function vl(e){let t=!1,n=0,r=!1,o;const i=us(),s=y=>{var p;r||(m(new yl(y)),(p=e.abort)==null||p.call(e))},a=()=>{t=!0},l=()=>{t=!1},d=()=>Us.isFocused()&&(e.networkMode==="always"||io.isOnline())&&e.canRun(),u=()=>gl(e.networkMode)&&e.canRun(),f=y=>{var p;r||(r=!0,(p=e.onSuccess)==null||p.call(e,y),o==null||o(),i.resolve(y))},m=y=>{var p;r||(r=!0,(p=e.onError)==null||p.call(e,y),o==null||o(),i.reject(y))},g=()=>new Promise(y=>{var p;o=x=>{(r||d())&&y(x)},(p=e.onPause)==null||p.call(e)}).then(()=>{var y;o=void 0,r||(y=e.onContinue)==null||y.call(e)}),v=()=>{if(r)return;let y;const p=n===0?e.initialPromise:void 0;try{y=p??e.fn()}catch(x){y=Promise.reject(x)}Promise.resolve(y).then(f).catch(x=>{var S;if(r)return;const h=e.retry??(pr?0:3),w=e.retryDelay??rp,I=typeof w=="function"?w(n,x):w,O=h===!0||typeof h=="number"&&n<h||typeof h=="function"&&h(n,x);if(t||!O){m(x);return}n++,(S=e.onFail)==null||S.call(e,n,x),Yf(I).then(()=>d()?void 0:g()).then(()=>{t?m(x):v()})})};return{promise:i,cancel:s,continue:()=>(o==null||o(),i),cancelRetry:a,continueRetry:l,canStart:u,start:()=>(u()?v():g().then(v),i)}}var ip=e=>setTimeout(e,0);function op(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=ip;const i=a=>{t?e.push(a):o(()=>{n(a)})},s=()=>{const a=e;e=[],a.length&&o(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||s()}return l},batchCalls:a=>(...l)=>{i(()=>{a(...l)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{o=a}}}var Qe=op(),or,ol,wl=(ol=class{constructor(){se(this,or)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ss(this.gcTime)&&G(this,or,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(pr?1/0:5*60*1e3))}clearGcTimeout(){_(this,or)&&(clearTimeout(_(this,or)),G(this,or,void 0))}},or=new WeakMap,ol),Er,Nr,Ft,sr,ct,yi,ar,Ht,mn,sl,sp=(sl=class extends wl{constructor(t){super();se(this,Ht);se(this,Er);se(this,Nr);se(this,Ft);se(this,sr);se(this,ct);se(this,yi);se(this,ar);G(this,ar,!1),G(this,yi,t.defaultOptions),this.setOptions(t.options),this.observers=[],G(this,sr,t.client),G(this,Ft,_(this,sr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,G(this,Er,ap(this.options)),this.state=t.state??_(this,Er),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=_(this,ct))==null?void 0:t.promise}setOptions(t){this.options={..._(this,yi),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&_(this,Ft).remove(this)}setData(t,n){const r=ls(this.state.data,t,this.options);return pe(this,Ht,mn).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){pe(this,Ht,mn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=_(this,ct))==null?void 0:r.promise;return(o=_(this,ct))==null||o.cancel(t),n?n.then(ft).catch(ft):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(_(this,Er))}isActive(){return this.observers.some(t=>Jt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ro||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Vn(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!pl(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=_(this,ct))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=_(this,ct))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),_(this,Ft).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(_(this,ct)&&(_(this,ar)?_(this,ct).cancel({revert:!0}):_(this,ct).cancelRetry()),this.scheduleGc()),_(this,Ft).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||pe(this,Ht,mn).call(this,{type:"invalidate"})}fetch(t,n){var d,u,f;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(_(this,ct))return _(this,ct).continueRetry(),_(this,ct).promise}if(t&&this.setOptions(t),!this.options.queryFn){const m=this.observers.find(g=>g.options.queryFn);m&&this.setOptions(m.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,o=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(G(this,ar,!0),r.signal)})},i=()=>{const m=hl(this.options,n),v=(()=>{const y={client:_(this,sr),queryKey:this.queryKey,meta:this.meta};return o(y),y})();return G(this,ar,!1),this.options.persister?this.options.persister(m,v,this):m(v)},a=(()=>{const m={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:_(this,sr),state:this.state,fetchFn:i};return o(m),m})();(d=this.options.behavior)==null||d.onFetch(a,this),G(this,Nr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&pe(this,Ht,mn).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta});const l=m=>{var g,v,y,p;Uo(m)&&m.silent||pe(this,Ht,mn).call(this,{type:"error",error:m}),Uo(m)||((v=(g=_(this,Ft).config).onError)==null||v.call(g,m,this),(p=(y=_(this,Ft).config).onSettled)==null||p.call(y,this.state.data,m,this)),this.scheduleGc()};return G(this,ct,vl({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:m=>{var g,v,y,p;if(m===void 0){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}`),l(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(m)}catch(x){l(x);return}(v=(g=_(this,Ft).config).onSuccess)==null||v.call(g,m,this),(p=(y=_(this,Ft).config).onSettled)==null||p.call(y,m,this.state.error,this),this.scheduleGc()},onError:l,onFail:(m,g)=>{pe(this,Ht,mn).call(this,{type:"failed",failureCount:m,error:g})},onPause:()=>{pe(this,Ht,mn).call(this,{type:"pause"})},onContinue:()=>{pe(this,Ht,mn).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0})),_(this,ct).start()}},Er=new WeakMap,Nr=new WeakMap,Ft=new WeakMap,sr=new WeakMap,ct=new WeakMap,yi=new WeakMap,ar=new WeakMap,Ht=new WeakSet,mn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...bl(r.data,this.options),fetchMeta:t.meta??null};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const o=t.error;return Uo(o)&&o.revert&&_(this,Nr)?{..._(this,Nr),fetchStatus:"idle"}:{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Qe.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),_(this,Ft).notify({query:this,type:"updated",action:t})})},sl);function bl(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:gl(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function ap(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 en,al,cp=(al=class extends zr{constructor(t={}){super();se(this,en);this.config=t,G(this,en,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??Ks(o,n);let s=this.get(i);return s||(s=new sp({client:t,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){_(this,en).has(t.queryHash)||(_(this,en).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=_(this,en).get(t.queryHash);n&&(t.destroy(),n===t&&_(this,en).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Qe.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return _(this,en).get(t)}getAll(){return[..._(this,en).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Ba(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Ba(t,r)):n}notify(t){Qe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Qe.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Qe.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},en=new WeakMap,al),tn,ut,cr,nn,An,cl,lp=(cl=class extends wl{constructor(t){super();se(this,nn);se(this,tn);se(this,ut);se(this,cr);this.mutationId=t.mutationId,G(this,ut,t.mutationCache),G(this,tn,[]),this.state=t.state||Il(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){_(this,tn).includes(t)||(_(this,tn).push(t),this.clearGcTimeout(),_(this,ut).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){G(this,tn,_(this,tn).filter(n=>n!==t)),this.scheduleGc(),_(this,ut).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){_(this,tn).length||(this.state.status==="pending"?this.scheduleGc():_(this,ut).remove(this))}continue(){var t;return((t=_(this,cr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,s,a,l,d,u,f,m,g,v,y,p,x,h,w,I,O,S,T,R;const n=()=>{pe(this,nn,An).call(this,{type:"continue"})};G(this,cr,vl({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(A,D)=>{pe(this,nn,An).call(this,{type:"failed",failureCount:A,error:D})},onPause:()=>{pe(this,nn,An).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>_(this,ut).canRun(this)}));const r=this.state.status==="pending",o=!_(this,cr).canStart();try{if(r)n();else{pe(this,nn,An).call(this,{type:"pending",variables:t,isPaused:o}),await((s=(i=_(this,ut).config).onMutate)==null?void 0:s.call(i,t,this));const D=await((l=(a=this.options).onMutate)==null?void 0:l.call(a,t));D!==this.state.context&&pe(this,nn,An).call(this,{type:"pending",context:D,variables:t,isPaused:o})}const A=await _(this,cr).start();return await((u=(d=_(this,ut).config).onSuccess)==null?void 0:u.call(d,A,t,this.state.context,this)),await((m=(f=this.options).onSuccess)==null?void 0:m.call(f,A,t,this.state.context)),await((v=(g=_(this,ut).config).onSettled)==null?void 0:v.call(g,A,null,this.state.variables,this.state.context,this)),await((p=(y=this.options).onSettled)==null?void 0:p.call(y,A,null,t,this.state.context)),pe(this,nn,An).call(this,{type:"success",data:A}),A}catch(A){try{throw await((h=(x=_(this,ut).config).onError)==null?void 0:h.call(x,A,t,this.state.context,this)),await((I=(w=this.options).onError)==null?void 0:I.call(w,A,t,this.state.context)),await((S=(O=_(this,ut).config).onSettled)==null?void 0:S.call(O,void 0,A,this.state.variables,this.state.context,this)),await((R=(T=this.options).onSettled)==null?void 0:R.call(T,void 0,A,t,this.state.context)),A}finally{pe(this,nn,An).call(this,{type:"error",error:A})}}finally{_(this,ut).runNext(this)}}},tn=new WeakMap,ut=new WeakMap,cr=new WeakMap,nn=new WeakSet,An=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Qe.batch(()=>{_(this,tn).forEach(r=>{r.onMutationUpdate(t)}),_(this,ut).notify({mutation:this,type:"updated",action:t})})},cl);function Il(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var gn,Bt,vi,ll,up=(ll=class extends zr{constructor(t={}){super();se(this,gn);se(this,Bt);se(this,vi);this.config=t,G(this,gn,new Set),G(this,Bt,new Map),G(this,vi,0)}build(t,n,r){const o=new lp({mutationCache:this,mutationId:++Ki(this,vi)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){_(this,gn).add(t);const n=Ui(t);if(typeof n=="string"){const r=_(this,Bt).get(n);r?r.push(t):_(this,Bt).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(_(this,gn).delete(t)){const n=Ui(t);if(typeof n=="string"){const r=_(this,Bt).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&_(this,Bt).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Ui(t);if(typeof n=="string"){const r=_(this,Bt).get(n),o=r==null?void 0:r.find(i=>i.state.status==="pending");return!o||o===t}else return!0}runNext(t){var r;const n=Ui(t);if(typeof n=="string"){const o=(r=_(this,Bt).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Qe.batch(()=>{_(this,gn).forEach(t=>{this.notify({type:"removed",mutation:t})}),_(this,gn).clear(),_(this,Bt).clear()})}getAll(){return Array.from(_(this,gn))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Ja(n,r))}findAll(t={}){return this.getAll().filter(n=>Ja(t,n))}notify(t){Qe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Qe.batch(()=>Promise.all(t.map(n=>n.continue().catch(ft))))}},gn=new WeakMap,Bt=new WeakMap,vi=new WeakMap,ll);function Ui(e){var t;return(t=e.options.scope)==null?void 0:t.id}function Qa(e){return{onFetch:(t,n)=>{var u,f,m,g,v;const r=t.options,o=(m=(f=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:f.fetchMore)==null?void 0:m.direction,i=((g=t.state.data)==null?void 0:g.pages)||[],s=((v=t.state.data)==null?void 0:v.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const d=async()=>{let y=!1;const p=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(t.signal.aborted?y=!0:t.signal.addEventListener("abort",()=>{y=!0}),t.signal)})},x=hl(t.options,t.fetchOptions),h=async(w,I,O)=>{if(y)return Promise.reject();if(I==null&&w.pages.length)return Promise.resolve(w);const T=(()=>{const B={client:t.client,queryKey:t.queryKey,pageParam:I,direction:O?"backward":"forward",meta:t.options.meta};return p(B),B})(),R=await x(T),{maxPages:A}=t.options,D=O?ep:Zf;return{pages:D(w.pages,R,A),pageParams:D(w.pageParams,I,A)}};if(o&&i.length){const w=o==="backward",I=w?dp:Ga,O={pages:i,pageParams:s},S=I(r,O);a=await h(O,S,w)}else{const w=e??i.length;do{const I=l===0?s[0]??r.initialPageParam:Ga(r,a);if(l>0&&I==null)break;a=await h(a,I),l++}while(l<w)}return a};t.options.persister?t.fetchFn=()=>{var y,p;return(p=(y=t.options).persister)==null?void 0:p.call(y,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=d}}}function Ga(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 dp(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var je,Dn,Mn,Tr,Rr,kn,Ar,Fr,ul,fp=(ul=class{constructor(e={}){se(this,je);se(this,Dn);se(this,Mn);se(this,Tr);se(this,Rr);se(this,kn);se(this,Ar);se(this,Fr);G(this,je,e.queryCache||new cp),G(this,Dn,e.mutationCache||new up),G(this,Mn,e.defaultOptions||{}),G(this,Tr,new Map),G(this,Rr,new Map),G(this,kn,0)}mount(){Ki(this,kn)._++,_(this,kn)===1&&(G(this,Ar,Us.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,je).onFocus())})),G(this,Fr,io.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,je).onOnline())})))}unmount(){var e,t;Ki(this,kn)._--,_(this,kn)===0&&((e=_(this,Ar))==null||e.call(this),G(this,Ar,void 0),(t=_(this,Fr))==null||t.call(this),G(this,Fr,void 0))}isFetching(e){return _(this,je).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return _(this,Dn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=_(this,je).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=_(this,je).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Vn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return _(this,je).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,je).get(r.queryHash),i=o==null?void 0:o.state.data,s=Xf(t,i);if(s!==void 0)return _(this,je).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return Qe.batch(()=>_(this,je).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=_(this,je).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=_(this,je);Qe.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=_(this,je);return Qe.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Qe.batch(()=>_(this,je).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(ft).catch(ft)}invalidateQueries(e,t={}){return Qe.batch(()=>(_(this,je).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Qe.batch(()=>_(this,je).findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(ft)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(ft)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=_(this,je).build(this,t);return n.isStaleByTime(Vn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ft).catch(ft)}fetchInfiniteQuery(e){return e.behavior=Qa(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ft).catch(ft)}ensureInfiniteQueryData(e){return e.behavior=Qa(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return io.isOnline()?_(this,Dn).resumePausedMutations():Promise.resolve()}getQueryCache(){return _(this,je)}getMutationCache(){return _(this,Dn)}getDefaultOptions(){return _(this,Mn)}setDefaultOptions(e){G(this,Mn,e)}setQueryDefaults(e,t){_(this,Tr).set(hr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[..._(this,Tr).values()],n={};return t.forEach(r=>{ui(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){_(this,Rr).set(hr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[..._(this,Rr).values()],n={};return t.forEach(r=>{ui(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={..._(this,Mn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ks(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===ro&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{..._(this,Mn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){_(this,je).clear(),_(this,Dn).clear()}},je=new WeakMap,Dn=new WeakMap,Mn=new WeakMap,Tr=new WeakMap,Rr=new WeakMap,kn=new WeakMap,Ar=new WeakMap,Fr=new WeakMap,ul),yt,ve,wi,dt,lr,Pr,jn,Ln,bi,Dr,Mr,ur,dr,qn,kr,Se,oi,ds,fs,ps,hs,ms,gs,ys,Cl,dl,pp=(dl=class extends zr{constructor(t,n){super();se(this,Se);se(this,yt);se(this,ve);se(this,wi);se(this,dt);se(this,lr);se(this,Pr);se(this,jn);se(this,Ln);se(this,bi);se(this,Dr);se(this,Mr);se(this,ur);se(this,dr);se(this,qn);se(this,kr,new Set);this.options=n,G(this,yt,t),G(this,Ln,null),G(this,jn,us()),this.options.experimental_prefetchInRender||_(this,jn).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(_(this,ve).addObserver(this),Xa(_(this,ve),this.options)?pe(this,Se,oi).call(this):this.updateResult(),pe(this,Se,hs).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return vs(_(this,ve),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return vs(_(this,ve),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,pe(this,Se,ms).call(this),pe(this,Se,gs).call(this),_(this,ve).removeObserver(this)}setOptions(t){const n=this.options,r=_(this,ve);if(this.options=_(this,yt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Jt(this.options.enabled,_(this,ve))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");pe(this,Se,ys).call(this),_(this,ve).setOptions(this.options),n._defaulted&&!no(this.options,n)&&_(this,yt).getQueryCache().notify({type:"observerOptionsUpdated",query:_(this,ve),observer:this});const o=this.hasListeners();o&&Ya(_(this,ve),r,this.options,n)&&pe(this,Se,oi).call(this),this.updateResult(),o&&(_(this,ve)!==r||Jt(this.options.enabled,_(this,ve))!==Jt(n.enabled,_(this,ve))||Vn(this.options.staleTime,_(this,ve))!==Vn(n.staleTime,_(this,ve)))&&pe(this,Se,ds).call(this);const i=pe(this,Se,fs).call(this);o&&(_(this,ve)!==r||Jt(this.options.enabled,_(this,ve))!==Jt(n.enabled,_(this,ve))||i!==_(this,qn))&&pe(this,Se,ps).call(this,i)}getOptimisticResult(t){const n=_(this,yt).getQueryCache().build(_(this,yt),t),r=this.createResult(n,t);return mp(this,r)&&(G(this,dt,r),G(this,Pr,this.options),G(this,lr,_(this,ve).state)),r}getCurrentResult(){return _(this,dt)}trackResult(t,n){return new Proxy(t,{get:(r,o)=>(this.trackProp(o),n==null||n(o),Reflect.get(r,o))})}trackProp(t){_(this,kr).add(t)}getCurrentQuery(){return _(this,ve)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=_(this,yt).defaultQueryOptions(t),r=_(this,yt).getQueryCache().build(_(this,yt),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return pe(this,Se,oi).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),_(this,dt)))}createResult(t,n){var A;const r=_(this,ve),o=this.options,i=_(this,dt),s=_(this,lr),a=_(this,Pr),d=t!==r?t.state:_(this,wi),{state:u}=t;let f={...u},m=!1,g;if(n._optimisticResults){const D=this.hasListeners(),B=!D&&Xa(t,n),$=D&&Ya(t,r,n,o);(B||$)&&(f={...f,...bl(u.data,t.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:v,errorUpdatedAt:y,status:p}=f;g=f.data;let x=!1;if(n.placeholderData!==void 0&&g===void 0&&p==="pending"){let D;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(D=i.data,x=!0):D=typeof n.placeholderData=="function"?n.placeholderData((A=_(this,Mr))==null?void 0:A.state.data,_(this,Mr)):n.placeholderData,D!==void 0&&(p="success",g=ls(i==null?void 0:i.data,D,n),m=!0)}if(n.select&&g!==void 0&&!x)if(i&&g===(s==null?void 0:s.data)&&n.select===_(this,bi))g=_(this,Dr);else try{G(this,bi,n.select),g=n.select(g),g=ls(i==null?void 0:i.data,g,n),G(this,Dr,g),G(this,Ln,null)}catch(D){G(this,Ln,D)}_(this,Ln)&&(v=_(this,Ln),g=_(this,Dr),y=Date.now(),p="error");const h=f.fetchStatus==="fetching",w=p==="pending",I=p==="error",O=w&&h,S=g!==void 0,R={status:p,fetchStatus:f.fetchStatus,isPending:w,isSuccess:p==="success",isError:I,isInitialLoading:O,isLoading:O,data:g,dataUpdatedAt:f.dataUpdatedAt,error:v,errorUpdatedAt:y,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>d.dataUpdateCount||f.errorUpdateCount>d.errorUpdateCount,isFetching:h,isRefetching:h&&!w,isLoadingError:I&&!S,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:I&&S,isStale:Vs(t,n),refetch:this.refetch,promise:_(this,jn)};if(this.options.experimental_prefetchInRender){const D=L=>{R.status==="error"?L.reject(R.error):R.data!==void 0&&L.resolve(R.data)},B=()=>{const L=G(this,jn,R.promise=us());D(L)},$=_(this,jn);switch($.status){case"pending":t.queryHash===r.queryHash&&D($);break;case"fulfilled":(R.status==="error"||R.data!==$.value)&&B();break;case"rejected":(R.status!=="error"||R.error!==$.reason)&&B();break}}return R}updateResult(){const t=_(this,dt),n=this.createResult(_(this,ve),this.options);if(G(this,lr,_(this,ve).state),G(this,Pr,this.options),_(this,lr).data!==void 0&&G(this,Mr,_(this,ve)),no(n,t))return;G(this,dt,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:o}=this.options,i=typeof o=="function"?o():o;if(i==="all"||!i&&!_(this,kr).size)return!0;const s=new Set(i??_(this,kr));return this.options.throwOnError&&s.add("error"),Object.keys(_(this,dt)).some(a=>{const l=a;return _(this,dt)[l]!==t[l]&&s.has(l)})};pe(this,Se,Cl).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&pe(this,Se,hs).call(this)}},yt=new WeakMap,ve=new WeakMap,wi=new WeakMap,dt=new WeakMap,lr=new WeakMap,Pr=new WeakMap,jn=new WeakMap,Ln=new WeakMap,bi=new WeakMap,Dr=new WeakMap,Mr=new WeakMap,ur=new WeakMap,dr=new WeakMap,qn=new WeakMap,kr=new WeakMap,Se=new WeakSet,oi=function(t){pe(this,Se,ys).call(this);let n=_(this,ve).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(ft)),n},ds=function(){pe(this,Se,ms).call(this);const t=Vn(this.options.staleTime,_(this,ve));if(pr||_(this,dt).isStale||!ss(t))return;const r=pl(_(this,dt).dataUpdatedAt,t)+1;G(this,ur,setTimeout(()=>{_(this,dt).isStale||this.updateResult()},r))},fs=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(_(this,ve)):this.options.refetchInterval)??!1},ps=function(t){pe(this,Se,gs).call(this),G(this,qn,t),!(pr||Jt(this.options.enabled,_(this,ve))===!1||!ss(_(this,qn))||_(this,qn)===0)&&G(this,dr,setInterval(()=>{(this.options.refetchIntervalInBackground||Us.isFocused())&&pe(this,Se,oi).call(this)},_(this,qn)))},hs=function(){pe(this,Se,ds).call(this),pe(this,Se,ps).call(this,pe(this,Se,fs).call(this))},ms=function(){_(this,ur)&&(clearTimeout(_(this,ur)),G(this,ur,void 0))},gs=function(){_(this,dr)&&(clearInterval(_(this,dr)),G(this,dr,void 0))},ys=function(){const t=_(this,yt).getQueryCache().build(_(this,yt),this.options);if(t===_(this,ve))return;const n=_(this,ve);G(this,ve,t),G(this,wi,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Cl=function(t){Qe.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(_(this,dt))}),_(this,yt).getQueryCache().notify({query:_(this,ve),type:"observerResultsUpdated"})})},dl);function hp(e,t){return Jt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Xa(e,t){return hp(e,t)||e.state.data!==void 0&&vs(e,t,t.refetchOnMount)}function vs(e,t,n){if(Jt(t.enabled,e)!==!1&&Vn(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Vs(e,t)}return!1}function Ya(e,t,n,r){return(e!==t||Jt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Vs(e,n)}function Vs(e,t){return Jt(t.enabled,e)!==!1&&e.isStaleByTime(Vn(t.staleTime,e))}function mp(e,t){return!no(e.getCurrentResult(),t)}var Kn,Un,vt,yn,wn,Xi,ws,fl,gp=(fl=class extends zr{constructor(n,r){super();se(this,wn);se(this,Kn);se(this,Un);se(this,vt);se(this,yn);G(this,Kn,n),this.setOptions(r),this.bindMethods(),pe(this,wn,Xi).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var o;const r=this.options;this.options=_(this,Kn).defaultMutationOptions(n),no(this.options,r)||_(this,Kn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:_(this,vt),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&hr(r.mutationKey)!==hr(this.options.mutationKey)?this.reset():((o=_(this,vt))==null?void 0:o.state.status)==="pending"&&_(this,vt).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=_(this,vt))==null||n.removeObserver(this)}onMutationUpdate(n){pe(this,wn,Xi).call(this),pe(this,wn,ws).call(this,n)}getCurrentResult(){return _(this,Un)}reset(){var n;(n=_(this,vt))==null||n.removeObserver(this),G(this,vt,void 0),pe(this,wn,Xi).call(this),pe(this,wn,ws).call(this)}mutate(n,r){var o;return G(this,yn,r),(o=_(this,vt))==null||o.removeObserver(this),G(this,vt,_(this,Kn).getMutationCache().build(_(this,Kn),this.options)),_(this,vt).addObserver(this),_(this,vt).execute(n)}},Kn=new WeakMap,Un=new WeakMap,vt=new WeakMap,yn=new WeakMap,wn=new WeakSet,Xi=function(){var r;const n=((r=_(this,vt))==null?void 0:r.state)??Il();G(this,Un,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},ws=function(n){Qe.batch(()=>{var r,o,i,s,a,l,d,u;if(_(this,yn)&&this.hasListeners()){const f=_(this,Un).variables,m=_(this,Un).context;(n==null?void 0:n.type)==="success"?((o=(r=_(this,yn)).onSuccess)==null||o.call(r,n.data,f,m),(s=(i=_(this,yn)).onSettled)==null||s.call(i,n.data,null,f,m)):(n==null?void 0:n.type)==="error"&&((l=(a=_(this,yn)).onError)==null||l.call(a,n.error,f,m),(u=(d=_(this,yn)).onSettled)==null||u.call(d,void 0,n.error,f,m))}this.listeners.forEach(f=>{f(_(this,Un))})})},fl),xl=k.createContext(void 0),qe=e=>{const t=k.useContext(xl);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},yp=({client:e,children:t})=>(k.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),c.jsx(xl.Provider,{value:e,children:t})),Ol=k.createContext(!1),vp=()=>k.useContext(Ol);Ol.Provider;function wp(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var bp=k.createContext(wp()),Ip=()=>k.useContext(bp),Cp=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},xp=e=>{k.useEffect(()=>{e.clearReset()},[e])},Op=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||ml(n,[e.error,r])),_p=e=>{if(e.suspense){const t=r=>r==="static"?r:Math.max(r??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...r)=>t(n(...r)):t(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Sp=(e,t)=>e.isLoading&&e.isFetching&&!t,Ep=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Za=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Np(e,t,n){var f,m,g,v,y;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=vp(),o=Ip(),i=qe(),s=i.defaultQueryOptions(e);(m=(f=i.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||m.call(f,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",_p(s),Cp(s,o),xp(o);const a=!i.getQueryCache().get(s.queryHash),[l]=k.useState(()=>new t(i,s)),d=l.getOptimisticResult(s),u=!r&&e.subscribed!==!1;if(k.useSyncExternalStore(k.useCallback(p=>{const x=u?l.subscribe(Qe.batchCalls(p)):ft;return l.updateResult(),x},[l,u]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),k.useEffect(()=>{l.setOptions(s)},[s,l]),Ep(s,d))throw Za(s,l,o);if(Op({result:d,errorResetBoundary:o,throwOnError:s.throwOnError,query:i.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw d.error;if((v=(g=i.getDefaultOptions().queries)==null?void 0:g._experimental_afterQuery)==null||v.call(g,s,d),s.experimental_prefetchInRender&&!pr&&Sp(d,r)){const p=a?Za(s,l,o):(y=i.getQueryCache().get(s.queryHash))==null?void 0:y.promise;p==null||p.catch(ft).finally(()=>{l.updateResult()})}return s.notifyOnChangeProps?d:l.trackResult(d)}function Wn(e,t){return Np(e,pp)}function In(e,t){const n=qe(),[r]=k.useState(()=>new gp(n,e));k.useEffect(()=>{r.setOptions(e)},[r,e]);const o=k.useSyncExternalStore(k.useCallback(s=>r.subscribe(Qe.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=k.useCallback((s,a)=>{r.mutate(s,a).catch(ft)},[r]);if(o.error&&ml(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:i,mutateAsync:o.mutate}}const _l=b.createContext(null),Tp=_l.Provider,Sl=()=>{const e=b.useContext(_l);if(e===null)throw new Error("useApiKey must be used within an ApiKeyProvider");return e};var ue=(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))(ue||{});const El=b.createContext(void 0);function Mt(){const e=b.useContext(El);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const Rp=(()=>{const e={};return Object.values(ue).forEach(t=>{e[t]={}}),e})();function Ap({children:e}){const[t,n]=b.useState(Rp),r=b.useCallback((u,f,m=!0)=>{n(g=>{const v={...g};return v[u]=v[u]||{},v[u][f]=m,v})},[n]),o=b.useCallback((u,f)=>{var m;return!!((m=t[u])!=null&&m[f])},[t]),i=b.useCallback((u,f)=>{var m;return(m=t[u])==null?void 0:m[f]},[t]),s=b.useCallback((u,f)=>{n(m=>{var v;const g={...m};return(v=g[u])==null||delete v[f],g})},[n]),a=b.useCallback(u=>{n(f=>{const m={...f};return m[u]={},m})},[n]),l=b.useCallback((u,f)=>{n(m=>{const g={...m};return g[u]=g[u]||{},f.forEach(v=>{g[u][v]=!0}),g})},[n]),d=b.useMemo(()=>({errorState:t,setErrorState:n,setError:r,isError:o,removeError:s,resetBoundary:a,setErrors:l,getError:i}),[t,n,r,o,s,a,l,i]);return c.jsx(El.Provider,{value:d,children:e})}const Fp="https://api.withampersand.com/v1".replace(/\/+$/,"");class $s{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Fp}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Tl}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 Pp=new $s,bo=class bo{constructor(t=Pp){this.configuration=t,this.fetchApi=async(n,r)=>{let o={url:n,init:r};for(const s of this.middleware)s.pre&&(o=await s.pre({fetch:this.fetchApi,...o})||o);let i;try{i=await(this.configuration.fetchApi||fetch)(o.url,o.init)}catch(s){for(const a of this.middleware)a.onError&&(i=await a.onError({fetch:this.fetchApi,url:o.url,init:o.init,error:s,response:i?i.clone():void 0})||i);if(i===void 0)throw s instanceof Error?new kp(s,"The request failed and the interceptors did not return an alternative response"):s}for(const s of this.middleware)s.post&&(i=await s.post({fetch:this.fetchApi,url:o.url,init:o.init,response:i.clone()})||i);return i},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?bo.jsonRegex.test(t):!1}async request(t,n){const{url:r,init:o}=await this.createFetchParams(t,n),i=await this.fetchApi(r,o);if(i&&i.status>=200&&i.status<300)return i;throw new Nl(i,"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 o=Object.assign({},this.configuration.headers,t.headers);Object.keys(o).forEach(d=>o[d]===void 0?delete o[d]:{});const i=typeof n=="function"?n:async()=>n,s={method:t.method,headers:o,body:t.body,credentials:this.configuration.credentials},a={...s,...await i({init:s,context:t})},l={...a,body:Mp(a.body)||a.body instanceof URLSearchParams||Dp(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}};bo.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let rn=bo;function Dp(e){return typeof Blob<"u"&&e instanceof Blob}function Mp(e){return typeof FormData<"u"&&e instanceof FormData}class Nl extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class kp extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class ie extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function N(e,t){const n=e[t];return n!=null}function Tl(e,t=""){return Object.keys(e).map(n=>Rl(n,e[n],t)).filter(n=>n.length>0).join("&")}function Rl(e,t,n=""){const r=n+(n.length?`[${e}]`:e);if(t instanceof Array){const o=t.map(i=>encodeURIComponent(String(i))).join(`&${encodeURIComponent(r)}=`);return`${encodeURIComponent(r)}=${o}`}if(t instanceof Set){const o=Array.from(t);return Rl(e,o,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Tl(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function Ue(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class Le{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class jr{constructor(t){this.raw=t}async value(){}}class ec{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function jp(e){return Lp(e)}function Lp(e,t){return e==null?e:{fieldUsed:N(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:N(e,"keyFormat")?e.keyFormat:void 0}}function qp(e){return Kp(e)}function Kp(e,t){return e==null?e:{name:e.name,valuePrefix:N(e,"valuePrefix")?e.valuePrefix:void 0}}function Up(e){return Vp(e)}function Vp(e,t){return e==null?e:{name:e.name}}function $p(e){return Hp(e)}function Hp(e,t){return e==null?e:{attachmentType:e.attachmentType,query:N(e,"query")?Up(e.query):void 0,header:N(e,"header")?qp(e.header):void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0}}function Bp(e){return Jp(e)}function Jp(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0,includeFullRecords:N(e,"includeFullRecords")?e.includeFullRecords:void 0}}function Wp(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,includeFullRecords:e.includeFullRecords}}function zp(e){return Qp(e)}function Qp(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 tc={Oauth2:"oauth2",ApiKey:"apiKey",Basic:"basic",Jwt:"jwt",Custom:"custom",None:"none"};function Gp(e){return Xp(e)}function Xp(e,t){return e}function Yp(e){return Zp(e)}function Zp(e,t){return e==null?e:{days:N(e,"days")?e.days:void 0,fullHistory:N(e,"fullHistory")?e.fullHistory:void 0}}function eh(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Al(e){return th(e)}function th(e,t){return e==null?e:{defaultPeriod:Yp(e.defaultPeriod)}}function nh(e){if(e!==void 0)return e===null?null:{defaultPeriod:eh(e.defaultPeriod)}}function rh(e){return ih(e)}function ih(e,t){return e==null?e:{days:N(e,"days")?e.days:void 0,fullHistory:N(e,"fullHistory")?e.fullHistory:void 0}}function oh(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function sh(e){return ah(e)}function ah(e,t){return e==null?e:{defaultPeriod:rh(e.defaultPeriod)}}function Fl(e){if(e!==void 0)return e===null?null:{defaultPeriod:oh(e.defaultPeriod)}}function ch(e){return lh(e)}function lh(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function Pl(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function uh(e){return dh(e)}function dh(e,t){return e}function fh(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:e.selectedValueMappings,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:Fl(e.backfill)}}function ph(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Ue(e.objects,fh)}}function hh(e){return mh(e)}function mh(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 gh(e){if(e!==void 0)return e===null?null:{stringValue:e.stringValue,integerValue:e.integerValue,booleanValue:e.booleanValue}}const yh={Always:"always",Never:"never"},vh={Always:"always",Never:"never"};function wh(e){return bh(e)}function bh(e,t){return e==null?e:{default:N(e,"default")?hh(e.default):void 0,writeOnCreate:N(e,"writeOnCreate")?e.writeOnCreate:void 0,writeOnUpdate:N(e,"writeOnUpdate")?e.writeOnUpdate:void 0}}function Dl(e){if(e!==void 0)return e===null?null:{default:gh(e.default),writeOnCreate:e.writeOnCreate,writeOnUpdate:e.writeOnUpdate}}function Ih(e){let t=!0;return t=t&&"value"in e,t}function Ch(e,t){return e==null?e:{value:e.value,applyOnUpdate:N(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function xh(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Oh(e){let t=!0;return t=t&&"value"in e,t}function _h(e,t){return e==null?e:{value:e.value,applyOnUpdate:N(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Sh(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Eh(e){let t=!0;return t=t&&"value"in e,t}function Nh(e,t){return e==null?e:{value:e.value,applyOnUpdate:N(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Th(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Rh(e){return Ah(e)}function Ah(e,t){return e==null?e:{...Ch(e),..._h(e),...Nh(e)}}function Ml(e){if(e!==void 0)return e===null?null:Ih(e)?xh(e):Oh(e)?Sh(e):Eh(e)?Th(e):{}}function Fh(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:Ue(e.selectedValueDefaults,Ml),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:Ue(e.selectedFieldSettings,Dl)}}function Ph(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Ue(e.objects,Fh)}}function Dh(e){return Mh(e)}function Mh(e,t){return e==null?e:{enabled:e.enabled}}function kh(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function jh(e){return Lh(e)}function Lh(e,t){return e==null?e:{enabled:e.enabled}}function qh(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Kh(e){return Uh(e)}function Uh(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 Vh(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function $h(e){return Hh(e)}function Hh(e,t){return e==null?e:{apiKeyAsBasic:N(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:N(e,"apiKeyAsBasicOpts")?jp(e.apiKeyAsBasicOpts):void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0}}function Bh(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Jh(e){return Wh(e)}function Wh(e,t){return e==null?e:{value:e.value}}function zh(e){return Qh(e)}function Qh(e,t){return e==null?e:{brandingRemoval:N(e,"brandingRemoval")?Jh(e.brandingRemoval):void 0}}function Vi(e){return Gh(e)}function Gh(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")?zh(e.entitlements):void 0}}function Xh(e){return Yh(e)}function Yh(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function Zh(e){return em(e)}function em(e,t){return e==null?e:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:N(e,"selectedValueMappings")?e.selectedValueMappings:void 0,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:N(e,"selectedFieldsAuto")?uh(e.selectedFieldsAuto):void 0,backfill:N(e,"backfill")?sh(e.backfill):void 0}}function tm(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:e.selectedValueMappings,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:Fl(e.backfill)}}function nm(e){return rm(e)}function rm(e,t){return e==null?e:{objects:Ue(e.objects,Zh)}}function im(e){if(e!==void 0)return e===null?null:{objects:Ue(e.objects,tm)}}function om(e){return sm(e)}function sm(e,t){return e==null?e:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:N(e,"createEvent")?Dh(e.createEvent):void 0,updateEvent:N(e,"updateEvent")?Kh(e.updateEvent):void 0,deleteEvent:N(e,"deleteEvent")?jh(e.deleteEvent):void 0}}function am(e){if(e!==void 0)return e===null?null:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:kh(e.createEvent),updateEvent:Vh(e.updateEvent),deleteEvent:qh(e.deleteEvent)}}function cm(e){return lm(e)}function lm(e,t){return e==null?e:{objects:Ue(e.objects,om)}}function um(e){if(e!==void 0)return e===null?null:{objects:Ue(e.objects,am)}}function dm(e){return fm(e)}function fm(e,t){return e==null?e:{objectName:e.objectName,selectedValueDefaults:N(e,"selectedValueDefaults")?Ue(e.selectedValueDefaults,Rh):void 0,selectedFieldSettings:N(e,"selectedFieldSettings")?Ue(e.selectedFieldSettings,wh):void 0}}function pm(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:Ue(e.selectedValueDefaults,Ml),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:Ue(e.selectedFieldSettings,Dl)}}function hm(e){return mm(e)}function mm(e,t){return e==null?e:{objects:N(e,"objects")?Ue(e.objects,dm):void 0}}function gm(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Ue(e.objects,pm)}}function ym(e){return vm(e)}function vm(e,t){return e==null?e:{provider:e.provider,read:N(e,"read")?nm(e.read):void 0,write:N(e,"write")?hm(e.write):void 0,proxy:N(e,"proxy")?ch(e.proxy):void 0,subscribe:N(e,"subscribe")?cm(e.subscribe):void 0}}function wm(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:im(e.read),write:gm(e.write),proxy:Pl(e.proxy),subscribe:um(e.subscribe)}}function bm(e){return Im(e)}function Im(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:ym(e.content)}}function Cm(e){return xm(e)}function xm(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0}}function kl(e){return Om(e)}function Om(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0}}function _m(e){return Sm(e)}function Sm(e,t){return e==null?e:{token:e.token,issuedAt:N(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:N(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Em(e){return Nm(e)}function Nm(e,t){return e==null?e:{token:e.token,issuedAt:N(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:N(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Tm(e){return Rm(e)}function Rm(e,t){return e==null?e:{accessToken:N(e,"accessToken")?_m(e.accessToken):void 0,refreshToken:N(e,"refreshToken")?Em(e.refreshToken):void 0,scopes:N(e,"scopes")?e.scopes:void 0}}function Yi(e){return Am(e)}function Am(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 Fm(e){return Pm(e)}function Pm(e,t){return e==null?e:{value:e.value,source:e.source,displayName:N(e,"displayName")?e.displayName:void 0}}function Hs(e){if(e!==void 0)return e===null?null:{value:e.value,source:e.source,displayName:e.displayName}}function si(e){return Dm(e)}function Dm(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:N(e,"providerApp")?Yi(e.providerApp):void 0,group:kl(e.group),consumer:Cm(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")?Tm(e.oauth2AuthorizationCode):void 0,apiKey:N(e,"apiKey")?e.apiKey:void 0,providerMetadata:N(e,"providerMetadata")?Ue(e.providerMetadata,Fm):void 0}}function jl(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function Ll(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function ql(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password,clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function Mm(e){if(e!==void 0)return e===null?null:{token:e.token,expiresAt:e.expiresAt===void 0?void 0:e.expiresAt.toISOString(),issuedAt:e.issuedAt===void 0?void 0:e.issuedAt.toISOString()}}function km(e){if(e!==void 0)return e===null?null:{token:e.token,expiresAt:e.expiresAt===void 0?void 0:e.expiresAt.toISOString(),issuedAt:e.issuedAt===void 0?void 0:e.issuedAt.toISOString()}}function Kl(e){if(e!==void 0)return e===null?null:{accessToken:Mm(e.accessToken),refreshToken:km(e.refreshToken),scopes:e.scopes}}function jm(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:Ue(e.providerMetadata,Hs),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,customAuth:e.customAuth,basicAuth:jl(e.basicAuth),oauth2ClientCredentials:Ll(e.oauth2ClientCredentials),oauth2PasswordCredentials:ql(e.oauth2PasswordCredentials),oauth2AuthorizationCode:Kl(e.oauth2AuthorizationCode)}}function Lm(e){return qm(e)}function qm(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function Km(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Um(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:wm(e.content)}}function Vm(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:Um(e.config)}}function $m(e){return Hm(e)}function Hm(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function Bm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Jm(e){return Wm(e)}function Wm(e,t){return e==null?e:{mode:N(e,"mode")?e.mode:void 0,pageSize:N(e,"pageSize")?e.pageSize:void 0}}function zm(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function Qm(e){let t=!0;return t=t&&"fieldName"in e,t}function Gm(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:N(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Xm(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function Ym(e){let t=!0;return t=t&&"mapToName"in e,t}function Ul(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 Zm(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function nc(e){return eg(e)}function eg(e,t){return e==null?e:{...Gm(e),...Ul(e)}}function rc(e){if(e!==void 0)return e===null?null:Qm(e)?Xm(e):Ym(e)?Zm(e):{}}function Vl(e){return tg(e)}function tg(e,t){return e}function ng(e){return rg(e)}function rg(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:N(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:N(e,"requiredFields")?e.requiredFields.map(nc):void 0,optionalFields:N(e,"optionalFields")?e.optionalFields.map(nc):void 0,optionalFieldsAuto:N(e,"optionalFieldsAuto")?Vl(e.optionalFieldsAuto):void 0,backfill:N(e,"backfill")?Al(e.backfill):void 0,delivery:N(e,"delivery")?Jm(e.delivery):void 0}}function ig(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,requiredFields:e.requiredFields===void 0?void 0:e.requiredFields.map(rc),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(rc),optionalFieldsAuto:e.optionalFieldsAuto,backfill:nh(e.backfill),delivery:zm(e.delivery)}}function og(e){return sg(e)}function sg(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(ng):void 0}}function ag(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(ig)}}function cg(e){return lg(e)}function lg(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function ug(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function dg(e){return fg(e)}function fg(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0,watchFieldsAuto:N(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:N(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function pg(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function hg(e){return mg(e)}function mg(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:N(e,"inheritFieldsAndMapping")?e.inheritFieldsAndMapping:void 0,createEvent:N(e,"createEvent")?Lm(e.createEvent):void 0,updateEvent:N(e,"updateEvent")?dg(e.updateEvent):void 0,deleteEvent:N(e,"deleteEvent")?cg(e.deleteEvent):void 0,associationChangeEvent:N(e,"associationChangeEvent")?Bp(e.associationChangeEvent):void 0,otherEvents:N(e,"otherEvents")?e.otherEvents:void 0}}function gg(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:e.inheritFieldsAndMapping,createEvent:Km(e.createEvent),updateEvent:pg(e.updateEvent),deleteEvent:ug(e.deleteEvent),associationChangeEvent:Wp(e.associationChangeEvent),otherEvents:e.otherEvents}}function yg(e){return vg(e)}function vg(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(hg):void 0}}function wg(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(gg)}}function $l(e){return bg(e)}function bg(e,t){return e==null?e:{allowAnyFields:N(e,"allowAnyFields")?e.allowAnyFields:void 0}}function Ig(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function Cg(e){return xg(e)}function xg(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:N(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:N(e,"valueDefaults")?$l(e.valueDefaults):void 0}}function Og(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:Ig(e.valueDefaults)}}function _g(e){return Sg(e)}function Sg(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(Cg):void 0}}function Eg(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Og)}}function Ng(e){return Tg(e)}function Tg(e,t){return e==null?e:{name:e.name,displayName:N(e,"displayName")?e.displayName:void 0,provider:e.provider,read:N(e,"read")?og(e.read):void 0,write:N(e,"write")?_g(e.write):void 0,proxy:N(e,"proxy")?$m(e.proxy):void 0,subscribe:N(e,"subscribe")?yg(e.subscribe):void 0}}function Rg(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:ag(e.read),write:Eg(e.write),proxy:Bm(e.proxy),subscribe:wg(e.subscribe)}}function Ag(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:Rg(e.content)}}function Fg(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:Ag(e.latestRevision)}}function Pg(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function Dg(e){if(e!==void 0)return e===null?null:{externalRef:e.externalRef,provider:e.provider,clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function Mg(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function kg(e){return jg(e)}function jg(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function Lg(e){return qg(e)}function qg(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 Kg(e){return Ug(e)}function Ug(e,t){return e==null?e:{name:e.name,valueTemplate:e.valueTemplate}}function Vg(e){return $g(e)}function $g(e,t){return e==null?e:{headers:N(e,"headers")?e.headers.map(kg):void 0,queryParams:N(e,"queryParams")?e.queryParams.map(Kg):void 0,inputs:N(e,"inputs")?e.inputs.map(Lg):void 0}}function Hg(e){return Bg(e)}function Bg(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function Jg(e){return Wg(e)}function Wg(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,values:N(e,"values")?e.values.map(Hg):void 0}}function zg(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:Ue(e.providerMetadata,Hs),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,customAuth:e.customAuth,basicAuth:jl(e.basicAuth),oauth2ClientCredentials:Ll(e.oauth2ClientCredentials),oauth2PasswordCredentials:ql(e.oauth2PasswordCredentials),oauth2AuthorizationCode:Kl(e.oauth2AuthorizationCode)}}function Qg(e){return Gg(e)}function Gg(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function Xg(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 Vo(e){return Yg(e)}function Yg(e,t){return e==null?e:{...Xg(e),...Ul(e)}}function Zg(e){return ey(e)}function ey(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(Vo):void 0,optionalFields:N(e,"optionalFields")?e.optionalFields.map(Vo):void 0,optionalFieldsAuto:N(e,"optionalFieldsAuto")?Vl(e.optionalFieldsAuto):void 0,allFieldsMetadata:N(e,"allFieldsMetadata")?Ue(e.allFieldsMetadata,Jg):void 0,allFields:N(e,"allFields")?e.allFields.map(Vo):void 0,backfill:N(e,"backfill")?Al(e.backfill):void 0}}function ty(e){return ny(e)}function ny(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(Zg):void 0}}function ry(e){return iy(e)}function iy(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:N(e,"valueDefaults")?$l(e.valueDefaults):void 0}}function oy(e){return sy(e)}function sy(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(ry):void 0}}function ay(e){return cy(e)}function cy(e,t){return e==null?e:{name:e.name,displayName:N(e,"displayName")?e.displayName:void 0,provider:e.provider,read:N(e,"read")?ty(e.read):void 0,write:N(e,"write")?oy(e.write):void 0,proxy:N(e,"proxy")?Qg(e.proxy):void 0}}function ly(e){return uy(e)}function uy(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:ay(e.content)}}function $i(e){return dy(e)}function dy(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:N(e,"group")?kl(e.group):void 0,healthStatus:e.healthStatus,connection:si(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0,config:bm(e.config)}}function fy(e){return py(e)}function py(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Ng(e.content)}}function ic(e){return hy(e)}function hy(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:fy(e.latestRevision)}}function my(e){return gy(e)}function gy(e,t){return e==null?e:{iconURL:N(e,"iconURL")?e.iconURL:void 0,logoURL:N(e,"logoURL")?e.logoURL:void 0}}function yy(e){return vy(e)}function vy(e,t){return e==null?e:{iconURL:N(e,"iconURL")?e.iconURL:void 0,logoURL:N(e,"logoURL")?e.logoURL:void 0}}function wy(e){return by(e)}function by(e,t){return e==null?e:{regular:N(e,"regular")?yy(e.regular):void 0,darkMode:N(e,"darkMode")?my(e.darkMode):void 0}}function Iy(e){return Cy(e)}function Cy(e,t){return e==null?e:{name:e.name,displayName:N(e,"displayName")?e.displayName: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 xy(e){return Oy(e)}function Oy(e,t){return e==null?e:{name:e.name,moduleDependencies:N(e,"moduleDependencies")?e.moduleDependencies:void 0}}function _y(e){return Sy(e)}function Sy(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 Hl(e){return Ey(e)}function Ey(e,t){return e==null?e:{bulkWrite:Xh(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write,subscribeSupport:N(e,"subscribeSupport")?_y(e.subscribeSupport):void 0}}function Ny(e){return Ty(e)}function Ty(e,t){return e==null?e:{displayName:e.displayName,baseURL:e.baseURL,support:Hl(e.support)}}function Ry(e){return Ay(e)}function Ay(e,t){return e==null?e:{name:e.name,displayName:e.displayName,path:e.path,capture:N(e,"capture")?e.capture:void 0}}function Fy(e){return Py(e)}function Py(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(Ry):void 0}}const $o={AuthorizationCode:"authorizationCode",AuthorizationCodePkce:"authorizationCodePKCE",ClientCredentials:"clientCredentials",Password:"password"};function Dy(e){return My(e)}function My(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,tokenMetadataFields:Fy(e.tokenMetadataFields),docsURL:N(e,"docsURL")?e.docsURL:void 0,authURLParams:N(e,"authURLParams")?e.authURLParams:void 0}}function ky(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:Ue(e.providerMetadata,Hs),projectId:e.projectId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerAppId:e.providerAppId,provider:e.provider,enableCSRFProtection:e.enableCSRFProtection}}function jy(e){return Ly(e)}function Ly(e,t){return e==null?e:{input:N(e,"input")?e.input.map(Iy):void 0,postAuthentication:N(e,"postAuthentication")?e.postAuthentication.map(xy):void 0}}function qy(e){return Ky(e)}function Ky(e,t){return e==null?e:{subscriptionScope:e.subscriptionScope,targetURLScope:e.targetURLScope,registrationTiming:e.registrationTiming}}function oc(e){return Uy(e)}function Uy(e,t){return e==null?e:{name:e.name,authType:Gp(e.authType),baseURL:e.baseURL,defaultModule:e.defaultModule,oauth2Opts:N(e,"oauth2Opts")?Dy(e.oauth2Opts):void 0,apiKeyOpts:N(e,"apiKeyOpts")?$p(e.apiKeyOpts):void 0,basicOpts:N(e,"basicOpts")?$h(e.basicOpts):void 0,customOpts:N(e,"customOpts")?Vg(e.customOpts):void 0,support:Hl(e.support),providerOpts:e.providerOpts,authHealthCheck:N(e,"authHealthCheck")?zp(e.authHealthCheck):void 0,displayName:N(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:N(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:N(e,"media")?wy(e.media):void 0,labels:N(e,"labels")?e.labels:void 0,subscribeOpts:N(e,"subscribeOpts")?qy(e.subscribeOpts):void 0,modules:N(e,"modules")?Ue(e.modules,Ny):void 0,metadata:N(e,"metadata")?jy(e.metadata):void 0}}function Vy(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,connection:jm(e.connection)}}function $y(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:ph(e.read),write:Ph(e.write),proxy:Pl(e.proxy)}}function Hy(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:$y(e.content)}}function By(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:Hy(e.config)}}function Jy(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:By(e.installation)}}function Wy(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function zy(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:Wy(e.project)}}function Qy(e){if(e!==void 0)return e===null?null:{externalRef:e.externalRef,provider:e.provider,clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function Gy(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:Qy(e.providerApp)}}class Xy extends rn{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling deleteConnection.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"DELETE",headers:o,query:r},n);return new jr(i)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:zg(t.generateConnectionParams)},n);return new Le(i,s=>si(s))}async generateConnection(t,n){return await(await this.generateConnectionRaw(t,n)).value()}async getConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const r={};t.includeCreds!==void 0&&(r.includeCreds=t.includeCreds),t.includeRefreshToken!==void 0&&(r.includeRefreshToken=t.includeRefreshToken),t.refresh!==void 0&&(r.refresh=t.refresh);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"GET",headers:o,query:r},n);return new Le(i,s=>si(s))}async getConnection(t,n){return await(await this.getConnectionRaw(t,n)).value()}async listConnectionsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const r={};t.provider!==void 0&&(r.provider=t.provider),t.groupRef!==void 0&&(r.groupRef=t.groupRef),t.consumerRef!==void 0&&(r.consumerRef=t.consumerRef);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Le(i,s=>s.map(si))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}async updateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling updateConnection.");if(t.updateConnectionRequest===null||t.updateConnectionRequest===void 0)throw new ie("updateConnectionRequest","Required parameter requestParameters.updateConnectionRequest was null or undefined when calling updateConnection.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:o,query:r,body:Vy(t.updateConnectionRequest)},n);return new Le(i,s=>si(s))}async updateConnection(t,n){return await(await this.updateConnectionRaw(t,n)).value()}}class Yy extends rn{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new ie("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:r,body:Vm(t.installation)},n);return new Le(i,s=>$i(s))}async createInstallation(t,n){return await(await this.createInstallationRaw(t,n)).value()}async deleteInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=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:o,query:r},n);return new jr(i)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=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:o,query:r},n);return new Le(i,s=>$i(s))}async getInstallation(t,n){return await(await this.getInstallationRaw(t,n)).value()}async listInstallationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"GET",headers:o,query:r},n);return new Le(i,s=>s.map($i))}async listInstallations(t,n){return await(await this.listInstallationsRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new ie("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=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:o,query:r,body:Jy(t.installationUpdate)},n);return new Le(i,s=>$i(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class Zy extends rn{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");if(t.batchUpsertIntegrationsRequest===null||t.batchUpsertIntegrationsRequest===void 0)throw new ie("batchUpsertIntegrationsRequest","Required parameter requestParameters.batchUpsertIntegrationsRequest was null or undefined when calling batchUpsertIntegrations.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:o,query:r,body:Bh(t.batchUpsertIntegrationsRequest)},n);return new Le(i,s=>s.map(ic))}async batchUpsertIntegrations(t,n){return await(await this.batchUpsertIntegrationsRaw(t,n)).value()}async createIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new ie("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:Fg(t.integration)},n);return new jr(i)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"DELETE",headers:o,query:r},n);return new jr(i)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Le(i,s=>s.map(ic))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class ev extends rn{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new ie("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/oauth-connect",method:"POST",headers:o,query:r,body:ky(t.connectOAuthParams)},n);return this.isJsonMime(i.headers.get("content-type"))?new Le(i):new ec(i)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}async oauthUpdateRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling oauthUpdate.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling oauthUpdate.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=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:o,query:r},n);return this.isJsonMime(i.headers.get("content-type"))?new Le(i):new ec(i)}async oauthUpdate(t,n){return await(await this.oauthUpdateRaw(t,n)).value()}}class tv extends rn{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new ie("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects",method:"POST",headers:o,query:r,body:Pg(t.project)},n);return new Le(i,s=>Vi(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={};t.includeEntitlements!==void 0&&(r.includeEntitlements=t.includeEntitlements);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Le(i,s=>Vi(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects",method:"GET",headers:r,query:n},t);return new Le(o,i=>i.map(Vi))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new ie("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:o,query:r,body:zy(t.projectUpdate)},n);return new Le(i,s=>Vi(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class nv extends rn{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new ie("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:o,query:r},n);return new Le(i,s=>oc(s))}async getProvider(t,n){return await(await this.getProviderRaw(t,n)).value()}async listProvidersRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/providers",method:"GET",headers:r,query:n},t);return new Le(o,i=>Ue(i,oc))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class rv extends rn{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new ie("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:Dg(t.providerApp)},n);return new Le(i,s=>Yi(s))}async createProviderApp(t,n){return await(await this.createProviderAppRaw(t,n)).value()}async deleteProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ie("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"DELETE",headers:o,query:r},n);return new jr(i)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Le(i,s=>s.map(Yi))}async listProviderApps(t,n){return await(await this.listProviderAppsRaw(t,n)).value()}async updateProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ie("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new ie("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"PATCH",headers:o,query:r,body:Gy(t.providerAppUpdate)},n);return new Le(i,s=>Yi(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class iv extends rn{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");if(t.revision===null||t.revision===void 0)throw new ie("revision","Required parameter requestParameters.revision was null or undefined when calling createRevision.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:r,body:Mg(t.revision)},n);return new jr(i)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new ie("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=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:o,query:r},n);return new Le(i,s=>ly(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class Bl{constructor(t){this.connectionApi=new Xy(t),this.installationApi=new Yy(t),this.integrationApi=new Zy(t),this.oAuthApi=new ev(t),this.projectApi=new tv(t),this.providerApi=new nv(t),this.providerAppApi=new rv(t),this.revisionApi=new iv(t)}}const Jl="2.8.5",ov="v1",Hi="https://api.withampersand.com";function Wl(){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 Hi;case"mock":return"http://127.0.0.1:4010";case"":return Hi;default:return e??Hi}}catch{return Hi}}const sv=(e,t)=>`${e}/${t}`;function av(){return sv(Wl(),ov)}const zl=Wl(),Ql=av(),cv=new $s({basePath:Ql,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Jl}});let lv=new Bl(cv);const Bs=()=>lv;function ot(){const e=Sl();return b.useCallback(async()=>{e||console.error("Unable to create API service without API key.");const n=new $s({basePath:Ql,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Jl,"X-Api-Key":e}});return new Bl(n)},[e])}const uv=e=>{const t=ot();return Wn({queryKey:["project",e],queryFn:async()=>(await t()).projectApi.getProject({projectIdOrName:e})})},Gl=b.createContext({project:null,appName:"",projectId:"",projectIdOrName:"",isLoading:!0}),Ee=()=>{const e=b.useContext(Gl);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e};function dv({projectIdOrName:e,children:t}){const{setError:n}=Mt(),{data:r,isLoading:o,isError:i}=uv(e);b.useEffect(()=>{i&&n(ue.PROJECT,e)},[i,e,n]);const s=b.useMemo(()=>({projectId:(r==null?void 0:r.id)||"",projectIdOrName:e,project:r||null,appName:(r==null?void 0:r.appName)||"",isLoading:o}),[e,r,o]);return c.jsx(Gl.Provider,{value:s,children:t})}function Xl(){const e=ot(),{projectIdOrName:t}=Ee();return Wn({queryKey:["amp","integrations",t],queryFn:async()=>{if(!t)throw new Error("Project ID or name is required");return(await e()).integrationApi.listIntegrations({projectIdOrName:t})},enabled:!!t})}const Me=async(e,t)=>{var n;if(e instanceof Nl){const{status:r,statusText:o}=e.response;console.error(r===500?"Internal Server Error (500):":r===400?"Bad Request (400):":`Error (${r}):`,o);try{const s=await e.response.clone().json(),a=((n=s==null?void 0:s.causes)==null?void 0:n.join(`
2
+ `))||(s==null?void 0:s.detail);a?(console.error("[Error Message]",a),s!=null&&s.remedy&&console.error("[Remedy]",s.remedy)):console.error("Unexpected error response:",s);const l=`${a} ${s!=null&&s.remedy?`
3
3
 
4
- [Remedy] ${s.remedy}`:""}`;t&&t(c)}catch(i){console.error("Error parsing error response body:",i)}}else console.error("Unexpected error:",e.message)},Gl=b.createContext({integrations:null,isLoading:!0}),Js=()=>{const e=b.useContext(Gl);if(!e)throw new Error("useIntegrationList must be used within a IntegrationListProvider");return e};function uv({children:e}){const{projectIdOrName:t}=Ee(),{setError:n,removeError:r}=Mt(),{data:o,isLoading:i,isError:s}=Ql();b.useEffect(()=>{s?(Me(s),n(ue.INTEGRATION_LIST,t)):r(ue.INTEGRATION_LIST,t)},[s,t,r,n]);const a=b.useMemo(()=>({integrations:o||null,isLoading:i}),[o,i]);return l.jsx(Gl.Provider,{value:a,children:e})}const dv=new up;function fv(e){const{options:{apiKey:t,projectId:n,project:r},children:o}=e,i=r||n;if(n&&r)throw new Error("Use AmpersandProvider either with projectId or project but not both.");if(!i)throw new Error("Cannot use AmpersandProvider without a projectId or name.");if(!t)throw new Error("Cannot use AmpersandProvider without an apiKey.");return l.jsx(mp,{client:dv,children:l.jsx(Tp,{children:l.jsx(Ep,{value:t,children:l.jsx(lv,{projectIdOrName:i,children:l.jsx(uv,{children:o})})})})})}const Xl=b.createContext(null);function pv(){const e=b.useContext(Xl);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
5
- component is wrapped with AmpersandProvider`);return e}const Ws=({groupRef:e,provider:t})=>{const{projectIdOrName:n}=Ee(),r=ot();return Wn({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})},Gr=e=>{const t=Ql(),n=t.data,r=n==null?void 0:n.find(o=>o.name===e||o.id===e);return{...t,data:r,provider:r==null?void 0:r.provider}};function hv(){return l.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.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"}),l.jsx("path",{d:"M24 18V26",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M24 34H24.02",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}const mv="_box_1p7c5_1",oc={box:mv};function Cn({children:e,className:t,style:n}){return l.jsx("div",{className:t?`${oc.box} ${t}`:oc.box,style:n,children:e})}const gv="_container_1wvzr_1",sc={container:gv};function Xr({children:e,className:t,style:n}){return l.jsx("div",{className:t?`${sc.container} ${t}`:sc.container,style:n,children:e})}const yv="_errorBoxContainer_4sdb2_1",vv="_errorBox_4sdb2_1",wv="_errorText_4sdb2_20",bs={errorBoxContainer:yv,errorBox:vv,errorText:wv};function Yl({message:e}){return l.jsx(Cn,{className:bs.errorBox,children:l.jsx("p",{className:bs.errorText,children:e})})}function Zl({message:e,children:t}){return l.jsxs(Xr,{className:bs.errorBoxContainer,children:[l.jsx(hv,{}),l.jsx(Yl,{message:e}),t]})}const bv="_loader_6ubm6_1",Iv="_rotate_6ubm6_1",Cv="_ball1_6ubm6_1",xv="_ball2_6ubm6_1",Ov={loader:bv,rotate:Iv,ball1:Cv,ball2:xv};function _v(){return l.jsx("span",{className:Ov.loader})}function fi(){return l.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:l.jsx(_v,{})})}function eu({children:e}){return l.jsx(Xr,{style:{maxWidth:"55rem"},children:l.jsx(Cn,{children:e})})}function Yr(){return l.jsx(eu,{children:l.jsx(fi,{})})}function Wt({message:e,children:t}){return l.jsx(eu,{children:l.jsx(Zl,{message:e,children:t})})}const zs=(e,t)=>{var s;const n=ot(),{projectIdOrName:r}=Ee(),{integrations:o}=Js(),i=(s=o==null?void 0:o.find(a=>a.name===e))==null?void 0:s.id;return Wn({queryKey:["amp","installations",r,i,t],queryFn:async()=>{if(!r)throw new Error("Project ID is required");if(!i)throw new Error("Integration ID is required");if(!t)throw new Error("Group reference is required");return(await n()).installationApi.listInstallations({projectIdOrName:r,integrationId:i,groupRef:t})},enabled:!!r&&!!i&&!!t&&!!o&&o.length>0})};function Qt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Sv(e,t){return(t==null?void 0:t.displayName)??Qt(e)}const Ev=e=>e.split(`
6
- `).filter(n=>n.trim()!==""),Nv=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,Tv=e=>e.replace(/[.:/\\]/g,"\\$&"),Rv=()=>{const[e,t]=b.useState(!1),n=b.useCallback(()=>{t(!0)},[t]),r=b.useCallback(()=>{t(!1)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n,resetIntegrationDeleted:r}},tu=b.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 Ze(){const e=b.useContext(tu);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function Av({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,fieldMapping:d,resetComponent:u}){const{integrations:f}=Js(),{setError:m,isError:g,removeError:v}=Mt(),{isIntegrationDeleted:y,setIntegrationDeleted:p,resetIntegrationDeleted:x}=Rv(),h=b.useMemo(()=>Nv(t,f||[]),[t,f]),{data:w,isLoading:I,isError:O,error:S}=zs(t,o),T=(w==null?void 0:w[0])||null;b.useEffect(()=>{x()},[t,n,r,o,i,d]),b.useEffect(()=>{h===null&&(f!=null&&f.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,h,f]),b.useEffect(()=>{O?(m(ue.INSTALLATION_LIST,(h==null?void 0:h.id)||""),Me(S)):v(ue.INSTALLATION_LIST,(h==null?void 0:h.id)||"")},[O,h,m,v,S]);const R=qe(),A=b.useCallback(()=>{R.invalidateQueries({queryKey:["amp","installations"]})},[R]),D=b.useCallback(L=>{R.setQueryData(["amp","installations"],[L]),R.invalidateQueries({queryKey:["amp","installations"]})},[R]),B=(h==null?void 0:h.id)||"",$=b.useMemo(()=>({integrationId:(h==null?void 0:h.id)||"",provider:(h==null?void 0:h.provider)||"",integrationObj:h,consumerRef:n,consumerName:r,groupRef:o,groupName:i,installation:T||void 0,setInstallation:D,resetInstallations:A,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,isIntegrationDeleted:y,setIntegrationDeleted:p,fieldMapping:d,resetComponent:u}),[h,n,r,o,i,T,D,A,s,a,c,y,p,d,u]);if(I)return l.jsx(Yr,{});if(h===null)return l.jsx(Wt,{message:`Integration "${t}" not found`});if(g(ue.INSTALLATION_LIST,B)){const L=`Error retrieving installation information for integration "${(h==null?void 0:h.name)||"unknown"}"`;return l.jsx(Wt,{message:L})}return l.jsx(tu.Provider,{value:$,children:e})}const nu=b.createContext({connections:null,isConnectionsLoading:!0,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),Yt=()=>{const e=b.useContext(nu);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function ru({groupRef:e,provider:t,children:n}){const r=qe(),{setError:o,isError:i}=Mt(),{projectId:s,isLoading:a}=Ee(),{integrationId:c,groupRef:d}=Ze(),{provider:u}=Gr(c),{data:f,isLoading:m,isError:g,error:v}=Ws({groupRef:e||d,provider:u||t}),y=f==null?void 0:f[0],p=b.useCallback(w=>{r.setQueryData(["amp","connections"],()=>w),r.invalidateQueries({queryKey:["amp","connections"]})},[r]),x=b.useCallback(()=>{r.invalidateQueries({queryKey:["amp","connections"]})},[r]);b.useEffect(()=>{g?(o(ue.CONNECTION_LIST,s,!0),Me(v)):o(ue.CONNECTION_LIST,s,!1)},[g,o,s,v]);const h=b.useMemo(()=>({connections:f||null,isConnectionsLoading:m,selectedConnection:y||null,setConnections:p,setSelectedConnection:x}),[f,m,y,p,x]);if(m||a)return l.jsx(Yr,{});if(i(ue.PROJECT,s))return l.jsx(Wt,{message:`Error loading project ${s}`});if(i(ue.CONNECTION_LIST,s))return l.jsx(Wt,{message:"Error retrieving existing connections"});if(!s)throw new Error("Project ID not found. ConnectionsProvider must be used within AmpersandProvider");return l.jsx(nu.Provider,{value:h,children:n})}function iu(){const[e,t]=b.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}var Ji=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Qs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var so={exports:{}};so.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",o=1,i=2,s=9007199254740991,a="[object Arguments]",c="[object Array]",d="[object AsyncFunction]",u="[object Boolean]",f="[object Date]",m="[object Error]",g="[object Function]",v="[object GeneratorFunction]",y="[object Map]",p="[object Number]",x="[object Null]",h="[object Object]",w="[object Promise]",I="[object Proxy]",O="[object RegExp]",S="[object Set]",T="[object String]",R="[object Symbol]",A="[object Undefined]",D="[object WeakMap]",B="[object ArrayBuffer]",$="[object DataView]",L="[object Float32Array]",J="[object Float64Array]",ae="[object Int8Array]",re="[object Int16Array]",ne="[object Int32Array]",ge="[object Uint8Array]",be="[object Uint8ClampedArray]",F="[object Uint16Array]",q="[object Uint32Array]",H=/[\\^$.*+?()[\]{}|]/g,U=/^\[object .+?Constructor\]$/,K=/^(?:0|[1-9]\d*)$/,M={};M[L]=M[J]=M[ae]=M[re]=M[ne]=M[ge]=M[be]=M[F]=M[q]=!0,M[a]=M[c]=M[B]=M[u]=M[$]=M[f]=M[m]=M[g]=M[y]=M[p]=M[h]=M[O]=M[S]=M[T]=M[D]=!1;var Z=typeof Ji=="object"&&Ji&&Ji.Object===Object&&Ji,ee=typeof self=="object"&&self&&self.Object===Object&&self,W=Z||ee||Function("return this")(),te=t&&!t.nodeType&&t,X=te&&!0&&e&&!e.nodeType&&e,de=X&&X.exports===te,j=de&&Z.process,we=function(){try{return j&&j.binding&&j.binding("util")}catch{}}(),z=we&&we.isTypedArray;function Ne(C,E){for(var P=-1,Y=C==null?0:C.length,Re=0,fe=[];++P<Y;){var ke=C[P];E(ke,P,C)&&(fe[Re++]=ke)}return fe}function Ve(C,E){for(var P=-1,Y=E.length,Re=C.length;++P<Y;)C[Re+P]=E[P];return C}function et(C,E){for(var P=-1,Y=C==null?0:C.length;++P<Y;)if(E(C[P],P,C))return!0;return!1}function He(C,E){for(var P=-1,Y=Array(C);++P<C;)Y[P]=E(P);return Y}function Ie(C){return function(E){return C(E)}}function kt(C,E){return C.has(E)}function tt(C,E){return C==null?void 0:C[E]}function It(C){var E=-1,P=Array(C.size);return C.forEach(function(Y,Re){P[++E]=[Re,Y]}),P}function jt(C,E){return function(P){return C(E(P))}}function Lt(C){var E=-1,P=Array(C.size);return C.forEach(function(Y){P[++E]=Y}),P}var nt=Array.prototype,Ge=Function.prototype,Be=Object.prototype,Fe=W["__core-js_shared__"],qt=Ge.toString,pt=Be.hasOwnProperty,ln=function(){var C=/[^.]+$/.exec(Fe&&Fe.keys&&Fe.keys.IE_PROTO||"");return C?"Symbol(src)_1."+C:""}(),en=Be.toString,Ct=RegExp("^"+qt.call(pt).replace(H,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Pe=de?W.Buffer:void 0,un=W.Symbol,On=W.Uint8Array,dn=Be.propertyIsEnumerable,Gn=nt.splice,ht=un?un.toStringTag:void 0,fn=Object.getOwnPropertySymbols,_n=Pe?Pe.isBuffer:void 0,Xn=jt(Object.keys,Object),Sn=br(W,"DataView"),Ae=br(W,"Map"),st=br(W,"Promise"),oe=br(W,"Set"),me=br(W,"WeakMap"),Je=br(Object,"create"),pn=Zn(Sn),Q=Zn(Ae),ce=Zn(st),le=Zn(oe),Ke=Zn(me),We=un?un.prototype:void 0,mt=We?We.valueOf:void 0;function Xe(C){var E=-1,P=C==null?0:C.length;for(this.clear();++E<P;){var Y=C[E];this.set(Y[0],Y[1])}}function rt(){this.__data__=Je?Je(null):{},this.size=0}function gt(C){var E=this.has(C)&&delete this.__data__[C];return this.size-=E?1:0,E}function Te(C){var E=this.__data__;if(Je){var P=E[C];return P===r?void 0:P}return pt.call(E,C)?E[C]:void 0}function En(C){var E=this.__data__;return Je?E[C]!==void 0:pt.call(E,C)}function jo(C,E){var P=this.__data__;return this.size+=this.has(C)?0:1,P[C]=Je&&E===void 0?r:E,this}Xe.prototype.clear=rt,Xe.prototype.delete=gt,Xe.prototype.get=Te,Xe.prototype.has=En,Xe.prototype.set=jo;function Kt(C){var E=-1,P=C==null?0:C.length;for(this.clear();++E<P;){var Y=C[E];this.set(Y[0],Y[1])}}function Ri(){this.__data__=[],this.size=0}function Ai(C){var E=this.__data__,P=ki(E,C);if(P<0)return!1;var Y=E.length-1;return P==Y?E.pop():Gn.call(E,P,1),--this.size,!0}function Fi(C){var E=this.__data__,P=ki(E,C);return P<0?void 0:E[P][1]}function Pi(C){return ki(this.__data__,C)>-1}function Di(C,E){var P=this.__data__,Y=ki(P,C);return Y<0?(++this.size,P.push([C,E])):P[Y][1]=E,this}Kt.prototype.clear=Ri,Kt.prototype.delete=Ai,Kt.prototype.get=Fi,Kt.prototype.has=Pi,Kt.prototype.set=Di;function ye(C){var E=-1,P=C==null?0:C.length;for(this.clear();++E<P;){var Y=C[E];this.set(Y[0],Y[1])}}function Ut(){this.size=0,this.__data__={hash:new Xe,map:new(Ae||Kt),string:new Xe}}function ni(C){var E=ji(this,C).delete(C);return this.size-=E?1:0,E}function Yn(C){return ji(this,C).get(C)}function Lo(C){return ji(this,C).has(C)}function ri(C,E){var P=ji(this,C),Y=P.size;return P.set(C,E),this.size+=P.size==Y?0:1,this}ye.prototype.clear=Ut,ye.prototype.delete=ni,ye.prototype.get=Yn,ye.prototype.has=Lo,ye.prototype.set=ri;function Mi(C){var E=-1,P=C==null?0:C.length;for(this.__data__=new ye;++E<P;)this.add(C[E])}function bf(C){return this.__data__.set(C,r),this}function If(C){return this.__data__.has(C)}Mi.prototype.add=Mi.prototype.push=bf,Mi.prototype.has=If;function Nn(C){var E=this.__data__=new Kt(C);this.size=E.size}function Cf(){this.__data__=new Kt,this.size=0}function xf(C){var E=this.__data__,P=E.delete(C);return this.size=E.size,P}function Of(C){return this.__data__.get(C)}function _f(C){return this.__data__.has(C)}function Sf(C,E){var P=this.__data__;if(P instanceof Kt){var Y=P.__data__;if(!Ae||Y.length<n-1)return Y.push([C,E]),this.size=++P.size,this;P=this.__data__=new ye(Y)}return P.set(C,E),this.size=P.size,this}Nn.prototype.clear=Cf,Nn.prototype.delete=xf,Nn.prototype.get=Of,Nn.prototype.has=_f,Nn.prototype.set=Sf;function Ef(C,E){var P=Li(C),Y=!P&&Vf(C),Re=!P&&!Y&&qo(C),fe=!P&&!Y&&!Re&&Ua(C),ke=P||Y||Re||fe,Ye=ke?He(C.length,String):[],it=Ye.length;for(var De in C)pt.call(C,De)&&!(ke&&(De=="length"||Re&&(De=="offset"||De=="parent")||fe&&(De=="buffer"||De=="byteLength"||De=="byteOffset")||jf(De,it)))&&Ye.push(De);return Ye}function ki(C,E){for(var P=C.length;P--;)if(ja(C[P][0],E))return P;return-1}function Nf(C,E,P){var Y=E(C);return Li(C)?Y:Ve(Y,P(C))}function ii(C){return C==null?C===void 0?A:x:ht&&ht in Object(C)?Mf(C):Uf(C)}function Pa(C){return oi(C)&&ii(C)==a}function Da(C,E,P,Y,Re){return C===E?!0:C==null||E==null||!oi(C)&&!oi(E)?C!==C&&E!==E:Tf(C,E,P,Y,Da,Re)}function Tf(C,E,P,Y,Re,fe){var ke=Li(C),Ye=Li(E),it=ke?c:Tn(C),De=Ye?c:Tn(E);it=it==a?h:it,De=De==a?h:De;var xt=it==h,Vt=De==h,at=it==De;if(at&&qo(C)){if(!qo(E))return!1;ke=!0,xt=!1}if(at&&!xt)return fe||(fe=new Nn),ke||Ua(C)?Ma(C,E,P,Y,Re,fe):Pf(C,E,it,P,Y,Re,fe);if(!(P&o)){var Tt=xt&&pt.call(C,"__wrapped__"),Rt=Vt&&pt.call(E,"__wrapped__");if(Tt||Rt){var Rn=Tt?C.value():C,hn=Rt?E.value():E;return fe||(fe=new Nn),Re(Rn,hn,P,Y,fe)}}return at?(fe||(fe=new Nn),Df(C,E,P,Y,Re,fe)):!1}function Rf(C){if(!Ka(C)||qf(C))return!1;var E=La(C)?Ct:U;return E.test(Zn(C))}function Af(C){return oi(C)&&qa(C.length)&&!!M[ii(C)]}function Ff(C){if(!Kf(C))return Xn(C);var E=[];for(var P in Object(C))pt.call(C,P)&&P!="constructor"&&E.push(P);return E}function Ma(C,E,P,Y,Re,fe){var ke=P&o,Ye=C.length,it=E.length;if(Ye!=it&&!(ke&&it>Ye))return!1;var De=fe.get(C);if(De&&fe.get(E))return De==E;var xt=-1,Vt=!0,at=P&i?new Mi:void 0;for(fe.set(C,E),fe.set(E,C);++xt<Ye;){var Tt=C[xt],Rt=E[xt];if(Y)var Rn=ke?Y(Rt,Tt,xt,E,C,fe):Y(Tt,Rt,xt,C,E,fe);if(Rn!==void 0){if(Rn)continue;Vt=!1;break}if(at){if(!et(E,function(hn,er){if(!kt(at,er)&&(Tt===hn||Re(Tt,hn,P,Y,fe)))return at.push(er)})){Vt=!1;break}}else if(!(Tt===Rt||Re(Tt,Rt,P,Y,fe))){Vt=!1;break}}return fe.delete(C),fe.delete(E),Vt}function Pf(C,E,P,Y,Re,fe,ke){switch(P){case $:if(C.byteLength!=E.byteLength||C.byteOffset!=E.byteOffset)return!1;C=C.buffer,E=E.buffer;case B:return!(C.byteLength!=E.byteLength||!fe(new On(C),new On(E)));case u:case f:case p:return ja(+C,+E);case m:return C.name==E.name&&C.message==E.message;case O:case T:return C==E+"";case y:var Ye=It;case S:var it=Y&o;if(Ye||(Ye=Lt),C.size!=E.size&&!it)return!1;var De=ke.get(C);if(De)return De==E;Y|=i,ke.set(C,E);var xt=Ma(Ye(C),Ye(E),Y,Re,fe,ke);return ke.delete(C),xt;case R:if(mt)return mt.call(C)==mt.call(E)}return!1}function Df(C,E,P,Y,Re,fe){var ke=P&o,Ye=ka(C),it=Ye.length,De=ka(E),xt=De.length;if(it!=xt&&!ke)return!1;for(var Vt=it;Vt--;){var at=Ye[Vt];if(!(ke?at in E:pt.call(E,at)))return!1}var Tt=fe.get(C);if(Tt&&fe.get(E))return Tt==E;var Rt=!0;fe.set(C,E),fe.set(E,C);for(var Rn=ke;++Vt<it;){at=Ye[Vt];var hn=C[at],er=E[at];if(Y)var Va=ke?Y(er,hn,at,E,C,fe):Y(hn,er,at,C,E,fe);if(!(Va===void 0?hn===er||Re(hn,er,P,Y,fe):Va)){Rt=!1;break}Rn||(Rn=at=="constructor")}if(Rt&&!Rn){var qi=C.constructor,Ki=E.constructor;qi!=Ki&&"constructor"in C&&"constructor"in E&&!(typeof qi=="function"&&qi instanceof qi&&typeof Ki=="function"&&Ki instanceof Ki)&&(Rt=!1)}return fe.delete(C),fe.delete(E),Rt}function ka(C){return Nf(C,Bf,kf)}function ji(C,E){var P=C.__data__;return Lf(E)?P[typeof E=="string"?"string":"hash"]:P.map}function br(C,E){var P=tt(C,E);return Rf(P)?P:void 0}function Mf(C){var E=pt.call(C,ht),P=C[ht];try{C[ht]=void 0;var Y=!0}catch{}var Re=en.call(C);return Y&&(E?C[ht]=P:delete C[ht]),Re}var kf=fn?function(C){return C==null?[]:(C=Object(C),Ne(fn(C),function(E){return dn.call(C,E)}))}:Jf,Tn=ii;(Sn&&Tn(new Sn(new ArrayBuffer(1)))!=$||Ae&&Tn(new Ae)!=y||st&&Tn(st.resolve())!=w||oe&&Tn(new oe)!=S||me&&Tn(new me)!=D)&&(Tn=function(C){var E=ii(C),P=E==h?C.constructor:void 0,Y=P?Zn(P):"";if(Y)switch(Y){case pn:return $;case Q:return y;case ce:return w;case le:return S;case Ke:return D}return E});function jf(C,E){return E=E??s,!!E&&(typeof C=="number"||K.test(C))&&C>-1&&C%1==0&&C<E}function Lf(C){var E=typeof C;return E=="string"||E=="number"||E=="symbol"||E=="boolean"?C!=="__proto__":C===null}function qf(C){return!!ln&&ln in C}function Kf(C){var E=C&&C.constructor,P=typeof E=="function"&&E.prototype||Be;return C===P}function Uf(C){return en.call(C)}function Zn(C){if(C!=null){try{return qt.call(C)}catch{}try{return C+""}catch{}}return""}function ja(C,E){return C===E||C!==C&&E!==E}var Vf=Pa(function(){return arguments}())?Pa:function(C){return oi(C)&&pt.call(C,"callee")&&!dn.call(C,"callee")},Li=Array.isArray;function $f(C){return C!=null&&qa(C.length)&&!La(C)}var qo=_n||Wf;function Hf(C,E){return Da(C,E)}function La(C){if(!Ka(C))return!1;var E=ii(C);return E==g||E==v||E==d||E==I}function qa(C){return typeof C=="number"&&C>-1&&C%1==0&&C<=s}function Ka(C){var E=typeof C;return C!=null&&(E=="object"||E=="function")}function oi(C){return C!=null&&typeof C=="object"}var Ua=z?Ie(z):Af;function Bf(C){return $f(C)?Ef(C):Ff(C)}function Jf(){return[]}function Wf(){return!1}e.exports=Hf})(so,so.exports);var Fv=so.exports;const ou=Qs(Fv),mr="other",ao="manage-tab";function bn(e){return!e.fieldName}function Pv(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function Dv(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!bn(n)&&!!n.fieldName))||null}function Mv(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>bn(r)&&!!r.mapToName))||[]}function kv(e){var n;return((n=e==null?void 0:e.optionalFields)==null?void 0:n.filter(r=>bn(r)&&!!r.mapToName))||[]}function jv(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!bn(n)&&!!n.fieldName))||null}const su=(e,t)=>{var n,r,o;return(o=(r=(n=e==null?void 0:e.content)==null?void 0:n.read)==null?void 0:r.objects)==null?void 0:o[t]};function Lv(e){return bn(e)?e.mapToName:e.fieldName}const au=(e,t)=>{var r,o,i;const n=[];return(i=(o=(r=t.content)==null?void 0:r.read)==null?void 0:o.objects)==null||i.forEach(s=>{n.push({name:s==null?void 0:s.objectName,displayName:(s==null?void 0:s.mapToDisplayName)||(s==null?void 0:s.displayName)||(s==null?void 0:s.objectName)&&Qt(s==null?void 0:s.objectName),completed:e?!!su(e,s.objectName):!1})}),n},cu=e=>{var n;return{name:mr,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function qv(e,t){var i;const n=au(e,t),o=!!((i=t==null?void 0:t.content)!=null&&i.write)?cu(e):void 0;return o&&n.push(o),n}function lu(e,t,n){const r=(e==null?void 0:e.filter(i=>!(t!=null&&t[i==null?void 0:i.mapToName])))||[],o=r.map(i=>i.mapToName);return n(ue.MAPPING,o),r!=null&&r.length&&console.error("required fields not met",r.map(i=>i.mapToDisplayName)),{errorList:o}}function Kv(e,t){return ou(e,t)}function uu(e,t){return ou(e,t)}const Uv=(e,t,n)=>{var p,x,h,w,I,O,S,T,R;if(!e)return null;const r=Pv(e,t),o=r&&Dv(r),i=r&&jv(r),s=r&&Mv(r),a=r&&kv(r),c=(r==null?void 0:r.allFields)||[],d=(r==null?void 0:r.allFieldsMetadata)||{},u=n==null?void 0:n.content,f=((h=(x=(p=u==null?void 0:u.read)==null?void 0:p.objects)==null?void 0:x[t])==null?void 0:h.selectedFields)||{},m=((O=(I=(w=u==null?void 0:u.read)==null?void 0:w.objects)==null?void 0:I[t])==null?void 0:O.selectedValueMappings)||{},g=((R=(T=(S=u==null?void 0:u.read)==null?void 0:S.objects)==null?void 0:T[t])==null?void 0:R.selectedFieldMappings)||{},v=Object.entries(f).reduce((A,[D,B])=>((i==null?void 0:i.some(L=>!bn(L)&&"fieldName"in L&&L.fieldName===D))&&(A[D]=B),A),{}),y={...g};return{allFields:c,allFieldsMetadata:d,requiredFields:o,optionalFields:i,requiredMapFields:s,optionalMapFields:a,selectedOptionalFields:v,selectedFieldMappings:g,selectedValueMappings:m,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,isValueMappingsModified:!1,savedConfig:{optionalFields:v,requiredMapFields:y,selectedValueMappings:m}}},Vv=(e,t)=>{var r,o;if(!e)return null;const n=(o=(r=t==null?void 0:t.content)==null?void 0:r.write)==null?void 0:o.objects;return{writeObjects:(e==null?void 0:e.objects)||[],selectedWriteObjects:n||{},isWriteModified:!1,savedConfig:{selectedWriteObjects:n||{}}}};function du(e,t,n){var i,s;const r=(i=e==null?void 0:e.content)==null?void 0:i.read,o=(s=e==null?void 0:e.content)==null?void 0:s.write;return{read:Uv(r,t,n),write:Vv(o,n)}}const fu=(e,t,n,r)=>{const o=du(e,n,t);r(n,o)},$v=(e,t,n)=>{const r=qv(t,e),o={};r.forEach(({name:i,completed:s})=>{s&&(o[i]=du(e,i,t))}),n(o)},pu=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(i=>r.add(Lv(i))),{...Array.from(r).reduce((i,s)=>({...i,[s]:!0}),{}),...n||{}}},hu=e=>{const{selectedFieldMappings:t}=(e==null?void 0:e.read)||{},n={};return t&&Object.keys(t).forEach(r=>{t[r]!==void 0?n[r]=t[r]||"":console.warn(`Error undefined when generating selectedRequiredMapFieldsSubmit for key: ${r}`)}),n},mu=e=>{const{selectedValueMappings:t}=(e==null?void 0:e.read)||{};return t};function gu(e,t){return t[e]||void 0}async function yu({createConfig:e,projectId:t,integrationId:n,groupRef:r,connectionId:o,apiKey:i,setError:s,setInstallation:a,onInstallSuccess:c}){const d={projectIdOrName:t,integrationId:n,installation:{groupRef:r,connectionId:o,config:e}};try{const u=await Bs().installationApi.createInstallation(d,{headers:{"X-Api-Key":i,"Content-Type":"application/json"}});a(u),c==null||c(u.id,u.config)}catch(u){Me(u,s)}}function Ci(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const Hv=(e,t)=>{const n=e.content.read,r=n==null?void 0:n.objects;return r==null?void 0:r.find(o=>o.objectName===t)},Bv=(e,t,n,r)=>{const o=pu(e),i=hu(e),s=mu(e),a=Hv(n,t);if(!a)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const c={revisionId:n.id,createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,schedule:a.schedule,destination:a.destination,selectedFields:o,selectedFieldMappings:i,selectedValueMappings:s||{},backfill:a.backfill}}}}};return Ci(n)&&(c.content.proxy={enabled:!0}),c},Jv=(e,t,n,r,o,i,s,a,c,d,u,f)=>{const m=Bv(c,i,a,r);return m?yu({createConfig:m,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:s,setError:d,setInstallation:u,onInstallSuccess:f}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},vu=e=>{var t;return{...(t=e.write)==null?void 0:t.selectedWriteObjects}},Wv=e=>{const t=e.content.write;return t==null?void 0:t.objects},zv=(e,t,n)=>{if(!Wv(t))return console.error("Error when getting write objects from hydratedRevision"),null;const o=vu(e),i={revisionId:t.id,createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:o}}};return Ci(t)&&(i.content.proxy={enabled:!0}),i},Qv=(e,t,n,r,o,i,s,a,c,d,u)=>{const f=zv(a,s,r);return f?yu({createConfig:f,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:i,setError:c,setInstallation:d,onInstallSuccess:u}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))};var wu={exports:{}};/*!
4
+ [Remedy] ${s.remedy}`:""}`;t&&t(l)}catch(i){console.error("Error parsing error response body:",i)}}else console.error("Unexpected error:",e.message)},Yl=b.createContext({integrations:null,isLoading:!0}),Js=()=>{const e=b.useContext(Yl);if(!e)throw new Error("useIntegrationList must be used within a IntegrationListProvider");return e};function fv({children:e}){const{projectIdOrName:t}=Ee(),{setError:n,removeError:r}=Mt(),{data:o,isLoading:i,isError:s}=Xl();b.useEffect(()=>{s?(Me(s),n(ue.INTEGRATION_LIST,t)):r(ue.INTEGRATION_LIST,t)},[s,t,r,n]);const a=b.useMemo(()=>({integrations:o||null,isLoading:i}),[o,i]);return c.jsx(Yl.Provider,{value:a,children:e})}const pv=new fp;function hv(e){const{options:{apiKey:t,projectId:n,project:r},children:o}=e,i=r||n;if(n&&r)throw new Error("Use AmpersandProvider either with projectId or project but not both.");if(!i)throw new Error("Cannot use AmpersandProvider without a projectId or name.");if(!t)throw new Error("Cannot use AmpersandProvider without an apiKey.");return c.jsx(yp,{client:pv,children:c.jsx(Ap,{children:c.jsx(Tp,{value:t,children:c.jsx(dv,{projectIdOrName:i,children:c.jsx(fv,{children:o})})})})})}const Zl=b.createContext(null);function mv(){const e=b.useContext(Zl);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
5
+ component is wrapped with AmpersandProvider`);return e}const Ws=({groupRef:e,provider:t})=>{const{projectIdOrName:n}=Ee(),r=ot();return Wn({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})},Qr=e=>{const t=Xl(),n=t.data,r=n==null?void 0:n.find(o=>o.name===e||o.id===e);return{...t,data:r,provider:r==null?void 0:r.provider}};function gv(){return c.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("path",{d:"M20.5796 7.72236L3.63955 36.0024C3.29029 36.6072 3.10549 37.293 3.10353 37.9914C3.10158 38.6898 3.28254 39.3766 3.62841 39.9834C3.97428 40.5902 4.473 41.0959 5.07497 41.4501C5.67693 41.8043 6.36115 41.9947 7.05955 42.0024H40.9396C41.638 41.9947 42.3222 41.8043 42.9241 41.4501C43.5261 41.0959 44.0248 40.5902 44.3707 39.9834C44.7166 39.3766 44.8975 38.6898 44.8956 37.9914C44.8936 37.293 44.7088 36.6072 44.3596 36.0024L27.4196 7.72236C27.063 7.13458 26.561 6.6486 25.9619 6.31133C25.3629 5.97406 24.687 5.79688 23.9996 5.79688C23.3121 5.79688 22.6362 5.97406 22.0372 6.31133C21.4381 6.6486 20.9361 7.13458 20.5796 7.72236Z",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M24 18V26",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M24 34H24.02",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}const yv="_box_1p7c5_1",sc={box:yv};function Cn({children:e,className:t,style:n}){return c.jsx("div",{className:t?`${sc.box} ${t}`:sc.box,style:n,children:e})}const vv="_container_1wvzr_1",ac={container:vv};function Gr({children:e,className:t,style:n}){return c.jsx("div",{className:t?`${ac.container} ${t}`:ac.container,style:n,children:e})}const wv="_errorBoxContainer_4sdb2_1",bv="_errorBox_4sdb2_1",Iv="_errorText_4sdb2_20",bs={errorBoxContainer:wv,errorBox:bv,errorText:Iv};function eu({message:e}){return c.jsx(Cn,{className:bs.errorBox,children:c.jsx("p",{className:bs.errorText,children:e})})}function tu({message:e,children:t}){return c.jsxs(Gr,{className:bs.errorBoxContainer,children:[c.jsx(gv,{}),c.jsx(eu,{message:e}),t]})}const Cv="_loader_6ubm6_1",xv="_rotate_6ubm6_1",Ov="_ball1_6ubm6_1",_v="_ball2_6ubm6_1",Sv={loader:Cv,rotate:xv,ball1:Ov,ball2:_v};function Ev(){return c.jsx("span",{className:Sv.loader})}function di(){return c.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:c.jsx(Ev,{})})}function nu({children:e}){return c.jsx(Gr,{style:{maxWidth:"55rem"},children:c.jsx(Cn,{children:e})})}function Xr(){return c.jsx(nu,{children:c.jsx(di,{})})}function Wt({message:e,children:t}){return c.jsx(nu,{children:c.jsx(tu,{message:e,children:t})})}const zs=(e,t)=>{var s;const n=ot(),{projectIdOrName:r}=Ee(),{integrations:o}=Js(),i=(s=o==null?void 0:o.find(a=>a.name===e))==null?void 0:s.id;return Wn({queryKey:["amp","installations",r,i,t],queryFn:async()=>{if(!r)throw new Error("Project ID is required");if(!i)throw new Error("Integration ID is required");if(!t)throw new Error("Group reference is required");return(await n()).installationApi.listInstallations({projectIdOrName:r,integrationId:i,groupRef:t})},enabled:!!r&&!!i&&!!t&&!!o&&o.length>0})};function on(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Nv(e,t){return(t==null?void 0:t.displayName)??on(e)}const Tv=e=>e.split(`
6
+ `).filter(n=>n.trim()!==""),Rv=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,Av=e=>e.replace(/[.:/\\]/g,"\\$&");function Fv(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 Pv=()=>{const[e,t]=b.useState(!1),n=b.useCallback(()=>{t(!0)},[t]),r=b.useCallback(()=>{t(!1)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n,resetIntegrationDeleted:r}},ru=b.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 Ze(){const e=b.useContext(ru);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function Dv({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:l,fieldMapping:d,resetComponent:u}){const{integrations:f}=Js(),{setError:m,isError:g,removeError:v}=Mt(),{isIntegrationDeleted:y,setIntegrationDeleted:p,resetIntegrationDeleted:x}=Pv(),h=b.useMemo(()=>Rv(t,f||[]),[t,f]),{data:w,isLoading:I,isError:O,error:S}=zs(t,o),T=(w==null?void 0:w[0])||null;b.useEffect(()=>{x()},[t,n,r,o,i,d]),b.useEffect(()=>{h===null&&(f!=null&&f.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,h,f]),b.useEffect(()=>{O?(m(ue.INSTALLATION_LIST,(h==null?void 0:h.id)||""),Me(S)):v(ue.INSTALLATION_LIST,(h==null?void 0:h.id)||"")},[O,h,m,v,S]);const R=qe(),A=b.useCallback(()=>{R.invalidateQueries({queryKey:["amp","installations"]})},[R]),D=b.useCallback(L=>{R.setQueryData(["amp","installations"],[L]),R.invalidateQueries({queryKey:["amp","installations"]})},[R]),B=(h==null?void 0:h.id)||"",$=b.useMemo(()=>({integrationId:(h==null?void 0:h.id)||"",provider:(h==null?void 0:h.provider)||"",integrationObj:h,consumerRef:n,consumerName:r,groupRef:o,groupName:i,installation:T||void 0,setInstallation:D,resetInstallations:A,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:l,isIntegrationDeleted:y,setIntegrationDeleted:p,fieldMapping:d,resetComponent:u}),[h,n,r,o,i,T,D,A,s,a,l,y,p,d,u]);if(I)return c.jsx(Xr,{});if(h===null)return c.jsx(Wt,{message:`Integration "${t}" not found`});if(g(ue.INSTALLATION_LIST,B)){const L=`Error retrieving installation information for integration "${(h==null?void 0:h.name)||"unknown"}"`;return c.jsx(Wt,{message:L})}return c.jsx(ru.Provider,{value:$,children:e})}const iu=b.createContext({connections:null,isConnectionsLoading:!0,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),Xt=()=>{const e=b.useContext(iu);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function ou({groupRef:e,provider:t,children:n}){const r=qe(),{setError:o,isError:i}=Mt(),{projectId:s,isLoading:a}=Ee(),{integrationId:l,groupRef:d}=Ze(),{provider:u}=Qr(l),{data:f,isLoading:m,isError:g,error:v}=Ws({groupRef:e||d,provider:u||t}),y=f==null?void 0:f[0],p=b.useCallback(w=>{r.setQueryData(["amp","connections"],()=>w),r.invalidateQueries({queryKey:["amp","connections"]})},[r]),x=b.useCallback(()=>{r.invalidateQueries({queryKey:["amp","connections"]})},[r]);b.useEffect(()=>{g?(o(ue.CONNECTION_LIST,s,!0),Me(v)):o(ue.CONNECTION_LIST,s,!1)},[g,o,s,v]);const h=b.useMemo(()=>({connections:f||null,isConnectionsLoading:m,selectedConnection:y||null,setConnections:p,setSelectedConnection:x}),[f,m,y,p,x]);if(m||a)return c.jsx(Xr,{});if(i(ue.PROJECT,s))return c.jsx(Wt,{message:`Error loading project ${s}`});if(i(ue.CONNECTION_LIST,s))return c.jsx(Wt,{message:"Error retrieving existing connections"});if(!s)throw new Error("Project ID not found. ConnectionsProvider must be used within AmpersandProvider");return c.jsx(iu.Provider,{value:h,children:n})}function su(){const[e,t]=b.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}var Bi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Qs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var oo={exports:{}};oo.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",o=1,i=2,s=9007199254740991,a="[object Arguments]",l="[object Array]",d="[object AsyncFunction]",u="[object Boolean]",f="[object Date]",m="[object Error]",g="[object Function]",v="[object GeneratorFunction]",y="[object Map]",p="[object Number]",x="[object Null]",h="[object Object]",w="[object Promise]",I="[object Proxy]",O="[object RegExp]",S="[object Set]",T="[object String]",R="[object Symbol]",A="[object Undefined]",D="[object WeakMap]",B="[object ArrayBuffer]",$="[object DataView]",L="[object Float32Array]",J="[object Float64Array]",ae="[object Int8Array]",re="[object Int16Array]",ne="[object Int32Array]",ge="[object Uint8Array]",be="[object Uint8ClampedArray]",F="[object Uint16Array]",q="[object Uint32Array]",H=/[\\^$.*+?()[\]{}|]/g,U=/^\[object .+?Constructor\]$/,K=/^(?:0|[1-9]\d*)$/,M={};M[L]=M[J]=M[ae]=M[re]=M[ne]=M[ge]=M[be]=M[F]=M[q]=!0,M[a]=M[l]=M[B]=M[u]=M[$]=M[f]=M[m]=M[g]=M[y]=M[p]=M[h]=M[O]=M[S]=M[T]=M[D]=!1;var Z=typeof Bi=="object"&&Bi&&Bi.Object===Object&&Bi,ee=typeof self=="object"&&self&&self.Object===Object&&self,W=Z||ee||Function("return this")(),te=t&&!t.nodeType&&t,X=te&&!0&&e&&!e.nodeType&&e,de=X&&X.exports===te,j=de&&Z.process,we=function(){try{return j&&j.binding&&j.binding("util")}catch{}}(),z=we&&we.isTypedArray;function Ne(C,E){for(var P=-1,Y=C==null?0:C.length,Re=0,fe=[];++P<Y;){var ke=C[P];E(ke,P,C)&&(fe[Re++]=ke)}return fe}function Ve(C,E){for(var P=-1,Y=E.length,Re=C.length;++P<Y;)C[Re+P]=E[P];return C}function et(C,E){for(var P=-1,Y=C==null?0:C.length;++P<Y;)if(E(C[P],P,C))return!0;return!1}function He(C,E){for(var P=-1,Y=Array(C);++P<C;)Y[P]=E(P);return Y}function Ie(C){return function(E){return C(E)}}function kt(C,E){return C.has(E)}function tt(C,E){return C==null?void 0:C[E]}function It(C){var E=-1,P=Array(C.size);return C.forEach(function(Y,Re){P[++E]=[Re,Y]}),P}function jt(C,E){return function(P){return C(E(P))}}function Lt(C){var E=-1,P=Array(C.size);return C.forEach(function(Y){P[++E]=Y}),P}var nt=Array.prototype,Ge=Function.prototype,Be=Object.prototype,Fe=W["__core-js_shared__"],qt=Ge.toString,pt=Be.hasOwnProperty,ln=function(){var C=/[^.]+$/.exec(Fe&&Fe.keys&&Fe.keys.IE_PROTO||"");return C?"Symbol(src)_1."+C:""}(),Zt=Be.toString,Ct=RegExp("^"+qt.call(pt).replace(H,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Pe=de?W.Buffer:void 0,un=W.Symbol,On=W.Uint8Array,dn=Be.propertyIsEnumerable,Gn=nt.splice,ht=un?un.toStringTag:void 0,fn=Object.getOwnPropertySymbols,_n=Pe?Pe.isBuffer:void 0,Xn=jt(Object.keys,Object),Sn=br(W,"DataView"),Ae=br(W,"Map"),st=br(W,"Promise"),oe=br(W,"Set"),me=br(W,"WeakMap"),Je=br(Object,"create"),pn=Zn(Sn),Q=Zn(Ae),ce=Zn(st),le=Zn(oe),Ke=Zn(me),We=un?un.prototype:void 0,mt=We?We.valueOf:void 0;function Xe(C){var E=-1,P=C==null?0:C.length;for(this.clear();++E<P;){var Y=C[E];this.set(Y[0],Y[1])}}function rt(){this.__data__=Je?Je(null):{},this.size=0}function gt(C){var E=this.has(C)&&delete this.__data__[C];return this.size-=E?1:0,E}function Te(C){var E=this.__data__;if(Je){var P=E[C];return P===r?void 0:P}return pt.call(E,C)?E[C]:void 0}function En(C){var E=this.__data__;return Je?E[C]!==void 0:pt.call(E,C)}function jo(C,E){var P=this.__data__;return this.size+=this.has(C)?0:1,P[C]=Je&&E===void 0?r:E,this}Xe.prototype.clear=rt,Xe.prototype.delete=gt,Xe.prototype.get=Te,Xe.prototype.has=En,Xe.prototype.set=jo;function Kt(C){var E=-1,P=C==null?0:C.length;for(this.clear();++E<P;){var Y=C[E];this.set(Y[0],Y[1])}}function Ti(){this.__data__=[],this.size=0}function Ri(C){var E=this.__data__,P=Mi(E,C);if(P<0)return!1;var Y=E.length-1;return P==Y?E.pop():Gn.call(E,P,1),--this.size,!0}function Ai(C){var E=this.__data__,P=Mi(E,C);return P<0?void 0:E[P][1]}function Fi(C){return Mi(this.__data__,C)>-1}function Pi(C,E){var P=this.__data__,Y=Mi(P,C);return Y<0?(++this.size,P.push([C,E])):P[Y][1]=E,this}Kt.prototype.clear=Ti,Kt.prototype.delete=Ri,Kt.prototype.get=Ai,Kt.prototype.has=Fi,Kt.prototype.set=Pi;function ye(C){var E=-1,P=C==null?0:C.length;for(this.clear();++E<P;){var Y=C[E];this.set(Y[0],Y[1])}}function Ut(){this.size=0,this.__data__={hash:new Xe,map:new(Ae||Kt),string:new Xe}}function ti(C){var E=ki(this,C).delete(C);return this.size-=E?1:0,E}function Yn(C){return ki(this,C).get(C)}function Lo(C){return ki(this,C).has(C)}function ni(C,E){var P=ki(this,C),Y=P.size;return P.set(C,E),this.size+=P.size==Y?0:1,this}ye.prototype.clear=Ut,ye.prototype.delete=ti,ye.prototype.get=Yn,ye.prototype.has=Lo,ye.prototype.set=ni;function Di(C){var E=-1,P=C==null?0:C.length;for(this.__data__=new ye;++E<P;)this.add(C[E])}function Cf(C){return this.__data__.set(C,r),this}function xf(C){return this.__data__.has(C)}Di.prototype.add=Di.prototype.push=Cf,Di.prototype.has=xf;function Nn(C){var E=this.__data__=new Kt(C);this.size=E.size}function Of(){this.__data__=new Kt,this.size=0}function _f(C){var E=this.__data__,P=E.delete(C);return this.size=E.size,P}function Sf(C){return this.__data__.get(C)}function Ef(C){return this.__data__.has(C)}function Nf(C,E){var P=this.__data__;if(P instanceof Kt){var Y=P.__data__;if(!Ae||Y.length<n-1)return Y.push([C,E]),this.size=++P.size,this;P=this.__data__=new ye(Y)}return P.set(C,E),this.size=P.size,this}Nn.prototype.clear=Of,Nn.prototype.delete=_f,Nn.prototype.get=Sf,Nn.prototype.has=Ef,Nn.prototype.set=Nf;function Tf(C,E){var P=ji(C),Y=!P&&Hf(C),Re=!P&&!Y&&qo(C),fe=!P&&!Y&&!Re&&Va(C),ke=P||Y||Re||fe,Ye=ke?He(C.length,String):[],it=Ye.length;for(var De in C)pt.call(C,De)&&!(ke&&(De=="length"||Re&&(De=="offset"||De=="parent")||fe&&(De=="buffer"||De=="byteLength"||De=="byteOffset")||qf(De,it)))&&Ye.push(De);return Ye}function Mi(C,E){for(var P=C.length;P--;)if(La(C[P][0],E))return P;return-1}function Rf(C,E,P){var Y=E(C);return ji(C)?Y:Ve(Y,P(C))}function ri(C){return C==null?C===void 0?A:x:ht&&ht in Object(C)?jf(C):$f(C)}function Da(C){return ii(C)&&ri(C)==a}function Ma(C,E,P,Y,Re){return C===E?!0:C==null||E==null||!ii(C)&&!ii(E)?C!==C&&E!==E:Af(C,E,P,Y,Ma,Re)}function Af(C,E,P,Y,Re,fe){var ke=ji(C),Ye=ji(E),it=ke?l:Tn(C),De=Ye?l:Tn(E);it=it==a?h:it,De=De==a?h:De;var xt=it==h,Vt=De==h,at=it==De;if(at&&qo(C)){if(!qo(E))return!1;ke=!0,xt=!1}if(at&&!xt)return fe||(fe=new Nn),ke||Va(C)?ka(C,E,P,Y,Re,fe):Mf(C,E,it,P,Y,Re,fe);if(!(P&o)){var Tt=xt&&pt.call(C,"__wrapped__"),Rt=Vt&&pt.call(E,"__wrapped__");if(Tt||Rt){var Rn=Tt?C.value():C,hn=Rt?E.value():E;return fe||(fe=new Nn),Re(Rn,hn,P,Y,fe)}}return at?(fe||(fe=new Nn),kf(C,E,P,Y,Re,fe)):!1}function Ff(C){if(!Ua(C)||Uf(C))return!1;var E=qa(C)?Ct:U;return E.test(Zn(C))}function Pf(C){return ii(C)&&Ka(C.length)&&!!M[ri(C)]}function Df(C){if(!Vf(C))return Xn(C);var E=[];for(var P in Object(C))pt.call(C,P)&&P!="constructor"&&E.push(P);return E}function ka(C,E,P,Y,Re,fe){var ke=P&o,Ye=C.length,it=E.length;if(Ye!=it&&!(ke&&it>Ye))return!1;var De=fe.get(C);if(De&&fe.get(E))return De==E;var xt=-1,Vt=!0,at=P&i?new Di:void 0;for(fe.set(C,E),fe.set(E,C);++xt<Ye;){var Tt=C[xt],Rt=E[xt];if(Y)var Rn=ke?Y(Rt,Tt,xt,E,C,fe):Y(Tt,Rt,xt,C,E,fe);if(Rn!==void 0){if(Rn)continue;Vt=!1;break}if(at){if(!et(E,function(hn,er){if(!kt(at,er)&&(Tt===hn||Re(Tt,hn,P,Y,fe)))return at.push(er)})){Vt=!1;break}}else if(!(Tt===Rt||Re(Tt,Rt,P,Y,fe))){Vt=!1;break}}return fe.delete(C),fe.delete(E),Vt}function Mf(C,E,P,Y,Re,fe,ke){switch(P){case $:if(C.byteLength!=E.byteLength||C.byteOffset!=E.byteOffset)return!1;C=C.buffer,E=E.buffer;case B:return!(C.byteLength!=E.byteLength||!fe(new On(C),new On(E)));case u:case f:case p:return La(+C,+E);case m:return C.name==E.name&&C.message==E.message;case O:case T:return C==E+"";case y:var Ye=It;case S:var it=Y&o;if(Ye||(Ye=Lt),C.size!=E.size&&!it)return!1;var De=ke.get(C);if(De)return De==E;Y|=i,ke.set(C,E);var xt=ka(Ye(C),Ye(E),Y,Re,fe,ke);return ke.delete(C),xt;case R:if(mt)return mt.call(C)==mt.call(E)}return!1}function kf(C,E,P,Y,Re,fe){var ke=P&o,Ye=ja(C),it=Ye.length,De=ja(E),xt=De.length;if(it!=xt&&!ke)return!1;for(var Vt=it;Vt--;){var at=Ye[Vt];if(!(ke?at in E:pt.call(E,at)))return!1}var Tt=fe.get(C);if(Tt&&fe.get(E))return Tt==E;var Rt=!0;fe.set(C,E),fe.set(E,C);for(var Rn=ke;++Vt<it;){at=Ye[Vt];var hn=C[at],er=E[at];if(Y)var $a=ke?Y(er,hn,at,E,C,fe):Y(hn,er,at,C,E,fe);if(!($a===void 0?hn===er||Re(hn,er,P,Y,fe):$a)){Rt=!1;break}Rn||(Rn=at=="constructor")}if(Rt&&!Rn){var Li=C.constructor,qi=E.constructor;Li!=qi&&"constructor"in C&&"constructor"in E&&!(typeof Li=="function"&&Li instanceof Li&&typeof qi=="function"&&qi instanceof qi)&&(Rt=!1)}return fe.delete(C),fe.delete(E),Rt}function ja(C){return Rf(C,Wf,Lf)}function ki(C,E){var P=C.__data__;return Kf(E)?P[typeof E=="string"?"string":"hash"]:P.map}function br(C,E){var P=tt(C,E);return Ff(P)?P:void 0}function jf(C){var E=pt.call(C,ht),P=C[ht];try{C[ht]=void 0;var Y=!0}catch{}var Re=Zt.call(C);return Y&&(E?C[ht]=P:delete C[ht]),Re}var Lf=fn?function(C){return C==null?[]:(C=Object(C),Ne(fn(C),function(E){return dn.call(C,E)}))}:zf,Tn=ri;(Sn&&Tn(new Sn(new ArrayBuffer(1)))!=$||Ae&&Tn(new Ae)!=y||st&&Tn(st.resolve())!=w||oe&&Tn(new oe)!=S||me&&Tn(new me)!=D)&&(Tn=function(C){var E=ri(C),P=E==h?C.constructor:void 0,Y=P?Zn(P):"";if(Y)switch(Y){case pn:return $;case Q:return y;case ce:return w;case le:return S;case Ke:return D}return E});function qf(C,E){return E=E??s,!!E&&(typeof C=="number"||K.test(C))&&C>-1&&C%1==0&&C<E}function Kf(C){var E=typeof C;return E=="string"||E=="number"||E=="symbol"||E=="boolean"?C!=="__proto__":C===null}function Uf(C){return!!ln&&ln in C}function Vf(C){var E=C&&C.constructor,P=typeof E=="function"&&E.prototype||Be;return C===P}function $f(C){return Zt.call(C)}function Zn(C){if(C!=null){try{return qt.call(C)}catch{}try{return C+""}catch{}}return""}function La(C,E){return C===E||C!==C&&E!==E}var Hf=Da(function(){return arguments}())?Da:function(C){return ii(C)&&pt.call(C,"callee")&&!dn.call(C,"callee")},ji=Array.isArray;function Bf(C){return C!=null&&Ka(C.length)&&!qa(C)}var qo=_n||Qf;function Jf(C,E){return Ma(C,E)}function qa(C){if(!Ua(C))return!1;var E=ri(C);return E==g||E==v||E==d||E==I}function Ka(C){return typeof C=="number"&&C>-1&&C%1==0&&C<=s}function Ua(C){var E=typeof C;return C!=null&&(E=="object"||E=="function")}function ii(C){return C!=null&&typeof C=="object"}var Va=z?Ie(z):Pf;function Wf(C){return Bf(C)?Tf(C):Df(C)}function zf(){return[]}function Qf(){return!1}e.exports=Jf})(oo,oo.exports);var Mv=oo.exports;const au=Qs(Mv),mr="other",so="manage-tab";function bn(e){return!e.fieldName}function kv(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function jv(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!bn(n)&&!!n.fieldName))||null}function Lv(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>bn(r)&&!!r.mapToName))||[]}function qv(e){var n;return((n=e==null?void 0:e.optionalFields)==null?void 0:n.filter(r=>bn(r)&&!!r.mapToName))||[]}function Kv(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!bn(n)&&!!n.fieldName))||null}const cu=(e,t)=>{var n,r,o;return(o=(r=(n=e==null?void 0:e.content)==null?void 0:n.read)==null?void 0:r.objects)==null?void 0:o[t]};function Uv(e){return bn(e)?e.mapToName:e.fieldName}const lu=(e,t)=>{var r,o,i;const n=[];return(i=(o=(r=t.content)==null?void 0:r.read)==null?void 0:o.objects)==null||i.forEach(s=>{n.push({name:s==null?void 0:s.objectName,displayName:(s==null?void 0:s.mapToDisplayName)||(s==null?void 0:s.displayName)||(s==null?void 0:s.objectName)&&on(s==null?void 0:s.objectName),completed:e?!!cu(e,s.objectName):!1})}),n},uu=e=>{var n;return{name:mr,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function Vv(e,t){var i;const n=lu(e,t),o=!!((i=t==null?void 0:t.content)!=null&&i.write)?uu(e):void 0;return o&&n.push(o),n}function du(e,t,n){const r=(e==null?void 0:e.filter(i=>!(t!=null&&t[i==null?void 0:i.mapToName])))||[],o=r.map(i=>i.mapToName);return n(ue.MAPPING,o),r!=null&&r.length&&console.error("required fields not met",r.map(i=>i.mapToDisplayName)),{errorList:o}}function $v(e,t){return au(e,t)}function fu(e,t){return au(e,t)}const Hv=(e,t,n)=>{var p,x,h,w,I,O,S,T,R;if(!e)return null;const r=kv(e,t),o=r&&jv(r),i=r&&Kv(r),s=r&&Lv(r),a=r&&qv(r),l=(r==null?void 0:r.allFields)||[],d=(r==null?void 0:r.allFieldsMetadata)||{},u=n==null?void 0:n.content,f=((h=(x=(p=u==null?void 0:u.read)==null?void 0:p.objects)==null?void 0:x[t])==null?void 0:h.selectedFields)||{},m=((O=(I=(w=u==null?void 0:u.read)==null?void 0:w.objects)==null?void 0:I[t])==null?void 0:O.selectedValueMappings)||{},g=((R=(T=(S=u==null?void 0:u.read)==null?void 0:S.objects)==null?void 0:T[t])==null?void 0:R.selectedFieldMappings)||{},v=Object.entries(f).reduce((A,[D,B])=>((i==null?void 0:i.some(L=>!bn(L)&&"fieldName"in L&&L.fieldName===D))&&(A[D]=B),A),{}),y={...g};return{allFields:l,allFieldsMetadata:d,requiredFields:o,optionalFields:i,requiredMapFields:s,optionalMapFields:a,selectedOptionalFields:v,selectedFieldMappings:g,selectedValueMappings:m,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,isValueMappingsModified:!1,savedConfig:{optionalFields:v,requiredMapFields:y,selectedValueMappings:m}}},Bv=(e,t)=>{var r,o;if(!e)return null;const n=(o=(r=t==null?void 0:t.content)==null?void 0:r.write)==null?void 0:o.objects;return{writeObjects:(e==null?void 0:e.objects)||[],selectedWriteObjects:n||{},isWriteModified:!1,savedConfig:{selectedWriteObjects:n||{}}}};function pu(e,t,n){var i,s;const r=(i=e==null?void 0:e.content)==null?void 0:i.read,o=(s=e==null?void 0:e.content)==null?void 0:s.write;return{read:Hv(r,t,n),write:Bv(o,n)}}const hu=(e,t,n,r)=>{const o=pu(e,n,t);r(n,o)},Jv=(e,t,n)=>{const r=Vv(t,e),o={};r.forEach(({name:i,completed:s})=>{s&&(o[i]=pu(e,i,t))}),n(o)},mu=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(i=>r.add(Uv(i))),{...Array.from(r).reduce((i,s)=>({...i,[s]:!0}),{}),...n||{}}},gu=e=>{const{selectedFieldMappings:t}=(e==null?void 0:e.read)||{},n={};return t&&Object.keys(t).forEach(r=>{t[r]!==void 0?n[r]=t[r]||"":console.warn(`Error undefined when generating selectedRequiredMapFieldsSubmit for key: ${r}`)}),n},yu=e=>{const{selectedValueMappings:t}=(e==null?void 0:e.read)||{};return t};function vu(e,t){return t[e]||void 0}async function wu({createConfig:e,projectId:t,integrationId:n,groupRef:r,connectionId:o,apiKey:i,setError:s,setInstallation:a,onInstallSuccess:l}){const d={projectIdOrName:t,integrationId:n,installation:{groupRef:r,connectionId:o,config:e}};try{const u=await Bs().installationApi.createInstallation(d,{headers:{"X-Api-Key":i,"Content-Type":"application/json"}});a(u),l==null||l(u.id,u.config)}catch(u){Me(u,s)}}function Ii(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const Wv=(e,t)=>{const n=e.content.read,r=n==null?void 0:n.objects;return r==null?void 0:r.find(o=>o.objectName===t)},zv=(e,t,n,r)=>{const o=mu(e),i=gu(e),s=yu(e),a=Wv(n,t);if(!a)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const l={revisionId:n.id,createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,schedule:a.schedule,destination:a.destination,selectedFields:o,selectedFieldMappings:i,selectedValueMappings:s||{},backfill:a.backfill}}}}};return Ii(n)&&(l.content.proxy={enabled:!0}),l},Qv=(e,t,n,r,o,i,s,a,l,d,u,f)=>{const m=zv(l,i,a,r);return m?wu({createConfig:m,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:s,setError:d,setInstallation:u,onInstallSuccess:f}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},bu=e=>{var t;return{...(t=e.write)==null?void 0:t.selectedWriteObjects}},Gv=e=>{const t=e.content.write;return t==null?void 0:t.objects},Xv=(e,t,n)=>{if(!Gv(t))return console.error("Error when getting write objects from hydratedRevision"),null;const o=bu(e),i={revisionId:t.id,createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:o}}};return Ii(t)&&(i.content.proxy={enabled:!0}),i},Yv=(e,t,n,r,o,i,s,a,l,d,u)=>{const f=Xv(a,s,r);return f?wu({createConfig:f,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:i,setError:l,setInstallation:d,onInstallSuccess:u}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))};var Iu={exports:{}};/*!
7
7
  Copyright (c) 2018 Jed Watson.
8
8
  Licensed under the MIT License (MIT), see
9
9
  http://jedwatson.github.io/classnames
10
- */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var i="",s=0;s<arguments.length;s++){var a=arguments[s];a&&(i=o(i,r(a)))}return i}function r(i){if(typeof i=="string"||typeof i=="number")return i;if(typeof i!="object")return"";if(Array.isArray(i))return n.apply(null,i);if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]"))return i.toString();var s="";for(var a in i)t.call(i,a)&&i[a]&&(s=o(s,a));return s}function o(i,s){return s?i?i+" "+s:i+s:i}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(wu);var Gv=wu.exports;const Dt=Qs(Gv),Xv="_button_kwfiu_1",Yv="_buttonError_kwfiu_28",Zv="_danger_kwfiu_42",ew="_ghost_kwfiu_47",Ho={button:Xv,buttonError:Yv,danger:Zv,ghost:ew};function $e({className:e,style:t,type:n,children:r,variant:o,...i}){const s=Dt(Ho.button,{[Ho.danger]:o==="danger",[Ho.ghost]:o==="ghost",[e||""]:!!e});return l.jsx("button",{type:n,className:s,style:t,...i,children:r})}const tw={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 xi({children:e,style:t}){return l.jsx(Cn,{style:{...tw,...t},children:e})}const Io=e=>{const t=ot(),{provider:n}=Ze(),r=e||n;return Wn({queryKey:["amp","providerInfo",r],queryFn:async()=>{if(!r)throw new Error("Provider not found");return(await t()).providerApi.getProvider({provider:r})},enabled:!!r})},lt=e=>{const t=Io(e),{data:n}=t,{provider:r}=Ze(),o=n&&Sv(n==null?void 0:n.name,n);return{...t,providerName:o,selectedProvider:e||r}};function an({error:e}){return e?l.jsx(xi,{style:{marginTop:"2em"},children:e}):null}const nw="_input_1ymb7_1",rw="_inputError_1ymb7_27",iw="_error_1ymb7_43",Bo={input:nw,inputError:rw,error:iw};function ow({id:e,type:t,className:n,isError:r=!1,...o}){const i=r?Dt(Bo.inputError,Bo.input):Bo.input;return l.jsx("input",{id:e,type:t,className:Dt(i,n),...o})}function sw(){return l.jsx("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.jsxs("g",{opacity:"0.5",children:[l.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"}),l.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 aw(){return l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:[l.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"}),l.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"}),l.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 cw({id:e,name:t,placeholder:n="Password",onChange:r,value:o,className:i,isError:s}){const[a,c]=b.useState(!1),d=()=>c(u=>!u);return l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(bt.Input,{id:e,name:t,type:a?"text":"password",placeholder:n,onChange:r,value:o,className:i,isError:s}),l.jsx($e,{type:"button","aria-label":a?"Hide password":"Show password",style:{height:"2.5rem",width:"2.5rem",display:"flex",alignItems:"center",justifyContent:"center"},onClick:d,variant:"ghost",children:l.jsx("span",{style:{height:"1.5rem",width:"1.5rem"},children:a?l.jsx(aw,{}):l.jsx(sw,{})})})]})}const lw="_textarea_18zl4_1",uw="_textareaError_18zl4_14",dw="_error_18zl4_29",Jo={textarea:lw,textareaError:uw,error:dw};function fw({className:e,isError:t=!1,...n}){const r=t?Dt(Jo.textareaError,Jo.textarea):Jo.textarea;return l.jsx("textarea",{className:Dt(e,r),...n})}const bt={Input:ow,Textarea:fw,PasswordInput:cw},pw=()=>{const{project:e}=Ee(),t=e==null?void 0:e.id,n=ot();return Wn({queryKey:["project",t,"entitlements"],queryFn:async()=>{if(!t)throw new Error("Project ID is required");return(await n()).projectApi.getProject({projectIdOrName:t,includeEntitlements:!0})},enabled:!!t})};function bu(){var n,r;const{data:e}=pw();return((r=(n=e==null?void 0:e.entitlements)==null?void 0:n.brandingRemoval)==null?void 0:r.value)===!0?null:l.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:[l.jsx("p",{style:{color:"light-dark(gray, #EFEFEF)"},children:"Secured by"}),l.jsx("a",{href:"https://www.withampersand.com/",target:"_blank","aria-label":"Go to Ampersand",rel:"noreferrer noopener",children:l.jsxs("picture",{children:[l.jsx("source",{srcSet:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",media:"(prefers-color-scheme: light)"}),l.jsx("source",{srcSet:"https://res.cloudinary.com/dycvts6vp/image/upload/v1735853540/ampersand_logo_white.svg",media:"(prefers-color-scheme: dark)"}),l.jsx("img",{style:{height:".8em"},src:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",alt:"Ampersand"})]})})]})}function zn({children:e}){return l.jsx(Xr,{children:l.jsxs(Cn,{children:[l.jsx("div",{style:{padding:"3rem 2rem"},children:e}),l.jsx(bu,{})]})})}function Qn({children:e}){return l.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function hw({children:e}){return l.jsx("p",{style:{padding:".5em 0"},children:e})}const mw="_link_oo2kv_1",gw={link:mw};function Iu({href:e,className:t,style:n,label:r,children:o,newTab:i=!1}){return l.jsx("a",{className:Dt(gw.link,t),style:n,href:e,"aria-label":r||void 0,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:o})}function Lr({url:e,providerDisplayName:t,credentialName:n}){return l.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[l.jsx(Iu,{href:e,newTab:!0,children:l.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," ","about where to find your ",t," ",n,"."]})}function Co(e,t){const n={},r=[];if(e.forEach(o=>{const i=t[o.name];!i||i.trim()===""?r.push(o.displayName||o.name):n[o.name]={value:i,source:"input"}}),r.length>0)throw new Error(`Please fill in the following required fields: ${r.join(", ")}.`);return n}function qr(e,t){return e.every(n=>{const r=t[n.name];return r&&r.trim()!==""})}function Cu({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o,submitButtonType:i}){var x,h;const[s,a]=b.useState({apiKey:""}),c=((x=t.metadata)==null?void 0:x.input)||[],d=w=>{const{name:I,value:O}=w.currentTarget;a(S=>({...S,[I]:O.trim()}))},{apiKey:u}=s,{providerName:f}=lt(e),m=u.length>0,g=qr(c,s),v=r||!m||!g,y=(h=t.apiKeyOpts)==null?void 0:h.docsURL,p=()=>{const w=Co(c,s);n({apiKey:u,providerMetadata:w})};return l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[y&&l.jsx(Lr,{url:y,providerDisplayName:f||Qt(e),credentialName:"API key"}),l.jsx(bt.PasswordInput,{id:"apiKey",name:"apiKey",placeholder:"API Key",onChange:d}),c.map(w=>l.jsxs("div",{children:[w.docsURL&&l.jsx(Lr,{url:w.docsURL,providerDisplayName:f||Qt(e),credentialName:w.displayName||w.name}),l.jsx(bt.Input,{id:w.name,name:w.name,type:"text",placeholder:w.displayName||w.name,onChange:d})]},w.name)),l.jsx($e,{style:{marginTop:"1em",width:"100%"},disabled:v,type:i||"submit",onClick:p,variant:o,children:"Next"})]})}function yw({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=lt(e);return l.jsxs(zn,{children:[l.jsx(Qn,{children:`Set up ${i} integration`}),l.jsx(an,{error:r}),l.jsx(Cu,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function vw({...e}){return l.jsx(yw,{...e})}const ww={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 xo({children:e,style:t}){return l.jsx(Cn,{style:{...ww,...t},children:e})}const Gs=()=>{const e=ot(),t=qe(),[n,r]=b.useState(null);return{...In({mutationKey:["updateConnection"],mutationFn:async i=>(await e()).connectionApi.updateConnection(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)}}),errorMsg:n}},bw="_divider_1kmoj_1",ac={divider:bw};function Oo({className:e,style:t}){return l.jsx("hr",{className:e?`${ac.divider} ${e}`:ac.divider,style:t})}function Nt({string:e}){return l.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[l.jsx("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:e}),l.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:l.jsx(Oo,{style:{width:"100%",marginLeft:"1rem"}})})]})}function Iw({provider:e}){const{projectIdOrName:t}=Ee(),{providerName:n,data:r}=lt(e),{selectedConnection:o,isConnectionsLoading:i}=Yt(),{mutateAsync:s,isPending:a,error:c}=Gs(),[d,u]=b.useState(null),[f,m]=b.useState(!1),g=()=>m(!1),v=()=>{m(!0),u(null)},y=(c==null?void 0:c.message)||d||null,p=async x=>{g(),u(null);try{await s({projectIdOrName:t||"",connectionId:(o==null?void 0:o.id)||"",updateConnectionRequest:{updateMask:["apiKey"],connection:{apiKey:x.apiKey}}},{onError:h=>{console.error("Update connection error:",h),Me(h,u)},onSuccess:()=>{v()}})}catch(h){console.error("Update connection caught error:",h),Me(h,u)}};return r?l.jsxs(l.Fragment,{children:[l.jsx(Nt,{string:"Update connection"}),l.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[l.jsx("p",{children:`Update ${n} API Key`}),f&&l.jsx(xo,{children:"Connection updated successfully"}),y&&l.jsx(xi,{children:`Error updating connection ${y}`}),l.jsx(Cu,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:p,isButtonDisabled:a||i,buttonVariant:"ghost",submitButtonType:"button"})]})]}):null}function xu({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o}){var p,x;const[i,s]=b.useState({username:"",password:""}),a=((p=t.metadata)==null?void 0:p.input)||[],{username:c,password:d}=i,{providerName:u}=lt(e),f=h=>{const{name:w,value:I}=h.currentTarget;s(O=>({...O,[w]:I.trim()}))},m=qr(a,i),g=r||!m,v=()=>{const h=Co(a,i);n({user:c,pass:d,providerMetadata:h})},y=(x=t.basicOpts)==null?void 0:x.docsURL;return l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[y&&l.jsx(Lr,{url:y,providerDisplayName:u||Qt(e),credentialName:"credentials"}),l.jsx(bt.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:f}),l.jsx(bt.PasswordInput,{id:"password",name:"password",placeholder:"Password",onChange:f}),a.map(h=>l.jsxs("div",{children:[h.docsURL&&l.jsx(Lr,{url:h.docsURL,providerDisplayName:u||Qt(e),credentialName:h.displayName||h.name}),l.jsx(bt.Input,{id:h.name,name:h.name,type:"text",placeholder:h.displayName||h.name,onChange:f})]},h.name)),l.jsx($e,{style:{marginTop:"1em",width:"100%"},disabled:g,type:"button",onClick:v,variant:o,children:"Next"})]})}function Cw({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=lt(e);return l.jsxs(zn,{children:[l.jsx(Qn,{children:`Set up ${i} integration`}),l.jsx(an,{error:r}),l.jsx(xu,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function xw({...e}){return l.jsx(Cw,{...e})}function Ow({provider:e}){const{projectIdOrName:t}=Ee(),{providerName:n,data:r}=lt(e),{selectedConnection:o,isConnectionsLoading:i}=Yt(),{mutateAsync:s,isPending:a,error:c}=Gs(),[d,u]=b.useState(null),[f,m]=b.useState(!1),g=()=>m(!1),v=()=>{m(!0),u(null)},y=(c==null?void 0:c.message)||d||null,p=async x=>{g(),u(null);try{await s({projectIdOrName:t||"",connectionId:(o==null?void 0:o.id)||"",updateConnectionRequest:{updateMask:["basicAuth"],connection:{basicAuth:{username:x.user,password:x.pass}}}},{onError:h=>{console.error(h),Me(h,u)},onSuccess:()=>{v()}})}catch(h){console.error(h),Me(h,u)}};return r?l.jsxs(l.Fragment,{children:[l.jsx(Nt,{string:"Update connection"}),l.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[l.jsx("p",{children:`Update ${n} credentials`}),f&&l.jsx(xo,{children:"Connection updated successfully"}),y&&l.jsx(xi,{children:`Error updating connection: ${y}`}),l.jsx(xu,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:p,isButtonDisabled:a||i,buttonVariant:"ghost"})]})]}):null}function Ou({provider:e,handleSubmit:t,isButtonDisabled:n,explicitScopesRequired:r,buttonVariant:o}){var I;const[i,s]=b.useState({clientSecret:"",clientId:"",scopes:""}),[a,c]=b.useState(null),{data:d}=Io(e),u=((I=d==null?void 0:d.metadata)==null?void 0:I.input)||[],f=O=>{const{name:S,value:T}=O.currentTarget;s(R=>({...R,[S]:T.trim()})),c(null)},{clientSecret:m,clientId:g,scopes:v}=i,y=m.length>0,p=g.length>0,x=qr(u,i),h=n||!y||!p||!x,w=()=>{const O=Co(u,i),S={clientId:g,clientSecret:m,providerMetadata:O};r&&v.length>0&&(S.scopes=Ev(v)),t(S)};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[l.jsx(bt.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:f}),l.jsx(bt.PasswordInput,{id:"clientSecret",name:"clientSecret",placeholder:"Client Secret",onChange:f}),r&&l.jsx(bt.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:f}),u.map(O=>l.jsx(bt.Input,{id:O.name,name:O.name,type:"text",placeholder:O.displayName||O.name,onChange:f},O.name))]}),l.jsx(an,{error:a}),l.jsx("br",{}),l.jsx($e,{style:{width:"100%"},disabled:h,type:"button",onClick:w,variant:o,children:"Next"})]})}function _w({provider:e,handleSubmit:t,error:n,isButtonDisabled:r,providerName:o,explicitScopesRequired:i}){return l.jsxs(zn,{children:[l.jsx(Qn,{children:`Set up ${o} integration`}),l.jsx(an,{error:n}),l.jsx("br",{}),l.jsx(Ou,{provider:e,handleSubmit:t,isButtonDisabled:r,explicitScopesRequired:i})]})}function Sw({provider:e}){var h;const{projectIdOrName:t}=Ee(),{selectedConnection:n,isConnectionsLoading:r}=Yt(),{providerName:o,data:i}=lt(e),{mutateAsync:s,isPending:a,error:c}=Gs(),[d,u]=b.useState(null),[f,m]=b.useState(!1),g=()=>{m(!1)},v=()=>{m(!0),u(null)},y=(h=i==null?void 0:i.oauth2Opts)==null?void 0:h.explicitScopesRequired,p=(c==null?void 0:c.message)||d||null,x=async w=>{g(),u(null);try{await s({projectIdOrName:t||"",connectionId:(n==null?void 0:n.id)||"",updateConnectionRequest:{updateMask:["oauth2ClientCredentials"],connection:{oauth2ClientCredentials:{clientId:w.clientId,clientSecret:w.clientSecret,scopes:w.scopes}}}}),v()}catch(I){Me(I,u)}};return l.jsxs(l.Fragment,{children:[l.jsx(Nt,{string:"Update connection"}),l.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[l.jsx("p",{children:`Re-authenticate to ${o}`}),f&&l.jsx(xo,{children:"Connection updated successfully"}),p&&l.jsx(xi,{children:`Error updating connection ${p}`}),l.jsx(Ou,{provider:o||"",handleSubmit:x,isButtonDisabled:a||r,explicitScopesRequired:y,buttonVariant:"ghost"})]})]})}const cc=600,lc=600,Ew="AUTHORIZATION_SUCCEEDED",Nw="AUTHORIZATION_FAILED";function Tw(e,t,n,r){return b.useCallback(()=>{if(!r)return;const o=window.screenX+(window.outerWidth-cc)/2,i=window.screenY+(window.outerHeight-lc)/2.5,s=`width=${cc},height=${lc},left=${o},top=${i}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function Rw(e,t,n,r){const o=qe();return b.useCallback(i=>{var s,a;if(i.origin===Jl){if(i.data.eventType===Ew){const c=(s=i.data.data)==null?void 0:s.connection;c?(e(c),o.setQueriesData({queryKey:["amp","connections"]},()=>[c]),t==null||t.close(),r==null||r(),o.invalidateQueries({queryKey:["amp","connections"]})):console.error("Connection ID not found in event data: ",{event:i})}i.data.eventType===Nw&&(console.error("OAuth failed: ",{event:i}),n==null||n(((a=i==null?void 0:i.data)==null?void 0:a.message)??"Something went wrong. Please try again."))}},[t,n,o,e,r])}function Aw({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:o,onSuccessConnect:i,isSuccessConnect:s,onWindowClose:a}){const[c,d]=b.useState(null),[u,f]=b.useState(null),m=qe(),g=b.useRef(null),v=Rw(d,u,r,i),y=Tw(n,f,v,t);b.useEffect(()=>{t&&!u&&!c&&!o&&!s&&(r==null||r(null),y())},[t,u,y,c,o,s,r]);const p=b.useCallback(()=>{m.invalidateQueries({queryKey:["amp","connections"]}),f(null),!c&&!o?console.error("Window closed and no connection was found. Please try again."):c&&(r==null||r(null)),a==null||a()},[c,o,r,a,m]);return b.useEffect(()=>{if(u)return g.current=setInterval(()=>{u!=null&&u.closed&&(g.current&&clearInterval(g.current),g.current=null,p())},500),()=>{g.current&&(clearInterval(g.current),g.current=null),window.removeEventListener("message",v)}},[p,u,v]),l.jsx("div",{children:e})}const Fw=()=>{const e=ot(),t=qe();return In({mutationKey:["updateOauthConnection"],mutationFn:async n=>{const r=await e();if(!n.projectIdOrName||!n.connectionId)throw new Error("Project ID and connection ID are required");return r.oAuthApi.oauthUpdate(n)},onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})};function Pw({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return l.jsxs("div",{style:{padding:"1rem 0"},children:[l.jsx("p",{children:`Re-authenticate to ${r}`}),l.jsx(an,{error:t}),l.jsx($e,{variant:"ghost",style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function Dw({provider:e}){const{selectedConnection:t,isConnectionsLoading:n}=Yt(),r=t==null?void 0:t.id,o=t==null?void 0:t.projectId,{providerName:i}=lt(e),{mutateAsync:s,isPending:a,error:c}=Fw(),[d,u]=b.useState(null),[f,m]=b.useState(!1),[g,v]=b.useState(null),y=()=>{m(!1)},p=()=>{m(!0),u(null),v(null)},x=(c==null?void 0:c.message)||d||null,h=async()=>{y(),u(null);try{const I=await s({projectIdOrName:o||"",connectionId:r||""});v(I)}catch(I){Me(I,u)}},w=b.useCallback(I=>{u(I)},[]);return l.jsxs(l.Fragment,{children:[l.jsx(Nt,{string:"Update connection"}),f&&l.jsx(xo,{children:"Connection updated successfully"}),l.jsx(Aw,{windowTitle:`Connect to ${i}`,oauthUrl:g||null,onError:w,error:x,isSuccessConnect:f,onSuccessConnect:p,children:l.jsx(Pw,{handleSubmit:h,error:x,providerName:i,isButtonDisabled:a||n||f})})]})}function Xs({provider:e}){var r;const{data:t}=Io(e);if((t==null?void 0:t.authType)===ec.Basic)return l.jsx(Ow,{provider:e});if((t==null?void 0:t.authType)===ec.ApiKey)return l.jsx(Iw,{provider:e});const n=(r=t==null?void 0:t.oauth2Opts)==null?void 0:r.grantType;if(n){if(n===$o.AuthorizationCode||n===$o.AuthorizationCodePkce)return l.jsx(Dw,{provider:e});if(n===$o.ClientCredentials)return l.jsx(Sw,{provider:e})}return null}const Mw=()=>{const e=ot(),t=qe(),[n,r]=b.useState(null);return{...In({mutationKey:["deleteConnection"],mutationFn:async i=>(await e()).connectionApi.deleteConnection(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)},onError:i=>{console.error("Error deleting connection"),Me(i,r)}}),errorMsg:n}};function _u({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:o,onDisconnectError:i}){const{projectId:s}=Ee(),{selectedConnection:a}=Yt(),{mutate:c,isPending:d}=Mw(),u=!s||!a||!a.id||d,f=async()=>{u||(console.warn("deleting connection",{projectId:s,connectionId:a==null?void 0:a.id}),c({projectIdOrName:s,connectionId:a==null?void 0:a.id},{onSuccess:()=>{console.warn("successfully deleted connection:",a==null?void 0:a.id),r==null||r(a),o()},onError:v=>{Me(v,i)}}))},m=d?"Pending...":e;return l.jsx($e,{type:"button",onClick:f,disabled:u,variant:t,style:n,children:m})}const Su=b.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),Zr=()=>{const e=b.useContext(Su);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e},kw=()=>{var d;const e=qe(),t=ot(),{selectedConnection:n,isConnectionsLoading:r}=Yt(),{projectIdOrName:o}=Ee(),{integrationId:i,integrationObj:s}=Ze(),a=n==null?void 0:n.id,c=(d=s==null?void 0:s.latestRevision)==null?void 0:d.id;return b.useEffect(()=>{a||e.invalidateQueries({queryKey:["amp","hydratedRevision"]})},[a,e]),Wn({queryKey:["amp","hydratedRevision",o,i,c,a],queryFn:async()=>{if(!o)throw new Error("projectIdOrName is required");if(!i)throw new Error("integrationId is required");if(!c)throw new Error("revisionId is required");if(!a)throw new Error("connectionId is required");return(await t()).revisionApi.getHydratedRevision({projectIdOrName:o,integrationId:i,revisionId:c,connectionId:a})},retry:3,enabled:!!o&&!!i&&!!c&&!!a&&!r})};function jw({children:e,resetComponent:t}){const{integrationId:n,integrationObj:r}=Ze(),{isError:o,removeError:i,setError:s}=Mt(),a=(r==null?void 0:r.name)||n,[c,d]=b.useState(null),[u,f]=b.useState(null),{data:m,isLoading:g,isError:v,error:y}=kw();b.useEffect(()=>{v?(s(ue.HYDRATED_REVISION,a),Me(y,d)):(i(ue.HYDRATED_REVISION,a),d(null),f(null))},[v,a,s,i,y,d]);const p=b.useMemo(()=>{var h,w,I;return{hydratedRevision:m||null,loading:g,readAction:(h=m==null?void 0:m.content)==null?void 0:h.read,writeObjects:((I=(w=m==null?void 0:m.content)==null?void 0:w.write)==null?void 0:I.objects)||[]}},[m,g]);if(g)return l.jsx(Yr,{});const x=(r==null?void 0:r.provider)||"provider";if(o(ue.HYDRATED_REVISION,a)){const h=(r==null?void 0:r.name)||n||"unknown integration",w=`${c?`: ${c}`:`Error retrieving objects from ${x} or integration details for ${h}`}`;return l.jsx(Wt,{message:w,children:l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",paddingTop:"1rem",width:"100%"},children:[l.jsx(Xs,{provider:x}),l.jsx("p",{children:"If authentication is failing, please try reauthenticating using the section above before deleting and recreating the connection."}),u&&l.jsx(Yl,{message:u}),l.jsx(_u,{buttonText:"Delete Connection",resetComponent:t,buttonVariant:"danger",onDisconnectError:I=>f(I)})]})})}return l.jsx(Su.Provider,{value:p,children:e})}function vn(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 he(){return he=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},he.apply(null,arguments)}function Is(e,t){return Is=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Is(e,t)}function Lw(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Is(e,t)}var Cs={exports:{}},Wi={exports:{}},Ce={};/** @license React v16.13.1
10
+ */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var i="",s=0;s<arguments.length;s++){var a=arguments[s];a&&(i=o(i,r(a)))}return i}function r(i){if(typeof i=="string"||typeof i=="number")return i;if(typeof i!="object")return"";if(Array.isArray(i))return n.apply(null,i);if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]"))return i.toString();var s="";for(var a in i)t.call(i,a)&&i[a]&&(s=o(s,a));return s}function o(i,s){return s?i?i+" "+s:i+s:i}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Iu);var Zv=Iu.exports;const Dt=Qs(Zv),ew="_button_kwfiu_1",tw="_buttonError_kwfiu_28",nw="_danger_kwfiu_42",rw="_ghost_kwfiu_47",Ho={button:ew,buttonError:tw,danger:nw,ghost:rw};function $e({className:e,style:t,type:n,children:r,variant:o,...i}){const s=Dt(Ho.button,{[Ho.danger]:o==="danger",[Ho.ghost]:o==="ghost",[e||""]:!!e});return c.jsx("button",{type:n,className:s,style:t,...i,children:r})}const iw={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 Ci({children:e,style:t}){return c.jsx(Cn,{style:{...iw,...t},children:e})}const Io=e=>{const t=ot(),{provider:n}=Ze(),r=e||n;return Wn({queryKey:["amp","providerInfo",r],queryFn:async()=>{if(!r)throw new Error("Provider not found");return(await t()).providerApi.getProvider({provider:r})},enabled:!!r})},lt=e=>{const t=Io(e),{data:n}=t,{provider:r}=Ze(),o=n&&Nv(n==null?void 0:n.name,n);return{...t,providerName:o,selectedProvider:e||r}};function an({error:e}){return e?c.jsx(Ci,{style:{marginTop:"2em"},children:e}):null}const ow="_input_1ymb7_1",sw="_inputError_1ymb7_27",aw="_error_1ymb7_43",Bo={input:ow,inputError:sw,error:aw};function cw({id:e,type:t,className:n,isError:r=!1,...o}){const i=r?Dt(Bo.inputError,Bo.input):Bo.input;return c.jsx("input",{id:e,type:t,className:Dt(i,n),...o})}function lw(){return c.jsx("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:c.jsxs("g",{opacity:"0.5",children:[c.jsx("path",{d:"M14.2821 11.0004C14.2821 12.8154 12.8154 14.2821 11.0004 14.2821C9.18542 14.2821 7.71875 12.8154 7.71875 11.0004C7.71875 9.18542 9.18542 7.71875 11.0004 7.71875C12.8154 7.71875 14.2821 9.18542 14.2821 11.0004Z",stroke:"currentColor",strokeWidth:"1.375",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M10.9999 18.581C14.2357 18.581 17.2515 16.6743 19.3507 13.3743C20.1757 12.0818 20.1757 9.90932 19.3507 8.61682C17.2515 5.31682 14.2357 3.41016 10.9999 3.41016C7.76402 3.41016 4.74819 5.31682 2.64902 8.61682C1.82402 9.90932 1.82402 12.0818 2.64902 13.3743C4.74819 16.6743 7.76402 18.581 10.9999 18.581Z",stroke:"currentColor",strokeWidth:"1.375",strokeLinecap:"round",strokeLinejoin:"round"})]})})}function uw(){return c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:[c.jsx("path",{d:"M13.3187 8.68036L8.68036 13.3187C8.06528 12.7036 7.71973 11.8694 7.71973 10.9995C7.71973 10.5688 7.80456 10.1423 7.96939 9.7444C8.13421 9.34648 8.3758 8.98491 8.68036 8.68036C8.98491 8.3758 9.34648 8.13421 9.7444 7.96939C10.1423 7.80456 10.5688 7.71973 10.9995 7.71973C11.8694 7.71973 12.7036 8.06528 13.3187 8.68036Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M16.3349 5.28895C14.7307 4.07895 12.8974 3.41895 10.9999 3.41895C7.76402 3.41895 4.74819 5.32561 2.64902 8.62561C1.82402 9.91811 1.82402 12.0906 2.64902 13.3831C3.37319 14.5198 4.21652 15.5006 5.13319 16.2889M7.71819 17.9023C8.76319 18.3423 9.87236 18.5806 10.9999 18.5806C14.2357 18.5806 17.2515 16.6739 19.3507 13.3739C20.1757 12.0814 20.1757 9.90895 19.3507 8.61645C19.0482 8.13978 18.7182 7.69061 18.379 7.26895",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M14.2172 11.6413C14.093 12.2808 13.7806 12.8685 13.32 13.3291C12.8594 13.7897 12.2716 14.1022 11.6322 14.2263M8.68051 13.3188L1.83301 20.1663M20.1663 1.83301L13.3188 8.68051",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function dw({id:e,name:t,placeholder:n="Password",onChange:r,value:o,className:i,isError:s}){const[a,l]=b.useState(!1),d=()=>l(u=>!u);return c.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[c.jsx(bt.Input,{id:e,name:t,type:a?"text":"password",placeholder:n,onChange:r,value:o,className:i,isError:s}),c.jsx($e,{type:"button","aria-label":a?"Hide password":"Show password",style:{height:"2.5rem",width:"2.5rem",display:"flex",alignItems:"center",justifyContent:"center"},onClick:d,variant:"ghost",children:c.jsx("span",{style:{height:"1.5rem",width:"1.5rem"},children:a?c.jsx(uw,{}):c.jsx(lw,{})})})]})}const fw="_textarea_18zl4_1",pw="_textareaError_18zl4_14",hw="_error_18zl4_29",Jo={textarea:fw,textareaError:pw,error:hw};function mw({className:e,isError:t=!1,...n}){const r=t?Dt(Jo.textareaError,Jo.textarea):Jo.textarea;return c.jsx("textarea",{className:Dt(e,r),...n})}const bt={Input:cw,Textarea:mw,PasswordInput:dw},gw=()=>{const{project:e}=Ee(),t=e==null?void 0:e.id,n=ot();return Wn({queryKey:["project",t,"entitlements"],queryFn:async()=>{if(!t)throw new Error("Project ID is required");return(await n()).projectApi.getProject({projectIdOrName:t,includeEntitlements:!0})},enabled:!!t})};function Cu(){var n,r;const{data:e}=gw();return((r=(n=e==null?void 0:e.entitlements)==null?void 0:n.brandingRemoval)==null?void 0:r.value)===!0?null:c.jsxs("footer",{style:{backgroundColor:"light-dark(#EFEFEF, #646266)",padding:"1em",fontSize:"0.8em",color:"gray",display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"0 0 4px 4px",gap:"0.4em"},children:[c.jsx("p",{style:{color:"light-dark(gray, #EFEFEF)"},children:"Secured by"}),c.jsx("a",{href:"https://www.withampersand.com/",target:"_blank","aria-label":"Go to Ampersand",rel:"noreferrer noopener",children:c.jsxs("picture",{children:[c.jsx("source",{srcSet:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",media:"(prefers-color-scheme: light)"}),c.jsx("source",{srcSet:"https://res.cloudinary.com/dycvts6vp/image/upload/v1735853540/ampersand_logo_white.svg",media:"(prefers-color-scheme: dark)"}),c.jsx("img",{style:{height:".8em"},src:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",alt:"Ampersand"})]})})]})}function zn({children:e}){return c.jsx(Gr,{children:c.jsxs(Cn,{children:[c.jsx("div",{style:{padding:"3rem 2rem"},children:e}),c.jsx(Cu,{})]})})}function Qn({children:e}){return c.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function yw({children:e}){return c.jsx("p",{style:{padding:".5em 0"},children:e})}const vw="_link_oo2kv_1",ww={link:vw};function Gs({href:e,className:t,style:n,label:r,children:o,newTab:i=!1}){return c.jsx("a",{className:Dt(ww.link,t),style:n,href:e,"aria-label":r||void 0,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:o})}function ao({url:e,providerDisplayName:t,credentialName:n}){return c.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[c.jsx(Gs,{href:e,newTab:!0,children:c.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," ","about where to find your ",t," ",n,"."]})}function Co(e,t){const n={},r=[];if(e.forEach(o=>{const i=t[o.name];!i||i.trim()===""?r.push(o.displayName||o.name):n[o.name]={value:i,source:"input"}}),r.length>0)throw new Error(`Please fill in the following required fields: ${r.join(", ")}.`);return n}function Lr(e,t){return e.every(n=>{const r=t[n.name];return r&&r.trim()!==""})}function xu({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o,submitButtonType:i}){var x,h;const[s,a]=b.useState({apiKey:""}),l=((x=t.metadata)==null?void 0:x.input)||[],d=w=>{const{name:I,value:O}=w.currentTarget;a(S=>({...S,[I]:O.trim()}))},{apiKey:u}=s,{providerName:f}=lt(e),m=u.length>0,g=Lr(l,s),v=r||!m||!g,y=(h=t.apiKeyOpts)==null?void 0:h.docsURL,p=()=>{const w=Co(l,s);n({apiKey:u,providerMetadata:w})};return c.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[y&&c.jsx(ao,{url:y,providerDisplayName:f||on(e),credentialName:"API key"}),c.jsx(bt.PasswordInput,{id:"apiKey",name:"apiKey",placeholder:"API Key",onChange:d}),l.map(w=>c.jsxs("div",{children:[w.docsURL&&c.jsx(ao,{url:w.docsURL,providerDisplayName:f||on(e),credentialName:w.displayName||w.name}),c.jsx(bt.Input,{id:w.name,name:w.name,type:"text",placeholder:w.displayName||w.name,onChange:d})]},w.name)),c.jsx($e,{style:{marginTop:"1em",width:"100%"},disabled:v,type:i||"submit",onClick:p,variant:o,children:"Next"})]})}function bw({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=lt(e);return c.jsxs(zn,{children:[c.jsx(Qn,{children:`Set up ${i} integration`}),c.jsx(an,{error:r}),c.jsx(xu,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function Iw({...e}){return c.jsx(bw,{...e})}const Cw={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 xo({children:e,style:t}){return c.jsx(Cn,{style:{...Cw,...t},children:e})}const Xs=()=>{const e=ot(),t=qe(),[n,r]=b.useState(null);return{...In({mutationKey:["updateConnection"],mutationFn:async i=>(await e()).connectionApi.updateConnection(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)}}),errorMsg:n}},xw="_divider_1kmoj_1",cc={divider:xw};function Oo({className:e,style:t}){return c.jsx("hr",{className:e?`${cc.divider} ${e}`:cc.divider,style:t})}function Nt({string:e}){return c.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[c.jsx("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:e}),c.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:c.jsx(Oo,{style:{width:"100%",marginLeft:"1rem"}})})]})}function Ow({provider:e}){const{projectIdOrName:t}=Ee(),{providerName:n,data:r}=lt(e),{selectedConnection:o,isConnectionsLoading:i}=Xt(),{mutateAsync:s,isPending:a,error:l}=Xs(),[d,u]=b.useState(null),[f,m]=b.useState(!1),g=()=>m(!1),v=()=>{m(!0),u(null)},y=(l==null?void 0:l.message)||d||null,p=async x=>{g(),u(null);try{await s({projectIdOrName:t||"",connectionId:(o==null?void 0:o.id)||"",updateConnectionRequest:{updateMask:["apiKey"],connection:{apiKey:x.apiKey}}},{onError:h=>{console.error("Update connection error:",h),Me(h,u)},onSuccess:()=>{v()}})}catch(h){console.error("Update connection caught error:",h),Me(h,u)}};return r?c.jsxs(c.Fragment,{children:[c.jsx(Nt,{string:"Update connection"}),c.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[c.jsx("p",{children:`Update ${n} API Key`}),f&&c.jsx(xo,{children:"Connection updated successfully"}),y&&c.jsx(Ci,{children:`Error updating connection ${y}`}),c.jsx(xu,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:p,isButtonDisabled:a||i,buttonVariant:"ghost",submitButtonType:"button"})]})]}):null}function Ou({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o}){var p,x;const[i,s]=b.useState({username:"",password:""}),a=((p=t.metadata)==null?void 0:p.input)||[],{username:l,password:d}=i,{providerName:u}=lt(e),f=h=>{const{name:w,value:I}=h.currentTarget;s(O=>({...O,[w]:I.trim()}))},m=Lr(a,i),g=r||!m,v=()=>{const h=Co(a,i);n({user:l,pass:d,providerMetadata:h})},y=(x=t.basicOpts)==null?void 0:x.docsURL;return c.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[y&&c.jsx(ao,{url:y,providerDisplayName:u||on(e),credentialName:"credentials"}),c.jsx(bt.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:f}),c.jsx(bt.PasswordInput,{id:"password",name:"password",placeholder:"Password",onChange:f}),a.map(h=>c.jsxs("div",{children:[h.docsURL&&c.jsx(ao,{url:h.docsURL,providerDisplayName:u||on(e),credentialName:h.displayName||h.name}),c.jsx(bt.Input,{id:h.name,name:h.name,type:"text",placeholder:h.displayName||h.name,onChange:f})]},h.name)),c.jsx($e,{style:{marginTop:"1em",width:"100%"},disabled:g,type:"button",onClick:v,variant:o,children:"Next"})]})}function _w({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=lt(e);return c.jsxs(zn,{children:[c.jsx(Qn,{children:`Set up ${i} integration`}),c.jsx(an,{error:r}),c.jsx(Ou,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function Sw({...e}){return c.jsx(_w,{...e})}function Ew({provider:e}){const{projectIdOrName:t}=Ee(),{providerName:n,data:r}=lt(e),{selectedConnection:o,isConnectionsLoading:i}=Xt(),{mutateAsync:s,isPending:a,error:l}=Xs(),[d,u]=b.useState(null),[f,m]=b.useState(!1),g=()=>m(!1),v=()=>{m(!0),u(null)},y=(l==null?void 0:l.message)||d||null,p=async x=>{g(),u(null);try{await s({projectIdOrName:t||"",connectionId:(o==null?void 0:o.id)||"",updateConnectionRequest:{updateMask:["basicAuth"],connection:{basicAuth:{username:x.user,password:x.pass}}}},{onError:h=>{console.error(h),Me(h,u)},onSuccess:()=>{v()}})}catch(h){console.error(h),Me(h,u)}};return r?c.jsxs(c.Fragment,{children:[c.jsx(Nt,{string:"Update connection"}),c.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[c.jsx("p",{children:`Update ${n} credentials`}),f&&c.jsx(xo,{children:"Connection updated successfully"}),y&&c.jsx(Ci,{children:`Error updating connection: ${y}`}),c.jsx(Ou,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:p,isButtonDisabled:a||i,buttonVariant:"ghost"})]})]}):null}function _u({provider:e,handleSubmit:t,isButtonDisabled:n,explicitScopesRequired:r,buttonVariant:o}){var I;const[i,s]=b.useState({clientSecret:"",clientId:"",scopes:""}),[a,l]=b.useState(null),{data:d}=Io(e),u=((I=d==null?void 0:d.metadata)==null?void 0:I.input)||[],f=O=>{const{name:S,value:T}=O.currentTarget;s(R=>({...R,[S]:T.trim()})),l(null)},{clientSecret:m,clientId:g,scopes:v}=i,y=m.length>0,p=g.length>0,x=Lr(u,i),h=n||!y||!p||!x,w=()=>{const O=Co(u,i),S={clientId:g,clientSecret:m,providerMetadata:O};r&&v.length>0&&(S.scopes=Tv(v)),t(S)};return c.jsxs(c.Fragment,{children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[c.jsx(bt.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:f}),c.jsx(bt.PasswordInput,{id:"clientSecret",name:"clientSecret",placeholder:"Client Secret",onChange:f}),r&&c.jsx(bt.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:f}),u.map(O=>c.jsx(bt.Input,{id:O.name,name:O.name,type:"text",placeholder:O.displayName||O.name,onChange:f},O.name))]}),c.jsx(an,{error:a}),c.jsx("br",{}),c.jsx($e,{style:{width:"100%"},disabled:h,type:"button",onClick:w,variant:o,children:"Next"})]})}function Nw({provider:e,handleSubmit:t,error:n,isButtonDisabled:r,providerName:o,explicitScopesRequired:i}){return c.jsxs(zn,{children:[c.jsx(Qn,{children:`Set up ${o} integration`}),c.jsx(an,{error:n}),c.jsx("br",{}),c.jsx(_u,{provider:e,handleSubmit:t,isButtonDisabled:r,explicitScopesRequired:i})]})}function Tw({provider:e}){var h;const{projectIdOrName:t}=Ee(),{selectedConnection:n,isConnectionsLoading:r}=Xt(),{providerName:o,data:i}=lt(e),{mutateAsync:s,isPending:a,error:l}=Xs(),[d,u]=b.useState(null),[f,m]=b.useState(!1),g=()=>{m(!1)},v=()=>{m(!0),u(null)},y=(h=i==null?void 0:i.oauth2Opts)==null?void 0:h.explicitScopesRequired,p=(l==null?void 0:l.message)||d||null,x=async w=>{g(),u(null);try{await s({projectIdOrName:t||"",connectionId:(n==null?void 0:n.id)||"",updateConnectionRequest:{updateMask:["oauth2ClientCredentials"],connection:{oauth2ClientCredentials:{clientId:w.clientId,clientSecret:w.clientSecret,scopes:w.scopes}}}}),v()}catch(I){Me(I,u)}};return c.jsxs(c.Fragment,{children:[c.jsx(Nt,{string:"Update connection"}),c.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[c.jsx("p",{children:`Re-authenticate to ${o}`}),f&&c.jsx(xo,{children:"Connection updated successfully"}),p&&c.jsx(Ci,{children:`Error updating connection ${p}`}),c.jsx(_u,{provider:o||"",handleSubmit:x,isButtonDisabled:a||r,explicitScopesRequired:y,buttonVariant:"ghost"})]})]})}const lc=600,uc=600,Rw="AUTHORIZATION_SUCCEEDED",Aw="AUTHORIZATION_FAILED";function Fw(e,t,n,r){return b.useCallback(()=>{if(!r)return;const o=window.screenX+(window.outerWidth-lc)/2,i=window.screenY+(window.outerHeight-uc)/2.5,s=`width=${lc},height=${uc},left=${o},top=${i}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function Pw(e,t,n,r){const o=qe();return b.useCallback(i=>{var s,a;if(i.origin===zl){if(i.data.eventType===Rw){const l=(s=i.data.data)==null?void 0:s.connection;l?(e(l),o.setQueriesData({queryKey:["amp","connections"]},()=>[l]),t==null||t.close(),r==null||r(),o.invalidateQueries({queryKey:["amp","connections"]})):console.error("Connection ID not found in event data: ",{event:i})}i.data.eventType===Aw&&(console.error("OAuth failed: ",{event:i}),n==null||n(((a=i==null?void 0:i.data)==null?void 0:a.message)??"Something went wrong. Please try again."))}},[t,n,o,e,r])}function Dw({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:o,onSuccessConnect:i,isSuccessConnect:s,onWindowClose:a}){const[l,d]=b.useState(null),[u,f]=b.useState(null),m=qe(),g=b.useRef(null),v=Pw(d,u,r,i),y=Fw(n,f,v,t);b.useEffect(()=>{t&&!u&&!l&&!o&&!s&&(r==null||r(null),y())},[t,u,y,l,o,s,r]);const p=b.useCallback(()=>{m.invalidateQueries({queryKey:["amp","connections"]}),f(null),!l&&!o?console.error("Window closed and no connection was found. Please try again."):l&&(r==null||r(null)),a==null||a()},[l,o,r,a,m]);return b.useEffect(()=>{if(u)return g.current=setInterval(()=>{u!=null&&u.closed&&(g.current&&clearInterval(g.current),g.current=null,p())},500),()=>{g.current&&(clearInterval(g.current),g.current=null),window.removeEventListener("message",v)}},[p,u,v]),c.jsx("div",{children:e})}const Mw=()=>{const e=ot(),t=qe();return In({mutationKey:["updateOauthConnection"],mutationFn:async n=>{const r=await e();if(!n.projectIdOrName||!n.connectionId)throw new Error("Project ID and connection ID are required");return r.oAuthApi.oauthUpdate(n)},onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})};function kw({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return c.jsxs("div",{style:{padding:"1rem 0"},children:[c.jsx("p",{children:`Re-authenticate to ${r}`}),c.jsx(an,{error:t}),c.jsx($e,{variant:"ghost",style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function jw({provider:e}){const{selectedConnection:t,isConnectionsLoading:n}=Xt(),r=t==null?void 0:t.id,o=t==null?void 0:t.projectId,{providerName:i}=lt(e),{mutateAsync:s,isPending:a,error:l}=Mw(),[d,u]=b.useState(null),[f,m]=b.useState(!1),[g,v]=b.useState(null),y=()=>{m(!1)},p=()=>{m(!0),u(null),v(null)},x=(l==null?void 0:l.message)||d||null,h=async()=>{y(),u(null);try{const I=await s({projectIdOrName:o||"",connectionId:r||""});v(I)}catch(I){Me(I,u)}},w=b.useCallback(I=>{u(I)},[]);return c.jsxs(c.Fragment,{children:[c.jsx(Nt,{string:"Update connection"}),f&&c.jsx(xo,{children:"Connection updated successfully"}),c.jsx(Dw,{windowTitle:`Connect to ${i}`,oauthUrl:g||null,onError:w,error:x,isSuccessConnect:f,onSuccessConnect:p,children:c.jsx(kw,{handleSubmit:h,error:x,providerName:i,isButtonDisabled:a||n||f})})]})}function Ys({provider:e}){var r;const{data:t}=Io(e);if((t==null?void 0:t.authType)===tc.Basic)return c.jsx(Ew,{provider:e});if((t==null?void 0:t.authType)===tc.ApiKey)return c.jsx(Ow,{provider:e});const n=(r=t==null?void 0:t.oauth2Opts)==null?void 0:r.grantType;if(n){if(n===$o.AuthorizationCode||n===$o.AuthorizationCodePkce)return c.jsx(jw,{provider:e});if(n===$o.ClientCredentials)return c.jsx(Tw,{provider:e})}return null}const Lw=()=>{const e=ot(),t=qe(),[n,r]=b.useState(null);return{...In({mutationKey:["deleteConnection"],mutationFn:async i=>(await e()).connectionApi.deleteConnection(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)},onError:i=>{console.error("Error deleting connection"),Me(i,r)}}),errorMsg:n}};function Su({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:o,onDisconnectError:i}){const{projectId:s}=Ee(),{selectedConnection:a}=Xt(),{mutate:l,isPending:d}=Lw(),u=!s||!a||!a.id||d,f=async()=>{u||(console.warn("deleting connection",{projectId:s,connectionId:a==null?void 0:a.id}),l({projectIdOrName:s,connectionId:a==null?void 0:a.id},{onSuccess:()=>{console.warn("successfully deleted connection:",a==null?void 0:a.id),r==null||r(a),o()},onError:v=>{Me(v,i)}}))},m=d?"Pending...":e;return c.jsx($e,{type:"button",onClick:f,disabled:u,variant:t,style:n,children:m})}const Eu=b.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),Yr=()=>{const e=b.useContext(Eu);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e},qw=()=>{var d;const e=qe(),t=ot(),{selectedConnection:n,isConnectionsLoading:r}=Xt(),{projectIdOrName:o}=Ee(),{integrationId:i,integrationObj:s}=Ze(),a=n==null?void 0:n.id,l=(d=s==null?void 0:s.latestRevision)==null?void 0:d.id;return b.useEffect(()=>{a||e.invalidateQueries({queryKey:["amp","hydratedRevision"]})},[a,e]),Wn({queryKey:["amp","hydratedRevision",o,i,l,a],queryFn:async()=>{if(!o)throw new Error("projectIdOrName is required");if(!i)throw new Error("integrationId is required");if(!l)throw new Error("revisionId is required");if(!a)throw new Error("connectionId is required");return(await t()).revisionApi.getHydratedRevision({projectIdOrName:o,integrationId:i,revisionId:l,connectionId:a})},retry:3,enabled:!!o&&!!i&&!!l&&!!a&&!r})};function Kw({children:e,resetComponent:t}){const{integrationId:n,integrationObj:r}=Ze(),{isError:o,removeError:i,setError:s}=Mt(),a=(r==null?void 0:r.name)||n,[l,d]=b.useState(null),[u,f]=b.useState(null),{data:m,isLoading:g,isError:v,error:y}=qw();b.useEffect(()=>{v?(s(ue.HYDRATED_REVISION,a),Me(y,d)):(i(ue.HYDRATED_REVISION,a),d(null),f(null))},[v,a,s,i,y,d]);const p=b.useMemo(()=>{var h,w,I;return{hydratedRevision:m||null,loading:g,readAction:(h=m==null?void 0:m.content)==null?void 0:h.read,writeObjects:((I=(w=m==null?void 0:m.content)==null?void 0:w.write)==null?void 0:I.objects)||[]}},[m,g]);if(g)return c.jsx(Xr,{});const x=(r==null?void 0:r.provider)||"provider";if(o(ue.HYDRATED_REVISION,a)){const h=(r==null?void 0:r.name)||n||"unknown integration",w=`${l?`: ${l}`:`Error retrieving objects from ${x} or integration details for ${h}`}`;return c.jsx(Wt,{message:w,children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",paddingTop:"1rem",width:"100%"},children:[c.jsx(Ys,{provider:x}),c.jsx("p",{children:"If authentication is failing, please try reauthenticating using the section above before deleting and recreating the connection."}),u&&c.jsx(eu,{message:u}),c.jsx(Su,{buttonText:"Delete Connection",resetComponent:t,buttonVariant:"danger",onDisconnectError:I=>f(I)})]})})}return c.jsx(Eu.Provider,{value:p,children:e})}function vn(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 he(){return he=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},he.apply(null,arguments)}function Is(e,t){return Is=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Is(e,t)}function Uw(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Is(e,t)}var Cs={exports:{}},Ji={exports:{}},Ce={};/** @license React v16.13.1
11
11
  * react-is.production.min.js
12
12
  *
13
13
  * Copyright (c) Facebook, Inc. and its affiliates.
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var uc;function qw(){if(uc)return Ce;uc=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,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,a=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,d=e?Symbol.for("react.concurrent_mode"):60111,u=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,g=e?Symbol.for("react.memo"):60115,v=e?Symbol.for("react.lazy"):60116,y=e?Symbol.for("react.block"):60121,p=e?Symbol.for("react.fundamental"):60117,x=e?Symbol.for("react.responder"):60118,h=e?Symbol.for("react.scope"):60119;function w(O){if(typeof O=="object"&&O!==null){var S=O.$$typeof;switch(S){case t:switch(O=O.type,O){case c:case d:case r:case i:case o:case f:return O;default:switch(O=O&&O.$$typeof,O){case a:case u:case v:case g:case s:return O;default:return S}}case n:return S}}}function I(O){return w(O)===d}return Ce.AsyncMode=c,Ce.ConcurrentMode=d,Ce.ContextConsumer=a,Ce.ContextProvider=s,Ce.Element=t,Ce.ForwardRef=u,Ce.Fragment=r,Ce.Lazy=v,Ce.Memo=g,Ce.Portal=n,Ce.Profiler=i,Ce.StrictMode=o,Ce.Suspense=f,Ce.isAsyncMode=function(O){return I(O)||w(O)===c},Ce.isConcurrentMode=I,Ce.isContextConsumer=function(O){return w(O)===a},Ce.isContextProvider=function(O){return w(O)===s},Ce.isElement=function(O){return typeof O=="object"&&O!==null&&O.$$typeof===t},Ce.isForwardRef=function(O){return w(O)===u},Ce.isFragment=function(O){return w(O)===r},Ce.isLazy=function(O){return w(O)===v},Ce.isMemo=function(O){return w(O)===g},Ce.isPortal=function(O){return w(O)===n},Ce.isProfiler=function(O){return w(O)===i},Ce.isStrictMode=function(O){return w(O)===o},Ce.isSuspense=function(O){return w(O)===f},Ce.isValidElementType=function(O){return typeof O=="string"||typeof O=="function"||O===r||O===d||O===i||O===o||O===f||O===m||typeof O=="object"&&O!==null&&(O.$$typeof===v||O.$$typeof===g||O.$$typeof===s||O.$$typeof===a||O.$$typeof===u||O.$$typeof===p||O.$$typeof===x||O.$$typeof===h||O.$$typeof===y)},Ce.typeOf=w,Ce}var xe={};/** @license React v16.13.1
17
+ */var dc;function Vw(){if(dc)return Ce;dc=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,o=e?Symbol.for("react.strict_mode"):60108,i=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,d=e?Symbol.for("react.concurrent_mode"):60111,u=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,g=e?Symbol.for("react.memo"):60115,v=e?Symbol.for("react.lazy"):60116,y=e?Symbol.for("react.block"):60121,p=e?Symbol.for("react.fundamental"):60117,x=e?Symbol.for("react.responder"):60118,h=e?Symbol.for("react.scope"):60119;function w(O){if(typeof O=="object"&&O!==null){var S=O.$$typeof;switch(S){case t:switch(O=O.type,O){case l:case d:case r:case i:case o:case f:return O;default:switch(O=O&&O.$$typeof,O){case a:case u:case v:case g:case s:return O;default:return S}}case n:return S}}}function I(O){return w(O)===d}return Ce.AsyncMode=l,Ce.ConcurrentMode=d,Ce.ContextConsumer=a,Ce.ContextProvider=s,Ce.Element=t,Ce.ForwardRef=u,Ce.Fragment=r,Ce.Lazy=v,Ce.Memo=g,Ce.Portal=n,Ce.Profiler=i,Ce.StrictMode=o,Ce.Suspense=f,Ce.isAsyncMode=function(O){return I(O)||w(O)===l},Ce.isConcurrentMode=I,Ce.isContextConsumer=function(O){return w(O)===a},Ce.isContextProvider=function(O){return w(O)===s},Ce.isElement=function(O){return typeof O=="object"&&O!==null&&O.$$typeof===t},Ce.isForwardRef=function(O){return w(O)===u},Ce.isFragment=function(O){return w(O)===r},Ce.isLazy=function(O){return w(O)===v},Ce.isMemo=function(O){return w(O)===g},Ce.isPortal=function(O){return w(O)===n},Ce.isProfiler=function(O){return w(O)===i},Ce.isStrictMode=function(O){return w(O)===o},Ce.isSuspense=function(O){return w(O)===f},Ce.isValidElementType=function(O){return typeof O=="string"||typeof O=="function"||O===r||O===d||O===i||O===o||O===f||O===m||typeof O=="object"&&O!==null&&(O.$$typeof===v||O.$$typeof===g||O.$$typeof===s||O.$$typeof===a||O.$$typeof===u||O.$$typeof===p||O.$$typeof===x||O.$$typeof===h||O.$$typeof===y)},Ce.typeOf=w,Ce}var xe={};/** @license React v16.13.1
18
18
  * react-is.development.js
19
19
  *
20
20
  * Copyright (c) Facebook, Inc. and its affiliates.
21
21
  *
22
22
  * This source code is licensed under the MIT license found in the
23
23
  * LICENSE file in the root directory of this source tree.
24
- */var dc;function Kw(){return dc||(dc=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,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,a=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,d=e?Symbol.for("react.concurrent_mode"):60111,u=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,g=e?Symbol.for("react.memo"):60115,v=e?Symbol.for("react.lazy"):60116,y=e?Symbol.for("react.block"):60121,p=e?Symbol.for("react.fundamental"):60117,x=e?Symbol.for("react.responder"):60118,h=e?Symbol.for("react.scope"):60119;function w(j){return typeof j=="string"||typeof j=="function"||j===r||j===d||j===i||j===o||j===f||j===m||typeof j=="object"&&j!==null&&(j.$$typeof===v||j.$$typeof===g||j.$$typeof===s||j.$$typeof===a||j.$$typeof===u||j.$$typeof===p||j.$$typeof===x||j.$$typeof===h||j.$$typeof===y)}function I(j){if(typeof j=="object"&&j!==null){var we=j.$$typeof;switch(we){case t:var z=j.type;switch(z){case c:case d:case r:case i:case o:case f:return z;default:var Ne=z&&z.$$typeof;switch(Ne){case a:case u:case v:case g:case s:return Ne;default:return we}}case n:return we}}}var O=c,S=d,T=a,R=s,A=t,D=u,B=r,$=v,L=g,J=n,ae=i,re=o,ne=f,ge=!1;function be(j){return ge||(ge=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),F(j)||I(j)===c}function F(j){return I(j)===d}function q(j){return I(j)===a}function H(j){return I(j)===s}function U(j){return typeof j=="object"&&j!==null&&j.$$typeof===t}function K(j){return I(j)===u}function M(j){return I(j)===r}function Z(j){return I(j)===v}function ee(j){return I(j)===g}function W(j){return I(j)===n}function te(j){return I(j)===i}function X(j){return I(j)===o}function de(j){return I(j)===f}xe.AsyncMode=O,xe.ConcurrentMode=S,xe.ContextConsumer=T,xe.ContextProvider=R,xe.Element=A,xe.ForwardRef=D,xe.Fragment=B,xe.Lazy=$,xe.Memo=L,xe.Portal=J,xe.Profiler=ae,xe.StrictMode=re,xe.Suspense=ne,xe.isAsyncMode=be,xe.isConcurrentMode=F,xe.isContextConsumer=q,xe.isContextProvider=H,xe.isElement=U,xe.isForwardRef=K,xe.isFragment=M,xe.isLazy=Z,xe.isMemo=ee,xe.isPortal=W,xe.isProfiler=te,xe.isStrictMode=X,xe.isSuspense=de,xe.isValidElementType=w,xe.typeOf=I}()),xe}var fc;function Eu(){return fc||(fc=1,process.env.NODE_ENV==="production"?Wi.exports=qw():Wi.exports=Kw()),Wi.exports}/*
24
+ */var fc;function $w(){return fc||(fc=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,o=e?Symbol.for("react.strict_mode"):60108,i=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,d=e?Symbol.for("react.concurrent_mode"):60111,u=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,g=e?Symbol.for("react.memo"):60115,v=e?Symbol.for("react.lazy"):60116,y=e?Symbol.for("react.block"):60121,p=e?Symbol.for("react.fundamental"):60117,x=e?Symbol.for("react.responder"):60118,h=e?Symbol.for("react.scope"):60119;function w(j){return typeof j=="string"||typeof j=="function"||j===r||j===d||j===i||j===o||j===f||j===m||typeof j=="object"&&j!==null&&(j.$$typeof===v||j.$$typeof===g||j.$$typeof===s||j.$$typeof===a||j.$$typeof===u||j.$$typeof===p||j.$$typeof===x||j.$$typeof===h||j.$$typeof===y)}function I(j){if(typeof j=="object"&&j!==null){var we=j.$$typeof;switch(we){case t:var z=j.type;switch(z){case l:case d:case r:case i:case o:case f:return z;default:var Ne=z&&z.$$typeof;switch(Ne){case a:case u:case v:case g:case s:return Ne;default:return we}}case n:return we}}}var O=l,S=d,T=a,R=s,A=t,D=u,B=r,$=v,L=g,J=n,ae=i,re=o,ne=f,ge=!1;function be(j){return ge||(ge=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),F(j)||I(j)===l}function F(j){return I(j)===d}function q(j){return I(j)===a}function H(j){return I(j)===s}function U(j){return typeof j=="object"&&j!==null&&j.$$typeof===t}function K(j){return I(j)===u}function M(j){return I(j)===r}function Z(j){return I(j)===v}function ee(j){return I(j)===g}function W(j){return I(j)===n}function te(j){return I(j)===i}function X(j){return I(j)===o}function de(j){return I(j)===f}xe.AsyncMode=O,xe.ConcurrentMode=S,xe.ContextConsumer=T,xe.ContextProvider=R,xe.Element=A,xe.ForwardRef=D,xe.Fragment=B,xe.Lazy=$,xe.Memo=L,xe.Portal=J,xe.Profiler=ae,xe.StrictMode=re,xe.Suspense=ne,xe.isAsyncMode=be,xe.isConcurrentMode=F,xe.isContextConsumer=q,xe.isContextProvider=H,xe.isElement=U,xe.isForwardRef=K,xe.isFragment=M,xe.isLazy=Z,xe.isMemo=ee,xe.isPortal=W,xe.isProfiler=te,xe.isStrictMode=X,xe.isSuspense=de,xe.isValidElementType=w,xe.typeOf=I}()),xe}var pc;function Nu(){return pc||(pc=1,process.env.NODE_ENV==="production"?Ji.exports=Vw():Ji.exports=$w()),Ji.exports}/*
25
25
  object-assign
26
26
  (c) Sindre Sorhus
27
27
  @license MIT
28
- */var Wo,pc;function Uw(){if(pc)return Wo;pc=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function o(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var s={},a=0;a<10;a++)s["_"+String.fromCharCode(a)]=a;var c=Object.getOwnPropertyNames(s).map(function(u){return s[u]});if(c.join("")!=="0123456789")return!1;var d={};return"abcdefghijklmnopqrst".split("").forEach(function(u){d[u]=u}),Object.keys(Object.assign({},d)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Wo=o()?Object.assign:function(i,s){for(var a,c=r(i),d,u=1;u<arguments.length;u++){a=Object(arguments[u]);for(var f in a)t.call(a,f)&&(c[f]=a[f]);if(e){d=e(a);for(var m=0;m<d.length;m++)n.call(a,d[m])&&(c[d[m]]=a[d[m]])}}return c},Wo}var zo,hc;function Ys(){if(hc)return zo;hc=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return zo=e,zo}var Qo,mc;function Nu(){return mc||(mc=1,Qo=Function.call.bind(Object.prototype.hasOwnProperty)),Qo}var Go,gc;function Vw(){if(gc)return Go;gc=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Ys(),n={},r=Nu();e=function(i){var s="Warning: "+i;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function o(i,s,a,c,d){if(process.env.NODE_ENV!=="production"){for(var u in i)if(r(i,u)){var f;try{if(typeof i[u]!="function"){var m=Error((c||"React class")+": "+a+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw m.name="Invariant Violation",m}f=i[u](s,u,c,a,null,t)}catch(v){f=v}if(f&&!(f instanceof Error)&&e((c||"React class")+": type specification of "+a+" `"+u+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof f+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),f instanceof Error&&!(f.message in n)){n[f.message]=!0;var g=d?d():"";e("Failed "+a+" type: "+f.message+(g??""))}}}}return o.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Go=o,Go}var Xo,yc;function $w(){if(yc)return Xo;yc=1;var e=Eu(),t=Uw(),n=Ys(),r=Nu(),o=Vw(),i=function(){};process.env.NODE_ENV!=="production"&&(i=function(a){var c="Warning: "+a;typeof console<"u"&&console.error(c);try{throw new Error(c)}catch{}});function s(){return null}return Xo=function(a,c){var d=typeof Symbol=="function"&&Symbol.iterator,u="@@iterator";function f(F){var q=F&&(d&&F[d]||F[u]);if(typeof q=="function")return q}var m="<<anonymous>>",g={array:x("array"),bigint:x("bigint"),bool:x("boolean"),func:x("function"),number:x("number"),object:x("object"),string:x("string"),symbol:x("symbol"),any:h(),arrayOf:w,element:I(),elementType:O(),instanceOf:S,node:D(),objectOf:R,oneOf:T,oneOfType:A,shape:$,exact:L};function v(F,q){return F===q?F!==0||1/F===1/q:F!==F&&q!==q}function y(F,q){this.message=F,this.data=q&&typeof q=="object"?q:{},this.stack=""}y.prototype=Error.prototype;function p(F){if(process.env.NODE_ENV!=="production")var q={},H=0;function U(M,Z,ee,W,te,X,de){if(W=W||m,X=X||ee,de!==n){if(c){var j=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 j.name="Invariant Violation",j}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var we=W+":"+ee;!q[we]&&H<3&&(i("You are manually calling a React.PropTypes validation function for the `"+X+"` prop on `"+W+"`. 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."),q[we]=!0,H++)}}return Z[ee]==null?M?Z[ee]===null?new y("The "+te+" `"+X+"` is marked as required "+("in `"+W+"`, but its value is `null`.")):new y("The "+te+" `"+X+"` is marked as required in "+("`"+W+"`, but its value is `undefined`.")):null:F(Z,ee,W,te,X)}var K=U.bind(null,!1);return K.isRequired=U.bind(null,!0),K}function x(F){function q(H,U,K,M,Z,ee){var W=H[U],te=re(W);if(te!==F){var X=ne(W);return new y("Invalid "+M+" `"+Z+"` of type "+("`"+X+"` supplied to `"+K+"`, expected ")+("`"+F+"`."),{expectedType:F})}return null}return p(q)}function h(){return p(s)}function w(F){function q(H,U,K,M,Z){if(typeof F!="function")return new y("Property `"+Z+"` of component `"+K+"` has invalid PropType notation inside arrayOf.");var ee=H[U];if(!Array.isArray(ee)){var W=re(ee);return new y("Invalid "+M+" `"+Z+"` of type "+("`"+W+"` supplied to `"+K+"`, expected an array."))}for(var te=0;te<ee.length;te++){var X=F(ee,te,K,M,Z+"["+te+"]",n);if(X instanceof Error)return X}return null}return p(q)}function I(){function F(q,H,U,K,M){var Z=q[H];if(!a(Z)){var ee=re(Z);return new y("Invalid "+K+" `"+M+"` of type "+("`"+ee+"` supplied to `"+U+"`, expected a single ReactElement."))}return null}return p(F)}function O(){function F(q,H,U,K,M){var Z=q[H];if(!e.isValidElementType(Z)){var ee=re(Z);return new y("Invalid "+K+" `"+M+"` of type "+("`"+ee+"` supplied to `"+U+"`, expected a single ReactElement type."))}return null}return p(F)}function S(F){function q(H,U,K,M,Z){if(!(H[U]instanceof F)){var ee=F.name||m,W=be(H[U]);return new y("Invalid "+M+" `"+Z+"` of type "+("`"+W+"` supplied to `"+K+"`, expected ")+("instance of `"+ee+"`."))}return null}return p(q)}function T(F){if(!Array.isArray(F))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("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])."):i("Invalid argument supplied to oneOf, expected an array.")),s;function q(H,U,K,M,Z){for(var ee=H[U],W=0;W<F.length;W++)if(v(ee,F[W]))return null;var te=JSON.stringify(F,function(de,j){var we=ne(j);return we==="symbol"?String(j):j});return new y("Invalid "+M+" `"+Z+"` of value `"+String(ee)+"` "+("supplied to `"+K+"`, expected one of "+te+"."))}return p(q)}function R(F){function q(H,U,K,M,Z){if(typeof F!="function")return new y("Property `"+Z+"` of component `"+K+"` has invalid PropType notation inside objectOf.");var ee=H[U],W=re(ee);if(W!=="object")return new y("Invalid "+M+" `"+Z+"` of type "+("`"+W+"` supplied to `"+K+"`, expected an object."));for(var te in ee)if(r(ee,te)){var X=F(ee,te,K,M,Z+"."+te,n);if(X instanceof Error)return X}return null}return p(q)}function A(F){if(!Array.isArray(F))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var q=0;q<F.length;q++){var H=F[q];if(typeof H!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+ge(H)+" at index "+q+"."),s}function U(K,M,Z,ee,W){for(var te=[],X=0;X<F.length;X++){var de=F[X],j=de(K,M,Z,ee,W,n);if(j==null)return null;j.data&&r(j.data,"expectedType")&&te.push(j.data.expectedType)}var we=te.length>0?", expected one of type ["+te.join(", ")+"]":"";return new y("Invalid "+ee+" `"+W+"` supplied to "+("`"+Z+"`"+we+"."))}return p(U)}function D(){function F(q,H,U,K,M){return J(q[H])?null:new y("Invalid "+K+" `"+M+"` supplied to "+("`"+U+"`, expected a ReactNode."))}return p(F)}function B(F,q,H,U,K){return new y((F||"React class")+": "+q+" type `"+H+"."+U+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+K+"`.")}function $(F){function q(H,U,K,M,Z){var ee=H[U],W=re(ee);if(W!=="object")return new y("Invalid "+M+" `"+Z+"` of type `"+W+"` "+("supplied to `"+K+"`, expected `object`."));for(var te in F){var X=F[te];if(typeof X!="function")return B(K,M,Z,te,ne(X));var de=X(ee,te,K,M,Z+"."+te,n);if(de)return de}return null}return p(q)}function L(F){function q(H,U,K,M,Z){var ee=H[U],W=re(ee);if(W!=="object")return new y("Invalid "+M+" `"+Z+"` of type `"+W+"` "+("supplied to `"+K+"`, expected `object`."));var te=t({},H[U],F);for(var X in te){var de=F[X];if(r(F,X)&&typeof de!="function")return B(K,M,Z,X,ne(de));if(!de)return new y("Invalid "+M+" `"+Z+"` key `"+X+"` supplied to `"+K+"`.\nBad object: "+JSON.stringify(H[U],null," ")+`
29
- Valid keys: `+JSON.stringify(Object.keys(F),null," "));var j=de(ee,X,K,M,Z+"."+X,n);if(j)return j}return null}return p(q)}function J(F){switch(typeof F){case"number":case"string":case"undefined":return!0;case"boolean":return!F;case"object":if(Array.isArray(F))return F.every(J);if(F===null||a(F))return!0;var q=f(F);if(q){var H=q.call(F),U;if(q!==F.entries){for(;!(U=H.next()).done;)if(!J(U.value))return!1}else for(;!(U=H.next()).done;){var K=U.value;if(K&&!J(K[1]))return!1}}else return!1;return!0;default:return!1}}function ae(F,q){return F==="symbol"?!0:q?q["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&q instanceof Symbol:!1}function re(F){var q=typeof F;return Array.isArray(F)?"array":F instanceof RegExp?"object":ae(q,F)?"symbol":q}function ne(F){if(typeof F>"u"||F===null)return""+F;var q=re(F);if(q==="object"){if(F instanceof Date)return"date";if(F instanceof RegExp)return"regexp"}return q}function ge(F){var q=ne(F);switch(q){case"array":case"object":return"an "+q;case"boolean":case"date":case"regexp":return"a "+q;default:return q}}function be(F){return!F.constructor||!F.constructor.name?m:F.constructor.name}return g.checkPropTypes=o,g.resetWarningCache=o.resetWarningCache,g.PropTypes=g,g},Xo}var Yo,vc;function Hw(){if(vc)return Yo;vc=1;var e=Ys();function t(){}function n(){}return n.resetWarningCache=t,Yo=function(){function r(s,a,c,d,u,f){if(f!==e){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}}r.isRequired=r;function o(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},Yo}if(process.env.NODE_ENV!=="production"){var Bw=Eu(),Jw=!0;Cs.exports=$w()(Bw.isElement,Jw)}else Cs.exports=Hw()();var Ww=Cs.exports;const V=Qs(Ww);var xs={exports:{}},Oe={};/**
28
+ */var Wo,hc;function Hw(){if(hc)return Wo;hc=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function o(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[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 d={};return"abcdefghijklmnopqrst".split("").forEach(function(u){d[u]=u}),Object.keys(Object.assign({},d)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Wo=o()?Object.assign:function(i,s){for(var a,l=r(i),d,u=1;u<arguments.length;u++){a=Object(arguments[u]);for(var f in a)t.call(a,f)&&(l[f]=a[f]);if(e){d=e(a);for(var m=0;m<d.length;m++)n.call(a,d[m])&&(l[d[m]]=a[d[m]])}}return l},Wo}var zo,mc;function Zs(){if(mc)return zo;mc=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return zo=e,zo}var Qo,gc;function Tu(){return gc||(gc=1,Qo=Function.call.bind(Object.prototype.hasOwnProperty)),Qo}var Go,yc;function Bw(){if(yc)return Go;yc=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Zs(),n={},r=Tu();e=function(i){var s="Warning: "+i;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function o(i,s,a,l,d){if(process.env.NODE_ENV!=="production"){for(var u in i)if(r(i,u)){var f;try{if(typeof i[u]!="function"){var m=Error((l||"React class")+": "+a+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw m.name="Invariant Violation",m}f=i[u](s,u,l,a,null,t)}catch(v){f=v}if(f&&!(f 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 f+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),f instanceof Error&&!(f.message in n)){n[f.message]=!0;var g=d?d():"";e("Failed "+a+" type: "+f.message+(g??""))}}}}return o.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Go=o,Go}var Xo,vc;function Jw(){if(vc)return Xo;vc=1;var e=Nu(),t=Hw(),n=Zs(),r=Tu(),o=Bw(),i=function(){};process.env.NODE_ENV!=="production"&&(i=function(a){var l="Warning: "+a;typeof console<"u"&&console.error(l);try{throw new Error(l)}catch{}});function s(){return null}return Xo=function(a,l){var d=typeof Symbol=="function"&&Symbol.iterator,u="@@iterator";function f(F){var q=F&&(d&&F[d]||F[u]);if(typeof q=="function")return q}var m="<<anonymous>>",g={array:x("array"),bigint:x("bigint"),bool:x("boolean"),func:x("function"),number:x("number"),object:x("object"),string:x("string"),symbol:x("symbol"),any:h(),arrayOf:w,element:I(),elementType:O(),instanceOf:S,node:D(),objectOf:R,oneOf:T,oneOfType:A,shape:$,exact:L};function v(F,q){return F===q?F!==0||1/F===1/q:F!==F&&q!==q}function y(F,q){this.message=F,this.data=q&&typeof q=="object"?q:{},this.stack=""}y.prototype=Error.prototype;function p(F){if(process.env.NODE_ENV!=="production")var q={},H=0;function U(M,Z,ee,W,te,X,de){if(W=W||m,X=X||ee,de!==n){if(l){var j=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 j.name="Invariant Violation",j}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var we=W+":"+ee;!q[we]&&H<3&&(i("You are manually calling a React.PropTypes validation function for the `"+X+"` prop on `"+W+"`. 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."),q[we]=!0,H++)}}return Z[ee]==null?M?Z[ee]===null?new y("The "+te+" `"+X+"` is marked as required "+("in `"+W+"`, but its value is `null`.")):new y("The "+te+" `"+X+"` is marked as required in "+("`"+W+"`, but its value is `undefined`.")):null:F(Z,ee,W,te,X)}var K=U.bind(null,!1);return K.isRequired=U.bind(null,!0),K}function x(F){function q(H,U,K,M,Z,ee){var W=H[U],te=re(W);if(te!==F){var X=ne(W);return new y("Invalid "+M+" `"+Z+"` of type "+("`"+X+"` supplied to `"+K+"`, expected ")+("`"+F+"`."),{expectedType:F})}return null}return p(q)}function h(){return p(s)}function w(F){function q(H,U,K,M,Z){if(typeof F!="function")return new y("Property `"+Z+"` of component `"+K+"` has invalid PropType notation inside arrayOf.");var ee=H[U];if(!Array.isArray(ee)){var W=re(ee);return new y("Invalid "+M+" `"+Z+"` of type "+("`"+W+"` supplied to `"+K+"`, expected an array."))}for(var te=0;te<ee.length;te++){var X=F(ee,te,K,M,Z+"["+te+"]",n);if(X instanceof Error)return X}return null}return p(q)}function I(){function F(q,H,U,K,M){var Z=q[H];if(!a(Z)){var ee=re(Z);return new y("Invalid "+K+" `"+M+"` of type "+("`"+ee+"` supplied to `"+U+"`, expected a single ReactElement."))}return null}return p(F)}function O(){function F(q,H,U,K,M){var Z=q[H];if(!e.isValidElementType(Z)){var ee=re(Z);return new y("Invalid "+K+" `"+M+"` of type "+("`"+ee+"` supplied to `"+U+"`, expected a single ReactElement type."))}return null}return p(F)}function S(F){function q(H,U,K,M,Z){if(!(H[U]instanceof F)){var ee=F.name||m,W=be(H[U]);return new y("Invalid "+M+" `"+Z+"` of type "+("`"+W+"` supplied to `"+K+"`, expected ")+("instance of `"+ee+"`."))}return null}return p(q)}function T(F){if(!Array.isArray(F))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("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])."):i("Invalid argument supplied to oneOf, expected an array.")),s;function q(H,U,K,M,Z){for(var ee=H[U],W=0;W<F.length;W++)if(v(ee,F[W]))return null;var te=JSON.stringify(F,function(de,j){var we=ne(j);return we==="symbol"?String(j):j});return new y("Invalid "+M+" `"+Z+"` of value `"+String(ee)+"` "+("supplied to `"+K+"`, expected one of "+te+"."))}return p(q)}function R(F){function q(H,U,K,M,Z){if(typeof F!="function")return new y("Property `"+Z+"` of component `"+K+"` has invalid PropType notation inside objectOf.");var ee=H[U],W=re(ee);if(W!=="object")return new y("Invalid "+M+" `"+Z+"` of type "+("`"+W+"` supplied to `"+K+"`, expected an object."));for(var te in ee)if(r(ee,te)){var X=F(ee,te,K,M,Z+"."+te,n);if(X instanceof Error)return X}return null}return p(q)}function A(F){if(!Array.isArray(F))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var q=0;q<F.length;q++){var H=F[q];if(typeof H!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+ge(H)+" at index "+q+"."),s}function U(K,M,Z,ee,W){for(var te=[],X=0;X<F.length;X++){var de=F[X],j=de(K,M,Z,ee,W,n);if(j==null)return null;j.data&&r(j.data,"expectedType")&&te.push(j.data.expectedType)}var we=te.length>0?", expected one of type ["+te.join(", ")+"]":"";return new y("Invalid "+ee+" `"+W+"` supplied to "+("`"+Z+"`"+we+"."))}return p(U)}function D(){function F(q,H,U,K,M){return J(q[H])?null:new y("Invalid "+K+" `"+M+"` supplied to "+("`"+U+"`, expected a ReactNode."))}return p(F)}function B(F,q,H,U,K){return new y((F||"React class")+": "+q+" type `"+H+"."+U+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+K+"`.")}function $(F){function q(H,U,K,M,Z){var ee=H[U],W=re(ee);if(W!=="object")return new y("Invalid "+M+" `"+Z+"` of type `"+W+"` "+("supplied to `"+K+"`, expected `object`."));for(var te in F){var X=F[te];if(typeof X!="function")return B(K,M,Z,te,ne(X));var de=X(ee,te,K,M,Z+"."+te,n);if(de)return de}return null}return p(q)}function L(F){function q(H,U,K,M,Z){var ee=H[U],W=re(ee);if(W!=="object")return new y("Invalid "+M+" `"+Z+"` of type `"+W+"` "+("supplied to `"+K+"`, expected `object`."));var te=t({},H[U],F);for(var X in te){var de=F[X];if(r(F,X)&&typeof de!="function")return B(K,M,Z,X,ne(de));if(!de)return new y("Invalid "+M+" `"+Z+"` key `"+X+"` supplied to `"+K+"`.\nBad object: "+JSON.stringify(H[U],null," ")+`
29
+ Valid keys: `+JSON.stringify(Object.keys(F),null," "));var j=de(ee,X,K,M,Z+"."+X,n);if(j)return j}return null}return p(q)}function J(F){switch(typeof F){case"number":case"string":case"undefined":return!0;case"boolean":return!F;case"object":if(Array.isArray(F))return F.every(J);if(F===null||a(F))return!0;var q=f(F);if(q){var H=q.call(F),U;if(q!==F.entries){for(;!(U=H.next()).done;)if(!J(U.value))return!1}else for(;!(U=H.next()).done;){var K=U.value;if(K&&!J(K[1]))return!1}}else return!1;return!0;default:return!1}}function ae(F,q){return F==="symbol"?!0:q?q["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&q instanceof Symbol:!1}function re(F){var q=typeof F;return Array.isArray(F)?"array":F instanceof RegExp?"object":ae(q,F)?"symbol":q}function ne(F){if(typeof F>"u"||F===null)return""+F;var q=re(F);if(q==="object"){if(F instanceof Date)return"date";if(F instanceof RegExp)return"regexp"}return q}function ge(F){var q=ne(F);switch(q){case"array":case"object":return"an "+q;case"boolean":case"date":case"regexp":return"a "+q;default:return q}}function be(F){return!F.constructor||!F.constructor.name?m:F.constructor.name}return g.checkPropTypes=o,g.resetWarningCache=o.resetWarningCache,g.PropTypes=g,g},Xo}var Yo,wc;function Ww(){if(wc)return Yo;wc=1;var e=Zs();function t(){}function n(){}return n.resetWarningCache=t,Yo=function(){function r(s,a,l,d,u,f){if(f!==e){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}}r.isRequired=r;function o(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},Yo}if(process.env.NODE_ENV!=="production"){var zw=Nu(),Qw=!0;Cs.exports=Jw()(zw.isElement,Qw)}else Cs.exports=Ww()();var Gw=Cs.exports;const V=Qs(Gw);var xs={exports:{}},Oe={};/**
30
30
  * @license React
31
31
  * react-is.production.min.js
32
32
  *
@@ -34,7 +34,7 @@ Valid keys: `+JSON.stringify(Object.keys(F),null," "));var j=de(ee,X,K,M,Z+"."+
34
34
  *
35
35
  * This source code is licensed under the MIT license found in the
36
36
  * LICENSE file in the root directory of this source tree.
37
- */var wc;function zw(){if(wc)return Oe;wc=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen"),v;v=Symbol.for("react.module.reference");function y(p){if(typeof p=="object"&&p!==null){var x=p.$$typeof;switch(x){case e:switch(p=p.type,p){case n:case o:case r:case d:case u:return p;default:switch(p=p&&p.$$typeof,p){case a:case s:case c:case m:case f:case i:return p;default:return x}}case t:return x}}}return Oe.ContextConsumer=s,Oe.ContextProvider=i,Oe.Element=e,Oe.ForwardRef=c,Oe.Fragment=n,Oe.Lazy=m,Oe.Memo=f,Oe.Portal=t,Oe.Profiler=o,Oe.StrictMode=r,Oe.Suspense=d,Oe.SuspenseList=u,Oe.isAsyncMode=function(){return!1},Oe.isConcurrentMode=function(){return!1},Oe.isContextConsumer=function(p){return y(p)===s},Oe.isContextProvider=function(p){return y(p)===i},Oe.isElement=function(p){return typeof p=="object"&&p!==null&&p.$$typeof===e},Oe.isForwardRef=function(p){return y(p)===c},Oe.isFragment=function(p){return y(p)===n},Oe.isLazy=function(p){return y(p)===m},Oe.isMemo=function(p){return y(p)===f},Oe.isPortal=function(p){return y(p)===t},Oe.isProfiler=function(p){return y(p)===o},Oe.isStrictMode=function(p){return y(p)===r},Oe.isSuspense=function(p){return y(p)===d},Oe.isSuspenseList=function(p){return y(p)===u},Oe.isValidElementType=function(p){return typeof p=="string"||typeof p=="function"||p===n||p===o||p===r||p===d||p===u||p===g||typeof p=="object"&&p!==null&&(p.$$typeof===m||p.$$typeof===f||p.$$typeof===i||p.$$typeof===s||p.$$typeof===c||p.$$typeof===v||p.getModuleId!==void 0)},Oe.typeOf=y,Oe}var _e={};/**
37
+ */var bc;function Xw(){if(bc)return Oe;bc=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen"),v;v=Symbol.for("react.module.reference");function y(p){if(typeof p=="object"&&p!==null){var x=p.$$typeof;switch(x){case e:switch(p=p.type,p){case n:case o:case r:case d:case u:return p;default:switch(p=p&&p.$$typeof,p){case a:case s:case l:case m:case f:case i:return p;default:return x}}case t:return x}}}return Oe.ContextConsumer=s,Oe.ContextProvider=i,Oe.Element=e,Oe.ForwardRef=l,Oe.Fragment=n,Oe.Lazy=m,Oe.Memo=f,Oe.Portal=t,Oe.Profiler=o,Oe.StrictMode=r,Oe.Suspense=d,Oe.SuspenseList=u,Oe.isAsyncMode=function(){return!1},Oe.isConcurrentMode=function(){return!1},Oe.isContextConsumer=function(p){return y(p)===s},Oe.isContextProvider=function(p){return y(p)===i},Oe.isElement=function(p){return typeof p=="object"&&p!==null&&p.$$typeof===e},Oe.isForwardRef=function(p){return y(p)===l},Oe.isFragment=function(p){return y(p)===n},Oe.isLazy=function(p){return y(p)===m},Oe.isMemo=function(p){return y(p)===f},Oe.isPortal=function(p){return y(p)===t},Oe.isProfiler=function(p){return y(p)===o},Oe.isStrictMode=function(p){return y(p)===r},Oe.isSuspense=function(p){return y(p)===d},Oe.isSuspenseList=function(p){return y(p)===u},Oe.isValidElementType=function(p){return typeof p=="string"||typeof p=="function"||p===n||p===o||p===r||p===d||p===u||p===g||typeof p=="object"&&p!==null&&(p.$$typeof===m||p.$$typeof===f||p.$$typeof===i||p.$$typeof===s||p.$$typeof===l||p.$$typeof===v||p.getModuleId!==void 0)},Oe.typeOf=y,Oe}var _e={};/**
38
38
  * @license React
39
39
  * react-is.development.js
40
40
  *
@@ -42,11 +42,11 @@ Valid keys: `+JSON.stringify(Object.keys(F),null," "));var j=de(ee,X,K,M,Z+"."+
42
42
  *
43
43
  * This source code is licensed under the MIT license found in the
44
44
  * LICENSE file in the root directory of this source tree.
45
- */var bc;function Qw(){return bc||(bc=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"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen"),v=!1,y=!1,p=!1,x=!1,h=!1,w;w=Symbol.for("react.module.reference");function I(z){return!!(typeof z=="string"||typeof z=="function"||z===n||z===o||h||z===r||z===d||z===u||x||z===g||v||y||p||typeof z=="object"&&z!==null&&(z.$$typeof===m||z.$$typeof===f||z.$$typeof===i||z.$$typeof===s||z.$$typeof===c||z.$$typeof===w||z.getModuleId!==void 0))}function O(z){if(typeof z=="object"&&z!==null){var Ne=z.$$typeof;switch(Ne){case e:var Ve=z.type;switch(Ve){case n:case o:case r:case d:case u:return Ve;default:var et=Ve&&Ve.$$typeof;switch(et){case a:case s:case c:case m:case f:case i:return et;default:return Ne}}case t:return Ne}}}var S=s,T=i,R=e,A=c,D=n,B=m,$=f,L=t,J=o,ae=r,re=d,ne=u,ge=!1,be=!1;function F(z){return ge||(ge=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function q(z){return be||(be=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function H(z){return O(z)===s}function U(z){return O(z)===i}function K(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function M(z){return O(z)===c}function Z(z){return O(z)===n}function ee(z){return O(z)===m}function W(z){return O(z)===f}function te(z){return O(z)===t}function X(z){return O(z)===o}function de(z){return O(z)===r}function j(z){return O(z)===d}function we(z){return O(z)===u}_e.ContextConsumer=S,_e.ContextProvider=T,_e.Element=R,_e.ForwardRef=A,_e.Fragment=D,_e.Lazy=B,_e.Memo=$,_e.Portal=L,_e.Profiler=J,_e.StrictMode=ae,_e.Suspense=re,_e.SuspenseList=ne,_e.isAsyncMode=F,_e.isConcurrentMode=q,_e.isContextConsumer=H,_e.isContextProvider=U,_e.isElement=K,_e.isForwardRef=M,_e.isFragment=Z,_e.isLazy=ee,_e.isMemo=W,_e.isPortal=te,_e.isProfiler=X,_e.isStrictMode=de,_e.isSuspense=j,_e.isSuspenseList=we,_e.isValidElementType=I,_e.typeOf=O}()),_e}process.env.NODE_ENV==="production"?xs.exports=zw():xs.exports=Qw();var Ic=xs.exports;const Cc=e=>typeof e=="object"&&e!=null&&e.nodeType===1,xc=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Zo=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return xc(n.overflowY,t)||xc(n.overflowX,t)||(r=>{const o=(i=>{if(!i.ownerDocument||!i.ownerDocument.defaultView)return null;try{return i.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!o&&(o.clientHeight<r.scrollHeight||o.clientWidth<r.scrollWidth)})(e)}return!1},zi=(e,t,n,r,o,i,s,a)=>i<e&&s>t||i>e&&s<t?0:i<=e&&a<=n||s>=t&&a>=n?i-e-r:s>t&&a<n||i<e&&a>n?s-t+o:0,Gw=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Xw=(e,t)=>{var n,r,o,i;if(typeof document>"u")return[];const{scrollMode:s,block:a,inline:c,boundary:d,skipOverflowHiddenElements:u}=t,f=typeof d=="function"?d:re=>re!==d;if(!Cc(e))throw new TypeError("Invalid target");const m=document.scrollingElement||document.documentElement,g=[];let v=e;for(;Cc(v)&&f(v);){if(v=Gw(v),v===m){g.push(v);break}v!=null&&v===document.body&&Zo(v)&&!Zo(document.documentElement)||v!=null&&Zo(v,u)&&g.push(v)}const y=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,p=(i=(o=window.visualViewport)==null?void 0:o.height)!=null?i:innerHeight,{scrollX:x,scrollY:h}=window,{height:w,width:I,top:O,right:S,bottom:T,left:R}=e.getBoundingClientRect(),{top:A,right:D,bottom:B,left:$}=(re=>{const ne=window.getComputedStyle(re);return{top:parseFloat(ne.scrollMarginTop)||0,right:parseFloat(ne.scrollMarginRight)||0,bottom:parseFloat(ne.scrollMarginBottom)||0,left:parseFloat(ne.scrollMarginLeft)||0}})(e);let L=a==="start"||a==="nearest"?O-A:a==="end"?T+B:O+w/2-A+B,J=c==="center"?R+I/2-$+D:c==="end"?S+D:R-$;const ae=[];for(let re=0;re<g.length;re++){const ne=g[re],{height:ge,width:be,top:F,right:q,bottom:H,left:U}=ne.getBoundingClientRect();if(s==="if-needed"&&O>=0&&R>=0&&T<=p&&S<=y&&O>=F&&T<=H&&R>=U&&S<=q)return ae;const K=getComputedStyle(ne),M=parseInt(K.borderLeftWidth,10),Z=parseInt(K.borderTopWidth,10),ee=parseInt(K.borderRightWidth,10),W=parseInt(K.borderBottomWidth,10);let te=0,X=0;const de="offsetWidth"in ne?ne.offsetWidth-ne.clientWidth-M-ee:0,j="offsetHeight"in ne?ne.offsetHeight-ne.clientHeight-Z-W:0,we="offsetWidth"in ne?ne.offsetWidth===0?0:be/ne.offsetWidth:0,z="offsetHeight"in ne?ne.offsetHeight===0?0:ge/ne.offsetHeight:0;if(m===ne)te=a==="start"?L:a==="end"?L-p:a==="nearest"?zi(h,h+p,p,Z,W,h+L,h+L+w,w):L-p/2,X=c==="start"?J:c==="center"?J-y/2:c==="end"?J-y:zi(x,x+y,y,M,ee,x+J,x+J+I,I),te=Math.max(0,te+h),X=Math.max(0,X+x);else{te=a==="start"?L-F-Z:a==="end"?L-H+W+j:a==="nearest"?zi(F,H,ge,Z,W+j,L,L+w,w):L-(F+ge/2)+j/2,X=c==="start"?J-U-M:c==="center"?J-(U+be/2)+de/2:c==="end"?J-q+ee+de:zi(U,q,be,M,ee+de,J,J+I,I);const{scrollLeft:Ne,scrollTop:Ve}=ne;te=z===0?0:Math.max(0,Math.min(Ve+te/z,ne.scrollHeight-ge/z+j)),X=we===0?0:Math.max(0,Math.min(Ne+X/we,ne.scrollWidth-be/we+de)),L+=Ve-te,J+=Ne-X}ae.push({el:ne,top:te,left:X})}return ae};var Kr=function(){return Kr=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Kr.apply(this,arguments)};var Yw=0;function Oc(e){return typeof e=="function"?e:Ot}function Ot(){}function Tu(e,t){if(e){var n=Xw(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach(function(r){var o=r.el,i=r.top,s=r.left;o.scrollTop=i,o.scrollLeft=s})}}function _c(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function Zs(e,t){var n;function r(){n&&clearTimeout(n)}function o(){for(var i=arguments.length,s=new Array(i),a=0;a<i;a++)s[a]=arguments[a];r(),n=setTimeout(function(){n=null,e.apply(void 0,s)},t)}return o.cancel=r,o}function ze(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var o=arguments.length,i=new Array(o>1?o-1:0),s=1;s<o;s++)i[s-1]=arguments[s];return t.some(function(a){return a&&a.apply(void 0,[r].concat(i)),r.preventDownshiftDefault||r.hasOwnProperty("nativeEvent")&&r.nativeEvent.preventDownshiftDefault})}}function Cr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){t.forEach(function(o){typeof o=="function"?o(r):o&&(o.current=r)})}}function Ru(){return String(Yw++)}function Zw(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 Sc(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function Au(e){return typeof e.type=="string"}function Fu(e){return e.props}function eb(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var tb=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function Qi(e){e===void 0&&(e={});var t={};return tb.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function co(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,r){return n[r]=lo(t,r)?t[r]:e[r],n},{})}function lo(e,t){return e[t]!==void 0}function Os(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function nb(e){return Object.prototype.toString.call(e)==="[object Object]"}function rr(e,t,n,r,o){var i=n.length;if(i===0)return-1;var s=i-1;(typeof e!="number"||e<0||e>s)&&(e=t>0?-1:s+1);var a=e+t;a<0?a=s:a>s&&(a=0);var c=Ur(a,t<0,n,r,o);return c===-1?e>=i?-1:e:c}function Ur(e,t,n,r,o){o===void 0&&(o=!1);var i=n.length;if(t){for(var s=e;s>=0;s--)if(!r(n[s],s))return s}else for(var a=e;a<i;a++)if(!r(n[a],a))return a;return o?Ur(t?i-1:0,t,n,r):-1}function uo(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(o){return o&&(_c(o,e,n)||r&&_c(o,n.document.activeElement,n))})}var ea=Ot;process.env.NODE_ENV!=="production"&&(ea=function(t,n,r){var o="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(i){n[i]!==void 0&&r[i]===void 0?console.error('downshift: A component has changed the controlled prop "'+i+'" to be uncontrolled. '+o):n[i]===void 0&&r[i]!==void 0&&console.error('downshift: A component has changed the uncontrolled prop "'+i+'" to be controlled. '+o)})});var rb=Zs(function(e){Pu(e).textContent=""},500);function Pu(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 Du(e,t){if(!(!e||!t)){var n=Pu(t);n.textContent=e,rb(t)}}function ib(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var Mu=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,ku=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,ju=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,eo=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,to=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,Lu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,qu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,Ku=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,Uu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,Vu=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,$u=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,Hu=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,Bu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,_s=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,Ju=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,Wu=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,zu=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,ob=Object.freeze({__proto__:null,blurButton:Ju,blurInput:$u,changeInput:Hu,clickButton:_s,clickItem:Vu,controlledPropUpdatedSelectedItem:Wu,itemMouseEnter:ju,keyDownArrowDown:to,keyDownArrowUp:eo,keyDownEnd:Uu,keyDownEnter:qu,keyDownEscape:Lu,keyDownHome:Ku,keyDownSpaceButton:Bu,mouseUp:ku,touchEnd:zu,unknown:Mu}),sb=["refKey","ref"],ab=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],cb=["onKeyDown","onBlur","onChange","onInput","onChangeText"],lb=["refKey","ref"],ub=["onMouseMove","onMouseDown","onClick","onPress","index","item"],db=function(){var e=function(t){function n(o){var i;i=t.call(this,o)||this,i.id=i.props.id||"downshift-"+Ru(),i.menuId=i.props.menuId||i.id+"-menu",i.labelId=i.props.labelId||i.id+"-label",i.inputId=i.props.inputId||i.id+"-input",i.getItemId=i.props.getItemId||function(h){return i.id+"-item-"+h},i.items=[],i.itemCount=null,i.previousResultCount=0,i.timeoutIds=[],i.internalSetTimeout=function(h,w){var I=setTimeout(function(){i.timeoutIds=i.timeoutIds.filter(function(O){return O!==I}),h()},w);i.timeoutIds.push(I)},i.setItemCount=function(h){i.itemCount=h},i.unsetItemCount=function(){i.itemCount=null},i.isItemDisabled=function(h,w){var I=i.getItemNodeFromIndex(w);return I&&I.hasAttribute("disabled")},i.setHighlightedIndex=function(h,w){h===void 0&&(h=i.props.defaultHighlightedIndex),w===void 0&&(w={}),w=Qi(w),i.internalSetState(he({highlightedIndex:h},w))},i.clearSelection=function(h){i.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:i.props.defaultHighlightedIndex,isOpen:i.props.defaultIsOpen},h)},i.selectItem=function(h,w,I){w=Qi(w),i.internalSetState(he({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,selectedItem:h,inputValue:i.props.itemToString(h)},w),I)},i.selectItemAtIndex=function(h,w,I){var O=i.items[h];O!=null&&i.selectItem(O,w,I)},i.selectHighlightedItem=function(h,w){return i.selectItemAtIndex(i.getState().highlightedIndex,h,w)},i.internalSetState=function(h,w){var I,O,S={},T=typeof h=="function";return!T&&h.hasOwnProperty("inputValue")&&i.props.onInputValueChange(h.inputValue,he({},i.getStateAndHelpers(),h)),i.setState(function(R){var A;R=i.getState(R);var D=T?h(R):h;D=i.props.stateReducer(R,D),I=D.hasOwnProperty("selectedItem");var B={};return I&&D.selectedItem!==R.selectedItem&&(O=D.selectedItem),(A=D).type||(A.type=Mu),Object.keys(D).forEach(function($){R[$]!==D[$]&&(S[$]=D[$]),$!=="type"&&(D[$],lo(i.props,$)||(B[$]=D[$]))}),T&&D.hasOwnProperty("inputValue")&&i.props.onInputValueChange(D.inputValue,he({},i.getStateAndHelpers(),D)),B},function(){Oc(w)();var R=Object.keys(S).length>1;R&&i.props.onStateChange(S,i.getStateAndHelpers()),I&&i.props.onSelect(h.selectedItem,i.getStateAndHelpers()),O!==void 0&&i.props.onChange(O,i.getStateAndHelpers()),i.props.onUserAction(S,i.getStateAndHelpers())})},i.rootRef=function(h){return i._rootNode=h},i.getRootProps=function(h,w){var I,O=h===void 0?{}:h,S=O.refKey,T=S===void 0?"ref":S,R=O.ref,A=vn(O,sb),D=w===void 0?{}:w,B=D.suppressRefError,$=B===void 0?!1:B;i.getRootProps.called=!0,i.getRootProps.refKey=T,i.getRootProps.suppressRefError=$;var L=i.getState(),J=L.isOpen;return he((I={},I[T]=Cr(R,i.rootRef),I.role="combobox",I["aria-expanded"]=J,I["aria-haspopup"]="listbox",I["aria-owns"]=J?i.menuId:void 0,I["aria-labelledby"]=i.labelId,I),A)},i.keyDownHandlers={ArrowDown:function(w){var I=this;if(w.preventDefault(),this.getState().isOpen){var O=w.shiftKey?5:1;this.moveHighlightedIndex(O,{type:to})}else this.internalSetState({isOpen:!0,type:to},function(){var S=I.getItemCount();if(S>0){var T=I.getState(),R=T.highlightedIndex,A=rr(R,1,{length:S},I.isItemDisabled,!0);I.setHighlightedIndex(A,{type:to})}})},ArrowUp:function(w){var I=this;if(w.preventDefault(),this.getState().isOpen){var O=w.shiftKey?-5:-1;this.moveHighlightedIndex(O,{type:eo})}else this.internalSetState({isOpen:!0,type:eo},function(){var S=I.getItemCount();if(S>0){var T=I.getState(),R=T.highlightedIndex,A=rr(R,-1,{length:S},I.isItemDisabled,!0);I.setHighlightedIndex(A,{type:eo})}})},Enter:function(w){if(w.which!==229){var I=this.getState(),O=I.isOpen,S=I.highlightedIndex;if(O&&S!=null){w.preventDefault();var T=this.items[S],R=this.getItemNodeFromIndex(S);if(T==null||R&&R.hasAttribute("disabled"))return;this.selectHighlightedItem({type:qu})}}},Escape:function(w){w.preventDefault(),this.reset(he({type:Lu},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},i.buttonKeyDownHandlers=he({},i.keyDownHandlers,{" ":function(w){w.preventDefault(),this.toggleMenu({type:Bu})}}),i.inputKeyDownHandlers=he({},i.keyDownHandlers,{Home:function(w){var I=this.getState(),O=I.isOpen;if(O){w.preventDefault();var S=this.getItemCount();if(!(S<=0||!O)){var T=Ur(0,!1,{length:S},this.isItemDisabled);this.setHighlightedIndex(T,{type:Ku})}}},End:function(w){var I=this.getState(),O=I.isOpen;if(O){w.preventDefault();var S=this.getItemCount();if(!(S<=0||!O)){var T=Ur(S-1,!0,{length:S},this.isItemDisabled);this.setHighlightedIndex(T,{type:Uu})}}}}),i.getToggleButtonProps=function(h){var w=h===void 0?{}:h,I=w.onClick;w.onPress;var O=w.onKeyDown,S=w.onKeyUp,T=w.onBlur,R=vn(w,ab),A=i.getState(),D=A.isOpen,B={onClick:ze(I,i.buttonHandleClick),onKeyDown:ze(O,i.buttonHandleKeyDown),onKeyUp:ze(S,i.buttonHandleKeyUp),onBlur:ze(T,i.buttonHandleBlur)},$=R.disabled?{}:B;return he({type:"button",role:"button","aria-label":D?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},$,R)},i.buttonHandleKeyUp=function(h){h.preventDefault()},i.buttonHandleKeyDown=function(h){var w=Os(h);i.buttonKeyDownHandlers[w]&&i.buttonKeyDownHandlers[w].call(i,h)},i.buttonHandleClick=function(h){if(h.preventDefault(),i.props.environment){var w=i.props.environment.document,I=w.body,O=w.activeElement;I&&I===O&&h.target.focus()}process.env.NODE_ENV==="test"?i.toggleMenu({type:_s}):i.internalSetTimeout(function(){return i.toggleMenu({type:_s})})},i.buttonHandleBlur=function(h){var w=h.target;i.internalSetTimeout(function(){if(!(i.isMouseDown||!i.props.environment)){var I=i.props.environment.document.activeElement;(I==null||I.id!==i.inputId)&&I!==w&&i.reset({type:Ju})}})},i.getLabelProps=function(h){return he({htmlFor:i.inputId,id:i.labelId},h)},i.getInputProps=function(h){var w=h===void 0?{}:h,I=w.onKeyDown,O=w.onBlur,S=w.onChange,T=w.onInput;w.onChangeText;var R=vn(w,cb),A,D={};A="onChange";var B=i.getState(),$=B.inputValue,L=B.isOpen,J=B.highlightedIndex;if(!R.disabled){var ae;D=(ae={},ae[A]=ze(S,T,i.inputHandleChange),ae.onKeyDown=ze(I,i.inputHandleKeyDown),ae.onBlur=ze(O,i.inputHandleBlur),ae)}return he({"aria-autocomplete":"list","aria-activedescendant":L&&typeof J=="number"&&J>=0?i.getItemId(J):void 0,"aria-controls":L?i.menuId:void 0,"aria-labelledby":R&&R["aria-label"]?void 0:i.labelId,autoComplete:"off",value:$,id:i.inputId},D,R)},i.inputHandleKeyDown=function(h){var w=Os(h);w&&i.inputKeyDownHandlers[w]&&i.inputKeyDownHandlers[w].call(i,h)},i.inputHandleChange=function(h){i.internalSetState({type:Hu,isOpen:!0,inputValue:h.target.value,highlightedIndex:i.props.defaultHighlightedIndex})},i.inputHandleBlur=function(){i.internalSetTimeout(function(){var h;if(!(i.isMouseDown||!i.props.environment)){var w=i.props.environment.document.activeElement,I=(w==null||(h=w.dataset)==null?void 0:h.toggle)&&i._rootNode&&i._rootNode.contains(w);I||i.reset({type:$u})}})},i.menuRef=function(h){i._menuNode=h},i.getMenuProps=function(h,w){var I,O=h===void 0?{}:h,S=O.refKey,T=S===void 0?"ref":S,R=O.ref,A=vn(O,lb),D=w===void 0?{}:w,B=D.suppressRefError,$=B===void 0?!1:B;return i.getMenuProps.called=!0,i.getMenuProps.refKey=T,i.getMenuProps.suppressRefError=$,he((I={},I[T]=Cr(R,i.menuRef),I.role="listbox",I["aria-labelledby"]=A&&A["aria-label"]?void 0:i.labelId,I.id=i.menuId,I),A)},i.getItemProps=function(h){var w,I=h===void 0?{}:h,O=I.onMouseMove,S=I.onMouseDown,T=I.onClick;I.onPress;var R=I.index,A=I.item,D=A===void 0?process.env.NODE_ENV==="production"?void 0:eb("getItemProps","item"):A,B=vn(I,ub);R===void 0?(i.items.push(D),R=i.items.indexOf(D)):i.items[R]=D;var $="onClick",L=T,J=(w={onMouseMove:ze(O,function(){R!==i.getState().highlightedIndex&&(i.setHighlightedIndex(R,{type:ju}),i.avoidScrolling=!0,i.internalSetTimeout(function(){return i.avoidScrolling=!1},250))}),onMouseDown:ze(S,function(re){re.preventDefault()})},w[$]=ze(L,function(){i.selectItemAtIndex(R,{type:Vu})}),w),ae=B.disabled?{onMouseDown:J.onMouseDown}:J;return he({id:i.getItemId(R),role:"option","aria-selected":i.getState().highlightedIndex===R},ae,B)},i.clearItems=function(){i.items=[]},i.reset=function(h,w){h===void 0&&(h={}),h=Qi(h),i.internalSetState(function(I){var O=I.selectedItem;return he({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,inputValue:i.props.itemToString(O)},h)},w)},i.toggleMenu=function(h,w){h===void 0&&(h={}),h=Qi(h),i.internalSetState(function(I){var O=I.isOpen;return he({isOpen:!O},O&&{highlightedIndex:i.props.defaultHighlightedIndex},h)},function(){var I=i.getState(),O=I.isOpen,S=I.highlightedIndex;O&&i.getItemCount()>0&&typeof S=="number"&&i.setHighlightedIndex(S,h),Oc(w)()})},i.openMenu=function(h){i.internalSetState({isOpen:!0},h)},i.closeMenu=function(h){i.internalSetState({isOpen:!1},h)},i.updateStatus=Zs(function(){var h;if((h=i.props)!=null&&(h=h.environment)!=null&&h.document){var w=i.getState(),I=i.items[w.highlightedIndex],O=i.getItemCount(),S=i.props.getA11yStatusMessage(he({itemToString:i.props.itemToString,previousResultCount:i.previousResultCount,resultCount:O,highlightedItem:I},w));i.previousResultCount=O,Du(S,i.props.environment.document)}},200);var s=i.props,a=s.defaultHighlightedIndex,c=s.initialHighlightedIndex,d=c===void 0?a:c,u=s.defaultIsOpen,f=s.initialIsOpen,m=f===void 0?u:f,g=s.initialInputValue,v=g===void 0?"":g,y=s.initialSelectedItem,p=y===void 0?null:y,x=i.getState({highlightedIndex:d,isOpen:m,inputValue:v,selectedItem:p});return x.selectedItem!=null&&i.props.initialInputValue===void 0&&(x.inputValue=i.props.itemToString(x.selectedItem)),i.state=x,i}Lw(n,t);var r=n.prototype;return r.internalClearTimeouts=function(){this.timeoutIds.forEach(function(i){clearTimeout(i)}),this.timeoutIds=[]},r.getState=function(i){return i===void 0&&(i=this.state),co(i,this.props)},r.getItemCount=function(){var i=this.items.length;return this.itemCount!=null?i=this.itemCount:this.props.itemCount!==void 0&&(i=this.props.itemCount),i},r.getItemNodeFromIndex=function(i){return this.props.environment?this.props.environment.document.getElementById(this.getItemId(i)):null},r.scrollHighlightedItemIntoView=function(){{var i=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(i,this._menuNode)}},r.moveHighlightedIndex=function(i,s){var a=this.getItemCount(),c=this.getState(),d=c.highlightedIndex;if(a>0){var u=rr(d,i,{length:a},this.isItemDisabled,!0);this.setHighlightedIndex(u,s)}},r.getStateAndHelpers=function(){var i=this.getState(),s=i.highlightedIndex,a=i.inputValue,c=i.selectedItem,d=i.isOpen,u=this.props.itemToString,f=this.id,m=this.getRootProps,g=this.getToggleButtonProps,v=this.getLabelProps,y=this.getMenuProps,p=this.getInputProps,x=this.getItemProps,h=this.openMenu,w=this.closeMenu,I=this.toggleMenu,O=this.selectItem,S=this.selectItemAtIndex,T=this.selectHighlightedItem,R=this.setHighlightedIndex,A=this.clearSelection,D=this.clearItems,B=this.reset,$=this.setItemCount,L=this.unsetItemCount,J=this.internalSetState;return{getRootProps:m,getToggleButtonProps:g,getLabelProps:v,getMenuProps:y,getInputProps:p,getItemProps:x,reset:B,openMenu:h,closeMenu:w,toggleMenu:I,selectItem:O,selectItemAtIndex:S,selectHighlightedItem:T,setHighlightedIndex:R,clearSelection:A,clearItems:D,setItemCount:$,unsetItemCount:L,setState:J,itemToString:u,id:f,highlightedIndex:s,inputValue:a,isOpen:d,selectedItem:c}},r.componentDidMount=function(){var i=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&Ec(this._menuNode,this.getMenuProps),!this.props.environment)this.cleanup=function(){i.internalClearTimeouts()};else{var s=function(){i.isMouseDown=!0},a=function(g){i.isMouseDown=!1;var v=uo(g.target,[i._rootNode,i._menuNode],i.props.environment);!v&&i.getState().isOpen&&i.reset({type:ku},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},c=function(){i.isTouchMove=!1},d=function(){i.isTouchMove=!0},u=function(g){var v=uo(g.target,[i._rootNode,i._menuNode],i.props.environment,!1);!i.isTouchMove&&!v&&i.getState().isOpen&&i.reset({type:zu},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},f=this.props.environment;f.addEventListener("mousedown",s),f.addEventListener("mouseup",a),f.addEventListener("touchstart",c),f.addEventListener("touchmove",d),f.addEventListener("touchend",u),this.cleanup=function(){i.internalClearTimeouts(),i.updateStatus.cancel(),f.removeEventListener("mousedown",s),f.removeEventListener("mouseup",a),f.removeEventListener("touchstart",c),f.removeEventListener("touchmove",d),f.removeEventListener("touchend",u)}}},r.shouldScroll=function(i,s){var a=this.props.highlightedIndex===void 0?this.getState():this.props,c=a.highlightedIndex,d=s.highlightedIndex===void 0?i:s,u=d.highlightedIndex,f=c&&this.getState().isOpen&&!i.isOpen,m=c!==u;return f||m},r.componentDidUpdate=function(i,s){process.env.NODE_ENV!=="production"&&(ea(this.state,i,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&Ec(this._menuNode,this.getMenuProps)),lo(this.props,"selectedItem")&&this.props.selectedItemChanged(i.selectedItem,this.props.selectedItem)&&this.internalSetState({type:Wu,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(s,i)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},r.componentWillUnmount=function(){this.cleanup()},r.render=function(){var i=Sc(this.props.children,Ot);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=Sc(i(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&&fb(s,this.getRootProps),s;if(Au(s))return b.cloneElement(s,this.getRootProps(Fu(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}(b.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:Zw,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&nb(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:Ot,onInputValueChange:Ot,onUserAction:Ot,onChange:Ot,onSelect:Ot,onOuterClick:Ot,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:Tu},e.stateChangeTypes=ob,e}();process.env.NODE_ENV!=="production"&&(db.propTypes={children:V.func,defaultHighlightedIndex:V.number,defaultIsOpen:V.bool,initialHighlightedIndex:V.number,initialSelectedItem:V.any,initialInputValue:V.string,initialIsOpen:V.bool,getA11yStatusMessage:V.func,itemToString:V.func,onChange:V.func,onSelect:V.func,onStateChange:V.func,onInputValueChange:V.func,onUserAction:V.func,onOuterClick:V.func,selectedItemChanged:V.func,stateReducer:V.func,itemCount:V.number,id:V.string,environment:V.shape({addEventListener:V.func.isRequired,removeEventListener:V.func.isRequired,document:V.shape({createElement:V.func.isRequired,getElementById:V.func.isRequired,activeElement:V.any.isRequired,body:V.any.isRequired}).isRequired,Node:V.func.isRequired}),suppressRefError:V.bool,scrollIntoView:V.func,selectedItem:V.any,isOpen:V.bool,inputValue:V.string,highlightedIndex:V.number,labelId:V.string,inputId:V.string,menuId:V.string,getItemId:V.func});function Ec(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 fb(e,t){var n=t.refKey,r=n!=="ref",o=!Au(e);o&&!r&&!Ic.isForwardRef(e)?console.error("downshift: You returned a non-DOM element. You must specify a refKey in getRootProps"):!o&&r&&console.error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "'+n+'"'),!Ic.isForwardRef(e)&&!Fu(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Qu={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function pb(e,t,n){var r=e.props,o=e.type,i={};Object.keys(t).forEach(function(s){hb(s,e,t,n),n[s]!==t[s]&&(i[s]=n[s])}),r.onStateChange&&Object.keys(i).length&&r.onStateChange(he({type:o},i))}function hb(e,t,n,r){var o=t.props,i=t.type,s="on"+ta(e)+"Change";o[s]&&r[e]!==void 0&&r[e]!==n[e]&&o[s](he({type:i},r))}function mb(e,t){return t.changes}var Nc=Zs(function(e,t){Du(e,t)},200),gb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?b.useLayoutEffect:b.useEffect,yb="useId"in b?function(t){var n=t.id,r=t.labelId,o=t.menuId,i=t.getItemId,s=t.toggleButtonId,a=t.inputId,c="downshift-"+b.useId();n||(n=c);var d=b.useRef({labelId:r||n+"-label",menuId:o||n+"-menu",getItemId:i||function(u){return n+"-item-"+u},toggleButtonId:s||n+"-toggle-button",inputId:a||n+"-input"});return d.current}:function(t){var n=t.id,r=n===void 0?"downshift-"+Ru():n,o=t.labelId,i=t.menuId,s=t.getItemId,a=t.toggleButtonId,c=t.inputId,d=b.useRef({labelId:o||r+"-label",menuId:i||r+"-menu",getItemId:s||function(u){return r+"-item-"+u},toggleButtonId:a||r+"-toggle-button",inputId:c||r+"-input"});return d.current};function vb(e,t,n,r){var o,i;if(e===void 0){if(t===void 0)throw new Error(r);o=n[t],i=t}else i=t===void 0?n.indexOf(e):t,o=e;return[o,i]}function ta(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Gu(e){var t=b.useRef(e);return t.current=e,t}function wb(e,t,n,r){var o=b.useRef(),i=b.useRef(),s=b.useCallback(function(g,v){i.current=v,g=co(g,v.props);var y=e(g,v),p=v.props.stateReducer(g,he({},v,{changes:y}));return p},[e]),a=b.useReducer(s,t,n),c=a[0],d=a[1],u=Gu(t),f=b.useCallback(function(g){return d(he({props:u.current},g))},[u]),m=i.current;return b.useEffect(function(){var g=co(o.current,m==null?void 0:m.props),v=m&&o.current&&!r(g,c);v&&pb(m,g,c),o.current=c},[c,m,r]),[c,f]}var ci={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:mb,scrollIntoView:Tu,environment:typeof window>"u"?void 0:window};function $n(e,t,n){n===void 0&&(n=Qu);var r=e["default"+ta(t)];return r!==void 0?r:n[t]}function li(e,t,n){n===void 0&&(n=Qu);var r=e[t];if(r!==void 0)return r;var o=e["initial"+ta(t)];return o!==void 0?o:$n(e,t,n)}function bb(e){var t=li(e,"selectedItem"),n=li(e,"isOpen"),r=_b(e),o=li(e,"inputValue");return{highlightedIndex:r<0&&t&&n?e.items.findIndex(function(i){return e.itemToKey(i)===e.itemToKey(t)}):r,isOpen:n,selectedItem:t,inputValue:o}}function ui(e,t,n){var r=e.items,o=e.initialHighlightedIndex,i=e.defaultHighlightedIndex,s=e.isItemDisabled,a=e.itemToKey,c=t.selectedItem,d=t.highlightedIndex;return r.length===0?-1:o!==void 0&&d===o&&!s(r[o],o)?o:i!==void 0&&!s(r[i],i)?i:c?r.findIndex(function(u){return a(c)===a(u)}):n<0&&!s(r[r.length-1],r.length-1)?r.length-1:n>0&&!s(r[0],0)?0:-1}function Ib(e,t,n){var r=b.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return b.useEffect(function(){if(!e)return Ot;var o=n.map(function(u){return u.current});function i(){r.current.isTouchEnd=!1,r.current.isMouseDown=!0}function s(u){r.current.isMouseDown=!1,uo(u.target,o,e)||t()}function a(){r.current.isTouchEnd=!1,r.current.isTouchMove=!1}function c(){r.current.isTouchMove=!0}function d(u){r.current.isTouchEnd=!0,!r.current.isTouchMove&&!uo(u.target,o,e,!1)&&t()}return e.addEventListener("mousedown",i),e.addEventListener("mouseup",s),e.addEventListener("touchstart",a),e.addEventListener("touchmove",c),e.addEventListener("touchend",d),function(){e.removeEventListener("mousedown",i),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",c),e.removeEventListener("touchend",d)}},[n,e,t]),r.current}var Xu=function(){return Ot};process.env.NODE_ENV!=="production"&&(Xu=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=b.useRef(n.reduce(function(s,a){return s[a]={},s},{}));b.useEffect(function(){Object.keys(o.current).forEach(function(s){var a=o.current[s];if(!Object.keys(a).length){console.error("downshift: You forgot to call the "+s+" getter function on your component / element.");return}var c=a.suppressRefError,d=a.refKey,u=a.elementRef;c||u!=null&&u.current||console.error('downshift: The ref prop "'+d+'" from '+s+" was not applied correctly on your element.")})},[]);var i=b.useCallback(function(s,a,c,d){o.current[s]={suppressRefError:a,refKey:c,elementRef:d}},[]);return i});function Cb(e,t,n,r){r===void 0&&(r={});var o=r.document,i=_o();b.useEffect(function(){if(!(!e||i||!o)){var s=e(t);Nc(s,o)}},n),b.useEffect(function(){return function(){Nc.cancel(),ib(o)}},[o])}function xb(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,o=e.getItemNodeFromIndex,i=e.menuElement,s=e.scrollIntoView,a=b.useRef(!0);return gb(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(o(t),i))},[t]),a}var Yu=Ot;process.env.NODE_ENV!=="production"&&(Yu=function(t){var n=t.props,r=t.state,o=b.useRef(n),i=_o();b.useEffect(function(){i||(ea(r,o.current,n),o.current=n)},[r,n,i])});function Tc(e,t,n){var r;n===void 0&&(n=!0);var o=((r=e.items)==null?void 0:r.length)&&t>=0;return he({isOpen:!1,highlightedIndex:-1},o&&he({selectedItem:e.items[t],isOpen:$n(e,"isOpen"),highlightedIndex:$n(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function Ob(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function _o(){var e=b.useRef(!0);return b.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function Ss(e){var t=$n(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function _b(e){var t=li(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var no={environment:V.shape({addEventListener:V.func.isRequired,removeEventListener:V.func.isRequired,document:V.shape({createElement:V.func.isRequired,getElementById:V.func.isRequired,activeElement:V.any.isRequired,body:V.any.isRequired}).isRequired,Node:V.func.isRequired}),itemToString:V.func,itemToKey:V.func,stateReducer:V.func},Zu=he({},no,{getA11yStatusMessage:V.func,highlightedIndex:V.number,defaultHighlightedIndex:V.number,initialHighlightedIndex:V.number,isOpen:V.bool,defaultIsOpen:V.bool,initialIsOpen:V.bool,selectedItem:V.any,initialSelectedItem:V.any,defaultSelectedItem:V.any,id:V.string,labelId:V.string,menuId:V.string,getItemId:V.func,toggleButtonId:V.string,onSelectedItemChange:V.func,onHighlightedIndexChange:V.func,onStateChange:V.func,onIsOpenChange:V.func,scrollIntoView:V.func});function Sb(e,t,n){var r=t.type,o=t.props,i;switch(r){case n.ItemMouseMove:i={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:i={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:i={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:ui(o,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:ui(o,e,0)};break;case n.FunctionCloseMenu:i={isOpen:!1};break;case n.FunctionSetHighlightedIndex:i={highlightedIndex:o.isItemDisabled(o.items[t.highlightedIndex],t.highlightedIndex)?-1:t.highlightedIndex};break;case n.FunctionSetInputValue:i={inputValue:t.inputValue};break;case n.FunctionReset:i={highlightedIndex:Ss(o),isOpen:$n(o,"isOpen"),selectedItem:$n(o,"selectedItem"),inputValue:$n(o,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return he({},e,i)}Kr(Kr({},Zu),{items:V.array.isRequired,isItemDisabled:V.func});Kr(Kr({},ci),{isItemDisabled:function(){return!1}});process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;var na=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,ra=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,ia=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,oa=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,sa=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,aa=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,ca=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,la=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,ua=process.env.NODE_ENV!=="production"?"__input_change__":8,fo=process.env.NODE_ENV!=="production"?"__input_blur__":9,da=process.env.NODE_ENV!=="production"?"__input_click__":10,ed=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,td=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,fa=process.env.NODE_ENV!=="production"?"__item_click__":13,nd=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,rd=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,id=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,od=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,sd=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,pa=process.env.NODE_ENV!=="production"?"__function_select_item__":19,ad=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,cd=process.env.NODE_ENV!=="production"?"__function_reset__":21,ha=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,ld=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:ha,FunctionCloseMenu:od,FunctionOpenMenu:id,FunctionReset:cd,FunctionSelectItem:pa,FunctionSetHighlightedIndex:sd,FunctionSetInputValue:ad,FunctionToggleMenu:rd,InputBlur:fo,InputChange:ua,InputClick:da,InputKeyDownArrowDown:na,InputKeyDownArrowUp:ra,InputKeyDownEnd:sa,InputKeyDownEnter:la,InputKeyDownEscape:ia,InputKeyDownHome:oa,InputKeyDownPageDown:ca,InputKeyDownPageUp:aa,ItemClick:fa,ItemMouseMove:td,MenuMouseLeave:ed,ToggleButtonClick:nd});function Eb(e){var t=bb(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)),he({},t,{inputValue:r})}var Nb=he({},Zu,{items:V.array.isRequired,isItemDisabled:V.func,inputValue:V.string,defaultInputValue:V.string,initialInputValue:V.string,inputId:V.string,onInputValueChange:V.func});function Tb(e,t,n,r){var o=b.useRef(),i=wb(e,t,n,r),s=i[0],a=i[1],c=_o();return b.useEffect(function(){if(lo(t,"selectedItem")){if(!c){var d=t.itemToKey(t.selectedItem)!==t.itemToKey(o.current);d&&a({type:ha,inputValue:t.itemToString(t.selectedItem)})}o.current=s.selectedItem===o.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[co(s,t),a]}var ud=Ot;process.env.NODE_ENV!=="production"&&(ud=function(t,n){V.checkPropTypes(Nb,t,"prop",n.name)});var Rb=he({},ci,{isItemDisabled:function(){return!1}});function Ab(e,t){var n,r=t.type,o=t.props,i=t.altKey,s;switch(r){case fa:s={isOpen:$n(o,"isOpen"),highlightedIndex:Ss(o),selectedItem:o.items[t.index],inputValue:o.itemToString(o.items[t.index])};break;case na:e.isOpen?s={highlightedIndex:rr(e.highlightedIndex,1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:i&&e.selectedItem==null?-1:ui(o,e,1),isOpen:o.items.length>=0};break;case ra:e.isOpen?i?s=Tc(o,e.highlightedIndex):s={highlightedIndex:rr(e.highlightedIndex,-1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:ui(o,e,-1),isOpen:o.items.length>=0};break;case la:s=Tc(o,e.highlightedIndex);break;case ia:s=he({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case aa:s={highlightedIndex:rr(e.highlightedIndex,-10,o.items,o.isItemDisabled,!0)};break;case ca:s={highlightedIndex:rr(e.highlightedIndex,10,o.items,o.isItemDisabled,!0)};break;case oa:s={highlightedIndex:Ur(0,!1,o.items,o.isItemDisabled)};break;case sa:s={highlightedIndex:Ur(o.items.length-1,!0,o.items,o.isItemDisabled)};break;case fo:s=he({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&((n=o.items)==null?void 0:n.length)&&t.selectItem&&{selectedItem:o.items[e.highlightedIndex],inputValue:o.itemToString(o.items[e.highlightedIndex])});break;case ua:s={isOpen:!0,highlightedIndex:Ss(o),inputValue:t.inputValue};break;case da:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:ui(o,e,0)};break;case pa:s={selectedItem:t.selectedItem,inputValue:o.itemToString(t.selectedItem)};break;case ha:s={inputValue:t.inputValue};break;default:return Sb(e,t,ld)}return he({},e,s)}var Fb=["onMouseLeave","refKey","ref"],Pb=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],Db=["onClick","onPress","refKey","ref"],Mb=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];ma.stateChangeTypes=ld;function ma(e){e===void 0&&(e={}),ud(e,ma);var t=he({},Rb,e),n=t.items,r=t.scrollIntoView,o=t.environment,i=t.getA11yStatusMessage,s=Tb(Ab,t,Eb,Ob),a=s[0],c=s[1],d=a.isOpen,u=a.highlightedIndex,f=a.selectedItem,m=a.inputValue,g=b.useRef(null),v=b.useRef({}),y=b.useRef(null),p=b.useRef(null),x=_o(),h=yb(t),w=b.useRef(),I=Gu({state:a,props:t}),O=b.useCallback(function(H){return v.current[h.getItemId(H)]},[h]);Cb(i,a,[d,u,f,m],o);var S=xb({menuElement:g.current,highlightedIndex:u,isOpen:d,itemRefs:v,scrollIntoView:r,getItemNodeFromIndex:O});Yu({props:t,state:a}),b.useEffect(function(){var H=li(t,"isOpen");H&&y.current&&y.current.focus()},[]),b.useEffect(function(){x||(w.current=n.length)});var T=Ib(o,b.useCallback(function(){I.current.state.isOpen&&c({type:fo,selectItem:!1})},[c,I]),b.useMemo(function(){return[g,p,y]},[g.current,p.current,y.current])),R=Xu("getInputProps","getMenuProps");b.useEffect(function(){d||(v.current={})},[d]),b.useEffect(function(){var H;!d||!(o!=null&&o.document)||!(y!=null&&(H=y.current)!=null&&H.focus)||o.document.activeElement!==y.current&&y.current.focus()},[d,o]);var A=b.useMemo(function(){return{ArrowDown:function(U){U.preventDefault(),c({type:na,altKey:U.altKey})},ArrowUp:function(U){U.preventDefault(),c({type:ra,altKey:U.altKey})},Home:function(U){I.current.state.isOpen&&(U.preventDefault(),c({type:oa}))},End:function(U){I.current.state.isOpen&&(U.preventDefault(),c({type:sa}))},Escape:function(U){var K=I.current.state;(K.isOpen||K.inputValue||K.selectedItem||K.highlightedIndex>-1)&&(U.preventDefault(),c({type:ia}))},Enter:function(U){var K=I.current.state;!K.isOpen||U.which===229||(U.preventDefault(),c({type:la}))},PageUp:function(U){I.current.state.isOpen&&(U.preventDefault(),c({type:aa}))},PageDown:function(U){I.current.state.isOpen&&(U.preventDefault(),c({type:ca}))}}},[c,I]),D=b.useCallback(function(H){return he({id:h.labelId,htmlFor:h.inputId},H)},[h]),B=b.useCallback(function(H,U){var K,M=H===void 0?{}:H,Z=M.onMouseLeave,ee=M.refKey,W=ee===void 0?"ref":ee,te=M.ref,X=vn(M,Fb),de=U===void 0?{}:U,j=de.suppressRefError,we=j===void 0?!1:j;return R("getMenuProps",we,W,g),he((K={},K[W]=Cr(te,function(z){g.current=z}),K.id=h.menuId,K.role="listbox",K["aria-labelledby"]=X&&X["aria-label"]?void 0:""+h.labelId,K.onMouseLeave=ze(Z,function(){c({type:ed})}),K),X)},[c,R,h]),$=b.useCallback(function(H){var U,K,M=H===void 0?{}:H,Z=M.item,ee=M.index,W=M.refKey,te=W===void 0?"ref":W,X=M.ref,de=M.onMouseMove,j=M.onMouseDown,we=M.onClick;M.onPress;var z=M.disabled,Ne=vn(M,Pb);z!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var Ve=I.current,et=Ve.props,He=Ve.state,Ie=vb(Z,ee,et.items,"Pass either item or index to getItemProps!"),kt=Ie[0],tt=Ie[1],It=et.isItemDisabled(kt,tt),jt="onClick",Lt=we,nt=function(){T.isTouchEnd||tt===He.highlightedIndex||(S.current=!1,c({type:td,index:tt,disabled:It}))},Ge=function(){c({type:fa,index:tt})},Be=function(qt){return qt.preventDefault()};return he((U={},U[te]=Cr(X,function(Fe){Fe&&(v.current[h.getItemId(tt)]=Fe)}),U["aria-disabled"]=It,U["aria-selected"]=tt===He.highlightedIndex,U.id=h.getItemId(tt),U.role="option",U),!It&&(K={},K[jt]=ze(Lt,Ge),K),{onMouseMove:ze(de,nt),onMouseDown:ze(j,Be)},Ne)},[c,h,I,T,S]),L=b.useCallback(function(H){var U,K=H===void 0?{}:H,M=K.onClick;K.onPress;var Z=K.refKey,ee=Z===void 0?"ref":Z,W=K.ref,te=vn(K,Db),X=I.current.state,de=function(){c({type:nd})};return he((U={},U[ee]=Cr(W,function(j){p.current=j}),U["aria-controls"]=h.menuId,U["aria-expanded"]=X.isOpen,U.id=h.toggleButtonId,U.tabIndex=-1,U),!te.disabled&&he({},{onClick:ze(M,de)}),te)},[c,I,h]),J=b.useCallback(function(H,U){var K,M=H===void 0?{}:H,Z=M.onKeyDown,ee=M.onChange,W=M.onInput,te=M.onBlur;M.onChangeText;var X=M.onClick,de=M.refKey,j=de===void 0?"ref":de,we=M.ref,z=vn(M,Mb),Ne=U===void 0?{}:U,Ve=Ne.suppressRefError,et=Ve===void 0?!1:Ve;R("getInputProps",et,j,y);var He=I.current.state,Ie=function(Be){var Fe=Os(Be);Fe&&A[Fe]&&A[Fe](Be)},kt=function(Be){c({type:ua,inputValue:Be.target.value})},tt=function(Be){if(o!=null&&o.document&&He.isOpen&&!T.isMouseDown){var Fe=Be.relatedTarget===null&&o.document.activeElement!==o.document.body;c({type:fo,selectItem:!Fe})}},It=function(){c({type:da})},jt="onChange",Lt={};if(!z.disabled){var nt;Lt=(nt={},nt[jt]=ze(ee,W,kt),nt.onKeyDown=ze(Z,Ie),nt.onBlur=ze(te,tt),nt.onClick=ze(X,It),nt)}return he((K={},K[j]=Cr(we,function(Ge){y.current=Ge}),K["aria-activedescendant"]=He.isOpen&&He.highlightedIndex>-1?h.getItemId(He.highlightedIndex):"",K["aria-autocomplete"]="list",K["aria-controls"]=h.menuId,K["aria-expanded"]=He.isOpen,K["aria-labelledby"]=z&&z["aria-label"]?void 0:h.labelId,K.autoComplete="off",K.id=h.inputId,K.role="combobox",K.value=He.inputValue,K),Lt,z)},[c,h,o,A,I,T,R]),ae=b.useCallback(function(){c({type:rd})},[c]),re=b.useCallback(function(){c({type:od})},[c]),ne=b.useCallback(function(){c({type:id})},[c]),ge=b.useCallback(function(H){c({type:sd,highlightedIndex:H})},[c]),be=b.useCallback(function(H){c({type:pa,selectedItem:H})},[c]),F=b.useCallback(function(H){c({type:ad,inputValue:H})},[c]),q=b.useCallback(function(){c({type:cd})},[c]);return{getItemProps:$,getLabelProps:D,getMenuProps:B,getInputProps:J,getToggleButtonProps:L,toggleMenu:ae,openMenu:ne,closeMenu:re,setHighlightedIndex:ge,setInputValue:F,selectItem:be,reset:q,highlightedIndex:u,isOpen:d,selectedItem:f,inputValue:m}}no.stateReducer,no.itemToKey,no.environment,V.array,V.array,V.array,V.func,V.number,V.number,V.number,V.func,V.func,V.string,V.string;ci.itemToKey,ci.stateReducer,ci.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 kb="_comboboxContainer_1lcc8_1",jb="_label_1lcc8_8",Lb="_inputContainer_1lcc8_12",qb="_input_1lcc8_12",Kb="_toggleButton_1lcc8_33",Ub="_menu_1lcc8_39",Vb="_menuBottom_1lcc8_55",$b="_menuTop_1lcc8_61",Hb="_menuItem_1lcc8_66",Bb="_highlighted_1lcc8_73",Jb="_selected_1lcc8_77",Wb="_hidden_1lcc8_81",$t={comboboxContainer:kb,label:jb,inputContainer:Lb,input:qb,toggleButton:Kb,menu:Ub,menuBottom:Vb,menuTop:$b,menuItem:Hb,highlighted:Bb,selected:Jb,hidden:Wb};function zb(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function dd({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:o,style:i,menuPosition:s="bottom"}){const[a,c]=b.useState(e),d=b.useRef(null);b.useEffect(()=>c(e),[e]);const u=b.useCallback(T=>{(T==null?void 0:T.length)>0?c(e.filter(zb(T))):c(e)},[e]),{isOpen:f,getToggleButtonProps:m,getMenuProps:g,getInputProps:v,highlightedIndex:y,getItemProps:p,setInputValue:x,selectedItem:h}=ma({items:a,selectedItem:t?e.find(T=>T.value===t):null,itemToString:T=>(T==null?void 0:T.label)||"",onInputValueChange:({inputValue:T})=>u(T),onSelectedItemChange:({selectedItem:T})=>{var R;n(T),(R=d.current)==null||R.blur()}}),w=()=>{x(""),c(e)},I=()=>w(),O=b.useMemo(()=>{var T;return(T=e.find(R=>R.value===t))==null?void 0:T.label},[e,t]),S=()=>{t&&O&&t!==(h==null?void 0:h.value)&&x(O||"")};return l.jsxs("div",{style:{position:"relative",...i},children:[l.jsx("div",{className:$t.comboboxContainer,children:l.jsxs("div",{className:$t.inputContainer,children:[l.jsx("input",{style:{border:"none"},disabled:o,placeholder:r,className:$t.input,...v({onFocus:I,onBlur:S,ref:d})}),l.jsx("button",{style:{border:"none"},disabled:o,"aria-label":"toggle menu",className:$t.toggleButton,type:"button",...m(),children:f?l.jsx(l.Fragment,{children:"↑"}):l.jsx(l.Fragment,{children:"↓"})})]})}),l.jsx("ul",{className:`${$t.menu} ${f&&e.length?"":$t.hidden} ${s==="top"?$t.menuTop:$t.menuBottom}`,...g(),children:f&&a.map((T,R)=>l.jsx("li",{className:`${$t.menuItem} ${y===R?$t.highlighted:""} ${t===(T==null?void 0:T.value)?$t.selected:""}`,...p({item:T,index:R}),children:l.jsx("span",{children:T.label})},T.id))})]})}const Vr=Math.min,fr=Math.max,po=Math.round,Gi=Math.floor,Bn=e=>({x:e,y:e}),Qb={left:"right",right:"left",bottom:"top",top:"bottom"},Gb={start:"end",end:"start"};function Es(e,t,n){return fr(e,Vr(t,n))}function Oi(e,t){return typeof e=="function"?e(t):e}function gr(e){return e.split("-")[0]}function _i(e){return e.split("-")[1]}function fd(e){return e==="x"?"y":"x"}function ga(e){return e==="y"?"height":"width"}function $r(e){return["top","bottom"].includes(gr(e))?"y":"x"}function ya(e){return fd($r(e))}function Xb(e,t,n){n===void 0&&(n=!1);const r=_i(e),o=ya(e),i=ga(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=ho(s)),[s,ho(s)]}function Yb(e){const t=ho(e);return[Ns(e),t,Ns(t)]}function Ns(e){return e.replace(/start|end/g,t=>Gb[t])}function Zb(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:s;default:return[]}}function eI(e,t,n,r){const o=_i(e);let i=Zb(gr(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(Ns)))),i}function ho(e){return e.replace(/left|right|bottom|top/g,t=>Qb[t])}function tI(e){return{top:0,right:0,bottom:0,left:0,...e}}function pd(e){return typeof e!="number"?tI(e):{top:e,right:e,bottom:e,left:e}}function mo(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Rc(e,t,n){let{reference:r,floating:o}=e;const i=$r(t),s=ya(t),a=ga(s),c=gr(t),d=i==="y",u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,m=r[a]/2-o[a]/2;let g;switch(c){case"top":g={x:u,y:r.y-o.height};break;case"bottom":g={x:u,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:f};break;case"left":g={x:r.x-o.width,y:f};break;default:g={x:r.x,y:r.y}}switch(_i(t)){case"start":g[s]-=m*(n&&d?-1:1);break;case"end":g[s]+=m*(n&&d?-1:1);break}return g}const nI=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),c=await(s.isRTL==null?void 0:s.isRTL(t));let d=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=Rc(d,r,c),m=r,g={},v=0;for(let y=0;y<a.length;y++){const{name:p,fn:x}=a[y],{x:h,y:w,data:I,reset:O}=await x({x:u,y:f,initialPlacement:r,placement:m,strategy:o,middlewareData:g,rects:d,platform:s,elements:{reference:e,floating:t}});u=h??u,f=w??f,g={...g,[p]:{...g[p],...I}},O&&v<=50&&(v++,typeof O=="object"&&(O.placement&&(m=O.placement),O.rects&&(d=O.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):O.rects),{x:u,y:f}=Rc(d,m,c)),y=-1)}return{x:u,y:f,placement:m,strategy:o,middlewareData:g}};async function hd(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:m=!1,padding:g=0}=Oi(t,e),v=pd(g),p=a[m?f==="floating"?"reference":"floating":f],x=mo(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(p)))==null||n?p:p.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:d,rootBoundary:u,strategy:c})),h=f==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),I=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},O=mo(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:h,offsetParent:w,strategy:c}):h);return{top:(x.top-O.top+v.top)/I.y,bottom:(O.bottom-x.bottom+v.bottom)/I.y,left:(x.left-O.left+v.left)/I.x,right:(O.right-x.right+v.right)/I.x}}const rI=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:c}=t,{element:d,padding:u=0}=Oi(e,t)||{};if(d==null)return{};const f=pd(u),m={x:n,y:r},g=ya(o),v=ga(g),y=await s.getDimensions(d),p=g==="y",x=p?"top":"left",h=p?"bottom":"right",w=p?"clientHeight":"clientWidth",I=i.reference[v]+i.reference[g]-m[g]-i.floating[v],O=m[g]-i.reference[g],S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(d));let T=S?S[w]:0;(!T||!await(s.isElement==null?void 0:s.isElement(S)))&&(T=a.floating[w]||i.floating[v]);const R=I/2-O/2,A=T/2-y[v]/2-1,D=Vr(f[x],A),B=Vr(f[h],A),$=D,L=T-y[v]-B,J=T/2-y[v]/2+R,ae=Es($,J,L),re=!c.arrow&&_i(o)!=null&&J!==ae&&i.reference[v]/2-(J<$?D:B)-y[v]/2<0,ne=re?J<$?J-$:J-L:0;return{[g]:m[g]+ne,data:{[g]:ae,centerOffset:J-ae-ne,...re&&{alignmentOffset:ne}},reset:re}}}),iI=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:c,elements:d}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:y=!0,...p}=Oi(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const x=gr(o),h=$r(a),w=gr(a)===a,I=await(c.isRTL==null?void 0:c.isRTL(d.floating)),O=m||(w||!y?[ho(a)]:Yb(a)),S=v!=="none";!m&&S&&O.push(...eI(a,y,v,I));const T=[a,...O],R=await hd(t,p),A=[];let D=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&A.push(R[x]),f){const J=Xb(o,s,I);A.push(R[J[0]],R[J[1]])}if(D=[...D,{placement:o,overflows:A}],!A.every(J=>J<=0)){var B,$;const J=(((B=i.flip)==null?void 0:B.index)||0)+1,ae=T[J];if(ae)return{data:{index:J,overflows:D},reset:{placement:ae}};let re=($=D.filter(ne=>ne.overflows[0]<=0).sort((ne,ge)=>ne.overflows[1]-ge.overflows[1])[0])==null?void 0:$.placement;if(!re)switch(g){case"bestFit":{var L;const ne=(L=D.filter(ge=>{if(S){const be=$r(ge.placement);return be===h||be==="y"}return!0}).map(ge=>[ge.placement,ge.overflows.filter(be=>be>0).reduce((be,F)=>be+F,0)]).sort((ge,be)=>ge[1]-be[1])[0])==null?void 0:L[0];ne&&(re=ne);break}case"initialPlacement":re=a;break}if(o!==re)return{reset:{placement:re}}}return{}}}};async function oI(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=gr(n),a=_i(n),c=$r(n)==="y",d=["left","top"].includes(s)?-1:1,u=i&&c?-1:1,f=Oi(t,e);let{mainAxis:m,crossAxis:g,alignmentAxis:v}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof v=="number"&&(g=a==="end"?v*-1:v),c?{x:g*u,y:m*d}:{x:m*d,y:g*u}}const sI=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,c=await oI(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:i+c.y,data:{...c,placement:s}}}}},aI=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:p=>{let{x,y:h}=p;return{x,y:h}}},...c}=Oi(e,t),d={x:n,y:r},u=await hd(t,c),f=$r(gr(o)),m=fd(f);let g=d[m],v=d[f];if(i){const p=m==="y"?"top":"left",x=m==="y"?"bottom":"right",h=g+u[p],w=g-u[x];g=Es(h,g,w)}if(s){const p=f==="y"?"top":"left",x=f==="y"?"bottom":"right",h=v+u[p],w=v-u[x];v=Es(h,v,w)}const y=a.fn({...t,[m]:g,[f]:v});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[m]:i,[f]:s}}}}}};function So(){return typeof window<"u"}function ei(e){return md(e)?(e.nodeName||"").toLowerCase():"#document"}function _t(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function cn(e){var t;return(t=(md(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function md(e){return So()?e instanceof Node||e instanceof _t(e).Node:!1}function Gt(e){return So()?e instanceof Element||e instanceof _t(e).Element:!1}function sn(e){return So()?e instanceof HTMLElement||e instanceof _t(e).HTMLElement:!1}function Ac(e){return!So()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof _t(e).ShadowRoot}function Si(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Xt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function cI(e){return["table","td","th"].includes(ei(e))}function Eo(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function va(e){const t=wa(),n=Gt(e)?Xt(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 lI(e){let t=Jn(e);for(;sn(t)&&!Hr(t);){if(va(t))return t;if(Eo(t))return null;t=Jn(t)}return null}function wa(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Hr(e){return["html","body","#document"].includes(ei(e))}function Xt(e){return _t(e).getComputedStyle(e)}function No(e){return Gt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Jn(e){if(ei(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ac(e)&&e.host||cn(e);return Ac(t)?t.host:t}function gd(e){const t=Jn(e);return Hr(t)?e.ownerDocument?e.ownerDocument.body:e.body:sn(t)&&Si(t)?t:gd(t)}function pi(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=gd(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=_t(o);if(i){const a=Ts(s);return t.concat(s,s.visualViewport||[],Si(o)?o:[],a&&n?pi(a):[])}return t.concat(o,pi(o,[],n))}function Ts(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function yd(e){const t=Xt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=sn(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=po(n)!==i||po(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function ba(e){return Gt(e)?e:e.contextElement}function xr(e){const t=ba(e);if(!sn(t))return Bn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=yd(t);let s=(i?po(n.width):n.width)/r,a=(i?po(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const uI=Bn(0);function vd(e){const t=_t(e);return!wa()||!t.visualViewport?uI:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function dI(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==_t(e)?!1:t}function yr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=ba(e);let s=Bn(1);t&&(r?Gt(r)&&(s=xr(r)):s=xr(e));const a=dI(i,n,r)?vd(i):Bn(0);let c=(o.left+a.x)/s.x,d=(o.top+a.y)/s.y,u=o.width/s.x,f=o.height/s.y;if(i){const m=_t(i),g=r&&Gt(r)?_t(r):r;let v=m,y=Ts(v);for(;y&&r&&g!==v;){const p=xr(y),x=y.getBoundingClientRect(),h=Xt(y),w=x.left+(y.clientLeft+parseFloat(h.paddingLeft))*p.x,I=x.top+(y.clientTop+parseFloat(h.paddingTop))*p.y;c*=p.x,d*=p.y,u*=p.x,f*=p.y,c+=w,d+=I,v=_t(y),y=Ts(v)}}return mo({width:u,height:f,x:c,y:d})}function fI(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=cn(r),a=t?Eo(t.floating):!1;if(r===s||a&&i)return n;let c={scrollLeft:0,scrollTop:0},d=Bn(1);const u=Bn(0),f=sn(r);if((f||!f&&!i)&&((ei(r)!=="body"||Si(s))&&(c=No(r)),sn(r))){const m=yr(r);d=xr(r),u.x=m.x+r.clientLeft,u.y=m.y+r.clientTop}return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+u.x,y:n.y*d.y-c.scrollTop*d.y+u.y}}function pI(e){return Array.from(e.getClientRects())}function Rs(e,t){const n=No(e).scrollLeft;return t?t.left+n:yr(cn(e)).left+n}function hI(e){const t=cn(e),n=No(e),r=e.ownerDocument.body,o=fr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=fr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Rs(e);const a=-n.scrollTop;return Xt(r).direction==="rtl"&&(s+=fr(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function mI(e,t){const n=_t(e),r=cn(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,c=0;if(o){i=o.width,s=o.height;const d=wa();(!d||d&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}return{width:i,height:s,x:a,y:c}}function gI(e,t){const n=yr(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=sn(e)?xr(e):Bn(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,c=o*i.x,d=r*i.y;return{width:s,height:a,x:c,y:d}}function Fc(e,t,n){let r;if(t==="viewport")r=mI(e,n);else if(t==="document")r=hI(cn(e));else if(Gt(t))r=gI(t,n);else{const o=vd(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return mo(r)}function wd(e,t){const n=Jn(e);return n===t||!Gt(n)||Hr(n)?!1:Xt(n).position==="fixed"||wd(n,t)}function yI(e,t){const n=t.get(e);if(n)return n;let r=pi(e,[],!1).filter(a=>Gt(a)&&ei(a)!=="body"),o=null;const i=Xt(e).position==="fixed";let s=i?Jn(e):e;for(;Gt(s)&&!Hr(s);){const a=Xt(s),c=va(s);!c&&a.position==="fixed"&&(o=null),(i?!c&&!o:!c&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Si(s)&&!c&&wd(e,s))?r=r.filter(u=>u!==s):o=a,s=Jn(s)}return t.set(e,r),r}function vI(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?Eo(t)?[]:yI(t,this._c):[].concat(n),r],a=s[0],c=s.reduce((d,u)=>{const f=Fc(t,u,o);return d.top=fr(f.top,d.top),d.right=Vr(f.right,d.right),d.bottom=Vr(f.bottom,d.bottom),d.left=fr(f.left,d.left),d},Fc(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function wI(e){const{width:t,height:n}=yd(e);return{width:t,height:n}}function bI(e,t,n){const r=sn(t),o=cn(t),i=n==="fixed",s=yr(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=Bn(0);if(r||!r&&!i)if((ei(t)!=="body"||Si(o))&&(a=No(t)),r){const g=yr(t,!0,i,t);c.x=g.x+t.clientLeft,c.y=g.y+t.clientTop}else o&&(c.x=Rs(o));let d=0,u=0;if(o&&!r&&!i){const g=o.getBoundingClientRect();u=g.top+a.scrollTop,d=g.left+a.scrollLeft-Rs(o,g)}const f=s.left+a.scrollLeft-c.x-d,m=s.top+a.scrollTop-c.y-u;return{x:f,y:m,width:s.width,height:s.height}}function es(e){return Xt(e).position==="static"}function Pc(e,t){if(!sn(e)||Xt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return cn(e)===n&&(n=n.ownerDocument.body),n}function bd(e,t){const n=_t(e);if(Eo(e))return n;if(!sn(e)){let o=Jn(e);for(;o&&!Hr(o);){if(Gt(o)&&!es(o))return o;o=Jn(o)}return n}let r=Pc(e,t);for(;r&&cI(r)&&es(r);)r=Pc(r,t);return r&&Hr(r)&&es(r)&&!va(r)?n:r||lI(e)||n}const II=async function(e){const t=this.getOffsetParent||bd,n=this.getDimensions,r=await n(e.floating);return{reference:bI(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function CI(e){return Xt(e).direction==="rtl"}const xI={convertOffsetParentRelativeRectToViewportRelativeRect:fI,getDocumentElement:cn,getClippingRect:vI,getOffsetParent:bd,getElementRects:II,getClientRects:pI,getDimensions:wI,getScale:xr,isElement:Gt,isRTL:CI};function OI(e,t){let n=null,r;const o=cn(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),i();const{left:d,top:u,width:f,height:m}=e.getBoundingClientRect();if(a||t(),!f||!m)return;const g=Gi(u),v=Gi(o.clientWidth-(d+f)),y=Gi(o.clientHeight-(u+m)),p=Gi(d),h={rootMargin:-g+"px "+-v+"px "+-y+"px "+-p+"px",threshold:fr(0,Vr(1,c))||1};let w=!0;function I(O){const S=O[0].intersectionRatio;if(S!==c){if(!w)return s();S?s(!1,S):r=setTimeout(()=>{s(!1,1e-7)},1e3)}w=!1}try{n=new IntersectionObserver(I,{...h,root:o.ownerDocument})}catch{n=new IntersectionObserver(I,h)}n.observe(e)}return s(!0),i}function _I(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=ba(e),u=o||i?[...d?pi(d):[],...pi(t)]:[];u.forEach(x=>{o&&x.addEventListener("scroll",n,{passive:!0}),i&&x.addEventListener("resize",n)});const f=d&&a?OI(d,n):null;let m=-1,g=null;s&&(g=new ResizeObserver(x=>{let[h]=x;h&&h.target===d&&g&&(g.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var w;(w=g)==null||w.observe(t)})),n()}),d&&!c&&g.observe(d),g.observe(t));let v,y=c?yr(e):null;c&&p();function p(){const x=yr(e);y&&(x.x!==y.x||x.y!==y.y||x.width!==y.width||x.height!==y.height)&&n(),y=x,v=requestAnimationFrame(p)}return n(),()=>{var x;u.forEach(h=>{o&&h.removeEventListener("scroll",n),i&&h.removeEventListener("resize",n)}),f==null||f(),(x=g)==null||x.disconnect(),g=null,c&&cancelAnimationFrame(v)}}const SI=sI,EI=aI,NI=iI,TI=rI,Dc=(e,t,n)=>{const r=new Map,o={platform:xI,...n},i={...o.platform,_c:r};return nI(e,t,{...o,platform:i})};/*
45
+ */var Ic;function Yw(){return Ic||(Ic=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"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen"),v=!1,y=!1,p=!1,x=!1,h=!1,w;w=Symbol.for("react.module.reference");function I(z){return!!(typeof z=="string"||typeof z=="function"||z===n||z===o||h||z===r||z===d||z===u||x||z===g||v||y||p||typeof z=="object"&&z!==null&&(z.$$typeof===m||z.$$typeof===f||z.$$typeof===i||z.$$typeof===s||z.$$typeof===l||z.$$typeof===w||z.getModuleId!==void 0))}function O(z){if(typeof z=="object"&&z!==null){var Ne=z.$$typeof;switch(Ne){case e:var Ve=z.type;switch(Ve){case n:case o:case r:case d:case u:return Ve;default:var et=Ve&&Ve.$$typeof;switch(et){case a:case s:case l:case m:case f:case i:return et;default:return Ne}}case t:return Ne}}}var S=s,T=i,R=e,A=l,D=n,B=m,$=f,L=t,J=o,ae=r,re=d,ne=u,ge=!1,be=!1;function F(z){return ge||(ge=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function q(z){return be||(be=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function H(z){return O(z)===s}function U(z){return O(z)===i}function K(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function M(z){return O(z)===l}function Z(z){return O(z)===n}function ee(z){return O(z)===m}function W(z){return O(z)===f}function te(z){return O(z)===t}function X(z){return O(z)===o}function de(z){return O(z)===r}function j(z){return O(z)===d}function we(z){return O(z)===u}_e.ContextConsumer=S,_e.ContextProvider=T,_e.Element=R,_e.ForwardRef=A,_e.Fragment=D,_e.Lazy=B,_e.Memo=$,_e.Portal=L,_e.Profiler=J,_e.StrictMode=ae,_e.Suspense=re,_e.SuspenseList=ne,_e.isAsyncMode=F,_e.isConcurrentMode=q,_e.isContextConsumer=H,_e.isContextProvider=U,_e.isElement=K,_e.isForwardRef=M,_e.isFragment=Z,_e.isLazy=ee,_e.isMemo=W,_e.isPortal=te,_e.isProfiler=X,_e.isStrictMode=de,_e.isSuspense=j,_e.isSuspenseList=we,_e.isValidElementType=I,_e.typeOf=O}()),_e}process.env.NODE_ENV==="production"?xs.exports=Xw():xs.exports=Yw();var Cc=xs.exports;const xc=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Oc=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Zo=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Oc(n.overflowY,t)||Oc(n.overflowX,t)||(r=>{const o=(i=>{if(!i.ownerDocument||!i.ownerDocument.defaultView)return null;try{return i.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!o&&(o.clientHeight<r.scrollHeight||o.clientWidth<r.scrollWidth)})(e)}return!1},Wi=(e,t,n,r,o,i,s,a)=>i<e&&s>t||i>e&&s<t?0:i<=e&&a<=n||s>=t&&a>=n?i-e-r:s>t&&a<n||i<e&&a>n?s-t+o:0,Zw=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},eb=(e,t)=>{var n,r,o,i;if(typeof document>"u")return[];const{scrollMode:s,block:a,inline:l,boundary:d,skipOverflowHiddenElements:u}=t,f=typeof d=="function"?d:re=>re!==d;if(!xc(e))throw new TypeError("Invalid target");const m=document.scrollingElement||document.documentElement,g=[];let v=e;for(;xc(v)&&f(v);){if(v=Zw(v),v===m){g.push(v);break}v!=null&&v===document.body&&Zo(v)&&!Zo(document.documentElement)||v!=null&&Zo(v,u)&&g.push(v)}const y=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,p=(i=(o=window.visualViewport)==null?void 0:o.height)!=null?i:innerHeight,{scrollX:x,scrollY:h}=window,{height:w,width:I,top:O,right:S,bottom:T,left:R}=e.getBoundingClientRect(),{top:A,right:D,bottom:B,left:$}=(re=>{const ne=window.getComputedStyle(re);return{top:parseFloat(ne.scrollMarginTop)||0,right:parseFloat(ne.scrollMarginRight)||0,bottom:parseFloat(ne.scrollMarginBottom)||0,left:parseFloat(ne.scrollMarginLeft)||0}})(e);let L=a==="start"||a==="nearest"?O-A:a==="end"?T+B:O+w/2-A+B,J=l==="center"?R+I/2-$+D:l==="end"?S+D:R-$;const ae=[];for(let re=0;re<g.length;re++){const ne=g[re],{height:ge,width:be,top:F,right:q,bottom:H,left:U}=ne.getBoundingClientRect();if(s==="if-needed"&&O>=0&&R>=0&&T<=p&&S<=y&&O>=F&&T<=H&&R>=U&&S<=q)return ae;const K=getComputedStyle(ne),M=parseInt(K.borderLeftWidth,10),Z=parseInt(K.borderTopWidth,10),ee=parseInt(K.borderRightWidth,10),W=parseInt(K.borderBottomWidth,10);let te=0,X=0;const de="offsetWidth"in ne?ne.offsetWidth-ne.clientWidth-M-ee:0,j="offsetHeight"in ne?ne.offsetHeight-ne.clientHeight-Z-W:0,we="offsetWidth"in ne?ne.offsetWidth===0?0:be/ne.offsetWidth:0,z="offsetHeight"in ne?ne.offsetHeight===0?0:ge/ne.offsetHeight:0;if(m===ne)te=a==="start"?L:a==="end"?L-p:a==="nearest"?Wi(h,h+p,p,Z,W,h+L,h+L+w,w):L-p/2,X=l==="start"?J:l==="center"?J-y/2:l==="end"?J-y:Wi(x,x+y,y,M,ee,x+J,x+J+I,I),te=Math.max(0,te+h),X=Math.max(0,X+x);else{te=a==="start"?L-F-Z:a==="end"?L-H+W+j:a==="nearest"?Wi(F,H,ge,Z,W+j,L,L+w,w):L-(F+ge/2)+j/2,X=l==="start"?J-U-M:l==="center"?J-(U+be/2)+de/2:l==="end"?J-q+ee+de:Wi(U,q,be,M,ee+de,J,J+I,I);const{scrollLeft:Ne,scrollTop:Ve}=ne;te=z===0?0:Math.max(0,Math.min(Ve+te/z,ne.scrollHeight-ge/z+j)),X=we===0?0:Math.max(0,Math.min(Ne+X/we,ne.scrollWidth-be/we+de)),L+=Ve-te,J+=Ne-X}ae.push({el:ne,top:te,left:X})}return ae};var qr=function(){return qr=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},qr.apply(this,arguments)};var tb=0;function _c(e){return typeof e=="function"?e:Ot}function Ot(){}function Ru(e,t){if(e){var n=eb(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach(function(r){var o=r.el,i=r.top,s=r.left;o.scrollTop=i,o.scrollLeft=s})}}function Sc(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function ea(e,t){var n;function r(){n&&clearTimeout(n)}function o(){for(var i=arguments.length,s=new Array(i),a=0;a<i;a++)s[a]=arguments[a];r(),n=setTimeout(function(){n=null,e.apply(void 0,s)},t)}return o.cancel=r,o}function ze(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var o=arguments.length,i=new Array(o>1?o-1:0),s=1;s<o;s++)i[s-1]=arguments[s];return t.some(function(a){return a&&a.apply(void 0,[r].concat(i)),r.preventDownshiftDefault||r.hasOwnProperty("nativeEvent")&&r.nativeEvent.preventDownshiftDefault})}}function Cr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){t.forEach(function(o){typeof o=="function"?o(r):o&&(o.current=r)})}}function Au(){return String(tb++)}function nb(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 Ec(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function Fu(e){return typeof e.type=="string"}function Pu(e){return e.props}function rb(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var ib=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function zi(e){e===void 0&&(e={});var t={};return ib.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function co(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,r){return n[r]=lo(t,r)?t[r]:e[r],n},{})}function lo(e,t){return e[t]!==void 0}function Os(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function ob(e){return Object.prototype.toString.call(e)==="[object Object]"}function rr(e,t,n,r,o){var i=n.length;if(i===0)return-1;var s=i-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=Kr(a,t<0,n,r,o);return l===-1?e>=i?-1:e:l}function Kr(e,t,n,r,o){o===void 0&&(o=!1);var i=n.length;if(t){for(var s=e;s>=0;s--)if(!r(n[s],s))return s}else for(var a=e;a<i;a++)if(!r(n[a],a))return a;return o?Kr(t?i-1:0,t,n,r):-1}function uo(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(o){return o&&(Sc(o,e,n)||r&&Sc(o,n.document.activeElement,n))})}var ta=Ot;process.env.NODE_ENV!=="production"&&(ta=function(t,n,r){var o="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(i){n[i]!==void 0&&r[i]===void 0?console.error('downshift: A component has changed the controlled prop "'+i+'" to be uncontrolled. '+o):n[i]===void 0&&r[i]!==void 0&&console.error('downshift: A component has changed the uncontrolled prop "'+i+'" to be controlled. '+o)})});var sb=ea(function(e){Du(e).textContent=""},500);function Du(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 Mu(e,t){if(!(!e||!t)){var n=Du(t);n.textContent=e,sb(t)}}function ab(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var ku=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,ju=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,Lu=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,Zi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,eo=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,qu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,Ku=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,Uu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,Vu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,$u=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,Hu=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,Bu=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,Ju=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,_s=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,Wu=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,zu=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,Qu=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,cb=Object.freeze({__proto__:null,blurButton:Wu,blurInput:Hu,changeInput:Bu,clickButton:_s,clickItem:$u,controlledPropUpdatedSelectedItem:zu,itemMouseEnter:Lu,keyDownArrowDown:eo,keyDownArrowUp:Zi,keyDownEnd:Vu,keyDownEnter:Ku,keyDownEscape:qu,keyDownHome:Uu,keyDownSpaceButton:Ju,mouseUp:ju,touchEnd:Qu,unknown:ku}),lb=["refKey","ref"],ub=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],db=["onKeyDown","onBlur","onChange","onInput","onChangeText"],fb=["refKey","ref"],pb=["onMouseMove","onMouseDown","onClick","onPress","index","item"],hb=function(){var e=function(t){function n(o){var i;i=t.call(this,o)||this,i.id=i.props.id||"downshift-"+Au(),i.menuId=i.props.menuId||i.id+"-menu",i.labelId=i.props.labelId||i.id+"-label",i.inputId=i.props.inputId||i.id+"-input",i.getItemId=i.props.getItemId||function(h){return i.id+"-item-"+h},i.items=[],i.itemCount=null,i.previousResultCount=0,i.timeoutIds=[],i.internalSetTimeout=function(h,w){var I=setTimeout(function(){i.timeoutIds=i.timeoutIds.filter(function(O){return O!==I}),h()},w);i.timeoutIds.push(I)},i.setItemCount=function(h){i.itemCount=h},i.unsetItemCount=function(){i.itemCount=null},i.isItemDisabled=function(h,w){var I=i.getItemNodeFromIndex(w);return I&&I.hasAttribute("disabled")},i.setHighlightedIndex=function(h,w){h===void 0&&(h=i.props.defaultHighlightedIndex),w===void 0&&(w={}),w=zi(w),i.internalSetState(he({highlightedIndex:h},w))},i.clearSelection=function(h){i.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:i.props.defaultHighlightedIndex,isOpen:i.props.defaultIsOpen},h)},i.selectItem=function(h,w,I){w=zi(w),i.internalSetState(he({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,selectedItem:h,inputValue:i.props.itemToString(h)},w),I)},i.selectItemAtIndex=function(h,w,I){var O=i.items[h];O!=null&&i.selectItem(O,w,I)},i.selectHighlightedItem=function(h,w){return i.selectItemAtIndex(i.getState().highlightedIndex,h,w)},i.internalSetState=function(h,w){var I,O,S={},T=typeof h=="function";return!T&&h.hasOwnProperty("inputValue")&&i.props.onInputValueChange(h.inputValue,he({},i.getStateAndHelpers(),h)),i.setState(function(R){var A;R=i.getState(R);var D=T?h(R):h;D=i.props.stateReducer(R,D),I=D.hasOwnProperty("selectedItem");var B={};return I&&D.selectedItem!==R.selectedItem&&(O=D.selectedItem),(A=D).type||(A.type=ku),Object.keys(D).forEach(function($){R[$]!==D[$]&&(S[$]=D[$]),$!=="type"&&(D[$],lo(i.props,$)||(B[$]=D[$]))}),T&&D.hasOwnProperty("inputValue")&&i.props.onInputValueChange(D.inputValue,he({},i.getStateAndHelpers(),D)),B},function(){_c(w)();var R=Object.keys(S).length>1;R&&i.props.onStateChange(S,i.getStateAndHelpers()),I&&i.props.onSelect(h.selectedItem,i.getStateAndHelpers()),O!==void 0&&i.props.onChange(O,i.getStateAndHelpers()),i.props.onUserAction(S,i.getStateAndHelpers())})},i.rootRef=function(h){return i._rootNode=h},i.getRootProps=function(h,w){var I,O=h===void 0?{}:h,S=O.refKey,T=S===void 0?"ref":S,R=O.ref,A=vn(O,lb),D=w===void 0?{}:w,B=D.suppressRefError,$=B===void 0?!1:B;i.getRootProps.called=!0,i.getRootProps.refKey=T,i.getRootProps.suppressRefError=$;var L=i.getState(),J=L.isOpen;return he((I={},I[T]=Cr(R,i.rootRef),I.role="combobox",I["aria-expanded"]=J,I["aria-haspopup"]="listbox",I["aria-owns"]=J?i.menuId:void 0,I["aria-labelledby"]=i.labelId,I),A)},i.keyDownHandlers={ArrowDown:function(w){var I=this;if(w.preventDefault(),this.getState().isOpen){var O=w.shiftKey?5:1;this.moveHighlightedIndex(O,{type:eo})}else this.internalSetState({isOpen:!0,type:eo},function(){var S=I.getItemCount();if(S>0){var T=I.getState(),R=T.highlightedIndex,A=rr(R,1,{length:S},I.isItemDisabled,!0);I.setHighlightedIndex(A,{type:eo})}})},ArrowUp:function(w){var I=this;if(w.preventDefault(),this.getState().isOpen){var O=w.shiftKey?-5:-1;this.moveHighlightedIndex(O,{type:Zi})}else this.internalSetState({isOpen:!0,type:Zi},function(){var S=I.getItemCount();if(S>0){var T=I.getState(),R=T.highlightedIndex,A=rr(R,-1,{length:S},I.isItemDisabled,!0);I.setHighlightedIndex(A,{type:Zi})}})},Enter:function(w){if(w.which!==229){var I=this.getState(),O=I.isOpen,S=I.highlightedIndex;if(O&&S!=null){w.preventDefault();var T=this.items[S],R=this.getItemNodeFromIndex(S);if(T==null||R&&R.hasAttribute("disabled"))return;this.selectHighlightedItem({type:Ku})}}},Escape:function(w){w.preventDefault(),this.reset(he({type:qu},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},i.buttonKeyDownHandlers=he({},i.keyDownHandlers,{" ":function(w){w.preventDefault(),this.toggleMenu({type:Ju})}}),i.inputKeyDownHandlers=he({},i.keyDownHandlers,{Home:function(w){var I=this.getState(),O=I.isOpen;if(O){w.preventDefault();var S=this.getItemCount();if(!(S<=0||!O)){var T=Kr(0,!1,{length:S},this.isItemDisabled);this.setHighlightedIndex(T,{type:Uu})}}},End:function(w){var I=this.getState(),O=I.isOpen;if(O){w.preventDefault();var S=this.getItemCount();if(!(S<=0||!O)){var T=Kr(S-1,!0,{length:S},this.isItemDisabled);this.setHighlightedIndex(T,{type:Vu})}}}}),i.getToggleButtonProps=function(h){var w=h===void 0?{}:h,I=w.onClick;w.onPress;var O=w.onKeyDown,S=w.onKeyUp,T=w.onBlur,R=vn(w,ub),A=i.getState(),D=A.isOpen,B={onClick:ze(I,i.buttonHandleClick),onKeyDown:ze(O,i.buttonHandleKeyDown),onKeyUp:ze(S,i.buttonHandleKeyUp),onBlur:ze(T,i.buttonHandleBlur)},$=R.disabled?{}:B;return he({type:"button",role:"button","aria-label":D?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},$,R)},i.buttonHandleKeyUp=function(h){h.preventDefault()},i.buttonHandleKeyDown=function(h){var w=Os(h);i.buttonKeyDownHandlers[w]&&i.buttonKeyDownHandlers[w].call(i,h)},i.buttonHandleClick=function(h){if(h.preventDefault(),i.props.environment){var w=i.props.environment.document,I=w.body,O=w.activeElement;I&&I===O&&h.target.focus()}process.env.NODE_ENV==="test"?i.toggleMenu({type:_s}):i.internalSetTimeout(function(){return i.toggleMenu({type:_s})})},i.buttonHandleBlur=function(h){var w=h.target;i.internalSetTimeout(function(){if(!(i.isMouseDown||!i.props.environment)){var I=i.props.environment.document.activeElement;(I==null||I.id!==i.inputId)&&I!==w&&i.reset({type:Wu})}})},i.getLabelProps=function(h){return he({htmlFor:i.inputId,id:i.labelId},h)},i.getInputProps=function(h){var w=h===void 0?{}:h,I=w.onKeyDown,O=w.onBlur,S=w.onChange,T=w.onInput;w.onChangeText;var R=vn(w,db),A,D={};A="onChange";var B=i.getState(),$=B.inputValue,L=B.isOpen,J=B.highlightedIndex;if(!R.disabled){var ae;D=(ae={},ae[A]=ze(S,T,i.inputHandleChange),ae.onKeyDown=ze(I,i.inputHandleKeyDown),ae.onBlur=ze(O,i.inputHandleBlur),ae)}return he({"aria-autocomplete":"list","aria-activedescendant":L&&typeof J=="number"&&J>=0?i.getItemId(J):void 0,"aria-controls":L?i.menuId:void 0,"aria-labelledby":R&&R["aria-label"]?void 0:i.labelId,autoComplete:"off",value:$,id:i.inputId},D,R)},i.inputHandleKeyDown=function(h){var w=Os(h);w&&i.inputKeyDownHandlers[w]&&i.inputKeyDownHandlers[w].call(i,h)},i.inputHandleChange=function(h){i.internalSetState({type:Bu,isOpen:!0,inputValue:h.target.value,highlightedIndex:i.props.defaultHighlightedIndex})},i.inputHandleBlur=function(){i.internalSetTimeout(function(){var h;if(!(i.isMouseDown||!i.props.environment)){var w=i.props.environment.document.activeElement,I=(w==null||(h=w.dataset)==null?void 0:h.toggle)&&i._rootNode&&i._rootNode.contains(w);I||i.reset({type:Hu})}})},i.menuRef=function(h){i._menuNode=h},i.getMenuProps=function(h,w){var I,O=h===void 0?{}:h,S=O.refKey,T=S===void 0?"ref":S,R=O.ref,A=vn(O,fb),D=w===void 0?{}:w,B=D.suppressRefError,$=B===void 0?!1:B;return i.getMenuProps.called=!0,i.getMenuProps.refKey=T,i.getMenuProps.suppressRefError=$,he((I={},I[T]=Cr(R,i.menuRef),I.role="listbox",I["aria-labelledby"]=A&&A["aria-label"]?void 0:i.labelId,I.id=i.menuId,I),A)},i.getItemProps=function(h){var w,I=h===void 0?{}:h,O=I.onMouseMove,S=I.onMouseDown,T=I.onClick;I.onPress;var R=I.index,A=I.item,D=A===void 0?process.env.NODE_ENV==="production"?void 0:rb("getItemProps","item"):A,B=vn(I,pb);R===void 0?(i.items.push(D),R=i.items.indexOf(D)):i.items[R]=D;var $="onClick",L=T,J=(w={onMouseMove:ze(O,function(){R!==i.getState().highlightedIndex&&(i.setHighlightedIndex(R,{type:Lu}),i.avoidScrolling=!0,i.internalSetTimeout(function(){return i.avoidScrolling=!1},250))}),onMouseDown:ze(S,function(re){re.preventDefault()})},w[$]=ze(L,function(){i.selectItemAtIndex(R,{type:$u})}),w),ae=B.disabled?{onMouseDown:J.onMouseDown}:J;return he({id:i.getItemId(R),role:"option","aria-selected":i.getState().highlightedIndex===R},ae,B)},i.clearItems=function(){i.items=[]},i.reset=function(h,w){h===void 0&&(h={}),h=zi(h),i.internalSetState(function(I){var O=I.selectedItem;return he({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,inputValue:i.props.itemToString(O)},h)},w)},i.toggleMenu=function(h,w){h===void 0&&(h={}),h=zi(h),i.internalSetState(function(I){var O=I.isOpen;return he({isOpen:!O},O&&{highlightedIndex:i.props.defaultHighlightedIndex},h)},function(){var I=i.getState(),O=I.isOpen,S=I.highlightedIndex;O&&i.getItemCount()>0&&typeof S=="number"&&i.setHighlightedIndex(S,h),_c(w)()})},i.openMenu=function(h){i.internalSetState({isOpen:!0},h)},i.closeMenu=function(h){i.internalSetState({isOpen:!1},h)},i.updateStatus=ea(function(){var h;if((h=i.props)!=null&&(h=h.environment)!=null&&h.document){var w=i.getState(),I=i.items[w.highlightedIndex],O=i.getItemCount(),S=i.props.getA11yStatusMessage(he({itemToString:i.props.itemToString,previousResultCount:i.previousResultCount,resultCount:O,highlightedItem:I},w));i.previousResultCount=O,Mu(S,i.props.environment.document)}},200);var s=i.props,a=s.defaultHighlightedIndex,l=s.initialHighlightedIndex,d=l===void 0?a:l,u=s.defaultIsOpen,f=s.initialIsOpen,m=f===void 0?u:f,g=s.initialInputValue,v=g===void 0?"":g,y=s.initialSelectedItem,p=y===void 0?null:y,x=i.getState({highlightedIndex:d,isOpen:m,inputValue:v,selectedItem:p});return x.selectedItem!=null&&i.props.initialInputValue===void 0&&(x.inputValue=i.props.itemToString(x.selectedItem)),i.state=x,i}Uw(n,t);var r=n.prototype;return r.internalClearTimeouts=function(){this.timeoutIds.forEach(function(i){clearTimeout(i)}),this.timeoutIds=[]},r.getState=function(i){return i===void 0&&(i=this.state),co(i,this.props)},r.getItemCount=function(){var i=this.items.length;return this.itemCount!=null?i=this.itemCount:this.props.itemCount!==void 0&&(i=this.props.itemCount),i},r.getItemNodeFromIndex=function(i){return this.props.environment?this.props.environment.document.getElementById(this.getItemId(i)):null},r.scrollHighlightedItemIntoView=function(){{var i=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(i,this._menuNode)}},r.moveHighlightedIndex=function(i,s){var a=this.getItemCount(),l=this.getState(),d=l.highlightedIndex;if(a>0){var u=rr(d,i,{length:a},this.isItemDisabled,!0);this.setHighlightedIndex(u,s)}},r.getStateAndHelpers=function(){var i=this.getState(),s=i.highlightedIndex,a=i.inputValue,l=i.selectedItem,d=i.isOpen,u=this.props.itemToString,f=this.id,m=this.getRootProps,g=this.getToggleButtonProps,v=this.getLabelProps,y=this.getMenuProps,p=this.getInputProps,x=this.getItemProps,h=this.openMenu,w=this.closeMenu,I=this.toggleMenu,O=this.selectItem,S=this.selectItemAtIndex,T=this.selectHighlightedItem,R=this.setHighlightedIndex,A=this.clearSelection,D=this.clearItems,B=this.reset,$=this.setItemCount,L=this.unsetItemCount,J=this.internalSetState;return{getRootProps:m,getToggleButtonProps:g,getLabelProps:v,getMenuProps:y,getInputProps:p,getItemProps:x,reset:B,openMenu:h,closeMenu:w,toggleMenu:I,selectItem:O,selectItemAtIndex:S,selectHighlightedItem:T,setHighlightedIndex:R,clearSelection:A,clearItems:D,setItemCount:$,unsetItemCount:L,setState:J,itemToString:u,id:f,highlightedIndex:s,inputValue:a,isOpen:d,selectedItem:l}},r.componentDidMount=function(){var i=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&Nc(this._menuNode,this.getMenuProps),!this.props.environment)this.cleanup=function(){i.internalClearTimeouts()};else{var s=function(){i.isMouseDown=!0},a=function(g){i.isMouseDown=!1;var v=uo(g.target,[i._rootNode,i._menuNode],i.props.environment);!v&&i.getState().isOpen&&i.reset({type:ju},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},l=function(){i.isTouchMove=!1},d=function(){i.isTouchMove=!0},u=function(g){var v=uo(g.target,[i._rootNode,i._menuNode],i.props.environment,!1);!i.isTouchMove&&!v&&i.getState().isOpen&&i.reset({type:Qu},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},f=this.props.environment;f.addEventListener("mousedown",s),f.addEventListener("mouseup",a),f.addEventListener("touchstart",l),f.addEventListener("touchmove",d),f.addEventListener("touchend",u),this.cleanup=function(){i.internalClearTimeouts(),i.updateStatus.cancel(),f.removeEventListener("mousedown",s),f.removeEventListener("mouseup",a),f.removeEventListener("touchstart",l),f.removeEventListener("touchmove",d),f.removeEventListener("touchend",u)}}},r.shouldScroll=function(i,s){var a=this.props.highlightedIndex===void 0?this.getState():this.props,l=a.highlightedIndex,d=s.highlightedIndex===void 0?i:s,u=d.highlightedIndex,f=l&&this.getState().isOpen&&!i.isOpen,m=l!==u;return f||m},r.componentDidUpdate=function(i,s){process.env.NODE_ENV!=="production"&&(ta(this.state,i,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&Nc(this._menuNode,this.getMenuProps)),lo(this.props,"selectedItem")&&this.props.selectedItemChanged(i.selectedItem,this.props.selectedItem)&&this.internalSetState({type:zu,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(s,i)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},r.componentWillUnmount=function(){this.cleanup()},r.render=function(){var i=Ec(this.props.children,Ot);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=Ec(i(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&&mb(s,this.getRootProps),s;if(Fu(s))return b.cloneElement(s,this.getRootProps(Pu(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}(b.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:nb,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&ob(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:Ot,onInputValueChange:Ot,onUserAction:Ot,onChange:Ot,onSelect:Ot,onOuterClick:Ot,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:Ru},e.stateChangeTypes=cb,e}();process.env.NODE_ENV!=="production"&&(hb.propTypes={children:V.func,defaultHighlightedIndex:V.number,defaultIsOpen:V.bool,initialHighlightedIndex:V.number,initialSelectedItem:V.any,initialInputValue:V.string,initialIsOpen:V.bool,getA11yStatusMessage:V.func,itemToString:V.func,onChange:V.func,onSelect:V.func,onStateChange:V.func,onInputValueChange:V.func,onUserAction:V.func,onOuterClick:V.func,selectedItemChanged:V.func,stateReducer:V.func,itemCount:V.number,id:V.string,environment:V.shape({addEventListener:V.func.isRequired,removeEventListener:V.func.isRequired,document:V.shape({createElement:V.func.isRequired,getElementById:V.func.isRequired,activeElement:V.any.isRequired,body:V.any.isRequired}).isRequired,Node:V.func.isRequired}),suppressRefError:V.bool,scrollIntoView:V.func,selectedItem:V.any,isOpen:V.bool,inputValue:V.string,highlightedIndex:V.number,labelId:V.string,inputId:V.string,menuId:V.string,getItemId:V.func});function Nc(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 mb(e,t){var n=t.refKey,r=n!=="ref",o=!Fu(e);o&&!r&&!Cc.isForwardRef(e)?console.error("downshift: You returned a non-DOM element. You must specify a refKey in getRootProps"):!o&&r&&console.error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "'+n+'"'),!Cc.isForwardRef(e)&&!Pu(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Gu={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function gb(e,t,n){var r=e.props,o=e.type,i={};Object.keys(t).forEach(function(s){yb(s,e,t,n),n[s]!==t[s]&&(i[s]=n[s])}),r.onStateChange&&Object.keys(i).length&&r.onStateChange(he({type:o},i))}function yb(e,t,n,r){var o=t.props,i=t.type,s="on"+na(e)+"Change";o[s]&&r[e]!==void 0&&r[e]!==n[e]&&o[s](he({type:i},r))}function vb(e,t){return t.changes}var Tc=ea(function(e,t){Mu(e,t)},200),wb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?b.useLayoutEffect:b.useEffect,bb="useId"in b?function(t){var n=t.id,r=t.labelId,o=t.menuId,i=t.getItemId,s=t.toggleButtonId,a=t.inputId,l="downshift-"+b.useId();n||(n=l);var d=b.useRef({labelId:r||n+"-label",menuId:o||n+"-menu",getItemId:i||function(u){return n+"-item-"+u},toggleButtonId:s||n+"-toggle-button",inputId:a||n+"-input"});return d.current}:function(t){var n=t.id,r=n===void 0?"downshift-"+Au():n,o=t.labelId,i=t.menuId,s=t.getItemId,a=t.toggleButtonId,l=t.inputId,d=b.useRef({labelId:o||r+"-label",menuId:i||r+"-menu",getItemId:s||function(u){return r+"-item-"+u},toggleButtonId:a||r+"-toggle-button",inputId:l||r+"-input"});return d.current};function Ib(e,t,n,r){var o,i;if(e===void 0){if(t===void 0)throw new Error(r);o=n[t],i=t}else i=t===void 0?n.indexOf(e):t,o=e;return[o,i]}function na(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Xu(e){var t=b.useRef(e);return t.current=e,t}function Cb(e,t,n,r){var o=b.useRef(),i=b.useRef(),s=b.useCallback(function(g,v){i.current=v,g=co(g,v.props);var y=e(g,v),p=v.props.stateReducer(g,he({},v,{changes:y}));return p},[e]),a=b.useReducer(s,t,n),l=a[0],d=a[1],u=Xu(t),f=b.useCallback(function(g){return d(he({props:u.current},g))},[u]),m=i.current;return b.useEffect(function(){var g=co(o.current,m==null?void 0:m.props),v=m&&o.current&&!r(g,l);v&&gb(m,g,l),o.current=l},[l,m,r]),[l,f]}var ai={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:vb,scrollIntoView:Ru,environment:typeof window>"u"?void 0:window};function $n(e,t,n){n===void 0&&(n=Gu);var r=e["default"+na(t)];return r!==void 0?r:n[t]}function ci(e,t,n){n===void 0&&(n=Gu);var r=e[t];if(r!==void 0)return r;var o=e["initial"+na(t)];return o!==void 0?o:$n(e,t,n)}function xb(e){var t=ci(e,"selectedItem"),n=ci(e,"isOpen"),r=Nb(e),o=ci(e,"inputValue");return{highlightedIndex:r<0&&t&&n?e.items.findIndex(function(i){return e.itemToKey(i)===e.itemToKey(t)}):r,isOpen:n,selectedItem:t,inputValue:o}}function li(e,t,n){var r=e.items,o=e.initialHighlightedIndex,i=e.defaultHighlightedIndex,s=e.isItemDisabled,a=e.itemToKey,l=t.selectedItem,d=t.highlightedIndex;return r.length===0?-1:o!==void 0&&d===o&&!s(r[o],o)?o:i!==void 0&&!s(r[i],i)?i: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 Ob(e,t,n){var r=b.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return b.useEffect(function(){if(!e)return Ot;var o=n.map(function(u){return u.current});function i(){r.current.isTouchEnd=!1,r.current.isMouseDown=!0}function s(u){r.current.isMouseDown=!1,uo(u.target,o,e)||t()}function a(){r.current.isTouchEnd=!1,r.current.isTouchMove=!1}function l(){r.current.isTouchMove=!0}function d(u){r.current.isTouchEnd=!0,!r.current.isTouchMove&&!uo(u.target,o,e,!1)&&t()}return e.addEventListener("mousedown",i),e.addEventListener("mouseup",s),e.addEventListener("touchstart",a),e.addEventListener("touchmove",l),e.addEventListener("touchend",d),function(){e.removeEventListener("mousedown",i),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",l),e.removeEventListener("touchend",d)}},[n,e,t]),r.current}var Yu=function(){return Ot};process.env.NODE_ENV!=="production"&&(Yu=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=b.useRef(n.reduce(function(s,a){return s[a]={},s},{}));b.useEffect(function(){Object.keys(o.current).forEach(function(s){var a=o.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,d=a.refKey,u=a.elementRef;l||u!=null&&u.current||console.error('downshift: The ref prop "'+d+'" from '+s+" was not applied correctly on your element.")})},[]);var i=b.useCallback(function(s,a,l,d){o.current[s]={suppressRefError:a,refKey:l,elementRef:d}},[]);return i});function _b(e,t,n,r){r===void 0&&(r={});var o=r.document,i=_o();b.useEffect(function(){if(!(!e||i||!o)){var s=e(t);Tc(s,o)}},n),b.useEffect(function(){return function(){Tc.cancel(),ab(o)}},[o])}function Sb(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,o=e.getItemNodeFromIndex,i=e.menuElement,s=e.scrollIntoView,a=b.useRef(!0);return wb(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(o(t),i))},[t]),a}var Zu=Ot;process.env.NODE_ENV!=="production"&&(Zu=function(t){var n=t.props,r=t.state,o=b.useRef(n),i=_o();b.useEffect(function(){i||(ta(r,o.current,n),o.current=n)},[r,n,i])});function Rc(e,t,n){var r;n===void 0&&(n=!0);var o=((r=e.items)==null?void 0:r.length)&&t>=0;return he({isOpen:!1,highlightedIndex:-1},o&&he({selectedItem:e.items[t],isOpen:$n(e,"isOpen"),highlightedIndex:$n(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function Eb(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function _o(){var e=b.useRef(!0);return b.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function Ss(e){var t=$n(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function Nb(e){var t=ci(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var to={environment:V.shape({addEventListener:V.func.isRequired,removeEventListener:V.func.isRequired,document:V.shape({createElement:V.func.isRequired,getElementById:V.func.isRequired,activeElement:V.any.isRequired,body:V.any.isRequired}).isRequired,Node:V.func.isRequired}),itemToString:V.func,itemToKey:V.func,stateReducer:V.func},ed=he({},to,{getA11yStatusMessage:V.func,highlightedIndex:V.number,defaultHighlightedIndex:V.number,initialHighlightedIndex:V.number,isOpen:V.bool,defaultIsOpen:V.bool,initialIsOpen:V.bool,selectedItem:V.any,initialSelectedItem:V.any,defaultSelectedItem:V.any,id:V.string,labelId:V.string,menuId:V.string,getItemId:V.func,toggleButtonId:V.string,onSelectedItemChange:V.func,onHighlightedIndexChange:V.func,onStateChange:V.func,onIsOpenChange:V.func,scrollIntoView:V.func});function Tb(e,t,n){var r=t.type,o=t.props,i;switch(r){case n.ItemMouseMove:i={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:i={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:i={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:li(o,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:li(o,e,0)};break;case n.FunctionCloseMenu:i={isOpen:!1};break;case n.FunctionSetHighlightedIndex:i={highlightedIndex:o.isItemDisabled(o.items[t.highlightedIndex],t.highlightedIndex)?-1:t.highlightedIndex};break;case n.FunctionSetInputValue:i={inputValue:t.inputValue};break;case n.FunctionReset:i={highlightedIndex:Ss(o),isOpen:$n(o,"isOpen"),selectedItem:$n(o,"selectedItem"),inputValue:$n(o,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return he({},e,i)}qr(qr({},ed),{items:V.array.isRequired,isItemDisabled:V.func});qr(qr({},ai),{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 ra=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,ia=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,oa=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,sa=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,aa=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,ca=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,la=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,ua=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,da=process.env.NODE_ENV!=="production"?"__input_change__":8,fo=process.env.NODE_ENV!=="production"?"__input_blur__":9,fa=process.env.NODE_ENV!=="production"?"__input_click__":10,td=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,nd=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,pa=process.env.NODE_ENV!=="production"?"__item_click__":13,rd=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,id=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,od=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,sd=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,ad=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,ha=process.env.NODE_ENV!=="production"?"__function_select_item__":19,cd=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,ld=process.env.NODE_ENV!=="production"?"__function_reset__":21,ma=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,ud=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:ma,FunctionCloseMenu:sd,FunctionOpenMenu:od,FunctionReset:ld,FunctionSelectItem:ha,FunctionSetHighlightedIndex:ad,FunctionSetInputValue:cd,FunctionToggleMenu:id,InputBlur:fo,InputChange:da,InputClick:fa,InputKeyDownArrowDown:ra,InputKeyDownArrowUp:ia,InputKeyDownEnd:aa,InputKeyDownEnter:ua,InputKeyDownEscape:oa,InputKeyDownHome:sa,InputKeyDownPageDown:la,InputKeyDownPageUp:ca,ItemClick:pa,ItemMouseMove:nd,MenuMouseLeave:td,ToggleButtonClick:rd});function Rb(e){var t=xb(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)),he({},t,{inputValue:r})}var Ab=he({},ed,{items:V.array.isRequired,isItemDisabled:V.func,inputValue:V.string,defaultInputValue:V.string,initialInputValue:V.string,inputId:V.string,onInputValueChange:V.func});function Fb(e,t,n,r){var o=b.useRef(),i=Cb(e,t,n,r),s=i[0],a=i[1],l=_o();return b.useEffect(function(){if(lo(t,"selectedItem")){if(!l){var d=t.itemToKey(t.selectedItem)!==t.itemToKey(o.current);d&&a({type:ma,inputValue:t.itemToString(t.selectedItem)})}o.current=s.selectedItem===o.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[co(s,t),a]}var dd=Ot;process.env.NODE_ENV!=="production"&&(dd=function(t,n){V.checkPropTypes(Ab,t,"prop",n.name)});var Pb=he({},ai,{isItemDisabled:function(){return!1}});function Db(e,t){var n,r=t.type,o=t.props,i=t.altKey,s;switch(r){case pa:s={isOpen:$n(o,"isOpen"),highlightedIndex:Ss(o),selectedItem:o.items[t.index],inputValue:o.itemToString(o.items[t.index])};break;case ra:e.isOpen?s={highlightedIndex:rr(e.highlightedIndex,1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:i&&e.selectedItem==null?-1:li(o,e,1),isOpen:o.items.length>=0};break;case ia:e.isOpen?i?s=Rc(o,e.highlightedIndex):s={highlightedIndex:rr(e.highlightedIndex,-1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:li(o,e,-1),isOpen:o.items.length>=0};break;case ua:s=Rc(o,e.highlightedIndex);break;case oa:s=he({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case ca:s={highlightedIndex:rr(e.highlightedIndex,-10,o.items,o.isItemDisabled,!0)};break;case la:s={highlightedIndex:rr(e.highlightedIndex,10,o.items,o.isItemDisabled,!0)};break;case sa:s={highlightedIndex:Kr(0,!1,o.items,o.isItemDisabled)};break;case aa:s={highlightedIndex:Kr(o.items.length-1,!0,o.items,o.isItemDisabled)};break;case fo:s=he({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&((n=o.items)==null?void 0:n.length)&&t.selectItem&&{selectedItem:o.items[e.highlightedIndex],inputValue:o.itemToString(o.items[e.highlightedIndex])});break;case da:s={isOpen:!0,highlightedIndex:Ss(o),inputValue:t.inputValue};break;case fa:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:li(o,e,0)};break;case ha:s={selectedItem:t.selectedItem,inputValue:o.itemToString(t.selectedItem)};break;case ma:s={inputValue:t.inputValue};break;default:return Tb(e,t,ud)}return he({},e,s)}var Mb=["onMouseLeave","refKey","ref"],kb=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],jb=["onClick","onPress","refKey","ref"],Lb=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];ga.stateChangeTypes=ud;function ga(e){e===void 0&&(e={}),dd(e,ga);var t=he({},Pb,e),n=t.items,r=t.scrollIntoView,o=t.environment,i=t.getA11yStatusMessage,s=Fb(Db,t,Rb,Eb),a=s[0],l=s[1],d=a.isOpen,u=a.highlightedIndex,f=a.selectedItem,m=a.inputValue,g=b.useRef(null),v=b.useRef({}),y=b.useRef(null),p=b.useRef(null),x=_o(),h=bb(t),w=b.useRef(),I=Xu({state:a,props:t}),O=b.useCallback(function(H){return v.current[h.getItemId(H)]},[h]);_b(i,a,[d,u,f,m],o);var S=Sb({menuElement:g.current,highlightedIndex:u,isOpen:d,itemRefs:v,scrollIntoView:r,getItemNodeFromIndex:O});Zu({props:t,state:a}),b.useEffect(function(){var H=ci(t,"isOpen");H&&y.current&&y.current.focus()},[]),b.useEffect(function(){x||(w.current=n.length)});var T=Ob(o,b.useCallback(function(){I.current.state.isOpen&&l({type:fo,selectItem:!1})},[l,I]),b.useMemo(function(){return[g,p,y]},[g.current,p.current,y.current])),R=Yu("getInputProps","getMenuProps");b.useEffect(function(){d||(v.current={})},[d]),b.useEffect(function(){var H;!d||!(o!=null&&o.document)||!(y!=null&&(H=y.current)!=null&&H.focus)||o.document.activeElement!==y.current&&y.current.focus()},[d,o]);var A=b.useMemo(function(){return{ArrowDown:function(U){U.preventDefault(),l({type:ra,altKey:U.altKey})},ArrowUp:function(U){U.preventDefault(),l({type:ia,altKey:U.altKey})},Home:function(U){I.current.state.isOpen&&(U.preventDefault(),l({type:sa}))},End:function(U){I.current.state.isOpen&&(U.preventDefault(),l({type:aa}))},Escape:function(U){var K=I.current.state;(K.isOpen||K.inputValue||K.selectedItem||K.highlightedIndex>-1)&&(U.preventDefault(),l({type:oa}))},Enter:function(U){var K=I.current.state;!K.isOpen||U.which===229||(U.preventDefault(),l({type:ua}))},PageUp:function(U){I.current.state.isOpen&&(U.preventDefault(),l({type:ca}))},PageDown:function(U){I.current.state.isOpen&&(U.preventDefault(),l({type:la}))}}},[l,I]),D=b.useCallback(function(H){return he({id:h.labelId,htmlFor:h.inputId},H)},[h]),B=b.useCallback(function(H,U){var K,M=H===void 0?{}:H,Z=M.onMouseLeave,ee=M.refKey,W=ee===void 0?"ref":ee,te=M.ref,X=vn(M,Mb),de=U===void 0?{}:U,j=de.suppressRefError,we=j===void 0?!1:j;return R("getMenuProps",we,W,g),he((K={},K[W]=Cr(te,function(z){g.current=z}),K.id=h.menuId,K.role="listbox",K["aria-labelledby"]=X&&X["aria-label"]?void 0:""+h.labelId,K.onMouseLeave=ze(Z,function(){l({type:td})}),K),X)},[l,R,h]),$=b.useCallback(function(H){var U,K,M=H===void 0?{}:H,Z=M.item,ee=M.index,W=M.refKey,te=W===void 0?"ref":W,X=M.ref,de=M.onMouseMove,j=M.onMouseDown,we=M.onClick;M.onPress;var z=M.disabled,Ne=vn(M,kb);z!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var Ve=I.current,et=Ve.props,He=Ve.state,Ie=Ib(Z,ee,et.items,"Pass either item or index to getItemProps!"),kt=Ie[0],tt=Ie[1],It=et.isItemDisabled(kt,tt),jt="onClick",Lt=we,nt=function(){T.isTouchEnd||tt===He.highlightedIndex||(S.current=!1,l({type:nd,index:tt,disabled:It}))},Ge=function(){l({type:pa,index:tt})},Be=function(qt){return qt.preventDefault()};return he((U={},U[te]=Cr(X,function(Fe){Fe&&(v.current[h.getItemId(tt)]=Fe)}),U["aria-disabled"]=It,U["aria-selected"]=tt===He.highlightedIndex,U.id=h.getItemId(tt),U.role="option",U),!It&&(K={},K[jt]=ze(Lt,Ge),K),{onMouseMove:ze(de,nt),onMouseDown:ze(j,Be)},Ne)},[l,h,I,T,S]),L=b.useCallback(function(H){var U,K=H===void 0?{}:H,M=K.onClick;K.onPress;var Z=K.refKey,ee=Z===void 0?"ref":Z,W=K.ref,te=vn(K,jb),X=I.current.state,de=function(){l({type:rd})};return he((U={},U[ee]=Cr(W,function(j){p.current=j}),U["aria-controls"]=h.menuId,U["aria-expanded"]=X.isOpen,U.id=h.toggleButtonId,U.tabIndex=-1,U),!te.disabled&&he({},{onClick:ze(M,de)}),te)},[l,I,h]),J=b.useCallback(function(H,U){var K,M=H===void 0?{}:H,Z=M.onKeyDown,ee=M.onChange,W=M.onInput,te=M.onBlur;M.onChangeText;var X=M.onClick,de=M.refKey,j=de===void 0?"ref":de,we=M.ref,z=vn(M,Lb),Ne=U===void 0?{}:U,Ve=Ne.suppressRefError,et=Ve===void 0?!1:Ve;R("getInputProps",et,j,y);var He=I.current.state,Ie=function(Be){var Fe=Os(Be);Fe&&A[Fe]&&A[Fe](Be)},kt=function(Be){l({type:da,inputValue:Be.target.value})},tt=function(Be){if(o!=null&&o.document&&He.isOpen&&!T.isMouseDown){var Fe=Be.relatedTarget===null&&o.document.activeElement!==o.document.body;l({type:fo,selectItem:!Fe})}},It=function(){l({type:fa})},jt="onChange",Lt={};if(!z.disabled){var nt;Lt=(nt={},nt[jt]=ze(ee,W,kt),nt.onKeyDown=ze(Z,Ie),nt.onBlur=ze(te,tt),nt.onClick=ze(X,It),nt)}return he((K={},K[j]=Cr(we,function(Ge){y.current=Ge}),K["aria-activedescendant"]=He.isOpen&&He.highlightedIndex>-1?h.getItemId(He.highlightedIndex):"",K["aria-autocomplete"]="list",K["aria-controls"]=h.menuId,K["aria-expanded"]=He.isOpen,K["aria-labelledby"]=z&&z["aria-label"]?void 0:h.labelId,K.autoComplete="off",K.id=h.inputId,K.role="combobox",K.value=He.inputValue,K),Lt,z)},[l,h,o,A,I,T,R]),ae=b.useCallback(function(){l({type:id})},[l]),re=b.useCallback(function(){l({type:sd})},[l]),ne=b.useCallback(function(){l({type:od})},[l]),ge=b.useCallback(function(H){l({type:ad,highlightedIndex:H})},[l]),be=b.useCallback(function(H){l({type:ha,selectedItem:H})},[l]),F=b.useCallback(function(H){l({type:cd,inputValue:H})},[l]),q=b.useCallback(function(){l({type:ld})},[l]);return{getItemProps:$,getLabelProps:D,getMenuProps:B,getInputProps:J,getToggleButtonProps:L,toggleMenu:ae,openMenu:ne,closeMenu:re,setHighlightedIndex:ge,setInputValue:F,selectItem:be,reset:q,highlightedIndex:u,isOpen:d,selectedItem:f,inputValue:m}}to.stateReducer,to.itemToKey,to.environment,V.array,V.array,V.array,V.func,V.number,V.number,V.number,V.func,V.func,V.string,V.string;ai.itemToKey,ai.stateReducer,ai.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 qb="_comboboxContainer_1lcc8_1",Kb="_label_1lcc8_8",Ub="_inputContainer_1lcc8_12",Vb="_input_1lcc8_12",$b="_toggleButton_1lcc8_33",Hb="_menu_1lcc8_39",Bb="_menuBottom_1lcc8_55",Jb="_menuTop_1lcc8_61",Wb="_menuItem_1lcc8_66",zb="_highlighted_1lcc8_73",Qb="_selected_1lcc8_77",Gb="_hidden_1lcc8_81",$t={comboboxContainer:qb,label:Kb,inputContainer:Ub,input:Vb,toggleButton:$b,menu:Hb,menuBottom:Bb,menuTop:Jb,menuItem:Wb,highlighted:zb,selected:Qb,hidden:Gb};function Xb(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function fd({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:o,style:i,menuPosition:s="bottom"}){const[a,l]=b.useState(e),d=b.useRef(null);b.useEffect(()=>l(e),[e]);const u=b.useCallback(T=>{(T==null?void 0:T.length)>0?l(e.filter(Xb(T))):l(e)},[e]),{isOpen:f,getToggleButtonProps:m,getMenuProps:g,getInputProps:v,highlightedIndex:y,getItemProps:p,setInputValue:x,selectedItem:h}=ga({items:a,selectedItem:t?e.find(T=>T.value===t):null,itemToString:T=>(T==null?void 0:T.label)||"",onInputValueChange:({inputValue:T})=>u(T),onSelectedItemChange:({selectedItem:T})=>{var R;n(T),(R=d.current)==null||R.blur()}}),w=()=>{x(""),l(e)},I=()=>w(),O=b.useMemo(()=>{var T;return(T=e.find(R=>R.value===t))==null?void 0:T.label},[e,t]),S=()=>{t&&O&&t!==(h==null?void 0:h.value)&&x(O||"")};return c.jsxs("div",{style:{position:"relative",...i},children:[c.jsx("div",{className:$t.comboboxContainer,children:c.jsxs("div",{className:$t.inputContainer,children:[c.jsx("input",{style:{border:"none"},disabled:o,placeholder:r,className:$t.input,...v({onFocus:I,onBlur:S,ref:d})}),c.jsx("button",{style:{border:"none"},disabled:o,"aria-label":"toggle menu",className:$t.toggleButton,type:"button",...m(),children:f?c.jsx(c.Fragment,{children:"↑"}):c.jsx(c.Fragment,{children:"↓"})})]})}),c.jsx("ul",{className:`${$t.menu} ${f&&e.length?"":$t.hidden} ${s==="top"?$t.menuTop:$t.menuBottom}`,...g(),children:f&&a.map((T,R)=>c.jsx("li",{className:`${$t.menuItem} ${y===R?$t.highlighted:""} ${t===(T==null?void 0:T.value)?$t.selected:""}`,...p({item:T,index:R}),children:c.jsx("span",{children:T.label})},T.id))})]})}const Ur=Math.min,fr=Math.max,po=Math.round,Qi=Math.floor,Bn=e=>({x:e,y:e}),Yb={left:"right",right:"left",bottom:"top",top:"bottom"},Zb={start:"end",end:"start"};function Es(e,t,n){return fr(e,Ur(t,n))}function xi(e,t){return typeof e=="function"?e(t):e}function gr(e){return e.split("-")[0]}function Oi(e){return e.split("-")[1]}function pd(e){return e==="x"?"y":"x"}function ya(e){return e==="y"?"height":"width"}function Vr(e){return["top","bottom"].includes(gr(e))?"y":"x"}function va(e){return pd(Vr(e))}function eI(e,t,n){n===void 0&&(n=!1);const r=Oi(e),o=va(e),i=ya(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=ho(s)),[s,ho(s)]}function tI(e){const t=ho(e);return[Ns(e),t,Ns(t)]}function Ns(e){return e.replace(/start|end/g,t=>Zb[t])}function nI(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:s;default:return[]}}function rI(e,t,n,r){const o=Oi(e);let i=nI(gr(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(Ns)))),i}function ho(e){return e.replace(/left|right|bottom|top/g,t=>Yb[t])}function iI(e){return{top:0,right:0,bottom:0,left:0,...e}}function hd(e){return typeof e!="number"?iI(e):{top:e,right:e,bottom:e,left:e}}function mo(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Ac(e,t,n){let{reference:r,floating:o}=e;const i=Vr(t),s=va(t),a=ya(s),l=gr(t),d=i==="y",u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,m=r[a]/2-o[a]/2;let g;switch(l){case"top":g={x:u,y:r.y-o.height};break;case"bottom":g={x:u,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:f};break;case"left":g={x:r.x-o.width,y:f};break;default:g={x:r.x,y:r.y}}switch(Oi(t)){case"start":g[s]-=m*(n&&d?-1:1);break;case"end":g[s]+=m*(n&&d?-1:1);break}return g}const oI=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let d=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=Ac(d,r,l),m=r,g={},v=0;for(let y=0;y<a.length;y++){const{name:p,fn:x}=a[y],{x:h,y:w,data:I,reset:O}=await x({x:u,y:f,initialPlacement:r,placement:m,strategy:o,middlewareData:g,rects:d,platform:s,elements:{reference:e,floating:t}});u=h??u,f=w??f,g={...g,[p]:{...g[p],...I}},O&&v<=50&&(v++,typeof O=="object"&&(O.placement&&(m=O.placement),O.rects&&(d=O.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):O.rects),{x:u,y:f}=Ac(d,m,l)),y=-1)}return{x:u,y:f,placement:m,strategy:o,middlewareData:g}};async function md(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:m=!1,padding:g=0}=xi(t,e),v=hd(g),p=a[m?f==="floating"?"reference":"floating":f],x=mo(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(p)))==null||n?p:p.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:d,rootBoundary:u,strategy:l})),h=f==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),I=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},O=mo(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:h,offsetParent:w,strategy:l}):h);return{top:(x.top-O.top+v.top)/I.y,bottom:(O.bottom-x.bottom+v.bottom)/I.y,left:(x.left-O.left+v.left)/I.x,right:(O.right-x.right+v.right)/I.x}}const sI=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:l}=t,{element:d,padding:u=0}=xi(e,t)||{};if(d==null)return{};const f=hd(u),m={x:n,y:r},g=va(o),v=ya(g),y=await s.getDimensions(d),p=g==="y",x=p?"top":"left",h=p?"bottom":"right",w=p?"clientHeight":"clientWidth",I=i.reference[v]+i.reference[g]-m[g]-i.floating[v],O=m[g]-i.reference[g],S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(d));let T=S?S[w]:0;(!T||!await(s.isElement==null?void 0:s.isElement(S)))&&(T=a.floating[w]||i.floating[v]);const R=I/2-O/2,A=T/2-y[v]/2-1,D=Ur(f[x],A),B=Ur(f[h],A),$=D,L=T-y[v]-B,J=T/2-y[v]/2+R,ae=Es($,J,L),re=!l.arrow&&Oi(o)!=null&&J!==ae&&i.reference[v]/2-(J<$?D:B)-y[v]/2<0,ne=re?J<$?J-$:J-L:0;return{[g]:m[g]+ne,data:{[g]:ae,centerOffset:J-ae-ne,...re&&{alignmentOffset:ne}},reset:re}}}),aI=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:d}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:y=!0,...p}=xi(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const x=gr(o),h=Vr(a),w=gr(a)===a,I=await(l.isRTL==null?void 0:l.isRTL(d.floating)),O=m||(w||!y?[ho(a)]:tI(a)),S=v!=="none";!m&&S&&O.push(...rI(a,y,v,I));const T=[a,...O],R=await md(t,p),A=[];let D=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&A.push(R[x]),f){const J=eI(o,s,I);A.push(R[J[0]],R[J[1]])}if(D=[...D,{placement:o,overflows:A}],!A.every(J=>J<=0)){var B,$;const J=(((B=i.flip)==null?void 0:B.index)||0)+1,ae=T[J];if(ae)return{data:{index:J,overflows:D},reset:{placement:ae}};let re=($=D.filter(ne=>ne.overflows[0]<=0).sort((ne,ge)=>ne.overflows[1]-ge.overflows[1])[0])==null?void 0:$.placement;if(!re)switch(g){case"bestFit":{var L;const ne=(L=D.filter(ge=>{if(S){const be=Vr(ge.placement);return be===h||be==="y"}return!0}).map(ge=>[ge.placement,ge.overflows.filter(be=>be>0).reduce((be,F)=>be+F,0)]).sort((ge,be)=>ge[1]-be[1])[0])==null?void 0:L[0];ne&&(re=ne);break}case"initialPlacement":re=a;break}if(o!==re)return{reset:{placement:re}}}return{}}}};async function cI(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=gr(n),a=Oi(n),l=Vr(n)==="y",d=["left","top"].includes(s)?-1:1,u=i&&l?-1:1,f=xi(t,e);let{mainAxis:m,crossAxis:g,alignmentAxis:v}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof v=="number"&&(g=a==="end"?v*-1:v),l?{x:g*u,y:m*d}:{x:m*d,y:g*u}}const lI=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,l=await cI(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},uI=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:p=>{let{x,y:h}=p;return{x,y:h}}},...l}=xi(e,t),d={x:n,y:r},u=await md(t,l),f=Vr(gr(o)),m=pd(f);let g=d[m],v=d[f];if(i){const p=m==="y"?"top":"left",x=m==="y"?"bottom":"right",h=g+u[p],w=g-u[x];g=Es(h,g,w)}if(s){const p=f==="y"?"top":"left",x=f==="y"?"bottom":"right",h=v+u[p],w=v-u[x];v=Es(h,v,w)}const y=a.fn({...t,[m]:g,[f]:v});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[m]:i,[f]:s}}}}}};function So(){return typeof window<"u"}function Zr(e){return gd(e)?(e.nodeName||"").toLowerCase():"#document"}function _t(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function cn(e){var t;return(t=(gd(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function gd(e){return So()?e instanceof Node||e instanceof _t(e).Node:!1}function Qt(e){return So()?e instanceof Element||e instanceof _t(e).Element:!1}function sn(e){return So()?e instanceof HTMLElement||e instanceof _t(e).HTMLElement:!1}function Fc(e){return!So()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof _t(e).ShadowRoot}function _i(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Gt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function dI(e){return["table","td","th"].includes(Zr(e))}function Eo(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function wa(e){const t=ba(),n=Qt(e)?Gt(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 fI(e){let t=Jn(e);for(;sn(t)&&!$r(t);){if(wa(t))return t;if(Eo(t))return null;t=Jn(t)}return null}function ba(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function $r(e){return["html","body","#document"].includes(Zr(e))}function Gt(e){return _t(e).getComputedStyle(e)}function No(e){return Qt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Jn(e){if(Zr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Fc(e)&&e.host||cn(e);return Fc(t)?t.host:t}function yd(e){const t=Jn(e);return $r(t)?e.ownerDocument?e.ownerDocument.body:e.body:sn(t)&&_i(t)?t:yd(t)}function fi(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=yd(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=_t(o);if(i){const a=Ts(s);return t.concat(s,s.visualViewport||[],_i(o)?o:[],a&&n?fi(a):[])}return t.concat(o,fi(o,[],n))}function Ts(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function vd(e){const t=Gt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=sn(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=po(n)!==i||po(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function Ia(e){return Qt(e)?e:e.contextElement}function xr(e){const t=Ia(e);if(!sn(t))return Bn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=vd(t);let s=(i?po(n.width):n.width)/r,a=(i?po(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const pI=Bn(0);function wd(e){const t=_t(e);return!ba()||!t.visualViewport?pI:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function hI(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==_t(e)?!1:t}function yr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=Ia(e);let s=Bn(1);t&&(r?Qt(r)&&(s=xr(r)):s=xr(e));const a=hI(i,n,r)?wd(i):Bn(0);let l=(o.left+a.x)/s.x,d=(o.top+a.y)/s.y,u=o.width/s.x,f=o.height/s.y;if(i){const m=_t(i),g=r&&Qt(r)?_t(r):r;let v=m,y=Ts(v);for(;y&&r&&g!==v;){const p=xr(y),x=y.getBoundingClientRect(),h=Gt(y),w=x.left+(y.clientLeft+parseFloat(h.paddingLeft))*p.x,I=x.top+(y.clientTop+parseFloat(h.paddingTop))*p.y;l*=p.x,d*=p.y,u*=p.x,f*=p.y,l+=w,d+=I,v=_t(y),y=Ts(v)}}return mo({width:u,height:f,x:l,y:d})}function mI(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=cn(r),a=t?Eo(t.floating):!1;if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},d=Bn(1);const u=Bn(0),f=sn(r);if((f||!f&&!i)&&((Zr(r)!=="body"||_i(s))&&(l=No(r)),sn(r))){const m=yr(r);d=xr(r),u.x=m.x+r.clientLeft,u.y=m.y+r.clientTop}return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-l.scrollLeft*d.x+u.x,y:n.y*d.y-l.scrollTop*d.y+u.y}}function gI(e){return Array.from(e.getClientRects())}function Rs(e,t){const n=No(e).scrollLeft;return t?t.left+n:yr(cn(e)).left+n}function yI(e){const t=cn(e),n=No(e),r=e.ownerDocument.body,o=fr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=fr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Rs(e);const a=-n.scrollTop;return Gt(r).direction==="rtl"&&(s+=fr(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function vI(e,t){const n=_t(e),r=cn(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const d=ba();(!d||d&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a,y:l}}function wI(e,t){const n=yr(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=sn(e)?xr(e):Bn(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=o*i.x,d=r*i.y;return{width:s,height:a,x:l,y:d}}function Pc(e,t,n){let r;if(t==="viewport")r=vI(e,n);else if(t==="document")r=yI(cn(e));else if(Qt(t))r=wI(t,n);else{const o=wd(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return mo(r)}function bd(e,t){const n=Jn(e);return n===t||!Qt(n)||$r(n)?!1:Gt(n).position==="fixed"||bd(n,t)}function bI(e,t){const n=t.get(e);if(n)return n;let r=fi(e,[],!1).filter(a=>Qt(a)&&Zr(a)!=="body"),o=null;const i=Gt(e).position==="fixed";let s=i?Jn(e):e;for(;Qt(s)&&!$r(s);){const a=Gt(s),l=wa(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||_i(s)&&!l&&bd(e,s))?r=r.filter(u=>u!==s):o=a,s=Jn(s)}return t.set(e,r),r}function II(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?Eo(t)?[]:bI(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((d,u)=>{const f=Pc(t,u,o);return d.top=fr(f.top,d.top),d.right=Ur(f.right,d.right),d.bottom=Ur(f.bottom,d.bottom),d.left=fr(f.left,d.left),d},Pc(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function CI(e){const{width:t,height:n}=vd(e);return{width:t,height:n}}function xI(e,t,n){const r=sn(t),o=cn(t),i=n==="fixed",s=yr(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=Bn(0);if(r||!r&&!i)if((Zr(t)!=="body"||_i(o))&&(a=No(t)),r){const g=yr(t,!0,i,t);l.x=g.x+t.clientLeft,l.y=g.y+t.clientTop}else o&&(l.x=Rs(o));let d=0,u=0;if(o&&!r&&!i){const g=o.getBoundingClientRect();u=g.top+a.scrollTop,d=g.left+a.scrollLeft-Rs(o,g)}const f=s.left+a.scrollLeft-l.x-d,m=s.top+a.scrollTop-l.y-u;return{x:f,y:m,width:s.width,height:s.height}}function es(e){return Gt(e).position==="static"}function Dc(e,t){if(!sn(e)||Gt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return cn(e)===n&&(n=n.ownerDocument.body),n}function Id(e,t){const n=_t(e);if(Eo(e))return n;if(!sn(e)){let o=Jn(e);for(;o&&!$r(o);){if(Qt(o)&&!es(o))return o;o=Jn(o)}return n}let r=Dc(e,t);for(;r&&dI(r)&&es(r);)r=Dc(r,t);return r&&$r(r)&&es(r)&&!wa(r)?n:r||fI(e)||n}const OI=async function(e){const t=this.getOffsetParent||Id,n=this.getDimensions,r=await n(e.floating);return{reference:xI(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function _I(e){return Gt(e).direction==="rtl"}const SI={convertOffsetParentRelativeRectToViewportRelativeRect:mI,getDocumentElement:cn,getClippingRect:II,getOffsetParent:Id,getElementRects:OI,getClientRects:gI,getDimensions:CI,getScale:xr,isElement:Qt,isRTL:_I};function EI(e,t){let n=null,r;const o=cn(e);function i(){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),i();const{left:d,top:u,width:f,height:m}=e.getBoundingClientRect();if(a||t(),!f||!m)return;const g=Qi(u),v=Qi(o.clientWidth-(d+f)),y=Qi(o.clientHeight-(u+m)),p=Qi(d),h={rootMargin:-g+"px "+-v+"px "+-y+"px "+-p+"px",threshold:fr(0,Ur(1,l))||1};let w=!0;function I(O){const S=O[0].intersectionRatio;if(S!==l){if(!w)return s();S?s(!1,S):r=setTimeout(()=>{s(!1,1e-7)},1e3)}w=!1}try{n=new IntersectionObserver(I,{...h,root:o.ownerDocument})}catch{n=new IntersectionObserver(I,h)}n.observe(e)}return s(!0),i}function NI(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,d=Ia(e),u=o||i?[...d?fi(d):[],...fi(t)]:[];u.forEach(x=>{o&&x.addEventListener("scroll",n,{passive:!0}),i&&x.addEventListener("resize",n)});const f=d&&a?EI(d,n):null;let m=-1,g=null;s&&(g=new ResizeObserver(x=>{let[h]=x;h&&h.target===d&&g&&(g.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var w;(w=g)==null||w.observe(t)})),n()}),d&&!l&&g.observe(d),g.observe(t));let v,y=l?yr(e):null;l&&p();function p(){const x=yr(e);y&&(x.x!==y.x||x.y!==y.y||x.width!==y.width||x.height!==y.height)&&n(),y=x,v=requestAnimationFrame(p)}return n(),()=>{var x;u.forEach(h=>{o&&h.removeEventListener("scroll",n),i&&h.removeEventListener("resize",n)}),f==null||f(),(x=g)==null||x.disconnect(),g=null,l&&cancelAnimationFrame(v)}}const TI=lI,RI=uI,AI=aI,FI=sI,Mc=(e,t,n)=>{const r=new Map,o={platform:SI,...n},i={...o.platform,_c:r};return oI(e,t,{...o,platform:i})};/*
46
46
  * React Tooltip
47
47
  * {@link https://github.com/ReactTooltip/react-tooltip}
48
48
  * @copyright ReactTooltip Team
49
49
  * @license MIT
50
- */const RI="react-tooltip-core-styles",AI="react-tooltip-base-styles",Mc={core:!1,base:!1};function kc({css:e,id:t=AI,type:n="base",ref:r}){var o,i;if(!e||typeof document>"u"||Mc[n]||n==="core"&&typeof process<"u"&&(!((o=process==null?void 0:process.env)===null||o===void 0)&&o.REACT_TOOLTIP_DISABLE_CORE_STYLES)||n!=="base"&&typeof process<"u"&&(!((i=process==null?void 0:process.env)===null||i===void 0)&&i.REACT_TOOLTIP_DISABLE_BASE_STYLES))return;n==="core"&&(t=RI),r||(r={});const{insertAt:s}=r;if(document.getElementById(t))return;const a=document.head||document.getElementsByTagName("head")[0],c=document.createElement("style");c.id=t,c.type="text/css",s==="top"&&a.firstChild?a.insertBefore(c,a.firstChild):a.appendChild(c),c.styleSheet?c.styleSheet.cssText=e:c.appendChild(document.createTextNode(e)),Mc[n]=!0}const jc=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10,strategy:i="absolute",middlewares:s=[SI(Number(o)),NI({fallbackAxisSideDirection:"start"}),EI({padding:5})],border:a})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const c=s;return n?(c.push(TI({element:n,padding:5})),Dc(e,t,{placement:r,strategy:i,middleware:c}).then(({x:d,y:u,placement:f,middlewareData:m})=>{var g,v;const y={left:`${d}px`,top:`${u}px`,border:a},{x:p,y:x}=(g=m.arrow)!==null&&g!==void 0?g:{x:0,y:0},h=(v={top:"bottom",right:"left",bottom:"top",left:"right"}[f.split("-")[0]])!==null&&v!==void 0?v:"bottom",w=a&&{borderBottom:a,borderRight:a};let I=0;if(a){const O=`${a}`.match(/(\d+)px/);I=O!=null&&O[1]?Number(O[1]):1}return{tooltipStyles:y,tooltipArrowStyles:{left:p!=null?`${p}px`:"",top:x!=null?`${x}px`:"",right:"",bottom:"",...w,[h]:`-${4+I}px`},place:f}})):Dc(e,t,{placement:"bottom",strategy:i,middleware:c}).then(({x:d,y:u,placement:f})=>({tooltipStyles:{left:`${d}px`,top:`${u}px`},tooltipArrowStyles:{},place:f}))},Lc=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),qc=(e,t,n)=>{let r=null;const o=function(...i){const s=()=>{r=null};!r&&(e.apply(this,i),r=setTimeout(s,t))};return o.cancel=()=>{r&&(clearTimeout(r),r=null)},o},Kc=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",As=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((o,i)=>As(o,t[i]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Kc(e)||!Kc(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(o=>As(e[o],t[o]))},FI=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"})},Uc=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(FI(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},PI=typeof window<"u"?b.useLayoutEffect:b.useEffect,At=e=>{e.current&&(clearTimeout(e.current),e.current=null)},DI="DEFAULT_TOOLTIP_ID",MI={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},kI=b.createContext({getTooltipData:()=>MI});function Id(e=DI){return b.useContext(kI).getTooltipData(e)}var Ir={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"},ts={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 jI=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:o="dark",anchorId:i,anchorSelect:s,place:a="top",offset:c=10,events:d=["hover"],openOnClick:u=!1,positionStrategy:f="absolute",middlewares:m,wrapper:g,delayShow:v=0,delayHide:y=0,float:p=!1,hidden:x=!1,noArrow:h=!1,clickable:w=!1,closeOnEsc:I=!1,closeOnScroll:O=!1,closeOnResize:S=!1,openEvents:T,closeEvents:R,globalCloseEvents:A,imperativeModeOnly:D,style:B,position:$,afterShow:L,afterHide:J,disableTooltip:ae,content:re,contentWrapperRef:ne,isOpen:ge,defaultIsOpen:be=!1,setIsOpen:F,activeAnchor:q,setActiveAnchor:H,border:U,opacity:K,arrowColor:M,role:Z="tooltip"})=>{var ee;const W=b.useRef(null),te=b.useRef(null),X=b.useRef(null),de=b.useRef(null),j=b.useRef(null),[we,z]=b.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[Ne,Ve]=b.useState(!1),[et,He]=b.useState(!1),[Ie,kt]=b.useState(null),tt=b.useRef(!1),It=b.useRef(null),{anchorRefs:jt,setActiveAnchor:Lt}=Id(t),nt=b.useRef(!1),[Ge,Be]=b.useState([]),Fe=b.useRef(!1),qt=u||d.includes("click"),pt=qt||(T==null?void 0:T.click)||(T==null?void 0:T.dblclick)||(T==null?void 0:T.mousedown),ln=T?{...T}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!T&&qt&&Object.assign(ln,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const en=R?{...R}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!R&&qt&&Object.assign(en,{mouseleave:!1,blur:!1,mouseout:!1});const Ct=A?{...A}:{escape:I||!1,scroll:O||!1,resize:S||!1,clickOutsideAnchor:pt||!1};D&&(Object.assign(ln,{mouseover:!1,focus:!1,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(en,{mouseout:!1,blur:!1,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(Ct,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),PI(()=>(Fe.current=!0,()=>{Fe.current=!1}),[]);const Pe=Q=>{Fe.current&&(Q&&He(!0),setTimeout(()=>{Fe.current&&(F==null||F(Q),ge===void 0&&Ve(Q))},10))};b.useEffect(()=>{if(ge===void 0)return()=>null;ge&&He(!0);const Q=setTimeout(()=>{Ve(ge)},10);return()=>{clearTimeout(Q)}},[ge]),b.useEffect(()=>{if(Ne!==tt.current)if(At(j),tt.current=Ne,Ne)L==null||L();else{const Q=(ce=>{const le=ce.match(/^([\d.]+)(ms|s)$/);if(!le)return 0;const[,Ke,We]=le;return Number(Ke)*(We==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));j.current=setTimeout(()=>{He(!1),kt(null),J==null||J()},Q+25)}},[Ne]);const un=Q=>{z(ce=>As(ce,Q)?ce:Q)},On=(Q=v)=>{At(X),et?Pe(!0):X.current=setTimeout(()=>{Pe(!0)},Q)},dn=(Q=y)=>{At(de),de.current=setTimeout(()=>{nt.current||Pe(!1)},Q)},Gn=Q=>{var ce;if(!Q)return;const le=(ce=Q.currentTarget)!==null&&ce!==void 0?ce:Q.target;if(!(le!=null&&le.isConnected))return H(null),void Lt({current:null});v?On():Pe(!0),H(le),Lt({current:le}),At(de)},ht=()=>{w?dn(y||100):y?dn():Pe(!1),At(X)},fn=({x:Q,y:ce})=>{var le;const Ke={getBoundingClientRect:()=>({x:Q,y:ce,width:0,height:0,top:ce,left:Q,right:Q,bottom:ce})};jc({place:(le=Ie==null?void 0:Ie.place)!==null&&le!==void 0?le:a,offset:c,elementReference:Ke,tooltipReference:W.current,tooltipArrowReference:te.current,strategy:f,middlewares:m,border:U}).then(We=>{un(We)})},_n=Q=>{if(!Q)return;const ce=Q,le={x:ce.clientX,y:ce.clientY};fn(le),It.current=le},Xn=Q=>{var ce;if(!Ne)return;const le=Q.target;le.isConnected&&(!((ce=W.current)===null||ce===void 0)&&ce.contains(le)||[document.querySelector(`[id='${i}']`),...Ge].some(Ke=>Ke==null?void 0:Ke.contains(le))||(Pe(!1),At(X)))},Sn=qc(Gn,50),Ae=qc(ht,50),st=Q=>{Ae.cancel(),Sn(Q)},oe=()=>{Sn.cancel(),Ae()},me=b.useCallback(()=>{var Q,ce;const le=(Q=Ie==null?void 0:Ie.position)!==null&&Q!==void 0?Q:$;le?fn(le):p?It.current&&fn(It.current):q!=null&&q.isConnected&&jc({place:(ce=Ie==null?void 0:Ie.place)!==null&&ce!==void 0?ce:a,offset:c,elementReference:q,tooltipReference:W.current,tooltipArrowReference:te.current,strategy:f,middlewares:m,border:U}).then(Ke=>{Fe.current&&un(Ke)})},[Ne,q,re,B,a,Ie==null?void 0:Ie.place,c,f,$,Ie==null?void 0:Ie.position,p]);b.useEffect(()=>{var Q,ce;const le=new Set(jt);Ge.forEach(ye=>{ae!=null&&ae(ye)||le.add({current:ye})});const Ke=document.querySelector(`[id='${i}']`);Ke&&!(ae!=null&&ae(Ke))&&le.add({current:Ke});const We=()=>{Pe(!1)},mt=Uc(q),Xe=Uc(W.current);Ct.scroll&&(window.addEventListener("scroll",We),mt==null||mt.addEventListener("scroll",We),Xe==null||Xe.addEventListener("scroll",We));let rt=null;Ct.resize?window.addEventListener("resize",We):q&&W.current&&(rt=_I(q,W.current,me,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const gt=ye=>{ye.key==="Escape"&&Pe(!1)};Ct.escape&&window.addEventListener("keydown",gt),Ct.clickOutsideAnchor&&window.addEventListener("click",Xn);const Te=[],En=ye=>!!(ye!=null&&ye.target&&(q!=null&&q.contains(ye.target))),jo=ye=>{Ne&&En(ye)||Gn(ye)},Kt=ye=>{Ne&&En(ye)&&ht()},Ri=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],Ai=["click","dblclick","mousedown","mouseup"];Object.entries(ln).forEach(([ye,Ut])=>{Ut&&(Ri.includes(ye)?Te.push({event:ye,listener:st}):Ai.includes(ye)&&Te.push({event:ye,listener:jo}))}),Object.entries(en).forEach(([ye,Ut])=>{Ut&&(Ri.includes(ye)?Te.push({event:ye,listener:oe}):Ai.includes(ye)&&Te.push({event:ye,listener:Kt}))}),p&&Te.push({event:"pointermove",listener:_n});const Fi=()=>{nt.current=!0},Pi=()=>{nt.current=!1,ht()},Di=w&&(en.mouseout||en.mouseleave);return Di&&((Q=W.current)===null||Q===void 0||Q.addEventListener("mouseover",Fi),(ce=W.current)===null||ce===void 0||ce.addEventListener("mouseout",Pi)),Te.forEach(({event:ye,listener:Ut})=>{le.forEach(ni=>{var Yn;(Yn=ni.current)===null||Yn===void 0||Yn.addEventListener(ye,Ut)})}),()=>{var ye,Ut;Ct.scroll&&(window.removeEventListener("scroll",We),mt==null||mt.removeEventListener("scroll",We),Xe==null||Xe.removeEventListener("scroll",We)),Ct.resize?window.removeEventListener("resize",We):rt==null||rt(),Ct.clickOutsideAnchor&&window.removeEventListener("click",Xn),Ct.escape&&window.removeEventListener("keydown",gt),Di&&((ye=W.current)===null||ye===void 0||ye.removeEventListener("mouseover",Fi),(Ut=W.current)===null||Ut===void 0||Ut.removeEventListener("mouseout",Pi)),Te.forEach(({event:ni,listener:Yn})=>{le.forEach(Lo=>{var ri;(ri=Lo.current)===null||ri===void 0||ri.removeEventListener(ni,Yn)})})}},[q,me,et,jt,Ge,T,R,A,qt,v,y]),b.useEffect(()=>{var Q,ce;let le=(ce=(Q=Ie==null?void 0:Ie.anchorSelect)!==null&&Q!==void 0?Q:s)!==null&&ce!==void 0?ce:"";!le&&t&&(le=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const Ke=new MutationObserver(We=>{const mt=[],Xe=[];We.forEach(rt=>{if(rt.type==="attributes"&&rt.attributeName==="data-tooltip-id"&&(rt.target.getAttribute("data-tooltip-id")===t?mt.push(rt.target):rt.oldValue===t&&Xe.push(rt.target)),rt.type==="childList"){if(q){const gt=[...rt.removedNodes].filter(Te=>Te.nodeType===1);if(le)try{Xe.push(...gt.filter(Te=>Te.matches(le))),Xe.push(...gt.flatMap(Te=>[...Te.querySelectorAll(le)]))}catch{}gt.some(Te=>{var En;return!!(!((En=Te==null?void 0:Te.contains)===null||En===void 0)&&En.call(Te,q))&&(He(!1),Pe(!1),H(null),At(X),At(de),!0)})}if(le)try{const gt=[...rt.addedNodes].filter(Te=>Te.nodeType===1);mt.push(...gt.filter(Te=>Te.matches(le))),mt.push(...gt.flatMap(Te=>[...Te.querySelectorAll(le)]))}catch{}}}),(mt.length||Xe.length)&&Be(rt=>[...rt.filter(gt=>!Xe.includes(gt)),...mt])});return Ke.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{Ke.disconnect()}},[t,s,Ie==null?void 0:Ie.anchorSelect,q]),b.useEffect(()=>{me()},[me]),b.useEffect(()=>{if(!(ne!=null&&ne.current))return()=>null;const Q=new ResizeObserver(()=>{setTimeout(()=>me())});return Q.observe(ne.current),()=>{Q.disconnect()}},[re,ne==null?void 0:ne.current]),b.useEffect(()=>{var Q;const ce=document.querySelector(`[id='${i}']`),le=[...Ge,ce];q&&le.includes(q)||H((Q=Ge[0])!==null&&Q!==void 0?Q:ce)},[i,Ge,q]),b.useEffect(()=>(be&&Pe(!0),()=>{At(X),At(de)}),[]),b.useEffect(()=>{var Q;let ce=(Q=Ie==null?void 0:Ie.anchorSelect)!==null&&Q!==void 0?Q:s;if(!ce&&t&&(ce=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),ce)try{const le=Array.from(document.querySelectorAll(ce));Be(le)}catch{Be([])}},[t,s,Ie==null?void 0:Ie.anchorSelect]),b.useEffect(()=>{X.current&&(At(X),On(v))},[v]);const Je=(ee=Ie==null?void 0:Ie.content)!==null&&ee!==void 0?ee:re,pn=Ne&&Object.keys(we.tooltipStyles).length>0;return b.useImperativeHandle(e,()=>({open:Q=>{if(Q!=null&&Q.anchorSelect)try{document.querySelector(Q.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${Q.anchorSelect}" is not a valid CSS selector`)}kt(Q??null),Q!=null&&Q.delay?On(Q.delay):Pe(!0)},close:Q=>{Q!=null&&Q.delay?dn(Q.delay):Pe(!1)},activeAnchor:q,place:we.place,isOpen:!!(et&&!x&&Je&&pn)})),et&&!x&&Je?b.createElement(g,{id:t,role:Z,className:Dt("react-tooltip",Ir.tooltip,ts.tooltip,ts[o],n,`react-tooltip__place-${we.place}`,Ir[pn?"show":"closing"],pn?"react-tooltip__show":"react-tooltip__closing",f==="fixed"&&Ir.fixed,w&&Ir.clickable),onTransitionEnd:Q=>{At(j),Ne||Q.propertyName!=="opacity"||(He(!1),kt(null),J==null||J())},style:{...B,...we.tooltipStyles,opacity:K!==void 0&&pn?K:void 0},ref:W},Je,b.createElement(g,{className:Dt("react-tooltip-arrow",Ir.arrow,ts.arrow,r,h&&Ir.noArrow),style:{...we.tooltipArrowStyles,background:M?`linear-gradient(to right bottom, transparent 50%, ${M} 50%)`:void 0},ref:te})):null},LI=({content:e})=>b.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),qI=b.forwardRef(({id:e,anchorId:t,anchorSelect:n,content:r,html:o,render:i,className:s,classNameArrow:a,variant:c="dark",place:d="top",offset:u=10,wrapper:f="div",children:m=null,events:g=["hover"],openOnClick:v=!1,positionStrategy:y="absolute",middlewares:p,delayShow:x=0,delayHide:h=0,float:w=!1,hidden:I=!1,noArrow:O=!1,clickable:S=!1,closeOnEsc:T=!1,closeOnScroll:R=!1,closeOnResize:A=!1,openEvents:D,closeEvents:B,globalCloseEvents:$,imperativeModeOnly:L=!1,style:J,position:ae,isOpen:re,defaultIsOpen:ne=!1,disableStyleInjection:ge=!1,border:be,opacity:F,arrowColor:q,setIsOpen:H,afterShow:U,afterHide:K,disableTooltip:M,role:Z="tooltip"},ee)=>{const[W,te]=b.useState(r),[X,de]=b.useState(o),[j,we]=b.useState(d),[z,Ne]=b.useState(c),[Ve,et]=b.useState(u),[He,Ie]=b.useState(x),[kt,tt]=b.useState(h),[It,jt]=b.useState(w),[Lt,nt]=b.useState(I),[Ge,Be]=b.useState(f),[Fe,qt]=b.useState(g),[pt,ln]=b.useState(y),[en,Ct]=b.useState(null),[Pe,un]=b.useState(null),On=b.useRef(ge),{anchorRefs:dn,activeAnchor:Gn}=Id(e),ht=Ae=>Ae==null?void 0:Ae.getAttributeNames().reduce((st,oe)=>{var me;return oe.startsWith("data-tooltip-")&&(st[oe.replace(/^data-tooltip-/,"")]=(me=Ae==null?void 0:Ae.getAttribute(oe))!==null&&me!==void 0?me:null),st},{}),fn=Ae=>{const st={place:oe=>{var me;we((me=oe)!==null&&me!==void 0?me:d)},content:oe=>{te(oe??r)},html:oe=>{de(oe??o)},variant:oe=>{var me;Ne((me=oe)!==null&&me!==void 0?me:c)},offset:oe=>{et(oe===null?u:Number(oe))},wrapper:oe=>{var me;Be((me=oe)!==null&&me!==void 0?me:f)},events:oe=>{const me=oe==null?void 0:oe.split(" ");qt(me??g)},"position-strategy":oe=>{var me;ln((me=oe)!==null&&me!==void 0?me:y)},"delay-show":oe=>{Ie(oe===null?x:Number(oe))},"delay-hide":oe=>{tt(oe===null?h:Number(oe))},float:oe=>{jt(oe===null?w:oe==="true")},hidden:oe=>{nt(oe===null?I:oe==="true")},"class-name":oe=>{Ct(oe)}};Object.values(st).forEach(oe=>oe(null)),Object.entries(Ae).forEach(([oe,me])=>{var Je;(Je=st[oe])===null||Je===void 0||Je.call(st,me)})};b.useEffect(()=>{te(r)},[r]),b.useEffect(()=>{de(o)},[o]),b.useEffect(()=>{we(d)},[d]),b.useEffect(()=>{Ne(c)},[c]),b.useEffect(()=>{et(u)},[u]),b.useEffect(()=>{Ie(x)},[x]),b.useEffect(()=>{tt(h)},[h]),b.useEffect(()=>{jt(w)},[w]),b.useEffect(()=>{nt(I)},[I]),b.useEffect(()=>{ln(y)},[y]),b.useEffect(()=>{On.current!==ge&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")},[ge]),b.useEffect(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:ge==="core",disableBase:ge}}))},[]),b.useEffect(()=>{var Ae;const st=new Set(dn);let oe=n;if(!oe&&e&&(oe=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),oe)try{document.querySelectorAll(oe).forEach(ce=>{st.add({current:ce})})}catch{console.warn(`[react-tooltip] "${oe}" is not a valid CSS selector`)}const me=document.querySelector(`[id='${t}']`);if(me&&st.add({current:me}),!st.size)return()=>null;const Je=(Ae=Pe??me)!==null&&Ae!==void 0?Ae:Gn.current,pn=new MutationObserver(ce=>{ce.forEach(le=>{var Ke;if(!Je||le.type!=="attributes"||!(!((Ke=le.attributeName)===null||Ke===void 0)&&Ke.startsWith("data-tooltip-")))return;const We=ht(Je);fn(We)})}),Q={attributes:!0,childList:!1,subtree:!1};if(Je){const ce=ht(Je);fn(ce),pn.observe(Je,Q)}return()=>{pn.disconnect()}},[dn,Gn,Pe,t,n]),b.useEffect(()=>{J!=null&&J.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),be&&!Lc("border",`${be}`)&&console.warn(`[react-tooltip] "${be}" is not a valid \`border\`.`),J!=null&&J.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),F&&!Lc("opacity",`${F}`)&&console.warn(`[react-tooltip] "${F}" is not a valid \`opacity\`.`)},[]);let _n=m;const Xn=b.useRef(null);if(i){const Ae=i({content:(Pe==null?void 0:Pe.getAttribute("data-tooltip-content"))||W||null,activeAnchor:Pe});_n=Ae?b.createElement("div",{ref:Xn,className:"react-tooltip-content-wrapper"},Ae):null}else W&&(_n=W);X&&(_n=b.createElement(LI,{content:X}));const Sn={forwardRef:ee,id:e,anchorId:t,anchorSelect:n,className:Dt(s,en),classNameArrow:a,content:_n,contentWrapperRef:Xn,place:j,variant:z,offset:Ve,wrapper:Ge,events:Fe,openOnClick:v,positionStrategy:pt,middlewares:p,delayShow:He,delayHide:kt,float:It,hidden:Lt,noArrow:O,clickable:S,closeOnEsc:T,closeOnScroll:R,closeOnResize:A,openEvents:D,closeEvents:B,globalCloseEvents:$,imperativeModeOnly:L,style:J,position:ae,isOpen:re,defaultIsOpen:ne,border:be,opacity:F,arrowColor:q,setIsOpen:H,afterShow:U,afterHide:K,disableTooltip:M,activeAnchor:Pe,setActiveAnchor:Ae=>un(Ae),role:Z};return b.createElement(jI,{...Sn})});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}.core-styles-module_tooltip__3vRRp{position:absolute;top:0;left:0;pointer-events:none;opacity:0;will-change:opacity}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{opacity:var(--rt-opacity);transition:opacity var(--rt-transition-show-delay)ease-out}.core-styles-module_closing__sGnxF{opacity:0;transition:opacity var(--rt-transition-closing-delay)ease-in}",type:"core"}),e.detail.disableBase||kc({css:`
51
- .styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:8px;height:8px}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:"base"})});function KI(){return l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",children:[l.jsxs("g",{clipPath:"url(#clip0_2896_16290)",children:[l.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"}),l.jsx("path",{d:"M8.00293 5.83301L7.99768 5.83301",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"})]}),l.jsx("defs",{children:l.jsx("clipPath",{id:"clip0_2896_16290",children:l.jsx("rect",{width:"16",height:"16",fill:"white",transform:"translate(16 16.5) rotate(180)"})})})]})}function UI({id:e,tooltipText:t}){return l.jsxs(l.Fragment,{children:[l.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:KI()}),l.jsx(qI,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}const Cd=b.createContext(null);function xd(){const e=b.useContext(Cd);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const Od=b.createContext(()=>{});function VI(){const e=b.useContext(Od);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}var _d=Symbol.for("immer-nothing"),Vc=Symbol.for("immer-draftable"),St=Symbol.for("immer-state"),$I=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 wt(e,...t){if(process.env.NODE_ENV!=="production"){const n=$I[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 Br=Object.getPrototypeOf;function Jr(e){return!!e&&!!e[St]}function vr(e){var t;return e?Sd(e)||Array.isArray(e)||!!e[Vc]||!!((t=e.constructor)!=null&&t[Vc])||Ro(e)||Ao(e):!1}var HI=Object.prototype.constructor.toString();function Sd(e){if(!e||typeof e!="object")return!1;const t=Br(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===HI}function go(e,t){To(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function To(e){const t=e[St];return t?t.type_:Array.isArray(e)?1:Ro(e)?2:Ao(e)?3:0}function Fs(e,t){return To(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Ed(e,t,n){const r=To(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function BI(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Ro(e){return e instanceof Map}function Ao(e){return e instanceof Set}function nr(e){return e.copy_||e.base_}function Ps(e,t){if(Ro(e))return new Map(e);if(Ao(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[St];let o=Reflect.ownKeys(r);for(let i=0;i<o.length;i++){const s=o[i],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(Br(e),r)}else{const r=Br(e);if(r!==null&&n)return{...e};const o=Object.create(r);return Object.assign(o,e)}}function Ia(e,t=!1){return Fo(e)||Jr(e)||!vr(e)||(To(e)>1&&(e.set=e.add=e.clear=e.delete=JI),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Ia(r,!0))),e}function JI(){wt(2)}function Fo(e){return Object.isFrozen(e)}var WI={};function wr(e){const t=WI[e];return t||wt(0,e),t}var hi;function Nd(){return hi}function zI(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function $c(e,t){t&&(wr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ds(e){Ms(e),e.drafts_.forEach(QI),e.drafts_=null}function Ms(e){e===hi&&(hi=e.parent_)}function Hc(e){return hi=zI(hi,e)}function QI(e){const t=e[St];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Bc(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[St].modified_&&(Ds(t),wt(4)),vr(e)&&(e=yo(t,e),t.parent_||vo(t,e)),t.patches_&&wr("Patches").generateReplacementPatches_(n[St].base_,e,t.patches_,t.inversePatches_)):e=yo(t,n,[]),Ds(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==_d?e:void 0}function yo(e,t,n){if(Fo(t))return t;const r=t[St];if(!r)return go(t,(o,i)=>Jc(e,r,t,o,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return vo(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const o=r.copy_;let i=o,s=!1;r.type_===3&&(i=new Set(o),o.clear(),s=!0),go(i,(a,c)=>Jc(e,r,o,a,c,n,s)),vo(e,o,!1),n&&e.patches_&&wr("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Jc(e,t,n,r,o,i,s){if(process.env.NODE_ENV!=="production"&&o===n&&wt(5),Jr(o)){const a=i&&t&&t.type_!==3&&!Fs(t.assigned_,r)?i.concat(r):void 0,c=yo(e,o,a);if(Ed(n,r,c),Jr(c))e.canAutoFreeze_=!1;else return}else s&&n.add(o);if(vr(o)&&!Fo(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;yo(e,o),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&vo(e,o)}}function vo(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ia(t,n)}function GI(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Nd(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=Ca;n&&(o=[r],i=mi);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}var Ca={get(e,t){if(t===St)return e;const n=nr(e);if(!Fs(n,t))return XI(e,n,t);const r=n[t];return e.finalized_||!vr(r)?r:r===ns(e.base_,t)?(rs(e),e.copy_[t]=js(r,e)):r},has(e,t){return t in nr(e)},ownKeys(e){return Reflect.ownKeys(nr(e))},set(e,t,n){const r=Td(nr(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=ns(nr(e),t),i=o==null?void 0:o[St];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(BI(n,o)&&(n!==void 0||Fs(e.base_,t)))return!0;rs(e),ks(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 ns(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,rs(e),ks(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=nr(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){wt(11)},getPrototypeOf(e){return Br(e.base_)},setPrototypeOf(){wt(12)}},mi={};go(Ca,(e,t)=>{mi[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});mi.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&wt(13),mi.set.call(this,e,t,void 0)};mi.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&wt(14),Ca.set.call(this,e[0],t,n,e[0])};function ns(e,t){const n=e[St];return(n?nr(n):e)[t]}function XI(e,t,n){var o;const r=Td(t,n);return r?"value"in r?r.value:(o=r.get)==null?void 0:o.call(e.draft_):void 0}function Td(e,t){if(!(t in e))return;let n=Br(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Br(n)}}function ks(e){e.modified_||(e.modified_=!0,e.parent_&&ks(e.parent_))}function rs(e){e.copy_||(e.copy_=Ps(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var YI=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(c=i,...d){return s.produce(c,u=>n.call(this,u,...d))}}typeof n!="function"&&wt(6),r!==void 0&&typeof r!="function"&&wt(7);let o;if(vr(t)){const i=Hc(this),s=js(t,void 0);let a=!0;try{o=n(s),a=!1}finally{a?Ds(i):Ms(i)}return $c(i,r),Bc(o,i)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===_d&&(o=void 0),this.autoFreeze_&&Ia(o,!0),r){const i=[],s=[];wr("Patches").generateReplacementPatches_(t,o,i,s),r(i,s)}return o}else wt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,c=>t(c,...a));let r,o;return[this.produce(t,n,(s,a)=>{r=s,o=a}),r,o]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){vr(e)||wt(8),Jr(e)&&(e=ZI(e));const t=Hc(this),n=js(e,void 0);return n[St].isManual_=!0,Ms(t),n}finishDraft(e,t){const n=e&&e[St];(!n||!n.isManual_)&&wt(9);const{scope_:r}=n;return $c(r,t),Bc(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const o=t[n];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}n>-1&&(t=t.slice(n+1));const r=wr("Patches").applyPatches_;return Jr(e)?r(e,t):this.produce(e,o=>r(o,t))}};function js(e,t){const n=Ro(e)?wr("MapSet").proxyMap_(e,t):Ao(e)?wr("MapSet").proxySet_(e,t):GI(e,t);return(t?t.scope_:Nd()).drafts_.push(n),n}function ZI(e){return Jr(e)||wt(10,e),Rd(e)}function Rd(e){if(!vr(e)||Fo(e))return e;const t=e[St];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Ps(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Ps(e,!0);return go(n,(r,o)=>{Ed(n,r,Rd(o))}),t&&(t.finalized_=!1),n}var Et=new YI,Pt=Et.produce;Et.produceWithPatches.bind(Et);Et.setAutoFreeze.bind(Et);Et.setUseStrictShallowCopy.bind(Et);Et.applyPatches.bind(Et);Et.createDraft.bind(Et);Et.finishDraft.bind(Et);const Ad=b.createContext(void 0),eC={};function xa(){const e=b.useContext(Ad);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function tC({children:e}){const{installation:t}=Ze(),{hydratedRevision:n,loading:r}=Zr(),[o,i]=b.useState(eC),s=t==null?void 0:t.config;b.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(o).length>0)&&$v(n,s,i)},[n,r,s,o]);const a=b.useCallback((g,v)=>{i(y=>Pt(y,p=>{p[g]=Pt(p[g],v)}))},[i]),c=b.useCallback((g,v)=>{i(y=>Pt(y,p=>{p[g]=v}))},[i]),d=b.useCallback(()=>{i(Pt(g=>{const v=g.other.write;v&&(v.isWriteModified=!1)}))},[i]),u=b.useCallback(g=>{i(Pt(v=>{var p;const y=(p=v[g])==null?void 0:p.read;y&&(y.isOptionalFieldsModified=!1,y.isRequiredMapFieldsModified=!1,y.isValueMappingsModified=!1)}))},[i]),f=b.useCallback(g=>{g===mr?d():u(g)},[u,d]),m=b.useMemo(()=>({objectConfigurationsState:o,setObjectConfigurationsState:i,setConfigureState:a,resetConfigureState:c,resetPendingConfigurationState:f}),[o,c,f,a]);return l.jsx(Ad.Provider,{value:m,children:e})}const Zt=()=>{const{appName:e}=Ee(),{objectConfigurationsState:t,setConfigureState:n}=xa(),{selectedObjectName:r}=xd(),o=gu(r||"",t);return{appName:e,configureState:o,setConfigureState:n,selectedObjectName:r}};function nC(e,t){var r;const n=((r=e==null?void 0:e.read)==null?void 0:r.selectedFieldMappings)||{};if(t.forEach(o=>{const{field:i,value:s}=o;s===null?delete n[i]:n[i]=s}),e!=null&&e.read){const o=e.read.savedConfig.requiredMapFields,s=!uu(o,n);e.read.isRequiredMapFieldsModified=s}}function gi(e,t,n){t(e,r=>nC(r,n))}const rC="Each field must be mapped to a unique value";function Oa({field:e,onSelectChange:t,allFields:n}){var h;const{configureState:r,selectedObjectName:o,setConfigureState:i}=Zt(),[s,a]=b.useState(!0),{isError:c,removeError:d,getError:u}=Mt(),f=(h=r==null?void 0:r.read)==null?void 0:h.selectedFieldMappings,m=f==null?void 0:f[e.mapToName];b.useEffect(()=>{e._default&&!m&&o&&r&&gi(o,i,[{field:e.mapToName,value:e._default}]),a(!1)},[e,i,o,m,r]);const g=b.useMemo(()=>n.map(w=>({id:w.fieldName,label:w.displayName,value:w.fieldName})),[n]),v=l.jsx(dd,{disabled:s,items:g,selectedValue:m||null,onSelectedItemChange:w=>{t({target:{name:e.mapToName,value:w==null?void 0:w.value}})},placeholder:"Please select one",style:{width:"100%"}}),y=b.useCallback(()=>{o&&(gi(o,i,[{field:e.mapToName,value:null}]),c(ue.MAPPING,o)&&d(ue.MAPPING,o))},[e.mapToName,o,i,c,d]),{hasDuplicationError:p,errorMessage:x}=b.useMemo(()=>{const w=u(ue.MAPPING,o),I=Array.isArray(w)&&w.length>0&&w.includes(e.mapToName);return{hasDuplicationError:I,errorMessage:I?rC:""}},[o,u,e.mapToName]);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:[l.jsx("span",{style:{fontWeight:500},children:e.mapToDisplayName??e.mapToName}),l.jsx("span",{children:(e==null?void 0:e.prompt)&&l.jsx(UI,{id:`tooltip-id-${e==null?void 0:e.prompt}`,tooltipText:e==null?void 0:e.prompt})})]}),l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[v,l.jsx($e,{type:"button",variant:"ghost",onClick:y,children:"Clear"})]})]},e.mapToName),p&&l.jsxs("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:[" ",x," "]},e.mapToName)]})}const iC="_formControl_9qd8d_1",oC="_formLabel_9qd8d_5",sC="_formLabelRequired_9qd8d_11",aC="_formInput_9qd8d_16",cC="_formInputInvalid_9qd8d_20",lC="_formError_9qd8d_24",uC="_disabled_9qd8d_30",tr={formControl:iC,formLabel:oC,formLabelRequired:sC,formInput:aC,formInputInvalid:cC,formError:lC,disabled:uC};function Po({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:o=!1,errorMessage:i,children:s}){return l.jsxs("div",{className:Dt(tr.formControl,{[tr.disabled]:r}),children:[t&&l.jsx("label",{htmlFor:e,className:Dt(tr.formLabel,{[tr.formLabelRequired]:n}),children:t}),l.jsx("div",{id:e,className:Dt(tr.formInput,{[tr.formInputInvalid]:o}),children:s}),o&&i&&l.jsx("div",{className:tr.formError,role:"alert",children:i})]})}function Fd({selectedFieldMappings:e,selectedObjectName:t,fieldName:n,fieldValue:r,setError:o}){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(c=>e[c]===r),a=[n,...s];return o(ue.MAPPING,t,a),!0}return!1}function dC({dynamicFieldMappings:e,onSelectChange:t,allFields:n}){return e.length?l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:e.map(r=>l.jsx(Po,{id:r.mapToName,children:l.jsx(Oa,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function fC(){var v,y;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Zt(),{isError:r,removeError:o,setError:i}=Mt(),s=((v=t==null?void 0:t.read)==null?void 0:v.allFields)||[],{fieldMapping:a}=Ze(),c=(y=t==null?void 0:t.read)==null?void 0:y.selectedFieldMappings,d=p=>{const{value:x,name:h}=p.target;!x||Fd({selectedFieldMappings:c,selectedObjectName:e,fieldName:h,fieldValue:x,setError:i})||(e&&gi(e,n,[{field:h,value:x}]),r(ue.MAPPING,h)&&o(ue.MAPPING,h),e&&r(ue.MAPPING,e)&&o(ue.MAPPING,e))},u=b.useMemo(()=>!e||!a?[]:Object.values(a[e]||{}).flat().filter(p=>!p.fieldName),[a,e]),f=b.useMemo(()=>{var h;return(((h=t==null?void 0:t.read)==null?void 0:h.optionalMapFields)||[]).filter(w=>!u.some(I=>I.mapToName===w.mapToName))},[t,u]),m=u.length>0;return f.length>0||m?l.jsxs(l.Fragment,{children:[l.jsx(Nt,{string:"Map the following optional fields"}),l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:[f==null?void 0:f.map(p=>l.jsx(Po,{id:p.mapToName,children:l.jsx(Oa,{allFields:s,field:p,onSelectChange:d})},p.mapToName)),m&&l.jsx(dC,{dynamicFieldMappings:u,onSelectChange:d,allFields:s})]})]}):null}function pC(){var d;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Zt(),{isError:r,removeError:o,setError:i}=Mt(),s=(d=t==null?void 0:t.read)==null?void 0:d.selectedFieldMappings,a=u=>{const{value:f,name:m}=u.target;!f||Fd({selectedFieldMappings:s,selectedObjectName:e,fieldName:m,fieldValue:f,setError:i})||(e&&gi(e,n,[{field:m,value:f}]),r(ue.MAPPING,m)&&o(ue.MAPPING,m),e&&r(ue.MAPPING,e)&&o(ue.MAPPING,e))},c=b.useMemo(()=>{var u;return((u=t==null?void 0:t.read)==null?void 0:u.requiredMapFields)||[]},[t]);return c!=null&&c.length?l.jsxs(l.Fragment,{children:[l.jsx(Nt,{string:"Map the following fields"}),l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:c.map(u=>{var f;return l.jsx(Po,{id:u.mapToName,isInvalid:r(ue.MAPPING,u.mapToName),errorMessage:"* required",children:l.jsx(Oa,{allFields:((f=t==null?void 0:t.read)==null?void 0:f.allFields)||[],field:u,onSelectChange:a})},u.mapToName)})})]}):null}const hC=(e,t)=>e.filter(n=>!t.has(n));function mC(){var m,g,v;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Zt(),{fieldMapping:r}=Ze(),o=((m=t==null?void 0:t.read)==null?void 0:m.selectedFieldMappings)||{},i=Object.keys(o),s=((g=t==null?void 0:t.read)==null?void 0:g.requiredMapFields)||[],a=((v=t==null?void 0:t.read)==null?void 0:v.optionalMapFields)||[],c=e&&r?Object.values(r[e]||{}).flat().filter(y=>!y.fieldName):[],d=s.concat(c,a).map(y=>y.mapToName),u=new Set(d),f=hC(i,u);b.useEffect(()=>{e&&f.length&&gi(e,n,f.map(y=>({field:y,value:null})))},[e,n,f])}const gC={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function yC({children:e,style:t}){return l.jsx(Cn,{style:{...gC,...t},children:e})}function vC(){var d,u,f;const{project:e}=Ee(),{hydratedRevision:t}=Zr(),{selectedObjectName:n}=Zt(),{providerName:r}=lt(),o=e==null?void 0:e.appName,i=(f=(u=(d=t==null?void 0:t.content)==null?void 0:d.read)==null?void 0:u.objects)==null?void 0:f.find(m=>m.objectName===n),s=(i==null?void 0:i.displayName)||n&&Qt(n),a=i==null?void 0:i.mapToName,c=(i==null?void 0:i.mapToDisplayName)||a&&Qt(a);return c&&o&&r?l.jsx(yC,{style:{marginTop:"1rem"},children:l.jsxs("p",{style:{margin:"1rem 0"},children:[l.jsx("b",{children:c})," in ",o," is mapped to"," ",l.jsx("b",{children:s})," in ",r,"."]})}):null}function Wc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Pd(...e){return t=>{let n=!1;const r=e.map(o=>{const i=Wc(o,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){const i=r[o];typeof i=="function"?i():Wc(e[o],null)}}}}function Wr(...e){return k.useCallback(Pd(...e),e)}function Do(e,t=[]){let n=[];function r(i,s){const a=k.createContext(s),c=n.length;n=[...n,s];const d=f=>{var x;const{scope:m,children:g,...v}=f,y=((x=m==null?void 0:m[e])==null?void 0:x[c])||a,p=k.useMemo(()=>v,Object.values(v));return l.jsx(y.Provider,{value:p,children:g})};d.displayName=i+"Provider";function u(f,m){var y;const g=((y=m==null?void 0:m[e])==null?void 0:y[c])||a,v=k.useContext(g);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[d,u]}const o=()=>{const i=n.map(s=>k.createContext(s));return function(a){const c=(a==null?void 0:a[e])||i;return k.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return o.scopeName=e,[r,wC(o,...t)]}function wC(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:c,scopeName:d})=>{const f=c(i)[`__scope${d}`];return{...a,...f}},{});return k.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function zt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}var yi=globalThis!=null&&globalThis.document?k.useLayoutEffect:()=>{},bC=k[" useInsertionEffect ".trim().toString()]||yi;function _a({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,s]=IC({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:o;{const u=k.useRef(e!==void 0);k.useEffect(()=>{const f=u.current;f!==a&&console.warn(`${r} is changing from ${f?"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 d=k.useCallback(u=>{var f;if(a){const m=CC(u)?u(e):u;m!==e&&((f=s.current)==null||f.call(s,m))}else i(u)},[a,e,i,s]);return[c,d]}function IC({defaultProp:e,onChange:t}){const[n,r]=k.useState(e),o=k.useRef(n),i=k.useRef(t);return bC(()=>{i.current=t},[t]),k.useEffect(()=>{var s;o.current!==n&&((s=i.current)==null||s.call(i,n),o.current=n)},[n,o]),[n,r,i]}function CC(e){return typeof e=="function"}function xC(e){const t=k.useRef({value:e,previous:e});return k.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function OC(e){const[t,n]=k.useState(void 0);return yi(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const c=i.borderBoxSize,d=Array.isArray(c)?c[0]:c;s=d.inlineSize,a=d.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 _C(e,t){return k.useReducer((n,r)=>t[n][r]??n,e)}var Sa=e=>{const{present:t,children:n}=e,r=SC(t),o=typeof n=="function"?n({present:r.isPresent}):k.Children.only(n),i=Wr(r.ref,EC(o));return typeof n=="function"||r.isPresent?k.cloneElement(o,{ref:i}):null};Sa.displayName="Presence";function SC(e){const[t,n]=k.useState(),r=k.useRef(null),o=k.useRef(e),i=k.useRef("none"),s=e?"mounted":"unmounted",[a,c]=_C(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return k.useEffect(()=>{const d=Xi(r.current);i.current=a==="mounted"?d:"none"},[a]),yi(()=>{const d=r.current,u=o.current;if(u!==e){const m=i.current,g=Xi(d);e?c("MOUNT"):g==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(u&&m!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),yi(()=>{if(t){let d;const u=t.ownerDocument.defaultView??window,f=g=>{const y=Xi(r.current).includes(g.animationName);if(g.target===t&&y&&(c("ANIMATION_END"),!o.current)){const p=t.style.animationFillMode;t.style.animationFillMode="forwards",d=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=p)})}},m=g=>{g.target===t&&(i.current=Xi(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{u.clearTimeout(d),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:k.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function Xi(e){return(e==null?void 0:e.animationName)||"none"}function EC(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Ls(e){const t=NC(e),n=k.forwardRef((r,o)=>{const{children:i,...s}=r,a=k.Children.toArray(i),c=a.find(RC);if(c){const d=c.props.children,u=a.map(f=>f===c?k.Children.count(d)>1?k.Children.only(null):k.isValidElement(d)?d.props.children:null:f);return l.jsx(t,{...s,ref:o,children:k.isValidElement(d)?k.cloneElement(d,void 0,u):null})}return l.jsx(t,{...s,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function NC(e){const t=k.forwardRef((n,r)=>{const{children:o,...i}=n;if(k.isValidElement(o)){const s=FC(o),a=AC(i,o.props);return o.type!==k.Fragment&&(a.ref=r?Pd(r,s):s),k.cloneElement(o,a)}return k.Children.count(o)>1?k.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var TC=Symbol("radix.slottable");function RC(e){return k.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===TC}function AC(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{const c=i(...a);return o(...a),c}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function FC(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var PC=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],xn=PC.reduce((e,t)=>{const n=Ls(`Primitive.${t}`),r=k.forwardRef((o,i)=>{const{asChild:s,...a}=o,c=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Mo="Checkbox",[DC,iO]=Do(Mo),[MC,Ea]=DC(Mo);function kC(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:o,disabled:i,form:s,name:a,onCheckedChange:c,required:d,value:u="on",internal_do_not_use_render:f}=e,[m,g]=_a({prop:n,defaultProp:o??!1,onChange:c,caller:Mo}),[v,y]=k.useState(null),[p,x]=k.useState(null),h=k.useRef(!1),w=v?!!s||!!v.closest("form"):!0,I={checked:m,disabled:i,setChecked:g,control:v,setControl:y,name:a,form:s,value:u,hasConsumerStoppedPropagationRef:h,required:d,defaultChecked:Hn(o)?!1:o,isFormControl:w,bubbleInput:p,setBubbleInput:x};return l.jsx(MC,{scope:t,...I,children:jC(f)?f(I):r})}var Dd="CheckboxTrigger",Md=k.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},o)=>{const{control:i,value:s,disabled:a,checked:c,required:d,setControl:u,setChecked:f,hasConsumerStoppedPropagationRef:m,isFormControl:g,bubbleInput:v}=Ea(Dd,e),y=Wr(o,u),p=k.useRef(c);return k.useEffect(()=>{const x=i==null?void 0:i.form;if(x){const h=()=>f(p.current);return x.addEventListener("reset",h),()=>x.removeEventListener("reset",h)}},[i,f]),l.jsx(xn.button,{type:"button",role:"checkbox","aria-checked":Hn(c)?"mixed":c,"aria-required":d,"data-state":qd(c),"data-disabled":a?"":void 0,disabled:a,value:s,...r,ref:y,onKeyDown:zt(t,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:zt(n,x=>{f(h=>Hn(h)?!0:!h),v&&g&&(m.current=x.isPropagationStopped(),m.current||x.stopPropagation())})})});Md.displayName=Dd;var Na=k.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:c,onCheckedChange:d,form:u,...f}=e;return l.jsx(kC,{__scopeCheckbox:n,checked:o,defaultChecked:i,disabled:a,required:s,onCheckedChange:d,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:m})=>l.jsxs(l.Fragment,{children:[l.jsx(Md,{...f,ref:t,__scopeCheckbox:n}),m&&l.jsx(Ld,{__scopeCheckbox:n})]})})});Na.displayName=Mo;var kd="CheckboxIndicator",Ta=k.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=Ea(kd,n);return l.jsx(Sa,{present:r||Hn(i.checked)||i.checked===!0,children:l.jsx(xn.span,{"data-state":qd(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});Ta.displayName=kd;var jd="CheckboxBubbleInput",Ld=k.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:o,checked:i,defaultChecked:s,required:a,disabled:c,name:d,value:u,form:f,bubbleInput:m,setBubbleInput:g}=Ea(jd,e),v=Wr(n,g),y=xC(i),p=OC(r);k.useEffect(()=>{const h=m;if(!h)return;const w=window.HTMLInputElement.prototype,O=Object.getOwnPropertyDescriptor(w,"checked").set,S=!o.current;if(y!==i&&O){const T=new Event("click",{bubbles:S});h.indeterminate=Hn(i),O.call(h,Hn(i)?!1:i),h.dispatchEvent(T)}},[m,y,i,o]);const x=k.useRef(Hn(i)?!1:i);return l.jsx(xn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??x.current,required:a,disabled:c,name:d,value:u,form:f,...t,tabIndex:-1,ref:v,style:{...t.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Ld.displayName=jd;function jC(e){return typeof e=="function"}function Hn(e){return e==="indeterminate"}function qd(e){return Hn(e)?"indeterminate":e?"checked":"unchecked"}function Kd(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}var LC=["color"],Ud=b.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Kd(e,LC);return b.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),b.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"}))}),qC=["color"],KC=b.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Kd(e,qC);return b.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),b.createElement("path",{d:"M2 7.5C2 7.22386 2.22386 7 2.5 7H12.5C12.7761 7 13 7.22386 13 7.5C13 7.77614 12.7761 8 12.5 8H2.5C2.22386 8 2 7.77614 2 7.5Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});const UC="_checkboxGroupContainer_hqfeu_1",VC="_stack_hqfeu_6",$C="_selectAllContainer_hqfeu_10",HC="_fieldContainer_hqfeu_17",BC="_checkbox_hqfeu_1",zr={checkboxGroupContainer:UC,stack:VC,selectAllContainer:$C,fieldContainer:HC,checkbox:BC};function JC({id:e,isChecked:t,label:n,onCheckedChange:r}){return l.jsxs("div",{className:zr.fieldContainer,children:[l.jsx(Na,{className:zr.checkbox,id:e,onCheckedChange:r,checked:t,children:l.jsx(Ta,{children:l.jsx(Ud,{})})}),l.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function WC({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:o}){return l.jsxs("div",{className:zr.selectAllContainer,children:[l.jsx(Na,{className:zr.checkbox,id:e,onCheckedChange:r,checked:o?"indeterminate":t,children:l.jsxs(Ta,{children:[o&&l.jsx(KC,{}),t===!0&&l.jsx(Ud,{})]})}),l.jsx("label",{htmlFor:e,children:n})]})}function zC({children:e}){return l.jsx("div",{className:zr.checkboxGroupContainer,children:e})}function QC({children:e}){return l.jsx("div",{className:zr.stack,children:e})}const GC="_paginationContainer_i9j9p_1",XC="_pageInfo_i9j9p_7",zc={paginationContainer:GC,pageInfo:XC};function Vd({items:e,onItemChange:t,onSelectAllChange:n,isAllChecked:r=!1,isIndeterminate:o=!1,itemsPerPage:i=8,showSelectAll:s=!0}){const[a,c]=b.useState(1),d=Math.ceil(e.length/i),u=(a-1)*i,f=u+i,m=e.slice(u,f);return l.jsxs(zC,{children:[d>1&&l.jsxs("div",{className:zc.paginationContainer,children:[l.jsx($e,{type:"button",onClick:()=>c(g=>Math.max(1,g-1)),disabled:a===1,variant:"ghost",children:"<"}),l.jsxs("span",{className:zc.pageInfo,children:[a," of ",d]}),l.jsx($e,{type:"button",onClick:()=>c(g=>Math.min(d,g+1)),disabled:a===d,variant:"ghost",children:">"})]}),s&&e.length>=2&&l.jsx(WC,{id:"select-all-fields",isChecked:r,label:`Select all ${e.length} fields`,onCheckedChange:n,isIndeterminate:o}),l.jsx(QC,{children:m.map(g=>l.jsx(JC,{id:g.id,isChecked:g.isChecked,label:g.label,onCheckedChange:v=>t(g.id,v===!0)},g.id))})]})}function YC(e,t,n){var o,i;const r=((o=e==null?void 0:e.read)==null?void 0:o.selectedOptionalFields)||{};if(r[t]=n,n||delete r[t],(i=e.read)!=null&&i.savedConfig.optionalFields){const s=e.read.savedConfig.optionalFields,c=!uu(s,r);e.read.isOptionalFieldsModified=c}else console.warn("read.savedConfig.optionalFields is undefined")}function Qc(e,t,n,r){t(e,o=>YC(o,n,r))}function ZC(){var m,g;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=Zt(),o=(m=t==null?void 0:t.read)==null?void 0:m.selectedOptionalFields,i=(g=t==null?void 0:t.read)==null?void 0:g.optionalFields,s=(v,y)=>{r&&t&&Qc(r,n,v,y)},a=v=>{r&&i&&i.forEach(y=>{bn(y)||Qc(r,n,y.fieldName,v)})},c=b.useMemo(()=>(i==null?void 0:i.filter(v=>!bn(v)&&"fieldName"in v&&"displayName"in v).map(v=>({id:v.fieldName,label:v.displayName,isChecked:!!(o!=null&&o[v.fieldName])})).sort((v,y)=>v.label.localeCompare(y.label)))||[],[i,o]),d=!!(i&&i.length>0),u=c.every(v=>(o==null?void 0:o[v.id])===!0),f=!u&&Object.keys(o||{}).length>0;return d&&l.jsxs(l.Fragment,{children:[l.jsx(Nt,{string:`${e} reads the following optional fields`}),l.jsx(Vd,{items:c,onItemChange:s,onSelectAllChange:a,isAllChecked:u,isIndeterminate:f,showSelectAll:c.length>=2},`${r}-${i==null?void 0:i.length}`)]})}function e0(){return l.jsx(ZC,{})}const t0={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 n0({children:e,style:t,...n}){return l.jsx("span",{style:{...t0,...t},...n,children:e})}function r0(){var n,r,o;const{configureState:e}=Zt(),{appName:t}=Ee();return l.jsxs(l.Fragment,{children:[l.jsx(Nt,{string:`${t} reads the following fields`}),l.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:(r=(n=e==null?void 0:e.read)==null?void 0:n.requiredFields)!=null&&r.length?(o=e.read)==null?void 0:o.requiredFields.map(i=>bn(i)?null:l.jsx(n0,{children:i.displayName},i.fieldName)):"There are no required fields."})]})}function i0(e,t,n,r,o){e.read&&(e.read.selectedValueMappings||(e.read.selectedValueMappings={}),e.read.selectedValueMappings[o]||(e.read.selectedValueMappings[o]={}),r===""&&e.read.selectedValueMappings[o][n]?delete e.read.selectedValueMappings[o][n]:e.read.selectedValueMappings[o][n]=r)}function $d(e,t,n,r,o){t(e,i=>i0(i,e,n,r,o))}function o0(e,t,n){t(e,r=>{r.read&&(r.read.isValueMappingsModified=n)})}function s0({string:e,fieldName:t}){return l.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[l.jsxs("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:[e,l.jsx("b",{children:t})]}),l.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:l.jsx(Oo,{style:{width:"100%",marginLeft:"1rem"}})})]})}function a0({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r,hasError:o}){var O;const{configureState:i,selectedObjectName:s,setConfigureState:a}=Zt(),[c,d]=b.useState(!0),{getError:u,setError:f,resetBoundary:m,isError:g,removeError:v}=Mt(),y=b.useMemo(()=>{var S,T;return((T=(S=i==null?void 0:i.read)==null?void 0:S.selectedValueMappings)==null?void 0:T[n])||{}},[(O=i==null?void 0:i.read)==null?void 0:O.selectedValueMappings,n]),p=b.useMemo(()=>y==null?void 0:y[e.mappedValue],[y,e.mappedValue]);b.useEffect(()=>{d(!1)},[e,a,s,p,i]);const x=b.useMemo(()=>r.map(S=>({id:S.value,label:S.displayValue,value:S.value})),[r]),h=b.useCallback(S=>{if(S){if(Object.values(y).some(T=>T===S.value&&T!==p)){const T=[...Object.entries(y).filter(([R,A])=>A===S.value&&A!==p).map(([R])=>R),e.mappedValue];f(ue.VALUE_MAPPING,n,T);return}u(ue.VALUE_MAPPING,n)&&m(ue.VALUE_MAPPING),t({target:{name:e.mappedValue,value:S.value,fieldName:n}})}},[t,y,p,n,e.mappedValue,m,f,u]),w=b.useMemo(()=>l.jsx(dd,{disabled:c,items:x,selectedValue:p||null,onSelectedItemChange:h,placeholder:"Please select one",style:{border:o?"2px solid red":void 0,borderRadius:"8px",width:"100%"}},p),[p,c,x,h,o]),I=b.useCallback(()=>{s&&($d(s,a,e.mappedValue,"",n),g(ue.VALUE_MAPPING,n)&&v(ue.VALUE_MAPPING,n))},[s,a,e.mappedValue,n,g,v]);return l.jsxs("div",{style:{display:"flex",flexDirection:"column",marginBottom:".25rem"},children:[l.jsx("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:l.jsx("span",{style:{fontWeight:500},children:e.mappedDisplayValue})}),l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[w,l.jsx($e,{type:"button",variant:"ghost",onClick:I,children:"Clear"})]})]},e.mappedValue)}function c0(){var g,v,y;const{fieldMapping:e}=Ze(),{selectedObjectName:t,configureState:n,setConfigureState:r}=Zt(),{isError:o,removeError:i,getError:s}=Mt(),a=(g=n==null?void 0:n.read)==null?void 0:g.selectedFieldMappings,c=(v=n==null?void 0:n.read)==null?void 0:v.selectedValueMappings,d=(y=n==null?void 0:n.read)==null?void 0:y.isValueMappingsModified,u=b.useRef(!1),f=b.useMemo(()=>{const p=t&&e?Object.values(e[t]||{}).flat().filter(x=>x.mappedValues).map(x=>({...x})):[];if(a)for(let x=0;x<p.length;x+=1){const{mapToName:h}=p[x];a!=null&&a[h]&&(p[x].fieldName=a[h])}return p},[t,e,a]),m=b.useCallback(p=>{const{value:x,name:h,fieldName:w}=p.target;x&&(t&&$d(t,r,h,x,w),o(ue.VALUE_MAPPING,h)&&i(ue.VALUE_MAPPING,h))},[t,r,o,i]);return b.useEffect(()=>{var p;if(t&&c){const x=((p=e==null?void 0:e[t])==null?void 0:p.filter(w=>w.fieldName&&w.mappedValues.length>0))||[];x.every(w=>{const I=c[w.fieldName]||{};return Object.keys(I).length===Object.keys(w.mappedValues).length})&&x.length>0?!d&&!u.current&&(o0(t,r,!0),u.current=!0):u.current=!1}},[c,f,t,r,e,d]),f!=null&&f.length?l.jsx(l.Fragment,{children:f.map(p=>{var S,T,R;if(!p.fieldName)return null;const x=(T=(S=n==null?void 0:n.read)==null?void 0:S.allFieldsMetadata)==null?void 0:T[p.fieldName],h=x==null?void 0:x.valueType;if(!["singleSelect","multiSelect"].includes(h))return console.error("fieldName is not a singleSelect or multiSelect",p),null;const w=x==null?void 0:x.values;if(!w)return null;const I=Object.keys(w).length,O=Object.keys((p==null?void 0:p.mappedValues)||[]).length;return I!==O?(console.error("field values and the values to be mapped are not of the same length",p,w),null):l.jsxs(l.Fragment,{children:[l.jsx(s0,{string:"Map the values for ",fieldName:p.mapToDisplayName||p.mapToName||p.fieldName}),l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:l.jsx(Po,{id:p.mapToName||p.fieldName,children:(R=p==null?void 0:p.mappedValues)==null?void 0:R.map(A=>{var L,J,ae;const D=s(ue.VALUE_MAPPING,p.fieldName),B=Array.isArray(D)&&D.includes(A.mappedValue),$=((ae=(J=(L=n==null?void 0:n.read)==null?void 0:L.allFieldsMetadata)==null?void 0:J[p.fieldName])==null?void 0:ae.values)||[];return l.jsxs(l.Fragment,{children:[l.jsx(a0,{allValueOptions:$,mappedValue:A,onSelectChange:m,fieldName:(p==null?void 0:p.fieldName)||"",hasError:B},`${A.mappedValue}-${p.fieldName}`),B&&l.jsx("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:`Each ${p.mapToName||p.fieldName} must be mapped to a unique value`},A.mappedValue)]})})},p.mapToName||p.fieldName)})]})})}):null}function l0(){return mC(),l.jsxs(l.Fragment,{children:[l.jsx(vC,{}),l.jsx(r0,{}),l.jsx(pC,{}),l.jsx(fC,{}),l.jsx(c0,{}),l.jsx(e0,{})]})}function u0(e,t,n){var r,o,i;if(((r=e==null?void 0:e.write)==null?void 0:r.selectedWriteObjects)===null&&(e.write.selectedWriteObjects={}),e!=null&&e.write){const s=e.write.selectedWriteObjects;if(n&&(s[t]={objectName:t}),n||delete s[t],(i=(o=e==null?void 0:e.write)==null?void 0:o.savedConfig)!=null&&i.selectedWriteObjects){const a=e.write.savedConfig.selectedWriteObjects,d=!Kv(a,s);e.write.isWriteModified=d}}}function Gc(e,t,n,r){t(e,o=>{u0(o,n,r)})}function d0(){var m,g,v,y;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=Zt(),o=(m=n==null?void 0:n.write)==null?void 0:m.selectedWriteObjects,i=(g=n==null?void 0:n.write)==null?void 0:g.writeObjects,s=(p,x)=>{t&&n&&Gc(t,r,p,x)},a=p=>{var x,h;t&&n&&((h=(x=n==null?void 0:n.write)==null?void 0:x.writeObjects)==null||h.forEach(w=>{Gc(t,r,w.objectName,p)}))},c=!!i,d=Object.keys(o||{}).length===((y=(v=n==null?void 0:n.write)==null?void 0:v.writeObjects)==null?void 0:y.length),u=!d&&Object.keys(o||{}).length>0,f=(i==null?void 0:i.map(p=>({id:p.objectName,label:p.displayName,isChecked:!!(o!=null&&o[p.objectName])})))||[];return c&&l.jsxs(l.Fragment,{children:[l.jsx(Nt,{string:`Allow ${e} to write to these objects`}),l.jsx(Vd,{items:f,onItemChange:s,onSelectAllChange:a,isAllChecked:d,isIndeterminate:u,showSelectAll:i.length>=2})]})}function f0(){return l.jsx(l.Fragment,{children:l.jsx(d0,{})})}function Hd({resetComponent:e,onDisconnectSuccess:t}){return l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[l.jsx(Nt,{string:"Remove connection"}),l.jsx("p",{children:"Click to disconnect your connection from the provider."}),l.jsx(_u,{resetComponent:e,onDisconnectSuccess:t,buttonText:"Remove connection",buttonVariant:"danger",buttonStyle:{fontSize:"13px",width:"100%"}})]})}const p0="_authenticationRow_1g2ms_1",h0="_field_1g2ms_8",m0="_value_1g2ms_12",is={authenticationRow:p0,field:h0,value:m0};function Xc({label:e,value:t}){return l.jsxs("div",{className:is.authenticationRow,children:[l.jsx("div",{className:is.field,children:e}),l.jsx("div",{className:is.value,children:t})]})}function g0(){const{selectedConnection:e}=Yt(),{providerName:t}=lt(),r=(e==null?void 0:e.provider)==="salesforce"?"subdomain":"workspace",o=`${t} ${r}`;return l.jsxs(l.Fragment,{children:[l.jsx(Nt,{string:"Connection details"}),l.jsxs("div",{style:{paddingBottom:"1rem"},children:[l.jsx(Xc,{label:o,value:e==null?void 0:e.providerWorkspaceRef}),l.jsx(Xc,{label:"Status",value:Qt((e==null?void 0:e.status)||"")})]})]})}const y0=()=>{const e=ot(),t=qe();return In({mutationFn:async({projectIdOrName:n,integrationId:r,installationId:o})=>(await e()).installationApi.deleteInstallation({projectIdOrName:n,integrationId:r,installationId:o}),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]})},onError:n=>{console.error("Error uninstalling installation."),Me(n)}})};function Bd({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const{projectId:r}=Ee(),{integrationId:o,installation:i,setIntegrationDeleted:s,onUninstallSuccess:a}=Ze(),[c,d]=b.useState(!1),u=!r||!o||!(i!=null&&i.id)||c,f=y0(),m=async()=>{u||(d(!0),console.warn("uninstalling installation",{projectId:r,integrationId:o,installationId:i.id}),f.mutate({projectIdOrName:r,integrationId:o,installationId:i.id},{onSuccess:()=>{console.warn("successfully uninstalled installation:",i.id),a==null||a(i==null?void 0:i.id),s()},onSettled:()=>d(!1)}))},g=c?"Uninstalling...":e,v=l.jsx($e,{type:"button",onClick:m,disabled:u,variant:t,style:n,children:g});return i!=null&&i.id?v:null}function v0(){const{installation:e}=Ze(),{providerName:t}=lt();return e?l.jsxs(l.Fragment,{children:[l.jsx(Nt,{string:"Uninstall entire integration"}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",padding:"1rem 0"},children:[e!=null&&e.id?l.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."]}):l.jsx("p",{children:"You've successfully uninstalled the integration."}),l.jsx(Bd,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})]}):null}function w0(){const{installation:e,resetComponent:t}=Ze();return l.jsxs(l.Fragment,{children:[l.jsx(g0,{}),l.jsx(Xs,{}),e&&l.jsx(v0,{}),!e&&l.jsx(Hd,{resetComponent:t})]})}function Jd({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:o}){var S,T,R,A;const{installation:i}=Ze(),{hydratedRevision:s,loading:a}=Zr(),{configureState:c,selectedObjectName:d}=Zt(),u=i==null?void 0:i.config,f=u&&d&&!!su(u,d)||!1,m=((S=c==null?void 0:c.read)==null?void 0:S.isOptionalFieldsModified)||((T=c==null?void 0:c.read)==null?void 0:T.isRequiredMapFieldsModified)||((R=c==null?void 0:c.read)==null?void 0:R.isValueMappingsModified),g=(A=c==null?void 0:c.write)==null?void 0:A.isWriteModified,x=a||n||!c||!d||!(m||g||r||d!==mr&&!f),h=d===mr,w=d===ao,I=l.jsx($e,{type:"submit",disabled:x,children:r?"Install":"Save"}),O=l.jsx($e,{type:"button",onClick:t,disabled:x,variant:"ghost",children:"Reset"});return n?l.jsx(fi,{}):l.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[l.jsx("div",{style:{display:"flex",flexDirection:"row-reverse",gap:".8rem",marginBottom:"20px",height:"3rem"},children:!w&&l.jsxs(l.Fragment,{children:[I,O]})}),l.jsxs(Cn,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[o&&l.jsx(xi,{children:typeof o=="string"?o:"Installation Failed."}),a&&l.jsx(fi,{}),s&&!h&&!w&&l.jsx(l0,{}),s&&h&&!w&&l.jsx(f0,{}),!a&&w&&l.jsx(w0,{})]})]})}const Wd=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:o,onUpdateSuccess:i}=Ze(),{hydratedRevision:s,loading:a}=Zr(),{selectedObjectName:c}=xd(),{selectedConnection:d}=Yt(),u=Ol(),{projectId:f}=Ee(),{resetBoundary:m,setErrors:g,setError:v,getError:y}=Mt(),{resetConfigureState:p,objectConfigurationsState:x,resetPendingConfigurationState:h}=xa(),w=gu(c||"",x),{onNextIncompleteTab:I}=VI(),O=b.useCallback(()=>{m(ue.INSTALLATION_MUTATION)},[m]),S=b.useCallback(R=>R?A=>{v(ue.INSTALLATION_MUTATION,R,A)}:A=>{console.error("objectName is required to set installation error: ",A)},[v]),T=b.useCallback(R=>R?y(ue.INSTALLATION_MUTATION,R):"",[y]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:s,loading:a,selectedObjectName:c,selectedConnection:d,apiKey:u,projectId:f,resetBoundary:m,setErrors:g,setMutateInstallationError:S,getMutateInstallationError:T,resetMutateInstallationErrorState:O,resetConfigureState:p,objectConfigurationsState:x,resetPendingConfigurationState:h,configureState:w,onInstallSuccess:o,onUpdateSuccess:i,onNextIncompleteTab:I}},b0=void 0;function I0(){const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:o,loading:i,selectedObjectName:s,selectedConnection:a,apiKey:c,projectId:d,resetBoundary:u,setErrors:f,setMutateInstallationError:m,getMutateInstallationError:g,resetMutateInstallationErrorState:v,resetConfigureState:y,objectConfigurationsState:p,resetPendingConfigurationState:x,configureState:h,onInstallSuccess:w,onNextIncompleteTab:I}=Wd(),[O,S]=b.useState(!1),T=s===mr,R=g(s),A=b.useCallback(()=>{u(ue.MAPPING),o!=null&&o.content&&!i&&s&&fu(o,b0,s,y)},[u,o,i,s,y]);b.useEffect(()=>{!h&&(o!=null&&o.content)&&!i&&A()},[h,p,o,i,A]);const D=()=>{v();const{requiredMapFields:L,selectedFieldMappings:J}=(h==null?void 0:h.read)||{},{errorList:ae}=lu(L,J,f);ae.length>0||(s&&(a!=null&&a.id)&&c&&d&&e&&t&&n&&o?(S(!0),Jv(d,e,t,n,a.id,s,c,o,h,m(s),r,w).finally(()=>{S(!1),x(s),I()})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},B=()=>{v(),s&&(a!=null&&a.id)&&c&&d&&e&&t&&n&&o?(S(!0),Qv(d,e,t,n,a.id,c,o,h,m(s),r,w).finally(()=>{S(!1),x(s),I()})):console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},$=L=>{L.preventDefault(),T?B():D()};return l.jsx(Jd,{errorMsg:R,isCreateMode:!0,isLoading:O,onSave:$,onReset:A})}function C0({updateConfig:e,projectId:t,integrationId:n,installationId:r,apiKey:o,selectedObjectName:i,setInstallation:s,onUpdateSuccess:a,setError:c}){const d={projectIdOrName:t,installationId:r,integrationId:n,installationUpdate:{updateMask:[`config.content.read.objects.${Tv(i)}`],installation:{config:e}}};return Bs().installationApi.updateInstallation(d,{headers:{"X-Api-Key":o,"Content-Type":"application/json"}}).then(u=>{s(u),a==null||a(u.id,u.config)}).catch(u=>{Me(u,c)})}const x0=(e,t,n,r,o,i)=>{const s=pu(e),a=hu(e),c=mu(e),d={content:{read:{objects:{[t]:{objectName:t,schedule:r,destination:(n==null?void 0:n.destination)||"",selectedFields:s,selectedFieldMappings:a,selectedValueMappings:c||{},backfill:i}}}}};return Ci(o)&&(d.content||(d.content={}),d.content.proxy={enabled:!0}),d},O0=(e,t,n,r,o,i,s,a,c,d,u)=>{const f=x0(i,r||"",a,a.schedule,c,a.backfill);return f?C0({updateConfig:f,projectId:e,integrationId:t,installationId:n,apiKey:o,selectedObjectName:r,setError:d,setInstallation:s,onUpdateSuccess:u}):(console.error("Error when generating updateConfig from configureState"),Promise.resolve(null))},_0=(e,t)=>{const r={content:{write:{objects:vu(e)}}};return Ci(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r},S0=(e,t,n,r,o,i,s,a,c)=>{const d=_0(o,i);if(!d)return console.error("Error when generating write updateConfig from configureState"),Promise.resolve(null);const u={projectIdOrName:e,installationId:n,integrationId:t,installationUpdate:{updateMask:["config.content.write.objects"],installation:{config:d}}};return Bs().installationApi.updateInstallation(u,{headers:{"X-Api-Key":r,"Content-Type":"application/json"}}).then(f=>{a(f),c==null||c(f.id,f.config)}).catch(f=>{Me(f,s)})};function E0({installation:e,integrationObj:t}){const{setInstallation:n,hydratedRevision:r,loading:o,selectedObjectName:i,apiKey:s,projectId:a,resetBoundary:c,setErrors:d,setMutateInstallationError:u,getMutateInstallationError:f,resetConfigureState:m,resetPendingConfigurationState:g,configureState:v,onUpdateSuccess:y,onNextIncompleteTab:p}=Wd(),[x,h]=b.useState(!1),w=i===mr,I=f(i),{config:O}=e,S=b.useCallback(()=>{c(ue.MAPPING),r!=null&&r.content&&!o&&i&&fu(r,O,i,m)},[c,r,o,i,O,m]);b.useEffect(()=>{v||S()},[v,S]);const T=b.useMemo(()=>{var $,L,J;return(J=(L=($=r==null?void 0:r.content)==null?void 0:$.read)==null?void 0:L.objects)==null?void 0:J.find(ae=>(ae==null?void 0:ae.objectName)===i)},[r,i]),R=()=>{const{requiredMapFields:B,selectedFieldMappings:$}=(v==null?void 0:v.read)||{},{errorList:L}=lu(B,$,d);L.length>0||(r&&e&&i&&s&&a&&T?(h(!0),O0(a,t.id,e.id,i,s,v,n,T,r,u(i),y).finally(()=>{h(!1),g(i),p()})):console.error("UpdateInstallation - onSaveUpdate missing required props"))},A=()=>{e&&i&&s&&a&&r?(h(!0),S0(a,t.id,e.id,s,v,r,u(i),n,y).finally(()=>{h(!1),g(i),p()})):console.error("UpdateInstallation - onSaveUpdate missing required props")},D=B=>{B.preventDefault(),w?A():R()};return l.jsx(Jd,{errorMsg:I,onSave:D,onReset:S,isLoading:x})}function N0(){const{integrationObj:e,installation:t}=Ze();return e?t&&e?l.jsx(E0,{installation:t,integrationObj:e}):l.jsx(I0,{}):l.jsx(Zl,{message:"We can't load the integration"})}const zd=()=>{const e=ot(),t=qe(),[n,r]=b.useState(null);return{...In({mutationKey:["createInstallation"],mutationFn:async i=>(await e()).installationApi.createInstallation(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:i=>{console.error("Error creating installation"),Me(i,r)}}),errorMsg:n}};function T0(){return l.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),l.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ra({text:e,children:t}){return l.jsx(Xr,{children:l.jsxs(Cn,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[l.jsx(T0,{}),l.jsx("p",{children:e}),t]})})}function R0({provider:e}){const{providerName:t}=lt(e),n=`You have successfully installed your ${t} integration.`;return l.jsx(Ra,{text:n,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:l.jsx(Bd,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const A0=e=>{const{read:t,write:n}=(e==null?void 0:e.content)??{};return!t&&!n};function F0({children:e}){var O;const t=b.useRef(!1),{projectId:n}=Ee(),{hydratedRevision:r,loading:o}=Zr(),{integrationObj:i,installation:s,groupRef:a,consumerRef:c,onInstallSuccess:d,isIntegrationDeleted:u}=Ze(),{mutate:f,isIdle:m,isPending:g,error:v,errorMsg:y}=zd(),{selectedConnection:p,isConnectionsLoading:x}=Yt(),h=o||g||x,w=(O=r==null?void 0:r.content)==null?void 0:O.provider,I=A0(r);return b.useEffect(()=>{var S;if(!h&&!x&&r&&I&&!s&&p&&(i!=null&&i.id)&&!u&&w){const T={projectIdOrName:n,integrationId:i==null?void 0:i.id,installation:{groupRef:a,connectionId:p==null?void 0:p.id,config:{content:{provider:w}}}};Ci(r)===!0&&(T.installation.config.content.proxy=(S=r==null?void 0:r.content)==null?void 0:S.proxy),m&&!t.current&&(f(T,{onSuccess:R=>{d==null||d(R==null?void 0:R.id,R.config)}}),t.current=!0)}},[r,I,s,p,n,i==null?void 0:i.id,a,c,h,d,u,x,w,f,m]),I&&w&&s?l.jsx(R0,{provider:w}):v?l.jsx(Wt,{message:y??"Create installation failed"}):i?h?l.jsx(Yr,{}):l.jsx("div",{children:e}):l.jsx(Wt,{message:"We can't load the integration"})}function Ei(){const e=ot(),t=qe();return In({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"),Me(n)}})}function P0({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:c}=Ee(),d=Ei(),u=b.useCallback(f=>{var y;const{apiKey:m,providerMetadata:g}=f,v={projectIdOrName:c,generateConnectionParams:{providerWorkspaceRef:(y=g==null?void 0:g.workspace)==null?void 0:y.value,groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,apiKey:m,...g&&{providerMetadata:g}}};d.mutate(v)},[c,i,o,r,n,e,d]);return a===null?l.jsx(vw,{provider:e,providerInfo:t,handleSubmit:u,error:null}):s}function D0({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:c}=Ee(),d=Ei(),u=b.useCallback(f=>{var p;const{user:m,pass:g,providerMetadata:v}=f,y={projectIdOrName:c,generateConnectionParams:{providerWorkspaceRef:(p=v==null?void 0:v.workspace)==null?void 0:p.value,groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:m,password:g},...v&&{providerMetadata:v}}};d.mutate(y)},[c,i,o,r,n,e,d]);return a===null?l.jsx(xw,{provider:e,providerInfo:t,handleSubmit:u,error:null}):s}function M0({providerInfo:e,handleSubmit:t,isButtonDisabled:n,buttonVariant:r}){var m,g;const[o,i]=b.useState({}),s=((m=e.metadata)==null?void 0:m.input)||[],a=v=>{const{name:y,value:p}=v.currentTarget;i(x=>({...x,[y]:p.trim()}))},c=qr(s,o),d=n||!c,u=((g=e.customOpts)==null?void 0:g.inputs)||[],f=()=>{const v=Co(s,o),y=Object.fromEntries(u.map(p=>[p.name,o[p.name]]));t({customAuth:y,providerMetadata:v})};return l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[u.map(v=>l.jsxs("div",{children:[v.docsURL&&l.jsx(Lr,{url:v.docsURL,providerDisplayName:e.displayName||Qt(e.name),credentialName:v.displayName}),l.jsx(bt.PasswordInput,{id:v.name,name:v.name,placeholder:v.prompt||v.displayName,onChange:a})]},v.name)),s.map(v=>l.jsxs("div",{children:[v.docsURL&&l.jsx(Lr,{url:v.docsURL,providerDisplayName:e.displayName||Qt(e.name),credentialName:v.displayName||v.name}),l.jsx(bt.Input,{id:v.name,name:v.name,type:"text",placeholder:v.displayName||v.name,onChange:a})]},v.name)),l.jsx($e,{style:{marginTop:"1em",width:"100%"},disabled:d,type:"submit",onClick:f,variant:r,children:"Next"})]})}function k0({providerInfo:e,handleSubmit:t,error:n,isButtonDisabled:r}){return l.jsxs(zn,{children:[l.jsx(Qn,{children:`Set up ${e.displayName} integration`}),l.jsx(an,{error:n}),l.jsx(M0,{providerInfo:e,handleSubmit:t,isButtonDisabled:r})]})}function j0({providerInfo:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s}){const{projectIdOrName:a}=Ee(),c=Ei(),[d,u]=b.useState(null),f=b.useCallback(m=>{var p;const{customAuth:g,providerMetadata:v}=m;u(null);const y={projectIdOrName:a,generateConnectionParams:{providerWorkspaceRef:(p=v==null?void 0:v.workspace)==null?void 0:p.value,groupName:o,groupRef:r,consumerName:n,consumerRef:t,provider:e.name,customAuth:g,...v&&{providerMetadata:v}}};c.mutate(y,{onError:x=>{Me(x,u)},onSuccess:()=>{u(null)}})},[a,o,r,n,t,e.name,c]);return s===null?l.jsx(k0,{providerInfo:e,handleSubmit:f,error:d}):i}function L0({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,children:o,title:i}){if(!i&&!r)throw new Error("Either title or providerName is required");return l.jsxs(zn,{children:[l.jsx(Qn,{children:i||`Set up ${r} integration`}),l.jsx(an,{error:t}),o,l.jsx($e,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function q0({...e}){return l.jsx(L0,{...e})}function K0({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s,providerName:a}){const{projectIdOrName:c}=Ee(),d=Ei(),u=b.useCallback(()=>{const f={projectIdOrName:c,generateConnectionParams:{groupName:o,groupRef:r,consumerName:n,consumerRef:t,provider:e}};d.mutate(f)},[c,o,r,n,t,e,d]);return s===null?l.jsx(q0,{handleSubmit:u,error:null,providerName:a}):i}const U0=()=>{const e=ot(),t=qe();return In({mutationKey:["createOauthConnection"],mutationFn:async n=>(await e()).oAuthApi.oauthConnect(n),onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})};function V0({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return l.jsxs(zn,{children:[l.jsx(Qn,{children:`Set up ${r} integration`}),l.jsx(hw,{children:`Click Next to sign into the ${r} account you'd like to sync.`}),l.jsx(an,{error:t}),l.jsx($e,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:n?"Loading...":"Next"})]})}const $0="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function H0({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return l.jsxs(zn,{children:[l.jsx(Qn,{children:"Enter your Salesforce subdomain"}),l.jsx(Iu,{href:$0,newTab:!0,children:"What is my Salesforce subdomain?"}),l.jsx(an,{error:n}),l.jsxs("div",{style:{display:"flex",marginTop:"1em",alignItems:"center"},children:[l.jsx(bt.Input,{id:"salesforce-subdomain",type:"text",placeholder:"my-domain",onChange:o=>t(o.currentTarget.value)}),l.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),l.jsx($e,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function B0({handleSubmit:e,setFormData:t,error:n,isButtonDisabled:r,providerName:o,metadataFields:i}){return l.jsxs(zn,{children:[l.jsxs(Qn,{children:["Enter your ",o," workspace"]}),l.jsx(an,{error:n}),l.jsx("br",{}),i.map(s=>l.jsx(bt.Input,{id:s.name,name:s.name,type:"text",placeholder:s.displayName||s.name,onChange:a=>t(s.name,a.currentTarget.value)},s.name)),l.jsx("br",{}),l.jsx($e,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const Yc=600,Zc=600,el="salesforce";function J0({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){var B;const{projectId:s}=Ee(),a=qe(),c=b.useRef(null),[d,u]=b.useState(null),[f,m]=b.useState(""),[g,v]=b.useState({}),[y,p]=b.useState({}),{data:x}=Io(e),h=((B=x==null?void 0:x.metadata)==null?void 0:B.input)||[],{mutateAsync:w,isPending:I}=U0(),{isFetching:O,refetch:S}=Ws({groupRef:r,provider:e});b.useEffect(()=>{const $=L=>{var J,ae,re;L.origin===Jl&&(((J=L.data)==null?void 0:J.eventType)==="AUTHORIZATION_SUCCEEDED"?(u(null),console.debug("New connection:",L.data.data.connection),a.invalidateQueries({queryKey:["amp","connections"]})):((ae=L.data)==null?void 0:ae.eventType)==="AUTHORIZATION_FAILED"&&(console.error("OAuth failed:",L.data.data.error),a.invalidateQueries({queryKey:["amp","connections"]}),u(L.data.data.error||"An error occurred. Please try again.")),(re=c.current)==null||re.close())};return window.addEventListener("message",$),()=>window.removeEventListener("message",$)},[a]);const T=$=>{m($),v(L=>({...L,workspace:$})),p(L=>({...L,workspace:{value:$,source:"input"}}))},R=($,L)=>{v(J=>({...J,[$]:L})),p(J=>({...J,[$]:{value:L,source:"input"}}))},A=async()=>{var $;u(null);try{const{data:L}=await S();if(L&&L.length>0){console.debug("connections found");return}}catch{console.debug("error with fetching connections")}if(h.length>0&&!qr(h,g)){u("Please fill in all required fields");return}try{const L=await w({connectOAuthParams:{provider:e,consumerRef:t,groupRef:r,projectId:s,consumerName:n,groupName:o,providerWorkspaceRef:e===el?f:($=y==null?void 0:y.workspace)==null?void 0:$.value,providerMetadata:y}});if(L){const J=window.screenX+(window.outerWidth-Yc)/2,ae=window.screenY+(window.outerHeight-Zc)/2.5,re=`width=${Yc},height=${Zc},left=${J},top=${ae}`;c.current=window.open(L,"OAuthPopup",re)}}catch(L){console.error(L),u(L instanceof Error?L.message:String(L)||"An error occurred. Please try again.")}},D=e===el?l.jsx(H0,{handleSubmit:A,setWorkspace:T,error:d,isButtonDisabled:f.length===0||I||O}):h.length>0?l.jsx(B0,{handleSubmit:A,setFormData:R,error:d,isButtonDisabled:!qr(h,g)||I||O,providerName:i,metadataFields:h}):l.jsx(V0,{handleSubmit:A,error:d,providerName:i,isButtonDisabled:I||O});return l.jsx("div",{children:D})}function W0({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,explicitScopesRequired:s,selectedConnection:a}){const{projectIdOrName:c}=Ee(),d=Ei(),[u,f]=b.useState(null),m=b.useCallback(g=>{var y,p;f(null);const v={projectIdOrName:c,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:(p=(y=g.providerMetadata)==null?void 0:y.workspace)==null?void 0:p.value,oauth2ClientCredentials:{clientId:g.clientId,clientSecret:g.clientSecret,scopes:g.scopes},...g.providerMetadata&&{providerMetadata:g.providerMetadata}}};d.mutate(v,{onError:()=>f("Error loading provider info")})},[c,i,o,r,n,e,d]);return a===null?l.jsx(_w,{provider:e,providerName:t,handleSubmit:m,error:u,explicitScopesRequired:s}):l.jsx(fi,{})}function z0({...e}){return l.jsx(W0,{...e})}const Q0="authorizationCode",G0="authorizationCodePKCE",X0="clientCredentials";function Y0({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,selectedConnection:s,setSelectedConnection:a}){const{providerName:c}=lt(e);if(t.oauth2Opts===void 0)return l.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:d,explicitScopesRequired:u}=t.oauth2Opts,f={provider:e,consumerRef:n,consumerName:r,groupRef:o,groupName:i,providerName:c};return d===Q0||d===G0?l.jsx(J0,{...f}):d===X0?l.jsx(z0,{...f,explicitScopesRequired:u,selectedConnection:s,setSelectedConnection:a}):d==="password"?l.jsx("em",{children:"Password flow not supported yet"}):l.jsxs("em",{children:["Unsupported grant type: ",d]})}function Z0(e){const{selectedConnection:t}=Yt();b.useEffect(()=>{e&&t&&e(t)},[e,t])}function ex({onSuccess:e}){Z0(e)}function Qd({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,onSuccess:s,onDisconnectSuccess:a,resetComponent:c}){const{data:d,isLoading:u,isError:f,error:m,providerName:g,selectedProvider:v}=lt(e),{provider:y,isIntegrationDeleted:p}=Ze(),{selectedConnection:x,setSelectedConnection:h}=Yt();ex({onSuccess:s});const w=qe(),I=d;b.useEffect(()=>{f&&(console.error("Error loading provider info."),Me(m))},[f,m]);const O=b.useCallback(()=>{w.clear(),c()},[c,w]);if(!e&&!y)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(p)return l.jsx(Ra,{text:"Integration successfully uninstalled.",children:l.jsx($e,{type:"button",onClick:O,style:{width:"100%"},children:"Reinstall Integration"})});if(x)return i;if(u)return l.jsx(Yr,{});if(I==null)return l.jsx(Wt,{message:"Provider info was not found."});const S={provider:v,consumerRef:t,consumerName:n,groupRef:r,groupName:o,selectedConnection:x,setSelectedConnection:h,providerName:g,providerInfo:I,onDisconnectSuccess:a};return I.authType==="none"?l.jsx(K0,{...S,children:i}):I.authType==="basic"?l.jsx(D0,{...S,children:i}):I.authType==="apiKey"?l.jsx(P0,{...S,children:i}):I.authType==="custom"?l.jsx(j0,{...S,children:i}):l.jsx(Y0,{...S})}function tx(e){const t=e+"CollectionProvider",[n,r]=Do(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=y=>{const{scope:p,children:x}=y,h=b.useRef(null),w=b.useRef(new Map).current;return l.jsx(o,{scope:p,itemMap:w,collectionRef:h,children:x})};s.displayName=t;const a=e+"CollectionSlot",c=Ls(a),d=b.forwardRef((y,p)=>{const{scope:x,children:h}=y,w=i(a,x),I=Wr(p,w.collectionRef);return l.jsx(c,{ref:I,children:h})});d.displayName=a;const u=e+"CollectionItemSlot",f="data-radix-collection-item",m=Ls(u),g=b.forwardRef((y,p)=>{const{scope:x,children:h,...w}=y,I=b.useRef(null),O=Wr(p,I),S=i(u,x);return b.useEffect(()=>(S.itemMap.set(I,{ref:I,...w}),()=>void S.itemMap.delete(I))),l.jsx(m,{[f]:"",ref:O,children:h})});g.displayName=u;function v(y){const p=i(e+"CollectionConsumer",y);return b.useCallback(()=>{const h=p.collectionRef.current;if(!h)return[];const w=Array.from(h.querySelectorAll(`[${f}]`));return Array.from(p.itemMap.values()).sort((S,T)=>w.indexOf(S.ref.current)-w.indexOf(T.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:s,Slot:d,ItemSlot:g},v,r]}var nx=k[" useId ".trim().toString()]||(()=>{}),rx=0;function Gd(e){const[t,n]=k.useState(nx());return yi(()=>{e||n(r=>r??String(rx++))},[e]),e||(t?`radix-${t}`:"")}function ix(e){const t=k.useRef(e);return k.useEffect(()=>{t.current=e}),k.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}var ox=k.createContext(void 0);function Xd(e){const t=k.useContext(ox);return e||t||"ltr"}var os="rovingFocusGroup.onEntryFocus",sx={bubbles:!1,cancelable:!0},Ni="RovingFocusGroup",[qs,Yd,ax]=tx(Ni),[cx,Zd]=Do(Ni,[ax]),[lx,ux]=cx(Ni),ef=k.forwardRef((e,t)=>l.jsx(qs.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(qs.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(dx,{...e,ref:t})})}));ef.displayName=Ni;var dx=k.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:u=!1,...f}=e,m=k.useRef(null),g=Wr(t,m),v=Xd(i),[y,p]=_a({prop:s,defaultProp:a??null,onChange:c,caller:Ni}),[x,h]=k.useState(!1),w=ix(d),I=Yd(n),O=k.useRef(!1),[S,T]=k.useState(0);return k.useEffect(()=>{const R=m.current;if(R)return R.addEventListener(os,w),()=>R.removeEventListener(os,w)},[w]),l.jsx(lx,{scope:n,orientation:r,dir:v,loop:o,currentTabStopId:y,onItemFocus:k.useCallback(R=>p(R),[p]),onItemShiftTab:k.useCallback(()=>h(!0),[]),onFocusableItemAdd:k.useCallback(()=>T(R=>R+1),[]),onFocusableItemRemove:k.useCallback(()=>T(R=>R-1),[]),children:l.jsx(xn.div,{tabIndex:x||S===0?-1:0,"data-orientation":r,...f,ref:g,style:{outline:"none",...e.style},onMouseDown:zt(e.onMouseDown,()=>{O.current=!0}),onFocus:zt(e.onFocus,R=>{const A=!O.current;if(R.target===R.currentTarget&&A&&!x){const D=new CustomEvent(os,sx);if(R.currentTarget.dispatchEvent(D),!D.defaultPrevented){const B=I().filter(re=>re.focusable),$=B.find(re=>re.active),L=B.find(re=>re.id===y),ae=[$,L,...B].filter(Boolean).map(re=>re.ref.current);rf(ae,u)}}O.current=!1}),onBlur:zt(e.onBlur,()=>h(!1))})})}),tf="RovingFocusGroupItem",nf=k.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:s,...a}=e,c=Gd(),d=i||c,u=ux(tf,n),f=u.currentTabStopId===d,m=Yd(n),{onFocusableItemAdd:g,onFocusableItemRemove:v,currentTabStopId:y}=u;return k.useEffect(()=>{if(r)return g(),()=>v()},[r,g,v]),l.jsx(qs.ItemSlot,{scope:n,id:d,focusable:r,active:o,children:l.jsx(xn.span,{tabIndex:f?0:-1,"data-orientation":u.orientation,...a,ref:t,onMouseDown:zt(e.onMouseDown,p=>{r?u.onItemFocus(d):p.preventDefault()}),onFocus:zt(e.onFocus,()=>u.onItemFocus(d)),onKeyDown:zt(e.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){u.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const x=hx(p,u.orientation,u.dir);if(x!==void 0){if(p.metaKey||p.ctrlKey||p.altKey||p.shiftKey)return;p.preventDefault();let w=m().filter(I=>I.focusable).map(I=>I.ref.current);if(x==="last")w.reverse();else if(x==="prev"||x==="next"){x==="prev"&&w.reverse();const I=w.indexOf(p.currentTarget);w=u.loop?mx(w,I+1):w.slice(I+1)}setTimeout(()=>rf(w))}}),children:typeof s=="function"?s({isCurrentTabStop:f,hasTabStop:y!=null}):s})})});nf.displayName=tf;var fx={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function px(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function hx(e,t,n){const r=px(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return fx[r]}function rf(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function mx(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var gx=ef,yx=nf,ko="Tabs",[vx,oO]=Do(ko,[Zd]),of=Zd(),[wx,Aa]=vx(ko),sf=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:c="automatic",...d}=e,u=Xd(a),[f,m]=_a({prop:r,onChange:o,defaultProp:i??"",caller:ko});return l.jsx(wx,{scope:n,baseId:Gd(),value:f,onValueChange:m,orientation:s,dir:u,activationMode:c,children:l.jsx(xn.div,{dir:u,"data-orientation":s,...d,ref:t})})});sf.displayName=ko;var af="TabsList",cf=k.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=Aa(af,n),s=of(n);return l.jsx(gx,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:l.jsx(xn.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});cf.displayName=af;var lf="TabsTrigger",uf=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=Aa(lf,n),a=of(n),c=ff(s.baseId,r),d=pf(s.baseId,r),u=r===s.value;return l.jsx(yx,{asChild:!0,...a,focusable:!o,active:u,children:l.jsx(xn.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":d,"data-state":u?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...i,ref:t,onMouseDown:zt(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:zt(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:zt(e.onFocus,()=>{const f=s.activationMode!=="manual";!u&&!o&&f&&s.onValueChange(r)})})})});uf.displayName=lf;var df="TabsContent",bx=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=Aa(df,n),c=ff(a.baseId,r),d=pf(a.baseId,r),u=r===a.value,f=k.useRef(u);return k.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),l.jsx(Sa,{present:o||u,children:({present:m})=>l.jsx(xn.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:d,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:m&&i})})});bx.displayName=df;function ff(e,t){return`${e}-trigger-${t}`}function pf(e,t){return`${e}-content-${t}`}var Ix=sf,Cx=cf,hf=uf;const xx=l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[l.jsx("circle",{cx:"9",cy:"9",r:"9",fill:"#BBF7D0"}),l.jsx("path",{d:"M13 7L7.5 12L5 9.72727",stroke:"#16A34A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function Ox(e,t){return t?b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},b.createElement("circle",{cx:"9",cy:"9",r:"5",fill:"#FBD38D"})):e?xx:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:l.jsx("circle",{cx:"9",cy:"9",r:"5",fill:"#BFDBFE"})})}function _x(){return l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.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"}),l.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 Sx="_tabsRoot_ktpr0_1",Ex="_tabsList_ktpr0_6",Nx="_tabTrigger_ktpr0_12",Tx="_danger_ktpr0_29",wo={tabsRoot:Sx,tabsList:Ex,tabTrigger:Nx,danger:Tx};function Rx(){return l.jsxs(l.Fragment,{children:[l.jsx(Oo,{style:{margin:"1rem 0"}}),l.jsx(hf,{value:ao,className:wo.tabTrigger,children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[l.jsx(_x,{}),l.jsx("span",{children:"Manage"})]})})]})}function mf({objectName:e,completed:t,pending:n,displayName:r}){return l.jsx(hf,{value:e,className:wo.tabTrigger,children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[Ox(t,n),l.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[l.jsx("span",{children:r||e}),n&&l.jsx("span",{style:{fontSize:".8rem",fontStyle:"italic"},children:"pending"})]})]})})}function Ax({completed:e,pending:t,displayName:n}){return l.jsxs(l.Fragment,{children:[l.jsx(Oo,{style:{margin:"1rem 0"}}),l.jsx(mf,{objectName:mr,completed:e,pending:t,displayName:n},"other-write")]})}function Fx({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:o}){var i,s;return l.jsx(Ix,{value:e,className:wo.tabsRoot,onValueChange:n,children:l.jsxs(Cx,{className:wo.tabsList,children:[t.map(a=>{var c,d,u,f,m,g;return l.jsx(mf,{objectName:a.name,displayName:a.displayName,completed:a.completed,pending:((d=(c=r==null?void 0:r[a.name])==null?void 0:c.read)==null?void 0:d.isOptionalFieldsModified)||((f=(u=r==null?void 0:r[a.name])==null?void 0:u.read)==null?void 0:f.isRequiredMapFieldsModified)||((g=(m=r==null?void 0:r[a.name])==null?void 0:m.read)==null?void 0:g.isValueMappingsModified)||!1},a.name)}),o&&l.jsx(Ax,{completed:o.completed,pending:((s=(i=r==null?void 0:r.other)==null?void 0:i.write)==null?void 0:s.isWriteModified)||!1,displayName:"Write"}),l.jsx(Rx,{})]})})}function Px(e,t){return t===ao?{name:ao,completed:!1}:e.find(n=>n.name===t)}function Dx({children:e}){var x;const{project:t}=Ee(),{installation:n}=Ze(),{providerName:r}=lt(),{hydratedRevision:o}=Zr(),{objectConfigurationsState:i}=xa(),[s,a]=b.useState(""),c=(t==null?void 0:t.appName)||"",d=n==null?void 0:n.config,u=o&&au(d,o),f=u!==null,m=!!((x=o==null?void 0:o.content)!=null&&x.write),g=m?cu(d):void 0,v=b.useMemo(()=>{const h=[...u||[]];return g&&m&&h.push(g),h},[u,g,m]),y=Px(v,s),p=b.useCallback(()=>{const h=v.find(w=>y!==w&&!w.completed);h&&a(h.name)},[v,y]);return b.useEffect(()=>{!s&&v.length>0&&a(v[0].name)},[v,s,p]),l.jsx(Od.Provider,{value:p,children:l.jsx(Cd.Provider,{value:y==null?void 0:y.name,children:l.jsxs(Xr,{style:{maxWidth:"55rem"},children:[l.jsxs(Cn,{style:{display:"flex",gap:"1rem",padding:"3rem",paddingBottom:"6rem",backgroundColor:"var(--amp-colors-bg-primary)"},children:[l.jsxs("div",{style:{width:"20rem"},children:[l.jsxs("h1",{style:{fontSize:"small",fontWeight:"400"},children:[r," integration"]}),l.jsx("h3",{style:{marginBottom:"20px",fontSize:"large",fontWeight:"500"},children:c}),f&&l.jsx(Fx,{value:s,readNavObjects:u,onValueChange:h=>a(h),objectConfigurationsState:i,writeNavObject:g})]}),e]}),l.jsx(bu,{})]})})})}function Mx({...e}){return l.jsx(Dx,{...e})}const kx="_resetContainer_lkwv9_4",gf={resetContainer:kx};function jx({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c}){var p;const{projectIdOrName:d,isLoading:u}=Ee(),{isLoading:f}=Js(),{isError:m,errorState:g}=Mt(),{seed:v,reset:y}=iu();return u||f?l.jsx(Yr,{}):m(ue.PROJECT,d)?l.jsx(Wt,{message:`Error loading project ${d}`}):m(ue.INTEGRATION_LIST,d)?l.jsx(Wt,{message:"Error retrieving integrations for the project, double check the API key"}):(p=g[ue.INTEGRATION_LIST])!=null&&p.apiError?l.jsx(Wt,{message:"Something went wrong, couldn't find integration information"}):l.jsx("div",{className:gf.resetContainer,children:l.jsx(Av,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c,resetComponent:y,children:l.jsx(ru,{children:l.jsx(Qd,{consumerRef:t,consumerName:n,groupRef:r,groupName:o,resetComponent:y,children:l.jsx(jw,{resetComponent:y,children:l.jsx(F0,{children:l.jsx(tC,{children:l.jsx(Mx,{children:l.jsx(N0,{})})})})})})})},v)})}function Lx(){return l.jsxs(Xr,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[l.jsx(fi,{}),l.jsx("p",{children:"Redirecting"})]})}function qx({redirectURL:e,children:t}){return b.useEffect(()=>{e&&window.location.replace(e)},[e]),e?l.jsx(Lx,{}):t}function Kx({resetComponent:e,onDisconnectSuccess:t,provider:n}){const[r,o]=b.useState(!1);return l.jsxs(l.Fragment,{children:[r===!1&&l.jsxs(l.Fragment,{children:[l.jsx(Nt,{string:"Manage connection"}),l.jsxs("div",{style:{padding:"1rem 0",width:"100%",display:"flex",flexDirection:"column",gap:"1rem"},children:[l.jsx("p",{children:"Click to reauthenticate or refresh your connection."}),l.jsx($e,{type:"button",onClick:()=>o(!0),variant:"ghost",style:{fontSize:"13px"},children:"Update connection"})]})]}),r===!0&&l.jsxs(l.Fragment,{children:[l.jsx(Xs,{provider:n}),l.jsx(Hd,{resetComponent:e,onDisconnectSuccess:t})]})]})}function Ux({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=Ee(),{providerName:o}=lt(e),i=`You have successfully connected your ${o} account to ${r}.`;return l.jsx(Ra,{text:i,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"},children:l.jsx(Kx,{resetComponent:n,onDisconnectSuccess:t,provider:e})})})}function Vx({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,redirectUrl:i,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:c}){const{seed:d,reset:u}=iu(),f=b.useCallback(m=>{s?s(m.id):c&&c(m)},[s,c]);return l.jsx("div",{className:gf.resetContainer,children:l.jsx(ru,{groupRef:r,provider:e,children:l.jsx(Qd,{resetComponent:u,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onSuccess:f,onDisconnectSuccess:a,children:l.jsx(qx,{redirectURL:i,children:l.jsx(Ux,{resetComponent:u,provider:e,onDisconnectSuccess:a})})})})},d)}const $x=(e,t)=>{const{data:n,isLoading:r,isError:o,error:i}=zs(e,t),s=((n==null?void 0:n.length)||0)>0,a=!!n&&!r,c=n==null?void 0:n[0],d=c==null?void 0:c.config;return b.useEffect(()=>{o&&Me(i)},[o,i]),{isLoaded:a,isIntegrationInstalled:s,isLoading:r,config:d}};function Ti(){const{integrationNameOrId:e,groupRef:t}=ti(),n=zs(e,t),{isPending:r,isFetching:o,isError:i,isSuccess:s,error:a,data:c}=n;return{installation:c==null?void 0:c[0],isPending:r,isFetching:o,isError:i,isSuccess:s,error:a}}const Fa=()=>{const{groupRef:e,integrationNameOrId:t}=ti(),{provider:n}=Gr(t),r=Ws({groupRef:e,provider:n}),{isPending:o,isFetching:i,isError:s,isSuccess:a,error:c,data:d}=r;return{connection:d==null?void 0:d[0],error:c,isPending:o,isFetching:i,isError:s,isSuccess:a}},Hx=()=>{var m;const e=qe(),t=ot(),{connection:n,isPending:r,isFetching:o}=Fa(),{projectIdOrName:i}=Ee(),{integrationNameOrId:s}=ti(),{data:a}=Gr(s),c=n==null?void 0:n.id,d=a==null?void 0:a.id,u=(m=a==null?void 0:a.latestRevision)==null?void 0:m.id,f=r||o;return b.useEffect(()=>{c||e.invalidateQueries({queryKey:["amp","hydratedRevision"]})},[c,e]),Wn({queryKey:["amp","hydratedRevision",i,d,u,c],queryFn:async()=>{if(!i)throw new Error("projectIdOrName is required");if(!d)throw new Error("integrationId is required");if(!u)throw new Error("revisionId is required");if(!c)throw new Error("connectionId is required");return(await t()).revisionApi.getHydratedRevision({projectIdOrName:i,integrationId:d,revisionId:u,connectionId:c})},retry:3,enabled:!!i&&!!d&&!!u&&!!c&&!f})};function yf(){var d,u;const e=Hx(),{isPending:t,isFetching:n,isError:r,isSuccess:o,error:i,data:s}=e,a=s==null?void 0:s.content,c=b.useMemo(()=>({getReadObject:f=>{var g,v;const m=(v=(g=a==null?void 0:a.read)==null?void 0:g.objects)==null?void 0:v.find(y=>y.objectName===f);return m?{object:m,getRequiredFields:()=>m.requiredFields??[],getOptionalFields:()=>m.optionalFields??[]}:(console.error(`Object ${f} not found`),{object:null,getRequiredFields:()=>null,getOptionalFields:()=>null})},getWriteObject:f=>{var g,v;const m=(v=(g=a==null?void 0:a.write)==null?void 0:g.objects)==null?void 0:v.find(y=>y.objectName===f);return m?{object:m}:(console.error(`Object ${f} not found`),{object:null})},getCustomerFieldsForObject:f=>{var g,v;const m=(v=(g=a==null?void 0:a.read)==null?void 0:g.objects)==null?void 0:v.find(y=>y.objectName===f);return m?{allFields:m.allFieldsMetadata??{},getField:y=>{var x;const p=(x=m.allFieldsMetadata)==null?void 0:x[y];return p||(console.error(`Field ${y} not found`),null)}}:(console.error(`Object ${f} not found`),{allFields:null,getField:()=>null})}}),[(d=a==null?void 0:a.read)==null?void 0:d.objects,(u=a==null?void 0:a.write)==null?void 0:u.objects]);return{data:s,...c,isPending:t,isFetching:n,isError:r,isSuccess:o,error:i}}function Bx(e){var f,m,g,v;const[t,n]=b.useState(e),{getReadObject:r,data:o}=yf(),{installation:i}=Ti(),s=b.useCallback(()=>t,[t]),a=b.useCallback((y,p)=>{var R,A,D,B;p.provider=p.provider||((R=o==null?void 0:o.content)==null?void 0:R.provider)||"";const x=p.read||{objects:{}},h=x.objects||{},w=h[y]||{},I=r(y),O=(A=I==null?void 0:I.object)==null?void 0:A.schedule,S=(D=I==null?void 0:I.object)==null?void 0:D.destination,T={};return(B=I==null?void 0:I.getRequiredFields())==null||B.forEach($=>{"fieldName"in $&&(T[$.fieldName]=!0)}),w.objectName=w.objectName||y,w.schedule=w.schedule||O||"",w.destination=w.destination||S||"",w.selectedFields=w.selectedFields||T,h[y]=w,x.objects=h,p.read=x,{read:x,objects:h,obj:w}},[r,(f=o==null?void 0:o.content)==null?void 0:f.provider]),c=b.useCallback(y=>{var p,x;return{object:(x=(p=t.read)==null?void 0:p.objects)==null?void 0:x[y],getSelectedField:h=>{var w,I,O,S;return!!((S=(O=(I=(w=t.read)==null?void 0:w.objects)==null?void 0:I[y])==null?void 0:O.selectedFields)!=null&&S[h])},setSelectedField:({fieldName:h,selected:w})=>{n(I=>Pt(I,O=>{const{obj:S}=a(y,O);S.selectedFields=S.selectedFields||{},S.selectedFields[h]=w,S.selectedFields[h]===!1&&delete S.selectedFields[h]}))},getFieldMapping:h=>{var w,I,O,S;return(S=(O=(I=(w=t.read)==null?void 0:w.objects)==null?void 0:I[y])==null?void 0:O.selectedFieldMappings)==null?void 0:S[h]},setFieldMapping:({fieldName:h,mapToName:w})=>{n(I=>Pt(I,O=>{const{obj:S}=a(y,O);S.selectedFieldMappings=S.selectedFieldMappings||{},S.selectedFieldMappings[w]=h}))}}},[(m=t.read)==null?void 0:m.objects,a]),d=b.useCallback(y=>{var I,O;const p=(O=(I=t.write)==null?void 0:I.objects)==null?void 0:O[y],x=S=>{const T=S.write||{},R=T.objects||{},A=R[y]||{objectName:y};return R[y]=A,T.objects=R,S.write=T,{write:T,objects:R,obj:A}},h=(S,T)=>{var R,A;return(A=(R=p==null?void 0:p.selectedFieldSettings)==null?void 0:R[S])==null?void 0:A[T]},w=(S,T,R)=>{n(A=>Pt(A,D=>{var $;const{obj:B}=x(D);B.selectedFieldSettings={...B.selectedFieldSettings,[S]:{...($=B.selectedFieldSettings)==null?void 0:$[S],[T]:R}}}))};return{object:p,setEnableWrite:()=>{n(S=>Pt(S,T=>{const{obj:R}=x(T);R.objectName=y}))},setDisableWrite:()=>{n(S=>Pt(S,T=>{const{objects:R}=x(T);delete R[y]}))},getWriteObject:()=>{var S,T;return(T=(S=t.write)==null?void 0:S.objects)==null?void 0:T[y]},getSelectedFieldSettings:S=>{var T;return(T=p==null?void 0:p.selectedFieldSettings)==null?void 0:T[S]},setSelectedFieldSettings:({fieldName:S,settings:T})=>{n(R=>Pt(R,A=>{const{obj:D}=x(A),B=D.selectedFieldSettings||{};D.selectedFieldSettings={...B,[S]:T},T===void 0&&delete D.selectedFieldSettings[S]}))},getDefaultValues:S=>h(S,"default"),setDefaultValues:({fieldName:S,value:T})=>w(S,"default",T),getWriteOnCreateSetting:S=>h(S,"writeOnCreate"),setWriteOnCreateSetting:({fieldName:S,value:T})=>w(S,"writeOnCreate",T),getWriteOnUpdateSetting:S=>h(S,"writeOnUpdate"),setWriteOnUpdateSetting:({fieldName:S,value:T})=>w(S,"writeOnUpdate",T)}},[(g=t.write)==null?void 0:g.objects]),u=b.useCallback(()=>{n(y=>Pt(y,p=>{var x;Object.assign(p,(x=i==null?void 0:i.config)==null?void 0:x.content)}))},[(v=i==null?void 0:i.config)==null?void 0:v.content]);return b.useEffect(()=>{console.debug("Installation found",{installation:i}),u()},[i,u]),{draft:t,get:s,reset:u,setDraft:n,readObject:c,writeObject:d}}const vf=b.createContext(null);function Jx({children:e,initialConfig:t}){const n=Bx(t);return l.jsx(vf.Provider,{value:n,children:e})}function Wx(){const e=b.useContext(vf);if(!e)throw new Error("useConfigContext must be used within a ConfigProvider / InstallationProvider");return e}const wf=b.createContext({integrationNameOrId:"",consumerRef:"",consumerName:void 0,groupRef:"",groupName:void 0});function ti(){const e=b.useContext(wf);if(!e)throw new Error("useInstallationProps must be used within an InstallationProvider");return e}function zx({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i}){const s=b.useMemo(()=>({integrationNameOrId:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i}),[t,n,r,o,i]);return l.jsx(wf.Provider,{value:s,children:l.jsx(Jx,{initialConfig:{},children:e})})}function Qx(e){return typeof e.provider=="string"}function Gx(e){if(!Qx(e))throw new Error("Config must have a provider field for creation");return e}function Xx(){const{projectIdOrName:e}=Ee(),{groupRef:t,integrationNameOrId:n}=ti(),{data:r}=Gr(n),{connection:o}=Fa(),{installation:i}=Ti(),s=qe(),{mutate:a,isIdle:c,isPending:d,error:u,errorMsg:f}=zd();return{createInstallation:({config:g,onSuccess:v,onError:y,onSettled:p})=>{if(i)throw Error("Installation already created. Try updating instead.");if(!r)throw Error("No integration found");const x={projectIdOrName:e,integrationId:r==null?void 0:r.id,installation:{groupRef:t,connectionId:o==null?void 0:o.id,config:{content:Gx(g)}}};return a(x,{onSuccess:h=>{v==null||v(h)},onError:h=>{y==null||y(h)},onSettled:()=>{p==null||p(),s.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:c,isPending:d,error:u,errorMsg:f}}const Yx=()=>{const e=ot(),t=qe(),[n,r]=b.useState(null);return{...In({mutationKey:["updateInstallation"],mutationFn:async i=>(await e()).installationApi.updateInstallation(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:i=>{console.error("Error updating installation"),Me(i,r)}}),errorMsg:n}};function Zx(){const{projectIdOrName:e}=Ee(),{integrationNameOrId:t}=ti(),{data:n}=Gr(t),{installation:r}=Ti(),o=qe(),{mutate:i,isIdle:s,isPending:a,error:c,errorMsg:d}=Yx();return{updateInstallation:({config:f,onSuccess:m,onError:g,onSettled:v})=>{var x,h;if(!r)throw Error("Installation not created yet. Try creating the installation first.");if(!n)throw Error("No integration found");const y=[];if((x=f==null?void 0:f.write)!=null&&x.objects&&Object.keys(f.write.objects).length>0&&y.push("config.content.write.objects"),(h=f==null?void 0:f.read)!=null&&h.objects){const w=Object.keys(f.read.objects);y.push(...w.map(I=>`config.content.read.objects.${I}`))}const p={projectIdOrName:e,integrationId:n==null?void 0:n.id,installationId:r.id,installationUpdate:{updateMask:y,installation:{config:{content:f}}}};return i(p,{onSuccess:w=>{m==null||m(w)},onError:w=>{g==null||g(w)},onSettled:()=>{v==null||v(),o.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:s,isPending:a,error:c,errorMsg:d}}const eO=()=>{const e=ot(),t=qe(),[n,r]=b.useState(null);return{...In({mutationKey:["deleteInstallation"],mutationFn:async i=>(await e()).installationApi.deleteInstallation(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:i=>{console.error("Error deleting installation"),Me(i,r)}}),errorMsg:n}};function tO(){const{projectIdOrName:e}=Ee(),{integrationNameOrId:t}=ti(),{data:n}=Gr(t),{installation:r}=Ti(),o=qe(),{mutate:i,isIdle:s,isPending:a,error:c,errorMsg:d}=eO();return{deleteInstallation:({onSuccess:f,onError:m,onSettled:g})=>{if(!r)throw Error("Installation not found. Not able to delete installation.");if(!n)throw Error("No integration found");return i({projectIdOrName:e,integrationId:n==null?void 0:n.id,installationId:r.id},{onSuccess:()=>{f==null||f()},onError:v=>{m==null||m(v)},onSettled:()=>{g==null||g(),o.invalidateQueries({queryKey:["amp","installations"]}),o.invalidateQueries({queryKey:["amp","connections"]})}})},isIdle:s,isPending:a,error:c,errorMsg:d}}exports.AmpersandContext=Xl;exports.AmpersandProvider=fv;exports.ConnectProvider=Vx;exports.FieldSettingWriteOnCreateEnum=mh;exports.FieldSettingWriteOnUpdateEnum=gh;exports.InstallIntegration=jx;exports.InstallationProvider=zx;exports.useAmpersandProvider=pv;exports.useConfig=Wx;exports.useConnection=Fa;exports.useCreateInstallation=Xx;exports.useDeleteInstallation=tO;exports.useInstallation=Ti;exports.useIsIntegrationInstalled=$x;exports.useManifest=yf;exports.useUpdateInstallation=Zx;
50
+ */const PI="react-tooltip-core-styles",DI="react-tooltip-base-styles",kc={core:!1,base:!1};function jc({css:e,id:t=DI,type:n="base",ref:r}){var o,i;if(!e||typeof document>"u"||kc[n]||n==="core"&&typeof process<"u"&&(!((o=process==null?void 0:process.env)===null||o===void 0)&&o.REACT_TOOLTIP_DISABLE_CORE_STYLES)||n!=="base"&&typeof process<"u"&&(!((i=process==null?void 0:process.env)===null||i===void 0)&&i.REACT_TOOLTIP_DISABLE_BASE_STYLES))return;n==="core"&&(t=PI),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 Lc=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10,strategy:i="absolute",middlewares:s=[TI(Number(o)),AI({fallbackAxisSideDirection:"start"}),RI({padding:5})],border:a})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const l=s;return n?(l.push(FI({element:n,padding:5})),Mc(e,t,{placement:r,strategy:i,middleware:l}).then(({x:d,y:u,placement:f,middlewareData:m})=>{var g,v;const y={left:`${d}px`,top:`${u}px`,border:a},{x:p,y:x}=(g=m.arrow)!==null&&g!==void 0?g:{x:0,y:0},h=(v={top:"bottom",right:"left",bottom:"top",left:"right"}[f.split("-")[0]])!==null&&v!==void 0?v:"bottom",w=a&&{borderBottom:a,borderRight:a};let I=0;if(a){const O=`${a}`.match(/(\d+)px/);I=O!=null&&O[1]?Number(O[1]):1}return{tooltipStyles:y,tooltipArrowStyles:{left:p!=null?`${p}px`:"",top:x!=null?`${x}px`:"",right:"",bottom:"",...w,[h]:`-${4+I}px`},place:f}})):Mc(e,t,{placement:"bottom",strategy:i,middleware:l}).then(({x:d,y:u,placement:f})=>({tooltipStyles:{left:`${d}px`,top:`${u}px`},tooltipArrowStyles:{},place:f}))},qc=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),Kc=(e,t,n)=>{let r=null;const o=function(...i){const s=()=>{r=null};!r&&(e.apply(this,i),r=setTimeout(s,t))};return o.cancel=()=>{r&&(clearTimeout(r),r=null)},o},Uc=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",As=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((o,i)=>As(o,t[i]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Uc(e)||!Uc(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(o=>As(e[o],t[o]))},MI=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"})},Vc=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(MI(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},kI=typeof window<"u"?b.useLayoutEffect:b.useEffect,At=e=>{e.current&&(clearTimeout(e.current),e.current=null)},jI="DEFAULT_TOOLTIP_ID",LI={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},qI=b.createContext({getTooltipData:()=>LI});function Cd(e=jI){return b.useContext(qI).getTooltipData(e)}var Ir={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"},ts={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 KI=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:o="dark",anchorId:i,anchorSelect:s,place:a="top",offset:l=10,events:d=["hover"],openOnClick:u=!1,positionStrategy:f="absolute",middlewares:m,wrapper:g,delayShow:v=0,delayHide:y=0,float:p=!1,hidden:x=!1,noArrow:h=!1,clickable:w=!1,closeOnEsc:I=!1,closeOnScroll:O=!1,closeOnResize:S=!1,openEvents:T,closeEvents:R,globalCloseEvents:A,imperativeModeOnly:D,style:B,position:$,afterShow:L,afterHide:J,disableTooltip:ae,content:re,contentWrapperRef:ne,isOpen:ge,defaultIsOpen:be=!1,setIsOpen:F,activeAnchor:q,setActiveAnchor:H,border:U,opacity:K,arrowColor:M,role:Z="tooltip"})=>{var ee;const W=b.useRef(null),te=b.useRef(null),X=b.useRef(null),de=b.useRef(null),j=b.useRef(null),[we,z]=b.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[Ne,Ve]=b.useState(!1),[et,He]=b.useState(!1),[Ie,kt]=b.useState(null),tt=b.useRef(!1),It=b.useRef(null),{anchorRefs:jt,setActiveAnchor:Lt}=Cd(t),nt=b.useRef(!1),[Ge,Be]=b.useState([]),Fe=b.useRef(!1),qt=u||d.includes("click"),pt=qt||(T==null?void 0:T.click)||(T==null?void 0:T.dblclick)||(T==null?void 0:T.mousedown),ln=T?{...T}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!T&&qt&&Object.assign(ln,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const Zt=R?{...R}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!R&&qt&&Object.assign(Zt,{mouseleave:!1,blur:!1,mouseout:!1});const Ct=A?{...A}:{escape:I||!1,scroll:O||!1,resize:S||!1,clickOutsideAnchor:pt||!1};D&&(Object.assign(ln,{mouseover:!1,focus:!1,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(Zt,{mouseout:!1,blur:!1,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(Ct,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),kI(()=>(Fe.current=!0,()=>{Fe.current=!1}),[]);const Pe=Q=>{Fe.current&&(Q&&He(!0),setTimeout(()=>{Fe.current&&(F==null||F(Q),ge===void 0&&Ve(Q))},10))};b.useEffect(()=>{if(ge===void 0)return()=>null;ge&&He(!0);const Q=setTimeout(()=>{Ve(ge)},10);return()=>{clearTimeout(Q)}},[ge]),b.useEffect(()=>{if(Ne!==tt.current)if(At(j),tt.current=Ne,Ne)L==null||L();else{const Q=(ce=>{const le=ce.match(/^([\d.]+)(ms|s)$/);if(!le)return 0;const[,Ke,We]=le;return Number(Ke)*(We==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));j.current=setTimeout(()=>{He(!1),kt(null),J==null||J()},Q+25)}},[Ne]);const un=Q=>{z(ce=>As(ce,Q)?ce:Q)},On=(Q=v)=>{At(X),et?Pe(!0):X.current=setTimeout(()=>{Pe(!0)},Q)},dn=(Q=y)=>{At(de),de.current=setTimeout(()=>{nt.current||Pe(!1)},Q)},Gn=Q=>{var ce;if(!Q)return;const le=(ce=Q.currentTarget)!==null&&ce!==void 0?ce:Q.target;if(!(le!=null&&le.isConnected))return H(null),void Lt({current:null});v?On():Pe(!0),H(le),Lt({current:le}),At(de)},ht=()=>{w?dn(y||100):y?dn():Pe(!1),At(X)},fn=({x:Q,y:ce})=>{var le;const Ke={getBoundingClientRect:()=>({x:Q,y:ce,width:0,height:0,top:ce,left:Q,right:Q,bottom:ce})};Lc({place:(le=Ie==null?void 0:Ie.place)!==null&&le!==void 0?le:a,offset:l,elementReference:Ke,tooltipReference:W.current,tooltipArrowReference:te.current,strategy:f,middlewares:m,border:U}).then(We=>{un(We)})},_n=Q=>{if(!Q)return;const ce=Q,le={x:ce.clientX,y:ce.clientY};fn(le),It.current=le},Xn=Q=>{var ce;if(!Ne)return;const le=Q.target;le.isConnected&&(!((ce=W.current)===null||ce===void 0)&&ce.contains(le)||[document.querySelector(`[id='${i}']`),...Ge].some(Ke=>Ke==null?void 0:Ke.contains(le))||(Pe(!1),At(X)))},Sn=Kc(Gn,50),Ae=Kc(ht,50),st=Q=>{Ae.cancel(),Sn(Q)},oe=()=>{Sn.cancel(),Ae()},me=b.useCallback(()=>{var Q,ce;const le=(Q=Ie==null?void 0:Ie.position)!==null&&Q!==void 0?Q:$;le?fn(le):p?It.current&&fn(It.current):q!=null&&q.isConnected&&Lc({place:(ce=Ie==null?void 0:Ie.place)!==null&&ce!==void 0?ce:a,offset:l,elementReference:q,tooltipReference:W.current,tooltipArrowReference:te.current,strategy:f,middlewares:m,border:U}).then(Ke=>{Fe.current&&un(Ke)})},[Ne,q,re,B,a,Ie==null?void 0:Ie.place,l,f,$,Ie==null?void 0:Ie.position,p]);b.useEffect(()=>{var Q,ce;const le=new Set(jt);Ge.forEach(ye=>{ae!=null&&ae(ye)||le.add({current:ye})});const Ke=document.querySelector(`[id='${i}']`);Ke&&!(ae!=null&&ae(Ke))&&le.add({current:Ke});const We=()=>{Pe(!1)},mt=Vc(q),Xe=Vc(W.current);Ct.scroll&&(window.addEventListener("scroll",We),mt==null||mt.addEventListener("scroll",We),Xe==null||Xe.addEventListener("scroll",We));let rt=null;Ct.resize?window.addEventListener("resize",We):q&&W.current&&(rt=NI(q,W.current,me,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const gt=ye=>{ye.key==="Escape"&&Pe(!1)};Ct.escape&&window.addEventListener("keydown",gt),Ct.clickOutsideAnchor&&window.addEventListener("click",Xn);const Te=[],En=ye=>!!(ye!=null&&ye.target&&(q!=null&&q.contains(ye.target))),jo=ye=>{Ne&&En(ye)||Gn(ye)},Kt=ye=>{Ne&&En(ye)&&ht()},Ti=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],Ri=["click","dblclick","mousedown","mouseup"];Object.entries(ln).forEach(([ye,Ut])=>{Ut&&(Ti.includes(ye)?Te.push({event:ye,listener:st}):Ri.includes(ye)&&Te.push({event:ye,listener:jo}))}),Object.entries(Zt).forEach(([ye,Ut])=>{Ut&&(Ti.includes(ye)?Te.push({event:ye,listener:oe}):Ri.includes(ye)&&Te.push({event:ye,listener:Kt}))}),p&&Te.push({event:"pointermove",listener:_n});const Ai=()=>{nt.current=!0},Fi=()=>{nt.current=!1,ht()},Pi=w&&(Zt.mouseout||Zt.mouseleave);return Pi&&((Q=W.current)===null||Q===void 0||Q.addEventListener("mouseover",Ai),(ce=W.current)===null||ce===void 0||ce.addEventListener("mouseout",Fi)),Te.forEach(({event:ye,listener:Ut})=>{le.forEach(ti=>{var Yn;(Yn=ti.current)===null||Yn===void 0||Yn.addEventListener(ye,Ut)})}),()=>{var ye,Ut;Ct.scroll&&(window.removeEventListener("scroll",We),mt==null||mt.removeEventListener("scroll",We),Xe==null||Xe.removeEventListener("scroll",We)),Ct.resize?window.removeEventListener("resize",We):rt==null||rt(),Ct.clickOutsideAnchor&&window.removeEventListener("click",Xn),Ct.escape&&window.removeEventListener("keydown",gt),Pi&&((ye=W.current)===null||ye===void 0||ye.removeEventListener("mouseover",Ai),(Ut=W.current)===null||Ut===void 0||Ut.removeEventListener("mouseout",Fi)),Te.forEach(({event:ti,listener:Yn})=>{le.forEach(Lo=>{var ni;(ni=Lo.current)===null||ni===void 0||ni.removeEventListener(ti,Yn)})})}},[q,me,et,jt,Ge,T,R,A,qt,v,y]),b.useEffect(()=>{var Q,ce;let le=(ce=(Q=Ie==null?void 0:Ie.anchorSelect)!==null&&Q!==void 0?Q:s)!==null&&ce!==void 0?ce:"";!le&&t&&(le=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const Ke=new MutationObserver(We=>{const mt=[],Xe=[];We.forEach(rt=>{if(rt.type==="attributes"&&rt.attributeName==="data-tooltip-id"&&(rt.target.getAttribute("data-tooltip-id")===t?mt.push(rt.target):rt.oldValue===t&&Xe.push(rt.target)),rt.type==="childList"){if(q){const gt=[...rt.removedNodes].filter(Te=>Te.nodeType===1);if(le)try{Xe.push(...gt.filter(Te=>Te.matches(le))),Xe.push(...gt.flatMap(Te=>[...Te.querySelectorAll(le)]))}catch{}gt.some(Te=>{var En;return!!(!((En=Te==null?void 0:Te.contains)===null||En===void 0)&&En.call(Te,q))&&(He(!1),Pe(!1),H(null),At(X),At(de),!0)})}if(le)try{const gt=[...rt.addedNodes].filter(Te=>Te.nodeType===1);mt.push(...gt.filter(Te=>Te.matches(le))),mt.push(...gt.flatMap(Te=>[...Te.querySelectorAll(le)]))}catch{}}}),(mt.length||Xe.length)&&Be(rt=>[...rt.filter(gt=>!Xe.includes(gt)),...mt])});return Ke.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{Ke.disconnect()}},[t,s,Ie==null?void 0:Ie.anchorSelect,q]),b.useEffect(()=>{me()},[me]),b.useEffect(()=>{if(!(ne!=null&&ne.current))return()=>null;const Q=new ResizeObserver(()=>{setTimeout(()=>me())});return Q.observe(ne.current),()=>{Q.disconnect()}},[re,ne==null?void 0:ne.current]),b.useEffect(()=>{var Q;const ce=document.querySelector(`[id='${i}']`),le=[...Ge,ce];q&&le.includes(q)||H((Q=Ge[0])!==null&&Q!==void 0?Q:ce)},[i,Ge,q]),b.useEffect(()=>(be&&Pe(!0),()=>{At(X),At(de)}),[]),b.useEffect(()=>{var Q;let ce=(Q=Ie==null?void 0:Ie.anchorSelect)!==null&&Q!==void 0?Q:s;if(!ce&&t&&(ce=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),ce)try{const le=Array.from(document.querySelectorAll(ce));Be(le)}catch{Be([])}},[t,s,Ie==null?void 0:Ie.anchorSelect]),b.useEffect(()=>{X.current&&(At(X),On(v))},[v]);const Je=(ee=Ie==null?void 0:Ie.content)!==null&&ee!==void 0?ee:re,pn=Ne&&Object.keys(we.tooltipStyles).length>0;return b.useImperativeHandle(e,()=>({open:Q=>{if(Q!=null&&Q.anchorSelect)try{document.querySelector(Q.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${Q.anchorSelect}" is not a valid CSS selector`)}kt(Q??null),Q!=null&&Q.delay?On(Q.delay):Pe(!0)},close:Q=>{Q!=null&&Q.delay?dn(Q.delay):Pe(!1)},activeAnchor:q,place:we.place,isOpen:!!(et&&!x&&Je&&pn)})),et&&!x&&Je?b.createElement(g,{id:t,role:Z,className:Dt("react-tooltip",Ir.tooltip,ts.tooltip,ts[o],n,`react-tooltip__place-${we.place}`,Ir[pn?"show":"closing"],pn?"react-tooltip__show":"react-tooltip__closing",f==="fixed"&&Ir.fixed,w&&Ir.clickable),onTransitionEnd:Q=>{At(j),Ne||Q.propertyName!=="opacity"||(He(!1),kt(null),J==null||J())},style:{...B,...we.tooltipStyles,opacity:K!==void 0&&pn?K:void 0},ref:W},Je,b.createElement(g,{className:Dt("react-tooltip-arrow",Ir.arrow,ts.arrow,r,h&&Ir.noArrow),style:{...we.tooltipArrowStyles,background:M?`linear-gradient(to right bottom, transparent 50%, ${M} 50%)`:void 0},ref:te})):null},UI=({content:e})=>b.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),VI=b.forwardRef(({id:e,anchorId:t,anchorSelect:n,content:r,html:o,render:i,className:s,classNameArrow:a,variant:l="dark",place:d="top",offset:u=10,wrapper:f="div",children:m=null,events:g=["hover"],openOnClick:v=!1,positionStrategy:y="absolute",middlewares:p,delayShow:x=0,delayHide:h=0,float:w=!1,hidden:I=!1,noArrow:O=!1,clickable:S=!1,closeOnEsc:T=!1,closeOnScroll:R=!1,closeOnResize:A=!1,openEvents:D,closeEvents:B,globalCloseEvents:$,imperativeModeOnly:L=!1,style:J,position:ae,isOpen:re,defaultIsOpen:ne=!1,disableStyleInjection:ge=!1,border:be,opacity:F,arrowColor:q,setIsOpen:H,afterShow:U,afterHide:K,disableTooltip:M,role:Z="tooltip"},ee)=>{const[W,te]=b.useState(r),[X,de]=b.useState(o),[j,we]=b.useState(d),[z,Ne]=b.useState(l),[Ve,et]=b.useState(u),[He,Ie]=b.useState(x),[kt,tt]=b.useState(h),[It,jt]=b.useState(w),[Lt,nt]=b.useState(I),[Ge,Be]=b.useState(f),[Fe,qt]=b.useState(g),[pt,ln]=b.useState(y),[Zt,Ct]=b.useState(null),[Pe,un]=b.useState(null),On=b.useRef(ge),{anchorRefs:dn,activeAnchor:Gn}=Cd(e),ht=Ae=>Ae==null?void 0:Ae.getAttributeNames().reduce((st,oe)=>{var me;return oe.startsWith("data-tooltip-")&&(st[oe.replace(/^data-tooltip-/,"")]=(me=Ae==null?void 0:Ae.getAttribute(oe))!==null&&me!==void 0?me:null),st},{}),fn=Ae=>{const st={place:oe=>{var me;we((me=oe)!==null&&me!==void 0?me:d)},content:oe=>{te(oe??r)},html:oe=>{de(oe??o)},variant:oe=>{var me;Ne((me=oe)!==null&&me!==void 0?me:l)},offset:oe=>{et(oe===null?u:Number(oe))},wrapper:oe=>{var me;Be((me=oe)!==null&&me!==void 0?me:f)},events:oe=>{const me=oe==null?void 0:oe.split(" ");qt(me??g)},"position-strategy":oe=>{var me;ln((me=oe)!==null&&me!==void 0?me:y)},"delay-show":oe=>{Ie(oe===null?x:Number(oe))},"delay-hide":oe=>{tt(oe===null?h:Number(oe))},float:oe=>{jt(oe===null?w:oe==="true")},hidden:oe=>{nt(oe===null?I:oe==="true")},"class-name":oe=>{Ct(oe)}};Object.values(st).forEach(oe=>oe(null)),Object.entries(Ae).forEach(([oe,me])=>{var Je;(Je=st[oe])===null||Je===void 0||Je.call(st,me)})};b.useEffect(()=>{te(r)},[r]),b.useEffect(()=>{de(o)},[o]),b.useEffect(()=>{we(d)},[d]),b.useEffect(()=>{Ne(l)},[l]),b.useEffect(()=>{et(u)},[u]),b.useEffect(()=>{Ie(x)},[x]),b.useEffect(()=>{tt(h)},[h]),b.useEffect(()=>{jt(w)},[w]),b.useEffect(()=>{nt(I)},[I]),b.useEffect(()=>{ln(y)},[y]),b.useEffect(()=>{On.current!==ge&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")},[ge]),b.useEffect(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:ge==="core",disableBase:ge}}))},[]),b.useEffect(()=>{var Ae;const st=new Set(dn);let oe=n;if(!oe&&e&&(oe=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),oe)try{document.querySelectorAll(oe).forEach(ce=>{st.add({current:ce})})}catch{console.warn(`[react-tooltip] "${oe}" is not a valid CSS selector`)}const me=document.querySelector(`[id='${t}']`);if(me&&st.add({current:me}),!st.size)return()=>null;const Je=(Ae=Pe??me)!==null&&Ae!==void 0?Ae:Gn.current,pn=new MutationObserver(ce=>{ce.forEach(le=>{var Ke;if(!Je||le.type!=="attributes"||!(!((Ke=le.attributeName)===null||Ke===void 0)&&Ke.startsWith("data-tooltip-")))return;const We=ht(Je);fn(We)})}),Q={attributes:!0,childList:!1,subtree:!1};if(Je){const ce=ht(Je);fn(ce),pn.observe(Je,Q)}return()=>{pn.disconnect()}},[dn,Gn,Pe,t,n]),b.useEffect(()=>{J!=null&&J.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),be&&!qc("border",`${be}`)&&console.warn(`[react-tooltip] "${be}" is not a valid \`border\`.`),J!=null&&J.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),F&&!qc("opacity",`${F}`)&&console.warn(`[react-tooltip] "${F}" is not a valid \`opacity\`.`)},[]);let _n=m;const Xn=b.useRef(null);if(i){const Ae=i({content:(Pe==null?void 0:Pe.getAttribute("data-tooltip-content"))||W||null,activeAnchor:Pe});_n=Ae?b.createElement("div",{ref:Xn,className:"react-tooltip-content-wrapper"},Ae):null}else W&&(_n=W);X&&(_n=b.createElement(UI,{content:X}));const Sn={forwardRef:ee,id:e,anchorId:t,anchorSelect:n,className:Dt(s,Zt),classNameArrow:a,content:_n,contentWrapperRef:Xn,place:j,variant:z,offset:Ve,wrapper:Ge,events:Fe,openOnClick:v,positionStrategy:pt,middlewares:p,delayShow:He,delayHide:kt,float:It,hidden:Lt,noArrow:O,clickable:S,closeOnEsc:T,closeOnScroll:R,closeOnResize:A,openEvents:D,closeEvents:B,globalCloseEvents:$,imperativeModeOnly:L,style:J,position:ae,isOpen:re,defaultIsOpen:ne,border:be,opacity:F,arrowColor:q,setIsOpen:H,afterShow:U,afterHide:K,disableTooltip:M,activeAnchor:Pe,setActiveAnchor:Ae=>un(Ae),role:Z};return b.createElement(KI,{...Sn})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||jc({css:":root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9;--rt-transition-show-delay:0.15s;--rt-transition-closing-delay:0.15s}.core-styles-module_tooltip__3vRRp{position:absolute;top:0;left:0;pointer-events:none;opacity:0;will-change:opacity}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{opacity:var(--rt-opacity);transition:opacity var(--rt-transition-show-delay)ease-out}.core-styles-module_closing__sGnxF{opacity:0;transition:opacity var(--rt-transition-closing-delay)ease-in}",type:"core"}),e.detail.disableBase||jc({css:`
51
+ .styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:8px;height:8px}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:"base"})});function $I(){return c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",children:[c.jsxs("g",{clipPath:"url(#clip0_2896_16290)",children:[c.jsx("path",{d:"M8.00032 11.167L8.00032 7.83366M8.00032 1.83366C4.33366 1.83366 1.33366 4.83366 1.33366 8.50033C1.33366 12.167 4.33366 15.167 8.00033 15.167C11.667 15.167 14.667 12.167 14.667 8.50033C14.667 4.83366 11.667 1.83366 8.00032 1.83366Z",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M8.00293 5.83301L7.99768 5.83301",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"})]}),c.jsx("defs",{children:c.jsx("clipPath",{id:"clip0_2896_16290",children:c.jsx("rect",{width:"16",height:"16",fill:"white",transform:"translate(16 16.5) rotate(180)"})})})]})}function xd({id:e,tooltipText:t}){return c.jsxs(c.Fragment,{children:[c.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:$I()}),c.jsx(VI,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}const Od=b.createContext(null);function _d(){const e=b.useContext(Od);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const Sd=b.createContext(()=>{});function HI(){const e=b.useContext(Sd);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}var Ed=Symbol.for("immer-nothing"),$c=Symbol.for("immer-draftable"),St=Symbol.for("immer-state"),BI=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 wt(e,...t){if(process.env.NODE_ENV!=="production"){const n=BI[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 Hr=Object.getPrototypeOf;function Br(e){return!!e&&!!e[St]}function vr(e){var t;return e?Nd(e)||Array.isArray(e)||!!e[$c]||!!((t=e.constructor)!=null&&t[$c])||Ro(e)||Ao(e):!1}var JI=Object.prototype.constructor.toString();function Nd(e){if(!e||typeof e!="object")return!1;const t=Hr(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===JI}function go(e,t){To(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function To(e){const t=e[St];return t?t.type_:Array.isArray(e)?1:Ro(e)?2:Ao(e)?3:0}function Fs(e,t){return To(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Td(e,t,n){const r=To(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function WI(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Ro(e){return e instanceof Map}function Ao(e){return e instanceof Set}function nr(e){return e.copy_||e.base_}function Ps(e,t){if(Ro(e))return new Map(e);if(Ao(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Nd(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[St];let o=Reflect.ownKeys(r);for(let i=0;i<o.length;i++){const s=o[i],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(Hr(e),r)}else{const r=Hr(e);if(r!==null&&n)return{...e};const o=Object.create(r);return Object.assign(o,e)}}function Ca(e,t=!1){return Fo(e)||Br(e)||!vr(e)||(To(e)>1&&(e.set=e.add=e.clear=e.delete=zI),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Ca(r,!0))),e}function zI(){wt(2)}function Fo(e){return Object.isFrozen(e)}var QI={};function wr(e){const t=QI[e];return t||wt(0,e),t}var pi;function Rd(){return pi}function GI(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Hc(e,t){t&&(wr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ds(e){Ms(e),e.drafts_.forEach(XI),e.drafts_=null}function Ms(e){e===pi&&(pi=e.parent_)}function Bc(e){return pi=GI(pi,e)}function XI(e){const t=e[St];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Jc(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[St].modified_&&(Ds(t),wt(4)),vr(e)&&(e=yo(t,e),t.parent_||vo(t,e)),t.patches_&&wr("Patches").generateReplacementPatches_(n[St].base_,e,t.patches_,t.inversePatches_)):e=yo(t,n,[]),Ds(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Ed?e:void 0}function yo(e,t,n){if(Fo(t))return t;const r=t[St];if(!r)return go(t,(o,i)=>Wc(e,r,t,o,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return vo(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const o=r.copy_;let i=o,s=!1;r.type_===3&&(i=new Set(o),o.clear(),s=!0),go(i,(a,l)=>Wc(e,r,o,a,l,n,s)),vo(e,o,!1),n&&e.patches_&&wr("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Wc(e,t,n,r,o,i,s){if(process.env.NODE_ENV!=="production"&&o===n&&wt(5),Br(o)){const a=i&&t&&t.type_!==3&&!Fs(t.assigned_,r)?i.concat(r):void 0,l=yo(e,o,a);if(Td(n,r,l),Br(l))e.canAutoFreeze_=!1;else return}else s&&n.add(o);if(vr(o)&&!Fo(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;yo(e,o),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&vo(e,o)}}function vo(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ca(t,n)}function YI(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Rd(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=xa;n&&(o=[r],i=hi);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}var xa={get(e,t){if(t===St)return e;const n=nr(e);if(!Fs(n,t))return ZI(e,n,t);const r=n[t];return e.finalized_||!vr(r)?r:r===ns(e.base_,t)?(rs(e),e.copy_[t]=js(r,e)):r},has(e,t){return t in nr(e)},ownKeys(e){return Reflect.ownKeys(nr(e))},set(e,t,n){const r=Ad(nr(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=ns(nr(e),t),i=o==null?void 0:o[St];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(WI(n,o)&&(n!==void 0||Fs(e.base_,t)))return!0;rs(e),ks(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 ns(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,rs(e),ks(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=nr(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){wt(11)},getPrototypeOf(e){return Hr(e.base_)},setPrototypeOf(){wt(12)}},hi={};go(xa,(e,t)=>{hi[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});hi.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&wt(13),hi.set.call(this,e,t,void 0)};hi.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&wt(14),xa.set.call(this,e[0],t,n,e[0])};function ns(e,t){const n=e[St];return(n?nr(n):e)[t]}function ZI(e,t,n){var o;const r=Ad(t,n);return r?"value"in r?r.value:(o=r.get)==null?void 0:o.call(e.draft_):void 0}function Ad(e,t){if(!(t in e))return;let n=Hr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Hr(n)}}function ks(e){e.modified_||(e.modified_=!0,e.parent_&&ks(e.parent_))}function rs(e){e.copy_||(e.copy_=Ps(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var e0=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(l=i,...d){return s.produce(l,u=>n.call(this,u,...d))}}typeof n!="function"&&wt(6),r!==void 0&&typeof r!="function"&&wt(7);let o;if(vr(t)){const i=Bc(this),s=js(t,void 0);let a=!0;try{o=n(s),a=!1}finally{a?Ds(i):Ms(i)}return Hc(i,r),Jc(o,i)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===Ed&&(o=void 0),this.autoFreeze_&&Ca(o,!0),r){const i=[],s=[];wr("Patches").generateReplacementPatches_(t,o,i,s),r(i,s)}return o}else wt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,l=>t(l,...a));let r,o;return[this.produce(t,n,(s,a)=>{r=s,o=a}),r,o]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){vr(e)||wt(8),Br(e)&&(e=t0(e));const t=Bc(this),n=js(e,void 0);return n[St].isManual_=!0,Ms(t),n}finishDraft(e,t){const n=e&&e[St];(!n||!n.isManual_)&&wt(9);const{scope_:r}=n;return Hc(r,t),Jc(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const o=t[n];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}n>-1&&(t=t.slice(n+1));const r=wr("Patches").applyPatches_;return Br(e)?r(e,t):this.produce(e,o=>r(o,t))}};function js(e,t){const n=Ro(e)?wr("MapSet").proxyMap_(e,t):Ao(e)?wr("MapSet").proxySet_(e,t):YI(e,t);return(t?t.scope_:Rd()).drafts_.push(n),n}function t0(e){return Br(e)||wt(10,e),Fd(e)}function Fd(e){if(!vr(e)||Fo(e))return e;const t=e[St];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Ps(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Ps(e,!0);return go(n,(r,o)=>{Td(n,r,Fd(o))}),t&&(t.finalized_=!1),n}var Et=new e0,Pt=Et.produce;Et.produceWithPatches.bind(Et);Et.setAutoFreeze.bind(Et);Et.setUseStrictShallowCopy.bind(Et);Et.applyPatches.bind(Et);Et.createDraft.bind(Et);Et.finishDraft.bind(Et);const Pd=b.createContext(void 0),n0={};function Oa(){const e=b.useContext(Pd);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function r0({children:e}){const{installation:t}=Ze(),{hydratedRevision:n,loading:r}=Yr(),[o,i]=b.useState(n0),s=t==null?void 0:t.config;b.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(o).length>0)&&Jv(n,s,i)},[n,r,s,o]);const a=b.useCallback((g,v)=>{i(y=>Pt(y,p=>{p[g]=Pt(p[g],v)}))},[i]),l=b.useCallback((g,v)=>{i(y=>Pt(y,p=>{p[g]=v}))},[i]),d=b.useCallback(()=>{i(Pt(g=>{const v=g.other.write;v&&(v.isWriteModified=!1)}))},[i]),u=b.useCallback(g=>{i(Pt(v=>{var p;const y=(p=v[g])==null?void 0:p.read;y&&(y.isOptionalFieldsModified=!1,y.isRequiredMapFieldsModified=!1,y.isValueMappingsModified=!1)}))},[i]),f=b.useCallback(g=>{g===mr?d():u(g)},[u,d]),m=b.useMemo(()=>({objectConfigurationsState:o,setObjectConfigurationsState:i,setConfigureState:a,resetConfigureState:l,resetPendingConfigurationState:f}),[o,l,f,a]);return c.jsx(Pd.Provider,{value:m,children:e})}const Yt=()=>{const{appName:e}=Ee(),{objectConfigurationsState:t,setConfigureState:n}=Oa(),{selectedObjectName:r}=_d(),o=vu(r||"",t);return{appName:e,configureState:o,setConfigureState:n,selectedObjectName:r}};function i0(e,t){var r;const n=((r=e==null?void 0:e.read)==null?void 0:r.selectedFieldMappings)||{};if(t.forEach(o=>{const{field:i,value:s}=o;s===null?delete n[i]:n[i]=s}),e!=null&&e.read){const o=e.read.savedConfig.requiredMapFields,s=!fu(o,n);e.read.isRequiredMapFieldsModified=s}}function mi(e,t,n){t(e,r=>i0(r,n))}const o0="Each field must be mapped to a unique value";function _a({field:e,onSelectChange:t,allFields:n}){var h;const{configureState:r,selectedObjectName:o,setConfigureState:i}=Yt(),[s,a]=b.useState(!0),{isError:l,removeError:d,getError:u}=Mt(),f=(h=r==null?void 0:r.read)==null?void 0:h.selectedFieldMappings,m=f==null?void 0:f[e.mapToName];b.useEffect(()=>{e._default&&!m&&o&&r&&mi(o,i,[{field:e.mapToName,value:e._default}]),a(!1)},[e,i,o,m,r]);const g=b.useMemo(()=>n.map(w=>({id:w.fieldName,label:w.displayName,value:w.fieldName})),[n]),v=c.jsx(fd,{disabled:s,items:g,selectedValue:m||null,onSelectedItemChange:w=>{t({target:{name:e.mapToName,value:w==null?void 0:w.value}})},placeholder:"Please select one",style:{width:"100%"}}),y=b.useCallback(()=>{o&&(mi(o,i,[{field:e.mapToName,value:null}]),l(ue.MAPPING,o)&&d(ue.MAPPING,o))},[e.mapToName,o,i,l,d]),{hasDuplicationError:p,errorMessage:x}=b.useMemo(()=>{const w=u(ue.MAPPING,o),I=Array.isArray(w)&&w.length>0&&w.includes(e.mapToName);return{hasDuplicationError:I,errorMessage:I?o0:""}},[o,u,e.mapToName]);return c.jsxs(c.Fragment,{children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[c.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:[c.jsx("span",{style:{fontWeight:500},children:e.mapToDisplayName??e.mapToName}),c.jsx("span",{children:(e==null?void 0:e.prompt)&&c.jsx(xd,{id:`tooltip-id-${e==null?void 0:e.prompt}`,tooltipText:e==null?void 0:e.prompt})})]}),c.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[v,c.jsx($e,{type:"button",variant:"ghost",onClick:y,children:"Clear"})]})]},e.mapToName),p&&c.jsxs("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:[" ",x," "]},e.mapToName)]})}const s0="_formControl_9qd8d_1",a0="_formLabel_9qd8d_5",c0="_formLabelRequired_9qd8d_11",l0="_formInput_9qd8d_16",u0="_formInputInvalid_9qd8d_20",d0="_formError_9qd8d_24",f0="_disabled_9qd8d_30",tr={formControl:s0,formLabel:a0,formLabelRequired:c0,formInput:l0,formInputInvalid:u0,formError:d0,disabled:f0};function Po({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:o=!1,errorMessage:i,children:s}){return c.jsxs("div",{className:Dt(tr.formControl,{[tr.disabled]:r}),children:[t&&c.jsx("label",{htmlFor:e,className:Dt(tr.formLabel,{[tr.formLabelRequired]:n}),children:t}),c.jsx("div",{id:e,className:Dt(tr.formInput,{[tr.formInputInvalid]:o}),children:s}),o&&i&&c.jsx("div",{className:tr.formError,role:"alert",children:i})]})}function Dd({selectedFieldMappings:e,selectedObjectName:t,fieldName:n,fieldValue:r,setError:o}){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 o(ue.MAPPING,t,a),!0}return!1}function p0({dynamicFieldMappings:e,onSelectChange:t,allFields:n}){return e.length?c.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:e.map(r=>c.jsx(Po,{id:r.mapToName,children:c.jsx(_a,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function h0(){var v,y;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Yt(),{isError:r,removeError:o,setError:i}=Mt(),s=((v=t==null?void 0:t.read)==null?void 0:v.allFields)||[],{fieldMapping:a}=Ze(),l=(y=t==null?void 0:t.read)==null?void 0:y.selectedFieldMappings,d=p=>{const{value:x,name:h}=p.target;!x||Dd({selectedFieldMappings:l,selectedObjectName:e,fieldName:h,fieldValue:x,setError:i})||(e&&mi(e,n,[{field:h,value:x}]),r(ue.MAPPING,h)&&o(ue.MAPPING,h),e&&r(ue.MAPPING,e)&&o(ue.MAPPING,e))},u=b.useMemo(()=>!e||!a?[]:Object.values(a[e]||{}).flat().filter(p=>!p.fieldName),[a,e]),f=b.useMemo(()=>{var h;return(((h=t==null?void 0:t.read)==null?void 0:h.optionalMapFields)||[]).filter(w=>!u.some(I=>I.mapToName===w.mapToName))},[t,u]),m=u.length>0;return f.length>0||m?c.jsxs(c.Fragment,{children:[c.jsx(Nt,{string:"Map the following optional fields"}),c.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:[f==null?void 0:f.map(p=>c.jsx(Po,{id:p.mapToName,children:c.jsx(_a,{allFields:s,field:p,onSelectChange:d})},p.mapToName)),m&&c.jsx(p0,{dynamicFieldMappings:u,onSelectChange:d,allFields:s})]})]}):null}function m0(){var d;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Yt(),{isError:r,removeError:o,setError:i}=Mt(),s=(d=t==null?void 0:t.read)==null?void 0:d.selectedFieldMappings,a=u=>{const{value:f,name:m}=u.target;!f||Dd({selectedFieldMappings:s,selectedObjectName:e,fieldName:m,fieldValue:f,setError:i})||(e&&mi(e,n,[{field:m,value:f}]),r(ue.MAPPING,m)&&o(ue.MAPPING,m),e&&r(ue.MAPPING,e)&&o(ue.MAPPING,e))},l=b.useMemo(()=>{var u;return((u=t==null?void 0:t.read)==null?void 0:u.requiredMapFields)||[]},[t]);return l!=null&&l.length?c.jsxs(c.Fragment,{children:[c.jsx(Nt,{string:"Map the following fields"}),c.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:l.map(u=>{var f;return c.jsx(Po,{id:u.mapToName,isInvalid:r(ue.MAPPING,u.mapToName),errorMessage:"* required",children:c.jsx(_a,{allFields:((f=t==null?void 0:t.read)==null?void 0:f.allFields)||[],field:u,onSelectChange:a})},u.mapToName)})})]}):null}const g0=(e,t)=>e.filter(n=>!t.has(n));function y0(){var m,g,v;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Yt(),{fieldMapping:r}=Ze(),o=((m=t==null?void 0:t.read)==null?void 0:m.selectedFieldMappings)||{},i=Object.keys(o),s=((g=t==null?void 0:t.read)==null?void 0:g.requiredMapFields)||[],a=((v=t==null?void 0:t.read)==null?void 0:v.optionalMapFields)||[],l=e&&r?Object.values(r[e]||{}).flat().filter(y=>!y.fieldName):[],d=s.concat(l,a).map(y=>y.mapToName),u=new Set(d),f=g0(i,u);b.useEffect(()=>{e&&f.length&&mi(e,n,f.map(y=>({field:y,value:null})))},[e,n,f])}const v0={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function w0({children:e,style:t}){return c.jsx(Cn,{style:{...v0,...t},children:e})}function b0(){var d,u,f;const{project:e}=Ee(),{hydratedRevision:t}=Yr(),{selectedObjectName:n}=Yt(),{providerName:r}=lt(),o=e==null?void 0:e.appName,i=(f=(u=(d=t==null?void 0:t.content)==null?void 0:d.read)==null?void 0:u.objects)==null?void 0:f.find(m=>m.objectName===n),s=(i==null?void 0:i.displayName)||n&&on(n),a=i==null?void 0:i.mapToName,l=(i==null?void 0:i.mapToDisplayName)||a&&on(a);return l&&o&&r?c.jsx(w0,{style:{marginTop:"1rem"},children:c.jsxs("p",{style:{margin:"1rem 0"},children:[c.jsx("b",{children:l})," in ",o," is mapped to"," ",c.jsx("b",{children:s})," in ",r,"."]})}):null}function zc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Md(...e){return t=>{let n=!1;const r=e.map(o=>{const i=zc(o,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){const i=r[o];typeof i=="function"?i():zc(e[o],null)}}}}function Jr(...e){return k.useCallback(Md(...e),e)}function Do(e,t=[]){let n=[];function r(i,s){const a=k.createContext(s),l=n.length;n=[...n,s];const d=f=>{var x;const{scope:m,children:g,...v}=f,y=((x=m==null?void 0:m[e])==null?void 0:x[l])||a,p=k.useMemo(()=>v,Object.values(v));return c.jsx(y.Provider,{value:p,children:g})};d.displayName=i+"Provider";function u(f,m){var y;const g=((y=m==null?void 0:m[e])==null?void 0:y[l])||a,v=k.useContext(g);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[d,u]}const o=()=>{const i=n.map(s=>k.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return k.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,I0(o,...t)]}function I0(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:d})=>{const f=l(i)[`__scope${d}`];return{...a,...f}},{});return k.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function zt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}var gi=globalThis!=null&&globalThis.document?k.useLayoutEffect:()=>{},C0=k[" useInsertionEffect ".trim().toString()]||gi;function Sa({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,s]=x0({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:o;{const u=k.useRef(e!==void 0);k.useEffect(()=>{const f=u.current;f!==a&&console.warn(`${r} is changing from ${f?"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 d=k.useCallback(u=>{var f;if(a){const m=O0(u)?u(e):u;m!==e&&((f=s.current)==null||f.call(s,m))}else i(u)},[a,e,i,s]);return[l,d]}function x0({defaultProp:e,onChange:t}){const[n,r]=k.useState(e),o=k.useRef(n),i=k.useRef(t);return C0(()=>{i.current=t},[t]),k.useEffect(()=>{var s;o.current!==n&&((s=i.current)==null||s.call(i,n),o.current=n)},[n,o]),[n,r,i]}function O0(e){return typeof e=="function"}function _0(e){const t=k.useRef({value:e,previous:e});return k.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function S0(e){const[t,n]=k.useState(void 0);return gi(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const l=i.borderBoxSize,d=Array.isArray(l)?l[0]:l;s=d.inlineSize,a=d.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 E0(e,t){return k.useReducer((n,r)=>t[n][r]??n,e)}var Ea=e=>{const{present:t,children:n}=e,r=N0(t),o=typeof n=="function"?n({present:r.isPresent}):k.Children.only(n),i=Jr(r.ref,T0(o));return typeof n=="function"||r.isPresent?k.cloneElement(o,{ref:i}):null};Ea.displayName="Presence";function N0(e){const[t,n]=k.useState(),r=k.useRef(null),o=k.useRef(e),i=k.useRef("none"),s=e?"mounted":"unmounted",[a,l]=E0(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return k.useEffect(()=>{const d=Gi(r.current);i.current=a==="mounted"?d:"none"},[a]),gi(()=>{const d=r.current,u=o.current;if(u!==e){const m=i.current,g=Gi(d);e?l("MOUNT"):g==="none"||(d==null?void 0:d.display)==="none"?l("UNMOUNT"):l(u&&m!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),gi(()=>{if(t){let d;const u=t.ownerDocument.defaultView??window,f=g=>{const y=Gi(r.current).includes(g.animationName);if(g.target===t&&y&&(l("ANIMATION_END"),!o.current)){const p=t.style.animationFillMode;t.style.animationFillMode="forwards",d=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=p)})}},m=g=>{g.target===t&&(i.current=Gi(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{u.clearTimeout(d),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:k.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function Gi(e){return(e==null?void 0:e.animationName)||"none"}function T0(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Ls(e){const t=R0(e),n=k.forwardRef((r,o)=>{const{children:i,...s}=r,a=k.Children.toArray(i),l=a.find(F0);if(l){const d=l.props.children,u=a.map(f=>f===l?k.Children.count(d)>1?k.Children.only(null):k.isValidElement(d)?d.props.children:null:f);return c.jsx(t,{...s,ref:o,children:k.isValidElement(d)?k.cloneElement(d,void 0,u):null})}return c.jsx(t,{...s,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function R0(e){const t=k.forwardRef((n,r)=>{const{children:o,...i}=n;if(k.isValidElement(o)){const s=D0(o),a=P0(i,o.props);return o.type!==k.Fragment&&(a.ref=r?Md(r,s):s),k.cloneElement(o,a)}return k.Children.count(o)>1?k.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var A0=Symbol("radix.slottable");function F0(e){return k.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===A0}function P0(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{const l=i(...a);return o(...a),l}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function D0(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var M0=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],xn=M0.reduce((e,t)=>{const n=Ls(`Primitive.${t}`),r=k.forwardRef((o,i)=>{const{asChild:s,...a}=o,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(l,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Mo="Checkbox",[k0,sO]=Do(Mo),[j0,Na]=k0(Mo);function L0(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:o,disabled:i,form:s,name:a,onCheckedChange:l,required:d,value:u="on",internal_do_not_use_render:f}=e,[m,g]=Sa({prop:n,defaultProp:o??!1,onChange:l,caller:Mo}),[v,y]=k.useState(null),[p,x]=k.useState(null),h=k.useRef(!1),w=v?!!s||!!v.closest("form"):!0,I={checked:m,disabled:i,setChecked:g,control:v,setControl:y,name:a,form:s,value:u,hasConsumerStoppedPropagationRef:h,required:d,defaultChecked:Hn(o)?!1:o,isFormControl:w,bubbleInput:p,setBubbleInput:x};return c.jsx(j0,{scope:t,...I,children:q0(f)?f(I):r})}var kd="CheckboxTrigger",jd=k.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},o)=>{const{control:i,value:s,disabled:a,checked:l,required:d,setControl:u,setChecked:f,hasConsumerStoppedPropagationRef:m,isFormControl:g,bubbleInput:v}=Na(kd,e),y=Jr(o,u),p=k.useRef(l);return k.useEffect(()=>{const x=i==null?void 0:i.form;if(x){const h=()=>f(p.current);return x.addEventListener("reset",h),()=>x.removeEventListener("reset",h)}},[i,f]),c.jsx(xn.button,{type:"button",role:"checkbox","aria-checked":Hn(l)?"mixed":l,"aria-required":d,"data-state":Ud(l),"data-disabled":a?"":void 0,disabled:a,value:s,...r,ref:y,onKeyDown:zt(t,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:zt(n,x=>{f(h=>Hn(h)?!0:!h),v&&g&&(m.current=x.isPropagationStopped(),m.current||x.stopPropagation())})})});jd.displayName=kd;var Ta=k.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:l,onCheckedChange:d,form:u,...f}=e;return c.jsx(L0,{__scopeCheckbox:n,checked:o,defaultChecked:i,disabled:a,required:s,onCheckedChange:d,name:r,form:u,value:l,internal_do_not_use_render:({isFormControl:m})=>c.jsxs(c.Fragment,{children:[c.jsx(jd,{...f,ref:t,__scopeCheckbox:n}),m&&c.jsx(Kd,{__scopeCheckbox:n})]})})});Ta.displayName=Mo;var Ld="CheckboxIndicator",Ra=k.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=Na(Ld,n);return c.jsx(Ea,{present:r||Hn(i.checked)||i.checked===!0,children:c.jsx(xn.span,{"data-state":Ud(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});Ra.displayName=Ld;var qd="CheckboxBubbleInput",Kd=k.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:o,checked:i,defaultChecked:s,required:a,disabled:l,name:d,value:u,form:f,bubbleInput:m,setBubbleInput:g}=Na(qd,e),v=Jr(n,g),y=_0(i),p=S0(r);k.useEffect(()=>{const h=m;if(!h)return;const w=window.HTMLInputElement.prototype,O=Object.getOwnPropertyDescriptor(w,"checked").set,S=!o.current;if(y!==i&&O){const T=new Event("click",{bubbles:S});h.indeterminate=Hn(i),O.call(h,Hn(i)?!1:i),h.dispatchEvent(T)}},[m,y,i,o]);const x=k.useRef(Hn(i)?!1:i);return c.jsx(xn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??x.current,required:a,disabled:l,name:d,value:u,form:f,...t,tabIndex:-1,ref:v,style:{...t.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Kd.displayName=qd;function q0(e){return typeof e=="function"}function Hn(e){return e==="indeterminate"}function Ud(e){return Hn(e)?"indeterminate":e?"checked":"unchecked"}function Vd(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}var K0=["color"],$d=b.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Vd(e,K0);return b.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),b.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"}))}),U0=["color"],V0=b.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Vd(e,U0);return b.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),b.createElement("path",{d:"M2 7.5C2 7.22386 2.22386 7 2.5 7H12.5C12.7761 7 13 7.22386 13 7.5C13 7.77614 12.7761 8 12.5 8H2.5C2.22386 8 2 7.77614 2 7.5Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});const $0="_checkboxGroupContainer_hqfeu_1",H0="_stack_hqfeu_6",B0="_selectAllContainer_hqfeu_10",J0="_fieldContainer_hqfeu_17",W0="_checkbox_hqfeu_1",Wr={checkboxGroupContainer:$0,stack:H0,selectAllContainer:B0,fieldContainer:J0,checkbox:W0};function z0({id:e,isChecked:t,label:n,onCheckedChange:r}){return c.jsxs("div",{className:Wr.fieldContainer,children:[c.jsx(Ta,{className:Wr.checkbox,id:e,onCheckedChange:r,checked:t,children:c.jsx(Ra,{children:c.jsx($d,{})})}),c.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function Q0({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:o}){return c.jsxs("div",{className:Wr.selectAllContainer,children:[c.jsx(Ta,{className:Wr.checkbox,id:e,onCheckedChange:r,checked:o?"indeterminate":t,children:c.jsxs(Ra,{children:[o&&c.jsx(V0,{}),t===!0&&c.jsx($d,{})]})}),c.jsx("label",{htmlFor:e,children:n})]})}function G0({children:e}){return c.jsx("div",{className:Wr.checkboxGroupContainer,children:e})}function X0({children:e}){return c.jsx("div",{className:Wr.stack,children:e})}const Y0="_paginationContainer_i9j9p_1",Z0="_pageInfo_i9j9p_7",Qc={paginationContainer:Y0,pageInfo:Z0};function Hd({items:e,onItemChange:t,onSelectAllChange:n,isAllChecked:r=!1,isIndeterminate:o=!1,itemsPerPage:i=8,showSelectAll:s=!0}){const[a,l]=b.useState(1),d=Math.ceil(e.length/i),u=(a-1)*i,f=u+i,m=e.slice(u,f);return c.jsxs(G0,{children:[d>1&&c.jsxs("div",{className:Qc.paginationContainer,children:[c.jsx($e,{type:"button",onClick:()=>l(g=>Math.max(1,g-1)),disabled:a===1,variant:"ghost",children:"<"}),c.jsxs("span",{className:Qc.pageInfo,children:[a," of ",d]}),c.jsx($e,{type:"button",onClick:()=>l(g=>Math.min(d,g+1)),disabled:a===d,variant:"ghost",children:">"})]}),s&&e.length>=2&&c.jsx(Q0,{id:"select-all-fields",isChecked:r,label:`Select all ${e.length} fields`,onCheckedChange:n,isIndeterminate:o}),c.jsx(X0,{children:m.map(g=>c.jsx(z0,{id:g.id,isChecked:g.isChecked,label:g.label,onCheckedChange:v=>t(g.id,v===!0)},g.id))})]})}function eC(e,t,n){var o,i;const r=((o=e==null?void 0:e.read)==null?void 0:o.selectedOptionalFields)||{};if(r[t]=n,n||delete r[t],(i=e.read)!=null&&i.savedConfig.optionalFields){const s=e.read.savedConfig.optionalFields,l=!fu(s,r);e.read.isOptionalFieldsModified=l}else console.warn("read.savedConfig.optionalFields is undefined")}function Gc(e,t,n,r){t(e,o=>eC(o,n,r))}function tC(){var m,g;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=Yt(),o=(m=t==null?void 0:t.read)==null?void 0:m.selectedOptionalFields,i=(g=t==null?void 0:t.read)==null?void 0:g.optionalFields,s=(v,y)=>{r&&t&&Gc(r,n,v,y)},a=v=>{r&&i&&i.forEach(y=>{bn(y)||Gc(r,n,y.fieldName,v)})},l=b.useMemo(()=>(i==null?void 0:i.filter(v=>!bn(v)&&"fieldName"in v&&"displayName"in v).map(v=>({id:v.fieldName,label:v.displayName,isChecked:!!(o!=null&&o[v.fieldName])})).sort((v,y)=>v.label.localeCompare(y.label)))||[],[i,o]),d=!!(i&&i.length>0),u=l.every(v=>(o==null?void 0:o[v.id])===!0),f=!u&&Object.keys(o||{}).length>0;return d&&c.jsxs(c.Fragment,{children:[c.jsx(Nt,{string:`${e} reads the following optional fields`}),c.jsx(Hd,{items:l,onItemChange:s,onSelectAllChange:a,isAllChecked:u,isIndeterminate:f,showSelectAll:l.length>=2},`${r}-${i==null?void 0:i.length}`)]})}function nC(){return c.jsx(tC,{})}const rC={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 iC({children:e,style:t,...n}){return c.jsx("span",{style:{...rC,...t},...n,children:e})}function oC(){var n,r,o;const{configureState:e}=Yt(),{appName:t}=Ee();return c.jsxs(c.Fragment,{children:[c.jsx(Nt,{string:`${t} reads the following fields`}),c.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:(r=(n=e==null?void 0:e.read)==null?void 0:n.requiredFields)!=null&&r.length?(o=e.read)==null?void 0:o.requiredFields.map(i=>bn(i)?null:c.jsx(iC,{children:i.displayName},i.fieldName)):"There are no required fields."})]})}function sC(e,t,n,r,o){e.read&&(e.read.selectedValueMappings||(e.read.selectedValueMappings={}),e.read.selectedValueMappings[o]||(e.read.selectedValueMappings[o]={}),r===""&&e.read.selectedValueMappings[o][n]?delete e.read.selectedValueMappings[o][n]:e.read.selectedValueMappings[o][n]=r)}function Bd(e,t,n,r,o){t(e,i=>sC(i,e,n,r,o))}function aC(e,t,n){t(e,r=>{r.read&&(r.read.isValueMappingsModified=n)})}function cC({string:e,fieldName:t}){return c.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[c.jsxs("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:[e,c.jsx("b",{children:t})]}),c.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:c.jsx(Oo,{style:{width:"100%",marginLeft:"1rem"}})})]})}function lC({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r,hasError:o}){var O;const{configureState:i,selectedObjectName:s,setConfigureState:a}=Yt(),[l,d]=b.useState(!0),{getError:u,setError:f,resetBoundary:m,isError:g,removeError:v}=Mt(),y=b.useMemo(()=>{var S,T;return((T=(S=i==null?void 0:i.read)==null?void 0:S.selectedValueMappings)==null?void 0:T[n])||{}},[(O=i==null?void 0:i.read)==null?void 0:O.selectedValueMappings,n]),p=b.useMemo(()=>y==null?void 0:y[e.mappedValue],[y,e.mappedValue]);b.useEffect(()=>{d(!1)},[e,a,s,p,i]);const x=b.useMemo(()=>r.map(S=>({id:S.value,label:S.displayValue,value:S.value})),[r]),h=b.useCallback(S=>{if(S){if(Object.values(y).some(T=>T===S.value&&T!==p)){const T=[...Object.entries(y).filter(([R,A])=>A===S.value&&A!==p).map(([R])=>R),e.mappedValue];f(ue.VALUE_MAPPING,n,T);return}u(ue.VALUE_MAPPING,n)&&m(ue.VALUE_MAPPING),t({target:{name:e.mappedValue,value:S.value,fieldName:n}})}},[t,y,p,n,e.mappedValue,m,f,u]),w=b.useMemo(()=>c.jsx(fd,{disabled:l,items:x,selectedValue:p||null,onSelectedItemChange:h,placeholder:"Please select one",style:{border:o?"2px solid red":void 0,borderRadius:"8px",width:"100%"}},p),[p,l,x,h,o]),I=b.useCallback(()=>{s&&(Bd(s,a,e.mappedValue,"",n),g(ue.VALUE_MAPPING,n)&&v(ue.VALUE_MAPPING,n))},[s,a,e.mappedValue,n,g,v]);return c.jsxs("div",{style:{display:"flex",flexDirection:"column",marginBottom:".25rem"},children:[c.jsx("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:c.jsx("span",{style:{fontWeight:500},children:e.mappedDisplayValue})}),c.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[w,c.jsx($e,{type:"button",variant:"ghost",onClick:I,children:"Clear"})]})]},e.mappedValue)}function uC(){var g,v,y;const{fieldMapping:e}=Ze(),{selectedObjectName:t,configureState:n,setConfigureState:r}=Yt(),{isError:o,removeError:i,getError:s}=Mt(),a=(g=n==null?void 0:n.read)==null?void 0:g.selectedFieldMappings,l=(v=n==null?void 0:n.read)==null?void 0:v.selectedValueMappings,d=(y=n==null?void 0:n.read)==null?void 0:y.isValueMappingsModified,u=b.useRef(!1),f=b.useMemo(()=>{const p=t&&e?Object.values(e[t]||{}).flat().filter(x=>x.mappedValues).map(x=>({...x})):[];if(a)for(let x=0;x<p.length;x+=1){const{mapToName:h}=p[x];a!=null&&a[h]&&(p[x].fieldName=a[h])}return p},[t,e,a]),m=b.useCallback(p=>{const{value:x,name:h,fieldName:w}=p.target;x&&(t&&Bd(t,r,h,x,w),o(ue.VALUE_MAPPING,h)&&i(ue.VALUE_MAPPING,h))},[t,r,o,i]);return b.useEffect(()=>{var p;if(t&&l){const x=((p=e==null?void 0:e[t])==null?void 0:p.filter(w=>w.fieldName&&w.mappedValues.length>0))||[];x.every(w=>{const I=l[w.fieldName]||{};return Object.keys(I).length===Object.keys(w.mappedValues).length})&&x.length>0?!d&&!u.current&&(aC(t,r,!0),u.current=!0):u.current=!1}},[l,f,t,r,e,d]),f!=null&&f.length?c.jsx(c.Fragment,{children:f.map(p=>{var S,T,R;if(!p.fieldName)return null;const x=(T=(S=n==null?void 0:n.read)==null?void 0:S.allFieldsMetadata)==null?void 0:T[p.fieldName],h=x==null?void 0:x.valueType;if(!["singleSelect","multiSelect"].includes(h))return console.error("fieldName is not a singleSelect or multiSelect",p),null;const w=x==null?void 0:x.values;if(!w)return null;const I=Object.keys(w).length,O=Object.keys((p==null?void 0:p.mappedValues)||[]).length;return I!==O?(console.error("field values and the values to be mapped are not of the same length",p,w),null):c.jsxs(c.Fragment,{children:[c.jsx(cC,{string:"Map the values for ",fieldName:p.mapToDisplayName||p.mapToName||p.fieldName}),c.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:c.jsx(Po,{id:p.mapToName||p.fieldName,children:(R=p==null?void 0:p.mappedValues)==null?void 0:R.map(A=>{var L,J,ae;const D=s(ue.VALUE_MAPPING,p.fieldName),B=Array.isArray(D)&&D.includes(A.mappedValue),$=((ae=(J=(L=n==null?void 0:n.read)==null?void 0:L.allFieldsMetadata)==null?void 0:J[p.fieldName])==null?void 0:ae.values)||[];return c.jsxs(c.Fragment,{children:[c.jsx(lC,{allValueOptions:$,mappedValue:A,onSelectChange:m,fieldName:(p==null?void 0:p.fieldName)||"",hasError:B},`${A.mappedValue}-${p.fieldName}`),B&&c.jsx("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:`Each ${p.mapToName||p.fieldName} must be mapped to a unique value`},A.mappedValue)]})})},p.mapToName||p.fieldName)})]})})}):null}function dC(){return y0(),c.jsxs(c.Fragment,{children:[c.jsx(b0,{}),c.jsx(oC,{}),c.jsx(m0,{}),c.jsx(h0,{}),c.jsx(uC,{}),c.jsx(nC,{})]})}function fC(e,t,n){var r,o,i;if(((r=e==null?void 0:e.write)==null?void 0:r.selectedWriteObjects)===null&&(e.write.selectedWriteObjects={}),e!=null&&e.write){const s=e.write.selectedWriteObjects;if(n&&(s[t]={objectName:t}),n||delete s[t],(i=(o=e==null?void 0:e.write)==null?void 0:o.savedConfig)!=null&&i.selectedWriteObjects){const a=e.write.savedConfig.selectedWriteObjects,d=!$v(a,s);e.write.isWriteModified=d}}}function Xc(e,t,n,r){t(e,o=>{fC(o,n,r)})}function pC(){var m,g,v,y;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=Yt(),o=(m=n==null?void 0:n.write)==null?void 0:m.selectedWriteObjects,i=(g=n==null?void 0:n.write)==null?void 0:g.writeObjects,s=(p,x)=>{t&&n&&Xc(t,r,p,x)},a=p=>{var x,h;t&&n&&((h=(x=n==null?void 0:n.write)==null?void 0:x.writeObjects)==null||h.forEach(w=>{Xc(t,r,w.objectName,p)}))},l=!!i,d=Object.keys(o||{}).length===((y=(v=n==null?void 0:n.write)==null?void 0:v.writeObjects)==null?void 0:y.length),u=!d&&Object.keys(o||{}).length>0,f=(i==null?void 0:i.map(p=>({id:p.objectName,label:p.displayName,isChecked:!!(o!=null&&o[p.objectName])})))||[];return l&&c.jsxs(c.Fragment,{children:[c.jsx(Nt,{string:`Allow ${e} to write to these objects`}),c.jsx(Hd,{items:f,onItemChange:s,onSelectAllChange:a,isAllChecked:d,isIndeterminate:u,showSelectAll:i.length>=2})]})}function hC(){return c.jsx(c.Fragment,{children:c.jsx(pC,{})})}function Jd({resetComponent:e,onDisconnectSuccess:t}){return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[c.jsx(Nt,{string:"Remove connection"}),c.jsx("p",{children:"Click to disconnect your connection from the provider."}),c.jsx(Su,{resetComponent:e,onDisconnectSuccess:t,buttonText:"Remove connection",buttonVariant:"danger",buttonStyle:{fontSize:"13px",width:"100%"}})]})}const mC="_authenticationRow_1g2ms_1",gC="_field_1g2ms_8",yC="_value_1g2ms_12",is={authenticationRow:mC,field:gC,value:yC};function Yc({label:e,value:t}){return c.jsxs("div",{className:is.authenticationRow,children:[c.jsx("div",{className:is.field,children:e}),c.jsx("div",{className:is.value,children:t})]})}function vC(){const{selectedConnection:e}=Xt(),{providerName:t}=lt(),r=(e==null?void 0:e.provider)==="salesforce"?"subdomain":"workspace",o=`${t} ${r}`;return c.jsxs(c.Fragment,{children:[c.jsx(Nt,{string:"Connection details"}),c.jsxs("div",{style:{paddingBottom:"1rem"},children:[c.jsx(Yc,{label:o,value:e==null?void 0:e.providerWorkspaceRef}),c.jsx(Yc,{label:"Status",value:on((e==null?void 0:e.status)||"")})]})]})}const wC=()=>{const e=ot(),t=qe();return In({mutationFn:async({projectIdOrName:n,integrationId:r,installationId:o})=>(await e()).installationApi.deleteInstallation({projectIdOrName:n,integrationId:r,installationId:o}),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]})},onError:n=>{console.error("Error uninstalling installation."),Me(n)}})};function Wd({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const{projectId:r}=Ee(),{integrationId:o,installation:i,setIntegrationDeleted:s,onUninstallSuccess:a}=Ze(),[l,d]=b.useState(!1),u=!r||!o||!(i!=null&&i.id)||l,f=wC(),m=async()=>{u||(d(!0),console.warn("uninstalling installation",{projectId:r,integrationId:o,installationId:i.id}),f.mutate({projectIdOrName:r,integrationId:o,installationId:i.id},{onSuccess:()=>{console.warn("successfully uninstalled installation:",i.id),a==null||a(i==null?void 0:i.id),s()},onSettled:()=>d(!1)}))},g=l?"Uninstalling...":e,v=c.jsx($e,{type:"button",onClick:m,disabled:u,variant:t,style:n,children:g});return i!=null&&i.id?v:null}function bC(){const{installation:e}=Ze(),{providerName:t}=lt();return e?c.jsxs(c.Fragment,{children:[c.jsx(Nt,{string:"Uninstall entire integration"}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",padding:"1rem 0"},children:[e!=null&&e.id?c.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:["By clicking below, you will uninstall the entire ",t," ","integration. You will lose any configuration you've set up."]}):c.jsx("p",{children:"You've successfully uninstalled the integration."}),c.jsx(Wd,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})]}):null}function IC(){const{installation:e,resetComponent:t}=Ze();return c.jsxs(c.Fragment,{children:[c.jsx(vC,{}),c.jsx(Ys,{}),e&&c.jsx(bC,{}),!e&&c.jsx(Jd,{resetComponent:t})]})}function zd({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:o}){var S,T,R,A;const{installation:i}=Ze(),{hydratedRevision:s,loading:a}=Yr(),{configureState:l,selectedObjectName:d}=Yt(),u=i==null?void 0:i.config,f=u&&d&&!!cu(u,d)||!1,m=((S=l==null?void 0:l.read)==null?void 0:S.isOptionalFieldsModified)||((T=l==null?void 0:l.read)==null?void 0:T.isRequiredMapFieldsModified)||((R=l==null?void 0:l.read)==null?void 0:R.isValueMappingsModified),g=(A=l==null?void 0:l.write)==null?void 0:A.isWriteModified,x=a||n||!l||!d||!(m||g||r||d!==mr&&!f),h=d===mr,w=d===so,I=c.jsx($e,{type:"submit",disabled:x,children:r?"Install":"Save"}),O=c.jsx($e,{type:"button",onClick:t,disabled:x,variant:"ghost",children:"Reset"});return n?c.jsx(di,{}):c.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[c.jsx("div",{style:{display:"flex",flexDirection:"row-reverse",gap:".8rem",marginBottom:"20px",height:"3rem"},children:!w&&c.jsxs(c.Fragment,{children:[I,O]})}),c.jsxs(Cn,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[o&&c.jsx(Ci,{children:typeof o=="string"?o:"Installation Failed."}),a&&c.jsx(di,{}),s&&!h&&!w&&c.jsx(dC,{}),s&&h&&!w&&c.jsx(hC,{}),!a&&w&&c.jsx(IC,{})]})]})}const Qd=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:o,onUpdateSuccess:i}=Ze(),{hydratedRevision:s,loading:a}=Yr(),{selectedObjectName:l}=_d(),{selectedConnection:d}=Xt(),u=Sl(),{projectId:f}=Ee(),{resetBoundary:m,setErrors:g,setError:v,getError:y}=Mt(),{resetConfigureState:p,objectConfigurationsState:x,resetPendingConfigurationState:h}=Oa(),w=vu(l||"",x),{onNextIncompleteTab:I}=HI(),O=b.useCallback(()=>{m(ue.INSTALLATION_MUTATION)},[m]),S=b.useCallback(R=>R?A=>{v(ue.INSTALLATION_MUTATION,R,A)}:A=>{console.error("objectName is required to set installation error: ",A)},[v]),T=b.useCallback(R=>R?y(ue.INSTALLATION_MUTATION,R):"",[y]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:s,loading:a,selectedObjectName:l,selectedConnection:d,apiKey:u,projectId:f,resetBoundary:m,setErrors:g,setMutateInstallationError:S,getMutateInstallationError:T,resetMutateInstallationErrorState:O,resetConfigureState:p,objectConfigurationsState:x,resetPendingConfigurationState:h,configureState:w,onInstallSuccess:o,onUpdateSuccess:i,onNextIncompleteTab:I}},CC=void 0;function xC(){const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:o,loading:i,selectedObjectName:s,selectedConnection:a,apiKey:l,projectId:d,resetBoundary:u,setErrors:f,setMutateInstallationError:m,getMutateInstallationError:g,resetMutateInstallationErrorState:v,resetConfigureState:y,objectConfigurationsState:p,resetPendingConfigurationState:x,configureState:h,onInstallSuccess:w,onNextIncompleteTab:I}=Qd(),[O,S]=b.useState(!1),T=s===mr,R=g(s),A=b.useCallback(()=>{u(ue.MAPPING),o!=null&&o.content&&!i&&s&&hu(o,CC,s,y)},[u,o,i,s,y]);b.useEffect(()=>{!h&&(o!=null&&o.content)&&!i&&A()},[h,p,o,i,A]);const D=()=>{v();const{requiredMapFields:L,selectedFieldMappings:J}=(h==null?void 0:h.read)||{},{errorList:ae}=du(L,J,f);ae.length>0||(s&&(a!=null&&a.id)&&l&&d&&e&&t&&n&&o?(S(!0),Qv(d,e,t,n,a.id,s,l,o,h,m(s),r,w).finally(()=>{S(!1),x(s),I()})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},B=()=>{v(),s&&(a!=null&&a.id)&&l&&d&&e&&t&&n&&o?(S(!0),Yv(d,e,t,n,a.id,l,o,h,m(s),r,w).finally(()=>{S(!1),x(s),I()})):console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},$=L=>{L.preventDefault(),T?B():D()};return c.jsx(zd,{errorMsg:R,isCreateMode:!0,isLoading:O,onSave:$,onReset:A})}function OC({updateConfig:e,projectId:t,integrationId:n,installationId:r,apiKey:o,selectedObjectName:i,setInstallation:s,onUpdateSuccess:a,setError:l}){const d={projectIdOrName:t,installationId:r,integrationId:n,installationUpdate:{updateMask:[`config.content.read.objects.${Av(i)}`],installation:{config:e}}};return Bs().installationApi.updateInstallation(d,{headers:{"X-Api-Key":o,"Content-Type":"application/json"}}).then(u=>{s(u),a==null||a(u.id,u.config)}).catch(u=>{Me(u,l)})}const _C=(e,t,n,r,o,i)=>{const s=mu(e),a=gu(e),l=yu(e),d={content:{read:{objects:{[t]:{objectName:t,schedule:r,destination:(n==null?void 0:n.destination)||"",selectedFields:s,selectedFieldMappings:a,selectedValueMappings:l||{},backfill:i}}}}};return Ii(o)&&(d.content||(d.content={}),d.content.proxy={enabled:!0}),d},SC=(e,t,n,r,o,i,s,a,l,d,u)=>{const f=_C(i,r||"",a,a.schedule,l,a.backfill);return f?OC({updateConfig:f,projectId:e,integrationId:t,installationId:n,apiKey:o,selectedObjectName:r,setError:d,setInstallation:s,onUpdateSuccess:u}):(console.error("Error when generating updateConfig from configureState"),Promise.resolve(null))},EC=(e,t)=>{const r={content:{write:{objects:bu(e)}}};return Ii(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r},NC=(e,t,n,r,o,i,s,a,l)=>{const d=EC(o,i);if(!d)return console.error("Error when generating write updateConfig from configureState"),Promise.resolve(null);const u={projectIdOrName:e,installationId:n,integrationId:t,installationUpdate:{updateMask:["config.content.write.objects"],installation:{config:d}}};return Bs().installationApi.updateInstallation(u,{headers:{"X-Api-Key":r,"Content-Type":"application/json"}}).then(f=>{a(f),l==null||l(f.id,f.config)}).catch(f=>{Me(f,s)})};function TC({installation:e,integrationObj:t}){const{setInstallation:n,hydratedRevision:r,loading:o,selectedObjectName:i,apiKey:s,projectId:a,resetBoundary:l,setErrors:d,setMutateInstallationError:u,getMutateInstallationError:f,resetConfigureState:m,resetPendingConfigurationState:g,configureState:v,onUpdateSuccess:y,onNextIncompleteTab:p}=Qd(),[x,h]=b.useState(!1),w=i===mr,I=f(i),{config:O}=e,S=b.useCallback(()=>{l(ue.MAPPING),r!=null&&r.content&&!o&&i&&hu(r,O,i,m)},[l,r,o,i,O,m]);b.useEffect(()=>{v||S()},[v,S]);const T=b.useMemo(()=>{var $,L,J;return(J=(L=($=r==null?void 0:r.content)==null?void 0:$.read)==null?void 0:L.objects)==null?void 0:J.find(ae=>(ae==null?void 0:ae.objectName)===i)},[r,i]),R=()=>{const{requiredMapFields:B,selectedFieldMappings:$}=(v==null?void 0:v.read)||{},{errorList:L}=du(B,$,d);L.length>0||(r&&e&&i&&s&&a&&T?(h(!0),SC(a,t.id,e.id,i,s,v,n,T,r,u(i),y).finally(()=>{h(!1),g(i),p()})):console.error("UpdateInstallation - onSaveUpdate missing required props"))},A=()=>{e&&i&&s&&a&&r?(h(!0),NC(a,t.id,e.id,s,v,r,u(i),n,y).finally(()=>{h(!1),g(i),p()})):console.error("UpdateInstallation - onSaveUpdate missing required props")},D=B=>{B.preventDefault(),w?A():R()};return c.jsx(zd,{errorMsg:I,onSave:D,onReset:S,isLoading:x})}function RC(){const{integrationObj:e,installation:t}=Ze();return e?t&&e?c.jsx(TC,{installation:t,integrationObj:e}):c.jsx(xC,{}):c.jsx(tu,{message:"We can't load the integration"})}const Gd=()=>{const e=ot(),t=qe(),[n,r]=b.useState(null);return{...In({mutationKey:["createInstallation"],mutationFn:async i=>(await e()).installationApi.createInstallation(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:i=>{console.error("Error creating installation"),Me(i,r)}}),errorMsg:n}};function AC(){return c.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),c.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Aa({text:e,children:t}){return c.jsx(Gr,{children:c.jsxs(Cn,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[c.jsx(AC,{}),c.jsx("p",{children:e}),t]})})}function FC({provider:e}){const{providerName:t}=lt(e),n=`You have successfully installed your ${t} integration.`;return c.jsx(Aa,{text:n,children:c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:c.jsx(Wd,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const PC=e=>{const{read:t,write:n}=(e==null?void 0:e.content)??{};return!t&&!n};function DC({children:e}){var O;const t=b.useRef(!1),{projectId:n}=Ee(),{hydratedRevision:r,loading:o}=Yr(),{integrationObj:i,installation:s,groupRef:a,consumerRef:l,onInstallSuccess:d,isIntegrationDeleted:u}=Ze(),{mutate:f,isIdle:m,isPending:g,error:v,errorMsg:y}=Gd(),{selectedConnection:p,isConnectionsLoading:x}=Xt(),h=o||g||x,w=(O=r==null?void 0:r.content)==null?void 0:O.provider,I=PC(r);return b.useEffect(()=>{var S;if(!h&&!x&&r&&I&&!s&&p&&(i!=null&&i.id)&&!u&&w){const T={projectIdOrName:n,integrationId:i==null?void 0:i.id,installation:{groupRef:a,connectionId:p==null?void 0:p.id,config:{content:{provider:w}}}};Ii(r)===!0&&(T.installation.config.content.proxy=(S=r==null?void 0:r.content)==null?void 0:S.proxy),m&&!t.current&&(f(T,{onSuccess:R=>{d==null||d(R==null?void 0:R.id,R.config)}}),t.current=!0)}},[r,I,s,p,n,i==null?void 0:i.id,a,l,h,d,u,x,w,f,m]),I&&w&&s?c.jsx(FC,{provider:w}):v?c.jsx(Wt,{message:y??"Create installation failed"}):i?h?c.jsx(Xr,{}):c.jsx("div",{children:e}):c.jsx(Wt,{message:"We can't load the integration"})}function Si(){const e=ot(),t=qe();return In({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"),Me(n)}})}function MC({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:l}=Ee(),d=Si(),u=b.useCallback(f=>{var y;const{apiKey:m,providerMetadata:g}=f,v={projectIdOrName:l,generateConnectionParams:{providerWorkspaceRef:(y=g==null?void 0:g.workspace)==null?void 0:y.value,groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,apiKey:m,...g&&{providerMetadata:g}}};d.mutate(v)},[l,i,o,r,n,e,d]);return a===null?c.jsx(Iw,{provider:e,providerInfo:t,handleSubmit:u,error:null}):s}function kC({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:l}=Ee(),d=Si(),u=b.useCallback(f=>{var p;const{user:m,pass:g,providerMetadata:v}=f,y={projectIdOrName:l,generateConnectionParams:{providerWorkspaceRef:(p=v==null?void 0:v.workspace)==null?void 0:p.value,groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:m,password:g},...v&&{providerMetadata:v}}};d.mutate(y)},[l,i,o,r,n,e,d]);return a===null?c.jsx(Sw,{provider:e,providerInfo:t,handleSubmit:u,error:null}):s}function Zc({url:e,prompt:t,inputName:n}){return c.jsx("p",{style:{color:"var(--amp-colors-text-muted)",display:"flex",justifyContent:"space-between"},children:c.jsxs("span",{children:[e?c.jsx(Gs,{href:e,newTab:!0,children:c.jsx("span",{style:{textDecoration:"underline"},children:n})}):c.jsx("span",{children:n})," ",t&&c.jsx(xd,{id:`docs-helper-text-${Fv(n||(t==null?void 0:t.slice(0,50)))}`,tooltipText:t})]})})}function jC({providerInfo:e,handleSubmit:t,isButtonDisabled:n,buttonVariant:r}){var m,g;const[o,i]=b.useState({}),s=((m=e.metadata)==null?void 0:m.input)||[],a=v=>{const{name:y,value:p}=v.currentTarget;i(x=>({...x,[y]:p.trim()}))},l=Lr(s,o),d=n||!l,u=((g=e.customOpts)==null?void 0:g.inputs)||[],f=()=>{const v=Co(s,o),y=Object.fromEntries(u.map(p=>[p.name,o[p.name]]));t({customAuth:y,providerMetadata:v})};return c.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[u.map(v=>c.jsxs("div",{children:[c.jsx(Zc,{url:v.docsURL,prompt:v.prompt,inputName:v.displayName}),c.jsx(bt.PasswordInput,{id:v.name,name:v.name,onChange:a,placeholder:""})]},v.name)),s.map(v=>c.jsxs("div",{children:[v.docsURL&&c.jsx(Zc,{url:v.docsURL,prompt:v.displayName||v.name,inputName:v.displayName||on(v.name.toLowerCase())}),c.jsx(bt.Input,{id:v.name,name:v.name,type:"text",placeholder:"",onChange:a})]},v.name)),c.jsx($e,{style:{marginTop:"1em",width:"100%"},disabled:d,type:"submit",onClick:f,variant:r,children:"Next"})]})}function LC({providerInfo:e,handleSubmit:t,error:n,isButtonDisabled:r}){return c.jsxs(zn,{children:[c.jsx(Qn,{children:`Set up ${e.displayName} integration`}),c.jsx(an,{error:n}),c.jsx(jC,{providerInfo:e,handleSubmit:t,isButtonDisabled:r})]})}function qC({providerInfo:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s}){const{projectIdOrName:a}=Ee(),l=Si(),[d,u]=b.useState(null),f=b.useCallback(m=>{var p;const{customAuth:g,providerMetadata:v}=m;u(null);const y={projectIdOrName:a,generateConnectionParams:{providerWorkspaceRef:(p=v==null?void 0:v.workspace)==null?void 0:p.value,groupName:o,groupRef:r,consumerName:n,consumerRef:t,provider:e.name,customAuth:g,...v&&{providerMetadata:v}}};l.mutate(y,{onError:x=>{Me(x,u)},onSuccess:()=>{u(null)}})},[a,o,r,n,t,e.name,l]);return s===null?c.jsx(LC,{providerInfo:e,handleSubmit:f,error:d}):i}function KC({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,children:o,title:i}){if(!i&&!r)throw new Error("Either title or providerName is required");return c.jsxs(zn,{children:[c.jsx(Qn,{children:i||`Set up ${r} integration`}),c.jsx(an,{error:t}),o,c.jsx($e,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function UC({...e}){return c.jsx(KC,{...e})}function VC({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s,providerName:a}){const{projectIdOrName:l}=Ee(),d=Si(),u=b.useCallback(()=>{const f={projectIdOrName:l,generateConnectionParams:{groupName:o,groupRef:r,consumerName:n,consumerRef:t,provider:e}};d.mutate(f)},[l,o,r,n,t,e,d]);return s===null?c.jsx(UC,{handleSubmit:u,error:null,providerName:a}):i}const $C=()=>{const e=ot(),t=qe();return In({mutationKey:["createOauthConnection"],mutationFn:async n=>(await e()).oAuthApi.oauthConnect(n),onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})};function HC({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return c.jsxs(zn,{children:[c.jsx(Qn,{children:`Set up ${r} integration`}),c.jsx(yw,{children:`Click Next to sign into the ${r} account you'd like to sync.`}),c.jsx(an,{error:t}),c.jsx($e,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:n?"Loading...":"Next"})]})}const BC="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function JC({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return c.jsxs(zn,{children:[c.jsx(Qn,{children:"Enter your Salesforce subdomain"}),c.jsx(Gs,{href:BC,newTab:!0,children:"What is my Salesforce subdomain?"}),c.jsx(an,{error:n}),c.jsxs("div",{style:{display:"flex",marginTop:"1em",alignItems:"center"},children:[c.jsx(bt.Input,{id:"salesforce-subdomain",type:"text",placeholder:"my-domain",onChange:o=>t(o.currentTarget.value)}),c.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),c.jsx($e,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function WC({handleSubmit:e,setFormData:t,error:n,isButtonDisabled:r,providerName:o,metadataFields:i}){return c.jsxs(zn,{children:[c.jsxs(Qn,{children:["Enter your ",o," workspace"]}),c.jsx(an,{error:n}),c.jsx("br",{}),i.map(s=>c.jsx(bt.Input,{id:s.name,name:s.name,type:"text",placeholder:s.displayName||s.name,onChange:a=>t(s.name,a.currentTarget.value)},s.name)),c.jsx("br",{}),c.jsx($e,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const el=600,tl=600,nl="salesforce";function zC({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){var B;const{projectId:s}=Ee(),a=qe(),l=b.useRef(null),[d,u]=b.useState(null),[f,m]=b.useState(""),[g,v]=b.useState({}),[y,p]=b.useState({}),{data:x}=Io(e),h=((B=x==null?void 0:x.metadata)==null?void 0:B.input)||[],{mutateAsync:w,isPending:I}=$C(),{isFetching:O,refetch:S}=Ws({groupRef:r,provider:e});b.useEffect(()=>{const $=L=>{var J,ae,re;L.origin===zl&&(((J=L.data)==null?void 0:J.eventType)==="AUTHORIZATION_SUCCEEDED"?(u(null),console.debug("New connection:",L.data.data.connection),a.invalidateQueries({queryKey:["amp","connections"]})):((ae=L.data)==null?void 0:ae.eventType)==="AUTHORIZATION_FAILED"&&(console.error("OAuth failed:",L.data.data.error),a.invalidateQueries({queryKey:["amp","connections"]}),u(L.data.data.error||"An error occurred. Please try again.")),(re=l.current)==null||re.close())};return window.addEventListener("message",$),()=>window.removeEventListener("message",$)},[a]);const T=$=>{m($),v(L=>({...L,workspace:$})),p(L=>({...L,workspace:{value:$,source:"input"}}))},R=($,L)=>{v(J=>({...J,[$]:L})),p(J=>({...J,[$]:{value:L,source:"input"}}))},A=async()=>{var $;u(null);try{const{data:L}=await S();if(L&&L.length>0){console.debug("connections found");return}}catch{console.debug("error with fetching connections")}if(h.length>0&&!Lr(h,g)){u("Please fill in all required fields");return}try{const L=await w({connectOAuthParams:{provider:e,consumerRef:t,groupRef:r,projectId:s,consumerName:n,groupName:o,providerWorkspaceRef:e===nl?f:($=y==null?void 0:y.workspace)==null?void 0:$.value,providerMetadata:y}});if(L){const J=window.screenX+(window.outerWidth-el)/2,ae=window.screenY+(window.outerHeight-tl)/2.5,re=`width=${el},height=${tl},left=${J},top=${ae}`;l.current=window.open(L,"OAuthPopup",re)}}catch(L){console.error(L),u(L instanceof Error?L.message:String(L)||"An error occurred. Please try again.")}},D=e===nl?c.jsx(JC,{handleSubmit:A,setWorkspace:T,error:d,isButtonDisabled:f.length===0||I||O}):h.length>0?c.jsx(WC,{handleSubmit:A,setFormData:R,error:d,isButtonDisabled:!Lr(h,g)||I||O,providerName:i,metadataFields:h}):c.jsx(HC,{handleSubmit:A,error:d,providerName:i,isButtonDisabled:I||O});return c.jsx("div",{children:D})}function QC({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,explicitScopesRequired:s,selectedConnection:a}){const{projectIdOrName:l}=Ee(),d=Si(),[u,f]=b.useState(null),m=b.useCallback(g=>{var y,p;f(null);const v={projectIdOrName:l,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:(p=(y=g.providerMetadata)==null?void 0:y.workspace)==null?void 0:p.value,oauth2ClientCredentials:{clientId:g.clientId,clientSecret:g.clientSecret,scopes:g.scopes},...g.providerMetadata&&{providerMetadata:g.providerMetadata}}};d.mutate(v,{onError:()=>f("Error loading provider info")})},[l,i,o,r,n,e,d]);return a===null?c.jsx(Nw,{provider:e,providerName:t,handleSubmit:m,error:u,explicitScopesRequired:s}):c.jsx(di,{})}function GC({...e}){return c.jsx(QC,{...e})}const XC="authorizationCode",YC="authorizationCodePKCE",ZC="clientCredentials";function ex({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,selectedConnection:s,setSelectedConnection:a}){const{providerName:l}=lt(e);if(t.oauth2Opts===void 0)return c.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:d,explicitScopesRequired:u}=t.oauth2Opts,f={provider:e,consumerRef:n,consumerName:r,groupRef:o,groupName:i,providerName:l};return d===XC||d===YC?c.jsx(zC,{...f}):d===ZC?c.jsx(GC,{...f,explicitScopesRequired:u,selectedConnection:s,setSelectedConnection:a}):d==="password"?c.jsx("em",{children:"Password flow not supported yet"}):c.jsxs("em",{children:["Unsupported grant type: ",d]})}function tx(e){const{selectedConnection:t}=Xt();b.useEffect(()=>{e&&t&&e(t)},[e,t])}function nx({onSuccess:e}){tx(e)}function Xd({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,onSuccess:s,onDisconnectSuccess:a,resetComponent:l}){const{data:d,isLoading:u,isError:f,error:m,providerName:g,selectedProvider:v}=lt(e),{provider:y,isIntegrationDeleted:p}=Ze(),{selectedConnection:x,setSelectedConnection:h}=Xt();nx({onSuccess:s});const w=qe(),I=d;b.useEffect(()=>{f&&(console.error("Error loading provider info."),Me(m))},[f,m]);const O=b.useCallback(()=>{w.clear(),l()},[l,w]);if(!e&&!y)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(p)return c.jsx(Aa,{text:"Integration successfully uninstalled.",children:c.jsx($e,{type:"button",onClick:O,style:{width:"100%"},children:"Reinstall Integration"})});if(x)return i;if(u)return c.jsx(Xr,{});if(I==null)return c.jsx(Wt,{message:"Provider info was not found."});const S={provider:v,consumerRef:t,consumerName:n,groupRef:r,groupName:o,selectedConnection:x,setSelectedConnection:h,providerName:g,providerInfo:I,onDisconnectSuccess:a};return I.authType==="none"?c.jsx(VC,{...S,children:i}):I.authType==="basic"?c.jsx(kC,{...S,children:i}):I.authType==="apiKey"?c.jsx(MC,{...S,children:i}):I.authType==="custom"?c.jsx(qC,{...S,children:i}):c.jsx(ex,{...S})}function rx(e){const t=e+"CollectionProvider",[n,r]=Do(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=y=>{const{scope:p,children:x}=y,h=b.useRef(null),w=b.useRef(new Map).current;return c.jsx(o,{scope:p,itemMap:w,collectionRef:h,children:x})};s.displayName=t;const a=e+"CollectionSlot",l=Ls(a),d=b.forwardRef((y,p)=>{const{scope:x,children:h}=y,w=i(a,x),I=Jr(p,w.collectionRef);return c.jsx(l,{ref:I,children:h})});d.displayName=a;const u=e+"CollectionItemSlot",f="data-radix-collection-item",m=Ls(u),g=b.forwardRef((y,p)=>{const{scope:x,children:h,...w}=y,I=b.useRef(null),O=Jr(p,I),S=i(u,x);return b.useEffect(()=>(S.itemMap.set(I,{ref:I,...w}),()=>void S.itemMap.delete(I))),c.jsx(m,{[f]:"",ref:O,children:h})});g.displayName=u;function v(y){const p=i(e+"CollectionConsumer",y);return b.useCallback(()=>{const h=p.collectionRef.current;if(!h)return[];const w=Array.from(h.querySelectorAll(`[${f}]`));return Array.from(p.itemMap.values()).sort((S,T)=>w.indexOf(S.ref.current)-w.indexOf(T.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:s,Slot:d,ItemSlot:g},v,r]}var ix=k[" useId ".trim().toString()]||(()=>{}),ox=0;function Yd(e){const[t,n]=k.useState(ix());return gi(()=>{e||n(r=>r??String(ox++))},[e]),e||(t?`radix-${t}`:"")}function sx(e){const t=k.useRef(e);return k.useEffect(()=>{t.current=e}),k.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}var ax=k.createContext(void 0);function Zd(e){const t=k.useContext(ax);return e||t||"ltr"}var os="rovingFocusGroup.onEntryFocus",cx={bubbles:!1,cancelable:!0},Ei="RovingFocusGroup",[qs,ef,lx]=rx(Ei),[ux,tf]=Do(Ei,[lx]),[dx,fx]=ux(Ei),nf=k.forwardRef((e,t)=>c.jsx(qs.Provider,{scope:e.__scopeRovingFocusGroup,children:c.jsx(qs.Slot,{scope:e.__scopeRovingFocusGroup,children:c.jsx(px,{...e,ref:t})})}));nf.displayName=Ei;var px=k.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:d,preventScrollOnEntryFocus:u=!1,...f}=e,m=k.useRef(null),g=Jr(t,m),v=Zd(i),[y,p]=Sa({prop:s,defaultProp:a??null,onChange:l,caller:Ei}),[x,h]=k.useState(!1),w=sx(d),I=ef(n),O=k.useRef(!1),[S,T]=k.useState(0);return k.useEffect(()=>{const R=m.current;if(R)return R.addEventListener(os,w),()=>R.removeEventListener(os,w)},[w]),c.jsx(dx,{scope:n,orientation:r,dir:v,loop:o,currentTabStopId:y,onItemFocus:k.useCallback(R=>p(R),[p]),onItemShiftTab:k.useCallback(()=>h(!0),[]),onFocusableItemAdd:k.useCallback(()=>T(R=>R+1),[]),onFocusableItemRemove:k.useCallback(()=>T(R=>R-1),[]),children:c.jsx(xn.div,{tabIndex:x||S===0?-1:0,"data-orientation":r,...f,ref:g,style:{outline:"none",...e.style},onMouseDown:zt(e.onMouseDown,()=>{O.current=!0}),onFocus:zt(e.onFocus,R=>{const A=!O.current;if(R.target===R.currentTarget&&A&&!x){const D=new CustomEvent(os,cx);if(R.currentTarget.dispatchEvent(D),!D.defaultPrevented){const B=I().filter(re=>re.focusable),$=B.find(re=>re.active),L=B.find(re=>re.id===y),ae=[$,L,...B].filter(Boolean).map(re=>re.ref.current);sf(ae,u)}}O.current=!1}),onBlur:zt(e.onBlur,()=>h(!1))})})}),rf="RovingFocusGroupItem",of=k.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:s,...a}=e,l=Yd(),d=i||l,u=fx(rf,n),f=u.currentTabStopId===d,m=ef(n),{onFocusableItemAdd:g,onFocusableItemRemove:v,currentTabStopId:y}=u;return k.useEffect(()=>{if(r)return g(),()=>v()},[r,g,v]),c.jsx(qs.ItemSlot,{scope:n,id:d,focusable:r,active:o,children:c.jsx(xn.span,{tabIndex:f?0:-1,"data-orientation":u.orientation,...a,ref:t,onMouseDown:zt(e.onMouseDown,p=>{r?u.onItemFocus(d):p.preventDefault()}),onFocus:zt(e.onFocus,()=>u.onItemFocus(d)),onKeyDown:zt(e.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){u.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const x=gx(p,u.orientation,u.dir);if(x!==void 0){if(p.metaKey||p.ctrlKey||p.altKey||p.shiftKey)return;p.preventDefault();let w=m().filter(I=>I.focusable).map(I=>I.ref.current);if(x==="last")w.reverse();else if(x==="prev"||x==="next"){x==="prev"&&w.reverse();const I=w.indexOf(p.currentTarget);w=u.loop?yx(w,I+1):w.slice(I+1)}setTimeout(()=>sf(w))}}),children:typeof s=="function"?s({isCurrentTabStop:f,hasTabStop:y!=null}):s})})});of.displayName=rf;var hx={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function mx(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function gx(e,t,n){const r=mx(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return hx[r]}function sf(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function yx(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var vx=nf,wx=of,ko="Tabs",[bx,aO]=Do(ko,[tf]),af=tf(),[Ix,Fa]=bx(ko),cf=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:l="automatic",...d}=e,u=Zd(a),[f,m]=Sa({prop:r,onChange:o,defaultProp:i??"",caller:ko});return c.jsx(Ix,{scope:n,baseId:Yd(),value:f,onValueChange:m,orientation:s,dir:u,activationMode:l,children:c.jsx(xn.div,{dir:u,"data-orientation":s,...d,ref:t})})});cf.displayName=ko;var lf="TabsList",uf=k.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=Fa(lf,n),s=af(n);return c.jsx(vx,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:c.jsx(xn.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});uf.displayName=lf;var df="TabsTrigger",ff=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=Fa(df,n),a=af(n),l=hf(s.baseId,r),d=mf(s.baseId,r),u=r===s.value;return c.jsx(wx,{asChild:!0,...a,focusable:!o,active:u,children:c.jsx(xn.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":d,"data-state":u?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:l,...i,ref:t,onMouseDown:zt(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:zt(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:zt(e.onFocus,()=>{const f=s.activationMode!=="manual";!u&&!o&&f&&s.onValueChange(r)})})})});ff.displayName=df;var pf="TabsContent",Cx=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=Fa(pf,n),l=hf(a.baseId,r),d=mf(a.baseId,r),u=r===a.value,f=k.useRef(u);return k.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),c.jsx(Ea,{present:o||u,children:({present:m})=>c.jsx(xn.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!m,id:d,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:m&&i})})});Cx.displayName=pf;function hf(e,t){return`${e}-trigger-${t}`}function mf(e,t){return`${e}-content-${t}`}var xx=cf,Ox=uf,gf=ff;const _x=c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[c.jsx("circle",{cx:"9",cy:"9",r:"9",fill:"#BBF7D0"}),c.jsx("path",{d:"M13 7L7.5 12L5 9.72727",stroke:"#16A34A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function Sx(e,t){return t?b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},b.createElement("circle",{cx:"9",cy:"9",r:"5",fill:"#FBD38D"})):e?_x:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:c.jsx("circle",{cx:"9",cy:"9",r:"5",fill:"#BFDBFE"})})}function Ex(){return c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("path",{d:"M8 11C9.65685 11 11 9.65685 11 8C11 6.34315 9.65685 5 8 5C6.34315 5 5 6.34315 5 8C5 9.65685 6.34315 11 8 11Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M12.3378 5.04365C12.4882 5.25907 12.62 5.48699 12.7315 5.7249L14.3503 6.6249C14.5524 7.5302 14.5545 8.4687 14.3565 9.3749L12.7315 10.2749C12.62 10.5128 12.4882 10.7407 12.3378 10.9562L12.369 12.8124C11.683 13.4375 10.871 13.9085 9.98776 14.1937L8.39401 13.2374C8.13185 13.2562 7.86868 13.2562 7.60651 13.2374L6.01901 14.1874C5.13295 13.9075 4.31832 13.4383 3.63151 12.8124L3.66276 10.9624C3.51356 10.744 3.38189 10.5141 3.26901 10.2749L1.65026 9.3749C1.44814 8.46961 1.446 7.53111 1.64401 6.6249L3.26901 5.7249C3.38056 5.48699 3.5123 5.25907 3.66276 5.04365L3.63151 3.1874C4.31754 2.56226 5.1295 2.09128 6.01276 1.80615L7.60651 2.7624C7.86868 2.74365 8.13185 2.74365 8.39401 2.7624L9.98151 1.8124C10.8676 2.09234 11.6822 2.5615 12.369 3.1874L12.3378 5.04365Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const Nx="_tabsRoot_ktpr0_1",Tx="_tabsList_ktpr0_6",Rx="_tabTrigger_ktpr0_12",Ax="_danger_ktpr0_29",wo={tabsRoot:Nx,tabsList:Tx,tabTrigger:Rx,danger:Ax};function Fx(){return c.jsxs(c.Fragment,{children:[c.jsx(Oo,{style:{margin:"1rem 0"}}),c.jsx(gf,{value:so,className:wo.tabTrigger,children:c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[c.jsx(Ex,{}),c.jsx("span",{children:"Manage"})]})})]})}function yf({objectName:e,completed:t,pending:n,displayName:r}){return c.jsx(gf,{value:e,className:wo.tabTrigger,children:c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[Sx(t,n),c.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[c.jsx("span",{children:r||e}),n&&c.jsx("span",{style:{fontSize:".8rem",fontStyle:"italic"},children:"pending"})]})]})})}function Px({completed:e,pending:t,displayName:n}){return c.jsxs(c.Fragment,{children:[c.jsx(Oo,{style:{margin:"1rem 0"}}),c.jsx(yf,{objectName:mr,completed:e,pending:t,displayName:n},"other-write")]})}function Dx({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:o}){var i,s;return c.jsx(xx,{value:e,className:wo.tabsRoot,onValueChange:n,children:c.jsxs(Ox,{className:wo.tabsList,children:[t.map(a=>{var l,d,u,f,m,g;return c.jsx(yf,{objectName:a.name,displayName:a.displayName,completed:a.completed,pending:((d=(l=r==null?void 0:r[a.name])==null?void 0:l.read)==null?void 0:d.isOptionalFieldsModified)||((f=(u=r==null?void 0:r[a.name])==null?void 0:u.read)==null?void 0:f.isRequiredMapFieldsModified)||((g=(m=r==null?void 0:r[a.name])==null?void 0:m.read)==null?void 0:g.isValueMappingsModified)||!1},a.name)}),o&&c.jsx(Px,{completed:o.completed,pending:((s=(i=r==null?void 0:r.other)==null?void 0:i.write)==null?void 0:s.isWriteModified)||!1,displayName:"Write"}),c.jsx(Fx,{})]})})}function Mx(e,t){return t===so?{name:so,completed:!1}:e.find(n=>n.name===t)}function kx({children:e}){var x;const{project:t}=Ee(),{installation:n}=Ze(),{providerName:r}=lt(),{hydratedRevision:o}=Yr(),{objectConfigurationsState:i}=Oa(),[s,a]=b.useState(""),l=(t==null?void 0:t.appName)||"",d=n==null?void 0:n.config,u=o&&lu(d,o),f=u!==null,m=!!((x=o==null?void 0:o.content)!=null&&x.write),g=m?uu(d):void 0,v=b.useMemo(()=>{const h=[...u||[]];return g&&m&&h.push(g),h},[u,g,m]),y=Mx(v,s),p=b.useCallback(()=>{const h=v.find(w=>y!==w&&!w.completed);h&&a(h.name)},[v,y]);return b.useEffect(()=>{!s&&v.length>0&&a(v[0].name)},[v,s,p]),c.jsx(Sd.Provider,{value:p,children:c.jsx(Od.Provider,{value:y==null?void 0:y.name,children:c.jsxs(Gr,{style:{maxWidth:"55rem"},children:[c.jsxs(Cn,{style:{display:"flex",gap:"1rem",padding:"3rem",paddingBottom:"6rem",backgroundColor:"var(--amp-colors-bg-primary)"},children:[c.jsxs("div",{style:{width:"20rem"},children:[c.jsxs("h1",{style:{fontSize:"small",fontWeight:"400"},children:[r," integration"]}),c.jsx("h3",{style:{marginBottom:"20px",fontSize:"large",fontWeight:"500"},children:l}),f&&c.jsx(Dx,{value:s,readNavObjects:u,onValueChange:h=>a(h),objectConfigurationsState:i,writeNavObject:g})]}),e]}),c.jsx(Cu,{})]})})})}function jx({...e}){return c.jsx(kx,{...e})}const Lx="_resetContainer_lkwv9_4",vf={resetContainer:Lx};function qx({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:l}){var p;const{projectIdOrName:d,isLoading:u}=Ee(),{isLoading:f}=Js(),{isError:m,errorState:g}=Mt(),{seed:v,reset:y}=su();return u||f?c.jsx(Xr,{}):m(ue.PROJECT,d)?c.jsx(Wt,{message:`Error loading project ${d}`}):m(ue.INTEGRATION_LIST,d)?c.jsx(Wt,{message:"Error retrieving integrations for the project, double check the API key"}):(p=g[ue.INTEGRATION_LIST])!=null&&p.apiError?c.jsx(Wt,{message:"Something went wrong, couldn't find integration information"}):c.jsx("div",{className:vf.resetContainer,children:c.jsx(Dv,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:l,resetComponent:y,children:c.jsx(ou,{children:c.jsx(Xd,{consumerRef:t,consumerName:n,groupRef:r,groupName:o,resetComponent:y,children:c.jsx(Kw,{resetComponent:y,children:c.jsx(DC,{children:c.jsx(r0,{children:c.jsx(jx,{children:c.jsx(RC,{})})})})})})})},v)})}function Kx(){return c.jsxs(Gr,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[c.jsx(di,{}),c.jsx("p",{children:"Redirecting"})]})}function Ux({redirectURL:e,children:t}){return b.useEffect(()=>{e&&window.location.replace(e)},[e]),e?c.jsx(Kx,{}):t}function Vx({resetComponent:e,onDisconnectSuccess:t,provider:n}){const[r,o]=b.useState(!1);return c.jsxs(c.Fragment,{children:[r===!1&&c.jsxs(c.Fragment,{children:[c.jsx(Nt,{string:"Manage connection"}),c.jsxs("div",{style:{padding:"1rem 0",width:"100%",display:"flex",flexDirection:"column",gap:"1rem"},children:[c.jsx("p",{children:"Click to reauthenticate or refresh your connection."}),c.jsx($e,{type:"button",onClick:()=>o(!0),variant:"ghost",style:{fontSize:"13px"},children:"Update connection"})]})]}),r===!0&&c.jsxs(c.Fragment,{children:[c.jsx(Ys,{provider:n}),c.jsx(Jd,{resetComponent:e,onDisconnectSuccess:t})]})]})}function $x({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=Ee(),{providerName:o}=lt(e),i=`You have successfully connected your ${o} account to ${r}.`;return c.jsx(Aa,{text:i,children:c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"},children:c.jsx(Vx,{resetComponent:n,onDisconnectSuccess:t,provider:e})})})}function Hx({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,redirectUrl:i,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:l}){const{seed:d,reset:u}=su(),f=b.useCallback(m=>{s?s(m.id):l&&l(m)},[s,l]);return c.jsx("div",{className:vf.resetContainer,children:c.jsx(ou,{groupRef:r,provider:e,children:c.jsx(Xd,{resetComponent:u,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onSuccess:f,onDisconnectSuccess:a,children:c.jsx(Ux,{redirectURL:i,children:c.jsx($x,{resetComponent:u,provider:e,onDisconnectSuccess:a})})})})},d)}const Bx=(e,t)=>{const{data:n,isLoading:r,isError:o,error:i}=zs(e,t),s=((n==null?void 0:n.length)||0)>0,a=!!n&&!r,l=n==null?void 0:n[0],d=l==null?void 0:l.config;return b.useEffect(()=>{o&&Me(i)},[o,i]),{isLoaded:a,isIntegrationInstalled:s,isLoading:r,config:d}};function Ni(){const{integrationNameOrId:e,groupRef:t}=ei(),n=zs(e,t),{isPending:r,isFetching:o,isError:i,isSuccess:s,error:a,data:l}=n;return{installation:l==null?void 0:l[0],isPending:r,isFetching:o,isError:i,isSuccess:s,error:a}}const Pa=()=>{const{groupRef:e,integrationNameOrId:t}=ei(),{provider:n}=Qr(t),r=Ws({groupRef:e,provider:n}),{isPending:o,isFetching:i,isError:s,isSuccess:a,error:l,data:d}=r;return{connection:d==null?void 0:d[0],error:l,isPending:o,isFetching:i,isError:s,isSuccess:a}},Jx=()=>{var m;const e=qe(),t=ot(),{connection:n,isPending:r,isFetching:o}=Pa(),{projectIdOrName:i}=Ee(),{integrationNameOrId:s}=ei(),{data:a}=Qr(s),l=n==null?void 0:n.id,d=a==null?void 0:a.id,u=(m=a==null?void 0:a.latestRevision)==null?void 0:m.id,f=r||o;return b.useEffect(()=>{l||e.invalidateQueries({queryKey:["amp","hydratedRevision"]})},[l,e]),Wn({queryKey:["amp","hydratedRevision",i,d,u,l],queryFn:async()=>{if(!i)throw new Error("projectIdOrName is required");if(!d)throw new Error("integrationId is required");if(!u)throw new Error("revisionId is required");if(!l)throw new Error("connectionId is required");return(await t()).revisionApi.getHydratedRevision({projectIdOrName:i,integrationId:d,revisionId:u,connectionId:l})},retry:3,enabled:!!i&&!!d&&!!u&&!!l&&!f})};function wf(){var d,u;const e=Jx(),{isPending:t,isFetching:n,isError:r,isSuccess:o,error:i,data:s}=e,a=s==null?void 0:s.content,l=b.useMemo(()=>({getReadObject:f=>{var g,v;const m=(v=(g=a==null?void 0:a.read)==null?void 0:g.objects)==null?void 0:v.find(y=>y.objectName===f);return m?{object:m,getRequiredFields:()=>m.requiredFields??[],getOptionalFields:()=>m.optionalFields??[]}:(console.error(`Object ${f} not found`),{object:null,getRequiredFields:()=>null,getOptionalFields:()=>null})},getWriteObject:f=>{var g,v;const m=(v=(g=a==null?void 0:a.write)==null?void 0:g.objects)==null?void 0:v.find(y=>y.objectName===f);return m?{object:m}:(console.error(`Object ${f} not found`),{object:null})},getCustomerFieldsForObject:f=>{var g,v;const m=(v=(g=a==null?void 0:a.read)==null?void 0:g.objects)==null?void 0:v.find(y=>y.objectName===f);return m?{allFields:m.allFieldsMetadata??{},getField:y=>{var x;const p=(x=m.allFieldsMetadata)==null?void 0:x[y];return p||(console.error(`Field ${y} not found`),null)}}:(console.error(`Object ${f} not found`),{allFields:null,getField:()=>null})}}),[(d=a==null?void 0:a.read)==null?void 0:d.objects,(u=a==null?void 0:a.write)==null?void 0:u.objects]);return{data:s,...l,isPending:t,isFetching:n,isError:r,isSuccess:o,error:i}}function Wx(e){var f,m,g,v;const[t,n]=b.useState(e),{getReadObject:r,data:o}=wf(),{installation:i}=Ni(),s=b.useCallback(()=>t,[t]),a=b.useCallback((y,p)=>{var R,A,D,B;p.provider=p.provider||((R=o==null?void 0:o.content)==null?void 0:R.provider)||"";const x=p.read||{objects:{}},h=x.objects||{},w=h[y]||{},I=r(y),O=(A=I==null?void 0:I.object)==null?void 0:A.schedule,S=(D=I==null?void 0:I.object)==null?void 0:D.destination,T={};return(B=I==null?void 0:I.getRequiredFields())==null||B.forEach($=>{"fieldName"in $&&(T[$.fieldName]=!0)}),w.objectName=w.objectName||y,w.schedule=w.schedule||O||"",w.destination=w.destination||S||"",w.selectedFields=w.selectedFields||T,h[y]=w,x.objects=h,p.read=x,{read:x,objects:h,obj:w}},[r,(f=o==null?void 0:o.content)==null?void 0:f.provider]),l=b.useCallback(y=>{var p,x;return{object:(x=(p=t.read)==null?void 0:p.objects)==null?void 0:x[y],getSelectedField:h=>{var w,I,O,S;return!!((S=(O=(I=(w=t.read)==null?void 0:w.objects)==null?void 0:I[y])==null?void 0:O.selectedFields)!=null&&S[h])},setSelectedField:({fieldName:h,selected:w})=>{n(I=>Pt(I,O=>{const{obj:S}=a(y,O);S.selectedFields=S.selectedFields||{},S.selectedFields[h]=w,S.selectedFields[h]===!1&&delete S.selectedFields[h]}))},getFieldMapping:h=>{var w,I,O,S;return(S=(O=(I=(w=t.read)==null?void 0:w.objects)==null?void 0:I[y])==null?void 0:O.selectedFieldMappings)==null?void 0:S[h]},setFieldMapping:({fieldName:h,mapToName:w})=>{n(I=>Pt(I,O=>{const{obj:S}=a(y,O);S.selectedFieldMappings=S.selectedFieldMappings||{},S.selectedFieldMappings[w]=h}))}}},[(m=t.read)==null?void 0:m.objects,a]),d=b.useCallback(y=>{var I,O;const p=(O=(I=t.write)==null?void 0:I.objects)==null?void 0:O[y],x=S=>{const T=S.write||{},R=T.objects||{},A=R[y]||{objectName:y};return R[y]=A,T.objects=R,S.write=T,{write:T,objects:R,obj:A}},h=(S,T)=>{var R,A;return(A=(R=p==null?void 0:p.selectedFieldSettings)==null?void 0:R[S])==null?void 0:A[T]},w=(S,T,R)=>{n(A=>Pt(A,D=>{var $;const{obj:B}=x(D);B.selectedFieldSettings={...B.selectedFieldSettings,[S]:{...($=B.selectedFieldSettings)==null?void 0:$[S],[T]:R}}}))};return{object:p,setEnableWrite:()=>{n(S=>Pt(S,T=>{const{obj:R}=x(T);R.objectName=y}))},setDisableWrite:()=>{n(S=>Pt(S,T=>{const{objects:R}=x(T);delete R[y]}))},getWriteObject:()=>{var S,T;return(T=(S=t.write)==null?void 0:S.objects)==null?void 0:T[y]},getSelectedFieldSettings:S=>{var T;return(T=p==null?void 0:p.selectedFieldSettings)==null?void 0:T[S]},setSelectedFieldSettings:({fieldName:S,settings:T})=>{n(R=>Pt(R,A=>{const{obj:D}=x(A),B=D.selectedFieldSettings||{};D.selectedFieldSettings={...B,[S]:T},T===void 0&&delete D.selectedFieldSettings[S]}))},getDefaultValues:S=>h(S,"default"),setDefaultValues:({fieldName:S,value:T})=>w(S,"default",T),getWriteOnCreateSetting:S=>h(S,"writeOnCreate"),setWriteOnCreateSetting:({fieldName:S,value:T})=>w(S,"writeOnCreate",T),getWriteOnUpdateSetting:S=>h(S,"writeOnUpdate"),setWriteOnUpdateSetting:({fieldName:S,value:T})=>w(S,"writeOnUpdate",T)}},[(g=t.write)==null?void 0:g.objects]),u=b.useCallback(()=>{n(y=>Pt(y,p=>{var x;Object.assign(p,(x=i==null?void 0:i.config)==null?void 0:x.content)}))},[(v=i==null?void 0:i.config)==null?void 0:v.content]);return b.useEffect(()=>{console.debug("Installation found",{installation:i}),u()},[i,u]),{draft:t,get:s,reset:u,setDraft:n,readObject:l,writeObject:d}}const bf=b.createContext(null);function zx({children:e,initialConfig:t}){const n=Wx(t);return c.jsx(bf.Provider,{value:n,children:e})}function Qx(){const e=b.useContext(bf);if(!e)throw new Error("useConfigContext must be used within a ConfigProvider / InstallationProvider");return e}const If=b.createContext({integrationNameOrId:"",consumerRef:"",consumerName:void 0,groupRef:"",groupName:void 0});function ei(){const e=b.useContext(If);if(!e)throw new Error("useInstallationProps must be used within an InstallationProvider");return e}function Gx({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i}){const s=b.useMemo(()=>({integrationNameOrId:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i}),[t,n,r,o,i]);return c.jsx(If.Provider,{value:s,children:c.jsx(zx,{initialConfig:{},children:e})})}function Xx(e){return typeof e.provider=="string"}function Yx(e){if(!Xx(e))throw new Error("Config must have a provider field for creation");return e}function Zx(){const{projectIdOrName:e}=Ee(),{groupRef:t,integrationNameOrId:n}=ei(),{data:r}=Qr(n),{connection:o}=Pa(),{installation:i}=Ni(),s=qe(),{mutate:a,isIdle:l,isPending:d,error:u,errorMsg:f}=Gd();return{createInstallation:({config:g,onSuccess:v,onError:y,onSettled:p})=>{if(i)throw Error("Installation already created. Try updating instead.");if(!r)throw Error("No integration found");const x={projectIdOrName:e,integrationId:r==null?void 0:r.id,installation:{groupRef:t,connectionId:o==null?void 0:o.id,config:{content:Yx(g)}}};return a(x,{onSuccess:h=>{v==null||v(h)},onError:h=>{y==null||y(h)},onSettled:()=>{p==null||p(),s.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:l,isPending:d,error:u,errorMsg:f}}const eO=()=>{const e=ot(),t=qe(),[n,r]=b.useState(null);return{...In({mutationKey:["updateInstallation"],mutationFn:async i=>(await e()).installationApi.updateInstallation(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:i=>{console.error("Error updating installation"),Me(i,r)}}),errorMsg:n}};function tO(){const{projectIdOrName:e}=Ee(),{integrationNameOrId:t}=ei(),{data:n}=Qr(t),{installation:r}=Ni(),o=qe(),{mutate:i,isIdle:s,isPending:a,error:l,errorMsg:d}=eO();return{updateInstallation:({config:f,onSuccess:m,onError:g,onSettled:v})=>{var x,h;if(!r)throw Error("Installation not created yet. Try creating the installation first.");if(!n)throw Error("No integration found");const y=[];if((x=f==null?void 0:f.write)!=null&&x.objects&&Object.keys(f.write.objects).length>0&&y.push("config.content.write.objects"),(h=f==null?void 0:f.read)!=null&&h.objects){const w=Object.keys(f.read.objects);y.push(...w.map(I=>`config.content.read.objects.${I}`))}const p={projectIdOrName:e,integrationId:n==null?void 0:n.id,installationId:r.id,installationUpdate:{updateMask:y,installation:{config:{content:f}}}};return i(p,{onSuccess:w=>{m==null||m(w)},onError:w=>{g==null||g(w)},onSettled:()=>{v==null||v(),o.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:s,isPending:a,error:l,errorMsg:d}}const nO=()=>{const e=ot(),t=qe(),[n,r]=b.useState(null);return{...In({mutationKey:["deleteInstallation"],mutationFn:async i=>(await e()).installationApi.deleteInstallation(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:i=>{console.error("Error deleting installation"),Me(i,r)}}),errorMsg:n}};function rO(){const{projectIdOrName:e}=Ee(),{integrationNameOrId:t}=ei(),{data:n}=Qr(t),{installation:r}=Ni(),o=qe(),{mutate:i,isIdle:s,isPending:a,error:l,errorMsg:d}=nO();return{deleteInstallation:({onSuccess:f,onError:m,onSettled:g})=>{if(!r)throw Error("Installation not found. Not able to delete installation.");if(!n)throw Error("No integration found");return i({projectIdOrName:e,integrationId:n==null?void 0:n.id,installationId:r.id},{onSuccess:()=>{f==null||f()},onError:v=>{m==null||m(v)},onSettled:()=>{g==null||g(),o.invalidateQueries({queryKey:["amp","installations"]}),o.invalidateQueries({queryKey:["amp","connections"]})}})},isIdle:s,isPending:a,error:l,errorMsg:d}}exports.AmpersandContext=Zl;exports.AmpersandProvider=hv;exports.ConnectProvider=Hx;exports.FieldSettingWriteOnCreateEnum=yh;exports.FieldSettingWriteOnUpdateEnum=vh;exports.InstallIntegration=qx;exports.InstallationProvider=Gx;exports.useAmpersandProvider=mv;exports.useConfig=Qx;exports.useConnection=Pa;exports.useCreateInstallation=Zx;exports.useDeleteInstallation=rO;exports.useInstallation=Ni;exports.useIsIntegrationInstalled=Bx;exports.useManifest=wf;exports.useUpdateInstallation=tO;
52
52
  //# sourceMappingURL=amp-react.cjs.js.map