@amp-labs/react 2.7.10 → 2.7.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/amp-react.cjs.js +14 -14
- package/build/amp-react.cjs.js.map +1 -1
- package/build/amp-react.es.js +15497 -11231
- package/build/amp-react.es.js.map +1 -1
- package/build/index.d.ts +10158 -65
- package/build/style.css +1 -1
- package/package.json +1 -1
package/build/amp-react.cjs.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
"use strict";var ja=e=>{throw TypeError(e)};var ko=(e,t,n)=>t.has(e)||ja("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)?ja("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 qf(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=qf(y);var Jr=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},cr=typeof window>"u"||"Deno"in globalThis;function ft(){}function Hf(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 La(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==ks(s,t.options))return!1}else if(!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(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 ks(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=Va(e)&&Va(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 Va(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function is(e){if(!Ua(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Ua(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Ua(e){return Object.prototype.toString.call(e)==="[object Object]"}function Bf(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 Jf(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Wf(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}function sl(e,t){return typeof e=="function"?e(...t):!!e}var Zn,Tn,Or,zc,zf=(zc=class extends Jr{constructor(){super();se(this,Zn);se(this,Tn);se(this,Or);G(this,Or,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,Or))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Tn))==null||t.call(this),G(this,Tn,void 0))}setEventListener(t){var n;G(this,Or,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,Or=new WeakMap,zc),js=new zf,Er,Rn,Sr,Gc,Gf=(Gc=class extends Jr{constructor(){super();se(this,Er,!0);se(this,Rn);se(this,Sr);G(this,Sr,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,Sr))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,Rn))==null||t.call(this),G(this,Rn,void 0))}setEventListener(t){var n;G(this,Sr,t),(n=O(this,Rn))==null||n.call(this),G(this,Rn,t(this.setOnline.bind(this)))}setOnline(t){O(this,Er)!==t&&(G(this,Er,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return O(this,Er)}},Er=new WeakMap,Rn=new WeakMap,Sr=new WeakMap,Gc),to=new Gf;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 Qf(e){return Math.min(1e3*2**e,3e4)}function al(e){return(e??"online")==="online"?to.isOnline():!0}var cl=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 cl}function ll(e){let t=!1,n=0,r=!1,o;const i=ss(),s=v=>{var p;r||(g(new cl(v)),(p=e.abort)==null||p.call(e))},a=()=>{t=!0},c=()=>{t=!1},f=()=>js.isFocused()&&(e.networkMode==="always"||to.isOnline())&&e.canRun(),u=()=>al(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=C=>{(r||f())&&v(C)},(p=e.onPause)==null||p.call(e)}).then(()=>{var v;o=void 0,r||(v=e.onContinue)==null||v.call(e)}),I=()=>{if(r)return;let v;const p=n===0?e.initialPromise:void 0;try{v=p??e.fn()}catch(C){v=Promise.reject(C)}Promise.resolve(v).then(d).catch(C=>{var S;if(r)return;const m=e.retry??(cr?0:3),w=e.retryDelay??Qf,x=typeof w=="function"?w(n,C):w,_=m===!0||typeof m=="number"&&n<m||typeof m=="function"&&m(n,C);if(t||!_){g(C);return}n++,(S=e.onFail)==null||S.call(e,n,C),Bf(x).then(()=>f()?void 0:h()).then(()=>{t?g(C):I()})})};return{promise:i,cancel:s,continue:()=>(o==null||o(),i),cancelRetry:a,continueRetry:c,canStart:u,start:()=>(u()?I():h().then(I),i)}}var Xf=e=>setTimeout(e,0);function Yf(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=Xf;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=Yf(),er,Qc,ul=(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),Nr,Tr,At,tr,st,mi,nr,$t,fn,Xc,Zf=(Xc=class extends ul{constructor(t){super();se(this,$t);se(this,Nr);se(this,Tr);se(this,At);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,At,O(this,tr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,G(this,Nr,ep(this.options)),this.state=t.state??O(this,Nr),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,At).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(ft).catch(ft):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(O(this,Nr))}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,At).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(O(this,st)&&(O(this,nr)?O(this,st).cancel({revert:!0}):O(this,st).cancelRetry()),this.scheduleGc()),O(this,At).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,Tr,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,I,v;jo(d)&&d.silent||he(this,$t,fn).call(this,{type:"error",error:d}),jo(d)||((h=(g=O(this,At).config).onError)==null||h.call(g,d,this),(v=(I=O(this,At).config).onSettled)==null||v.call(I,this.state.data,d,this)),this.scheduleGc()};return G(this,st,ll({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:d=>{var g,h,I,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,At).config).onSuccess)==null||h.call(g,d,this),(v=(I=O(this,At).config).onSettled)==null||v.call(I,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()}},Nr=new WeakMap,Tr=new WeakMap,At=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,...dl(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,Tr)?{...O(this,Tr),fetchStatus:"idle"}:{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Je.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),O(this,At).notify({query:this,type:"updated",action:t})})},Xc);function dl(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:al(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function ep(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,tp=(Yc=class extends Jr{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??ks(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,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=>La(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>La(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,ut,rr,tn,Nn,Zc,np=(Zc=class extends ul{constructor(t){super();se(this,tn);se(this,en);se(this,ut);se(this,rr);this.mutationId=t.mutationId,G(this,ut,t.mutationCache),G(this,en,[]),this.state=t.state||fl(),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,ut).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){G(this,en,O(this,en).filter(n=>n!==t)),this.scheduleGc(),O(this,ut).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){O(this,en).length||(this.state.status==="pending"?this.scheduleGc():O(this,ut).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,I,v,p,C,m,w,x,_,S,R,N;const n=()=>{he(this,tn,Nn).call(this,{type:"continue"})};G(this,rr,ll({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,ut).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,ut).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,ut).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((I=(h=O(this,ut).config).onSettled)==null?void 0:I.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=(C=O(this,ut).config).onError)==null?void 0:m.call(C,A,t,this.state.context,this)),await((x=(w=this.options).onError)==null?void 0:x.call(w,A,t,this.state.context)),await((S=(_=O(this,ut).config).onSettled)==null?void 0:S.call(_,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,ut).runNext(this)}}},en=new WeakMap,ut=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,ut).notify({mutation:this,type:"updated",action:t})})},Zc);function fl(){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,rp=(el=class extends Jr{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 np({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=>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(ft))))}},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 $a(e){return{onFetch:(t,n)=>{var u,d,g,h,I;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=((I=t.state.data)==null?void 0:I.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const f=async()=>{let v=!1;const p=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(t.signal.aborted?v=!0:t.signal.addEventListener("abort",()=>{v=!0}),t.signal)})},C=ol(t.options,t.fetchOptions),m=async(w,x,_)=>{if(v)return Promise.reject();if(x==null&&w.pages.length)return Promise.resolve(w);const S={client:t.client,queryKey:t.queryKey,pageParam:x,direction:_?"backward":"forward",meta:t.options.meta};p(S);const R=await C(S),{maxPages:N}=t.options,A=_?Wf:Jf;return{pages:A(w.pages,R,N),pageParams:A(w.pageParams,x,N)}};if(o&&i.length){const w=o==="backward",x=w?ip:qa,_={pages:i,pageParams:s},S=x(r,_);a=await m(_,S,w)}else{const w=e??i.length;do{const x=c===0?s[0]??r.initialPageParam:qa(r,a);if(c>0&&x==null)break;a=await m(a,x),c++}while(c<w)}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 qa(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function ip(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,Rr,Ar,Fn,Pr,Fr,tl,op=(tl=class{constructor(e={}){se(this,ke);se(this,An);se(this,Pn);se(this,Rr);se(this,Ar);se(this,Fn);se(this,Pr);se(this,Fr);G(this,ke,e.queryCache||new tp),G(this,An,e.mutationCache||new rp),G(this,Pn,e.defaultOptions||{}),G(this,Rr,new Map),G(this,Ar,new Map),G(this,Fn,0)}mount(){ji(this,Fn)._++,O(this,Fn)===1&&(G(this,Pr,js.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,ke).onFocus())})),G(this,Fr,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,Pr))==null||e.call(this),G(this,Pr,void 0),(t=O(this,Fr))==null||t.call(this),G(this,Fr,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=Hf(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(ft).catch(ft)}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(ft)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(ft)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=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(ft).catch(ft)}fetchInfiniteQuery(e){return e.behavior=$a(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ft).catch(ft)}ensureInfiniteQueryData(e){return e.behavior=$a(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,Rr).set(lr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...O(this,Rr).values()],n={};return t.forEach(r=>{ai(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){O(this,Ar).set(lr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...O(this,Ar).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=ks(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===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,Rr=new WeakMap,Ar=new WeakMap,Fn=new WeakMap,Pr=new WeakMap,Fr=new WeakMap,tl),yt,ve,yi,dt,ir,Dr,Dn,Mn,vi,Mr,kr,or,sr,kn,jr,Ee,ni,as,cs,ls,us,ds,fs,ps,pl,nl,sp=(nl=class extends Jr{constructor(t,n){super();se(this,Ee);se(this,yt);se(this,ve);se(this,yi);se(this,dt);se(this,ir);se(this,Dr);se(this,Dn);se(this,Mn);se(this,vi);se(this,Mr);se(this,kr);se(this,or);se(this,sr);se(this,kn);se(this,jr,new Set);this.options=n,G(this,yt,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),Ha(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,yt).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,yt).getQueryCache().notify({type:"observerOptionsUpdated",query:O(this,ve),observer:this});const o=this.hasListeners();o&&Ba(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,yt).getQueryCache().build(O(this,yt),t),r=this.createResult(n,t);return cp(this,r)&&(G(this,dt,r),G(this,Dr,this.options),G(this,ir,O(this,ve).state)),r}getCurrentResult(){return O(this,dt)}trackResult(t,n){return new Proxy(t,{get:(r,o)=>(this.trackProp(o),n==null||n(o),Reflect.get(r,o))})}trackProp(t){O(this,jr).add(t)}getCurrentQuery(){return O(this,ve)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=O(this,yt).defaultQueryOptions(t),r=O(this,yt).getQueryCache().build(O(this,yt),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,dt)))}createResult(t,n){var A;const r=O(this,ve),o=this.options,i=O(this,dt),s=O(this,ir),a=O(this,Dr),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&&Ha(t,n),H=K&&Ba(t,r,n,o);(z||H)&&(d={...d,...dl(u.data,t.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:I,errorUpdatedAt:v,status:p}=d;h=d.data;let C=!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,C=!0):K=typeof n.placeholderData=="function"?n.placeholderData((A=O(this,kr))==null?void 0:A.state.data,O(this,kr)):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&&!C)if(i&&h===(s==null?void 0:s.data)&&n.select===O(this,vi))h=O(this,Mr);else try{G(this,vi,n.select),h=n.select(h),h=os(i==null?void 0:i.data,h,n),G(this,Mr,h),G(this,Mn,null)}catch(K){G(this,Mn,K)}O(this,Mn)&&(I=O(this,Mn),h=O(this,Mr),v=Date.now(),p="error");const m=d.fetchStatus==="fetching",w=p==="pending",x=p==="error",_=w&&m,S=h!==void 0,N={status:p,fetchStatus:d.fetchStatus,isPending:w,isSuccess:p==="success",isError:x,isInitialLoading:_,isLoading:_,data:h,dataUpdatedAt:d.dataUpdatedAt,error:I,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&&!w,isLoadingError:x&&!S,isPaused:d.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:x&&S,isStale:Ls(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,dt),n=this.createResult(O(this,ve),this.options);if(G(this,ir,O(this,ve).state),G(this,Dr,this.options),O(this,ir).data!==void 0&&G(this,kr,O(this,ve)),Zi(n,t))return;G(this,dt,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:o}=this.options,i=typeof o=="function"?o():o;if(i==="all"||!i&&!O(this,jr).size)return!0;const s=new Set(i??O(this,jr));return this.options.throwOnError&&s.add("error"),Object.keys(O(this,dt)).some(a=>{const c=a;return O(this,dt)[c]!==t[c]&&s.has(c)})};he(this,Ee,pl).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&he(this,Ee,us).call(this)}},yt=new WeakMap,ve=new WeakMap,yi=new WeakMap,dt=new WeakMap,ir=new WeakMap,Dr=new WeakMap,Dn=new WeakMap,Mn=new WeakMap,vi=new WeakMap,Mr=new WeakMap,kr=new WeakMap,or=new WeakMap,sr=new WeakMap,kn=new WeakMap,jr=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(ft)),n},as=function(){he(this,Ee,ds).call(this);const t=xr(this.options.staleTime,O(this,ve));if(cr||O(this,dt).isStale||!ns(t))return;const r=il(O(this,dt).dataUpdatedAt,t)+1;G(this,or,setTimeout(()=>{O(this,dt).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||js.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,yt).getQueryCache().build(O(this,yt),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))},pl=function(t){Je.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(O(this,dt))}),O(this,yt).getQueryCache().notify({query:O(this,ve),type:"observerResultsUpdated"})})},nl);function ap(e,t){return Ht(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Ha(e,t){return ap(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&&Ls(e,t)}return!1}function Ba(e,t,n,r){return(e!==t||Ht(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Ls(e,n)}function Ls(e,t){return Ht(t.enabled,e)!==!1&&e.isStaleByTime(xr(t.staleTime,e))}function cp(e,t){return!Zi(e.getCurrentResult(),t)}var jn,Ln,vt,hn,gn,zi,ms,rl,lp=(rl=class extends Jr{constructor(n,r){super();se(this,gn);se(this,jn);se(this,Ln);se(this,vt);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,vt),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&lr(r.mutationKey)!==lr(this.options.mutationKey)?this.reset():((o=O(this,vt))==null?void 0:o.state.status)==="pending"&&O(this,vt).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=O(this,vt))==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,vt))==null||n.removeObserver(this),G(this,vt,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,vt))==null||o.removeObserver(this),G(this,vt,O(this,jn).getMutationCache().build(O(this,jn),this.options)),O(this,vt).addObserver(this),O(this,vt).execute(n)}},jn=new WeakMap,Ln=new WeakMap,vt=new WeakMap,hn=new WeakMap,gn=new WeakSet,zi=function(){var r;const n=((r=O(this,vt))==null?void 0:r.state)??fl();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),hl=M.createContext(void 0),at=e=>{const t=M.useContext(hl);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},up=({client:e,children:t})=>(M.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(hl.Provider,{value:e,children:t})),ml=M.createContext(!1),dp=()=>M.useContext(ml);ml.Provider;function fp(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var pp=M.createContext(fp()),hp=()=>M.useContext(pp),mp=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},gp=e=>{M.useEffect(()=>{e.clearReset()},[e])},yp=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||sl(n,[e.error,r])),vp=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)))},wp=(e,t)=>e.isLoading&&e.isFetching&&!t,Ip=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Ja=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function bp(e,t,n){var d,g,h,I,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=at(),o=dp(),i=hp(),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",vp(s),mp(s,i),gp(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 C=u?c.subscribe(Je.batchCalls(p)):ft;return c.updateResult(),C},[c,u]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),M.useEffect(()=>{c.setOptions(s)},[s,c]),Ip(s,f))throw Ja(s,c,i);if(yp({result:f,errorResetBoundary:i,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw f.error;if((I=(h=r.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||I.call(h,s,f),s.experimental_prefetchInRender&&!cr&&wp(f,o)){const p=a?Ja(s,c,i):(v=r.getQueryCache().get(s.queryHash))==null?void 0:v.promise;p==null||p.catch(ft).finally(()=>{c.updateResult()})}return s.notifyOnChangeProps?f:c.trackResult(f)}function yn(e,t){return bp(e,sp)}function yr(e,t){const n=at(),[r]=M.useState(()=>new lp(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(ft)},[r]);if(o.error&&sl(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:i,mutateAsync:o.mutate}}const gl=y.createContext(null),Cp=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 _p({children:e}){const[t,n]=y.useState(xp),r=y.useCallback((u,d,g=!0)=>{n(h=>{const I={...h};return I[u]=I[u]||{},I[u][d]=g,I})},[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 I;const h={...g};return(I=h[u])==null||delete I[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(I=>{h[u][I]=!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 Op="https://api.withampersand.com/v1".replace(/\/+$/,"");class Ks{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Op}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 Ep=new Ks,yo=class yo{constructor(t=Ep){this.configuration=t,this.fetchApi=async(n,r)=>{let o={url:n,init:r};for(const s of this.middleware)s.pre&&(o=await s.pre({fetch:this.fetchApi,...o})||o);let i;try{i=await(this.configuration.fetchApi||fetch)(o.url,o.init)}catch(s){for(const a of this.middleware)a.onError&&(i=await a.onError({fetch:this.fetchApi,url:o.url,init:o.init,error:s,response:i?i.clone():void 0})||i);if(i===void 0)throw s instanceof Error?new Tp(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:Np(a.body)||a.body instanceof URLSearchParams||Sp(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 Sp(e){return typeof Blob<"u"&&e instanceof Blob}function Np(e){return typeof FormData<"u"&&e instanceof FormData}class wl extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class Tp 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 Wa{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function Rp(e){return Ap(e)}function Ap(e,t){return e==null?e:{fieldUsed:T(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:T(e,"keyFormat")?e.keyFormat:void 0}}function Pp(e){return Fp(e)}function Fp(e,t){return e==null?e:{name:e.name,valuePrefix:T(e,"valuePrefix")?e.valuePrefix:void 0}}function Dp(e){return Mp(e)}function Mp(e,t){return e==null?e:{name:e.name}}function kp(e){return jp(e)}function jp(e,t){return e==null?e:{attachmentType:e.attachmentType,query:T(e,"query")?Dp(e.query):void 0,header:T(e,"header")?Pp(e.header):void 0,docsURL:T(e,"docsURL")?e.docsURL:void 0}}function Lp(e){return Kp(e)}function Kp(e,t){return e==null?e:{enabled:T(e,"enabled")?e.enabled:void 0,includeFullRecords:T(e,"includeFullRecords")?e.includeFullRecords:void 0}}function Vp(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,includeFullRecords:e.includeFullRecords}}function Up(e){return $p(e)}function $p(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 za={Oauth2:"oauth2",ApiKey:"apiKey",Basic:"basic",Jwt:"jwt",None:"none"};function qp(e){return Hp(e)}function Hp(e,t){return e}function Bp(e){return Jp(e)}function Jp(e,t){return e==null?e:{days:T(e,"days")?e.days:void 0,fullHistory:T(e,"fullHistory")?e.fullHistory:void 0}}function Wp(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Cl(e){return zp(e)}function zp(e,t){return e==null?e:{defaultPeriod:Bp(e.defaultPeriod)}}function Gp(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:{days:T(e,"days")?e.days:void 0,fullHistory:T(e,"fullHistory")?e.fullHistory:void 0}}function Yp(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Zp(e){return eh(e)}function eh(e,t){return e==null?e:{defaultPeriod:Qp(e.defaultPeriod)}}function xl(e){if(e!==void 0)return e===null?null:{defaultPeriod:Yp(e.defaultPeriod)}}function th(e){return nh(e)}function nh(e,t){return e==null?e:{enabled:T(e,"enabled")?e.enabled:void 0}}function _l(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function rh(e){return ih(e)}function ih(e,t){return e}function oh(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:xl(e.backfill)}}function sh(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:We(e.objects,oh)}}function ah(e){return ch(e)}function ch(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 lh(e){if(e!==void 0)return e===null?null:{stringValue:e.stringValue,integerValue:e.integerValue,booleanValue:e.booleanValue}}function uh(e){return dh(e)}function dh(e,t){return e==null?e:{_default:T(e,"default")?ah(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:lh(e._default),writeOnCreate:e.writeOnCreate,writeOnUpdate:e.writeOnUpdate}}function fh(e){let t=!0;return t=t&&"value"in e,t}function ph(e,t){return e==null?e:{value:e.value,applyOnUpdate:T(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function hh(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function mh(e){let t=!0;return t=t&&"value"in e,t}function gh(e,t){return e==null?e:{value:e.value,applyOnUpdate:T(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function yh(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function vh(e){let t=!0;return t=t&&"value"in e,t}function wh(e,t){return e==null?e:{value:e.value,applyOnUpdate:T(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Ih(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function bh(e){return Ch(e)}function Ch(e,t){return e==null?e:{...ph(e),...gh(e),...wh(e)}}function El(e){if(e!==void 0)return e===null?null:fh(e)?hh(e):mh(e)?yh(e):vh(e)?Ih(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 _h(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:We(e.objects,xh)}}function Oh(e){return Eh(e)}function Eh(e,t){return e==null?e:{apiKeyAsBasic:T(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:T(e,"apiKeyAsBasicOpts")?Rp(e.apiKeyAsBasicOpts):void 0,docsURL:T(e,"docsURL")?e.docsURL:void 0}}function Sh(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Nh(e){return Th(e)}function Th(e,t){return e==null?e:{value:e.value}}function Rh(e){return Ah(e)}function Ah(e,t){return e==null?e:{brandingRemoval:T(e,"brandingRemoval")?Nh(e.brandingRemoval):void 0}}function Ki(e){return Ph(e)}function Ph(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")?Rh(e.entitlements):void 0}}function Fh(e){return Dh(e)}function Dh(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function Mh(e){return kh(e)}function kh(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")?rh(e.selectedFieldsAuto):void 0,backfill:T(e,"backfill")?Zp(e.backfill):void 0}}function jh(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:xl(e.backfill)}}function Lh(e){return Kh(e)}function Kh(e,t){return e==null?e:{objects:We(e.objects,Mh)}}function Vh(e){if(e!==void 0)return e===null?null:{objects:We(e.objects,jh)}}function Uh(e){return $h(e)}function $h(e,t){return e==null?e:{objectName:e.objectName,selectedValueDefaults:T(e,"selectedValueDefaults")?We(e.selectedValueDefaults,bh):void 0,selectedFieldSettings:T(e,"selectedFieldSettings")?We(e.selectedFieldSettings,uh):void 0}}function qh(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 Hh(e){return Bh(e)}function Bh(e,t){return e==null?e:{objects:T(e,"objects")?We(e.objects,Uh):void 0}}function Jh(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:We(e.objects,qh)}}function Wh(e){return zh(e)}function zh(e,t){return e==null?e:{provider:e.provider,read:T(e,"read")?Lh(e.read):void 0,write:T(e,"write")?Hh(e.write):void 0,proxy:T(e,"proxy")?th(e.proxy):void 0}}function Gh(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:Vh(e.read),write:Jh(e.write),proxy:_l(e.proxy)}}function Qh(e){return Xh(e)}function Xh(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:Wh(e.content)}}function Yh(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:T(e,"updateTime")?new Date(e.updateTime):void 0}}function Sl(e){return em(e)}function em(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 tm(e){return nm(e)}function nm(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 rm(e){return im(e)}function im(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 om(e){return sm(e)}function sm(e,t){return e==null?e:{accessToken:T(e,"accessToken")?tm(e.accessToken):void 0,refreshToken:T(e,"refreshToken")?rm(e.refreshToken):void 0,scopes:T(e,"scopes")?e.scopes:void 0}}function Gi(e){return am(e)}function am(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 cm(e){return lm(e)}function lm(e,t){return e==null?e:{value:e.value,source:e.source,displayName:T(e,"displayName")?e.displayName:void 0}}function Vs(e){if(e!==void 0)return e===null?null:{value:e.value,source:e.source,displayName:e.displayName}}function ri(e){return um(e)}function um(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:Yh(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")?om(e.oauth2AuthorizationCode):void 0,apiKey:T(e,"apiKey")?e.apiKey:void 0,providerMetadata:T(e,"providerMetadata")?We(e.providerMetadata,cm):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 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 fm(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:dm(e.accessToken),refreshToken:fm(e.refreshToken),scopes:e.scopes}}function pm(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:We(e.providerMetadata,Vs),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 hm(e){return mm(e)}function mm(e,t){return e==null?e:{enabled:T(e,"enabled")?e.enabled:void 0}}function gm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function ym(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Gh(e.content)}}function vm(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:ym(e.config)}}function wm(e){return Im(e)}function Im(e,t){return e==null?e:{enabled:T(e,"enabled")?e.enabled:void 0}}function bm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Cm(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 _m(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function Om(e){let t=!0;return t=t&&"fieldName"in e,t}function Em(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 Sm(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function Nm(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 Tm(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function Ga(e){return Rm(e)}function Rm(e,t){return e==null?e:{...Em(e),...Pl(e)}}function Qa(e){if(e!==void 0)return e===null?null:Om(e)?Sm(e):Nm(e)?Tm(e):{}}function Fl(e){return Am(e)}function Am(e,t){return e}function Pm(e){return Fm(e)}function Fm(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(Ga):void 0,optionalFields:T(e,"optionalFields")?e.optionalFields.map(Ga):void 0,optionalFieldsAuto:T(e,"optionalFieldsAuto")?Fl(e.optionalFieldsAuto):void 0,backfill:T(e,"backfill")?Cl(e.backfill):void 0,delivery:T(e,"delivery")?Cm(e.delivery):void 0}}function Dm(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(Qa),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(Qa),optionalFieldsAuto:e.optionalFieldsAuto,backfill:Gp(e.backfill),delivery:_m(e.delivery)}}function Mm(e){return km(e)}function km(e,t){return e==null?e:{objects:T(e,"objects")?e.objects.map(Pm):void 0}}function jm(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Dm)}}function Lm(e){return Km(e)}function Km(e,t){return e==null?e:{enabled:T(e,"enabled")?e.enabled:void 0}}function Vm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Um(e){return $m(e)}function $m(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 qm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function Hm(e){return Bm(e)}function Bm(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:T(e,"inheritFieldsAndMapping")?e.inheritFieldsAndMapping:void 0,createEvent:T(e,"createEvent")?hm(e.createEvent):void 0,updateEvent:T(e,"updateEvent")?Um(e.updateEvent):void 0,deleteEvent:T(e,"deleteEvent")?Lm(e.deleteEvent):void 0,associationChangeEvent:T(e,"associationChangeEvent")?Lp(e.associationChangeEvent):void 0,otherEvents:T(e,"otherEvents")?e.otherEvents:void 0}}function Jm(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:e.inheritFieldsAndMapping,createEvent:gm(e.createEvent),updateEvent:qm(e.updateEvent),deleteEvent:Vm(e.deleteEvent),associationChangeEvent:Vp(e.associationChangeEvent),otherEvents:e.otherEvents}}function Wm(e){return zm(e)}function zm(e,t){return e==null?e:{objects:T(e,"objects")?e.objects.map(Hm):void 0}}function Gm(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Jm)}}function Dl(e){return Qm(e)}function Qm(e,t){return e==null?e:{allowAnyFields:T(e,"allowAnyFields")?e.allowAnyFields:void 0}}function Xm(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function Ym(e){return Zm(e)}function Zm(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 eg(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:Xm(e.valueDefaults)}}function tg(e){return ng(e)}function ng(e,t){return e==null?e:{objects:T(e,"objects")?e.objects.map(Ym):void 0}}function rg(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(eg)}}function ig(e){return og(e)}function og(e,t){return e==null?e:{name:e.name,displayName:T(e,"displayName")?e.displayName:void 0,provider:e.provider,read:T(e,"read")?Mm(e.read):void 0,write:T(e,"write")?tg(e.write):void 0,proxy:T(e,"proxy")?wm(e.proxy):void 0,subscribe:T(e,"subscribe")?Wm(e.subscribe):void 0}}function sg(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:jm(e.read),write:rg(e.write),proxy:bm(e.proxy),subscribe:Gm(e.subscribe)}}function ag(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:sg(e.content)}}function cg(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:ag(e.latestRevision)}}function lg(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function ug(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 dg(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function fg(e){return pg(e)}function pg(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function hg(e){return mg(e)}function mg(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(fg):void 0}}function gg(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:We(e.providerMetadata,Vs),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 yg(e){return vg(e)}function vg(e,t){return e==null?e:{enabled:T(e,"enabled")?e.enabled:void 0}}function wg(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 Ig(e)}function Ig(e,t){return e==null?e:{...wg(e),...Pl(e)}}function bg(e){return Cg(e)}function Cg(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,hg):void 0,backfill:T(e,"backfill")?Cl(e.backfill):void 0}}function xg(e){return _g(e)}function _g(e,t){return e==null?e:{objects:T(e,"objects")?e.objects.map(bg):void 0}}function Og(e){return Eg(e)}function Eg(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:T(e,"valueDefaults")?Dl(e.valueDefaults):void 0}}function Sg(e){return Ng(e)}function Ng(e,t){return e==null?e:{objects:T(e,"objects")?e.objects.map(Og):void 0}}function Tg(e){return Rg(e)}function Rg(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")?Sg(e.write):void 0,proxy:T(e,"proxy")?yg(e.proxy):void 0}}function Ag(e){return Pg(e)}function Pg(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Tg(e.content)}}function Vi(e){return Fg(e)}function Fg(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:Qh(e.config)}}function Dg(e){return Mg(e)}function Mg(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:ig(e.content)}}function Xa(e){return kg(e)}function kg(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:Dg(e.latestRevision)}}function jg(e){return Lg(e)}function Lg(e,t){return e==null?e:{iconURL:T(e,"iconURL")?e.iconURL:void 0,logoURL:T(e,"logoURL")?e.logoURL:void 0}}function Kg(e){return Vg(e)}function Vg(e,t){return e==null?e:{iconURL:T(e,"iconURL")?e.iconURL:void 0,logoURL:T(e,"logoURL")?e.logoURL:void 0}}function Ug(e){return $g(e)}function $g(e,t){return e==null?e:{regular:T(e,"regular")?Kg(e.regular):void 0,darkMode:T(e,"darkMode")?jg(e.darkMode):void 0}}function qg(e){return Hg(e)}function Hg(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 Bg(e){return Jg(e)}function Jg(e,t){return e==null?e:{name:e.name}}function Wg(e){return zg(e)}function zg(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 Gg(e)}function Gg(e,t){return e==null?e:{bulkWrite:Fh(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write,subscribeSupport:T(e,"subscribeSupport")?Wg(e.subscribeSupport):void 0}}function Qg(e){return Xg(e)}function Xg(e,t){return e==null?e:{displayName:e.displayName,baseURL:e.baseURL,support:Ml(e.support)}}function Yg(e){return Zg(e)}function Zg(e,t){return e==null?e:{name:e.name,displayName:e.displayName,path:e.path,capture:T(e,"capture")?e.capture:void 0}}function ey(e){return ty(e)}function ty(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(Yg):void 0}}const Ko={AuthorizationCode:"authorizationCode",AuthorizationCodePkce:"authorizationCodePKCE",ClientCredentials:"clientCredentials",Password:"password"};function ny(e){return ry(e)}function ry(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:ey(e.tokenMetadataFields),docsURL:T(e,"docsURL")?e.docsURL:void 0,authURLParams:T(e,"authURLParams")?e.authURLParams:void 0}}function iy(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:We(e.providerMetadata,Vs),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 oy(e){return sy(e)}function sy(e,t){return e==null?e:{input:T(e,"input")?e.input.map(qg):void 0,postAuthentication:T(e,"postAuthentication")?e.postAuthentication.map(Bg):void 0}}function ay(e){return cy(e)}function cy(e,t){return e==null?e:{subscriptionScope:e.subscriptionScope,targetURLScope:e.targetURLScope,registrationTiming:e.registrationTiming}}function Ya(e){return ly(e)}function ly(e,t){return e==null?e:{name:e.name,authType:qp(e.authType),baseURL:e.baseURL,oauth2Opts:T(e,"oauth2Opts")?ny(e.oauth2Opts):void 0,apiKeyOpts:T(e,"apiKeyOpts")?kp(e.apiKeyOpts):void 0,basicOpts:T(e,"basicOpts")?Oh(e.basicOpts):void 0,support:Ml(e.support),providerOpts:e.providerOpts,authHealthCheck:T(e,"authHealthCheck")?Up(e.authHealthCheck):void 0,displayName:T(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:T(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:T(e,"media")?Ug(e.media):void 0,labels:T(e,"labels")?e.labels:void 0,subscribeOpts:T(e,"subscribeOpts")?ay(e.subscribeOpts):void 0,modules:T(e,"modules")?We(e.modules,Qg):void 0,metadata:T(e,"metadata")?oy(e.metadata):void 0}}function uy(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,connection:pm(e.connection)}}function dy(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:sh(e.read),write:_h(e.write),proxy:_l(e.proxy)}}function fy(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:dy(e.content)}}function py(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:fy(e.config)}}function hy(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:py(e.installation)}}function my(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function gy(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:my(e.project)}}function yy(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 vy(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:yy(e.providerApp)}}class wy 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:gg(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:uy(t.updateConnectionRequest)},n);return new je(i,s=>ri(s))}async updateConnection(t,n){return await(await this.updateConnectionRaw(t,n)).value()}}class Iy 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:vm(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:hy(t.installationUpdate)},n);return new je(i,s=>Vi(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class by 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:Sh(t.batchUpsertIntegrationsRequest)},n);return new je(i,s=>s.map(Xa))}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:cg(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(Xa))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class Cy 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:iy(t.connectOAuthParams)},n);return this.isJsonMime(i.headers.get("content-type"))?new je(i):new Wa(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 Wa(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:lg(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:gy(t.projectUpdate)},n);return new je(i,s=>Ki(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class _y 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=>Ya(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,Ya))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class Oy 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:ug(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:vy(t.providerAppUpdate)},n);return new je(i,s=>Gi(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class Ey 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:dg(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=>Ag(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class kl{constructor(t){this.connectionApi=new wy(t),this.installationApi=new Iy(t),this.integrationApi=new by(t),this.oAuthApi=new Cy(t),this.projectApi=new xy(t),this.providerApi=new _y(t),this.providerAppApi=new Oy(t),this.revisionApi=new Ey(t)}}const jl="2.7.10",Sy="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 Ny=(e,t)=>`${e}/${t}`;function Ty(){return Ny(Ll(),Sy)}const Kl=Ll(),Vl=Ty(),Ry=new Ks({basePath:Vl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":jl}});let Ay=new kl(Ry);const Us=()=>Ay;function ct(){const e=yl();return y.useCallback(async()=>{e||console.error("Unable to create API service without API key.");const n=new Ks({basePath:Vl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":jl,"X-Api-Key":e}});return new kl(n)},[e])}const Py=e=>{const t=ct();return yn({queryKey:["project",e],queryFn:async()=>(await t()).projectApi.getProject({projectIdOrName:e})})},Ul=y.createContext({project:null,appName:"",projectId:"",projectIdOrName:"",isLoading:!0}),Ne=()=>{const e=y.useContext(Ul);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(Ul.Provider,{value:s,children:t})}function $l(){const e=ct(),{projectIdOrName:t}=Ne();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
|
-
`))||(
|
|
1
|
+
"use strict";var yu=e=>{throw TypeError(e)};var Yo=(e,t,n)=>t.has(e)||yu("Cannot "+n);var T=(e,t,n)=>(Yo(e,t,"read from private field"),n?n.call(e):t.get(e)),se=(e,t,n)=>t.has(e)?yu("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Q=(e,t,n,r)=>(Yo(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),he=(e,t,n)=>(Yo(e,t,"access private method"),n);var Wi=(e,t,n,r)=>({set _(o){Q(e,t,o,n)},get _(){return T(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),v=require("react");require("react-dom");function PI(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 U=PI(v);var Xr=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(){}},dr=typeof window>"u"||"Deno"in globalThis;function ft(){}function DI(e,t){return typeof e=="function"?e(t):e}function ga(e){return typeof e=="number"&&e>=0&&e!==1/0}function _l(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Tr(e,t){return typeof e=="function"?e(t):e}function Wt(e,t){return typeof e=="function"?e(t):e}function Ou(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:a,stale:s}=e;if(a){if(r){if(t.queryHash!==is(a,t.options))return!1}else if(!hi(t.queryKey,a))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof s=="boolean"&&t.isStale()!==s||o&&o!==t.state.fetchStatus||i&&!i(t))}function vu(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(pr(t.options.mutationKey)!==pr(i))return!1}else if(!hi(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function is(e,t){return((t==null?void 0:t.queryKeyHashFn)||pr)(e)}function pr(e){return JSON.stringify(e,(t,n)=>Oa(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function hi(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>hi(e[n],t[n])):!1}function ya(e,t){if(e===t)return e;const n=Iu(e)&&Iu(t);if(n||Oa(e)&&Oa(t)){const r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),a=i.length,s=n?[]:{};let c=0;for(let p=0;p<a;p++){const l=n?p:i[p];(!n&&r.includes(l)||n)&&e[l]===void 0&&t[l]===void 0?(s[l]=void 0,c++):(s[l]=ya(e[l],t[l]),s[l]===e[l]&&e[l]!==void 0&&c++)}return o===a&&c===o?e:s}return t}function lo(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 Iu(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Oa(e){if(!Su(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Su(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Su(e){return Object.prototype.toString.call(e)==="[object Object]"}function MI(e){return new Promise(t=>{setTimeout(t,e)})}function va(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 ya(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 ya(e,t)}return t}function JI(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function kI(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var po=Symbol();function Pl(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===po&&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===po?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Dl(e,t){return typeof e=="function"?e(...t):!!e}var nr,Fn,xr,wl,qI=(wl=class extends Xr{constructor(){super();se(this,nr);se(this,Fn);se(this,xr);Q(this,xr,t=>{if(!dr&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){T(this,Fn)||this.setEventListener(T(this,xr))}onUnsubscribe(){var t;this.hasListeners()||((t=T(this,Fn))==null||t.call(this),Q(this,Fn,void 0))}setEventListener(t){var n;Q(this,xr,t),(n=T(this,Fn))==null||n.call(this),Q(this,Fn,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){T(this,nr)!==t&&(Q(this,nr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof T(this,nr)=="boolean"?T(this,nr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},nr=new WeakMap,Fn=new WeakMap,xr=new WeakMap,wl),os=new qI,Ar,_n,Er,bl,KI=(bl=class extends Xr{constructor(){super();se(this,Ar,!0);se(this,_n);se(this,Er);Q(this,Er,t=>{if(!dr&&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(){T(this,_n)||this.setEventListener(T(this,Er))}onUnsubscribe(){var t;this.hasListeners()||((t=T(this,_n))==null||t.call(this),Q(this,_n,void 0))}setEventListener(t){var n;Q(this,Er,t),(n=T(this,_n))==null||n.call(this),Q(this,_n,t(this.setOnline.bind(this)))}setOnline(t){T(this,Ar)!==t&&(Q(this,Ar,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return T(this,Ar)}},Ar=new WeakMap,_n=new WeakMap,Er=new WeakMap,bl),fo=new KI;function Ia(){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 UI(e){return Math.min(1e3*2**e,3e4)}function Ml(e){return(e??"online")==="online"?fo.isOnline():!0}var Jl=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Zo(e){return e instanceof Jl}function kl(e){let t=!1,n=0,r=!1,o;const i=Ia(),a=I=>{var f;r||(h(new Jl(I)),(f=e.abort)==null||f.call(e))},s=()=>{t=!0},c=()=>{t=!1},p=()=>os.isFocused()&&(e.networkMode==="always"||fo.isOnline())&&e.canRun(),l=()=>Ml(e.networkMode)&&e.canRun(),d=I=>{var f;r||(r=!0,(f=e.onSuccess)==null||f.call(e,I),o==null||o(),i.resolve(I))},h=I=>{var f;r||(r=!0,(f=e.onError)==null||f.call(e,I),o==null||o(),i.reject(I))},m=()=>new Promise(I=>{var f;o=C=>{(r||p())&&I(C)},(f=e.onPause)==null||f.call(e)}).then(()=>{var I;o=void 0,r||(I=e.onContinue)==null||I.call(e)}),S=()=>{if(r)return;let I;const f=n===0?e.initialPromise:void 0;try{I=f??e.fn()}catch(C){I=Promise.reject(C)}Promise.resolve(I).then(d).catch(C=>{var R;if(r)return;const g=e.retry??(dr?0:3),O=e.retryDelay??UI,b=typeof O=="function"?O(n,C):O,N=g===!0||typeof g=="number"&&n<g||typeof g=="function"&&g(n,C);if(t||!N){h(C);return}n++,(R=e.onFail)==null||R.call(e,n,C),MI(b).then(()=>p()?void 0:m()).then(()=>{t?h(C):S()})})};return{promise:i,cancel:a,continue:()=>(o==null||o(),i),cancelRetry:s,continueRetry:c,canStart:l,start:()=>(l()?S():m().then(S),i)}}var LI=e=>setTimeout(e,0);function BI(){let e=[],t=0,n=s=>{s()},r=s=>{s()},o=LI;const i=s=>{t?e.push(s):o(()=>{n(s)})},a=()=>{const s=e;e=[],s.length&&o(()=>{r(()=>{s.forEach(c=>{n(c)})})})};return{batch:s=>{let c;t++;try{c=s()}finally{t--,t||a()}return c},batchCalls:s=>(...c)=>{i(()=>{s(...c)})},schedule:i,setNotifyFunction:s=>{n=s},setBatchNotifyFunction:s=>{r=s},setScheduler:s=>{o=s}}}var Ge=BI(),rr,Nl,ql=(Nl=class{constructor(){se(this,rr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ga(this.gcTime)&&Q(this,rr,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(dr?1/0:5*60*1e3))}clearGcTimeout(){T(this,rr)&&(clearTimeout(T(this,rr)),Q(this,rr,void 0))}},rr=new WeakMap,Nl),Fr,_r,Pt,ir,ut,bi,or,jt,mn,Cl,VI=(Cl=class extends ql{constructor(t){super();se(this,jt);se(this,Fr);se(this,_r);se(this,Pt);se(this,ir);se(this,ut);se(this,bi);se(this,or);Q(this,or,!1),Q(this,bi,t.defaultOptions),this.setOptions(t.options),this.observers=[],Q(this,ir,t.client),Q(this,Pt,T(this,ir).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Q(this,Fr,$I(this.options)),this.state=t.state??T(this,Fr),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=T(this,ut))==null?void 0:t.promise}setOptions(t){this.options={...T(this,bi),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&T(this,Pt).remove(this)}setData(t,n){const r=va(this.state.data,t,this.options);return he(this,jt,mn).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){he(this,jt,mn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=T(this,ut))==null?void 0:r.promise;return(o=T(this,ut))==null||o.cancel(t),n?n.then(ft).catch(ft):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(T(this,Fr))}isActive(){return this.observers.some(t=>Wt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===po||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||!_l(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=T(this,ut))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=T(this,ut))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),T(this,Pt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(T(this,ut)&&(T(this,or)?T(this,ut).cancel({revert:!0}):T(this,ut).cancelRetry()),this.scheduleGc()),T(this,Pt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||he(this,jt,mn).call(this,{type:"invalidate"})}fetch(t,n){var c,p,l;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(T(this,ut))return T(this,ut).continueRetry(),T(this,ut).promise}if(t&&this.setOptions(t),!this.options.queryFn){const d=this.observers.find(h=>h.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:()=>(Q(this,or,!0),r.signal)})},i=()=>{const d=Pl(this.options,n),h={client:T(this,ir),queryKey:this.queryKey,meta:this.meta};return o(h),Q(this,or,!1),this.options.persister?this.options.persister(d,h,this):d(h)},a={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:T(this,ir),state:this.state,fetchFn:i};o(a),(c=this.options.behavior)==null||c.onFetch(a,this),Q(this,_r,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((p=a.fetchOptions)==null?void 0:p.meta))&&he(this,jt,mn).call(this,{type:"fetch",meta:(l=a.fetchOptions)==null?void 0:l.meta});const s=d=>{var h,m,S,I;Zo(d)&&d.silent||he(this,jt,mn).call(this,{type:"error",error:d}),Zo(d)||((m=(h=T(this,Pt).config).onError)==null||m.call(h,d,this),(I=(S=T(this,Pt).config).onSettled)==null||I.call(S,this.state.data,d,this)),this.scheduleGc()};return Q(this,ut,kl({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:d=>{var h,m,S,I;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}`),s(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(d)}catch(f){s(f);return}(m=(h=T(this,Pt).config).onSuccess)==null||m.call(h,d,this),(I=(S=T(this,Pt).config).onSettled)==null||I.call(S,d,this.state.error,this),this.scheduleGc()},onError:s,onFail:(d,h)=>{he(this,jt,mn).call(this,{type:"failed",failureCount:d,error:h})},onPause:()=>{he(this,jt,mn).call(this,{type:"pause"})},onContinue:()=>{he(this,jt,mn).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0})),T(this,ut).start()}},Fr=new WeakMap,_r=new WeakMap,Pt=new WeakMap,ir=new WeakMap,ut=new WeakMap,bi=new WeakMap,or=new WeakMap,jt=new WeakSet,mn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Kl(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 Zo(o)&&o.revert&&T(this,_r)?{...T(this,_r),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),Ge.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),T(this,Pt).notify({query:this,type:"updated",action:t})})},Cl);function Kl(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ml(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function $I(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 nn,Tl,jI=(Tl=class extends Xr{constructor(t={}){super();se(this,nn);this.config=t,Q(this,nn,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??is(o,n);let a=this.get(i);return a||(a=new VI({client:t,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(a)),a}add(t){T(this,nn).has(t.queryHash)||(T(this,nn).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=T(this,nn).get(t.queryHash);n&&(t.destroy(),n===t&&T(this,nn).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ge.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return T(this,nn).get(t)}getAll(){return[...T(this,nn).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Ou(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Ou(t,r)):n}notify(t){Ge.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Ge.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Ge.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},nn=new WeakMap,Tl),rn,dt,ar,on,En,Rl,HI=(Rl=class extends ql{constructor(t){super();se(this,on);se(this,rn);se(this,dt);se(this,ar);this.mutationId=t.mutationId,Q(this,dt,t.mutationCache),Q(this,rn,[]),this.state=t.state||Ul(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){T(this,rn).includes(t)||(T(this,rn).push(t),this.clearGcTimeout(),T(this,dt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Q(this,rn,T(this,rn).filter(n=>n!==t)),this.scheduleGc(),T(this,dt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){T(this,rn).length||(this.state.status==="pending"?this.scheduleGc():T(this,dt).remove(this))}continue(){var t;return((t=T(this,ar))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,a,s,c,p,l,d,h,m,S,I,f,C,g,O,b,N,R,E,x;const n=()=>{he(this,on,En).call(this,{type:"continue"})};Q(this,ar,kl({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(_,F)=>{he(this,on,En).call(this,{type:"failed",failureCount:_,error:F})},onPause:()=>{he(this,on,En).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>T(this,dt).canRun(this)}));const r=this.state.status==="pending",o=!T(this,ar).canStart();try{if(r)n();else{he(this,on,En).call(this,{type:"pending",variables:t,isPaused:o}),await((a=(i=T(this,dt).config).onMutate)==null?void 0:a.call(i,t,this));const F=await((c=(s=this.options).onMutate)==null?void 0:c.call(s,t));F!==this.state.context&&he(this,on,En).call(this,{type:"pending",context:F,variables:t,isPaused:o})}const _=await T(this,ar).start();return await((l=(p=T(this,dt).config).onSuccess)==null?void 0:l.call(p,_,t,this.state.context,this)),await((h=(d=this.options).onSuccess)==null?void 0:h.call(d,_,t,this.state.context)),await((S=(m=T(this,dt).config).onSettled)==null?void 0:S.call(m,_,null,this.state.variables,this.state.context,this)),await((f=(I=this.options).onSettled)==null?void 0:f.call(I,_,null,t,this.state.context)),he(this,on,En).call(this,{type:"success",data:_}),_}catch(_){try{throw await((g=(C=T(this,dt).config).onError)==null?void 0:g.call(C,_,t,this.state.context,this)),await((b=(O=this.options).onError)==null?void 0:b.call(O,_,t,this.state.context)),await((R=(N=T(this,dt).config).onSettled)==null?void 0:R.call(N,void 0,_,this.state.variables,this.state.context,this)),await((x=(E=this.options).onSettled)==null?void 0:x.call(E,void 0,_,t,this.state.context)),_}finally{he(this,on,En).call(this,{type:"error",error:_})}}finally{T(this,dt).runNext(this)}}},rn=new WeakMap,dt=new WeakMap,ar=new WeakMap,on=new WeakSet,En=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),Ge.batch(()=>{T(this,rn).forEach(r=>{r.onMutationUpdate(t)}),T(this,dt).notify({mutation:this,type:"updated",action:t})})},Rl);function Ul(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var hn,Ht,Ni,xl,WI=(xl=class extends Xr{constructor(t={}){super();se(this,hn);se(this,Ht);se(this,Ni);this.config=t,Q(this,hn,new Set),Q(this,Ht,new Map),Q(this,Ni,0)}build(t,n,r){const o=new HI({mutationCache:this,mutationId:++Wi(this,Ni)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){T(this,hn).add(t);const n=zi(t);if(typeof n=="string"){const r=T(this,Ht).get(n);r?r.push(t):T(this,Ht).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(T(this,hn).delete(t)){const n=zi(t);if(typeof n=="string"){const r=T(this,Ht).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&T(this,Ht).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=zi(t);if(typeof n=="string"){const r=T(this,Ht).get(n),o=r==null?void 0:r.find(i=>i.state.status==="pending");return!o||o===t}else return!0}runNext(t){var r;const n=zi(t);if(typeof n=="string"){const o=(r=T(this,Ht).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Ge.batch(()=>{T(this,hn).forEach(t=>{this.notify({type:"removed",mutation:t})}),T(this,hn).clear(),T(this,Ht).clear()})}getAll(){return Array.from(T(this,hn))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>vu(n,r))}findAll(t={}){return this.getAll().filter(n=>vu(t,n))}notify(t){Ge.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Ge.batch(()=>Promise.all(t.map(n=>n.continue().catch(ft))))}},hn=new WeakMap,Ht=new WeakMap,Ni=new WeakMap,xl);function zi(e){var t;return(t=e.options.scope)==null?void 0:t.id}function wu(e){return{onFetch:(t,n)=>{var l,d,h,m,S;const r=t.options,o=(h=(d=(l=t.fetchOptions)==null?void 0:l.meta)==null?void 0:d.fetchMore)==null?void 0:h.direction,i=((m=t.state.data)==null?void 0:m.pages)||[],a=((S=t.state.data)==null?void 0:S.pageParams)||[];let s={pages:[],pageParams:[]},c=0;const p=async()=>{let I=!1;const f=O=>{Object.defineProperty(O,"signal",{enumerable:!0,get:()=>(t.signal.aborted?I=!0:t.signal.addEventListener("abort",()=>{I=!0}),t.signal)})},C=Pl(t.options,t.fetchOptions),g=async(O,b,N)=>{if(I)return Promise.reject();if(b==null&&O.pages.length)return Promise.resolve(O);const R={client:t.client,queryKey:t.queryKey,pageParam:b,direction:N?"backward":"forward",meta:t.options.meta};f(R);const E=await C(R),{maxPages:x}=t.options,_=N?kI:JI;return{pages:_(O.pages,E,x),pageParams:_(O.pageParams,b,x)}};if(o&&i.length){const O=o==="backward",b=O?zI:bu,N={pages:i,pageParams:a},R=b(r,N);s=await g(N,R,O)}else{const O=e??i.length;do{const b=c===0?a[0]??r.initialPageParam:bu(r,s);if(c>0&&b==null)break;s=await g(s,b),c++}while(c<O)}return s};t.options.persister?t.fetchFn=()=>{var I,f;return(f=(I=t.options).persister)==null?void 0:f.call(I,p,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=p}}}function bu(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 zI(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 qe,Pn,Dn,Pr,Dr,Mn,Mr,Jr,Al,GI=(Al=class{constructor(e={}){se(this,qe);se(this,Pn);se(this,Dn);se(this,Pr);se(this,Dr);se(this,Mn);se(this,Mr);se(this,Jr);Q(this,qe,e.queryCache||new jI),Q(this,Pn,e.mutationCache||new WI),Q(this,Dn,e.defaultOptions||{}),Q(this,Pr,new Map),Q(this,Dr,new Map),Q(this,Mn,0)}mount(){Wi(this,Mn)._++,T(this,Mn)===1&&(Q(this,Mr,os.subscribe(async e=>{e&&(await this.resumePausedMutations(),T(this,qe).onFocus())})),Q(this,Jr,fo.subscribe(async e=>{e&&(await this.resumePausedMutations(),T(this,qe).onOnline())})))}unmount(){var e,t;Wi(this,Mn)._--,T(this,Mn)===0&&((e=T(this,Mr))==null||e.call(this),Q(this,Mr,void 0),(t=T(this,Jr))==null||t.call(this),Q(this,Jr,void 0))}isFetching(e){return T(this,qe).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return T(this,Pn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=T(this,qe).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=T(this,qe).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Tr(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return T(this,qe).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=T(this,qe).get(r.queryHash),i=o==null?void 0:o.state.data,a=DI(t,i);if(a!==void 0)return T(this,qe).build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Ge.batch(()=>T(this,qe).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=T(this,qe).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=T(this,qe);Ge.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=T(this,qe);return Ge.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Ge.batch(()=>T(this,qe).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(ft).catch(ft)}invalidateQueries(e,t={}){return Ge.batch(()=>(T(this,qe).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=Ge.batch(()=>T(this,qe).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(ft)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(ft)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=T(this,qe).build(this,t);return n.isStaleByTime(Tr(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ft).catch(ft)}fetchInfiniteQuery(e){return e.behavior=wu(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ft).catch(ft)}ensureInfiniteQueryData(e){return e.behavior=wu(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return fo.isOnline()?T(this,Pn).resumePausedMutations():Promise.resolve()}getQueryCache(){return T(this,qe)}getMutationCache(){return T(this,Pn)}getDefaultOptions(){return T(this,Dn)}setDefaultOptions(e){Q(this,Dn,e)}setQueryDefaults(e,t){T(this,Pr).set(pr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...T(this,Pr).values()],n={};return t.forEach(r=>{hi(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){T(this,Dr).set(pr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...T(this,Dr).values()],n={};return t.forEach(r=>{hi(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...T(this,Dn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=is(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===po&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...T(this,Dn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){T(this,qe).clear(),T(this,Pn).clear()}},qe=new WeakMap,Pn=new WeakMap,Dn=new WeakMap,Pr=new WeakMap,Dr=new WeakMap,Mn=new WeakMap,Mr=new WeakMap,Jr=new WeakMap,Al),Ot,Ie,Ci,pt,sr,kr,Jn,kn,Ti,qr,Kr,cr,ur,qn,Ur,xe,ai,Sa,wa,ba,Na,Ca,Ta,Ra,Ll,El,XI=(El=class extends Xr{constructor(t,n){super();se(this,xe);se(this,Ot);se(this,Ie);se(this,Ci);se(this,pt);se(this,sr);se(this,kr);se(this,Jn);se(this,kn);se(this,Ti);se(this,qr);se(this,Kr);se(this,cr);se(this,ur);se(this,qn);se(this,Ur,new Set);this.options=n,Q(this,Ot,t),Q(this,kn,null),Q(this,Jn,Ia()),this.options.experimental_prefetchInRender||T(this,Jn).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(T(this,Ie).addObserver(this),Nu(T(this,Ie),this.options)?he(this,xe,ai).call(this):this.updateResult(),he(this,xe,Na).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return xa(T(this,Ie),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return xa(T(this,Ie),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,he(this,xe,Ca).call(this),he(this,xe,Ta).call(this),T(this,Ie).removeObserver(this)}setOptions(t){const n=this.options,r=T(this,Ie);if(this.options=T(this,Ot).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Wt(this.options.enabled,T(this,Ie))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");he(this,xe,Ra).call(this),T(this,Ie).setOptions(this.options),n._defaulted&&!lo(this.options,n)&&T(this,Ot).getQueryCache().notify({type:"observerOptionsUpdated",query:T(this,Ie),observer:this});const o=this.hasListeners();o&&Cu(T(this,Ie),r,this.options,n)&&he(this,xe,ai).call(this),this.updateResult(),o&&(T(this,Ie)!==r||Wt(this.options.enabled,T(this,Ie))!==Wt(n.enabled,T(this,Ie))||Tr(this.options.staleTime,T(this,Ie))!==Tr(n.staleTime,T(this,Ie)))&&he(this,xe,Sa).call(this);const i=he(this,xe,wa).call(this);o&&(T(this,Ie)!==r||Wt(this.options.enabled,T(this,Ie))!==Wt(n.enabled,T(this,Ie))||i!==T(this,qn))&&he(this,xe,ba).call(this,i)}getOptimisticResult(t){const n=T(this,Ot).getQueryCache().build(T(this,Ot),t),r=this.createResult(n,t);return YI(this,r)&&(Q(this,pt,r),Q(this,kr,this.options),Q(this,sr,T(this,Ie).state)),r}getCurrentResult(){return T(this,pt)}trackResult(t,n){return new Proxy(t,{get:(r,o)=>(this.trackProp(o),n==null||n(o),Reflect.get(r,o))})}trackProp(t){T(this,Ur).add(t)}getCurrentQuery(){return T(this,Ie)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=T(this,Ot).defaultQueryOptions(t),r=T(this,Ot).getQueryCache().build(T(this,Ot),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return he(this,xe,ai).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),T(this,pt)))}createResult(t,n){var _;const r=T(this,Ie),o=this.options,i=T(this,pt),a=T(this,sr),s=T(this,kr),p=t!==r?t.state:T(this,Ci),{state:l}=t;let d={...l},h=!1,m;if(n._optimisticResults){const F=this.hasListeners(),k=!F&&Nu(t,n),J=F&&Cu(t,r,n,o);(k||J)&&(d={...d,...Kl(l.data,t.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:S,errorUpdatedAt:I,status:f}=d;m=d.data;let C=!1;if(n.placeholderData!==void 0&&m===void 0&&f==="pending"){let F;i!=null&&i.isPlaceholderData&&n.placeholderData===(s==null?void 0:s.placeholderData)?(F=i.data,C=!0):F=typeof n.placeholderData=="function"?n.placeholderData((_=T(this,Kr))==null?void 0:_.state.data,T(this,Kr)):n.placeholderData,F!==void 0&&(f="success",m=va(i==null?void 0:i.data,F,n),h=!0)}if(n.select&&m!==void 0&&!C)if(i&&m===(a==null?void 0:a.data)&&n.select===T(this,Ti))m=T(this,qr);else try{Q(this,Ti,n.select),m=n.select(m),m=va(i==null?void 0:i.data,m,n),Q(this,qr,m),Q(this,kn,null)}catch(F){Q(this,kn,F)}T(this,kn)&&(S=T(this,kn),m=T(this,qr),I=Date.now(),f="error");const g=d.fetchStatus==="fetching",O=f==="pending",b=f==="error",N=O&&g,R=m!==void 0,x={status:f,fetchStatus:d.fetchStatus,isPending:O,isSuccess:f==="success",isError:b,isInitialLoading:N,isLoading:N,data:m,dataUpdatedAt:d.dataUpdatedAt,error:S,errorUpdatedAt:I,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>p.dataUpdateCount||d.errorUpdateCount>p.errorUpdateCount,isFetching:g,isRefetching:g&&!O,isLoadingError:b&&!R,isPaused:d.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:b&&R,isStale:as(t,n),refetch:this.refetch,promise:T(this,Jn)};if(this.options.experimental_prefetchInRender){const F=q=>{x.status==="error"?q.reject(x.error):x.data!==void 0&&q.resolve(x.data)},k=()=>{const q=Q(this,Jn,x.promise=Ia());F(q)},J=T(this,Jn);switch(J.status){case"pending":t.queryHash===r.queryHash&&F(J);break;case"fulfilled":(x.status==="error"||x.data!==J.value)&&k();break;case"rejected":(x.status!=="error"||x.error!==J.reason)&&k();break}}return x}updateResult(){const t=T(this,pt),n=this.createResult(T(this,Ie),this.options);if(Q(this,sr,T(this,Ie).state),Q(this,kr,this.options),T(this,sr).data!==void 0&&Q(this,Kr,T(this,Ie)),lo(n,t))return;Q(this,pt,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:o}=this.options,i=typeof o=="function"?o():o;if(i==="all"||!i&&!T(this,Ur).size)return!0;const a=new Set(i??T(this,Ur));return this.options.throwOnError&&a.add("error"),Object.keys(T(this,pt)).some(s=>{const c=s;return T(this,pt)[c]!==t[c]&&a.has(c)})};he(this,xe,Ll).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&he(this,xe,Na).call(this)}},Ot=new WeakMap,Ie=new WeakMap,Ci=new WeakMap,pt=new WeakMap,sr=new WeakMap,kr=new WeakMap,Jn=new WeakMap,kn=new WeakMap,Ti=new WeakMap,qr=new WeakMap,Kr=new WeakMap,cr=new WeakMap,ur=new WeakMap,qn=new WeakMap,Ur=new WeakMap,xe=new WeakSet,ai=function(t){he(this,xe,Ra).call(this);let n=T(this,Ie).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(ft)),n},Sa=function(){he(this,xe,Ca).call(this);const t=Tr(this.options.staleTime,T(this,Ie));if(dr||T(this,pt).isStale||!ga(t))return;const r=_l(T(this,pt).dataUpdatedAt,t)+1;Q(this,cr,setTimeout(()=>{T(this,pt).isStale||this.updateResult()},r))},wa=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(T(this,Ie)):this.options.refetchInterval)??!1},ba=function(t){he(this,xe,Ta).call(this),Q(this,qn,t),!(dr||Wt(this.options.enabled,T(this,Ie))===!1||!ga(T(this,qn))||T(this,qn)===0)&&Q(this,ur,setInterval(()=>{(this.options.refetchIntervalInBackground||os.isFocused())&&he(this,xe,ai).call(this)},T(this,qn)))},Na=function(){he(this,xe,Sa).call(this),he(this,xe,ba).call(this,he(this,xe,wa).call(this))},Ca=function(){T(this,cr)&&(clearTimeout(T(this,cr)),Q(this,cr,void 0))},Ta=function(){T(this,ur)&&(clearInterval(T(this,ur)),Q(this,ur,void 0))},Ra=function(){const t=T(this,Ot).getQueryCache().build(T(this,Ot),this.options);if(t===T(this,Ie))return;const n=T(this,Ie);Q(this,Ie,t),Q(this,Ci,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Ll=function(t){Ge.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(T(this,pt))}),T(this,Ot).getQueryCache().notify({query:T(this,Ie),type:"observerResultsUpdated"})})},El);function QI(e,t){return Wt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Nu(e,t){return QI(e,t)||e.state.data!==void 0&&xa(e,t,t.refetchOnMount)}function xa(e,t,n){if(Wt(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&as(e,t)}return!1}function Cu(e,t,n,r){return(e!==t||Wt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&as(e,n)}function as(e,t){return Wt(t.enabled,e)!==!1&&e.isStaleByTime(Tr(t.staleTime,e))}function YI(e,t){return!lo(e.getCurrentResult(),t)}var Kn,Un,vt,gn,On,no,Aa,Fl,ZI=(Fl=class extends Xr{constructor(n,r){super();se(this,On);se(this,Kn);se(this,Un);se(this,vt);se(this,gn);Q(this,Kn,n),this.setOptions(r),this.bindMethods(),he(this,On,no).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=T(this,Kn).defaultMutationOptions(n),lo(this.options,r)||T(this,Kn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:T(this,vt),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&pr(r.mutationKey)!==pr(this.options.mutationKey)?this.reset():((o=T(this,vt))==null?void 0:o.state.status)==="pending"&&T(this,vt).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=T(this,vt))==null||n.removeObserver(this)}onMutationUpdate(n){he(this,On,no).call(this),he(this,On,Aa).call(this,n)}getCurrentResult(){return T(this,Un)}reset(){var n;(n=T(this,vt))==null||n.removeObserver(this),Q(this,vt,void 0),he(this,On,no).call(this),he(this,On,Aa).call(this)}mutate(n,r){var o;return Q(this,gn,r),(o=T(this,vt))==null||o.removeObserver(this),Q(this,vt,T(this,Kn).getMutationCache().build(T(this,Kn),this.options)),T(this,vt).addObserver(this),T(this,vt).execute(n)}},Kn=new WeakMap,Un=new WeakMap,vt=new WeakMap,gn=new WeakMap,On=new WeakSet,no=function(){var r;const n=((r=T(this,vt))==null?void 0:r.state)??Ul();Q(this,Un,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Aa=function(n){Ge.batch(()=>{var r,o,i,a,s,c,p,l;if(T(this,gn)&&this.hasListeners()){const d=T(this,Un).variables,h=T(this,Un).context;(n==null?void 0:n.type)==="success"?((o=(r=T(this,gn)).onSuccess)==null||o.call(r,n.data,d,h),(a=(i=T(this,gn)).onSettled)==null||a.call(i,n.data,null,d,h)):(n==null?void 0:n.type)==="error"&&((c=(s=T(this,gn)).onError)==null||c.call(s,n.error,d,h),(l=(p=T(this,gn)).onSettled)==null||l.call(p,void 0,n.error,d,h))}this.listeners.forEach(d=>{d(T(this,Un))})})},Fl),Bl=U.createContext(void 0),Ke=e=>{const t=U.useContext(Bl);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},eS=({client:e,children:t})=>(U.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),u.jsx(Bl.Provider,{value:e,children:t})),Vl=U.createContext(!1),tS=()=>U.useContext(Vl);Vl.Provider;function nS(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var rS=U.createContext(nS()),iS=()=>U.useContext(rS),oS=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},aS=e=>{U.useEffect(()=>{e.clearReset()},[e])},sS=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||Dl(n,[e.error,r])),cS=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)))},uS=(e,t)=>e.isLoading&&e.isFetching&&!t,lS=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Tu=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function dS(e,t,n){var d,h,m,S,I;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=Ke(),o=tS(),i=iS(),a=r.defaultQueryOptions(e);(h=(d=r.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||h.call(d,a),process.env.NODE_ENV!=="production"&&(a.queryFn||console.error(`[${a.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`)),a._optimisticResults=o?"isRestoring":"optimistic",cS(a),oS(a,i),aS(i);const s=!r.getQueryCache().get(a.queryHash),[c]=U.useState(()=>new t(r,a)),p=c.getOptimisticResult(a),l=!o&&e.subscribed!==!1;if(U.useSyncExternalStore(U.useCallback(f=>{const C=l?c.subscribe(Ge.batchCalls(f)):ft;return c.updateResult(),C},[c,l]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),U.useEffect(()=>{c.setOptions(a)},[a,c]),lS(a,p))throw Tu(a,c,i);if(sS({result:p,errorResetBoundary:i,throwOnError:a.throwOnError,query:r.getQueryCache().get(a.queryHash),suspense:a.suspense}))throw p.error;if((S=(m=r.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||S.call(m,a,p),a.experimental_prefetchInRender&&!dr&&uS(p,o)){const f=s?Tu(a,c,i):(I=r.getQueryCache().get(a.queryHash))==null?void 0:I.promise;f==null||f.catch(ft).finally(()=>{c.updateResult()})}return a.notifyOnChangeProps?p:c.trackResult(p)}function Wn(e,t){return dS(e,XI)}function vn(e,t){const n=Ke(),[r]=U.useState(()=>new ZI(n,e));U.useEffect(()=>{r.setOptions(e)},[r,e]);const o=U.useSyncExternalStore(U.useCallback(a=>r.subscribe(Ge.batchCalls(a)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=U.useCallback((a,s)=>{r.mutate(a,s).catch(ft)},[r]);if(o.error&&Dl(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:i,mutateAsync:o.mutate}}const $l=v.createContext(null),pS=$l.Provider,jl=()=>{const e=v.useContext($l);if(e===null)throw new Error("useApiKey must be used within an ApiKeyProvider");return e};var de=(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))(de||{});const Hl=v.createContext(void 0);function Jt(){const e=v.useContext(Hl);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const fS=(()=>{const e={};return Object.values(de).forEach(t=>{e[t]={}}),e})();function mS({children:e}){const[t,n]=v.useState(fS),r=v.useCallback((l,d,h=!0)=>{n(m=>{const S={...m};return S[l]=S[l]||{},S[l][d]=h,S})},[n]),o=v.useCallback((l,d)=>{var h;return!!((h=t[l])!=null&&h[d])},[t]),i=v.useCallback((l,d)=>{var h;return(h=t[l])==null?void 0:h[d]},[t]),a=v.useCallback((l,d)=>{n(h=>{var S;const m={...h};return(S=m[l])==null||delete S[d],m})},[n]),s=v.useCallback(l=>{n(d=>{const h={...d};return h[l]={},h})},[n]),c=v.useCallback((l,d)=>{n(h=>{const m={...h};return m[l]=m[l]||{},d.forEach(S=>{m[l][S]=!0}),m})},[n]),p=v.useMemo(()=>({errorState:t,setErrorState:n,setError:r,isError:o,removeError:a,resetBoundary:s,setErrors:c,getError:i}),[t,n,r,o,a,s,c,i]);return u.jsx(Hl.Provider,{value:p,children:e})}const Wl="https://api.withampersand.com/v1".replace(/\/+$/,"");class Ao{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Wl}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||cs}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 zl=new Ao,xo=class xo{constructor(t=zl){this.configuration=t,this.fetchApi=async(n,r)=>{let o={url:n,init:r};for(const a of this.middleware)a.pre&&(o=await a.pre({fetch:this.fetchApi,...o})||o);let i;try{i=await(this.configuration.fetchApi||fetch)(o.url,o.init)}catch(a){for(const s of this.middleware)s.onError&&(i=await s.onError({fetch:this.fetchApi,url:o.url,init:o.init,error:a,response:i?i.clone():void 0})||i);if(i===void 0)throw a instanceof Error?new Gl(a,"The request failed and the interceptors did not return an alternative response"):a}for(const a of this.middleware)a.post&&(i=await a.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?xo.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 ss(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(p=>o[p]===void 0?delete o[p]:{});const i=typeof n=="function"?n:async()=>n,a={method:t.method,headers:o,body:t.body,credentials:this.configuration.credentials},s={...a,...await i({init:a,context:t})},c={...s,body:gS(s.body)||s.body instanceof URLSearchParams||hS(s.body)?s.body:JSON.stringify(s.body)};return{url:r,init:c}}clone(){const t=this.constructor,n=new t(this.configuration);return n.middleware=this.middleware.slice(),n}};xo.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let Le=xo;function hS(e){return typeof Blob<"u"&&e instanceof Blob}function gS(e){return typeof FormData<"u"&&e instanceof FormData}class ss extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class Gl extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class P extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}const yS={csv:",",ssv:" ",tsv:" ",pipes:"|"};function y(e,t){const n=e[t];return n!=null}function cs(e,t=""){return Object.keys(e).map(n=>Xl(n,e[n],t)).filter(n=>n.length>0).join("&")}function Xl(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 Xl(e,o,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?cs(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function pe(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}function OS(e){for(const t of e)if(t.contentType==="multipart/form-data")return!0;return!1}class ue{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class Tt{constructor(t){this.raw=t}async value(){}}class vS{constructor(t){this.raw=t}async value(){return await this.raw.blob()}}class Ea{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function IS(e){let t=!0;return t=t&&"invitedEmail"in e,t}function SS(e){return Ql(e)}function Ql(e,t){return e==null?e:{invitedEmail:e.invitedEmail}}function Yl(e){if(e!==void 0)return e===null?null:{invitedEmail:e.invitedEmail}}function wS(e){let t=!0;return t=t&&"key"in e,t=t&&"label"in e,t=t&&"scopes"in e,t=t&&"projectId"in e,t}function si(e){return Zl(e)}function Zl(e,t){return e==null?e:{key:e.key,label:e.label,scopes:e.scopes,projectId:e.projectId,active:y(e,"active")?e.active:void 0}}function bS(e){if(e!==void 0)return e===null?null:{key:e.key,label:e.label,scopes:e.scopes,projectId:e.projectId,active:e.active}}const NS={UsernameField:"username",PasswordField:"password"};function CS(e){return!0}function ed(e){return td(e)}function td(e,t){return e==null?e:{fieldUsed:y(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:y(e,"keyFormat")?e.keyFormat:void 0}}function nd(e){if(e!==void 0)return e===null?null:{fieldUsed:e.fieldUsed,keyFormat:e.keyFormat}}function TS(e){let t=!0;return t=t&&"name"in e,t}function rd(e){return id(e)}function id(e,t){return e==null?e:{name:e.name,valuePrefix:y(e,"valuePrefix")?e.valuePrefix:void 0}}function od(e){if(e!==void 0)return e===null?null:{name:e.name,valuePrefix:e.valuePrefix}}function RS(e){let t=!0;return t=t&&"name"in e,t}function ad(e){return sd(e)}function sd(e,t){return e==null?e:{name:e.name}}function cd(e){if(e!==void 0)return e===null?null:{name:e.name}}const xS={Query:"query",Header:"header"};function AS(e){let t=!0;return t=t&&"attachmentType"in e,t}function ud(e){return ld(e)}function ld(e,t){return e==null?e:{attachmentType:e.attachmentType,query:y(e,"query")?ad(e.query):void 0,header:y(e,"header")?rd(e.header):void 0,docsURL:y(e,"docsURL")?e.docsURL:void 0}}function dd(e){if(e!==void 0)return e===null?null:{attachmentType:e.attachmentType,query:cd(e.query),header:od(e.header),docsURL:e.docsURL}}function ES(e){let t=!0;return t=t&&"label"in e,t}function FS(e){return pd(e)}function pd(e,t){return e==null?e:{label:e.label,scopes:y(e,"scopes")?e.scopes:void 0}}function fd(e){if(e!==void 0)return e===null?null:{label:e.label,scopes:e.scopes}}function _S(e){return!0}function PS(e){return md(e)}function md(e,t){return e==null?e:{subsystem:y(e,"subsystem")?e.subsystem:void 0,time:y(e,"time")?new Date(e.time):void 0,requestId:y(e,"requestId")?e.requestId:void 0,causes:y(e,"causes")?e.causes:void 0,remedy:y(e,"remedy")?e.remedy:void 0,supportEmail:y(e,"supportEmail")?e.supportEmail:void 0,supportPhone:y(e,"supportPhone")?e.supportPhone:void 0,supportUrl:y(e,"supportUrl")?e.supportUrl:void 0,retryable:y(e,"retryable")?e.retryable:void 0,retryAfter:y(e,"retryAfter")?new Date(e.retryAfter):void 0,context:y(e,"context")?e.context:void 0,type:y(e,"type")?e.type:void 0,href:y(e,"href")?e.href:void 0,title:y(e,"title")?e.title:void 0,status:y(e,"status")?e.status:void 0,detail:y(e,"detail")?e.detail:void 0,instance:y(e,"instance")?e.instance:void 0}}function DS(e){if(e!==void 0)return e===null?null:{subsystem:e.subsystem,time:e.time===void 0?void 0:e.time.toISOString(),requestId:e.requestId,causes:e.causes,remedy:e.remedy,supportEmail:e.supportEmail,supportPhone:e.supportPhone,supportUrl:e.supportUrl,retryable:e.retryable,retryAfter:e.retryAfter===void 0?void 0:e.retryAfter.toISOString(),context:e.context,type:e.type,href:e.href,title:e.title,status:e.status,detail:e.detail,instance:e.instance}}const MS={Always:"always"};function JS(e){return!0}function hd(e){return gd(e)}function gd(e,t){return e==null?e:{enabled:y(e,"enabled")?e.enabled:void 0,includeFullRecords:y(e,"includeFullRecords")?e.includeFullRecords:void 0}}function yd(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,includeFullRecords:e.includeFullRecords}}function kS(e){let t=!0;return t=t&&"url"in e,t}function Od(e){return vd(e)}function vd(e,t){return e==null?e:{url:e.url,method:y(e,"method")?e.method:void 0,successStatusCodes:y(e,"successStatusCodes")?e.successStatusCodes:void 0}}function Id(e){if(e!==void 0)return e===null?null:{url:e.url,method:e.method,successStatusCodes:e.successStatusCodes}}const Fa={Oauth2:"oauth2",ApiKey:"apiKey",Basic:"basic",Jwt:"jwt",None:"none"};function Sd(e){return wd(e)}function wd(e,t){return e}function qS(e){return e}function KS(e){return!0}function bd(e){return Nd(e)}function Nd(e,t){return e==null?e:{days:y(e,"days")?e.days:void 0,fullHistory:y(e,"fullHistory")?e.fullHistory:void 0}}function Cd(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function US(e){let t=!0;return t=t&&"defaultPeriod"in e,t}function us(e){return Td(e)}function Td(e,t){return e==null?e:{defaultPeriod:bd(e.defaultPeriod)}}function ls(e){if(e!==void 0)return e===null?null:{defaultPeriod:Cd(e.defaultPeriod)}}function LS(e){return!0}function Rd(e){return xd(e)}function xd(e,t){return e==null?e:{days:y(e,"days")?e.days:void 0,fullHistory:y(e,"fullHistory")?e.fullHistory:void 0}}function Ad(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function BS(e){let t=!0;return t=t&&"defaultPeriod"in e,t}function ds(e){return Ed(e)}function Ed(e,t){return e==null?e:{defaultPeriod:Rd(e.defaultPeriod)}}function ps(e){if(e!==void 0)return e===null?null:{defaultPeriod:Ad(e.defaultPeriod)}}function VS(e){return!0}function Eo(e){return Fd(e)}function Fd(e,t){return e==null?e:{enabled:y(e,"enabled")?e.enabled:void 0}}function Fo(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}const $S={SelectedFieldsAll:"all"};function fs(e){return _d(e)}function _d(e,t){return e}function jS(e){return e}function HS(e){return!0}function Pd(e){return Dd(e)}function Dd(e,t){return e==null?e:{objectName:y(e,"objectName")?e.objectName:void 0,schedule:y(e,"schedule")?e.schedule:void 0,destination:y(e,"destination")?e.destination:void 0,selectedFields:y(e,"selectedFields")?e.selectedFields:void 0,selectedValueMappings:y(e,"selectedValueMappings")?e.selectedValueMappings:void 0,selectedFieldMappings:y(e,"selectedFieldMappings")?e.selectedFieldMappings:void 0,selectedFieldsAuto:y(e,"selectedFieldsAuto")?fs(e.selectedFieldsAuto):void 0,backfill:y(e,"backfill")?ds(e.backfill):void 0}}function Md(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:ps(e.backfill)}}function WS(e){return!0}function ms(e){return Jd(e)}function Jd(e,t){return e==null?e:{objects:y(e,"objects")?pe(e.objects,Pd):void 0}}function hs(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:pe(e.objects,Md)}}function zS(e){return!0}function kd(e){return qd(e)}function qd(e,t){return e==null?e:{stringValue:y(e,"stringValue")?e.stringValue:void 0,integerValue:y(e,"integerValue")?e.integerValue:void 0,booleanValue:y(e,"booleanValue")?e.booleanValue:void 0}}function Kd(e){if(e!==void 0)return e===null?null:{stringValue:e.stringValue,integerValue:e.integerValue,booleanValue:e.booleanValue}}const GS={Always:"always",Never:"never"},XS={Always:"always",Never:"never"};function QS(e){return!0}function gs(e){return Ud(e)}function Ud(e,t){return e==null?e:{_default:y(e,"default")?kd(e.default):void 0,writeOnCreate:y(e,"writeOnCreate")?e.writeOnCreate:void 0,writeOnUpdate:y(e,"writeOnUpdate")?e.writeOnUpdate:void 0}}function ys(e){if(e!==void 0)return e===null?null:{default:Kd(e._default),writeOnCreate:e.writeOnCreate,writeOnUpdate:e.writeOnUpdate}}const YS={Always:"always",Never:"never"};function Ld(e){let t=!0;return t=t&&"value"in e,t}function ZS(e){return Os(e)}function Os(e,t){return e==null?e:{value:e.value,applyOnUpdate:y(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Bd(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}const ew={Always:"always",Never:"never"};function Vd(e){let t=!0;return t=t&&"value"in e,t}function tw(e){return vs(e)}function vs(e,t){return e==null?e:{value:e.value,applyOnUpdate:y(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function $d(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}const nw={Always:"always",Never:"never"};function jd(e){let t=!0;return t=t&&"value"in e,t}function rw(e){return Is(e)}function Is(e,t){return e==null?e:{value:e.value,applyOnUpdate:y(e,"applyOnUpdate")?e.applyOnUpdate:void 0}}function Hd(e){if(e!==void 0)return e===null?null:{value:e.value,applyOnUpdate:e.applyOnUpdate}}function Ss(e){return Wd(e)}function Wd(e,t){return e==null?e:{...Os(e),...vs(e),...Is(e)}}function ws(e){if(e!==void 0)return e===null?null:Ld(e)?Bd(e):Vd(e)?$d(e):jd(e)?Hd(e):{}}function iw(e){let t=!0;return t=t&&"objectName"in e,t}function zd(e){return Gd(e)}function Gd(e,t){return e==null?e:{objectName:e.objectName,selectedValueDefaults:y(e,"selectedValueDefaults")?pe(e.selectedValueDefaults,Ss):void 0,selectedFieldSettings:y(e,"selectedFieldSettings")?pe(e.selectedFieldSettings,gs):void 0}}function Xd(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:pe(e.selectedValueDefaults,ws),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:pe(e.selectedFieldSettings,ys)}}function ow(e){return!0}function bs(e){return Qd(e)}function Qd(e,t){return e==null?e:{objects:y(e,"objects")?pe(e.objects,zd):void 0}}function Ns(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:pe(e.objects,Xd)}}function aw(e){return!0}function sw(e){return Yd(e)}function Yd(e,t){return e==null?e:{provider:y(e,"provider")?e.provider:void 0,read:y(e,"read")?ms(e.read):void 0,write:y(e,"write")?bs(e.write):void 0,proxy:y(e,"proxy")?Eo(e.proxy):void 0}}function cw(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:hs(e.read),write:Ns(e.write),proxy:Fo(e.proxy)}}const uw={Always:"always"};function lw(e){let t=!0;return t=t&&"enabled"in e,t}function Cs(e){return Zd(e)}function Zd(e,t){return e==null?e:{enabled:e.enabled}}function Ts(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}const dw={Always:"always"};function pw(e){let t=!0;return t=t&&"enabled"in e,t}function Rs(e){return ep(e)}function ep(e,t){return e==null?e:{enabled:e.enabled}}function xs(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}const fw={Always:"always"},mw={All:"all"};function hw(e){let t=!0;return t=t&&"enabled"in e,t}function As(e){return tp(e)}function tp(e,t){return e==null?e:{enabled:e.enabled,watchFieldsAuto:y(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:y(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function Es(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function gw(e){let t=!0;return t=t&&"inheritFieldsAndMappings"in e,t=t&&"objectName"in e,t=t&&"destination"in e,t}function np(e){return rp(e)}function rp(e,t){return e==null?e:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:y(e,"createEvent")?Cs(e.createEvent):void 0,updateEvent:y(e,"updateEvent")?As(e.updateEvent):void 0,deleteEvent:y(e,"deleteEvent")?Rs(e.deleteEvent):void 0}}function ip(e){if(e!==void 0)return e===null?null:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:Ts(e.createEvent),updateEvent:Es(e.updateEvent),deleteEvent:xs(e.deleteEvent)}}function yw(e){return!0}function Ow(e){return op(e)}function op(e,t){return e==null?e:{objects:y(e,"objects")?pe(e.objects,np):void 0}}function vw(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:pe(e.objects,ip)}}function Iw(e){return!0}function ap(e){return sp(e)}function sp(e,t){return e==null?e:{apiKeyAsBasic:y(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:y(e,"apiKeyAsBasicOpts")?ed(e.apiKeyAsBasicOpts):void 0,docsURL:y(e,"docsURL")?e.docsURL:void 0}}function cp(e){if(e!==void 0)return e===null?null:{apiKeyAsBasic:e.apiKeyAsBasic,apiKeyAsBasicOpts:nd(e.apiKeyAsBasicOpts),docsURL:e.docsURL}}function Sw(e){return!0}function ww(e){return up(e)}function up(e,t){return e==null?e:{sourceZipUrl:y(e,"sourceZipUrl")?e.sourceZipUrl:void 0,sourceYaml:y(e,"sourceYaml")?e.sourceYaml:void 0}}function lp(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function bw(e){let t=!0;return t=t&&"id"in e,t=t&&"displayName"in e,t=t&&"billingProvider"in e,t=t&&"billingProviderRef"in e,t}function dp(e){return pp(e)}function pp(e,t){return e==null?e:{id:e.id,displayName:e.displayName,billingProvider:e.billingProvider,billingProviderRef:e.billingProviderRef,createTime:y(e,"createTime")?new Date(e.createTime):void 0,updateTime:y(e,"updateTime")?new Date(e.updateTime):void 0}}function Nw(e){if(e!==void 0)return e===null?null:{id:e.id,displayName:e.displayName,billingProvider:e.billingProvider,billingProviderRef:e.billingProviderRef,createTime:e.createTime===void 0?void 0:e.createTime.toISOString(),updateTime:e.updateTime===void 0?void 0:e.updateTime.toISOString()}}function Cw(e){let t=!0;return t=t&&"id"in e,t=t&&"idpProvider"in e,t=t&&"idpRef"in e,t=t&&"createTime"in e,t}function Fs(e){return fp(e)}function fp(e,t){return e==null?e:{id:e.id,idpProvider:e.idpProvider,idpRef:e.idpRef,createTime:new Date(e.createTime),firstName:y(e,"firstName")?e.firstName:void 0,lastName:y(e,"lastName")?e.lastName:void 0,fullName:y(e,"fullName")?e.fullName:void 0,primaryEmail:y(e,"primaryEmail")?e.primaryEmail:void 0}}function mp(e){if(e!==void 0)return e===null?null:{id:e.id,idpProvider:e.idpProvider,idpRef:e.idpRef,createTime:e.createTime.toISOString(),firstName:e.firstName,lastName:e.lastName,fullName:e.fullName,primaryEmail:e.primaryEmail}}function Tw(e){let t=!0;return t=t&&"id"in e,t=t&&"label"in e,t=t&&"defaultTeamId"in e,t=t&&"createTime"in e,t}function li(e){return hp(e)}function hp(e,t){return e==null?e:{id:e.id,label:e.label,defaultTeamId:e.defaultTeamId,createTime:new Date(e.createTime),updateTime:y(e,"updateTime")?new Date(e.updateTime):void 0}}function gp(e){if(e!==void 0)return e===null?null:{id:e.id,label:e.label,defaultTeamId:e.defaultTeamId,createTime:e.createTime.toISOString(),updateTime:e.updateTime===void 0?void 0:e.updateTime.toISOString()}}const Rw={Team:"team",Builder:"builder"};function xw(e){let t=!0;return t=t&&"role"in e,t=t&&"principalType"in e,t=t&&"principalId"in e,t=t&&"org"in e,t}function yp(e){return Op(e)}function Op(e,t){return e==null?e:{role:e.role,principalType:e.principalType,principalId:e.principalId,org:li(e.org)}}function vp(e){if(e!==void 0)return e===null?null:{role:e.role,principalType:e.principalType,principalId:e.principalId,org:gp(e.org)}}function Aw(e){let t=!0;return t=t&&"value"in e,t}function Ip(e){return Sp(e)}function Sp(e,t){return e==null?e:{value:e.value}}function wp(e){if(e!==void 0)return e===null?null:{value:e.value}}function Ew(e){return!0}function bp(e){return Np(e)}function Np(e,t){return e==null?e:{brandingRemoval:y(e,"brandingRemoval")?Ip(e.brandingRemoval):void 0}}function Cp(e){if(e!==void 0)return e===null?null:{brandingRemoval:wp(e.brandingRemoval)}}function Fw(e){let t=!0;return t=t&&"id"in e,t=t&&"name"in e,t=t&&"appName"in e,t=t&&"createTime"in e,t}function br(e){return Tp(e)}function Tp(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:y(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:y(e,"updateTime")?new Date(e.updateTime):void 0,entitlements:y(e,"entitlements")?bp(e.entitlements):void 0}}function Rp(e){if(e!==void 0)return e===null?null:{id:e.id,name:e.name,appName:e.appName,orgId:e.orgId,createTime:e.createTime.toISOString(),updateTime:e.updateTime===void 0?void 0:e.updateTime.toISOString(),entitlements:Cp(e.entitlements)}}const _w={Team:"team",Builder:"builder"};function Pw(e){let t=!0;return t=t&&"role"in e,t=t&&"principalType"in e,t=t&&"principalId"in e,t=t&&"project"in e,t}function xp(e){return Ap(e)}function Ap(e,t){return e==null?e:{role:e.role,principalType:e.principalType,principalId:e.principalId,project:br(e.project)}}function Ep(e){if(e!==void 0)return e===null?null:{role:e.role,principalType:e.principalType,principalId:e.principalId,project:Rp(e.project)}}function Dw(e){let t=!0;return t=t&&"builder"in e,t=t&&"projectRoles"in e,t}function _a(e){return Fp(e)}function Fp(e,t){return e==null?e:{builder:Fs(e.builder),projectRoles:pe(e.projectRoles,xp),orgRole:y(e,"orgRole")?yp(e.orgRole):void 0}}function Mw(e){if(e!==void 0)return e===null?null:{builder:mp(e.builder),projectRoles:pe(e.projectRoles,Ep),orgRole:vp(e.orgRole)}}function Jw(e){let t=!0;return t=t&&"insert"in e,t=t&&"update"in e,t=t&&"upsert"in e,t=t&&"_delete"in e,t}function _p(e){return Pp(e)}function Pp(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function Dp(e){if(e!==void 0)return e===null?null:{insert:e.insert,update:e.update,upsert:e.upsert,delete:e._delete}}function kw(e){let t=!0;return t=t&&"objectName"in e,t=t&&"schedule"in e,t=t&&"destination"in e,t=t&&"selectedFields"in e,t=t&&"selectedFieldMappings"in e,t}function _s(e){return Mp(e)}function Mp(e,t){return e==null?e:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:y(e,"selectedValueMappings")?e.selectedValueMappings:void 0,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:y(e,"selectedFieldsAuto")?fs(e.selectedFieldsAuto):void 0,backfill:y(e,"backfill")?ds(e.backfill):void 0}}function Ps(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:ps(e.backfill)}}function qw(e){let t=!0;return t=t&&"objects"in e,t}function Ds(e){return Jp(e)}function Jp(e,t){return e==null?e:{objects:pe(e.objects,_s)}}function Ms(e){if(e!==void 0)return e===null?null:{objects:pe(e.objects,Ps)}}function Kw(e){let t=!0;return t=t&&"inheritFieldsAndMappings"in e,t=t&&"objectName"in e,t=t&&"destination"in e,t}function Js(e){return kp(e)}function kp(e,t){return e==null?e:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:y(e,"createEvent")?Cs(e.createEvent):void 0,updateEvent:y(e,"updateEvent")?As(e.updateEvent):void 0,deleteEvent:y(e,"deleteEvent")?Rs(e.deleteEvent):void 0}}function ks(e){if(e!==void 0)return e===null?null:{inheritFieldsAndMappings:e.inheritFieldsAndMappings,objectName:e.objectName,destination:e.destination,createEvent:Ts(e.createEvent),updateEvent:Es(e.updateEvent),deleteEvent:xs(e.deleteEvent)}}function Uw(e){let t=!0;return t=t&&"objects"in e,t}function qs(e){return qp(e)}function qp(e,t){return e==null?e:{objects:pe(e.objects,Js)}}function Ks(e){if(e!==void 0)return e===null?null:{objects:pe(e.objects,ks)}}function Lw(e){let t=!0;return t=t&&"objectName"in e,t}function Us(e){return Kp(e)}function Kp(e,t){return e==null?e:{objectName:e.objectName,selectedValueDefaults:y(e,"selectedValueDefaults")?pe(e.selectedValueDefaults,Ss):void 0,selectedFieldSettings:y(e,"selectedFieldSettings")?pe(e.selectedFieldSettings,gs):void 0}}function Ls(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults===void 0?void 0:pe(e.selectedValueDefaults,ws),selectedFieldSettings:e.selectedFieldSettings===void 0?void 0:pe(e.selectedFieldSettings,ys)}}function Bw(e){return!0}function Bs(e){return Up(e)}function Up(e,t){return e==null?e:{objects:y(e,"objects")?pe(e.objects,Us):void 0}}function Vs(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:pe(e.objects,Ls)}}function Vw(e){let t=!0;return t=t&&"provider"in e,t}function $s(e){return Lp(e)}function Lp(e,t){return e==null?e:{provider:e.provider,read:y(e,"read")?Ds(e.read):void 0,write:y(e,"write")?Bs(e.write):void 0,proxy:y(e,"proxy")?Eo(e.proxy):void 0,subscribe:y(e,"subscribe")?qs(e.subscribe):void 0}}function js(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:Ms(e.read),write:Vs(e.write),proxy:Fo(e.proxy),subscribe:Ks(e.subscribe)}}function $w(e){let t=!0;return t=t&&"id"in e,t=t&&"revisionId"in e,t=t&&"createTime"in e,t=t&&"createdBy"in e,t=t&&"content"in e,t}function Bp(e){return Vp(e)}function Vp(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:$s(e.content)}}function $p(e){if(e!==void 0)return e===null?null:{id:e.id,revisionId:e.revisionId,createTime:e.createTime.toISOString(),createdBy:e.createdBy,content:js(e.content)}}function jw(e){return!0}function Hw(e){return jp(e)}function jp(e,t){return e==null?e:{read:y(e,"read")?Ds(e.read):void 0,write:y(e,"write")?Bs(e.write):void 0,subscribe:y(e,"subscribe")?qs(e.subscribe):void 0}}function Ww(e){if(e!==void 0)return e===null?null:{read:Ms(e.read),write:Vs(e.write),subscribe:Ks(e.subscribe)}}function zw(e){let t=!0;return t=t&&"consumerRef"in e,t=t&&"consumerName"in e,t=t&&"projectId"in e,t=t&&"createTime"in e,t}function Hp(e){return Wp(e)}function Wp(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:y(e,"updateTime")?new Date(e.updateTime):void 0}}function zp(e){if(e!==void 0)return e===null?null:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:e.createTime.toISOString(),updateTime:e.updateTime===void 0?void 0:e.updateTime.toISOString()}}function Gw(e){let t=!0;return t=t&&"groupRef"in e,t=t&&"groupName"in e,t=t&&"projectId"in e,t=t&&"createTime"in e,t}function Hs(e){return Gp(e)}function Gp(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:y(e,"updateTime")?new Date(e.updateTime):void 0}}function Ws(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:e.createTime.toISOString(),updateTime:e.updateTime===void 0?void 0:e.updateTime.toISOString()}}function Xw(e){let t=!0;return t=t&&"token"in e,t}function Xp(e){return Qp(e)}function Qp(e,t){return e==null?e:{token:e.token,issuedAt:y(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:y(e,"expiresAt")?new Date(e.expiresAt):void 0}}function Yp(e){if(e!==void 0)return e===null?null:{token:e.token,issuedAt:e.issuedAt===void 0?void 0:e.issuedAt.toISOString(),expiresAt:e.expiresAt===void 0?void 0:e.expiresAt.toISOString()}}function Qw(e){let t=!0;return t=t&&"token"in e,t}function Zp(e){return ef(e)}function ef(e,t){return e==null?e:{token:e.token,issuedAt:y(e,"issuedAt")?new Date(e.issuedAt):void 0,expiresAt:y(e,"expiresAt")?new Date(e.expiresAt):void 0}}function tf(e){if(e!==void 0)return e===null?null:{token:e.token,issuedAt:e.issuedAt===void 0?void 0:e.issuedAt.toISOString(),expiresAt:e.expiresAt===void 0?void 0:e.expiresAt.toISOString()}}function Yw(e){return!0}function nf(e){return rf(e)}function rf(e,t){return e==null?e:{accessToken:y(e,"accessToken")?Xp(e.accessToken):void 0,refreshToken:y(e,"refreshToken")?Zp(e.refreshToken):void 0,scopes:y(e,"scopes")?e.scopes:void 0}}function of(e){if(e!==void 0)return e===null?null:{accessToken:Yp(e.accessToken),refreshToken:tf(e.refreshToken),scopes:e.scopes}}function Zw(e){let t=!0;return t=t&&"id"in e,t=t&&"projectId"in e,t=t&&"provider"in e,t=t&&"clientId"in e,t=t&&"createTime"in e,t}function di(e){return af(e)}function af(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:y(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:y(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:y(e,"updateTime")?new Date(e.updateTime):void 0}}function sf(e){if(e!==void 0)return e===null?null:{id:e.id,projectId:e.projectId,externalRef:e.externalRef,provider:e.provider,clientId:e.clientId,scopes:e.scopes,createTime:e.createTime.toISOString(),updateTime:e.updateTime===void 0?void 0:e.updateTime.toISOString()}}const eb={Input:"input",Token:"token",Provider:"provider"};function tb(e){let t=!0;return t=t&&"value"in e,t=t&&"source"in e,t}function Ri(e){return cf(e)}function cf(e,t){return e==null?e:{value:e.value,source:e.source,displayName:y(e,"displayName")?e.displayName:void 0}}function xi(e){if(e!==void 0)return e===null?null:{value:e.value,source:e.source,displayName:e.displayName}}const nb={None:"none",ApiKey:"apiKey",Basic:"basic",Oauth2AuthorizationCode:"oauth2/authorizationCode",Oauth2AuthorizationCodePkce:"oauth2/authorizationCodePKCE",Oauth2ClientCredentials:"oauth2/clientCredentials",Oauth2Password:"oauth2/password"},rb={Created:"created",Working:"working",BadCredentials:"bad_credentials"};function ib(e){let t=!0;return t=t&&"id"in e,t=t&&"projectId"in e,t=t&&"provider"in e,t=t&&"group"in e,t=t&&"consumer"in e,t=t&&"createTime"in e,t=t&&"authScheme"in e,t=t&&"status"in e,t}function Nr(e){return uf(e)}function uf(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:y(e,"providerApp")?di(e.providerApp):void 0,group:Hs(e.group),consumer:Hp(e.consumer),providerWorkspaceRef:y(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerConsumerRef:y(e,"providerConsumerRef")?e.providerConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:y(e,"updateTime")?new Date(e.updateTime):void 0,authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:y(e,"oauth2AuthorizationCode")?nf(e.oauth2AuthorizationCode):void 0,apiKey:y(e,"apiKey")?e.apiKey:void 0,providerMetadata:y(e,"providerMetadata")?pe(e.providerMetadata,Ri):void 0}}function lf(e){if(e!==void 0)return e===null?null:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:sf(e.providerApp),group:Ws(e.group),consumer:zp(e.consumer),providerWorkspaceRef:e.providerWorkspaceRef,providerConsumerRef:e.providerConsumerRef,createTime:e.createTime.toISOString(),updateTime:e.updateTime===void 0?void 0:e.updateTime.toISOString(),authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:of(e.oauth2AuthorizationCode),apiKey:e.apiKey,providerMetadata:e.providerMetadata===void 0?void 0:pe(e.providerMetadata,xi)}}function ob(e){let t=!0;return t=t&&"username"in e,t=t&&"password"in e,t}function zs(e){return df(e)}function df(e,t){return e==null?e:{username:e.username,password:e.password}}function Gs(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function ab(e){let t=!0;return t=t&&"clientId"in e,t=t&&"clientSecret"in e,t}function Xs(e){return pf(e)}function pf(e,t){return e==null?e:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:y(e,"scopes")?e.scopes:void 0}}function Qs(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function sb(e){let t=!0;return t=t&&"username"in e,t=t&&"password"in e,t=t&&"clientId"in e,t=t&&"clientSecret"in e,t}function Ys(e){return ff(e)}function ff(e,t){return e==null?e:{username:e.username,password:e.password,clientId:e.clientId,clientSecret:e.clientSecret,scopes:y(e,"scopes")?e.scopes:void 0}}function Zs(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 cb(e){let t=!0;return t=t&&"token"in e,t}function mf(e){return hf(e)}function hf(e,t){return e==null?e:{token:e.token,expiresAt:y(e,"expiresAt")?new Date(e.expiresAt):void 0,issuedAt:y(e,"issuedAt")?new Date(e.issuedAt):void 0}}function gf(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 ub(e){let t=!0;return t=t&&"token"in e,t}function yf(e){return Of(e)}function Of(e,t){return e==null?e:{token:e.token,expiresAt:y(e,"expiresAt")?new Date(e.expiresAt):void 0,issuedAt:y(e,"issuedAt")?new Date(e.issuedAt):void 0}}function vf(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 lb(e){return!0}function ec(e){return If(e)}function If(e,t){return e==null?e:{accessToken:y(e,"accessToken")?mf(e.accessToken):void 0,refreshToken:y(e,"refreshToken")?yf(e.refreshToken):void 0,scopes:y(e,"scopes")?e.scopes:void 0}}function tc(e){if(e!==void 0)return e===null?null:{accessToken:gf(e.accessToken),refreshToken:vf(e.refreshToken),scopes:e.scopes}}function db(e){return!0}function Sf(e){return wf(e)}function wf(e,t){return e==null?e:{providerWorkspaceRef:y(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerMetadata:y(e,"providerMetadata")?pe(e.providerMetadata,Ri):void 0,groupName:y(e,"groupName")?e.groupName:void 0,groupRef:y(e,"groupRef")?e.groupRef:void 0,consumerName:y(e,"consumerName")?e.consumerName:void 0,consumerRef:y(e,"consumerRef")?e.consumerRef:void 0,provider:y(e,"provider")?e.provider:void 0,apiKey:y(e,"apiKey")?e.apiKey:void 0,basicAuth:y(e,"basicAuth")?zs(e.basicAuth):void 0,oauth2ClientCredentials:y(e,"oauth2ClientCredentials")?Xs(e.oauth2ClientCredentials):void 0,oauth2PasswordCredentials:y(e,"oauth2PasswordCredentials")?Ys(e.oauth2PasswordCredentials):void 0,oauth2AuthorizationCode:y(e,"oauth2AuthorizationCode")?ec(e.oauth2AuthorizationCode):void 0}}function bf(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:pe(e.providerMetadata,xi),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,basicAuth:Gs(e.basicAuth),oauth2ClientCredentials:Qs(e.oauth2ClientCredentials),oauth2PasswordCredentials:Zs(e.oauth2PasswordCredentials),oauth2AuthorizationCode:tc(e.oauth2AuthorizationCode)}}function pb(e){let t=!0;return t=t&&"url"in e,t}function Nf(e){return Cf(e)}function Cf(e,t){return e==null?e:{url:e.url}}function fb(e){if(e!==void 0)return e===null?null:{url:e.url}}function mb(e){let t=!0;return t=t&&"redirectUrl"in e,t}function hb(e){return Tf(e)}function Tf(e,t){return e==null?e:{redirectUrl:e.redirectUrl,timeout:y(e,"timeout")?e.timeout:void 0}}function Rf(e){if(e!==void 0)return e===null?null:{redirectUrl:e.redirectUrl,timeout:e.timeout}}function gb(e){let t=!0;return t=t&&"consumerRef"in e,t=t&&"consumerName"in e,t}function yb(e){return xf(e)}function xf(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName}}function Af(e){if(e!==void 0)return e===null?null:{consumerRef:e.consumerRef,consumerName:e.consumerName}}function Ob(e){return!0}function Ef(e){return Ff(e)}function Ff(e,t){return e==null?e:{url:y(e,"url")?e.url:void 0,headers:y(e,"headers")?e.headers:void 0}}function _f(e){if(e!==void 0)return e===null?null:{url:e.url,headers:e.headers}}function vb(e){let t=!0;return t=t&&"name"in e,t=t&&"type"in e,t=t&&"metadata"in e,t}function Ib(e){return Pf(e)}function Pf(e,t){return e==null?e:{name:e.name,type:e.type,metadata:Ef(e.metadata)}}function Df(e){if(e!==void 0)return e===null?null:{name:e.name,type:e.type,metadata:_f(e.metadata)}}const Sb={Always:"always"};function wb(e){return!0}function Mf(e){return Jf(e)}function Jf(e,t){return e==null?e:{enabled:y(e,"enabled")?e.enabled:void 0}}function kf(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function bb(e){let t=!0;return t=t&&"groupRef"in e,t=t&&"groupName"in e,t}function Nb(e){return qf(e)}function qf(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName}}function Kf(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,groupName:e.groupName}}function Cb(e){let t=!0;return t=t&&"content"in e,t}function Uf(e){return Lf(e)}function Lf(e,t){return e==null?e:{revisionId:y(e,"revisionId")?e.revisionId:void 0,createdBy:y(e,"createdBy")?e.createdBy:void 0,content:$s(e.content)}}function Bf(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:js(e.content)}}function Tb(e){let t=!0;return t=t&&"groupRef"in e,t=t&&"config"in e,t}function Rb(e){return Vf(e)}function Vf(e,t){return e==null?e:{groupRef:e.groupRef,connectionId:y(e,"connectionId")?e.connectionId:void 0,config:Uf(e.config)}}function $f(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:Bf(e.config)}}function xb(e){return!0}function jf(e){return Hf(e)}function Hf(e,t){return e==null?e:{enabled:y(e,"enabled")?e.enabled:void 0}}function Wf(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}const Ab={OnRequest:"onRequest",Auto:"auto"};function Eb(e){return!0}function zf(e){return Gf(e)}function Gf(e,t){return e==null?e:{mode:y(e,"mode")?e.mode:void 0,pageSize:y(e,"pageSize")?e.pageSize:void 0}}function Xf(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function Qf(e){let t=!0;return t=t&&"fieldName"in e,t}function Fb(e){return nc(e)}function nc(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:y(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:y(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Yf(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function rc(e){let t=!0;return t=t&&"mapToName"in e,t}function _b(e){return _o(e)}function _o(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:y(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:y(e,"default")?e.default:void 0,prompt:y(e,"prompt")?e.prompt:void 0}}function ic(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function Pa(e){return Zf(e)}function Zf(e,t){return e==null?e:{...nc(e),..._o(e)}}function Da(e){if(e!==void 0)return e===null?null:Qf(e)?Yf(e):rc(e)?ic(e):{}}const Pb={All:"all"};function oc(e){return em(e)}function em(e,t){return e}function Db(e){return e}function Mb(e){let t=!0;return t=t&&"objectName"in e,t=t&&"destination"in e,t=t&&"schedule"in e,t}function tm(e){return nm(e)}function nm(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:y(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:y(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:y(e,"requiredFields")?e.requiredFields.map(Pa):void 0,optionalFields:y(e,"optionalFields")?e.optionalFields.map(Pa):void 0,optionalFieldsAuto:y(e,"optionalFieldsAuto")?oc(e.optionalFieldsAuto):void 0,backfill:y(e,"backfill")?us(e.backfill):void 0,delivery:y(e,"delivery")?zf(e.delivery):void 0}}function rm(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(Da),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(Da),optionalFieldsAuto:e.optionalFieldsAuto,backfill:ls(e.backfill),delivery:Xf(e.delivery)}}function Jb(e){return!0}function im(e){return om(e)}function om(e,t){return e==null?e:{objects:y(e,"objects")?e.objects.map(tm):void 0}}function am(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(rm)}}const kb={Always:"always"};function qb(e){return!0}function sm(e){return cm(e)}function cm(e,t){return e==null?e:{enabled:y(e,"enabled")?e.enabled:void 0}}function um(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}const Kb={Always:"always"},Ub={All:"all"};function Lb(e){return!0}function lm(e){return dm(e)}function dm(e,t){return e==null?e:{enabled:y(e,"enabled")?e.enabled:void 0,watchFieldsAuto:y(e,"watchFieldsAuto")?e.watchFieldsAuto:void 0,requiredWatchFields:y(e,"requiredWatchFields")?e.requiredWatchFields:void 0}}function pm(e){if(e!==void 0)return e===null?null:{enabled:e.enabled,watchFieldsAuto:e.watchFieldsAuto,requiredWatchFields:e.requiredWatchFields}}function Bb(e){let t=!0;return t=t&&"objectName"in e,t=t&&"destination"in e,t}function fm(e){return mm(e)}function mm(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:y(e,"inheritFieldsAndMapping")?e.inheritFieldsAndMapping:void 0,createEvent:y(e,"createEvent")?Mf(e.createEvent):void 0,updateEvent:y(e,"updateEvent")?lm(e.updateEvent):void 0,deleteEvent:y(e,"deleteEvent")?sm(e.deleteEvent):void 0,associationChangeEvent:y(e,"associationChangeEvent")?hd(e.associationChangeEvent):void 0,otherEvents:y(e,"otherEvents")?e.otherEvents:void 0}}function hm(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,inheritFieldsAndMapping:e.inheritFieldsAndMapping,createEvent:kf(e.createEvent),updateEvent:pm(e.updateEvent),deleteEvent:um(e.deleteEvent),associationChangeEvent:yd(e.associationChangeEvent),otherEvents:e.otherEvents}}function Vb(e){return!0}function gm(e){return ym(e)}function ym(e,t){return e==null?e:{objects:y(e,"objects")?e.objects.map(fm):void 0}}function Om(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(hm)}}function $b(e){return!0}function ac(e){return vm(e)}function vm(e,t){return e==null?e:{allowAnyFields:y(e,"allowAnyFields")?e.allowAnyFields:void 0}}function sc(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function jb(e){let t=!0;return t=t&&"objectName"in e,t}function Im(e){return Sm(e)}function Sm(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:y(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:y(e,"valueDefaults")?ac(e.valueDefaults):void 0}}function wm(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:sc(e.valueDefaults)}}function Hb(e){return!0}function bm(e){return Nm(e)}function Nm(e,t){return e==null?e:{objects:y(e,"objects")?e.objects.map(Im):void 0}}function Cm(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(wm)}}function Wb(e){let t=!0;return t=t&&"name"in e,t=t&&"provider"in e,t}function cc(e){return Tm(e)}function Tm(e,t){return e==null?e:{name:e.name,displayName:y(e,"displayName")?e.displayName:void 0,provider:e.provider,read:y(e,"read")?im(e.read):void 0,write:y(e,"write")?bm(e.write):void 0,proxy:y(e,"proxy")?jf(e.proxy):void 0,subscribe:y(e,"subscribe")?gm(e.subscribe):void 0}}function uc(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:am(e.read),write:Cm(e.write),proxy:Wf(e.proxy),subscribe:Om(e.subscribe)}}function zb(e){let t=!0;return t=t&&"specVersion"in e,t=t&&"content"in e,t}function Rm(e){return xm(e)}function xm(e,t){return e==null?e:{specVersion:e.specVersion,content:cc(e.content)}}function Am(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:uc(e.content)}}function Gb(e){let t=!0;return t=t&&"name"in e,t=t&&"provider"in e,t=t&&"latestRevision"in e,t}function Xb(e){return Em(e)}function Em(e,t){return e==null?e:{name:e.name,provider:e.provider,latestRevision:Rm(e.latestRevision)}}function Fm(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:Am(e.latestRevision)}}function Qb(e){let t=!0;return t=t&&"email"in e,t}function Yb(e){return _m(e)}function _m(e,t){return e==null?e:{email:e.email}}function Pm(e){if(e!==void 0)return e===null?null:{email:e.email}}function Zb(e){let t=!0;return t=t&&"label"in e,t}function eN(e){return Dm(e)}function Dm(e,t){return e==null?e:{label:e.label}}function Mm(e){if(e!==void 0)return e===null?null:{label:e.label}}function tN(e){let t=!0;return t=t&&"appName"in e,t=t&&"name"in e,t=t&&"orgId"in e,t}function nN(e){return Jm(e)}function Jm(e,t){return e==null?e:{appName:e.appName,name:e.name,orgId:e.orgId}}function km(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function rN(e){let t=!0;return t=t&&"provider"in e,t=t&&"clientId"in e,t=t&&"clientSecret"in e,t}function iN(e){return qm(e)}function qm(e,t){return e==null?e:{externalRef:y(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,clientSecret:e.clientSecret,scopes:y(e,"scopes")?e.scopes:void 0}}function Km(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 oN(e){return!0}function aN(e){return Um(e)}function Um(e,t){return e==null?e:{sourceZipUrl:y(e,"sourceZipUrl")?e.sourceZipUrl:void 0,sourceYaml:y(e,"sourceYaml")?e.sourceYaml:void 0}}function Lm(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function sN(e){return!0}function lc(e){return Bm(e)}function Bm(e,t){return e==null?e:{url:y(e,"url")?e.url:void 0,headers:y(e,"headers")?e.headers:void 0}}function dc(e){if(e!==void 0)return e===null?null:{url:e.url,headers:e.headers}}function cN(e){let t=!0;return t=t&&"id"in e,t=t&&"name"in e,t=t&&"type"in e,t=t&&"metadata"in e,t=t&&"createTime"in e,t}function ci(e){return Vm(e)}function Vm(e,t){return e==null?e:{id:e.id,name:e.name,type:e.type,metadata:lc(e.metadata),createTime:new Date(e.createTime),updateTime:y(e,"updateTime")?new Date(e.updateTime):void 0}}function uN(e){if(e!==void 0)return e===null?null:{id:e.id,name:e.name,type:e.type,metadata:dc(e.metadata),createTime:e.createTime.toISOString(),updateTime:e.updateTime===void 0?void 0:e.updateTime.toISOString()}}function lN(e){let t=!0;return t=t&&"value"in e,t=t&&"displayValue"in e,t}function $m(e){return jm(e)}function jm(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function Hm(e){if(e!==void 0)return e===null?null:{value:e.value,displayValue:e.displayValue}}const dN={String:"string",Boolean:"boolean",SingleSelect:"singleSelect",MultiSelect:"multiSelect",Date:"date",Datetime:"datetime",Int:"int",Float:"float",Other:"other"};function pN(e){let t=!0;return t=t&&"fieldName"in e,t=t&&"displayName"in e,t}function pc(e){return Wm(e)}function Wm(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,valueType:y(e,"valueType")?e.valueType:void 0,providerType:y(e,"providerType")?e.providerType:void 0,readOnly:y(e,"readOnly")?e.readOnly:void 0,values:y(e,"values")?e.values.map($m):void 0}}function fc(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,displayName:e.displayName,valueType:e.valueType,providerType:e.providerType,readOnly:e.readOnly,values:e.values===void 0?void 0:e.values.map(Hm)}}function fN(e){let t=!0;return t=t&&"groupRef"in e,t=t&&"consumerRef"in e,t=t&&"provider"in e,t}function mN(e){return zm(e)}function zm(e,t){return e==null?e:{providerWorkspaceRef:y(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerMetadata:y(e,"providerMetadata")?pe(e.providerMetadata,Ri):void 0,groupName:y(e,"groupName")?e.groupName:void 0,groupRef:e.groupRef,consumerName:y(e,"consumerName")?e.consumerName:void 0,consumerRef:e.consumerRef,provider:e.provider,apiKey:y(e,"apiKey")?e.apiKey:void 0,basicAuth:y(e,"basicAuth")?zs(e.basicAuth):void 0,oauth2ClientCredentials:y(e,"oauth2ClientCredentials")?Xs(e.oauth2ClientCredentials):void 0,oauth2PasswordCredentials:y(e,"oauth2PasswordCredentials")?Ys(e.oauth2PasswordCredentials):void 0,oauth2AuthorizationCode:y(e,"oauth2AuthorizationCode")?ec(e.oauth2AuthorizationCode):void 0}}function Gm(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:pe(e.providerMetadata,xi),groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,basicAuth:Gs(e.basicAuth),oauth2ClientCredentials:Qs(e.oauth2ClientCredentials),oauth2PasswordCredentials:Zs(e.oauth2PasswordCredentials),oauth2AuthorizationCode:tc(e.oauth2AuthorizationCode)}}function hN(e){return!0}function Xm(e){return Qm(e)}function Qm(e,t){return e==null?e:{enabled:y(e,"enabled")?e.enabled:void 0}}function Ym(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Zm(e){let t=!0;return t=t&&"fieldName"in e,t=t&&"displayName"in e,t}function gN(e){return mc(e)}function mc(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,mapToName:y(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:y(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function eh(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,displayName:e.displayName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function ro(e){return th(e)}function th(e,t){return e==null?e:{...mc(e),..._o(e)}}function io(e){if(e!==void 0)return e===null?null:Zm(e)?eh(e):rc(e)?ic(e):{}}function yN(e){let t=!0;return t=t&&"objectName"in e,t=t&&"displayName"in e,t=t&&"destination"in e,t=t&&"schedule"in e,t}function nh(e){return rh(e)}function rh(e,t){return e==null?e:{error:y(e,"error")?e.error:void 0,objectName:e.objectName,displayName:e.displayName,mapToName:y(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:y(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:y(e,"requiredFields")?e.requiredFields.map(ro):void 0,optionalFields:y(e,"optionalFields")?e.optionalFields.map(ro):void 0,optionalFieldsAuto:y(e,"optionalFieldsAuto")?oc(e.optionalFieldsAuto):void 0,allFields:y(e,"allFields")?e.allFields.map(ro):void 0,allFieldsMetadata:y(e,"allFieldsMetadata")?pe(e.allFieldsMetadata,pc):void 0,backfill:y(e,"backfill")?us(e.backfill):void 0}}function ih(e){if(e!==void 0)return e===null?null:{error:e.error,objectName:e.objectName,displayName:e.displayName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,destination:e.destination,schedule:e.schedule,requiredFields:e.requiredFields===void 0?void 0:e.requiredFields.map(io),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(io),optionalFieldsAuto:e.optionalFieldsAuto,allFields:e.allFields===void 0?void 0:e.allFields.map(io),allFieldsMetadata:e.allFieldsMetadata===void 0?void 0:pe(e.allFieldsMetadata,fc),backfill:ls(e.backfill)}}function ON(e){return!0}function oh(e){return ah(e)}function ah(e,t){return e==null?e:{objects:y(e,"objects")?e.objects.map(nh):void 0}}function sh(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(ih)}}function vN(e){let t=!0;return t=t&&"objectName"in e,t=t&&"displayName"in e,t}function ch(e){return uh(e)}function uh(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:y(e,"valueDefaults")?ac(e.valueDefaults):void 0}}function lh(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,displayName:e.displayName,valueDefaults:sc(e.valueDefaults)}}function IN(e){return!0}function dh(e){return ph(e)}function ph(e,t){return e==null?e:{objects:y(e,"objects")?e.objects.map(ch):void 0}}function fh(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(lh)}}function SN(e){let t=!0;return t=t&&"name"in e,t=t&&"provider"in e,t}function mh(e){return hh(e)}function hh(e,t){return e==null?e:{name:e.name,displayName:y(e,"displayName")?e.displayName:void 0,provider:e.provider,read:y(e,"read")?oh(e.read):void 0,write:y(e,"write")?dh(e.write):void 0,proxy:y(e,"proxy")?Xm(e.proxy):void 0}}function gh(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:sh(e.read),write:fh(e.write),proxy:Ym(e.proxy)}}function wN(e){let t=!0;return t=t&&"id"in e,t=t&&"specVersion"in e,t=t&&"createTime"in e,t=t&&"content"in e,t}function yh(e){return Oh(e)}function Oh(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:mh(e.content)}}function bN(e){if(e!==void 0)return e===null?null:{id:e.id,specVersion:e.specVersion,createTime:e.createTime.toISOString(),content:gh(e.content)}}const NN={Body:"body",Header:"header",Path:"path",Query:"query"};function CN(e){return!0}function vh(e){return Ih(e)}function Ih(e,t){return e==null?e:{_in:y(e,"in")?e.in:void 0,name:y(e,"name")?e.name:void 0,value:y(e,"value")?e.value:void 0,type:y(e,"type")?e.type:void 0,href:y(e,"href")?e.href:void 0,title:y(e,"title")?e.title:void 0,status:y(e,"status")?e.status:void 0,detail:y(e,"detail")?e.detail:void 0,instance:y(e,"instance")?e.instance:void 0}}function Sh(e){if(e!==void 0)return e===null?null:{in:e._in,name:e.name,value:e.value,type:e.type,href:e.href,title:e.title,status:e.status,detail:e.detail,instance:e.instance}}function TN(e){return!0}function RN(e){return wh(e)}function wh(e,t){return e==null?e:{issues:y(e,"issues")?e.issues.map(vh):void 0,type:y(e,"type")?e.type:void 0,href:y(e,"href")?e.href:void 0,title:y(e,"title")?e.title:void 0,status:y(e,"status")?e.status:void 0,detail:y(e,"detail")?e.detail:void 0,instance:y(e,"instance")?e.instance:void 0}}function xN(e){if(e!==void 0)return e===null?null:{issues:e.issues===void 0?void 0:e.issues.map(Sh),type:e.type,href:e.href,title:e.title,status:e.status,detail:e.detail,instance:e.instance}}function AN(e){let t=!0;return t=t&&"id"in e,t=t&&"projectId"in e,t=t&&"integrationId"in e,t=t&&"healthStatus"in e,t=t&&"connection"in e,t=t&&"createTime"in e,t=t&&"createdBy"in e,t=t&&"config"in e,t}function ui(e){return bh(e)}function bh(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:y(e,"group")?Hs(e.group):void 0,healthStatus:e.healthStatus,connection:Nr(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:y(e,"updateTime")?new Date(e.updateTime):void 0,config:Bp(e.config)}}function EN(e){if(e!==void 0)return e===null?null:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:Ws(e.group),healthStatus:e.healthStatus,connection:lf(e.connection),createTime:e.createTime.toISOString(),createdBy:e.createdBy,updateTime:e.updateTime===void 0?void 0:e.updateTime.toISOString(),config:$p(e.config)}}function FN(e){let t=!0;return t=t&&"id"in e,t=t&&"specVersion"in e,t=t&&"createTime"in e,t=t&&"content"in e,t}function Nh(e){return Ch(e)}function Ch(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:cc(e.content)}}function Th(e){if(e!==void 0)return e===null?null:{id:e.id,specVersion:e.specVersion,createTime:e.createTime.toISOString(),content:uc(e.content)}}function _N(e){let t=!0;return t=t&&"id"in e,t=t&&"projectId"in e,t=t&&"name"in e,t=t&&"provider"in e,t=t&&"createTime"in e,t=t&&"latestRevision"in e,t}function Ma(e){return Rh(e)}function Rh(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:y(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:Nh(e.latestRevision)}}function PN(e){if(e!==void 0)return e===null?null:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:e.createTime.toISOString(),updateTime:e.updateTime===void 0?void 0:e.updateTime.toISOString(),latestRevision:Th(e.latestRevision)}}const DN={Org:"org"},MN={Pending:"pending",Accepted:"accepted",Revoked:"revoked",Expired:"expired"};function JN(e){let t=!0;return t=t&&"id"in e,t=t&&"invitedEmail"in e,t=t&&"parentType"in e,t=t&&"parentId"in e,t=t&&"status"in e,t=t&&"createTime"in e,t}function oo(e){return xh(e)}function xh(e,t){return e==null?e:{id:e.id,invitedEmail:e.invitedEmail,parentType:e.parentType,parentId:e.parentId,status:e.status,createTime:new Date(e.createTime),updateTime:y(e,"updateTime")?new Date(e.updateTime):void 0}}function kN(e){if(e!==void 0)return e===null?null:{id:e.id,invitedEmail:e.invitedEmail,parentType:e.parentType,parentId:e.parentId,status:e.status,createTime:e.createTime.toISOString(),updateTime:e.updateTime===void 0?void 0:e.updateTime.toISOString()}}function qN(e){let t=!0;return t=t&&"projectId"in e,t=t&&"integrationId"in e,t=t&&"configId"in e,t=t&&"actionType"in e,t=t&&"id"in e,t=t&&"installationId"in e,t=t&&"status"in e,t}function hc(e){return Ah(e)}function Ah(e,t){return e==null?e:{projectId:e.projectId,integrationId:e.integrationId,configId:e.configId,actionType:e.actionType,id:e.id,installationId:e.installationId,status:e.status,result:y(e,"result")?e.result:void 0,metadata:y(e,"metadata")?e.metadata:void 0,createTime:y(e,"createTime")?new Date(e.createTime):void 0}}function Eh(e){if(e!==void 0)return e===null?null:{projectId:e.projectId,integrationId:e.integrationId,configId:e.configId,actionType:e.actionType,id:e.id,installationId:e.installationId,status:e.status,result:e.result,metadata:e.metadata,createTime:e.createTime===void 0?void 0:e.createTime.toISOString()}}function KN(e){let t=!0;return t=t&&"done"in e,t}function Fh(e){return _h(e)}function _h(e,t){return e==null?e:{done:e.done,nextPageToken:y(e,"nextPageToken")?e.nextPageToken:void 0}}function Ph(e){if(e!==void 0)return e===null?null:{done:e.done,nextPageToken:e.nextPageToken}}function UN(e){let t=!0;return t=t&&"results"in e,t=t&&"pagination"in e,t}function Dh(e){return Mh(e)}function Mh(e,t){return e==null?e:{results:e.results.map(hc),pagination:Fh(e.pagination)}}function LN(e){if(e!==void 0)return e===null?null:{results:e.results.map(Eh),pagination:Ph(e.pagination)}}function BN(e){let t=!0;return t=t&&"msg"in e,t}function Jh(e){return kh(e)}function kh(e,t){return e==null?e:{msg:e.msg,error:y(e,"error")?e.error:void 0,operationId:y(e,"operation_id")?e.operation_id:void 0}}function qh(e){if(e!==void 0)return e===null?null:{msg:e.msg,error:e.error,operation_id:e.operationId}}function VN(e){let t=!0;return t=t&&"timestamp"in e,t=t&&"message"in e,t=t&&"severity"in e,t}function Kh(e){return Uh(e)}function Uh(e,t){return e==null?e:{timestamp:e.timestamp,message:Jh(e.message),severity:e.severity}}function $N(e){if(e!==void 0)return e===null?null:{timestamp:e.timestamp,message:qh(e.message),severity:e.severity}}function jN(e){return!0}function Lh(e){return Bh(e)}function Bh(e,t){return e==null?e:{iconURL:y(e,"iconURL")?e.iconURL:void 0,logoURL:y(e,"logoURL")?e.logoURL:void 0}}function Vh(e){if(e!==void 0)return e===null?null:{iconURL:e.iconURL,logoURL:e.logoURL}}function HN(e){return!0}function $h(e){return jh(e)}function jh(e,t){return e==null?e:{iconURL:y(e,"iconURL")?e.iconURL:void 0,logoURL:y(e,"logoURL")?e.logoURL:void 0}}function Hh(e){if(e!==void 0)return e===null?null:{iconURL:e.iconURL,logoURL:e.logoURL}}function WN(e){return!0}function Wh(e){return zh(e)}function zh(e,t){return e==null?e:{regular:y(e,"regular")?$h(e.regular):void 0,darkMode:y(e,"darkMode")?Lh(e.darkMode):void 0}}function Gh(e){if(e!==void 0)return e===null?null:{regular:Hh(e.regular),darkMode:Vh(e.darkMode)}}function zN(e){let t=!0;return t=t&&"name"in e,t}function Xh(e){return Qh(e)}function Qh(e,t){return e==null?e:{name:e.name,displayName:y(e,"displayName")?e.displayName:void 0,docsURL:y(e,"docsURL")?e.docsURL:void 0}}function Yh(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,docsURL:e.docsURL}}function GN(e){let t=!0;return t=t&&"name"in e,t}function Zh(e){return eg(e)}function eg(e,t){return e==null?e:{name:e.name}}function tg(e){if(e!==void 0)return e===null?null:{name:e.name}}function XN(e){return!0}function ng(e){return rg(e)}function rg(e,t){return e==null?e:{create:y(e,"create")?e.create:void 0,update:y(e,"update")?e.update:void 0,_delete:y(e,"delete")?e.delete:void 0,passThrough:y(e,"passThrough")?e.passThrough:void 0}}function ig(e){if(e!==void 0)return e===null?null:{create:e.create,update:e.update,delete:e._delete,passThrough:e.passThrough}}function QN(e){let t=!0;return t=t&&"bulkWrite"in e,t=t&&"proxy"in e,t=t&&"read"in e,t=t&&"subscribe"in e,t=t&&"write"in e,t}function gc(e){return og(e)}function og(e,t){return e==null?e:{bulkWrite:_p(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write,subscribeSupport:y(e,"subscribeSupport")?ng(e.subscribeSupport):void 0}}function yc(e){if(e!==void 0)return e===null?null:{bulkWrite:Dp(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write,subscribeSupport:ig(e.subscribeSupport)}}function YN(e){let t=!0;return t=t&&"displayName"in e,t=t&&"baseURL"in e,t=t&&"support"in e,t}function ag(e){return sg(e)}function sg(e,t){return e==null?e:{displayName:e.displayName,baseURL:e.baseURL,support:gc(e.support)}}function cg(e){if(e!==void 0)return e===null?null:{displayName:e.displayName,baseURL:e.baseURL,support:yc(e.support)}}function ZN(e){let t=!0;return t=t&&"name"in e,t=t&&"displayName"in e,t=t&&"path"in e,t}function ug(e){return lg(e)}function lg(e,t){return e==null?e:{name:e.name,displayName:e.displayName,path:e.path,capture:y(e,"capture")?e.capture:void 0}}function dg(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,path:e.path,capture:e.capture}}function eC(e){return!0}function pg(e){return fg(e)}function fg(e,t){return e==null?e:{workspaceRefField:y(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:y(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:y(e,"scopesField")?e.scopesField:void 0,otherFields:y(e,"otherFields")?e.otherFields.map(ug):void 0}}function mg(e){if(e!==void 0)return e===null?null:{workspaceRefField:e.workspaceRefField,consumerRefField:e.consumerRefField,scopesField:e.scopesField,otherFields:e.otherFields===void 0?void 0:e.otherFields.map(dg)}}const ao={AuthorizationCode:"authorizationCode",AuthorizationCodePkce:"authorizationCodePKCE",ClientCredentials:"clientCredentials",Password:"password"};function tC(e){let t=!0;return t=t&&"grantType"in e,t=t&&"tokenURL"in e,t=t&&"explicitScopesRequired"in e,t=t&&"explicitWorkspaceRequired"in e,t=t&&"tokenMetadataFields"in e,t}function hg(e){return gg(e)}function gg(e,t){return e==null?e:{grantType:e.grantType,authURL:y(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:y(e,"audience")?e.audience:void 0,tokenMetadataFields:pg(e.tokenMetadataFields),docsURL:y(e,"docsURL")?e.docsURL:void 0,authURLParams:y(e,"authURLParams")?e.authURLParams:void 0}}function yg(e){if(e!==void 0)return e===null?null:{grantType:e.grantType,authURL:e.authURL,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:e.audience,tokenMetadataFields:mg(e.tokenMetadataFields),docsURL:e.docsURL,authURLParams:e.authURLParams}}function nC(e){let t=!0;return t=t&&"projectId"in e,t=t&&"groupRef"in e,t=t&&"consumerRef"in e,t=t&&"provider"in e,t}function rC(e){return Og(e)}function Og(e,t){return e==null?e:{providerWorkspaceRef:y(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerMetadata:y(e,"providerMetadata")?pe(e.providerMetadata,Ri):void 0,projectId:e.projectId,groupRef:e.groupRef,groupName:y(e,"groupName")?e.groupName:void 0,consumerRef:e.consumerRef,consumerName:y(e,"consumerName")?e.consumerName:void 0,providerAppId:y(e,"providerAppId")?e.providerAppId:void 0,provider:e.provider,enableCSRFProtection:y(e,"enableCSRFProtection")?e.enableCSRFProtection:void 0}}function vg(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,providerMetadata:e.providerMetadata===void 0?void 0:pe(e.providerMetadata,xi),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 iC(e){let t=!0;return t=t&&"name"in e,t=t&&"fields"in e,t}function Ja(e){return Ig(e)}function Ig(e,t){return e==null?e:{name:e.name,displayName:y(e,"displayName")?e.displayName:void 0,mappedObjectName:y(e,"mappedObjectName")?e.mappedObjectName:void 0,fields:pe(e.fields,pc)}}function oC(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,mappedObjectName:e.mappedObjectName,fields:pe(e.fields,fc)}}function aC(e){return!0}function Sg(e){return wg(e)}function wg(e,t){return e==null?e:{label:y(e,"label")?e.label:void 0,active:y(e,"active")?e.active:void 0,scopes:y(e,"scopes")?e.scopes:void 0}}function bg(e){if(e!==void 0)return e===null?null:{label:e.label,active:e.active,scopes:e.scopes}}function sC(e){let t=!0;return t=t&&"updateMask"in e,t=t&&"apiKey"in e,t}function cC(e){return Ng(e)}function Ng(e,t){return e==null?e:{updateMask:e.updateMask,apiKey:Sg(e.apiKey)}}function Cg(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,apiKey:bg(e.apiKey)}}function uC(e){return!0}function lC(e){return Tg(e)}function Tg(e,t){return e==null?e:{type:y(e,"type")?e.type:void 0,href:y(e,"href")?e.href:void 0,title:y(e,"title")?e.title:void 0,status:y(e,"status")?e.status:void 0,detail:y(e,"detail")?e.detail:void 0,instance:y(e,"instance")?e.instance:void 0}}function dC(e){if(e!==void 0)return e===null?null:{type:e.type,href:e.href,title:e.title,status:e.status,detail:e.detail,instance:e.instance}}function pC(e){return!0}function Rg(e){return xg(e)}function xg(e,t){return e==null?e:{input:y(e,"input")?e.input.map(Xh):void 0,postAuthentication:y(e,"postAuthentication")?e.postAuthentication.map(Zh):void 0}}function Ag(e){if(e!==void 0)return e===null?null:{input:e.input===void 0?void 0:e.input.map(Yh),postAuthentication:e.postAuthentication===void 0?void 0:e.postAuthentication.map(tg)}}const fC={Integration:"integration",Installation:"installation"},mC={Integration:"integration",Installation:"installation"},hC={ProviderApp:"providerApp",Integration:"integration",Installation:"installation"};function gC(e){let t=!0;return t=t&&"subscriptionScope"in e,t=t&&"targetURLScope"in e,t=t&&"registrationTiming"in e,t}function Eg(e){return Fg(e)}function Fg(e,t){return e==null?e:{subscriptionScope:e.subscriptionScope,targetURLScope:e.targetURLScope,registrationTiming:e.registrationTiming}}function _g(e){if(e!==void 0)return e===null?null:{subscriptionScope:e.subscriptionScope,targetURLScope:e.targetURLScope,registrationTiming:e.registrationTiming}}function yC(e){let t=!0;return t=t&&"name"in e,t=t&&"authType"in e,t=t&&"baseURL"in e,t=t&&"defaultModule"in e,t=t&&"support"in e,t=t&&"providerOpts"in e,t}function ka(e){return Pg(e)}function Pg(e,t){return e==null?e:{name:e.name,authType:Sd(e.authType),baseURL:e.baseURL,defaultModule:e.defaultModule,oauth2Opts:y(e,"oauth2Opts")?hg(e.oauth2Opts):void 0,apiKeyOpts:y(e,"apiKeyOpts")?ud(e.apiKeyOpts):void 0,basicOpts:y(e,"basicOpts")?ap(e.basicOpts):void 0,support:gc(e.support),providerOpts:e.providerOpts,authHealthCheck:y(e,"authHealthCheck")?Od(e.authHealthCheck):void 0,displayName:y(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:y(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:y(e,"media")?Wh(e.media):void 0,labels:y(e,"labels")?e.labels:void 0,subscribeOpts:y(e,"subscribeOpts")?Eg(e.subscribeOpts):void 0,modules:y(e,"modules")?pe(e.modules,ag):void 0,metadata:y(e,"metadata")?Rg(e.metadata):void 0}}function OC(e){if(e!==void 0)return e===null?null:{name:e.name,authType:e.authType,baseURL:e.baseURL,defaultModule:e.defaultModule,oauth2Opts:yg(e.oauth2Opts),apiKeyOpts:dd(e.apiKeyOpts),basicOpts:cp(e.basicOpts),support:yc(e.support),providerOpts:e.providerOpts,authHealthCheck:Id(e.authHealthCheck),displayName:e.displayName,postAuthInfoNeeded:e.postAuthInfoNeeded,media:Gh(e.media),labels:e.labels,subscribeOpts:_g(e.subscribeOpts),modules:e.modules===void 0?void 0:pe(e.modules,cg),metadata:Ag(e.metadata)}}function vC(e){let t=!0;return t=t&&"objects"in e,t}function IC(e){return Dg(e)}function Dg(e,t){return e==null?e:{objects:pe(e.objects,_s)}}function SC(e){if(e!==void 0)return e===null?null:{objects:pe(e.objects,Ps)}}function wC(e){let t=!0;return t=t&&"url"in e,t=t&&"bucket"in e,t=t&&"path"in e,t}function Mg(e){return Jg(e)}function Jg(e,t){return e==null?e:{url:e.url,bucket:e.bucket,path:e.path}}function bC(e){if(e!==void 0)return e===null?null:{url:e.url,bucket:e.bucket,path:e.path}}function NC(e){let t=!0;return t=t&&"objects"in e,t}function CC(e){return kg(e)}function kg(e,t){return e==null?e:{objects:pe(e.objects,Js)}}function TC(e){if(e!==void 0)return e===null?null:{objects:pe(e.objects,ks)}}function RC(e){let t=!0;return t=t&&"updateMask"in e,t=t&&"connection"in e,t}function xC(e){return qg(e)}function qg(e,t){return e==null?e:{updateMask:e.updateMask,connection:Sf(e.connection)}}function Kg(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,connection:bf(e.connection)}}function AC(e){return!0}function Ug(e){return Lg(e)}function Lg(e,t){return e==null?e:{name:y(e,"name")?e.name:void 0,metadata:y(e,"metadata")?lc(e.metadata):void 0}}function Bg(e){if(e!==void 0)return e===null?null:{name:e.name,metadata:dc(e.metadata)}}function EC(e){let t=!0;return t=t&&"updateMask"in e,t=t&&"destination"in e,t}function FC(e){return Vg(e)}function Vg(e,t){return e==null?e:{updateMask:e.updateMask,destination:Ug(e.destination)}}function $g(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,destination:Bg(e.destination)}}function _C(e){return!0}function jg(e){return Hg(e)}function Hg(e,t){return e==null?e:{provider:y(e,"provider")?e.provider:void 0,read:y(e,"read")?ms(e.read):void 0,write:y(e,"write")?bs(e.write):void 0,proxy:y(e,"proxy")?Eo(e.proxy):void 0}}function Wg(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:hs(e.read),write:Ns(e.write),proxy:Fo(e.proxy)}}function PC(e){return!0}function zg(e){return Gg(e)}function Gg(e,t){return e==null?e:{revisionId:y(e,"revisionId")?e.revisionId:void 0,createdBy:y(e,"createdBy")?e.createdBy:void 0,content:y(e,"content")?jg(e.content):void 0}}function Xg(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Wg(e.content)}}function DC(e){return!0}function Qg(e){return Yg(e)}function Yg(e,t){return e==null?e:{connectionId:y(e,"connectionId")?e.connectionId:void 0,config:y(e,"config")?zg(e.config):void 0}}function Zg(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:Xg(e.config)}}function MC(e){let t=!0;return t=t&&"updateMask"in e,t=t&&"installation"in e,t}function JC(e){return ey(e)}function ey(e,t){return e==null?e:{updateMask:e.updateMask,installation:Qg(e.installation)}}function ty(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:Zg(e.installation)}}function kC(e){return!0}function ny(e){return ry(e)}function ry(e,t){return e==null?e:{label:y(e,"label")?e.label:void 0}}function iy(e){if(e!==void 0)return e===null?null:{label:e.label}}function qC(e){let t=!0;return t=t&&"updateMask"in e,t=t&&"org"in e,t}function KC(e){return oy(e)}function oy(e,t){return e==null?e:{updateMask:e.updateMask,org:ny(e.org)}}function ay(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,org:iy(e.org)}}function UC(e){return!0}function sy(e){return cy(e)}function cy(e,t){return e==null?e:{appName:y(e,"appName")?e.appName:void 0,name:y(e,"name")?e.name:void 0}}function uy(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function LC(e){let t=!0;return t=t&&"updateMask"in e,t=t&&"project"in e,t}function BC(e){return ly(e)}function ly(e,t){return e==null?e:{updateMask:e.updateMask,project:sy(e.project)}}function dy(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:uy(e.project)}}function VC(e){return!0}function py(e){return fy(e)}function fy(e,t){return e==null?e:{externalRef:y(e,"externalRef")?e.externalRef:void 0,provider:y(e,"provider")?e.provider:void 0,clientId:y(e,"clientId")?e.clientId:void 0,clientSecret:y(e,"clientSecret")?e.clientSecret:void 0,scopes:y(e,"scopes")?e.scopes:void 0}}function my(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 $C(e){let t=!0;return t=t&&"updateMask"in e,t=t&&"providerApp"in e,t}function jC(e){return hy(e)}function hy(e,t){return e==null?e:{updateMask:e.updateMask,providerApp:py(e.providerApp)}}function gy(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:my(e.providerApp)}}function HC(e){return!0}function WC(e){return yy(e)}function yy(e,t){return e==null?e:{objects:y(e,"objects")?pe(e.objects,Us):void 0}}function zC(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:pe(e.objects,Ls)}}class GC extends Le{async createApiKeyRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createApiKey.");if(t.apiKey===null||t.apiKey===void 0)throw new P("apiKey","Required parameter requestParameters.apiKey was null or undefined when calling createApiKey.");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}/api-keys".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:fd(t.apiKey)},n);return new ue(i,a=>si(a))}async createApiKey(t,n){return await(await this.createApiKeyRaw(t,n)).value()}async deleteApiKeyRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteApiKey.");if(t.apiKey===null||t.apiKey===void 0)throw new P("apiKey","Required parameter requestParameters.apiKey was null or undefined when calling deleteApiKey.");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}/api-keys/{apiKey}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{apiKey}",encodeURIComponent(String(t.apiKey))),method:"DELETE",headers:o,query:r},n);return new Tt(i)}async deleteApiKey(t,n){await this.deleteApiKeyRaw(t,n)}async getApiKeyRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getApiKey.");if(t.apiKey===null||t.apiKey===void 0)throw new P("apiKey","Required parameter requestParameters.apiKey was null or undefined when calling getApiKey.");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}/api-keys/{apiKey}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{apiKey}",encodeURIComponent(String(t.apiKey))),method:"GET",headers:o,query:r},n);return new ue(i,a=>si(a))}async getApiKey(t,n){return await(await this.getApiKeyRaw(t,n)).value()}async listApiKeysRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listApiKeys.");const r={};t.active!==void 0&&(r.active=t.active);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}/api-keys".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new ue(i,a=>a.map(si))}async listApiKeys(t,n){return await(await this.listApiKeysRaw(t,n)).value()}async updateApiKeyRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateApiKey.");if(t.apiKey===null||t.apiKey===void 0)throw new P("apiKey","Required parameter requestParameters.apiKey was null or undefined when calling updateApiKey.");if(t.patchApiKeyRequest===null||t.patchApiKeyRequest===void 0)throw new P("patchApiKeyRequest","Required parameter requestParameters.patchApiKeyRequest was null or undefined when calling updateApiKey.");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}/api-keys/{apiKey}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{apiKey}",encodeURIComponent(String(t.apiKey))),method:"PATCH",headers:o,query:r,body:Cg(t.patchApiKeyRequest)},n);return new ue(i,a=>si(a))}async updateApiKey(t,n){return await(await this.updateApiKeyRaw(t,n)).value()}}class XC extends Le{async createBillingAccountSessionRaw(t,n){if(t.billingAccountId===null||t.billingAccountId===void 0)throw new P("billingAccountId","Required parameter requestParameters.billingAccountId was null or undefined when calling createBillingAccountSession.");if(t.createBillingAccountSessionRequest===null||t.createBillingAccountSessionRequest===void 0)throw new P("createBillingAccountSessionRequest","Required parameter requestParameters.createBillingAccountSessionRequest was null or undefined when calling createBillingAccountSession.");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:"/billingAccounts/{billingAccountId}/portalSession".replace("{billingAccountId}",encodeURIComponent(String(t.billingAccountId))),method:"POST",headers:o,query:r,body:Rf(t.createBillingAccountSessionRequest)},n);return new ue(i,a=>Nf(a))}async createBillingAccountSession(t,n){return await(await this.createBillingAccountSessionRaw(t,n)).value()}async getOrgBillingAccountRaw(t,n){if(t.orgId===null||t.orgId===void 0)throw new P("orgId","Required parameter requestParameters.orgId was null or undefined when calling getOrgBillingAccount.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/orgs/{orgId}/billingAccount".replace("{orgId}",encodeURIComponent(String(t.orgId))),method:"GET",headers:o,query:r},n);return new ue(i,a=>dp(a))}async getOrgBillingAccount(t,n){return await(await this.getOrgBillingAccountRaw(t,n)).value()}}class Oy extends Le{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new P("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 Tt(i)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new P("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:Gm(t.generateConnectionParams)},n);return new ue(i,a=>Nr(a))}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 P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new P("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 ue(i,a=>Nr(a))}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 P("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 ue(i,a=>a.map(Nr))}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 P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new P("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling updateConnection.");if(t.updateConnectionRequest===null||t.updateConnectionRequest===void 0)throw new P("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:Kg(t.updateConnectionRequest)},n);return new ue(i,a=>Nr(a))}async updateConnection(t,n){return await(await this.updateConnectionRaw(t,n)).value()}}const QC={Force:"force",IfExpired:"ifExpired"};class YC extends Le{async createConsumerRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createConsumer.");if(t.consumer===null||t.consumer===void 0)throw new P("consumer","Required parameter requestParameters.consumer was null or undefined when calling createConsumer.");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}/consumers".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:Af(t.consumer)},n);return new Tt(i)}async createConsumer(t,n){await this.createConsumerRaw(t,n)}}class ZC extends Le{async createDestinationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createDestination.");if(t.destination===null||t.destination===void 0)throw new P("destination","Required parameter requestParameters.destination was null or undefined when calling createDestination.");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}/destinations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:Df(t.destination)},n);return new ue(i,a=>ci(a))}async createDestination(t,n){return await(await this.createDestinationRaw(t,n)).value()}async deleteDestinationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteDestination.");if(t.destination===null||t.destination===void 0)throw new P("destination","Required parameter requestParameters.destination was null or undefined when calling deleteDestination.");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}/destinations/{destination}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{destination}",encodeURIComponent(String(t.destination))),method:"DELETE",headers:o,query:r},n);return new Tt(i)}async deleteDestination(t,n){await this.deleteDestinationRaw(t,n)}async getDestinationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getDestination.");if(t.destination===null||t.destination===void 0)throw new P("destination","Required parameter requestParameters.destination was null or undefined when calling getDestination.");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}/destinations/{destination}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{destination}",encodeURIComponent(String(t.destination))),method:"GET",headers:o,query:r},n);return new ue(i,a=>ci(a))}async getDestination(t,n){return await(await this.getDestinationRaw(t,n)).value()}async listDestinationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listDestinations.");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}/destinations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new ue(i,a=>a.map(ci))}async listDestinations(t,n){return await(await this.listDestinationsRaw(t,n)).value()}async updateDestinationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateDestination.");if(t.destination===null||t.destination===void 0)throw new P("destination","Required parameter requestParameters.destination was null or undefined when calling updateDestination.");if(t.destinationUpdate===null||t.destinationUpdate===void 0)throw new P("destinationUpdate","Required parameter requestParameters.destinationUpdate was null or undefined when calling updateDestination.");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}/destinations/{destination}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{destination}",encodeURIComponent(String(t.destination))),method:"PATCH",headers:o,query:r,body:$g(t.destinationUpdate)},n);return new ue(i,a=>ci(a))}async updateDestination(t,n){return await(await this.updateDestinationRaw(t,n)).value()}}class e0 extends Le{async createGroupRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createGroup.");if(t.group===null||t.group===void 0)throw new P("group","Required parameter requestParameters.group was null or undefined when calling createGroup.");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}/groups".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:Kf(t.group)},n);return new Tt(i)}async createGroup(t,n){await this.createGroupRaw(t,n)}}class vy extends Le{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new P("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new P("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:$f(t.installation)},n);return new ue(i,a=>ui(a))}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 P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new P("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new P("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 Tt(i)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new P("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new P("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 ue(i,a=>ui(a))}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 P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new P("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 ue(i,a=>a.map(ui))}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 P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new P("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new P("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new P("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:ty(t.installationUpdate)},n);return new ue(i,a=>ui(a))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class Iy extends Le{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");if(t.batchUpsertIntegrationsRequest===null||t.batchUpsertIntegrationsRequest===void 0)throw new P("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:lp(t.batchUpsertIntegrationsRequest)},n);return new ue(i,a=>a.map(Ma))}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 P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new P("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:Fm(t.integration)},n);return new Tt(i)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new P("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 Tt(i)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new P("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 ue(i,a=>a.map(Ma))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class Sy extends Le{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new P("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:vg(t.connectOAuthParams)},n);return this.isJsonMime(i.headers.get("content-type"))?new ue(i):new Ea(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 P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling oauthUpdate.");if(t.connectionId===null||t.connectionId===void 0)throw new P("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 ue(i):new Ea(i)}async oauthUpdate(t,n){return await(await this.oauthUpdateRaw(t,n)).value()}}class t0 extends Le{async getObjectMetadataForConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getObjectMetadataForConnection.");if(t.provider===null||t.provider===void 0)throw new P("provider","Required parameter requestParameters.provider was null or undefined when calling getObjectMetadataForConnection.");if(t.objectName===null||t.objectName===void 0)throw new P("objectName","Required parameter requestParameters.objectName was null or undefined when calling getObjectMetadataForConnection.");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}/providers/{provider}/objects/{objectName}/metadata".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{provider}",encodeURIComponent(String(t.provider))).replace("{objectName}",encodeURIComponent(String(t.objectName))),method:"GET",headers:o,query:r},n);return new ue(i,a=>Ja(a))}async getObjectMetadataForConnection(t,n){return await(await this.getObjectMetadataForConnectionRaw(t,n)).value()}async getObjectMetadataForInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getObjectMetadataForInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new P("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getObjectMetadataForInstallation.");if(t.objectName===null||t.objectName===void 0)throw new P("objectName","Required parameter requestParameters.objectName was null or undefined when calling getObjectMetadataForInstallation.");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}/objects/{objectName}/metadata".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{objectName}",encodeURIComponent(String(t.objectName))),method:"GET",headers:o,query:r},n);return new ue(i,a=>Ja(a))}async getObjectMetadataForInstallation(t,n){return await(await this.getObjectMetadataForInstallationRaw(t,n)).value()}}class n0 extends Le{async getOperationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getOperation.");if(t.operationId===null||t.operationId===void 0)throw new P("operationId","Required parameter requestParameters.operationId was null or undefined when calling getOperation.");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}/operations/{operationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{operationId}",encodeURIComponent(String(t.operationId))),method:"GET",headers:o,query:r},n);return new ue(i,a=>hc(a))}async getOperation(t,n){return await(await this.getOperationRaw(t,n)).value()}async listOperationLogsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listOperationLogs.");if(t.operationId===null||t.operationId===void 0)throw new P("operationId","Required parameter requestParameters.operationId was null or undefined when calling listOperationLogs.");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}/operations/{operationId}/logs".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{operationId}",encodeURIComponent(String(t.operationId))),method:"GET",headers:o,query:r},n);return new ue(i,a=>a.map(Kh))}async listOperationLogs(t,n){return await(await this.listOperationLogsRaw(t,n)).value()}async listOperationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listOperations.");if(t.integrationId===null||t.integrationId===void 0)throw new P("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listOperations.");if(t.installationId===null||t.installationId===void 0)throw new P("installationId","Required parameter requestParameters.installationId was null or undefined when calling listOperations.");const r={};t.pageSize!==void 0&&(r.pageSize=t.pageSize),t.pageToken!==void 0&&(r.pageToken=t.pageToken);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/{installationId}/operations".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 ue(i,a=>Dh(a))}async listOperations(t,n){return await(await this.listOperationsRaw(t,n)).value()}}class r0 extends Le{async createOrgRaw(t,n){if(t.org===null||t.org===void 0)throw new P("org","Required parameter requestParameters.org was null or undefined when calling createOrg.");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:"/orgs",method:"POST",headers:o,query:r,body:Mm(t.org)},n);return new ue(i,a=>li(a))}async createOrg(t,n){return await(await this.createOrgRaw(t,n)).value()}async createOrgInviteRaw(t,n){if(t.orgId===null||t.orgId===void 0)throw new P("orgId","Required parameter requestParameters.orgId was null or undefined when calling createOrgInvite.");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:"/orgs/{orgId}/invites".replace("{orgId}",encodeURIComponent(String(t.orgId))),method:"POST",headers:o,query:r,body:Pm(t.createOrgInviteRequest)},n);return new ue(i,a=>oo(a))}async createOrgInvite(t,n){return await(await this.createOrgInviteRaw(t,n)).value()}async deleteOrgInviteRaw(t,n){if(t.orgId===null||t.orgId===void 0)throw new P("orgId","Required parameter requestParameters.orgId was null or undefined when calling deleteOrgInvite.");if(t.inviteId===null||t.inviteId===void 0)throw new P("inviteId","Required parameter requestParameters.inviteId was null or undefined when calling deleteOrgInvite.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/orgs/{orgId}/invites/{inviteId}".replace("{orgId}",encodeURIComponent(String(t.orgId))).replace("{inviteId}",encodeURIComponent(String(t.inviteId))),method:"DELETE",headers:o,query:r},n);return new Tt(i)}async deleteOrgInvite(t,n){await this.deleteOrgInviteRaw(t,n)}async getOrgRaw(t,n){if(t.orgId===null||t.orgId===void 0)throw new P("orgId","Required parameter requestParameters.orgId was null or undefined when calling getOrg.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/orgs/{orgId}".replace("{orgId}",encodeURIComponent(String(t.orgId))),method:"GET",headers:o,query:r},n);return new ue(i,a=>li(a))}async getOrg(t,n){return await(await this.getOrgRaw(t,n)).value()}async getOrgInviteRaw(t,n){if(t.orgId===null||t.orgId===void 0)throw new P("orgId","Required parameter requestParameters.orgId was null or undefined when calling getOrgInvite.");if(t.inviteId===null||t.inviteId===void 0)throw new P("inviteId","Required parameter requestParameters.inviteId was null or undefined when calling getOrgInvite.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/orgs/{orgId}/invites/{inviteId}".replace("{orgId}",encodeURIComponent(String(t.orgId))).replace("{inviteId}",encodeURIComponent(String(t.inviteId))),method:"GET",headers:o,query:r},n);return new ue(i,a=>oo(a))}async getOrgInvite(t,n){return await(await this.getOrgInviteRaw(t,n)).value()}async listOrgBuildersRaw(t,n){if(t.orgId===null||t.orgId===void 0)throw new P("orgId","Required parameter requestParameters.orgId was null or undefined when calling listOrgBuilders.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/orgs/{orgId}/builders".replace("{orgId}",encodeURIComponent(String(t.orgId))),method:"GET",headers:o,query:r},n);return new ue(i,a=>a.map(Fs))}async listOrgBuilders(t,n){return await(await this.listOrgBuildersRaw(t,n)).value()}async listOrgInvitesRaw(t,n){if(t.orgId===null||t.orgId===void 0)throw new P("orgId","Required parameter requestParameters.orgId was null or undefined when calling listOrgInvites.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/orgs/{orgId}/invites".replace("{orgId}",encodeURIComponent(String(t.orgId))),method:"GET",headers:o,query:r},n);return new ue(i,a=>a.map(oo))}async listOrgInvites(t,n){return await(await this.listOrgInvitesRaw(t,n)).value()}async updateOrgRaw(t,n){if(t.orgId===null||t.orgId===void 0)throw new P("orgId","Required parameter requestParameters.orgId was null or undefined when calling updateOrg.");if(t.updateOrgRequest===null||t.updateOrgRequest===void 0)throw new P("updateOrgRequest","Required parameter requestParameters.updateOrgRequest was null or undefined when calling updateOrg.");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:"/orgs/{orgId}".replace("{orgId}",encodeURIComponent(String(t.orgId))),method:"PATCH",headers:o,query:r,body:ay(t.updateOrgRequest)},n);return new ue(i,a=>li(a))}async updateOrg(t,n){return await(await this.updateOrgRaw(t,n)).value()}}class wy extends Le{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new P("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:km(t.project)},n);return new ue(i,a=>br(a))}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 P("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 Tt(i)}async deleteProject(t,n){await this.deleteProjectRaw(t,n)}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new P("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 ue(i,a=>br(a))}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 ue(o,i=>i.map(br))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new P("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 ue(i,a=>br(a))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class by extends Le{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new P("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 ue(i,a=>ka(a))}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 ue(o,i=>pe(i,ka))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class Ny extends Le{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new P("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:Km(t.providerApp)},n);return new ue(i,a=>di(a))}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 P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new P("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 Tt(i)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new P("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 ue(i,a=>a.map(di))}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 P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new P("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new P("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"PATCH",headers:o,query:r,body:gy(t.providerAppUpdate)},n);return new ue(i,a=>di(a))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class Cy extends Le{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new P("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");if(t.revision===null||t.revision===void 0)throw new P("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:Lm(t.revision)},n);return new Tt(i)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new P("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new P("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new P("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new P("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 ue(i,a=>yh(a))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class i0 extends Le{async generateUploadUrlRaw(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:"/generate-upload-url",method:"GET",headers:r,query:n},t);return new ue(o,i=>Mg(i))}async generateUploadUrl(t){return await(await this.generateUploadUrlRaw(t)).value()}}class o0 extends Le{async acceptInviteRaw(t,n){if(t.acceptInviteRequest===null||t.acceptInviteRequest===void 0)throw new P("acceptInviteRequest","Required parameter requestParameters.acceptInviteRequest was null or undefined when calling acceptInvite.");const r={},o={};o["Content-Type"]="application/json";const i=await this.request({path:"/invites:accept",method:"POST",headers:o,query:r,body:Yl(t.acceptInviteRequest)},n);return new ue(i,a=>_a(a))}async acceptInvite(t,n){return await(await this.acceptInviteRaw(t,n)).value()}async getMyInfoRaw(t){const n={},r={},o=await this.request({path:"/my-info",method:"GET",headers:r,query:n},t);return new ue(o,i=>_a(i))}async getMyInfo(t){return await(await this.getMyInfoRaw(t)).value()}}class Ty{constructor(t){this.connectionApi=new Oy(t),this.installationApi=new vy(t),this.integrationApi=new Iy(t),this.oAuthApi=new Sy(t),this.projectApi=new wy(t),this.providerApi=new by(t),this.providerAppApi=new Ny(t),this.revisionApi=new Cy(t)}}const Ry="2.7.12",a0="v1",Gi="https://api.withampersand.com";function xy(){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 Gi;case"mock":return"http://127.0.0.1:4010";case"":return Gi;default:return e??Gi}}catch{return Gi}}const s0=(e,t)=>`${e}/${t}`;function c0(){return s0(xy(),a0)}const Ay=xy(),Ey=c0(),u0=new Ao({basePath:Ey,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Ry}});let l0=new Ty(u0);const Oc=()=>l0;function ot(){const e=jl();return v.useCallback(async()=>{e||console.error("Unable to create API service without API key.");const n=new Ao({basePath:Ey,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Ry,"X-Api-Key":e}});return new Ty(n)},[e])}const d0=e=>{const t=ot();return Wn({queryKey:["project",e],queryFn:async()=>(await t()).projectApi.getProject({projectIdOrName:e})})},Fy=v.createContext({project:null,appName:"",projectId:"",projectIdOrName:"",isLoading:!0}),Ee=()=>{const e=v.useContext(Fy);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e};function p0({projectIdOrName:e,children:t}){const{setError:n}=Jt(),{data:r,isLoading:o,isError:i}=d0(e);v.useEffect(()=>{i&&n(de.PROJECT,e)},[i,e,n]);const a=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 u.jsx(Fy.Provider,{value:a,children:t})}function _y(){const e=ot(),{projectIdOrName:t}=Ee();return Wn({queryKey:["amp","integrations",t],queryFn:async()=>{if(!t)throw new Error("Project ID or name is required");return(await e()).integrationApi.listIntegrations({projectIdOrName:t})},enabled:!!t})}const Be=async(e,t)=>{var n;if(e instanceof ss){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 a=await e.response.clone().json(),s=((n=a==null?void 0:a.causes)==null?void 0:n.join(`
|
|
2
|
+
`))||(a==null?void 0:a.detail);s?(console.error("[Error Message]",s),a!=null&&a.remedy&&console.error("[Remedy]",a.remedy)):console.error("Unexpected error response:",a);const c=`${s} ${a!=null&&a.remedy?`
|
|
3
3
|
|
|
4
|
-
[Remedy] ${
|
|
5
|
-
component is wrapped with AmpersandProvider`);return e}const
|
|
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}},Xl=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(Xl);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}=$s(),{setError:d,isError:g,removeError:h}=Ft(),{isIntegrationDeleted:I,setIntegrationDeleted:v,resetIntegrationDeleted:p}=ev(),C=y.useMemo(()=>Yy(t,u||[]),[t,u]),{data:m,isLoading:w,isError:x,error:_}=Gl(t,o),S=(m==null?void 0:m[0])||null;y.useEffect(()=>{p()},[t,n,r,o,i,f]),y.useEffect(()=>{C===null&&(u!=null&&u.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,C,u]),y.useEffect(()=>{x?(d(ue.INSTALLATION_LIST,(C==null?void 0:C.id)||""),Le(_)):h(ue.INSTALLATION_LIST,(C==null?void 0:C.id)||"")},[x,C,d,h,_]);const R=at(),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=(C==null?void 0:C.id)||"",z=y.useMemo(()=>({integrationId:(C==null?void 0:C.id)||"",provider:(C==null?void 0:C.provider)||"",integrationObj:C,consumerRef:n,consumerName:r,groupRef:o,groupName:i,installation:S||void 0,setInstallation:A,resetInstallations:N,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,isIntegrationDeleted:I,setIntegrationDeleted:v,fieldMapping:f}),[C,n,r,o,i,S,A,N,s,a,c,I,v,f]);if(w)return l.jsx(zr,{});if(C===null)return l.jsx(Jt,{message:`Integration "${t}" not found`});if(g(ue.INSTALLATION_LIST,K)){const H=`Error retrieving installation information for integration "${(C==null?void 0:C.name)||"unknown"}"`;return l.jsx(Jt,{message:H})}return l.jsx(Xl.Provider,{value:z,children:e})}const Yl=y.createContext({connections:null,isConnectionsLoading:!0,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),Qt=()=>{const e=y.useContext(Yl);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function Zl({groupRef:e,provider:t,children:n}){const r=at(),{setError:o,isError:i}=Ft(),{projectId:s,isLoading:a}=Ne(),{integrationId:c,groupRef:f}=rt(),{provider:u}=Ly(c),{data:d,isLoading:g,isError:h,error:I}=Bl({groupRef:e||f,provider:u||t}),v=d==null?void 0:d[0],p=y.useCallback(w=>{r.setQueryData(["amp","connections"],()=>w),r.invalidateQueries({queryKey:["amp","connections"]})},[r]),C=y.useCallback(()=>{r.invalidateQueries({queryKey:["amp","connections"]})},[r]);y.useEffect(()=>{h?(o(ue.CONNECTION_LIST,s,!0),Le(I)):o(ue.CONNECTION_LIST,s,!1)},[h,o,s,I]);const m=y.useMemo(()=>({connections:d||null,isConnectionsLoading:g,selectedConnection:v||null,setConnections:p,setSelectedConnection:C}),[d,g,v,p,C]);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(Yl.Provider,{value:m,children:n})}function eu(){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 Hs(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]",I="[object GeneratorFunction]",v="[object Map]",p="[object Number]",C="[object Null]",m="[object Object]",w="[object Promise]",x="[object Proxy]",_="[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[_]=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 It(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,pt=$e.hasOwnProperty,sn=function(){var b=/[^.]+$/.exec(Pe&&Pe.keys&&Pe.keys.IE_PROTO||"");return b?"Symbol(src)_1."+b:""}(),Yt=$e.toString,bt=RegExp("^"+jt.call(pt).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,ht=an?an.toStringTag:void 0,ln=Object.getOwnPropertySymbols,Cn=Fe?Fe.isBuffer:void 0,Jn=Mt(Object.keys,Object),xn=Ir(B,"DataView"),Ae=Ir(B,"Map"),it=Ir(B,"Promise"),oe=Ir(B,"Set"),ge=Ir(B,"WeakMap"),qe=Ir(Object,"create"),un=zn(xn),W=zn(Ae),ce=zn(it),le=zn(oe),Ke=zn(ge),He=an?an.prototype:void 0,mt=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 gt(b){var E=this.has(b)&&delete this.__data__[b];return this.size-=E?1:0,E}function Te(b){var E=this.__data__;if(qe){var F=E[b];return F===r?void 0:F}return pt.call(E,b)?E[b]:void 0}function _n(b){var E=this.__data__;return qe?E[b]!==void 0:pt.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=gt,Qe.prototype.get=Te,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 mf(b){return this.__data__.set(b,r),this}function gf(b){return this.__data__.has(b)}Ai.prototype.add=Ai.prototype.push=mf,Ai.prototype.has=gf;function On(b){var E=this.__data__=new Lt(b);this.size=E.size}function yf(){this.__data__=new Lt,this.size=0}function vf(b){var E=this.__data__,F=E.delete(b);return this.size=E.size,F}function wf(b){return this.__data__.get(b)}function If(b){return this.__data__.has(b)}function bf(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=yf,On.prototype.delete=vf,On.prototype.get=wf,On.prototype.has=If,On.prototype.set=bf;function Cf(b,E){var F=Di(b),Z=!F&&jf(b),Re=!F&&!Z&&Mo(b),pe=!F&&!Z&&!Re&&Ma(b),Me=F||Z||Re||pe,Xe=Me?Ue(b.length,String):[],nt=Xe.length;for(var De in b)pt.call(b,De)&&!(Me&&(De=="length"||Re&&(De=="offset"||De=="parent")||pe&&(De=="buffer"||De=="byteLength"||De=="byteOffset")||Pf(De,nt)))&&Xe.push(De);return Xe}function Pi(b,E){for(var F=b.length;F--;)if(Aa(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:C:ht&&ht in Object(b)?Rf(b):kf(b)}function Sa(b){return ei(b)&&Zr(b)==a}function Na(b,E,F,Z,Re){return b===E?!0:b==null||E==null||!ei(b)&&!ei(E)?b!==b&&E!==E:_f(b,E,F,Z,Na,Re)}function _f(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 Ct=nt==m,Vt=De==m,ot=nt==De;if(ot&&Mo(b)){if(!Mo(E))return!1;Me=!0,Ct=!1}if(ot&&!Ct)return pe||(pe=new On),Me||Ma(b)?Ta(b,E,F,Z,Re,pe):Nf(b,E,nt,F,Z,Re,pe);if(!(F&o)){var Nt=Ct&&pt.call(b,"__wrapped__"),Tt=Vt&&pt.call(E,"__wrapped__");if(Nt||Tt){var Sn=Nt?b.value():b,dn=Tt?E.value():E;return pe||(pe=new On),Re(Sn,dn,F,Z,pe)}}return ot?(pe||(pe=new On),Tf(b,E,F,Z,Re,pe)):!1}function Of(b){if(!Da(b)||Df(b))return!1;var E=Pa(b)?bt:V;return E.test(zn(b))}function Ef(b){return ei(b)&&Fa(b.length)&&!!D[Zr(b)]}function Sf(b){if(!Mf(b))return Jn(b);var E=[];for(var F in Object(b))pt.call(b,F)&&F!="constructor"&&E.push(F);return E}function Ta(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 Ct=-1,Vt=!0,ot=F&i?new Ai:void 0;for(pe.set(b,E),pe.set(E,b);++Ct<Xe;){var Nt=b[Ct],Tt=E[Ct];if(Z)var Sn=Me?Z(Tt,Nt,Ct,E,b,pe):Z(Nt,Tt,Ct,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)&&(Nt===dn||Re(Nt,dn,F,Z,pe)))return ot.push(Gn)})){Vt=!1;break}}else if(!(Nt===Tt||Re(Nt,Tt,F,Z,pe))){Vt=!1;break}}return pe.delete(b),pe.delete(E),Vt}function Nf(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 Aa(+b,+E);case g:return b.name==E.name&&b.message==E.message;case _:case R:return b==E+"";case v:var Xe=It;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 Ct=Ta(Xe(b),Xe(E),Z,Re,pe,Me);return Me.delete(b),Ct;case N:if(mt)return mt.call(b)==mt.call(E)}return!1}function Tf(b,E,F,Z,Re,pe){var Me=F&o,Xe=Ra(b),nt=Xe.length,De=Ra(E),Ct=De.length;if(nt!=Ct&&!Me)return!1;for(var Vt=nt;Vt--;){var ot=Xe[Vt];if(!(Me?ot in E:pt.call(E,ot)))return!1}var Nt=pe.get(b);if(Nt&&pe.get(E))return Nt==E;var Tt=!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 ka=Me?Z(Gn,dn,ot,E,b,pe):Z(dn,Gn,ot,b,E,pe);if(!(ka===void 0?dn===Gn||Re(dn,Gn,F,Z,pe):ka)){Tt=!1;break}Sn||(Sn=ot=="constructor")}if(Tt&&!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)&&(Tt=!1)}return pe.delete(b),pe.delete(E),Tt}function Ra(b){return xf(b,Vf,Af)}function Fi(b,E){var F=b.__data__;return Ff(E)?F[typeof E=="string"?"string":"hash"]:F.map}function Ir(b,E){var F=Ze(b,E);return Of(F)?F:void 0}function Rf(b){var E=pt.call(b,ht),F=b[ht];try{b[ht]=void 0;var Z=!0}catch{}var Re=Yt.call(b);return Z&&(E?b[ht]=F:delete b[ht]),Re}var Af=ln?function(b){return b==null?[]:(b=Object(b),Se(ln(b),function(E){return cn.call(b,E)}))}:Uf,En=Zr;(xn&&En(new xn(new ArrayBuffer(1)))!=H||Ae&&En(new Ae)!=v||it&&En(it.resolve())!=w||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 w;case le:return S;case Ke:return K}return E});function Pf(b,E){return E=E??s,!!E&&(typeof b=="number"||L.test(b))&&b>-1&&b%1==0&&b<E}function Ff(b){var E=typeof b;return E=="string"||E=="number"||E=="symbol"||E=="boolean"?b!=="__proto__":b===null}function Df(b){return!!sn&&sn in b}function Mf(b){var E=b&&b.constructor,F=typeof E=="function"&&E.prototype||$e;return b===F}function kf(b){return Yt.call(b)}function zn(b){if(b!=null){try{return jt.call(b)}catch{}try{return b+""}catch{}}return""}function Aa(b,E){return b===E||b!==b&&E!==E}var jf=Sa(function(){return arguments}())?Sa:function(b){return ei(b)&&pt.call(b,"callee")&&!cn.call(b,"callee")},Di=Array.isArray;function Lf(b){return b!=null&&Fa(b.length)&&!Pa(b)}var Mo=Cn||$f;function Kf(b,E){return Na(b,E)}function Pa(b){if(!Da(b))return!1;var E=Zr(b);return E==h||E==I||E==f||E==x}function Fa(b){return typeof b=="number"&&b>-1&&b%1==0&&b<=s}function Da(b){var E=typeof b;return b!=null&&(E=="object"||E=="function")}function ei(b){return b!=null&&typeof b=="object"}var Ma=J?be(J):Ef;function Vf(b){return Lf(b)?Cf(b):Sf(b)}function Uf(){return[]}function $f(){return!1}e.exports=Kf})(no,no.exports);var nv=no.exports;const tu=Hs(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 nu=(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 ru=(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?!!nu(e,s.objectName):!1})}),n},iu=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=ru(e,t),o=!!((i=t==null?void 0:t.content)!=null&&i.write)?iu(e):void 0;return o&&n.push(o),n}function ou(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 tu(e,t)}function su(e,t){return tu(e,t)}const dv=(e,t,n)=>{var p,C,m,w,x,_,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=(C=(p=u==null?void 0:u.read)==null?void 0:p.objects)==null?void 0:C[t])==null?void 0:m.selectedFields)||{},g=((_=(x=(w=u==null?void 0:u.read)==null?void 0:w.objects)==null?void 0:x[t])==null?void 0:_.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)||{},I={...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:I,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 au(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 cu=(e,t,n,r)=>{const o=au(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]=au(e,i,t))}),n(o)},lu=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||{}}},uu=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},du=e=>{const{selectedValueMappings:t}=(e==null?void 0:e.read)||{};return t};function fu(e,t){return t[e]||void 0}async function pu({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 Us().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=lu(e),i=uu(e),s=du(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?pu({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))},hu=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=hu(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?pu({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 mu={exports:{}};/*!
|
|
4
|
+
[Remedy] ${a.remedy}`:""}`;t&&t(c)}catch(i){console.error("Error parsing error response body:",i)}}else console.error("Unexpected error:",e.message)},Py=v.createContext({integrations:null,isLoading:!0}),vc=()=>{const e=v.useContext(Py);if(!e)throw new Error("useIntegrationList must be used within a IntegrationListProvider");return e};function f0({children:e}){const{projectIdOrName:t}=Ee(),{setError:n,removeError:r}=Jt(),{data:o,isLoading:i,isError:a}=_y();v.useEffect(()=>{a?(Be(a),n(de.INTEGRATION_LIST,t)):r(de.INTEGRATION_LIST,t)},[a,t,r,n]);const s=v.useMemo(()=>({integrations:o||null,isLoading:i}),[o,i]);return u.jsx(Py.Provider,{value:s,children:e})}const m0=new GI;function h0(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 u.jsx(eS,{client:m0,children:u.jsx(mS,{children:u.jsx(pS,{value:t,children:u.jsx(p0,{projectIdOrName:i,children:u.jsx(f0,{children:o})})})})})}const Dy=v.createContext(null);function g0(){const e=v.useContext(Dy);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
|
|
5
|
+
component is wrapped with AmpersandProvider`);return e}const Ic=({groupRef:e,provider:t})=>{const{projectIdOrName:n}=Ee(),r=ot();return Wn({queryKey:["amp","connections",n,e,t],queryFn:async()=>{if(!n)throw new Error("Project ID or name not found. Please wrap this component inside of AmpersandProvider");if(!e)throw new Error("Group reference not found.");if(!t)throw new Error("Provider not found.");return(await r()).connectionApi.listConnections({projectIdOrName:n,groupRef:e,provider:t})},retry:3,enabled:!!n&&!!e&&!!t})},Qr=e=>{const t=_y(),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 y0(){return u.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u.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"}),u.jsx("path",{d:"M24 18V26",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M24 34H24.02",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}const O0="_box_1p7c5_1",Ru={box:O0};function In({children:e,className:t,style:n}){return u.jsx("div",{className:t?`${Ru.box} ${t}`:Ru.box,style:n,children:e})}const v0="_container_1wvzr_1",xu={container:v0};function Yr({children:e,className:t,style:n}){return u.jsx("div",{className:t?`${xu.container} ${t}`:xu.container,style:n,children:e})}const I0="_errorBoxContainer_4sdb2_1",S0="_errorBox_4sdb2_1",w0="_errorText_4sdb2_20",qa={errorBoxContainer:I0,errorBox:S0,errorText:w0};function My({message:e}){return u.jsx(In,{className:qa.errorBox,children:u.jsx("p",{className:qa.errorText,children:e})})}function Jy({message:e,children:t}){return u.jsxs(Yr,{className:qa.errorBoxContainer,children:[u.jsx(y0,{}),u.jsx(My,{message:e}),t]})}const b0="_loader_6ubm6_1",N0="_rotate_6ubm6_1",C0="_ball1_6ubm6_1",T0="_ball2_6ubm6_1",R0={loader:b0,rotate:N0,ball1:C0,ball2:T0};function x0(){return u.jsx("span",{className:R0.loader})}function gi(){return u.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:u.jsx(x0,{})})}function ky({children:e}){return u.jsx(Yr,{style:{maxWidth:"55rem"},children:u.jsx(In,{children:e})})}function Zr(){return u.jsx(ky,{children:u.jsx(gi,{})})}function Gt({message:e,children:t}){return u.jsx(ky,{children:u.jsx(Jy,{message:e,children:t})})}const Sc=(e,t)=>{var a;const n=ot(),{projectIdOrName:r}=Ee(),{integrations:o}=vc(),i=(a=o==null?void 0:o.find(s=>s.name===e))==null?void 0:a.id;return Wn({queryKey:["amp","installations",r,i,t],queryFn:async()=>{if(!r)throw new Error("Project ID is required");if(!i)throw new Error("Integration ID is required");if(!t)throw new Error("Group reference is required");return(await n()).installationApi.listInstallations({projectIdOrName:r,integrationId:i,groupRef:t})},enabled:!!r&&!!i&&!!t&&!!o&&o.length>0})};function Vn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function A0(e,t){return(t==null?void 0:t.displayName)??Vn(e)}const E0=e=>e.split(`
|
|
6
|
+
`).filter(n=>n.trim()!==""),F0=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,_0=e=>e.replace(/[.:/\\]/g,"\\$&"),P0=()=>{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}},qy=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 at(){const e=v.useContext(qy);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function D0({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,onInstallSuccess:a,onUpdateSuccess:s,onUninstallSuccess:c,fieldMapping:p}){const{integrations:l}=vc(),{setError:d,isError:h,removeError:m}=Jt(),{isIntegrationDeleted:S,setIntegrationDeleted:I,resetIntegrationDeleted:f}=P0(),C=v.useMemo(()=>F0(t,l||[]),[t,l]),{data:g,isLoading:O,isError:b,error:N}=Sc(t,o),R=(g==null?void 0:g[0])||null;v.useEffect(()=>{f()},[t,n,r,o,i,p]),v.useEffect(()=>{C===null&&(l!=null&&l.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,C,l]),v.useEffect(()=>{b?(d(de.INSTALLATION_LIST,(C==null?void 0:C.id)||""),Be(N)):m(de.INSTALLATION_LIST,(C==null?void 0:C.id)||"")},[b,C,d,m,N]);const E=Ke(),x=v.useCallback(()=>{E.invalidateQueries({queryKey:["amp","installations"]})},[E]),_=v.useCallback(J=>{E.setQueryData(["amp","installations"],[J]),E.invalidateQueries({queryKey:["amp","installations"]})},[E]),F=(C==null?void 0:C.id)||"",k=v.useMemo(()=>({integrationId:(C==null?void 0:C.id)||"",provider:(C==null?void 0:C.provider)||"",integrationObj:C,consumerRef:n,consumerName:r,groupRef:o,groupName:i,installation:R||void 0,setInstallation:_,resetInstallations:x,onInstallSuccess:a,onUpdateSuccess:s,onUninstallSuccess:c,isIntegrationDeleted:S,setIntegrationDeleted:I,fieldMapping:p}),[C,n,r,o,i,R,_,x,a,s,c,S,I,p]);if(O)return u.jsx(Zr,{});if(C===null)return u.jsx(Gt,{message:`Integration "${t}" not found`});if(h(de.INSTALLATION_LIST,F)){const J=`Error retrieving installation information for integration "${(C==null?void 0:C.name)||"unknown"}"`;return u.jsx(Gt,{message:J})}return u.jsx(qy.Provider,{value:k,children:e})}const Ky=v.createContext({connections:null,isConnectionsLoading:!0,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),Zt=()=>{const e=v.useContext(Ky);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function Uy({groupRef:e,provider:t,children:n}){const r=Ke(),{setError:o,isError:i}=Jt(),{projectId:a,isLoading:s}=Ee(),{integrationId:c,groupRef:p}=at(),{provider:l}=Qr(c),{data:d,isLoading:h,isError:m,error:S}=Ic({groupRef:e||p,provider:l||t}),I=d==null?void 0:d[0],f=v.useCallback(O=>{r.setQueryData(["amp","connections"],()=>O),r.invalidateQueries({queryKey:["amp","connections"]})},[r]),C=v.useCallback(()=>{r.invalidateQueries({queryKey:["amp","connections"]})},[r]);v.useEffect(()=>{m?(o(de.CONNECTION_LIST,a,!0),Be(S)):o(de.CONNECTION_LIST,a,!1)},[m,o,a,S]);const g=v.useMemo(()=>({connections:d||null,isConnectionsLoading:h,selectedConnection:I||null,setConnections:f,setSelectedConnection:C}),[d,h,I,f,C]);if(h||s)return u.jsx(Zr,{});if(i(de.PROJECT,a))return u.jsx(Gt,{message:`Error loading project ${a}`});if(i(de.CONNECTION_LIST,a))return u.jsx(Gt,{message:"Error retrieving existing connections"});if(!a)throw new Error("Project ID not found. ConnectionsProvider must be used within AmpersandProvider");return u.jsx(Ky.Provider,{value:g,children:n})}function Ly(){const[e,t]=v.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}var Xi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function wc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var mo={exports:{}};mo.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",o=1,i=2,a=9007199254740991,s="[object Arguments]",c="[object Array]",p="[object AsyncFunction]",l="[object Boolean]",d="[object Date]",h="[object Error]",m="[object Function]",S="[object GeneratorFunction]",I="[object Map]",f="[object Number]",C="[object Null]",g="[object Object]",O="[object Promise]",b="[object Proxy]",N="[object RegExp]",R="[object Set]",E="[object String]",x="[object Symbol]",_="[object Undefined]",F="[object WeakMap]",k="[object ArrayBuffer]",J="[object DataView]",q="[object Float32Array]",$="[object Float64Array]",te="[object Int8Array]",ee="[object Int16Array]",oe="[object Int32Array]",Oe="[object Uint8Array]",we="[object Uint8ClampedArray]",D="[object Uint16Array]",B="[object Uint32Array]",W=/[\\^$.*+?()[\]{}|]/g,j=/^\[object .+?Constructor\]$/,V=/^(?:0|[1-9]\d*)$/,K={};K[q]=K[$]=K[te]=K[ee]=K[oe]=K[Oe]=K[we]=K[D]=K[B]=!0,K[s]=K[c]=K[k]=K[l]=K[J]=K[d]=K[h]=K[m]=K[I]=K[f]=K[g]=K[N]=K[R]=K[E]=K[F]=!1;var ne=typeof Xi=="object"&&Xi&&Xi.Object===Object&&Xi,re=typeof self=="object"&&self&&self.Object===Object&&self,z=ne||re||Function("return this")(),ie=t&&!t.nodeType&&t,Y=ie&&!0&&e&&!e.nodeType&&e,fe=Y&&Y.exports===ie,L=fe&&ne.process,Se=function(){try{return L&&L.binding&&L.binding("util")}catch{}}(),G=Se&&Se.isTypedArray;function Ae(w,A){for(var M=-1,Z=w==null?0:w.length,_e=0,me=[];++M<Z;){var ke=w[M];A(ke,M,w)&&(me[_e++]=ke)}return me}function Ve(w,A){for(var M=-1,Z=A.length,_e=w.length;++M<Z;)w[_e+M]=A[M];return w}function et(w,A){for(var M=-1,Z=w==null?0:w.length;++M<Z;)if(A(w[M],M,w))return!0;return!1}function $e(w,A){for(var M=-1,Z=Array(w);++M<w;)Z[M]=A(M);return Z}function be(w){return function(A){return w(A)}}function kt(w,A){return w.has(A)}function tt(w,A){return w==null?void 0:w[A]}function St(w){var A=-1,M=Array(w.size);return w.forEach(function(Z,_e){M[++A]=[_e,Z]}),M}function qt(w,A){return function(M){return w(A(M))}}function Kt(w){var A=-1,M=Array(w.size);return w.forEach(function(Z){M[++A]=Z}),M}var nt=Array.prototype,Qe=Function.prototype,je=Object.prototype,De=z["__core-js_shared__"],Ut=Qe.toString,mt=je.hasOwnProperty,cn=function(){var w=/[^.]+$/.exec(De&&De.keys&&De.keys.IE_PROTO||"");return w?"Symbol(src)_1."+w:""}(),tn=je.toString,wt=RegExp("^"+Ut.call(mt).replace(W,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Me=fe?z.Buffer:void 0,un=z.Symbol,bn=z.Uint8Array,ln=je.propertyIsEnumerable,zn=nt.splice,ht=un?un.toStringTag:void 0,dn=Object.getOwnPropertySymbols,Nn=Me?Me.isBuffer:void 0,Gn=qt(Object.keys,Object),Cn=Sr(z,"DataView"),Pe=Sr(z,"Map"),st=Sr(z,"Promise"),ae=Sr(z,"Set"),ye=Sr(z,"WeakMap"),He=Sr(Object,"create"),pn=Qn(Cn),X=Qn(Pe),ce=Qn(st),le=Qn(ae),Ue=Qn(ye),We=un?un.prototype:void 0,gt=We?We.valueOf:void 0;function Ye(w){var A=-1,M=w==null?0:w.length;for(this.clear();++A<M;){var Z=w[A];this.set(Z[0],Z[1])}}function rt(){this.__data__=He?He(null):{},this.size=0}function yt(w){var A=this.has(w)&&delete this.__data__[w];return this.size-=A?1:0,A}function Fe(w){var A=this.__data__;if(He){var M=A[w];return M===r?void 0:M}return mt.call(A,w)?A[w]:void 0}function Tn(w){var A=this.__data__;return He?A[w]!==void 0:mt.call(A,w)}function Go(w,A){var M=this.__data__;return this.size+=this.has(w)?0:1,M[w]=He&&A===void 0?r:A,this}Ye.prototype.clear=rt,Ye.prototype.delete=yt,Ye.prototype.get=Fe,Ye.prototype.has=Tn,Ye.prototype.set=Go;function Lt(w){var A=-1,M=w==null?0:w.length;for(this.clear();++A<M;){var Z=w[A];this.set(Z[0],Z[1])}}function Ji(){this.__data__=[],this.size=0}function ki(w){var A=this.__data__,M=Bi(A,w);if(M<0)return!1;var Z=A.length-1;return M==Z?A.pop():zn.call(A,M,1),--this.size,!0}function qi(w){var A=this.__data__,M=Bi(A,w);return M<0?void 0:A[M][1]}function Ki(w){return Bi(this.__data__,w)>-1}function Ui(w,A){var M=this.__data__,Z=Bi(M,w);return Z<0?(++this.size,M.push([w,A])):M[Z][1]=A,this}Lt.prototype.clear=Ji,Lt.prototype.delete=ki,Lt.prototype.get=qi,Lt.prototype.has=Ki,Lt.prototype.set=Ui;function ve(w){var A=-1,M=w==null?0:w.length;for(this.clear();++A<M;){var Z=w[A];this.set(Z[0],Z[1])}}function Bt(){this.size=0,this.__data__={hash:new Ye,map:new(Pe||Lt),string:new Ye}}function ni(w){var A=Vi(this,w).delete(w);return this.size-=A?1:0,A}function Xn(w){return Vi(this,w).get(w)}function Xo(w){return Vi(this,w).has(w)}function ri(w,A){var M=Vi(this,w),Z=M.size;return M.set(w,A),this.size+=M.size==Z?0:1,this}ve.prototype.clear=Bt,ve.prototype.delete=ni,ve.prototype.get=Xn,ve.prototype.has=Xo,ve.prototype.set=ri;function Li(w){var A=-1,M=w==null?0:w.length;for(this.__data__=new ve;++A<M;)this.add(w[A])}function oI(w){return this.__data__.set(w,r),this}function aI(w){return this.__data__.has(w)}Li.prototype.add=Li.prototype.push=oI,Li.prototype.has=aI;function Rn(w){var A=this.__data__=new Lt(w);this.size=A.size}function sI(){this.__data__=new Lt,this.size=0}function cI(w){var A=this.__data__,M=A.delete(w);return this.size=A.size,M}function uI(w){return this.__data__.get(w)}function lI(w){return this.__data__.has(w)}function dI(w,A){var M=this.__data__;if(M instanceof Lt){var Z=M.__data__;if(!Pe||Z.length<n-1)return Z.push([w,A]),this.size=++M.size,this;M=this.__data__=new ve(Z)}return M.set(w,A),this.size=M.size,this}Rn.prototype.clear=sI,Rn.prototype.delete=cI,Rn.prototype.get=uI,Rn.prototype.has=lI,Rn.prototype.set=dI;function pI(w,A){var M=$i(w),Z=!M&&RI(w),_e=!M&&!Z&&Qo(w),me=!M&&!Z&&!_e&&hu(w),ke=M||Z||_e||me,Ze=ke?$e(w.length,String):[],it=Ze.length;for(var Je in w)mt.call(w,Je)&&!(ke&&(Je=="length"||_e&&(Je=="offset"||Je=="parent")||me&&(Je=="buffer"||Je=="byteLength"||Je=="byteOffset")||wI(Je,it)))&&Ze.push(Je);return Ze}function Bi(w,A){for(var M=w.length;M--;)if(du(w[M][0],A))return M;return-1}function fI(w,A,M){var Z=A(w);return $i(w)?Z:Ve(Z,M(w))}function ii(w){return w==null?w===void 0?_:C:ht&&ht in Object(w)?II(w):TI(w)}function su(w){return oi(w)&&ii(w)==s}function cu(w,A,M,Z,_e){return w===A?!0:w==null||A==null||!oi(w)&&!oi(A)?w!==w&&A!==A:mI(w,A,M,Z,cu,_e)}function mI(w,A,M,Z,_e,me){var ke=$i(w),Ze=$i(A),it=ke?c:xn(w),Je=Ze?c:xn(A);it=it==s?g:it,Je=Je==s?g:Je;var bt=it==g,Vt=Je==g,ct=it==Je;if(ct&&Qo(w)){if(!Qo(A))return!1;ke=!0,bt=!1}if(ct&&!bt)return me||(me=new Rn),ke||hu(w)?uu(w,A,M,Z,_e,me):OI(w,A,it,M,Z,_e,me);if(!(M&o)){var Et=bt&&mt.call(w,"__wrapped__"),Ft=Vt&&mt.call(A,"__wrapped__");if(Et||Ft){var An=Et?w.value():w,fn=Ft?A.value():A;return me||(me=new Rn),_e(An,fn,M,Z,me)}}return ct?(me||(me=new Rn),vI(w,A,M,Z,_e,me)):!1}function hI(w){if(!mu(w)||NI(w))return!1;var A=pu(w)?wt:j;return A.test(Qn(w))}function gI(w){return oi(w)&&fu(w.length)&&!!K[ii(w)]}function yI(w){if(!CI(w))return Gn(w);var A=[];for(var M in Object(w))mt.call(w,M)&&M!="constructor"&&A.push(M);return A}function uu(w,A,M,Z,_e,me){var ke=M&o,Ze=w.length,it=A.length;if(Ze!=it&&!(ke&&it>Ze))return!1;var Je=me.get(w);if(Je&&me.get(A))return Je==A;var bt=-1,Vt=!0,ct=M&i?new Li:void 0;for(me.set(w,A),me.set(A,w);++bt<Ze;){var Et=w[bt],Ft=A[bt];if(Z)var An=ke?Z(Ft,Et,bt,A,w,me):Z(Et,Ft,bt,w,A,me);if(An!==void 0){if(An)continue;Vt=!1;break}if(ct){if(!et(A,function(fn,Yn){if(!kt(ct,Yn)&&(Et===fn||_e(Et,fn,M,Z,me)))return ct.push(Yn)})){Vt=!1;break}}else if(!(Et===Ft||_e(Et,Ft,M,Z,me))){Vt=!1;break}}return me.delete(w),me.delete(A),Vt}function OI(w,A,M,Z,_e,me,ke){switch(M){case J:if(w.byteLength!=A.byteLength||w.byteOffset!=A.byteOffset)return!1;w=w.buffer,A=A.buffer;case k:return!(w.byteLength!=A.byteLength||!me(new bn(w),new bn(A)));case l:case d:case f:return du(+w,+A);case h:return w.name==A.name&&w.message==A.message;case N:case E:return w==A+"";case I:var Ze=St;case R:var it=Z&o;if(Ze||(Ze=Kt),w.size!=A.size&&!it)return!1;var Je=ke.get(w);if(Je)return Je==A;Z|=i,ke.set(w,A);var bt=uu(Ze(w),Ze(A),Z,_e,me,ke);return ke.delete(w),bt;case x:if(gt)return gt.call(w)==gt.call(A)}return!1}function vI(w,A,M,Z,_e,me){var ke=M&o,Ze=lu(w),it=Ze.length,Je=lu(A),bt=Je.length;if(it!=bt&&!ke)return!1;for(var Vt=it;Vt--;){var ct=Ze[Vt];if(!(ke?ct in A:mt.call(A,ct)))return!1}var Et=me.get(w);if(Et&&me.get(A))return Et==A;var Ft=!0;me.set(w,A),me.set(A,w);for(var An=ke;++Vt<it;){ct=Ze[Vt];var fn=w[ct],Yn=A[ct];if(Z)var gu=ke?Z(Yn,fn,ct,A,w,me):Z(fn,Yn,ct,w,A,me);if(!(gu===void 0?fn===Yn||_e(fn,Yn,M,Z,me):gu)){Ft=!1;break}An||(An=ct=="constructor")}if(Ft&&!An){var ji=w.constructor,Hi=A.constructor;ji!=Hi&&"constructor"in w&&"constructor"in A&&!(typeof ji=="function"&&ji instanceof ji&&typeof Hi=="function"&&Hi instanceof Hi)&&(Ft=!1)}return me.delete(w),me.delete(A),Ft}function lu(w){return fI(w,EI,SI)}function Vi(w,A){var M=w.__data__;return bI(A)?M[typeof A=="string"?"string":"hash"]:M.map}function Sr(w,A){var M=tt(w,A);return hI(M)?M:void 0}function II(w){var A=mt.call(w,ht),M=w[ht];try{w[ht]=void 0;var Z=!0}catch{}var _e=tn.call(w);return Z&&(A?w[ht]=M:delete w[ht]),_e}var SI=dn?function(w){return w==null?[]:(w=Object(w),Ae(dn(w),function(A){return ln.call(w,A)}))}:FI,xn=ii;(Cn&&xn(new Cn(new ArrayBuffer(1)))!=J||Pe&&xn(new Pe)!=I||st&&xn(st.resolve())!=O||ae&&xn(new ae)!=R||ye&&xn(new ye)!=F)&&(xn=function(w){var A=ii(w),M=A==g?w.constructor:void 0,Z=M?Qn(M):"";if(Z)switch(Z){case pn:return J;case X:return I;case ce:return O;case le:return R;case Ue:return F}return A});function wI(w,A){return A=A??a,!!A&&(typeof w=="number"||V.test(w))&&w>-1&&w%1==0&&w<A}function bI(w){var A=typeof w;return A=="string"||A=="number"||A=="symbol"||A=="boolean"?w!=="__proto__":w===null}function NI(w){return!!cn&&cn in w}function CI(w){var A=w&&w.constructor,M=typeof A=="function"&&A.prototype||je;return w===M}function TI(w){return tn.call(w)}function Qn(w){if(w!=null){try{return Ut.call(w)}catch{}try{return w+""}catch{}}return""}function du(w,A){return w===A||w!==w&&A!==A}var RI=su(function(){return arguments}())?su:function(w){return oi(w)&&mt.call(w,"callee")&&!ln.call(w,"callee")},$i=Array.isArray;function xI(w){return w!=null&&fu(w.length)&&!pu(w)}var Qo=Nn||_I;function AI(w,A){return cu(w,A)}function pu(w){if(!mu(w))return!1;var A=ii(w);return A==m||A==S||A==p||A==b}function fu(w){return typeof w=="number"&&w>-1&&w%1==0&&w<=a}function mu(w){var A=typeof w;return w!=null&&(A=="object"||A=="function")}function oi(w){return w!=null&&typeof w=="object"}var hu=G?be(G):gI;function EI(w){return xI(w)?pI(w):yI(w)}function FI(){return[]}function _I(){return!1}e.exports=AI})(mo,mo.exports);var M0=mo.exports;const By=wc(M0),fr="other",ho="manage-tab";function $n(e){return!e.fieldName}function J0(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function k0(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!$n(n)&&!!n.fieldName))||null}function q0(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>$n(r)&&!!r.mapToName))||[]}function K0(e){var n;return((n=e==null?void 0:e.optionalFields)==null?void 0:n.filter(r=>$n(r)&&!!r.mapToName))||[]}function U0(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!$n(n)&&!!n.fieldName))||null}const Vy=(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 L0(e){return $n(e)?e.mapToName:e.fieldName}const $y=(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(a=>{n.push({name:a==null?void 0:a.objectName,displayName:(a==null?void 0:a.mapToDisplayName)||(a==null?void 0:a.displayName)||(a==null?void 0:a.objectName)&&Vn(a==null?void 0:a.objectName),completed:e?!!Vy(e,a.objectName):!1})}),n},jy=e=>{var n;return{name:fr,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function B0(e,t){var i;const n=$y(e,t),o=!!((i=t==null?void 0:t.content)!=null&&i.write)?jy(e):void 0;return o&&n.push(o),n}function Hy(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(de.MAPPING,o),r!=null&&r.length&&console.error("required fields not met",r.map(i=>i.mapToDisplayName)),{errorList:o}}function V0(e,t){return By(e,t)}function Wy(e,t){return By(e,t)}const $0=(e,t,n)=>{var f,C,g,O,b,N,R,E,x;if(!e)return null;const r=J0(e,t),o=r&&k0(r),i=r&&U0(r),a=r&&q0(r),s=r&&K0(r),c=(r==null?void 0:r.allFields)||[],p=(r==null?void 0:r.allFieldsMetadata)||{},l=n==null?void 0:n.content,d=((g=(C=(f=l==null?void 0:l.read)==null?void 0:f.objects)==null?void 0:C[t])==null?void 0:g.selectedFields)||{},h=((N=(b=(O=l==null?void 0:l.read)==null?void 0:O.objects)==null?void 0:b[t])==null?void 0:N.selectedValueMappings)||{},m=((x=(E=(R=l==null?void 0:l.read)==null?void 0:R.objects)==null?void 0:E[t])==null?void 0:x.selectedFieldMappings)||{},S={...d},I={...m};return{allFields:c,allFieldsMetadata:p,requiredFields:o,optionalFields:i,requiredMapFields:a,optionalMapFields:s,selectedOptionalFields:d,selectedFieldMappings:m,selectedValueMappings:h,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,isValueMappingsModified:!1,savedConfig:{optionalFields:S,requiredMapFields:I,selectedValueMappings:h}}},j0=(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 zy(e,t,n){var i,a;const r=(i=e==null?void 0:e.content)==null?void 0:i.read,o=(a=e==null?void 0:e.content)==null?void 0:a.write;return{read:$0(r,t,n),write:j0(o,n)}}const Gy=(e,t,n,r)=>{const o=zy(e,n,t);r(n,o)},H0=(e,t,n)=>{const r=B0(t,e),o={};r.forEach(({name:i,completed:a})=>{a&&(o[i]=zy(e,i,t))}),n(o)},Xy=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(i=>r.add(L0(i))),{...Array.from(r).reduce((i,a)=>({...i,[a]:!0}),{}),...n||{}}},Qy=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},Yy=e=>{const{selectedValueMappings:t}=(e==null?void 0:e.read)||{};return t};function Zy(e,t){return t[e]||void 0}async function eO({createConfig:e,projectId:t,integrationId:n,groupRef:r,connectionId:o,apiKey:i,setError:a,setInstallation:s,onInstallSuccess:c}){const p={projectIdOrName:t,integrationId:n,installation:{groupRef:r,connectionId:o,config:e}};try{const l=await Oc().installationApi.createInstallation(p,{headers:{"X-Api-Key":i,"Content-Type":"application/json"}});s(l),c==null||c(l.id,l.config)}catch(l){Be(l,a)}}function Ai(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const W0=(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)},z0=(e,t,n,r)=>{const o=Xy(e),i=Qy(e),a=Yy(e),s=W0(n,t);if(!s)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:s.schedule,destination:s.destination,selectedFields:o,selectedFieldMappings:i,selectedValueMappings:a||{},backfill:s.backfill}}}}};return Ai(n)&&(c.content.proxy={enabled:!0}),c},G0=(e,t,n,r,o,i,a,s,c,p,l,d)=>{const h=z0(c,i,s,r);return h?eO({createConfig:h,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:a,setError:p,setInstallation:l,onInstallSuccess:d}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},tO=e=>{var t;return{...(t=e.write)==null?void 0:t.selectedWriteObjects}},X0=e=>{const t=e.content.write;return t==null?void 0:t.objects},Q0=(e,t,n)=>{if(!X0(t))return console.error("Error when getting write objects from hydratedRevision"),null;const o=tO(e),i={revisionId:t.id,createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:o}}};return Ai(t)&&(i.content.proxy={enabled:!0}),i},Y0=(e,t,n,r,o,i,a,s,c,p,l)=>{const d=Q0(s,a,r);return d?eO({createConfig:d,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:i,setError:c,setInstallation:p,onInstallSuccess:l}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))};var nO={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})()})(mu);var Iv=mu.exports;const Pt=Hs(Iv),bv="_button_kwfiu_1",Cv="_buttonError_kwfiu_28",xv="_danger_kwfiu_42",_v="_ghost_kwfiu_47",Vo={button:bv,buttonError:Cv,danger:xv,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=ct(),t=at();return yr({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 gu({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:o,onDisconnectError:i}){const{projectId:s}=Ne(),{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 yu=y.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),Gr=()=>{const e=y.useContext(yu);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e},Sv=()=>{var f;const e=at(),t=ct(),{selectedConnection:n,isConnectionsLoading:r}=Qt(),{projectIdOrName:o}=Ne(),{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:I,error:v}=Sv();y.useEffect(()=>{I?(s(ue.HYDRATED_REVISION,a),Le(v,f)):(i(ue.HYDRATED_REVISION,a),f(null),d(null))},[I,a,s,i,v,f]);const p=y.useMemo(()=>{var m,w,x;return{hydratedRevision:g||null,loading:h,readAction:(m=g==null?void 0:g.content)==null?void 0:m.read,writeObjects:((x=(w=g==null?void 0:g.content)==null?void 0:w.write)==null?void 0:x.objects)||[]}},[g,h]);if(h)return l.jsx(zr,{});const C=(r==null?void 0:r.provider)||"provider";if(o(ue.HYDRATED_REVISION,a)){const m=(r==null?void 0:r.name)||n||"unknown integration",w=`${c?`: ${c}`:`Error retrieving objects from ${C} or integration details for ${m}`}`;return l.jsx(Jt,{message:w,children:l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",paddingTop:"1rem"},children:[u&&l.jsx(Jl,{message:u}),l.jsx(gu,{buttonText:"Try again",resetComponent:t,buttonVariant:"danger",onDisconnectError:x=>d(x)})]})})}return l.jsx(yu.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 ys(e,t){return ys=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},ys(e,t)}function Tv(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ys(e,t)}var vs={exports:{}},qi={exports:{}},Ce={};/** @license React v16.13.1
|
|
10
|
+
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var i="",a=0;a<arguments.length;a++){var s=arguments[a];s&&(i=o(i,r(s)))}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 a="";for(var s in i)t.call(i,s)&&i[s]&&(a=o(a,s));return a}function o(i,a){return a?i?i+" "+a:i+a:i}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(nO);var Z0=nO.exports;const Mt=wc(Z0),eT="_button_kwfiu_1",tT="_buttonError_kwfiu_28",nT="_danger_kwfiu_42",rT="_ghost_kwfiu_47",ea={button:eT,buttonError:tT,danger:nT,ghost:rT};function Xe({className:e,style:t,type:n,children:r,variant:o,...i}){const a=Mt(ea.button,{[ea.danger]:o==="danger",[ea.ghost]:o==="ghost",[e||""]:!!e});return u.jsx("button",{type:n,className:a,style:t,...i,children:r})}const iT={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 Ei({children:e,style:t}){return u.jsx(In,{style:{...iT,...t},children:e})}const Po=e=>{const t=ot(),{provider:n}=at(),r=e||n;return Wn({queryKey:["amp","providerInfo",r],queryFn:async()=>{if(!r)throw new Error("Provider not found");return(await t()).providerApi.getProvider({provider:r})},enabled:!!r})},lt=e=>{const t=Po(e),{data:n}=t,{provider:r}=at(),o=n&&A0(n==null?void 0:n.name,n);return{...t,providerName:o,selectedProvider:e||r}};function Sn({error:e}){return e?u.jsx(Ei,{style:{marginTop:"2em"},children:e}):null}const oT="_input_1ymb7_1",aT="_inputError_1ymb7_27",sT="_error_1ymb7_43",ta={input:oT,inputError:aT,error:sT};function cT({id:e,type:t,className:n,isError:r=!1,...o}){const i=r?Mt(ta.inputError,ta.input):ta.input;return u.jsx("input",{id:e,type:t,className:Mt(i,n),...o})}const uT="_textarea_18zl4_1",lT="_textareaError_18zl4_14",dT="_error_18zl4_29",na={textarea:uT,textareaError:lT,error:dT};function pT({className:e,isError:t=!1,...n}){const r=t?Mt(na.textareaError,na.textarea):na.textarea;return u.jsx("textarea",{className:Mt(e,r),...n})}const zt={Input:cT,Textarea:pT},fT=()=>{const{project:e}=Ee(),t=e==null?void 0:e.id,n=ot();return Wn({queryKey:["project",t,"entitlements"],queryFn:async()=>{if(!t)throw new Error("Project ID is required");return(await n()).projectApi.getProject({projectIdOrName:t,includeEntitlements:!0})},enabled:!!t})};function rO(){var n,r;const{data:e}=fT();return((r=(n=e==null?void 0:e.entitlements)==null?void 0:n.brandingRemoval)==null?void 0:r.value)===!0?null:u.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:[u.jsx("p",{style:{color:"light-dark(gray, #EFEFEF)"},children:"Secured by"}),u.jsx("a",{href:"https://www.withampersand.com/",target:"_blank","aria-label":"Go to Ampersand",rel:"noreferrer noopener",children:u.jsxs("picture",{children:[u.jsx("source",{srcSet:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",media:"(prefers-color-scheme: light)"}),u.jsx("source",{srcSet:"https://res.cloudinary.com/dycvts6vp/image/upload/v1735853540/ampersand_logo_white.svg",media:"(prefers-color-scheme: dark)"}),u.jsx("img",{style:{height:".8em"},src:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",alt:"Ampersand"})]})})]})}function Or({children:e}){return u.jsx(Yr,{children:u.jsxs(In,{children:[u.jsx("div",{style:{padding:"3rem 2rem"},children:e}),u.jsx(rO,{})]})})}function vr({children:e}){return u.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function mT({children:e}){return u.jsx("p",{style:{padding:".5em 0"},children:e})}const hT="_link_oo2kv_1",gT={link:hT};function iO({href:e,className:t,style:n,label:r,children:o,newTab:i=!1}){return u.jsx("a",{className:Mt(gT.link,t),style:n,href:e,"aria-label":r||void 0,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:o})}function go({url:e,providerDisplayName:t,credentialName:n}){return u.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[u.jsx(iO,{href:e,newTab:!0,children:u.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," ","about where to find your ",t," ",n,"."]})}function bc(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 yi(e,t){return e.every(n=>{const r=t[n.name];return r&&r.trim()!==""})}function oO({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o,submitButtonType:i}){var b,N;const[a,s]=v.useState(!1),c=()=>s(R=>!R),[p,l]=v.useState({apiKey:""}),d=((b=t.metadata)==null?void 0:b.input)||[],h=R=>{const{name:E,value:x}=R.currentTarget;l(_=>({..._,[E]:x.trim()}))},{apiKey:m}=p,{providerName:S}=lt(e),I=m.length>0,f=yi(d,p),C=r||!I||!f,g=(N=t.apiKeyOpts)==null?void 0:N.docsURL,O=()=>{const R=bc(d,p);n({apiKey:m,providerMetadata:R})};return u.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[g&&u.jsx(go,{url:g,providerDisplayName:S||Vn(e),credentialName:"API key"}),u.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[u.jsx(zt.Input,{id:"apiKey",name:"apiKey",type:a?"text":"password",placeholder:"API Key",onChange:h}),u.jsx(Xe,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:c,variant:o,children:a?"Hide":"Show"})]}),d.map(R=>u.jsxs("div",{children:[R.docsURL&&u.jsx(go,{url:R.docsURL,providerDisplayName:S||Vn(e),credentialName:R.displayName||R.name}),u.jsx(zt.Input,{id:R.name,name:R.name,type:"text",placeholder:R.displayName||R.name,onChange:h})]},R.name)),u.jsx(Xe,{style:{marginTop:"1em",width:"100%"},disabled:C,type:i||"submit",onClick:O,variant:o,children:"Next"})]})}function yT({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=lt(e);return u.jsxs(Or,{children:[u.jsx(vr,{children:`Set up ${i} integration`}),u.jsx(Sn,{error:r}),u.jsx(oO,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function OT({...e}){return u.jsx(yT,{...e})}const vT={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 Do({children:e,style:t}){return u.jsx(In,{style:{...vT,...t},children:e})}const Nc=()=>{const e=ot(),t=Ke(),[n,r]=v.useState(null);return{...vn({mutationKey:["updateConnection"],mutationFn:async i=>(await e()).connectionApi.updateConnection(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)}}),errorMsg:n}},IT="_divider_1kmoj_1",Au={divider:IT};function Mo({className:e,style:t}){return u.jsx("hr",{className:e?`${Au.divider} ${e}`:Au.divider,style:t})}function Rt({string:e}){return u.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[u.jsx("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:e}),u.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:u.jsx(Mo,{style:{width:"100%",marginLeft:"1rem"}})})]})}function ST({provider:e}){const{projectIdOrName:t}=Ee(),{providerName:n,data:r}=lt(e),{selectedConnection:o,isConnectionsLoading:i}=Zt(),{mutateAsync:a,isPending:s,error:c}=Nc(),[p,l]=v.useState(null),[d,h]=v.useState(!1),m=()=>h(!1),S=()=>{h(!0),l(null)},I=(c==null?void 0:c.message)||p||null,f=async C=>{m(),l(null);try{await a({projectIdOrName:t||"",connectionId:(o==null?void 0:o.id)||"",updateConnectionRequest:{updateMask:["apiKey"],connection:{apiKey:C.apiKey}}},{onError:g=>{console.error("Update connection error:",g),Be(g,l)},onSuccess:()=>{S()}})}catch(g){console.error("Update connection caught error:",g),Be(g,l)}};return r?u.jsxs(u.Fragment,{children:[u.jsx(Rt,{string:"Update connection"}),u.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[u.jsx("p",{children:`Update ${n} API Key`}),d&&u.jsx(Do,{children:"Connection updated successfully"}),I&&u.jsx(Ei,{children:`Error updating connection ${I}`}),u.jsx(oO,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:f,isButtonDisabled:s||i,buttonVariant:"ghost",submitButtonType:"button"})]})]}):null}function aO({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o}){var O,b;const[i,a]=v.useState(!1),s=()=>a(N=>!N),[c,p]=v.useState({username:"",password:""}),l=((O=t.metadata)==null?void 0:O.input)||[],{username:d,password:h}=c,{providerName:m}=lt(e),S=N=>{const{name:R,value:E}=N.currentTarget;p(x=>({...x,[R]:E.trim()}))},I=yi(l,c),f=r||!I,C=()=>{const N=bc(l,c);n({user:d,pass:h,providerMetadata:N})},g=(b=t.basicOpts)==null?void 0:b.docsURL;return u.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[g&&u.jsx(go,{url:g,providerDisplayName:m||Vn(e),credentialName:"credentials"}),u.jsx(zt.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:S}),u.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[u.jsx(zt.Input,{id:"password",name:"password",type:i?"text":"password",placeholder:"Password",onChange:S}),u.jsx(Xe,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:s,variant:o,children:i?"Hide":"Show"})]}),l.map(N=>u.jsxs("div",{children:[N.docsURL&&u.jsx(go,{url:N.docsURL,providerDisplayName:m||Vn(e),credentialName:N.displayName||N.name}),u.jsx(zt.Input,{id:N.name,name:N.name,type:"text",placeholder:N.displayName||N.name,onChange:S})]},N.name)),u.jsx(Xe,{style:{marginTop:"1em",width:"100%"},disabled:f,type:"button",onClick:C,variant:o,children:"Next"})]})}function wT({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=lt(e);return u.jsxs(Or,{children:[u.jsx(vr,{children:`Set up ${i} integration`}),u.jsx(Sn,{error:r}),u.jsx(aO,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function bT({...e}){return u.jsx(wT,{...e})}function NT({provider:e}){const{projectIdOrName:t}=Ee(),{providerName:n,data:r}=lt(e),{selectedConnection:o,isConnectionsLoading:i}=Zt(),{mutateAsync:a,isPending:s,error:c}=Nc(),[p,l]=v.useState(null),[d,h]=v.useState(!1),m=()=>h(!1),S=()=>{h(!0),l(null)},I=(c==null?void 0:c.message)||p||null,f=async C=>{m(),l(null);try{await a({projectIdOrName:t||"",connectionId:(o==null?void 0:o.id)||"",updateConnectionRequest:{updateMask:["basicAuth"],connection:{basicAuth:{username:C.user,password:C.pass}}}},{onError:g=>{console.error(g),Be(g,l)},onSuccess:()=>{S()}})}catch(g){console.error(g),Be(g,l)}};return r?u.jsxs(u.Fragment,{children:[u.jsx(Rt,{string:"Update connection"}),u.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[u.jsx("p",{children:`Update ${n} credentials`}),d&&u.jsx(Do,{children:"Connection updated successfully"}),I&&u.jsx(Ei,{children:`Error updating connection: ${I}`}),u.jsx(aO,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:f,isButtonDisabled:s||i,buttonVariant:"ghost"})]})]}):null}function sO({provider:e,handleSubmit:t,isButtonDisabled:n,explicitScopesRequired:r,buttonVariant:o}){var E;const[i,a]=v.useState(!1),[s,c]=v.useState({clientSecret:"",clientId:"",scopes:""}),[p,l]=v.useState(null),{data:d}=Po(e),h=((E=d==null?void 0:d.metadata)==null?void 0:E.input)||[],m=()=>a(x=>!x),S=x=>{const{name:_,value:F}=x.currentTarget;c(k=>({...k,[_]:F.trim()})),l(null)},{clientSecret:I,clientId:f,scopes:C}=s,g=I.length>0,O=f.length>0,b=yi(h,s),N=n||!g||!O||!b,R=()=>{const x=bc(h,s),_={clientId:f,clientSecret:I,providerMetadata:x};r&&C.length>0&&(_.scopes=E0(C)),t(_)};return u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[u.jsx(zt.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:S}),u.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[u.jsx(zt.Input,{id:"clientSecret",name:"clientSecret",type:i?"text":"password",placeholder:"Client Secret",onChange:S}),u.jsx(Xe,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:m,variant:o,children:i?"Hide":"Show"})]}),r&&u.jsx(zt.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:S}),h.map(x=>u.jsx(zt.Input,{id:x.name,name:x.name,type:"text",placeholder:x.displayName||x.name,onChange:S},x.name))]}),u.jsx(Sn,{error:p}),u.jsx("br",{}),u.jsx(Xe,{style:{width:"100%"},disabled:N,type:"button",onClick:R,variant:o,children:"Next"})]})}function CT({provider:e,handleSubmit:t,error:n,isButtonDisabled:r,providerName:o,explicitScopesRequired:i}){return u.jsxs(Or,{children:[u.jsx(vr,{children:`Set up ${o} integration`}),u.jsx(Sn,{error:n}),u.jsx("br",{}),u.jsx(sO,{provider:e,handleSubmit:t,isButtonDisabled:r,explicitScopesRequired:i})]})}function TT({provider:e}){var g;const{projectIdOrName:t}=Ee(),{selectedConnection:n,isConnectionsLoading:r}=Zt(),{providerName:o,data:i}=lt(e),{mutateAsync:a,isPending:s,error:c}=Nc(),[p,l]=v.useState(null),[d,h]=v.useState(!1),m=()=>{h(!1)},S=()=>{h(!0),l(null)},I=(g=i==null?void 0:i.oauth2Opts)==null?void 0:g.explicitScopesRequired,f=(c==null?void 0:c.message)||p||null,C=async O=>{m(),l(null);try{await a({projectIdOrName:t||"",connectionId:(n==null?void 0:n.id)||"",updateConnectionRequest:{updateMask:["oauth2ClientCredentials"],connection:{oauth2ClientCredentials:{clientId:O.clientId,clientSecret:O.clientSecret,scopes:O.scopes}}}}),S()}catch(b){Be(b,l)}};return u.jsxs(u.Fragment,{children:[u.jsx(Rt,{string:"Update connection"}),u.jsxs("div",{style:{padding:"1rem 0",display:"flex",flexDirection:"column",gap:".5rem"},children:[u.jsx("p",{children:`Re-authenticate to ${o}`}),d&&u.jsx(Do,{children:"Connection updated successfully"}),f&&u.jsx(Ei,{children:`Error updating connection ${f}`}),u.jsx(sO,{provider:o||"",handleSubmit:C,isButtonDisabled:s||r,explicitScopesRequired:I,buttonVariant:"ghost"})]})]})}const Eu=600,Fu=600,RT="AUTHORIZATION_SUCCEEDED",xT="AUTHORIZATION_FAILED";function AT(e,t,n,r){return v.useCallback(()=>{if(!r)return;const o=window.screenX+(window.outerWidth-Eu)/2,i=window.screenY+(window.outerHeight-Fu)/2.5,a=`width=${Eu},height=${Fu},left=${o},top=${i}`,s=window.open(r,e,a);t(s),window.addEventListener("message",n,!1)},[r,e,t,n])}function ET(e,t,n,r){const o=Ke();return v.useCallback(i=>{var a,s;if(i.origin===Ay){if(i.data.eventType===RT){const c=(a=i.data.data)==null?void 0:a.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===xT&&(console.error("OAuth failed: ",{event:i}),n==null||n(((s=i==null?void 0:i.data)==null?void 0:s.message)??"Something went wrong. Please try again."))}},[t,n,o,e,r])}function FT({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:o,onSuccessConnect:i,isSuccessConnect:a,onWindowClose:s}){const[c,p]=v.useState(null),[l,d]=v.useState(null),h=Ke(),m=v.useRef(null),S=ET(p,l,r,i),I=AT(n,d,S,t);v.useEffect(()=>{t&&!l&&!c&&!o&&!a&&(r==null||r(null),I())},[t,l,I,c,o,a,r]);const f=v.useCallback(()=>{h.invalidateQueries({queryKey:["amp","connections"]}),d(null),!c&&!o?console.error("Window closed and no connection was found. Please try again."):c&&(r==null||r(null)),s==null||s()},[c,o,r,s,h]);return v.useEffect(()=>{if(l)return m.current=setInterval(()=>{l!=null&&l.closed&&(m.current&&clearInterval(m.current),m.current=null,f())},500),()=>{m.current&&(clearInterval(m.current),m.current=null),window.removeEventListener("message",S)}},[f,l,S]),u.jsx("div",{children:e})}const _T=()=>{const e=ot(),t=Ke();return vn({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 PT({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return u.jsxs("div",{style:{padding:"1rem 0"},children:[u.jsx("p",{children:`Re-authenticate to ${r}`}),u.jsx(Sn,{error:t}),u.jsx(Xe,{variant:"ghost",style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function DT({provider:e}){const{selectedConnection:t,isConnectionsLoading:n}=Zt(),r=t==null?void 0:t.id,o=t==null?void 0:t.projectId,{providerName:i}=lt(e),{mutateAsync:a,isPending:s,error:c}=_T(),[p,l]=v.useState(null),[d,h]=v.useState(!1),[m,S]=v.useState(null),I=()=>{h(!1)},f=()=>{h(!0),l(null),S(null)},C=(c==null?void 0:c.message)||p||null,g=async()=>{I(),l(null);try{const b=await a({projectIdOrName:o||"",connectionId:r||""});S(b)}catch(b){Be(b,l)}},O=v.useCallback(b=>{l(b)},[]);return u.jsxs(u.Fragment,{children:[u.jsx(Rt,{string:"Update connection"}),d&&u.jsx(Do,{children:"Connection updated successfully"}),u.jsx(FT,{windowTitle:`Connect to ${i}`,oauthUrl:m||null,onError:O,error:C,isSuccessConnect:d,onSuccessConnect:f,children:u.jsx(PT,{handleSubmit:g,error:C,providerName:i,isButtonDisabled:s||n||d})})]})}function Cc({provider:e}){var r;const{data:t}=Po(e);if((t==null?void 0:t.authType)===Fa.Basic)return u.jsx(NT,{provider:e});if((t==null?void 0:t.authType)===Fa.ApiKey)return u.jsx(ST,{provider:e});const n=(r=t==null?void 0:t.oauth2Opts)==null?void 0:r.grantType;if(n){if(n===ao.AuthorizationCode||n===ao.AuthorizationCodePkce)return u.jsx(DT,{provider:e});if(n===ao.ClientCredentials)return u.jsx(TT,{provider:e})}return null}const MT=()=>{const e=ot(),t=Ke();return vn({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 cO({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:o,onDisconnectError:i}){const{projectId:a}=Ee(),{selectedConnection:s}=Zt(),c=MT(),[p,l]=v.useState(!1),d=!a||!s||!s.id||p,h=async()=>{d||(l(!0),console.warn("deleting connection",{projectId:a,connectionId:s==null?void 0:s.id}),c.mutate({projectIdOrName:a,connectionId:s==null?void 0:s.id},{onSuccess:()=>{console.warn("successfully deleted connection:",s==null?void 0:s.id),r==null||r(s),o()},onError:I=>{Be(I,i)},onSettled:()=>l(!1)}))},m=p?"Disconnecting...":e;return u.jsx(Xe,{type:"button",onClick:h,disabled:d,variant:t,style:n,children:m})}const uO=v.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),ei=()=>{const e=v.useContext(uO);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e},JT=()=>{var p;const e=Ke(),t=ot(),{selectedConnection:n,isConnectionsLoading:r}=Zt(),{projectIdOrName:o}=Ee(),{integrationId:i,integrationObj:a}=at(),s=n==null?void 0:n.id,c=(p=a==null?void 0:a.latestRevision)==null?void 0:p.id;return v.useEffect(()=>{s||e.invalidateQueries({queryKey:["amp","hydratedRevision"]})},[s,e]),Wn({queryKey:["amp","hydratedRevision",o,i,c,s],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(!s)throw new Error("connectionId is required");return(await t()).revisionApi.getHydratedRevision({projectIdOrName:o,integrationId:i,revisionId:c,connectionId:s})},retry:3,enabled:!!o&&!!i&&!!c&&!!s&&!r})};function kT({children:e,resetComponent:t}){const{integrationId:n,integrationObj:r}=at(),{isError:o,removeError:i,setError:a}=Jt(),s=(r==null?void 0:r.name)||n,[c,p]=v.useState(null),[l,d]=v.useState(null),{data:h,isLoading:m,isError:S,error:I}=JT();v.useEffect(()=>{S?(a(de.HYDRATED_REVISION,s),Be(I,p)):(i(de.HYDRATED_REVISION,s),p(null),d(null))},[S,s,a,i,I,p]);const f=v.useMemo(()=>{var g,O,b;return{hydratedRevision:h||null,loading:m,readAction:(g=h==null?void 0:h.content)==null?void 0:g.read,writeObjects:((b=(O=h==null?void 0:h.content)==null?void 0:O.write)==null?void 0:b.objects)||[]}},[h,m]);if(m)return u.jsx(Zr,{});const C=(r==null?void 0:r.provider)||"provider";if(o(de.HYDRATED_REVISION,s)){const g=(r==null?void 0:r.name)||n||"unknown integration",O=`${c?`: ${c}`:`Error retrieving objects from ${C} or integration details for ${g}`}`;return u.jsx(Gt,{message:O,children:u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",paddingTop:"1rem",width:"100%"},children:[u.jsx(Cc,{provider:C}),u.jsx("p",{children:"If authentication is failing, please try reauthenticating using the section above before deleting and recreating the connection."}),l&&u.jsx(My,{message:l}),u.jsx(cO,{buttonText:"Delete Connection",resetComponent:t,buttonVariant:"danger",onDisconnectError:b=>d(b)})]})})}return u.jsx(uO.Provider,{value:f,children:e})}function yn(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 ge(){return ge=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},ge.apply(null,arguments)}function Ka(e,t){return Ka=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Ka(e,t)}function qT(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Ka(e,t)}var Ua={exports:{}},Qi={exports:{}},Ne={};/** @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 _u;function KT(){if(_u)return Ne;_u=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,a=e?Symbol.for("react.provider"):60109,s=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,p=e?Symbol.for("react.concurrent_mode"):60111,l=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,h=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,S=e?Symbol.for("react.lazy"):60116,I=e?Symbol.for("react.block"):60121,f=e?Symbol.for("react.fundamental"):60117,C=e?Symbol.for("react.responder"):60118,g=e?Symbol.for("react.scope"):60119;function O(N){if(typeof N=="object"&&N!==null){var R=N.$$typeof;switch(R){case t:switch(N=N.type,N){case c:case p:case r:case i:case o:case d:return N;default:switch(N=N&&N.$$typeof,N){case s:case l:case S:case m:case a:return N;default:return R}}case n:return R}}}function b(N){return O(N)===p}return Ne.AsyncMode=c,Ne.ConcurrentMode=p,Ne.ContextConsumer=s,Ne.ContextProvider=a,Ne.Element=t,Ne.ForwardRef=l,Ne.Fragment=r,Ne.Lazy=S,Ne.Memo=m,Ne.Portal=n,Ne.Profiler=i,Ne.StrictMode=o,Ne.Suspense=d,Ne.isAsyncMode=function(N){return b(N)||O(N)===c},Ne.isConcurrentMode=b,Ne.isContextConsumer=function(N){return O(N)===s},Ne.isContextProvider=function(N){return O(N)===a},Ne.isElement=function(N){return typeof N=="object"&&N!==null&&N.$$typeof===t},Ne.isForwardRef=function(N){return O(N)===l},Ne.isFragment=function(N){return O(N)===r},Ne.isLazy=function(N){return O(N)===S},Ne.isMemo=function(N){return O(N)===m},Ne.isPortal=function(N){return O(N)===n},Ne.isProfiler=function(N){return O(N)===i},Ne.isStrictMode=function(N){return O(N)===o},Ne.isSuspense=function(N){return O(N)===d},Ne.isValidElementType=function(N){return typeof N=="string"||typeof N=="function"||N===r||N===p||N===i||N===o||N===d||N===h||typeof N=="object"&&N!==null&&(N.$$typeof===S||N.$$typeof===m||N.$$typeof===a||N.$$typeof===s||N.$$typeof===l||N.$$typeof===f||N.$$typeof===C||N.$$typeof===g||N.$$typeof===I)},Ne.typeOf=O,Ne}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 Pu;function UT(){return Pu||(Pu=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,a=e?Symbol.for("react.provider"):60109,s=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,p=e?Symbol.for("react.concurrent_mode"):60111,l=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,h=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,S=e?Symbol.for("react.lazy"):60116,I=e?Symbol.for("react.block"):60121,f=e?Symbol.for("react.fundamental"):60117,C=e?Symbol.for("react.responder"):60118,g=e?Symbol.for("react.scope"):60119;function O(L){return typeof L=="string"||typeof L=="function"||L===r||L===p||L===i||L===o||L===d||L===h||typeof L=="object"&&L!==null&&(L.$$typeof===S||L.$$typeof===m||L.$$typeof===a||L.$$typeof===s||L.$$typeof===l||L.$$typeof===f||L.$$typeof===C||L.$$typeof===g||L.$$typeof===I)}function b(L){if(typeof L=="object"&&L!==null){var Se=L.$$typeof;switch(Se){case t:var G=L.type;switch(G){case c:case p:case r:case i:case o:case d:return G;default:var Ae=G&&G.$$typeof;switch(Ae){case s:case l:case S:case m:case a:return Ae;default:return Se}}case n:return Se}}}var N=c,R=p,E=s,x=a,_=t,F=l,k=r,J=S,q=m,$=n,te=i,ee=o,oe=d,Oe=!1;function we(L){return Oe||(Oe=!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.")),D(L)||b(L)===c}function D(L){return b(L)===p}function B(L){return b(L)===s}function W(L){return b(L)===a}function j(L){return typeof L=="object"&&L!==null&&L.$$typeof===t}function V(L){return b(L)===l}function K(L){return b(L)===r}function ne(L){return b(L)===S}function re(L){return b(L)===m}function z(L){return b(L)===n}function ie(L){return b(L)===i}function Y(L){return b(L)===o}function fe(L){return b(L)===d}Ce.AsyncMode=N,Ce.ConcurrentMode=R,Ce.ContextConsumer=E,Ce.ContextProvider=x,Ce.Element=_,Ce.ForwardRef=F,Ce.Fragment=k,Ce.Lazy=J,Ce.Memo=q,Ce.Portal=$,Ce.Profiler=te,Ce.StrictMode=ee,Ce.Suspense=oe,Ce.isAsyncMode=we,Ce.isConcurrentMode=D,Ce.isContextConsumer=B,Ce.isContextProvider=W,Ce.isElement=j,Ce.isForwardRef=V,Ce.isFragment=K,Ce.isLazy=ne,Ce.isMemo=re,Ce.isPortal=z,Ce.isProfiler=ie,Ce.isStrictMode=Y,Ce.isSuspense=fe,Ce.isValidElementType=O,Ce.typeOf=b}()),Ce}var Du;function lO(){return Du||(Du=1,process.env.NODE_ENV==="production"?Qi.exports=KT():Qi.exports=UT()),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 ra,Mu;function LT(){if(Mu)return ra;Mu=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 a={},s=0;s<10;s++)a["_"+String.fromCharCode(s)]=s;var c=Object.getOwnPropertyNames(a).map(function(l){return a[l]});if(c.join("")!=="0123456789")return!1;var p={};return"abcdefghijklmnopqrst".split("").forEach(function(l){p[l]=l}),Object.keys(Object.assign({},p)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return ra=o()?Object.assign:function(i,a){for(var s,c=r(i),p,l=1;l<arguments.length;l++){s=Object(arguments[l]);for(var d in s)t.call(s,d)&&(c[d]=s[d]);if(e){p=e(s);for(var h=0;h<p.length;h++)n.call(s,p[h])&&(c[p[h]]=s[p[h]])}}return c},ra}var ia,Ju;function Tc(){if(Ju)return ia;Ju=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return ia=e,ia}var oa,ku;function dO(){return ku||(ku=1,oa=Function.call.bind(Object.prototype.hasOwnProperty)),oa}var aa,qu;function BT(){if(qu)return aa;qu=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Tc(),n={},r=dO();e=function(i){var a="Warning: "+i;typeof console<"u"&&console.error(a);try{throw new Error(a)}catch{}}}function o(i,a,s,c,p){if(process.env.NODE_ENV!=="production"){for(var l in i)if(r(i,l)){var d;try{if(typeof i[l]!="function"){var h=Error((c||"React class")+": "+s+" type `"+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[l]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw h.name="Invariant Violation",h}d=i[l](a,l,c,s,null,t)}catch(S){d=S}if(d&&!(d instanceof Error)&&e((c||"React class")+": type specification of "+s+" `"+l+"` 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 m=p?p():"";e("Failed "+s+" type: "+d.message+(m??""))}}}}return o.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},aa=o,aa}var sa,Ku;function VT(){if(Ku)return sa;Ku=1;var e=lO(),t=LT(),n=Tc(),r=dO(),o=BT(),i=function(){};process.env.NODE_ENV!=="production"&&(i=function(s){var c="Warning: "+s;typeof console<"u"&&console.error(c);try{throw new Error(c)}catch{}});function a(){return null}return sa=function(s,c){var p=typeof Symbol=="function"&&Symbol.iterator,l="@@iterator";function d(D){var B=D&&(p&&D[p]||D[l]);if(typeof B=="function")return B}var h="<<anonymous>>",m={array:C("array"),bigint:C("bigint"),bool:C("boolean"),func:C("function"),number:C("number"),object:C("object"),string:C("string"),symbol:C("symbol"),any:g(),arrayOf:O,element:b(),elementType:N(),instanceOf:R,node:F(),objectOf:x,oneOf:E,oneOfType:_,shape:J,exact:q};function S(D,B){return D===B?D!==0||1/D===1/B:D!==D&&B!==B}function I(D,B){this.message=D,this.data=B&&typeof B=="object"?B:{},this.stack=""}I.prototype=Error.prototype;function f(D){if(process.env.NODE_ENV!=="production")var B={},W=0;function j(K,ne,re,z,ie,Y,fe){if(z=z||h,Y=Y||re,fe!==n){if(c){var L=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 L.name="Invariant Violation",L}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var Se=z+":"+re;!B[Se]&&W<3&&(i("You are manually calling a React.PropTypes validation function for the `"+Y+"` prop on `"+z+"`. 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."),B[Se]=!0,W++)}}return ne[re]==null?K?ne[re]===null?new I("The "+ie+" `"+Y+"` is marked as required "+("in `"+z+"`, but its value is `null`.")):new I("The "+ie+" `"+Y+"` is marked as required in "+("`"+z+"`, but its value is `undefined`.")):null:D(ne,re,z,ie,Y)}var V=j.bind(null,!1);return V.isRequired=j.bind(null,!0),V}function C(D){function B(W,j,V,K,ne,re){var z=W[j],ie=ee(z);if(ie!==D){var Y=oe(z);return new I("Invalid "+K+" `"+ne+"` of type "+("`"+Y+"` supplied to `"+V+"`, expected ")+("`"+D+"`."),{expectedType:D})}return null}return f(B)}function g(){return f(a)}function O(D){function B(W,j,V,K,ne){if(typeof D!="function")return new I("Property `"+ne+"` of component `"+V+"` has invalid PropType notation inside arrayOf.");var re=W[j];if(!Array.isArray(re)){var z=ee(re);return new I("Invalid "+K+" `"+ne+"` of type "+("`"+z+"` supplied to `"+V+"`, expected an array."))}for(var ie=0;ie<re.length;ie++){var Y=D(re,ie,V,K,ne+"["+ie+"]",n);if(Y instanceof Error)return Y}return null}return f(B)}function b(){function D(B,W,j,V,K){var ne=B[W];if(!s(ne)){var re=ee(ne);return new I("Invalid "+V+" `"+K+"` of type "+("`"+re+"` supplied to `"+j+"`, expected a single ReactElement."))}return null}return f(D)}function N(){function D(B,W,j,V,K){var ne=B[W];if(!e.isValidElementType(ne)){var re=ee(ne);return new I("Invalid "+V+" `"+K+"` of type "+("`"+re+"` supplied to `"+j+"`, expected a single ReactElement type."))}return null}return f(D)}function R(D){function B(W,j,V,K,ne){if(!(W[j]instanceof D)){var re=D.name||h,z=we(W[j]);return new I("Invalid "+K+" `"+ne+"` of type "+("`"+z+"` supplied to `"+V+"`, expected ")+("instance of `"+re+"`."))}return null}return f(B)}function E(D){if(!Array.isArray(D))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.")),a;function B(W,j,V,K,ne){for(var re=W[j],z=0;z<D.length;z++)if(S(re,D[z]))return null;var ie=JSON.stringify(D,function(fe,L){var Se=oe(L);return Se==="symbol"?String(L):L});return new I("Invalid "+K+" `"+ne+"` of value `"+String(re)+"` "+("supplied to `"+V+"`, expected one of "+ie+"."))}return f(B)}function x(D){function B(W,j,V,K,ne){if(typeof D!="function")return new I("Property `"+ne+"` of component `"+V+"` has invalid PropType notation inside objectOf.");var re=W[j],z=ee(re);if(z!=="object")return new I("Invalid "+K+" `"+ne+"` of type "+("`"+z+"` supplied to `"+V+"`, expected an object."));for(var ie in re)if(r(re,ie)){var Y=D(re,ie,V,K,ne+"."+ie,n);if(Y instanceof Error)return Y}return null}return f(B)}function _(D){if(!Array.isArray(D))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),a;for(var B=0;B<D.length;B++){var W=D[B];if(typeof W!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+Oe(W)+" at index "+B+"."),a}function j(V,K,ne,re,z){for(var ie=[],Y=0;Y<D.length;Y++){var fe=D[Y],L=fe(V,K,ne,re,z,n);if(L==null)return null;L.data&&r(L.data,"expectedType")&&ie.push(L.data.expectedType)}var Se=ie.length>0?", expected one of type ["+ie.join(", ")+"]":"";return new I("Invalid "+re+" `"+z+"` supplied to "+("`"+ne+"`"+Se+"."))}return f(j)}function F(){function D(B,W,j,V,K){return $(B[W])?null:new I("Invalid "+V+" `"+K+"` supplied to "+("`"+j+"`, expected a ReactNode."))}return f(D)}function k(D,B,W,j,V){return new I((D||"React class")+": "+B+" type `"+W+"."+j+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+V+"`.")}function J(D){function B(W,j,V,K,ne){var re=W[j],z=ee(re);if(z!=="object")return new I("Invalid "+K+" `"+ne+"` of type `"+z+"` "+("supplied to `"+V+"`, expected `object`."));for(var ie in D){var Y=D[ie];if(typeof Y!="function")return k(V,K,ne,ie,oe(Y));var fe=Y(re,ie,V,K,ne+"."+ie,n);if(fe)return fe}return null}return f(B)}function q(D){function B(W,j,V,K,ne){var re=W[j],z=ee(re);if(z!=="object")return new I("Invalid "+K+" `"+ne+"` of type `"+z+"` "+("supplied to `"+V+"`, expected `object`."));var ie=t({},W[j],D);for(var Y in ie){var fe=D[Y];if(r(D,Y)&&typeof fe!="function")return k(V,K,ne,Y,oe(fe));if(!fe)return new I("Invalid "+K+" `"+ne+"` key `"+Y+"` supplied to `"+V+"`.\nBad object: "+JSON.stringify(W[j],null," ")+`
|
|
29
|
+
Valid keys: `+JSON.stringify(Object.keys(D),null," "));var L=fe(re,Y,V,K,ne+"."+Y,n);if(L)return L}return null}return f(B)}function $(D){switch(typeof D){case"number":case"string":case"undefined":return!0;case"boolean":return!D;case"object":if(Array.isArray(D))return D.every($);if(D===null||s(D))return!0;var B=d(D);if(B){var W=B.call(D),j;if(B!==D.entries){for(;!(j=W.next()).done;)if(!$(j.value))return!1}else for(;!(j=W.next()).done;){var V=j.value;if(V&&!$(V[1]))return!1}}else return!1;return!0;default:return!1}}function te(D,B){return D==="symbol"?!0:B?B["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&B instanceof Symbol:!1}function ee(D){var B=typeof D;return Array.isArray(D)?"array":D instanceof RegExp?"object":te(B,D)?"symbol":B}function oe(D){if(typeof D>"u"||D===null)return""+D;var B=ee(D);if(B==="object"){if(D instanceof Date)return"date";if(D instanceof RegExp)return"regexp"}return B}function Oe(D){var B=oe(D);switch(B){case"array":case"object":return"an "+B;case"boolean":case"date":case"regexp":return"a "+B;default:return B}}function we(D){return!D.constructor||!D.constructor.name?h:D.constructor.name}return m.checkPropTypes=o,m.resetWarningCache=o.resetWarningCache,m.PropTypes=m,m},sa}var ca,Uu;function $T(){if(Uu)return ca;Uu=1;var e=Tc();function t(){}function n(){}return n.resetWarningCache=t,ca=function(){function r(a,s,c,p,l,d){if(d!==e){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}r.isRequired=r;function 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},ca}if(process.env.NODE_ENV!=="production"){var jT=lO(),HT=!0;Ua.exports=VT()(jT.isElement,HT)}else Ua.exports=$T()();var WT=Ua.exports;const H=wc(WT);var La={exports:{}},Te={};/**
|
|
30
30
|
* @license React
|
|
31
31
|
* react-is.production.min.js
|
|
32
32
|
*
|
|
@@ -34,7 +34,7 @@ Valid keys: `+JSON.stringify(Object.keys(P),null," "));var k=de(ne,Q,L,D,te+"."
|
|
|
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 Lu;function zT(){if(Lu)return Te;Lu=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"),a=Symbol.for("react.context"),s=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),S;S=Symbol.for("react.module.reference");function I(f){if(typeof f=="object"&&f!==null){var C=f.$$typeof;switch(C){case e:switch(f=f.type,f){case n:case o:case r:case p:case l:return f;default:switch(f=f&&f.$$typeof,f){case s:case a:case c:case h:case d:case i:return f;default:return C}}case t:return C}}}return Te.ContextConsumer=a,Te.ContextProvider=i,Te.Element=e,Te.ForwardRef=c,Te.Fragment=n,Te.Lazy=h,Te.Memo=d,Te.Portal=t,Te.Profiler=o,Te.StrictMode=r,Te.Suspense=p,Te.SuspenseList=l,Te.isAsyncMode=function(){return!1},Te.isConcurrentMode=function(){return!1},Te.isContextConsumer=function(f){return I(f)===a},Te.isContextProvider=function(f){return I(f)===i},Te.isElement=function(f){return typeof f=="object"&&f!==null&&f.$$typeof===e},Te.isForwardRef=function(f){return I(f)===c},Te.isFragment=function(f){return I(f)===n},Te.isLazy=function(f){return I(f)===h},Te.isMemo=function(f){return I(f)===d},Te.isPortal=function(f){return I(f)===t},Te.isProfiler=function(f){return I(f)===o},Te.isStrictMode=function(f){return I(f)===r},Te.isSuspense=function(f){return I(f)===p},Te.isSuspenseList=function(f){return I(f)===l},Te.isValidElementType=function(f){return typeof f=="string"||typeof f=="function"||f===n||f===o||f===r||f===p||f===l||f===m||typeof f=="object"&&f!==null&&(f.$$typeof===h||f.$$typeof===d||f.$$typeof===i||f.$$typeof===a||f.$$typeof===c||f.$$typeof===S||f.getModuleId!==void 0)},Te.typeOf=I,Te}var Re={};/**
|
|
38
38
|
* @license React
|
|
39
39
|
* react-is.development.js
|
|
40
40
|
*
|
|
@@ -42,11 +42,11 @@ Valid keys: `+JSON.stringify(Object.keys(P),null," "));var k=de(ne,Q,L,D,te+"."
|
|
|
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 dc;function Vv(){return dc||(dc=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"),I=!1,v=!1,p=!1,C=!1,m=!1,w;w=Symbol.for("react.module.reference");function x(J){return!!(typeof J=="string"||typeof J=="function"||J===n||J===o||m||J===r||J===f||J===u||C||J===h||I||v||p||typeof J=="object"&&J!==null&&(J.$$typeof===g||J.$$typeof===d||J.$$typeof===i||J.$$typeof===s||J.$$typeof===c||J.$$typeof===w||J.getModuleId!==void 0))}function _(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 _(J)===s}function V(J){return _(J)===i}function L(J){return typeof J=="object"&&J!==null&&J.$$typeof===e}function D(J){return _(J)===c}function te(J){return _(J)===n}function ne(J){return _(J)===g}function B(J){return _(J)===d}function re(J){return _(J)===t}function Q(J){return _(J)===o}function de(J){return _(J)===r}function k(J){return _(J)===f}function we(J){return _(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=x,Oe.typeOf=_}()),Oe}process.env.NODE_ENV==="production"?ws.exports=Kv():ws.exports=Vv();var fc=ws.exports;const pc=e=>typeof e=="object"&&e!=null&&e.nodeType===1,hc=(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 hc(n.overflowY,t)||hc(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(!pc(e))throw new TypeError("Invalid target");const g=document.scrollingElement||document.documentElement,h=[];let I=e;for(;pc(I)&&d(I);){if(I=Uv(I),I===g){h.push(I);break}I!=null&&I===document.body&&Wo(I)&&!Wo(document.documentElement)||I!=null&&Wo(I,u)&&h.push(I)}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:C,scrollY:m}=window,{height:w,width:x,top:_,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"?_-A:a==="end"?R+z:_+w/2-A+z,q=c==="center"?N+x/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"&&_>=0&&N>=0&&R<=p&&S<=v&&_>=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+w,w):ee-p/2,Q=c==="start"?q:c==="center"?q-v/2:c==="end"?q-v:Hi(C,C+v,v,D,ne,C+q,C+q+x,x),re=Math.max(0,re+m),Q=Math.max(0,Q+C);else{re=a==="start"?ee-P-te:a==="end"?ee-$+B+k:a==="nearest"?Hi(P,$,fe,te,B+k,ee,ee+w,w):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+x,x);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 Lr=function(){return Lr=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},Lr.apply(this,arguments)};var qv=0;function mc(e){return typeof e=="function"?e:xt}function xt(){}function Iu(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 gc(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function Js(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 Cr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){t.forEach(function(o){typeof o=="function"?o(r):o&&(o.current=r)})}}function bu(){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 yc(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function Cu(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 Is(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=Kr(a,t<0,n,r,o);return c===-1?e>=i?-1:e:c}function Kr(e,t,n,r,o){o===void 0&&(o=!1);var i=n.length;if(t){for(var s=e;s>=0;s--)if(!r(n[s],s))return s}else for(var a=e;a<i;a++)if(!r(n[a],a))return a;return o?Kr(t?i-1:0,t,n,r):-1}function so(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(o){return o&&(gc(o,e,n)||r&&gc(o,n.document.activeElement,n))})}var Ws=xt;process.env.NODE_ENV!=="production"&&(Ws=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=Js(function(e){_u(e).textContent=""},500);function _u(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 Ou(e,t){if(!(!e||!t)){var n=_u(t);n.textContent=e,zv(t)}}function Gv(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var Eu=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,Su=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,Nu=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,Tu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,Ru=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,Au=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,Pu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,Fu=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,Du=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,Mu=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,ku=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,bs=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,ju=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,Lu=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,Ku=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,Qv=Object.freeze({__proto__:null,blurButton:ju,blurInput:Du,changeInput:Mu,clickButton:bs,clickItem:Fu,controlledPropUpdatedSelectedItem:Lu,itemMouseEnter:Nu,keyDownArrowDown:Xi,keyDownArrowUp:Qi,keyDownEnd:Pu,keyDownEnter:Ru,keyDownEscape:Tu,keyDownHome:Au,keyDownSpaceButton:ku,mouseUp:Su,touchEnd:Ku,unknown:Eu}),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-"+bu(),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,w){var x=setTimeout(function(){i.timeoutIds=i.timeoutIds.filter(function(_){return _!==x}),m()},w);i.timeoutIds.push(x)},i.setItemCount=function(m){i.itemCount=m},i.unsetItemCount=function(){i.itemCount=null},i.isItemDisabled=function(m,w){var x=i.getItemNodeFromIndex(w);return x&&x.hasAttribute("disabled")},i.setHighlightedIndex=function(m,w){m===void 0&&(m=i.props.defaultHighlightedIndex),w===void 0&&(w={}),w=Bi(w),i.internalSetState(me({highlightedIndex:m},w))},i.clearSelection=function(m){i.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:i.props.defaultHighlightedIndex,isOpen:i.props.defaultIsOpen},m)},i.selectItem=function(m,w,x){w=Bi(w),i.internalSetState(me({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,selectedItem:m,inputValue:i.props.itemToString(m)},w),x)},i.selectItemAtIndex=function(m,w,x){var _=i.items[m];_!=null&&i.selectItem(_,w,x)},i.selectHighlightedItem=function(m,w){return i.selectItemAtIndex(i.getState().highlightedIndex,m,w)},i.internalSetState=function(m,w){var x,_,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),x=K.hasOwnProperty("selectedItem");var z={};return x&&K.selectedItem!==N.selectedItem&&(_=K.selectedItem),(A=K).type||(A.type=Eu),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(){mc(w)();var N=Object.keys(S).length>1;N&&i.props.onStateChange(S,i.getStateAndHelpers()),x&&i.props.onSelect(m.selectedItem,i.getStateAndHelpers()),_!==void 0&&i.props.onChange(_,i.getStateAndHelpers()),i.props.onUserAction(S,i.getStateAndHelpers())})},i.rootRef=function(m){return i._rootNode=m},i.getRootProps=function(m,w){var x,_=m===void 0?{}:m,S=_.refKey,R=S===void 0?"ref":S,N=_.ref,A=mn(_,Xv),K=w===void 0?{}:w,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((x={},x[R]=Cr(N,i.rootRef),x.role="combobox",x["aria-expanded"]=q,x["aria-haspopup"]="listbox",x["aria-owns"]=q?i.menuId:void 0,x["aria-labelledby"]=i.labelId,x),A)},i.keyDownHandlers={ArrowDown:function(w){var x=this;if(w.preventDefault(),this.getState().isOpen){var _=w.shiftKey?5:1;this.moveHighlightedIndex(_,{type:Xi})}else this.internalSetState({isOpen:!0,type:Xi},function(){var S=x.getItemCount();if(S>0){var R=x.getState(),N=R.highlightedIndex,A=Yn(N,1,{length:S},x.isItemDisabled,!0);x.setHighlightedIndex(A,{type:Xi})}})},ArrowUp:function(w){var x=this;if(w.preventDefault(),this.getState().isOpen){var _=w.shiftKey?-5:-1;this.moveHighlightedIndex(_,{type:Qi})}else this.internalSetState({isOpen:!0,type:Qi},function(){var S=x.getItemCount();if(S>0){var R=x.getState(),N=R.highlightedIndex,A=Yn(N,-1,{length:S},x.isItemDisabled,!0);x.setHighlightedIndex(A,{type:Qi})}})},Enter:function(w){if(w.which!==229){var x=this.getState(),_=x.isOpen,S=x.highlightedIndex;if(_&&S!=null){w.preventDefault();var R=this.items[S],N=this.getItemNodeFromIndex(S);if(R==null||N&&N.hasAttribute("disabled"))return;this.selectHighlightedItem({type:Ru})}}},Escape:function(w){w.preventDefault(),this.reset(me({type:Tu},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},i.buttonKeyDownHandlers=me({},i.keyDownHandlers,{" ":function(w){w.preventDefault(),this.toggleMenu({type:ku})}}),i.inputKeyDownHandlers=me({},i.keyDownHandlers,{Home:function(w){var x=this.getState(),_=x.isOpen;if(_){w.preventDefault();var S=this.getItemCount();if(!(S<=0||!_)){var R=Kr(0,!1,{length:S},this.isItemDisabled);this.setHighlightedIndex(R,{type:Au})}}},End:function(w){var x=this.getState(),_=x.isOpen;if(_){w.preventDefault();var S=this.getItemCount();if(!(S<=0||!_)){var R=Kr(S-1,!0,{length:S},this.isItemDisabled);this.setHighlightedIndex(R,{type:Pu})}}}}),i.getToggleButtonProps=function(m){var w=m===void 0?{}:m,x=w.onClick;w.onPress;var _=w.onKeyDown,S=w.onKeyUp,R=w.onBlur,N=mn(w,Yv),A=i.getState(),K=A.isOpen,z={onClick:Be(x,i.buttonHandleClick),onKeyDown:Be(_,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 w=Is(m);i.buttonKeyDownHandlers[w]&&i.buttonKeyDownHandlers[w].call(i,m)},i.buttonHandleClick=function(m){if(m.preventDefault(),i.props.environment){var w=i.props.environment.document,x=w.body,_=w.activeElement;x&&x===_&&m.target.focus()}process.env.NODE_ENV==="test"?i.toggleMenu({type:bs}):i.internalSetTimeout(function(){return i.toggleMenu({type:bs})})},i.buttonHandleBlur=function(m){var w=m.target;i.internalSetTimeout(function(){if(!(i.isMouseDown||!i.props.environment)){var x=i.props.environment.document.activeElement;(x==null||x.id!==i.inputId)&&x!==w&&i.reset({type:ju})}})},i.getLabelProps=function(m){return me({htmlFor:i.inputId,id:i.labelId},m)},i.getInputProps=function(m){var w=m===void 0?{}:m,x=w.onKeyDown,_=w.onBlur,S=w.onChange,R=w.onInput;w.onChangeText;var N=mn(w,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(x,i.inputHandleKeyDown),ae.onBlur=Be(_,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 w=Is(m);w&&i.inputKeyDownHandlers[w]&&i.inputKeyDownHandlers[w].call(i,m)},i.inputHandleChange=function(m){i.internalSetState({type:Mu,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 w=i.props.environment.document.activeElement,x=(w==null||(m=w.dataset)==null?void 0:m.toggle)&&i._rootNode&&i._rootNode.contains(w);x||i.reset({type:Du})}})},i.menuRef=function(m){i._menuNode=m},i.getMenuProps=function(m,w){var x,_=m===void 0?{}:m,S=_.refKey,R=S===void 0?"ref":S,N=_.ref,A=mn(_,ew),K=w===void 0?{}:w,z=K.suppressRefError,H=z===void 0?!1:z;return i.getMenuProps.called=!0,i.getMenuProps.refKey=R,i.getMenuProps.suppressRefError=H,me((x={},x[R]=Cr(N,i.menuRef),x.role="listbox",x["aria-labelledby"]=A&&A["aria-label"]?void 0:i.labelId,x.id=i.menuId,x),A)},i.getItemProps=function(m){var w,x=m===void 0?{}:m,_=x.onMouseMove,S=x.onMouseDown,R=x.onClick;x.onPress;var N=x.index,A=x.item,K=A===void 0?process.env.NODE_ENV==="production"?void 0:Bv("getItemProps","item"):A,z=mn(x,tw);N===void 0?(i.items.push(K),N=i.items.indexOf(K)):i.items[N]=K;var H="onClick",ee=R,q=(w={onMouseMove:Be(_,function(){N!==i.getState().highlightedIndex&&(i.setHighlightedIndex(N,{type:Nu}),i.avoidScrolling=!0,i.internalSetTimeout(function(){return i.avoidScrolling=!1},250))}),onMouseDown:Be(S,function(X){X.preventDefault()})},w[H]=Be(ee,function(){i.selectItemAtIndex(N,{type:Fu})}),w),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,w){m===void 0&&(m={}),m=Bi(m),i.internalSetState(function(x){var _=x.selectedItem;return me({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,inputValue:i.props.itemToString(_)},m)},w)},i.toggleMenu=function(m,w){m===void 0&&(m={}),m=Bi(m),i.internalSetState(function(x){var _=x.isOpen;return me({isOpen:!_},_&&{highlightedIndex:i.props.defaultHighlightedIndex},m)},function(){var x=i.getState(),_=x.isOpen,S=x.highlightedIndex;_&&i.getItemCount()>0&&typeof S=="number"&&i.setHighlightedIndex(S,m),mc(w)()})},i.openMenu=function(m){i.internalSetState({isOpen:!0},m)},i.closeMenu=function(m){i.internalSetState({isOpen:!1},m)},i.updateStatus=Js(function(){var m;if((m=i.props)!=null&&(m=m.environment)!=null&&m.document){var w=i.getState(),x=i.items[w.highlightedIndex],_=i.getItemCount(),S=i.props.getA11yStatusMessage(me({itemToString:i.props.itemToString,previousResultCount:i.previousResultCount,resultCount:_,highlightedItem:x},w));i.previousResultCount=_,Ou(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,I=h===void 0?"":h,v=s.initialSelectedItem,p=v===void 0?null:v,C=i.getState({highlightedIndex:f,isOpen:g,inputValue:I,selectedItem:p});return C.selectedItem!=null&&i.props.initialInputValue===void 0&&(C.inputValue=i.props.itemToString(C.selectedItem)),i.state=C,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,I=this.getLabelProps,v=this.getMenuProps,p=this.getInputProps,C=this.getItemProps,m=this.openMenu,w=this.closeMenu,x=this.toggleMenu,_=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:I,getMenuProps:v,getInputProps:p,getItemProps:C,reset:z,openMenu:m,closeMenu:w,toggleMenu:x,selectItem:_,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&&vc(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 I=so(h.target,[i._rootNode,i._menuNode],i.props.environment);!I&&i.getState().isOpen&&i.reset({type:Su},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},c=function(){i.isTouchMove=!1},f=function(){i.isTouchMove=!0},u=function(h){var I=so(h.target,[i._rootNode,i._menuNode],i.props.environment,!1);!i.isTouchMove&&!I&&i.getState().isOpen&&i.reset({type:Ku},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"&&(Ws(this.state,i,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&vc(this._menuNode,this.getMenuProps)),oo(this.props,"selectedItem")&&this.props.selectedItemChanged(i.selectedItem,this.props.selectedItem)&&this.internalSetState({type:Lu,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=yc(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=yc(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(Cu(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:Iu},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 vc(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=!Cu(e);o&&!r&&!fc.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+'"'),!fc.isForwardRef(e)&&!xu(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Vu={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"+zs(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 wc=Js(function(e,t){Ou(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-"+bu():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 zs(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Uu(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,I){i.current=I,h=io(h,I.props);var v=e(h,I),p=I.props.stateReducer(h,me({},I,{changes:v}));return p},[e]),a=y.useReducer(s,t,n),c=a[0],f=a[1],u=Uu(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),I=g&&o.current&&!r(h,c);I&&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:Iu,environment:typeof window>"u"?void 0:window};function Kn(e,t,n){n===void 0&&(n=Vu);var r=e["default"+zs(t)];return r!==void 0?r:n[t]}function oi(e,t,n){n===void 0&&(n=Vu);var r=e[t];if(r!==void 0)return r;var o=e["initial"+zs(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 $u=function(){return xt};process.env.NODE_ENV!=="production"&&($u=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);wc(s,o)}},n),y.useEffect(function(){return function(){wc.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 qu=xt;process.env.NODE_ENV!=="production"&&(qu=function(t){var n=t.props,r=t.state,o=y.useRef(n),i=vo();y.useEffect(function(){i||(Ws(r,o.current,n),o.current=n)},[r,n,i])});function Ic(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},Hu=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)}Lr(Lr({},Hu),{items:U.array.isRequired,isItemDisabled:U.func});Lr(Lr({},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 Gs=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,Qs=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,Xs=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,Ys=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,Zs=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,ea=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,ta=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,na=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,ra=process.env.NODE_ENV!=="production"?"__input_change__":8,ao=process.env.NODE_ENV!=="production"?"__input_blur__":9,ia=process.env.NODE_ENV!=="production"?"__input_click__":10,Bu=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,Ju=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,oa=process.env.NODE_ENV!=="production"?"__item_click__":13,Wu=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,zu=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,Gu=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,Qu=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,Xu=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,sa=process.env.NODE_ENV!=="production"?"__function_select_item__":19,Yu=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,Zu=process.env.NODE_ENV!=="production"?"__function_reset__":21,aa=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,ed=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:aa,FunctionCloseMenu:Qu,FunctionOpenMenu:Gu,FunctionReset:Zu,FunctionSelectItem:sa,FunctionSetHighlightedIndex:Xu,FunctionSetInputValue:Yu,FunctionToggleMenu:zu,InputBlur:ao,InputChange:ra,InputClick:ia,InputKeyDownArrowDown:Gs,InputKeyDownArrowUp:Qs,InputKeyDownEnd:Zs,InputKeyDownEnter:na,InputKeyDownEscape:Xs,InputKeyDownHome:Ys,InputKeyDownPageDown:ta,InputKeyDownPageUp:ea,ItemClick:oa,ItemMouseMove:Ju,MenuMouseLeave:Bu,ToggleButtonClick:Wu});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({},Hu,{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:aa,inputValue:t.itemToString(t.selectedItem)})}o.current=s.selectedItem===o.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[io(s,t),a]}var td=xt;process.env.NODE_ENV!=="production"&&(td=function(t,n){U.checkPropTypes(ww,t,"prop",n.name)});var bw=me({},ii,{isItemDisabled:function(){return!1}});function Cw(e,t){var n,r=t.type,o=t.props,i=t.altKey,s;switch(r){case oa:s={isOpen:Kn(o,"isOpen"),highlightedIndex:Cs(o),selectedItem:o.items[t.index],inputValue:o.itemToString(o.items[t.index])};break;case Gs: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 Qs:e.isOpen?i?s=Ic(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 na:s=Ic(o,e.highlightedIndex);break;case Xs:s=me({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case ea:s={highlightedIndex:Yn(e.highlightedIndex,-10,o.items,o.isItemDisabled,!0)};break;case ta:s={highlightedIndex:Yn(e.highlightedIndex,10,o.items,o.isItemDisabled,!0)};break;case Ys:s={highlightedIndex:Kr(0,!1,o.items,o.isItemDisabled)};break;case Zs:s={highlightedIndex:Kr(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 ra:s={isOpen:!0,highlightedIndex:Cs(o),inputValue:t.inputValue};break;case ia:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:si(o,e,0)};break;case sa:s={selectedItem:t.selectedItem,inputValue:o.itemToString(t.selectedItem)};break;case aa:s={inputValue:t.inputValue};break;default:return yw(e,t,ed)}return me({},e,s)}var xw=["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"];ca.stateChangeTypes=ed;function ca(e){e===void 0&&(e={}),td(e,ca);var t=me({},bw,e),n=t.items,r=t.scrollIntoView,o=t.environment,i=t.getA11yStatusMessage,s=Iw(Cw,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),I=y.useRef({}),v=y.useRef(null),p=y.useRef(null),C=vo(),m=cw(t),w=y.useRef(),x=Uu({state:a,props:t}),_=y.useCallback(function($){return I.current[m.getItemId($)]},[m]);pw(i,a,[f,u,d,g],o);var S=hw({menuElement:h.current,highlightedIndex:u,isOpen:f,itemRefs:I,scrollIntoView:r,getItemNodeFromIndex:_});qu({props:t,state:a}),y.useEffect(function(){var $=oi(t,"isOpen");$&&v.current&&v.current.focus()},[]),y.useEffect(function(){C||(w.current=n.length)});var R=fw(o,y.useCallback(function(){x.current.state.isOpen&&c({type:ao,selectItem:!1})},[c,x]),y.useMemo(function(){return[h,p,v]},[h.current,p.current,v.current])),N=$u("getInputProps","getMenuProps");y.useEffect(function(){f||(I.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:Gs,altKey:V.altKey})},ArrowUp:function(V){V.preventDefault(),c({type:Qs,altKey:V.altKey})},Home:function(V){x.current.state.isOpen&&(V.preventDefault(),c({type:Ys}))},End:function(V){x.current.state.isOpen&&(V.preventDefault(),c({type:Zs}))},Escape:function(V){var L=x.current.state;(L.isOpen||L.inputValue||L.selectedItem||L.highlightedIndex>-1)&&(V.preventDefault(),c({type:Xs}))},Enter:function(V){var L=x.current.state;!L.isOpen||V.which===229||(V.preventDefault(),c({type:na}))},PageUp:function(V){x.current.state.isOpen&&(V.preventDefault(),c({type:ea}))},PageDown:function(V){x.current.state.isOpen&&(V.preventDefault(),c({type:ta}))}}},[c,x]),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,xw),de=V===void 0?{}:V,k=de.suppressRefError,we=k===void 0?!1:k;return N("getMenuProps",we,B,h),me((L={},L[B]=Cr(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:Bu})}),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=x.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],It=Ye.isItemDisabled(Dt,Ze),Mt="onClick",kt=we,et=function(){R.isTouchEnd||Ze===Ue.highlightedIndex||(S.current=!1,c({type:Ju,index:Ze,disabled:It}))},Ge=function(){c({type:oa,index:Ze})},$e=function(jt){return jt.preventDefault()};return me((V={},V[re]=Cr(Q,function(Pe){Pe&&(I.current[m.getItemId(Ze)]=Pe)}),V["aria-disabled"]=It,V["aria-selected"]=Ze===Ue.highlightedIndex,V.id=m.getItemId(Ze),V.role="option",V),!It&&(L={},L[Mt]=Be(kt,Ge),L),{onMouseMove:Be(de,et),onMouseDown:Be(k,$e)},Se)},[c,m,x,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=x.current.state,de=function(){c({type:Wu})};return me((V={},V[ne]=Cr(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,x,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=x.current.state,be=function($e){var Pe=Is($e);Pe&&A[Pe]&&A[Pe]($e)},Dt=function($e){c({type:ra,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})}},It=function(){c({type:ia})},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,It),et)}return me((L={},L[k]=Cr(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,x,R,N]),ae=y.useCallback(function(){c({type:zu})},[c]),X=y.useCallback(function(){c({type:Qu})},[c]),Y=y.useCallback(function(){c({type:Gu})},[c]),fe=y.useCallback(function($){c({type:Xu,highlightedIndex:$})},[c]),Ie=y.useCallback(function($){c({type:sa,selectedItem:$})},[c]),P=y.useCallback(function($){c({type:Yu,inputValue:$})},[c]),j=y.useCallback(function(){c({type:Zu})},[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 nd({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:I,highlightedIndex:v,getItemProps:p,setInputValue:C,selectedItem:m}=ca({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()}}),w=()=>{C(""),c(e)},x=()=>w(),_=y.useMemo(()=>{var R;return(R=e.find(N=>N.value===t))==null?void 0:R.label},[e,t]),S=()=>{t&&_&&t!==(m==null?void 0:m.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,...I({onFocus:x,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 Vr=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 xs(e,t,n){return ar(e,Vr(t,n))}function bi(e,t){return typeof e=="function"?e(t):e}function fr(e){return e.split("-")[0]}function Ci(e){return e.split("-")[1]}function rd(e){return e==="x"?"y":"x"}function la(e){return e==="y"?"height":"width"}function Ur(e){return["top","bottom"].includes(fr(e))?"y":"x"}function ua(e){return rd(Ur(e))}function $w(e,t,n){n===void 0&&(n=!1);const r=Ci(e),o=ua(e),i=la(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[_s(e),t,_s(t)]}function _s(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=Ci(e);let i=Hw(fr(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(_s)))),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 id(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 bc(e,t,n){let{reference:r,floating:o}=e;const i=Ur(t),s=ua(t),a=la(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(Ci(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}=bc(f,r,c),g=r,h={},I=0;for(let v=0;v<a.length;v++){const{name:p,fn:C}=a[v],{x:m,y:w,data:x,reset:_}=await C({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=w??d,h={...h,[p]:{...h[p],...x}},_&&I<=50&&(I++,typeof _=="object"&&(_.placement&&(g=_.placement),_.rects&&(f=_.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):_.rects),{x:u,y:d}=bc(f,g,c)),v=-1)}return{x:u,y:d,placement:g,strategy:o,middlewareData:h}};async function od(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),I=id(h),p=a[g?d==="floating"?"reference":"floating":d],C=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,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),x=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},_=uo(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:m,offsetParent:w,strategy:c}):m);return{top:(C.top-_.top+I.top)/x.y,bottom:(_.bottom-C.bottom+I.bottom)/x.y,left:(C.left-_.left+I.left)/x.x,right:(_.right-C.right+I.right)/x.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=id(u),g={x:n,y:r},h=ua(o),I=la(h),v=await s.getDimensions(f),p=h==="y",C=p?"top":"left",m=p?"bottom":"right",w=p?"clientHeight":"clientWidth",x=i.reference[I]+i.reference[h]-g[h]-i.floating[I],_=g[h]-i.reference[h],S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(f));let R=S?S[w]:0;(!R||!await(s.isElement==null?void 0:s.isElement(S)))&&(R=a.floating[w]||i.floating[I]);const N=x/2-_/2,A=R/2-v[I]/2-1,K=Vr(d[C],A),z=Vr(d[m],A),H=K,ee=R-v[I]-z,q=R/2-v[I]/2+N,ae=xs(H,q,ee),X=!c.arrow&&Ci(o)!=null&&q!==ae&&i.reference[I]/2-(q<H?K:z)-v[I]/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:I="none",flipAlignment:v=!0,...p}=bi(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const C=fr(o),m=Ur(a),w=fr(a)===a,x=await(c.isRTL==null?void 0:c.isRTL(f.floating)),_=g||(w||!v?[lo(a)]:qw(a)),S=I!=="none";!g&&S&&_.push(...Bw(a,v,I,x));const R=[a,..._],N=await od(t,p),A=[];let K=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&A.push(N[C]),d){const q=$w(o,s,x);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=Ur(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=Ci(n),c=Ur(n)==="y",f=["left","top"].includes(s)?-1:1,u=i&&c?-1:1,d=bi(t,e);let{mainAxis:g,crossAxis:h,alignmentAxis:I}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof I=="number"&&(h=a==="end"?I*-1:I),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:C,y:m}=p;return{x:C,y:m}}},...c}=bi(e,t),f={x:n,y:r},u=await od(t,c),d=Ur(fr(o)),g=rd(d);let h=f[g],I=f[d];if(i){const p=g==="y"?"top":"left",C=g==="y"?"bottom":"right",m=h+u[p],w=h-u[C];h=xs(m,h,w)}if(s){const p=d==="y"?"top":"left",C=d==="y"?"bottom":"right",m=I+u[p],w=I-u[C];I=xs(m,I,w)}const v=a.fn({...t,[g]:h,[d]:I});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 sd(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=(sd(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function sd(e){return wo()?e instanceof Node||e instanceof _t(e).Node:!1}function zt(e){return wo()?e instanceof Element||e instanceof _t(e).Element:!1}function rn(e){return wo()?e instanceof HTMLElement||e instanceof _t(e).HTMLElement:!1}function Cc(e){return!wo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof _t(e).ShadowRoot}function xi(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Gt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function 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 da(e){const t=fa(),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)&&!$r(t);){if(da(t))return t;if(Io(t))return null;t=Hn(t)}return null}function fa(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function $r(e){return["html","body","#document"].includes(Qr(e))}function Gt(e){return _t(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||Cc(e)&&e.host||on(e);return Cc(t)?t.host:t}function ad(e){const t=Hn(e);return $r(t)?e.ownerDocument?e.ownerDocument.body:e.body:rn(t)&&xi(t)?t:ad(t)}function li(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=ad(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=_t(o);if(i){const a=Os(s);return t.concat(s,s.visualViewport||[],xi(o)?o:[],a&&n?li(a):[])}return t.concat(o,li(o,[],n))}function Os(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function cd(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 pa(e){return zt(e)?e:e.contextElement}function _r(e){const t=pa(e);if(!rn(t))return qn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=cd(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 ld(e){const t=_t(e);return!fa()||!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!==_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=pa(e);let s=qn(1);t&&(r?zt(r)&&(s=_r(r)):s=_r(e));const a=nI(i,n,r)?ld(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=_t(i),h=r&&zt(r)?_t(r):r;let I=g,v=Os(I);for(;v&&r&&h!==I;){const p=_r(v),C=v.getBoundingClientRect(),m=Gt(v),w=C.left+(v.clientLeft+parseFloat(m.paddingLeft))*p.x,x=C.top+(v.clientTop+parseFloat(m.paddingTop))*p.y;c*=p.x,f*=p.y,u*=p.x,d*=p.y,c+=w,f+=x,I=_t(v),v=Os(I)}}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"||xi(s))&&(c=bo(r)),rn(r))){const g=pr(r);f=_r(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 Es(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+Es(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=_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 f=fa();(!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)?_r(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 xc(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=ld(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return uo(r)}function ud(e,t){const n=Hn(e);return n===t||!zt(n)||$r(n)?!1:Gt(n).position==="fixed"||ud(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)&&!$r(s);){const a=Gt(s),c=da(s);!c&&a.position==="fixed"&&(o=null),(i?!c&&!o:!c&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||xi(s)&&!c&&ud(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=xc(t,u,o);return f.top=ar(d.top,f.top),f.right=Vr(d.right,f.right),f.bottom=Vr(d.bottom,f.bottom),f.left=ar(d.left,f.left),f},xc(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}=cd(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"||xi(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=Es(o));let f=0,u=0;if(o&&!r&&!i){const h=o.getBoundingClientRect();u=h.top+a.scrollTop,f=h.left+a.scrollLeft-Es(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 _c(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 dd(e,t){const n=_t(e);if(Io(e))return n;if(!rn(e)){let o=Hn(e);for(;o&&!$r(o);){if(zt(o)&&!zo(o))return o;o=Hn(o)}return n}let r=_c(e,t);for(;r&&Zw(r)&&zo(r);)r=_c(r,t);return r&&$r(r)&&zo(r)&&!da(r)?n:r||eI(e)||n}const fI=async function(e){const t=this.getOffsetParent||dd,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:dd,getElementRects:fI,getClientRects:iI,getDimensions:uI,getScale:_r,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),I=Ji(o.clientWidth-(f+d)),v=Ji(o.clientHeight-(u+g)),p=Ji(f),m={rootMargin:-h+"px "+-I+"px "+-v+"px "+-p+"px",threshold:ar(0,Vr(1,c))||1};let w=!0;function x(_){const S=_[0].intersectionRatio;if(S!==c){if(!w)return s();S?s(!1,S):r=setTimeout(()=>{s(!1,1e-7)},1e3)}w=!1}try{n=new IntersectionObserver(x,{...m,root:o.ownerDocument})}catch{n=new IntersectionObserver(x,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=pa(e),u=o||i?[...f?li(f):[],...li(t)]:[];u.forEach(C=>{o&&C.addEventListener("scroll",n,{passive:!0}),i&&C.addEventListener("resize",n)});const d=f&&a?mI(f,n):null;let g=-1,h=null;s&&(h=new ResizeObserver(C=>{let[m]=C;m&&m.target===f&&h&&(h.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var w;(w=h)==null||w.observe(t)})),n()}),f&&!c&&h.observe(f),h.observe(t));let I,v=c?pr(e):null;c&&p();function p(){const C=pr(e);v&&(C.x!==v.x||C.y!==v.y||C.width!==v.width||C.height!==v.height)&&n(),v=C,I=requestAnimationFrame(p)}return n(),()=>{var C;u.forEach(m=>{o&&m.removeEventListener("scroll",n),i&&m.removeEventListener("resize",n)}),d==null||d(),(C=h)==null||C.disconnect(),h=null,c&&cancelAnimationFrame(I)}}const yI=Xw,vI=Yw,wI=Gw,II=zw,Oc=(e,t,n)=>{const r=new Map,o={platform:hI,...n},i={...o.platform,_c:r};return Ww(e,t,{...o,platform:i})};/*
|
|
45
|
+
*/var Bu;function GT(){return Bu||(Bu=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"),a=Symbol.for("react.context"),s=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),S=!1,I=!1,f=!1,C=!1,g=!1,O;O=Symbol.for("react.module.reference");function b(G){return!!(typeof G=="string"||typeof G=="function"||G===n||G===o||g||G===r||G===p||G===l||C||G===m||S||I||f||typeof G=="object"&&G!==null&&(G.$$typeof===h||G.$$typeof===d||G.$$typeof===i||G.$$typeof===a||G.$$typeof===c||G.$$typeof===O||G.getModuleId!==void 0))}function N(G){if(typeof G=="object"&&G!==null){var Ae=G.$$typeof;switch(Ae){case e:var Ve=G.type;switch(Ve){case n:case o:case r:case p:case l:return Ve;default:var et=Ve&&Ve.$$typeof;switch(et){case s:case a:case c:case h:case d:case i:return et;default:return Ae}}case t:return Ae}}}var R=a,E=i,x=e,_=c,F=n,k=h,J=d,q=t,$=o,te=r,ee=p,oe=l,Oe=!1,we=!1;function D(G){return Oe||(Oe=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function B(G){return we||(we=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function W(G){return N(G)===a}function j(G){return N(G)===i}function V(G){return typeof G=="object"&&G!==null&&G.$$typeof===e}function K(G){return N(G)===c}function ne(G){return N(G)===n}function re(G){return N(G)===h}function z(G){return N(G)===d}function ie(G){return N(G)===t}function Y(G){return N(G)===o}function fe(G){return N(G)===r}function L(G){return N(G)===p}function Se(G){return N(G)===l}Re.ContextConsumer=R,Re.ContextProvider=E,Re.Element=x,Re.ForwardRef=_,Re.Fragment=F,Re.Lazy=k,Re.Memo=J,Re.Portal=q,Re.Profiler=$,Re.StrictMode=te,Re.Suspense=ee,Re.SuspenseList=oe,Re.isAsyncMode=D,Re.isConcurrentMode=B,Re.isContextConsumer=W,Re.isContextProvider=j,Re.isElement=V,Re.isForwardRef=K,Re.isFragment=ne,Re.isLazy=re,Re.isMemo=z,Re.isPortal=ie,Re.isProfiler=Y,Re.isStrictMode=fe,Re.isSuspense=L,Re.isSuspenseList=Se,Re.isValidElementType=b,Re.typeOf=N}()),Re}process.env.NODE_ENV==="production"?La.exports=zT():La.exports=GT();var Vu=La.exports;const $u=e=>typeof e=="object"&&e!=null&&e.nodeType===1,ju=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",ua=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return ju(n.overflowY,t)||ju(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},Yi=(e,t,n,r,o,i,a,s)=>i<e&&a>t||i>e&&a<t?0:i<=e&&s<=n||a>=t&&s>=n?i-e-r:a>t&&s<n||i<e&&s>n?a-t+o:0,XT=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},QT=(e,t)=>{var n,r,o,i;if(typeof document>"u")return[];const{scrollMode:a,block:s,inline:c,boundary:p,skipOverflowHiddenElements:l}=t,d=typeof p=="function"?p:ee=>ee!==p;if(!$u(e))throw new TypeError("Invalid target");const h=document.scrollingElement||document.documentElement,m=[];let S=e;for(;$u(S)&&d(S);){if(S=XT(S),S===h){m.push(S);break}S!=null&&S===document.body&&ua(S)&&!ua(document.documentElement)||S!=null&&ua(S,l)&&m.push(S)}const I=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,f=(i=(o=window.visualViewport)==null?void 0:o.height)!=null?i:innerHeight,{scrollX:C,scrollY:g}=window,{height:O,width:b,top:N,right:R,bottom:E,left:x}=e.getBoundingClientRect(),{top:_,right:F,bottom:k,left:J}=(ee=>{const oe=window.getComputedStyle(ee);return{top:parseFloat(oe.scrollMarginTop)||0,right:parseFloat(oe.scrollMarginRight)||0,bottom:parseFloat(oe.scrollMarginBottom)||0,left:parseFloat(oe.scrollMarginLeft)||0}})(e);let q=s==="start"||s==="nearest"?N-_:s==="end"?E+k:N+O/2-_+k,$=c==="center"?x+b/2-J+F:c==="end"?R+F:x-J;const te=[];for(let ee=0;ee<m.length;ee++){const oe=m[ee],{height:Oe,width:we,top:D,right:B,bottom:W,left:j}=oe.getBoundingClientRect();if(a==="if-needed"&&N>=0&&x>=0&&E<=f&&R<=I&&N>=D&&E<=W&&x>=j&&R<=B)return te;const V=getComputedStyle(oe),K=parseInt(V.borderLeftWidth,10),ne=parseInt(V.borderTopWidth,10),re=parseInt(V.borderRightWidth,10),z=parseInt(V.borderBottomWidth,10);let ie=0,Y=0;const fe="offsetWidth"in oe?oe.offsetWidth-oe.clientWidth-K-re:0,L="offsetHeight"in oe?oe.offsetHeight-oe.clientHeight-ne-z:0,Se="offsetWidth"in oe?oe.offsetWidth===0?0:we/oe.offsetWidth:0,G="offsetHeight"in oe?oe.offsetHeight===0?0:Oe/oe.offsetHeight:0;if(h===oe)ie=s==="start"?q:s==="end"?q-f:s==="nearest"?Yi(g,g+f,f,ne,z,g+q,g+q+O,O):q-f/2,Y=c==="start"?$:c==="center"?$-I/2:c==="end"?$-I:Yi(C,C+I,I,K,re,C+$,C+$+b,b),ie=Math.max(0,ie+g),Y=Math.max(0,Y+C);else{ie=s==="start"?q-D-ne:s==="end"?q-W+z+L:s==="nearest"?Yi(D,W,Oe,ne,z+L,q,q+O,O):q-(D+Oe/2)+L/2,Y=c==="start"?$-j-K:c==="center"?$-(j+we/2)+fe/2:c==="end"?$-B+re+fe:Yi(j,B,we,K,re+fe,$,$+b,b);const{scrollLeft:Ae,scrollTop:Ve}=oe;ie=G===0?0:Math.max(0,Math.min(Ve+ie/G,oe.scrollHeight-Oe/G+L)),Y=Se===0?0:Math.max(0,Math.min(Ae+Y/Se,oe.scrollWidth-we/Se+fe)),q+=Ve-ie,$+=Ae-Y}te.push({el:oe,top:ie,left:Y})}return te};var Lr=function(){return Lr=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},Lr.apply(this,arguments)};var YT=0;function Hu(e){return typeof e=="function"?e:Nt}function Nt(){}function pO(e,t){if(e){var n=QT(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach(function(r){var o=r.el,i=r.top,a=r.left;o.scrollTop=i,o.scrollLeft=a})}}function Wu(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function Rc(e,t){var n;function r(){n&&clearTimeout(n)}function o(){for(var i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];r(),n=setTimeout(function(){n=null,e.apply(void 0,a)},t)}return o.cancel=r,o}function ze(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];return t.some(function(s){return s&&s.apply(void 0,[r].concat(i)),r.preventDownshiftDefault||r.hasOwnProperty("nativeEvent")&&r.nativeEvent.preventDownshiftDefault})}}function Cr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){t.forEach(function(o){typeof o=="function"?o(r):o&&(o.current=r)})}}function fO(){return String(YT++)}function ZT(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 zu(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function mO(e){return typeof e.type=="string"}function hO(e){return e.props}function eR(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var tR=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function Zi(e){e===void 0&&(e={});var t={};return tR.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function yo(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 Ba(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function nR(e){return Object.prototype.toString.call(e)==="[object Object]"}function tr(e,t,n,r,o){var i=n.length;if(i===0)return-1;var a=i-1;(typeof e!="number"||e<0||e>a)&&(e=t>0?-1:a+1);var s=e+t;s<0?s=a:s>a&&(s=0);var c=Br(s,t<0,n,r,o);return c===-1?e>=i?-1:e:c}function Br(e,t,n,r,o){o===void 0&&(o=!1);var i=n.length;if(t){for(var a=e;a>=0;a--)if(!r(n[a],a))return a}else for(var s=e;s<i;s++)if(!r(n[s],s))return s;return o?Br(t?i-1:0,t,n,r):-1}function vo(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(o){return o&&(Wu(o,e,n)||r&&Wu(o,n.document.activeElement,n))})}var xc=Nt;process.env.NODE_ENV!=="production"&&(xc=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 rR=Rc(function(e){gO(e).textContent=""},500);function gO(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 yO(e,t){if(!(!e||!t)){var n=gO(t);n.textContent=e,rR(t)}}function iR(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var OO=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,vO=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,IO=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,so=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,co=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,SO=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,wO=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,bO=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,NO=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,CO=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,TO=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,RO=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,xO=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,Va=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,AO=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,EO=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,FO=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,oR=Object.freeze({__proto__:null,blurButton:AO,blurInput:TO,changeInput:RO,clickButton:Va,clickItem:CO,controlledPropUpdatedSelectedItem:EO,itemMouseEnter:IO,keyDownArrowDown:co,keyDownArrowUp:so,keyDownEnd:NO,keyDownEnter:wO,keyDownEscape:SO,keyDownHome:bO,keyDownSpaceButton:xO,mouseUp:vO,touchEnd:FO,unknown:OO}),aR=["refKey","ref"],sR=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],cR=["onKeyDown","onBlur","onChange","onInput","onChangeText"],uR=["refKey","ref"],lR=["onMouseMove","onMouseDown","onClick","onPress","index","item"],dR=function(){var e=function(t){function n(o){var i;i=t.call(this,o)||this,i.id=i.props.id||"downshift-"+fO(),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,O){var b=setTimeout(function(){i.timeoutIds=i.timeoutIds.filter(function(N){return N!==b}),g()},O);i.timeoutIds.push(b)},i.setItemCount=function(g){i.itemCount=g},i.unsetItemCount=function(){i.itemCount=null},i.isItemDisabled=function(g,O){var b=i.getItemNodeFromIndex(O);return b&&b.hasAttribute("disabled")},i.setHighlightedIndex=function(g,O){g===void 0&&(g=i.props.defaultHighlightedIndex),O===void 0&&(O={}),O=Zi(O),i.internalSetState(ge({highlightedIndex:g},O))},i.clearSelection=function(g){i.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:i.props.defaultHighlightedIndex,isOpen:i.props.defaultIsOpen},g)},i.selectItem=function(g,O,b){O=Zi(O),i.internalSetState(ge({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,selectedItem:g,inputValue:i.props.itemToString(g)},O),b)},i.selectItemAtIndex=function(g,O,b){var N=i.items[g];N!=null&&i.selectItem(N,O,b)},i.selectHighlightedItem=function(g,O){return i.selectItemAtIndex(i.getState().highlightedIndex,g,O)},i.internalSetState=function(g,O){var b,N,R={},E=typeof g=="function";return!E&&g.hasOwnProperty("inputValue")&&i.props.onInputValueChange(g.inputValue,ge({},i.getStateAndHelpers(),g)),i.setState(function(x){var _;x=i.getState(x);var F=E?g(x):g;F=i.props.stateReducer(x,F),b=F.hasOwnProperty("selectedItem");var k={};return b&&F.selectedItem!==x.selectedItem&&(N=F.selectedItem),(_=F).type||(_.type=OO),Object.keys(F).forEach(function(J){x[J]!==F[J]&&(R[J]=F[J]),J!=="type"&&(F[J],Oo(i.props,J)||(k[J]=F[J]))}),E&&F.hasOwnProperty("inputValue")&&i.props.onInputValueChange(F.inputValue,ge({},i.getStateAndHelpers(),F)),k},function(){Hu(O)();var x=Object.keys(R).length>1;x&&i.props.onStateChange(R,i.getStateAndHelpers()),b&&i.props.onSelect(g.selectedItem,i.getStateAndHelpers()),N!==void 0&&i.props.onChange(N,i.getStateAndHelpers()),i.props.onUserAction(R,i.getStateAndHelpers())})},i.rootRef=function(g){return i._rootNode=g},i.getRootProps=function(g,O){var b,N=g===void 0?{}:g,R=N.refKey,E=R===void 0?"ref":R,x=N.ref,_=yn(N,aR),F=O===void 0?{}:O,k=F.suppressRefError,J=k===void 0?!1:k;i.getRootProps.called=!0,i.getRootProps.refKey=E,i.getRootProps.suppressRefError=J;var q=i.getState(),$=q.isOpen;return ge((b={},b[E]=Cr(x,i.rootRef),b.role="combobox",b["aria-expanded"]=$,b["aria-haspopup"]="listbox",b["aria-owns"]=$?i.menuId:void 0,b["aria-labelledby"]=i.labelId,b),_)},i.keyDownHandlers={ArrowDown:function(O){var b=this;if(O.preventDefault(),this.getState().isOpen){var N=O.shiftKey?5:1;this.moveHighlightedIndex(N,{type:co})}else this.internalSetState({isOpen:!0,type:co},function(){var R=b.getItemCount();if(R>0){var E=b.getState(),x=E.highlightedIndex,_=tr(x,1,{length:R},b.isItemDisabled,!0);b.setHighlightedIndex(_,{type:co})}})},ArrowUp:function(O){var b=this;if(O.preventDefault(),this.getState().isOpen){var N=O.shiftKey?-5:-1;this.moveHighlightedIndex(N,{type:so})}else this.internalSetState({isOpen:!0,type:so},function(){var R=b.getItemCount();if(R>0){var E=b.getState(),x=E.highlightedIndex,_=tr(x,-1,{length:R},b.isItemDisabled,!0);b.setHighlightedIndex(_,{type:so})}})},Enter:function(O){if(O.which!==229){var b=this.getState(),N=b.isOpen,R=b.highlightedIndex;if(N&&R!=null){O.preventDefault();var E=this.items[R],x=this.getItemNodeFromIndex(R);if(E==null||x&&x.hasAttribute("disabled"))return;this.selectHighlightedItem({type:wO})}}},Escape:function(O){O.preventDefault(),this.reset(ge({type:SO},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},i.buttonKeyDownHandlers=ge({},i.keyDownHandlers,{" ":function(O){O.preventDefault(),this.toggleMenu({type:xO})}}),i.inputKeyDownHandlers=ge({},i.keyDownHandlers,{Home:function(O){var b=this.getState(),N=b.isOpen;if(N){O.preventDefault();var R=this.getItemCount();if(!(R<=0||!N)){var E=Br(0,!1,{length:R},this.isItemDisabled);this.setHighlightedIndex(E,{type:bO})}}},End:function(O){var b=this.getState(),N=b.isOpen;if(N){O.preventDefault();var R=this.getItemCount();if(!(R<=0||!N)){var E=Br(R-1,!0,{length:R},this.isItemDisabled);this.setHighlightedIndex(E,{type:NO})}}}}),i.getToggleButtonProps=function(g){var O=g===void 0?{}:g,b=O.onClick;O.onPress;var N=O.onKeyDown,R=O.onKeyUp,E=O.onBlur,x=yn(O,sR),_=i.getState(),F=_.isOpen,k={onClick:ze(b,i.buttonHandleClick),onKeyDown:ze(N,i.buttonHandleKeyDown),onKeyUp:ze(R,i.buttonHandleKeyUp),onBlur:ze(E,i.buttonHandleBlur)},J=x.disabled?{}:k;return ge({type:"button",role:"button","aria-label":F?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},J,x)},i.buttonHandleKeyUp=function(g){g.preventDefault()},i.buttonHandleKeyDown=function(g){var O=Ba(g);i.buttonKeyDownHandlers[O]&&i.buttonKeyDownHandlers[O].call(i,g)},i.buttonHandleClick=function(g){if(g.preventDefault(),i.props.environment){var O=i.props.environment.document,b=O.body,N=O.activeElement;b&&b===N&&g.target.focus()}process.env.NODE_ENV==="test"?i.toggleMenu({type:Va}):i.internalSetTimeout(function(){return i.toggleMenu({type:Va})})},i.buttonHandleBlur=function(g){var O=g.target;i.internalSetTimeout(function(){if(!(i.isMouseDown||!i.props.environment)){var b=i.props.environment.document.activeElement;(b==null||b.id!==i.inputId)&&b!==O&&i.reset({type:AO})}})},i.getLabelProps=function(g){return ge({htmlFor:i.inputId,id:i.labelId},g)},i.getInputProps=function(g){var O=g===void 0?{}:g,b=O.onKeyDown,N=O.onBlur,R=O.onChange,E=O.onInput;O.onChangeText;var x=yn(O,cR),_,F={};_="onChange";var k=i.getState(),J=k.inputValue,q=k.isOpen,$=k.highlightedIndex;if(!x.disabled){var te;F=(te={},te[_]=ze(R,E,i.inputHandleChange),te.onKeyDown=ze(b,i.inputHandleKeyDown),te.onBlur=ze(N,i.inputHandleBlur),te)}return ge({"aria-autocomplete":"list","aria-activedescendant":q&&typeof $=="number"&&$>=0?i.getItemId($):void 0,"aria-controls":q?i.menuId:void 0,"aria-labelledby":x&&x["aria-label"]?void 0:i.labelId,autoComplete:"off",value:J,id:i.inputId},F,x)},i.inputHandleKeyDown=function(g){var O=Ba(g);O&&i.inputKeyDownHandlers[O]&&i.inputKeyDownHandlers[O].call(i,g)},i.inputHandleChange=function(g){i.internalSetState({type:RO,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 O=i.props.environment.document.activeElement,b=(O==null||(g=O.dataset)==null?void 0:g.toggle)&&i._rootNode&&i._rootNode.contains(O);b||i.reset({type:TO})}})},i.menuRef=function(g){i._menuNode=g},i.getMenuProps=function(g,O){var b,N=g===void 0?{}:g,R=N.refKey,E=R===void 0?"ref":R,x=N.ref,_=yn(N,uR),F=O===void 0?{}:O,k=F.suppressRefError,J=k===void 0?!1:k;return i.getMenuProps.called=!0,i.getMenuProps.refKey=E,i.getMenuProps.suppressRefError=J,ge((b={},b[E]=Cr(x,i.menuRef),b.role="listbox",b["aria-labelledby"]=_&&_["aria-label"]?void 0:i.labelId,b.id=i.menuId,b),_)},i.getItemProps=function(g){var O,b=g===void 0?{}:g,N=b.onMouseMove,R=b.onMouseDown,E=b.onClick;b.onPress;var x=b.index,_=b.item,F=_===void 0?process.env.NODE_ENV==="production"?void 0:eR("getItemProps","item"):_,k=yn(b,lR);x===void 0?(i.items.push(F),x=i.items.indexOf(F)):i.items[x]=F;var J="onClick",q=E,$=(O={onMouseMove:ze(N,function(){x!==i.getState().highlightedIndex&&(i.setHighlightedIndex(x,{type:IO}),i.avoidScrolling=!0,i.internalSetTimeout(function(){return i.avoidScrolling=!1},250))}),onMouseDown:ze(R,function(ee){ee.preventDefault()})},O[J]=ze(q,function(){i.selectItemAtIndex(x,{type:CO})}),O),te=k.disabled?{onMouseDown:$.onMouseDown}:$;return ge({id:i.getItemId(x),role:"option","aria-selected":i.getState().highlightedIndex===x},te,k)},i.clearItems=function(){i.items=[]},i.reset=function(g,O){g===void 0&&(g={}),g=Zi(g),i.internalSetState(function(b){var N=b.selectedItem;return ge({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,inputValue:i.props.itemToString(N)},g)},O)},i.toggleMenu=function(g,O){g===void 0&&(g={}),g=Zi(g),i.internalSetState(function(b){var N=b.isOpen;return ge({isOpen:!N},N&&{highlightedIndex:i.props.defaultHighlightedIndex},g)},function(){var b=i.getState(),N=b.isOpen,R=b.highlightedIndex;N&&i.getItemCount()>0&&typeof R=="number"&&i.setHighlightedIndex(R,g),Hu(O)()})},i.openMenu=function(g){i.internalSetState({isOpen:!0},g)},i.closeMenu=function(g){i.internalSetState({isOpen:!1},g)},i.updateStatus=Rc(function(){var g;if((g=i.props)!=null&&(g=g.environment)!=null&&g.document){var O=i.getState(),b=i.items[O.highlightedIndex],N=i.getItemCount(),R=i.props.getA11yStatusMessage(ge({itemToString:i.props.itemToString,previousResultCount:i.previousResultCount,resultCount:N,highlightedItem:b},O));i.previousResultCount=N,yO(R,i.props.environment.document)}},200);var a=i.props,s=a.defaultHighlightedIndex,c=a.initialHighlightedIndex,p=c===void 0?s:c,l=a.defaultIsOpen,d=a.initialIsOpen,h=d===void 0?l:d,m=a.initialInputValue,S=m===void 0?"":m,I=a.initialSelectedItem,f=I===void 0?null:I,C=i.getState({highlightedIndex:p,isOpen:h,inputValue:S,selectedItem:f});return C.selectedItem!=null&&i.props.initialInputValue===void 0&&(C.inputValue=i.props.itemToString(C.selectedItem)),i.state=C,i}qT(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),yo(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,a){var s=this.getItemCount(),c=this.getState(),p=c.highlightedIndex;if(s>0){var l=tr(p,i,{length:s},this.isItemDisabled,!0);this.setHighlightedIndex(l,a)}},r.getStateAndHelpers=function(){var i=this.getState(),a=i.highlightedIndex,s=i.inputValue,c=i.selectedItem,p=i.isOpen,l=this.props.itemToString,d=this.id,h=this.getRootProps,m=this.getToggleButtonProps,S=this.getLabelProps,I=this.getMenuProps,f=this.getInputProps,C=this.getItemProps,g=this.openMenu,O=this.closeMenu,b=this.toggleMenu,N=this.selectItem,R=this.selectItemAtIndex,E=this.selectHighlightedItem,x=this.setHighlightedIndex,_=this.clearSelection,F=this.clearItems,k=this.reset,J=this.setItemCount,q=this.unsetItemCount,$=this.internalSetState;return{getRootProps:h,getToggleButtonProps:m,getLabelProps:S,getMenuProps:I,getInputProps:f,getItemProps:C,reset:k,openMenu:g,closeMenu:O,toggleMenu:b,selectItem:N,selectItemAtIndex:R,selectHighlightedItem:E,setHighlightedIndex:x,clearSelection:_,clearItems:F,setItemCount:J,unsetItemCount:q,setState:$,itemToString:l,id:d,highlightedIndex:a,inputValue:s,isOpen:p,selectedItem:c}},r.componentDidMount=function(){var i=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&Gu(this._menuNode,this.getMenuProps),!this.props.environment)this.cleanup=function(){i.internalClearTimeouts()};else{var a=function(){i.isMouseDown=!0},s=function(m){i.isMouseDown=!1;var S=vo(m.target,[i._rootNode,i._menuNode],i.props.environment);!S&&i.getState().isOpen&&i.reset({type:vO},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},c=function(){i.isTouchMove=!1},p=function(){i.isTouchMove=!0},l=function(m){var S=vo(m.target,[i._rootNode,i._menuNode],i.props.environment,!1);!i.isTouchMove&&!S&&i.getState().isOpen&&i.reset({type:FO},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},d=this.props.environment;d.addEventListener("mousedown",a),d.addEventListener("mouseup",s),d.addEventListener("touchstart",c),d.addEventListener("touchmove",p),d.addEventListener("touchend",l),this.cleanup=function(){i.internalClearTimeouts(),i.updateStatus.cancel(),d.removeEventListener("mousedown",a),d.removeEventListener("mouseup",s),d.removeEventListener("touchstart",c),d.removeEventListener("touchmove",p),d.removeEventListener("touchend",l)}}},r.shouldScroll=function(i,a){var s=this.props.highlightedIndex===void 0?this.getState():this.props,c=s.highlightedIndex,p=a.highlightedIndex===void 0?i:a,l=p.highlightedIndex,d=c&&this.getState().isOpen&&!i.isOpen,h=c!==l;return d||h},r.componentDidUpdate=function(i,a){process.env.NODE_ENV!=="production"&&(xc(this.state,i,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&Gu(this._menuNode,this.getMenuProps)),Oo(this.props,"selectedItem")&&this.props.selectedItemChanged(i.selectedItem,this.props.selectedItem)&&this.internalSetState({type:EO,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(a,i)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},r.componentWillUnmount=function(){this.cleanup()},r.render=function(){var i=zu(this.props.children,Nt);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 a=zu(i(this.getStateAndHelpers()));if(!a)return null;if(this.getRootProps.called||this.props.suppressRefError)return process.env.NODE_ENV!=="production"&&!this.getRootProps.suppressRefError&&!this.props.suppressRefError&&pR(a,this.getRootProps),a;if(mO(a))return v.cloneElement(a,this.getRootProps(hO(a)));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:ZT,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&nR(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:Nt,onInputValueChange:Nt,onUserAction:Nt,onChange:Nt,onSelect:Nt,onOuterClick:Nt,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:pO},e.stateChangeTypes=oR,e}();process.env.NODE_ENV!=="production"&&(dR.propTypes={children:H.func,defaultHighlightedIndex:H.number,defaultIsOpen:H.bool,initialHighlightedIndex:H.number,initialSelectedItem:H.any,initialInputValue:H.string,initialIsOpen:H.bool,getA11yStatusMessage:H.func,itemToString:H.func,onChange:H.func,onSelect:H.func,onStateChange:H.func,onInputValueChange:H.func,onUserAction:H.func,onOuterClick:H.func,selectedItemChanged:H.func,stateReducer:H.func,itemCount:H.number,id:H.string,environment:H.shape({addEventListener:H.func.isRequired,removeEventListener:H.func.isRequired,document:H.shape({createElement:H.func.isRequired,getElementById:H.func.isRequired,activeElement:H.any.isRequired,body:H.any.isRequired}).isRequired,Node:H.func.isRequired}),suppressRefError:H.bool,scrollIntoView:H.func,selectedItem:H.any,isOpen:H.bool,inputValue:H.string,highlightedIndex:H.number,labelId:H.string,inputId:H.string,menuId:H.string,getItemId:H.func});function Gu(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 pR(e,t){var n=t.refKey,r=n!=="ref",o=!mO(e);o&&!r&&!Vu.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+'"'),!Vu.isForwardRef(e)&&!hO(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var _O={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function fR(e,t,n){var r=e.props,o=e.type,i={};Object.keys(t).forEach(function(a){mR(a,e,t,n),n[a]!==t[a]&&(i[a]=n[a])}),r.onStateChange&&Object.keys(i).length&&r.onStateChange(ge({type:o},i))}function mR(e,t,n,r){var o=t.props,i=t.type,a="on"+Ac(e)+"Change";o[a]&&r[e]!==void 0&&r[e]!==n[e]&&o[a](ge({type:i},r))}function hR(e,t){return t.changes}var Xu=Rc(function(e,t){yO(e,t)},200),gR=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?v.useLayoutEffect:v.useEffect,yR="useId"in v?function(t){var n=t.id,r=t.labelId,o=t.menuId,i=t.getItemId,a=t.toggleButtonId,s=t.inputId,c="downshift-"+v.useId();n||(n=c);var p=v.useRef({labelId:r||n+"-label",menuId:o||n+"-menu",getItemId:i||function(l){return n+"-item-"+l},toggleButtonId:a||n+"-toggle-button",inputId:s||n+"-input"});return p.current}:function(t){var n=t.id,r=n===void 0?"downshift-"+fO():n,o=t.labelId,i=t.menuId,a=t.getItemId,s=t.toggleButtonId,c=t.inputId,p=v.useRef({labelId:o||r+"-label",menuId:i||r+"-menu",getItemId:a||function(l){return r+"-item-"+l},toggleButtonId:s||r+"-toggle-button",inputId:c||r+"-input"});return p.current};function OR(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 Ac(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function PO(e){var t=v.useRef(e);return t.current=e,t}function vR(e,t,n,r){var o=v.useRef(),i=v.useRef(),a=v.useCallback(function(m,S){i.current=S,m=yo(m,S.props);var I=e(m,S),f=S.props.stateReducer(m,ge({},S,{changes:I}));return f},[e]),s=v.useReducer(a,t,n),c=s[0],p=s[1],l=PO(t),d=v.useCallback(function(m){return p(ge({props:l.current},m))},[l]),h=i.current;return v.useEffect(function(){var m=yo(o.current,h==null?void 0:h.props),S=h&&o.current&&!r(m,c);S&&fR(h,m,c),o.current=c},[c,h,r]),[c,d]}var pi={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:hR,scrollIntoView:pO,environment:typeof window>"u"?void 0:window};function Ln(e,t,n){n===void 0&&(n=_O);var r=e["default"+Ac(t)];return r!==void 0?r:n[t]}function fi(e,t,n){n===void 0&&(n=_O);var r=e[t];if(r!==void 0)return r;var o=e["initial"+Ac(t)];return o!==void 0?o:Ln(e,t,n)}function IR(e){var t=fi(e,"selectedItem"),n=fi(e,"isOpen"),r=CR(e),o=fi(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 mi(e,t,n){var r=e.items,o=e.initialHighlightedIndex,i=e.defaultHighlightedIndex,a=e.isItemDisabled,s=e.itemToKey,c=t.selectedItem,p=t.highlightedIndex;return r.length===0?-1:o!==void 0&&p===o&&!a(r[o],o)?o:i!==void 0&&!a(r[i],i)?i:c?r.findIndex(function(l){return s(c)===s(l)}):n<0&&!a(r[r.length-1],r.length-1)?r.length-1:n>0&&!a(r[0],0)?0:-1}function SR(e,t,n){var r=v.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return v.useEffect(function(){if(!e)return Nt;var o=n.map(function(l){return l.current});function i(){r.current.isTouchEnd=!1,r.current.isMouseDown=!0}function a(l){r.current.isMouseDown=!1,vo(l.target,o,e)||t()}function s(){r.current.isTouchEnd=!1,r.current.isTouchMove=!1}function c(){r.current.isTouchMove=!0}function p(l){r.current.isTouchEnd=!0,!r.current.isTouchMove&&!vo(l.target,o,e,!1)&&t()}return e.addEventListener("mousedown",i),e.addEventListener("mouseup",a),e.addEventListener("touchstart",s),e.addEventListener("touchmove",c),e.addEventListener("touchend",p),function(){e.removeEventListener("mousedown",i),e.removeEventListener("mouseup",a),e.removeEventListener("touchstart",s),e.removeEventListener("touchmove",c),e.removeEventListener("touchend",p)}},[n,e,t]),r.current}var DO=function(){return Nt};process.env.NODE_ENV!=="production"&&(DO=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(a,s){return a[s]={},a},{}));v.useEffect(function(){Object.keys(o.current).forEach(function(a){var s=o.current[a];if(!Object.keys(s).length){console.error("downshift: You forgot to call the "+a+" getter function on your component / element.");return}var c=s.suppressRefError,p=s.refKey,l=s.elementRef;c||l!=null&&l.current||console.error('downshift: The ref prop "'+p+'" from '+a+" was not applied correctly on your element.")})},[]);var i=v.useCallback(function(a,s,c,p){o.current[a]={suppressRefError:s,refKey:c,elementRef:p}},[]);return i});function wR(e,t,n,r){r===void 0&&(r={});var o=r.document,i=Jo();v.useEffect(function(){if(!(!e||i||!o)){var a=e(t);Xu(a,o)}},n),v.useEffect(function(){return function(){Xu.cancel(),iR(o)}},[o])}function bR(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,o=e.getItemNodeFromIndex,i=e.menuElement,a=e.scrollIntoView,s=v.useRef(!0);return gR(function(){t<0||!n||!Object.keys(r.current).length||(s.current===!1?s.current=!0:a(o(t),i))},[t]),s}var MO=Nt;process.env.NODE_ENV!=="production"&&(MO=function(t){var n=t.props,r=t.state,o=v.useRef(n),i=Jo();v.useEffect(function(){i||(xc(r,o.current,n),o.current=n)},[r,n,i])});function Qu(e,t,n){var r;n===void 0&&(n=!0);var o=((r=e.items)==null?void 0:r.length)&&t>=0;return ge({isOpen:!1,highlightedIndex:-1},o&&ge({selectedItem:e.items[t],isOpen:Ln(e,"isOpen"),highlightedIndex:Ln(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function NR(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function Jo(){var e=v.useRef(!0);return v.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function $a(e){var t=Ln(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function CR(e){var t=fi(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var uo={environment:H.shape({addEventListener:H.func.isRequired,removeEventListener:H.func.isRequired,document:H.shape({createElement:H.func.isRequired,getElementById:H.func.isRequired,activeElement:H.any.isRequired,body:H.any.isRequired}).isRequired,Node:H.func.isRequired}),itemToString:H.func,itemToKey:H.func,stateReducer:H.func},JO=ge({},uo,{getA11yStatusMessage:H.func,highlightedIndex:H.number,defaultHighlightedIndex:H.number,initialHighlightedIndex:H.number,isOpen:H.bool,defaultIsOpen:H.bool,initialIsOpen:H.bool,selectedItem:H.any,initialSelectedItem:H.any,defaultSelectedItem:H.any,id:H.string,labelId:H.string,menuId:H.string,getItemId:H.func,toggleButtonId:H.string,onSelectedItemChange:H.func,onHighlightedIndexChange:H.func,onStateChange:H.func,onIsOpenChange:H.func,scrollIntoView:H.func});function TR(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:mi(o,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:mi(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:$a(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 ge({},e,i)}Lr(Lr({},JO),{items:H.array.isRequired,isItemDisabled:H.func});Lr(Lr({},pi),{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 Ec=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,Fc=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,_c=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,Pc=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,Dc=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,Mc=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,Jc=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,kc=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,qc=process.env.NODE_ENV!=="production"?"__input_change__":8,Io=process.env.NODE_ENV!=="production"?"__input_blur__":9,Kc=process.env.NODE_ENV!=="production"?"__input_click__":10,kO=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,qO=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,Uc=process.env.NODE_ENV!=="production"?"__item_click__":13,KO=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,UO=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,LO=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,BO=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,VO=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,Lc=process.env.NODE_ENV!=="production"?"__function_select_item__":19,$O=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,jO=process.env.NODE_ENV!=="production"?"__function_reset__":21,Bc=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,HO=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:Bc,FunctionCloseMenu:BO,FunctionOpenMenu:LO,FunctionReset:jO,FunctionSelectItem:Lc,FunctionSetHighlightedIndex:VO,FunctionSetInputValue:$O,FunctionToggleMenu:UO,InputBlur:Io,InputChange:qc,InputClick:Kc,InputKeyDownArrowDown:Ec,InputKeyDownArrowUp:Fc,InputKeyDownEnd:Dc,InputKeyDownEnter:kc,InputKeyDownEscape:_c,InputKeyDownHome:Pc,InputKeyDownPageDown:Jc,InputKeyDownPageUp:Mc,ItemClick:Uc,ItemMouseMove:qO,MenuMouseLeave:kO,ToggleButtonClick:KO});function RR(e){var t=IR(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)),ge({},t,{inputValue:r})}var xR=ge({},JO,{items:H.array.isRequired,isItemDisabled:H.func,inputValue:H.string,defaultInputValue:H.string,initialInputValue:H.string,inputId:H.string,onInputValueChange:H.func});function AR(e,t,n,r){var o=v.useRef(),i=vR(e,t,n,r),a=i[0],s=i[1],c=Jo();return v.useEffect(function(){if(Oo(t,"selectedItem")){if(!c){var p=t.itemToKey(t.selectedItem)!==t.itemToKey(o.current);p&&s({type:Bc,inputValue:t.itemToString(t.selectedItem)})}o.current=a.selectedItem===o.current?t.selectedItem:a.selectedItem}},[a.selectedItem,t.selectedItem]),[yo(a,t),s]}var WO=Nt;process.env.NODE_ENV!=="production"&&(WO=function(t,n){H.checkPropTypes(xR,t,"prop",n.name)});var ER=ge({},pi,{isItemDisabled:function(){return!1}});function FR(e,t){var n,r=t.type,o=t.props,i=t.altKey,a;switch(r){case Uc:a={isOpen:Ln(o,"isOpen"),highlightedIndex:$a(o),selectedItem:o.items[t.index],inputValue:o.itemToString(o.items[t.index])};break;case Ec:e.isOpen?a={highlightedIndex:tr(e.highlightedIndex,1,o.items,o.isItemDisabled,!0)}:a={highlightedIndex:i&&e.selectedItem==null?-1:mi(o,e,1),isOpen:o.items.length>=0};break;case Fc:e.isOpen?i?a=Qu(o,e.highlightedIndex):a={highlightedIndex:tr(e.highlightedIndex,-1,o.items,o.isItemDisabled,!0)}:a={highlightedIndex:mi(o,e,-1),isOpen:o.items.length>=0};break;case kc:a=Qu(o,e.highlightedIndex);break;case _c:a=ge({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case Mc:a={highlightedIndex:tr(e.highlightedIndex,-10,o.items,o.isItemDisabled,!0)};break;case Jc:a={highlightedIndex:tr(e.highlightedIndex,10,o.items,o.isItemDisabled,!0)};break;case Pc:a={highlightedIndex:Br(0,!1,o.items,o.isItemDisabled)};break;case Dc:a={highlightedIndex:Br(o.items.length-1,!0,o.items,o.isItemDisabled)};break;case Io:a=ge({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 qc:a={isOpen:!0,highlightedIndex:$a(o),inputValue:t.inputValue};break;case Kc:a={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:mi(o,e,0)};break;case Lc:a={selectedItem:t.selectedItem,inputValue:o.itemToString(t.selectedItem)};break;case Bc:a={inputValue:t.inputValue};break;default:return TR(e,t,HO)}return ge({},e,a)}var _R=["onMouseLeave","refKey","ref"],PR=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],DR=["onClick","onPress","refKey","ref"],MR=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];Vc.stateChangeTypes=HO;function Vc(e){e===void 0&&(e={}),WO(e,Vc);var t=ge({},ER,e),n=t.items,r=t.scrollIntoView,o=t.environment,i=t.getA11yStatusMessage,a=AR(FR,t,RR,NR),s=a[0],c=a[1],p=s.isOpen,l=s.highlightedIndex,d=s.selectedItem,h=s.inputValue,m=v.useRef(null),S=v.useRef({}),I=v.useRef(null),f=v.useRef(null),C=Jo(),g=yR(t),O=v.useRef(),b=PO({state:s,props:t}),N=v.useCallback(function(W){return S.current[g.getItemId(W)]},[g]);wR(i,s,[p,l,d,h],o);var R=bR({menuElement:m.current,highlightedIndex:l,isOpen:p,itemRefs:S,scrollIntoView:r,getItemNodeFromIndex:N});MO({props:t,state:s}),v.useEffect(function(){var W=fi(t,"isOpen");W&&I.current&&I.current.focus()},[]),v.useEffect(function(){C||(O.current=n.length)});var E=SR(o,v.useCallback(function(){b.current.state.isOpen&&c({type:Io,selectItem:!1})},[c,b]),v.useMemo(function(){return[m,f,I]},[m.current,f.current,I.current])),x=DO("getInputProps","getMenuProps");v.useEffect(function(){p||(S.current={})},[p]),v.useEffect(function(){var W;!p||!(o!=null&&o.document)||!(I!=null&&(W=I.current)!=null&&W.focus)||o.document.activeElement!==I.current&&I.current.focus()},[p,o]);var _=v.useMemo(function(){return{ArrowDown:function(j){j.preventDefault(),c({type:Ec,altKey:j.altKey})},ArrowUp:function(j){j.preventDefault(),c({type:Fc,altKey:j.altKey})},Home:function(j){b.current.state.isOpen&&(j.preventDefault(),c({type:Pc}))},End:function(j){b.current.state.isOpen&&(j.preventDefault(),c({type:Dc}))},Escape:function(j){var V=b.current.state;(V.isOpen||V.inputValue||V.selectedItem||V.highlightedIndex>-1)&&(j.preventDefault(),c({type:_c}))},Enter:function(j){var V=b.current.state;!V.isOpen||j.which===229||(j.preventDefault(),c({type:kc}))},PageUp:function(j){b.current.state.isOpen&&(j.preventDefault(),c({type:Mc}))},PageDown:function(j){b.current.state.isOpen&&(j.preventDefault(),c({type:Jc}))}}},[c,b]),F=v.useCallback(function(W){return ge({id:g.labelId,htmlFor:g.inputId},W)},[g]),k=v.useCallback(function(W,j){var V,K=W===void 0?{}:W,ne=K.onMouseLeave,re=K.refKey,z=re===void 0?"ref":re,ie=K.ref,Y=yn(K,_R),fe=j===void 0?{}:j,L=fe.suppressRefError,Se=L===void 0?!1:L;return x("getMenuProps",Se,z,m),ge((V={},V[z]=Cr(ie,function(G){m.current=G}),V.id=g.menuId,V.role="listbox",V["aria-labelledby"]=Y&&Y["aria-label"]?void 0:""+g.labelId,V.onMouseLeave=ze(ne,function(){c({type:kO})}),V),Y)},[c,x,g]),J=v.useCallback(function(W){var j,V,K=W===void 0?{}:W,ne=K.item,re=K.index,z=K.refKey,ie=z===void 0?"ref":z,Y=K.ref,fe=K.onMouseMove,L=K.onMouseDown,Se=K.onClick;K.onPress;var G=K.disabled,Ae=yn(K,PR);G!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var Ve=b.current,et=Ve.props,$e=Ve.state,be=OR(ne,re,et.items,"Pass either item or index to getItemProps!"),kt=be[0],tt=be[1],St=et.isItemDisabled(kt,tt),qt="onClick",Kt=Se,nt=function(){E.isTouchEnd||tt===$e.highlightedIndex||(R.current=!1,c({type:qO,index:tt,disabled:St}))},Qe=function(){c({type:Uc,index:tt})},je=function(Ut){return Ut.preventDefault()};return ge((j={},j[ie]=Cr(Y,function(De){De&&(S.current[g.getItemId(tt)]=De)}),j["aria-disabled"]=St,j["aria-selected"]=tt===$e.highlightedIndex,j.id=g.getItemId(tt),j.role="option",j),!St&&(V={},V[qt]=ze(Kt,Qe),V),{onMouseMove:ze(fe,nt),onMouseDown:ze(L,je)},Ae)},[c,g,b,E,R]),q=v.useCallback(function(W){var j,V=W===void 0?{}:W,K=V.onClick;V.onPress;var ne=V.refKey,re=ne===void 0?"ref":ne,z=V.ref,ie=yn(V,DR),Y=b.current.state,fe=function(){c({type:KO})};return ge((j={},j[re]=Cr(z,function(L){f.current=L}),j["aria-controls"]=g.menuId,j["aria-expanded"]=Y.isOpen,j.id=g.toggleButtonId,j.tabIndex=-1,j),!ie.disabled&&ge({},{onClick:ze(K,fe)}),ie)},[c,b,g]),$=v.useCallback(function(W,j){var V,K=W===void 0?{}:W,ne=K.onKeyDown,re=K.onChange,z=K.onInput,ie=K.onBlur;K.onChangeText;var Y=K.onClick,fe=K.refKey,L=fe===void 0?"ref":fe,Se=K.ref,G=yn(K,MR),Ae=j===void 0?{}:j,Ve=Ae.suppressRefError,et=Ve===void 0?!1:Ve;x("getInputProps",et,L,I);var $e=b.current.state,be=function(je){var De=Ba(je);De&&_[De]&&_[De](je)},kt=function(je){c({type:qc,inputValue:je.target.value})},tt=function(je){if(o!=null&&o.document&&$e.isOpen&&!E.isMouseDown){var De=je.relatedTarget===null&&o.document.activeElement!==o.document.body;c({type:Io,selectItem:!De})}},St=function(){c({type:Kc})},qt="onChange",Kt={};if(!G.disabled){var nt;Kt=(nt={},nt[qt]=ze(re,z,kt),nt.onKeyDown=ze(ne,be),nt.onBlur=ze(ie,tt),nt.onClick=ze(Y,St),nt)}return ge((V={},V[L]=Cr(Se,function(Qe){I.current=Qe}),V["aria-activedescendant"]=$e.isOpen&&$e.highlightedIndex>-1?g.getItemId($e.highlightedIndex):"",V["aria-autocomplete"]="list",V["aria-controls"]=g.menuId,V["aria-expanded"]=$e.isOpen,V["aria-labelledby"]=G&&G["aria-label"]?void 0:g.labelId,V.autoComplete="off",V.id=g.inputId,V.role="combobox",V.value=$e.inputValue,V),Kt,G)},[c,g,o,_,b,E,x]),te=v.useCallback(function(){c({type:UO})},[c]),ee=v.useCallback(function(){c({type:BO})},[c]),oe=v.useCallback(function(){c({type:LO})},[c]),Oe=v.useCallback(function(W){c({type:VO,highlightedIndex:W})},[c]),we=v.useCallback(function(W){c({type:Lc,selectedItem:W})},[c]),D=v.useCallback(function(W){c({type:$O,inputValue:W})},[c]),B=v.useCallback(function(){c({type:jO})},[c]);return{getItemProps:J,getLabelProps:F,getMenuProps:k,getInputProps:$,getToggleButtonProps:q,toggleMenu:te,openMenu:oe,closeMenu:ee,setHighlightedIndex:Oe,setInputValue:D,selectItem:we,reset:B,highlightedIndex:l,isOpen:p,selectedItem:d,inputValue:h}}uo.stateReducer,uo.itemToKey,uo.environment,H.array,H.array,H.array,H.func,H.number,H.number,H.number,H.func,H.func,H.string,H.string;pi.itemToKey,pi.stateReducer,pi.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 JR="_comboboxContainer_1lcc8_1",kR="_label_1lcc8_8",qR="_inputContainer_1lcc8_12",KR="_input_1lcc8_12",UR="_toggleButton_1lcc8_33",LR="_menu_1lcc8_39",BR="_menuBottom_1lcc8_55",VR="_menuTop_1lcc8_61",$R="_menuItem_1lcc8_66",jR="_highlighted_1lcc8_73",HR="_selected_1lcc8_77",WR="_hidden_1lcc8_81",$t={comboboxContainer:JR,label:kR,inputContainer:qR,input:KR,toggleButton:UR,menu:LR,menuBottom:BR,menuTop:VR,menuItem:$R,highlighted:jR,selected:HR,hidden:WR};function zR(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function zO({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:o,style:i,menuPosition:a="bottom"}){const[s,c]=v.useState(e),p=v.useRef(null);v.useEffect(()=>c(e),[e]);const l=v.useCallback(E=>{(E==null?void 0:E.length)>0?c(e.filter(zR(E))):c(e)},[e]),{isOpen:d,getToggleButtonProps:h,getMenuProps:m,getInputProps:S,highlightedIndex:I,getItemProps:f,setInputValue:C,selectedItem:g}=Vc({items:s,selectedItem:t?e.find(E=>E.value===t):null,itemToString:E=>(E==null?void 0:E.label)||"",onInputValueChange:({inputValue:E})=>l(E),onSelectedItemChange:({selectedItem:E})=>{var x;n(E),(x=p.current)==null||x.blur()}}),O=()=>{C(""),c(e)},b=()=>O(),N=v.useMemo(()=>{var E;return(E=e.find(x=>x.value===t))==null?void 0:E.label},[e,t]),R=()=>{t&&N&&t!==(g==null?void 0:g.value)&&C(N||"")};return u.jsxs("div",{style:{position:"relative",...i},children:[u.jsx("div",{className:$t.comboboxContainer,children:u.jsxs("div",{className:$t.inputContainer,children:[u.jsx("input",{style:{border:"none"},disabled:o,placeholder:r,className:$t.input,...S({onFocus:b,onBlur:R,ref:p})}),u.jsx("button",{style:{border:"none"},disabled:o,"aria-label":"toggle menu",className:$t.toggleButton,type:"button",...h(),children:d?u.jsx(u.Fragment,{children:"↑"}):u.jsx(u.Fragment,{children:"↓"})})]})}),u.jsx("ul",{className:`${$t.menu} ${d&&e.length?"":$t.hidden} ${a==="top"?$t.menuTop:$t.menuBottom}`,...m(),children:d&&s.map((E,x)=>u.jsx("li",{className:`${$t.menuItem} ${I===x?$t.highlighted:""} ${t===(E==null?void 0:E.value)?$t.selected:""}`,...f({item:E,index:x}),children:u.jsx("span",{children:E.label})},E.id))})]})}const Vr=Math.min,lr=Math.max,So=Math.round,eo=Math.floor,jn=e=>({x:e,y:e}),GR={left:"right",right:"left",bottom:"top",top:"bottom"},XR={start:"end",end:"start"};function ja(e,t,n){return lr(e,Vr(t,n))}function Fi(e,t){return typeof e=="function"?e(t):e}function mr(e){return e.split("-")[0]}function _i(e){return e.split("-")[1]}function GO(e){return e==="x"?"y":"x"}function $c(e){return e==="y"?"height":"width"}function $r(e){return["top","bottom"].includes(mr(e))?"y":"x"}function jc(e){return GO($r(e))}function QR(e,t,n){n===void 0&&(n=!1);const r=_i(e),o=jc(e),i=$c(o);let a=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=wo(a)),[a,wo(a)]}function YR(e){const t=wo(e);return[Ha(e),t,Ha(t)]}function Ha(e){return e.replace(/start|end/g,t=>XR[t])}function ZR(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:a;default:return[]}}function ex(e,t,n,r){const o=_i(e);let i=ZR(mr(e),n==="start",r);return o&&(i=i.map(a=>a+"-"+o),t&&(i=i.concat(i.map(Ha)))),i}function wo(e){return e.replace(/left|right|bottom|top/g,t=>GR[t])}function tx(e){return{top:0,right:0,bottom:0,left:0,...e}}function XO(e){return typeof e!="number"?tx(e):{top:e,right:e,bottom:e,left:e}}function bo(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 Yu(e,t,n){let{reference:r,floating:o}=e;const i=$r(t),a=jc(t),s=$c(a),c=mr(t),p=i==="y",l=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,h=r[s]/2-o[s]/2;let m;switch(c){case"top":m={x:l,y:r.y-o.height};break;case"bottom":m={x:l,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:d};break;case"left":m={x:r.x-o.width,y:d};break;default:m={x:r.x,y:r.y}}switch(_i(t)){case"start":m[a]-=h*(n&&p?-1:1);break;case"end":m[a]+=h*(n&&p?-1:1);break}return m}const nx=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,s=i.filter(Boolean),c=await(a.isRTL==null?void 0:a.isRTL(t));let p=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:l,y:d}=Yu(p,r,c),h=r,m={},S=0;for(let I=0;I<s.length;I++){const{name:f,fn:C}=s[I],{x:g,y:O,data:b,reset:N}=await C({x:l,y:d,initialPlacement:r,placement:h,strategy:o,middlewareData:m,rects:p,platform:a,elements:{reference:e,floating:t}});l=g??l,d=O??d,m={...m,[f]:{...m[f],...b}},N&&S<=50&&(S++,typeof N=="object"&&(N.placement&&(h=N.placement),N.rects&&(p=N.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:o}):N.rects),{x:l,y:d}=Yu(p,h,c)),I=-1)}return{x:l,y:d,placement:h,strategy:o,middlewareData:m}};async function QO(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:a,elements:s,strategy:c}=e,{boundary:p="clippingAncestors",rootBoundary:l="viewport",elementContext:d="floating",altBoundary:h=!1,padding:m=0}=Fi(t,e),S=XO(m),f=s[h?d==="floating"?"reference":"floating":d],C=bo(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(f)))==null||n?f:f.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(s.floating)),boundary:p,rootBoundary:l,strategy:c})),g=d==="floating"?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,O=await(i.getOffsetParent==null?void 0:i.getOffsetParent(s.floating)),b=await(i.isElement==null?void 0:i.isElement(O))?await(i.getScale==null?void 0:i.getScale(O))||{x:1,y:1}:{x:1,y:1},N=bo(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:g,offsetParent:O,strategy:c}):g);return{top:(C.top-N.top+S.top)/b.y,bottom:(N.bottom-C.bottom+S.bottom)/b.y,left:(C.left-N.left+S.left)/b.x,right:(N.right-C.right+S.right)/b.x}}const rx=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:a,elements:s,middlewareData:c}=t,{element:p,padding:l=0}=Fi(e,t)||{};if(p==null)return{};const d=XO(l),h={x:n,y:r},m=jc(o),S=$c(m),I=await a.getDimensions(p),f=m==="y",C=f?"top":"left",g=f?"bottom":"right",O=f?"clientHeight":"clientWidth",b=i.reference[S]+i.reference[m]-h[m]-i.floating[S],N=h[m]-i.reference[m],R=await(a.getOffsetParent==null?void 0:a.getOffsetParent(p));let E=R?R[O]:0;(!E||!await(a.isElement==null?void 0:a.isElement(R)))&&(E=s.floating[O]||i.floating[S]);const x=b/2-N/2,_=E/2-I[S]/2-1,F=Vr(d[C],_),k=Vr(d[g],_),J=F,q=E-I[S]-k,$=E/2-I[S]/2+x,te=ja(J,$,q),ee=!c.arrow&&_i(o)!=null&&$!==te&&i.reference[S]/2-($<J?F:k)-I[S]/2<0,oe=ee?$<J?$-J:$-q:0;return{[m]:h[m]+oe,data:{[m]:te,centerOffset:$-te-oe,...ee&&{alignmentOffset:oe}},reset:ee}}}),ix=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:s,platform:c,elements:p}=t,{mainAxis:l=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:S="none",flipAlignment:I=!0,...f}=Fi(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const C=mr(o),g=$r(s),O=mr(s)===s,b=await(c.isRTL==null?void 0:c.isRTL(p.floating)),N=h||(O||!I?[wo(s)]:YR(s)),R=S!=="none";!h&&R&&N.push(...ex(s,I,S,b));const E=[s,...N],x=await QO(t,f),_=[];let F=((r=i.flip)==null?void 0:r.overflows)||[];if(l&&_.push(x[C]),d){const $=QR(o,a,b);_.push(x[$[0]],x[$[1]])}if(F=[...F,{placement:o,overflows:_}],!_.every($=>$<=0)){var k,J;const $=(((k=i.flip)==null?void 0:k.index)||0)+1,te=E[$];if(te)return{data:{index:$,overflows:F},reset:{placement:te}};let ee=(J=F.filter(oe=>oe.overflows[0]<=0).sort((oe,Oe)=>oe.overflows[1]-Oe.overflows[1])[0])==null?void 0:J.placement;if(!ee)switch(m){case"bestFit":{var q;const oe=(q=F.filter(Oe=>{if(R){const we=$r(Oe.placement);return we===g||we==="y"}return!0}).map(Oe=>[Oe.placement,Oe.overflows.filter(we=>we>0).reduce((we,D)=>we+D,0)]).sort((Oe,we)=>Oe[1]-we[1])[0])==null?void 0:q[0];oe&&(ee=oe);break}case"initialPlacement":ee=s;break}if(o!==ee)return{reset:{placement:ee}}}return{}}}};async function ox(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),a=mr(n),s=_i(n),c=$r(n)==="y",p=["left","top"].includes(a)?-1:1,l=i&&c?-1:1,d=Fi(t,e);let{mainAxis:h,crossAxis:m,alignmentAxis:S}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof S=="number"&&(m=s==="end"?S*-1:S),c?{x:m*l,y:h*p}:{x:h*p,y:m*l}}const ax=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:a,middlewareData:s}=t,c=await ox(t,e);return a===((n=s.offset)==null?void 0:n.placement)&&(r=s.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:i+c.y,data:{...c,placement:a}}}}},sx=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:a=!1,limiter:s={fn:f=>{let{x:C,y:g}=f;return{x:C,y:g}}},...c}=Fi(e,t),p={x:n,y:r},l=await QO(t,c),d=$r(mr(o)),h=GO(d);let m=p[h],S=p[d];if(i){const f=h==="y"?"top":"left",C=h==="y"?"bottom":"right",g=m+l[f],O=m-l[C];m=ja(g,m,O)}if(a){const f=d==="y"?"top":"left",C=d==="y"?"bottom":"right",g=S+l[f],O=S-l[C];S=ja(g,S,O)}const I=s.fn({...t,[h]:m,[d]:S});return{...I,data:{x:I.x-n,y:I.y-r,enabled:{[h]:i,[d]:a}}}}}};function ko(){return typeof window<"u"}function ti(e){return YO(e)?(e.nodeName||"").toLowerCase():"#document"}function Ct(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function sn(e){var t;return(t=(YO(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function YO(e){return ko()?e instanceof Node||e instanceof Ct(e).Node:!1}function Qt(e){return ko()?e instanceof Element||e instanceof Ct(e).Element:!1}function an(e){return ko()?e instanceof HTMLElement||e instanceof Ct(e).HTMLElement:!1}function Zu(e){return!ko()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ct(e).ShadowRoot}function Pi(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Yt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function cx(e){return["table","td","th"].includes(ti(e))}function qo(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Hc(e){const t=Wc(),n=Qt(e)?Yt(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 ux(e){let t=Hn(e);for(;an(t)&&!jr(t);){if(Hc(t))return t;if(qo(t))return null;t=Hn(t)}return null}function Wc(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function jr(e){return["html","body","#document"].includes(ti(e))}function Yt(e){return Ct(e).getComputedStyle(e)}function Ko(e){return Qt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Hn(e){if(ti(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Zu(e)&&e.host||sn(e);return Zu(t)?t.host:t}function ZO(e){const t=Hn(e);return jr(t)?e.ownerDocument?e.ownerDocument.body:e.body:an(t)&&Pi(t)?t:ZO(t)}function Oi(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=ZO(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),a=Ct(o);if(i){const s=Wa(a);return t.concat(a,a.visualViewport||[],Pi(o)?o:[],s&&n?Oi(s):[])}return t.concat(o,Oi(o,[],n))}function Wa(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ev(e){const t=Yt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=an(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,s=So(n)!==i||So(r)!==a;return s&&(n=i,r=a),{width:n,height:r,$:s}}function zc(e){return Qt(e)?e:e.contextElement}function Rr(e){const t=zc(e);if(!an(t))return jn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=ev(t);let a=(i?So(n.width):n.width)/r,s=(i?So(n.height):n.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}const lx=jn(0);function tv(e){const t=Ct(e);return!Wc()||!t.visualViewport?lx:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function dx(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ct(e)?!1:t}function hr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=zc(e);let a=jn(1);t&&(r?Qt(r)&&(a=Rr(r)):a=Rr(e));const s=dx(i,n,r)?tv(i):jn(0);let c=(o.left+s.x)/a.x,p=(o.top+s.y)/a.y,l=o.width/a.x,d=o.height/a.y;if(i){const h=Ct(i),m=r&&Qt(r)?Ct(r):r;let S=h,I=Wa(S);for(;I&&r&&m!==S;){const f=Rr(I),C=I.getBoundingClientRect(),g=Yt(I),O=C.left+(I.clientLeft+parseFloat(g.paddingLeft))*f.x,b=C.top+(I.clientTop+parseFloat(g.paddingTop))*f.y;c*=f.x,p*=f.y,l*=f.x,d*=f.y,c+=O,p+=b,S=Ct(I),I=Wa(S)}}return bo({width:l,height:d,x:c,y:p})}function px(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",a=sn(r),s=t?qo(t.floating):!1;if(r===a||s&&i)return n;let c={scrollLeft:0,scrollTop:0},p=jn(1);const l=jn(0),d=an(r);if((d||!d&&!i)&&((ti(r)!=="body"||Pi(a))&&(c=Ko(r)),an(r))){const h=hr(r);p=Rr(r),l.x=h.x+r.clientLeft,l.y=h.y+r.clientTop}return{width:n.width*p.x,height:n.height*p.y,x:n.x*p.x-c.scrollLeft*p.x+l.x,y:n.y*p.y-c.scrollTop*p.y+l.y}}function fx(e){return Array.from(e.getClientRects())}function za(e,t){const n=Ko(e).scrollLeft;return t?t.left+n:hr(sn(e)).left+n}function mx(e){const t=sn(e),n=Ko(e),r=e.ownerDocument.body,o=lr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=lr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+za(e);const s=-n.scrollTop;return Yt(r).direction==="rtl"&&(a+=lr(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:s}}function hx(e,t){const n=Ct(e),r=sn(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,s=0,c=0;if(o){i=o.width,a=o.height;const p=Wc();(!p||p&&t==="fixed")&&(s=o.offsetLeft,c=o.offsetTop)}return{width:i,height:a,x:s,y:c}}function gx(e,t){const n=hr(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=an(e)?Rr(e):jn(1),a=e.clientWidth*i.x,s=e.clientHeight*i.y,c=o*i.x,p=r*i.y;return{width:a,height:s,x:c,y:p}}function el(e,t,n){let r;if(t==="viewport")r=hx(e,n);else if(t==="document")r=mx(sn(e));else if(Qt(t))r=gx(t,n);else{const o=tv(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return bo(r)}function nv(e,t){const n=Hn(e);return n===t||!Qt(n)||jr(n)?!1:Yt(n).position==="fixed"||nv(n,t)}function yx(e,t){const n=t.get(e);if(n)return n;let r=Oi(e,[],!1).filter(s=>Qt(s)&&ti(s)!=="body"),o=null;const i=Yt(e).position==="fixed";let a=i?Hn(e):e;for(;Qt(a)&&!jr(a);){const s=Yt(a),c=Hc(a);!c&&s.position==="fixed"&&(o=null),(i?!c&&!o:!c&&s.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Pi(a)&&!c&&nv(e,a))?r=r.filter(l=>l!==a):o=s,a=Hn(a)}return t.set(e,r),r}function Ox(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const a=[...n==="clippingAncestors"?qo(t)?[]:yx(t,this._c):[].concat(n),r],s=a[0],c=a.reduce((p,l)=>{const d=el(t,l,o);return p.top=lr(d.top,p.top),p.right=Vr(d.right,p.right),p.bottom=Vr(d.bottom,p.bottom),p.left=lr(d.left,p.left),p},el(t,s,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function vx(e){const{width:t,height:n}=ev(e);return{width:t,height:n}}function Ix(e,t,n){const r=an(t),o=sn(t),i=n==="fixed",a=hr(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const c=jn(0);if(r||!r&&!i)if((ti(t)!=="body"||Pi(o))&&(s=Ko(t)),r){const m=hr(t,!0,i,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}else o&&(c.x=za(o));let p=0,l=0;if(o&&!r&&!i){const m=o.getBoundingClientRect();l=m.top+s.scrollTop,p=m.left+s.scrollLeft-za(o,m)}const d=a.left+s.scrollLeft-c.x-p,h=a.top+s.scrollTop-c.y-l;return{x:d,y:h,width:a.width,height:a.height}}function la(e){return Yt(e).position==="static"}function tl(e,t){if(!an(e)||Yt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return sn(e)===n&&(n=n.ownerDocument.body),n}function rv(e,t){const n=Ct(e);if(qo(e))return n;if(!an(e)){let o=Hn(e);for(;o&&!jr(o);){if(Qt(o)&&!la(o))return o;o=Hn(o)}return n}let r=tl(e,t);for(;r&&cx(r)&&la(r);)r=tl(r,t);return r&&jr(r)&&la(r)&&!Hc(r)?n:r||ux(e)||n}const Sx=async function(e){const t=this.getOffsetParent||rv,n=this.getDimensions,r=await n(e.floating);return{reference:Ix(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function wx(e){return Yt(e).direction==="rtl"}const bx={convertOffsetParentRelativeRectToViewportRelativeRect:px,getDocumentElement:sn,getClippingRect:Ox,getOffsetParent:rv,getElementRects:Sx,getClientRects:fx,getDimensions:vx,getScale:Rr,isElement:Qt,isRTL:wx};function Nx(e,t){let n=null,r;const o=sn(e);function i(){var s;clearTimeout(r),(s=n)==null||s.disconnect(),n=null}function a(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),i();const{left:p,top:l,width:d,height:h}=e.getBoundingClientRect();if(s||t(),!d||!h)return;const m=eo(l),S=eo(o.clientWidth-(p+d)),I=eo(o.clientHeight-(l+h)),f=eo(p),g={rootMargin:-m+"px "+-S+"px "+-I+"px "+-f+"px",threshold:lr(0,Vr(1,c))||1};let O=!0;function b(N){const R=N[0].intersectionRatio;if(R!==c){if(!O)return a();R?a(!1,R):r=setTimeout(()=>{a(!1,1e-7)},1e3)}O=!1}try{n=new IntersectionObserver(b,{...g,root:o.ownerDocument})}catch{n=new IntersectionObserver(b,g)}n.observe(e)}return a(!0),i}function Cx(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,p=zc(e),l=o||i?[...p?Oi(p):[],...Oi(t)]:[];l.forEach(C=>{o&&C.addEventListener("scroll",n,{passive:!0}),i&&C.addEventListener("resize",n)});const d=p&&s?Nx(p,n):null;let h=-1,m=null;a&&(m=new ResizeObserver(C=>{let[g]=C;g&&g.target===p&&m&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var O;(O=m)==null||O.observe(t)})),n()}),p&&!c&&m.observe(p),m.observe(t));let S,I=c?hr(e):null;c&&f();function f(){const C=hr(e);I&&(C.x!==I.x||C.y!==I.y||C.width!==I.width||C.height!==I.height)&&n(),I=C,S=requestAnimationFrame(f)}return n(),()=>{var C;l.forEach(g=>{o&&g.removeEventListener("scroll",n),i&&g.removeEventListener("resize",n)}),d==null||d(),(C=m)==null||C.disconnect(),m=null,c&&cancelAnimationFrame(S)}}const Tx=ax,Rx=sx,xx=ix,Ax=rx,nl=(e,t,n)=>{const r=new Map,o={platform:bx,...n},i={...o.platform,_c:r};return nx(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 bI="react-tooltip-core-styles",CI="react-tooltip-base-styles",Ec={core:!1,base:!1};function Sc({css:e,id:t=CI,type:n="base",ref:r}){var o,i;if(!e||typeof document>"u"||Ec[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)),Ec[n]=!0}const Nc=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})),Oc(e,t,{placement:r,strategy:i,middleware:c}).then(({x:f,y:u,placement:d,middlewareData:g})=>{var h,I;const v={left:`${f}px`,top:`${u}px`,border:a},{x:p,y:C}=(h=g.arrow)!==null&&h!==void 0?h:{x:0,y:0},m=(I={top:"bottom",right:"left",bottom:"top",left:"right"}[d.split("-")[0]])!==null&&I!==void 0?I:"bottom",w=a&&{borderBottom:a,borderRight:a};let x=0;if(a){const _=`${a}`.match(/(\d+)px/);x=_!=null&&_[1]?Number(_[1]):1}return{tooltipStyles:v,tooltipArrowStyles:{left:p!=null?`${p}px`:"",top:C!=null?`${C}px`:"",right:"",bottom:"",...w,[m]:`-${4+x}px`},place:d}})):Oc(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}))},Tc=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),Rc=(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},Ac=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",Ss=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((o,i)=>Ss(o,t[i]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Ac(e)||!Ac(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(o=>Ss(e[o],t[o]))},xI=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"})},Pc=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(xI(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},_I=typeof window<"u"?y.useLayoutEffect:y.useEffect,Rt=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 fd(e=OI){return y.useContext(SI).getTooltipData(e)}var br={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:I=0,delayHide:v=0,float:p=!1,hidden:C=!1,noArrow:m=!1,clickable:w=!1,closeOnEsc:x=!1,closeOnScroll:_=!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),It=y.useRef(null),{anchorRefs:Mt,setActiveAnchor:kt}=fd(t),et=y.useRef(!1),[Ge,$e]=y.useState([]),Pe=y.useRef(!1),jt=u||f.includes("click"),pt=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 bt=A?{...A}:{escape:x||!1,scroll:_||!1,resize:S||!1,clickOutsideAnchor:pt||!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(bt,{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(Rt(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=>Ss(ce,W)?ce:W)},bn=(W=I)=>{Rt(Q),Ye?Fe(!0):Q.current=setTimeout(()=>{Fe(!0)},W)},cn=(W=v)=>{Rt(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});I?bn():Fe(!0),$(le),kt({current:le}),Rt(de)},ht=()=>{w?cn(v||100):v?cn():Fe(!1),Rt(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})};Nc({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)})},Cn=W=>{if(!W)return;const ce=W,le={x:ce.clientX,y:ce.clientY};ln(le),It.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),Rt(Q)))},xn=Rc(Bn,50),Ae=Rc(ht,50),it=W=>{Ae.cancel(),xn(W)},oe=()=>{xn.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?It.current&&ln(It.current):j!=null&&j.isConnected&&Nc({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)},mt=Pc(j),Qe=Pc(B.current);bt.scroll&&(window.addEventListener("scroll",He),mt==null||mt.addEventListener("scroll",He),Qe==null||Qe.addEventListener("scroll",He));let tt=null;bt.resize?window.addEventListener("resize",He):j&&B.current&&(tt=gI(j,B.current,ge,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const gt=ye=>{ye.key==="Escape"&&Fe(!1)};bt.escape&&window.addEventListener("keydown",gt),bt.clickOutsideAnchor&&window.addEventListener("click",Jn);const Te=[],_n=ye=>!!(ye!=null&&ye.target&&(j!=null&&j.contains(ye.target))),Fo=ye=>{Se&&_n(ye)||Bn(ye)},Lt=ye=>{Se&&_n(ye)&&ht()},Ei=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],Si=["click","dblclick","mousedown","mouseup"];Object.entries(sn).forEach(([ye,Kt])=>{Kt&&(Ei.includes(ye)?Te.push({event:ye,listener:it}):Si.includes(ye)&&Te.push({event:ye,listener:Fo}))}),Object.entries(Yt).forEach(([ye,Kt])=>{Kt&&(Ei.includes(ye)?Te.push({event:ye,listener:oe}):Si.includes(ye)&&Te.push({event:ye,listener:Lt}))}),p&&Te.push({event:"pointermove",listener:Cn});const Ni=()=>{et.current=!0},Ti=()=>{et.current=!1,ht()},Ri=w&&(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)),Te.forEach(({event:ye,listener:Kt})=>{le.forEach(Xr=>{var Wn;(Wn=Xr.current)===null||Wn===void 0||Wn.addEventListener(ye,Kt)})}),()=>{var ye,Kt;bt.scroll&&(window.removeEventListener("scroll",He),mt==null||mt.removeEventListener("scroll",He),Qe==null||Qe.removeEventListener("scroll",He)),bt.resize?window.removeEventListener("resize",He):tt==null||tt(),bt.clickOutsideAnchor&&window.removeEventListener("click",Jn),bt.escape&&window.removeEventListener("keydown",gt),Ri&&((ye=B.current)===null||ye===void 0||ye.removeEventListener("mouseover",Ni),(Kt=B.current)===null||Kt===void 0||Kt.removeEventListener("mouseout",Ti)),Te.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,I,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 mt=[],Qe=[];He.forEach(tt=>{if(tt.type==="attributes"&&tt.attributeName==="data-tooltip-id"&&(tt.target.getAttribute("data-tooltip-id")===t?mt.push(tt.target):tt.oldValue===t&&Qe.push(tt.target)),tt.type==="childList"){if(j){const gt=[...tt.removedNodes].filter(Te=>Te.nodeType===1);if(le)try{Qe.push(...gt.filter(Te=>Te.matches(le))),Qe.push(...gt.flatMap(Te=>[...Te.querySelectorAll(le)]))}catch{}gt.some(Te=>{var _n;return!!(!((_n=Te==null?void 0:Te.contains)===null||_n===void 0)&&_n.call(Te,j))&&(Ue(!1),Fe(!1),$(null),Rt(Q),Rt(de),!0)})}if(le)try{const gt=[...tt.addedNodes].filter(Te=>Te.nodeType===1);mt.push(...gt.filter(Te=>Te.matches(le))),mt.push(...gt.flatMap(Te=>[...Te.querySelectorAll(le)]))}catch{}}}),(mt.length||Qe.length)&&$e(tt=>[...tt.filter(gt=>!Qe.includes(gt)),...mt])});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),()=>{Rt(Q),Rt(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&&(Rt(Q),bn(I))},[I]);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&&!C&&qe&&un)})),Ye&&!C&&qe?y.createElement(h,{id:t,role:te,className:Pt("react-tooltip",br.tooltip,Go.tooltip,Go[o],n,`react-tooltip__place-${we.place}`,br[un?"show":"closing"],un?"react-tooltip__show":"react-tooltip__closing",d==="fixed"&&br.fixed,w&&br.clickable),onTransitionEnd:W=>{Rt(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",br.arrow,Go.arrow,r,m&&br.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:I=!1,positionStrategy:v="absolute",middlewares:p,delayShow:C=0,delayHide:m=0,float:w=!1,hidden:x=!1,noArrow:_=!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(C),[Dt,Ze]=y.useState(m),[It,Mt]=y.useState(w),[kt,et]=y.useState(x),[Ge,$e]=y.useState(d),[Pe,jt]=y.useState(h),[pt,sn]=y.useState(v),[Yt,bt]=y.useState(null),[Fe,an]=y.useState(null),bn=y.useRef(fe),{anchorRefs:cn,activeAnchor:Bn}=fd(e),ht=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?C:Number(oe))},"delay-hide":oe=>{Ze(oe===null?m:Number(oe))},float:oe=>{Mt(oe===null?w:oe==="true")},hidden:oe=>{et(oe===null?x:oe==="true")},"class-name":oe=>{bt(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(C)},[C]),y.useEffect(()=>{Ze(m)},[m]),y.useEffect(()=>{Mt(w)},[w]),y.useEffect(()=>{et(x)},[x]),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=ht(qe);ln(He)})}),W={attributes:!0,childList:!1,subtree:!1};if(qe){const ce=ht(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&&!Tc("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&&!Tc("opacity",`${P}`)&&console.warn(`[react-tooltip] "${P}" is not a valid \`opacity\`.`)},[]);let Cn=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});Cn=Ae?y.createElement("div",{ref:Jn,className:"react-tooltip-content-wrapper"},Ae):null}else B&&(Cn=B);Q&&(Cn=y.createElement(TI,{content:Q}));const xn={forwardRef:ne,id:e,anchorId:t,anchorSelect:n,className:Pt(s,Yt),classNameArrow:a,content:Cn,contentWrapperRef:Jn,place:k,variant:J,offset:Ve,wrapper:Ge,events:Pe,openOnClick:I,positionStrategy:pt,middlewares:p,delayShow:Ue,delayHide:Dt,float:It,hidden:kt,noArrow:_,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,{...xn})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||Sc({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||Sc({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 pd=y.createContext(null);function hd(){const e=y.useContext(pd);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const md=y.createContext(()=>{});function FI(){const e=y.useContext(md);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}var gd=Symbol.for("immer-nothing"),Fc=Symbol.for("immer-draftable"),Ot=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 wt(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 qr=Object.getPrototypeOf;function Hr(e){return!!e&&!!e[Ot]}function hr(e){var t;return e?yd(e)||Array.isArray(e)||!!e[Fc]||!!((t=e.constructor)!=null&&t[Fc])||xo(e)||_o(e):!1}var MI=Object.prototype.constructor.toString();function yd(e){if(!e||typeof e!="object")return!1;const t=qr(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){Co(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Co(e){const t=e[Ot];return t?t.type_:Array.isArray(e)?1:xo(e)?2:_o(e)?3:0}function Ns(e,t){return Co(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function vd(e,t,n){const r=Co(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 xo(e){return e instanceof Map}function _o(e){return e instanceof Set}function Xn(e){return e.copy_||e.base_}function Ts(e,t){if(xo(e))return new Map(e);if(_o(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=yd(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[Ot];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(qr(e),r)}else{const r=qr(e);if(r!==null&&n)return{...e};const o=Object.create(r);return Object.assign(o,e)}}function ha(e,t=!1){return Oo(e)||Hr(e)||!hr(e)||(Co(e)>1&&(e.set=e.add=e.clear=e.delete=jI),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>ha(r,!0))),e}function jI(){wt(2)}function Oo(e){return Object.isFrozen(e)}var LI={};function mr(e){const t=LI[e];return t||wt(0,e),t}var ui;function wd(){return ui}function KI(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Dc(e,t){t&&(mr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Rs(e){As(e),e.drafts_.forEach(VI),e.drafts_=null}function As(e){e===ui&&(ui=e.parent_)}function Mc(e){return ui=KI(ui,e)}function VI(e){const t=e[Ot];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function kc(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Ot].modified_&&(Rs(t),wt(4)),hr(e)&&(e=po(t,e),t.parent_||ho(t,e)),t.patches_&&mr("Patches").generateReplacementPatches_(n[Ot].base_,e,t.patches_,t.inversePatches_)):e=po(t,n,[]),Rs(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==gd?e:void 0}function po(e,t,n){if(Oo(t))return t;const r=t[Ot];if(!r)return fo(t,(o,i)=>jc(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)=>jc(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 jc(e,t,n,r,o,i,s){if(process.env.NODE_ENV!=="production"&&o===n&&wt(5),Hr(o)){const a=i&&t&&t.type_!==3&&!Ns(t.assigned_,r)?i.concat(r):void 0,c=po(e,o,a);if(vd(n,r,c),Hr(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_&&ha(t,n)}function UI(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:wd(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=ma;n&&(o=[r],i=di);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}var ma={get(e,t){if(t===Ot)return e;const n=Xn(e);if(!Ns(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]=Fs(r,e)):r},has(e,t){return t in Xn(e)},ownKeys(e){return Reflect.ownKeys(Xn(e))},set(e,t,n){const r=Id(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[Ot];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(kI(n,o)&&(n!==void 0||Ns(e.base_,t)))return!0;Xo(e),Ps(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),Ps(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(){wt(11)},getPrototypeOf(e){return qr(e.base_)},setPrototypeOf(){wt(12)}},di={};fo(ma,(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))&&wt(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))&&wt(14),ma.set.call(this,e[0],t,n,e[0])};function Qo(e,t){const n=e[Ot];return(n?Xn(n):e)[t]}function $I(e,t,n){var o;const r=Id(t,n);return r?"value"in r?r.value:(o=r.get)==null?void 0:o.call(e.draft_):void 0}function Id(e,t){if(!(t in e))return;let n=qr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=qr(n)}}function Ps(e){e.modified_||(e.modified_=!0,e.parent_&&Ps(e.parent_))}function Xo(e){e.copy_||(e.copy_=Ts(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"&&wt(6),r!==void 0&&typeof r!="function"&&wt(7);let o;if(hr(t)){const i=Mc(this),s=Fs(t,void 0);let a=!0;try{o=n(s),a=!1}finally{a?Rs(i):As(i)}return Dc(i,r),kc(o,i)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===gd&&(o=void 0),this.autoFreeze_&&ha(o,!0),r){const i=[],s=[];mr("Patches").generateReplacementPatches_(t,o,i,s),r(i,s)}return o}else wt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,c=>t(c,...a));let r,o;return[this.produce(t,n,(s,a)=>{r=s,o=a}),r,o]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){hr(e)||wt(8),Hr(e)&&(e=HI(e));const t=Mc(this),n=Fs(e,void 0);return n[Ot].isManual_=!0,As(t),n}finishDraft(e,t){const n=e&&e[Ot];(!n||!n.isManual_)&&wt(9);const{scope_:r}=n;return Dc(r,t),kc(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 Hr(e)?r(e,t):this.produce(e,o=>r(o,t))}};function Fs(e,t){const n=xo(e)?mr("MapSet").proxyMap_(e,t):_o(e)?mr("MapSet").proxySet_(e,t):UI(e,t);return(t?t.scope_:wd()).drafts_.push(n),n}function HI(e){return Hr(e)||wt(10,e),bd(e)}function bd(e){if(!hr(e)||Oo(e))return e;const t=e[Ot];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Ts(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Ts(e,!0);return fo(n,(r,o)=>{vd(n,r,bd(o))}),t&&(t.finalized_=!1),n}var Et=new qI,ti=Et.produce;Et.produceWithPatches.bind(Et);Et.setAutoFreeze.bind(Et);Et.setUseStrictShallowCopy.bind(Et);Et.applyPatches.bind(Et);Et.createDraft.bind(Et);Et.finishDraft.bind(Et);const Cd=y.createContext(void 0),BI={};function ga(){const e=y.useContext(Cd);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,I)=>{i(v=>ti(v,p=>{p[h]=ti(p[h],I)}))},[i]),c=y.useCallback((h,I)=>{i(v=>ti(v,p=>{p[h]=I}))},[i]),f=y.useCallback(()=>{i(ti(h=>{const I=h.other.write;I&&(I.isWriteModified=!1)}))},[i]),u=y.useCallback(h=>{i(ti(I=>{var p;const v=(p=I[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(Cd.Provider,{value:g,children:e})}const Xt=()=>{const{appName:e}=Ne(),{objectConfigurationsState:t,setConfigureState:n}=ga(),{selectedObjectName:r}=hd(),o=fu(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=!su(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 ya({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(w=>({id:w.fieldName,label:w.displayName,value:w.fieldName})),[n]),I=l.jsx(nd,{disabled:s,items:h,selectedValue:g||null,onSelectedItemChange:w=>{t({target:{name:e.mapToName,value:w==null?void 0:w.value}})},placeholder:"Please select one",style:{width:"100%"}}),v=y.useCallback(()=>{o&&(fi(o,i,[{field:e.mapToName,value:null}]),c(ue.MAPPING,o)&&f(ue.MAPPING,o))},[e.mapToName,o,i,c,f]),{hasDuplicationError:p,errorMessage:C}=y.useMemo(()=>{const w=u(ue.MAPPING,o),x=Array.isArray(w)&&w.length>0&&w.includes(e.mapToName);return{hasDuplicationError:x,errorMessage:x?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:[I,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:[" ",C," "]},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",Lc={divider:nb};function So({className:e,style:t}){return l.jsx("hr",{className:e?`${Lc.divider} ${e}`:Lc.divider,style:t})}function St({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(ya,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function ib(){var I,v;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Xt(),{isError:r,removeError:o,setError:i}=Ft(),s=((I=t==null?void 0:t.read)==null?void 0:I.allFields)||[],{fieldMapping:a}=rt(),c=(v=t==null?void 0:t.read)==null?void 0:v.selectedFieldMappings,f=p=>{const{value:C,name:m}=p.target;!C||xd({selectedFieldMappings:c,selectedObjectName:e,fieldName:m,fieldValue:C,setError:i})||(e&&fi(e,n,[{field:m,value:C}]),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(w=>!u.some(x=>x.mapToName===w.mapToName))},[t,u]),g=u.length>0;return d.length>0||g?l.jsxs(l.Fragment,{children:[l.jsx(St,{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(ya,{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(St,{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(ya,{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,I;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=((I=t==null?void 0:t.read)==null?void 0:I.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=ct(),{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})},lt=e=>{const t=_i(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 ub(){var f,u,d;const{project:e}=Ne(),{hydratedRevision:t}=Gr(),{selectedObjectName:n}=Xt(),{providerName:r}=lt(),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 Kc(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=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 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 C;const{scope:g,children:h,...I}=d,v=((C=g==null?void 0:g[e])==null?void 0:C[c])||a,p=M.useMemo(()=>I,Object.values(I));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,I=M.useContext(h);if(I)return I;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 va({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 wa=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};wa.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 Ds(e){const t=bb(e),n=M.forwardRef((r,o)=>{const{children:i,...s}=r,a=M.Children.toArray(i),c=a.find(xb);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 Cb=Symbol("radix.slottable");function xb(e){return M.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Cb}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=Ds(`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,p_]=No(To),[Nb,Ia]=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]=va({prop:n,defaultProp:o??!1,onChange:c,caller:To}),[I,v]=M.useState(null),[p,C]=M.useState(null),m=M.useRef(!1),w=I?!!s||!!I.closest("form"):!0,x={checked:g,disabled:i,setChecked:h,control:I,setControl:v,name:a,form:s,value:u,hasConsumerStoppedPropagationRef:m,required:f,defaultChecked:Vn(o)?!1:o,isFormControl:w,bubbleInput:p,setBubbleInput:C};return l.jsx(Nb,{scope:t,...x,children:Rb(d)?d(x):r})}var _d="CheckboxTrigger",Od=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:I}=Ia(_d,e),v=gr(o,u),p=M.useRef(c);return M.useEffect(()=>{const C=i==null?void 0:i.form;if(C){const m=()=>d(p.current);return C.addEventListener("reset",m),()=>C.removeEventListener("reset",m)}},[i,d]),l.jsx(wn.button,{type:"button",role:"checkbox","aria-checked":Vn(c)?"mixed":c,"aria-required":f,"data-state":Td(c),"data-disabled":a?"":void 0,disabled:a,value:s,...r,ref:v,onKeyDown:Wt(t,C=>{C.key==="Enter"&&C.preventDefault()}),onClick:Wt(n,C=>{d(m=>Vn(m)?!0:!m),I&&h&&(g.current=C.isPropagationStopped(),g.current||C.stopPropagation())})})});Od.displayName=_d;var ba=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(Od,{...d,ref:t,__scopeCheckbox:n}),g&&l.jsx(Nd,{__scopeCheckbox:n})]})})});ba.displayName=To;var Ed="CheckboxIndicator",Ca=M.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=Ia(Ed,n);return l.jsx(wa,{present:r||Vn(i.checked)||i.checked===!0,children:l.jsx(wn.span,{"data-state":Td(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});Ca.displayName=Ed;var Sd="CheckboxBubbleInput",Nd=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}=Ia(Sd,e),I=gr(n,h),v=gb(i),p=yb(r);M.useEffect(()=>{const m=g;if(!m)return;const w=window.HTMLInputElement.prototype,_=Object.getOwnPropertyDescriptor(w,"checked").set,S=!o.current;if(v!==i&&_){const R=new Event("click",{bubbles:S});m.indeterminate=Vn(i),_.call(m,Vn(i)?!1:i),m.dispatchEvent(R)}},[g,v,i,o]);const C=M.useRef(Vn(i)?!1:i);return l.jsx(wn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??C.current,required:a,disabled:c,name:f,value:u,form:d,...t,tabIndex:-1,ref:I,style:{...t.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Nd.displayName=Sd;function Rb(e){return typeof e=="function"}function Vn(e){return e==="indeterminate"}function Td(e){return Vn(e)?"indeterminate":e?"checked":"unchecked"}function Rd(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"],Ad=y.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Rd(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=Rd(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",Br={checkboxGroupContainer:Db,stack:Mb,selectAllContainer:kb,fieldContainer:jb,checkbox:Lb};function Pd({id:e,isChecked:t,label:n,onCheckedChange:r}){return l.jsxs("div",{className:Br.fieldContainer,children:[l.jsx(ba,{className:Br.checkbox,id:e,onCheckedChange:r,checked:t,children:l.jsx(Ca,{children:l.jsx(Ad,{})})}),l.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function Fd({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:o}){return l.jsxs("div",{className:Br.selectAllContainer,children:[l.jsx(ba,{className:Br.checkbox,id:e,onCheckedChange:r,children:l.jsxs(Ca,{children:[o&&l.jsx(Fb,{}),t===!0&&l.jsx(Ad,{})]})}),l.jsx("label",{htmlFor:e,children:n})]})}function Dd({children:e}){return l.jsx("div",{className:Br.checkboxGroupContainer,children:e})}function Md({children:e}){return l.jsx("div",{className:Br.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=!su(s,r);e.read.isOptionalFieldsModified=c}else console.warn("read.savedConfig.optionalFields is undefined")}function Vc(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,I)=>{h!=="indeterminate"&&r&&t&&Vc(r,n,I,h)},s=(g=t==null?void 0:t.read)==null?void 0:g.optionalFields,a=h=>{r&&s&&s.forEach(I=>{$n(I)||Vc(r,n,I.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(St,{string:`${e} reads the following optional fields`}),l.jsxs(Dd,{children:[((s==null?void 0:s.length)||0)>=2&&l.jsx(Fd,{id:"select-all-fields",isChecked:f,label:"Select all",onCheckedChange:a,isIndeterminate:u}),l.jsx(Md,{children:s.map(h=>$n(h)?null:l.jsx(Pd,{id:h.fieldName,isChecked:!!(o!=null&&o[h==null?void 0:h.fieldName]),label:h.displayName,onCheckedChange:I=>i(I,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}=Ne();return l.jsxs(l.Fragment,{children:[l.jsx(St,{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 kd(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 _;const{configureState:i,selectedObjectName:s,setConfigureState:a}=Xt(),[c,f]=y.useState(!0),{getError:u,setError:d,resetBoundary:g,isError:h,removeError:I}=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])||{}},[(_=i==null?void 0:i.read)==null?void 0:_.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 C=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]),w=y.useMemo(()=>l.jsx(nd,{disabled:c,items:C,selectedValue:p||null,onSelectedItemChange:m,placeholder:"Please select one",style:{border:o?"2px solid red":void 0,borderRadius:"8px",width:"100%"}},p),[p,c,C,m,o]),x=y.useCallback(()=>{s&&(kd(s,a,e.mappedValue,"",n),h(ue.VALUE_MAPPING,n)&&I(ue.VALUE_MAPPING,n))},[s,a,e.mappedValue,n,h,I]);return l.jsxs("div",{style:{display:"flex",flexDirection:"column",marginBottom:".25rem"},children:[l.jsx("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:l.jsx("span",{style:{fontWeight:500},children:e.mappedDisplayValue})}),l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[w,l.jsx(ze,{type:"button",variant:"ghost",onClick:x,children:"Clear"})]})]},e.mappedValue)}function Gb(){var h,I,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=(I=n==null?void 0:n.read)==null?void 0:I.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(C=>C.mappedValues).map(C=>({...C})):[];if(a)for(let C=0;C<p.length;C+=1){const{mapToName:m}=p[C];a!=null&&a[m]&&(p[C].fieldName=a[m])}return p},[t,e,a]),g=y.useCallback(p=>{const{value:C,name:m,fieldName:w}=p.target;C&&(t&&kd(t,r,m,C,w),o(ue.VALUE_MAPPING,m)&&i(ue.VALUE_MAPPING,m))},[t,r,o,i]);return y.useEffect(()=>{var p;if(t&&c){const C=((p=e==null?void 0:e[t])==null?void 0:p.filter(w=>w.fieldName&&w.mappedValues.length>0))||[];C.every(w=>{const x=c[w.fieldName]||{};return Object.keys(x).length===Object.keys(w.mappedValues).length})&&C.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 C=(R=(S=n==null?void 0:n.read)==null?void 0:S.allFieldsMetadata)==null?void 0:R[p.fieldName],m=C==null?void 0:C.valueType;if(!["singleSelect","multiSelect"].includes(m))return console.error("fieldName is not a singleSelect or multiSelect",p),null;const w=C==null?void 0:C.values;if(!w)return null;const x=Object.keys(w).length,_=Object.keys((p==null?void 0:p.mappedValues)||[]).length;return x!==_?(console.error("field values and the values to be mapped are not of the same length",p,w),null):l.jsxs(l.Fragment,{children:[l.jsx(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 Uc(e,t,n,r){t(e,o=>{Xb(o,n,r)})}function Yb(){var d,g,h,I;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&&Uc(t,r,p,v)},a=v=>{var p,C;t&&n&&((C=(p=n==null?void 0:n.write)==null?void 0:p.writeObjects)==null||C.forEach(m=>{Uc(t,r,m.objectName,v)}))},c=!!i,f=Object.keys(o||{}).length===((I=(h=n==null?void 0:n.write)==null?void 0:h.writeObjects)==null?void 0:I.length),u=!f&&Object.keys(o||{}).length>0;return c&&l.jsxs(l.Fragment,{children:[l.jsx(St,{string:`Allow ${e} to write to these objects`}),l.jsxs(Dd,{children:[((i==null?void 0:i.length)||0)>=2&&l.jsx(Fd,{id:"select-all-fields",onCheckedChange:a,isIndeterminate:u,isChecked:f,label:"Select all"}),l.jsx(Md,{children:i.map(v=>l.jsx(Pd,{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 eC="_authenticationRow_cjz1t_1",tC="_field_cjz1t_8",nC="_value_cjz1t_12",Yo={authenticationRow:eC,field:tC,value:nC};function $c({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 rC(){const{selectedConnection:e}=Qt(),{providerName:t}=lt(),r=(e==null?void 0:e.provider)==="salesforce"?"subdomain":"workspace",o=`${t} ${r}`;return l.jsxs(l.Fragment,{children:[l.jsx(St,{string:"Connection details"}),l.jsxs("div",{style:{paddingBottom:"1rem"},children:[l.jsx($c,{label:o,value:e==null?void 0:e.providerWorkspaceRef}),l.jsx($c,{label:"Status",value:e==null?void 0:e.status})]})]})}const iC=()=>{const e=ct(),t=at();return yr({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 jd({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const{projectId:r}=Ne(),{integrationId:o,installation:i,setIntegrationDeleted:s,onUninstallSuccess:a}=rt(),[c,f]=y.useState(!1),u=!r||!o||!(i!=null&&i.id)||c,d=iC(),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,I=l.jsx(ze,{type:"button",onClick:g,disabled:u,variant:t,style:n,children:h});return i!=null&&i.id?I:null}function oC(){const{installation:e}=rt(),{providerName:t}=lt();return e?l.jsxs(l.Fragment,{children:[l.jsx(St,{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(jd,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})]}):null}function In({error:e}){return e?l.jsx(Ii,{style:{marginTop:"2em"},children:e}):null}const sC="_input_1ymb7_1",aC="_inputError_1ymb7_27",cC="_error_1ymb7_43",Zo={input:sC,inputError:aC,error:cC};function lC({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 uC="_textarea_18zl4_1",dC="_textareaError_18zl4_14",fC="_error_18zl4_29",es={textarea:uC,textareaError:dC,error:fC};function pC({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:lC,Textarea:pC},hC=()=>{const{project:e}=Ne(),t=e==null?void 0:e.id,n=ct();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 Ld(){var n,r;const{data:e}=hC();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 vr({children:e}){return l.jsx(Wr,{children:l.jsxs(vn,{children:[l.jsx("div",{style:{padding:"3rem 2rem"},children:e}),l.jsx(Ld,{})]})})}function wr({children:e}){return l.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function mC({children:e}){return l.jsx("p",{style:{padding:".5em 0"},children:e})}const gC="_link_oo2kv_1",yC={link:gC};function Kd({href:e,className:t,style:n,label:r,children:o,newTab:i=!1}){return l.jsx("a",{className:Pt(yC.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(Kd,{href:e,newTab:!0,children:l.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," ","about where to find your ",t," ",n,"."]})}function xa(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 Vd({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o,submitButtonType:i}){var x,_;const[s,a]=y.useState(!1),c=()=>a(S=>!S),[f,u]=y.useState({apiKey:""}),d=((x=t.metadata)==null?void 0:x.input)||[],g=S=>{const{name:R,value:N}=S.currentTarget;u(A=>({...A,[R]:N.trim()}))},{apiKey:h}=f,{providerName:I}=lt(e),v=h.length>0,p=hi(d,f),C=r||!v||!p,m=(_=t.apiKeyOpts)==null?void 0:_.docsURL,w=()=>{const S=xa(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:I||Un(e),credentialName:"API key"}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(Bt.Input,{id:"apiKey",name:"apiKey",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:I||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:C,type:i||"submit",onClick:w,variant:o,children:"Next"})]})}function vC({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=lt(e);return l.jsxs(vr,{children:[l.jsx(wr,{children:`Set up ${i} integration`}),l.jsx(In,{error:r}),l.jsx(Vd,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function wC({...e}){return l.jsx(vC,{...e})}const IC={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:{...IC,...t},children:e})}const _a=()=>{const e=ct(),t=at(),[n,r]=y.useState(null);return{...yr({mutationKey:["updateConnection"],mutationFn:async i=>(await e()).connectionApi.updateConnection(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]}),r(null)}}),errorMsg:n}};function bC({provider:e}){const{projectIdOrName:t}=Ne(),{providerName:n,data:r}=lt(e),{selectedConnection:o,isConnectionsLoading:i}=Qt(),{mutateAsync:s,isPending:a,error:c}=_a(),[f,u]=y.useState(null),[d,g]=y.useState(!1),h=()=>g(!1),I=()=>{g(!0),u(null)},v=(c==null?void 0:c.message)||f||null,p=async C=>{h(),u(null);try{await s({projectIdOrName:t||"",connectionId:(o==null?void 0:o.id)||"",updateConnectionRequest:{updateMask:["apiKey"],connection:{apiKey:C.apiKey}}},{onError:m=>{console.error("Update connection error:",m),Le(m,u)},onSuccess:()=>{I()}})}catch(m){console.error("Update connection caught error:",m),Le(m,u)}};return r?l.jsxs(l.Fragment,{children:[l.jsx(St,{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(Vd,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:p,isButtonDisabled:a||i,buttonVariant:"ghost",submitButtonType:"button"})]})]}):null}function Ud({provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:r,buttonVariant:o}){var w,x;const[i,s]=y.useState(!1),a=()=>s(_=>!_),[c,f]=y.useState({username:"",password:""}),u=((w=t.metadata)==null?void 0:w.input)||[],{username:d,password:g}=c,{providerName:h}=lt(e),I=_=>{const{name:S,value:R}=_.currentTarget;f(N=>({...N,[S]:R.trim()}))},v=hi(u,c),p=r||!v,C=()=>{const _=xa(u,c);n({user:d,pass:g,providerMetadata:_})},m=(x=t.basicOpts)==null?void 0:x.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:I}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(Bt.Input,{id:"password",name:"password",type:i?"text":"password",placeholder:"Password",onChange:I}),l.jsx(ze,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,variant:o,children:i?"Hide":"Show"})]}),u.map(_=>l.jsxs("div",{children:[_.docsURL&&l.jsx(mo,{url:_.docsURL,providerDisplayName:h||Un(e),credentialName:_.displayName||_.name}),l.jsx(Bt.Input,{id:_.name,name:_.name,type:"text",placeholder:_.displayName||_.name,onChange:I})]},_.name)),l.jsx(ze,{style:{marginTop:"1em",width:"100%"},disabled:p,type:"button",onClick:C,variant:o,children:"Next"})]})}function CC({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){const{providerName:i}=lt(e);return l.jsxs(vr,{children:[l.jsx(wr,{children:`Set up ${i} integration`}),l.jsx(In,{error:r}),l.jsx(Ud,{provider:e,providerInfo:t,handleSubmit:n,isButtonDisabled:o})]})}function xC({...e}){return l.jsx(CC,{...e})}function _C({provider:e}){const{projectIdOrName:t}=Ne(),{providerName:n,data:r}=lt(e),{selectedConnection:o,isConnectionsLoading:i}=Qt(),{mutateAsync:s,isPending:a,error:c}=_a(),[f,u]=y.useState(null),[d,g]=y.useState(!1),h=()=>g(!1),I=()=>{g(!0),u(null)},v=(c==null?void 0:c.message)||f||null,p=async C=>{h(),u(null);try{await s({projectIdOrName:t||"",connectionId:(o==null?void 0:o.id)||"",updateConnectionRequest:{updateMask:["basicAuth"],connection:{basicAuth:{username:C.user,password:C.pass}}}},{onError:m=>{console.error(m),Le(m,u)},onSuccess:()=>{I()}})}catch(m){console.error(m),Le(m,u)}};return r?l.jsxs(l.Fragment,{children:[l.jsx(St,{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(Ud,{provider:r==null?void 0:r.name,providerInfo:r,handleSubmit:p,isButtonDisabled:a||i,buttonVariant:"ghost"})]})]}):null}function $d({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),I=N=>{const{name:A,value:K}=N.currentTarget;c(z=>({...z,[A]:K.trim()})),u(null)},{clientSecret:v,clientId:p,scopes:C}=a,m=v.length>0,w=p.length>0,x=hi(g,a),_=n||!m||!w||!x,S=()=>{const N=xa(g,a),A={clientId:p,clientSecret:v,providerMetadata:N};r&&C.length>0&&(A.scopes=Xy(C)),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:I}),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:I}),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:I}),g.map(N=>l.jsx(Bt.Input,{id:N.name,name:N.name,type:"text",placeholder:N.displayName||N.name,onChange:I},N.name))]}),l.jsx(In,{error:f}),l.jsx("br",{}),l.jsx(ze,{style:{width:"100%"},disabled:_,type:"button",onClick:S,variant:o,children:"Next"})]})}function OC({provider:e,handleSubmit:t,error:n,isButtonDisabled:r,providerName:o,explicitScopesRequired:i}){return l.jsxs(vr,{children:[l.jsx(wr,{children:`Set up ${o} integration`}),l.jsx(In,{error:n}),l.jsx("br",{}),l.jsx($d,{provider:e,handleSubmit:t,isButtonDisabled:r,explicitScopesRequired:i})]})}function EC({provider:e}){var m;const{projectIdOrName:t}=Ne(),{selectedConnection:n,isConnectionsLoading:r}=Qt(),{providerName:o,data:i}=lt(e),{mutateAsync:s,isPending:a,error:c}=_a(),[f,u]=y.useState(null),[d,g]=y.useState(!1),h=()=>{g(!1)},I=()=>{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,C=async w=>{h(),u(null);try{await s({projectIdOrName:t||"",connectionId:(n==null?void 0:n.id)||"",updateConnectionRequest:{updateMask:["oauth2ClientCredentials"],connection:{oauth2ClientCredentials:{clientId:w.clientId,clientSecret:w.clientSecret,scopes:w.scopes}}}}),I()}catch(x){Le(x,u)}};return l.jsxs(l.Fragment,{children:[l.jsx(St,{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($d,{provider:o||"",handleSubmit:C,isButtonDisabled:a||r,explicitScopesRequired:v,buttonVariant:"ghost"})]})]})}const qc=600,Hc=600,SC="AUTHORIZATION_SUCCEEDED",NC="AUTHORIZATION_FAILED";function TC(e,t,n,r){return y.useCallback(()=>{if(!r)return;const o=window.screenX+(window.outerWidth-qc)/2,i=window.screenY+(window.outerHeight-Hc)/2.5,s=`width=${qc},height=${Hc},left=${o},top=${i}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function RC(e,t,n,r){const o=at();return y.useCallback(i=>{var s,a;if(i.origin===Kl){if(i.data.eventType===SC){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===NC&&(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 qd({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=at(),h=y.useRef(null),I=RC(f,u,r,i),v=TC(n,d,I,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."):c&&(r==null||r(null)),a==null||a()},[c,o,r,a,g]);return y.useEffect(()=>{if(u)return h.current=setInterval(()=>{u!=null&&u.closed&&(h.current&&clearInterval(h.current),h.current=null,p())},500),()=>{h.current&&(clearInterval(h.current),h.current=null),window.removeEventListener("message",I)}},[p,u,I]),l.jsx("div",{children:e})}const AC=()=>{const e=ct(),t=at();return yr({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 PC({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 FC({provider:e}){const{selectedConnection:t,isConnectionsLoading:n}=Qt(),r=t==null?void 0:t.id,o=t==null?void 0:t.projectId,{providerName:i}=lt(e),{mutateAsync:s,isPending:a,error:c}=AC(),[f,u]=y.useState(null),[d,g]=y.useState(!1),[h,I]=y.useState(null),v=()=>{g(!1)},p=()=>{g(!0),u(null),I(null)},C=(c==null?void 0:c.message)||f||null,m=async()=>{v(),u(null);try{const x=await s({projectIdOrName:o||"",connectionId:r||""});I(x)}catch(x){Le(x,u)}},w=y.useCallback(x=>{u(x)},[]);return l.jsxs(l.Fragment,{children:[l.jsx(St,{string:"Update connection"}),d&&l.jsx(Ro,{children:"Connection updated successfully"}),l.jsx(qd,{windowTitle:`Connect to ${i}`,oauthUrl:h||null,onError:w,error:C,isSuccessConnect:d,onSuccessConnect:p,children:l.jsx(PC,{handleSubmit:m,error:C,providerName:i,isButtonDisabled:a||n||d})})]})}function Hd({provider:e}){var r;const{data:t}=_i(e);if((t==null?void 0:t.authType)===za.Basic)return l.jsx(_C,{provider:e});if((t==null?void 0:t.authType)===za.ApiKey)return l.jsx(bC,{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(FC,{provider:e});if(n===Ko.ClientCredentials)return l.jsx(EC,{provider:e})}return null}function DC(){return l.jsxs(l.Fragment,{children:[l.jsx(rC,{}),l.jsx(Hd,{}),l.jsx(oC,{})]})}function Bd({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&&!!nu(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,C=a||n||!c||!f||!(g||h||r||f!==dr&&!d),m=f===dr,w=f===ro,x=l.jsx(ze,{type:"submit",disabled:C,children:r?"Install":"Save"}),_=l.jsx(ze,{type:"button",onClick:t,disabled:C,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:!w&&l.jsxs(l.Fragment,{children:[x,_]})}),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&&!w&&l.jsx(Qb,{}),s&&m&&!w&&l.jsx(Zb,{}),!a&&w&&l.jsx(DC,{})]})]})}const Jd=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:o,onUpdateSuccess:i}=rt(),{hydratedRevision:s,loading:a}=Gr(),{selectedObjectName:c}=hd(),{selectedConnection:f}=Qt(),u=yl(),{projectId:d}=Ne(),{resetBoundary:g,setErrors:h,setError:I,getError:v}=Ft(),{resetConfigureState:p,objectConfigurationsState:C,resetPendingConfigurationState:m}=ga(),w=fu(c||"",C),{onNextIncompleteTab:x}=FI(),_=y.useCallback(()=>{g(ue.INSTALLATION_MUTATION)},[g]),S=y.useCallback(N=>N?A=>{I(ue.INSTALLATION_MUTATION,N,A)}:A=>{console.error("objectName is required to set installation error: ",A)},[I]),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:_,resetConfigureState:p,objectConfigurationsState:C,resetPendingConfigurationState:m,configureState:w,onInstallSuccess:o,onUpdateSuccess:i,onNextIncompleteTab:x}},MC=void 0;function kC(){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:I,resetConfigureState:v,objectConfigurationsState:p,resetPendingConfigurationState:C,configureState:m,onInstallSuccess:w,onNextIncompleteTab:x}=Jd(),[_,S]=y.useState(!1),R=s===dr,N=h(s),A=y.useCallback(()=>{u(ue.MAPPING),o!=null&&o.content&&!i&&s&&cu(o,MC,s,v)},[u,o,i,s,v]);y.useEffect(()=>{!m&&(o!=null&&o.content)&&!i&&A()},[m,p,o,i,A]);const K=()=>{I();const{requiredMapFields:ee,selectedFieldMappings:q}=(m==null?void 0:m.read)||{},{errorList:ae}=ou(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,w).finally(()=>{S(!1),C(s),x()})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},z=()=>{I(),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,w).finally(()=>{S(!1),C(s),x()})):console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},H=ee=>{ee.preventDefault(),R?z():K()};return l.jsx(Bd,{errorMsg:N,isCreateMode:!0,isLoading:_,onSave:H,onReset:A})}function jC({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 Us().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 LC=(e,t,n,r,o,i)=>{const s=lu(e),a=uu(e),c=du(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},KC=(e,t,n,r,o,i,s,a,c,f,u)=>{const d=LC(i,r||"",a,a.schedule,c,a.backfill);return d?jC({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))},VC=(e,t)=>{const r={content:{write:{objects:hu(e)}}};return wi(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r},UC=(e,t,n,r,o,i,s,a,c)=>{const f=VC(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 Us().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 $C({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:I,onUpdateSuccess:v,onNextIncompleteTab:p}=Jd(),[C,m]=y.useState(!1),w=i===dr,x=d(i),{config:_}=e,S=y.useCallback(()=>{c(ue.MAPPING),r!=null&&r.content&&!o&&i&&cu(r,_,i,g)},[c,r,o,i,_,g]);y.useEffect(()=>{I||S()},[I,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}=(I==null?void 0:I.read)||{},{errorList:ee}=ou(z,H,f);ee.length>0||(r&&e&&i&&s&&a&&R?(m(!0),KC(a,t.id,e.id,i,s,I,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),UC(a,t.id,e.id,s,I,r,u(i),n,v).finally(()=>{m(!1),h(i),p()})):console.error("UpdateInstallation - onSaveUpdate missing required props")},K=z=>{z.preventDefault(),w?A():N()};return l.jsx(Bd,{errorMsg:x,onSave:K,onReset:S,isLoading:C})}function qC(){const{integrationObj:e,installation:t}=rt();return e?t&&e?l.jsx($C,{installation:t,integrationObj:e}):l.jsx(kC,{}):l.jsx(Wl,{message:"We can't load the integration"})}const HC=()=>{const e=ct(),t=at(),[n,r]=y.useState(null);return{...yr({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 BC(){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 Oa({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(BC,{}),l.jsx("p",{children:e}),t]})})}function JC({provider:e}){const{providerName:t}=lt(e),n=`You have successfully installed your ${t} integration.`;return l.jsx(Oa,{text:n,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:l.jsx(jd,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const WC=e=>{const{read:t,write:n}=(e==null?void 0:e.content)??{};return!t&&!n};function zC({children:e}){var _;const t=y.useRef(!1),{projectId:n}=Ne(),{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:I,errorMsg:v}=HC(),{selectedConnection:p,isConnectionsLoading:C}=Qt(),m=o||h||C,w=(_=r==null?void 0:r.content)==null?void 0:_.provider,x=WC(r);return y.useEffect(()=>{var S;if(!m&&!C&&r&&x&&!s&&p&&(i!=null&&i.id)&&!u&&w){const R={projectIdOrName:n,integrationId:i==null?void 0:i.id,installation:{groupRef:a,connectionId:p==null?void 0:p.id,config:{content:{provider:w}}}};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,x,s,p,n,i==null?void 0:i.id,a,c,m,f,u,C,w,d,g]),x&&w&&s?l.jsx(JC,{provider:w}):I?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=ct(),t=at();return yr({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 GC({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:c}=Ne(),f=Ao(),u=y.useCallback(d=>{var v;const{apiKey:g,providerMetadata:h}=d,I={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(I)},[c,i,o,r,n,e,f]);return a===null?l.jsx(wC,{provider:e,providerInfo:t,handleSubmit:u,error:null}):s}function QC({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a}){const{projectIdOrName:c}=Ne(),f=Ao(),u=y.useCallback(d=>{var p;const{user:g,pass:h,providerMetadata:I}=d,v={projectIdOrName:c,generateConnectionParams:{providerWorkspaceRef:(p=I==null?void 0:I.workspace)==null?void 0:p.value,groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:g,password:h},...I&&{providerMetadata:I}}};f.mutate(v)},[c,i,o,r,n,e,f]);return a===null?l.jsx(xC,{provider:e,providerInfo:t,handleSubmit:u,error:null}):s}function XC({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(vr,{children:[l.jsx(wr,{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 YC({...e}){return l.jsx(XC,{...e})}function ZC({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s,providerName:a}){const{projectIdOrName:c}=Ne(),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(YC,{handleSubmit:u,error:null,providerName:a}):i}const ex=()=>{const e=ct(),t=at();return yr({mutationKey:["createOauthConnection"],mutationFn:async n=>(await e()).oAuthApi.oauthConnect(n),onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})};function tx({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return l.jsxs(vr,{children:[l.jsx(wr,{children:`Set up ${r} integration`}),l.jsx(mC,{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"})]})}const Bc=600,Jc=600;function nx({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){const{projectId:s}=Ne(),a=at(),c=y.useRef(null),{mutateAsync:f,isPending:u}=ex(),{isFetching:d,refetch:g}=Bl({groupRef:r,provider:e}),[h,I]=y.useState(null);y.useEffect(()=>{const p=C=>{var m,w,x;C.origin===Kl&&(((m=C.data)==null?void 0:m.eventType)==="AUTHORIZATION_SUCCEEDED"?(I(null),console.info("New connection:",C.data.data.connection),a.invalidateQueries({queryKey:["amp","connections"]})):((w=C.data)==null?void 0:w.eventType)==="AUTHORIZATION_FAILED"&&(console.error("OAuth failed:",C.data.data.error),I(C.data.data.error||"An error occurred. Please try again.")),(x=c.current)==null||x.close())};return window.addEventListener("message",p),()=>window.removeEventListener("message",p)},[a]);const v=async()=>{I(null);try{const{data:p}=await g();if(p&&p.length>0){console.debug("connections found");return}}catch{console.debug("error with fetching connections")}try{const p=await f({connectOAuthParams:{provider:e,consumerRef:t,groupRef:r,projectId:s,consumerName:n,groupName:o}});if(p){const C=window.screenX+(window.outerWidth-Bc)/2,m=window.screenY+(window.outerHeight-Jc)/2.5,w=`width=${Bc},height=${Jc},left=${C},top=${m}`;c.current=window.open(p,"OAuthPopup",w)}}catch(p){console.error(p),I(p instanceof Error?p.message:String(p)||"An error occurred. Please try again.")}};return l.jsx("div",{children:l.jsx(tx,{handleSubmit:v,error:u?"":h,providerName:i,isButtonDisabled:u||d})})}const rx=()=>{const e=ct(),{projectIdOrName:t}=Ne();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})},ix=e=>{const t=ct(),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})},ox=qs("VITE_AMP_ENABLE_CSRF",!1),sx=qs("NEXT_AMP_ENABLE_CSRF",!1),ax=qs("REACT_APP_AMP_ENABLE_CSRF",!1),cx=!!ox||!!sx||!!ax,lx=(e,t,n,r,o,i,s)=>{var S;const{projectId:a}=Ne(),{data:c,isLoading:f,error:u}=_i(n),{data:d,isLoading:g,error:h}=rx(),I=d==null?void 0:d.find(R=>R.provider===n),v=c?Ql(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:I==null?void 0:I.id,provider:n,enableCSRFProtection:cx,providerMetadata:s},{data:C,error:m,isLoading:w,refetch:x}=ix(p);return y.useEffect(()=>{c&&n&&d&&!I&&console.error(`You must first set up a ${v} Provider App using the Ampersand Console. `,{provInfo:c,provider:n,providerApps:d,app:I})},[I,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:C,error:u||h||m,isLoading:f||g||w,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 x();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}}},ux="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function dx({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return l.jsxs(vr,{children:[l.jsx(wr,{children:"Enter your Salesforce subdomain"}),l.jsx(Kd,{href:ux,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 fx({handleSubmit:e,setFormData:t,error:n,isButtonDisabled:r,providerName:o,metadataFields:i}){return l.jsxs(vr,{children:[l.jsxs(wr,{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 px({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),[I,v]=y.useState({}),{data:p}=_i(e),C=((q=p==null?void 0:p.metadata)==null?void 0:q.input)||[],{url:m,error:w,isLoading:x,refetchOauthConnect:_}=lx(t,r,e,n,o,e===Wc?s:(ae=I==null?void 0:I.workspace)==null?void 0:ae.value,I),S=(w==null?void 0:w.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(C,c)){d("Please fill in all required fields");return}const X=await _();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(dx,{handleSubmit:H,setWorkspace:K,error:S,isButtonDisabled:s.length===0}):l.jsx(fx,{handleSubmit:H,setFormData:z,error:S,isButtonDisabled:!hi(C,c)||x,providerName:i,metadataFields:C});return l.jsx(qd,{windowTitle:`Connect to ${i}`,oauthUrl:g&&m||null,onError:R,error:S,onSuccessConnect:N,onWindowClose:A,children:ee})}function hx({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,explicitScopesRequired:s,selectedConnection:a}){const{projectIdOrName:c}=Ne(),f=Ao(),[u,d]=y.useState(null),g=y.useCallback(h=>{var v,p;d(null);const I={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(I,{onError:()=>d("Error loading provider info")})},[c,i,o,r,n,e,f]);return a===null?l.jsx(OC,{provider:e,providerName:t,handleSubmit:g,error:u,explicitScopesRequired:s}):l.jsx(ci,{})}function mx({...e}){return l.jsx(hx,{...e})}const gx="authorizationCode",yx="authorizationCodePKCE",vx="clientCredentials";function wx({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,selectedConnection:s,setSelectedConnection:a}){var g;const{providerName:c}=lt(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===gx||f===yx?(g=t.metadata)!=null&&g.input?l.jsx(px,{...d}):l.jsx(nx,{...d}):f===vx?l.jsx(mx,{...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 Ix(e){const{selectedConnection:t}=Qt();y.useEffect(()=>{e&&t&&e(t)},[e,t])}function bx({onSuccess:e}){Ix(e)}function Wd({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:I}=lt(e),{provider:v,isIntegrationDeleted:p}=rt(),{selectedConnection:C,setSelectedConnection:m}=Qt();bx({onSuccess:s});const w=at();y.useEffect(()=>{d&&(console.error("Error loading provider info."),Le(g))},[d,g]);const x=y.useCallback(()=>{w.clear(),c()},[c,w]);if(!e&&!v)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(p)return l.jsx(Oa,{text:"Integration successfully uninstalled.",children:l.jsx(ze,{type:"button",onClick:x,style:{width:"100%"},children:"Reinstall Integration"})});if(C)return i;if(u)return l.jsx(zr,{});if(f==null)return l.jsx(Jt,{message:"Provider info was not found."});const _={provider:I,consumerRef:t,consumerName:n,groupRef:r,groupName:o,selectedConnection:C,setSelectedConnection:m,providerName:h,providerInfo:f,onDisconnectSuccess:a};return f.authType==="none"?l.jsx(ZC,{..._,children:i}):f.authType==="basic"?l.jsx(QC,{..._,children:i}):f.authType==="apiKey"?l.jsx(GC,{..._,children:i}):l.jsx(wx,{..._})}function Cx(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:C}=v,m=y.useRef(null),w=y.useRef(new Map).current;return l.jsx(o,{scope:p,itemMap:w,collectionRef:m,children:C})};s.displayName=t;const a=e+"CollectionSlot",c=Ds(a),f=y.forwardRef((v,p)=>{const{scope:C,children:m}=v,w=i(a,C),x=gr(p,w.collectionRef);return l.jsx(c,{ref:x,children:m})});f.displayName=a;const u=e+"CollectionItemSlot",d="data-radix-collection-item",g=Ds(u),h=y.forwardRef((v,p)=>{const{scope:C,children:m,...w}=v,x=y.useRef(null),_=gr(p,x),S=i(u,C);return y.useEffect(()=>(S.itemMap.set(x,{ref:x,...w}),()=>void S.itemMap.delete(x))),l.jsx(g,{[d]:"",ref:_,children:m})});h.displayName=u;function I(v){const p=i(e+"CollectionConsumer",v);return y.useCallback(()=>{const m=p.collectionRef.current;if(!m)return[];const w=Array.from(m.querySelectorAll(`[${d}]`));return Array.from(p.itemMap.values()).sort((S,R)=>w.indexOf(S.ref.current)-w.indexOf(R.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:s,Slot:f,ItemSlot:h},I,r]}var xx=M[" useId ".trim().toString()]||(()=>{}),_x=0;function zd(e){const[t,n]=M.useState(xx());return pi(()=>{e||n(r=>r??String(_x++))},[e]),e||(t?`radix-${t}`:"")}function Ox(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 Ex=M.createContext(void 0);function Gd(e){const t=M.useContext(Ex);return e||t||"ltr"}var ts="rovingFocusGroup.onEntryFocus",Sx={bubbles:!1,cancelable:!0},Oi="RovingFocusGroup",[Ms,Qd,Nx]=Cx(Oi),[Tx,Xd]=No(Oi,[Nx]),[Rx,Ax]=Tx(Oi),Yd=M.forwardRef((e,t)=>l.jsx(Ms.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Ms.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Px,{...e,ref:t})})}));Yd.displayName=Oi;var Px=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),I=Gd(i),[v,p]=va({prop:s,defaultProp:a??null,onChange:c,caller:Oi}),[C,m]=M.useState(!1),w=Ox(f),x=Qd(n),_=M.useRef(!1),[S,R]=M.useState(0);return M.useEffect(()=>{const N=g.current;if(N)return N.addEventListener(ts,w),()=>N.removeEventListener(ts,w)},[w]),l.jsx(Rx,{scope:n,orientation:r,dir:I,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:C||S===0?-1:0,"data-orientation":r,...d,ref:h,style:{outline:"none",...e.style},onMouseDown:Wt(e.onMouseDown,()=>{_.current=!0}),onFocus:Wt(e.onFocus,N=>{const A=!_.current;if(N.target===N.currentTarget&&A&&!C){const K=new CustomEvent(ts,Sx);if(N.currentTarget.dispatchEvent(K),!K.defaultPrevented){const z=x().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);tf(ae,u)}}_.current=!1}),onBlur:Wt(e.onBlur,()=>m(!1))})})}),Zd="RovingFocusGroupItem",ef=M.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:s,...a}=e,c=zd(),f=i||c,u=Ax(Zd,n),d=u.currentTabStopId===f,g=Qd(n),{onFocusableItemAdd:h,onFocusableItemRemove:I,currentTabStopId:v}=u;return M.useEffect(()=>{if(r)return h(),()=>I()},[r,h,I]),l.jsx(Ms.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 C=Mx(p,u.orientation,u.dir);if(C!==void 0){if(p.metaKey||p.ctrlKey||p.altKey||p.shiftKey)return;p.preventDefault();let w=g().filter(x=>x.focusable).map(x=>x.ref.current);if(C==="last")w.reverse();else if(C==="prev"||C==="next"){C==="prev"&&w.reverse();const x=w.indexOf(p.currentTarget);w=u.loop?kx(w,x+1):w.slice(x+1)}setTimeout(()=>tf(w))}}),children:typeof s=="function"?s({isCurrentTabStop:d,hasTabStop:v!=null}):s})})});ef.displayName=Zd;var Fx={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Dx(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Mx(e,t,n){const r=Dx(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Fx[r]}function tf(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function kx(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var jx=Yd,Lx=ef,Po="Tabs",[Kx,h_]=No(Po,[Xd]),nf=Xd(),[Vx,Ea]=Kx(Po),rf=M.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:c="automatic",...f}=e,u=Gd(a),[d,g]=va({prop:r,onChange:o,defaultProp:i??"",caller:Po});return l.jsx(Vx,{scope:n,baseId:zd(),value:d,onValueChange:g,orientation:s,dir:u,activationMode:c,children:l.jsx(wn.div,{dir:u,"data-orientation":s,...f,ref:t})})});rf.displayName=Po;var of="TabsList",sf=M.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=Ea(of,n),s=nf(n);return l.jsx(jx,{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})})});sf.displayName=of;var af="TabsTrigger",cf=M.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=Ea(af,n),a=nf(n),c=uf(s.baseId,r),f=df(s.baseId,r),u=r===s.value;return l.jsx(Lx,{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)})})})});cf.displayName=af;var lf="TabsContent",Ux=M.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=Ea(lf,n),c=uf(a.baseId,r),f=df(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(wa,{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})})});Ux.displayName=lf;function uf(e,t){return`${e}-trigger-${t}`}function df(e,t){return`${e}-content-${t}`}var $x=rf,qx=sf,ff=cf;const Hx=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 Bx(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?Hx: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 Jx(){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 Wx="_tabsRoot_ktpr0_1",zx="_tabsList_ktpr0_6",Gx="_tabTrigger_ktpr0_12",Qx="_danger_ktpr0_29",go={tabsRoot:Wx,tabsList:zx,tabTrigger:Gx,danger:Qx};function Xx(){return l.jsxs(l.Fragment,{children:[l.jsx(So,{style:{margin:"1rem 0"}}),l.jsx(ff,{value:ro,className:go.tabTrigger,children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[l.jsx(Jx,{}),l.jsx("span",{children:"Manage"})]})})]})}function pf({objectName:e,completed:t,pending:n,displayName:r}){return l.jsx(ff,{value:e,className:go.tabTrigger,children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[Bx(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 Yx({completed:e,pending:t,displayName:n}){return l.jsxs(l.Fragment,{children:[l.jsx(So,{style:{margin:"1rem 0"}}),l.jsx(pf,{objectName:dr,completed:e,pending:t,displayName:n},"other-write")]})}function Zx({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:o}){var i,s;return l.jsx($x,{value:e,className:go.tabsRoot,onValueChange:n,children:l.jsxs(qx,{className:go.tabsList,children:[t.map(a=>{var c,f,u,d,g,h;return l.jsx(pf,{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(Yx,{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(Xx,{})]})})}function e_(e,t){return t===ro?{name:ro,completed:!1}:e.find(n=>n.name===t)}function t_({children:e}){var C;const{project:t}=Ne(),{installation:n}=rt(),{providerName:r}=lt(),{hydratedRevision:o}=Gr(),{objectConfigurationsState:i}=ga(),[s,a]=y.useState(""),c=(t==null?void 0:t.appName)||"",f=n==null?void 0:n.config,u=o&&ru(f,o),d=u!==null,g=!!((C=o==null?void 0:o.content)!=null&&C.write),h=g?iu(f):void 0,I=y.useMemo(()=>{const m=[...u||[]];return h&&g&&m.push(h),m},[u,h,g]),v=e_(I,s),p=y.useCallback(()=>{const m=I.find(w=>v!==w&&!w.completed);m&&a(m.name)},[I,v]);return y.useEffect(()=>{!s&&I.length>0&&a(I[0].name)},[I,s,p]),l.jsx(md.Provider,{value:p,children:l.jsx(pd.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(Zx,{value:s,readNavObjects:u,onValueChange:m=>a(m),objectConfigurationsState:i,writeNavObject:h})]}),e]}),l.jsx(Ld,{})]})})})}function n_({...e}){return l.jsx(t_,{...e})}const r_="_resetContainer_lkwv9_4",hf={resetContainer:r_};function i_({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}=Ne(),{isLoading:d}=$s(),{isError:g,errorState:h}=Ft(),{seed:I,reset:v}=eu();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:hf.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(Zl,{children:l.jsx(Wd,{consumerRef:t,consumerName:n,groupRef:r,groupName:o,resetComponent:v,children:l.jsx(Nv,{resetComponent:v,children:l.jsx(zC,{children:l.jsx(JI,{children:l.jsx(n_,{children:l.jsx(qC,{})})})})})})})},I)})}function o_(){return l.jsxs(Wr,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[l.jsx(ci,{}),l.jsx("p",{children:"Redirecting"})]})}function s_({redirectURL:e,children:t}){return y.useEffect(()=>{e&&window.location.replace(e)},[e]),e?l.jsx(o_,{}):t}function a_({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(St,{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(Hd,{provider:n}),l.jsx(St,{string:"Remove connection"}),l.jsx("p",{children:"Click to disconnect your connection from the provider."}),l.jsx(gu,{resetComponent:e,onDisconnectSuccess:t,buttonText:"Remove connection",buttonVariant:"danger",buttonStyle:{fontSize:"13px"}})]})]})}function c_({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=Ne(),{providerName:o}=lt(e),i=`You have successfully connected your ${o} account to ${r}.`;return l.jsx(Oa,{text:i,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"},children:l.jsx(a_,{resetComponent:n,onDisconnectSuccess:t,provider:e})})})}function l_({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,redirectUrl:i,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:c}){const{seed:f,reset:u}=eu(),d=y.useCallback(g=>{s?s(g.id):c&&c(g)},[s,c]);return l.jsx("div",{className:hf.resetContainer,children:l.jsx(Zl,{groupRef:r,provider:e,children:l.jsx(Wd,{resetComponent:u,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onSuccess:d,onDisconnectSuccess:a,children:l.jsx(s_,{redirectURL:i,children:l.jsx(c_,{resetComponent:u,provider:e,onDisconnectSuccess:a})})})})},f)}const u_=(e,t)=>{const{data:n,isLoading:r,isError:o,error:i}=Gl(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=Hl;exports.AmpersandProvider=ky;exports.ConnectProvider=l_;exports.InstallIntegration=i_;exports.useAmpersandProvider=jy;exports.useIsIntegrationInstalled=u_;
|
|
50
|
+
*/const Ex="react-tooltip-core-styles",Fx="react-tooltip-base-styles",rl={core:!1,base:!1};function il({css:e,id:t=Fx,type:n="base",ref:r}){var o,i;if(!e||typeof document>"u"||rl[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=Ex),r||(r={});const{insertAt:a}=r;if(document.getElementById(t))return;const s=document.head||document.getElementsByTagName("head")[0],c=document.createElement("style");c.id=t,c.type="text/css",a==="top"&&s.firstChild?s.insertBefore(c,s.firstChild):s.appendChild(c),c.styleSheet?c.styleSheet.cssText=e:c.appendChild(document.createTextNode(e)),rl[n]=!0}const ol=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10,strategy:i="absolute",middlewares:a=[Tx(Number(o)),xx({fallbackAxisSideDirection:"start"}),Rx({padding:5})],border:s})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const c=a;return n?(c.push(Ax({element:n,padding:5})),nl(e,t,{placement:r,strategy:i,middleware:c}).then(({x:p,y:l,placement:d,middlewareData:h})=>{var m,S;const I={left:`${p}px`,top:`${l}px`,border:s},{x:f,y:C}=(m=h.arrow)!==null&&m!==void 0?m:{x:0,y:0},g=(S={top:"bottom",right:"left",bottom:"top",left:"right"}[d.split("-")[0]])!==null&&S!==void 0?S:"bottom",O=s&&{borderBottom:s,borderRight:s};let b=0;if(s){const N=`${s}`.match(/(\d+)px/);b=N!=null&&N[1]?Number(N[1]):1}return{tooltipStyles:I,tooltipArrowStyles:{left:f!=null?`${f}px`:"",top:C!=null?`${C}px`:"",right:"",bottom:"",...O,[g]:`-${4+b}px`},place:d}})):nl(e,t,{placement:"bottom",strategy:i,middleware:c}).then(({x:p,y:l,placement:d})=>({tooltipStyles:{left:`${p}px`,top:`${l}px`},tooltipArrowStyles:{},place:d}))},al=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),sl=(e,t,n)=>{let r=null;const o=function(...i){const a=()=>{r=null};!r&&(e.apply(this,i),r=setTimeout(a,t))};return o.cancel=()=>{r&&(clearTimeout(r),r=null)},o},cl=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",Ga=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((o,i)=>Ga(o,t[i]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!cl(e)||!cl(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(o=>Ga(e[o],t[o]))},_x=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"})},ul=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(_x(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},Px=typeof window<"u"?v.useLayoutEffect:v.useEffect,_t=e=>{e.current&&(clearTimeout(e.current),e.current=null)},Dx="DEFAULT_TOOLTIP_ID",Mx={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},Jx=v.createContext({getTooltipData:()=>Mx});function iv(e=Dx){return v.useContext(Jx).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"},da={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 kx=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:o="dark",anchorId:i,anchorSelect:a,place:s="top",offset:c=10,events:p=["hover"],openOnClick:l=!1,positionStrategy:d="absolute",middlewares:h,wrapper:m,delayShow:S=0,delayHide:I=0,float:f=!1,hidden:C=!1,noArrow:g=!1,clickable:O=!1,closeOnEsc:b=!1,closeOnScroll:N=!1,closeOnResize:R=!1,openEvents:E,closeEvents:x,globalCloseEvents:_,imperativeModeOnly:F,style:k,position:J,afterShow:q,afterHide:$,disableTooltip:te,content:ee,contentWrapperRef:oe,isOpen:Oe,defaultIsOpen:we=!1,setIsOpen:D,activeAnchor:B,setActiveAnchor:W,border:j,opacity:V,arrowColor:K,role:ne="tooltip"})=>{var re;const z=v.useRef(null),ie=v.useRef(null),Y=v.useRef(null),fe=v.useRef(null),L=v.useRef(null),[Se,G]=v.useState({tooltipStyles:{},tooltipArrowStyles:{},place:s}),[Ae,Ve]=v.useState(!1),[et,$e]=v.useState(!1),[be,kt]=v.useState(null),tt=v.useRef(!1),St=v.useRef(null),{anchorRefs:qt,setActiveAnchor:Kt}=iv(t),nt=v.useRef(!1),[Qe,je]=v.useState([]),De=v.useRef(!1),Ut=l||p.includes("click"),mt=Ut||(E==null?void 0:E.click)||(E==null?void 0:E.dblclick)||(E==null?void 0:E.mousedown),cn=E?{...E}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!E&&Ut&&Object.assign(cn,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const tn=x?{...x}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!x&&Ut&&Object.assign(tn,{mouseleave:!1,blur:!1,mouseout:!1});const wt=_?{..._}:{escape:b||!1,scroll:N||!1,resize:R||!1,clickOutsideAnchor:mt||!1};F&&(Object.assign(cn,{mouseover:!1,focus:!1,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(tn,{mouseout:!1,blur:!1,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(wt,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),Px(()=>(De.current=!0,()=>{De.current=!1}),[]);const Me=X=>{De.current&&(X&&$e(!0),setTimeout(()=>{De.current&&(D==null||D(X),Oe===void 0&&Ve(X))},10))};v.useEffect(()=>{if(Oe===void 0)return()=>null;Oe&&$e(!0);const X=setTimeout(()=>{Ve(Oe)},10);return()=>{clearTimeout(X)}},[Oe]),v.useEffect(()=>{if(Ae!==tt.current)if(_t(L),tt.current=Ae,Ae)q==null||q();else{const X=(ce=>{const le=ce.match(/^([\d.]+)(ms|s)$/);if(!le)return 0;const[,Ue,We]=le;return Number(Ue)*(We==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));L.current=setTimeout(()=>{$e(!1),kt(null),$==null||$()},X+25)}},[Ae]);const un=X=>{G(ce=>Ga(ce,X)?ce:X)},bn=(X=S)=>{_t(Y),et?Me(!0):Y.current=setTimeout(()=>{Me(!0)},X)},ln=(X=I)=>{_t(fe),fe.current=setTimeout(()=>{nt.current||Me(!1)},X)},zn=X=>{var ce;if(!X)return;const le=(ce=X.currentTarget)!==null&&ce!==void 0?ce:X.target;if(!(le!=null&&le.isConnected))return W(null),void Kt({current:null});S?bn():Me(!0),W(le),Kt({current:le}),_t(fe)},ht=()=>{O?ln(I||100):I?ln():Me(!1),_t(Y)},dn=({x:X,y:ce})=>{var le;const Ue={getBoundingClientRect:()=>({x:X,y:ce,width:0,height:0,top:ce,left:X,right:X,bottom:ce})};ol({place:(le=be==null?void 0:be.place)!==null&&le!==void 0?le:s,offset:c,elementReference:Ue,tooltipReference:z.current,tooltipArrowReference:ie.current,strategy:d,middlewares:h,border:j}).then(We=>{un(We)})},Nn=X=>{if(!X)return;const ce=X,le={x:ce.clientX,y:ce.clientY};dn(le),St.current=le},Gn=X=>{var ce;if(!Ae)return;const le=X.target;le.isConnected&&(!((ce=z.current)===null||ce===void 0)&&ce.contains(le)||[document.querySelector(`[id='${i}']`),...Qe].some(Ue=>Ue==null?void 0:Ue.contains(le))||(Me(!1),_t(Y)))},Cn=sl(zn,50),Pe=sl(ht,50),st=X=>{Pe.cancel(),Cn(X)},ae=()=>{Cn.cancel(),Pe()},ye=v.useCallback(()=>{var X,ce;const le=(X=be==null?void 0:be.position)!==null&&X!==void 0?X:J;le?dn(le):f?St.current&&dn(St.current):B!=null&&B.isConnected&&ol({place:(ce=be==null?void 0:be.place)!==null&&ce!==void 0?ce:s,offset:c,elementReference:B,tooltipReference:z.current,tooltipArrowReference:ie.current,strategy:d,middlewares:h,border:j}).then(Ue=>{De.current&&un(Ue)})},[Ae,B,ee,k,s,be==null?void 0:be.place,c,d,J,be==null?void 0:be.position,f]);v.useEffect(()=>{var X,ce;const le=new Set(qt);Qe.forEach(ve=>{te!=null&&te(ve)||le.add({current:ve})});const Ue=document.querySelector(`[id='${i}']`);Ue&&!(te!=null&&te(Ue))&&le.add({current:Ue});const We=()=>{Me(!1)},gt=ul(B),Ye=ul(z.current);wt.scroll&&(window.addEventListener("scroll",We),gt==null||gt.addEventListener("scroll",We),Ye==null||Ye.addEventListener("scroll",We));let rt=null;wt.resize?window.addEventListener("resize",We):B&&z.current&&(rt=Cx(B,z.current,ye,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const yt=ve=>{ve.key==="Escape"&&Me(!1)};wt.escape&&window.addEventListener("keydown",yt),wt.clickOutsideAnchor&&window.addEventListener("click",Gn);const Fe=[],Tn=ve=>!!(ve!=null&&ve.target&&(B!=null&&B.contains(ve.target))),Go=ve=>{Ae&&Tn(ve)||zn(ve)},Lt=ve=>{Ae&&Tn(ve)&&ht()},Ji=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],ki=["click","dblclick","mousedown","mouseup"];Object.entries(cn).forEach(([ve,Bt])=>{Bt&&(Ji.includes(ve)?Fe.push({event:ve,listener:st}):ki.includes(ve)&&Fe.push({event:ve,listener:Go}))}),Object.entries(tn).forEach(([ve,Bt])=>{Bt&&(Ji.includes(ve)?Fe.push({event:ve,listener:ae}):ki.includes(ve)&&Fe.push({event:ve,listener:Lt}))}),f&&Fe.push({event:"pointermove",listener:Nn});const qi=()=>{nt.current=!0},Ki=()=>{nt.current=!1,ht()},Ui=O&&(tn.mouseout||tn.mouseleave);return Ui&&((X=z.current)===null||X===void 0||X.addEventListener("mouseover",qi),(ce=z.current)===null||ce===void 0||ce.addEventListener("mouseout",Ki)),Fe.forEach(({event:ve,listener:Bt})=>{le.forEach(ni=>{var Xn;(Xn=ni.current)===null||Xn===void 0||Xn.addEventListener(ve,Bt)})}),()=>{var ve,Bt;wt.scroll&&(window.removeEventListener("scroll",We),gt==null||gt.removeEventListener("scroll",We),Ye==null||Ye.removeEventListener("scroll",We)),wt.resize?window.removeEventListener("resize",We):rt==null||rt(),wt.clickOutsideAnchor&&window.removeEventListener("click",Gn),wt.escape&&window.removeEventListener("keydown",yt),Ui&&((ve=z.current)===null||ve===void 0||ve.removeEventListener("mouseover",qi),(Bt=z.current)===null||Bt===void 0||Bt.removeEventListener("mouseout",Ki)),Fe.forEach(({event:ni,listener:Xn})=>{le.forEach(Xo=>{var ri;(ri=Xo.current)===null||ri===void 0||ri.removeEventListener(ni,Xn)})})}},[B,ye,et,qt,Qe,E,x,_,Ut,S,I]),v.useEffect(()=>{var X,ce;let le=(ce=(X=be==null?void 0:be.anchorSelect)!==null&&X!==void 0?X:a)!==null&&ce!==void 0?ce:"";!le&&t&&(le=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const Ue=new MutationObserver(We=>{const gt=[],Ye=[];We.forEach(rt=>{if(rt.type==="attributes"&&rt.attributeName==="data-tooltip-id"&&(rt.target.getAttribute("data-tooltip-id")===t?gt.push(rt.target):rt.oldValue===t&&Ye.push(rt.target)),rt.type==="childList"){if(B){const yt=[...rt.removedNodes].filter(Fe=>Fe.nodeType===1);if(le)try{Ye.push(...yt.filter(Fe=>Fe.matches(le))),Ye.push(...yt.flatMap(Fe=>[...Fe.querySelectorAll(le)]))}catch{}yt.some(Fe=>{var Tn;return!!(!((Tn=Fe==null?void 0:Fe.contains)===null||Tn===void 0)&&Tn.call(Fe,B))&&($e(!1),Me(!1),W(null),_t(Y),_t(fe),!0)})}if(le)try{const yt=[...rt.addedNodes].filter(Fe=>Fe.nodeType===1);gt.push(...yt.filter(Fe=>Fe.matches(le))),gt.push(...yt.flatMap(Fe=>[...Fe.querySelectorAll(le)]))}catch{}}}),(gt.length||Ye.length)&&je(rt=>[...rt.filter(yt=>!Ye.includes(yt)),...gt])});return Ue.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{Ue.disconnect()}},[t,a,be==null?void 0:be.anchorSelect,B]),v.useEffect(()=>{ye()},[ye]),v.useEffect(()=>{if(!(oe!=null&&oe.current))return()=>null;const X=new ResizeObserver(()=>{setTimeout(()=>ye())});return X.observe(oe.current),()=>{X.disconnect()}},[ee,oe==null?void 0:oe.current]),v.useEffect(()=>{var X;const ce=document.querySelector(`[id='${i}']`),le=[...Qe,ce];B&&le.includes(B)||W((X=Qe[0])!==null&&X!==void 0?X:ce)},[i,Qe,B]),v.useEffect(()=>(we&&Me(!0),()=>{_t(Y),_t(fe)}),[]),v.useEffect(()=>{var X;let ce=(X=be==null?void 0:be.anchorSelect)!==null&&X!==void 0?X:a;if(!ce&&t&&(ce=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),ce)try{const le=Array.from(document.querySelectorAll(ce));je(le)}catch{je([])}},[t,a,be==null?void 0:be.anchorSelect]),v.useEffect(()=>{Y.current&&(_t(Y),bn(S))},[S]);const He=(re=be==null?void 0:be.content)!==null&&re!==void 0?re:ee,pn=Ae&&Object.keys(Se.tooltipStyles).length>0;return v.useImperativeHandle(e,()=>({open:X=>{if(X!=null&&X.anchorSelect)try{document.querySelector(X.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${X.anchorSelect}" is not a valid CSS selector`)}kt(X??null),X!=null&&X.delay?bn(X.delay):Me(!0)},close:X=>{X!=null&&X.delay?ln(X.delay):Me(!1)},activeAnchor:B,place:Se.place,isOpen:!!(et&&!C&&He&&pn)})),et&&!C&&He?v.createElement(m,{id:t,role:ne,className:Mt("react-tooltip",wr.tooltip,da.tooltip,da[o],n,`react-tooltip__place-${Se.place}`,wr[pn?"show":"closing"],pn?"react-tooltip__show":"react-tooltip__closing",d==="fixed"&&wr.fixed,O&&wr.clickable),onTransitionEnd:X=>{_t(L),Ae||X.propertyName!=="opacity"||($e(!1),kt(null),$==null||$())},style:{...k,...Se.tooltipStyles,opacity:V!==void 0&&pn?V:void 0},ref:z},He,v.createElement(m,{className:Mt("react-tooltip-arrow",wr.arrow,da.arrow,r,g&&wr.noArrow),style:{...Se.tooltipArrowStyles,background:K?`linear-gradient(to right bottom, transparent 50%, ${K} 50%)`:void 0},ref:ie})):null},qx=({content:e})=>v.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),Kx=v.forwardRef(({id:e,anchorId:t,anchorSelect:n,content:r,html:o,render:i,className:a,classNameArrow:s,variant:c="dark",place:p="top",offset:l=10,wrapper:d="div",children:h=null,events:m=["hover"],openOnClick:S=!1,positionStrategy:I="absolute",middlewares:f,delayShow:C=0,delayHide:g=0,float:O=!1,hidden:b=!1,noArrow:N=!1,clickable:R=!1,closeOnEsc:E=!1,closeOnScroll:x=!1,closeOnResize:_=!1,openEvents:F,closeEvents:k,globalCloseEvents:J,imperativeModeOnly:q=!1,style:$,position:te,isOpen:ee,defaultIsOpen:oe=!1,disableStyleInjection:Oe=!1,border:we,opacity:D,arrowColor:B,setIsOpen:W,afterShow:j,afterHide:V,disableTooltip:K,role:ne="tooltip"},re)=>{const[z,ie]=v.useState(r),[Y,fe]=v.useState(o),[L,Se]=v.useState(p),[G,Ae]=v.useState(c),[Ve,et]=v.useState(l),[$e,be]=v.useState(C),[kt,tt]=v.useState(g),[St,qt]=v.useState(O),[Kt,nt]=v.useState(b),[Qe,je]=v.useState(d),[De,Ut]=v.useState(m),[mt,cn]=v.useState(I),[tn,wt]=v.useState(null),[Me,un]=v.useState(null),bn=v.useRef(Oe),{anchorRefs:ln,activeAnchor:zn}=iv(e),ht=Pe=>Pe==null?void 0:Pe.getAttributeNames().reduce((st,ae)=>{var ye;return ae.startsWith("data-tooltip-")&&(st[ae.replace(/^data-tooltip-/,"")]=(ye=Pe==null?void 0:Pe.getAttribute(ae))!==null&&ye!==void 0?ye:null),st},{}),dn=Pe=>{const st={place:ae=>{var ye;Se((ye=ae)!==null&&ye!==void 0?ye:p)},content:ae=>{ie(ae??r)},html:ae=>{fe(ae??o)},variant:ae=>{var ye;Ae((ye=ae)!==null&&ye!==void 0?ye:c)},offset:ae=>{et(ae===null?l:Number(ae))},wrapper:ae=>{var ye;je((ye=ae)!==null&&ye!==void 0?ye:d)},events:ae=>{const ye=ae==null?void 0:ae.split(" ");Ut(ye??m)},"position-strategy":ae=>{var ye;cn((ye=ae)!==null&&ye!==void 0?ye:I)},"delay-show":ae=>{be(ae===null?C:Number(ae))},"delay-hide":ae=>{tt(ae===null?g:Number(ae))},float:ae=>{qt(ae===null?O:ae==="true")},hidden:ae=>{nt(ae===null?b:ae==="true")},"class-name":ae=>{wt(ae)}};Object.values(st).forEach(ae=>ae(null)),Object.entries(Pe).forEach(([ae,ye])=>{var He;(He=st[ae])===null||He===void 0||He.call(st,ye)})};v.useEffect(()=>{ie(r)},[r]),v.useEffect(()=>{fe(o)},[o]),v.useEffect(()=>{Se(p)},[p]),v.useEffect(()=>{Ae(c)},[c]),v.useEffect(()=>{et(l)},[l]),v.useEffect(()=>{be(C)},[C]),v.useEffect(()=>{tt(g)},[g]),v.useEffect(()=>{qt(O)},[O]),v.useEffect(()=>{nt(b)},[b]),v.useEffect(()=>{cn(I)},[I]),v.useEffect(()=>{bn.current!==Oe&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")},[Oe]),v.useEffect(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:Oe==="core",disableBase:Oe}}))},[]),v.useEffect(()=>{var Pe;const st=new Set(ln);let ae=n;if(!ae&&e&&(ae=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),ae)try{document.querySelectorAll(ae).forEach(ce=>{st.add({current:ce})})}catch{console.warn(`[react-tooltip] "${ae}" is not a valid CSS selector`)}const ye=document.querySelector(`[id='${t}']`);if(ye&&st.add({current:ye}),!st.size)return()=>null;const He=(Pe=Me??ye)!==null&&Pe!==void 0?Pe:zn.current,pn=new MutationObserver(ce=>{ce.forEach(le=>{var Ue;if(!He||le.type!=="attributes"||!(!((Ue=le.attributeName)===null||Ue===void 0)&&Ue.startsWith("data-tooltip-")))return;const We=ht(He);dn(We)})}),X={attributes:!0,childList:!1,subtree:!1};if(He){const ce=ht(He);dn(ce),pn.observe(He,X)}return()=>{pn.disconnect()}},[ln,zn,Me,t,n]),v.useEffect(()=>{$!=null&&$.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),we&&!al("border",`${we}`)&&console.warn(`[react-tooltip] "${we}" is not a valid \`border\`.`),$!=null&&$.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),D&&!al("opacity",`${D}`)&&console.warn(`[react-tooltip] "${D}" is not a valid \`opacity\`.`)},[]);let Nn=h;const Gn=v.useRef(null);if(i){const Pe=i({content:(Me==null?void 0:Me.getAttribute("data-tooltip-content"))||z||null,activeAnchor:Me});Nn=Pe?v.createElement("div",{ref:Gn,className:"react-tooltip-content-wrapper"},Pe):null}else z&&(Nn=z);Y&&(Nn=v.createElement(qx,{content:Y}));const Cn={forwardRef:re,id:e,anchorId:t,anchorSelect:n,className:Mt(a,tn),classNameArrow:s,content:Nn,contentWrapperRef:Gn,place:L,variant:G,offset:Ve,wrapper:Qe,events:De,openOnClick:S,positionStrategy:mt,middlewares:f,delayShow:$e,delayHide:kt,float:St,hidden:Kt,noArrow:N,clickable:R,closeOnEsc:E,closeOnScroll:x,closeOnResize:_,openEvents:F,closeEvents:k,globalCloseEvents:J,imperativeModeOnly:q,style:$,position:te,isOpen:ee,defaultIsOpen:oe,border:we,opacity:D,arrowColor:B,setIsOpen:W,afterShow:j,afterHide:V,disableTooltip:K,activeAnchor:Me,setActiveAnchor:Pe=>un(Pe),role:ne};return v.createElement(kx,{...Cn})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||il({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||il({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 Ux(){return u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",children:[u.jsxs("g",{clipPath:"url(#clip0_2896_16290)",children:[u.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"}),u.jsx("path",{d:"M8.00293 5.83301L7.99768 5.83301",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"})]}),u.jsx("defs",{children:u.jsx("clipPath",{id:"clip0_2896_16290",children:u.jsx("rect",{width:"16",height:"16",fill:"white",transform:"translate(16 16.5) rotate(180)"})})})]})}function Lx({id:e,tooltipText:t}){return u.jsxs(u.Fragment,{children:[u.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:Ux()}),u.jsx(Kx,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}const ov=v.createContext(null);function av(){const e=v.useContext(ov);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const sv=v.createContext(()=>{});function Bx(){const e=v.useContext(sv);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}var cv=Symbol.for("immer-nothing"),ll=Symbol.for("immer-draftable"),xt=Symbol.for("immer-state"),Vx=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 It(e,...t){if(process.env.NODE_ENV!=="production"){const n=Vx[e],r=typeof n=="function"?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Hr=Object.getPrototypeOf;function Wr(e){return!!e&&!!e[xt]}function gr(e){var t;return e?uv(e)||Array.isArray(e)||!!e[ll]||!!((t=e.constructor)!=null&&t[ll])||Lo(e)||Bo(e):!1}var $x=Object.prototype.constructor.toString();function uv(e){if(!e||typeof e!="object")return!1;const t=Hr(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===$x}function No(e,t){Uo(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Uo(e){const t=e[xt];return t?t.type_:Array.isArray(e)?1:Lo(e)?2:Bo(e)?3:0}function Xa(e,t){return Uo(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function lv(e,t,n){const r=Uo(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function jx(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Lo(e){return e instanceof Map}function Bo(e){return e instanceof Set}function er(e){return e.copy_||e.base_}function Qa(e,t){if(Lo(e))return new Map(e);if(Bo(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=uv(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[xt];let o=Reflect.ownKeys(r);for(let i=0;i<o.length;i++){const a=o[i],s=r[a];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(r[a]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[a]})}return Object.create(Hr(e),r)}else{const r=Hr(e);if(r!==null&&n)return{...e};const o=Object.create(r);return Object.assign(o,e)}}function Gc(e,t=!1){return Vo(e)||Wr(e)||!gr(e)||(Uo(e)>1&&(e.set=e.add=e.clear=e.delete=Hx),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Gc(r,!0))),e}function Hx(){It(2)}function Vo(e){return Object.isFrozen(e)}var Wx={};function yr(e){const t=Wx[e];return t||It(0,e),t}var vi;function dv(){return vi}function zx(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function dl(e,t){t&&(yr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ya(e){Za(e),e.drafts_.forEach(Gx),e.drafts_=null}function Za(e){e===vi&&(vi=e.parent_)}function pl(e){return vi=zx(vi,e)}function Gx(e){const t=e[xt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function fl(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[xt].modified_&&(Ya(t),It(4)),gr(e)&&(e=Co(t,e),t.parent_||To(t,e)),t.patches_&&yr("Patches").generateReplacementPatches_(n[xt].base_,e,t.patches_,t.inversePatches_)):e=Co(t,n,[]),Ya(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==cv?e:void 0}function Co(e,t,n){if(Vo(t))return t;const r=t[xt];if(!r)return No(t,(o,i)=>ml(e,r,t,o,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return To(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const o=r.copy_;let i=o,a=!1;r.type_===3&&(i=new Set(o),o.clear(),a=!0),No(i,(s,c)=>ml(e,r,o,s,c,n,a)),To(e,o,!1),n&&e.patches_&&yr("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function ml(e,t,n,r,o,i,a){if(process.env.NODE_ENV!=="production"&&o===n&&It(5),Wr(o)){const s=i&&t&&t.type_!==3&&!Xa(t.assigned_,r)?i.concat(r):void 0,c=Co(e,o,s);if(lv(n,r,c),Wr(c))e.canAutoFreeze_=!1;else return}else a&&n.add(o);if(gr(o)&&!Vo(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Co(e,o),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&To(e,o)}}function To(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Gc(t,n)}function Xx(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:dv(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=Xc;n&&(o=[r],i=Ii);const{revoke:a,proxy:s}=Proxy.revocable(o,i);return r.draft_=s,r.revoke_=a,s}var Xc={get(e,t){if(t===xt)return e;const n=er(e);if(!Xa(n,t))return Qx(e,n,t);const r=n[t];return e.finalized_||!gr(r)?r:r===pa(e.base_,t)?(fa(e),e.copy_[t]=ts(r,e)):r},has(e,t){return t in er(e)},ownKeys(e){return Reflect.ownKeys(er(e))},set(e,t,n){const r=pv(er(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=pa(er(e),t),i=o==null?void 0:o[xt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(jx(n,o)&&(n!==void 0||Xa(e.base_,t)))return!0;fa(e),es(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 pa(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,fa(e),es(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=er(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){It(11)},getPrototypeOf(e){return Hr(e.base_)},setPrototypeOf(){It(12)}},Ii={};No(Xc,(e,t)=>{Ii[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Ii.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&It(13),Ii.set.call(this,e,t,void 0)};Ii.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&It(14),Xc.set.call(this,e[0],t,n,e[0])};function pa(e,t){const n=e[xt];return(n?er(n):e)[t]}function Qx(e,t,n){var o;const r=pv(t,n);return r?"value"in r?r.value:(o=r.get)==null?void 0:o.call(e.draft_):void 0}function pv(e,t){if(!(t in e))return;let n=Hr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Hr(n)}}function es(e){e.modified_||(e.modified_=!0,e.parent_&&es(e.parent_))}function fa(e){e.copy_||(e.copy_=Qa(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Yx=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 a=this;return function(c=i,...p){return a.produce(c,l=>n.call(this,l,...p))}}typeof n!="function"&&It(6),r!==void 0&&typeof r!="function"&&It(7);let o;if(gr(t)){const i=pl(this),a=ts(t,void 0);let s=!0;try{o=n(a),s=!1}finally{s?Ya(i):Za(i)}return dl(i,r),fl(o,i)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===cv&&(o=void 0),this.autoFreeze_&&Gc(o,!0),r){const i=[],a=[];yr("Patches").generateReplacementPatches_(t,o,i,a),r(i,a)}return o}else It(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(a,...s)=>this.produceWithPatches(a,c=>t(c,...s));let r,o;return[this.produce(t,n,(a,s)=>{r=a,o=s}),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){gr(e)||It(8),Wr(e)&&(e=Zx(e));const t=pl(this),n=ts(e,void 0);return n[xt].isManual_=!0,Za(t),n}finishDraft(e,t){const n=e&&e[xt];(!n||!n.isManual_)&&It(9);const{scope_:r}=n;return dl(r,t),fl(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=yr("Patches").applyPatches_;return Wr(e)?r(e,t):this.produce(e,o=>r(o,t))}};function ts(e,t){const n=Lo(e)?yr("MapSet").proxyMap_(e,t):Bo(e)?yr("MapSet").proxySet_(e,t):Xx(e,t);return(t?t.scope_:dv()).drafts_.push(n),n}function Zx(e){return Wr(e)||It(10,e),fv(e)}function fv(e){if(!gr(e)||Vo(e))return e;const t=e[xt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Qa(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Qa(e,!0);return No(n,(r,o)=>{lv(n,r,fv(o))}),t&&(t.finalized_=!1),n}var At=new Yx,Dt=At.produce;At.produceWithPatches.bind(At);At.setAutoFreeze.bind(At);At.setUseStrictShallowCopy.bind(At);At.applyPatches.bind(At);At.createDraft.bind(At);At.finishDraft.bind(At);const mv=v.createContext(void 0),eA={};function Qc(){const e=v.useContext(mv);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function tA({children:e}){const{installation:t}=at(),{hydratedRevision:n,loading:r}=ei(),[o,i]=v.useState(eA),a=t==null?void 0:t.config;v.useEffect(()=>{n!=null&&n.content&&!r&&a&&!(Object.entries(o).length>0)&&H0(n,a,i)},[n,r,a,o]);const s=v.useCallback((m,S)=>{i(I=>Dt(I,f=>{f[m]=Dt(f[m],S)}))},[i]),c=v.useCallback((m,S)=>{i(I=>Dt(I,f=>{f[m]=S}))},[i]),p=v.useCallback(()=>{i(Dt(m=>{const S=m.other.write;S&&(S.isWriteModified=!1)}))},[i]),l=v.useCallback(m=>{i(Dt(S=>{var f;const I=(f=S[m])==null?void 0:f.read;I&&(I.isOptionalFieldsModified=!1,I.isRequiredMapFieldsModified=!1,I.isValueMappingsModified=!1)}))},[i]),d=v.useCallback(m=>{m===fr?p():l(m)},[l,p]),h=v.useMemo(()=>({objectConfigurationsState:o,setObjectConfigurationsState:i,setConfigureState:s,resetConfigureState:c,resetPendingConfigurationState:d}),[o,c,d,s]);return u.jsx(mv.Provider,{value:h,children:e})}const en=()=>{const{appName:e}=Ee(),{objectConfigurationsState:t,setConfigureState:n}=Qc(),{selectedObjectName:r}=av(),o=Zy(r||"",t);return{appName:e,configureState:o,setConfigureState:n,selectedObjectName:r}};function nA(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:a}=o;a===null?delete n[i]:n[i]=a}),e!=null&&e.read){const o=e.read.savedConfig.requiredMapFields,a=!Wy(o,n);e.read.isRequiredMapFieldsModified=a}}function Si(e,t,n){t(e,r=>nA(r,n))}const rA="Each field must be mapped to a unique value";function Yc({field:e,onSelectChange:t,allFields:n}){var g;const{configureState:r,selectedObjectName:o,setConfigureState:i}=en(),[a,s]=v.useState(!0),{isError:c,removeError:p,getError:l}=Jt(),d=(g=r==null?void 0:r.read)==null?void 0:g.selectedFieldMappings,h=d==null?void 0:d[e.mapToName];v.useEffect(()=>{e._default&&!h&&o&&r&&Si(o,i,[{field:e.mapToName,value:e._default}]),s(!1)},[e,i,o,h,r]);const m=v.useMemo(()=>n.map(O=>({id:O.fieldName,label:O.displayName,value:O.fieldName})),[n]),S=u.jsx(zO,{disabled:a,items:m,selectedValue:h||null,onSelectedItemChange:O=>{t({target:{name:e.mapToName,value:O==null?void 0:O.value}})},placeholder:"Please select one",style:{width:"100%"}}),I=v.useCallback(()=>{o&&(Si(o,i,[{field:e.mapToName,value:null}]),c(de.MAPPING,o)&&p(de.MAPPING,o))},[e.mapToName,o,i,c,p]),{hasDuplicationError:f,errorMessage:C}=v.useMemo(()=>{const O=l(de.MAPPING,o),b=Array.isArray(O)&&O.length>0&&O.includes(e.mapToName);return{hasDuplicationError:b,errorMessage:b?rA:""}},[o,l,e.mapToName]);return u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[u.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:[u.jsx("span",{style:{fontWeight:500},children:e.mapToDisplayName??e.mapToName}),u.jsx("span",{children:(e==null?void 0:e.prompt)&&u.jsx(Lx,{id:`tooltip-id-${e==null?void 0:e.prompt}`,tooltipText:e==null?void 0:e.prompt})})]}),u.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[S,u.jsx(Xe,{type:"button",variant:"ghost",onClick:I,children:"Clear"})]})]},e.mapToName),f&&u.jsxs("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:[" ",C," "]},e.mapToName)]})}const iA="_formControl_9qd8d_1",oA="_formLabel_9qd8d_5",aA="_formLabelRequired_9qd8d_11",sA="_formInput_9qd8d_16",cA="_formInputInvalid_9qd8d_20",uA="_formError_9qd8d_24",lA="_disabled_9qd8d_30",Zn={formControl:iA,formLabel:oA,formLabelRequired:aA,formInput:sA,formInputInvalid:cA,formError:uA,disabled:lA};function $o({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:o=!1,errorMessage:i,children:a}){return u.jsxs("div",{className:Mt(Zn.formControl,{[Zn.disabled]:r}),children:[t&&u.jsx("label",{htmlFor:e,className:Mt(Zn.formLabel,{[Zn.formLabelRequired]:n}),children:t}),u.jsx("div",{id:e,className:Mt(Zn.formInput,{[Zn.formInputInvalid]:o}),children:a}),o&&i&&u.jsx("div",{className:Zn.formError,role:"alert",children:i})]})}function hv({selectedFieldMappings:e,selectedObjectName:t,fieldName:n,fieldValue:r,setError:o}){if(!e||!t)return!1;if(Object.values(e).some(a=>a===r&&a!==n)){console.error("Each field must be mapped to a unique value",e);const a=Object.keys(e).filter(c=>e[c]===r),s=[n,...a];return o(de.MAPPING,t,s),!0}return!1}function dA({dynamicFieldMappings:e,onSelectChange:t,allFields:n}){return e.length?u.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:e.map(r=>u.jsx($o,{id:r.mapToName,children:u.jsx(Yc,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function pA(){var S,I;const{selectedObjectName:e,configureState:t,setConfigureState:n}=en(),{isError:r,removeError:o,setError:i}=Jt(),a=((S=t==null?void 0:t.read)==null?void 0:S.allFields)||[],{fieldMapping:s}=at(),c=(I=t==null?void 0:t.read)==null?void 0:I.selectedFieldMappings,p=f=>{const{value:C,name:g}=f.target;!C||hv({selectedFieldMappings:c,selectedObjectName:e,fieldName:g,fieldValue:C,setError:i})||(e&&Si(e,n,[{field:g,value:C}]),r(de.MAPPING,g)&&o(de.MAPPING,g),e&&r(de.MAPPING,e)&&o(de.MAPPING,e))},l=v.useMemo(()=>!e||!s?[]:Object.values(s[e]||{}).flat().filter(f=>!f.fieldName),[s,e]),d=v.useMemo(()=>{var g;return(((g=t==null?void 0:t.read)==null?void 0:g.optionalMapFields)||[]).filter(O=>!l.some(b=>b.mapToName===O.mapToName))},[t,l]),h=l.length>0;return d.length>0||h?u.jsxs(u.Fragment,{children:[u.jsx(Rt,{string:"Map the following optional fields"}),u.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:[d==null?void 0:d.map(f=>u.jsx($o,{id:f.mapToName,children:u.jsx(Yc,{allFields:a,field:f,onSelectChange:p})},f.mapToName)),h&&u.jsx(dA,{dynamicFieldMappings:l,onSelectChange:p,allFields:a})]})]}):null}function fA(){var p;const{selectedObjectName:e,configureState:t,setConfigureState:n}=en(),{isError:r,removeError:o,setError:i}=Jt(),a=(p=t==null?void 0:t.read)==null?void 0:p.selectedFieldMappings,s=l=>{const{value:d,name:h}=l.target;!d||hv({selectedFieldMappings:a,selectedObjectName:e,fieldName:h,fieldValue:d,setError:i})||(e&&Si(e,n,[{field:h,value:d}]),r(de.MAPPING,h)&&o(de.MAPPING,h),e&&r(de.MAPPING,e)&&o(de.MAPPING,e))},c=v.useMemo(()=>{var l;return((l=t==null?void 0:t.read)==null?void 0:l.requiredMapFields)||[]},[t]);return c!=null&&c.length?u.jsxs(u.Fragment,{children:[u.jsx(Rt,{string:"Map the following fields"}),u.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:c.map(l=>{var d;return u.jsx($o,{id:l.mapToName,isInvalid:r(de.MAPPING,l.mapToName),errorMessage:"* required",children:u.jsx(Yc,{allFields:((d=t==null?void 0:t.read)==null?void 0:d.allFields)||[],field:l,onSelectChange:s})},l.mapToName)})})]}):null}const mA=(e,t)=>e.filter(n=>!t.has(n));function hA(){var h,m,S;const{selectedObjectName:e,configureState:t,setConfigureState:n}=en(),{fieldMapping:r}=at(),o=((h=t==null?void 0:t.read)==null?void 0:h.selectedFieldMappings)||{},i=Object.keys(o),a=((m=t==null?void 0:t.read)==null?void 0:m.requiredMapFields)||[],s=((S=t==null?void 0:t.read)==null?void 0:S.optionalMapFields)||[],c=e&&r?Object.values(r[e]||{}).flat().filter(I=>!I.fieldName):[],p=a.concat(c,s).map(I=>I.mapToName),l=new Set(p),d=mA(i,l);v.useEffect(()=>{e&&d.length&&Si(e,n,d.map(I=>({field:I,value:null})))},[e,n,d])}const gA={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function yA({children:e,style:t}){return u.jsx(In,{style:{...gA,...t},children:e})}function OA(){var p,l,d;const{project:e}=Ee(),{hydratedRevision:t}=ei(),{selectedObjectName:n}=en(),{providerName:r}=lt(),o=e==null?void 0:e.appName,i=(d=(l=(p=t==null?void 0:t.content)==null?void 0:p.read)==null?void 0:l.objects)==null?void 0:d.find(h=>h.objectName===n),a=(i==null?void 0:i.displayName)||n&&Vn(n),s=i==null?void 0:i.mapToName,c=(i==null?void 0:i.mapToDisplayName)||s&&Vn(s);return c&&o&&r?u.jsx(yA,{style:{marginTop:"1rem"},children:u.jsxs("p",{style:{margin:"1rem 0"},children:[u.jsx("b",{children:c})," in ",o," is mapped to"," ",u.jsx("b",{children:a})," in ",r,"."]})}):null}function hl(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function gv(...e){return t=>{let n=!1;const r=e.map(o=>{const i=hl(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():hl(e[o],null)}}}}function zr(...e){return U.useCallback(gv(...e),e)}function jo(e,t=[]){let n=[];function r(i,a){const s=U.createContext(a),c=n.length;n=[...n,a];const p=d=>{var C;const{scope:h,children:m,...S}=d,I=((C=h==null?void 0:h[e])==null?void 0:C[c])||s,f=U.useMemo(()=>S,Object.values(S));return u.jsx(I.Provider,{value:f,children:m})};p.displayName=i+"Provider";function l(d,h){var I;const m=((I=h==null?void 0:h[e])==null?void 0:I[c])||s,S=U.useContext(m);if(S)return S;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[p,l]}const o=()=>{const i=n.map(a=>U.createContext(a));return function(s){const c=(s==null?void 0:s[e])||i;return U.useMemo(()=>({[`__scope${e}`]:{...s,[e]:c}}),[s,c])}};return o.scopeName=e,[r,vA(o,...t)]}function vA(...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 a=r.reduce((s,{useScope:c,scopeName:p})=>{const d=c(i)[`__scope${p}`];return{...s,...d}},{});return U.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}function Xt(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 wi=globalThis!=null&&globalThis.document?U.useLayoutEffect:()=>{},IA=U[" useInsertionEffect ".trim().toString()]||wi;function Zc({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,a]=SA({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:o;{const l=U.useRef(e!==void 0);U.useEffect(()=>{const d=l.current;d!==s&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${s?"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.`),l.current=s},[s,r])}const p=U.useCallback(l=>{var d;if(s){const h=wA(l)?l(e):l;h!==e&&((d=a.current)==null||d.call(a,h))}else i(l)},[s,e,i,a]);return[c,p]}function SA({defaultProp:e,onChange:t}){const[n,r]=U.useState(e),o=U.useRef(n),i=U.useRef(t);return IA(()=>{i.current=t},[t]),U.useEffect(()=>{var a;o.current!==n&&((a=i.current)==null||a.call(i,n),o.current=n)},[n,o]),[n,r,i]}function wA(e){return typeof e=="function"}function bA(e){const t=U.useRef({value:e,previous:e});return U.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function NA(e){const[t,n]=U.useState(void 0);return wi(()=>{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 a,s;if("borderBoxSize"in i){const c=i.borderBoxSize,p=Array.isArray(c)?c[0]:c;a=p.inlineSize,s=p.blockSize}else a=e.offsetWidth,s=e.offsetHeight;n({width:a,height:s})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}function CA(e,t){return U.useReducer((n,r)=>t[n][r]??n,e)}var eu=e=>{const{present:t,children:n}=e,r=TA(t),o=typeof n=="function"?n({present:r.isPresent}):U.Children.only(n),i=zr(r.ref,RA(o));return typeof n=="function"||r.isPresent?U.cloneElement(o,{ref:i}):null};eu.displayName="Presence";function TA(e){const[t,n]=U.useState(),r=U.useRef(null),o=U.useRef(e),i=U.useRef("none"),a=e?"mounted":"unmounted",[s,c]=CA(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return U.useEffect(()=>{const p=to(r.current);i.current=s==="mounted"?p:"none"},[s]),wi(()=>{const p=r.current,l=o.current;if(l!==e){const h=i.current,m=to(p);e?c("MOUNT"):m==="none"||(p==null?void 0:p.display)==="none"?c("UNMOUNT"):c(l&&h!==m?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),wi(()=>{if(t){let p;const l=t.ownerDocument.defaultView??window,d=m=>{const I=to(r.current).includes(m.animationName);if(m.target===t&&I&&(c("ANIMATION_END"),!o.current)){const f=t.style.animationFillMode;t.style.animationFillMode="forwards",p=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=f)})}},h=m=>{m.target===t&&(i.current=to(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{l.clearTimeout(p),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:U.useCallback(p=>{r.current=p?getComputedStyle(p):null,n(p)},[])}}function to(e){return(e==null?void 0:e.animationName)||"none"}function RA(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 ns(e){const t=xA(e),n=U.forwardRef((r,o)=>{const{children:i,...a}=r,s=U.Children.toArray(i),c=s.find(EA);if(c){const p=c.props.children,l=s.map(d=>d===c?U.Children.count(p)>1?U.Children.only(null):U.isValidElement(p)?p.props.children:null:d);return u.jsx(t,{...a,ref:o,children:U.isValidElement(p)?U.cloneElement(p,void 0,l):null})}return u.jsx(t,{...a,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function xA(e){const t=U.forwardRef((n,r)=>{const{children:o,...i}=n;if(U.isValidElement(o)){const a=_A(o),s=FA(i,o.props);return o.type!==U.Fragment&&(s.ref=r?gv(r,a):a),U.cloneElement(o,s)}return U.Children.count(o)>1?U.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var AA=Symbol("radix.slottable");function EA(e){return U.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===AA}function FA(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]=(...s)=>{const c=i(...s);return o(...s),c}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function _A(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 PA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],wn=PA.reduce((e,t)=>{const n=ns(`Primitive.${t}`),r=U.forwardRef((o,i)=>{const{asChild:a,...s}=o,c=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(c,{...s,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Ho="Checkbox",[DA,HF]=jo(Ho),[MA,tu]=DA(Ho);function JA(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:o,disabled:i,form:a,name:s,onCheckedChange:c,required:p,value:l="on",internal_do_not_use_render:d}=e,[h,m]=Zc({prop:n,defaultProp:o??!1,onChange:c,caller:Ho}),[S,I]=U.useState(null),[f,C]=U.useState(null),g=U.useRef(!1),O=S?!!a||!!S.closest("form"):!0,b={checked:h,disabled:i,setChecked:m,control:S,setControl:I,name:s,form:a,value:l,hasConsumerStoppedPropagationRef:g,required:p,defaultChecked:Bn(o)?!1:o,isFormControl:O,bubbleInput:f,setBubbleInput:C};return u.jsx(MA,{scope:t,...b,children:kA(d)?d(b):r})}var yv="CheckboxTrigger",Ov=U.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},o)=>{const{control:i,value:a,disabled:s,checked:c,required:p,setControl:l,setChecked:d,hasConsumerStoppedPropagationRef:h,isFormControl:m,bubbleInput:S}=tu(yv,e),I=zr(o,l),f=U.useRef(c);return U.useEffect(()=>{const C=i==null?void 0:i.form;if(C){const g=()=>d(f.current);return C.addEventListener("reset",g),()=>C.removeEventListener("reset",g)}},[i,d]),u.jsx(wn.button,{type:"button",role:"checkbox","aria-checked":Bn(c)?"mixed":c,"aria-required":p,"data-state":wv(c),"data-disabled":s?"":void 0,disabled:s,value:a,...r,ref:I,onKeyDown:Xt(t,C=>{C.key==="Enter"&&C.preventDefault()}),onClick:Xt(n,C=>{d(g=>Bn(g)?!0:!g),S&&m&&(h.current=C.isPropagationStopped(),h.current||C.stopPropagation())})})});Ov.displayName=yv;var nu=U.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:a,disabled:s,value:c,onCheckedChange:p,form:l,...d}=e;return u.jsx(JA,{__scopeCheckbox:n,checked:o,defaultChecked:i,disabled:s,required:a,onCheckedChange:p,name:r,form:l,value:c,internal_do_not_use_render:({isFormControl:h})=>u.jsxs(u.Fragment,{children:[u.jsx(Ov,{...d,ref:t,__scopeCheckbox:n}),h&&u.jsx(Sv,{__scopeCheckbox:n})]})})});nu.displayName=Ho;var vv="CheckboxIndicator",ru=U.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=tu(vv,n);return u.jsx(eu,{present:r||Bn(i.checked)||i.checked===!0,children:u.jsx(wn.span,{"data-state":wv(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});ru.displayName=vv;var Iv="CheckboxBubbleInput",Sv=U.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:o,checked:i,defaultChecked:a,required:s,disabled:c,name:p,value:l,form:d,bubbleInput:h,setBubbleInput:m}=tu(Iv,e),S=zr(n,m),I=bA(i),f=NA(r);U.useEffect(()=>{const g=h;if(!g)return;const O=window.HTMLInputElement.prototype,N=Object.getOwnPropertyDescriptor(O,"checked").set,R=!o.current;if(I!==i&&N){const E=new Event("click",{bubbles:R});g.indeterminate=Bn(i),N.call(g,Bn(i)?!1:i),g.dispatchEvent(E)}},[h,I,i,o]);const C=U.useRef(Bn(i)?!1:i);return u.jsx(wn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:a??C.current,required:s,disabled:c,name:p,value:l,form:d,...t,tabIndex:-1,ref:S,style:{...t.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Sv.displayName=Iv;function kA(e){return typeof e=="function"}function Bn(e){return e==="indeterminate"}function wv(e){return Bn(e)?"indeterminate":e?"checked":"unchecked"}function bv(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 qA=["color"],Nv=v.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=bv(e,qA);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"}))}),KA=["color"],UA=v.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=bv(e,KA);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 LA="_checkboxGroupContainer_1ya1t_1",BA="_stack_1ya1t_6",VA="_selectAllContainer_1ya1t_11",$A="_fieldContainer_1ya1t_18",jA="_checkbox_1ya1t_1",Gr={checkboxGroupContainer:LA,stack:BA,selectAllContainer:VA,fieldContainer:$A,checkbox:jA};function Cv({id:e,isChecked:t,label:n,onCheckedChange:r}){return u.jsxs("div",{className:Gr.fieldContainer,children:[u.jsx(nu,{className:Gr.checkbox,id:e,onCheckedChange:r,checked:t,children:u.jsx(ru,{children:u.jsx(Nv,{})})}),u.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function Tv({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:o}){return u.jsxs("div",{className:Gr.selectAllContainer,children:[u.jsx(nu,{className:Gr.checkbox,id:e,onCheckedChange:r,children:u.jsxs(ru,{children:[o&&u.jsx(UA,{}),t===!0&&u.jsx(Nv,{})]})}),u.jsx("label",{htmlFor:e,children:n})]})}function Rv({children:e}){return u.jsx("div",{className:Gr.checkboxGroupContainer,children:e})}function xv({children:e}){return u.jsx("div",{className:Gr.stack,children:e})}function HA(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 a=e.read.savedConfig.optionalFields,c=!Wy(a,r);e.read.isOptionalFieldsModified=c}else console.warn("read.savedConfig.optionalFields is undefined")}function gl(e,t,n,r){t(e,o=>HA(o,n,r))}function WA(){var d,h;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=en(),o=(d=t==null?void 0:t.read)==null?void 0:d.selectedOptionalFields,i=(m,S)=>{m!=="indeterminate"&&r&&t&&gl(r,n,S,m)},a=(h=t==null?void 0:t.read)==null?void 0:h.optionalFields,s=m=>{r&&a&&a.forEach(S=>{$n(S)||gl(r,n,S.fieldName,m)})},c=!!(a&&a.length>0),p=Object.keys(o||{}).length===(a==null?void 0:a.length),l=!p&&Object.keys(o||{}).length>0;return c&&u.jsxs(u.Fragment,{children:[u.jsx(Rt,{string:`${e} reads the following optional fields`}),u.jsxs(Rv,{children:[((a==null?void 0:a.length)||0)>=2&&u.jsx(Tv,{id:"select-all-fields",isChecked:p,label:"Select all",onCheckedChange:s,isIndeterminate:l}),u.jsx(xv,{children:a.map(m=>$n(m)?null:u.jsx(Cv,{id:m.fieldName,isChecked:!!(o!=null&&o[m==null?void 0:m.fieldName]),label:m.displayName,onCheckedChange:S=>i(S,m.fieldName)},m.fieldName))})]})]})}function zA(){return u.jsx(WA,{})}const GA={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 XA({children:e,style:t,...n}){return u.jsx("span",{style:{...GA,...t},...n,children:e})}function QA(){var n,r,o;const{configureState:e}=en(),{appName:t}=Ee();return u.jsxs(u.Fragment,{children:[u.jsx(Rt,{string:`${t} reads the following fields`}),u.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:u.jsx(XA,{children:i.displayName},i.fieldName)):"There are no required fields."})]})}function YA(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 Av(e,t,n,r,o){t(e,i=>YA(i,e,n,r,o))}function ZA(e,t,n){t(e,r=>{r.read&&(r.read.isValueMappingsModified=n)})}function eE({string:e,fieldName:t}){return u.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[u.jsxs("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:[e,u.jsx("b",{children:t})]}),u.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:u.jsx(Mo,{style:{width:"100%",marginLeft:"1rem"}})})]})}function tE({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r,hasError:o}){var N;const{configureState:i,selectedObjectName:a,setConfigureState:s}=en(),[c,p]=v.useState(!0),{getError:l,setError:d,resetBoundary:h,isError:m,removeError:S}=Jt(),I=v.useMemo(()=>{var R,E;return((E=(R=i==null?void 0:i.read)==null?void 0:R.selectedValueMappings)==null?void 0:E[n])||{}},[(N=i==null?void 0:i.read)==null?void 0:N.selectedValueMappings,n]),f=v.useMemo(()=>I==null?void 0:I[e.mappedValue],[I,e.mappedValue]);v.useEffect(()=>{p(!1)},[e,s,a,f,i]);const C=v.useMemo(()=>r.map(R=>({id:R.value,label:R.displayValue,value:R.value})),[r]),g=v.useCallback(R=>{if(R){if(Object.values(I).some(E=>E===R.value&&E!==f)){const E=[...Object.entries(I).filter(([x,_])=>_===R.value&&_!==f).map(([x])=>x),e.mappedValue];d(de.VALUE_MAPPING,n,E);return}l(de.VALUE_MAPPING,n)&&h(de.VALUE_MAPPING),t({target:{name:e.mappedValue,value:R.value,fieldName:n}})}},[t,I,f,n,e.mappedValue,h,d,l]),O=v.useMemo(()=>u.jsx(zO,{disabled:c,items:C,selectedValue:f||null,onSelectedItemChange:g,placeholder:"Please select one",style:{border:o?"2px solid red":void 0,borderRadius:"8px",width:"100%"}},f),[f,c,C,g,o]),b=v.useCallback(()=>{a&&(Av(a,s,e.mappedValue,"",n),m(de.VALUE_MAPPING,n)&&S(de.VALUE_MAPPING,n))},[a,s,e.mappedValue,n,m,S]);return u.jsxs("div",{style:{display:"flex",flexDirection:"column",marginBottom:".25rem"},children:[u.jsx("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:u.jsx("span",{style:{fontWeight:500},children:e.mappedDisplayValue})}),u.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[O,u.jsx(Xe,{type:"button",variant:"ghost",onClick:b,children:"Clear"})]})]},e.mappedValue)}function nE(){var m,S,I;const{fieldMapping:e}=at(),{selectedObjectName:t,configureState:n,setConfigureState:r}=en(),{isError:o,removeError:i,getError:a}=Jt(),s=(m=n==null?void 0:n.read)==null?void 0:m.selectedFieldMappings,c=(S=n==null?void 0:n.read)==null?void 0:S.selectedValueMappings,p=(I=n==null?void 0:n.read)==null?void 0:I.isValueMappingsModified,l=v.useRef(!1),d=v.useMemo(()=>{const f=t&&e?Object.values(e[t]||{}).flat().filter(C=>C.mappedValues).map(C=>({...C})):[];if(s)for(let C=0;C<f.length;C+=1){const{mapToName:g}=f[C];s!=null&&s[g]&&(f[C].fieldName=s[g])}return f},[t,e,s]),h=v.useCallback(f=>{const{value:C,name:g,fieldName:O}=f.target;C&&(t&&Av(t,r,g,C,O),o(de.VALUE_MAPPING,g)&&i(de.VALUE_MAPPING,g))},[t,r,o,i]);return v.useEffect(()=>{var f;if(t&&c){const C=((f=e==null?void 0:e[t])==null?void 0:f.filter(O=>O.fieldName&&O.mappedValues.length>0))||[];C.every(O=>{const b=c[O.fieldName]||{};return Object.keys(b).length===Object.keys(O.mappedValues).length})&&C.length>0?!p&&!l.current&&(ZA(t,r,!0),l.current=!0):l.current=!1}},[c,d,t,r,e,p]),d!=null&&d.length?u.jsx(u.Fragment,{children:d.map(f=>{var R,E,x;if(!f.fieldName)return null;const C=(E=(R=n==null?void 0:n.read)==null?void 0:R.allFieldsMetadata)==null?void 0:E[f.fieldName],g=C==null?void 0:C.valueType;if(!["singleSelect","multiSelect"].includes(g))return console.error("fieldName is not a singleSelect or multiSelect",f),null;const O=C==null?void 0:C.values;if(!O)return null;const b=Object.keys(O).length,N=Object.keys((f==null?void 0:f.mappedValues)||[]).length;return b!==N?(console.error("field values and the values to be mapped are not of the same length",f,O),null):u.jsxs(u.Fragment,{children:[u.jsx(eE,{string:"Map the values for ",fieldName:f.mapToDisplayName||f.mapToName||f.fieldName}),u.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:u.jsx($o,{id:f.mapToName||f.fieldName,children:(x=f==null?void 0:f.mappedValues)==null?void 0:x.map(_=>{var q,$,te;const F=a(de.VALUE_MAPPING,f.fieldName),k=Array.isArray(F)&&F.includes(_.mappedValue),J=((te=($=(q=n==null?void 0:n.read)==null?void 0:q.allFieldsMetadata)==null?void 0:$[f.fieldName])==null?void 0:te.values)||[];return u.jsxs(u.Fragment,{children:[u.jsx(tE,{allValueOptions:J,mappedValue:_,onSelectChange:h,fieldName:(f==null?void 0:f.fieldName)||"",hasError:k},`${_.mappedValue}-${f.fieldName}`),k&&u.jsx("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:`Each ${f.mapToName||f.fieldName} must be mapped to a unique value`},_.mappedValue)]})})},f.mapToName||f.fieldName)})]})})}):null}function rE(){return hA(),u.jsxs(u.Fragment,{children:[u.jsx(OA,{}),u.jsx(QA,{}),u.jsx(fA,{}),u.jsx(pA,{}),u.jsx(nE,{}),u.jsx(zA,{})]})}function iE(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 a=e.write.selectedWriteObjects;if(n&&(a[t]={objectName:t}),n||delete a[t],(i=(o=e==null?void 0:e.write)==null?void 0:o.savedConfig)!=null&&i.selectedWriteObjects){const s=e.write.savedConfig.selectedWriteObjects,p=!V0(s,a);e.write.isWriteModified=p}}}function yl(e,t,n,r){t(e,o=>{iE(o,n,r)})}function oE(){var d,h,m,S;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=en(),o=(d=n==null?void 0:n.write)==null?void 0:d.selectedWriteObjects,i=(h=n==null?void 0:n.write)==null?void 0:h.writeObjects,a=(I,f)=>{I!=="indeterminate"&&t&&n&&yl(t,r,f,I)},s=I=>{var f,C;t&&n&&((C=(f=n==null?void 0:n.write)==null?void 0:f.writeObjects)==null||C.forEach(g=>{yl(t,r,g.objectName,I)}))},c=!!i,p=Object.keys(o||{}).length===((S=(m=n==null?void 0:n.write)==null?void 0:m.writeObjects)==null?void 0:S.length),l=!p&&Object.keys(o||{}).length>0;return c&&u.jsxs(u.Fragment,{children:[u.jsx(Rt,{string:`Allow ${e} to write to these objects`}),u.jsxs(Rv,{children:[((i==null?void 0:i.length)||0)>=2&&u.jsx(Tv,{id:"select-all-fields",onCheckedChange:s,isIndeterminate:l,isChecked:p,label:"Select all"}),u.jsx(xv,{children:i.map(I=>u.jsx(Cv,{id:I.objectName,onCheckedChange:f=>a(f,I.objectName),isChecked:!!(o!=null&&o[I.objectName]),label:I.displayName},I.objectName))})]})]})}function aE(){return u.jsx(u.Fragment,{children:u.jsx(oE,{})})}const sE="_authenticationRow_cjz1t_1",cE="_field_cjz1t_8",uE="_value_cjz1t_12",ma={authenticationRow:sE,field:cE,value:uE};function Ol({label:e,value:t}){return u.jsxs("div",{className:ma.authenticationRow,children:[u.jsx("div",{className:ma.field,children:e}),u.jsx("div",{className:ma.value,children:t})]})}function lE(){const{selectedConnection:e}=Zt(),{providerName:t}=lt(),r=(e==null?void 0:e.provider)==="salesforce"?"subdomain":"workspace",o=`${t} ${r}`;return u.jsxs(u.Fragment,{children:[u.jsx(Rt,{string:"Connection details"}),u.jsxs("div",{style:{paddingBottom:"1rem"},children:[u.jsx(Ol,{label:o,value:e==null?void 0:e.providerWorkspaceRef}),u.jsx(Ol,{label:"Status",value:e==null?void 0:e.status})]})]})}const dE=()=>{const e=ot(),t=Ke();return vn({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."),Be(n)}})};function Ev({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const{projectId:r}=Ee(),{integrationId:o,installation:i,setIntegrationDeleted:a,onUninstallSuccess:s}=at(),[c,p]=v.useState(!1),l=!r||!o||!(i!=null&&i.id)||c,d=dE(),h=async()=>{l||(p(!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),s==null||s(i==null?void 0:i.id),a()},onSettled:()=>p(!1)}))},m=c?"Uninstalling...":e,S=u.jsx(Xe,{type:"button",onClick:h,disabled:l,variant:t,style:n,children:m});return i!=null&&i.id?S:null}function pE(){const{installation:e}=at(),{providerName:t}=lt();return e?u.jsxs(u.Fragment,{children:[u.jsx(Rt,{string:"Uninstall entire integration"}),u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",padding:"1rem 0"},children:[e!=null&&e.id?u.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."]}):u.jsx("p",{children:"You've successfully uninstalled the integration."}),u.jsx(Ev,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})]}):null}function fE(){return u.jsxs(u.Fragment,{children:[u.jsx(lE,{}),u.jsx(Cc,{}),u.jsx(pE,{})]})}function Fv({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:o}){var R,E,x,_;const{installation:i}=at(),{hydratedRevision:a,loading:s}=ei(),{configureState:c,selectedObjectName:p}=en(),l=i==null?void 0:i.config,d=l&&p&&!!Vy(l,p)||!1,h=((R=c==null?void 0:c.read)==null?void 0:R.isOptionalFieldsModified)||((E=c==null?void 0:c.read)==null?void 0:E.isRequiredMapFieldsModified)||((x=c==null?void 0:c.read)==null?void 0:x.isValueMappingsModified),m=(_=c==null?void 0:c.write)==null?void 0:_.isWriteModified,C=s||n||!c||!p||!(h||m||r||p!==fr&&!d),g=p===fr,O=p===ho,b=u.jsx(Xe,{type:"submit",disabled:C,children:r?"Install":"Save"}),N=u.jsx(Xe,{type:"button",onClick:t,disabled:C,variant:"ghost",children:"Reset"});return n?u.jsx(gi,{}):u.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[u.jsx("div",{style:{display:"flex",flexDirection:"row-reverse",gap:".8rem",marginBottom:"20px",height:"3rem"},children:!O&&u.jsxs(u.Fragment,{children:[b,N]})}),u.jsxs(In,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[o&&u.jsx(Ei,{children:typeof o=="string"?o:"Installation Failed."}),s&&u.jsx(gi,{}),a&&!g&&!O&&u.jsx(rE,{}),a&&g&&!O&&u.jsx(aE,{}),!s&&O&&u.jsx(fE,{})]})]})}const _v=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:o,onUpdateSuccess:i}=at(),{hydratedRevision:a,loading:s}=ei(),{selectedObjectName:c}=av(),{selectedConnection:p}=Zt(),l=jl(),{projectId:d}=Ee(),{resetBoundary:h,setErrors:m,setError:S,getError:I}=Jt(),{resetConfigureState:f,objectConfigurationsState:C,resetPendingConfigurationState:g}=Qc(),O=Zy(c||"",C),{onNextIncompleteTab:b}=Bx(),N=v.useCallback(()=>{h(de.INSTALLATION_MUTATION)},[h]),R=v.useCallback(x=>x?_=>{S(de.INSTALLATION_MUTATION,x,_)}:_=>{console.error("objectName is required to set installation error: ",_)},[S]),E=v.useCallback(x=>x?I(de.INSTALLATION_MUTATION,x):"",[I]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:a,loading:s,selectedObjectName:c,selectedConnection:p,apiKey:l,projectId:d,resetBoundary:h,setErrors:m,setMutateInstallationError:R,getMutateInstallationError:E,resetMutateInstallationErrorState:N,resetConfigureState:f,objectConfigurationsState:C,resetPendingConfigurationState:g,configureState:O,onInstallSuccess:o,onUpdateSuccess:i,onNextIncompleteTab:b}},mE=void 0;function hE(){const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:o,loading:i,selectedObjectName:a,selectedConnection:s,apiKey:c,projectId:p,resetBoundary:l,setErrors:d,setMutateInstallationError:h,getMutateInstallationError:m,resetMutateInstallationErrorState:S,resetConfigureState:I,objectConfigurationsState:f,resetPendingConfigurationState:C,configureState:g,onInstallSuccess:O,onNextIncompleteTab:b}=_v(),[N,R]=v.useState(!1),E=a===fr,x=m(a),_=v.useCallback(()=>{l(de.MAPPING),o!=null&&o.content&&!i&&a&&Gy(o,mE,a,I)},[l,o,i,a,I]);v.useEffect(()=>{!g&&(o!=null&&o.content)&&!i&&_()},[g,f,o,i,_]);const F=()=>{S();const{requiredMapFields:q,selectedFieldMappings:$}=(g==null?void 0:g.read)||{},{errorList:te}=Hy(q,$,d);te.length>0||(a&&(s!=null&&s.id)&&c&&p&&e&&t&&n&&o?(R(!0),G0(p,e,t,n,s.id,a,c,o,g,h(a),r,O).finally(()=>{R(!1),C(a),b()})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},k=()=>{S(),a&&(s!=null&&s.id)&&c&&p&&e&&t&&n&&o?(R(!0),Y0(p,e,t,n,s.id,c,o,g,h(a),r,O).finally(()=>{R(!1),C(a),b()})):console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},J=q=>{q.preventDefault(),E?k():F()};return u.jsx(Fv,{errorMsg:x,isCreateMode:!0,isLoading:N,onSave:J,onReset:_})}function gE({updateConfig:e,projectId:t,integrationId:n,installationId:r,apiKey:o,selectedObjectName:i,setInstallation:a,onUpdateSuccess:s,setError:c}){const p={projectIdOrName:t,installationId:r,integrationId:n,installationUpdate:{updateMask:[`config.content.read.objects.${_0(i)}`],installation:{config:e}}};return Oc().installationApi.updateInstallation(p,{headers:{"X-Api-Key":o,"Content-Type":"application/json"}}).then(l=>{a(l),s==null||s(l.id,l.config)}).catch(l=>{Be(l,c)})}const yE=(e,t,n,r,o,i)=>{const a=Xy(e),s=Qy(e),c=Yy(e),p={content:{read:{objects:{[t]:{objectName:t,schedule:r,destination:(n==null?void 0:n.destination)||"",selectedFields:a,selectedFieldMappings:s,selectedValueMappings:c||{},backfill:i}}}}};return Ai(o)&&(p.content||(p.content={}),p.content.proxy={enabled:!0}),p},OE=(e,t,n,r,o,i,a,s,c,p,l)=>{const d=yE(i,r||"",s,s.schedule,c,s.backfill);return d?gE({updateConfig:d,projectId:e,integrationId:t,installationId:n,apiKey:o,selectedObjectName:r,setError:p,setInstallation:a,onUpdateSuccess:l}):(console.error("Error when generating updateConfig from configureState"),Promise.resolve(null))},vE=(e,t)=>{const r={content:{write:{objects:tO(e)}}};return Ai(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r},IE=(e,t,n,r,o,i,a,s,c)=>{const p=vE(o,i);if(!p)return console.error("Error when generating write updateConfig from configureState"),Promise.resolve(null);const l={projectIdOrName:e,installationId:n,integrationId:t,installationUpdate:{updateMask:["config.content.write.objects"],installation:{config:p}}};return Oc().installationApi.updateInstallation(l,{headers:{"X-Api-Key":r,"Content-Type":"application/json"}}).then(d=>{s(d),c==null||c(d.id,d.config)}).catch(d=>{Be(d,a)})};function SE({installation:e,integrationObj:t}){const{setInstallation:n,hydratedRevision:r,loading:o,selectedObjectName:i,apiKey:a,projectId:s,resetBoundary:c,setErrors:p,setMutateInstallationError:l,getMutateInstallationError:d,resetConfigureState:h,resetPendingConfigurationState:m,configureState:S,onUpdateSuccess:I,onNextIncompleteTab:f}=_v(),[C,g]=v.useState(!1),O=i===fr,b=d(i),{config:N}=e,R=v.useCallback(()=>{c(de.MAPPING),r!=null&&r.content&&!o&&i&&Gy(r,N,i,h)},[c,r,o,i,N,h]);v.useEffect(()=>{S||R()},[S,R]);const E=v.useMemo(()=>{var J,q,$;return($=(q=(J=r==null?void 0:r.content)==null?void 0:J.read)==null?void 0:q.objects)==null?void 0:$.find(te=>(te==null?void 0:te.objectName)===i)},[r,i]),x=()=>{const{requiredMapFields:k,selectedFieldMappings:J}=(S==null?void 0:S.read)||{},{errorList:q}=Hy(k,J,p);q.length>0||(r&&e&&i&&a&&s&&E?(g(!0),OE(s,t.id,e.id,i,a,S,n,E,r,l(i),I).finally(()=>{g(!1),m(i),f()})):console.error("UpdateInstallation - onSaveUpdate missing required props"))},_=()=>{e&&i&&a&&s&&r?(g(!0),IE(s,t.id,e.id,a,S,r,l(i),n,I).finally(()=>{g(!1),m(i),f()})):console.error("UpdateInstallation - onSaveUpdate missing required props")},F=k=>{k.preventDefault(),O?_():x()};return u.jsx(Fv,{errorMsg:b,onSave:F,onReset:R,isLoading:C})}function wE(){const{integrationObj:e,installation:t}=at();return e?t&&e?u.jsx(SE,{installation:t,integrationObj:e}):u.jsx(hE,{}):u.jsx(Jy,{message:"We can't load the integration"})}const Pv=()=>{const e=ot(),t=Ke(),[n,r]=v.useState(null);return{...vn({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"),Be(i,r)}}),errorMsg:n}};function bE(){return u.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),u.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function iu({text:e,children:t}){return u.jsx(Yr,{children:u.jsxs(In,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[u.jsx(bE,{}),u.jsx("p",{children:e}),t]})})}function NE({provider:e}){const{providerName:t}=lt(e),n=`You have successfully installed your ${t} integration.`;return u.jsx(iu,{text:n,children:u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:u.jsx(Ev,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const CE=e=>{const{read:t,write:n}=(e==null?void 0:e.content)??{};return!t&&!n};function TE({children:e}){var N;const t=v.useRef(!1),{projectId:n}=Ee(),{hydratedRevision:r,loading:o}=ei(),{integrationObj:i,installation:a,groupRef:s,consumerRef:c,onInstallSuccess:p,isIntegrationDeleted:l}=at(),{mutate:d,isIdle:h,isPending:m,error:S,errorMsg:I}=Pv(),{selectedConnection:f,isConnectionsLoading:C}=Zt(),g=o||m||C,O=(N=r==null?void 0:r.content)==null?void 0:N.provider,b=CE(r);return v.useEffect(()=>{var R;if(!g&&!C&&r&&b&&!a&&f&&(i!=null&&i.id)&&!l&&O){const E={projectIdOrName:n,integrationId:i==null?void 0:i.id,installation:{groupRef:s,connectionId:f==null?void 0:f.id,config:{content:{provider:O}}}};Ai(r)===!0&&(E.installation.config.content.proxy=(R=r==null?void 0:r.content)==null?void 0:R.proxy),h&&!t.current&&(d(E,{onSuccess:x=>{p==null||p(x==null?void 0:x.id,x.config)}}),t.current=!0)}},[r,b,a,f,n,i==null?void 0:i.id,s,c,g,p,l,C,O,d,h]),b&&O&&a?u.jsx(NE,{provider:O}):S?u.jsx(Gt,{message:I??"Create installation failed"}):i?g?u.jsx(Zr,{}):u.jsx("div",{children:e}):u.jsx(Gt,{message:"We can't load the integration"})}function Wo(){const e=ot(),t=Ke();return vn({mutationKey:["createConnection"],mutationFn:async n=>(await e()).connectionApi.generateConnection(n),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","connections"]})},onError:n=>{console.error("Error creating connection and loading provider info"),Be(n)}})}function RE({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:a,selectedConnection:s}){const{projectIdOrName:c}=Ee(),p=Wo(),l=v.useCallback(d=>{var I;const{apiKey:h,providerMetadata:m}=d,S={projectIdOrName:c,generateConnectionParams:{providerWorkspaceRef:(I=m==null?void 0:m.workspace)==null?void 0:I.value,groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,apiKey:h,...m&&{providerMetadata:m}}};p.mutate(S)},[c,i,o,r,n,e,p]);return s===null?u.jsx(OT,{provider:e,providerInfo:t,handleSubmit:l,error:null}):a}function xE({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:a,selectedConnection:s}){const{projectIdOrName:c}=Ee(),p=Wo(),l=v.useCallback(d=>{var f;const{user:h,pass:m,providerMetadata:S}=d,I={projectIdOrName:c,generateConnectionParams:{providerWorkspaceRef:(f=S==null?void 0:S.workspace)==null?void 0:f.value,groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:h,password:m},...S&&{providerMetadata:S}}};p.mutate(I)},[c,i,o,r,n,e,p]);return s===null?u.jsx(bT,{provider:e,providerInfo:t,handleSubmit:l,error:null}):a}function AE({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 u.jsxs(Or,{children:[u.jsx(vr,{children:i||`Set up ${r} integration`}),u.jsx(Sn,{error:t}),o,u.jsx(Xe,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function EE({...e}){return u.jsx(AE,{...e})}function FE({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:a,providerName:s}){const{projectIdOrName:c}=Ee(),p=Wo(),l=v.useCallback(()=>{const d={projectIdOrName:c,generateConnectionParams:{groupName:o,groupRef:r,consumerName:n,consumerRef:t,provider:e}};p.mutate(d)},[c,o,r,n,t,e,p]);return a===null?u.jsx(EE,{handleSubmit:l,error:null,providerName:s}):i}const _E=()=>{const e=ot(),t=Ke();return vn({mutationKey:["createOauthConnection"],mutationFn:async n=>(await e()).oAuthApi.oauthConnect(n),onSuccess:()=>{t.invalidateQueries({queryKey:["connections"]})}})};function PE({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return u.jsxs(Or,{children:[u.jsx(vr,{children:`Set up ${r} integration`}),u.jsx(mT,{children:`Click Next to sign into the ${r} account you'd like to sync.`}),u.jsx(Sn,{error:t}),u.jsx(Xe,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:n?"Loading...":"Next"})]})}const DE="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function ME({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return u.jsxs(Or,{children:[u.jsx(vr,{children:"Enter your Salesforce subdomain"}),u.jsx(iO,{href:DE,newTab:!0,children:"What is my Salesforce subdomain?"}),u.jsx(Sn,{error:n}),u.jsxs("div",{style:{display:"flex",marginTop:"1em",alignItems:"center"},children:[u.jsx(zt.Input,{id:"salesforce-subdomain",type:"text",placeholder:"my-domain",onChange:o=>t(o.currentTarget.value)}),u.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),u.jsx(Xe,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function JE({handleSubmit:e,setFormData:t,error:n,isButtonDisabled:r,providerName:o,metadataFields:i}){return u.jsxs(Or,{children:[u.jsxs(vr,{children:["Enter your ",o," workspace"]}),u.jsx(Sn,{error:n}),u.jsx("br",{}),i.map(a=>u.jsx(zt.Input,{id:a.name,name:a.name,type:"text",placeholder:a.displayName||a.name,onChange:s=>t(a.name,s.currentTarget.value)},a.name)),u.jsx("br",{}),u.jsx(Xe,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const vl=600,Il=600,Sl="salesforce";function kE({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){var k;const{projectId:a}=Ee(),s=Ke(),c=v.useRef(null),[p,l]=v.useState(null),[d,h]=v.useState(""),[m,S]=v.useState({}),[I,f]=v.useState({}),{data:C}=Po(e),g=((k=C==null?void 0:C.metadata)==null?void 0:k.input)||[],{mutateAsync:O,isPending:b}=_E(),{isFetching:N,refetch:R}=Ic({groupRef:r,provider:e});v.useEffect(()=>{const J=q=>{var $,te,ee;q.origin===Ay&&((($=q.data)==null?void 0:$.eventType)==="AUTHORIZATION_SUCCEEDED"?(l(null),console.debug("New connection:",q.data.data.connection),s.invalidateQueries({queryKey:["amp","connections"]})):((te=q.data)==null?void 0:te.eventType)==="AUTHORIZATION_FAILED"&&(console.error("OAuth failed:",q.data.data.error),s.invalidateQueries({queryKey:["amp","connections"]}),l(q.data.data.error||"An error occurred. Please try again.")),(ee=c.current)==null||ee.close())};return window.addEventListener("message",J),()=>window.removeEventListener("message",J)},[s]);const E=J=>{h(J),S(q=>({...q,workspace:J})),f(q=>({...q,workspace:{value:J,source:"input"}}))},x=(J,q)=>{S($=>({...$,[J]:q})),f($=>({...$,[J]:{value:q,source:"input"}}))},_=async()=>{var J;l(null);try{const{data:q}=await R();if(q&&q.length>0){console.debug("connections found");return}}catch{console.debug("error with fetching connections")}if(g.length>0&&!yi(g,m)){l("Please fill in all required fields");return}try{const q=await O({connectOAuthParams:{provider:e,consumerRef:t,groupRef:r,projectId:a,consumerName:n,groupName:o,providerWorkspaceRef:e===Sl?d:(J=I==null?void 0:I.workspace)==null?void 0:J.value,providerMetadata:I}});if(q){const $=window.screenX+(window.outerWidth-vl)/2,te=window.screenY+(window.outerHeight-Il)/2.5,ee=`width=${vl},height=${Il},left=${$},top=${te}`;c.current=window.open(q,"OAuthPopup",ee)}}catch(q){console.error(q),l(q instanceof Error?q.message:String(q)||"An error occurred. Please try again.")}},F=e===Sl?u.jsx(ME,{handleSubmit:_,setWorkspace:E,error:p,isButtonDisabled:d.length===0||b||N}):g.length>0?u.jsx(JE,{handleSubmit:_,setFormData:x,error:p,isButtonDisabled:!yi(g,m)||b||N,providerName:i,metadataFields:g}):u.jsx(PE,{handleSubmit:_,error:p,providerName:i,isButtonDisabled:b||N});return u.jsx("div",{children:F})}function qE({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,explicitScopesRequired:a,selectedConnection:s}){const{projectIdOrName:c}=Ee(),p=Wo(),[l,d]=v.useState(null),h=v.useCallback(m=>{var I,f;d(null);const S={projectIdOrName:c,generateConnectionParams:{groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:(f=(I=m.providerMetadata)==null?void 0:I.workspace)==null?void 0:f.value,oauth2ClientCredentials:{clientId:m.clientId,clientSecret:m.clientSecret,scopes:m.scopes},...m.providerMetadata&&{providerMetadata:m.providerMetadata}}};p.mutate(S,{onError:()=>d("Error loading provider info")})},[c,i,o,r,n,e,p]);return s===null?u.jsx(CT,{provider:e,providerName:t,handleSubmit:h,error:l,explicitScopesRequired:a}):u.jsx(gi,{})}function KE({...e}){return u.jsx(qE,{...e})}const UE="authorizationCode",LE="authorizationCodePKCE",BE="clientCredentials";function VE({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,selectedConnection:a,setSelectedConnection:s}){const{providerName:c}=lt(e);if(t.oauth2Opts===void 0)return u.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:p,explicitScopesRequired:l}=t.oauth2Opts,d={provider:e,consumerRef:n,consumerName:r,groupRef:o,groupName:i,providerName:c};return p===UE||p===LE?u.jsx(kE,{...d}):p===BE?u.jsx(KE,{...d,explicitScopesRequired:l,selectedConnection:a,setSelectedConnection:s}):p==="password"?u.jsx("em",{children:"Password flow not supported yet"}):u.jsxs("em",{children:["Unsupported grant type: ",p]})}function $E(e){const{selectedConnection:t}=Zt();v.useEffect(()=>{e&&t&&e(t)},[e,t])}function jE({onSuccess:e}){$E(e)}function Dv({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,onSuccess:a,onDisconnectSuccess:s,resetComponent:c}){const{data:p,isLoading:l,isError:d,error:h,providerName:m,selectedProvider:S}=lt(e),{provider:I,isIntegrationDeleted:f}=at(),{selectedConnection:C,setSelectedConnection:g}=Zt();jE({onSuccess:a});const O=Ke();v.useEffect(()=>{d&&(console.error("Error loading provider info."),Be(h))},[d,h]);const b=v.useCallback(()=>{O.clear(),c()},[c,O]);if(!e&&!I)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(f)return u.jsx(iu,{text:"Integration successfully uninstalled.",children:u.jsx(Xe,{type:"button",onClick:b,style:{width:"100%"},children:"Reinstall Integration"})});if(C)return i;if(l)return u.jsx(Zr,{});if(p==null)return u.jsx(Gt,{message:"Provider info was not found."});const N={provider:S,consumerRef:t,consumerName:n,groupRef:r,groupName:o,selectedConnection:C,setSelectedConnection:g,providerName:m,providerInfo:p,onDisconnectSuccess:s};return p.authType==="none"?u.jsx(FE,{...N,children:i}):p.authType==="basic"?u.jsx(xE,{...N,children:i}):p.authType==="apiKey"?u.jsx(RE,{...N,children:i}):u.jsx(VE,{...N})}function HE(e){const t=e+"CollectionProvider",[n,r]=jo(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=I=>{const{scope:f,children:C}=I,g=v.useRef(null),O=v.useRef(new Map).current;return u.jsx(o,{scope:f,itemMap:O,collectionRef:g,children:C})};a.displayName=t;const s=e+"CollectionSlot",c=ns(s),p=v.forwardRef((I,f)=>{const{scope:C,children:g}=I,O=i(s,C),b=zr(f,O.collectionRef);return u.jsx(c,{ref:b,children:g})});p.displayName=s;const l=e+"CollectionItemSlot",d="data-radix-collection-item",h=ns(l),m=v.forwardRef((I,f)=>{const{scope:C,children:g,...O}=I,b=v.useRef(null),N=zr(f,b),R=i(l,C);return v.useEffect(()=>(R.itemMap.set(b,{ref:b,...O}),()=>void R.itemMap.delete(b))),u.jsx(h,{[d]:"",ref:N,children:g})});m.displayName=l;function S(I){const f=i(e+"CollectionConsumer",I);return v.useCallback(()=>{const g=f.collectionRef.current;if(!g)return[];const O=Array.from(g.querySelectorAll(`[${d}]`));return Array.from(f.itemMap.values()).sort((R,E)=>O.indexOf(R.ref.current)-O.indexOf(E.ref.current))},[f.collectionRef,f.itemMap])}return[{Provider:a,Slot:p,ItemSlot:m},S,r]}var WE=U[" useId ".trim().toString()]||(()=>{}),zE=0;function Mv(e){const[t,n]=U.useState(WE());return wi(()=>{e||n(r=>r??String(zE++))},[e]),e||(t?`radix-${t}`:"")}function GE(e){const t=U.useRef(e);return U.useEffect(()=>{t.current=e}),U.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}var XE=U.createContext(void 0);function Jv(e){const t=U.useContext(XE);return e||t||"ltr"}var ha="rovingFocusGroup.onEntryFocus",QE={bubbles:!1,cancelable:!0},Di="RovingFocusGroup",[rs,kv,YE]=HE(Di),[ZE,qv]=jo(Di,[YE]),[eF,tF]=ZE(Di),Kv=U.forwardRef((e,t)=>u.jsx(rs.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx(rs.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(nF,{...e,ref:t})})}));Kv.displayName=Di;var nF=U.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:p,preventScrollOnEntryFocus:l=!1,...d}=e,h=U.useRef(null),m=zr(t,h),S=Jv(i),[I,f]=Zc({prop:a,defaultProp:s??null,onChange:c,caller:Di}),[C,g]=U.useState(!1),O=GE(p),b=kv(n),N=U.useRef(!1),[R,E]=U.useState(0);return U.useEffect(()=>{const x=h.current;if(x)return x.addEventListener(ha,O),()=>x.removeEventListener(ha,O)},[O]),u.jsx(eF,{scope:n,orientation:r,dir:S,loop:o,currentTabStopId:I,onItemFocus:U.useCallback(x=>f(x),[f]),onItemShiftTab:U.useCallback(()=>g(!0),[]),onFocusableItemAdd:U.useCallback(()=>E(x=>x+1),[]),onFocusableItemRemove:U.useCallback(()=>E(x=>x-1),[]),children:u.jsx(wn.div,{tabIndex:C||R===0?-1:0,"data-orientation":r,...d,ref:m,style:{outline:"none",...e.style},onMouseDown:Xt(e.onMouseDown,()=>{N.current=!0}),onFocus:Xt(e.onFocus,x=>{const _=!N.current;if(x.target===x.currentTarget&&_&&!C){const F=new CustomEvent(ha,QE);if(x.currentTarget.dispatchEvent(F),!F.defaultPrevented){const k=b().filter(ee=>ee.focusable),J=k.find(ee=>ee.active),q=k.find(ee=>ee.id===I),te=[J,q,...k].filter(Boolean).map(ee=>ee.ref.current);Bv(te,l)}}N.current=!1}),onBlur:Xt(e.onBlur,()=>g(!1))})})}),Uv="RovingFocusGroupItem",Lv=U.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:a,...s}=e,c=Mv(),p=i||c,l=tF(Uv,n),d=l.currentTabStopId===p,h=kv(n),{onFocusableItemAdd:m,onFocusableItemRemove:S,currentTabStopId:I}=l;return U.useEffect(()=>{if(r)return m(),()=>S()},[r,m,S]),u.jsx(rs.ItemSlot,{scope:n,id:p,focusable:r,active:o,children:u.jsx(wn.span,{tabIndex:d?0:-1,"data-orientation":l.orientation,...s,ref:t,onMouseDown:Xt(e.onMouseDown,f=>{r?l.onItemFocus(p):f.preventDefault()}),onFocus:Xt(e.onFocus,()=>l.onItemFocus(p)),onKeyDown:Xt(e.onKeyDown,f=>{if(f.key==="Tab"&&f.shiftKey){l.onItemShiftTab();return}if(f.target!==f.currentTarget)return;const C=oF(f,l.orientation,l.dir);if(C!==void 0){if(f.metaKey||f.ctrlKey||f.altKey||f.shiftKey)return;f.preventDefault();let O=h().filter(b=>b.focusable).map(b=>b.ref.current);if(C==="last")O.reverse();else if(C==="prev"||C==="next"){C==="prev"&&O.reverse();const b=O.indexOf(f.currentTarget);O=l.loop?aF(O,b+1):O.slice(b+1)}setTimeout(()=>Bv(O))}}),children:typeof a=="function"?a({isCurrentTabStop:d,hasTabStop:I!=null}):a})})});Lv.displayName=Uv;var rF={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function iF(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function oF(e,t,n){const r=iF(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return rF[r]}function Bv(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function aF(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var sF=Kv,cF=Lv,zo="Tabs",[uF,WF]=jo(zo,[qv]),Vv=qv(),[lF,ou]=uF(zo),$v=U.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:a="horizontal",dir:s,activationMode:c="automatic",...p}=e,l=Jv(s),[d,h]=Zc({prop:r,onChange:o,defaultProp:i??"",caller:zo});return u.jsx(lF,{scope:n,baseId:Mv(),value:d,onValueChange:h,orientation:a,dir:l,activationMode:c,children:u.jsx(wn.div,{dir:l,"data-orientation":a,...p,ref:t})})});$v.displayName=zo;var jv="TabsList",Hv=U.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=ou(jv,n),a=Vv(n);return u.jsx(sF,{asChild:!0,...a,orientation:i.orientation,dir:i.dir,loop:r,children:u.jsx(wn.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});Hv.displayName=jv;var Wv="TabsTrigger",zv=U.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,a=ou(Wv,n),s=Vv(n),c=Xv(a.baseId,r),p=Qv(a.baseId,r),l=r===a.value;return u.jsx(cF,{asChild:!0,...s,focusable:!o,active:l,children:u.jsx(wn.button,{type:"button",role:"tab","aria-selected":l,"aria-controls":p,"data-state":l?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...i,ref:t,onMouseDown:Xt(e.onMouseDown,d=>{!o&&d.button===0&&d.ctrlKey===!1?a.onValueChange(r):d.preventDefault()}),onKeyDown:Xt(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&a.onValueChange(r)}),onFocus:Xt(e.onFocus,()=>{const d=a.activationMode!=="manual";!l&&!o&&d&&a.onValueChange(r)})})})});zv.displayName=Wv;var Gv="TabsContent",dF=U.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...a}=e,s=ou(Gv,n),c=Xv(s.baseId,r),p=Qv(s.baseId,r),l=r===s.value,d=U.useRef(l);return U.useEffect(()=>{const h=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(h)},[]),u.jsx(eu,{present:o||l,children:({present:h})=>u.jsx(wn.div,{"data-state":l?"active":"inactive","data-orientation":s.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:p,tabIndex:0,...a,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:h&&i})})});dF.displayName=Gv;function Xv(e,t){return`${e}-trigger-${t}`}function Qv(e,t){return`${e}-content-${t}`}var pF=$v,fF=Hv,Yv=zv;const mF=u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[u.jsx("circle",{cx:"9",cy:"9",r:"9",fill:"#BBF7D0"}),u.jsx("path",{d:"M13 7L7.5 12L5 9.72727",stroke:"#16A34A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function hF(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?mF:u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:u.jsx("circle",{cx:"9",cy:"9",r:"5",fill:"#BFDBFE"})})}function gF(){return u.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u.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"}),u.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 yF="_tabsRoot_ktpr0_1",OF="_tabsList_ktpr0_6",vF="_tabTrigger_ktpr0_12",IF="_danger_ktpr0_29",Ro={tabsRoot:yF,tabsList:OF,tabTrigger:vF,danger:IF};function SF(){return u.jsxs(u.Fragment,{children:[u.jsx(Mo,{style:{margin:"1rem 0"}}),u.jsx(Yv,{value:ho,className:Ro.tabTrigger,children:u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[u.jsx(gF,{}),u.jsx("span",{children:"Manage"})]})})]})}function Zv({objectName:e,completed:t,pending:n,displayName:r}){return u.jsx(Yv,{value:e,className:Ro.tabTrigger,children:u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[hF(t,n),u.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[u.jsx("span",{children:r||e}),n&&u.jsx("span",{style:{fontSize:".8rem",fontStyle:"italic"},children:"pending"})]})]})})}function wF({completed:e,pending:t,displayName:n}){return u.jsxs(u.Fragment,{children:[u.jsx(Mo,{style:{margin:"1rem 0"}}),u.jsx(Zv,{objectName:fr,completed:e,pending:t,displayName:n},"other-write")]})}function bF({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:o}){var i,a;return u.jsx(pF,{value:e,className:Ro.tabsRoot,onValueChange:n,children:u.jsxs(fF,{className:Ro.tabsList,children:[t.map(s=>{var c,p,l,d,h,m;return u.jsx(Zv,{objectName:s.name,displayName:s.displayName,completed:s.completed,pending:((p=(c=r==null?void 0:r[s.name])==null?void 0:c.read)==null?void 0:p.isOptionalFieldsModified)||((d=(l=r==null?void 0:r[s.name])==null?void 0:l.read)==null?void 0:d.isRequiredMapFieldsModified)||((m=(h=r==null?void 0:r[s.name])==null?void 0:h.read)==null?void 0:m.isValueMappingsModified)||!1},s.name)}),o&&u.jsx(wF,{completed:o.completed,pending:((a=(i=r==null?void 0:r.other)==null?void 0:i.write)==null?void 0:a.isWriteModified)||!1,displayName:"Write"}),u.jsx(SF,{})]})})}function NF(e,t){return t===ho?{name:ho,completed:!1}:e.find(n=>n.name===t)}function CF({children:e}){var C;const{project:t}=Ee(),{installation:n}=at(),{providerName:r}=lt(),{hydratedRevision:o}=ei(),{objectConfigurationsState:i}=Qc(),[a,s]=v.useState(""),c=(t==null?void 0:t.appName)||"",p=n==null?void 0:n.config,l=o&&$y(p,o),d=l!==null,h=!!((C=o==null?void 0:o.content)!=null&&C.write),m=h?jy(p):void 0,S=v.useMemo(()=>{const g=[...l||[]];return m&&h&&g.push(m),g},[l,m,h]),I=NF(S,a),f=v.useCallback(()=>{const g=S.find(O=>I!==O&&!O.completed);g&&s(g.name)},[S,I]);return v.useEffect(()=>{!a&&S.length>0&&s(S[0].name)},[S,a,f]),u.jsx(sv.Provider,{value:f,children:u.jsx(ov.Provider,{value:I==null?void 0:I.name,children:u.jsxs(Yr,{style:{maxWidth:"55rem"},children:[u.jsxs(In,{style:{display:"flex",gap:"1rem",padding:"3rem",paddingBottom:"6rem",backgroundColor:"var(--amp-colors-bg-primary)"},children:[u.jsxs("div",{style:{width:"20rem"},children:[u.jsxs("h1",{style:{fontSize:"small",fontWeight:"400"},children:[r," integration"]}),u.jsx("h3",{style:{marginBottom:"20px",fontSize:"large",fontWeight:"500"},children:c}),d&&u.jsx(bF,{value:a,readNavObjects:l,onValueChange:g=>s(g),objectConfigurationsState:i,writeNavObject:m})]}),e]}),u.jsx(rO,{})]})})})}function TF({...e}){return u.jsx(CF,{...e})}const RF="_resetContainer_lkwv9_4",eI={resetContainer:RF};function xF({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:a,onUninstallSuccess:s,fieldMapping:c}){var f;const{projectIdOrName:p,isLoading:l}=Ee(),{isLoading:d}=vc(),{isError:h,errorState:m}=Jt(),{seed:S,reset:I}=Ly();return l||d?u.jsx(Zr,{}):h(de.PROJECT,p)?u.jsx(Gt,{message:`Error loading project ${p}`}):h(de.INTEGRATION_LIST,p)?u.jsx(Gt,{message:"Error retrieving integrations for the project, double check the API key"}):(f=m[de.INTEGRATION_LIST])!=null&&f.apiError?u.jsx(Gt,{message:"Something went wrong, couldn't find integration information"}):u.jsx("div",{className:eI.resetContainer,children:u.jsx(D0,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:a,onUninstallSuccess:s,fieldMapping:c,children:u.jsx(Uy,{children:u.jsx(Dv,{consumerRef:t,consumerName:n,groupRef:r,groupName:o,resetComponent:I,children:u.jsx(kT,{resetComponent:I,children:u.jsx(TE,{children:u.jsx(tA,{children:u.jsx(TF,{children:u.jsx(wE,{})})})})})})})},S)})}function AF(){return u.jsxs(Yr,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[u.jsx(gi,{}),u.jsx("p",{children:"Redirecting"})]})}function EF({redirectURL:e,children:t}){return v.useEffect(()=>{e&&window.location.replace(e)},[e]),e?u.jsx(AF,{}):t}function FF({resetComponent:e,onDisconnectSuccess:t,provider:n}){const[r,o]=v.useState(!1);return u.jsxs(u.Fragment,{children:[r===!1&&u.jsxs(u.Fragment,{children:[u.jsx(Rt,{string:"Manage connection"}),u.jsxs("div",{style:{padding:"1rem 0",width:"100%",display:"flex",flexDirection:"column",gap:"1rem"},children:[u.jsx("p",{children:"Click to reauthenticate or refresh your connection."}),u.jsx(Xe,{type:"button",onClick:()=>o(!0),variant:"ghost",style:{fontSize:"13px"},children:"Update connection"})]})]}),r===!0&&u.jsxs(u.Fragment,{children:[u.jsx(Cc,{provider:n}),u.jsx(Rt,{string:"Remove connection"}),u.jsx("p",{children:"Click to disconnect your connection from the provider."}),u.jsx(cO,{resetComponent:e,onDisconnectSuccess:t,buttonText:"Remove connection",buttonVariant:"danger",buttonStyle:{fontSize:"13px"}})]})]})}function _F({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=Ee(),{providerName:o}=lt(e),i=`You have successfully connected your ${o} account to ${r}.`;return u.jsx(iu,{text:i,children:u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"},children:u.jsx(FF,{resetComponent:n,onDisconnectSuccess:t,provider:e})})})}function PF({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,redirectUrl:i,onSuccess:a,onDisconnectSuccess:s,onConnectSuccess:c}){const{seed:p,reset:l}=Ly(),d=v.useCallback(h=>{a?a(h.id):c&&c(h)},[a,c]);return u.jsx("div",{className:eI.resetContainer,children:u.jsx(Uy,{groupRef:r,provider:e,children:u.jsx(Dv,{resetComponent:l,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onSuccess:d,onDisconnectSuccess:s,children:u.jsx(EF,{redirectURL:i,children:u.jsx(_F,{resetComponent:l,provider:e,onDisconnectSuccess:s})})})})},p)}const DF=(e,t)=>{const{data:n,isLoading:r,isError:o,error:i}=Sc(e,t),a=((n==null?void 0:n.length)||0)>0,s=!!n&&!r,c=n==null?void 0:n[0],p=c==null?void 0:c.config;return v.useEffect(()=>{o&&Be(i)},[o,i]),{isLoaded:s,isIntegrationInstalled:a,isLoading:r,config:p}};function Mi(){const{integrationNameOrId:e,groupRef:t}=Ir(),n=Sc(e,t),{isPending:r,isFetching:o,isError:i,isSuccess:a,error:s,data:c}=n;return{installation:c==null?void 0:c[0],isPending:r,isFetching:o,isError:i,isSuccess:a,error:s}}const au=()=>{const{groupRef:e,integrationNameOrId:t}=Ir(),{provider:n}=Qr(t),r=Ic({groupRef:e,provider:n}),{isPending:o,isFetching:i,isError:a,isSuccess:s,error:c,data:p}=r;return{connection:p==null?void 0:p[0],error:c,isPending:o,isFetching:i,isError:a,isSuccess:s}},tI=()=>{var h;const e=Ke(),t=ot(),{connection:n,isPending:r,isFetching:o}=au(),{projectIdOrName:i}=Ee(),{integrationNameOrId:a}=Ir(),{data:s}=Qr(a),c=n==null?void 0:n.id,p=s==null?void 0:s.id,l=(h=s==null?void 0:s.latestRevision)==null?void 0:h.id,d=r||o;return v.useEffect(()=>{c||e.invalidateQueries({queryKey:["amp","hydratedRevision"]})},[c,e]),Wn({queryKey:["amp","hydratedRevision",i,p,l,c],queryFn:async()=>{if(!i)throw new Error("projectIdOrName is required");if(!p)throw new Error("integrationId is required");if(!l)throw new Error("revisionId is required");if(!c)throw new Error("connectionId is required");return(await t()).revisionApi.getHydratedRevision({projectIdOrName:i,integrationId:p,revisionId:l,connectionId:c})},retry:3,enabled:!!i&&!!p&&!!l&&!!c&&!d})};function nI(){var p;const e=tI(),{isPending:t,isFetching:n,isError:r,isSuccess:o,error:i,data:a}=e,s=a==null?void 0:a.content,c=v.useMemo(()=>({getReadObject:l=>{var h,m;const d=(m=(h=s==null?void 0:s.read)==null?void 0:h.objects)==null?void 0:m.find(S=>S.objectName===l);return d?{object:d,getRequiredFields:()=>d.requiredFields??[],getOptionalFields:()=>d.optionalFields??[]}:(console.error(`Object ${l} not found`),{object:null,getRequiredFields:()=>null,getOptionalFields:()=>null})},getCustomerFieldsForObject:l=>{var h,m;const d=(m=(h=s==null?void 0:s.read)==null?void 0:h.objects)==null?void 0:m.find(S=>S.objectName===l);return d?d.allFields??[]:(console.error(`Object ${l} not found`),null)},getCustomerFieldsMetadataForObject:l=>{var h,m;const d=(m=(h=s==null?void 0:s.read)==null?void 0:h.objects)==null?void 0:m.find(S=>S.objectName===l);return d?{allFieldsMetaData:d.allFieldsMetadata??{},getField:S=>{var f;const I=(f=d.allFieldsMetadata)==null?void 0:f[S];return I||(console.error(`Field ${S} not found`),null)}}:(console.error(`Object ${l} not found`),{allFieldsMetaData:null,getField:()=>null})}}),[(p=s==null?void 0:s.read)==null?void 0:p.objects]);return{data:a,...c,isPending:t,isFetching:n,isError:r,isSuccess:o,error:i}}function MF(e){var I,f,C,g;const[t,n]=v.useState(e),[r]=v.useState(e),{getReadObject:o,data:i}=nI(),{installation:a}=Mi(),s=v.useCallback(()=>t,[t]),c=v.useCallback(()=>{n(r)},[r]),p=v.useCallback((O,b)=>{var J,q,$,te;b.provider=b.provider||((J=i==null?void 0:i.content)==null?void 0:J.provider)||"";const N=b.read||{},R=N.objects||{},E=R[O]||{},x=o(O),_=(q=x==null?void 0:x.object)==null?void 0:q.schedule,F=($=x==null?void 0:x.object)==null?void 0:$.destination,k={};return(te=x==null?void 0:x.getRequiredFields())==null||te.forEach(ee=>{"fieldName"in ee&&(k[ee.fieldName]=!0)}),E.objectName=E.objectName||O,E.schedule=E.schedule||_,E.destination=E.destination||F,E.selectedFields=E.selectedFields||k,R[O]=E,N.objects=R,b.read=N,{read:N,objects:R,obj:E}},[o,(I=i==null?void 0:i.content)==null?void 0:I.provider]),l=v.useCallback(O=>{var b,N;return{object:(N=(b=t.read)==null?void 0:b.objects)==null?void 0:N[O],getSelectedField:R=>{var E,x,_,F;return!!((F=(_=(x=(E=t.read)==null?void 0:E.objects)==null?void 0:x[O])==null?void 0:_.selectedFields)!=null&&F[R])},setSelectedField:({fieldName:R,selected:E})=>{n(x=>Dt(x,_=>{const{obj:F}=p(O,_);F.selectedFields=F.selectedFields||{},F.selectedFields[R]=E,F.selectedFields[R]===!1&&delete F.selectedFields[R]}))},getFieldMapping:R=>{var E,x,_,F;return(F=(_=(x=(E=t.read)==null?void 0:E.objects)==null?void 0:x[O])==null?void 0:_.selectedFieldMappings)==null?void 0:F[R]},setFieldMapping:({fieldName:R,mapToName:E})=>{n(x=>Dt(x,_=>{const{obj:F}=p(O,_);F.selectedFieldMappings=F.selectedFieldMappings||{},F.selectedFieldMappings[E]=R}))}}},[(f=t.read)==null?void 0:f.objects,p]),d=v.useCallback(O=>{var x,_;const b=(_=(x=t.write)==null?void 0:x.objects)==null?void 0:_[O],N=F=>{const k=F.write||{},J=k.objects||{},q=J[O]||{objectName:O};return J[O]=q,k.objects=J,F.write=k,{write:k,objects:J,obj:q}},R=(F,k)=>{var J,q;return(q=(J=b==null?void 0:b.selectedFieldSettings)==null?void 0:J[F])==null?void 0:q[k]},E=(F,k,J)=>{n(q=>Dt(q,$=>{var ee;const{obj:te}=N($);te.selectedFieldSettings={...te.selectedFieldSettings,[F]:{...(ee=te.selectedFieldSettings)==null?void 0:ee[F],[k]:J}}}))};return{object:b,setEnableWrite:()=>{n(F=>Dt(F,k=>{const{obj:J}=N(k);J.objectName=O}))},setDisableWrite:()=>{n(F=>Dt(F,k=>{const{objects:J}=N(k);delete J[O]}))},getWriteObject:()=>{var F,k;return(k=(F=t.write)==null?void 0:F.objects)==null?void 0:k[O]},getSelectedFieldSettings:F=>{var k;return(k=b==null?void 0:b.selectedFieldSettings)==null?void 0:k[F]},setSelectedFieldSettings:({fieldName:F,settings:k})=>{n(J=>Dt(J,q=>{const{obj:$}=N(q),te=$.selectedFieldSettings||{};$.selectedFieldSettings={...te,[F]:k},k===void 0&&delete $.selectedFieldSettings[F]}))},getDefaultValues:F=>R(F,"_default"),setDefaultValues:({fieldName:F,value:k})=>E(F,"_default",k),getWriteOnCreateSetting:F=>R(F,"writeOnCreate"),setWriteOnCreateSetting:({fieldName:F,value:k})=>E(F,"writeOnCreate",k),getWriteOnUpdateSetting:F=>R(F,"writeOnUpdate"),setWriteOnUpdateSetting:({fieldName:F,value:k})=>E(F,"writeOnUpdate",k)}},[(C=t.write)==null?void 0:C.objects]),[h,m]=v.useState(!1),S=v.useCallback(()=>{m(!0),n(O=>Dt(O,b=>{var N;Object.assign(b,(N=a==null?void 0:a.config)==null?void 0:N.content)})),m(!1)},[(g=a==null?void 0:a.config)==null?void 0:g.content]);return v.useEffect(()=>{console.debug("Installation found",{installation:a}),S()},[a,S]),{draft:t,get:s,syncInstallationConfig:S,isSyncing:h,setDraft:n,reset:c,readObject:l,writeObject:d}}const rI=v.createContext(null);function JF({children:e,initialConfig:t}){const n=MF(t);return u.jsx(rI.Provider,{value:n,children:e})}function kF(){const e=v.useContext(rI);if(!e)throw new Error("useConfigContext must be used within a ConfigProvider / InstallationProvider");return e}const iI=v.createContext({integrationNameOrId:"",consumerRef:"",consumerName:void 0,groupRef:"",groupName:void 0});function Ir(){const e=v.useContext(iI);if(!e)throw new Error("useInstallationProps must be used within an InstallationProvider");return e}function qF({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i}){const a=v.useMemo(()=>({integrationNameOrId:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i}),[t,n,r,o,i]);return u.jsx(iI.Provider,{value:a,children:u.jsx(JF,{initialConfig:{},children:e})})}function KF(){const{projectIdOrName:e}=Ee(),{groupRef:t,integrationNameOrId:n}=Ir(),{data:r}=Qr(n),{connection:o}=au(),{installation:i}=Mi(),a=Ke(),{mutate:s,isIdle:c,isPending:p,error:l,errorMsg:d}=Pv();return{createInstallation:({config:m,onSuccess:S,onError:I,onSettled:f})=>{if(i)throw Error("Installation already created. Try updating instead.");if(!r)throw Error("No integration found");const C={projectIdOrName:e,integrationId:r==null?void 0:r.id,installation:{groupRef:t,connectionId:o==null?void 0:o.id,config:{content:{...m}}}};return s(C,{onSuccess:g=>{S==null||S(g)},onError:g=>{I==null||I(g)},onSettled:()=>{f==null||f(),a.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:c,isPending:p,error:l,errorMsg:d}}const UF=()=>{const e=ot(),t=Ke(),[n,r]=v.useState(null);return{...vn({mutationKey:["updateInstallation"],mutationFn:async i=>(await e()).installationApi.updateInstallation(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:i=>{console.error("Error updating installation"),Be(i,r)}}),errorMsg:n}};function LF(){const{projectIdOrName:e}=Ee(),{integrationNameOrId:t}=Ir(),{data:n}=Qr(t),{installation:r}=Mi(),o=Ke(),{mutate:i,isIdle:a,isPending:s,error:c,errorMsg:p}=UF();return{updateInstallation:({config:d,onSuccess:h,onError:m,onSettled:S})=>{var C,g;if(!r)throw Error("Installation not created yet. Try creating the installation first.");if(!n)throw Error("No integration found");const I=[];if((C=d==null?void 0:d.write)!=null&&C.objects&&Object.keys(d.write.objects).length>0&&I.push("config.content.write.objects"),(g=d==null?void 0:d.read)!=null&&g.objects){const O=Object.keys(d.read.objects);I.push(...O.map(b=>`config.content.read.objects.${b}`))}const f={projectIdOrName:e,integrationId:n==null?void 0:n.id,installationId:r.id,installationUpdate:{updateMask:I,installation:{config:{content:d}}}};return i(f,{onSuccess:O=>{h==null||h(O)},onError:O=>{m==null||m(O)},onSettled:()=>{S==null||S(),o.invalidateQueries({queryKey:["amp","installations"]})}})},isIdle:a,isPending:s,error:c,errorMsg:p}}const BF=()=>{const e=ot(),t=Ke(),[n,r]=v.useState(null);return{...vn({mutationKey:["deleteInstallation"],mutationFn:async i=>(await e()).installationApi.deleteInstallation(i),onSuccess:()=>{t.invalidateQueries({queryKey:["amp","installations"]}),r(null)},onError:i=>{console.error("Error deleting installation"),Be(i,r)}}),errorMsg:n}};function VF(){const{projectIdOrName:e}=Ee(),{integrationNameOrId:t}=Ir(),{data:n}=Qr(t),{installation:r}=Mi(),o=Ke(),{mutate:i,isIdle:a,isPending:s,error:c,errorMsg:p}=BF();return{deleteInstallation:({onSuccess:d,onError:h,onSettled:m})=>{if(!r)throw Error("Installation not found. Not able to delete installation.");if(!n)throw Error("No integration found");return i({projectIdOrName:e,integrationId:n==null?void 0:n.id,installationId:r.id},{onSuccess:()=>{d==null||d()},onError:S=>{h==null||h(S)},onSettled:()=>{m==null||m(),o.invalidateQueries({queryKey:["amp","installations"]}),o.invalidateQueries({queryKey:["amp","connections"]})}})},isIdle:a,isPending:s,error:c,errorMsg:p}}exports.APIKeyApi=GC;exports.AcceptInviteRequestFromJSON=SS;exports.AcceptInviteRequestFromJSONTyped=Ql;exports.AcceptInviteRequestToJSON=Yl;exports.AmpersandContext=Dy;exports.AmpersandProvider=h0;exports.ApiKeyAsBasicOptsFieldUsedEnum=NS;exports.ApiKeyAsBasicOptsFromJSON=ed;exports.ApiKeyAsBasicOptsFromJSONTyped=td;exports.ApiKeyAsBasicOptsToJSON=nd;exports.ApiKeyFromJSON=si;exports.ApiKeyFromJSONTyped=Zl;exports.ApiKeyOptsAttachmentTypeEnum=xS;exports.ApiKeyOptsFromJSON=ud;exports.ApiKeyOptsFromJSONTyped=ld;exports.ApiKeyOptsHeaderFromJSON=rd;exports.ApiKeyOptsHeaderFromJSONTyped=id;exports.ApiKeyOptsHeaderToJSON=od;exports.ApiKeyOptsQueryFromJSON=ad;exports.ApiKeyOptsQueryFromJSONTyped=sd;exports.ApiKeyOptsQueryToJSON=cd;exports.ApiKeyOptsToJSON=dd;exports.ApiKeyRequestFromJSON=FS;exports.ApiKeyRequestFromJSONTyped=pd;exports.ApiKeyRequestToJSON=fd;exports.ApiKeyToJSON=bS;exports.ApiProblemFromJSON=PS;exports.ApiProblemFromJSONTyped=md;exports.ApiProblemToJSON=DS;exports.AssociationChangeEventEnabledEnum=MS;exports.AssociationChangeEventFromJSON=hd;exports.AssociationChangeEventFromJSONTyped=gd;exports.AssociationChangeEventToJSON=yd;exports.AuthHealthCheckFromJSON=Od;exports.AuthHealthCheckFromJSONTyped=vd;exports.AuthHealthCheckToJSON=Id;exports.AuthType=Fa;exports.AuthTypeFromJSON=Sd;exports.AuthTypeFromJSONTyped=wd;exports.AuthTypeToJSON=qS;exports.BASE_PATH=Wl;exports.BackfillConfigFromJSON=ds;exports.BackfillConfigFromJSONTyped=Ed;exports.BackfillConfigToJSON=ps;exports.BackfillFromJSON=us;exports.BackfillFromJSONTyped=Td;exports.BackfillToJSON=ls;exports.BaseAPI=Le;exports.BaseConfigContentFromJSON=sw;exports.BaseConfigContentFromJSONTyped=Yd;exports.BaseConfigContentToJSON=cw;exports.BaseProxyConfigFromJSON=Eo;exports.BaseProxyConfigFromJSONTyped=Fd;exports.BaseProxyConfigToJSON=Fo;exports.BaseReadConfigFromJSON=ms;exports.BaseReadConfigFromJSONTyped=Jd;exports.BaseReadConfigObjectFromJSON=Pd;exports.BaseReadConfigObjectFromJSONTyped=Dd;exports.BaseReadConfigObjectToJSON=Md;exports.BaseReadConfigToJSON=hs;exports.BaseSubscribeConfigFromJSON=Ow;exports.BaseSubscribeConfigFromJSONTyped=op;exports.BaseSubscribeConfigObjectFromJSON=np;exports.BaseSubscribeConfigObjectFromJSONTyped=rp;exports.BaseSubscribeConfigObjectToJSON=ip;exports.BaseSubscribeConfigToJSON=vw;exports.BaseWriteConfigFromJSON=bs;exports.BaseWriteConfigFromJSONTyped=Qd;exports.BaseWriteConfigObjectFromJSON=zd;exports.BaseWriteConfigObjectFromJSONTyped=Gd;exports.BaseWriteConfigObjectToJSON=Xd;exports.BaseWriteConfigToJSON=Ns;exports.BasicAuthOptsFromJSON=ap;exports.BasicAuthOptsFromJSONTyped=sp;exports.BasicAuthOptsToJSON=cp;exports.BatchUpsertIntegrationsRequestFromJSON=ww;exports.BatchUpsertIntegrationsRequestFromJSONTyped=up;exports.BatchUpsertIntegrationsRequestToJSON=lp;exports.BillingAccountApi=XC;exports.BillingAccountFromJSON=dp;exports.BillingAccountFromJSONTyped=pp;exports.BillingAccountToJSON=Nw;exports.BlobApiResponse=vS;exports.BuilderFromJSON=Fs;exports.BuilderFromJSONTyped=fp;exports.BuilderInfoFromJSON=_a;exports.BuilderInfoFromJSONTyped=Fp;exports.BuilderInfoOrgRoleFromJSON=yp;exports.BuilderInfoOrgRoleFromJSONTyped=Op;exports.BuilderInfoOrgRolePrincipalTypeEnum=Rw;exports.BuilderInfoOrgRoleToJSON=vp;exports.BuilderInfoProjectRolesValueFromJSON=xp;exports.BuilderInfoProjectRolesValueFromJSONTyped=Ap;exports.BuilderInfoProjectRolesValuePrincipalTypeEnum=_w;exports.BuilderInfoProjectRolesValueToJSON=Ep;exports.BuilderInfoToJSON=Mw;exports.BuilderToJSON=mp;exports.BulkWriteSupportFromJSON=_p;exports.BulkWriteSupportFromJSONTyped=Pp;exports.BulkWriteSupportToJSON=Dp;exports.COLLECTION_FORMATS=yS;exports.ConfigContentAllOfFromJSON=Hw;exports.ConfigContentAllOfFromJSONTyped=jp;exports.ConfigContentAllOfToJSON=Ww;exports.ConfigContentFromJSON=$s;exports.ConfigContentFromJSONTyped=Lp;exports.ConfigContentToJSON=js;exports.ConfigCreateEventEnabledEnum=uw;exports.ConfigCreateEventFromJSON=Cs;exports.ConfigCreateEventFromJSONTyped=Zd;exports.ConfigCreateEventToJSON=Ts;exports.ConfigDeleteEventEnabledEnum=dw;exports.ConfigDeleteEventFromJSON=Rs;exports.ConfigDeleteEventFromJSONTyped=ep;exports.ConfigDeleteEventToJSON=xs;exports.ConfigFromJSON=Bp;exports.ConfigFromJSONTyped=Vp;exports.ConfigToJSON=$p;exports.ConfigUpdateEventEnabledEnum=fw;exports.ConfigUpdateEventFromJSON=As;exports.ConfigUpdateEventFromJSONTyped=tp;exports.ConfigUpdateEventToJSON=Es;exports.ConfigUpdateEventWatchFieldsAutoEnum=mw;exports.Configuration=Ao;exports.ConnectProvider=PF;exports.ConnectionApi=Oy;exports.ConnectionAuthSchemeEnum=nb;exports.ConnectionFromJSON=Nr;exports.ConnectionFromJSONTyped=uf;exports.ConnectionRequestBasicAuthFromJSON=zs;exports.ConnectionRequestBasicAuthFromJSONTyped=df;exports.ConnectionRequestBasicAuthToJSON=Gs;exports.ConnectionRequestFromJSON=Sf;exports.ConnectionRequestFromJSONTyped=wf;exports.ConnectionRequestOauth2ClientCredentialsFromJSON=Xs;exports.ConnectionRequestOauth2ClientCredentialsFromJSONTyped=pf;exports.ConnectionRequestOauth2ClientCredentialsToJSON=Qs;exports.ConnectionRequestOauth2PasswordCredentialsFromJSON=Ys;exports.ConnectionRequestOauth2PasswordCredentialsFromJSONTyped=ff;exports.ConnectionRequestOauth2PasswordCredentialsToJSON=Zs;exports.ConnectionRequestToJSON=bf;exports.ConnectionStatusEnum=rb;exports.ConnectionToJSON=lf;exports.ConsumerApi=YC;exports.ConsumerFromJSON=Hp;exports.ConsumerFromJSONTyped=Wp;exports.ConsumerToJSON=zp;exports.CreateBillingAccountSession200ResponseFromJSON=Nf;exports.CreateBillingAccountSession200ResponseFromJSONTyped=Cf;exports.CreateBillingAccountSession200ResponseToJSON=fb;exports.CreateBillingAccountSessionRequestFromJSON=hb;exports.CreateBillingAccountSessionRequestFromJSONTyped=Tf;exports.CreateBillingAccountSessionRequestToJSON=Rf;exports.CreateConsumerRequestFromJSON=yb;exports.CreateConsumerRequestFromJSONTyped=xf;exports.CreateConsumerRequestToJSON=Af;exports.CreateDestinationRequestFromJSON=Ib;exports.CreateDestinationRequestFromJSONTyped=Pf;exports.CreateDestinationRequestMetadataFromJSON=Ef;exports.CreateDestinationRequestMetadataFromJSONTyped=Ff;exports.CreateDestinationRequestMetadataToJSON=_f;exports.CreateDestinationRequestToJSON=Df;exports.CreateEventEnabledEnum=Sb;exports.CreateEventFromJSON=Mf;exports.CreateEventFromJSONTyped=Jf;exports.CreateEventToJSON=kf;exports.CreateGroupRequestFromJSON=Nb;exports.CreateGroupRequestFromJSONTyped=qf;exports.CreateGroupRequestToJSON=Kf;exports.CreateInstallationRequestConfigFromJSON=Uf;exports.CreateInstallationRequestConfigFromJSONTyped=Lf;exports.CreateInstallationRequestConfigToJSON=Bf;exports.CreateInstallationRequestFromJSON=Rb;exports.CreateInstallationRequestFromJSONTyped=Vf;exports.CreateInstallationRequestToJSON=$f;exports.CreateIntegrationRequestFromJSON=Xb;exports.CreateIntegrationRequestFromJSONTyped=Em;exports.CreateIntegrationRequestLatestRevisionFromJSON=Rm;exports.CreateIntegrationRequestLatestRevisionFromJSONTyped=xm;exports.CreateIntegrationRequestLatestRevisionToJSON=Am;exports.CreateIntegrationRequestToJSON=Fm;exports.CreateOrgInviteRequestFromJSON=Yb;exports.CreateOrgInviteRequestFromJSONTyped=_m;exports.CreateOrgInviteRequestToJSON=Pm;exports.CreateOrgRequestFromJSON=eN;exports.CreateOrgRequestFromJSONTyped=Dm;exports.CreateOrgRequestToJSON=Mm;exports.CreateProjectRequestFromJSON=nN;exports.CreateProjectRequestFromJSONTyped=Jm;exports.CreateProjectRequestToJSON=km;exports.CreateProviderAppRequestFromJSON=iN;exports.CreateProviderAppRequestFromJSONTyped=qm;exports.CreateProviderAppRequestToJSON=Km;exports.CreateRevisionRequestFromJSON=aN;exports.CreateRevisionRequestFromJSONTyped=Um;exports.CreateRevisionRequestToJSON=Lm;exports.DefaultConfig=zl;exports.DefaultPeriodConfigFromJSON=Rd;exports.DefaultPeriodConfigFromJSONTyped=xd;exports.DefaultPeriodConfigToJSON=Ad;exports.DefaultPeriodFromJSON=bd;exports.DefaultPeriodFromJSONTyped=Nd;exports.DefaultPeriodToJSON=Cd;exports.DeleteEventEnabledEnum=kb;exports.DeleteEventFromJSON=sm;exports.DeleteEventFromJSONTyped=cm;exports.DeleteEventToJSON=um;exports.DeliveryFromJSON=zf;exports.DeliveryFromJSONTyped=Gf;exports.DeliveryModeEnum=Ab;exports.DeliveryToJSON=Xf;exports.DestinationApi=ZC;exports.DestinationFromJSON=ci;exports.DestinationFromJSONTyped=Vm;exports.DestinationToJSON=uN;exports.FetchError=Gl;exports.FieldMetadataFromJSON=pc;exports.FieldMetadataFromJSONTyped=Wm;exports.FieldMetadataToJSON=fc;exports.FieldMetadataValueTypeEnum=dN;exports.FieldSettingDefaultFromJSON=kd;exports.FieldSettingDefaultFromJSONTyped=qd;exports.FieldSettingDefaultToJSON=Kd;exports.FieldSettingFromJSON=gs;exports.FieldSettingFromJSONTyped=Ud;exports.FieldSettingToJSON=ys;exports.FieldSettingWriteOnCreateEnum=GS;exports.FieldSettingWriteOnUpdateEnum=XS;exports.FieldValueFromJSON=$m;exports.FieldValueFromJSONTyped=jm;exports.FieldValueToJSON=Hm;exports.GenerateConnectionRequestFromJSON=mN;exports.GenerateConnectionRequestFromJSONTyped=zm;exports.GenerateConnectionRequestToJSON=Gm;exports.GetConnectionRefreshEnum=QC;exports.GroupApi=e0;exports.GroupFromJSON=Hs;exports.GroupFromJSONTyped=Gp;exports.GroupToJSON=Ws;exports.HydratedIntegrationFieldExistentFromJSON=gN;exports.HydratedIntegrationFieldExistentFromJSONTyped=mc;exports.HydratedIntegrationFieldExistentToJSON=eh;exports.HydratedIntegrationFieldFromJSON=ro;exports.HydratedIntegrationFieldFromJSONTyped=th;exports.HydratedIntegrationFieldToJSON=io;exports.HydratedIntegrationFromJSON=mh;exports.HydratedIntegrationFromJSONTyped=hh;exports.HydratedIntegrationObjectFromJSON=nh;exports.HydratedIntegrationObjectFromJSONTyped=rh;exports.HydratedIntegrationObjectToJSON=ih;exports.HydratedIntegrationProxyFromJSON=Xm;exports.HydratedIntegrationProxyFromJSONTyped=Qm;exports.HydratedIntegrationProxyToJSON=Ym;exports.HydratedIntegrationReadFromJSON=oh;exports.HydratedIntegrationReadFromJSONTyped=ah;exports.HydratedIntegrationReadToJSON=sh;exports.HydratedIntegrationToJSON=gh;exports.HydratedIntegrationWriteFromJSON=dh;exports.HydratedIntegrationWriteFromJSONTyped=ph;exports.HydratedIntegrationWriteObjectFromJSON=ch;exports.HydratedIntegrationWriteObjectFromJSONTyped=uh;exports.HydratedIntegrationWriteObjectToJSON=lh;exports.HydratedIntegrationWriteToJSON=fh;exports.HydratedRevisionFromJSON=yh;exports.HydratedRevisionFromJSONTyped=Oh;exports.HydratedRevisionToJSON=bN;exports.InputValidationIssueFromJSON=vh;exports.InputValidationIssueFromJSONTyped=Ih;exports.InputValidationIssueInEnum=NN;exports.InputValidationIssueToJSON=Sh;exports.InputValidationProblemFromJSON=RN;exports.InputValidationProblemFromJSONTyped=wh;exports.InputValidationProblemToJSON=xN;exports.InstallIntegration=xF;exports.InstallationApi=vy;exports.InstallationFromJSON=ui;exports.InstallationFromJSONTyped=bh;exports.InstallationProvider=qF;exports.InstallationToJSON=EN;exports.Integration1FromJSON=cc;exports.Integration1FromJSONTyped=Tm;exports.Integration1ToJSON=uc;exports.IntegrationApi=Iy;exports.IntegrationFieldExistentFromJSON=Fb;exports.IntegrationFieldExistentFromJSONTyped=nc;exports.IntegrationFieldExistentToJSON=Yf;exports.IntegrationFieldFromJSON=Pa;exports.IntegrationFieldFromJSONTyped=Zf;exports.IntegrationFieldMappingFromJSON=_b;exports.IntegrationFieldMappingFromJSONTyped=_o;exports.IntegrationFieldMappingToJSON=ic;exports.IntegrationFieldToJSON=Da;exports.IntegrationFromJSON=Ma;exports.IntegrationFromJSONTyped=Rh;exports.IntegrationObjectFromJSON=tm;exports.IntegrationObjectFromJSONTyped=nm;exports.IntegrationObjectToJSON=rm;exports.IntegrationProxyFromJSON=jf;exports.IntegrationProxyFromJSONTyped=Hf;exports.IntegrationProxyToJSON=Wf;exports.IntegrationReadFromJSON=im;exports.IntegrationReadFromJSONTyped=om;exports.IntegrationReadToJSON=am;exports.IntegrationSubscribeFromJSON=gm;exports.IntegrationSubscribeFromJSONTyped=ym;exports.IntegrationSubscribeObjectFromJSON=fm;exports.IntegrationSubscribeObjectFromJSONTyped=mm;exports.IntegrationSubscribeObjectToJSON=hm;exports.IntegrationSubscribeToJSON=Om;exports.IntegrationToJSON=PN;exports.IntegrationWriteFromJSON=bm;exports.IntegrationWriteFromJSONTyped=Nm;exports.IntegrationWriteObjectFromJSON=Im;exports.IntegrationWriteObjectFromJSONTyped=Sm;exports.IntegrationWriteObjectToJSON=wm;exports.IntegrationWriteToJSON=Cm;exports.InviteFromJSON=oo;exports.InviteFromJSONTyped=xh;exports.InviteParentTypeEnum=DN;exports.InviteStatusEnum=MN;exports.InviteToJSON=kN;exports.JSONApiResponse=ue;exports.ListOperations200ResponseFromJSON=Dh;exports.ListOperations200ResponseFromJSONTyped=Mh;exports.ListOperations200ResponseToJSON=LN;exports.LogFromJSON=Kh;exports.LogFromJSONTyped=Uh;exports.LogMessageFromJSON=Jh;exports.LogMessageFromJSONTyped=kh;exports.LogMessageToJSON=qh;exports.LogToJSON=$N;exports.MediaFromJSON=Wh;exports.MediaFromJSONTyped=zh;exports.MediaToJSON=Gh;exports.MediaTypeDarkModeFromJSON=Lh;exports.MediaTypeDarkModeFromJSONTyped=Bh;exports.MediaTypeDarkModeToJSON=Vh;exports.MediaTypeRegularFromJSON=$h;exports.MediaTypeRegularFromJSONTyped=jh;exports.MediaTypeRegularToJSON=Hh;exports.MetadataItemInputFromJSON=Xh;exports.MetadataItemInputFromJSONTyped=Qh;exports.MetadataItemInputToJSON=Yh;exports.MetadataItemPostAuthenticationFromJSON=Zh;exports.MetadataItemPostAuthenticationFromJSONTyped=eg;exports.MetadataItemPostAuthenticationToJSON=tg;exports.ModuleInfoFromJSON=ag;exports.ModuleInfoFromJSONTyped=sg;exports.ModuleInfoToJSON=cg;exports.OAuthApi=Sy;exports.Oauth2AuthorizationCodeAccessTokenFromJSON=mf;exports.Oauth2AuthorizationCodeAccessTokenFromJSONTyped=hf;exports.Oauth2AuthorizationCodeAccessTokenToJSON=gf;exports.Oauth2AuthorizationCodeFromJSON=ec;exports.Oauth2AuthorizationCodeFromJSONTyped=If;exports.Oauth2AuthorizationCodeRefreshTokenFromJSON=yf;exports.Oauth2AuthorizationCodeRefreshTokenFromJSONTyped=Of;exports.Oauth2AuthorizationCodeRefreshTokenToJSON=vf;exports.Oauth2AuthorizationCodeToJSON=tc;exports.Oauth2AuthorizationCodeTokensOnlyAccessTokenFromJSON=Xp;exports.Oauth2AuthorizationCodeTokensOnlyAccessTokenFromJSONTyped=Qp;exports.Oauth2AuthorizationCodeTokensOnlyAccessTokenToJSON=Yp;exports.Oauth2AuthorizationCodeTokensOnlyFromJSON=nf;exports.Oauth2AuthorizationCodeTokensOnlyFromJSONTyped=rf;exports.Oauth2AuthorizationCodeTokensOnlyRefreshTokenFromJSON=Zp;exports.Oauth2AuthorizationCodeTokensOnlyRefreshTokenFromJSONTyped=ef;exports.Oauth2AuthorizationCodeTokensOnlyRefreshTokenToJSON=tf;exports.Oauth2AuthorizationCodeTokensOnlyToJSON=of;exports.Oauth2OptsFromJSON=hg;exports.Oauth2OptsFromJSONTyped=gg;exports.Oauth2OptsGrantTypeEnum=ao;exports.Oauth2OptsToJSON=yg;exports.OauthConnectRequestFromJSON=rC;exports.OauthConnectRequestFromJSONTyped=Og;exports.OauthConnectRequestToJSON=vg;exports.ObjectMetadataFromJSON=Ja;exports.ObjectMetadataFromJSONTyped=Ig;exports.ObjectMetadataToJSON=oC;exports.ObjectsFieldsApi=t0;exports.OperationApi=n0;exports.OperationFromJSON=hc;exports.OperationFromJSONTyped=Ah;exports.OperationToJSON=Eh;exports.OptionalFieldsAutoOption=Pb;exports.OptionalFieldsAutoOptionFromJSON=oc;exports.OptionalFieldsAutoOptionFromJSONTyped=em;exports.OptionalFieldsAutoOptionToJSON=Db;exports.OrgApi=r0;exports.OrgFromJSON=li;exports.OrgFromJSONTyped=hp;exports.OrgToJSON=gp;exports.PaginationInfoFromJSON=Fh;exports.PaginationInfoFromJSONTyped=_h;exports.PaginationInfoToJSON=Ph;exports.PatchApiKeyRequestApiKeyFromJSON=Sg;exports.PatchApiKeyRequestApiKeyFromJSONTyped=wg;exports.PatchApiKeyRequestApiKeyToJSON=bg;exports.PatchApiKeyRequestFromJSON=cC;exports.PatchApiKeyRequestFromJSONTyped=Ng;exports.PatchApiKeyRequestToJSON=Cg;exports.ProblemFromJSON=lC;exports.ProblemFromJSONTyped=Tg;exports.ProblemToJSON=dC;exports.ProjectApi=wy;exports.ProjectEntitlementsBrandingRemovalFromJSON=Ip;exports.ProjectEntitlementsBrandingRemovalFromJSONTyped=Sp;exports.ProjectEntitlementsBrandingRemovalToJSON=wp;exports.ProjectEntitlementsFromJSON=bp;exports.ProjectEntitlementsFromJSONTyped=Np;exports.ProjectEntitlementsToJSON=Cp;exports.ProjectFromJSON=br;exports.ProjectFromJSONTyped=Tp;exports.ProjectToJSON=Rp;exports.ProviderApi=by;exports.ProviderAppApi=Ny;exports.ProviderAppFromJSON=di;exports.ProviderAppFromJSONTyped=af;exports.ProviderAppToJSON=sf;exports.ProviderInfoFromJSON=ka;exports.ProviderInfoFromJSONTyped=Pg;exports.ProviderInfoToJSON=OC;exports.ProviderMetadata1FromJSON=Rg;exports.ProviderMetadata1FromJSONTyped=xg;exports.ProviderMetadata1ToJSON=Ag;exports.ProviderMetadataInfoFromJSON=Ri;exports.ProviderMetadataInfoFromJSONTyped=cf;exports.ProviderMetadataInfoSourceEnum=eb;exports.ProviderMetadataInfoToJSON=xi;exports.ReadConfigAllOfFromJSON=IC;exports.ReadConfigAllOfFromJSONTyped=Dg;exports.ReadConfigAllOfToJSON=SC;exports.ReadConfigFromJSON=Ds;exports.ReadConfigFromJSONTyped=Jp;exports.ReadConfigObjectFromJSON=_s;exports.ReadConfigObjectFromJSONTyped=Mp;exports.ReadConfigObjectToJSON=Ps;exports.ReadConfigToJSON=Ms;exports.RequiredError=P;exports.ResponseError=ss;exports.RevisionApi=Cy;exports.RevisionFromJSON=Nh;exports.RevisionFromJSONTyped=Ch;exports.RevisionToJSON=Th;exports.SelectedFieldsAutoConfig=$S;exports.SelectedFieldsAutoConfigFromJSON=fs;exports.SelectedFieldsAutoConfigFromJSONTyped=_d;exports.SelectedFieldsAutoConfigToJSON=jS;exports.SignedUrlFromJSON=Mg;exports.SignedUrlFromJSONTyped=Jg;exports.SignedUrlToJSON=bC;exports.SubscribeConfigAllOfFromJSON=CC;exports.SubscribeConfigAllOfFromJSONTyped=kg;exports.SubscribeConfigAllOfToJSON=TC;exports.SubscribeConfigFromJSON=qs;exports.SubscribeConfigFromJSONTyped=qp;exports.SubscribeConfigObjectFromJSON=Js;exports.SubscribeConfigObjectFromJSONTyped=kp;exports.SubscribeConfigObjectToJSON=ks;exports.SubscribeConfigToJSON=Ks;exports.SubscribeOptsFromJSON=Eg;exports.SubscribeOptsFromJSONTyped=Fg;exports.SubscribeOptsRegistrationTimingEnum=hC;exports.SubscribeOptsSubscriptionScopeEnum=fC;exports.SubscribeOptsTargetURLScopeEnum=mC;exports.SubscribeOptsToJSON=_g;exports.SubscribeSupportFromJSON=ng;exports.SubscribeSupportFromJSONTyped=rg;exports.SubscribeSupportToJSON=ig;exports.SupportFromJSON=gc;exports.SupportFromJSONTyped=og;exports.SupportToJSON=yc;exports.TextApiResponse=Ea;exports.TokenMetadataFieldsFromJSON=pg;exports.TokenMetadataFieldsFromJSONTyped=fg;exports.TokenMetadataFieldsOtherFieldsInnerFromJSON=ug;exports.TokenMetadataFieldsOtherFieldsInnerFromJSONTyped=lg;exports.TokenMetadataFieldsOtherFieldsInnerToJSON=dg;exports.TokenMetadataFieldsToJSON=mg;exports.UpdateConnectionRequestFromJSON=xC;exports.UpdateConnectionRequestFromJSONTyped=qg;exports.UpdateConnectionRequestToJSON=Kg;exports.UpdateDestinationRequestDestinationFromJSON=Ug;exports.UpdateDestinationRequestDestinationFromJSONTyped=Lg;exports.UpdateDestinationRequestDestinationMetadataFromJSON=lc;exports.UpdateDestinationRequestDestinationMetadataFromJSONTyped=Bm;exports.UpdateDestinationRequestDestinationMetadataToJSON=dc;exports.UpdateDestinationRequestDestinationToJSON=Bg;exports.UpdateDestinationRequestFromJSON=FC;exports.UpdateDestinationRequestFromJSONTyped=Vg;exports.UpdateDestinationRequestToJSON=$g;exports.UpdateEventEnabledEnum=Kb;exports.UpdateEventFromJSON=lm;exports.UpdateEventFromJSONTyped=dm;exports.UpdateEventToJSON=pm;exports.UpdateEventWatchFieldsAutoEnum=Ub;exports.UpdateInstallationConfigContentFromJSON=jg;exports.UpdateInstallationConfigContentFromJSONTyped=Hg;exports.UpdateInstallationConfigContentToJSON=Wg;exports.UpdateInstallationRequestFromJSON=JC;exports.UpdateInstallationRequestFromJSONTyped=ey;exports.UpdateInstallationRequestInstallationConfigFromJSON=zg;exports.UpdateInstallationRequestInstallationConfigFromJSONTyped=Gg;exports.UpdateInstallationRequestInstallationConfigToJSON=Xg;exports.UpdateInstallationRequestInstallationFromJSON=Qg;exports.UpdateInstallationRequestInstallationFromJSONTyped=Yg;exports.UpdateInstallationRequestInstallationToJSON=Zg;exports.UpdateInstallationRequestToJSON=ty;exports.UpdateOrgRequestFromJSON=KC;exports.UpdateOrgRequestFromJSONTyped=oy;exports.UpdateOrgRequestOrgFromJSON=ny;exports.UpdateOrgRequestOrgFromJSONTyped=ry;exports.UpdateOrgRequestOrgToJSON=iy;exports.UpdateOrgRequestToJSON=ay;exports.UpdateProjectRequestFromJSON=BC;exports.UpdateProjectRequestFromJSONTyped=ly;exports.UpdateProjectRequestProjectFromJSON=sy;exports.UpdateProjectRequestProjectFromJSONTyped=cy;exports.UpdateProjectRequestProjectToJSON=uy;exports.UpdateProjectRequestToJSON=dy;exports.UpdateProviderAppRequestFromJSON=jC;exports.UpdateProviderAppRequestFromJSONTyped=hy;exports.UpdateProviderAppRequestProviderAppFromJSON=py;exports.UpdateProviderAppRequestProviderAppFromJSONTyped=fy;exports.UpdateProviderAppRequestProviderAppToJSON=my;exports.UpdateProviderAppRequestToJSON=gy;exports.UploadURLApi=i0;exports.UserApi=o0;exports.ValueDefaultBooleanApplyOnUpdateEnum=YS;exports.ValueDefaultBooleanFromJSON=ZS;exports.ValueDefaultBooleanFromJSONTyped=Os;exports.ValueDefaultBooleanToJSON=Bd;exports.ValueDefaultFromJSON=Ss;exports.ValueDefaultFromJSONTyped=Wd;exports.ValueDefaultIntegerApplyOnUpdateEnum=ew;exports.ValueDefaultIntegerFromJSON=tw;exports.ValueDefaultIntegerFromJSONTyped=vs;exports.ValueDefaultIntegerToJSON=$d;exports.ValueDefaultStringApplyOnUpdateEnum=nw;exports.ValueDefaultStringFromJSON=rw;exports.ValueDefaultStringFromJSONTyped=Is;exports.ValueDefaultStringToJSON=Hd;exports.ValueDefaultToJSON=ws;exports.ValueDefaultsFromJSON=ac;exports.ValueDefaultsFromJSONTyped=vm;exports.ValueDefaultsToJSON=sc;exports.VoidApiResponse=Tt;exports.WriteConfigAllOfFromJSON=WC;exports.WriteConfigAllOfFromJSONTyped=yy;exports.WriteConfigAllOfToJSON=zC;exports.WriteConfigFromJSON=Bs;exports.WriteConfigFromJSONTyped=Up;exports.WriteConfigObjectFromJSON=Us;exports.WriteConfigObjectFromJSONTyped=Kp;exports.WriteConfigObjectToJSON=Ls;exports.WriteConfigToJSON=Vs;exports.canConsumeForm=OS;exports.exists=y;exports.instanceOfAcceptInviteRequest=IS;exports.instanceOfApiKey=wS;exports.instanceOfApiKeyAsBasicOpts=CS;exports.instanceOfApiKeyOpts=AS;exports.instanceOfApiKeyOptsHeader=TS;exports.instanceOfApiKeyOptsQuery=RS;exports.instanceOfApiKeyRequest=ES;exports.instanceOfApiProblem=_S;exports.instanceOfAssociationChangeEvent=JS;exports.instanceOfAuthHealthCheck=kS;exports.instanceOfBackfill=US;exports.instanceOfBackfillConfig=BS;exports.instanceOfBaseConfigContent=aw;exports.instanceOfBaseProxyConfig=VS;exports.instanceOfBaseReadConfig=WS;exports.instanceOfBaseReadConfigObject=HS;exports.instanceOfBaseSubscribeConfig=yw;exports.instanceOfBaseSubscribeConfigObject=gw;exports.instanceOfBaseWriteConfig=ow;exports.instanceOfBaseWriteConfigObject=iw;exports.instanceOfBasicAuthOpts=Iw;exports.instanceOfBatchUpsertIntegrationsRequest=Sw;exports.instanceOfBillingAccount=bw;exports.instanceOfBuilder=Cw;exports.instanceOfBuilderInfo=Dw;exports.instanceOfBuilderInfoOrgRole=xw;exports.instanceOfBuilderInfoProjectRolesValue=Pw;exports.instanceOfBulkWriteSupport=Jw;exports.instanceOfConfig=$w;exports.instanceOfConfigContent=Vw;exports.instanceOfConfigContentAllOf=jw;exports.instanceOfConfigCreateEvent=lw;exports.instanceOfConfigDeleteEvent=pw;exports.instanceOfConfigUpdateEvent=hw;exports.instanceOfConnection=ib;exports.instanceOfConnectionRequest=db;exports.instanceOfConnectionRequestBasicAuth=ob;exports.instanceOfConnectionRequestOauth2ClientCredentials=ab;exports.instanceOfConnectionRequestOauth2PasswordCredentials=sb;exports.instanceOfConsumer=zw;exports.instanceOfCreateBillingAccountSession200Response=pb;exports.instanceOfCreateBillingAccountSessionRequest=mb;exports.instanceOfCreateConsumerRequest=gb;exports.instanceOfCreateDestinationRequest=vb;exports.instanceOfCreateDestinationRequestMetadata=Ob;exports.instanceOfCreateEvent=wb;exports.instanceOfCreateGroupRequest=bb;exports.instanceOfCreateInstallationRequest=Tb;exports.instanceOfCreateInstallationRequestConfig=Cb;exports.instanceOfCreateIntegrationRequest=Gb;exports.instanceOfCreateIntegrationRequestLatestRevision=zb;exports.instanceOfCreateOrgInviteRequest=Qb;exports.instanceOfCreateOrgRequest=Zb;exports.instanceOfCreateProjectRequest=tN;exports.instanceOfCreateProviderAppRequest=rN;exports.instanceOfCreateRevisionRequest=oN;exports.instanceOfDefaultPeriod=KS;exports.instanceOfDefaultPeriodConfig=LS;exports.instanceOfDeleteEvent=qb;exports.instanceOfDelivery=Eb;exports.instanceOfDestination=cN;exports.instanceOfFieldMetadata=pN;exports.instanceOfFieldSetting=QS;exports.instanceOfFieldSettingDefault=zS;exports.instanceOfFieldValue=lN;exports.instanceOfGenerateConnectionRequest=fN;exports.instanceOfGroup=Gw;exports.instanceOfHydratedIntegration=SN;exports.instanceOfHydratedIntegrationFieldExistent=Zm;exports.instanceOfHydratedIntegrationObject=yN;exports.instanceOfHydratedIntegrationProxy=hN;exports.instanceOfHydratedIntegrationRead=ON;exports.instanceOfHydratedIntegrationWrite=IN;exports.instanceOfHydratedIntegrationWriteObject=vN;exports.instanceOfHydratedRevision=wN;exports.instanceOfInputValidationIssue=CN;exports.instanceOfInputValidationProblem=TN;exports.instanceOfInstallation=AN;exports.instanceOfIntegration=_N;exports.instanceOfIntegration1=Wb;exports.instanceOfIntegrationFieldExistent=Qf;exports.instanceOfIntegrationFieldMapping=rc;exports.instanceOfIntegrationObject=Mb;exports.instanceOfIntegrationProxy=xb;exports.instanceOfIntegrationRead=Jb;exports.instanceOfIntegrationSubscribe=Vb;exports.instanceOfIntegrationSubscribeObject=Bb;exports.instanceOfIntegrationWrite=Hb;exports.instanceOfIntegrationWriteObject=jb;exports.instanceOfInvite=JN;exports.instanceOfListOperations200Response=UN;exports.instanceOfLog=VN;exports.instanceOfLogMessage=BN;exports.instanceOfMedia=WN;exports.instanceOfMediaTypeDarkMode=jN;exports.instanceOfMediaTypeRegular=HN;exports.instanceOfMetadataItemInput=zN;exports.instanceOfMetadataItemPostAuthentication=GN;exports.instanceOfModuleInfo=YN;exports.instanceOfOauth2AuthorizationCode=lb;exports.instanceOfOauth2AuthorizationCodeAccessToken=cb;exports.instanceOfOauth2AuthorizationCodeRefreshToken=ub;exports.instanceOfOauth2AuthorizationCodeTokensOnly=Yw;exports.instanceOfOauth2AuthorizationCodeTokensOnlyAccessToken=Xw;exports.instanceOfOauth2AuthorizationCodeTokensOnlyRefreshToken=Qw;exports.instanceOfOauth2Opts=tC;exports.instanceOfOauthConnectRequest=nC;exports.instanceOfObjectMetadata=iC;exports.instanceOfOperation=qN;exports.instanceOfOrg=Tw;exports.instanceOfPaginationInfo=KN;exports.instanceOfPatchApiKeyRequest=sC;exports.instanceOfPatchApiKeyRequestApiKey=aC;exports.instanceOfProblem=uC;exports.instanceOfProject=Fw;exports.instanceOfProjectEntitlements=Ew;exports.instanceOfProjectEntitlementsBrandingRemoval=Aw;exports.instanceOfProviderApp=Zw;exports.instanceOfProviderInfo=yC;exports.instanceOfProviderMetadata1=pC;exports.instanceOfProviderMetadataInfo=tb;exports.instanceOfReadConfig=qw;exports.instanceOfReadConfigAllOf=vC;exports.instanceOfReadConfigObject=kw;exports.instanceOfRevision=FN;exports.instanceOfSignedUrl=wC;exports.instanceOfSubscribeConfig=Uw;exports.instanceOfSubscribeConfigAllOf=NC;exports.instanceOfSubscribeConfigObject=Kw;exports.instanceOfSubscribeOpts=gC;exports.instanceOfSubscribeSupport=XN;exports.instanceOfSupport=QN;exports.instanceOfTokenMetadataFields=eC;exports.instanceOfTokenMetadataFieldsOtherFieldsInner=ZN;exports.instanceOfUpdateConnectionRequest=RC;exports.instanceOfUpdateDestinationRequest=EC;exports.instanceOfUpdateDestinationRequestDestination=AC;exports.instanceOfUpdateDestinationRequestDestinationMetadata=sN;exports.instanceOfUpdateEvent=Lb;exports.instanceOfUpdateInstallationConfigContent=_C;exports.instanceOfUpdateInstallationRequest=MC;exports.instanceOfUpdateInstallationRequestInstallation=DC;exports.instanceOfUpdateInstallationRequestInstallationConfig=PC;exports.instanceOfUpdateOrgRequest=qC;exports.instanceOfUpdateOrgRequestOrg=kC;exports.instanceOfUpdateProjectRequest=LC;exports.instanceOfUpdateProjectRequestProject=UC;exports.instanceOfUpdateProviderAppRequest=$C;exports.instanceOfUpdateProviderAppRequestProviderApp=VC;exports.instanceOfValueDefaultBoolean=Ld;exports.instanceOfValueDefaultInteger=Vd;exports.instanceOfValueDefaultString=jd;exports.instanceOfValueDefaults=$b;exports.instanceOfWriteConfig=Bw;exports.instanceOfWriteConfigAllOf=HC;exports.instanceOfWriteConfigObject=Lw;exports.mapValues=pe;exports.querystring=cs;exports.useAmpersandProvider=g0;exports.useConfig=kF;exports.useConnection=au;exports.useCreateInstallation=KF;exports.useDeleteInstallation=VF;exports.useHydratedRevisionQuery=tI;exports.useInstallation=Mi;exports.useInstallationProps=Ir;exports.useIsIntegrationInstalled=DF;exports.useManifest=nI;exports.useUpdateInstallation=LF;
|
|
52
52
|
//# sourceMappingURL=amp-react.cjs.js.map
|