@amp-labs/react 2.4.4 → 2.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,30 +1,30 @@
1
- "use strict";var Ia=e=>{throw TypeError(e)};var _o=(e,t,n)=>t.has(e)||Ia("Cannot "+n);var O=(e,t,n)=>(_o(e,t,"read from private field"),n?n.call(e):t.get(e)),ae=(e,t,n)=>t.has(e)?Ia("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Y=(e,t,n,r)=>(_o(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),me=(e,t,n)=>(_o(e,t,"access private method"),n);var xi=(e,t,n,r)=>({set _(o){Y(e,t,o,n)},get _(){return O(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),w=require("react");require("react-dom");function nf(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 $=nf(w);var si=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(){}},Yn=typeof window>"u"||"Deno"in globalThis;function Tt(){}function rf(e,t){return typeof e=="function"?e(t):e}function $o(e){return typeof e=="number"&&e>=0&&e!==1/0}function jc(e,t){return Math.max(e+(t||0)-Date.now(),0)}function cr(e,t){return typeof e=="function"?e(t):e}function Kt(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!==Is(s,t.options))return!1}else if(!Jr(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 _a(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Wr(t.options.mutationKey)!==Wr(i))return!1}else if(!Jr(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function Is(e,t){return((t==null?void 0:t.queryKeyHashFn)||Wr)(e)}function Wr(e){return JSON.stringify(e,(t,n)=>Ho(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function Jr(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!Jr(e[n],t[n])):!1}function qo(e,t){if(e===t)return e;const n=xa(e)&&xa(t);if(n||Ho(e)&&Ho(t)){const r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),s=i.length,a=n?[]:{};let c=0;for(let u=0;u<s;u++){const d=n?u:i[u];(!n&&r.includes(d)||n)&&e[d]===void 0&&t[d]===void 0?(a[d]=void 0,c++):(a[d]=qo(e[d],t[d]),a[d]===e[d]&&e[d]!==void 0&&c++)}return o===s&&c===o?e:a}return t}function Uo(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 xa(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ho(e){if(!Ca(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Ca(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Ca(e){return Object.prototype.toString.call(e)==="[object Object]"}function of(e){return new Promise(t=>{setTimeout(t,e)})}function Bo(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 qo(e,t)}catch(r){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}`)}return qo(e,t)}return t}function sf(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function af(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Ki=Symbol();function kc(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Ki&&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===Ki?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var Hn,In,ur,Sc,cf=(Sc=class extends si{constructor(){super();ae(this,Hn);ae(this,In);ae(this,ur);Y(this,ur,t=>{if(!Yn&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){O(this,In)||this.setEventListener(O(this,ur))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,In))==null||t.call(this),Y(this,In,void 0))}setEventListener(t){var n;Y(this,ur,t),(n=O(this,In))==null||n.call(this),Y(this,In,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){O(this,Hn)!==t&&(Y(this,Hn,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof O(this,Hn)=="boolean"?O(this,Hn):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Hn=new WeakMap,In=new WeakMap,ur=new WeakMap,Sc),bs=new cf,dr,bn,fr,Nc,lf=(Nc=class extends si{constructor(){super();ae(this,dr,!0);ae(this,bn);ae(this,fr);Y(this,fr,t=>{if(!Yn&&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(){O(this,bn)||this.setEventListener(O(this,fr))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,bn))==null||t.call(this),Y(this,bn,void 0))}setEventListener(t){var n;Y(this,fr,t),(n=O(this,bn))==null||n.call(this),Y(this,bn,t(this.setOnline.bind(this)))}setOnline(t){O(this,dr)!==t&&(Y(this,dr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return O(this,dr)}},dr=new WeakMap,bn=new WeakMap,fr=new WeakMap,Nc),Vi=new lf;function Wo(){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 uf(e){return Math.min(1e3*2**e,3e4)}function Lc(e){return(e??"online")==="online"?Vi.isOnline():!0}var Kc=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function xo(e){return e instanceof Kc}function Vc(e){let t=!1,n=0,r=!1,o;const i=Wo(),s=y=>{var h;r||(m(new Kc(y)),(h=e.abort)==null||h.call(e))},a=()=>{t=!0},c=()=>{t=!1},u=()=>bs.isFocused()&&(e.networkMode==="always"||Vi.isOnline())&&e.canRun(),d=()=>Lc(e.networkMode)&&e.canRun(),f=y=>{var h;r||(r=!0,(h=e.onSuccess)==null||h.call(e,y),o==null||o(),i.resolve(y))},m=y=>{var h;r||(r=!0,(h=e.onError)==null||h.call(e,y),o==null||o(),i.reject(y))},p=()=>new Promise(y=>{var h;o=_=>{(r||u())&&y(_)},(h=e.onPause)==null||h.call(e)}).then(()=>{var y;o=void 0,r||(y=e.onContinue)==null||y.call(e)}),g=()=>{if(r)return;let y;const h=n===0?e.initialPromise:void 0;try{y=h??e.fn()}catch(_){y=Promise.reject(_)}Promise.resolve(y).then(f).catch(_=>{var N;if(r)return;const v=e.retry??(Yn?0:3),x=e.retryDelay??uf,C=typeof x=="function"?x(n,_):x,b=v===!0||typeof v=="number"&&n<v||typeof v=="function"&&v(n,_);if(t||!b){m(_);return}n++,(N=e.onFail)==null||N.call(e,n,_),of(C).then(()=>u()?void 0:p()).then(()=>{t?m(_):g()})})};return{promise:i,cancel:s,continue:()=>(o==null||o(),i),cancelRetry:a,continueRetry:c,canStart:d,start:()=>(d()?g():p().then(g),i)}}function df(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=a=>setTimeout(a,0);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 Ze=df(),Bn,Tc,$c=(Tc=class{constructor(){ae(this,Bn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),$o(this.gcTime)&&Y(this,Bn,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Yn?1/0:5*60*1e3))}clearGcTimeout(){O(this,Bn)&&(clearTimeout(O(this,Bn)),Y(this,Bn,void 0))}},Bn=new WeakMap,Tc),pr,hr,Nt,ot,ni,Wn,kt,an,Rc,ff=(Rc=class extends $c{constructor(t){super();ae(this,kt);ae(this,pr);ae(this,hr);ae(this,Nt);ae(this,ot);ae(this,ni);ae(this,Wn);Y(this,Wn,!1),Y(this,ni,t.defaultOptions),this.setOptions(t.options),this.observers=[],Y(this,Nt,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Y(this,pr,pf(this.options)),this.state=t.state??O(this,pr),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=O(this,ot))==null?void 0:t.promise}setOptions(t){this.options={...O(this,ni),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&O(this,Nt).remove(this)}setData(t,n){const r=Bo(this.state.data,t,this.options);return me(this,kt,an).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){me(this,kt,an).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=O(this,ot))==null?void 0:r.promise;return(o=O(this,ot))==null||o.cancel(t),n?n.then(Tt).catch(Tt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(O(this,pr))}isActive(){return this.observers.some(t=>Kt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ki||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!jc(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=O(this,ot))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=O(this,ot))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),O(this,Nt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(O(this,ot)&&(O(this,Wn)?O(this,ot).cancel({revert:!0}):O(this,ot).cancelRetry()),this.scheduleGc()),O(this,Nt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||me(this,kt,an).call(this,{type:"invalidate"})}fetch(t,n){var c,u,d;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(O(this,ot))return O(this,ot).continueRetry(),O(this,ot).promise}if(t&&this.setOptions(t),!this.options.queryFn){const f=this.observers.find(m=>m.options.queryFn);f&&this.setOptions(f.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=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(Y(this,Wn,!0),r.signal)})},i=()=>{const f=kc(this.options,n),m={queryKey:this.queryKey,meta:this.meta};return o(m),Y(this,Wn,!1),this.options.persister?this.options.persister(f,m,this):f(m)},s={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:i};o(s),(c=this.options.behavior)==null||c.onFetch(s,this),Y(this,hr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=s.fetchOptions)==null?void 0:u.meta))&&me(this,kt,an).call(this,{type:"fetch",meta:(d=s.fetchOptions)==null?void 0:d.meta});const a=f=>{var m,p,g,y;xo(f)&&f.silent||me(this,kt,an).call(this,{type:"error",error:f}),xo(f)||((p=(m=O(this,Nt).config).onError)==null||p.call(m,f,this),(y=(g=O(this,Nt).config).onSettled)==null||y.call(g,this.state.data,f,this)),this.scheduleGc()};return Y(this,ot,Vc({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:f=>{var m,p,g,y;if(f===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}`),a(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(h){a(h);return}(p=(m=O(this,Nt).config).onSuccess)==null||p.call(m,f,this),(y=(g=O(this,Nt).config).onSettled)==null||y.call(g,f,this.state.error,this),this.scheduleGc()},onError:a,onFail:(f,m)=>{me(this,kt,an).call(this,{type:"failed",failureCount:f,error:m})},onPause:()=>{me(this,kt,an).call(this,{type:"pause"})},onContinue:()=>{me(this,kt,an).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),O(this,ot).start()}},pr=new WeakMap,hr=new WeakMap,Nt=new WeakMap,ot=new WeakMap,ni=new WeakMap,Wn=new WeakMap,kt=new WeakSet,an=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,...qc(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 xo(o)&&o.revert&&O(this,hr)?{...O(this,hr),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),Ze.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),O(this,Nt).notify({query:this,type:"updated",action:t})})},Rc);function qc(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Lc(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function pf(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 Bt,Ac,hf=(Ac=class extends si{constructor(t={}){super();ae(this,Bt);this.config=t,Y(this,Bt,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??Is(o,n);let s=this.get(i);return s||(s=new ff({cache:this,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){O(this,Bt).has(t.queryHash)||(O(this,Bt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=O(this,Bt).get(t.queryHash);n&&(t.destroy(),n===t&&O(this,Bt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ze.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return O(this,Bt).get(t)}getAll(){return[...O(this,Bt).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){Ze.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Ze.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Ze.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Bt=new WeakMap,Ac),Wt,ct,Jn,Jt,wn,Pc,mf=(Pc=class extends $c{constructor(t){super();ae(this,Jt);ae(this,Wt);ae(this,ct);ae(this,Jn);this.mutationId=t.mutationId,Y(this,ct,t.mutationCache),Y(this,Wt,[]),this.state=t.state||gf(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){O(this,Wt).includes(t)||(O(this,Wt).push(t),this.clearGcTimeout(),O(this,ct).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Y(this,Wt,O(this,Wt).filter(n=>n!==t)),this.scheduleGc(),O(this,ct).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){O(this,Wt).length||(this.state.status==="pending"?this.scheduleGc():O(this,ct).remove(this))}continue(){var t;return((t=O(this,Jn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,s,a,c,u,d,f,m,p,g,y,h,_,v,x,C,b,N,R;Y(this,Jn,Vc({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(S,F)=>{me(this,Jt,wn).call(this,{type:"failed",failureCount:S,error:F})},onPause:()=>{me(this,Jt,wn).call(this,{type:"pause"})},onContinue:()=>{me(this,Jt,wn).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>O(this,ct).canRun(this)}));const n=this.state.status==="pending",r=!O(this,Jn).canStart();try{if(!n){me(this,Jt,wn).call(this,{type:"pending",variables:t,isPaused:r}),await((i=(o=O(this,ct).config).onMutate)==null?void 0:i.call(o,t,this));const F=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,t));F!==this.state.context&&me(this,Jt,wn).call(this,{type:"pending",context:F,variables:t,isPaused:r})}const S=await O(this,Jn).start();return await((u=(c=O(this,ct).config).onSuccess)==null?void 0:u.call(c,S,t,this.state.context,this)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,S,t,this.state.context)),await((p=(m=O(this,ct).config).onSettled)==null?void 0:p.call(m,S,null,this.state.variables,this.state.context,this)),await((y=(g=this.options).onSettled)==null?void 0:y.call(g,S,null,t,this.state.context)),me(this,Jt,wn).call(this,{type:"success",data:S}),S}catch(S){try{throw await((_=(h=O(this,ct).config).onError)==null?void 0:_.call(h,S,t,this.state.context,this)),await((x=(v=this.options).onError)==null?void 0:x.call(v,S,t,this.state.context)),await((b=(C=O(this,ct).config).onSettled)==null?void 0:b.call(C,void 0,S,this.state.variables,this.state.context,this)),await((R=(N=this.options).onSettled)==null?void 0:R.call(N,void 0,S,t,this.state.context)),S}finally{me(this,Jt,wn).call(this,{type:"error",error:S})}}finally{O(this,ct).runNext(this)}}},Wt=new WeakMap,ct=new WeakMap,Jn=new WeakMap,Jt=new WeakSet,wn=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),Ze.batch(()=>{O(this,Wt).forEach(r=>{r.onMutationUpdate(t)}),O(this,ct).notify({mutation:this,type:"updated",action:t})})},Pc);function gf(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var cn,Lt,ri,Dc,yf=(Dc=class extends si{constructor(t={}){super();ae(this,cn);ae(this,Lt);ae(this,ri);this.config=t,Y(this,cn,new Set),Y(this,Lt,new Map),Y(this,ri,0)}build(t,n,r){const o=new mf({mutationCache:this,mutationId:++xi(this,ri)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){O(this,cn).add(t);const n=Ci(t);if(typeof n=="string"){const r=O(this,Lt).get(n);r?r.push(t):O(this,Lt).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(O(this,cn).delete(t)){const n=Ci(t);if(typeof n=="string"){const r=O(this,Lt).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&O(this,Lt).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Ci(t);if(typeof n=="string"){const r=O(this,Lt).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=Ci(t);if(typeof n=="string"){const o=(r=O(this,Lt).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(){Ze.batch(()=>{O(this,cn).forEach(t=>{this.notify({type:"removed",mutation:t})}),O(this,cn).clear(),O(this,Lt).clear()})}getAll(){return Array.from(O(this,cn))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>_a(n,r))}findAll(t={}){return this.getAll().filter(n=>_a(t,n))}notify(t){Ze.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Ze.batch(()=>Promise.all(t.map(n=>n.continue().catch(Tt))))}},cn=new WeakMap,Lt=new WeakMap,ri=new WeakMap,Dc);function Ci(e){var t;return(t=e.options.scope)==null?void 0:t.id}function Oa(e){return{onFetch:(t,n)=>{var d,f,m,p,g;const r=t.options,o=(m=(f=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:m.direction,i=((p=t.state.data)==null?void 0:p.pages)||[],s=((g=t.state.data)==null?void 0:g.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const u=async()=>{let y=!1;const h=x=>{Object.defineProperty(x,"signal",{enumerable:!0,get:()=>(t.signal.aborted?y=!0:t.signal.addEventListener("abort",()=>{y=!0}),t.signal)})},_=kc(t.options,t.fetchOptions),v=async(x,C,b)=>{if(y)return Promise.reject();if(C==null&&x.pages.length)return Promise.resolve(x);const N={queryKey:t.queryKey,pageParam:C,direction:b?"backward":"forward",meta:t.options.meta};h(N);const R=await _(N),{maxPages:S}=t.options,F=b?af:sf;return{pages:F(x.pages,R,S),pageParams:F(x.pageParams,C,S)}};if(o&&i.length){const x=o==="backward",C=x?vf:Ea,b={pages:i,pageParams:s},N=C(r,b);a=await v(b,N,x)}else{const x=e??i.length;do{const C=c===0?s[0]??r.initialPageParam:Ea(r,a);if(c>0&&C==null)break;a=await v(a,C),c++}while(c<x)}return a};t.options.persister?t.fetchFn=()=>{var y,h;return(h=(y=t.options).persister)==null?void 0:h.call(y,u,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function Ea(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 vf(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 Me,_n,xn,mr,gr,Cn,yr,vr,Fc,wf=(Fc=class{constructor(e={}){ae(this,Me);ae(this,_n);ae(this,xn);ae(this,mr);ae(this,gr);ae(this,Cn);ae(this,yr);ae(this,vr);Y(this,Me,e.queryCache||new hf),Y(this,_n,e.mutationCache||new yf),Y(this,xn,e.defaultOptions||{}),Y(this,mr,new Map),Y(this,gr,new Map),Y(this,Cn,0)}mount(){xi(this,Cn)._++,O(this,Cn)===1&&(Y(this,yr,bs.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Me).onFocus())})),Y(this,vr,Vi.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Me).onOnline())})))}unmount(){var e,t;xi(this,Cn)._--,O(this,Cn)===0&&((e=O(this,yr))==null||e.call(this),Y(this,yr,void 0),(t=O(this,vr))==null||t.call(this),Y(this,vr,void 0))}isFetching(e){return O(this,Me).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return O(this,_n).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=O(this,Me).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=O(this,Me).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(cr(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return O(this,Me).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=O(this,Me).get(r.queryHash),i=o==null?void 0:o.state.data,s=rf(t,i);if(s!==void 0)return O(this,Me).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return Ze.batch(()=>O(this,Me).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=O(this,Me).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=O(this,Me);Ze.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=O(this,Me),r={type:"active",...e};return Ze.batch(()=>(n.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries(r,t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Ze.batch(()=>O(this,Me).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Tt).catch(Tt)}invalidateQueries(e,t={}){return Ze.batch(()=>{if(O(this,Me).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none")return Promise.resolve();const n={...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"};return this.refetchQueries(n,t)})}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Ze.batch(()=>O(this,Me).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(Tt)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Tt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=O(this,Me).build(this,t);return n.isStaleByTime(cr(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Tt).catch(Tt)}fetchInfiniteQuery(e){return e.behavior=Oa(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Tt).catch(Tt)}ensureInfiniteQueryData(e){return e.behavior=Oa(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Vi.isOnline()?O(this,_n).resumePausedMutations():Promise.resolve()}getQueryCache(){return O(this,Me)}getMutationCache(){return O(this,_n)}getDefaultOptions(){return O(this,xn)}setDefaultOptions(e){Y(this,xn,e)}setQueryDefaults(e,t){O(this,mr).set(Wr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...O(this,mr).values()],n={};return t.forEach(r=>{Jr(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){O(this,gr).set(Wr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...O(this,gr).values()];let n={};return t.forEach(r=>{Jr(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...O(this,xn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Is(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===Ki&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...O(this,xn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){O(this,Me).clear(),O(this,_n).clear()}},Me=new WeakMap,_n=new WeakMap,xn=new WeakMap,mr=new WeakMap,gr=new WeakMap,Cn=new WeakMap,yr=new WeakMap,vr=new WeakMap,Fc),pt,ge,ii,lt,zn,wr,On,zt,oi,Ir,br,Gn,Qn,En,_r,Oe,qr,Jo,zo,Go,Qo,Xo,Yo,Zo,Uc,Mc,If=(Mc=class extends si{constructor(t,n){super();ae(this,Oe);ae(this,pt);ae(this,ge);ae(this,ii);ae(this,lt);ae(this,zn);ae(this,wr);ae(this,On);ae(this,zt);ae(this,oi);ae(this,Ir);ae(this,br);ae(this,Gn);ae(this,Qn);ae(this,En);ae(this,_r,new Set);this.options=n,Y(this,pt,t),Y(this,zt,null),Y(this,On,Wo()),this.options.experimental_prefetchInRender||O(this,On).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&&(O(this,ge).addObserver(this),Sa(O(this,ge),this.options)?me(this,Oe,qr).call(this):this.updateResult(),me(this,Oe,Qo).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return es(O(this,ge),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return es(O(this,ge),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,me(this,Oe,Xo).call(this),me(this,Oe,Yo).call(this),O(this,ge).removeObserver(this)}setOptions(t,n){const r=this.options,o=O(this,ge);if(this.options=O(this,pt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Kt(this.options.enabled,O(this,ge))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");me(this,Oe,Zo).call(this),O(this,ge).setOptions(this.options),r._defaulted&&!Uo(this.options,r)&&O(this,pt).getQueryCache().notify({type:"observerOptionsUpdated",query:O(this,ge),observer:this});const i=this.hasListeners();i&&Na(O(this,ge),o,this.options,r)&&me(this,Oe,qr).call(this),this.updateResult(n),i&&(O(this,ge)!==o||Kt(this.options.enabled,O(this,ge))!==Kt(r.enabled,O(this,ge))||cr(this.options.staleTime,O(this,ge))!==cr(r.staleTime,O(this,ge)))&&me(this,Oe,Jo).call(this);const s=me(this,Oe,zo).call(this);i&&(O(this,ge)!==o||Kt(this.options.enabled,O(this,ge))!==Kt(r.enabled,O(this,ge))||s!==O(this,En))&&me(this,Oe,Go).call(this,s)}getOptimisticResult(t){const n=O(this,pt).getQueryCache().build(O(this,pt),t),r=this.createResult(n,t);return _f(this,r)&&(Y(this,lt,r),Y(this,wr,this.options),Y(this,zn,O(this,ge).state)),r}getCurrentResult(){return O(this,lt)}trackResult(t,n){const r={};return Object.keys(t).forEach(o=>{Object.defineProperty(r,o,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(o),n==null||n(o),t[o])})}),r}trackProp(t){O(this,_r).add(t)}getCurrentQuery(){return O(this,ge)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=O(this,pt).defaultQueryOptions(t),r=O(this,pt).getQueryCache().build(O(this,pt),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return me(this,Oe,qr).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),O(this,lt)))}createResult(t,n){var S;const r=O(this,ge),o=this.options,i=O(this,lt),s=O(this,zn),a=O(this,wr),u=t!==r?t.state:O(this,ii),{state:d}=t;let f={...d},m=!1,p;if(n._optimisticResults){const F=this.hasListeners(),q=!F&&Sa(t,n),z=F&&Na(t,r,n,o);(q||z)&&(f={...f,...qc(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:g,errorUpdatedAt:y,status:h}=f;if(n.select&&f.data!==void 0)if(i&&f.data===(s==null?void 0:s.data)&&n.select===O(this,oi))p=O(this,Ir);else try{Y(this,oi,n.select),p=n.select(f.data),p=Bo(i==null?void 0:i.data,p,n),Y(this,Ir,p),Y(this,zt,null)}catch(F){Y(this,zt,F)}else p=f.data;if(n.placeholderData!==void 0&&p===void 0&&h==="pending"){let F;if(i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))F=i.data;else if(F=typeof n.placeholderData=="function"?n.placeholderData((S=O(this,br))==null?void 0:S.state.data,O(this,br)):n.placeholderData,n.select&&F!==void 0)try{F=n.select(F),Y(this,zt,null)}catch(q){Y(this,zt,q)}F!==void 0&&(h="success",p=Bo(i==null?void 0:i.data,F,n),m=!0)}O(this,zt)&&(g=O(this,zt),p=O(this,Ir),y=Date.now(),h="error");const _=f.fetchStatus==="fetching",v=h==="pending",x=h==="error",C=v&&_,b=p!==void 0,R={status:h,fetchStatus:f.fetchStatus,isPending:v,isSuccess:h==="success",isError:x,isInitialLoading:C,isLoading:C,data:p,dataUpdatedAt:f.dataUpdatedAt,error:g,errorUpdatedAt:y,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:_,isRefetching:_&&!v,isLoadingError:x&&!b,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:x&&b,isStale:_s(t,n),refetch:this.refetch,promise:O(this,On)};if(this.options.experimental_prefetchInRender){const F=J=>{R.status==="error"?J.reject(R.error):R.data!==void 0&&J.resolve(R.data)},q=()=>{const J=Y(this,On,R.promise=Wo());F(J)},z=O(this,On);switch(z.status){case"pending":t.queryHash===r.queryHash&&F(z);break;case"fulfilled":(R.status==="error"||R.data!==z.value)&&q();break;case"rejected":(R.status!=="error"||R.error!==z.reason)&&q();break}}return R}updateResult(t){const n=O(this,lt),r=this.createResult(O(this,ge),this.options);if(Y(this,zn,O(this,ge).state),Y(this,wr,this.options),O(this,zn).data!==void 0&&Y(this,br,O(this,ge)),Uo(r,n))return;Y(this,lt,r);const o={},i=()=>{if(!n)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!O(this,_r).size)return!0;const c=new Set(a??O(this,_r));return this.options.throwOnError&&c.add("error"),Object.keys(O(this,lt)).some(u=>{const d=u;return O(this,lt)[d]!==n[d]&&c.has(d)})};(t==null?void 0:t.listeners)!==!1&&i()&&(o.listeners=!0),me(this,Oe,Uc).call(this,{...o,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&me(this,Oe,Qo).call(this)}},pt=new WeakMap,ge=new WeakMap,ii=new WeakMap,lt=new WeakMap,zn=new WeakMap,wr=new WeakMap,On=new WeakMap,zt=new WeakMap,oi=new WeakMap,Ir=new WeakMap,br=new WeakMap,Gn=new WeakMap,Qn=new WeakMap,En=new WeakMap,_r=new WeakMap,Oe=new WeakSet,qr=function(t){me(this,Oe,Zo).call(this);let n=O(this,ge).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Tt)),n},Jo=function(){me(this,Oe,Xo).call(this);const t=cr(this.options.staleTime,O(this,ge));if(Yn||O(this,lt).isStale||!$o(t))return;const r=jc(O(this,lt).dataUpdatedAt,t)+1;Y(this,Gn,setTimeout(()=>{O(this,lt).isStale||this.updateResult()},r))},zo=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(O(this,ge)):this.options.refetchInterval)??!1},Go=function(t){me(this,Oe,Yo).call(this),Y(this,En,t),!(Yn||Kt(this.options.enabled,O(this,ge))===!1||!$o(O(this,En))||O(this,En)===0)&&Y(this,Qn,setInterval(()=>{(this.options.refetchIntervalInBackground||bs.isFocused())&&me(this,Oe,qr).call(this)},O(this,En)))},Qo=function(){me(this,Oe,Jo).call(this),me(this,Oe,Go).call(this,me(this,Oe,zo).call(this))},Xo=function(){O(this,Gn)&&(clearTimeout(O(this,Gn)),Y(this,Gn,void 0))},Yo=function(){O(this,Qn)&&(clearInterval(O(this,Qn)),Y(this,Qn,void 0))},Zo=function(){const t=O(this,pt).getQueryCache().build(O(this,pt),this.options);if(t===O(this,ge))return;const n=O(this,ge);Y(this,ge,t),Y(this,ii,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Uc=function(t){Ze.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(O(this,lt))}),O(this,pt).getQueryCache().notify({query:O(this,ge),type:"observerResultsUpdated"})})},Mc);function bf(e,t){return Kt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Sa(e,t){return bf(e,t)||e.state.data!==void 0&&es(e,t,t.refetchOnMount)}function es(e,t,n){if(Kt(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&_s(e,t)}return!1}function Na(e,t,n,r){return(e!==t||Kt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&_s(e,n)}function _s(e,t){return Kt(t.enabled,e)!==!1&&e.isStaleByTime(cr(t.staleTime,e))}function _f(e,t){return!Uo(e.getCurrentResult(),t)}var Hc=$.createContext(void 0),ai=e=>{const t=$.useContext(Hc);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},xf=({client:e,children:t})=>($.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(Hc.Provider,{value:e,children:t})),Bc=$.createContext(!1),Cf=()=>$.useContext(Bc);Bc.Provider;function Of(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ef=$.createContext(Of()),Sf=()=>$.useContext(Ef);function Nf(e,t){return typeof e=="function"?e(...t):!!e}function Ta(){}var Tf=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Rf=e=>{$.useEffect(()=>{e.clearReset()},[e])},Af=({result:e,errorResetBoundary:t,throwOnError:n,query:r})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&Nf(n,[e.error,r]),Pf=e=>{const t=e.staleTime;e.suspense&&(e.staleTime=typeof t=="function"?(...n)=>Math.max(t(...n),1e3):Math.max(t??1e3,1e3),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3)))},Df=(e,t)=>e.isLoading&&e.isFetching&&!t,Ff=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Ra=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Mf(e,t,n){var f,m,p,g,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=ai(),o=Cf(),i=Sf(),s=r.defaultQueryOptions(e);(m=(f=r.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||m.call(f,s),s._optimisticResults=o?"isRestoring":"optimistic",Pf(s),Tf(s,i),Rf(i);const a=!r.getQueryCache().get(s.queryHash),[c]=$.useState(()=>new t(r,s)),u=c.getOptimisticResult(s),d=!o&&e.subscribed!==!1;if($.useSyncExternalStore($.useCallback(h=>{const _=d?c.subscribe(Ze.batchCalls(h)):Ta;return c.updateResult(),_},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),$.useEffect(()=>{c.setOptions(s,{listeners:!1})},[s,c]),Ff(s,u))throw Ra(s,c,i);if(Af({result:u,errorResetBoundary:i,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash)}))throw u.error;if((g=(p=r.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||g.call(p,s,u),s.experimental_prefetchInRender&&!Yn&&Df(u,o)){const h=a?Ra(s,c,i):(y=r.getQueryCache().get(s.queryHash))==null?void 0:y.promise;h==null||h.catch(Ta).finally(()=>{c.updateResult()})}return s.notifyOnChangeProps?u:c.trackResult(u)}function Ar(e,t){return Mf(e,If)}const Wc=w.createContext(null),jf=Wc.Provider,Ut=()=>{const e=w.useContext(Wc);if(e===null)throw new Error("useApiKey must be used within an ApiKeyProvider");return e};var ye=(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))(ye||{});const Jc=w.createContext(void 0);function Ht(){const e=w.useContext(Jc);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const kf=(()=>{const e={};return Object.values(ye).forEach(t=>{e[t]={}}),e})();function Lf({children:e}){const[t,n]=w.useState(kf),r=w.useCallback((d,f,m=!0)=>{n(p=>{const g={...p};return g[d]=g[d]||{},g[d][f]=m,g})},[n]),o=w.useCallback((d,f)=>{var m;return!!((m=t[d])!=null&&m[f])},[t]),i=w.useCallback((d,f)=>{var m;return(m=t[d])==null?void 0:m[f]},[t]),s=w.useCallback((d,f)=>{n(m=>{var g;const p={...m};return(g=p[d])==null||delete g[f],p})},[n]),a=w.useCallback(d=>{n(f=>{const m={...f};return m[d]={},m})},[n]),c=w.useCallback((d,f)=>{n(m=>{const p={...m};return p[d]=p[d]||{},f.forEach(g=>{p[d][g]=!0}),p})},[n]),u=w.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(Jc.Provider,{value:u,children:e})}const Kf="https://api.withampersand.com/v1".replace(/\/+$/,"");class xs{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Kf}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Gc}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 Vf=new xs,no=class no{constructor(t=Vf){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 Uf(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?no.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 zc(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(u=>o[u]===void 0?delete o[u]:{});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:qf(a.body)||a.body instanceof URLSearchParams||$f(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}};no.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let Qt=no;function $f(e){return typeof Blob<"u"&&e instanceof Blob}function qf(e){return typeof FormData<"u"&&e instanceof FormData}class zc extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class Uf extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class se extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function P(e,t){const n=e[t];return n!=null}function Gc(e,t=""){return Object.keys(e).map(n=>Qc(n,e[n],t)).filter(n=>n.length>0).join("&")}function Qc(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 Qc(e,o,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Gc(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function ro(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class Ke{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class Zn{constructor(t){this.raw=t}async value(){}}class Hf{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function Bf(e){return Wf(e)}function Wf(e,t){return e==null?e:{fieldUsed:P(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:P(e,"keyFormat")?e.keyFormat:void 0}}function Jf(e){return zf(e)}function zf(e,t){return e==null?e:{name:e.name,valuePrefix:P(e,"valuePrefix")?e.valuePrefix:void 0}}function Gf(e){return Qf(e)}function Qf(e,t){return e==null?e:{name:e.name}}function Xf(e){return Yf(e)}function Yf(e,t){return e==null?e:{attachmentType:e.attachmentType,query:P(e,"query")?Gf(e.query):void 0,header:P(e,"header")?Jf(e.header):void 0,docsURL:P(e,"docsURL")?e.docsURL:void 0}}function Zf(e){return ep(e)}function ep(e,t){return e}function tp(e){return np(e)}function np(e,t){return e==null?e:{days:P(e,"days")?e.days:void 0,fullHistory:P(e,"fullHistory")?e.fullHistory:void 0}}function rp(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Xc(e){return ip(e)}function ip(e,t){return e==null?e:{defaultPeriod:tp(e.defaultPeriod)}}function op(e){if(e!==void 0)return e===null?null:{defaultPeriod:rp(e.defaultPeriod)}}function sp(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function ap(e){if(e!==void 0)return e===null?null:{defaultPeriod:sp(e.defaultPeriod)}}function cp(e){return lp(e)}function lp(e,t){return e==null?e:{enabled:P(e,"enabled")?e.enabled:void 0}}function Yc(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function up(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:ap(e.backfill)}}function dp(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:ro(e.objects,up)}}function fp(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults}}function pp(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:ro(e.objects,fp)}}function hp(e){return mp(e)}function mp(e,t){return e==null?e:{apiKeyAsBasic:P(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:P(e,"apiKeyAsBasicOpts")?Bf(e.apiKeyAsBasicOpts):void 0,docsURL:P(e,"docsURL")?e.docsURL:void 0}}function gp(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Oi(e){return yp(e)}function yp(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:P(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:P(e,"updateTime")?new Date(e.updateTime):void 0}}function vp(e){return wp(e)}function wp(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function Ip(e){return bp(e)}function bp(e,t){return e==null?e:{provider:e.provider,read:P(e,"read")?e.read:void 0,write:P(e,"write")?e.write:void 0,proxy:P(e,"proxy")?cp(e.proxy):void 0}}function _p(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:e.read,write:e.write,proxy:Yc(e.proxy)}}function xp(e){return Cp(e)}function Cp(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:Ip(e.content)}}function Op(e){return Ep(e)}function Ep(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:P(e,"updateTime")?new Date(e.updateTime):void 0}}function Zc(e){return Sp(e)}function Sp(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:P(e,"updateTime")?new Date(e.updateTime):void 0}}function Np(e){return Tp(e)}function Tp(e,t){return e==null?e:{token:e.token}}function Rp(e){return Ap(e)}function Ap(e,t){return e==null?e:{token:e.token}}function Pp(e){return Dp(e)}function Dp(e,t){return e==null?e:{accessToken:P(e,"accessToken")?Np(e.accessToken):void 0,refreshToken:P(e,"refreshToken")?Rp(e.refreshToken):void 0,scopes:P(e,"scopes")?e.scopes:void 0}}function Fi(e){return Fp(e)}function Fp(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:P(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:P(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:P(e,"updateTime")?new Date(e.updateTime):void 0}}function Mi(e){return Mp(e)}function Mp(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:P(e,"providerApp")?Fi(e.providerApp):void 0,group:Zc(e.group),consumer:Op(e.consumer),providerWorkspaceRef:P(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerConsumerRef:P(e,"providerConsumerRef")?e.providerConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:P(e,"updateTime")?new Date(e.updateTime):void 0,authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:P(e,"oauth2AuthorizationCode")?Pp(e.oauth2AuthorizationCode):void 0,apiKey:P(e,"apiKey")?e.apiKey:void 0}}function jp(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:_p(e.content)}}function kp(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:jp(e.config)}}function Lp(e){return Kp(e)}function Kp(e,t){return e==null?e:{enabled:P(e,"enabled")?e.enabled:void 0}}function Vp(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function $p(e){return qp(e)}function qp(e,t){return e==null?e:{mode:P(e,"mode")?e.mode:void 0,pageSize:P(e,"pageSize")?e.pageSize:void 0}}function Up(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function Hp(e){let t=!0;return t=t&&"fieldName"in e,t}function Bp(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:P(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:P(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Wp(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function Jp(e){let t=!0;return t=t&&"mapToName"in e,t}function el(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:P(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:P(e,"default")?e.default:void 0,prompt:P(e,"prompt")?e.prompt:void 0}}function zp(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function Aa(e){return Gp(e)}function Gp(e,t){return e==null?e:{...Bp(e),...el(e)}}function Pa(e){if(e!==void 0)return e===null?null:Hp(e)?Wp(e):Jp(e)?zp(e):{}}function tl(e){return Qp(e)}function Qp(e,t){return e}function Xp(e){return Yp(e)}function Yp(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:P(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:P(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:P(e,"requiredFields")?e.requiredFields.map(Aa):void 0,optionalFields:P(e,"optionalFields")?e.optionalFields.map(Aa):void 0,optionalFieldsAuto:P(e,"optionalFieldsAuto")?tl(e.optionalFieldsAuto):void 0,backfill:P(e,"backfill")?Xc(e.backfill):void 0,delivery:P(e,"delivery")?$p(e.delivery):void 0}}function Zp(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(Pa),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(Pa),optionalFieldsAuto:e.optionalFieldsAuto,backfill:op(e.backfill),delivery:Up(e.delivery)}}function eh(e){return th(e)}function th(e,t){return e==null?e:{objects:P(e,"objects")?e.objects.map(Xp):void 0}}function nh(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Zp)}}function nl(e){return rh(e)}function rh(e,t){return e==null?e:{allowAnyFields:P(e,"allowAnyFields")?e.allowAnyFields:void 0}}function ih(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function oh(e){return sh(e)}function sh(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:P(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:P(e,"valueDefaults")?nl(e.valueDefaults):void 0}}function ah(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:ih(e.valueDefaults)}}function ch(e){return lh(e)}function lh(e,t){return e==null?e:{objects:P(e,"objects")?e.objects.map(oh):void 0}}function uh(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(ah)}}function dh(e){return fh(e)}function fh(e,t){return e==null?e:{name:e.name,displayName:P(e,"displayName")?e.displayName:void 0,provider:e.provider,read:P(e,"read")?eh(e.read):void 0,write:P(e,"write")?ch(e.write):void 0,proxy:P(e,"proxy")?Lp(e.proxy):void 0}}function ph(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:nh(e.read),write:uh(e.write),proxy:Vp(e.proxy)}}function hh(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:ph(e.content)}}function mh(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:hh(e.latestRevision)}}function gh(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function yh(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 vh(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function wh(e){return Ih(e)}function Ih(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function bh(e){return _h(e)}function _h(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,valueType:P(e,"valueType")?e.valueType:void 0,providerType:P(e,"providerType")?e.providerType:void 0,readOnly:P(e,"readOnly")?e.readOnly:void 0,values:P(e,"values")?e.values.map(wh):void 0}}function xh(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function Ch(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function Oh(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 Eh(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 Sh(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 Nh(e){if(e!==void 0)return e===null?null:{accessToken:Eh(e.accessToken),refreshToken:Sh(e.refreshToken),scopes:e.scopes}}function Th(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,basicAuth:xh(e.basicAuth),oauth2ClientCredentials:Ch(e.oauth2ClientCredentials),oauth2Password:Oh(e.oauth2Password),oauth2AuthorizationCode:Nh(e.oauth2AuthorizationCode)}}function Rh(e){return Ah(e)}function Ah(e,t){return e==null?e:{enabled:P(e,"enabled")?e.enabled:void 0}}function Ph(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,mapToName:P(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:P(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Co(e){return Dh(e)}function Dh(e,t){return e==null?e:{...Ph(e),...el(e)}}function Fh(e){return Mh(e)}function Mh(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,mapToName:P(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:P(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:P(e,"requiredFields")?e.requiredFields.map(Co):void 0,optionalFields:P(e,"optionalFields")?e.optionalFields.map(Co):void 0,optionalFieldsAuto:P(e,"optionalFieldsAuto")?tl(e.optionalFieldsAuto):void 0,allFields:P(e,"allFields")?e.allFields.map(Co):void 0,allFieldsMetadata:P(e,"allFieldsMetadata")?ro(e.allFieldsMetadata,bh):void 0,backfill:P(e,"backfill")?Xc(e.backfill):void 0}}function jh(e){return kh(e)}function kh(e,t){return e==null?e:{objects:P(e,"objects")?e.objects.map(Fh):void 0}}function Lh(e){return Kh(e)}function Kh(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:P(e,"valueDefaults")?nl(e.valueDefaults):void 0}}function Vh(e){return $h(e)}function $h(e,t){return e==null?e:{objects:P(e,"objects")?e.objects.map(Lh):void 0}}function qh(e){return Uh(e)}function Uh(e,t){return e==null?e:{name:e.name,displayName:P(e,"displayName")?e.displayName:void 0,provider:e.provider,read:P(e,"read")?jh(e.read):void 0,write:P(e,"write")?Vh(e.write):void 0,proxy:P(e,"proxy")?Rh(e.proxy):void 0}}function Hh(e){return Bh(e)}function Bh(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:qh(e.content)}}function Ei(e){return Wh(e)}function Wh(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:P(e,"group")?Zc(e.group):void 0,healthStatus:e.healthStatus,connection:Mi(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:P(e,"updateTime")?new Date(e.updateTime):void 0,config:xp(e.config)}}function Jh(e){return zh(e)}function zh(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:dh(e.content)}}function Da(e){return Gh(e)}function Gh(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:P(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:Jh(e.latestRevision)}}function Qh(e){return Xh(e)}function Xh(e,t){return e==null?e:{iconURL:P(e,"iconURL")?e.iconURL:void 0,logoURL:P(e,"logoURL")?e.logoURL:void 0}}function Yh(e){return Zh(e)}function Zh(e,t){return e==null?e:{iconURL:P(e,"iconURL")?e.iconURL:void 0,logoURL:P(e,"logoURL")?e.logoURL:void 0}}function em(e){return tm(e)}function tm(e,t){return e==null?e:{regular:P(e,"regular")?Yh(e.regular):void 0,darkMode:P(e,"darkMode")?Qh(e.darkMode):void 0}}function nm(e){return rm(e)}function rm(e,t){return e==null?e:{workspaceRefField:P(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:P(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:P(e,"scopesField")?e.scopesField:void 0}}function im(e){return om(e)}function om(e,t){return e==null?e:{grantType:e.grantType,authURL:P(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:P(e,"audience")?e.audience:void 0,tokenMetadataFields:nm(e.tokenMetadataFields),docsURL:P(e,"docsURL")?e.docsURL:void 0,authURLParams:P(e,"authURLParams")?e.authURLParams:void 0}}function sm(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,projectId:e.projectId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerAppId:e.providerAppId,provider:e.provider,enableCSRFProtection:e.enableCSRFProtection}}function am(e){return cm(e)}function cm(e,t){return e==null?e:{bulkWrite:vp(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write}}function Fa(e){return lm(e)}function lm(e,t){return e==null?e:{name:e.name,authType:Zf(e.authType),baseURL:e.baseURL,oauth2Opts:P(e,"oauth2Opts")?im(e.oauth2Opts):void 0,apiKeyOpts:P(e,"apiKeyOpts")?Xf(e.apiKeyOpts):void 0,basicOpts:P(e,"basicOpts")?hp(e.basicOpts):void 0,support:am(e.support),providerOpts:e.providerOpts,displayName:P(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:P(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:P(e,"media")?em(e.media):void 0,labels:P(e,"labels")?e.labels:void 0}}function um(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:dp(e.read),write:pp(e.write),proxy:Yc(e.proxy)}}function dm(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:um(e.content)}}function fm(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:dm(e.config)}}function pm(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:fm(e.installation)}}function hm(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function mm(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:hm(e.project)}}function gm(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 ym(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:gm(e.providerApp)}}class vm extends Qt{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new se("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 Zn(i)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("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:Th(t.generateConnectionParams)},n);return new Ke(i,s=>Mi(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 se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new se("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 Ke(i,s=>Mi(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 se("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 Ke(i,s=>s.map(Mi))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}}class wm extends Qt{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new se("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new se("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:kp(t.installation)},n);return new Ke(i,s=>Ei(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 se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new se("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new se("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 Zn(i)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new se("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new se("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 Ke(i,s=>Ei(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 se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new se("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 Ke(i,s=>s.map(Ei))}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 se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new se("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new se("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new se("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:pm(t.installationUpdate)},n);return new Ke(i,s=>Ei(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class Im extends Qt{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName 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:gp(t.batchUpsertIntegrationsRequest)},n);return new Ke(i,s=>s.map(Da))}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 se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new se("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:mh(t.integration)},n);return new Zn(i)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new se("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 Zn(i)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("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 Ke(i,s=>s.map(Da))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class bm extends Qt{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new se("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},o={};o["Content-Type"]="application/json";const i=await this.request({path:"/oauth-connect",method:"POST",headers:o,query:r,body:sm(t.connectOAuthParams)},n);return this.isJsonMime(i.headers.get("content-type"))?new Ke(i):new Hf(i)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}}class _m extends Qt{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new se("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:gh(t.project)},n);return new Ke(i,s=>Oi(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async deleteProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProject.");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}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"DELETE",headers:o,query:r},n);return new Zn(i)}async deleteProject(t,n){await this.deleteProjectRaw(t,n)}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");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}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Ke(i,s=>Oi(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 Ke(o,i=>i.map(Oi))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new se("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:mm(t.projectUpdate)},n);return new Ke(i,s=>Oi(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class xm extends Qt{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new se("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 Ke(i,s=>Fa(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 Ke(o,i=>ro(i,Fa))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class Cm extends Qt{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new se("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:yh(t.providerApp)},n);return new Ke(i,s=>Fi(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 se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new se("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 Zn(i)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("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 Ke(i,s=>s.map(Fi))}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 se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new se("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new se("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:ym(t.providerAppUpdate)},n);return new Ke(i,s=>Fi(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class Om extends Qt{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new se("integrationId","Required parameter requestParameters.integrationId 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:vh(t.revision)},n);return new Zn(i)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new se("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new se("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new se("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 Ke(i,s=>Hh(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class rl{constructor(t){this.connectionApi=new vm(t),this.installationApi=new wm(t),this.integrationApi=new Im(t),this.oAuthApi=new bm(t),this.projectApi=new _m(t),this.providerApi=new xm(t),this.providerAppApi=new Cm(t),this.revisionApi=new Om(t)}}const il="2.4.4",Em="v1",Si="https://api.withampersand.com";function ol(){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 Si;case"mock":return"http://127.0.0.1:4010";case"":return Si;default:return e??Si}}catch{return Si}}const Sm=(e,t)=>`${e}/${t}`;function Nm(){return Sm(ol(),Em)}const Tm=ol(),sl=Nm(),Rm=new xs({basePath:sl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":il}});let Am=new rl(Rm);const st=()=>Am;function Pr(){const e=Ut();return w.useCallback(async()=>{e||console.error("Unable to create API service without API key.");const n=new xs({basePath:sl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":il,"X-Api-Key":e}});return new rl(n)},[e])}const et=async(e,t)=>{var n;if(e instanceof zc){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
- `))||"[ERROR] Creating installation failed.";console.error("[Error Message]",a),t&&t(a)}catch(i){console.error("Error parsing error response body:",i)}}else console.error("Unexpected error:",e.message)},Pm=e=>{const t=Pr();return Ar({queryKey:["project",e],queryFn:async()=>(await t()).projectApi.getProject({projectIdOrName:e})})},al=w.createContext({project:null,appName:"",projectId:"",projectIdOrName:"",isLoading:!0}),je=()=>{const e=w.useContext(al);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e};function Dm({projectIdOrName:e,children:t}){const{setError:n}=Ht(),{data:r,isLoading:o,isError:i}=Pm(e);w.useEffect(()=>{i&&n(ye.PROJECT,e)},[i,e,n]);const s=w.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(al.Provider,{value:s,children:t})}const cl=w.createContext({integrations:null,isLoading:!0}),Cs=()=>{const e=w.useContext(cl);if(!e)throw new Error("useIntegrationList must be used within a IntegrationListProvider");return e};function Fm(){const e=Pr(),{projectIdOrName:t}=je();return Ar({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})}function Mm({children:e}){const{projectIdOrName:t}=je(),{setError:n,removeError:r}=Ht(),{data:o,isLoading:i,isError:s}=Fm();w.useEffect(()=>{s?(et(s),n(ye.INTEGRATION_LIST,t)):r(ye.INTEGRATION_LIST,t)},[s,t,r,n]);const a=w.useMemo(()=>({integrations:o||null,isLoading:i}),[o,i]);return l.jsx(cl.Provider,{value:a,children:e})}const jm=new wf;function km(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(xf,{client:jm,children:l.jsx(Lf,{children:l.jsx(jf,{value:t,children:l.jsx(Dm,{projectIdOrName:i,children:l.jsx(Mm,{children:o})})})})})}const ll=w.createContext(null);function Lm(){const e=w.useContext(ll);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
3
- component is wrapped with AmpersandProvider`);return e}function Km(){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 Vm="_box_1p7c5_1",Ma={box:Vm};function Pn({children:e,className:t,style:n}){return l.jsx("div",{className:t?`${Ma.box} ${t}`:Ma.box,style:n,children:e})}const $m="_container_1wvzr_1",ja={container:$m};function Dr({children:e,className:t,style:n}){return l.jsx("div",{className:t?`${ja.container} ${t}`:ja.container,style:n,children:e})}const qm="_errorBoxContainer_4sdb2_1",Um="_errorBox_4sdb2_1",Hm="_errorText_4sdb2_20",Oo={errorBoxContainer:qm,errorBox:Um,errorText:Hm};function ul({message:e}){return l.jsxs(Dr,{className:Oo.errorBoxContainer,children:[l.jsx(Km,{}),l.jsx(Pn,{className:Oo.errorBox,children:l.jsx("p",{className:Oo.errorText,children:e})})]})}const Bm="_loader_6ubm6_1",Wm="_rotate_6ubm6_1",Jm="_ball1_6ubm6_1",zm="_ball2_6ubm6_1",Gm={loader:Bm,rotate:Wm,ball1:Jm,ball2:zm};function Qm(){return l.jsx("span",{className:Gm.loader})}function zr(){return l.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:l.jsx(Qm,{})})}function dl({children:e}){return l.jsx(Dr,{style:{maxWidth:"55rem"},children:l.jsx(Pn,{children:e})})}function Fr(){return l.jsx(dl,{children:l.jsx(zr,{})})}function Gt({message:e}){return l.jsx(dl,{children:l.jsx(ul,{message:e})})}const fl=(e,t)=>{var s;const n=Pr(),{projectIdOrName:r}=je(),{integrations:o}=Cs(),i=(s=o==null?void 0:o.find(a=>a.name===e))==null?void 0:s.id;return Ar({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 Os(e,t){try{return process.env[e]}catch{return t}}function Gr(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Dn(e,t){return(t==null?void 0:t.displayName)??Gr(e)}const Xm=e=>e.split(`
4
- `).filter(n=>n.trim()!==""),Ym=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,Zm=()=>{const[e,t]=w.useState(!1),n=w.useCallback(()=>{t(!0)},[t]),r=w.useCallback(()=>{t(!1)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n,resetIntegrationDeleted:r}},pl=w.createContext({integrationId:"",provider:"",integrationObj:void 0,consumerRef:"",consumerName:"",groupRef:"",groupName:"",installation:void 0,setInstallation:()=>{},resetInstallations:()=>{},onInstallSuccess:void 0,onUpdateSuccess:void 0,onUninstallSuccess:void 0,isIntegrationDeleted:!1,setIntegrationDeleted:()=>{}});function tt(){const e=w.useContext(pl);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function eg({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,fieldMapping:u}){const{integrations:d}=Cs(),{setError:f,isError:m,removeError:p}=Ht(),{isIntegrationDeleted:g,setIntegrationDeleted:y,resetIntegrationDeleted:h}=Zm(),_=w.useMemo(()=>Ym(t,d||[]),[t,d]),{data:v,isLoading:x,isError:C,error:b}=fl(t,o),N=(v==null?void 0:v[0])||null;w.useEffect(()=>{h()},[t,n,r,o,i,u]),w.useEffect(()=>{_===null&&(d!=null&&d.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,_,d]),w.useEffect(()=>{C?(f(ye.INSTALLATION_LIST,(_==null?void 0:_.id)||""),et(b)):p(ye.INSTALLATION_LIST,(_==null?void 0:_.id)||"")},[C,_,f,p,b]);const R=ai(),S=w.useCallback(()=>{R.invalidateQueries({queryKey:["amp","installations"]})},[R]),F=w.useCallback(J=>{R.setQueryData(["amp","installations"],[J]),R.invalidateQueries({queryKey:["amp","installations"]})},[R]),q=(_==null?void 0:_.id)||"",z=w.useMemo(()=>({integrationId:(_==null?void 0:_.id)||"",provider:(_==null?void 0:_.provider)||"",integrationObj:_,consumerRef:n,consumerName:r,groupRef:o,groupName:i,installation:N||void 0,setInstallation:F,resetInstallations:S,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,isIntegrationDeleted:g,setIntegrationDeleted:y,fieldMapping:u}),[_,n,r,o,i,N,F,S,s,a,c,g,y,u]);if(x)return l.jsx(Fr,{});if(_===null)return l.jsx(Gt,{message:`Integration "${t}" not found`});if(m(ye.INSTALLATION_LIST,q)){const J=`Error retrieving installation information for integration "${(_==null?void 0:_.name)||"unknown"}"`;return l.jsx(Gt,{message:J})}return l.jsx(pl.Provider,{value:z,children:e})}const hl=w.createContext({connections:null,isConnectionsLoading:!0,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),Mr=()=>{const e=w.useContext(hl);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e},tg=()=>{const{projectIdOrName:e}=je(),{groupRef:t,provider:n}=tt(),r=Pr();return Ar({queryKey:["amp","connections",e,t,n],queryFn:async()=>{if(!e)throw new Error("Project ID or name not found. Please wrap this component inside of AmpersandProvider");if(!t)throw new Error("Group reference not found.");if(!n)throw new Error("Provider not found.");return(await r()).connectionApi.listConnections({projectIdOrName:e,groupRef:t,provider:n})},retry:3,enabled:!!e&&!!t&&!!n})};function ml({children:e}){const t=ai(),{setError:n,isError:r}=Ht(),{projectId:o,isLoading:i}=je(),{data:s,isLoading:a,isError:c,error:u}=tg(),d=s==null?void 0:s[0],f=w.useCallback(g=>{t.setQueryData(["amp","connections"],()=>g),t.invalidateQueries({queryKey:["amp","connections"]})},[t]),m=w.useCallback(()=>{t.invalidateQueries({queryKey:["amp","connections"]})},[t]);w.useEffect(()=>{c?(n(ye.CONNECTION_LIST,o,!0),et(u)):n(ye.CONNECTION_LIST,o,!1)},[c,n,o,u]);const p=w.useMemo(()=>({connections:s||null,isConnectionsLoading:a,selectedConnection:d||null,setConnections:f,setSelectedConnection:m}),[s,a,d,f,m]);if(a||i)return l.jsx(Fr,{});if(r(ye.PROJECT,o))return l.jsx(Gt,{message:`Error loading project ${o}`});if(r(ye.CONNECTION_LIST,o))return l.jsx(Gt,{message:"Error retrieving existing connections"});if(!o)throw new Error("Project ID not found. ConnectionsProvider must be used within AmpersandProvider");return l.jsx(hl.Provider,{value:p,children:e})}function gl(){const[e,t]=w.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}const ng="_resetContainer_lkwv9_4",yl={resetContainer:ng};var Ni=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Es(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $i={exports:{}};$i.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",o=1,i=2,s=9007199254740991,a="[object Arguments]",c="[object Array]",u="[object AsyncFunction]",d="[object Boolean]",f="[object Date]",m="[object Error]",p="[object Function]",g="[object GeneratorFunction]",y="[object Map]",h="[object Number]",_="[object Null]",v="[object Object]",x="[object Promise]",C="[object Proxy]",b="[object RegExp]",N="[object Set]",R="[object String]",S="[object Symbol]",F="[object Undefined]",q="[object WeakMap]",z="[object ArrayBuffer]",J="[object DataView]",ne="[object Float32Array]",B="[object Float64Array]",ce="[object Int8Array]",re="[object Int16Array]",X="[object Int32Array]",fe="[object Uint8Array]",ve="[object Uint8ClampedArray]",T="[object Uint16Array]",j="[object Uint32Array]",V=/[\\^$.*+?()[\]{}|]/g,L=/^\[object .+?Constructor\]$/,k=/^(?:0|[1-9]\d*)$/,D={};D[ne]=D[B]=D[ce]=D[re]=D[X]=D[fe]=D[ve]=D[T]=D[j]=!0,D[a]=D[c]=D[z]=D[d]=D[J]=D[f]=D[m]=D[p]=D[y]=D[h]=D[v]=D[b]=D[N]=D[R]=D[q]=!1;var Z=typeof Ni=="object"&&Ni&&Ni.Object===Object&&Ni,ee=typeof self=="object"&&self&&self.Object===Object&&self,U=Z||ee||Function("return this")(),te=t&&!t.nodeType&&t,G=te&&!0&&e&&!e.nodeType&&e,ue=G&&G.exports===te,M=ue&&Z.process,we=function(){try{return M&&M.binding&&M.binding("util")}catch{}}(),H=we&&we.isTypedArray;function Ee(I,E){for(var A=-1,Q=I==null?0:I.length,Te=0,de=[];++A<Q;){var Fe=I[A];E(Fe,A,I)&&(de[Te++]=Fe)}return de}function Le(I,E){for(var A=-1,Q=E.length,Te=I.length;++A<Q;)I[Te+A]=E[A];return I}function ze(I,E){for(var A=-1,Q=I==null?0:I.length;++A<Q;)if(E(I[A],A,I))return!0;return!1}function Ve(I,E){for(var A=-1,Q=Array(I);++A<I;)Q[A]=E(A);return Q}function Ie(I){return function(E){return I(E)}}function Rt(I,E){return I.has(E)}function Ge(I,E){return I==null?void 0:I[E]}function mt(I){var E=-1,A=Array(I.size);return I.forEach(function(Q,Te){A[++E]=[Te,Q]}),A}function At(I,E){return function(A){return I(E(A))}}function Pt(I){var E=-1,A=Array(I.size);return I.forEach(function(Q){A[++E]=Q}),A}var Qe=Array.prototype,Be=Function.prototype,$e=Object.prototype,Ae=U["__core-js_shared__"],Dt=Be.toString,nt=$e.hasOwnProperty,Zt=function(){var I=/[^.]+$/.exec(Ae&&Ae.keys&&Ae.keys.IE_PROTO||"");return I?"Symbol(src)_1."+I:""}(),fn=$e.toString,gt=RegExp("^"+Dt.call(nt).replace(V,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Pe=ue?U.Buffer:void 0,en=U.Symbol,pn=U.Uint8Array,tn=$e.propertyIsEnumerable,Mn=Qe.splice,ut=en?en.toStringTag:void 0,nn=Object.getOwnPropertySymbols,hn=Pe?Pe.isBuffer:void 0,jn=At(Object.keys,Object),mn=or(U,"DataView"),Re=or(U,"Map"),rt=or(U,"Promise"),ie=or(U,"Set"),he=or(U,"WeakMap"),qe=or(Object,"create"),rn=Kn(mn),W=Kn(Re),oe=Kn(rt),le=Kn(ie),ke=Kn(he),Ue=en?en.prototype:void 0,dt=Ue?Ue.valueOf:void 0;function We(I){var E=-1,A=I==null?0:I.length;for(this.clear();++E<A;){var Q=I[E];this.set(Q[0],Q[1])}}function Xe(){this.__data__=qe?qe(null):{},this.size=0}function ft(I){var E=this.has(I)&&delete this.__data__[I];return this.size-=E?1:0,E}function Ne(I){var E=this.__data__;if(qe){var A=E[I];return A===r?void 0:A}return nt.call(E,I)?E[I]:void 0}function kn(I){var E=this.__data__;return qe?E[I]!==void 0:nt.call(E,I)}function wo(I,E){var A=this.__data__;return this.size+=this.has(I)?0:1,A[I]=qe&&E===void 0?r:E,this}We.prototype.clear=Xe,We.prototype.delete=ft,We.prototype.get=Ne,We.prototype.has=kn,We.prototype.set=wo;function Ct(I){var E=-1,A=I==null?0:I.length;for(this.clear();++E<A;){var Q=I[E];this.set(Q[0],Q[1])}}function hi(){this.__data__=[],this.size=0}function mi(I){var E=this.__data__,A=vi(E,I);if(A<0)return!1;var Q=E.length-1;return A==Q?E.pop():Mn.call(E,A,1),--this.size,!0}function gi(I){var E=this.__data__,A=vi(E,I);return A<0?void 0:E[A][1]}function Se(I){return vi(this.__data__,I)>-1}function Ft(I,E){var A=this.__data__,Q=vi(A,I);return Q<0?(++this.size,A.push([I,E])):A[Q][1]=E,this}Ct.prototype.clear=hi,Ct.prototype.delete=mi,Ct.prototype.get=gi,Ct.prototype.has=Se,Ct.prototype.set=Ft;function Mt(I){var E=-1,A=I==null?0:I.length;for(this.clear();++E<A;){var Q=I[E];this.set(Q[0],Q[1])}}function Ln(){this.size=0,this.__data__={hash:new We,map:new(Re||Ct),string:new We}}function Io(I){var E=wi(this,I).delete(I);return this.size-=E?1:0,E}function Lr(I){return wi(this,I).get(I)}function Ed(I){return wi(this,I).has(I)}function Sd(I,E){var A=wi(this,I),Q=A.size;return A.set(I,E),this.size+=A.size==Q?0:1,this}Mt.prototype.clear=Ln,Mt.prototype.delete=Io,Mt.prototype.get=Lr,Mt.prototype.has=Ed,Mt.prototype.set=Sd;function yi(I){var E=-1,A=I==null?0:I.length;for(this.__data__=new Mt;++E<A;)this.add(I[E])}function Nd(I){return this.__data__.set(I,r),this}function Td(I){return this.__data__.has(I)}yi.prototype.add=yi.prototype.push=Nd,yi.prototype.has=Td;function gn(I){var E=this.__data__=new Ct(I);this.size=E.size}function Rd(){this.__data__=new Ct,this.size=0}function Ad(I){var E=this.__data__,A=E.delete(I);return this.size=E.size,A}function Pd(I){return this.__data__.get(I)}function Dd(I){return this.__data__.has(I)}function Fd(I,E){var A=this.__data__;if(A instanceof Ct){var Q=A.__data__;if(!Re||Q.length<n-1)return Q.push([I,E]),this.size=++A.size,this;A=this.__data__=new Mt(Q)}return A.set(I,E),this.size=A.size,this}gn.prototype.clear=Rd,gn.prototype.delete=Ad,gn.prototype.get=Pd,gn.prototype.has=Dd,gn.prototype.set=Fd;function Md(I,E){var A=Ii(I),Q=!A&&Qd(I),Te=!A&&!Q&&bo(I),de=!A&&!Q&&!Te&&va(I),Fe=A||Q||Te||de,Je=Fe?Ve(I.length,String):[],Ye=Je.length;for(var De in I)nt.call(I,De)&&!(Fe&&(De=="length"||Te&&(De=="offset"||De=="parent")||de&&(De=="buffer"||De=="byteLength"||De=="byteOffset")||Bd(De,Ye)))&&Je.push(De);return Je}function vi(I,E){for(var A=I.length;A--;)if(ha(I[A][0],E))return A;return-1}function jd(I,E,A){var Q=E(I);return Ii(I)?Q:Le(Q,A(I))}function Kr(I){return I==null?I===void 0?F:_:ut&&ut in Object(I)?Ud(I):Gd(I)}function ua(I){return Vr(I)&&Kr(I)==a}function da(I,E,A,Q,Te){return I===E?!0:I==null||E==null||!Vr(I)&&!Vr(E)?I!==I&&E!==E:kd(I,E,A,Q,da,Te)}function kd(I,E,A,Q,Te,de){var Fe=Ii(I),Je=Ii(E),Ye=Fe?c:yn(I),De=Je?c:yn(E);Ye=Ye==a?v:Ye,De=De==a?v:De;var yt=Ye==v,jt=De==v,it=Ye==De;if(it&&bo(I)){if(!bo(E))return!1;Fe=!0,yt=!1}if(it&&!yt)return de||(de=new gn),Fe||va(I)?fa(I,E,A,Q,Te,de):$d(I,E,Ye,A,Q,Te,de);if(!(A&o)){var Ot=yt&&nt.call(I,"__wrapped__"),Et=jt&&nt.call(E,"__wrapped__");if(Ot||Et){var vn=Ot?I.value():I,on=Et?E.value():E;return de||(de=new gn),Te(vn,on,A,Q,de)}}return it?(de||(de=new gn),qd(I,E,A,Q,Te,de)):!1}function Ld(I){if(!ya(I)||Jd(I))return!1;var E=ma(I)?gt:L;return E.test(Kn(I))}function Kd(I){return Vr(I)&&ga(I.length)&&!!D[Kr(I)]}function Vd(I){if(!zd(I))return jn(I);var E=[];for(var A in Object(I))nt.call(I,A)&&A!="constructor"&&E.push(A);return E}function fa(I,E,A,Q,Te,de){var Fe=A&o,Je=I.length,Ye=E.length;if(Je!=Ye&&!(Fe&&Ye>Je))return!1;var De=de.get(I);if(De&&de.get(E))return De==E;var yt=-1,jt=!0,it=A&i?new yi:void 0;for(de.set(I,E),de.set(E,I);++yt<Je;){var Ot=I[yt],Et=E[yt];if(Q)var vn=Fe?Q(Et,Ot,yt,E,I,de):Q(Ot,Et,yt,I,E,de);if(vn!==void 0){if(vn)continue;jt=!1;break}if(it){if(!ze(E,function(on,Vn){if(!Rt(it,Vn)&&(Ot===on||Te(Ot,on,A,Q,de)))return it.push(Vn)})){jt=!1;break}}else if(!(Ot===Et||Te(Ot,Et,A,Q,de))){jt=!1;break}}return de.delete(I),de.delete(E),jt}function $d(I,E,A,Q,Te,de,Fe){switch(A){case J:if(I.byteLength!=E.byteLength||I.byteOffset!=E.byteOffset)return!1;I=I.buffer,E=E.buffer;case z:return!(I.byteLength!=E.byteLength||!de(new pn(I),new pn(E)));case d:case f:case h:return ha(+I,+E);case m:return I.name==E.name&&I.message==E.message;case b:case R:return I==E+"";case y:var Je=mt;case N:var Ye=Q&o;if(Je||(Je=Pt),I.size!=E.size&&!Ye)return!1;var De=Fe.get(I);if(De)return De==E;Q|=i,Fe.set(I,E);var yt=fa(Je(I),Je(E),Q,Te,de,Fe);return Fe.delete(I),yt;case S:if(dt)return dt.call(I)==dt.call(E)}return!1}function qd(I,E,A,Q,Te,de){var Fe=A&o,Je=pa(I),Ye=Je.length,De=pa(E),yt=De.length;if(Ye!=yt&&!Fe)return!1;for(var jt=Ye;jt--;){var it=Je[jt];if(!(Fe?it in E:nt.call(E,it)))return!1}var Ot=de.get(I);if(Ot&&de.get(E))return Ot==E;var Et=!0;de.set(I,E),de.set(E,I);for(var vn=Fe;++jt<Ye;){it=Je[jt];var on=I[it],Vn=E[it];if(Q)var wa=Fe?Q(Vn,on,it,E,I,de):Q(on,Vn,it,I,E,de);if(!(wa===void 0?on===Vn||Te(on,Vn,A,Q,de):wa)){Et=!1;break}vn||(vn=it=="constructor")}if(Et&&!vn){var bi=I.constructor,_i=E.constructor;bi!=_i&&"constructor"in I&&"constructor"in E&&!(typeof bi=="function"&&bi instanceof bi&&typeof _i=="function"&&_i instanceof _i)&&(Et=!1)}return de.delete(I),de.delete(E),Et}function pa(I){return jd(I,Zd,Hd)}function wi(I,E){var A=I.__data__;return Wd(E)?A[typeof E=="string"?"string":"hash"]:A.map}function or(I,E){var A=Ge(I,E);return Ld(A)?A:void 0}function Ud(I){var E=nt.call(I,ut),A=I[ut];try{I[ut]=void 0;var Q=!0}catch{}var Te=fn.call(I);return Q&&(E?I[ut]=A:delete I[ut]),Te}var Hd=nn?function(I){return I==null?[]:(I=Object(I),Ee(nn(I),function(E){return tn.call(I,E)}))}:ef,yn=Kr;(mn&&yn(new mn(new ArrayBuffer(1)))!=J||Re&&yn(new Re)!=y||rt&&yn(rt.resolve())!=x||ie&&yn(new ie)!=N||he&&yn(new he)!=q)&&(yn=function(I){var E=Kr(I),A=E==v?I.constructor:void 0,Q=A?Kn(A):"";if(Q)switch(Q){case rn:return J;case W:return y;case oe:return x;case le:return N;case ke:return q}return E});function Bd(I,E){return E=E??s,!!E&&(typeof I=="number"||k.test(I))&&I>-1&&I%1==0&&I<E}function Wd(I){var E=typeof I;return E=="string"||E=="number"||E=="symbol"||E=="boolean"?I!=="__proto__":I===null}function Jd(I){return!!Zt&&Zt in I}function zd(I){var E=I&&I.constructor,A=typeof E=="function"&&E.prototype||$e;return I===A}function Gd(I){return fn.call(I)}function Kn(I){if(I!=null){try{return Dt.call(I)}catch{}try{return I+""}catch{}}return""}function ha(I,E){return I===E||I!==I&&E!==E}var Qd=ua(function(){return arguments}())?ua:function(I){return Vr(I)&&nt.call(I,"callee")&&!tn.call(I,"callee")},Ii=Array.isArray;function Xd(I){return I!=null&&ga(I.length)&&!ma(I)}var bo=hn||tf;function Yd(I,E){return da(I,E)}function ma(I){if(!ya(I))return!1;var E=Kr(I);return E==p||E==g||E==u||E==C}function ga(I){return typeof I=="number"&&I>-1&&I%1==0&&I<=s}function ya(I){var E=typeof I;return I!=null&&(E=="object"||E=="function")}function Vr(I){return I!=null&&typeof I=="object"}var va=H?Ie(H):Kd;function Zd(I){return Xd(I)?Md(I):Vd(I)}function ef(){return[]}function tf(){return!1}e.exports=Yd})($i,$i.exports);var rg=$i.exports;const vl=Es(rg),er="other",qi="uninstall-installation";function Tn(e){return!e.fieldName}function Ss(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function ig(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!Tn(n)&&!!n.fieldName))||null}function og(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>Tn(r)&&!!r.mapToName))||[]}function sg(e){var n;return((n=e==null?void 0:e.optionalFields)==null?void 0:n.filter(r=>Tn(r)&&!!r.mapToName))||[]}function ag(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!Tn(n)&&!!n.fieldName))||null}const wl=(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 cg(e){return Tn(e)?e.mapToName:e.fieldName}const Il=(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)&&Gr(s==null?void 0:s.objectName),completed:e?!!wl(e,s.objectName):!1})}),n},bl=e=>{var n;return{name:er,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function lg(e,t){var i;const n=Il(e,t),o=!!((i=t==null?void 0:t.content)!=null&&i.write)?bl(e):void 0;return o&&n.push(o),n}function _l(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(ye.MAPPING,o),r!=null&&r.length&&console.error("required fields not met",r.map(i=>i.mapToDisplayName)),{errorList:o}}function xl(e,t){return vl(e,t)}function Cl(e,t){return vl(e,t)}const ug=(e,t,n)=>{var h,_,v,x,C,b,N,R,S;if(!e)return null;const r=Ss(e,t),o=r&&ig(r),i=r&&ag(r),s=r&&og(r),a=r&&sg(r),c=(r==null?void 0:r.allFields)||[],u=(r==null?void 0:r.allFieldsMetadata)||{},d=n==null?void 0:n.content,f=((v=(_=(h=d==null?void 0:d.read)==null?void 0:h.objects)==null?void 0:_[t])==null?void 0:v.selectedFields)||{},m=((b=(C=(x=d==null?void 0:d.read)==null?void 0:x.objects)==null?void 0:C[t])==null?void 0:b.selectedValueMappings)||{},p=((S=(R=(N=d==null?void 0:d.read)==null?void 0:N.objects)==null?void 0:R[t])==null?void 0:S.selectedFieldMappings)||{},g={...f},y={...p};return{allFields:c,allFieldsMetadata:u,requiredFields:o,optionalFields:i,requiredMapFields:s,optionalMapFields:a,selectedOptionalFields:f,selectedFieldMappings:p,selectedValueMappings:m,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,isValueMappingsModified:!1,savedConfig:{optionalFields:g,requiredMapFields:y,selectedValueMappings:m}}},dg=(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 Ol(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:ug(r,t,n),write:dg(o,n)}}const El=(e,t,n,r)=>{const o=Ol(e,n,t);r(n,o)},fg=(e,t,n)=>{const r=lg(t,e),o={};r.forEach(({name:i,completed:s})=>{s&&(o[i]=Ol(e,i,t))}),n(o)},Sl=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(i=>r.add(cg(i))),{...Array.from(r).reduce((i,s)=>({...i,[s]:!0}),{}),...n||{}}},Nl=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},Tl=e=>{const{selectedValueMappings:t}=(e==null?void 0:e.read)||{};return t};function Rl(e,t){return t[e]||void 0}async function Ns({createConfig:e,projectId:t,integrationId:n,groupRef:r,connectionId:o,apiKey:i,setError:s,setInstallation:a,onInstallSuccess:c}){const u={projectIdOrName:t,integrationId:n,installation:{groupRef:r,connectionId:o,config:e}};try{const d=await st().installationApi.createInstallation(u,{headers:{"X-Api-Key":i,"Content-Type":"application/json"}});a(d),c==null||c(d.id,d.config)}catch(d){et(d,s)}}function io(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const pg=(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)},hg=(e,t,n,r)=>{const o=Sl(e),i=Nl(e),s=Tl(e),a=pg(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 io(n)&&(c.content.proxy={enabled:!0}),c},mg=(e,t,n,r,o,i,s,a,c,u,d,f)=>{const m=hg(c,i,a,r);return m?Ns({createConfig:m,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:s,setError:u,setInstallation:d,onInstallSuccess:f}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},Al=e=>{var t;return{...(t=e.write)==null?void 0:t.selectedWriteObjects}},gg=e=>{const t=e.content.write;return t==null?void 0:t.objects},yg=(e,t,n)=>{if(!gg(t))return console.error("Error when getting write objects from hydratedRevision"),null;const o=Al(e),i={revisionId:t.id,createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:o}}};return io(t)&&(i.content.proxy={enabled:!0}),i},vg=(e,t,n,r,o,i,s,a,c,u,d)=>{const f=yg(a,s,r);return f?Ns({createConfig:f,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:i,setError:c,setInstallation:u,onInstallSuccess:d}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},wg={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 Pl({children:e,style:t}){return l.jsx(Pn,{style:{...wg,...t},children:e})}var Dl={exports:{}};/*!
1
+ "use strict";var Ra=e=>{throw TypeError(e)};var Ro=(e,t,n)=>t.has(e)||Ra("Cannot "+n);var O=(e,t,n)=>(Ro(e,t,"read from private field"),n?n.call(e):t.get(e)),ie=(e,t,n)=>t.has(e)?Ra("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),J=(e,t,n,r)=>(Ro(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),pe=(e,t,n)=>(Ro(e,t,"access private method"),n);var Ti=(e,t,n,r)=>({set _(o){J(e,t,o,n)},get _(){return O(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),v=require("react");require("react-dom");function yf(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=yf(v);var $r=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},rr=typeof window>"u"||"Deno"in globalThis;function Tt(){}function vf(e,t){return typeof e=="function"?e(t):e}function Go(e){return typeof e=="number"&&e>=0&&e!==1/0}function Wc(e,t){return Math.max(e+(t||0)-Date.now(),0)}function yr(e,t){return typeof e=="function"?e(t):e}function Kt(e,t){return typeof e=="function"?e(t):e}function Aa(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==Ts(s,t.options))return!1}else if(!ni(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 Pa(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(ir(t.options.mutationKey)!==ir(i))return!1}else if(!ni(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function Ts(e,t){return((t==null?void 0:t.queryKeyHashFn)||ir)(e)}function ir(e){return JSON.stringify(e,(t,n)=>Xo(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function ni(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!ni(e[n],t[n])):!1}function Qo(e,t){if(e===t)return e;const n=Da(e)&&Da(t);if(n||Xo(e)&&Xo(t)){const r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),s=i.length,a=n?[]:{};let c=0;for(let u=0;u<s;u++){const d=n?u:i[u];(!n&&r.includes(d)||n)&&e[d]===void 0&&t[d]===void 0?(a[d]=void 0,c++):(a[d]=Qo(e[d],t[d]),a[d]===e[d]&&e[d]!==void 0&&c++)}return o===s&&c===o?e:a}return t}function Wi(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 Da(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Xo(e){if(!Ma(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Ma(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Ma(e){return Object.prototype.toString.call(e)==="[object Object]"}function wf(e){return new Promise(t=>{setTimeout(t,e)})}function Yo(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 Qo(e,t)}catch(r){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}`)}return Qo(e,t)}return t}function If(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function bf(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Ji=Symbol();function Jc(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Ji&&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===Ji?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var zn,_n,wr,kc,_f=(kc=class extends $r{constructor(){super();ie(this,zn);ie(this,_n);ie(this,wr);J(this,wr,t=>{if(!rr&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){O(this,_n)||this.setEventListener(O(this,wr))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,_n))==null||t.call(this),J(this,_n,void 0))}setEventListener(t){var n;J(this,wr,t),(n=O(this,_n))==null||n.call(this),J(this,_n,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){O(this,zn)!==t&&(J(this,zn,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof O(this,zn)=="boolean"?O(this,zn):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},zn=new WeakMap,_n=new WeakMap,wr=new WeakMap,kc),Rs=new _f,Ir,xn,br,jc,xf=(jc=class extends $r{constructor(){super();ie(this,Ir,!0);ie(this,xn);ie(this,br);J(this,br,t=>{if(!rr&&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(){O(this,xn)||this.setEventListener(O(this,br))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,xn))==null||t.call(this),J(this,xn,void 0))}setEventListener(t){var n;J(this,br,t),(n=O(this,xn))==null||n.call(this),J(this,xn,t(this.setOnline.bind(this)))}setOnline(t){O(this,Ir)!==t&&(J(this,Ir,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return O(this,Ir)}},Ir=new WeakMap,xn=new WeakMap,br=new WeakMap,jc),zi=new xf;function Zo(){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 Cf(e){return Math.min(1e3*2**e,3e4)}function zc(e){return(e??"online")==="online"?zi.isOnline():!0}var Gc=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Ao(e){return e instanceof Gc}function Qc(e){let t=!1,n=0,r=!1,o;const i=Zo(),s=w=>{var h;r||(p(new Gc(w)),(h=e.abort)==null||h.call(e))},a=()=>{t=!0},c=()=>{t=!1},u=()=>Rs.isFocused()&&(e.networkMode==="always"||zi.isOnline())&&e.canRun(),d=()=>zc(e.networkMode)&&e.canRun(),f=w=>{var h;r||(r=!0,(h=e.onSuccess)==null||h.call(e,w),o==null||o(),i.resolve(w))},p=w=>{var h;r||(r=!0,(h=e.onError)==null||h.call(e,w),o==null||o(),i.reject(w))},m=()=>new Promise(w=>{var h;o=x=>{(r||u())&&w(x)},(h=e.onPause)==null||h.call(e)}).then(()=>{var w;o=void 0,r||(w=e.onContinue)==null||w.call(e)}),g=()=>{if(r)return;let w;const h=n===0?e.initialPromise:void 0;try{w=h??e.fn()}catch(x){w=Promise.reject(x)}Promise.resolve(w).then(f).catch(x=>{var S;if(r)return;const y=e.retry??(rr?0:3),b=e.retryDelay??Cf,C=typeof b=="function"?b(n,x):b,_=y===!0||typeof y=="number"&&n<y||typeof y=="function"&&y(n,x);if(t||!_){p(x);return}n++,(S=e.onFail)==null||S.call(e,n,x),wf(C).then(()=>u()?void 0:m()).then(()=>{t?p(x):g()})})};return{promise:i,cancel:s,continue:()=>(o==null||o(),i),cancelRetry:a,continueRetry:c,canStart:d,start:()=>(d()?g():m().then(g),i)}}function Of(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=a=>setTimeout(a,0);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 Be=Of(),Gn,Lc,Xc=(Lc=class{constructor(){ie(this,Gn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Go(this.gcTime)&&J(this,Gn,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(rr?1/0:5*60*1e3))}clearGcTimeout(){O(this,Gn)&&(clearTimeout(O(this,Gn)),J(this,Gn,void 0))}},Gn=new WeakMap,Lc),_r,xr,Nt,Qn,it,ui,Xn,Lt,sn,Vc,Ef=(Vc=class extends Xc{constructor(t){super();ie(this,Lt);ie(this,_r);ie(this,xr);ie(this,Nt);ie(this,Qn);ie(this,it);ie(this,ui);ie(this,Xn);J(this,Xn,!1),J(this,ui,t.defaultOptions),this.setOptions(t.options),this.observers=[],J(this,Qn,t.client),J(this,Nt,O(this,Qn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,J(this,_r,Sf(this.options)),this.state=t.state??O(this,_r),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=O(this,it))==null?void 0:t.promise}setOptions(t){this.options={...O(this,ui),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&O(this,Nt).remove(this)}setData(t,n){const r=Yo(this.state.data,t,this.options);return pe(this,Lt,sn).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,Lt,sn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=O(this,it))==null?void 0:r.promise;return(o=O(this,it))==null||o.cancel(t),n?n.then(Tt).catch(Tt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(O(this,_r))}isActive(){return this.observers.some(t=>Kt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ji||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!Wc(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=O(this,it))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=O(this,it))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),O(this,Nt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(O(this,it)&&(O(this,Xn)?O(this,it).cancel({revert:!0}):O(this,it).cancelRetry()),this.scheduleGc()),O(this,Nt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||pe(this,Lt,sn).call(this,{type:"invalidate"})}fetch(t,n){var c,u,d;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(O(this,it))return O(this,it).continueRetry(),O(this,it).promise}if(t&&this.setOptions(t),!this.options.queryFn){const f=this.observers.find(p=>p.options.queryFn);f&&this.setOptions(f.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=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(J(this,Xn,!0),r.signal)})},i=()=>{const f=Jc(this.options,n),p={client:O(this,Qn),queryKey:this.queryKey,meta:this.meta};return o(p),J(this,Xn,!1),this.options.persister?this.options.persister(f,p,this):f(p)},s={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:O(this,Qn),state:this.state,fetchFn:i};o(s),(c=this.options.behavior)==null||c.onFetch(s,this),J(this,xr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=s.fetchOptions)==null?void 0:u.meta))&&pe(this,Lt,sn).call(this,{type:"fetch",meta:(d=s.fetchOptions)==null?void 0:d.meta});const a=f=>{var p,m,g,w;Ao(f)&&f.silent||pe(this,Lt,sn).call(this,{type:"error",error:f}),Ao(f)||((m=(p=O(this,Nt).config).onError)==null||m.call(p,f,this),(w=(g=O(this,Nt).config).onSettled)==null||w.call(g,this.state.data,f,this)),this.scheduleGc()};return J(this,it,Qc({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:f=>{var p,m,g,w;if(f===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}`),a(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(h){a(h);return}(m=(p=O(this,Nt).config).onSuccess)==null||m.call(p,f,this),(w=(g=O(this,Nt).config).onSettled)==null||w.call(g,f,this.state.error,this),this.scheduleGc()},onError:a,onFail:(f,p)=>{pe(this,Lt,sn).call(this,{type:"failed",failureCount:f,error:p})},onPause:()=>{pe(this,Lt,sn).call(this,{type:"pause"})},onContinue:()=>{pe(this,Lt,sn).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),O(this,it).start()}},_r=new WeakMap,xr=new WeakMap,Nt=new WeakMap,Qn=new WeakMap,it=new WeakMap,ui=new WeakMap,Xn=new WeakMap,Lt=new WeakSet,sn=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,...Yc(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 Ao(o)&&o.revert&&O(this,xr)?{...O(this,xr),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),Be.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),O(this,Nt).notify({query:this,type:"updated",action:t})})},Vc);function Yc(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:zc(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Sf(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 Ht,Kc,Nf=(Kc=class extends $r{constructor(t={}){super();ie(this,Ht);this.config=t,J(this,Ht,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??Ts(o,n);let s=this.get(i);return s||(s=new Ef({client:t,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){O(this,Ht).has(t.queryHash)||(O(this,Ht).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=O(this,Ht).get(t.queryHash);n&&(t.destroy(),n===t&&O(this,Ht).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Be.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return O(this,Ht).get(t)}getAll(){return[...O(this,Ht).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Aa(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Aa(t,r)):n}notify(t){Be.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Be.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Be.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Ht=new WeakMap,Kc),Bt,st,Yn,Wt,bn,$c,Tf=($c=class extends Xc{constructor(t){super();ie(this,Wt);ie(this,Bt);ie(this,st);ie(this,Yn);this.mutationId=t.mutationId,J(this,st,t.mutationCache),J(this,Bt,[]),this.state=t.state||Zc(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){O(this,Bt).includes(t)||(O(this,Bt).push(t),this.clearGcTimeout(),O(this,st).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){J(this,Bt,O(this,Bt).filter(n=>n!==t)),this.scheduleGc(),O(this,st).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){O(this,Bt).length||(this.state.status==="pending"?this.scheduleGc():O(this,st).remove(this))}continue(){var t;return((t=O(this,Yn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,s,a,c,u,d,f,p,m,g,w,h,x,y,b,C,_,S,T;J(this,Yn,Qc({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(N,P)=>{pe(this,Wt,bn).call(this,{type:"failed",failureCount:N,error:P})},onPause:()=>{pe(this,Wt,bn).call(this,{type:"pause"})},onContinue:()=>{pe(this,Wt,bn).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>O(this,st).canRun(this)}));const n=this.state.status==="pending",r=!O(this,Yn).canStart();try{if(!n){pe(this,Wt,bn).call(this,{type:"pending",variables:t,isPaused:r}),await((i=(o=O(this,st).config).onMutate)==null?void 0:i.call(o,t,this));const P=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,t));P!==this.state.context&&pe(this,Wt,bn).call(this,{type:"pending",context:P,variables:t,isPaused:r})}const N=await O(this,Yn).start();return await((u=(c=O(this,st).config).onSuccess)==null?void 0:u.call(c,N,t,this.state.context,this)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,N,t,this.state.context)),await((m=(p=O(this,st).config).onSettled)==null?void 0:m.call(p,N,null,this.state.variables,this.state.context,this)),await((w=(g=this.options).onSettled)==null?void 0:w.call(g,N,null,t,this.state.context)),pe(this,Wt,bn).call(this,{type:"success",data:N}),N}catch(N){try{throw await((x=(h=O(this,st).config).onError)==null?void 0:x.call(h,N,t,this.state.context,this)),await((b=(y=this.options).onError)==null?void 0:b.call(y,N,t,this.state.context)),await((_=(C=O(this,st).config).onSettled)==null?void 0:_.call(C,void 0,N,this.state.variables,this.state.context,this)),await((T=(S=this.options).onSettled)==null?void 0:T.call(S,void 0,N,t,this.state.context)),N}finally{pe(this,Wt,bn).call(this,{type:"error",error:N})}}finally{O(this,st).runNext(this)}}},Bt=new WeakMap,st=new WeakMap,Yn=new WeakMap,Wt=new WeakSet,bn=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),Be.batch(()=>{O(this,Bt).forEach(r=>{r.onMutationUpdate(t)}),O(this,st).notify({mutation:this,type:"updated",action:t})})},$c);function Zc(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var an,Vt,di,qc,Rf=(qc=class extends $r{constructor(t={}){super();ie(this,an);ie(this,Vt);ie(this,di);this.config=t,J(this,an,new Set),J(this,Vt,new Map),J(this,di,0)}build(t,n,r){const o=new Tf({mutationCache:this,mutationId:++Ti(this,di)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){O(this,an).add(t);const n=Ri(t);if(typeof n=="string"){const r=O(this,Vt).get(n);r?r.push(t):O(this,Vt).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(O(this,an).delete(t)){const n=Ri(t);if(typeof n=="string"){const r=O(this,Vt).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&O(this,Vt).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Ri(t);if(typeof n=="string"){const r=O(this,Vt).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=Ri(t);if(typeof n=="string"){const o=(r=O(this,Vt).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(){Be.batch(()=>{O(this,an).forEach(t=>{this.notify({type:"removed",mutation:t})}),O(this,an).clear(),O(this,Vt).clear()})}getAll(){return Array.from(O(this,an))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Pa(n,r))}findAll(t={}){return this.getAll().filter(n=>Pa(t,n))}notify(t){Be.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Be.batch(()=>Promise.all(t.map(n=>n.continue().catch(Tt))))}},an=new WeakMap,Vt=new WeakMap,di=new WeakMap,qc);function Ri(e){var t;return(t=e.options.scope)==null?void 0:t.id}function Fa(e){return{onFetch:(t,n)=>{var d,f,p,m,g;const r=t.options,o=(p=(f=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:p.direction,i=((m=t.state.data)==null?void 0:m.pages)||[],s=((g=t.state.data)==null?void 0:g.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const u=async()=>{let w=!1;const h=b=>{Object.defineProperty(b,"signal",{enumerable:!0,get:()=>(t.signal.aborted?w=!0:t.signal.addEventListener("abort",()=>{w=!0}),t.signal)})},x=Jc(t.options,t.fetchOptions),y=async(b,C,_)=>{if(w)return Promise.reject();if(C==null&&b.pages.length)return Promise.resolve(b);const S={client:t.client,queryKey:t.queryKey,pageParam:C,direction:_?"backward":"forward",meta:t.options.meta};h(S);const T=await x(S),{maxPages:N}=t.options,P=_?bf:If;return{pages:P(b.pages,T,N),pageParams:P(b.pageParams,C,N)}};if(o&&i.length){const b=o==="backward",C=b?Af:ka,_={pages:i,pageParams:s},S=C(r,_);a=await y(_,S,b)}else{const b=e??i.length;do{const C=c===0?s[0]??r.initialPageParam:ka(r,a);if(c>0&&C==null)break;a=await y(a,C),c++}while(c<b)}return a};t.options.persister?t.fetchFn=()=>{var w,h;return(h=(w=t.options).persister)==null?void 0:h.call(w,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function ka(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 Af(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 Fe,Cn,On,Cr,Or,En,Er,Sr,Uc,Pf=(Uc=class{constructor(e={}){ie(this,Fe);ie(this,Cn);ie(this,On);ie(this,Cr);ie(this,Or);ie(this,En);ie(this,Er);ie(this,Sr);J(this,Fe,e.queryCache||new Nf),J(this,Cn,e.mutationCache||new Rf),J(this,On,e.defaultOptions||{}),J(this,Cr,new Map),J(this,Or,new Map),J(this,En,0)}mount(){Ti(this,En)._++,O(this,En)===1&&(J(this,Er,Rs.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Fe).onFocus())})),J(this,Sr,zi.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Fe).onOnline())})))}unmount(){var e,t;Ti(this,En)._--,O(this,En)===0&&((e=O(this,Er))==null||e.call(this),J(this,Er,void 0),(t=O(this,Sr))==null||t.call(this),J(this,Sr,void 0))}isFetching(e){return O(this,Fe).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return O(this,Cn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=O(this,Fe).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=O(this,Fe).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(yr(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return O(this,Fe).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=O(this,Fe).get(r.queryHash),i=o==null?void 0:o.state.data,s=vf(t,i);if(s!==void 0)return O(this,Fe).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return Be.batch(()=>O(this,Fe).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=O(this,Fe).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=O(this,Fe);Be.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=O(this,Fe),r={type:"active",...e};return Be.batch(()=>(n.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries(r,t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Be.batch(()=>O(this,Fe).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Tt).catch(Tt)}invalidateQueries(e,t={}){return Be.batch(()=>{if(O(this,Fe).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none")return Promise.resolve();const n={...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"};return this.refetchQueries(n,t)})}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Be.batch(()=>O(this,Fe).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(Tt)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Tt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=O(this,Fe).build(this,t);return n.isStaleByTime(yr(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Tt).catch(Tt)}fetchInfiniteQuery(e){return e.behavior=Fa(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Tt).catch(Tt)}ensureInfiniteQueryData(e){return e.behavior=Fa(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return zi.isOnline()?O(this,Cn).resumePausedMutations():Promise.resolve()}getQueryCache(){return O(this,Fe)}getMutationCache(){return O(this,Cn)}getDefaultOptions(){return O(this,On)}setDefaultOptions(e){J(this,On,e)}setQueryDefaults(e,t){O(this,Cr).set(ir(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...O(this,Cr).values()],n={};return t.forEach(r=>{ni(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){O(this,Or).set(ir(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...O(this,Or).values()];let n={};return t.forEach(r=>{ni(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...O(this,On).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ts(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===Ji&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...O(this,On).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){O(this,Fe).clear(),O(this,Cn).clear()}},Fe=new WeakMap,Cn=new WeakMap,On=new WeakMap,Cr=new WeakMap,Or=new WeakMap,En=new WeakMap,Er=new WeakMap,Sr=new WeakMap,Uc),dt,ye,fi,at,Zn,Nr,Sn,Jt,pi,Tr,Rr,er,tr,Nn,Ar,Oe,Yr,es,ts,ns,rs,is,os,ss,el,Hc,Df=(Hc=class extends $r{constructor(t,n){super();ie(this,Oe);ie(this,dt);ie(this,ye);ie(this,fi);ie(this,at);ie(this,Zn);ie(this,Nr);ie(this,Sn);ie(this,Jt);ie(this,pi);ie(this,Tr);ie(this,Rr);ie(this,er);ie(this,tr);ie(this,Nn);ie(this,Ar,new Set);this.options=n,J(this,dt,t),J(this,Jt,null),J(this,Sn,Zo()),this.options.experimental_prefetchInRender||O(this,Sn).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&&(O(this,ye).addObserver(this),ja(O(this,ye),this.options)?pe(this,Oe,Yr).call(this):this.updateResult(),pe(this,Oe,rs).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return as(O(this,ye),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return as(O(this,ye),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,pe(this,Oe,is).call(this),pe(this,Oe,os).call(this),O(this,ye).removeObserver(this)}setOptions(t,n){const r=this.options,o=O(this,ye);if(this.options=O(this,dt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Kt(this.options.enabled,O(this,ye))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");pe(this,Oe,ss).call(this),O(this,ye).setOptions(this.options),r._defaulted&&!Wi(this.options,r)&&O(this,dt).getQueryCache().notify({type:"observerOptionsUpdated",query:O(this,ye),observer:this});const i=this.hasListeners();i&&La(O(this,ye),o,this.options,r)&&pe(this,Oe,Yr).call(this),this.updateResult(n),i&&(O(this,ye)!==o||Kt(this.options.enabled,O(this,ye))!==Kt(r.enabled,O(this,ye))||yr(this.options.staleTime,O(this,ye))!==yr(r.staleTime,O(this,ye)))&&pe(this,Oe,es).call(this);const s=pe(this,Oe,ts).call(this);i&&(O(this,ye)!==o||Kt(this.options.enabled,O(this,ye))!==Kt(r.enabled,O(this,ye))||s!==O(this,Nn))&&pe(this,Oe,ns).call(this,s)}getOptimisticResult(t){const n=O(this,dt).getQueryCache().build(O(this,dt),t),r=this.createResult(n,t);return Ff(this,r)&&(J(this,at,r),J(this,Nr,this.options),J(this,Zn,O(this,ye).state)),r}getCurrentResult(){return O(this,at)}trackResult(t,n){const r={};return Object.keys(t).forEach(o=>{Object.defineProperty(r,o,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(o),n==null||n(o),t[o])})}),r}trackProp(t){O(this,Ar).add(t)}getCurrentQuery(){return O(this,ye)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=O(this,dt).defaultQueryOptions(t),r=O(this,dt).getQueryCache().build(O(this,dt),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return pe(this,Oe,Yr).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),O(this,at)))}createResult(t,n){var N;const r=O(this,ye),o=this.options,i=O(this,at),s=O(this,Zn),a=O(this,Nr),u=t!==r?t.state:O(this,fi),{state:d}=t;let f={...d},p=!1,m;if(n._optimisticResults){const P=this.hasListeners(),q=!P&&ja(t,n),G=P&&La(t,r,n,o);(q||G)&&(f={...f,...Yc(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:g,errorUpdatedAt:w,status:h}=f;if(n.select&&f.data!==void 0)if(i&&f.data===(s==null?void 0:s.data)&&n.select===O(this,pi))m=O(this,Tr);else try{J(this,pi,n.select),m=n.select(f.data),m=Yo(i==null?void 0:i.data,m,n),J(this,Tr,m),J(this,Jt,null)}catch(P){J(this,Jt,P)}else m=f.data;if(n.placeholderData!==void 0&&m===void 0&&h==="pending"){let P;if(i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))P=i.data;else if(P=typeof n.placeholderData=="function"?n.placeholderData((N=O(this,Rr))==null?void 0:N.state.data,O(this,Rr)):n.placeholderData,n.select&&P!==void 0)try{P=n.select(P),J(this,Jt,null)}catch(q){J(this,Jt,q)}P!==void 0&&(h="success",m=Yo(i==null?void 0:i.data,P,n),p=!0)}O(this,Jt)&&(g=O(this,Jt),m=O(this,Tr),w=Date.now(),h="error");const x=f.fetchStatus==="fetching",y=h==="pending",b=h==="error",C=y&&x,_=m!==void 0,T={status:h,fetchStatus:f.fetchStatus,isPending:y,isSuccess:h==="success",isError:b,isInitialLoading:C,isLoading:C,data:m,dataUpdatedAt:f.dataUpdatedAt,error:g,errorUpdatedAt:w,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:x,isRefetching:x&&!y,isLoadingError:b&&!_,isPaused:f.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:b&&_,isStale:As(t,n),refetch:this.refetch,promise:O(this,Sn)};if(this.options.experimental_prefetchInRender){const P=z=>{T.status==="error"?z.reject(T.error):T.data!==void 0&&z.resolve(T.data)},q=()=>{const z=J(this,Sn,T.promise=Zo());P(z)},G=O(this,Sn);switch(G.status){case"pending":t.queryHash===r.queryHash&&P(G);break;case"fulfilled":(T.status==="error"||T.data!==G.value)&&q();break;case"rejected":(T.status!=="error"||T.error!==G.reason)&&q();break}}return T}updateResult(t){const n=O(this,at),r=this.createResult(O(this,ye),this.options);if(J(this,Zn,O(this,ye).state),J(this,Nr,this.options),O(this,Zn).data!==void 0&&J(this,Rr,O(this,ye)),Wi(r,n))return;J(this,at,r);const o={},i=()=>{if(!n)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!O(this,Ar).size)return!0;const c=new Set(a??O(this,Ar));return this.options.throwOnError&&c.add("error"),Object.keys(O(this,at)).some(u=>{const d=u;return O(this,at)[d]!==n[d]&&c.has(d)})};(t==null?void 0:t.listeners)!==!1&&i()&&(o.listeners=!0),pe(this,Oe,el).call(this,{...o,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&pe(this,Oe,rs).call(this)}},dt=new WeakMap,ye=new WeakMap,fi=new WeakMap,at=new WeakMap,Zn=new WeakMap,Nr=new WeakMap,Sn=new WeakMap,Jt=new WeakMap,pi=new WeakMap,Tr=new WeakMap,Rr=new WeakMap,er=new WeakMap,tr=new WeakMap,Nn=new WeakMap,Ar=new WeakMap,Oe=new WeakSet,Yr=function(t){pe(this,Oe,ss).call(this);let n=O(this,ye).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Tt)),n},es=function(){pe(this,Oe,is).call(this);const t=yr(this.options.staleTime,O(this,ye));if(rr||O(this,at).isStale||!Go(t))return;const r=Wc(O(this,at).dataUpdatedAt,t)+1;J(this,er,setTimeout(()=>{O(this,at).isStale||this.updateResult()},r))},ts=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(O(this,ye)):this.options.refetchInterval)??!1},ns=function(t){pe(this,Oe,os).call(this),J(this,Nn,t),!(rr||Kt(this.options.enabled,O(this,ye))===!1||!Go(O(this,Nn))||O(this,Nn)===0)&&J(this,tr,setInterval(()=>{(this.options.refetchIntervalInBackground||Rs.isFocused())&&pe(this,Oe,Yr).call(this)},O(this,Nn)))},rs=function(){pe(this,Oe,es).call(this),pe(this,Oe,ns).call(this,pe(this,Oe,ts).call(this))},is=function(){O(this,er)&&(clearTimeout(O(this,er)),J(this,er,void 0))},os=function(){O(this,tr)&&(clearInterval(O(this,tr)),J(this,tr,void 0))},ss=function(){const t=O(this,dt).getQueryCache().build(O(this,dt),this.options);if(t===O(this,ye))return;const n=O(this,ye);J(this,ye,t),J(this,fi,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},el=function(t){Be.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(O(this,at))}),O(this,dt).getQueryCache().notify({query:O(this,ye),type:"observerResultsUpdated"})})},Hc);function Mf(e,t){return Kt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function ja(e,t){return Mf(e,t)||e.state.data!==void 0&&as(e,t,t.refetchOnMount)}function as(e,t,n){if(Kt(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&As(e,t)}return!1}function La(e,t,n,r){return(e!==t||Kt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&As(e,n)}function As(e,t){return Kt(t.enabled,e)!==!1&&e.isStaleByTime(yr(t.staleTime,e))}function Ff(e,t){return!Wi(e.getCurrentResult(),t)}var Tn,Rn,ft,cn,fn,Ki,cs,Bc,kf=(Bc=class extends $r{constructor(n,r){super();ie(this,fn);ie(this,Tn);ie(this,Rn);ie(this,ft);ie(this,cn);J(this,Tn,n),this.setOptions(r),this.bindMethods(),pe(this,fn,Ki).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=O(this,Tn).defaultMutationOptions(n),Wi(this.options,r)||O(this,Tn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:O(this,ft),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&ir(r.mutationKey)!==ir(this.options.mutationKey)?this.reset():((o=O(this,ft))==null?void 0:o.state.status)==="pending"&&O(this,ft).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=O(this,ft))==null||n.removeObserver(this)}onMutationUpdate(n){pe(this,fn,Ki).call(this),pe(this,fn,cs).call(this,n)}getCurrentResult(){return O(this,Rn)}reset(){var n;(n=O(this,ft))==null||n.removeObserver(this),J(this,ft,void 0),pe(this,fn,Ki).call(this),pe(this,fn,cs).call(this)}mutate(n,r){var o;return J(this,cn,r),(o=O(this,ft))==null||o.removeObserver(this),J(this,ft,O(this,Tn).getMutationCache().build(O(this,Tn),this.options)),O(this,ft).addObserver(this),O(this,ft).execute(n)}},Tn=new WeakMap,Rn=new WeakMap,ft=new WeakMap,cn=new WeakMap,fn=new WeakSet,Ki=function(){var r;const n=((r=O(this,ft))==null?void 0:r.state)??Zc();J(this,Rn,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},cs=function(n){Be.batch(()=>{var r,o,i,s,a,c,u,d;if(O(this,cn)&&this.hasListeners()){const f=O(this,Rn).variables,p=O(this,Rn).context;(n==null?void 0:n.type)==="success"?((o=(r=O(this,cn)).onSuccess)==null||o.call(r,n.data,f,p),(s=(i=O(this,cn)).onSettled)==null||s.call(i,n.data,null,f,p)):(n==null?void 0:n.type)==="error"&&((c=(a=O(this,cn)).onError)==null||c.call(a,n.error,f,p),(d=(u=O(this,cn)).onSettled)==null||d.call(u,void 0,n.error,f,p))}this.listeners.forEach(f=>{f(O(this,Rn))})})},Bc),tl=K.createContext(void 0),dr=e=>{const t=K.useContext(tl);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},jf=({client:e,children:t})=>(K.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(tl.Provider,{value:e,children:t})),nl=K.createContext(!1),Lf=()=>K.useContext(nl);nl.Provider;function Vf(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Kf=K.createContext(Vf()),$f=()=>K.useContext(Kf);function rl(e,t){return typeof e=="function"?e(...t):!!e}function ls(){}var qf=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Uf=e=>{K.useEffect(()=>{e.clearReset()},[e])},Hf=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||rl(n,[e.error,r])),Bf=e=>{const t=e.staleTime;e.suspense&&(e.staleTime=typeof t=="function"?(...n)=>Math.max(t(...n),1e3):Math.max(t??1e3,1e3),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3)))},Wf=(e,t)=>e.isLoading&&e.isFetching&&!t,Jf=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Va=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function zf(e,t,n){var f,p,m,g,w;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=dr(),o=Lf(),i=$f(),s=r.defaultQueryOptions(e);(p=(f=r.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||p.call(f,s),s._optimisticResults=o?"isRestoring":"optimistic",Bf(s),qf(s,i),Uf(i);const a=!r.getQueryCache().get(s.queryHash),[c]=K.useState(()=>new t(r,s)),u=c.getOptimisticResult(s),d=!o&&e.subscribed!==!1;if(K.useSyncExternalStore(K.useCallback(h=>{const x=d?c.subscribe(Be.batchCalls(h)):ls;return c.updateResult(),x},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),K.useEffect(()=>{c.setOptions(s,{listeners:!1})},[s,c]),Jf(s,u))throw Va(s,c,i);if(Hf({result:u,errorResetBoundary:i,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw u.error;if((g=(m=r.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||g.call(m,s,u),s.experimental_prefetchInRender&&!rr&&Wf(u,o)){const h=a?Va(s,c,i):(w=r.getQueryCache().get(s.queryHash))==null?void 0:w.promise;h==null||h.catch(ls).finally(()=>{c.updateResult()})}return s.notifyOnChangeProps?u:c.trackResult(u)}function qr(e,t){return zf(e,Df)}function Gf(e,t){const n=dr(),[r]=K.useState(()=>new kf(n,e));K.useEffect(()=>{r.setOptions(e)},[r,e]);const o=K.useSyncExternalStore(K.useCallback(s=>r.subscribe(Be.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=K.useCallback((s,a)=>{r.mutate(s,a).catch(ls)},[r]);if(o.error&&rl(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:i,mutateAsync:o.mutate}}const il=v.createContext(null),Qf=il.Provider,fr=()=>{const e=v.useContext(il);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 ol=v.createContext(void 0);function Rt(){const e=v.useContext(ol);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const Xf=(()=>{const e={};return Object.values(ue).forEach(t=>{e[t]={}}),e})();function Yf({children:e}){const[t,n]=v.useState(Xf),r=v.useCallback((d,f,p=!0)=>{n(m=>{const g={...m};return g[d]=g[d]||{},g[d][f]=p,g})},[n]),o=v.useCallback((d,f)=>{var p;return!!((p=t[d])!=null&&p[f])},[t]),i=v.useCallback((d,f)=>{var p;return(p=t[d])==null?void 0:p[f]},[t]),s=v.useCallback((d,f)=>{n(p=>{var g;const m={...p};return(g=m[d])==null||delete g[f],m})},[n]),a=v.useCallback(d=>{n(f=>{const p={...f};return p[d]={},p})},[n]),c=v.useCallback((d,f)=>{n(p=>{const m={...p};return m[d]=m[d]||{},f.forEach(g=>{m[d][g]=!0}),m})},[n]),u=v.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(ol.Provider,{value:u,children:e})}const Zf="https://api.withampersand.com/v1".replace(/\/+$/,"");class Ps{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Zf}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||al}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 ep=new Ps,uo=class uo{constructor(t=ep){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 rp(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?uo.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(u=>o[u]===void 0?delete o[u]:{});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:np(a.body)||a.body instanceof URLSearchParams||tp(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}};uo.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let Gt=uo;function tp(e){return typeof Blob<"u"&&e instanceof Blob}function np(e){return typeof FormData<"u"&&e instanceof FormData}class sl extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class rp extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class ae extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function D(e,t){const n=e[t];return n!=null}function al(e,t=""){return Object.keys(e).map(n=>cl(n,e[n],t)).filter(n=>n.length>0).join("&")}function cl(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 cl(e,o,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?al(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function fo(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class Ve{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class or{constructor(t){this.raw=t}async value(){}}class ip{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function op(e){return sp(e)}function sp(e,t){return e==null?e:{fieldUsed:D(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:D(e,"keyFormat")?e.keyFormat:void 0}}function ap(e){return cp(e)}function cp(e,t){return e==null?e:{name:e.name,valuePrefix:D(e,"valuePrefix")?e.valuePrefix:void 0}}function lp(e){return up(e)}function up(e,t){return e==null?e:{name:e.name}}function dp(e){return fp(e)}function fp(e,t){return e==null?e:{attachmentType:e.attachmentType,query:D(e,"query")?lp(e.query):void 0,header:D(e,"header")?ap(e.header):void 0,docsURL:D(e,"docsURL")?e.docsURL:void 0}}function pp(e){return hp(e)}function hp(e,t){return e}function mp(e){return gp(e)}function gp(e,t){return e==null?e:{days:D(e,"days")?e.days:void 0,fullHistory:D(e,"fullHistory")?e.fullHistory:void 0}}function yp(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function ll(e){return vp(e)}function vp(e,t){return e==null?e:{defaultPeriod:mp(e.defaultPeriod)}}function wp(e){if(e!==void 0)return e===null?null:{defaultPeriod:yp(e.defaultPeriod)}}function Ip(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function bp(e){if(e!==void 0)return e===null?null:{defaultPeriod:Ip(e.defaultPeriod)}}function _p(e){return xp(e)}function xp(e,t){return e==null?e:{enabled:D(e,"enabled")?e.enabled:void 0}}function ul(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Cp(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:bp(e.backfill)}}function Op(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:fo(e.objects,Cp)}}function Ep(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults}}function Sp(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:fo(e.objects,Ep)}}function Np(e){return Tp(e)}function Tp(e,t){return e==null?e:{apiKeyAsBasic:D(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:D(e,"apiKeyAsBasicOpts")?op(e.apiKeyAsBasicOpts):void 0,docsURL:D(e,"docsURL")?e.docsURL:void 0}}function Rp(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Ai(e){return Ap(e)}function Ap(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:D(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:D(e,"updateTime")?new Date(e.updateTime):void 0}}function Pp(e){return Dp(e)}function Dp(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function Mp(e){return Fp(e)}function Fp(e,t){return e==null?e:{provider:e.provider,read:D(e,"read")?e.read:void 0,write:D(e,"write")?e.write:void 0,proxy:D(e,"proxy")?_p(e.proxy):void 0}}function kp(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:e.read,write:e.write,proxy:ul(e.proxy)}}function jp(e){return Lp(e)}function Lp(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:Mp(e.content)}}function Vp(e){return Kp(e)}function Kp(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:D(e,"updateTime")?new Date(e.updateTime):void 0}}function dl(e){return $p(e)}function $p(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:D(e,"updateTime")?new Date(e.updateTime):void 0}}function qp(e){return Up(e)}function Up(e,t){return e==null?e:{token:e.token}}function Hp(e){return Bp(e)}function Bp(e,t){return e==null?e:{token:e.token}}function Wp(e){return Jp(e)}function Jp(e,t){return e==null?e:{accessToken:D(e,"accessToken")?qp(e.accessToken):void 0,refreshToken:D(e,"refreshToken")?Hp(e.refreshToken):void 0,scopes:D(e,"scopes")?e.scopes:void 0}}function $i(e){return zp(e)}function zp(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:D(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:D(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:D(e,"updateTime")?new Date(e.updateTime):void 0}}function qi(e){return Gp(e)}function Gp(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:D(e,"providerApp")?$i(e.providerApp):void 0,group:dl(e.group),consumer:Vp(e.consumer),providerWorkspaceRef:D(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerConsumerRef:D(e,"providerConsumerRef")?e.providerConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:D(e,"updateTime")?new Date(e.updateTime):void 0,authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:D(e,"oauth2AuthorizationCode")?Wp(e.oauth2AuthorizationCode):void 0,apiKey:D(e,"apiKey")?e.apiKey:void 0}}function Qp(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:kp(e.content)}}function Xp(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:Qp(e.config)}}function Yp(e){return Zp(e)}function Zp(e,t){return e==null?e:{enabled:D(e,"enabled")?e.enabled:void 0}}function eh(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function th(e){return nh(e)}function nh(e,t){return e==null?e:{mode:D(e,"mode")?e.mode:void 0,pageSize:D(e,"pageSize")?e.pageSize:void 0}}function rh(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function ih(e){let t=!0;return t=t&&"fieldName"in e,t}function oh(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:D(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:D(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function sh(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function ah(e){let t=!0;return t=t&&"mapToName"in e,t}function fl(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:D(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:D(e,"default")?e.default:void 0,prompt:D(e,"prompt")?e.prompt:void 0}}function ch(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function Ka(e){return lh(e)}function lh(e,t){return e==null?e:{...oh(e),...fl(e)}}function $a(e){if(e!==void 0)return e===null?null:ih(e)?sh(e):ah(e)?ch(e):{}}function pl(e){return uh(e)}function uh(e,t){return e}function dh(e){return fh(e)}function fh(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:D(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:D(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:D(e,"requiredFields")?e.requiredFields.map(Ka):void 0,optionalFields:D(e,"optionalFields")?e.optionalFields.map(Ka):void 0,optionalFieldsAuto:D(e,"optionalFieldsAuto")?pl(e.optionalFieldsAuto):void 0,backfill:D(e,"backfill")?ll(e.backfill):void 0,delivery:D(e,"delivery")?th(e.delivery):void 0}}function ph(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($a),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map($a),optionalFieldsAuto:e.optionalFieldsAuto,backfill:wp(e.backfill),delivery:rh(e.delivery)}}function hh(e){return mh(e)}function mh(e,t){return e==null?e:{objects:D(e,"objects")?e.objects.map(dh):void 0}}function gh(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(ph)}}function hl(e){return yh(e)}function yh(e,t){return e==null?e:{allowAnyFields:D(e,"allowAnyFields")?e.allowAnyFields:void 0}}function vh(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function wh(e){return Ih(e)}function Ih(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:D(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:D(e,"valueDefaults")?hl(e.valueDefaults):void 0}}function bh(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:vh(e.valueDefaults)}}function _h(e){return xh(e)}function xh(e,t){return e==null?e:{objects:D(e,"objects")?e.objects.map(wh):void 0}}function Ch(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(bh)}}function Oh(e){return Eh(e)}function Eh(e,t){return e==null?e:{name:e.name,displayName:D(e,"displayName")?e.displayName:void 0,provider:e.provider,read:D(e,"read")?hh(e.read):void 0,write:D(e,"write")?_h(e.write):void 0,proxy:D(e,"proxy")?Yp(e.proxy):void 0}}function Sh(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:gh(e.read),write:Ch(e.write),proxy:eh(e.proxy)}}function Nh(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:Sh(e.content)}}function Th(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:Nh(e.latestRevision)}}function Rh(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function Ah(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 Ph(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Dh(e){return Mh(e)}function Mh(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function Fh(e){return kh(e)}function kh(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,valueType:D(e,"valueType")?e.valueType:void 0,providerType:D(e,"providerType")?e.providerType:void 0,readOnly:D(e,"readOnly")?e.readOnly:void 0,values:D(e,"values")?e.values.map(Dh):void 0}}function jh(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function Lh(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function Vh(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 Kh(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 $h(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 qh(e){if(e!==void 0)return e===null?null:{accessToken:Kh(e.accessToken),refreshToken:$h(e.refreshToken),scopes:e.scopes}}function Uh(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,basicAuth:jh(e.basicAuth),oauth2ClientCredentials:Lh(e.oauth2ClientCredentials),oauth2Password:Vh(e.oauth2Password),oauth2AuthorizationCode:qh(e.oauth2AuthorizationCode)}}function Hh(e){return Bh(e)}function Bh(e,t){return e==null?e:{enabled:D(e,"enabled")?e.enabled:void 0}}function Wh(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,mapToName:D(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:D(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Po(e){return Jh(e)}function Jh(e,t){return e==null?e:{...Wh(e),...fl(e)}}function zh(e){return Gh(e)}function Gh(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,mapToName:D(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:D(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:D(e,"requiredFields")?e.requiredFields.map(Po):void 0,optionalFields:D(e,"optionalFields")?e.optionalFields.map(Po):void 0,optionalFieldsAuto:D(e,"optionalFieldsAuto")?pl(e.optionalFieldsAuto):void 0,allFields:D(e,"allFields")?e.allFields.map(Po):void 0,allFieldsMetadata:D(e,"allFieldsMetadata")?fo(e.allFieldsMetadata,Fh):void 0,backfill:D(e,"backfill")?ll(e.backfill):void 0}}function Qh(e){return Xh(e)}function Xh(e,t){return e==null?e:{objects:D(e,"objects")?e.objects.map(zh):void 0}}function Yh(e){return Zh(e)}function Zh(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:D(e,"valueDefaults")?hl(e.valueDefaults):void 0}}function em(e){return tm(e)}function tm(e,t){return e==null?e:{objects:D(e,"objects")?e.objects.map(Yh):void 0}}function nm(e){return rm(e)}function rm(e,t){return e==null?e:{name:e.name,displayName:D(e,"displayName")?e.displayName:void 0,provider:e.provider,read:D(e,"read")?Qh(e.read):void 0,write:D(e,"write")?em(e.write):void 0,proxy:D(e,"proxy")?Hh(e.proxy):void 0}}function im(e){return om(e)}function om(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:nm(e.content)}}function Pi(e){return sm(e)}function sm(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:D(e,"group")?dl(e.group):void 0,healthStatus:e.healthStatus,connection:qi(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:D(e,"updateTime")?new Date(e.updateTime):void 0,config:jp(e.config)}}function am(e){return cm(e)}function cm(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Oh(e.content)}}function qa(e){return lm(e)}function lm(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:D(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:am(e.latestRevision)}}function um(e){return dm(e)}function dm(e,t){return e==null?e:{iconURL:D(e,"iconURL")?e.iconURL:void 0,logoURL:D(e,"logoURL")?e.logoURL:void 0}}function fm(e){return pm(e)}function pm(e,t){return e==null?e:{iconURL:D(e,"iconURL")?e.iconURL:void 0,logoURL:D(e,"logoURL")?e.logoURL:void 0}}function hm(e){return mm(e)}function mm(e,t){return e==null?e:{regular:D(e,"regular")?fm(e.regular):void 0,darkMode:D(e,"darkMode")?um(e.darkMode):void 0}}function gm(e){return ym(e)}function ym(e,t){return e==null?e:{workspaceRefField:D(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:D(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:D(e,"scopesField")?e.scopesField:void 0}}function vm(e){return wm(e)}function wm(e,t){return e==null?e:{grantType:e.grantType,authURL:D(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:D(e,"audience")?e.audience:void 0,tokenMetadataFields:gm(e.tokenMetadataFields),docsURL:D(e,"docsURL")?e.docsURL:void 0,authURLParams:D(e,"authURLParams")?e.authURLParams:void 0}}function Im(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,projectId:e.projectId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerAppId:e.providerAppId,provider:e.provider,enableCSRFProtection:e.enableCSRFProtection}}function bm(e){return _m(e)}function _m(e,t){return e==null?e:{bulkWrite:Pp(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write}}function Ua(e){return xm(e)}function xm(e,t){return e==null?e:{name:e.name,authType:pp(e.authType),baseURL:e.baseURL,oauth2Opts:D(e,"oauth2Opts")?vm(e.oauth2Opts):void 0,apiKeyOpts:D(e,"apiKeyOpts")?dp(e.apiKeyOpts):void 0,basicOpts:D(e,"basicOpts")?Np(e.basicOpts):void 0,support:bm(e.support),providerOpts:e.providerOpts,displayName:D(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:D(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:D(e,"media")?hm(e.media):void 0,labels:D(e,"labels")?e.labels:void 0}}function Cm(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:Op(e.read),write:Sp(e.write),proxy:ul(e.proxy)}}function Om(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Cm(e.content)}}function Em(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:Om(e.config)}}function Sm(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:Em(e.installation)}}function Nm(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function Tm(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:Nm(e.project)}}function Rm(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 Am(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:Rm(e.providerApp)}}class Pm extends Gt{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ae("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling deleteConnection.");const r={},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 or(i)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},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:Uh(t.generateConnectionParams)},n);return new Ve(i,s=>qi(s))}async generateConnection(t,n){return await(await this.generateConnectionRaw(t,n)).value()}async getConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ae("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const r={};t.includeCreds!==void 0&&(r.includeCreds=t.includeCreds),t.includeRefreshToken!==void 0&&(r.includeRefreshToken=t.includeRefreshToken),t.refresh!==void 0&&(r.refresh=t.refresh);const 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 Ve(i,s=>qi(s))}async getConnection(t,n){return await(await this.getConnectionRaw(t,n)).value()}async listConnectionsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const r={};t.provider!==void 0&&(r.provider=t.provider),t.groupRef!==void 0&&(r.groupRef=t.groupRef),t.consumerRef!==void 0&&(r.consumerRef=t.consumerRef);const 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 Ve(i,s=>s.map(qi))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}}class Dm extends Gt{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new ae("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},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:Xp(t.installation)},n);return new Ve(i,s=>Pi(s))}async createInstallation(t,n){return await(await this.createInstallationRaw(t,n)).value()}async deleteInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ae("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},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 or(i)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ae("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},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 Ve(i,s=>Pi(s))}async getInstallation(t,n){return await(await this.getInstallationRaw(t,n)).value()}async listInstallationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const 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 Ve(i,s=>s.map(Pi))}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 ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ae("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new ae("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},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:Sm(t.installationUpdate)},n);return new Ve(i,s=>Pi(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class Mm extends Gt{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");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:Rp(t.batchUpsertIntegrationsRequest)},n);return new Ve(i,s=>s.map(qa))}async batchUpsertIntegrations(t,n){return await(await this.batchUpsertIntegrationsRaw(t,n)).value()}async createIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new ae("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},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:Th(t.integration)},n);return new or(i)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},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 or(i)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},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 Ve(i,s=>s.map(qa))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class Fm extends Gt{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new ae("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},o={};o["Content-Type"]="application/json";const i=await this.request({path:"/oauth-connect",method:"POST",headers:o,query:r,body:Im(t.connectOAuthParams)},n);return this.isJsonMime(i.headers.get("content-type"))?new Ve(i):new ip(i)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}}class km extends Gt{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new ae("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},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:Rh(t.project)},n);return new Ve(i,s=>Ai(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async deleteProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProject.");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}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"DELETE",headers:o,query:r},n);return new or(i)}async deleteProject(t,n){await this.deleteProjectRaw(t,n)}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={},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 Ve(i,s=>Ai(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 Ve(o,i=>i.map(Ai))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new ae("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},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:Tm(t.projectUpdate)},n);return new Ve(i,s=>Ai(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class jm extends Gt{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new ae("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},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 Ve(i,s=>Ua(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 Ve(o,i=>fo(i,Ua))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class Lm extends Gt{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new ae("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},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:Ah(t.providerApp)},n);return new Ve(i,s=>$i(s))}async createProviderApp(t,n){return await(await this.createProviderAppRaw(t,n)).value()}async deleteProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ae("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},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 or(i)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},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 Ve(i,s=>s.map($i))}async listProviderApps(t,n){return await(await this.listProviderAppsRaw(t,n)).value()}async updateProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ae("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new ae("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},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:Am(t.providerAppUpdate)},n);return new Ve(i,s=>$i(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class Vm extends Gt{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");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:Ph(t.revision)},n);return new or(i)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ae("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ae("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new ae("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new ae("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const 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 Ve(i,s=>im(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class ml{constructor(t){this.connectionApi=new Pm(t),this.installationApi=new Dm(t),this.integrationApi=new Mm(t),this.oAuthApi=new Fm(t),this.projectApi=new km(t),this.providerApi=new jm(t),this.providerAppApi=new Lm(t),this.revisionApi=new Vm(t)}}const gl="2.4.6",Km="v1",Di="https://api.withampersand.com";function yl(){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 Di;case"mock":return"http://127.0.0.1:4010";case"":return Di;default:return e??Di}}catch{return Di}}const $m=(e,t)=>`${e}/${t}`;function qm(){return $m(yl(),Km)}const Um=yl(),vl=qm(),Hm=new Ps({basePath:vl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":gl}});let Bm=new ml(Hm);const dn=()=>Bm;function pr(){const e=fr();return v.useCallback(async()=>{e||console.error("Unable to create API service without API key.");const n=new Ps({basePath:vl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":gl,"X-Api-Key":e}});return new ml(n)},[e])}const ht=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
+ `))||"[ERROR] Creating installation failed.";console.error("[Error Message]",a),t&&t(a)}catch(i){console.error("Error parsing error response body:",i)}}else console.error("Unexpected error:",e.message)},Wm=e=>{const t=pr();return qr({queryKey:["project",e],queryFn:async()=>(await t()).projectApi.getProject({projectIdOrName:e})})},wl=v.createContext({project:null,appName:"",projectId:"",projectIdOrName:"",isLoading:!0}),ke=()=>{const e=v.useContext(wl);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e};function Jm({projectIdOrName:e,children:t}){const{setError:n}=Rt(),{data:r,isLoading:o,isError:i}=Wm(e);v.useEffect(()=>{i&&n(ue.PROJECT,e)},[i,e,n]);const s=v.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(wl.Provider,{value:s,children:t})}const Il=v.createContext({integrations:null,isLoading:!0}),Ds=()=>{const e=v.useContext(Il);if(!e)throw new Error("useIntegrationList must be used within a IntegrationListProvider");return e};function zm(){const e=pr(),{projectIdOrName:t}=ke();return qr({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})}function Gm({children:e}){const{projectIdOrName:t}=ke(),{setError:n,removeError:r}=Rt(),{data:o,isLoading:i,isError:s}=zm();v.useEffect(()=>{s?(ht(s),n(ue.INTEGRATION_LIST,t)):r(ue.INTEGRATION_LIST,t)},[s,t,r,n]);const a=v.useMemo(()=>({integrations:o||null,isLoading:i}),[o,i]);return l.jsx(Il.Provider,{value:a,children:e})}const Qm=new Pf;function Xm(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(jf,{client:Qm,children:l.jsx(Yf,{children:l.jsx(Qf,{value:t,children:l.jsx(Jm,{projectIdOrName:i,children:l.jsx(Gm,{children:o})})})})})}const bl=v.createContext(null);function Ym(){const e=v.useContext(bl);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
3
+ component is wrapped with AmpersandProvider`);return e}function Zm(){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 eg="_box_1p7c5_1",Ha={box:eg};function kn({children:e,className:t,style:n}){return l.jsx("div",{className:t?`${Ha.box} ${t}`:Ha.box,style:n,children:e})}const tg="_container_1wvzr_1",Ba={container:tg};function Ur({children:e,className:t,style:n}){return l.jsx("div",{className:t?`${Ba.container} ${t}`:Ba.container,style:n,children:e})}const ng="_errorBoxContainer_4sdb2_1",rg="_errorBox_4sdb2_1",ig="_errorText_4sdb2_20",Do={errorBoxContainer:ng,errorBox:rg,errorText:ig};function _l({message:e}){return l.jsxs(Ur,{className:Do.errorBoxContainer,children:[l.jsx(Zm,{}),l.jsx(kn,{className:Do.errorBox,children:l.jsx("p",{className:Do.errorText,children:e})})]})}const og="_loader_6ubm6_1",sg="_rotate_6ubm6_1",ag="_ball1_6ubm6_1",cg="_ball2_6ubm6_1",lg={loader:og,rotate:sg,ball1:ag,ball2:cg};function ug(){return l.jsx("span",{className:lg.loader})}function ri(){return l.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:l.jsx(ug,{})})}function xl({children:e}){return l.jsx(Ur,{style:{maxWidth:"55rem"},children:l.jsx(kn,{children:e})})}function Hr(){return l.jsx(xl,{children:l.jsx(ri,{})})}function zt({message:e}){return l.jsx(xl,{children:l.jsx(_l,{message:e})})}const Cl=(e,t)=>{var s;const n=pr(),{projectIdOrName:r}=ke(),{integrations:o}=Ds(),i=(s=o==null?void 0:o.find(a=>a.name===e))==null?void 0:s.id;return qr({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 Ms(e,t){try{return process.env[e]}catch{return t}}function Pr(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Ol(e,t){return(t==null?void 0:t.displayName)??Pr(e)}const dg=e=>e.split(`
4
+ `).filter(n=>n.trim()!==""),fg=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,pg=()=>{const[e,t]=v.useState(!1),n=v.useCallback(()=>{t(!0)},[t]),r=v.useCallback(()=>{t(!1)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n,resetIntegrationDeleted:r}},El=v.createContext({integrationId:"",provider:"",integrationObj:void 0,consumerRef:"",consumerName:"",groupRef:"",groupName:"",installation:void 0,setInstallation:()=>{},resetInstallations:()=>{},onInstallSuccess:void 0,onUpdateSuccess:void 0,onUninstallSuccess:void 0,isIntegrationDeleted:!1,setIntegrationDeleted:()=>{}});function et(){const e=v.useContext(El);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function hg({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,fieldMapping:u}){const{integrations:d}=Ds(),{setError:f,isError:p,removeError:m}=Rt(),{isIntegrationDeleted:g,setIntegrationDeleted:w,resetIntegrationDeleted:h}=pg(),x=v.useMemo(()=>fg(t,d||[]),[t,d]),{data:y,isLoading:b,isError:C,error:_}=Cl(t,o),S=(y==null?void 0:y[0])||null;v.useEffect(()=>{h()},[t,n,r,o,i,u]),v.useEffect(()=>{x===null&&(d!=null&&d.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,x,d]),v.useEffect(()=>{C?(f(ue.INSTALLATION_LIST,(x==null?void 0:x.id)||""),ht(_)):m(ue.INSTALLATION_LIST,(x==null?void 0:x.id)||"")},[C,x,f,m,_]);const T=dr(),N=v.useCallback(()=>{T.invalidateQueries({queryKey:["amp","installations"]})},[T]),P=v.useCallback(z=>{T.setQueryData(["amp","installations"],[z]),T.invalidateQueries({queryKey:["amp","installations"]})},[T]),q=(x==null?void 0:x.id)||"",G=v.useMemo(()=>({integrationId:(x==null?void 0:x.id)||"",provider:(x==null?void 0:x.provider)||"",integrationObj:x,consumerRef:n,consumerName:r,groupRef:o,groupName:i,installation:S||void 0,setInstallation:P,resetInstallations:N,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,isIntegrationDeleted:g,setIntegrationDeleted:w,fieldMapping:u}),[x,n,r,o,i,S,P,N,s,a,c,g,w,u]);if(b)return l.jsx(Hr,{});if(x===null)return l.jsx(zt,{message:`Integration "${t}" not found`});if(p(ue.INSTALLATION_LIST,q)){const z=`Error retrieving installation information for integration "${(x==null?void 0:x.name)||"unknown"}"`;return l.jsx(zt,{message:z})}return l.jsx(El.Provider,{value:G,children:e})}const Sl=v.createContext({connections:null,isConnectionsLoading:!0,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),Br=()=>{const e=v.useContext(Sl);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e},mg=()=>{const{projectIdOrName:e}=ke(),{groupRef:t,provider:n}=et(),r=pr();return qr({queryKey:["amp","connections",e,t,n],queryFn:async()=>{if(!e)throw new Error("Project ID or name not found. Please wrap this component inside of AmpersandProvider");if(!t)throw new Error("Group reference not found.");if(!n)throw new Error("Provider not found.");return(await r()).connectionApi.listConnections({projectIdOrName:e,groupRef:t,provider:n})},retry:3,enabled:!!e&&!!t&&!!n})};function Nl({children:e}){const t=dr(),{setError:n,isError:r}=Rt(),{projectId:o,isLoading:i}=ke(),{data:s,isLoading:a,isError:c,error:u}=mg(),d=s==null?void 0:s[0],f=v.useCallback(g=>{t.setQueryData(["amp","connections"],()=>g),t.invalidateQueries({queryKey:["amp","connections"]})},[t]),p=v.useCallback(()=>{t.invalidateQueries({queryKey:["amp","connections"]})},[t]);v.useEffect(()=>{c?(n(ue.CONNECTION_LIST,o,!0),ht(u)):n(ue.CONNECTION_LIST,o,!1)},[c,n,o,u]);const m=v.useMemo(()=>({connections:s||null,isConnectionsLoading:a,selectedConnection:d||null,setConnections:f,setSelectedConnection:p}),[s,a,d,f,p]);if(a||i)return l.jsx(Hr,{});if(r(ue.PROJECT,o))return l.jsx(zt,{message:`Error loading project ${o}`});if(r(ue.CONNECTION_LIST,o))return l.jsx(zt,{message:"Error retrieving existing connections"});if(!o)throw new Error("Project ID not found. ConnectionsProvider must be used within AmpersandProvider");return l.jsx(Sl.Provider,{value:m,children:e})}function Tl(){const[e,t]=v.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}const gg="_resetContainer_lkwv9_4",Rl={resetContainer:gg};var Mi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Fs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Gi={exports:{}};Gi.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",o=1,i=2,s=9007199254740991,a="[object Arguments]",c="[object Array]",u="[object AsyncFunction]",d="[object Boolean]",f="[object Date]",p="[object Error]",m="[object Function]",g="[object GeneratorFunction]",w="[object Map]",h="[object Number]",x="[object Null]",y="[object Object]",b="[object Promise]",C="[object Proxy]",_="[object RegExp]",S="[object Set]",T="[object String]",N="[object Symbol]",P="[object Undefined]",q="[object WeakMap]",G="[object ArrayBuffer]",z="[object DataView]",ne="[object Float32Array]",B="[object Float64Array]",ce="[object Int8Array]",oe="[object Int16Array]",te="[object Int32Array]",ge="[object Uint8Array]",we="[object Uint8ClampedArray]",R="[object Uint16Array]",k="[object Uint32Array]",$=/[\\^$.*+?()[\]{}|]/g,L=/^\[object .+?Constructor\]$/,j=/^(?:0|[1-9]\d*)$/,M={};M[ne]=M[B]=M[ce]=M[oe]=M[te]=M[ge]=M[we]=M[R]=M[k]=!0,M[a]=M[c]=M[G]=M[d]=M[z]=M[f]=M[p]=M[m]=M[w]=M[h]=M[y]=M[_]=M[S]=M[T]=M[q]=!1;var Y=typeof Mi=="object"&&Mi&&Mi.Object===Object&&Mi,Z=typeof self=="object"&&self&&self.Object===Object&&self,U=Y||Z||Function("return this")(),ee=t&&!t.nodeType&&t,Q=ee&&!0&&e&&!e.nodeType&&e,de=Q&&Q.exports===ee,F=de&&Y.process,ve=function(){try{return F&&F.binding&&F.binding("util")}catch{}}(),H=ve&&ve.isTypedArray;function Ee(I,E){for(var A=-1,X=I==null?0:I.length,Te=0,fe=[];++A<X;){var Me=I[A];E(Me,A,I)&&(fe[Te++]=Me)}return fe}function Le(I,E){for(var A=-1,X=E.length,Te=I.length;++A<X;)I[Te+A]=E[A];return I}function Ge(I,E){for(var A=-1,X=I==null?0:I.length;++A<X;)if(E(I[A],A,I))return!0;return!1}function Ke(I,E){for(var A=-1,X=Array(I);++A<I;)X[A]=E(A);return X}function Ie(I){return function(E){return I(E)}}function At(I,E){return I.has(E)}function Qe(I,E){return I==null?void 0:I[E]}function mt(I){var E=-1,A=Array(I.size);return I.forEach(function(X,Te){A[++E]=[Te,X]}),A}function Pt(I,E){return function(A){return I(E(A))}}function Dt(I){var E=-1,A=Array(I.size);return I.forEach(function(X){A[++E]=X}),A}var Xe=Array.prototype,We=Function.prototype,$e=Object.prototype,Ae=U["__core-js_shared__"],Mt=We.toString,tt=$e.hasOwnProperty,Yt=function(){var I=/[^.]+$/.exec(Ae&&Ae.keys&&Ae.keys.IE_PROTO||"");return I?"Symbol(src)_1."+I:""}(),hn=$e.toString,gt=RegExp("^"+Mt.call(tt).replace($,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Pe=de?U.Buffer:void 0,Zt=U.Symbol,mn=U.Uint8Array,en=$e.propertyIsEnumerable,Vn=Xe.splice,ct=Zt?Zt.toStringTag:void 0,tn=Object.getOwnPropertySymbols,gn=Pe?Pe.isBuffer:void 0,Kn=Pt(Object.keys,Object),yn=hr(U,"DataView"),Re=hr(U,"Map"),nt=hr(U,"Promise"),re=hr(U,"Set"),me=hr(U,"WeakMap"),qe=hr(Object,"create"),nn=Un(yn),W=Un(Re),se=Un(nt),le=Un(re),je=Un(me),Ue=Zt?Zt.prototype:void 0,lt=Ue?Ue.valueOf:void 0;function Je(I){var E=-1,A=I==null?0:I.length;for(this.clear();++E<A;){var X=I[E];this.set(X[0],X[1])}}function Ye(){this.__data__=qe?qe(null):{},this.size=0}function ut(I){var E=this.has(I)&&delete this.__data__[I];return this.size-=E?1:0,E}function Ne(I){var E=this.__data__;if(qe){var A=E[I];return A===r?void 0:A}return tt.call(E,I)?E[I]:void 0}function $n(I){var E=this.__data__;return qe?E[I]!==void 0:tt.call(E,I)}function So(I,E){var A=this.__data__;return this.size+=this.has(I)?0:1,A[I]=qe&&E===void 0?r:E,this}Je.prototype.clear=Ye,Je.prototype.delete=ut,Je.prototype.get=Ne,Je.prototype.has=$n,Je.prototype.set=So;function Ct(I){var E=-1,A=I==null?0:I.length;for(this.clear();++E<A;){var X=I[E];this.set(X[0],X[1])}}function Ii(){this.__data__=[],this.size=0}function bi(I){var E=this.__data__,A=Ci(E,I);if(A<0)return!1;var X=E.length-1;return A==X?E.pop():Vn.call(E,A,1),--this.size,!0}function _i(I){var E=this.__data__,A=Ci(E,I);return A<0?void 0:E[A][1]}function Se(I){return Ci(this.__data__,I)>-1}function Ft(I,E){var A=this.__data__,X=Ci(A,I);return X<0?(++this.size,A.push([I,E])):A[X][1]=E,this}Ct.prototype.clear=Ii,Ct.prototype.delete=bi,Ct.prototype.get=_i,Ct.prototype.has=Se,Ct.prototype.set=Ft;function kt(I){var E=-1,A=I==null?0:I.length;for(this.clear();++E<A;){var X=I[E];this.set(X[0],X[1])}}function qn(){this.size=0,this.__data__={hash:new Je,map:new(Re||Ct),string:new Je}}function No(I){var E=Oi(this,I).delete(I);return this.size-=E?1:0,E}function zr(I){return Oi(this,I).get(I)}function Kd(I){return Oi(this,I).has(I)}function $d(I,E){var A=Oi(this,I),X=A.size;return A.set(I,E),this.size+=A.size==X?0:1,this}kt.prototype.clear=qn,kt.prototype.delete=No,kt.prototype.get=zr,kt.prototype.has=Kd,kt.prototype.set=$d;function xi(I){var E=-1,A=I==null?0:I.length;for(this.__data__=new kt;++E<A;)this.add(I[E])}function qd(I){return this.__data__.set(I,r),this}function Ud(I){return this.__data__.has(I)}xi.prototype.add=xi.prototype.push=qd,xi.prototype.has=Ud;function vn(I){var E=this.__data__=new Ct(I);this.size=E.size}function Hd(){this.__data__=new Ct,this.size=0}function Bd(I){var E=this.__data__,A=E.delete(I);return this.size=E.size,A}function Wd(I){return this.__data__.get(I)}function Jd(I){return this.__data__.has(I)}function zd(I,E){var A=this.__data__;if(A instanceof Ct){var X=A.__data__;if(!Re||X.length<n-1)return X.push([I,E]),this.size=++A.size,this;A=this.__data__=new kt(X)}return A.set(I,E),this.size=A.size,this}vn.prototype.clear=Hd,vn.prototype.delete=Bd,vn.prototype.get=Wd,vn.prototype.has=Jd,vn.prototype.set=zd;function Gd(I,E){var A=Ei(I),X=!A&&df(I),Te=!A&&!X&&To(I),fe=!A&&!X&&!Te&&Na(I),Me=A||X||Te||fe,ze=Me?Ke(I.length,String):[],Ze=ze.length;for(var De in I)tt.call(I,De)&&!(Me&&(De=="length"||Te&&(De=="offset"||De=="parent")||fe&&(De=="buffer"||De=="byteLength"||De=="byteOffset")||sf(De,Ze)))&&ze.push(De);return ze}function Ci(I,E){for(var A=I.length;A--;)if(Ca(I[A][0],E))return A;return-1}function Qd(I,E,A){var X=E(I);return Ei(I)?X:Le(X,A(I))}function Gr(I){return I==null?I===void 0?P:x:ct&&ct in Object(I)?rf(I):uf(I)}function Ia(I){return Qr(I)&&Gr(I)==a}function ba(I,E,A,X,Te){return I===E?!0:I==null||E==null||!Qr(I)&&!Qr(E)?I!==I&&E!==E:Xd(I,E,A,X,ba,Te)}function Xd(I,E,A,X,Te,fe){var Me=Ei(I),ze=Ei(E),Ze=Me?c:wn(I),De=ze?c:wn(E);Ze=Ze==a?y:Ze,De=De==a?y:De;var yt=Ze==y,jt=De==y,rt=Ze==De;if(rt&&To(I)){if(!To(E))return!1;Me=!0,yt=!1}if(rt&&!yt)return fe||(fe=new vn),Me||Na(I)?_a(I,E,A,X,Te,fe):tf(I,E,Ze,A,X,Te,fe);if(!(A&o)){var Ot=yt&&tt.call(I,"__wrapped__"),Et=jt&&tt.call(E,"__wrapped__");if(Ot||Et){var In=Ot?I.value():I,rn=Et?E.value():E;return fe||(fe=new vn),Te(In,rn,A,X,fe)}}return rt?(fe||(fe=new vn),nf(I,E,A,X,Te,fe)):!1}function Yd(I){if(!Sa(I)||cf(I))return!1;var E=Oa(I)?gt:L;return E.test(Un(I))}function Zd(I){return Qr(I)&&Ea(I.length)&&!!M[Gr(I)]}function ef(I){if(!lf(I))return Kn(I);var E=[];for(var A in Object(I))tt.call(I,A)&&A!="constructor"&&E.push(A);return E}function _a(I,E,A,X,Te,fe){var Me=A&o,ze=I.length,Ze=E.length;if(ze!=Ze&&!(Me&&Ze>ze))return!1;var De=fe.get(I);if(De&&fe.get(E))return De==E;var yt=-1,jt=!0,rt=A&i?new xi:void 0;for(fe.set(I,E),fe.set(E,I);++yt<ze;){var Ot=I[yt],Et=E[yt];if(X)var In=Me?X(Et,Ot,yt,E,I,fe):X(Ot,Et,yt,I,E,fe);if(In!==void 0){if(In)continue;jt=!1;break}if(rt){if(!Ge(E,function(rn,Hn){if(!At(rt,Hn)&&(Ot===rn||Te(Ot,rn,A,X,fe)))return rt.push(Hn)})){jt=!1;break}}else if(!(Ot===Et||Te(Ot,Et,A,X,fe))){jt=!1;break}}return fe.delete(I),fe.delete(E),jt}function tf(I,E,A,X,Te,fe,Me){switch(A){case z:if(I.byteLength!=E.byteLength||I.byteOffset!=E.byteOffset)return!1;I=I.buffer,E=E.buffer;case G:return!(I.byteLength!=E.byteLength||!fe(new mn(I),new mn(E)));case d:case f:case h:return Ca(+I,+E);case p:return I.name==E.name&&I.message==E.message;case _:case T:return I==E+"";case w:var ze=mt;case S:var Ze=X&o;if(ze||(ze=Dt),I.size!=E.size&&!Ze)return!1;var De=Me.get(I);if(De)return De==E;X|=i,Me.set(I,E);var yt=_a(ze(I),ze(E),X,Te,fe,Me);return Me.delete(I),yt;case N:if(lt)return lt.call(I)==lt.call(E)}return!1}function nf(I,E,A,X,Te,fe){var Me=A&o,ze=xa(I),Ze=ze.length,De=xa(E),yt=De.length;if(Ze!=yt&&!Me)return!1;for(var jt=Ze;jt--;){var rt=ze[jt];if(!(Me?rt in E:tt.call(E,rt)))return!1}var Ot=fe.get(I);if(Ot&&fe.get(E))return Ot==E;var Et=!0;fe.set(I,E),fe.set(E,I);for(var In=Me;++jt<Ze;){rt=ze[jt];var rn=I[rt],Hn=E[rt];if(X)var Ta=Me?X(Hn,rn,rt,E,I,fe):X(rn,Hn,rt,I,E,fe);if(!(Ta===void 0?rn===Hn||Te(rn,Hn,A,X,fe):Ta)){Et=!1;break}In||(In=rt=="constructor")}if(Et&&!In){var Si=I.constructor,Ni=E.constructor;Si!=Ni&&"constructor"in I&&"constructor"in E&&!(typeof Si=="function"&&Si instanceof Si&&typeof Ni=="function"&&Ni instanceof Ni)&&(Et=!1)}return fe.delete(I),fe.delete(E),Et}function xa(I){return Qd(I,hf,of)}function Oi(I,E){var A=I.__data__;return af(E)?A[typeof E=="string"?"string":"hash"]:A.map}function hr(I,E){var A=Qe(I,E);return Yd(A)?A:void 0}function rf(I){var E=tt.call(I,ct),A=I[ct];try{I[ct]=void 0;var X=!0}catch{}var Te=hn.call(I);return X&&(E?I[ct]=A:delete I[ct]),Te}var of=tn?function(I){return I==null?[]:(I=Object(I),Ee(tn(I),function(E){return en.call(I,E)}))}:mf,wn=Gr;(yn&&wn(new yn(new ArrayBuffer(1)))!=z||Re&&wn(new Re)!=w||nt&&wn(nt.resolve())!=b||re&&wn(new re)!=S||me&&wn(new me)!=q)&&(wn=function(I){var E=Gr(I),A=E==y?I.constructor:void 0,X=A?Un(A):"";if(X)switch(X){case nn:return z;case W:return w;case se:return b;case le:return S;case je:return q}return E});function sf(I,E){return E=E??s,!!E&&(typeof I=="number"||j.test(I))&&I>-1&&I%1==0&&I<E}function af(I){var E=typeof I;return E=="string"||E=="number"||E=="symbol"||E=="boolean"?I!=="__proto__":I===null}function cf(I){return!!Yt&&Yt in I}function lf(I){var E=I&&I.constructor,A=typeof E=="function"&&E.prototype||$e;return I===A}function uf(I){return hn.call(I)}function Un(I){if(I!=null){try{return Mt.call(I)}catch{}try{return I+""}catch{}}return""}function Ca(I,E){return I===E||I!==I&&E!==E}var df=Ia(function(){return arguments}())?Ia:function(I){return Qr(I)&&tt.call(I,"callee")&&!en.call(I,"callee")},Ei=Array.isArray;function ff(I){return I!=null&&Ea(I.length)&&!Oa(I)}var To=gn||gf;function pf(I,E){return ba(I,E)}function Oa(I){if(!Sa(I))return!1;var E=Gr(I);return E==m||E==g||E==u||E==C}function Ea(I){return typeof I=="number"&&I>-1&&I%1==0&&I<=s}function Sa(I){var E=typeof I;return I!=null&&(E=="object"||E=="function")}function Qr(I){return I!=null&&typeof I=="object"}var Na=H?Ie(H):Zd;function hf(I){return ff(I)?Gd(I):ef(I)}function mf(){return[]}function gf(){return!1}e.exports=pf})(Gi,Gi.exports);var yg=Gi.exports;const Al=Fs(yg),sr="other",Qi="uninstall-installation";function Dn(e){return!e.fieldName}function ks(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function vg(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!Dn(n)&&!!n.fieldName))||null}function wg(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>Dn(r)&&!!r.mapToName))||[]}function Ig(e){var n;return((n=e==null?void 0:e.optionalFields)==null?void 0:n.filter(r=>Dn(r)&&!!r.mapToName))||[]}function bg(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!Dn(n)&&!!n.fieldName))||null}const Pl=(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 _g(e){return Dn(e)?e.mapToName:e.fieldName}const Dl=(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)&&Pr(s==null?void 0:s.objectName),completed:e?!!Pl(e,s.objectName):!1})}),n},Ml=e=>{var n;return{name:sr,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function xg(e,t){var i;const n=Dl(e,t),o=!!((i=t==null?void 0:t.content)!=null&&i.write)?Ml(e):void 0;return o&&n.push(o),n}function Fl(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 kl(e,t){return Al(e,t)}function jl(e,t){return Al(e,t)}const Cg=(e,t,n)=>{var h,x,y,b,C,_,S,T,N;if(!e)return null;const r=ks(e,t),o=r&&vg(r),i=r&&bg(r),s=r&&wg(r),a=r&&Ig(r),c=(r==null?void 0:r.allFields)||[],u=(r==null?void 0:r.allFieldsMetadata)||{},d=n==null?void 0:n.content,f=((y=(x=(h=d==null?void 0:d.read)==null?void 0:h.objects)==null?void 0:x[t])==null?void 0:y.selectedFields)||{},p=((_=(C=(b=d==null?void 0:d.read)==null?void 0:b.objects)==null?void 0:C[t])==null?void 0:_.selectedValueMappings)||{},m=((N=(T=(S=d==null?void 0:d.read)==null?void 0:S.objects)==null?void 0:T[t])==null?void 0:N.selectedFieldMappings)||{},g={...f},w={...m};return{allFields:c,allFieldsMetadata:u,requiredFields:o,optionalFields:i,requiredMapFields:s,optionalMapFields:a,selectedOptionalFields:f,selectedFieldMappings:m,selectedValueMappings:p,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,isValueMappingsModified:!1,savedConfig:{optionalFields:g,requiredMapFields:w,selectedValueMappings:p}}},Og=(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 Ll(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:Cg(r,t,n),write:Og(o,n)}}const Vl=(e,t,n,r)=>{const o=Ll(e,n,t);r(n,o)},Eg=(e,t,n)=>{const r=xg(t,e),o={};r.forEach(({name:i,completed:s})=>{s&&(o[i]=Ll(e,i,t))}),n(o)},Kl=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(i=>r.add(_g(i))),{...Array.from(r).reduce((i,s)=>({...i,[s]:!0}),{}),...n||{}}},$l=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},ql=e=>{const{selectedValueMappings:t}=(e==null?void 0:e.read)||{};return t};function Ul(e,t){return t[e]||void 0}async function js({createConfig:e,projectId:t,integrationId:n,groupRef:r,connectionId:o,apiKey:i,setError:s,setInstallation:a,onInstallSuccess:c}){const u={projectIdOrName:t,integrationId:n,installation:{groupRef:r,connectionId:o,config:e}};try{const d=await dn().installationApi.createInstallation(u,{headers:{"X-Api-Key":i,"Content-Type":"application/json"}});a(d),c==null||c(d.id,d.config)}catch(d){ht(d,s)}}function po(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const Sg=(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)},Ng=(e,t,n,r)=>{const o=Kl(e),i=$l(e),s=ql(e),a=Sg(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 po(n)&&(c.content.proxy={enabled:!0}),c},Tg=(e,t,n,r,o,i,s,a,c,u,d,f)=>{const p=Ng(c,i,a,r);return p?js({createConfig:p,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:s,setError:u,setInstallation:d,onInstallSuccess:f}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},Hl=e=>{var t;return{...(t=e.write)==null?void 0:t.selectedWriteObjects}},Rg=e=>{const t=e.content.write;return t==null?void 0:t.objects},Ag=(e,t,n)=>{if(!Rg(t))return console.error("Error when getting write objects from hydratedRevision"),null;const o=Hl(e),i={revisionId:t.id,createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:o}}};return po(t)&&(i.content.proxy={enabled:!0}),i},Pg=(e,t,n,r,o,i,s,a,c,u,d)=>{const f=Ag(a,s,r);return f?js({createConfig:f,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:i,setError:c,setInstallation:u,onInstallSuccess:d}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},Dg={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 Bl({children:e,style:t}){return l.jsx(kn,{style:{...Dg,...t},children:e})}var Wl={exports:{}};/*!
5
5
  Copyright (c) 2018 Jed Watson.
6
6
  Licensed under the MIT License (MIT), see
7
7
  http://jedwatson.github.io/classnames
8
- */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var 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})()})(Dl);var Ig=Dl.exports;const wt=Es(Ig),bg="_button_1kk7v_1",_g="_buttonError_1kk7v_20",xg="_danger_1kk7v_34",Cg="_ghost_1kk7v_39",Eo={button:bg,buttonError:_g,danger:xg,ghost:Cg};function at({className:e,style:t,type:n,children:r,variant:o,...i}){const s=wt(Eo.button,{[Eo.danger]:o==="danger",[Eo.ghost]:o==="ghost",[e||""]:!!e});return l.jsx("button",{type:n,className:s,style:t,...i,children:r})}const Fl=w.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),dn=()=>{const e=w.useContext(Fl);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e},Og=()=>{var c;const e=Pr(),{selectedConnection:t,isConnectionsLoading:n}=Mr(),{projectIdOrName:r}=je(),{integrationId:o,integrationObj:i}=tt(),s=t==null?void 0:t.id,a=(c=i==null?void 0:i.latestRevision)==null?void 0:c.id;return Ar({queryKey:["amp","hydratedRevision",r,o,a],queryFn:async()=>{if(!r)throw new Error("projectIdOrName is required");if(!o)throw new Error("integrationId is required");if(!a)throw new Error("revisionId is required");if(!s)throw new Error("connectionId is required");return(await e()).revisionApi.getHydratedRevision({projectIdOrName:r,integrationId:o,revisionId:a,connectionId:s})},retry:3,enabled:!!r&&!!o&&!!a&&!!s&&!n})};function Eg({children:e}){const{integrationId:t,integrationObj:n}=tt(),{isError:r,removeError:o,setError:i}=Ht(),s=(n==null?void 0:n.name)||t,{data:a,isLoading:c,isError:u,error:d}=Og();w.useEffect(()=>{u?(i(ye.HYDRATED_REVISION,s),et(d)):o(ye.HYDRATED_REVISION,s)},[u,s,i,o,d]);const f=w.useMemo(()=>{var m,p,g;return{hydratedRevision:a||null,loading:c,readAction:(m=a==null?void 0:a.content)==null?void 0:m.read,writeObjects:((g=(p=a==null?void 0:a.content)==null?void 0:p.write)==null?void 0:g.objects)||[]}},[a,c]);if(c)return l.jsx(Fr,{});if(r(ye.HYDRATED_REVISION,s)){const p=`Error retrieving integration details for '${(n==null?void 0:n.name)||t||"unknown integration"}. This is sometimes caused by insufficient permissions with your credentials'`;return l.jsx(Gt,{message:p})}return l.jsx(Fl.Provider,{value:f,children:e})}const Ml=w.createContext(null);function jl(){const e=w.useContext(Ml);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const kl=w.createContext(()=>{});function Sg(){const e=w.useContext(kl);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}var Ll=Symbol.for("immer-nothing"),ka=Symbol.for("immer-draftable"),bt=Symbol.for("immer-state"),Ng=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 ht(e,...t){if(process.env.NODE_ENV!=="production"){const n=Ng[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 xr=Object.getPrototypeOf;function Cr(e){return!!e&&!!e[bt]}function tr(e){var t;return e?Kl(e)||Array.isArray(e)||!!e[ka]||!!((t=e.constructor)!=null&&t[ka])||so(e)||ao(e):!1}var Tg=Object.prototype.constructor.toString();function Kl(e){if(!e||typeof e!="object")return!1;const t=xr(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)===Tg}function Ui(e,t){oo(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function oo(e){const t=e[bt];return t?t.type_:Array.isArray(e)?1:so(e)?2:ao(e)?3:0}function ts(e,t){return oo(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Vl(e,t,n){const r=oo(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Rg(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function so(e){return e instanceof Map}function ao(e){return e instanceof Set}function qn(e){return e.copy_||e.base_}function ns(e,t){if(so(e))return new Map(e);if(ao(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Kl(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[bt];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(xr(e),r)}else{const r=xr(e);if(r!==null&&n)return{...e};const o=Object.create(r);return Object.assign(o,e)}}function Ts(e,t=!1){return co(e)||Cr(e)||!tr(e)||(oo(e)>1&&(e.set=e.add=e.clear=e.delete=Ag),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Ts(r,!0))),e}function Ag(){ht(2)}function co(e){return Object.isFrozen(e)}var Pg={};function nr(e){const t=Pg[e];return t||ht(0,e),t}var Qr;function $l(){return Qr}function Dg(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function La(e,t){t&&(nr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function rs(e){is(e),e.drafts_.forEach(Fg),e.drafts_=null}function is(e){e===Qr&&(Qr=e.parent_)}function Ka(e){return Qr=Dg(Qr,e)}function Fg(e){const t=e[bt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Va(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[bt].modified_&&(rs(t),ht(4)),tr(e)&&(e=Hi(t,e),t.parent_||Bi(t,e)),t.patches_&&nr("Patches").generateReplacementPatches_(n[bt].base_,e,t.patches_,t.inversePatches_)):e=Hi(t,n,[]),rs(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Ll?e:void 0}function Hi(e,t,n){if(co(t))return t;const r=t[bt];if(!r)return Ui(t,(o,i)=>$a(e,r,t,o,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Bi(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),Ui(i,(a,c)=>$a(e,r,o,a,c,n,s)),Bi(e,o,!1),n&&e.patches_&&nr("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function $a(e,t,n,r,o,i,s){if(process.env.NODE_ENV!=="production"&&o===n&&ht(5),Cr(o)){const a=i&&t&&t.type_!==3&&!ts(t.assigned_,r)?i.concat(r):void 0,c=Hi(e,o,a);if(Vl(n,r,c),Cr(c))e.canAutoFreeze_=!1;else return}else s&&n.add(o);if(tr(o)&&!co(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Hi(e,o),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&Bi(e,o)}}function Bi(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ts(t,n)}function Mg(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:$l(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=Rs;n&&(o=[r],i=Xr);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}var Rs={get(e,t){if(t===bt)return e;const n=qn(e);if(!ts(n,t))return jg(e,n,t);const r=n[t];return e.finalized_||!tr(r)?r:r===So(e.base_,t)?(No(e),e.copy_[t]=ss(r,e)):r},has(e,t){return t in qn(e)},ownKeys(e){return Reflect.ownKeys(qn(e))},set(e,t,n){const r=ql(qn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=So(qn(e),t),i=o==null?void 0:o[bt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Rg(n,o)&&(n!==void 0||ts(e.base_,t)))return!0;No(e),os(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 So(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,No(e),os(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=qn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){ht(11)},getPrototypeOf(e){return xr(e.base_)},setPrototypeOf(){ht(12)}},Xr={};Ui(Rs,(e,t)=>{Xr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Xr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&ht(13),Xr.set.call(this,e,t,void 0)};Xr.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&ht(14),Rs.set.call(this,e[0],t,n,e[0])};function So(e,t){const n=e[bt];return(n?qn(n):e)[t]}function jg(e,t,n){var o;const r=ql(t,n);return r?"value"in r?r.value:(o=r.get)==null?void 0:o.call(e.draft_):void 0}function ql(e,t){if(!(t in e))return;let n=xr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=xr(n)}}function os(e){e.modified_||(e.modified_=!0,e.parent_&&os(e.parent_))}function No(e){e.copy_||(e.copy_=ns(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var kg=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,...u){return s.produce(c,d=>n.call(this,d,...u))}}typeof n!="function"&&ht(6),r!==void 0&&typeof r!="function"&&ht(7);let o;if(tr(t)){const i=Ka(this),s=ss(t,void 0);let a=!0;try{o=n(s),a=!1}finally{a?rs(i):is(i)}return La(i,r),Va(o,i)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===Ll&&(o=void 0),this.autoFreeze_&&Ts(o,!0),r){const i=[],s=[];nr("Patches").generateReplacementPatches_(t,o,i,s),r(i,s)}return o}else ht(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){tr(e)||ht(8),Cr(e)&&(e=Lg(e));const t=Ka(this),n=ss(e,void 0);return n[bt].isManual_=!0,is(t),n}finishDraft(e,t){const n=e&&e[bt];(!n||!n.isManual_)&&ht(9);const{scope_:r}=n;return La(r,t),Va(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=nr("Patches").applyPatches_;return Cr(e)?r(e,t):this.produce(e,o=>r(o,t))}};function ss(e,t){const n=so(e)?nr("MapSet").proxyMap_(e,t):ao(e)?nr("MapSet").proxySet_(e,t):Mg(e,t);return(t?t.scope_:$l()).drafts_.push(n),n}function Lg(e){return Cr(e)||ht(10,e),Ul(e)}function Ul(e){if(!tr(e)||co(e))return e;const t=e[bt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ns(e,t.scope_.immer_.useStrictShallowCopy_)}else n=ns(e,!0);return Ui(n,(r,o)=>{Vl(n,r,Ul(o))}),t&&(t.finalized_=!1),n}var _t=new kg,$r=_t.produce;_t.produceWithPatches.bind(_t);_t.setAutoFreeze.bind(_t);_t.setUseStrictShallowCopy.bind(_t);_t.applyPatches.bind(_t);_t.createDraft.bind(_t);_t.finishDraft.bind(_t);const Hl=w.createContext(void 0),Kg={};function As(){const e=w.useContext(Hl);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function Vg({children:e}){const{installation:t}=tt(),{hydratedRevision:n,loading:r}=dn(),[o,i]=w.useState(Kg),s=t==null?void 0:t.config;w.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(o).length>0)&&fg(n,s,i)},[n,r,s,o]);const a=w.useCallback((p,g)=>{i(y=>$r(y,h=>{h[p]=$r(h[p],g)}))},[i]),c=w.useCallback((p,g)=>{i(y=>$r(y,h=>{h[p]=g}))},[i]),u=w.useCallback(()=>{i($r(p=>{const g=p.other.write;g&&(g.isWriteModified=!1)}))},[i]),d=w.useCallback(p=>{i($r(g=>{var h;const y=(h=g[p])==null?void 0:h.read;y&&(y.isOptionalFieldsModified=!1,y.isRequiredMapFieldsModified=!1,y.isValueMappingsModified=!1)}))},[i]),f=w.useCallback(p=>{p===er?u():d(p)},[d,u]),m=w.useMemo(()=>({objectConfigurationsState:o,setObjectConfigurationsState:i,setConfigureState:a,resetConfigureState:c,resetPendingConfigurationState:f}),[o,c,f,a]);return l.jsx(Hl.Provider,{value:m,children:e})}const xt=()=>{const{appName:e}=je(),{objectConfigurationsState:t,setConfigureState:n}=As(),{selectedObjectName:r}=jl(),o=Rl(r||"",t);return{appName:e,configureState:o,setConfigureState:n,selectedObjectName:r}};function $g(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=!Cl(o,n);e.read.isRequiredMapFieldsModified=s}}function Yr(e,t,n){t(e,r=>$g(r,n))}const qg=(e,t)=>e.filter(n=>!t.has(n));function Ug(){var m,p,g;const{selectedObjectName:e,configureState:t,setConfigureState:n}=xt(),{fieldMapping:r}=tt(),o=((m=t==null?void 0:t.read)==null?void 0:m.selectedFieldMappings)||{},i=Object.keys(o),s=((p=t==null?void 0:t.read)==null?void 0:p.requiredMapFields)||[],a=((g=t==null?void 0:t.read)==null?void 0:g.optionalMapFields)||[],c=e&&r?Object.values(r[e]||{}).flat().filter(y=>!y.fieldName):[],u=s.concat(c,a).map(y=>y.mapToName),d=new Set(u),f=qg(i,d);w.useEffect(()=>{e&&f.length&&Yr(e,n,f.map(y=>({field:y,value:null})))},[e,n,f])}function ln(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 pe(){return pe=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},pe.apply(null,arguments)}function as(e,t){return as=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},as(e,t)}function Hg(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,as(e,t)}var cs={exports:{}},Ti={exports:{}},be={};/** @license React v16.13.1
8
+ */(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})()})(Wl);var Mg=Wl.exports;const wt=Fs(Mg),Fg="_button_1kk7v_1",kg="_buttonError_1kk7v_20",jg="_danger_1kk7v_34",Lg="_ghost_1kk7v_39",Mo={button:Fg,buttonError:kg,danger:jg,ghost:Lg};function ot({className:e,style:t,type:n,children:r,variant:o,...i}){const s=wt(Mo.button,{[Mo.danger]:o==="danger",[Mo.ghost]:o==="ghost",[e||""]:!!e});return l.jsx("button",{type:n,className:s,style:t,...i,children:r})}const Jl=v.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),pn=()=>{const e=v.useContext(Jl);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e},Vg=()=>{var c;const e=pr(),{selectedConnection:t,isConnectionsLoading:n}=Br(),{projectIdOrName:r}=ke(),{integrationId:o,integrationObj:i}=et(),s=t==null?void 0:t.id,a=(c=i==null?void 0:i.latestRevision)==null?void 0:c.id;return qr({queryKey:["amp","hydratedRevision",r,o,a],queryFn:async()=>{if(!r)throw new Error("projectIdOrName is required");if(!o)throw new Error("integrationId is required");if(!a)throw new Error("revisionId is required");if(!s)throw new Error("connectionId is required");return(await e()).revisionApi.getHydratedRevision({projectIdOrName:r,integrationId:o,revisionId:a,connectionId:s})},retry:3,enabled:!!r&&!!o&&!!a&&!!s&&!n})};function Kg({children:e}){const{integrationId:t,integrationObj:n}=et(),{isError:r,removeError:o,setError:i}=Rt(),s=(n==null?void 0:n.name)||t,{data:a,isLoading:c,isError:u,error:d}=Vg();v.useEffect(()=>{u?(i(ue.HYDRATED_REVISION,s),ht(d)):o(ue.HYDRATED_REVISION,s)},[u,s,i,o,d]);const f=v.useMemo(()=>{var p,m,g;return{hydratedRevision:a||null,loading:c,readAction:(p=a==null?void 0:a.content)==null?void 0:p.read,writeObjects:((g=(m=a==null?void 0:a.content)==null?void 0:m.write)==null?void 0:g.objects)||[]}},[a,c]);if(c)return l.jsx(Hr,{});if(r(ue.HYDRATED_REVISION,s)){const m=`Error retrieving integration details for '${(n==null?void 0:n.name)||t||"unknown integration"}. This is sometimes caused by insufficient permissions with your credentials'`;return l.jsx(zt,{message:m})}return l.jsx(Jl.Provider,{value:f,children:e})}const zl=v.createContext(null);function Gl(){const e=v.useContext(zl);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const Ql=v.createContext(()=>{});function $g(){const e=v.useContext(Ql);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}var Xl=Symbol.for("immer-nothing"),Wa=Symbol.for("immer-draftable"),bt=Symbol.for("immer-state"),qg=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 pt(e,...t){if(process.env.NODE_ENV!=="production"){const n=qg[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 Dr=Object.getPrototypeOf;function Mr(e){return!!e&&!!e[bt]}function ar(e){var t;return e?Yl(e)||Array.isArray(e)||!!e[Wa]||!!((t=e.constructor)!=null&&t[Wa])||mo(e)||go(e):!1}var Ug=Object.prototype.constructor.toString();function Yl(e){if(!e||typeof e!="object")return!1;const t=Dr(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)===Ug}function Xi(e,t){ho(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function ho(e){const t=e[bt];return t?t.type_:Array.isArray(e)?1:mo(e)?2:go(e)?3:0}function us(e,t){return ho(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Zl(e,t,n){const r=ho(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Hg(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function mo(e){return e instanceof Map}function go(e){return e instanceof Set}function Wn(e){return e.copy_||e.base_}function ds(e,t){if(mo(e))return new Map(e);if(go(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Yl(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[bt];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(Dr(e),r)}else{const r=Dr(e);if(r!==null&&n)return{...e};const o=Object.create(r);return Object.assign(o,e)}}function Ls(e,t=!1){return yo(e)||Mr(e)||!ar(e)||(ho(e)>1&&(e.set=e.add=e.clear=e.delete=Bg),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Ls(r,!0))),e}function Bg(){pt(2)}function yo(e){return Object.isFrozen(e)}var Wg={};function cr(e){const t=Wg[e];return t||pt(0,e),t}var ii;function eu(){return ii}function Jg(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Ja(e,t){t&&(cr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function fs(e){ps(e),e.drafts_.forEach(zg),e.drafts_=null}function ps(e){e===ii&&(ii=e.parent_)}function za(e){return ii=Jg(ii,e)}function zg(e){const t=e[bt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Ga(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[bt].modified_&&(fs(t),pt(4)),ar(e)&&(e=Yi(t,e),t.parent_||Zi(t,e)),t.patches_&&cr("Patches").generateReplacementPatches_(n[bt].base_,e,t.patches_,t.inversePatches_)):e=Yi(t,n,[]),fs(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Xl?e:void 0}function Yi(e,t,n){if(yo(t))return t;const r=t[bt];if(!r)return Xi(t,(o,i)=>Qa(e,r,t,o,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Zi(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),Xi(i,(a,c)=>Qa(e,r,o,a,c,n,s)),Zi(e,o,!1),n&&e.patches_&&cr("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Qa(e,t,n,r,o,i,s){if(process.env.NODE_ENV!=="production"&&o===n&&pt(5),Mr(o)){const a=i&&t&&t.type_!==3&&!us(t.assigned_,r)?i.concat(r):void 0,c=Yi(e,o,a);if(Zl(n,r,c),Mr(c))e.canAutoFreeze_=!1;else return}else s&&n.add(o);if(ar(o)&&!yo(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Yi(e,o),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&Zi(e,o)}}function Zi(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ls(t,n)}function Gg(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:eu(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=Vs;n&&(o=[r],i=oi);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}var Vs={get(e,t){if(t===bt)return e;const n=Wn(e);if(!us(n,t))return Qg(e,n,t);const r=n[t];return e.finalized_||!ar(r)?r:r===Fo(e.base_,t)?(ko(e),e.copy_[t]=ms(r,e)):r},has(e,t){return t in Wn(e)},ownKeys(e){return Reflect.ownKeys(Wn(e))},set(e,t,n){const r=tu(Wn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=Fo(Wn(e),t),i=o==null?void 0:o[bt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Hg(n,o)&&(n!==void 0||us(e.base_,t)))return!0;ko(e),hs(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 Fo(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,ko(e),hs(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Wn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){pt(11)},getPrototypeOf(e){return Dr(e.base_)},setPrototypeOf(){pt(12)}},oi={};Xi(Vs,(e,t)=>{oi[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});oi.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&pt(13),oi.set.call(this,e,t,void 0)};oi.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&pt(14),Vs.set.call(this,e[0],t,n,e[0])};function Fo(e,t){const n=e[bt];return(n?Wn(n):e)[t]}function Qg(e,t,n){var o;const r=tu(t,n);return r?"value"in r?r.value:(o=r.get)==null?void 0:o.call(e.draft_):void 0}function tu(e,t){if(!(t in e))return;let n=Dr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Dr(n)}}function hs(e){e.modified_||(e.modified_=!0,e.parent_&&hs(e.parent_))}function ko(e){e.copy_||(e.copy_=ds(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Xg=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,...u){return s.produce(c,d=>n.call(this,d,...u))}}typeof n!="function"&&pt(6),r!==void 0&&typeof r!="function"&&pt(7);let o;if(ar(t)){const i=za(this),s=ms(t,void 0);let a=!0;try{o=n(s),a=!1}finally{a?fs(i):ps(i)}return Ja(i,r),Ga(o,i)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===Xl&&(o=void 0),this.autoFreeze_&&Ls(o,!0),r){const i=[],s=[];cr("Patches").generateReplacementPatches_(t,o,i,s),r(i,s)}return o}else pt(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){ar(e)||pt(8),Mr(e)&&(e=Yg(e));const t=za(this),n=ms(e,void 0);return n[bt].isManual_=!0,ps(t),n}finishDraft(e,t){const n=e&&e[bt];(!n||!n.isManual_)&&pt(9);const{scope_:r}=n;return Ja(r,t),Ga(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=cr("Patches").applyPatches_;return Mr(e)?r(e,t):this.produce(e,o=>r(o,t))}};function ms(e,t){const n=mo(e)?cr("MapSet").proxyMap_(e,t):go(e)?cr("MapSet").proxySet_(e,t):Gg(e,t);return(t?t.scope_:eu()).drafts_.push(n),n}function Yg(e){return Mr(e)||pt(10,e),nu(e)}function nu(e){if(!ar(e)||yo(e))return e;const t=e[bt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ds(e,t.scope_.immer_.useStrictShallowCopy_)}else n=ds(e,!0);return Xi(n,(r,o)=>{Zl(n,r,nu(o))}),t&&(t.finalized_=!1),n}var _t=new Xg,Xr=_t.produce;_t.produceWithPatches.bind(_t);_t.setAutoFreeze.bind(_t);_t.setUseStrictShallowCopy.bind(_t);_t.applyPatches.bind(_t);_t.createDraft.bind(_t);_t.finishDraft.bind(_t);const ru=v.createContext(void 0),Zg={};function Ks(){const e=v.useContext(ru);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function ey({children:e}){const{installation:t}=et(),{hydratedRevision:n,loading:r}=pn(),[o,i]=v.useState(Zg),s=t==null?void 0:t.config;v.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(o).length>0)&&Eg(n,s,i)},[n,r,s,o]);const a=v.useCallback((m,g)=>{i(w=>Xr(w,h=>{h[m]=Xr(h[m],g)}))},[i]),c=v.useCallback((m,g)=>{i(w=>Xr(w,h=>{h[m]=g}))},[i]),u=v.useCallback(()=>{i(Xr(m=>{const g=m.other.write;g&&(g.isWriteModified=!1)}))},[i]),d=v.useCallback(m=>{i(Xr(g=>{var h;const w=(h=g[m])==null?void 0:h.read;w&&(w.isOptionalFieldsModified=!1,w.isRequiredMapFieldsModified=!1,w.isValueMappingsModified=!1)}))},[i]),f=v.useCallback(m=>{m===sr?u():d(m)},[d,u]),p=v.useMemo(()=>({objectConfigurationsState:o,setObjectConfigurationsState:i,setConfigureState:a,resetConfigureState:c,resetPendingConfigurationState:f}),[o,c,f,a]);return l.jsx(ru.Provider,{value:p,children:e})}const xt=()=>{const{appName:e}=ke(),{objectConfigurationsState:t,setConfigureState:n}=Ks(),{selectedObjectName:r}=Gl(),o=Ul(r||"",t);return{appName:e,configureState:o,setConfigureState:n,selectedObjectName:r}};function ty(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=!jl(o,n);e.read.isRequiredMapFieldsModified=s}}function si(e,t,n){t(e,r=>ty(r,n))}const ny=(e,t)=>e.filter(n=>!t.has(n));function ry(){var p,m,g;const{selectedObjectName:e,configureState:t,setConfigureState:n}=xt(),{fieldMapping:r}=et(),o=((p=t==null?void 0:t.read)==null?void 0:p.selectedFieldMappings)||{},i=Object.keys(o),s=((m=t==null?void 0:t.read)==null?void 0:m.requiredMapFields)||[],a=((g=t==null?void 0:t.read)==null?void 0:g.optionalMapFields)||[],c=e&&r?Object.values(r[e]||{}).flat().filter(w=>!w.fieldName):[],u=s.concat(c,a).map(w=>w.mapToName),d=new Set(u),f=ny(i,d);v.useEffect(()=>{e&&f.length&&si(e,n,f.map(w=>({field:w,value:null})))},[e,n,f])}function ln(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 gs(e,t){return gs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},gs(e,t)}function iy(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,gs(e,t)}var ys={exports:{}},Fi={exports:{}},be={};/** @license React v16.13.1
9
9
  * react-is.production.min.js
10
10
  *
11
11
  * Copyright (c) Facebook, Inc. and its affiliates.
12
12
  *
13
13
  * This source code is licensed under the MIT license found in the
14
14
  * LICENSE file in the root directory of this source tree.
15
- */var qa;function Bg(){if(qa)return be;qa=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,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,y=e?Symbol.for("react.block"):60121,h=e?Symbol.for("react.fundamental"):60117,_=e?Symbol.for("react.responder"):60118,v=e?Symbol.for("react.scope"):60119;function x(b){if(typeof b=="object"&&b!==null){var N=b.$$typeof;switch(N){case t:switch(b=b.type,b){case c:case u:case r:case i:case o:case f:return b;default:switch(b=b&&b.$$typeof,b){case a:case d:case g:case p:case s:return b;default:return N}}case n:return N}}}function C(b){return x(b)===u}return be.AsyncMode=c,be.ConcurrentMode=u,be.ContextConsumer=a,be.ContextProvider=s,be.Element=t,be.ForwardRef=d,be.Fragment=r,be.Lazy=g,be.Memo=p,be.Portal=n,be.Profiler=i,be.StrictMode=o,be.Suspense=f,be.isAsyncMode=function(b){return C(b)||x(b)===c},be.isConcurrentMode=C,be.isContextConsumer=function(b){return x(b)===a},be.isContextProvider=function(b){return x(b)===s},be.isElement=function(b){return typeof b=="object"&&b!==null&&b.$$typeof===t},be.isForwardRef=function(b){return x(b)===d},be.isFragment=function(b){return x(b)===r},be.isLazy=function(b){return x(b)===g},be.isMemo=function(b){return x(b)===p},be.isPortal=function(b){return x(b)===n},be.isProfiler=function(b){return x(b)===i},be.isStrictMode=function(b){return x(b)===o},be.isSuspense=function(b){return x(b)===f},be.isValidElementType=function(b){return typeof b=="string"||typeof b=="function"||b===r||b===u||b===i||b===o||b===f||b===m||typeof b=="object"&&b!==null&&(b.$$typeof===g||b.$$typeof===p||b.$$typeof===s||b.$$typeof===a||b.$$typeof===d||b.$$typeof===h||b.$$typeof===_||b.$$typeof===v||b.$$typeof===y)},be.typeOf=x,be}var _e={};/** @license React v16.13.1
15
+ */var Xa;function oy(){if(Xa)return be;Xa=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,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,w=e?Symbol.for("react.block"):60121,h=e?Symbol.for("react.fundamental"):60117,x=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function b(_){if(typeof _=="object"&&_!==null){var S=_.$$typeof;switch(S){case t:switch(_=_.type,_){case c:case u:case r:case i:case o:case f:return _;default:switch(_=_&&_.$$typeof,_){case a:case d:case g:case m:case s:return _;default:return S}}case n:return S}}}function C(_){return b(_)===u}return be.AsyncMode=c,be.ConcurrentMode=u,be.ContextConsumer=a,be.ContextProvider=s,be.Element=t,be.ForwardRef=d,be.Fragment=r,be.Lazy=g,be.Memo=m,be.Portal=n,be.Profiler=i,be.StrictMode=o,be.Suspense=f,be.isAsyncMode=function(_){return C(_)||b(_)===c},be.isConcurrentMode=C,be.isContextConsumer=function(_){return b(_)===a},be.isContextProvider=function(_){return b(_)===s},be.isElement=function(_){return typeof _=="object"&&_!==null&&_.$$typeof===t},be.isForwardRef=function(_){return b(_)===d},be.isFragment=function(_){return b(_)===r},be.isLazy=function(_){return b(_)===g},be.isMemo=function(_){return b(_)===m},be.isPortal=function(_){return b(_)===n},be.isProfiler=function(_){return b(_)===i},be.isStrictMode=function(_){return b(_)===o},be.isSuspense=function(_){return b(_)===f},be.isValidElementType=function(_){return typeof _=="string"||typeof _=="function"||_===r||_===u||_===i||_===o||_===f||_===p||typeof _=="object"&&_!==null&&(_.$$typeof===g||_.$$typeof===m||_.$$typeof===s||_.$$typeof===a||_.$$typeof===d||_.$$typeof===h||_.$$typeof===x||_.$$typeof===y||_.$$typeof===w)},be.typeOf=b,be}var _e={};/** @license React v16.13.1
16
16
  * react-is.development.js
17
17
  *
18
18
  * Copyright (c) Facebook, Inc. and its affiliates.
19
19
  *
20
20
  * This source code is licensed under the MIT license found in the
21
21
  * LICENSE file in the root directory of this source tree.
22
- */var Ua;function Wg(){return Ua||(Ua=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,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,y=e?Symbol.for("react.block"):60121,h=e?Symbol.for("react.fundamental"):60117,_=e?Symbol.for("react.responder"):60118,v=e?Symbol.for("react.scope"):60119;function x(M){return typeof M=="string"||typeof M=="function"||M===r||M===u||M===i||M===o||M===f||M===m||typeof M=="object"&&M!==null&&(M.$$typeof===g||M.$$typeof===p||M.$$typeof===s||M.$$typeof===a||M.$$typeof===d||M.$$typeof===h||M.$$typeof===_||M.$$typeof===v||M.$$typeof===y)}function C(M){if(typeof M=="object"&&M!==null){var we=M.$$typeof;switch(we){case t:var H=M.type;switch(H){case c:case u:case r:case i:case o:case f:return H;default:var Ee=H&&H.$$typeof;switch(Ee){case a:case d:case g:case p:case s:return Ee;default:return we}}case n:return we}}}var b=c,N=u,R=a,S=s,F=t,q=d,z=r,J=g,ne=p,B=n,ce=i,re=o,X=f,fe=!1;function ve(M){return fe||(fe=!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.")),T(M)||C(M)===c}function T(M){return C(M)===u}function j(M){return C(M)===a}function V(M){return C(M)===s}function L(M){return typeof M=="object"&&M!==null&&M.$$typeof===t}function k(M){return C(M)===d}function D(M){return C(M)===r}function Z(M){return C(M)===g}function ee(M){return C(M)===p}function U(M){return C(M)===n}function te(M){return C(M)===i}function G(M){return C(M)===o}function ue(M){return C(M)===f}_e.AsyncMode=b,_e.ConcurrentMode=N,_e.ContextConsumer=R,_e.ContextProvider=S,_e.Element=F,_e.ForwardRef=q,_e.Fragment=z,_e.Lazy=J,_e.Memo=ne,_e.Portal=B,_e.Profiler=ce,_e.StrictMode=re,_e.Suspense=X,_e.isAsyncMode=ve,_e.isConcurrentMode=T,_e.isContextConsumer=j,_e.isContextProvider=V,_e.isElement=L,_e.isForwardRef=k,_e.isFragment=D,_e.isLazy=Z,_e.isMemo=ee,_e.isPortal=U,_e.isProfiler=te,_e.isStrictMode=G,_e.isSuspense=ue,_e.isValidElementType=x,_e.typeOf=C}()),_e}var Ha;function Bl(){return Ha||(Ha=1,process.env.NODE_ENV==="production"?Ti.exports=Bg():Ti.exports=Wg()),Ti.exports}/*
22
+ */var Ya;function sy(){return Ya||(Ya=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,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,w=e?Symbol.for("react.block"):60121,h=e?Symbol.for("react.fundamental"):60117,x=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function b(F){return typeof F=="string"||typeof F=="function"||F===r||F===u||F===i||F===o||F===f||F===p||typeof F=="object"&&F!==null&&(F.$$typeof===g||F.$$typeof===m||F.$$typeof===s||F.$$typeof===a||F.$$typeof===d||F.$$typeof===h||F.$$typeof===x||F.$$typeof===y||F.$$typeof===w)}function C(F){if(typeof F=="object"&&F!==null){var ve=F.$$typeof;switch(ve){case t:var H=F.type;switch(H){case c:case u:case r:case i:case o:case f:return H;default:var Ee=H&&H.$$typeof;switch(Ee){case a:case d:case g:case m:case s:return Ee;default:return ve}}case n:return ve}}}var _=c,S=u,T=a,N=s,P=t,q=d,G=r,z=g,ne=m,B=n,ce=i,oe=o,te=f,ge=!1;function we(F){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.")),R(F)||C(F)===c}function R(F){return C(F)===u}function k(F){return C(F)===a}function $(F){return C(F)===s}function L(F){return typeof F=="object"&&F!==null&&F.$$typeof===t}function j(F){return C(F)===d}function M(F){return C(F)===r}function Y(F){return C(F)===g}function Z(F){return C(F)===m}function U(F){return C(F)===n}function ee(F){return C(F)===i}function Q(F){return C(F)===o}function de(F){return C(F)===f}_e.AsyncMode=_,_e.ConcurrentMode=S,_e.ContextConsumer=T,_e.ContextProvider=N,_e.Element=P,_e.ForwardRef=q,_e.Fragment=G,_e.Lazy=z,_e.Memo=ne,_e.Portal=B,_e.Profiler=ce,_e.StrictMode=oe,_e.Suspense=te,_e.isAsyncMode=we,_e.isConcurrentMode=R,_e.isContextConsumer=k,_e.isContextProvider=$,_e.isElement=L,_e.isForwardRef=j,_e.isFragment=M,_e.isLazy=Y,_e.isMemo=Z,_e.isPortal=U,_e.isProfiler=ee,_e.isStrictMode=Q,_e.isSuspense=de,_e.isValidElementType=b,_e.typeOf=C}()),_e}var Za;function iu(){return Za||(Za=1,process.env.NODE_ENV==="production"?Fi.exports=oy():Fi.exports=sy()),Fi.exports}/*
23
23
  object-assign
24
24
  (c) Sindre Sorhus
25
25
  @license MIT
26
- */var To,Ba;function Jg(){if(Ba)return To;Ba=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(d){return s[d]});if(c.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(d){u[d]=d}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return To=o()?Object.assign:function(i,s){for(var a,c=r(i),u,d=1;d<arguments.length;d++){a=Object(arguments[d]);for(var f in a)t.call(a,f)&&(c[f]=a[f]);if(e){u=e(a);for(var m=0;m<u.length;m++)n.call(a,u[m])&&(c[u[m]]=a[u[m]])}}return c},To}var Ro,Wa;function Ps(){if(Wa)return Ro;Wa=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Ro=e,Ro}var Ao,Ja;function Wl(){return Ja||(Ja=1,Ao=Function.call.bind(Object.prototype.hasOwnProperty)),Ao}var Po,za;function zg(){if(za)return Po;za=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Ps(),n={},r=Wl();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,u){if(process.env.NODE_ENV!=="production"){for(var d in i)if(r(i,d)){var f;try{if(typeof i[d]!="function"){var m=Error((c||"React class")+": "+a+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw m.name="Invariant Violation",m}f=i[d](s,d,c,a,null,t)}catch(g){f=g}if(f&&!(f instanceof Error)&&e((c||"React class")+": type specification of "+a+" `"+d+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof f+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),f instanceof Error&&!(f.message in n)){n[f.message]=!0;var p=u?u():"";e("Failed "+a+" type: "+f.message+(p??""))}}}}return o.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Po=o,Po}var Do,Ga;function Gg(){if(Ga)return Do;Ga=1;var e=Bl(),t=Jg(),n=Ps(),r=Wl(),o=zg(),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 Do=function(a,c){var u=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function f(T){var j=T&&(u&&T[u]||T[d]);if(typeof j=="function")return j}var m="<<anonymous>>",p={array:_("array"),bigint:_("bigint"),bool:_("boolean"),func:_("function"),number:_("number"),object:_("object"),string:_("string"),symbol:_("symbol"),any:v(),arrayOf:x,element:C(),elementType:b(),instanceOf:N,node:q(),objectOf:S,oneOf:R,oneOfType:F,shape:J,exact:ne};function g(T,j){return T===j?T!==0||1/T===1/j:T!==T&&j!==j}function y(T,j){this.message=T,this.data=j&&typeof j=="object"?j:{},this.stack=""}y.prototype=Error.prototype;function h(T){if(process.env.NODE_ENV!=="production")var j={},V=0;function L(D,Z,ee,U,te,G,ue){if(U=U||m,G=G||ee,ue!==n){if(c){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}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var we=U+":"+ee;!j[we]&&V<3&&(i("You are manually calling a React.PropTypes validation function for the `"+G+"` prop on `"+U+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),j[we]=!0,V++)}}return Z[ee]==null?D?Z[ee]===null?new y("The "+te+" `"+G+"` is marked as required "+("in `"+U+"`, but its value is `null`.")):new y("The "+te+" `"+G+"` is marked as required in "+("`"+U+"`, but its value is `undefined`.")):null:T(Z,ee,U,te,G)}var k=L.bind(null,!1);return k.isRequired=L.bind(null,!0),k}function _(T){function j(V,L,k,D,Z,ee){var U=V[L],te=re(U);if(te!==T){var G=X(U);return new y("Invalid "+D+" `"+Z+"` of type "+("`"+G+"` supplied to `"+k+"`, expected ")+("`"+T+"`."),{expectedType:T})}return null}return h(j)}function v(){return h(s)}function x(T){function j(V,L,k,D,Z){if(typeof T!="function")return new y("Property `"+Z+"` of component `"+k+"` has invalid PropType notation inside arrayOf.");var ee=V[L];if(!Array.isArray(ee)){var U=re(ee);return new y("Invalid "+D+" `"+Z+"` of type "+("`"+U+"` supplied to `"+k+"`, expected an array."))}for(var te=0;te<ee.length;te++){var G=T(ee,te,k,D,Z+"["+te+"]",n);if(G instanceof Error)return G}return null}return h(j)}function C(){function T(j,V,L,k,D){var Z=j[V];if(!a(Z)){var ee=re(Z);return new y("Invalid "+k+" `"+D+"` of type "+("`"+ee+"` supplied to `"+L+"`, expected a single ReactElement."))}return null}return h(T)}function b(){function T(j,V,L,k,D){var Z=j[V];if(!e.isValidElementType(Z)){var ee=re(Z);return new y("Invalid "+k+" `"+D+"` of type "+("`"+ee+"` supplied to `"+L+"`, expected a single ReactElement type."))}return null}return h(T)}function N(T){function j(V,L,k,D,Z){if(!(V[L]instanceof T)){var ee=T.name||m,U=ve(V[L]);return new y("Invalid "+D+" `"+Z+"` of type "+("`"+U+"` supplied to `"+k+"`, expected ")+("instance of `"+ee+"`."))}return null}return h(j)}function R(T){if(!Array.isArray(T))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 j(V,L,k,D,Z){for(var ee=V[L],U=0;U<T.length;U++)if(g(ee,T[U]))return null;var te=JSON.stringify(T,function(ue,M){var we=X(M);return we==="symbol"?String(M):M});return new y("Invalid "+D+" `"+Z+"` of value `"+String(ee)+"` "+("supplied to `"+k+"`, expected one of "+te+"."))}return h(j)}function S(T){function j(V,L,k,D,Z){if(typeof T!="function")return new y("Property `"+Z+"` of component `"+k+"` has invalid PropType notation inside objectOf.");var ee=V[L],U=re(ee);if(U!=="object")return new y("Invalid "+D+" `"+Z+"` of type "+("`"+U+"` supplied to `"+k+"`, expected an object."));for(var te in ee)if(r(ee,te)){var G=T(ee,te,k,D,Z+"."+te,n);if(G instanceof Error)return G}return null}return h(j)}function F(T){if(!Array.isArray(T))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var j=0;j<T.length;j++){var V=T[j];if(typeof V!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+fe(V)+" at index "+j+"."),s}function L(k,D,Z,ee,U){for(var te=[],G=0;G<T.length;G++){var ue=T[G],M=ue(k,D,Z,ee,U,n);if(M==null)return null;M.data&&r(M.data,"expectedType")&&te.push(M.data.expectedType)}var we=te.length>0?", expected one of type ["+te.join(", ")+"]":"";return new y("Invalid "+ee+" `"+U+"` supplied to "+("`"+Z+"`"+we+"."))}return h(L)}function q(){function T(j,V,L,k,D){return B(j[V])?null:new y("Invalid "+k+" `"+D+"` supplied to "+("`"+L+"`, expected a ReactNode."))}return h(T)}function z(T,j,V,L,k){return new y((T||"React class")+": "+j+" type `"+V+"."+L+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+k+"`.")}function J(T){function j(V,L,k,D,Z){var ee=V[L],U=re(ee);if(U!=="object")return new y("Invalid "+D+" `"+Z+"` of type `"+U+"` "+("supplied to `"+k+"`, expected `object`."));for(var te in T){var G=T[te];if(typeof G!="function")return z(k,D,Z,te,X(G));var ue=G(ee,te,k,D,Z+"."+te,n);if(ue)return ue}return null}return h(j)}function ne(T){function j(V,L,k,D,Z){var ee=V[L],U=re(ee);if(U!=="object")return new y("Invalid "+D+" `"+Z+"` of type `"+U+"` "+("supplied to `"+k+"`, expected `object`."));var te=t({},V[L],T);for(var G in te){var ue=T[G];if(r(T,G)&&typeof ue!="function")return z(k,D,Z,G,X(ue));if(!ue)return new y("Invalid "+D+" `"+Z+"` key `"+G+"` supplied to `"+k+"`.\nBad object: "+JSON.stringify(V[L],null," ")+`
27
- Valid keys: `+JSON.stringify(Object.keys(T),null," "));var M=ue(ee,G,k,D,Z+"."+G,n);if(M)return M}return null}return h(j)}function B(T){switch(typeof T){case"number":case"string":case"undefined":return!0;case"boolean":return!T;case"object":if(Array.isArray(T))return T.every(B);if(T===null||a(T))return!0;var j=f(T);if(j){var V=j.call(T),L;if(j!==T.entries){for(;!(L=V.next()).done;)if(!B(L.value))return!1}else for(;!(L=V.next()).done;){var k=L.value;if(k&&!B(k[1]))return!1}}else return!1;return!0;default:return!1}}function ce(T,j){return T==="symbol"?!0:j?j["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&j instanceof Symbol:!1}function re(T){var j=typeof T;return Array.isArray(T)?"array":T instanceof RegExp?"object":ce(j,T)?"symbol":j}function X(T){if(typeof T>"u"||T===null)return""+T;var j=re(T);if(j==="object"){if(T instanceof Date)return"date";if(T instanceof RegExp)return"regexp"}return j}function fe(T){var j=X(T);switch(j){case"array":case"object":return"an "+j;case"boolean":case"date":case"regexp":return"a "+j;default:return j}}function ve(T){return!T.constructor||!T.constructor.name?m:T.constructor.name}return p.checkPropTypes=o,p.resetWarningCache=o.resetWarningCache,p.PropTypes=p,p},Do}var Fo,Qa;function Qg(){if(Qa)return Fo;Qa=1;var e=Ps();function t(){}function n(){}return n.resetWarningCache=t,Fo=function(){function r(s,a,c,u,d,f){if(f!==e){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}}r.isRequired=r;function 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},Fo}if(process.env.NODE_ENV!=="production"){var Xg=Bl(),Yg=!0;cs.exports=Gg()(Xg.isElement,Yg)}else cs.exports=Qg()();var Zg=cs.exports;const K=Es(Zg);var ls={exports:{}},xe={};/**
26
+ */var jo,ec;function ay(){if(ec)return jo;ec=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(d){return s[d]});if(c.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(d){u[d]=d}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return jo=o()?Object.assign:function(i,s){for(var a,c=r(i),u,d=1;d<arguments.length;d++){a=Object(arguments[d]);for(var f in a)t.call(a,f)&&(c[f]=a[f]);if(e){u=e(a);for(var p=0;p<u.length;p++)n.call(a,u[p])&&(c[u[p]]=a[u[p]])}}return c},jo}var Lo,tc;function $s(){if(tc)return Lo;tc=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Lo=e,Lo}var Vo,nc;function ou(){return nc||(nc=1,Vo=Function.call.bind(Object.prototype.hasOwnProperty)),Vo}var Ko,rc;function cy(){if(rc)return Ko;rc=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=$s(),n={},r=ou();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,u){if(process.env.NODE_ENV!=="production"){for(var d in i)if(r(i,d)){var f;try{if(typeof i[d]!="function"){var p=Error((c||"React class")+": "+a+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw p.name="Invariant Violation",p}f=i[d](s,d,c,a,null,t)}catch(g){f=g}if(f&&!(f instanceof Error)&&e((c||"React class")+": type specification of "+a+" `"+d+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof f+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),f instanceof Error&&!(f.message in n)){n[f.message]=!0;var m=u?u():"";e("Failed "+a+" type: "+f.message+(m??""))}}}}return o.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Ko=o,Ko}var $o,ic;function ly(){if(ic)return $o;ic=1;var e=iu(),t=ay(),n=$s(),r=ou(),o=cy(),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 $o=function(a,c){var u=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function f(R){var k=R&&(u&&R[u]||R[d]);if(typeof k=="function")return k}var p="<<anonymous>>",m={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:y(),arrayOf:b,element:C(),elementType:_(),instanceOf:S,node:q(),objectOf:N,oneOf:T,oneOfType:P,shape:z,exact:ne};function g(R,k){return R===k?R!==0||1/R===1/k:R!==R&&k!==k}function w(R,k){this.message=R,this.data=k&&typeof k=="object"?k:{},this.stack=""}w.prototype=Error.prototype;function h(R){if(process.env.NODE_ENV!=="production")var k={},$=0;function L(M,Y,Z,U,ee,Q,de){if(U=U||p,Q=Q||Z,de!==n){if(c){var F=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 F.name="Invariant Violation",F}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ve=U+":"+Z;!k[ve]&&$<3&&(i("You are manually calling a React.PropTypes validation function for the `"+Q+"` prop on `"+U+"`. 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."),k[ve]=!0,$++)}}return Y[Z]==null?M?Y[Z]===null?new w("The "+ee+" `"+Q+"` is marked as required "+("in `"+U+"`, but its value is `null`.")):new w("The "+ee+" `"+Q+"` is marked as required in "+("`"+U+"`, but its value is `undefined`.")):null:R(Y,Z,U,ee,Q)}var j=L.bind(null,!1);return j.isRequired=L.bind(null,!0),j}function x(R){function k($,L,j,M,Y,Z){var U=$[L],ee=oe(U);if(ee!==R){var Q=te(U);return new w("Invalid "+M+" `"+Y+"` of type "+("`"+Q+"` supplied to `"+j+"`, expected ")+("`"+R+"`."),{expectedType:R})}return null}return h(k)}function y(){return h(s)}function b(R){function k($,L,j,M,Y){if(typeof R!="function")return new w("Property `"+Y+"` of component `"+j+"` has invalid PropType notation inside arrayOf.");var Z=$[L];if(!Array.isArray(Z)){var U=oe(Z);return new w("Invalid "+M+" `"+Y+"` of type "+("`"+U+"` supplied to `"+j+"`, expected an array."))}for(var ee=0;ee<Z.length;ee++){var Q=R(Z,ee,j,M,Y+"["+ee+"]",n);if(Q instanceof Error)return Q}return null}return h(k)}function C(){function R(k,$,L,j,M){var Y=k[$];if(!a(Y)){var Z=oe(Y);return new w("Invalid "+j+" `"+M+"` of type "+("`"+Z+"` supplied to `"+L+"`, expected a single ReactElement."))}return null}return h(R)}function _(){function R(k,$,L,j,M){var Y=k[$];if(!e.isValidElementType(Y)){var Z=oe(Y);return new w("Invalid "+j+" `"+M+"` of type "+("`"+Z+"` supplied to `"+L+"`, expected a single ReactElement type."))}return null}return h(R)}function S(R){function k($,L,j,M,Y){if(!($[L]instanceof R)){var Z=R.name||p,U=we($[L]);return new w("Invalid "+M+" `"+Y+"` of type "+("`"+U+"` supplied to `"+j+"`, expected ")+("instance of `"+Z+"`."))}return null}return h(k)}function T(R){if(!Array.isArray(R))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 k($,L,j,M,Y){for(var Z=$[L],U=0;U<R.length;U++)if(g(Z,R[U]))return null;var ee=JSON.stringify(R,function(de,F){var ve=te(F);return ve==="symbol"?String(F):F});return new w("Invalid "+M+" `"+Y+"` of value `"+String(Z)+"` "+("supplied to `"+j+"`, expected one of "+ee+"."))}return h(k)}function N(R){function k($,L,j,M,Y){if(typeof R!="function")return new w("Property `"+Y+"` of component `"+j+"` has invalid PropType notation inside objectOf.");var Z=$[L],U=oe(Z);if(U!=="object")return new w("Invalid "+M+" `"+Y+"` of type "+("`"+U+"` supplied to `"+j+"`, expected an object."));for(var ee in Z)if(r(Z,ee)){var Q=R(Z,ee,j,M,Y+"."+ee,n);if(Q instanceof Error)return Q}return null}return h(k)}function P(R){if(!Array.isArray(R))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var k=0;k<R.length;k++){var $=R[k];if(typeof $!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+ge($)+" at index "+k+"."),s}function L(j,M,Y,Z,U){for(var ee=[],Q=0;Q<R.length;Q++){var de=R[Q],F=de(j,M,Y,Z,U,n);if(F==null)return null;F.data&&r(F.data,"expectedType")&&ee.push(F.data.expectedType)}var ve=ee.length>0?", expected one of type ["+ee.join(", ")+"]":"";return new w("Invalid "+Z+" `"+U+"` supplied to "+("`"+Y+"`"+ve+"."))}return h(L)}function q(){function R(k,$,L,j,M){return B(k[$])?null:new w("Invalid "+j+" `"+M+"` supplied to "+("`"+L+"`, expected a ReactNode."))}return h(R)}function G(R,k,$,L,j){return new w((R||"React class")+": "+k+" type `"+$+"."+L+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+j+"`.")}function z(R){function k($,L,j,M,Y){var Z=$[L],U=oe(Z);if(U!=="object")return new w("Invalid "+M+" `"+Y+"` of type `"+U+"` "+("supplied to `"+j+"`, expected `object`."));for(var ee in R){var Q=R[ee];if(typeof Q!="function")return G(j,M,Y,ee,te(Q));var de=Q(Z,ee,j,M,Y+"."+ee,n);if(de)return de}return null}return h(k)}function ne(R){function k($,L,j,M,Y){var Z=$[L],U=oe(Z);if(U!=="object")return new w("Invalid "+M+" `"+Y+"` of type `"+U+"` "+("supplied to `"+j+"`, expected `object`."));var ee=t({},$[L],R);for(var Q in ee){var de=R[Q];if(r(R,Q)&&typeof de!="function")return G(j,M,Y,Q,te(de));if(!de)return new w("Invalid "+M+" `"+Y+"` key `"+Q+"` supplied to `"+j+"`.\nBad object: "+JSON.stringify($[L],null," ")+`
27
+ Valid keys: `+JSON.stringify(Object.keys(R),null," "));var F=de(Z,Q,j,M,Y+"."+Q,n);if(F)return F}return null}return h(k)}function B(R){switch(typeof R){case"number":case"string":case"undefined":return!0;case"boolean":return!R;case"object":if(Array.isArray(R))return R.every(B);if(R===null||a(R))return!0;var k=f(R);if(k){var $=k.call(R),L;if(k!==R.entries){for(;!(L=$.next()).done;)if(!B(L.value))return!1}else for(;!(L=$.next()).done;){var j=L.value;if(j&&!B(j[1]))return!1}}else return!1;return!0;default:return!1}}function ce(R,k){return R==="symbol"?!0:k?k["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&k instanceof Symbol:!1}function oe(R){var k=typeof R;return Array.isArray(R)?"array":R instanceof RegExp?"object":ce(k,R)?"symbol":k}function te(R){if(typeof R>"u"||R===null)return""+R;var k=oe(R);if(k==="object"){if(R instanceof Date)return"date";if(R instanceof RegExp)return"regexp"}return k}function ge(R){var k=te(R);switch(k){case"array":case"object":return"an "+k;case"boolean":case"date":case"regexp":return"a "+k;default:return k}}function we(R){return!R.constructor||!R.constructor.name?p:R.constructor.name}return m.checkPropTypes=o,m.resetWarningCache=o.resetWarningCache,m.PropTypes=m,m},$o}var qo,oc;function uy(){if(oc)return qo;oc=1;var e=$s();function t(){}function n(){}return n.resetWarningCache=t,qo=function(){function r(s,a,c,u,d,f){if(f!==e){var p=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 p.name="Invariant Violation",p}}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},qo}if(process.env.NODE_ENV!=="production"){var dy=iu(),fy=!0;ys.exports=ly()(dy.isElement,fy)}else ys.exports=uy()();var py=ys.exports;const V=Fs(py);var vs={exports:{}},xe={};/**
28
28
  * @license React
29
29
  * react-is.production.min.js
30
30
  *
@@ -32,7 +32,7 @@ Valid keys: `+JSON.stringify(Object.keys(T),null," "));var M=ue(ee,G,k,D,Z+"."+
32
32
  *
33
33
  * This source code is licensed under the MIT license found in the
34
34
  * LICENSE file in the root directory of this source tree.
35
- */var Xa;function ey(){if(Xa)return xe;Xa=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"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),g;g=Symbol.for("react.module.reference");function y(h){if(typeof h=="object"&&h!==null){var _=h.$$typeof;switch(_){case e:switch(h=h.type,h){case n:case o:case r:case u:case d:return h;default:switch(h=h&&h.$$typeof,h){case a:case s:case c:case m:case f:case i:return h;default:return _}}case t:return _}}}return xe.ContextConsumer=s,xe.ContextProvider=i,xe.Element=e,xe.ForwardRef=c,xe.Fragment=n,xe.Lazy=m,xe.Memo=f,xe.Portal=t,xe.Profiler=o,xe.StrictMode=r,xe.Suspense=u,xe.SuspenseList=d,xe.isAsyncMode=function(){return!1},xe.isConcurrentMode=function(){return!1},xe.isContextConsumer=function(h){return y(h)===s},xe.isContextProvider=function(h){return y(h)===i},xe.isElement=function(h){return typeof h=="object"&&h!==null&&h.$$typeof===e},xe.isForwardRef=function(h){return y(h)===c},xe.isFragment=function(h){return y(h)===n},xe.isLazy=function(h){return y(h)===m},xe.isMemo=function(h){return y(h)===f},xe.isPortal=function(h){return y(h)===t},xe.isProfiler=function(h){return y(h)===o},xe.isStrictMode=function(h){return y(h)===r},xe.isSuspense=function(h){return y(h)===u},xe.isSuspenseList=function(h){return y(h)===d},xe.isValidElementType=function(h){return typeof h=="string"||typeof h=="function"||h===n||h===o||h===r||h===u||h===d||h===p||typeof h=="object"&&h!==null&&(h.$$typeof===m||h.$$typeof===f||h.$$typeof===i||h.$$typeof===s||h.$$typeof===c||h.$$typeof===g||h.getModuleId!==void 0)},xe.typeOf=y,xe}var Ce={};/**
35
+ */var sc;function hy(){if(sc)return xe;sc=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"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),g;g=Symbol.for("react.module.reference");function w(h){if(typeof h=="object"&&h!==null){var x=h.$$typeof;switch(x){case e:switch(h=h.type,h){case n:case o:case r:case u:case d:return h;default:switch(h=h&&h.$$typeof,h){case a:case s:case c:case p:case f:case i:return h;default:return x}}case t:return x}}}return xe.ContextConsumer=s,xe.ContextProvider=i,xe.Element=e,xe.ForwardRef=c,xe.Fragment=n,xe.Lazy=p,xe.Memo=f,xe.Portal=t,xe.Profiler=o,xe.StrictMode=r,xe.Suspense=u,xe.SuspenseList=d,xe.isAsyncMode=function(){return!1},xe.isConcurrentMode=function(){return!1},xe.isContextConsumer=function(h){return w(h)===s},xe.isContextProvider=function(h){return w(h)===i},xe.isElement=function(h){return typeof h=="object"&&h!==null&&h.$$typeof===e},xe.isForwardRef=function(h){return w(h)===c},xe.isFragment=function(h){return w(h)===n},xe.isLazy=function(h){return w(h)===p},xe.isMemo=function(h){return w(h)===f},xe.isPortal=function(h){return w(h)===t},xe.isProfiler=function(h){return w(h)===o},xe.isStrictMode=function(h){return w(h)===r},xe.isSuspense=function(h){return w(h)===u},xe.isSuspenseList=function(h){return w(h)===d},xe.isValidElementType=function(h){return typeof h=="string"||typeof h=="function"||h===n||h===o||h===r||h===u||h===d||h===m||typeof h=="object"&&h!==null&&(h.$$typeof===p||h.$$typeof===f||h.$$typeof===i||h.$$typeof===s||h.$$typeof===c||h.$$typeof===g||h.getModuleId!==void 0)},xe.typeOf=w,xe}var Ce={};/**
36
36
  * @license React
37
37
  * react-is.development.js
38
38
  *
@@ -40,10 +40,10 @@ Valid keys: `+JSON.stringify(Object.keys(T),null," "));var M=ue(ee,G,k,D,Z+"."+
40
40
  *
41
41
  * This source code is licensed under the MIT license found in the
42
42
  * LICENSE file in the root directory of this source tree.
43
- */var Ya;function ty(){return Ya||(Ya=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"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),g=!1,y=!1,h=!1,_=!1,v=!1,x;x=Symbol.for("react.module.reference");function C(H){return!!(typeof H=="string"||typeof H=="function"||H===n||H===o||v||H===r||H===u||H===d||_||H===p||g||y||h||typeof H=="object"&&H!==null&&(H.$$typeof===m||H.$$typeof===f||H.$$typeof===i||H.$$typeof===s||H.$$typeof===c||H.$$typeof===x||H.getModuleId!==void 0))}function b(H){if(typeof H=="object"&&H!==null){var Ee=H.$$typeof;switch(Ee){case e:var Le=H.type;switch(Le){case n:case o:case r:case u:case d:return Le;default:var ze=Le&&Le.$$typeof;switch(ze){case a:case s:case c:case m:case f:case i:return ze;default:return Ee}}case t:return Ee}}}var N=s,R=i,S=e,F=c,q=n,z=m,J=f,ne=t,B=o,ce=r,re=u,X=d,fe=!1,ve=!1;function T(H){return fe||(fe=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function j(H){return ve||(ve=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function V(H){return b(H)===s}function L(H){return b(H)===i}function k(H){return typeof H=="object"&&H!==null&&H.$$typeof===e}function D(H){return b(H)===c}function Z(H){return b(H)===n}function ee(H){return b(H)===m}function U(H){return b(H)===f}function te(H){return b(H)===t}function G(H){return b(H)===o}function ue(H){return b(H)===r}function M(H){return b(H)===u}function we(H){return b(H)===d}Ce.ContextConsumer=N,Ce.ContextProvider=R,Ce.Element=S,Ce.ForwardRef=F,Ce.Fragment=q,Ce.Lazy=z,Ce.Memo=J,Ce.Portal=ne,Ce.Profiler=B,Ce.StrictMode=ce,Ce.Suspense=re,Ce.SuspenseList=X,Ce.isAsyncMode=T,Ce.isConcurrentMode=j,Ce.isContextConsumer=V,Ce.isContextProvider=L,Ce.isElement=k,Ce.isForwardRef=D,Ce.isFragment=Z,Ce.isLazy=ee,Ce.isMemo=U,Ce.isPortal=te,Ce.isProfiler=G,Ce.isStrictMode=ue,Ce.isSuspense=M,Ce.isSuspenseList=we,Ce.isValidElementType=C,Ce.typeOf=b}()),Ce}process.env.NODE_ENV==="production"?ls.exports=ey():ls.exports=ty();var Za=ls.exports;const ec=e=>typeof e=="object"&&e!=null&&e.nodeType===1,tc=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Mo=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return tc(n.overflowY,t)||tc(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},Ri=(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,ny=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},ry=(e,t)=>{var n,r,o,i;if(typeof document>"u")return[];const{scrollMode:s,block:a,inline:c,boundary:u,skipOverflowHiddenElements:d}=t,f=typeof u=="function"?u:re=>re!==u;if(!ec(e))throw new TypeError("Invalid target");const m=document.scrollingElement||document.documentElement,p=[];let g=e;for(;ec(g)&&f(g);){if(g=ny(g),g===m){p.push(g);break}g!=null&&g===document.body&&Mo(g)&&!Mo(document.documentElement)||g!=null&&Mo(g,d)&&p.push(g)}const y=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,h=(i=(o=window.visualViewport)==null?void 0:o.height)!=null?i:innerHeight,{scrollX:_,scrollY:v}=window,{height:x,width:C,top:b,right:N,bottom:R,left:S}=e.getBoundingClientRect(),{top:F,right:q,bottom:z,left:J}=(re=>{const X=window.getComputedStyle(re);return{top:parseFloat(X.scrollMarginTop)||0,right:parseFloat(X.scrollMarginRight)||0,bottom:parseFloat(X.scrollMarginBottom)||0,left:parseFloat(X.scrollMarginLeft)||0}})(e);let ne=a==="start"||a==="nearest"?b-F:a==="end"?R+z:b+x/2-F+z,B=c==="center"?S+C/2-J+q:c==="end"?N+q:S-J;const ce=[];for(let re=0;re<p.length;re++){const X=p[re],{height:fe,width:ve,top:T,right:j,bottom:V,left:L}=X.getBoundingClientRect();if(s==="if-needed"&&b>=0&&S>=0&&R<=h&&N<=y&&b>=T&&R<=V&&S>=L&&N<=j)return ce;const k=getComputedStyle(X),D=parseInt(k.borderLeftWidth,10),Z=parseInt(k.borderTopWidth,10),ee=parseInt(k.borderRightWidth,10),U=parseInt(k.borderBottomWidth,10);let te=0,G=0;const ue="offsetWidth"in X?X.offsetWidth-X.clientWidth-D-ee:0,M="offsetHeight"in X?X.offsetHeight-X.clientHeight-Z-U:0,we="offsetWidth"in X?X.offsetWidth===0?0:ve/X.offsetWidth:0,H="offsetHeight"in X?X.offsetHeight===0?0:fe/X.offsetHeight:0;if(m===X)te=a==="start"?ne:a==="end"?ne-h:a==="nearest"?Ri(v,v+h,h,Z,U,v+ne,v+ne+x,x):ne-h/2,G=c==="start"?B:c==="center"?B-y/2:c==="end"?B-y:Ri(_,_+y,y,D,ee,_+B,_+B+C,C),te=Math.max(0,te+v),G=Math.max(0,G+_);else{te=a==="start"?ne-T-Z:a==="end"?ne-V+U+M:a==="nearest"?Ri(T,V,fe,Z,U+M,ne,ne+x,x):ne-(T+fe/2)+M/2,G=c==="start"?B-L-D:c==="center"?B-(L+ve/2)+ue/2:c==="end"?B-j+ee+ue:Ri(L,j,ve,D,ee+ue,B,B+C,C);const{scrollLeft:Ee,scrollTop:Le}=X;te=H===0?0:Math.max(0,Math.min(Le+te/H,X.scrollHeight-fe/H+M)),G=we===0?0:Math.max(0,Math.min(Ee+G/we,X.scrollWidth-ve/we+ue)),ne+=Le-te,B+=Ee-G}ce.push({el:X,top:te,left:G})}return ce};var Or=function(){return Or=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},Or.apply(this,arguments)};var iy=0;function nc(e){return typeof e=="function"?e:vt}function vt(){}function Jl(e,t){if(e){var n=ry(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 rc(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function Ds(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 He(){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 ar(){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 zl(){return String(iy++)}function oy(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 ic(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function Gl(e){return typeof e.type=="string"}function Ql(e){return e.props}function sy(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var ay=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function Ai(e){e===void 0&&(e={});var t={};return ay.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function Wi(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,r){return n[r]=Ji(t,r)?t[r]:e[r],n},{})}function Ji(e,t){return e[t]!==void 0}function us(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function cy(e){return Object.prototype.toString.call(e)==="[object Object]"}function Un(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=Er(a,t<0,n,r,o);return c===-1?e>=i?-1:e:c}function Er(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?Er(t?i-1:0,t,n,r):-1}function zi(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(o){return o&&(rc(o,e,n)||r&&rc(o,n.document.activeElement,n))})}var Fs=vt;process.env.NODE_ENV!=="production"&&(Fs=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 ly=Ds(function(e){Xl(e).textContent=""},500);function Xl(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 Yl(e,t){if(!(!e||!t)){var n=Xl(t);n.textContent=e,ly(t)}}function uy(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var Zl=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,eu=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,tu=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,ji=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,ki=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,nu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,ru=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,iu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,ou=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,su=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,au=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,cu=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,lu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,ds=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,uu=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,du=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,fu=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,dy=Object.freeze({__proto__:null,blurButton:uu,blurInput:au,changeInput:cu,clickButton:ds,clickItem:su,controlledPropUpdatedSelectedItem:du,itemMouseEnter:tu,keyDownArrowDown:ki,keyDownArrowUp:ji,keyDownEnd:ou,keyDownEnter:ru,keyDownEscape:nu,keyDownHome:iu,keyDownSpaceButton:lu,mouseUp:eu,touchEnd:fu,unknown:Zl}),fy=["refKey","ref"],py=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],hy=["onKeyDown","onBlur","onChange","onInput","onChangeText"],my=["refKey","ref"],gy=["onMouseMove","onMouseDown","onClick","onPress","index","item"],yy=function(){var e=function(t){function n(o){var i;i=t.call(this,o)||this,i.id=i.props.id||"downshift-"+zl(),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(v){return i.id+"-item-"+v},i.items=[],i.itemCount=null,i.previousResultCount=0,i.timeoutIds=[],i.internalSetTimeout=function(v,x){var C=setTimeout(function(){i.timeoutIds=i.timeoutIds.filter(function(b){return b!==C}),v()},x);i.timeoutIds.push(C)},i.setItemCount=function(v){i.itemCount=v},i.unsetItemCount=function(){i.itemCount=null},i.isItemDisabled=function(v,x){var C=i.getItemNodeFromIndex(x);return C&&C.hasAttribute("disabled")},i.setHighlightedIndex=function(v,x){v===void 0&&(v=i.props.defaultHighlightedIndex),x===void 0&&(x={}),x=Ai(x),i.internalSetState(pe({highlightedIndex:v},x))},i.clearSelection=function(v){i.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:i.props.defaultHighlightedIndex,isOpen:i.props.defaultIsOpen},v)},i.selectItem=function(v,x,C){x=Ai(x),i.internalSetState(pe({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,selectedItem:v,inputValue:i.props.itemToString(v)},x),C)},i.selectItemAtIndex=function(v,x,C){var b=i.items[v];b!=null&&i.selectItem(b,x,C)},i.selectHighlightedItem=function(v,x){return i.selectItemAtIndex(i.getState().highlightedIndex,v,x)},i.internalSetState=function(v,x){var C,b,N={},R=typeof v=="function";return!R&&v.hasOwnProperty("inputValue")&&i.props.onInputValueChange(v.inputValue,pe({},i.getStateAndHelpers(),v)),i.setState(function(S){var F;S=i.getState(S);var q=R?v(S):v;q=i.props.stateReducer(S,q),C=q.hasOwnProperty("selectedItem");var z={};return C&&q.selectedItem!==S.selectedItem&&(b=q.selectedItem),(F=q).type||(F.type=Zl),Object.keys(q).forEach(function(J){S[J]!==q[J]&&(N[J]=q[J]),J!=="type"&&(q[J],Ji(i.props,J)||(z[J]=q[J]))}),R&&q.hasOwnProperty("inputValue")&&i.props.onInputValueChange(q.inputValue,pe({},i.getStateAndHelpers(),q)),z},function(){nc(x)();var S=Object.keys(N).length>1;S&&i.props.onStateChange(N,i.getStateAndHelpers()),C&&i.props.onSelect(v.selectedItem,i.getStateAndHelpers()),b!==void 0&&i.props.onChange(b,i.getStateAndHelpers()),i.props.onUserAction(N,i.getStateAndHelpers())})},i.rootRef=function(v){return i._rootNode=v},i.getRootProps=function(v,x){var C,b=v===void 0?{}:v,N=b.refKey,R=N===void 0?"ref":N,S=b.ref,F=ln(b,fy),q=x===void 0?{}:x,z=q.suppressRefError,J=z===void 0?!1:z;i.getRootProps.called=!0,i.getRootProps.refKey=R,i.getRootProps.suppressRefError=J;var ne=i.getState(),B=ne.isOpen;return pe((C={},C[R]=ar(S,i.rootRef),C.role="combobox",C["aria-expanded"]=B,C["aria-haspopup"]="listbox",C["aria-owns"]=B?i.menuId:void 0,C["aria-labelledby"]=i.labelId,C),F)},i.keyDownHandlers={ArrowDown:function(x){var C=this;if(x.preventDefault(),this.getState().isOpen){var b=x.shiftKey?5:1;this.moveHighlightedIndex(b,{type:ki})}else this.internalSetState({isOpen:!0,type:ki},function(){var N=C.getItemCount();if(N>0){var R=C.getState(),S=R.highlightedIndex,F=Un(S,1,{length:N},C.isItemDisabled,!0);C.setHighlightedIndex(F,{type:ki})}})},ArrowUp:function(x){var C=this;if(x.preventDefault(),this.getState().isOpen){var b=x.shiftKey?-5:-1;this.moveHighlightedIndex(b,{type:ji})}else this.internalSetState({isOpen:!0,type:ji},function(){var N=C.getItemCount();if(N>0){var R=C.getState(),S=R.highlightedIndex,F=Un(S,-1,{length:N},C.isItemDisabled,!0);C.setHighlightedIndex(F,{type:ji})}})},Enter:function(x){if(x.which!==229){var C=this.getState(),b=C.isOpen,N=C.highlightedIndex;if(b&&N!=null){x.preventDefault();var R=this.items[N],S=this.getItemNodeFromIndex(N);if(R==null||S&&S.hasAttribute("disabled"))return;this.selectHighlightedItem({type:ru})}}},Escape:function(x){x.preventDefault(),this.reset(pe({type:nu},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},i.buttonKeyDownHandlers=pe({},i.keyDownHandlers,{" ":function(x){x.preventDefault(),this.toggleMenu({type:lu})}}),i.inputKeyDownHandlers=pe({},i.keyDownHandlers,{Home:function(x){var C=this.getState(),b=C.isOpen;if(b){x.preventDefault();var N=this.getItemCount();if(!(N<=0||!b)){var R=Er(0,!1,{length:N},this.isItemDisabled);this.setHighlightedIndex(R,{type:iu})}}},End:function(x){var C=this.getState(),b=C.isOpen;if(b){x.preventDefault();var N=this.getItemCount();if(!(N<=0||!b)){var R=Er(N-1,!0,{length:N},this.isItemDisabled);this.setHighlightedIndex(R,{type:ou})}}}}),i.getToggleButtonProps=function(v){var x=v===void 0?{}:v,C=x.onClick;x.onPress;var b=x.onKeyDown,N=x.onKeyUp,R=x.onBlur,S=ln(x,py),F=i.getState(),q=F.isOpen,z={onClick:He(C,i.buttonHandleClick),onKeyDown:He(b,i.buttonHandleKeyDown),onKeyUp:He(N,i.buttonHandleKeyUp),onBlur:He(R,i.buttonHandleBlur)},J=S.disabled?{}:z;return pe({type:"button",role:"button","aria-label":q?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},J,S)},i.buttonHandleKeyUp=function(v){v.preventDefault()},i.buttonHandleKeyDown=function(v){var x=us(v);i.buttonKeyDownHandlers[x]&&i.buttonKeyDownHandlers[x].call(i,v)},i.buttonHandleClick=function(v){if(v.preventDefault(),i.props.environment){var x=i.props.environment.document,C=x.body,b=x.activeElement;C&&C===b&&v.target.focus()}process.env.NODE_ENV==="test"?i.toggleMenu({type:ds}):i.internalSetTimeout(function(){return i.toggleMenu({type:ds})})},i.buttonHandleBlur=function(v){var x=v.target;i.internalSetTimeout(function(){if(!(i.isMouseDown||!i.props.environment)){var C=i.props.environment.document.activeElement;(C==null||C.id!==i.inputId)&&C!==x&&i.reset({type:uu})}})},i.getLabelProps=function(v){return pe({htmlFor:i.inputId,id:i.labelId},v)},i.getInputProps=function(v){var x=v===void 0?{}:v,C=x.onKeyDown,b=x.onBlur,N=x.onChange,R=x.onInput;x.onChangeText;var S=ln(x,hy),F,q={};F="onChange";var z=i.getState(),J=z.inputValue,ne=z.isOpen,B=z.highlightedIndex;if(!S.disabled){var ce;q=(ce={},ce[F]=He(N,R,i.inputHandleChange),ce.onKeyDown=He(C,i.inputHandleKeyDown),ce.onBlur=He(b,i.inputHandleBlur),ce)}return pe({"aria-autocomplete":"list","aria-activedescendant":ne&&typeof B=="number"&&B>=0?i.getItemId(B):void 0,"aria-controls":ne?i.menuId:void 0,"aria-labelledby":S&&S["aria-label"]?void 0:i.labelId,autoComplete:"off",value:J,id:i.inputId},q,S)},i.inputHandleKeyDown=function(v){var x=us(v);x&&i.inputKeyDownHandlers[x]&&i.inputKeyDownHandlers[x].call(i,v)},i.inputHandleChange=function(v){i.internalSetState({type:cu,isOpen:!0,inputValue:v.target.value,highlightedIndex:i.props.defaultHighlightedIndex})},i.inputHandleBlur=function(){i.internalSetTimeout(function(){var v;if(!(i.isMouseDown||!i.props.environment)){var x=i.props.environment.document.activeElement,C=(x==null||(v=x.dataset)==null?void 0:v.toggle)&&i._rootNode&&i._rootNode.contains(x);C||i.reset({type:au})}})},i.menuRef=function(v){i._menuNode=v},i.getMenuProps=function(v,x){var C,b=v===void 0?{}:v,N=b.refKey,R=N===void 0?"ref":N,S=b.ref,F=ln(b,my),q=x===void 0?{}:x,z=q.suppressRefError,J=z===void 0?!1:z;return i.getMenuProps.called=!0,i.getMenuProps.refKey=R,i.getMenuProps.suppressRefError=J,pe((C={},C[R]=ar(S,i.menuRef),C.role="listbox",C["aria-labelledby"]=F&&F["aria-label"]?void 0:i.labelId,C.id=i.menuId,C),F)},i.getItemProps=function(v){var x,C=v===void 0?{}:v,b=C.onMouseMove,N=C.onMouseDown,R=C.onClick;C.onPress;var S=C.index,F=C.item,q=F===void 0?process.env.NODE_ENV==="production"?void 0:sy("getItemProps","item"):F,z=ln(C,gy);S===void 0?(i.items.push(q),S=i.items.indexOf(q)):i.items[S]=q;var J="onClick",ne=R,B=(x={onMouseMove:He(b,function(){S!==i.getState().highlightedIndex&&(i.setHighlightedIndex(S,{type:tu}),i.avoidScrolling=!0,i.internalSetTimeout(function(){return i.avoidScrolling=!1},250))}),onMouseDown:He(N,function(re){re.preventDefault()})},x[J]=He(ne,function(){i.selectItemAtIndex(S,{type:su})}),x),ce=z.disabled?{onMouseDown:B.onMouseDown}:B;return pe({id:i.getItemId(S),role:"option","aria-selected":i.getState().highlightedIndex===S},ce,z)},i.clearItems=function(){i.items=[]},i.reset=function(v,x){v===void 0&&(v={}),v=Ai(v),i.internalSetState(function(C){var b=C.selectedItem;return pe({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,inputValue:i.props.itemToString(b)},v)},x)},i.toggleMenu=function(v,x){v===void 0&&(v={}),v=Ai(v),i.internalSetState(function(C){var b=C.isOpen;return pe({isOpen:!b},b&&{highlightedIndex:i.props.defaultHighlightedIndex},v)},function(){var C=i.getState(),b=C.isOpen,N=C.highlightedIndex;b&&i.getItemCount()>0&&typeof N=="number"&&i.setHighlightedIndex(N,v),nc(x)()})},i.openMenu=function(v){i.internalSetState({isOpen:!0},v)},i.closeMenu=function(v){i.internalSetState({isOpen:!1},v)},i.updateStatus=Ds(function(){var v;if((v=i.props)!=null&&(v=v.environment)!=null&&v.document){var x=i.getState(),C=i.items[x.highlightedIndex],b=i.getItemCount(),N=i.props.getA11yStatusMessage(pe({itemToString:i.props.itemToString,previousResultCount:i.previousResultCount,resultCount:b,highlightedItem:C},x));i.previousResultCount=b,Yl(N,i.props.environment.document)}},200);var s=i.props,a=s.defaultHighlightedIndex,c=s.initialHighlightedIndex,u=c===void 0?a:c,d=s.defaultIsOpen,f=s.initialIsOpen,m=f===void 0?d:f,p=s.initialInputValue,g=p===void 0?"":p,y=s.initialSelectedItem,h=y===void 0?null:y,_=i.getState({highlightedIndex:u,isOpen:m,inputValue:g,selectedItem:h});return _.selectedItem!=null&&i.props.initialInputValue===void 0&&(_.inputValue=i.props.itemToString(_.selectedItem)),i.state=_,i}Hg(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),Wi(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(),u=c.highlightedIndex;if(a>0){var d=Un(u,i,{length:a},this.isItemDisabled,!0);this.setHighlightedIndex(d,s)}},r.getStateAndHelpers=function(){var i=this.getState(),s=i.highlightedIndex,a=i.inputValue,c=i.selectedItem,u=i.isOpen,d=this.props.itemToString,f=this.id,m=this.getRootProps,p=this.getToggleButtonProps,g=this.getLabelProps,y=this.getMenuProps,h=this.getInputProps,_=this.getItemProps,v=this.openMenu,x=this.closeMenu,C=this.toggleMenu,b=this.selectItem,N=this.selectItemAtIndex,R=this.selectHighlightedItem,S=this.setHighlightedIndex,F=this.clearSelection,q=this.clearItems,z=this.reset,J=this.setItemCount,ne=this.unsetItemCount,B=this.internalSetState;return{getRootProps:m,getToggleButtonProps:p,getLabelProps:g,getMenuProps:y,getInputProps:h,getItemProps:_,reset:z,openMenu:v,closeMenu:x,toggleMenu:C,selectItem:b,selectItemAtIndex:N,selectHighlightedItem:R,setHighlightedIndex:S,clearSelection:F,clearItems:q,setItemCount:J,unsetItemCount:ne,setState:B,itemToString:d,id:f,highlightedIndex:s,inputValue:a,isOpen:u,selectedItem:c}},r.componentDidMount=function(){var i=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&oc(this._menuNode,this.getMenuProps),!this.props.environment)this.cleanup=function(){i.internalClearTimeouts()};else{var s=function(){i.isMouseDown=!0},a=function(p){i.isMouseDown=!1;var g=zi(p.target,[i._rootNode,i._menuNode],i.props.environment);!g&&i.getState().isOpen&&i.reset({type:eu},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},c=function(){i.isTouchMove=!1},u=function(){i.isTouchMove=!0},d=function(p){var g=zi(p.target,[i._rootNode,i._menuNode],i.props.environment,!1);!i.isTouchMove&&!g&&i.getState().isOpen&&i.reset({type:fu},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",u),f.addEventListener("touchend",d),this.cleanup=function(){i.internalClearTimeouts(),i.updateStatus.cancel(),f.removeEventListener("mousedown",s),f.removeEventListener("mouseup",a),f.removeEventListener("touchstart",c),f.removeEventListener("touchmove",u),f.removeEventListener("touchend",d)}}},r.shouldScroll=function(i,s){var a=this.props.highlightedIndex===void 0?this.getState():this.props,c=a.highlightedIndex,u=s.highlightedIndex===void 0?i:s,d=u.highlightedIndex,f=c&&this.getState().isOpen&&!i.isOpen,m=c!==d;return f||m},r.componentDidUpdate=function(i,s){process.env.NODE_ENV!=="production"&&(Fs(this.state,i,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&oc(this._menuNode,this.getMenuProps)),Ji(this.props,"selectedItem")&&this.props.selectedItemChanged(i.selectedItem,this.props.selectedItem)&&this.internalSetState({type:du,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=ic(this.props.children,vt);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=ic(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&&vy(s,this.getRootProps),s;if(Gl(s))return w.cloneElement(s,this.getRootProps(Ql(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}(w.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:oy,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&cy(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:vt,onInputValueChange:vt,onUserAction:vt,onChange:vt,onSelect:vt,onOuterClick:vt,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:Jl},e.stateChangeTypes=dy,e}();process.env.NODE_ENV!=="production"&&(yy.propTypes={children:K.func,defaultHighlightedIndex:K.number,defaultIsOpen:K.bool,initialHighlightedIndex:K.number,initialSelectedItem:K.any,initialInputValue:K.string,initialIsOpen:K.bool,getA11yStatusMessage:K.func,itemToString:K.func,onChange:K.func,onSelect:K.func,onStateChange:K.func,onInputValueChange:K.func,onUserAction:K.func,onOuterClick:K.func,selectedItemChanged:K.func,stateReducer:K.func,itemCount:K.number,id:K.string,environment:K.shape({addEventListener:K.func.isRequired,removeEventListener:K.func.isRequired,document:K.shape({createElement:K.func.isRequired,getElementById:K.func.isRequired,activeElement:K.any.isRequired,body:K.any.isRequired}).isRequired,Node:K.func.isRequired}),suppressRefError:K.bool,scrollIntoView:K.func,selectedItem:K.any,isOpen:K.bool,inputValue:K.string,highlightedIndex:K.number,labelId:K.string,inputId:K.string,menuId:K.string,getItemId:K.func});function oc(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 vy(e,t){var n=t.refKey,r=n!=="ref",o=!Gl(e);o&&!r&&!Za.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+'"'),!Za.isForwardRef(e)&&!Ql(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var pu={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function wy(e,t,n){var r=e.props,o=e.type,i={};Object.keys(t).forEach(function(s){Iy(s,e,t,n),n[s]!==t[s]&&(i[s]=n[s])}),r.onStateChange&&Object.keys(i).length&&r.onStateChange(pe({type:o},i))}function Iy(e,t,n,r){var o=t.props,i=t.type,s="on"+Ms(e)+"Change";o[s]&&r[e]!==void 0&&r[e]!==n[e]&&o[s](pe({type:i},r))}function by(e,t){return t.changes}var sc=Ds(function(e,t){Yl(e,t)},200),_y=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?w.useLayoutEffect:w.useEffect,xy="useId"in w?function(t){var n=t.id,r=t.labelId,o=t.menuId,i=t.getItemId,s=t.toggleButtonId,a=t.inputId,c="downshift-"+w.useId();n||(n=c);var u=w.useRef({labelId:r||n+"-label",menuId:o||n+"-menu",getItemId:i||function(d){return n+"-item-"+d},toggleButtonId:s||n+"-toggle-button",inputId:a||n+"-input"});return u.current}:function(t){var n=t.id,r=n===void 0?"downshift-"+zl():n,o=t.labelId,i=t.menuId,s=t.getItemId,a=t.toggleButtonId,c=t.inputId,u=w.useRef({labelId:o||r+"-label",menuId:i||r+"-menu",getItemId:s||function(d){return r+"-item-"+d},toggleButtonId:a||r+"-toggle-button",inputId:c||r+"-input"});return u.current};function Cy(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 Ms(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function hu(e){var t=w.useRef(e);return t.current=e,t}function Oy(e,t,n,r){var o=w.useRef(),i=w.useRef(),s=w.useCallback(function(p,g){i.current=g,p=Wi(p,g.props);var y=e(p,g),h=g.props.stateReducer(p,pe({},g,{changes:y}));return h},[e]),a=w.useReducer(s,t,n),c=a[0],u=a[1],d=hu(t),f=w.useCallback(function(p){return u(pe({props:d.current},p))},[d]),m=i.current;return w.useEffect(function(){var p=Wi(o.current,m==null?void 0:m.props),g=m&&o.current&&!r(p,c);g&&wy(m,p,c),o.current=c},[c,m,r]),[c,f]}var Ur={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:by,scrollIntoView:Jl,environment:typeof window>"u"?void 0:window};function Sn(e,t,n){n===void 0&&(n=pu);var r=e["default"+Ms(t)];return r!==void 0?r:n[t]}function Hr(e,t,n){n===void 0&&(n=pu);var r=e[t];if(r!==void 0)return r;var o=e["initial"+Ms(t)];return o!==void 0?o:Sn(e,t,n)}function Ey(e){var t=Hr(e,"selectedItem"),n=Hr(e,"isOpen"),r=Ay(e),o=Hr(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 Br(e,t,n){var r=e.items,o=e.initialHighlightedIndex,i=e.defaultHighlightedIndex,s=e.isItemDisabled,a=e.itemToKey,c=t.selectedItem,u=t.highlightedIndex;return r.length===0?-1:o!==void 0&&u===o&&!s(r[o],o)?o:i!==void 0&&!s(r[i],i)?i:c?r.findIndex(function(d){return a(c)===a(d)}):n<0&&!s(r[r.length-1],r.length-1)?r.length-1:n>0&&!s(r[0],0)?0:-1}function Sy(e,t,n){var r=w.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return w.useEffect(function(){if(!e)return vt;var o=n.map(function(d){return d.current});function i(){r.current.isTouchEnd=!1,r.current.isMouseDown=!0}function s(d){r.current.isMouseDown=!1,zi(d.target,o,e)||t()}function a(){r.current.isTouchEnd=!1,r.current.isTouchMove=!1}function c(){r.current.isTouchMove=!0}function u(d){r.current.isTouchEnd=!0,!r.current.isTouchMove&&!zi(d.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",u),function(){e.removeEventListener("mousedown",i),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",c),e.removeEventListener("touchend",u)}},[n,e,t]),r.current}var mu=function(){return vt};process.env.NODE_ENV!=="production"&&(mu=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=w.useRef(n.reduce(function(s,a){return s[a]={},s},{}));w.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,u=a.refKey,d=a.elementRef;c||d!=null&&d.current||console.error('downshift: The ref prop "'+u+'" from '+s+" was not applied correctly on your element.")})},[]);var i=w.useCallback(function(s,a,c,u){o.current[s]={suppressRefError:a,refKey:c,elementRef:u}},[]);return i});function Ny(e,t,n,r){r===void 0&&(r={});var o=r.document,i=lo();w.useEffect(function(){if(!(!e||i||!o)){var s=e(t);sc(s,o)}},n),w.useEffect(function(){return function(){sc.cancel(),uy(o)}},[o])}function Ty(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,o=e.getItemNodeFromIndex,i=e.menuElement,s=e.scrollIntoView,a=w.useRef(!0);return _y(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(o(t),i))},[t]),a}var gu=vt;process.env.NODE_ENV!=="production"&&(gu=function(t){var n=t.props,r=t.state,o=w.useRef(n),i=lo();w.useEffect(function(){i||(Fs(r,o.current,n),o.current=n)},[r,n,i])});function ac(e,t,n){var r;n===void 0&&(n=!0);var o=((r=e.items)==null?void 0:r.length)&&t>=0;return pe({isOpen:!1,highlightedIndex:-1},o&&pe({selectedItem:e.items[t],isOpen:Sn(e,"isOpen"),highlightedIndex:Sn(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function Ry(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function lo(){var e=w.useRef(!0);return w.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function fs(e){var t=Sn(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function Ay(e){var t=Hr(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var Li={environment:K.shape({addEventListener:K.func.isRequired,removeEventListener:K.func.isRequired,document:K.shape({createElement:K.func.isRequired,getElementById:K.func.isRequired,activeElement:K.any.isRequired,body:K.any.isRequired}).isRequired,Node:K.func.isRequired}),itemToString:K.func,itemToKey:K.func,stateReducer:K.func},yu=pe({},Li,{getA11yStatusMessage:K.func,highlightedIndex:K.number,defaultHighlightedIndex:K.number,initialHighlightedIndex:K.number,isOpen:K.bool,defaultIsOpen:K.bool,initialIsOpen:K.bool,selectedItem:K.any,initialSelectedItem:K.any,defaultSelectedItem:K.any,id:K.string,labelId:K.string,menuId:K.string,getItemId:K.func,toggleButtonId:K.string,onSelectedItemChange:K.func,onHighlightedIndexChange:K.func,onStateChange:K.func,onIsOpenChange:K.func,scrollIntoView:K.func});function Py(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:Br(o,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:Br(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:fs(o),isOpen:Sn(o,"isOpen"),selectedItem:Sn(o,"selectedItem"),inputValue:Sn(o,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return pe({},e,i)}Or(Or({},yu),{items:K.array.isRequired,isItemDisabled:K.func});Or(Or({},Ur),{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 js=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,ks=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,Ls=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,Ks=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,Vs=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,$s=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,qs=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,Us=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,Hs=process.env.NODE_ENV!=="production"?"__input_change__":8,Gi=process.env.NODE_ENV!=="production"?"__input_blur__":9,Bs=process.env.NODE_ENV!=="production"?"__input_click__":10,vu=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,wu=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,Ws=process.env.NODE_ENV!=="production"?"__item_click__":13,Iu=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,bu=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,_u=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,xu=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,Cu=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,Js=process.env.NODE_ENV!=="production"?"__function_select_item__":19,Ou=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,Eu=process.env.NODE_ENV!=="production"?"__function_reset__":21,zs=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,Su=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:zs,FunctionCloseMenu:xu,FunctionOpenMenu:_u,FunctionReset:Eu,FunctionSelectItem:Js,FunctionSetHighlightedIndex:Cu,FunctionSetInputValue:Ou,FunctionToggleMenu:bu,InputBlur:Gi,InputChange:Hs,InputClick:Bs,InputKeyDownArrowDown:js,InputKeyDownArrowUp:ks,InputKeyDownEnd:Vs,InputKeyDownEnter:Us,InputKeyDownEscape:Ls,InputKeyDownHome:Ks,InputKeyDownPageDown:qs,InputKeyDownPageUp:$s,ItemClick:Ws,ItemMouseMove:wu,MenuMouseLeave:vu,ToggleButtonClick:Iu});function Dy(e){var t=Ey(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)),pe({},t,{inputValue:r})}var Fy=pe({},yu,{items:K.array.isRequired,isItemDisabled:K.func,inputValue:K.string,defaultInputValue:K.string,initialInputValue:K.string,inputId:K.string,onInputValueChange:K.func});function My(e,t,n,r){var o=w.useRef(),i=Oy(e,t,n,r),s=i[0],a=i[1],c=lo();return w.useEffect(function(){if(Ji(t,"selectedItem")){if(!c){var u=t.itemToKey(t.selectedItem)!==t.itemToKey(o.current);u&&a({type:zs,inputValue:t.itemToString(t.selectedItem)})}o.current=s.selectedItem===o.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[Wi(s,t),a]}var Nu=vt;process.env.NODE_ENV!=="production"&&(Nu=function(t,n){K.checkPropTypes(Fy,t,"prop",n.name)});var jy=pe({},Ur,{isItemDisabled:function(){return!1}});function ky(e,t){var n,r=t.type,o=t.props,i=t.altKey,s;switch(r){case Ws:s={isOpen:Sn(o,"isOpen"),highlightedIndex:fs(o),selectedItem:o.items[t.index],inputValue:o.itemToString(o.items[t.index])};break;case js:e.isOpen?s={highlightedIndex:Un(e.highlightedIndex,1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:i&&e.selectedItem==null?-1:Br(o,e,1),isOpen:o.items.length>=0};break;case ks:e.isOpen?i?s=ac(o,e.highlightedIndex):s={highlightedIndex:Un(e.highlightedIndex,-1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:Br(o,e,-1),isOpen:o.items.length>=0};break;case Us:s=ac(o,e.highlightedIndex);break;case Ls:s=pe({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case $s:s={highlightedIndex:Un(e.highlightedIndex,-10,o.items,o.isItemDisabled,!0)};break;case qs:s={highlightedIndex:Un(e.highlightedIndex,10,o.items,o.isItemDisabled,!0)};break;case Ks:s={highlightedIndex:Er(0,!1,o.items,o.isItemDisabled)};break;case Vs:s={highlightedIndex:Er(o.items.length-1,!0,o.items,o.isItemDisabled)};break;case Gi:s=pe({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 Hs:s={isOpen:!0,highlightedIndex:fs(o),inputValue:t.inputValue};break;case Bs:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Br(o,e,0)};break;case Js:s={selectedItem:t.selectedItem,inputValue:o.itemToString(t.selectedItem)};break;case zs:s={inputValue:t.inputValue};break;default:return Py(e,t,Su)}return pe({},e,s)}var Ly=["onMouseLeave","refKey","ref"],Ky=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],Vy=["onClick","onPress","refKey","ref"],$y=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];Gs.stateChangeTypes=Su;function Gs(e){e===void 0&&(e={}),Nu(e,Gs);var t=pe({},jy,e),n=t.items,r=t.scrollIntoView,o=t.environment,i=t.getA11yStatusMessage,s=My(ky,t,Dy,Ry),a=s[0],c=s[1],u=a.isOpen,d=a.highlightedIndex,f=a.selectedItem,m=a.inputValue,p=w.useRef(null),g=w.useRef({}),y=w.useRef(null),h=w.useRef(null),_=lo(),v=xy(t),x=w.useRef(),C=hu({state:a,props:t}),b=w.useCallback(function(V){return g.current[v.getItemId(V)]},[v]);Ny(i,a,[u,d,f,m],o);var N=Ty({menuElement:p.current,highlightedIndex:d,isOpen:u,itemRefs:g,scrollIntoView:r,getItemNodeFromIndex:b});gu({props:t,state:a}),w.useEffect(function(){var V=Hr(t,"isOpen");V&&y.current&&y.current.focus()},[]),w.useEffect(function(){_||(x.current=n.length)});var R=Sy(o,w.useCallback(function(){C.current.state.isOpen&&c({type:Gi,selectItem:!1})},[c,C]),w.useMemo(function(){return[p,h,y]},[p.current,h.current,y.current])),S=mu("getInputProps","getMenuProps");w.useEffect(function(){u||(g.current={})},[u]),w.useEffect(function(){var V;!u||!(o!=null&&o.document)||!(y!=null&&(V=y.current)!=null&&V.focus)||o.document.activeElement!==y.current&&y.current.focus()},[u,o]);var F=w.useMemo(function(){return{ArrowDown:function(L){L.preventDefault(),c({type:js,altKey:L.altKey})},ArrowUp:function(L){L.preventDefault(),c({type:ks,altKey:L.altKey})},Home:function(L){C.current.state.isOpen&&(L.preventDefault(),c({type:Ks}))},End:function(L){C.current.state.isOpen&&(L.preventDefault(),c({type:Vs}))},Escape:function(L){var k=C.current.state;(k.isOpen||k.inputValue||k.selectedItem||k.highlightedIndex>-1)&&(L.preventDefault(),c({type:Ls}))},Enter:function(L){var k=C.current.state;!k.isOpen||L.which===229||(L.preventDefault(),c({type:Us}))},PageUp:function(L){C.current.state.isOpen&&(L.preventDefault(),c({type:$s}))},PageDown:function(L){C.current.state.isOpen&&(L.preventDefault(),c({type:qs}))}}},[c,C]),q=w.useCallback(function(V){return pe({id:v.labelId,htmlFor:v.inputId},V)},[v]),z=w.useCallback(function(V,L){var k,D=V===void 0?{}:V,Z=D.onMouseLeave,ee=D.refKey,U=ee===void 0?"ref":ee,te=D.ref,G=ln(D,Ly),ue=L===void 0?{}:L,M=ue.suppressRefError,we=M===void 0?!1:M;return S("getMenuProps",we,U,p),pe((k={},k[U]=ar(te,function(H){p.current=H}),k.id=v.menuId,k.role="listbox",k["aria-labelledby"]=G&&G["aria-label"]?void 0:""+v.labelId,k.onMouseLeave=He(Z,function(){c({type:vu})}),k),G)},[c,S,v]),J=w.useCallback(function(V){var L,k,D=V===void 0?{}:V,Z=D.item,ee=D.index,U=D.refKey,te=U===void 0?"ref":U,G=D.ref,ue=D.onMouseMove,M=D.onMouseDown,we=D.onClick;D.onPress;var H=D.disabled,Ee=ln(D,Ky);H!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var Le=C.current,ze=Le.props,Ve=Le.state,Ie=Cy(Z,ee,ze.items,"Pass either item or index to getItemProps!"),Rt=Ie[0],Ge=Ie[1],mt=ze.isItemDisabled(Rt,Ge),At="onClick",Pt=we,Qe=function(){R.isTouchEnd||Ge===Ve.highlightedIndex||(N.current=!1,c({type:wu,index:Ge,disabled:mt}))},Be=function(){c({type:Ws,index:Ge})},$e=function(Dt){return Dt.preventDefault()};return pe((L={},L[te]=ar(G,function(Ae){Ae&&(g.current[v.getItemId(Ge)]=Ae)}),L["aria-disabled"]=mt,L["aria-selected"]=Ge===Ve.highlightedIndex,L.id=v.getItemId(Ge),L.role="option",L),!mt&&(k={},k[At]=He(Pt,Be),k),{onMouseMove:He(ue,Qe),onMouseDown:He(M,$e)},Ee)},[c,v,C,R,N]),ne=w.useCallback(function(V){var L,k=V===void 0?{}:V,D=k.onClick;k.onPress;var Z=k.refKey,ee=Z===void 0?"ref":Z,U=k.ref,te=ln(k,Vy),G=C.current.state,ue=function(){c({type:Iu})};return pe((L={},L[ee]=ar(U,function(M){h.current=M}),L["aria-controls"]=v.menuId,L["aria-expanded"]=G.isOpen,L.id=v.toggleButtonId,L.tabIndex=-1,L),!te.disabled&&pe({},{onClick:He(D,ue)}),te)},[c,C,v]),B=w.useCallback(function(V,L){var k,D=V===void 0?{}:V,Z=D.onKeyDown,ee=D.onChange,U=D.onInput,te=D.onBlur;D.onChangeText;var G=D.onClick,ue=D.refKey,M=ue===void 0?"ref":ue,we=D.ref,H=ln(D,$y),Ee=L===void 0?{}:L,Le=Ee.suppressRefError,ze=Le===void 0?!1:Le;S("getInputProps",ze,M,y);var Ve=C.current.state,Ie=function($e){var Ae=us($e);Ae&&F[Ae]&&F[Ae]($e)},Rt=function($e){c({type:Hs,inputValue:$e.target.value})},Ge=function($e){if(o!=null&&o.document&&Ve.isOpen&&!R.isMouseDown){var Ae=$e.relatedTarget===null&&o.document.activeElement!==o.document.body;c({type:Gi,selectItem:!Ae})}},mt=function(){c({type:Bs})},At="onChange",Pt={};if(!H.disabled){var Qe;Pt=(Qe={},Qe[At]=He(ee,U,Rt),Qe.onKeyDown=He(Z,Ie),Qe.onBlur=He(te,Ge),Qe.onClick=He(G,mt),Qe)}return pe((k={},k[M]=ar(we,function(Be){y.current=Be}),k["aria-activedescendant"]=Ve.isOpen&&Ve.highlightedIndex>-1?v.getItemId(Ve.highlightedIndex):"",k["aria-autocomplete"]="list",k["aria-controls"]=v.menuId,k["aria-expanded"]=Ve.isOpen,k["aria-labelledby"]=H&&H["aria-label"]?void 0:v.labelId,k.autoComplete="off",k.id=v.inputId,k.role="combobox",k.value=Ve.inputValue,k),Pt,H)},[c,v,o,F,C,R,S]),ce=w.useCallback(function(){c({type:bu})},[c]),re=w.useCallback(function(){c({type:xu})},[c]),X=w.useCallback(function(){c({type:_u})},[c]),fe=w.useCallback(function(V){c({type:Cu,highlightedIndex:V})},[c]),ve=w.useCallback(function(V){c({type:Js,selectedItem:V})},[c]),T=w.useCallback(function(V){c({type:Ou,inputValue:V})},[c]),j=w.useCallback(function(){c({type:Eu})},[c]);return{getItemProps:J,getLabelProps:q,getMenuProps:z,getInputProps:B,getToggleButtonProps:ne,toggleMenu:ce,openMenu:X,closeMenu:re,setHighlightedIndex:fe,setInputValue:T,selectItem:ve,reset:j,highlightedIndex:d,isOpen:u,selectedItem:f,inputValue:m}}Li.stateReducer,Li.itemToKey,Li.environment,K.array,K.array,K.array,K.func,K.number,K.number,K.number,K.func,K.func,K.string,K.string;Ur.itemToKey,Ur.stateReducer,Ur.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 qy="_comboboxContainer_9s7ov_1",Uy="_label_9s7ov_8",Hy="_inputContainer_9s7ov_12",By="_input_9s7ov_12",Wy="_toggleButton_9s7ov_33",Jy="_menu_9s7ov_39",zy="_menuItem_9s7ov_54",Gy="_highlighted_9s7ov_61",Qy="_selected_9s7ov_65",Xy="_hidden_9s7ov_69",sn={comboboxContainer:qy,label:Uy,inputContainer:Hy,input:By,toggleButton:Wy,menu:Jy,menuItem:zy,highlighted:Gy,selected:Qy,hidden:Xy};function Yy(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function Qs({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:o,style:i}){const[s,a]=w.useState(e),c=w.useRef(null);w.useEffect(()=>a(e),[e]);const u=b=>{a(e.filter(Yy(b)))},{isOpen:d,getToggleButtonProps:f,getMenuProps:m,getInputProps:p,highlightedIndex:g,getItemProps:y,setInputValue:h}=Gs({items:s,selectedItem:t?e.find(b=>b.value===t):null,itemToString:b=>(b==null?void 0:b.label)||"",onInputValueChange:({inputValue:b})=>u(b),onSelectedItemChange:({selectedItem:b})=>{var N;(N=c.current)==null||N.blur(),n(b)}}),_=()=>{h(""),a(e)},v=()=>_(),x=w.useMemo(()=>{var b;return(b=e.find(N=>N.value===t))==null?void 0:b.label},[e,t]),C=()=>h(x||"");return l.jsxs("div",{style:{position:"relative",...i},children:[l.jsx("div",{className:sn.comboboxContainer,children:l.jsxs("div",{className:sn.inputContainer,children:[l.jsx("input",{style:{border:"none"},disabled:o,placeholder:x||r,className:sn.input,...p({onFocus:v,onBlur:C,ref:c})}),l.jsx("button",{style:{border:"none"},disabled:o,"aria-label":"toggle menu",className:sn.toggleButton,type:"button",...f(),children:d?l.jsx(l.Fragment,{children:"↑"}):l.jsx(l.Fragment,{children:"↓"})})]})}),l.jsx("ul",{className:`${sn.menu} ${d&&e.length?"":sn.hidden}`,...m(),children:d&&s.map((b,N)=>l.jsx("li",{className:`${sn.menuItem} ${g===N?sn.highlighted:""} ${t===(b==null?void 0:b.value)?sn.selected:""}`,...y({item:b,index:N}),children:l.jsx("span",{children:b.label})},b.id))})]})}const Sr=Math.min,Xn=Math.max,Qi=Math.round,Pi=Math.floor,Rn=e=>({x:e,y:e}),Zy={left:"right",right:"left",bottom:"top",top:"bottom"},ev={start:"end",end:"start"};function ps(e,t,n){return Xn(e,Sr(t,n))}function ci(e,t){return typeof e=="function"?e(t):e}function rr(e){return e.split("-")[0]}function li(e){return e.split("-")[1]}function Tu(e){return e==="x"?"y":"x"}function Xs(e){return e==="y"?"height":"width"}function Nr(e){return["top","bottom"].includes(rr(e))?"y":"x"}function Ys(e){return Tu(Nr(e))}function tv(e,t,n){n===void 0&&(n=!1);const r=li(e),o=Ys(e),i=Xs(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Xi(s)),[s,Xi(s)]}function nv(e){const t=Xi(e);return[hs(e),t,hs(t)]}function hs(e){return e.replace(/start|end/g,t=>ev[t])}function rv(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 iv(e,t,n,r){const o=li(e);let i=rv(rr(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(hs)))),i}function Xi(e){return e.replace(/left|right|bottom|top/g,t=>Zy[t])}function ov(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ru(e){return typeof e!="number"?ov(e):{top:e,right:e,bottom:e,left:e}}function Yi(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 cc(e,t,n){let{reference:r,floating:o}=e;const i=Nr(t),s=Ys(t),a=Xs(s),c=rr(t),u=i==="y",d=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 p;switch(c){case"top":p={x:d,y:r.y-o.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-o.width,y:f};break;default:p={x:r.x,y:r.y}}switch(li(t)){case"start":p[s]-=m*(n&&u?-1:1);break;case"end":p[s]+=m*(n&&u?-1:1);break}return p}const sv=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 u=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:f}=cc(u,r,c),m=r,p={},g=0;for(let y=0;y<a.length;y++){const{name:h,fn:_}=a[y],{x:v,y:x,data:C,reset:b}=await _({x:d,y:f,initialPlacement:r,placement:m,strategy:o,middlewareData:p,rects:u,platform:s,elements:{reference:e,floating:t}});d=v??d,f=x??f,p={...p,[h]:{...p[h],...C}},b&&g<=50&&(g++,typeof b=="object"&&(b.placement&&(m=b.placement),b.rects&&(u=b.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):b.rects),{x:d,y:f}=cc(u,m,c)),y=-1)}return{x:d,y:f,placement:m,strategy:o,middlewareData:p}};async function Au(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:m=!1,padding:p=0}=ci(t,e),g=Ru(p),h=a[m?f==="floating"?"reference":"floating":f],_=Yi(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(h)))==null||n?h:h.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:u,rootBoundary:d,strategy:c})),v=f==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),C=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},b=Yi(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:x,strategy:c}):v);return{top:(_.top-b.top+g.top)/C.y,bottom:(b.bottom-_.bottom+g.bottom)/C.y,left:(_.left-b.left+g.left)/C.x,right:(b.right-_.right+g.right)/C.x}}const av=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:u,padding:d=0}=ci(e,t)||{};if(u==null)return{};const f=Ru(d),m={x:n,y:r},p=Ys(o),g=Xs(p),y=await s.getDimensions(u),h=p==="y",_=h?"top":"left",v=h?"bottom":"right",x=h?"clientHeight":"clientWidth",C=i.reference[g]+i.reference[p]-m[p]-i.floating[g],b=m[p]-i.reference[p],N=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let R=N?N[x]:0;(!R||!await(s.isElement==null?void 0:s.isElement(N)))&&(R=a.floating[x]||i.floating[g]);const S=C/2-b/2,F=R/2-y[g]/2-1,q=Sr(f[_],F),z=Sr(f[v],F),J=q,ne=R-y[g]-z,B=R/2-y[g]/2+S,ce=ps(J,B,ne),re=!c.arrow&&li(o)!=null&&B!==ce&&i.reference[g]/2-(B<J?q:z)-y[g]/2<0,X=re?B<J?B-J:B-ne:0;return{[p]:m[p]+X,data:{[p]:ce,centerOffset:B-ce-X,...re&&{alignmentOffset:X}},reset:re}}}),cv=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:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:y=!0,...h}=ci(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const _=rr(o),v=Nr(a),x=rr(a)===a,C=await(c.isRTL==null?void 0:c.isRTL(u.floating)),b=m||(x||!y?[Xi(a)]:nv(a)),N=g!=="none";!m&&N&&b.push(...iv(a,y,g,C));const R=[a,...b],S=await Au(t,h),F=[];let q=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&F.push(S[_]),f){const B=tv(o,s,C);F.push(S[B[0]],S[B[1]])}if(q=[...q,{placement:o,overflows:F}],!F.every(B=>B<=0)){var z,J;const B=(((z=i.flip)==null?void 0:z.index)||0)+1,ce=R[B];if(ce)return{data:{index:B,overflows:q},reset:{placement:ce}};let re=(J=q.filter(X=>X.overflows[0]<=0).sort((X,fe)=>X.overflows[1]-fe.overflows[1])[0])==null?void 0:J.placement;if(!re)switch(p){case"bestFit":{var ne;const X=(ne=q.filter(fe=>{if(N){const ve=Nr(fe.placement);return ve===v||ve==="y"}return!0}).map(fe=>[fe.placement,fe.overflows.filter(ve=>ve>0).reduce((ve,T)=>ve+T,0)]).sort((fe,ve)=>fe[1]-ve[1])[0])==null?void 0:ne[0];X&&(re=X);break}case"initialPlacement":re=a;break}if(o!==re)return{reset:{placement:re}}}return{}}}};async function lv(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=rr(n),a=li(n),c=Nr(n)==="y",u=["left","top"].includes(s)?-1:1,d=i&&c?-1:1,f=ci(t,e);let{mainAxis:m,crossAxis:p,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof g=="number"&&(p=a==="end"?g*-1:g),c?{x:p*d,y:m*u}:{x:m*u,y:p*d}}const uv=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 lv(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}}}}},dv=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:h=>{let{x:_,y:v}=h;return{x:_,y:v}}},...c}=ci(e,t),u={x:n,y:r},d=await Au(t,c),f=Nr(rr(o)),m=Tu(f);let p=u[m],g=u[f];if(i){const h=m==="y"?"top":"left",_=m==="y"?"bottom":"right",v=p+d[h],x=p-d[_];p=ps(v,p,x)}if(s){const h=f==="y"?"top":"left",_=f==="y"?"bottom":"right",v=g+d[h],x=g-d[_];g=ps(v,g,x)}const y=a.fn({...t,[m]:p,[f]:g});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[m]:i,[f]:s}}}}}};function uo(){return typeof window<"u"}function jr(e){return Pu(e)?(e.nodeName||"").toLowerCase():"#document"}function It(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Yt(e){var t;return(t=(Pu(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Pu(e){return uo()?e instanceof Node||e instanceof It(e).Node:!1}function $t(e){return uo()?e instanceof Element||e instanceof It(e).Element:!1}function Xt(e){return uo()?e instanceof HTMLElement||e instanceof It(e).HTMLElement:!1}function lc(e){return!uo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof It(e).ShadowRoot}function ui(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=qt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function fv(e){return["table","td","th"].includes(jr(e))}function fo(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Zs(e){const t=ea(),n=$t(e)?qt(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function pv(e){let t=An(e);for(;Xt(t)&&!Tr(t);){if(Zs(t))return t;if(fo(t))return null;t=An(t)}return null}function ea(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Tr(e){return["html","body","#document"].includes(jr(e))}function qt(e){return It(e).getComputedStyle(e)}function po(e){return $t(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function An(e){if(jr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||lc(e)&&e.host||Yt(e);return lc(t)?t.host:t}function Du(e){const t=An(e);return Tr(t)?e.ownerDocument?e.ownerDocument.body:e.body:Xt(t)&&ui(t)?t:Du(t)}function Zr(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Du(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=It(o);if(i){const a=ms(s);return t.concat(s,s.visualViewport||[],ui(o)?o:[],a&&n?Zr(a):[])}return t.concat(o,Zr(o,[],n))}function ms(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Fu(e){const t=qt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Xt(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=Qi(n)!==i||Qi(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function ta(e){return $t(e)?e:e.contextElement}function lr(e){const t=ta(e);if(!Xt(t))return Rn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Fu(t);let s=(i?Qi(n.width):n.width)/r,a=(i?Qi(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const hv=Rn(0);function Mu(e){const t=It(e);return!ea()||!t.visualViewport?hv:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function mv(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==It(e)?!1:t}function ir(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=ta(e);let s=Rn(1);t&&(r?$t(r)&&(s=lr(r)):s=lr(e));const a=mv(i,n,r)?Mu(i):Rn(0);let c=(o.left+a.x)/s.x,u=(o.top+a.y)/s.y,d=o.width/s.x,f=o.height/s.y;if(i){const m=It(i),p=r&&$t(r)?It(r):r;let g=m,y=ms(g);for(;y&&r&&p!==g;){const h=lr(y),_=y.getBoundingClientRect(),v=qt(y),x=_.left+(y.clientLeft+parseFloat(v.paddingLeft))*h.x,C=_.top+(y.clientTop+parseFloat(v.paddingTop))*h.y;c*=h.x,u*=h.y,d*=h.x,f*=h.y,c+=x,u+=C,g=It(y),y=ms(g)}}return Yi({width:d,height:f,x:c,y:u})}function gv(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=Yt(r),a=t?fo(t.floating):!1;if(r===s||a&&i)return n;let c={scrollLeft:0,scrollTop:0},u=Rn(1);const d=Rn(0),f=Xt(r);if((f||!f&&!i)&&((jr(r)!=="body"||ui(s))&&(c=po(r)),Xt(r))){const m=ir(r);u=lr(r),d.x=m.x+r.clientLeft,d.y=m.y+r.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x,y:n.y*u.y-c.scrollTop*u.y+d.y}}function yv(e){return Array.from(e.getClientRects())}function gs(e,t){const n=po(e).scrollLeft;return t?t.left+n:ir(Yt(e)).left+n}function vv(e){const t=Yt(e),n=po(e),r=e.ownerDocument.body,o=Xn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Xn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+gs(e);const a=-n.scrollTop;return qt(r).direction==="rtl"&&(s+=Xn(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function wv(e,t){const n=It(e),r=Yt(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,c=0;if(o){i=o.width,s=o.height;const u=ea();(!u||u&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}return{width:i,height:s,x:a,y:c}}function Iv(e,t){const n=ir(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Xt(e)?lr(e):Rn(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,c=o*i.x,u=r*i.y;return{width:s,height:a,x:c,y:u}}function uc(e,t,n){let r;if(t==="viewport")r=wv(e,n);else if(t==="document")r=vv(Yt(e));else if($t(t))r=Iv(t,n);else{const o=Mu(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return Yi(r)}function ju(e,t){const n=An(e);return n===t||!$t(n)||Tr(n)?!1:qt(n).position==="fixed"||ju(n,t)}function bv(e,t){const n=t.get(e);if(n)return n;let r=Zr(e,[],!1).filter(a=>$t(a)&&jr(a)!=="body"),o=null;const i=qt(e).position==="fixed";let s=i?An(e):e;for(;$t(s)&&!Tr(s);){const a=qt(s),c=Zs(s);!c&&a.position==="fixed"&&(o=null),(i?!c&&!o:!c&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||ui(s)&&!c&&ju(e,s))?r=r.filter(d=>d!==s):o=a,s=An(s)}return t.set(e,r),r}function _v(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?fo(t)?[]:bv(t,this._c):[].concat(n),r],a=s[0],c=s.reduce((u,d)=>{const f=uc(t,d,o);return u.top=Xn(f.top,u.top),u.right=Sr(f.right,u.right),u.bottom=Sr(f.bottom,u.bottom),u.left=Xn(f.left,u.left),u},uc(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function xv(e){const{width:t,height:n}=Fu(e);return{width:t,height:n}}function Cv(e,t,n){const r=Xt(t),o=Yt(t),i=n==="fixed",s=ir(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=Rn(0);if(r||!r&&!i)if((jr(t)!=="body"||ui(o))&&(a=po(t)),r){const p=ir(t,!0,i,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else o&&(c.x=gs(o));let u=0,d=0;if(o&&!r&&!i){const p=o.getBoundingClientRect();d=p.top+a.scrollTop,u=p.left+a.scrollLeft-gs(o,p)}const f=s.left+a.scrollLeft-c.x-u,m=s.top+a.scrollTop-c.y-d;return{x:f,y:m,width:s.width,height:s.height}}function jo(e){return qt(e).position==="static"}function dc(e,t){if(!Xt(e)||qt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Yt(e)===n&&(n=n.ownerDocument.body),n}function ku(e,t){const n=It(e);if(fo(e))return n;if(!Xt(e)){let o=An(e);for(;o&&!Tr(o);){if($t(o)&&!jo(o))return o;o=An(o)}return n}let r=dc(e,t);for(;r&&fv(r)&&jo(r);)r=dc(r,t);return r&&Tr(r)&&jo(r)&&!Zs(r)?n:r||pv(e)||n}const Ov=async function(e){const t=this.getOffsetParent||ku,n=this.getDimensions,r=await n(e.floating);return{reference:Cv(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ev(e){return qt(e).direction==="rtl"}const Sv={convertOffsetParentRelativeRectToViewportRelativeRect:gv,getDocumentElement:Yt,getClippingRect:_v,getOffsetParent:ku,getElementRects:Ov,getClientRects:yv,getDimensions:xv,getScale:lr,isElement:$t,isRTL:Ev};function Nv(e,t){let n=null,r;const o=Yt(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:u,top:d,width:f,height:m}=e.getBoundingClientRect();if(a||t(),!f||!m)return;const p=Pi(d),g=Pi(o.clientWidth-(u+f)),y=Pi(o.clientHeight-(d+m)),h=Pi(u),v={rootMargin:-p+"px "+-g+"px "+-y+"px "+-h+"px",threshold:Xn(0,Sr(1,c))||1};let x=!0;function C(b){const N=b[0].intersectionRatio;if(N!==c){if(!x)return s();N?s(!1,N):r=setTimeout(()=>{s(!1,1e-7)},1e3)}x=!1}try{n=new IntersectionObserver(C,{...v,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,v)}n.observe(e)}return s(!0),i}function Tv(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,u=ta(e),d=o||i?[...u?Zr(u):[],...Zr(t)]:[];d.forEach(_=>{o&&_.addEventListener("scroll",n,{passive:!0}),i&&_.addEventListener("resize",n)});const f=u&&a?Nv(u,n):null;let m=-1,p=null;s&&(p=new ResizeObserver(_=>{let[v]=_;v&&v.target===u&&p&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var x;(x=p)==null||x.observe(t)})),n()}),u&&!c&&p.observe(u),p.observe(t));let g,y=c?ir(e):null;c&&h();function h(){const _=ir(e);y&&(_.x!==y.x||_.y!==y.y||_.width!==y.width||_.height!==y.height)&&n(),y=_,g=requestAnimationFrame(h)}return n(),()=>{var _;d.forEach(v=>{o&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),f==null||f(),(_=p)==null||_.disconnect(),p=null,c&&cancelAnimationFrame(g)}}const Rv=uv,Av=dv,Pv=cv,Dv=av,fc=(e,t,n)=>{const r=new Map,o={platform:Sv,...n},i={...o.platform,_c:r};return sv(e,t,{...o,platform:i})};/*
43
+ */var ac;function my(){return ac||(ac=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"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),g=!1,w=!1,h=!1,x=!1,y=!1,b;b=Symbol.for("react.module.reference");function C(H){return!!(typeof H=="string"||typeof H=="function"||H===n||H===o||y||H===r||H===u||H===d||x||H===m||g||w||h||typeof H=="object"&&H!==null&&(H.$$typeof===p||H.$$typeof===f||H.$$typeof===i||H.$$typeof===s||H.$$typeof===c||H.$$typeof===b||H.getModuleId!==void 0))}function _(H){if(typeof H=="object"&&H!==null){var Ee=H.$$typeof;switch(Ee){case e:var Le=H.type;switch(Le){case n:case o:case r:case u:case d:return Le;default:var Ge=Le&&Le.$$typeof;switch(Ge){case a:case s:case c:case p:case f:case i:return Ge;default:return Ee}}case t:return Ee}}}var S=s,T=i,N=e,P=c,q=n,G=p,z=f,ne=t,B=o,ce=r,oe=u,te=d,ge=!1,we=!1;function R(H){return ge||(ge=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function k(H){return we||(we=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function $(H){return _(H)===s}function L(H){return _(H)===i}function j(H){return typeof H=="object"&&H!==null&&H.$$typeof===e}function M(H){return _(H)===c}function Y(H){return _(H)===n}function Z(H){return _(H)===p}function U(H){return _(H)===f}function ee(H){return _(H)===t}function Q(H){return _(H)===o}function de(H){return _(H)===r}function F(H){return _(H)===u}function ve(H){return _(H)===d}Ce.ContextConsumer=S,Ce.ContextProvider=T,Ce.Element=N,Ce.ForwardRef=P,Ce.Fragment=q,Ce.Lazy=G,Ce.Memo=z,Ce.Portal=ne,Ce.Profiler=B,Ce.StrictMode=ce,Ce.Suspense=oe,Ce.SuspenseList=te,Ce.isAsyncMode=R,Ce.isConcurrentMode=k,Ce.isContextConsumer=$,Ce.isContextProvider=L,Ce.isElement=j,Ce.isForwardRef=M,Ce.isFragment=Y,Ce.isLazy=Z,Ce.isMemo=U,Ce.isPortal=ee,Ce.isProfiler=Q,Ce.isStrictMode=de,Ce.isSuspense=F,Ce.isSuspenseList=ve,Ce.isValidElementType=C,Ce.typeOf=_}()),Ce}process.env.NODE_ENV==="production"?vs.exports=hy():vs.exports=my();var cc=vs.exports;const lc=e=>typeof e=="object"&&e!=null&&e.nodeType===1,uc=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Uo=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return uc(n.overflowY,t)||uc(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},ki=(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,gy=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},yy=(e,t)=>{var n,r,o,i;if(typeof document>"u")return[];const{scrollMode:s,block:a,inline:c,boundary:u,skipOverflowHiddenElements:d}=t,f=typeof u=="function"?u:oe=>oe!==u;if(!lc(e))throw new TypeError("Invalid target");const p=document.scrollingElement||document.documentElement,m=[];let g=e;for(;lc(g)&&f(g);){if(g=gy(g),g===p){m.push(g);break}g!=null&&g===document.body&&Uo(g)&&!Uo(document.documentElement)||g!=null&&Uo(g,d)&&m.push(g)}const w=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,h=(i=(o=window.visualViewport)==null?void 0:o.height)!=null?i:innerHeight,{scrollX:x,scrollY:y}=window,{height:b,width:C,top:_,right:S,bottom:T,left:N}=e.getBoundingClientRect(),{top:P,right:q,bottom:G,left:z}=(oe=>{const te=window.getComputedStyle(oe);return{top:parseFloat(te.scrollMarginTop)||0,right:parseFloat(te.scrollMarginRight)||0,bottom:parseFloat(te.scrollMarginBottom)||0,left:parseFloat(te.scrollMarginLeft)||0}})(e);let ne=a==="start"||a==="nearest"?_-P:a==="end"?T+G:_+b/2-P+G,B=c==="center"?N+C/2-z+q:c==="end"?S+q:N-z;const ce=[];for(let oe=0;oe<m.length;oe++){const te=m[oe],{height:ge,width:we,top:R,right:k,bottom:$,left:L}=te.getBoundingClientRect();if(s==="if-needed"&&_>=0&&N>=0&&T<=h&&S<=w&&_>=R&&T<=$&&N>=L&&S<=k)return ce;const j=getComputedStyle(te),M=parseInt(j.borderLeftWidth,10),Y=parseInt(j.borderTopWidth,10),Z=parseInt(j.borderRightWidth,10),U=parseInt(j.borderBottomWidth,10);let ee=0,Q=0;const de="offsetWidth"in te?te.offsetWidth-te.clientWidth-M-Z:0,F="offsetHeight"in te?te.offsetHeight-te.clientHeight-Y-U:0,ve="offsetWidth"in te?te.offsetWidth===0?0:we/te.offsetWidth:0,H="offsetHeight"in te?te.offsetHeight===0?0:ge/te.offsetHeight:0;if(p===te)ee=a==="start"?ne:a==="end"?ne-h:a==="nearest"?ki(y,y+h,h,Y,U,y+ne,y+ne+b,b):ne-h/2,Q=c==="start"?B:c==="center"?B-w/2:c==="end"?B-w:ki(x,x+w,w,M,Z,x+B,x+B+C,C),ee=Math.max(0,ee+y),Q=Math.max(0,Q+x);else{ee=a==="start"?ne-R-Y:a==="end"?ne-$+U+F:a==="nearest"?ki(R,$,ge,Y,U+F,ne,ne+b,b):ne-(R+ge/2)+F/2,Q=c==="start"?B-L-M:c==="center"?B-(L+we/2)+de/2:c==="end"?B-k+Z+de:ki(L,k,we,M,Z+de,B,B+C,C);const{scrollLeft:Ee,scrollTop:Le}=te;ee=H===0?0:Math.max(0,Math.min(Le+ee/H,te.scrollHeight-ge/H+F)),Q=ve===0?0:Math.max(0,Math.min(Ee+Q/ve,te.scrollWidth-we/ve+de)),ne+=Le-ee,B+=Ee-Q}ce.push({el:te,top:ee,left:Q})}return ce};var Fr=function(){return Fr=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},Fr.apply(this,arguments)};var vy=0;function dc(e){return typeof e=="function"?e:vt}function vt(){}function su(e,t){if(e){var n=yy(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 fc(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function qs(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 He(){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 gr(){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(vy++)}function wy(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 pc(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function cu(e){return typeof e.type=="string"}function lu(e){return e.props}function Iy(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var by=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function ji(e){e===void 0&&(e={});var t={};return by.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function eo(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,r){return n[r]=to(t,r)?t[r]:e[r],n},{})}function to(e,t){return e[t]!==void 0}function ws(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function _y(e){return Object.prototype.toString.call(e)==="[object Object]"}function Jn(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=kr(a,t<0,n,r,o);return c===-1?e>=i?-1:e:c}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 no(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(o){return o&&(fc(o,e,n)||r&&fc(o,n.document.activeElement,n))})}var Us=vt;process.env.NODE_ENV!=="production"&&(Us=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 xy=qs(function(e){uu(e).textContent=""},500);function uu(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=uu(t);n.textContent=e,xy(t)}}function Cy(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var fu=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,pu=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,hu=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,Ui=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,Hi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,mu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,gu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,yu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,vu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,wu=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,Iu=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,bu=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,_u=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,Is=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,xu=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,Cu=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,Ou=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,Oy=Object.freeze({__proto__:null,blurButton:xu,blurInput:Iu,changeInput:bu,clickButton:Is,clickItem:wu,controlledPropUpdatedSelectedItem:Cu,itemMouseEnter:hu,keyDownArrowDown:Hi,keyDownArrowUp:Ui,keyDownEnd:vu,keyDownEnter:gu,keyDownEscape:mu,keyDownHome:yu,keyDownSpaceButton:_u,mouseUp:pu,touchEnd:Ou,unknown:fu}),Ey=["refKey","ref"],Sy=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],Ny=["onKeyDown","onBlur","onChange","onInput","onChangeText"],Ty=["refKey","ref"],Ry=["onMouseMove","onMouseDown","onClick","onPress","index","item"],Ay=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(y){return i.id+"-item-"+y},i.items=[],i.itemCount=null,i.previousResultCount=0,i.timeoutIds=[],i.internalSetTimeout=function(y,b){var C=setTimeout(function(){i.timeoutIds=i.timeoutIds.filter(function(_){return _!==C}),y()},b);i.timeoutIds.push(C)},i.setItemCount=function(y){i.itemCount=y},i.unsetItemCount=function(){i.itemCount=null},i.isItemDisabled=function(y,b){var C=i.getItemNodeFromIndex(b);return C&&C.hasAttribute("disabled")},i.setHighlightedIndex=function(y,b){y===void 0&&(y=i.props.defaultHighlightedIndex),b===void 0&&(b={}),b=ji(b),i.internalSetState(he({highlightedIndex:y},b))},i.clearSelection=function(y){i.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:i.props.defaultHighlightedIndex,isOpen:i.props.defaultIsOpen},y)},i.selectItem=function(y,b,C){b=ji(b),i.internalSetState(he({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,selectedItem:y,inputValue:i.props.itemToString(y)},b),C)},i.selectItemAtIndex=function(y,b,C){var _=i.items[y];_!=null&&i.selectItem(_,b,C)},i.selectHighlightedItem=function(y,b){return i.selectItemAtIndex(i.getState().highlightedIndex,y,b)},i.internalSetState=function(y,b){var C,_,S={},T=typeof y=="function";return!T&&y.hasOwnProperty("inputValue")&&i.props.onInputValueChange(y.inputValue,he({},i.getStateAndHelpers(),y)),i.setState(function(N){var P;N=i.getState(N);var q=T?y(N):y;q=i.props.stateReducer(N,q),C=q.hasOwnProperty("selectedItem");var G={};return C&&q.selectedItem!==N.selectedItem&&(_=q.selectedItem),(P=q).type||(P.type=fu),Object.keys(q).forEach(function(z){N[z]!==q[z]&&(S[z]=q[z]),z!=="type"&&(q[z],to(i.props,z)||(G[z]=q[z]))}),T&&q.hasOwnProperty("inputValue")&&i.props.onInputValueChange(q.inputValue,he({},i.getStateAndHelpers(),q)),G},function(){dc(b)();var N=Object.keys(S).length>1;N&&i.props.onStateChange(S,i.getStateAndHelpers()),C&&i.props.onSelect(y.selectedItem,i.getStateAndHelpers()),_!==void 0&&i.props.onChange(_,i.getStateAndHelpers()),i.props.onUserAction(S,i.getStateAndHelpers())})},i.rootRef=function(y){return i._rootNode=y},i.getRootProps=function(y,b){var C,_=y===void 0?{}:y,S=_.refKey,T=S===void 0?"ref":S,N=_.ref,P=ln(_,Ey),q=b===void 0?{}:b,G=q.suppressRefError,z=G===void 0?!1:G;i.getRootProps.called=!0,i.getRootProps.refKey=T,i.getRootProps.suppressRefError=z;var ne=i.getState(),B=ne.isOpen;return he((C={},C[T]=gr(N,i.rootRef),C.role="combobox",C["aria-expanded"]=B,C["aria-haspopup"]="listbox",C["aria-owns"]=B?i.menuId:void 0,C["aria-labelledby"]=i.labelId,C),P)},i.keyDownHandlers={ArrowDown:function(b){var C=this;if(b.preventDefault(),this.getState().isOpen){var _=b.shiftKey?5:1;this.moveHighlightedIndex(_,{type:Hi})}else this.internalSetState({isOpen:!0,type:Hi},function(){var S=C.getItemCount();if(S>0){var T=C.getState(),N=T.highlightedIndex,P=Jn(N,1,{length:S},C.isItemDisabled,!0);C.setHighlightedIndex(P,{type:Hi})}})},ArrowUp:function(b){var C=this;if(b.preventDefault(),this.getState().isOpen){var _=b.shiftKey?-5:-1;this.moveHighlightedIndex(_,{type:Ui})}else this.internalSetState({isOpen:!0,type:Ui},function(){var S=C.getItemCount();if(S>0){var T=C.getState(),N=T.highlightedIndex,P=Jn(N,-1,{length:S},C.isItemDisabled,!0);C.setHighlightedIndex(P,{type:Ui})}})},Enter:function(b){if(b.which!==229){var C=this.getState(),_=C.isOpen,S=C.highlightedIndex;if(_&&S!=null){b.preventDefault();var T=this.items[S],N=this.getItemNodeFromIndex(S);if(T==null||N&&N.hasAttribute("disabled"))return;this.selectHighlightedItem({type:gu})}}},Escape:function(b){b.preventDefault(),this.reset(he({type:mu},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},i.buttonKeyDownHandlers=he({},i.keyDownHandlers,{" ":function(b){b.preventDefault(),this.toggleMenu({type:_u})}}),i.inputKeyDownHandlers=he({},i.keyDownHandlers,{Home:function(b){var C=this.getState(),_=C.isOpen;if(_){b.preventDefault();var S=this.getItemCount();if(!(S<=0||!_)){var T=kr(0,!1,{length:S},this.isItemDisabled);this.setHighlightedIndex(T,{type:yu})}}},End:function(b){var C=this.getState(),_=C.isOpen;if(_){b.preventDefault();var S=this.getItemCount();if(!(S<=0||!_)){var T=kr(S-1,!0,{length:S},this.isItemDisabled);this.setHighlightedIndex(T,{type:vu})}}}}),i.getToggleButtonProps=function(y){var b=y===void 0?{}:y,C=b.onClick;b.onPress;var _=b.onKeyDown,S=b.onKeyUp,T=b.onBlur,N=ln(b,Sy),P=i.getState(),q=P.isOpen,G={onClick:He(C,i.buttonHandleClick),onKeyDown:He(_,i.buttonHandleKeyDown),onKeyUp:He(S,i.buttonHandleKeyUp),onBlur:He(T,i.buttonHandleBlur)},z=N.disabled?{}:G;return he({type:"button",role:"button","aria-label":q?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},z,N)},i.buttonHandleKeyUp=function(y){y.preventDefault()},i.buttonHandleKeyDown=function(y){var b=ws(y);i.buttonKeyDownHandlers[b]&&i.buttonKeyDownHandlers[b].call(i,y)},i.buttonHandleClick=function(y){if(y.preventDefault(),i.props.environment){var b=i.props.environment.document,C=b.body,_=b.activeElement;C&&C===_&&y.target.focus()}process.env.NODE_ENV==="test"?i.toggleMenu({type:Is}):i.internalSetTimeout(function(){return i.toggleMenu({type:Is})})},i.buttonHandleBlur=function(y){var b=y.target;i.internalSetTimeout(function(){if(!(i.isMouseDown||!i.props.environment)){var C=i.props.environment.document.activeElement;(C==null||C.id!==i.inputId)&&C!==b&&i.reset({type:xu})}})},i.getLabelProps=function(y){return he({htmlFor:i.inputId,id:i.labelId},y)},i.getInputProps=function(y){var b=y===void 0?{}:y,C=b.onKeyDown,_=b.onBlur,S=b.onChange,T=b.onInput;b.onChangeText;var N=ln(b,Ny),P,q={};P="onChange";var G=i.getState(),z=G.inputValue,ne=G.isOpen,B=G.highlightedIndex;if(!N.disabled){var ce;q=(ce={},ce[P]=He(S,T,i.inputHandleChange),ce.onKeyDown=He(C,i.inputHandleKeyDown),ce.onBlur=He(_,i.inputHandleBlur),ce)}return he({"aria-autocomplete":"list","aria-activedescendant":ne&&typeof B=="number"&&B>=0?i.getItemId(B):void 0,"aria-controls":ne?i.menuId:void 0,"aria-labelledby":N&&N["aria-label"]?void 0:i.labelId,autoComplete:"off",value:z,id:i.inputId},q,N)},i.inputHandleKeyDown=function(y){var b=ws(y);b&&i.inputKeyDownHandlers[b]&&i.inputKeyDownHandlers[b].call(i,y)},i.inputHandleChange=function(y){i.internalSetState({type:bu,isOpen:!0,inputValue:y.target.value,highlightedIndex:i.props.defaultHighlightedIndex})},i.inputHandleBlur=function(){i.internalSetTimeout(function(){var y;if(!(i.isMouseDown||!i.props.environment)){var b=i.props.environment.document.activeElement,C=(b==null||(y=b.dataset)==null?void 0:y.toggle)&&i._rootNode&&i._rootNode.contains(b);C||i.reset({type:Iu})}})},i.menuRef=function(y){i._menuNode=y},i.getMenuProps=function(y,b){var C,_=y===void 0?{}:y,S=_.refKey,T=S===void 0?"ref":S,N=_.ref,P=ln(_,Ty),q=b===void 0?{}:b,G=q.suppressRefError,z=G===void 0?!1:G;return i.getMenuProps.called=!0,i.getMenuProps.refKey=T,i.getMenuProps.suppressRefError=z,he((C={},C[T]=gr(N,i.menuRef),C.role="listbox",C["aria-labelledby"]=P&&P["aria-label"]?void 0:i.labelId,C.id=i.menuId,C),P)},i.getItemProps=function(y){var b,C=y===void 0?{}:y,_=C.onMouseMove,S=C.onMouseDown,T=C.onClick;C.onPress;var N=C.index,P=C.item,q=P===void 0?process.env.NODE_ENV==="production"?void 0:Iy("getItemProps","item"):P,G=ln(C,Ry);N===void 0?(i.items.push(q),N=i.items.indexOf(q)):i.items[N]=q;var z="onClick",ne=T,B=(b={onMouseMove:He(_,function(){N!==i.getState().highlightedIndex&&(i.setHighlightedIndex(N,{type:hu}),i.avoidScrolling=!0,i.internalSetTimeout(function(){return i.avoidScrolling=!1},250))}),onMouseDown:He(S,function(oe){oe.preventDefault()})},b[z]=He(ne,function(){i.selectItemAtIndex(N,{type:wu})}),b),ce=G.disabled?{onMouseDown:B.onMouseDown}:B;return he({id:i.getItemId(N),role:"option","aria-selected":i.getState().highlightedIndex===N},ce,G)},i.clearItems=function(){i.items=[]},i.reset=function(y,b){y===void 0&&(y={}),y=ji(y),i.internalSetState(function(C){var _=C.selectedItem;return he({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,inputValue:i.props.itemToString(_)},y)},b)},i.toggleMenu=function(y,b){y===void 0&&(y={}),y=ji(y),i.internalSetState(function(C){var _=C.isOpen;return he({isOpen:!_},_&&{highlightedIndex:i.props.defaultHighlightedIndex},y)},function(){var C=i.getState(),_=C.isOpen,S=C.highlightedIndex;_&&i.getItemCount()>0&&typeof S=="number"&&i.setHighlightedIndex(S,y),dc(b)()})},i.openMenu=function(y){i.internalSetState({isOpen:!0},y)},i.closeMenu=function(y){i.internalSetState({isOpen:!1},y)},i.updateStatus=qs(function(){var y;if((y=i.props)!=null&&(y=y.environment)!=null&&y.document){var b=i.getState(),C=i.items[b.highlightedIndex],_=i.getItemCount(),S=i.props.getA11yStatusMessage(he({itemToString:i.props.itemToString,previousResultCount:i.previousResultCount,resultCount:_,highlightedItem:C},b));i.previousResultCount=_,du(S,i.props.environment.document)}},200);var s=i.props,a=s.defaultHighlightedIndex,c=s.initialHighlightedIndex,u=c===void 0?a:c,d=s.defaultIsOpen,f=s.initialIsOpen,p=f===void 0?d:f,m=s.initialInputValue,g=m===void 0?"":m,w=s.initialSelectedItem,h=w===void 0?null:w,x=i.getState({highlightedIndex:u,isOpen:p,inputValue:g,selectedItem:h});return x.selectedItem!=null&&i.props.initialInputValue===void 0&&(x.inputValue=i.props.itemToString(x.selectedItem)),i.state=x,i}iy(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),eo(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(),u=c.highlightedIndex;if(a>0){var d=Jn(u,i,{length:a},this.isItemDisabled,!0);this.setHighlightedIndex(d,s)}},r.getStateAndHelpers=function(){var i=this.getState(),s=i.highlightedIndex,a=i.inputValue,c=i.selectedItem,u=i.isOpen,d=this.props.itemToString,f=this.id,p=this.getRootProps,m=this.getToggleButtonProps,g=this.getLabelProps,w=this.getMenuProps,h=this.getInputProps,x=this.getItemProps,y=this.openMenu,b=this.closeMenu,C=this.toggleMenu,_=this.selectItem,S=this.selectItemAtIndex,T=this.selectHighlightedItem,N=this.setHighlightedIndex,P=this.clearSelection,q=this.clearItems,G=this.reset,z=this.setItemCount,ne=this.unsetItemCount,B=this.internalSetState;return{getRootProps:p,getToggleButtonProps:m,getLabelProps:g,getMenuProps:w,getInputProps:h,getItemProps:x,reset:G,openMenu:y,closeMenu:b,toggleMenu:C,selectItem:_,selectItemAtIndex:S,selectHighlightedItem:T,setHighlightedIndex:N,clearSelection:P,clearItems:q,setItemCount:z,unsetItemCount:ne,setState:B,itemToString:d,id:f,highlightedIndex:s,inputValue:a,isOpen:u,selectedItem:c}},r.componentDidMount=function(){var i=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&hc(this._menuNode,this.getMenuProps),!this.props.environment)this.cleanup=function(){i.internalClearTimeouts()};else{var s=function(){i.isMouseDown=!0},a=function(m){i.isMouseDown=!1;var g=no(m.target,[i._rootNode,i._menuNode],i.props.environment);!g&&i.getState().isOpen&&i.reset({type:pu},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},c=function(){i.isTouchMove=!1},u=function(){i.isTouchMove=!0},d=function(m){var g=no(m.target,[i._rootNode,i._menuNode],i.props.environment,!1);!i.isTouchMove&&!g&&i.getState().isOpen&&i.reset({type:Ou},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",u),f.addEventListener("touchend",d),this.cleanup=function(){i.internalClearTimeouts(),i.updateStatus.cancel(),f.removeEventListener("mousedown",s),f.removeEventListener("mouseup",a),f.removeEventListener("touchstart",c),f.removeEventListener("touchmove",u),f.removeEventListener("touchend",d)}}},r.shouldScroll=function(i,s){var a=this.props.highlightedIndex===void 0?this.getState():this.props,c=a.highlightedIndex,u=s.highlightedIndex===void 0?i:s,d=u.highlightedIndex,f=c&&this.getState().isOpen&&!i.isOpen,p=c!==d;return f||p},r.componentDidUpdate=function(i,s){process.env.NODE_ENV!=="production"&&(Us(this.state,i,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&hc(this._menuNode,this.getMenuProps)),to(this.props,"selectedItem")&&this.props.selectedItemChanged(i.selectedItem,this.props.selectedItem)&&this.internalSetState({type:Cu,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=pc(this.props.children,vt);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=pc(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&&Py(s,this.getRootProps),s;if(cu(s))return v.cloneElement(s,this.getRootProps(lu(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}(v.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:wy,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&_y(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:vt,onInputValueChange:vt,onUserAction:vt,onChange:vt,onSelect:vt,onOuterClick:vt,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:su},e.stateChangeTypes=Oy,e}();process.env.NODE_ENV!=="production"&&(Ay.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 hc(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 Py(e,t){var n=t.refKey,r=n!=="ref",o=!cu(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)&&!lu(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Eu={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function Dy(e,t,n){var r=e.props,o=e.type,i={};Object.keys(t).forEach(function(s){My(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 My(e,t,n,r){var o=t.props,i=t.type,s="on"+Hs(e)+"Change";o[s]&&r[e]!==void 0&&r[e]!==n[e]&&o[s](he({type:i},r))}function Fy(e,t){return t.changes}var mc=qs(function(e,t){du(e,t)},200),ky=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?v.useLayoutEffect:v.useEffect,jy="useId"in v?function(t){var n=t.id,r=t.labelId,o=t.menuId,i=t.getItemId,s=t.toggleButtonId,a=t.inputId,c="downshift-"+v.useId();n||(n=c);var u=v.useRef({labelId:r||n+"-label",menuId:o||n+"-menu",getItemId:i||function(d){return n+"-item-"+d},toggleButtonId:s||n+"-toggle-button",inputId:a||n+"-input"});return u.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,c=t.inputId,u=v.useRef({labelId:o||r+"-label",menuId:i||r+"-menu",getItemId:s||function(d){return r+"-item-"+d},toggleButtonId:a||r+"-toggle-button",inputId:c||r+"-input"});return u.current};function Ly(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 Hs(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Su(e){var t=v.useRef(e);return t.current=e,t}function Vy(e,t,n,r){var o=v.useRef(),i=v.useRef(),s=v.useCallback(function(m,g){i.current=g,m=eo(m,g.props);var w=e(m,g),h=g.props.stateReducer(m,he({},g,{changes:w}));return h},[e]),a=v.useReducer(s,t,n),c=a[0],u=a[1],d=Su(t),f=v.useCallback(function(m){return u(he({props:d.current},m))},[d]),p=i.current;return v.useEffect(function(){var m=eo(o.current,p==null?void 0:p.props),g=p&&o.current&&!r(m,c);g&&Dy(p,m,c),o.current=c},[c,p,r]),[c,f]}var Zr={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:Fy,scrollIntoView:su,environment:typeof window>"u"?void 0:window};function An(e,t,n){n===void 0&&(n=Eu);var r=e["default"+Hs(t)];return r!==void 0?r:n[t]}function ei(e,t,n){n===void 0&&(n=Eu);var r=e[t];if(r!==void 0)return r;var o=e["initial"+Hs(t)];return o!==void 0?o:An(e,t,n)}function Ky(e){var t=ei(e,"selectedItem"),n=ei(e,"isOpen"),r=By(e),o=ei(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 ti(e,t,n){var r=e.items,o=e.initialHighlightedIndex,i=e.defaultHighlightedIndex,s=e.isItemDisabled,a=e.itemToKey,c=t.selectedItem,u=t.highlightedIndex;return r.length===0?-1:o!==void 0&&u===o&&!s(r[o],o)?o:i!==void 0&&!s(r[i],i)?i:c?r.findIndex(function(d){return a(c)===a(d)}):n<0&&!s(r[r.length-1],r.length-1)?r.length-1:n>0&&!s(r[0],0)?0:-1}function $y(e,t,n){var r=v.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return v.useEffect(function(){if(!e)return vt;var o=n.map(function(d){return d.current});function i(){r.current.isTouchEnd=!1,r.current.isMouseDown=!0}function s(d){r.current.isMouseDown=!1,no(d.target,o,e)||t()}function a(){r.current.isTouchEnd=!1,r.current.isTouchMove=!1}function c(){r.current.isTouchMove=!0}function u(d){r.current.isTouchEnd=!0,!r.current.isTouchMove&&!no(d.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",u),function(){e.removeEventListener("mousedown",i),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",c),e.removeEventListener("touchend",u)}},[n,e,t]),r.current}var Nu=function(){return vt};process.env.NODE_ENV!=="production"&&(Nu=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=v.useRef(n.reduce(function(s,a){return s[a]={},s},{}));v.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,u=a.refKey,d=a.elementRef;c||d!=null&&d.current||console.error('downshift: The ref prop "'+u+'" from '+s+" was not applied correctly on your element.")})},[]);var i=v.useCallback(function(s,a,c,u){o.current[s]={suppressRefError:a,refKey:c,elementRef:u}},[]);return i});function qy(e,t,n,r){r===void 0&&(r={});var o=r.document,i=vo();v.useEffect(function(){if(!(!e||i||!o)){var s=e(t);mc(s,o)}},n),v.useEffect(function(){return function(){mc.cancel(),Cy(o)}},[o])}function Uy(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,o=e.getItemNodeFromIndex,i=e.menuElement,s=e.scrollIntoView,a=v.useRef(!0);return ky(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(o(t),i))},[t]),a}var Tu=vt;process.env.NODE_ENV!=="production"&&(Tu=function(t){var n=t.props,r=t.state,o=v.useRef(n),i=vo();v.useEffect(function(){i||(Us(r,o.current,n),o.current=n)},[r,n,i])});function gc(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:An(e,"isOpen"),highlightedIndex:An(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function Hy(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function vo(){var e=v.useRef(!0);return v.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function bs(e){var t=An(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function By(e){var t=ei(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var Bi={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},Ru=he({},Bi,{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 Wy(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:ti(o,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:ti(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:bs(o),isOpen:An(o,"isOpen"),selectedItem:An(o,"selectedItem"),inputValue:An(o,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return he({},e,i)}Fr(Fr({},Ru),{items:V.array.isRequired,isItemDisabled:V.func});Fr(Fr({},Zr),{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 Bs=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,Ws=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,Js=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,zs=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,Gs=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,Qs=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,Xs=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,Ys=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,Zs=process.env.NODE_ENV!=="production"?"__input_change__":8,ro=process.env.NODE_ENV!=="production"?"__input_blur__":9,ea=process.env.NODE_ENV!=="production"?"__input_click__":10,Au=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,Pu=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,ta=process.env.NODE_ENV!=="production"?"__item_click__":13,Du=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,Mu=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,Fu=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,ku=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,ju=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,na=process.env.NODE_ENV!=="production"?"__function_select_item__":19,Lu=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,Vu=process.env.NODE_ENV!=="production"?"__function_reset__":21,ra=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,Ku=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:ra,FunctionCloseMenu:ku,FunctionOpenMenu:Fu,FunctionReset:Vu,FunctionSelectItem:na,FunctionSetHighlightedIndex:ju,FunctionSetInputValue:Lu,FunctionToggleMenu:Mu,InputBlur:ro,InputChange:Zs,InputClick:ea,InputKeyDownArrowDown:Bs,InputKeyDownArrowUp:Ws,InputKeyDownEnd:Gs,InputKeyDownEnter:Ys,InputKeyDownEscape:Js,InputKeyDownHome:zs,InputKeyDownPageDown:Xs,InputKeyDownPageUp:Qs,ItemClick:ta,ItemMouseMove:Pu,MenuMouseLeave:Au,ToggleButtonClick:Du});function Jy(e){var t=Ky(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 zy=he({},Ru,{items:V.array.isRequired,isItemDisabled:V.func,inputValue:V.string,defaultInputValue:V.string,initialInputValue:V.string,inputId:V.string,onInputValueChange:V.func});function Gy(e,t,n,r){var o=v.useRef(),i=Vy(e,t,n,r),s=i[0],a=i[1],c=vo();return v.useEffect(function(){if(to(t,"selectedItem")){if(!c){var u=t.itemToKey(t.selectedItem)!==t.itemToKey(o.current);u&&a({type:ra,inputValue:t.itemToString(t.selectedItem)})}o.current=s.selectedItem===o.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[eo(s,t),a]}var $u=vt;process.env.NODE_ENV!=="production"&&($u=function(t,n){V.checkPropTypes(zy,t,"prop",n.name)});var Qy=he({},Zr,{isItemDisabled:function(){return!1}});function Xy(e,t){var n,r=t.type,o=t.props,i=t.altKey,s;switch(r){case ta:s={isOpen:An(o,"isOpen"),highlightedIndex:bs(o),selectedItem:o.items[t.index],inputValue:o.itemToString(o.items[t.index])};break;case Bs:e.isOpen?s={highlightedIndex:Jn(e.highlightedIndex,1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:i&&e.selectedItem==null?-1:ti(o,e,1),isOpen:o.items.length>=0};break;case Ws:e.isOpen?i?s=gc(o,e.highlightedIndex):s={highlightedIndex:Jn(e.highlightedIndex,-1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:ti(o,e,-1),isOpen:o.items.length>=0};break;case Ys:s=gc(o,e.highlightedIndex);break;case Js:s=he({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case Qs:s={highlightedIndex:Jn(e.highlightedIndex,-10,o.items,o.isItemDisabled,!0)};break;case Xs:s={highlightedIndex:Jn(e.highlightedIndex,10,o.items,o.isItemDisabled,!0)};break;case zs:s={highlightedIndex:kr(0,!1,o.items,o.isItemDisabled)};break;case Gs:s={highlightedIndex:kr(o.items.length-1,!0,o.items,o.isItemDisabled)};break;case ro: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 Zs:s={isOpen:!0,highlightedIndex:bs(o),inputValue:t.inputValue};break;case ea:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:ti(o,e,0)};break;case na:s={selectedItem:t.selectedItem,inputValue:o.itemToString(t.selectedItem)};break;case ra:s={inputValue:t.inputValue};break;default:return Wy(e,t,Ku)}return he({},e,s)}var Yy=["onMouseLeave","refKey","ref"],Zy=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],ev=["onClick","onPress","refKey","ref"],tv=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];ia.stateChangeTypes=Ku;function ia(e){e===void 0&&(e={}),$u(e,ia);var t=he({},Qy,e),n=t.items,r=t.scrollIntoView,o=t.environment,i=t.getA11yStatusMessage,s=Gy(Xy,t,Jy,Hy),a=s[0],c=s[1],u=a.isOpen,d=a.highlightedIndex,f=a.selectedItem,p=a.inputValue,m=v.useRef(null),g=v.useRef({}),w=v.useRef(null),h=v.useRef(null),x=vo(),y=jy(t),b=v.useRef(),C=Su({state:a,props:t}),_=v.useCallback(function($){return g.current[y.getItemId($)]},[y]);qy(i,a,[u,d,f,p],o);var S=Uy({menuElement:m.current,highlightedIndex:d,isOpen:u,itemRefs:g,scrollIntoView:r,getItemNodeFromIndex:_});Tu({props:t,state:a}),v.useEffect(function(){var $=ei(t,"isOpen");$&&w.current&&w.current.focus()},[]),v.useEffect(function(){x||(b.current=n.length)});var T=$y(o,v.useCallback(function(){C.current.state.isOpen&&c({type:ro,selectItem:!1})},[c,C]),v.useMemo(function(){return[m,h,w]},[m.current,h.current,w.current])),N=Nu("getInputProps","getMenuProps");v.useEffect(function(){u||(g.current={})},[u]),v.useEffect(function(){var $;!u||!(o!=null&&o.document)||!(w!=null&&($=w.current)!=null&&$.focus)||o.document.activeElement!==w.current&&w.current.focus()},[u,o]);var P=v.useMemo(function(){return{ArrowDown:function(L){L.preventDefault(),c({type:Bs,altKey:L.altKey})},ArrowUp:function(L){L.preventDefault(),c({type:Ws,altKey:L.altKey})},Home:function(L){C.current.state.isOpen&&(L.preventDefault(),c({type:zs}))},End:function(L){C.current.state.isOpen&&(L.preventDefault(),c({type:Gs}))},Escape:function(L){var j=C.current.state;(j.isOpen||j.inputValue||j.selectedItem||j.highlightedIndex>-1)&&(L.preventDefault(),c({type:Js}))},Enter:function(L){var j=C.current.state;!j.isOpen||L.which===229||(L.preventDefault(),c({type:Ys}))},PageUp:function(L){C.current.state.isOpen&&(L.preventDefault(),c({type:Qs}))},PageDown:function(L){C.current.state.isOpen&&(L.preventDefault(),c({type:Xs}))}}},[c,C]),q=v.useCallback(function($){return he({id:y.labelId,htmlFor:y.inputId},$)},[y]),G=v.useCallback(function($,L){var j,M=$===void 0?{}:$,Y=M.onMouseLeave,Z=M.refKey,U=Z===void 0?"ref":Z,ee=M.ref,Q=ln(M,Yy),de=L===void 0?{}:L,F=de.suppressRefError,ve=F===void 0?!1:F;return N("getMenuProps",ve,U,m),he((j={},j[U]=gr(ee,function(H){m.current=H}),j.id=y.menuId,j.role="listbox",j["aria-labelledby"]=Q&&Q["aria-label"]?void 0:""+y.labelId,j.onMouseLeave=He(Y,function(){c({type:Au})}),j),Q)},[c,N,y]),z=v.useCallback(function($){var L,j,M=$===void 0?{}:$,Y=M.item,Z=M.index,U=M.refKey,ee=U===void 0?"ref":U,Q=M.ref,de=M.onMouseMove,F=M.onMouseDown,ve=M.onClick;M.onPress;var H=M.disabled,Ee=ln(M,Zy);H!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var Le=C.current,Ge=Le.props,Ke=Le.state,Ie=Ly(Y,Z,Ge.items,"Pass either item or index to getItemProps!"),At=Ie[0],Qe=Ie[1],mt=Ge.isItemDisabled(At,Qe),Pt="onClick",Dt=ve,Xe=function(){T.isTouchEnd||Qe===Ke.highlightedIndex||(S.current=!1,c({type:Pu,index:Qe,disabled:mt}))},We=function(){c({type:ta,index:Qe})},$e=function(Mt){return Mt.preventDefault()};return he((L={},L[ee]=gr(Q,function(Ae){Ae&&(g.current[y.getItemId(Qe)]=Ae)}),L["aria-disabled"]=mt,L["aria-selected"]=Qe===Ke.highlightedIndex,L.id=y.getItemId(Qe),L.role="option",L),!mt&&(j={},j[Pt]=He(Dt,We),j),{onMouseMove:He(de,Xe),onMouseDown:He(F,$e)},Ee)},[c,y,C,T,S]),ne=v.useCallback(function($){var L,j=$===void 0?{}:$,M=j.onClick;j.onPress;var Y=j.refKey,Z=Y===void 0?"ref":Y,U=j.ref,ee=ln(j,ev),Q=C.current.state,de=function(){c({type:Du})};return he((L={},L[Z]=gr(U,function(F){h.current=F}),L["aria-controls"]=y.menuId,L["aria-expanded"]=Q.isOpen,L.id=y.toggleButtonId,L.tabIndex=-1,L),!ee.disabled&&he({},{onClick:He(M,de)}),ee)},[c,C,y]),B=v.useCallback(function($,L){var j,M=$===void 0?{}:$,Y=M.onKeyDown,Z=M.onChange,U=M.onInput,ee=M.onBlur;M.onChangeText;var Q=M.onClick,de=M.refKey,F=de===void 0?"ref":de,ve=M.ref,H=ln(M,tv),Ee=L===void 0?{}:L,Le=Ee.suppressRefError,Ge=Le===void 0?!1:Le;N("getInputProps",Ge,F,w);var Ke=C.current.state,Ie=function($e){var Ae=ws($e);Ae&&P[Ae]&&P[Ae]($e)},At=function($e){c({type:Zs,inputValue:$e.target.value})},Qe=function($e){if(o!=null&&o.document&&Ke.isOpen&&!T.isMouseDown){var Ae=$e.relatedTarget===null&&o.document.activeElement!==o.document.body;c({type:ro,selectItem:!Ae})}},mt=function(){c({type:ea})},Pt="onChange",Dt={};if(!H.disabled){var Xe;Dt=(Xe={},Xe[Pt]=He(Z,U,At),Xe.onKeyDown=He(Y,Ie),Xe.onBlur=He(ee,Qe),Xe.onClick=He(Q,mt),Xe)}return he((j={},j[F]=gr(ve,function(We){w.current=We}),j["aria-activedescendant"]=Ke.isOpen&&Ke.highlightedIndex>-1?y.getItemId(Ke.highlightedIndex):"",j["aria-autocomplete"]="list",j["aria-controls"]=y.menuId,j["aria-expanded"]=Ke.isOpen,j["aria-labelledby"]=H&&H["aria-label"]?void 0:y.labelId,j.autoComplete="off",j.id=y.inputId,j.role="combobox",j.value=Ke.inputValue,j),Dt,H)},[c,y,o,P,C,T,N]),ce=v.useCallback(function(){c({type:Mu})},[c]),oe=v.useCallback(function(){c({type:ku})},[c]),te=v.useCallback(function(){c({type:Fu})},[c]),ge=v.useCallback(function($){c({type:ju,highlightedIndex:$})},[c]),we=v.useCallback(function($){c({type:na,selectedItem:$})},[c]),R=v.useCallback(function($){c({type:Lu,inputValue:$})},[c]),k=v.useCallback(function(){c({type:Vu})},[c]);return{getItemProps:z,getLabelProps:q,getMenuProps:G,getInputProps:B,getToggleButtonProps:ne,toggleMenu:ce,openMenu:te,closeMenu:oe,setHighlightedIndex:ge,setInputValue:R,selectItem:we,reset:k,highlightedIndex:d,isOpen:u,selectedItem:f,inputValue:p}}Bi.stateReducer,Bi.itemToKey,Bi.environment,V.array,V.array,V.array,V.func,V.number,V.number,V.number,V.func,V.func,V.string,V.string;Zr.itemToKey,Zr.stateReducer,Zr.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 nv="_comboboxContainer_9s7ov_1",rv="_label_9s7ov_8",iv="_inputContainer_9s7ov_12",ov="_input_9s7ov_12",sv="_toggleButton_9s7ov_33",av="_menu_9s7ov_39",cv="_menuItem_9s7ov_54",lv="_highlighted_9s7ov_61",uv="_selected_9s7ov_65",dv="_hidden_9s7ov_69",on={comboboxContainer:nv,label:rv,inputContainer:iv,input:ov,toggleButton:sv,menu:av,menuItem:cv,highlighted:lv,selected:uv,hidden:dv};function fv(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function oa({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:o,style:i}){const[s,a]=v.useState(e),c=v.useRef(null);v.useEffect(()=>a(e),[e]);const u=v.useCallback(S=>{(S==null?void 0:S.length)>0?a(e.filter(fv(S))):a(e)},[e]),{isOpen:d,getToggleButtonProps:f,getMenuProps:p,getInputProps:m,highlightedIndex:g,getItemProps:w,setInputValue:h,selectedItem:x}=ia({items:s,selectedItem:t?e.find(S=>S.value===t):null,itemToString:S=>(S==null?void 0:S.label)||"",onInputValueChange:({inputValue:S})=>u(S),onSelectedItemChange:({selectedItem:S})=>{var T;n(S),(T=c.current)==null||T.blur()}}),y=()=>{h(""),a(e)},b=()=>y(),C=v.useMemo(()=>{var S;return(S=e.find(T=>T.value===t))==null?void 0:S.label},[e,t]),_=()=>{t&&C&&t!==(x==null?void 0:x.value)&&h(C||"")};return l.jsxs("div",{style:{position:"relative",...i},children:[l.jsx("div",{className:on.comboboxContainer,children:l.jsxs("div",{className:on.inputContainer,children:[l.jsx("input",{style:{border:"none"},disabled:o,placeholder:r,className:on.input,...m({onFocus:b,onBlur:_,ref:c})}),l.jsx("button",{style:{border:"none"},disabled:o,"aria-label":"toggle menu",className:on.toggleButton,type:"button",...f(),children:d?l.jsx(l.Fragment,{children:"↑"}):l.jsx(l.Fragment,{children:"↓"})})]})}),l.jsx("ul",{className:`${on.menu} ${d&&e.length?"":on.hidden}`,...p(),children:d&&s.map((S,T)=>l.jsx("li",{className:`${on.menuItem} ${g===T?on.highlighted:""} ${t===(S==null?void 0:S.value)?on.selected:""}`,...w({item:S,index:T}),children:l.jsx("span",{children:S.label})},S.id))})]})}const jr=Math.min,nr=Math.max,io=Math.round,Li=Math.floor,Mn=e=>({x:e,y:e}),pv={left:"right",right:"left",bottom:"top",top:"bottom"},hv={start:"end",end:"start"};function _s(e,t,n){return nr(e,jr(t,n))}function hi(e,t){return typeof e=="function"?e(t):e}function lr(e){return e.split("-")[0]}function mi(e){return e.split("-")[1]}function qu(e){return e==="x"?"y":"x"}function sa(e){return e==="y"?"height":"width"}function Lr(e){return["top","bottom"].includes(lr(e))?"y":"x"}function aa(e){return qu(Lr(e))}function mv(e,t,n){n===void 0&&(n=!1);const r=mi(e),o=aa(e),i=sa(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=oo(s)),[s,oo(s)]}function gv(e){const t=oo(e);return[xs(e),t,xs(t)]}function xs(e){return e.replace(/start|end/g,t=>hv[t])}function yv(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 vv(e,t,n,r){const o=mi(e);let i=yv(lr(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(xs)))),i}function oo(e){return e.replace(/left|right|bottom|top/g,t=>pv[t])}function wv(e){return{top:0,right:0,bottom:0,left:0,...e}}function Uu(e){return typeof e!="number"?wv(e):{top:e,right:e,bottom:e,left:e}}function so(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 yc(e,t,n){let{reference:r,floating:o}=e;const i=Lr(t),s=aa(t),a=sa(s),c=lr(t),u=i==="y",d=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,p=r[a]/2-o[a]/2;let m;switch(c){case"top":m={x:d,y:r.y-o.height};break;case"bottom":m={x:d,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:f};break;case"left":m={x:r.x-o.width,y:f};break;default:m={x:r.x,y:r.y}}switch(mi(t)){case"start":m[s]-=p*(n&&u?-1:1);break;case"end":m[s]+=p*(n&&u?-1:1);break}return m}const Iv=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 u=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:f}=yc(u,r,c),p=r,m={},g=0;for(let w=0;w<a.length;w++){const{name:h,fn:x}=a[w],{x:y,y:b,data:C,reset:_}=await x({x:d,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:m,rects:u,platform:s,elements:{reference:e,floating:t}});d=y??d,f=b??f,m={...m,[h]:{...m[h],...C}},_&&g<=50&&(g++,typeof _=="object"&&(_.placement&&(p=_.placement),_.rects&&(u=_.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):_.rects),{x:d,y:f}=yc(u,p,c)),w=-1)}return{x:d,y:f,placement:p,strategy:o,middlewareData:m}};async function Hu(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:p=!1,padding:m=0}=hi(t,e),g=Uu(m),h=a[p?f==="floating"?"reference":"floating":f],x=so(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(h)))==null||n?h:h.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:u,rootBoundary:d,strategy:c})),y=f==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,b=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),C=await(i.isElement==null?void 0:i.isElement(b))?await(i.getScale==null?void 0:i.getScale(b))||{x:1,y:1}:{x:1,y:1},_=so(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:b,strategy:c}):y);return{top:(x.top-_.top+g.top)/C.y,bottom:(_.bottom-x.bottom+g.bottom)/C.y,left:(x.left-_.left+g.left)/C.x,right:(_.right-x.right+g.right)/C.x}}const bv=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:u,padding:d=0}=hi(e,t)||{};if(u==null)return{};const f=Uu(d),p={x:n,y:r},m=aa(o),g=sa(m),w=await s.getDimensions(u),h=m==="y",x=h?"top":"left",y=h?"bottom":"right",b=h?"clientHeight":"clientWidth",C=i.reference[g]+i.reference[m]-p[m]-i.floating[g],_=p[m]-i.reference[m],S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let T=S?S[b]:0;(!T||!await(s.isElement==null?void 0:s.isElement(S)))&&(T=a.floating[b]||i.floating[g]);const N=C/2-_/2,P=T/2-w[g]/2-1,q=jr(f[x],P),G=jr(f[y],P),z=q,ne=T-w[g]-G,B=T/2-w[g]/2+N,ce=_s(z,B,ne),oe=!c.arrow&&mi(o)!=null&&B!==ce&&i.reference[g]/2-(B<z?q:G)-w[g]/2<0,te=oe?B<z?B-z:B-ne:0;return{[m]:p[m]+te,data:{[m]:ce,centerOffset:B-ce-te,...oe&&{alignmentOffset:te}},reset:oe}}}),_v=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:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:w=!0,...h}=hi(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const x=lr(o),y=Lr(a),b=lr(a)===a,C=await(c.isRTL==null?void 0:c.isRTL(u.floating)),_=p||(b||!w?[oo(a)]:gv(a)),S=g!=="none";!p&&S&&_.push(...vv(a,w,g,C));const T=[a,..._],N=await Hu(t,h),P=[];let q=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&P.push(N[x]),f){const B=mv(o,s,C);P.push(N[B[0]],N[B[1]])}if(q=[...q,{placement:o,overflows:P}],!P.every(B=>B<=0)){var G,z;const B=(((G=i.flip)==null?void 0:G.index)||0)+1,ce=T[B];if(ce)return{data:{index:B,overflows:q},reset:{placement:ce}};let oe=(z=q.filter(te=>te.overflows[0]<=0).sort((te,ge)=>te.overflows[1]-ge.overflows[1])[0])==null?void 0:z.placement;if(!oe)switch(m){case"bestFit":{var ne;const te=(ne=q.filter(ge=>{if(S){const we=Lr(ge.placement);return we===y||we==="y"}return!0}).map(ge=>[ge.placement,ge.overflows.filter(we=>we>0).reduce((we,R)=>we+R,0)]).sort((ge,we)=>ge[1]-we[1])[0])==null?void 0:ne[0];te&&(oe=te);break}case"initialPlacement":oe=a;break}if(o!==oe)return{reset:{placement:oe}}}return{}}}};async function xv(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=lr(n),a=mi(n),c=Lr(n)==="y",u=["left","top"].includes(s)?-1:1,d=i&&c?-1:1,f=hi(t,e);let{mainAxis:p,crossAxis:m,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof g=="number"&&(m=a==="end"?g*-1:g),c?{x:m*d,y:p*u}:{x:p*u,y:m*d}}const Cv=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 xv(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}}}}},Ov=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:h=>{let{x,y}=h;return{x,y}}},...c}=hi(e,t),u={x:n,y:r},d=await Hu(t,c),f=Lr(lr(o)),p=qu(f);let m=u[p],g=u[f];if(i){const h=p==="y"?"top":"left",x=p==="y"?"bottom":"right",y=m+d[h],b=m-d[x];m=_s(y,m,b)}if(s){const h=f==="y"?"top":"left",x=f==="y"?"bottom":"right",y=g+d[h],b=g-d[x];g=_s(y,g,b)}const w=a.fn({...t,[p]:m,[f]:g});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[p]:i,[f]:s}}}}}};function wo(){return typeof window<"u"}function Wr(e){return Bu(e)?(e.nodeName||"").toLowerCase():"#document"}function It(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Xt(e){var t;return(t=(Bu(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Bu(e){return wo()?e instanceof Node||e instanceof It(e).Node:!1}function qt(e){return wo()?e instanceof Element||e instanceof It(e).Element:!1}function Qt(e){return wo()?e instanceof HTMLElement||e instanceof It(e).HTMLElement:!1}function vc(e){return!wo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof It(e).ShadowRoot}function gi(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Ut(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function Ev(e){return["table","td","th"].includes(Wr(e))}function Io(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function ca(e){const t=la(),n=qt(e)?Ut(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 Sv(e){let t=Fn(e);for(;Qt(t)&&!Vr(t);){if(ca(t))return t;if(Io(t))return null;t=Fn(t)}return null}function la(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Vr(e){return["html","body","#document"].includes(Wr(e))}function Ut(e){return It(e).getComputedStyle(e)}function bo(e){return qt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Fn(e){if(Wr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||vc(e)&&e.host||Xt(e);return vc(t)?t.host:t}function Wu(e){const t=Fn(e);return Vr(t)?e.ownerDocument?e.ownerDocument.body:e.body:Qt(t)&&gi(t)?t:Wu(t)}function ai(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Wu(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=It(o);if(i){const a=Cs(s);return t.concat(s,s.visualViewport||[],gi(o)?o:[],a&&n?ai(a):[])}return t.concat(o,ai(o,[],n))}function Cs(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ju(e){const t=Ut(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Qt(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=io(n)!==i||io(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function ua(e){return qt(e)?e:e.contextElement}function vr(e){const t=ua(e);if(!Qt(t))return Mn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Ju(t);let s=(i?io(n.width):n.width)/r,a=(i?io(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const Nv=Mn(0);function zu(e){const t=It(e);return!la()||!t.visualViewport?Nv:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Tv(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==It(e)?!1:t}function ur(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=ua(e);let s=Mn(1);t&&(r?qt(r)&&(s=vr(r)):s=vr(e));const a=Tv(i,n,r)?zu(i):Mn(0);let c=(o.left+a.x)/s.x,u=(o.top+a.y)/s.y,d=o.width/s.x,f=o.height/s.y;if(i){const p=It(i),m=r&&qt(r)?It(r):r;let g=p,w=Cs(g);for(;w&&r&&m!==g;){const h=vr(w),x=w.getBoundingClientRect(),y=Ut(w),b=x.left+(w.clientLeft+parseFloat(y.paddingLeft))*h.x,C=x.top+(w.clientTop+parseFloat(y.paddingTop))*h.y;c*=h.x,u*=h.y,d*=h.x,f*=h.y,c+=b,u+=C,g=It(w),w=Cs(g)}}return so({width:d,height:f,x:c,y:u})}function Rv(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=Xt(r),a=t?Io(t.floating):!1;if(r===s||a&&i)return n;let c={scrollLeft:0,scrollTop:0},u=Mn(1);const d=Mn(0),f=Qt(r);if((f||!f&&!i)&&((Wr(r)!=="body"||gi(s))&&(c=bo(r)),Qt(r))){const p=ur(r);u=vr(r),d.x=p.x+r.clientLeft,d.y=p.y+r.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x,y:n.y*u.y-c.scrollTop*u.y+d.y}}function Av(e){return Array.from(e.getClientRects())}function Os(e,t){const n=bo(e).scrollLeft;return t?t.left+n:ur(Xt(e)).left+n}function Pv(e){const t=Xt(e),n=bo(e),r=e.ownerDocument.body,o=nr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=nr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Os(e);const a=-n.scrollTop;return Ut(r).direction==="rtl"&&(s+=nr(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function Dv(e,t){const n=It(e),r=Xt(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,c=0;if(o){i=o.width,s=o.height;const u=la();(!u||u&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}return{width:i,height:s,x:a,y:c}}function Mv(e,t){const n=ur(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Qt(e)?vr(e):Mn(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,c=o*i.x,u=r*i.y;return{width:s,height:a,x:c,y:u}}function wc(e,t,n){let r;if(t==="viewport")r=Dv(e,n);else if(t==="document")r=Pv(Xt(e));else if(qt(t))r=Mv(t,n);else{const o=zu(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return so(r)}function Gu(e,t){const n=Fn(e);return n===t||!qt(n)||Vr(n)?!1:Ut(n).position==="fixed"||Gu(n,t)}function Fv(e,t){const n=t.get(e);if(n)return n;let r=ai(e,[],!1).filter(a=>qt(a)&&Wr(a)!=="body"),o=null;const i=Ut(e).position==="fixed";let s=i?Fn(e):e;for(;qt(s)&&!Vr(s);){const a=Ut(s),c=ca(s);!c&&a.position==="fixed"&&(o=null),(i?!c&&!o:!c&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||gi(s)&&!c&&Gu(e,s))?r=r.filter(d=>d!==s):o=a,s=Fn(s)}return t.set(e,r),r}function kv(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?Io(t)?[]:Fv(t,this._c):[].concat(n),r],a=s[0],c=s.reduce((u,d)=>{const f=wc(t,d,o);return u.top=nr(f.top,u.top),u.right=jr(f.right,u.right),u.bottom=jr(f.bottom,u.bottom),u.left=nr(f.left,u.left),u},wc(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function jv(e){const{width:t,height:n}=Ju(e);return{width:t,height:n}}function Lv(e,t,n){const r=Qt(t),o=Xt(t),i=n==="fixed",s=ur(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=Mn(0);if(r||!r&&!i)if((Wr(t)!=="body"||gi(o))&&(a=bo(t)),r){const m=ur(t,!0,i,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}else o&&(c.x=Os(o));let u=0,d=0;if(o&&!r&&!i){const m=o.getBoundingClientRect();d=m.top+a.scrollTop,u=m.left+a.scrollLeft-Os(o,m)}const f=s.left+a.scrollLeft-c.x-u,p=s.top+a.scrollTop-c.y-d;return{x:f,y:p,width:s.width,height:s.height}}function Ho(e){return Ut(e).position==="static"}function Ic(e,t){if(!Qt(e)||Ut(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Xt(e)===n&&(n=n.ownerDocument.body),n}function Qu(e,t){const n=It(e);if(Io(e))return n;if(!Qt(e)){let o=Fn(e);for(;o&&!Vr(o);){if(qt(o)&&!Ho(o))return o;o=Fn(o)}return n}let r=Ic(e,t);for(;r&&Ev(r)&&Ho(r);)r=Ic(r,t);return r&&Vr(r)&&Ho(r)&&!ca(r)?n:r||Sv(e)||n}const Vv=async function(e){const t=this.getOffsetParent||Qu,n=this.getDimensions,r=await n(e.floating);return{reference:Lv(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Kv(e){return Ut(e).direction==="rtl"}const $v={convertOffsetParentRelativeRectToViewportRelativeRect:Rv,getDocumentElement:Xt,getClippingRect:kv,getOffsetParent:Qu,getElementRects:Vv,getClientRects:Av,getDimensions:jv,getScale:vr,isElement:qt,isRTL:Kv};function qv(e,t){let n=null,r;const o=Xt(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:u,top:d,width:f,height:p}=e.getBoundingClientRect();if(a||t(),!f||!p)return;const m=Li(d),g=Li(o.clientWidth-(u+f)),w=Li(o.clientHeight-(d+p)),h=Li(u),y={rootMargin:-m+"px "+-g+"px "+-w+"px "+-h+"px",threshold:nr(0,jr(1,c))||1};let b=!0;function C(_){const S=_[0].intersectionRatio;if(S!==c){if(!b)return s();S?s(!1,S):r=setTimeout(()=>{s(!1,1e-7)},1e3)}b=!1}try{n=new IntersectionObserver(C,{...y,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,y)}n.observe(e)}return s(!0),i}function Uv(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,u=ua(e),d=o||i?[...u?ai(u):[],...ai(t)]:[];d.forEach(x=>{o&&x.addEventListener("scroll",n,{passive:!0}),i&&x.addEventListener("resize",n)});const f=u&&a?qv(u,n):null;let p=-1,m=null;s&&(m=new ResizeObserver(x=>{let[y]=x;y&&y.target===u&&m&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var b;(b=m)==null||b.observe(t)})),n()}),u&&!c&&m.observe(u),m.observe(t));let g,w=c?ur(e):null;c&&h();function h(){const x=ur(e);w&&(x.x!==w.x||x.y!==w.y||x.width!==w.width||x.height!==w.height)&&n(),w=x,g=requestAnimationFrame(h)}return n(),()=>{var x;d.forEach(y=>{o&&y.removeEventListener("scroll",n),i&&y.removeEventListener("resize",n)}),f==null||f(),(x=m)==null||x.disconnect(),m=null,c&&cancelAnimationFrame(g)}}const Hv=Cv,Bv=Ov,Wv=_v,Jv=bv,bc=(e,t,n)=>{const r=new Map,o={platform:$v,...n},i={...o.platform,_c:r};return Iv(e,t,{...o,platform:i})};/*
44
44
  * React Tooltip
45
45
  * {@link https://github.com/ReactTooltip/react-tooltip}
46
46
  * @copyright ReactTooltip Team
47
47
  * @license MIT
48
- */const Fv="react-tooltip-core-styles",Mv="react-tooltip-base-styles",pc={core:!1,base:!1};function hc({css:e,id:t=Mv,type:n="base",ref:r}){var o,i;if(!e||typeof document>"u"||pc[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=Fv),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)),pc[n]=!0}const mc=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10,strategy:i="absolute",middlewares:s=[Rv(Number(o)),Pv({fallbackAxisSideDirection:"start"}),Av({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(Dv({element:n,padding:5})),fc(e,t,{placement:r,strategy:i,middleware:c}).then(({x:u,y:d,placement:f,middlewareData:m})=>{var p,g;const y={left:`${u}px`,top:`${d}px`,border:a},{x:h,y:_}=(p=m.arrow)!==null&&p!==void 0?p:{x:0,y:0},v=(g={top:"bottom",right:"left",bottom:"top",left:"right"}[f.split("-")[0]])!==null&&g!==void 0?g:"bottom",x=a&&{borderBottom:a,borderRight:a};let C=0;if(a){const b=`${a}`.match(/(\d+)px/);C=b!=null&&b[1]?Number(b[1]):1}return{tooltipStyles:y,tooltipArrowStyles:{left:h!=null?`${h}px`:"",top:_!=null?`${_}px`:"",right:"",bottom:"",...x,[v]:`-${4+C}px`},place:f}})):fc(e,t,{placement:"bottom",strategy:i,middleware:c}).then(({x:u,y:d,placement:f})=>({tooltipStyles:{left:`${u}px`,top:`${d}px`},tooltipArrowStyles:{},place:f}))},gc=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),yc=(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},vc=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",ys=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((o,i)=>ys(o,t[i]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!vc(e)||!vc(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(o=>ys(e[o],t[o]))},jv=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"})},wc=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(jv(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},kv=typeof window<"u"?w.useLayoutEffect:w.useEffect,St=e=>{e.current&&(clearTimeout(e.current),e.current=null)},Lv="DEFAULT_TOOLTIP_ID",Kv={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},Vv=w.createContext({getTooltipData:()=>Kv});function Lu(e=Lv){return w.useContext(Vv).getTooltipData(e)}var sr={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"},ko={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 $v=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:o="dark",anchorId:i,anchorSelect:s,place:a="top",offset:c=10,events:u=["hover"],openOnClick:d=!1,positionStrategy:f="absolute",middlewares:m,wrapper:p,delayShow:g=0,delayHide:y=0,float:h=!1,hidden:_=!1,noArrow:v=!1,clickable:x=!1,closeOnEsc:C=!1,closeOnScroll:b=!1,closeOnResize:N=!1,openEvents:R,closeEvents:S,globalCloseEvents:F,imperativeModeOnly:q,style:z,position:J,afterShow:ne,afterHide:B,disableTooltip:ce,content:re,contentWrapperRef:X,isOpen:fe,defaultIsOpen:ve=!1,setIsOpen:T,activeAnchor:j,setActiveAnchor:V,border:L,opacity:k,arrowColor:D,role:Z="tooltip"})=>{var ee;const U=w.useRef(null),te=w.useRef(null),G=w.useRef(null),ue=w.useRef(null),M=w.useRef(null),[we,H]=w.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[Ee,Le]=w.useState(!1),[ze,Ve]=w.useState(!1),[Ie,Rt]=w.useState(null),Ge=w.useRef(!1),mt=w.useRef(null),{anchorRefs:At,setActiveAnchor:Pt}=Lu(t),Qe=w.useRef(!1),[Be,$e]=w.useState([]),Ae=w.useRef(!1),Dt=d||u.includes("click"),nt=Dt||(R==null?void 0:R.click)||(R==null?void 0:R.dblclick)||(R==null?void 0:R.mousedown),Zt=R?{...R}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!R&&Dt&&Object.assign(Zt,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const fn=S?{...S}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!S&&Dt&&Object.assign(fn,{mouseleave:!1,blur:!1,mouseout:!1});const gt=F?{...F}:{escape:C||!1,scroll:b||!1,resize:N||!1,clickOutsideAnchor:nt||!1};q&&(Object.assign(Zt,{mouseenter:!1,focus:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(fn,{mouseleave:!1,blur:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(gt,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),kv(()=>(Ae.current=!0,()=>{Ae.current=!1}),[]);const Pe=W=>{Ae.current&&(W&&Ve(!0),setTimeout(()=>{Ae.current&&(T==null||T(W),fe===void 0&&Le(W))},10))};w.useEffect(()=>{if(fe===void 0)return()=>null;fe&&Ve(!0);const W=setTimeout(()=>{Le(fe)},10);return()=>{clearTimeout(W)}},[fe]),w.useEffect(()=>{if(Ee!==Ge.current)if(St(M),Ge.current=Ee,Ee)ne==null||ne();else{const W=(oe=>{const le=oe.match(/^([\d.]+)(ms|s)$/);if(!le)return 0;const[,ke,Ue]=le;return Number(ke)*(Ue==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));M.current=setTimeout(()=>{Ve(!1),Rt(null),B==null||B()},W+25)}},[Ee]);const en=W=>{H(oe=>ys(oe,W)?oe:W)},pn=(W=g)=>{St(G),ze?Pe(!0):G.current=setTimeout(()=>{Pe(!0)},W)},tn=(W=y)=>{St(ue),ue.current=setTimeout(()=>{Qe.current||Pe(!1)},W)},Mn=W=>{var oe;if(!W)return;const le=(oe=W.currentTarget)!==null&&oe!==void 0?oe:W.target;if(!(le!=null&&le.isConnected))return V(null),void Pt({current:null});g?pn():Pe(!0),V(le),Pt({current:le}),St(ue)},ut=()=>{x?tn(y||100):y?tn():Pe(!1),St(G)},nn=({x:W,y:oe})=>{var le;const ke={getBoundingClientRect:()=>({x:W,y:oe,width:0,height:0,top:oe,left:W,right:W,bottom:oe})};mc({place:(le=Ie==null?void 0:Ie.place)!==null&&le!==void 0?le:a,offset:c,elementReference:ke,tooltipReference:U.current,tooltipArrowReference:te.current,strategy:f,middlewares:m,border:L}).then(Ue=>{en(Ue)})},hn=W=>{if(!W)return;const oe=W,le={x:oe.clientX,y:oe.clientY};nn(le),mt.current=le},jn=W=>{var oe;if(!Ee)return;const le=W.target;le.isConnected&&(!((oe=U.current)===null||oe===void 0)&&oe.contains(le)||[document.querySelector(`[id='${i}']`),...Be].some(ke=>ke==null?void 0:ke.contains(le))||(Pe(!1),St(G)))},mn=yc(Mn,50),Re=yc(ut,50),rt=W=>{Re.cancel(),mn(W)},ie=()=>{mn.cancel(),Re()},he=w.useCallback(()=>{var W,oe;const le=(W=Ie==null?void 0:Ie.position)!==null&&W!==void 0?W:J;le?nn(le):h?mt.current&&nn(mt.current):j!=null&&j.isConnected&&mc({place:(oe=Ie==null?void 0:Ie.place)!==null&&oe!==void 0?oe:a,offset:c,elementReference:j,tooltipReference:U.current,tooltipArrowReference:te.current,strategy:f,middlewares:m,border:L}).then(ke=>{Ae.current&&en(ke)})},[Ee,j,re,z,a,Ie==null?void 0:Ie.place,c,f,J,Ie==null?void 0:Ie.position,h]);w.useEffect(()=>{var W,oe;const le=new Set(At);Be.forEach(Se=>{ce!=null&&ce(Se)||le.add({current:Se})});const ke=document.querySelector(`[id='${i}']`);ke&&!(ce!=null&&ce(ke))&&le.add({current:ke});const Ue=()=>{Pe(!1)},dt=wc(j),We=wc(U.current);gt.scroll&&(window.addEventListener("scroll",Ue),dt==null||dt.addEventListener("scroll",Ue),We==null||We.addEventListener("scroll",Ue));let Xe=null;gt.resize?window.addEventListener("resize",Ue):j&&U.current&&(Xe=Tv(j,U.current,he,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const ft=Se=>{Se.key==="Escape"&&Pe(!1)};gt.escape&&window.addEventListener("keydown",ft),gt.clickOutsideAnchor&&window.addEventListener("click",jn);const Ne=[],kn=Se=>{Ee&&(Se==null?void 0:Se.target)===j||Mn(Se)},wo=Se=>{Ee&&(Se==null?void 0:Se.target)===j&&ut()},Ct=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],hi=["click","dblclick","mousedown","mouseup"];Object.entries(Zt).forEach(([Se,Ft])=>{Ft&&(Ct.includes(Se)?Ne.push({event:Se,listener:rt}):hi.includes(Se)&&Ne.push({event:Se,listener:kn}))}),Object.entries(fn).forEach(([Se,Ft])=>{Ft&&(Ct.includes(Se)?Ne.push({event:Se,listener:ie}):hi.includes(Se)&&Ne.push({event:Se,listener:wo}))}),h&&Ne.push({event:"pointermove",listener:hn});const mi=()=>{Qe.current=!0},gi=()=>{Qe.current=!1,ut()};return x&&!nt&&((W=U.current)===null||W===void 0||W.addEventListener("mouseenter",mi),(oe=U.current)===null||oe===void 0||oe.addEventListener("mouseleave",gi)),Ne.forEach(({event:Se,listener:Ft})=>{le.forEach(Mt=>{var Ln;(Ln=Mt.current)===null||Ln===void 0||Ln.addEventListener(Se,Ft)})}),()=>{var Se,Ft;gt.scroll&&(window.removeEventListener("scroll",Ue),dt==null||dt.removeEventListener("scroll",Ue),We==null||We.removeEventListener("scroll",Ue)),gt.resize?window.removeEventListener("resize",Ue):Xe==null||Xe(),gt.clickOutsideAnchor&&window.removeEventListener("click",jn),gt.escape&&window.removeEventListener("keydown",ft),x&&!nt&&((Se=U.current)===null||Se===void 0||Se.removeEventListener("mouseenter",mi),(Ft=U.current)===null||Ft===void 0||Ft.removeEventListener("mouseleave",gi)),Ne.forEach(({event:Mt,listener:Ln})=>{le.forEach(Io=>{var Lr;(Lr=Io.current)===null||Lr===void 0||Lr.removeEventListener(Mt,Ln)})})}},[j,he,ze,At,Be,R,S,F,Dt,g,y]),w.useEffect(()=>{var W,oe;let le=(oe=(W=Ie==null?void 0:Ie.anchorSelect)!==null&&W!==void 0?W:s)!==null&&oe!==void 0?oe:"";!le&&t&&(le=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const ke=new MutationObserver(Ue=>{const dt=[],We=[];Ue.forEach(Xe=>{if(Xe.type==="attributes"&&Xe.attributeName==="data-tooltip-id"&&(Xe.target.getAttribute("data-tooltip-id")===t?dt.push(Xe.target):Xe.oldValue===t&&We.push(Xe.target)),Xe.type==="childList"){if(j){const ft=[...Xe.removedNodes].filter(Ne=>Ne.nodeType===1);if(le)try{We.push(...ft.filter(Ne=>Ne.matches(le))),We.push(...ft.flatMap(Ne=>[...Ne.querySelectorAll(le)]))}catch{}ft.some(Ne=>{var kn;return!!(!((kn=Ne==null?void 0:Ne.contains)===null||kn===void 0)&&kn.call(Ne,j))&&(Ve(!1),Pe(!1),V(null),St(G),St(ue),!0)})}if(le)try{const ft=[...Xe.addedNodes].filter(Ne=>Ne.nodeType===1);dt.push(...ft.filter(Ne=>Ne.matches(le))),dt.push(...ft.flatMap(Ne=>[...Ne.querySelectorAll(le)]))}catch{}}}),(dt.length||We.length)&&$e(Xe=>[...Xe.filter(ft=>!We.includes(ft)),...dt])});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,j]),w.useEffect(()=>{he()},[he]),w.useEffect(()=>{if(!(X!=null&&X.current))return()=>null;const W=new ResizeObserver(()=>{setTimeout(()=>he())});return W.observe(X.current),()=>{W.disconnect()}},[re,X==null?void 0:X.current]),w.useEffect(()=>{var W;const oe=document.querySelector(`[id='${i}']`),le=[...Be,oe];j&&le.includes(j)||V((W=Be[0])!==null&&W!==void 0?W:oe)},[i,Be,j]),w.useEffect(()=>(ve&&Pe(!0),()=>{St(G),St(ue)}),[]),w.useEffect(()=>{var W;let oe=(W=Ie==null?void 0:Ie.anchorSelect)!==null&&W!==void 0?W:s;if(!oe&&t&&(oe=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),oe)try{const le=Array.from(document.querySelectorAll(oe));$e(le)}catch{$e([])}},[t,s,Ie==null?void 0:Ie.anchorSelect]),w.useEffect(()=>{G.current&&(St(G),pn(g))},[g]);const qe=(ee=Ie==null?void 0:Ie.content)!==null&&ee!==void 0?ee:re,rn=Ee&&Object.keys(we.tooltipStyles).length>0;return w.useImperativeHandle(e,()=>({open:W=>{if(W!=null&&W.anchorSelect)try{document.querySelector(W.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${W.anchorSelect}" is not a valid CSS selector`)}Rt(W??null),W!=null&&W.delay?pn(W.delay):Pe(!0)},close:W=>{W!=null&&W.delay?tn(W.delay):Pe(!1)},activeAnchor:j,place:we.place,isOpen:!!(ze&&!_&&qe&&rn)})),ze&&!_&&qe?w.createElement(p,{id:t,role:Z,className:wt("react-tooltip",sr.tooltip,ko.tooltip,ko[o],n,`react-tooltip__place-${we.place}`,sr[rn?"show":"closing"],rn?"react-tooltip__show":"react-tooltip__closing",f==="fixed"&&sr.fixed,x&&sr.clickable),onTransitionEnd:W=>{St(M),Ee||W.propertyName!=="opacity"||(Ve(!1),Rt(null),B==null||B())},style:{...z,...we.tooltipStyles,opacity:k!==void 0&&rn?k:void 0},ref:U},qe,w.createElement(p,{className:wt("react-tooltip-arrow",sr.arrow,ko.arrow,r,v&&sr.noArrow),style:{...we.tooltipArrowStyles,background:D?`linear-gradient(to right bottom, transparent 50%, ${D} 50%)`:void 0},ref:te})):null},qv=({content:e})=>w.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),Uv=w.forwardRef(({id:e,anchorId:t,anchorSelect:n,content:r,html:o,render:i,className:s,classNameArrow:a,variant:c="dark",place:u="top",offset:d=10,wrapper:f="div",children:m=null,events:p=["hover"],openOnClick:g=!1,positionStrategy:y="absolute",middlewares:h,delayShow:_=0,delayHide:v=0,float:x=!1,hidden:C=!1,noArrow:b=!1,clickable:N=!1,closeOnEsc:R=!1,closeOnScroll:S=!1,closeOnResize:F=!1,openEvents:q,closeEvents:z,globalCloseEvents:J,imperativeModeOnly:ne=!1,style:B,position:ce,isOpen:re,defaultIsOpen:X=!1,disableStyleInjection:fe=!1,border:ve,opacity:T,arrowColor:j,setIsOpen:V,afterShow:L,afterHide:k,disableTooltip:D,role:Z="tooltip"},ee)=>{const[U,te]=w.useState(r),[G,ue]=w.useState(o),[M,we]=w.useState(u),[H,Ee]=w.useState(c),[Le,ze]=w.useState(d),[Ve,Ie]=w.useState(_),[Rt,Ge]=w.useState(v),[mt,At]=w.useState(x),[Pt,Qe]=w.useState(C),[Be,$e]=w.useState(f),[Ae,Dt]=w.useState(p),[nt,Zt]=w.useState(y),[fn,gt]=w.useState(null),[Pe,en]=w.useState(null),pn=w.useRef(fe),{anchorRefs:tn,activeAnchor:Mn}=Lu(e),ut=Re=>Re==null?void 0:Re.getAttributeNames().reduce((rt,ie)=>{var he;return ie.startsWith("data-tooltip-")&&(rt[ie.replace(/^data-tooltip-/,"")]=(he=Re==null?void 0:Re.getAttribute(ie))!==null&&he!==void 0?he:null),rt},{}),nn=Re=>{const rt={place:ie=>{var he;we((he=ie)!==null&&he!==void 0?he:u)},content:ie=>{te(ie??r)},html:ie=>{ue(ie??o)},variant:ie=>{var he;Ee((he=ie)!==null&&he!==void 0?he:c)},offset:ie=>{ze(ie===null?d:Number(ie))},wrapper:ie=>{var he;$e((he=ie)!==null&&he!==void 0?he:f)},events:ie=>{const he=ie==null?void 0:ie.split(" ");Dt(he??p)},"position-strategy":ie=>{var he;Zt((he=ie)!==null&&he!==void 0?he:y)},"delay-show":ie=>{Ie(ie===null?_:Number(ie))},"delay-hide":ie=>{Ge(ie===null?v:Number(ie))},float:ie=>{At(ie===null?x:ie==="true")},hidden:ie=>{Qe(ie===null?C:ie==="true")},"class-name":ie=>{gt(ie)}};Object.values(rt).forEach(ie=>ie(null)),Object.entries(Re).forEach(([ie,he])=>{var qe;(qe=rt[ie])===null||qe===void 0||qe.call(rt,he)})};w.useEffect(()=>{te(r)},[r]),w.useEffect(()=>{ue(o)},[o]),w.useEffect(()=>{we(u)},[u]),w.useEffect(()=>{Ee(c)},[c]),w.useEffect(()=>{ze(d)},[d]),w.useEffect(()=>{Ie(_)},[_]),w.useEffect(()=>{Ge(v)},[v]),w.useEffect(()=>{At(x)},[x]),w.useEffect(()=>{Qe(C)},[C]),w.useEffect(()=>{Zt(y)},[y]),w.useEffect(()=>{pn.current!==fe&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")},[fe]),w.useEffect(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:fe==="core",disableBase:fe}}))},[]),w.useEffect(()=>{var Re;const rt=new Set(tn);let ie=n;if(!ie&&e&&(ie=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),ie)try{document.querySelectorAll(ie).forEach(oe=>{rt.add({current:oe})})}catch{console.warn(`[react-tooltip] "${ie}" is not a valid CSS selector`)}const he=document.querySelector(`[id='${t}']`);if(he&&rt.add({current:he}),!rt.size)return()=>null;const qe=(Re=Pe??he)!==null&&Re!==void 0?Re:Mn.current,rn=new MutationObserver(oe=>{oe.forEach(le=>{var ke;if(!qe||le.type!=="attributes"||!(!((ke=le.attributeName)===null||ke===void 0)&&ke.startsWith("data-tooltip-")))return;const Ue=ut(qe);nn(Ue)})}),W={attributes:!0,childList:!1,subtree:!1};if(qe){const oe=ut(qe);nn(oe),rn.observe(qe,W)}return()=>{rn.disconnect()}},[tn,Mn,Pe,t,n]),w.useEffect(()=>{B!=null&&B.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),ve&&!gc("border",`${ve}`)&&console.warn(`[react-tooltip] "${ve}" is not a valid \`border\`.`),B!=null&&B.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),T&&!gc("opacity",`${T}`)&&console.warn(`[react-tooltip] "${T}" is not a valid \`opacity\`.`)},[]);let hn=m;const jn=w.useRef(null);if(i){const Re=i({content:(Pe==null?void 0:Pe.getAttribute("data-tooltip-content"))||U||null,activeAnchor:Pe});hn=Re?w.createElement("div",{ref:jn,className:"react-tooltip-content-wrapper"},Re):null}else U&&(hn=U);G&&(hn=w.createElement(qv,{content:G}));const mn={forwardRef:ee,id:e,anchorId:t,anchorSelect:n,className:wt(s,fn),classNameArrow:a,content:hn,contentWrapperRef:jn,place:M,variant:H,offset:Le,wrapper:Be,events:Ae,openOnClick:g,positionStrategy:nt,middlewares:h,delayShow:Ve,delayHide:Rt,float:mt,hidden:Pt,noArrow:b,clickable:N,closeOnEsc:R,closeOnScroll:S,closeOnResize:F,openEvents:q,closeEvents:z,globalCloseEvents:J,imperativeModeOnly:ne,style:B,position:ce,isOpen:re,defaultIsOpen:X,border:ve,opacity:T,arrowColor:j,setIsOpen:V,afterShow:L,afterHide:k,disableTooltip:D,activeAnchor:Pe,setActiveAnchor:Re=>en(Re),role:Z};return w.createElement($v,{...mn})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||hc({css:":root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9;--rt-transition-show-delay:0.15s;--rt-transition-closing-delay:0.15s}.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||hc({css:`
49
- .styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:8px;height:8px}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:"base"})});function Hv(){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 Bv({id:e,tooltipText:t}){return l.jsxs(l.Fragment,{children:[l.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:Hv()}),l.jsx(Uv,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}function ho({field:e,onSelectChange:t,allFields:n}){var p;const{configureState:r,selectedObjectName:o,setConfigureState:i}=xt(),[s,a]=w.useState(!0),c=(p=r==null?void 0:r.read)==null?void 0:p.selectedFieldMappings,u=c==null?void 0:c[e.mapToName];w.useEffect(()=>{e._default&&!u&&o&&r&&Yr(o,i,[{field:e.mapToName,value:e._default}]),a(!1)},[e,i,o,u,r]);const d=w.useMemo(()=>n.map(g=>({id:g.fieldName,label:g.displayName,value:g.fieldName})),[n]),f=l.jsx(Qs,{disabled:s,items:d,selectedValue:u||null,onSelectedItemChange:g=>{t({target:{name:e.mapToName,value:g==null?void 0:g.value}})},placeholder:"Please select one",style:{width:"100%"}}),m=w.useCallback(()=>{o&&Yr(o,i,[{field:e.mapToName,value:null}])},[e.mapToName,o,i]);return 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}),l.jsx("span",{children:(e==null?void 0:e.prompt)&&l.jsx(Bv,{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:[f,l.jsx(at,{type:"button",variant:"ghost",onClick:m,children:"clear"})]})]},e.mapToName)}const Wv="_formControl_9qd8d_1",Jv="_formLabel_9qd8d_5",zv="_formLabelRequired_9qd8d_11",Gv="_formInput_9qd8d_16",Qv="_formInputInvalid_9qd8d_20",Xv="_formError_9qd8d_24",Yv="_disabled_9qd8d_30",$n={formControl:Wv,formLabel:Jv,formLabelRequired:zv,formInput:Gv,formInputInvalid:Qv,formError:Xv,disabled:Yv};function mo({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:o=!1,errorMessage:i,children:s}){return l.jsxs("div",{className:wt($n.formControl,{[$n.disabled]:r}),children:[t&&l.jsx("label",{htmlFor:e,className:wt($n.formLabel,{[$n.formLabelRequired]:n}),children:t}),l.jsx("div",{id:e,className:wt($n.formInput,{[$n.formInputInvalid]:o}),children:s}),o&&i&&l.jsx("div",{className:$n.formError,role:"alert",children:i})]})}const Zv="_divider_1kmoj_1",Ic={divider:Zv};function go({className:e,style:t}){return l.jsx("hr",{className:e?`${Ic.divider} ${e}`:Ic.divider,style:t})}function kr({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(go,{style:{width:"100%",marginLeft:"1rem"}})})]})}function ew({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(mo,{id:r.mapToName,children:l.jsx(ho,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function tw(){var m;const{selectedObjectName:e,configureState:t,setConfigureState:n}=xt(),{isError:r,removeError:o}=Ht(),i=((m=t==null?void 0:t.read)==null?void 0:m.allFields)||[],{fieldMapping:s}=tt(),a=p=>{const{value:g,name:y}=p.target;g&&(e&&Yr(e,n,[{field:y,value:g}]),r(ye.MAPPING,y)&&o(ye.MAPPING,y))},c=w.useMemo(()=>!e||!s?[]:Object.values(s[e]||{}).flat().filter(p=>!p.fieldName),[s,e]),u=w.useMemo(()=>{var y;return(((y=t==null?void 0:t.read)==null?void 0:y.optionalMapFields)||[]).filter(h=>!c.some(_=>_.mapToName===h.mapToName))},[t,c]),d=c.length>0;return u.length>0||d?l.jsxs(l.Fragment,{children:[l.jsx(kr,{string:"Map the following optional fields"}),l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:[u==null?void 0:u.map(p=>l.jsx(mo,{id:p.mapToName,children:l.jsx(ho,{allFields:i,field:p,onSelectChange:a})},p.mapToName)),d&&l.jsx(ew,{dynamicFieldMappings:c,onSelectChange:a,allFields:i})]})]}):null}function nw(){const{selectedObjectName:e,configureState:t,setConfigureState:n}=xt(),{isError:r,removeError:o}=Ht(),i=a=>{const{value:c,name:u}=a.target;c&&(e&&Yr(e,n,[{field:u,value:c}]),r(ye.MAPPING,u)&&o(ye.MAPPING,u))},s=w.useMemo(()=>{var a;return((a=t==null?void 0:t.read)==null?void 0:a.requiredMapFields)||[]},[t]);return s!=null&&s.length?l.jsxs(l.Fragment,{children:[l.jsx(kr,{string:"Map the following fields"}),l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:s.map(a=>{var c;return l.jsx(mo,{id:a.mapToName,isInvalid:r(ye.MAPPING,a.mapToName),errorMessage:"* required",children:l.jsx(ho,{allFields:((c=t==null?void 0:t.read)==null?void 0:c.allFields)||[],field:a,onSelectChange:i})},a.mapToName)})})]}):null}const rw={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function iw({children:e,style:t}){return l.jsx(Pn,{style:{...rw,...t},children:e})}function ow(){var d,f,m;const{project:e}=je(),{hydratedRevision:t}=dn(),{selectedObjectName:n}=xt(),{provider:r}=tt(),o=e==null?void 0:e.appName,i=Dn(r),s=(m=(f=(d=t==null?void 0:t.content)==null?void 0:d.read)==null?void 0:f.objects)==null?void 0:m.find(p=>p.objectName===n),a=(s==null?void 0:s.displayName)||n&&Gr(n),c=s==null?void 0:s.mapToName,u=(s==null?void 0:s.mapToDisplayName)||c&&Gr(c);return u&&o&&i?l.jsx(iw,{style:{marginTop:"1rem"},children:l.jsxs("p",{style:{margin:"1rem 0"},children:[l.jsx("b",{children:u})," in ",o," is mapped to ",l.jsx("b",{children:a})," in ",i,"."]})}):null}function bc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ku(...e){return t=>{let n=!1;const r=e.map(o=>{const i=bc(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():bc(e[o],null)}}}}function ei(...e){return $.useCallback(Ku(...e),e)}function yo(e,t=[]){let n=[];function r(i,s){const a=$.createContext(s),c=n.length;n=[...n,s];const u=f=>{var _;const{scope:m,children:p,...g}=f,y=((_=m==null?void 0:m[e])==null?void 0:_[c])||a,h=$.useMemo(()=>g,Object.values(g));return l.jsx(y.Provider,{value:h,children:p})};u.displayName=i+"Provider";function d(f,m){var y;const p=((y=m==null?void 0:m[e])==null?void 0:y[c])||a,g=$.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[u,d]}const o=()=>{const i=n.map(s=>$.createContext(s));return function(a){const c=(a==null?void 0:a[e])||i;return $.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return o.scopeName=e,[r,sw(o,...t)]}function sw(...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:u})=>{const f=c(i)[`__scope${u}`];return{...a,...f}},{});return $.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Vt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function na(e){const t=$.useRef(e);return $.useEffect(()=>{t.current=e}),$.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function ra({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=aw({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,a=na(n),c=$.useCallback(u=>{if(i){const f=typeof u=="function"?u(e):u;f!==e&&a(f)}else o(u)},[i,e,o,a]);return[s,c]}function aw({defaultProp:e,onChange:t}){const n=$.useState(e),[r]=n,o=$.useRef(r),i=na(t);return $.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}function cw(e){const t=$.useRef({value:e,previous:e});return $.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Zi=globalThis!=null&&globalThis.document?$.useLayoutEffect:()=>{};function lw(e){const[t,n]=$.useState(void 0);return Zi(()=>{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,u=Array.isArray(c)?c[0]:c;s=u.inlineSize,a=u.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 uw(e,t){return $.useReducer((n,r)=>t[n][r]??n,e)}var ia=e=>{const{present:t,children:n}=e,r=dw(t),o=typeof n=="function"?n({present:r.isPresent}):$.Children.only(n),i=ei(r.ref,fw(o));return typeof n=="function"||r.isPresent?$.cloneElement(o,{ref:i}):null};ia.displayName="Presence";function dw(e){const[t,n]=$.useState(),r=$.useRef({}),o=$.useRef(e),i=$.useRef("none"),s=e?"mounted":"unmounted",[a,c]=uw(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return $.useEffect(()=>{const u=Di(r.current);i.current=a==="mounted"?u:"none"},[a]),Zi(()=>{const u=r.current,d=o.current;if(d!==e){const m=i.current,p=Di(u);e?c("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&m!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),Zi(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=p=>{const y=Di(r.current).includes(p.animationName);if(p.target===t&&y&&(c("ANIMATION_END"),!o.current)){const h=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=h)})}},m=p=>{p.target===t&&(i.current=Di(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:$.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function Di(e){return(e==null?void 0:e.animationName)||"none"}function fw(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 eo=$.forwardRef((e,t)=>{const{children:n,...r}=e,o=$.Children.toArray(n),i=o.find(hw);if(i){const s=i.props.children,a=o.map(c=>c===i?$.Children.count(s)>1?$.Children.only(null):$.isValidElement(s)?s.props.children:null:c);return l.jsx(vs,{...r,ref:t,children:$.isValidElement(s)?$.cloneElement(s,void 0,a):null})}return l.jsx(vs,{...r,ref:t,children:n})});eo.displayName="Slot";var vs=$.forwardRef((e,t)=>{const{children:n,...r}=e;if($.isValidElement(n)){const o=gw(n);return $.cloneElement(n,{...mw(r,n.props),ref:t?Ku(t,o):o})}return $.Children.count(n)>1?$.Children.only(null):null});vs.displayName="SlotClone";var pw=({children:e})=>l.jsx(l.Fragment,{children:e});function hw(e){return $.isValidElement(e)&&e.type===pw}function mw(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)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function gw(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 yw=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Fn=yw.reduce((e,t)=>{const n=$.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?eo:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(a,{...s,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),oa="Checkbox",[vw,Hb]=yo(oa),[ww,Iw]=vw(oa),Vu=$.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:c="on",onCheckedChange:u,form:d,...f}=e,[m,p]=$.useState(null),g=ei(t,C=>p(C)),y=$.useRef(!1),h=m?d||!!m.closest("form"):!0,[_=!1,v]=ra({prop:o,defaultProp:i,onChange:u}),x=$.useRef(_);return $.useEffect(()=>{const C=m==null?void 0:m.form;if(C){const b=()=>v(x.current);return C.addEventListener("reset",b),()=>C.removeEventListener("reset",b)}},[m,v]),l.jsxs(ww,{scope:n,state:_,disabled:a,children:[l.jsx(Fn.button,{type:"button",role:"checkbox","aria-checked":Nn(_)?"mixed":_,"aria-required":s,"data-state":Uu(_),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:g,onKeyDown:Vt(e.onKeyDown,C=>{C.key==="Enter"&&C.preventDefault()}),onClick:Vt(e.onClick,C=>{v(b=>Nn(b)?!0:!b),h&&(y.current=C.isPropagationStopped(),y.current||C.stopPropagation())})}),h&&l.jsx(bw,{control:m,bubbles:!y.current,name:r,value:c,checked:_,required:s,disabled:a,form:d,style:{transform:"translateX(-100%)"},defaultChecked:Nn(i)?!1:i})]})});Vu.displayName=oa;var $u="CheckboxIndicator",qu=$.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=Iw($u,n);return l.jsx(ia,{present:r||Nn(i.state)||i.state===!0,children:l.jsx(Fn.span,{"data-state":Uu(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});qu.displayName=$u;var bw=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:o,...i}=e,s=$.useRef(null),a=cw(n),c=lw(t);$.useEffect(()=>{const d=s.current,f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(a!==n&&p){const g=new Event("click",{bubbles:r});d.indeterminate=Nn(n),p.call(d,Nn(n)?!1:n),d.dispatchEvent(g)}},[a,n,r]);const u=$.useRef(Nn(n)?!1:n);return l.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o??u.current,...i,tabIndex:-1,ref:s,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Nn(e){return e==="indeterminate"}function Uu(e){return Nn(e)?"indeterminate":e?"checked":"unchecked"}var Hu=Vu,Bu=qu;function Wu(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 _w=["color"],Ju=w.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Wu(e,_w);return w.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}),w.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"}))}),xw=["color"],Cw=w.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Wu(e,xw);return w.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}),w.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 Ow="_checkboxGroupContainer_1ya1t_1",Ew="_stack_1ya1t_6",Sw="_selectAllContainer_1ya1t_11",Nw="_fieldContainer_1ya1t_18",Tw="_checkbox_1ya1t_1",Rr={checkboxGroupContainer:Ow,stack:Ew,selectAllContainer:Sw,fieldContainer:Nw,checkbox:Tw};function zu({id:e,isChecked:t,label:n,onCheckedChange:r}){return l.jsxs("div",{className:Rr.fieldContainer,children:[l.jsx(Hu,{className:Rr.checkbox,id:e,onCheckedChange:r,checked:t,children:l.jsx(Bu,{children:l.jsx(Ju,{})})}),l.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function Gu({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:o}){return l.jsxs("div",{className:Rr.selectAllContainer,children:[l.jsx(Hu,{className:Rr.checkbox,id:e,onCheckedChange:r,children:l.jsxs(Bu,{children:[o&&l.jsx(Cw,{}),t===!0&&l.jsx(Ju,{})]})}),l.jsx("label",{htmlFor:e,children:n})]})}function Qu({children:e}){return l.jsx("div",{className:Rr.checkboxGroupContainer,children:e})}function Xu({children:e}){return l.jsx("div",{className:Rr.stack,children:e})}function Rw(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=!Cl(s,r);e.read.isOptionalFieldsModified=c}else console.warn("read.savedConfig.optionalFields is undefined")}function _c(e,t,n,r){t(e,o=>Rw(o,n,r))}function Aw(){var f,m;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=xt(),o=(f=t==null?void 0:t.read)==null?void 0:f.selectedOptionalFields,i=(p,g)=>{p!=="indeterminate"&&r&&t&&_c(r,n,g,p)},s=(m=t==null?void 0:t.read)==null?void 0:m.optionalFields,a=p=>{r&&s&&s.forEach(g=>{Tn(g)||_c(r,n,g.fieldName,p)})},c=!!(s&&s.length>0),u=Object.keys(o||{}).length===(s==null?void 0:s.length),d=!u&&Object.keys(o||{}).length>0;return c&&l.jsxs(l.Fragment,{children:[l.jsx(kr,{string:`${e} reads the following optional fields`}),l.jsxs(Qu,{children:[((s==null?void 0:s.length)||0)>=2&&l.jsx(Gu,{id:"select-all-fields",isChecked:u,label:"Select all",onCheckedChange:a,isIndeterminate:d}),l.jsx(Xu,{children:s.map(p=>Tn(p)?null:l.jsx(zu,{id:p.fieldName,isChecked:!!(o!=null&&o[p==null?void 0:p.fieldName]),label:p.displayName,onCheckedChange:g=>i(g,p.fieldName)},p.fieldName))})]})]})}function Pw(){return l.jsx(Aw,{})}const Dw={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 Fw({children:e,style:t,...n}){return l.jsx("span",{style:{...Dw,...t},...n,children:e})}function Mw(){var r,o,i;const{configureState:e,selectedObjectName:t}=xt(),{appName:n}=je();return l.jsxs(l.Fragment,{children:[l.jsx(kr,{string:`${n} reads the following ${t} fields`}),l.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:(o=(r=e==null?void 0:e.read)==null?void 0:r.requiredFields)!=null&&o.length?(i=e.read)==null?void 0:i.requiredFields.map(s=>Tn(s)?null:l.jsx(Fw,{children:s.displayName},s.fieldName)):"There are no required fields."})]})}function jw(e,t,n,r,o){e.read&&(e.read.selectedValueMappings||(e.read.selectedValueMappings={}),e.read.selectedValueMappings[o]||(e.read.selectedValueMappings[o]={}),e.read.selectedValueMappings[o][n]=r)}function kw(e,t,n,r,o){t(e,i=>jw(i,e,n,r,o))}function Lw(e,t,n){t(e,r=>{r.read&&(r.read.isValueMappingsModified=n)})}function Kw({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(go,{style:{width:"100%",marginLeft:"1rem"}})})]})}function Vw({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r,hasError:o}){var v;const{configureState:i,selectedObjectName:s,setConfigureState:a}=xt(),[c,u]=w.useState(!0),{getError:d,setError:f,resetBoundary:m}=Ht(),p=w.useMemo(()=>{var x,C;return((C=(x=i==null?void 0:i.read)==null?void 0:x.selectedValueMappings)==null?void 0:C[n])||{}},[(v=i==null?void 0:i.read)==null?void 0:v.selectedValueMappings,n]),g=w.useMemo(()=>p==null?void 0:p[e.mappedValue],[p,e.mappedValue]);w.useEffect(()=>{u(!1)},[e,a,s,g,i]);const y=w.useMemo(()=>r.map(x=>({id:x.value,label:x.displayValue,value:x.value})),[r]),h=w.useCallback(x=>{if(x){if(Object.values(p).some(C=>C===x.value&&C!==g)){const C=[...Object.entries(p).filter(([b,N])=>N===x.value&&N!==g).map(([b])=>b),e.mappedValue];f(ye.VALUE_MAPPING,n,C);return}d(ye.VALUE_MAPPING,n)&&m(ye.VALUE_MAPPING),t({target:{name:e.mappedValue,value:x.value,fieldName:n}})}},[t,p,g,n,e.mappedValue,m,f,d]),_=w.useMemo(()=>l.jsx(Qs,{disabled:c,items:y,selectedValue:g||null,onSelectedItemChange:h,placeholder:"Please select one",style:{border:o?"2px solid red":void 0,borderRadius:"8px"}},g),[g,c,y,h,o]);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})}),_]},e.mappedValue)}function $w(){var p,g,y;const{fieldMapping:e}=tt(),{selectedObjectName:t,configureState:n,setConfigureState:r}=xt(),{isError:o,removeError:i,getError:s}=Ht(),a=(p=n==null?void 0:n.read)==null?void 0:p.selectedFieldMappings,c=(g=n==null?void 0:n.read)==null?void 0:g.selectedValueMappings,u=(y=n==null?void 0:n.read)==null?void 0:y.isValueMappingsModified,d=w.useRef(!1),f=w.useMemo(()=>{const h=t&&e?Object.values(e[t]||{}).flat().filter(_=>_.mappedValues).map(_=>({..._})):[];if(a)for(let _=0;_<h.length;_+=1)a!=null&&a[h[_].mapToName]&&(h[_].fieldName=a[h[_].mapToName]);return h},[t,e,a]),m=w.useCallback(h=>{const{value:_,name:v,fieldName:x}=h.target;_&&(t&&kw(t,r,v,_,x),o(ye.VALUE_MAPPING,v)&&i(ye.VALUE_MAPPING,v))},[t,r,o,i]);return w.useEffect(()=>{var h;if(t&&c){const _=((h=e==null?void 0:e[t])==null?void 0:h.filter(x=>x.fieldName&&x.mappedValues.length>0))||[];_.every(x=>{const C=c[x.fieldName]||{};return Object.keys(C).length===Object.keys(x.mappedValues).length})&&_.length>0?!u&&!d.current&&(Lw(t,r,!0),d.current=!0):d.current=!1}},[c,f,t,r,e,u]),f!=null&&f.length?l.jsx(l.Fragment,{children:f.map(h=>{var _,v,x,C,b,N,R,S,F,q,z,J,ne,B,ce,re;return h.fieldName?["singleSelect","multiSelect"].includes((x=(v=(_=n==null?void 0:n.read)==null?void 0:_.allFieldsMetadata)==null?void 0:v[h.fieldName])==null?void 0:x.valueType)?(N=(b=(C=n==null?void 0:n.read)==null?void 0:C.allFieldsMetadata)==null?void 0:b[h.fieldName])!=null&&N.values?(F=(S=(R=n==null?void 0:n.read)==null?void 0:R.allFieldsMetadata)==null?void 0:S[h.fieldName])!=null&&F.values&&Object.keys((h==null?void 0:h.mappedValues)||[]).length===Object.keys(((J=(z=(q=n==null?void 0:n.read)==null?void 0:q.allFieldsMetadata)==null?void 0:z[h.fieldName])==null?void 0:J.values)||[]).length?l.jsxs(l.Fragment,{children:[l.jsx(Kw,{string:"Map the values for ",fieldName:h.mapToName||h.fieldName}),l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:l.jsx(mo,{id:h.mapToName||h.fieldName,children:(re=h==null?void 0:h.mappedValues)==null?void 0:re.map(X=>{var T,j,V;const fe=s(ye.VALUE_MAPPING,h.fieldName),ve=Array.isArray(fe)&&fe.includes(X.mappedValue);return l.jsxs(l.Fragment,{children:[l.jsx(Vw,{allValueOptions:((V=(j=(T=n==null?void 0:n.read)==null?void 0:T.allFieldsMetadata)==null?void 0:j[h.fieldName])==null?void 0:V.values)||[],mappedValue:X,onSelectChange:m,fieldName:(h==null?void 0:h.fieldName)||"",hasError:ve},`${X.mappedValue}-${h.fieldName}`),ve&&l.jsx("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:`Each ${h.mapToName||h.fieldName} must be mapped to a unique value`},X.mappedValue)]})})},h.mapToName||h.fieldName)})]}):(console.error("field values and the values to be mapped are not of the same length",h,(ce=(B=(ne=n==null?void 0:n.read)==null?void 0:ne.allFieldsMetadata)==null?void 0:B[h.fieldName])==null?void 0:ce.values),null):(console.error("field has no values array",h),null):(console.error("fieldName is not a singleSelect or multiSelect",h),null):(console.error("fieldName is undefined",h),null)})}):null}function qw(){return Ug(),l.jsxs(l.Fragment,{children:[l.jsx(ow,{}),l.jsx(Mw,{}),l.jsx(nw,{}),l.jsx(tw,{}),l.jsx($w,{}),l.jsx(Pw,{})]})}const Uw="_input_10rzg_1",Hw="_inputError_10rzg_27",Bw="_error_10rzg_43",Lo={input:Uw,inputError:Hw,error:Bw};function to({id:e,type:t,className:n,isError:r=!1,...o}){const i=r?wt(Lo.inputError,Lo.input):Lo.input;return l.jsx("input",{id:e,type:t,className:wt(i,n),...o})}function Ww({objectName:e,onAddDefaultValue:t}){const{readAction:n,loading:r}=dn(),[o,i]=w.useState(null),[s,a]=w.useState(""),c=n&&Ss(n,e),u=w.useMemo(()=>(c==null?void 0:c.allFields)||[],[c]),d=r||!u||u.length===0,f=w.useMemo(()=>u.map(h=>({id:h.fieldName,label:h.displayName,value:h.fieldName})),[u]),m=h=>{const{value:_,name:v}=h.target;_&&i({label:v,value:_})},p=h=>{const{value:_}=h.target;a(_)},g=()=>{s&&(o!=null&&o.value)&&(t(o==null?void 0:o.value,o.label,s),i(null),a(""))},y=l.jsx(Qs,{style:{width:"100%"},disabled:d,items:f,selectedValue:(o==null?void 0:o.value)||null,onSelectedItemChange:h=>{m({target:{name:h==null?void 0:h.label,value:h==null?void 0:h.value}})},placeholder:"Please select field."});return l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[y,l.jsx(to,{id:"new-default-value",type:"text",value:s,onChange:p,style:{width:"10rem"},placeholder:"default value"}),l.jsx(at,{type:"button",onClick:g,variant:"ghost",children:"+"})]})}function Jw(e,t,n,r){var o,i,s,a;if(((o=e==null?void 0:e.write)==null?void 0:o.selectedWriteObjects)===null&&(e.write.selectedWriteObjects={}),e!=null&&e.write){const c=e.write.selectedWriteObjects;if(r&&(c[t]||(c[t]={}),c[t].selectedValueDefaults||(c[t].selectedValueDefaults={}),c[t].selectedValueDefaults[n]=r),r||(i=c[t])!=null&&i.selectedValueDefaults&&delete c[t].selectedValueDefaults[n],(a=(s=e==null?void 0:e.write)==null?void 0:s.savedConfig)!=null&&a.selectedWriteObjects){const u=e.write.savedConfig.selectedWriteObjects,f=!xl(u,c);e.write.isWriteModified=f}}}function xc(e,t,n,r,o){o(e,i=>{Jw(i,t,n,r)})}const zw=(e,t,n)=>{var i;const r=n&&Ss(n,t),o=r==null?void 0:r.allFieldsMetadata;return((i=o==null?void 0:o[e])==null?void 0:i.displayName)||e};function Gw({objectName:e}){var f;const{readAction:t}=dn(),{selectedObjectName:n,configureState:r,setConfigureState:o}=xt(),i=(f=r==null?void 0:r.write)==null?void 0:f.selectedWriteObjects,s=i==null?void 0:i[e],a=w.useMemo(()=>(s==null?void 0:s.selectedValueDefaults)||{},[s]),c=w.useCallback((m,p,g)=>{xc(n||"",e,m,g,o)},[e,n,o]),u=m=>{xc(n||"",e,m,null,o)},d=Object.keys(a).map(m=>({field:m,defaultValue:a[m],fieldDisplayName:t?zw(m,e,t):m}));return l.jsxs(l.Fragment,{children:[l.jsx("div",{style:{paddingBottom:"1rem",display:"flex",flexDirection:"column",gap:".5rem"},children:d.map(({field:m,fieldDisplayName:p,defaultValue:g})=>l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[l.jsx(to,{id:m,type:"text",disabled:!0,value:p,style:{width:"100%"}}),l.jsx(to,{id:`${m}-${g}`,type:"text",disabled:!0,value:g,style:{width:"10rem"}}),l.jsx(at,{type:"button",variant:"ghost",onClick:()=>u(m),children:"x"})]},`${m}-${g}`))}),l.jsx(Ww,{objectName:e,onAddDefaultValue:c}),l.jsx("div",{style:{textAlign:"right",padding:".25rem 0",color:"var(--amp-colors-text-muted)"},children:"click + to confirm"})]})}const Qw=(e,t)=>!!t.find(n=>{var r;return n.objectName===e&&((r=n==null?void 0:n.valueDefaults)==null?void 0:r.allowAnyFields)});function Xw(){var o;const{configureState:e}=xt(),{writeObjects:t}=dn(),n=(o=e==null?void 0:e.write)==null?void 0:o.selectedWriteObjects;return!!t&&l.jsx(l.Fragment,{children:t.map(i=>n!=null&&n[i.objectName]&&Qw(i.objectName,t)?l.jsxs(l.Fragment,{children:[l.jsx(kr,{string:`Defaults for ${i.displayName} `}),l.jsx(Gw,{objectName:i.objectName})]}):null)})}function Yw(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,u=!xl(a,s);e.write.isWriteModified=u}}}function Cc(e,t,n,r){t(e,o=>{Yw(o,n,r)})}function Zw(){var f,m,p,g;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=xt(),o=(f=n==null?void 0:n.write)==null?void 0:f.selectedWriteObjects,i=(m=n==null?void 0:n.write)==null?void 0:m.writeObjects,s=(y,h)=>{y!=="indeterminate"&&t&&n&&Cc(t,r,h,y)},a=y=>{var h,_;t&&n&&((_=(h=n==null?void 0:n.write)==null?void 0:h.writeObjects)==null||_.forEach(v=>{Cc(t,r,v.objectName,y)}))},c=!!i,u=Object.keys(o||{}).length===((g=(p=n==null?void 0:n.write)==null?void 0:p.writeObjects)==null?void 0:g.length),d=!u&&Object.keys(o||{}).length>0;return c&&l.jsxs(l.Fragment,{children:[l.jsx(kr,{string:`Allow ${e} to write to these objects`}),l.jsxs(Qu,{children:[((i==null?void 0:i.length)||0)>=2&&l.jsx(Gu,{id:"select-all-fields",onCheckedChange:a,isIndeterminate:d,isChecked:u,label:"Select all"}),l.jsx(Xu,{children:i.map(y=>l.jsx(zu,{id:y.objectName,onCheckedChange:h=>s(h,y.objectName),isChecked:!!(o!=null&&o[y.objectName]),label:y.displayName},y.objectName))})]})]})}function eI(){return l.jsxs(l.Fragment,{children:[l.jsx(Zw,{}),l.jsx(Xw,{})]})}function Yu({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const r=Ut(),{projectId:o}=je(),{integrationId:i,installation:s,resetInstallations:a,setIntegrationDeleted:c,onUninstallSuccess:u}=tt(),[d,f]=w.useState(!1),m=!o||!i||!(s!=null&&s.id)||d,p=async()=>{if(!m){f(!0),console.warn("uninstalling installation",{projectId:o,integrationId:i,installationId:s.id});try{await st().installationApi.deleteInstallation({projectIdOrName:o,integrationId:i,installationId:s.id},{headers:{"X-Api-Key":r,"Content-Type":"application/json"}}),console.warn("successfully uninstalled installation:",s.id),u==null||u(s==null?void 0:s.id),a(),c()}catch(h){console.error("Error uninstalling installation."),et(h)}finally{f(!1)}}},g=d?"Uninstalling...":e,y=l.jsx(at,{type:"button",onClick:p,disabled:m,variant:t,style:n,children:g});return s!=null&&s.id?y:null}function tI(){const{installation:e}=tt();return l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[e!=null&&e.id?l.jsx("p",{children:"Once you uninstall this integration, its configuration will be lost."}):l.jsx("p",{children:"You've successfully uninstalled the integration."}),l.jsx(Yu,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})}function Zu({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:o}){var N,R,S,F;const{installation:i}=tt(),{hydratedRevision:s,loading:a}=dn(),{configureState:c,selectedObjectName:u}=xt(),d=i==null?void 0:i.config,f=d&&u&&!!wl(d,u)||!1,m=((N=c==null?void 0:c.read)==null?void 0:N.isOptionalFieldsModified)||((R=c==null?void 0:c.read)==null?void 0:R.isRequiredMapFieldsModified)||((S=c==null?void 0:c.read)==null?void 0:S.isValueMappingsModified),p=(F=c==null?void 0:c.write)==null?void 0:F.isWriteModified,_=a||n||!c||!u||!(m||p||r||u!==er&&!f),v=u===er,x=u===qi,C=l.jsx(at,{type:"submit",disabled:_,children:r?"Install":"Save"}),b=l.jsx(at,{type:"button",onClick:t,disabled:_,variant:"ghost",children:"Reset"});return n?l.jsx(zr,{}):l.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[l.jsxs("div",{style:{display:"flex",flexDirection:"row-reverse",gap:".8rem",marginBottom:"20px"},children:[C,b]}),l.jsxs(Pn,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[o&&l.jsx(Pl,{children:typeof o=="string"?o:"Installation Failed."}),a&&l.jsx(zr,{}),s&&!x&&!v&&l.jsx(qw,{}),s&&!x&&v&&l.jsx(eI,{}),!a&&x&&l.jsx(tI,{})]})]})}const ed=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:o,onUpdateSuccess:i}=tt(),{hydratedRevision:s,loading:a}=dn(),{selectedObjectName:c}=jl(),{selectedConnection:u}=Mr(),d=Ut(),{projectId:f}=je(),{resetBoundary:m,setErrors:p,setError:g,getError:y}=Ht(),{resetConfigureState:h,objectConfigurationsState:_,resetPendingConfigurationState:v}=As(),x=Rl(c||"",_),{onNextIncompleteTab:C}=Sg(),b=w.useCallback(()=>{m(ye.INSTALLATION_MUTATION)},[m]),N=w.useCallback(S=>S?F=>{g(ye.INSTALLATION_MUTATION,S,F)}:F=>{console.error("objectName is required to set installation error: ",F)},[g]),R=w.useCallback(S=>S?y(ye.INSTALLATION_MUTATION,S):"",[y]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:s,loading:a,selectedObjectName:c,selectedConnection:u,apiKey:d,projectId:f,resetBoundary:m,setErrors:p,setMutateInstallationError:N,getMutateInstallationError:R,resetMutateInstallationErrorState:b,resetConfigureState:h,objectConfigurationsState:_,resetPendingConfigurationState:v,configureState:x,onInstallSuccess:o,onUpdateSuccess:i,onNextIncompleteTab:C}},nI=void 0;function rI(){const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:o,loading:i,selectedObjectName:s,selectedConnection:a,apiKey:c,projectId:u,resetBoundary:d,setErrors:f,setMutateInstallationError:m,getMutateInstallationError:p,resetMutateInstallationErrorState:g,resetConfigureState:y,objectConfigurationsState:h,resetPendingConfigurationState:_,configureState:v,onInstallSuccess:x,onNextIncompleteTab:C}=ed(),[b,N]=w.useState(!1),R=s===er,S=p(s),F=w.useCallback(()=>{d(ye.MAPPING),o!=null&&o.content&&!i&&s&&El(o,nI,s,y)},[d,o,i,s,y]);w.useEffect(()=>{!v&&(o!=null&&o.content)&&!i&&F()},[v,h,o,i,F]);const q=()=>{g();const{requiredMapFields:ne,selectedFieldMappings:B}=(v==null?void 0:v.read)||{},{errorList:ce}=_l(ne,B,f);ce.length>0||(s&&(a!=null&&a.id)&&c&&u&&e&&t&&n&&o?(N(!0),mg(u,e,t,n,a.id,s,c,o,v,m(s),r,x).finally(()=>{N(!1),_(s),C()})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},z=()=>{g(),s&&(a!=null&&a.id)&&c&&u&&e&&t&&n&&o?(N(!0),vg(u,e,t,n,a.id,c,o,v,m(s),r,x).finally(()=>{N(!1),_(s),C()})):console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},J=ne=>{ne.preventDefault(),R?z():q()};return l.jsx(Zu,{errorMsg:S,isCreateMode:!0,isLoading:b,onSave:J,onReset:F})}function iI({updateConfig:e,projectId:t,integrationId:n,installationId:r,apiKey:o,selectedObjectName:i,setInstallation:s,onUpdateSuccess:a,setError:c}){const u={projectIdOrName:t,installationId:r,integrationId:n,installationUpdate:{updateMask:[`config.content.read.objects.${i}`],installation:{config:e}}};return st().installationApi.updateInstallation(u,{headers:{"X-Api-Key":o,"Content-Type":"application/json"}}).then(d=>{s(d),a==null||a(d.id,d.config)}).catch(d=>{et(d,c)})}const oI=(e,t,n,r,o,i)=>{const s=Sl(e),a=Nl(e),c=Tl(e),u={content:{read:{objects:{[t]:{objectName:t,schedule:r,destination:(n==null?void 0:n.destination)||"",selectedFields:s,selectedFieldMappings:a,selectedValueMappings:c||{},backfill:i}}}}};return io(o)&&(u.content||(u.content={}),u.content.proxy={enabled:!0}),u},sI=(e,t,n,r,o,i,s,a,c,u,d)=>{const f=oI(i,r||"",a,a.schedule,c,a.backfill);return f?iI({updateConfig:f,projectId:e,integrationId:t,installationId:n,apiKey:o,selectedObjectName:r,setError:u,setInstallation:s,onUpdateSuccess:d}):(console.error("Error when generating updateConfig from configureState"),Promise.resolve(null))},aI=(e,t)=>{const r={content:{write:{objects:Al(e)}}};return io(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r},cI=(e,t,n,r,o,i,s,a,c)=>{const u=aI(o,i);if(!u)return console.error("Error when generating write updateConfig from configureState"),Promise.resolve(null);const d={projectIdOrName:e,installationId:n,integrationId:t,installationUpdate:{updateMask:["config.content.write.objects"],installation:{config:u}}};return st().installationApi.updateInstallation(d,{headers:{"X-Api-Key":r,"Content-Type":"application/json"}}).then(f=>{a(f),c==null||c(f.id,f.config)}).catch(f=>{et(f,s)})};function lI({installation:e,integrationObj:t}){const{setInstallation:n,hydratedRevision:r,loading:o,selectedObjectName:i,apiKey:s,projectId:a,resetBoundary:c,setErrors:u,setMutateInstallationError:d,getMutateInstallationError:f,resetConfigureState:m,resetPendingConfigurationState:p,configureState:g,onUpdateSuccess:y,onNextIncompleteTab:h}=ed(),[_,v]=w.useState(!1),x=i===er,C=f(i),{config:b}=e,N=w.useCallback(()=>{c(ye.MAPPING),r!=null&&r.content&&!o&&i&&El(r,b,i,m)},[c,r,o,i,b,m]);w.useEffect(()=>{g||N()},[g,N]);const R=w.useMemo(()=>{var J,ne,B;return(B=(ne=(J=r==null?void 0:r.content)==null?void 0:J.read)==null?void 0:ne.objects)==null?void 0:B.find(ce=>(ce==null?void 0:ce.objectName)===i)},[r,i]),S=()=>{const{requiredMapFields:z,selectedFieldMappings:J}=(g==null?void 0:g.read)||{},{errorList:ne}=_l(z,J,u);ne.length>0||(r&&e&&i&&s&&a&&R?(v(!0),sI(a,t.id,e.id,i,s,g,n,R,r,d(i),y).finally(()=>{v(!1),p(i),h()})):console.error("UpdateInstallation - onSaveUpdate missing required props"))},F=()=>{e&&i&&s&&a&&r?(v(!0),cI(a,t.id,e.id,s,g,r,d(i),n,y).finally(()=>{v(!1),p(i),h()})):console.error("UpdateInstallation - onSaveUpdate missing required props")},q=z=>{z.preventDefault(),x?F():S()};return l.jsx(Zu,{errorMsg:C,onSave:q,onReset:N,isLoading:_})}function uI(){const{integrationObj:e,installation:t}=tt();return e?t&&e?l.jsx(lI,{installation:t,integrationObj:e}):l.jsx(rI,{}):l.jsx(ul,{message:"We can't load the integration"})}const dI=(e,t)=>({revisionId:e.id,createdBy:`consumer:${t}`,content:{provider:e.content.provider,proxy:{enabled:!0}}});function fI({projectId:e,integrationId:t,groupRef:n,consumerRef:r,connectionId:o,apiKey:i,hydratedRevision:s,setError:a,setInstallation:c,onInstallSuccess:u}){const d=dI(s,r);return d?Ns({createConfig:d,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:i,setError:a,setInstallation:c,onInstallSuccess:u}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))}function pI(){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 sa({text:e,children:t}){return l.jsx(Dr,{children:l.jsxs(Pn,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[l.jsx(pI,{}),l.jsx("p",{children:e}),t]})})}function hI({provider:e}){const t=`You have successfully installed your ${Dn(e)} integration.`;return l.jsx(sa,{text:t,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:l.jsx(Yu,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const mI=e=>{const{read:t,write:n,proxy:r}=(e==null?void 0:e.content)??{};return!t&&!n&&(r==null?void 0:r.enabled)||!1};function gI({children:e}){var C;const{projectId:t}=je(),n=Ut(),{hydratedRevision:r,loading:o}=dn(),{integrationObj:i,installation:s,groupRef:a,consumerRef:c,setInstallation:u,onInstallSuccess:d,isIntegrationDeleted:f}=tt(),{selectedConnection:m,isConnectionsLoading:p}=Mr(),[g,y]=w.useState(!1),h=o||g,_=(C=r==null?void 0:r.content)==null?void 0:C.provider,v=mI(r),x=b=>{console.error("Error when creating proxy installation:",b)};return w.useEffect(()=>{!h&&!p&&r&&v&&!s&&m&&n&&(i!=null&&i.id)&&!f&&(y(!0),fI({apiKey:n,projectId:t,integrationId:i==null?void 0:i.id,groupRef:a,consumerRef:c,connectionId:m==null?void 0:m.id,hydratedRevision:r,setError:x,setInstallation:u,onInstallSuccess:d}).then(()=>{y(!1)}).catch(b=>{y(!1),console.error("Error when creating proxy installation:",b)}))},[r,v,s,m,n,t,i==null?void 0:i.id,a,c,u,h,d,f,p]),i?h?l.jsx(Fr,{}):v&&_&&s?l.jsx(hI,{provider:_}):l.jsx("div",{children:e}):l.jsx(Gt,{message:"We can't load the integration"})}function td(){return 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 di({children:e}){return l.jsx(Dr,{children:l.jsxs(Pn,{children:[l.jsx("div",{style:{padding:"3rem 2rem"},children:e}),l.jsx(td,{})]})})}function fi({children:e}){return l.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function pi({error:e}){return e?l.jsx(Pl,{style:{marginTop:"2em"},children:e}):null}function aa({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(di,{children:[l.jsx(fi,{children:i||`Set up ${r} integration`}),l.jsx(pi,{error:t}),o,l.jsx(at,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}const yI="_link_oo2kv_1",vI={link:yI};function nd({href:e,className:t,style:n,label:r,children:o,newTab:i=!1}){return l.jsx("a",{className:wt(vI.link,t),style:n,href:e,"aria-label":r||void 0,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:o})}function rd({url:e,providerDisplayName:t,credentialName:n}){return l.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[l.jsx(nd,{href:e,newTab:!0,children:l.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," about where to find your ",t," ",n,"."]})}const wI="_textarea_18zl4_1",II="_textareaError_18zl4_14",bI="_error_18zl4_29",Ko={textarea:wI,textareaError:II,error:bI};function _I({className:e,isError:t=!1,...n}){const r=t?wt(Ko.textareaError,Ko.textarea):Ko.textarea;return l.jsx("textarea",{className:wt(e,r),...n})}const un={Input:to,Textarea:_I};function xI({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){var y;const[i,s]=w.useState(!1),a=()=>s(h=>!h),[c,u]=w.useState(""),d=h=>u(h.currentTarget.value),f=c.length>0,m=o||!f,p=Dn(e,t),g=(y=t.apiKeyOpts)==null?void 0:y.docsURL;return l.jsx(aa,{providerName:p,handleSubmit:()=>{n({apiKey:c})},error:r,isButtonDisabled:m,children:l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[g&&l.jsx(rd,{url:g,providerDisplayName:p,credentialName:"API key"}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(un.Input,{id:"password",name:"password",type:i?"text":"password",placeholder:"API Key",onChange:h=>d(h)}),l.jsx(at,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,children:i?"Hide":"Show"})]})]})})}function CI({...e}){return l.jsx(xI,{...e})}function OI({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a,setSelectedConnection:c}){const u=je(),[d,f]=w.useState(!1),[m,p]=w.useState(null),g=Ut();w.useEffect(()=>{if(e&&st&&d&&m!=null){const h={groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,apiKey:m};st().connectionApi.generateConnection({projectIdOrName:u.projectId,generateConnectionParams:h},{headers:{"X-Api-Key":g??"","Content-Type":"application/json"}}).then(_=>{c(_)}).catch(_=>{console.error("Error loading provider info."),et(_)})}},[g,e,d,r,n,i,o,u,c,m]);const y=h=>{p(h.apiKey),f(!0)};return a===null?l.jsx(CI,{provider:e,providerInfo:t,handleSubmit:y,error:null}):s}function EI({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){var _;const[i,s]=w.useState(!1),a=()=>s(v=>!v),[c,u]=w.useState({username:"",password:""}),{username:d,password:f}=c,m=Dn(e,t),p=(_=t.basicOpts)==null?void 0:_.docsURL,g=d.length>0,y=o||!g,h=v=>{const{name:x,value:C}=v.currentTarget;u(b=>({...b,[x]:C}))};return l.jsx(aa,{providerName:m,handleSubmit:()=>{n({user:d,pass:f})},error:r,isButtonDisabled:y,children:l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[p&&l.jsx(rd,{url:p,providerDisplayName:m,credentialName:"credentials"}),l.jsx(un.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:v=>h(v)}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(un.Input,{id:"password",name:"password",type:i?"text":"password",placeholder:"Password",onChange:v=>h(v)}),l.jsx(at,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,children:i?"Hide":"Show"})]})]})})}function SI({...e}){return l.jsx(EI,{...e})}function NI({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a,setSelectedConnection:c}){const u=je(),[d,f]=w.useState(!1),[m,p]=w.useState(null),g=Ut();w.useEffect(()=>{if(e&&st&&d&&m!=null){const h={groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:m.user,password:m.pass}};st().connectionApi.generateConnection({projectIdOrName:u.projectId,generateConnectionParams:h},{headers:{"X-Api-Key":g??"","Content-Type":"application/json"}}).then(_=>{c(_)}).catch(_=>{console.error("Error loading provider info."),et(_)})}},[g,e,d,r,n,i,o,u,m,c]);const y=h=>{const{user:_,pass:v}=h;p({user:_,pass:v}),f(!0)};return a===null?l.jsx(SI,{provider:e,providerInfo:t,handleSubmit:y,error:null}):s}function TI({...e}){return l.jsx(aa,{...e})}function RI({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s,setSelectedConnection:a,providerName:c}){const u=je(),d=Ut(),[f,m]=w.useState(!1);w.useEffect(()=>{if(e&&st&&f){const g={groupName:o,groupRef:r,consumerName:n,consumerRef:t,provider:e};st().connectionApi.generateConnection({projectIdOrName:u.projectId,generateConnectionParams:g},{headers:{"X-Api-Key":d??"","Content-Type":"application/json"}}).then(y=>{a(y)}).catch(y=>{console.error("Error loading provider info."),et(y)})}},[d,e,f,n,t,o,r,a,u]);const p=()=>{m(!0)};return s===null?l.jsx(TI,{handleSubmit:p,error:null,providerName:c}):i}const AI=Os("VITE_AMP_ENABLE_CSRF",!1),PI=Os("NEXT_AMP_ENABLE_CSRF",!1),DI=Os("REACT_APP_AMP_ENABLE_CSRF",!1),FI=!!AI||!!PI||!!DI,id=async(e,t,n,r,o,i,s,a)=>{var u,d;const c=await st().providerApi.getProvider({provider:o},{headers:{"X-Api-Key":r??""}});if(!c)throw new Error(`Provider ${o} not found`);if(c.authType==="oauth2"&&(((u=c.oauth2Opts)==null?void 0:u.grantType)==="authorizationCode"||((d=c.oauth2Opts)==null?void 0:d.grantType)==="authorizationCodePKCE")){const m=(await st().providerAppApi.listProviderApps({projectIdOrName:e},{headers:{"X-Api-Key":r??""}})).find(h=>h.provider===o),p=Dn(o,c);if(!m)throw new Error(`You must first set up a ${p} Provider App using the Ampersand Console.`);const g={connectOAuthParams:{providerWorkspaceRef:i,projectId:e,groupRef:n,groupName:a,consumerRef:t,consumerName:s,providerAppId:m.id,provider:o,enableCSRFProtection:FI}};return await st().oAuthApi.oauthConnect(g,{credentials:"include",headers:{"X-Api-Key":r??"","Content-Type":"application/json"}})}throw new Error(`Provider ${o} does not support an OAuth2 web flow.`)},Oc=600,Ec=600,MI="AUTHORIZATION_SUCCEEDED",jI="AUTHORIZATION_FAILED";function kI(e,t,n,r){return w.useCallback(()=>{if(!r)return;const o=window.screenX+(window.outerWidth-Oc)/2,i=window.screenY+(window.outerHeight-Ec)/2.5,s=`width=${Oc},height=${Ec},left=${o},top=${i}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function LI(e,t,n){const r=ai();return w.useCallback(o=>{var i,s;if(o.origin===Tm){if(o.data.eventType===MI){const a=(i=o.data.data)==null?void 0:i.connection;a?(e(a),t==null||t.close(),r.invalidateQueries({queryKey:["amp","connections"]})):console.error("Connection ID not found in event data: ",{event:o})}o.data.eventType===jI&&(console.error("OAuth failed: ",{event:o}),n==null||n(((s=o==null?void 0:o.data)==null?void 0:s.message)??"Something went wrong. Please try again."))}},[t,n,r,e])}function od({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:o}){const[i,s]=w.useState(null),[a,c]=w.useState(null),u=LI(s,a,r),d=kI(n,c,u,t);return w.useEffect(()=>{t&&!a&&d()},[t,a,d,u,n]),w.useEffect(()=>{if(!a)return;const f=setInterval(()=>{a.closed&&(clearInterval(f),window.removeEventListener("message",u),c(null),!i&&!o?(console.error("OAuth failed. Please try again."),r==null||r("Something went wrong. Please try again.")):i&&(r==null||r(null)))},500);return()=>{clearInterval(f),window.removeEventListener("message",u)}},[a,i,o,u,r]),l.jsx("div",{children:e})}function KI({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return l.jsxs(di,{children:[l.jsx(fi,{children:`Set up ${r} integration`}),l.jsx(pi,{error:t}),l.jsx(at,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function VI({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){const{projectId:s}=je(),a=Ut(),[c,u]=w.useState(null),[d,f]=w.useState(null),m=async()=>{f(null);try{const g=await id(s,t,r,a,e,void 0,n,o);u(g)}catch(g){console.error("Could not fetch OAuth popup URL."),et(g),f(g.message??"Unexpected error")}},p=w.useCallback(g=>{f(g),u(null)},[]);return l.jsx(od,{windowTitle:`Connect to ${i}`,oauthUrl:c,onError:p,children:l.jsx(KI,{handleSubmit:m,error:d,providerName:i})})}const $I="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function qI({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return l.jsxs(di,{children:[l.jsx(fi,{children:"Enter your Salesforce subdomain"}),l.jsx(nd,{href:$I,newTab:!0,children:"What is my Salesforce subdomain?"}),l.jsx(pi,{error:n}),l.jsxs("div",{style:{display:"flex",marginTop:"1em",alignItems:"center"},children:[l.jsx(un.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(at,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function UI({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r,providerName:o}){return l.jsxs(di,{children:[l.jsxs(fi,{children:["Enter your ",o," workspace"]}),l.jsx(pi,{error:n}),l.jsx("br",{}),l.jsx(un.Input,{id:"workspace",type:"text",placeholder:"MyWorkspace",onChange:i=>t(i.currentTarget.value)}),l.jsx("br",{}),l.jsx(at,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const HI="salesforce";function BI({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){const{projectId:s}=je(),a=Ut(),[c,u]=w.useState(""),[d,f]=w.useState(null),[m,p]=w.useState(null),g=async()=>{if(p(null),!c){p("Workspace is required");return}try{const _=await id(s,t,r,a,e,c,n,o);f(_)}catch(_){console.error(_),p((_==null?void 0:_.message)??"Unexpected error")}},y=w.useCallback(_=>{p(_),f(null)},[]),h=e===HI?l.jsx(qI,{handleSubmit:g,setWorkspace:u,error:m,isButtonDisabled:c.length===0}):l.jsx(UI,{handleSubmit:g,setWorkspace:u,error:m,isButtonDisabled:c.length===0,providerName:i});return l.jsx(od,{windowTitle:`Connect to ${i}`,oauthUrl:d,onError:y,children:h})}function WI({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,explicitScopesRequired:o,explicitWorkspaceRequired:i}){const[s,a]=w.useState(!1),[c,u]=w.useState({clientSecret:"",clientId:"",workspace:"",scopes:""}),d=()=>a(b=>!b),f=b=>{const{name:N,value:R}=b.currentTarget;u(S=>({...S,[N]:R}))},{clientSecret:m,clientId:p,workspace:g,scopes:y}=c,h=m.length>0,_=p.length>0,v=i?g.length>0:!0,x=n||!h||!_||!v,C=()=>{const b={clientId:p,clientSecret:m};i&&(b.workspace=g),o&&y.length>0&&(b.scopes=Xm(y)),e(b)};return l.jsxs(di,{children:[l.jsx(fi,{children:`Set up ${r} integration`}),l.jsx(pi,{error:t}),l.jsx("br",{}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[i&&l.jsx(un.Input,{id:"workspace",name:"workspace",type:"text",placeholder:"MyWorkspace",onChange:b=>f(b)}),l.jsx(un.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:b=>f(b)}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(un.Input,{id:"clientSecret",name:"clientSecret",type:s?"text":"password",placeholder:"Client Secret",onChange:b=>f(b)}),l.jsx(at,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:d,children:s?"Hide":"Show"})]}),o&&l.jsx(un.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:b=>f(b)})]}),l.jsx("br",{}),l.jsx(at,{style:{marginTop:"1em",width:"100%"},disabled:x,type:"submit",onClick:C,children:"Next"})]})}function JI({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,explicitScopesRequired:s,explicitWorkspaceRequired:a,selectedConnection:c,setSelectedConnection:u}){const{projectId:d}=je(),f=Ut(),[m,p]=w.useState(null),g=async y=>{p(null);const h={groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:y.workspace,oauth2ClientCredentials:{clientId:y.clientId,clientSecret:y.clientSecret,scopes:y.scopes}};st().connectionApi.generateConnection({projectIdOrName:d,generateConnectionParams:h},{headers:{"X-Api-Key":f??"","Content-Type":"application/json"}}).then(_=>{u(_)}).catch(_=>{console.error("Error loading provider info."),et(_),p("Error loading provider info")})};return c===null?l.jsx(WI,{providerName:t,handleSubmit:g,error:m,explicitScopesRequired:s,explicitWorkspaceRequired:a}):l.jsx(zr,{})}function zI({...e}){return l.jsx(JI,{...e})}const GI="authorizationCode",QI="authorizationCodePKCE",XI="clientCredentials";function YI({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,selectedConnection:s,setSelectedConnection:a}){if(t.oauth2Opts===void 0)return l.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:c,explicitScopesRequired:u,explicitWorkspaceRequired:d}=t.oauth2Opts,f=Dn(e,t),m={provider:e,consumerRef:n,consumerName:r,groupRef:o,groupName:i,providerName:f};return c===GI||c===QI?d?l.jsx(BI,{...m}):l.jsx(VI,{...m}):c===XI?l.jsx(zI,{...m,explicitWorkspaceRequired:d,explicitScopesRequired:u,selectedConnection:s,setSelectedConnection:a}):c==="password"?l.jsx("em",{children:"Password flow not supported yet"}):l.jsxs("em",{children:["Unsupported grant type: ",c]})}function ZI(e){const{selectedConnection:t}=Mr();w.useEffect(()=>{e&&t&&e(t)},[e,t])}function eb({onSuccess:e}){ZI(e)}const tb=e=>{const t=Pr(),{provider:n}=tt(),r=e||n;return Ar({queryKey:["amp","providerInfo",r],queryFn:async()=>{if(!r)throw new Error("Provider not found");return(await t()).providerApi.getProvider({provider:r})},enabled:!!r})};function sd({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,onSuccess:s,onDisconnectSuccess:a,resetComponent:c}){const{data:u,isLoading:d,isError:f,error:m}=tb(e),{provider:p,isIntegrationDeleted:g}=tt(),{selectedConnection:y,setSelectedConnection:h}=Mr();eb({onSuccess:s});const _=ai(),v=e||p,x=(u==null?void 0:u.displayName)??Gr(v);w.useEffect(()=>{f&&(console.error("Error loading provider info."),et(m))},[f,m]);const C=w.useCallback(()=>{_.clear(),c()},[c,_]);if(!e&&!p)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(g)return l.jsx(sa,{text:"Integration successfully uninstalled.",children:l.jsx(at,{type:"button",onClick:C,style:{width:"100%"},children:"Reinstall Integration"})});if(y)return i;if(d)return l.jsx(Fr,{});if(u==null)return l.jsx(Gt,{message:"Provider info was not found."});const b={provider:v,consumerRef:t,consumerName:n,groupRef:r,groupName:o,selectedConnection:y,setSelectedConnection:h,providerName:x,providerInfo:u,onDisconnectSuccess:a};return u.authType==="none"?l.jsx(RI,{...b,children:i}):u.authType==="basic"?l.jsx(NI,{...b,children:i}):u.authType==="apiKey"?l.jsx(OI,{...b,children:i}):l.jsx(YI,{...b})}function nb(e){const t=e+"CollectionProvider",[n,r]=yo(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=p=>{const{scope:g,children:y}=p,h=w.useRef(null),_=w.useRef(new Map).current;return l.jsx(o,{scope:g,itemMap:_,collectionRef:h,children:y})};s.displayName=t;const a=e+"CollectionSlot",c=w.forwardRef((p,g)=>{const{scope:y,children:h}=p,_=i(a,y),v=ei(g,_.collectionRef);return l.jsx(eo,{ref:v,children:h})});c.displayName=a;const u=e+"CollectionItemSlot",d="data-radix-collection-item",f=w.forwardRef((p,g)=>{const{scope:y,children:h,..._}=p,v=w.useRef(null),x=ei(g,v),C=i(u,y);return w.useEffect(()=>(C.itemMap.set(v,{ref:v,..._}),()=>void C.itemMap.delete(v))),l.jsx(eo,{[d]:"",ref:x,children:h})});f.displayName=u;function m(p){const g=i(e+"CollectionConsumer",p);return w.useCallback(()=>{const h=g.collectionRef.current;if(!h)return[];const _=Array.from(h.querySelectorAll(`[${d}]`));return Array.from(g.itemMap.values()).sort((C,b)=>_.indexOf(C.ref.current)-_.indexOf(b.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:s,Slot:c,ItemSlot:f},m,r]}var rb=$.useId||(()=>{}),ib=0;function ad(e){const[t,n]=$.useState(rb());return Zi(()=>{e||n(r=>r??String(ib++))},[e]),e||(t?`radix-${t}`:"")}var ob=$.createContext(void 0);function cd(e){const t=$.useContext(ob);return e||t||"ltr"}var Vo="rovingFocusGroup.onEntryFocus",sb={bubbles:!1,cancelable:!0},vo="RovingFocusGroup",[ws,ld,ab]=nb(vo),[cb,ud]=yo(vo,[ab]),[lb,ub]=cb(vo),dd=$.forwardRef((e,t)=>l.jsx(ws.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(ws.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(db,{...e,ref:t})})}));dd.displayName=vo;var db=$.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,m=$.useRef(null),p=ei(t,m),g=cd(i),[y=null,h]=ra({prop:s,defaultProp:a,onChange:c}),[_,v]=$.useState(!1),x=na(u),C=ld(n),b=$.useRef(!1),[N,R]=$.useState(0);return $.useEffect(()=>{const S=m.current;if(S)return S.addEventListener(Vo,x),()=>S.removeEventListener(Vo,x)},[x]),l.jsx(lb,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:y,onItemFocus:$.useCallback(S=>h(S),[h]),onItemShiftTab:$.useCallback(()=>v(!0),[]),onFocusableItemAdd:$.useCallback(()=>R(S=>S+1),[]),onFocusableItemRemove:$.useCallback(()=>R(S=>S-1),[]),children:l.jsx(Fn.div,{tabIndex:_||N===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...e.style},onMouseDown:Vt(e.onMouseDown,()=>{b.current=!0}),onFocus:Vt(e.onFocus,S=>{const F=!b.current;if(S.target===S.currentTarget&&F&&!_){const q=new CustomEvent(Vo,sb);if(S.currentTarget.dispatchEvent(q),!q.defaultPrevented){const z=C().filter(re=>re.focusable),J=z.find(re=>re.active),ne=z.find(re=>re.id===y),ce=[J,ne,...z].filter(Boolean).map(re=>re.ref.current);hd(ce,d)}}b.current=!1}),onBlur:Vt(e.onBlur,()=>v(!1))})})}),fd="RovingFocusGroupItem",pd=$.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=e,a=ad(),c=i||a,u=ub(fd,n),d=u.currentTabStopId===c,f=ld(n),{onFocusableItemAdd:m,onFocusableItemRemove:p}=u;return $.useEffect(()=>{if(r)return m(),()=>p()},[r,m,p]),l.jsx(ws.ItemSlot,{scope:n,id:c,focusable:r,active:o,children:l.jsx(Fn.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:Vt(e.onMouseDown,g=>{r?u.onItemFocus(c):g.preventDefault()}),onFocus:Vt(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:Vt(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){u.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const y=hb(g,u.orientation,u.dir);if(y!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let _=f().filter(v=>v.focusable).map(v=>v.ref.current);if(y==="last")_.reverse();else if(y==="prev"||y==="next"){y==="prev"&&_.reverse();const v=_.indexOf(g.currentTarget);_=u.loop?mb(_,v+1):_.slice(v+1)}setTimeout(()=>hd(_))}})})})});pd.displayName=fd;var fb={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function pb(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function hb(e,t,n){const r=pb(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return fb[r]}function hd(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function mb(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var gb=dd,yb=pd,ca="Tabs",[vb,Bb]=yo(ca,[ud]),md=ud(),[wb,la]=vb(ca),gd=$.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=cd(a),[f,m]=ra({prop:r,onChange:o,defaultProp:i});return l.jsx(wb,{scope:n,baseId:ad(),value:f,onValueChange:m,orientation:s,dir:d,activationMode:c,children:l.jsx(Fn.div,{dir:d,"data-orientation":s,...u,ref:t})})});gd.displayName=ca;var yd="TabsList",vd=$.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=la(yd,n),s=md(n);return l.jsx(gb,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:l.jsx(Fn.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});vd.displayName=yd;var wd="TabsTrigger",Id=$.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=la(wd,n),a=md(n),c=_d(s.baseId,r),u=xd(s.baseId,r),d=r===s.value;return l.jsx(yb,{asChild:!0,...a,focusable:!o,active:d,children:l.jsx(Fn.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...i,ref:t,onMouseDown:Vt(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:Vt(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:Vt(e.onFocus,()=>{const f=s.activationMode!=="manual";!d&&!o&&f&&s.onValueChange(r)})})})});Id.displayName=wd;var bd="TabsContent",Ib=$.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=la(bd,n),c=_d(a.baseId,r),u=xd(a.baseId,r),d=r===a.value,f=$.useRef(d);return $.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),l.jsx(ia,{present:o||d,children:({present:m})=>l.jsx(Fn.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:u,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:m&&i})})});Ib.displayName=bd;function _d(e,t){return`${e}-trigger-${t}`}function xd(e,t){return`${e}-content-${t}`}var bb=gd,_b=vd,Cd=Id;const xb=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 Cb(e,t){return t?w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},w.createElement("circle",{cx:"9",cy:"9",r:"5",fill:"#FBD38D"})):e?xb: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 Ob(){return l.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M2.25 4.5H3.75H15.75",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M14.25 4.5V15C14.25 15.3978 14.092 15.7794 13.8107 16.0607C13.5294 16.342 13.1478 16.5 12.75 16.5H5.25C4.85218 16.5 4.47064 16.342 4.18934 16.0607C3.90804 15.7794 3.75 15.3978 3.75 15V4.5M6 4.5V3C6 2.60218 6.15804 2.22064 6.43934 1.93934C6.72064 1.65804 7.10218 1.5 7.5 1.5H10.5C10.8978 1.5 11.2794 1.65804 11.5607 1.93934C11.842 2.22064 12 2.60218 12 3V4.5",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M7.5 8.25V12.75",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M10.5 8.25V12.75",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const Eb="_tabsRoot_ktpr0_1",Sb="_tabsList_ktpr0_6",Nb="_tabTrigger_ktpr0_12",Tb="_danger_ktpr0_29",ti={tabsRoot:Eb,tabsList:Sb,tabTrigger:Nb,danger:Tb};function Od({objectName:e,completed:t,pending:n,displayName:r}){return l.jsx(Cd,{value:e,className:ti.tabTrigger,children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[Cb(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 Rb({completed:e,pending:t,displayName:n}){return l.jsxs(l.Fragment,{children:[l.jsx(go,{style:{margin:"1rem 0"}}),l.jsx(Od,{objectName:er,completed:e,pending:t,displayName:n},"other-write")]})}function Ab(){return l.jsxs(l.Fragment,{children:[l.jsx(go,{style:{margin:"3rem 0 1rem 0"}}),l.jsx(Cd,{value:qi,className:wt(ti.tabTrigger,ti.danger),children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[Ob(),l.jsx("span",{children:"Uninstall"})]})})]})}function Pb({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:o,showUninstallButton:i}){var s,a;return l.jsx(bb,{value:e,className:ti.tabsRoot,onValueChange:n,children:l.jsxs(_b,{className:ti.tabsList,children:[t.map(c=>{var u,d,f,m,p,g;return l.jsx(Od,{objectName:c.name,displayName:c.displayName,completed:c.completed,pending:((d=(u=r==null?void 0:r[c.name])==null?void 0:u.read)==null?void 0:d.isOptionalFieldsModified)||((m=(f=r==null?void 0:r[c.name])==null?void 0:f.read)==null?void 0:m.isRequiredMapFieldsModified)||((g=(p=r==null?void 0:r[c.name])==null?void 0:p.read)==null?void 0:g.isValueMappingsModified)||!1},c.name)}),o&&l.jsx(Rb,{completed:o.completed,pending:((a=(s=r==null?void 0:r.other)==null?void 0:s.write)==null?void 0:a.isWriteModified)||!1,displayName:"Write"}),i&&l.jsx(Ab,{})]})})}function Db(e,t){return t===qi?{name:qi,completed:!1}:e.find(n=>n.name===t)}function Fb({children:e}){var _;const{project:t}=je(),{installation:n,provider:r}=tt(),{hydratedRevision:o}=dn(),{objectConfigurationsState:i}=As(),[s,a]=w.useState(""),c=(t==null?void 0:t.appName)||"",u=n==null?void 0:n.config,d=o&&Il(u,o),f=d!==null,m=!!((_=o==null?void 0:o.content)!=null&&_.write),p=m?bl(u):void 0,g=w.useMemo(()=>{const v=[...d||[]];return p&&m&&v.push(p),v},[d,p,m]),y=Db(g,s),h=w.useCallback(()=>{const v=g.find(x=>y!==x&&!x.completed);v&&a(v.name)},[g,y]);return w.useEffect(()=>{!s&&g.length>0&&a(g[0].name)},[g,s,h]),l.jsx(kl.Provider,{value:h,children:l.jsx(Ml.Provider,{value:y==null?void 0:y.name,children:l.jsxs(Dr,{style:{maxWidth:"55rem"},children:[l.jsxs(Pn,{style:{display:"flex",gap:"1rem",padding:"3rem",backgroundColor:"var(--amp-colors-bg-primary)"},children:[l.jsxs("div",{style:{width:"20rem"},children:[l.jsxs("h1",{style:{fontSize:"small",fontWeight:"400"},children:[Dn(r)," integration"]}),l.jsx("h3",{style:{marginBottom:"20px",fontSize:"large",fontWeight:"500"},children:c}),f&&l.jsx(Pb,{value:s,readNavObjects:d,onValueChange:v=>a(v),objectConfigurationsState:i,writeNavObject:p,showUninstallButton:!!n})]}),e]}),l.jsx(td,{})]})})})}function Mb({...e}){return l.jsx(Fb,{...e})}function jb({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c}){var h;const{projectIdOrName:u,isLoading:d}=je(),{isLoading:f}=Cs(),{isError:m,errorState:p}=Ht(),{seed:g,reset:y}=gl();return d||f?l.jsx(Fr,{}):m(ye.PROJECT,u)?l.jsx(Gt,{message:`Error loading project ${u}`}):m(ye.INTEGRATION_LIST,u)?l.jsx(Gt,{message:"Error retrieving integrations for the project, double check the API key"}):(h=p[ye.INTEGRATION_LIST])!=null&&h.apiError?l.jsx(Gt,{message:"Something went wrong, couldn't find integration information"}):l.jsx("div",{className:yl.resetContainer,children:l.jsx(eg,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c,children:l.jsx(ml,{children:l.jsx(sd,{consumerRef:t,consumerName:n,groupRef:r,groupName:o,resetComponent:y,children:l.jsx(Eg,{children:l.jsx(gI,{children:l.jsx(Vg,{children:l.jsx(Mb,{children:l.jsx(uI,{})})})})})})})},g)})}function kb(){return l.jsxs(Dr,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[l.jsx(zr,{}),l.jsx("p",{children:"Redirecting"})]})}function Lb({redirectURL:e,children:t}){return w.useEffect(()=>{e&&window.location.replace(e)},[e]),e?l.jsx(kb,{}):t}function Kb({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:o}){const i=Ut(),{projectId:s}=je(),{selectedConnection:a,setConnections:c}=Mr(),[u,d]=w.useState(!1),f=!s||!a||!a.id||u,m=async()=>{if(!f){d(!0),console.warn("deleting connection",{projectId:s,connectionId:a==null?void 0:a.id});try{await st().connectionApi.deleteConnection({projectIdOrName:s,connectionId:a==null?void 0:a.id},{headers:{"X-Api-Key":i,"Content-Type":"application/json"}}),console.warn("successfully deleted connection:",a==null?void 0:a.id),r==null||r(a),st().connectionApi.listConnections({projectIdOrName:s},{headers:{"X-Api-Key":i??""}}).then(y=>{c(y),o()}).catch(y=>{et(y)})}catch(y){console.error("Error deleting connection."),et(y)}finally{d(!1)}}},p=u?"Disconnecting...":e;return l.jsx(at,{type:"button",onClick:m,disabled:f,variant:t,style:n,children:p})}function Vb({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=je(),o=`You have successfully connected your ${Dn(e)} account to ${r}.`;return l.jsx(sa,{text:o,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:l.jsx(Kb,{resetComponent:n,onDisconnectSuccess:t,buttonText:"Remove Connection",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}function $b({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,redirectUrl:i,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:c}){const{seed:u,reset:d}=gl(),f=w.useCallback(m=>{s?s(m.id):c&&c(m)},[s,c]);return l.jsx("div",{className:yl.resetContainer,children:l.jsx(ml,{children:l.jsx(sd,{resetComponent:d,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onSuccess:f,onDisconnectSuccess:a,children:l.jsx(Lb,{redirectURL:i,children:l.jsx(Vb,{resetComponent:d,provider:e,onDisconnectSuccess:a})})})})},u)}const qb=(e,t)=>{const{data:n,isLoading:r,isError:o,error:i}=fl(e,t),s=((n==null?void 0:n.length)||0)>0,a=!!n&&!r;return w.useEffect(()=>{o&&et(i)},[o,i]),{isLoaded:a,isIntegrationInstalled:s,isLoading:r}};exports.AmpersandContext=ll;exports.AmpersandProvider=km;exports.ConnectProvider=$b;exports.FieldMapping=ho;exports.InstallIntegration=jb;exports.useAmpersandProvider=Lm;exports.useIsIntegrationInstalled=qb;
48
+ */const zv="react-tooltip-core-styles",Gv="react-tooltip-base-styles",_c={core:!1,base:!1};function xc({css:e,id:t=Gv,type:n="base",ref:r}){var o,i;if(!e||typeof document>"u"||_c[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=zv),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)),_c[n]=!0}const Cc=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10,strategy:i="absolute",middlewares:s=[Hv(Number(o)),Wv({fallbackAxisSideDirection:"start"}),Bv({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(Jv({element:n,padding:5})),bc(e,t,{placement:r,strategy:i,middleware:c}).then(({x:u,y:d,placement:f,middlewareData:p})=>{var m,g;const w={left:`${u}px`,top:`${d}px`,border:a},{x:h,y:x}=(m=p.arrow)!==null&&m!==void 0?m:{x:0,y:0},y=(g={top:"bottom",right:"left",bottom:"top",left:"right"}[f.split("-")[0]])!==null&&g!==void 0?g:"bottom",b=a&&{borderBottom:a,borderRight:a};let C=0;if(a){const _=`${a}`.match(/(\d+)px/);C=_!=null&&_[1]?Number(_[1]):1}return{tooltipStyles:w,tooltipArrowStyles:{left:h!=null?`${h}px`:"",top:x!=null?`${x}px`:"",right:"",bottom:"",...b,[y]:`-${4+C}px`},place:f}})):bc(e,t,{placement:"bottom",strategy:i,middleware:c}).then(({x:u,y:d,placement:f})=>({tooltipStyles:{left:`${u}px`,top:`${d}px`},tooltipArrowStyles:{},place:f}))},Oc=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),Ec=(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},Sc=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",Es=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((o,i)=>Es(o,t[i]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Sc(e)||!Sc(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(o=>Es(e[o],t[o]))},Qv=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"})},Nc=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(Qv(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},Xv=typeof window<"u"?v.useLayoutEffect:v.useEffect,St=e=>{e.current&&(clearTimeout(e.current),e.current=null)},Yv="DEFAULT_TOOLTIP_ID",Zv={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},ew=v.createContext({getTooltipData:()=>Zv});function Xu(e=Yv){return v.useContext(ew).getTooltipData(e)}var mr={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"},Bo={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 tw=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:o="dark",anchorId:i,anchorSelect:s,place:a="top",offset:c=10,events:u=["hover"],openOnClick:d=!1,positionStrategy:f="absolute",middlewares:p,wrapper:m,delayShow:g=0,delayHide:w=0,float:h=!1,hidden:x=!1,noArrow:y=!1,clickable:b=!1,closeOnEsc:C=!1,closeOnScroll:_=!1,closeOnResize:S=!1,openEvents:T,closeEvents:N,globalCloseEvents:P,imperativeModeOnly:q,style:G,position:z,afterShow:ne,afterHide:B,disableTooltip:ce,content:oe,contentWrapperRef:te,isOpen:ge,defaultIsOpen:we=!1,setIsOpen:R,activeAnchor:k,setActiveAnchor:$,border:L,opacity:j,arrowColor:M,role:Y="tooltip"})=>{var Z;const U=v.useRef(null),ee=v.useRef(null),Q=v.useRef(null),de=v.useRef(null),F=v.useRef(null),[ve,H]=v.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[Ee,Le]=v.useState(!1),[Ge,Ke]=v.useState(!1),[Ie,At]=v.useState(null),Qe=v.useRef(!1),mt=v.useRef(null),{anchorRefs:Pt,setActiveAnchor:Dt}=Xu(t),Xe=v.useRef(!1),[We,$e]=v.useState([]),Ae=v.useRef(!1),Mt=d||u.includes("click"),tt=Mt||(T==null?void 0:T.click)||(T==null?void 0:T.dblclick)||(T==null?void 0:T.mousedown),Yt=T?{...T}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!T&&Mt&&Object.assign(Yt,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const hn=N?{...N}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!N&&Mt&&Object.assign(hn,{mouseleave:!1,blur:!1,mouseout:!1});const gt=P?{...P}:{escape:C||!1,scroll:_||!1,resize:S||!1,clickOutsideAnchor:tt||!1};q&&(Object.assign(Yt,{mouseenter:!1,focus:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(hn,{mouseleave:!1,blur:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(gt,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),Xv(()=>(Ae.current=!0,()=>{Ae.current=!1}),[]);const Pe=W=>{Ae.current&&(W&&Ke(!0),setTimeout(()=>{Ae.current&&(R==null||R(W),ge===void 0&&Le(W))},10))};v.useEffect(()=>{if(ge===void 0)return()=>null;ge&&Ke(!0);const W=setTimeout(()=>{Le(ge)},10);return()=>{clearTimeout(W)}},[ge]),v.useEffect(()=>{if(Ee!==Qe.current)if(St(F),Qe.current=Ee,Ee)ne==null||ne();else{const W=(se=>{const le=se.match(/^([\d.]+)(ms|s)$/);if(!le)return 0;const[,je,Ue]=le;return Number(je)*(Ue==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));F.current=setTimeout(()=>{Ke(!1),At(null),B==null||B()},W+25)}},[Ee]);const Zt=W=>{H(se=>Es(se,W)?se:W)},mn=(W=g)=>{St(Q),Ge?Pe(!0):Q.current=setTimeout(()=>{Pe(!0)},W)},en=(W=w)=>{St(de),de.current=setTimeout(()=>{Xe.current||Pe(!1)},W)},Vn=W=>{var se;if(!W)return;const le=(se=W.currentTarget)!==null&&se!==void 0?se:W.target;if(!(le!=null&&le.isConnected))return $(null),void Dt({current:null});g?mn():Pe(!0),$(le),Dt({current:le}),St(de)},ct=()=>{b?en(w||100):w?en():Pe(!1),St(Q)},tn=({x:W,y:se})=>{var le;const je={getBoundingClientRect:()=>({x:W,y:se,width:0,height:0,top:se,left:W,right:W,bottom:se})};Cc({place:(le=Ie==null?void 0:Ie.place)!==null&&le!==void 0?le:a,offset:c,elementReference:je,tooltipReference:U.current,tooltipArrowReference:ee.current,strategy:f,middlewares:p,border:L}).then(Ue=>{Zt(Ue)})},gn=W=>{if(!W)return;const se=W,le={x:se.clientX,y:se.clientY};tn(le),mt.current=le},Kn=W=>{var se;if(!Ee)return;const le=W.target;le.isConnected&&(!((se=U.current)===null||se===void 0)&&se.contains(le)||[document.querySelector(`[id='${i}']`),...We].some(je=>je==null?void 0:je.contains(le))||(Pe(!1),St(Q)))},yn=Ec(Vn,50),Re=Ec(ct,50),nt=W=>{Re.cancel(),yn(W)},re=()=>{yn.cancel(),Re()},me=v.useCallback(()=>{var W,se;const le=(W=Ie==null?void 0:Ie.position)!==null&&W!==void 0?W:z;le?tn(le):h?mt.current&&tn(mt.current):k!=null&&k.isConnected&&Cc({place:(se=Ie==null?void 0:Ie.place)!==null&&se!==void 0?se:a,offset:c,elementReference:k,tooltipReference:U.current,tooltipArrowReference:ee.current,strategy:f,middlewares:p,border:L}).then(je=>{Ae.current&&Zt(je)})},[Ee,k,oe,G,a,Ie==null?void 0:Ie.place,c,f,z,Ie==null?void 0:Ie.position,h]);v.useEffect(()=>{var W,se;const le=new Set(Pt);We.forEach(Se=>{ce!=null&&ce(Se)||le.add({current:Se})});const je=document.querySelector(`[id='${i}']`);je&&!(ce!=null&&ce(je))&&le.add({current:je});const Ue=()=>{Pe(!1)},lt=Nc(k),Je=Nc(U.current);gt.scroll&&(window.addEventListener("scroll",Ue),lt==null||lt.addEventListener("scroll",Ue),Je==null||Je.addEventListener("scroll",Ue));let Ye=null;gt.resize?window.addEventListener("resize",Ue):k&&U.current&&(Ye=Uv(k,U.current,me,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const ut=Se=>{Se.key==="Escape"&&Pe(!1)};gt.escape&&window.addEventListener("keydown",ut),gt.clickOutsideAnchor&&window.addEventListener("click",Kn);const Ne=[],$n=Se=>{Ee&&(Se==null?void 0:Se.target)===k||Vn(Se)},So=Se=>{Ee&&(Se==null?void 0:Se.target)===k&&ct()},Ct=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],Ii=["click","dblclick","mousedown","mouseup"];Object.entries(Yt).forEach(([Se,Ft])=>{Ft&&(Ct.includes(Se)?Ne.push({event:Se,listener:nt}):Ii.includes(Se)&&Ne.push({event:Se,listener:$n}))}),Object.entries(hn).forEach(([Se,Ft])=>{Ft&&(Ct.includes(Se)?Ne.push({event:Se,listener:re}):Ii.includes(Se)&&Ne.push({event:Se,listener:So}))}),h&&Ne.push({event:"pointermove",listener:gn});const bi=()=>{Xe.current=!0},_i=()=>{Xe.current=!1,ct()};return b&&!tt&&((W=U.current)===null||W===void 0||W.addEventListener("mouseenter",bi),(se=U.current)===null||se===void 0||se.addEventListener("mouseleave",_i)),Ne.forEach(({event:Se,listener:Ft})=>{le.forEach(kt=>{var qn;(qn=kt.current)===null||qn===void 0||qn.addEventListener(Se,Ft)})}),()=>{var Se,Ft;gt.scroll&&(window.removeEventListener("scroll",Ue),lt==null||lt.removeEventListener("scroll",Ue),Je==null||Je.removeEventListener("scroll",Ue)),gt.resize?window.removeEventListener("resize",Ue):Ye==null||Ye(),gt.clickOutsideAnchor&&window.removeEventListener("click",Kn),gt.escape&&window.removeEventListener("keydown",ut),b&&!tt&&((Se=U.current)===null||Se===void 0||Se.removeEventListener("mouseenter",bi),(Ft=U.current)===null||Ft===void 0||Ft.removeEventListener("mouseleave",_i)),Ne.forEach(({event:kt,listener:qn})=>{le.forEach(No=>{var zr;(zr=No.current)===null||zr===void 0||zr.removeEventListener(kt,qn)})})}},[k,me,Ge,Pt,We,T,N,P,Mt,g,w]),v.useEffect(()=>{var W,se;let le=(se=(W=Ie==null?void 0:Ie.anchorSelect)!==null&&W!==void 0?W:s)!==null&&se!==void 0?se:"";!le&&t&&(le=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const je=new MutationObserver(Ue=>{const lt=[],Je=[];Ue.forEach(Ye=>{if(Ye.type==="attributes"&&Ye.attributeName==="data-tooltip-id"&&(Ye.target.getAttribute("data-tooltip-id")===t?lt.push(Ye.target):Ye.oldValue===t&&Je.push(Ye.target)),Ye.type==="childList"){if(k){const ut=[...Ye.removedNodes].filter(Ne=>Ne.nodeType===1);if(le)try{Je.push(...ut.filter(Ne=>Ne.matches(le))),Je.push(...ut.flatMap(Ne=>[...Ne.querySelectorAll(le)]))}catch{}ut.some(Ne=>{var $n;return!!(!(($n=Ne==null?void 0:Ne.contains)===null||$n===void 0)&&$n.call(Ne,k))&&(Ke(!1),Pe(!1),$(null),St(Q),St(de),!0)})}if(le)try{const ut=[...Ye.addedNodes].filter(Ne=>Ne.nodeType===1);lt.push(...ut.filter(Ne=>Ne.matches(le))),lt.push(...ut.flatMap(Ne=>[...Ne.querySelectorAll(le)]))}catch{}}}),(lt.length||Je.length)&&$e(Ye=>[...Ye.filter(ut=>!Je.includes(ut)),...lt])});return je.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{je.disconnect()}},[t,s,Ie==null?void 0:Ie.anchorSelect,k]),v.useEffect(()=>{me()},[me]),v.useEffect(()=>{if(!(te!=null&&te.current))return()=>null;const W=new ResizeObserver(()=>{setTimeout(()=>me())});return W.observe(te.current),()=>{W.disconnect()}},[oe,te==null?void 0:te.current]),v.useEffect(()=>{var W;const se=document.querySelector(`[id='${i}']`),le=[...We,se];k&&le.includes(k)||$((W=We[0])!==null&&W!==void 0?W:se)},[i,We,k]),v.useEffect(()=>(we&&Pe(!0),()=>{St(Q),St(de)}),[]),v.useEffect(()=>{var W;let se=(W=Ie==null?void 0:Ie.anchorSelect)!==null&&W!==void 0?W:s;if(!se&&t&&(se=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),se)try{const le=Array.from(document.querySelectorAll(se));$e(le)}catch{$e([])}},[t,s,Ie==null?void 0:Ie.anchorSelect]),v.useEffect(()=>{Q.current&&(St(Q),mn(g))},[g]);const qe=(Z=Ie==null?void 0:Ie.content)!==null&&Z!==void 0?Z:oe,nn=Ee&&Object.keys(ve.tooltipStyles).length>0;return v.useImperativeHandle(e,()=>({open:W=>{if(W!=null&&W.anchorSelect)try{document.querySelector(W.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${W.anchorSelect}" is not a valid CSS selector`)}At(W??null),W!=null&&W.delay?mn(W.delay):Pe(!0)},close:W=>{W!=null&&W.delay?en(W.delay):Pe(!1)},activeAnchor:k,place:ve.place,isOpen:!!(Ge&&!x&&qe&&nn)})),Ge&&!x&&qe?v.createElement(m,{id:t,role:Y,className:wt("react-tooltip",mr.tooltip,Bo.tooltip,Bo[o],n,`react-tooltip__place-${ve.place}`,mr[nn?"show":"closing"],nn?"react-tooltip__show":"react-tooltip__closing",f==="fixed"&&mr.fixed,b&&mr.clickable),onTransitionEnd:W=>{St(F),Ee||W.propertyName!=="opacity"||(Ke(!1),At(null),B==null||B())},style:{...G,...ve.tooltipStyles,opacity:j!==void 0&&nn?j:void 0},ref:U},qe,v.createElement(m,{className:wt("react-tooltip-arrow",mr.arrow,Bo.arrow,r,y&&mr.noArrow),style:{...ve.tooltipArrowStyles,background:M?`linear-gradient(to right bottom, transparent 50%, ${M} 50%)`:void 0},ref:ee})):null},nw=({content:e})=>v.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),rw=v.forwardRef(({id:e,anchorId:t,anchorSelect:n,content:r,html:o,render:i,className:s,classNameArrow:a,variant:c="dark",place:u="top",offset:d=10,wrapper:f="div",children:p=null,events:m=["hover"],openOnClick:g=!1,positionStrategy:w="absolute",middlewares:h,delayShow:x=0,delayHide:y=0,float:b=!1,hidden:C=!1,noArrow:_=!1,clickable:S=!1,closeOnEsc:T=!1,closeOnScroll:N=!1,closeOnResize:P=!1,openEvents:q,closeEvents:G,globalCloseEvents:z,imperativeModeOnly:ne=!1,style:B,position:ce,isOpen:oe,defaultIsOpen:te=!1,disableStyleInjection:ge=!1,border:we,opacity:R,arrowColor:k,setIsOpen:$,afterShow:L,afterHide:j,disableTooltip:M,role:Y="tooltip"},Z)=>{const[U,ee]=v.useState(r),[Q,de]=v.useState(o),[F,ve]=v.useState(u),[H,Ee]=v.useState(c),[Le,Ge]=v.useState(d),[Ke,Ie]=v.useState(x),[At,Qe]=v.useState(y),[mt,Pt]=v.useState(b),[Dt,Xe]=v.useState(C),[We,$e]=v.useState(f),[Ae,Mt]=v.useState(m),[tt,Yt]=v.useState(w),[hn,gt]=v.useState(null),[Pe,Zt]=v.useState(null),mn=v.useRef(ge),{anchorRefs:en,activeAnchor:Vn}=Xu(e),ct=Re=>Re==null?void 0:Re.getAttributeNames().reduce((nt,re)=>{var me;return re.startsWith("data-tooltip-")&&(nt[re.replace(/^data-tooltip-/,"")]=(me=Re==null?void 0:Re.getAttribute(re))!==null&&me!==void 0?me:null),nt},{}),tn=Re=>{const nt={place:re=>{var me;ve((me=re)!==null&&me!==void 0?me:u)},content:re=>{ee(re??r)},html:re=>{de(re??o)},variant:re=>{var me;Ee((me=re)!==null&&me!==void 0?me:c)},offset:re=>{Ge(re===null?d:Number(re))},wrapper:re=>{var me;$e((me=re)!==null&&me!==void 0?me:f)},events:re=>{const me=re==null?void 0:re.split(" ");Mt(me??m)},"position-strategy":re=>{var me;Yt((me=re)!==null&&me!==void 0?me:w)},"delay-show":re=>{Ie(re===null?x:Number(re))},"delay-hide":re=>{Qe(re===null?y:Number(re))},float:re=>{Pt(re===null?b:re==="true")},hidden:re=>{Xe(re===null?C:re==="true")},"class-name":re=>{gt(re)}};Object.values(nt).forEach(re=>re(null)),Object.entries(Re).forEach(([re,me])=>{var qe;(qe=nt[re])===null||qe===void 0||qe.call(nt,me)})};v.useEffect(()=>{ee(r)},[r]),v.useEffect(()=>{de(o)},[o]),v.useEffect(()=>{ve(u)},[u]),v.useEffect(()=>{Ee(c)},[c]),v.useEffect(()=>{Ge(d)},[d]),v.useEffect(()=>{Ie(x)},[x]),v.useEffect(()=>{Qe(y)},[y]),v.useEffect(()=>{Pt(b)},[b]),v.useEffect(()=>{Xe(C)},[C]),v.useEffect(()=>{Yt(w)},[w]),v.useEffect(()=>{mn.current!==ge&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")},[ge]),v.useEffect(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:ge==="core",disableBase:ge}}))},[]),v.useEffect(()=>{var Re;const nt=new Set(en);let re=n;if(!re&&e&&(re=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),re)try{document.querySelectorAll(re).forEach(se=>{nt.add({current:se})})}catch{console.warn(`[react-tooltip] "${re}" is not a valid CSS selector`)}const me=document.querySelector(`[id='${t}']`);if(me&&nt.add({current:me}),!nt.size)return()=>null;const qe=(Re=Pe??me)!==null&&Re!==void 0?Re:Vn.current,nn=new MutationObserver(se=>{se.forEach(le=>{var je;if(!qe||le.type!=="attributes"||!(!((je=le.attributeName)===null||je===void 0)&&je.startsWith("data-tooltip-")))return;const Ue=ct(qe);tn(Ue)})}),W={attributes:!0,childList:!1,subtree:!1};if(qe){const se=ct(qe);tn(se),nn.observe(qe,W)}return()=>{nn.disconnect()}},[en,Vn,Pe,t,n]),v.useEffect(()=>{B!=null&&B.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),we&&!Oc("border",`${we}`)&&console.warn(`[react-tooltip] "${we}" is not a valid \`border\`.`),B!=null&&B.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),R&&!Oc("opacity",`${R}`)&&console.warn(`[react-tooltip] "${R}" is not a valid \`opacity\`.`)},[]);let gn=p;const Kn=v.useRef(null);if(i){const Re=i({content:(Pe==null?void 0:Pe.getAttribute("data-tooltip-content"))||U||null,activeAnchor:Pe});gn=Re?v.createElement("div",{ref:Kn,className:"react-tooltip-content-wrapper"},Re):null}else U&&(gn=U);Q&&(gn=v.createElement(nw,{content:Q}));const yn={forwardRef:Z,id:e,anchorId:t,anchorSelect:n,className:wt(s,hn),classNameArrow:a,content:gn,contentWrapperRef:Kn,place:F,variant:H,offset:Le,wrapper:We,events:Ae,openOnClick:g,positionStrategy:tt,middlewares:h,delayShow:Ke,delayHide:At,float:mt,hidden:Dt,noArrow:_,clickable:S,closeOnEsc:T,closeOnScroll:N,closeOnResize:P,openEvents:q,closeEvents:G,globalCloseEvents:z,imperativeModeOnly:ne,style:B,position:ce,isOpen:oe,defaultIsOpen:te,border:we,opacity:R,arrowColor:k,setIsOpen:$,afterShow:L,afterHide:j,disableTooltip:M,activeAnchor:Pe,setActiveAnchor:Re=>Zt(Re),role:Y};return v.createElement(tw,{...yn})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||xc({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||xc({css:`
49
+ .styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:8px;height:8px}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:"base"})});function iw(){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 ow({id:e,tooltipText:t}){return l.jsxs(l.Fragment,{children:[l.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:iw()}),l.jsx(rw,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}const sw="Each field must be mapped to a unique value";function da({field:e,onSelectChange:t,allFields:n}){var y;const{configureState:r,selectedObjectName:o,setConfigureState:i}=xt(),[s,a]=v.useState(!0),{isError:c,removeError:u,getError:d}=Rt(),f=(y=r==null?void 0:r.read)==null?void 0:y.selectedFieldMappings,p=f==null?void 0:f[e.mapToName];v.useEffect(()=>{e._default&&!p&&o&&r&&si(o,i,[{field:e.mapToName,value:e._default}]),a(!1)},[e,i,o,p,r]);const m=v.useMemo(()=>n.map(b=>({id:b.fieldName,label:b.displayName,value:b.fieldName})),[n]),g=l.jsx(oa,{disabled:s,items:m,selectedValue:p||null,onSelectedItemChange:b=>{t({target:{name:e.mapToName,value:b==null?void 0:b.value}})},placeholder:"Please select one",style:{width:"100%"}}),w=v.useCallback(()=>{o&&(si(o,i,[{field:e.mapToName,value:null}]),c(ue.MAPPING,o)&&u(ue.MAPPING,o))},[e.mapToName,o,i,c,u]),{hasDuplicationError:h,errorMessage:x}=v.useMemo(()=>{const b=d(ue.MAPPING,o),C=Array.isArray(b)&&b.length>0&&b.includes(e.mapToName);return{hasDuplicationError:C,errorMessage:C?sw:""}},[o,d,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}),l.jsx("span",{children:(e==null?void 0:e.prompt)&&l.jsx(ow,{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:[g,l.jsx(ot,{type:"button",variant:"ghost",onClick:w,children:"Clear"})]})]},e.mapToName),h&&l.jsxs("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:[" ",x," "]},e.mapToName)]})}const aw="_formControl_9qd8d_1",cw="_formLabel_9qd8d_5",lw="_formLabelRequired_9qd8d_11",uw="_formInput_9qd8d_16",dw="_formInputInvalid_9qd8d_20",fw="_formError_9qd8d_24",pw="_disabled_9qd8d_30",Bn={formControl:aw,formLabel:cw,formLabelRequired:lw,formInput:uw,formInputInvalid:dw,formError:fw,disabled:pw};function _o({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:o=!1,errorMessage:i,children:s}){return l.jsxs("div",{className:wt(Bn.formControl,{[Bn.disabled]:r}),children:[t&&l.jsx("label",{htmlFor:e,className:wt(Bn.formLabel,{[Bn.formLabelRequired]:n}),children:t}),l.jsx("div",{id:e,className:wt(Bn.formInput,{[Bn.formInputInvalid]:o}),children:s}),o&&i&&l.jsx("div",{className:Bn.formError,role:"alert",children:i})]})}const hw="_divider_1kmoj_1",Tc={divider:hw};function xo({className:e,style:t}){return l.jsx("hr",{className:e?`${Tc.divider} ${e}`:Tc.divider,style:t})}function Jr({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(xo,{style:{width:"100%",marginLeft:"1rem"}})})]})}function Yu({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 mw({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(_o,{id:r.mapToName,children:l.jsx(da,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function gw(){var g,w;const{selectedObjectName:e,configureState:t,setConfigureState:n}=xt(),{isError:r,removeError:o,setError:i}=Rt(),s=((g=t==null?void 0:t.read)==null?void 0:g.allFields)||[],{fieldMapping:a}=et(),c=(w=t==null?void 0:t.read)==null?void 0:w.selectedFieldMappings,u=h=>{const{value:x,name:y}=h.target;!x||Yu({selectedFieldMappings:c,selectedObjectName:e,fieldName:y,fieldValue:x,setError:i})||(e&&si(e,n,[{field:y,value:x}]),r(ue.MAPPING,y)&&o(ue.MAPPING,y),e&&r(ue.MAPPING,e)&&o(ue.MAPPING,e))},d=v.useMemo(()=>!e||!a?[]:Object.values(a[e]||{}).flat().filter(h=>!h.fieldName),[a,e]),f=v.useMemo(()=>{var y;return(((y=t==null?void 0:t.read)==null?void 0:y.optionalMapFields)||[]).filter(b=>!d.some(C=>C.mapToName===b.mapToName))},[t,d]),p=d.length>0;return f.length>0||p?l.jsxs(l.Fragment,{children:[l.jsx(Jr,{string:"Map the following optional fields"}),l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:[f==null?void 0:f.map(h=>l.jsx(_o,{id:h.mapToName,children:l.jsx(da,{allFields:s,field:h,onSelectChange:u})},h.mapToName)),p&&l.jsx(mw,{dynamicFieldMappings:d,onSelectChange:u,allFields:s})]})]}):null}function yw(){var u;const{selectedObjectName:e,configureState:t,setConfigureState:n}=xt(),{isError:r,removeError:o,setError:i}=Rt(),s=(u=t==null?void 0:t.read)==null?void 0:u.selectedFieldMappings,a=d=>{const{value:f,name:p}=d.target;!f||Yu({selectedFieldMappings:s,selectedObjectName:e,fieldName:p,fieldValue:f,setError:i})||(e&&si(e,n,[{field:p,value:f}]),r(ue.MAPPING,p)&&o(ue.MAPPING,p),e&&r(ue.MAPPING,e)&&o(ue.MAPPING,e))},c=v.useMemo(()=>{var d;return((d=t==null?void 0:t.read)==null?void 0:d.requiredMapFields)||[]},[t]);return c!=null&&c.length?l.jsxs(l.Fragment,{children:[l.jsx(Jr,{string:"Map the following fields"}),l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:c.map(d=>{var f;return l.jsx(_o,{id:d.mapToName,isInvalid:r(ue.MAPPING,d.mapToName),errorMessage:"* required",children:l.jsx(da,{allFields:((f=t==null?void 0:t.read)==null?void 0:f.allFields)||[],field:d,onSelectChange:a})},d.mapToName)})})]}):null}const vw={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function ww({children:e,style:t}){return l.jsx(kn,{style:{...vw,...t},children:e})}const Iw=e=>{const t=pr(),{provider:n}=et(),r=e||n;return qr({queryKey:["amp","providerInfo",r],queryFn:async()=>{if(!r)throw new Error("Provider not found");return(await t()).providerApi.getProvider({provider:r})},enabled:!!r})},jn=e=>{const t=Iw(e),{data:n}=t,{provider:r}=et(),o=n&&Ol(n==null?void 0:n.name,n);return{...t,providerName:o,selectedProvider:e||r}};function bw(){var u,d,f;const{project:e}=ke(),{hydratedRevision:t}=pn(),{selectedObjectName:n}=xt(),{providerName:r}=jn(),o=e==null?void 0:e.appName,i=(f=(d=(u=t==null?void 0:t.content)==null?void 0:u.read)==null?void 0:d.objects)==null?void 0:f.find(p=>p.objectName===n),s=(i==null?void 0:i.displayName)||n&&Pr(n),a=i==null?void 0:i.mapToName,c=(i==null?void 0:i.mapToDisplayName)||a&&Pr(a);return c&&o&&r?l.jsx(ww,{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 Rc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Zu(...e){return t=>{let n=!1;const r=e.map(o=>{const i=Rc(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():Rc(e[o],null)}}}}function ci(...e){return K.useCallback(Zu(...e),e)}function Co(e,t=[]){let n=[];function r(i,s){const a=K.createContext(s),c=n.length;n=[...n,s];const u=f=>{var x;const{scope:p,children:m,...g}=f,w=((x=p==null?void 0:p[e])==null?void 0:x[c])||a,h=K.useMemo(()=>g,Object.values(g));return l.jsx(w.Provider,{value:h,children:m})};u.displayName=i+"Provider";function d(f,p){var w;const m=((w=p==null?void 0:p[e])==null?void 0:w[c])||a,g=K.useContext(m);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[u,d]}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,_w(o,...t)]}function _w(...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:u})=>{const f=c(i)[`__scope${u}`];return{...a,...f}},{});return K.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function $t(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function fa(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)},[])}function pa({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=xw({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,a=fa(n),c=K.useCallback(u=>{if(i){const f=typeof u=="function"?u(e):u;f!==e&&a(f)}else o(u)},[i,e,o,a]);return[s,c]}function xw({defaultProp:e,onChange:t}){const n=K.useState(e),[r]=n,o=K.useRef(r),i=fa(t);return K.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}function Cw(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])}var ao=globalThis!=null&&globalThis.document?K.useLayoutEffect:()=>{};function Ow(e){const[t,n]=K.useState(void 0);return ao(()=>{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,u=Array.isArray(c)?c[0]:c;s=u.inlineSize,a=u.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 Ew(e,t){return K.useReducer((n,r)=>t[n][r]??n,e)}var ha=e=>{const{present:t,children:n}=e,r=Sw(t),o=typeof n=="function"?n({present:r.isPresent}):K.Children.only(n),i=ci(r.ref,Nw(o));return typeof n=="function"||r.isPresent?K.cloneElement(o,{ref:i}):null};ha.displayName="Presence";function Sw(e){const[t,n]=K.useState(),r=K.useRef({}),o=K.useRef(e),i=K.useRef("none"),s=e?"mounted":"unmounted",[a,c]=Ew(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return K.useEffect(()=>{const u=Vi(r.current);i.current=a==="mounted"?u:"none"},[a]),ao(()=>{const u=r.current,d=o.current;if(d!==e){const p=i.current,m=Vi(u);e?c("MOUNT"):m==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&p!==m?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),ao(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=m=>{const w=Vi(r.current).includes(m.animationName);if(m.target===t&&w&&(c("ANIMATION_END"),!o.current)){const h=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=h)})}},p=m=>{m.target===t&&(i.current=Vi(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:K.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function Vi(e){return(e==null?void 0:e.animationName)||"none"}function Nw(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 co=K.forwardRef((e,t)=>{const{children:n,...r}=e,o=K.Children.toArray(n),i=o.find(Rw);if(i){const s=i.props.children,a=o.map(c=>c===i?K.Children.count(s)>1?K.Children.only(null):K.isValidElement(s)?s.props.children:null:c);return l.jsx(Ss,{...r,ref:t,children:K.isValidElement(s)?K.cloneElement(s,void 0,a):null})}return l.jsx(Ss,{...r,ref:t,children:n})});co.displayName="Slot";var Ss=K.forwardRef((e,t)=>{const{children:n,...r}=e;if(K.isValidElement(n)){const o=Pw(n);return K.cloneElement(n,{...Aw(r,n.props),ref:t?Zu(t,o):o})}return K.Children.count(n)>1?K.Children.only(null):null});Ss.displayName="SlotClone";var Tw=({children:e})=>l.jsx(l.Fragment,{children:e});function Rw(e){return K.isValidElement(e)&&e.type===Tw}function Aw(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)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function Pw(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 Dw=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Ln=Dw.reduce((e,t)=>{const n=K.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?co:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(a,{...s,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),ma="Checkbox",[Mw,s_]=Co(ma),[Fw,kw]=Mw(ma),ed=K.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:c="on",onCheckedChange:u,form:d,...f}=e,[p,m]=K.useState(null),g=ci(t,C=>m(C)),w=K.useRef(!1),h=p?d||!!p.closest("form"):!0,[x=!1,y]=pa({prop:o,defaultProp:i,onChange:u}),b=K.useRef(x);return K.useEffect(()=>{const C=p==null?void 0:p.form;if(C){const _=()=>y(b.current);return C.addEventListener("reset",_),()=>C.removeEventListener("reset",_)}},[p,y]),l.jsxs(Fw,{scope:n,state:x,disabled:a,children:[l.jsx(Ln.button,{type:"button",role:"checkbox","aria-checked":Pn(x)?"mixed":x,"aria-required":s,"data-state":rd(x),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:g,onKeyDown:$t(e.onKeyDown,C=>{C.key==="Enter"&&C.preventDefault()}),onClick:$t(e.onClick,C=>{y(_=>Pn(_)?!0:!_),h&&(w.current=C.isPropagationStopped(),w.current||C.stopPropagation())})}),h&&l.jsx(jw,{control:p,bubbles:!w.current,name:r,value:c,checked:x,required:s,disabled:a,form:d,style:{transform:"translateX(-100%)"},defaultChecked:Pn(i)?!1:i})]})});ed.displayName=ma;var td="CheckboxIndicator",nd=K.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=kw(td,n);return l.jsx(ha,{present:r||Pn(i.state)||i.state===!0,children:l.jsx(Ln.span,{"data-state":rd(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});nd.displayName=td;var jw=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:o,...i}=e,s=K.useRef(null),a=Cw(n),c=Ow(t);K.useEffect(()=>{const d=s.current,f=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(f,"checked").set;if(a!==n&&m){const g=new Event("click",{bubbles:r});d.indeterminate=Pn(n),m.call(d,Pn(n)?!1:n),d.dispatchEvent(g)}},[a,n,r]);const u=K.useRef(Pn(n)?!1:n);return l.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o??u.current,...i,tabIndex:-1,ref:s,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Pn(e){return e==="indeterminate"}function rd(e){return Pn(e)?"indeterminate":e?"checked":"unchecked"}var id=ed,od=nd;function sd(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 Lw=["color"],ad=v.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=sd(e,Lw);return v.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}),v.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"}))}),Vw=["color"],Kw=v.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=sd(e,Vw);return v.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}),v.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 $w="_checkboxGroupContainer_1ya1t_1",qw="_stack_1ya1t_6",Uw="_selectAllContainer_1ya1t_11",Hw="_fieldContainer_1ya1t_18",Bw="_checkbox_1ya1t_1",Kr={checkboxGroupContainer:$w,stack:qw,selectAllContainer:Uw,fieldContainer:Hw,checkbox:Bw};function cd({id:e,isChecked:t,label:n,onCheckedChange:r}){return l.jsxs("div",{className:Kr.fieldContainer,children:[l.jsx(id,{className:Kr.checkbox,id:e,onCheckedChange:r,checked:t,children:l.jsx(od,{children:l.jsx(ad,{})})}),l.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function ld({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:o}){return l.jsxs("div",{className:Kr.selectAllContainer,children:[l.jsx(id,{className:Kr.checkbox,id:e,onCheckedChange:r,children:l.jsxs(od,{children:[o&&l.jsx(Kw,{}),t===!0&&l.jsx(ad,{})]})}),l.jsx("label",{htmlFor:e,children:n})]})}function ud({children:e}){return l.jsx("div",{className:Kr.checkboxGroupContainer,children:e})}function dd({children:e}){return l.jsx("div",{className:Kr.stack,children:e})}function Ww(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=!jl(s,r);e.read.isOptionalFieldsModified=c}else console.warn("read.savedConfig.optionalFields is undefined")}function Ac(e,t,n,r){t(e,o=>Ww(o,n,r))}function Jw(){var f,p;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=xt(),o=(f=t==null?void 0:t.read)==null?void 0:f.selectedOptionalFields,i=(m,g)=>{m!=="indeterminate"&&r&&t&&Ac(r,n,g,m)},s=(p=t==null?void 0:t.read)==null?void 0:p.optionalFields,a=m=>{r&&s&&s.forEach(g=>{Dn(g)||Ac(r,n,g.fieldName,m)})},c=!!(s&&s.length>0),u=Object.keys(o||{}).length===(s==null?void 0:s.length),d=!u&&Object.keys(o||{}).length>0;return c&&l.jsxs(l.Fragment,{children:[l.jsx(Jr,{string:`${e} reads the following optional fields`}),l.jsxs(ud,{children:[((s==null?void 0:s.length)||0)>=2&&l.jsx(ld,{id:"select-all-fields",isChecked:u,label:"Select all",onCheckedChange:a,isIndeterminate:d}),l.jsx(dd,{children:s.map(m=>Dn(m)?null:l.jsx(cd,{id:m.fieldName,isChecked:!!(o!=null&&o[m==null?void 0:m.fieldName]),label:m.displayName,onCheckedChange:g=>i(g,m.fieldName)},m.fieldName))})]})]})}function zw(){return l.jsx(Jw,{})}const Gw={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 Qw({children:e,style:t,...n}){return l.jsx("span",{style:{...Gw,...t},...n,children:e})}function Xw(){var r,o,i;const{configureState:e,selectedObjectName:t}=xt(),{appName:n}=ke();return l.jsxs(l.Fragment,{children:[l.jsx(Jr,{string:`${n} reads the following ${t} fields`}),l.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:(o=(r=e==null?void 0:e.read)==null?void 0:r.requiredFields)!=null&&o.length?(i=e.read)==null?void 0:i.requiredFields.map(s=>Dn(s)?null:l.jsx(Qw,{children:s.displayName},s.fieldName)):"There are no required fields."})]})}function Yw(e,t,n,r,o){e.read&&(e.read.selectedValueMappings||(e.read.selectedValueMappings={}),e.read.selectedValueMappings[o]||(e.read.selectedValueMappings[o]={}),e.read.selectedValueMappings[o][n]=r)}function Zw(e,t,n,r,o){t(e,i=>Yw(i,e,n,r,o))}function eI(e,t,n){t(e,r=>{r.read&&(r.read.isValueMappingsModified=n)})}function tI({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(xo,{style:{width:"100%",marginLeft:"1rem"}})})]})}function nI({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r,hasError:o}){var y;const{configureState:i,selectedObjectName:s,setConfigureState:a}=xt(),[c,u]=v.useState(!0),{getError:d,setError:f,resetBoundary:p}=Rt(),m=v.useMemo(()=>{var b,C;return((C=(b=i==null?void 0:i.read)==null?void 0:b.selectedValueMappings)==null?void 0:C[n])||{}},[(y=i==null?void 0:i.read)==null?void 0:y.selectedValueMappings,n]),g=v.useMemo(()=>m==null?void 0:m[e.mappedValue],[m,e.mappedValue]);v.useEffect(()=>{u(!1)},[e,a,s,g,i]);const w=v.useMemo(()=>r.map(b=>({id:b.value,label:b.displayValue,value:b.value})),[r]),h=v.useCallback(b=>{if(b){if(Object.values(m).some(C=>C===b.value&&C!==g)){const C=[...Object.entries(m).filter(([_,S])=>S===b.value&&S!==g).map(([_])=>_),e.mappedValue];f(ue.VALUE_MAPPING,n,C);return}d(ue.VALUE_MAPPING,n)&&p(ue.VALUE_MAPPING),t({target:{name:e.mappedValue,value:b.value,fieldName:n}})}},[t,m,g,n,e.mappedValue,p,f,d]),x=v.useMemo(()=>l.jsx(oa,{disabled:c,items:w,selectedValue:g||null,onSelectedItemChange:h,placeholder:"Please select one",style:{border:o?"2px solid red":void 0,borderRadius:"8px"}},g),[g,c,w,h,o]);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})}),x]},e.mappedValue)}function rI(){var m,g,w;const{fieldMapping:e}=et(),{selectedObjectName:t,configureState:n,setConfigureState:r}=xt(),{isError:o,removeError:i,getError:s}=Rt(),a=(m=n==null?void 0:n.read)==null?void 0:m.selectedFieldMappings,c=(g=n==null?void 0:n.read)==null?void 0:g.selectedValueMappings,u=(w=n==null?void 0:n.read)==null?void 0:w.isValueMappingsModified,d=v.useRef(!1),f=v.useMemo(()=>{const h=t&&e?Object.values(e[t]||{}).flat().filter(x=>x.mappedValues).map(x=>({...x})):[];if(a)for(let x=0;x<h.length;x+=1){const{mapToName:y}=h[x];a!=null&&a[y]&&(h[x].fieldName=a[y])}return h},[t,e,a]),p=v.useCallback(h=>{const{value:x,name:y,fieldName:b}=h.target;x&&(t&&Zw(t,r,y,x,b),o(ue.VALUE_MAPPING,y)&&i(ue.VALUE_MAPPING,y))},[t,r,o,i]);return v.useEffect(()=>{var h;if(t&&c){const x=((h=e==null?void 0:e[t])==null?void 0:h.filter(b=>b.fieldName&&b.mappedValues.length>0))||[];x.every(b=>{const C=c[b.fieldName]||{};return Object.keys(C).length===Object.keys(b.mappedValues).length})&&x.length>0?!u&&!d.current&&(eI(t,r,!0),d.current=!0):d.current=!1}},[c,f,t,r,e,u]),f!=null&&f.length?l.jsx(l.Fragment,{children:f.map(h=>{var S,T,N;if(!h.fieldName)return console.error("fieldName is undefined",h),null;const x=(T=(S=n==null?void 0:n.read)==null?void 0:S.allFieldsMetadata)==null?void 0:T[h.fieldName],y=x==null?void 0:x.valueType;if(!["singleSelect","multiSelect"].includes(y))return console.error("fieldName is not a singleSelect or multiSelect",h),null;const b=x==null?void 0:x.values;if(!b)return console.error("field has no values array",h),null;const C=Object.keys(b).length,_=Object.keys((h==null?void 0:h.mappedValues)||[]).length;return C!==_?(console.error("field values and the values to be mapped are not of the same length",h,b),null):l.jsxs(l.Fragment,{children:[l.jsx(tI,{string:"Map the values for ",fieldName:h.mapToName||h.fieldName}),l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:l.jsx(_o,{id:h.mapToName||h.fieldName,children:(N=h==null?void 0:h.mappedValues)==null?void 0:N.map(P=>{var ne,B,ce;const q=s(ue.VALUE_MAPPING,h.fieldName),G=Array.isArray(q)&&q.includes(P.mappedValue),z=((ce=(B=(ne=n==null?void 0:n.read)==null?void 0:ne.allFieldsMetadata)==null?void 0:B[h.fieldName])==null?void 0:ce.values)||[];return l.jsxs(l.Fragment,{children:[l.jsx(nI,{allValueOptions:z,mappedValue:P,onSelectChange:p,fieldName:(h==null?void 0:h.fieldName)||"",hasError:G},`${P.mappedValue}-${h.fieldName}`),G&&l.jsx("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:`Each ${h.mapToName||h.fieldName} must be mapped to a unique value`},P.mappedValue)]})})},h.mapToName||h.fieldName)})]})})}):null}function iI(){return ry(),l.jsxs(l.Fragment,{children:[l.jsx(bw,{}),l.jsx(Xw,{}),l.jsx(yw,{}),l.jsx(gw,{}),l.jsx(rI,{}),l.jsx(zw,{})]})}const oI="_input_10rzg_1",sI="_inputError_10rzg_27",aI="_error_10rzg_43",Wo={input:oI,inputError:sI,error:aI};function lo({id:e,type:t,className:n,isError:r=!1,...o}){const i=r?wt(Wo.inputError,Wo.input):Wo.input;return l.jsx("input",{id:e,type:t,className:wt(i,n),...o})}function cI({objectName:e,onAddDefaultValue:t}){const{readAction:n,loading:r}=pn(),[o,i]=v.useState(null),[s,a]=v.useState(""),c=n&&ks(n,e),u=v.useMemo(()=>(c==null?void 0:c.allFields)||[],[c]),d=r||!u||u.length===0,f=v.useMemo(()=>u.map(h=>({id:h.fieldName,label:h.displayName,value:h.fieldName})),[u]),p=h=>{const{value:x,name:y}=h.target;x&&i({label:y,value:x})},m=h=>{const{value:x}=h.target;a(x)},g=()=>{s&&(o!=null&&o.value)&&(t(o==null?void 0:o.value,o.label,s),i(null),a(""))},w=l.jsx(oa,{style:{width:"100%"},disabled:d,items:f,selectedValue:(o==null?void 0:o.value)||null,onSelectedItemChange:h=>{p({target:{name:h==null?void 0:h.label,value:h==null?void 0:h.value}})},placeholder:"Please select field."});return l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[w,l.jsx(lo,{id:"new-default-value",type:"text",value:s,onChange:m,style:{width:"10rem"},placeholder:"default value"}),l.jsx(ot,{type:"button",onClick:g,variant:"ghost",children:"+"})]})}function lI(e,t,n,r){var o,i,s,a;if(((o=e==null?void 0:e.write)==null?void 0:o.selectedWriteObjects)===null&&(e.write.selectedWriteObjects={}),e!=null&&e.write){const c=e.write.selectedWriteObjects;if(r&&(c[t]||(c[t]={}),c[t].selectedValueDefaults||(c[t].selectedValueDefaults={}),c[t].selectedValueDefaults[n]=r),r||(i=c[t])!=null&&i.selectedValueDefaults&&delete c[t].selectedValueDefaults[n],(a=(s=e==null?void 0:e.write)==null?void 0:s.savedConfig)!=null&&a.selectedWriteObjects){const u=e.write.savedConfig.selectedWriteObjects,f=!kl(u,c);e.write.isWriteModified=f}}}function Pc(e,t,n,r,o){o(e,i=>{lI(i,t,n,r)})}const uI=(e,t,n)=>{var i;const r=n&&ks(n,t),o=r==null?void 0:r.allFieldsMetadata;return((i=o==null?void 0:o[e])==null?void 0:i.displayName)||e};function dI({objectName:e}){var f;const{readAction:t}=pn(),{selectedObjectName:n,configureState:r,setConfigureState:o}=xt(),i=(f=r==null?void 0:r.write)==null?void 0:f.selectedWriteObjects,s=i==null?void 0:i[e],a=v.useMemo(()=>(s==null?void 0:s.selectedValueDefaults)||{},[s]),c=v.useCallback((p,m,g)=>{Pc(n||"",e,p,g,o)},[e,n,o]),u=p=>{Pc(n||"",e,p,null,o)},d=Object.keys(a).map(p=>({field:p,defaultValue:a[p],fieldDisplayName:t?uI(p,e,t):p}));return l.jsxs(l.Fragment,{children:[l.jsx("div",{style:{paddingBottom:"1rem",display:"flex",flexDirection:"column",gap:".5rem"},children:d.map(({field:p,fieldDisplayName:m,defaultValue:g})=>l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[l.jsx(lo,{id:p,type:"text",disabled:!0,value:m,style:{width:"100%"}}),l.jsx(lo,{id:`${p}-${g}`,type:"text",disabled:!0,value:g,style:{width:"10rem"}}),l.jsx(ot,{type:"button",variant:"ghost",onClick:()=>u(p),children:"x"})]},`${p}-${g}`))}),l.jsx(cI,{objectName:e,onAddDefaultValue:c}),l.jsx("div",{style:{textAlign:"right",padding:".25rem 0",color:"var(--amp-colors-text-muted)"},children:"click + to confirm"})]})}const fI=(e,t)=>!!t.find(n=>{var r;return n.objectName===e&&((r=n==null?void 0:n.valueDefaults)==null?void 0:r.allowAnyFields)});function pI(){var o;const{configureState:e}=xt(),{writeObjects:t}=pn(),n=(o=e==null?void 0:e.write)==null?void 0:o.selectedWriteObjects;return!!t&&l.jsx(l.Fragment,{children:t.map(i=>n!=null&&n[i.objectName]&&fI(i.objectName,t)?l.jsxs(l.Fragment,{children:[l.jsx(Jr,{string:`Defaults for ${i.displayName} `}),l.jsx(dI,{objectName:i.objectName})]}):null)})}function hI(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,u=!kl(a,s);e.write.isWriteModified=u}}}function Dc(e,t,n,r){t(e,o=>{hI(o,n,r)})}function mI(){var f,p,m,g;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=xt(),o=(f=n==null?void 0:n.write)==null?void 0:f.selectedWriteObjects,i=(p=n==null?void 0:n.write)==null?void 0:p.writeObjects,s=(w,h)=>{w!=="indeterminate"&&t&&n&&Dc(t,r,h,w)},a=w=>{var h,x;t&&n&&((x=(h=n==null?void 0:n.write)==null?void 0:h.writeObjects)==null||x.forEach(y=>{Dc(t,r,y.objectName,w)}))},c=!!i,u=Object.keys(o||{}).length===((g=(m=n==null?void 0:n.write)==null?void 0:m.writeObjects)==null?void 0:g.length),d=!u&&Object.keys(o||{}).length>0;return c&&l.jsxs(l.Fragment,{children:[l.jsx(Jr,{string:`Allow ${e} to write to these objects`}),l.jsxs(ud,{children:[((i==null?void 0:i.length)||0)>=2&&l.jsx(ld,{id:"select-all-fields",onCheckedChange:a,isIndeterminate:d,isChecked:u,label:"Select all"}),l.jsx(dd,{children:i.map(w=>l.jsx(cd,{id:w.objectName,onCheckedChange:h=>s(h,w.objectName),isChecked:!!(o!=null&&o[w.objectName]),label:w.displayName},w.objectName))})]})]})}function gI(){return l.jsxs(l.Fragment,{children:[l.jsx(mI,{}),l.jsx(pI,{})]})}function fd({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const r=fr(),{projectId:o}=ke(),{integrationId:i,installation:s,resetInstallations:a,setIntegrationDeleted:c,onUninstallSuccess:u}=et(),[d,f]=v.useState(!1),p=!o||!i||!(s!=null&&s.id)||d,m=async()=>{if(!p){f(!0),console.warn("uninstalling installation",{projectId:o,integrationId:i,installationId:s.id});try{await dn().installationApi.deleteInstallation({projectIdOrName:o,integrationId:i,installationId:s.id},{headers:{"X-Api-Key":r,"Content-Type":"application/json"}}),console.warn("successfully uninstalled installation:",s.id),u==null||u(s==null?void 0:s.id),a(),c()}catch(h){console.error("Error uninstalling installation."),ht(h)}finally{f(!1)}}},g=d?"Uninstalling...":e,w=l.jsx(ot,{type:"button",onClick:m,disabled:p,variant:t,style:n,children:g});return s!=null&&s.id?w:null}function yI(){const{installation:e}=et();return l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[e!=null&&e.id?l.jsx("p",{children:"Once you uninstall this integration, its configuration will be lost."}):l.jsx("p",{children:"You've successfully uninstalled the integration."}),l.jsx(fd,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})}function pd({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:o}){var S,T,N,P;const{installation:i}=et(),{hydratedRevision:s,loading:a}=pn(),{configureState:c,selectedObjectName:u}=xt(),d=i==null?void 0:i.config,f=d&&u&&!!Pl(d,u)||!1,p=((S=c==null?void 0:c.read)==null?void 0:S.isOptionalFieldsModified)||((T=c==null?void 0:c.read)==null?void 0:T.isRequiredMapFieldsModified)||((N=c==null?void 0:c.read)==null?void 0:N.isValueMappingsModified),m=(P=c==null?void 0:c.write)==null?void 0:P.isWriteModified,x=a||n||!c||!u||!(p||m||r||u!==sr&&!f),y=u===sr,b=u===Qi,C=l.jsx(ot,{type:"submit",disabled:x,children:r?"Install":"Save"}),_=l.jsx(ot,{type:"button",onClick:t,disabled:x,variant:"ghost",children:"Reset"});return n?l.jsx(ri,{}):l.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[l.jsxs("div",{style:{display:"flex",flexDirection:"row-reverse",gap:".8rem",marginBottom:"20px"},children:[C,_]}),l.jsxs(kn,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[o&&l.jsx(Bl,{children:typeof o=="string"?o:"Installation Failed."}),a&&l.jsx(ri,{}),s&&!b&&!y&&l.jsx(iI,{}),s&&!b&&y&&l.jsx(gI,{}),!a&&b&&l.jsx(yI,{})]})]})}const hd=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:o,onUpdateSuccess:i}=et(),{hydratedRevision:s,loading:a}=pn(),{selectedObjectName:c}=Gl(),{selectedConnection:u}=Br(),d=fr(),{projectId:f}=ke(),{resetBoundary:p,setErrors:m,setError:g,getError:w}=Rt(),{resetConfigureState:h,objectConfigurationsState:x,resetPendingConfigurationState:y}=Ks(),b=Ul(c||"",x),{onNextIncompleteTab:C}=$g(),_=v.useCallback(()=>{p(ue.INSTALLATION_MUTATION)},[p]),S=v.useCallback(N=>N?P=>{g(ue.INSTALLATION_MUTATION,N,P)}:P=>{console.error("objectName is required to set installation error: ",P)},[g]),T=v.useCallback(N=>N?w(ue.INSTALLATION_MUTATION,N):"",[w]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:s,loading:a,selectedObjectName:c,selectedConnection:u,apiKey:d,projectId:f,resetBoundary:p,setErrors:m,setMutateInstallationError:S,getMutateInstallationError:T,resetMutateInstallationErrorState:_,resetConfigureState:h,objectConfigurationsState:x,resetPendingConfigurationState:y,configureState:b,onInstallSuccess:o,onUpdateSuccess:i,onNextIncompleteTab:C}},vI=void 0;function wI(){const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:o,loading:i,selectedObjectName:s,selectedConnection:a,apiKey:c,projectId:u,resetBoundary:d,setErrors:f,setMutateInstallationError:p,getMutateInstallationError:m,resetMutateInstallationErrorState:g,resetConfigureState:w,objectConfigurationsState:h,resetPendingConfigurationState:x,configureState:y,onInstallSuccess:b,onNextIncompleteTab:C}=hd(),[_,S]=v.useState(!1),T=s===sr,N=m(s),P=v.useCallback(()=>{d(ue.MAPPING),o!=null&&o.content&&!i&&s&&Vl(o,vI,s,w)},[d,o,i,s,w]);v.useEffect(()=>{!y&&(o!=null&&o.content)&&!i&&P()},[y,h,o,i,P]);const q=()=>{g();const{requiredMapFields:ne,selectedFieldMappings:B}=(y==null?void 0:y.read)||{},{errorList:ce}=Fl(ne,B,f);ce.length>0||(s&&(a!=null&&a.id)&&c&&u&&e&&t&&n&&o?(S(!0),Tg(u,e,t,n,a.id,s,c,o,y,p(s),r,b).finally(()=>{S(!1),x(s),C()})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},G=()=>{g(),s&&(a!=null&&a.id)&&c&&u&&e&&t&&n&&o?(S(!0),Pg(u,e,t,n,a.id,c,o,y,p(s),r,b).finally(()=>{S(!1),x(s),C()})):console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},z=ne=>{ne.preventDefault(),T?G():q()};return l.jsx(pd,{errorMsg:N,isCreateMode:!0,isLoading:_,onSave:z,onReset:P})}function II({updateConfig:e,projectId:t,integrationId:n,installationId:r,apiKey:o,selectedObjectName:i,setInstallation:s,onUpdateSuccess:a,setError:c}){const u={projectIdOrName:t,installationId:r,integrationId:n,installationUpdate:{updateMask:[`config.content.read.objects.${i}`],installation:{config:e}}};return dn().installationApi.updateInstallation(u,{headers:{"X-Api-Key":o,"Content-Type":"application/json"}}).then(d=>{s(d),a==null||a(d.id,d.config)}).catch(d=>{ht(d,c)})}const bI=(e,t,n,r,o,i)=>{const s=Kl(e),a=$l(e),c=ql(e),u={content:{read:{objects:{[t]:{objectName:t,schedule:r,destination:(n==null?void 0:n.destination)||"",selectedFields:s,selectedFieldMappings:a,selectedValueMappings:c||{},backfill:i}}}}};return po(o)&&(u.content||(u.content={}),u.content.proxy={enabled:!0}),u},_I=(e,t,n,r,o,i,s,a,c,u,d)=>{const f=bI(i,r||"",a,a.schedule,c,a.backfill);return f?II({updateConfig:f,projectId:e,integrationId:t,installationId:n,apiKey:o,selectedObjectName:r,setError:u,setInstallation:s,onUpdateSuccess:d}):(console.error("Error when generating updateConfig from configureState"),Promise.resolve(null))},xI=(e,t)=>{const r={content:{write:{objects:Hl(e)}}};return po(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r},CI=(e,t,n,r,o,i,s,a,c)=>{const u=xI(o,i);if(!u)return console.error("Error when generating write updateConfig from configureState"),Promise.resolve(null);const d={projectIdOrName:e,installationId:n,integrationId:t,installationUpdate:{updateMask:["config.content.write.objects"],installation:{config:u}}};return dn().installationApi.updateInstallation(d,{headers:{"X-Api-Key":r,"Content-Type":"application/json"}}).then(f=>{a(f),c==null||c(f.id,f.config)}).catch(f=>{ht(f,s)})};function OI({installation:e,integrationObj:t}){const{setInstallation:n,hydratedRevision:r,loading:o,selectedObjectName:i,apiKey:s,projectId:a,resetBoundary:c,setErrors:u,setMutateInstallationError:d,getMutateInstallationError:f,resetConfigureState:p,resetPendingConfigurationState:m,configureState:g,onUpdateSuccess:w,onNextIncompleteTab:h}=hd(),[x,y]=v.useState(!1),b=i===sr,C=f(i),{config:_}=e,S=v.useCallback(()=>{c(ue.MAPPING),r!=null&&r.content&&!o&&i&&Vl(r,_,i,p)},[c,r,o,i,_,p]);v.useEffect(()=>{g||S()},[g,S]);const T=v.useMemo(()=>{var z,ne,B;return(B=(ne=(z=r==null?void 0:r.content)==null?void 0:z.read)==null?void 0:ne.objects)==null?void 0:B.find(ce=>(ce==null?void 0:ce.objectName)===i)},[r,i]),N=()=>{const{requiredMapFields:G,selectedFieldMappings:z}=(g==null?void 0:g.read)||{},{errorList:ne}=Fl(G,z,u);ne.length>0||(r&&e&&i&&s&&a&&T?(y(!0),_I(a,t.id,e.id,i,s,g,n,T,r,d(i),w).finally(()=>{y(!1),m(i),h()})):console.error("UpdateInstallation - onSaveUpdate missing required props"))},P=()=>{e&&i&&s&&a&&r?(y(!0),CI(a,t.id,e.id,s,g,r,d(i),n,w).finally(()=>{y(!1),m(i),h()})):console.error("UpdateInstallation - onSaveUpdate missing required props")},q=G=>{G.preventDefault(),b?P():N()};return l.jsx(pd,{errorMsg:C,onSave:q,onReset:S,isLoading:x})}function EI(){const{integrationObj:e,installation:t}=et();return e?t&&e?l.jsx(OI,{installation:t,integrationObj:e}):l.jsx(wI,{}):l.jsx(_l,{message:"We can't load the integration"})}const SI=(e,t)=>({revisionId:e.id,createdBy:`consumer:${t}`,content:{provider:e.content.provider,proxy:{enabled:!0}}});function NI({projectId:e,integrationId:t,groupRef:n,consumerRef:r,connectionId:o,apiKey:i,hydratedRevision:s,setError:a,setInstallation:c,onInstallSuccess:u}){const d=SI(s,r);return d?js({createConfig:d,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:i,setError:a,setInstallation:c,onInstallSuccess:u}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))}function TI(){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 ga({text:e,children:t}){return l.jsx(Ur,{children:l.jsxs(kn,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[l.jsx(TI,{}),l.jsx("p",{children:e}),t]})})}function RI({provider:e}){const{providerName:t}=jn(e),n=`You have successfully installed your ${t} integration.`;return l.jsx(ga,{text:n,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:l.jsx(fd,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const AI=e=>{const{read:t,write:n,proxy:r}=(e==null?void 0:e.content)??{};return!t&&!n&&(r==null?void 0:r.enabled)||!1};function PI({children:e}){var C;const{projectId:t}=ke(),n=fr(),{hydratedRevision:r,loading:o}=pn(),{integrationObj:i,installation:s,groupRef:a,consumerRef:c,setInstallation:u,onInstallSuccess:d,isIntegrationDeleted:f}=et(),{selectedConnection:p,isConnectionsLoading:m}=Br(),[g,w]=v.useState(!1),h=o||g,x=(C=r==null?void 0:r.content)==null?void 0:C.provider,y=AI(r),b=_=>{console.error("Error when creating proxy installation:",_)};return v.useEffect(()=>{!h&&!m&&r&&y&&!s&&p&&n&&(i!=null&&i.id)&&!f&&(w(!0),NI({apiKey:n,projectId:t,integrationId:i==null?void 0:i.id,groupRef:a,consumerRef:c,connectionId:p==null?void 0:p.id,hydratedRevision:r,setError:b,setInstallation:u,onInstallSuccess:d}).then(()=>{w(!1)}).catch(_=>{w(!1),console.error("Error when creating proxy installation:",_)}))},[r,y,s,p,n,t,i==null?void 0:i.id,a,c,u,h,d,f,m]),i?h?l.jsx(Hr,{}):y&&x&&s?l.jsx(RI,{provider:x}):l.jsx("div",{children:e}):l.jsx(zt,{message:"We can't load the integration"})}function Oo(){const e=pr(),t=dr();return Gf({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"),ht(n)}})}function md(){return 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 yi({children:e}){return l.jsx(Ur,{children:l.jsxs(kn,{children:[l.jsx("div",{style:{padding:"3rem 2rem"},children:e}),l.jsx(md,{})]})})}function vi({children:e}){return l.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function wi({error:e}){return e?l.jsx(Bl,{style:{marginTop:"2em"},children:e}):null}function ya({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(yi,{children:[l.jsx(vi,{children:i||`Set up ${r} integration`}),l.jsx(wi,{error:t}),o,l.jsx(ot,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}const DI="_link_oo2kv_1",MI={link:DI};function gd({href:e,className:t,style:n,label:r,children:o,newTab:i=!1}){return l.jsx("a",{className:wt(MI.link,t),style:n,href:e,"aria-label":r||void 0,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:o})}function yd({url:e,providerDisplayName:t,credentialName:n}){return l.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[l.jsx(gd,{href:e,newTab:!0,children:l.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," about where to find your ",t," ",n,"."]})}const FI="_textarea_18zl4_1",kI="_textareaError_18zl4_14",jI="_error_18zl4_29",Jo={textarea:FI,textareaError:kI,error:jI};function LI({className:e,isError:t=!1,...n}){const r=t?wt(Jo.textareaError,Jo.textarea):Jo.textarea;return l.jsx("textarea",{className:wt(e,r),...n})}const un={Input:lo,Textarea:LI};function VI({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){var w;const[i,s]=v.useState(!1),a=()=>s(h=>!h),[c,u]=v.useState(""),d=h=>u(h.currentTarget.value),{providerName:f}=jn(e),p=c.length>0,m=o||!p,g=(w=t.apiKeyOpts)==null?void 0:w.docsURL;return l.jsx(ya,{providerName:f,handleSubmit:()=>{n({apiKey:c})},error:r,isButtonDisabled:m,children:l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[g&&l.jsx(yd,{url:g,providerDisplayName:f||Pr(e),credentialName:"API key"}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(un.Input,{id:"password",name:"password",type:i?"text":"password",placeholder:"API Key",onChange:h=>d(h)}),l.jsx(ot,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,children:i?"Hide":"Show"})]})]})})}function KI({...e}){return l.jsx(VI,{...e})}function $I({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:c}=ke(),u=Oo(),d=v.useCallback(f=>{const{apiKey:p}=f,m={projectIdOrName:c,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,apiKey:p}};u.mutate(m)},[c,i,o,r,n,e,u]);return a===null?l.jsx(KI,{provider:e,providerInfo:t,handleSubmit:d,error:null}):s}function qI({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){var y;const[i,s]=v.useState(!1),a=()=>s(b=>!b),[c,u]=v.useState({username:"",password:""}),{username:d,password:f}=c,{providerName:p}=jn(e),m=p||Pr(e),g=(y=t.basicOpts)==null?void 0:y.docsURL,w=d.length>0,h=o||!w,x=b=>{const{name:C,value:_}=b.currentTarget;u(S=>({...S,[C]:_}))};return l.jsx(ya,{providerName:p,handleSubmit:()=>{n({user:d,pass:f})},error:r,isButtonDisabled:h,children:l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[g&&l.jsx(yd,{url:g,providerDisplayName:m,credentialName:"credentials"}),l.jsx(un.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:b=>x(b)}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(un.Input,{id:"password",name:"password",type:i?"text":"password",placeholder:"Password",onChange:b=>x(b)}),l.jsx(ot,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,children:i?"Hide":"Show"})]})]})})}function UI({...e}){return l.jsx(qI,{...e})}function HI({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:c}=ke(),u=Oo(),d=v.useCallback(f=>{const{user:p,pass:m}=f,g={projectIdOrName:c,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:p,password:m}}};u.mutate(g)},[c,i,o,r,n,e,u]);return a===null?l.jsx(UI,{provider:e,providerInfo:t,handleSubmit:d,error:null}):s}function BI({...e}){return l.jsx(ya,{...e})}function WI({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s,providerName:a}){const{projectIdOrName:c}=ke(),u=Oo(),d=v.useCallback(()=>{const f={projectIdOrName:c,generateConnectionParams:{groupName:o,groupRef:r,consumerName:n,consumerRef:t,provider:e}};u.mutate(f)},[c,o,r,n,t,e,u]);return s===null?l.jsx(BI,{handleSubmit:d,error:null,providerName:a}):i}const JI=Ms("VITE_AMP_ENABLE_CSRF",!1),zI=Ms("NEXT_AMP_ENABLE_CSRF",!1),GI=Ms("REACT_APP_AMP_ENABLE_CSRF",!1),QI=!!JI||!!zI||!!GI,vd=async(e,t,n,r,o,i,s,a)=>{var u,d;const c=await dn().providerApi.getProvider({provider:o},{headers:{"X-Api-Key":r??""}});if(!c)throw new Error(`Provider ${o} not found`);if(c.authType==="oauth2"&&(((u=c.oauth2Opts)==null?void 0:u.grantType)==="authorizationCode"||((d=c.oauth2Opts)==null?void 0:d.grantType)==="authorizationCodePKCE")){const p=(await dn().providerAppApi.listProviderApps({projectIdOrName:e},{headers:{"X-Api-Key":r??""}})).find(h=>h.provider===o),m=Ol(o,c);if(!p)throw new Error(`You must first set up a ${m} Provider App using the Ampersand Console.`);const g={connectOAuthParams:{providerWorkspaceRef:i,projectId:e,groupRef:n,groupName:a,consumerRef:t,consumerName:s,providerAppId:p.id,provider:o,enableCSRFProtection:QI}};return await dn().oAuthApi.oauthConnect(g,{credentials:"include",headers:{"X-Api-Key":r??"","Content-Type":"application/json"}})}throw new Error(`Provider ${o} does not support an OAuth2 web flow.`)},Mc=600,Fc=600,XI="AUTHORIZATION_SUCCEEDED",YI="AUTHORIZATION_FAILED";function ZI(e,t,n,r){return v.useCallback(()=>{if(!r)return;const o=window.screenX+(window.outerWidth-Mc)/2,i=window.screenY+(window.outerHeight-Fc)/2.5,s=`width=${Mc},height=${Fc},left=${o},top=${i}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function eb(e,t,n){const r=dr();return v.useCallback(o=>{var i,s;if(o.origin===Um){if(o.data.eventType===XI){const a=(i=o.data.data)==null?void 0:i.connection;a?(e(a),t==null||t.close(),r.invalidateQueries({queryKey:["amp","connections"]})):console.error("Connection ID not found in event data: ",{event:o})}o.data.eventType===YI&&(console.error("OAuth failed: ",{event:o}),n==null||n(((s=o==null?void 0:o.data)==null?void 0:s.message)??"Something went wrong. Please try again."))}},[t,n,r,e])}function wd({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:o}){const[i,s]=v.useState(null),[a,c]=v.useState(null),u=eb(s,a,r),d=ZI(n,c,u,t);return v.useEffect(()=>{t&&!a&&d()},[t,a,d,u,n]),v.useEffect(()=>{if(!a)return;const f=setInterval(()=>{a.closed&&(clearInterval(f),window.removeEventListener("message",u),c(null),!i&&!o?(console.error("OAuth failed. Please try again."),r==null||r("Something went wrong. Please try again.")):i&&(r==null||r(null)))},500);return()=>{clearInterval(f),window.removeEventListener("message",u)}},[a,i,o,u,r]),l.jsx("div",{children:e})}function tb({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return l.jsxs(yi,{children:[l.jsx(vi,{children:`Set up ${r} integration`}),l.jsx(wi,{error:t}),l.jsx(ot,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function nb({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){const{projectId:s}=ke(),a=fr(),[c,u]=v.useState(null),[d,f]=v.useState(null),p=async()=>{f(null);try{const g=await vd(s,t,r,a,e,void 0,n,o);u(g)}catch(g){console.error("Could not fetch OAuth popup URL."),ht(g),f(g.message??"Unexpected error")}},m=v.useCallback(g=>{f(g),u(null)},[]);return l.jsx(wd,{windowTitle:`Connect to ${i}`,oauthUrl:c,onError:m,children:l.jsx(tb,{handleSubmit:p,error:d,providerName:i})})}const rb="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function ib({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return l.jsxs(yi,{children:[l.jsx(vi,{children:"Enter your Salesforce subdomain"}),l.jsx(gd,{href:rb,newTab:!0,children:"What is my Salesforce subdomain?"}),l.jsx(wi,{error:n}),l.jsxs("div",{style:{display:"flex",marginTop:"1em",alignItems:"center"},children:[l.jsx(un.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(ot,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function ob({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r,providerName:o}){return l.jsxs(yi,{children:[l.jsxs(vi,{children:["Enter your ",o," workspace"]}),l.jsx(wi,{error:n}),l.jsx("br",{}),l.jsx(un.Input,{id:"workspace",type:"text",placeholder:"MyWorkspace",onChange:i=>t(i.currentTarget.value)}),l.jsx("br",{}),l.jsx(ot,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const sb="salesforce";function ab({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){const{projectId:s}=ke(),a=fr(),[c,u]=v.useState(""),[d,f]=v.useState(null),[p,m]=v.useState(null),g=async()=>{if(m(null),!c){m("Workspace is required");return}try{const x=await vd(s,t,r,a,e,c,n,o);f(x)}catch(x){console.error(x),m((x==null?void 0:x.message)??"Unexpected error")}},w=v.useCallback(x=>{m(x),f(null)},[]),h=e===sb?l.jsx(ib,{handleSubmit:g,setWorkspace:u,error:p,isButtonDisabled:c.length===0}):l.jsx(ob,{handleSubmit:g,setWorkspace:u,error:p,isButtonDisabled:c.length===0,providerName:i});return l.jsx(wd,{windowTitle:`Connect to ${i}`,oauthUrl:d,onError:w,children:h})}function cb({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,explicitScopesRequired:o,explicitWorkspaceRequired:i}){const[s,a]=v.useState(!1),[c,u]=v.useState({clientSecret:"",clientId:"",workspace:"",scopes:""}),d=()=>a(_=>!_),f=_=>{const{name:S,value:T}=_.currentTarget;u(N=>({...N,[S]:T}))},{clientSecret:p,clientId:m,workspace:g,scopes:w}=c,h=p.length>0,x=m.length>0,y=i?g.length>0:!0,b=n||!h||!x||!y,C=()=>{const _={clientId:m,clientSecret:p};i&&(_.workspace=g),o&&w.length>0&&(_.scopes=dg(w)),e(_)};return l.jsxs(yi,{children:[l.jsx(vi,{children:`Set up ${r} integration`}),l.jsx(wi,{error:t}),l.jsx("br",{}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[i&&l.jsx(un.Input,{id:"workspace",name:"workspace",type:"text",placeholder:"MyWorkspace",onChange:_=>f(_)}),l.jsx(un.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:_=>f(_)}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(un.Input,{id:"clientSecret",name:"clientSecret",type:s?"text":"password",placeholder:"Client Secret",onChange:_=>f(_)}),l.jsx(ot,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:d,children:s?"Hide":"Show"})]}),o&&l.jsx(un.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:_=>f(_)})]}),l.jsx("br",{}),l.jsx(ot,{style:{marginTop:"1em",width:"100%"},disabled:b,type:"submit",onClick:C,children:"Next"})]})}function lb({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,explicitScopesRequired:s,explicitWorkspaceRequired:a,selectedConnection:c}){const{projectIdOrName:u}=ke(),d=Oo(),[f,p]=v.useState(null),m=v.useCallback(g=>{p(null);const w={projectIdOrName:u,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:g.workspace,oauth2ClientCredentials:{clientId:g.clientId,clientSecret:g.clientSecret,scopes:g.scopes}}};d.mutate(w,{onError:()=>p("Error loading provider info")})},[u,i,o,r,n,e,d]);return c===null?l.jsx(cb,{providerName:t,handleSubmit:m,error:f,explicitScopesRequired:s,explicitWorkspaceRequired:a}):l.jsx(ri,{})}function ub({...e}){return l.jsx(lb,{...e})}const db="authorizationCode",fb="authorizationCodePKCE",pb="clientCredentials";function hb({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,selectedConnection:s,setSelectedConnection:a}){const{providerName:c}=jn(e);if(t.oauth2Opts===void 0)return l.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:u,explicitScopesRequired:d,explicitWorkspaceRequired:f}=t.oauth2Opts,p={provider:e,consumerRef:n,consumerName:r,groupRef:o,groupName:i,providerName:c};return u===db||u===fb?f?l.jsx(ab,{...p}):l.jsx(nb,{...p}):u===pb?l.jsx(ub,{...p,explicitWorkspaceRequired:f,explicitScopesRequired:d,selectedConnection:s,setSelectedConnection:a}):u==="password"?l.jsx("em",{children:"Password flow not supported yet"}):l.jsxs("em",{children:["Unsupported grant type: ",u]})}function mb(e){const{selectedConnection:t}=Br();v.useEffect(()=>{e&&t&&e(t)},[e,t])}function gb({onSuccess:e}){mb(e)}function Id({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,onSuccess:s,onDisconnectSuccess:a,resetComponent:c}){const{data:u,isLoading:d,isError:f,error:p,providerName:m,selectedProvider:g}=jn(e),{provider:w,isIntegrationDeleted:h}=et(),{selectedConnection:x,setSelectedConnection:y}=Br();gb({onSuccess:s});const b=dr();v.useEffect(()=>{f&&(console.error("Error loading provider info."),ht(p))},[f,p]);const C=v.useCallback(()=>{b.clear(),c()},[c,b]);if(!e&&!w)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(h)return l.jsx(ga,{text:"Integration successfully uninstalled.",children:l.jsx(ot,{type:"button",onClick:C,style:{width:"100%"},children:"Reinstall Integration"})});if(x)return i;if(d)return l.jsx(Hr,{});if(u==null)return l.jsx(zt,{message:"Provider info was not found."});const _={provider:g,consumerRef:t,consumerName:n,groupRef:r,groupName:o,selectedConnection:x,setSelectedConnection:y,providerName:m,providerInfo:u,onDisconnectSuccess:a};return u.authType==="none"?l.jsx(WI,{..._,children:i}):u.authType==="basic"?l.jsx(HI,{..._,children:i}):u.authType==="apiKey"?l.jsx($I,{..._,children:i}):l.jsx(hb,{..._})}function yb(e){const t=e+"CollectionProvider",[n,r]=Co(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=m=>{const{scope:g,children:w}=m,h=v.useRef(null),x=v.useRef(new Map).current;return l.jsx(o,{scope:g,itemMap:x,collectionRef:h,children:w})};s.displayName=t;const a=e+"CollectionSlot",c=v.forwardRef((m,g)=>{const{scope:w,children:h}=m,x=i(a,w),y=ci(g,x.collectionRef);return l.jsx(co,{ref:y,children:h})});c.displayName=a;const u=e+"CollectionItemSlot",d="data-radix-collection-item",f=v.forwardRef((m,g)=>{const{scope:w,children:h,...x}=m,y=v.useRef(null),b=ci(g,y),C=i(u,w);return v.useEffect(()=>(C.itemMap.set(y,{ref:y,...x}),()=>void C.itemMap.delete(y))),l.jsx(co,{[d]:"",ref:b,children:h})});f.displayName=u;function p(m){const g=i(e+"CollectionConsumer",m);return v.useCallback(()=>{const h=g.collectionRef.current;if(!h)return[];const x=Array.from(h.querySelectorAll(`[${d}]`));return Array.from(g.itemMap.values()).sort((C,_)=>x.indexOf(C.ref.current)-x.indexOf(_.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:s,Slot:c,ItemSlot:f},p,r]}var vb=K.useId||(()=>{}),wb=0;function bd(e){const[t,n]=K.useState(vb());return ao(()=>{e||n(r=>r??String(wb++))},[e]),e||(t?`radix-${t}`:"")}var Ib=K.createContext(void 0);function _d(e){const t=K.useContext(Ib);return e||t||"ltr"}var zo="rovingFocusGroup.onEntryFocus",bb={bubbles:!1,cancelable:!0},Eo="RovingFocusGroup",[Ns,xd,_b]=yb(Eo),[xb,Cd]=Co(Eo,[_b]),[Cb,Ob]=xb(Eo),Od=K.forwardRef((e,t)=>l.jsx(Ns.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Ns.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Eb,{...e,ref:t})})}));Od.displayName=Eo;var Eb=K.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,p=K.useRef(null),m=ci(t,p),g=_d(i),[w=null,h]=pa({prop:s,defaultProp:a,onChange:c}),[x,y]=K.useState(!1),b=fa(u),C=xd(n),_=K.useRef(!1),[S,T]=K.useState(0);return K.useEffect(()=>{const N=p.current;if(N)return N.addEventListener(zo,b),()=>N.removeEventListener(zo,b)},[b]),l.jsx(Cb,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:w,onItemFocus:K.useCallback(N=>h(N),[h]),onItemShiftTab:K.useCallback(()=>y(!0),[]),onFocusableItemAdd:K.useCallback(()=>T(N=>N+1),[]),onFocusableItemRemove:K.useCallback(()=>T(N=>N-1),[]),children:l.jsx(Ln.div,{tabIndex:x||S===0?-1:0,"data-orientation":r,...f,ref:m,style:{outline:"none",...e.style},onMouseDown:$t(e.onMouseDown,()=>{_.current=!0}),onFocus:$t(e.onFocus,N=>{const P=!_.current;if(N.target===N.currentTarget&&P&&!x){const q=new CustomEvent(zo,bb);if(N.currentTarget.dispatchEvent(q),!q.defaultPrevented){const G=C().filter(oe=>oe.focusable),z=G.find(oe=>oe.active),ne=G.find(oe=>oe.id===w),ce=[z,ne,...G].filter(Boolean).map(oe=>oe.ref.current);Nd(ce,d)}}_.current=!1}),onBlur:$t(e.onBlur,()=>y(!1))})})}),Ed="RovingFocusGroupItem",Sd=K.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=e,a=bd(),c=i||a,u=Ob(Ed,n),d=u.currentTabStopId===c,f=xd(n),{onFocusableItemAdd:p,onFocusableItemRemove:m}=u;return K.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),l.jsx(Ns.ItemSlot,{scope:n,id:c,focusable:r,active:o,children:l.jsx(Ln.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:$t(e.onMouseDown,g=>{r?u.onItemFocus(c):g.preventDefault()}),onFocus:$t(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:$t(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){u.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const w=Tb(g,u.orientation,u.dir);if(w!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let x=f().filter(y=>y.focusable).map(y=>y.ref.current);if(w==="last")x.reverse();else if(w==="prev"||w==="next"){w==="prev"&&x.reverse();const y=x.indexOf(g.currentTarget);x=u.loop?Rb(x,y+1):x.slice(y+1)}setTimeout(()=>Nd(x))}})})})});Sd.displayName=Ed;var Sb={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Nb(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Tb(e,t,n){const r=Nb(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Sb[r]}function Nd(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Rb(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Ab=Od,Pb=Sd,va="Tabs",[Db,a_]=Co(va,[Cd]),Td=Cd(),[Mb,wa]=Db(va),Rd=K.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=_d(a),[f,p]=pa({prop:r,onChange:o,defaultProp:i});return l.jsx(Mb,{scope:n,baseId:bd(),value:f,onValueChange:p,orientation:s,dir:d,activationMode:c,children:l.jsx(Ln.div,{dir:d,"data-orientation":s,...u,ref:t})})});Rd.displayName=va;var Ad="TabsList",Pd=K.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=wa(Ad,n),s=Td(n);return l.jsx(Ab,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:l.jsx(Ln.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});Pd.displayName=Ad;var Dd="TabsTrigger",Md=K.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=wa(Dd,n),a=Td(n),c=kd(s.baseId,r),u=jd(s.baseId,r),d=r===s.value;return l.jsx(Pb,{asChild:!0,...a,focusable:!o,active:d,children:l.jsx(Ln.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...i,ref:t,onMouseDown:$t(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:$t(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:$t(e.onFocus,()=>{const f=s.activationMode!=="manual";!d&&!o&&f&&s.onValueChange(r)})})})});Md.displayName=Dd;var Fd="TabsContent",Fb=K.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=wa(Fd,n),c=kd(a.baseId,r),u=jd(a.baseId,r),d=r===a.value,f=K.useRef(d);return K.useEffect(()=>{const p=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(p)},[]),l.jsx(ha,{present:o||d,children:({present:p})=>l.jsx(Ln.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!p,id:u,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:p&&i})})});Fb.displayName=Fd;function kd(e,t){return`${e}-trigger-${t}`}function jd(e,t){return`${e}-content-${t}`}var kb=Rd,jb=Pd,Ld=Md;const Lb=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 Vb(e,t){return t?v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},v.createElement("circle",{cx:"9",cy:"9",r:"5",fill:"#FBD38D"})):e?Lb: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 Kb(){return l.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M2.25 4.5H3.75H15.75",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M14.25 4.5V15C14.25 15.3978 14.092 15.7794 13.8107 16.0607C13.5294 16.342 13.1478 16.5 12.75 16.5H5.25C4.85218 16.5 4.47064 16.342 4.18934 16.0607C3.90804 15.7794 3.75 15.3978 3.75 15V4.5M6 4.5V3C6 2.60218 6.15804 2.22064 6.43934 1.93934C6.72064 1.65804 7.10218 1.5 7.5 1.5H10.5C10.8978 1.5 11.2794 1.65804 11.5607 1.93934C11.842 2.22064 12 2.60218 12 3V4.5",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M7.5 8.25V12.75",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M10.5 8.25V12.75",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const $b="_tabsRoot_ktpr0_1",qb="_tabsList_ktpr0_6",Ub="_tabTrigger_ktpr0_12",Hb="_danger_ktpr0_29",li={tabsRoot:$b,tabsList:qb,tabTrigger:Ub,danger:Hb};function Vd({objectName:e,completed:t,pending:n,displayName:r}){return l.jsx(Ld,{value:e,className:li.tabTrigger,children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[Vb(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 Bb({completed:e,pending:t,displayName:n}){return l.jsxs(l.Fragment,{children:[l.jsx(xo,{style:{margin:"1rem 0"}}),l.jsx(Vd,{objectName:sr,completed:e,pending:t,displayName:n},"other-write")]})}function Wb(){return l.jsxs(l.Fragment,{children:[l.jsx(xo,{style:{margin:"3rem 0 1rem 0"}}),l.jsx(Ld,{value:Qi,className:wt(li.tabTrigger,li.danger),children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[Kb(),l.jsx("span",{children:"Uninstall"})]})})]})}function Jb({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:o,showUninstallButton:i}){var s,a;return l.jsx(kb,{value:e,className:li.tabsRoot,onValueChange:n,children:l.jsxs(jb,{className:li.tabsList,children:[t.map(c=>{var u,d,f,p,m,g;return l.jsx(Vd,{objectName:c.name,displayName:c.displayName,completed:c.completed,pending:((d=(u=r==null?void 0:r[c.name])==null?void 0:u.read)==null?void 0:d.isOptionalFieldsModified)||((p=(f=r==null?void 0:r[c.name])==null?void 0:f.read)==null?void 0:p.isRequiredMapFieldsModified)||((g=(m=r==null?void 0:r[c.name])==null?void 0:m.read)==null?void 0:g.isValueMappingsModified)||!1},c.name)}),o&&l.jsx(Bb,{completed:o.completed,pending:((a=(s=r==null?void 0:r.other)==null?void 0:s.write)==null?void 0:a.isWriteModified)||!1,displayName:"Write"}),i&&l.jsx(Wb,{})]})})}function zb(e,t){return t===Qi?{name:Qi,completed:!1}:e.find(n=>n.name===t)}function Gb({children:e}){var x;const{project:t}=ke(),{installation:n}=et(),{providerName:r}=jn(),{hydratedRevision:o}=pn(),{objectConfigurationsState:i}=Ks(),[s,a]=v.useState(""),c=(t==null?void 0:t.appName)||"",u=n==null?void 0:n.config,d=o&&Dl(u,o),f=d!==null,p=!!((x=o==null?void 0:o.content)!=null&&x.write),m=p?Ml(u):void 0,g=v.useMemo(()=>{const y=[...d||[]];return m&&p&&y.push(m),y},[d,m,p]),w=zb(g,s),h=v.useCallback(()=>{const y=g.find(b=>w!==b&&!b.completed);y&&a(y.name)},[g,w]);return v.useEffect(()=>{!s&&g.length>0&&a(g[0].name)},[g,s,h]),l.jsx(Ql.Provider,{value:h,children:l.jsx(zl.Provider,{value:w==null?void 0:w.name,children:l.jsxs(Ur,{style:{maxWidth:"55rem"},children:[l.jsxs(kn,{style:{display:"flex",gap:"1rem",padding:"3rem",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(Jb,{value:s,readNavObjects:d,onValueChange:y=>a(y),objectConfigurationsState:i,writeNavObject:m,showUninstallButton:!!n})]}),e]}),l.jsx(md,{})]})})})}function Qb({...e}){return l.jsx(Gb,{...e})}function Xb({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c}){var h;const{projectIdOrName:u,isLoading:d}=ke(),{isLoading:f}=Ds(),{isError:p,errorState:m}=Rt(),{seed:g,reset:w}=Tl();return d||f?l.jsx(Hr,{}):p(ue.PROJECT,u)?l.jsx(zt,{message:`Error loading project ${u}`}):p(ue.INTEGRATION_LIST,u)?l.jsx(zt,{message:"Error retrieving integrations for the project, double check the API key"}):(h=m[ue.INTEGRATION_LIST])!=null&&h.apiError?l.jsx(zt,{message:"Something went wrong, couldn't find integration information"}):l.jsx("div",{className:Rl.resetContainer,children:l.jsx(hg,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c,children:l.jsx(Nl,{children:l.jsx(Id,{consumerRef:t,consumerName:n,groupRef:r,groupName:o,resetComponent:w,children:l.jsx(Kg,{children:l.jsx(PI,{children:l.jsx(ey,{children:l.jsx(Qb,{children:l.jsx(EI,{})})})})})})})},g)})}function Yb(){return l.jsxs(Ur,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[l.jsx(ri,{}),l.jsx("p",{children:"Redirecting"})]})}function Zb({redirectURL:e,children:t}){return v.useEffect(()=>{e&&window.location.replace(e)},[e]),e?l.jsx(Yb,{}):t}function e_({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:o}){const i=fr(),{projectId:s}=ke(),{selectedConnection:a,setConnections:c}=Br(),[u,d]=v.useState(!1),f=!s||!a||!a.id||u,p=async()=>{if(!f){d(!0),console.warn("deleting connection",{projectId:s,connectionId:a==null?void 0:a.id});try{await dn().connectionApi.deleteConnection({projectIdOrName:s,connectionId:a==null?void 0:a.id},{headers:{"X-Api-Key":i,"Content-Type":"application/json"}}),console.warn("successfully deleted connection:",a==null?void 0:a.id),r==null||r(a),dn().connectionApi.listConnections({projectIdOrName:s},{headers:{"X-Api-Key":i??""}}).then(w=>{c(w),o()}).catch(w=>{ht(w)})}catch(w){console.error("Error deleting connection."),ht(w)}finally{d(!1)}}},m=u?"Disconnecting...":e;return l.jsx(ot,{type:"button",onClick:p,disabled:f,variant:t,style:n,children:m})}function t_({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=ke(),{providerName:o}=jn(e),i=`You have successfully connected your ${o} account to ${r}.`;return l.jsx(ga,{text:i,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:l.jsx(e_,{resetComponent:n,onDisconnectSuccess:t,buttonText:"Remove Connection",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}function n_({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,redirectUrl:i,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:c}){const{seed:u,reset:d}=Tl(),f=v.useCallback(p=>{s?s(p.id):c&&c(p)},[s,c]);return l.jsx("div",{className:Rl.resetContainer,children:l.jsx(Nl,{children:l.jsx(Id,{resetComponent:d,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onSuccess:f,onDisconnectSuccess:a,children:l.jsx(Zb,{redirectURL:i,children:l.jsx(t_,{resetComponent:d,provider:e,onDisconnectSuccess:a})})})})},u)}const r_=(e,t)=>{const{data:n,isLoading:r,isError:o,error:i}=Cl(e,t),s=((n==null?void 0:n.length)||0)>0,a=!!n&&!r;return v.useEffect(()=>{o&&ht(i)},[o,i]),{isLoaded:a,isIntegrationInstalled:s,isLoading:r}};exports.AmpersandContext=bl;exports.AmpersandProvider=Xm;exports.ConnectProvider=n_;exports.InstallIntegration=Xb;exports.useAmpersandProvider=Ym;exports.useIsIntegrationInstalled=r_;