@amp-labs/react 2.7.3 → 2.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/amp-react.cjs.js +14 -14
- package/build/amp-react.es.js +2331 -2247
- package/package.json +1 -1
package/build/amp-react.cjs.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
"use strict";var Aa=e=>{throw TypeError(e)};var Ao=(e,t,n)=>t.has(e)||Aa("Cannot "+n);var O=(e,t,n)=>(Ao(e,t,"read from private field"),n?n.call(e):t.get(e)),oe=(e,t,n)=>t.has(e)?Aa("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),z=(e,t,n,r)=>(Ao(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),pe=(e,t,n)=>(Ao(e,t,"access private method"),n);var Fi=(e,t,n,r)=>({set _(o){z(e,t,o,n)},get _(){return O(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),y=require("react");require("react-dom");function jf(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=jf(y);var Jr=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(){}},cr=typeof window>"u"||"Deno"in globalThis;function Pt(){}function Lf(e,t){return typeof e=="function"?e(t):e}function Xo(e){return typeof e=="number"&&e>=0&&e!==1/0}function Gc(e,t){return Math.max(e+(t||0)-Date.now(),0)}function br(e,t){return typeof e=="function"?e(t):e}function Bt(e,t){return typeof e=="function"?e(t):e}function Pa(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==Ps(s,t.options))return!1}else if(!ai(t.queryKey,s))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||o&&o!==t.state.fetchStatus||i&&!i(t))}function Fa(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(lr(t.options.mutationKey)!==lr(i))return!1}else if(!ai(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function Ps(e,t){return((t==null?void 0:t.queryKeyHashFn)||lr)(e)}function lr(e){return JSON.stringify(e,(t,n)=>Zo(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function ai(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>ai(e[n],t[n])):!1}function Yo(e,t){if(e===t)return e;const n=Da(e)&&Da(t);if(n||Zo(e)&&Zo(t)){const r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),s=i.length,a=n?[]:{};let l=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,l++):(a[d]=Yo(e[d],t[d]),a[d]===e[d]&&e[d]!==void 0&&l++)}return o===s&&l===o?e:a}return t}function Gi(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Da(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Zo(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 Kf(e){return new Promise(t=>{setTimeout(t,e)})}function es(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 Yo(e,t)}catch(r){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`),r}return Yo(e,t)}return t}function Vf(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Uf(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Qi=Symbol();function Qc(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Qi&&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===Qi?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var Zn,Nn,xr,Kc,$f=(Kc=class extends Jr{constructor(){super();oe(this,Zn);oe(this,Nn);oe(this,xr);z(this,xr,t=>{if(!cr&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){O(this,Nn)||this.setEventListener(O(this,xr))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Nn))==null||t.call(this),z(this,Nn,void 0))}setEventListener(t){var n;z(this,xr,t),(n=O(this,Nn))==null||n.call(this),z(this,Nn,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){O(this,Zn)!==t&&(z(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,Nn=new WeakMap,xr=new WeakMap,Kc),Fs=new $f,Cr,Tn,Or,Vc,qf=(Vc=class extends Jr{constructor(){super();oe(this,Cr,!0);oe(this,Tn);oe(this,Or);z(this,Or,t=>{if(!cr&&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,Tn)||this.setEventListener(O(this,Or))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Tn))==null||t.call(this),z(this,Tn,void 0))}setEventListener(t){var n;z(this,Or,t),(n=O(this,Tn))==null||n.call(this),z(this,Tn,t(this.setOnline.bind(this)))}setOnline(t){O(this,Cr)!==t&&(z(this,Cr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return O(this,Cr)}},Cr=new WeakMap,Tn=new WeakMap,Or=new WeakMap,Vc),Xi=new qf;function ts(){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 Hf(e){return Math.min(1e3*2**e,3e4)}function Xc(e){return(e??"online")==="online"?Xi.isOnline():!0}var Yc=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Po(e){return e instanceof Yc}function Zc(e){let t=!1,n=0,r=!1,o;const i=ts(),s=v=>{var p;r||(h(new Yc(v)),(p=e.abort)==null||p.call(e))},a=()=>{t=!0},l=()=>{t=!1},u=()=>Fs.isFocused()&&(e.networkMode==="always"||Xi.isOnline())&&e.canRun(),d=()=>Xc(e.networkMode)&&e.canRun(),f=v=>{var p;r||(r=!0,(p=e.onSuccess)==null||p.call(e,v),o==null||o(),i.resolve(v))},h=v=>{var p;r||(r=!0,(p=e.onError)==null||p.call(e,v),o==null||o(),i.reject(v))},m=()=>new Promise(v=>{var p;o=x=>{(r||u())&&v(x)},(p=e.onPause)==null||p.call(e)}).then(()=>{var v;o=void 0,r||(v=e.onContinue)==null||v.call(e)}),b=()=>{if(r)return;let v;const p=n===0?e.initialPromise:void 0;try{v=p??e.fn()}catch(x){v=Promise.reject(x)}Promise.resolve(v).then(f).catch(x=>{var N;if(r)return;const g=e.retry??(cr?0:3),w=e.retryDelay??Hf,_=typeof w=="function"?w(n,x):w,C=g===!0||typeof g=="number"&&n<g||typeof g=="function"&&g(n,x);if(t||!C){h(x);return}n++,(N=e.onFail)==null||N.call(e,n,x),Kf(_).then(()=>u()?void 0:m()).then(()=>{t?h(x):b()})})};return{promise:i,cancel:s,continue:()=>(o==null||o(),i),cancelRetry:a,continueRetry:l,canStart:d,start:()=>(d()?b():m().then(b),i)}}var Bf=e=>setTimeout(e,0);function Jf(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=Bf;const i=a=>{t?e.push(a):o(()=>{n(a)})},s=()=>{const a=e;e=[],a.length&&o(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||s()}return l},batchCalls:a=>(...l)=>{i(()=>{a(...l)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{o=a}}}var Je=Jf(),er,Uc,el=(Uc=class{constructor(){oe(this,er)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Xo(this.gcTime)&&z(this,er,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(cr?1/0:5*60*1e3))}clearGcTimeout(){O(this,er)&&(clearTimeout(O(this,er)),z(this,er,void 0))}},er=new WeakMap,Uc),Er,Sr,At,tr,at,hi,nr,qt,dn,$c,Wf=($c=class extends el{constructor(t){super();oe(this,qt);oe(this,Er);oe(this,Sr);oe(this,At);oe(this,tr);oe(this,at);oe(this,hi);oe(this,nr);z(this,nr,!1),z(this,hi,t.defaultOptions),this.setOptions(t.options),this.observers=[],z(this,tr,t.client),z(this,At,O(this,tr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,z(this,Er,zf(this.options)),this.state=t.state??O(this,Er),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=O(this,at))==null?void 0:t.promise}setOptions(t){this.options={...O(this,hi),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&O(this,At).remove(this)}setData(t,n){const r=es(this.state.data,t,this.options);return pe(this,qt,dn).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,qt,dn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=O(this,at))==null?void 0:r.promise;return(o=O(this,at))==null||o.cancel(t),n?n.then(Pt).catch(Pt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(O(this,Er))}isActive(){return this.observers.some(t=>Bt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Qi||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||!Gc(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=O(this,at))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=O(this,at))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),O(this,At).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,at)&&(O(this,nr)?O(this,at).cancel({revert:!0}):O(this,at).cancelRetry()),this.scheduleGc()),O(this,At).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||pe(this,qt,dn).call(this,{type:"invalidate"})}fetch(t,n){var l,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,at))return O(this,at).continueRetry(),O(this,at).promise}if(t&&this.setOptions(t),!this.options.queryFn){const f=this.observers.find(h=>h.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:()=>(z(this,nr,!0),r.signal)})},i=()=>{const f=Qc(this.options,n),h={client:O(this,tr),queryKey:this.queryKey,meta:this.meta};return o(h),z(this,nr,!1),this.options.persister?this.options.persister(f,h,this):f(h)},s={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:O(this,tr),state:this.state,fetchFn:i};o(s),(l=this.options.behavior)==null||l.onFetch(s,this),z(this,Sr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=s.fetchOptions)==null?void 0:u.meta))&&pe(this,qt,dn).call(this,{type:"fetch",meta:(d=s.fetchOptions)==null?void 0:d.meta});const a=f=>{var h,m,b,v;Po(f)&&f.silent||pe(this,qt,dn).call(this,{type:"error",error:f}),Po(f)||((m=(h=O(this,At).config).onError)==null||m.call(h,f,this),(v=(b=O(this,At).config).onSettled)==null||v.call(b,this.state.data,f,this)),this.scheduleGc()};return z(this,at,Zc({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:f=>{var h,m,b,v;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(p){a(p);return}(m=(h=O(this,At).config).onSuccess)==null||m.call(h,f,this),(v=(b=O(this,At).config).onSettled)==null||v.call(b,f,this.state.error,this),this.scheduleGc()},onError:a,onFail:(f,h)=>{pe(this,qt,dn).call(this,{type:"failed",failureCount:f,error:h})},onPause:()=>{pe(this,qt,dn).call(this,{type:"pause"})},onContinue:()=>{pe(this,qt,dn).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),O(this,at).start()}},Er=new WeakMap,Sr=new WeakMap,At=new WeakMap,tr=new WeakMap,at=new WeakMap,hi=new WeakMap,nr=new WeakMap,qt=new WeakSet,dn=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,...tl(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 Po(o)&&o.revert&&O(this,Sr)?{...O(this,Sr),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),Je.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),O(this,At).notify({query:this,type:"updated",action:t})})},$c);function tl(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Xc(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function zf(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 Yt,qc,Gf=(qc=class extends Jr{constructor(t={}){super();oe(this,Yt);this.config=t,z(this,Yt,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??Ps(o,n);let s=this.get(i);return s||(s=new Wf({client:t,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){O(this,Yt).has(t.queryHash)||(O(this,Yt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=O(this,Yt).get(t.queryHash);n&&(t.destroy(),n===t&&O(this,Yt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Je.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return O(this,Yt).get(t)}getAll(){return[...O(this,Yt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Pa(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Pa(t,r)):n}notify(t){Je.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Je.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Je.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Yt=new WeakMap,qc),Zt,lt,rr,en,Sn,Hc,Qf=(Hc=class extends el{constructor(t){super();oe(this,en);oe(this,Zt);oe(this,lt);oe(this,rr);this.mutationId=t.mutationId,z(this,lt,t.mutationCache),z(this,Zt,[]),this.state=t.state||nl(),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,Zt).includes(t)||(O(this,Zt).push(t),this.clearGcTimeout(),O(this,lt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){z(this,Zt,O(this,Zt).filter(n=>n!==t)),this.scheduleGc(),O(this,lt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){O(this,Zt).length||(this.state.status==="pending"?this.scheduleGc():O(this,lt).remove(this))}continue(){var t;return((t=O(this,rr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,s,a,l,u,d,f,h,m,b,v,p,x,g,w,_,C,N,R,T;const n=()=>{pe(this,en,Sn).call(this,{type:"continue"})};z(this,rr,Zc({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(F,U)=>{pe(this,en,Sn).call(this,{type:"failed",failureCount:F,error:U})},onPause:()=>{pe(this,en,Sn).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>O(this,lt).canRun(this)}));const r=this.state.status==="pending",o=!O(this,rr).canStart();try{if(r)n();else{pe(this,en,Sn).call(this,{type:"pending",variables:t,isPaused:o}),await((s=(i=O(this,lt).config).onMutate)==null?void 0:s.call(i,t,this));const U=await((l=(a=this.options).onMutate)==null?void 0:l.call(a,t));U!==this.state.context&&pe(this,en,Sn).call(this,{type:"pending",context:U,variables:t,isPaused:o})}const F=await O(this,rr).start();return await((d=(u=O(this,lt).config).onSuccess)==null?void 0:d.call(u,F,t,this.state.context,this)),await((h=(f=this.options).onSuccess)==null?void 0:h.call(f,F,t,this.state.context)),await((b=(m=O(this,lt).config).onSettled)==null?void 0:b.call(m,F,null,this.state.variables,this.state.context,this)),await((p=(v=this.options).onSettled)==null?void 0:p.call(v,F,null,t,this.state.context)),pe(this,en,Sn).call(this,{type:"success",data:F}),F}catch(F){try{throw await((g=(x=O(this,lt).config).onError)==null?void 0:g.call(x,F,t,this.state.context,this)),await((_=(w=this.options).onError)==null?void 0:_.call(w,F,t,this.state.context)),await((N=(C=O(this,lt).config).onSettled)==null?void 0:N.call(C,void 0,F,this.state.variables,this.state.context,this)),await((T=(R=this.options).onSettled)==null?void 0:T.call(R,void 0,F,t,this.state.context)),F}finally{pe(this,en,Sn).call(this,{type:"error",error:F})}}finally{O(this,lt).runNext(this)}}},Zt=new WeakMap,lt=new WeakMap,rr=new WeakMap,en=new WeakSet,Sn=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),Je.batch(()=>{O(this,Zt).forEach(r=>{r.onMutationUpdate(t)}),O(this,lt).notify({mutation:this,type:"updated",action:t})})},Hc);function nl(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var fn,Ht,mi,Bc,Xf=(Bc=class extends Jr{constructor(t={}){super();oe(this,fn);oe(this,Ht);oe(this,mi);this.config=t,z(this,fn,new Set),z(this,Ht,new Map),z(this,mi,0)}build(t,n,r){const o=new Qf({mutationCache:this,mutationId:++Fi(this,mi)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){O(this,fn).add(t);const n=Di(t);if(typeof n=="string"){const r=O(this,Ht).get(n);r?r.push(t):O(this,Ht).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(O(this,fn).delete(t)){const n=Di(t);if(typeof n=="string"){const r=O(this,Ht).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,Ht).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Di(t);if(typeof n=="string"){const r=O(this,Ht).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=Di(t);if(typeof n=="string"){const o=(r=O(this,Ht).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(){Je.batch(()=>{O(this,fn).forEach(t=>{this.notify({type:"removed",mutation:t})}),O(this,fn).clear(),O(this,Ht).clear()})}getAll(){return Array.from(O(this,fn))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Fa(n,r))}findAll(t={}){return this.getAll().filter(n=>Fa(t,n))}notify(t){Je.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Je.batch(()=>Promise.all(t.map(n=>n.continue().catch(Pt))))}},fn=new WeakMap,Ht=new WeakMap,mi=new WeakMap,Bc);function Di(e){var t;return(t=e.options.scope)==null?void 0:t.id}function ka(e){return{onFetch:(t,n)=>{var d,f,h,m,b;const r=t.options,o=(h=(f=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:h.direction,i=((m=t.state.data)==null?void 0:m.pages)||[],s=((b=t.state.data)==null?void 0:b.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const u=async()=>{let v=!1;const p=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(t.signal.aborted?v=!0:t.signal.addEventListener("abort",()=>{v=!0}),t.signal)})},x=Qc(t.options,t.fetchOptions),g=async(w,_,C)=>{if(v)return Promise.reject();if(_==null&&w.pages.length)return Promise.resolve(w);const N={client:t.client,queryKey:t.queryKey,pageParam:_,direction:C?"backward":"forward",meta:t.options.meta};p(N);const R=await x(N),{maxPages:T}=t.options,F=C?Uf:Vf;return{pages:F(w.pages,R,T),pageParams:F(w.pageParams,_,T)}};if(o&&i.length){const w=o==="backward",_=w?Yf:ja,C={pages:i,pageParams:s},N=_(r,C);a=await g(C,N,w)}else{const w=e??i.length;do{const _=l===0?s[0]??r.initialPageParam:ja(r,a);if(l>0&&_==null)break;a=await g(a,_),l++}while(l<w)}return a};t.options.persister?t.fetchFn=()=>{var v,p;return(p=(v=t.options).persister)==null?void 0:p.call(v,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function ja(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 Yf(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 ke,Rn,An,Nr,Tr,Pn,Rr,Ar,Jc,Zf=(Jc=class{constructor(e={}){oe(this,ke);oe(this,Rn);oe(this,An);oe(this,Nr);oe(this,Tr);oe(this,Pn);oe(this,Rr);oe(this,Ar);z(this,ke,e.queryCache||new Gf),z(this,Rn,e.mutationCache||new Xf),z(this,An,e.defaultOptions||{}),z(this,Nr,new Map),z(this,Tr,new Map),z(this,Pn,0)}mount(){Fi(this,Pn)._++,O(this,Pn)===1&&(z(this,Rr,Fs.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,ke).onFocus())})),z(this,Ar,Xi.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,ke).onOnline())})))}unmount(){var e,t;Fi(this,Pn)._--,O(this,Pn)===0&&((e=O(this,Rr))==null||e.call(this),z(this,Rr,void 0),(t=O(this,Ar))==null||t.call(this),z(this,Ar,void 0))}isFetching(e){return O(this,ke).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return O(this,Rn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=O(this,ke).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=O(this,ke).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(br(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return O(this,ke).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,ke).get(r.queryHash),i=o==null?void 0:o.state.data,s=Lf(t,i);if(s!==void 0)return O(this,ke).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return Je.batch(()=>O(this,ke).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,ke).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=O(this,ke);Je.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=O(this,ke);return Je.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Je.batch(()=>O(this,ke).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Pt).catch(Pt)}invalidateQueries(e,t={}){return Je.batch(()=>(O(this,ke).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Je.batch(()=>O(this,ke).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(Pt)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Pt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=O(this,ke).build(this,t);return n.isStaleByTime(br(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Pt).catch(Pt)}fetchInfiniteQuery(e){return e.behavior=ka(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Pt).catch(Pt)}ensureInfiniteQueryData(e){return e.behavior=ka(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Xi.isOnline()?O(this,Rn).resumePausedMutations():Promise.resolve()}getQueryCache(){return O(this,ke)}getMutationCache(){return O(this,Rn)}getDefaultOptions(){return O(this,An)}setDefaultOptions(e){z(this,An,e)}setQueryDefaults(e,t){O(this,Nr).set(lr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...O(this,Nr).values()],n={};return t.forEach(r=>{ai(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){O(this,Tr).set(lr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...O(this,Tr).values()],n={};return t.forEach(r=>{ai(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...O(this,An).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ps(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===Qi&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...O(this,An).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){O(this,ke).clear(),O(this,Rn).clear()}},ke=new WeakMap,Rn=new WeakMap,An=new WeakMap,Nr=new WeakMap,Tr=new WeakMap,Pn=new WeakMap,Rr=new WeakMap,Ar=new WeakMap,Jc),mt,ye,gi,ut,ir,Pr,Fn,Dn,yi,Fr,Dr,or,sr,Mn,Mr,Oe,ni,ns,rs,is,os,ss,as,cs,rl,Wc,ep=(Wc=class extends Jr{constructor(t,n){super();oe(this,Oe);oe(this,mt);oe(this,ye);oe(this,gi);oe(this,ut);oe(this,ir);oe(this,Pr);oe(this,Fn);oe(this,Dn);oe(this,yi);oe(this,Fr);oe(this,Dr);oe(this,or);oe(this,sr);oe(this,Mn);oe(this,Mr,new Set);this.options=n,z(this,mt,t),z(this,Dn,null),z(this,Fn,ts()),this.options.experimental_prefetchInRender||O(this,Fn).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),La(O(this,ye),this.options)?pe(this,Oe,ni).call(this):this.updateResult(),pe(this,Oe,os).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ls(O(this,ye),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ls(O(this,ye),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,pe(this,Oe,ss).call(this),pe(this,Oe,as).call(this),O(this,ye).removeObserver(this)}setOptions(t){const n=this.options,r=O(this,ye);if(this.options=O(this,mt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Bt(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,cs).call(this),O(this,ye).setOptions(this.options),n._defaulted&&!Gi(this.options,n)&&O(this,mt).getQueryCache().notify({type:"observerOptionsUpdated",query:O(this,ye),observer:this});const o=this.hasListeners();o&&Ka(O(this,ye),r,this.options,n)&&pe(this,Oe,ni).call(this),this.updateResult(),o&&(O(this,ye)!==r||Bt(this.options.enabled,O(this,ye))!==Bt(n.enabled,O(this,ye))||br(this.options.staleTime,O(this,ye))!==br(n.staleTime,O(this,ye)))&&pe(this,Oe,ns).call(this);const i=pe(this,Oe,rs).call(this);o&&(O(this,ye)!==r||Bt(this.options.enabled,O(this,ye))!==Bt(n.enabled,O(this,ye))||i!==O(this,Mn))&&pe(this,Oe,is).call(this,i)}getOptimisticResult(t){const n=O(this,mt).getQueryCache().build(O(this,mt),t),r=this.createResult(n,t);return np(this,r)&&(z(this,ut,r),z(this,Pr,this.options),z(this,ir,O(this,ye).state)),r}getCurrentResult(){return O(this,ut)}trackResult(t,n){return new Proxy(t,{get:(r,o)=>(this.trackProp(o),n==null||n(o),Reflect.get(r,o))})}trackProp(t){O(this,Mr).add(t)}getCurrentQuery(){return O(this,ye)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=O(this,mt).defaultQueryOptions(t),r=O(this,mt).getQueryCache().build(O(this,mt),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return pe(this,Oe,ni).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),O(this,ut)))}createResult(t,n){var F;const r=O(this,ye),o=this.options,i=O(this,ut),s=O(this,ir),a=O(this,Pr),u=t!==r?t.state:O(this,gi),{state:d}=t;let f={...d},h=!1,m;if(n._optimisticResults){const U=this.hasListeners(),Q=!U&&La(t,n),J=U&&Ka(t,r,n,o);(Q||J)&&(f={...f,...tl(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:b,errorUpdatedAt:v,status:p}=f;m=f.data;let x=!1;if(n.placeholderData!==void 0&&m===void 0&&p==="pending"){let U;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(U=i.data,x=!0):U=typeof n.placeholderData=="function"?n.placeholderData((F=O(this,Dr))==null?void 0:F.state.data,O(this,Dr)):n.placeholderData,U!==void 0&&(p="success",m=es(i==null?void 0:i.data,U,n),h=!0)}if(n.select&&m!==void 0&&!x)if(i&&m===(s==null?void 0:s.data)&&n.select===O(this,yi))m=O(this,Fr);else try{z(this,yi,n.select),m=n.select(m),m=es(i==null?void 0:i.data,m,n),z(this,Fr,m),z(this,Dn,null)}catch(U){z(this,Dn,U)}O(this,Dn)&&(b=O(this,Dn),m=O(this,Fr),v=Date.now(),p="error");const g=f.fetchStatus==="fetching",w=p==="pending",_=p==="error",C=w&&g,N=m!==void 0,T={status:p,fetchStatus:f.fetchStatus,isPending:w,isSuccess:p==="success",isError:_,isInitialLoading:C,isLoading:C,data:m,dataUpdatedAt:f.dataUpdatedAt,error:b,errorUpdatedAt:v,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:g,isRefetching:g&&!w,isLoadingError:_&&!N,isPaused:f.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:_&&N,isStale:Ds(t,n),refetch:this.refetch,promise:O(this,Fn)};if(this.options.experimental_prefetchInRender){const U=Y=>{T.status==="error"?Y.reject(T.error):T.data!==void 0&&Y.resolve(T.data)},Q=()=>{const Y=z(this,Fn,T.promise=ts());U(Y)},J=O(this,Fn);switch(J.status){case"pending":t.queryHash===r.queryHash&&U(J);break;case"fulfilled":(T.status==="error"||T.data!==J.value)&&Q();break;case"rejected":(T.status!=="error"||T.error!==J.reason)&&Q();break}}return T}updateResult(){const t=O(this,ut),n=this.createResult(O(this,ye),this.options);if(z(this,ir,O(this,ye).state),z(this,Pr,this.options),O(this,ir).data!==void 0&&z(this,Dr,O(this,ye)),Gi(n,t))return;z(this,ut,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:o}=this.options,i=typeof o=="function"?o():o;if(i==="all"||!i&&!O(this,Mr).size)return!0;const s=new Set(i??O(this,Mr));return this.options.throwOnError&&s.add("error"),Object.keys(O(this,ut)).some(a=>{const l=a;return O(this,ut)[l]!==t[l]&&s.has(l)})};pe(this,Oe,rl).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&pe(this,Oe,os).call(this)}},mt=new WeakMap,ye=new WeakMap,gi=new WeakMap,ut=new WeakMap,ir=new WeakMap,Pr=new WeakMap,Fn=new WeakMap,Dn=new WeakMap,yi=new WeakMap,Fr=new WeakMap,Dr=new WeakMap,or=new WeakMap,sr=new WeakMap,Mn=new WeakMap,Mr=new WeakMap,Oe=new WeakSet,ni=function(t){pe(this,Oe,cs).call(this);let n=O(this,ye).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Pt)),n},ns=function(){pe(this,Oe,ss).call(this);const t=br(this.options.staleTime,O(this,ye));if(cr||O(this,ut).isStale||!Xo(t))return;const r=Gc(O(this,ut).dataUpdatedAt,t)+1;z(this,or,setTimeout(()=>{O(this,ut).isStale||this.updateResult()},r))},rs=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(O(this,ye)):this.options.refetchInterval)??!1},is=function(t){pe(this,Oe,as).call(this),z(this,Mn,t),!(cr||Bt(this.options.enabled,O(this,ye))===!1||!Xo(O(this,Mn))||O(this,Mn)===0)&&z(this,sr,setInterval(()=>{(this.options.refetchIntervalInBackground||Fs.isFocused())&&pe(this,Oe,ni).call(this)},O(this,Mn)))},os=function(){pe(this,Oe,ns).call(this),pe(this,Oe,is).call(this,pe(this,Oe,rs).call(this))},ss=function(){O(this,or)&&(clearTimeout(O(this,or)),z(this,or,void 0))},as=function(){O(this,sr)&&(clearInterval(O(this,sr)),z(this,sr,void 0))},cs=function(){const t=O(this,mt).getQueryCache().build(O(this,mt),this.options);if(t===O(this,ye))return;const n=O(this,ye);z(this,ye,t),z(this,gi,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},rl=function(t){Je.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(O(this,ut))}),O(this,mt).getQueryCache().notify({query:O(this,ye),type:"observerResultsUpdated"})})},Wc);function tp(e,t){return Bt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function La(e,t){return tp(e,t)||e.state.data!==void 0&&ls(e,t,t.refetchOnMount)}function ls(e,t,n){if(Bt(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Ds(e,t)}return!1}function Ka(e,t,n,r){return(e!==t||Bt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Ds(e,n)}function Ds(e,t){return Bt(t.enabled,e)!==!1&&e.isStaleByTime(br(t.staleTime,e))}function np(e,t){return!Gi(e.getCurrentResult(),t)}var kn,jn,gt,pn,gn,Hi,us,zc,rp=(zc=class extends Jr{constructor(n,r){super();oe(this,gn);oe(this,kn);oe(this,jn);oe(this,gt);oe(this,pn);z(this,kn,n),this.setOptions(r),this.bindMethods(),pe(this,gn,Hi).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,kn).defaultMutationOptions(n),Gi(this.options,r)||O(this,kn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:O(this,gt),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&lr(r.mutationKey)!==lr(this.options.mutationKey)?this.reset():((o=O(this,gt))==null?void 0:o.state.status)==="pending"&&O(this,gt).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=O(this,gt))==null||n.removeObserver(this)}onMutationUpdate(n){pe(this,gn,Hi).call(this),pe(this,gn,us).call(this,n)}getCurrentResult(){return O(this,jn)}reset(){var n;(n=O(this,gt))==null||n.removeObserver(this),z(this,gt,void 0),pe(this,gn,Hi).call(this),pe(this,gn,us).call(this)}mutate(n,r){var o;return z(this,pn,r),(o=O(this,gt))==null||o.removeObserver(this),z(this,gt,O(this,kn).getMutationCache().build(O(this,kn),this.options)),O(this,gt).addObserver(this),O(this,gt).execute(n)}},kn=new WeakMap,jn=new WeakMap,gt=new WeakMap,pn=new WeakMap,gn=new WeakSet,Hi=function(){var r;const n=((r=O(this,gt))==null?void 0:r.state)??nl();z(this,jn,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},us=function(n){Je.batch(()=>{var r,o,i,s,a,l,u,d;if(O(this,pn)&&this.hasListeners()){const f=O(this,jn).variables,h=O(this,jn).context;(n==null?void 0:n.type)==="success"?((o=(r=O(this,pn)).onSuccess)==null||o.call(r,n.data,f,h),(s=(i=O(this,pn)).onSettled)==null||s.call(i,n.data,null,f,h)):(n==null?void 0:n.type)==="error"&&((l=(a=O(this,pn)).onError)==null||l.call(a,n.error,f,h),(d=(u=O(this,pn)).onSettled)==null||d.call(u,void 0,n.error,f,h))}this.listeners.forEach(f=>{f(O(this,jn))})})},zc),il=k.createContext(void 0),Et=e=>{const t=k.useContext(il);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},ip=({client:e,children:t})=>(k.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),c.jsx(il.Provider,{value:e,children:t})),ol=k.createContext(!1),op=()=>k.useContext(ol);ol.Provider;function sp(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var ap=k.createContext(sp()),cp=()=>k.useContext(ap);function sl(e,t){return typeof e=="function"?e(...t):!!e}function ds(){}var lp=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},up=e=>{k.useEffect(()=>{e.clearReset()},[e])},dp=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||sl(n,[e.error,r])),fp=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)))},pp=(e,t)=>e.isLoading&&e.isFetching&&!t,hp=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Va=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function mp(e,t,n){var f,h,m,b,v;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=Et(),o=op(),i=cp(),s=r.defaultQueryOptions(e);(h=(f=r.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||h.call(f,s),process.env.NODE_ENV!=="production"&&(s.queryFn||console.error(`[${s.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),s._optimisticResults=o?"isRestoring":"optimistic",fp(s),lp(s,i),up(i);const a=!r.getQueryCache().get(s.queryHash),[l]=k.useState(()=>new t(r,s)),u=l.getOptimisticResult(s),d=!o&&e.subscribed!==!1;if(k.useSyncExternalStore(k.useCallback(p=>{const x=d?l.subscribe(Je.batchCalls(p)):ds;return l.updateResult(),x},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),k.useEffect(()=>{l.setOptions(s)},[s,l]),hp(s,u))throw Va(s,l,i);if(dp({result:u,errorResetBoundary:i,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw u.error;if((b=(m=r.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||b.call(m,s,u),s.experimental_prefetchInRender&&!cr&&pp(u,o)){const p=a?Va(s,l,i):(v=r.getQueryCache().get(s.queryHash))==null?void 0:v.promise;p==null||p.catch(ds).finally(()=>{l.updateResult()})}return s.notifyOnChangeProps?u:l.trackResult(u)}function yn(e,t){return mp(e,ep)}function Wr(e,t){const n=Et(),[r]=k.useState(()=>new rp(n,e));k.useEffect(()=>{r.setOptions(e)},[r,e]);const o=k.useSyncExternalStore(k.useCallback(s=>r.subscribe(Je.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=k.useCallback((s,a)=>{r.mutate(s,a).catch(ds)},[r]);if(o.error&&sl(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:i,mutateAsync:o.mutate}}const al=y.createContext(null),gp=al.Provider,cl=()=>{const e=y.useContext(al);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 ll=y.createContext(void 0);function Dt(){const e=y.useContext(ll);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const yp=(()=>{const e={};return Object.values(ue).forEach(t=>{e[t]={}}),e})();function vp({children:e}){const[t,n]=y.useState(yp),r=y.useCallback((d,f,h=!0)=>{n(m=>{const b={...m};return b[d]=b[d]||{},b[d][f]=h,b})},[n]),o=y.useCallback((d,f)=>{var h;return!!((h=t[d])!=null&&h[f])},[t]),i=y.useCallback((d,f)=>{var h;return(h=t[d])==null?void 0:h[f]},[t]),s=y.useCallback((d,f)=>{n(h=>{var b;const m={...h};return(b=m[d])==null||delete b[f],m})},[n]),a=y.useCallback(d=>{n(f=>{const h={...f};return h[d]={},h})},[n]),l=y.useCallback((d,f)=>{n(h=>{const m={...h};return m[d]=m[d]||{},f.forEach(b=>{m[d][b]=!0}),m})},[n]),u=y.useMemo(()=>({errorState:t,setErrorState:n,setError:r,isError:o,removeError:s,resetBoundary:a,setErrors:l,getError:i}),[t,n,r,o,s,a,l,i]);return c.jsx(ll.Provider,{value:u,children:e})}const wp="https://api.withampersand.com/v1".replace(/\/+$/,"");class Ms{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:wp}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||dl}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 Ip=new Ms,fo=class fo{constructor(t=Ip){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 xp(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?fo.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 ul(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})},l={...a,body:_p(a.body)||a.body instanceof URLSearchParams||bp(a.body)?a.body:JSON.stringify(a.body)};return{url:r,init:l}}clone(){const t=this.constructor,n=new t(this.configuration);return n.middleware=this.middleware.slice(),n}};fo.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let tn=fo;function bp(e){return typeof Blob<"u"&&e instanceof Blob}function _p(e){return typeof FormData<"u"&&e instanceof FormData}class ul extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class xp extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class re extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function S(e,t){const n=e[t];return n!=null}function dl(e,t=""){return Object.keys(e).map(n=>fl(n,e[n],t)).filter(n=>n.length>0).join("&")}function fl(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 fl(e,o,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?dl(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function We(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class je{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class ur{constructor(t){this.raw=t}async value(){}}class Ua{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function Cp(e){return Op(e)}function Op(e,t){return e==null?e:{fieldUsed:S(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:S(e,"keyFormat")?e.keyFormat:void 0}}function Ep(e){return Sp(e)}function Sp(e,t){return e==null?e:{name:e.name,valuePrefix:S(e,"valuePrefix")?e.valuePrefix:void 0}}function Np(e){return Tp(e)}function Tp(e,t){return e==null?e:{name:e.name}}function Rp(e){return Ap(e)}function Ap(e,t){return e==null?e:{attachmentType:e.attachmentType,query:S(e,"query")?Np(e.query):void 0,header:S(e,"header")?Ep(e.header):void 0,docsURL:S(e,"docsURL")?e.docsURL:void 0}}function Pp(e){return Fp(e)}function Fp(e,t){return e==null?e:{enabled:S(e,"enabled")?e.enabled:void 0,includeFullRecords:S(e,"includeFullRecords")?e.includeFullRecords:void 0}}function Dp(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,includeFullRecords:e.includeFullRecords}}const $a={Oauth2:"oauth2",ApiKey:"apiKey",Basic:"basic",Jwt:"jwt",None:"none"};function Mp(e){return kp(e)}function kp(e,t){return e}function jp(e){return Lp(e)}function Lp(e,t){return e==null?e:{days:S(e,"days")?e.days:void 0,fullHistory:S(e,"fullHistory")?e.fullHistory:void 0}}function Kp(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function pl(e){return Vp(e)}function Vp(e,t){return e==null?e:{defaultPeriod:jp(e.defaultPeriod)}}function Up(e){if(e!==void 0)return e===null?null:{defaultPeriod:Kp(e.defaultPeriod)}}function $p(e){return qp(e)}function qp(e,t){return e==null?e:{days:S(e,"days")?e.days:void 0,fullHistory:S(e,"fullHistory")?e.fullHistory:void 0}}function Hp(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Bp(e){return Jp(e)}function Jp(e,t){return e==null?e:{defaultPeriod:$p(e.defaultPeriod)}}function hl(e){if(e!==void 0)return e===null?null:{defaultPeriod:Hp(e.defaultPeriod)}}function Wp(e){return zp(e)}function zp(e,t){return e==null?e:{enabled:S(e,"enabled")?e.enabled:void 0}}function ml(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Gp(e){return Qp(e)}function Qp(e,t){return e}function Xp(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:hl(e.backfill)}}function Yp(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:We(e.objects,Xp)}}function Zp(e){return eh(e)}function eh(e,t){return e==null?e:{stringValue:S(e,"stringValue")?e.stringValue:void 0,integerValue:S(e,"integerValue")?e.integerValue:void 0,booleanValue:S(e,"booleanValue")?e.booleanValue:void 0}}function th(e){if(e!==void 0)return e===null?null:{stringValue:e.stringValue,integerValue:e.integerValue,booleanValue:e.booleanValue}}function nh(e){return rh(e)}function rh(e,t){return e==null?e:{_default:S(e,"default")?Zp(e.default):void 0,writeOnCreate:S(e,"writeOnCreate")?e.writeOnCreate:void 0,writeOnUpdate:S(e,"writeOnUpdate")?e.writeOnUpdate:void 0}}function gl(e){if(e!==void 0)return e===null?null:{default:th(e._default),writeOnCreate:e.writeOnCreate,writeOnUpdate:e.writeOnUpdate}}function ih(e){let t=!0;return t=t&&"value"in e,t}function oh(e,t){return e==null?e:{value:e.value,applyOnUpdate:S(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function sh(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function ah(e){let t=!0;return t=t&&"value"in e,t}function ch(e,t){return e==null?e:{value:e.value,applyOnUpdate:S(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function lh(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function uh(e){let t=!0;return t=t&&"value"in e,t}function dh(e,t){return e==null?e:{value:e.value,applyOnUpdate:S(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function fh(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function ph(e){return hh(e)}function hh(e,t){return e==null?e:{...oh(e),...ch(e),...dh(e)}}function yl(e){if(e!==void 0)return e===null?null:ih(e)?sh(e):ah(e)?lh(e):uh(e)?fh(e):{}}function mh(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:We(e.selectedValueDefaults,yl),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:We(e.selectedFieldSettings,gl)}}function gh(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:We(e.objects,mh)}}function yh(e){return vh(e)}function vh(e,t){return e==null?e:{apiKeyAsBasic:S(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:S(e,"apiKeyAsBasicOpts")?Cp(e.apiKeyAsBasicOpts):void 0,docsURL:S(e,"docsURL")?e.docsURL:void 0}}function wh(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Ih(e){return bh(e)}function bh(e,t){return e==null?e:{value:e.value}}function _h(e){return xh(e)}function xh(e,t){return e==null?e:{brandingRemoval:S(e,"brandingRemoval")?Ih(e.brandingRemoval):void 0}}function Mi(e){return Ch(e)}function Ch(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:S(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:S(e,"updateTime")?new Date(e.updateTime):void 0,entitlements:S(e,"entitlements")?_h(e.entitlements):void 0}}function Oh(e){return Eh(e)}function Eh(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function Sh(e){return Nh(e)}function Nh(e,t){return e==null?e:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:S(e,"selectedValueMappings")?e.selectedValueMappings:void 0,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:S(e,"selectedFieldsAuto")?Gp(e.selectedFieldsAuto):void 0,backfill:S(e,"backfill")?Bp(e.backfill):void 0}}function Th(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:hl(e.backfill)}}function Rh(e){return Ah(e)}function Ah(e,t){return e==null?e:{objects:We(e.objects,Sh)}}function Ph(e){if(e!==void 0)return e===null?null:{objects:We(e.objects,Th)}}function Fh(e){return Dh(e)}function Dh(e,t){return e==null?e:{objectName:e.objectName,selectedValueDefaults:S(e,"selectedValueDefaults")?We(e.selectedValueDefaults,ph):void 0,selectedFieldSettings:S(e,"selectedFieldSettings")?We(e.selectedFieldSettings,nh):void 0}}function Mh(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:We(e.selectedValueDefaults,yl),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:We(e.selectedFieldSettings,gl)}}function kh(e){return jh(e)}function jh(e,t){return e==null?e:{objects:S(e,"objects")?We(e.objects,Fh):void 0}}function Lh(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:We(e.objects,Mh)}}function Kh(e){return Vh(e)}function Vh(e,t){return e==null?e:{provider:e.provider,read:S(e,"read")?Rh(e.read):void 0,write:S(e,"write")?kh(e.write):void 0,proxy:S(e,"proxy")?Wp(e.proxy):void 0}}function Uh(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:Ph(e.read),write:Lh(e.write),proxy:ml(e.proxy)}}function $h(e){return qh(e)}function qh(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:Kh(e.content)}}function Hh(e){return Bh(e)}function Bh(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:S(e,"updateTime")?new Date(e.updateTime):void 0}}function vl(e){return Jh(e)}function Jh(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:S(e,"updateTime")?new Date(e.updateTime):void 0}}function Wh(e){return zh(e)}function zh(e,t){return e==null?e:{token:e.token,issuedAt:S(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:S(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Gh(e){return Qh(e)}function Qh(e,t){return e==null?e:{token:e.token,issuedAt:S(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:S(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Xh(e){return Yh(e)}function Yh(e,t){return e==null?e:{accessToken:S(e,"accessToken")?Wh(e.accessToken):void 0,refreshToken:S(e,"refreshToken")?Gh(e.refreshToken):void 0,scopes:S(e,"scopes")?e.scopes:void 0}}function Bi(e){return Zh(e)}function Zh(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:S(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:S(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:S(e,"updateTime")?new Date(e.updateTime):void 0}}function em(e){return tm(e)}function tm(e,t){return e==null?e:{value:e.value,source:e.source,displayName:S(e,"displayName")?e.displayName:void 0}}function ks(e){if(e!==void 0)return e===null?null:{value:e.value,source:e.source,displayName:e.displayName}}function ri(e){return nm(e)}function nm(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:S(e,"providerApp")?Bi(e.providerApp):void 0,group:vl(e.group),consumer:Hh(e.consumer),providerWorkspaceRef:S(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerConsumerRef:S(e,"providerConsumerRef")?e.providerConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:S(e,"updateTime")?new Date(e.updateTime):void 0,authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:S(e,"oauth2AuthorizationCode")?Xh(e.oauth2AuthorizationCode):void 0,apiKey:S(e,"apiKey")?e.apiKey:void 0,providerMetadata:S(e,"providerMetadata")?We(e.providerMetadata,em):void 0}}function wl(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function Il(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function bl(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 rm(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 im(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 _l(e){if(e!==void 0)return e===null?null:{accessToken:rm(e.accessToken),refreshToken:im(e.refreshToken),scopes:e.scopes}}function om(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:We(e.providerMetadata,ks),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,basicAuth:wl(e.basicAuth),oauth2ClientCredentials:Il(e.oauth2ClientCredentials),oauth2PasswordCredentials:bl(e.oauth2PasswordCredentials),oauth2AuthorizationCode:_l(e.oauth2AuthorizationCode)}}function sm(e){return am(e)}function am(e,t){return e==null?e:{enabled:S(e,"enabled")?e.enabled:void 0}}function cm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function lm(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Uh(e.content)}}function um(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:lm(e.config)}}function dm(e){return fm(e)}function fm(e,t){return e==null?e:{enabled:S(e,"enabled")?e.enabled:void 0}}function pm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function hm(e){return mm(e)}function mm(e,t){return e==null?e:{mode:S(e,"mode")?e.mode:void 0,pageSize:S(e,"pageSize")?e.pageSize:void 0}}function gm(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function ym(e){let t=!0;return t=t&&"fieldName"in e,t}function vm(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:S(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:S(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function wm(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function Im(e){let t=!0;return t=t&&"mapToName"in e,t}function xl(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:S(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:S(e,"default")?e.default:void 0,prompt:S(e,"prompt")?e.prompt:void 0}}function bm(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function qa(e){return _m(e)}function _m(e,t){return e==null?e:{...vm(e),...xl(e)}}function Ha(e){if(e!==void 0)return e===null?null:ym(e)?wm(e):Im(e)?bm(e):{}}function Cl(e){return xm(e)}function xm(e,t){return e}function Cm(e){return Om(e)}function Om(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:S(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:S(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:S(e,"requiredFields")?e.requiredFields.map(qa):void 0,optionalFields:S(e,"optionalFields")?e.optionalFields.map(qa):void 0,optionalFieldsAuto:S(e,"optionalFieldsAuto")?Cl(e.optionalFieldsAuto):void 0,backfill:S(e,"backfill")?pl(e.backfill):void 0,delivery:S(e,"delivery")?hm(e.delivery):void 0}}function Em(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(Ha),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(Ha),optionalFieldsAuto:e.optionalFieldsAuto,backfill:Up(e.backfill),delivery:gm(e.delivery)}}function Sm(e){return Nm(e)}function Nm(e,t){return e==null?e:{objects:S(e,"objects")?e.objects.map(Cm):void 0}}function Tm(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Em)}}function Rm(e){return Am(e)}function Am(e,t){return e==null?e:{enabled:S(e,"enabled")?e.enabled:void 0}}function Pm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Fm(e){return Dm(e)}function Dm(e,t){return e==null?e:{enabled:S(e,"enabled")?e.enabled:void 0,watchFieldsAuto:S(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:S(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function Mm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function km(e){return jm(e)}function jm(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:S(e,"inheritFieldsAndMapping")?e.inheritFieldsAndMapping:void 0,createEvent:S(e,"createEvent")?sm(e.createEvent):void 0,updateEvent:S(e,"updateEvent")?Fm(e.updateEvent):void 0,deleteEvent:S(e,"deleteEvent")?Rm(e.deleteEvent):void 0,associationChangeEvent:S(e,"associationChangeEvent")?Pp(e.associationChangeEvent):void 0,otherEvents:S(e,"otherEvents")?e.otherEvents:void 0}}function Lm(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:e.inheritFieldsAndMapping,createEvent:cm(e.createEvent),updateEvent:Mm(e.updateEvent),deleteEvent:Pm(e.deleteEvent),associationChangeEvent:Dp(e.associationChangeEvent),otherEvents:e.otherEvents}}function Km(e){return Vm(e)}function Vm(e,t){return e==null?e:{objects:S(e,"objects")?e.objects.map(km):void 0}}function Um(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Lm)}}function Ol(e){return $m(e)}function $m(e,t){return e==null?e:{allowAnyFields:S(e,"allowAnyFields")?e.allowAnyFields:void 0}}function qm(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function Hm(e){return Bm(e)}function Bm(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:S(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:S(e,"valueDefaults")?Ol(e.valueDefaults):void 0}}function Jm(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:qm(e.valueDefaults)}}function Wm(e){return zm(e)}function zm(e,t){return e==null?e:{objects:S(e,"objects")?e.objects.map(Hm):void 0}}function Gm(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Jm)}}function Qm(e){return Xm(e)}function Xm(e,t){return e==null?e:{name:e.name,displayName:S(e,"displayName")?e.displayName:void 0,provider:e.provider,read:S(e,"read")?Sm(e.read):void 0,write:S(e,"write")?Wm(e.write):void 0,proxy:S(e,"proxy")?dm(e.proxy):void 0,subscribe:S(e,"subscribe")?Km(e.subscribe):void 0}}function Ym(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:Tm(e.read),write:Gm(e.write),proxy:pm(e.proxy),subscribe:Um(e.subscribe)}}function Zm(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:Ym(e.content)}}function eg(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:Zm(e.latestRevision)}}function tg(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function ng(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 rg(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function ig(e){return og(e)}function og(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function sg(e){return ag(e)}function ag(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,valueType:S(e,"valueType")?e.valueType:void 0,providerType:S(e,"providerType")?e.providerType:void 0,readOnly:S(e,"readOnly")?e.readOnly:void 0,values:S(e,"values")?e.values.map(ig):void 0}}function cg(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:We(e.providerMetadata,ks),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,basicAuth:wl(e.basicAuth),oauth2ClientCredentials:Il(e.oauth2ClientCredentials),oauth2PasswordCredentials:bl(e.oauth2PasswordCredentials),oauth2AuthorizationCode:_l(e.oauth2AuthorizationCode)}}function lg(e){return ug(e)}function ug(e,t){return e==null?e:{enabled:S(e,"enabled")?e.enabled:void 0}}function dg(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,mapToName:S(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:S(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Fo(e){return fg(e)}function fg(e,t){return e==null?e:{...dg(e),...xl(e)}}function pg(e){return hg(e)}function hg(e,t){return e==null?e:{error:S(e,"error")?e.error:void 0,objectName:e.objectName,displayName:e.displayName,mapToName:S(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:S(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:S(e,"requiredFields")?e.requiredFields.map(Fo):void 0,optionalFields:S(e,"optionalFields")?e.optionalFields.map(Fo):void 0,optionalFieldsAuto:S(e,"optionalFieldsAuto")?Cl(e.optionalFieldsAuto):void 0,allFields:S(e,"allFields")?e.allFields.map(Fo):void 0,allFieldsMetadata:S(e,"allFieldsMetadata")?We(e.allFieldsMetadata,sg):void 0,backfill:S(e,"backfill")?pl(e.backfill):void 0}}function mg(e){return gg(e)}function gg(e,t){return e==null?e:{objects:S(e,"objects")?e.objects.map(pg):void 0}}function yg(e){return vg(e)}function vg(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:S(e,"valueDefaults")?Ol(e.valueDefaults):void 0}}function wg(e){return Ig(e)}function Ig(e,t){return e==null?e:{objects:S(e,"objects")?e.objects.map(yg):void 0}}function bg(e){return _g(e)}function _g(e,t){return e==null?e:{name:e.name,displayName:S(e,"displayName")?e.displayName:void 0,provider:e.provider,read:S(e,"read")?mg(e.read):void 0,write:S(e,"write")?wg(e.write):void 0,proxy:S(e,"proxy")?lg(e.proxy):void 0}}function xg(e){return Cg(e)}function Cg(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:bg(e.content)}}function ki(e){return Og(e)}function Og(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:S(e,"group")?vl(e.group):void 0,healthStatus:e.healthStatus,connection:ri(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:S(e,"updateTime")?new Date(e.updateTime):void 0,config:$h(e.config)}}function Eg(e){return Sg(e)}function Sg(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Qm(e.content)}}function Ba(e){return Ng(e)}function Ng(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:S(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:Eg(e.latestRevision)}}function Tg(e){return Rg(e)}function Rg(e,t){return e==null?e:{iconURL:S(e,"iconURL")?e.iconURL:void 0,logoURL:S(e,"logoURL")?e.logoURL:void 0}}function Ag(e){return Pg(e)}function Pg(e,t){return e==null?e:{iconURL:S(e,"iconURL")?e.iconURL:void 0,logoURL:S(e,"logoURL")?e.logoURL:void 0}}function Fg(e){return Dg(e)}function Dg(e,t){return e==null?e:{regular:S(e,"regular")?Ag(e.regular):void 0,darkMode:S(e,"darkMode")?Tg(e.darkMode):void 0}}function Mg(e){return kg(e)}function kg(e,t){return e==null?e:{name:e.name,displayName:S(e,"displayName")?e.displayName:void 0,docsURL:S(e,"docsURL")?e.docsURL:void 0}}function jg(e){return Lg(e)}function Lg(e,t){return e==null?e:{name:e.name}}function Kg(e){return Vg(e)}function Vg(e,t){return e==null?e:{create:S(e,"create")?e.create:void 0,update:S(e,"update")?e.update:void 0,_delete:S(e,"delete")?e.delete:void 0,passThrough:S(e,"passThrough")?e.passThrough:void 0}}function El(e){return Ug(e)}function Ug(e,t){return e==null?e:{bulkWrite:Oh(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write,subscribeSupport:S(e,"subscribeSupport")?Kg(e.subscribeSupport):void 0}}function $g(e){return qg(e)}function qg(e,t){return e==null?e:{displayName:e.displayName,baseURL:e.baseURL,support:El(e.support)}}function Hg(e){return Bg(e)}function Bg(e,t){return e==null?e:{name:e.name,displayName:e.displayName,jqValueSelector:e.jqValueSelector}}function Jg(e){return Wg(e)}function Wg(e,t){return e==null?e:{workspaceRefField:S(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:S(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:S(e,"scopesField")?e.scopesField:void 0,otherFields:S(e,"otherFields")?e.otherFields.map(Hg):void 0}}const Do={AuthorizationCode:"authorizationCode",AuthorizationCodePkce:"authorizationCodePKCE",ClientCredentials:"clientCredentials",Password:"password"};function zg(e){return Gg(e)}function Gg(e,t){return e==null?e:{grantType:e.grantType,authURL:S(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:S(e,"audience")?e.audience:void 0,tokenMetadataFields:Jg(e.tokenMetadataFields),docsURL:S(e,"docsURL")?e.docsURL:void 0,authURLParams:S(e,"authURLParams")?e.authURLParams:void 0}}function Qg(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:We(e.providerMetadata,ks),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 Xg(e){return Yg(e)}function Yg(e,t){return e==null?e:{input:S(e,"input")?e.input.map(Mg):void 0,postAuthentication:S(e,"postAuthentication")?e.postAuthentication.map(jg):void 0}}function Zg(e){return ey(e)}function ey(e,t){return e==null?e:{subscriptionScope:e.subscriptionScope,targetURLScope:e.targetURLScope,registrationTiming:e.registrationTiming}}function Ja(e){return ty(e)}function ty(e,t){return e==null?e:{name:e.name,authType:Mp(e.authType),baseURL:e.baseURL,oauth2Opts:S(e,"oauth2Opts")?zg(e.oauth2Opts):void 0,apiKeyOpts:S(e,"apiKeyOpts")?Rp(e.apiKeyOpts):void 0,basicOpts:S(e,"basicOpts")?yh(e.basicOpts):void 0,support:El(e.support),providerOpts:e.providerOpts,displayName:S(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:S(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:S(e,"media")?Fg(e.media):void 0,labels:S(e,"labels")?e.labels:void 0,subscribeOpts:S(e,"subscribeOpts")?Zg(e.subscribeOpts):void 0,modules:S(e,"modules")?We(e.modules,$g):void 0,metadata:S(e,"metadata")?Xg(e.metadata):void 0}}function ny(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,connection:om(e.connection)}}function ry(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:Yp(e.read),write:gh(e.write),proxy:ml(e.proxy)}}function iy(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:ry(e.content)}}function oy(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:iy(e.config)}}function sy(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:oy(e.installation)}}function ay(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function cy(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:ay(e.project)}}function ly(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 uy(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:ly(e.providerApp)}}class dy extends tn{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new re("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling deleteConnection.");const r={},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 ur(i)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},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:cg(t.generateConnectionParams)},n);return new je(i,s=>ri(s))}async generateConnection(t,n){return await(await this.generateConnectionRaw(t,n)).value()}async getConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new re("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const r={};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 je(i,s=>ri(s))}async getConnection(t,n){return await(await this.getConnectionRaw(t,n)).value()}async listConnectionsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const r={};t.provider!==void 0&&(r.provider=t.provider),t.groupRef!==void 0&&(r.groupRef=t.groupRef),t.consumerRef!==void 0&&(r.consumerRef=t.consumerRef);const 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 je(i,s=>s.map(ri))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}async updateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new re("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling updateConnection.");if(t.updateConnectionRequest===null||t.updateConnectionRequest===void 0)throw new re("updateConnectionRequest","Required parameter requestParameters.updateConnectionRequest was null or undefined when calling updateConnection.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:o,query:r,body:ny(t.updateConnectionRequest)},n);return new je(i,s=>ri(s))}async updateConnection(t,n){return await(await this.updateConnectionRaw(t,n)).value()}}class fy extends tn{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new re("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},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:um(t.installation)},n);return new je(i,s=>ki(s))}async createInstallation(t,n){return await(await this.createInstallationRaw(t,n)).value()}async deleteInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new re("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},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 ur(i)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new re("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},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 je(i,s=>ki(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 re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const 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 je(i,s=>s.map(ki))}async listInstallations(t,n){return await(await this.listInstallationsRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new re("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new re("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},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:sy(t.installationUpdate)},n);return new je(i,s=>ki(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class py extends tn{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");if(t.batchUpsertIntegrationsRequest===null||t.batchUpsertIntegrationsRequest===void 0)throw new re("batchUpsertIntegrationsRequest","Required parameter requestParameters.batchUpsertIntegrationsRequest was null or undefined when calling batchUpsertIntegrations.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:o,query:r,body:wh(t.batchUpsertIntegrationsRequest)},n);return new je(i,s=>s.map(Ba))}async batchUpsertIntegrations(t,n){return await(await this.batchUpsertIntegrationsRaw(t,n)).value()}async createIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new re("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},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:eg(t.integration)},n);return new ur(i)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},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 ur(i)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},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 je(i,s=>s.map(Ba))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class hy extends tn{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new re("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/oauth-connect",method:"POST",headers:o,query:r,body:Qg(t.connectOAuthParams)},n);return this.isJsonMime(i.headers.get("content-type"))?new je(i):new Ua(i)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}async oauthUpdateRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling oauthUpdate.");if(t.connectionId===null||t.connectionId===void 0)throw new re("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling oauthUpdate.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}:oauth-update".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:o,query:r},n);return this.isJsonMime(i.headers.get("content-type"))?new je(i):new Ua(i)}async oauthUpdate(t,n){return await(await this.oauthUpdateRaw(t,n)).value()}}class my extends tn{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new re("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},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:tg(t.project)},n);return new je(i,s=>Mi(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async deleteProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProject.");const r={},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 ur(i)}async deleteProject(t,n){await this.deleteProjectRaw(t,n)}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={};t.includeEntitlements!==void 0&&(r.includeEntitlements=t.includeEntitlements);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new je(i,s=>Mi(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 je(o,i=>i.map(Mi))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new re("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},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:cy(t.projectUpdate)},n);return new je(i,s=>Mi(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class gy extends tn{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new re("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},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 je(i,s=>Ja(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 je(o,i=>We(i,Ja))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class yy extends tn{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new re("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},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:ng(t.providerApp)},n);return new je(i,s=>Bi(s))}async createProviderApp(t,n){return await(await this.createProviderAppRaw(t,n)).value()}async deleteProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new re("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},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 ur(i)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},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 je(i,s=>s.map(Bi))}async listProviderApps(t,n){return await(await this.listProviderAppsRaw(t,n)).value()}async updateProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new re("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new re("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},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:uy(t.providerAppUpdate)},n);return new je(i,s=>Bi(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class vy extends tn{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");if(t.revision===null||t.revision===void 0)throw new re("revision","Required parameter requestParameters.revision was null or undefined when calling createRevision.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:r,body:rg(t.revision)},n);return new ur(i)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new re("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new re("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const 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 je(i,s=>xg(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class Sl{constructor(t){this.connectionApi=new dy(t),this.installationApi=new fy(t),this.integrationApi=new py(t),this.oAuthApi=new hy(t),this.projectApi=new my(t),this.providerApi=new gy(t),this.providerAppApi=new yy(t),this.revisionApi=new vy(t)}}const Nl="2.7.3",wy="v1",ji="https://api.withampersand.com";function Tl(){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 ji;case"mock":return"http://127.0.0.1:4010";case"":return ji;default:return e??ji}}catch{return ji}}const Iy=(e,t)=>`${e}/${t}`;function by(){return Iy(Tl(),wy)}const _y=Tl(),Rl=by(),xy=new Ms({basePath:Rl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Nl}});let Cy=new Sl(xy);const js=()=>Cy;function dt(){const e=cl();return y.useCallback(async()=>{e||console.error("Unable to create API service without API key.");const n=new Ms({basePath:Rl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Nl,"X-Api-Key":e}});return new Sl(n)},[e])}const Oy=e=>{const t=dt();return yn({queryKey:["project",e],queryFn:async()=>(await t()).projectApi.getProject({projectIdOrName:e})})},Al=y.createContext({project:null,appName:"",projectId:"",projectIdOrName:"",isLoading:!0}),Te=()=>{const e=y.useContext(Al);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e};function Ey({projectIdOrName:e,children:t}){const{setError:n}=Dt(),{data:r,isLoading:o,isError:i}=Oy(e);y.useEffect(()=>{i&&n(ue.PROJECT,e)},[i,e,n]);const s=y.useMemo(()=>({projectId:(r==null?void 0:r.id)||"",projectIdOrName:e,project:r||null,appName:(r==null?void 0:r.appName)||"",isLoading:o}),[e,r,o]);return c.jsx(Al.Provider,{value:s,children:t})}function Pl(){const e=dt(),{projectIdOrName:t}=Te();return yn({queryKey:["amp","integrations",t],queryFn:async()=>{if(!t)throw new Error("Project ID or name is required");return(await e()).integrationApi.listIntegrations({projectIdOrName:t})},enabled:!!t})}const Le=async(e,t)=>{var n;if(e instanceof ul){const{status:r,statusText:o}=e.response;console.error(r===500?"Internal Server Error (500):":r===400?"Bad Request (400):":`Error (${r}):`,o);try{const s=await e.response.clone().json(),a=((n=s==null?void 0:s.causes)==null?void 0:n.join(`
|
|
2
|
-
`))||(s==null?void 0:s.detail);a?(console.error("[Error Message]",a),s!=null&&s.remedy&&console.error("[Remedy]",s.remedy)):console.error("Unexpected error response:",s);const
|
|
1
|
+
"use strict";var Pa=e=>{throw TypeError(e)};var Ao=(e,t,n)=>t.has(e)||Pa("Cannot "+n);var O=(e,t,n)=>(Ao(e,t,"read from private field"),n?n.call(e):t.get(e)),oe=(e,t,n)=>t.has(e)?Pa("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),z=(e,t,n,r)=>(Ao(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),pe=(e,t,n)=>(Ao(e,t,"access private method"),n);var Fi=(e,t,n,r)=>({set _(o){z(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 jf(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=jf(v);var Jr=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(){}},cr=typeof window>"u"||"Deno"in globalThis;function Pt(){}function Lf(e,t){return typeof e=="function"?e(t):e}function Xo(e){return typeof e=="number"&&e>=0&&e!==1/0}function Qc(e,t){return Math.max(e+(t||0)-Date.now(),0)}function xr(e,t){return typeof e=="function"?e(t):e}function Bt(e,t){return typeof e=="function"?e(t):e}function Fa(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==Fs(s,t.options))return!1}else if(!ai(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 Da(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(lr(t.options.mutationKey)!==lr(i))return!1}else if(!ai(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function Fs(e,t){return((t==null?void 0:t.queryKeyHashFn)||lr)(e)}function lr(e){return JSON.stringify(e,(t,n)=>Zo(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function ai(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>ai(e[n],t[n])):!1}function Yo(e,t){if(e===t)return e;const n=Ma(e)&&Ma(t);if(n||Zo(e)&&Zo(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]=Yo(e[d],t[d]),a[d]===e[d]&&e[d]!==void 0&&c++)}return o===s&&c===o?e:a}return t}function Gi(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Ma(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Zo(e){if(!ka(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!ka(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function ka(e){return Object.prototype.toString.call(e)==="[object Object]"}function Kf(e){return new Promise(t=>{setTimeout(t,e)})}function es(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 Yo(e,t)}catch(r){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`),r}return Yo(e,t)}return t}function Vf(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Uf(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Qi=Symbol();function Xc(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Qi&&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===Qi?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var Zn,Nn,Cr,Vc,$f=(Vc=class extends Jr{constructor(){super();oe(this,Zn);oe(this,Nn);oe(this,Cr);z(this,Cr,t=>{if(!cr&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){O(this,Nn)||this.setEventListener(O(this,Cr))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Nn))==null||t.call(this),z(this,Nn,void 0))}setEventListener(t){var n;z(this,Cr,t),(n=O(this,Nn))==null||n.call(this),z(this,Nn,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){O(this,Zn)!==t&&(z(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,Nn=new WeakMap,Cr=new WeakMap,Vc),Ds=new $f,Or,Tn,Er,Uc,qf=(Uc=class extends Jr{constructor(){super();oe(this,Or,!0);oe(this,Tn);oe(this,Er);z(this,Er,t=>{if(!cr&&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,Tn)||this.setEventListener(O(this,Er))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Tn))==null||t.call(this),z(this,Tn,void 0))}setEventListener(t){var n;z(this,Er,t),(n=O(this,Tn))==null||n.call(this),z(this,Tn,t(this.setOnline.bind(this)))}setOnline(t){O(this,Or)!==t&&(z(this,Or,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return O(this,Or)}},Or=new WeakMap,Tn=new WeakMap,Er=new WeakMap,Uc),Xi=new qf;function ts(){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 Hf(e){return Math.min(1e3*2**e,3e4)}function Yc(e){return(e??"online")==="online"?Xi.isOnline():!0}var Zc=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Po(e){return e instanceof Zc}function el(e){let t=!1,n=0,r=!1,o;const i=ts(),s=w=>{var p;r||(h(new Zc(w)),(p=e.abort)==null||p.call(e))},a=()=>{t=!0},c=()=>{t=!1},u=()=>Ds.isFocused()&&(e.networkMode==="always"||Xi.isOnline())&&e.canRun(),d=()=>Yc(e.networkMode)&&e.canRun(),f=w=>{var p;r||(r=!0,(p=e.onSuccess)==null||p.call(e,w),o==null||o(),i.resolve(w))},h=w=>{var p;r||(r=!0,(p=e.onError)==null||p.call(e,w),o==null||o(),i.reject(w))},m=()=>new Promise(w=>{var p;o=_=>{(r||u())&&w(_)},(p=e.onPause)==null||p.call(e)}).then(()=>{var w;o=void 0,r||(w=e.onContinue)==null||w.call(e)}),b=()=>{if(r)return;let w;const p=n===0?e.initialPromise:void 0;try{w=p??e.fn()}catch(_){w=Promise.reject(_)}Promise.resolve(w).then(f).catch(_=>{var S;if(r)return;const g=e.retry??(cr?0:3),y=e.retryDelay??Hf,I=typeof y=="function"?y(n,_):y,C=g===!0||typeof g=="number"&&n<g||typeof g=="function"&&g(n,_);if(t||!C){h(_);return}n++,(S=e.onFail)==null||S.call(e,n,_),Kf(I).then(()=>u()?void 0:m()).then(()=>{t?h(_):b()})})};return{promise:i,cancel:s,continue:()=>(o==null||o(),i),cancelRetry:a,continueRetry:c,canStart:d,start:()=>(d()?b():m().then(b),i)}}var Bf=e=>setTimeout(e,0);function Jf(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=Bf;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 Je=Jf(),er,$c,tl=($c=class{constructor(){oe(this,er)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Xo(this.gcTime)&&z(this,er,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(cr?1/0:5*60*1e3))}clearGcTimeout(){O(this,er)&&(clearTimeout(O(this,er)),z(this,er,void 0))}},er=new WeakMap,$c),Sr,Nr,At,tr,at,hi,nr,qt,fn,qc,Wf=(qc=class extends tl{constructor(t){super();oe(this,qt);oe(this,Sr);oe(this,Nr);oe(this,At);oe(this,tr);oe(this,at);oe(this,hi);oe(this,nr);z(this,nr,!1),z(this,hi,t.defaultOptions),this.setOptions(t.options),this.observers=[],z(this,tr,t.client),z(this,At,O(this,tr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,z(this,Sr,zf(this.options)),this.state=t.state??O(this,Sr),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=O(this,at))==null?void 0:t.promise}setOptions(t){this.options={...O(this,hi),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&O(this,At).remove(this)}setData(t,n){const r=es(this.state.data,t,this.options);return pe(this,qt,fn).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,qt,fn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=O(this,at))==null?void 0:r.promise;return(o=O(this,at))==null||o.cancel(t),n?n.then(Pt).catch(Pt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(O(this,Sr))}isActive(){return this.observers.some(t=>Bt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Qi||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||!Qc(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=O(this,at))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=O(this,at))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),O(this,At).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,at)&&(O(this,nr)?O(this,at).cancel({revert:!0}):O(this,at).cancelRetry()),this.scheduleGc()),O(this,At).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||pe(this,qt,fn).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,at))return O(this,at).continueRetry(),O(this,at).promise}if(t&&this.setOptions(t),!this.options.queryFn){const f=this.observers.find(h=>h.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:()=>(z(this,nr,!0),r.signal)})},i=()=>{const f=Xc(this.options,n),h={client:O(this,tr),queryKey:this.queryKey,meta:this.meta};return o(h),z(this,nr,!1),this.options.persister?this.options.persister(f,h,this):f(h)},s={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:O(this,tr),state:this.state,fetchFn:i};o(s),(c=this.options.behavior)==null||c.onFetch(s,this),z(this,Nr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=s.fetchOptions)==null?void 0:u.meta))&&pe(this,qt,fn).call(this,{type:"fetch",meta:(d=s.fetchOptions)==null?void 0:d.meta});const a=f=>{var h,m,b,w;Po(f)&&f.silent||pe(this,qt,fn).call(this,{type:"error",error:f}),Po(f)||((m=(h=O(this,At).config).onError)==null||m.call(h,f,this),(w=(b=O(this,At).config).onSettled)==null||w.call(b,this.state.data,f,this)),this.scheduleGc()};return z(this,at,el({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:f=>{var h,m,b,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(p){a(p);return}(m=(h=O(this,At).config).onSuccess)==null||m.call(h,f,this),(w=(b=O(this,At).config).onSettled)==null||w.call(b,f,this.state.error,this),this.scheduleGc()},onError:a,onFail:(f,h)=>{pe(this,qt,fn).call(this,{type:"failed",failureCount:f,error:h})},onPause:()=>{pe(this,qt,fn).call(this,{type:"pause"})},onContinue:()=>{pe(this,qt,fn).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),O(this,at).start()}},Sr=new WeakMap,Nr=new WeakMap,At=new WeakMap,tr=new WeakMap,at=new WeakMap,hi=new WeakMap,nr=new WeakMap,qt=new WeakSet,fn=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,...nl(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 Po(o)&&o.revert&&O(this,Nr)?{...O(this,Nr),fetchStatus:"idle"}:{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Je.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),O(this,At).notify({query:this,type:"updated",action:t})})},qc);function nl(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Yc(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function zf(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 Yt,Hc,Gf=(Hc=class extends Jr{constructor(t={}){super();oe(this,Yt);this.config=t,z(this,Yt,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??Fs(o,n);let s=this.get(i);return s||(s=new Wf({client:t,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){O(this,Yt).has(t.queryHash)||(O(this,Yt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=O(this,Yt).get(t.queryHash);n&&(t.destroy(),n===t&&O(this,Yt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Je.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return O(this,Yt).get(t)}getAll(){return[...O(this,Yt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Fa(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Fa(t,r)):n}notify(t){Je.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Je.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Je.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Yt=new WeakMap,Hc),Zt,lt,rr,en,Sn,Bc,Qf=(Bc=class extends tl{constructor(t){super();oe(this,en);oe(this,Zt);oe(this,lt);oe(this,rr);this.mutationId=t.mutationId,z(this,lt,t.mutationCache),z(this,Zt,[]),this.state=t.state||rl(),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,Zt).includes(t)||(O(this,Zt).push(t),this.clearGcTimeout(),O(this,lt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){z(this,Zt,O(this,Zt).filter(n=>n!==t)),this.scheduleGc(),O(this,lt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){O(this,Zt).length||(this.state.status==="pending"?this.scheduleGc():O(this,lt).remove(this))}continue(){var t;return((t=O(this,rr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,s,a,c,u,d,f,h,m,b,w,p,_,g,y,I,C,S,T,R;const n=()=>{pe(this,en,Sn).call(this,{type:"continue"})};z(this,rr,el({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(F,U)=>{pe(this,en,Sn).call(this,{type:"failed",failureCount:F,error:U})},onPause:()=>{pe(this,en,Sn).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>O(this,lt).canRun(this)}));const r=this.state.status==="pending",o=!O(this,rr).canStart();try{if(r)n();else{pe(this,en,Sn).call(this,{type:"pending",variables:t,isPaused:o}),await((s=(i=O(this,lt).config).onMutate)==null?void 0:s.call(i,t,this));const U=await((c=(a=this.options).onMutate)==null?void 0:c.call(a,t));U!==this.state.context&&pe(this,en,Sn).call(this,{type:"pending",context:U,variables:t,isPaused:o})}const F=await O(this,rr).start();return await((d=(u=O(this,lt).config).onSuccess)==null?void 0:d.call(u,F,t,this.state.context,this)),await((h=(f=this.options).onSuccess)==null?void 0:h.call(f,F,t,this.state.context)),await((b=(m=O(this,lt).config).onSettled)==null?void 0:b.call(m,F,null,this.state.variables,this.state.context,this)),await((p=(w=this.options).onSettled)==null?void 0:p.call(w,F,null,t,this.state.context)),pe(this,en,Sn).call(this,{type:"success",data:F}),F}catch(F){try{throw await((g=(_=O(this,lt).config).onError)==null?void 0:g.call(_,F,t,this.state.context,this)),await((I=(y=this.options).onError)==null?void 0:I.call(y,F,t,this.state.context)),await((S=(C=O(this,lt).config).onSettled)==null?void 0:S.call(C,void 0,F,this.state.variables,this.state.context,this)),await((R=(T=this.options).onSettled)==null?void 0:R.call(T,void 0,F,t,this.state.context)),F}finally{pe(this,en,Sn).call(this,{type:"error",error:F})}}finally{O(this,lt).runNext(this)}}},Zt=new WeakMap,lt=new WeakMap,rr=new WeakMap,en=new WeakSet,Sn=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),Je.batch(()=>{O(this,Zt).forEach(r=>{r.onMutationUpdate(t)}),O(this,lt).notify({mutation:this,type:"updated",action:t})})},Bc);function rl(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var pn,Ht,mi,Jc,Xf=(Jc=class extends Jr{constructor(t={}){super();oe(this,pn);oe(this,Ht);oe(this,mi);this.config=t,z(this,pn,new Set),z(this,Ht,new Map),z(this,mi,0)}build(t,n,r){const o=new Qf({mutationCache:this,mutationId:++Fi(this,mi)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){O(this,pn).add(t);const n=Di(t);if(typeof n=="string"){const r=O(this,Ht).get(n);r?r.push(t):O(this,Ht).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(O(this,pn).delete(t)){const n=Di(t);if(typeof n=="string"){const r=O(this,Ht).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,Ht).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Di(t);if(typeof n=="string"){const r=O(this,Ht).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=Di(t);if(typeof n=="string"){const o=(r=O(this,Ht).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(){Je.batch(()=>{O(this,pn).forEach(t=>{this.notify({type:"removed",mutation:t})}),O(this,pn).clear(),O(this,Ht).clear()})}getAll(){return Array.from(O(this,pn))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Da(n,r))}findAll(t={}){return this.getAll().filter(n=>Da(t,n))}notify(t){Je.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Je.batch(()=>Promise.all(t.map(n=>n.continue().catch(Pt))))}},pn=new WeakMap,Ht=new WeakMap,mi=new WeakMap,Jc);function Di(e){var t;return(t=e.options.scope)==null?void 0:t.id}function ja(e){return{onFetch:(t,n)=>{var d,f,h,m,b;const r=t.options,o=(h=(f=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:h.direction,i=((m=t.state.data)==null?void 0:m.pages)||[],s=((b=t.state.data)==null?void 0:b.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const u=async()=>{let w=!1;const p=y=>{Object.defineProperty(y,"signal",{enumerable:!0,get:()=>(t.signal.aborted?w=!0:t.signal.addEventListener("abort",()=>{w=!0}),t.signal)})},_=Xc(t.options,t.fetchOptions),g=async(y,I,C)=>{if(w)return Promise.reject();if(I==null&&y.pages.length)return Promise.resolve(y);const S={client:t.client,queryKey:t.queryKey,pageParam:I,direction:C?"backward":"forward",meta:t.options.meta};p(S);const T=await _(S),{maxPages:R}=t.options,F=C?Uf:Vf;return{pages:F(y.pages,T,R),pageParams:F(y.pageParams,I,R)}};if(o&&i.length){const y=o==="backward",I=y?Yf:La,C={pages:i,pageParams:s},S=I(r,C);a=await g(C,S,y)}else{const y=e??i.length;do{const I=c===0?s[0]??r.initialPageParam:La(r,a);if(c>0&&I==null)break;a=await g(a,I),c++}while(c<y)}return a};t.options.persister?t.fetchFn=()=>{var w,p;return(p=(w=t.options).persister)==null?void 0:p.call(w,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function La(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 Yf(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 ke,Rn,An,Tr,Rr,Pn,Ar,Pr,Wc,Zf=(Wc=class{constructor(e={}){oe(this,ke);oe(this,Rn);oe(this,An);oe(this,Tr);oe(this,Rr);oe(this,Pn);oe(this,Ar);oe(this,Pr);z(this,ke,e.queryCache||new Gf),z(this,Rn,e.mutationCache||new Xf),z(this,An,e.defaultOptions||{}),z(this,Tr,new Map),z(this,Rr,new Map),z(this,Pn,0)}mount(){Fi(this,Pn)._++,O(this,Pn)===1&&(z(this,Ar,Ds.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,ke).onFocus())})),z(this,Pr,Xi.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,ke).onOnline())})))}unmount(){var e,t;Fi(this,Pn)._--,O(this,Pn)===0&&((e=O(this,Ar))==null||e.call(this),z(this,Ar,void 0),(t=O(this,Pr))==null||t.call(this),z(this,Pr,void 0))}isFetching(e){return O(this,ke).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return O(this,Rn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=O(this,ke).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=O(this,ke).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(xr(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return O(this,ke).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,ke).get(r.queryHash),i=o==null?void 0:o.state.data,s=Lf(t,i);if(s!==void 0)return O(this,ke).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return Je.batch(()=>O(this,ke).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,ke).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=O(this,ke);Je.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=O(this,ke);return Je.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Je.batch(()=>O(this,ke).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Pt).catch(Pt)}invalidateQueries(e,t={}){return Je.batch(()=>(O(this,ke).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Je.batch(()=>O(this,ke).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(Pt)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Pt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=O(this,ke).build(this,t);return n.isStaleByTime(xr(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Pt).catch(Pt)}fetchInfiniteQuery(e){return e.behavior=ja(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Pt).catch(Pt)}ensureInfiniteQueryData(e){return e.behavior=ja(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Xi.isOnline()?O(this,Rn).resumePausedMutations():Promise.resolve()}getQueryCache(){return O(this,ke)}getMutationCache(){return O(this,Rn)}getDefaultOptions(){return O(this,An)}setDefaultOptions(e){z(this,An,e)}setQueryDefaults(e,t){O(this,Tr).set(lr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...O(this,Tr).values()],n={};return t.forEach(r=>{ai(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){O(this,Rr).set(lr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...O(this,Rr).values()],n={};return t.forEach(r=>{ai(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...O(this,An).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Fs(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===Qi&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...O(this,An).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){O(this,ke).clear(),O(this,Rn).clear()}},ke=new WeakMap,Rn=new WeakMap,An=new WeakMap,Tr=new WeakMap,Rr=new WeakMap,Pn=new WeakMap,Ar=new WeakMap,Pr=new WeakMap,Wc),mt,ye,gi,ut,ir,Fr,Fn,Dn,yi,Dr,Mr,or,sr,Mn,kr,Oe,ni,ns,rs,is,os,ss,as,cs,il,zc,ep=(zc=class extends Jr{constructor(t,n){super();oe(this,Oe);oe(this,mt);oe(this,ye);oe(this,gi);oe(this,ut);oe(this,ir);oe(this,Fr);oe(this,Fn);oe(this,Dn);oe(this,yi);oe(this,Dr);oe(this,Mr);oe(this,or);oe(this,sr);oe(this,Mn);oe(this,kr,new Set);this.options=n,z(this,mt,t),z(this,Dn,null),z(this,Fn,ts()),this.options.experimental_prefetchInRender||O(this,Fn).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),Ka(O(this,ye),this.options)?pe(this,Oe,ni).call(this):this.updateResult(),pe(this,Oe,os).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ls(O(this,ye),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ls(O(this,ye),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,pe(this,Oe,ss).call(this),pe(this,Oe,as).call(this),O(this,ye).removeObserver(this)}setOptions(t){const n=this.options,r=O(this,ye);if(this.options=O(this,mt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Bt(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,cs).call(this),O(this,ye).setOptions(this.options),n._defaulted&&!Gi(this.options,n)&&O(this,mt).getQueryCache().notify({type:"observerOptionsUpdated",query:O(this,ye),observer:this});const o=this.hasListeners();o&&Va(O(this,ye),r,this.options,n)&&pe(this,Oe,ni).call(this),this.updateResult(),o&&(O(this,ye)!==r||Bt(this.options.enabled,O(this,ye))!==Bt(n.enabled,O(this,ye))||xr(this.options.staleTime,O(this,ye))!==xr(n.staleTime,O(this,ye)))&&pe(this,Oe,ns).call(this);const i=pe(this,Oe,rs).call(this);o&&(O(this,ye)!==r||Bt(this.options.enabled,O(this,ye))!==Bt(n.enabled,O(this,ye))||i!==O(this,Mn))&&pe(this,Oe,is).call(this,i)}getOptimisticResult(t){const n=O(this,mt).getQueryCache().build(O(this,mt),t),r=this.createResult(n,t);return np(this,r)&&(z(this,ut,r),z(this,Fr,this.options),z(this,ir,O(this,ye).state)),r}getCurrentResult(){return O(this,ut)}trackResult(t,n){return new Proxy(t,{get:(r,o)=>(this.trackProp(o),n==null||n(o),Reflect.get(r,o))})}trackProp(t){O(this,kr).add(t)}getCurrentQuery(){return O(this,ye)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=O(this,mt).defaultQueryOptions(t),r=O(this,mt).getQueryCache().build(O(this,mt),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return pe(this,Oe,ni).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),O(this,ut)))}createResult(t,n){var F;const r=O(this,ye),o=this.options,i=O(this,ut),s=O(this,ir),a=O(this,Fr),u=t!==r?t.state:O(this,gi),{state:d}=t;let f={...d},h=!1,m;if(n._optimisticResults){const U=this.hasListeners(),Q=!U&&Ka(t,n),J=U&&Va(t,r,n,o);(Q||J)&&(f={...f,...nl(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:b,errorUpdatedAt:w,status:p}=f;m=f.data;let _=!1;if(n.placeholderData!==void 0&&m===void 0&&p==="pending"){let U;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(U=i.data,_=!0):U=typeof n.placeholderData=="function"?n.placeholderData((F=O(this,Mr))==null?void 0:F.state.data,O(this,Mr)):n.placeholderData,U!==void 0&&(p="success",m=es(i==null?void 0:i.data,U,n),h=!0)}if(n.select&&m!==void 0&&!_)if(i&&m===(s==null?void 0:s.data)&&n.select===O(this,yi))m=O(this,Dr);else try{z(this,yi,n.select),m=n.select(m),m=es(i==null?void 0:i.data,m,n),z(this,Dr,m),z(this,Dn,null)}catch(U){z(this,Dn,U)}O(this,Dn)&&(b=O(this,Dn),m=O(this,Dr),w=Date.now(),p="error");const g=f.fetchStatus==="fetching",y=p==="pending",I=p==="error",C=y&&g,S=m!==void 0,R={status:p,fetchStatus:f.fetchStatus,isPending:y,isSuccess:p==="success",isError:I,isInitialLoading:C,isLoading:C,data:m,dataUpdatedAt:f.dataUpdatedAt,error:b,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:g,isRefetching:g&&!y,isLoadingError:I&&!S,isPaused:f.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:I&&S,isStale:Ms(t,n),refetch:this.refetch,promise:O(this,Fn)};if(this.options.experimental_prefetchInRender){const U=Y=>{R.status==="error"?Y.reject(R.error):R.data!==void 0&&Y.resolve(R.data)},Q=()=>{const Y=z(this,Fn,R.promise=ts());U(Y)},J=O(this,Fn);switch(J.status){case"pending":t.queryHash===r.queryHash&&U(J);break;case"fulfilled":(R.status==="error"||R.data!==J.value)&&Q();break;case"rejected":(R.status!=="error"||R.error!==J.reason)&&Q();break}}return R}updateResult(){const t=O(this,ut),n=this.createResult(O(this,ye),this.options);if(z(this,ir,O(this,ye).state),z(this,Fr,this.options),O(this,ir).data!==void 0&&z(this,Mr,O(this,ye)),Gi(n,t))return;z(this,ut,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:o}=this.options,i=typeof o=="function"?o():o;if(i==="all"||!i&&!O(this,kr).size)return!0;const s=new Set(i??O(this,kr));return this.options.throwOnError&&s.add("error"),Object.keys(O(this,ut)).some(a=>{const c=a;return O(this,ut)[c]!==t[c]&&s.has(c)})};pe(this,Oe,il).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&pe(this,Oe,os).call(this)}},mt=new WeakMap,ye=new WeakMap,gi=new WeakMap,ut=new WeakMap,ir=new WeakMap,Fr=new WeakMap,Fn=new WeakMap,Dn=new WeakMap,yi=new WeakMap,Dr=new WeakMap,Mr=new WeakMap,or=new WeakMap,sr=new WeakMap,Mn=new WeakMap,kr=new WeakMap,Oe=new WeakSet,ni=function(t){pe(this,Oe,cs).call(this);let n=O(this,ye).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Pt)),n},ns=function(){pe(this,Oe,ss).call(this);const t=xr(this.options.staleTime,O(this,ye));if(cr||O(this,ut).isStale||!Xo(t))return;const r=Qc(O(this,ut).dataUpdatedAt,t)+1;z(this,or,setTimeout(()=>{O(this,ut).isStale||this.updateResult()},r))},rs=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(O(this,ye)):this.options.refetchInterval)??!1},is=function(t){pe(this,Oe,as).call(this),z(this,Mn,t),!(cr||Bt(this.options.enabled,O(this,ye))===!1||!Xo(O(this,Mn))||O(this,Mn)===0)&&z(this,sr,setInterval(()=>{(this.options.refetchIntervalInBackground||Ds.isFocused())&&pe(this,Oe,ni).call(this)},O(this,Mn)))},os=function(){pe(this,Oe,ns).call(this),pe(this,Oe,is).call(this,pe(this,Oe,rs).call(this))},ss=function(){O(this,or)&&(clearTimeout(O(this,or)),z(this,or,void 0))},as=function(){O(this,sr)&&(clearInterval(O(this,sr)),z(this,sr,void 0))},cs=function(){const t=O(this,mt).getQueryCache().build(O(this,mt),this.options);if(t===O(this,ye))return;const n=O(this,ye);z(this,ye,t),z(this,gi,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},il=function(t){Je.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(O(this,ut))}),O(this,mt).getQueryCache().notify({query:O(this,ye),type:"observerResultsUpdated"})})},zc);function tp(e,t){return Bt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Ka(e,t){return tp(e,t)||e.state.data!==void 0&&ls(e,t,t.refetchOnMount)}function ls(e,t,n){if(Bt(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Ms(e,t)}return!1}function Va(e,t,n,r){return(e!==t||Bt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Ms(e,n)}function Ms(e,t){return Bt(t.enabled,e)!==!1&&e.isStaleByTime(xr(t.staleTime,e))}function np(e,t){return!Gi(e.getCurrentResult(),t)}var kn,jn,gt,hn,gn,Hi,us,Gc,rp=(Gc=class extends Jr{constructor(n,r){super();oe(this,gn);oe(this,kn);oe(this,jn);oe(this,gt);oe(this,hn);z(this,kn,n),this.setOptions(r),this.bindMethods(),pe(this,gn,Hi).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,kn).defaultMutationOptions(n),Gi(this.options,r)||O(this,kn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:O(this,gt),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&lr(r.mutationKey)!==lr(this.options.mutationKey)?this.reset():((o=O(this,gt))==null?void 0:o.state.status)==="pending"&&O(this,gt).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=O(this,gt))==null||n.removeObserver(this)}onMutationUpdate(n){pe(this,gn,Hi).call(this),pe(this,gn,us).call(this,n)}getCurrentResult(){return O(this,jn)}reset(){var n;(n=O(this,gt))==null||n.removeObserver(this),z(this,gt,void 0),pe(this,gn,Hi).call(this),pe(this,gn,us).call(this)}mutate(n,r){var o;return z(this,hn,r),(o=O(this,gt))==null||o.removeObserver(this),z(this,gt,O(this,kn).getMutationCache().build(O(this,kn),this.options)),O(this,gt).addObserver(this),O(this,gt).execute(n)}},kn=new WeakMap,jn=new WeakMap,gt=new WeakMap,hn=new WeakMap,gn=new WeakSet,Hi=function(){var r;const n=((r=O(this,gt))==null?void 0:r.state)??rl();z(this,jn,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},us=function(n){Je.batch(()=>{var r,o,i,s,a,c,u,d;if(O(this,hn)&&this.hasListeners()){const f=O(this,jn).variables,h=O(this,jn).context;(n==null?void 0:n.type)==="success"?((o=(r=O(this,hn)).onSuccess)==null||o.call(r,n.data,f,h),(s=(i=O(this,hn)).onSettled)==null||s.call(i,n.data,null,f,h)):(n==null?void 0:n.type)==="error"&&((c=(a=O(this,hn)).onError)==null||c.call(a,n.error,f,h),(d=(u=O(this,hn)).onSettled)==null||d.call(u,void 0,n.error,f,h))}this.listeners.forEach(f=>{f(O(this,jn))})})},Gc),ol=k.createContext(void 0),vt=e=>{const t=k.useContext(ol);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},ip=({client:e,children:t})=>(k.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(ol.Provider,{value:e,children:t})),sl=k.createContext(!1),op=()=>k.useContext(sl);sl.Provider;function sp(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var ap=k.createContext(sp()),cp=()=>k.useContext(ap);function al(e,t){return typeof e=="function"?e(...t):!!e}function ds(){}var lp=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},up=e=>{k.useEffect(()=>{e.clearReset()},[e])},dp=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||al(n,[e.error,r])),fp=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)))},pp=(e,t)=>e.isLoading&&e.isFetching&&!t,hp=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Ua=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function mp(e,t,n){var f,h,m,b,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=vt(),o=op(),i=cp(),s=r.defaultQueryOptions(e);(h=(f=r.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||h.call(f,s),process.env.NODE_ENV!=="production"&&(s.queryFn||console.error(`[${s.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),s._optimisticResults=o?"isRestoring":"optimistic",fp(s),lp(s,i),up(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(p=>{const _=d?c.subscribe(Je.batchCalls(p)):ds;return c.updateResult(),_},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),k.useEffect(()=>{c.setOptions(s)},[s,c]),hp(s,u))throw Ua(s,c,i);if(dp({result:u,errorResetBoundary:i,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw u.error;if((b=(m=r.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||b.call(m,s,u),s.experimental_prefetchInRender&&!cr&&pp(u,o)){const p=a?Ua(s,c,i):(w=r.getQueryCache().get(s.queryHash))==null?void 0:w.promise;p==null||p.catch(ds).finally(()=>{c.updateResult()})}return s.notifyOnChangeProps?u:c.trackResult(u)}function yn(e,t){return mp(e,ep)}function Wr(e,t){const n=vt(),[r]=k.useState(()=>new rp(n,e));k.useEffect(()=>{r.setOptions(e)},[r,e]);const o=k.useSyncExternalStore(k.useCallback(s=>r.subscribe(Je.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=k.useCallback((s,a)=>{r.mutate(s,a).catch(ds)},[r]);if(o.error&&al(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:i,mutateAsync:o.mutate}}const cl=v.createContext(null),gp=cl.Provider,ll=()=>{const e=v.useContext(cl);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 ul=v.createContext(void 0);function Dt(){const e=v.useContext(ul);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const yp=(()=>{const e={};return Object.values(ue).forEach(t=>{e[t]={}}),e})();function vp({children:e}){const[t,n]=v.useState(yp),r=v.useCallback((d,f,h=!0)=>{n(m=>{const b={...m};return b[d]=b[d]||{},b[d][f]=h,b})},[n]),o=v.useCallback((d,f)=>{var h;return!!((h=t[d])!=null&&h[f])},[t]),i=v.useCallback((d,f)=>{var h;return(h=t[d])==null?void 0:h[f]},[t]),s=v.useCallback((d,f)=>{n(h=>{var b;const m={...h};return(b=m[d])==null||delete b[f],m})},[n]),a=v.useCallback(d=>{n(f=>{const h={...f};return h[d]={},h})},[n]),c=v.useCallback((d,f)=>{n(h=>{const m={...h};return m[d]=m[d]||{},f.forEach(b=>{m[d][b]=!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(ul.Provider,{value:u,children:e})}const wp="https://api.withampersand.com/v1".replace(/\/+$/,"");class ks{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:wp}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||fl}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 Ip=new ks,fo=class fo{constructor(t=Ip){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 _p(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?fo.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 dl(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:xp(a.body)||a.body instanceof URLSearchParams||bp(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}};fo.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let nn=fo;function bp(e){return typeof Blob<"u"&&e instanceof Blob}function xp(e){return typeof FormData<"u"&&e instanceof FormData}class dl extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class _p extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class re extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function N(e,t){const n=e[t];return n!=null}function fl(e,t=""){return Object.keys(e).map(n=>pl(n,e[n],t)).filter(n=>n.length>0).join("&")}function pl(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 pl(e,o,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?fl(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function We(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class je{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class ur{constructor(t){this.raw=t}async value(){}}class $a{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function Cp(e){return Op(e)}function Op(e,t){return e==null?e:{fieldUsed:N(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:N(e,"keyFormat")?e.keyFormat:void 0}}function Ep(e){return Sp(e)}function Sp(e,t){return e==null?e:{name:e.name,valuePrefix:N(e,"valuePrefix")?e.valuePrefix:void 0}}function Np(e){return Tp(e)}function Tp(e,t){return e==null?e:{name:e.name}}function Rp(e){return Ap(e)}function Ap(e,t){return e==null?e:{attachmentType:e.attachmentType,query:N(e,"query")?Np(e.query):void 0,header:N(e,"header")?Ep(e.header):void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0}}function Pp(e){return Fp(e)}function Fp(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0,includeFullRecords:N(e,"includeFullRecords")?e.includeFullRecords:void 0}}function Dp(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,includeFullRecords:e.includeFullRecords}}const qa={Oauth2:"oauth2",ApiKey:"apiKey",Basic:"basic",Jwt:"jwt",None:"none"};function Mp(e){return kp(e)}function kp(e,t){return e}function jp(e){return Lp(e)}function Lp(e,t){return e==null?e:{days:N(e,"days")?e.days:void 0,fullHistory:N(e,"fullHistory")?e.fullHistory:void 0}}function Kp(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function hl(e){return Vp(e)}function Vp(e,t){return e==null?e:{defaultPeriod:jp(e.defaultPeriod)}}function Up(e){if(e!==void 0)return e===null?null:{defaultPeriod:Kp(e.defaultPeriod)}}function $p(e){return qp(e)}function qp(e,t){return e==null?e:{days:N(e,"days")?e.days:void 0,fullHistory:N(e,"fullHistory")?e.fullHistory:void 0}}function Hp(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Bp(e){return Jp(e)}function Jp(e,t){return e==null?e:{defaultPeriod:$p(e.defaultPeriod)}}function ml(e){if(e!==void 0)return e===null?null:{defaultPeriod:Hp(e.defaultPeriod)}}function Wp(e){return zp(e)}function zp(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function gl(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Gp(e){return Qp(e)}function Qp(e,t){return e}function Xp(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:ml(e.backfill)}}function Yp(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:We(e.objects,Xp)}}function Zp(e){return eh(e)}function eh(e,t){return e==null?e:{stringValue:N(e,"stringValue")?e.stringValue:void 0,integerValue:N(e,"integerValue")?e.integerValue:void 0,booleanValue:N(e,"booleanValue")?e.booleanValue:void 0}}function th(e){if(e!==void 0)return e===null?null:{stringValue:e.stringValue,integerValue:e.integerValue,booleanValue:e.booleanValue}}function nh(e){return rh(e)}function rh(e,t){return e==null?e:{_default:N(e,"default")?Zp(e.default):void 0,writeOnCreate:N(e,"writeOnCreate")?e.writeOnCreate:void 0,writeOnUpdate:N(e,"writeOnUpdate")?e.writeOnUpdate:void 0}}function yl(e){if(e!==void 0)return e===null?null:{default:th(e._default),writeOnCreate:e.writeOnCreate,writeOnUpdate:e.writeOnUpdate}}function ih(e){let t=!0;return t=t&&"value"in e,t}function oh(e,t){return e==null?e:{value:e.value,applyOnUpdate:N(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function sh(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function ah(e){let t=!0;return t=t&&"value"in e,t}function ch(e,t){return e==null?e:{value:e.value,applyOnUpdate:N(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function lh(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function uh(e){let t=!0;return t=t&&"value"in e,t}function dh(e,t){return e==null?e:{value:e.value,applyOnUpdate:N(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function fh(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function ph(e){return hh(e)}function hh(e,t){return e==null?e:{...oh(e),...ch(e),...dh(e)}}function vl(e){if(e!==void 0)return e===null?null:ih(e)?sh(e):ah(e)?lh(e):uh(e)?fh(e):{}}function mh(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:We(e.selectedValueDefaults,vl),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:We(e.selectedFieldSettings,yl)}}function gh(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:We(e.objects,mh)}}function yh(e){return vh(e)}function vh(e,t){return e==null?e:{apiKeyAsBasic:N(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:N(e,"apiKeyAsBasicOpts")?Cp(e.apiKeyAsBasicOpts):void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0}}function wh(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Ih(e){return bh(e)}function bh(e,t){return e==null?e:{value:e.value}}function xh(e){return _h(e)}function _h(e,t){return e==null?e:{brandingRemoval:N(e,"brandingRemoval")?Ih(e.brandingRemoval):void 0}}function Mi(e){return Ch(e)}function Ch(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:N(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0,entitlements:N(e,"entitlements")?xh(e.entitlements):void 0}}function Oh(e){return Eh(e)}function Eh(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function Sh(e){return Nh(e)}function Nh(e,t){return e==null?e:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:N(e,"selectedValueMappings")?e.selectedValueMappings:void 0,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:N(e,"selectedFieldsAuto")?Gp(e.selectedFieldsAuto):void 0,backfill:N(e,"backfill")?Bp(e.backfill):void 0}}function Th(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:ml(e.backfill)}}function Rh(e){return Ah(e)}function Ah(e,t){return e==null?e:{objects:We(e.objects,Sh)}}function Ph(e){if(e!==void 0)return e===null?null:{objects:We(e.objects,Th)}}function Fh(e){return Dh(e)}function Dh(e,t){return e==null?e:{objectName:e.objectName,selectedValueDefaults:N(e,"selectedValueDefaults")?We(e.selectedValueDefaults,ph):void 0,selectedFieldSettings:N(e,"selectedFieldSettings")?We(e.selectedFieldSettings,nh):void 0}}function Mh(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:We(e.selectedValueDefaults,vl),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:We(e.selectedFieldSettings,yl)}}function kh(e){return jh(e)}function jh(e,t){return e==null?e:{objects:N(e,"objects")?We(e.objects,Fh):void 0}}function Lh(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:We(e.objects,Mh)}}function Kh(e){return Vh(e)}function Vh(e,t){return e==null?e:{provider:e.provider,read:N(e,"read")?Rh(e.read):void 0,write:N(e,"write")?kh(e.write):void 0,proxy:N(e,"proxy")?Wp(e.proxy):void 0}}function Uh(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:Ph(e.read),write:Lh(e.write),proxy:gl(e.proxy)}}function $h(e){return qh(e)}function qh(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:Kh(e.content)}}function Hh(e){return Bh(e)}function Bh(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0}}function wl(e){return Jh(e)}function Jh(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0}}function Wh(e){return zh(e)}function zh(e,t){return e==null?e:{token:e.token,issuedAt:N(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:N(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Gh(e){return Qh(e)}function Qh(e,t){return e==null?e:{token:e.token,issuedAt:N(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:N(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Xh(e){return Yh(e)}function Yh(e,t){return e==null?e:{accessToken:N(e,"accessToken")?Wh(e.accessToken):void 0,refreshToken:N(e,"refreshToken")?Gh(e.refreshToken):void 0,scopes:N(e,"scopes")?e.scopes:void 0}}function Bi(e){return Zh(e)}function Zh(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:N(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:N(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0}}function em(e){return tm(e)}function tm(e,t){return e==null?e:{value:e.value,source:e.source,displayName:N(e,"displayName")?e.displayName:void 0}}function js(e){if(e!==void 0)return e===null?null:{value:e.value,source:e.source,displayName:e.displayName}}function ri(e){return nm(e)}function nm(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:N(e,"providerApp")?Bi(e.providerApp):void 0,group:wl(e.group),consumer:Hh(e.consumer),providerWorkspaceRef:N(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerConsumerRef:N(e,"providerConsumerRef")?e.providerConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0,authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:N(e,"oauth2AuthorizationCode")?Xh(e.oauth2AuthorizationCode):void 0,apiKey:N(e,"apiKey")?e.apiKey:void 0,providerMetadata:N(e,"providerMetadata")?We(e.providerMetadata,em):void 0}}function Il(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function bl(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function xl(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 rm(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 im(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 _l(e){if(e!==void 0)return e===null?null:{accessToken:rm(e.accessToken),refreshToken:im(e.refreshToken),scopes:e.scopes}}function om(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:We(e.providerMetadata,js),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,basicAuth:Il(e.basicAuth),oauth2ClientCredentials:bl(e.oauth2ClientCredentials),oauth2PasswordCredentials:xl(e.oauth2PasswordCredentials),oauth2AuthorizationCode:_l(e.oauth2AuthorizationCode)}}function sm(e){return am(e)}function am(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function cm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function lm(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Uh(e.content)}}function um(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:lm(e.config)}}function dm(e){return fm(e)}function fm(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function pm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function hm(e){return mm(e)}function mm(e,t){return e==null?e:{mode:N(e,"mode")?e.mode:void 0,pageSize:N(e,"pageSize")?e.pageSize:void 0}}function gm(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function ym(e){let t=!0;return t=t&&"fieldName"in e,t}function vm(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:N(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function wm(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function Im(e){let t=!0;return t=t&&"mapToName"in e,t}function Cl(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:N(e,"default")?e.default:void 0,prompt:N(e,"prompt")?e.prompt:void 0}}function bm(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function Ha(e){return xm(e)}function xm(e,t){return e==null?e:{...vm(e),...Cl(e)}}function Ba(e){if(e!==void 0)return e===null?null:ym(e)?wm(e):Im(e)?bm(e):{}}function Ol(e){return _m(e)}function _m(e,t){return e}function Cm(e){return Om(e)}function Om(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:N(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:N(e,"requiredFields")?e.requiredFields.map(Ha):void 0,optionalFields:N(e,"optionalFields")?e.optionalFields.map(Ha):void 0,optionalFieldsAuto:N(e,"optionalFieldsAuto")?Ol(e.optionalFieldsAuto):void 0,backfill:N(e,"backfill")?hl(e.backfill):void 0,delivery:N(e,"delivery")?hm(e.delivery):void 0}}function Em(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(Ba),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(Ba),optionalFieldsAuto:e.optionalFieldsAuto,backfill:Up(e.backfill),delivery:gm(e.delivery)}}function Sm(e){return Nm(e)}function Nm(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(Cm):void 0}}function Tm(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Em)}}function Rm(e){return Am(e)}function Am(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function Pm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Fm(e){return Dm(e)}function Dm(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0,watchFieldsAuto:N(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:N(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function Mm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function km(e){return jm(e)}function jm(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:N(e,"inheritFieldsAndMapping")?e.inheritFieldsAndMapping:void 0,createEvent:N(e,"createEvent")?sm(e.createEvent):void 0,updateEvent:N(e,"updateEvent")?Fm(e.updateEvent):void 0,deleteEvent:N(e,"deleteEvent")?Rm(e.deleteEvent):void 0,associationChangeEvent:N(e,"associationChangeEvent")?Pp(e.associationChangeEvent):void 0,otherEvents:N(e,"otherEvents")?e.otherEvents:void 0}}function Lm(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:e.inheritFieldsAndMapping,createEvent:cm(e.createEvent),updateEvent:Mm(e.updateEvent),deleteEvent:Pm(e.deleteEvent),associationChangeEvent:Dp(e.associationChangeEvent),otherEvents:e.otherEvents}}function Km(e){return Vm(e)}function Vm(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(km):void 0}}function Um(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Lm)}}function El(e){return $m(e)}function $m(e,t){return e==null?e:{allowAnyFields:N(e,"allowAnyFields")?e.allowAnyFields:void 0}}function qm(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function Hm(e){return Bm(e)}function Bm(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:N(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:N(e,"valueDefaults")?El(e.valueDefaults):void 0}}function Jm(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:qm(e.valueDefaults)}}function Wm(e){return zm(e)}function zm(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(Hm):void 0}}function Gm(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Jm)}}function Qm(e){return Xm(e)}function Xm(e,t){return e==null?e:{name:e.name,displayName:N(e,"displayName")?e.displayName:void 0,provider:e.provider,read:N(e,"read")?Sm(e.read):void 0,write:N(e,"write")?Wm(e.write):void 0,proxy:N(e,"proxy")?dm(e.proxy):void 0,subscribe:N(e,"subscribe")?Km(e.subscribe):void 0}}function Ym(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:Tm(e.read),write:Gm(e.write),proxy:pm(e.proxy),subscribe:Um(e.subscribe)}}function Zm(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:Ym(e.content)}}function eg(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:Zm(e.latestRevision)}}function tg(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function ng(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 rg(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function ig(e){return og(e)}function og(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function sg(e){return ag(e)}function ag(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,valueType:N(e,"valueType")?e.valueType:void 0,providerType:N(e,"providerType")?e.providerType:void 0,readOnly:N(e,"readOnly")?e.readOnly:void 0,values:N(e,"values")?e.values.map(ig):void 0}}function cg(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:We(e.providerMetadata,js),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,basicAuth:Il(e.basicAuth),oauth2ClientCredentials:bl(e.oauth2ClientCredentials),oauth2PasswordCredentials:xl(e.oauth2PasswordCredentials),oauth2AuthorizationCode:_l(e.oauth2AuthorizationCode)}}function lg(e){return ug(e)}function ug(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function dg(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,mapToName:N(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Fo(e){return fg(e)}function fg(e,t){return e==null?e:{...dg(e),...Cl(e)}}function pg(e){return hg(e)}function hg(e,t){return e==null?e:{error:N(e,"error")?e.error:void 0,objectName:e.objectName,displayName:e.displayName,mapToName:N(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:N(e,"requiredFields")?e.requiredFields.map(Fo):void 0,optionalFields:N(e,"optionalFields")?e.optionalFields.map(Fo):void 0,optionalFieldsAuto:N(e,"optionalFieldsAuto")?Ol(e.optionalFieldsAuto):void 0,allFields:N(e,"allFields")?e.allFields.map(Fo):void 0,allFieldsMetadata:N(e,"allFieldsMetadata")?We(e.allFieldsMetadata,sg):void 0,backfill:N(e,"backfill")?hl(e.backfill):void 0}}function mg(e){return gg(e)}function gg(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(pg):void 0}}function yg(e){return vg(e)}function vg(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:N(e,"valueDefaults")?El(e.valueDefaults):void 0}}function wg(e){return Ig(e)}function Ig(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(yg):void 0}}function bg(e){return xg(e)}function xg(e,t){return e==null?e:{name:e.name,displayName:N(e,"displayName")?e.displayName:void 0,provider:e.provider,read:N(e,"read")?mg(e.read):void 0,write:N(e,"write")?wg(e.write):void 0,proxy:N(e,"proxy")?lg(e.proxy):void 0}}function _g(e){return Cg(e)}function Cg(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:bg(e.content)}}function ki(e){return Og(e)}function Og(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:N(e,"group")?wl(e.group):void 0,healthStatus:e.healthStatus,connection:ri(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0,config:$h(e.config)}}function Eg(e){return Sg(e)}function Sg(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Qm(e.content)}}function Ja(e){return Ng(e)}function Ng(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:Eg(e.latestRevision)}}function Tg(e){return Rg(e)}function Rg(e,t){return e==null?e:{iconURL:N(e,"iconURL")?e.iconURL:void 0,logoURL:N(e,"logoURL")?e.logoURL:void 0}}function Ag(e){return Pg(e)}function Pg(e,t){return e==null?e:{iconURL:N(e,"iconURL")?e.iconURL:void 0,logoURL:N(e,"logoURL")?e.logoURL:void 0}}function Fg(e){return Dg(e)}function Dg(e,t){return e==null?e:{regular:N(e,"regular")?Ag(e.regular):void 0,darkMode:N(e,"darkMode")?Tg(e.darkMode):void 0}}function Mg(e){return kg(e)}function kg(e,t){return e==null?e:{name:e.name,displayName:N(e,"displayName")?e.displayName:void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0}}function jg(e){return Lg(e)}function Lg(e,t){return e==null?e:{name:e.name}}function Kg(e){return Vg(e)}function Vg(e,t){return e==null?e:{create:N(e,"create")?e.create:void 0,update:N(e,"update")?e.update:void 0,_delete:N(e,"delete")?e.delete:void 0,passThrough:N(e,"passThrough")?e.passThrough:void 0}}function Sl(e){return Ug(e)}function Ug(e,t){return e==null?e:{bulkWrite:Oh(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write,subscribeSupport:N(e,"subscribeSupport")?Kg(e.subscribeSupport):void 0}}function $g(e){return qg(e)}function qg(e,t){return e==null?e:{displayName:e.displayName,baseURL:e.baseURL,support:Sl(e.support)}}function Hg(e){return Bg(e)}function Bg(e,t){return e==null?e:{name:e.name,displayName:e.displayName,jqValueSelector:e.jqValueSelector}}function Jg(e){return Wg(e)}function Wg(e,t){return e==null?e:{workspaceRefField:N(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:N(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:N(e,"scopesField")?e.scopesField:void 0,otherFields:N(e,"otherFields")?e.otherFields.map(Hg):void 0}}const Do={AuthorizationCode:"authorizationCode",AuthorizationCodePkce:"authorizationCodePKCE",ClientCredentials:"clientCredentials",Password:"password"};function zg(e){return Gg(e)}function Gg(e,t){return e==null?e:{grantType:e.grantType,authURL:N(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:N(e,"audience")?e.audience:void 0,tokenMetadataFields:Jg(e.tokenMetadataFields),docsURL:N(e,"docsURL")?e.docsURL:void 0,authURLParams:N(e,"authURLParams")?e.authURLParams:void 0}}function Qg(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:We(e.providerMetadata,js),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 Xg(e){return Yg(e)}function Yg(e,t){return e==null?e:{input:N(e,"input")?e.input.map(Mg):void 0,postAuthentication:N(e,"postAuthentication")?e.postAuthentication.map(jg):void 0}}function Zg(e){return ey(e)}function ey(e,t){return e==null?e:{subscriptionScope:e.subscriptionScope,targetURLScope:e.targetURLScope,registrationTiming:e.registrationTiming}}function Wa(e){return ty(e)}function ty(e,t){return e==null?e:{name:e.name,authType:Mp(e.authType),baseURL:e.baseURL,oauth2Opts:N(e,"oauth2Opts")?zg(e.oauth2Opts):void 0,apiKeyOpts:N(e,"apiKeyOpts")?Rp(e.apiKeyOpts):void 0,basicOpts:N(e,"basicOpts")?yh(e.basicOpts):void 0,support:Sl(e.support),providerOpts:e.providerOpts,displayName:N(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:N(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:N(e,"media")?Fg(e.media):void 0,labels:N(e,"labels")?e.labels:void 0,subscribeOpts:N(e,"subscribeOpts")?Zg(e.subscribeOpts):void 0,modules:N(e,"modules")?We(e.modules,$g):void 0,metadata:N(e,"metadata")?Xg(e.metadata):void 0}}function ny(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,connection:om(e.connection)}}function ry(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:Yp(e.read),write:gh(e.write),proxy:gl(e.proxy)}}function iy(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:ry(e.content)}}function oy(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:iy(e.config)}}function sy(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:oy(e.installation)}}function ay(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function cy(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:ay(e.project)}}function ly(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 uy(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:ly(e.providerApp)}}class dy extends nn{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new re("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling deleteConnection.");const r={},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 ur(i)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},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:cg(t.generateConnectionParams)},n);return new je(i,s=>ri(s))}async generateConnection(t,n){return await(await this.generateConnectionRaw(t,n)).value()}async getConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new re("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const r={};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 je(i,s=>ri(s))}async getConnection(t,n){return await(await this.getConnectionRaw(t,n)).value()}async listConnectionsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const r={};t.provider!==void 0&&(r.provider=t.provider),t.groupRef!==void 0&&(r.groupRef=t.groupRef),t.consumerRef!==void 0&&(r.consumerRef=t.consumerRef);const 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 je(i,s=>s.map(ri))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}async updateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new re("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling updateConnection.");if(t.updateConnectionRequest===null||t.updateConnectionRequest===void 0)throw new re("updateConnectionRequest","Required parameter requestParameters.updateConnectionRequest was null or undefined when calling updateConnection.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:o,query:r,body:ny(t.updateConnectionRequest)},n);return new je(i,s=>ri(s))}async updateConnection(t,n){return await(await this.updateConnectionRaw(t,n)).value()}}class fy extends nn{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new re("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},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:um(t.installation)},n);return new je(i,s=>ki(s))}async createInstallation(t,n){return await(await this.createInstallationRaw(t,n)).value()}async deleteInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new re("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},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 ur(i)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new re("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},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 je(i,s=>ki(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 re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const 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 je(i,s=>s.map(ki))}async listInstallations(t,n){return await(await this.listInstallationsRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new re("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new re("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},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:sy(t.installationUpdate)},n);return new je(i,s=>ki(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class py extends nn{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");if(t.batchUpsertIntegrationsRequest===null||t.batchUpsertIntegrationsRequest===void 0)throw new re("batchUpsertIntegrationsRequest","Required parameter requestParameters.batchUpsertIntegrationsRequest was null or undefined when calling batchUpsertIntegrations.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:o,query:r,body:wh(t.batchUpsertIntegrationsRequest)},n);return new je(i,s=>s.map(Ja))}async batchUpsertIntegrations(t,n){return await(await this.batchUpsertIntegrationsRaw(t,n)).value()}async createIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new re("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},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:eg(t.integration)},n);return new ur(i)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},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 ur(i)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},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 je(i,s=>s.map(Ja))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class hy extends nn{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new re("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/oauth-connect",method:"POST",headers:o,query:r,body:Qg(t.connectOAuthParams)},n);return this.isJsonMime(i.headers.get("content-type"))?new je(i):new $a(i)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}async oauthUpdateRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling oauthUpdate.");if(t.connectionId===null||t.connectionId===void 0)throw new re("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling oauthUpdate.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}:oauth-update".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:o,query:r},n);return this.isJsonMime(i.headers.get("content-type"))?new je(i):new $a(i)}async oauthUpdate(t,n){return await(await this.oauthUpdateRaw(t,n)).value()}}class my extends nn{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new re("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},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:tg(t.project)},n);return new je(i,s=>Mi(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async deleteProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProject.");const r={},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 ur(i)}async deleteProject(t,n){await this.deleteProjectRaw(t,n)}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={};t.includeEntitlements!==void 0&&(r.includeEntitlements=t.includeEntitlements);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new je(i,s=>Mi(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 je(o,i=>i.map(Mi))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new re("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},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:cy(t.projectUpdate)},n);return new je(i,s=>Mi(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class gy extends nn{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new re("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},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 je(i,s=>Wa(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 je(o,i=>We(i,Wa))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class yy extends nn{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new re("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},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:ng(t.providerApp)},n);return new je(i,s=>Bi(s))}async createProviderApp(t,n){return await(await this.createProviderAppRaw(t,n)).value()}async deleteProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new re("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},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 ur(i)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},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 je(i,s=>s.map(Bi))}async listProviderApps(t,n){return await(await this.listProviderAppsRaw(t,n)).value()}async updateProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new re("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new re("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},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:uy(t.providerAppUpdate)},n);return new je(i,s=>Bi(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class vy extends nn{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");if(t.revision===null||t.revision===void 0)throw new re("revision","Required parameter requestParameters.revision was null or undefined when calling createRevision.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:r,body:rg(t.revision)},n);return new ur(i)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new re("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new re("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new re("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new re("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const 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 je(i,s=>_g(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class Nl{constructor(t){this.connectionApi=new dy(t),this.installationApi=new fy(t),this.integrationApi=new py(t),this.oAuthApi=new hy(t),this.projectApi=new my(t),this.providerApi=new gy(t),this.providerAppApi=new yy(t),this.revisionApi=new vy(t)}}const Tl="2.7.5",wy="v1",ji="https://api.withampersand.com";function Rl(){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 ji;case"mock":return"http://127.0.0.1:4010";case"":return ji;default:return e??ji}}catch{return ji}}const Iy=(e,t)=>`${e}/${t}`;function by(){return Iy(Rl(),wy)}const xy=Rl(),Al=by(),_y=new ks({basePath:Al,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Tl}});let Cy=new Nl(_y);const Ls=()=>Cy;function dt(){const e=ll();return v.useCallback(async()=>{e||console.error("Unable to create API service without API key.");const n=new ks({basePath:Al,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Tl,"X-Api-Key":e}});return new Nl(n)},[e])}const Oy=e=>{const t=dt();return yn({queryKey:["project",e],queryFn:async()=>(await t()).projectApi.getProject({projectIdOrName:e})})},Pl=v.createContext({project:null,appName:"",projectId:"",projectIdOrName:"",isLoading:!0}),Te=()=>{const e=v.useContext(Pl);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e};function Ey({projectIdOrName:e,children:t}){const{setError:n}=Dt(),{data:r,isLoading:o,isError:i}=Oy(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(Pl.Provider,{value:s,children:t})}function Fl(){const e=dt(),{projectIdOrName:t}=Te();return yn({queryKey:["amp","integrations",t],queryFn:async()=>{if(!t)throw new Error("Project ID or name is required");return(await e()).integrationApi.listIntegrations({projectIdOrName:t})},enabled:!!t})}const Le=async(e,t)=>{var n;if(e instanceof dl){const{status:r,statusText:o}=e.response;console.error(r===500?"Internal Server Error (500):":r===400?"Bad Request (400):":`Error (${r}):`,o);try{const s=await e.response.clone().json(),a=((n=s==null?void 0:s.causes)==null?void 0:n.join(`
|
|
2
|
+
`))||(s==null?void 0:s.detail);a?(console.error("[Error Message]",a),s!=null&&s.remedy&&console.error("[Remedy]",s.remedy)):console.error("Unexpected error response:",s);const c=`${a} ${s!=null&&s.remedy?`
|
|
3
3
|
|
|
4
|
-
[Remedy] ${s.remedy}`:""}`;t&&t(
|
|
5
|
-
component is wrapped with AmpersandProvider`);return e}const Ay=({groupRef:e,provider:t})=>{const{projectIdOrName:n}=Te(),r=dt();return yn({queryKey:["amp","connections",n,e,t],queryFn:async()=>{if(!n)throw new Error("Project ID or name not found. Please wrap this component inside of AmpersandProvider");if(!e)throw new Error("Group reference not found.");if(!t)throw new Error("Provider not found.");return(await r()).connectionApi.listConnections({projectIdOrName:n,groupRef:e,provider:t})},retry:3,enabled:!!n&&!!e&&!!t})},Py=e=>{const t=
|
|
6
|
-
`).filter(n=>n.trim()!==""),Jy=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,Wy=e=>e.replace(/[.:/\\]/g,"\\$&"),zy=()=>{const[e,t]=y.useState(!1),n=y.useCallback(()=>{t(!0)},[t]),r=y.useCallback(()=>{t(!1)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n,resetIntegrationDeleted:r}},Vl=y.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 rt(){const e=y.useContext(Vl);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function Gy({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:l,fieldMapping:u}){const{integrations:d}=Ls(),{setError:f,isError:h,removeError:m}=Dt(),{isIntegrationDeleted:b,setIntegrationDeleted:v,resetIntegrationDeleted:p}=zy(),x=y.useMemo(()=>Jy(t,d||[]),[t,d]),{data:g,isLoading:w,isError:_,error:C}=Ll(t,o),N=(g==null?void 0:g[0])||null;y.useEffect(()=>{p()},[t,n,r,o,i,u]),y.useEffect(()=>{x===null&&(d!=null&&d.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,x,d]),y.useEffect(()=>{_?(f(ue.INSTALLATION_LIST,(x==null?void 0:x.id)||""),Le(C)):m(ue.INSTALLATION_LIST,(x==null?void 0:x.id)||"")},[_,x,f,m,C]);const R=Et(),T=y.useCallback(()=>{R.invalidateQueries({queryKey:["amp","installations"]})},[R]),F=y.useCallback(J=>{R.setQueryData(["amp","installations"],[J]),R.invalidateQueries({queryKey:["amp","installations"]})},[R]),U=(x==null?void 0:x.id)||"",Q=y.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:N||void 0,setInstallation:F,resetInstallations:T,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:l,isIntegrationDeleted:b,setIntegrationDeleted:v,fieldMapping:u}),[x,n,r,o,i,N,F,T,s,a,l,b,v,u]);if(w)return c.jsx(Gr,{});if(x===null)return c.jsx(Jt,{message:`Integration "${t}" not found`});if(h(ue.INSTALLATION_LIST,U)){const J=`Error retrieving installation information for integration "${(x==null?void 0:x.name)||"unknown"}"`;return c.jsx(Jt,{message:J})}return c.jsx(Vl.Provider,{value:Q,children:e})}const Ul=y.createContext({connections:null,isConnectionsLoading:!0,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),Qt=()=>{const e=y.useContext(Ul);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function $l({groupRef:e,provider:t,children:n}){const r=Et(),{setError:o,isError:i}=Dt(),{projectId:s,isLoading:a}=Te(),{integrationId:l,groupRef:u}=rt(),{provider:d}=Py(l),{data:f,isLoading:h,isError:m,error:b}=Ay({groupRef:e||u,provider:d||t}),v=f==null?void 0:f[0],p=y.useCallback(w=>{r.setQueryData(["amp","connections"],()=>w),r.invalidateQueries({queryKey:["amp","connections"]})},[r]),x=y.useCallback(()=>{r.invalidateQueries({queryKey:["amp","connections"]})},[r]);y.useEffect(()=>{m?(o(ue.CONNECTION_LIST,s,!0),Le(b)):o(ue.CONNECTION_LIST,s,!1)},[m,o,s,b]);const g=y.useMemo(()=>({connections:f||null,isConnectionsLoading:h,selectedConnection:v||null,setConnections:p,setSelectedConnection:x}),[f,h,v,p,x]);if(h||a)return c.jsx(Gr,{});if(i(ue.PROJECT,s))return c.jsx(Jt,{message:`Error loading project ${s}`});if(i(ue.CONNECTION_LIST,s))return c.jsx(Jt,{message:"Error retrieving existing connections"});if(!s)throw new Error("Project ID not found. ConnectionsProvider must be used within AmpersandProvider");return c.jsx(Ul.Provider,{value:g,children:n})}function ql(){const[e,t]=y.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}var Li=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Vs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Yi={exports:{}};Yi.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",o=1,i=2,s=9007199254740991,a="[object Arguments]",l="[object Array]",u="[object AsyncFunction]",d="[object Boolean]",f="[object Date]",h="[object Error]",m="[object Function]",b="[object GeneratorFunction]",v="[object Map]",p="[object Number]",x="[object Null]",g="[object Object]",w="[object Promise]",_="[object Proxy]",C="[object RegExp]",N="[object Set]",R="[object String]",T="[object Symbol]",F="[object Undefined]",U="[object WeakMap]",Q="[object ArrayBuffer]",J="[object DataView]",Y="[object Float32Array]",B="[object Float64Array]",ce="[object Int8Array]",se="[object Int16Array]",ne="[object Int32Array]",ge="[object Uint8Array]",we="[object Uint8ClampedArray]",A="[object Uint16Array]",j="[object Uint32Array]",$=/[\\^$.*+?()[\]{}|]/g,K=/^\[object .+?Constructor\]$/,L=/^(?:0|[1-9]\d*)$/,D={};D[Y]=D[B]=D[ce]=D[se]=D[ne]=D[ge]=D[we]=D[A]=D[j]=!0,D[a]=D[l]=D[Q]=D[d]=D[J]=D[f]=D[h]=D[m]=D[v]=D[p]=D[g]=D[C]=D[N]=D[R]=D[U]=!1;var Z=typeof Li=="object"&&Li&&Li.Object===Object&&Li,ee=typeof self=="object"&&self&&self.Object===Object&&self,q=Z||ee||Function("return this")(),te=t&&!t.nodeType&&t,G=te&&!0&&e&&!e.nodeType&&e,de=G&&G.exports===te,M=de&&Z.process,ve=function(){try{return M&&M.binding&&M.binding("util")}catch{}}(),H=ve&&ve.isTypedArray;function Ee(I,E){for(var P=-1,X=I==null?0:I.length,Re=0,fe=[];++P<X;){var Me=I[P];E(Me,P,I)&&(fe[Re++]=Me)}return fe}function Ve(I,E){for(var P=-1,X=E.length,Re=I.length;++P<X;)I[Re+P]=E[P];return I}function Ye(I,E){for(var P=-1,X=I==null?0:I.length;++P<X;)if(E(I[P],P,I))return!0;return!1}function Ue(I,E){for(var P=-1,X=Array(I);++P<I;)X[P]=E(P);return X}function Ie(I){return function(E){return I(E)}}function Mt(I,E){return I.has(E)}function Ze(I,E){return I==null?void 0:I[E]}function vt(I){var E=-1,P=Array(I.size);return I.forEach(function(X,Re){P[++E]=[Re,X]}),P}function kt(I,E){return function(P){return I(E(P))}}function jt(I){var E=-1,P=Array(I.size);return I.forEach(function(X){P[++E]=X}),P}var et=Array.prototype,Ge=Function.prototype,$e=Object.prototype,Pe=q["__core-js_shared__"],Lt=Ge.toString,it=$e.hasOwnProperty,on=function(){var I=/[^.]+$/.exec(Pe&&Pe.keys&&Pe.keys.IE_PROTO||"");return I?"Symbol(src)_1."+I:""}(),In=$e.toString,wt=RegExp("^"+Lt.call(it).replace($,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Fe=de?q.Buffer:void 0,sn=q.Symbol,bn=q.Uint8Array,an=$e.propertyIsEnumerable,Hn=et.splice,ft=sn?sn.toStringTag:void 0,cn=Object.getOwnPropertySymbols,_n=Fe?Fe.isBuffer:void 0,Bn=kt(Object.keys,Object),xn=vr(q,"DataView"),Ae=vr(q,"Map"),ot=vr(q,"Promise"),ie=vr(q,"Set"),me=vr(q,"WeakMap"),qe=vr(Object,"create"),ln=zn(xn),W=zn(Ae),ae=zn(ot),le=zn(ie),Ke=zn(me),He=sn?sn.prototype:void 0,pt=He?He.valueOf:void 0;function Qe(I){var E=-1,P=I==null?0:I.length;for(this.clear();++E<P;){var X=I[E];this.set(X[0],X[1])}}function tt(){this.__data__=qe?qe(null):{},this.size=0}function ht(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 P=E[I];return P===r?void 0:P}return it.call(E,I)?E[I]:void 0}function Jn(I){var E=this.__data__;return qe?E[I]!==void 0:it.call(E,I)}function No(I,E){var P=this.__data__;return this.size+=this.has(I)?0:1,P[I]=qe&&E===void 0?r:E,this}Qe.prototype.clear=tt,Qe.prototype.delete=ht,Qe.prototype.get=Ne,Qe.prototype.has=Jn,Qe.prototype.set=No;function St(I){var E=-1,P=I==null?0:I.length;for(this.clear();++E<P;){var X=I[E];this.set(X[0],X[1])}}function Ci(){this.__data__=[],this.size=0}function Oi(I){var E=this.__data__,P=Ni(E,I);if(P<0)return!1;var X=E.length-1;return P==X?E.pop():Hn.call(E,P,1),--this.size,!0}function Ei(I){var E=this.__data__,P=Ni(E,I);return P<0?void 0:E[P][1]}function Se(I){return Ni(this.__data__,I)>-1}function Kt(I,E){var P=this.__data__,X=Ni(P,I);return X<0?(++this.size,P.push([I,E])):P[X][1]=E,this}St.prototype.clear=Ci,St.prototype.delete=Oi,St.prototype.get=Ei,St.prototype.has=Se,St.prototype.set=Kt;function Vt(I){var E=-1,P=I==null?0:I.length;for(this.clear();++E<P;){var X=I[E];this.set(X[0],X[1])}}function Wn(){this.size=0,this.__data__={hash:new Qe,map:new(Ae||St),string:new Qe}}function To(I){var E=Ti(this,I).delete(I);return this.size-=E?1:0,E}function Yr(I){return Ti(this,I).get(I)}function af(I){return Ti(this,I).has(I)}function cf(I,E){var P=Ti(this,I),X=P.size;return P.set(I,E),this.size+=P.size==X?0:1,this}Vt.prototype.clear=Wn,Vt.prototype.delete=To,Vt.prototype.get=Yr,Vt.prototype.has=af,Vt.prototype.set=cf;function Si(I){var E=-1,P=I==null?0:I.length;for(this.__data__=new Vt;++E<P;)this.add(I[E])}function lf(I){return this.__data__.set(I,r),this}function uf(I){return this.__data__.has(I)}Si.prototype.add=Si.prototype.push=lf,Si.prototype.has=uf;function Cn(I){var E=this.__data__=new St(I);this.size=E.size}function df(){this.__data__=new St,this.size=0}function ff(I){var E=this.__data__,P=E.delete(I);return this.size=E.size,P}function pf(I){return this.__data__.get(I)}function hf(I){return this.__data__.has(I)}function mf(I,E){var P=this.__data__;if(P instanceof St){var X=P.__data__;if(!Ae||X.length<n-1)return X.push([I,E]),this.size=++P.size,this;P=this.__data__=new Vt(X)}return P.set(I,E),this.size=P.size,this}Cn.prototype.clear=df,Cn.prototype.delete=ff,Cn.prototype.get=pf,Cn.prototype.has=hf,Cn.prototype.set=mf;function gf(I,E){var P=Ri(I),X=!P&&Af(I),Re=!P&&!X&&Ro(I),fe=!P&&!X&&!Re&&Ta(I),Me=P||X||Re||fe,Xe=Me?Ue(I.length,String):[],nt=Xe.length;for(var De in I)it.call(I,De)&&!(Me&&(De=="length"||Re&&(De=="offset"||De=="parent")||fe&&(De=="buffer"||De=="byteLength"||De=="byteOffset")||Ef(De,nt)))&&Xe.push(De);return Xe}function Ni(I,E){for(var P=I.length;P--;)if(Oa(I[P][0],E))return P;return-1}function yf(I,E,P){var X=E(I);return Ri(I)?X:Ve(X,P(I))}function Zr(I){return I==null?I===void 0?F:x:ft&&ft in Object(I)?Cf(I):Rf(I)}function ba(I){return ei(I)&&Zr(I)==a}function _a(I,E,P,X,Re){return I===E?!0:I==null||E==null||!ei(I)&&!ei(E)?I!==I&&E!==E:vf(I,E,P,X,_a,Re)}function vf(I,E,P,X,Re,fe){var Me=Ri(I),Xe=Ri(E),nt=Me?l:On(I),De=Xe?l:On(E);nt=nt==a?g:nt,De=De==a?g:De;var It=nt==g,Ut=De==g,st=nt==De;if(st&&Ro(I)){if(!Ro(E))return!1;Me=!0,It=!1}if(st&&!It)return fe||(fe=new Cn),Me||Ta(I)?xa(I,E,P,X,Re,fe):_f(I,E,nt,P,X,Re,fe);if(!(P&o)){var Nt=It&&it.call(I,"__wrapped__"),Tt=Ut&&it.call(E,"__wrapped__");if(Nt||Tt){var En=Nt?I.value():I,un=Tt?E.value():E;return fe||(fe=new Cn),Re(En,un,P,X,fe)}}return st?(fe||(fe=new Cn),xf(I,E,P,X,Re,fe)):!1}function wf(I){if(!Na(I)||Nf(I))return!1;var E=Ea(I)?wt:K;return E.test(zn(I))}function If(I){return ei(I)&&Sa(I.length)&&!!D[Zr(I)]}function bf(I){if(!Tf(I))return Bn(I);var E=[];for(var P in Object(I))it.call(I,P)&&P!="constructor"&&E.push(P);return E}function xa(I,E,P,X,Re,fe){var Me=P&o,Xe=I.length,nt=E.length;if(Xe!=nt&&!(Me&&nt>Xe))return!1;var De=fe.get(I);if(De&&fe.get(E))return De==E;var It=-1,Ut=!0,st=P&i?new Si:void 0;for(fe.set(I,E),fe.set(E,I);++It<Xe;){var Nt=I[It],Tt=E[It];if(X)var En=Me?X(Tt,Nt,It,E,I,fe):X(Nt,Tt,It,I,E,fe);if(En!==void 0){if(En)continue;Ut=!1;break}if(st){if(!Ye(E,function(un,Gn){if(!Mt(st,Gn)&&(Nt===un||Re(Nt,un,P,X,fe)))return st.push(Gn)})){Ut=!1;break}}else if(!(Nt===Tt||Re(Nt,Tt,P,X,fe))){Ut=!1;break}}return fe.delete(I),fe.delete(E),Ut}function _f(I,E,P,X,Re,fe,Me){switch(P){case J:if(I.byteLength!=E.byteLength||I.byteOffset!=E.byteOffset)return!1;I=I.buffer,E=E.buffer;case Q:return!(I.byteLength!=E.byteLength||!fe(new bn(I),new bn(E)));case d:case f:case p:return Oa(+I,+E);case h:return I.name==E.name&&I.message==E.message;case C:case R:return I==E+"";case v:var Xe=vt;case N:var nt=X&o;if(Xe||(Xe=jt),I.size!=E.size&&!nt)return!1;var De=Me.get(I);if(De)return De==E;X|=i,Me.set(I,E);var It=xa(Xe(I),Xe(E),X,Re,fe,Me);return Me.delete(I),It;case T:if(pt)return pt.call(I)==pt.call(E)}return!1}function xf(I,E,P,X,Re,fe){var Me=P&o,Xe=Ca(I),nt=Xe.length,De=Ca(E),It=De.length;if(nt!=It&&!Me)return!1;for(var Ut=nt;Ut--;){var st=Xe[Ut];if(!(Me?st in E:it.call(E,st)))return!1}var Nt=fe.get(I);if(Nt&&fe.get(E))return Nt==E;var Tt=!0;fe.set(I,E),fe.set(E,I);for(var En=Me;++Ut<nt;){st=Xe[Ut];var un=I[st],Gn=E[st];if(X)var Ra=Me?X(Gn,un,st,E,I,fe):X(un,Gn,st,I,E,fe);if(!(Ra===void 0?un===Gn||Re(un,Gn,P,X,fe):Ra)){Tt=!1;break}En||(En=st=="constructor")}if(Tt&&!En){var Ai=I.constructor,Pi=E.constructor;Ai!=Pi&&"constructor"in I&&"constructor"in E&&!(typeof Ai=="function"&&Ai instanceof Ai&&typeof Pi=="function"&&Pi instanceof Pi)&&(Tt=!1)}return fe.delete(I),fe.delete(E),Tt}function Ca(I){return yf(I,Df,Of)}function Ti(I,E){var P=I.__data__;return Sf(E)?P[typeof E=="string"?"string":"hash"]:P.map}function vr(I,E){var P=Ze(I,E);return wf(P)?P:void 0}function Cf(I){var E=it.call(I,ft),P=I[ft];try{I[ft]=void 0;var X=!0}catch{}var Re=In.call(I);return X&&(E?I[ft]=P:delete I[ft]),Re}var Of=cn?function(I){return I==null?[]:(I=Object(I),Ee(cn(I),function(E){return an.call(I,E)}))}:Mf,On=Zr;(xn&&On(new xn(new ArrayBuffer(1)))!=J||Ae&&On(new Ae)!=v||ot&&On(ot.resolve())!=w||ie&&On(new ie)!=N||me&&On(new me)!=U)&&(On=function(I){var E=Zr(I),P=E==g?I.constructor:void 0,X=P?zn(P):"";if(X)switch(X){case ln:return J;case W:return v;case ae:return w;case le:return N;case Ke:return U}return E});function Ef(I,E){return E=E??s,!!E&&(typeof I=="number"||L.test(I))&&I>-1&&I%1==0&&I<E}function Sf(I){var E=typeof I;return E=="string"||E=="number"||E=="symbol"||E=="boolean"?I!=="__proto__":I===null}function Nf(I){return!!on&&on in I}function Tf(I){var E=I&&I.constructor,P=typeof E=="function"&&E.prototype||$e;return I===P}function Rf(I){return In.call(I)}function zn(I){if(I!=null){try{return Lt.call(I)}catch{}try{return I+""}catch{}}return""}function Oa(I,E){return I===E||I!==I&&E!==E}var Af=ba(function(){return arguments}())?ba:function(I){return ei(I)&&it.call(I,"callee")&&!an.call(I,"callee")},Ri=Array.isArray;function Pf(I){return I!=null&&Sa(I.length)&&!Ea(I)}var Ro=_n||kf;function Ff(I,E){return _a(I,E)}function Ea(I){if(!Na(I))return!1;var E=Zr(I);return E==m||E==b||E==u||E==_}function Sa(I){return typeof I=="number"&&I>-1&&I%1==0&&I<=s}function Na(I){var E=typeof I;return I!=null&&(E=="object"||E=="function")}function ei(I){return I!=null&&typeof I=="object"}var Ta=H?Ie(H):If;function Df(I){return Pf(I)?gf(I):bf(I)}function Mf(){return[]}function kf(){return!1}e.exports=Ff})(Yi,Yi.exports);var Qy=Yi.exports;const Hl=Vs(Qy),dr="other",Zi="manage-tab";function Vn(e){return!e.fieldName}function Xy(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function Yy(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!Vn(n)&&!!n.fieldName))||null}function Zy(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>Vn(r)&&!!r.mapToName))||[]}function ev(e){var n;return((n=e==null?void 0:e.optionalFields)==null?void 0:n.filter(r=>Vn(r)&&!!r.mapToName))||[]}function tv(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!Vn(n)&&!!n.fieldName))||null}const Bl=(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 nv(e){return Vn(e)?e.mapToName:e.fieldName}const Jl=(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)&&kr(s==null?void 0:s.objectName),completed:e?!!Bl(e,s.objectName):!1})}),n},Wl=e=>{var n;return{name:dr,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function rv(e,t){var i;const n=Jl(e,t),o=!!((i=t==null?void 0:t.content)!=null&&i.write)?Wl(e):void 0;return o&&n.push(o),n}function zl(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 iv(e,t){return Hl(e,t)}function Gl(e,t){return Hl(e,t)}const ov=(e,t,n)=>{var p,x,g,w,_,C,N,R,T;if(!e)return null;const r=Xy(e,t),o=r&&Yy(r),i=r&&tv(r),s=r&&Zy(r),a=r&&ev(r),l=(r==null?void 0:r.allFields)||[],u=(r==null?void 0:r.allFieldsMetadata)||{},d=n==null?void 0:n.content,f=((g=(x=(p=d==null?void 0:d.read)==null?void 0:p.objects)==null?void 0:x[t])==null?void 0:g.selectedFields)||{},h=((C=(_=(w=d==null?void 0:d.read)==null?void 0:w.objects)==null?void 0:_[t])==null?void 0:C.selectedValueMappings)||{},m=((T=(R=(N=d==null?void 0:d.read)==null?void 0:N.objects)==null?void 0:R[t])==null?void 0:T.selectedFieldMappings)||{},b={...f},v={...m};return{allFields:l,allFieldsMetadata:u,requiredFields:o,optionalFields:i,requiredMapFields:s,optionalMapFields:a,selectedOptionalFields:f,selectedFieldMappings:m,selectedValueMappings:h,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,isValueMappingsModified:!1,savedConfig:{optionalFields:b,requiredMapFields:v,selectedValueMappings:h}}},sv=(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 Ql(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:ov(r,t,n),write:sv(o,n)}}const Xl=(e,t,n,r)=>{const o=Ql(e,n,t);r(n,o)},av=(e,t,n)=>{const r=rv(t,e),o={};r.forEach(({name:i,completed:s})=>{s&&(o[i]=Ql(e,i,t))}),n(o)},Yl=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(i=>r.add(nv(i))),{...Array.from(r).reduce((i,s)=>({...i,[s]:!0}),{}),...n||{}}},Zl=e=>{const{selectedFieldMappings:t}=(e==null?void 0:e.read)||{},n={};return t&&Object.keys(t).forEach(r=>{t[r]!==void 0?n[r]=t[r]||"":console.warn(`Error undefined when generating selectedRequiredMapFieldsSubmit for key: ${r}`)}),n},eu=e=>{const{selectedValueMappings:t}=(e==null?void 0:e.read)||{};return t};function tu(e,t){return t[e]||void 0}async function nu({createConfig:e,projectId:t,integrationId:n,groupRef:r,connectionId:o,apiKey:i,setError:s,setInstallation:a,onInstallSuccess:l}){const u={projectIdOrName:t,integrationId:n,installation:{groupRef:r,connectionId:o,config:e}};try{const d=await js().installationApi.createInstallation(u,{headers:{"X-Api-Key":i,"Content-Type":"application/json"}});a(d),l==null||l(d.id,d.config)}catch(d){Le(d,s)}}function vi(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const cv=(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)},lv=(e,t,n,r)=>{const o=Yl(e),i=Zl(e),s=eu(e),a=cv(n,t);if(!a)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const l={revisionId:n.id,createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,schedule:a.schedule,destination:a.destination,selectedFields:o,selectedFieldMappings:i,selectedValueMappings:s||{},backfill:a.backfill}}}}};return vi(n)&&(l.content.proxy={enabled:!0}),l},uv=(e,t,n,r,o,i,s,a,l,u,d,f)=>{const h=lv(l,i,a,r);return h?nu({createConfig:h,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))},ru=e=>{var t;return{...(t=e.write)==null?void 0:t.selectedWriteObjects}},dv=e=>{const t=e.content.write;return t==null?void 0:t.objects},fv=(e,t,n)=>{if(!dv(t))return console.error("Error when getting write objects from hydratedRevision"),null;const o=ru(e),i={revisionId:t.id,createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:o}}};return vi(t)&&(i.content.proxy={enabled:!0}),i},pv=(e,t,n,r,o,i,s,a,l,u,d)=>{const f=fv(a,s,r);return f?nu({createConfig:f,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:i,setError:l,setInstallation:u,onInstallSuccess:d}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))};var iu={exports:{}};/*!
|
|
4
|
+
[Remedy] ${s.remedy}`:""}`;t&&t(c)}catch(i){console.error("Error parsing error response body:",i)}}else console.error("Unexpected error:",e.message)},Dl=v.createContext({integrations:null,isLoading:!0}),Ks=()=>{const e=v.useContext(Dl);if(!e)throw new Error("useIntegrationList must be used within a IntegrationListProvider");return e};function Sy({children:e}){const{projectIdOrName:t}=Te(),{setError:n,removeError:r}=Dt(),{data:o,isLoading:i,isError:s}=Fl();v.useEffect(()=>{s?(Le(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(Dl.Provider,{value:a,children:e})}const Ny=new Zf;function Ty(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(ip,{client:Ny,children:l.jsx(vp,{children:l.jsx(gp,{value:t,children:l.jsx(Ey,{projectIdOrName:i,children:l.jsx(Sy,{children:o})})})})})}const Ml=v.createContext(null);function Ry(){const e=v.useContext(Ml);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
|
|
5
|
+
component is wrapped with AmpersandProvider`);return e}const Ay=({groupRef:e,provider:t})=>{const{projectIdOrName:n}=Te(),r=dt();return yn({queryKey:["amp","connections",n,e,t],queryFn:async()=>{if(!n)throw new Error("Project ID or name not found. Please wrap this component inside of AmpersandProvider");if(!e)throw new Error("Group reference not found.");if(!t)throw new Error("Provider not found.");return(await r()).connectionApi.listConnections({projectIdOrName:n,groupRef:e,provider:t})},retry:3,enabled:!!n&&!!e&&!!t})},Py=e=>{const t=Fl(),n=t.data,r=n==null?void 0:n.find(o=>o.name===e||o.id===e);return{...t,data:r,provider:r==null?void 0:r.provider}};function Fy(){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 Dy="_box_1p7c5_1",za={box:Dy};function vn({children:e,className:t,style:n}){return l.jsx("div",{className:t?`${za.box} ${t}`:za.box,style:n,children:e})}const My="_container_1wvzr_1",Ga={container:My};function zr({children:e,className:t,style:n}){return l.jsx("div",{className:t?`${Ga.container} ${t}`:Ga.container,style:n,children:e})}const ky="_errorBoxContainer_4sdb2_1",jy="_errorBox_4sdb2_1",Ly="_errorText_4sdb2_20",fs={errorBoxContainer:ky,errorBox:jy,errorText:Ly};function kl({message:e}){return l.jsx(vn,{className:fs.errorBox,children:l.jsx("p",{className:fs.errorText,children:e})})}function jl({message:e,children:t}){return l.jsxs(zr,{className:fs.errorBoxContainer,children:[l.jsx(Fy,{}),l.jsx(kl,{message:e}),t]})}const Ky="_loader_6ubm6_1",Vy="_rotate_6ubm6_1",Uy="_ball1_6ubm6_1",$y="_ball2_6ubm6_1",qy={loader:Ky,rotate:Vy,ball1:Uy,ball2:$y};function Hy(){return l.jsx("span",{className:qy.loader})}function ci(){return l.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:l.jsx(Hy,{})})}function Ll({children:e}){return l.jsx(zr,{style:{maxWidth:"55rem"},children:l.jsx(vn,{children:e})})}function Gr(){return l.jsx(Ll,{children:l.jsx(ci,{})})}function Jt({message:e,children:t}){return l.jsx(Ll,{children:l.jsx(jl,{message:e,children:t})})}const Kl=(e,t)=>{var s;const n=dt(),{projectIdOrName:r}=Te(),{integrations:o}=Ks(),i=(s=o==null?void 0:o.find(a=>a.name===e))==null?void 0:s.id;return yn({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 Vs(e,t){try{return process.env[e]}catch{return t}}function dr(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Vl(e,t){return(t==null?void 0:t.displayName)??dr(e)}const By=e=>e.split(`
|
|
6
|
+
`).filter(n=>n.trim()!==""),Jy=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,Wy=e=>e.replace(/[.:/\\]/g,"\\$&"),zy=()=>{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}},Ul=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 rt(){const e=v.useContext(Ul);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function Gy({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,fieldMapping:u}){const{integrations:d}=Ks(),{setError:f,isError:h,removeError:m}=Dt(),{isIntegrationDeleted:b,setIntegrationDeleted:w,resetIntegrationDeleted:p}=zy(),_=v.useMemo(()=>Jy(t,d||[]),[t,d]),{data:g,isLoading:y,isError:I,error:C}=Kl(t,o),S=(g==null?void 0:g[0])||null;v.useEffect(()=>{p()},[t,n,r,o,i,u]),v.useEffect(()=>{_===null&&(d!=null&&d.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,_,d]),v.useEffect(()=>{I?(f(ue.INSTALLATION_LIST,(_==null?void 0:_.id)||""),Le(C)):m(ue.INSTALLATION_LIST,(_==null?void 0:_.id)||"")},[I,_,f,m,C]);const T=vt(),R=v.useCallback(()=>{T.invalidateQueries({queryKey:["amp","installations"]})},[T]),F=v.useCallback(J=>{T.setQueryData(["amp","installations"],[J]),T.invalidateQueries({queryKey:["amp","installations"]})},[T]),U=(_==null?void 0:_.id)||"",Q=v.useMemo(()=>({integrationId:(_==null?void 0:_.id)||"",provider:(_==null?void 0:_.provider)||"",integrationObj:_,consumerRef:n,consumerName:r,groupRef:o,groupName:i,installation:S||void 0,setInstallation:F,resetInstallations:R,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,isIntegrationDeleted:b,setIntegrationDeleted:w,fieldMapping:u}),[_,n,r,o,i,S,F,R,s,a,c,b,w,u]);if(y)return l.jsx(Gr,{});if(_===null)return l.jsx(Jt,{message:`Integration "${t}" not found`});if(h(ue.INSTALLATION_LIST,U)){const J=`Error retrieving installation information for integration "${(_==null?void 0:_.name)||"unknown"}"`;return l.jsx(Jt,{message:J})}return l.jsx(Ul.Provider,{value:Q,children:e})}const $l=v.createContext({connections:null,isConnectionsLoading:!0,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),Qt=()=>{const e=v.useContext($l);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function ql({groupRef:e,provider:t,children:n}){const r=vt(),{setError:o,isError:i}=Dt(),{projectId:s,isLoading:a}=Te(),{integrationId:c,groupRef:u}=rt(),{provider:d}=Py(c),{data:f,isLoading:h,isError:m,error:b}=Ay({groupRef:e||u,provider:d||t}),w=f==null?void 0:f[0],p=v.useCallback(y=>{r.setQueryData(["amp","connections"],()=>y),r.invalidateQueries({queryKey:["amp","connections"]})},[r]),_=v.useCallback(()=>{r.invalidateQueries({queryKey:["amp","connections"]})},[r]);v.useEffect(()=>{m?(o(ue.CONNECTION_LIST,s,!0),Le(b)):o(ue.CONNECTION_LIST,s,!1)},[m,o,s,b]);const g=v.useMemo(()=>({connections:f||null,isConnectionsLoading:h,selectedConnection:w||null,setConnections:p,setSelectedConnection:_}),[f,h,w,p,_]);if(h||a)return l.jsx(Gr,{});if(i(ue.PROJECT,s))return l.jsx(Jt,{message:`Error loading project ${s}`});if(i(ue.CONNECTION_LIST,s))return l.jsx(Jt,{message:"Error retrieving existing connections"});if(!s)throw new Error("Project ID not found. ConnectionsProvider must be used within AmpersandProvider");return l.jsx($l.Provider,{value:g,children:n})}function Hl(){const[e,t]=v.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}var Li=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Us(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Yi={exports:{}};Yi.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]",h="[object Error]",m="[object Function]",b="[object GeneratorFunction]",w="[object Map]",p="[object Number]",_="[object Null]",g="[object Object]",y="[object Promise]",I="[object Proxy]",C="[object RegExp]",S="[object Set]",T="[object String]",R="[object Symbol]",F="[object Undefined]",U="[object WeakMap]",Q="[object ArrayBuffer]",J="[object DataView]",Y="[object Float32Array]",B="[object Float64Array]",ce="[object Int8Array]",se="[object Int16Array]",ne="[object Int32Array]",ge="[object Uint8Array]",we="[object Uint8ClampedArray]",A="[object Uint16Array]",j="[object Uint32Array]",$=/[\\^$.*+?()[\]{}|]/g,K=/^\[object .+?Constructor\]$/,L=/^(?:0|[1-9]\d*)$/,D={};D[Y]=D[B]=D[ce]=D[se]=D[ne]=D[ge]=D[we]=D[A]=D[j]=!0,D[a]=D[c]=D[Q]=D[d]=D[J]=D[f]=D[h]=D[m]=D[w]=D[p]=D[g]=D[C]=D[S]=D[T]=D[U]=!1;var Z=typeof Li=="object"&&Li&&Li.Object===Object&&Li,ee=typeof self=="object"&&self&&self.Object===Object&&self,q=Z||ee||Function("return this")(),te=t&&!t.nodeType&&t,G=te&&!0&&e&&!e.nodeType&&e,de=G&&G.exports===te,M=de&&Z.process,ve=function(){try{return M&&M.binding&&M.binding("util")}catch{}}(),H=ve&&ve.isTypedArray;function Ee(x,E){for(var P=-1,X=x==null?0:x.length,Re=0,fe=[];++P<X;){var Me=x[P];E(Me,P,x)&&(fe[Re++]=Me)}return fe}function Ve(x,E){for(var P=-1,X=E.length,Re=x.length;++P<X;)x[Re+P]=E[P];return x}function Ye(x,E){for(var P=-1,X=x==null?0:x.length;++P<X;)if(E(x[P],P,x))return!0;return!1}function Ue(x,E){for(var P=-1,X=Array(x);++P<x;)X[P]=E(P);return X}function Ie(x){return function(E){return x(E)}}function Mt(x,E){return x.has(E)}function Ze(x,E){return x==null?void 0:x[E]}function wt(x){var E=-1,P=Array(x.size);return x.forEach(function(X,Re){P[++E]=[Re,X]}),P}function kt(x,E){return function(P){return x(E(P))}}function jt(x){var E=-1,P=Array(x.size);return x.forEach(function(X){P[++E]=X}),P}var et=Array.prototype,Ge=Function.prototype,$e=Object.prototype,Pe=q["__core-js_shared__"],Lt=Ge.toString,it=$e.hasOwnProperty,sn=function(){var x=/[^.]+$/.exec(Pe&&Pe.keys&&Pe.keys.IE_PROTO||"");return x?"Symbol(src)_1."+x:""}(),In=$e.toString,It=RegExp("^"+Lt.call(it).replace($,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Fe=de?q.Buffer:void 0,an=q.Symbol,bn=q.Uint8Array,cn=$e.propertyIsEnumerable,Hn=et.splice,ft=an?an.toStringTag:void 0,ln=Object.getOwnPropertySymbols,xn=Fe?Fe.isBuffer:void 0,Bn=kt(Object.keys,Object),_n=wr(q,"DataView"),Ae=wr(q,"Map"),ot=wr(q,"Promise"),ie=wr(q,"Set"),me=wr(q,"WeakMap"),qe=wr(Object,"create"),un=zn(_n),W=zn(Ae),ae=zn(ot),le=zn(ie),Ke=zn(me),He=an?an.prototype:void 0,pt=He?He.valueOf:void 0;function Qe(x){var E=-1,P=x==null?0:x.length;for(this.clear();++E<P;){var X=x[E];this.set(X[0],X[1])}}function tt(){this.__data__=qe?qe(null):{},this.size=0}function ht(x){var E=this.has(x)&&delete this.__data__[x];return this.size-=E?1:0,E}function Ne(x){var E=this.__data__;if(qe){var P=E[x];return P===r?void 0:P}return it.call(E,x)?E[x]:void 0}function Jn(x){var E=this.__data__;return qe?E[x]!==void 0:it.call(E,x)}function No(x,E){var P=this.__data__;return this.size+=this.has(x)?0:1,P[x]=qe&&E===void 0?r:E,this}Qe.prototype.clear=tt,Qe.prototype.delete=ht,Qe.prototype.get=Ne,Qe.prototype.has=Jn,Qe.prototype.set=No;function St(x){var E=-1,P=x==null?0:x.length;for(this.clear();++E<P;){var X=x[E];this.set(X[0],X[1])}}function Ci(){this.__data__=[],this.size=0}function Oi(x){var E=this.__data__,P=Ni(E,x);if(P<0)return!1;var X=E.length-1;return P==X?E.pop():Hn.call(E,P,1),--this.size,!0}function Ei(x){var E=this.__data__,P=Ni(E,x);return P<0?void 0:E[P][1]}function Se(x){return Ni(this.__data__,x)>-1}function Kt(x,E){var P=this.__data__,X=Ni(P,x);return X<0?(++this.size,P.push([x,E])):P[X][1]=E,this}St.prototype.clear=Ci,St.prototype.delete=Oi,St.prototype.get=Ei,St.prototype.has=Se,St.prototype.set=Kt;function Vt(x){var E=-1,P=x==null?0:x.length;for(this.clear();++E<P;){var X=x[E];this.set(X[0],X[1])}}function Wn(){this.size=0,this.__data__={hash:new Qe,map:new(Ae||St),string:new Qe}}function To(x){var E=Ti(this,x).delete(x);return this.size-=E?1:0,E}function Yr(x){return Ti(this,x).get(x)}function af(x){return Ti(this,x).has(x)}function cf(x,E){var P=Ti(this,x),X=P.size;return P.set(x,E),this.size+=P.size==X?0:1,this}Vt.prototype.clear=Wn,Vt.prototype.delete=To,Vt.prototype.get=Yr,Vt.prototype.has=af,Vt.prototype.set=cf;function Si(x){var E=-1,P=x==null?0:x.length;for(this.__data__=new Vt;++E<P;)this.add(x[E])}function lf(x){return this.__data__.set(x,r),this}function uf(x){return this.__data__.has(x)}Si.prototype.add=Si.prototype.push=lf,Si.prototype.has=uf;function Cn(x){var E=this.__data__=new St(x);this.size=E.size}function df(){this.__data__=new St,this.size=0}function ff(x){var E=this.__data__,P=E.delete(x);return this.size=E.size,P}function pf(x){return this.__data__.get(x)}function hf(x){return this.__data__.has(x)}function mf(x,E){var P=this.__data__;if(P instanceof St){var X=P.__data__;if(!Ae||X.length<n-1)return X.push([x,E]),this.size=++P.size,this;P=this.__data__=new Vt(X)}return P.set(x,E),this.size=P.size,this}Cn.prototype.clear=df,Cn.prototype.delete=ff,Cn.prototype.get=pf,Cn.prototype.has=hf,Cn.prototype.set=mf;function gf(x,E){var P=Ri(x),X=!P&&Af(x),Re=!P&&!X&&Ro(x),fe=!P&&!X&&!Re&&Ra(x),Me=P||X||Re||fe,Xe=Me?Ue(x.length,String):[],nt=Xe.length;for(var De in x)it.call(x,De)&&!(Me&&(De=="length"||Re&&(De=="offset"||De=="parent")||fe&&(De=="buffer"||De=="byteLength"||De=="byteOffset")||Ef(De,nt)))&&Xe.push(De);return Xe}function Ni(x,E){for(var P=x.length;P--;)if(Ea(x[P][0],E))return P;return-1}function yf(x,E,P){var X=E(x);return Ri(x)?X:Ve(X,P(x))}function Zr(x){return x==null?x===void 0?F:_:ft&&ft in Object(x)?Cf(x):Rf(x)}function xa(x){return ei(x)&&Zr(x)==a}function _a(x,E,P,X,Re){return x===E?!0:x==null||E==null||!ei(x)&&!ei(E)?x!==x&&E!==E:vf(x,E,P,X,_a,Re)}function vf(x,E,P,X,Re,fe){var Me=Ri(x),Xe=Ri(E),nt=Me?c:On(x),De=Xe?c:On(E);nt=nt==a?g:nt,De=De==a?g:De;var bt=nt==g,Ut=De==g,st=nt==De;if(st&&Ro(x)){if(!Ro(E))return!1;Me=!0,bt=!1}if(st&&!bt)return fe||(fe=new Cn),Me||Ra(x)?Ca(x,E,P,X,Re,fe):xf(x,E,nt,P,X,Re,fe);if(!(P&o)){var Nt=bt&&it.call(x,"__wrapped__"),Tt=Ut&&it.call(E,"__wrapped__");if(Nt||Tt){var En=Nt?x.value():x,dn=Tt?E.value():E;return fe||(fe=new Cn),Re(En,dn,P,X,fe)}}return st?(fe||(fe=new Cn),_f(x,E,P,X,Re,fe)):!1}function wf(x){if(!Ta(x)||Nf(x))return!1;var E=Sa(x)?It:K;return E.test(zn(x))}function If(x){return ei(x)&&Na(x.length)&&!!D[Zr(x)]}function bf(x){if(!Tf(x))return Bn(x);var E=[];for(var P in Object(x))it.call(x,P)&&P!="constructor"&&E.push(P);return E}function Ca(x,E,P,X,Re,fe){var Me=P&o,Xe=x.length,nt=E.length;if(Xe!=nt&&!(Me&&nt>Xe))return!1;var De=fe.get(x);if(De&&fe.get(E))return De==E;var bt=-1,Ut=!0,st=P&i?new Si:void 0;for(fe.set(x,E),fe.set(E,x);++bt<Xe;){var Nt=x[bt],Tt=E[bt];if(X)var En=Me?X(Tt,Nt,bt,E,x,fe):X(Nt,Tt,bt,x,E,fe);if(En!==void 0){if(En)continue;Ut=!1;break}if(st){if(!Ye(E,function(dn,Gn){if(!Mt(st,Gn)&&(Nt===dn||Re(Nt,dn,P,X,fe)))return st.push(Gn)})){Ut=!1;break}}else if(!(Nt===Tt||Re(Nt,Tt,P,X,fe))){Ut=!1;break}}return fe.delete(x),fe.delete(E),Ut}function xf(x,E,P,X,Re,fe,Me){switch(P){case J:if(x.byteLength!=E.byteLength||x.byteOffset!=E.byteOffset)return!1;x=x.buffer,E=E.buffer;case Q:return!(x.byteLength!=E.byteLength||!fe(new bn(x),new bn(E)));case d:case f:case p:return Ea(+x,+E);case h:return x.name==E.name&&x.message==E.message;case C:case T:return x==E+"";case w:var Xe=wt;case S:var nt=X&o;if(Xe||(Xe=jt),x.size!=E.size&&!nt)return!1;var De=Me.get(x);if(De)return De==E;X|=i,Me.set(x,E);var bt=Ca(Xe(x),Xe(E),X,Re,fe,Me);return Me.delete(x),bt;case R:if(pt)return pt.call(x)==pt.call(E)}return!1}function _f(x,E,P,X,Re,fe){var Me=P&o,Xe=Oa(x),nt=Xe.length,De=Oa(E),bt=De.length;if(nt!=bt&&!Me)return!1;for(var Ut=nt;Ut--;){var st=Xe[Ut];if(!(Me?st in E:it.call(E,st)))return!1}var Nt=fe.get(x);if(Nt&&fe.get(E))return Nt==E;var Tt=!0;fe.set(x,E),fe.set(E,x);for(var En=Me;++Ut<nt;){st=Xe[Ut];var dn=x[st],Gn=E[st];if(X)var Aa=Me?X(Gn,dn,st,E,x,fe):X(dn,Gn,st,x,E,fe);if(!(Aa===void 0?dn===Gn||Re(dn,Gn,P,X,fe):Aa)){Tt=!1;break}En||(En=st=="constructor")}if(Tt&&!En){var Ai=x.constructor,Pi=E.constructor;Ai!=Pi&&"constructor"in x&&"constructor"in E&&!(typeof Ai=="function"&&Ai instanceof Ai&&typeof Pi=="function"&&Pi instanceof Pi)&&(Tt=!1)}return fe.delete(x),fe.delete(E),Tt}function Oa(x){return yf(x,Df,Of)}function Ti(x,E){var P=x.__data__;return Sf(E)?P[typeof E=="string"?"string":"hash"]:P.map}function wr(x,E){var P=Ze(x,E);return wf(P)?P:void 0}function Cf(x){var E=it.call(x,ft),P=x[ft];try{x[ft]=void 0;var X=!0}catch{}var Re=In.call(x);return X&&(E?x[ft]=P:delete x[ft]),Re}var Of=ln?function(x){return x==null?[]:(x=Object(x),Ee(ln(x),function(E){return cn.call(x,E)}))}:Mf,On=Zr;(_n&&On(new _n(new ArrayBuffer(1)))!=J||Ae&&On(new Ae)!=w||ot&&On(ot.resolve())!=y||ie&&On(new ie)!=S||me&&On(new me)!=U)&&(On=function(x){var E=Zr(x),P=E==g?x.constructor:void 0,X=P?zn(P):"";if(X)switch(X){case un:return J;case W:return w;case ae:return y;case le:return S;case Ke:return U}return E});function Ef(x,E){return E=E??s,!!E&&(typeof x=="number"||L.test(x))&&x>-1&&x%1==0&&x<E}function Sf(x){var E=typeof x;return E=="string"||E=="number"||E=="symbol"||E=="boolean"?x!=="__proto__":x===null}function Nf(x){return!!sn&&sn in x}function Tf(x){var E=x&&x.constructor,P=typeof E=="function"&&E.prototype||$e;return x===P}function Rf(x){return In.call(x)}function zn(x){if(x!=null){try{return Lt.call(x)}catch{}try{return x+""}catch{}}return""}function Ea(x,E){return x===E||x!==x&&E!==E}var Af=xa(function(){return arguments}())?xa:function(x){return ei(x)&&it.call(x,"callee")&&!cn.call(x,"callee")},Ri=Array.isArray;function Pf(x){return x!=null&&Na(x.length)&&!Sa(x)}var Ro=xn||kf;function Ff(x,E){return _a(x,E)}function Sa(x){if(!Ta(x))return!1;var E=Zr(x);return E==m||E==b||E==u||E==I}function Na(x){return typeof x=="number"&&x>-1&&x%1==0&&x<=s}function Ta(x){var E=typeof x;return x!=null&&(E=="object"||E=="function")}function ei(x){return x!=null&&typeof x=="object"}var Ra=H?Ie(H):If;function Df(x){return Pf(x)?gf(x):bf(x)}function Mf(){return[]}function kf(){return!1}e.exports=Ff})(Yi,Yi.exports);var Qy=Yi.exports;const Bl=Us(Qy),fr="other",Zi="manage-tab";function Vn(e){return!e.fieldName}function Xy(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function Yy(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!Vn(n)&&!!n.fieldName))||null}function Zy(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>Vn(r)&&!!r.mapToName))||[]}function ev(e){var n;return((n=e==null?void 0:e.optionalFields)==null?void 0:n.filter(r=>Vn(r)&&!!r.mapToName))||[]}function tv(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!Vn(n)&&!!n.fieldName))||null}const Jl=(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 nv(e){return Vn(e)?e.mapToName:e.fieldName}const Wl=(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)&&dr(s==null?void 0:s.objectName),completed:e?!!Jl(e,s.objectName):!1})}),n},zl=e=>{var n;return{name:fr,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function rv(e,t){var i;const n=Wl(e,t),o=!!((i=t==null?void 0:t.content)!=null&&i.write)?zl(e):void 0;return o&&n.push(o),n}function Gl(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 iv(e,t){return Bl(e,t)}function Ql(e,t){return Bl(e,t)}const ov=(e,t,n)=>{var p,_,g,y,I,C,S,T,R;if(!e)return null;const r=Xy(e,t),o=r&&Yy(r),i=r&&tv(r),s=r&&Zy(r),a=r&&ev(r),c=(r==null?void 0:r.allFields)||[],u=(r==null?void 0:r.allFieldsMetadata)||{},d=n==null?void 0:n.content,f=((g=(_=(p=d==null?void 0:d.read)==null?void 0:p.objects)==null?void 0:_[t])==null?void 0:g.selectedFields)||{},h=((C=(I=(y=d==null?void 0:d.read)==null?void 0:y.objects)==null?void 0:I[t])==null?void 0:C.selectedValueMappings)||{},m=((R=(T=(S=d==null?void 0:d.read)==null?void 0:S.objects)==null?void 0:T[t])==null?void 0:R.selectedFieldMappings)||{},b={...f},w={...m};return{allFields:c,allFieldsMetadata:u,requiredFields:o,optionalFields:i,requiredMapFields:s,optionalMapFields:a,selectedOptionalFields:f,selectedFieldMappings:m,selectedValueMappings:h,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,isValueMappingsModified:!1,savedConfig:{optionalFields:b,requiredMapFields:w,selectedValueMappings:h}}},sv=(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 Xl(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:ov(r,t,n),write:sv(o,n)}}const Yl=(e,t,n,r)=>{const o=Xl(e,n,t);r(n,o)},av=(e,t,n)=>{const r=rv(t,e),o={};r.forEach(({name:i,completed:s})=>{s&&(o[i]=Xl(e,i,t))}),n(o)},Zl=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(i=>r.add(nv(i))),{...Array.from(r).reduce((i,s)=>({...i,[s]:!0}),{}),...n||{}}},eu=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},tu=e=>{const{selectedValueMappings:t}=(e==null?void 0:e.read)||{};return t};function nu(e,t){return t[e]||void 0}async function ru({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 Ls().installationApi.createInstallation(u,{headers:{"X-Api-Key":i,"Content-Type":"application/json"}});a(d),c==null||c(d.id,d.config)}catch(d){Le(d,s)}}function vi(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const cv=(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)},lv=(e,t,n,r)=>{const o=Zl(e),i=eu(e),s=tu(e),a=cv(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 vi(n)&&(c.content.proxy={enabled:!0}),c},uv=(e,t,n,r,o,i,s,a,c,u,d,f)=>{const h=lv(c,i,a,r);return h?ru({createConfig:h,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))},iu=e=>{var t;return{...(t=e.write)==null?void 0:t.selectedWriteObjects}},dv=e=>{const t=e.content.write;return t==null?void 0:t.objects},fv=(e,t,n)=>{if(!dv(t))return console.error("Error when getting write objects from hydratedRevision"),null;const o=iu(e),i={revisionId:t.id,createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:o}}};return vi(t)&&(i.content.proxy={enabled:!0}),i},pv=(e,t,n,r,o,i,s,a,c,u,d)=>{const f=fv(a,s,r);return f?ru({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))};var ou={exports:{}};/*!
|
|
7
7
|
Copyright (c) 2018 Jed Watson.
|
|
8
8
|
Licensed under the MIT License (MIT), see
|
|
9
9
|
http://jedwatson.github.io/classnames
|
|
10
|
-
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var i="",s=0;s<arguments.length;s++){var a=arguments[s];a&&(i=o(i,r(a)))}return i}function r(i){if(typeof i=="string"||typeof i=="number")return i;if(typeof i!="object")return"";if(Array.isArray(i))return n.apply(null,i);if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]"))return i.toString();var s="";for(var a in i)t.call(i,a)&&i[a]&&(s=o(s,a));return s}function o(i,s){return s?i?i+" "+s:i+s:i}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(
|
|
10
|
+
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var i="",s=0;s<arguments.length;s++){var a=arguments[s];a&&(i=o(i,r(a)))}return i}function r(i){if(typeof i=="string"||typeof i=="number")return i;if(typeof i!="object")return"";if(Array.isArray(i))return n.apply(null,i);if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]"))return i.toString();var s="";for(var a in i)t.call(i,a)&&i[a]&&(s=o(s,a));return s}function o(i,s){return s?i?i+" "+s:i+s:i}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(ou);var hv=ou.exports;const Ft=Us(hv),mv="_button_kwfiu_1",gv="_buttonError_kwfiu_28",yv="_danger_kwfiu_42",vv="_ghost_kwfiu_47",Mo={button:mv,buttonError:gv,danger:yv,ghost:vv};function ze({className:e,style:t,type:n,children:r,variant:o,...i}){const s=Ft(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 wv={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 wi({children:e,style:t}){return l.jsx(vn,{style:{...wv,...t},children:e})}const Iv=()=>{const e=dt(),t=vt();return Wr({mutationKey:["deleteConnection"],mutationFn:async({projectIdOrName:n,connectionId:r})=>(await e()).connectionApi.deleteConnection({projectIdOrName:n,connectionId:r}),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]})},onError:n=>{console.error("Error deleting connection.",{error:n})}})};function su({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:o,onDisconnectError:i}){const{projectId:s}=Te(),{selectedConnection:a}=Qt(),c=Iv(),[u,d]=v.useState(!1),f=!s||!a||!a.id||u,h=async()=>{f||(d(!0),console.warn("deleting connection",{projectId:s,connectionId:a==null?void 0:a.id}),c.mutate({projectIdOrName:s,connectionId:a==null?void 0:a.id},{onSuccess:()=>{console.warn("successfully deleted connection:",a==null?void 0:a.id),r==null||r(a),o()},onError:w=>{Le(w,i)},onSettled:()=>d(!1)}))},m=u?"Disconnecting...":e;return l.jsx(ze,{type:"button",onClick:h,disabled:f,variant:t,style:n,children:m})}const au=v.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),Qr=()=>{const e=v.useContext(au);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e},bv=()=>{var u;const e=vt(),t=dt(),{selectedConnection:n,isConnectionsLoading:r}=Qt(),{projectIdOrName:o}=Te(),{integrationId:i,integrationObj:s}=rt(),a=n==null?void 0:n.id,c=(u=s==null?void 0:s.latestRevision)==null?void 0:u.id;return v.useEffect(()=>{a||e.invalidateQueries({queryKey:["amp","hydratedRevision"]})},[a,e]),yn({queryKey:["amp","hydratedRevision",o,i,c,a],queryFn:async()=>{if(!o)throw new Error("projectIdOrName is required");if(!i)throw new Error("integrationId is required");if(!c)throw new Error("revisionId is required");if(!a)throw new Error("connectionId is required");return(await t()).revisionApi.getHydratedRevision({projectIdOrName:o,integrationId:i,revisionId:c,connectionId:a})},retry:3,enabled:!!o&&!!i&&!!c&&!!a&&!r})};function xv({children:e,resetComponent:t}){const{integrationId:n,integrationObj:r}=rt(),{isError:o,removeError:i,setError:s}=Dt(),a=(r==null?void 0:r.name)||n,[c,u]=v.useState(null),[d,f]=v.useState(null),{data:h,isLoading:m,isError:b,error:w}=bv();v.useEffect(()=>{b?(s(ue.HYDRATED_REVISION,a),Le(w,u)):(i(ue.HYDRATED_REVISION,a),u(null),f(null))},[b,a,s,i,w,u]);const p=v.useMemo(()=>{var g,y,I;return{hydratedRevision:h||null,loading:m,readAction:(g=h==null?void 0:h.content)==null?void 0:g.read,writeObjects:((I=(y=h==null?void 0:h.content)==null?void 0:y.write)==null?void 0:I.objects)||[]}},[h,m]);if(m)return l.jsx(Gr,{});const _=(r==null?void 0:r.provider)||"provider";if(o(ue.HYDRATED_REVISION,a)){const g=(r==null?void 0:r.name)||n||"unknown integration",y=`${c?`: ${c}`:`Error retrieving objects from ${_} or integration details for ${g}`}`;return l.jsx(Jt,{message:y,children:l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",paddingTop:"1rem"},children:[d&&l.jsx(kl,{message:d}),l.jsx(su,{buttonText:"Try again",resetComponent:t,buttonVariant:"danger",onDisconnectError:I=>f(I)})]})})}return l.jsx(au.Provider,{value:p,children:e})}function mn(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 ps(e,t){return ps=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},ps(e,t)}function _v(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ps(e,t)}var hs={exports:{}},Ki={exports:{}},be={};/** @license React v16.13.1
|
|
11
11
|
* react-is.production.min.js
|
|
12
12
|
*
|
|
13
13
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var Qa;function Cv(){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,h=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,b=e?Symbol.for("react.lazy"):60116,w=e?Symbol.for("react.block"):60121,p=e?Symbol.for("react.fundamental"):60117,_=e?Symbol.for("react.responder"):60118,g=e?Symbol.for("react.scope"):60119;function y(C){if(typeof C=="object"&&C!==null){var S=C.$$typeof;switch(S){case t:switch(C=C.type,C){case c:case u:case r:case i:case o:case f:return C;default:switch(C=C&&C.$$typeof,C){case a:case d:case b:case m:case s:return C;default:return S}}case n:return S}}}function I(C){return y(C)===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=b,be.Memo=m,be.Portal=n,be.Profiler=i,be.StrictMode=o,be.Suspense=f,be.isAsyncMode=function(C){return I(C)||y(C)===c},be.isConcurrentMode=I,be.isContextConsumer=function(C){return y(C)===a},be.isContextProvider=function(C){return y(C)===s},be.isElement=function(C){return typeof C=="object"&&C!==null&&C.$$typeof===t},be.isForwardRef=function(C){return y(C)===d},be.isFragment=function(C){return y(C)===r},be.isLazy=function(C){return y(C)===b},be.isMemo=function(C){return y(C)===m},be.isPortal=function(C){return y(C)===n},be.isProfiler=function(C){return y(C)===i},be.isStrictMode=function(C){return y(C)===o},be.isSuspense=function(C){return y(C)===f},be.isValidElementType=function(C){return typeof C=="string"||typeof C=="function"||C===r||C===u||C===i||C===o||C===f||C===h||typeof C=="object"&&C!==null&&(C.$$typeof===b||C.$$typeof===m||C.$$typeof===s||C.$$typeof===a||C.$$typeof===d||C.$$typeof===p||C.$$typeof===_||C.$$typeof===g||C.$$typeof===w)},be.typeOf=y,be}var xe={};/** @license React v16.13.1
|
|
18
18
|
* react-is.development.js
|
|
19
19
|
*
|
|
20
20
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
21
21
|
*
|
|
22
22
|
* This source code is licensed under the MIT license found in the
|
|
23
23
|
* LICENSE file in the root directory of this source tree.
|
|
24
|
-
*/var
|
|
24
|
+
*/var Xa;function Ov(){return Xa||(Xa=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,h=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,b=e?Symbol.for("react.lazy"):60116,w=e?Symbol.for("react.block"):60121,p=e?Symbol.for("react.fundamental"):60117,_=e?Symbol.for("react.responder"):60118,g=e?Symbol.for("react.scope"):60119;function y(M){return typeof M=="string"||typeof M=="function"||M===r||M===u||M===i||M===o||M===f||M===h||typeof M=="object"&&M!==null&&(M.$$typeof===b||M.$$typeof===m||M.$$typeof===s||M.$$typeof===a||M.$$typeof===d||M.$$typeof===p||M.$$typeof===_||M.$$typeof===g||M.$$typeof===w)}function I(M){if(typeof M=="object"&&M!==null){var ve=M.$$typeof;switch(ve){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 b:case m:case s:return Ee;default:return ve}}case n:return ve}}}var C=c,S=u,T=a,R=s,F=t,U=d,Q=r,J=b,Y=m,B=n,ce=i,se=o,ne=f,ge=!1;function we(M){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.")),A(M)||I(M)===c}function A(M){return I(M)===u}function j(M){return I(M)===a}function $(M){return I(M)===s}function K(M){return typeof M=="object"&&M!==null&&M.$$typeof===t}function L(M){return I(M)===d}function D(M){return I(M)===r}function Z(M){return I(M)===b}function ee(M){return I(M)===m}function q(M){return I(M)===n}function te(M){return I(M)===i}function G(M){return I(M)===o}function de(M){return I(M)===f}xe.AsyncMode=C,xe.ConcurrentMode=S,xe.ContextConsumer=T,xe.ContextProvider=R,xe.Element=F,xe.ForwardRef=U,xe.Fragment=Q,xe.Lazy=J,xe.Memo=Y,xe.Portal=B,xe.Profiler=ce,xe.StrictMode=se,xe.Suspense=ne,xe.isAsyncMode=we,xe.isConcurrentMode=A,xe.isContextConsumer=j,xe.isContextProvider=$,xe.isElement=K,xe.isForwardRef=L,xe.isFragment=D,xe.isLazy=Z,xe.isMemo=ee,xe.isPortal=q,xe.isProfiler=te,xe.isStrictMode=G,xe.isSuspense=de,xe.isValidElementType=y,xe.typeOf=I}()),xe}var Ya;function cu(){return Ya||(Ya=1,process.env.NODE_ENV==="production"?Ki.exports=Cv():Ki.exports=Ov()),Ki.exports}/*
|
|
25
25
|
object-assign
|
|
26
26
|
(c) Sindre Sorhus
|
|
27
27
|
@license MIT
|
|
28
|
-
*/var ko,
|
|
29
|
-
Valid keys: `+JSON.stringify(Object.keys(A),null," "));var M=de(ee,G,L,D,Z+"."+G,n);if(M)return M}return null}return p(j)}function B(A){switch(typeof A){case"number":case"string":case"undefined":return!0;case"boolean":return!A;case"object":if(Array.isArray(A))return A.every(B);if(A===null||a(A))return!0;var j=f(A);if(j){var $=j.call(A),K;if(j!==A.entries){for(;!(K=$.next()).done;)if(!B(K.value))return!1}else for(;!(K=$.next()).done;){var L=K.value;if(L&&!B(L[1]))return!1}}else return!1;return!0;default:return!1}}function ce(A,j){return A==="symbol"?!0:j?j["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&j instanceof Symbol:!1}function se(A){var j=typeof A;return Array.isArray(A)?"array":A instanceof RegExp?"object":ce(j,A)?"symbol":j}function ne(A){if(typeof A>"u"||A===null)return""+A;var j=se(A);if(j==="object"){if(A instanceof Date)return"date";if(A instanceof RegExp)return"regexp"}return j}function ge(A){var j=ne(A);switch(j){case"array":case"object":return"an "+j;case"boolean":case"date":case"regexp":return"a "+j;default:return j}}function we(A){return!A.constructor||!A.constructor.name?h:A.constructor.name}return m.checkPropTypes=o,m.resetWarningCache=o.resetWarningCache,m.PropTypes=m,m},Vo}var Uo,
|
|
28
|
+
*/var ko,Za;function Ev(){if(Za)return ko;Za=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 ko=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 h=0;h<u.length;h++)n.call(a,u[h])&&(c[u[h]]=a[u[h]])}}return c},ko}var jo,ec;function $s(){if(ec)return jo;ec=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return jo=e,jo}var Lo,tc;function lu(){return tc||(tc=1,Lo=Function.call.bind(Object.prototype.hasOwnProperty)),Lo}var Ko,nc;function Sv(){if(nc)return Ko;nc=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=$s(),n={},r=lu();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 h=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 h.name="Invariant Violation",h}f=i[d](s,d,c,a,null,t)}catch(b){f=b}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 Vo,rc;function Nv(){if(rc)return Vo;rc=1;var e=cu(),t=Ev(),n=$s(),r=lu(),o=Sv(),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 Vo=function(a,c){var u=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function f(A){var j=A&&(u&&A[u]||A[d]);if(typeof j=="function")return j}var h="<<anonymous>>",m={array:_("array"),bigint:_("bigint"),bool:_("boolean"),func:_("function"),number:_("number"),object:_("object"),string:_("string"),symbol:_("symbol"),any:g(),arrayOf:y,element:I(),elementType:C(),instanceOf:S,node:U(),objectOf:R,oneOf:T,oneOfType:F,shape:J,exact:Y};function b(A,j){return A===j?A!==0||1/A===1/j:A!==A&&j!==j}function w(A,j){this.message=A,this.data=j&&typeof j=="object"?j:{},this.stack=""}w.prototype=Error.prototype;function p(A){if(process.env.NODE_ENV!=="production")var j={},$=0;function K(D,Z,ee,q,te,G,de){if(q=q||h,G=G||ee,de!==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 ve=q+":"+ee;!j[ve]&&$<3&&(i("You are manually calling a React.PropTypes validation function for the `"+G+"` prop on `"+q+"`. 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[ve]=!0,$++)}}return Z[ee]==null?D?Z[ee]===null?new w("The "+te+" `"+G+"` is marked as required "+("in `"+q+"`, but its value is `null`.")):new w("The "+te+" `"+G+"` is marked as required in "+("`"+q+"`, but its value is `undefined`.")):null:A(Z,ee,q,te,G)}var L=K.bind(null,!1);return L.isRequired=K.bind(null,!0),L}function _(A){function j($,K,L,D,Z,ee){var q=$[K],te=se(q);if(te!==A){var G=ne(q);return new w("Invalid "+D+" `"+Z+"` of type "+("`"+G+"` supplied to `"+L+"`, expected ")+("`"+A+"`."),{expectedType:A})}return null}return p(j)}function g(){return p(s)}function y(A){function j($,K,L,D,Z){if(typeof A!="function")return new w("Property `"+Z+"` of component `"+L+"` has invalid PropType notation inside arrayOf.");var ee=$[K];if(!Array.isArray(ee)){var q=se(ee);return new w("Invalid "+D+" `"+Z+"` of type "+("`"+q+"` supplied to `"+L+"`, expected an array."))}for(var te=0;te<ee.length;te++){var G=A(ee,te,L,D,Z+"["+te+"]",n);if(G instanceof Error)return G}return null}return p(j)}function I(){function A(j,$,K,L,D){var Z=j[$];if(!a(Z)){var ee=se(Z);return new w("Invalid "+L+" `"+D+"` of type "+("`"+ee+"` supplied to `"+K+"`, expected a single ReactElement."))}return null}return p(A)}function C(){function A(j,$,K,L,D){var Z=j[$];if(!e.isValidElementType(Z)){var ee=se(Z);return new w("Invalid "+L+" `"+D+"` of type "+("`"+ee+"` supplied to `"+K+"`, expected a single ReactElement type."))}return null}return p(A)}function S(A){function j($,K,L,D,Z){if(!($[K]instanceof A)){var ee=A.name||h,q=we($[K]);return new w("Invalid "+D+" `"+Z+"` of type "+("`"+q+"` supplied to `"+L+"`, expected ")+("instance of `"+ee+"`."))}return null}return p(j)}function T(A){if(!Array.isArray(A))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($,K,L,D,Z){for(var ee=$[K],q=0;q<A.length;q++)if(b(ee,A[q]))return null;var te=JSON.stringify(A,function(de,M){var ve=ne(M);return ve==="symbol"?String(M):M});return new w("Invalid "+D+" `"+Z+"` of value `"+String(ee)+"` "+("supplied to `"+L+"`, expected one of "+te+"."))}return p(j)}function R(A){function j($,K,L,D,Z){if(typeof A!="function")return new w("Property `"+Z+"` of component `"+L+"` has invalid PropType notation inside objectOf.");var ee=$[K],q=se(ee);if(q!=="object")return new w("Invalid "+D+" `"+Z+"` of type "+("`"+q+"` supplied to `"+L+"`, expected an object."));for(var te in ee)if(r(ee,te)){var G=A(ee,te,L,D,Z+"."+te,n);if(G instanceof Error)return G}return null}return p(j)}function F(A){if(!Array.isArray(A))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var j=0;j<A.length;j++){var $=A[j];if(typeof $!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+ge($)+" at index "+j+"."),s}function K(L,D,Z,ee,q){for(var te=[],G=0;G<A.length;G++){var de=A[G],M=de(L,D,Z,ee,q,n);if(M==null)return null;M.data&&r(M.data,"expectedType")&&te.push(M.data.expectedType)}var ve=te.length>0?", expected one of type ["+te.join(", ")+"]":"";return new w("Invalid "+ee+" `"+q+"` supplied to "+("`"+Z+"`"+ve+"."))}return p(K)}function U(){function A(j,$,K,L,D){return B(j[$])?null:new w("Invalid "+L+" `"+D+"` supplied to "+("`"+K+"`, expected a ReactNode."))}return p(A)}function Q(A,j,$,K,L){return new w((A||"React class")+": "+j+" type `"+$+"."+K+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+L+"`.")}function J(A){function j($,K,L,D,Z){var ee=$[K],q=se(ee);if(q!=="object")return new w("Invalid "+D+" `"+Z+"` of type `"+q+"` "+("supplied to `"+L+"`, expected `object`."));for(var te in A){var G=A[te];if(typeof G!="function")return Q(L,D,Z,te,ne(G));var de=G(ee,te,L,D,Z+"."+te,n);if(de)return de}return null}return p(j)}function Y(A){function j($,K,L,D,Z){var ee=$[K],q=se(ee);if(q!=="object")return new w("Invalid "+D+" `"+Z+"` of type `"+q+"` "+("supplied to `"+L+"`, expected `object`."));var te=t({},$[K],A);for(var G in te){var de=A[G];if(r(A,G)&&typeof de!="function")return Q(L,D,Z,G,ne(de));if(!de)return new w("Invalid "+D+" `"+Z+"` key `"+G+"` supplied to `"+L+"`.\nBad object: "+JSON.stringify($[K],null," ")+`
|
|
29
|
+
Valid keys: `+JSON.stringify(Object.keys(A),null," "));var M=de(ee,G,L,D,Z+"."+G,n);if(M)return M}return null}return p(j)}function B(A){switch(typeof A){case"number":case"string":case"undefined":return!0;case"boolean":return!A;case"object":if(Array.isArray(A))return A.every(B);if(A===null||a(A))return!0;var j=f(A);if(j){var $=j.call(A),K;if(j!==A.entries){for(;!(K=$.next()).done;)if(!B(K.value))return!1}else for(;!(K=$.next()).done;){var L=K.value;if(L&&!B(L[1]))return!1}}else return!1;return!0;default:return!1}}function ce(A,j){return A==="symbol"?!0:j?j["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&j instanceof Symbol:!1}function se(A){var j=typeof A;return Array.isArray(A)?"array":A instanceof RegExp?"object":ce(j,A)?"symbol":j}function ne(A){if(typeof A>"u"||A===null)return""+A;var j=se(A);if(j==="object"){if(A instanceof Date)return"date";if(A instanceof RegExp)return"regexp"}return j}function ge(A){var j=ne(A);switch(j){case"array":case"object":return"an "+j;case"boolean":case"date":case"regexp":return"a "+j;default:return j}}function we(A){return!A.constructor||!A.constructor.name?h:A.constructor.name}return m.checkPropTypes=o,m.resetWarningCache=o.resetWarningCache,m.PropTypes=m,m},Vo}var Uo,ic;function Tv(){if(ic)return Uo;ic=1;var e=$s();function t(){}function n(){}return n.resetWarningCache=t,Uo=function(){function r(s,a,c,u,d,f){if(f!==e){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}r.isRequired=r;function 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},Uo}if(process.env.NODE_ENV!=="production"){var Rv=cu(),Av=!0;hs.exports=Nv()(Rv.isElement,Av)}else hs.exports=Tv()();var Pv=hs.exports;const V=Us(Pv);var ms={exports:{}},_e={};/**
|
|
30
30
|
* @license React
|
|
31
31
|
* react-is.production.min.js
|
|
32
32
|
*
|
|
@@ -34,7 +34,7 @@ Valid keys: `+JSON.stringify(Object.keys(A),null," "));var M=de(ee,G,L,D,Z+"."+
|
|
|
34
34
|
*
|
|
35
35
|
* This source code is licensed under the MIT license found in the
|
|
36
36
|
* LICENSE file in the root directory of this source tree.
|
|
37
|
-
*/var
|
|
37
|
+
*/var oc;function Fv(){if(oc)return _e;oc=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"),h=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),b;b=Symbol.for("react.module.reference");function w(p){if(typeof p=="object"&&p!==null){var _=p.$$typeof;switch(_){case e:switch(p=p.type,p){case n:case o:case r:case u:case d:return p;default:switch(p=p&&p.$$typeof,p){case a:case s:case c:case h:case f:case i:return p;default:return _}}case t:return _}}}return _e.ContextConsumer=s,_e.ContextProvider=i,_e.Element=e,_e.ForwardRef=c,_e.Fragment=n,_e.Lazy=h,_e.Memo=f,_e.Portal=t,_e.Profiler=o,_e.StrictMode=r,_e.Suspense=u,_e.SuspenseList=d,_e.isAsyncMode=function(){return!1},_e.isConcurrentMode=function(){return!1},_e.isContextConsumer=function(p){return w(p)===s},_e.isContextProvider=function(p){return w(p)===i},_e.isElement=function(p){return typeof p=="object"&&p!==null&&p.$$typeof===e},_e.isForwardRef=function(p){return w(p)===c},_e.isFragment=function(p){return w(p)===n},_e.isLazy=function(p){return w(p)===h},_e.isMemo=function(p){return w(p)===f},_e.isPortal=function(p){return w(p)===t},_e.isProfiler=function(p){return w(p)===o},_e.isStrictMode=function(p){return w(p)===r},_e.isSuspense=function(p){return w(p)===u},_e.isSuspenseList=function(p){return w(p)===d},_e.isValidElementType=function(p){return typeof p=="string"||typeof p=="function"||p===n||p===o||p===r||p===u||p===d||p===m||typeof p=="object"&&p!==null&&(p.$$typeof===h||p.$$typeof===f||p.$$typeof===i||p.$$typeof===s||p.$$typeof===c||p.$$typeof===b||p.getModuleId!==void 0)},_e.typeOf=w,_e}var Ce={};/**
|
|
38
38
|
* @license React
|
|
39
39
|
* react-is.development.js
|
|
40
40
|
*
|
|
@@ -42,10 +42,10 @@ Valid keys: `+JSON.stringify(Object.keys(A),null," "));var M=de(ee,G,L,D,Z+"."+
|
|
|
42
42
|
*
|
|
43
43
|
* This source code is licensed under the MIT license found in the
|
|
44
44
|
* LICENSE file in the root directory of this source tree.
|
|
45
|
-
*/var oc;function Dv(){return oc||(oc=1,process.env.NODE_ENV!=="production"&&function(){var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),b=!1,v=!1,p=!1,x=!1,g=!1,w;w=Symbol.for("react.module.reference");function _(H){return!!(typeof H=="string"||typeof H=="function"||H===n||H===o||g||H===r||H===u||H===d||x||H===m||b||v||p||typeof H=="object"&&H!==null&&(H.$$typeof===h||H.$$typeof===f||H.$$typeof===i||H.$$typeof===s||H.$$typeof===l||H.$$typeof===w||H.getModuleId!==void 0))}function C(H){if(typeof H=="object"&&H!==null){var Ee=H.$$typeof;switch(Ee){case e:var Ve=H.type;switch(Ve){case n:case o:case r:case u:case d:return Ve;default:var Ye=Ve&&Ve.$$typeof;switch(Ye){case a:case s:case l:case h:case f:case i:return Ye;default:return Ee}}case t:return Ee}}}var N=s,R=i,T=e,F=l,U=n,Q=h,J=f,Y=t,B=o,ce=r,se=u,ne=d,ge=!1,we=!1;function A(H){return ge||(ge=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function j(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 C(H)===s}function K(H){return C(H)===i}function L(H){return typeof H=="object"&&H!==null&&H.$$typeof===e}function D(H){return C(H)===l}function Z(H){return C(H)===n}function ee(H){return C(H)===h}function q(H){return C(H)===f}function te(H){return C(H)===t}function G(H){return C(H)===o}function de(H){return C(H)===r}function M(H){return C(H)===u}function ve(H){return C(H)===d}Ce.ContextConsumer=N,Ce.ContextProvider=R,Ce.Element=T,Ce.ForwardRef=F,Ce.Fragment=U,Ce.Lazy=Q,Ce.Memo=J,Ce.Portal=Y,Ce.Profiler=B,Ce.StrictMode=ce,Ce.Suspense=se,Ce.SuspenseList=ne,Ce.isAsyncMode=A,Ce.isConcurrentMode=j,Ce.isContextConsumer=$,Ce.isContextProvider=K,Ce.isElement=L,Ce.isForwardRef=D,Ce.isFragment=Z,Ce.isLazy=ee,Ce.isMemo=q,Ce.isPortal=te,Ce.isProfiler=G,Ce.isStrictMode=de,Ce.isSuspense=M,Ce.isSuspenseList=ve,Ce.isValidElementType=_,Ce.typeOf=C}()),Ce}process.env.NODE_ENV==="production"?ms.exports=Fv():ms.exports=Dv();var sc=ms.exports;const ac=e=>typeof e=="object"&&e!=null&&e.nodeType===1,cc=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",$o=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return cc(n.overflowY,t)||cc(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},Vi=(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,Mv=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},kv=(e,t)=>{var n,r,o,i;if(typeof document>"u")return[];const{scrollMode:s,block:a,inline:l,boundary:u,skipOverflowHiddenElements:d}=t,f=typeof u=="function"?u:se=>se!==u;if(!ac(e))throw new TypeError("Invalid target");const h=document.scrollingElement||document.documentElement,m=[];let b=e;for(;ac(b)&&f(b);){if(b=Mv(b),b===h){m.push(b);break}b!=null&&b===document.body&&$o(b)&&!$o(document.documentElement)||b!=null&&$o(b,d)&&m.push(b)}const v=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,p=(i=(o=window.visualViewport)==null?void 0:o.height)!=null?i:innerHeight,{scrollX:x,scrollY:g}=window,{height:w,width:_,top:C,right:N,bottom:R,left:T}=e.getBoundingClientRect(),{top:F,right:U,bottom:Q,left:J}=(se=>{const ne=window.getComputedStyle(se);return{top:parseFloat(ne.scrollMarginTop)||0,right:parseFloat(ne.scrollMarginRight)||0,bottom:parseFloat(ne.scrollMarginBottom)||0,left:parseFloat(ne.scrollMarginLeft)||0}})(e);let Y=a==="start"||a==="nearest"?C-F:a==="end"?R+Q:C+w/2-F+Q,B=l==="center"?T+_/2-J+U:l==="end"?N+U:T-J;const ce=[];for(let se=0;se<m.length;se++){const ne=m[se],{height:ge,width:we,top:A,right:j,bottom:$,left:K}=ne.getBoundingClientRect();if(s==="if-needed"&&C>=0&&T>=0&&R<=p&&N<=v&&C>=A&&R<=$&&T>=K&&N<=j)return ce;const L=getComputedStyle(ne),D=parseInt(L.borderLeftWidth,10),Z=parseInt(L.borderTopWidth,10),ee=parseInt(L.borderRightWidth,10),q=parseInt(L.borderBottomWidth,10);let te=0,G=0;const de="offsetWidth"in ne?ne.offsetWidth-ne.clientWidth-D-ee:0,M="offsetHeight"in ne?ne.offsetHeight-ne.clientHeight-Z-q:0,ve="offsetWidth"in ne?ne.offsetWidth===0?0:we/ne.offsetWidth:0,H="offsetHeight"in ne?ne.offsetHeight===0?0:ge/ne.offsetHeight:0;if(h===ne)te=a==="start"?Y:a==="end"?Y-p:a==="nearest"?Vi(g,g+p,p,Z,q,g+Y,g+Y+w,w):Y-p/2,G=l==="start"?B:l==="center"?B-v/2:l==="end"?B-v:Vi(x,x+v,v,D,ee,x+B,x+B+_,_),te=Math.max(0,te+g),G=Math.max(0,G+x);else{te=a==="start"?Y-A-Z:a==="end"?Y-$+q+M:a==="nearest"?Vi(A,$,ge,Z,q+M,Y,Y+w,w):Y-(A+ge/2)+M/2,G=l==="start"?B-K-D:l==="center"?B-(K+we/2)+de/2:l==="end"?B-j+ee+de:Vi(K,j,we,D,ee+de,B,B+_,_);const{scrollLeft:Ee,scrollTop:Ve}=ne;te=H===0?0:Math.max(0,Math.min(Ve+te/H,ne.scrollHeight-ge/H+M)),G=ve===0?0:Math.max(0,Math.min(Ee+G/ve,ne.scrollWidth-we/ve+de)),Y+=Ve-te,B+=Ee-G}ce.push({el:ne,top:te,left:G})}return ce};var jr=function(){return jr=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},jr.apply(this,arguments)};var jv=0;function lc(e){return typeof e=="function"?e:bt}function bt(){}function lu(e,t){if(e){var n=kv(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 uc(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function $s(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 Be(){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 Ir(){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 uu(){return String(jv++)}function Lv(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 dc(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function du(e){return typeof e.type=="string"}function fu(e){return e.props}function Kv(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var Vv=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function Ui(e){e===void 0&&(e={});var t={};return Vv.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 gs(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function Uv(e){return Object.prototype.toString.call(e)==="[object Object]"}function Yn(e,t,n,r,o){var i=n.length;if(i===0)return-1;var s=i-1;(typeof e!="number"||e<0||e>s)&&(e=t>0?-1:s+1);var a=e+t;a<0?a=s:a>s&&(a=0);var l=Lr(a,t<0,n,r,o);return l===-1?e>=i?-1:e:l}function Lr(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?Lr(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&&(uc(o,e,n)||r&&uc(o,n.document.activeElement,n))})}var qs=bt;process.env.NODE_ENV!=="production"&&(qs=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 $v=$s(function(e){pu(e).textContent=""},500);function pu(e){var t=e.getElementById("a11y-status-message");return t||(t=e.createElement("div"),t.setAttribute("id","a11y-status-message"),t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-relevant","additions text"),Object.assign(t.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),e.body.appendChild(t),t)}function hu(e,t){if(!(!e||!t)){var n=pu(t);n.textContent=e,$v(t)}}function qv(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var mu=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,gu=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,yu=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,Ji=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,Wi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,vu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,wu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,Iu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,bu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,_u=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,xu=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,Cu=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,Ou=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,ys=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,Eu=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,Su=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,Nu=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,Hv=Object.freeze({__proto__:null,blurButton:Eu,blurInput:xu,changeInput:Cu,clickButton:ys,clickItem:_u,controlledPropUpdatedSelectedItem:Su,itemMouseEnter:yu,keyDownArrowDown:Wi,keyDownArrowUp:Ji,keyDownEnd:bu,keyDownEnter:wu,keyDownEscape:vu,keyDownHome:Iu,keyDownSpaceButton:Ou,mouseUp:gu,touchEnd:Nu,unknown:mu}),Bv=["refKey","ref"],Jv=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],Wv=["onKeyDown","onBlur","onChange","onInput","onChangeText"],zv=["refKey","ref"],Gv=["onMouseMove","onMouseDown","onClick","onPress","index","item"],Qv=function(){var e=function(t){function n(o){var i;i=t.call(this,o)||this,i.id=i.props.id||"downshift-"+uu(),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(g){return i.id+"-item-"+g},i.items=[],i.itemCount=null,i.previousResultCount=0,i.timeoutIds=[],i.internalSetTimeout=function(g,w){var _=setTimeout(function(){i.timeoutIds=i.timeoutIds.filter(function(C){return C!==_}),g()},w);i.timeoutIds.push(_)},i.setItemCount=function(g){i.itemCount=g},i.unsetItemCount=function(){i.itemCount=null},i.isItemDisabled=function(g,w){var _=i.getItemNodeFromIndex(w);return _&&_.hasAttribute("disabled")},i.setHighlightedIndex=function(g,w){g===void 0&&(g=i.props.defaultHighlightedIndex),w===void 0&&(w={}),w=Ui(w),i.internalSetState(he({highlightedIndex:g},w))},i.clearSelection=function(g){i.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:i.props.defaultHighlightedIndex,isOpen:i.props.defaultIsOpen},g)},i.selectItem=function(g,w,_){w=Ui(w),i.internalSetState(he({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,selectedItem:g,inputValue:i.props.itemToString(g)},w),_)},i.selectItemAtIndex=function(g,w,_){var C=i.items[g];C!=null&&i.selectItem(C,w,_)},i.selectHighlightedItem=function(g,w){return i.selectItemAtIndex(i.getState().highlightedIndex,g,w)},i.internalSetState=function(g,w){var _,C,N={},R=typeof g=="function";return!R&&g.hasOwnProperty("inputValue")&&i.props.onInputValueChange(g.inputValue,he({},i.getStateAndHelpers(),g)),i.setState(function(T){var F;T=i.getState(T);var U=R?g(T):g;U=i.props.stateReducer(T,U),_=U.hasOwnProperty("selectedItem");var Q={};return _&&U.selectedItem!==T.selectedItem&&(C=U.selectedItem),(F=U).type||(F.type=mu),Object.keys(U).forEach(function(J){T[J]!==U[J]&&(N[J]=U[J]),J!=="type"&&(U[J],to(i.props,J)||(Q[J]=U[J]))}),R&&U.hasOwnProperty("inputValue")&&i.props.onInputValueChange(U.inputValue,he({},i.getStateAndHelpers(),U)),Q},function(){lc(w)();var T=Object.keys(N).length>1;T&&i.props.onStateChange(N,i.getStateAndHelpers()),_&&i.props.onSelect(g.selectedItem,i.getStateAndHelpers()),C!==void 0&&i.props.onChange(C,i.getStateAndHelpers()),i.props.onUserAction(N,i.getStateAndHelpers())})},i.rootRef=function(g){return i._rootNode=g},i.getRootProps=function(g,w){var _,C=g===void 0?{}:g,N=C.refKey,R=N===void 0?"ref":N,T=C.ref,F=hn(C,Bv),U=w===void 0?{}:w,Q=U.suppressRefError,J=Q===void 0?!1:Q;i.getRootProps.called=!0,i.getRootProps.refKey=R,i.getRootProps.suppressRefError=J;var Y=i.getState(),B=Y.isOpen;return he((_={},_[R]=Ir(T,i.rootRef),_.role="combobox",_["aria-expanded"]=B,_["aria-haspopup"]="listbox",_["aria-owns"]=B?i.menuId:void 0,_["aria-labelledby"]=i.labelId,_),F)},i.keyDownHandlers={ArrowDown:function(w){var _=this;if(w.preventDefault(),this.getState().isOpen){var C=w.shiftKey?5:1;this.moveHighlightedIndex(C,{type:Wi})}else this.internalSetState({isOpen:!0,type:Wi},function(){var N=_.getItemCount();if(N>0){var R=_.getState(),T=R.highlightedIndex,F=Yn(T,1,{length:N},_.isItemDisabled,!0);_.setHighlightedIndex(F,{type:Wi})}})},ArrowUp:function(w){var _=this;if(w.preventDefault(),this.getState().isOpen){var C=w.shiftKey?-5:-1;this.moveHighlightedIndex(C,{type:Ji})}else this.internalSetState({isOpen:!0,type:Ji},function(){var N=_.getItemCount();if(N>0){var R=_.getState(),T=R.highlightedIndex,F=Yn(T,-1,{length:N},_.isItemDisabled,!0);_.setHighlightedIndex(F,{type:Ji})}})},Enter:function(w){if(w.which!==229){var _=this.getState(),C=_.isOpen,N=_.highlightedIndex;if(C&&N!=null){w.preventDefault();var R=this.items[N],T=this.getItemNodeFromIndex(N);if(R==null||T&&T.hasAttribute("disabled"))return;this.selectHighlightedItem({type:wu})}}},Escape:function(w){w.preventDefault(),this.reset(he({type:vu},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},i.buttonKeyDownHandlers=he({},i.keyDownHandlers,{" ":function(w){w.preventDefault(),this.toggleMenu({type:Ou})}}),i.inputKeyDownHandlers=he({},i.keyDownHandlers,{Home:function(w){var _=this.getState(),C=_.isOpen;if(C){w.preventDefault();var N=this.getItemCount();if(!(N<=0||!C)){var R=Lr(0,!1,{length:N},this.isItemDisabled);this.setHighlightedIndex(R,{type:Iu})}}},End:function(w){var _=this.getState(),C=_.isOpen;if(C){w.preventDefault();var N=this.getItemCount();if(!(N<=0||!C)){var R=Lr(N-1,!0,{length:N},this.isItemDisabled);this.setHighlightedIndex(R,{type:bu})}}}}),i.getToggleButtonProps=function(g){var w=g===void 0?{}:g,_=w.onClick;w.onPress;var C=w.onKeyDown,N=w.onKeyUp,R=w.onBlur,T=hn(w,Jv),F=i.getState(),U=F.isOpen,Q={onClick:Be(_,i.buttonHandleClick),onKeyDown:Be(C,i.buttonHandleKeyDown),onKeyUp:Be(N,i.buttonHandleKeyUp),onBlur:Be(R,i.buttonHandleBlur)},J=T.disabled?{}:Q;return he({type:"button",role:"button","aria-label":U?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},J,T)},i.buttonHandleKeyUp=function(g){g.preventDefault()},i.buttonHandleKeyDown=function(g){var w=gs(g);i.buttonKeyDownHandlers[w]&&i.buttonKeyDownHandlers[w].call(i,g)},i.buttonHandleClick=function(g){if(g.preventDefault(),i.props.environment){var w=i.props.environment.document,_=w.body,C=w.activeElement;_&&_===C&&g.target.focus()}process.env.NODE_ENV==="test"?i.toggleMenu({type:ys}):i.internalSetTimeout(function(){return i.toggleMenu({type:ys})})},i.buttonHandleBlur=function(g){var w=g.target;i.internalSetTimeout(function(){if(!(i.isMouseDown||!i.props.environment)){var _=i.props.environment.document.activeElement;(_==null||_.id!==i.inputId)&&_!==w&&i.reset({type:Eu})}})},i.getLabelProps=function(g){return he({htmlFor:i.inputId,id:i.labelId},g)},i.getInputProps=function(g){var w=g===void 0?{}:g,_=w.onKeyDown,C=w.onBlur,N=w.onChange,R=w.onInput;w.onChangeText;var T=hn(w,Wv),F,U={};F="onChange";var Q=i.getState(),J=Q.inputValue,Y=Q.isOpen,B=Q.highlightedIndex;if(!T.disabled){var ce;U=(ce={},ce[F]=Be(N,R,i.inputHandleChange),ce.onKeyDown=Be(_,i.inputHandleKeyDown),ce.onBlur=Be(C,i.inputHandleBlur),ce)}return he({"aria-autocomplete":"list","aria-activedescendant":Y&&typeof B=="number"&&B>=0?i.getItemId(B):void 0,"aria-controls":Y?i.menuId:void 0,"aria-labelledby":T&&T["aria-label"]?void 0:i.labelId,autoComplete:"off",value:J,id:i.inputId},U,T)},i.inputHandleKeyDown=function(g){var w=gs(g);w&&i.inputKeyDownHandlers[w]&&i.inputKeyDownHandlers[w].call(i,g)},i.inputHandleChange=function(g){i.internalSetState({type:Cu,isOpen:!0,inputValue:g.target.value,highlightedIndex:i.props.defaultHighlightedIndex})},i.inputHandleBlur=function(){i.internalSetTimeout(function(){var g;if(!(i.isMouseDown||!i.props.environment)){var w=i.props.environment.document.activeElement,_=(w==null||(g=w.dataset)==null?void 0:g.toggle)&&i._rootNode&&i._rootNode.contains(w);_||i.reset({type:xu})}})},i.menuRef=function(g){i._menuNode=g},i.getMenuProps=function(g,w){var _,C=g===void 0?{}:g,N=C.refKey,R=N===void 0?"ref":N,T=C.ref,F=hn(C,zv),U=w===void 0?{}:w,Q=U.suppressRefError,J=Q===void 0?!1:Q;return i.getMenuProps.called=!0,i.getMenuProps.refKey=R,i.getMenuProps.suppressRefError=J,he((_={},_[R]=Ir(T,i.menuRef),_.role="listbox",_["aria-labelledby"]=F&&F["aria-label"]?void 0:i.labelId,_.id=i.menuId,_),F)},i.getItemProps=function(g){var w,_=g===void 0?{}:g,C=_.onMouseMove,N=_.onMouseDown,R=_.onClick;_.onPress;var T=_.index,F=_.item,U=F===void 0?process.env.NODE_ENV==="production"?void 0:Kv("getItemProps","item"):F,Q=hn(_,Gv);T===void 0?(i.items.push(U),T=i.items.indexOf(U)):i.items[T]=U;var J="onClick",Y=R,B=(w={onMouseMove:Be(C,function(){T!==i.getState().highlightedIndex&&(i.setHighlightedIndex(T,{type:yu}),i.avoidScrolling=!0,i.internalSetTimeout(function(){return i.avoidScrolling=!1},250))}),onMouseDown:Be(N,function(se){se.preventDefault()})},w[J]=Be(Y,function(){i.selectItemAtIndex(T,{type:_u})}),w),ce=Q.disabled?{onMouseDown:B.onMouseDown}:B;return he({id:i.getItemId(T),role:"option","aria-selected":i.getState().highlightedIndex===T},ce,Q)},i.clearItems=function(){i.items=[]},i.reset=function(g,w){g===void 0&&(g={}),g=Ui(g),i.internalSetState(function(_){var C=_.selectedItem;return he({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,inputValue:i.props.itemToString(C)},g)},w)},i.toggleMenu=function(g,w){g===void 0&&(g={}),g=Ui(g),i.internalSetState(function(_){var C=_.isOpen;return he({isOpen:!C},C&&{highlightedIndex:i.props.defaultHighlightedIndex},g)},function(){var _=i.getState(),C=_.isOpen,N=_.highlightedIndex;C&&i.getItemCount()>0&&typeof N=="number"&&i.setHighlightedIndex(N,g),lc(w)()})},i.openMenu=function(g){i.internalSetState({isOpen:!0},g)},i.closeMenu=function(g){i.internalSetState({isOpen:!1},g)},i.updateStatus=$s(function(){var g;if((g=i.props)!=null&&(g=g.environment)!=null&&g.document){var w=i.getState(),_=i.items[w.highlightedIndex],C=i.getItemCount(),N=i.props.getA11yStatusMessage(he({itemToString:i.props.itemToString,previousResultCount:i.previousResultCount,resultCount:C,highlightedItem:_},w));i.previousResultCount=C,hu(N,i.props.environment.document)}},200);var s=i.props,a=s.defaultHighlightedIndex,l=s.initialHighlightedIndex,u=l===void 0?a:l,d=s.defaultIsOpen,f=s.initialIsOpen,h=f===void 0?d:f,m=s.initialInputValue,b=m===void 0?"":m,v=s.initialSelectedItem,p=v===void 0?null:v,x=i.getState({highlightedIndex:u,isOpen:h,inputValue:b,selectedItem:p});return x.selectedItem!=null&&i.props.initialInputValue===void 0&&(x.inputValue=i.props.itemToString(x.selectedItem)),i.state=x,i}xv(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(),l=this.getState(),u=l.highlightedIndex;if(a>0){var d=Yn(u,i,{length:a},this.isItemDisabled,!0);this.setHighlightedIndex(d,s)}},r.getStateAndHelpers=function(){var i=this.getState(),s=i.highlightedIndex,a=i.inputValue,l=i.selectedItem,u=i.isOpen,d=this.props.itemToString,f=this.id,h=this.getRootProps,m=this.getToggleButtonProps,b=this.getLabelProps,v=this.getMenuProps,p=this.getInputProps,x=this.getItemProps,g=this.openMenu,w=this.closeMenu,_=this.toggleMenu,C=this.selectItem,N=this.selectItemAtIndex,R=this.selectHighlightedItem,T=this.setHighlightedIndex,F=this.clearSelection,U=this.clearItems,Q=this.reset,J=this.setItemCount,Y=this.unsetItemCount,B=this.internalSetState;return{getRootProps:h,getToggleButtonProps:m,getLabelProps:b,getMenuProps:v,getInputProps:p,getItemProps:x,reset:Q,openMenu:g,closeMenu:w,toggleMenu:_,selectItem:C,selectItemAtIndex:N,selectHighlightedItem:R,setHighlightedIndex:T,clearSelection:F,clearItems:U,setItemCount:J,unsetItemCount:Y,setState:B,itemToString:d,id:f,highlightedIndex:s,inputValue:a,isOpen:u,selectedItem:l}},r.componentDidMount=function(){var i=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&fc(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 b=no(m.target,[i._rootNode,i._menuNode],i.props.environment);!b&&i.getState().isOpen&&i.reset({type:gu},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},l=function(){i.isTouchMove=!1},u=function(){i.isTouchMove=!0},d=function(m){var b=no(m.target,[i._rootNode,i._menuNode],i.props.environment,!1);!i.isTouchMove&&!b&&i.getState().isOpen&&i.reset({type:Nu},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},f=this.props.environment;f.addEventListener("mousedown",s),f.addEventListener("mouseup",a),f.addEventListener("touchstart",l),f.addEventListener("touchmove",u),f.addEventListener("touchend",d),this.cleanup=function(){i.internalClearTimeouts(),i.updateStatus.cancel(),f.removeEventListener("mousedown",s),f.removeEventListener("mouseup",a),f.removeEventListener("touchstart",l),f.removeEventListener("touchmove",u),f.removeEventListener("touchend",d)}}},r.shouldScroll=function(i,s){var a=this.props.highlightedIndex===void 0?this.getState():this.props,l=a.highlightedIndex,u=s.highlightedIndex===void 0?i:s,d=u.highlightedIndex,f=l&&this.getState().isOpen&&!i.isOpen,h=l!==d;return f||h},r.componentDidUpdate=function(i,s){process.env.NODE_ENV!=="production"&&(qs(this.state,i,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&fc(this._menuNode,this.getMenuProps)),to(this.props,"selectedItem")&&this.props.selectedItemChanged(i.selectedItem,this.props.selectedItem)&&this.internalSetState({type:Su,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=dc(this.props.children,bt);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=dc(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&&Xv(s,this.getRootProps),s;if(du(s))return y.cloneElement(s,this.getRootProps(fu(s)));if(process.env.NODE_ENV!=="production")throw new Error("downshift: If you return a non-DOM element, you must apply the getRootProps function")},n}(y.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:Lv,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&Uv(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:bt,onInputValueChange:bt,onUserAction:bt,onChange:bt,onSelect:bt,onOuterClick:bt,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:lu},e.stateChangeTypes=Hv,e}();process.env.NODE_ENV!=="production"&&(Qv.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 fc(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 Xv(e,t){var n=t.refKey,r=n!=="ref",o=!du(e);o&&!r&&!sc.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+'"'),!sc.isForwardRef(e)&&!fu(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Tu={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function Yv(e,t,n){var r=e.props,o=e.type,i={};Object.keys(t).forEach(function(s){Zv(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 Zv(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 ew(e,t){return t.changes}var pc=$s(function(e,t){hu(e,t)},200),tw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?y.useLayoutEffect:y.useEffect,nw="useId"in y?function(t){var n=t.id,r=t.labelId,o=t.menuId,i=t.getItemId,s=t.toggleButtonId,a=t.inputId,l="downshift-"+y.useId();n||(n=l);var u=y.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-"+uu():n,o=t.labelId,i=t.menuId,s=t.getItemId,a=t.toggleButtonId,l=t.inputId,u=y.useRef({labelId:o||r+"-label",menuId:i||r+"-menu",getItemId:s||function(d){return r+"-item-"+d},toggleButtonId:a||r+"-toggle-button",inputId:l||r+"-input"});return u.current};function rw(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 Ru(e){var t=y.useRef(e);return t.current=e,t}function iw(e,t,n,r){var o=y.useRef(),i=y.useRef(),s=y.useCallback(function(m,b){i.current=b,m=eo(m,b.props);var v=e(m,b),p=b.props.stateReducer(m,he({},b,{changes:v}));return p},[e]),a=y.useReducer(s,t,n),l=a[0],u=a[1],d=Ru(t),f=y.useCallback(function(m){return u(he({props:d.current},m))},[d]),h=i.current;return y.useEffect(function(){var m=eo(o.current,h==null?void 0:h.props),b=h&&o.current&&!r(m,l);b&&Yv(h,m,l),o.current=l},[l,h,r]),[l,f]}var ii={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:ew,scrollIntoView:lu,environment:typeof window>"u"?void 0:window};function Ln(e,t,n){n===void 0&&(n=Tu);var r=e["default"+Hs(t)];return r!==void 0?r:n[t]}function oi(e,t,n){n===void 0&&(n=Tu);var r=e[t];if(r!==void 0)return r;var o=e["initial"+Hs(t)];return o!==void 0?o:Ln(e,t,n)}function ow(e){var t=oi(e,"selectedItem"),n=oi(e,"isOpen"),r=uw(e),o=oi(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 si(e,t,n){var r=e.items,o=e.initialHighlightedIndex,i=e.defaultHighlightedIndex,s=e.isItemDisabled,a=e.itemToKey,l=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:l?r.findIndex(function(d){return a(l)===a(d)}):n<0&&!s(r[r.length-1],r.length-1)?r.length-1:n>0&&!s(r[0],0)?0:-1}function sw(e,t,n){var r=y.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return y.useEffect(function(){if(!e)return bt;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 l(){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",l),e.addEventListener("touchend",u),function(){e.removeEventListener("mousedown",i),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",l),e.removeEventListener("touchend",u)}},[n,e,t]),r.current}var Au=function(){return bt};process.env.NODE_ENV!=="production"&&(Au=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=y.useRef(n.reduce(function(s,a){return s[a]={},s},{}));y.useEffect(function(){Object.keys(o.current).forEach(function(s){var a=o.current[s];if(!Object.keys(a).length){console.error("downshift: You forgot to call the "+s+" getter function on your component / element.");return}var l=a.suppressRefError,u=a.refKey,d=a.elementRef;l||d!=null&&d.current||console.error('downshift: The ref prop "'+u+'" from '+s+" was not applied correctly on your element.")})},[]);var i=y.useCallback(function(s,a,l,u){o.current[s]={suppressRefError:a,refKey:l,elementRef:u}},[]);return i});function aw(e,t,n,r){r===void 0&&(r={});var o=r.document,i=po();y.useEffect(function(){if(!(!e||i||!o)){var s=e(t);pc(s,o)}},n),y.useEffect(function(){return function(){pc.cancel(),qv(o)}},[o])}function cw(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,o=e.getItemNodeFromIndex,i=e.menuElement,s=e.scrollIntoView,a=y.useRef(!0);return tw(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(o(t),i))},[t]),a}var Pu=bt;process.env.NODE_ENV!=="production"&&(Pu=function(t){var n=t.props,r=t.state,o=y.useRef(n),i=po();y.useEffect(function(){i||(qs(r,o.current,n),o.current=n)},[r,n,i])});function hc(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:Ln(e,"isOpen"),highlightedIndex:Ln(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function lw(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function po(){var e=y.useRef(!0);return y.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function vs(e){var t=Ln(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function uw(e){var t=oi(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var zi={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},Fu=he({},zi,{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 dw(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:si(o,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:si(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:vs(o),isOpen:Ln(o,"isOpen"),selectedItem:Ln(o,"selectedItem"),inputValue:Ln(o,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return he({},e,i)}jr(jr({},Fu),{items:V.array.isRequired,isItemDisabled:V.func});jr(jr({},ii),{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,Js=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,Ws=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,Du=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,Mu=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,ta=process.env.NODE_ENV!=="production"?"__item_click__":13,ku=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,ju=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,Lu=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,Ku=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,Vu=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,na=process.env.NODE_ENV!=="production"?"__function_select_item__":19,Uu=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,$u=process.env.NODE_ENV!=="production"?"__function_reset__":21,ra=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,qu=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:ra,FunctionCloseMenu:Ku,FunctionOpenMenu:Lu,FunctionReset:$u,FunctionSelectItem:na,FunctionSetHighlightedIndex:Vu,FunctionSetInputValue:Uu,FunctionToggleMenu:ju,InputBlur:ro,InputChange:Zs,InputClick:ea,InputKeyDownArrowDown:Bs,InputKeyDownArrowUp:Js,InputKeyDownEnd:Gs,InputKeyDownEnter:Ys,InputKeyDownEscape:Ws,InputKeyDownHome:zs,InputKeyDownPageDown:Xs,InputKeyDownPageUp:Qs,ItemClick:ta,ItemMouseMove:Mu,MenuMouseLeave:Du,ToggleButtonClick:ku});function fw(e){var t=ow(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 pw=he({},Fu,{items:V.array.isRequired,isItemDisabled:V.func,inputValue:V.string,defaultInputValue:V.string,initialInputValue:V.string,inputId:V.string,onInputValueChange:V.func});function hw(e,t,n,r){var o=y.useRef(),i=iw(e,t,n,r),s=i[0],a=i[1],l=po();return y.useEffect(function(){if(to(t,"selectedItem")){if(!l){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 Hu=bt;process.env.NODE_ENV!=="production"&&(Hu=function(t,n){V.checkPropTypes(pw,t,"prop",n.name)});var mw=he({},ii,{isItemDisabled:function(){return!1}});function gw(e,t){var n,r=t.type,o=t.props,i=t.altKey,s;switch(r){case ta:s={isOpen:Ln(o,"isOpen"),highlightedIndex:vs(o),selectedItem:o.items[t.index],inputValue:o.itemToString(o.items[t.index])};break;case Bs:e.isOpen?s={highlightedIndex:Yn(e.highlightedIndex,1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:i&&e.selectedItem==null?-1:si(o,e,1),isOpen:o.items.length>=0};break;case Js:e.isOpen?i?s=hc(o,e.highlightedIndex):s={highlightedIndex:Yn(e.highlightedIndex,-1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:si(o,e,-1),isOpen:o.items.length>=0};break;case Ys:s=hc(o,e.highlightedIndex);break;case Ws:s=he({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case Qs:s={highlightedIndex:Yn(e.highlightedIndex,-10,o.items,o.isItemDisabled,!0)};break;case Xs:s={highlightedIndex:Yn(e.highlightedIndex,10,o.items,o.isItemDisabled,!0)};break;case zs:s={highlightedIndex:Lr(0,!1,o.items,o.isItemDisabled)};break;case Gs:s={highlightedIndex:Lr(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:vs(o),inputValue:t.inputValue};break;case ea:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:si(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 dw(e,t,qu)}return he({},e,s)}var yw=["onMouseLeave","refKey","ref"],vw=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],ww=["onClick","onPress","refKey","ref"],Iw=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];ia.stateChangeTypes=qu;function ia(e){e===void 0&&(e={}),Hu(e,ia);var t=he({},mw,e),n=t.items,r=t.scrollIntoView,o=t.environment,i=t.getA11yStatusMessage,s=hw(gw,t,fw,lw),a=s[0],l=s[1],u=a.isOpen,d=a.highlightedIndex,f=a.selectedItem,h=a.inputValue,m=y.useRef(null),b=y.useRef({}),v=y.useRef(null),p=y.useRef(null),x=po(),g=nw(t),w=y.useRef(),_=Ru({state:a,props:t}),C=y.useCallback(function($){return b.current[g.getItemId($)]},[g]);aw(i,a,[u,d,f,h],o);var N=cw({menuElement:m.current,highlightedIndex:d,isOpen:u,itemRefs:b,scrollIntoView:r,getItemNodeFromIndex:C});Pu({props:t,state:a}),y.useEffect(function(){var $=oi(t,"isOpen");$&&v.current&&v.current.focus()},[]),y.useEffect(function(){x||(w.current=n.length)});var R=sw(o,y.useCallback(function(){_.current.state.isOpen&&l({type:ro,selectItem:!1})},[l,_]),y.useMemo(function(){return[m,p,v]},[m.current,p.current,v.current])),T=Au("getInputProps","getMenuProps");y.useEffect(function(){u||(b.current={})},[u]),y.useEffect(function(){var $;!u||!(o!=null&&o.document)||!(v!=null&&($=v.current)!=null&&$.focus)||o.document.activeElement!==v.current&&v.current.focus()},[u,o]);var F=y.useMemo(function(){return{ArrowDown:function(K){K.preventDefault(),l({type:Bs,altKey:K.altKey})},ArrowUp:function(K){K.preventDefault(),l({type:Js,altKey:K.altKey})},Home:function(K){_.current.state.isOpen&&(K.preventDefault(),l({type:zs}))},End:function(K){_.current.state.isOpen&&(K.preventDefault(),l({type:Gs}))},Escape:function(K){var L=_.current.state;(L.isOpen||L.inputValue||L.selectedItem||L.highlightedIndex>-1)&&(K.preventDefault(),l({type:Ws}))},Enter:function(K){var L=_.current.state;!L.isOpen||K.which===229||(K.preventDefault(),l({type:Ys}))},PageUp:function(K){_.current.state.isOpen&&(K.preventDefault(),l({type:Qs}))},PageDown:function(K){_.current.state.isOpen&&(K.preventDefault(),l({type:Xs}))}}},[l,_]),U=y.useCallback(function($){return he({id:g.labelId,htmlFor:g.inputId},$)},[g]),Q=y.useCallback(function($,K){var L,D=$===void 0?{}:$,Z=D.onMouseLeave,ee=D.refKey,q=ee===void 0?"ref":ee,te=D.ref,G=hn(D,yw),de=K===void 0?{}:K,M=de.suppressRefError,ve=M===void 0?!1:M;return T("getMenuProps",ve,q,m),he((L={},L[q]=Ir(te,function(H){m.current=H}),L.id=g.menuId,L.role="listbox",L["aria-labelledby"]=G&&G["aria-label"]?void 0:""+g.labelId,L.onMouseLeave=Be(Z,function(){l({type:Du})}),L),G)},[l,T,g]),J=y.useCallback(function($){var K,L,D=$===void 0?{}:$,Z=D.item,ee=D.index,q=D.refKey,te=q===void 0?"ref":q,G=D.ref,de=D.onMouseMove,M=D.onMouseDown,ve=D.onClick;D.onPress;var H=D.disabled,Ee=hn(D,vw);H!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var Ve=_.current,Ye=Ve.props,Ue=Ve.state,Ie=rw(Z,ee,Ye.items,"Pass either item or index to getItemProps!"),Mt=Ie[0],Ze=Ie[1],vt=Ye.isItemDisabled(Mt,Ze),kt="onClick",jt=ve,et=function(){R.isTouchEnd||Ze===Ue.highlightedIndex||(N.current=!1,l({type:Mu,index:Ze,disabled:vt}))},Ge=function(){l({type:ta,index:Ze})},$e=function(Lt){return Lt.preventDefault()};return he((K={},K[te]=Ir(G,function(Pe){Pe&&(b.current[g.getItemId(Ze)]=Pe)}),K["aria-disabled"]=vt,K["aria-selected"]=Ze===Ue.highlightedIndex,K.id=g.getItemId(Ze),K.role="option",K),!vt&&(L={},L[kt]=Be(jt,Ge),L),{onMouseMove:Be(de,et),onMouseDown:Be(M,$e)},Ee)},[l,g,_,R,N]),Y=y.useCallback(function($){var K,L=$===void 0?{}:$,D=L.onClick;L.onPress;var Z=L.refKey,ee=Z===void 0?"ref":Z,q=L.ref,te=hn(L,ww),G=_.current.state,de=function(){l({type:ku})};return he((K={},K[ee]=Ir(q,function(M){p.current=M}),K["aria-controls"]=g.menuId,K["aria-expanded"]=G.isOpen,K.id=g.toggleButtonId,K.tabIndex=-1,K),!te.disabled&&he({},{onClick:Be(D,de)}),te)},[l,_,g]),B=y.useCallback(function($,K){var L,D=$===void 0?{}:$,Z=D.onKeyDown,ee=D.onChange,q=D.onInput,te=D.onBlur;D.onChangeText;var G=D.onClick,de=D.refKey,M=de===void 0?"ref":de,ve=D.ref,H=hn(D,Iw),Ee=K===void 0?{}:K,Ve=Ee.suppressRefError,Ye=Ve===void 0?!1:Ve;T("getInputProps",Ye,M,v);var Ue=_.current.state,Ie=function($e){var Pe=gs($e);Pe&&F[Pe]&&F[Pe]($e)},Mt=function($e){l({type:Zs,inputValue:$e.target.value})},Ze=function($e){if(o!=null&&o.document&&Ue.isOpen&&!R.isMouseDown){var Pe=$e.relatedTarget===null&&o.document.activeElement!==o.document.body;l({type:ro,selectItem:!Pe})}},vt=function(){l({type:ea})},kt="onChange",jt={};if(!H.disabled){var et;jt=(et={},et[kt]=Be(ee,q,Mt),et.onKeyDown=Be(Z,Ie),et.onBlur=Be(te,Ze),et.onClick=Be(G,vt),et)}return he((L={},L[M]=Ir(ve,function(Ge){v.current=Ge}),L["aria-activedescendant"]=Ue.isOpen&&Ue.highlightedIndex>-1?g.getItemId(Ue.highlightedIndex):"",L["aria-autocomplete"]="list",L["aria-controls"]=g.menuId,L["aria-expanded"]=Ue.isOpen,L["aria-labelledby"]=H&&H["aria-label"]?void 0:g.labelId,L.autoComplete="off",L.id=g.inputId,L.role="combobox",L.value=Ue.inputValue,L),jt,H)},[l,g,o,F,_,R,T]),ce=y.useCallback(function(){l({type:ju})},[l]),se=y.useCallback(function(){l({type:Ku})},[l]),ne=y.useCallback(function(){l({type:Lu})},[l]),ge=y.useCallback(function($){l({type:Vu,highlightedIndex:$})},[l]),we=y.useCallback(function($){l({type:na,selectedItem:$})},[l]),A=y.useCallback(function($){l({type:Uu,inputValue:$})},[l]),j=y.useCallback(function(){l({type:$u})},[l]);return{getItemProps:J,getLabelProps:U,getMenuProps:Q,getInputProps:B,getToggleButtonProps:Y,toggleMenu:ce,openMenu:ne,closeMenu:se,setHighlightedIndex:ge,setInputValue:A,selectItem:we,reset:j,highlightedIndex:d,isOpen:u,selectedItem:f,inputValue:h}}zi.stateReducer,zi.itemToKey,zi.environment,V.array,V.array,V.array,V.func,V.number,V.number,V.number,V.func,V.func,V.string,V.string;ii.itemToKey,ii.stateReducer,ii.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 bw="_comboboxContainer_1lcc8_1",_w="_label_1lcc8_8",xw="_inputContainer_1lcc8_12",Cw="_input_1lcc8_12",Ow="_toggleButton_1lcc8_33",Ew="_menu_1lcc8_39",Sw="_menuBottom_1lcc8_55",Nw="_menuTop_1lcc8_61",Tw="_menuItem_1lcc8_66",Rw="_highlighted_1lcc8_73",Aw="_selected_1lcc8_77",Pw="_hidden_1lcc8_81",$t={comboboxContainer:bw,label:_w,inputContainer:xw,input:Cw,toggleButton:Ow,menu:Ew,menuBottom:Sw,menuTop:Nw,menuItem:Tw,highlighted:Rw,selected:Aw,hidden:Pw};function Fw(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function Bu({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:o,style:i,menuPosition:s="bottom"}){const[a,l]=y.useState(e),u=y.useRef(null);y.useEffect(()=>l(e),[e]);const d=y.useCallback(R=>{(R==null?void 0:R.length)>0?l(e.filter(Fw(R))):l(e)},[e]),{isOpen:f,getToggleButtonProps:h,getMenuProps:m,getInputProps:b,highlightedIndex:v,getItemProps:p,setInputValue:x,selectedItem:g}=ia({items:a,selectedItem:t?e.find(R=>R.value===t):null,itemToString:R=>(R==null?void 0:R.label)||"",onInputValueChange:({inputValue:R})=>d(R),onSelectedItemChange:({selectedItem:R})=>{var T;n(R),(T=u.current)==null||T.blur()}}),w=()=>{x(""),l(e)},_=()=>w(),C=y.useMemo(()=>{var R;return(R=e.find(T=>T.value===t))==null?void 0:R.label},[e,t]),N=()=>{t&&C&&t!==(g==null?void 0:g.value)&&x(C||"")};return c.jsxs("div",{style:{position:"relative",...i},children:[c.jsx("div",{className:$t.comboboxContainer,children:c.jsxs("div",{className:$t.inputContainer,children:[c.jsx("input",{style:{border:"none"},disabled:o,placeholder:r,className:$t.input,...b({onFocus:_,onBlur:N,ref:u})}),c.jsx("button",{style:{border:"none"},disabled:o,"aria-label":"toggle menu",className:$t.toggleButton,type:"button",...h(),children:f?c.jsx(c.Fragment,{children:"↑"}):c.jsx(c.Fragment,{children:"↓"})})]})}),c.jsx("ul",{className:`${$t.menu} ${f&&e.length?"":$t.hidden} ${s==="top"?$t.menuTop:$t.menuBottom}`,...m(),children:f&&a.map((R,T)=>c.jsx("li",{className:`${$t.menuItem} ${v===T?$t.highlighted:""} ${t===(R==null?void 0:R.value)?$t.selected:""}`,...p({item:R,index:T}),children:c.jsx("span",{children:R.label})},R.id))})]})}const Kr=Math.min,ar=Math.max,io=Math.round,$i=Math.floor,Un=e=>({x:e,y:e}),Dw={left:"right",right:"left",bottom:"top",top:"bottom"},Mw={start:"end",end:"start"};function ws(e,t,n){return ar(e,Kr(t,n))}function Ii(e,t){return typeof e=="function"?e(t):e}function fr(e){return e.split("-")[0]}function bi(e){return e.split("-")[1]}function Ju(e){return e==="x"?"y":"x"}function oa(e){return e==="y"?"height":"width"}function Vr(e){return["top","bottom"].includes(fr(e))?"y":"x"}function sa(e){return Ju(Vr(e))}function kw(e,t,n){n===void 0&&(n=!1);const r=bi(e),o=sa(e),i=oa(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 jw(e){const t=oo(e);return[Is(e),t,Is(t)]}function Is(e){return e.replace(/start|end/g,t=>Mw[t])}function Lw(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 Kw(e,t,n,r){const o=bi(e);let i=Lw(fr(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(Is)))),i}function oo(e){return e.replace(/left|right|bottom|top/g,t=>Dw[t])}function Vw(e){return{top:0,right:0,bottom:0,left:0,...e}}function Wu(e){return typeof e!="number"?Vw(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 mc(e,t,n){let{reference:r,floating:o}=e;const i=Vr(t),s=sa(t),a=oa(s),l=fr(t),u=i==="y",d=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,h=r[a]/2-o[a]/2;let m;switch(l){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(bi(t)){case"start":m[s]-=h*(n&&u?-1:1);break;case"end":m[s]+=h*(n&&u?-1:1);break}return m}const Uw=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let u=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:f}=mc(u,r,l),h=r,m={},b=0;for(let v=0;v<a.length;v++){const{name:p,fn:x}=a[v],{x:g,y:w,data:_,reset:C}=await x({x:d,y:f,initialPlacement:r,placement:h,strategy:o,middlewareData:m,rects:u,platform:s,elements:{reference:e,floating:t}});d=g??d,f=w??f,m={...m,[p]:{...m[p],..._}},C&&b<=50&&(b++,typeof C=="object"&&(C.placement&&(h=C.placement),C.rects&&(u=C.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:d,y:f}=mc(u,h,l)),v=-1)}return{x:d,y:f,placement:h,strategy:o,middlewareData:m}};async function zu(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:h=!1,padding:m=0}=Ii(t,e),b=Wu(m),p=a[h?f==="floating"?"reference":"floating":f],x=so(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(p)))==null||n?p:p.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:u,rootBoundary:d,strategy:l})),g=f==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),_=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},C=so(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:g,offsetParent:w,strategy:l}):g);return{top:(x.top-C.top+b.top)/_.y,bottom:(C.bottom-x.bottom+b.bottom)/_.y,left:(x.left-C.left+b.left)/_.x,right:(C.right-x.right+b.right)/_.x}}const $w=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:l}=t,{element:u,padding:d=0}=Ii(e,t)||{};if(u==null)return{};const f=Wu(d),h={x:n,y:r},m=sa(o),b=oa(m),v=await s.getDimensions(u),p=m==="y",x=p?"top":"left",g=p?"bottom":"right",w=p?"clientHeight":"clientWidth",_=i.reference[b]+i.reference[m]-h[m]-i.floating[b],C=h[m]-i.reference[m],N=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let R=N?N[w]:0;(!R||!await(s.isElement==null?void 0:s.isElement(N)))&&(R=a.floating[w]||i.floating[b]);const T=_/2-C/2,F=R/2-v[b]/2-1,U=Kr(f[x],F),Q=Kr(f[g],F),J=U,Y=R-v[b]-Q,B=R/2-v[b]/2+T,ce=ws(J,B,Y),se=!l.arrow&&bi(o)!=null&&B!==ce&&i.reference[b]/2-(B<J?U:Q)-v[b]/2<0,ne=se?B<J?B-J:B-Y:0;return{[m]:h[m]+ne,data:{[m]:ce,centerOffset:B-ce-ne,...se&&{alignmentOffset:ne}},reset:se}}}),qw=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:v=!0,...p}=Ii(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const x=fr(o),g=Vr(a),w=fr(a)===a,_=await(l.isRTL==null?void 0:l.isRTL(u.floating)),C=h||(w||!v?[oo(a)]:jw(a)),N=b!=="none";!h&&N&&C.push(...Kw(a,v,b,_));const R=[a,...C],T=await zu(t,p),F=[];let U=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&F.push(T[x]),f){const B=kw(o,s,_);F.push(T[B[0]],T[B[1]])}if(U=[...U,{placement:o,overflows:F}],!F.every(B=>B<=0)){var Q,J;const B=(((Q=i.flip)==null?void 0:Q.index)||0)+1,ce=R[B];if(ce)return{data:{index:B,overflows:U},reset:{placement:ce}};let se=(J=U.filter(ne=>ne.overflows[0]<=0).sort((ne,ge)=>ne.overflows[1]-ge.overflows[1])[0])==null?void 0:J.placement;if(!se)switch(m){case"bestFit":{var Y;const ne=(Y=U.filter(ge=>{if(N){const we=Vr(ge.placement);return we===g||we==="y"}return!0}).map(ge=>[ge.placement,ge.overflows.filter(we=>we>0).reduce((we,A)=>we+A,0)]).sort((ge,we)=>ge[1]-we[1])[0])==null?void 0:Y[0];ne&&(se=ne);break}case"initialPlacement":se=a;break}if(o!==se)return{reset:{placement:se}}}return{}}}};async function Hw(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=fr(n),a=bi(n),l=Vr(n)==="y",u=["left","top"].includes(s)?-1:1,d=i&&l?-1:1,f=Ii(t,e);let{mainAxis:h,crossAxis:m,alignmentAxis:b}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof b=="number"&&(m=a==="end"?b*-1:b),l?{x:m*d,y:h*u}:{x:h*u,y:m*d}}const Bw=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,l=await Hw(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},Jw=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:p=>{let{x,y:g}=p;return{x,y:g}}},...l}=Ii(e,t),u={x:n,y:r},d=await zu(t,l),f=Vr(fr(o)),h=Ju(f);let m=u[h],b=u[f];if(i){const p=h==="y"?"top":"left",x=h==="y"?"bottom":"right",g=m+d[p],w=m-d[x];m=ws(g,m,w)}if(s){const p=f==="y"?"top":"left",x=f==="y"?"bottom":"right",g=b+d[p],w=b-d[x];b=ws(g,b,w)}const v=a.fn({...t,[h]:m,[f]:b});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[h]:i,[f]:s}}}}}};function ho(){return typeof window<"u"}function Xr(e){return Gu(e)?(e.nodeName||"").toLowerCase():"#document"}function _t(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function rn(e){var t;return(t=(Gu(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Gu(e){return ho()?e instanceof Node||e instanceof _t(e).Node:!1}function zt(e){return ho()?e instanceof Element||e instanceof _t(e).Element:!1}function nn(e){return ho()?e instanceof HTMLElement||e instanceof _t(e).HTMLElement:!1}function gc(e){return!ho()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof _t(e).ShadowRoot}function _i(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Gt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function Ww(e){return["table","td","th"].includes(Xr(e))}function mo(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function aa(e){const t=ca(),n=zt(e)?Gt(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function zw(e){let t=$n(e);for(;nn(t)&&!Ur(t);){if(aa(t))return t;if(mo(t))return null;t=$n(t)}return null}function ca(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ur(e){return["html","body","#document"].includes(Xr(e))}function Gt(e){return _t(e).getComputedStyle(e)}function go(e){return zt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function $n(e){if(Xr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||gc(e)&&e.host||rn(e);return gc(t)?t.host:t}function Qu(e){const t=$n(e);return Ur(t)?e.ownerDocument?e.ownerDocument.body:e.body:nn(t)&&_i(t)?t:Qu(t)}function li(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Qu(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=_t(o);if(i){const a=bs(s);return t.concat(s,s.visualViewport||[],_i(o)?o:[],a&&n?li(a):[])}return t.concat(o,li(o,[],n))}function bs(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Xu(e){const t=Gt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=nn(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 la(e){return zt(e)?e:e.contextElement}function _r(e){const t=la(e);if(!nn(t))return Un(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Xu(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 Gw=Un(0);function Yu(e){const t=_t(e);return!ca()||!t.visualViewport?Gw:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Qw(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==_t(e)?!1:t}function pr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=la(e);let s=Un(1);t&&(r?zt(r)&&(s=_r(r)):s=_r(e));const a=Qw(i,n,r)?Yu(i):Un(0);let l=(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 h=_t(i),m=r&&zt(r)?_t(r):r;let b=h,v=bs(b);for(;v&&r&&m!==b;){const p=_r(v),x=v.getBoundingClientRect(),g=Gt(v),w=x.left+(v.clientLeft+parseFloat(g.paddingLeft))*p.x,_=x.top+(v.clientTop+parseFloat(g.paddingTop))*p.y;l*=p.x,u*=p.y,d*=p.x,f*=p.y,l+=w,u+=_,b=_t(v),v=bs(b)}}return so({width:d,height:f,x:l,y:u})}function Xw(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=rn(r),a=t?mo(t.floating):!1;if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},u=Un(1);const d=Un(0),f=nn(r);if((f||!f&&!i)&&((Xr(r)!=="body"||_i(s))&&(l=go(r)),nn(r))){const h=pr(r);u=_r(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x,y:n.y*u.y-l.scrollTop*u.y+d.y}}function Yw(e){return Array.from(e.getClientRects())}function _s(e,t){const n=go(e).scrollLeft;return t?t.left+n:pr(rn(e)).left+n}function Zw(e){const t=rn(e),n=go(e),r=e.ownerDocument.body,o=ar(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=ar(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+_s(e);const a=-n.scrollTop;return Gt(r).direction==="rtl"&&(s+=ar(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function eI(e,t){const n=_t(e),r=rn(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const u=ca();(!u||u&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a,y:l}}function tI(e,t){const n=pr(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=nn(e)?_r(e):Un(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=o*i.x,u=r*i.y;return{width:s,height:a,x:l,y:u}}function yc(e,t,n){let r;if(t==="viewport")r=eI(e,n);else if(t==="document")r=Zw(rn(e));else if(zt(t))r=tI(t,n);else{const o=Yu(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return so(r)}function Zu(e,t){const n=$n(e);return n===t||!zt(n)||Ur(n)?!1:Gt(n).position==="fixed"||Zu(n,t)}function nI(e,t){const n=t.get(e);if(n)return n;let r=li(e,[],!1).filter(a=>zt(a)&&Xr(a)!=="body"),o=null;const i=Gt(e).position==="fixed";let s=i?$n(e):e;for(;zt(s)&&!Ur(s);){const a=Gt(s),l=aa(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||_i(s)&&!l&&Zu(e,s))?r=r.filter(d=>d!==s):o=a,s=$n(s)}return t.set(e,r),r}function rI(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?mo(t)?[]:nI(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((u,d)=>{const f=yc(t,d,o);return u.top=ar(f.top,u.top),u.right=Kr(f.right,u.right),u.bottom=Kr(f.bottom,u.bottom),u.left=ar(f.left,u.left),u},yc(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function iI(e){const{width:t,height:n}=Xu(e);return{width:t,height:n}}function oI(e,t,n){const r=nn(t),o=rn(t),i=n==="fixed",s=pr(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=Un(0);if(r||!r&&!i)if((Xr(t)!=="body"||_i(o))&&(a=go(t)),r){const m=pr(t,!0,i,t);l.x=m.x+t.clientLeft,l.y=m.y+t.clientTop}else o&&(l.x=_s(o));let u=0,d=0;if(o&&!r&&!i){const m=o.getBoundingClientRect();d=m.top+a.scrollTop,u=m.left+a.scrollLeft-_s(o,m)}const f=s.left+a.scrollLeft-l.x-u,h=s.top+a.scrollTop-l.y-d;return{x:f,y:h,width:s.width,height:s.height}}function qo(e){return Gt(e).position==="static"}function vc(e,t){if(!nn(e)||Gt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return rn(e)===n&&(n=n.ownerDocument.body),n}function ed(e,t){const n=_t(e);if(mo(e))return n;if(!nn(e)){let o=$n(e);for(;o&&!Ur(o);){if(zt(o)&&!qo(o))return o;o=$n(o)}return n}let r=vc(e,t);for(;r&&Ww(r)&&qo(r);)r=vc(r,t);return r&&Ur(r)&&qo(r)&&!aa(r)?n:r||zw(e)||n}const sI=async function(e){const t=this.getOffsetParent||ed,n=this.getDimensions,r=await n(e.floating);return{reference:oI(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function aI(e){return Gt(e).direction==="rtl"}const cI={convertOffsetParentRelativeRectToViewportRelativeRect:Xw,getDocumentElement:rn,getClippingRect:rI,getOffsetParent:ed,getElementRects:sI,getClientRects:Yw,getDimensions:iI,getScale:_r,isElement:zt,isRTL:aI};function lI(e,t){let n=null,r;const o=rn(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const{left:u,top:d,width:f,height:h}=e.getBoundingClientRect();if(a||t(),!f||!h)return;const m=$i(d),b=$i(o.clientWidth-(u+f)),v=$i(o.clientHeight-(d+h)),p=$i(u),g={rootMargin:-m+"px "+-b+"px "+-v+"px "+-p+"px",threshold:ar(0,Kr(1,l))||1};let w=!0;function _(C){const N=C[0].intersectionRatio;if(N!==l){if(!w)return s();N?s(!1,N):r=setTimeout(()=>{s(!1,1e-7)},1e3)}w=!1}try{n=new IntersectionObserver(_,{...g,root:o.ownerDocument})}catch{n=new IntersectionObserver(_,g)}n.observe(e)}return s(!0),i}function uI(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=la(e),d=o||i?[...u?li(u):[],...li(t)]:[];d.forEach(x=>{o&&x.addEventListener("scroll",n,{passive:!0}),i&&x.addEventListener("resize",n)});const f=u&&a?lI(u,n):null;let h=-1,m=null;s&&(m=new ResizeObserver(x=>{let[g]=x;g&&g.target===u&&m&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=m)==null||w.observe(t)})),n()}),u&&!l&&m.observe(u),m.observe(t));let b,v=l?pr(e):null;l&&p();function p(){const x=pr(e);v&&(x.x!==v.x||x.y!==v.y||x.width!==v.width||x.height!==v.height)&&n(),v=x,b=requestAnimationFrame(p)}return n(),()=>{var x;d.forEach(g=>{o&&g.removeEventListener("scroll",n),i&&g.removeEventListener("resize",n)}),f==null||f(),(x=m)==null||x.disconnect(),m=null,l&&cancelAnimationFrame(b)}}const dI=Bw,fI=Jw,pI=qw,hI=$w,wc=(e,t,n)=>{const r=new Map,o={platform:cI,...n},i={...o.platform,_c:r};return Uw(e,t,{...o,platform:i})};/*
|
|
45
|
+
*/var sc;function Dv(){return sc||(sc=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"),h=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),b=!1,w=!1,p=!1,_=!1,g=!1,y;y=Symbol.for("react.module.reference");function I(H){return!!(typeof H=="string"||typeof H=="function"||H===n||H===o||g||H===r||H===u||H===d||_||H===m||b||w||p||typeof H=="object"&&H!==null&&(H.$$typeof===h||H.$$typeof===f||H.$$typeof===i||H.$$typeof===s||H.$$typeof===c||H.$$typeof===y||H.getModuleId!==void 0))}function C(H){if(typeof H=="object"&&H!==null){var Ee=H.$$typeof;switch(Ee){case e:var Ve=H.type;switch(Ve){case n:case o:case r:case u:case d:return Ve;default:var Ye=Ve&&Ve.$$typeof;switch(Ye){case a:case s:case c:case h:case f:case i:return Ye;default:return Ee}}case t:return Ee}}}var S=s,T=i,R=e,F=c,U=n,Q=h,J=f,Y=t,B=o,ce=r,se=u,ne=d,ge=!1,we=!1;function A(H){return ge||(ge=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function j(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 C(H)===s}function K(H){return C(H)===i}function L(H){return typeof H=="object"&&H!==null&&H.$$typeof===e}function D(H){return C(H)===c}function Z(H){return C(H)===n}function ee(H){return C(H)===h}function q(H){return C(H)===f}function te(H){return C(H)===t}function G(H){return C(H)===o}function de(H){return C(H)===r}function M(H){return C(H)===u}function ve(H){return C(H)===d}Ce.ContextConsumer=S,Ce.ContextProvider=T,Ce.Element=R,Ce.ForwardRef=F,Ce.Fragment=U,Ce.Lazy=Q,Ce.Memo=J,Ce.Portal=Y,Ce.Profiler=B,Ce.StrictMode=ce,Ce.Suspense=se,Ce.SuspenseList=ne,Ce.isAsyncMode=A,Ce.isConcurrentMode=j,Ce.isContextConsumer=$,Ce.isContextProvider=K,Ce.isElement=L,Ce.isForwardRef=D,Ce.isFragment=Z,Ce.isLazy=ee,Ce.isMemo=q,Ce.isPortal=te,Ce.isProfiler=G,Ce.isStrictMode=de,Ce.isSuspense=M,Ce.isSuspenseList=ve,Ce.isValidElementType=I,Ce.typeOf=C}()),Ce}process.env.NODE_ENV==="production"?ms.exports=Fv():ms.exports=Dv();var ac=ms.exports;const cc=e=>typeof e=="object"&&e!=null&&e.nodeType===1,lc=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",$o=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return lc(n.overflowY,t)||lc(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},Vi=(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,Mv=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},kv=(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:se=>se!==u;if(!cc(e))throw new TypeError("Invalid target");const h=document.scrollingElement||document.documentElement,m=[];let b=e;for(;cc(b)&&f(b);){if(b=Mv(b),b===h){m.push(b);break}b!=null&&b===document.body&&$o(b)&&!$o(document.documentElement)||b!=null&&$o(b,d)&&m.push(b)}const w=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,p=(i=(o=window.visualViewport)==null?void 0:o.height)!=null?i:innerHeight,{scrollX:_,scrollY:g}=window,{height:y,width:I,top:C,right:S,bottom:T,left:R}=e.getBoundingClientRect(),{top:F,right:U,bottom:Q,left:J}=(se=>{const ne=window.getComputedStyle(se);return{top:parseFloat(ne.scrollMarginTop)||0,right:parseFloat(ne.scrollMarginRight)||0,bottom:parseFloat(ne.scrollMarginBottom)||0,left:parseFloat(ne.scrollMarginLeft)||0}})(e);let Y=a==="start"||a==="nearest"?C-F:a==="end"?T+Q:C+y/2-F+Q,B=c==="center"?R+I/2-J+U:c==="end"?S+U:R-J;const ce=[];for(let se=0;se<m.length;se++){const ne=m[se],{height:ge,width:we,top:A,right:j,bottom:$,left:K}=ne.getBoundingClientRect();if(s==="if-needed"&&C>=0&&R>=0&&T<=p&&S<=w&&C>=A&&T<=$&&R>=K&&S<=j)return ce;const L=getComputedStyle(ne),D=parseInt(L.borderLeftWidth,10),Z=parseInt(L.borderTopWidth,10),ee=parseInt(L.borderRightWidth,10),q=parseInt(L.borderBottomWidth,10);let te=0,G=0;const de="offsetWidth"in ne?ne.offsetWidth-ne.clientWidth-D-ee:0,M="offsetHeight"in ne?ne.offsetHeight-ne.clientHeight-Z-q:0,ve="offsetWidth"in ne?ne.offsetWidth===0?0:we/ne.offsetWidth:0,H="offsetHeight"in ne?ne.offsetHeight===0?0:ge/ne.offsetHeight:0;if(h===ne)te=a==="start"?Y:a==="end"?Y-p:a==="nearest"?Vi(g,g+p,p,Z,q,g+Y,g+Y+y,y):Y-p/2,G=c==="start"?B:c==="center"?B-w/2:c==="end"?B-w:Vi(_,_+w,w,D,ee,_+B,_+B+I,I),te=Math.max(0,te+g),G=Math.max(0,G+_);else{te=a==="start"?Y-A-Z:a==="end"?Y-$+q+M:a==="nearest"?Vi(A,$,ge,Z,q+M,Y,Y+y,y):Y-(A+ge/2)+M/2,G=c==="start"?B-K-D:c==="center"?B-(K+we/2)+de/2:c==="end"?B-j+ee+de:Vi(K,j,we,D,ee+de,B,B+I,I);const{scrollLeft:Ee,scrollTop:Ve}=ne;te=H===0?0:Math.max(0,Math.min(Ve+te/H,ne.scrollHeight-ge/H+M)),G=ve===0?0:Math.max(0,Math.min(Ee+G/ve,ne.scrollWidth-we/ve+de)),Y+=Ve-te,B+=Ee-G}ce.push({el:ne,top:te,left:G})}return ce};var jr=function(){return jr=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},jr.apply(this,arguments)};var jv=0;function uc(e){return typeof e=="function"?e:xt}function xt(){}function uu(e,t){if(e){var n=kv(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 dc(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 Be(){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 br(){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 du(){return String(jv++)}function Lv(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 fc(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function fu(e){return typeof e.type=="string"}function pu(e){return e.props}function Kv(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var Vv=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function Ui(e){e===void 0&&(e={});var t={};return Vv.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 gs(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function Uv(e){return Object.prototype.toString.call(e)==="[object Object]"}function Yn(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=Lr(a,t<0,n,r,o);return c===-1?e>=i?-1:e:c}function Lr(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?Lr(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&&(dc(o,e,n)||r&&dc(o,n.document.activeElement,n))})}var Hs=xt;process.env.NODE_ENV!=="production"&&(Hs=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 $v=qs(function(e){hu(e).textContent=""},500);function hu(e){var t=e.getElementById("a11y-status-message");return t||(t=e.createElement("div"),t.setAttribute("id","a11y-status-message"),t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-relevant","additions text"),Object.assign(t.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),e.body.appendChild(t),t)}function mu(e,t){if(!(!e||!t)){var n=hu(t);n.textContent=e,$v(t)}}function qv(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var gu=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,yu=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,vu=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,Ji=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,Wi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,wu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,Iu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,bu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,xu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,_u=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,Cu=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,Ou=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,Eu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,ys=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,Su=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,Nu=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,Tu=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,Hv=Object.freeze({__proto__:null,blurButton:Su,blurInput:Cu,changeInput:Ou,clickButton:ys,clickItem:_u,controlledPropUpdatedSelectedItem:Nu,itemMouseEnter:vu,keyDownArrowDown:Wi,keyDownArrowUp:Ji,keyDownEnd:xu,keyDownEnter:Iu,keyDownEscape:wu,keyDownHome:bu,keyDownSpaceButton:Eu,mouseUp:yu,touchEnd:Tu,unknown:gu}),Bv=["refKey","ref"],Jv=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],Wv=["onKeyDown","onBlur","onChange","onInput","onChangeText"],zv=["refKey","ref"],Gv=["onMouseMove","onMouseDown","onClick","onPress","index","item"],Qv=function(){var e=function(t){function n(o){var i;i=t.call(this,o)||this,i.id=i.props.id||"downshift-"+du(),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(g){return i.id+"-item-"+g},i.items=[],i.itemCount=null,i.previousResultCount=0,i.timeoutIds=[],i.internalSetTimeout=function(g,y){var I=setTimeout(function(){i.timeoutIds=i.timeoutIds.filter(function(C){return C!==I}),g()},y);i.timeoutIds.push(I)},i.setItemCount=function(g){i.itemCount=g},i.unsetItemCount=function(){i.itemCount=null},i.isItemDisabled=function(g,y){var I=i.getItemNodeFromIndex(y);return I&&I.hasAttribute("disabled")},i.setHighlightedIndex=function(g,y){g===void 0&&(g=i.props.defaultHighlightedIndex),y===void 0&&(y={}),y=Ui(y),i.internalSetState(he({highlightedIndex:g},y))},i.clearSelection=function(g){i.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:i.props.defaultHighlightedIndex,isOpen:i.props.defaultIsOpen},g)},i.selectItem=function(g,y,I){y=Ui(y),i.internalSetState(he({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,selectedItem:g,inputValue:i.props.itemToString(g)},y),I)},i.selectItemAtIndex=function(g,y,I){var C=i.items[g];C!=null&&i.selectItem(C,y,I)},i.selectHighlightedItem=function(g,y){return i.selectItemAtIndex(i.getState().highlightedIndex,g,y)},i.internalSetState=function(g,y){var I,C,S={},T=typeof g=="function";return!T&&g.hasOwnProperty("inputValue")&&i.props.onInputValueChange(g.inputValue,he({},i.getStateAndHelpers(),g)),i.setState(function(R){var F;R=i.getState(R);var U=T?g(R):g;U=i.props.stateReducer(R,U),I=U.hasOwnProperty("selectedItem");var Q={};return I&&U.selectedItem!==R.selectedItem&&(C=U.selectedItem),(F=U).type||(F.type=gu),Object.keys(U).forEach(function(J){R[J]!==U[J]&&(S[J]=U[J]),J!=="type"&&(U[J],to(i.props,J)||(Q[J]=U[J]))}),T&&U.hasOwnProperty("inputValue")&&i.props.onInputValueChange(U.inputValue,he({},i.getStateAndHelpers(),U)),Q},function(){uc(y)();var R=Object.keys(S).length>1;R&&i.props.onStateChange(S,i.getStateAndHelpers()),I&&i.props.onSelect(g.selectedItem,i.getStateAndHelpers()),C!==void 0&&i.props.onChange(C,i.getStateAndHelpers()),i.props.onUserAction(S,i.getStateAndHelpers())})},i.rootRef=function(g){return i._rootNode=g},i.getRootProps=function(g,y){var I,C=g===void 0?{}:g,S=C.refKey,T=S===void 0?"ref":S,R=C.ref,F=mn(C,Bv),U=y===void 0?{}:y,Q=U.suppressRefError,J=Q===void 0?!1:Q;i.getRootProps.called=!0,i.getRootProps.refKey=T,i.getRootProps.suppressRefError=J;var Y=i.getState(),B=Y.isOpen;return he((I={},I[T]=br(R,i.rootRef),I.role="combobox",I["aria-expanded"]=B,I["aria-haspopup"]="listbox",I["aria-owns"]=B?i.menuId:void 0,I["aria-labelledby"]=i.labelId,I),F)},i.keyDownHandlers={ArrowDown:function(y){var I=this;if(y.preventDefault(),this.getState().isOpen){var C=y.shiftKey?5:1;this.moveHighlightedIndex(C,{type:Wi})}else this.internalSetState({isOpen:!0,type:Wi},function(){var S=I.getItemCount();if(S>0){var T=I.getState(),R=T.highlightedIndex,F=Yn(R,1,{length:S},I.isItemDisabled,!0);I.setHighlightedIndex(F,{type:Wi})}})},ArrowUp:function(y){var I=this;if(y.preventDefault(),this.getState().isOpen){var C=y.shiftKey?-5:-1;this.moveHighlightedIndex(C,{type:Ji})}else this.internalSetState({isOpen:!0,type:Ji},function(){var S=I.getItemCount();if(S>0){var T=I.getState(),R=T.highlightedIndex,F=Yn(R,-1,{length:S},I.isItemDisabled,!0);I.setHighlightedIndex(F,{type:Ji})}})},Enter:function(y){if(y.which!==229){var I=this.getState(),C=I.isOpen,S=I.highlightedIndex;if(C&&S!=null){y.preventDefault();var T=this.items[S],R=this.getItemNodeFromIndex(S);if(T==null||R&&R.hasAttribute("disabled"))return;this.selectHighlightedItem({type:Iu})}}},Escape:function(y){y.preventDefault(),this.reset(he({type:wu},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},i.buttonKeyDownHandlers=he({},i.keyDownHandlers,{" ":function(y){y.preventDefault(),this.toggleMenu({type:Eu})}}),i.inputKeyDownHandlers=he({},i.keyDownHandlers,{Home:function(y){var I=this.getState(),C=I.isOpen;if(C){y.preventDefault();var S=this.getItemCount();if(!(S<=0||!C)){var T=Lr(0,!1,{length:S},this.isItemDisabled);this.setHighlightedIndex(T,{type:bu})}}},End:function(y){var I=this.getState(),C=I.isOpen;if(C){y.preventDefault();var S=this.getItemCount();if(!(S<=0||!C)){var T=Lr(S-1,!0,{length:S},this.isItemDisabled);this.setHighlightedIndex(T,{type:xu})}}}}),i.getToggleButtonProps=function(g){var y=g===void 0?{}:g,I=y.onClick;y.onPress;var C=y.onKeyDown,S=y.onKeyUp,T=y.onBlur,R=mn(y,Jv),F=i.getState(),U=F.isOpen,Q={onClick:Be(I,i.buttonHandleClick),onKeyDown:Be(C,i.buttonHandleKeyDown),onKeyUp:Be(S,i.buttonHandleKeyUp),onBlur:Be(T,i.buttonHandleBlur)},J=R.disabled?{}:Q;return he({type:"button",role:"button","aria-label":U?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},J,R)},i.buttonHandleKeyUp=function(g){g.preventDefault()},i.buttonHandleKeyDown=function(g){var y=gs(g);i.buttonKeyDownHandlers[y]&&i.buttonKeyDownHandlers[y].call(i,g)},i.buttonHandleClick=function(g){if(g.preventDefault(),i.props.environment){var y=i.props.environment.document,I=y.body,C=y.activeElement;I&&I===C&&g.target.focus()}process.env.NODE_ENV==="test"?i.toggleMenu({type:ys}):i.internalSetTimeout(function(){return i.toggleMenu({type:ys})})},i.buttonHandleBlur=function(g){var y=g.target;i.internalSetTimeout(function(){if(!(i.isMouseDown||!i.props.environment)){var I=i.props.environment.document.activeElement;(I==null||I.id!==i.inputId)&&I!==y&&i.reset({type:Su})}})},i.getLabelProps=function(g){return he({htmlFor:i.inputId,id:i.labelId},g)},i.getInputProps=function(g){var y=g===void 0?{}:g,I=y.onKeyDown,C=y.onBlur,S=y.onChange,T=y.onInput;y.onChangeText;var R=mn(y,Wv),F,U={};F="onChange";var Q=i.getState(),J=Q.inputValue,Y=Q.isOpen,B=Q.highlightedIndex;if(!R.disabled){var ce;U=(ce={},ce[F]=Be(S,T,i.inputHandleChange),ce.onKeyDown=Be(I,i.inputHandleKeyDown),ce.onBlur=Be(C,i.inputHandleBlur),ce)}return he({"aria-autocomplete":"list","aria-activedescendant":Y&&typeof B=="number"&&B>=0?i.getItemId(B):void 0,"aria-controls":Y?i.menuId:void 0,"aria-labelledby":R&&R["aria-label"]?void 0:i.labelId,autoComplete:"off",value:J,id:i.inputId},U,R)},i.inputHandleKeyDown=function(g){var y=gs(g);y&&i.inputKeyDownHandlers[y]&&i.inputKeyDownHandlers[y].call(i,g)},i.inputHandleChange=function(g){i.internalSetState({type:Ou,isOpen:!0,inputValue:g.target.value,highlightedIndex:i.props.defaultHighlightedIndex})},i.inputHandleBlur=function(){i.internalSetTimeout(function(){var g;if(!(i.isMouseDown||!i.props.environment)){var y=i.props.environment.document.activeElement,I=(y==null||(g=y.dataset)==null?void 0:g.toggle)&&i._rootNode&&i._rootNode.contains(y);I||i.reset({type:Cu})}})},i.menuRef=function(g){i._menuNode=g},i.getMenuProps=function(g,y){var I,C=g===void 0?{}:g,S=C.refKey,T=S===void 0?"ref":S,R=C.ref,F=mn(C,zv),U=y===void 0?{}:y,Q=U.suppressRefError,J=Q===void 0?!1:Q;return i.getMenuProps.called=!0,i.getMenuProps.refKey=T,i.getMenuProps.suppressRefError=J,he((I={},I[T]=br(R,i.menuRef),I.role="listbox",I["aria-labelledby"]=F&&F["aria-label"]?void 0:i.labelId,I.id=i.menuId,I),F)},i.getItemProps=function(g){var y,I=g===void 0?{}:g,C=I.onMouseMove,S=I.onMouseDown,T=I.onClick;I.onPress;var R=I.index,F=I.item,U=F===void 0?process.env.NODE_ENV==="production"?void 0:Kv("getItemProps","item"):F,Q=mn(I,Gv);R===void 0?(i.items.push(U),R=i.items.indexOf(U)):i.items[R]=U;var J="onClick",Y=T,B=(y={onMouseMove:Be(C,function(){R!==i.getState().highlightedIndex&&(i.setHighlightedIndex(R,{type:vu}),i.avoidScrolling=!0,i.internalSetTimeout(function(){return i.avoidScrolling=!1},250))}),onMouseDown:Be(S,function(se){se.preventDefault()})},y[J]=Be(Y,function(){i.selectItemAtIndex(R,{type:_u})}),y),ce=Q.disabled?{onMouseDown:B.onMouseDown}:B;return he({id:i.getItemId(R),role:"option","aria-selected":i.getState().highlightedIndex===R},ce,Q)},i.clearItems=function(){i.items=[]},i.reset=function(g,y){g===void 0&&(g={}),g=Ui(g),i.internalSetState(function(I){var C=I.selectedItem;return he({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,inputValue:i.props.itemToString(C)},g)},y)},i.toggleMenu=function(g,y){g===void 0&&(g={}),g=Ui(g),i.internalSetState(function(I){var C=I.isOpen;return he({isOpen:!C},C&&{highlightedIndex:i.props.defaultHighlightedIndex},g)},function(){var I=i.getState(),C=I.isOpen,S=I.highlightedIndex;C&&i.getItemCount()>0&&typeof S=="number"&&i.setHighlightedIndex(S,g),uc(y)()})},i.openMenu=function(g){i.internalSetState({isOpen:!0},g)},i.closeMenu=function(g){i.internalSetState({isOpen:!1},g)},i.updateStatus=qs(function(){var g;if((g=i.props)!=null&&(g=g.environment)!=null&&g.document){var y=i.getState(),I=i.items[y.highlightedIndex],C=i.getItemCount(),S=i.props.getA11yStatusMessage(he({itemToString:i.props.itemToString,previousResultCount:i.previousResultCount,resultCount:C,highlightedItem:I},y));i.previousResultCount=C,mu(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,h=f===void 0?d:f,m=s.initialInputValue,b=m===void 0?"":m,w=s.initialSelectedItem,p=w===void 0?null:w,_=i.getState({highlightedIndex:u,isOpen:h,inputValue:b,selectedItem:p});return _.selectedItem!=null&&i.props.initialInputValue===void 0&&(_.inputValue=i.props.itemToString(_.selectedItem)),i.state=_,i}_v(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=Yn(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,h=this.getRootProps,m=this.getToggleButtonProps,b=this.getLabelProps,w=this.getMenuProps,p=this.getInputProps,_=this.getItemProps,g=this.openMenu,y=this.closeMenu,I=this.toggleMenu,C=this.selectItem,S=this.selectItemAtIndex,T=this.selectHighlightedItem,R=this.setHighlightedIndex,F=this.clearSelection,U=this.clearItems,Q=this.reset,J=this.setItemCount,Y=this.unsetItemCount,B=this.internalSetState;return{getRootProps:h,getToggleButtonProps:m,getLabelProps:b,getMenuProps:w,getInputProps:p,getItemProps:_,reset:Q,openMenu:g,closeMenu:y,toggleMenu:I,selectItem:C,selectItemAtIndex:S,selectHighlightedItem:T,setHighlightedIndex:R,clearSelection:F,clearItems:U,setItemCount:J,unsetItemCount:Y,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&&pc(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 b=no(m.target,[i._rootNode,i._menuNode],i.props.environment);!b&&i.getState().isOpen&&i.reset({type:yu},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},c=function(){i.isTouchMove=!1},u=function(){i.isTouchMove=!0},d=function(m){var b=no(m.target,[i._rootNode,i._menuNode],i.props.environment,!1);!i.isTouchMove&&!b&&i.getState().isOpen&&i.reset({type:Tu},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,h=c!==d;return f||h},r.componentDidUpdate=function(i,s){process.env.NODE_ENV!=="production"&&(Hs(this.state,i,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&pc(this._menuNode,this.getMenuProps)),to(this.props,"selectedItem")&&this.props.selectedItemChanged(i.selectedItem,this.props.selectedItem)&&this.internalSetState({type:Nu,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=fc(this.props.children,xt);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=fc(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&&Xv(s,this.getRootProps),s;if(fu(s))return v.cloneElement(s,this.getRootProps(pu(s)));if(process.env.NODE_ENV!=="production")throw new Error("downshift: If you return a non-DOM element, you must apply the getRootProps function")},n}(v.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:Lv,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&Uv(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:xt,onInputValueChange:xt,onUserAction:xt,onChange:xt,onSelect:xt,onOuterClick:xt,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:uu},e.stateChangeTypes=Hv,e}();process.env.NODE_ENV!=="production"&&(Qv.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 pc(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 Xv(e,t){var n=t.refKey,r=n!=="ref",o=!fu(e);o&&!r&&!ac.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+'"'),!ac.isForwardRef(e)&&!pu(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Ru={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function Yv(e,t,n){var r=e.props,o=e.type,i={};Object.keys(t).forEach(function(s){Zv(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 Zv(e,t,n,r){var o=t.props,i=t.type,s="on"+Bs(e)+"Change";o[s]&&r[e]!==void 0&&r[e]!==n[e]&&o[s](he({type:i},r))}function ew(e,t){return t.changes}var hc=qs(function(e,t){mu(e,t)},200),tw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?v.useLayoutEffect:v.useEffect,nw="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-"+du():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 rw(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 Bs(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Au(e){var t=v.useRef(e);return t.current=e,t}function iw(e,t,n,r){var o=v.useRef(),i=v.useRef(),s=v.useCallback(function(m,b){i.current=b,m=eo(m,b.props);var w=e(m,b),p=b.props.stateReducer(m,he({},b,{changes:w}));return p},[e]),a=v.useReducer(s,t,n),c=a[0],u=a[1],d=Au(t),f=v.useCallback(function(m){return u(he({props:d.current},m))},[d]),h=i.current;return v.useEffect(function(){var m=eo(o.current,h==null?void 0:h.props),b=h&&o.current&&!r(m,c);b&&Yv(h,m,c),o.current=c},[c,h,r]),[c,f]}var ii={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:ew,scrollIntoView:uu,environment:typeof window>"u"?void 0:window};function Ln(e,t,n){n===void 0&&(n=Ru);var r=e["default"+Bs(t)];return r!==void 0?r:n[t]}function oi(e,t,n){n===void 0&&(n=Ru);var r=e[t];if(r!==void 0)return r;var o=e["initial"+Bs(t)];return o!==void 0?o:Ln(e,t,n)}function ow(e){var t=oi(e,"selectedItem"),n=oi(e,"isOpen"),r=uw(e),o=oi(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 si(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 sw(e,t,n){var r=v.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return v.useEffect(function(){if(!e)return xt;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 Pu=function(){return xt};process.env.NODE_ENV!=="production"&&(Pu=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 aw(e,t,n,r){r===void 0&&(r={});var o=r.document,i=po();v.useEffect(function(){if(!(!e||i||!o)){var s=e(t);hc(s,o)}},n),v.useEffect(function(){return function(){hc.cancel(),qv(o)}},[o])}function cw(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 tw(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(o(t),i))},[t]),a}var Fu=xt;process.env.NODE_ENV!=="production"&&(Fu=function(t){var n=t.props,r=t.state,o=v.useRef(n),i=po();v.useEffect(function(){i||(Hs(r,o.current,n),o.current=n)},[r,n,i])});function mc(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:Ln(e,"isOpen"),highlightedIndex:Ln(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function lw(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function po(){var e=v.useRef(!0);return v.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function vs(e){var t=Ln(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function uw(e){var t=oi(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var zi={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},Du=he({},zi,{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 dw(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:si(o,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:si(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:vs(o),isOpen:Ln(o,"isOpen"),selectedItem:Ln(o,"selectedItem"),inputValue:Ln(o,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return he({},e,i)}jr(jr({},Du),{items:V.array.isRequired,isItemDisabled:V.func});jr(jr({},ii),{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,Ws=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,zs=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,Gs=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,Qs=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,Xs=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,Ys=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,Zs=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,ea=process.env.NODE_ENV!=="production"?"__input_change__":8,ro=process.env.NODE_ENV!=="production"?"__input_blur__":9,ta=process.env.NODE_ENV!=="production"?"__input_click__":10,Mu=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,ku=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,na=process.env.NODE_ENV!=="production"?"__item_click__":13,ju=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,Lu=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,Ku=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,Vu=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,Uu=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,ra=process.env.NODE_ENV!=="production"?"__function_select_item__":19,$u=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,qu=process.env.NODE_ENV!=="production"?"__function_reset__":21,ia=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,Hu=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:ia,FunctionCloseMenu:Vu,FunctionOpenMenu:Ku,FunctionReset:qu,FunctionSelectItem:ra,FunctionSetHighlightedIndex:Uu,FunctionSetInputValue:$u,FunctionToggleMenu:Lu,InputBlur:ro,InputChange:ea,InputClick:ta,InputKeyDownArrowDown:Js,InputKeyDownArrowUp:Ws,InputKeyDownEnd:Qs,InputKeyDownEnter:Zs,InputKeyDownEscape:zs,InputKeyDownHome:Gs,InputKeyDownPageDown:Ys,InputKeyDownPageUp:Xs,ItemClick:na,ItemMouseMove:ku,MenuMouseLeave:Mu,ToggleButtonClick:ju});function fw(e){var t=ow(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 pw=he({},Du,{items:V.array.isRequired,isItemDisabled:V.func,inputValue:V.string,defaultInputValue:V.string,initialInputValue:V.string,inputId:V.string,onInputValueChange:V.func});function hw(e,t,n,r){var o=v.useRef(),i=iw(e,t,n,r),s=i[0],a=i[1],c=po();return v.useEffect(function(){if(to(t,"selectedItem")){if(!c){var u=t.itemToKey(t.selectedItem)!==t.itemToKey(o.current);u&&a({type:ia,inputValue:t.itemToString(t.selectedItem)})}o.current=s.selectedItem===o.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[eo(s,t),a]}var Bu=xt;process.env.NODE_ENV!=="production"&&(Bu=function(t,n){V.checkPropTypes(pw,t,"prop",n.name)});var mw=he({},ii,{isItemDisabled:function(){return!1}});function gw(e,t){var n,r=t.type,o=t.props,i=t.altKey,s;switch(r){case na:s={isOpen:Ln(o,"isOpen"),highlightedIndex:vs(o),selectedItem:o.items[t.index],inputValue:o.itemToString(o.items[t.index])};break;case Js:e.isOpen?s={highlightedIndex:Yn(e.highlightedIndex,1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:i&&e.selectedItem==null?-1:si(o,e,1),isOpen:o.items.length>=0};break;case Ws:e.isOpen?i?s=mc(o,e.highlightedIndex):s={highlightedIndex:Yn(e.highlightedIndex,-1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:si(o,e,-1),isOpen:o.items.length>=0};break;case Zs:s=mc(o,e.highlightedIndex);break;case zs:s=he({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case Xs:s={highlightedIndex:Yn(e.highlightedIndex,-10,o.items,o.isItemDisabled,!0)};break;case Ys:s={highlightedIndex:Yn(e.highlightedIndex,10,o.items,o.isItemDisabled,!0)};break;case Gs:s={highlightedIndex:Lr(0,!1,o.items,o.isItemDisabled)};break;case Qs:s={highlightedIndex:Lr(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 ea:s={isOpen:!0,highlightedIndex:vs(o),inputValue:t.inputValue};break;case ta:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:si(o,e,0)};break;case ra:s={selectedItem:t.selectedItem,inputValue:o.itemToString(t.selectedItem)};break;case ia:s={inputValue:t.inputValue};break;default:return dw(e,t,Hu)}return he({},e,s)}var yw=["onMouseLeave","refKey","ref"],vw=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],ww=["onClick","onPress","refKey","ref"],Iw=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];oa.stateChangeTypes=Hu;function oa(e){e===void 0&&(e={}),Bu(e,oa);var t=he({},mw,e),n=t.items,r=t.scrollIntoView,o=t.environment,i=t.getA11yStatusMessage,s=hw(gw,t,fw,lw),a=s[0],c=s[1],u=a.isOpen,d=a.highlightedIndex,f=a.selectedItem,h=a.inputValue,m=v.useRef(null),b=v.useRef({}),w=v.useRef(null),p=v.useRef(null),_=po(),g=nw(t),y=v.useRef(),I=Au({state:a,props:t}),C=v.useCallback(function($){return b.current[g.getItemId($)]},[g]);aw(i,a,[u,d,f,h],o);var S=cw({menuElement:m.current,highlightedIndex:d,isOpen:u,itemRefs:b,scrollIntoView:r,getItemNodeFromIndex:C});Fu({props:t,state:a}),v.useEffect(function(){var $=oi(t,"isOpen");$&&w.current&&w.current.focus()},[]),v.useEffect(function(){_||(y.current=n.length)});var T=sw(o,v.useCallback(function(){I.current.state.isOpen&&c({type:ro,selectItem:!1})},[c,I]),v.useMemo(function(){return[m,p,w]},[m.current,p.current,w.current])),R=Pu("getInputProps","getMenuProps");v.useEffect(function(){u||(b.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 F=v.useMemo(function(){return{ArrowDown:function(K){K.preventDefault(),c({type:Js,altKey:K.altKey})},ArrowUp:function(K){K.preventDefault(),c({type:Ws,altKey:K.altKey})},Home:function(K){I.current.state.isOpen&&(K.preventDefault(),c({type:Gs}))},End:function(K){I.current.state.isOpen&&(K.preventDefault(),c({type:Qs}))},Escape:function(K){var L=I.current.state;(L.isOpen||L.inputValue||L.selectedItem||L.highlightedIndex>-1)&&(K.preventDefault(),c({type:zs}))},Enter:function(K){var L=I.current.state;!L.isOpen||K.which===229||(K.preventDefault(),c({type:Zs}))},PageUp:function(K){I.current.state.isOpen&&(K.preventDefault(),c({type:Xs}))},PageDown:function(K){I.current.state.isOpen&&(K.preventDefault(),c({type:Ys}))}}},[c,I]),U=v.useCallback(function($){return he({id:g.labelId,htmlFor:g.inputId},$)},[g]),Q=v.useCallback(function($,K){var L,D=$===void 0?{}:$,Z=D.onMouseLeave,ee=D.refKey,q=ee===void 0?"ref":ee,te=D.ref,G=mn(D,yw),de=K===void 0?{}:K,M=de.suppressRefError,ve=M===void 0?!1:M;return R("getMenuProps",ve,q,m),he((L={},L[q]=br(te,function(H){m.current=H}),L.id=g.menuId,L.role="listbox",L["aria-labelledby"]=G&&G["aria-label"]?void 0:""+g.labelId,L.onMouseLeave=Be(Z,function(){c({type:Mu})}),L),G)},[c,R,g]),J=v.useCallback(function($){var K,L,D=$===void 0?{}:$,Z=D.item,ee=D.index,q=D.refKey,te=q===void 0?"ref":q,G=D.ref,de=D.onMouseMove,M=D.onMouseDown,ve=D.onClick;D.onPress;var H=D.disabled,Ee=mn(D,vw);H!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var Ve=I.current,Ye=Ve.props,Ue=Ve.state,Ie=rw(Z,ee,Ye.items,"Pass either item or index to getItemProps!"),Mt=Ie[0],Ze=Ie[1],wt=Ye.isItemDisabled(Mt,Ze),kt="onClick",jt=ve,et=function(){T.isTouchEnd||Ze===Ue.highlightedIndex||(S.current=!1,c({type:ku,index:Ze,disabled:wt}))},Ge=function(){c({type:na,index:Ze})},$e=function(Lt){return Lt.preventDefault()};return he((K={},K[te]=br(G,function(Pe){Pe&&(b.current[g.getItemId(Ze)]=Pe)}),K["aria-disabled"]=wt,K["aria-selected"]=Ze===Ue.highlightedIndex,K.id=g.getItemId(Ze),K.role="option",K),!wt&&(L={},L[kt]=Be(jt,Ge),L),{onMouseMove:Be(de,et),onMouseDown:Be(M,$e)},Ee)},[c,g,I,T,S]),Y=v.useCallback(function($){var K,L=$===void 0?{}:$,D=L.onClick;L.onPress;var Z=L.refKey,ee=Z===void 0?"ref":Z,q=L.ref,te=mn(L,ww),G=I.current.state,de=function(){c({type:ju})};return he((K={},K[ee]=br(q,function(M){p.current=M}),K["aria-controls"]=g.menuId,K["aria-expanded"]=G.isOpen,K.id=g.toggleButtonId,K.tabIndex=-1,K),!te.disabled&&he({},{onClick:Be(D,de)}),te)},[c,I,g]),B=v.useCallback(function($,K){var L,D=$===void 0?{}:$,Z=D.onKeyDown,ee=D.onChange,q=D.onInput,te=D.onBlur;D.onChangeText;var G=D.onClick,de=D.refKey,M=de===void 0?"ref":de,ve=D.ref,H=mn(D,Iw),Ee=K===void 0?{}:K,Ve=Ee.suppressRefError,Ye=Ve===void 0?!1:Ve;R("getInputProps",Ye,M,w);var Ue=I.current.state,Ie=function($e){var Pe=gs($e);Pe&&F[Pe]&&F[Pe]($e)},Mt=function($e){c({type:ea,inputValue:$e.target.value})},Ze=function($e){if(o!=null&&o.document&&Ue.isOpen&&!T.isMouseDown){var Pe=$e.relatedTarget===null&&o.document.activeElement!==o.document.body;c({type:ro,selectItem:!Pe})}},wt=function(){c({type:ta})},kt="onChange",jt={};if(!H.disabled){var et;jt=(et={},et[kt]=Be(ee,q,Mt),et.onKeyDown=Be(Z,Ie),et.onBlur=Be(te,Ze),et.onClick=Be(G,wt),et)}return he((L={},L[M]=br(ve,function(Ge){w.current=Ge}),L["aria-activedescendant"]=Ue.isOpen&&Ue.highlightedIndex>-1?g.getItemId(Ue.highlightedIndex):"",L["aria-autocomplete"]="list",L["aria-controls"]=g.menuId,L["aria-expanded"]=Ue.isOpen,L["aria-labelledby"]=H&&H["aria-label"]?void 0:g.labelId,L.autoComplete="off",L.id=g.inputId,L.role="combobox",L.value=Ue.inputValue,L),jt,H)},[c,g,o,F,I,T,R]),ce=v.useCallback(function(){c({type:Lu})},[c]),se=v.useCallback(function(){c({type:Vu})},[c]),ne=v.useCallback(function(){c({type:Ku})},[c]),ge=v.useCallback(function($){c({type:Uu,highlightedIndex:$})},[c]),we=v.useCallback(function($){c({type:ra,selectedItem:$})},[c]),A=v.useCallback(function($){c({type:$u,inputValue:$})},[c]),j=v.useCallback(function(){c({type:qu})},[c]);return{getItemProps:J,getLabelProps:U,getMenuProps:Q,getInputProps:B,getToggleButtonProps:Y,toggleMenu:ce,openMenu:ne,closeMenu:se,setHighlightedIndex:ge,setInputValue:A,selectItem:we,reset:j,highlightedIndex:d,isOpen:u,selectedItem:f,inputValue:h}}zi.stateReducer,zi.itemToKey,zi.environment,V.array,V.array,V.array,V.func,V.number,V.number,V.number,V.func,V.func,V.string,V.string;ii.itemToKey,ii.stateReducer,ii.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 bw="_comboboxContainer_1lcc8_1",xw="_label_1lcc8_8",_w="_inputContainer_1lcc8_12",Cw="_input_1lcc8_12",Ow="_toggleButton_1lcc8_33",Ew="_menu_1lcc8_39",Sw="_menuBottom_1lcc8_55",Nw="_menuTop_1lcc8_61",Tw="_menuItem_1lcc8_66",Rw="_highlighted_1lcc8_73",Aw="_selected_1lcc8_77",Pw="_hidden_1lcc8_81",$t={comboboxContainer:bw,label:xw,inputContainer:_w,input:Cw,toggleButton:Ow,menu:Ew,menuBottom:Sw,menuTop:Nw,menuItem:Tw,highlighted:Rw,selected:Aw,hidden:Pw};function Fw(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function Ju({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:o,style:i,menuPosition:s="bottom"}){const[a,c]=v.useState(e),u=v.useRef(null);v.useEffect(()=>c(e),[e]);const d=v.useCallback(T=>{(T==null?void 0:T.length)>0?c(e.filter(Fw(T))):c(e)},[e]),{isOpen:f,getToggleButtonProps:h,getMenuProps:m,getInputProps:b,highlightedIndex:w,getItemProps:p,setInputValue:_,selectedItem:g}=oa({items:a,selectedItem:t?e.find(T=>T.value===t):null,itemToString:T=>(T==null?void 0:T.label)||"",onInputValueChange:({inputValue:T})=>d(T),onSelectedItemChange:({selectedItem:T})=>{var R;n(T),(R=u.current)==null||R.blur()}}),y=()=>{_(""),c(e)},I=()=>y(),C=v.useMemo(()=>{var T;return(T=e.find(R=>R.value===t))==null?void 0:T.label},[e,t]),S=()=>{t&&C&&t!==(g==null?void 0:g.value)&&_(C||"")};return l.jsxs("div",{style:{position:"relative",...i},children:[l.jsx("div",{className:$t.comboboxContainer,children:l.jsxs("div",{className:$t.inputContainer,children:[l.jsx("input",{style:{border:"none"},disabled:o,placeholder:r,className:$t.input,...b({onFocus:I,onBlur:S,ref:u})}),l.jsx("button",{style:{border:"none"},disabled:o,"aria-label":"toggle menu",className:$t.toggleButton,type:"button",...h(),children:f?l.jsx(l.Fragment,{children:"↑"}):l.jsx(l.Fragment,{children:"↓"})})]})}),l.jsx("ul",{className:`${$t.menu} ${f&&e.length?"":$t.hidden} ${s==="top"?$t.menuTop:$t.menuBottom}`,...m(),children:f&&a.map((T,R)=>l.jsx("li",{className:`${$t.menuItem} ${w===R?$t.highlighted:""} ${t===(T==null?void 0:T.value)?$t.selected:""}`,...p({item:T,index:R}),children:l.jsx("span",{children:T.label})},T.id))})]})}const Kr=Math.min,ar=Math.max,io=Math.round,$i=Math.floor,Un=e=>({x:e,y:e}),Dw={left:"right",right:"left",bottom:"top",top:"bottom"},Mw={start:"end",end:"start"};function ws(e,t,n){return ar(e,Kr(t,n))}function Ii(e,t){return typeof e=="function"?e(t):e}function pr(e){return e.split("-")[0]}function bi(e){return e.split("-")[1]}function Wu(e){return e==="x"?"y":"x"}function sa(e){return e==="y"?"height":"width"}function Vr(e){return["top","bottom"].includes(pr(e))?"y":"x"}function aa(e){return Wu(Vr(e))}function kw(e,t,n){n===void 0&&(n=!1);const r=bi(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 jw(e){const t=oo(e);return[Is(e),t,Is(t)]}function Is(e){return e.replace(/start|end/g,t=>Mw[t])}function Lw(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 Kw(e,t,n,r){const o=bi(e);let i=Lw(pr(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(Is)))),i}function oo(e){return e.replace(/left|right|bottom|top/g,t=>Dw[t])}function Vw(e){return{top:0,right:0,bottom:0,left:0,...e}}function zu(e){return typeof e!="number"?Vw(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 gc(e,t,n){let{reference:r,floating:o}=e;const i=Vr(t),s=aa(t),a=sa(s),c=pr(t),u=i==="y",d=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,h=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(bi(t)){case"start":m[s]-=h*(n&&u?-1:1);break;case"end":m[s]+=h*(n&&u?-1:1);break}return m}const Uw=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}=gc(u,r,c),h=r,m={},b=0;for(let w=0;w<a.length;w++){const{name:p,fn:_}=a[w],{x:g,y,data:I,reset:C}=await _({x:d,y:f,initialPlacement:r,placement:h,strategy:o,middlewareData:m,rects:u,platform:s,elements:{reference:e,floating:t}});d=g??d,f=y??f,m={...m,[p]:{...m[p],...I}},C&&b<=50&&(b++,typeof C=="object"&&(C.placement&&(h=C.placement),C.rects&&(u=C.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:d,y:f}=gc(u,h,c)),w=-1)}return{x:d,y:f,placement:h,strategy:o,middlewareData:m}};async function Gu(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:h=!1,padding:m=0}=Ii(t,e),b=zu(m),p=a[h?f==="floating"?"reference":"floating":f],_=so(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(p)))==null||n?p:p.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:u,rootBoundary:d,strategy:c})),g=f==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,y=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),I=await(i.isElement==null?void 0:i.isElement(y))?await(i.getScale==null?void 0:i.getScale(y))||{x:1,y:1}:{x:1,y:1},C=so(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:g,offsetParent:y,strategy:c}):g);return{top:(_.top-C.top+b.top)/I.y,bottom:(C.bottom-_.bottom+b.bottom)/I.y,left:(_.left-C.left+b.left)/I.x,right:(C.right-_.right+b.right)/I.x}}const $w=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}=Ii(e,t)||{};if(u==null)return{};const f=zu(d),h={x:n,y:r},m=aa(o),b=sa(m),w=await s.getDimensions(u),p=m==="y",_=p?"top":"left",g=p?"bottom":"right",y=p?"clientHeight":"clientWidth",I=i.reference[b]+i.reference[m]-h[m]-i.floating[b],C=h[m]-i.reference[m],S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let T=S?S[y]:0;(!T||!await(s.isElement==null?void 0:s.isElement(S)))&&(T=a.floating[y]||i.floating[b]);const R=I/2-C/2,F=T/2-w[b]/2-1,U=Kr(f[_],F),Q=Kr(f[g],F),J=U,Y=T-w[b]-Q,B=T/2-w[b]/2+R,ce=ws(J,B,Y),se=!c.arrow&&bi(o)!=null&&B!==ce&&i.reference[b]/2-(B<J?U:Q)-w[b]/2<0,ne=se?B<J?B-J:B-Y:0;return{[m]:h[m]+ne,data:{[m]:ce,centerOffset:B-ce-ne,...se&&{alignmentOffset:ne}},reset:se}}}),qw=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:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:w=!0,...p}=Ii(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const _=pr(o),g=Vr(a),y=pr(a)===a,I=await(c.isRTL==null?void 0:c.isRTL(u.floating)),C=h||(y||!w?[oo(a)]:jw(a)),S=b!=="none";!h&&S&&C.push(...Kw(a,w,b,I));const T=[a,...C],R=await Gu(t,p),F=[];let U=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&F.push(R[_]),f){const B=kw(o,s,I);F.push(R[B[0]],R[B[1]])}if(U=[...U,{placement:o,overflows:F}],!F.every(B=>B<=0)){var Q,J;const B=(((Q=i.flip)==null?void 0:Q.index)||0)+1,ce=T[B];if(ce)return{data:{index:B,overflows:U},reset:{placement:ce}};let se=(J=U.filter(ne=>ne.overflows[0]<=0).sort((ne,ge)=>ne.overflows[1]-ge.overflows[1])[0])==null?void 0:J.placement;if(!se)switch(m){case"bestFit":{var Y;const ne=(Y=U.filter(ge=>{if(S){const we=Vr(ge.placement);return we===g||we==="y"}return!0}).map(ge=>[ge.placement,ge.overflows.filter(we=>we>0).reduce((we,A)=>we+A,0)]).sort((ge,we)=>ge[1]-we[1])[0])==null?void 0:Y[0];ne&&(se=ne);break}case"initialPlacement":se=a;break}if(o!==se)return{reset:{placement:se}}}return{}}}};async function Hw(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=pr(n),a=bi(n),c=Vr(n)==="y",u=["left","top"].includes(s)?-1:1,d=i&&c?-1:1,f=Ii(t,e);let{mainAxis:h,crossAxis:m,alignmentAxis:b}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof b=="number"&&(m=a==="end"?b*-1:b),c?{x:m*d,y:h*u}:{x:h*u,y:m*d}}const Bw=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 Hw(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}}}}},Jw=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:p=>{let{x:_,y:g}=p;return{x:_,y:g}}},...c}=Ii(e,t),u={x:n,y:r},d=await Gu(t,c),f=Vr(pr(o)),h=Wu(f);let m=u[h],b=u[f];if(i){const p=h==="y"?"top":"left",_=h==="y"?"bottom":"right",g=m+d[p],y=m-d[_];m=ws(g,m,y)}if(s){const p=f==="y"?"top":"left",_=f==="y"?"bottom":"right",g=b+d[p],y=b-d[_];b=ws(g,b,y)}const w=a.fn({...t,[h]:m,[f]:b});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[h]:i,[f]:s}}}}}};function ho(){return typeof window<"u"}function Xr(e){return Qu(e)?(e.nodeName||"").toLowerCase():"#document"}function _t(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function on(e){var t;return(t=(Qu(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Qu(e){return ho()?e instanceof Node||e instanceof _t(e).Node:!1}function zt(e){return ho()?e instanceof Element||e instanceof _t(e).Element:!1}function rn(e){return ho()?e instanceof HTMLElement||e instanceof _t(e).HTMLElement:!1}function yc(e){return!ho()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof _t(e).ShadowRoot}function xi(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Gt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function Ww(e){return["table","td","th"].includes(Xr(e))}function mo(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function ca(e){const t=la(),n=zt(e)?Gt(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function zw(e){let t=$n(e);for(;rn(t)&&!Ur(t);){if(ca(t))return t;if(mo(t))return null;t=$n(t)}return null}function la(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ur(e){return["html","body","#document"].includes(Xr(e))}function Gt(e){return _t(e).getComputedStyle(e)}function go(e){return zt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function $n(e){if(Xr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||yc(e)&&e.host||on(e);return yc(t)?t.host:t}function Xu(e){const t=$n(e);return Ur(t)?e.ownerDocument?e.ownerDocument.body:e.body:rn(t)&&xi(t)?t:Xu(t)}function li(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Xu(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=_t(o);if(i){const a=bs(s);return t.concat(s,s.visualViewport||[],xi(o)?o:[],a&&n?li(a):[])}return t.concat(o,li(o,[],n))}function bs(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Yu(e){const t=Gt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=rn(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 zt(e)?e:e.contextElement}function _r(e){const t=ua(e);if(!rn(t))return Un(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Yu(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 Gw=Un(0);function Zu(e){const t=_t(e);return!la()||!t.visualViewport?Gw:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Qw(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==_t(e)?!1:t}function hr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=ua(e);let s=Un(1);t&&(r?zt(r)&&(s=_r(r)):s=_r(e));const a=Qw(i,n,r)?Zu(i):Un(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 h=_t(i),m=r&&zt(r)?_t(r):r;let b=h,w=bs(b);for(;w&&r&&m!==b;){const p=_r(w),_=w.getBoundingClientRect(),g=Gt(w),y=_.left+(w.clientLeft+parseFloat(g.paddingLeft))*p.x,I=_.top+(w.clientTop+parseFloat(g.paddingTop))*p.y;c*=p.x,u*=p.y,d*=p.x,f*=p.y,c+=y,u+=I,b=_t(w),w=bs(b)}}return so({width:d,height:f,x:c,y:u})}function Xw(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=on(r),a=t?mo(t.floating):!1;if(r===s||a&&i)return n;let c={scrollLeft:0,scrollTop:0},u=Un(1);const d=Un(0),f=rn(r);if((f||!f&&!i)&&((Xr(r)!=="body"||xi(s))&&(c=go(r)),rn(r))){const h=hr(r);u=_r(r),d.x=h.x+r.clientLeft,d.y=h.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 Yw(e){return Array.from(e.getClientRects())}function xs(e,t){const n=go(e).scrollLeft;return t?t.left+n:hr(on(e)).left+n}function Zw(e){const t=on(e),n=go(e),r=e.ownerDocument.body,o=ar(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=ar(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+xs(e);const a=-n.scrollTop;return Gt(r).direction==="rtl"&&(s+=ar(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function eI(e,t){const n=_t(e),r=on(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 tI(e,t){const n=hr(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=rn(e)?_r(e):Un(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 vc(e,t,n){let r;if(t==="viewport")r=eI(e,n);else if(t==="document")r=Zw(on(e));else if(zt(t))r=tI(t,n);else{const o=Zu(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return so(r)}function ed(e,t){const n=$n(e);return n===t||!zt(n)||Ur(n)?!1:Gt(n).position==="fixed"||ed(n,t)}function nI(e,t){const n=t.get(e);if(n)return n;let r=li(e,[],!1).filter(a=>zt(a)&&Xr(a)!=="body"),o=null;const i=Gt(e).position==="fixed";let s=i?$n(e):e;for(;zt(s)&&!Ur(s);){const a=Gt(s),c=ca(s);!c&&a.position==="fixed"&&(o=null),(i?!c&&!o:!c&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||xi(s)&&!c&&ed(e,s))?r=r.filter(d=>d!==s):o=a,s=$n(s)}return t.set(e,r),r}function rI(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?mo(t)?[]:nI(t,this._c):[].concat(n),r],a=s[0],c=s.reduce((u,d)=>{const f=vc(t,d,o);return u.top=ar(f.top,u.top),u.right=Kr(f.right,u.right),u.bottom=Kr(f.bottom,u.bottom),u.left=ar(f.left,u.left),u},vc(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function iI(e){const{width:t,height:n}=Yu(e);return{width:t,height:n}}function oI(e,t,n){const r=rn(t),o=on(t),i=n==="fixed",s=hr(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=Un(0);if(r||!r&&!i)if((Xr(t)!=="body"||xi(o))&&(a=go(t)),r){const m=hr(t,!0,i,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}else o&&(c.x=xs(o));let u=0,d=0;if(o&&!r&&!i){const m=o.getBoundingClientRect();d=m.top+a.scrollTop,u=m.left+a.scrollLeft-xs(o,m)}const f=s.left+a.scrollLeft-c.x-u,h=s.top+a.scrollTop-c.y-d;return{x:f,y:h,width:s.width,height:s.height}}function qo(e){return Gt(e).position==="static"}function wc(e,t){if(!rn(e)||Gt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return on(e)===n&&(n=n.ownerDocument.body),n}function td(e,t){const n=_t(e);if(mo(e))return n;if(!rn(e)){let o=$n(e);for(;o&&!Ur(o);){if(zt(o)&&!qo(o))return o;o=$n(o)}return n}let r=wc(e,t);for(;r&&Ww(r)&&qo(r);)r=wc(r,t);return r&&Ur(r)&&qo(r)&&!ca(r)?n:r||zw(e)||n}const sI=async function(e){const t=this.getOffsetParent||td,n=this.getDimensions,r=await n(e.floating);return{reference:oI(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function aI(e){return Gt(e).direction==="rtl"}const cI={convertOffsetParentRelativeRectToViewportRelativeRect:Xw,getDocumentElement:on,getClippingRect:rI,getOffsetParent:td,getElementRects:sI,getClientRects:Yw,getDimensions:iI,getScale:_r,isElement:zt,isRTL:aI};function lI(e,t){let n=null,r;const o=on(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:h}=e.getBoundingClientRect();if(a||t(),!f||!h)return;const m=$i(d),b=$i(o.clientWidth-(u+f)),w=$i(o.clientHeight-(d+h)),p=$i(u),g={rootMargin:-m+"px "+-b+"px "+-w+"px "+-p+"px",threshold:ar(0,Kr(1,c))||1};let y=!0;function I(C){const S=C[0].intersectionRatio;if(S!==c){if(!y)return s();S?s(!1,S):r=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{n=new IntersectionObserver(I,{...g,root:o.ownerDocument})}catch{n=new IntersectionObserver(I,g)}n.observe(e)}return s(!0),i}function uI(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?li(u):[],...li(t)]:[];d.forEach(_=>{o&&_.addEventListener("scroll",n,{passive:!0}),i&&_.addEventListener("resize",n)});const f=u&&a?lI(u,n):null;let h=-1,m=null;s&&(m=new ResizeObserver(_=>{let[g]=_;g&&g.target===u&&m&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var y;(y=m)==null||y.observe(t)})),n()}),u&&!c&&m.observe(u),m.observe(t));let b,w=c?hr(e):null;c&&p();function p(){const _=hr(e);w&&(_.x!==w.x||_.y!==w.y||_.width!==w.width||_.height!==w.height)&&n(),w=_,b=requestAnimationFrame(p)}return n(),()=>{var _;d.forEach(g=>{o&&g.removeEventListener("scroll",n),i&&g.removeEventListener("resize",n)}),f==null||f(),(_=m)==null||_.disconnect(),m=null,c&&cancelAnimationFrame(b)}}const dI=Bw,fI=Jw,pI=qw,hI=$w,Ic=(e,t,n)=>{const r=new Map,o={platform:cI,...n},i={...o.platform,_c:r};return Uw(e,t,{...o,platform:i})};/*
|
|
46
46
|
* React Tooltip
|
|
47
47
|
* {@link https://github.com/ReactTooltip/react-tooltip}
|
|
48
48
|
* @copyright ReactTooltip Team
|
|
49
49
|
* @license MIT
|
|
50
|
-
*/const mI="react-tooltip-core-styles",gI="react-tooltip-base-styles",Ic={core:!1,base:!1};function bc({css:e,id:t=gI,type:n="base",ref:r}){var o,i;if(!e||typeof document>"u"||Ic[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=mI),r||(r={});const{insertAt:s}=r;if(document.getElementById(t))return;const a=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.id=t,l.type="text/css",s==="top"&&a.firstChild?a.insertBefore(l,a.firstChild):a.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e)),Ic[n]=!0}const _c=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10,strategy:i="absolute",middlewares:s=[dI(Number(o)),pI({fallbackAxisSideDirection:"start"}),fI({padding:5})],border:a})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const l=s;return n?(l.push(hI({element:n,padding:5})),wc(e,t,{placement:r,strategy:i,middleware:l}).then(({x:u,y:d,placement:f,middlewareData:h})=>{var m,b;const v={left:`${u}px`,top:`${d}px`,border:a},{x:p,y:x}=(m=h.arrow)!==null&&m!==void 0?m:{x:0,y:0},g=(b={top:"bottom",right:"left",bottom:"top",left:"right"}[f.split("-")[0]])!==null&&b!==void 0?b:"bottom",w=a&&{borderBottom:a,borderRight:a};let _=0;if(a){const C=`${a}`.match(/(\d+)px/);_=C!=null&&C[1]?Number(C[1]):1}return{tooltipStyles:v,tooltipArrowStyles:{left:p!=null?`${p}px`:"",top:x!=null?`${x}px`:"",right:"",bottom:"",...w,[g]:`-${4+_}px`},place:f}})):wc(e,t,{placement:"bottom",strategy:i,middleware:l}).then(({x:u,y:d,placement:f})=>({tooltipStyles:{left:`${u}px`,top:`${d}px`},tooltipArrowStyles:{},place:f}))},xc=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),Cc=(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},Oc=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",xs=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((o,i)=>xs(o,t[i]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Oc(e)||!Oc(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(o=>xs(e[o],t[o]))},yI=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"})},Ec=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(yI(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},vI=typeof window<"u"?y.useLayoutEffect:y.useEffect,Rt=e=>{e.current&&(clearTimeout(e.current),e.current=null)},wI="DEFAULT_TOOLTIP_ID",II={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},bI=y.createContext({getTooltipData:()=>II});function td(e=wI){return y.useContext(bI).getTooltipData(e)}var wr={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"},Ho={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 _I=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:o="dark",anchorId:i,anchorSelect:s,place:a="top",offset:l=10,events:u=["hover"],openOnClick:d=!1,positionStrategy:f="absolute",middlewares:h,wrapper:m,delayShow:b=0,delayHide:v=0,float:p=!1,hidden:x=!1,noArrow:g=!1,clickable:w=!1,closeOnEsc:_=!1,closeOnScroll:C=!1,closeOnResize:N=!1,openEvents:R,closeEvents:T,globalCloseEvents:F,imperativeModeOnly:U,style:Q,position:J,afterShow:Y,afterHide:B,disableTooltip:ce,content:se,contentWrapperRef:ne,isOpen:ge,defaultIsOpen:we=!1,setIsOpen:A,activeAnchor:j,setActiveAnchor:$,border:K,opacity:L,arrowColor:D,role:Z="tooltip"})=>{var ee;const q=y.useRef(null),te=y.useRef(null),G=y.useRef(null),de=y.useRef(null),M=y.useRef(null),[ve,H]=y.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[Ee,Ve]=y.useState(!1),[Ye,Ue]=y.useState(!1),[Ie,Mt]=y.useState(null),Ze=y.useRef(!1),vt=y.useRef(null),{anchorRefs:kt,setActiveAnchor:jt}=td(t),et=y.useRef(!1),[Ge,$e]=y.useState([]),Pe=y.useRef(!1),Lt=d||u.includes("click"),it=Lt||(R==null?void 0:R.click)||(R==null?void 0:R.dblclick)||(R==null?void 0:R.mousedown),on=R?{...R}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!R&&Lt&&Object.assign(on,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const In=T?{...T}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!T&&Lt&&Object.assign(In,{mouseleave:!1,blur:!1,mouseout:!1});const wt=F?{...F}:{escape:_||!1,scroll:C||!1,resize:N||!1,clickOutsideAnchor:it||!1};U&&(Object.assign(on,{mouseenter:!1,focus:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(In,{mouseleave:!1,blur:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(wt,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),vI(()=>(Pe.current=!0,()=>{Pe.current=!1}),[]);const Fe=W=>{Pe.current&&(W&&Ue(!0),setTimeout(()=>{Pe.current&&(A==null||A(W),ge===void 0&&Ve(W))},10))};y.useEffect(()=>{if(ge===void 0)return()=>null;ge&&Ue(!0);const W=setTimeout(()=>{Ve(ge)},10);return()=>{clearTimeout(W)}},[ge]),y.useEffect(()=>{if(Ee!==Ze.current)if(Rt(M),Ze.current=Ee,Ee)Y==null||Y();else{const W=(ae=>{const le=ae.match(/^([\d.]+)(ms|s)$/);if(!le)return 0;const[,Ke,He]=le;return Number(Ke)*(He==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));M.current=setTimeout(()=>{Ue(!1),Mt(null),B==null||B()},W+25)}},[Ee]);const sn=W=>{H(ae=>xs(ae,W)?ae:W)},bn=(W=b)=>{Rt(G),Ye?Fe(!0):G.current=setTimeout(()=>{Fe(!0)},W)},an=(W=v)=>{Rt(de),de.current=setTimeout(()=>{et.current||Fe(!1)},W)},Hn=W=>{var ae;if(!W)return;const le=(ae=W.currentTarget)!==null&&ae!==void 0?ae:W.target;if(!(le!=null&&le.isConnected))return $(null),void jt({current:null});b?bn():Fe(!0),$(le),jt({current:le}),Rt(de)},ft=()=>{w?an(v||100):v?an():Fe(!1),Rt(G)},cn=({x:W,y:ae})=>{var le;const Ke={getBoundingClientRect:()=>({x:W,y:ae,width:0,height:0,top:ae,left:W,right:W,bottom:ae})};_c({place:(le=Ie==null?void 0:Ie.place)!==null&&le!==void 0?le:a,offset:l,elementReference:Ke,tooltipReference:q.current,tooltipArrowReference:te.current,strategy:f,middlewares:h,border:K}).then(He=>{sn(He)})},_n=W=>{if(!W)return;const ae=W,le={x:ae.clientX,y:ae.clientY};cn(le),vt.current=le},Bn=W=>{var ae;if(!Ee)return;const le=W.target;le.isConnected&&(!((ae=q.current)===null||ae===void 0)&&ae.contains(le)||[document.querySelector(`[id='${i}']`),...Ge].some(Ke=>Ke==null?void 0:Ke.contains(le))||(Fe(!1),Rt(G)))},xn=Cc(Hn,50),Ae=Cc(ft,50),ot=W=>{Ae.cancel(),xn(W)},ie=()=>{xn.cancel(),Ae()},me=y.useCallback(()=>{var W,ae;const le=(W=Ie==null?void 0:Ie.position)!==null&&W!==void 0?W:J;le?cn(le):p?vt.current&&cn(vt.current):j!=null&&j.isConnected&&_c({place:(ae=Ie==null?void 0:Ie.place)!==null&&ae!==void 0?ae:a,offset:l,elementReference:j,tooltipReference:q.current,tooltipArrowReference:te.current,strategy:f,middlewares:h,border:K}).then(Ke=>{Pe.current&&sn(Ke)})},[Ee,j,se,Q,a,Ie==null?void 0:Ie.place,l,f,J,Ie==null?void 0:Ie.position,p]);y.useEffect(()=>{var W,ae;const le=new Set(kt);Ge.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 He=()=>{Fe(!1)},pt=Ec(j),Qe=Ec(q.current);wt.scroll&&(window.addEventListener("scroll",He),pt==null||pt.addEventListener("scroll",He),Qe==null||Qe.addEventListener("scroll",He));let tt=null;wt.resize?window.addEventListener("resize",He):j&&q.current&&(tt=uI(j,q.current,me,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const ht=Se=>{Se.key==="Escape"&&Fe(!1)};wt.escape&&window.addEventListener("keydown",ht),wt.clickOutsideAnchor&&window.addEventListener("click",Bn);const Ne=[],Jn=Se=>{Ee&&(Se==null?void 0:Se.target)===j||Hn(Se)},No=Se=>{Ee&&(Se==null?void 0:Se.target)===j&&ft()},St=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],Ci=["click","dblclick","mousedown","mouseup"];Object.entries(on).forEach(([Se,Kt])=>{Kt&&(St.includes(Se)?Ne.push({event:Se,listener:ot}):Ci.includes(Se)&&Ne.push({event:Se,listener:Jn}))}),Object.entries(In).forEach(([Se,Kt])=>{Kt&&(St.includes(Se)?Ne.push({event:Se,listener:ie}):Ci.includes(Se)&&Ne.push({event:Se,listener:No}))}),p&&Ne.push({event:"pointermove",listener:_n});const Oi=()=>{et.current=!0},Ei=()=>{et.current=!1,ft()};return w&&!it&&((W=q.current)===null||W===void 0||W.addEventListener("mouseenter",Oi),(ae=q.current)===null||ae===void 0||ae.addEventListener("mouseleave",Ei)),Ne.forEach(({event:Se,listener:Kt})=>{le.forEach(Vt=>{var Wn;(Wn=Vt.current)===null||Wn===void 0||Wn.addEventListener(Se,Kt)})}),()=>{var Se,Kt;wt.scroll&&(window.removeEventListener("scroll",He),pt==null||pt.removeEventListener("scroll",He),Qe==null||Qe.removeEventListener("scroll",He)),wt.resize?window.removeEventListener("resize",He):tt==null||tt(),wt.clickOutsideAnchor&&window.removeEventListener("click",Bn),wt.escape&&window.removeEventListener("keydown",ht),w&&!it&&((Se=q.current)===null||Se===void 0||Se.removeEventListener("mouseenter",Oi),(Kt=q.current)===null||Kt===void 0||Kt.removeEventListener("mouseleave",Ei)),Ne.forEach(({event:Vt,listener:Wn})=>{le.forEach(To=>{var Yr;(Yr=To.current)===null||Yr===void 0||Yr.removeEventListener(Vt,Wn)})})}},[j,me,Ye,kt,Ge,R,T,F,Lt,b,v]),y.useEffect(()=>{var W,ae;let le=(ae=(W=Ie==null?void 0:Ie.anchorSelect)!==null&&W!==void 0?W:s)!==null&&ae!==void 0?ae:"";!le&&t&&(le=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const Ke=new MutationObserver(He=>{const pt=[],Qe=[];He.forEach(tt=>{if(tt.type==="attributes"&&tt.attributeName==="data-tooltip-id"&&(tt.target.getAttribute("data-tooltip-id")===t?pt.push(tt.target):tt.oldValue===t&&Qe.push(tt.target)),tt.type==="childList"){if(j){const ht=[...tt.removedNodes].filter(Ne=>Ne.nodeType===1);if(le)try{Qe.push(...ht.filter(Ne=>Ne.matches(le))),Qe.push(...ht.flatMap(Ne=>[...Ne.querySelectorAll(le)]))}catch{}ht.some(Ne=>{var Jn;return!!(!((Jn=Ne==null?void 0:Ne.contains)===null||Jn===void 0)&&Jn.call(Ne,j))&&(Ue(!1),Fe(!1),$(null),Rt(G),Rt(de),!0)})}if(le)try{const ht=[...tt.addedNodes].filter(Ne=>Ne.nodeType===1);pt.push(...ht.filter(Ne=>Ne.matches(le))),pt.push(...ht.flatMap(Ne=>[...Ne.querySelectorAll(le)]))}catch{}}}),(pt.length||Qe.length)&&$e(tt=>[...tt.filter(ht=>!Qe.includes(ht)),...pt])});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]),y.useEffect(()=>{me()},[me]),y.useEffect(()=>{if(!(ne!=null&&ne.current))return()=>null;const W=new ResizeObserver(()=>{setTimeout(()=>me())});return W.observe(ne.current),()=>{W.disconnect()}},[se,ne==null?void 0:ne.current]),y.useEffect(()=>{var W;const ae=document.querySelector(`[id='${i}']`),le=[...Ge,ae];j&&le.includes(j)||$((W=Ge[0])!==null&&W!==void 0?W:ae)},[i,Ge,j]),y.useEffect(()=>(we&&Fe(!0),()=>{Rt(G),Rt(de)}),[]),y.useEffect(()=>{var W;let ae=(W=Ie==null?void 0:Ie.anchorSelect)!==null&&W!==void 0?W:s;if(!ae&&t&&(ae=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),ae)try{const le=Array.from(document.querySelectorAll(ae));$e(le)}catch{$e([])}},[t,s,Ie==null?void 0:Ie.anchorSelect]),y.useEffect(()=>{G.current&&(Rt(G),bn(b))},[b]);const qe=(ee=Ie==null?void 0:Ie.content)!==null&&ee!==void 0?ee:se,ln=Ee&&Object.keys(ve.tooltipStyles).length>0;return y.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`)}Mt(W??null),W!=null&&W.delay?bn(W.delay):Fe(!0)},close:W=>{W!=null&&W.delay?an(W.delay):Fe(!1)},activeAnchor:j,place:ve.place,isOpen:!!(Ye&&!x&&qe&&ln)})),Ye&&!x&&qe?y.createElement(m,{id:t,role:Z,className:Ft("react-tooltip",wr.tooltip,Ho.tooltip,Ho[o],n,`react-tooltip__place-${ve.place}`,wr[ln?"show":"closing"],ln?"react-tooltip__show":"react-tooltip__closing",f==="fixed"&&wr.fixed,w&&wr.clickable),onTransitionEnd:W=>{Rt(M),Ee||W.propertyName!=="opacity"||(Ue(!1),Mt(null),B==null||B())},style:{...Q,...ve.tooltipStyles,opacity:L!==void 0&&ln?L:void 0},ref:q},qe,y.createElement(m,{className:Ft("react-tooltip-arrow",wr.arrow,Ho.arrow,r,g&&wr.noArrow),style:{...ve.tooltipArrowStyles,background:D?`linear-gradient(to right bottom, transparent 50%, ${D} 50%)`:void 0},ref:te})):null},xI=({content:e})=>y.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),CI=y.forwardRef(({id:e,anchorId:t,anchorSelect:n,content:r,html:o,render:i,className:s,classNameArrow:a,variant:l="dark",place:u="top",offset:d=10,wrapper:f="div",children:h=null,events:m=["hover"],openOnClick:b=!1,positionStrategy:v="absolute",middlewares:p,delayShow:x=0,delayHide:g=0,float:w=!1,hidden:_=!1,noArrow:C=!1,clickable:N=!1,closeOnEsc:R=!1,closeOnScroll:T=!1,closeOnResize:F=!1,openEvents:U,closeEvents:Q,globalCloseEvents:J,imperativeModeOnly:Y=!1,style:B,position:ce,isOpen:se,defaultIsOpen:ne=!1,disableStyleInjection:ge=!1,border:we,opacity:A,arrowColor:j,setIsOpen:$,afterShow:K,afterHide:L,disableTooltip:D,role:Z="tooltip"},ee)=>{const[q,te]=y.useState(r),[G,de]=y.useState(o),[M,ve]=y.useState(u),[H,Ee]=y.useState(l),[Ve,Ye]=y.useState(d),[Ue,Ie]=y.useState(x),[Mt,Ze]=y.useState(g),[vt,kt]=y.useState(w),[jt,et]=y.useState(_),[Ge,$e]=y.useState(f),[Pe,Lt]=y.useState(m),[it,on]=y.useState(v),[In,wt]=y.useState(null),[Fe,sn]=y.useState(null),bn=y.useRef(ge),{anchorRefs:an,activeAnchor:Hn}=td(e),ft=Ae=>Ae==null?void 0:Ae.getAttributeNames().reduce((ot,ie)=>{var me;return ie.startsWith("data-tooltip-")&&(ot[ie.replace(/^data-tooltip-/,"")]=(me=Ae==null?void 0:Ae.getAttribute(ie))!==null&&me!==void 0?me:null),ot},{}),cn=Ae=>{const ot={place:ie=>{var me;ve((me=ie)!==null&&me!==void 0?me:u)},content:ie=>{te(ie??r)},html:ie=>{de(ie??o)},variant:ie=>{var me;Ee((me=ie)!==null&&me!==void 0?me:l)},offset:ie=>{Ye(ie===null?d:Number(ie))},wrapper:ie=>{var me;$e((me=ie)!==null&&me!==void 0?me:f)},events:ie=>{const me=ie==null?void 0:ie.split(" ");Lt(me??m)},"position-strategy":ie=>{var me;on((me=ie)!==null&&me!==void 0?me:v)},"delay-show":ie=>{Ie(ie===null?x:Number(ie))},"delay-hide":ie=>{Ze(ie===null?g:Number(ie))},float:ie=>{kt(ie===null?w:ie==="true")},hidden:ie=>{et(ie===null?_:ie==="true")},"class-name":ie=>{wt(ie)}};Object.values(ot).forEach(ie=>ie(null)),Object.entries(Ae).forEach(([ie,me])=>{var qe;(qe=ot[ie])===null||qe===void 0||qe.call(ot,me)})};y.useEffect(()=>{te(r)},[r]),y.useEffect(()=>{de(o)},[o]),y.useEffect(()=>{ve(u)},[u]),y.useEffect(()=>{Ee(l)},[l]),y.useEffect(()=>{Ye(d)},[d]),y.useEffect(()=>{Ie(x)},[x]),y.useEffect(()=>{Ze(g)},[g]),y.useEffect(()=>{kt(w)},[w]),y.useEffect(()=>{et(_)},[_]),y.useEffect(()=>{on(v)},[v]),y.useEffect(()=>{bn.current!==ge&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")},[ge]),y.useEffect(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:ge==="core",disableBase:ge}}))},[]),y.useEffect(()=>{var Ae;const ot=new Set(an);let ie=n;if(!ie&&e&&(ie=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),ie)try{document.querySelectorAll(ie).forEach(ae=>{ot.add({current:ae})})}catch{console.warn(`[react-tooltip] "${ie}" is not a valid CSS selector`)}const me=document.querySelector(`[id='${t}']`);if(me&&ot.add({current:me}),!ot.size)return()=>null;const qe=(Ae=Fe??me)!==null&&Ae!==void 0?Ae:Hn.current,ln=new MutationObserver(ae=>{ae.forEach(le=>{var Ke;if(!qe||le.type!=="attributes"||!(!((Ke=le.attributeName)===null||Ke===void 0)&&Ke.startsWith("data-tooltip-")))return;const He=ft(qe);cn(He)})}),W={attributes:!0,childList:!1,subtree:!1};if(qe){const ae=ft(qe);cn(ae),ln.observe(qe,W)}return()=>{ln.disconnect()}},[an,Hn,Fe,t,n]),y.useEffect(()=>{B!=null&&B.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),we&&!xc("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."),A&&!xc("opacity",`${A}`)&&console.warn(`[react-tooltip] "${A}" is not a valid \`opacity\`.`)},[]);let _n=h;const Bn=y.useRef(null);if(i){const Ae=i({content:(Fe==null?void 0:Fe.getAttribute("data-tooltip-content"))||q||null,activeAnchor:Fe});_n=Ae?y.createElement("div",{ref:Bn,className:"react-tooltip-content-wrapper"},Ae):null}else q&&(_n=q);G&&(_n=y.createElement(xI,{content:G}));const xn={forwardRef:ee,id:e,anchorId:t,anchorSelect:n,className:Ft(s,In),classNameArrow:a,content:_n,contentWrapperRef:Bn,place:M,variant:H,offset:Ve,wrapper:Ge,events:Pe,openOnClick:b,positionStrategy:it,middlewares:p,delayShow:Ue,delayHide:Mt,float:vt,hidden:jt,noArrow:C,clickable:N,closeOnEsc:R,closeOnScroll:T,closeOnResize:F,openEvents:U,closeEvents:Q,globalCloseEvents:J,imperativeModeOnly:Y,style:B,position:ce,isOpen:se,defaultIsOpen:ne,border:we,opacity:A,arrowColor:j,setIsOpen:$,afterShow:K,afterHide:L,disableTooltip:D,activeAnchor:Fe,setActiveAnchor:Ae=>sn(Ae),role:Z};return y.createElement(_I,{...xn})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||bc({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||bc({css:`
|
|
51
|
-
.styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:8px;height:8px}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:"base"})});function OI(){return c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",children:[c.jsxs("g",{clipPath:"url(#clip0_2896_16290)",children:[c.jsx("path",{d:"M8.00032 11.167L8.00032 7.83366M8.00032 1.83366C4.33366 1.83366 1.33366 4.83366 1.33366 8.50033C1.33366 12.167 4.33366 15.167 8.00033 15.167C11.667 15.167 14.667 12.167 14.667 8.50033C14.667 4.83366 11.667 1.83366 8.00032 1.83366Z",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M8.00293 5.83301L7.99768 5.83301",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"})]}),c.jsx("defs",{children:c.jsx("clipPath",{id:"clip0_2896_16290",children:c.jsx("rect",{width:"16",height:"16",fill:"white",transform:"translate(16 16.5) rotate(180)"})})})]})}function EI({id:e,tooltipText:t}){return c.jsxs(c.Fragment,{children:[c.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:OI()}),c.jsx(CI,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}const nd=y.createContext(null);function rd(){const e=y.useContext(nd);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const id=y.createContext(()=>{});function SI(){const e=y.useContext(id);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}var od=Symbol.for("immer-nothing"),Sc=Symbol.for("immer-draftable"),xt=Symbol.for("immer-state"),NI=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 yt(e,...t){if(process.env.NODE_ENV!=="production"){const n=NI[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 $r=Object.getPrototypeOf;function qr(e){return!!e&&!!e[xt]}function hr(e){var t;return e?sd(e)||Array.isArray(e)||!!e[Sc]||!!((t=e.constructor)!=null&&t[Sc])||vo(e)||wo(e):!1}var TI=Object.prototype.constructor.toString();function sd(e){if(!e||typeof e!="object")return!1;const t=$r(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)===TI}function ao(e,t){yo(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function yo(e){const t=e[xt];return t?t.type_:Array.isArray(e)?1:vo(e)?2:wo(e)?3:0}function Cs(e,t){return yo(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ad(e,t,n){const r=yo(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function RI(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function vo(e){return e instanceof Map}function wo(e){return e instanceof Set}function Xn(e){return e.copy_||e.base_}function Os(e,t){if(vo(e))return new Map(e);if(wo(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=sd(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[xt];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($r(e),r)}else{const r=$r(e);if(r!==null&&n)return{...e};const o=Object.create(r);return Object.assign(o,e)}}function ua(e,t=!1){return Io(e)||qr(e)||!hr(e)||(yo(e)>1&&(e.set=e.add=e.clear=e.delete=AI),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>ua(r,!0))),e}function AI(){yt(2)}function Io(e){return Object.isFrozen(e)}var PI={};function mr(e){const t=PI[e];return t||yt(0,e),t}var ui;function cd(){return ui}function FI(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Nc(e,t){t&&(mr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Es(e){Ss(e),e.drafts_.forEach(DI),e.drafts_=null}function Ss(e){e===ui&&(ui=e.parent_)}function Tc(e){return ui=FI(ui,e)}function DI(e){const t=e[xt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Rc(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[xt].modified_&&(Es(t),yt(4)),hr(e)&&(e=co(t,e),t.parent_||lo(t,e)),t.patches_&&mr("Patches").generateReplacementPatches_(n[xt].base_,e,t.patches_,t.inversePatches_)):e=co(t,n,[]),Es(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==od?e:void 0}function co(e,t,n){if(Io(t))return t;const r=t[xt];if(!r)return ao(t,(o,i)=>Ac(e,r,t,o,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return lo(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),ao(i,(a,l)=>Ac(e,r,o,a,l,n,s)),lo(e,o,!1),n&&e.patches_&&mr("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Ac(e,t,n,r,o,i,s){if(process.env.NODE_ENV!=="production"&&o===n&&yt(5),qr(o)){const a=i&&t&&t.type_!==3&&!Cs(t.assigned_,r)?i.concat(r):void 0,l=co(e,o,a);if(ad(n,r,l),qr(l))e.canAutoFreeze_=!1;else return}else s&&n.add(o);if(hr(o)&&!Io(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;co(e,o),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&lo(e,o)}}function lo(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ua(t,n)}function MI(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:cd(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=da;n&&(o=[r],i=di);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}var da={get(e,t){if(t===xt)return e;const n=Xn(e);if(!Cs(n,t))return kI(e,n,t);const r=n[t];return e.finalized_||!hr(r)?r:r===Bo(e.base_,t)?(Jo(e),e.copy_[t]=Ts(r,e)):r},has(e,t){return t in Xn(e)},ownKeys(e){return Reflect.ownKeys(Xn(e))},set(e,t,n){const r=ld(Xn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=Bo(Xn(e),t),i=o==null?void 0:o[xt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(RI(n,o)&&(n!==void 0||Cs(e.base_,t)))return!0;Jo(e),Ns(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Bo(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Jo(e),Ns(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Xn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){yt(11)},getPrototypeOf(e){return $r(e.base_)},setPrototypeOf(){yt(12)}},di={};ao(da,(e,t)=>{di[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});di.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&yt(13),di.set.call(this,e,t,void 0)};di.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&yt(14),da.set.call(this,e[0],t,n,e[0])};function Bo(e,t){const n=e[xt];return(n?Xn(n):e)[t]}function kI(e,t,n){var o;const r=ld(t,n);return r?"value"in r?r.value:(o=r.get)==null?void 0:o.call(e.draft_):void 0}function ld(e,t){if(!(t in e))return;let n=$r(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=$r(n)}}function Ns(e){e.modified_||(e.modified_=!0,e.parent_&&Ns(e.parent_))}function Jo(e){e.copy_||(e.copy_=Os(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var jI=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(l=i,...u){return s.produce(l,d=>n.call(this,d,...u))}}typeof n!="function"&&yt(6),r!==void 0&&typeof r!="function"&&yt(7);let o;if(hr(t)){const i=Tc(this),s=Ts(t,void 0);let a=!0;try{o=n(s),a=!1}finally{a?Es(i):Ss(i)}return Nc(i,r),Rc(o,i)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===od&&(o=void 0),this.autoFreeze_&&ua(o,!0),r){const i=[],s=[];mr("Patches").generateReplacementPatches_(t,o,i,s),r(i,s)}return o}else yt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,l=>t(l,...a));let r,o;return[this.produce(t,n,(s,a)=>{r=s,o=a}),r,o]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){hr(e)||yt(8),qr(e)&&(e=LI(e));const t=Tc(this),n=Ts(e,void 0);return n[xt].isManual_=!0,Ss(t),n}finishDraft(e,t){const n=e&&e[xt];(!n||!n.isManual_)&&yt(9);const{scope_:r}=n;return Nc(r,t),Rc(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=mr("Patches").applyPatches_;return qr(e)?r(e,t):this.produce(e,o=>r(o,t))}};function Ts(e,t){const n=vo(e)?mr("MapSet").proxyMap_(e,t):wo(e)?mr("MapSet").proxySet_(e,t):MI(e,t);return(t?t.scope_:cd()).drafts_.push(n),n}function LI(e){return qr(e)||yt(10,e),ud(e)}function ud(e){if(!hr(e)||Io(e))return e;const t=e[xt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Os(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Os(e,!0);return ao(n,(r,o)=>{ad(n,r,ud(o))}),t&&(t.finalized_=!1),n}var Ct=new jI,ti=Ct.produce;Ct.produceWithPatches.bind(Ct);Ct.setAutoFreeze.bind(Ct);Ct.setUseStrictShallowCopy.bind(Ct);Ct.applyPatches.bind(Ct);Ct.createDraft.bind(Ct);Ct.finishDraft.bind(Ct);const dd=y.createContext(void 0),KI={};function fa(){const e=y.useContext(dd);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function VI({children:e}){const{installation:t}=rt(),{hydratedRevision:n,loading:r}=Qr(),[o,i]=y.useState(KI),s=t==null?void 0:t.config;y.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(o).length>0)&&av(n,s,i)},[n,r,s,o]);const a=y.useCallback((m,b)=>{i(v=>ti(v,p=>{p[m]=ti(p[m],b)}))},[i]),l=y.useCallback((m,b)=>{i(v=>ti(v,p=>{p[m]=b}))},[i]),u=y.useCallback(()=>{i(ti(m=>{const b=m.other.write;b&&(b.isWriteModified=!1)}))},[i]),d=y.useCallback(m=>{i(ti(b=>{var p;const v=(p=b[m])==null?void 0:p.read;v&&(v.isOptionalFieldsModified=!1,v.isRequiredMapFieldsModified=!1,v.isValueMappingsModified=!1)}))},[i]),f=y.useCallback(m=>{m===dr?u():d(m)},[d,u]),h=y.useMemo(()=>({objectConfigurationsState:o,setObjectConfigurationsState:i,setConfigureState:a,resetConfigureState:l,resetPendingConfigurationState:f}),[o,l,f,a]);return c.jsx(dd.Provider,{value:h,children:e})}const Xt=()=>{const{appName:e}=Te(),{objectConfigurationsState:t,setConfigureState:n}=fa(),{selectedObjectName:r}=rd(),o=tu(r||"",t);return{appName:e,configureState:o,setConfigureState:n,selectedObjectName:r}};function UI(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=!Gl(o,n);e.read.isRequiredMapFieldsModified=s}}function fi(e,t,n){t(e,r=>UI(r,n))}const $I="Each field must be mapped to a unique value";function pa({field:e,onSelectChange:t,allFields:n}){var g;const{configureState:r,selectedObjectName:o,setConfigureState:i}=Xt(),[s,a]=y.useState(!0),{isError:l,removeError:u,getError:d}=Dt(),f=(g=r==null?void 0:r.read)==null?void 0:g.selectedFieldMappings,h=f==null?void 0:f[e.mapToName];y.useEffect(()=>{e._default&&!h&&o&&r&&fi(o,i,[{field:e.mapToName,value:e._default}]),a(!1)},[e,i,o,h,r]);const m=y.useMemo(()=>n.map(w=>({id:w.fieldName,label:w.displayName,value:w.fieldName})),[n]),b=c.jsx(Bu,{disabled:s,items:m,selectedValue:h||null,onSelectedItemChange:w=>{t({target:{name:e.mapToName,value:w==null?void 0:w.value}})},placeholder:"Please select one",style:{width:"100%"}}),v=y.useCallback(()=>{o&&(fi(o,i,[{field:e.mapToName,value:null}]),l(ue.MAPPING,o)&&u(ue.MAPPING,o))},[e.mapToName,o,i,l,u]),{hasDuplicationError:p,errorMessage:x}=y.useMemo(()=>{const w=d(ue.MAPPING,o),_=Array.isArray(w)&&w.length>0&&w.includes(e.mapToName);return{hasDuplicationError:_,errorMessage:_?$I:""}},[o,d,e.mapToName]);return c.jsxs(c.Fragment,{children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[c.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:[c.jsx("span",{style:{fontWeight:500},children:e.mapToDisplayName??e.mapToName}),c.jsx("span",{children:(e==null?void 0:e.prompt)&&c.jsx(EI,{id:`tooltip-id-${e==null?void 0:e.prompt}`,tooltipText:e==null?void 0:e.prompt})})]}),c.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[b,c.jsx(ze,{type:"button",variant:"ghost",onClick:v,children:"Clear"})]})]},e.mapToName),p&&c.jsxs("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:[" ",x," "]},e.mapToName)]})}const qI="_formControl_9qd8d_1",HI="_formLabel_9qd8d_5",BI="_formLabelRequired_9qd8d_11",JI="_formInput_9qd8d_16",WI="_formInputInvalid_9qd8d_20",zI="_formError_9qd8d_24",GI="_disabled_9qd8d_30",Qn={formControl:qI,formLabel:HI,formLabelRequired:BI,formInput:JI,formInputInvalid:WI,formError:zI,disabled:GI};function bo({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:o=!1,errorMessage:i,children:s}){return c.jsxs("div",{className:Ft(Qn.formControl,{[Qn.disabled]:r}),children:[t&&c.jsx("label",{htmlFor:e,className:Ft(Qn.formLabel,{[Qn.formLabelRequired]:n}),children:t}),c.jsx("div",{id:e,className:Ft(Qn.formInput,{[Qn.formInputInvalid]:o}),children:s}),o&&i&&c.jsx("div",{className:Qn.formError,role:"alert",children:i})]})}const QI="_divider_1kmoj_1",Pc={divider:QI};function _o({className:e,style:t}){return c.jsx("hr",{className:e?`${Pc.divider} ${e}`:Pc.divider,style:t})}function Ot({string:e}){return c.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[c.jsx("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:e}),c.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:c.jsx(_o,{style:{width:"100%",marginLeft:"1rem"}})})]})}function fd({selectedFieldMappings:e,selectedObjectName:t,fieldName:n,fieldValue:r,setError:o}){if(!e||!t)return!1;if(Object.values(e).some(s=>s===r&&s!==n)){console.error("Each field must be mapped to a unique value",e);const s=Object.keys(e).filter(l=>e[l]===r),a=[n,...s];return o(ue.MAPPING,t,a),!0}return!1}function XI({dynamicFieldMappings:e,onSelectChange:t,allFields:n}){return e.length?c.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:e.map(r=>c.jsx(bo,{id:r.mapToName,children:c.jsx(pa,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function YI(){var b,v;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Xt(),{isError:r,removeError:o,setError:i}=Dt(),s=((b=t==null?void 0:t.read)==null?void 0:b.allFields)||[],{fieldMapping:a}=rt(),l=(v=t==null?void 0:t.read)==null?void 0:v.selectedFieldMappings,u=p=>{const{value:x,name:g}=p.target;!x||fd({selectedFieldMappings:l,selectedObjectName:e,fieldName:g,fieldValue:x,setError:i})||(e&&fi(e,n,[{field:g,value:x}]),r(ue.MAPPING,g)&&o(ue.MAPPING,g),e&&r(ue.MAPPING,e)&&o(ue.MAPPING,e))},d=y.useMemo(()=>!e||!a?[]:Object.values(a[e]||{}).flat().filter(p=>!p.fieldName),[a,e]),f=y.useMemo(()=>{var g;return(((g=t==null?void 0:t.read)==null?void 0:g.optionalMapFields)||[]).filter(w=>!d.some(_=>_.mapToName===w.mapToName))},[t,d]),h=d.length>0;return f.length>0||h?c.jsxs(c.Fragment,{children:[c.jsx(Ot,{string:"Map the following optional fields"}),c.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:[f==null?void 0:f.map(p=>c.jsx(bo,{id:p.mapToName,children:c.jsx(pa,{allFields:s,field:p,onSelectChange:u})},p.mapToName)),h&&c.jsx(XI,{dynamicFieldMappings:d,onSelectChange:u,allFields:s})]})]}):null}function ZI(){var u;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Xt(),{isError:r,removeError:o,setError:i}=Dt(),s=(u=t==null?void 0:t.read)==null?void 0:u.selectedFieldMappings,a=d=>{const{value:f,name:h}=d.target;!f||fd({selectedFieldMappings:s,selectedObjectName:e,fieldName:h,fieldValue:f,setError:i})||(e&&fi(e,n,[{field:h,value:f}]),r(ue.MAPPING,h)&&o(ue.MAPPING,h),e&&r(ue.MAPPING,e)&&o(ue.MAPPING,e))},l=y.useMemo(()=>{var d;return((d=t==null?void 0:t.read)==null?void 0:d.requiredMapFields)||[]},[t]);return l!=null&&l.length?c.jsxs(c.Fragment,{children:[c.jsx(Ot,{string:"Map the following fields"}),c.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:l.map(d=>{var f;return c.jsx(bo,{id:d.mapToName,isInvalid:r(ue.MAPPING,d.mapToName),errorMessage:"* required",children:c.jsx(pa,{allFields:((f=t==null?void 0:t.read)==null?void 0:f.allFields)||[],field:d,onSelectChange:a})},d.mapToName)})})]}):null}const eb=(e,t)=>e.filter(n=>!t.has(n));function tb(){var h,m,b;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Xt(),{fieldMapping:r}=rt(),o=((h=t==null?void 0:t.read)==null?void 0:h.selectedFieldMappings)||{},i=Object.keys(o),s=((m=t==null?void 0:t.read)==null?void 0:m.requiredMapFields)||[],a=((b=t==null?void 0:t.read)==null?void 0:b.optionalMapFields)||[],l=e&&r?Object.values(r[e]||{}).flat().filter(v=>!v.fieldName):[],u=s.concat(l,a).map(v=>v.mapToName),d=new Set(u),f=eb(i,d);y.useEffect(()=>{e&&f.length&&fi(e,n,f.map(v=>({field:v,value:null})))},[e,n,f])}const nb={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function rb({children:e,style:t}){return c.jsx(vn,{style:{...nb,...t},children:e})}const ha=e=>{const t=dt(),{provider:n}=rt(),r=e||n;return yn({queryKey:["amp","providerInfo",r],queryFn:async()=>{if(!r)throw new Error("Provider not found");return(await t()).providerApi.getProvider({provider:r})},enabled:!!r})},ct=e=>{const t=ha(e),{data:n}=t,{provider:r}=rt(),o=n&&Kl(n==null?void 0:n.name,n);return{...t,providerName:o,selectedProvider:e||r}};function ib(){var u,d,f;const{project:e}=Te(),{hydratedRevision:t}=Qr(),{selectedObjectName:n}=Xt(),{providerName:r}=ct(),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(h=>h.objectName===n),s=(i==null?void 0:i.displayName)||n&&kr(n),a=i==null?void 0:i.mapToName,l=(i==null?void 0:i.mapToDisplayName)||a&&kr(a);return l&&o&&r?c.jsx(rb,{style:{marginTop:"1rem"},children:c.jsxs("p",{style:{margin:"1rem 0"},children:[c.jsx("b",{children:l})," in ",o," is mapped to"," ",c.jsx("b",{children:s})," in ",r,"."]})}):null}function Fc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function pd(...e){return t=>{let n=!1;const r=e.map(o=>{const i=Fc(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():Fc(e[o],null)}}}}function Hr(...e){return k.useCallback(pd(...e),e)}function xo(e,t=[]){let n=[];function r(i,s){const a=k.createContext(s),l=n.length;n=[...n,s];const u=f=>{var x;const{scope:h,children:m,...b}=f,v=((x=h==null?void 0:h[e])==null?void 0:x[l])||a,p=k.useMemo(()=>b,Object.values(b));return c.jsx(v.Provider,{value:p,children:m})};u.displayName=i+"Provider";function d(f,h){var v;const m=((v=h==null?void 0:h[e])==null?void 0:v[l])||a,b=k.useContext(m);if(b)return b;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 l=(a==null?void 0:a[e])||i;return k.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,ob(o,...t)]}function ob(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:u})=>{const f=l(i)[`__scope${u}`];return{...a,...f}},{});return k.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Wt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}var pi=globalThis!=null&&globalThis.document?k.useLayoutEffect:()=>{},sb=k[" useInsertionEffect ".trim().toString()]||pi;function ma({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,s]=ab({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:o;{const d=k.useRef(e!==void 0);k.useEffect(()=>{const f=d.current;f!==a&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=a},[a,r])}const u=k.useCallback(d=>{var f;if(a){const h=cb(d)?d(e):d;h!==e&&((f=s.current)==null||f.call(s,h))}else i(d)},[a,e,i,s]);return[l,u]}function ab({defaultProp:e,onChange:t}){const[n,r]=k.useState(e),o=k.useRef(n),i=k.useRef(t);return sb(()=>{i.current=t},[t]),k.useEffect(()=>{var s;o.current!==n&&((s=i.current)==null||s.call(i,n),o.current=n)},[n,o]),[n,r,i]}function cb(e){return typeof e=="function"}function lb(e){const t=k.useRef({value:e,previous:e});return k.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function ub(e){const[t,n]=k.useState(void 0);return pi(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const l=i.borderBoxSize,u=Array.isArray(l)?l[0]:l;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 db(e,t){return k.useReducer((n,r)=>t[n][r]??n,e)}var ga=e=>{const{present:t,children:n}=e,r=fb(t),o=typeof n=="function"?n({present:r.isPresent}):k.Children.only(n),i=Hr(r.ref,pb(o));return typeof n=="function"||r.isPresent?k.cloneElement(o,{ref:i}):null};ga.displayName="Presence";function fb(e){const[t,n]=k.useState(),r=k.useRef(null),o=k.useRef(e),i=k.useRef("none"),s=e?"mounted":"unmounted",[a,l]=db(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return k.useEffect(()=>{const u=qi(r.current);i.current=a==="mounted"?u:"none"},[a]),pi(()=>{const u=r.current,d=o.current;if(d!==e){const h=i.current,m=qi(u);e?l("MOUNT"):m==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(d&&h!==m?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),pi(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=m=>{const v=qi(r.current).includes(m.animationName);if(m.target===t&&v&&(l("ANIMATION_END"),!o.current)){const p=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=p)})}},h=m=>{m.target===t&&(i.current=qi(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:k.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function qi(e){return(e==null?void 0:e.animationName)||"none"}function pb(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Rs(e){const t=hb(e),n=k.forwardRef((r,o)=>{const{children:i,...s}=r,a=k.Children.toArray(i),l=a.find(gb);if(l){const u=l.props.children,d=a.map(f=>f===l?k.Children.count(u)>1?k.Children.only(null):k.isValidElement(u)?u.props.children:null:f);return c.jsx(t,{...s,ref:o,children:k.isValidElement(u)?k.cloneElement(u,void 0,d):null})}return c.jsx(t,{...s,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function hb(e){const t=k.forwardRef((n,r)=>{const{children:o,...i}=n;if(k.isValidElement(o)){const s=vb(o),a=yb(i,o.props);return o.type!==k.Fragment&&(a.ref=r?pd(r,s):s),k.cloneElement(o,a)}return k.Children.count(o)>1?k.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var mb=Symbol("radix.slottable");function gb(e){return k.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===mb}function yb(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 vb(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 wb=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],wn=wb.reduce((e,t)=>{const n=Rs(`Primitive.${t}`),r=k.forwardRef((o,i)=>{const{asChild:s,...a}=o,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(l,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Co="Checkbox",[Ib,oC]=xo(Co),[bb,_b]=Ib(Co),hd=k.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:l="on",onCheckedChange:u,form:d,...f}=e,[h,m]=k.useState(null),b=Hr(t,_=>m(_)),v=k.useRef(!1),p=h?d||!!h.closest("form"):!0,[x,g]=ma({prop:o,defaultProp:i??!1,onChange:u,caller:Co}),w=k.useRef(x);return k.useEffect(()=>{const _=h==null?void 0:h.form;if(_){const C=()=>g(w.current);return _.addEventListener("reset",C),()=>_.removeEventListener("reset",C)}},[h,g]),c.jsxs(bb,{scope:n,state:x,disabled:a,children:[c.jsx(wn.button,{type:"button",role:"checkbox","aria-checked":Kn(x)?"mixed":x,"aria-required":s,"data-state":vd(x),"data-disabled":a?"":void 0,disabled:a,value:l,...f,ref:b,onKeyDown:Wt(e.onKeyDown,_=>{_.key==="Enter"&&_.preventDefault()}),onClick:Wt(e.onClick,_=>{g(C=>Kn(C)?!0:!C),p&&(v.current=_.isPropagationStopped(),v.current||_.stopPropagation())})}),p&&c.jsx(yd,{control:h,bubbles:!v.current,name:r,value:l,checked:x,required:s,disabled:a,form:d,style:{transform:"translateX(-100%)"},defaultChecked:Kn(i)?!1:i})]})});hd.displayName=Co;var md="CheckboxIndicator",gd=k.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=_b(md,n);return c.jsx(ga,{present:r||Kn(i.state)||i.state===!0,children:c.jsx(wn.span,{"data-state":vd(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});gd.displayName=md;var xb="CheckboxBubbleInput",yd=k.forwardRef(({__scopeCheckbox:e,control:t,checked:n,bubbles:r=!0,defaultChecked:o,...i},s)=>{const a=k.useRef(null),l=Hr(a,s),u=lb(n),d=ub(t);k.useEffect(()=>{const h=a.current;if(!h)return;const m=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(m,"checked").set;if(u!==n&&v){const p=new Event("click",{bubbles:r});h.indeterminate=Kn(n),v.call(h,Kn(n)?!1:n),h.dispatchEvent(p)}},[u,n,r]);const f=k.useRef(Kn(n)?!1:n);return c.jsx(wn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??f.current,...i,tabIndex:-1,ref:l,style:{...i.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});yd.displayName=xb;function Kn(e){return e==="indeterminate"}function vd(e){return Kn(e)?"indeterminate":e?"checked":"unchecked"}var wd=hd,Id=gd;function bd(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 Cb=["color"],_d=y.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=bd(e,Cb);return y.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}),y.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"}))}),Ob=["color"],Eb=y.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=bd(e,Ob);return y.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}),y.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 Sb="_checkboxGroupContainer_1ya1t_1",Nb="_stack_1ya1t_6",Tb="_selectAllContainer_1ya1t_11",Rb="_fieldContainer_1ya1t_18",Ab="_checkbox_1ya1t_1",Br={checkboxGroupContainer:Sb,stack:Nb,selectAllContainer:Tb,fieldContainer:Rb,checkbox:Ab};function xd({id:e,isChecked:t,label:n,onCheckedChange:r}){return c.jsxs("div",{className:Br.fieldContainer,children:[c.jsx(wd,{className:Br.checkbox,id:e,onCheckedChange:r,checked:t,children:c.jsx(Id,{children:c.jsx(_d,{})})}),c.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function Cd({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:o}){return c.jsxs("div",{className:Br.selectAllContainer,children:[c.jsx(wd,{className:Br.checkbox,id:e,onCheckedChange:r,children:c.jsxs(Id,{children:[o&&c.jsx(Eb,{}),t===!0&&c.jsx(_d,{})]})}),c.jsx("label",{htmlFor:e,children:n})]})}function Od({children:e}){return c.jsx("div",{className:Br.checkboxGroupContainer,children:e})}function Ed({children:e}){return c.jsx("div",{className:Br.stack,children:e})}function Pb(e,t,n){var o,i;const r=((o=e==null?void 0:e.read)==null?void 0:o.selectedOptionalFields)||{};if(r[t]=n,n||delete r[t],(i=e.read)!=null&&i.savedConfig.optionalFields){const s=e.read.savedConfig.optionalFields,l=!Gl(s,r);e.read.isOptionalFieldsModified=l}else console.warn("read.savedConfig.optionalFields is undefined")}function Dc(e,t,n,r){t(e,o=>Pb(o,n,r))}function Fb(){var f,h;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,b)=>{m!=="indeterminate"&&r&&t&&Dc(r,n,b,m)},s=(h=t==null?void 0:t.read)==null?void 0:h.optionalFields,a=m=>{r&&s&&s.forEach(b=>{Vn(b)||Dc(r,n,b.fieldName,m)})},l=!!(s&&s.length>0),u=Object.keys(o||{}).length===(s==null?void 0:s.length),d=!u&&Object.keys(o||{}).length>0;return l&&c.jsxs(c.Fragment,{children:[c.jsx(Ot,{string:`${e} reads the following optional fields`}),c.jsxs(Od,{children:[((s==null?void 0:s.length)||0)>=2&&c.jsx(Cd,{id:"select-all-fields",isChecked:u,label:"Select all",onCheckedChange:a,isIndeterminate:d}),c.jsx(Ed,{children:s.map(m=>Vn(m)?null:c.jsx(xd,{id:m.fieldName,isChecked:!!(o!=null&&o[m==null?void 0:m.fieldName]),label:m.displayName,onCheckedChange:b=>i(b,m.fieldName)},m.fieldName))})]})]})}function Db(){return c.jsx(Fb,{})}const Mb={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 kb({children:e,style:t,...n}){return c.jsx("span",{style:{...Mb,...t},...n,children:e})}function jb(){var n,r,o;const{configureState:e}=Xt(),{appName:t}=Te();return c.jsxs(c.Fragment,{children:[c.jsx(Ot,{string:`${t} reads the following fields`}),c.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:(r=(n=e==null?void 0:e.read)==null?void 0:n.requiredFields)!=null&&r.length?(o=e.read)==null?void 0:o.requiredFields.map(i=>Vn(i)?null:c.jsx(kb,{children:i.displayName},i.fieldName)):"There are no required fields."})]})}function Lb(e,t,n,r,o){e.read&&(e.read.selectedValueMappings||(e.read.selectedValueMappings={}),e.read.selectedValueMappings[o]||(e.read.selectedValueMappings[o]={}),r===""&&e.read.selectedValueMappings[o][n]?delete e.read.selectedValueMappings[o][n]:e.read.selectedValueMappings[o][n]=r)}function Sd(e,t,n,r,o){t(e,i=>Lb(i,e,n,r,o))}function Kb(e,t,n){t(e,r=>{r.read&&(r.read.isValueMappingsModified=n)})}function Vb({string:e,fieldName:t}){return c.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[c.jsxs("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:[e,c.jsx("b",{children:t})]}),c.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:c.jsx(_o,{style:{width:"100%",marginLeft:"1rem"}})})]})}function Ub({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r,hasError:o}){var C;const{configureState:i,selectedObjectName:s,setConfigureState:a}=Xt(),[l,u]=y.useState(!0),{getError:d,setError:f,resetBoundary:h,isError:m,removeError:b}=Dt(),v=y.useMemo(()=>{var N,R;return((R=(N=i==null?void 0:i.read)==null?void 0:N.selectedValueMappings)==null?void 0:R[n])||{}},[(C=i==null?void 0:i.read)==null?void 0:C.selectedValueMappings,n]),p=y.useMemo(()=>v==null?void 0:v[e.mappedValue],[v,e.mappedValue]);y.useEffect(()=>{u(!1)},[e,a,s,p,i]);const x=y.useMemo(()=>r.map(N=>({id:N.value,label:N.displayValue,value:N.value})),[r]),g=y.useCallback(N=>{if(N){if(Object.values(v).some(R=>R===N.value&&R!==p)){const R=[...Object.entries(v).filter(([T,F])=>F===N.value&&F!==p).map(([T])=>T),e.mappedValue];f(ue.VALUE_MAPPING,n,R);return}d(ue.VALUE_MAPPING,n)&&h(ue.VALUE_MAPPING),t({target:{name:e.mappedValue,value:N.value,fieldName:n}})}},[t,v,p,n,e.mappedValue,h,f,d]),w=y.useMemo(()=>c.jsx(Bu,{disabled:l,items:x,selectedValue:p||null,onSelectedItemChange:g,placeholder:"Please select one",style:{border:o?"2px solid red":void 0,borderRadius:"8px",width:"100%"}},p),[p,l,x,g,o]),_=y.useCallback(()=>{s&&(Sd(s,a,e.mappedValue,"",n),m(ue.VALUE_MAPPING,n)&&b(ue.VALUE_MAPPING,n))},[s,a,e.mappedValue,n,m,b]);return c.jsxs("div",{style:{display:"flex",flexDirection:"column",marginBottom:".25rem"},children:[c.jsx("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:c.jsx("span",{style:{fontWeight:500},children:e.mappedDisplayValue})}),c.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[w,c.jsx(ze,{type:"button",variant:"ghost",onClick:_,children:"Clear"})]})]},e.mappedValue)}function $b(){var m,b,v;const{fieldMapping:e}=rt(),{selectedObjectName:t,configureState:n,setConfigureState:r}=Xt(),{isError:o,removeError:i,getError:s}=Dt(),a=(m=n==null?void 0:n.read)==null?void 0:m.selectedFieldMappings,l=(b=n==null?void 0:n.read)==null?void 0:b.selectedValueMappings,u=(v=n==null?void 0:n.read)==null?void 0:v.isValueMappingsModified,d=y.useRef(!1),f=y.useMemo(()=>{const p=t&&e?Object.values(e[t]||{}).flat().filter(x=>x.mappedValues).map(x=>({...x})):[];if(a)for(let x=0;x<p.length;x+=1){const{mapToName:g}=p[x];a!=null&&a[g]&&(p[x].fieldName=a[g])}return p},[t,e,a]),h=y.useCallback(p=>{const{value:x,name:g,fieldName:w}=p.target;x&&(t&&Sd(t,r,g,x,w),o(ue.VALUE_MAPPING,g)&&i(ue.VALUE_MAPPING,g))},[t,r,o,i]);return y.useEffect(()=>{var p;if(t&&l){const x=((p=e==null?void 0:e[t])==null?void 0:p.filter(w=>w.fieldName&&w.mappedValues.length>0))||[];x.every(w=>{const _=l[w.fieldName]||{};return Object.keys(_).length===Object.keys(w.mappedValues).length})&&x.length>0?!u&&!d.current&&(Kb(t,r,!0),d.current=!0):d.current=!1}},[l,f,t,r,e,u]),f!=null&&f.length?c.jsx(c.Fragment,{children:f.map(p=>{var N,R,T;if(!p.fieldName)return null;const x=(R=(N=n==null?void 0:n.read)==null?void 0:N.allFieldsMetadata)==null?void 0:R[p.fieldName],g=x==null?void 0:x.valueType;if(!["singleSelect","multiSelect"].includes(g))return console.error("fieldName is not a singleSelect or multiSelect",p),null;const w=x==null?void 0:x.values;if(!w)return null;const _=Object.keys(w).length,C=Object.keys((p==null?void 0:p.mappedValues)||[]).length;return _!==C?(console.error("field values and the values to be mapped are not of the same length",p,w),null):c.jsxs(c.Fragment,{children:[c.jsx(Vb,{string:"Map the values for ",fieldName:p.mapToDisplayName||p.mapToName||p.fieldName}),c.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:c.jsx(bo,{id:p.mapToName||p.fieldName,children:(T=p==null?void 0:p.mappedValues)==null?void 0:T.map(F=>{var Y,B,ce;const U=s(ue.VALUE_MAPPING,p.fieldName),Q=Array.isArray(U)&&U.includes(F.mappedValue),J=((ce=(B=(Y=n==null?void 0:n.read)==null?void 0:Y.allFieldsMetadata)==null?void 0:B[p.fieldName])==null?void 0:ce.values)||[];return c.jsxs(c.Fragment,{children:[c.jsx(Ub,{allValueOptions:J,mappedValue:F,onSelectChange:h,fieldName:(p==null?void 0:p.fieldName)||"",hasError:Q},`${F.mappedValue}-${p.fieldName}`),Q&&c.jsx("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:`Each ${p.mapToName||p.fieldName} must be mapped to a unique value`},F.mappedValue)]})})},p.mapToName||p.fieldName)})]})})}):null}function qb(){return tb(),c.jsxs(c.Fragment,{children:[c.jsx(ib,{}),c.jsx(jb,{}),c.jsx(ZI,{}),c.jsx(YI,{}),c.jsx($b,{}),c.jsx(Db,{})]})}function Hb(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=!iv(a,s);e.write.isWriteModified=u}}}function Mc(e,t,n,r){t(e,o=>{Hb(o,n,r)})}function Bb(){var f,h,m,b;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=Xt(),o=(f=n==null?void 0:n.write)==null?void 0:f.selectedWriteObjects,i=(h=n==null?void 0:n.write)==null?void 0:h.writeObjects,s=(v,p)=>{v!=="indeterminate"&&t&&n&&Mc(t,r,p,v)},a=v=>{var p,x;t&&n&&((x=(p=n==null?void 0:n.write)==null?void 0:p.writeObjects)==null||x.forEach(g=>{Mc(t,r,g.objectName,v)}))},l=!!i,u=Object.keys(o||{}).length===((b=(m=n==null?void 0:n.write)==null?void 0:m.writeObjects)==null?void 0:b.length),d=!u&&Object.keys(o||{}).length>0;return l&&c.jsxs(c.Fragment,{children:[c.jsx(Ot,{string:`Allow ${e} to write to these objects`}),c.jsxs(Od,{children:[((i==null?void 0:i.length)||0)>=2&&c.jsx(Cd,{id:"select-all-fields",onCheckedChange:a,isIndeterminate:d,isChecked:u,label:"Select all"}),c.jsx(Ed,{children:i.map(v=>c.jsx(xd,{id:v.objectName,onCheckedChange:p=>s(p,v.objectName),isChecked:!!(o!=null&&o[v.objectName]),label:v.displayName},v.objectName))})]})]})}function Jb(){return c.jsx(c.Fragment,{children:c.jsx(Bb,{})})}const Wb="_authenticationRow_cjz1t_1",zb="_field_cjz1t_8",Gb="_value_cjz1t_12",Wo={authenticationRow:Wb,field:zb,value:Gb};function kc({label:e,value:t}){return c.jsxs("div",{className:Wo.authenticationRow,children:[c.jsx("div",{className:Wo.field,children:e}),c.jsx("div",{className:Wo.value,children:t})]})}function Qb(){const{selectedConnection:e}=Qt(),{providerName:t}=ct(),r=(e==null?void 0:e.provider)==="salesforce"?"subdomain":"workspace",o=`${t} ${r}`;return c.jsxs(c.Fragment,{children:[c.jsx(Ot,{string:"Connection details"}),c.jsxs("div",{style:{paddingBottom:"1rem"},children:[c.jsx(kc,{label:o,value:e==null?void 0:e.providerWorkspaceRef}),c.jsx(kc,{label:"Status",value:e==null?void 0:e.status})]})]})}const Xb=()=>{const e=dt(),t=Et();return Wr({mutationFn:async({projectIdOrName:n,integrationId:r,installationId:o})=>(await e()).installationApi.deleteInstallation({projectIdOrName:n,integrationId:r,installationId:o}),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]})},onError:n=>{console.error("Error uninstalling installation."),Le(n)}})};function Nd({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const{projectId:r}=Te(),{integrationId:o,installation:i,setIntegrationDeleted:s,onUninstallSuccess:a}=rt(),[l,u]=y.useState(!1),d=!r||!o||!(i!=null&&i.id)||l,f=Xb(),h=async()=>{d||(u(!0),console.warn("uninstalling installation",{projectId:r,integrationId:o,installationId:i.id}),f.mutate({projectIdOrName:r,integrationId:o,installationId:i.id},{onSuccess:()=>{console.warn("successfully uninstalled installation:",i.id),a==null||a(i==null?void 0:i.id),s()},onSettled:()=>u(!1)}))},m=l?"Uninstalling...":e,b=c.jsx(ze,{type:"button",onClick:h,disabled:d,variant:t,style:n,children:m});return i!=null&&i.id?b:null}function Yb(){const{installation:e}=rt(),{providerName:t}=ct();return e?c.jsxs(c.Fragment,{children:[c.jsx(Ot,{string:"Uninstall entire integration"}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",padding:"1rem 0"},children:[e!=null&&e.id?c.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:["By clicking below, you will uninstall the entire ",t," ","integration. You will lose any configuration you've set up."]}):c.jsx("p",{children:"You've successfully uninstalled the integration."}),c.jsx(Nd,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})]}):null}function qn({error:e}){return e?c.jsx(wi,{style:{marginTop:"2em"},children:e}):null}const Zb="_input_1ymb7_1",e_="_inputError_1ymb7_27",t_="_error_1ymb7_43",zo={input:Zb,inputError:e_,error:t_};function n_({id:e,type:t,className:n,isError:r=!1,...o}){const i=r?Ft(zo.inputError,zo.input):zo.input;return c.jsx("input",{id:e,type:t,className:Ft(i,n),...o})}const r_="_textarea_18zl4_1",i_="_textareaError_18zl4_14",o_="_error_18zl4_29",Go={textarea:r_,textareaError:i_,error:o_};function s_({className:e,isError:t=!1,...n}){const r=t?Ft(Go.textareaError,Go.textarea):Go.textarea;return c.jsx("textarea",{className:Ft(e,r),...n})}const mn={Input:n_,Textarea:s_},a_=()=>{const{project:e}=Te(),t=e==null?void 0:e.id,n=dt();return yn({queryKey:["project",t,"entitlements"],queryFn:async()=>{if(!t)throw new Error("Project ID is required");return(await n()).projectApi.getProject({projectIdOrName:t,includeEntitlements:!0})},enabled:!!t})};function Td(){var n,r;const{data:e}=a_();return((r=(n=e==null?void 0:e.entitlements)==null?void 0:n.brandingRemoval)==null?void 0:r.value)===!0?null:c.jsxs("footer",{style:{backgroundColor:"light-dark(#EFEFEF, #646266)",padding:"1em",fontSize:"0.8em",color:"gray",display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"0 0 4px 4px",gap:"0.4em"},children:[c.jsx("p",{style:{color:"light-dark(gray, #EFEFEF)"},children:"Secured by"}),c.jsx("a",{href:"https://www.withampersand.com/",target:"_blank","aria-label":"Go to Ampersand",rel:"noreferrer noopener",children:c.jsxs("picture",{children:[c.jsx("source",{srcSet:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",media:"(prefers-color-scheme: light)"}),c.jsx("source",{srcSet:"https://res.cloudinary.com/dycvts6vp/image/upload/v1735853540/ampersand_logo_white.svg",media:"(prefers-color-scheme: dark)"}),c.jsx("img",{style:{height:".8em"},src:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",alt:"Ampersand"})]})})]})}function gr({children:e}){return c.jsx(zr,{children:c.jsxs(vn,{children:[c.jsx("div",{style:{padding:"3rem 2rem"},children:e}),c.jsx(Td,{})]})})}function yr({children:e}){return c.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function c_({children:e}){return c.jsx("p",{style:{padding:".5em 0"},children:e})}const l_="_link_oo2kv_1",u_={link:l_};function Rd({href:e,className:t,style:n,label:r,children:o,newTab:i=!1}){return c.jsx("a",{className:Ft(u_.link,t),style:n,href:e,"aria-label":r||void 0,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:o})}function Ad({url:e,providerDisplayName:t,credentialName:n}){return c.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[c.jsx(Rd,{href:e,newTab:!0,children:c.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," ","about where to find your ",t," ",n,"."]})}function Pd({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o,submitButtonType:i}){var p;const[s,a]=y.useState(!1),l=()=>a(x=>!x),[u,d]=y.useState(""),f=x=>d(x.currentTarget.value),{providerName:h}=ct(e),m=u.length>0,b=r||!m,v=(p=t.apiKeyOpts)==null?void 0:p.docsURL;return c.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[v&&c.jsx(Ad,{url:v,providerDisplayName:h||kr(e),credentialName:"API key"}),c.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[c.jsx(mn.Input,{id:"password",name:"password",type:s?"text":"password",placeholder:"API Key",onChange:x=>f(x)}),c.jsx(ze,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:l,variant:o,children:s?"Hide":"Show"})]}),c.jsx(ze,{style:{marginTop:"1em",width:"100%"},disabled:b,type:i||"submit",onClick:()=>n({apiKey:u}),variant:o,children:"Next"})]})}function d_({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=ct(e);return c.jsxs(gr,{children:[c.jsx(yr,{children:`Set up ${i} integration`}),c.jsx(qn,{error:r}),c.jsx(Pd,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function f_({...e}){return c.jsx(d_,{...e})}const p_={backgroundColor:"var(--amp-colors-status-success-muted)",borderColor:"var(--amp-colors-status-success-muted)",color:"var(--amp-colors-status-success-dark)",padding:".5rem 1rem"};function Oo({children:e,style:t}){return c.jsx(vn,{style:{...p_,...t},children:e})}const ya=()=>{const e=dt(),t=Et(),[n,r]=y.useState(null);return{...Wr({mutationKey:["updateConnection"],mutationFn:async i=>(await e()).connectionApi.updateConnection(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)}}),errorMsg:n}};function h_({provider:e}){const{projectIdOrName:t}=Te(),{providerName:n,data:r}=ct(e),{selectedConnection:o,isConnectionsLoading:i}=Qt(),{mutateAsync:s,isPending:a,error:l}=ya(),[u,d]=y.useState(null),[f,h]=y.useState(!1),m=()=>h(!1),b=()=>{h(!0),d(null)},v=(l==null?void 0:l.message)||u||null,p=async x=>{m(),d(null);try{await s({projectIdOrName:t||"",connectionId:(o==null?void 0:o.id)||"",updateConnectionRequest:{updateMask:["apiKey"],connection:{apiKey:x.apiKey}}},{onError:g=>{console.error("Update connection error:",g),Le(g,d)},onSuccess:()=>{b()}})}catch(g){console.error("Update connection caught error:",g),Le(g,d)}};return r?c.jsxs(c.Fragment,{children:[c.jsx(Ot,{string:"Update connection"}),c.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[c.jsx("p",{children:`Update ${n} API Key`}),f&&c.jsx(Oo,{children:"Connection updated successfully"}),v&&c.jsx(wi,{children:`Error updating connection ${v}`}),c.jsx(Pd,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:p,isButtonDisabled:a||i,buttonVariant:"ghost",submitButtonType:"button"})]})]}):null}function Fd({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o}){var p;const[i,s]=y.useState(!1),a=()=>s(x=>!x),[l,u]=y.useState({username:"",password:""}),{username:d,password:f}=l,{providerName:h}=ct(e),m=x=>{const{name:g,value:w}=x.currentTarget;u(_=>({..._,[g]:w}))},b=r,v=(p=t.basicOpts)==null?void 0:p.docsURL;return c.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[v&&c.jsx(Ad,{url:v,providerDisplayName:h||kr(e),credentialName:"credentials"}),c.jsx(mn.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:x=>m(x)}),c.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[c.jsx(mn.Input,{id:"password",name:"password",type:i?"text":"password",placeholder:"Password",onChange:x=>m(x)}),c.jsx(ze,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,variant:o,children:i?"Hide":"Show"})]}),c.jsx(ze,{style:{marginTop:"1em",width:"100%"},disabled:b,type:"button",onClick:()=>n({user:d,pass:f}),variant:o,children:"Next"})]})}function m_({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=ct(e);return c.jsxs(gr,{children:[c.jsx(yr,{children:`Set up ${i} integration`}),c.jsx(qn,{error:r}),c.jsx(Fd,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function g_({...e}){return c.jsx(m_,{...e})}function y_({provider:e}){const{projectIdOrName:t}=Te(),{providerName:n,data:r}=ct(e),{selectedConnection:o,isConnectionsLoading:i}=Qt(),{mutateAsync:s,isPending:a,error:l}=ya(),[u,d]=y.useState(null),[f,h]=y.useState(!1),m=()=>h(!1),b=()=>{h(!0),d(null)},v=(l==null?void 0:l.message)||u||null,p=async x=>{m(),d(null);try{await s({projectIdOrName:t||"",connectionId:(o==null?void 0:o.id)||"",updateConnectionRequest:{updateMask:["basicAuth"],connection:{basicAuth:{username:x.user,password:x.pass}}}},{onError:g=>{console.error(g),Le(g,d)},onSuccess:()=>{b()}})}catch(g){console.error(g),Le(g,d)}};return r?c.jsxs(c.Fragment,{children:[c.jsx(Ot,{string:"Update connection"}),c.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[c.jsx("p",{children:`Update ${n} credentials`}),f&&c.jsx(Oo,{children:"Connection updated successfully"}),v&&c.jsx(wi,{children:`Error updating connection: ${v}`}),c.jsx(Fd,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:p,isButtonDisabled:a||i,buttonVariant:"ghost"})]})]}):null}function Dd({handleSubmit:e,isButtonDisabled:t,explicitScopesRequired:n,explicitWorkspaceRequired:r,buttonVariant:o}){const[i,s]=y.useState(!1),[a,l]=y.useState({clientSecret:"",clientId:"",workspace:"",scopes:""}),u=()=>s(_=>!_),d=_=>{const{name:C,value:N}=_.currentTarget;l(R=>({...R,[C]:N}))},{clientSecret:f,clientId:h,workspace:m,scopes:b}=a,v=f.length>0,p=h.length>0,x=r?m.length>0:!0,g=t||!v||!p||!x,w=()=>{const _={clientId:h,clientSecret:f};r&&(_.workspace=m),n&&b.length>0&&(_.scopes=By(b)),e(_)};return c.jsxs(c.Fragment,{children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[r&&c.jsx(mn.Input,{id:"workspace",name:"workspace",type:"text",placeholder:"MyWorkspace",onChange:_=>d(_)}),c.jsx(mn.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:_=>d(_)}),c.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[c.jsx(mn.Input,{id:"clientSecret",name:"clientSecret",type:i?"text":"password",placeholder:"Client Secret",onChange:_=>d(_)}),c.jsx(ze,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:u,variant:o,children:i?"Hide":"Show"})]}),n&&c.jsx(mn.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:_=>d(_)})]}),c.jsx("br",{}),c.jsx(ze,{style:{width:"100%"},disabled:g,type:"button",onClick:w,variant:o,children:"Next"})]})}function v_({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,explicitScopesRequired:o,explicitWorkspaceRequired:i}){return c.jsxs(gr,{children:[c.jsx(yr,{children:`Set up ${r} integration`}),c.jsx(qn,{error:t}),c.jsx("br",{}),c.jsx(Dd,{handleSubmit:e,isButtonDisabled:n,explicitScopesRequired:o,explicitWorkspaceRequired:i})]})}function w_({provider:e}){var g;const{projectIdOrName:t}=Te(),{selectedConnection:n,isConnectionsLoading:r}=Qt(),{providerName:o,data:i}=ct(e),{mutateAsync:s,isPending:a,error:l}=ya(),[u,d]=y.useState(null),[f,h]=y.useState(!1),m=()=>{h(!1)},b=()=>{h(!0),d(null)},v=(g=i==null?void 0:i.oauth2Opts)==null?void 0:g.explicitScopesRequired,p=(l==null?void 0:l.message)||u||null,x=async w=>{m(),d(null);try{await s({projectIdOrName:t||"",connectionId:(n==null?void 0:n.id)||"",updateConnectionRequest:{updateMask:["oauth2ClientCredentials"],connection:{oauth2ClientCredentials:{clientId:w.clientId,clientSecret:w.clientSecret,scopes:w.scopes}}}}),b()}catch(_){Le(_,d)}};return c.jsxs(c.Fragment,{children:[c.jsx(Ot,{string:"Update connection"}),c.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[c.jsx("p",{children:`Re-authenticate to ${o}`}),f&&c.jsx(Oo,{children:"Connection updated successfully"}),p&&c.jsx(wi,{children:`Error updating connection ${p}`}),c.jsx(Dd,{handleSubmit:x,isButtonDisabled:a||r,explicitScopesRequired:v,explicitWorkspaceRequired:!1,buttonVariant:"ghost"})]})]})}const jc=600,Lc=600,I_="AUTHORIZATION_SUCCEEDED",b_="AUTHORIZATION_FAILED";function __(e,t,n,r){return y.useCallback(()=>{if(!r)return;const o=window.screenX+(window.outerWidth-jc)/2,i=window.screenY+(window.outerHeight-Lc)/2.5,s=`width=${jc},height=${Lc},left=${o},top=${i}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function x_(e,t,n,r){const o=Et();return y.useCallback(i=>{var s,a;if(i.origin===_y){if(i.data.eventType===I_){const l=(s=i.data.data)==null?void 0:s.connection;l?(e(l),t==null||t.close(),r==null||r(),o.invalidateQueries({queryKey:["amp","connections"]})):console.error("Connection ID not found in event data: ",{event:i})}i.data.eventType===b_&&(console.error("OAuth failed: ",{event:i}),n==null||n(((a=i==null?void 0:i.data)==null?void 0:a.message)??"Something went wrong. Please try again."))}},[t,n,o,e,r])}function va({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:o,onSuccessConnect:i,isSuccessConnect:s}){const[a,l]=y.useState(null),[u,d]=y.useState(null),f=x_(l,u,r,i),h=__(n,d,f,t);return y.useEffect(()=>{t&&!u&&!a&&!o&&!s&&h()},[t,u,h,a,o,s]),y.useEffect(()=>{if(!u)return;const m=setInterval(()=>{u.closed&&(clearInterval(m),window.removeEventListener("message",f),d(null),!a&&!o?(console.error("OAuth failed. Please try again."),r==null||r("Authentication was cancelled. Please try again.")):a&&(r==null||r(null)))},500);return()=>{clearInterval(m),window.removeEventListener("message",f)}},[u,a,o,f,r]),c.jsx("div",{children:e})}const C_=()=>{const e=dt(),t=Et();return Wr({mutationKey:["updateOauthConnection"],mutationFn:async n=>{const r=await e();if(!n.projectIdOrName||!n.connectionId)throw new Error("Project ID and connection ID are required");return r.oAuthApi.oauthUpdate(n)},onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})};function O_({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return c.jsxs("div",{style:{padding:"1rem 0"},children:[c.jsx("p",{children:`Re-authenticate to ${r}`}),c.jsx(qn,{error:t}),c.jsx(ze,{variant:"ghost",style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function E_({provider:e}){const{selectedConnection:t,isConnectionsLoading:n}=Qt(),r=t==null?void 0:t.id,o=t==null?void 0:t.projectId,{providerName:i}=ct(e),{mutateAsync:s,isPending:a,error:l}=C_(),[u,d]=y.useState(null),[f,h]=y.useState(!1),[m,b]=y.useState(null),v=()=>{h(!1)},p=()=>{h(!0),d(null),b(null)},x=(l==null?void 0:l.message)||u||null,g=async()=>{v(),d(null);try{const _=await s({projectIdOrName:o||"",connectionId:r||""});b(_)}catch(_){Le(_,d)}},w=y.useCallback(_=>{d(_)},[]);return c.jsxs(c.Fragment,{children:[c.jsx(Ot,{string:"Update connection"}),f&&c.jsx(Oo,{children:"Connection updated successfully"}),c.jsx(va,{windowTitle:`Connect to ${i}`,oauthUrl:m||null,onError:w,error:x,isSuccessConnect:f,onSuccessConnect:p,children:c.jsx(O_,{handleSubmit:g,error:x,providerName:i,isButtonDisabled:a||n||f})})]})}function Md({provider:e}){var r;const{data:t}=ha(e);if((t==null?void 0:t.authType)===$a.Basic)return c.jsx(y_,{provider:e});if((t==null?void 0:t.authType)===$a.ApiKey)return c.jsx(h_,{provider:e});const n=(r=t==null?void 0:t.oauth2Opts)==null?void 0:r.grantType;if(n){if(n===Do.AuthorizationCode||n===Do.AuthorizationCodePkce)return c.jsx(E_,{provider:e});if(n===Do.ClientCredentials)return c.jsx(w_,{provider:e})}return null}function S_(){return c.jsxs(c.Fragment,{children:[c.jsx(Qb,{}),c.jsx(Md,{}),c.jsx(Yb,{})]})}function kd({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:o}){var N,R,T,F;const{installation:i}=rt(),{hydratedRevision:s,loading:a}=Qr(),{configureState:l,selectedObjectName:u}=Xt(),d=i==null?void 0:i.config,f=d&&u&&!!Bl(d,u)||!1,h=((N=l==null?void 0:l.read)==null?void 0:N.isOptionalFieldsModified)||((R=l==null?void 0:l.read)==null?void 0:R.isRequiredMapFieldsModified)||((T=l==null?void 0:l.read)==null?void 0:T.isValueMappingsModified),m=(F=l==null?void 0:l.write)==null?void 0:F.isWriteModified,x=a||n||!l||!u||!(h||m||r||u!==dr&&!f),g=u===dr,w=u===Zi,_=c.jsx(ze,{type:"submit",disabled:x,children:r?"Install":"Save"}),C=c.jsx(ze,{type:"button",onClick:t,disabled:x,variant:"ghost",children:"Reset"});return n?c.jsx(ci,{}):c.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[c.jsx("div",{style:{display:"flex",flexDirection:"row-reverse",gap:".8rem",marginBottom:"20px",height:"3rem"},children:!w&&c.jsxs(c.Fragment,{children:[_,C]})}),c.jsxs(vn,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[o&&c.jsx(wi,{children:typeof o=="string"?o:"Installation Failed."}),a&&c.jsx(ci,{}),s&&!g&&!w&&c.jsx(qb,{}),s&&g&&!w&&c.jsx(Jb,{}),!a&&w&&c.jsx(S_,{})]})]})}const jd=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:o,onUpdateSuccess:i}=rt(),{hydratedRevision:s,loading:a}=Qr(),{selectedObjectName:l}=rd(),{selectedConnection:u}=Qt(),d=cl(),{projectId:f}=Te(),{resetBoundary:h,setErrors:m,setError:b,getError:v}=Dt(),{resetConfigureState:p,objectConfigurationsState:x,resetPendingConfigurationState:g}=fa(),w=tu(l||"",x),{onNextIncompleteTab:_}=SI(),C=y.useCallback(()=>{h(ue.INSTALLATION_MUTATION)},[h]),N=y.useCallback(T=>T?F=>{b(ue.INSTALLATION_MUTATION,T,F)}:F=>{console.error("objectName is required to set installation error: ",F)},[b]),R=y.useCallback(T=>T?v(ue.INSTALLATION_MUTATION,T):"",[v]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:s,loading:a,selectedObjectName:l,selectedConnection:u,apiKey:d,projectId:f,resetBoundary:h,setErrors:m,setMutateInstallationError:N,getMutateInstallationError:R,resetMutateInstallationErrorState:C,resetConfigureState:p,objectConfigurationsState:x,resetPendingConfigurationState:g,configureState:w,onInstallSuccess:o,onUpdateSuccess:i,onNextIncompleteTab:_}},N_=void 0;function T_(){const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:o,loading:i,selectedObjectName:s,selectedConnection:a,apiKey:l,projectId:u,resetBoundary:d,setErrors:f,setMutateInstallationError:h,getMutateInstallationError:m,resetMutateInstallationErrorState:b,resetConfigureState:v,objectConfigurationsState:p,resetPendingConfigurationState:x,configureState:g,onInstallSuccess:w,onNextIncompleteTab:_}=jd(),[C,N]=y.useState(!1),R=s===dr,T=m(s),F=y.useCallback(()=>{d(ue.MAPPING),o!=null&&o.content&&!i&&s&&Xl(o,N_,s,v)},[d,o,i,s,v]);y.useEffect(()=>{!g&&(o!=null&&o.content)&&!i&&F()},[g,p,o,i,F]);const U=()=>{b();const{requiredMapFields:Y,selectedFieldMappings:B}=(g==null?void 0:g.read)||{},{errorList:ce}=zl(Y,B,f);ce.length>0||(s&&(a!=null&&a.id)&&l&&u&&e&&t&&n&&o?(N(!0),uv(u,e,t,n,a.id,s,l,o,g,h(s),r,w).finally(()=>{N(!1),x(s),_()})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},Q=()=>{b(),s&&(a!=null&&a.id)&&l&&u&&e&&t&&n&&o?(N(!0),pv(u,e,t,n,a.id,l,o,g,h(s),r,w).finally(()=>{N(!1),x(s),_()})):console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},J=Y=>{Y.preventDefault(),R?Q():U()};return c.jsx(kd,{errorMsg:T,isCreateMode:!0,isLoading:C,onSave:J,onReset:F})}function R_({updateConfig:e,projectId:t,integrationId:n,installationId:r,apiKey:o,selectedObjectName:i,setInstallation:s,onUpdateSuccess:a,setError:l}){const u={projectIdOrName:t,installationId:r,integrationId:n,installationUpdate:{updateMask:[`config.content.read.objects.${Wy(i)}`],installation:{config:e}}};return js().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=>{Le(d,l)})}const A_=(e,t,n,r,o,i)=>{const s=Yl(e),a=Zl(e),l=eu(e),u={content:{read:{objects:{[t]:{objectName:t,schedule:r,destination:(n==null?void 0:n.destination)||"",selectedFields:s,selectedFieldMappings:a,selectedValueMappings:l||{},backfill:i}}}}};return vi(o)&&(u.content||(u.content={}),u.content.proxy={enabled:!0}),u},P_=(e,t,n,r,o,i,s,a,l,u,d)=>{const f=A_(i,r||"",a,a.schedule,l,a.backfill);return f?R_({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))},F_=(e,t)=>{const r={content:{write:{objects:ru(e)}}};return vi(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r},D_=(e,t,n,r,o,i,s,a,l)=>{const u=F_(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 js().installationApi.updateInstallation(d,{headers:{"X-Api-Key":r,"Content-Type":"application/json"}}).then(f=>{a(f),l==null||l(f.id,f.config)}).catch(f=>{Le(f,s)})};function M_({installation:e,integrationObj:t}){const{setInstallation:n,hydratedRevision:r,loading:o,selectedObjectName:i,apiKey:s,projectId:a,resetBoundary:l,setErrors:u,setMutateInstallationError:d,getMutateInstallationError:f,resetConfigureState:h,resetPendingConfigurationState:m,configureState:b,onUpdateSuccess:v,onNextIncompleteTab:p}=jd(),[x,g]=y.useState(!1),w=i===dr,_=f(i),{config:C}=e,N=y.useCallback(()=>{l(ue.MAPPING),r!=null&&r.content&&!o&&i&&Xl(r,C,i,h)},[l,r,o,i,C,h]);y.useEffect(()=>{b||N()},[b,N]);const R=y.useMemo(()=>{var J,Y,B;return(B=(Y=(J=r==null?void 0:r.content)==null?void 0:J.read)==null?void 0:Y.objects)==null?void 0:B.find(ce=>(ce==null?void 0:ce.objectName)===i)},[r,i]),T=()=>{const{requiredMapFields:Q,selectedFieldMappings:J}=(b==null?void 0:b.read)||{},{errorList:Y}=zl(Q,J,u);Y.length>0||(r&&e&&i&&s&&a&&R?(g(!0),P_(a,t.id,e.id,i,s,b,n,R,r,d(i),v).finally(()=>{g(!1),m(i),p()})):console.error("UpdateInstallation - onSaveUpdate missing required props"))},F=()=>{e&&i&&s&&a&&r?(g(!0),D_(a,t.id,e.id,s,b,r,d(i),n,v).finally(()=>{g(!1),m(i),p()})):console.error("UpdateInstallation - onSaveUpdate missing required props")},U=Q=>{Q.preventDefault(),w?F():T()};return c.jsx(kd,{errorMsg:_,onSave:U,onReset:N,isLoading:x})}function k_(){const{integrationObj:e,installation:t}=rt();return e?t&&e?c.jsx(M_,{installation:t,integrationObj:e}):c.jsx(T_,{}):c.jsx(kl,{message:"We can't load the integration"})}const j_=()=>{const e=dt(),t=Et(),[n,r]=y.useState(null);return{...Wr({mutationKey:["createInstallation"],mutationFn:async i=>(await e()).installationApi.createInstallation(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:i=>{console.error("Error creating installation"),Le(i,r)}}),errorMsg:n}};function L_(){return c.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),c.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function wa({text:e,children:t}){return c.jsx(zr,{children:c.jsxs(vn,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[c.jsx(L_,{}),c.jsx("p",{children:e}),t]})})}function K_({provider:e}){const{providerName:t}=ct(e),n=`You have successfully installed your ${t} integration.`;return c.jsx(wa,{text:n,children:c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:c.jsx(Nd,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const V_=e=>{const{read:t,write:n}=(e==null?void 0:e.content)??{};return!t&&!n};function U_({children:e}){var C;const t=y.useRef(!1),{projectId:n}=Te(),{hydratedRevision:r,loading:o}=Qr(),{integrationObj:i,installation:s,groupRef:a,consumerRef:l,onInstallSuccess:u,isIntegrationDeleted:d}=rt(),{mutate:f,isIdle:h,isPending:m,error:b,errorMsg:v}=j_(),{selectedConnection:p,isConnectionsLoading:x}=Qt(),g=o||m||x,w=(C=r==null?void 0:r.content)==null?void 0:C.provider,_=V_(r);return y.useEffect(()=>{var N;if(!g&&!x&&r&&_&&!s&&p&&(i!=null&&i.id)&&!d&&w){const R={projectIdOrName:n,integrationId:i==null?void 0:i.id,installation:{groupRef:a,connectionId:p==null?void 0:p.id,config:{content:{provider:w}}}};vi(r)===!0&&(R.installation.config.content.proxy=(N=r==null?void 0:r.content)==null?void 0:N.proxy),h&&!t.current&&(f(R,{onSuccess:T=>{u==null||u(T==null?void 0:T.id,T.config)}}),t.current=!0)}},[r,_,s,p,n,i==null?void 0:i.id,a,l,g,u,d,x,w,f,h]),_&&w&&s?c.jsx(K_,{provider:w}):b?c.jsx(Jt,{message:v??"Create installation failed"}):i?g?c.jsx(Gr,{}):c.jsx("div",{children:e}):c.jsx(Jt,{message:"We can't load the integration"})}function Eo(){const e=dt(),t=Et();return Wr({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"),Le(n)}})}function $_({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:l}=Te(),u=Eo(),d=y.useCallback(f=>{const{apiKey:h}=f,m={projectIdOrName:l,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,apiKey:h}};u.mutate(m)},[l,i,o,r,n,e,u]);return a===null?c.jsx(f_,{provider:e,providerInfo:t,handleSubmit:d,error:null}):s}function q_({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:l}=Te(),u=Eo(),d=y.useCallback(f=>{const{user:h,pass:m}=f,b={projectIdOrName:l,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:h,password:m}}};u.mutate(b)},[l,i,o,r,n,e,u]);return a===null?c.jsx(g_,{provider:e,providerInfo:t,handleSubmit:d,error:null}):s}function H_({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,children:o,title:i}){if(!i&&!r)throw new Error("Either title or providerName is required");return c.jsxs(gr,{children:[c.jsx(yr,{children:i||`Set up ${r} integration`}),c.jsx(qn,{error:t}),o,c.jsx(ze,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function B_({...e}){return c.jsx(H_,{...e})}function J_({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s,providerName:a}){const{projectIdOrName:l}=Te(),u=Eo(),d=y.useCallback(()=>{const f={projectIdOrName:l,generateConnectionParams:{groupName:o,groupRef:r,consumerName:n,consumerRef:t,provider:e}};u.mutate(f)},[l,o,r,n,t,e,u]);return s===null?c.jsx(B_,{handleSubmit:d,error:null,providerName:a}):i}const W_=()=>{const e=dt(),{projectIdOrName:t}=Te();return yn({queryKey:["amp","providerApps",t],queryFn:async()=>{if(!t)throw new Error("Project ID is required");return(await e()).providerAppApi.listProviderApps({projectIdOrName:t})},enabled:!!t})},z_=e=>{const t=dt(),n={connectOAuthParams:e};return yn({queryKey:["amp","oauthConnect",e.projectId,e.groupRef,e.consumerRef,e.provider],queryFn:async()=>{if(!e.projectId)throw new Error("Project ID is required");if(!(e!=null&&e.providerAppId))throw new Error("Provider App ID is required");if(!(e!=null&&e.provider))throw new Error("Provider is required");if(!(e!=null&&e.consumerRef))throw new Error("Consumer Ref is required");if(!(e!=null&&e.groupRef))throw new Error("Group Ref is required");return(await t()).oAuthApi.oauthConnect(n)},enabled:!1})},G_=Ks("VITE_AMP_ENABLE_CSRF",!1),Q_=Ks("NEXT_AMP_ENABLE_CSRF",!1),X_=Ks("REACT_APP_AMP_ENABLE_CSRF",!1),Y_=!!G_||!!Q_||!!X_,Ld=(e,t,n,r,o,i)=>{const{projectId:s}=Te(),{data:a,isLoading:l,error:u}=ha(n),{data:d,isLoading:f,error:h}=W_(),m=d==null?void 0:d.find(C=>C.provider===n),b=a?Kl(n,a):null,v={providerWorkspaceRef:r,projectId:s,groupRef:t,groupName:i,consumerRef:e,consumerName:o,providerAppId:m==null?void 0:m.id,provider:n,enableCSRFProtection:Y_},{data:p,error:x,isLoading:g,refetch:w}=z_(v);return y.useEffect(()=>{a&&n&&!m&&console.error(`You must first set up a ${b} Provider App using the Ampersand Console.`)},[m,b,a,n]),y.useEffect(()=>{u&&(console.error("Error fetching provider info:",u),Le(u))},[u]),y.useEffect(()=>{h&&(console.error("Error fetching provider apps:",h),Le(h))},[h]),y.useEffect(()=>{x&&(console.error("Error fetching OAuth connect:",x),Le(x))},[x]),{url:p,error:u||h||x,isLoading:l||f||g,refetchOauthConnect:()=>{var C,N;(a==null?void 0:a.authType)==="oauth2"?((C=a==null?void 0:a.oauth2Opts)==null?void 0:C.grantType)==="authorizationCode"||((N=a==null?void 0:a.oauth2Opts)==null?void 0:N.grantType)==="authorizationCodePKCE"?w():console.error("Provider does not support an OAuth2 web flow grant type."):console.error("Provider does not support an OAuth2 web flow.")}}};function Z_({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return c.jsxs(gr,{children:[c.jsx(yr,{children:`Set up ${r} integration`}),c.jsx(c_,{children:`Click Next to sign into the ${r} account you'd like to sync.`}),c.jsx(qn,{error:t}),c.jsx(ze,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function ex({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){const[s,a]=y.useState(null),{url:l,error:u,isLoading:d,refetchOauthConnect:f}=Ld(t,r,e,void 0,n,o),h=(u==null?void 0:u.message)||s||null,m=async()=>{a(null),f()},b=y.useCallback(p=>{a(p)},[a]),v=y.useCallback(()=>{a(null)},[a]);return c.jsx(va,{windowTitle:`Connect to ${i}`,oauthUrl:l||null,onError:b,error:h,onSuccessConnect:v,children:c.jsx(Z_,{handleSubmit:m,error:h,providerName:i,isButtonDisabled:d})})}const tx="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function nx({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return c.jsxs(gr,{children:[c.jsx(yr,{children:"Enter your Salesforce subdomain"}),c.jsx(Rd,{href:tx,newTab:!0,children:"What is my Salesforce subdomain?"}),c.jsx(qn,{error:n}),c.jsxs("div",{style:{display:"flex",marginTop:"1em",alignItems:"center"},children:[c.jsx(mn.Input,{id:"salesforce-subdomain",type:"text",placeholder:"my-domain",onChange:o=>t(o.currentTarget.value)}),c.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),c.jsx(ze,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function rx({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r,providerName:o}){return c.jsxs(gr,{children:[c.jsxs(yr,{children:["Enter your ",o," workspace"]}),c.jsx(qn,{error:n}),c.jsx("br",{}),c.jsx(mn.Input,{id:"workspace",type:"text",placeholder:"MyWorkspace",onChange:i=>t(i.currentTarget.value)}),c.jsx("br",{}),c.jsx(ze,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const ix="salesforce";function ox({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){const[s,a]=y.useState(""),[l,u]=y.useState(null),{url:d,error:f,isLoading:h,refetchOauthConnect:m}=Ld(t,r,e,s,n,o),b=(f==null?void 0:f.message)||l||null,v=async()=>{if(u(null),!s){u("Workspace is required");return}m()},p=y.useCallback(g=>{u(g)},[]),x=e===ix?c.jsx(nx,{handleSubmit:v,setWorkspace:a,error:b,isButtonDisabled:s.length===0}):c.jsx(rx,{handleSubmit:v,setWorkspace:a,error:b,isButtonDisabled:s.length===0||h,providerName:i});return c.jsx(va,{windowTitle:`Connect to ${i}`,oauthUrl:d||null,onError:p,error:b,children:x})}function sx({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,explicitScopesRequired:s,explicitWorkspaceRequired:a,selectedConnection:l}){const{projectIdOrName:u}=Te(),d=Eo(),[f,h]=y.useState(null),m=y.useCallback(b=>{h(null);const v={projectIdOrName:u,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:b.workspace,oauth2ClientCredentials:{clientId:b.clientId,clientSecret:b.clientSecret,scopes:b.scopes}}};d.mutate(v,{onError:()=>h("Error loading provider info")})},[u,i,o,r,n,e,d]);return l===null?c.jsx(v_,{providerName:t,handleSubmit:m,error:f,explicitScopesRequired:s,explicitWorkspaceRequired:a}):c.jsx(ci,{})}function ax({...e}){return c.jsx(sx,{...e})}const cx="authorizationCode",lx="authorizationCodePKCE",ux="clientCredentials";function dx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,selectedConnection:s,setSelectedConnection:a}){const{providerName:l}=ct(e);if(t.oauth2Opts===void 0)return c.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:u,explicitScopesRequired:d,explicitWorkspaceRequired:f}=t.oauth2Opts,h={provider:e,consumerRef:n,consumerName:r,groupRef:o,groupName:i,providerName:l};return u===cx||u===lx?f?c.jsx(ox,{...h}):c.jsx(ex,{...h}):u===ux?c.jsx(ax,{...h,explicitWorkspaceRequired:f,explicitScopesRequired:d,selectedConnection:s,setSelectedConnection:a}):u==="password"?c.jsx("em",{children:"Password flow not supported yet"}):c.jsxs("em",{children:["Unsupported grant type: ",u]})}function fx(e){const{selectedConnection:t}=Qt();y.useEffect(()=>{e&&t&&e(t)},[e,t])}function px({onSuccess:e}){fx(e)}function Kd({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,onSuccess:s,onDisconnectSuccess:a,resetComponent:l}){const{data:u,isLoading:d,isError:f,error:h,providerName:m,selectedProvider:b}=ct(e),{provider:v,isIntegrationDeleted:p}=rt(),{selectedConnection:x,setSelectedConnection:g}=Qt();px({onSuccess:s});const w=Et();y.useEffect(()=>{f&&(console.error("Error loading provider info."),Le(h))},[f,h]);const _=y.useCallback(()=>{w.clear(),l()},[l,w]);if(!e&&!v)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(p)return c.jsx(wa,{text:"Integration successfully uninstalled.",children:c.jsx(ze,{type:"button",onClick:_,style:{width:"100%"},children:"Reinstall Integration"})});if(x)return i;if(d)return c.jsx(Gr,{});if(u==null)return c.jsx(Jt,{message:"Provider info was not found."});const C={provider:b,consumerRef:t,consumerName:n,groupRef:r,groupName:o,selectedConnection:x,setSelectedConnection:g,providerName:m,providerInfo:u,onDisconnectSuccess:a};return u.authType==="none"?c.jsx(J_,{...C,children:i}):u.authType==="basic"?c.jsx(q_,{...C,children:i}):u.authType==="apiKey"?c.jsx($_,{...C,children:i}):c.jsx(dx,{...C})}function hx(e){const t=e+"CollectionProvider",[n,r]=xo(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=v=>{const{scope:p,children:x}=v,g=y.useRef(null),w=y.useRef(new Map).current;return c.jsx(o,{scope:p,itemMap:w,collectionRef:g,children:x})};s.displayName=t;const a=e+"CollectionSlot",l=Rs(a),u=y.forwardRef((v,p)=>{const{scope:x,children:g}=v,w=i(a,x),_=Hr(p,w.collectionRef);return c.jsx(l,{ref:_,children:g})});u.displayName=a;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=Rs(d),m=y.forwardRef((v,p)=>{const{scope:x,children:g,...w}=v,_=y.useRef(null),C=Hr(p,_),N=i(d,x);return y.useEffect(()=>(N.itemMap.set(_,{ref:_,...w}),()=>void N.itemMap.delete(_))),c.jsx(h,{[f]:"",ref:C,children:g})});m.displayName=d;function b(v){const p=i(e+"CollectionConsumer",v);return y.useCallback(()=>{const g=p.collectionRef.current;if(!g)return[];const w=Array.from(g.querySelectorAll(`[${f}]`));return Array.from(p.itemMap.values()).sort((N,R)=>w.indexOf(N.ref.current)-w.indexOf(R.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:s,Slot:u,ItemSlot:m},b,r]}var mx=k[" useId ".trim().toString()]||(()=>{}),gx=0;function Vd(e){const[t,n]=k.useState(mx());return pi(()=>{e||n(r=>r??String(gx++))},[e]),e||(t?`radix-${t}`:"")}function yx(e){const t=k.useRef(e);return k.useEffect(()=>{t.current=e}),k.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}var vx=k.createContext(void 0);function Ud(e){const t=k.useContext(vx);return e||t||"ltr"}var Qo="rovingFocusGroup.onEntryFocus",wx={bubbles:!1,cancelable:!0},xi="RovingFocusGroup",[As,$d,Ix]=hx(xi),[bx,qd]=xo(xi,[Ix]),[_x,xx]=bx(xi),Hd=k.forwardRef((e,t)=>c.jsx(As.Provider,{scope:e.__scopeRovingFocusGroup,children:c.jsx(As.Slot,{scope:e.__scopeRovingFocusGroup,children:c.jsx(Cx,{...e,ref:t})})}));Hd.displayName=xi;var Cx=k.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,h=k.useRef(null),m=Hr(t,h),b=Ud(i),[v,p]=ma({prop:s,defaultProp:a??null,onChange:l,caller:xi}),[x,g]=k.useState(!1),w=yx(u),_=$d(n),C=k.useRef(!1),[N,R]=k.useState(0);return k.useEffect(()=>{const T=h.current;if(T)return T.addEventListener(Qo,w),()=>T.removeEventListener(Qo,w)},[w]),c.jsx(_x,{scope:n,orientation:r,dir:b,loop:o,currentTabStopId:v,onItemFocus:k.useCallback(T=>p(T),[p]),onItemShiftTab:k.useCallback(()=>g(!0),[]),onFocusableItemAdd:k.useCallback(()=>R(T=>T+1),[]),onFocusableItemRemove:k.useCallback(()=>R(T=>T-1),[]),children:c.jsx(wn.div,{tabIndex:x||N===0?-1:0,"data-orientation":r,...f,ref:m,style:{outline:"none",...e.style},onMouseDown:Wt(e.onMouseDown,()=>{C.current=!0}),onFocus:Wt(e.onFocus,T=>{const F=!C.current;if(T.target===T.currentTarget&&F&&!x){const U=new CustomEvent(Qo,wx);if(T.currentTarget.dispatchEvent(U),!U.defaultPrevented){const Q=_().filter(se=>se.focusable),J=Q.find(se=>se.active),Y=Q.find(se=>se.id===v),ce=[J,Y,...Q].filter(Boolean).map(se=>se.ref.current);Wd(ce,d)}}C.current=!1}),onBlur:Wt(e.onBlur,()=>g(!1))})})}),Bd="RovingFocusGroupItem",Jd=k.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:s,...a}=e,l=Vd(),u=i||l,d=xx(Bd,n),f=d.currentTabStopId===u,h=$d(n),{onFocusableItemAdd:m,onFocusableItemRemove:b,currentTabStopId:v}=d;return k.useEffect(()=>{if(r)return m(),()=>b()},[r,m,b]),c.jsx(As.ItemSlot,{scope:n,id:u,focusable:r,active:o,children:c.jsx(wn.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...a,ref:t,onMouseDown:Wt(e.onMouseDown,p=>{r?d.onItemFocus(u):p.preventDefault()}),onFocus:Wt(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:Wt(e.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){d.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const x=Sx(p,d.orientation,d.dir);if(x!==void 0){if(p.metaKey||p.ctrlKey||p.altKey||p.shiftKey)return;p.preventDefault();let w=h().filter(_=>_.focusable).map(_=>_.ref.current);if(x==="last")w.reverse();else if(x==="prev"||x==="next"){x==="prev"&&w.reverse();const _=w.indexOf(p.currentTarget);w=d.loop?Nx(w,_+1):w.slice(_+1)}setTimeout(()=>Wd(w))}}),children:typeof s=="function"?s({isCurrentTabStop:f,hasTabStop:v!=null}):s})})});Jd.displayName=Bd;var Ox={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Ex(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Sx(e,t,n){const r=Ex(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Ox[r]}function Wd(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Nx(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Tx=Hd,Rx=Jd,So="Tabs",[Ax,sC]=xo(So,[qd]),zd=qd(),[Px,Ia]=Ax(So),Gd=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:l="automatic",...u}=e,d=Ud(a),[f,h]=ma({prop:r,onChange:o,defaultProp:i??"",caller:So});return c.jsx(Px,{scope:n,baseId:Vd(),value:f,onValueChange:h,orientation:s,dir:d,activationMode:l,children:c.jsx(wn.div,{dir:d,"data-orientation":s,...u,ref:t})})});Gd.displayName=So;var Qd="TabsList",Xd=k.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=Ia(Qd,n),s=zd(n);return c.jsx(Tx,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:c.jsx(wn.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});Xd.displayName=Qd;var Yd="TabsTrigger",Zd=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=Ia(Yd,n),a=zd(n),l=tf(s.baseId,r),u=nf(s.baseId,r),d=r===s.value;return c.jsx(Rx,{asChild:!0,...a,focusable:!o,active:d,children:c.jsx(wn.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:l,...i,ref:t,onMouseDown:Wt(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:Wt(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:Wt(e.onFocus,()=>{const f=s.activationMode!=="manual";!d&&!o&&f&&s.onValueChange(r)})})})});Zd.displayName=Yd;var ef="TabsContent",Fx=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=Ia(ef,n),l=tf(a.baseId,r),u=nf(a.baseId,r),d=r===a.value,f=k.useRef(d);return k.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),c.jsx(ga,{present:o||d,children:({present:h})=>c.jsx(wn.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!h,id:u,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:h&&i})})});Fx.displayName=ef;function tf(e,t){return`${e}-trigger-${t}`}function nf(e,t){return`${e}-content-${t}`}var Dx=Gd,Mx=Xd,rf=Zd;const kx=c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[c.jsx("circle",{cx:"9",cy:"9",r:"9",fill:"#BBF7D0"}),c.jsx("path",{d:"M13 7L7.5 12L5 9.72727",stroke:"#16A34A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function jx(e,t){return t?y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},y.createElement("circle",{cx:"9",cy:"9",r:"5",fill:"#FBD38D"})):e?kx:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:c.jsx("circle",{cx:"9",cy:"9",r:"5",fill:"#BFDBFE"})})}function Lx(){return c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("path",{d:"M8 11C9.65685 11 11 9.65685 11 8C11 6.34315 9.65685 5 8 5C6.34315 5 5 6.34315 5 8C5 9.65685 6.34315 11 8 11Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M12.3378 5.04365C12.4882 5.25907 12.62 5.48699 12.7315 5.7249L14.3503 6.6249C14.5524 7.5302 14.5545 8.4687 14.3565 9.3749L12.7315 10.2749C12.62 10.5128 12.4882 10.7407 12.3378 10.9562L12.369 12.8124C11.683 13.4375 10.871 13.9085 9.98776 14.1937L8.39401 13.2374C8.13185 13.2562 7.86868 13.2562 7.60651 13.2374L6.01901 14.1874C5.13295 13.9075 4.31832 13.4383 3.63151 12.8124L3.66276 10.9624C3.51356 10.744 3.38189 10.5141 3.26901 10.2749L1.65026 9.3749C1.44814 8.46961 1.446 7.53111 1.64401 6.6249L3.26901 5.7249C3.38056 5.48699 3.5123 5.25907 3.66276 5.04365L3.63151 3.1874C4.31754 2.56226 5.1295 2.09128 6.01276 1.80615L7.60651 2.7624C7.86868 2.74365 8.13185 2.74365 8.39401 2.7624L9.98151 1.8124C10.8676 2.09234 11.6822 2.5615 12.369 3.1874L12.3378 5.04365Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const Kx="_tabsRoot_ktpr0_1",Vx="_tabsList_ktpr0_6",Ux="_tabTrigger_ktpr0_12",$x="_danger_ktpr0_29",uo={tabsRoot:Kx,tabsList:Vx,tabTrigger:Ux,danger:$x};function qx(){return c.jsxs(c.Fragment,{children:[c.jsx(_o,{style:{margin:"1rem 0"}}),c.jsx(rf,{value:Zi,className:uo.tabTrigger,children:c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[c.jsx(Lx,{}),c.jsx("span",{children:"Manage"})]})})]})}function of({objectName:e,completed:t,pending:n,displayName:r}){return c.jsx(rf,{value:e,className:uo.tabTrigger,children:c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[jx(t,n),c.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[c.jsx("span",{children:r||e}),n&&c.jsx("span",{style:{fontSize:".8rem",fontStyle:"italic"},children:"pending"})]})]})})}function Hx({completed:e,pending:t,displayName:n}){return c.jsxs(c.Fragment,{children:[c.jsx(_o,{style:{margin:"1rem 0"}}),c.jsx(of,{objectName:dr,completed:e,pending:t,displayName:n},"other-write")]})}function Bx({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:o}){var i,s;return c.jsx(Dx,{value:e,className:uo.tabsRoot,onValueChange:n,children:c.jsxs(Mx,{className:uo.tabsList,children:[t.map(a=>{var l,u,d,f,h,m;return c.jsx(of,{objectName:a.name,displayName:a.displayName,completed:a.completed,pending:((u=(l=r==null?void 0:r[a.name])==null?void 0:l.read)==null?void 0:u.isOptionalFieldsModified)||((f=(d=r==null?void 0:r[a.name])==null?void 0:d.read)==null?void 0:f.isRequiredMapFieldsModified)||((m=(h=r==null?void 0:r[a.name])==null?void 0:h.read)==null?void 0:m.isValueMappingsModified)||!1},a.name)}),o&&c.jsx(Hx,{completed:o.completed,pending:((s=(i=r==null?void 0:r.other)==null?void 0:i.write)==null?void 0:s.isWriteModified)||!1,displayName:"Write"}),c.jsx(qx,{})]})})}function Jx(e,t){return t===Zi?{name:Zi,completed:!1}:e.find(n=>n.name===t)}function Wx({children:e}){var x;const{project:t}=Te(),{installation:n}=rt(),{providerName:r}=ct(),{hydratedRevision:o}=Qr(),{objectConfigurationsState:i}=fa(),[s,a]=y.useState(""),l=(t==null?void 0:t.appName)||"",u=n==null?void 0:n.config,d=o&&Jl(u,o),f=d!==null,h=!!((x=o==null?void 0:o.content)!=null&&x.write),m=h?Wl(u):void 0,b=y.useMemo(()=>{const g=[...d||[]];return m&&h&&g.push(m),g},[d,m,h]),v=Jx(b,s),p=y.useCallback(()=>{const g=b.find(w=>v!==w&&!w.completed);g&&a(g.name)},[b,v]);return y.useEffect(()=>{!s&&b.length>0&&a(b[0].name)},[b,s,p]),c.jsx(id.Provider,{value:p,children:c.jsx(nd.Provider,{value:v==null?void 0:v.name,children:c.jsxs(zr,{style:{maxWidth:"55rem"},children:[c.jsxs(vn,{style:{display:"flex",gap:"1rem",padding:"3rem",paddingBottom:"6rem",backgroundColor:"var(--amp-colors-bg-primary)"},children:[c.jsxs("div",{style:{width:"20rem"},children:[c.jsxs("h1",{style:{fontSize:"small",fontWeight:"400"},children:[r," integration"]}),c.jsx("h3",{style:{marginBottom:"20px",fontSize:"large",fontWeight:"500"},children:l}),f&&c.jsx(Bx,{value:s,readNavObjects:d,onValueChange:g=>a(g),objectConfigurationsState:i,writeNavObject:m})]}),e]}),c.jsx(Td,{})]})})})}function zx({...e}){return c.jsx(Wx,{...e})}const Gx="_resetContainer_lkwv9_4",sf={resetContainer:Gx};function Qx({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:l}){var p;const{projectIdOrName:u,isLoading:d}=Te(),{isLoading:f}=Ls(),{isError:h,errorState:m}=Dt(),{seed:b,reset:v}=ql();return d||f?c.jsx(Gr,{}):h(ue.PROJECT,u)?c.jsx(Jt,{message:`Error loading project ${u}`}):h(ue.INTEGRATION_LIST,u)?c.jsx(Jt,{message:"Error retrieving integrations for the project, double check the API key"}):(p=m[ue.INTEGRATION_LIST])!=null&&p.apiError?c.jsx(Jt,{message:"Something went wrong, couldn't find integration information"}):c.jsx("div",{className:sf.resetContainer,children:c.jsx(Gy,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:l,children:c.jsx($l,{children:c.jsx(Kd,{consumerRef:t,consumerName:n,groupRef:r,groupName:o,resetComponent:v,children:c.jsx(_v,{resetComponent:v,children:c.jsx(U_,{children:c.jsx(VI,{children:c.jsx(zx,{children:c.jsx(k_,{})})})})})})})},b)})}function Xx(){return c.jsxs(zr,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[c.jsx(ci,{}),c.jsx("p",{children:"Redirecting"})]})}function Yx({redirectURL:e,children:t}){return y.useEffect(()=>{e&&window.location.replace(e)},[e]),e?c.jsx(Xx,{}):t}function Zx({resetComponent:e,onDisconnectSuccess:t,provider:n}){const[r,o]=y.useState(!1);return c.jsxs(c.Fragment,{children:[r===!1&&c.jsxs(c.Fragment,{children:[c.jsx(Ot,{string:"Manage connection"}),c.jsxs("div",{style:{padding:"1rem 0",width:"100%",display:"flex",flexDirection:"column",gap:"1rem"},children:[c.jsx("p",{children:"Click to reauthenticate or refresh your connection."}),c.jsx(ze,{type:"button",onClick:()=>o(!0),variant:"ghost",style:{fontSize:"13px"},children:"Update connection"})]})]}),r===!0&&c.jsxs(c.Fragment,{children:[c.jsx(Md,{provider:n}),c.jsx(Ot,{string:"Remove connection"}),c.jsx("p",{children:"Click to disconnect your connection from the provider."}),c.jsx(ou,{resetComponent:e,onDisconnectSuccess:t,buttonText:"Remove connection",buttonVariant:"danger",buttonStyle:{fontSize:"13px"}})]})]})}function eC({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=Te(),{providerName:o}=ct(e),i=`You have successfully connected your ${o} account to ${r}.`;return c.jsx(wa,{text:i,children:c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"},children:c.jsx(Zx,{resetComponent:n,onDisconnectSuccess:t,provider:e})})})}function tC({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,redirectUrl:i,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:l}){const{seed:u,reset:d}=ql(),f=y.useCallback(h=>{s?s(h.id):l&&l(h)},[s,l]);return c.jsx("div",{className:sf.resetContainer,children:c.jsx($l,{groupRef:r,provider:e,children:c.jsx(Kd,{resetComponent:d,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onSuccess:f,onDisconnectSuccess:a,children:c.jsx(Yx,{redirectURL:i,children:c.jsx(eC,{resetComponent:d,provider:e,onDisconnectSuccess:a})})})})},u)}const nC=(e,t)=>{const{data:n,isLoading:r,isError:o,error:i}=Ll(e,t),s=((n==null?void 0:n.length)||0)>0,a=!!n&&!r,l=n==null?void 0:n[0],u=l==null?void 0:l.config;return y.useEffect(()=>{o&&Le(i)},[o,i]),{isLoaded:a,isIntegrationInstalled:s,isLoading:r,config:u}};exports.AmpersandContext=Dl;exports.AmpersandProvider=Ty;exports.ConnectProvider=tC;exports.InstallIntegration=Qx;exports.useAmpersandProvider=Ry;exports.useIsIntegrationInstalled=nC;
|
|
50
|
+
*/const mI="react-tooltip-core-styles",gI="react-tooltip-base-styles",bc={core:!1,base:!1};function xc({css:e,id:t=gI,type:n="base",ref:r}){var o,i;if(!e||typeof document>"u"||bc[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=mI),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)),bc[n]=!0}const _c=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10,strategy:i="absolute",middlewares:s=[dI(Number(o)),pI({fallbackAxisSideDirection:"start"}),fI({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(hI({element:n,padding:5})),Ic(e,t,{placement:r,strategy:i,middleware:c}).then(({x:u,y:d,placement:f,middlewareData:h})=>{var m,b;const w={left:`${u}px`,top:`${d}px`,border:a},{x:p,y:_}=(m=h.arrow)!==null&&m!==void 0?m:{x:0,y:0},g=(b={top:"bottom",right:"left",bottom:"top",left:"right"}[f.split("-")[0]])!==null&&b!==void 0?b:"bottom",y=a&&{borderBottom:a,borderRight:a};let I=0;if(a){const C=`${a}`.match(/(\d+)px/);I=C!=null&&C[1]?Number(C[1]):1}return{tooltipStyles:w,tooltipArrowStyles:{left:p!=null?`${p}px`:"",top:_!=null?`${_}px`:"",right:"",bottom:"",...y,[g]:`-${4+I}px`},place:f}})):Ic(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}))},Cc=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),Oc=(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},Ec=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",_s=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((o,i)=>_s(o,t[i]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Ec(e)||!Ec(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(o=>_s(e[o],t[o]))},yI=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"})},Sc=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(yI(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},vI=typeof window<"u"?v.useLayoutEffect:v.useEffect,Rt=e=>{e.current&&(clearTimeout(e.current),e.current=null)},wI="DEFAULT_TOOLTIP_ID",II={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},bI=v.createContext({getTooltipData:()=>II});function nd(e=wI){return v.useContext(bI).getTooltipData(e)}var Ir={tooltip:"core-styles-module_tooltip__3vRRp",fixed:"core-styles-module_fixed__pcSol",arrow:"core-styles-module_arrow__cvMwQ",noArrow:"core-styles-module_noArrow__xock6",clickable:"core-styles-module_clickable__ZuTTB",show:"core-styles-module_show__Nt9eE",closing:"core-styles-module_closing__sGnxF"},Ho={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 xI=({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:h,wrapper:m,delayShow:b=0,delayHide:w=0,float:p=!1,hidden:_=!1,noArrow:g=!1,clickable:y=!1,closeOnEsc:I=!1,closeOnScroll:C=!1,closeOnResize:S=!1,openEvents:T,closeEvents:R,globalCloseEvents:F,imperativeModeOnly:U,style:Q,position:J,afterShow:Y,afterHide:B,disableTooltip:ce,content:se,contentWrapperRef:ne,isOpen:ge,defaultIsOpen:we=!1,setIsOpen:A,activeAnchor:j,setActiveAnchor:$,border:K,opacity:L,arrowColor:D,role:Z="tooltip"})=>{var ee;const q=v.useRef(null),te=v.useRef(null),G=v.useRef(null),de=v.useRef(null),M=v.useRef(null),[ve,H]=v.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[Ee,Ve]=v.useState(!1),[Ye,Ue]=v.useState(!1),[Ie,Mt]=v.useState(null),Ze=v.useRef(!1),wt=v.useRef(null),{anchorRefs:kt,setActiveAnchor:jt}=nd(t),et=v.useRef(!1),[Ge,$e]=v.useState([]),Pe=v.useRef(!1),Lt=d||u.includes("click"),it=Lt||(T==null?void 0:T.click)||(T==null?void 0:T.dblclick)||(T==null?void 0:T.mousedown),sn=T?{...T}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!T&&Lt&&Object.assign(sn,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const In=R?{...R}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!R&&Lt&&Object.assign(In,{mouseleave:!1,blur:!1,mouseout:!1});const It=F?{...F}:{escape:I||!1,scroll:C||!1,resize:S||!1,clickOutsideAnchor:it||!1};U&&(Object.assign(sn,{mouseenter:!1,focus:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(In,{mouseleave:!1,blur:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(It,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),vI(()=>(Pe.current=!0,()=>{Pe.current=!1}),[]);const Fe=W=>{Pe.current&&(W&&Ue(!0),setTimeout(()=>{Pe.current&&(A==null||A(W),ge===void 0&&Ve(W))},10))};v.useEffect(()=>{if(ge===void 0)return()=>null;ge&&Ue(!0);const W=setTimeout(()=>{Ve(ge)},10);return()=>{clearTimeout(W)}},[ge]),v.useEffect(()=>{if(Ee!==Ze.current)if(Rt(M),Ze.current=Ee,Ee)Y==null||Y();else{const W=(ae=>{const le=ae.match(/^([\d.]+)(ms|s)$/);if(!le)return 0;const[,Ke,He]=le;return Number(Ke)*(He==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));M.current=setTimeout(()=>{Ue(!1),Mt(null),B==null||B()},W+25)}},[Ee]);const an=W=>{H(ae=>_s(ae,W)?ae:W)},bn=(W=b)=>{Rt(G),Ye?Fe(!0):G.current=setTimeout(()=>{Fe(!0)},W)},cn=(W=w)=>{Rt(de),de.current=setTimeout(()=>{et.current||Fe(!1)},W)},Hn=W=>{var ae;if(!W)return;const le=(ae=W.currentTarget)!==null&&ae!==void 0?ae:W.target;if(!(le!=null&&le.isConnected))return $(null),void jt({current:null});b?bn():Fe(!0),$(le),jt({current:le}),Rt(de)},ft=()=>{y?cn(w||100):w?cn():Fe(!1),Rt(G)},ln=({x:W,y:ae})=>{var le;const Ke={getBoundingClientRect:()=>({x:W,y:ae,width:0,height:0,top:ae,left:W,right:W,bottom:ae})};_c({place:(le=Ie==null?void 0:Ie.place)!==null&&le!==void 0?le:a,offset:c,elementReference:Ke,tooltipReference:q.current,tooltipArrowReference:te.current,strategy:f,middlewares:h,border:K}).then(He=>{an(He)})},xn=W=>{if(!W)return;const ae=W,le={x:ae.clientX,y:ae.clientY};ln(le),wt.current=le},Bn=W=>{var ae;if(!Ee)return;const le=W.target;le.isConnected&&(!((ae=q.current)===null||ae===void 0)&&ae.contains(le)||[document.querySelector(`[id='${i}']`),...Ge].some(Ke=>Ke==null?void 0:Ke.contains(le))||(Fe(!1),Rt(G)))},_n=Oc(Hn,50),Ae=Oc(ft,50),ot=W=>{Ae.cancel(),_n(W)},ie=()=>{_n.cancel(),Ae()},me=v.useCallback(()=>{var W,ae;const le=(W=Ie==null?void 0:Ie.position)!==null&&W!==void 0?W:J;le?ln(le):p?wt.current&&ln(wt.current):j!=null&&j.isConnected&&_c({place:(ae=Ie==null?void 0:Ie.place)!==null&&ae!==void 0?ae:a,offset:c,elementReference:j,tooltipReference:q.current,tooltipArrowReference:te.current,strategy:f,middlewares:h,border:K}).then(Ke=>{Pe.current&&an(Ke)})},[Ee,j,se,Q,a,Ie==null?void 0:Ie.place,c,f,J,Ie==null?void 0:Ie.position,p]);v.useEffect(()=>{var W,ae;const le=new Set(kt);Ge.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 He=()=>{Fe(!1)},pt=Sc(j),Qe=Sc(q.current);It.scroll&&(window.addEventListener("scroll",He),pt==null||pt.addEventListener("scroll",He),Qe==null||Qe.addEventListener("scroll",He));let tt=null;It.resize?window.addEventListener("resize",He):j&&q.current&&(tt=uI(j,q.current,me,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const ht=Se=>{Se.key==="Escape"&&Fe(!1)};It.escape&&window.addEventListener("keydown",ht),It.clickOutsideAnchor&&window.addEventListener("click",Bn);const Ne=[],Jn=Se=>{Ee&&(Se==null?void 0:Se.target)===j||Hn(Se)},No=Se=>{Ee&&(Se==null?void 0:Se.target)===j&&ft()},St=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],Ci=["click","dblclick","mousedown","mouseup"];Object.entries(sn).forEach(([Se,Kt])=>{Kt&&(St.includes(Se)?Ne.push({event:Se,listener:ot}):Ci.includes(Se)&&Ne.push({event:Se,listener:Jn}))}),Object.entries(In).forEach(([Se,Kt])=>{Kt&&(St.includes(Se)?Ne.push({event:Se,listener:ie}):Ci.includes(Se)&&Ne.push({event:Se,listener:No}))}),p&&Ne.push({event:"pointermove",listener:xn});const Oi=()=>{et.current=!0},Ei=()=>{et.current=!1,ft()};return y&&!it&&((W=q.current)===null||W===void 0||W.addEventListener("mouseenter",Oi),(ae=q.current)===null||ae===void 0||ae.addEventListener("mouseleave",Ei)),Ne.forEach(({event:Se,listener:Kt})=>{le.forEach(Vt=>{var Wn;(Wn=Vt.current)===null||Wn===void 0||Wn.addEventListener(Se,Kt)})}),()=>{var Se,Kt;It.scroll&&(window.removeEventListener("scroll",He),pt==null||pt.removeEventListener("scroll",He),Qe==null||Qe.removeEventListener("scroll",He)),It.resize?window.removeEventListener("resize",He):tt==null||tt(),It.clickOutsideAnchor&&window.removeEventListener("click",Bn),It.escape&&window.removeEventListener("keydown",ht),y&&!it&&((Se=q.current)===null||Se===void 0||Se.removeEventListener("mouseenter",Oi),(Kt=q.current)===null||Kt===void 0||Kt.removeEventListener("mouseleave",Ei)),Ne.forEach(({event:Vt,listener:Wn})=>{le.forEach(To=>{var Yr;(Yr=To.current)===null||Yr===void 0||Yr.removeEventListener(Vt,Wn)})})}},[j,me,Ye,kt,Ge,T,R,F,Lt,b,w]),v.useEffect(()=>{var W,ae;let le=(ae=(W=Ie==null?void 0:Ie.anchorSelect)!==null&&W!==void 0?W:s)!==null&&ae!==void 0?ae:"";!le&&t&&(le=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const Ke=new MutationObserver(He=>{const pt=[],Qe=[];He.forEach(tt=>{if(tt.type==="attributes"&&tt.attributeName==="data-tooltip-id"&&(tt.target.getAttribute("data-tooltip-id")===t?pt.push(tt.target):tt.oldValue===t&&Qe.push(tt.target)),tt.type==="childList"){if(j){const ht=[...tt.removedNodes].filter(Ne=>Ne.nodeType===1);if(le)try{Qe.push(...ht.filter(Ne=>Ne.matches(le))),Qe.push(...ht.flatMap(Ne=>[...Ne.querySelectorAll(le)]))}catch{}ht.some(Ne=>{var Jn;return!!(!((Jn=Ne==null?void 0:Ne.contains)===null||Jn===void 0)&&Jn.call(Ne,j))&&(Ue(!1),Fe(!1),$(null),Rt(G),Rt(de),!0)})}if(le)try{const ht=[...tt.addedNodes].filter(Ne=>Ne.nodeType===1);pt.push(...ht.filter(Ne=>Ne.matches(le))),pt.push(...ht.flatMap(Ne=>[...Ne.querySelectorAll(le)]))}catch{}}}),(pt.length||Qe.length)&&$e(tt=>[...tt.filter(ht=>!Qe.includes(ht)),...pt])});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]),v.useEffect(()=>{me()},[me]),v.useEffect(()=>{if(!(ne!=null&&ne.current))return()=>null;const W=new ResizeObserver(()=>{setTimeout(()=>me())});return W.observe(ne.current),()=>{W.disconnect()}},[se,ne==null?void 0:ne.current]),v.useEffect(()=>{var W;const ae=document.querySelector(`[id='${i}']`),le=[...Ge,ae];j&&le.includes(j)||$((W=Ge[0])!==null&&W!==void 0?W:ae)},[i,Ge,j]),v.useEffect(()=>(we&&Fe(!0),()=>{Rt(G),Rt(de)}),[]),v.useEffect(()=>{var W;let ae=(W=Ie==null?void 0:Ie.anchorSelect)!==null&&W!==void 0?W:s;if(!ae&&t&&(ae=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),ae)try{const le=Array.from(document.querySelectorAll(ae));$e(le)}catch{$e([])}},[t,s,Ie==null?void 0:Ie.anchorSelect]),v.useEffect(()=>{G.current&&(Rt(G),bn(b))},[b]);const qe=(ee=Ie==null?void 0:Ie.content)!==null&&ee!==void 0?ee:se,un=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`)}Mt(W??null),W!=null&&W.delay?bn(W.delay):Fe(!0)},close:W=>{W!=null&&W.delay?cn(W.delay):Fe(!1)},activeAnchor:j,place:ve.place,isOpen:!!(Ye&&!_&&qe&&un)})),Ye&&!_&&qe?v.createElement(m,{id:t,role:Z,className:Ft("react-tooltip",Ir.tooltip,Ho.tooltip,Ho[o],n,`react-tooltip__place-${ve.place}`,Ir[un?"show":"closing"],un?"react-tooltip__show":"react-tooltip__closing",f==="fixed"&&Ir.fixed,y&&Ir.clickable),onTransitionEnd:W=>{Rt(M),Ee||W.propertyName!=="opacity"||(Ue(!1),Mt(null),B==null||B())},style:{...Q,...ve.tooltipStyles,opacity:L!==void 0&&un?L:void 0},ref:q},qe,v.createElement(m,{className:Ft("react-tooltip-arrow",Ir.arrow,Ho.arrow,r,g&&Ir.noArrow),style:{...ve.tooltipArrowStyles,background:D?`linear-gradient(to right bottom, transparent 50%, ${D} 50%)`:void 0},ref:te})):null},_I=({content:e})=>v.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),CI=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:h=null,events:m=["hover"],openOnClick:b=!1,positionStrategy:w="absolute",middlewares:p,delayShow:_=0,delayHide:g=0,float:y=!1,hidden:I=!1,noArrow:C=!1,clickable:S=!1,closeOnEsc:T=!1,closeOnScroll:R=!1,closeOnResize:F=!1,openEvents:U,closeEvents:Q,globalCloseEvents:J,imperativeModeOnly:Y=!1,style:B,position:ce,isOpen:se,defaultIsOpen:ne=!1,disableStyleInjection:ge=!1,border:we,opacity:A,arrowColor:j,setIsOpen:$,afterShow:K,afterHide:L,disableTooltip:D,role:Z="tooltip"},ee)=>{const[q,te]=v.useState(r),[G,de]=v.useState(o),[M,ve]=v.useState(u),[H,Ee]=v.useState(c),[Ve,Ye]=v.useState(d),[Ue,Ie]=v.useState(_),[Mt,Ze]=v.useState(g),[wt,kt]=v.useState(y),[jt,et]=v.useState(I),[Ge,$e]=v.useState(f),[Pe,Lt]=v.useState(m),[it,sn]=v.useState(w),[In,It]=v.useState(null),[Fe,an]=v.useState(null),bn=v.useRef(ge),{anchorRefs:cn,activeAnchor:Hn}=nd(e),ft=Ae=>Ae==null?void 0:Ae.getAttributeNames().reduce((ot,ie)=>{var me;return ie.startsWith("data-tooltip-")&&(ot[ie.replace(/^data-tooltip-/,"")]=(me=Ae==null?void 0:Ae.getAttribute(ie))!==null&&me!==void 0?me:null),ot},{}),ln=Ae=>{const ot={place:ie=>{var me;ve((me=ie)!==null&&me!==void 0?me:u)},content:ie=>{te(ie??r)},html:ie=>{de(ie??o)},variant:ie=>{var me;Ee((me=ie)!==null&&me!==void 0?me:c)},offset:ie=>{Ye(ie===null?d:Number(ie))},wrapper:ie=>{var me;$e((me=ie)!==null&&me!==void 0?me:f)},events:ie=>{const me=ie==null?void 0:ie.split(" ");Lt(me??m)},"position-strategy":ie=>{var me;sn((me=ie)!==null&&me!==void 0?me:w)},"delay-show":ie=>{Ie(ie===null?_:Number(ie))},"delay-hide":ie=>{Ze(ie===null?g:Number(ie))},float:ie=>{kt(ie===null?y:ie==="true")},hidden:ie=>{et(ie===null?I:ie==="true")},"class-name":ie=>{It(ie)}};Object.values(ot).forEach(ie=>ie(null)),Object.entries(Ae).forEach(([ie,me])=>{var qe;(qe=ot[ie])===null||qe===void 0||qe.call(ot,me)})};v.useEffect(()=>{te(r)},[r]),v.useEffect(()=>{de(o)},[o]),v.useEffect(()=>{ve(u)},[u]),v.useEffect(()=>{Ee(c)},[c]),v.useEffect(()=>{Ye(d)},[d]),v.useEffect(()=>{Ie(_)},[_]),v.useEffect(()=>{Ze(g)},[g]),v.useEffect(()=>{kt(y)},[y]),v.useEffect(()=>{et(I)},[I]),v.useEffect(()=>{sn(w)},[w]),v.useEffect(()=>{bn.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 Ae;const ot=new Set(cn);let ie=n;if(!ie&&e&&(ie=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),ie)try{document.querySelectorAll(ie).forEach(ae=>{ot.add({current:ae})})}catch{console.warn(`[react-tooltip] "${ie}" is not a valid CSS selector`)}const me=document.querySelector(`[id='${t}']`);if(me&&ot.add({current:me}),!ot.size)return()=>null;const qe=(Ae=Fe??me)!==null&&Ae!==void 0?Ae:Hn.current,un=new MutationObserver(ae=>{ae.forEach(le=>{var Ke;if(!qe||le.type!=="attributes"||!(!((Ke=le.attributeName)===null||Ke===void 0)&&Ke.startsWith("data-tooltip-")))return;const He=ft(qe);ln(He)})}),W={attributes:!0,childList:!1,subtree:!1};if(qe){const ae=ft(qe);ln(ae),un.observe(qe,W)}return()=>{un.disconnect()}},[cn,Hn,Fe,t,n]),v.useEffect(()=>{B!=null&&B.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),we&&!Cc("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."),A&&!Cc("opacity",`${A}`)&&console.warn(`[react-tooltip] "${A}" is not a valid \`opacity\`.`)},[]);let xn=h;const Bn=v.useRef(null);if(i){const Ae=i({content:(Fe==null?void 0:Fe.getAttribute("data-tooltip-content"))||q||null,activeAnchor:Fe});xn=Ae?v.createElement("div",{ref:Bn,className:"react-tooltip-content-wrapper"},Ae):null}else q&&(xn=q);G&&(xn=v.createElement(_I,{content:G}));const _n={forwardRef:ee,id:e,anchorId:t,anchorSelect:n,className:Ft(s,In),classNameArrow:a,content:xn,contentWrapperRef:Bn,place:M,variant:H,offset:Ve,wrapper:Ge,events:Pe,openOnClick:b,positionStrategy:it,middlewares:p,delayShow:Ue,delayHide:Mt,float:wt,hidden:jt,noArrow:C,clickable:S,closeOnEsc:T,closeOnScroll:R,closeOnResize:F,openEvents:U,closeEvents:Q,globalCloseEvents:J,imperativeModeOnly:Y,style:B,position:ce,isOpen:se,defaultIsOpen:ne,border:we,opacity:A,arrowColor:j,setIsOpen:$,afterShow:K,afterHide:L,disableTooltip:D,activeAnchor:Fe,setActiveAnchor:Ae=>an(Ae),role:Z};return v.createElement(xI,{..._n})});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:`
|
|
51
|
+
.styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:8px;height:8px}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:"base"})});function OI(){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 EI({id:e,tooltipText:t}){return l.jsxs(l.Fragment,{children:[l.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:OI()}),l.jsx(CI,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}const rd=v.createContext(null);function id(){const e=v.useContext(rd);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const od=v.createContext(()=>{});function SI(){const e=v.useContext(od);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}var sd=Symbol.for("immer-nothing"),Nc=Symbol.for("immer-draftable"),Ct=Symbol.for("immer-state"),NI=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 yt(e,...t){if(process.env.NODE_ENV!=="production"){const n=NI[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 $r=Object.getPrototypeOf;function qr(e){return!!e&&!!e[Ct]}function mr(e){var t;return e?ad(e)||Array.isArray(e)||!!e[Nc]||!!((t=e.constructor)!=null&&t[Nc])||vo(e)||wo(e):!1}var TI=Object.prototype.constructor.toString();function ad(e){if(!e||typeof e!="object")return!1;const t=$r(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)===TI}function ao(e,t){yo(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function yo(e){const t=e[Ct];return t?t.type_:Array.isArray(e)?1:vo(e)?2:wo(e)?3:0}function Cs(e,t){return yo(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function cd(e,t,n){const r=yo(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function RI(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function vo(e){return e instanceof Map}function wo(e){return e instanceof Set}function Xn(e){return e.copy_||e.base_}function Os(e,t){if(vo(e))return new Map(e);if(wo(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=ad(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[Ct];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($r(e),r)}else{const r=$r(e);if(r!==null&&n)return{...e};const o=Object.create(r);return Object.assign(o,e)}}function da(e,t=!1){return Io(e)||qr(e)||!mr(e)||(yo(e)>1&&(e.set=e.add=e.clear=e.delete=AI),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>da(r,!0))),e}function AI(){yt(2)}function Io(e){return Object.isFrozen(e)}var PI={};function gr(e){const t=PI[e];return t||yt(0,e),t}var ui;function ld(){return ui}function FI(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Tc(e,t){t&&(gr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Es(e){Ss(e),e.drafts_.forEach(DI),e.drafts_=null}function Ss(e){e===ui&&(ui=e.parent_)}function Rc(e){return ui=FI(ui,e)}function DI(e){const t=e[Ct];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Ac(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Ct].modified_&&(Es(t),yt(4)),mr(e)&&(e=co(t,e),t.parent_||lo(t,e)),t.patches_&&gr("Patches").generateReplacementPatches_(n[Ct].base_,e,t.patches_,t.inversePatches_)):e=co(t,n,[]),Es(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==sd?e:void 0}function co(e,t,n){if(Io(t))return t;const r=t[Ct];if(!r)return ao(t,(o,i)=>Pc(e,r,t,o,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return lo(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),ao(i,(a,c)=>Pc(e,r,o,a,c,n,s)),lo(e,o,!1),n&&e.patches_&&gr("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Pc(e,t,n,r,o,i,s){if(process.env.NODE_ENV!=="production"&&o===n&&yt(5),qr(o)){const a=i&&t&&t.type_!==3&&!Cs(t.assigned_,r)?i.concat(r):void 0,c=co(e,o,a);if(cd(n,r,c),qr(c))e.canAutoFreeze_=!1;else return}else s&&n.add(o);if(mr(o)&&!Io(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;co(e,o),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&lo(e,o)}}function lo(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&da(t,n)}function MI(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:ld(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=fa;n&&(o=[r],i=di);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}var fa={get(e,t){if(t===Ct)return e;const n=Xn(e);if(!Cs(n,t))return kI(e,n,t);const r=n[t];return e.finalized_||!mr(r)?r:r===Bo(e.base_,t)?(Jo(e),e.copy_[t]=Ts(r,e)):r},has(e,t){return t in Xn(e)},ownKeys(e){return Reflect.ownKeys(Xn(e))},set(e,t,n){const r=ud(Xn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=Bo(Xn(e),t),i=o==null?void 0:o[Ct];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(RI(n,o)&&(n!==void 0||Cs(e.base_,t)))return!0;Jo(e),Ns(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Bo(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Jo(e),Ns(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Xn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){yt(11)},getPrototypeOf(e){return $r(e.base_)},setPrototypeOf(){yt(12)}},di={};ao(fa,(e,t)=>{di[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});di.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&yt(13),di.set.call(this,e,t,void 0)};di.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&yt(14),fa.set.call(this,e[0],t,n,e[0])};function Bo(e,t){const n=e[Ct];return(n?Xn(n):e)[t]}function kI(e,t,n){var o;const r=ud(t,n);return r?"value"in r?r.value:(o=r.get)==null?void 0:o.call(e.draft_):void 0}function ud(e,t){if(!(t in e))return;let n=$r(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=$r(n)}}function Ns(e){e.modified_||(e.modified_=!0,e.parent_&&Ns(e.parent_))}function Jo(e){e.copy_||(e.copy_=Os(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var jI=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"&&yt(6),r!==void 0&&typeof r!="function"&&yt(7);let o;if(mr(t)){const i=Rc(this),s=Ts(t,void 0);let a=!0;try{o=n(s),a=!1}finally{a?Es(i):Ss(i)}return Tc(i,r),Ac(o,i)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===sd&&(o=void 0),this.autoFreeze_&&da(o,!0),r){const i=[],s=[];gr("Patches").generateReplacementPatches_(t,o,i,s),r(i,s)}return o}else yt(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){mr(e)||yt(8),qr(e)&&(e=LI(e));const t=Rc(this),n=Ts(e,void 0);return n[Ct].isManual_=!0,Ss(t),n}finishDraft(e,t){const n=e&&e[Ct];(!n||!n.isManual_)&&yt(9);const{scope_:r}=n;return Tc(r,t),Ac(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=gr("Patches").applyPatches_;return qr(e)?r(e,t):this.produce(e,o=>r(o,t))}};function Ts(e,t){const n=vo(e)?gr("MapSet").proxyMap_(e,t):wo(e)?gr("MapSet").proxySet_(e,t):MI(e,t);return(t?t.scope_:ld()).drafts_.push(n),n}function LI(e){return qr(e)||yt(10,e),dd(e)}function dd(e){if(!mr(e)||Io(e))return e;const t=e[Ct];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Os(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Os(e,!0);return ao(n,(r,o)=>{cd(n,r,dd(o))}),t&&(t.finalized_=!1),n}var Ot=new jI,ti=Ot.produce;Ot.produceWithPatches.bind(Ot);Ot.setAutoFreeze.bind(Ot);Ot.setUseStrictShallowCopy.bind(Ot);Ot.applyPatches.bind(Ot);Ot.createDraft.bind(Ot);Ot.finishDraft.bind(Ot);const fd=v.createContext(void 0),KI={};function pa(){const e=v.useContext(fd);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function VI({children:e}){const{installation:t}=rt(),{hydratedRevision:n,loading:r}=Qr(),[o,i]=v.useState(KI),s=t==null?void 0:t.config;v.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(o).length>0)&&av(n,s,i)},[n,r,s,o]);const a=v.useCallback((m,b)=>{i(w=>ti(w,p=>{p[m]=ti(p[m],b)}))},[i]),c=v.useCallback((m,b)=>{i(w=>ti(w,p=>{p[m]=b}))},[i]),u=v.useCallback(()=>{i(ti(m=>{const b=m.other.write;b&&(b.isWriteModified=!1)}))},[i]),d=v.useCallback(m=>{i(ti(b=>{var p;const w=(p=b[m])==null?void 0:p.read;w&&(w.isOptionalFieldsModified=!1,w.isRequiredMapFieldsModified=!1,w.isValueMappingsModified=!1)}))},[i]),f=v.useCallback(m=>{m===fr?u():d(m)},[d,u]),h=v.useMemo(()=>({objectConfigurationsState:o,setObjectConfigurationsState:i,setConfigureState:a,resetConfigureState:c,resetPendingConfigurationState:f}),[o,c,f,a]);return l.jsx(fd.Provider,{value:h,children:e})}const Xt=()=>{const{appName:e}=Te(),{objectConfigurationsState:t,setConfigureState:n}=pa(),{selectedObjectName:r}=id(),o=nu(r||"",t);return{appName:e,configureState:o,setConfigureState:n,selectedObjectName:r}};function UI(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=!Ql(o,n);e.read.isRequiredMapFieldsModified=s}}function fi(e,t,n){t(e,r=>UI(r,n))}const $I="Each field must be mapped to a unique value";function ha({field:e,onSelectChange:t,allFields:n}){var g;const{configureState:r,selectedObjectName:o,setConfigureState:i}=Xt(),[s,a]=v.useState(!0),{isError:c,removeError:u,getError:d}=Dt(),f=(g=r==null?void 0:r.read)==null?void 0:g.selectedFieldMappings,h=f==null?void 0:f[e.mapToName];v.useEffect(()=>{e._default&&!h&&o&&r&&fi(o,i,[{field:e.mapToName,value:e._default}]),a(!1)},[e,i,o,h,r]);const m=v.useMemo(()=>n.map(y=>({id:y.fieldName,label:y.displayName,value:y.fieldName})),[n]),b=l.jsx(Ju,{disabled:s,items:m,selectedValue:h||null,onSelectedItemChange:y=>{t({target:{name:e.mapToName,value:y==null?void 0:y.value}})},placeholder:"Please select one",style:{width:"100%"}}),w=v.useCallback(()=>{o&&(fi(o,i,[{field:e.mapToName,value:null}]),c(ue.MAPPING,o)&&u(ue.MAPPING,o))},[e.mapToName,o,i,c,u]),{hasDuplicationError:p,errorMessage:_}=v.useMemo(()=>{const y=d(ue.MAPPING,o),I=Array.isArray(y)&&y.length>0&&y.includes(e.mapToName);return{hasDuplicationError:I,errorMessage:I?$I:""}},[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??e.mapToName}),l.jsx("span",{children:(e==null?void 0:e.prompt)&&l.jsx(EI,{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:[b,l.jsx(ze,{type:"button",variant:"ghost",onClick:w,children:"Clear"})]})]},e.mapToName),p&&l.jsxs("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:[" ",_," "]},e.mapToName)]})}const qI="_formControl_9qd8d_1",HI="_formLabel_9qd8d_5",BI="_formLabelRequired_9qd8d_11",JI="_formInput_9qd8d_16",WI="_formInputInvalid_9qd8d_20",zI="_formError_9qd8d_24",GI="_disabled_9qd8d_30",Qn={formControl:qI,formLabel:HI,formLabelRequired:BI,formInput:JI,formInputInvalid:WI,formError:zI,disabled:GI};function bo({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:o=!1,errorMessage:i,children:s}){return l.jsxs("div",{className:Ft(Qn.formControl,{[Qn.disabled]:r}),children:[t&&l.jsx("label",{htmlFor:e,className:Ft(Qn.formLabel,{[Qn.formLabelRequired]:n}),children:t}),l.jsx("div",{id:e,className:Ft(Qn.formInput,{[Qn.formInputInvalid]:o}),children:s}),o&&i&&l.jsx("div",{className:Qn.formError,role:"alert",children:i})]})}const QI="_divider_1kmoj_1",Fc={divider:QI};function xo({className:e,style:t}){return l.jsx("hr",{className:e?`${Fc.divider} ${e}`:Fc.divider,style:t})}function Et({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 pd({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 XI({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(bo,{id:r.mapToName,children:l.jsx(ha,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function YI(){var b,w;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Xt(),{isError:r,removeError:o,setError:i}=Dt(),s=((b=t==null?void 0:t.read)==null?void 0:b.allFields)||[],{fieldMapping:a}=rt(),c=(w=t==null?void 0:t.read)==null?void 0:w.selectedFieldMappings,u=p=>{const{value:_,name:g}=p.target;!_||pd({selectedFieldMappings:c,selectedObjectName:e,fieldName:g,fieldValue:_,setError:i})||(e&&fi(e,n,[{field:g,value:_}]),r(ue.MAPPING,g)&&o(ue.MAPPING,g),e&&r(ue.MAPPING,e)&&o(ue.MAPPING,e))},d=v.useMemo(()=>!e||!a?[]:Object.values(a[e]||{}).flat().filter(p=>!p.fieldName),[a,e]),f=v.useMemo(()=>{var g;return(((g=t==null?void 0:t.read)==null?void 0:g.optionalMapFields)||[]).filter(y=>!d.some(I=>I.mapToName===y.mapToName))},[t,d]),h=d.length>0;return f.length>0||h?l.jsxs(l.Fragment,{children:[l.jsx(Et,{string:"Map the following optional fields"}),l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:[f==null?void 0:f.map(p=>l.jsx(bo,{id:p.mapToName,children:l.jsx(ha,{allFields:s,field:p,onSelectChange:u})},p.mapToName)),h&&l.jsx(XI,{dynamicFieldMappings:d,onSelectChange:u,allFields:s})]})]}):null}function ZI(){var u;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Xt(),{isError:r,removeError:o,setError:i}=Dt(),s=(u=t==null?void 0:t.read)==null?void 0:u.selectedFieldMappings,a=d=>{const{value:f,name:h}=d.target;!f||pd({selectedFieldMappings:s,selectedObjectName:e,fieldName:h,fieldValue:f,setError:i})||(e&&fi(e,n,[{field:h,value:f}]),r(ue.MAPPING,h)&&o(ue.MAPPING,h),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(Et,{string:"Map the following fields"}),l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:c.map(d=>{var f;return l.jsx(bo,{id:d.mapToName,isInvalid:r(ue.MAPPING,d.mapToName),errorMessage:"* required",children:l.jsx(ha,{allFields:((f=t==null?void 0:t.read)==null?void 0:f.allFields)||[],field:d,onSelectChange:a})},d.mapToName)})})]}):null}const eb=(e,t)=>e.filter(n=>!t.has(n));function tb(){var h,m,b;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Xt(),{fieldMapping:r}=rt(),o=((h=t==null?void 0:t.read)==null?void 0:h.selectedFieldMappings)||{},i=Object.keys(o),s=((m=t==null?void 0:t.read)==null?void 0:m.requiredMapFields)||[],a=((b=t==null?void 0:t.read)==null?void 0:b.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=eb(i,d);v.useEffect(()=>{e&&f.length&&fi(e,n,f.map(w=>({field:w,value:null})))},[e,n,f])}const nb={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function rb({children:e,style:t}){return l.jsx(vn,{style:{...nb,...t},children:e})}const ma=e=>{const t=dt(),{provider:n}=rt(),r=e||n;return yn({queryKey:["amp","providerInfo",r],queryFn:async()=>{if(!r)throw new Error("Provider not found");return(await t()).providerApi.getProvider({provider:r})},enabled:!!r})},ct=e=>{const t=ma(e),{data:n}=t,{provider:r}=rt(),o=n&&Vl(n==null?void 0:n.name,n);return{...t,providerName:o,selectedProvider:e||r}};function ib(){var u,d,f;const{project:e}=Te(),{hydratedRevision:t}=Qr(),{selectedObjectName:n}=Xt(),{providerName:r}=ct(),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(h=>h.objectName===n),s=(i==null?void 0:i.displayName)||n&&dr(n),a=i==null?void 0:i.mapToName,c=(i==null?void 0:i.mapToDisplayName)||a&&dr(a);return c&&o&&r?l.jsx(rb,{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 Dc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function hd(...e){return t=>{let n=!1;const r=e.map(o=>{const i=Dc(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():Dc(e[o],null)}}}}function Hr(...e){return k.useCallback(hd(...e),e)}function _o(e,t=[]){let n=[];function r(i,s){const a=k.createContext(s),c=n.length;n=[...n,s];const u=f=>{var _;const{scope:h,children:m,...b}=f,w=((_=h==null?void 0:h[e])==null?void 0:_[c])||a,p=k.useMemo(()=>b,Object.values(b));return l.jsx(w.Provider,{value:p,children:m})};u.displayName=i+"Provider";function d(f,h){var w;const m=((w=h==null?void 0:h[e])==null?void 0:w[c])||a,b=k.useContext(m);if(b)return b;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,ob(o,...t)]}function ob(...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 Wt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}var pi=globalThis!=null&&globalThis.document?k.useLayoutEffect:()=>{},sb=k[" useInsertionEffect ".trim().toString()]||pi;function ga({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,s]=ab({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:o;{const d=k.useRef(e!==void 0);k.useEffect(()=>{const f=d.current;f!==a&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=a},[a,r])}const u=k.useCallback(d=>{var f;if(a){const h=cb(d)?d(e):d;h!==e&&((f=s.current)==null||f.call(s,h))}else i(d)},[a,e,i,s]);return[c,u]}function ab({defaultProp:e,onChange:t}){const[n,r]=k.useState(e),o=k.useRef(n),i=k.useRef(t);return sb(()=>{i.current=t},[t]),k.useEffect(()=>{var s;o.current!==n&&((s=i.current)==null||s.call(i,n),o.current=n)},[n,o]),[n,r,i]}function cb(e){return typeof e=="function"}function lb(e){const t=k.useRef({value:e,previous:e});return k.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function ub(e){const[t,n]=k.useState(void 0);return pi(()=>{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 db(e,t){return k.useReducer((n,r)=>t[n][r]??n,e)}var ya=e=>{const{present:t,children:n}=e,r=fb(t),o=typeof n=="function"?n({present:r.isPresent}):k.Children.only(n),i=Hr(r.ref,pb(o));return typeof n=="function"||r.isPresent?k.cloneElement(o,{ref:i}):null};ya.displayName="Presence";function fb(e){const[t,n]=k.useState(),r=k.useRef(null),o=k.useRef(e),i=k.useRef("none"),s=e?"mounted":"unmounted",[a,c]=db(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return k.useEffect(()=>{const u=qi(r.current);i.current=a==="mounted"?u:"none"},[a]),pi(()=>{const u=r.current,d=o.current;if(d!==e){const h=i.current,m=qi(u);e?c("MOUNT"):m==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&h!==m?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),pi(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=m=>{const w=qi(r.current).includes(m.animationName);if(m.target===t&&w&&(c("ANIMATION_END"),!o.current)){const p=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=p)})}},h=m=>{m.target===t&&(i.current=qi(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:k.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function qi(e){return(e==null?void 0:e.animationName)||"none"}function pb(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Rs(e){const t=hb(e),n=k.forwardRef((r,o)=>{const{children:i,...s}=r,a=k.Children.toArray(i),c=a.find(gb);if(c){const u=c.props.children,d=a.map(f=>f===c?k.Children.count(u)>1?k.Children.only(null):k.isValidElement(u)?u.props.children:null:f);return l.jsx(t,{...s,ref:o,children:k.isValidElement(u)?k.cloneElement(u,void 0,d):null})}return l.jsx(t,{...s,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function hb(e){const t=k.forwardRef((n,r)=>{const{children:o,...i}=n;if(k.isValidElement(o)){const s=vb(o),a=yb(i,o.props);return o.type!==k.Fragment&&(a.ref=r?hd(r,s):s),k.cloneElement(o,a)}return k.Children.count(o)>1?k.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var mb=Symbol("radix.slottable");function gb(e){return k.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===mb}function yb(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 vb(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 wb=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],wn=wb.reduce((e,t)=>{const n=Rs(`Primitive.${t}`),r=k.forwardRef((o,i)=>{const{asChild:s,...a}=o,c=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Co="Checkbox",[Ib,oC]=_o(Co),[bb,xb]=Ib(Co),md=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,[h,m]=k.useState(null),b=Hr(t,I=>m(I)),w=k.useRef(!1),p=h?d||!!h.closest("form"):!0,[_,g]=ga({prop:o,defaultProp:i??!1,onChange:u,caller:Co}),y=k.useRef(_);return k.useEffect(()=>{const I=h==null?void 0:h.form;if(I){const C=()=>g(y.current);return I.addEventListener("reset",C),()=>I.removeEventListener("reset",C)}},[h,g]),l.jsxs(bb,{scope:n,state:_,disabled:a,children:[l.jsx(wn.button,{type:"button",role:"checkbox","aria-checked":Kn(_)?"mixed":_,"aria-required":s,"data-state":wd(_),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:b,onKeyDown:Wt(e.onKeyDown,I=>{I.key==="Enter"&&I.preventDefault()}),onClick:Wt(e.onClick,I=>{g(C=>Kn(C)?!0:!C),p&&(w.current=I.isPropagationStopped(),w.current||I.stopPropagation())})}),p&&l.jsx(vd,{control:h,bubbles:!w.current,name:r,value:c,checked:_,required:s,disabled:a,form:d,style:{transform:"translateX(-100%)"},defaultChecked:Kn(i)?!1:i})]})});md.displayName=Co;var gd="CheckboxIndicator",yd=k.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=xb(gd,n);return l.jsx(ya,{present:r||Kn(i.state)||i.state===!0,children:l.jsx(wn.span,{"data-state":wd(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});yd.displayName=gd;var _b="CheckboxBubbleInput",vd=k.forwardRef(({__scopeCheckbox:e,control:t,checked:n,bubbles:r=!0,defaultChecked:o,...i},s)=>{const a=k.useRef(null),c=Hr(a,s),u=lb(n),d=ub(t);k.useEffect(()=>{const h=a.current;if(!h)return;const m=window.HTMLInputElement.prototype,w=Object.getOwnPropertyDescriptor(m,"checked").set;if(u!==n&&w){const p=new Event("click",{bubbles:r});h.indeterminate=Kn(n),w.call(h,Kn(n)?!1:n),h.dispatchEvent(p)}},[u,n,r]);const f=k.useRef(Kn(n)?!1:n);return l.jsx(wn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??f.current,...i,tabIndex:-1,ref:c,style:{...i.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});vd.displayName=_b;function Kn(e){return e==="indeterminate"}function wd(e){return Kn(e)?"indeterminate":e?"checked":"unchecked"}var Id=md,bd=yd;function xd(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 Cb=["color"],_d=v.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=xd(e,Cb);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"}))}),Ob=["color"],Eb=v.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=xd(e,Ob);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 Sb="_checkboxGroupContainer_1ya1t_1",Nb="_stack_1ya1t_6",Tb="_selectAllContainer_1ya1t_11",Rb="_fieldContainer_1ya1t_18",Ab="_checkbox_1ya1t_1",Br={checkboxGroupContainer:Sb,stack:Nb,selectAllContainer:Tb,fieldContainer:Rb,checkbox:Ab};function Cd({id:e,isChecked:t,label:n,onCheckedChange:r}){return l.jsxs("div",{className:Br.fieldContainer,children:[l.jsx(Id,{className:Br.checkbox,id:e,onCheckedChange:r,checked:t,children:l.jsx(bd,{children:l.jsx(_d,{})})}),l.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function Od({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:o}){return l.jsxs("div",{className:Br.selectAllContainer,children:[l.jsx(Id,{className:Br.checkbox,id:e,onCheckedChange:r,children:l.jsxs(bd,{children:[o&&l.jsx(Eb,{}),t===!0&&l.jsx(_d,{})]})}),l.jsx("label",{htmlFor:e,children:n})]})}function Ed({children:e}){return l.jsx("div",{className:Br.checkboxGroupContainer,children:e})}function Sd({children:e}){return l.jsx("div",{className:Br.stack,children:e})}function Pb(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=!Ql(s,r);e.read.isOptionalFieldsModified=c}else console.warn("read.savedConfig.optionalFields is undefined")}function Mc(e,t,n,r){t(e,o=>Pb(o,n,r))}function Fb(){var f,h;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,b)=>{m!=="indeterminate"&&r&&t&&Mc(r,n,b,m)},s=(h=t==null?void 0:t.read)==null?void 0:h.optionalFields,a=m=>{r&&s&&s.forEach(b=>{Vn(b)||Mc(r,n,b.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(Et,{string:`${e} reads the following optional fields`}),l.jsxs(Ed,{children:[((s==null?void 0:s.length)||0)>=2&&l.jsx(Od,{id:"select-all-fields",isChecked:u,label:"Select all",onCheckedChange:a,isIndeterminate:d}),l.jsx(Sd,{children:s.map(m=>Vn(m)?null:l.jsx(Cd,{id:m.fieldName,isChecked:!!(o!=null&&o[m==null?void 0:m.fieldName]),label:m.displayName,onCheckedChange:b=>i(b,m.fieldName)},m.fieldName))})]})]})}function Db(){return l.jsx(Fb,{})}const Mb={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 kb({children:e,style:t,...n}){return l.jsx("span",{style:{...Mb,...t},...n,children:e})}function jb(){var n,r,o;const{configureState:e}=Xt(),{appName:t}=Te();return l.jsxs(l.Fragment,{children:[l.jsx(Et,{string:`${t} reads the following fields`}),l.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:(r=(n=e==null?void 0:e.read)==null?void 0:n.requiredFields)!=null&&r.length?(o=e.read)==null?void 0:o.requiredFields.map(i=>Vn(i)?null:l.jsx(kb,{children:i.displayName},i.fieldName)):"There are no required fields."})]})}function Lb(e,t,n,r,o){e.read&&(e.read.selectedValueMappings||(e.read.selectedValueMappings={}),e.read.selectedValueMappings[o]||(e.read.selectedValueMappings[o]={}),r===""&&e.read.selectedValueMappings[o][n]?delete e.read.selectedValueMappings[o][n]:e.read.selectedValueMappings[o][n]=r)}function Nd(e,t,n,r,o){t(e,i=>Lb(i,e,n,r,o))}function Kb(e,t,n){t(e,r=>{r.read&&(r.read.isValueMappingsModified=n)})}function Vb({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 Ub({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r,hasError:o}){var C;const{configureState:i,selectedObjectName:s,setConfigureState:a}=Xt(),[c,u]=v.useState(!0),{getError:d,setError:f,resetBoundary:h,isError:m,removeError:b}=Dt(),w=v.useMemo(()=>{var S,T;return((T=(S=i==null?void 0:i.read)==null?void 0:S.selectedValueMappings)==null?void 0:T[n])||{}},[(C=i==null?void 0:i.read)==null?void 0:C.selectedValueMappings,n]),p=v.useMemo(()=>w==null?void 0:w[e.mappedValue],[w,e.mappedValue]);v.useEffect(()=>{u(!1)},[e,a,s,p,i]);const _=v.useMemo(()=>r.map(S=>({id:S.value,label:S.displayValue,value:S.value})),[r]),g=v.useCallback(S=>{if(S){if(Object.values(w).some(T=>T===S.value&&T!==p)){const T=[...Object.entries(w).filter(([R,F])=>F===S.value&&F!==p).map(([R])=>R),e.mappedValue];f(ue.VALUE_MAPPING,n,T);return}d(ue.VALUE_MAPPING,n)&&h(ue.VALUE_MAPPING),t({target:{name:e.mappedValue,value:S.value,fieldName:n}})}},[t,w,p,n,e.mappedValue,h,f,d]),y=v.useMemo(()=>l.jsx(Ju,{disabled:c,items:_,selectedValue:p||null,onSelectedItemChange:g,placeholder:"Please select one",style:{border:o?"2px solid red":void 0,borderRadius:"8px",width:"100%"}},p),[p,c,_,g,o]),I=v.useCallback(()=>{s&&(Nd(s,a,e.mappedValue,"",n),m(ue.VALUE_MAPPING,n)&&b(ue.VALUE_MAPPING,n))},[s,a,e.mappedValue,n,m,b]);return l.jsxs("div",{style:{display:"flex",flexDirection:"column",marginBottom:".25rem"},children:[l.jsx("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:l.jsx("span",{style:{fontWeight:500},children:e.mappedDisplayValue})}),l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[y,l.jsx(ze,{type:"button",variant:"ghost",onClick:I,children:"Clear"})]})]},e.mappedValue)}function $b(){var m,b,w;const{fieldMapping:e}=rt(),{selectedObjectName:t,configureState:n,setConfigureState:r}=Xt(),{isError:o,removeError:i,getError:s}=Dt(),a=(m=n==null?void 0:n.read)==null?void 0:m.selectedFieldMappings,c=(b=n==null?void 0:n.read)==null?void 0:b.selectedValueMappings,u=(w=n==null?void 0:n.read)==null?void 0:w.isValueMappingsModified,d=v.useRef(!1),f=v.useMemo(()=>{const p=t&&e?Object.values(e[t]||{}).flat().filter(_=>_.mappedValues).map(_=>({..._})):[];if(a)for(let _=0;_<p.length;_+=1){const{mapToName:g}=p[_];a!=null&&a[g]&&(p[_].fieldName=a[g])}return p},[t,e,a]),h=v.useCallback(p=>{const{value:_,name:g,fieldName:y}=p.target;_&&(t&&Nd(t,r,g,_,y),o(ue.VALUE_MAPPING,g)&&i(ue.VALUE_MAPPING,g))},[t,r,o,i]);return v.useEffect(()=>{var p;if(t&&c){const _=((p=e==null?void 0:e[t])==null?void 0:p.filter(y=>y.fieldName&&y.mappedValues.length>0))||[];_.every(y=>{const I=c[y.fieldName]||{};return Object.keys(I).length===Object.keys(y.mappedValues).length})&&_.length>0?!u&&!d.current&&(Kb(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(p=>{var S,T,R;if(!p.fieldName)return null;const _=(T=(S=n==null?void 0:n.read)==null?void 0:S.allFieldsMetadata)==null?void 0:T[p.fieldName],g=_==null?void 0:_.valueType;if(!["singleSelect","multiSelect"].includes(g))return console.error("fieldName is not a singleSelect or multiSelect",p),null;const y=_==null?void 0:_.values;if(!y)return null;const I=Object.keys(y).length,C=Object.keys((p==null?void 0:p.mappedValues)||[]).length;return I!==C?(console.error("field values and the values to be mapped are not of the same length",p,y),null):l.jsxs(l.Fragment,{children:[l.jsx(Vb,{string:"Map the values for ",fieldName:p.mapToDisplayName||p.mapToName||p.fieldName}),l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:l.jsx(bo,{id:p.mapToName||p.fieldName,children:(R=p==null?void 0:p.mappedValues)==null?void 0:R.map(F=>{var Y,B,ce;const U=s(ue.VALUE_MAPPING,p.fieldName),Q=Array.isArray(U)&&U.includes(F.mappedValue),J=((ce=(B=(Y=n==null?void 0:n.read)==null?void 0:Y.allFieldsMetadata)==null?void 0:B[p.fieldName])==null?void 0:ce.values)||[];return l.jsxs(l.Fragment,{children:[l.jsx(Ub,{allValueOptions:J,mappedValue:F,onSelectChange:h,fieldName:(p==null?void 0:p.fieldName)||"",hasError:Q},`${F.mappedValue}-${p.fieldName}`),Q&&l.jsx("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:`Each ${p.mapToName||p.fieldName} must be mapped to a unique value`},F.mappedValue)]})})},p.mapToName||p.fieldName)})]})})}):null}function qb(){return tb(),l.jsxs(l.Fragment,{children:[l.jsx(ib,{}),l.jsx(jb,{}),l.jsx(ZI,{}),l.jsx(YI,{}),l.jsx($b,{}),l.jsx(Db,{})]})}function Hb(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=!iv(a,s);e.write.isWriteModified=u}}}function kc(e,t,n,r){t(e,o=>{Hb(o,n,r)})}function Bb(){var f,h,m,b;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=Xt(),o=(f=n==null?void 0:n.write)==null?void 0:f.selectedWriteObjects,i=(h=n==null?void 0:n.write)==null?void 0:h.writeObjects,s=(w,p)=>{w!=="indeterminate"&&t&&n&&kc(t,r,p,w)},a=w=>{var p,_;t&&n&&((_=(p=n==null?void 0:n.write)==null?void 0:p.writeObjects)==null||_.forEach(g=>{kc(t,r,g.objectName,w)}))},c=!!i,u=Object.keys(o||{}).length===((b=(m=n==null?void 0:n.write)==null?void 0:m.writeObjects)==null?void 0:b.length),d=!u&&Object.keys(o||{}).length>0;return c&&l.jsxs(l.Fragment,{children:[l.jsx(Et,{string:`Allow ${e} to write to these objects`}),l.jsxs(Ed,{children:[((i==null?void 0:i.length)||0)>=2&&l.jsx(Od,{id:"select-all-fields",onCheckedChange:a,isIndeterminate:d,isChecked:u,label:"Select all"}),l.jsx(Sd,{children:i.map(w=>l.jsx(Cd,{id:w.objectName,onCheckedChange:p=>s(p,w.objectName),isChecked:!!(o!=null&&o[w.objectName]),label:w.displayName},w.objectName))})]})]})}function Jb(){return l.jsx(l.Fragment,{children:l.jsx(Bb,{})})}const Wb="_authenticationRow_cjz1t_1",zb="_field_cjz1t_8",Gb="_value_cjz1t_12",Wo={authenticationRow:Wb,field:zb,value:Gb};function jc({label:e,value:t}){return l.jsxs("div",{className:Wo.authenticationRow,children:[l.jsx("div",{className:Wo.field,children:e}),l.jsx("div",{className:Wo.value,children:t})]})}function Qb(){const{selectedConnection:e}=Qt(),{providerName:t}=ct(),r=(e==null?void 0:e.provider)==="salesforce"?"subdomain":"workspace",o=`${t} ${r}`;return l.jsxs(l.Fragment,{children:[l.jsx(Et,{string:"Connection details"}),l.jsxs("div",{style:{paddingBottom:"1rem"},children:[l.jsx(jc,{label:o,value:e==null?void 0:e.providerWorkspaceRef}),l.jsx(jc,{label:"Status",value:e==null?void 0:e.status})]})]})}const Xb=()=>{const e=dt(),t=vt();return Wr({mutationFn:async({projectIdOrName:n,integrationId:r,installationId:o})=>(await e()).installationApi.deleteInstallation({projectIdOrName:n,integrationId:r,installationId:o}),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]})},onError:n=>{console.error("Error uninstalling installation."),Le(n)}})};function Td({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const{projectId:r}=Te(),{integrationId:o,installation:i,setIntegrationDeleted:s,onUninstallSuccess:a}=rt(),[c,u]=v.useState(!1),d=!r||!o||!(i!=null&&i.id)||c,f=Xb(),h=async()=>{d||(u(!0),console.warn("uninstalling installation",{projectId:r,integrationId:o,installationId:i.id}),f.mutate({projectIdOrName:r,integrationId:o,installationId:i.id},{onSuccess:()=>{console.warn("successfully uninstalled installation:",i.id),a==null||a(i==null?void 0:i.id),s()},onSettled:()=>u(!1)}))},m=c?"Uninstalling...":e,b=l.jsx(ze,{type:"button",onClick:h,disabled:d,variant:t,style:n,children:m});return i!=null&&i.id?b:null}function Yb(){const{installation:e}=rt(),{providerName:t}=ct();return e?l.jsxs(l.Fragment,{children:[l.jsx(Et,{string:"Uninstall entire integration"}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",padding:"1rem 0"},children:[e!=null&&e.id?l.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:["By clicking below, you will uninstall the entire ",t," ","integration. You will lose any configuration you've set up."]}):l.jsx("p",{children:"You've successfully uninstalled the integration."}),l.jsx(Td,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})]}):null}function qn({error:e}){return e?l.jsx(wi,{style:{marginTop:"2em"},children:e}):null}const Zb="_input_1ymb7_1",ex="_inputError_1ymb7_27",tx="_error_1ymb7_43",zo={input:Zb,inputError:ex,error:tx};function nx({id:e,type:t,className:n,isError:r=!1,...o}){const i=r?Ft(zo.inputError,zo.input):zo.input;return l.jsx("input",{id:e,type:t,className:Ft(i,n),...o})}const rx="_textarea_18zl4_1",ix="_textareaError_18zl4_14",ox="_error_18zl4_29",Go={textarea:rx,textareaError:ix,error:ox};function sx({className:e,isError:t=!1,...n}){const r=t?Ft(Go.textareaError,Go.textarea):Go.textarea;return l.jsx("textarea",{className:Ft(e,r),...n})}const tn={Input:nx,Textarea:sx},ax=()=>{const{project:e}=Te(),t=e==null?void 0:e.id,n=dt();return yn({queryKey:["project",t,"entitlements"],queryFn:async()=>{if(!t)throw new Error("Project ID is required");return(await n()).projectApi.getProject({projectIdOrName:t,includeEntitlements:!0})},enabled:!!t})};function Rd(){var n,r;const{data:e}=ax();return((r=(n=e==null?void 0:e.entitlements)==null?void 0:n.brandingRemoval)==null?void 0:r.value)===!0?null:l.jsxs("footer",{style:{backgroundColor:"light-dark(#EFEFEF, #646266)",padding:"1em",fontSize:"0.8em",color:"gray",display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"0 0 4px 4px",gap:"0.4em"},children:[l.jsx("p",{style:{color:"light-dark(gray, #EFEFEF)"},children:"Secured by"}),l.jsx("a",{href:"https://www.withampersand.com/",target:"_blank","aria-label":"Go to Ampersand",rel:"noreferrer noopener",children:l.jsxs("picture",{children:[l.jsx("source",{srcSet:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",media:"(prefers-color-scheme: light)"}),l.jsx("source",{srcSet:"https://res.cloudinary.com/dycvts6vp/image/upload/v1735853540/ampersand_logo_white.svg",media:"(prefers-color-scheme: dark)"}),l.jsx("img",{style:{height:".8em"},src:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",alt:"Ampersand"})]})})]})}function yr({children:e}){return l.jsx(zr,{children:l.jsxs(vn,{children:[l.jsx("div",{style:{padding:"3rem 2rem"},children:e}),l.jsx(Rd,{})]})})}function vr({children:e}){return l.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function cx({children:e}){return l.jsx("p",{style:{padding:".5em 0"},children:e})}const lx="_link_oo2kv_1",ux={link:lx};function Ad({href:e,className:t,style:n,label:r,children:o,newTab:i=!1}){return l.jsx("a",{className:Ft(ux.link,t),style:n,href:e,"aria-label":r||void 0,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:o})}function As({url:e,providerDisplayName:t,credentialName:n}){return l.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[l.jsx(Ad,{href:e,newTab:!0,children:l.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," ","about where to find your ",t," ",n,"."]})}function Pd({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o,submitButtonType:i}){var p;const[s,a]=v.useState(!1),c=()=>a(_=>!_),[u,d]=v.useState(""),f=_=>d(_.currentTarget.value),{providerName:h}=ct(e),m=u.length>0,b=r||!m,w=(p=t.apiKeyOpts)==null?void 0:p.docsURL;return l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[w&&l.jsx(As,{url:w,providerDisplayName:h||dr(e),credentialName:"API key"}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(tn.Input,{id:"password",name:"password",type:s?"text":"password",placeholder:"API Key",onChange:_=>f(_)}),l.jsx(ze,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:c,variant:o,children:s?"Hide":"Show"})]}),l.jsx(ze,{style:{marginTop:"1em",width:"100%"},disabled:b,type:i||"submit",onClick:()=>n({apiKey:u}),variant:o,children:"Next"})]})}function dx({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=ct(e);return l.jsxs(yr,{children:[l.jsx(vr,{children:`Set up ${i} integration`}),l.jsx(qn,{error:r}),l.jsx(Pd,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function fx({...e}){return l.jsx(dx,{...e})}const px={backgroundColor:"var(--amp-colors-status-success-muted)",borderColor:"var(--amp-colors-status-success-muted)",color:"var(--amp-colors-status-success-dark)",padding:".5rem 1rem"};function Oo({children:e,style:t}){return l.jsx(vn,{style:{...px,...t},children:e})}const va=()=>{const e=dt(),t=vt(),[n,r]=v.useState(null);return{...Wr({mutationKey:["updateConnection"],mutationFn:async i=>(await e()).connectionApi.updateConnection(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)}}),errorMsg:n}};function hx({provider:e}){const{projectIdOrName:t}=Te(),{providerName:n,data:r}=ct(e),{selectedConnection:o,isConnectionsLoading:i}=Qt(),{mutateAsync:s,isPending:a,error:c}=va(),[u,d]=v.useState(null),[f,h]=v.useState(!1),m=()=>h(!1),b=()=>{h(!0),d(null)},w=(c==null?void 0:c.message)||u||null,p=async _=>{m(),d(null);try{await s({projectIdOrName:t||"",connectionId:(o==null?void 0:o.id)||"",updateConnectionRequest:{updateMask:["apiKey"],connection:{apiKey:_.apiKey}}},{onError:g=>{console.error("Update connection error:",g),Le(g,d)},onSuccess:()=>{b()}})}catch(g){console.error("Update connection caught error:",g),Le(g,d)}};return r?l.jsxs(l.Fragment,{children:[l.jsx(Et,{string:"Update connection"}),l.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[l.jsx("p",{children:`Update ${n} API Key`}),f&&l.jsx(Oo,{children:"Connection updated successfully"}),w&&l.jsx(wi,{children:`Error updating connection ${w}`}),l.jsx(Pd,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:p,isButtonDisabled:a||i,buttonVariant:"ghost",submitButtonType:"button"})]})]}):null}function Fd({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o,requiredProviderMetadata:i=[]}){var g;const[s,a]=v.useState(!1),c=()=>a(y=>!y),[u,d]=v.useState({username:"",password:""}),{username:f,password:h}=u,{providerName:m}=ct(e),b=y=>{const{name:I,value:C}=y.currentTarget;d(S=>({...S,[I]:C}))},w=()=>{const y={};let I=!1;i.forEach(C=>{const S=u[C.name];!S||S.trim()===""?I=!0:y[C.name]=S}),!I&&n({user:f,pass:h,...Object.keys(y).length>0&&{providerMetadata:y}})},p=r||!f||!h||i.some(y=>!u[y.name]||u[y.name].trim()===""),_=(g=t.basicOpts)==null?void 0:g.docsURL;return l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[_&&l.jsx(As,{url:_,providerDisplayName:m||dr(e),credentialName:"credentials"}),l.jsx(tn.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:y=>b(y)}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(tn.Input,{id:"password",name:"password",type:s?"text":"password",placeholder:"Password",onChange:y=>b(y)}),l.jsx(ze,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:c,variant:o,children:s?"Hide":"Show"})]}),i.map(y=>l.jsxs("div",{children:[y.docsURL&&l.jsx(As,{url:y.docsURL,providerDisplayName:m||dr(e),credentialName:y.displayName||y.name}),l.jsx(tn.Input,{id:y.name,name:y.name,type:"text",placeholder:y.displayName||y.name,onChange:I=>b(I)})]},y.name)),l.jsx(ze,{style:{marginTop:"1em",width:"100%"},disabled:p,type:"button",onClick:w,variant:o,children:"Next"})]})}function mx({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o,requiredProviderMetadata:i}){const{providerName:s}=ct(e);return l.jsxs(yr,{children:[l.jsx(vr,{children:`Set up ${s} integration`}),l.jsx(qn,{error:r}),l.jsx(Fd,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o,requiredProviderMetadata:i})]})}function gx({...e}){return l.jsx(mx,{...e})}function yx({provider:e}){const{projectIdOrName:t}=Te(),{providerName:n,data:r}=ct(e),{selectedConnection:o,isConnectionsLoading:i}=Qt(),{mutateAsync:s,isPending:a,error:c}=va(),[u,d]=v.useState(null),[f,h]=v.useState(!1),m=()=>h(!1),b=()=>{h(!0),d(null)},w=(c==null?void 0:c.message)||u||null,p=async _=>{m(),d(null);try{await s({projectIdOrName:t||"",connectionId:(o==null?void 0:o.id)||"",updateConnectionRequest:{updateMask:["basicAuth"],connection:{basicAuth:{username:_.user,password:_.pass}}}},{onError:g=>{console.error(g),Le(g,d)},onSuccess:()=>{b()}})}catch(g){console.error(g),Le(g,d)}};return r?l.jsxs(l.Fragment,{children:[l.jsx(Et,{string:"Update connection"}),l.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[l.jsx("p",{children:`Update ${n} credentials`}),f&&l.jsx(Oo,{children:"Connection updated successfully"}),w&&l.jsx(wi,{children:`Error updating connection: ${w}`}),l.jsx(Fd,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:p,isButtonDisabled:a||i,buttonVariant:"ghost"})]})]}):null}function Dd({handleSubmit:e,isButtonDisabled:t,explicitScopesRequired:n,explicitWorkspaceRequired:r,buttonVariant:o}){const[i,s]=v.useState(!1),[a,c]=v.useState({clientSecret:"",clientId:"",workspace:"",scopes:""}),u=()=>s(I=>!I),d=I=>{const{name:C,value:S}=I.currentTarget;c(T=>({...T,[C]:S}))},{clientSecret:f,clientId:h,workspace:m,scopes:b}=a,w=f.length>0,p=h.length>0,_=r?m.length>0:!0,g=t||!w||!p||!_,y=()=>{const I={clientId:h,clientSecret:f};r&&(I.workspace=m),n&&b.length>0&&(I.scopes=By(b)),e(I)};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[r&&l.jsx(tn.Input,{id:"workspace",name:"workspace",type:"text",placeholder:"MyWorkspace",onChange:I=>d(I)}),l.jsx(tn.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:I=>d(I)}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(tn.Input,{id:"clientSecret",name:"clientSecret",type:i?"text":"password",placeholder:"Client Secret",onChange:I=>d(I)}),l.jsx(ze,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:u,variant:o,children:i?"Hide":"Show"})]}),n&&l.jsx(tn.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:I=>d(I)})]}),l.jsx("br",{}),l.jsx(ze,{style:{width:"100%"},disabled:g,type:"button",onClick:y,variant:o,children:"Next"})]})}function vx({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,explicitScopesRequired:o,explicitWorkspaceRequired:i}){return l.jsxs(yr,{children:[l.jsx(vr,{children:`Set up ${r} integration`}),l.jsx(qn,{error:t}),l.jsx("br",{}),l.jsx(Dd,{handleSubmit:e,isButtonDisabled:n,explicitScopesRequired:o,explicitWorkspaceRequired:i})]})}function wx({provider:e}){var g;const{projectIdOrName:t}=Te(),{selectedConnection:n,isConnectionsLoading:r}=Qt(),{providerName:o,data:i}=ct(e),{mutateAsync:s,isPending:a,error:c}=va(),[u,d]=v.useState(null),[f,h]=v.useState(!1),m=()=>{h(!1)},b=()=>{h(!0),d(null)},w=(g=i==null?void 0:i.oauth2Opts)==null?void 0:g.explicitScopesRequired,p=(c==null?void 0:c.message)||u||null,_=async y=>{m(),d(null);try{await s({projectIdOrName:t||"",connectionId:(n==null?void 0:n.id)||"",updateConnectionRequest:{updateMask:["oauth2ClientCredentials"],connection:{oauth2ClientCredentials:{clientId:y.clientId,clientSecret:y.clientSecret,scopes:y.scopes}}}}),b()}catch(I){Le(I,d)}};return l.jsxs(l.Fragment,{children:[l.jsx(Et,{string:"Update connection"}),l.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[l.jsx("p",{children:`Re-authenticate to ${o}`}),f&&l.jsx(Oo,{children:"Connection updated successfully"}),p&&l.jsx(wi,{children:`Error updating connection ${p}`}),l.jsx(Dd,{handleSubmit:_,isButtonDisabled:a||r,explicitScopesRequired:w,explicitWorkspaceRequired:!1,buttonVariant:"ghost"})]})]})}const Lc=600,Kc=600,Ix="AUTHORIZATION_SUCCEEDED",bx="AUTHORIZATION_FAILED";function xx(e,t,n,r){return v.useCallback(()=>{if(!r)return;const o=window.screenX+(window.outerWidth-Lc)/2,i=window.screenY+(window.outerHeight-Kc)/2.5,s=`width=${Lc},height=${Kc},left=${o},top=${i}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function _x(e,t,n,r){const o=vt();return v.useCallback(i=>{var s,a;if(i.origin===xy){if(i.data.eventType===Ix){const c=(s=i.data.data)==null?void 0:s.connection;c?(e(c),o.setQueriesData({queryKey:["amp","connections"]},()=>[c]),t==null||t.close(),r==null||r(),o.invalidateQueries({queryKey:["amp","connections"]})):console.error("Connection ID not found in event data: ",{event:i})}i.data.eventType===bx&&(console.error("OAuth failed: ",{event:i}),n==null||n(((a=i==null?void 0:i.data)==null?void 0:a.message)??"Something went wrong. Please try again."))}},[t,n,o,e,r])}function wa({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:o,onSuccessConnect:i,isSuccessConnect:s,onWindowClose:a}){const[c,u]=v.useState(null),[d,f]=v.useState(null),h=vt(),m=_x(u,d,r,i),b=xx(n,f,m,t);return v.useEffect(()=>{t&&!d&&!c&&!o&&!s&&b()},[t,d,b,c,o,s]),v.useEffect(()=>{if(!d)return;const w=setInterval(()=>{d.closed&&(clearInterval(w),window.removeEventListener("message",m),f(null),!c&&!o?(console.error("OAuth failed. Please try again."),r==null||r("Authentication was cancelled. Please try again.")):c&&(r==null||r(null)),h.invalidateQueries({queryKey:["amp","connections"]}),a==null||a())},500);return()=>{clearInterval(w),window.removeEventListener("message",m)}},[d,c,o,m,r,a,h]),l.jsx("div",{children:e})}const Cx=()=>{const e=dt(),t=vt();return Wr({mutationKey:["updateOauthConnection"],mutationFn:async n=>{const r=await e();if(!n.projectIdOrName||!n.connectionId)throw new Error("Project ID and connection ID are required");return r.oAuthApi.oauthUpdate(n)},onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})};function Ox({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return l.jsxs("div",{style:{padding:"1rem 0"},children:[l.jsx("p",{children:`Re-authenticate to ${r}`}),l.jsx(qn,{error:t}),l.jsx(ze,{variant:"ghost",style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function Ex({provider:e}){const{selectedConnection:t,isConnectionsLoading:n}=Qt(),r=t==null?void 0:t.id,o=t==null?void 0:t.projectId,{providerName:i}=ct(e),{mutateAsync:s,isPending:a,error:c}=Cx(),[u,d]=v.useState(null),[f,h]=v.useState(!1),[m,b]=v.useState(null),w=()=>{h(!1)},p=()=>{h(!0),d(null),b(null)},_=(c==null?void 0:c.message)||u||null,g=async()=>{w(),d(null);try{const I=await s({projectIdOrName:o||"",connectionId:r||""});b(I)}catch(I){Le(I,d)}},y=v.useCallback(I=>{d(I)},[]);return l.jsxs(l.Fragment,{children:[l.jsx(Et,{string:"Update connection"}),f&&l.jsx(Oo,{children:"Connection updated successfully"}),l.jsx(wa,{windowTitle:`Connect to ${i}`,oauthUrl:m||null,onError:y,error:_,isSuccessConnect:f,onSuccessConnect:p,children:l.jsx(Ox,{handleSubmit:g,error:_,providerName:i,isButtonDisabled:a||n||f})})]})}function Md({provider:e}){var r;const{data:t}=ma(e);if((t==null?void 0:t.authType)===qa.Basic)return l.jsx(yx,{provider:e});if((t==null?void 0:t.authType)===qa.ApiKey)return l.jsx(hx,{provider:e});const n=(r=t==null?void 0:t.oauth2Opts)==null?void 0:r.grantType;if(n){if(n===Do.AuthorizationCode||n===Do.AuthorizationCodePkce)return l.jsx(Ex,{provider:e});if(n===Do.ClientCredentials)return l.jsx(wx,{provider:e})}return null}function Sx(){return l.jsxs(l.Fragment,{children:[l.jsx(Qb,{}),l.jsx(Md,{}),l.jsx(Yb,{})]})}function kd({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:o}){var S,T,R,F;const{installation:i}=rt(),{hydratedRevision:s,loading:a}=Qr(),{configureState:c,selectedObjectName:u}=Xt(),d=i==null?void 0:i.config,f=d&&u&&!!Jl(d,u)||!1,h=((S=c==null?void 0:c.read)==null?void 0:S.isOptionalFieldsModified)||((T=c==null?void 0:c.read)==null?void 0:T.isRequiredMapFieldsModified)||((R=c==null?void 0:c.read)==null?void 0:R.isValueMappingsModified),m=(F=c==null?void 0:c.write)==null?void 0:F.isWriteModified,_=a||n||!c||!u||!(h||m||r||u!==fr&&!f),g=u===fr,y=u===Zi,I=l.jsx(ze,{type:"submit",disabled:_,children:r?"Install":"Save"}),C=l.jsx(ze,{type:"button",onClick:t,disabled:_,variant:"ghost",children:"Reset"});return n?l.jsx(ci,{}):l.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[l.jsx("div",{style:{display:"flex",flexDirection:"row-reverse",gap:".8rem",marginBottom:"20px",height:"3rem"},children:!y&&l.jsxs(l.Fragment,{children:[I,C]})}),l.jsxs(vn,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[o&&l.jsx(wi,{children:typeof o=="string"?o:"Installation Failed."}),a&&l.jsx(ci,{}),s&&!g&&!y&&l.jsx(qb,{}),s&&g&&!y&&l.jsx(Jb,{}),!a&&y&&l.jsx(Sx,{})]})]})}const jd=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:o,onUpdateSuccess:i}=rt(),{hydratedRevision:s,loading:a}=Qr(),{selectedObjectName:c}=id(),{selectedConnection:u}=Qt(),d=ll(),{projectId:f}=Te(),{resetBoundary:h,setErrors:m,setError:b,getError:w}=Dt(),{resetConfigureState:p,objectConfigurationsState:_,resetPendingConfigurationState:g}=pa(),y=nu(c||"",_),{onNextIncompleteTab:I}=SI(),C=v.useCallback(()=>{h(ue.INSTALLATION_MUTATION)},[h]),S=v.useCallback(R=>R?F=>{b(ue.INSTALLATION_MUTATION,R,F)}:F=>{console.error("objectName is required to set installation error: ",F)},[b]),T=v.useCallback(R=>R?w(ue.INSTALLATION_MUTATION,R):"",[w]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:s,loading:a,selectedObjectName:c,selectedConnection:u,apiKey:d,projectId:f,resetBoundary:h,setErrors:m,setMutateInstallationError:S,getMutateInstallationError:T,resetMutateInstallationErrorState:C,resetConfigureState:p,objectConfigurationsState:_,resetPendingConfigurationState:g,configureState:y,onInstallSuccess:o,onUpdateSuccess:i,onNextIncompleteTab:I}},Nx=void 0;function Tx(){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:h,getMutateInstallationError:m,resetMutateInstallationErrorState:b,resetConfigureState:w,objectConfigurationsState:p,resetPendingConfigurationState:_,configureState:g,onInstallSuccess:y,onNextIncompleteTab:I}=jd(),[C,S]=v.useState(!1),T=s===fr,R=m(s),F=v.useCallback(()=>{d(ue.MAPPING),o!=null&&o.content&&!i&&s&&Yl(o,Nx,s,w)},[d,o,i,s,w]);v.useEffect(()=>{!g&&(o!=null&&o.content)&&!i&&F()},[g,p,o,i,F]);const U=()=>{b();const{requiredMapFields:Y,selectedFieldMappings:B}=(g==null?void 0:g.read)||{},{errorList:ce}=Gl(Y,B,f);ce.length>0||(s&&(a!=null&&a.id)&&c&&u&&e&&t&&n&&o?(S(!0),uv(u,e,t,n,a.id,s,c,o,g,h(s),r,y).finally(()=>{S(!1),_(s),I()})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},Q=()=>{b(),s&&(a!=null&&a.id)&&c&&u&&e&&t&&n&&o?(S(!0),pv(u,e,t,n,a.id,c,o,g,h(s),r,y).finally(()=>{S(!1),_(s),I()})):console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},J=Y=>{Y.preventDefault(),T?Q():U()};return l.jsx(kd,{errorMsg:R,isCreateMode:!0,isLoading:C,onSave:J,onReset:F})}function Rx({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.${Wy(i)}`],installation:{config:e}}};return Ls().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=>{Le(d,c)})}const Ax=(e,t,n,r,o,i)=>{const s=Zl(e),a=eu(e),c=tu(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 vi(o)&&(u.content||(u.content={}),u.content.proxy={enabled:!0}),u},Px=(e,t,n,r,o,i,s,a,c,u,d)=>{const f=Ax(i,r||"",a,a.schedule,c,a.backfill);return f?Rx({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))},Fx=(e,t)=>{const r={content:{write:{objects:iu(e)}}};return vi(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r},Dx=(e,t,n,r,o,i,s,a,c)=>{const u=Fx(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 Ls().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=>{Le(f,s)})};function Mx({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:h,resetPendingConfigurationState:m,configureState:b,onUpdateSuccess:w,onNextIncompleteTab:p}=jd(),[_,g]=v.useState(!1),y=i===fr,I=f(i),{config:C}=e,S=v.useCallback(()=>{c(ue.MAPPING),r!=null&&r.content&&!o&&i&&Yl(r,C,i,h)},[c,r,o,i,C,h]);v.useEffect(()=>{b||S()},[b,S]);const T=v.useMemo(()=>{var J,Y,B;return(B=(Y=(J=r==null?void 0:r.content)==null?void 0:J.read)==null?void 0:Y.objects)==null?void 0:B.find(ce=>(ce==null?void 0:ce.objectName)===i)},[r,i]),R=()=>{const{requiredMapFields:Q,selectedFieldMappings:J}=(b==null?void 0:b.read)||{},{errorList:Y}=Gl(Q,J,u);Y.length>0||(r&&e&&i&&s&&a&&T?(g(!0),Px(a,t.id,e.id,i,s,b,n,T,r,d(i),w).finally(()=>{g(!1),m(i),p()})):console.error("UpdateInstallation - onSaveUpdate missing required props"))},F=()=>{e&&i&&s&&a&&r?(g(!0),Dx(a,t.id,e.id,s,b,r,d(i),n,w).finally(()=>{g(!1),m(i),p()})):console.error("UpdateInstallation - onSaveUpdate missing required props")},U=Q=>{Q.preventDefault(),y?F():R()};return l.jsx(kd,{errorMsg:I,onSave:U,onReset:S,isLoading:_})}function kx(){const{integrationObj:e,installation:t}=rt();return e?t&&e?l.jsx(Mx,{installation:t,integrationObj:e}):l.jsx(Tx,{}):l.jsx(jl,{message:"We can't load the integration"})}const jx=()=>{const e=dt(),t=vt(),[n,r]=v.useState(null);return{...Wr({mutationKey:["createInstallation"],mutationFn:async i=>(await e()).installationApi.createInstallation(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:i=>{console.error("Error creating installation"),Le(i,r)}}),errorMsg:n}};function Lx(){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 Ia({text:e,children:t}){return l.jsx(zr,{children:l.jsxs(vn,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[l.jsx(Lx,{}),l.jsx("p",{children:e}),t]})})}function Kx({provider:e}){const{providerName:t}=ct(e),n=`You have successfully installed your ${t} integration.`;return l.jsx(Ia,{text:n,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:l.jsx(Td,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const Vx=e=>{const{read:t,write:n}=(e==null?void 0:e.content)??{};return!t&&!n};function Ux({children:e}){var C;const t=v.useRef(!1),{projectId:n}=Te(),{hydratedRevision:r,loading:o}=Qr(),{integrationObj:i,installation:s,groupRef:a,consumerRef:c,onInstallSuccess:u,isIntegrationDeleted:d}=rt(),{mutate:f,isIdle:h,isPending:m,error:b,errorMsg:w}=jx(),{selectedConnection:p,isConnectionsLoading:_}=Qt(),g=o||m||_,y=(C=r==null?void 0:r.content)==null?void 0:C.provider,I=Vx(r);return v.useEffect(()=>{var S;if(!g&&!_&&r&&I&&!s&&p&&(i!=null&&i.id)&&!d&&y){const T={projectIdOrName:n,integrationId:i==null?void 0:i.id,installation:{groupRef:a,connectionId:p==null?void 0:p.id,config:{content:{provider:y}}}};vi(r)===!0&&(T.installation.config.content.proxy=(S=r==null?void 0:r.content)==null?void 0:S.proxy),h&&!t.current&&(f(T,{onSuccess:R=>{u==null||u(R==null?void 0:R.id,R.config)}}),t.current=!0)}},[r,I,s,p,n,i==null?void 0:i.id,a,c,g,u,d,_,y,f,h]),I&&y&&s?l.jsx(Kx,{provider:y}):b?l.jsx(Jt,{message:w??"Create installation failed"}):i?g?l.jsx(Gr,{}):l.jsx("div",{children:e}):l.jsx(Jt,{message:"We can't load the integration"})}function Eo(){const e=dt(),t=vt();return Wr({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"),Le(n)}})}function $x({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:c}=Te(),u=Eo(),d=v.useCallback(f=>{const{apiKey:h}=f,m={projectIdOrName:c,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,apiKey:h}};u.mutate(m)},[c,i,o,r,n,e,u]);return a===null?l.jsx(fx,{provider:e,providerInfo:t,handleSubmit:d,error:null}):s}function qx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){var f;const{projectIdOrName:c}=Te(),u=Eo(),d=v.useCallback(h=>{const{user:m,pass:b,providerMetadata:w}=h,p={projectIdOrName:c,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:m,password:b},...w&&{providerMetadata:Object.entries(w).reduce((_,[g,y])=>(_[g]={value:y,source:"input"},_),{})}}};u.mutate(p)},[c,i,o,r,n,e,u]);return a===null?l.jsx(gx,{provider:e,providerInfo:t,handleSubmit:d,error:null,requiredProviderMetadata:((f=t.metadata)==null?void 0:f.input)||[]}):s}function Hx({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(yr,{children:[l.jsx(vr,{children:i||`Set up ${r} integration`}),l.jsx(qn,{error:t}),o,l.jsx(ze,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function Bx({...e}){return l.jsx(Hx,{...e})}function Jx({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s,providerName:a}){const{projectIdOrName:c}=Te(),u=Eo(),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(Bx,{handleSubmit:d,error:null,providerName:a}):i}const Wx=()=>{const e=dt(),{projectIdOrName:t}=Te();return yn({queryKey:["amp","providerApps",t],queryFn:async()=>{if(!t)throw new Error("Project ID is required");return(await e()).providerAppApi.listProviderApps({projectIdOrName:t})},enabled:!!t})},zx=e=>{const t=dt(),n={connectOAuthParams:e};return yn({queryKey:["amp","oauthConnect",e.projectId,e.groupRef,e.consumerRef,e.provider],queryFn:async()=>{if(!e.projectId)throw new Error("Project ID is required");if(!(e!=null&&e.providerAppId))throw new Error("Provider App ID is required");if(!(e!=null&&e.provider))throw new Error("Provider is required");if(!(e!=null&&e.consumerRef))throw new Error("Consumer Ref is required");if(!(e!=null&&e.groupRef))throw new Error("Group Ref is required");return(await t()).oAuthApi.oauthConnect(n)},enabled:!1})},Gx=Vs("VITE_AMP_ENABLE_CSRF",!1),Qx=Vs("NEXT_AMP_ENABLE_CSRF",!1),Xx=Vs("REACT_APP_AMP_ENABLE_CSRF",!1),Yx=!!Gx||!!Qx||!!Xx,Ld=(e,t,n,r,o,i)=>{const{projectId:s}=Te(),{data:a,isLoading:c,error:u}=ma(n),{data:d,isLoading:f,error:h}=Wx(),m=d==null?void 0:d.find(C=>C.provider===n),b=a?Vl(n,a):null,w={providerWorkspaceRef:r,projectId:s,groupRef:t,groupName:i,consumerRef:e,consumerName:o,providerAppId:m==null?void 0:m.id,provider:n,enableCSRFProtection:Yx},{data:p,error:_,isLoading:g,refetch:y}=zx(w);return v.useEffect(()=>{a&&n&&!m&&console.error(`You must first set up a ${b} Provider App using the Ampersand Console.`)},[m,b,a,n]),v.useEffect(()=>{u&&(console.error("Error fetching provider info:",u),Le(u))},[u]),v.useEffect(()=>{h&&(console.error("Error fetching provider apps:",h),Le(h))},[h]),v.useEffect(()=>{_&&(console.error("Error fetching OAuth connect:",_),Le(_))},[_]),{url:p,error:u||h||_,isLoading:c||f||g,refetchOauthConnect:async()=>{var C,S;if((a==null?void 0:a.authType)==="oauth2"){if(((C=a==null?void 0:a.oauth2Opts)==null?void 0:C.grantType)==="authorizationCode"||((S=a==null?void 0:a.oauth2Opts)==null?void 0:S.grantType)==="authorizationCodePKCE")return await y();console.error("Provider does not support an OAuth2 web flow grant type.")}else console.error("Provider does not support an OAuth2 web flow.");return null}}};function Zx({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return l.jsxs(yr,{children:[l.jsx(vr,{children:`Set up ${r} integration`}),l.jsx(cx,{children:`Click Next to sign into the ${r} account you'd like to sync.`}),l.jsx(qn,{error:t}),l.jsx(ze,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function e_({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){const[s,a]=v.useState(null),[c,u]=v.useState(!1),{url:d,error:f,isLoading:h,refetchOauthConnect:m}=Ld(t,r,e,void 0,n,o),b=(f==null?void 0:f.message)||s||null,w=v.useCallback(y=>{a(y),u(!1)},[a]),p=v.useCallback(()=>{a(null),u(!1)},[a]),_=v.useCallback(()=>{u(!1)},[u]),g=async()=>{var I;a(null);const y=await m();y!=null&&y.data?u(!0):w(((I=y==null?void 0:y.error)==null?void 0:I.message)||"Authentication failed")};return l.jsx(wa,{windowTitle:`Connect to ${i}`,oauthUrl:c&&d||null,onError:w,error:b,onSuccessConnect:p,onWindowClose:_,children:l.jsx(Zx,{handleSubmit:g,error:b,providerName:i,isButtonDisabled:h})})}const t_="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function n_({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return l.jsxs(yr,{children:[l.jsx(vr,{children:"Enter your Salesforce subdomain"}),l.jsx(Ad,{href:t_,newTab:!0,children:"What is my Salesforce subdomain?"}),l.jsx(qn,{error:n}),l.jsxs("div",{style:{display:"flex",marginTop:"1em",alignItems:"center"},children:[l.jsx(tn.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(ze,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function r_({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r,providerName:o}){return l.jsxs(yr,{children:[l.jsxs(vr,{children:["Enter your ",o," workspace"]}),l.jsx(qn,{error:n}),l.jsx("br",{}),l.jsx(tn.Input,{id:"workspace",type:"text",placeholder:"MyWorkspace",onChange:i=>t(i.currentTarget.value)}),l.jsx("br",{}),l.jsx(ze,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const i_="salesforce";function o_({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){const[s,a]=v.useState(""),[c,u]=v.useState(null),[d,f]=v.useState(!1),{url:h,error:m,isLoading:b,refetchOauthConnect:w}=Ld(t,r,e,s,n,o),p=(m==null?void 0:m.message)||c||null,_=v.useCallback(S=>{u(S),f(!1)},[]),g=v.useCallback(()=>{u(null),f(!1)},[]),y=v.useCallback(()=>{f(!1)},[f]),I=async()=>{var T;if(u(null),!s){u("Workspace is required");return}const S=await w();S!=null&&S.data?f(!0):_(((T=S==null?void 0:S.error)==null?void 0:T.message)||"Authentication failed")},C=e===i_?l.jsx(n_,{handleSubmit:I,setWorkspace:a,error:p,isButtonDisabled:s.length===0}):l.jsx(r_,{handleSubmit:I,setWorkspace:a,error:p,isButtonDisabled:s.length===0||b,providerName:i});return l.jsx(wa,{windowTitle:`Connect to ${i}`,oauthUrl:d&&h||null,onError:_,error:p,onSuccessConnect:g,onWindowClose:y,children:C})}function s_({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,explicitScopesRequired:s,explicitWorkspaceRequired:a,selectedConnection:c}){const{projectIdOrName:u}=Te(),d=Eo(),[f,h]=v.useState(null),m=v.useCallback(b=>{h(null);const w={projectIdOrName:u,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:b.workspace,oauth2ClientCredentials:{clientId:b.clientId,clientSecret:b.clientSecret,scopes:b.scopes}}};d.mutate(w,{onError:()=>h("Error loading provider info")})},[u,i,o,r,n,e,d]);return c===null?l.jsx(vx,{providerName:t,handleSubmit:m,error:f,explicitScopesRequired:s,explicitWorkspaceRequired:a}):l.jsx(ci,{})}function a_({...e}){return l.jsx(s_,{...e})}const c_="authorizationCode",l_="authorizationCodePKCE",u_="clientCredentials";function d_({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,selectedConnection:s,setSelectedConnection:a}){const{providerName:c}=ct(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,h={provider:e,consumerRef:n,consumerName:r,groupRef:o,groupName:i,providerName:c};return u===c_||u===l_?f?l.jsx(o_,{...h}):l.jsx(e_,{...h}):u===u_?l.jsx(a_,{...h,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 f_(e){const{selectedConnection:t}=Qt();v.useEffect(()=>{e&&t&&e(t)},[e,t])}function p_({onSuccess:e}){f_(e)}function Kd({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:h,providerName:m,selectedProvider:b}=ct(e),{provider:w,isIntegrationDeleted:p}=rt(),{selectedConnection:_,setSelectedConnection:g}=Qt();p_({onSuccess:s});const y=vt();v.useEffect(()=>{f&&(console.error("Error loading provider info."),Le(h))},[f,h]);const I=v.useCallback(()=>{y.clear(),c()},[c,y]);if(!e&&!w)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(p)return l.jsx(Ia,{text:"Integration successfully uninstalled.",children:l.jsx(ze,{type:"button",onClick:I,style:{width:"100%"},children:"Reinstall Integration"})});if(_)return i;if(d)return l.jsx(Gr,{});if(u==null)return l.jsx(Jt,{message:"Provider info was not found."});const C={provider:b,consumerRef:t,consumerName:n,groupRef:r,groupName:o,selectedConnection:_,setSelectedConnection:g,providerName:m,providerInfo:u,onDisconnectSuccess:a};return u.authType==="none"?l.jsx(Jx,{...C,children:i}):u.authType==="basic"?l.jsx(qx,{...C,children:i}):u.authType==="apiKey"?l.jsx($x,{...C,children:i}):l.jsx(d_,{...C})}function h_(e){const t=e+"CollectionProvider",[n,r]=_o(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=w=>{const{scope:p,children:_}=w,g=v.useRef(null),y=v.useRef(new Map).current;return l.jsx(o,{scope:p,itemMap:y,collectionRef:g,children:_})};s.displayName=t;const a=e+"CollectionSlot",c=Rs(a),u=v.forwardRef((w,p)=>{const{scope:_,children:g}=w,y=i(a,_),I=Hr(p,y.collectionRef);return l.jsx(c,{ref:I,children:g})});u.displayName=a;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=Rs(d),m=v.forwardRef((w,p)=>{const{scope:_,children:g,...y}=w,I=v.useRef(null),C=Hr(p,I),S=i(d,_);return v.useEffect(()=>(S.itemMap.set(I,{ref:I,...y}),()=>void S.itemMap.delete(I))),l.jsx(h,{[f]:"",ref:C,children:g})});m.displayName=d;function b(w){const p=i(e+"CollectionConsumer",w);return v.useCallback(()=>{const g=p.collectionRef.current;if(!g)return[];const y=Array.from(g.querySelectorAll(`[${f}]`));return Array.from(p.itemMap.values()).sort((S,T)=>y.indexOf(S.ref.current)-y.indexOf(T.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:s,Slot:u,ItemSlot:m},b,r]}var m_=k[" useId ".trim().toString()]||(()=>{}),g_=0;function Vd(e){const[t,n]=k.useState(m_());return pi(()=>{e||n(r=>r??String(g_++))},[e]),e||(t?`radix-${t}`:"")}function y_(e){const t=k.useRef(e);return k.useEffect(()=>{t.current=e}),k.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}var v_=k.createContext(void 0);function Ud(e){const t=k.useContext(v_);return e||t||"ltr"}var Qo="rovingFocusGroup.onEntryFocus",w_={bubbles:!1,cancelable:!0},_i="RovingFocusGroup",[Ps,$d,I_]=h_(_i),[b_,qd]=_o(_i,[I_]),[x_,__]=b_(_i),Hd=k.forwardRef((e,t)=>l.jsx(Ps.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Ps.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(C_,{...e,ref:t})})}));Hd.displayName=_i;var C_=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,h=k.useRef(null),m=Hr(t,h),b=Ud(i),[w,p]=ga({prop:s,defaultProp:a??null,onChange:c,caller:_i}),[_,g]=k.useState(!1),y=y_(u),I=$d(n),C=k.useRef(!1),[S,T]=k.useState(0);return k.useEffect(()=>{const R=h.current;if(R)return R.addEventListener(Qo,y),()=>R.removeEventListener(Qo,y)},[y]),l.jsx(x_,{scope:n,orientation:r,dir:b,loop:o,currentTabStopId:w,onItemFocus:k.useCallback(R=>p(R),[p]),onItemShiftTab:k.useCallback(()=>g(!0),[]),onFocusableItemAdd:k.useCallback(()=>T(R=>R+1),[]),onFocusableItemRemove:k.useCallback(()=>T(R=>R-1),[]),children:l.jsx(wn.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...f,ref:m,style:{outline:"none",...e.style},onMouseDown:Wt(e.onMouseDown,()=>{C.current=!0}),onFocus:Wt(e.onFocus,R=>{const F=!C.current;if(R.target===R.currentTarget&&F&&!_){const U=new CustomEvent(Qo,w_);if(R.currentTarget.dispatchEvent(U),!U.defaultPrevented){const Q=I().filter(se=>se.focusable),J=Q.find(se=>se.active),Y=Q.find(se=>se.id===w),ce=[J,Y,...Q].filter(Boolean).map(se=>se.ref.current);Wd(ce,d)}}C.current=!1}),onBlur:Wt(e.onBlur,()=>g(!1))})})}),Bd="RovingFocusGroupItem",Jd=k.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:s,...a}=e,c=Vd(),u=i||c,d=__(Bd,n),f=d.currentTabStopId===u,h=$d(n),{onFocusableItemAdd:m,onFocusableItemRemove:b,currentTabStopId:w}=d;return k.useEffect(()=>{if(r)return m(),()=>b()},[r,m,b]),l.jsx(Ps.ItemSlot,{scope:n,id:u,focusable:r,active:o,children:l.jsx(wn.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...a,ref:t,onMouseDown:Wt(e.onMouseDown,p=>{r?d.onItemFocus(u):p.preventDefault()}),onFocus:Wt(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:Wt(e.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){d.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const _=S_(p,d.orientation,d.dir);if(_!==void 0){if(p.metaKey||p.ctrlKey||p.altKey||p.shiftKey)return;p.preventDefault();let y=h().filter(I=>I.focusable).map(I=>I.ref.current);if(_==="last")y.reverse();else if(_==="prev"||_==="next"){_==="prev"&&y.reverse();const I=y.indexOf(p.currentTarget);y=d.loop?N_(y,I+1):y.slice(I+1)}setTimeout(()=>Wd(y))}}),children:typeof s=="function"?s({isCurrentTabStop:f,hasTabStop:w!=null}):s})})});Jd.displayName=Bd;var O_={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function E_(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function S_(e,t,n){const r=E_(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return O_[r]}function Wd(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function N_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var T_=Hd,R_=Jd,So="Tabs",[A_,sC]=_o(So,[qd]),zd=qd(),[P_,ba]=A_(So),Gd=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=Ud(a),[f,h]=ga({prop:r,onChange:o,defaultProp:i??"",caller:So});return l.jsx(P_,{scope:n,baseId:Vd(),value:f,onValueChange:h,orientation:s,dir:d,activationMode:c,children:l.jsx(wn.div,{dir:d,"data-orientation":s,...u,ref:t})})});Gd.displayName=So;var Qd="TabsList",Xd=k.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=ba(Qd,n),s=zd(n);return l.jsx(T_,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:l.jsx(wn.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});Xd.displayName=Qd;var Yd="TabsTrigger",Zd=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=ba(Yd,n),a=zd(n),c=tf(s.baseId,r),u=nf(s.baseId,r),d=r===s.value;return l.jsx(R_,{asChild:!0,...a,focusable:!o,active:d,children:l.jsx(wn.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:Wt(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:Wt(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:Wt(e.onFocus,()=>{const f=s.activationMode!=="manual";!d&&!o&&f&&s.onValueChange(r)})})})});Zd.displayName=Yd;var ef="TabsContent",F_=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=ba(ef,n),c=tf(a.baseId,r),u=nf(a.baseId,r),d=r===a.value,f=k.useRef(d);return k.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),l.jsx(ya,{present:o||d,children:({present:h})=>l.jsx(wn.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:u,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:h&&i})})});F_.displayName=ef;function tf(e,t){return`${e}-trigger-${t}`}function nf(e,t){return`${e}-content-${t}`}var D_=Gd,M_=Xd,rf=Zd;const k_=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 j_(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?k_: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 L_(){return l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M8 11C9.65685 11 11 9.65685 11 8C11 6.34315 9.65685 5 8 5C6.34315 5 5 6.34315 5 8C5 9.65685 6.34315 11 8 11Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M12.3378 5.04365C12.4882 5.25907 12.62 5.48699 12.7315 5.7249L14.3503 6.6249C14.5524 7.5302 14.5545 8.4687 14.3565 9.3749L12.7315 10.2749C12.62 10.5128 12.4882 10.7407 12.3378 10.9562L12.369 12.8124C11.683 13.4375 10.871 13.9085 9.98776 14.1937L8.39401 13.2374C8.13185 13.2562 7.86868 13.2562 7.60651 13.2374L6.01901 14.1874C5.13295 13.9075 4.31832 13.4383 3.63151 12.8124L3.66276 10.9624C3.51356 10.744 3.38189 10.5141 3.26901 10.2749L1.65026 9.3749C1.44814 8.46961 1.446 7.53111 1.64401 6.6249L3.26901 5.7249C3.38056 5.48699 3.5123 5.25907 3.66276 5.04365L3.63151 3.1874C4.31754 2.56226 5.1295 2.09128 6.01276 1.80615L7.60651 2.7624C7.86868 2.74365 8.13185 2.74365 8.39401 2.7624L9.98151 1.8124C10.8676 2.09234 11.6822 2.5615 12.369 3.1874L12.3378 5.04365Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const K_="_tabsRoot_ktpr0_1",V_="_tabsList_ktpr0_6",U_="_tabTrigger_ktpr0_12",$_="_danger_ktpr0_29",uo={tabsRoot:K_,tabsList:V_,tabTrigger:U_,danger:$_};function q_(){return l.jsxs(l.Fragment,{children:[l.jsx(xo,{style:{margin:"1rem 0"}}),l.jsx(rf,{value:Zi,className:uo.tabTrigger,children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[l.jsx(L_,{}),l.jsx("span",{children:"Manage"})]})})]})}function of({objectName:e,completed:t,pending:n,displayName:r}){return l.jsx(rf,{value:e,className:uo.tabTrigger,children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[j_(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 H_({completed:e,pending:t,displayName:n}){return l.jsxs(l.Fragment,{children:[l.jsx(xo,{style:{margin:"1rem 0"}}),l.jsx(of,{objectName:fr,completed:e,pending:t,displayName:n},"other-write")]})}function B_({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:o}){var i,s;return l.jsx(D_,{value:e,className:uo.tabsRoot,onValueChange:n,children:l.jsxs(M_,{className:uo.tabsList,children:[t.map(a=>{var c,u,d,f,h,m;return l.jsx(of,{objectName:a.name,displayName:a.displayName,completed:a.completed,pending:((u=(c=r==null?void 0:r[a.name])==null?void 0:c.read)==null?void 0:u.isOptionalFieldsModified)||((f=(d=r==null?void 0:r[a.name])==null?void 0:d.read)==null?void 0:f.isRequiredMapFieldsModified)||((m=(h=r==null?void 0:r[a.name])==null?void 0:h.read)==null?void 0:m.isValueMappingsModified)||!1},a.name)}),o&&l.jsx(H_,{completed:o.completed,pending:((s=(i=r==null?void 0:r.other)==null?void 0:i.write)==null?void 0:s.isWriteModified)||!1,displayName:"Write"}),l.jsx(q_,{})]})})}function J_(e,t){return t===Zi?{name:Zi,completed:!1}:e.find(n=>n.name===t)}function W_({children:e}){var _;const{project:t}=Te(),{installation:n}=rt(),{providerName:r}=ct(),{hydratedRevision:o}=Qr(),{objectConfigurationsState:i}=pa(),[s,a]=v.useState(""),c=(t==null?void 0:t.appName)||"",u=n==null?void 0:n.config,d=o&&Wl(u,o),f=d!==null,h=!!((_=o==null?void 0:o.content)!=null&&_.write),m=h?zl(u):void 0,b=v.useMemo(()=>{const g=[...d||[]];return m&&h&&g.push(m),g},[d,m,h]),w=J_(b,s),p=v.useCallback(()=>{const g=b.find(y=>w!==y&&!y.completed);g&&a(g.name)},[b,w]);return v.useEffect(()=>{!s&&b.length>0&&a(b[0].name)},[b,s,p]),l.jsx(od.Provider,{value:p,children:l.jsx(rd.Provider,{value:w==null?void 0:w.name,children:l.jsxs(zr,{style:{maxWidth:"55rem"},children:[l.jsxs(vn,{style:{display:"flex",gap:"1rem",padding:"3rem",paddingBottom:"6rem",backgroundColor:"var(--amp-colors-bg-primary)"},children:[l.jsxs("div",{style:{width:"20rem"},children:[l.jsxs("h1",{style:{fontSize:"small",fontWeight:"400"},children:[r," integration"]}),l.jsx("h3",{style:{marginBottom:"20px",fontSize:"large",fontWeight:"500"},children:c}),f&&l.jsx(B_,{value:s,readNavObjects:d,onValueChange:g=>a(g),objectConfigurationsState:i,writeNavObject:m})]}),e]}),l.jsx(Rd,{})]})})})}function z_({...e}){return l.jsx(W_,{...e})}const G_="_resetContainer_lkwv9_4",sf={resetContainer:G_};function Q_({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c}){var p;const{projectIdOrName:u,isLoading:d}=Te(),{isLoading:f}=Ks(),{isError:h,errorState:m}=Dt(),{seed:b,reset:w}=Hl();return d||f?l.jsx(Gr,{}):h(ue.PROJECT,u)?l.jsx(Jt,{message:`Error loading project ${u}`}):h(ue.INTEGRATION_LIST,u)?l.jsx(Jt,{message:"Error retrieving integrations for the project, double check the API key"}):(p=m[ue.INTEGRATION_LIST])!=null&&p.apiError?l.jsx(Jt,{message:"Something went wrong, couldn't find integration information"}):l.jsx("div",{className:sf.resetContainer,children:l.jsx(Gy,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c,children:l.jsx(ql,{children:l.jsx(Kd,{consumerRef:t,consumerName:n,groupRef:r,groupName:o,resetComponent:w,children:l.jsx(xv,{resetComponent:w,children:l.jsx(Ux,{children:l.jsx(VI,{children:l.jsx(z_,{children:l.jsx(kx,{})})})})})})})},b)})}function X_(){return l.jsxs(zr,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[l.jsx(ci,{}),l.jsx("p",{children:"Redirecting"})]})}function Y_({redirectURL:e,children:t}){return v.useEffect(()=>{e&&window.location.replace(e)},[e]),e?l.jsx(X_,{}):t}function Z_({resetComponent:e,onDisconnectSuccess:t,provider:n}){const[r,o]=v.useState(!1);return l.jsxs(l.Fragment,{children:[r===!1&&l.jsxs(l.Fragment,{children:[l.jsx(Et,{string:"Manage connection"}),l.jsxs("div",{style:{padding:"1rem 0",width:"100%",display:"flex",flexDirection:"column",gap:"1rem"},children:[l.jsx("p",{children:"Click to reauthenticate or refresh your connection."}),l.jsx(ze,{type:"button",onClick:()=>o(!0),variant:"ghost",style:{fontSize:"13px"},children:"Update connection"})]})]}),r===!0&&l.jsxs(l.Fragment,{children:[l.jsx(Md,{provider:n}),l.jsx(Et,{string:"Remove connection"}),l.jsx("p",{children:"Click to disconnect your connection from the provider."}),l.jsx(su,{resetComponent:e,onDisconnectSuccess:t,buttonText:"Remove connection",buttonVariant:"danger",buttonStyle:{fontSize:"13px"}})]})]})}function eC({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=Te(),{providerName:o}=ct(e),i=`You have successfully connected your ${o} account to ${r}.`;return l.jsx(Ia,{text:i,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"},children:l.jsx(Z_,{resetComponent:n,onDisconnectSuccess:t,provider:e})})})}function tC({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,redirectUrl:i,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:c}){const{seed:u,reset:d}=Hl(),f=v.useCallback(h=>{s?s(h.id):c&&c(h)},[s,c]);return l.jsx("div",{className:sf.resetContainer,children:l.jsx(ql,{groupRef:r,provider:e,children:l.jsx(Kd,{resetComponent:d,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onSuccess:f,onDisconnectSuccess:a,children:l.jsx(Y_,{redirectURL:i,children:l.jsx(eC,{resetComponent:d,provider:e,onDisconnectSuccess:a})})})})},u)}const nC=(e,t)=>{const{data:n,isLoading:r,isError:o,error:i}=Kl(e,t),s=((n==null?void 0:n.length)||0)>0,a=!!n&&!r,c=n==null?void 0:n[0],u=c==null?void 0:c.config;return v.useEffect(()=>{o&&Le(i)},[o,i]),{isLoaded:a,isIntegrationInstalled:s,isLoading:r,config:u}};exports.AmpersandContext=Ml;exports.AmpersandProvider=Ty;exports.ConnectProvider=tC;exports.InstallIntegration=Q_;exports.useAmpersandProvider=Ry;exports.useIsIntegrationInstalled=nC;
|