@amp-labs/react 2.7.6 → 2.7.7
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 -13
- package/build/amp-react.cjs.js.map +1 -0
- package/build/amp-react.es.js +5463 -5297
- package/build/amp-react.es.js.map +1 -0
- package/package.json +1 -1
package/build/amp-react.cjs.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
"use strict";var Da=e=>{throw TypeError(e)};var Fo=(e,t,n)=>t.has(e)||Da("Cannot "+n);var O=(e,t,n)=>(Fo(e,t,"read from private field"),n?n.call(e):t.get(e)),oe=(e,t,n)=>t.has(e)?Da("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),z=(e,t,n,r)=>(Fo(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),pe=(e,t,n)=>(Fo(e,t,"access private method"),n);var Mi=(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 Lf(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=Lf(v);var Br=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(){}},ar=typeof window>"u"||"Deno"in globalThis;function At(){}function Kf(e,t){return typeof e=="function"?e(t):e}function Zo(e){return typeof e=="number"&&e>=0&&e!==1/0}function Yc(e,t){return Math.max(e+(t||0)-Date.now(),0)}function br(e,t){return typeof e=="function"?e(t):e}function Ht(e,t){return typeof e=="function"?e(t):e}function Ma(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==Ms(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 ka(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(cr(t.options.mutationKey)!==cr(i))return!1}else if(!ai(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function Ms(e,t){return((t==null?void 0:t.queryKeyHashFn)||cr)(e)}function cr(e){return JSON.stringify(e,(t,n)=>ts(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 es(e,t){if(e===t)return e;const n=ja(e)&&ja(t);if(n||ts(e)&&ts(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]=es(e[d],t[d]),a[d]===e[d]&&e[d]!==void 0&&c++)}return o===s&&c===o?e:a}return t}function Xi(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function ja(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ts(e){if(!La(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!La(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function La(e){return Object.prototype.toString.call(e)==="[object Object]"}function Vf(e){return new Promise(t=>{setTimeout(t,e)})}function ns(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 es(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 es(e,t)}return t}function Uf(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function $f(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Yi=Symbol();function Zc(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Yi&&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===Yi?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var Yn,Nn,_r,$c,qf=($c=class extends Br{constructor(){super();oe(this,Yn);oe(this,Nn);oe(this,_r);z(this,_r,t=>{if(!ar&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){O(this,Nn)||this.setEventListener(O(this,_r))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Nn))==null||t.call(this),z(this,Nn,void 0))}setEventListener(t){var n;z(this,_r,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,Yn)!==t&&(z(this,Yn,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof O(this,Yn)=="boolean"?O(this,Yn):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Yn=new WeakMap,Nn=new WeakMap,_r=new WeakMap,$c),ks=new qf,Cr,Tn,Or,qc,Hf=(qc=class extends Br{constructor(){super();oe(this,Cr,!0);oe(this,Tn);oe(this,Or);z(this,Or,t=>{if(!ar&&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,qc),Zi=new Hf;function rs(){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 Bf(e){return Math.min(1e3*2**e,3e4)}function el(e){return(e??"online")==="online"?Zi.isOnline():!0}var tl=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Do(e){return e instanceof tl}function nl(e){let t=!1,n=0,r=!1,o;const i=rs(),s=w=>{var p;r||(h(new tl(w)),(p=e.abort)==null||p.call(e))},a=()=>{t=!0},c=()=>{t=!1},u=()=>ks.isFocused()&&(e.networkMode==="always"||Zi.isOnline())&&e.canRun(),d=()=>el(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)}),x=()=>{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??(ar?0:3),y=e.retryDelay??Bf,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,_),Vf(I).then(()=>u()?void 0:m()).then(()=>{t?h(_):x()})})};return{promise:i,cancel:s,continue:()=>(o==null||o(),i),cancelRetry:a,continueRetry:c,canStart:d,start:()=>(d()?x():m().then(x),i)}}var Jf=e=>setTimeout(e,0);function Wf(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=Jf;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=Wf(),Zn,Hc,rl=(Hc=class{constructor(){oe(this,Zn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Zo(this.gcTime)&&z(this,Zn,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ar?1/0:5*60*1e3))}clearGcTimeout(){O(this,Zn)&&(clearTimeout(O(this,Zn)),z(this,Zn,void 0))}},Zn=new WeakMap,Hc),Er,Sr,Rt,er,st,hi,tr,$t,fn,Bc,zf=(Bc=class extends rl{constructor(t){super();oe(this,$t);oe(this,Er);oe(this,Sr);oe(this,Rt);oe(this,er);oe(this,st);oe(this,hi);oe(this,tr);z(this,tr,!1),z(this,hi,t.defaultOptions),this.setOptions(t.options),this.observers=[],z(this,er,t.client),z(this,Rt,O(this,er).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,z(this,Er,Gf(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,st))==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,Rt).remove(this)}setData(t,n){const r=ns(this.state.data,t,this.options);return pe(this,$t,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,$t,fn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=O(this,st))==null?void 0:r.promise;return(o=O(this,st))==null||o.cancel(t),n?n.then(At).catch(At):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(O(this,Er))}isActive(){return this.observers.some(t=>Ht(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Yi||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||!Yc(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=O(this,st))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=O(this,st))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),O(this,Rt).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,st)&&(O(this,tr)?O(this,st).cancel({revert:!0}):O(this,st).cancelRetry()),this.scheduleGc()),O(this,Rt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||pe(this,$t,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,st))return O(this,st).continueRetry(),O(this,st).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,tr,!0),r.signal)})},i=()=>{const f=Zc(this.options,n),h={client:O(this,er),queryKey:this.queryKey,meta:this.meta};return o(h),z(this,tr,!1),this.options.persister?this.options.persister(f,h,this):f(h)},s={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:O(this,er),state:this.state,fetchFn:i};o(s),(c=this.options.behavior)==null||c.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,$t,fn).call(this,{type:"fetch",meta:(d=s.fetchOptions)==null?void 0:d.meta});const a=f=>{var h,m,x,w;Do(f)&&f.silent||pe(this,$t,fn).call(this,{type:"error",error:f}),Do(f)||((m=(h=O(this,Rt).config).onError)==null||m.call(h,f,this),(w=(x=O(this,Rt).config).onSettled)==null||w.call(x,this.state.data,f,this)),this.scheduleGc()};return z(this,st,nl({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:f=>{var h,m,x,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,Rt).config).onSuccess)==null||m.call(h,f,this),(w=(x=O(this,Rt).config).onSettled)==null||w.call(x,f,this.state.error,this),this.scheduleGc()},onError:a,onFail:(f,h)=>{pe(this,$t,fn).call(this,{type:"failed",failureCount:f,error:h})},onPause:()=>{pe(this,$t,fn).call(this,{type:"pause"})},onContinue:()=>{pe(this,$t,fn).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),O(this,st).start()}},Er=new WeakMap,Sr=new WeakMap,Rt=new WeakMap,er=new WeakMap,st=new WeakMap,hi=new WeakMap,tr=new WeakMap,$t=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,...il(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 Do(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,Rt).notify({query:this,type:"updated",action:t})})},Bc);function il(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:el(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Gf(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,Jc,Qf=(Jc=class extends Br{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??Ms(o,n);let s=this.get(i);return s||(s=new zf({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=>Ma(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Ma(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,Jc),Zt,ct,nr,en,Sn,Wc,Xf=(Wc=class extends rl{constructor(t){super();oe(this,en);oe(this,Zt);oe(this,ct);oe(this,nr);this.mutationId=t.mutationId,z(this,ct,t.mutationCache),z(this,Zt,[]),this.state=t.state||ol(),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,ct).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){z(this,Zt,O(this,Zt).filter(n=>n!==t)),this.scheduleGc(),O(this,ct).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){O(this,Zt).length||(this.state.status==="pending"?this.scheduleGc():O(this,ct).remove(this))}continue(){var t;return((t=O(this,nr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,s,a,c,u,d,f,h,m,x,w,p,_,g,y,I,C,S,T,R;const n=()=>{pe(this,en,Sn).call(this,{type:"continue"})};z(this,nr,nl({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,ct).canRun(this)}));const r=this.state.status==="pending",o=!O(this,nr).canStart();try{if(r)n();else{pe(this,en,Sn).call(this,{type:"pending",variables:t,isPaused:o}),await((s=(i=O(this,ct).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,nr).start();return await((d=(u=O(this,ct).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((x=(m=O(this,ct).config).onSettled)==null?void 0:x.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,ct).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,ct).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,ct).runNext(this)}}},Zt=new WeakMap,ct=new WeakMap,nr=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,ct).notify({mutation:this,type:"updated",action:t})})},Wc);function ol(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var pn,qt,mi,zc,Yf=(zc=class extends Br{constructor(t={}){super();oe(this,pn);oe(this,qt);oe(this,mi);this.config=t,z(this,pn,new Set),z(this,qt,new Map),z(this,mi,0)}build(t,n,r){const o=new Xf({mutationCache:this,mutationId:++Mi(this,mi)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){O(this,pn).add(t);const n=ki(t);if(typeof n=="string"){const r=O(this,qt).get(n);r?r.push(t):O(this,qt).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(O(this,pn).delete(t)){const n=ki(t);if(typeof n=="string"){const r=O(this,qt).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,qt).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=ki(t);if(typeof n=="string"){const r=O(this,qt).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=ki(t);if(typeof n=="string"){const o=(r=O(this,qt).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,qt).clear()})}getAll(){return Array.from(O(this,pn))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>ka(n,r))}findAll(t={}){return this.getAll().filter(n=>ka(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(At))))}},pn=new WeakMap,qt=new WeakMap,mi=new WeakMap,zc);function ki(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,x;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=((x=t.state.data)==null?void 0:x.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)})},_=Zc(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?$f:Uf;return{pages:F(y.pages,T,R),pageParams:F(y.pageParams,I,R)}};if(o&&i.length){const y=o==="backward",I=y?Zf:Va,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:Va(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 Va(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 Zf(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,Gc,ep=(Gc=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 Qf),z(this,Rn,e.mutationCache||new Yf),z(this,An,e.defaultOptions||{}),z(this,Nr,new Map),z(this,Tr,new Map),z(this,Pn,0)}mount(){Mi(this,Pn)._++,O(this,Pn)===1&&(z(this,Rr,ks.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,ke).onFocus())})),z(this,Ar,Zi.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,ke).onOnline())})))}unmount(){var e,t;Mi(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=Kf(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(At).catch(At)}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(At)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(At)}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(At).catch(At)}fetchInfiniteQuery(e){return e.behavior=Ka(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(At).catch(At)}ensureInfiniteQueryData(e){return e.behavior=Ka(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Zi.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(cr(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(cr(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=Ms(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===Yi&&(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,Gc),mt,ve,gi,lt,rr,Pr,Fn,Dn,yi,Fr,Dr,ir,or,Mn,Mr,Ee,ni,is,os,ss,as,cs,ls,us,sl,Qc,tp=(Qc=class extends Br{constructor(t,n){super();oe(this,Ee);oe(this,mt);oe(this,ve);oe(this,gi);oe(this,lt);oe(this,rr);oe(this,Pr);oe(this,Fn);oe(this,Dn);oe(this,yi);oe(this,Fr);oe(this,Dr);oe(this,ir);oe(this,or);oe(this,Mn);oe(this,Mr,new Set);this.options=n,z(this,mt,t),z(this,Dn,null),z(this,Fn,rs()),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,ve).addObserver(this),Ua(O(this,ve),this.options)?pe(this,Ee,ni).call(this):this.updateResult(),pe(this,Ee,as).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ds(O(this,ve),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ds(O(this,ve),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,pe(this,Ee,cs).call(this),pe(this,Ee,ls).call(this),O(this,ve).removeObserver(this)}setOptions(t){const n=this.options,r=O(this,ve);if(this.options=O(this,mt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ht(this.options.enabled,O(this,ve))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");pe(this,Ee,us).call(this),O(this,ve).setOptions(this.options),n._defaulted&&!Xi(this.options,n)&&O(this,mt).getQueryCache().notify({type:"observerOptionsUpdated",query:O(this,ve),observer:this});const o=this.hasListeners();o&&$a(O(this,ve),r,this.options,n)&&pe(this,Ee,ni).call(this),this.updateResult(),o&&(O(this,ve)!==r||Ht(this.options.enabled,O(this,ve))!==Ht(n.enabled,O(this,ve))||br(this.options.staleTime,O(this,ve))!==br(n.staleTime,O(this,ve)))&&pe(this,Ee,is).call(this);const i=pe(this,Ee,os).call(this);o&&(O(this,ve)!==r||Ht(this.options.enabled,O(this,ve))!==Ht(n.enabled,O(this,ve))||i!==O(this,Mn))&&pe(this,Ee,ss).call(this,i)}getOptimisticResult(t){const n=O(this,mt).getQueryCache().build(O(this,mt),t),r=this.createResult(n,t);return rp(this,r)&&(z(this,lt,r),z(this,Pr,this.options),z(this,rr,O(this,ve).state)),r}getCurrentResult(){return O(this,lt)}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,ve)}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,Ee,ni).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),O(this,lt)))}createResult(t,n){var F;const r=O(this,ve),o=this.options,i=O(this,lt),s=O(this,rr),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&&Ua(t,n),J=U&&$a(t,r,n,o);(Q||J)&&(f={...f,...il(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:x,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,Dr))==null?void 0:F.state.data,O(this,Dr)):n.placeholderData,U!==void 0&&(p="success",m=ns(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,Fr);else try{z(this,yi,n.select),m=n.select(m),m=ns(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)&&(x=O(this,Dn),m=O(this,Fr),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:x,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:js(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=rs());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,lt),n=this.createResult(O(this,ve),this.options);if(z(this,rr,O(this,ve).state),z(this,Pr,this.options),O(this,rr).data!==void 0&&z(this,Dr,O(this,ve)),Xi(n,t))return;z(this,lt,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,lt)).some(a=>{const c=a;return O(this,lt)[c]!==t[c]&&s.has(c)})};pe(this,Ee,sl).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&pe(this,Ee,as).call(this)}},mt=new WeakMap,ve=new WeakMap,gi=new WeakMap,lt=new WeakMap,rr=new WeakMap,Pr=new WeakMap,Fn=new WeakMap,Dn=new WeakMap,yi=new WeakMap,Fr=new WeakMap,Dr=new WeakMap,ir=new WeakMap,or=new WeakMap,Mn=new WeakMap,Mr=new WeakMap,Ee=new WeakSet,ni=function(t){pe(this,Ee,us).call(this);let n=O(this,ve).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(At)),n},is=function(){pe(this,Ee,cs).call(this);const t=br(this.options.staleTime,O(this,ve));if(ar||O(this,lt).isStale||!Zo(t))return;const r=Yc(O(this,lt).dataUpdatedAt,t)+1;z(this,ir,setTimeout(()=>{O(this,lt).isStale||this.updateResult()},r))},os=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(O(this,ve)):this.options.refetchInterval)??!1},ss=function(t){pe(this,Ee,ls).call(this),z(this,Mn,t),!(ar||Ht(this.options.enabled,O(this,ve))===!1||!Zo(O(this,Mn))||O(this,Mn)===0)&&z(this,or,setInterval(()=>{(this.options.refetchIntervalInBackground||ks.isFocused())&&pe(this,Ee,ni).call(this)},O(this,Mn)))},as=function(){pe(this,Ee,is).call(this),pe(this,Ee,ss).call(this,pe(this,Ee,os).call(this))},cs=function(){O(this,ir)&&(clearTimeout(O(this,ir)),z(this,ir,void 0))},ls=function(){O(this,or)&&(clearInterval(O(this,or)),z(this,or,void 0))},us=function(){const t=O(this,mt).getQueryCache().build(O(this,mt),this.options);if(t===O(this,ve))return;const n=O(this,ve);z(this,ve,t),z(this,gi,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},sl=function(t){Je.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(O(this,lt))}),O(this,mt).getQueryCache().notify({query:O(this,ve),type:"observerResultsUpdated"})})},Qc);function np(e,t){return Ht(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Ua(e,t){return np(e,t)||e.state.data!==void 0&&ds(e,t,t.refetchOnMount)}function ds(e,t,n){if(Ht(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&js(e,t)}return!1}function $a(e,t,n,r){return(e!==t||Ht(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&js(e,n)}function js(e,t){return Ht(t.enabled,e)!==!1&&e.isStaleByTime(br(t.staleTime,e))}function rp(e,t){return!Xi(e.getCurrentResult(),t)}var kn,jn,gt,hn,gn,Ji,fs,Xc,ip=(Xc=class extends Br{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,Ji).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),Xi(this.options,r)||O(this,kn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:O(this,gt),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&cr(r.mutationKey)!==cr(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,Ji).call(this),pe(this,gn,fs).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,Ji).call(this),pe(this,gn,fs).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,Ji=function(){var r;const n=((r=O(this,gt))==null?void 0:r.state)??ol();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})},fs=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))})})},Xc),al=k.createContext(void 0),vt=e=>{const t=k.useContext(al);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},op=({client:e,children:t})=>(k.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(al.Provider,{value:e,children:t})),cl=k.createContext(!1),sp=()=>k.useContext(cl);cl.Provider;function ap(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var cp=k.createContext(ap()),lp=()=>k.useContext(cp);function ll(e,t){return typeof e=="function"?e(...t):!!e}function ps(){}var up=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},dp=e=>{k.useEffect(()=>{e.clearReset()},[e])},fp=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||ll(n,[e.error,r])),pp=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)))},hp=(e,t)=>e.isLoading&&e.isFetching&&!t,mp=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,qa=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function gp(e,t,n){var f,h,m,x,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=sp(),i=lp(),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",pp(s),up(s,i),dp(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)):ps;return c.updateResult(),_},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),k.useEffect(()=>{c.setOptions(s)},[s,c]),mp(s,u))throw qa(s,c,i);if(fp({result:u,errorResetBoundary:i,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw u.error;if((x=(m=r.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||x.call(m,s,u),s.experimental_prefetchInRender&&!ar&&hp(u,o)){const p=a?qa(s,c,i):(w=r.getQueryCache().get(s.queryHash))==null?void 0:w.promise;p==null||p.catch(ps).finally(()=>{c.updateResult()})}return s.notifyOnChangeProps?u:c.trackResult(u)}function yn(e,t){return gp(e,tp)}function Jr(e,t){const n=vt(),[r]=k.useState(()=>new ip(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(ps)},[r]);if(o.error&&ll(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:i,mutateAsync:o.mutate}}const ul=v.createContext(null),yp=ul.Provider,dl=()=>{const e=v.useContext(ul);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 fl=v.createContext(void 0);function Ft(){const e=v.useContext(fl);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const vp=(()=>{const e={};return Object.values(ue).forEach(t=>{e[t]={}}),e})();function wp({children:e}){const[t,n]=v.useState(vp),r=v.useCallback((d,f,h=!0)=>{n(m=>{const x={...m};return x[d]=x[d]||{},x[d][f]=h,x})},[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 x;const m={...h};return(x=m[d])==null||delete x[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(x=>{m[d][x]=!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(fl.Provider,{value:u,children:e})}const Ip="https://api.withampersand.com/v1".replace(/\/+$/,"");class Ls{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Ip}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||hl}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 bp=new Ls,ho=class ho{constructor(t=bp){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 Cp(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?ho.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 pl(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:_p(a.body)||a.body instanceof URLSearchParams||xp(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}};ho.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let nn=ho;function xp(e){return typeof Blob<"u"&&e instanceof Blob}function _p(e){return typeof FormData<"u"&&e instanceof FormData}class pl extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class Cp 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 hl(e,t=""){return Object.keys(e).map(n=>ml(n,e[n],t)).filter(n=>n.length>0).join("&")}function ml(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 ml(e,o,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?hl(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 lr{constructor(t){this.raw=t}async value(){}}class Ha{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function Op(e){return Ep(e)}function Ep(e,t){return e==null?e:{fieldUsed:N(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:N(e,"keyFormat")?e.keyFormat:void 0}}function Sp(e){return Np(e)}function Np(e,t){return e==null?e:{name:e.name,valuePrefix:N(e,"valuePrefix")?e.valuePrefix:void 0}}function Tp(e){return Rp(e)}function Rp(e,t){return e==null?e:{name:e.name}}function Ap(e){return Pp(e)}function Pp(e,t){return e==null?e:{attachmentType:e.attachmentType,query:N(e,"query")?Tp(e.query):void 0,header:N(e,"header")?Sp(e.header):void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0}}function Fp(e){return Dp(e)}function Dp(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0,includeFullRecords:N(e,"includeFullRecords")?e.includeFullRecords:void 0}}function Mp(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,includeFullRecords:e.includeFullRecords}}function kp(e){return jp(e)}function jp(e,t){return e==null?e:{url:e.url,method:N(e,"method")?e.method:void 0,successStatusCodes:N(e,"successStatusCodes")?e.successStatusCodes:void 0}}const Ba={Oauth2:"oauth2",ApiKey:"apiKey",Basic:"basic",Jwt:"jwt",None:"none"};function Lp(e){return Kp(e)}function Kp(e,t){return e}function Vp(e){return Up(e)}function Up(e,t){return e==null?e:{days:N(e,"days")?e.days:void 0,fullHistory:N(e,"fullHistory")?e.fullHistory:void 0}}function $p(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function gl(e){return qp(e)}function qp(e,t){return e==null?e:{defaultPeriod:Vp(e.defaultPeriod)}}function Hp(e){if(e!==void 0)return e===null?null:{defaultPeriod:$p(e.defaultPeriod)}}function Bp(e){return Jp(e)}function Jp(e,t){return e==null?e:{days:N(e,"days")?e.days:void 0,fullHistory:N(e,"fullHistory")?e.fullHistory:void 0}}function Wp(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function zp(e){return Gp(e)}function Gp(e,t){return e==null?e:{defaultPeriod:Bp(e.defaultPeriod)}}function yl(e){if(e!==void 0)return e===null?null:{defaultPeriod:Wp(e.defaultPeriod)}}function Qp(e){return Xp(e)}function Xp(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function vl(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Yp(e){return Zp(e)}function Zp(e,t){return e}function eh(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:yl(e.backfill)}}function th(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:We(e.objects,eh)}}function nh(e){return rh(e)}function rh(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 ih(e){if(e!==void 0)return e===null?null:{stringValue:e.stringValue,integerValue:e.integerValue,booleanValue:e.booleanValue}}function oh(e){return sh(e)}function sh(e,t){return e==null?e:{_default:N(e,"default")?nh(e.default):void 0,writeOnCreate:N(e,"writeOnCreate")?e.writeOnCreate:void 0,writeOnUpdate:N(e,"writeOnUpdate")?e.writeOnUpdate:void 0}}function wl(e){if(e!==void 0)return e===null?null:{default:ih(e._default),writeOnCreate:e.writeOnCreate,writeOnUpdate:e.writeOnUpdate}}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){let t=!0;return t=t&&"value"in e,t}function hh(e,t){return e==null?e:{value:e.value,applyOnUpdate:N(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function mh(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function gh(e){return yh(e)}function yh(e,t){return e==null?e:{...ch(e),...dh(e),...hh(e)}}function Il(e){if(e!==void 0)return e===null?null:ah(e)?lh(e):uh(e)?fh(e):ph(e)?mh(e):{}}function vh(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:We(e.selectedValueDefaults,Il),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:We(e.selectedFieldSettings,wl)}}function wh(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:We(e.objects,vh)}}function Ih(e){return bh(e)}function bh(e,t){return e==null?e:{apiKeyAsBasic:N(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:N(e,"apiKeyAsBasicOpts")?Op(e.apiKeyAsBasicOpts):void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0}}function xh(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function _h(e){return Ch(e)}function Ch(e,t){return e==null?e:{value:e.value}}function Oh(e){return Eh(e)}function Eh(e,t){return e==null?e:{brandingRemoval:N(e,"brandingRemoval")?_h(e.brandingRemoval):void 0}}function ji(e){return Sh(e)}function Sh(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")?Oh(e.entitlements):void 0}}function Nh(e){return Th(e)}function Th(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function Rh(e){return Ah(e)}function Ah(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")?Yp(e.selectedFieldsAuto):void 0,backfill:N(e,"backfill")?zp(e.backfill):void 0}}function Ph(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:yl(e.backfill)}}function Fh(e){return Dh(e)}function Dh(e,t){return e==null?e:{objects:We(e.objects,Rh)}}function Mh(e){if(e!==void 0)return e===null?null:{objects:We(e.objects,Ph)}}function kh(e){return jh(e)}function jh(e,t){return e==null?e:{objectName:e.objectName,selectedValueDefaults:N(e,"selectedValueDefaults")?We(e.selectedValueDefaults,gh):void 0,selectedFieldSettings:N(e,"selectedFieldSettings")?We(e.selectedFieldSettings,oh):void 0}}function Lh(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:We(e.selectedValueDefaults,Il),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:We(e.selectedFieldSettings,wl)}}function Kh(e){return Vh(e)}function Vh(e,t){return e==null?e:{objects:N(e,"objects")?We(e.objects,kh):void 0}}function Uh(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:We(e.objects,Lh)}}function $h(e){return qh(e)}function qh(e,t){return e==null?e:{provider:e.provider,read:N(e,"read")?Fh(e.read):void 0,write:N(e,"write")?Kh(e.write):void 0,proxy:N(e,"proxy")?Qp(e.proxy):void 0}}function Hh(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:Mh(e.read),write:Uh(e.write),proxy:vl(e.proxy)}}function Bh(e){return Jh(e)}function Jh(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:$h(e.content)}}function Wh(e){return zh(e)}function zh(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 bl(e){return Gh(e)}function Gh(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 Qh(e){return Xh(e)}function Xh(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 Yh(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 em(e){return tm(e)}function tm(e,t){return e==null?e:{accessToken:N(e,"accessToken")?Qh(e.accessToken):void 0,refreshToken:N(e,"refreshToken")?Yh(e.refreshToken):void 0,scopes:N(e,"scopes")?e.scopes:void 0}}function Wi(e){return nm(e)}function nm(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:N(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:N(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0}}function rm(e){return im(e)}function im(e,t){return e==null?e:{value:e.value,source:e.source,displayName:N(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 om(e)}function om(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:N(e,"providerApp")?Wi(e.providerApp):void 0,group:bl(e.group),consumer:Wh(e.consumer),providerWorkspaceRef:N(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerConsumerRef:N(e,"providerConsumerRef")?e.providerConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0,authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:N(e,"oauth2AuthorizationCode")?em(e.oauth2AuthorizationCode):void 0,apiKey:N(e,"apiKey")?e.apiKey:void 0,providerMetadata:N(e,"providerMetadata")?We(e.providerMetadata,rm):void 0}}function xl(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function _l(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function Cl(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 sm(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 am(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 Ol(e){if(e!==void 0)return e===null?null:{accessToken:sm(e.accessToken),refreshToken:am(e.refreshToken),scopes:e.scopes}}function cm(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:xl(e.basicAuth),oauth2ClientCredentials:_l(e.oauth2ClientCredentials),oauth2PasswordCredentials:Cl(e.oauth2PasswordCredentials),oauth2AuthorizationCode:Ol(e.oauth2AuthorizationCode)}}function lm(e){return um(e)}function um(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function dm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function fm(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Hh(e.content)}}function pm(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:fm(e.config)}}function hm(e){return mm(e)}function mm(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function gm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function ym(e){return vm(e)}function vm(e,t){return e==null?e:{mode:N(e,"mode")?e.mode:void 0,pageSize:N(e,"pageSize")?e.pageSize:void 0}}function wm(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function Im(e){let t=!0;return t=t&&"fieldName"in e,t}function bm(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:N(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function xm(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function _m(e){let t=!0;return t=t&&"mapToName"in e,t}function El(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 Cm(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function Ja(e){return Om(e)}function Om(e,t){return e==null?e:{...bm(e),...El(e)}}function Wa(e){if(e!==void 0)return e===null?null:Im(e)?xm(e):_m(e)?Cm(e):{}}function Sl(e){return Em(e)}function Em(e,t){return e}function Sm(e){return Nm(e)}function Nm(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(Ja):void 0,optionalFields:N(e,"optionalFields")?e.optionalFields.map(Ja):void 0,optionalFieldsAuto:N(e,"optionalFieldsAuto")?Sl(e.optionalFieldsAuto):void 0,backfill:N(e,"backfill")?gl(e.backfill):void 0,delivery:N(e,"delivery")?ym(e.delivery):void 0}}function Tm(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(Wa),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(Wa),optionalFieldsAuto:e.optionalFieldsAuto,backfill:Hp(e.backfill),delivery:wm(e.delivery)}}function Rm(e){return Am(e)}function Am(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(Sm):void 0}}function Pm(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Tm)}}function Fm(e){return Dm(e)}function Dm(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function Mm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function km(e){return jm(e)}function jm(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 Lm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function Km(e){return Vm(e)}function Vm(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:N(e,"inheritFieldsAndMapping")?e.inheritFieldsAndMapping:void 0,createEvent:N(e,"createEvent")?lm(e.createEvent):void 0,updateEvent:N(e,"updateEvent")?km(e.updateEvent):void 0,deleteEvent:N(e,"deleteEvent")?Fm(e.deleteEvent):void 0,associationChangeEvent:N(e,"associationChangeEvent")?Fp(e.associationChangeEvent):void 0,otherEvents:N(e,"otherEvents")?e.otherEvents:void 0}}function Um(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:e.inheritFieldsAndMapping,createEvent:dm(e.createEvent),updateEvent:Lm(e.updateEvent),deleteEvent:Mm(e.deleteEvent),associationChangeEvent:Mp(e.associationChangeEvent),otherEvents:e.otherEvents}}function $m(e){return qm(e)}function qm(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(Km):void 0}}function Hm(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Um)}}function Nl(e){return Bm(e)}function Bm(e,t){return e==null?e:{allowAnyFields:N(e,"allowAnyFields")?e.allowAnyFields:void 0}}function Jm(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function Wm(e){return zm(e)}function zm(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:N(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:N(e,"valueDefaults")?Nl(e.valueDefaults):void 0}}function Gm(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:Jm(e.valueDefaults)}}function Qm(e){return Xm(e)}function Xm(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(Wm):void 0}}function Ym(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Gm)}}function Zm(e){return eg(e)}function eg(e,t){return e==null?e:{name:e.name,displayName:N(e,"displayName")?e.displayName:void 0,provider:e.provider,read:N(e,"read")?Rm(e.read):void 0,write:N(e,"write")?Qm(e.write):void 0,proxy:N(e,"proxy")?hm(e.proxy):void 0,subscribe:N(e,"subscribe")?$m(e.subscribe):void 0}}function tg(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:Pm(e.read),write:Ym(e.write),proxy:gm(e.proxy),subscribe:Hm(e.subscribe)}}function ng(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:tg(e.content)}}function rg(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:ng(e.latestRevision)}}function ig(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function og(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 sg(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function ag(e){return cg(e)}function cg(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function lg(e){return ug(e)}function ug(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(ag):void 0}}function dg(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:xl(e.basicAuth),oauth2ClientCredentials:_l(e.oauth2ClientCredentials),oauth2PasswordCredentials:Cl(e.oauth2PasswordCredentials),oauth2AuthorizationCode:Ol(e.oauth2AuthorizationCode)}}function fg(e){return pg(e)}function pg(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function hg(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,mapToName:N(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Mo(e){return mg(e)}function mg(e,t){return e==null?e:{...hg(e),...El(e)}}function gg(e){return yg(e)}function yg(e,t){return e==null?e:{error:N(e,"error")?e.error:void 0,objectName:e.objectName,displayName:e.displayName,mapToName:N(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:N(e,"requiredFields")?e.requiredFields.map(Mo):void 0,optionalFields:N(e,"optionalFields")?e.optionalFields.map(Mo):void 0,optionalFieldsAuto:N(e,"optionalFieldsAuto")?Sl(e.optionalFieldsAuto):void 0,allFields:N(e,"allFields")?e.allFields.map(Mo):void 0,allFieldsMetadata:N(e,"allFieldsMetadata")?We(e.allFieldsMetadata,lg):void 0,backfill:N(e,"backfill")?gl(e.backfill):void 0}}function vg(e){return wg(e)}function wg(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(gg):void 0}}function Ig(e){return bg(e)}function bg(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:N(e,"valueDefaults")?Nl(e.valueDefaults):void 0}}function xg(e){return _g(e)}function _g(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(Ig):void 0}}function Cg(e){return Og(e)}function Og(e,t){return e==null?e:{name:e.name,displayName:N(e,"displayName")?e.displayName:void 0,provider:e.provider,read:N(e,"read")?vg(e.read):void 0,write:N(e,"write")?xg(e.write):void 0,proxy:N(e,"proxy")?fg(e.proxy):void 0}}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:Cg(e.content)}}function Li(e){return Ng(e)}function Ng(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:N(e,"group")?bl(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:Bh(e.config)}}function Tg(e){return Rg(e)}function Rg(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Zm(e.content)}}function za(e){return Ag(e)}function Ag(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:Tg(e.latestRevision)}}function Pg(e){return Fg(e)}function Fg(e,t){return e==null?e:{iconURL:N(e,"iconURL")?e.iconURL:void 0,logoURL:N(e,"logoURL")?e.logoURL:void 0}}function Dg(e){return Mg(e)}function Mg(e,t){return e==null?e:{iconURL:N(e,"iconURL")?e.iconURL:void 0,logoURL:N(e,"logoURL")?e.logoURL:void 0}}function kg(e){return jg(e)}function jg(e,t){return e==null?e:{regular:N(e,"regular")?Dg(e.regular):void 0,darkMode:N(e,"darkMode")?Pg(e.darkMode):void 0}}function Lg(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 Vg(e){return Ug(e)}function Ug(e,t){return e==null?e:{name:e.name}}function $g(e){return qg(e)}function qg(e,t){return e==null?e:{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 Tl(e){return Hg(e)}function Hg(e,t){return e==null?e:{bulkWrite:Nh(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write,subscribeSupport:N(e,"subscribeSupport")?$g(e.subscribeSupport):void 0}}function Bg(e){return Jg(e)}function Jg(e,t){return e==null?e:{displayName:e.displayName,baseURL:e.baseURL,support:Tl(e.support)}}function Wg(e){return zg(e)}function zg(e,t){return e==null?e:{name:e.name,displayName:e.displayName,jqValueSelector:e.jqValueSelector}}function Gg(e){return Qg(e)}function Qg(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(Wg):void 0}}const ko={AuthorizationCode:"authorizationCode",AuthorizationCodePkce:"authorizationCodePKCE",ClientCredentials:"clientCredentials",Password:"password"};function Xg(e){return Yg(e)}function Yg(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:Gg(e.tokenMetadataFields),docsURL:N(e,"docsURL")?e.docsURL:void 0,authURLParams:N(e,"authURLParams")?e.authURLParams:void 0}}function Zg(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 ey(e){return ty(e)}function ty(e,t){return e==null?e:{input:N(e,"input")?e.input.map(Lg):void 0,postAuthentication:N(e,"postAuthentication")?e.postAuthentication.map(Vg):void 0}}function ny(e){return ry(e)}function ry(e,t){return e==null?e:{subscriptionScope:e.subscriptionScope,targetURLScope:e.targetURLScope,registrationTiming:e.registrationTiming}}function Ga(e){return iy(e)}function iy(e,t){return e==null?e:{name:e.name,authType:Lp(e.authType),baseURL:e.baseURL,oauth2Opts:N(e,"oauth2Opts")?Xg(e.oauth2Opts):void 0,apiKeyOpts:N(e,"apiKeyOpts")?Ap(e.apiKeyOpts):void 0,basicOpts:N(e,"basicOpts")?Ih(e.basicOpts):void 0,support:Tl(e.support),providerOpts:e.providerOpts,authHealthCheck:N(e,"authHealthCheck")?kp(e.authHealthCheck):void 0,displayName:N(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:N(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:N(e,"media")?kg(e.media):void 0,labels:N(e,"labels")?e.labels:void 0,subscribeOpts:N(e,"subscribeOpts")?ny(e.subscribeOpts):void 0,modules:N(e,"modules")?We(e.modules,Bg):void 0,metadata:N(e,"metadata")?ey(e.metadata):void 0}}function oy(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,connection:cm(e.connection)}}function sy(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:th(e.read),write:wh(e.write),proxy:vl(e.proxy)}}function ay(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:sy(e.content)}}function cy(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:ay(e.config)}}function ly(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:cy(e.installation)}}function uy(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function dy(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:uy(e.project)}}function fy(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 py(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:fy(e.providerApp)}}class hy 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 lr(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:dg(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:oy(t.updateConnectionRequest)},n);return new je(i,s=>ri(s))}async updateConnection(t,n){return await(await this.updateConnectionRaw(t,n)).value()}}class my 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:pm(t.installation)},n);return new je(i,s=>Li(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 lr(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=>Li(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(Li))}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:ly(t.installationUpdate)},n);return new je(i,s=>Li(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class gy 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:xh(t.batchUpsertIntegrationsRequest)},n);return new je(i,s=>s.map(za))}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:rg(t.integration)},n);return new lr(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 lr(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(za))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class yy 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:Zg(t.connectOAuthParams)},n);return this.isJsonMime(i.headers.get("content-type"))?new je(i):new Ha(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 Ha(i)}async oauthUpdate(t,n){return await(await this.oauthUpdateRaw(t,n)).value()}}class vy 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:ig(t.project)},n);return new je(i,s=>ji(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 lr(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=>ji(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(ji))}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:dy(t.projectUpdate)},n);return new je(i,s=>ji(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class wy 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=>Ga(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,Ga))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class Iy 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:og(t.providerApp)},n);return new je(i,s=>Wi(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 lr(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(Wi))}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:py(t.providerAppUpdate)},n);return new je(i,s=>Wi(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class by 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:sg(t.revision)},n);return new lr(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=>Eg(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class Rl{constructor(t){this.connectionApi=new hy(t),this.installationApi=new my(t),this.integrationApi=new gy(t),this.oAuthApi=new yy(t),this.projectApi=new vy(t),this.providerApi=new wy(t),this.providerAppApi=new Iy(t),this.revisionApi=new by(t)}}const Al="2.7.6",xy="v1",Ki="https://api.withampersand.com";function Pl(){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 Ki;case"mock":return"http://127.0.0.1:4010";case"":return Ki;default:return e??Ki}}catch{return Ki}}const _y=(e,t)=>`${e}/${t}`;function Cy(){return _y(Pl(),xy)}const Oy=Pl(),Fl=Cy(),Ey=new Ls({basePath:Fl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Al}});let Sy=new Rl(Ey);const Vs=()=>Sy;function ut(){const e=dl();return v.useCallback(async()=>{e||console.error("Unable to create API service without API key.");const n=new Ls({basePath:Fl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Al,"X-Api-Key":e}});return new Rl(n)},[e])}const Ny=e=>{const t=ut();return yn({queryKey:["project",e],queryFn:async()=>(await t()).projectApi.getProject({projectIdOrName:e})})},Dl=v.createContext({project:null,appName:"",projectId:"",projectIdOrName:"",isLoading:!0}),Te=()=>{const e=v.useContext(Dl);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e};function Ty({projectIdOrName:e,children:t}){const{setError:n}=Ft(),{data:r,isLoading:o,isError:i}=Ny(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(Dl.Provider,{value:s,children:t})}function Ml(){const e=ut(),{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 pl){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(`
|
|
1
|
+
"use strict";var Ka=e=>{throw TypeError(e)};var ko=(e,t,n)=>t.has(e)||Ka("Cannot "+n);var O=(e,t,n)=>(ko(e,t,"read from private field"),n?n.call(e):t.get(e)),se=(e,t,n)=>t.has(e)?Ka("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),G=(e,t,n,r)=>(ko(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),he=(e,t,n)=>(ko(e,t,"access private method"),n);var ji=(e,t,n,r)=>({set _(o){G(e,t,o,n)},get _(){return O(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),y=require("react");require("react-dom");function $f(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 M=$f(y);var Br=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 At(){}function qf(e,t){return typeof e=="function"?e(t):e}function ns(e){return typeof e=="number"&&e>=0&&e!==1/0}function il(e,t){return Math.max(e+(t||0)-Date.now(),0)}function xr(e,t){return typeof e=="function"?e(t):e}function Ht(e,t){return typeof e=="function"?e(t):e}function Va(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==js(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 Ua(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 js(e,t){return((t==null?void 0:t.queryKeyHashFn)||lr)(e)}function lr(e){return JSON.stringify(e,(t,n)=>is(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 rs(e,t){if(e===t)return e;const n=$a(e)&&$a(t);if(n||is(e)&&is(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 f=0;f<s;f++){const u=n?f:i[f];(!n&&r.includes(u)||n)&&e[u]===void 0&&t[u]===void 0?(a[u]=void 0,c++):(a[u]=rs(e[u],t[u]),a[u]===e[u]&&e[u]!==void 0&&c++)}return o===s&&c===o?e:a}return t}function Zi(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 $a(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function is(e){if(!qa(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!qa(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function qa(e){return Object.prototype.toString.call(e)==="[object Object]"}function Hf(e){return new Promise(t=>{setTimeout(t,e)})}function os(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return rs(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 rs(e,t)}return t}function Bf(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Jf(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var eo=Symbol();function ol(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===eo&&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===eo?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var Zn,Tn,_r,zc,Wf=(zc=class extends Br{constructor(){super();se(this,Zn);se(this,Tn);se(this,_r);G(this,_r,t=>{if(!cr&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){O(this,Tn)||this.setEventListener(O(this,_r))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Tn))==null||t.call(this),G(this,Tn,void 0))}setEventListener(t){var n;G(this,_r,t),(n=O(this,Tn))==null||n.call(this),G(this,Tn,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){O(this,Zn)!==t&&(G(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,Tn=new WeakMap,_r=new WeakMap,zc),Ls=new Wf,Or,Rn,Er,Gc,zf=(Gc=class extends Br{constructor(){super();se(this,Or,!0);se(this,Rn);se(this,Er);G(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,Rn)||this.setEventListener(O(this,Er))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Rn))==null||t.call(this),G(this,Rn,void 0))}setEventListener(t){var n;G(this,Er,t),(n=O(this,Rn))==null||n.call(this),G(this,Rn,t(this.setOnline.bind(this)))}setOnline(t){O(this,Or)!==t&&(G(this,Or,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return O(this,Or)}},Or=new WeakMap,Rn=new WeakMap,Er=new WeakMap,Gc),to=new zf;function ss(){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 Gf(e){return Math.min(1e3*2**e,3e4)}function sl(e){return(e??"online")==="online"?to.isOnline():!0}var al=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function jo(e){return e instanceof al}function cl(e){let t=!1,n=0,r=!1,o;const i=ss(),s=v=>{var p;r||(g(new al(v)),(p=e.abort)==null||p.call(e))},a=()=>{t=!0},c=()=>{t=!1},f=()=>Ls.isFocused()&&(e.networkMode==="always"||to.isOnline())&&e.canRun(),u=()=>sl(e.networkMode)&&e.canRun(),d=v=>{var p;r||(r=!0,(p=e.onSuccess)==null||p.call(e,v),o==null||o(),i.resolve(v))},g=v=>{var p;r||(r=!0,(p=e.onError)==null||p.call(e,v),o==null||o(),i.reject(v))},h=()=>new Promise(v=>{var p;o=x=>{(r||f())&&v(x)},(p=e.onPause)==null||p.call(e)}).then(()=>{var v;o=void 0,r||(v=e.onContinue)==null||v.call(e)}),w=()=>{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(d).catch(x=>{var S;if(r)return;const m=e.retry??(cr?0:3),I=e.retryDelay??Gf,_=typeof I=="function"?I(n,x):I,C=m===!0||typeof m=="number"&&n<m||typeof m=="function"&&m(n,x);if(t||!C){g(x);return}n++,(S=e.onFail)==null||S.call(e,n,x),Hf(_).then(()=>f()?void 0:h()).then(()=>{t?g(x):w()})})};return{promise:i,cancel:s,continue:()=>(o==null||o(),i),cancelRetry:a,continueRetry:c,canStart:u,start:()=>(u()?w():h().then(w),i)}}var Qf=e=>setTimeout(e,0);function Xf(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=Qf;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=Xf(),er,Qc,ll=(Qc=class{constructor(){se(this,er)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ns(this.gcTime)&&G(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)),G(this,er,void 0))}},er=new WeakMap,Qc),Sr,Nr,Rt,tr,st,mi,nr,$t,fn,Xc,Yf=(Xc=class extends ll{constructor(t){super();se(this,$t);se(this,Sr);se(this,Nr);se(this,Rt);se(this,tr);se(this,st);se(this,mi);se(this,nr);G(this,nr,!1),G(this,mi,t.defaultOptions),this.setOptions(t.options),this.observers=[],G(this,tr,t.client),G(this,Rt,O(this,tr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,G(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,st))==null?void 0:t.promise}setOptions(t){this.options={...O(this,mi),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&O(this,Rt).remove(this)}setData(t,n){const r=os(this.state.data,t,this.options);return he(this,$t,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){he(this,$t,fn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=O(this,st))==null?void 0:r.promise;return(o=O(this,st))==null||o.cancel(t),n?n.then(At).catch(At):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(O(this,Sr))}isActive(){return this.observers.some(t=>Ht(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===eo||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||!il(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=O(this,st))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=O(this,st))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),O(this,Rt).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,st)&&(O(this,nr)?O(this,st).cancel({revert:!0}):O(this,st).cancelRetry()),this.scheduleGc()),O(this,Rt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||he(this,$t,fn).call(this,{type:"invalidate"})}fetch(t,n){var c,f,u;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(O(this,st))return O(this,st).continueRetry(),O(this,st).promise}if(t&&this.setOptions(t),!this.options.queryFn){const d=this.observers.find(g=>g.options.queryFn);d&&this.setOptions(d.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=d=>{Object.defineProperty(d,"signal",{enumerable:!0,get:()=>(G(this,nr,!0),r.signal)})},i=()=>{const d=ol(this.options,n),g={client:O(this,tr),queryKey:this.queryKey,meta:this.meta};return o(g),G(this,nr,!1),this.options.persister?this.options.persister(d,g,this):d(g)},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),G(this,Nr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=s.fetchOptions)==null?void 0:f.meta))&&he(this,$t,fn).call(this,{type:"fetch",meta:(u=s.fetchOptions)==null?void 0:u.meta});const a=d=>{var g,h,w,v;jo(d)&&d.silent||he(this,$t,fn).call(this,{type:"error",error:d}),jo(d)||((h=(g=O(this,Rt).config).onError)==null||h.call(g,d,this),(v=(w=O(this,Rt).config).onSettled)==null||v.call(w,this.state.data,d,this)),this.scheduleGc()};return G(this,st,cl({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:d=>{var g,h,w,v;if(d===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(d)}catch(p){a(p);return}(h=(g=O(this,Rt).config).onSuccess)==null||h.call(g,d,this),(v=(w=O(this,Rt).config).onSettled)==null||v.call(w,d,this.state.error,this),this.scheduleGc()},onError:a,onFail:(d,g)=>{he(this,$t,fn).call(this,{type:"failed",failureCount:d,error:g})},onPause:()=>{he(this,$t,fn).call(this,{type:"pause"})},onContinue:()=>{he(this,$t,fn).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),O(this,st).start()}},Sr=new WeakMap,Nr=new WeakMap,Rt=new WeakMap,tr=new WeakMap,st=new WeakMap,mi=new WeakMap,nr=new WeakMap,$t=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,...ul(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 jo(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,Rt).notify({query:this,type:"updated",action:t})})},Xc);function ul(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:sl(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 Zt,Yc,ep=(Yc=class extends Br{constructor(t={}){super();se(this,Zt);this.config=t,G(this,Zt,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??js(o,n);let s=this.get(i);return s||(s=new Yf({client:t,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){O(this,Zt).has(t.queryHash)||(O(this,Zt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=O(this,Zt).get(t.queryHash);n&&(t.destroy(),n===t&&O(this,Zt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Je.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return O(this,Zt).get(t)}getAll(){return[...O(this,Zt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Va(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Va(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()})})}},Zt=new WeakMap,Yc),en,ct,rr,tn,Nn,Zc,tp=(Zc=class extends ll{constructor(t){super();se(this,tn);se(this,en);se(this,ct);se(this,rr);this.mutationId=t.mutationId,G(this,ct,t.mutationCache),G(this,en,[]),this.state=t.state||dl(),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,en).includes(t)||(O(this,en).push(t),this.clearGcTimeout(),O(this,ct).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){G(this,en,O(this,en).filter(n=>n!==t)),this.scheduleGc(),O(this,ct).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){O(this,en).length||(this.state.status==="pending"?this.scheduleGc():O(this,ct).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,f,u,d,g,h,w,v,p,x,m,I,_,C,S,R,N;const n=()=>{he(this,tn,Nn).call(this,{type:"continue"})};G(this,rr,cl({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(A,K)=>{he(this,tn,Nn).call(this,{type:"failed",failureCount:A,error:K})},onPause:()=>{he(this,tn,Nn).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>O(this,ct).canRun(this)}));const r=this.state.status==="pending",o=!O(this,rr).canStart();try{if(r)n();else{he(this,tn,Nn).call(this,{type:"pending",variables:t,isPaused:o}),await((s=(i=O(this,ct).config).onMutate)==null?void 0:s.call(i,t,this));const K=await((c=(a=this.options).onMutate)==null?void 0:c.call(a,t));K!==this.state.context&&he(this,tn,Nn).call(this,{type:"pending",context:K,variables:t,isPaused:o})}const A=await O(this,rr).start();return await((u=(f=O(this,ct).config).onSuccess)==null?void 0:u.call(f,A,t,this.state.context,this)),await((g=(d=this.options).onSuccess)==null?void 0:g.call(d,A,t,this.state.context)),await((w=(h=O(this,ct).config).onSettled)==null?void 0:w.call(h,A,null,this.state.variables,this.state.context,this)),await((p=(v=this.options).onSettled)==null?void 0:p.call(v,A,null,t,this.state.context)),he(this,tn,Nn).call(this,{type:"success",data:A}),A}catch(A){try{throw await((m=(x=O(this,ct).config).onError)==null?void 0:m.call(x,A,t,this.state.context,this)),await((_=(I=this.options).onError)==null?void 0:_.call(I,A,t,this.state.context)),await((S=(C=O(this,ct).config).onSettled)==null?void 0:S.call(C,void 0,A,this.state.variables,this.state.context,this)),await((N=(R=this.options).onSettled)==null?void 0:N.call(R,void 0,A,t,this.state.context)),A}finally{he(this,tn,Nn).call(this,{type:"error",error:A})}}finally{O(this,ct).runNext(this)}}},en=new WeakMap,ct=new WeakMap,rr=new WeakMap,tn=new WeakSet,Nn=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,en).forEach(r=>{r.onMutationUpdate(t)}),O(this,ct).notify({mutation:this,type:"updated",action:t})})},Zc);function dl(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var pn,qt,gi,el,np=(el=class extends Br{constructor(t={}){super();se(this,pn);se(this,qt);se(this,gi);this.config=t,G(this,pn,new Set),G(this,qt,new Map),G(this,gi,0)}build(t,n,r){const o=new tp({mutationCache:this,mutationId:++ji(this,gi)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){O(this,pn).add(t);const n=Li(t);if(typeof n=="string"){const r=O(this,qt).get(n);r?r.push(t):O(this,qt).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(O(this,pn).delete(t)){const n=Li(t);if(typeof n=="string"){const r=O(this,qt).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,qt).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Li(t);if(typeof n=="string"){const r=O(this,qt).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=Li(t);if(typeof n=="string"){const o=(r=O(this,qt).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,qt).clear()})}getAll(){return Array.from(O(this,pn))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Ua(n,r))}findAll(t={}){return this.getAll().filter(n=>Ua(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(At))))}},pn=new WeakMap,qt=new WeakMap,gi=new WeakMap,el);function Li(e){var t;return(t=e.options.scope)==null?void 0:t.id}function Ha(e){return{onFetch:(t,n)=>{var u,d,g,h,w;const r=t.options,o=(g=(d=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:d.fetchMore)==null?void 0:g.direction,i=((h=t.state.data)==null?void 0:h.pages)||[],s=((w=t.state.data)==null?void 0:w.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const f=async()=>{let v=!1;const p=I=>{Object.defineProperty(I,"signal",{enumerable:!0,get:()=>(t.signal.aborted?v=!0:t.signal.addEventListener("abort",()=>{v=!0}),t.signal)})},x=ol(t.options,t.fetchOptions),m=async(I,_,C)=>{if(v)return Promise.reject();if(_==null&&I.pages.length)return Promise.resolve(I);const S={client:t.client,queryKey:t.queryKey,pageParam:_,direction:C?"backward":"forward",meta:t.options.meta};p(S);const R=await x(S),{maxPages:N}=t.options,A=C?Jf:Bf;return{pages:A(I.pages,R,N),pageParams:A(I.pageParams,_,N)}};if(o&&i.length){const I=o==="backward",_=I?rp:Ba,C={pages:i,pageParams:s},S=_(r,C);a=await m(C,S,I)}else{const I=e??i.length;do{const _=c===0?s[0]??r.initialPageParam:Ba(r,a);if(c>0&&_==null)break;a=await m(a,_),c++}while(c<I)}return a};t.options.persister?t.fetchFn=()=>{var v,p;return(p=(v=t.options).persister)==null?void 0:p.call(v,f,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=f}}}function Ba(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 rp(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,An,Pn,Tr,Rr,Fn,Ar,Pr,tl,ip=(tl=class{constructor(e={}){se(this,ke);se(this,An);se(this,Pn);se(this,Tr);se(this,Rr);se(this,Fn);se(this,Ar);se(this,Pr);G(this,ke,e.queryCache||new ep),G(this,An,e.mutationCache||new np),G(this,Pn,e.defaultOptions||{}),G(this,Tr,new Map),G(this,Rr,new Map),G(this,Fn,0)}mount(){ji(this,Fn)._++,O(this,Fn)===1&&(G(this,Ar,Ls.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,ke).onFocus())})),G(this,Pr,to.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,ke).onOnline())})))}unmount(){var e,t;ji(this,Fn)._--,O(this,Fn)===0&&((e=O(this,Ar))==null||e.call(this),G(this,Ar,void 0),(t=O(this,Pr))==null||t.call(this),G(this,Pr,void 0))}isFetching(e){return O(this,ke).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return O(this,An).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=qf(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(At).catch(At)}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(At)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(At)}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(At).catch(At)}fetchInfiniteQuery(e){return e.behavior=Ha(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(At).catch(At)}ensureInfiniteQueryData(e){return e.behavior=Ha(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return to.isOnline()?O(this,An).resumePausedMutations():Promise.resolve()}getQueryCache(){return O(this,ke)}getMutationCache(){return O(this,An)}getDefaultOptions(){return O(this,Pn)}setDefaultOptions(e){G(this,Pn,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,Pn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=js(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===eo&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...O(this,Pn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){O(this,ke).clear(),O(this,An).clear()}},ke=new WeakMap,An=new WeakMap,Pn=new WeakMap,Tr=new WeakMap,Rr=new WeakMap,Fn=new WeakMap,Ar=new WeakMap,Pr=new WeakMap,tl),mt,ve,yi,lt,ir,Fr,Dn,Mn,vi,Dr,Mr,or,sr,kn,kr,Ee,ni,as,cs,ls,us,ds,fs,ps,fl,nl,op=(nl=class extends Br{constructor(t,n){super();se(this,Ee);se(this,mt);se(this,ve);se(this,yi);se(this,lt);se(this,ir);se(this,Fr);se(this,Dn);se(this,Mn);se(this,vi);se(this,Dr);se(this,Mr);se(this,or);se(this,sr);se(this,kn);se(this,kr,new Set);this.options=n,G(this,mt,t),G(this,Mn,null),G(this,Dn,ss()),this.options.experimental_prefetchInRender||O(this,Dn).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,ve).addObserver(this),Ja(O(this,ve),this.options)?he(this,Ee,ni).call(this):this.updateResult(),he(this,Ee,us).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return hs(O(this,ve),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return hs(O(this,ve),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,he(this,Ee,ds).call(this),he(this,Ee,fs).call(this),O(this,ve).removeObserver(this)}setOptions(t){const n=this.options,r=O(this,ve);if(this.options=O(this,mt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ht(this.options.enabled,O(this,ve))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");he(this,Ee,ps).call(this),O(this,ve).setOptions(this.options),n._defaulted&&!Zi(this.options,n)&&O(this,mt).getQueryCache().notify({type:"observerOptionsUpdated",query:O(this,ve),observer:this});const o=this.hasListeners();o&&Wa(O(this,ve),r,this.options,n)&&he(this,Ee,ni).call(this),this.updateResult(),o&&(O(this,ve)!==r||Ht(this.options.enabled,O(this,ve))!==Ht(n.enabled,O(this,ve))||xr(this.options.staleTime,O(this,ve))!==xr(n.staleTime,O(this,ve)))&&he(this,Ee,as).call(this);const i=he(this,Ee,cs).call(this);o&&(O(this,ve)!==r||Ht(this.options.enabled,O(this,ve))!==Ht(n.enabled,O(this,ve))||i!==O(this,kn))&&he(this,Ee,ls).call(this,i)}getOptimisticResult(t){const n=O(this,mt).getQueryCache().build(O(this,mt),t),r=this.createResult(n,t);return ap(this,r)&&(G(this,lt,r),G(this,Fr,this.options),G(this,ir,O(this,ve).state)),r}getCurrentResult(){return O(this,lt)}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,ve)}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 he(this,Ee,ni).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),O(this,lt)))}createResult(t,n){var A;const r=O(this,ve),o=this.options,i=O(this,lt),s=O(this,ir),a=O(this,Fr),f=t!==r?t.state:O(this,yi),{state:u}=t;let d={...u},g=!1,h;if(n._optimisticResults){const K=this.hasListeners(),z=!K&&Ja(t,n),H=K&&Wa(t,r,n,o);(z||H)&&(d={...d,...ul(u.data,t.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:w,errorUpdatedAt:v,status:p}=d;h=d.data;let x=!1;if(n.placeholderData!==void 0&&h===void 0&&p==="pending"){let K;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(K=i.data,x=!0):K=typeof n.placeholderData=="function"?n.placeholderData((A=O(this,Mr))==null?void 0:A.state.data,O(this,Mr)):n.placeholderData,K!==void 0&&(p="success",h=os(i==null?void 0:i.data,K,n),g=!0)}if(n.select&&h!==void 0&&!x)if(i&&h===(s==null?void 0:s.data)&&n.select===O(this,vi))h=O(this,Dr);else try{G(this,vi,n.select),h=n.select(h),h=os(i==null?void 0:i.data,h,n),G(this,Dr,h),G(this,Mn,null)}catch(K){G(this,Mn,K)}O(this,Mn)&&(w=O(this,Mn),h=O(this,Dr),v=Date.now(),p="error");const m=d.fetchStatus==="fetching",I=p==="pending",_=p==="error",C=I&&m,S=h!==void 0,N={status:p,fetchStatus:d.fetchStatus,isPending:I,isSuccess:p==="success",isError:_,isInitialLoading:C,isLoading:C,data:h,dataUpdatedAt:d.dataUpdatedAt,error:w,errorUpdatedAt:v,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>f.dataUpdateCount||d.errorUpdateCount>f.errorUpdateCount,isFetching:m,isRefetching:m&&!I,isLoadingError:_&&!S,isPaused:d.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:_&&S,isStale:Ks(t,n),refetch:this.refetch,promise:O(this,Dn)};if(this.options.experimental_prefetchInRender){const K=ee=>{N.status==="error"?ee.reject(N.error):N.data!==void 0&&ee.resolve(N.data)},z=()=>{const ee=G(this,Dn,N.promise=ss());K(ee)},H=O(this,Dn);switch(H.status){case"pending":t.queryHash===r.queryHash&&K(H);break;case"fulfilled":(N.status==="error"||N.data!==H.value)&&z();break;case"rejected":(N.status!=="error"||N.error!==H.reason)&&z();break}}return N}updateResult(){const t=O(this,lt),n=this.createResult(O(this,ve),this.options);if(G(this,ir,O(this,ve).state),G(this,Fr,this.options),O(this,ir).data!==void 0&&G(this,Mr,O(this,ve)),Zi(n,t))return;G(this,lt,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,lt)).some(a=>{const c=a;return O(this,lt)[c]!==t[c]&&s.has(c)})};he(this,Ee,fl).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&he(this,Ee,us).call(this)}},mt=new WeakMap,ve=new WeakMap,yi=new WeakMap,lt=new WeakMap,ir=new WeakMap,Fr=new WeakMap,Dn=new WeakMap,Mn=new WeakMap,vi=new WeakMap,Dr=new WeakMap,Mr=new WeakMap,or=new WeakMap,sr=new WeakMap,kn=new WeakMap,kr=new WeakMap,Ee=new WeakSet,ni=function(t){he(this,Ee,ps).call(this);let n=O(this,ve).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(At)),n},as=function(){he(this,Ee,ds).call(this);const t=xr(this.options.staleTime,O(this,ve));if(cr||O(this,lt).isStale||!ns(t))return;const r=il(O(this,lt).dataUpdatedAt,t)+1;G(this,or,setTimeout(()=>{O(this,lt).isStale||this.updateResult()},r))},cs=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(O(this,ve)):this.options.refetchInterval)??!1},ls=function(t){he(this,Ee,fs).call(this),G(this,kn,t),!(cr||Ht(this.options.enabled,O(this,ve))===!1||!ns(O(this,kn))||O(this,kn)===0)&&G(this,sr,setInterval(()=>{(this.options.refetchIntervalInBackground||Ls.isFocused())&&he(this,Ee,ni).call(this)},O(this,kn)))},us=function(){he(this,Ee,as).call(this),he(this,Ee,ls).call(this,he(this,Ee,cs).call(this))},ds=function(){O(this,or)&&(clearTimeout(O(this,or)),G(this,or,void 0))},fs=function(){O(this,sr)&&(clearInterval(O(this,sr)),G(this,sr,void 0))},ps=function(){const t=O(this,mt).getQueryCache().build(O(this,mt),this.options);if(t===O(this,ve))return;const n=O(this,ve);G(this,ve,t),G(this,yi,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},fl=function(t){Je.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(O(this,lt))}),O(this,mt).getQueryCache().notify({query:O(this,ve),type:"observerResultsUpdated"})})},nl);function sp(e,t){return Ht(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Ja(e,t){return sp(e,t)||e.state.data!==void 0&&hs(e,t,t.refetchOnMount)}function hs(e,t,n){if(Ht(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Ks(e,t)}return!1}function Wa(e,t,n,r){return(e!==t||Ht(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Ks(e,n)}function Ks(e,t){return Ht(t.enabled,e)!==!1&&e.isStaleByTime(xr(t.staleTime,e))}function ap(e,t){return!Zi(e.getCurrentResult(),t)}var jn,Ln,gt,hn,gn,zi,ms,rl,cp=(rl=class extends Br{constructor(n,r){super();se(this,gn);se(this,jn);se(this,Ln);se(this,gt);se(this,hn);G(this,jn,n),this.setOptions(r),this.bindMethods(),he(this,gn,zi).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,jn).defaultMutationOptions(n),Zi(this.options,r)||O(this,jn).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){he(this,gn,zi).call(this),he(this,gn,ms).call(this,n)}getCurrentResult(){return O(this,Ln)}reset(){var n;(n=O(this,gt))==null||n.removeObserver(this),G(this,gt,void 0),he(this,gn,zi).call(this),he(this,gn,ms).call(this)}mutate(n,r){var o;return G(this,hn,r),(o=O(this,gt))==null||o.removeObserver(this),G(this,gt,O(this,jn).getMutationCache().build(O(this,jn),this.options)),O(this,gt).addObserver(this),O(this,gt).execute(n)}},jn=new WeakMap,Ln=new WeakMap,gt=new WeakMap,hn=new WeakMap,gn=new WeakSet,zi=function(){var r;const n=((r=O(this,gt))==null?void 0:r.state)??dl();G(this,Ln,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},ms=function(n){Je.batch(()=>{var r,o,i,s,a,c,f,u;if(O(this,hn)&&this.hasListeners()){const d=O(this,Ln).variables,g=O(this,Ln).context;(n==null?void 0:n.type)==="success"?((o=(r=O(this,hn)).onSuccess)==null||o.call(r,n.data,d,g),(s=(i=O(this,hn)).onSettled)==null||s.call(i,n.data,null,d,g)):(n==null?void 0:n.type)==="error"&&((c=(a=O(this,hn)).onError)==null||c.call(a,n.error,d,g),(u=(f=O(this,hn)).onSettled)==null||u.call(f,void 0,n.error,d,g))}this.listeners.forEach(d=>{d(O(this,Ln))})})},rl),pl=M.createContext(void 0),vt=e=>{const t=M.useContext(pl);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},lp=({client:e,children:t})=>(M.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(pl.Provider,{value:e,children:t})),hl=M.createContext(!1),up=()=>M.useContext(hl);hl.Provider;function dp(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var fp=M.createContext(dp()),pp=()=>M.useContext(fp);function ml(e,t){return typeof e=="function"?e(...t):!!e}function gs(){}var hp=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},mp=e=>{M.useEffect(()=>{e.clearReset()},[e])},gp=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||ml(n,[e.error,r])),yp=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)))},vp=(e,t)=>e.isLoading&&e.isFetching&&!t,wp=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,za=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Ip(e,t,n){var d,g,h,w,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=vt(),o=up(),i=pp(),s=r.defaultQueryOptions(e);(g=(d=r.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||g.call(d,s),process.env.NODE_ENV!=="production"&&(s.queryFn||console.error(`[${s.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),s._optimisticResults=o?"isRestoring":"optimistic",yp(s),hp(s,i),mp(i);const a=!r.getQueryCache().get(s.queryHash),[c]=M.useState(()=>new t(r,s)),f=c.getOptimisticResult(s),u=!o&&e.subscribed!==!1;if(M.useSyncExternalStore(M.useCallback(p=>{const x=u?c.subscribe(Je.batchCalls(p)):gs;return c.updateResult(),x},[c,u]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),M.useEffect(()=>{c.setOptions(s)},[s,c]),wp(s,f))throw za(s,c,i);if(gp({result:f,errorResetBoundary:i,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw f.error;if((w=(h=r.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||w.call(h,s,f),s.experimental_prefetchInRender&&!cr&&vp(f,o)){const p=a?za(s,c,i):(v=r.getQueryCache().get(s.queryHash))==null?void 0:v.promise;p==null||p.catch(gs).finally(()=>{c.updateResult()})}return s.notifyOnChangeProps?f:c.trackResult(f)}function yn(e,t){return Ip(e,op)}function Jr(e,t){const n=vt(),[r]=M.useState(()=>new cp(n,e));M.useEffect(()=>{r.setOptions(e)},[r,e]);const o=M.useSyncExternalStore(M.useCallback(s=>r.subscribe(Je.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=M.useCallback((s,a)=>{r.mutate(s,a).catch(gs)},[r]);if(o.error&&ml(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:i,mutateAsync:o.mutate}}const gl=y.createContext(null),bp=gl.Provider,yl=()=>{const e=y.useContext(gl);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 vl=y.createContext(void 0);function Ft(){const e=y.useContext(vl);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const xp=(()=>{const e={};return Object.values(ue).forEach(t=>{e[t]={}}),e})();function Cp({children:e}){const[t,n]=y.useState(xp),r=y.useCallback((u,d,g=!0)=>{n(h=>{const w={...h};return w[u]=w[u]||{},w[u][d]=g,w})},[n]),o=y.useCallback((u,d)=>{var g;return!!((g=t[u])!=null&&g[d])},[t]),i=y.useCallback((u,d)=>{var g;return(g=t[u])==null?void 0:g[d]},[t]),s=y.useCallback((u,d)=>{n(g=>{var w;const h={...g};return(w=h[u])==null||delete w[d],h})},[n]),a=y.useCallback(u=>{n(d=>{const g={...d};return g[u]={},g})},[n]),c=y.useCallback((u,d)=>{n(g=>{const h={...g};return h[u]=h[u]||{},d.forEach(w=>{h[u][w]=!0}),h})},[n]),f=y.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(vl.Provider,{value:f,children:e})}const _p="https://api.withampersand.com/v1".replace(/\/+$/,"");class Vs{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:_p}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Il}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 Op=new Vs,yo=class yo{constructor(t=Op){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 Np(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?yo.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 wl(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(f=>o[f]===void 0?delete o[f]:{});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:Sp(a.body)||a.body instanceof URLSearchParams||Ep(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}};yo.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let nn=yo;function Ep(e){return typeof Blob<"u"&&e instanceof Blob}function Sp(e){return typeof FormData<"u"&&e instanceof FormData}class wl extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class Np extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class ie extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function T(e,t){const n=e[t];return n!=null}function Il(e,t=""){return Object.keys(e).map(n=>bl(n,e[n],t)).filter(n=>n.length>0).join("&")}function bl(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 bl(e,o,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Il(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 Ga{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function Tp(e){return Rp(e)}function Rp(e,t){return e==null?e:{fieldUsed:T(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:T(e,"keyFormat")?e.keyFormat:void 0}}function Ap(e){return Pp(e)}function Pp(e,t){return e==null?e:{name:e.name,valuePrefix:T(e,"valuePrefix")?e.valuePrefix:void 0}}function Fp(e){return Dp(e)}function Dp(e,t){return e==null?e:{name:e.name}}function Mp(e){return kp(e)}function kp(e,t){return e==null?e:{attachmentType:e.attachmentType,query:T(e,"query")?Fp(e.query):void 0,header:T(e,"header")?Ap(e.header):void 0,docsURL:T(e,"docsURL")?e.docsURL:void 0}}function jp(e){return Lp(e)}function Lp(e,t){return e==null?e:{enabled:T(e,"enabled")?e.enabled:void 0,includeFullRecords:T(e,"includeFullRecords")?e.includeFullRecords:void 0}}function Kp(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,includeFullRecords:e.includeFullRecords}}function Vp(e){return Up(e)}function Up(e,t){return e==null?e:{url:e.url,method:T(e,"method")?e.method:void 0,successStatusCodes:T(e,"successStatusCodes")?e.successStatusCodes:void 0}}const Qa={Oauth2:"oauth2",ApiKey:"apiKey",Basic:"basic",Jwt:"jwt",None:"none"};function $p(e){return qp(e)}function qp(e,t){return e}function Hp(e){return Bp(e)}function Bp(e,t){return e==null?e:{days:T(e,"days")?e.days:void 0,fullHistory:T(e,"fullHistory")?e.fullHistory:void 0}}function Jp(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function xl(e){return Wp(e)}function Wp(e,t){return e==null?e:{defaultPeriod:Hp(e.defaultPeriod)}}function zp(e){if(e!==void 0)return e===null?null:{defaultPeriod:Jp(e.defaultPeriod)}}function Gp(e){return Qp(e)}function Qp(e,t){return e==null?e:{days:T(e,"days")?e.days:void 0,fullHistory:T(e,"fullHistory")?e.fullHistory:void 0}}function Xp(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Yp(e){return Zp(e)}function Zp(e,t){return e==null?e:{defaultPeriod:Gp(e.defaultPeriod)}}function Cl(e){if(e!==void 0)return e===null?null:{defaultPeriod:Xp(e.defaultPeriod)}}function eh(e){return th(e)}function th(e,t){return e==null?e:{enabled:T(e,"enabled")?e.enabled:void 0}}function _l(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function nh(e){return rh(e)}function rh(e,t){return e}function ih(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:Cl(e.backfill)}}function oh(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:We(e.objects,ih)}}function sh(e){return ah(e)}function ah(e,t){return e==null?e:{stringValue:T(e,"stringValue")?e.stringValue:void 0,integerValue:T(e,"integerValue")?e.integerValue:void 0,booleanValue:T(e,"booleanValue")?e.booleanValue:void 0}}function ch(e){if(e!==void 0)return e===null?null:{stringValue:e.stringValue,integerValue:e.integerValue,booleanValue:e.booleanValue}}function lh(e){return uh(e)}function uh(e,t){return e==null?e:{_default:T(e,"default")?sh(e.default):void 0,writeOnCreate:T(e,"writeOnCreate")?e.writeOnCreate:void 0,writeOnUpdate:T(e,"writeOnUpdate")?e.writeOnUpdate:void 0}}function Ol(e){if(e!==void 0)return e===null?null:{default:ch(e._default),writeOnCreate:e.writeOnCreate,writeOnUpdate:e.writeOnUpdate}}function dh(e){let t=!0;return t=t&&"value"in e,t}function fh(e,t){return e==null?e:{value:e.value,applyOnUpdate:T(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function ph(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function hh(e){let t=!0;return t=t&&"value"in e,t}function mh(e,t){return e==null?e:{value:e.value,applyOnUpdate:T(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function gh(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function yh(e){let t=!0;return t=t&&"value"in e,t}function vh(e,t){return e==null?e:{value:e.value,applyOnUpdate:T(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function wh(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Ih(e){return bh(e)}function bh(e,t){return e==null?e:{...fh(e),...mh(e),...vh(e)}}function El(e){if(e!==void 0)return e===null?null:dh(e)?ph(e):hh(e)?gh(e):yh(e)?wh(e):{}}function xh(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:We(e.selectedValueDefaults,El),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:We(e.selectedFieldSettings,Ol)}}function Ch(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:We(e.objects,xh)}}function _h(e){return Oh(e)}function Oh(e,t){return e==null?e:{apiKeyAsBasic:T(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:T(e,"apiKeyAsBasicOpts")?Tp(e.apiKeyAsBasicOpts):void 0,docsURL:T(e,"docsURL")?e.docsURL:void 0}}function Eh(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Sh(e){return Nh(e)}function Nh(e,t){return e==null?e:{value:e.value}}function Th(e){return Rh(e)}function Rh(e,t){return e==null?e:{brandingRemoval:T(e,"brandingRemoval")?Sh(e.brandingRemoval):void 0}}function Ki(e){return Ah(e)}function Ah(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:T(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:T(e,"updateTime")?new Date(e.updateTime):void 0,entitlements:T(e,"entitlements")?Th(e.entitlements):void 0}}function Ph(e){return Fh(e)}function Fh(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function Dh(e){return Mh(e)}function Mh(e,t){return e==null?e:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:T(e,"selectedValueMappings")?e.selectedValueMappings:void 0,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:T(e,"selectedFieldsAuto")?nh(e.selectedFieldsAuto):void 0,backfill:T(e,"backfill")?Yp(e.backfill):void 0}}function kh(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:Cl(e.backfill)}}function jh(e){return Lh(e)}function Lh(e,t){return e==null?e:{objects:We(e.objects,Dh)}}function Kh(e){if(e!==void 0)return e===null?null:{objects:We(e.objects,kh)}}function Vh(e){return Uh(e)}function Uh(e,t){return e==null?e:{objectName:e.objectName,selectedValueDefaults:T(e,"selectedValueDefaults")?We(e.selectedValueDefaults,Ih):void 0,selectedFieldSettings:T(e,"selectedFieldSettings")?We(e.selectedFieldSettings,lh):void 0}}function $h(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:We(e.selectedValueDefaults,El),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:We(e.selectedFieldSettings,Ol)}}function qh(e){return Hh(e)}function Hh(e,t){return e==null?e:{objects:T(e,"objects")?We(e.objects,Vh):void 0}}function Bh(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:We(e.objects,$h)}}function Jh(e){return Wh(e)}function Wh(e,t){return e==null?e:{provider:e.provider,read:T(e,"read")?jh(e.read):void 0,write:T(e,"write")?qh(e.write):void 0,proxy:T(e,"proxy")?eh(e.proxy):void 0}}function zh(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:Kh(e.read),write:Bh(e.write),proxy:_l(e.proxy)}}function Gh(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:Jh(e.content)}}function Xh(e){return Yh(e)}function Yh(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:T(e,"updateTime")?new Date(e.updateTime):void 0}}function Sl(e){return Zh(e)}function Zh(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:T(e,"updateTime")?new Date(e.updateTime):void 0}}function em(e){return tm(e)}function tm(e,t){return e==null?e:{token:e.token,issuedAt:T(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:T(e,"expiresAt")?new Date(e.expiresAt):void 0}}function nm(e){return rm(e)}function rm(e,t){return e==null?e:{token:e.token,issuedAt:T(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:T(e,"expiresAt")?new Date(e.expiresAt):void 0}}function im(e){return om(e)}function om(e,t){return e==null?e:{accessToken:T(e,"accessToken")?em(e.accessToken):void 0,refreshToken:T(e,"refreshToken")?nm(e.refreshToken):void 0,scopes:T(e,"scopes")?e.scopes:void 0}}function Gi(e){return sm(e)}function sm(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:T(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:T(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:T(e,"updateTime")?new Date(e.updateTime):void 0}}function am(e){return cm(e)}function cm(e,t){return e==null?e:{value:e.value,source:e.source,displayName:T(e,"displayName")?e.displayName:void 0}}function Us(e){if(e!==void 0)return e===null?null:{value:e.value,source:e.source,displayName:e.displayName}}function ri(e){return lm(e)}function lm(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:T(e,"providerApp")?Gi(e.providerApp):void 0,group:Sl(e.group),consumer:Xh(e.consumer),providerWorkspaceRef:T(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerConsumerRef:T(e,"providerConsumerRef")?e.providerConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:T(e,"updateTime")?new Date(e.updateTime):void 0,authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:T(e,"oauth2AuthorizationCode")?im(e.oauth2AuthorizationCode):void 0,apiKey:T(e,"apiKey")?e.apiKey:void 0,providerMetadata:T(e,"providerMetadata")?We(e.providerMetadata,am):void 0}}function Nl(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function Tl(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function Rl(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 um(e){if(e!==void 0)return e===null?null:{token:e.token,expiresAt:e.expiresAt===void 0?void 0:e.expiresAt.toISOString(),issuedAt:e.issuedAt===void 0?void 0:e.issuedAt.toISOString()}}function dm(e){if(e!==void 0)return e===null?null:{token:e.token,expiresAt:e.expiresAt===void 0?void 0:e.expiresAt.toISOString(),issuedAt:e.issuedAt===void 0?void 0:e.issuedAt.toISOString()}}function Al(e){if(e!==void 0)return e===null?null:{accessToken:um(e.accessToken),refreshToken:dm(e.refreshToken),scopes:e.scopes}}function fm(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:We(e.providerMetadata,Us),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,basicAuth:Nl(e.basicAuth),oauth2ClientCredentials:Tl(e.oauth2ClientCredentials),oauth2PasswordCredentials:Rl(e.oauth2PasswordCredentials),oauth2AuthorizationCode:Al(e.oauth2AuthorizationCode)}}function pm(e){return hm(e)}function hm(e,t){return e==null?e:{enabled:T(e,"enabled")?e.enabled:void 0}}function mm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function gm(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:zh(e.content)}}function ym(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:gm(e.config)}}function vm(e){return wm(e)}function wm(e,t){return e==null?e:{enabled:T(e,"enabled")?e.enabled:void 0}}function Im(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function bm(e){return xm(e)}function xm(e,t){return e==null?e:{mode:T(e,"mode")?e.mode:void 0,pageSize:T(e,"pageSize")?e.pageSize:void 0}}function Cm(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function _m(e){let t=!0;return t=t&&"fieldName"in e,t}function Om(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:T(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:T(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Em(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function Sm(e){let t=!0;return t=t&&"mapToName"in e,t}function Pl(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:T(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:T(e,"default")?e.default:void 0,prompt:T(e,"prompt")?e.prompt:void 0}}function Nm(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function Xa(e){return Tm(e)}function Tm(e,t){return e==null?e:{...Om(e),...Pl(e)}}function Ya(e){if(e!==void 0)return e===null?null:_m(e)?Em(e):Sm(e)?Nm(e):{}}function Fl(e){return Rm(e)}function Rm(e,t){return e}function Am(e){return Pm(e)}function Pm(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:T(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:T(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:T(e,"requiredFields")?e.requiredFields.map(Xa):void 0,optionalFields:T(e,"optionalFields")?e.optionalFields.map(Xa):void 0,optionalFieldsAuto:T(e,"optionalFieldsAuto")?Fl(e.optionalFieldsAuto):void 0,backfill:T(e,"backfill")?xl(e.backfill):void 0,delivery:T(e,"delivery")?bm(e.delivery):void 0}}function Fm(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(Ya),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(Ya),optionalFieldsAuto:e.optionalFieldsAuto,backfill:zp(e.backfill),delivery:Cm(e.delivery)}}function Dm(e){return Mm(e)}function Mm(e,t){return e==null?e:{objects:T(e,"objects")?e.objects.map(Am):void 0}}function km(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Fm)}}function jm(e){return Lm(e)}function Lm(e,t){return e==null?e:{enabled:T(e,"enabled")?e.enabled:void 0}}function Km(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Vm(e){return Um(e)}function Um(e,t){return e==null?e:{enabled:T(e,"enabled")?e.enabled:void 0,watchFieldsAuto:T(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:T(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function $m(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function qm(e){return Hm(e)}function Hm(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:T(e,"inheritFieldsAndMapping")?e.inheritFieldsAndMapping:void 0,createEvent:T(e,"createEvent")?pm(e.createEvent):void 0,updateEvent:T(e,"updateEvent")?Vm(e.updateEvent):void 0,deleteEvent:T(e,"deleteEvent")?jm(e.deleteEvent):void 0,associationChangeEvent:T(e,"associationChangeEvent")?jp(e.associationChangeEvent):void 0,otherEvents:T(e,"otherEvents")?e.otherEvents:void 0}}function Bm(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:e.inheritFieldsAndMapping,createEvent:mm(e.createEvent),updateEvent:$m(e.updateEvent),deleteEvent:Km(e.deleteEvent),associationChangeEvent:Kp(e.associationChangeEvent),otherEvents:e.otherEvents}}function Jm(e){return Wm(e)}function Wm(e,t){return e==null?e:{objects:T(e,"objects")?e.objects.map(qm):void 0}}function zm(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Bm)}}function Dl(e){return Gm(e)}function Gm(e,t){return e==null?e:{allowAnyFields:T(e,"allowAnyFields")?e.allowAnyFields:void 0}}function Qm(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function Xm(e){return Ym(e)}function Ym(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:T(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:T(e,"valueDefaults")?Dl(e.valueDefaults):void 0}}function Zm(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:Qm(e.valueDefaults)}}function eg(e){return tg(e)}function tg(e,t){return e==null?e:{objects:T(e,"objects")?e.objects.map(Xm):void 0}}function ng(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Zm)}}function rg(e){return ig(e)}function ig(e,t){return e==null?e:{name:e.name,displayName:T(e,"displayName")?e.displayName:void 0,provider:e.provider,read:T(e,"read")?Dm(e.read):void 0,write:T(e,"write")?eg(e.write):void 0,proxy:T(e,"proxy")?vm(e.proxy):void 0,subscribe:T(e,"subscribe")?Jm(e.subscribe):void 0}}function og(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:km(e.read),write:ng(e.write),proxy:Im(e.proxy),subscribe:zm(e.subscribe)}}function sg(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:og(e.content)}}function ag(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:sg(e.latestRevision)}}function cg(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function lg(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 ug(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function dg(e){return fg(e)}function fg(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function pg(e){return hg(e)}function hg(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,valueType:T(e,"valueType")?e.valueType:void 0,providerType:T(e,"providerType")?e.providerType:void 0,readOnly:T(e,"readOnly")?e.readOnly:void 0,values:T(e,"values")?e.values.map(dg):void 0}}function mg(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:We(e.providerMetadata,Us),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,basicAuth:Nl(e.basicAuth),oauth2ClientCredentials:Tl(e.oauth2ClientCredentials),oauth2PasswordCredentials:Rl(e.oauth2PasswordCredentials),oauth2AuthorizationCode:Al(e.oauth2AuthorizationCode)}}function gg(e){return yg(e)}function yg(e,t){return e==null?e:{enabled:T(e,"enabled")?e.enabled:void 0}}function vg(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,mapToName:T(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:T(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Lo(e){return wg(e)}function wg(e,t){return e==null?e:{...vg(e),...Pl(e)}}function Ig(e){return bg(e)}function bg(e,t){return e==null?e:{error:T(e,"error")?e.error:void 0,objectName:e.objectName,displayName:e.displayName,mapToName:T(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:T(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:T(e,"requiredFields")?e.requiredFields.map(Lo):void 0,optionalFields:T(e,"optionalFields")?e.optionalFields.map(Lo):void 0,optionalFieldsAuto:T(e,"optionalFieldsAuto")?Fl(e.optionalFieldsAuto):void 0,allFields:T(e,"allFields")?e.allFields.map(Lo):void 0,allFieldsMetadata:T(e,"allFieldsMetadata")?We(e.allFieldsMetadata,pg):void 0,backfill:T(e,"backfill")?xl(e.backfill):void 0}}function xg(e){return Cg(e)}function Cg(e,t){return e==null?e:{objects:T(e,"objects")?e.objects.map(Ig):void 0}}function _g(e){return Og(e)}function Og(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:T(e,"valueDefaults")?Dl(e.valueDefaults):void 0}}function Eg(e){return Sg(e)}function Sg(e,t){return e==null?e:{objects:T(e,"objects")?e.objects.map(_g):void 0}}function Ng(e){return Tg(e)}function Tg(e,t){return e==null?e:{name:e.name,displayName:T(e,"displayName")?e.displayName:void 0,provider:e.provider,read:T(e,"read")?xg(e.read):void 0,write:T(e,"write")?Eg(e.write):void 0,proxy:T(e,"proxy")?gg(e.proxy):void 0}}function Rg(e){return Ag(e)}function Ag(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Ng(e.content)}}function Vi(e){return Pg(e)}function Pg(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:T(e,"group")?Sl(e.group):void 0,healthStatus:e.healthStatus,connection:ri(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:T(e,"updateTime")?new Date(e.updateTime):void 0,config:Gh(e.config)}}function Fg(e){return Dg(e)}function Dg(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:rg(e.content)}}function Za(e){return Mg(e)}function Mg(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:T(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:Fg(e.latestRevision)}}function kg(e){return jg(e)}function jg(e,t){return e==null?e:{iconURL:T(e,"iconURL")?e.iconURL:void 0,logoURL:T(e,"logoURL")?e.logoURL:void 0}}function Lg(e){return Kg(e)}function Kg(e,t){return e==null?e:{iconURL:T(e,"iconURL")?e.iconURL:void 0,logoURL:T(e,"logoURL")?e.logoURL:void 0}}function Vg(e){return Ug(e)}function Ug(e,t){return e==null?e:{regular:T(e,"regular")?Lg(e.regular):void 0,darkMode:T(e,"darkMode")?kg(e.darkMode):void 0}}function $g(e){return qg(e)}function qg(e,t){return e==null?e:{name:e.name,displayName:T(e,"displayName")?e.displayName:void 0,docsURL:T(e,"docsURL")?e.docsURL:void 0}}function Hg(e){return Bg(e)}function Bg(e,t){return e==null?e:{name:e.name}}function Jg(e){return Wg(e)}function Wg(e,t){return e==null?e:{create:T(e,"create")?e.create:void 0,update:T(e,"update")?e.update:void 0,_delete:T(e,"delete")?e.delete:void 0,passThrough:T(e,"passThrough")?e.passThrough:void 0}}function Ml(e){return zg(e)}function zg(e,t){return e==null?e:{bulkWrite:Ph(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write,subscribeSupport:T(e,"subscribeSupport")?Jg(e.subscribeSupport):void 0}}function Gg(e){return Qg(e)}function Qg(e,t){return e==null?e:{displayName:e.displayName,baseURL:e.baseURL,support:Ml(e.support)}}function Xg(e){return Yg(e)}function Yg(e,t){return e==null?e:{name:e.name,displayName:e.displayName,path:e.path,capture:T(e,"capture")?e.capture:void 0}}function Zg(e){return ey(e)}function ey(e,t){return e==null?e:{workspaceRefField:T(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:T(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:T(e,"scopesField")?e.scopesField:void 0,otherFields:T(e,"otherFields")?e.otherFields.map(Xg):void 0}}const Ko={AuthorizationCode:"authorizationCode",AuthorizationCodePkce:"authorizationCodePKCE",ClientCredentials:"clientCredentials",Password:"password"};function ty(e){return ny(e)}function ny(e,t){return e==null?e:{grantType:e.grantType,authURL:T(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:T(e,"audience")?e.audience:void 0,tokenMetadataFields:Zg(e.tokenMetadataFields),docsURL:T(e,"docsURL")?e.docsURL:void 0,authURLParams:T(e,"authURLParams")?e.authURLParams:void 0}}function ry(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:We(e.providerMetadata,Us),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 iy(e){return oy(e)}function oy(e,t){return e==null?e:{input:T(e,"input")?e.input.map($g):void 0,postAuthentication:T(e,"postAuthentication")?e.postAuthentication.map(Hg):void 0}}function sy(e){return ay(e)}function ay(e,t){return e==null?e:{subscriptionScope:e.subscriptionScope,targetURLScope:e.targetURLScope,registrationTiming:e.registrationTiming}}function ec(e){return cy(e)}function cy(e,t){return e==null?e:{name:e.name,authType:$p(e.authType),baseURL:e.baseURL,oauth2Opts:T(e,"oauth2Opts")?ty(e.oauth2Opts):void 0,apiKeyOpts:T(e,"apiKeyOpts")?Mp(e.apiKeyOpts):void 0,basicOpts:T(e,"basicOpts")?_h(e.basicOpts):void 0,support:Ml(e.support),providerOpts:e.providerOpts,authHealthCheck:T(e,"authHealthCheck")?Vp(e.authHealthCheck):void 0,displayName:T(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:T(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:T(e,"media")?Vg(e.media):void 0,labels:T(e,"labels")?e.labels:void 0,subscribeOpts:T(e,"subscribeOpts")?sy(e.subscribeOpts):void 0,modules:T(e,"modules")?We(e.modules,Gg):void 0,metadata:T(e,"metadata")?iy(e.metadata):void 0}}function ly(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,connection:fm(e.connection)}}function uy(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:oh(e.read),write:Ch(e.write),proxy:_l(e.proxy)}}function dy(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:uy(e.content)}}function fy(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:dy(e.config)}}function py(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:fy(e.installation)}}function hy(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function my(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:hy(e.project)}}function gy(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 yy(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:gy(e.providerApp)}}class vy extends nn{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling deleteConnection.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"DELETE",headers:o,query:r},n);return new 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 ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:mg(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 ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const r={};t.includeCreds!==void 0&&(r.includeCreds=t.includeCreds),t.includeRefreshToken!==void 0&&(r.includeRefreshToken=t.includeRefreshToken),t.refresh!==void 0&&(r.refresh=t.refresh);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"GET",headers:o,query:r},n);return new 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 ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const r={};t.provider!==void 0&&(r.provider=t.provider),t.groupRef!==void 0&&(r.groupRef=t.groupRef),t.consumerRef!==void 0&&(r.consumerRef=t.consumerRef);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new 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 ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling updateConnection.");if(t.updateConnectionRequest===null||t.updateConnectionRequest===void 0)throw new ie("updateConnectionRequest","Required parameter requestParameters.updateConnectionRequest was null or undefined when calling updateConnection.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:o,query:r,body:ly(t.updateConnectionRequest)},n);return new je(i,s=>ri(s))}async updateConnection(t,n){return await(await this.updateConnectionRaw(t,n)).value()}}class wy extends nn{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new ie("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:r,body:ym(t.installation)},n);return new je(i,s=>Vi(s))}async createInstallation(t,n){return await(await this.createInstallationRaw(t,n)).value()}async deleteInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"DELETE",headers:o,query:r},n);return new 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 ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"GET",headers:o,query:r},n);return new je(i,s=>Vi(s))}async getInstallation(t,n){return await(await this.getInstallationRaw(t,n)).value()}async listInstallationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"GET",headers:o,query:r},n);return new je(i,s=>s.map(Vi))}async listInstallations(t,n){return await(await this.listInstallationsRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new ie("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"PATCH",headers:o,query:r,body:py(t.installationUpdate)},n);return new je(i,s=>Vi(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class Iy extends nn{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");if(t.batchUpsertIntegrationsRequest===null||t.batchUpsertIntegrationsRequest===void 0)throw new ie("batchUpsertIntegrationsRequest","Required parameter requestParameters.batchUpsertIntegrationsRequest was null or undefined when calling batchUpsertIntegrations.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:o,query:r,body:Eh(t.batchUpsertIntegrationsRequest)},n);return new je(i,s=>s.map(Za))}async batchUpsertIntegrations(t,n){return await(await this.batchUpsertIntegrationsRaw(t,n)).value()}async createIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new ie("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:ag(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 ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"DELETE",headers:o,query:r},n);return new 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 ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new je(i,s=>s.map(Za))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class by extends nn{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new ie("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/oauth-connect",method:"POST",headers:o,query:r,body:ry(t.connectOAuthParams)},n);return this.isJsonMime(i.headers.get("content-type"))?new je(i):new Ga(i)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}async oauthUpdateRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling oauthUpdate.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling oauthUpdate.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}:oauth-update".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"PATCH",headers:o,query:r},n);return this.isJsonMime(i.headers.get("content-type"))?new je(i):new Ga(i)}async oauthUpdate(t,n){return await(await this.oauthUpdateRaw(t,n)).value()}}class xy extends nn{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new ie("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects",method:"POST",headers:o,query:r,body:cg(t.project)},n);return new je(i,s=>Ki(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 ie("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 ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={};t.includeEntitlements!==void 0&&(r.includeEntitlements=t.includeEntitlements);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new je(i,s=>Ki(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(Ki))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new ie("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:o,query:r,body:my(t.projectUpdate)},n);return new je(i,s=>Ki(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class Cy extends nn{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new ie("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:o,query:r},n);return new je(i,s=>ec(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,ec))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class _y extends nn{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new ie("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:lg(t.providerApp)},n);return new je(i,s=>Gi(s))}async createProviderApp(t,n){return await(await this.createProviderAppRaw(t,n)).value()}async deleteProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ie("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"DELETE",headers:o,query:r},n);return new 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 ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new je(i,s=>s.map(Gi))}async listProviderApps(t,n){return await(await this.listProviderAppsRaw(t,n)).value()}async updateProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ie("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new ie("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"PATCH",headers:o,query:r,body:yy(t.providerAppUpdate)},n);return new je(i,s=>Gi(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class Oy extends nn{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");if(t.revision===null||t.revision===void 0)throw new ie("revision","Required parameter requestParameters.revision was null or undefined when calling createRevision.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:r,body:ug(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 ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new ie("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions/{revisionId}:hydrate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{revisionId}",encodeURIComponent(String(t.revisionId))),method:"GET",headers:o,query:r},n);return new je(i,s=>Rg(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class kl{constructor(t){this.connectionApi=new vy(t),this.installationApi=new wy(t),this.integrationApi=new Iy(t),this.oAuthApi=new by(t),this.projectApi=new xy(t),this.providerApi=new Cy(t),this.providerAppApi=new _y(t),this.revisionApi=new Oy(t)}}const jl="2.7.7",Ey="v1",Ui="https://api.withampersand.com";function Ll(){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 Ui;case"mock":return"http://127.0.0.1:4010";case"":return Ui;default:return e??Ui}}catch{return Ui}}const Sy=(e,t)=>`${e}/${t}`;function Ny(){return Sy(Ll(),Ey)}const Ty=Ll(),Kl=Ny(),Ry=new Vs({basePath:Kl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":jl}});let Ay=new kl(Ry);const $s=()=>Ay;function ut(){const e=yl();return y.useCallback(async()=>{e||console.error("Unable to create API service without API key.");const n=new Vs({basePath:Kl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":jl,"X-Api-Key":e}});return new kl(n)},[e])}const Py=e=>{const t=ut();return yn({queryKey:["project",e],queryFn:async()=>(await t()).projectApi.getProject({projectIdOrName:e})})},Vl=y.createContext({project:null,appName:"",projectId:"",projectIdOrName:"",isLoading:!0}),Te=()=>{const e=y.useContext(Vl);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e};function Fy({projectIdOrName:e,children:t}){const{setError:n}=Ft(),{data:r,isLoading:o,isError:i}=Py(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 l.jsx(Vl.Provider,{value:s,children:t})}function Ul(){const e=ut(),{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 wl){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
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(c)}catch(i){console.error("Error parsing error response body:",i)}}else console.error("Unexpected error:",e.message)}
|
|
5
|
-
component is wrapped with AmpersandProvider`);return e}const
|
|
6
|
-
`).filter(n=>n.trim()!==""),zy=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,Gy=e=>e.replace(/[.:/\\]/g,"\\$&"),Qy=()=>{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}},Hl=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(Hl);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function Xy({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,fieldMapping:u}){const{integrations:d}=Us(),{setError:f,isError:h,removeError:m}=Ft(),{isIntegrationDeleted:x,setIntegrationDeleted:w,resetIntegrationDeleted:p}=Qy(),_=v.useMemo(()=>zy(t,d||[]),[t,d]),{data:g,isLoading:y,isError:I,error:C}=$l(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:x,setIntegrationDeleted:w,fieldMapping:u}),[_,n,r,o,i,S,F,R,s,a,c,x,w,u]);if(y)return l.jsx(zr,{});if(_===null)return l.jsx(Bt,{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(Bt,{message:J})}return l.jsx(Hl.Provider,{value:Q,children:e})}const Bl=v.createContext({connections:null,isConnectionsLoading:!0,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),Gt=()=>{const e=v.useContext(Bl);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function Jl({groupRef:e,provider:t,children:n}){const r=vt(),{setError:o,isError:i}=Ft(),{projectId:s,isLoading:a}=Te(),{integrationId:c,groupRef:u}=rt(),{provider:d}=Dy(c),{data:f,isLoading:h,isError:m,error:x}=Ll({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(x)):o(ue.CONNECTION_LIST,s,!1)},[m,o,s,x]);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(zr,{});if(i(ue.PROJECT,s))return l.jsx(Bt,{message:`Error loading project ${s}`});if(i(ue.CONNECTION_LIST,s))return l.jsx(Bt,{message:"Error retrieving existing connections"});if(!s)throw new Error("Project ID not found. ConnectionsProvider must be used within AmpersandProvider");return l.jsx(Bl.Provider,{value:g,children:n})}function Wl(){const[e,t]=v.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}var Vi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function qs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var eo={exports:{}};eo.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]",x="[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]",Ie="[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[Ie]=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 Vi=="object"&&Vi&&Vi.Object===Object&&Vi,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,we=function(){try{return M&&M.binding&&M.binding("util")}catch{}}(),H=we&&we.isTypedArray;function Se(b,E){for(var P=-1,X=b==null?0:b.length,Re=0,fe=[];++P<X;){var Me=b[P];E(Me,P,b)&&(fe[Re++]=Me)}return fe}function Ve(b,E){for(var P=-1,X=E.length,Re=b.length;++P<X;)b[Re+P]=E[P];return b}function Ye(b,E){for(var P=-1,X=b==null?0:b.length;++P<X;)if(E(b[P],P,b))return!0;return!1}function Ue(b,E){for(var P=-1,X=Array(b);++P<b;)X[P]=E(P);return X}function be(b){return function(E){return b(E)}}function Dt(b,E){return b.has(E)}function Ze(b,E){return b==null?void 0:b[E]}function wt(b){var E=-1,P=Array(b.size);return b.forEach(function(X,Re){P[++E]=[Re,X]}),P}function Mt(b,E){return function(P){return b(E(P))}}function kt(b){var E=-1,P=Array(b.size);return b.forEach(function(X){P[++E]=X}),P}var et=Array.prototype,Ge=Function.prototype,$e=Object.prototype,Pe=q["__core-js_shared__"],jt=Ge.toString,dt=$e.hasOwnProperty,sn=function(){var b=/[^.]+$/.exec(Pe&&Pe.keys&&Pe.keys.IE_PROTO||"");return b?"Symbol(src)_1."+b:""}(),Xt=$e.toString,It=RegExp("^"+jt.call(dt).replace($,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Fe=de?q.Buffer:void 0,an=q.Symbol,In=q.Uint8Array,cn=$e.propertyIsEnumerable,Hn=et.splice,ft=an?an.toStringTag:void 0,ln=Object.getOwnPropertySymbols,bn=Fe?Fe.isBuffer:void 0,Bn=Mt(Object.keys,Object),xn=vr(q,"DataView"),Ae=vr(q,"Map"),it=vr(q,"Promise"),ie=vr(q,"Set"),me=vr(q,"WeakMap"),qe=vr(Object,"create"),un=Wn(xn),W=Wn(Ae),ae=Wn(it),le=Wn(ie),Ke=Wn(me),He=an?an.prototype:void 0,pt=He?He.valueOf:void 0;function Qe(b){var E=-1,P=b==null?0:b.length;for(this.clear();++E<P;){var X=b[E];this.set(X[0],X[1])}}function tt(){this.__data__=qe?qe(null):{},this.size=0}function ht(b){var E=this.has(b)&&delete this.__data__[b];return this.size-=E?1:0,E}function Ne(b){var E=this.__data__;if(qe){var P=E[b];return P===r?void 0:P}return dt.call(E,b)?E[b]:void 0}function _n(b){var E=this.__data__;return qe?E[b]!==void 0:dt.call(E,b)}function Ro(b,E){var P=this.__data__;return this.size+=this.has(b)?0:1,P[b]=qe&&E===void 0?r:E,this}Qe.prototype.clear=tt,Qe.prototype.delete=ht,Qe.prototype.get=Ne,Qe.prototype.has=_n,Qe.prototype.set=Ro;function Lt(b){var E=-1,P=b==null?0:b.length;for(this.clear();++E<P;){var X=b[E];this.set(X[0],X[1])}}function Ci(){this.__data__=[],this.size=0}function Oi(b){var E=this.__data__,P=Ri(E,b);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(b){var E=this.__data__,P=Ri(E,b);return P<0?void 0:E[P][1]}function Si(b){return Ri(this.__data__,b)>-1}function Ni(b,E){var P=this.__data__,X=Ri(P,b);return X<0?(++this.size,P.push([b,E])):P[X][1]=E,this}Lt.prototype.clear=Ci,Lt.prototype.delete=Oi,Lt.prototype.get=Ei,Lt.prototype.has=Si,Lt.prototype.set=Ni;function ye(b){var E=-1,P=b==null?0:b.length;for(this.clear();++E<P;){var X=b[E];this.set(X[0],X[1])}}function Kt(){this.size=0,this.__data__={hash:new Qe,map:new(Ae||Lt),string:new Qe}}function Xr(b){var E=Ai(this,b).delete(b);return this.size-=E?1:0,E}function Jn(b){return Ai(this,b).get(b)}function Ao(b){return Ai(this,b).has(b)}function Yr(b,E){var P=Ai(this,b),X=P.size;return P.set(b,E),this.size+=P.size==X?0:1,this}ye.prototype.clear=Kt,ye.prototype.delete=Xr,ye.prototype.get=Jn,ye.prototype.has=Ao,ye.prototype.set=Yr;function Ti(b){var E=-1,P=b==null?0:b.length;for(this.__data__=new ye;++E<P;)this.add(b[E])}function uf(b){return this.__data__.set(b,r),this}function df(b){return this.__data__.has(b)}Ti.prototype.add=Ti.prototype.push=uf,Ti.prototype.has=df;function Cn(b){var E=this.__data__=new Lt(b);this.size=E.size}function ff(){this.__data__=new Lt,this.size=0}function pf(b){var E=this.__data__,P=E.delete(b);return this.size=E.size,P}function hf(b){return this.__data__.get(b)}function mf(b){return this.__data__.has(b)}function gf(b,E){var P=this.__data__;if(P instanceof Lt){var X=P.__data__;if(!Ae||X.length<n-1)return X.push([b,E]),this.size=++P.size,this;P=this.__data__=new ye(X)}return P.set(b,E),this.size=P.size,this}Cn.prototype.clear=ff,Cn.prototype.delete=pf,Cn.prototype.get=hf,Cn.prototype.has=mf,Cn.prototype.set=gf;function yf(b,E){var P=Pi(b),X=!P&&Pf(b),Re=!P&&!X&&Po(b),fe=!P&&!X&&!Re&&Pa(b),Me=P||X||Re||fe,Xe=Me?Ue(b.length,String):[],nt=Xe.length;for(var De in b)dt.call(b,De)&&!(Me&&(De=="length"||Re&&(De=="offset"||De=="parent")||fe&&(De=="buffer"||De=="byteLength"||De=="byteOffset")||Sf(De,nt)))&&Xe.push(De);return Xe}function Ri(b,E){for(var P=b.length;P--;)if(Na(b[P][0],E))return P;return-1}function vf(b,E,P){var X=E(b);return Pi(b)?X:Ve(X,P(b))}function Zr(b){return b==null?b===void 0?F:_:ft&&ft in Object(b)?Of(b):Af(b)}function Ca(b){return ei(b)&&Zr(b)==a}function Oa(b,E,P,X,Re){return b===E?!0:b==null||E==null||!ei(b)&&!ei(E)?b!==b&&E!==E:wf(b,E,P,X,Oa,Re)}function wf(b,E,P,X,Re,fe){var Me=Pi(b),Xe=Pi(E),nt=Me?c:On(b),De=Xe?c:On(E);nt=nt==a?g:nt,De=De==a?g:De;var bt=nt==g,Vt=De==g,ot=nt==De;if(ot&&Po(b)){if(!Po(E))return!1;Me=!0,bt=!1}if(ot&&!bt)return fe||(fe=new Cn),Me||Pa(b)?Ea(b,E,P,X,Re,fe):_f(b,E,nt,P,X,Re,fe);if(!(P&o)){var St=bt&&dt.call(b,"__wrapped__"),Nt=Vt&&dt.call(E,"__wrapped__");if(St||Nt){var En=St?b.value():b,dn=Nt?E.value():E;return fe||(fe=new Cn),Re(En,dn,P,X,fe)}}return ot?(fe||(fe=new Cn),Cf(b,E,P,X,Re,fe)):!1}function If(b){if(!Aa(b)||Tf(b))return!1;var E=Ta(b)?It:K;return E.test(Wn(b))}function bf(b){return ei(b)&&Ra(b.length)&&!!D[Zr(b)]}function xf(b){if(!Rf(b))return Bn(b);var E=[];for(var P in Object(b))dt.call(b,P)&&P!="constructor"&&E.push(P);return E}function Ea(b,E,P,X,Re,fe){var Me=P&o,Xe=b.length,nt=E.length;if(Xe!=nt&&!(Me&&nt>Xe))return!1;var De=fe.get(b);if(De&&fe.get(E))return De==E;var bt=-1,Vt=!0,ot=P&i?new Ti:void 0;for(fe.set(b,E),fe.set(E,b);++bt<Xe;){var St=b[bt],Nt=E[bt];if(X)var En=Me?X(Nt,St,bt,E,b,fe):X(St,Nt,bt,b,E,fe);if(En!==void 0){if(En)continue;Vt=!1;break}if(ot){if(!Ye(E,function(dn,zn){if(!Dt(ot,zn)&&(St===dn||Re(St,dn,P,X,fe)))return ot.push(zn)})){Vt=!1;break}}else if(!(St===Nt||Re(St,Nt,P,X,fe))){Vt=!1;break}}return fe.delete(b),fe.delete(E),Vt}function _f(b,E,P,X,Re,fe,Me){switch(P){case J:if(b.byteLength!=E.byteLength||b.byteOffset!=E.byteOffset)return!1;b=b.buffer,E=E.buffer;case Q:return!(b.byteLength!=E.byteLength||!fe(new In(b),new In(E)));case d:case f:case p:return Na(+b,+E);case h:return b.name==E.name&&b.message==E.message;case C:case T:return b==E+"";case w:var Xe=wt;case S:var nt=X&o;if(Xe||(Xe=kt),b.size!=E.size&&!nt)return!1;var De=Me.get(b);if(De)return De==E;X|=i,Me.set(b,E);var bt=Ea(Xe(b),Xe(E),X,Re,fe,Me);return Me.delete(b),bt;case R:if(pt)return pt.call(b)==pt.call(E)}return!1}function Cf(b,E,P,X,Re,fe){var Me=P&o,Xe=Sa(b),nt=Xe.length,De=Sa(E),bt=De.length;if(nt!=bt&&!Me)return!1;for(var Vt=nt;Vt--;){var ot=Xe[Vt];if(!(Me?ot in E:dt.call(E,ot)))return!1}var St=fe.get(b);if(St&&fe.get(E))return St==E;var Nt=!0;fe.set(b,E),fe.set(E,b);for(var En=Me;++Vt<nt;){ot=Xe[Vt];var dn=b[ot],zn=E[ot];if(X)var Fa=Me?X(zn,dn,ot,E,b,fe):X(dn,zn,ot,b,E,fe);if(!(Fa===void 0?dn===zn||Re(dn,zn,P,X,fe):Fa)){Nt=!1;break}En||(En=ot=="constructor")}if(Nt&&!En){var Fi=b.constructor,Di=E.constructor;Fi!=Di&&"constructor"in b&&"constructor"in E&&!(typeof Fi=="function"&&Fi instanceof Fi&&typeof Di=="function"&&Di instanceof Di)&&(Nt=!1)}return fe.delete(b),fe.delete(E),Nt}function Sa(b){return vf(b,Mf,Ef)}function Ai(b,E){var P=b.__data__;return Nf(E)?P[typeof E=="string"?"string":"hash"]:P.map}function vr(b,E){var P=Ze(b,E);return If(P)?P:void 0}function Of(b){var E=dt.call(b,ft),P=b[ft];try{b[ft]=void 0;var X=!0}catch{}var Re=Xt.call(b);return X&&(E?b[ft]=P:delete b[ft]),Re}var Ef=ln?function(b){return b==null?[]:(b=Object(b),Se(ln(b),function(E){return cn.call(b,E)}))}:kf,On=Zr;(xn&&On(new xn(new ArrayBuffer(1)))!=J||Ae&&On(new Ae)!=w||it&&On(it.resolve())!=y||ie&&On(new ie)!=S||me&&On(new me)!=U)&&(On=function(b){var E=Zr(b),P=E==g?b.constructor:void 0,X=P?Wn(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 Sf(b,E){return E=E??s,!!E&&(typeof b=="number"||L.test(b))&&b>-1&&b%1==0&&b<E}function Nf(b){var E=typeof b;return E=="string"||E=="number"||E=="symbol"||E=="boolean"?b!=="__proto__":b===null}function Tf(b){return!!sn&&sn in b}function Rf(b){var E=b&&b.constructor,P=typeof E=="function"&&E.prototype||$e;return b===P}function Af(b){return Xt.call(b)}function Wn(b){if(b!=null){try{return jt.call(b)}catch{}try{return b+""}catch{}}return""}function Na(b,E){return b===E||b!==b&&E!==E}var Pf=Ca(function(){return arguments}())?Ca:function(b){return ei(b)&&dt.call(b,"callee")&&!cn.call(b,"callee")},Pi=Array.isArray;function Ff(b){return b!=null&&Ra(b.length)&&!Ta(b)}var Po=bn||jf;function Df(b,E){return Oa(b,E)}function Ta(b){if(!Aa(b))return!1;var E=Zr(b);return E==m||E==x||E==u||E==I}function Ra(b){return typeof b=="number"&&b>-1&&b%1==0&&b<=s}function Aa(b){var E=typeof b;return b!=null&&(E=="object"||E=="function")}function ei(b){return b!=null&&typeof b=="object"}var Pa=H?be(H):bf;function Mf(b){return Ff(b)?yf(b):xf(b)}function kf(){return[]}function jf(){return!1}e.exports=Df})(eo,eo.exports);var Yy=eo.exports;const zl=qs(Yy),dr="other",to="manage-tab";function Vn(e){return!e.fieldName}function Zy(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function ev(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!Vn(n)&&!!n.fieldName))||null}function tv(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>Vn(r)&&!!r.mapToName))||[]}function nv(e){var n;return((n=e==null?void 0:e.optionalFields)==null?void 0:n.filter(r=>Vn(r)&&!!r.mapToName))||[]}function rv(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!Vn(n)&&!!n.fieldName))||null}const Gl=(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 iv(e){return Vn(e)?e.mapToName:e.fieldName}const Ql=(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)&&ur(s==null?void 0:s.objectName),completed:e?!!Gl(e,s.objectName):!1})}),n},Xl=e=>{var n;return{name:dr,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function ov(e,t){var i;const n=Ql(e,t),o=!!((i=t==null?void 0:t.content)!=null&&i.write)?Xl(e):void 0;return o&&n.push(o),n}function Yl(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 sv(e,t){return zl(e,t)}function Zl(e,t){return zl(e,t)}const av=(e,t,n)=>{var p,_,g,y,I,C,S,T,R;if(!e)return null;const r=Zy(e,t),o=r&&ev(r),i=r&&rv(r),s=r&&tv(r),a=r&&nv(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)||{},x={...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:x,requiredMapFields:w,selectedValueMappings:h}}},cv=(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 eu(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:av(r,t,n),write:cv(o,n)}}const tu=(e,t,n,r)=>{const o=eu(e,n,t);r(n,o)},lv=(e,t,n)=>{const r=ov(t,e),o={};r.forEach(({name:i,completed:s})=>{s&&(o[i]=eu(e,i,t))}),n(o)},nu=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(i=>r.add(iv(i))),{...Array.from(r).reduce((i,s)=>({...i,[s]:!0}),{}),...n||{}}},ru=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},iu=e=>{const{selectedValueMappings:t}=(e==null?void 0:e.read)||{};return t};function ou(e,t){return t[e]||void 0}async function su({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 Vs().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 uv=(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)},dv=(e,t,n,r)=>{const o=nu(e),i=ru(e),s=iu(e),a=uv(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},fv=(e,t,n,r,o,i,s,a,c,u,d,f)=>{const h=dv(c,i,a,r);return h?su({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))},au=e=>{var t;return{...(t=e.write)==null?void 0:t.selectedWriteObjects}},pv=e=>{const t=e.content.write;return t==null?void 0:t.objects},hv=(e,t,n)=>{if(!pv(t))return console.error("Error when getting write objects from hydratedRevision"),null;const o=au(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},mv=(e,t,n,r,o,i,s,a,c,u,d)=>{const f=hv(a,s,r);return f?su({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 cu={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)},$l=y.createContext({integrations:null,isLoading:!0}),qs=()=>{const e=y.useContext($l);if(!e)throw new Error("useIntegrationList must be used within a IntegrationListProvider");return e};function Dy({children:e}){const{projectIdOrName:t}=Te(),{setError:n,removeError:r}=Ft(),{data:o,isLoading:i,isError:s}=Ul();y.useEffect(()=>{s?(Le(s),n(ue.INTEGRATION_LIST,t)):r(ue.INTEGRATION_LIST,t)},[s,t,r,n]);const a=y.useMemo(()=>({integrations:o||null,isLoading:i}),[o,i]);return l.jsx($l.Provider,{value:a,children:e})}const My=new ip;function ky(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(lp,{client:My,children:l.jsx(Cp,{children:l.jsx(bp,{value:t,children:l.jsx(Fy,{projectIdOrName:i,children:l.jsx(Dy,{children:o})})})})})}const ql=y.createContext(null);function jy(){const e=y.useContext(ql);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
|
|
5
|
+
component is wrapped with AmpersandProvider`);return e}const Hl=({groupRef:e,provider:t})=>{const{projectIdOrName:n}=Te(),r=ut();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})},Ly=e=>{const t=Ul(),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 Ky(){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 Vy="_box_1p7c5_1",tc={box:Vy};function vn({children:e,className:t,style:n}){return l.jsx("div",{className:t?`${tc.box} ${t}`:tc.box,style:n,children:e})}const Uy="_container_1wvzr_1",nc={container:Uy};function Wr({children:e,className:t,style:n}){return l.jsx("div",{className:t?`${nc.container} ${t}`:nc.container,style:n,children:e})}const $y="_errorBoxContainer_4sdb2_1",qy="_errorBox_4sdb2_1",Hy="_errorText_4sdb2_20",ys={errorBoxContainer:$y,errorBox:qy,errorText:Hy};function Bl({message:e}){return l.jsx(vn,{className:ys.errorBox,children:l.jsx("p",{className:ys.errorText,children:e})})}function Jl({message:e,children:t}){return l.jsxs(Wr,{className:ys.errorBoxContainer,children:[l.jsx(Ky,{}),l.jsx(Bl,{message:e}),t]})}const By="_loader_6ubm6_1",Jy="_rotate_6ubm6_1",Wy="_ball1_6ubm6_1",zy="_ball2_6ubm6_1",Gy={loader:By,rotate:Jy,ball1:Wy,ball2:zy};function Qy(){return l.jsx("span",{className:Gy.loader})}function ci(){return l.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:l.jsx(Qy,{})})}function Wl({children:e}){return l.jsx(Wr,{style:{maxWidth:"55rem"},children:l.jsx(vn,{children:e})})}function zr(){return l.jsx(Wl,{children:l.jsx(ci,{})})}function Jt({message:e,children:t}){return l.jsx(Wl,{children:l.jsx(Jl,{message:e,children:t})})}const zl=(e,t)=>{var s;const n=ut(),{projectIdOrName:r}=Te(),{integrations:o}=qs(),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 Hs(e,t){try{return process.env[e]}catch{return t}}function Un(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Gl(e,t){return(t==null?void 0:t.displayName)??Un(e)}const Xy=e=>e.split(`
|
|
6
|
+
`).filter(n=>n.trim()!==""),Yy=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,Zy=e=>e.replace(/[.:/\\]/g,"\\$&"),ev=()=>{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}},Ql=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(Ql);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function tv({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,fieldMapping:f}){const{integrations:u}=qs(),{setError:d,isError:g,removeError:h}=Ft(),{isIntegrationDeleted:w,setIntegrationDeleted:v,resetIntegrationDeleted:p}=ev(),x=y.useMemo(()=>Yy(t,u||[]),[t,u]),{data:m,isLoading:I,isError:_,error:C}=zl(t,o),S=(m==null?void 0:m[0])||null;y.useEffect(()=>{p()},[t,n,r,o,i,f]),y.useEffect(()=>{x===null&&(u!=null&&u.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,x,u]),y.useEffect(()=>{_?(d(ue.INSTALLATION_LIST,(x==null?void 0:x.id)||""),Le(C)):h(ue.INSTALLATION_LIST,(x==null?void 0:x.id)||"")},[_,x,d,h,C]);const R=vt(),N=y.useCallback(()=>{R.invalidateQueries({queryKey:["amp","installations"]})},[R]),A=y.useCallback(H=>{R.setQueryData(["amp","installations"],[H]),R.invalidateQueries({queryKey:["amp","installations"]})},[R]),K=(x==null?void 0:x.id)||"",z=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:S||void 0,setInstallation:A,resetInstallations:N,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,isIntegrationDeleted:w,setIntegrationDeleted:v,fieldMapping:f}),[x,n,r,o,i,S,A,N,s,a,c,w,v,f]);if(I)return l.jsx(zr,{});if(x===null)return l.jsx(Jt,{message:`Integration "${t}" not found`});if(g(ue.INSTALLATION_LIST,K)){const H=`Error retrieving installation information for integration "${(x==null?void 0:x.name)||"unknown"}"`;return l.jsx(Jt,{message:H})}return l.jsx(Ql.Provider,{value:z,children:e})}const Xl=y.createContext({connections:null,isConnectionsLoading:!0,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),Qt=()=>{const e=y.useContext(Xl);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function Yl({groupRef:e,provider:t,children:n}){const r=vt(),{setError:o,isError:i}=Ft(),{projectId:s,isLoading:a}=Te(),{integrationId:c,groupRef:f}=rt(),{provider:u}=Ly(c),{data:d,isLoading:g,isError:h,error:w}=Hl({groupRef:e||f,provider:u||t}),v=d==null?void 0:d[0],p=y.useCallback(I=>{r.setQueryData(["amp","connections"],()=>I),r.invalidateQueries({queryKey:["amp","connections"]})},[r]),x=y.useCallback(()=>{r.invalidateQueries({queryKey:["amp","connections"]})},[r]);y.useEffect(()=>{h?(o(ue.CONNECTION_LIST,s,!0),Le(w)):o(ue.CONNECTION_LIST,s,!1)},[h,o,s,w]);const m=y.useMemo(()=>({connections:d||null,isConnectionsLoading:g,selectedConnection:v||null,setConnections:p,setSelectedConnection:x}),[d,g,v,p,x]);if(g||a)return l.jsx(zr,{});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(Xl.Provider,{value:m,children:n})}function Zl(){const[e,t]=y.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}var $i=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var no={exports:{}};no.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",o=1,i=2,s=9007199254740991,a="[object Arguments]",c="[object Array]",f="[object AsyncFunction]",u="[object Boolean]",d="[object Date]",g="[object Error]",h="[object Function]",w="[object GeneratorFunction]",v="[object Map]",p="[object Number]",x="[object Null]",m="[object Object]",I="[object Promise]",_="[object Proxy]",C="[object RegExp]",S="[object Set]",R="[object String]",N="[object Symbol]",A="[object Undefined]",K="[object WeakMap]",z="[object ArrayBuffer]",H="[object DataView]",ee="[object Float32Array]",q="[object Float64Array]",ae="[object Int8Array]",X="[object Int16Array]",Y="[object Int32Array]",fe="[object Uint8Array]",Ie="[object Uint8ClampedArray]",P="[object Uint16Array]",j="[object Uint32Array]",$=/[\\^$.*+?()[\]{}|]/g,V=/^\[object .+?Constructor\]$/,L=/^(?:0|[1-9]\d*)$/,D={};D[ee]=D[q]=D[ae]=D[X]=D[Y]=D[fe]=D[Ie]=D[P]=D[j]=!0,D[a]=D[c]=D[z]=D[u]=D[H]=D[d]=D[g]=D[h]=D[v]=D[p]=D[m]=D[C]=D[S]=D[R]=D[K]=!1;var te=typeof $i=="object"&&$i&&$i.Object===Object&&$i,ne=typeof self=="object"&&self&&self.Object===Object&&self,B=te||ne||Function("return this")(),re=t&&!t.nodeType&&t,Q=re&&!0&&e&&!e.nodeType&&e,de=Q&&Q.exports===re,k=de&&te.process,we=function(){try{return k&&k.binding&&k.binding("util")}catch{}}(),J=we&&we.isTypedArray;function Se(b,E){for(var F=-1,Z=b==null?0:b.length,Re=0,pe=[];++F<Z;){var Me=b[F];E(Me,F,b)&&(pe[Re++]=Me)}return pe}function Ve(b,E){for(var F=-1,Z=E.length,Re=b.length;++F<Z;)b[Re+F]=E[F];return b}function Ye(b,E){for(var F=-1,Z=b==null?0:b.length;++F<Z;)if(E(b[F],F,b))return!0;return!1}function Ue(b,E){for(var F=-1,Z=Array(b);++F<b;)Z[F]=E(F);return Z}function be(b){return function(E){return b(E)}}function Dt(b,E){return b.has(E)}function Ze(b,E){return b==null?void 0:b[E]}function wt(b){var E=-1,F=Array(b.size);return b.forEach(function(Z,Re){F[++E]=[Re,Z]}),F}function Mt(b,E){return function(F){return b(E(F))}}function kt(b){var E=-1,F=Array(b.size);return b.forEach(function(Z){F[++E]=Z}),F}var et=Array.prototype,Ge=Function.prototype,$e=Object.prototype,Pe=B["__core-js_shared__"],jt=Ge.toString,dt=$e.hasOwnProperty,sn=function(){var b=/[^.]+$/.exec(Pe&&Pe.keys&&Pe.keys.IE_PROTO||"");return b?"Symbol(src)_1."+b:""}(),Yt=$e.toString,It=RegExp("^"+jt.call(dt).replace($,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Fe=de?B.Buffer:void 0,an=B.Symbol,bn=B.Uint8Array,cn=$e.propertyIsEnumerable,Bn=et.splice,ft=an?an.toStringTag:void 0,ln=Object.getOwnPropertySymbols,xn=Fe?Fe.isBuffer:void 0,Jn=Mt(Object.keys,Object),Cn=wr(B,"DataView"),Ae=wr(B,"Map"),it=wr(B,"Promise"),oe=wr(B,"Set"),ge=wr(B,"WeakMap"),qe=wr(Object,"create"),un=zn(Cn),W=zn(Ae),ce=zn(it),le=zn(oe),Ke=zn(ge),He=an?an.prototype:void 0,pt=He?He.valueOf:void 0;function Qe(b){var E=-1,F=b==null?0:b.length;for(this.clear();++E<F;){var Z=b[E];this.set(Z[0],Z[1])}}function tt(){this.__data__=qe?qe(null):{},this.size=0}function ht(b){var E=this.has(b)&&delete this.__data__[b];return this.size-=E?1:0,E}function Ne(b){var E=this.__data__;if(qe){var F=E[b];return F===r?void 0:F}return dt.call(E,b)?E[b]:void 0}function _n(b){var E=this.__data__;return qe?E[b]!==void 0:dt.call(E,b)}function Fo(b,E){var F=this.__data__;return this.size+=this.has(b)?0:1,F[b]=qe&&E===void 0?r:E,this}Qe.prototype.clear=tt,Qe.prototype.delete=ht,Qe.prototype.get=Ne,Qe.prototype.has=_n,Qe.prototype.set=Fo;function Lt(b){var E=-1,F=b==null?0:b.length;for(this.clear();++E<F;){var Z=b[E];this.set(Z[0],Z[1])}}function Ei(){this.__data__=[],this.size=0}function Si(b){var E=this.__data__,F=Pi(E,b);if(F<0)return!1;var Z=E.length-1;return F==Z?E.pop():Bn.call(E,F,1),--this.size,!0}function Ni(b){var E=this.__data__,F=Pi(E,b);return F<0?void 0:E[F][1]}function Ti(b){return Pi(this.__data__,b)>-1}function Ri(b,E){var F=this.__data__,Z=Pi(F,b);return Z<0?(++this.size,F.push([b,E])):F[Z][1]=E,this}Lt.prototype.clear=Ei,Lt.prototype.delete=Si,Lt.prototype.get=Ni,Lt.prototype.has=Ti,Lt.prototype.set=Ri;function ye(b){var E=-1,F=b==null?0:b.length;for(this.clear();++E<F;){var Z=b[E];this.set(Z[0],Z[1])}}function Kt(){this.size=0,this.__data__={hash:new Qe,map:new(Ae||Lt),string:new Qe}}function Xr(b){var E=Fi(this,b).delete(b);return this.size-=E?1:0,E}function Wn(b){return Fi(this,b).get(b)}function Do(b){return Fi(this,b).has(b)}function Yr(b,E){var F=Fi(this,b),Z=F.size;return F.set(b,E),this.size+=F.size==Z?0:1,this}ye.prototype.clear=Kt,ye.prototype.delete=Xr,ye.prototype.get=Wn,ye.prototype.has=Do,ye.prototype.set=Yr;function Ai(b){var E=-1,F=b==null?0:b.length;for(this.__data__=new ye;++E<F;)this.add(b[E])}function hf(b){return this.__data__.set(b,r),this}function mf(b){return this.__data__.has(b)}Ai.prototype.add=Ai.prototype.push=hf,Ai.prototype.has=mf;function On(b){var E=this.__data__=new Lt(b);this.size=E.size}function gf(){this.__data__=new Lt,this.size=0}function yf(b){var E=this.__data__,F=E.delete(b);return this.size=E.size,F}function vf(b){return this.__data__.get(b)}function wf(b){return this.__data__.has(b)}function If(b,E){var F=this.__data__;if(F instanceof Lt){var Z=F.__data__;if(!Ae||Z.length<n-1)return Z.push([b,E]),this.size=++F.size,this;F=this.__data__=new ye(Z)}return F.set(b,E),this.size=F.size,this}On.prototype.clear=gf,On.prototype.delete=yf,On.prototype.get=vf,On.prototype.has=wf,On.prototype.set=If;function bf(b,E){var F=Di(b),Z=!F&&kf(b),Re=!F&&!Z&&Mo(b),pe=!F&&!Z&&!Re&&ja(b),Me=F||Z||Re||pe,Xe=Me?Ue(b.length,String):[],nt=Xe.length;for(var De in b)dt.call(b,De)&&!(Me&&(De=="length"||Re&&(De=="offset"||De=="parent")||pe&&(De=="buffer"||De=="byteLength"||De=="byteOffset")||Af(De,nt)))&&Xe.push(De);return Xe}function Pi(b,E){for(var F=b.length;F--;)if(Fa(b[F][0],E))return F;return-1}function xf(b,E,F){var Z=E(b);return Di(b)?Z:Ve(Z,F(b))}function Zr(b){return b==null?b===void 0?A:x:ft&&ft in Object(b)?Tf(b):Mf(b)}function Ta(b){return ei(b)&&Zr(b)==a}function Ra(b,E,F,Z,Re){return b===E?!0:b==null||E==null||!ei(b)&&!ei(E)?b!==b&&E!==E:Cf(b,E,F,Z,Ra,Re)}function Cf(b,E,F,Z,Re,pe){var Me=Di(b),Xe=Di(E),nt=Me?c:En(b),De=Xe?c:En(E);nt=nt==a?m:nt,De=De==a?m:De;var bt=nt==m,Vt=De==m,ot=nt==De;if(ot&&Mo(b)){if(!Mo(E))return!1;Me=!0,bt=!1}if(ot&&!bt)return pe||(pe=new On),Me||ja(b)?Aa(b,E,F,Z,Re,pe):Sf(b,E,nt,F,Z,Re,pe);if(!(F&o)){var St=bt&&dt.call(b,"__wrapped__"),Nt=Vt&&dt.call(E,"__wrapped__");if(St||Nt){var Sn=St?b.value():b,dn=Nt?E.value():E;return pe||(pe=new On),Re(Sn,dn,F,Z,pe)}}return ot?(pe||(pe=new On),Nf(b,E,F,Z,Re,pe)):!1}function _f(b){if(!ka(b)||Ff(b))return!1;var E=Da(b)?It:V;return E.test(zn(b))}function Of(b){return ei(b)&&Ma(b.length)&&!!D[Zr(b)]}function Ef(b){if(!Df(b))return Jn(b);var E=[];for(var F in Object(b))dt.call(b,F)&&F!="constructor"&&E.push(F);return E}function Aa(b,E,F,Z,Re,pe){var Me=F&o,Xe=b.length,nt=E.length;if(Xe!=nt&&!(Me&&nt>Xe))return!1;var De=pe.get(b);if(De&&pe.get(E))return De==E;var bt=-1,Vt=!0,ot=F&i?new Ai:void 0;for(pe.set(b,E),pe.set(E,b);++bt<Xe;){var St=b[bt],Nt=E[bt];if(Z)var Sn=Me?Z(Nt,St,bt,E,b,pe):Z(St,Nt,bt,b,E,pe);if(Sn!==void 0){if(Sn)continue;Vt=!1;break}if(ot){if(!Ye(E,function(dn,Gn){if(!Dt(ot,Gn)&&(St===dn||Re(St,dn,F,Z,pe)))return ot.push(Gn)})){Vt=!1;break}}else if(!(St===Nt||Re(St,Nt,F,Z,pe))){Vt=!1;break}}return pe.delete(b),pe.delete(E),Vt}function Sf(b,E,F,Z,Re,pe,Me){switch(F){case H:if(b.byteLength!=E.byteLength||b.byteOffset!=E.byteOffset)return!1;b=b.buffer,E=E.buffer;case z:return!(b.byteLength!=E.byteLength||!pe(new bn(b),new bn(E)));case u:case d:case p:return Fa(+b,+E);case g:return b.name==E.name&&b.message==E.message;case C:case R:return b==E+"";case v:var Xe=wt;case S:var nt=Z&o;if(Xe||(Xe=kt),b.size!=E.size&&!nt)return!1;var De=Me.get(b);if(De)return De==E;Z|=i,Me.set(b,E);var bt=Aa(Xe(b),Xe(E),Z,Re,pe,Me);return Me.delete(b),bt;case N:if(pt)return pt.call(b)==pt.call(E)}return!1}function Nf(b,E,F,Z,Re,pe){var Me=F&o,Xe=Pa(b),nt=Xe.length,De=Pa(E),bt=De.length;if(nt!=bt&&!Me)return!1;for(var Vt=nt;Vt--;){var ot=Xe[Vt];if(!(Me?ot in E:dt.call(E,ot)))return!1}var St=pe.get(b);if(St&&pe.get(E))return St==E;var Nt=!0;pe.set(b,E),pe.set(E,b);for(var Sn=Me;++Vt<nt;){ot=Xe[Vt];var dn=b[ot],Gn=E[ot];if(Z)var La=Me?Z(Gn,dn,ot,E,b,pe):Z(dn,Gn,ot,b,E,pe);if(!(La===void 0?dn===Gn||Re(dn,Gn,F,Z,pe):La)){Nt=!1;break}Sn||(Sn=ot=="constructor")}if(Nt&&!Sn){var Mi=b.constructor,ki=E.constructor;Mi!=ki&&"constructor"in b&&"constructor"in E&&!(typeof Mi=="function"&&Mi instanceof Mi&&typeof ki=="function"&&ki instanceof ki)&&(Nt=!1)}return pe.delete(b),pe.delete(E),Nt}function Pa(b){return xf(b,Kf,Rf)}function Fi(b,E){var F=b.__data__;return Pf(E)?F[typeof E=="string"?"string":"hash"]:F.map}function wr(b,E){var F=Ze(b,E);return _f(F)?F:void 0}function Tf(b){var E=dt.call(b,ft),F=b[ft];try{b[ft]=void 0;var Z=!0}catch{}var Re=Yt.call(b);return Z&&(E?b[ft]=F:delete b[ft]),Re}var Rf=ln?function(b){return b==null?[]:(b=Object(b),Se(ln(b),function(E){return cn.call(b,E)}))}:Vf,En=Zr;(Cn&&En(new Cn(new ArrayBuffer(1)))!=H||Ae&&En(new Ae)!=v||it&&En(it.resolve())!=I||oe&&En(new oe)!=S||ge&&En(new ge)!=K)&&(En=function(b){var E=Zr(b),F=E==m?b.constructor:void 0,Z=F?zn(F):"";if(Z)switch(Z){case un:return H;case W:return v;case ce:return I;case le:return S;case Ke:return K}return E});function Af(b,E){return E=E??s,!!E&&(typeof b=="number"||L.test(b))&&b>-1&&b%1==0&&b<E}function Pf(b){var E=typeof b;return E=="string"||E=="number"||E=="symbol"||E=="boolean"?b!=="__proto__":b===null}function Ff(b){return!!sn&&sn in b}function Df(b){var E=b&&b.constructor,F=typeof E=="function"&&E.prototype||$e;return b===F}function Mf(b){return Yt.call(b)}function zn(b){if(b!=null){try{return jt.call(b)}catch{}try{return b+""}catch{}}return""}function Fa(b,E){return b===E||b!==b&&E!==E}var kf=Ta(function(){return arguments}())?Ta:function(b){return ei(b)&&dt.call(b,"callee")&&!cn.call(b,"callee")},Di=Array.isArray;function jf(b){return b!=null&&Ma(b.length)&&!Da(b)}var Mo=xn||Uf;function Lf(b,E){return Ra(b,E)}function Da(b){if(!ka(b))return!1;var E=Zr(b);return E==h||E==w||E==f||E==_}function Ma(b){return typeof b=="number"&&b>-1&&b%1==0&&b<=s}function ka(b){var E=typeof b;return b!=null&&(E=="object"||E=="function")}function ei(b){return b!=null&&typeof b=="object"}var ja=J?be(J):Of;function Kf(b){return jf(b)?bf(b):Ef(b)}function Vf(){return[]}function Uf(){return!1}e.exports=Lf})(no,no.exports);var nv=no.exports;const eu=Bs(nv),dr="other",ro="manage-tab";function $n(e){return!e.fieldName}function rv(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function iv(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!$n(n)&&!!n.fieldName))||null}function ov(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>$n(r)&&!!r.mapToName))||[]}function sv(e){var n;return((n=e==null?void 0:e.optionalFields)==null?void 0:n.filter(r=>$n(r)&&!!r.mapToName))||[]}function av(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!$n(n)&&!!n.fieldName))||null}const tu=(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 cv(e){return $n(e)?e.mapToName:e.fieldName}const nu=(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)&&Un(s==null?void 0:s.objectName),completed:e?!!tu(e,s.objectName):!1})}),n},ru=e=>{var n;return{name:dr,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function lv(e,t){var i;const n=nu(e,t),o=!!((i=t==null?void 0:t.content)!=null&&i.write)?ru(e):void 0;return o&&n.push(o),n}function iu(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 uv(e,t){return eu(e,t)}function ou(e,t){return eu(e,t)}const dv=(e,t,n)=>{var p,x,m,I,_,C,S,R,N;if(!e)return null;const r=rv(e,t),o=r&&iv(r),i=r&&av(r),s=r&&ov(r),a=r&&sv(r),c=(r==null?void 0:r.allFields)||[],f=(r==null?void 0:r.allFieldsMetadata)||{},u=n==null?void 0:n.content,d=((m=(x=(p=u==null?void 0:u.read)==null?void 0:p.objects)==null?void 0:x[t])==null?void 0:m.selectedFields)||{},g=((C=(_=(I=u==null?void 0:u.read)==null?void 0:I.objects)==null?void 0:_[t])==null?void 0:C.selectedValueMappings)||{},h=((N=(R=(S=u==null?void 0:u.read)==null?void 0:S.objects)==null?void 0:R[t])==null?void 0:N.selectedFieldMappings)||{},w={...d},v={...h};return{allFields:c,allFieldsMetadata:f,requiredFields:o,optionalFields:i,requiredMapFields:s,optionalMapFields:a,selectedOptionalFields:d,selectedFieldMappings:h,selectedValueMappings:g,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,isValueMappingsModified:!1,savedConfig:{optionalFields:w,requiredMapFields:v,selectedValueMappings:g}}},fv=(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 su(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:dv(r,t,n),write:fv(o,n)}}const au=(e,t,n,r)=>{const o=su(e,n,t);r(n,o)},pv=(e,t,n)=>{const r=lv(t,e),o={};r.forEach(({name:i,completed:s})=>{s&&(o[i]=su(e,i,t))}),n(o)},cu=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(i=>r.add(cv(i))),{...Array.from(r).reduce((i,s)=>({...i,[s]:!0}),{}),...n||{}}},lu=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},uu=e=>{const{selectedValueMappings:t}=(e==null?void 0:e.read)||{};return t};function du(e,t){return t[e]||void 0}async function fu({createConfig:e,projectId:t,integrationId:n,groupRef:r,connectionId:o,apiKey:i,setError:s,setInstallation:a,onInstallSuccess:c}){const f={projectIdOrName:t,integrationId:n,installation:{groupRef:r,connectionId:o,config:e}};try{const u=await $s().installationApi.createInstallation(f,{headers:{"X-Api-Key":i,"Content-Type":"application/json"}});a(u),c==null||c(u.id,u.config)}catch(u){Le(u,s)}}function wi(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const hv=(e,t)=>{const n=e.content.read,r=n==null?void 0:n.objects;return r==null?void 0:r.find(o=>o.objectName===t)},mv=(e,t,n,r)=>{const o=cu(e),i=lu(e),s=uu(e),a=hv(n,t);if(!a)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const c={revisionId:n.id,createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,schedule:a.schedule,destination:a.destination,selectedFields:o,selectedFieldMappings:i,selectedValueMappings:s||{},backfill:a.backfill}}}}};return wi(n)&&(c.content.proxy={enabled:!0}),c},gv=(e,t,n,r,o,i,s,a,c,f,u,d)=>{const g=mv(c,i,a,r);return g?fu({createConfig:g,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:s,setError:f,setInstallation:u,onInstallSuccess:d}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},pu=e=>{var t;return{...(t=e.write)==null?void 0:t.selectedWriteObjects}},yv=e=>{const t=e.content.write;return t==null?void 0:t.objects},vv=(e,t,n)=>{if(!yv(t))return console.error("Error when getting write objects from hydratedRevision"),null;const o=pu(e),i={revisionId:t.id,createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:o}}};return wi(t)&&(i.content.proxy={enabled:!0}),i},wv=(e,t,n,r,o,i,s,a,c,f,u)=>{const d=vv(a,s,r);return d?fu({createConfig:d,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:i,setError:c,setInstallation:f,onInstallSuccess:u}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))};var hu={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})()})(hu);var Iv=hu.exports;const Pt=Bs(Iv),bv="_button_kwfiu_1",xv="_buttonError_kwfiu_28",Cv="_danger_kwfiu_42",_v="_ghost_kwfiu_47",Vo={button:bv,buttonError:xv,danger:Cv,ghost:_v};function ze({className:e,style:t,type:n,children:r,variant:o,...i}){const s=Pt(Vo.button,{[Vo.danger]:o==="danger",[Vo.ghost]:o==="ghost",[e||""]:!!e});return l.jsx("button",{type:n,className:s,style:t,...i,children:r})}const Ov={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 Ii({children:e,style:t}){return l.jsx(vn,{style:{...Ov,...t},children:e})}const Ev=()=>{const e=ut(),t=vt();return Jr({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 mu({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:o,onDisconnectError:i}){const{projectId:s}=Te(),{selectedConnection:a}=Qt(),c=Ev(),[f,u]=y.useState(!1),d=!s||!a||!a.id||f,g=async()=>{d||(u(!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:v=>{Le(v,i)},onSettled:()=>u(!1)}))},h=f?"Disconnecting...":e;return l.jsx(ze,{type:"button",onClick:g,disabled:d,variant:t,style:n,children:h})}const gu=y.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),Gr=()=>{const e=y.useContext(gu);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e},Sv=()=>{var f;const e=vt(),t=ut(),{selectedConnection:n,isConnectionsLoading:r}=Qt(),{projectIdOrName:o}=Te(),{integrationId:i,integrationObj:s}=rt(),a=n==null?void 0:n.id,c=(f=s==null?void 0:s.latestRevision)==null?void 0:f.id;return y.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 Nv({children:e,resetComponent:t}){const{integrationId:n,integrationObj:r}=rt(),{isError:o,removeError:i,setError:s}=Ft(),a=(r==null?void 0:r.name)||n,[c,f]=y.useState(null),[u,d]=y.useState(null),{data:g,isLoading:h,isError:w,error:v}=Sv();y.useEffect(()=>{w?(s(ue.HYDRATED_REVISION,a),Le(v,f)):(i(ue.HYDRATED_REVISION,a),f(null),d(null))},[w,a,s,i,v,f]);const p=y.useMemo(()=>{var m,I,_;return{hydratedRevision:g||null,loading:h,readAction:(m=g==null?void 0:g.content)==null?void 0:m.read,writeObjects:((_=(I=g==null?void 0:g.content)==null?void 0:I.write)==null?void 0:_.objects)||[]}},[g,h]);if(h)return l.jsx(zr,{});const x=(r==null?void 0:r.provider)||"provider";if(o(ue.HYDRATED_REVISION,a)){const m=(r==null?void 0:r.name)||n||"unknown integration",I=`${c?`: ${c}`:`Error retrieving objects from ${x} or integration details for ${m}`}`;return l.jsx(Jt,{message:I,children:l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",paddingTop:"1rem"},children:[u&&l.jsx(Bl,{message:u}),l.jsx(mu,{buttonText:"Try again",resetComponent:t,buttonVariant:"danger",onDisconnectError:_=>d(_)})]})})}return l.jsx(gu.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 me(){return me=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},me.apply(null,arguments)}function vs(e,t){return vs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},vs(e,t)}function Tv(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,vs(e,t)}var ws={exports:{}},qi={exports:{}},xe={};/** @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 rc;function Rv(){if(rc)return xe;rc=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,f=e?Symbol.for("react.concurrent_mode"):60111,u=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,g=e?Symbol.for("react.suspense_list"):60120,h=e?Symbol.for("react.memo"):60115,w=e?Symbol.for("react.lazy"):60116,v=e?Symbol.for("react.block"):60121,p=e?Symbol.for("react.fundamental"):60117,x=e?Symbol.for("react.responder"):60118,m=e?Symbol.for("react.scope"):60119;function I(C){if(typeof C=="object"&&C!==null){var S=C.$$typeof;switch(S){case t:switch(C=C.type,C){case c:case f:case r:case i:case o:case d:return C;default:switch(C=C&&C.$$typeof,C){case a:case u:case w:case h:case s:return C;default:return S}}case n:return S}}}function _(C){return I(C)===f}return xe.AsyncMode=c,xe.ConcurrentMode=f,xe.ContextConsumer=a,xe.ContextProvider=s,xe.Element=t,xe.ForwardRef=u,xe.Fragment=r,xe.Lazy=w,xe.Memo=h,xe.Portal=n,xe.Profiler=i,xe.StrictMode=o,xe.Suspense=d,xe.isAsyncMode=function(C){return _(C)||I(C)===c},xe.isConcurrentMode=_,xe.isContextConsumer=function(C){return I(C)===a},xe.isContextProvider=function(C){return I(C)===s},xe.isElement=function(C){return typeof C=="object"&&C!==null&&C.$$typeof===t},xe.isForwardRef=function(C){return I(C)===u},xe.isFragment=function(C){return I(C)===r},xe.isLazy=function(C){return I(C)===w},xe.isMemo=function(C){return I(C)===h},xe.isPortal=function(C){return I(C)===n},xe.isProfiler=function(C){return I(C)===i},xe.isStrictMode=function(C){return I(C)===o},xe.isSuspense=function(C){return I(C)===d},xe.isValidElementType=function(C){return typeof C=="string"||typeof C=="function"||C===r||C===f||C===i||C===o||C===d||C===g||typeof C=="object"&&C!==null&&(C.$$typeof===w||C.$$typeof===h||C.$$typeof===s||C.$$typeof===a||C.$$typeof===u||C.$$typeof===p||C.$$typeof===x||C.$$typeof===m||C.$$typeof===v)},xe.typeOf=I,xe}var Ce={};/** @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 ic;function Av(){return ic||(ic=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,f=e?Symbol.for("react.concurrent_mode"):60111,u=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,g=e?Symbol.for("react.suspense_list"):60120,h=e?Symbol.for("react.memo"):60115,w=e?Symbol.for("react.lazy"):60116,v=e?Symbol.for("react.block"):60121,p=e?Symbol.for("react.fundamental"):60117,x=e?Symbol.for("react.responder"):60118,m=e?Symbol.for("react.scope"):60119;function I(k){return typeof k=="string"||typeof k=="function"||k===r||k===f||k===i||k===o||k===d||k===g||typeof k=="object"&&k!==null&&(k.$$typeof===w||k.$$typeof===h||k.$$typeof===s||k.$$typeof===a||k.$$typeof===u||k.$$typeof===p||k.$$typeof===x||k.$$typeof===m||k.$$typeof===v)}function _(k){if(typeof k=="object"&&k!==null){var we=k.$$typeof;switch(we){case t:var J=k.type;switch(J){case c:case f:case r:case i:case o:case d:return J;default:var Se=J&&J.$$typeof;switch(Se){case a:case u:case w:case h:case s:return Se;default:return we}}case n:return we}}}var C=c,S=f,R=a,N=s,A=t,K=u,z=r,H=w,ee=h,q=n,ae=i,X=o,Y=d,fe=!1;function Ie(k){return fe||(fe=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),P(k)||_(k)===c}function P(k){return _(k)===f}function j(k){return _(k)===a}function $(k){return _(k)===s}function V(k){return typeof k=="object"&&k!==null&&k.$$typeof===t}function L(k){return _(k)===u}function D(k){return _(k)===r}function te(k){return _(k)===w}function ne(k){return _(k)===h}function B(k){return _(k)===n}function re(k){return _(k)===i}function Q(k){return _(k)===o}function de(k){return _(k)===d}Ce.AsyncMode=C,Ce.ConcurrentMode=S,Ce.ContextConsumer=R,Ce.ContextProvider=N,Ce.Element=A,Ce.ForwardRef=K,Ce.Fragment=z,Ce.Lazy=H,Ce.Memo=ee,Ce.Portal=q,Ce.Profiler=ae,Ce.StrictMode=X,Ce.Suspense=Y,Ce.isAsyncMode=Ie,Ce.isConcurrentMode=P,Ce.isContextConsumer=j,Ce.isContextProvider=$,Ce.isElement=V,Ce.isForwardRef=L,Ce.isFragment=D,Ce.isLazy=te,Ce.isMemo=ne,Ce.isPortal=B,Ce.isProfiler=re,Ce.isStrictMode=Q,Ce.isSuspense=de,Ce.isValidElementType=I,Ce.typeOf=_}()),Ce}var oc;function yu(){return oc||(oc=1,process.env.NODE_ENV==="production"?qi.exports=Rv():qi.exports=Av()),qi.exports}/*
|
|
25
25
|
object-assign
|
|
26
26
|
(c) Sindre Sorhus
|
|
27
27
|
@license MIT
|
|
28
|
-
*/var
|
|
29
|
-
Valid keys: `+JSON.stringify(Object.keys(
|
|
28
|
+
*/var Uo,sc;function Pv(){if(sc)return Uo;sc=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function o(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var s={},a=0;a<10;a++)s["_"+String.fromCharCode(a)]=a;var c=Object.getOwnPropertyNames(s).map(function(u){return s[u]});if(c.join("")!=="0123456789")return!1;var f={};return"abcdefghijklmnopqrst".split("").forEach(function(u){f[u]=u}),Object.keys(Object.assign({},f)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Uo=o()?Object.assign:function(i,s){for(var a,c=r(i),f,u=1;u<arguments.length;u++){a=Object(arguments[u]);for(var d in a)t.call(a,d)&&(c[d]=a[d]);if(e){f=e(a);for(var g=0;g<f.length;g++)n.call(a,f[g])&&(c[f[g]]=a[f[g]])}}return c},Uo}var $o,ac;function Js(){if(ac)return $o;ac=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return $o=e,$o}var qo,cc;function vu(){return cc||(cc=1,qo=Function.call.bind(Object.prototype.hasOwnProperty)),qo}var Ho,lc;function Fv(){if(lc)return Ho;lc=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Js(),n={},r=vu();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,f){if(process.env.NODE_ENV!=="production"){for(var u in i)if(r(i,u)){var d;try{if(typeof i[u]!="function"){var g=Error((c||"React class")+": "+a+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw g.name="Invariant Violation",g}d=i[u](s,u,c,a,null,t)}catch(w){d=w}if(d&&!(d instanceof Error)&&e((c||"React class")+": type specification of "+a+" `"+u+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof d+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),d instanceof Error&&!(d.message in n)){n[d.message]=!0;var h=f?f():"";e("Failed "+a+" type: "+d.message+(h??""))}}}}return o.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Ho=o,Ho}var Bo,uc;function Dv(){if(uc)return Bo;uc=1;var e=yu(),t=Pv(),n=Js(),r=vu(),o=Fv(),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 Bo=function(a,c){var f=typeof Symbol=="function"&&Symbol.iterator,u="@@iterator";function d(P){var j=P&&(f&&P[f]||P[u]);if(typeof j=="function")return j}var g="<<anonymous>>",h={array:x("array"),bigint:x("bigint"),bool:x("boolean"),func:x("function"),number:x("number"),object:x("object"),string:x("string"),symbol:x("symbol"),any:m(),arrayOf:I,element:_(),elementType:C(),instanceOf:S,node:K(),objectOf:N,oneOf:R,oneOfType:A,shape:H,exact:ee};function w(P,j){return P===j?P!==0||1/P===1/j:P!==P&&j!==j}function v(P,j){this.message=P,this.data=j&&typeof j=="object"?j:{},this.stack=""}v.prototype=Error.prototype;function p(P){if(process.env.NODE_ENV!=="production")var j={},$=0;function V(D,te,ne,B,re,Q,de){if(B=B||g,Q=Q||ne,de!==n){if(c){var k=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw k.name="Invariant Violation",k}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var we=B+":"+ne;!j[we]&&$<3&&(i("You are manually calling a React.PropTypes validation function for the `"+Q+"` prop on `"+B+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),j[we]=!0,$++)}}return te[ne]==null?D?te[ne]===null?new v("The "+re+" `"+Q+"` is marked as required "+("in `"+B+"`, but its value is `null`.")):new v("The "+re+" `"+Q+"` is marked as required in "+("`"+B+"`, but its value is `undefined`.")):null:P(te,ne,B,re,Q)}var L=V.bind(null,!1);return L.isRequired=V.bind(null,!0),L}function x(P){function j($,V,L,D,te,ne){var B=$[V],re=X(B);if(re!==P){var Q=Y(B);return new v("Invalid "+D+" `"+te+"` of type "+("`"+Q+"` supplied to `"+L+"`, expected ")+("`"+P+"`."),{expectedType:P})}return null}return p(j)}function m(){return p(s)}function I(P){function j($,V,L,D,te){if(typeof P!="function")return new v("Property `"+te+"` of component `"+L+"` has invalid PropType notation inside arrayOf.");var ne=$[V];if(!Array.isArray(ne)){var B=X(ne);return new v("Invalid "+D+" `"+te+"` of type "+("`"+B+"` supplied to `"+L+"`, expected an array."))}for(var re=0;re<ne.length;re++){var Q=P(ne,re,L,D,te+"["+re+"]",n);if(Q instanceof Error)return Q}return null}return p(j)}function _(){function P(j,$,V,L,D){var te=j[$];if(!a(te)){var ne=X(te);return new v("Invalid "+L+" `"+D+"` of type "+("`"+ne+"` supplied to `"+V+"`, expected a single ReactElement."))}return null}return p(P)}function C(){function P(j,$,V,L,D){var te=j[$];if(!e.isValidElementType(te)){var ne=X(te);return new v("Invalid "+L+" `"+D+"` of type "+("`"+ne+"` supplied to `"+V+"`, expected a single ReactElement type."))}return null}return p(P)}function S(P){function j($,V,L,D,te){if(!($[V]instanceof P)){var ne=P.name||g,B=Ie($[V]);return new v("Invalid "+D+" `"+te+"` of type "+("`"+B+"` supplied to `"+L+"`, expected ")+("instance of `"+ne+"`."))}return null}return p(j)}function R(P){if(!Array.isArray(P))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):i("Invalid argument supplied to oneOf, expected an array.")),s;function j($,V,L,D,te){for(var ne=$[V],B=0;B<P.length;B++)if(w(ne,P[B]))return null;var re=JSON.stringify(P,function(de,k){var we=Y(k);return we==="symbol"?String(k):k});return new v("Invalid "+D+" `"+te+"` of value `"+String(ne)+"` "+("supplied to `"+L+"`, expected one of "+re+"."))}return p(j)}function N(P){function j($,V,L,D,te){if(typeof P!="function")return new v("Property `"+te+"` of component `"+L+"` has invalid PropType notation inside objectOf.");var ne=$[V],B=X(ne);if(B!=="object")return new v("Invalid "+D+" `"+te+"` of type "+("`"+B+"` supplied to `"+L+"`, expected an object."));for(var re in ne)if(r(ne,re)){var Q=P(ne,re,L,D,te+"."+re,n);if(Q instanceof Error)return Q}return null}return p(j)}function A(P){if(!Array.isArray(P))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var j=0;j<P.length;j++){var $=P[j];if(typeof $!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+fe($)+" at index "+j+"."),s}function V(L,D,te,ne,B){for(var re=[],Q=0;Q<P.length;Q++){var de=P[Q],k=de(L,D,te,ne,B,n);if(k==null)return null;k.data&&r(k.data,"expectedType")&&re.push(k.data.expectedType)}var we=re.length>0?", expected one of type ["+re.join(", ")+"]":"";return new v("Invalid "+ne+" `"+B+"` supplied to "+("`"+te+"`"+we+"."))}return p(V)}function K(){function P(j,$,V,L,D){return q(j[$])?null:new v("Invalid "+L+" `"+D+"` supplied to "+("`"+V+"`, expected a ReactNode."))}return p(P)}function z(P,j,$,V,L){return new v((P||"React class")+": "+j+" type `"+$+"."+V+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+L+"`.")}function H(P){function j($,V,L,D,te){var ne=$[V],B=X(ne);if(B!=="object")return new v("Invalid "+D+" `"+te+"` of type `"+B+"` "+("supplied to `"+L+"`, expected `object`."));for(var re in P){var Q=P[re];if(typeof Q!="function")return z(L,D,te,re,Y(Q));var de=Q(ne,re,L,D,te+"."+re,n);if(de)return de}return null}return p(j)}function ee(P){function j($,V,L,D,te){var ne=$[V],B=X(ne);if(B!=="object")return new v("Invalid "+D+" `"+te+"` of type `"+B+"` "+("supplied to `"+L+"`, expected `object`."));var re=t({},$[V],P);for(var Q in re){var de=P[Q];if(r(P,Q)&&typeof de!="function")return z(L,D,te,Q,Y(de));if(!de)return new v("Invalid "+D+" `"+te+"` key `"+Q+"` supplied to `"+L+"`.\nBad object: "+JSON.stringify($[V],null," ")+`
|
|
29
|
+
Valid keys: `+JSON.stringify(Object.keys(P),null," "));var k=de(ne,Q,L,D,te+"."+Q,n);if(k)return k}return null}return p(j)}function q(P){switch(typeof P){case"number":case"string":case"undefined":return!0;case"boolean":return!P;case"object":if(Array.isArray(P))return P.every(q);if(P===null||a(P))return!0;var j=d(P);if(j){var $=j.call(P),V;if(j!==P.entries){for(;!(V=$.next()).done;)if(!q(V.value))return!1}else for(;!(V=$.next()).done;){var L=V.value;if(L&&!q(L[1]))return!1}}else return!1;return!0;default:return!1}}function ae(P,j){return P==="symbol"?!0:j?j["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&j instanceof Symbol:!1}function X(P){var j=typeof P;return Array.isArray(P)?"array":P instanceof RegExp?"object":ae(j,P)?"symbol":j}function Y(P){if(typeof P>"u"||P===null)return""+P;var j=X(P);if(j==="object"){if(P instanceof Date)return"date";if(P instanceof RegExp)return"regexp"}return j}function fe(P){var j=Y(P);switch(j){case"array":case"object":return"an "+j;case"boolean":case"date":case"regexp":return"a "+j;default:return j}}function Ie(P){return!P.constructor||!P.constructor.name?g:P.constructor.name}return h.checkPropTypes=o,h.resetWarningCache=o.resetWarningCache,h.PropTypes=h,h},Bo}var Jo,dc;function Mv(){if(dc)return Jo;dc=1;var e=Js();function t(){}function n(){}return n.resetWarningCache=t,Jo=function(){function r(s,a,c,f,u,d){if(d!==e){var g=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 g.name="Invariant Violation",g}}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},Jo}if(process.env.NODE_ENV!=="production"){var kv=yu(),jv=!0;ws.exports=Dv()(kv.isElement,jv)}else ws.exports=Mv()();var Lv=ws.exports;const U=Bs(Lv);var Is={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 fc;function Kv(){if(fc)return _e;fc=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"),f=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),w;w=Symbol.for("react.module.reference");function v(p){if(typeof p=="object"&&p!==null){var x=p.$$typeof;switch(x){case e:switch(p=p.type,p){case n:case o:case r:case f:case u:return p;default:switch(p=p&&p.$$typeof,p){case a:case s:case c:case g:case d:case i:return p;default:return x}}case t:return x}}}return _e.ContextConsumer=s,_e.ContextProvider=i,_e.Element=e,_e.ForwardRef=c,_e.Fragment=n,_e.Lazy=g,_e.Memo=d,_e.Portal=t,_e.Profiler=o,_e.StrictMode=r,_e.Suspense=f,_e.SuspenseList=u,_e.isAsyncMode=function(){return!1},_e.isConcurrentMode=function(){return!1},_e.isContextConsumer=function(p){return v(p)===s},_e.isContextProvider=function(p){return v(p)===i},_e.isElement=function(p){return typeof p=="object"&&p!==null&&p.$$typeof===e},_e.isForwardRef=function(p){return v(p)===c},_e.isFragment=function(p){return v(p)===n},_e.isLazy=function(p){return v(p)===g},_e.isMemo=function(p){return v(p)===d},_e.isPortal=function(p){return v(p)===t},_e.isProfiler=function(p){return v(p)===o},_e.isStrictMode=function(p){return v(p)===r},_e.isSuspense=function(p){return v(p)===f},_e.isSuspenseList=function(p){return v(p)===u},_e.isValidElementType=function(p){return typeof p=="string"||typeof p=="function"||p===n||p===o||p===r||p===f||p===u||p===h||typeof p=="object"&&p!==null&&(p.$$typeof===g||p.$$typeof===d||p.$$typeof===i||p.$$typeof===s||p.$$typeof===c||p.$$typeof===w||p.getModuleId!==void 0)},_e.typeOf=v,_e}var Oe={};/**
|
|
38
38
|
* @license React
|
|
39
39
|
* react-is.development.js
|
|
40
40
|
*
|
|
@@ -42,10 +42,11 @@ 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 cc;function kv(){return cc||(cc=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"),x=!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||x||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 Se=H.$$typeof;switch(Se){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 Se}}case t:return Se}}}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,Ie=!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 Ie||(Ie=!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 we(H){return C(H)===d}Oe.ContextConsumer=S,Oe.ContextProvider=T,Oe.Element=R,Oe.ForwardRef=F,Oe.Fragment=U,Oe.Lazy=Q,Oe.Memo=J,Oe.Portal=Y,Oe.Profiler=B,Oe.StrictMode=ce,Oe.Suspense=se,Oe.SuspenseList=ne,Oe.isAsyncMode=A,Oe.isConcurrentMode=j,Oe.isContextConsumer=$,Oe.isContextProvider=K,Oe.isElement=L,Oe.isForwardRef=D,Oe.isFragment=Z,Oe.isLazy=ee,Oe.isMemo=q,Oe.isPortal=te,Oe.isProfiler=G,Oe.isStrictMode=de,Oe.isSuspense=M,Oe.isSuspenseList=we,Oe.isValidElementType=I,Oe.typeOf=C}()),Oe}process.env.NODE_ENV==="production"?ys.exports=Mv():ys.exports=kv();var lc=ys.exports;const uc=e=>typeof e=="object"&&e!=null&&e.nodeType===1,dc=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Ho=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return dc(n.overflowY,t)||dc(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},$i=(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,jv=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Lv=(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(!uc(e))throw new TypeError("Invalid target");const h=document.scrollingElement||document.documentElement,m=[];let x=e;for(;uc(x)&&f(x);){if(x=jv(x),x===h){m.push(x);break}x!=null&&x===document.body&&Ho(x)&&!Ho(document.documentElement)||x!=null&&Ho(x,d)&&m.push(x)}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:Ie,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,we="offsetWidth"in ne?ne.offsetWidth===0?0:Ie/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"?$i(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:$i(_,_+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"?$i(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+Ie/2)+de/2:c==="end"?B-j+ee+de:$i(K,j,Ie,D,ee+de,B,B+I,I);const{scrollLeft:Se,scrollTop:Ve}=ne;te=H===0?0:Math.max(0,Math.min(Ve+te/H,ne.scrollHeight-ge/H+M)),G=we===0?0:Math.max(0,Math.min(Se+G/we,ne.scrollWidth-Ie/we+de)),Y+=Ve-te,B+=Se-G}ce.push({el:ne,top:te,left:G})}return ce};var kr=function(){return kr=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},kr.apply(this,arguments)};var Kv=0;function fc(e){return typeof e=="function"?e:xt}function xt(){}function pu(e,t){if(e){var n=Lv(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 pc(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function Bs(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 hu(){return String(Kv++)}function Vv(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 hc(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function mu(e){return typeof e.type=="string"}function gu(e){return e.props}function Uv(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var $v=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function qi(e){e===void 0&&(e={});var t={};return $v.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function no(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,r){return n[r]=ro(t,r)?t[r]:e[r],n},{})}function ro(e,t){return e[t]!==void 0}function vs(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function qv(e){return Object.prototype.toString.call(e)==="[object Object]"}function Xn(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=jr(a,t<0,n,r,o);return c===-1?e>=i?-1:e:c}function jr(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?jr(t?i-1:0,t,n,r):-1}function io(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(o){return o&&(pc(o,e,n)||r&&pc(o,n.document.activeElement,n))})}var Js=xt;process.env.NODE_ENV!=="production"&&(Js=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 Hv=Bs(function(e){yu(e).textContent=""},500);function yu(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 vu(e,t){if(!(!e||!t)){var n=yu(t);n.textContent=e,Hv(t)}}function Bv(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var wu=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,Iu=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,bu=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,zi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,Gi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,xu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,_u=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,Cu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,Ou=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,Eu=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,Su=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,Nu=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,Tu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,ws=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,Ru=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,Au=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,Pu=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,Jv=Object.freeze({__proto__:null,blurButton:Ru,blurInput:Su,changeInput:Nu,clickButton:ws,clickItem:Eu,controlledPropUpdatedSelectedItem:Au,itemMouseEnter:bu,keyDownArrowDown:Gi,keyDownArrowUp:zi,keyDownEnd:Ou,keyDownEnter:_u,keyDownEscape:xu,keyDownHome:Cu,keyDownSpaceButton:Tu,mouseUp:Iu,touchEnd:Pu,unknown:wu}),Wv=["refKey","ref"],zv=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],Gv=["onKeyDown","onBlur","onChange","onInput","onChangeText"],Qv=["refKey","ref"],Xv=["onMouseMove","onMouseDown","onClick","onPress","index","item"],Yv=function(){var e=function(t){function n(o){var i;i=t.call(this,o)||this,i.id=i.props.id||"downshift-"+hu(),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=qi(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=qi(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=wu),Object.keys(U).forEach(function(J){R[J]!==U[J]&&(S[J]=U[J]),J!=="type"&&(U[J],ro(i.props,J)||(Q[J]=U[J]))}),T&&U.hasOwnProperty("inputValue")&&i.props.onInputValueChange(U.inputValue,he({},i.getStateAndHelpers(),U)),Q},function(){fc(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,Wv),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]=Ir(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:Gi})}else this.internalSetState({isOpen:!0,type:Gi},function(){var S=I.getItemCount();if(S>0){var T=I.getState(),R=T.highlightedIndex,F=Xn(R,1,{length:S},I.isItemDisabled,!0);I.setHighlightedIndex(F,{type:Gi})}})},ArrowUp:function(y){var I=this;if(y.preventDefault(),this.getState().isOpen){var C=y.shiftKey?-5:-1;this.moveHighlightedIndex(C,{type:zi})}else this.internalSetState({isOpen:!0,type:zi},function(){var S=I.getItemCount();if(S>0){var T=I.getState(),R=T.highlightedIndex,F=Xn(R,-1,{length:S},I.isItemDisabled,!0);I.setHighlightedIndex(F,{type:zi})}})},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:_u})}}},Escape:function(y){y.preventDefault(),this.reset(he({type:xu},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},i.buttonKeyDownHandlers=he({},i.keyDownHandlers,{" ":function(y){y.preventDefault(),this.toggleMenu({type:Tu})}}),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=jr(0,!1,{length:S},this.isItemDisabled);this.setHighlightedIndex(T,{type:Cu})}}},End:function(y){var I=this.getState(),C=I.isOpen;if(C){y.preventDefault();var S=this.getItemCount();if(!(S<=0||!C)){var T=jr(S-1,!0,{length:S},this.isItemDisabled);this.setHighlightedIndex(T,{type:Ou})}}}}),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,zv),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=vs(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:ws}):i.internalSetTimeout(function(){return i.toggleMenu({type:ws})})},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:Ru})}})},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,Gv),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=vs(g);y&&i.inputKeyDownHandlers[y]&&i.inputKeyDownHandlers[y].call(i,g)},i.inputHandleChange=function(g){i.internalSetState({type:Nu,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:Su})}})},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,Qv),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]=Ir(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:Uv("getItemProps","item"):F,Q=mn(I,Xv);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:bu}),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:Eu})}),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=qi(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=qi(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),fc(y)()})},i.openMenu=function(g){i.internalSetState({isOpen:!0},g)},i.closeMenu=function(g){i.internalSetState({isOpen:!1},g)},i.updateStatus=Bs(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,vu(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,x=m===void 0?"":m,w=s.initialSelectedItem,p=w===void 0?null:w,_=i.getState({highlightedIndex:u,isOpen:h,inputValue:x,selectedItem:p});return _.selectedItem!=null&&i.props.initialInputValue===void 0&&(_.inputValue=i.props.itemToString(_.selectedItem)),i.state=_,i}Ov(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),no(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=Xn(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,x=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:x,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&&mc(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 x=io(m.target,[i._rootNode,i._menuNode],i.props.environment);!x&&i.getState().isOpen&&i.reset({type:Iu},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},c=function(){i.isTouchMove=!1},u=function(){i.isTouchMove=!0},d=function(m){var x=io(m.target,[i._rootNode,i._menuNode],i.props.environment,!1);!i.isTouchMove&&!x&&i.getState().isOpen&&i.reset({type:Pu},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"&&(Js(this.state,i,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&mc(this._menuNode,this.getMenuProps)),ro(this.props,"selectedItem")&&this.props.selectedItemChanged(i.selectedItem,this.props.selectedItem)&&this.internalSetState({type:Au,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=hc(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=hc(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&&Zv(s,this.getRootProps),s;if(mu(s))return v.cloneElement(s,this.getRootProps(gu(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:Vv,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&qv(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:pu},e.stateChangeTypes=Jv,e}();process.env.NODE_ENV!=="production"&&(Yv.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 mc(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 Zv(e,t){var n=t.refKey,r=n!=="ref",o=!mu(e);o&&!r&&!lc.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+'"'),!lc.isForwardRef(e)&&!gu(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Fu={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function ew(e,t,n){var r=e.props,o=e.type,i={};Object.keys(t).forEach(function(s){tw(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 tw(e,t,n,r){var o=t.props,i=t.type,s="on"+Ws(e)+"Change";o[s]&&r[e]!==void 0&&r[e]!==n[e]&&o[s](he({type:i},r))}function nw(e,t){return t.changes}var gc=Bs(function(e,t){vu(e,t)},200),rw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?v.useLayoutEffect:v.useEffect,iw="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-"+hu():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 ow(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 Ws(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Du(e){var t=v.useRef(e);return t.current=e,t}function sw(e,t,n,r){var o=v.useRef(),i=v.useRef(),s=v.useCallback(function(m,x){i.current=x,m=no(m,x.props);var w=e(m,x),p=x.props.stateReducer(m,he({},x,{changes:w}));return p},[e]),a=v.useReducer(s,t,n),c=a[0],u=a[1],d=Du(t),f=v.useCallback(function(m){return u(he({props:d.current},m))},[d]),h=i.current;return v.useEffect(function(){var m=no(o.current,h==null?void 0:h.props),x=h&&o.current&&!r(m,c);x&&ew(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:nw,scrollIntoView:pu,environment:typeof window>"u"?void 0:window};function Ln(e,t,n){n===void 0&&(n=Fu);var r=e["default"+Ws(t)];return r!==void 0?r:n[t]}function oi(e,t,n){n===void 0&&(n=Fu);var r=e[t];if(r!==void 0)return r;var o=e["initial"+Ws(t)];return o!==void 0?o:Ln(e,t,n)}function aw(e){var t=oi(e,"selectedItem"),n=oi(e,"isOpen"),r=fw(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 cw(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,io(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&&!io(d.target,o,e,!1)&&t()}return e.addEventListener("mousedown",i),e.addEventListener("mouseup",s),e.addEventListener("touchstart",a),e.addEventListener("touchmove",c),e.addEventListener("touchend",u),function(){e.removeEventListener("mousedown",i),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",c),e.removeEventListener("touchend",u)}},[n,e,t]),r.current}var Mu=function(){return xt};process.env.NODE_ENV!=="production"&&(Mu=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=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 lw(e,t,n,r){r===void 0&&(r={});var o=r.document,i=mo();v.useEffect(function(){if(!(!e||i||!o)){var s=e(t);gc(s,o)}},n),v.useEffect(function(){return function(){gc.cancel(),Bv(o)}},[o])}function uw(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 rw(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(o(t),i))},[t]),a}var ku=xt;process.env.NODE_ENV!=="production"&&(ku=function(t){var n=t.props,r=t.state,o=v.useRef(n),i=mo();v.useEffect(function(){i||(Js(r,o.current,n),o.current=n)},[r,n,i])});function yc(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 dw(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function mo(){var e=v.useRef(!0);return v.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function Is(e){var t=Ln(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function fw(e){var t=oi(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var Qi={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},ju=he({},Qi,{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 pw(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:Is(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)}kr(kr({},ju),{items:V.array.isRequired,isItemDisabled:V.func});kr(kr({},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 zs=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,Gs=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,Qs=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,Xs=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,Ys=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,Zs=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,ea=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,ta=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,na=process.env.NODE_ENV!=="production"?"__input_change__":8,oo=process.env.NODE_ENV!=="production"?"__input_blur__":9,ra=process.env.NODE_ENV!=="production"?"__input_click__":10,Lu=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,Ku=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,ia=process.env.NODE_ENV!=="production"?"__item_click__":13,Vu=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,Uu=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,$u=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,qu=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,Hu=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,oa=process.env.NODE_ENV!=="production"?"__function_select_item__":19,Bu=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,Ju=process.env.NODE_ENV!=="production"?"__function_reset__":21,sa=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,Wu=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:sa,FunctionCloseMenu:qu,FunctionOpenMenu:$u,FunctionReset:Ju,FunctionSelectItem:oa,FunctionSetHighlightedIndex:Hu,FunctionSetInputValue:Bu,FunctionToggleMenu:Uu,InputBlur:oo,InputChange:na,InputClick:ra,InputKeyDownArrowDown:zs,InputKeyDownArrowUp:Gs,InputKeyDownEnd:Ys,InputKeyDownEnter:ta,InputKeyDownEscape:Qs,InputKeyDownHome:Xs,InputKeyDownPageDown:ea,InputKeyDownPageUp:Zs,ItemClick:ia,ItemMouseMove:Ku,MenuMouseLeave:Lu,ToggleButtonClick:Vu});function hw(e){var t=aw(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 mw=he({},ju,{items:V.array.isRequired,isItemDisabled:V.func,inputValue:V.string,defaultInputValue:V.string,initialInputValue:V.string,inputId:V.string,onInputValueChange:V.func});function gw(e,t,n,r){var o=v.useRef(),i=sw(e,t,n,r),s=i[0],a=i[1],c=mo();return v.useEffect(function(){if(ro(t,"selectedItem")){if(!c){var u=t.itemToKey(t.selectedItem)!==t.itemToKey(o.current);u&&a({type:sa,inputValue:t.itemToString(t.selectedItem)})}o.current=s.selectedItem===o.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[no(s,t),a]}var zu=xt;process.env.NODE_ENV!=="production"&&(zu=function(t,n){V.checkPropTypes(mw,t,"prop",n.name)});var yw=he({},ii,{isItemDisabled:function(){return!1}});function vw(e,t){var n,r=t.type,o=t.props,i=t.altKey,s;switch(r){case ia:s={isOpen:Ln(o,"isOpen"),highlightedIndex:Is(o),selectedItem:o.items[t.index],inputValue:o.itemToString(o.items[t.index])};break;case zs:e.isOpen?s={highlightedIndex:Xn(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 Gs:e.isOpen?i?s=yc(o,e.highlightedIndex):s={highlightedIndex:Xn(e.highlightedIndex,-1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:si(o,e,-1),isOpen:o.items.length>=0};break;case ta:s=yc(o,e.highlightedIndex);break;case Qs:s=he({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case Zs:s={highlightedIndex:Xn(e.highlightedIndex,-10,o.items,o.isItemDisabled,!0)};break;case ea:s={highlightedIndex:Xn(e.highlightedIndex,10,o.items,o.isItemDisabled,!0)};break;case Xs:s={highlightedIndex:jr(0,!1,o.items,o.isItemDisabled)};break;case Ys:s={highlightedIndex:jr(o.items.length-1,!0,o.items,o.isItemDisabled)};break;case oo: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 na:s={isOpen:!0,highlightedIndex:Is(o),inputValue:t.inputValue};break;case ra:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:si(o,e,0)};break;case oa:s={selectedItem:t.selectedItem,inputValue:o.itemToString(t.selectedItem)};break;case sa:s={inputValue:t.inputValue};break;default:return pw(e,t,Wu)}return he({},e,s)}var ww=["onMouseLeave","refKey","ref"],Iw=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],bw=["onClick","onPress","refKey","ref"],xw=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];aa.stateChangeTypes=Wu;function aa(e){e===void 0&&(e={}),zu(e,aa);var t=he({},yw,e),n=t.items,r=t.scrollIntoView,o=t.environment,i=t.getA11yStatusMessage,s=gw(vw,t,hw,dw),a=s[0],c=s[1],u=a.isOpen,d=a.highlightedIndex,f=a.selectedItem,h=a.inputValue,m=v.useRef(null),x=v.useRef({}),w=v.useRef(null),p=v.useRef(null),_=mo(),g=iw(t),y=v.useRef(),I=Du({state:a,props:t}),C=v.useCallback(function($){return x.current[g.getItemId($)]},[g]);lw(i,a,[u,d,f,h],o);var S=uw({menuElement:m.current,highlightedIndex:d,isOpen:u,itemRefs:x,scrollIntoView:r,getItemNodeFromIndex:C});ku({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=cw(o,v.useCallback(function(){I.current.state.isOpen&&c({type:oo,selectItem:!1})},[c,I]),v.useMemo(function(){return[m,p,w]},[m.current,p.current,w.current])),R=Mu("getInputProps","getMenuProps");v.useEffect(function(){u||(x.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:zs,altKey:K.altKey})},ArrowUp:function(K){K.preventDefault(),c({type:Gs,altKey:K.altKey})},Home:function(K){I.current.state.isOpen&&(K.preventDefault(),c({type:Xs}))},End:function(K){I.current.state.isOpen&&(K.preventDefault(),c({type:Ys}))},Escape:function(K){var L=I.current.state;(L.isOpen||L.inputValue||L.selectedItem||L.highlightedIndex>-1)&&(K.preventDefault(),c({type:Qs}))},Enter:function(K){var L=I.current.state;!L.isOpen||K.which===229||(K.preventDefault(),c({type:ta}))},PageUp:function(K){I.current.state.isOpen&&(K.preventDefault(),c({type:Zs}))},PageDown:function(K){I.current.state.isOpen&&(K.preventDefault(),c({type:ea}))}}},[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,ww),de=K===void 0?{}:K,M=de.suppressRefError,we=M===void 0?!1:M;return R("getMenuProps",we,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(){c({type:Lu})}),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,we=D.onClick;D.onPress;var H=D.disabled,Se=mn(D,Iw);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,be=ow(Z,ee,Ye.items,"Pass either item or index to getItemProps!"),Dt=be[0],Ze=be[1],wt=Ye.isItemDisabled(Dt,Ze),Mt="onClick",kt=we,et=function(){T.isTouchEnd||Ze===Ue.highlightedIndex||(S.current=!1,c({type:Ku,index:Ze,disabled:wt}))},Ge=function(){c({type:ia,index:Ze})},$e=function(jt){return jt.preventDefault()};return he((K={},K[te]=Ir(G,function(Pe){Pe&&(x.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[Mt]=Be(kt,Ge),L),{onMouseMove:Be(de,et),onMouseDown:Be(M,$e)},Se)},[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,bw),G=I.current.state,de=function(){c({type:Vu})};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)},[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,we=D.ref,H=mn(D,xw),Se=K===void 0?{}:K,Ve=Se.suppressRefError,Ye=Ve===void 0?!1:Ve;R("getInputProps",Ye,M,w);var Ue=I.current.state,be=function($e){var Pe=vs($e);Pe&&F[Pe]&&F[Pe]($e)},Dt=function($e){c({type:na,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:oo,selectItem:!Pe})}},wt=function(){c({type:ra})},Mt="onChange",kt={};if(!H.disabled){var et;kt=(et={},et[Mt]=Be(ee,q,Dt),et.onKeyDown=Be(Z,be),et.onBlur=Be(te,Ze),et.onClick=Be(G,wt),et)}return he((L={},L[M]=Ir(we,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),kt,H)},[c,g,o,F,I,T,R]),ce=v.useCallback(function(){c({type:Uu})},[c]),se=v.useCallback(function(){c({type:qu})},[c]),ne=v.useCallback(function(){c({type:$u})},[c]),ge=v.useCallback(function($){c({type:Hu,highlightedIndex:$})},[c]),Ie=v.useCallback(function($){c({type:oa,selectedItem:$})},[c]),A=v.useCallback(function($){c({type:Bu,inputValue:$})},[c]),j=v.useCallback(function(){c({type:Ju})},[c]);return{getItemProps:J,getLabelProps:U,getMenuProps:Q,getInputProps:B,getToggleButtonProps:Y,toggleMenu:ce,openMenu:ne,closeMenu:se,setHighlightedIndex:ge,setInputValue:A,selectItem:Ie,reset:j,highlightedIndex:d,isOpen:u,selectedItem:f,inputValue:h}}Qi.stateReducer,Qi.itemToKey,Qi.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 _w="_comboboxContainer_1lcc8_1",Cw="_label_1lcc8_8",Ow="_inputContainer_1lcc8_12",Ew="_input_1lcc8_12",Sw="_toggleButton_1lcc8_33",Nw="_menu_1lcc8_39",Tw="_menuBottom_1lcc8_55",Rw="_menuTop_1lcc8_61",Aw="_menuItem_1lcc8_66",Pw="_highlighted_1lcc8_73",Fw="_selected_1lcc8_77",Dw="_hidden_1lcc8_81",Ut={comboboxContainer:_w,label:Cw,inputContainer:Ow,input:Ew,toggleButton:Sw,menu:Nw,menuBottom:Tw,menuTop:Rw,menuItem:Aw,highlighted:Pw,selected:Fw,hidden:Dw};function Mw(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function Gu({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(Mw(T))):c(e)},[e]),{isOpen:f,getToggleButtonProps:h,getMenuProps:m,getInputProps:x,highlightedIndex:w,getItemProps:p,setInputValue:_,selectedItem:g}=aa({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:Ut.comboboxContainer,children:l.jsxs("div",{className:Ut.inputContainer,children:[l.jsx("input",{style:{border:"none"},disabled:o,placeholder:r,className:Ut.input,...x({onFocus:I,onBlur:S,ref:u})}),l.jsx("button",{style:{border:"none"},disabled:o,"aria-label":"toggle menu",className:Ut.toggleButton,type:"button",...h(),children:f?l.jsx(l.Fragment,{children:"↑"}):l.jsx(l.Fragment,{children:"↓"})})]})}),l.jsx("ul",{className:`${Ut.menu} ${f&&e.length?"":Ut.hidden} ${s==="top"?Ut.menuTop:Ut.menuBottom}`,...m(),children:f&&a.map((T,R)=>l.jsx("li",{className:`${Ut.menuItem} ${w===R?Ut.highlighted:""} ${t===(T==null?void 0:T.value)?Ut.selected:""}`,...p({item:T,index:R}),children:l.jsx("span",{children:T.label})},T.id))})]})}const Lr=Math.min,sr=Math.max,so=Math.round,Hi=Math.floor,Un=e=>({x:e,y:e}),kw={left:"right",right:"left",bottom:"top",top:"bottom"},jw={start:"end",end:"start"};function bs(e,t,n){return sr(e,Lr(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 Qu(e){return e==="x"?"y":"x"}function ca(e){return e==="y"?"height":"width"}function Kr(e){return["top","bottom"].includes(fr(e))?"y":"x"}function la(e){return Qu(Kr(e))}function Lw(e,t,n){n===void 0&&(n=!1);const r=bi(e),o=la(e),i=ca(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=ao(s)),[s,ao(s)]}function Kw(e){const t=ao(e);return[xs(e),t,xs(t)]}function xs(e){return e.replace(/start|end/g,t=>jw[t])}function Vw(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 Uw(e,t,n,r){const o=bi(e);let i=Vw(fr(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(xs)))),i}function ao(e){return e.replace(/left|right|bottom|top/g,t=>kw[t])}function $w(e){return{top:0,right:0,bottom:0,left:0,...e}}function Xu(e){return typeof e!="number"?$w(e):{top:e,right:e,bottom:e,left:e}}function co(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 vc(e,t,n){let{reference:r,floating:o}=e;const i=Kr(t),s=la(t),a=ca(s),c=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(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 qw=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}=vc(u,r,c),h=r,m={},x=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&&x<=50&&(x++,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}=vc(u,h,c)),w=-1)}return{x:d,y:f,placement:h,strategy:o,middlewareData:m}};async function Yu(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),x=Xu(m),p=a[h?f==="floating"?"reference":"floating":f],_=co(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=co(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:g,offsetParent:y,strategy:c}):g);return{top:(_.top-C.top+x.top)/I.y,bottom:(C.bottom-_.bottom+x.bottom)/I.y,left:(_.left-C.left+x.left)/I.x,right:(C.right-_.right+x.right)/I.x}}const Hw=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=Xu(d),h={x:n,y:r},m=la(o),x=ca(m),w=await s.getDimensions(u),p=m==="y",_=p?"top":"left",g=p?"bottom":"right",y=p?"clientHeight":"clientWidth",I=i.reference[x]+i.reference[m]-h[m]-i.floating[x],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[x]);const R=I/2-C/2,F=T/2-w[x]/2-1,U=Lr(f[_],F),Q=Lr(f[g],F),J=U,Y=T-w[x]-Q,B=T/2-w[x]/2+R,ce=bs(J,B,Y),se=!c.arrow&&bi(o)!=null&&B!==ce&&i.reference[x]/2-(B<J?U:Q)-w[x]/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}}}),Bw=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:x="none",flipAlignment:w=!0,...p}=Ii(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const _=fr(o),g=Kr(a),y=fr(a)===a,I=await(c.isRTL==null?void 0:c.isRTL(u.floating)),C=h||(y||!w?[ao(a)]:Kw(a)),S=x!=="none";!h&&S&&C.push(...Uw(a,w,x,I));const T=[a,...C],R=await Yu(t,p),F=[];let U=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&F.push(R[_]),f){const B=Lw(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 Ie=Kr(ge.placement);return Ie===g||Ie==="y"}return!0}).map(ge=>[ge.placement,ge.overflows.filter(Ie=>Ie>0).reduce((Ie,A)=>Ie+A,0)]).sort((ge,Ie)=>ge[1]-Ie[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 Jw(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),c=Kr(n)==="y",u=["left","top"].includes(s)?-1:1,d=i&&c?-1:1,f=Ii(t,e);let{mainAxis:h,crossAxis:m,alignmentAxis:x}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof x=="number"&&(m=a==="end"?x*-1:x),c?{x:m*d,y:h*u}:{x:h*u,y:m*d}}const Ww=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 Jw(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}}}}},zw=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 Yu(t,c),f=Kr(fr(o)),h=Qu(f);let m=u[h],x=u[f];if(i){const p=h==="y"?"top":"left",_=h==="y"?"bottom":"right",g=m+d[p],y=m-d[_];m=bs(g,m,y)}if(s){const p=f==="y"?"top":"left",_=f==="y"?"bottom":"right",g=x+d[p],y=x-d[_];x=bs(g,x,y)}const w=a.fn({...t,[h]:m,[f]:x});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[h]:i,[f]:s}}}}}};function go(){return typeof window<"u"}function Qr(e){return Zu(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=(Zu(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Zu(e){return go()?e instanceof Node||e instanceof _t(e).Node:!1}function Wt(e){return go()?e instanceof Element||e instanceof _t(e).Element:!1}function rn(e){return go()?e instanceof HTMLElement||e instanceof _t(e).HTMLElement:!1}function wc(e){return!go()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof _t(e).ShadowRoot}function xi(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=zt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function Gw(e){return["table","td","th"].includes(Qr(e))}function yo(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function ua(e){const t=da(),n=Wt(e)?zt(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 Qw(e){let t=$n(e);for(;rn(t)&&!Vr(t);){if(ua(t))return t;if(yo(t))return null;t=$n(t)}return null}function da(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Vr(e){return["html","body","#document"].includes(Qr(e))}function zt(e){return _t(e).getComputedStyle(e)}function vo(e){return Wt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function $n(e){if(Qr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||wc(e)&&e.host||on(e);return wc(t)?t.host:t}function ed(e){const t=$n(e);return Vr(t)?e.ownerDocument?e.ownerDocument.body:e.body:rn(t)&&xi(t)?t:ed(t)}function li(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=ed(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=_t(o);if(i){const a=_s(s);return t.concat(s,s.visualViewport||[],xi(o)?o:[],a&&n?li(a):[])}return t.concat(o,li(o,[],n))}function _s(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function td(e){const t=zt(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=so(n)!==i||so(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function fa(e){return Wt(e)?e:e.contextElement}function xr(e){const t=fa(e);if(!rn(t))return Un(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=td(t);let s=(i?so(n.width):n.width)/r,a=(i?so(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const Xw=Un(0);function nd(e){const t=_t(e);return!da()||!t.visualViewport?Xw:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Yw(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=fa(e);let s=Un(1);t&&(r?Wt(r)&&(s=xr(r)):s=xr(e));const a=Yw(i,n,r)?nd(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&&Wt(r)?_t(r):r;let x=h,w=_s(x);for(;w&&r&&m!==x;){const p=xr(w),_=w.getBoundingClientRect(),g=zt(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,x=_t(w),w=_s(x)}}return co({width:d,height:f,x:c,y:u})}function Zw(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=on(r),a=t?yo(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)&&((Qr(r)!=="body"||xi(s))&&(c=vo(r)),rn(r))){const h=pr(r);u=xr(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 eI(e){return Array.from(e.getClientRects())}function Cs(e,t){const n=vo(e).scrollLeft;return t?t.left+n:pr(on(e)).left+n}function tI(e){const t=on(e),n=vo(e),r=e.ownerDocument.body,o=sr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=sr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Cs(e);const a=-n.scrollTop;return zt(r).direction==="rtl"&&(s+=sr(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function nI(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=da();(!u||u&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}return{width:i,height:s,x:a,y:c}}function rI(e,t){const n=pr(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=rn(e)?xr(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 Ic(e,t,n){let r;if(t==="viewport")r=nI(e,n);else if(t==="document")r=tI(on(e));else if(Wt(t))r=rI(t,n);else{const o=nd(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return co(r)}function rd(e,t){const n=$n(e);return n===t||!Wt(n)||Vr(n)?!1:zt(n).position==="fixed"||rd(n,t)}function iI(e,t){const n=t.get(e);if(n)return n;let r=li(e,[],!1).filter(a=>Wt(a)&&Qr(a)!=="body"),o=null;const i=zt(e).position==="fixed";let s=i?$n(e):e;for(;Wt(s)&&!Vr(s);){const a=zt(s),c=ua(s);!c&&a.position==="fixed"&&(o=null),(i?!c&&!o:!c&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||xi(s)&&!c&&rd(e,s))?r=r.filter(d=>d!==s):o=a,s=$n(s)}return t.set(e,r),r}function oI(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?yo(t)?[]:iI(t,this._c):[].concat(n),r],a=s[0],c=s.reduce((u,d)=>{const f=Ic(t,d,o);return u.top=sr(f.top,u.top),u.right=Lr(f.right,u.right),u.bottom=Lr(f.bottom,u.bottom),u.left=sr(f.left,u.left),u},Ic(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function sI(e){const{width:t,height:n}=td(e);return{width:t,height:n}}function aI(e,t,n){const r=rn(t),o=on(t),i=n==="fixed",s=pr(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=Un(0);if(r||!r&&!i)if((Qr(t)!=="body"||xi(o))&&(a=vo(t)),r){const m=pr(t,!0,i,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}else o&&(c.x=Cs(o));let u=0,d=0;if(o&&!r&&!i){const m=o.getBoundingClientRect();d=m.top+a.scrollTop,u=m.left+a.scrollLeft-Cs(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 Bo(e){return zt(e).position==="static"}function bc(e,t){if(!rn(e)||zt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return on(e)===n&&(n=n.ownerDocument.body),n}function id(e,t){const n=_t(e);if(yo(e))return n;if(!rn(e)){let o=$n(e);for(;o&&!Vr(o);){if(Wt(o)&&!Bo(o))return o;o=$n(o)}return n}let r=bc(e,t);for(;r&&Gw(r)&&Bo(r);)r=bc(r,t);return r&&Vr(r)&&Bo(r)&&!ua(r)?n:r||Qw(e)||n}const cI=async function(e){const t=this.getOffsetParent||id,n=this.getDimensions,r=await n(e.floating);return{reference:aI(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function lI(e){return zt(e).direction==="rtl"}const uI={convertOffsetParentRelativeRectToViewportRelativeRect:Zw,getDocumentElement:on,getClippingRect:oI,getOffsetParent:id,getElementRects:cI,getClientRects:eI,getDimensions:sI,getScale:xr,isElement:Wt,isRTL:lI};function dI(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=Hi(d),x=Hi(o.clientWidth-(u+f)),w=Hi(o.clientHeight-(d+h)),p=Hi(u),g={rootMargin:-m+"px "+-x+"px "+-w+"px "+-p+"px",threshold:sr(0,Lr(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 fI(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=fa(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?dI(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 x,w=c?pr(e):null;c&&p();function p(){const _=pr(e);w&&(_.x!==w.x||_.y!==w.y||_.width!==w.width||_.height!==w.height)&&n(),w=_,x=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(x)}}const pI=Ww,hI=zw,mI=Bw,gI=Hw,xc=(e,t,n)=>{const r=new Map,o={platform:uI,...n},i={...o.platform,_c:r};return qw(e,t,{...o,platform:i})};/*
|
|
45
|
+
*/var pc;function Vv(){return pc||(pc=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"),f=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),w=!1,v=!1,p=!1,x=!1,m=!1,I;I=Symbol.for("react.module.reference");function _(J){return!!(typeof J=="string"||typeof J=="function"||J===n||J===o||m||J===r||J===f||J===u||x||J===h||w||v||p||typeof J=="object"&&J!==null&&(J.$$typeof===g||J.$$typeof===d||J.$$typeof===i||J.$$typeof===s||J.$$typeof===c||J.$$typeof===I||J.getModuleId!==void 0))}function C(J){if(typeof J=="object"&&J!==null){var Se=J.$$typeof;switch(Se){case e:var Ve=J.type;switch(Ve){case n:case o:case r:case f:case u:return Ve;default:var Ye=Ve&&Ve.$$typeof;switch(Ye){case a:case s:case c:case g:case d:case i:return Ye;default:return Se}}case t:return Se}}}var S=s,R=i,N=e,A=c,K=n,z=g,H=d,ee=t,q=o,ae=r,X=f,Y=u,fe=!1,Ie=!1;function P(J){return fe||(fe=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function j(J){return Ie||(Ie=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function $(J){return C(J)===s}function V(J){return C(J)===i}function L(J){return typeof J=="object"&&J!==null&&J.$$typeof===e}function D(J){return C(J)===c}function te(J){return C(J)===n}function ne(J){return C(J)===g}function B(J){return C(J)===d}function re(J){return C(J)===t}function Q(J){return C(J)===o}function de(J){return C(J)===r}function k(J){return C(J)===f}function we(J){return C(J)===u}Oe.ContextConsumer=S,Oe.ContextProvider=R,Oe.Element=N,Oe.ForwardRef=A,Oe.Fragment=K,Oe.Lazy=z,Oe.Memo=H,Oe.Portal=ee,Oe.Profiler=q,Oe.StrictMode=ae,Oe.Suspense=X,Oe.SuspenseList=Y,Oe.isAsyncMode=P,Oe.isConcurrentMode=j,Oe.isContextConsumer=$,Oe.isContextProvider=V,Oe.isElement=L,Oe.isForwardRef=D,Oe.isFragment=te,Oe.isLazy=ne,Oe.isMemo=B,Oe.isPortal=re,Oe.isProfiler=Q,Oe.isStrictMode=de,Oe.isSuspense=k,Oe.isSuspenseList=we,Oe.isValidElementType=_,Oe.typeOf=C}()),Oe}process.env.NODE_ENV==="production"?Is.exports=Kv():Is.exports=Vv();var hc=Is.exports;const mc=e=>typeof e=="object"&&e!=null&&e.nodeType===1,gc=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Wo=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return gc(n.overflowY,t)||gc(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},Hi=(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,Uv=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},$v=(e,t)=>{var n,r,o,i;if(typeof document>"u")return[];const{scrollMode:s,block:a,inline:c,boundary:f,skipOverflowHiddenElements:u}=t,d=typeof f=="function"?f:X=>X!==f;if(!mc(e))throw new TypeError("Invalid target");const g=document.scrollingElement||document.documentElement,h=[];let w=e;for(;mc(w)&&d(w);){if(w=Uv(w),w===g){h.push(w);break}w!=null&&w===document.body&&Wo(w)&&!Wo(document.documentElement)||w!=null&&Wo(w,u)&&h.push(w)}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:m}=window,{height:I,width:_,top:C,right:S,bottom:R,left:N}=e.getBoundingClientRect(),{top:A,right:K,bottom:z,left:H}=(X=>{const Y=window.getComputedStyle(X);return{top:parseFloat(Y.scrollMarginTop)||0,right:parseFloat(Y.scrollMarginRight)||0,bottom:parseFloat(Y.scrollMarginBottom)||0,left:parseFloat(Y.scrollMarginLeft)||0}})(e);let ee=a==="start"||a==="nearest"?C-A:a==="end"?R+z:C+I/2-A+z,q=c==="center"?N+_/2-H+K:c==="end"?S+K:N-H;const ae=[];for(let X=0;X<h.length;X++){const Y=h[X],{height:fe,width:Ie,top:P,right:j,bottom:$,left:V}=Y.getBoundingClientRect();if(s==="if-needed"&&C>=0&&N>=0&&R<=p&&S<=v&&C>=P&&R<=$&&N>=V&&S<=j)return ae;const L=getComputedStyle(Y),D=parseInt(L.borderLeftWidth,10),te=parseInt(L.borderTopWidth,10),ne=parseInt(L.borderRightWidth,10),B=parseInt(L.borderBottomWidth,10);let re=0,Q=0;const de="offsetWidth"in Y?Y.offsetWidth-Y.clientWidth-D-ne:0,k="offsetHeight"in Y?Y.offsetHeight-Y.clientHeight-te-B:0,we="offsetWidth"in Y?Y.offsetWidth===0?0:Ie/Y.offsetWidth:0,J="offsetHeight"in Y?Y.offsetHeight===0?0:fe/Y.offsetHeight:0;if(g===Y)re=a==="start"?ee:a==="end"?ee-p:a==="nearest"?Hi(m,m+p,p,te,B,m+ee,m+ee+I,I):ee-p/2,Q=c==="start"?q:c==="center"?q-v/2:c==="end"?q-v:Hi(x,x+v,v,D,ne,x+q,x+q+_,_),re=Math.max(0,re+m),Q=Math.max(0,Q+x);else{re=a==="start"?ee-P-te:a==="end"?ee-$+B+k:a==="nearest"?Hi(P,$,fe,te,B+k,ee,ee+I,I):ee-(P+fe/2)+k/2,Q=c==="start"?q-V-D:c==="center"?q-(V+Ie/2)+de/2:c==="end"?q-j+ne+de:Hi(V,j,Ie,D,ne+de,q,q+_,_);const{scrollLeft:Se,scrollTop:Ve}=Y;re=J===0?0:Math.max(0,Math.min(Ve+re/J,Y.scrollHeight-fe/J+k)),Q=we===0?0:Math.max(0,Math.min(Se+Q/we,Y.scrollWidth-Ie/we+de)),ee+=Ve-re,q+=Se-Q}ae.push({el:Y,top:re,left:Q})}return ae};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 qv=0;function yc(e){return typeof e=="function"?e:xt}function xt(){}function wu(e,t){if(e){var n=$v(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 vc(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function Ws(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 Iu(){return String(qv++)}function Hv(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 wc(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function bu(e){return typeof e.type=="string"}function xu(e){return e.props}function Bv(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var Jv=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function Bi(e){e===void 0&&(e={});var t={};return Jv.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function io(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,r){return n[r]=oo(t,r)?t[r]:e[r],n},{})}function oo(e,t){return e[t]!==void 0}function bs(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function Wv(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 so(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(o){return o&&(vc(o,e,n)||r&&vc(o,n.document.activeElement,n))})}var zs=xt;process.env.NODE_ENV!=="production"&&(zs=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 zv=Ws(function(e){Cu(e).textContent=""},500);function Cu(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 _u(e,t){if(!(!e||!t)){var n=Cu(t);n.textContent=e,zv(t)}}function Gv(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var Ou=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,Eu=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,Su=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,Qi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,Xi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,Nu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,Tu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,Ru=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,Au=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,Pu=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,Fu=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,Du=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,Mu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,xs=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,ku=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,ju=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,Lu=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,Qv=Object.freeze({__proto__:null,blurButton:ku,blurInput:Fu,changeInput:Du,clickButton:xs,clickItem:Pu,controlledPropUpdatedSelectedItem:ju,itemMouseEnter:Su,keyDownArrowDown:Xi,keyDownArrowUp:Qi,keyDownEnd:Au,keyDownEnter:Tu,keyDownEscape:Nu,keyDownHome:Ru,keyDownSpaceButton:Mu,mouseUp:Eu,touchEnd:Lu,unknown:Ou}),Xv=["refKey","ref"],Yv=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],Zv=["onKeyDown","onBlur","onChange","onInput","onChangeText"],ew=["refKey","ref"],tw=["onMouseMove","onMouseDown","onClick","onPress","index","item"],nw=function(){var e=function(t){function n(o){var i;i=t.call(this,o)||this,i.id=i.props.id||"downshift-"+Iu(),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(m){return i.id+"-item-"+m},i.items=[],i.itemCount=null,i.previousResultCount=0,i.timeoutIds=[],i.internalSetTimeout=function(m,I){var _=setTimeout(function(){i.timeoutIds=i.timeoutIds.filter(function(C){return C!==_}),m()},I);i.timeoutIds.push(_)},i.setItemCount=function(m){i.itemCount=m},i.unsetItemCount=function(){i.itemCount=null},i.isItemDisabled=function(m,I){var _=i.getItemNodeFromIndex(I);return _&&_.hasAttribute("disabled")},i.setHighlightedIndex=function(m,I){m===void 0&&(m=i.props.defaultHighlightedIndex),I===void 0&&(I={}),I=Bi(I),i.internalSetState(me({highlightedIndex:m},I))},i.clearSelection=function(m){i.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:i.props.defaultHighlightedIndex,isOpen:i.props.defaultIsOpen},m)},i.selectItem=function(m,I,_){I=Bi(I),i.internalSetState(me({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,selectedItem:m,inputValue:i.props.itemToString(m)},I),_)},i.selectItemAtIndex=function(m,I,_){var C=i.items[m];C!=null&&i.selectItem(C,I,_)},i.selectHighlightedItem=function(m,I){return i.selectItemAtIndex(i.getState().highlightedIndex,m,I)},i.internalSetState=function(m,I){var _,C,S={},R=typeof m=="function";return!R&&m.hasOwnProperty("inputValue")&&i.props.onInputValueChange(m.inputValue,me({},i.getStateAndHelpers(),m)),i.setState(function(N){var A;N=i.getState(N);var K=R?m(N):m;K=i.props.stateReducer(N,K),_=K.hasOwnProperty("selectedItem");var z={};return _&&K.selectedItem!==N.selectedItem&&(C=K.selectedItem),(A=K).type||(A.type=Ou),Object.keys(K).forEach(function(H){N[H]!==K[H]&&(S[H]=K[H]),H!=="type"&&(K[H],oo(i.props,H)||(z[H]=K[H]))}),R&&K.hasOwnProperty("inputValue")&&i.props.onInputValueChange(K.inputValue,me({},i.getStateAndHelpers(),K)),z},function(){yc(I)();var N=Object.keys(S).length>1;N&&i.props.onStateChange(S,i.getStateAndHelpers()),_&&i.props.onSelect(m.selectedItem,i.getStateAndHelpers()),C!==void 0&&i.props.onChange(C,i.getStateAndHelpers()),i.props.onUserAction(S,i.getStateAndHelpers())})},i.rootRef=function(m){return i._rootNode=m},i.getRootProps=function(m,I){var _,C=m===void 0?{}:m,S=C.refKey,R=S===void 0?"ref":S,N=C.ref,A=mn(C,Xv),K=I===void 0?{}:I,z=K.suppressRefError,H=z===void 0?!1:z;i.getRootProps.called=!0,i.getRootProps.refKey=R,i.getRootProps.suppressRefError=H;var ee=i.getState(),q=ee.isOpen;return me((_={},_[R]=br(N,i.rootRef),_.role="combobox",_["aria-expanded"]=q,_["aria-haspopup"]="listbox",_["aria-owns"]=q?i.menuId:void 0,_["aria-labelledby"]=i.labelId,_),A)},i.keyDownHandlers={ArrowDown:function(I){var _=this;if(I.preventDefault(),this.getState().isOpen){var C=I.shiftKey?5:1;this.moveHighlightedIndex(C,{type:Xi})}else this.internalSetState({isOpen:!0,type:Xi},function(){var S=_.getItemCount();if(S>0){var R=_.getState(),N=R.highlightedIndex,A=Yn(N,1,{length:S},_.isItemDisabled,!0);_.setHighlightedIndex(A,{type:Xi})}})},ArrowUp:function(I){var _=this;if(I.preventDefault(),this.getState().isOpen){var C=I.shiftKey?-5:-1;this.moveHighlightedIndex(C,{type:Qi})}else this.internalSetState({isOpen:!0,type:Qi},function(){var S=_.getItemCount();if(S>0){var R=_.getState(),N=R.highlightedIndex,A=Yn(N,-1,{length:S},_.isItemDisabled,!0);_.setHighlightedIndex(A,{type:Qi})}})},Enter:function(I){if(I.which!==229){var _=this.getState(),C=_.isOpen,S=_.highlightedIndex;if(C&&S!=null){I.preventDefault();var R=this.items[S],N=this.getItemNodeFromIndex(S);if(R==null||N&&N.hasAttribute("disabled"))return;this.selectHighlightedItem({type:Tu})}}},Escape:function(I){I.preventDefault(),this.reset(me({type:Nu},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},i.buttonKeyDownHandlers=me({},i.keyDownHandlers,{" ":function(I){I.preventDefault(),this.toggleMenu({type:Mu})}}),i.inputKeyDownHandlers=me({},i.keyDownHandlers,{Home:function(I){var _=this.getState(),C=_.isOpen;if(C){I.preventDefault();var S=this.getItemCount();if(!(S<=0||!C)){var R=Lr(0,!1,{length:S},this.isItemDisabled);this.setHighlightedIndex(R,{type:Ru})}}},End:function(I){var _=this.getState(),C=_.isOpen;if(C){I.preventDefault();var S=this.getItemCount();if(!(S<=0||!C)){var R=Lr(S-1,!0,{length:S},this.isItemDisabled);this.setHighlightedIndex(R,{type:Au})}}}}),i.getToggleButtonProps=function(m){var I=m===void 0?{}:m,_=I.onClick;I.onPress;var C=I.onKeyDown,S=I.onKeyUp,R=I.onBlur,N=mn(I,Yv),A=i.getState(),K=A.isOpen,z={onClick:Be(_,i.buttonHandleClick),onKeyDown:Be(C,i.buttonHandleKeyDown),onKeyUp:Be(S,i.buttonHandleKeyUp),onBlur:Be(R,i.buttonHandleBlur)},H=N.disabled?{}:z;return me({type:"button",role:"button","aria-label":K?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},H,N)},i.buttonHandleKeyUp=function(m){m.preventDefault()},i.buttonHandleKeyDown=function(m){var I=bs(m);i.buttonKeyDownHandlers[I]&&i.buttonKeyDownHandlers[I].call(i,m)},i.buttonHandleClick=function(m){if(m.preventDefault(),i.props.environment){var I=i.props.environment.document,_=I.body,C=I.activeElement;_&&_===C&&m.target.focus()}process.env.NODE_ENV==="test"?i.toggleMenu({type:xs}):i.internalSetTimeout(function(){return i.toggleMenu({type:xs})})},i.buttonHandleBlur=function(m){var I=m.target;i.internalSetTimeout(function(){if(!(i.isMouseDown||!i.props.environment)){var _=i.props.environment.document.activeElement;(_==null||_.id!==i.inputId)&&_!==I&&i.reset({type:ku})}})},i.getLabelProps=function(m){return me({htmlFor:i.inputId,id:i.labelId},m)},i.getInputProps=function(m){var I=m===void 0?{}:m,_=I.onKeyDown,C=I.onBlur,S=I.onChange,R=I.onInput;I.onChangeText;var N=mn(I,Zv),A,K={};A="onChange";var z=i.getState(),H=z.inputValue,ee=z.isOpen,q=z.highlightedIndex;if(!N.disabled){var ae;K=(ae={},ae[A]=Be(S,R,i.inputHandleChange),ae.onKeyDown=Be(_,i.inputHandleKeyDown),ae.onBlur=Be(C,i.inputHandleBlur),ae)}return me({"aria-autocomplete":"list","aria-activedescendant":ee&&typeof q=="number"&&q>=0?i.getItemId(q):void 0,"aria-controls":ee?i.menuId:void 0,"aria-labelledby":N&&N["aria-label"]?void 0:i.labelId,autoComplete:"off",value:H,id:i.inputId},K,N)},i.inputHandleKeyDown=function(m){var I=bs(m);I&&i.inputKeyDownHandlers[I]&&i.inputKeyDownHandlers[I].call(i,m)},i.inputHandleChange=function(m){i.internalSetState({type:Du,isOpen:!0,inputValue:m.target.value,highlightedIndex:i.props.defaultHighlightedIndex})},i.inputHandleBlur=function(){i.internalSetTimeout(function(){var m;if(!(i.isMouseDown||!i.props.environment)){var I=i.props.environment.document.activeElement,_=(I==null||(m=I.dataset)==null?void 0:m.toggle)&&i._rootNode&&i._rootNode.contains(I);_||i.reset({type:Fu})}})},i.menuRef=function(m){i._menuNode=m},i.getMenuProps=function(m,I){var _,C=m===void 0?{}:m,S=C.refKey,R=S===void 0?"ref":S,N=C.ref,A=mn(C,ew),K=I===void 0?{}:I,z=K.suppressRefError,H=z===void 0?!1:z;return i.getMenuProps.called=!0,i.getMenuProps.refKey=R,i.getMenuProps.suppressRefError=H,me((_={},_[R]=br(N,i.menuRef),_.role="listbox",_["aria-labelledby"]=A&&A["aria-label"]?void 0:i.labelId,_.id=i.menuId,_),A)},i.getItemProps=function(m){var I,_=m===void 0?{}:m,C=_.onMouseMove,S=_.onMouseDown,R=_.onClick;_.onPress;var N=_.index,A=_.item,K=A===void 0?process.env.NODE_ENV==="production"?void 0:Bv("getItemProps","item"):A,z=mn(_,tw);N===void 0?(i.items.push(K),N=i.items.indexOf(K)):i.items[N]=K;var H="onClick",ee=R,q=(I={onMouseMove:Be(C,function(){N!==i.getState().highlightedIndex&&(i.setHighlightedIndex(N,{type:Su}),i.avoidScrolling=!0,i.internalSetTimeout(function(){return i.avoidScrolling=!1},250))}),onMouseDown:Be(S,function(X){X.preventDefault()})},I[H]=Be(ee,function(){i.selectItemAtIndex(N,{type:Pu})}),I),ae=z.disabled?{onMouseDown:q.onMouseDown}:q;return me({id:i.getItemId(N),role:"option","aria-selected":i.getState().highlightedIndex===N},ae,z)},i.clearItems=function(){i.items=[]},i.reset=function(m,I){m===void 0&&(m={}),m=Bi(m),i.internalSetState(function(_){var C=_.selectedItem;return me({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,inputValue:i.props.itemToString(C)},m)},I)},i.toggleMenu=function(m,I){m===void 0&&(m={}),m=Bi(m),i.internalSetState(function(_){var C=_.isOpen;return me({isOpen:!C},C&&{highlightedIndex:i.props.defaultHighlightedIndex},m)},function(){var _=i.getState(),C=_.isOpen,S=_.highlightedIndex;C&&i.getItemCount()>0&&typeof S=="number"&&i.setHighlightedIndex(S,m),yc(I)()})},i.openMenu=function(m){i.internalSetState({isOpen:!0},m)},i.closeMenu=function(m){i.internalSetState({isOpen:!1},m)},i.updateStatus=Ws(function(){var m;if((m=i.props)!=null&&(m=m.environment)!=null&&m.document){var I=i.getState(),_=i.items[I.highlightedIndex],C=i.getItemCount(),S=i.props.getA11yStatusMessage(me({itemToString:i.props.itemToString,previousResultCount:i.previousResultCount,resultCount:C,highlightedItem:_},I));i.previousResultCount=C,_u(S,i.props.environment.document)}},200);var s=i.props,a=s.defaultHighlightedIndex,c=s.initialHighlightedIndex,f=c===void 0?a:c,u=s.defaultIsOpen,d=s.initialIsOpen,g=d===void 0?u:d,h=s.initialInputValue,w=h===void 0?"":h,v=s.initialSelectedItem,p=v===void 0?null:v,x=i.getState({highlightedIndex:f,isOpen:g,inputValue:w,selectedItem:p});return x.selectedItem!=null&&i.props.initialInputValue===void 0&&(x.inputValue=i.props.itemToString(x.selectedItem)),i.state=x,i}Tv(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),io(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(),f=c.highlightedIndex;if(a>0){var u=Yn(f,i,{length:a},this.isItemDisabled,!0);this.setHighlightedIndex(u,s)}},r.getStateAndHelpers=function(){var i=this.getState(),s=i.highlightedIndex,a=i.inputValue,c=i.selectedItem,f=i.isOpen,u=this.props.itemToString,d=this.id,g=this.getRootProps,h=this.getToggleButtonProps,w=this.getLabelProps,v=this.getMenuProps,p=this.getInputProps,x=this.getItemProps,m=this.openMenu,I=this.closeMenu,_=this.toggleMenu,C=this.selectItem,S=this.selectItemAtIndex,R=this.selectHighlightedItem,N=this.setHighlightedIndex,A=this.clearSelection,K=this.clearItems,z=this.reset,H=this.setItemCount,ee=this.unsetItemCount,q=this.internalSetState;return{getRootProps:g,getToggleButtonProps:h,getLabelProps:w,getMenuProps:v,getInputProps:p,getItemProps:x,reset:z,openMenu:m,closeMenu:I,toggleMenu:_,selectItem:C,selectItemAtIndex:S,selectHighlightedItem:R,setHighlightedIndex:N,clearSelection:A,clearItems:K,setItemCount:H,unsetItemCount:ee,setState:q,itemToString:u,id:d,highlightedIndex:s,inputValue:a,isOpen:f,selectedItem:c}},r.componentDidMount=function(){var i=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&Ic(this._menuNode,this.getMenuProps),!this.props.environment)this.cleanup=function(){i.internalClearTimeouts()};else{var s=function(){i.isMouseDown=!0},a=function(h){i.isMouseDown=!1;var w=so(h.target,[i._rootNode,i._menuNode],i.props.environment);!w&&i.getState().isOpen&&i.reset({type:Eu},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},c=function(){i.isTouchMove=!1},f=function(){i.isTouchMove=!0},u=function(h){var w=so(h.target,[i._rootNode,i._menuNode],i.props.environment,!1);!i.isTouchMove&&!w&&i.getState().isOpen&&i.reset({type:Lu},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},d=this.props.environment;d.addEventListener("mousedown",s),d.addEventListener("mouseup",a),d.addEventListener("touchstart",c),d.addEventListener("touchmove",f),d.addEventListener("touchend",u),this.cleanup=function(){i.internalClearTimeouts(),i.updateStatus.cancel(),d.removeEventListener("mousedown",s),d.removeEventListener("mouseup",a),d.removeEventListener("touchstart",c),d.removeEventListener("touchmove",f),d.removeEventListener("touchend",u)}}},r.shouldScroll=function(i,s){var a=this.props.highlightedIndex===void 0?this.getState():this.props,c=a.highlightedIndex,f=s.highlightedIndex===void 0?i:s,u=f.highlightedIndex,d=c&&this.getState().isOpen&&!i.isOpen,g=c!==u;return d||g},r.componentDidUpdate=function(i,s){process.env.NODE_ENV!=="production"&&(zs(this.state,i,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&Ic(this._menuNode,this.getMenuProps)),oo(this.props,"selectedItem")&&this.props.selectedItemChanged(i.selectedItem,this.props.selectedItem)&&this.internalSetState({type:ju,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=wc(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=wc(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&&rw(s,this.getRootProps),s;if(bu(s))return y.cloneElement(s,this.getRootProps(xu(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:Hv,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&Wv(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:wu},e.stateChangeTypes=Qv,e}();process.env.NODE_ENV!=="production"&&(nw.propTypes={children:U.func,defaultHighlightedIndex:U.number,defaultIsOpen:U.bool,initialHighlightedIndex:U.number,initialSelectedItem:U.any,initialInputValue:U.string,initialIsOpen:U.bool,getA11yStatusMessage:U.func,itemToString:U.func,onChange:U.func,onSelect:U.func,onStateChange:U.func,onInputValueChange:U.func,onUserAction:U.func,onOuterClick:U.func,selectedItemChanged:U.func,stateReducer:U.func,itemCount:U.number,id:U.string,environment:U.shape({addEventListener:U.func.isRequired,removeEventListener:U.func.isRequired,document:U.shape({createElement:U.func.isRequired,getElementById:U.func.isRequired,activeElement:U.any.isRequired,body:U.any.isRequired}).isRequired,Node:U.func.isRequired}),suppressRefError:U.bool,scrollIntoView:U.func,selectedItem:U.any,isOpen:U.bool,inputValue:U.string,highlightedIndex:U.number,labelId:U.string,inputId:U.string,menuId:U.string,getItemId:U.func});function Ic(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 rw(e,t){var n=t.refKey,r=n!=="ref",o=!bu(e);o&&!r&&!hc.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+'"'),!hc.isForwardRef(e)&&!xu(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Ku={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function iw(e,t,n){var r=e.props,o=e.type,i={};Object.keys(t).forEach(function(s){ow(s,e,t,n),n[s]!==t[s]&&(i[s]=n[s])}),r.onStateChange&&Object.keys(i).length&&r.onStateChange(me({type:o},i))}function ow(e,t,n,r){var o=t.props,i=t.type,s="on"+Gs(e)+"Change";o[s]&&r[e]!==void 0&&r[e]!==n[e]&&o[s](me({type:i},r))}function sw(e,t){return t.changes}var bc=Ws(function(e,t){_u(e,t)},200),aw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?y.useLayoutEffect:y.useEffect,cw="useId"in y?function(t){var n=t.id,r=t.labelId,o=t.menuId,i=t.getItemId,s=t.toggleButtonId,a=t.inputId,c="downshift-"+y.useId();n||(n=c);var f=y.useRef({labelId:r||n+"-label",menuId:o||n+"-menu",getItemId:i||function(u){return n+"-item-"+u},toggleButtonId:s||n+"-toggle-button",inputId:a||n+"-input"});return f.current}:function(t){var n=t.id,r=n===void 0?"downshift-"+Iu():n,o=t.labelId,i=t.menuId,s=t.getItemId,a=t.toggleButtonId,c=t.inputId,f=y.useRef({labelId:o||r+"-label",menuId:i||r+"-menu",getItemId:s||function(u){return r+"-item-"+u},toggleButtonId:a||r+"-toggle-button",inputId:c||r+"-input"});return f.current};function lw(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 Gs(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Vu(e){var t=y.useRef(e);return t.current=e,t}function uw(e,t,n,r){var o=y.useRef(),i=y.useRef(),s=y.useCallback(function(h,w){i.current=w,h=io(h,w.props);var v=e(h,w),p=w.props.stateReducer(h,me({},w,{changes:v}));return p},[e]),a=y.useReducer(s,t,n),c=a[0],f=a[1],u=Vu(t),d=y.useCallback(function(h){return f(me({props:u.current},h))},[u]),g=i.current;return y.useEffect(function(){var h=io(o.current,g==null?void 0:g.props),w=g&&o.current&&!r(h,c);w&&iw(g,h,c),o.current=c},[c,g,r]),[c,d]}var ii={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:sw,scrollIntoView:wu,environment:typeof window>"u"?void 0:window};function Kn(e,t,n){n===void 0&&(n=Ku);var r=e["default"+Gs(t)];return r!==void 0?r:n[t]}function oi(e,t,n){n===void 0&&(n=Ku);var r=e[t];if(r!==void 0)return r;var o=e["initial"+Gs(t)];return o!==void 0?o:Kn(e,t,n)}function dw(e){var t=oi(e,"selectedItem"),n=oi(e,"isOpen"),r=gw(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,f=t.highlightedIndex;return r.length===0?-1:o!==void 0&&f===o&&!s(r[o],o)?o:i!==void 0&&!s(r[i],i)?i:c?r.findIndex(function(u){return a(c)===a(u)}):n<0&&!s(r[r.length-1],r.length-1)?r.length-1:n>0&&!s(r[0],0)?0:-1}function fw(e,t,n){var r=y.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return y.useEffect(function(){if(!e)return xt;var o=n.map(function(u){return u.current});function i(){r.current.isTouchEnd=!1,r.current.isMouseDown=!0}function s(u){r.current.isMouseDown=!1,so(u.target,o,e)||t()}function a(){r.current.isTouchEnd=!1,r.current.isTouchMove=!1}function c(){r.current.isTouchMove=!0}function f(u){r.current.isTouchEnd=!0,!r.current.isTouchMove&&!so(u.target,o,e,!1)&&t()}return e.addEventListener("mousedown",i),e.addEventListener("mouseup",s),e.addEventListener("touchstart",a),e.addEventListener("touchmove",c),e.addEventListener("touchend",f),function(){e.removeEventListener("mousedown",i),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",c),e.removeEventListener("touchend",f)}},[n,e,t]),r.current}var Uu=function(){return xt};process.env.NODE_ENV!=="production"&&(Uu=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 c=a.suppressRefError,f=a.refKey,u=a.elementRef;c||u!=null&&u.current||console.error('downshift: The ref prop "'+f+'" from '+s+" was not applied correctly on your element.")})},[]);var i=y.useCallback(function(s,a,c,f){o.current[s]={suppressRefError:a,refKey:c,elementRef:f}},[]);return i});function pw(e,t,n,r){r===void 0&&(r={});var o=r.document,i=vo();y.useEffect(function(){if(!(!e||i||!o)){var s=e(t);bc(s,o)}},n),y.useEffect(function(){return function(){bc.cancel(),Gv(o)}},[o])}function hw(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 aw(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(o(t),i))},[t]),a}var $u=xt;process.env.NODE_ENV!=="production"&&($u=function(t){var n=t.props,r=t.state,o=y.useRef(n),i=vo();y.useEffect(function(){i||(zs(r,o.current,n),o.current=n)},[r,n,i])});function xc(e,t,n){var r;n===void 0&&(n=!0);var o=((r=e.items)==null?void 0:r.length)&&t>=0;return me({isOpen:!1,highlightedIndex:-1},o&&me({selectedItem:e.items[t],isOpen:Kn(e,"isOpen"),highlightedIndex:Kn(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function mw(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function vo(){var e=y.useRef(!0);return y.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function Cs(e){var t=Kn(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function gw(e){var t=oi(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var Yi={environment:U.shape({addEventListener:U.func.isRequired,removeEventListener:U.func.isRequired,document:U.shape({createElement:U.func.isRequired,getElementById:U.func.isRequired,activeElement:U.any.isRequired,body:U.any.isRequired}).isRequired,Node:U.func.isRequired}),itemToString:U.func,itemToKey:U.func,stateReducer:U.func},qu=me({},Yi,{getA11yStatusMessage:U.func,highlightedIndex:U.number,defaultHighlightedIndex:U.number,initialHighlightedIndex:U.number,isOpen:U.bool,defaultIsOpen:U.bool,initialIsOpen:U.bool,selectedItem:U.any,initialSelectedItem:U.any,defaultSelectedItem:U.any,id:U.string,labelId:U.string,menuId:U.string,getItemId:U.func,toggleButtonId:U.string,onSelectedItemChange:U.func,onHighlightedIndexChange:U.func,onStateChange:U.func,onIsOpenChange:U.func,scrollIntoView:U.func});function yw(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:Cs(o),isOpen:Kn(o,"isOpen"),selectedItem:Kn(o,"selectedItem"),inputValue:Kn(o,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return me({},e,i)}jr(jr({},qu),{items:U.array.isRequired,isItemDisabled:U.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 Qs=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,Xs=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,Ys=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,Zs=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,ea=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,ta=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,na=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,ra=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,ia=process.env.NODE_ENV!=="production"?"__input_change__":8,ao=process.env.NODE_ENV!=="production"?"__input_blur__":9,oa=process.env.NODE_ENV!=="production"?"__input_click__":10,Hu=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,Bu=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,sa=process.env.NODE_ENV!=="production"?"__item_click__":13,Ju=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,Wu=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,zu=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,Gu=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,Qu=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,aa=process.env.NODE_ENV!=="production"?"__function_select_item__":19,Xu=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,Yu=process.env.NODE_ENV!=="production"?"__function_reset__":21,ca=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,Zu=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:ca,FunctionCloseMenu:Gu,FunctionOpenMenu:zu,FunctionReset:Yu,FunctionSelectItem:aa,FunctionSetHighlightedIndex:Qu,FunctionSetInputValue:Xu,FunctionToggleMenu:Wu,InputBlur:ao,InputChange:ia,InputClick:oa,InputKeyDownArrowDown:Qs,InputKeyDownArrowUp:Xs,InputKeyDownEnd:ea,InputKeyDownEnter:ra,InputKeyDownEscape:Ys,InputKeyDownHome:Zs,InputKeyDownPageDown:na,InputKeyDownPageUp:ta,ItemClick:sa,ItemMouseMove:Bu,MenuMouseLeave:Hu,ToggleButtonClick:Ju});function vw(e){var t=dw(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)),me({},t,{inputValue:r})}var ww=me({},qu,{items:U.array.isRequired,isItemDisabled:U.func,inputValue:U.string,defaultInputValue:U.string,initialInputValue:U.string,inputId:U.string,onInputValueChange:U.func});function Iw(e,t,n,r){var o=y.useRef(),i=uw(e,t,n,r),s=i[0],a=i[1],c=vo();return y.useEffect(function(){if(oo(t,"selectedItem")){if(!c){var f=t.itemToKey(t.selectedItem)!==t.itemToKey(o.current);f&&a({type:ca,inputValue:t.itemToString(t.selectedItem)})}o.current=s.selectedItem===o.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[io(s,t),a]}var ed=xt;process.env.NODE_ENV!=="production"&&(ed=function(t,n){U.checkPropTypes(ww,t,"prop",n.name)});var bw=me({},ii,{isItemDisabled:function(){return!1}});function xw(e,t){var n,r=t.type,o=t.props,i=t.altKey,s;switch(r){case sa:s={isOpen:Kn(o,"isOpen"),highlightedIndex:Cs(o),selectedItem:o.items[t.index],inputValue:o.itemToString(o.items[t.index])};break;case Qs: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 Xs:e.isOpen?i?s=xc(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 ra:s=xc(o,e.highlightedIndex);break;case Ys:s=me({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case ta:s={highlightedIndex:Yn(e.highlightedIndex,-10,o.items,o.isItemDisabled,!0)};break;case na: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 ea:s={highlightedIndex:Lr(o.items.length-1,!0,o.items,o.isItemDisabled)};break;case ao:s=me({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 ia:s={isOpen:!0,highlightedIndex:Cs(o),inputValue:t.inputValue};break;case oa:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:si(o,e,0)};break;case aa:s={selectedItem:t.selectedItem,inputValue:o.itemToString(t.selectedItem)};break;case ca:s={inputValue:t.inputValue};break;default:return yw(e,t,Zu)}return me({},e,s)}var Cw=["onMouseLeave","refKey","ref"],_w=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],Ow=["onClick","onPress","refKey","ref"],Ew=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];la.stateChangeTypes=Zu;function la(e){e===void 0&&(e={}),ed(e,la);var t=me({},bw,e),n=t.items,r=t.scrollIntoView,o=t.environment,i=t.getA11yStatusMessage,s=Iw(xw,t,vw,mw),a=s[0],c=s[1],f=a.isOpen,u=a.highlightedIndex,d=a.selectedItem,g=a.inputValue,h=y.useRef(null),w=y.useRef({}),v=y.useRef(null),p=y.useRef(null),x=vo(),m=cw(t),I=y.useRef(),_=Vu({state:a,props:t}),C=y.useCallback(function($){return w.current[m.getItemId($)]},[m]);pw(i,a,[f,u,d,g],o);var S=hw({menuElement:h.current,highlightedIndex:u,isOpen:f,itemRefs:w,scrollIntoView:r,getItemNodeFromIndex:C});$u({props:t,state:a}),y.useEffect(function(){var $=oi(t,"isOpen");$&&v.current&&v.current.focus()},[]),y.useEffect(function(){x||(I.current=n.length)});var R=fw(o,y.useCallback(function(){_.current.state.isOpen&&c({type:ao,selectItem:!1})},[c,_]),y.useMemo(function(){return[h,p,v]},[h.current,p.current,v.current])),N=Uu("getInputProps","getMenuProps");y.useEffect(function(){f||(w.current={})},[f]),y.useEffect(function(){var $;!f||!(o!=null&&o.document)||!(v!=null&&($=v.current)!=null&&$.focus)||o.document.activeElement!==v.current&&v.current.focus()},[f,o]);var A=y.useMemo(function(){return{ArrowDown:function(V){V.preventDefault(),c({type:Qs,altKey:V.altKey})},ArrowUp:function(V){V.preventDefault(),c({type:Xs,altKey:V.altKey})},Home:function(V){_.current.state.isOpen&&(V.preventDefault(),c({type:Zs}))},End:function(V){_.current.state.isOpen&&(V.preventDefault(),c({type:ea}))},Escape:function(V){var L=_.current.state;(L.isOpen||L.inputValue||L.selectedItem||L.highlightedIndex>-1)&&(V.preventDefault(),c({type:Ys}))},Enter:function(V){var L=_.current.state;!L.isOpen||V.which===229||(V.preventDefault(),c({type:ra}))},PageUp:function(V){_.current.state.isOpen&&(V.preventDefault(),c({type:ta}))},PageDown:function(V){_.current.state.isOpen&&(V.preventDefault(),c({type:na}))}}},[c,_]),K=y.useCallback(function($){return me({id:m.labelId,htmlFor:m.inputId},$)},[m]),z=y.useCallback(function($,V){var L,D=$===void 0?{}:$,te=D.onMouseLeave,ne=D.refKey,B=ne===void 0?"ref":ne,re=D.ref,Q=mn(D,Cw),de=V===void 0?{}:V,k=de.suppressRefError,we=k===void 0?!1:k;return N("getMenuProps",we,B,h),me((L={},L[B]=br(re,function(J){h.current=J}),L.id=m.menuId,L.role="listbox",L["aria-labelledby"]=Q&&Q["aria-label"]?void 0:""+m.labelId,L.onMouseLeave=Be(te,function(){c({type:Hu})}),L),Q)},[c,N,m]),H=y.useCallback(function($){var V,L,D=$===void 0?{}:$,te=D.item,ne=D.index,B=D.refKey,re=B===void 0?"ref":B,Q=D.ref,de=D.onMouseMove,k=D.onMouseDown,we=D.onClick;D.onPress;var J=D.disabled,Se=mn(D,_w);J!==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,be=lw(te,ne,Ye.items,"Pass either item or index to getItemProps!"),Dt=be[0],Ze=be[1],wt=Ye.isItemDisabled(Dt,Ze),Mt="onClick",kt=we,et=function(){R.isTouchEnd||Ze===Ue.highlightedIndex||(S.current=!1,c({type:Bu,index:Ze,disabled:wt}))},Ge=function(){c({type:sa,index:Ze})},$e=function(jt){return jt.preventDefault()};return me((V={},V[re]=br(Q,function(Pe){Pe&&(w.current[m.getItemId(Ze)]=Pe)}),V["aria-disabled"]=wt,V["aria-selected"]=Ze===Ue.highlightedIndex,V.id=m.getItemId(Ze),V.role="option",V),!wt&&(L={},L[Mt]=Be(kt,Ge),L),{onMouseMove:Be(de,et),onMouseDown:Be(k,$e)},Se)},[c,m,_,R,S]),ee=y.useCallback(function($){var V,L=$===void 0?{}:$,D=L.onClick;L.onPress;var te=L.refKey,ne=te===void 0?"ref":te,B=L.ref,re=mn(L,Ow),Q=_.current.state,de=function(){c({type:Ju})};return me((V={},V[ne]=br(B,function(k){p.current=k}),V["aria-controls"]=m.menuId,V["aria-expanded"]=Q.isOpen,V.id=m.toggleButtonId,V.tabIndex=-1,V),!re.disabled&&me({},{onClick:Be(D,de)}),re)},[c,_,m]),q=y.useCallback(function($,V){var L,D=$===void 0?{}:$,te=D.onKeyDown,ne=D.onChange,B=D.onInput,re=D.onBlur;D.onChangeText;var Q=D.onClick,de=D.refKey,k=de===void 0?"ref":de,we=D.ref,J=mn(D,Ew),Se=V===void 0?{}:V,Ve=Se.suppressRefError,Ye=Ve===void 0?!1:Ve;N("getInputProps",Ye,k,v);var Ue=_.current.state,be=function($e){var Pe=bs($e);Pe&&A[Pe]&&A[Pe]($e)},Dt=function($e){c({type:ia,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;c({type:ao,selectItem:!Pe})}},wt=function(){c({type:oa})},Mt="onChange",kt={};if(!J.disabled){var et;kt=(et={},et[Mt]=Be(ne,B,Dt),et.onKeyDown=Be(te,be),et.onBlur=Be(re,Ze),et.onClick=Be(Q,wt),et)}return me((L={},L[k]=br(we,function(Ge){v.current=Ge}),L["aria-activedescendant"]=Ue.isOpen&&Ue.highlightedIndex>-1?m.getItemId(Ue.highlightedIndex):"",L["aria-autocomplete"]="list",L["aria-controls"]=m.menuId,L["aria-expanded"]=Ue.isOpen,L["aria-labelledby"]=J&&J["aria-label"]?void 0:m.labelId,L.autoComplete="off",L.id=m.inputId,L.role="combobox",L.value=Ue.inputValue,L),kt,J)},[c,m,o,A,_,R,N]),ae=y.useCallback(function(){c({type:Wu})},[c]),X=y.useCallback(function(){c({type:Gu})},[c]),Y=y.useCallback(function(){c({type:zu})},[c]),fe=y.useCallback(function($){c({type:Qu,highlightedIndex:$})},[c]),Ie=y.useCallback(function($){c({type:aa,selectedItem:$})},[c]),P=y.useCallback(function($){c({type:Xu,inputValue:$})},[c]),j=y.useCallback(function(){c({type:Yu})},[c]);return{getItemProps:H,getLabelProps:K,getMenuProps:z,getInputProps:q,getToggleButtonProps:ee,toggleMenu:ae,openMenu:Y,closeMenu:X,setHighlightedIndex:fe,setInputValue:P,selectItem:Ie,reset:j,highlightedIndex:u,isOpen:f,selectedItem:d,inputValue:g}}Yi.stateReducer,Yi.itemToKey,Yi.environment,U.array,U.array,U.array,U.func,U.number,U.number,U.number,U.func,U.func,U.string,U.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 Sw="_comboboxContainer_1lcc8_1",Nw="_label_1lcc8_8",Tw="_inputContainer_1lcc8_12",Rw="_input_1lcc8_12",Aw="_toggleButton_1lcc8_33",Pw="_menu_1lcc8_39",Fw="_menuBottom_1lcc8_55",Dw="_menuTop_1lcc8_61",Mw="_menuItem_1lcc8_66",kw="_highlighted_1lcc8_73",jw="_selected_1lcc8_77",Lw="_hidden_1lcc8_81",Ut={comboboxContainer:Sw,label:Nw,inputContainer:Tw,input:Rw,toggleButton:Aw,menu:Pw,menuBottom:Fw,menuTop:Dw,menuItem:Mw,highlighted:kw,selected:jw,hidden:Lw};function Kw(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function td({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:o,style:i,menuPosition:s="bottom"}){const[a,c]=y.useState(e),f=y.useRef(null);y.useEffect(()=>c(e),[e]);const u=y.useCallback(R=>{(R==null?void 0:R.length)>0?c(e.filter(Kw(R))):c(e)},[e]),{isOpen:d,getToggleButtonProps:g,getMenuProps:h,getInputProps:w,highlightedIndex:v,getItemProps:p,setInputValue:x,selectedItem:m}=la({items:a,selectedItem:t?e.find(R=>R.value===t):null,itemToString:R=>(R==null?void 0:R.label)||"",onInputValueChange:({inputValue:R})=>u(R),onSelectedItemChange:({selectedItem:R})=>{var N;n(R),(N=f.current)==null||N.blur()}}),I=()=>{x(""),c(e)},_=()=>I(),C=y.useMemo(()=>{var R;return(R=e.find(N=>N.value===t))==null?void 0:R.label},[e,t]),S=()=>{t&&C&&t!==(m==null?void 0:m.value)&&x(C||"")};return l.jsxs("div",{style:{position:"relative",...i},children:[l.jsx("div",{className:Ut.comboboxContainer,children:l.jsxs("div",{className:Ut.inputContainer,children:[l.jsx("input",{style:{border:"none"},disabled:o,placeholder:r,className:Ut.input,...w({onFocus:_,onBlur:S,ref:f})}),l.jsx("button",{style:{border:"none"},disabled:o,"aria-label":"toggle menu",className:Ut.toggleButton,type:"button",...g(),children:d?l.jsx(l.Fragment,{children:"↑"}):l.jsx(l.Fragment,{children:"↓"})})]})}),l.jsx("ul",{className:`${Ut.menu} ${d&&e.length?"":Ut.hidden} ${s==="top"?Ut.menuTop:Ut.menuBottom}`,...h(),children:d&&a.map((R,N)=>l.jsx("li",{className:`${Ut.menuItem} ${v===N?Ut.highlighted:""} ${t===(R==null?void 0:R.value)?Ut.selected:""}`,...p({item:R,index:N}),children:l.jsx("span",{children:R.label})},R.id))})]})}const Kr=Math.min,ar=Math.max,co=Math.round,Ji=Math.floor,qn=e=>({x:e,y:e}),Vw={left:"right",right:"left",bottom:"top",top:"bottom"},Uw={start:"end",end:"start"};function _s(e,t,n){return ar(e,Kr(t,n))}function bi(e,t){return typeof e=="function"?e(t):e}function fr(e){return e.split("-")[0]}function xi(e){return e.split("-")[1]}function nd(e){return e==="x"?"y":"x"}function ua(e){return e==="y"?"height":"width"}function Vr(e){return["top","bottom"].includes(fr(e))?"y":"x"}function da(e){return nd(Vr(e))}function $w(e,t,n){n===void 0&&(n=!1);const r=xi(e),o=da(e),i=ua(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=lo(s)),[s,lo(s)]}function qw(e){const t=lo(e);return[Os(e),t,Os(t)]}function Os(e){return e.replace(/start|end/g,t=>Uw[t])}function Hw(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 Bw(e,t,n,r){const o=xi(e);let i=Hw(fr(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(Os)))),i}function lo(e){return e.replace(/left|right|bottom|top/g,t=>Vw[t])}function Jw(e){return{top:0,right:0,bottom:0,left:0,...e}}function rd(e){return typeof e!="number"?Jw(e):{top:e,right:e,bottom:e,left:e}}function uo(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Cc(e,t,n){let{reference:r,floating:o}=e;const i=Vr(t),s=da(t),a=ua(s),c=fr(t),f=i==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,g=r[a]/2-o[a]/2;let h;switch(c){case"top":h={x:u,y:r.y-o.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-o.width,y:d};break;default:h={x:r.x,y:r.y}}switch(xi(t)){case"start":h[s]-=g*(n&&f?-1:1);break;case"end":h[s]+=g*(n&&f?-1:1);break}return h}const Ww=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 f=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=Cc(f,r,c),g=r,h={},w=0;for(let v=0;v<a.length;v++){const{name:p,fn:x}=a[v],{x:m,y:I,data:_,reset:C}=await x({x:u,y:d,initialPlacement:r,placement:g,strategy:o,middlewareData:h,rects:f,platform:s,elements:{reference:e,floating:t}});u=m??u,d=I??d,h={...h,[p]:{...h[p],..._}},C&&w<=50&&(w++,typeof C=="object"&&(C.placement&&(g=C.placement),C.rects&&(f=C.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:u,y:d}=Cc(f,g,c)),v=-1)}return{x:u,y:d,placement:g,strategy:o,middlewareData:h}};async function id(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:c}=e,{boundary:f="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:g=!1,padding:h=0}=bi(t,e),w=rd(h),p=a[g?d==="floating"?"reference":"floating":d],x=uo(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:f,rootBoundary:u,strategy:c})),m=d==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,I=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),_=await(i.isElement==null?void 0:i.isElement(I))?await(i.getScale==null?void 0:i.getScale(I))||{x:1,y:1}:{x:1,y:1},C=uo(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:m,offsetParent:I,strategy:c}):m);return{top:(x.top-C.top+w.top)/_.y,bottom:(C.bottom-x.bottom+w.bottom)/_.y,left:(x.left-C.left+w.left)/_.x,right:(C.right-x.right+w.right)/_.x}}const zw=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:f,padding:u=0}=bi(e,t)||{};if(f==null)return{};const d=rd(u),g={x:n,y:r},h=da(o),w=ua(h),v=await s.getDimensions(f),p=h==="y",x=p?"top":"left",m=p?"bottom":"right",I=p?"clientHeight":"clientWidth",_=i.reference[w]+i.reference[h]-g[h]-i.floating[w],C=g[h]-i.reference[h],S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(f));let R=S?S[I]:0;(!R||!await(s.isElement==null?void 0:s.isElement(S)))&&(R=a.floating[I]||i.floating[w]);const N=_/2-C/2,A=R/2-v[w]/2-1,K=Kr(d[x],A),z=Kr(d[m],A),H=K,ee=R-v[w]-z,q=R/2-v[w]/2+N,ae=_s(H,q,ee),X=!c.arrow&&xi(o)!=null&&q!==ae&&i.reference[w]/2-(q<H?K:z)-v[w]/2<0,Y=X?q<H?q-H:q-ee:0;return{[h]:g[h]+Y,data:{[h]:ae,centerOffset:q-ae-Y,...X&&{alignmentOffset:Y}},reset:X}}}),Gw=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:f}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:g,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:v=!0,...p}=bi(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const x=fr(o),m=Vr(a),I=fr(a)===a,_=await(c.isRTL==null?void 0:c.isRTL(f.floating)),C=g||(I||!v?[lo(a)]:qw(a)),S=w!=="none";!g&&S&&C.push(...Bw(a,v,w,_));const R=[a,...C],N=await id(t,p),A=[];let K=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&A.push(N[x]),d){const q=$w(o,s,_);A.push(N[q[0]],N[q[1]])}if(K=[...K,{placement:o,overflows:A}],!A.every(q=>q<=0)){var z,H;const q=(((z=i.flip)==null?void 0:z.index)||0)+1,ae=R[q];if(ae)return{data:{index:q,overflows:K},reset:{placement:ae}};let X=(H=K.filter(Y=>Y.overflows[0]<=0).sort((Y,fe)=>Y.overflows[1]-fe.overflows[1])[0])==null?void 0:H.placement;if(!X)switch(h){case"bestFit":{var ee;const Y=(ee=K.filter(fe=>{if(S){const Ie=Vr(fe.placement);return Ie===m||Ie==="y"}return!0}).map(fe=>[fe.placement,fe.overflows.filter(Ie=>Ie>0).reduce((Ie,P)=>Ie+P,0)]).sort((fe,Ie)=>fe[1]-Ie[1])[0])==null?void 0:ee[0];Y&&(X=Y);break}case"initialPlacement":X=a;break}if(o!==X)return{reset:{placement:X}}}return{}}}};async function Qw(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=xi(n),c=Vr(n)==="y",f=["left","top"].includes(s)?-1:1,u=i&&c?-1:1,d=bi(t,e);let{mainAxis:g,crossAxis:h,alignmentAxis:w}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof w=="number"&&(h=a==="end"?w*-1:w),c?{x:h*u,y:g*f}:{x:g*f,y:h*u}}const Xw=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 Qw(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}}}}},Yw=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:m}=p;return{x,y:m}}},...c}=bi(e,t),f={x:n,y:r},u=await id(t,c),d=Vr(fr(o)),g=nd(d);let h=f[g],w=f[d];if(i){const p=g==="y"?"top":"left",x=g==="y"?"bottom":"right",m=h+u[p],I=h-u[x];h=_s(m,h,I)}if(s){const p=d==="y"?"top":"left",x=d==="y"?"bottom":"right",m=w+u[p],I=w-u[x];w=_s(m,w,I)}const v=a.fn({...t,[g]:h,[d]:w});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[g]:i,[d]:s}}}}}};function wo(){return typeof window<"u"}function Qr(e){return od(e)?(e.nodeName||"").toLowerCase():"#document"}function Ct(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function on(e){var t;return(t=(od(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function od(e){return wo()?e instanceof Node||e instanceof Ct(e).Node:!1}function zt(e){return wo()?e instanceof Element||e instanceof Ct(e).Element:!1}function rn(e){return wo()?e instanceof HTMLElement||e instanceof Ct(e).HTMLElement:!1}function _c(e){return!wo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ct(e).ShadowRoot}function Ci(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 Zw(e){return["table","td","th"].includes(Qr(e))}function Io(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function fa(e){const t=pa(),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 eI(e){let t=Hn(e);for(;rn(t)&&!Ur(t);){if(fa(t))return t;if(Io(t))return null;t=Hn(t)}return null}function pa(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ur(e){return["html","body","#document"].includes(Qr(e))}function Gt(e){return Ct(e).getComputedStyle(e)}function bo(e){return zt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Hn(e){if(Qr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||_c(e)&&e.host||on(e);return _c(t)?t.host:t}function sd(e){const t=Hn(e);return Ur(t)?e.ownerDocument?e.ownerDocument.body:e.body:rn(t)&&Ci(t)?t:sd(t)}function li(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=sd(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=Ct(o);if(i){const a=Es(s);return t.concat(s,s.visualViewport||[],Ci(o)?o:[],a&&n?li(a):[])}return t.concat(o,li(o,[],n))}function Es(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ad(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=co(n)!==i||co(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function ha(e){return zt(e)?e:e.contextElement}function Cr(e){const t=ha(e);if(!rn(t))return qn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=ad(t);let s=(i?co(n.width):n.width)/r,a=(i?co(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const tI=qn(0);function cd(e){const t=Ct(e);return!pa()||!t.visualViewport?tI:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function nI(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ct(e)?!1:t}function pr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=ha(e);let s=qn(1);t&&(r?zt(r)&&(s=Cr(r)):s=Cr(e));const a=nI(i,n,r)?cd(i):qn(0);let c=(o.left+a.x)/s.x,f=(o.top+a.y)/s.y,u=o.width/s.x,d=o.height/s.y;if(i){const g=Ct(i),h=r&&zt(r)?Ct(r):r;let w=g,v=Es(w);for(;v&&r&&h!==w;){const p=Cr(v),x=v.getBoundingClientRect(),m=Gt(v),I=x.left+(v.clientLeft+parseFloat(m.paddingLeft))*p.x,_=x.top+(v.clientTop+parseFloat(m.paddingTop))*p.y;c*=p.x,f*=p.y,u*=p.x,d*=p.y,c+=I,f+=_,w=Ct(v),v=Es(w)}}return uo({width:u,height:d,x:c,y:f})}function rI(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=on(r),a=t?Io(t.floating):!1;if(r===s||a&&i)return n;let c={scrollLeft:0,scrollTop:0},f=qn(1);const u=qn(0),d=rn(r);if((d||!d&&!i)&&((Qr(r)!=="body"||Ci(s))&&(c=bo(r)),rn(r))){const g=pr(r);f=Cr(r),u.x=g.x+r.clientLeft,u.y=g.y+r.clientTop}return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-c.scrollLeft*f.x+u.x,y:n.y*f.y-c.scrollTop*f.y+u.y}}function iI(e){return Array.from(e.getClientRects())}function Ss(e,t){const n=bo(e).scrollLeft;return t?t.left+n:pr(on(e)).left+n}function oI(e){const t=on(e),n=bo(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+Ss(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 sI(e,t){const n=Ct(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 f=pa();(!f||f&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}return{width:i,height:s,x:a,y:c}}function aI(e,t){const n=pr(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=rn(e)?Cr(e):qn(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,c=o*i.x,f=r*i.y;return{width:s,height:a,x:c,y:f}}function Oc(e,t,n){let r;if(t==="viewport")r=sI(e,n);else if(t==="document")r=oI(on(e));else if(zt(t))r=aI(t,n);else{const o=cd(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return uo(r)}function ld(e,t){const n=Hn(e);return n===t||!zt(n)||Ur(n)?!1:Gt(n).position==="fixed"||ld(n,t)}function cI(e,t){const n=t.get(e);if(n)return n;let r=li(e,[],!1).filter(a=>zt(a)&&Qr(a)!=="body"),o=null;const i=Gt(e).position==="fixed";let s=i?Hn(e):e;for(;zt(s)&&!Ur(s);){const a=Gt(s),c=fa(s);!c&&a.position==="fixed"&&(o=null),(i?!c&&!o:!c&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Ci(s)&&!c&&ld(e,s))?r=r.filter(u=>u!==s):o=a,s=Hn(s)}return t.set(e,r),r}function lI(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?Io(t)?[]:cI(t,this._c):[].concat(n),r],a=s[0],c=s.reduce((f,u)=>{const d=Oc(t,u,o);return f.top=ar(d.top,f.top),f.right=Kr(d.right,f.right),f.bottom=Kr(d.bottom,f.bottom),f.left=ar(d.left,f.left),f},Oc(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function uI(e){const{width:t,height:n}=ad(e);return{width:t,height:n}}function dI(e,t,n){const r=rn(t),o=on(t),i=n==="fixed",s=pr(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=qn(0);if(r||!r&&!i)if((Qr(t)!=="body"||Ci(o))&&(a=bo(t)),r){const h=pr(t,!0,i,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else o&&(c.x=Ss(o));let f=0,u=0;if(o&&!r&&!i){const h=o.getBoundingClientRect();u=h.top+a.scrollTop,f=h.left+a.scrollLeft-Ss(o,h)}const d=s.left+a.scrollLeft-c.x-f,g=s.top+a.scrollTop-c.y-u;return{x:d,y:g,width:s.width,height:s.height}}function zo(e){return Gt(e).position==="static"}function Ec(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 ud(e,t){const n=Ct(e);if(Io(e))return n;if(!rn(e)){let o=Hn(e);for(;o&&!Ur(o);){if(zt(o)&&!zo(o))return o;o=Hn(o)}return n}let r=Ec(e,t);for(;r&&Zw(r)&&zo(r);)r=Ec(r,t);return r&&Ur(r)&&zo(r)&&!fa(r)?n:r||eI(e)||n}const fI=async function(e){const t=this.getOffsetParent||ud,n=this.getDimensions,r=await n(e.floating);return{reference:dI(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function pI(e){return Gt(e).direction==="rtl"}const hI={convertOffsetParentRelativeRectToViewportRelativeRect:rI,getDocumentElement:on,getClippingRect:lI,getOffsetParent:ud,getElementRects:fI,getClientRects:iI,getDimensions:uI,getScale:Cr,isElement:zt,isRTL:pI};function mI(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:f,top:u,width:d,height:g}=e.getBoundingClientRect();if(a||t(),!d||!g)return;const h=Ji(u),w=Ji(o.clientWidth-(f+d)),v=Ji(o.clientHeight-(u+g)),p=Ji(f),m={rootMargin:-h+"px "+-w+"px "+-v+"px "+-p+"px",threshold:ar(0,Kr(1,c))||1};let I=!0;function _(C){const S=C[0].intersectionRatio;if(S!==c){if(!I)return s();S?s(!1,S):r=setTimeout(()=>{s(!1,1e-7)},1e3)}I=!1}try{n=new IntersectionObserver(_,{...m,root:o.ownerDocument})}catch{n=new IntersectionObserver(_,m)}n.observe(e)}return s(!0),i}function gI(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,f=ha(e),u=o||i?[...f?li(f):[],...li(t)]:[];u.forEach(x=>{o&&x.addEventListener("scroll",n,{passive:!0}),i&&x.addEventListener("resize",n)});const d=f&&a?mI(f,n):null;let g=-1,h=null;s&&(h=new ResizeObserver(x=>{let[m]=x;m&&m.target===f&&h&&(h.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var I;(I=h)==null||I.observe(t)})),n()}),f&&!c&&h.observe(f),h.observe(t));let w,v=c?pr(e):null;c&&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,w=requestAnimationFrame(p)}return n(),()=>{var x;u.forEach(m=>{o&&m.removeEventListener("scroll",n),i&&m.removeEventListener("resize",n)}),d==null||d(),(x=h)==null||x.disconnect(),h=null,c&&cancelAnimationFrame(w)}}const yI=Xw,vI=Yw,wI=Gw,II=zw,Sc=(e,t,n)=>{const r=new Map,o={platform:hI,...n},i={...o.platform,_c:r};return Ww(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 yI="react-tooltip-core-styles",vI="react-tooltip-base-styles",_c={core:!1,base:!1};function Cc({css:e,id:t=vI,type:n="base",ref:r}){var o,i;if(!e||typeof document>"u"||_c[n]||n==="core"&&typeof process<"u"&&(!((o=process==null?void 0:process.env)===null||o===void 0)&&o.REACT_TOOLTIP_DISABLE_CORE_STYLES)||n!=="base"&&typeof process<"u"&&(!((i=process==null?void 0:process.env)===null||i===void 0)&&i.REACT_TOOLTIP_DISABLE_BASE_STYLES))return;n==="core"&&(t=yI),r||(r={});const{insertAt:s}=r;if(document.getElementById(t))return;const a=document.head||document.getElementsByTagName("head")[0],c=document.createElement("style");c.id=t,c.type="text/css",s==="top"&&a.firstChild?a.insertBefore(c,a.firstChild):a.appendChild(c),c.styleSheet?c.styleSheet.cssText=e:c.appendChild(document.createTextNode(e)),_c[n]=!0}const Oc=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10,strategy:i="absolute",middlewares:s=[pI(Number(o)),mI({fallbackAxisSideDirection:"start"}),hI({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(gI({element:n,padding:5})),xc(e,t,{placement:r,strategy:i,middleware:c}).then(({x:u,y:d,placement:f,middlewareData:h})=>{var m,x;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=(x={top:"bottom",right:"left",bottom:"top",left:"right"}[f.split("-")[0]])!==null&&x!==void 0?x:"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}})):xc(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}))},Ec=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),Sc=(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},Nc=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",Os=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((o,i)=>Os(o,t[i]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Nc(e)||!Nc(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(o=>Os(e[o],t[o]))},wI=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"})},Tc=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(wI(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},II=typeof window<"u"?v.useLayoutEffect:v.useEffect,Tt=e=>{e.current&&(clearTimeout(e.current),e.current=null)},bI="DEFAULT_TOOLTIP_ID",xI={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},_I=v.createContext({getTooltipData:()=>xI});function od(e=bI){return v.useContext(_I).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"},Jo={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 CI=({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:x=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:Ie=!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),[we,H]=v.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[Se,Ve]=v.useState(!1),[Ye,Ue]=v.useState(!1),[be,Dt]=v.useState(null),Ze=v.useRef(!1),wt=v.useRef(null),{anchorRefs:Mt,setActiveAnchor:kt}=od(t),et=v.useRef(!1),[Ge,$e]=v.useState([]),Pe=v.useRef(!1),jt=d||u.includes("click"),dt=jt||(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&&jt&&Object.assign(sn,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const Xt=R?{...R}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!R&&jt&&Object.assign(Xt,{mouseleave:!1,blur:!1,mouseout:!1});const It=F?{...F}:{escape:I||!1,scroll:C||!1,resize:S||!1,clickOutsideAnchor:dt||!1};U&&(Object.assign(sn,{mouseover:!1,focus:!1,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(Xt,{mouseout:!1,blur:!1,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(It,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),II(()=>(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(Se!==Ze.current)if(Tt(M),Ze.current=Se,Se)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),Dt(null),B==null||B()},W+25)}},[Se]);const an=W=>{H(ae=>Os(ae,W)?ae:W)},In=(W=x)=>{Tt(G),Ye?Fe(!0):G.current=setTimeout(()=>{Fe(!0)},W)},cn=(W=w)=>{Tt(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 kt({current:null});x?In():Fe(!0),$(le),kt({current:le}),Tt(de)},ft=()=>{y?cn(w||100):w?cn():Fe(!1),Tt(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})};Oc({place:(le=be==null?void 0:be.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)})},bn=W=>{if(!W)return;const ae=W,le={x:ae.clientX,y:ae.clientY};ln(le),wt.current=le},Bn=W=>{var ae;if(!Se)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),Tt(G)))},xn=Sc(Hn,50),Ae=Sc(ft,50),it=W=>{Ae.cancel(),xn(W)},ie=()=>{xn.cancel(),Ae()},me=v.useCallback(()=>{var W,ae;const le=(W=be==null?void 0:be.position)!==null&&W!==void 0?W:J;le?ln(le):p?wt.current&&ln(wt.current):j!=null&&j.isConnected&&Oc({place:(ae=be==null?void 0:be.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)})},[Se,j,se,Q,a,be==null?void 0:be.place,c,f,J,be==null?void 0:be.position,p]);v.useEffect(()=>{var W,ae;const le=new Set(Mt);Ge.forEach(ye=>{ce!=null&&ce(ye)||le.add({current:ye})});const Ke=document.querySelector(`[id='${i}']`);Ke&&!(ce!=null&&ce(Ke))&&le.add({current:Ke});const He=()=>{Fe(!1)},pt=Tc(j),Qe=Tc(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=fI(j,q.current,me,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const ht=ye=>{ye.key==="Escape"&&Fe(!1)};It.escape&&window.addEventListener("keydown",ht),It.clickOutsideAnchor&&window.addEventListener("click",Bn);const Ne=[],_n=ye=>!!(ye!=null&&ye.target&&(j!=null&&j.contains(ye.target))),Ro=ye=>{Se&&_n(ye)||Hn(ye)},Lt=ye=>{Se&&_n(ye)&&ft()},Ci=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],Oi=["click","dblclick","mousedown","mouseup"];Object.entries(sn).forEach(([ye,Kt])=>{Kt&&(Ci.includes(ye)?Ne.push({event:ye,listener:it}):Oi.includes(ye)&&Ne.push({event:ye,listener:Ro}))}),Object.entries(Xt).forEach(([ye,Kt])=>{Kt&&(Ci.includes(ye)?Ne.push({event:ye,listener:ie}):Oi.includes(ye)&&Ne.push({event:ye,listener:Lt}))}),p&&Ne.push({event:"pointermove",listener:bn});const Ei=()=>{et.current=!0},Si=()=>{et.current=!1,ft()},Ni=y&&(Xt.mouseout||Xt.mouseleave);return Ni&&((W=q.current)===null||W===void 0||W.addEventListener("mouseover",Ei),(ae=q.current)===null||ae===void 0||ae.addEventListener("mouseout",Si)),Ne.forEach(({event:ye,listener:Kt})=>{le.forEach(Xr=>{var Jn;(Jn=Xr.current)===null||Jn===void 0||Jn.addEventListener(ye,Kt)})}),()=>{var ye,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),Ni&&((ye=q.current)===null||ye===void 0||ye.removeEventListener("mouseover",Ei),(Kt=q.current)===null||Kt===void 0||Kt.removeEventListener("mouseout",Si)),Ne.forEach(({event:Xr,listener:Jn})=>{le.forEach(Ao=>{var Yr;(Yr=Ao.current)===null||Yr===void 0||Yr.removeEventListener(Xr,Jn)})})}},[j,me,Ye,Mt,Ge,T,R,F,jt,x,w]),v.useEffect(()=>{var W,ae;let le=(ae=(W=be==null?void 0:be.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 _n;return!!(!((_n=Ne==null?void 0:Ne.contains)===null||_n===void 0)&&_n.call(Ne,j))&&(Ue(!1),Fe(!1),$(null),Tt(G),Tt(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,be==null?void 0:be.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(()=>(Ie&&Fe(!0),()=>{Tt(G),Tt(de)}),[]),v.useEffect(()=>{var W;let ae=(W=be==null?void 0:be.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,be==null?void 0:be.anchorSelect]),v.useEffect(()=>{G.current&&(Tt(G),In(x))},[x]);const qe=(ee=be==null?void 0:be.content)!==null&&ee!==void 0?ee:se,un=Se&&Object.keys(we.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`)}Dt(W??null),W!=null&&W.delay?In(W.delay):Fe(!0)},close:W=>{W!=null&&W.delay?cn(W.delay):Fe(!1)},activeAnchor:j,place:we.place,isOpen:!!(Ye&&!_&&qe&&un)})),Ye&&!_&&qe?v.createElement(m,{id:t,role:Z,className:Pt("react-tooltip",wr.tooltip,Jo.tooltip,Jo[o],n,`react-tooltip__place-${we.place}`,wr[un?"show":"closing"],un?"react-tooltip__show":"react-tooltip__closing",f==="fixed"&&wr.fixed,y&&wr.clickable),onTransitionEnd:W=>{Tt(M),Se||W.propertyName!=="opacity"||(Ue(!1),Dt(null),B==null||B())},style:{...Q,...we.tooltipStyles,opacity:L!==void 0&&un?L:void 0},ref:q},qe,v.createElement(m,{className:Pt("react-tooltip-arrow",wr.arrow,Jo.arrow,r,g&&wr.noArrow),style:{...we.tooltipArrowStyles,background:D?`linear-gradient(to right bottom, transparent 50%, ${D} 50%)`:void 0},ref:te})):null},OI=({content:e})=>v.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),EI=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:x=!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:Ie,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,we]=v.useState(u),[H,Se]=v.useState(c),[Ve,Ye]=v.useState(d),[Ue,be]=v.useState(_),[Dt,Ze]=v.useState(g),[wt,Mt]=v.useState(y),[kt,et]=v.useState(I),[Ge,$e]=v.useState(f),[Pe,jt]=v.useState(m),[dt,sn]=v.useState(w),[Xt,It]=v.useState(null),[Fe,an]=v.useState(null),In=v.useRef(ge),{anchorRefs:cn,activeAnchor:Hn}=od(e),ft=Ae=>Ae==null?void 0:Ae.getAttributeNames().reduce((it,ie)=>{var me;return ie.startsWith("data-tooltip-")&&(it[ie.replace(/^data-tooltip-/,"")]=(me=Ae==null?void 0:Ae.getAttribute(ie))!==null&&me!==void 0?me:null),it},{}),ln=Ae=>{const it={place:ie=>{var me;we((me=ie)!==null&&me!==void 0?me:u)},content:ie=>{te(ie??r)},html:ie=>{de(ie??o)},variant:ie=>{var me;Se((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(" ");jt(me??m)},"position-strategy":ie=>{var me;sn((me=ie)!==null&&me!==void 0?me:w)},"delay-show":ie=>{be(ie===null?_:Number(ie))},"delay-hide":ie=>{Ze(ie===null?g:Number(ie))},float:ie=>{Mt(ie===null?y:ie==="true")},hidden:ie=>{et(ie===null?I:ie==="true")},"class-name":ie=>{It(ie)}};Object.values(it).forEach(ie=>ie(null)),Object.entries(Ae).forEach(([ie,me])=>{var qe;(qe=it[ie])===null||qe===void 0||qe.call(it,me)})};v.useEffect(()=>{te(r)},[r]),v.useEffect(()=>{de(o)},[o]),v.useEffect(()=>{we(u)},[u]),v.useEffect(()=>{Se(c)},[c]),v.useEffect(()=>{Ye(d)},[d]),v.useEffect(()=>{be(_)},[_]),v.useEffect(()=>{Ze(g)},[g]),v.useEffect(()=>{Mt(y)},[y]),v.useEffect(()=>{et(I)},[I]),v.useEffect(()=>{sn(w)},[w]),v.useEffect(()=>{In.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 it=new Set(cn);let ie=n;if(!ie&&e&&(ie=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),ie)try{document.querySelectorAll(ie).forEach(ae=>{it.add({current:ae})})}catch{console.warn(`[react-tooltip] "${ie}" is not a valid CSS selector`)}const me=document.querySelector(`[id='${t}']`);if(me&&it.add({current:me}),!it.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."),Ie&&!Ec("border",`${Ie}`)&&console.warn(`[react-tooltip] "${Ie}" is not a valid \`border\`.`),B!=null&&B.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),A&&!Ec("opacity",`${A}`)&&console.warn(`[react-tooltip] "${A}" is not a valid \`opacity\`.`)},[]);let bn=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});bn=Ae?v.createElement("div",{ref:Bn,className:"react-tooltip-content-wrapper"},Ae):null}else q&&(bn=q);G&&(bn=v.createElement(OI,{content:G}));const xn={forwardRef:ee,id:e,anchorId:t,anchorSelect:n,className:Pt(s,Xt),classNameArrow:a,content:bn,contentWrapperRef:Bn,place:M,variant:H,offset:Ve,wrapper:Ge,events:Pe,openOnClick:x,positionStrategy:dt,middlewares:p,delayShow:Ue,delayHide:Dt,float:wt,hidden:kt,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:Ie,opacity:A,arrowColor:j,setIsOpen:$,afterShow:K,afterHide:L,disableTooltip:D,activeAnchor:Fe,setActiveAnchor:Ae=>an(Ae),role:Z};return v.createElement(CI,{...xn})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||Cc({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||Cc({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 SI(){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 NI({id:e,tooltipText:t}){return l.jsxs(l.Fragment,{children:[l.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:SI()}),l.jsx(EI,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}const sd=v.createContext(null);function ad(){const e=v.useContext(sd);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const cd=v.createContext(()=>{});function TI(){const e=v.useContext(cd);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}var ld=Symbol.for("immer-nothing"),Rc=Symbol.for("immer-draftable"),Ct=Symbol.for("immer-state"),RI=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=RI[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 Ur=Object.getPrototypeOf;function $r(e){return!!e&&!!e[Ct]}function hr(e){var t;return e?ud(e)||Array.isArray(e)||!!e[Rc]||!!((t=e.constructor)!=null&&t[Rc])||Io(e)||bo(e):!1}var AI=Object.prototype.constructor.toString();function ud(e){if(!e||typeof e!="object")return!1;const t=Ur(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)===AI}function lo(e,t){wo(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function wo(e){const t=e[Ct];return t?t.type_:Array.isArray(e)?1:Io(e)?2:bo(e)?3:0}function Es(e,t){return wo(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function dd(e,t,n){const r=wo(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function PI(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Io(e){return e instanceof Map}function bo(e){return e instanceof Set}function Qn(e){return e.copy_||e.base_}function Ss(e,t){if(Io(e))return new Map(e);if(bo(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=ud(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(Ur(e),r)}else{const r=Ur(e);if(r!==null&&n)return{...e};const o=Object.create(r);return Object.assign(o,e)}}function pa(e,t=!1){return xo(e)||$r(e)||!hr(e)||(wo(e)>1&&(e.set=e.add=e.clear=e.delete=FI),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>pa(r,!0))),e}function FI(){yt(2)}function xo(e){return Object.isFrozen(e)}var DI={};function mr(e){const t=DI[e];return t||yt(0,e),t}var ui;function fd(){return ui}function MI(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Ac(e,t){t&&(mr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ns(e){Ts(e),e.drafts_.forEach(kI),e.drafts_=null}function Ts(e){e===ui&&(ui=e.parent_)}function Pc(e){return ui=MI(ui,e)}function kI(e){const t=e[Ct];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Fc(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Ct].modified_&&(Ns(t),yt(4)),hr(e)&&(e=uo(t,e),t.parent_||fo(t,e)),t.patches_&&mr("Patches").generateReplacementPatches_(n[Ct].base_,e,t.patches_,t.inversePatches_)):e=uo(t,n,[]),Ns(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ld?e:void 0}function uo(e,t,n){if(xo(t))return t;const r=t[Ct];if(!r)return lo(t,(o,i)=>Dc(e,r,t,o,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return fo(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),lo(i,(a,c)=>Dc(e,r,o,a,c,n,s)),fo(e,o,!1),n&&e.patches_&&mr("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Dc(e,t,n,r,o,i,s){if(process.env.NODE_ENV!=="production"&&o===n&&yt(5),$r(o)){const a=i&&t&&t.type_!==3&&!Es(t.assigned_,r)?i.concat(r):void 0,c=uo(e,o,a);if(dd(n,r,c),$r(c))e.canAutoFreeze_=!1;else return}else s&&n.add(o);if(hr(o)&&!xo(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;uo(e,o),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&fo(e,o)}}function fo(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&pa(t,n)}function jI(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:fd(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=ha;n&&(o=[r],i=di);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}var ha={get(e,t){if(t===Ct)return e;const n=Qn(e);if(!Es(n,t))return LI(e,n,t);const r=n[t];return e.finalized_||!hr(r)?r:r===Wo(e.base_,t)?(zo(e),e.copy_[t]=As(r,e)):r},has(e,t){return t in Qn(e)},ownKeys(e){return Reflect.ownKeys(Qn(e))},set(e,t,n){const r=pd(Qn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=Wo(Qn(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(PI(n,o)&&(n!==void 0||Es(e.base_,t)))return!0;zo(e),Rs(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 Wo(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,zo(e),Rs(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Qn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){yt(11)},getPrototypeOf(e){return Ur(e.base_)},setPrototypeOf(){yt(12)}},di={};lo(ha,(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),ha.set.call(this,e[0],t,n,e[0])};function Wo(e,t){const n=e[Ct];return(n?Qn(n):e)[t]}function LI(e,t,n){var o;const r=pd(t,n);return r?"value"in r?r.value:(o=r.get)==null?void 0:o.call(e.draft_):void 0}function pd(e,t){if(!(t in e))return;let n=Ur(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Ur(n)}}function Rs(e){e.modified_||(e.modified_=!0,e.parent_&&Rs(e.parent_))}function zo(e){e.copy_||(e.copy_=Ss(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var KI=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(hr(t)){const i=Pc(this),s=As(t,void 0);let a=!0;try{o=n(s),a=!1}finally{a?Ns(i):Ts(i)}return Ac(i,r),Fc(o,i)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===ld&&(o=void 0),this.autoFreeze_&&pa(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,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){hr(e)||yt(8),$r(e)&&(e=VI(e));const t=Pc(this),n=As(e,void 0);return n[Ct].isManual_=!0,Ts(t),n}finishDraft(e,t){const n=e&&e[Ct];(!n||!n.isManual_)&&yt(9);const{scope_:r}=n;return Ac(r,t),Fc(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 $r(e)?r(e,t):this.produce(e,o=>r(o,t))}};function As(e,t){const n=Io(e)?mr("MapSet").proxyMap_(e,t):bo(e)?mr("MapSet").proxySet_(e,t):jI(e,t);return(t?t.scope_:fd()).drafts_.push(n),n}function VI(e){return $r(e)||yt(10,e),hd(e)}function hd(e){if(!hr(e)||xo(e))return e;const t=e[Ct];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Ss(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Ss(e,!0);return lo(n,(r,o)=>{dd(n,r,hd(o))}),t&&(t.finalized_=!1),n}var Ot=new KI,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 md=v.createContext(void 0),UI={};function ma(){const e=v.useContext(md);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function $I({children:e}){const{installation:t}=rt(),{hydratedRevision:n,loading:r}=Gr(),[o,i]=v.useState(UI),s=t==null?void 0:t.config;v.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(o).length>0)&&lv(n,s,i)},[n,r,s,o]);const a=v.useCallback((m,x)=>{i(w=>ti(w,p=>{p[m]=ti(p[m],x)}))},[i]),c=v.useCallback((m,x)=>{i(w=>ti(w,p=>{p[m]=x}))},[i]),u=v.useCallback(()=>{i(ti(m=>{const x=m.other.write;x&&(x.isWriteModified=!1)}))},[i]),d=v.useCallback(m=>{i(ti(x=>{var p;const w=(p=x[m])==null?void 0:p.read;w&&(w.isOptionalFieldsModified=!1,w.isRequiredMapFieldsModified=!1,w.isValueMappingsModified=!1)}))},[i]),f=v.useCallback(m=>{m===dr?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(md.Provider,{value:h,children:e})}const Qt=()=>{const{appName:e}=Te(),{objectConfigurationsState:t,setConfigureState:n}=ma(),{selectedObjectName:r}=ad(),o=ou(r||"",t);return{appName:e,configureState:o,setConfigureState:n,selectedObjectName:r}};function qI(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=!Zl(o,n);e.read.isRequiredMapFieldsModified=s}}function fi(e,t,n){t(e,r=>qI(r,n))}const HI="Each field must be mapped to a unique value";function ga({field:e,onSelectChange:t,allFields:n}){var g;const{configureState:r,selectedObjectName:o,setConfigureState:i}=Qt(),[s,a]=v.useState(!0),{isError:c,removeError:u,getError:d}=Ft(),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]),x=l.jsx(Gu,{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?HI:""}},[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(NI,{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:[x,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 BI="_formControl_9qd8d_1",JI="_formLabel_9qd8d_5",WI="_formLabelRequired_9qd8d_11",zI="_formInput_9qd8d_16",GI="_formInputInvalid_9qd8d_20",QI="_formError_9qd8d_24",XI="_disabled_9qd8d_30",Gn={formControl:BI,formLabel:JI,formLabelRequired:WI,formInput:zI,formInputInvalid:GI,formError:QI,disabled:XI};function _o({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:o=!1,errorMessage:i,children:s}){return l.jsxs("div",{className:Pt(Gn.formControl,{[Gn.disabled]:r}),children:[t&&l.jsx("label",{htmlFor:e,className:Pt(Gn.formLabel,{[Gn.formLabelRequired]:n}),children:t}),l.jsx("div",{id:e,className:Pt(Gn.formInput,{[Gn.formInputInvalid]:o}),children:s}),o&&i&&l.jsx("div",{className:Gn.formError,role:"alert",children:i})]})}const YI="_divider_1kmoj_1",Mc={divider:YI};function Co({className:e,style:t}){return l.jsx("hr",{className:e?`${Mc.divider} ${e}`:Mc.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(Co,{style:{width:"100%",marginLeft:"1rem"}})})]})}function gd({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 ZI({dynamicFieldMappings:e,onSelectChange:t,allFields:n}){return e.length?l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:e.map(r=>l.jsx(_o,{id:r.mapToName,children:l.jsx(ga,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function eb(){var x,w;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Qt(),{isError:r,removeError:o,setError:i}=Ft(),s=((x=t==null?void 0:t.read)==null?void 0:x.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;!_||gd({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(_o,{id:p.mapToName,children:l.jsx(ga,{allFields:s,field:p,onSelectChange:u})},p.mapToName)),h&&l.jsx(ZI,{dynamicFieldMappings:d,onSelectChange:u,allFields:s})]})]}):null}function tb(){var u;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Qt(),{isError:r,removeError:o,setError:i}=Ft(),s=(u=t==null?void 0:t.read)==null?void 0:u.selectedFieldMappings,a=d=>{const{value:f,name:h}=d.target;!f||gd({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(_o,{id:d.mapToName,isInvalid:r(ue.MAPPING,d.mapToName),errorMessage:"* required",children:l.jsx(ga,{allFields:((f=t==null?void 0:t.read)==null?void 0:f.allFields)||[],field:d,onSelectChange:a})},d.mapToName)})})]}):null}const nb=(e,t)=>e.filter(n=>!t.has(n));function rb(){var h,m,x;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Qt(),{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=((x=t==null?void 0:t.read)==null?void 0:x.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=nb(i,d);v.useEffect(()=>{e&&f.length&&fi(e,n,f.map(w=>({field:w,value:null})))},[e,n,f])}const ib={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function ob({children:e,style:t}){return l.jsx(vn,{style:{...ib,...t},children:e})}const ya=e=>{const t=ut(),{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})},at=e=>{const t=ya(e),{data:n}=t,{provider:r}=rt(),o=n&&ql(n==null?void 0:n.name,n);return{...t,providerName:o,selectedProvider:e||r}};function sb(){var u,d,f;const{project:e}=Te(),{hydratedRevision:t}=Gr(),{selectedObjectName:n}=Qt(),{providerName:r}=at(),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&&ur(n),a=i==null?void 0:i.mapToName,c=(i==null?void 0:i.mapToDisplayName)||a&&ur(a);return c&&o&&r?l.jsx(ob,{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 kc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function yd(...e){return t=>{let n=!1;const r=e.map(o=>{const i=kc(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():kc(e[o],null)}}}}function qr(...e){return k.useCallback(yd(...e),e)}function Oo(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,...x}=f,w=((_=h==null?void 0:h[e])==null?void 0:_[c])||a,p=k.useMemo(()=>x,Object.values(x));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,x=k.useContext(m);if(x)return x;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,ab(o,...t)]}function ab(...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 Jt(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:()=>{},cb=k[" useInsertionEffect ".trim().toString()]||pi;function va({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,s]=lb({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=ub(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 lb({defaultProp:e,onChange:t}){const[n,r]=k.useState(e),o=k.useRef(n),i=k.useRef(t);return cb(()=>{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 ub(e){return typeof e=="function"}function db(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 fb(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 pb(e,t){return k.useReducer((n,r)=>t[n][r]??n,e)}var wa=e=>{const{present:t,children:n}=e,r=hb(t),o=typeof n=="function"?n({present:r.isPresent}):k.Children.only(n),i=qr(r.ref,mb(o));return typeof n=="function"||r.isPresent?k.cloneElement(o,{ref:i}):null};wa.displayName="Presence";function hb(e){const[t,n]=k.useState(),r=k.useRef(null),o=k.useRef(e),i=k.useRef("none"),s=e?"mounted":"unmounted",[a,c]=pb(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return k.useEffect(()=>{const u=Bi(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=Bi(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=Bi(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=Bi(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 Bi(e){return(e==null?void 0:e.animationName)||"none"}function mb(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 Ps(e){const t=gb(e),n=k.forwardRef((r,o)=>{const{children:i,...s}=r,a=k.Children.toArray(i),c=a.find(vb);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 gb(e){const t=k.forwardRef((n,r)=>{const{children:o,...i}=n;if(k.isValidElement(o)){const s=Ib(o),a=wb(i,o.props);return o.type!==k.Fragment&&(a.ref=r?yd(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 yb=Symbol("radix.slottable");function vb(e){return k.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===yb}function wb(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 Ib(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 bb=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],wn=bb.reduce((e,t)=>{const n=Ps(`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}},{}),Eo="Checkbox",[xb,aC]=Oo(Eo),[_b,Cb]=xb(Eo),vd=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),x=qr(t,I=>m(I)),w=k.useRef(!1),p=h?d||!!h.closest("form"):!0,[_,g]=va({prop:o,defaultProp:i??!1,onChange:u,caller:Eo}),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(_b,{scope:n,state:_,disabled:a,children:[l.jsx(wn.button,{type:"button",role:"checkbox","aria-checked":Kn(_)?"mixed":_,"aria-required":s,"data-state":xd(_),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:x,onKeyDown:Jt(e.onKeyDown,I=>{I.key==="Enter"&&I.preventDefault()}),onClick:Jt(e.onClick,I=>{g(C=>Kn(C)?!0:!C),p&&(w.current=I.isPropagationStopped(),w.current||I.stopPropagation())})}),p&&l.jsx(bd,{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})]})});vd.displayName=Eo;var wd="CheckboxIndicator",Id=k.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=Cb(wd,n);return l.jsx(wa,{present:r||Kn(i.state)||i.state===!0,children:l.jsx(wn.span,{"data-state":xd(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});Id.displayName=wd;var Ob="CheckboxBubbleInput",bd=k.forwardRef(({__scopeCheckbox:e,control:t,checked:n,bubbles:r=!0,defaultChecked:o,...i},s)=>{const a=k.useRef(null),c=qr(a,s),u=db(n),d=fb(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}})});bd.displayName=Ob;function Kn(e){return e==="indeterminate"}function xd(e){return Kn(e)?"indeterminate":e?"checked":"unchecked"}var _d=vd,Cd=Id;function Od(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 Eb=["color"],Ed=v.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Od(e,Eb);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"}))}),Sb=["color"],Nb=v.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Od(e,Sb);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 Tb="_checkboxGroupContainer_1ya1t_1",Rb="_stack_1ya1t_6",Ab="_selectAllContainer_1ya1t_11",Pb="_fieldContainer_1ya1t_18",Fb="_checkbox_1ya1t_1",Hr={checkboxGroupContainer:Tb,stack:Rb,selectAllContainer:Ab,fieldContainer:Pb,checkbox:Fb};function Sd({id:e,isChecked:t,label:n,onCheckedChange:r}){return l.jsxs("div",{className:Hr.fieldContainer,children:[l.jsx(_d,{className:Hr.checkbox,id:e,onCheckedChange:r,checked:t,children:l.jsx(Cd,{children:l.jsx(Ed,{})})}),l.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function Nd({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:o}){return l.jsxs("div",{className:Hr.selectAllContainer,children:[l.jsx(_d,{className:Hr.checkbox,id:e,onCheckedChange:r,children:l.jsxs(Cd,{children:[o&&l.jsx(Nb,{}),t===!0&&l.jsx(Ed,{})]})}),l.jsx("label",{htmlFor:e,children:n})]})}function Td({children:e}){return l.jsx("div",{className:Hr.checkboxGroupContainer,children:e})}function Rd({children:e}){return l.jsx("div",{className:Hr.stack,children:e})}function Db(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=!Zl(s,r);e.read.isOptionalFieldsModified=c}else console.warn("read.savedConfig.optionalFields is undefined")}function jc(e,t,n,r){t(e,o=>Db(o,n,r))}function Mb(){var f,h;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=Qt(),o=(f=t==null?void 0:t.read)==null?void 0:f.selectedOptionalFields,i=(m,x)=>{m!=="indeterminate"&&r&&t&&jc(r,n,x,m)},s=(h=t==null?void 0:t.read)==null?void 0:h.optionalFields,a=m=>{r&&s&&s.forEach(x=>{Vn(x)||jc(r,n,x.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(Td,{children:[((s==null?void 0:s.length)||0)>=2&&l.jsx(Nd,{id:"select-all-fields",isChecked:u,label:"Select all",onCheckedChange:a,isIndeterminate:d}),l.jsx(Rd,{children:s.map(m=>Vn(m)?null:l.jsx(Sd,{id:m.fieldName,isChecked:!!(o!=null&&o[m==null?void 0:m.fieldName]),label:m.displayName,onCheckedChange:x=>i(x,m.fieldName)},m.fieldName))})]})]})}function kb(){return l.jsx(Mb,{})}const jb={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 Lb({children:e,style:t,...n}){return l.jsx("span",{style:{...jb,...t},...n,children:e})}function Kb(){var n,r,o;const{configureState:e}=Qt(),{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(Lb,{children:i.displayName},i.fieldName)):"There are no required fields."})]})}function Vb(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 Ad(e,t,n,r,o){t(e,i=>Vb(i,e,n,r,o))}function Ub(e,t,n){t(e,r=>{r.read&&(r.read.isValueMappingsModified=n)})}function $b({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(Co,{style:{width:"100%",marginLeft:"1rem"}})})]})}function qb({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r,hasError:o}){var C;const{configureState:i,selectedObjectName:s,setConfigureState:a}=Qt(),[c,u]=v.useState(!0),{getError:d,setError:f,resetBoundary:h,isError:m,removeError:x}=Ft(),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(Gu,{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&&(Ad(s,a,e.mappedValue,"",n),m(ue.VALUE_MAPPING,n)&&x(ue.VALUE_MAPPING,n))},[s,a,e.mappedValue,n,m,x]);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 Hb(){var m,x,w;const{fieldMapping:e}=rt(),{selectedObjectName:t,configureState:n,setConfigureState:r}=Qt(),{isError:o,removeError:i,getError:s}=Ft(),a=(m=n==null?void 0:n.read)==null?void 0:m.selectedFieldMappings,c=(x=n==null?void 0:n.read)==null?void 0:x.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&&Ad(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&&(Ub(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($b,{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(_o,{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(qb,{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 Bb(){return rb(),l.jsxs(l.Fragment,{children:[l.jsx(sb,{}),l.jsx(Kb,{}),l.jsx(tb,{}),l.jsx(eb,{}),l.jsx(Hb,{}),l.jsx(kb,{})]})}function Jb(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=!sv(a,s);e.write.isWriteModified=u}}}function Lc(e,t,n,r){t(e,o=>{Jb(o,n,r)})}function Wb(){var f,h,m,x;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=Qt(),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&&Lc(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=>{Lc(t,r,g.objectName,w)}))},c=!!i,u=Object.keys(o||{}).length===((x=(m=n==null?void 0:n.write)==null?void 0:m.writeObjects)==null?void 0:x.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(Td,{children:[((i==null?void 0:i.length)||0)>=2&&l.jsx(Nd,{id:"select-all-fields",onCheckedChange:a,isIndeterminate:d,isChecked:u,label:"Select all"}),l.jsx(Rd,{children:i.map(w=>l.jsx(Sd,{id:w.objectName,onCheckedChange:p=>s(p,w.objectName),isChecked:!!(o!=null&&o[w.objectName]),label:w.displayName},w.objectName))})]})]})}function zb(){return l.jsx(l.Fragment,{children:l.jsx(Wb,{})})}const Gb="_authenticationRow_cjz1t_1",Qb="_field_cjz1t_8",Xb="_value_cjz1t_12",Go={authenticationRow:Gb,field:Qb,value:Xb};function Kc({label:e,value:t}){return l.jsxs("div",{className:Go.authenticationRow,children:[l.jsx("div",{className:Go.field,children:e}),l.jsx("div",{className:Go.value,children:t})]})}function Yb(){const{selectedConnection:e}=Gt(),{providerName:t}=at(),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(Kc,{label:o,value:e==null?void 0:e.providerWorkspaceRef}),l.jsx(Kc,{label:"Status",value:e==null?void 0:e.status})]})]})}const Zb=()=>{const e=ut(),t=vt();return Jr({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 Pd({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=Zb(),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,x=l.jsx(ze,{type:"button",onClick:h,disabled:d,variant:t,style:n,children:m});return i!=null&&i.id?x:null}function ex(){const{installation:e}=rt(),{providerName:t}=at();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(Pd,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})]}):null}function qn({error:e}){return e?l.jsx(wi,{style:{marginTop:"2em"},children:e}):null}const tx="_input_1ymb7_1",nx="_inputError_1ymb7_27",rx="_error_1ymb7_43",Qo={input:tx,inputError:nx,error:rx};function ix({id:e,type:t,className:n,isError:r=!1,...o}){const i=r?Pt(Qo.inputError,Qo.input):Qo.input;return l.jsx("input",{id:e,type:t,className:Pt(i,n),...o})}const ox="_textarea_18zl4_1",sx="_textareaError_18zl4_14",ax="_error_18zl4_29",Xo={textarea:ox,textareaError:sx,error:ax};function cx({className:e,isError:t=!1,...n}){const r=t?Pt(Xo.textareaError,Xo.textarea):Xo.textarea;return l.jsx("textarea",{className:Pt(e,r),...n})}const tn={Input:ix,Textarea:cx},lx=()=>{const{project:e}=Te(),t=e==null?void 0:e.id,n=ut();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 Fd(){var n,r;const{data:e}=lx();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 gr({children:e}){return l.jsx(Wr,{children:l.jsxs(vn,{children:[l.jsx("div",{style:{padding:"3rem 2rem"},children:e}),l.jsx(Fd,{})]})})}function yr({children:e}){return l.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function ux({children:e}){return l.jsx("p",{style:{padding:".5em 0"},children:e})}const dx="_link_oo2kv_1",fx={link:dx};function Dd({href:e,className:t,style:n,label:r,children:o,newTab:i=!1}){return l.jsx("a",{className:Pt(fx.link,t),style:n,href:e,"aria-label":r||void 0,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:o})}function Fs({url:e,providerDisplayName:t,credentialName:n}){return l.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[l.jsx(Dd,{href:e,newTab:!0,children:l.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," ","about where to find your ",t," ",n,"."]})}function Md({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}=at(e),m=u.length>0,x=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(Fs,{url:w,providerDisplayName:h||ur(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:x,type:i||"submit",onClick:()=>n({apiKey:u}),variant:o,children:"Next"})]})}function px({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=at(e);return l.jsxs(gr,{children:[l.jsx(yr,{children:`Set up ${i} integration`}),l.jsx(qn,{error:r}),l.jsx(Md,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function hx({...e}){return l.jsx(px,{...e})}const mx={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 So({children:e,style:t}){return l.jsx(vn,{style:{...mx,...t},children:e})}const Ia=()=>{const e=ut(),t=vt(),[n,r]=v.useState(null);return{...Jr({mutationKey:["updateConnection"],mutationFn:async i=>(await e()).connectionApi.updateConnection(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)}}),errorMsg:n}};function gx({provider:e}){const{projectIdOrName:t}=Te(),{providerName:n,data:r}=at(e),{selectedConnection:o,isConnectionsLoading:i}=Gt(),{mutateAsync:s,isPending:a,error:c}=Ia(),[u,d]=v.useState(null),[f,h]=v.useState(!1),m=()=>h(!1),x=()=>{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:()=>{x()}})}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(So,{children:"Connection updated successfully"}),w&&l.jsx(wi,{children:`Error updating connection ${w}`}),l.jsx(Md,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:p,isButtonDisabled:a||i,buttonVariant:"ghost",submitButtonType:"button"})]})]}):null}function kd({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}=at(e),x=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(Fs,{url:_,providerDisplayName:m||ur(e),credentialName:"credentials"}),l.jsx(tn.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:y=>x(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=>x(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(Fs,{url:y.docsURL,providerDisplayName:m||ur(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=>x(I)})]},y.name)),l.jsx(ze,{style:{marginTop:"1em",width:"100%"},disabled:p,type:"button",onClick:w,variant:o,children:"Next"})]})}function yx({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o,requiredProviderMetadata:i}){const{providerName:s}=at(e);return l.jsxs(gr,{children:[l.jsx(yr,{children:`Set up ${s} integration`}),l.jsx(qn,{error:r}),l.jsx(kd,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o,requiredProviderMetadata:i})]})}function vx({...e}){return l.jsx(yx,{...e})}function wx({provider:e}){const{projectIdOrName:t}=Te(),{providerName:n,data:r}=at(e),{selectedConnection:o,isConnectionsLoading:i}=Gt(),{mutateAsync:s,isPending:a,error:c}=Ia(),[u,d]=v.useState(null),[f,h]=v.useState(!1),m=()=>h(!1),x=()=>{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:()=>{x()}})}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(So,{children:"Connection updated successfully"}),w&&l.jsx(wi,{children:`Error updating connection: ${w}`}),l.jsx(kd,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:p,isButtonDisabled:a||i,buttonVariant:"ghost"})]})]}):null}function jd({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:x}=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&&x.length>0&&(I.scopes=Wy(x)),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 Ix({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,explicitScopesRequired:o,explicitWorkspaceRequired:i}){return l.jsxs(gr,{children:[l.jsx(yr,{children:`Set up ${r} integration`}),l.jsx(qn,{error:t}),l.jsx("br",{}),l.jsx(jd,{handleSubmit:e,isButtonDisabled:n,explicitScopesRequired:o,explicitWorkspaceRequired:i})]})}function bx({provider:e}){var g;const{projectIdOrName:t}=Te(),{selectedConnection:n,isConnectionsLoading:r}=Gt(),{providerName:o,data:i}=at(e),{mutateAsync:s,isPending:a,error:c}=Ia(),[u,d]=v.useState(null),[f,h]=v.useState(!1),m=()=>{h(!1)},x=()=>{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}}}}),x()}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(So,{children:"Connection updated successfully"}),p&&l.jsx(wi,{children:`Error updating connection ${p}`}),l.jsx(jd,{handleSubmit:_,isButtonDisabled:a||r,explicitScopesRequired:w,explicitWorkspaceRequired:!1,buttonVariant:"ghost"})]})]})}const Vc=600,Uc=600,xx="AUTHORIZATION_SUCCEEDED",_x="AUTHORIZATION_FAILED";function Cx(e,t,n,r){return v.useCallback(()=>{if(!r)return;const o=window.screenX+(window.outerWidth-Vc)/2,i=window.screenY+(window.outerHeight-Uc)/2.5,s=`width=${Vc},height=${Uc},left=${o},top=${i}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function Ox(e,t,n,r){const o=vt();return v.useCallback(i=>{var s,a;if(i.origin===Oy){if(i.data.eventType===xx){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===_x&&(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 ba({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=Ox(u,d,r,i),x=Cx(n,f,m,t);return v.useEffect(()=>{t&&!d&&!c&&!o&&!s&&x()},[t,d,x,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 Ex=()=>{const e=ut(),t=vt();return Jr({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 Sx({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 Nx({provider:e}){const{selectedConnection:t,isConnectionsLoading:n}=Gt(),r=t==null?void 0:t.id,o=t==null?void 0:t.projectId,{providerName:i}=at(e),{mutateAsync:s,isPending:a,error:c}=Ex(),[u,d]=v.useState(null),[f,h]=v.useState(!1),[m,x]=v.useState(null),w=()=>{h(!1)},p=()=>{h(!0),d(null),x(null)},_=(c==null?void 0:c.message)||u||null,g=async()=>{w(),d(null);try{const I=await s({projectIdOrName:o||"",connectionId:r||""});x(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(So,{children:"Connection updated successfully"}),l.jsx(ba,{windowTitle:`Connect to ${i}`,oauthUrl:m||null,onError:y,error:_,isSuccessConnect:f,onSuccessConnect:p,children:l.jsx(Sx,{handleSubmit:g,error:_,providerName:i,isButtonDisabled:a||n||f})})]})}function Ld({provider:e}){var r;const{data:t}=ya(e);if((t==null?void 0:t.authType)===Ba.Basic)return l.jsx(wx,{provider:e});if((t==null?void 0:t.authType)===Ba.ApiKey)return l.jsx(gx,{provider:e});const n=(r=t==null?void 0:t.oauth2Opts)==null?void 0:r.grantType;if(n){if(n===ko.AuthorizationCode||n===ko.AuthorizationCodePkce)return l.jsx(Nx,{provider:e});if(n===ko.ClientCredentials)return l.jsx(bx,{provider:e})}return null}function Tx(){return l.jsxs(l.Fragment,{children:[l.jsx(Yb,{}),l.jsx(Ld,{}),l.jsx(ex,{})]})}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}=Gr(),{configureState:c,selectedObjectName:u}=Qt(),d=i==null?void 0:i.config,f=d&&u&&!!Gl(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!==dr&&!f),g=u===dr,y=u===to,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(Bb,{}),s&&g&&!y&&l.jsx(zb,{}),!a&&y&&l.jsx(Tx,{})]})]})}const Vd=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:o,onUpdateSuccess:i}=rt(),{hydratedRevision:s,loading:a}=Gr(),{selectedObjectName:c}=ad(),{selectedConnection:u}=Gt(),d=dl(),{projectId:f}=Te(),{resetBoundary:h,setErrors:m,setError:x,getError:w}=Ft(),{resetConfigureState:p,objectConfigurationsState:_,resetPendingConfigurationState:g}=ma(),y=ou(c||"",_),{onNextIncompleteTab:I}=TI(),C=v.useCallback(()=>{h(ue.INSTALLATION_MUTATION)},[h]),S=v.useCallback(R=>R?F=>{x(ue.INSTALLATION_MUTATION,R,F)}:F=>{console.error("objectName is required to set installation error: ",F)},[x]),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}},Rx=void 0;function Ax(){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:x,resetConfigureState:w,objectConfigurationsState:p,resetPendingConfigurationState:_,configureState:g,onInstallSuccess:y,onNextIncompleteTab:I}=Vd(),[C,S]=v.useState(!1),T=s===dr,R=m(s),F=v.useCallback(()=>{d(ue.MAPPING),o!=null&&o.content&&!i&&s&&tu(o,Rx,s,w)},[d,o,i,s,w]);v.useEffect(()=>{!g&&(o!=null&&o.content)&&!i&&F()},[g,p,o,i,F]);const U=()=>{x();const{requiredMapFields:Y,selectedFieldMappings:B}=(g==null?void 0:g.read)||{},{errorList:ce}=Yl(Y,B,f);ce.length>0||(s&&(a!=null&&a.id)&&c&&u&&e&&t&&n&&o?(S(!0),fv(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=()=>{x(),s&&(a!=null&&a.id)&&c&&u&&e&&t&&n&&o?(S(!0),mv(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 Px({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.${Gy(i)}`],installation:{config:e}}};return Vs().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 Fx=(e,t,n,r,o,i)=>{const s=nu(e),a=ru(e),c=iu(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},Dx=(e,t,n,r,o,i,s,a,c,u,d)=>{const f=Fx(i,r||"",a,a.schedule,c,a.backfill);return f?Px({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))},Mx=(e,t)=>{const r={content:{write:{objects:au(e)}}};return vi(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r},kx=(e,t,n,r,o,i,s,a,c)=>{const u=Mx(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 Vs().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 jx({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:x,onUpdateSuccess:w,onNextIncompleteTab:p}=Vd(),[_,g]=v.useState(!1),y=i===dr,I=f(i),{config:C}=e,S=v.useCallback(()=>{c(ue.MAPPING),r!=null&&r.content&&!o&&i&&tu(r,C,i,h)},[c,r,o,i,C,h]);v.useEffect(()=>{x||S()},[x,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}=(x==null?void 0:x.read)||{},{errorList:Y}=Yl(Q,J,u);Y.length>0||(r&&e&&i&&s&&a&&T?(g(!0),Dx(a,t.id,e.id,i,s,x,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),kx(a,t.id,e.id,s,x,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 Lx(){const{integrationObj:e,installation:t}=rt();return e?t&&e?l.jsx(jx,{installation:t,integrationObj:e}):l.jsx(Ax,{}):l.jsx(Vl,{message:"We can't load the integration"})}const Kx=()=>{const e=ut(),t=vt(),[n,r]=v.useState(null);return{...Jr({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 Vx(){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 xa({text:e,children:t}){return l.jsx(Wr,{children:l.jsxs(vn,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[l.jsx(Vx,{}),l.jsx("p",{children:e}),t]})})}function Ux({provider:e}){const{providerName:t}=at(e),n=`You have successfully installed your ${t} integration.`;return l.jsx(xa,{text:n,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:l.jsx(Pd,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const $x=e=>{const{read:t,write:n}=(e==null?void 0:e.content)??{};return!t&&!n};function qx({children:e}){var C;const t=v.useRef(!1),{projectId:n}=Te(),{hydratedRevision:r,loading:o}=Gr(),{integrationObj:i,installation:s,groupRef:a,consumerRef:c,onInstallSuccess:u,isIntegrationDeleted:d}=rt(),{mutate:f,isIdle:h,isPending:m,error:x,errorMsg:w}=Kx(),{selectedConnection:p,isConnectionsLoading:_}=Gt(),g=o||m||_,y=(C=r==null?void 0:r.content)==null?void 0:C.provider,I=$x(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(Ux,{provider:y}):x?l.jsx(Bt,{message:w??"Create installation failed"}):i?g?l.jsx(zr,{}):l.jsx("div",{children:e}):l.jsx(Bt,{message:"We can't load the integration"})}function No(){const e=ut(),t=vt();return Jr({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 Hx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:c}=Te(),u=No(),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(hx,{provider:e,providerInfo:t,handleSubmit:d,error:null}):s}function Bx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){var f;const{projectIdOrName:c}=Te(),u=No(),d=v.useCallback(h=>{const{user:m,pass:x,providerMetadata:w}=h,p={projectIdOrName:c,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:m,password:x},...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(vx,{provider:e,providerInfo:t,handleSubmit:d,error:null,requiredProviderMetadata:((f=t.metadata)==null?void 0:f.input)||[]}):s}function Jx({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(gr,{children:[l.jsx(yr,{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 Wx({...e}){return l.jsx(Jx,{...e})}function zx({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s,providerName:a}){const{projectIdOrName:c}=Te(),u=No(),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(Wx,{handleSubmit:d,error:null,providerName:a}):i}const Gx=()=>{const e=ut(),{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})},Qx=e=>{const t=ut(),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})},Xx=$s("VITE_AMP_ENABLE_CSRF",!1),Yx=$s("NEXT_AMP_ENABLE_CSRF",!1),Zx=$s("REACT_APP_AMP_ENABLE_CSRF",!1),e_=!!Xx||!!Yx||!!Zx,Ud=(e,t,n,r,o,i)=>{const{projectId:s}=Te(),{data:a,isLoading:c,error:u}=ya(n),{data:d,isLoading:f,error:h}=Gx(),m=d==null?void 0:d.find(C=>C.provider===n),x=a?ql(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:e_},{data:p,error:_,isLoading:g,refetch:y}=Qx(w);return v.useEffect(()=>{a&&n&&!m&&console.error(`You must first set up a ${x} Provider App using the Ampersand Console.`)},[m,x,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 t_({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return l.jsxs(gr,{children:[l.jsx(yr,{children:`Set up ${r} integration`}),l.jsx(ux,{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:n?"Loading...":"Next"})]})}function n_({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){const[s,a]=v.useState(null),[c,u]=v.useState(!1),{isFetching:d,refetch:f}=Ll({groupRef:r,provider:e}),{url:h,error:m,isLoading:x,refetchOauthConnect:w}=Ud(t,r,e,void 0,n,o),p=(m==null?void 0:m.message)||s||null,_=v.useCallback(C=>{a(C),u(!1)},[a]),g=v.useCallback(()=>{a(null),u(!1),f()},[a,f]),y=v.useCallback(()=>{u(!1),f()},[u,f]),I=async()=>{var T;a(null);const{data:C}=await f();if(C&&C.length>0)return;const S=await w();S!=null&&S.data?u(!0):_(((T=S==null?void 0:S.error)==null?void 0:T.message)||"Authentication failed")};return l.jsx(ba,{windowTitle:`Connect to ${i}`,oauthUrl:c&&h||null,onError:_,error:p,onSuccessConnect:g,onWindowClose:y,children:l.jsx(t_,{handleSubmit:I,error:d?"":p,providerName:i,isButtonDisabled:x||d})})}const r_="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function i_({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return l.jsxs(gr,{children:[l.jsx(yr,{children:"Enter your Salesforce subdomain"}),l.jsx(Dd,{href:r_,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 o_({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r,providerName:o}){return l.jsxs(gr,{children:[l.jsxs(yr,{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 s_="salesforce";function a_({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:x,refetchOauthConnect:w}=Ud(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===s_?l.jsx(i_,{handleSubmit:I,setWorkspace:a,error:p,isButtonDisabled:s.length===0}):l.jsx(o_,{handleSubmit:I,setWorkspace:a,error:p,isButtonDisabled:s.length===0||x,providerName:i});return l.jsx(ba,{windowTitle:`Connect to ${i}`,oauthUrl:d&&h||null,onError:_,error:p,onSuccessConnect:g,onWindowClose:y,children:C})}function c_({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,explicitScopesRequired:s,explicitWorkspaceRequired:a,selectedConnection:c}){const{projectIdOrName:u}=Te(),d=No(),[f,h]=v.useState(null),m=v.useCallback(x=>{h(null);const w={projectIdOrName:u,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:x.workspace,oauth2ClientCredentials:{clientId:x.clientId,clientSecret:x.clientSecret,scopes:x.scopes}}};d.mutate(w,{onError:()=>h("Error loading provider info")})},[u,i,o,r,n,e,d]);return c===null?l.jsx(Ix,{providerName:t,handleSubmit:m,error:f,explicitScopesRequired:s,explicitWorkspaceRequired:a}):l.jsx(ci,{})}function l_({...e}){return l.jsx(c_,{...e})}const u_="authorizationCode",d_="authorizationCodePKCE",f_="clientCredentials";function p_({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,selectedConnection:s,setSelectedConnection:a}){const{providerName:c}=at(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===u_||u===d_?f?l.jsx(a_,{...h}):l.jsx(n_,{...h}):u===f_?l.jsx(l_,{...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 h_(e){const{selectedConnection:t}=Gt();v.useEffect(()=>{e&&t&&e(t)},[e,t])}function m_({onSuccess:e}){h_(e)}function $d({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:x}=at(e),{provider:w,isIntegrationDeleted:p}=rt(),{selectedConnection:_,setSelectedConnection:g}=Gt();m_({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(xa,{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(zr,{});if(u==null)return l.jsx(Bt,{message:"Provider info was not found."});const C={provider:x,consumerRef:t,consumerName:n,groupRef:r,groupName:o,selectedConnection:_,setSelectedConnection:g,providerName:m,providerInfo:u,onDisconnectSuccess:a};return u.authType==="none"?l.jsx(zx,{...C,children:i}):u.authType==="basic"?l.jsx(Bx,{...C,children:i}):u.authType==="apiKey"?l.jsx(Hx,{...C,children:i}):l.jsx(p_,{...C})}function g_(e){const t=e+"CollectionProvider",[n,r]=Oo(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=Ps(a),u=v.forwardRef((w,p)=>{const{scope:_,children:g}=w,y=i(a,_),I=qr(p,y.collectionRef);return l.jsx(c,{ref:I,children:g})});u.displayName=a;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=Ps(d),m=v.forwardRef((w,p)=>{const{scope:_,children:g,...y}=w,I=v.useRef(null),C=qr(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 x(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},x,r]}var y_=k[" useId ".trim().toString()]||(()=>{}),v_=0;function qd(e){const[t,n]=k.useState(y_());return pi(()=>{e||n(r=>r??String(v_++))},[e]),e||(t?`radix-${t}`:"")}function w_(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 I_=k.createContext(void 0);function Hd(e){const t=k.useContext(I_);return e||t||"ltr"}var Yo="rovingFocusGroup.onEntryFocus",b_={bubbles:!1,cancelable:!0},_i="RovingFocusGroup",[Ds,Bd,x_]=g_(_i),[__,Jd]=Oo(_i,[x_]),[C_,O_]=__(_i),Wd=k.forwardRef((e,t)=>l.jsx(Ds.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Ds.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(E_,{...e,ref:t})})}));Wd.displayName=_i;var E_=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=qr(t,h),x=Hd(i),[w,p]=va({prop:s,defaultProp:a??null,onChange:c,caller:_i}),[_,g]=k.useState(!1),y=w_(u),I=Bd(n),C=k.useRef(!1),[S,T]=k.useState(0);return k.useEffect(()=>{const R=h.current;if(R)return R.addEventListener(Yo,y),()=>R.removeEventListener(Yo,y)},[y]),l.jsx(C_,{scope:n,orientation:r,dir:x,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:Jt(e.onMouseDown,()=>{C.current=!0}),onFocus:Jt(e.onFocus,R=>{const F=!C.current;if(R.target===R.currentTarget&&F&&!_){const U=new CustomEvent(Yo,b_);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);Qd(ce,d)}}C.current=!1}),onBlur:Jt(e.onBlur,()=>g(!1))})})}),zd="RovingFocusGroupItem",Gd=k.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:s,...a}=e,c=qd(),u=i||c,d=O_(zd,n),f=d.currentTabStopId===u,h=Bd(n),{onFocusableItemAdd:m,onFocusableItemRemove:x,currentTabStopId:w}=d;return k.useEffect(()=>{if(r)return m(),()=>x()},[r,m,x]),l.jsx(Ds.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:Jt(e.onMouseDown,p=>{r?d.onItemFocus(u):p.preventDefault()}),onFocus:Jt(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:Jt(e.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){d.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const _=T_(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?R_(y,I+1):y.slice(I+1)}setTimeout(()=>Qd(y))}}),children:typeof s=="function"?s({isCurrentTabStop:f,hasTabStop:w!=null}):s})})});Gd.displayName=zd;var S_={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function N_(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function T_(e,t,n){const r=N_(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return S_[r]}function Qd(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function R_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var A_=Wd,P_=Gd,To="Tabs",[F_,cC]=Oo(To,[Jd]),Xd=Jd(),[D_,_a]=F_(To),Yd=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=Hd(a),[f,h]=va({prop:r,onChange:o,defaultProp:i??"",caller:To});return l.jsx(D_,{scope:n,baseId:qd(),value:f,onValueChange:h,orientation:s,dir:d,activationMode:c,children:l.jsx(wn.div,{dir:d,"data-orientation":s,...u,ref:t})})});Yd.displayName=To;var Zd="TabsList",ef=k.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=_a(Zd,n),s=Xd(n);return l.jsx(A_,{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})})});ef.displayName=Zd;var tf="TabsTrigger",nf=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=_a(tf,n),a=Xd(n),c=of(s.baseId,r),u=sf(s.baseId,r),d=r===s.value;return l.jsx(P_,{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:Jt(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:Jt(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:Jt(e.onFocus,()=>{const f=s.activationMode!=="manual";!d&&!o&&f&&s.onValueChange(r)})})})});nf.displayName=tf;var rf="TabsContent",M_=k.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=_a(rf,n),c=of(a.baseId,r),u=sf(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(wa,{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})})});M_.displayName=rf;function of(e,t){return`${e}-trigger-${t}`}function sf(e,t){return`${e}-content-${t}`}var k_=Yd,j_=ef,af=nf;const L_=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 K_(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?L_: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 V_(){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 U_="_tabsRoot_ktpr0_1",$_="_tabsList_ktpr0_6",q_="_tabTrigger_ktpr0_12",H_="_danger_ktpr0_29",po={tabsRoot:U_,tabsList:$_,tabTrigger:q_,danger:H_};function B_(){return l.jsxs(l.Fragment,{children:[l.jsx(Co,{style:{margin:"1rem 0"}}),l.jsx(af,{value:to,className:po.tabTrigger,children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[l.jsx(V_,{}),l.jsx("span",{children:"Manage"})]})})]})}function cf({objectName:e,completed:t,pending:n,displayName:r}){return l.jsx(af,{value:e,className:po.tabTrigger,children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[K_(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 J_({completed:e,pending:t,displayName:n}){return l.jsxs(l.Fragment,{children:[l.jsx(Co,{style:{margin:"1rem 0"}}),l.jsx(cf,{objectName:dr,completed:e,pending:t,displayName:n},"other-write")]})}function W_({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:o}){var i,s;return l.jsx(k_,{value:e,className:po.tabsRoot,onValueChange:n,children:l.jsxs(j_,{className:po.tabsList,children:[t.map(a=>{var c,u,d,f,h,m;return l.jsx(cf,{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(J_,{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(B_,{})]})})}function z_(e,t){return t===to?{name:to,completed:!1}:e.find(n=>n.name===t)}function G_({children:e}){var _;const{project:t}=Te(),{installation:n}=rt(),{providerName:r}=at(),{hydratedRevision:o}=Gr(),{objectConfigurationsState:i}=ma(),[s,a]=v.useState(""),c=(t==null?void 0:t.appName)||"",u=n==null?void 0:n.config,d=o&&Ql(u,o),f=d!==null,h=!!((_=o==null?void 0:o.content)!=null&&_.write),m=h?Xl(u):void 0,x=v.useMemo(()=>{const g=[...d||[]];return m&&h&&g.push(m),g},[d,m,h]),w=z_(x,s),p=v.useCallback(()=>{const g=x.find(y=>w!==y&&!y.completed);g&&a(g.name)},[x,w]);return v.useEffect(()=>{!s&&x.length>0&&a(x[0].name)},[x,s,p]),l.jsx(cd.Provider,{value:p,children:l.jsx(sd.Provider,{value:w==null?void 0:w.name,children:l.jsxs(Wr,{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(W_,{value:s,readNavObjects:d,onValueChange:g=>a(g),objectConfigurationsState:i,writeNavObject:m})]}),e]}),l.jsx(Fd,{})]})})})}function Q_({...e}){return l.jsx(G_,{...e})}const X_="_resetContainer_lkwv9_4",lf={resetContainer:X_};function Y_({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}=Us(),{isError:h,errorState:m}=Ft(),{seed:x,reset:w}=Wl();return d||f?l.jsx(zr,{}):h(ue.PROJECT,u)?l.jsx(Bt,{message:`Error loading project ${u}`}):h(ue.INTEGRATION_LIST,u)?l.jsx(Bt,{message:"Error retrieving integrations for the project, double check the API key"}):(p=m[ue.INTEGRATION_LIST])!=null&&p.apiError?l.jsx(Bt,{message:"Something went wrong, couldn't find integration information"}):l.jsx("div",{className:lf.resetContainer,children:l.jsx(Xy,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c,children:l.jsx(Jl,{children:l.jsx($d,{consumerRef:t,consumerName:n,groupRef:r,groupName:o,resetComponent:w,children:l.jsx(Cv,{resetComponent:w,children:l.jsx(qx,{children:l.jsx($I,{children:l.jsx(Q_,{children:l.jsx(Lx,{})})})})})})})},x)})}function Z_(){return l.jsxs(Wr,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[l.jsx(ci,{}),l.jsx("p",{children:"Redirecting"})]})}function eC({redirectURL:e,children:t}){return v.useEffect(()=>{e&&window.location.replace(e)},[e]),e?l.jsx(Z_,{}):t}function tC({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(Ld,{provider:n}),l.jsx(Et,{string:"Remove connection"}),l.jsx("p",{children:"Click to disconnect your connection from the provider."}),l.jsx(lu,{resetComponent:e,onDisconnectSuccess:t,buttonText:"Remove connection",buttonVariant:"danger",buttonStyle:{fontSize:"13px"}})]})]})}function nC({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=Te(),{providerName:o}=at(e),i=`You have successfully connected your ${o} account to ${r}.`;return l.jsx(xa,{text:i,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"},children:l.jsx(tC,{resetComponent:n,onDisconnectSuccess:t,provider:e})})})}function rC({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,redirectUrl:i,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:c}){const{seed:u,reset:d}=Wl(),f=v.useCallback(h=>{s?s(h.id):c&&c(h)},[s,c]);return l.jsx("div",{className:lf.resetContainer,children:l.jsx(Jl,{groupRef:r,provider:e,children:l.jsx($d,{resetComponent:d,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onSuccess:f,onDisconnectSuccess:a,children:l.jsx(eC,{redirectURL:i,children:l.jsx(nC,{resetComponent:d,provider:e,onDisconnectSuccess:a})})})})},u)}const iC=(e,t)=>{const{data:n,isLoading:r,isError:o,error:i}=$l(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=jl;exports.AmpersandProvider=Py;exports.ConnectProvider=rC;exports.InstallIntegration=Y_;exports.useAmpersandProvider=Fy;exports.useIsIntegrationInstalled=iC;
|
|
50
|
+
*/const bI="react-tooltip-core-styles",xI="react-tooltip-base-styles",Nc={core:!1,base:!1};function Tc({css:e,id:t=xI,type:n="base",ref:r}){var o,i;if(!e||typeof document>"u"||Nc[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=bI),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)),Nc[n]=!0}const Rc=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10,strategy:i="absolute",middlewares:s=[yI(Number(o)),wI({fallbackAxisSideDirection:"start"}),vI({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(II({element:n,padding:5})),Sc(e,t,{placement:r,strategy:i,middleware:c}).then(({x:f,y:u,placement:d,middlewareData:g})=>{var h,w;const v={left:`${f}px`,top:`${u}px`,border:a},{x:p,y:x}=(h=g.arrow)!==null&&h!==void 0?h:{x:0,y:0},m=(w={top:"bottom",right:"left",bottom:"top",left:"right"}[d.split("-")[0]])!==null&&w!==void 0?w:"bottom",I=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:"",...I,[m]:`-${4+_}px`},place:d}})):Sc(e,t,{placement:"bottom",strategy:i,middleware:c}).then(({x:f,y:u,placement:d})=>({tooltipStyles:{left:`${f}px`,top:`${u}px`},tooltipArrowStyles:{},place:d}))},Ac=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),Pc=(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},Fc=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",Ns=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((o,i)=>Ns(o,t[i]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Fc(e)||!Fc(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(o=>Ns(e[o],t[o]))},CI=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"})},Dc=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(CI(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},_I=typeof window<"u"?y.useLayoutEffect:y.useEffect,Tt=e=>{e.current&&(clearTimeout(e.current),e.current=null)},OI="DEFAULT_TOOLTIP_ID",EI={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},SI=y.createContext({getTooltipData:()=>EI});function dd(e=OI){return y.useContext(SI).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"},Go={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 NI=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:o="dark",anchorId:i,anchorSelect:s,place:a="top",offset:c=10,events:f=["hover"],openOnClick:u=!1,positionStrategy:d="absolute",middlewares:g,wrapper:h,delayShow:w=0,delayHide:v=0,float:p=!1,hidden:x=!1,noArrow:m=!1,clickable:I=!1,closeOnEsc:_=!1,closeOnScroll:C=!1,closeOnResize:S=!1,openEvents:R,closeEvents:N,globalCloseEvents:A,imperativeModeOnly:K,style:z,position:H,afterShow:ee,afterHide:q,disableTooltip:ae,content:X,contentWrapperRef:Y,isOpen:fe,defaultIsOpen:Ie=!1,setIsOpen:P,activeAnchor:j,setActiveAnchor:$,border:V,opacity:L,arrowColor:D,role:te="tooltip"})=>{var ne;const B=y.useRef(null),re=y.useRef(null),Q=y.useRef(null),de=y.useRef(null),k=y.useRef(null),[we,J]=y.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[Se,Ve]=y.useState(!1),[Ye,Ue]=y.useState(!1),[be,Dt]=y.useState(null),Ze=y.useRef(!1),wt=y.useRef(null),{anchorRefs:Mt,setActiveAnchor:kt}=dd(t),et=y.useRef(!1),[Ge,$e]=y.useState([]),Pe=y.useRef(!1),jt=u||f.includes("click"),dt=jt||(R==null?void 0:R.click)||(R==null?void 0:R.dblclick)||(R==null?void 0:R.mousedown),sn=R?{...R}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!R&&jt&&Object.assign(sn,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const Yt=N?{...N}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!N&&jt&&Object.assign(Yt,{mouseleave:!1,blur:!1,mouseout:!1});const It=A?{...A}:{escape:_||!1,scroll:C||!1,resize:S||!1,clickOutsideAnchor:dt||!1};K&&(Object.assign(sn,{mouseover:!1,focus:!1,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(Yt,{mouseout:!1,blur:!1,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(It,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),_I(()=>(Pe.current=!0,()=>{Pe.current=!1}),[]);const Fe=W=>{Pe.current&&(W&&Ue(!0),setTimeout(()=>{Pe.current&&(P==null||P(W),fe===void 0&&Ve(W))},10))};y.useEffect(()=>{if(fe===void 0)return()=>null;fe&&Ue(!0);const W=setTimeout(()=>{Ve(fe)},10);return()=>{clearTimeout(W)}},[fe]),y.useEffect(()=>{if(Se!==Ze.current)if(Tt(k),Ze.current=Se,Se)ee==null||ee();else{const W=(ce=>{const le=ce.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"));k.current=setTimeout(()=>{Ue(!1),Dt(null),q==null||q()},W+25)}},[Se]);const an=W=>{J(ce=>Ns(ce,W)?ce:W)},bn=(W=w)=>{Tt(Q),Ye?Fe(!0):Q.current=setTimeout(()=>{Fe(!0)},W)},cn=(W=v)=>{Tt(de),de.current=setTimeout(()=>{et.current||Fe(!1)},W)},Bn=W=>{var ce;if(!W)return;const le=(ce=W.currentTarget)!==null&&ce!==void 0?ce:W.target;if(!(le!=null&&le.isConnected))return $(null),void kt({current:null});w?bn():Fe(!0),$(le),kt({current:le}),Tt(de)},ft=()=>{I?cn(v||100):v?cn():Fe(!1),Tt(Q)},ln=({x:W,y:ce})=>{var le;const Ke={getBoundingClientRect:()=>({x:W,y:ce,width:0,height:0,top:ce,left:W,right:W,bottom:ce})};Rc({place:(le=be==null?void 0:be.place)!==null&&le!==void 0?le:a,offset:c,elementReference:Ke,tooltipReference:B.current,tooltipArrowReference:re.current,strategy:d,middlewares:g,border:V}).then(He=>{an(He)})},xn=W=>{if(!W)return;const ce=W,le={x:ce.clientX,y:ce.clientY};ln(le),wt.current=le},Jn=W=>{var ce;if(!Se)return;const le=W.target;le.isConnected&&(!((ce=B.current)===null||ce===void 0)&&ce.contains(le)||[document.querySelector(`[id='${i}']`),...Ge].some(Ke=>Ke==null?void 0:Ke.contains(le))||(Fe(!1),Tt(Q)))},Cn=Pc(Bn,50),Ae=Pc(ft,50),it=W=>{Ae.cancel(),Cn(W)},oe=()=>{Cn.cancel(),Ae()},ge=y.useCallback(()=>{var W,ce;const le=(W=be==null?void 0:be.position)!==null&&W!==void 0?W:H;le?ln(le):p?wt.current&&ln(wt.current):j!=null&&j.isConnected&&Rc({place:(ce=be==null?void 0:be.place)!==null&&ce!==void 0?ce:a,offset:c,elementReference:j,tooltipReference:B.current,tooltipArrowReference:re.current,strategy:d,middlewares:g,border:V}).then(Ke=>{Pe.current&&an(Ke)})},[Se,j,X,z,a,be==null?void 0:be.place,c,d,H,be==null?void 0:be.position,p]);y.useEffect(()=>{var W,ce;const le=new Set(Mt);Ge.forEach(ye=>{ae!=null&&ae(ye)||le.add({current:ye})});const Ke=document.querySelector(`[id='${i}']`);Ke&&!(ae!=null&&ae(Ke))&&le.add({current:Ke});const He=()=>{Fe(!1)},pt=Dc(j),Qe=Dc(B.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&&B.current&&(tt=gI(j,B.current,ge,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const ht=ye=>{ye.key==="Escape"&&Fe(!1)};It.escape&&window.addEventListener("keydown",ht),It.clickOutsideAnchor&&window.addEventListener("click",Jn);const Ne=[],_n=ye=>!!(ye!=null&&ye.target&&(j!=null&&j.contains(ye.target))),Fo=ye=>{Se&&_n(ye)||Bn(ye)},Lt=ye=>{Se&&_n(ye)&&ft()},Ei=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],Si=["click","dblclick","mousedown","mouseup"];Object.entries(sn).forEach(([ye,Kt])=>{Kt&&(Ei.includes(ye)?Ne.push({event:ye,listener:it}):Si.includes(ye)&&Ne.push({event:ye,listener:Fo}))}),Object.entries(Yt).forEach(([ye,Kt])=>{Kt&&(Ei.includes(ye)?Ne.push({event:ye,listener:oe}):Si.includes(ye)&&Ne.push({event:ye,listener:Lt}))}),p&&Ne.push({event:"pointermove",listener:xn});const Ni=()=>{et.current=!0},Ti=()=>{et.current=!1,ft()},Ri=I&&(Yt.mouseout||Yt.mouseleave);return Ri&&((W=B.current)===null||W===void 0||W.addEventListener("mouseover",Ni),(ce=B.current)===null||ce===void 0||ce.addEventListener("mouseout",Ti)),Ne.forEach(({event:ye,listener:Kt})=>{le.forEach(Xr=>{var Wn;(Wn=Xr.current)===null||Wn===void 0||Wn.addEventListener(ye,Kt)})}),()=>{var ye,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",Jn),It.escape&&window.removeEventListener("keydown",ht),Ri&&((ye=B.current)===null||ye===void 0||ye.removeEventListener("mouseover",Ni),(Kt=B.current)===null||Kt===void 0||Kt.removeEventListener("mouseout",Ti)),Ne.forEach(({event:Xr,listener:Wn})=>{le.forEach(Do=>{var Yr;(Yr=Do.current)===null||Yr===void 0||Yr.removeEventListener(Xr,Wn)})})}},[j,ge,Ye,Mt,Ge,R,N,A,jt,w,v]),y.useEffect(()=>{var W,ce;let le=(ce=(W=be==null?void 0:be.anchorSelect)!==null&&W!==void 0?W:s)!==null&&ce!==void 0?ce:"";!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 _n;return!!(!((_n=Ne==null?void 0:Ne.contains)===null||_n===void 0)&&_n.call(Ne,j))&&(Ue(!1),Fe(!1),$(null),Tt(Q),Tt(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,be==null?void 0:be.anchorSelect,j]),y.useEffect(()=>{ge()},[ge]),y.useEffect(()=>{if(!(Y!=null&&Y.current))return()=>null;const W=new ResizeObserver(()=>{setTimeout(()=>ge())});return W.observe(Y.current),()=>{W.disconnect()}},[X,Y==null?void 0:Y.current]),y.useEffect(()=>{var W;const ce=document.querySelector(`[id='${i}']`),le=[...Ge,ce];j&&le.includes(j)||$((W=Ge[0])!==null&&W!==void 0?W:ce)},[i,Ge,j]),y.useEffect(()=>(Ie&&Fe(!0),()=>{Tt(Q),Tt(de)}),[]),y.useEffect(()=>{var W;let ce=(W=be==null?void 0:be.anchorSelect)!==null&&W!==void 0?W:s;if(!ce&&t&&(ce=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),ce)try{const le=Array.from(document.querySelectorAll(ce));$e(le)}catch{$e([])}},[t,s,be==null?void 0:be.anchorSelect]),y.useEffect(()=>{Q.current&&(Tt(Q),bn(w))},[w]);const qe=(ne=be==null?void 0:be.content)!==null&&ne!==void 0?ne:X,un=Se&&Object.keys(we.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`)}Dt(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:we.place,isOpen:!!(Ye&&!x&&qe&&un)})),Ye&&!x&&qe?y.createElement(h,{id:t,role:te,className:Pt("react-tooltip",Ir.tooltip,Go.tooltip,Go[o],n,`react-tooltip__place-${we.place}`,Ir[un?"show":"closing"],un?"react-tooltip__show":"react-tooltip__closing",d==="fixed"&&Ir.fixed,I&&Ir.clickable),onTransitionEnd:W=>{Tt(k),Se||W.propertyName!=="opacity"||(Ue(!1),Dt(null),q==null||q())},style:{...z,...we.tooltipStyles,opacity:L!==void 0&&un?L:void 0},ref:B},qe,y.createElement(h,{className:Pt("react-tooltip-arrow",Ir.arrow,Go.arrow,r,m&&Ir.noArrow),style:{...we.tooltipArrowStyles,background:D?`linear-gradient(to right bottom, transparent 50%, ${D} 50%)`:void 0},ref:re})):null},TI=({content:e})=>y.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),RI=y.forwardRef(({id:e,anchorId:t,anchorSelect:n,content:r,html:o,render:i,className:s,classNameArrow:a,variant:c="dark",place:f="top",offset:u=10,wrapper:d="div",children:g=null,events:h=["hover"],openOnClick:w=!1,positionStrategy:v="absolute",middlewares:p,delayShow:x=0,delayHide:m=0,float:I=!1,hidden:_=!1,noArrow:C=!1,clickable:S=!1,closeOnEsc:R=!1,closeOnScroll:N=!1,closeOnResize:A=!1,openEvents:K,closeEvents:z,globalCloseEvents:H,imperativeModeOnly:ee=!1,style:q,position:ae,isOpen:X,defaultIsOpen:Y=!1,disableStyleInjection:fe=!1,border:Ie,opacity:P,arrowColor:j,setIsOpen:$,afterShow:V,afterHide:L,disableTooltip:D,role:te="tooltip"},ne)=>{const[B,re]=y.useState(r),[Q,de]=y.useState(o),[k,we]=y.useState(f),[J,Se]=y.useState(c),[Ve,Ye]=y.useState(u),[Ue,be]=y.useState(x),[Dt,Ze]=y.useState(m),[wt,Mt]=y.useState(I),[kt,et]=y.useState(_),[Ge,$e]=y.useState(d),[Pe,jt]=y.useState(h),[dt,sn]=y.useState(v),[Yt,It]=y.useState(null),[Fe,an]=y.useState(null),bn=y.useRef(fe),{anchorRefs:cn,activeAnchor:Bn}=dd(e),ft=Ae=>Ae==null?void 0:Ae.getAttributeNames().reduce((it,oe)=>{var ge;return oe.startsWith("data-tooltip-")&&(it[oe.replace(/^data-tooltip-/,"")]=(ge=Ae==null?void 0:Ae.getAttribute(oe))!==null&&ge!==void 0?ge:null),it},{}),ln=Ae=>{const it={place:oe=>{var ge;we((ge=oe)!==null&&ge!==void 0?ge:f)},content:oe=>{re(oe??r)},html:oe=>{de(oe??o)},variant:oe=>{var ge;Se((ge=oe)!==null&&ge!==void 0?ge:c)},offset:oe=>{Ye(oe===null?u:Number(oe))},wrapper:oe=>{var ge;$e((ge=oe)!==null&&ge!==void 0?ge:d)},events:oe=>{const ge=oe==null?void 0:oe.split(" ");jt(ge??h)},"position-strategy":oe=>{var ge;sn((ge=oe)!==null&&ge!==void 0?ge:v)},"delay-show":oe=>{be(oe===null?x:Number(oe))},"delay-hide":oe=>{Ze(oe===null?m:Number(oe))},float:oe=>{Mt(oe===null?I:oe==="true")},hidden:oe=>{et(oe===null?_:oe==="true")},"class-name":oe=>{It(oe)}};Object.values(it).forEach(oe=>oe(null)),Object.entries(Ae).forEach(([oe,ge])=>{var qe;(qe=it[oe])===null||qe===void 0||qe.call(it,ge)})};y.useEffect(()=>{re(r)},[r]),y.useEffect(()=>{de(o)},[o]),y.useEffect(()=>{we(f)},[f]),y.useEffect(()=>{Se(c)},[c]),y.useEffect(()=>{Ye(u)},[u]),y.useEffect(()=>{be(x)},[x]),y.useEffect(()=>{Ze(m)},[m]),y.useEffect(()=>{Mt(I)},[I]),y.useEffect(()=>{et(_)},[_]),y.useEffect(()=>{sn(v)},[v]),y.useEffect(()=>{bn.current!==fe&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")},[fe]),y.useEffect(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:fe==="core",disableBase:fe}}))},[]),y.useEffect(()=>{var Ae;const it=new Set(cn);let oe=n;if(!oe&&e&&(oe=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),oe)try{document.querySelectorAll(oe).forEach(ce=>{it.add({current:ce})})}catch{console.warn(`[react-tooltip] "${oe}" is not a valid CSS selector`)}const ge=document.querySelector(`[id='${t}']`);if(ge&&it.add({current:ge}),!it.size)return()=>null;const qe=(Ae=Fe??ge)!==null&&Ae!==void 0?Ae:Bn.current,un=new MutationObserver(ce=>{ce.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 ce=ft(qe);ln(ce),un.observe(qe,W)}return()=>{un.disconnect()}},[cn,Bn,Fe,t,n]),y.useEffect(()=>{q!=null&&q.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),Ie&&!Ac("border",`${Ie}`)&&console.warn(`[react-tooltip] "${Ie}" is not a valid \`border\`.`),q!=null&&q.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),P&&!Ac("opacity",`${P}`)&&console.warn(`[react-tooltip] "${P}" is not a valid \`opacity\`.`)},[]);let xn=g;const Jn=y.useRef(null);if(i){const Ae=i({content:(Fe==null?void 0:Fe.getAttribute("data-tooltip-content"))||B||null,activeAnchor:Fe});xn=Ae?y.createElement("div",{ref:Jn,className:"react-tooltip-content-wrapper"},Ae):null}else B&&(xn=B);Q&&(xn=y.createElement(TI,{content:Q}));const Cn={forwardRef:ne,id:e,anchorId:t,anchorSelect:n,className:Pt(s,Yt),classNameArrow:a,content:xn,contentWrapperRef:Jn,place:k,variant:J,offset:Ve,wrapper:Ge,events:Pe,openOnClick:w,positionStrategy:dt,middlewares:p,delayShow:Ue,delayHide:Dt,float:wt,hidden:kt,noArrow:C,clickable:S,closeOnEsc:R,closeOnScroll:N,closeOnResize:A,openEvents:K,closeEvents:z,globalCloseEvents:H,imperativeModeOnly:ee,style:q,position:ae,isOpen:X,defaultIsOpen:Y,border:Ie,opacity:P,arrowColor:j,setIsOpen:$,afterShow:V,afterHide:L,disableTooltip:D,activeAnchor:Fe,setActiveAnchor:Ae=>an(Ae),role:te};return y.createElement(NI,{...Cn})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||Tc({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||Tc({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 AI(){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 PI({id:e,tooltipText:t}){return l.jsxs(l.Fragment,{children:[l.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:AI()}),l.jsx(RI,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}const fd=y.createContext(null);function pd(){const e=y.useContext(fd);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const hd=y.createContext(()=>{});function FI(){const e=y.useContext(hd);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}var md=Symbol.for("immer-nothing"),Mc=Symbol.for("immer-draftable"),_t=Symbol.for("immer-state"),DI=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=DI[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[_t]}function hr(e){var t;return e?gd(e)||Array.isArray(e)||!!e[Mc]||!!((t=e.constructor)!=null&&t[Mc])||Co(e)||_o(e):!1}var MI=Object.prototype.constructor.toString();function gd(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)===MI}function fo(e,t){xo(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function xo(e){const t=e[_t];return t?t.type_:Array.isArray(e)?1:Co(e)?2:_o(e)?3:0}function Ts(e,t){return xo(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function yd(e,t,n){const r=xo(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function kI(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Co(e){return e instanceof Map}function _o(e){return e instanceof Set}function Xn(e){return e.copy_||e.base_}function Rs(e,t){if(Co(e))return new Map(e);if(_o(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=gd(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[_t];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 ma(e,t=!1){return Oo(e)||qr(e)||!hr(e)||(xo(e)>1&&(e.set=e.add=e.clear=e.delete=jI),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>ma(r,!0))),e}function jI(){yt(2)}function Oo(e){return Object.isFrozen(e)}var LI={};function mr(e){const t=LI[e];return t||yt(0,e),t}var ui;function vd(){return ui}function KI(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function kc(e,t){t&&(mr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function As(e){Ps(e),e.drafts_.forEach(VI),e.drafts_=null}function Ps(e){e===ui&&(ui=e.parent_)}function jc(e){return ui=KI(ui,e)}function VI(e){const t=e[_t];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Lc(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[_t].modified_&&(As(t),yt(4)),hr(e)&&(e=po(t,e),t.parent_||ho(t,e)),t.patches_&&mr("Patches").generateReplacementPatches_(n[_t].base_,e,t.patches_,t.inversePatches_)):e=po(t,n,[]),As(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==md?e:void 0}function po(e,t,n){if(Oo(t))return t;const r=t[_t];if(!r)return fo(t,(o,i)=>Kc(e,r,t,o,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return ho(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),fo(i,(a,c)=>Kc(e,r,o,a,c,n,s)),ho(e,o,!1),n&&e.patches_&&mr("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Kc(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&&!Ts(t.assigned_,r)?i.concat(r):void 0,c=po(e,o,a);if(yd(n,r,c),qr(c))e.canAutoFreeze_=!1;else return}else s&&n.add(o);if(hr(o)&&!Oo(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;po(e,o),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&ho(e,o)}}function ho(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ma(t,n)}function UI(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:vd(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=ga;n&&(o=[r],i=di);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}var ga={get(e,t){if(t===_t)return e;const n=Xn(e);if(!Ts(n,t))return $I(e,n,t);const r=n[t];return e.finalized_||!hr(r)?r:r===Qo(e.base_,t)?(Xo(e),e.copy_[t]=Ds(r,e)):r},has(e,t){return t in Xn(e)},ownKeys(e){return Reflect.ownKeys(Xn(e))},set(e,t,n){const r=wd(Xn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=Qo(Xn(e),t),i=o==null?void 0:o[_t];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(kI(n,o)&&(n!==void 0||Ts(e.base_,t)))return!0;Xo(e),Fs(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 Qo(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Xo(e),Fs(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={};fo(ga,(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),ga.set.call(this,e[0],t,n,e[0])};function Qo(e,t){const n=e[_t];return(n?Xn(n):e)[t]}function $I(e,t,n){var o;const r=wd(t,n);return r?"value"in r?r.value:(o=r.get)==null?void 0:o.call(e.draft_):void 0}function wd(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 Fs(e){e.modified_||(e.modified_=!0,e.parent_&&Fs(e.parent_))}function Xo(e){e.copy_||(e.copy_=Rs(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var qI=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,...f){return s.produce(c,u=>n.call(this,u,...f))}}typeof n!="function"&&yt(6),r!==void 0&&typeof r!="function"&&yt(7);let o;if(hr(t)){const i=jc(this),s=Ds(t,void 0);let a=!0;try{o=n(s),a=!1}finally{a?As(i):Ps(i)}return kc(i,r),Lc(o,i)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===md&&(o=void 0),this.autoFreeze_&&ma(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,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){hr(e)||yt(8),qr(e)&&(e=HI(e));const t=jc(this),n=Ds(e,void 0);return n[_t].isManual_=!0,Ps(t),n}finishDraft(e,t){const n=e&&e[_t];(!n||!n.isManual_)&&yt(9);const{scope_:r}=n;return kc(r,t),Lc(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 Ds(e,t){const n=Co(e)?mr("MapSet").proxyMap_(e,t):_o(e)?mr("MapSet").proxySet_(e,t):UI(e,t);return(t?t.scope_:vd()).drafts_.push(n),n}function HI(e){return qr(e)||yt(10,e),Id(e)}function Id(e){if(!hr(e)||Oo(e))return e;const t=e[_t];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Rs(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Rs(e,!0);return fo(n,(r,o)=>{yd(n,r,Id(o))}),t&&(t.finalized_=!1),n}var Ot=new qI,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 bd=y.createContext(void 0),BI={};function ya(){const e=y.useContext(bd);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function JI({children:e}){const{installation:t}=rt(),{hydratedRevision:n,loading:r}=Gr(),[o,i]=y.useState(BI),s=t==null?void 0:t.config;y.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(o).length>0)&&pv(n,s,i)},[n,r,s,o]);const a=y.useCallback((h,w)=>{i(v=>ti(v,p=>{p[h]=ti(p[h],w)}))},[i]),c=y.useCallback((h,w)=>{i(v=>ti(v,p=>{p[h]=w}))},[i]),f=y.useCallback(()=>{i(ti(h=>{const w=h.other.write;w&&(w.isWriteModified=!1)}))},[i]),u=y.useCallback(h=>{i(ti(w=>{var p;const v=(p=w[h])==null?void 0:p.read;v&&(v.isOptionalFieldsModified=!1,v.isRequiredMapFieldsModified=!1,v.isValueMappingsModified=!1)}))},[i]),d=y.useCallback(h=>{h===dr?f():u(h)},[u,f]),g=y.useMemo(()=>({objectConfigurationsState:o,setObjectConfigurationsState:i,setConfigureState:a,resetConfigureState:c,resetPendingConfigurationState:d}),[o,c,d,a]);return l.jsx(bd.Provider,{value:g,children:e})}const Xt=()=>{const{appName:e}=Te(),{objectConfigurationsState:t,setConfigureState:n}=ya(),{selectedObjectName:r}=pd(),o=du(r||"",t);return{appName:e,configureState:o,setConfigureState:n,selectedObjectName:r}};function WI(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=!ou(o,n);e.read.isRequiredMapFieldsModified=s}}function fi(e,t,n){t(e,r=>WI(r,n))}const zI="Each field must be mapped to a unique value";function va({field:e,onSelectChange:t,allFields:n}){var m;const{configureState:r,selectedObjectName:o,setConfigureState:i}=Xt(),[s,a]=y.useState(!0),{isError:c,removeError:f,getError:u}=Ft(),d=(m=r==null?void 0:r.read)==null?void 0:m.selectedFieldMappings,g=d==null?void 0:d[e.mapToName];y.useEffect(()=>{e._default&&!g&&o&&r&&fi(o,i,[{field:e.mapToName,value:e._default}]),a(!1)},[e,i,o,g,r]);const h=y.useMemo(()=>n.map(I=>({id:I.fieldName,label:I.displayName,value:I.fieldName})),[n]),w=l.jsx(td,{disabled:s,items:h,selectedValue:g||null,onSelectedItemChange:I=>{t({target:{name:e.mapToName,value:I==null?void 0:I.value}})},placeholder:"Please select one",style:{width:"100%"}}),v=y.useCallback(()=>{o&&(fi(o,i,[{field:e.mapToName,value:null}]),c(ue.MAPPING,o)&&f(ue.MAPPING,o))},[e.mapToName,o,i,c,f]),{hasDuplicationError:p,errorMessage:x}=y.useMemo(()=>{const I=u(ue.MAPPING,o),_=Array.isArray(I)&&I.length>0&&I.includes(e.mapToName);return{hasDuplicationError:_,errorMessage:_?zI:""}},[o,u,e.mapToName]);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:[l.jsx("span",{style:{fontWeight:500},children:e.mapToDisplayName??e.mapToName}),l.jsx("span",{children:(e==null?void 0:e.prompt)&&l.jsx(PI,{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:[w,l.jsx(ze,{type:"button",variant:"ghost",onClick:v,children:"Clear"})]})]},e.mapToName),p&&l.jsxs("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:[" ",x," "]},e.mapToName)]})}const GI="_formControl_9qd8d_1",QI="_formLabel_9qd8d_5",XI="_formLabelRequired_9qd8d_11",YI="_formInput_9qd8d_16",ZI="_formInputInvalid_9qd8d_20",eb="_formError_9qd8d_24",tb="_disabled_9qd8d_30",Qn={formControl:GI,formLabel:QI,formLabelRequired:XI,formInput:YI,formInputInvalid:ZI,formError:eb,disabled:tb};function Eo({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:o=!1,errorMessage:i,children:s}){return l.jsxs("div",{className:Pt(Qn.formControl,{[Qn.disabled]:r}),children:[t&&l.jsx("label",{htmlFor:e,className:Pt(Qn.formLabel,{[Qn.formLabelRequired]:n}),children:t}),l.jsx("div",{id:e,className:Pt(Qn.formInput,{[Qn.formInputInvalid]:o}),children:s}),o&&i&&l.jsx("div",{className:Qn.formError,role:"alert",children:i})]})}const nb="_divider_1kmoj_1",Vc={divider:nb};function So({className:e,style:t}){return l.jsx("hr",{className:e?`${Vc.divider} ${e}`:Vc.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(So,{style:{width:"100%",marginLeft:"1rem"}})})]})}function xd({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 rb({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(Eo,{id:r.mapToName,children:l.jsx(va,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function ib(){var w,v;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Xt(),{isError:r,removeError:o,setError:i}=Ft(),s=((w=t==null?void 0:t.read)==null?void 0:w.allFields)||[],{fieldMapping:a}=rt(),c=(v=t==null?void 0:t.read)==null?void 0:v.selectedFieldMappings,f=p=>{const{value:x,name:m}=p.target;!x||xd({selectedFieldMappings:c,selectedObjectName:e,fieldName:m,fieldValue:x,setError:i})||(e&&fi(e,n,[{field:m,value:x}]),r(ue.MAPPING,m)&&o(ue.MAPPING,m),e&&r(ue.MAPPING,e)&&o(ue.MAPPING,e))},u=y.useMemo(()=>!e||!a?[]:Object.values(a[e]||{}).flat().filter(p=>!p.fieldName),[a,e]),d=y.useMemo(()=>{var m;return(((m=t==null?void 0:t.read)==null?void 0:m.optionalMapFields)||[]).filter(I=>!u.some(_=>_.mapToName===I.mapToName))},[t,u]),g=u.length>0;return d.length>0||g?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:[d==null?void 0:d.map(p=>l.jsx(Eo,{id:p.mapToName,children:l.jsx(va,{allFields:s,field:p,onSelectChange:f})},p.mapToName)),g&&l.jsx(rb,{dynamicFieldMappings:u,onSelectChange:f,allFields:s})]})]}):null}function ob(){var f;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Xt(),{isError:r,removeError:o,setError:i}=Ft(),s=(f=t==null?void 0:t.read)==null?void 0:f.selectedFieldMappings,a=u=>{const{value:d,name:g}=u.target;!d||xd({selectedFieldMappings:s,selectedObjectName:e,fieldName:g,fieldValue:d,setError:i})||(e&&fi(e,n,[{field:g,value:d}]),r(ue.MAPPING,g)&&o(ue.MAPPING,g),e&&r(ue.MAPPING,e)&&o(ue.MAPPING,e))},c=y.useMemo(()=>{var u;return((u=t==null?void 0:t.read)==null?void 0:u.requiredMapFields)||[]},[t]);return c!=null&&c.length?l.jsxs(l.Fragment,{children:[l.jsx(Et,{string:"Map the following fields"}),l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:c.map(u=>{var d;return l.jsx(Eo,{id:u.mapToName,isInvalid:r(ue.MAPPING,u.mapToName),errorMessage:"* required",children:l.jsx(va,{allFields:((d=t==null?void 0:t.read)==null?void 0:d.allFields)||[],field:u,onSelectChange:a})},u.mapToName)})})]}):null}const sb=(e,t)=>e.filter(n=>!t.has(n));function ab(){var g,h,w;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Xt(),{fieldMapping:r}=rt(),o=((g=t==null?void 0:t.read)==null?void 0:g.selectedFieldMappings)||{},i=Object.keys(o),s=((h=t==null?void 0:t.read)==null?void 0:h.requiredMapFields)||[],a=((w=t==null?void 0:t.read)==null?void 0:w.optionalMapFields)||[],c=e&&r?Object.values(r[e]||{}).flat().filter(v=>!v.fieldName):[],f=s.concat(c,a).map(v=>v.mapToName),u=new Set(f),d=sb(i,u);y.useEffect(()=>{e&&d.length&&fi(e,n,d.map(v=>({field:v,value:null})))},[e,n,d])}const cb={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function lb({children:e,style:t}){return l.jsx(vn,{style:{...cb,...t},children:e})}const _i=e=>{const t=ut(),{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})},at=e=>{const t=_i(e),{data:n}=t,{provider:r}=rt(),o=n&&Gl(n==null?void 0:n.name,n);return{...t,providerName:o,selectedProvider:e||r}};function ub(){var f,u,d;const{project:e}=Te(),{hydratedRevision:t}=Gr(),{selectedObjectName:n}=Xt(),{providerName:r}=at(),o=e==null?void 0:e.appName,i=(d=(u=(f=t==null?void 0:t.content)==null?void 0:f.read)==null?void 0:u.objects)==null?void 0:d.find(g=>g.objectName===n),s=(i==null?void 0:i.displayName)||n&&Un(n),a=i==null?void 0:i.mapToName,c=(i==null?void 0:i.mapToDisplayName)||a&&Un(a);return c&&o&&r?l.jsx(lb,{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 Uc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function db(...e){return t=>{let n=!1;const r=e.map(o=>{const i=Uc(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():Uc(e[o],null)}}}}function gr(...e){return M.useCallback(db(...e),e)}function No(e,t=[]){let n=[];function r(i,s){const a=M.createContext(s),c=n.length;n=[...n,s];const f=d=>{var x;const{scope:g,children:h,...w}=d,v=((x=g==null?void 0:g[e])==null?void 0:x[c])||a,p=M.useMemo(()=>w,Object.values(w));return l.jsx(v.Provider,{value:p,children:h})};f.displayName=i+"Provider";function u(d,g){var v;const h=((v=g==null?void 0:g[e])==null?void 0:v[c])||a,w=M.useContext(h);if(w)return w;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[f,u]}const o=()=>{const i=n.map(s=>M.createContext(s));return function(a){const c=(a==null?void 0:a[e])||i;return M.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return o.scopeName=e,[r,fb(o,...t)]}function fb(...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:f})=>{const d=c(i)[`__scope${f}`];return{...a,...d}},{});return M.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?M.useLayoutEffect:()=>{},pb=M[" useInsertionEffect ".trim().toString()]||pi;function wa({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,s]=hb({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:o;{const u=M.useRef(e!==void 0);M.useEffect(()=>{const d=u.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,r])}const f=M.useCallback(u=>{var d;if(a){const g=mb(u)?u(e):u;g!==e&&((d=s.current)==null||d.call(s,g))}else i(u)},[a,e,i,s]);return[c,f]}function hb({defaultProp:e,onChange:t}){const[n,r]=M.useState(e),o=M.useRef(n),i=M.useRef(t);return pb(()=>{i.current=t},[t]),M.useEffect(()=>{var s;o.current!==n&&((s=i.current)==null||s.call(i,n),o.current=n)},[n,o]),[n,r,i]}function mb(e){return typeof e=="function"}function gb(e){const t=M.useRef({value:e,previous:e});return M.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function yb(e){const[t,n]=M.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,f=Array.isArray(c)?c[0]:c;s=f.inlineSize,a=f.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}function vb(e,t){return M.useReducer((n,r)=>t[n][r]??n,e)}var Ia=e=>{const{present:t,children:n}=e,r=wb(t),o=typeof n=="function"?n({present:r.isPresent}):M.Children.only(n),i=gr(r.ref,Ib(o));return typeof n=="function"||r.isPresent?M.cloneElement(o,{ref:i}):null};Ia.displayName="Presence";function wb(e){const[t,n]=M.useState(),r=M.useRef(null),o=M.useRef(e),i=M.useRef("none"),s=e?"mounted":"unmounted",[a,c]=vb(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return M.useEffect(()=>{const f=Wi(r.current);i.current=a==="mounted"?f:"none"},[a]),pi(()=>{const f=r.current,u=o.current;if(u!==e){const g=i.current,h=Wi(f);e?c("MOUNT"):h==="none"||(f==null?void 0:f.display)==="none"?c("UNMOUNT"):c(u&&g!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),pi(()=>{if(t){let f;const u=t.ownerDocument.defaultView??window,d=h=>{const v=Wi(r.current).includes(h.animationName);if(h.target===t&&v&&(c("ANIMATION_END"),!o.current)){const p=t.style.animationFillMode;t.style.animationFillMode="forwards",f=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=p)})}},g=h=>{h.target===t&&(i.current=Wi(r.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{u.clearTimeout(f),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:M.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function Wi(e){return(e==null?void 0:e.animationName)||"none"}function Ib(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 Ms(e){const t=bb(e),n=M.forwardRef((r,o)=>{const{children:i,...s}=r,a=M.Children.toArray(i),c=a.find(Cb);if(c){const f=c.props.children,u=a.map(d=>d===c?M.Children.count(f)>1?M.Children.only(null):M.isValidElement(f)?f.props.children:null:d);return l.jsx(t,{...s,ref:o,children:M.isValidElement(f)?M.cloneElement(f,void 0,u):null})}return l.jsx(t,{...s,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function bb(e){const t=M.forwardRef((n,r)=>{const{children:o,...i}=n,s=M.isValidElement(o)?Ob(o):void 0,a=gr(s,r);if(M.isValidElement(o)){const c=_b(i,o.props);return o.type!==M.Fragment&&(c.ref=a),M.cloneElement(o,c)}return M.Children.count(o)>1?M.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var xb=Symbol("radix.slottable");function Cb(e){return M.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===xb}function _b(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{const c=i(...a);return o(...a),c}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function Ob(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 Eb=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],wn=Eb.reduce((e,t)=>{const n=Ms(`Primitive.${t}`),r=M.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}},{}),To="Checkbox",[Sb,d_]=No(To),[Nb,ba]=Sb(To);function Tb(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:o,disabled:i,form:s,name:a,onCheckedChange:c,required:f,value:u="on",internal_do_not_use_render:d}=e,[g,h]=wa({prop:n,defaultProp:o??!1,onChange:c,caller:To}),[w,v]=M.useState(null),[p,x]=M.useState(null),m=M.useRef(!1),I=w?!!s||!!w.closest("form"):!0,_={checked:g,disabled:i,setChecked:h,control:w,setControl:v,name:a,form:s,value:u,hasConsumerStoppedPropagationRef:m,required:f,defaultChecked:Vn(o)?!1:o,isFormControl:I,bubbleInput:p,setBubbleInput:x};return l.jsx(Nb,{scope:t,..._,children:Rb(d)?d(_):r})}var Cd="CheckboxTrigger",_d=M.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},o)=>{const{control:i,value:s,disabled:a,checked:c,required:f,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:g,isFormControl:h,bubbleInput:w}=ba(Cd,e),v=gr(o,u),p=M.useRef(c);return M.useEffect(()=>{const x=i==null?void 0:i.form;if(x){const m=()=>d(p.current);return x.addEventListener("reset",m),()=>x.removeEventListener("reset",m)}},[i,d]),l.jsx(wn.button,{type:"button",role:"checkbox","aria-checked":Vn(c)?"mixed":c,"aria-required":f,"data-state":Nd(c),"data-disabled":a?"":void 0,disabled:a,value:s,...r,ref:v,onKeyDown:Wt(t,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:Wt(n,x=>{d(m=>Vn(m)?!0:!m),w&&h&&(g.current=x.isPropagationStopped(),g.current||x.stopPropagation())})})});_d.displayName=Cd;var xa=M.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:c,onCheckedChange:f,form:u,...d}=e;return l.jsx(Tb,{__scopeCheckbox:n,checked:o,defaultChecked:i,disabled:a,required:s,onCheckedChange:f,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:g})=>l.jsxs(l.Fragment,{children:[l.jsx(_d,{...d,ref:t,__scopeCheckbox:n}),g&&l.jsx(Sd,{__scopeCheckbox:n})]})})});xa.displayName=To;var Od="CheckboxIndicator",Ca=M.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=ba(Od,n);return l.jsx(Ia,{present:r||Vn(i.checked)||i.checked===!0,children:l.jsx(wn.span,{"data-state":Nd(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});Ca.displayName=Od;var Ed="CheckboxBubbleInput",Sd=M.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:o,checked:i,defaultChecked:s,required:a,disabled:c,name:f,value:u,form:d,bubbleInput:g,setBubbleInput:h}=ba(Ed,e),w=gr(n,h),v=gb(i),p=yb(r);M.useEffect(()=>{const m=g;if(!m)return;const I=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(I,"checked").set,S=!o.current;if(v!==i&&C){const R=new Event("click",{bubbles:S});m.indeterminate=Vn(i),C.call(m,Vn(i)?!1:i),m.dispatchEvent(R)}},[g,v,i,o]);const x=M.useRef(Vn(i)?!1:i);return l.jsx(wn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??x.current,required:a,disabled:c,name:f,value:u,form:d,...t,tabIndex:-1,ref:w,style:{...t.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Sd.displayName=Ed;function Rb(e){return typeof e=="function"}function Vn(e){return e==="indeterminate"}function Nd(e){return Vn(e)?"indeterminate":e?"checked":"unchecked"}function Td(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 Ab=["color"],Rd=y.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Td(e,Ab);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"}))}),Pb=["color"],Fb=y.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Td(e,Pb);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 Db="_checkboxGroupContainer_1ya1t_1",Mb="_stack_1ya1t_6",kb="_selectAllContainer_1ya1t_11",jb="_fieldContainer_1ya1t_18",Lb="_checkbox_1ya1t_1",Hr={checkboxGroupContainer:Db,stack:Mb,selectAllContainer:kb,fieldContainer:jb,checkbox:Lb};function Ad({id:e,isChecked:t,label:n,onCheckedChange:r}){return l.jsxs("div",{className:Hr.fieldContainer,children:[l.jsx(xa,{className:Hr.checkbox,id:e,onCheckedChange:r,checked:t,children:l.jsx(Ca,{children:l.jsx(Rd,{})})}),l.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function Pd({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:o}){return l.jsxs("div",{className:Hr.selectAllContainer,children:[l.jsx(xa,{className:Hr.checkbox,id:e,onCheckedChange:r,children:l.jsxs(Ca,{children:[o&&l.jsx(Fb,{}),t===!0&&l.jsx(Rd,{})]})}),l.jsx("label",{htmlFor:e,children:n})]})}function Fd({children:e}){return l.jsx("div",{className:Hr.checkboxGroupContainer,children:e})}function Dd({children:e}){return l.jsx("div",{className:Hr.stack,children:e})}function Kb(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=!ou(s,r);e.read.isOptionalFieldsModified=c}else console.warn("read.savedConfig.optionalFields is undefined")}function $c(e,t,n,r){t(e,o=>Kb(o,n,r))}function Vb(){var d,g;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=Xt(),o=(d=t==null?void 0:t.read)==null?void 0:d.selectedOptionalFields,i=(h,w)=>{h!=="indeterminate"&&r&&t&&$c(r,n,w,h)},s=(g=t==null?void 0:t.read)==null?void 0:g.optionalFields,a=h=>{r&&s&&s.forEach(w=>{$n(w)||$c(r,n,w.fieldName,h)})},c=!!(s&&s.length>0),f=Object.keys(o||{}).length===(s==null?void 0:s.length),u=!f&&Object.keys(o||{}).length>0;return c&&l.jsxs(l.Fragment,{children:[l.jsx(Et,{string:`${e} reads the following optional fields`}),l.jsxs(Fd,{children:[((s==null?void 0:s.length)||0)>=2&&l.jsx(Pd,{id:"select-all-fields",isChecked:f,label:"Select all",onCheckedChange:a,isIndeterminate:u}),l.jsx(Dd,{children:s.map(h=>$n(h)?null:l.jsx(Ad,{id:h.fieldName,isChecked:!!(o!=null&&o[h==null?void 0:h.fieldName]),label:h.displayName,onCheckedChange:w=>i(w,h.fieldName)},h.fieldName))})]})]})}function Ub(){return l.jsx(Vb,{})}const $b={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 qb({children:e,style:t,...n}){return l.jsx("span",{style:{...$b,...t},...n,children:e})}function Hb(){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=>$n(i)?null:l.jsx(qb,{children:i.displayName},i.fieldName)):"There are no required fields."})]})}function Bb(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 Md(e,t,n,r,o){t(e,i=>Bb(i,e,n,r,o))}function Jb(e,t,n){t(e,r=>{r.read&&(r.read.isValueMappingsModified=n)})}function Wb({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(So,{style:{width:"100%",marginLeft:"1rem"}})})]})}function zb({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r,hasError:o}){var C;const{configureState:i,selectedObjectName:s,setConfigureState:a}=Xt(),[c,f]=y.useState(!0),{getError:u,setError:d,resetBoundary:g,isError:h,removeError:w}=Ft(),v=y.useMemo(()=>{var S,R;return((R=(S=i==null?void 0:i.read)==null?void 0:S.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(()=>{f(!1)},[e,a,s,p,i]);const x=y.useMemo(()=>r.map(S=>({id:S.value,label:S.displayValue,value:S.value})),[r]),m=y.useCallback(S=>{if(S){if(Object.values(v).some(R=>R===S.value&&R!==p)){const R=[...Object.entries(v).filter(([N,A])=>A===S.value&&A!==p).map(([N])=>N),e.mappedValue];d(ue.VALUE_MAPPING,n,R);return}u(ue.VALUE_MAPPING,n)&&g(ue.VALUE_MAPPING),t({target:{name:e.mappedValue,value:S.value,fieldName:n}})}},[t,v,p,n,e.mappedValue,g,d,u]),I=y.useMemo(()=>l.jsx(td,{disabled:c,items:x,selectedValue:p||null,onSelectedItemChange:m,placeholder:"Please select one",style:{border:o?"2px solid red":void 0,borderRadius:"8px",width:"100%"}},p),[p,c,x,m,o]),_=y.useCallback(()=>{s&&(Md(s,a,e.mappedValue,"",n),h(ue.VALUE_MAPPING,n)&&w(ue.VALUE_MAPPING,n))},[s,a,e.mappedValue,n,h,w]);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:[I,l.jsx(ze,{type:"button",variant:"ghost",onClick:_,children:"Clear"})]})]},e.mappedValue)}function Gb(){var h,w,v;const{fieldMapping:e}=rt(),{selectedObjectName:t,configureState:n,setConfigureState:r}=Xt(),{isError:o,removeError:i,getError:s}=Ft(),a=(h=n==null?void 0:n.read)==null?void 0:h.selectedFieldMappings,c=(w=n==null?void 0:n.read)==null?void 0:w.selectedValueMappings,f=(v=n==null?void 0:n.read)==null?void 0:v.isValueMappingsModified,u=y.useRef(!1),d=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:m}=p[x];a!=null&&a[m]&&(p[x].fieldName=a[m])}return p},[t,e,a]),g=y.useCallback(p=>{const{value:x,name:m,fieldName:I}=p.target;x&&(t&&Md(t,r,m,x,I),o(ue.VALUE_MAPPING,m)&&i(ue.VALUE_MAPPING,m))},[t,r,o,i]);return y.useEffect(()=>{var p;if(t&&c){const x=((p=e==null?void 0:e[t])==null?void 0:p.filter(I=>I.fieldName&&I.mappedValues.length>0))||[];x.every(I=>{const _=c[I.fieldName]||{};return Object.keys(_).length===Object.keys(I.mappedValues).length})&&x.length>0?!f&&!u.current&&(Jb(t,r,!0),u.current=!0):u.current=!1}},[c,d,t,r,e,f]),d!=null&&d.length?l.jsx(l.Fragment,{children:d.map(p=>{var S,R,N;if(!p.fieldName)return null;const x=(R=(S=n==null?void 0:n.read)==null?void 0:S.allFieldsMetadata)==null?void 0:R[p.fieldName],m=x==null?void 0:x.valueType;if(!["singleSelect","multiSelect"].includes(m))return console.error("fieldName is not a singleSelect or multiSelect",p),null;const I=x==null?void 0:x.values;if(!I)return null;const _=Object.keys(I).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,I),null):l.jsxs(l.Fragment,{children:[l.jsx(Wb,{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(Eo,{id:p.mapToName||p.fieldName,children:(N=p==null?void 0:p.mappedValues)==null?void 0:N.map(A=>{var ee,q,ae;const K=s(ue.VALUE_MAPPING,p.fieldName),z=Array.isArray(K)&&K.includes(A.mappedValue),H=((ae=(q=(ee=n==null?void 0:n.read)==null?void 0:ee.allFieldsMetadata)==null?void 0:q[p.fieldName])==null?void 0:ae.values)||[];return l.jsxs(l.Fragment,{children:[l.jsx(zb,{allValueOptions:H,mappedValue:A,onSelectChange:g,fieldName:(p==null?void 0:p.fieldName)||"",hasError:z},`${A.mappedValue}-${p.fieldName}`),z&&l.jsx("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:`Each ${p.mapToName||p.fieldName} must be mapped to a unique value`},A.mappedValue)]})})},p.mapToName||p.fieldName)})]})})}):null}function Qb(){return ab(),l.jsxs(l.Fragment,{children:[l.jsx(ub,{}),l.jsx(Hb,{}),l.jsx(ob,{}),l.jsx(ib,{}),l.jsx(Gb,{}),l.jsx(Ub,{})]})}function Xb(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,f=!uv(a,s);e.write.isWriteModified=f}}}function qc(e,t,n,r){t(e,o=>{Xb(o,n,r)})}function Yb(){var d,g,h,w;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=Xt(),o=(d=n==null?void 0:n.write)==null?void 0:d.selectedWriteObjects,i=(g=n==null?void 0:n.write)==null?void 0:g.writeObjects,s=(v,p)=>{v!=="indeterminate"&&t&&n&&qc(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(m=>{qc(t,r,m.objectName,v)}))},c=!!i,f=Object.keys(o||{}).length===((w=(h=n==null?void 0:n.write)==null?void 0:h.writeObjects)==null?void 0:w.length),u=!f&&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(Fd,{children:[((i==null?void 0:i.length)||0)>=2&&l.jsx(Pd,{id:"select-all-fields",onCheckedChange:a,isIndeterminate:u,isChecked:f,label:"Select all"}),l.jsx(Dd,{children:i.map(v=>l.jsx(Ad,{id:v.objectName,onCheckedChange:p=>s(p,v.objectName),isChecked:!!(o!=null&&o[v.objectName]),label:v.displayName},v.objectName))})]})]})}function Zb(){return l.jsx(l.Fragment,{children:l.jsx(Yb,{})})}const ex="_authenticationRow_cjz1t_1",tx="_field_cjz1t_8",nx="_value_cjz1t_12",Yo={authenticationRow:ex,field:tx,value:nx};function Hc({label:e,value:t}){return l.jsxs("div",{className:Yo.authenticationRow,children:[l.jsx("div",{className:Yo.field,children:e}),l.jsx("div",{className:Yo.value,children:t})]})}function rx(){const{selectedConnection:e}=Qt(),{providerName:t}=at(),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(Hc,{label:o,value:e==null?void 0:e.providerWorkspaceRef}),l.jsx(Hc,{label:"Status",value:e==null?void 0:e.status})]})]})}const ix=()=>{const e=ut(),t=vt();return Jr({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 kd({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const{projectId:r}=Te(),{integrationId:o,installation:i,setIntegrationDeleted:s,onUninstallSuccess:a}=rt(),[c,f]=y.useState(!1),u=!r||!o||!(i!=null&&i.id)||c,d=ix(),g=async()=>{u||(f(!0),console.warn("uninstalling installation",{projectId:r,integrationId:o,installationId:i.id}),d.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:()=>f(!1)}))},h=c?"Uninstalling...":e,w=l.jsx(ze,{type:"button",onClick:g,disabled:u,variant:t,style:n,children:h});return i!=null&&i.id?w:null}function ox(){const{installation:e}=rt(),{providerName:t}=at();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(kd,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})]}):null}function In({error:e}){return e?l.jsx(Ii,{style:{marginTop:"2em"},children:e}):null}const sx="_input_1ymb7_1",ax="_inputError_1ymb7_27",cx="_error_1ymb7_43",Zo={input:sx,inputError:ax,error:cx};function lx({id:e,type:t,className:n,isError:r=!1,...o}){const i=r?Pt(Zo.inputError,Zo.input):Zo.input;return l.jsx("input",{id:e,type:t,className:Pt(i,n),...o})}const ux="_textarea_18zl4_1",dx="_textareaError_18zl4_14",fx="_error_18zl4_29",es={textarea:ux,textareaError:dx,error:fx};function px({className:e,isError:t=!1,...n}){const r=t?Pt(es.textareaError,es.textarea):es.textarea;return l.jsx("textarea",{className:Pt(e,r),...n})}const Bt={Input:lx,Textarea:px},hx=()=>{const{project:e}=Te(),t=e==null?void 0:e.id,n=ut();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 jd(){var n,r;const{data:e}=hx();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(Wr,{children:l.jsxs(vn,{children:[l.jsx("div",{style:{padding:"3rem 2rem"},children:e}),l.jsx(jd,{})]})})}function vr({children:e}){return l.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function mx({children:e}){return l.jsx("p",{style:{padding:".5em 0"},children:e})}const gx="_link_oo2kv_1",yx={link:gx};function Ld({href:e,className:t,style:n,label:r,children:o,newTab:i=!1}){return l.jsx("a",{className:Pt(yx.link,t),style:n,href:e,"aria-label":r||void 0,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:o})}function mo({url:e,providerDisplayName:t,credentialName:n}){return l.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[l.jsx(Ld,{href:e,newTab:!0,children:l.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," ","about where to find your ",t," ",n,"."]})}function _a(e,t){const n={},r=[];if(e.forEach(o=>{const i=t[o.name];!i||i.trim()===""?r.push(o.displayName||o.name):n[o.name]={value:i,source:"input"}}),r.length>0)throw new Error(`Please fill in the following required fields: ${r.join(", ")}.`);return n}function hi(e,t){return e.every(n=>{const r=t[n.name];return r&&r.trim()!==""})}function Kd({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o,submitButtonType:i}){var _,C;const[s,a]=y.useState(!1),c=()=>a(S=>!S),[f,u]=y.useState({apiKey:""}),d=((_=t.metadata)==null?void 0:_.input)||[],g=S=>{const{name:R,value:N}=S.currentTarget;u(A=>({...A,[R]:N.trim()}))},{apiKey:h}=f,{providerName:w}=at(e),v=h.length>0,p=hi(d,f),x=r||!v||!p,m=(C=t.apiKeyOpts)==null?void 0:C.docsURL,I=()=>{const S=_a(d,f);n({apiKey:h,providerMetadata:S})};return l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[m&&l.jsx(mo,{url:m,providerDisplayName:w||Un(e),credentialName:"API key"}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(Bt.Input,{id:"password",name:"password",type:s?"text":"password",placeholder:"API Key",onChange:g}),l.jsx(ze,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:c,variant:o,children:s?"Hide":"Show"})]}),d.map(S=>l.jsxs("div",{children:[S.docsURL&&l.jsx(mo,{url:S.docsURL,providerDisplayName:w||Un(e),credentialName:S.displayName||S.name}),l.jsx(Bt.Input,{id:S.name,name:S.name,type:"text",placeholder:S.displayName||S.name,onChange:g})]},S.name)),l.jsx(ze,{style:{marginTop:"1em",width:"100%"},disabled:x,type:i||"submit",onClick:I,variant:o,children:"Next"})]})}function vx({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=at(e);return l.jsxs(yr,{children:[l.jsx(vr,{children:`Set up ${i} integration`}),l.jsx(In,{error:r}),l.jsx(Kd,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function wx({...e}){return l.jsx(vx,{...e})}const Ix={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 Ro({children:e,style:t}){return l.jsx(vn,{style:{...Ix,...t},children:e})}const Oa=()=>{const e=ut(),t=vt(),[n,r]=y.useState(null);return{...Jr({mutationKey:["updateConnection"],mutationFn:async i=>(await e()).connectionApi.updateConnection(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)}}),errorMsg:n}};function bx({provider:e}){const{projectIdOrName:t}=Te(),{providerName:n,data:r}=at(e),{selectedConnection:o,isConnectionsLoading:i}=Qt(),{mutateAsync:s,isPending:a,error:c}=Oa(),[f,u]=y.useState(null),[d,g]=y.useState(!1),h=()=>g(!1),w=()=>{g(!0),u(null)},v=(c==null?void 0:c.message)||f||null,p=async x=>{h(),u(null);try{await s({projectIdOrName:t||"",connectionId:(o==null?void 0:o.id)||"",updateConnectionRequest:{updateMask:["apiKey"],connection:{apiKey:x.apiKey}}},{onError:m=>{console.error("Update connection error:",m),Le(m,u)},onSuccess:()=>{w()}})}catch(m){console.error("Update connection caught error:",m),Le(m,u)}};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`}),d&&l.jsx(Ro,{children:"Connection updated successfully"}),v&&l.jsx(Ii,{children:`Error updating connection ${v}`}),l.jsx(Kd,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:p,isButtonDisabled:a||i,buttonVariant:"ghost",submitButtonType:"button"})]})]}):null}function Vd({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o}){var I,_;const[i,s]=y.useState(!1),a=()=>s(C=>!C),[c,f]=y.useState({username:"",password:""}),u=((I=t.metadata)==null?void 0:I.input)||[],{username:d,password:g}=c,{providerName:h}=at(e),w=C=>{const{name:S,value:R}=C.currentTarget;f(N=>({...N,[S]:R.trim()}))},v=hi(u,c),p=r||!v,x=()=>{const C=_a(u,c);n({user:d,pass:g,providerMetadata:C})},m=(_=t.basicOpts)==null?void 0:_.docsURL;return l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[m&&l.jsx(mo,{url:m,providerDisplayName:h||Un(e),credentialName:"credentials"}),l.jsx(Bt.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:w}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(Bt.Input,{id:"password",name:"password",type:i?"text":"password",placeholder:"Password",onChange:w}),l.jsx(ze,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,variant:o,children:i?"Hide":"Show"})]}),u.map(C=>l.jsxs("div",{children:[C.docsURL&&l.jsx(mo,{url:C.docsURL,providerDisplayName:h||Un(e),credentialName:C.displayName||C.name}),l.jsx(Bt.Input,{id:C.name,name:C.name,type:"text",placeholder:C.displayName||C.name,onChange:w})]},C.name)),l.jsx(ze,{style:{marginTop:"1em",width:"100%"},disabled:p,type:"button",onClick:x,variant:o,children:"Next"})]})}function xx({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=at(e);return l.jsxs(yr,{children:[l.jsx(vr,{children:`Set up ${i} integration`}),l.jsx(In,{error:r}),l.jsx(Vd,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function Cx({...e}){return l.jsx(xx,{...e})}function _x({provider:e}){const{projectIdOrName:t}=Te(),{providerName:n,data:r}=at(e),{selectedConnection:o,isConnectionsLoading:i}=Qt(),{mutateAsync:s,isPending:a,error:c}=Oa(),[f,u]=y.useState(null),[d,g]=y.useState(!1),h=()=>g(!1),w=()=>{g(!0),u(null)},v=(c==null?void 0:c.message)||f||null,p=async x=>{h(),u(null);try{await s({projectIdOrName:t||"",connectionId:(o==null?void 0:o.id)||"",updateConnectionRequest:{updateMask:["basicAuth"],connection:{basicAuth:{username:x.user,password:x.pass}}}},{onError:m=>{console.error(m),Le(m,u)},onSuccess:()=>{w()}})}catch(m){console.error(m),Le(m,u)}};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`}),d&&l.jsx(Ro,{children:"Connection updated successfully"}),v&&l.jsx(Ii,{children:`Error updating connection: ${v}`}),l.jsx(Vd,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:p,isButtonDisabled:a||i,buttonVariant:"ghost"})]})]}):null}function Ud({provider:e,handleSubmit:t,isButtonDisabled:n,explicitScopesRequired:r,buttonVariant:o}){var R;const[i,s]=y.useState(!1),[a,c]=y.useState({clientSecret:"",clientId:"",scopes:""}),[f,u]=y.useState(null),{data:d}=_i(e),g=((R=d==null?void 0:d.metadata)==null?void 0:R.input)||[],h=()=>s(N=>!N),w=N=>{const{name:A,value:K}=N.currentTarget;c(z=>({...z,[A]:K.trim()})),u(null)},{clientSecret:v,clientId:p,scopes:x}=a,m=v.length>0,I=p.length>0,_=hi(g,a),C=n||!m||!I||!_,S=()=>{const N=_a(g,a),A={clientId:p,clientSecret:v,providerMetadata:N};r&&x.length>0&&(A.scopes=Xy(x)),t(A)};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[l.jsx(Bt.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:w}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(Bt.Input,{id:"clientSecret",name:"clientSecret",type:i?"text":"password",placeholder:"Client Secret",onChange:w}),l.jsx(ze,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:h,variant:o,children:i?"Hide":"Show"})]}),r&&l.jsx(Bt.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:w}),g.map(N=>l.jsx(Bt.Input,{id:N.name,name:N.name,type:"text",placeholder:N.displayName||N.name,onChange:w},N.name))]}),l.jsx(In,{error:f}),l.jsx("br",{}),l.jsx(ze,{style:{width:"100%"},disabled:C,type:"button",onClick:S,variant:o,children:"Next"})]})}function Ox({provider:e,handleSubmit:t,error:n,isButtonDisabled:r,providerName:o,explicitScopesRequired:i}){return l.jsxs(yr,{children:[l.jsx(vr,{children:`Set up ${o} integration`}),l.jsx(In,{error:n}),l.jsx("br",{}),l.jsx(Ud,{provider:e,handleSubmit:t,isButtonDisabled:r,explicitScopesRequired:i})]})}function Ex({provider:e}){var m;const{projectIdOrName:t}=Te(),{selectedConnection:n,isConnectionsLoading:r}=Qt(),{providerName:o,data:i}=at(e),{mutateAsync:s,isPending:a,error:c}=Oa(),[f,u]=y.useState(null),[d,g]=y.useState(!1),h=()=>{g(!1)},w=()=>{g(!0),u(null)},v=(m=i==null?void 0:i.oauth2Opts)==null?void 0:m.explicitScopesRequired,p=(c==null?void 0:c.message)||f||null,x=async I=>{h(),u(null);try{await s({projectIdOrName:t||"",connectionId:(n==null?void 0:n.id)||"",updateConnectionRequest:{updateMask:["oauth2ClientCredentials"],connection:{oauth2ClientCredentials:{clientId:I.clientId,clientSecret:I.clientSecret,scopes:I.scopes}}}}),w()}catch(_){Le(_,u)}};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}`}),d&&l.jsx(Ro,{children:"Connection updated successfully"}),p&&l.jsx(Ii,{children:`Error updating connection ${p}`}),l.jsx(Ud,{provider:o||"",handleSubmit:x,isButtonDisabled:a||r,explicitScopesRequired:v,buttonVariant:"ghost"})]})]})}const Bc=600,Jc=600,Sx="AUTHORIZATION_SUCCEEDED",Nx="AUTHORIZATION_FAILED";function Tx(e,t,n,r){return y.useCallback(()=>{if(!r)return;const o=window.screenX+(window.outerWidth-Bc)/2,i=window.screenY+(window.outerHeight-Jc)/2.5,s=`width=${Bc},height=${Jc},left=${o},top=${i}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function Rx(e,t,n,r){const o=vt();return y.useCallback(i=>{var s,a;if(i.origin===Ty){if(i.data.eventType===Sx){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===Nx&&(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 Ea({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:o,onSuccessConnect:i,isSuccessConnect:s,onWindowClose:a}){const[c,f]=y.useState(null),[u,d]=y.useState(null),g=vt(),h=y.useRef(null),w=Rx(f,u,r,i),v=Tx(n,d,w,t);y.useEffect(()=>{t&&!u&&!c&&!o&&!s&&(r==null||r(null),v())},[t,u,v,c,o,s,r]);const p=y.useCallback(()=>{g.invalidateQueries({queryKey:["amp","connections"]}),d(null),!c&&!o?(console.error("Window closed and no connection was found. Please try again."),r==null||r("Window closed prematurely. Please wait and try again.")):c&&(r==null||r(null)),a==null||a(),setTimeout(()=>{window.removeEventListener("message",w)},1e3)},[c,o,r,a,w,g]);return y.useEffect(()=>{if(u)return h.current=setInterval(()=>{(!u||u.closed)&&(h.current&&clearInterval(h.current),h.current=null,p())},500),()=>{h.current&&(clearInterval(h.current),h.current=null),window.removeEventListener("message",w)}},[p,u,w]),l.jsx("div",{children:e})}const Ax=()=>{const e=ut(),t=vt();return Jr({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 Px({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(In,{error:t}),l.jsx(ze,{variant:"ghost",style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function Fx({provider:e}){const{selectedConnection:t,isConnectionsLoading:n}=Qt(),r=t==null?void 0:t.id,o=t==null?void 0:t.projectId,{providerName:i}=at(e),{mutateAsync:s,isPending:a,error:c}=Ax(),[f,u]=y.useState(null),[d,g]=y.useState(!1),[h,w]=y.useState(null),v=()=>{g(!1)},p=()=>{g(!0),u(null),w(null)},x=(c==null?void 0:c.message)||f||null,m=async()=>{v(),u(null);try{const _=await s({projectIdOrName:o||"",connectionId:r||""});w(_)}catch(_){Le(_,u)}},I=y.useCallback(_=>{u(_)},[]);return l.jsxs(l.Fragment,{children:[l.jsx(Et,{string:"Update connection"}),d&&l.jsx(Ro,{children:"Connection updated successfully"}),l.jsx(Ea,{windowTitle:`Connect to ${i}`,oauthUrl:h||null,onError:I,error:x,isSuccessConnect:d,onSuccessConnect:p,children:l.jsx(Px,{handleSubmit:m,error:x,providerName:i,isButtonDisabled:a||n||d})})]})}function $d({provider:e}){var r;const{data:t}=_i(e);if((t==null?void 0:t.authType)===Qa.Basic)return l.jsx(_x,{provider:e});if((t==null?void 0:t.authType)===Qa.ApiKey)return l.jsx(bx,{provider:e});const n=(r=t==null?void 0:t.oauth2Opts)==null?void 0:r.grantType;if(n){if(n===Ko.AuthorizationCode||n===Ko.AuthorizationCodePkce)return l.jsx(Fx,{provider:e});if(n===Ko.ClientCredentials)return l.jsx(Ex,{provider:e})}return null}function Dx(){return l.jsxs(l.Fragment,{children:[l.jsx(rx,{}),l.jsx($d,{}),l.jsx(ox,{})]})}function qd({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:o}){var S,R,N,A;const{installation:i}=rt(),{hydratedRevision:s,loading:a}=Gr(),{configureState:c,selectedObjectName:f}=Xt(),u=i==null?void 0:i.config,d=u&&f&&!!tu(u,f)||!1,g=((S=c==null?void 0:c.read)==null?void 0:S.isOptionalFieldsModified)||((R=c==null?void 0:c.read)==null?void 0:R.isRequiredMapFieldsModified)||((N=c==null?void 0:c.read)==null?void 0:N.isValueMappingsModified),h=(A=c==null?void 0:c.write)==null?void 0:A.isWriteModified,x=a||n||!c||!f||!(g||h||r||f!==dr&&!d),m=f===dr,I=f===ro,_=l.jsx(ze,{type:"submit",disabled:x,children:r?"Install":"Save"}),C=l.jsx(ze,{type:"button",onClick:t,disabled:x,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:!I&&l.jsxs(l.Fragment,{children:[_,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(Ii,{children:typeof o=="string"?o:"Installation Failed."}),a&&l.jsx(ci,{}),s&&!m&&!I&&l.jsx(Qb,{}),s&&m&&!I&&l.jsx(Zb,{}),!a&&I&&l.jsx(Dx,{})]})]})}const Hd=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:o,onUpdateSuccess:i}=rt(),{hydratedRevision:s,loading:a}=Gr(),{selectedObjectName:c}=pd(),{selectedConnection:f}=Qt(),u=yl(),{projectId:d}=Te(),{resetBoundary:g,setErrors:h,setError:w,getError:v}=Ft(),{resetConfigureState:p,objectConfigurationsState:x,resetPendingConfigurationState:m}=ya(),I=du(c||"",x),{onNextIncompleteTab:_}=FI(),C=y.useCallback(()=>{g(ue.INSTALLATION_MUTATION)},[g]),S=y.useCallback(N=>N?A=>{w(ue.INSTALLATION_MUTATION,N,A)}:A=>{console.error("objectName is required to set installation error: ",A)},[w]),R=y.useCallback(N=>N?v(ue.INSTALLATION_MUTATION,N):"",[v]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:s,loading:a,selectedObjectName:c,selectedConnection:f,apiKey:u,projectId:d,resetBoundary:g,setErrors:h,setMutateInstallationError:S,getMutateInstallationError:R,resetMutateInstallationErrorState:C,resetConfigureState:p,objectConfigurationsState:x,resetPendingConfigurationState:m,configureState:I,onInstallSuccess:o,onUpdateSuccess:i,onNextIncompleteTab:_}},Mx=void 0;function kx(){const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:o,loading:i,selectedObjectName:s,selectedConnection:a,apiKey:c,projectId:f,resetBoundary:u,setErrors:d,setMutateInstallationError:g,getMutateInstallationError:h,resetMutateInstallationErrorState:w,resetConfigureState:v,objectConfigurationsState:p,resetPendingConfigurationState:x,configureState:m,onInstallSuccess:I,onNextIncompleteTab:_}=Hd(),[C,S]=y.useState(!1),R=s===dr,N=h(s),A=y.useCallback(()=>{u(ue.MAPPING),o!=null&&o.content&&!i&&s&&au(o,Mx,s,v)},[u,o,i,s,v]);y.useEffect(()=>{!m&&(o!=null&&o.content)&&!i&&A()},[m,p,o,i,A]);const K=()=>{w();const{requiredMapFields:ee,selectedFieldMappings:q}=(m==null?void 0:m.read)||{},{errorList:ae}=iu(ee,q,d);ae.length>0||(s&&(a!=null&&a.id)&&c&&f&&e&&t&&n&&o?(S(!0),gv(f,e,t,n,a.id,s,c,o,m,g(s),r,I).finally(()=>{S(!1),x(s),_()})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},z=()=>{w(),s&&(a!=null&&a.id)&&c&&f&&e&&t&&n&&o?(S(!0),wv(f,e,t,n,a.id,c,o,m,g(s),r,I).finally(()=>{S(!1),x(s),_()})):console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},H=ee=>{ee.preventDefault(),R?z():K()};return l.jsx(qd,{errorMsg:N,isCreateMode:!0,isLoading:C,onSave:H,onReset:A})}function jx({updateConfig:e,projectId:t,integrationId:n,installationId:r,apiKey:o,selectedObjectName:i,setInstallation:s,onUpdateSuccess:a,setError:c}){const f={projectIdOrName:t,installationId:r,integrationId:n,installationUpdate:{updateMask:[`config.content.read.objects.${Zy(i)}`],installation:{config:e}}};return $s().installationApi.updateInstallation(f,{headers:{"X-Api-Key":o,"Content-Type":"application/json"}}).then(u=>{s(u),a==null||a(u.id,u.config)}).catch(u=>{Le(u,c)})}const Lx=(e,t,n,r,o,i)=>{const s=cu(e),a=lu(e),c=uu(e),f={content:{read:{objects:{[t]:{objectName:t,schedule:r,destination:(n==null?void 0:n.destination)||"",selectedFields:s,selectedFieldMappings:a,selectedValueMappings:c||{},backfill:i}}}}};return wi(o)&&(f.content||(f.content={}),f.content.proxy={enabled:!0}),f},Kx=(e,t,n,r,o,i,s,a,c,f,u)=>{const d=Lx(i,r||"",a,a.schedule,c,a.backfill);return d?jx({updateConfig:d,projectId:e,integrationId:t,installationId:n,apiKey:o,selectedObjectName:r,setError:f,setInstallation:s,onUpdateSuccess:u}):(console.error("Error when generating updateConfig from configureState"),Promise.resolve(null))},Vx=(e,t)=>{const r={content:{write:{objects:pu(e)}}};return wi(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r},Ux=(e,t,n,r,o,i,s,a,c)=>{const f=Vx(o,i);if(!f)return console.error("Error when generating write updateConfig from configureState"),Promise.resolve(null);const u={projectIdOrName:e,installationId:n,integrationId:t,installationUpdate:{updateMask:["config.content.write.objects"],installation:{config:f}}};return $s().installationApi.updateInstallation(u,{headers:{"X-Api-Key":r,"Content-Type":"application/json"}}).then(d=>{a(d),c==null||c(d.id,d.config)}).catch(d=>{Le(d,s)})};function $x({installation:e,integrationObj:t}){const{setInstallation:n,hydratedRevision:r,loading:o,selectedObjectName:i,apiKey:s,projectId:a,resetBoundary:c,setErrors:f,setMutateInstallationError:u,getMutateInstallationError:d,resetConfigureState:g,resetPendingConfigurationState:h,configureState:w,onUpdateSuccess:v,onNextIncompleteTab:p}=Hd(),[x,m]=y.useState(!1),I=i===dr,_=d(i),{config:C}=e,S=y.useCallback(()=>{c(ue.MAPPING),r!=null&&r.content&&!o&&i&&au(r,C,i,g)},[c,r,o,i,C,g]);y.useEffect(()=>{w||S()},[w,S]);const R=y.useMemo(()=>{var H,ee,q;return(q=(ee=(H=r==null?void 0:r.content)==null?void 0:H.read)==null?void 0:ee.objects)==null?void 0:q.find(ae=>(ae==null?void 0:ae.objectName)===i)},[r,i]),N=()=>{const{requiredMapFields:z,selectedFieldMappings:H}=(w==null?void 0:w.read)||{},{errorList:ee}=iu(z,H,f);ee.length>0||(r&&e&&i&&s&&a&&R?(m(!0),Kx(a,t.id,e.id,i,s,w,n,R,r,u(i),v).finally(()=>{m(!1),h(i),p()})):console.error("UpdateInstallation - onSaveUpdate missing required props"))},A=()=>{e&&i&&s&&a&&r?(m(!0),Ux(a,t.id,e.id,s,w,r,u(i),n,v).finally(()=>{m(!1),h(i),p()})):console.error("UpdateInstallation - onSaveUpdate missing required props")},K=z=>{z.preventDefault(),I?A():N()};return l.jsx(qd,{errorMsg:_,onSave:K,onReset:S,isLoading:x})}function qx(){const{integrationObj:e,installation:t}=rt();return e?t&&e?l.jsx($x,{installation:t,integrationObj:e}):l.jsx(kx,{}):l.jsx(Jl,{message:"We can't load the integration"})}const Hx=()=>{const e=ut(),t=vt(),[n,r]=y.useState(null);return{...Jr({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 Bx(){return l.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),l.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Sa({text:e,children:t}){return l.jsx(Wr,{children:l.jsxs(vn,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[l.jsx(Bx,{}),l.jsx("p",{children:e}),t]})})}function Jx({provider:e}){const{providerName:t}=at(e),n=`You have successfully installed your ${t} integration.`;return l.jsx(Sa,{text:n,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:l.jsx(kd,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const Wx=e=>{const{read:t,write:n}=(e==null?void 0:e.content)??{};return!t&&!n};function zx({children:e}){var C;const t=y.useRef(!1),{projectId:n}=Te(),{hydratedRevision:r,loading:o}=Gr(),{integrationObj:i,installation:s,groupRef:a,consumerRef:c,onInstallSuccess:f,isIntegrationDeleted:u}=rt(),{mutate:d,isIdle:g,isPending:h,error:w,errorMsg:v}=Hx(),{selectedConnection:p,isConnectionsLoading:x}=Qt(),m=o||h||x,I=(C=r==null?void 0:r.content)==null?void 0:C.provider,_=Wx(r);return y.useEffect(()=>{var S;if(!m&&!x&&r&&_&&!s&&p&&(i!=null&&i.id)&&!u&&I){const R={projectIdOrName:n,integrationId:i==null?void 0:i.id,installation:{groupRef:a,connectionId:p==null?void 0:p.id,config:{content:{provider:I}}}};wi(r)===!0&&(R.installation.config.content.proxy=(S=r==null?void 0:r.content)==null?void 0:S.proxy),g&&!t.current&&(d(R,{onSuccess:N=>{f==null||f(N==null?void 0:N.id,N.config)}}),t.current=!0)}},[r,_,s,p,n,i==null?void 0:i.id,a,c,m,f,u,x,I,d,g]),_&&I&&s?l.jsx(Jx,{provider:I}):w?l.jsx(Jt,{message:v??"Create installation failed"}):i?m?l.jsx(zr,{}):l.jsx("div",{children:e}):l.jsx(Jt,{message:"We can't load the integration"})}function Ao(){const e=ut(),t=vt();return Jr({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 Gx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:c}=Te(),f=Ao(),u=y.useCallback(d=>{var v;const{apiKey:g,providerMetadata:h}=d,w={projectIdOrName:c,generateConnectionParams:{providerWorkspaceRef:(v=h==null?void 0:h.workspace)==null?void 0:v.value,groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,apiKey:g,...h&&{providerMetadata:h}}};f.mutate(w)},[c,i,o,r,n,e,f]);return a===null?l.jsx(wx,{provider:e,providerInfo:t,handleSubmit:u,error:null}):s}function Qx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:c}=Te(),f=Ao(),u=y.useCallback(d=>{var p;const{user:g,pass:h,providerMetadata:w}=d,v={projectIdOrName:c,generateConnectionParams:{providerWorkspaceRef:(p=w==null?void 0:w.workspace)==null?void 0:p.value,groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:g,password:h},...w&&{providerMetadata:w}}};f.mutate(v)},[c,i,o,r,n,e,f]);return a===null?l.jsx(Cx,{provider:e,providerInfo:t,handleSubmit:u,error:null}):s}function Xx({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(In,{error:t}),o,l.jsx(ze,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function Yx({...e}){return l.jsx(Xx,{...e})}function Zx({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s,providerName:a}){const{projectIdOrName:c}=Te(),f=Ao(),u=y.useCallback(()=>{const d={projectIdOrName:c,generateConnectionParams:{groupName:o,groupRef:r,consumerName:n,consumerRef:t,provider:e}};f.mutate(d)},[c,o,r,n,t,e,f]);return s===null?l.jsx(Yx,{handleSubmit:u,error:null,providerName:a}):i}const eC=()=>{const e=ut(),{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})},tC=e=>{const t=ut(),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})},nC=Hs("VITE_AMP_ENABLE_CSRF",!1),rC=Hs("NEXT_AMP_ENABLE_CSRF",!1),iC=Hs("REACT_APP_AMP_ENABLE_CSRF",!1),oC=!!nC||!!rC||!!iC,Bd=(e,t,n,r,o,i,s)=>{var S;const{projectId:a}=Te(),{data:c,isLoading:f,error:u}=_i(n),{data:d,isLoading:g,error:h}=eC(),w=d==null?void 0:d.find(R=>R.provider===n),v=c?Gl(n,c):null,p={providerWorkspaceRef:i||((S=s==null?void 0:s.workspace)==null?void 0:S.value),projectId:a,groupRef:t,groupName:o,consumerRef:e,consumerName:r,providerAppId:w==null?void 0:w.id,provider:n,enableCSRFProtection:oC,providerMetadata:s},{data:x,error:m,isLoading:I,refetch:_}=tC(p);return y.useEffect(()=>{c&&n&&d&&!w&&console.error(`You must first set up a ${v} Provider App using the Ampersand Console. `,{provInfo:c,provider:n,providerApps:d,app:w})},[w,v,c,n,d]),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(()=>{m&&(console.error("Error fetching OAuth connect:",m),Le(m))},[m]),{url:x,error:u||h||m,isLoading:f||g||I,refetchOauthConnect:async()=>{var R,N;if((c==null?void 0:c.authType)==="oauth2"){if(((R=c==null?void 0:c.oauth2Opts)==null?void 0:R.grantType)==="authorizationCode"||((N=c==null?void 0:c.oauth2Opts)==null?void 0:N.grantType)==="authorizationCodePKCE")return await _();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 sC({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return l.jsxs(yr,{children:[l.jsx(vr,{children:`Set up ${r} integration`}),l.jsx(mx,{children:`Click Next to sign into the ${r} account you'd like to sync.`}),l.jsx(In,{error:t}),l.jsx(ze,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:n?"Loading...":"Next"})]})}function aC({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){const[s,a]=y.useState(null),[c,f]=y.useState(!1),{isFetching:u,refetch:d}=Hl({groupRef:r,provider:e}),{url:g,error:h,isLoading:w,refetchOauthConnect:v}=Bd(t,r,e,n,o,void 0,{}),p=(h==null?void 0:h.message)||s||null,x=y.useCallback(C=>{a(C),f(!1),d()},[a,d]),m=y.useCallback(()=>{a(null),f(!1),d()},[a,d]),I=y.useCallback(()=>{f(!1),d()},[f,d]),_=async()=>{var R;a(null);const{data:C}=await d();if(C&&C.length>0)return;const S=await v();S!=null&&S.data?f(!0):x(((R=S==null?void 0:S.error)==null?void 0:R.message)||"Authentication failed")};return l.jsx(Ea,{windowTitle:`Connect to ${i}`,oauthUrl:c&&g||null,onError:x,error:p,onSuccessConnect:m,onWindowClose:I,children:l.jsx(sC,{handleSubmit:_,error:u?"":p,providerName:i,isButtonDisabled:w||u})})}const cC="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function lC({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return l.jsxs(yr,{children:[l.jsx(vr,{children:"Enter your Salesforce subdomain"}),l.jsx(Ld,{href:cC,newTab:!0,children:"What is my Salesforce subdomain?"}),l.jsx(In,{error:n}),l.jsxs("div",{style:{display:"flex",marginTop:"1em",alignItems:"center"},children:[l.jsx(Bt.Input,{id:"salesforce-subdomain",type:"text",placeholder:"my-domain",onChange:o=>t(o.currentTarget.value)}),l.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),l.jsx(ze,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function uC({handleSubmit:e,setFormData:t,error:n,isButtonDisabled:r,providerName:o,metadataFields:i}){return l.jsxs(yr,{children:[l.jsxs(vr,{children:["Enter your ",o," workspace"]}),l.jsx(In,{error:n}),l.jsx("br",{}),i.map(s=>l.jsx(Bt.Input,{id:s.name,name:s.name,type:"text",placeholder:s.displayName||s.name,onChange:a=>t(s.name,a.currentTarget.value)},s.name)),l.jsx("br",{}),l.jsx(ze,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const Wc="salesforce";function dC({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){var q,ae;const[s,a]=y.useState(""),[c,f]=y.useState({}),[u,d]=y.useState(null),[g,h]=y.useState(!1),[w,v]=y.useState({}),{data:p}=_i(e),x=((q=p==null?void 0:p.metadata)==null?void 0:q.input)||[],{url:m,error:I,isLoading:_,refetchOauthConnect:C}=Bd(t,r,e,n,o,e===Wc?s:(ae=w==null?void 0:w.workspace)==null?void 0:ae.value,w),S=(I==null?void 0:I.message)||u||null,R=y.useCallback(X=>{d(X),h(!1)},[]),N=y.useCallback(()=>{d(null),h(!1)},[]),A=y.useCallback(()=>{h(!1)},[h]),K=X=>{a(X),f(Y=>({...Y,workspace:X})),v(Y=>({...Y,workspace:{value:X,source:"input"}}))},z=(X,Y)=>{f(fe=>({...fe,[X]:Y})),v(fe=>({...fe,[X]:{value:Y,source:"input"}}))},H=async()=>{var Y;if(d(null),!hi(x,c)){d("Please fill in all required fields");return}const X=await C();X!=null&&X.data?h(!0):R(((Y=X==null?void 0:X.error)==null?void 0:Y.message)||"Authentication failed")},ee=e===Wc?l.jsx(lC,{handleSubmit:H,setWorkspace:K,error:S,isButtonDisabled:s.length===0}):l.jsx(uC,{handleSubmit:H,setFormData:z,error:S,isButtonDisabled:!hi(x,c)||_,providerName:i,metadataFields:x});return l.jsx(Ea,{windowTitle:`Connect to ${i}`,oauthUrl:g&&m||null,onError:R,error:S,onSuccessConnect:N,onWindowClose:A,children:ee})}function fC({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,explicitScopesRequired:s,selectedConnection:a}){const{projectIdOrName:c}=Te(),f=Ao(),[u,d]=y.useState(null),g=y.useCallback(h=>{var v,p;d(null);const w={projectIdOrName:c,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:(p=(v=h.providerMetadata)==null?void 0:v.workspace)==null?void 0:p.value,oauth2ClientCredentials:{clientId:h.clientId,clientSecret:h.clientSecret,scopes:h.scopes},...h.providerMetadata&&{providerMetadata:h.providerMetadata}}};f.mutate(w,{onError:()=>d("Error loading provider info")})},[c,i,o,r,n,e,f]);return a===null?l.jsx(Ox,{provider:e,providerName:t,handleSubmit:g,error:u,explicitScopesRequired:s}):l.jsx(ci,{})}function pC({...e}){return l.jsx(fC,{...e})}const hC="authorizationCode",mC="authorizationCodePKCE",gC="clientCredentials";function yC({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,selectedConnection:s,setSelectedConnection:a}){var g;const{providerName:c}=at(e);if(t.oauth2Opts===void 0)return l.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:f,explicitScopesRequired:u}=t.oauth2Opts,d={provider:e,consumerRef:n,consumerName:r,groupRef:o,groupName:i,providerName:c};return f===hC||f===mC?(g=t.metadata)!=null&&g.input?l.jsx(dC,{...d}):l.jsx(aC,{...d}):f===gC?l.jsx(pC,{...d,explicitScopesRequired:u,selectedConnection:s,setSelectedConnection:a}):f==="password"?l.jsx("em",{children:"Password flow not supported yet"}):l.jsxs("em",{children:["Unsupported grant type: ",f]})}function vC(e){const{selectedConnection:t}=Qt();y.useEffect(()=>{e&&t&&e(t)},[e,t])}function wC({onSuccess:e}){vC(e)}function Jd({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,onSuccess:s,onDisconnectSuccess:a,resetComponent:c}){const{data:f,isLoading:u,isError:d,error:g,providerName:h,selectedProvider:w}=at(e),{provider:v,isIntegrationDeleted:p}=rt(),{selectedConnection:x,setSelectedConnection:m}=Qt();wC({onSuccess:s});const I=vt();y.useEffect(()=>{d&&(console.error("Error loading provider info."),Le(g))},[d,g]);const _=y.useCallback(()=>{I.clear(),c()},[c,I]);if(!e&&!v)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(p)return l.jsx(Sa,{text:"Integration successfully uninstalled.",children:l.jsx(ze,{type:"button",onClick:_,style:{width:"100%"},children:"Reinstall Integration"})});if(x)return i;if(u)return l.jsx(zr,{});if(f==null)return l.jsx(Jt,{message:"Provider info was not found."});const C={provider:w,consumerRef:t,consumerName:n,groupRef:r,groupName:o,selectedConnection:x,setSelectedConnection:m,providerName:h,providerInfo:f,onDisconnectSuccess:a};return f.authType==="none"?l.jsx(Zx,{...C,children:i}):f.authType==="basic"?l.jsx(Qx,{...C,children:i}):f.authType==="apiKey"?l.jsx(Gx,{...C,children:i}):l.jsx(yC,{...C})}function IC(e){const t=e+"CollectionProvider",[n,r]=No(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=v=>{const{scope:p,children:x}=v,m=y.useRef(null),I=y.useRef(new Map).current;return l.jsx(o,{scope:p,itemMap:I,collectionRef:m,children:x})};s.displayName=t;const a=e+"CollectionSlot",c=Ms(a),f=y.forwardRef((v,p)=>{const{scope:x,children:m}=v,I=i(a,x),_=gr(p,I.collectionRef);return l.jsx(c,{ref:_,children:m})});f.displayName=a;const u=e+"CollectionItemSlot",d="data-radix-collection-item",g=Ms(u),h=y.forwardRef((v,p)=>{const{scope:x,children:m,...I}=v,_=y.useRef(null),C=gr(p,_),S=i(u,x);return y.useEffect(()=>(S.itemMap.set(_,{ref:_,...I}),()=>void S.itemMap.delete(_))),l.jsx(g,{[d]:"",ref:C,children:m})});h.displayName=u;function w(v){const p=i(e+"CollectionConsumer",v);return y.useCallback(()=>{const m=p.collectionRef.current;if(!m)return[];const I=Array.from(m.querySelectorAll(`[${d}]`));return Array.from(p.itemMap.values()).sort((S,R)=>I.indexOf(S.ref.current)-I.indexOf(R.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:s,Slot:f,ItemSlot:h},w,r]}var bC=M[" useId ".trim().toString()]||(()=>{}),xC=0;function Wd(e){const[t,n]=M.useState(bC());return pi(()=>{e||n(r=>r??String(xC++))},[e]),e||(t?`radix-${t}`:"")}function CC(e){const t=M.useRef(e);return M.useEffect(()=>{t.current=e}),M.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}var _C=M.createContext(void 0);function zd(e){const t=M.useContext(_C);return e||t||"ltr"}var ts="rovingFocusGroup.onEntryFocus",OC={bubbles:!1,cancelable:!0},Oi="RovingFocusGroup",[ks,Gd,EC]=IC(Oi),[SC,Qd]=No(Oi,[EC]),[NC,TC]=SC(Oi),Xd=M.forwardRef((e,t)=>l.jsx(ks.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(ks.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(RC,{...e,ref:t})})}));Xd.displayName=Oi;var RC=M.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:f,preventScrollOnEntryFocus:u=!1,...d}=e,g=M.useRef(null),h=gr(t,g),w=zd(i),[v,p]=wa({prop:s,defaultProp:a??null,onChange:c,caller:Oi}),[x,m]=M.useState(!1),I=CC(f),_=Gd(n),C=M.useRef(!1),[S,R]=M.useState(0);return M.useEffect(()=>{const N=g.current;if(N)return N.addEventListener(ts,I),()=>N.removeEventListener(ts,I)},[I]),l.jsx(NC,{scope:n,orientation:r,dir:w,loop:o,currentTabStopId:v,onItemFocus:M.useCallback(N=>p(N),[p]),onItemShiftTab:M.useCallback(()=>m(!0),[]),onFocusableItemAdd:M.useCallback(()=>R(N=>N+1),[]),onFocusableItemRemove:M.useCallback(()=>R(N=>N-1),[]),children:l.jsx(wn.div,{tabIndex:x||S===0?-1:0,"data-orientation":r,...d,ref:h,style:{outline:"none",...e.style},onMouseDown:Wt(e.onMouseDown,()=>{C.current=!0}),onFocus:Wt(e.onFocus,N=>{const A=!C.current;if(N.target===N.currentTarget&&A&&!x){const K=new CustomEvent(ts,OC);if(N.currentTarget.dispatchEvent(K),!K.defaultPrevented){const z=_().filter(X=>X.focusable),H=z.find(X=>X.active),ee=z.find(X=>X.id===v),ae=[H,ee,...z].filter(Boolean).map(X=>X.ref.current);ef(ae,u)}}C.current=!1}),onBlur:Wt(e.onBlur,()=>m(!1))})})}),Yd="RovingFocusGroupItem",Zd=M.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:s,...a}=e,c=Wd(),f=i||c,u=TC(Yd,n),d=u.currentTabStopId===f,g=Gd(n),{onFocusableItemAdd:h,onFocusableItemRemove:w,currentTabStopId:v}=u;return M.useEffect(()=>{if(r)return h(),()=>w()},[r,h,w]),l.jsx(ks.ItemSlot,{scope:n,id:f,focusable:r,active:o,children:l.jsx(wn.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...a,ref:t,onMouseDown:Wt(e.onMouseDown,p=>{r?u.onItemFocus(f):p.preventDefault()}),onFocus:Wt(e.onFocus,()=>u.onItemFocus(f)),onKeyDown:Wt(e.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){u.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const x=FC(p,u.orientation,u.dir);if(x!==void 0){if(p.metaKey||p.ctrlKey||p.altKey||p.shiftKey)return;p.preventDefault();let I=g().filter(_=>_.focusable).map(_=>_.ref.current);if(x==="last")I.reverse();else if(x==="prev"||x==="next"){x==="prev"&&I.reverse();const _=I.indexOf(p.currentTarget);I=u.loop?DC(I,_+1):I.slice(_+1)}setTimeout(()=>ef(I))}}),children:typeof s=="function"?s({isCurrentTabStop:d,hasTabStop:v!=null}):s})})});Zd.displayName=Yd;var AC={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function PC(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function FC(e,t,n){const r=PC(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return AC[r]}function ef(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function DC(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var MC=Xd,kC=Zd,Po="Tabs",[jC,f_]=No(Po,[Qd]),tf=Qd(),[LC,Na]=jC(Po),nf=M.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:c="automatic",...f}=e,u=zd(a),[d,g]=wa({prop:r,onChange:o,defaultProp:i??"",caller:Po});return l.jsx(LC,{scope:n,baseId:Wd(),value:d,onValueChange:g,orientation:s,dir:u,activationMode:c,children:l.jsx(wn.div,{dir:u,"data-orientation":s,...f,ref:t})})});nf.displayName=Po;var rf="TabsList",of=M.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=Na(rf,n),s=tf(n);return l.jsx(MC,{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})})});of.displayName=rf;var sf="TabsTrigger",af=M.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=Na(sf,n),a=tf(n),c=lf(s.baseId,r),f=uf(s.baseId,r),u=r===s.value;return l.jsx(kC,{asChild:!0,...a,focusable:!o,active:u,children:l.jsx(wn.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":f,"data-state":u?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...i,ref:t,onMouseDown:Wt(e.onMouseDown,d=>{!o&&d.button===0&&d.ctrlKey===!1?s.onValueChange(r):d.preventDefault()}),onKeyDown:Wt(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&s.onValueChange(r)}),onFocus:Wt(e.onFocus,()=>{const d=s.activationMode!=="manual";!u&&!o&&d&&s.onValueChange(r)})})})});af.displayName=sf;var cf="TabsContent",KC=M.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=Na(cf,n),c=lf(a.baseId,r),f=uf(a.baseId,r),u=r===a.value,d=M.useRef(u);return M.useEffect(()=>{const g=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(g)},[]),l.jsx(Ia,{present:o||u,children:({present:g})=>l.jsx(wn.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!g,id:f,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:g&&i})})});KC.displayName=cf;function lf(e,t){return`${e}-trigger-${t}`}function uf(e,t){return`${e}-content-${t}`}var VC=nf,UC=of,df=af;const $C=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 qC(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?$C: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 HC(){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 BC="_tabsRoot_ktpr0_1",JC="_tabsList_ktpr0_6",WC="_tabTrigger_ktpr0_12",zC="_danger_ktpr0_29",go={tabsRoot:BC,tabsList:JC,tabTrigger:WC,danger:zC};function GC(){return l.jsxs(l.Fragment,{children:[l.jsx(So,{style:{margin:"1rem 0"}}),l.jsx(df,{value:ro,className:go.tabTrigger,children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[l.jsx(HC,{}),l.jsx("span",{children:"Manage"})]})})]})}function ff({objectName:e,completed:t,pending:n,displayName:r}){return l.jsx(df,{value:e,className:go.tabTrigger,children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[qC(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 QC({completed:e,pending:t,displayName:n}){return l.jsxs(l.Fragment,{children:[l.jsx(So,{style:{margin:"1rem 0"}}),l.jsx(ff,{objectName:dr,completed:e,pending:t,displayName:n},"other-write")]})}function XC({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:o}){var i,s;return l.jsx(VC,{value:e,className:go.tabsRoot,onValueChange:n,children:l.jsxs(UC,{className:go.tabsList,children:[t.map(a=>{var c,f,u,d,g,h;return l.jsx(ff,{objectName:a.name,displayName:a.displayName,completed:a.completed,pending:((f=(c=r==null?void 0:r[a.name])==null?void 0:c.read)==null?void 0:f.isOptionalFieldsModified)||((d=(u=r==null?void 0:r[a.name])==null?void 0:u.read)==null?void 0:d.isRequiredMapFieldsModified)||((h=(g=r==null?void 0:r[a.name])==null?void 0:g.read)==null?void 0:h.isValueMappingsModified)||!1},a.name)}),o&&l.jsx(QC,{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(GC,{})]})})}function YC(e,t){return t===ro?{name:ro,completed:!1}:e.find(n=>n.name===t)}function ZC({children:e}){var x;const{project:t}=Te(),{installation:n}=rt(),{providerName:r}=at(),{hydratedRevision:o}=Gr(),{objectConfigurationsState:i}=ya(),[s,a]=y.useState(""),c=(t==null?void 0:t.appName)||"",f=n==null?void 0:n.config,u=o&&nu(f,o),d=u!==null,g=!!((x=o==null?void 0:o.content)!=null&&x.write),h=g?ru(f):void 0,w=y.useMemo(()=>{const m=[...u||[]];return h&&g&&m.push(h),m},[u,h,g]),v=YC(w,s),p=y.useCallback(()=>{const m=w.find(I=>v!==I&&!I.completed);m&&a(m.name)},[w,v]);return y.useEffect(()=>{!s&&w.length>0&&a(w[0].name)},[w,s,p]),l.jsx(hd.Provider,{value:p,children:l.jsx(fd.Provider,{value:v==null?void 0:v.name,children:l.jsxs(Wr,{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}),d&&l.jsx(XC,{value:s,readNavObjects:u,onValueChange:m=>a(m),objectConfigurationsState:i,writeNavObject:h})]}),e]}),l.jsx(jd,{})]})})})}function e_({...e}){return l.jsx(ZC,{...e})}const t_="_resetContainer_lkwv9_4",pf={resetContainer:t_};function n_({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c}){var p;const{projectIdOrName:f,isLoading:u}=Te(),{isLoading:d}=qs(),{isError:g,errorState:h}=Ft(),{seed:w,reset:v}=Zl();return u||d?l.jsx(zr,{}):g(ue.PROJECT,f)?l.jsx(Jt,{message:`Error loading project ${f}`}):g(ue.INTEGRATION_LIST,f)?l.jsx(Jt,{message:"Error retrieving integrations for the project, double check the API key"}):(p=h[ue.INTEGRATION_LIST])!=null&&p.apiError?l.jsx(Jt,{message:"Something went wrong, couldn't find integration information"}):l.jsx("div",{className:pf.resetContainer,children:l.jsx(tv,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c,children:l.jsx(Yl,{children:l.jsx(Jd,{consumerRef:t,consumerName:n,groupRef:r,groupName:o,resetComponent:v,children:l.jsx(Nv,{resetComponent:v,children:l.jsx(zx,{children:l.jsx(JI,{children:l.jsx(e_,{children:l.jsx(qx,{})})})})})})})},w)})}function r_(){return l.jsxs(Wr,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[l.jsx(ci,{}),l.jsx("p",{children:"Redirecting"})]})}function i_({redirectURL:e,children:t}){return y.useEffect(()=>{e&&window.location.replace(e)},[e]),e?l.jsx(r_,{}):t}function o_({resetComponent:e,onDisconnectSuccess:t,provider:n}){const[r,o]=y.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($d,{provider:n}),l.jsx(Et,{string:"Remove connection"}),l.jsx("p",{children:"Click to disconnect your connection from the provider."}),l.jsx(mu,{resetComponent:e,onDisconnectSuccess:t,buttonText:"Remove connection",buttonVariant:"danger",buttonStyle:{fontSize:"13px"}})]})]})}function s_({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=Te(),{providerName:o}=at(e),i=`You have successfully connected your ${o} account to ${r}.`;return l.jsx(Sa,{text:i,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"},children:l.jsx(o_,{resetComponent:n,onDisconnectSuccess:t,provider:e})})})}function a_({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,redirectUrl:i,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:c}){const{seed:f,reset:u}=Zl(),d=y.useCallback(g=>{s?s(g.id):c&&c(g)},[s,c]);return l.jsx("div",{className:pf.resetContainer,children:l.jsx(Yl,{groupRef:r,provider:e,children:l.jsx(Jd,{resetComponent:u,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onSuccess:d,onDisconnectSuccess:a,children:l.jsx(i_,{redirectURL:i,children:l.jsx(s_,{resetComponent:u,provider:e,onDisconnectSuccess:a})})})})},f)}const c_=(e,t)=>{const{data:n,isLoading:r,isError:o,error:i}=zl(e,t),s=((n==null?void 0:n.length)||0)>0,a=!!n&&!r,c=n==null?void 0:n[0],f=c==null?void 0:c.config;return y.useEffect(()=>{o&&Le(i)},[o,i]),{isLoaded:a,isIntegrationInstalled:s,isLoading:r,config:f}};exports.AmpersandContext=ql;exports.AmpersandProvider=ky;exports.ConnectProvider=a_;exports.InstallIntegration=n_;exports.useAmpersandProvider=jy;exports.useIsIntegrationInstalled=c_;
|
|
52
|
+
//# sourceMappingURL=amp-react.cjs.js.map
|