@hiver/connector-admin 4.22.0-ghlSubAccountMapping-beta.4 → 4.22.0-ghlSubAccountMapping-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.es.js +4 -2
- package/index.umd.js +1 -1
- package/package.json +1 -1
package/index.es.js
CHANGED
|
@@ -6877,13 +6877,15 @@ const br = {
|
|
|
6877
6877
|
name: a,
|
|
6878
6878
|
logo: s,
|
|
6879
6879
|
type: c,
|
|
6880
|
-
connectorType: l
|
|
6880
|
+
connectorType: l,
|
|
6881
|
+
isConnectorAvailableInPlan: d
|
|
6881
6882
|
}) => ({
|
|
6882
6883
|
id: i,
|
|
6883
6884
|
name: a,
|
|
6884
6885
|
logo: s,
|
|
6885
6886
|
type: c,
|
|
6886
|
-
connectorType: l
|
|
6887
|
+
connectorType: l,
|
|
6888
|
+
isConnectorAvailableInPlan: d
|
|
6887
6889
|
})
|
|
6888
6890
|
).filter(({ logo: i }) => !!i) : [];
|
|
6889
6891
|
}, Vw = (e, t) => {
|
package/index.umd.js
CHANGED
|
@@ -64,7 +64,7 @@ Take a look at the reducer(s) handling this action type: ${h.type}.
|
|
|
64
64
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(o=>r.set(o)),r}static accessor(t){const r=(this[rf]=this[rf]={accessors:{}}).accessors,o=this.prototype;function A(a){const i=ai(a);r[i]||(ux(o,a),r[i]=!0)}return oe.isArray(t)?t.forEach(A):A(t),this}}Os.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),oe.reduceDescriptors(Os.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}}),oe.freezeMethods(Os);var Qr=Os;function iu(e,t){const n=this||Au,r=t||n,o=Qr.from(r.headers);let A=r.data;return oe.forEach(e,function(i){A=i.call(n,A,o.normalize(),t?t.status:void 0)}),o.normalize(),A}function of(e){return!!(e&&e.__CANCEL__)}function FA(e,t,n){$e.call(this,e??"canceled",$e.ERR_CANCELED,t,n),this.name="CanceledError"}oe.inherits(FA,$e,{__CANCEL__:!0});function Af(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new $e("Request failed with status code "+n.status,[$e.ERR_BAD_REQUEST,$e.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function gx(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function dx(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o=0,A=0,a;return t=t!==void 0?t:1e3,function(s){const c=Date.now(),l=r[A];a||(a=c),n[o]=s,r[o]=c;let C=A,Q=0;for(;C!==o;)Q+=n[C++],C=C%e;if(o=(o+1)%e,o===A&&(A=(A+1)%e),c-a<t)return;const h=l&&c-l;return h?Math.round(Q*1e3/h):void 0}}function Cx(e,t){let n=0,r=1e3/t,o,A;const a=(c,l=Date.now())=>{n=l,o=null,A&&(clearTimeout(A),A=null),e.apply(null,c)};return[(...c)=>{const l=Date.now(),C=l-n;C>=r?a(c,l):(o=c,A||(A=setTimeout(()=>{A=null,a(o)},r-C)))},()=>o&&a(o)]}const Fs=(e,t,n=3)=>{let r=0;const o=dx(50,250);return Cx(A=>{const a=A.loaded,i=A.lengthComputable?A.total:void 0,s=a-r,c=o(s),l=a<=i;r=a;const C={loaded:a,total:i,progress:i?a/i:void 0,bytes:s,rate:c||void 0,estimated:c&&i&&l?(i-a)/c:void 0,event:A,lengthComputable:i!=null,[t?"download":"upload"]:!0};e(C)},n)},af=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},sf=e=>(...t)=>oe.asap(()=>e(...t));var Ex=kn.hasStandardBrowserEnv?function(){const t=kn.navigator&&/(msie|trident)/i.test(kn.navigator.userAgent),n=document.createElement("a");let r;function o(A){let a=A;return t&&(n.setAttribute("href",a),a=n.href),n.setAttribute("href",a),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=o(window.location.href),function(a){const i=oe.isString(a)?o(a):a;return i.protocol===r.protocol&&i.host===r.host}}():function(){return function(){return!0}}(),fx=kn.hasStandardBrowserEnv?{write(e,t,n,r,o,A){const a=[e+"="+encodeURIComponent(t)];oe.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),oe.isString(r)&&a.push("path="+r),oe.isString(o)&&a.push("domain="+o),A===!0&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Ix(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function px(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function cf(e,t){return e&&!Ix(t)?px(e,t):t}const lf=e=>e instanceof Qr?{...e}:e;function eA(e,t){t=t||{};const n={};function r(c,l,C){return oe.isPlainObject(c)&&oe.isPlainObject(l)?oe.merge.call({caseless:C},c,l):oe.isPlainObject(l)?oe.merge({},l):oe.isArray(l)?l.slice():l}function o(c,l,C){if(oe.isUndefined(l)){if(!oe.isUndefined(c))return r(void 0,c,C)}else return r(c,l,C)}function A(c,l){if(!oe.isUndefined(l))return r(void 0,l)}function a(c,l){if(oe.isUndefined(l)){if(!oe.isUndefined(c))return r(void 0,c)}else return r(void 0,l)}function i(c,l,C){if(C in t)return r(c,l);if(C in e)return r(void 0,c)}const s={url:A,method:A,data:A,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:i,headers:(c,l)=>o(lf(c),lf(l),!0)};return oe.forEach(Object.keys(Object.assign({},e,t)),function(l){const C=s[l]||o,Q=C(e[l],t[l],l);oe.isUndefined(Q)&&C!==i||(n[l]=Q)}),n}var uf=e=>{const t=eA({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:A,headers:a,auth:i}=t;t.headers=a=Qr.from(a),t.url=$E(cf(t.baseURL,t.url),e.params,e.paramsSerializer),i&&a.set("Authorization","Basic "+btoa((i.username||"")+":"+(i.password?unescape(encodeURIComponent(i.password)):"")));let s;if(oe.isFormData(n)){if(kn.hasStandardBrowserEnv||kn.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((s=a.getContentType())!==!1){const[c,...l]=s?s.split(";").map(C=>C.trim()).filter(Boolean):[];a.setContentType([c||"multipart/form-data",...l].join("; "))}}if(kn.hasStandardBrowserEnv&&(r&&oe.isFunction(r)&&(r=r(t)),r||r!==!1&&Ex(t.url))){const c=o&&A&&fx.read(A);c&&a.set(o,c)}return t},Bx=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,r){const o=uf(e);let A=o.data;const a=Qr.from(o.headers).normalize();let{responseType:i,onUploadProgress:s,onDownloadProgress:c}=o,l,C,Q,h,I;function E(){h&&h(),I&&I(),o.cancelToken&&o.cancelToken.unsubscribe(l),o.signal&&o.signal.removeEventListener("abort",l)}let d=new XMLHttpRequest;d.open(o.method.toUpperCase(),o.url,!0),d.timeout=o.timeout;function B(){if(!d)return;const f=Qr.from("getAllResponseHeaders"in d&&d.getAllResponseHeaders()),v={data:!i||i==="text"||i==="json"?d.responseText:d.response,status:d.status,statusText:d.statusText,headers:f,config:e,request:d};Af(function(x){n(x),E()},function(x){r(x),E()},v),d=null}"onloadend"in d?d.onloadend=B:d.onreadystatechange=function(){!d||d.readyState!==4||d.status===0&&!(d.responseURL&&d.responseURL.indexOf("file:")===0)||setTimeout(B)},d.onabort=function(){d&&(r(new $e("Request aborted",$e.ECONNABORTED,e,d)),d=null)},d.onerror=function(){r(new $e("Network Error",$e.ERR_NETWORK,e,d)),d=null},d.ontimeout=function(){let m=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const v=o.transitional||tf;o.timeoutErrorMessage&&(m=o.timeoutErrorMessage),r(new $e(m,v.clarifyTimeoutError?$e.ETIMEDOUT:$e.ECONNABORTED,e,d)),d=null},A===void 0&&a.setContentType(null),"setRequestHeader"in d&&oe.forEach(a.toJSON(),function(m,v){d.setRequestHeader(v,m)}),oe.isUndefined(o.withCredentials)||(d.withCredentials=!!o.withCredentials),i&&i!=="json"&&(d.responseType=o.responseType),c&&([Q,I]=Fs(c,!0),d.addEventListener("progress",Q)),s&&d.upload&&([C,h]=Fs(s),d.upload.addEventListener("progress",C),d.upload.addEventListener("loadend",h)),(o.cancelToken||o.signal)&&(l=f=>{d&&(r(!f||f.type?new FA(null,e,d):f),d.abort(),d=null)},o.cancelToken&&o.cancelToken.subscribe(l),o.signal&&(o.signal.aborted?l():o.signal.addEventListener("abort",l)));const p=gx(o.url);if(p&&kn.protocols.indexOf(p)===-1){r(new $e("Unsupported protocol "+p+":",$e.ERR_BAD_REQUEST,e));return}d.send(A||null)})},hx=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,o;const A=function(c){if(!o){o=!0,i();const l=c instanceof Error?c:this.reason;r.abort(l instanceof $e?l:new FA(l instanceof Error?l.message:l))}};let a=t&&setTimeout(()=>{a=null,A(new $e(`timeout ${t} of ms exceeded`,$e.ETIMEDOUT))},t);const i=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(A):c.removeEventListener("abort",A)}),e=null)};e.forEach(c=>c.addEventListener("abort",A));const{signal:s}=r;return s.unsubscribe=()=>oe.asap(i),s}};const Qx=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,o;for(;r<n;)o=r+t,yield e.slice(r,o),r=o},mx=async function*(e,t){for await(const n of bx(e))yield*Qx(n,t)},bx=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},gf=(e,t,n,r)=>{const o=mx(e,t);let A=0,a,i=s=>{a||(a=!0,r&&r(s))};return new ReadableStream({async pull(s){try{const{done:c,value:l}=await o.next();if(c){i(),s.close();return}let C=l.byteLength;if(n){let Q=A+=C;n(Q)}s.enqueue(new Uint8Array(l))}catch(c){throw i(c),c}},cancel(s){return i(s),o.return()}},{highWaterMark:2})},Ms=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",df=Ms&&typeof ReadableStream=="function",yx=Ms&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Cf=(e,...t)=>{try{return!!e(...t)}catch{return!1}},vx=df&&Cf(()=>{let e=!1;const t=new Request(kn.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Ef=64*1024,su=df&&Cf(()=>oe.isReadableStream(new Response("").body)),_s={stream:su&&(e=>e.body)};Ms&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!_s[t]&&(_s[t]=oe.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new $e(`Response type '${t}' is not supported`,$e.ERR_NOT_SUPPORT,r)})})})(new Response);const xx=async e=>{if(e==null)return 0;if(oe.isBlob(e))return e.size;if(oe.isSpecCompliantForm(e))return(await new Request(kn.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(oe.isArrayBufferView(e)||oe.isArrayBuffer(e))return e.byteLength;if(oe.isURLSearchParams(e)&&(e=e+""),oe.isString(e))return(await yx(e)).byteLength},wx=async(e,t)=>{const n=oe.toFiniteNumber(e.getContentLength());return n??xx(t)};var Sx=Ms&&(async e=>{let{url:t,method:n,data:r,signal:o,cancelToken:A,timeout:a,onDownloadProgress:i,onUploadProgress:s,responseType:c,headers:l,withCredentials:C="same-origin",fetchOptions:Q}=uf(e);c=c?(c+"").toLowerCase():"text";let h=hx([o,A&&A.toAbortSignal()],a),I;const E=h&&h.unsubscribe&&(()=>{h.unsubscribe()});let d;try{if(s&&vx&&n!=="get"&&n!=="head"&&(d=await wx(l,r))!==0){let v=new Request(t,{method:"POST",body:r,duplex:"half"}),w;if(oe.isFormData(r)&&(w=v.headers.get("content-type"))&&l.setContentType(w),v.body){const[x,b]=af(d,Fs(sf(s)));r=gf(v.body,Ef,x,b)}}oe.isString(C)||(C=C?"include":"omit");const B="credentials"in Request.prototype;I=new Request(t,{...Q,signal:h,method:n.toUpperCase(),headers:l.normalize().toJSON(),body:r,duplex:"half",credentials:B?C:void 0});let p=await fetch(I);const f=su&&(c==="stream"||c==="response");if(su&&(i||f&&E)){const v={};["status","statusText","headers"].forEach(T=>{v[T]=p[T]});const w=oe.toFiniteNumber(p.headers.get("content-length")),[x,b]=i&&af(w,Fs(sf(i),!0))||[];p=new Response(gf(p.body,Ef,x,()=>{b&&b(),E&&E()}),v)}c=c||"text";let m=await _s[oe.findKey(_s,c)||"text"](p,e);return!f&&E&&E(),await new Promise((v,w)=>{Af(v,w,{data:m,headers:Qr.from(p.headers),status:p.status,statusText:p.statusText,config:e,request:I})})}catch(B){throw E&&E(),B&&B.name==="TypeError"&&/fetch/i.test(B.message)?Object.assign(new $e("Network Error",$e.ERR_NETWORK,e,I),{cause:B.cause||B}):$e.from(B,B&&B.code,e,I)}});const cu={http:H1,xhr:Bx,fetch:Sx};oe.forEach(cu,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const ff=e=>`- ${e}`,Tx=e=>oe.isFunction(e)||e===null||e===!1;var If={getAdapter:e=>{e=oe.isArray(e)?e:[e];const{length:t}=e;let n,r;const o={};for(let A=0;A<t;A++){n=e[A];let a;if(r=n,!Tx(n)&&(r=cu[(a=String(n)).toLowerCase()],r===void 0))throw new $e(`Unknown adapter '${a}'`);if(r)break;o[a||"#"+A]=r}if(!r){const A=Object.entries(o).map(([i,s])=>`adapter ${i} `+(s===!1?"is not supported by the environment":"is not available in the build"));let a=t?A.length>1?`since :
|
|
65
65
|
`+A.map(ff).join(`
|
|
66
66
|
`):" "+ff(A[0]):"as no adapter specified";throw new $e("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return r},adapters:cu};function lu(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new FA(null,e)}function pf(e){return lu(e),e.headers=Qr.from(e.headers),e.data=iu.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),If.getAdapter(e.adapter||Au.adapter)(e).then(function(r){return lu(e),r.data=iu.call(e,e.transformResponse,r),r.headers=Qr.from(r.headers),r},function(r){return of(r)||(lu(e),r&&r.response&&(r.response.data=iu.call(e,e.transformResponse,r.response),r.response.headers=Qr.from(r.response.headers))),Promise.reject(r)})}const Bf="1.7.7",uu={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{uu[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const hf={};uu.transitional=function(t,n,r){function o(A,a){return"[Axios v"+Bf+"] Transitional option '"+A+"'"+a+(r?". "+r:"")}return(A,a,i)=>{if(t===!1)throw new $e(o(a," has been removed"+(n?" in "+n:"")),$e.ERR_DEPRECATED);return n&&!hf[a]&&(hf[a]=!0,console.warn(o(a," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(A,a,i):!0}};function Dx(e,t,n){if(typeof e!="object")throw new $e("options must be an object",$e.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const A=r[o],a=t[A];if(a){const i=e[A],s=i===void 0||a(i,A,e);if(s!==!0)throw new $e("option "+A+" must be "+s,$e.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new $e("Unknown option "+A,$e.ERR_BAD_OPTION)}}var gu={assertOptions:Dx,validators:uu};const Bo=gu.validators;let Ps=class{constructor(t){this.defaults=t,this.interceptors={request:new ef,response:new ef}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let o;Error.captureStackTrace?Error.captureStackTrace(o={}):o=new Error;const A=o.stack?o.stack.replace(/^.+\n/,""):"";try{r.stack?A&&!String(r.stack).endsWith(A.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
67
|
-
`+A):r.stack=A}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=eA(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:A}=n;r!==void 0&&gu.assertOptions(r,{silentJSONParsing:Bo.transitional(Bo.boolean),forcedJSONParsing:Bo.transitional(Bo.boolean),clarifyTimeoutError:Bo.transitional(Bo.boolean)},!1),o!=null&&(oe.isFunction(o)?n.paramsSerializer={serialize:o}:gu.assertOptions(o,{encode:Bo.function,serialize:Bo.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=A&&oe.merge(A.common,A[n.method]);A&&oe.forEach(["delete","get","head","post","put","patch","common"],I=>{delete A[I]}),n.headers=Qr.concat(a,A);const i=[];let s=!0;this.interceptors.request.forEach(function(E){typeof E.runWhen=="function"&&E.runWhen(n)===!1||(s=s&&E.synchronous,i.unshift(E.fulfilled,E.rejected))});const c=[];this.interceptors.response.forEach(function(E){c.push(E.fulfilled,E.rejected)});let l,C=0,Q;if(!s){const I=[pf.bind(this),void 0];for(I.unshift.apply(I,i),I.push.apply(I,c),Q=I.length,l=Promise.resolve(n);C<Q;)l=l.then(I[C++],I[C++]);return l}Q=i.length;let h=n;for(C=0;C<Q;){const I=i[C++],E=i[C++];try{h=I(h)}catch(d){E.call(this,d);break}}try{l=pf.call(this,h)}catch(I){return Promise.reject(I)}for(C=0,Q=c.length;C<Q;)l=l.then(c[C++],c[C++]);return l}getUri(t){t=eA(this.defaults,t);const n=cf(t.baseURL,t.url);return $E(n,t.params,t.paramsSerializer)}};oe.forEach(["delete","get","head","options"],function(t){Ps.prototype[t]=function(n,r){return this.request(eA(r||{},{method:t,url:n,data:(r||{}).data}))}}),oe.forEach(["post","put","patch"],function(t){function n(r){return function(A,a,i){return this.request(eA(i||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:A,data:a}))}}Ps.prototype[t]=n(),Ps.prototype[t+"Form"]=n(!0)});var Ls=Ps;class du{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(A){n=A});const r=this;this.promise.then(o=>{if(!r._listeners)return;let A=r._listeners.length;for(;A-- >0;)r._listeners[A](o);r._listeners=null}),this.promise.then=o=>{let A;const a=new Promise(i=>{r.subscribe(i),A=i}).then(o);return a.cancel=function(){r.unsubscribe(A)},a},t(function(A,a,i){r.reason||(r.reason=new FA(A,a,i),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new du(function(o){t=o}),cancel:t}}}var Ox=du;function Fx(e){return function(n){return e.apply(null,n)}}function Mx(e){return oe.isObject(e)&&e.isAxiosError===!0}const Cu={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Cu).forEach(([e,t])=>{Cu[t]=e});var _x=Cu;function Qf(e){const t=new Ls(e),n=NE(Ls.prototype.request,t);return oe.extend(n,Ls.prototype,t,{allOwnKeys:!0}),oe.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return Qf(eA(e,o))},n}const Xt=Qf(Au);Xt.Axios=Ls,Xt.CanceledError=FA,Xt.CancelToken=Ox,Xt.isCancel=of,Xt.VERSION=Bf,Xt.toFormData=Ts,Xt.AxiosError=$e,Xt.Cancel=Xt.CanceledError,Xt.all=function(t){return Promise.all(t)},Xt.spread=Fx,Xt.isAxiosError=Mx,Xt.mergeConfig=eA,Xt.AxiosHeaders=Qr,Xt.formToJSON=e=>nf(oe.isHTMLForm(e)?new FormData(e):e),Xt.getAdapter=If.getAdapter,Xt.HttpStatusCode=_x,Xt.default=Xt;var mf=Xt,gt={},Mr={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PLATFORM=e.TENANT_PLATFORM=e.API_CALL_ORIGIN=e.TIERS=e.APP_UI=e.CONFIG_HIVER=e.DEFAULT_INIT_CONFIG_HIVER=e.TWO_MINUTES_IN_MS=e.REFETCH_CHECK_DELAY=e.GREXIT_ADMIN_DOMAIN=e.RETRY_DELAY_IN_CASE_OF_CORRUPTED_EXPIRY=e.INITIAL_RETRY_DELAY=e.MAX_BACKOFF_LIMIT=e.MAX_CONFLICT_RETRY_DELAY=e.MAX_RETRY_DELAY=e.GET_METHOD=void 0,e.GET_METHOD="GET",e.MAX_RETRY_DELAY=18e4,e.MAX_CONFLICT_RETRY_DELAY=63e3,e.MAX_BACKOFF_LIMIT=8e3,e.INITIAL_RETRY_DELAY=1e3,e.RETRY_DELAY_IN_CASE_OF_CORRUPTED_EXPIRY=3e3,e.GREXIT_ADMIN_DOMAIN="admin.hiverhq.com",e.REFETCH_CHECK_DELAY=168e4,e.TWO_MINUTES_IN_MS=2*60*1e3,e.DEFAULT_INIT_CONFIG_HIVER={getToken:!0,isHiverApiDomain:!0,fetchCsrfToken:function(){return""}},e.CONFIG_HIVER={getToken:!1,fetchCsrfToken:function(){return""},isHiverApiDomain:!0},e.APP_UI={COLLAB_SPACE:"collab-space",DEFAULT:"default"},e.TIERS={DEV:"dev",SIT:"sit",QA:"qa",PRODUCTION:"production",PROD:"prod"},e.API_CALL_ORIGIN={API_RETRY:"Api Retry"},e.TENANT_PLATFORM={GMAIL:"GMAIL",HIVERWEB:"HIVERWEB"},function(t){t[t.WEB=0]="WEB",t[t.MOBILE=1]="MOBILE"}(e.PLATFORM||(e.PLATFORM={}))})(Mr);var jn={};Object.defineProperty(jn,"__esModule",{value:!0}),jn.getProdHqConfig=jn.getProdApiConfig=jn.getSitHqConfig=jn.getSitApiConfig=jn.getDevHqConfig=jn.getDevApiConfig=void 0;var MA={heimdallTokenFetch:"/v1/token/get",heimdallLogin:"/v1/login/code",heimdallLogout:"/v1/logout",v2Login:"/api/auth/login/code",hotLogin:"/api/auth/login/code"},Px=function(){return{v2Url:"https://v2dev.hiver.space",heimdallUrl:"https://dev.hiver.space/api/heimdall-api",hotUrl:"http://local.hiverhq.co.in:3000",apiEndpoints:MA}};jn.getDevApiConfig=Px;var Lx=function(){return{v2Url:"https://v2dev.hiver.space",heimdallUrl:"https://dev.hiver.space/api/heimdall-api2",hotUrl:"http://local.hiverhq.co.in:3000",apiEndpoints:MA}};jn.getDevHqConfig=Lx;var Nx=function(e){return{v2Url:"https://v2".concat(e,".hiver.space"),heimdallUrl:"https://".concat(e,".hiver.space/api/heimdall-api"),hotUrl:"https://api-".concat(e,".hiver.space"),apiEndpoints:MA}};jn.getSitApiConfig=Nx;var Rx=function(e){return{v2Url:"https://v2".concat(e,".hiver.space"),heimdallUrl:"https://".concat(e,".hiver.space/api/heimdall-api2"),hotUrl:"https://api-".concat(e,".hiver.space"),apiEndpoints:MA}};jn.getSitHqConfig=Rx;var kx=function(e){return e===void 0&&(e=!1),{v2Url:e?"https://admin.hiverhq.com":"https://v2.hiverhq.com",heimdallUrl:"https://heimdall.hiverapi.com",hotUrl:"https://app.hiverhq.com",apiEndpoints:MA}};jn.getProdApiConfig=kx;var jx=function(e){return e===void 0&&(e=!1),{v2Url:e?"https://admin.hiverhq.com":"https://v2.hiverhq.com",heimdallUrl:"https://heimdall2.hiverhq.com",hotUrl:"https://app.hiverhq.com",apiEndpoints:MA}};jn.getProdHqConfig=jx;var _r={},Pr={};Object.defineProperty(Pr,"__esModule",{value:!0}),Pr.removeValue=Pr.getValue=Pr.setValue=void 0;var Eu={};function Vx(e,t){Eu[e]=t}Pr.setValue=Vx;function Gx(e){return Eu[e]}Pr.getValue=Gx;function Hx(e){delete Eu[e]}Pr.removeValue=Hx,Object.defineProperty(_r,"__esModule",{value:!0}),_r.removeItemFromStorage=_r.setItemInStorage=_r.getItemFromStorage=void 0;var _A=Mr,PA=Pr,Wx=function(e,t){switch(t===void 0&&(t=(0,PA.getValue)("PLATFORM")),t){case _A.PLATFORM.WEB:return sessionStorage.getItem(e);case _A.PLATFORM.MOBILE:return(0,PA.getValue)(e);default:throw Error("Invalid PLATFORM ".concat(t))}};_r.getItemFromStorage=Wx;var zx=function(e,t,n){switch(n===void 0&&(n=(0,PA.getValue)("PLATFORM")),n){case _A.PLATFORM.WEB:return sessionStorage.setItem(e,t);case _A.PLATFORM.MOBILE:return(0,PA.setValue)(e,t);default:throw Error("Invalid PLATFORM ".concat(n))}};_r.setItemInStorage=zx;var Yx=function(e,t){switch(t===void 0&&(t=(0,PA.getValue)("PLATFORM")),t){case _A.PLATFORM.WEB:sessionStorage.removeItem(e);break;case _A.PLATFORM.MOBILE:(0,PA.removeValue)(e);break;default:throw Error("Invalid PLATFORM ".concat(t))}};_r.removeItemFromStorage=Yx;var Jx=Ze&&Ze.__awaiter||function(e,t,n,r){function o(A){return A instanceof n?A:new n(function(a){a(A)})}return new(n||(n=Promise))(function(A,a){function i(l){try{c(r.next(l))}catch(C){a(C)}}function s(l){try{c(r.throw(l))}catch(C){a(C)}}function c(l){l.done?A(l.value):o(l.value).then(i,s)}c((r=r.apply(e,t||[])).next())})},Xx=Ze&&Ze.__generator||function(e,t){var n={label:0,sent:function(){if(A[0]&1)throw A[1];return A[1]},trys:[],ops:[]},r,o,A,a;return a={next:i(0),throw:i(1),return:i(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function i(c){return function(l){return s([c,l])}}function s(c){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(n=0)),n;)try{if(r=1,o&&(A=c[0]&2?o.return:c[0]?o.throw||((A=o.return)&&A.call(o),0):o.next)&&!(A=A.call(o,c[1])).done)return A;switch(o=0,A&&(c=[c[0]&2,A.value]),c[0]){case 0:case 1:A=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,o=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(A=n.trys,!(A=A.length>0&&A[A.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!A||c[1]>A[0]&&c[1]<A[3])){n.label=c[1];break}if(c[0]===6&&n.label<A[1]){n.label=A[1],A=c;break}if(A&&n.label<A[2]){n.label=A[2],n.ops.push(c);break}A[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(l){c=[6,l],o=0}finally{r=A=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(gt,"__esModule",{value:!0}),gt.expireToken=gt.invalidateToken=gt.validateToken=gt.validateAccount=gt.getConfig=gt.introduceDelay=gt.isTokenInExpiryWindow=gt.getStoredAuthData=gt.setUserDetails=gt.getRefreshInterval=gt.setTokenAndExpiry=gt.getRandomDelay=gt.hasValidToken=void 0;var Lr=Mr,LA=jn,er=_r,fu=function(){var e=new Date,t=new Date(e.getTime()+e.getTimezoneOffset()*6e4);return t},Iu=function(e){var t=parseInt((0,er.getItemFromStorage)("hiverAuthUserId")||"0"),n=parseInt((0,er.getItemFromStorage)("hiverAuthUserGroupId")||"0"),r=e.userId,o=e.usergroupId;return t===r&&o===n};gt.validateAccount=Iu;var Zx=function(e){var t=Iu(e);return!bf()&&t};gt.validateToken=Zx;var Ux=function(e){return e.apiRetry?e.apiRetry>0:!1};gt.invalidateToken=Ux;var qx=function(){try{sessionStorage.removeItem("hiverAuthTokenExpiry")}catch{console.log("Heimdall: Unable to Remove token.")}};gt.expireToken=qx;var Kx=function(e){var t=(0,er.getItemFromStorage)("hiverAuthTokenExpiry")||"",n=new Date(t),r=fu(),o=Iu(e);return console.log("Heimdall: checking if there is a valid token",r<n&&o),r<n&&o};gt.hasValidToken=Kx;var $x=function(){return Math.floor(Math.random()*6e4)+6e4};gt.getRandomDelay=$x;var e2=function(e,t){if(!e||!t)throw new Error("User Id or user group Id not found in the response");(0,er.setItemInStorage)("hiverAuthUserId",e),(0,er.setItemInStorage)("hiverAuthUserGroupId",t)};gt.setUserDetails=e2;var t2=function(e,t){if(!e)throw new Error("Token not found in the response");(0,er.setItemInStorage)("hiverAuthToken",e),(0,er.setItemInStorage)("hiverAuthTokenExpiry",t)};gt.setTokenAndExpiry=t2;var n2=function(){var e=(0,er.getItemFromStorage)("hiverAuthTokenExpiry"),t=(0,er.getItemFromStorage)("hiverAuthToken"),n=(0,er.getItemFromStorage)("hiverAuthUserId"),r=(0,er.getItemFromStorage)("hiverAuthUserGroupId");return{token:t,expiryTime:e,userId:n,usergroupId:r}};gt.getStoredAuthData=n2;var bf=function(){var e=(0,er.getItemFromStorage)("hiverAuthTokenExpiry")||"";if(!e)return!0;var t=fu(),n=new Date(e),r=4*60*1e3,o=n.getTime()-t.getTime()<r;return o};gt.isTokenInExpiryWindow=bf;var r2=function(e){return Jx(void 0,void 0,void 0,function(){return Xx(this,function(t){switch(t.label){case 0:return[4,new Promise(function(n){return setTimeout(n,e)})];case 1:return t.sent(),[2]}})})};gt.introduceDelay=r2;var o2=function(){return window.location.host===Lr.GREXIT_ADMIN_DOMAIN},A2=function(e,t,n){n===void 0&&(n=!0);var r=o2();switch(t){case Lr.TIERS.SIT:case Lr.TIERS.QA:return n?(0,LA.getSitApiConfig)(e):(0,LA.getSitHqConfig)(e);case Lr.TIERS.PRODUCTION:case Lr.TIERS.PROD:return n?(0,LA.getProdApiConfig)(r):(0,LA.getProdHqConfig)(r);case Lr.TIERS.DEV:default:return n?(0,LA.getDevApiConfig)():(0,LA.getDevHqConfig)()}};gt.getConfig=A2;var a2=function(){try{var e=(0,er.getItemFromStorage)("hiverAuthTokenExpiry");if(!e)return Lr.RETRY_DELAY_IN_CASE_OF_CORRUPTED_EXPIRY;var t=new Date(e),n=fu();return t.getTime()-n.getTime()>Lr.TWO_MINUTES_IN_MS?t.getTime()-Lr.TWO_MINUTES_IN_MS:t.getTime()-n.getTime()}catch(r){return console.error("Heimdall: Error in getRefreshInterval",r),Lr.REFETCH_CHECK_DELAY}};gt.getRefreshInterval=a2;var ii={},mr={},yf;function vf(){if(yf)return mr;yf=1;var e=Ze&&Ze.__awaiter||function(I,E,d,B){function p(f){return f instanceof d?f:new d(function(m){m(f)})}return new(d||(d=Promise))(function(f,m){function v(b){try{x(B.next(b))}catch(T){m(T)}}function w(b){try{x(B.throw(b))}catch(T){m(T)}}function x(b){b.done?f(b.value):p(b.value).then(v,w)}x((B=B.apply(I,E||[])).next())})},t=Ze&&Ze.__generator||function(I,E){var d={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},B,p,f,m;return m={next:v(0),throw:v(1),return:v(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function v(x){return function(b){return w([x,b])}}function w(x){if(B)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(d=0)),d;)try{if(B=1,p&&(f=x[0]&2?p.return:x[0]?p.throw||((f=p.return)&&f.call(p),0):p.next)&&!(f=f.call(p,x[1])).done)return f;switch(p=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return d.label++,{value:x[1],done:!1};case 5:d.label++,p=x[1],x=[0];continue;case 7:x=d.ops.pop(),d.trys.pop();continue;default:if(f=d.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){d=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){d.label=x[1];break}if(x[0]===6&&d.label<f[1]){d.label=f[1],f=x;break}if(f&&d.label<f[2]){d.label=f[2],d.ops.push(x);break}f[2]&&d.ops.pop(),d.trys.pop();continue}x=E.call(I,d)}catch(b){x=[6,b],p=0}finally{B=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}};Object.defineProperty(mr,"__esModule",{value:!0}),mr.logoutFromHeimdall=mr.getTenantLoginCode=mr.getLoginToken=mr.getAccessToken=void 0;var n=Mr,r=Df(),o=gt,A=function(I,E,d,B){var p=(0,o.getStoredAuthData)(),f=d===n.TENANT_PLATFORM.HIVERWEB?n.TENANT_PLATFORM.HIVERWEB:n.TENANT_PLATFORM.GMAIL;return{root_url:I.heimdallUrl,url:I.apiEndpoints.heimdallTokenFetch,method:n.GET_METHOD,data:{user_id:E.userId,usergroup_id:E.usergroupId,access_token:(p==null?void 0:p.token)||"",source:B,tenant:f}}},a=function(I,E,d,B,p){var f=d===n.TENANT_PLATFORM.HIVERWEB?n.TENANT_PLATFORM.HIVERWEB:n.TENANT_PLATFORM.GMAIL;return{root_url:E.heimdallUrl,url:E.apiEndpoints.heimdallLogin,method:n.GET_METHOD,data:{code:I},headers:{"x-hiver-tenant":f,"x-hiver-userid":B,"x-hiver-usergroupid":p}}},i=function(I,E){var d=E===n.TENANT_PLATFORM.HIVERWEB?n.TENANT_PLATFORM.HIVERWEB:n.TENANT_PLATFORM.GMAIL;return{root_url:I.heimdallUrl,url:I.apiEndpoints.heimdallLogout,method:n.GET_METHOD,headers:{"x-hiver-tenant":d}}},s=function(I){return parseInt(I,10)},c=function(I,E,d,B){return{root_url:d===n.TENANT_PLATFORM.HIVERWEB?I.hotUrl:I.v2Url,url:d===n.TENANT_PLATFORM.HIVERWEB?I.apiEndpoints.hotLogin:I.apiEndpoints.v2Login,method:n.GET_METHOD,data:{usersession:s(E.userId),app:B||n.APP_UI.DEFAULT}}},l=function(I,E,d,B,p){return e(void 0,void 0,void 0,function(){var f,m,v,w,x,b,T;return t(this,function(M){switch(M.label){case 0:return M.trys.push([0,4,,5]),!(0,o.validateToken)(d)||(0,o.invalidateToken)(d)?(f=A(E,d,B,p),[4,(0,r.performAxiosCall)(f)]):[3,2];case 1:return m=M.sent(),[2,{atToken:(w=m==null?void 0:m.data.at)===null||w===void 0?void 0:w.token,expiryTime:(x=m==null?void 0:m.data.at)===null||x===void 0?void 0:x.expires_at,userId:(b=m==null?void 0:m.data)===null||b===void 0?void 0:b.user_id,userGroupId:(T=m==null?void 0:m.data)===null||T===void 0?void 0:T.usergroup_id}];case 2:return[2,{}];case 3:return[3,5];case 4:throw v=M.sent(),v;case 5:return[2]}})})};mr.getAccessToken=l;var C=function(I,E,d,B,p,f){return e(void 0,void 0,void 0,function(){var m,v,w,x,b,T,M;return t(this,function(_){switch(_.label){case 0:m=a(I,d,B,p,f),_.label=1;case 1:return _.trys.push([1,3,,4]),[4,(0,r.performAxiosCall)(m)];case 2:return v=_.sent(),[2,{userId:(x=v==null?void 0:v.data)===null||x===void 0?void 0:x.user_id,userGroupId:(b=v==null?void 0:v.data)===null||b===void 0?void 0:b.usergroup_id,atToken:(T=v==null?void 0:v.data.at)===null||T===void 0?void 0:T.token,expiryTime:(M=v==null?void 0:v.data.at)===null||M===void 0?void 0:M.expires_at}];case 3:throw w=_.sent(),w;case 4:return[2]}})})};mr.getLoginToken=C;var Q=function(I,E,d,B,p){return e(void 0,void 0,void 0,function(){var f,m,v;return t(this,function(w){switch(w.label){case 0:return w.trys.push([0,2,,3]),f=c(E,d,B,p),[4,(0,r.performAxiosCall)(f)];case 1:return m=w.sent(),[2,m==null?void 0:m.data.code];case 2:throw v=w.sent(),v;case 3:return[2]}})})};mr.getTenantLoginCode=Q;var h=function(I,E,d){return d===void 0&&(d=0),e(void 0,void 0,void 0,function(){var B,p,f;return t(this,function(m){switch(m.label){case 0:return m.trys.push([0,2,,5]),B=i(I,E),[4,(0,r.performAxiosCall)(B)];case 1:return p=m.sent(),[2,p==null?void 0:p.status];case 2:return f=m.sent(),d<2?[4,h(I,E,d+1)]:[3,4];case 3:m.sent(),m.label=4;case 4:throw f;case 5:return[2]}})})};return mr.logoutFromHeimdall=h,mr}var Ns={},i2=Ze&&Ze.__awaiter||function(e,t,n,r){function o(A){return A instanceof n?A:new n(function(a){a(A)})}return new(n||(n=Promise))(function(A,a){function i(l){try{c(r.next(l))}catch(C){a(C)}}function s(l){try{c(r.throw(l))}catch(C){a(C)}}function c(l){l.done?A(l.value):o(l.value).then(i,s)}c((r=r.apply(e,t||[])).next())})},s2=Ze&&Ze.__generator||function(e,t){var n={label:0,sent:function(){if(A[0]&1)throw A[1];return A[1]},trys:[],ops:[]},r,o,A,a;return a={next:i(0),throw:i(1),return:i(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function i(c){return function(l){return s([c,l])}}function s(c){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(n=0)),n;)try{if(r=1,o&&(A=c[0]&2?o.return:c[0]?o.throw||((A=o.return)&&A.call(o),0):o.next)&&!(A=A.call(o,c[1])).done)return A;switch(o=0,A&&(c=[c[0]&2,A.value]),c[0]){case 0:case 1:A=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,o=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(A=n.trys,!(A=A.length>0&&A[A.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!A||c[1]>A[0]&&c[1]<A[3])){n.label=c[1];break}if(c[0]===6&&n.label<A[1]){n.label=A[1],A=c;break}if(A&&n.label<A[2]){n.label=A[2],n.ops.push(c);break}A[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(l){c=[6,l],o=0}finally{r=A=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(Ns,"__esModule",{value:!0}),Ns.subscribeToOnlineEvent=void 0;var xf=Mr,c2=Pr,l2=function(e,t){switch(t===void 0&&(t=(0,c2.getValue)("PLATFORM")),t){case xf.PLATFORM.WEB:return window.addEventListener("online",function(){return i2(void 0,void 0,void 0,function(){return s2(this,function(n){switch(n.label){case 0:return[4,e()];case 1:return n.sent(),[2]}})})});case xf.PLATFORM.MOBILE:e();return;default:throw Error("Invalid PLATFORM ".concat(t))}};Ns.subscribeToOnlineEvent=l2;var tA={};Object.defineProperty(tA,"__esModule",{value:!0}),tA.coalesceTokenFetch=tA.buildTokenFetchKey=void 0;var pu="__hiverAuthInFlight",u2=function(){var e=globalThis;return e[pu]||(e[pu]=new Map),e[pu]},g2=function(e,t,n){return"".concat(e??"",":").concat(t??"",":").concat(n??"")};tA.buildTokenFetchKey=g2;var d2=function(e,t){var n=u2(),r=n.get(e);if(r)return r;var o=t().finally(function(){n.delete(e)});return n.set(e,o),o};tA.coalesceTokenFetch=d2;var wf;function Sf(){if(wf)return ii;wf=1;var e=Ze&&Ze.__awaiter||function(E,d,B,p){function f(m){return m instanceof B?m:new B(function(v){v(m)})}return new(B||(B=Promise))(function(m,v){function w(T){try{b(p.next(T))}catch(M){v(M)}}function x(T){try{b(p.throw(T))}catch(M){v(M)}}function b(T){T.done?m(T.value):f(T.value).then(w,x)}b((p=p.apply(E,d||[])).next())})},t=Ze&&Ze.__generator||function(E,d){var B={label:0,sent:function(){if(m[0]&1)throw m[1];return m[1]},trys:[],ops:[]},p,f,m,v;return v={next:w(0),throw:w(1),return:w(2)},typeof Symbol=="function"&&(v[Symbol.iterator]=function(){return this}),v;function w(b){return function(T){return x([b,T])}}function x(b){if(p)throw new TypeError("Generator is already executing.");for(;v&&(v=0,b[0]&&(B=0)),B;)try{if(p=1,f&&(m=b[0]&2?f.return:b[0]?f.throw||((m=f.return)&&m.call(f),0):f.next)&&!(m=m.call(f,b[1])).done)return m;switch(f=0,m&&(b=[b[0]&2,m.value]),b[0]){case 0:case 1:m=b;break;case 4:return B.label++,{value:b[1],done:!1};case 5:B.label++,f=b[1],b=[0];continue;case 7:b=B.ops.pop(),B.trys.pop();continue;default:if(m=B.trys,!(m=m.length>0&&m[m.length-1])&&(b[0]===6||b[0]===2)){B=0;continue}if(b[0]===3&&(!m||b[1]>m[0]&&b[1]<m[3])){B.label=b[1];break}if(b[0]===6&&B.label<m[1]){B.label=m[1],m=b;break}if(m&&B.label<m[2]){B.label=m[2],B.ops.push(b);break}m[2]&&B.ops.pop(),B.trys.pop();continue}b=d.call(E,B)}catch(T){b=[6,T],f=0}finally{p=m=0}if(b[0]&5)throw b[1];return{value:b[0]?b[1]:void 0,done:!0}}};Object.defineProperty(ii,"__esModule",{value:!0}),ii.fetchAccessToken=void 0;var n=vf(),r=Mr,o=gt,A=Ns,a=tA,i,s,c,l=function(E,d,B,p,f,m){return m===void 0&&(m=r.APP_UI.DEFAULT),e(void 0,void 0,void 0,function(){var v,w,x,b,T,M,_,R,F;return t(this,function(O){switch(O.label){case 0:v=2,O.label=1;case 1:return O.trys.push([1,7,,12]),w=void 0,f?[4,f()]:[3,3];case 2:return w=O.sent(),[3,5];case 3:return[4,(0,n.getTenantLoginCode)(r.CONFIG_HIVER,E,d,p,m)];case 4:w=O.sent(),O.label=5;case 5:return[4,(0,n.getLoginToken)(w,r.CONFIG_HIVER,E,p,d.userId,d.usergroupId)];case 6:return x=O.sent(),b=x.userId,T=x.userGroupId,M=x.atToken,_=x.expiryTime,(0,o.setTokenAndExpiry)(M,_),(0,o.setUserDetails)(b,T),[3,12];case 7:R=O.sent(),console.log("ERROR debug: in error login:",R,m),F=B,O.label=8;case 8:return F<v?[4,l(E,d,F+1,p,f,m)]:[3,11];case 9:O.sent(),O.label=10;case 10:return F++,[3,8];case 11:throw R;case 12:return[2]}})})},C=function(E,d,B,p,f){return e(void 0,void 0,void 0,function(){var m,v,w,x;return t(this,function(b){switch(b.label){case 0:return d<r.MAX_CONFLICT_RETRY_DELAY?[4,new Promise(function(T){return setTimeout(T,E)})]:[3,3];case 1:return b.sent(),d+=E,E*2<=r.MAX_BACKOFF_LIMIT?E*=2:E=r.MAX_BACKOFF_LIMIT,m=B.retryDelay,v=B.configs,w=B.apiParams,x=B.appUI,[4,Q(m,E,d,v,w,p,f,x)];case 2:b.sent(),b.label=3;case 3:return[2]}})})},Q=function(E,d,B,p,f,m,v,w,x){return w===void 0&&(w="default"),e(void 0,void 0,void 0,function(){var b,T,M,_,R,F,O,j,W,ne,K,U,V,Z;return t(this,function(G){switch(G.label){case 0:return G.trys.push([0,2,,12]),[4,(0,n.getAccessToken)(r.CONFIG_HIVER,p,f,m,w)];case 1:return b=G.sent(),T=b.atToken,M=b.expiryTime,_=b.userId,R=b.userGroupId,T&&M&&(0,o.setTokenAndExpiry)(T,M),_&&R&&(0,o.setUserDetails)(_,R),E=r.INITIAL_RETRY_DELAY,d=r.INITIAL_RETRY_DELAY,B=0,[3,12];case 2:return F=G.sent(),console.log("ERROR: Heimdall fetch token",F),((W=F.response)===null||W===void 0?void 0:W.status)===401||((ne=F.request)===null||ne===void 0?void 0:ne.status)===401?(O=1,[4,l(p,f,O,m,v,x)]):[3,4];case 3:return G.sent(),[3,11];case 4:return((K=F.response)===null||K===void 0?void 0:K.status)===409||((U=F.request)===null||U===void 0?void 0:U.status)===409?(j={retryDelay:E,configs:p,apiParams:f,appUI:x},[4,C(d,B,j,m,v)]):[3,6];case 5:if(G.sent(),B>=r.MAX_CONFLICT_RETRY_DELAY)throw F;return[3,11];case 6:if(!(((V=F.response)===null||V===void 0?void 0:V.status)===422||((Z=F.request)===null||Z===void 0?void 0:Z.status)===422))return[3,7];throw console.log("ERROR: Throwing error",F.response.status),F;case 7:return E<=r.MAX_RETRY_DELAY?[4,new Promise(function(H){return setTimeout(H,E)})]:[3,10];case 8:return G.sent(),E*=2,[4,Q(E,d,B,p,f,m,v,x)];case 9:return G.sent(),[3,11];case 10:throw F;case 11:return[3,12];case 12:return[2]}})})},h=function(E,d,B,p,f,m,v,w){return B===void 0&&(B=r.INITIAL_RETRY_DELAY),p===void 0&&(p=r.INITIAL_RETRY_DELAY),e(void 0,void 0,void 0,function(){var x,b,T;return t(this,function(M){switch(M.label){case 0:return M.trys.push([0,4,,5]),x=(0,o.isTokenInExpiryWindow)(),x?(b=(0,o.getRandomDelay)(),[4,(0,o.introduceDelay)(b)]):[3,3];case 1:return M.sent(),[4,(0,a.coalesceTokenFetch)((0,a.buildTokenFetchKey)(d.userId,d.usergroupId,m),function(){return Q(B,p,f,E,d,m,v,w)})];case 2:M.sent(),M.label=3;case 3:return[3,5];case 4:throw T=M.sent(),T;case 5:return[2]}})})},I=function(E,d,B,p,f,m,v){return e(void 0,void 0,void 0,function(){var w,x,b,T,M,_;return t(this,function(R){switch(R.label){case 0:i=E,s=d,w=r.INITIAL_RETRY_DELAY,x=r.INITIAL_RETRY_DELAY,b=0,T=(0,o.getConfig)(i,s),R.label=1;case 1:return R.trys.push([1,3,,4]),[4,(0,a.coalesceTokenFetch)((0,a.buildTokenFetchKey)(B.userId,B.usergroupId,p),function(){return Q(w,x,b,T,B,p,f,m,v)})];case 2:return R.sent(),clearInterval(c),c=setInterval(function(){return h(T,B,r.INITIAL_RETRY_DELAY,r.INITIAL_RETRY_DELAY,0,p,f,v)},r.REFETCH_CHECK_DELAY),M=function(){return e(void 0,void 0,void 0,function(){return t(this,function(F){switch(F.label){case 0:return[4,h(T,B,r.INITIAL_RETRY_DELAY,r.INITIAL_RETRY_DELAY,0,p,f,v)];case 1:return F.sent(),[2]}})})},(0,A.subscribeToOnlineEvent)(M),[3,4];case 3:return _=R.sent(),console.log("ERROR: Fetching token failed",_),[3,4];case 4:return[2]}})})};return ii.fetchAccessToken=I,ii}var Tf;function Df(){if(Tf)return Ko;Tf=1;var e=Ze&&Ze.__assign||function(){return e=Object.assign||function(E){for(var d,B=1,p=arguments.length;B<p;B++){d=arguments[B];for(var f in d)Object.prototype.hasOwnProperty.call(d,f)&&(E[f]=d[f])}return E},e.apply(this,arguments)},t=Ze&&Ze.__awaiter||function(E,d,B,p){function f(m){return m instanceof B?m:new B(function(v){v(m)})}return new(B||(B=Promise))(function(m,v){function w(T){try{b(p.next(T))}catch(M){v(M)}}function x(T){try{b(p.throw(T))}catch(M){v(M)}}function b(T){T.done?m(T.value):f(T.value).then(w,x)}b((p=p.apply(E,d||[])).next())})},n=Ze&&Ze.__generator||function(E,d){var B={label:0,sent:function(){if(m[0]&1)throw m[1];return m[1]},trys:[],ops:[]},p,f,m,v;return v={next:w(0),throw:w(1),return:w(2)},typeof Symbol=="function"&&(v[Symbol.iterator]=function(){return this}),v;function w(b){return function(T){return x([b,T])}}function x(b){if(p)throw new TypeError("Generator is already executing.");for(;v&&(v=0,b[0]&&(B=0)),B;)try{if(p=1,f&&(m=b[0]&2?f.return:b[0]?f.throw||((m=f.return)&&m.call(f),0):f.next)&&!(m=m.call(f,b[1])).done)return m;switch(f=0,m&&(b=[b[0]&2,m.value]),b[0]){case 0:case 1:m=b;break;case 4:return B.label++,{value:b[1],done:!1};case 5:B.label++,f=b[1],b=[0];continue;case 7:b=B.ops.pop(),B.trys.pop();continue;default:if(m=B.trys,!(m=m.length>0&&m[m.length-1])&&(b[0]===6||b[0]===2)){B=0;continue}if(b[0]===3&&(!m||b[1]>m[0]&&b[1]<m[3])){B.label=b[1];break}if(b[0]===6&&B.label<m[1]){B.label=m[1],m=b;break}if(m&&B.label<m[2]){B.label=m[2],B.ops.push(b);break}m[2]&&B.ops.pop(),B.trys.pop();continue}b=d.call(E,B)}catch(T){b=[6,T],f=0}finally{p=m=0}if(b[0]&5)throw b[1];return{value:b[0]?b[1]:void 0,done:!0}}};Object.defineProperty(Ko,"__esModule",{value:!0}),Ko.hiverAxiosCall=Ko.performAxiosCall=void 0;var r=mf,o=gt,A=Sf(),a=_r,i=Mr,s,c=2,l=function(E,d){var B=d.fetchCsrfToken();E.formData?E.formData.append("_csrf_token",B):(E.data=E.data||{},E.data._csrf_token=B)},C=function(E,d){var B={};!E.method||E.method.toLowerCase()==="get"?B={params:E.params?E.params:E.data}:B=E.params?{params:E,data:E.data}:{data:E.data};var p=e(e({method:E.method,url:"".concat(E.root_url).concat(E.url),headers:E.headers},B),{withCredentials:d,responseType:(E==null?void 0:E.responseType)||""});return p};function Q(E,d){return d===void 0&&(d=!0),t(this,void 0,void 0,function(){var B;return n(this,function(p){return B=C(E,d),[2,(0,r.default)(B).then(function(f){return f}).catch(function(f){throw f})]})})}Ko.performAxiosCall=Q;function h(E,d,B){return t(this,void 0,void 0,function(){var p,f;return n(this,function(m){switch(m.label){case 0:return p=E.appEnv,f=E.tier,[4,(0,A.fetchAccessToken)(p,f,d,E.tenantPlatform,E.getTokenForLogin,B)];case 1:return m.sent(),[2]}})})}function I(E,d,B,p,f){var m,v,w,x;return f===void 0&&(f=0),t(this,void 0,void 0,function(){var b,T,M,_,R,F,O,j;return n(this,function(W){switch(W.label){case 0:if(W.trys.push([0,4,,5]),!(B.getToken&&!(0,o.hasValidToken)(d)))return[3,2];if(b=E.appEnv,T=E.tier,!b||!T)throw Error("appEnv or tier missing : ".concat(b,"/").concat(T));return"userId"in d&&"usergroupId"in d?(M={userId:d.userId,usergroupId:d.usergroupId},[4,h(E,M,p)]):[3,2];case 1:W.sent(),W.label=2;case 2:return E.csrfToken&&l(d,B),_=E.tenantPlatform===i.TENANT_PLATFORM.HIVERWEB?i.TENANT_PLATFORM.HIVERWEB:i.TENANT_PLATFORM.GMAIL,d.headers=e(e({},d.headers),{"x-hiver-tenant":_,"x-hiver-userid":(0,a.getItemFromStorage)("hiverAuthUserId")||"0","x-hiver-usergroupid":(0,a.getItemFromStorage)("hiverAuthUserGroupId")||"0"}),B.getToken&&(s=(0,a.getItemFromStorage)("hiverAuthToken")||"",d.headers=e(e({},d.headers),{Authorization:"Bearer ".concat(s)})),[4,Q(d,E.withCredentials)];case 3:return R=W.sent(),d.onSuccess&&d.onSuccess(R),[2,R];case 4:if(F=W.sent(),O=((m=F.response)===null||m===void 0?void 0:m.status)===403||((v=F.request)===null||v===void 0?void 0:v.status)===403,j=((w=F.response)===null||w===void 0?void 0:w.status)===401||((x=F.request)===null||x===void 0?void 0:x.status)===401,f<c&&(O||j))return(0,o.expireToken)(),[2,I(E,d,B,p,f+1)];if(f>=c&&O||!O)throw d.onFail&&d.onFail(F),console.log("ERROR: Reached make Axios",F),F;return[3,5];case 5:return[2]}})})}return Ko.hiverAxiosCall=I,Ko}var si={},Ot={},_t={};Object.defineProperty(_t,"__esModule",{value:!0}),_t.TIERS=_t.APP_UI=_t.CONFIG_HIVER=_t.GREXIT_ADMIN_DOMAIN=_t.REFETCH_CHECK_DELAY=_t.INITIAL_RETRY_DELAY=_t.MAX_BACKOFF_LIMIT=_t.MAX_CONFLICT_RETRY_DELAY=_t.MAX_RETRY_DELAY=_t.GET_METHOD=void 0,_t.GET_METHOD="GET",_t.MAX_RETRY_DELAY=18e4,_t.MAX_CONFLICT_RETRY_DELAY=63e3,_t.MAX_BACKOFF_LIMIT=8e3,_t.INITIAL_RETRY_DELAY=1e3,_t.REFETCH_CHECK_DELAY=168e4,_t.GREXIT_ADMIN_DOMAIN="admin.hiverhq.com",_t.CONFIG_HIVER={getToken:!1,fetchCsrfToken:function(){return""},isHiverApiDomain:!0},_t.APP_UI={COLLAB_SPACE:"collab-space",DEFAULT:"default"},_t.TIERS={DEV:"dev",SIT:"sit",PROD:"production"};var Vn={};Object.defineProperty(Vn,"__esModule",{value:!0}),Vn.getProdHqConfig=Vn.getProdApiConfig=Vn.getSitHqConfig=Vn.getSitApiConfig=Vn.getDevHqConfig=Vn.getDevApiConfig=void 0;var NA={heimdallTokenFetch:"/v1/token/get",heimdallLogin:"/v1/login/code",v2Login:"/api/auth/login/code"},C2=function(){return{v2Url:"https://v2dev.hiver.space",heimdallUrl:"https://dev.hiver.space/api/heimdall-api",apiEndpoints:NA}};Vn.getDevApiConfig=C2;var E2=function(){return{v2Url:"https://v2dev.hiver.space",heimdallUrl:"https://dev.hiver.space/api/heimdall-api2",apiEndpoints:NA}};Vn.getDevHqConfig=E2;var f2=function(e){return{v2Url:"https://v2".concat(e,".hiver.space"),heimdallUrl:"https://".concat(e,".hiver.space/api/heimdall-api"),apiEndpoints:NA}};Vn.getSitApiConfig=f2;var I2=function(e){return{v2Url:"https://v2".concat(e,".hiver.space"),heimdallUrl:"https://".concat(e,".hiver.space/api/heimdall-api2"),apiEndpoints:NA}};Vn.getSitHqConfig=I2;var p2=function(e){return e===void 0&&(e=!1),{v2Url:e?"https://admin.hiverhq.com":"https://v2.hiverhq.com",heimdallUrl:"https://heimdall.hiverapi.com",apiEndpoints:NA}};Vn.getProdApiConfig=p2;var B2=function(e){return e===void 0&&(e=!1),{v2Url:e?"https://admin.hiverhq.com":"https://v2.hiverhq.com",heimdallUrl:"https://heimdall2.hiverhq.com",apiEndpoints:NA}};Vn.getProdHqConfig=B2;var h2=Ze&&Ze.__awaiter||function(e,t,n,r){function o(A){return A instanceof n?A:new n(function(a){a(A)})}return new(n||(n=Promise))(function(A,a){function i(l){try{c(r.next(l))}catch(C){a(C)}}function s(l){try{c(r.throw(l))}catch(C){a(C)}}function c(l){l.done?A(l.value):o(l.value).then(i,s)}c((r=r.apply(e,t||[])).next())})},Q2=Ze&&Ze.__generator||function(e,t){var n={label:0,sent:function(){if(A[0]&1)throw A[1];return A[1]},trys:[],ops:[]},r,o,A,a;return a={next:i(0),throw:i(1),return:i(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function i(c){return function(l){return s([c,l])}}function s(c){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(n=0)),n;)try{if(r=1,o&&(A=c[0]&2?o.return:c[0]?o.throw||((A=o.return)&&A.call(o),0):o.next)&&!(A=A.call(o,c[1])).done)return A;switch(o=0,A&&(c=[c[0]&2,A.value]),c[0]){case 0:case 1:A=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,o=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(A=n.trys,!(A=A.length>0&&A[A.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!A||c[1]>A[0]&&c[1]<A[3])){n.label=c[1];break}if(c[0]===6&&n.label<A[1]){n.label=A[1],A=c;break}if(A&&n.label<A[2]){n.label=A[2],n.ops.push(c);break}A[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(l){c=[6,l],o=0}finally{r=A=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(Ot,"__esModule",{value:!0}),Ot.expireToken=Ot.validateToken=Ot.validateAccount=Ot.getConfig=Ot.introduceDelay=Ot.isTokenInExpiryWindow=Ot.getStoredAuthData=Ot.setUserDetails=Ot.setTokenAndExpiry=Ot.getRandomDelay=Ot.hasValidToken=void 0;var Rs=_t,RA=Vn,Of=function(){var e=new Date,t=new Date(e.getTime()+e.getTimezoneOffset()*6e4);return t},Bu=function(e){var t=parseInt(sessionStorage.getItem("hiverAuthUserId")||"0"),n=parseInt(sessionStorage.getItem("hiverAuthUserGroupId")||"0"),r=e.userId,o=e.usergroupId;return t===r&&o===n};Ot.validateAccount=Bu;var m2=function(e){var t=Bu(e);return!Ff()&&t};Ot.validateToken=m2;var b2=function(){try{sessionStorage.removeItem("hiverAuthTokenExpiry")}catch{console.log("Heimdall: Unable to Remove token.")}};Ot.expireToken=b2;var y2=function(e){var t=sessionStorage.getItem("hiverAuthTokenExpiry")||"",n=new Date(t),r=Of(),o=Bu(e);return r<n&&o};Ot.hasValidToken=y2;var v2=function(){return Math.floor(Math.random()*6e4)+6e4};Ot.getRandomDelay=v2;var x2=function(e,t){if(!e||!t)throw new Error("User Id or user group Id not found in the response");sessionStorage.setItem("hiverAuthUserId",e),sessionStorage.setItem("hiverAuthUserGroupId",t)};Ot.setUserDetails=x2;var w2=function(e,t){if(!e)throw new Error("Token not found in the response");sessionStorage.setItem("hiverAuthToken",e),sessionStorage.setItem("hiverAuthTokenExpiry",t)};Ot.setTokenAndExpiry=w2;var S2=function(){var e=sessionStorage.getItem("hiverAuthTokenExpiry"),t=sessionStorage.getItem("hiverAuthToken"),n=sessionStorage.getItem("hiverAuthUserId"),r=sessionStorage.getItem("hiverAuthUserGroupId");return{token:t,expiryTime:e,userId:n,usergroupId:r}};Ot.getStoredAuthData=S2;var Ff=function(){var e=sessionStorage.getItem("hiverAuthTokenExpiry")||"";if(!e)return!0;var t=Of(),n=new Date(e),r=4*60*1e3,o=n.getTime()-t.getTime()<r;return o};Ot.isTokenInExpiryWindow=Ff;var T2=function(e){return h2(void 0,void 0,void 0,function(){return Q2(this,function(t){switch(t.label){case 0:return[4,new Promise(function(n){return setTimeout(n,e)})];case 1:return t.sent(),[2]}})})};Ot.introduceDelay=T2;var D2=function(){return window.location.host===Rs.GREXIT_ADMIN_DOMAIN},O2=function(e,t,n){var r=D2();switch(t){case Rs.TIERS.SIT:return n?(0,RA.getSitApiConfig)(e):(0,RA.getSitHqConfig)(e);case Rs.TIERS.PROD:return n?(0,RA.getProdApiConfig)(r):(0,RA.getProdHqConfig)(r);case Rs.TIERS.DEV:default:return n?(0,RA.getDevApiConfig)():(0,RA.getDevHqConfig)()}};Ot.getConfig=O2;var ci={},to={},Mf;function F2(){if(Mf)return to;Mf=1;var e=Ze&&Ze.__awaiter||function(h,I,E,d){function B(p){return p instanceof E?p:new E(function(f){f(p)})}return new(E||(E=Promise))(function(p,f){function m(x){try{w(d.next(x))}catch(b){f(b)}}function v(x){try{w(d.throw(x))}catch(b){f(b)}}function w(x){x.done?p(x.value):B(x.value).then(m,v)}w((d=d.apply(h,I||[])).next())})},t=Ze&&Ze.__generator||function(h,I){var E={label:0,sent:function(){if(p[0]&1)throw p[1];return p[1]},trys:[],ops:[]},d,B,p,f;return f={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function m(w){return function(x){return v([w,x])}}function v(w){if(d)throw new TypeError("Generator is already executing.");for(;f&&(f=0,w[0]&&(E=0)),E;)try{if(d=1,B&&(p=w[0]&2?B.return:w[0]?B.throw||((p=B.return)&&p.call(B),0):B.next)&&!(p=p.call(B,w[1])).done)return p;switch(B=0,p&&(w=[w[0]&2,p.value]),w[0]){case 0:case 1:p=w;break;case 4:return E.label++,{value:w[1],done:!1};case 5:E.label++,B=w[1],w=[0];continue;case 7:w=E.ops.pop(),E.trys.pop();continue;default:if(p=E.trys,!(p=p.length>0&&p[p.length-1])&&(w[0]===6||w[0]===2)){E=0;continue}if(w[0]===3&&(!p||w[1]>p[0]&&w[1]<p[3])){E.label=w[1];break}if(w[0]===6&&E.label<p[1]){E.label=p[1],p=w;break}if(p&&E.label<p[2]){E.label=p[2],E.ops.push(w);break}p[2]&&E.ops.pop(),E.trys.pop();continue}w=I.call(h,E)}catch(x){w=[6,x],B=0}finally{d=p=0}if(w[0]&5)throw w[1];return{value:w[0]?w[1]:void 0,done:!0}}};Object.defineProperty(to,"__esModule",{value:!0}),to.getV2LoginCode=to.getLoginToken=to.getAccessToken=void 0;var n=_t,r=Nf(),o=Ot,A=Mr,a=function(h,I,E){var d,B=(0,o.getStoredAuthData)();return{root_url:h.heimdallUrl,url:h.apiEndpoints.heimdallTokenFetch,method:n.GET_METHOD,data:{user_id:I.userId,usergroup_id:I.usergroupId,access_token:(B==null?void 0:B.token)||"",source:E},withCredentials:!0,tenant:(d=I.tenant)!==null&&d!==void 0?d:A.TENANT_PLATFORM.GMAIL}},i=function(h,I,E){var d;return{root_url:I.heimdallUrl,url:I.apiEndpoints.heimdallLogin,method:n.GET_METHOD,data:{code:h},withCredentials:!0,tenant:(d=E.tenant)!==null&&d!==void 0?d:A.TENANT_PLATFORM.GMAIL}},s=function(h){return parseInt(h,10)},c=function(h,I,E){var d;return{root_url:h.v2Url,url:h.apiEndpoints.v2Login,method:n.GET_METHOD,withCredentials:!0,data:{usersession:s(localStorage.getItem("hiver-config.usersession")),app:E||n.APP_UI.DEFAULT},tenant:(d=I.tenant)!==null&&d!==void 0?d:A.TENANT_PLATFORM.GMAIL}},l=function(h,I,E,d){return e(void 0,void 0,void 0,function(){var B,p,f,m,v,w,x;return t(this,function(b){switch(b.label){case 0:return b.trys.push([0,4,,5]),(0,o.validateToken)(E)?[3,2]:(B=a(I,E,d),[4,(0,r.makeAxiosCall)(B,h)]);case 1:return p=b.sent(),[2,{atToken:(m=p==null?void 0:p.data.at)===null||m===void 0?void 0:m.token,expiryTime:(v=p==null?void 0:p.data.at)===null||v===void 0?void 0:v.expires_at,userId:(w=p==null?void 0:p.data)===null||w===void 0?void 0:w.user_id,userGroupId:(x=p==null?void 0:p.data)===null||x===void 0?void 0:x.usergroup_id}];case 2:return[2,{}];case 3:return[3,5];case 4:throw f=b.sent(),f;case 5:return[2]}})})};to.getAccessToken=l;var C=function(h,I,E,d){return e(void 0,void 0,void 0,function(){var B,p,f,m,v,w,x;return t(this,function(b){switch(b.label){case 0:B=i(h,E,d),b.label=1;case 1:return b.trys.push([1,3,,4]),[4,(0,r.makeAxiosCall)(B,I)];case 2:return p=b.sent(),[2,{userId:(m=p==null?void 0:p.data)===null||m===void 0?void 0:m.user_id,userGroupId:(v=p==null?void 0:p.data)===null||v===void 0?void 0:v.usergroup_id,atToken:(w=p==null?void 0:p.data.at)===null||w===void 0?void 0:w.token,expiryTime:(x=p==null?void 0:p.data.at)===null||x===void 0?void 0:x.expires_at}];case 3:throw f=b.sent(),f;case 4:return[2]}})})};to.getLoginToken=C;var Q=function(h,I,E,d){return e(void 0,void 0,void 0,function(){var B,p,f;return t(this,function(m){switch(m.label){case 0:return m.trys.push([0,2,,3]),console.log("ERROR debug: in getV2loginCode:",d),B=c(I,E,d),[4,(0,r.makeAxiosCall)(B,h)];case 1:return p=m.sent(),[2,p==null?void 0:p.data.code];case 2:throw f=m.sent(),f;case 3:return[2]}})})};return to.getV2LoginCode=Q,to}var _f;function Pf(){if(_f)return ci;_f=1;var e=Ze&&Ze.__awaiter||function(I,E,d,B){function p(f){return f instanceof d?f:new d(function(m){m(f)})}return new(d||(d=Promise))(function(f,m){function v(b){try{x(B.next(b))}catch(T){m(T)}}function w(b){try{x(B.throw(b))}catch(T){m(T)}}function x(b){b.done?f(b.value):p(b.value).then(v,w)}x((B=B.apply(I,E||[])).next())})},t=Ze&&Ze.__generator||function(I,E){var d={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},B,p,f,m;return m={next:v(0),throw:v(1),return:v(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function v(x){return function(b){return w([x,b])}}function w(x){if(B)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(d=0)),d;)try{if(B=1,p&&(f=x[0]&2?p.return:x[0]?p.throw||((f=p.return)&&f.call(p),0):p.next)&&!(f=f.call(p,x[1])).done)return f;switch(p=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return d.label++,{value:x[1],done:!1};case 5:d.label++,p=x[1],x=[0];continue;case 7:x=d.ops.pop(),d.trys.pop();continue;default:if(f=d.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){d=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){d.label=x[1];break}if(x[0]===6&&d.label<f[1]){d.label=f[1],f=x;break}if(f&&d.label<f[2]){d.label=f[2],d.ops.push(x);break}f[2]&&d.ops.pop(),d.trys.pop();continue}x=E.call(I,d)}catch(b){x=[6,b],p=0}finally{B=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}};Object.defineProperty(ci,"__esModule",{value:!0}),ci.fetchToken=void 0;var n=F2(),r=_t,o=Ot,A=tA,a,i,s,c=function(I,E,d,B){return B===void 0&&(B=r.APP_UI.DEFAULT),e(void 0,void 0,void 0,function(){var p,f,m,v,w,x,b,T,M;return t(this,function(_){switch(_.label){case 0:p=2,_.label=1;case 1:return _.trys.push([1,4,,9]),[4,(0,n.getV2LoginCode)(r.CONFIG_HIVER,I,d,B)];case 2:return f=_.sent(),[4,(0,n.getLoginToken)(f,r.CONFIG_HIVER,I,d)];case 3:return m=_.sent(),v=m.userId,w=m.userGroupId,x=m.atToken,b=m.expiryTime,(0,o.setTokenAndExpiry)(x,b),(0,o.setUserDetails)(v,w),[3,9];case 4:T=_.sent(),console.log("ERROR debug: in error login:",T,B),M=E,_.label=5;case 5:return M<p?[4,c(I,M+1,d,B)]:[3,8];case 6:_.sent(),_.label=7;case 7:return M++,[3,5];case 8:throw T;case 9:return[2]}})})},l=function(I,E,d){return e(void 0,void 0,void 0,function(){var B,p,f,m;return t(this,function(v){switch(v.label){case 0:return E<r.MAX_CONFLICT_RETRY_DELAY?[4,new Promise(function(w){return setTimeout(w,I)})]:[3,3];case 1:return v.sent(),E+=I,I*2<=r.MAX_BACKOFF_LIMIT?I*=2:I=r.MAX_BACKOFF_LIMIT,B=d.retryDelay,p=d.configs,f=d.api_params,m=d.appUI,[4,C(B,I,E,p,f,m)];case 2:v.sent(),v.label=3;case 3:return[2]}})})},C=function(I,E,d,B,p,f,m){return f===void 0&&(f="default"),e(void 0,void 0,void 0,function(){var v,w,x,b,T,M,_,R,F,O,j,W,ne,K;return t(this,function(U){switch(U.label){case 0:return U.trys.push([0,2,,12]),[4,(0,n.getAccessToken)(r.CONFIG_HIVER,B,p,f)];case 1:return v=U.sent(),w=v.atToken,x=v.expiryTime,b=v.userId,T=v.userGroupId,w&&x&&(0,o.setTokenAndExpiry)(w,x),b&&T&&(0,o.setUserDetails)(b,T),I=r.INITIAL_RETRY_DELAY,E=r.INITIAL_RETRY_DELAY,d=0,[3,12];case 2:return M=U.sent(),((F=M.response)===null||F===void 0?void 0:F.status)===401||((O=M.request)===null||O===void 0?void 0:O.status)===401?(_=1,[4,c(B,_,p,m)]):[3,4];case 3:return U.sent(),[3,11];case 4:return((j=M.response)===null||j===void 0?void 0:j.status)===409||((W=M.request)===null||W===void 0?void 0:W.status)===409?(R={retryDelay:I,configs:B,api_params:p,appUI:m},[4,l(E,d,R)]):[3,6];case 5:if(U.sent(),d>=r.MAX_CONFLICT_RETRY_DELAY)throw M;return[3,11];case 6:if(!(((ne=M.response)===null||ne===void 0?void 0:ne.status)===422||((K=M.request)===null||K===void 0?void 0:K.status)===422))return[3,7];throw console.log("ERROR: Throwing error",M.response.status),M;case 7:return I<=r.MAX_RETRY_DELAY?[4,new Promise(function(V){return setTimeout(V,I)})]:[3,10];case 8:return U.sent(),I*=2,console.log("Heimdall: Fetch token post doubling retry delay",I),[4,C(I,E,d,B,p,m)];case 9:return U.sent(),[3,11];case 10:throw M;case 11:return[3,12];case 12:return[2]}})})},Q=function(I,E,d,B,p,f){return d===void 0&&(d=r.INITIAL_RETRY_DELAY),B===void 0&&(B=r.INITIAL_RETRY_DELAY),p===void 0&&(p=0),e(void 0,void 0,void 0,function(){var m,v,w;return t(this,function(x){switch(x.label){case 0:return x.trys.push([0,4,,5]),m=(0,o.isTokenInExpiryWindow)(),m?(v=(0,o.getRandomDelay)(),[4,(0,o.introduceDelay)(v)]):[3,3];case 1:return x.sent(),[4,(0,A.coalesceTokenFetch)((0,A.buildTokenFetchKey)(E.userId,E.usergroupId,E.tenant),function(){return C(d,B,p,I,E,f)})];case 2:x.sent(),x.label=3;case 3:return[3,5];case 4:throw w=x.sent(),w;case 5:return[2]}})})},h=function(I,E,d,B,p,f){return e(void 0,void 0,void 0,function(){var m,v,w,x,b;return t(this,function(T){switch(T.label){case 0:a=I,i=E,m=r.INITIAL_RETRY_DELAY,v=r.INITIAL_RETRY_DELAY,w=0,x=(0,o.getConfig)(a,i,B),T.label=1;case 1:return T.trys.push([1,3,,4]),[4,(0,A.coalesceTokenFetch)((0,A.buildTokenFetchKey)(d.userId,d.usergroupId,d.tenant),function(){return C(m,v,w,x,d,p,f)})];case 2:return T.sent(),clearInterval(s),s=setInterval(function(){return Q(x,d)},r.REFETCH_CHECK_DELAY),window.addEventListener("online",function(){return e(void 0,void 0,void 0,function(){return t(this,function(M){switch(M.label){case 0:return[4,Q(x,d)];case 1:return M.sent(),[2]}})})}),[3,4];case 3:throw b=T.sent(),b;case 4:return[2]}})})};return ci.fetchToken=h,ci}var Lf;function Nf(){if(Lf)return si;Lf=1;var e=Ze&&Ze.__assign||function(){return e=Object.assign||function(I){for(var E,d=1,B=arguments.length;d<B;d++){E=arguments[d];for(var p in E)Object.prototype.hasOwnProperty.call(E,p)&&(I[p]=E[p])}return I},e.apply(this,arguments)},t=Ze&&Ze.__awaiter||function(I,E,d,B){function p(f){return f instanceof d?f:new d(function(m){m(f)})}return new(d||(d=Promise))(function(f,m){function v(b){try{x(B.next(b))}catch(T){m(T)}}function w(b){try{x(B.throw(b))}catch(T){m(T)}}function x(b){b.done?f(b.value):p(b.value).then(v,w)}x((B=B.apply(I,E||[])).next())})},n=Ze&&Ze.__generator||function(I,E){var d={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},B,p,f,m;return m={next:v(0),throw:v(1),return:v(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function v(x){return function(b){return w([x,b])}}function w(x){if(B)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(d=0)),d;)try{if(B=1,p&&(f=x[0]&2?p.return:x[0]?p.throw||((f=p.return)&&f.call(p),0):p.next)&&!(f=f.call(p,x[1])).done)return f;switch(p=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return d.label++,{value:x[1],done:!1};case 5:d.label++,p=x[1],x=[0];continue;case 7:x=d.ops.pop(),d.trys.pop();continue;default:if(f=d.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){d=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){d.label=x[1];break}if(x[0]===6&&d.label<f[1]){d.label=f[1],f=x;break}if(f&&d.label<f[2]){d.label=f[2],d.ops.push(x);break}f[2]&&d.ops.pop(),d.trys.pop();continue}x=E.call(I,d)}catch(b){x=[6,b],p=0}finally{B=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}};Object.defineProperty(si,"__esModule",{value:!0}),si.makeAxiosCall=void 0;var r=mf,o=Ot,A=Pf(),a=Mr,i,s=2,c=function(I,E){var d=E.fetchCsrfToken();I.formData?I.formData.append("_csrf_token",d):(I.data=I.data||{},I.data._csrf_token=d)},l=["/v1/token/get","/v1/login/code","/v1/logout"],C=function(I){var E,d,B,p,f=(E=I.tenant)!==null&&E!==void 0?E:a.TENANT_PLATFORM.GMAIL,m=!I.method||I.method.toLowerCase()==="get"?{params:e(e({},(d=I==null?void 0:I.data)!==null&&d!==void 0?d:{}),{tenant:f})}:{data:(I==null?void 0:I.data)instanceof FormData?I==null?void 0:I.data:e(e({},(B=I==null?void 0:I.data)!==null&&B!==void 0?B:{}),{tenant:f})},v=(I.url||"").split("?")[0],w=l.some(function(b){return v.endsWith(b)}),x=e(e({method:I.method,url:"".concat(I.root_url).concat(I.url),headers:e(e({},(p=I==null?void 0:I.headers)!==null&&p!==void 0?p:{}),w?{}:{"x-hiver-tenant":f})},m),{withCredentials:I.withCredentials,responseType:(I==null?void 0:I.responseType)||""});return x};function Q(I){return t(this,void 0,void 0,function(){var E;return n(this,function(d){return E=C(I),[2,(0,r.default)(E).then(function(B){return B}).catch(function(B){throw B})]})})}function h(I,E,d,B){var p,f;return B===void 0&&(B=0),t(this,void 0,void 0,function(){var m,v,w,x,b,T;return n(this,function(M){switch(M.label){case 0:if(M.trys.push([0,4,,5]),I.tenant||(I.tenant=a.TENANT_PLATFORM.GMAIL),!(E.getToken&&!(0,o.hasValidToken)(I)))return[3,2];if(m=I.app_env,v=I.tier,!m||!v)throw Error("app_env or tier missing : ".concat(m,"/").concat(v));return"userId"in I&&"usergroupId"in I?(w={userId:I.userId,usergroupId:I.usergroupId,tenant:I.tenant},typeof E.isHiverApiDomain!="boolean"&&(E.isHiverApiDomain=!0),[4,(0,A.fetchToken)(m,v,w,E.isHiverApiDomain,d)]):[3,2];case 1:M.sent(),M.label=2;case 2:return I.csrfToken&&c(I,E),E.getToken&&(i=sessionStorage.getItem("hiverAuthToken")||"",I.headers=e(e({},I.headers),{Authorization:"Bearer ".concat(i)})),[4,Q(I)];case 3:return x=M.sent(),I.onSuccess&&I.onSuccess(x),[2,x];case 4:if(b=M.sent(),T=((p=b.response)===null||p===void 0?void 0:p.status)===403||((f=b.request)===null||f===void 0?void 0:f.status)===403,B<s&&T)return(0,o.expireToken)(),[2,h(I,E,d,B+1)];if(B>=s&&T||!T)throw I.onFail&&I.onFail(b),console.log("ERROR: Reached make Axios",b),b;return[3,5];case 5:return[2]}})})}return si.makeAxiosCall=h,si}(function(e){var t=Ze&&Ze.__awaiter||function(h,I,E,d){function B(p){return p instanceof E?p:new E(function(f){f(p)})}return new(E||(E=Promise))(function(p,f){function m(x){try{w(d.next(x))}catch(b){f(b)}}function v(x){try{w(d.throw(x))}catch(b){f(b)}}function w(x){x.done?p(x.value):B(x.value).then(m,v)}w((d=d.apply(h,I||[])).next())})},n=Ze&&Ze.__generator||function(h,I){var E={label:0,sent:function(){if(p[0]&1)throw p[1];return p[1]},trys:[],ops:[]},d,B,p,f;return f={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function m(w){return function(x){return v([w,x])}}function v(w){if(d)throw new TypeError("Generator is already executing.");for(;f&&(f=0,w[0]&&(E=0)),E;)try{if(d=1,B&&(p=w[0]&2?B.return:w[0]?B.throw||((p=B.return)&&p.call(B),0):B.next)&&!(p=p.call(B,w[1])).done)return p;switch(B=0,p&&(w=[w[0]&2,p.value]),w[0]){case 0:case 1:p=w;break;case 4:return E.label++,{value:w[1],done:!1};case 5:E.label++,B=w[1],w=[0];continue;case 7:w=E.ops.pop(),E.trys.pop();continue;default:if(p=E.trys,!(p=p.length>0&&p[p.length-1])&&(w[0]===6||w[0]===2)){E=0;continue}if(w[0]===3&&(!p||w[1]>p[0]&&w[1]<p[3])){E.label=w[1];break}if(w[0]===6&&E.label<p[1]){E.label=p[1],p=w;break}if(p&&E.label<p[2]){E.label=p[2],E.ops.push(w);break}p[2]&&E.ops.pop(),E.trys.pop();continue}w=I.call(h,E)}catch(x){w=[6,x],B=0}finally{d=p=0}if(w[0]&5)throw w[1];return{value:w[0]?w[1]:void 0,done:!0}}};Object.defineProperty(e,"__esModule",{value:!0}),e.DEFAULT_INIT_CONFIG_HIVER=e.TENANT_PLATFORM=e.fetchToken=e.makeAxiosCall=e.Bifrost=void 0;var r=Df(),o=Sf(),A=Mr;Object.defineProperty(e,"TENANT_PLATFORM",{enumerable:!0,get:function(){return A.TENANT_PLATFORM}}),Object.defineProperty(e,"DEFAULT_INIT_CONFIG_HIVER",{enumerable:!0,get:function(){return A.DEFAULT_INIT_CONFIG_HIVER}});var a=vf(),i=gt,s=_r,c=Nf();Object.defineProperty(e,"makeAxiosCall",{enumerable:!0,get:function(){return c.makeAxiosCall}});var l=Pf();Object.defineProperty(e,"fetchToken",{enumerable:!0,get:function(){return l.fetchToken}});var C=Pr,Q=function(){function h(I,E,d,B,p,f){d===void 0&&(d=A.TENANT_PLATFORM.GMAIL),B===void 0&&(B=null),p===void 0&&(p=!0),f===void 0&&(f=!1),this.setEnvironment(),this.appEnv=I,this.tier=E,this.tenantPlatform=d,this.authTokenFetchingInProgress=!1,this.getTokenForLogin=B,this.withCredentials=p,this.csrfToken=f}return h.prototype.setEnvironment=function(){typeof window<"u"&&window.document?(0,C.setValue)("PLATFORM",A.PLATFORM.WEB):(0,C.setValue)("PLATFORM",A.PLATFORM.MOBILE)},h.prototype.hiverAxios=function(I,E,d,B){return E===void 0&&(E=A.DEFAULT_INIT_CONFIG_HIVER),t(this,void 0,void 0,function(){var p,f;return n(this,function(m){switch(m.label){case 0:return m.trys.push([0,4,,5]),B&&B<2?(p={userId:I.userId,usergroupId:I.usergroupId,apiRetry:B},[4,(0,o.fetchAccessToken)(this.appEnv,this.tier,p,this.tenantPlatform,this.getTokenForLogin,A.API_CALL_ORIGIN.API_RETRY)]):[3,2];case 1:m.sent(),m.label=2;case 2:return[4,(0,r.hiverAxiosCall)(this,I,E,d)];case 3:return[2,m.sent()];case 4:throw f=m.sent(),console.log("ERROR: Axios call failed",f),f;case 5:return[2]}})})},h.prototype.fetchAuthToken=function(I,E,d){return t(this,void 0,void 0,function(){return n(this,function(B){switch(B.label){case 0:return[4,(0,o.fetchAccessToken)(this.appEnv,this.tier,I,this.tenantPlatform,this.getTokenForLogin,E,d)];case 1:return B.sent(),[2]}})})},h.prototype.logout=function(){return t(this,void 0,void 0,function(){var I,E;return n(this,function(d){switch(d.label){case 0:return d.trys.push([0,2,,3]),I=(0,i.getConfig)(this.appEnv,this.tier),[4,(0,a.logoutFromHeimdall)(I,this.tenantPlatform)];case 1:return d.sent(),(0,s.removeItemFromStorage)("hiverAuthToken"),(0,s.removeItemFromStorage)("hiverAuthTokenExpiry"),(0,s.removeItemFromStorage)("hiverAuthUserId"),(0,s.removeItemFromStorage)("hiverAuthUserGroupId"),[3,3];case 2:throw E=d.sent(),console.error("Heimdall: Logout failed",E),E;case 3:return[2]}})})},h.prototype.isTokenFetchingInProgress=function(){return this.authTokenFetchingInProgress},h}();e.Bifrost=Q})(Ul);const ir={userId:"",userGroupId:"",baseUrl:"",appEnv:"",tier:"",bifrost:null,isInitiated:!1},br=()=>{if(!ir.isInitiated)return null;if(!ir.baseUrl)throw new Error("Base url is not setup. please call the initConnectorsBifrost function with the appropriate value");return ir},M2=({baseUrl:e,appEnv:t,tier:n,userId:r,userGroupId:o,tenantPlatform:A=Ul.TENANT_PLATFORM.GMAIL,withCredentials:a=!0,getTokenForLogin:i,onUserAuthRequired:s})=>{ir.baseUrl=e,ir.appEnv=t,ir.tier=n,ir.userGroupId=o,ir.userId=r,ir.tenantPlatform=A,ir.onUserAuthRequired=s,ir.bifrost=new Ul.Bifrost(t,n,A,i,a),ir.isInitiated=!0},_2="connector-logs-debug",Rf=()=>{},kf=()=>{var e;try{return((e=globalThis.localStorage)==null?void 0:e.getItem(_2))==="true"}catch{return!1}},li=e=>{var n;if(!kf())return Rf;const t=(n=globalThis.console)==null?void 0:n[e];return typeof t=="function"?t.bind(globalThis.console):Rf},pt={get log(){return li("debug")},get debug(){return li("debug")},get info(){return li("info")},get warn(){return li("warn")},get error(){return li("error")},get enabled(){return kf()}},Ue=(({configHiver:e})=>async n=>{var Q,h,I;const r=br();if(!r)throw new Error("Please call initConnectorsBifrost before making any api calls");const{bifrost:o,userGroupId:A,userId:a}=r,{url:i,method:s,root_url:c}=n,C={root_url:(c||r.baseUrl)+((n==null?void 0:n.prefix)||""),url:i,method:s,headers:n==null?void 0:n.headers,onSuccess:n==null?void 0:n.onSuccess,onFail:n==null?void 0:n.onFail,data:n==null?void 0:n.data,params:n==null?void 0:n.params,formData:n==null?void 0:n.formData,responseType:n==null?void 0:n.responseType,userId:Number(a),usergroupId:Number(A)};try{return await(o==null?void 0:o.hiverAxios(C,{...e,isHiverApiDomain:!0}))}catch(E){const d=E,B=(Q=d==null?void 0:d.response)==null?void 0:Q.status,p=(h=d==null?void 0:d.response)==null?void 0:h.data;if(B===412&&(p==null?void 0:p.error_code)==="USER_AUTH_REQUIRED")try{(I=r.onUserAuthRequired)==null||I.call(r,p)}catch(f){pt.error("onUserAuthRequired callback threw: ",f)}throw pt.error("API call failed with error: ",E),E}})({configHiver:{getToken:!0,fetchCsrfToken:()=>"",isHiverApiDomain:!0},withCredentials:!0}),P2="/v1/api"+"/templates/metadata",kA={GET:"GET",POST:"POST",DELETE:"DELETE",PATCH:"PATCH",PUT:"PUT"},L2="Invalid text",N2=async e=>{const t=new URLSearchParams,{inboxIds:n,channelType:r,conversationId:o,fetchAuthenticatedConnectors:A}=e||{};return n==null||n.forEach(i=>{t.append("inbox_ids",i)}),[["channel_type",r],["conversation_id",o],["fetch_authenticated_connectors",A==null?void 0:A.toString()]].forEach(([i,s])=>{s!==void 0&&t.append(i,s)}),Ue({url:`${P2}?${t.toString()}`,method:kA.GET})},R2="/v1/api/connectors/ug",k2=async(e,t)=>{const n=new URLSearchParams;for(const[a,i]of Object.entries(e||{}))if(Array.isArray(i))i.forEach(s=>{s&&n.append(a,String(s))});else{if(!i)continue;n.append(a,i)}n.append(t?"onlyEnabled":"onlyEnabledAuthenticated","true"),n.append("minimal","true");const r=R2+`?${n.toString()}`,o=await Ue({url:r,method:kA.GET}),A=o==null?void 0:o.data;return Array.isArray(A)?A.map(({id:a,name:i,logo:s,type:c,connectorType:l})=>({id:a,name:i,logo:s,type:c,connectorType:l})).filter(({logo:a})=>!!a):[]},j2=(e,t)=>{const n=new Map,r=(o,A)=>{o.forEach(a=>{const i=a==null?void 0:a.objectName;if(!i)return;const s=n.get(i)||{objectName:i,fieldsMap:new Map};((a==null?void 0:a.fields)||[]).forEach(c=>{const l=c==null?void 0:c.fieldKey;l&&(A||!s.fieldsMap.has(l))&&s.fieldsMap.set(l,c)}),n.set(i,s)})};return r(e,!0),r(t,!1),Array.from(n.values()).map(({objectName:o,fieldsMap:A})=>{const a=Array.from(A.values());return a.sort((i,s)=>i.fieldSource!==s.fieldSource?i.fieldSource==="TEMPLATE"?-1:1:(i.fieldLabel||"").toLowerCase().localeCompare((s.fieldLabel||"").toLowerCase())),{objectName:o,fields:a}}).filter(({fields:o})=>o.length>0)},jf=e=>e.flatMap(({objectName:t,fields:n=[]})=>n.map(r=>({id:`${t}::${r.fieldKey}`,value:`${t}::${r.fieldKey}`,displayName:`${t} - ${r.fieldLabel}`,objectName:t,fieldKey:r.fieldKey,fieldLabel:r.fieldLabel,fieldSource:r.fieldSource}))),V2=async e=>{var A,a;const[t,n]=await Promise.all([Ue({url:`/v1/api/connectors/${e}/object-fields/static`,method:kA.GET}),Ue({url:`/v1/api/connectors/${e}/object-fields/dynamic`,method:kA.GET})]),r=((A=t==null?void 0:t.data)==null?void 0:A.objects)??[],o=((a=n==null?void 0:n.data)==null?void 0:a.objects)??[];return jf(j2(r,o))},Vf=e=>{const t=e.filter(n=>{var r;return!!n.objectName&&(((r=n.fields)==null?void 0:r.length)??0)>0}).map(n=>{const r=(n.fields||[]).slice().sort((o,A)=>o.fieldSource!==A.fieldSource?o.fieldSource==="TEMPLATE"?-1:1:(o.fieldLabel||"").toLowerCase().localeCompare((A.fieldLabel||"").toLowerCase()));return{objectName:n.objectName,fields:r}});return jf(t)},G2=async e=>{var n;const t=await Ue({url:`/v1/api/connectors/${e}/object-fields/static`,method:kA.GET});return Vf(((n=t==null?void 0:t.data)==null?void 0:n.objects)??[])},H2=async e=>{var n;const t=await Ue({url:`/v1/api/connectors/${e}/object-fields/dynamic`,method:kA.GET});return Vf(((n=t==null?void 0:t.data)==null?void 0:n.objects)??[])};var jA=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(){}},nA=typeof window>"u"||"Deno"in globalThis;function sr(){}function W2(e,t){return typeof e=="function"?e(t):e}function hu(e){return typeof e=="number"&&e>=0&&e!==1/0}function Gf(e,t){return Math.max(e+(t||0)-Date.now(),0)}function VA(e,t){return typeof e=="function"?e(t):e}function yr(e,t){return typeof e=="function"?e(t):e}function Hf(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:A,queryKey:a,stale:i}=e;if(a){if(r){if(t.queryHash!==Qu(a,t.options))return!1}else if(!ui(t.queryKey,a))return!1}if(n!=="all"){const s=t.isActive();if(n==="active"&&!s||n==="inactive"&&s)return!1}return!(typeof i=="boolean"&&t.isStale()!==i||o&&o!==t.state.fetchStatus||A&&!A(t))}function Wf(e,t){const{exact:n,status:r,predicate:o,mutationKey:A}=e;if(A){if(!t.options.mutationKey)return!1;if(n){if(rA(t.options.mutationKey)!==rA(A))return!1}else if(!ui(t.options.mutationKey,A))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function Qu(e,t){return((t==null?void 0:t.queryKeyHashFn)||rA)(e)}function rA(e){return JSON.stringify(e,(t,n)=>bu(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function ui(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!ui(e[n],t[n])):!1}function mu(e,t){if(e===t)return e;const n=zf(e)&&zf(t);if(n||bu(e)&&bu(t)){const r=n?e:Object.keys(e),o=r.length,A=n?t:Object.keys(t),a=A.length,i=n?[]:{};let s=0;for(let c=0;c<a;c++){const l=n?c:A[c];(!n&&r.includes(l)||n)&&e[l]===void 0&&t[l]===void 0?(i[l]=void 0,s++):(i[l]=mu(e[l],t[l]),i[l]===e[l]&&e[l]!==void 0&&s++)}return o===a&&s===o?e:i}return t}function ks(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 zf(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function bu(e){if(!Yf(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Yf(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Yf(e){return Object.prototype.toString.call(e)==="[object Object]"}function z2(e){return new Promise(t=>{setTimeout(t,e)})}function yu(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 mu(e,t)}catch(r){console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`)}return mu(e,t)}return t}function Y2(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function J2(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var js=Symbol();function Jf(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===js&&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===js?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var X2=(Eb=class extends jA{constructor(){super();Ve(this,mA);Ve(this,Mo);Ve(this,Fa);De(this,Fa,t=>{if(!nA&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){N(this,Mo)||this.setEventListener(N(this,Fa))}onUnsubscribe(){var t;this.hasListeners()||((t=N(this,Mo))==null||t.call(this),De(this,Mo,void 0))}setEventListener(t){var n;De(this,Fa,t),(n=N(this,Mo))==null||n.call(this),De(this,Mo,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){N(this,mA)!==t&&(De(this,mA,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof N(this,mA)=="boolean"?N(this,mA):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},mA=new WeakMap,Mo=new WeakMap,Fa=new WeakMap,Eb),vu=new X2,Z2=(fb=class extends jA{constructor(){super();Ve(this,Ma,!0);Ve(this,_o);Ve(this,_a);De(this,_a,t=>{if(!nA&&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(){N(this,_o)||this.setEventListener(N(this,_a))}onUnsubscribe(){var t;this.hasListeners()||((t=N(this,_o))==null||t.call(this),De(this,_o,void 0))}setEventListener(t){var n;De(this,_a,t),(n=N(this,_o))==null||n.call(this),De(this,_o,t(this.setOnline.bind(this)))}setOnline(t){N(this,Ma)!==t&&(De(this,Ma,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return N(this,Ma)}},Ma=new WeakMap,_o=new WeakMap,_a=new WeakMap,fb),Vs=new Z2;function xu(){let e,t;const n=new Promise((o,A)=>{e=o,t=A});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 U2(e){return Math.min(1e3*2**e,3e4)}function Xf(e){return(e??"online")==="online"?Vs.isOnline():!0}var Zf=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function wu(e){return e instanceof Zf}function Uf(e){let t=!1,n=0,r=!1,o;const A=xu(),a=E=>{var d;r||(Q(new Zf(E)),(d=e.abort)==null||d.call(e))},i=()=>{t=!0},s=()=>{t=!1},c=()=>vu.isFocused()&&(e.networkMode==="always"||Vs.isOnline())&&e.canRun(),l=()=>Xf(e.networkMode)&&e.canRun(),C=E=>{var d;r||(r=!0,(d=e.onSuccess)==null||d.call(e,E),o==null||o(),A.resolve(E))},Q=E=>{var d;r||(r=!0,(d=e.onError)==null||d.call(e,E),o==null||o(),A.reject(E))},h=()=>new Promise(E=>{var d;o=B=>{(r||c())&&E(B)},(d=e.onPause)==null||d.call(e)}).then(()=>{var E;o=void 0,r||(E=e.onContinue)==null||E.call(e)}),I=()=>{if(r)return;let E;const d=n===0?e.initialPromise:void 0;try{E=d??e.fn()}catch(B){E=Promise.reject(B)}Promise.resolve(E).then(C).catch(B=>{var w;if(r)return;const p=e.retry??(nA?0:3),f=e.retryDelay??U2,m=typeof f=="function"?f(n,B):f,v=p===!0||typeof p=="number"&&n<p||typeof p=="function"&&p(n,B);if(t||!v){Q(B);return}n++,(w=e.onFail)==null||w.call(e,n,B),z2(m).then(()=>c()?void 0:h()).then(()=>{t?Q(B):I()})})};return{promise:A,cancel:a,continue:()=>(o==null||o(),A),cancelRetry:i,continueRetry:s,canStart:l,start:()=>(l()?I():h().then(I),A)}}function q2(){let e=[],t=0,n=i=>{i()},r=i=>{i()},o=i=>setTimeout(i,0);const A=i=>{t?e.push(i):o(()=>{n(i)})},a=()=>{const i=e;e=[],i.length&&o(()=>{r(()=>{i.forEach(s=>{n(s)})})})};return{batch:i=>{let s;t++;try{s=i()}finally{t--,t||a()}return s},batchCalls:i=>(...s)=>{A(()=>{i(...s)})},schedule:A,setNotifyFunction:i=>{n=i},setBatchNotifyFunction:i=>{r=i},setScheduler:i=>{o=i}}}var on=q2(),qf=(Ib=class{constructor(){Ve(this,bA)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),hu(this.gcTime)&&De(this,bA,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(nA?1/0:5*60*1e3))}clearGcTimeout(){N(this,bA)&&(clearTimeout(N(this,bA)),De(this,bA,void 0))}},bA=new WeakMap,Ib),K2=(pb=class extends qf{constructor(t){super();Ve(this,Dr);Ve(this,Pa);Ve(this,La);Ve(this,fr);Ve(this,yA);Ve(this,vn);Ve(this,Ki);Ve(this,vA);De(this,vA,!1),De(this,Ki,t.defaultOptions),this.setOptions(t.options),this.observers=[],De(this,yA,t.client),De(this,fr,N(this,yA).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,De(this,Pa,$2(this.options)),this.state=t.state??N(this,Pa),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=N(this,vn))==null?void 0:t.promise}setOptions(t){this.options={...N(this,Ki),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&N(this,fr).remove(this)}setData(t,n){const r=yu(this.state.data,t,this.options);return tt(this,Dr,Eo).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){tt(this,Dr,Eo).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=N(this,vn))==null?void 0:r.promise;return(o=N(this,vn))==null||o.cancel(t),n?n.then(sr).catch(sr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(N(this,Pa))}isActive(){return this.observers.some(t=>yr(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===js||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||!Gf(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=N(this,vn))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=N(this,vn))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),N(this,fr).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(N(this,vn)&&(N(this,vA)?N(this,vn).cancel({revert:!0}):N(this,vn).cancelRetry()),this.scheduleGc()),N(this,fr).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||tt(this,Dr,Eo).call(this,{type:"invalidate"})}fetch(t,n){var s,c,l;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(N(this,vn))return N(this,vn).continueRetry(),N(this,vn).promise}if(t&&this.setOptions(t),!this.options.queryFn){const C=this.observers.find(Q=>Q.options.queryFn);C&&this.setOptions(C.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=C=>{Object.defineProperty(C,"signal",{enumerable:!0,get:()=>(De(this,vA,!0),r.signal)})},A=()=>{const C=Jf(this.options,n),Q={client:N(this,yA),queryKey:this.queryKey,meta:this.meta};return o(Q),De(this,vA,!1),this.options.persister?this.options.persister(C,Q,this):C(Q)},a={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:N(this,yA),state:this.state,fetchFn:A};o(a),(s=this.options.behavior)==null||s.onFetch(a,this),De(this,La,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((c=a.fetchOptions)==null?void 0:c.meta))&&tt(this,Dr,Eo).call(this,{type:"fetch",meta:(l=a.fetchOptions)==null?void 0:l.meta});const i=C=>{var Q,h,I,E;wu(C)&&C.silent||tt(this,Dr,Eo).call(this,{type:"error",error:C}),wu(C)||((h=(Q=N(this,fr).config).onError)==null||h.call(Q,C,this),(E=(I=N(this,fr).config).onSettled)==null||E.call(I,this.state.data,C,this)),this.scheduleGc()};return De(this,vn,Uf({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:C=>{var Q,h,I,E;if(C===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}`),i(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(C)}catch(d){i(d);return}(h=(Q=N(this,fr).config).onSuccess)==null||h.call(Q,C,this),(E=(I=N(this,fr).config).onSettled)==null||E.call(I,C,this.state.error,this),this.scheduleGc()},onError:i,onFail:(C,Q)=>{tt(this,Dr,Eo).call(this,{type:"failed",failureCount:C,error:Q})},onPause:()=>{tt(this,Dr,Eo).call(this,{type:"pause"})},onContinue:()=>{tt(this,Dr,Eo).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0})),N(this,vn).start()}},Pa=new WeakMap,La=new WeakMap,fr=new WeakMap,yA=new WeakMap,vn=new WeakMap,Ki=new WeakMap,vA=new WeakMap,Dr=new WeakSet,Eo=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,...Kf(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 wu(o)&&o.revert&&N(this,La)?{...N(this,La),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),on.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),N(this,fr).notify({query:this,type:"updated",action:t})})},pb);function Kf(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Xf(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function $2(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 ew=(Bb=class extends jA{constructor(t={}){super();Ve(this,Xr);this.config=t,De(this,Xr,new Map)}build(t,n,r){const o=n.queryKey,A=n.queryHash??Qu(o,n);let a=this.get(A);return a||(a=new K2({client:t,queryKey:o,queryHash:A,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(a)),a}add(t){N(this,Xr).has(t.queryHash)||(N(this,Xr).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=N(this,Xr).get(t.queryHash);n&&(t.destroy(),n===t&&N(this,Xr).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){on.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return N(this,Xr).get(t)}getAll(){return[...N(this,Xr).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Hf(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Hf(t,r)):n}notify(t){on.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){on.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){on.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Xr=new WeakMap,Bb),tw=(hb=class extends qf{constructor(t){super();Ve(this,Ur);Ve(this,Zr);Ve(this,Ln);Ve(this,xA);this.mutationId=t.mutationId,De(this,Ln,t.mutationCache),De(this,Zr,[]),this.state=t.state||$f(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){N(this,Zr).includes(t)||(N(this,Zr).push(t),this.clearGcTimeout(),N(this,Ln).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){De(this,Zr,N(this,Zr).filter(n=>n!==t)),this.scheduleGc(),N(this,Ln).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){N(this,Zr).length||(this.state.status==="pending"?this.scheduleGc():N(this,Ln).remove(this))}continue(){var t;return((t=N(this,xA))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,A,a,i,s,c,l,C,Q,h,I,E,d,B,p,f,m,v,w,x;De(this,xA,Uf({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(b,T)=>{tt(this,Ur,Yo).call(this,{type:"failed",failureCount:b,error:T})},onPause:()=>{tt(this,Ur,Yo).call(this,{type:"pause"})},onContinue:()=>{tt(this,Ur,Yo).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>N(this,Ln).canRun(this)}));const n=this.state.status==="pending",r=!N(this,xA).canStart();try{if(!n){tt(this,Ur,Yo).call(this,{type:"pending",variables:t,isPaused:r}),await((A=(o=N(this,Ln).config).onMutate)==null?void 0:A.call(o,t,this));const T=await((i=(a=this.options).onMutate)==null?void 0:i.call(a,t));T!==this.state.context&&tt(this,Ur,Yo).call(this,{type:"pending",context:T,variables:t,isPaused:r})}const b=await N(this,xA).start();return await((c=(s=N(this,Ln).config).onSuccess)==null?void 0:c.call(s,b,t,this.state.context,this)),await((C=(l=this.options).onSuccess)==null?void 0:C.call(l,b,t,this.state.context)),await((h=(Q=N(this,Ln).config).onSettled)==null?void 0:h.call(Q,b,null,this.state.variables,this.state.context,this)),await((E=(I=this.options).onSettled)==null?void 0:E.call(I,b,null,t,this.state.context)),tt(this,Ur,Yo).call(this,{type:"success",data:b}),b}catch(b){try{throw await((B=(d=N(this,Ln).config).onError)==null?void 0:B.call(d,b,t,this.state.context,this)),await((f=(p=this.options).onError)==null?void 0:f.call(p,b,t,this.state.context)),await((v=(m=N(this,Ln).config).onSettled)==null?void 0:v.call(m,void 0,b,this.state.variables,this.state.context,this)),await((x=(w=this.options).onSettled)==null?void 0:x.call(w,void 0,b,t,this.state.context)),b}finally{tt(this,Ur,Yo).call(this,{type:"error",error:b})}}finally{N(this,Ln).runNext(this)}}},Zr=new WeakMap,Ln=new WeakMap,xA=new WeakMap,Ur=new WeakSet,Yo=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),on.batch(()=>{N(this,Zr).forEach(r=>{r.onMutationUpdate(t)}),N(this,Ln).notify({mutation:this,type:"updated",action:t})})},hb);function $f(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var nw=(Qb=class extends jA{constructor(t={}){super();Ve(this,co);Ve(this,Or);Ve(this,$i);this.config=t,De(this,co,new Set),De(this,Or,new Map),De(this,$i,0)}build(t,n,r){const o=new tw({mutationCache:this,mutationId:++wl(this,$i)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){N(this,co).add(t);const n=Gs(t);if(typeof n=="string"){const r=N(this,Or).get(n);r?r.push(t):N(this,Or).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(N(this,co).delete(t)){const n=Gs(t);if(typeof n=="string"){const r=N(this,Or).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&N(this,Or).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Gs(t);if(typeof n=="string"){const r=N(this,Or).get(n),o=r==null?void 0:r.find(A=>A.state.status==="pending");return!o||o===t}else return!0}runNext(t){var r;const n=Gs(t);if(typeof n=="string"){const o=(r=N(this,Or).get(n))==null?void 0:r.find(A=>A!==t&&A.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){on.batch(()=>{N(this,co).forEach(t=>{this.notify({type:"removed",mutation:t})}),N(this,co).clear(),N(this,Or).clear()})}getAll(){return Array.from(N(this,co))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Wf(n,r))}findAll(t={}){return this.getAll().filter(n=>Wf(t,n))}notify(t){on.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return on.batch(()=>Promise.all(t.map(n=>n.continue().catch(sr))))}},co=new WeakMap,Or=new WeakMap,$i=new WeakMap,Qb);function Gs(e){var t;return(t=e.options.scope)==null?void 0:t.id}function Hs(e){return{onFetch:(t,n)=>{var l,C,Q,h,I;const r=t.options,o=(Q=(C=(l=t.fetchOptions)==null?void 0:l.meta)==null?void 0:C.fetchMore)==null?void 0:Q.direction,A=((h=t.state.data)==null?void 0:h.pages)||[],a=((I=t.state.data)==null?void 0:I.pageParams)||[];let i={pages:[],pageParams:[]},s=0;const c=async()=>{let E=!1;const d=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(t.signal.aborted?E=!0:t.signal.addEventListener("abort",()=>{E=!0}),t.signal)})},B=Jf(t.options,t.fetchOptions),p=async(f,m,v)=>{if(E)return Promise.reject();if(m==null&&f.pages.length)return Promise.resolve(f);const w={client:t.client,queryKey:t.queryKey,pageParam:m,direction:v?"backward":"forward",meta:t.options.meta};d(w);const x=await B(w),{maxPages:b}=t.options,T=v?J2:Y2;return{pages:T(f.pages,x,b),pageParams:T(f.pageParams,m,b)}};if(o&&A.length){const f=o==="backward",m=f?eI:Su,v={pages:A,pageParams:a},w=m(r,v);i=await p(v,w,f)}else{const f=e??A.length;do{const m=s===0?a[0]??r.initialPageParam:Su(r,i);if(s>0&&m==null)break;i=await p(i,m),s++}while(s<f)}return i};t.options.persister?t.fetchFn=()=>{var E,d;return(d=(E=t.options).persister)==null?void 0:d.call(E,c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=c}}}function Su(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 eI(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}function rw(e,t){return t?Su(e,t)!=null:!1}function ow(e,t){return!t||!e.getPreviousPageParam?!1:eI(e,t)!=null}var Aw=(mb=class{constructor(e={}){Ve(this,zt);Ve(this,Po);Ve(this,Lo);Ve(this,Na);Ve(this,Ra);Ve(this,No);Ve(this,ka);Ve(this,ja);De(this,zt,e.queryCache||new ew),De(this,Po,e.mutationCache||new nw),De(this,Lo,e.defaultOptions||{}),De(this,Na,new Map),De(this,Ra,new Map),De(this,No,0)}mount(){wl(this,No)._++,N(this,No)===1&&(De(this,ka,vu.subscribe(async e=>{e&&(await this.resumePausedMutations(),N(this,zt).onFocus())})),De(this,ja,Vs.subscribe(async e=>{e&&(await this.resumePausedMutations(),N(this,zt).onOnline())})))}unmount(){var e,t;wl(this,No)._--,N(this,No)===0&&((e=N(this,ka))==null||e.call(this),De(this,ka,void 0),(t=N(this,ja))==null||t.call(this),De(this,ja,void 0))}isFetching(e){return N(this,zt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return N(this,Po).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=N(this,zt).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=N(this,zt).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(VA(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return N(this,zt).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=N(this,zt).get(r.queryHash),A=o==null?void 0:o.state.data,a=W2(t,A);if(a!==void 0)return N(this,zt).build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return on.batch(()=>N(this,zt).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=N(this,zt).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=N(this,zt);on.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=N(this,zt);return on.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=on.batch(()=>N(this,zt).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(sr).catch(sr)}invalidateQueries(e,t={}){return on.batch(()=>(N(this,zt).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=on.batch(()=>N(this,zt).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let A=o.fetch(void 0,n);return n.throwOnError||(A=A.catch(sr)),o.state.fetchStatus==="paused"?Promise.resolve():A}));return Promise.all(r).then(sr)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=N(this,zt).build(this,t);return n.isStaleByTime(VA(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(sr).catch(sr)}fetchInfiniteQuery(e){return e.behavior=Hs(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(sr).catch(sr)}ensureInfiniteQueryData(e){return e.behavior=Hs(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Vs.isOnline()?N(this,Po).resumePausedMutations():Promise.resolve()}getQueryCache(){return N(this,zt)}getMutationCache(){return N(this,Po)}getDefaultOptions(){return N(this,Lo)}setDefaultOptions(e){De(this,Lo,e)}setQueryDefaults(e,t){N(this,Na).set(rA(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...N(this,Na).values()],n={};return t.forEach(r=>{ui(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){N(this,Ra).set(rA(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...N(this,Ra).values()],n={};return t.forEach(r=>{ui(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...N(this,Lo).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Qu(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===js&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...N(this,Lo).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){N(this,zt).clear(),N(this,Po).clear()}},zt=new WeakMap,Po=new WeakMap,Lo=new WeakMap,Na=new WeakMap,Ra=new WeakMap,No=new WeakMap,ka=new WeakMap,ja=new WeakMap,mb),tI=(bb=class extends jA{constructor(t,n){super();Ve(this,vt);Ve(this,Wn);Ve(this,it);Ve(this,es);Ve(this,Nn);Ve(this,wA);Ve(this,Va);Ve(this,Ro);Ve(this,qr);Ve(this,ts);Ve(this,Ga);Ve(this,Ha);Ve(this,SA);Ve(this,TA);Ve(this,ko);Ve(this,Wa,new Set);this.options=n,De(this,Wn,t),De(this,qr,null),De(this,Ro,xu()),this.options.experimental_prefetchInRender||N(this,Ro).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&&(N(this,it).addObserver(this),nI(N(this,it),this.options)?tt(this,vt,os).call(this):this.updateResult(),tt(this,vt,_C).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Tu(N(this,it),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Tu(N(this,it),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,tt(this,vt,PC).call(this),tt(this,vt,LC).call(this),N(this,it).removeObserver(this)}setOptions(t,n){const r=this.options,o=N(this,it);if(this.options=N(this,Wn).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof yr(this.options.enabled,N(this,it))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");tt(this,vt,NC).call(this),N(this,it).setOptions(this.options),r._defaulted&&!ks(this.options,r)&&N(this,Wn).getQueryCache().notify({type:"observerOptionsUpdated",query:N(this,it),observer:this});const A=this.hasListeners();A&&rI(N(this,it),o,this.options,r)&&tt(this,vt,os).call(this),this.updateResult(n),A&&(N(this,it)!==o||yr(this.options.enabled,N(this,it))!==yr(r.enabled,N(this,it))||VA(this.options.staleTime,N(this,it))!==VA(r.staleTime,N(this,it)))&&tt(this,vt,OC).call(this);const a=tt(this,vt,FC).call(this);A&&(N(this,it)!==o||yr(this.options.enabled,N(this,it))!==yr(r.enabled,N(this,it))||a!==N(this,ko))&&tt(this,vt,MC).call(this,a)}getOptimisticResult(t){const n=N(this,Wn).getQueryCache().build(N(this,Wn),t),r=this.createResult(n,t);return iw(this,r)&&(De(this,Nn,r),De(this,Va,this.options),De(this,wA,N(this,it).state)),r}getCurrentResult(){return N(this,Nn)}trackResult(t,n){const r={};return Object.keys(t).forEach(o=>{Object.defineProperty(r,o,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(o),n==null||n(o),t[o])})}),r}trackProp(t){N(this,Wa).add(t)}getCurrentQuery(){return N(this,it)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=N(this,Wn).defaultQueryOptions(t),r=N(this,Wn).getQueryCache().build(N(this,Wn),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return tt(this,vt,os).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),N(this,Nn)))}createResult(t,n){var b;const r=N(this,it),o=this.options,A=N(this,Nn),a=N(this,wA),i=N(this,Va),c=t!==r?t.state:N(this,es),{state:l}=t;let C={...l},Q=!1,h;if(n._optimisticResults){const T=this.hasListeners(),M=!T&&nI(t,n),_=T&&rI(t,r,n,o);(M||_)&&(C={...C,...Kf(l.data,t.options)}),n._optimisticResults==="isRestoring"&&(C.fetchStatus="idle")}let{error:I,errorUpdatedAt:E,status:d}=C;if(n.select&&C.data!==void 0)if(A&&C.data===(a==null?void 0:a.data)&&n.select===N(this,ts))h=N(this,Ga);else try{De(this,ts,n.select),h=n.select(C.data),h=yu(A==null?void 0:A.data,h,n),De(this,Ga,h),De(this,qr,null)}catch(T){De(this,qr,T)}else h=C.data;if(n.placeholderData!==void 0&&h===void 0&&d==="pending"){let T;if(A!=null&&A.isPlaceholderData&&n.placeholderData===(i==null?void 0:i.placeholderData))T=A.data;else if(T=typeof n.placeholderData=="function"?n.placeholderData((b=N(this,Ha))==null?void 0:b.state.data,N(this,Ha)):n.placeholderData,n.select&&T!==void 0)try{T=n.select(T),De(this,qr,null)}catch(M){De(this,qr,M)}T!==void 0&&(d="success",h=yu(A==null?void 0:A.data,T,n),Q=!0)}N(this,qr)&&(I=N(this,qr),h=N(this,Ga),E=Date.now(),d="error");const B=C.fetchStatus==="fetching",p=d==="pending",f=d==="error",m=p&&B,v=h!==void 0,x={status:d,fetchStatus:C.fetchStatus,isPending:p,isSuccess:d==="success",isError:f,isInitialLoading:m,isLoading:m,data:h,dataUpdatedAt:C.dataUpdatedAt,error:I,errorUpdatedAt:E,failureCount:C.fetchFailureCount,failureReason:C.fetchFailureReason,errorUpdateCount:C.errorUpdateCount,isFetched:C.dataUpdateCount>0||C.errorUpdateCount>0,isFetchedAfterMount:C.dataUpdateCount>c.dataUpdateCount||C.errorUpdateCount>c.errorUpdateCount,isFetching:B,isRefetching:B&&!p,isLoadingError:f&&!v,isPaused:C.fetchStatus==="paused",isPlaceholderData:Q,isRefetchError:f&&v,isStale:Du(t,n),refetch:this.refetch,promise:N(this,Ro)};if(this.options.experimental_prefetchInRender){const T=R=>{x.status==="error"?R.reject(x.error):x.data!==void 0&&R.resolve(x.data)},M=()=>{const R=De(this,Ro,x.promise=xu());T(R)},_=N(this,Ro);switch(_.status){case"pending":t.queryHash===r.queryHash&&T(_);break;case"fulfilled":(x.status==="error"||x.data!==_.value)&&M();break;case"rejected":(x.status!=="error"||x.error!==_.reason)&&M();break}}return x}updateResult(t){const n=N(this,Nn),r=this.createResult(N(this,it),this.options);if(De(this,wA,N(this,it).state),De(this,Va,this.options),N(this,wA).data!==void 0&&De(this,Ha,N(this,it)),ks(r,n))return;De(this,Nn,r);const o={},A=()=>{if(!n)return!0;const{notifyOnChangeProps:a}=this.options,i=typeof a=="function"?a():a;if(i==="all"||!i&&!N(this,Wa).size)return!0;const s=new Set(i??N(this,Wa));return this.options.throwOnError&&s.add("error"),Object.keys(N(this,Nn)).some(c=>{const l=c;return N(this,Nn)[l]!==n[l]&&s.has(l)})};(t==null?void 0:t.listeners)!==!1&&A()&&(o.listeners=!0),tt(this,vt,wb).call(this,{...o,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&tt(this,vt,_C).call(this)}},Wn=new WeakMap,it=new WeakMap,es=new WeakMap,Nn=new WeakMap,wA=new WeakMap,Va=new WeakMap,Ro=new WeakMap,qr=new WeakMap,ts=new WeakMap,Ga=new WeakMap,Ha=new WeakMap,SA=new WeakMap,TA=new WeakMap,ko=new WeakMap,Wa=new WeakMap,vt=new WeakSet,os=function(t){tt(this,vt,NC).call(this);let n=N(this,it).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(sr)),n},OC=function(){tt(this,vt,PC).call(this);const t=VA(this.options.staleTime,N(this,it));if(nA||N(this,Nn).isStale||!hu(t))return;const r=Gf(N(this,Nn).dataUpdatedAt,t)+1;De(this,SA,setTimeout(()=>{N(this,Nn).isStale||this.updateResult()},r))},FC=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(N(this,it)):this.options.refetchInterval)??!1},MC=function(t){tt(this,vt,LC).call(this),De(this,ko,t),!(nA||yr(this.options.enabled,N(this,it))===!1||!hu(N(this,ko))||N(this,ko)===0)&&De(this,TA,setInterval(()=>{(this.options.refetchIntervalInBackground||vu.isFocused())&&tt(this,vt,os).call(this)},N(this,ko)))},_C=function(){tt(this,vt,OC).call(this),tt(this,vt,MC).call(this,tt(this,vt,FC).call(this))},PC=function(){N(this,SA)&&(clearTimeout(N(this,SA)),De(this,SA,void 0))},LC=function(){N(this,TA)&&(clearInterval(N(this,TA)),De(this,TA,void 0))},NC=function(){const t=N(this,Wn).getQueryCache().build(N(this,Wn),this.options);if(t===N(this,it))return;const n=N(this,it);De(this,it,t),De(this,es,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},wb=function(t){on.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(N(this,Nn))}),N(this,Wn).getQueryCache().notify({query:N(this,it),type:"observerResultsUpdated"})})},bb);function aw(e,t){return yr(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function nI(e,t){return aw(e,t)||e.state.data!==void 0&&Tu(e,t,t.refetchOnMount)}function Tu(e,t,n){if(yr(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Du(e,t)}return!1}function rI(e,t,n,r){return(e!==t||yr(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Du(e,n)}function Du(e,t){return yr(t.enabled,e)!==!1&&e.isStaleByTime(VA(t.staleTime,e))}function iw(e,t){return!ks(e.getCurrentResult(),t)}var sw=class extends tI{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e,t){super.setOptions({...e,behavior:Hs()},t)}getOptimisticResult(e){return e.behavior=Hs(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){var I,E;const{state:n}=e,r=super.createResult(e,t),{isFetching:o,isRefetching:A,isError:a,isRefetchError:i}=r,s=(E=(I=n.fetchMeta)==null?void 0:I.fetchMore)==null?void 0:E.direction,c=a&&s==="forward",l=o&&s==="forward",C=a&&s==="backward",Q=o&&s==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:rw(t,n.data),hasPreviousPage:ow(t,n.data),isFetchNextPageError:c,isFetchingNextPage:l,isFetchPreviousPageError:C,isFetchingPreviousPage:Q,isRefetchError:i&&!c&&!C,isRefetching:A&&!l&&!Q}}},cw=(yb=class extends jA{constructor(t,n){super();Ve(this,uo);Ve(this,jo);Ve(this,Vo);Ve(this,zn);Ve(this,lo);De(this,jo,t),this.setOptions(n),this.bindMethods(),tt(this,uo,Sl).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var r;const n=this.options;this.options=N(this,jo).defaultMutationOptions(t),ks(this.options,n)||N(this,jo).getMutationCache().notify({type:"observerOptionsUpdated",mutation:N(this,zn),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&rA(n.mutationKey)!==rA(this.options.mutationKey)?this.reset():((r=N(this,zn))==null?void 0:r.state.status)==="pending"&&N(this,zn).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=N(this,zn))==null||t.removeObserver(this)}onMutationUpdate(t){tt(this,uo,Sl).call(this),tt(this,uo,RC).call(this,t)}getCurrentResult(){return N(this,Vo)}reset(){var t;(t=N(this,zn))==null||t.removeObserver(this),De(this,zn,void 0),tt(this,uo,Sl).call(this),tt(this,uo,RC).call(this)}mutate(t,n){var r;return De(this,lo,n),(r=N(this,zn))==null||r.removeObserver(this),De(this,zn,N(this,jo).getMutationCache().build(N(this,jo),this.options)),N(this,zn).addObserver(this),N(this,zn).execute(t)}},jo=new WeakMap,Vo=new WeakMap,zn=new WeakMap,lo=new WeakMap,uo=new WeakSet,Sl=function(){var n;const t=((n=N(this,zn))==null?void 0:n.state)??$f();De(this,Vo,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},RC=function(t){on.batch(()=>{var n,r,o,A,a,i,s,c;if(N(this,lo)&&this.hasListeners()){const l=N(this,Vo).variables,C=N(this,Vo).context;(t==null?void 0:t.type)==="success"?((r=(n=N(this,lo)).onSuccess)==null||r.call(n,t.data,l,C),(A=(o=N(this,lo)).onSettled)==null||A.call(o,t.data,null,l,C)):(t==null?void 0:t.type)==="error"&&((i=(a=N(this,lo)).onError)==null||i.call(a,t.error,l,C),(c=(s=N(this,lo)).onSettled)==null||c.call(s,void 0,t.error,l,C))}this.listeners.forEach(l=>{l(N(this,Vo))})})},yb),oI=S.createContext(void 0),ho=e=>{const t=S.useContext(oI);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},lw=({client:e,children:t})=>(S.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),u.jsx(oI.Provider,{value:e,children:t})),AI=S.createContext(!1),uw=()=>S.useContext(AI);AI.Provider;function gw(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var dw=S.createContext(gw()),Cw=()=>S.useContext(dw);function aI(e,t){return typeof e=="function"?e(...t):!!e}function Ou(){}var Ew=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},fw=e=>{S.useEffect(()=>{e.clearReset()},[e])},Iw=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||aI(n,[e.error,r])),pw=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)))},Bw=(e,t)=>e.isLoading&&e.isFetching&&!t,hw=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,iI=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function sI(e,t,n){var C,Q,h,I,E;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=ho(),o=uw(),A=Cw(),a=r.defaultQueryOptions(e);(Q=(C=r.getDefaultOptions().queries)==null?void 0:C._experimental_beforeQuery)==null||Q.call(C,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",pw(a),Ew(a,A),fw(A);const i=!r.getQueryCache().get(a.queryHash),[s]=S.useState(()=>new t(r,a)),c=s.getOptimisticResult(a),l=!o&&e.subscribed!==!1;if(S.useSyncExternalStore(S.useCallback(d=>{const B=l?s.subscribe(on.batchCalls(d)):Ou;return s.updateResult(),B},[s,l]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),S.useEffect(()=>{s.setOptions(a,{listeners:!1})},[a,s]),hw(a,c))throw iI(a,s,A);if(Iw({result:c,errorResetBoundary:A,throwOnError:a.throwOnError,query:r.getQueryCache().get(a.queryHash),suspense:a.suspense}))throw c.error;if((I=(h=r.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||I.call(h,a,c),a.experimental_prefetchInRender&&!nA&&Bw(c,o)){const d=i?iI(a,s,A):(E=r.getQueryCache().get(a.queryHash))==null?void 0:E.promise;d==null||d.catch(Ou).finally(()=>{s.updateResult()})}return a.notifyOnChangeProps?c:s.trackResult(c)}function Qo(e,t){return sI(e,tI)}function oA(e,t){const n=ho(),[r]=S.useState(()=>new cw(n,e));S.useEffect(()=>{r.setOptions(e)},[r,e]);const o=S.useSyncExternalStore(S.useCallback(a=>r.subscribe(on.batchCalls(a)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),A=S.useCallback((a,i)=>{r.mutate(a,i).catch(Ou)},[r]);if(o.error&&aI(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:A,mutateAsync:o.mutate}}function Qw(e,t){return sI(e,sw)}var Fu=(e=>(e.ADD="ADD",e.MULTIPLY="MULTIPLY",e))(Fu||{});const mw={[Fu.ADD]:(e,t)=>e+t,[Fu.MULTIPLY]:(e,t)=>e*t},bw=e=>e,cI=()=>{if("crypto"in window&&"randomUUID"in window.crypto)return window.crypto.randomUUID();const e=Date.now().toString(16),t=Math.random().toString(16).substring(2,8);return`${e}-${t}`},lI=(e,t)=>{let n;const r=mw[t]??bw;for(const o of e){const A=Number(o);isNaN(A)||(n=n===void 0?A:r(n,A))}return(n??0).toFixed(2)},yw=(e,t)=>e.replace(/:(\w+)/g,(n,r)=>String(t[r])||""),Mu=e=>typeof e=="object"&&e!==null&&"value"in e&&"label"in e,vw={GET:"GET",POST:"POST",DELETE:"DELETE",PATCH:"PATCH",PUT:"PUT"},xw="/v1/api/connectors/forms/:formId/get_forms_custom_fields",ww=async({formId:e,args:t})=>{try{const n=await Ue({url:yw(xw,{formId:e}),data:{args:t},method:vw.POST});return(n==null?void 0:n.data).fieldList}catch(n){throw pt.error(n),n}},uI=(e,t)=>{if(!t)return{isApiEnabled:!0,args:{},argsMap:t};const n={};for(const r in t){const o=t[r],A=Mu(e[o])?e[o].value:e[o];if(!A)return{isApiEnabled:!1,args:{}};n[r]=A}return{isApiEnabled:!0,args:n,argsMap:t}},gI=({formId:e,argsMap:t,formData:n,enabled:r=!0,delay:o=500})=>{const[A,a]=y.useState(()=>uI(n,t));y.useEffect(()=>{const c=setTimeout(()=>{a(uI(n,t))},o);return()=>clearTimeout(c)},[n,t,o]);const i=A.argsMap===t,s=Qo({queryKey:["customFormFields",e,A.args],queryFn:()=>ww({formId:e,args:A.args}),enabled:!!e&&r&&i&&A.isApiEnabled,staleTime:0});return{...s,data:A.isApiEnabled?s.data:void 0}},dI=e=>{const t={current:null};return n=>{t.current&&clearTimeout(t.current),t.current=setTimeout(n,e)}},Sw=e=>(t,n)=>{if(typeof t=="string"){const r=n.limit;return r!==void 0&&t.length>r?e||`Maximum characters allowed are ${r}`:!0}return e||L2},Tw=["async-select","select","multi-select","reference"],Dw=(e,t)=>{const n=Array.isArray(e)?e:e?[e]:[],r=Array.isArray(t)?t:t?[t]:[];return n.map((o,A)=>({value:o,label:r[A]??String(o)}))},Ow=e=>{if(typeof e=="string"){const t=e.trim().toLowerCase();return t==="true"||t==="1"||t==="yes"}return!!e},CI=(e,t=!1)=>{const n={};for(const r in e){const o=e[r];if(!o)continue;if(o.type==="checkbox"){n[r]=Ow(o.value??o.label);continue}if(!(o!=null&&o.label)&&!(o!=null&&o.value))continue;const A=o.label??o.value??"",a=Array.isArray(A)?A[0]??"":A;if(t&&o.type==="date"){const i=isNaN(Number(a))?a:Number(a),s=new Date(i);n[r]=isNaN(s.getTime())?a:s.toISOString();continue}if(Tw.includes(o.type)){o.type==="multi-select"?n[r]=Dw(o.value,o.label):n[r]={label:o.label,value:o.value};continue}n[r]=a}return n},EI=(e,t)=>{const n={};for(const o of t)n[o.name]=o.type;const r={};for(const o in e){const A=e[o];if(Array.isArray(A)){const a=A.map(i=>i&&typeof i=="object"&&"value"in i&&"label"in i?i:{value:i,label:i});r[o]={value:a.map(i=>i.value),label:a.map(i=>i.label),type:n[o]}}else A&&typeof A=="object"&&"value"in A&&"label"in A?r[o]={value:A.value,label:A.label,type:n[o]}:r[o]={value:A,label:A,type:n[o]}}return r},Fw=e=>{let t=0,n=!1;for(const r in e){const o=e[r];if(o!=null&&o.value){t++;const A=o.value;if(typeof A!="string")continue;A.includes("{{")&&A.includes("}}")&&(n=!0)}}return{fields_configured_count:t,has_system_variable:n}};function fI(e,t){const n={};return e.forEach(r=>{const o=t(r);n[o]=r}),n}function II(e,t){return e.map(t)}function pI(e){const t={};return e.forEach(n=>{n.formFields.forEach(r=>{t[r.name]={...r}})}),t}const Fn=(e={},t)=>e&&typeof e[t]>"u"?(e==null?void 0:e[Jv])===!0:(e==null?void 0:e[t])===!0,Mw=e=>Fn(e,vv)&&!Fn(e,xv),GA=e=>Fn(e,wv),BI=e=>Fn(e,Dv),_w=(e,t,n)=>{const r="?email=&name=&referrer=",i=window.innerWidth-388,s=window.open(`${Wv}${r}`,zv,`scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no,width=364,height=533,left=${i}`);if(s){const c=window.outerHeight-(s.outerHeight+24);s.moveBy(0,c)}},Pw=(e,t)=>{const n=document.createElement("input");document.body.appendChild(n),n.value=e,n.focus(),n.select();try{const r=document.execCommand("copy");t==null||t(!r)}catch{t==null||t(!0)}n.remove()},Lw=async(e,t)=>{navigator.clipboard.writeText(e).then(()=>{pt.log("successfully copied"),t==null||t(!1)}).catch(()=>{pt.log("something went wrong while copying using navigator.clipboard function. Trying fallback copy"),Pw(e,t)})},Nw=e=>["sm.full"].some(n=>e.includes(n)),hI=e=>Object.keys(e).filter(t=>e[t]).join(" "),Ws=(e,t)=>Array.from({length:e},(n,r)=>t(r)),Ft=(e,t)=>e.replace(/:(\w+)/g,(n,r)=>String(t[r])||""),QI=(e,t)=>e.isConnectorAvailableInPlan===!1||Fn(t,e.featureKey),mI=({connector:e,isTemplate:t=!1})=>{if(t)return"not_authenticated";const{isAuthenticated:n,isEnabled:r,showUpgradeButton:o,authPending:A}=e;return o?"enabled_upgrade_available":n?r?"authenticated_enabled":"authenticated_disabled":A?"authentication_pending":"authentication_failed"},zs=(e,t)=>(...n)=>{localStorage.getItem("dev__logs")==="true"&&console[e](t||"DEV_LOG:",...n)},Ys={log:zs("log","### CONNECTOR_UI_LOGS ###"),warn:zs("warn","### CONNECTOR_UI_WARN ###"),error:zs("error","### CONNECTOR_UI_ERROR ###"),info:zs("info","### CONNECTOR_UI_INFO ###")},Js=e=>{const t=Object.values(e||{});let n=0,r=0,o=0;const A=[],a={},i={};let s="";for(const C of t){if(!(C!=null&&C.name))continue;A.push(C.name);const Q=!!C.isAuthenticated,h=!!C.isEnabled;a[C.name]=Q,i[C.name]=h,Q&&n++,h&&r++,h&&Q&&o++,C.createdAt&&(!s||new Date(C.createdAt)<new Date(s))&&(s=C.createdAt)}const c=t.length,l=A.join(",");return{total_authenticated_apps:n,total_enabled_apps:r,total_apps_activated:o,total_apps_setup:c,apps_list:l,apps_auth_status:a,apps_enabled_status:i,first_app_created_at:s}},nt={GET:"GET",POST:"POST",DELETE:"DELETE",PATCH:"PATCH",PUT:"PUT"},pe={IDLE:"idle",LOADING:"loading",FAILED:"failed",SUCCESS:"success"},Bt="/v1/api",Rw={connectorTemplates:null,connectorTemplateList:[],templateListApiStatus:pe.IDLE,connectorsApiStatus:pe.IDLE,templateDetailsApiStatus:pe.IDLE,selectedTemplateData:null},kw=Bt+"/template/list",jw=Bt+"/template/{{templateId}}",Vw=()=>Ue({url:kw,method:nt.GET}),Gw=e=>Ue({url:jw.replace("{{templateId}}",e),method:nt.GET}),bI=e=>e.templateLibrary.connectorTemplateList,HA=e=>e.templateLibrary.connectorTemplates,Hw=e=>e.templateLibrary.templateListApiStatus,Ww=e=>e.templateLibrary.templateListApiStatus,_u=e=>e.templateLibrary.templateDetailsApiStatus,zw=ni({name:"templateLibrary",initialState:Rw,reducers:{},extraReducers:e=>{e.addCase(Xs.pending,t=>{t.templateListApiStatus=pe.LOADING}).addCase(Xs.fulfilled,(t,n)=>{t.templateListApiStatus=pe.IDLE,t.connectorTemplateList=n.payload.connectorList,t.connectorTemplates=n.payload.connectors}).addCase(Xs.rejected,(t,n)=>{t.templateListApiStatus=pe.FAILED,pt.error(n.error)}).addCase(WA.pending,t=>{t.templateDetailsApiStatus=pe.LOADING}).addCase(WA.fulfilled,(t,n)=>{t.templateDetailsApiStatus=pe.IDLE;const{templateData:r,templateId:o}=n.payload;r&&o&&(t.connectorTemplates={...t.connectorTemplates,[o]:r})}).addCase(WA.rejected,(t,n)=>{t.templateDetailsApiStatus=pe.FAILED,pt.error(n.error)})}}),Xs=hn("connectorLibrary/fetchConnectorTemplates",async()=>{const e=await Vw();if(!e||!e.data||!Array.isArray(e.data))return{connectorList:[],connectors:{}};const n=e.data.sort((A,a)=>A.name.localeCompare(a.name)),r=fI(n,A=>A.id),o=II(n,A=>A.id);return{connectors:r,connectorList:o}}),WA=hn("connectorLibrary/fetchTemplateDetails",async e=>{const t=await Gw(e);return!t||!t.data?{templateId:e,templateData:null}:{templateData:t.data,templateId:e}}),Yw=zw.reducer,Jw={connectors:null,connectorList:[],connectorsApiStatus:pe.IDLE,selectedConnector:null,currentUpdatingConnectors:{},connectorDetailApiStatus:pe.IDLE,connectorDetails:null,rolesAndPermissions:null,rolesAndPermissionsApiStatus:pe.IDLE,updateEnableConnectorsApiStatus:pe.IDLE,cardCustomFields:{},cardCustomFieldsApiStatus:pe.IDLE,requireUpgradeConnectors:[],notAuthenticatedConnectors:[],fetchCustomCardsApiStatus:pe.IDLE,enableCustomCardApiStatus:{},updateConnectorByIdApiStatus:pe.IDLE},Xw=Bt+"/connectors/ug",Zw=Bt+"/connectors/:connectorId/ug",Uw=Bt+"/connectors/{{id}}",qw=Bt+"/connectors/{{id}}",yI="{{card_id}}",Kw=Bt+`/connectors/cards/${yI}`,$w=Bt+"/connectors/cards/:cardId/custom_fields",eS=Bt+"/connectors/:connectorId/custom_cards",tS=Bt+"/connectors/:connectorId/custom_cards",nS=Bt+"/connectors/:connectorId/lookup",rS=Bt+"/connectors/:connectorId/lookup-presets",oS=Bt+"/connectors/lookup/bulk",AS=`${Bt}/connectors/forms/:formId/field/:fieldName/data`,aS=`${Bt}/connectors/cards/:cardId/forms`,iS=`${Bt}/connectors/forms/:formId`,vI=`${Bt}/connectors/defaults/:entityId`,sS=`${Bt}/connectors/defaults`,xI=`${Bt}/connectors/forms/:formId/defaults`,wI="/v1/connectors/:connectorType",cS=`${wI}/admin/agency/locations`,SI=`${wI}/admin/agency/mapping`,lS=()=>Ue({url:Xw,method:nt.GET}),uS=({id:e,enabled:t})=>Ue({url:Uw.replace("{{id}}",e),method:nt.PATCH,data:{enabled:t}}),gS=e=>{const t=qw.replace("{{id}}",e);return Ue({url:t,method:nt.GET})},dS=({cardId:e,data:t})=>Ue({url:Kw.replace(yI,e),method:nt.PATCH,data:t}),CS=e=>Ue({url:Ft($w,{cardId:e}),method:nt.GET}),ES=e=>Ue({url:Ft(eS,{connectorId:e}),method:nt.GET}),fS=({connectorId:e,data:t})=>Ue({url:Ft(tS,{connectorId:e}),method:nt.PATCH,data:t}),IS=e=>Ue({url:Ft(nS,{connectorId:e}),method:nt.GET}),pS=e=>Ue({url:Ft(rS,{connectorId:e}),method:nt.GET}),BS=e=>Ue({url:oS,method:nt.PUT,data:{entries:e}}),hS=({connectorId:e,data:t})=>Ue({url:Ft(Zw,{connectorId:e}),method:nt.PATCH,data:t}),QS=e=>Ue({url:Ft(cS,{connectorType:e}),method:nt.GET}),mS=e=>{var n;const t=((n=br())==null?void 0:n.userGroupId)??"";return Ue({url:`${Ft(SI,{connectorType:e})}?ug_id=${encodeURIComponent(t)}`,method:nt.GET})},bS=({connectorType:e,smId:t,locationIds:n})=>{var o;const r=((o=br())==null?void 0:o.userGroupId)??"";return Ue({url:`${Ft(SI,{connectorType:e})}?ug_id=${encodeURIComponent(r)}`,method:nt.PUT,data:{smId:t,locationIds:n}})},yS="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='15'%20height='15'%20viewBox='0%200%2015%2015'%3e%3cpath%20fill='%23ffffff'%20fill-rule='nonzero'%20d='M8.821%207.496L14.716%201.6A.937.937%200%201%200%2013.391.275L7.496%206.17%201.6.275A.937.937%200%201%200%20.275%201.601L6.17%207.496.275%2013.39A.937.937%200%201%200%201.6%2014.716L7.496%208.82l5.895%205.895a.935.935%200%200%200%201.325%200%20.937.937%200%200%200%200-1.326L8.821%207.496z'%20opacity='.8'/%3e%3c/svg%3e",vS=g.styled(g.Box)`
|
|
67
|
+
`+A):r.stack=A}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=eA(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:A}=n;r!==void 0&&gu.assertOptions(r,{silentJSONParsing:Bo.transitional(Bo.boolean),forcedJSONParsing:Bo.transitional(Bo.boolean),clarifyTimeoutError:Bo.transitional(Bo.boolean)},!1),o!=null&&(oe.isFunction(o)?n.paramsSerializer={serialize:o}:gu.assertOptions(o,{encode:Bo.function,serialize:Bo.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=A&&oe.merge(A.common,A[n.method]);A&&oe.forEach(["delete","get","head","post","put","patch","common"],I=>{delete A[I]}),n.headers=Qr.concat(a,A);const i=[];let s=!0;this.interceptors.request.forEach(function(E){typeof E.runWhen=="function"&&E.runWhen(n)===!1||(s=s&&E.synchronous,i.unshift(E.fulfilled,E.rejected))});const c=[];this.interceptors.response.forEach(function(E){c.push(E.fulfilled,E.rejected)});let l,C=0,Q;if(!s){const I=[pf.bind(this),void 0];for(I.unshift.apply(I,i),I.push.apply(I,c),Q=I.length,l=Promise.resolve(n);C<Q;)l=l.then(I[C++],I[C++]);return l}Q=i.length;let h=n;for(C=0;C<Q;){const I=i[C++],E=i[C++];try{h=I(h)}catch(d){E.call(this,d);break}}try{l=pf.call(this,h)}catch(I){return Promise.reject(I)}for(C=0,Q=c.length;C<Q;)l=l.then(c[C++],c[C++]);return l}getUri(t){t=eA(this.defaults,t);const n=cf(t.baseURL,t.url);return $E(n,t.params,t.paramsSerializer)}};oe.forEach(["delete","get","head","options"],function(t){Ps.prototype[t]=function(n,r){return this.request(eA(r||{},{method:t,url:n,data:(r||{}).data}))}}),oe.forEach(["post","put","patch"],function(t){function n(r){return function(A,a,i){return this.request(eA(i||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:A,data:a}))}}Ps.prototype[t]=n(),Ps.prototype[t+"Form"]=n(!0)});var Ls=Ps;class du{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(A){n=A});const r=this;this.promise.then(o=>{if(!r._listeners)return;let A=r._listeners.length;for(;A-- >0;)r._listeners[A](o);r._listeners=null}),this.promise.then=o=>{let A;const a=new Promise(i=>{r.subscribe(i),A=i}).then(o);return a.cancel=function(){r.unsubscribe(A)},a},t(function(A,a,i){r.reason||(r.reason=new FA(A,a,i),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new du(function(o){t=o}),cancel:t}}}var Ox=du;function Fx(e){return function(n){return e.apply(null,n)}}function Mx(e){return oe.isObject(e)&&e.isAxiosError===!0}const Cu={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Cu).forEach(([e,t])=>{Cu[t]=e});var _x=Cu;function Qf(e){const t=new Ls(e),n=NE(Ls.prototype.request,t);return oe.extend(n,Ls.prototype,t,{allOwnKeys:!0}),oe.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return Qf(eA(e,o))},n}const Xt=Qf(Au);Xt.Axios=Ls,Xt.CanceledError=FA,Xt.CancelToken=Ox,Xt.isCancel=of,Xt.VERSION=Bf,Xt.toFormData=Ts,Xt.AxiosError=$e,Xt.Cancel=Xt.CanceledError,Xt.all=function(t){return Promise.all(t)},Xt.spread=Fx,Xt.isAxiosError=Mx,Xt.mergeConfig=eA,Xt.AxiosHeaders=Qr,Xt.formToJSON=e=>nf(oe.isHTMLForm(e)?new FormData(e):e),Xt.getAdapter=If.getAdapter,Xt.HttpStatusCode=_x,Xt.default=Xt;var mf=Xt,gt={},Mr={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PLATFORM=e.TENANT_PLATFORM=e.API_CALL_ORIGIN=e.TIERS=e.APP_UI=e.CONFIG_HIVER=e.DEFAULT_INIT_CONFIG_HIVER=e.TWO_MINUTES_IN_MS=e.REFETCH_CHECK_DELAY=e.GREXIT_ADMIN_DOMAIN=e.RETRY_DELAY_IN_CASE_OF_CORRUPTED_EXPIRY=e.INITIAL_RETRY_DELAY=e.MAX_BACKOFF_LIMIT=e.MAX_CONFLICT_RETRY_DELAY=e.MAX_RETRY_DELAY=e.GET_METHOD=void 0,e.GET_METHOD="GET",e.MAX_RETRY_DELAY=18e4,e.MAX_CONFLICT_RETRY_DELAY=63e3,e.MAX_BACKOFF_LIMIT=8e3,e.INITIAL_RETRY_DELAY=1e3,e.RETRY_DELAY_IN_CASE_OF_CORRUPTED_EXPIRY=3e3,e.GREXIT_ADMIN_DOMAIN="admin.hiverhq.com",e.REFETCH_CHECK_DELAY=168e4,e.TWO_MINUTES_IN_MS=2*60*1e3,e.DEFAULT_INIT_CONFIG_HIVER={getToken:!0,isHiverApiDomain:!0,fetchCsrfToken:function(){return""}},e.CONFIG_HIVER={getToken:!1,fetchCsrfToken:function(){return""},isHiverApiDomain:!0},e.APP_UI={COLLAB_SPACE:"collab-space",DEFAULT:"default"},e.TIERS={DEV:"dev",SIT:"sit",QA:"qa",PRODUCTION:"production",PROD:"prod"},e.API_CALL_ORIGIN={API_RETRY:"Api Retry"},e.TENANT_PLATFORM={GMAIL:"GMAIL",HIVERWEB:"HIVERWEB"},function(t){t[t.WEB=0]="WEB",t[t.MOBILE=1]="MOBILE"}(e.PLATFORM||(e.PLATFORM={}))})(Mr);var jn={};Object.defineProperty(jn,"__esModule",{value:!0}),jn.getProdHqConfig=jn.getProdApiConfig=jn.getSitHqConfig=jn.getSitApiConfig=jn.getDevHqConfig=jn.getDevApiConfig=void 0;var MA={heimdallTokenFetch:"/v1/token/get",heimdallLogin:"/v1/login/code",heimdallLogout:"/v1/logout",v2Login:"/api/auth/login/code",hotLogin:"/api/auth/login/code"},Px=function(){return{v2Url:"https://v2dev.hiver.space",heimdallUrl:"https://dev.hiver.space/api/heimdall-api",hotUrl:"http://local.hiverhq.co.in:3000",apiEndpoints:MA}};jn.getDevApiConfig=Px;var Lx=function(){return{v2Url:"https://v2dev.hiver.space",heimdallUrl:"https://dev.hiver.space/api/heimdall-api2",hotUrl:"http://local.hiverhq.co.in:3000",apiEndpoints:MA}};jn.getDevHqConfig=Lx;var Nx=function(e){return{v2Url:"https://v2".concat(e,".hiver.space"),heimdallUrl:"https://".concat(e,".hiver.space/api/heimdall-api"),hotUrl:"https://api-".concat(e,".hiver.space"),apiEndpoints:MA}};jn.getSitApiConfig=Nx;var Rx=function(e){return{v2Url:"https://v2".concat(e,".hiver.space"),heimdallUrl:"https://".concat(e,".hiver.space/api/heimdall-api2"),hotUrl:"https://api-".concat(e,".hiver.space"),apiEndpoints:MA}};jn.getSitHqConfig=Rx;var kx=function(e){return e===void 0&&(e=!1),{v2Url:e?"https://admin.hiverhq.com":"https://v2.hiverhq.com",heimdallUrl:"https://heimdall.hiverapi.com",hotUrl:"https://app.hiverhq.com",apiEndpoints:MA}};jn.getProdApiConfig=kx;var jx=function(e){return e===void 0&&(e=!1),{v2Url:e?"https://admin.hiverhq.com":"https://v2.hiverhq.com",heimdallUrl:"https://heimdall2.hiverhq.com",hotUrl:"https://app.hiverhq.com",apiEndpoints:MA}};jn.getProdHqConfig=jx;var _r={},Pr={};Object.defineProperty(Pr,"__esModule",{value:!0}),Pr.removeValue=Pr.getValue=Pr.setValue=void 0;var Eu={};function Vx(e,t){Eu[e]=t}Pr.setValue=Vx;function Gx(e){return Eu[e]}Pr.getValue=Gx;function Hx(e){delete Eu[e]}Pr.removeValue=Hx,Object.defineProperty(_r,"__esModule",{value:!0}),_r.removeItemFromStorage=_r.setItemInStorage=_r.getItemFromStorage=void 0;var _A=Mr,PA=Pr,Wx=function(e,t){switch(t===void 0&&(t=(0,PA.getValue)("PLATFORM")),t){case _A.PLATFORM.WEB:return sessionStorage.getItem(e);case _A.PLATFORM.MOBILE:return(0,PA.getValue)(e);default:throw Error("Invalid PLATFORM ".concat(t))}};_r.getItemFromStorage=Wx;var zx=function(e,t,n){switch(n===void 0&&(n=(0,PA.getValue)("PLATFORM")),n){case _A.PLATFORM.WEB:return sessionStorage.setItem(e,t);case _A.PLATFORM.MOBILE:return(0,PA.setValue)(e,t);default:throw Error("Invalid PLATFORM ".concat(n))}};_r.setItemInStorage=zx;var Yx=function(e,t){switch(t===void 0&&(t=(0,PA.getValue)("PLATFORM")),t){case _A.PLATFORM.WEB:sessionStorage.removeItem(e);break;case _A.PLATFORM.MOBILE:(0,PA.removeValue)(e);break;default:throw Error("Invalid PLATFORM ".concat(t))}};_r.removeItemFromStorage=Yx;var Jx=Ze&&Ze.__awaiter||function(e,t,n,r){function o(A){return A instanceof n?A:new n(function(a){a(A)})}return new(n||(n=Promise))(function(A,a){function i(l){try{c(r.next(l))}catch(C){a(C)}}function s(l){try{c(r.throw(l))}catch(C){a(C)}}function c(l){l.done?A(l.value):o(l.value).then(i,s)}c((r=r.apply(e,t||[])).next())})},Xx=Ze&&Ze.__generator||function(e,t){var n={label:0,sent:function(){if(A[0]&1)throw A[1];return A[1]},trys:[],ops:[]},r,o,A,a;return a={next:i(0),throw:i(1),return:i(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function i(c){return function(l){return s([c,l])}}function s(c){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(n=0)),n;)try{if(r=1,o&&(A=c[0]&2?o.return:c[0]?o.throw||((A=o.return)&&A.call(o),0):o.next)&&!(A=A.call(o,c[1])).done)return A;switch(o=0,A&&(c=[c[0]&2,A.value]),c[0]){case 0:case 1:A=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,o=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(A=n.trys,!(A=A.length>0&&A[A.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!A||c[1]>A[0]&&c[1]<A[3])){n.label=c[1];break}if(c[0]===6&&n.label<A[1]){n.label=A[1],A=c;break}if(A&&n.label<A[2]){n.label=A[2],n.ops.push(c);break}A[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(l){c=[6,l],o=0}finally{r=A=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(gt,"__esModule",{value:!0}),gt.expireToken=gt.invalidateToken=gt.validateToken=gt.validateAccount=gt.getConfig=gt.introduceDelay=gt.isTokenInExpiryWindow=gt.getStoredAuthData=gt.setUserDetails=gt.getRefreshInterval=gt.setTokenAndExpiry=gt.getRandomDelay=gt.hasValidToken=void 0;var Lr=Mr,LA=jn,er=_r,fu=function(){var e=new Date,t=new Date(e.getTime()+e.getTimezoneOffset()*6e4);return t},Iu=function(e){var t=parseInt((0,er.getItemFromStorage)("hiverAuthUserId")||"0"),n=parseInt((0,er.getItemFromStorage)("hiverAuthUserGroupId")||"0"),r=e.userId,o=e.usergroupId;return t===r&&o===n};gt.validateAccount=Iu;var Zx=function(e){var t=Iu(e);return!bf()&&t};gt.validateToken=Zx;var Ux=function(e){return e.apiRetry?e.apiRetry>0:!1};gt.invalidateToken=Ux;var qx=function(){try{sessionStorage.removeItem("hiverAuthTokenExpiry")}catch{console.log("Heimdall: Unable to Remove token.")}};gt.expireToken=qx;var Kx=function(e){var t=(0,er.getItemFromStorage)("hiverAuthTokenExpiry")||"",n=new Date(t),r=fu(),o=Iu(e);return console.log("Heimdall: checking if there is a valid token",r<n&&o),r<n&&o};gt.hasValidToken=Kx;var $x=function(){return Math.floor(Math.random()*6e4)+6e4};gt.getRandomDelay=$x;var e2=function(e,t){if(!e||!t)throw new Error("User Id or user group Id not found in the response");(0,er.setItemInStorage)("hiverAuthUserId",e),(0,er.setItemInStorage)("hiverAuthUserGroupId",t)};gt.setUserDetails=e2;var t2=function(e,t){if(!e)throw new Error("Token not found in the response");(0,er.setItemInStorage)("hiverAuthToken",e),(0,er.setItemInStorage)("hiverAuthTokenExpiry",t)};gt.setTokenAndExpiry=t2;var n2=function(){var e=(0,er.getItemFromStorage)("hiverAuthTokenExpiry"),t=(0,er.getItemFromStorage)("hiverAuthToken"),n=(0,er.getItemFromStorage)("hiverAuthUserId"),r=(0,er.getItemFromStorage)("hiverAuthUserGroupId");return{token:t,expiryTime:e,userId:n,usergroupId:r}};gt.getStoredAuthData=n2;var bf=function(){var e=(0,er.getItemFromStorage)("hiverAuthTokenExpiry")||"";if(!e)return!0;var t=fu(),n=new Date(e),r=4*60*1e3,o=n.getTime()-t.getTime()<r;return o};gt.isTokenInExpiryWindow=bf;var r2=function(e){return Jx(void 0,void 0,void 0,function(){return Xx(this,function(t){switch(t.label){case 0:return[4,new Promise(function(n){return setTimeout(n,e)})];case 1:return t.sent(),[2]}})})};gt.introduceDelay=r2;var o2=function(){return window.location.host===Lr.GREXIT_ADMIN_DOMAIN},A2=function(e,t,n){n===void 0&&(n=!0);var r=o2();switch(t){case Lr.TIERS.SIT:case Lr.TIERS.QA:return n?(0,LA.getSitApiConfig)(e):(0,LA.getSitHqConfig)(e);case Lr.TIERS.PRODUCTION:case Lr.TIERS.PROD:return n?(0,LA.getProdApiConfig)(r):(0,LA.getProdHqConfig)(r);case Lr.TIERS.DEV:default:return n?(0,LA.getDevApiConfig)():(0,LA.getDevHqConfig)()}};gt.getConfig=A2;var a2=function(){try{var e=(0,er.getItemFromStorage)("hiverAuthTokenExpiry");if(!e)return Lr.RETRY_DELAY_IN_CASE_OF_CORRUPTED_EXPIRY;var t=new Date(e),n=fu();return t.getTime()-n.getTime()>Lr.TWO_MINUTES_IN_MS?t.getTime()-Lr.TWO_MINUTES_IN_MS:t.getTime()-n.getTime()}catch(r){return console.error("Heimdall: Error in getRefreshInterval",r),Lr.REFETCH_CHECK_DELAY}};gt.getRefreshInterval=a2;var ii={},mr={},yf;function vf(){if(yf)return mr;yf=1;var e=Ze&&Ze.__awaiter||function(I,E,d,B){function p(f){return f instanceof d?f:new d(function(m){m(f)})}return new(d||(d=Promise))(function(f,m){function v(b){try{x(B.next(b))}catch(T){m(T)}}function w(b){try{x(B.throw(b))}catch(T){m(T)}}function x(b){b.done?f(b.value):p(b.value).then(v,w)}x((B=B.apply(I,E||[])).next())})},t=Ze&&Ze.__generator||function(I,E){var d={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},B,p,f,m;return m={next:v(0),throw:v(1),return:v(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function v(x){return function(b){return w([x,b])}}function w(x){if(B)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(d=0)),d;)try{if(B=1,p&&(f=x[0]&2?p.return:x[0]?p.throw||((f=p.return)&&f.call(p),0):p.next)&&!(f=f.call(p,x[1])).done)return f;switch(p=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return d.label++,{value:x[1],done:!1};case 5:d.label++,p=x[1],x=[0];continue;case 7:x=d.ops.pop(),d.trys.pop();continue;default:if(f=d.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){d=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){d.label=x[1];break}if(x[0]===6&&d.label<f[1]){d.label=f[1],f=x;break}if(f&&d.label<f[2]){d.label=f[2],d.ops.push(x);break}f[2]&&d.ops.pop(),d.trys.pop();continue}x=E.call(I,d)}catch(b){x=[6,b],p=0}finally{B=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}};Object.defineProperty(mr,"__esModule",{value:!0}),mr.logoutFromHeimdall=mr.getTenantLoginCode=mr.getLoginToken=mr.getAccessToken=void 0;var n=Mr,r=Df(),o=gt,A=function(I,E,d,B){var p=(0,o.getStoredAuthData)(),f=d===n.TENANT_PLATFORM.HIVERWEB?n.TENANT_PLATFORM.HIVERWEB:n.TENANT_PLATFORM.GMAIL;return{root_url:I.heimdallUrl,url:I.apiEndpoints.heimdallTokenFetch,method:n.GET_METHOD,data:{user_id:E.userId,usergroup_id:E.usergroupId,access_token:(p==null?void 0:p.token)||"",source:B,tenant:f}}},a=function(I,E,d,B,p){var f=d===n.TENANT_PLATFORM.HIVERWEB?n.TENANT_PLATFORM.HIVERWEB:n.TENANT_PLATFORM.GMAIL;return{root_url:E.heimdallUrl,url:E.apiEndpoints.heimdallLogin,method:n.GET_METHOD,data:{code:I},headers:{"x-hiver-tenant":f,"x-hiver-userid":B,"x-hiver-usergroupid":p}}},i=function(I,E){var d=E===n.TENANT_PLATFORM.HIVERWEB?n.TENANT_PLATFORM.HIVERWEB:n.TENANT_PLATFORM.GMAIL;return{root_url:I.heimdallUrl,url:I.apiEndpoints.heimdallLogout,method:n.GET_METHOD,headers:{"x-hiver-tenant":d}}},s=function(I){return parseInt(I,10)},c=function(I,E,d,B){return{root_url:d===n.TENANT_PLATFORM.HIVERWEB?I.hotUrl:I.v2Url,url:d===n.TENANT_PLATFORM.HIVERWEB?I.apiEndpoints.hotLogin:I.apiEndpoints.v2Login,method:n.GET_METHOD,data:{usersession:s(E.userId),app:B||n.APP_UI.DEFAULT}}},l=function(I,E,d,B,p){return e(void 0,void 0,void 0,function(){var f,m,v,w,x,b,T;return t(this,function(M){switch(M.label){case 0:return M.trys.push([0,4,,5]),!(0,o.validateToken)(d)||(0,o.invalidateToken)(d)?(f=A(E,d,B,p),[4,(0,r.performAxiosCall)(f)]):[3,2];case 1:return m=M.sent(),[2,{atToken:(w=m==null?void 0:m.data.at)===null||w===void 0?void 0:w.token,expiryTime:(x=m==null?void 0:m.data.at)===null||x===void 0?void 0:x.expires_at,userId:(b=m==null?void 0:m.data)===null||b===void 0?void 0:b.user_id,userGroupId:(T=m==null?void 0:m.data)===null||T===void 0?void 0:T.usergroup_id}];case 2:return[2,{}];case 3:return[3,5];case 4:throw v=M.sent(),v;case 5:return[2]}})})};mr.getAccessToken=l;var C=function(I,E,d,B,p,f){return e(void 0,void 0,void 0,function(){var m,v,w,x,b,T,M;return t(this,function(_){switch(_.label){case 0:m=a(I,d,B,p,f),_.label=1;case 1:return _.trys.push([1,3,,4]),[4,(0,r.performAxiosCall)(m)];case 2:return v=_.sent(),[2,{userId:(x=v==null?void 0:v.data)===null||x===void 0?void 0:x.user_id,userGroupId:(b=v==null?void 0:v.data)===null||b===void 0?void 0:b.usergroup_id,atToken:(T=v==null?void 0:v.data.at)===null||T===void 0?void 0:T.token,expiryTime:(M=v==null?void 0:v.data.at)===null||M===void 0?void 0:M.expires_at}];case 3:throw w=_.sent(),w;case 4:return[2]}})})};mr.getLoginToken=C;var Q=function(I,E,d,B,p){return e(void 0,void 0,void 0,function(){var f,m,v;return t(this,function(w){switch(w.label){case 0:return w.trys.push([0,2,,3]),f=c(E,d,B,p),[4,(0,r.performAxiosCall)(f)];case 1:return m=w.sent(),[2,m==null?void 0:m.data.code];case 2:throw v=w.sent(),v;case 3:return[2]}})})};mr.getTenantLoginCode=Q;var h=function(I,E,d){return d===void 0&&(d=0),e(void 0,void 0,void 0,function(){var B,p,f;return t(this,function(m){switch(m.label){case 0:return m.trys.push([0,2,,5]),B=i(I,E),[4,(0,r.performAxiosCall)(B)];case 1:return p=m.sent(),[2,p==null?void 0:p.status];case 2:return f=m.sent(),d<2?[4,h(I,E,d+1)]:[3,4];case 3:m.sent(),m.label=4;case 4:throw f;case 5:return[2]}})})};return mr.logoutFromHeimdall=h,mr}var Ns={},i2=Ze&&Ze.__awaiter||function(e,t,n,r){function o(A){return A instanceof n?A:new n(function(a){a(A)})}return new(n||(n=Promise))(function(A,a){function i(l){try{c(r.next(l))}catch(C){a(C)}}function s(l){try{c(r.throw(l))}catch(C){a(C)}}function c(l){l.done?A(l.value):o(l.value).then(i,s)}c((r=r.apply(e,t||[])).next())})},s2=Ze&&Ze.__generator||function(e,t){var n={label:0,sent:function(){if(A[0]&1)throw A[1];return A[1]},trys:[],ops:[]},r,o,A,a;return a={next:i(0),throw:i(1),return:i(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function i(c){return function(l){return s([c,l])}}function s(c){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(n=0)),n;)try{if(r=1,o&&(A=c[0]&2?o.return:c[0]?o.throw||((A=o.return)&&A.call(o),0):o.next)&&!(A=A.call(o,c[1])).done)return A;switch(o=0,A&&(c=[c[0]&2,A.value]),c[0]){case 0:case 1:A=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,o=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(A=n.trys,!(A=A.length>0&&A[A.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!A||c[1]>A[0]&&c[1]<A[3])){n.label=c[1];break}if(c[0]===6&&n.label<A[1]){n.label=A[1],A=c;break}if(A&&n.label<A[2]){n.label=A[2],n.ops.push(c);break}A[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(l){c=[6,l],o=0}finally{r=A=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(Ns,"__esModule",{value:!0}),Ns.subscribeToOnlineEvent=void 0;var xf=Mr,c2=Pr,l2=function(e,t){switch(t===void 0&&(t=(0,c2.getValue)("PLATFORM")),t){case xf.PLATFORM.WEB:return window.addEventListener("online",function(){return i2(void 0,void 0,void 0,function(){return s2(this,function(n){switch(n.label){case 0:return[4,e()];case 1:return n.sent(),[2]}})})});case xf.PLATFORM.MOBILE:e();return;default:throw Error("Invalid PLATFORM ".concat(t))}};Ns.subscribeToOnlineEvent=l2;var tA={};Object.defineProperty(tA,"__esModule",{value:!0}),tA.coalesceTokenFetch=tA.buildTokenFetchKey=void 0;var pu="__hiverAuthInFlight",u2=function(){var e=globalThis;return e[pu]||(e[pu]=new Map),e[pu]},g2=function(e,t,n){return"".concat(e??"",":").concat(t??"",":").concat(n??"")};tA.buildTokenFetchKey=g2;var d2=function(e,t){var n=u2(),r=n.get(e);if(r)return r;var o=t().finally(function(){n.delete(e)});return n.set(e,o),o};tA.coalesceTokenFetch=d2;var wf;function Sf(){if(wf)return ii;wf=1;var e=Ze&&Ze.__awaiter||function(E,d,B,p){function f(m){return m instanceof B?m:new B(function(v){v(m)})}return new(B||(B=Promise))(function(m,v){function w(T){try{b(p.next(T))}catch(M){v(M)}}function x(T){try{b(p.throw(T))}catch(M){v(M)}}function b(T){T.done?m(T.value):f(T.value).then(w,x)}b((p=p.apply(E,d||[])).next())})},t=Ze&&Ze.__generator||function(E,d){var B={label:0,sent:function(){if(m[0]&1)throw m[1];return m[1]},trys:[],ops:[]},p,f,m,v;return v={next:w(0),throw:w(1),return:w(2)},typeof Symbol=="function"&&(v[Symbol.iterator]=function(){return this}),v;function w(b){return function(T){return x([b,T])}}function x(b){if(p)throw new TypeError("Generator is already executing.");for(;v&&(v=0,b[0]&&(B=0)),B;)try{if(p=1,f&&(m=b[0]&2?f.return:b[0]?f.throw||((m=f.return)&&m.call(f),0):f.next)&&!(m=m.call(f,b[1])).done)return m;switch(f=0,m&&(b=[b[0]&2,m.value]),b[0]){case 0:case 1:m=b;break;case 4:return B.label++,{value:b[1],done:!1};case 5:B.label++,f=b[1],b=[0];continue;case 7:b=B.ops.pop(),B.trys.pop();continue;default:if(m=B.trys,!(m=m.length>0&&m[m.length-1])&&(b[0]===6||b[0]===2)){B=0;continue}if(b[0]===3&&(!m||b[1]>m[0]&&b[1]<m[3])){B.label=b[1];break}if(b[0]===6&&B.label<m[1]){B.label=m[1],m=b;break}if(m&&B.label<m[2]){B.label=m[2],B.ops.push(b);break}m[2]&&B.ops.pop(),B.trys.pop();continue}b=d.call(E,B)}catch(T){b=[6,T],f=0}finally{p=m=0}if(b[0]&5)throw b[1];return{value:b[0]?b[1]:void 0,done:!0}}};Object.defineProperty(ii,"__esModule",{value:!0}),ii.fetchAccessToken=void 0;var n=vf(),r=Mr,o=gt,A=Ns,a=tA,i,s,c,l=function(E,d,B,p,f,m){return m===void 0&&(m=r.APP_UI.DEFAULT),e(void 0,void 0,void 0,function(){var v,w,x,b,T,M,_,R,F;return t(this,function(O){switch(O.label){case 0:v=2,O.label=1;case 1:return O.trys.push([1,7,,12]),w=void 0,f?[4,f()]:[3,3];case 2:return w=O.sent(),[3,5];case 3:return[4,(0,n.getTenantLoginCode)(r.CONFIG_HIVER,E,d,p,m)];case 4:w=O.sent(),O.label=5;case 5:return[4,(0,n.getLoginToken)(w,r.CONFIG_HIVER,E,p,d.userId,d.usergroupId)];case 6:return x=O.sent(),b=x.userId,T=x.userGroupId,M=x.atToken,_=x.expiryTime,(0,o.setTokenAndExpiry)(M,_),(0,o.setUserDetails)(b,T),[3,12];case 7:R=O.sent(),console.log("ERROR debug: in error login:",R,m),F=B,O.label=8;case 8:return F<v?[4,l(E,d,F+1,p,f,m)]:[3,11];case 9:O.sent(),O.label=10;case 10:return F++,[3,8];case 11:throw R;case 12:return[2]}})})},C=function(E,d,B,p,f){return e(void 0,void 0,void 0,function(){var m,v,w,x;return t(this,function(b){switch(b.label){case 0:return d<r.MAX_CONFLICT_RETRY_DELAY?[4,new Promise(function(T){return setTimeout(T,E)})]:[3,3];case 1:return b.sent(),d+=E,E*2<=r.MAX_BACKOFF_LIMIT?E*=2:E=r.MAX_BACKOFF_LIMIT,m=B.retryDelay,v=B.configs,w=B.apiParams,x=B.appUI,[4,Q(m,E,d,v,w,p,f,x)];case 2:b.sent(),b.label=3;case 3:return[2]}})})},Q=function(E,d,B,p,f,m,v,w,x){return w===void 0&&(w="default"),e(void 0,void 0,void 0,function(){var b,T,M,_,R,F,O,j,W,ne,K,U,V,Z;return t(this,function(G){switch(G.label){case 0:return G.trys.push([0,2,,12]),[4,(0,n.getAccessToken)(r.CONFIG_HIVER,p,f,m,w)];case 1:return b=G.sent(),T=b.atToken,M=b.expiryTime,_=b.userId,R=b.userGroupId,T&&M&&(0,o.setTokenAndExpiry)(T,M),_&&R&&(0,o.setUserDetails)(_,R),E=r.INITIAL_RETRY_DELAY,d=r.INITIAL_RETRY_DELAY,B=0,[3,12];case 2:return F=G.sent(),console.log("ERROR: Heimdall fetch token",F),((W=F.response)===null||W===void 0?void 0:W.status)===401||((ne=F.request)===null||ne===void 0?void 0:ne.status)===401?(O=1,[4,l(p,f,O,m,v,x)]):[3,4];case 3:return G.sent(),[3,11];case 4:return((K=F.response)===null||K===void 0?void 0:K.status)===409||((U=F.request)===null||U===void 0?void 0:U.status)===409?(j={retryDelay:E,configs:p,apiParams:f,appUI:x},[4,C(d,B,j,m,v)]):[3,6];case 5:if(G.sent(),B>=r.MAX_CONFLICT_RETRY_DELAY)throw F;return[3,11];case 6:if(!(((V=F.response)===null||V===void 0?void 0:V.status)===422||((Z=F.request)===null||Z===void 0?void 0:Z.status)===422))return[3,7];throw console.log("ERROR: Throwing error",F.response.status),F;case 7:return E<=r.MAX_RETRY_DELAY?[4,new Promise(function(H){return setTimeout(H,E)})]:[3,10];case 8:return G.sent(),E*=2,[4,Q(E,d,B,p,f,m,v,x)];case 9:return G.sent(),[3,11];case 10:throw F;case 11:return[3,12];case 12:return[2]}})})},h=function(E,d,B,p,f,m,v,w){return B===void 0&&(B=r.INITIAL_RETRY_DELAY),p===void 0&&(p=r.INITIAL_RETRY_DELAY),e(void 0,void 0,void 0,function(){var x,b,T;return t(this,function(M){switch(M.label){case 0:return M.trys.push([0,4,,5]),x=(0,o.isTokenInExpiryWindow)(),x?(b=(0,o.getRandomDelay)(),[4,(0,o.introduceDelay)(b)]):[3,3];case 1:return M.sent(),[4,(0,a.coalesceTokenFetch)((0,a.buildTokenFetchKey)(d.userId,d.usergroupId,m),function(){return Q(B,p,f,E,d,m,v,w)})];case 2:M.sent(),M.label=3;case 3:return[3,5];case 4:throw T=M.sent(),T;case 5:return[2]}})})},I=function(E,d,B,p,f,m,v){return e(void 0,void 0,void 0,function(){var w,x,b,T,M,_;return t(this,function(R){switch(R.label){case 0:i=E,s=d,w=r.INITIAL_RETRY_DELAY,x=r.INITIAL_RETRY_DELAY,b=0,T=(0,o.getConfig)(i,s),R.label=1;case 1:return R.trys.push([1,3,,4]),[4,(0,a.coalesceTokenFetch)((0,a.buildTokenFetchKey)(B.userId,B.usergroupId,p),function(){return Q(w,x,b,T,B,p,f,m,v)})];case 2:return R.sent(),clearInterval(c),c=setInterval(function(){return h(T,B,r.INITIAL_RETRY_DELAY,r.INITIAL_RETRY_DELAY,0,p,f,v)},r.REFETCH_CHECK_DELAY),M=function(){return e(void 0,void 0,void 0,function(){return t(this,function(F){switch(F.label){case 0:return[4,h(T,B,r.INITIAL_RETRY_DELAY,r.INITIAL_RETRY_DELAY,0,p,f,v)];case 1:return F.sent(),[2]}})})},(0,A.subscribeToOnlineEvent)(M),[3,4];case 3:return _=R.sent(),console.log("ERROR: Fetching token failed",_),[3,4];case 4:return[2]}})})};return ii.fetchAccessToken=I,ii}var Tf;function Df(){if(Tf)return Ko;Tf=1;var e=Ze&&Ze.__assign||function(){return e=Object.assign||function(E){for(var d,B=1,p=arguments.length;B<p;B++){d=arguments[B];for(var f in d)Object.prototype.hasOwnProperty.call(d,f)&&(E[f]=d[f])}return E},e.apply(this,arguments)},t=Ze&&Ze.__awaiter||function(E,d,B,p){function f(m){return m instanceof B?m:new B(function(v){v(m)})}return new(B||(B=Promise))(function(m,v){function w(T){try{b(p.next(T))}catch(M){v(M)}}function x(T){try{b(p.throw(T))}catch(M){v(M)}}function b(T){T.done?m(T.value):f(T.value).then(w,x)}b((p=p.apply(E,d||[])).next())})},n=Ze&&Ze.__generator||function(E,d){var B={label:0,sent:function(){if(m[0]&1)throw m[1];return m[1]},trys:[],ops:[]},p,f,m,v;return v={next:w(0),throw:w(1),return:w(2)},typeof Symbol=="function"&&(v[Symbol.iterator]=function(){return this}),v;function w(b){return function(T){return x([b,T])}}function x(b){if(p)throw new TypeError("Generator is already executing.");for(;v&&(v=0,b[0]&&(B=0)),B;)try{if(p=1,f&&(m=b[0]&2?f.return:b[0]?f.throw||((m=f.return)&&m.call(f),0):f.next)&&!(m=m.call(f,b[1])).done)return m;switch(f=0,m&&(b=[b[0]&2,m.value]),b[0]){case 0:case 1:m=b;break;case 4:return B.label++,{value:b[1],done:!1};case 5:B.label++,f=b[1],b=[0];continue;case 7:b=B.ops.pop(),B.trys.pop();continue;default:if(m=B.trys,!(m=m.length>0&&m[m.length-1])&&(b[0]===6||b[0]===2)){B=0;continue}if(b[0]===3&&(!m||b[1]>m[0]&&b[1]<m[3])){B.label=b[1];break}if(b[0]===6&&B.label<m[1]){B.label=m[1],m=b;break}if(m&&B.label<m[2]){B.label=m[2],B.ops.push(b);break}m[2]&&B.ops.pop(),B.trys.pop();continue}b=d.call(E,B)}catch(T){b=[6,T],f=0}finally{p=m=0}if(b[0]&5)throw b[1];return{value:b[0]?b[1]:void 0,done:!0}}};Object.defineProperty(Ko,"__esModule",{value:!0}),Ko.hiverAxiosCall=Ko.performAxiosCall=void 0;var r=mf,o=gt,A=Sf(),a=_r,i=Mr,s,c=2,l=function(E,d){var B=d.fetchCsrfToken();E.formData?E.formData.append("_csrf_token",B):(E.data=E.data||{},E.data._csrf_token=B)},C=function(E,d){var B={};!E.method||E.method.toLowerCase()==="get"?B={params:E.params?E.params:E.data}:B=E.params?{params:E,data:E.data}:{data:E.data};var p=e(e({method:E.method,url:"".concat(E.root_url).concat(E.url),headers:E.headers},B),{withCredentials:d,responseType:(E==null?void 0:E.responseType)||""});return p};function Q(E,d){return d===void 0&&(d=!0),t(this,void 0,void 0,function(){var B;return n(this,function(p){return B=C(E,d),[2,(0,r.default)(B).then(function(f){return f}).catch(function(f){throw f})]})})}Ko.performAxiosCall=Q;function h(E,d,B){return t(this,void 0,void 0,function(){var p,f;return n(this,function(m){switch(m.label){case 0:return p=E.appEnv,f=E.tier,[4,(0,A.fetchAccessToken)(p,f,d,E.tenantPlatform,E.getTokenForLogin,B)];case 1:return m.sent(),[2]}})})}function I(E,d,B,p,f){var m,v,w,x;return f===void 0&&(f=0),t(this,void 0,void 0,function(){var b,T,M,_,R,F,O,j;return n(this,function(W){switch(W.label){case 0:if(W.trys.push([0,4,,5]),!(B.getToken&&!(0,o.hasValidToken)(d)))return[3,2];if(b=E.appEnv,T=E.tier,!b||!T)throw Error("appEnv or tier missing : ".concat(b,"/").concat(T));return"userId"in d&&"usergroupId"in d?(M={userId:d.userId,usergroupId:d.usergroupId},[4,h(E,M,p)]):[3,2];case 1:W.sent(),W.label=2;case 2:return E.csrfToken&&l(d,B),_=E.tenantPlatform===i.TENANT_PLATFORM.HIVERWEB?i.TENANT_PLATFORM.HIVERWEB:i.TENANT_PLATFORM.GMAIL,d.headers=e(e({},d.headers),{"x-hiver-tenant":_,"x-hiver-userid":(0,a.getItemFromStorage)("hiverAuthUserId")||"0","x-hiver-usergroupid":(0,a.getItemFromStorage)("hiverAuthUserGroupId")||"0"}),B.getToken&&(s=(0,a.getItemFromStorage)("hiverAuthToken")||"",d.headers=e(e({},d.headers),{Authorization:"Bearer ".concat(s)})),[4,Q(d,E.withCredentials)];case 3:return R=W.sent(),d.onSuccess&&d.onSuccess(R),[2,R];case 4:if(F=W.sent(),O=((m=F.response)===null||m===void 0?void 0:m.status)===403||((v=F.request)===null||v===void 0?void 0:v.status)===403,j=((w=F.response)===null||w===void 0?void 0:w.status)===401||((x=F.request)===null||x===void 0?void 0:x.status)===401,f<c&&(O||j))return(0,o.expireToken)(),[2,I(E,d,B,p,f+1)];if(f>=c&&O||!O)throw d.onFail&&d.onFail(F),console.log("ERROR: Reached make Axios",F),F;return[3,5];case 5:return[2]}})})}return Ko.hiverAxiosCall=I,Ko}var si={},Ot={},_t={};Object.defineProperty(_t,"__esModule",{value:!0}),_t.TIERS=_t.APP_UI=_t.CONFIG_HIVER=_t.GREXIT_ADMIN_DOMAIN=_t.REFETCH_CHECK_DELAY=_t.INITIAL_RETRY_DELAY=_t.MAX_BACKOFF_LIMIT=_t.MAX_CONFLICT_RETRY_DELAY=_t.MAX_RETRY_DELAY=_t.GET_METHOD=void 0,_t.GET_METHOD="GET",_t.MAX_RETRY_DELAY=18e4,_t.MAX_CONFLICT_RETRY_DELAY=63e3,_t.MAX_BACKOFF_LIMIT=8e3,_t.INITIAL_RETRY_DELAY=1e3,_t.REFETCH_CHECK_DELAY=168e4,_t.GREXIT_ADMIN_DOMAIN="admin.hiverhq.com",_t.CONFIG_HIVER={getToken:!1,fetchCsrfToken:function(){return""},isHiverApiDomain:!0},_t.APP_UI={COLLAB_SPACE:"collab-space",DEFAULT:"default"},_t.TIERS={DEV:"dev",SIT:"sit",PROD:"production"};var Vn={};Object.defineProperty(Vn,"__esModule",{value:!0}),Vn.getProdHqConfig=Vn.getProdApiConfig=Vn.getSitHqConfig=Vn.getSitApiConfig=Vn.getDevHqConfig=Vn.getDevApiConfig=void 0;var NA={heimdallTokenFetch:"/v1/token/get",heimdallLogin:"/v1/login/code",v2Login:"/api/auth/login/code"},C2=function(){return{v2Url:"https://v2dev.hiver.space",heimdallUrl:"https://dev.hiver.space/api/heimdall-api",apiEndpoints:NA}};Vn.getDevApiConfig=C2;var E2=function(){return{v2Url:"https://v2dev.hiver.space",heimdallUrl:"https://dev.hiver.space/api/heimdall-api2",apiEndpoints:NA}};Vn.getDevHqConfig=E2;var f2=function(e){return{v2Url:"https://v2".concat(e,".hiver.space"),heimdallUrl:"https://".concat(e,".hiver.space/api/heimdall-api"),apiEndpoints:NA}};Vn.getSitApiConfig=f2;var I2=function(e){return{v2Url:"https://v2".concat(e,".hiver.space"),heimdallUrl:"https://".concat(e,".hiver.space/api/heimdall-api2"),apiEndpoints:NA}};Vn.getSitHqConfig=I2;var p2=function(e){return e===void 0&&(e=!1),{v2Url:e?"https://admin.hiverhq.com":"https://v2.hiverhq.com",heimdallUrl:"https://heimdall.hiverapi.com",apiEndpoints:NA}};Vn.getProdApiConfig=p2;var B2=function(e){return e===void 0&&(e=!1),{v2Url:e?"https://admin.hiverhq.com":"https://v2.hiverhq.com",heimdallUrl:"https://heimdall2.hiverhq.com",apiEndpoints:NA}};Vn.getProdHqConfig=B2;var h2=Ze&&Ze.__awaiter||function(e,t,n,r){function o(A){return A instanceof n?A:new n(function(a){a(A)})}return new(n||(n=Promise))(function(A,a){function i(l){try{c(r.next(l))}catch(C){a(C)}}function s(l){try{c(r.throw(l))}catch(C){a(C)}}function c(l){l.done?A(l.value):o(l.value).then(i,s)}c((r=r.apply(e,t||[])).next())})},Q2=Ze&&Ze.__generator||function(e,t){var n={label:0,sent:function(){if(A[0]&1)throw A[1];return A[1]},trys:[],ops:[]},r,o,A,a;return a={next:i(0),throw:i(1),return:i(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function i(c){return function(l){return s([c,l])}}function s(c){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(n=0)),n;)try{if(r=1,o&&(A=c[0]&2?o.return:c[0]?o.throw||((A=o.return)&&A.call(o),0):o.next)&&!(A=A.call(o,c[1])).done)return A;switch(o=0,A&&(c=[c[0]&2,A.value]),c[0]){case 0:case 1:A=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,o=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(A=n.trys,!(A=A.length>0&&A[A.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!A||c[1]>A[0]&&c[1]<A[3])){n.label=c[1];break}if(c[0]===6&&n.label<A[1]){n.label=A[1],A=c;break}if(A&&n.label<A[2]){n.label=A[2],n.ops.push(c);break}A[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(l){c=[6,l],o=0}finally{r=A=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(Ot,"__esModule",{value:!0}),Ot.expireToken=Ot.validateToken=Ot.validateAccount=Ot.getConfig=Ot.introduceDelay=Ot.isTokenInExpiryWindow=Ot.getStoredAuthData=Ot.setUserDetails=Ot.setTokenAndExpiry=Ot.getRandomDelay=Ot.hasValidToken=void 0;var Rs=_t,RA=Vn,Of=function(){var e=new Date,t=new Date(e.getTime()+e.getTimezoneOffset()*6e4);return t},Bu=function(e){var t=parseInt(sessionStorage.getItem("hiverAuthUserId")||"0"),n=parseInt(sessionStorage.getItem("hiverAuthUserGroupId")||"0"),r=e.userId,o=e.usergroupId;return t===r&&o===n};Ot.validateAccount=Bu;var m2=function(e){var t=Bu(e);return!Ff()&&t};Ot.validateToken=m2;var b2=function(){try{sessionStorage.removeItem("hiverAuthTokenExpiry")}catch{console.log("Heimdall: Unable to Remove token.")}};Ot.expireToken=b2;var y2=function(e){var t=sessionStorage.getItem("hiverAuthTokenExpiry")||"",n=new Date(t),r=Of(),o=Bu(e);return r<n&&o};Ot.hasValidToken=y2;var v2=function(){return Math.floor(Math.random()*6e4)+6e4};Ot.getRandomDelay=v2;var x2=function(e,t){if(!e||!t)throw new Error("User Id or user group Id not found in the response");sessionStorage.setItem("hiverAuthUserId",e),sessionStorage.setItem("hiverAuthUserGroupId",t)};Ot.setUserDetails=x2;var w2=function(e,t){if(!e)throw new Error("Token not found in the response");sessionStorage.setItem("hiverAuthToken",e),sessionStorage.setItem("hiverAuthTokenExpiry",t)};Ot.setTokenAndExpiry=w2;var S2=function(){var e=sessionStorage.getItem("hiverAuthTokenExpiry"),t=sessionStorage.getItem("hiverAuthToken"),n=sessionStorage.getItem("hiverAuthUserId"),r=sessionStorage.getItem("hiverAuthUserGroupId");return{token:t,expiryTime:e,userId:n,usergroupId:r}};Ot.getStoredAuthData=S2;var Ff=function(){var e=sessionStorage.getItem("hiverAuthTokenExpiry")||"";if(!e)return!0;var t=Of(),n=new Date(e),r=4*60*1e3,o=n.getTime()-t.getTime()<r;return o};Ot.isTokenInExpiryWindow=Ff;var T2=function(e){return h2(void 0,void 0,void 0,function(){return Q2(this,function(t){switch(t.label){case 0:return[4,new Promise(function(n){return setTimeout(n,e)})];case 1:return t.sent(),[2]}})})};Ot.introduceDelay=T2;var D2=function(){return window.location.host===Rs.GREXIT_ADMIN_DOMAIN},O2=function(e,t,n){var r=D2();switch(t){case Rs.TIERS.SIT:return n?(0,RA.getSitApiConfig)(e):(0,RA.getSitHqConfig)(e);case Rs.TIERS.PROD:return n?(0,RA.getProdApiConfig)(r):(0,RA.getProdHqConfig)(r);case Rs.TIERS.DEV:default:return n?(0,RA.getDevApiConfig)():(0,RA.getDevHqConfig)()}};Ot.getConfig=O2;var ci={},to={},Mf;function F2(){if(Mf)return to;Mf=1;var e=Ze&&Ze.__awaiter||function(h,I,E,d){function B(p){return p instanceof E?p:new E(function(f){f(p)})}return new(E||(E=Promise))(function(p,f){function m(x){try{w(d.next(x))}catch(b){f(b)}}function v(x){try{w(d.throw(x))}catch(b){f(b)}}function w(x){x.done?p(x.value):B(x.value).then(m,v)}w((d=d.apply(h,I||[])).next())})},t=Ze&&Ze.__generator||function(h,I){var E={label:0,sent:function(){if(p[0]&1)throw p[1];return p[1]},trys:[],ops:[]},d,B,p,f;return f={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function m(w){return function(x){return v([w,x])}}function v(w){if(d)throw new TypeError("Generator is already executing.");for(;f&&(f=0,w[0]&&(E=0)),E;)try{if(d=1,B&&(p=w[0]&2?B.return:w[0]?B.throw||((p=B.return)&&p.call(B),0):B.next)&&!(p=p.call(B,w[1])).done)return p;switch(B=0,p&&(w=[w[0]&2,p.value]),w[0]){case 0:case 1:p=w;break;case 4:return E.label++,{value:w[1],done:!1};case 5:E.label++,B=w[1],w=[0];continue;case 7:w=E.ops.pop(),E.trys.pop();continue;default:if(p=E.trys,!(p=p.length>0&&p[p.length-1])&&(w[0]===6||w[0]===2)){E=0;continue}if(w[0]===3&&(!p||w[1]>p[0]&&w[1]<p[3])){E.label=w[1];break}if(w[0]===6&&E.label<p[1]){E.label=p[1],p=w;break}if(p&&E.label<p[2]){E.label=p[2],E.ops.push(w);break}p[2]&&E.ops.pop(),E.trys.pop();continue}w=I.call(h,E)}catch(x){w=[6,x],B=0}finally{d=p=0}if(w[0]&5)throw w[1];return{value:w[0]?w[1]:void 0,done:!0}}};Object.defineProperty(to,"__esModule",{value:!0}),to.getV2LoginCode=to.getLoginToken=to.getAccessToken=void 0;var n=_t,r=Nf(),o=Ot,A=Mr,a=function(h,I,E){var d,B=(0,o.getStoredAuthData)();return{root_url:h.heimdallUrl,url:h.apiEndpoints.heimdallTokenFetch,method:n.GET_METHOD,data:{user_id:I.userId,usergroup_id:I.usergroupId,access_token:(B==null?void 0:B.token)||"",source:E},withCredentials:!0,tenant:(d=I.tenant)!==null&&d!==void 0?d:A.TENANT_PLATFORM.GMAIL}},i=function(h,I,E){var d;return{root_url:I.heimdallUrl,url:I.apiEndpoints.heimdallLogin,method:n.GET_METHOD,data:{code:h},withCredentials:!0,tenant:(d=E.tenant)!==null&&d!==void 0?d:A.TENANT_PLATFORM.GMAIL}},s=function(h){return parseInt(h,10)},c=function(h,I,E){var d;return{root_url:h.v2Url,url:h.apiEndpoints.v2Login,method:n.GET_METHOD,withCredentials:!0,data:{usersession:s(localStorage.getItem("hiver-config.usersession")),app:E||n.APP_UI.DEFAULT},tenant:(d=I.tenant)!==null&&d!==void 0?d:A.TENANT_PLATFORM.GMAIL}},l=function(h,I,E,d){return e(void 0,void 0,void 0,function(){var B,p,f,m,v,w,x;return t(this,function(b){switch(b.label){case 0:return b.trys.push([0,4,,5]),(0,o.validateToken)(E)?[3,2]:(B=a(I,E,d),[4,(0,r.makeAxiosCall)(B,h)]);case 1:return p=b.sent(),[2,{atToken:(m=p==null?void 0:p.data.at)===null||m===void 0?void 0:m.token,expiryTime:(v=p==null?void 0:p.data.at)===null||v===void 0?void 0:v.expires_at,userId:(w=p==null?void 0:p.data)===null||w===void 0?void 0:w.user_id,userGroupId:(x=p==null?void 0:p.data)===null||x===void 0?void 0:x.usergroup_id}];case 2:return[2,{}];case 3:return[3,5];case 4:throw f=b.sent(),f;case 5:return[2]}})})};to.getAccessToken=l;var C=function(h,I,E,d){return e(void 0,void 0,void 0,function(){var B,p,f,m,v,w,x;return t(this,function(b){switch(b.label){case 0:B=i(h,E,d),b.label=1;case 1:return b.trys.push([1,3,,4]),[4,(0,r.makeAxiosCall)(B,I)];case 2:return p=b.sent(),[2,{userId:(m=p==null?void 0:p.data)===null||m===void 0?void 0:m.user_id,userGroupId:(v=p==null?void 0:p.data)===null||v===void 0?void 0:v.usergroup_id,atToken:(w=p==null?void 0:p.data.at)===null||w===void 0?void 0:w.token,expiryTime:(x=p==null?void 0:p.data.at)===null||x===void 0?void 0:x.expires_at}];case 3:throw f=b.sent(),f;case 4:return[2]}})})};to.getLoginToken=C;var Q=function(h,I,E,d){return e(void 0,void 0,void 0,function(){var B,p,f;return t(this,function(m){switch(m.label){case 0:return m.trys.push([0,2,,3]),console.log("ERROR debug: in getV2loginCode:",d),B=c(I,E,d),[4,(0,r.makeAxiosCall)(B,h)];case 1:return p=m.sent(),[2,p==null?void 0:p.data.code];case 2:throw f=m.sent(),f;case 3:return[2]}})})};return to.getV2LoginCode=Q,to}var _f;function Pf(){if(_f)return ci;_f=1;var e=Ze&&Ze.__awaiter||function(I,E,d,B){function p(f){return f instanceof d?f:new d(function(m){m(f)})}return new(d||(d=Promise))(function(f,m){function v(b){try{x(B.next(b))}catch(T){m(T)}}function w(b){try{x(B.throw(b))}catch(T){m(T)}}function x(b){b.done?f(b.value):p(b.value).then(v,w)}x((B=B.apply(I,E||[])).next())})},t=Ze&&Ze.__generator||function(I,E){var d={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},B,p,f,m;return m={next:v(0),throw:v(1),return:v(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function v(x){return function(b){return w([x,b])}}function w(x){if(B)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(d=0)),d;)try{if(B=1,p&&(f=x[0]&2?p.return:x[0]?p.throw||((f=p.return)&&f.call(p),0):p.next)&&!(f=f.call(p,x[1])).done)return f;switch(p=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return d.label++,{value:x[1],done:!1};case 5:d.label++,p=x[1],x=[0];continue;case 7:x=d.ops.pop(),d.trys.pop();continue;default:if(f=d.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){d=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){d.label=x[1];break}if(x[0]===6&&d.label<f[1]){d.label=f[1],f=x;break}if(f&&d.label<f[2]){d.label=f[2],d.ops.push(x);break}f[2]&&d.ops.pop(),d.trys.pop();continue}x=E.call(I,d)}catch(b){x=[6,b],p=0}finally{B=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}};Object.defineProperty(ci,"__esModule",{value:!0}),ci.fetchToken=void 0;var n=F2(),r=_t,o=Ot,A=tA,a,i,s,c=function(I,E,d,B){return B===void 0&&(B=r.APP_UI.DEFAULT),e(void 0,void 0,void 0,function(){var p,f,m,v,w,x,b,T,M;return t(this,function(_){switch(_.label){case 0:p=2,_.label=1;case 1:return _.trys.push([1,4,,9]),[4,(0,n.getV2LoginCode)(r.CONFIG_HIVER,I,d,B)];case 2:return f=_.sent(),[4,(0,n.getLoginToken)(f,r.CONFIG_HIVER,I,d)];case 3:return m=_.sent(),v=m.userId,w=m.userGroupId,x=m.atToken,b=m.expiryTime,(0,o.setTokenAndExpiry)(x,b),(0,o.setUserDetails)(v,w),[3,9];case 4:T=_.sent(),console.log("ERROR debug: in error login:",T,B),M=E,_.label=5;case 5:return M<p?[4,c(I,M+1,d,B)]:[3,8];case 6:_.sent(),_.label=7;case 7:return M++,[3,5];case 8:throw T;case 9:return[2]}})})},l=function(I,E,d){return e(void 0,void 0,void 0,function(){var B,p,f,m;return t(this,function(v){switch(v.label){case 0:return E<r.MAX_CONFLICT_RETRY_DELAY?[4,new Promise(function(w){return setTimeout(w,I)})]:[3,3];case 1:return v.sent(),E+=I,I*2<=r.MAX_BACKOFF_LIMIT?I*=2:I=r.MAX_BACKOFF_LIMIT,B=d.retryDelay,p=d.configs,f=d.api_params,m=d.appUI,[4,C(B,I,E,p,f,m)];case 2:v.sent(),v.label=3;case 3:return[2]}})})},C=function(I,E,d,B,p,f,m){return f===void 0&&(f="default"),e(void 0,void 0,void 0,function(){var v,w,x,b,T,M,_,R,F,O,j,W,ne,K;return t(this,function(U){switch(U.label){case 0:return U.trys.push([0,2,,12]),[4,(0,n.getAccessToken)(r.CONFIG_HIVER,B,p,f)];case 1:return v=U.sent(),w=v.atToken,x=v.expiryTime,b=v.userId,T=v.userGroupId,w&&x&&(0,o.setTokenAndExpiry)(w,x),b&&T&&(0,o.setUserDetails)(b,T),I=r.INITIAL_RETRY_DELAY,E=r.INITIAL_RETRY_DELAY,d=0,[3,12];case 2:return M=U.sent(),((F=M.response)===null||F===void 0?void 0:F.status)===401||((O=M.request)===null||O===void 0?void 0:O.status)===401?(_=1,[4,c(B,_,p,m)]):[3,4];case 3:return U.sent(),[3,11];case 4:return((j=M.response)===null||j===void 0?void 0:j.status)===409||((W=M.request)===null||W===void 0?void 0:W.status)===409?(R={retryDelay:I,configs:B,api_params:p,appUI:m},[4,l(E,d,R)]):[3,6];case 5:if(U.sent(),d>=r.MAX_CONFLICT_RETRY_DELAY)throw M;return[3,11];case 6:if(!(((ne=M.response)===null||ne===void 0?void 0:ne.status)===422||((K=M.request)===null||K===void 0?void 0:K.status)===422))return[3,7];throw console.log("ERROR: Throwing error",M.response.status),M;case 7:return I<=r.MAX_RETRY_DELAY?[4,new Promise(function(V){return setTimeout(V,I)})]:[3,10];case 8:return U.sent(),I*=2,console.log("Heimdall: Fetch token post doubling retry delay",I),[4,C(I,E,d,B,p,m)];case 9:return U.sent(),[3,11];case 10:throw M;case 11:return[3,12];case 12:return[2]}})})},Q=function(I,E,d,B,p,f){return d===void 0&&(d=r.INITIAL_RETRY_DELAY),B===void 0&&(B=r.INITIAL_RETRY_DELAY),p===void 0&&(p=0),e(void 0,void 0,void 0,function(){var m,v,w;return t(this,function(x){switch(x.label){case 0:return x.trys.push([0,4,,5]),m=(0,o.isTokenInExpiryWindow)(),m?(v=(0,o.getRandomDelay)(),[4,(0,o.introduceDelay)(v)]):[3,3];case 1:return x.sent(),[4,(0,A.coalesceTokenFetch)((0,A.buildTokenFetchKey)(E.userId,E.usergroupId,E.tenant),function(){return C(d,B,p,I,E,f)})];case 2:x.sent(),x.label=3;case 3:return[3,5];case 4:throw w=x.sent(),w;case 5:return[2]}})})},h=function(I,E,d,B,p,f){return e(void 0,void 0,void 0,function(){var m,v,w,x,b;return t(this,function(T){switch(T.label){case 0:a=I,i=E,m=r.INITIAL_RETRY_DELAY,v=r.INITIAL_RETRY_DELAY,w=0,x=(0,o.getConfig)(a,i,B),T.label=1;case 1:return T.trys.push([1,3,,4]),[4,(0,A.coalesceTokenFetch)((0,A.buildTokenFetchKey)(d.userId,d.usergroupId,d.tenant),function(){return C(m,v,w,x,d,p,f)})];case 2:return T.sent(),clearInterval(s),s=setInterval(function(){return Q(x,d)},r.REFETCH_CHECK_DELAY),window.addEventListener("online",function(){return e(void 0,void 0,void 0,function(){return t(this,function(M){switch(M.label){case 0:return[4,Q(x,d)];case 1:return M.sent(),[2]}})})}),[3,4];case 3:throw b=T.sent(),b;case 4:return[2]}})})};return ci.fetchToken=h,ci}var Lf;function Nf(){if(Lf)return si;Lf=1;var e=Ze&&Ze.__assign||function(){return e=Object.assign||function(I){for(var E,d=1,B=arguments.length;d<B;d++){E=arguments[d];for(var p in E)Object.prototype.hasOwnProperty.call(E,p)&&(I[p]=E[p])}return I},e.apply(this,arguments)},t=Ze&&Ze.__awaiter||function(I,E,d,B){function p(f){return f instanceof d?f:new d(function(m){m(f)})}return new(d||(d=Promise))(function(f,m){function v(b){try{x(B.next(b))}catch(T){m(T)}}function w(b){try{x(B.throw(b))}catch(T){m(T)}}function x(b){b.done?f(b.value):p(b.value).then(v,w)}x((B=B.apply(I,E||[])).next())})},n=Ze&&Ze.__generator||function(I,E){var d={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},B,p,f,m;return m={next:v(0),throw:v(1),return:v(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function v(x){return function(b){return w([x,b])}}function w(x){if(B)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(d=0)),d;)try{if(B=1,p&&(f=x[0]&2?p.return:x[0]?p.throw||((f=p.return)&&f.call(p),0):p.next)&&!(f=f.call(p,x[1])).done)return f;switch(p=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return d.label++,{value:x[1],done:!1};case 5:d.label++,p=x[1],x=[0];continue;case 7:x=d.ops.pop(),d.trys.pop();continue;default:if(f=d.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){d=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){d.label=x[1];break}if(x[0]===6&&d.label<f[1]){d.label=f[1],f=x;break}if(f&&d.label<f[2]){d.label=f[2],d.ops.push(x);break}f[2]&&d.ops.pop(),d.trys.pop();continue}x=E.call(I,d)}catch(b){x=[6,b],p=0}finally{B=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}};Object.defineProperty(si,"__esModule",{value:!0}),si.makeAxiosCall=void 0;var r=mf,o=Ot,A=Pf(),a=Mr,i,s=2,c=function(I,E){var d=E.fetchCsrfToken();I.formData?I.formData.append("_csrf_token",d):(I.data=I.data||{},I.data._csrf_token=d)},l=["/v1/token/get","/v1/login/code","/v1/logout"],C=function(I){var E,d,B,p,f=(E=I.tenant)!==null&&E!==void 0?E:a.TENANT_PLATFORM.GMAIL,m=!I.method||I.method.toLowerCase()==="get"?{params:e(e({},(d=I==null?void 0:I.data)!==null&&d!==void 0?d:{}),{tenant:f})}:{data:(I==null?void 0:I.data)instanceof FormData?I==null?void 0:I.data:e(e({},(B=I==null?void 0:I.data)!==null&&B!==void 0?B:{}),{tenant:f})},v=(I.url||"").split("?")[0],w=l.some(function(b){return v.endsWith(b)}),x=e(e({method:I.method,url:"".concat(I.root_url).concat(I.url),headers:e(e({},(p=I==null?void 0:I.headers)!==null&&p!==void 0?p:{}),w?{}:{"x-hiver-tenant":f})},m),{withCredentials:I.withCredentials,responseType:(I==null?void 0:I.responseType)||""});return x};function Q(I){return t(this,void 0,void 0,function(){var E;return n(this,function(d){return E=C(I),[2,(0,r.default)(E).then(function(B){return B}).catch(function(B){throw B})]})})}function h(I,E,d,B){var p,f;return B===void 0&&(B=0),t(this,void 0,void 0,function(){var m,v,w,x,b,T;return n(this,function(M){switch(M.label){case 0:if(M.trys.push([0,4,,5]),I.tenant||(I.tenant=a.TENANT_PLATFORM.GMAIL),!(E.getToken&&!(0,o.hasValidToken)(I)))return[3,2];if(m=I.app_env,v=I.tier,!m||!v)throw Error("app_env or tier missing : ".concat(m,"/").concat(v));return"userId"in I&&"usergroupId"in I?(w={userId:I.userId,usergroupId:I.usergroupId,tenant:I.tenant},typeof E.isHiverApiDomain!="boolean"&&(E.isHiverApiDomain=!0),[4,(0,A.fetchToken)(m,v,w,E.isHiverApiDomain,d)]):[3,2];case 1:M.sent(),M.label=2;case 2:return I.csrfToken&&c(I,E),E.getToken&&(i=sessionStorage.getItem("hiverAuthToken")||"",I.headers=e(e({},I.headers),{Authorization:"Bearer ".concat(i)})),[4,Q(I)];case 3:return x=M.sent(),I.onSuccess&&I.onSuccess(x),[2,x];case 4:if(b=M.sent(),T=((p=b.response)===null||p===void 0?void 0:p.status)===403||((f=b.request)===null||f===void 0?void 0:f.status)===403,B<s&&T)return(0,o.expireToken)(),[2,h(I,E,d,B+1)];if(B>=s&&T||!T)throw I.onFail&&I.onFail(b),console.log("ERROR: Reached make Axios",b),b;return[3,5];case 5:return[2]}})})}return si.makeAxiosCall=h,si}(function(e){var t=Ze&&Ze.__awaiter||function(h,I,E,d){function B(p){return p instanceof E?p:new E(function(f){f(p)})}return new(E||(E=Promise))(function(p,f){function m(x){try{w(d.next(x))}catch(b){f(b)}}function v(x){try{w(d.throw(x))}catch(b){f(b)}}function w(x){x.done?p(x.value):B(x.value).then(m,v)}w((d=d.apply(h,I||[])).next())})},n=Ze&&Ze.__generator||function(h,I){var E={label:0,sent:function(){if(p[0]&1)throw p[1];return p[1]},trys:[],ops:[]},d,B,p,f;return f={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function m(w){return function(x){return v([w,x])}}function v(w){if(d)throw new TypeError("Generator is already executing.");for(;f&&(f=0,w[0]&&(E=0)),E;)try{if(d=1,B&&(p=w[0]&2?B.return:w[0]?B.throw||((p=B.return)&&p.call(B),0):B.next)&&!(p=p.call(B,w[1])).done)return p;switch(B=0,p&&(w=[w[0]&2,p.value]),w[0]){case 0:case 1:p=w;break;case 4:return E.label++,{value:w[1],done:!1};case 5:E.label++,B=w[1],w=[0];continue;case 7:w=E.ops.pop(),E.trys.pop();continue;default:if(p=E.trys,!(p=p.length>0&&p[p.length-1])&&(w[0]===6||w[0]===2)){E=0;continue}if(w[0]===3&&(!p||w[1]>p[0]&&w[1]<p[3])){E.label=w[1];break}if(w[0]===6&&E.label<p[1]){E.label=p[1],p=w;break}if(p&&E.label<p[2]){E.label=p[2],E.ops.push(w);break}p[2]&&E.ops.pop(),E.trys.pop();continue}w=I.call(h,E)}catch(x){w=[6,x],B=0}finally{d=p=0}if(w[0]&5)throw w[1];return{value:w[0]?w[1]:void 0,done:!0}}};Object.defineProperty(e,"__esModule",{value:!0}),e.DEFAULT_INIT_CONFIG_HIVER=e.TENANT_PLATFORM=e.fetchToken=e.makeAxiosCall=e.Bifrost=void 0;var r=Df(),o=Sf(),A=Mr;Object.defineProperty(e,"TENANT_PLATFORM",{enumerable:!0,get:function(){return A.TENANT_PLATFORM}}),Object.defineProperty(e,"DEFAULT_INIT_CONFIG_HIVER",{enumerable:!0,get:function(){return A.DEFAULT_INIT_CONFIG_HIVER}});var a=vf(),i=gt,s=_r,c=Nf();Object.defineProperty(e,"makeAxiosCall",{enumerable:!0,get:function(){return c.makeAxiosCall}});var l=Pf();Object.defineProperty(e,"fetchToken",{enumerable:!0,get:function(){return l.fetchToken}});var C=Pr,Q=function(){function h(I,E,d,B,p,f){d===void 0&&(d=A.TENANT_PLATFORM.GMAIL),B===void 0&&(B=null),p===void 0&&(p=!0),f===void 0&&(f=!1),this.setEnvironment(),this.appEnv=I,this.tier=E,this.tenantPlatform=d,this.authTokenFetchingInProgress=!1,this.getTokenForLogin=B,this.withCredentials=p,this.csrfToken=f}return h.prototype.setEnvironment=function(){typeof window<"u"&&window.document?(0,C.setValue)("PLATFORM",A.PLATFORM.WEB):(0,C.setValue)("PLATFORM",A.PLATFORM.MOBILE)},h.prototype.hiverAxios=function(I,E,d,B){return E===void 0&&(E=A.DEFAULT_INIT_CONFIG_HIVER),t(this,void 0,void 0,function(){var p,f;return n(this,function(m){switch(m.label){case 0:return m.trys.push([0,4,,5]),B&&B<2?(p={userId:I.userId,usergroupId:I.usergroupId,apiRetry:B},[4,(0,o.fetchAccessToken)(this.appEnv,this.tier,p,this.tenantPlatform,this.getTokenForLogin,A.API_CALL_ORIGIN.API_RETRY)]):[3,2];case 1:m.sent(),m.label=2;case 2:return[4,(0,r.hiverAxiosCall)(this,I,E,d)];case 3:return[2,m.sent()];case 4:throw f=m.sent(),console.log("ERROR: Axios call failed",f),f;case 5:return[2]}})})},h.prototype.fetchAuthToken=function(I,E,d){return t(this,void 0,void 0,function(){return n(this,function(B){switch(B.label){case 0:return[4,(0,o.fetchAccessToken)(this.appEnv,this.tier,I,this.tenantPlatform,this.getTokenForLogin,E,d)];case 1:return B.sent(),[2]}})})},h.prototype.logout=function(){return t(this,void 0,void 0,function(){var I,E;return n(this,function(d){switch(d.label){case 0:return d.trys.push([0,2,,3]),I=(0,i.getConfig)(this.appEnv,this.tier),[4,(0,a.logoutFromHeimdall)(I,this.tenantPlatform)];case 1:return d.sent(),(0,s.removeItemFromStorage)("hiverAuthToken"),(0,s.removeItemFromStorage)("hiverAuthTokenExpiry"),(0,s.removeItemFromStorage)("hiverAuthUserId"),(0,s.removeItemFromStorage)("hiverAuthUserGroupId"),[3,3];case 2:throw E=d.sent(),console.error("Heimdall: Logout failed",E),E;case 3:return[2]}})})},h.prototype.isTokenFetchingInProgress=function(){return this.authTokenFetchingInProgress},h}();e.Bifrost=Q})(Ul);const ir={userId:"",userGroupId:"",baseUrl:"",appEnv:"",tier:"",bifrost:null,isInitiated:!1},br=()=>{if(!ir.isInitiated)return null;if(!ir.baseUrl)throw new Error("Base url is not setup. please call the initConnectorsBifrost function with the appropriate value");return ir},M2=({baseUrl:e,appEnv:t,tier:n,userId:r,userGroupId:o,tenantPlatform:A=Ul.TENANT_PLATFORM.GMAIL,withCredentials:a=!0,getTokenForLogin:i,onUserAuthRequired:s})=>{ir.baseUrl=e,ir.appEnv=t,ir.tier=n,ir.userGroupId=o,ir.userId=r,ir.tenantPlatform=A,ir.onUserAuthRequired=s,ir.bifrost=new Ul.Bifrost(t,n,A,i,a),ir.isInitiated=!0},_2="connector-logs-debug",Rf=()=>{},kf=()=>{var e;try{return((e=globalThis.localStorage)==null?void 0:e.getItem(_2))==="true"}catch{return!1}},li=e=>{var n;if(!kf())return Rf;const t=(n=globalThis.console)==null?void 0:n[e];return typeof t=="function"?t.bind(globalThis.console):Rf},pt={get log(){return li("debug")},get debug(){return li("debug")},get info(){return li("info")},get warn(){return li("warn")},get error(){return li("error")},get enabled(){return kf()}},Ue=(({configHiver:e})=>async n=>{var Q,h,I;const r=br();if(!r)throw new Error("Please call initConnectorsBifrost before making any api calls");const{bifrost:o,userGroupId:A,userId:a}=r,{url:i,method:s,root_url:c}=n,C={root_url:(c||r.baseUrl)+((n==null?void 0:n.prefix)||""),url:i,method:s,headers:n==null?void 0:n.headers,onSuccess:n==null?void 0:n.onSuccess,onFail:n==null?void 0:n.onFail,data:n==null?void 0:n.data,params:n==null?void 0:n.params,formData:n==null?void 0:n.formData,responseType:n==null?void 0:n.responseType,userId:Number(a),usergroupId:Number(A)};try{return await(o==null?void 0:o.hiverAxios(C,{...e,isHiverApiDomain:!0}))}catch(E){const d=E,B=(Q=d==null?void 0:d.response)==null?void 0:Q.status,p=(h=d==null?void 0:d.response)==null?void 0:h.data;if(B===412&&(p==null?void 0:p.error_code)==="USER_AUTH_REQUIRED")try{(I=r.onUserAuthRequired)==null||I.call(r,p)}catch(f){pt.error("onUserAuthRequired callback threw: ",f)}throw pt.error("API call failed with error: ",E),E}})({configHiver:{getToken:!0,fetchCsrfToken:()=>"",isHiverApiDomain:!0},withCredentials:!0}),P2="/v1/api"+"/templates/metadata",kA={GET:"GET",POST:"POST",DELETE:"DELETE",PATCH:"PATCH",PUT:"PUT"},L2="Invalid text",N2=async e=>{const t=new URLSearchParams,{inboxIds:n,channelType:r,conversationId:o,fetchAuthenticatedConnectors:A}=e||{};return n==null||n.forEach(i=>{t.append("inbox_ids",i)}),[["channel_type",r],["conversation_id",o],["fetch_authenticated_connectors",A==null?void 0:A.toString()]].forEach(([i,s])=>{s!==void 0&&t.append(i,s)}),Ue({url:`${P2}?${t.toString()}`,method:kA.GET})},R2="/v1/api/connectors/ug",k2=async(e,t)=>{const n=new URLSearchParams;for(const[a,i]of Object.entries(e||{}))if(Array.isArray(i))i.forEach(s=>{s&&n.append(a,String(s))});else{if(!i)continue;n.append(a,i)}n.append(t?"onlyEnabled":"onlyEnabledAuthenticated","true"),n.append("minimal","true");const r=R2+`?${n.toString()}`,o=await Ue({url:r,method:kA.GET}),A=o==null?void 0:o.data;return Array.isArray(A)?A.map(({id:a,name:i,logo:s,type:c,connectorType:l,isConnectorAvailableInPlan:C})=>({id:a,name:i,logo:s,type:c,connectorType:l,isConnectorAvailableInPlan:C})).filter(({logo:a})=>!!a):[]},j2=(e,t)=>{const n=new Map,r=(o,A)=>{o.forEach(a=>{const i=a==null?void 0:a.objectName;if(!i)return;const s=n.get(i)||{objectName:i,fieldsMap:new Map};((a==null?void 0:a.fields)||[]).forEach(c=>{const l=c==null?void 0:c.fieldKey;l&&(A||!s.fieldsMap.has(l))&&s.fieldsMap.set(l,c)}),n.set(i,s)})};return r(e,!0),r(t,!1),Array.from(n.values()).map(({objectName:o,fieldsMap:A})=>{const a=Array.from(A.values());return a.sort((i,s)=>i.fieldSource!==s.fieldSource?i.fieldSource==="TEMPLATE"?-1:1:(i.fieldLabel||"").toLowerCase().localeCompare((s.fieldLabel||"").toLowerCase())),{objectName:o,fields:a}}).filter(({fields:o})=>o.length>0)},jf=e=>e.flatMap(({objectName:t,fields:n=[]})=>n.map(r=>({id:`${t}::${r.fieldKey}`,value:`${t}::${r.fieldKey}`,displayName:`${t} - ${r.fieldLabel}`,objectName:t,fieldKey:r.fieldKey,fieldLabel:r.fieldLabel,fieldSource:r.fieldSource}))),V2=async e=>{var A,a;const[t,n]=await Promise.all([Ue({url:`/v1/api/connectors/${e}/object-fields/static`,method:kA.GET}),Ue({url:`/v1/api/connectors/${e}/object-fields/dynamic`,method:kA.GET})]),r=((A=t==null?void 0:t.data)==null?void 0:A.objects)??[],o=((a=n==null?void 0:n.data)==null?void 0:a.objects)??[];return jf(j2(r,o))},Vf=e=>{const t=e.filter(n=>{var r;return!!n.objectName&&(((r=n.fields)==null?void 0:r.length)??0)>0}).map(n=>{const r=(n.fields||[]).slice().sort((o,A)=>o.fieldSource!==A.fieldSource?o.fieldSource==="TEMPLATE"?-1:1:(o.fieldLabel||"").toLowerCase().localeCompare((A.fieldLabel||"").toLowerCase()));return{objectName:n.objectName,fields:r}});return jf(t)},G2=async e=>{var n;const t=await Ue({url:`/v1/api/connectors/${e}/object-fields/static`,method:kA.GET});return Vf(((n=t==null?void 0:t.data)==null?void 0:n.objects)??[])},H2=async e=>{var n;const t=await Ue({url:`/v1/api/connectors/${e}/object-fields/dynamic`,method:kA.GET});return Vf(((n=t==null?void 0:t.data)==null?void 0:n.objects)??[])};var jA=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(){}},nA=typeof window>"u"||"Deno"in globalThis;function sr(){}function W2(e,t){return typeof e=="function"?e(t):e}function hu(e){return typeof e=="number"&&e>=0&&e!==1/0}function Gf(e,t){return Math.max(e+(t||0)-Date.now(),0)}function VA(e,t){return typeof e=="function"?e(t):e}function yr(e,t){return typeof e=="function"?e(t):e}function Hf(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:A,queryKey:a,stale:i}=e;if(a){if(r){if(t.queryHash!==Qu(a,t.options))return!1}else if(!ui(t.queryKey,a))return!1}if(n!=="all"){const s=t.isActive();if(n==="active"&&!s||n==="inactive"&&s)return!1}return!(typeof i=="boolean"&&t.isStale()!==i||o&&o!==t.state.fetchStatus||A&&!A(t))}function Wf(e,t){const{exact:n,status:r,predicate:o,mutationKey:A}=e;if(A){if(!t.options.mutationKey)return!1;if(n){if(rA(t.options.mutationKey)!==rA(A))return!1}else if(!ui(t.options.mutationKey,A))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function Qu(e,t){return((t==null?void 0:t.queryKeyHashFn)||rA)(e)}function rA(e){return JSON.stringify(e,(t,n)=>bu(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function ui(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!ui(e[n],t[n])):!1}function mu(e,t){if(e===t)return e;const n=zf(e)&&zf(t);if(n||bu(e)&&bu(t)){const r=n?e:Object.keys(e),o=r.length,A=n?t:Object.keys(t),a=A.length,i=n?[]:{};let s=0;for(let c=0;c<a;c++){const l=n?c:A[c];(!n&&r.includes(l)||n)&&e[l]===void 0&&t[l]===void 0?(i[l]=void 0,s++):(i[l]=mu(e[l],t[l]),i[l]===e[l]&&e[l]!==void 0&&s++)}return o===a&&s===o?e:i}return t}function ks(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 zf(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function bu(e){if(!Yf(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Yf(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Yf(e){return Object.prototype.toString.call(e)==="[object Object]"}function z2(e){return new Promise(t=>{setTimeout(t,e)})}function yu(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 mu(e,t)}catch(r){console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`)}return mu(e,t)}return t}function Y2(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function J2(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var js=Symbol();function Jf(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===js&&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===js?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var X2=(Eb=class extends jA{constructor(){super();Ve(this,mA);Ve(this,Mo);Ve(this,Fa);De(this,Fa,t=>{if(!nA&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){N(this,Mo)||this.setEventListener(N(this,Fa))}onUnsubscribe(){var t;this.hasListeners()||((t=N(this,Mo))==null||t.call(this),De(this,Mo,void 0))}setEventListener(t){var n;De(this,Fa,t),(n=N(this,Mo))==null||n.call(this),De(this,Mo,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){N(this,mA)!==t&&(De(this,mA,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof N(this,mA)=="boolean"?N(this,mA):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},mA=new WeakMap,Mo=new WeakMap,Fa=new WeakMap,Eb),vu=new X2,Z2=(fb=class extends jA{constructor(){super();Ve(this,Ma,!0);Ve(this,_o);Ve(this,_a);De(this,_a,t=>{if(!nA&&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(){N(this,_o)||this.setEventListener(N(this,_a))}onUnsubscribe(){var t;this.hasListeners()||((t=N(this,_o))==null||t.call(this),De(this,_o,void 0))}setEventListener(t){var n;De(this,_a,t),(n=N(this,_o))==null||n.call(this),De(this,_o,t(this.setOnline.bind(this)))}setOnline(t){N(this,Ma)!==t&&(De(this,Ma,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return N(this,Ma)}},Ma=new WeakMap,_o=new WeakMap,_a=new WeakMap,fb),Vs=new Z2;function xu(){let e,t;const n=new Promise((o,A)=>{e=o,t=A});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 U2(e){return Math.min(1e3*2**e,3e4)}function Xf(e){return(e??"online")==="online"?Vs.isOnline():!0}var Zf=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function wu(e){return e instanceof Zf}function Uf(e){let t=!1,n=0,r=!1,o;const A=xu(),a=E=>{var d;r||(Q(new Zf(E)),(d=e.abort)==null||d.call(e))},i=()=>{t=!0},s=()=>{t=!1},c=()=>vu.isFocused()&&(e.networkMode==="always"||Vs.isOnline())&&e.canRun(),l=()=>Xf(e.networkMode)&&e.canRun(),C=E=>{var d;r||(r=!0,(d=e.onSuccess)==null||d.call(e,E),o==null||o(),A.resolve(E))},Q=E=>{var d;r||(r=!0,(d=e.onError)==null||d.call(e,E),o==null||o(),A.reject(E))},h=()=>new Promise(E=>{var d;o=B=>{(r||c())&&E(B)},(d=e.onPause)==null||d.call(e)}).then(()=>{var E;o=void 0,r||(E=e.onContinue)==null||E.call(e)}),I=()=>{if(r)return;let E;const d=n===0?e.initialPromise:void 0;try{E=d??e.fn()}catch(B){E=Promise.reject(B)}Promise.resolve(E).then(C).catch(B=>{var w;if(r)return;const p=e.retry??(nA?0:3),f=e.retryDelay??U2,m=typeof f=="function"?f(n,B):f,v=p===!0||typeof p=="number"&&n<p||typeof p=="function"&&p(n,B);if(t||!v){Q(B);return}n++,(w=e.onFail)==null||w.call(e,n,B),z2(m).then(()=>c()?void 0:h()).then(()=>{t?Q(B):I()})})};return{promise:A,cancel:a,continue:()=>(o==null||o(),A),cancelRetry:i,continueRetry:s,canStart:l,start:()=>(l()?I():h().then(I),A)}}function q2(){let e=[],t=0,n=i=>{i()},r=i=>{i()},o=i=>setTimeout(i,0);const A=i=>{t?e.push(i):o(()=>{n(i)})},a=()=>{const i=e;e=[],i.length&&o(()=>{r(()=>{i.forEach(s=>{n(s)})})})};return{batch:i=>{let s;t++;try{s=i()}finally{t--,t||a()}return s},batchCalls:i=>(...s)=>{A(()=>{i(...s)})},schedule:A,setNotifyFunction:i=>{n=i},setBatchNotifyFunction:i=>{r=i},setScheduler:i=>{o=i}}}var on=q2(),qf=(Ib=class{constructor(){Ve(this,bA)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),hu(this.gcTime)&&De(this,bA,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(nA?1/0:5*60*1e3))}clearGcTimeout(){N(this,bA)&&(clearTimeout(N(this,bA)),De(this,bA,void 0))}},bA=new WeakMap,Ib),K2=(pb=class extends qf{constructor(t){super();Ve(this,Dr);Ve(this,Pa);Ve(this,La);Ve(this,fr);Ve(this,yA);Ve(this,vn);Ve(this,Ki);Ve(this,vA);De(this,vA,!1),De(this,Ki,t.defaultOptions),this.setOptions(t.options),this.observers=[],De(this,yA,t.client),De(this,fr,N(this,yA).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,De(this,Pa,$2(this.options)),this.state=t.state??N(this,Pa),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=N(this,vn))==null?void 0:t.promise}setOptions(t){this.options={...N(this,Ki),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&N(this,fr).remove(this)}setData(t,n){const r=yu(this.state.data,t,this.options);return tt(this,Dr,Eo).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){tt(this,Dr,Eo).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=N(this,vn))==null?void 0:r.promise;return(o=N(this,vn))==null||o.cancel(t),n?n.then(sr).catch(sr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(N(this,Pa))}isActive(){return this.observers.some(t=>yr(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===js||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||!Gf(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=N(this,vn))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=N(this,vn))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),N(this,fr).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(N(this,vn)&&(N(this,vA)?N(this,vn).cancel({revert:!0}):N(this,vn).cancelRetry()),this.scheduleGc()),N(this,fr).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||tt(this,Dr,Eo).call(this,{type:"invalidate"})}fetch(t,n){var s,c,l;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(N(this,vn))return N(this,vn).continueRetry(),N(this,vn).promise}if(t&&this.setOptions(t),!this.options.queryFn){const C=this.observers.find(Q=>Q.options.queryFn);C&&this.setOptions(C.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=C=>{Object.defineProperty(C,"signal",{enumerable:!0,get:()=>(De(this,vA,!0),r.signal)})},A=()=>{const C=Jf(this.options,n),Q={client:N(this,yA),queryKey:this.queryKey,meta:this.meta};return o(Q),De(this,vA,!1),this.options.persister?this.options.persister(C,Q,this):C(Q)},a={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:N(this,yA),state:this.state,fetchFn:A};o(a),(s=this.options.behavior)==null||s.onFetch(a,this),De(this,La,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((c=a.fetchOptions)==null?void 0:c.meta))&&tt(this,Dr,Eo).call(this,{type:"fetch",meta:(l=a.fetchOptions)==null?void 0:l.meta});const i=C=>{var Q,h,I,E;wu(C)&&C.silent||tt(this,Dr,Eo).call(this,{type:"error",error:C}),wu(C)||((h=(Q=N(this,fr).config).onError)==null||h.call(Q,C,this),(E=(I=N(this,fr).config).onSettled)==null||E.call(I,this.state.data,C,this)),this.scheduleGc()};return De(this,vn,Uf({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:C=>{var Q,h,I,E;if(C===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}`),i(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(C)}catch(d){i(d);return}(h=(Q=N(this,fr).config).onSuccess)==null||h.call(Q,C,this),(E=(I=N(this,fr).config).onSettled)==null||E.call(I,C,this.state.error,this),this.scheduleGc()},onError:i,onFail:(C,Q)=>{tt(this,Dr,Eo).call(this,{type:"failed",failureCount:C,error:Q})},onPause:()=>{tt(this,Dr,Eo).call(this,{type:"pause"})},onContinue:()=>{tt(this,Dr,Eo).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0})),N(this,vn).start()}},Pa=new WeakMap,La=new WeakMap,fr=new WeakMap,yA=new WeakMap,vn=new WeakMap,Ki=new WeakMap,vA=new WeakMap,Dr=new WeakSet,Eo=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,...Kf(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 wu(o)&&o.revert&&N(this,La)?{...N(this,La),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),on.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),N(this,fr).notify({query:this,type:"updated",action:t})})},pb);function Kf(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Xf(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function $2(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 ew=(Bb=class extends jA{constructor(t={}){super();Ve(this,Xr);this.config=t,De(this,Xr,new Map)}build(t,n,r){const o=n.queryKey,A=n.queryHash??Qu(o,n);let a=this.get(A);return a||(a=new K2({client:t,queryKey:o,queryHash:A,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(a)),a}add(t){N(this,Xr).has(t.queryHash)||(N(this,Xr).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=N(this,Xr).get(t.queryHash);n&&(t.destroy(),n===t&&N(this,Xr).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){on.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return N(this,Xr).get(t)}getAll(){return[...N(this,Xr).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Hf(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Hf(t,r)):n}notify(t){on.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){on.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){on.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Xr=new WeakMap,Bb),tw=(hb=class extends qf{constructor(t){super();Ve(this,Ur);Ve(this,Zr);Ve(this,Ln);Ve(this,xA);this.mutationId=t.mutationId,De(this,Ln,t.mutationCache),De(this,Zr,[]),this.state=t.state||$f(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){N(this,Zr).includes(t)||(N(this,Zr).push(t),this.clearGcTimeout(),N(this,Ln).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){De(this,Zr,N(this,Zr).filter(n=>n!==t)),this.scheduleGc(),N(this,Ln).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){N(this,Zr).length||(this.state.status==="pending"?this.scheduleGc():N(this,Ln).remove(this))}continue(){var t;return((t=N(this,xA))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,A,a,i,s,c,l,C,Q,h,I,E,d,B,p,f,m,v,w,x;De(this,xA,Uf({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(b,T)=>{tt(this,Ur,Yo).call(this,{type:"failed",failureCount:b,error:T})},onPause:()=>{tt(this,Ur,Yo).call(this,{type:"pause"})},onContinue:()=>{tt(this,Ur,Yo).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>N(this,Ln).canRun(this)}));const n=this.state.status==="pending",r=!N(this,xA).canStart();try{if(!n){tt(this,Ur,Yo).call(this,{type:"pending",variables:t,isPaused:r}),await((A=(o=N(this,Ln).config).onMutate)==null?void 0:A.call(o,t,this));const T=await((i=(a=this.options).onMutate)==null?void 0:i.call(a,t));T!==this.state.context&&tt(this,Ur,Yo).call(this,{type:"pending",context:T,variables:t,isPaused:r})}const b=await N(this,xA).start();return await((c=(s=N(this,Ln).config).onSuccess)==null?void 0:c.call(s,b,t,this.state.context,this)),await((C=(l=this.options).onSuccess)==null?void 0:C.call(l,b,t,this.state.context)),await((h=(Q=N(this,Ln).config).onSettled)==null?void 0:h.call(Q,b,null,this.state.variables,this.state.context,this)),await((E=(I=this.options).onSettled)==null?void 0:E.call(I,b,null,t,this.state.context)),tt(this,Ur,Yo).call(this,{type:"success",data:b}),b}catch(b){try{throw await((B=(d=N(this,Ln).config).onError)==null?void 0:B.call(d,b,t,this.state.context,this)),await((f=(p=this.options).onError)==null?void 0:f.call(p,b,t,this.state.context)),await((v=(m=N(this,Ln).config).onSettled)==null?void 0:v.call(m,void 0,b,this.state.variables,this.state.context,this)),await((x=(w=this.options).onSettled)==null?void 0:x.call(w,void 0,b,t,this.state.context)),b}finally{tt(this,Ur,Yo).call(this,{type:"error",error:b})}}finally{N(this,Ln).runNext(this)}}},Zr=new WeakMap,Ln=new WeakMap,xA=new WeakMap,Ur=new WeakSet,Yo=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),on.batch(()=>{N(this,Zr).forEach(r=>{r.onMutationUpdate(t)}),N(this,Ln).notify({mutation:this,type:"updated",action:t})})},hb);function $f(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var nw=(Qb=class extends jA{constructor(t={}){super();Ve(this,co);Ve(this,Or);Ve(this,$i);this.config=t,De(this,co,new Set),De(this,Or,new Map),De(this,$i,0)}build(t,n,r){const o=new tw({mutationCache:this,mutationId:++wl(this,$i)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){N(this,co).add(t);const n=Gs(t);if(typeof n=="string"){const r=N(this,Or).get(n);r?r.push(t):N(this,Or).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(N(this,co).delete(t)){const n=Gs(t);if(typeof n=="string"){const r=N(this,Or).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&N(this,Or).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Gs(t);if(typeof n=="string"){const r=N(this,Or).get(n),o=r==null?void 0:r.find(A=>A.state.status==="pending");return!o||o===t}else return!0}runNext(t){var r;const n=Gs(t);if(typeof n=="string"){const o=(r=N(this,Or).get(n))==null?void 0:r.find(A=>A!==t&&A.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){on.batch(()=>{N(this,co).forEach(t=>{this.notify({type:"removed",mutation:t})}),N(this,co).clear(),N(this,Or).clear()})}getAll(){return Array.from(N(this,co))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Wf(n,r))}findAll(t={}){return this.getAll().filter(n=>Wf(t,n))}notify(t){on.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return on.batch(()=>Promise.all(t.map(n=>n.continue().catch(sr))))}},co=new WeakMap,Or=new WeakMap,$i=new WeakMap,Qb);function Gs(e){var t;return(t=e.options.scope)==null?void 0:t.id}function Hs(e){return{onFetch:(t,n)=>{var l,C,Q,h,I;const r=t.options,o=(Q=(C=(l=t.fetchOptions)==null?void 0:l.meta)==null?void 0:C.fetchMore)==null?void 0:Q.direction,A=((h=t.state.data)==null?void 0:h.pages)||[],a=((I=t.state.data)==null?void 0:I.pageParams)||[];let i={pages:[],pageParams:[]},s=0;const c=async()=>{let E=!1;const d=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(t.signal.aborted?E=!0:t.signal.addEventListener("abort",()=>{E=!0}),t.signal)})},B=Jf(t.options,t.fetchOptions),p=async(f,m,v)=>{if(E)return Promise.reject();if(m==null&&f.pages.length)return Promise.resolve(f);const w={client:t.client,queryKey:t.queryKey,pageParam:m,direction:v?"backward":"forward",meta:t.options.meta};d(w);const x=await B(w),{maxPages:b}=t.options,T=v?J2:Y2;return{pages:T(f.pages,x,b),pageParams:T(f.pageParams,m,b)}};if(o&&A.length){const f=o==="backward",m=f?eI:Su,v={pages:A,pageParams:a},w=m(r,v);i=await p(v,w,f)}else{const f=e??A.length;do{const m=s===0?a[0]??r.initialPageParam:Su(r,i);if(s>0&&m==null)break;i=await p(i,m),s++}while(s<f)}return i};t.options.persister?t.fetchFn=()=>{var E,d;return(d=(E=t.options).persister)==null?void 0:d.call(E,c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=c}}}function Su(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 eI(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}function rw(e,t){return t?Su(e,t)!=null:!1}function ow(e,t){return!t||!e.getPreviousPageParam?!1:eI(e,t)!=null}var Aw=(mb=class{constructor(e={}){Ve(this,zt);Ve(this,Po);Ve(this,Lo);Ve(this,Na);Ve(this,Ra);Ve(this,No);Ve(this,ka);Ve(this,ja);De(this,zt,e.queryCache||new ew),De(this,Po,e.mutationCache||new nw),De(this,Lo,e.defaultOptions||{}),De(this,Na,new Map),De(this,Ra,new Map),De(this,No,0)}mount(){wl(this,No)._++,N(this,No)===1&&(De(this,ka,vu.subscribe(async e=>{e&&(await this.resumePausedMutations(),N(this,zt).onFocus())})),De(this,ja,Vs.subscribe(async e=>{e&&(await this.resumePausedMutations(),N(this,zt).onOnline())})))}unmount(){var e,t;wl(this,No)._--,N(this,No)===0&&((e=N(this,ka))==null||e.call(this),De(this,ka,void 0),(t=N(this,ja))==null||t.call(this),De(this,ja,void 0))}isFetching(e){return N(this,zt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return N(this,Po).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=N(this,zt).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=N(this,zt).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(VA(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return N(this,zt).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=N(this,zt).get(r.queryHash),A=o==null?void 0:o.state.data,a=W2(t,A);if(a!==void 0)return N(this,zt).build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return on.batch(()=>N(this,zt).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=N(this,zt).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=N(this,zt);on.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=N(this,zt);return on.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=on.batch(()=>N(this,zt).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(sr).catch(sr)}invalidateQueries(e,t={}){return on.batch(()=>(N(this,zt).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=on.batch(()=>N(this,zt).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let A=o.fetch(void 0,n);return n.throwOnError||(A=A.catch(sr)),o.state.fetchStatus==="paused"?Promise.resolve():A}));return Promise.all(r).then(sr)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=N(this,zt).build(this,t);return n.isStaleByTime(VA(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(sr).catch(sr)}fetchInfiniteQuery(e){return e.behavior=Hs(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(sr).catch(sr)}ensureInfiniteQueryData(e){return e.behavior=Hs(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Vs.isOnline()?N(this,Po).resumePausedMutations():Promise.resolve()}getQueryCache(){return N(this,zt)}getMutationCache(){return N(this,Po)}getDefaultOptions(){return N(this,Lo)}setDefaultOptions(e){De(this,Lo,e)}setQueryDefaults(e,t){N(this,Na).set(rA(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...N(this,Na).values()],n={};return t.forEach(r=>{ui(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){N(this,Ra).set(rA(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...N(this,Ra).values()],n={};return t.forEach(r=>{ui(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...N(this,Lo).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Qu(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===js&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...N(this,Lo).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){N(this,zt).clear(),N(this,Po).clear()}},zt=new WeakMap,Po=new WeakMap,Lo=new WeakMap,Na=new WeakMap,Ra=new WeakMap,No=new WeakMap,ka=new WeakMap,ja=new WeakMap,mb),tI=(bb=class extends jA{constructor(t,n){super();Ve(this,vt);Ve(this,Wn);Ve(this,it);Ve(this,es);Ve(this,Nn);Ve(this,wA);Ve(this,Va);Ve(this,Ro);Ve(this,qr);Ve(this,ts);Ve(this,Ga);Ve(this,Ha);Ve(this,SA);Ve(this,TA);Ve(this,ko);Ve(this,Wa,new Set);this.options=n,De(this,Wn,t),De(this,qr,null),De(this,Ro,xu()),this.options.experimental_prefetchInRender||N(this,Ro).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&&(N(this,it).addObserver(this),nI(N(this,it),this.options)?tt(this,vt,os).call(this):this.updateResult(),tt(this,vt,_C).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Tu(N(this,it),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Tu(N(this,it),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,tt(this,vt,PC).call(this),tt(this,vt,LC).call(this),N(this,it).removeObserver(this)}setOptions(t,n){const r=this.options,o=N(this,it);if(this.options=N(this,Wn).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof yr(this.options.enabled,N(this,it))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");tt(this,vt,NC).call(this),N(this,it).setOptions(this.options),r._defaulted&&!ks(this.options,r)&&N(this,Wn).getQueryCache().notify({type:"observerOptionsUpdated",query:N(this,it),observer:this});const A=this.hasListeners();A&&rI(N(this,it),o,this.options,r)&&tt(this,vt,os).call(this),this.updateResult(n),A&&(N(this,it)!==o||yr(this.options.enabled,N(this,it))!==yr(r.enabled,N(this,it))||VA(this.options.staleTime,N(this,it))!==VA(r.staleTime,N(this,it)))&&tt(this,vt,OC).call(this);const a=tt(this,vt,FC).call(this);A&&(N(this,it)!==o||yr(this.options.enabled,N(this,it))!==yr(r.enabled,N(this,it))||a!==N(this,ko))&&tt(this,vt,MC).call(this,a)}getOptimisticResult(t){const n=N(this,Wn).getQueryCache().build(N(this,Wn),t),r=this.createResult(n,t);return iw(this,r)&&(De(this,Nn,r),De(this,Va,this.options),De(this,wA,N(this,it).state)),r}getCurrentResult(){return N(this,Nn)}trackResult(t,n){const r={};return Object.keys(t).forEach(o=>{Object.defineProperty(r,o,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(o),n==null||n(o),t[o])})}),r}trackProp(t){N(this,Wa).add(t)}getCurrentQuery(){return N(this,it)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=N(this,Wn).defaultQueryOptions(t),r=N(this,Wn).getQueryCache().build(N(this,Wn),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return tt(this,vt,os).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),N(this,Nn)))}createResult(t,n){var b;const r=N(this,it),o=this.options,A=N(this,Nn),a=N(this,wA),i=N(this,Va),c=t!==r?t.state:N(this,es),{state:l}=t;let C={...l},Q=!1,h;if(n._optimisticResults){const T=this.hasListeners(),M=!T&&nI(t,n),_=T&&rI(t,r,n,o);(M||_)&&(C={...C,...Kf(l.data,t.options)}),n._optimisticResults==="isRestoring"&&(C.fetchStatus="idle")}let{error:I,errorUpdatedAt:E,status:d}=C;if(n.select&&C.data!==void 0)if(A&&C.data===(a==null?void 0:a.data)&&n.select===N(this,ts))h=N(this,Ga);else try{De(this,ts,n.select),h=n.select(C.data),h=yu(A==null?void 0:A.data,h,n),De(this,Ga,h),De(this,qr,null)}catch(T){De(this,qr,T)}else h=C.data;if(n.placeholderData!==void 0&&h===void 0&&d==="pending"){let T;if(A!=null&&A.isPlaceholderData&&n.placeholderData===(i==null?void 0:i.placeholderData))T=A.data;else if(T=typeof n.placeholderData=="function"?n.placeholderData((b=N(this,Ha))==null?void 0:b.state.data,N(this,Ha)):n.placeholderData,n.select&&T!==void 0)try{T=n.select(T),De(this,qr,null)}catch(M){De(this,qr,M)}T!==void 0&&(d="success",h=yu(A==null?void 0:A.data,T,n),Q=!0)}N(this,qr)&&(I=N(this,qr),h=N(this,Ga),E=Date.now(),d="error");const B=C.fetchStatus==="fetching",p=d==="pending",f=d==="error",m=p&&B,v=h!==void 0,x={status:d,fetchStatus:C.fetchStatus,isPending:p,isSuccess:d==="success",isError:f,isInitialLoading:m,isLoading:m,data:h,dataUpdatedAt:C.dataUpdatedAt,error:I,errorUpdatedAt:E,failureCount:C.fetchFailureCount,failureReason:C.fetchFailureReason,errorUpdateCount:C.errorUpdateCount,isFetched:C.dataUpdateCount>0||C.errorUpdateCount>0,isFetchedAfterMount:C.dataUpdateCount>c.dataUpdateCount||C.errorUpdateCount>c.errorUpdateCount,isFetching:B,isRefetching:B&&!p,isLoadingError:f&&!v,isPaused:C.fetchStatus==="paused",isPlaceholderData:Q,isRefetchError:f&&v,isStale:Du(t,n),refetch:this.refetch,promise:N(this,Ro)};if(this.options.experimental_prefetchInRender){const T=R=>{x.status==="error"?R.reject(x.error):x.data!==void 0&&R.resolve(x.data)},M=()=>{const R=De(this,Ro,x.promise=xu());T(R)},_=N(this,Ro);switch(_.status){case"pending":t.queryHash===r.queryHash&&T(_);break;case"fulfilled":(x.status==="error"||x.data!==_.value)&&M();break;case"rejected":(x.status!=="error"||x.error!==_.reason)&&M();break}}return x}updateResult(t){const n=N(this,Nn),r=this.createResult(N(this,it),this.options);if(De(this,wA,N(this,it).state),De(this,Va,this.options),N(this,wA).data!==void 0&&De(this,Ha,N(this,it)),ks(r,n))return;De(this,Nn,r);const o={},A=()=>{if(!n)return!0;const{notifyOnChangeProps:a}=this.options,i=typeof a=="function"?a():a;if(i==="all"||!i&&!N(this,Wa).size)return!0;const s=new Set(i??N(this,Wa));return this.options.throwOnError&&s.add("error"),Object.keys(N(this,Nn)).some(c=>{const l=c;return N(this,Nn)[l]!==n[l]&&s.has(l)})};(t==null?void 0:t.listeners)!==!1&&A()&&(o.listeners=!0),tt(this,vt,wb).call(this,{...o,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&tt(this,vt,_C).call(this)}},Wn=new WeakMap,it=new WeakMap,es=new WeakMap,Nn=new WeakMap,wA=new WeakMap,Va=new WeakMap,Ro=new WeakMap,qr=new WeakMap,ts=new WeakMap,Ga=new WeakMap,Ha=new WeakMap,SA=new WeakMap,TA=new WeakMap,ko=new WeakMap,Wa=new WeakMap,vt=new WeakSet,os=function(t){tt(this,vt,NC).call(this);let n=N(this,it).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(sr)),n},OC=function(){tt(this,vt,PC).call(this);const t=VA(this.options.staleTime,N(this,it));if(nA||N(this,Nn).isStale||!hu(t))return;const r=Gf(N(this,Nn).dataUpdatedAt,t)+1;De(this,SA,setTimeout(()=>{N(this,Nn).isStale||this.updateResult()},r))},FC=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(N(this,it)):this.options.refetchInterval)??!1},MC=function(t){tt(this,vt,LC).call(this),De(this,ko,t),!(nA||yr(this.options.enabled,N(this,it))===!1||!hu(N(this,ko))||N(this,ko)===0)&&De(this,TA,setInterval(()=>{(this.options.refetchIntervalInBackground||vu.isFocused())&&tt(this,vt,os).call(this)},N(this,ko)))},_C=function(){tt(this,vt,OC).call(this),tt(this,vt,MC).call(this,tt(this,vt,FC).call(this))},PC=function(){N(this,SA)&&(clearTimeout(N(this,SA)),De(this,SA,void 0))},LC=function(){N(this,TA)&&(clearInterval(N(this,TA)),De(this,TA,void 0))},NC=function(){const t=N(this,Wn).getQueryCache().build(N(this,Wn),this.options);if(t===N(this,it))return;const n=N(this,it);De(this,it,t),De(this,es,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},wb=function(t){on.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(N(this,Nn))}),N(this,Wn).getQueryCache().notify({query:N(this,it),type:"observerResultsUpdated"})})},bb);function aw(e,t){return yr(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function nI(e,t){return aw(e,t)||e.state.data!==void 0&&Tu(e,t,t.refetchOnMount)}function Tu(e,t,n){if(yr(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Du(e,t)}return!1}function rI(e,t,n,r){return(e!==t||yr(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Du(e,n)}function Du(e,t){return yr(t.enabled,e)!==!1&&e.isStaleByTime(VA(t.staleTime,e))}function iw(e,t){return!ks(e.getCurrentResult(),t)}var sw=class extends tI{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e,t){super.setOptions({...e,behavior:Hs()},t)}getOptimisticResult(e){return e.behavior=Hs(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){var I,E;const{state:n}=e,r=super.createResult(e,t),{isFetching:o,isRefetching:A,isError:a,isRefetchError:i}=r,s=(E=(I=n.fetchMeta)==null?void 0:I.fetchMore)==null?void 0:E.direction,c=a&&s==="forward",l=o&&s==="forward",C=a&&s==="backward",Q=o&&s==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:rw(t,n.data),hasPreviousPage:ow(t,n.data),isFetchNextPageError:c,isFetchingNextPage:l,isFetchPreviousPageError:C,isFetchingPreviousPage:Q,isRefetchError:i&&!c&&!C,isRefetching:A&&!l&&!Q}}},cw=(yb=class extends jA{constructor(t,n){super();Ve(this,uo);Ve(this,jo);Ve(this,Vo);Ve(this,zn);Ve(this,lo);De(this,jo,t),this.setOptions(n),this.bindMethods(),tt(this,uo,Sl).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var r;const n=this.options;this.options=N(this,jo).defaultMutationOptions(t),ks(this.options,n)||N(this,jo).getMutationCache().notify({type:"observerOptionsUpdated",mutation:N(this,zn),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&rA(n.mutationKey)!==rA(this.options.mutationKey)?this.reset():((r=N(this,zn))==null?void 0:r.state.status)==="pending"&&N(this,zn).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=N(this,zn))==null||t.removeObserver(this)}onMutationUpdate(t){tt(this,uo,Sl).call(this),tt(this,uo,RC).call(this,t)}getCurrentResult(){return N(this,Vo)}reset(){var t;(t=N(this,zn))==null||t.removeObserver(this),De(this,zn,void 0),tt(this,uo,Sl).call(this),tt(this,uo,RC).call(this)}mutate(t,n){var r;return De(this,lo,n),(r=N(this,zn))==null||r.removeObserver(this),De(this,zn,N(this,jo).getMutationCache().build(N(this,jo),this.options)),N(this,zn).addObserver(this),N(this,zn).execute(t)}},jo=new WeakMap,Vo=new WeakMap,zn=new WeakMap,lo=new WeakMap,uo=new WeakSet,Sl=function(){var n;const t=((n=N(this,zn))==null?void 0:n.state)??$f();De(this,Vo,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},RC=function(t){on.batch(()=>{var n,r,o,A,a,i,s,c;if(N(this,lo)&&this.hasListeners()){const l=N(this,Vo).variables,C=N(this,Vo).context;(t==null?void 0:t.type)==="success"?((r=(n=N(this,lo)).onSuccess)==null||r.call(n,t.data,l,C),(A=(o=N(this,lo)).onSettled)==null||A.call(o,t.data,null,l,C)):(t==null?void 0:t.type)==="error"&&((i=(a=N(this,lo)).onError)==null||i.call(a,t.error,l,C),(c=(s=N(this,lo)).onSettled)==null||c.call(s,void 0,t.error,l,C))}this.listeners.forEach(l=>{l(N(this,Vo))})})},yb),oI=S.createContext(void 0),ho=e=>{const t=S.useContext(oI);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},lw=({client:e,children:t})=>(S.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),u.jsx(oI.Provider,{value:e,children:t})),AI=S.createContext(!1),uw=()=>S.useContext(AI);AI.Provider;function gw(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var dw=S.createContext(gw()),Cw=()=>S.useContext(dw);function aI(e,t){return typeof e=="function"?e(...t):!!e}function Ou(){}var Ew=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},fw=e=>{S.useEffect(()=>{e.clearReset()},[e])},Iw=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||aI(n,[e.error,r])),pw=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)))},Bw=(e,t)=>e.isLoading&&e.isFetching&&!t,hw=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,iI=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function sI(e,t,n){var C,Q,h,I,E;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=ho(),o=uw(),A=Cw(),a=r.defaultQueryOptions(e);(Q=(C=r.getDefaultOptions().queries)==null?void 0:C._experimental_beforeQuery)==null||Q.call(C,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",pw(a),Ew(a,A),fw(A);const i=!r.getQueryCache().get(a.queryHash),[s]=S.useState(()=>new t(r,a)),c=s.getOptimisticResult(a),l=!o&&e.subscribed!==!1;if(S.useSyncExternalStore(S.useCallback(d=>{const B=l?s.subscribe(on.batchCalls(d)):Ou;return s.updateResult(),B},[s,l]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),S.useEffect(()=>{s.setOptions(a,{listeners:!1})},[a,s]),hw(a,c))throw iI(a,s,A);if(Iw({result:c,errorResetBoundary:A,throwOnError:a.throwOnError,query:r.getQueryCache().get(a.queryHash),suspense:a.suspense}))throw c.error;if((I=(h=r.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||I.call(h,a,c),a.experimental_prefetchInRender&&!nA&&Bw(c,o)){const d=i?iI(a,s,A):(E=r.getQueryCache().get(a.queryHash))==null?void 0:E.promise;d==null||d.catch(Ou).finally(()=>{s.updateResult()})}return a.notifyOnChangeProps?c:s.trackResult(c)}function Qo(e,t){return sI(e,tI)}function oA(e,t){const n=ho(),[r]=S.useState(()=>new cw(n,e));S.useEffect(()=>{r.setOptions(e)},[r,e]);const o=S.useSyncExternalStore(S.useCallback(a=>r.subscribe(on.batchCalls(a)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),A=S.useCallback((a,i)=>{r.mutate(a,i).catch(Ou)},[r]);if(o.error&&aI(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:A,mutateAsync:o.mutate}}function Qw(e,t){return sI(e,sw)}var Fu=(e=>(e.ADD="ADD",e.MULTIPLY="MULTIPLY",e))(Fu||{});const mw={[Fu.ADD]:(e,t)=>e+t,[Fu.MULTIPLY]:(e,t)=>e*t},bw=e=>e,cI=()=>{if("crypto"in window&&"randomUUID"in window.crypto)return window.crypto.randomUUID();const e=Date.now().toString(16),t=Math.random().toString(16).substring(2,8);return`${e}-${t}`},lI=(e,t)=>{let n;const r=mw[t]??bw;for(const o of e){const A=Number(o);isNaN(A)||(n=n===void 0?A:r(n,A))}return(n??0).toFixed(2)},yw=(e,t)=>e.replace(/:(\w+)/g,(n,r)=>String(t[r])||""),Mu=e=>typeof e=="object"&&e!==null&&"value"in e&&"label"in e,vw={GET:"GET",POST:"POST",DELETE:"DELETE",PATCH:"PATCH",PUT:"PUT"},xw="/v1/api/connectors/forms/:formId/get_forms_custom_fields",ww=async({formId:e,args:t})=>{try{const n=await Ue({url:yw(xw,{formId:e}),data:{args:t},method:vw.POST});return(n==null?void 0:n.data).fieldList}catch(n){throw pt.error(n),n}},uI=(e,t)=>{if(!t)return{isApiEnabled:!0,args:{},argsMap:t};const n={};for(const r in t){const o=t[r],A=Mu(e[o])?e[o].value:e[o];if(!A)return{isApiEnabled:!1,args:{}};n[r]=A}return{isApiEnabled:!0,args:n,argsMap:t}},gI=({formId:e,argsMap:t,formData:n,enabled:r=!0,delay:o=500})=>{const[A,a]=y.useState(()=>uI(n,t));y.useEffect(()=>{const c=setTimeout(()=>{a(uI(n,t))},o);return()=>clearTimeout(c)},[n,t,o]);const i=A.argsMap===t,s=Qo({queryKey:["customFormFields",e,A.args],queryFn:()=>ww({formId:e,args:A.args}),enabled:!!e&&r&&i&&A.isApiEnabled,staleTime:0});return{...s,data:A.isApiEnabled?s.data:void 0}},dI=e=>{const t={current:null};return n=>{t.current&&clearTimeout(t.current),t.current=setTimeout(n,e)}},Sw=e=>(t,n)=>{if(typeof t=="string"){const r=n.limit;return r!==void 0&&t.length>r?e||`Maximum characters allowed are ${r}`:!0}return e||L2},Tw=["async-select","select","multi-select","reference"],Dw=(e,t)=>{const n=Array.isArray(e)?e:e?[e]:[],r=Array.isArray(t)?t:t?[t]:[];return n.map((o,A)=>({value:o,label:r[A]??String(o)}))},Ow=e=>{if(typeof e=="string"){const t=e.trim().toLowerCase();return t==="true"||t==="1"||t==="yes"}return!!e},CI=(e,t=!1)=>{const n={};for(const r in e){const o=e[r];if(!o)continue;if(o.type==="checkbox"){n[r]=Ow(o.value??o.label);continue}if(!(o!=null&&o.label)&&!(o!=null&&o.value))continue;const A=o.label??o.value??"",a=Array.isArray(A)?A[0]??"":A;if(t&&o.type==="date"){const i=isNaN(Number(a))?a:Number(a),s=new Date(i);n[r]=isNaN(s.getTime())?a:s.toISOString();continue}if(Tw.includes(o.type)){o.type==="multi-select"?n[r]=Dw(o.value,o.label):n[r]={label:o.label,value:o.value};continue}n[r]=a}return n},EI=(e,t)=>{const n={};for(const o of t)n[o.name]=o.type;const r={};for(const o in e){const A=e[o];if(Array.isArray(A)){const a=A.map(i=>i&&typeof i=="object"&&"value"in i&&"label"in i?i:{value:i,label:i});r[o]={value:a.map(i=>i.value),label:a.map(i=>i.label),type:n[o]}}else A&&typeof A=="object"&&"value"in A&&"label"in A?r[o]={value:A.value,label:A.label,type:n[o]}:r[o]={value:A,label:A,type:n[o]}}return r},Fw=e=>{let t=0,n=!1;for(const r in e){const o=e[r];if(o!=null&&o.value){t++;const A=o.value;if(typeof A!="string")continue;A.includes("{{")&&A.includes("}}")&&(n=!0)}}return{fields_configured_count:t,has_system_variable:n}};function fI(e,t){const n={};return e.forEach(r=>{const o=t(r);n[o]=r}),n}function II(e,t){return e.map(t)}function pI(e){const t={};return e.forEach(n=>{n.formFields.forEach(r=>{t[r.name]={...r}})}),t}const Fn=(e={},t)=>e&&typeof e[t]>"u"?(e==null?void 0:e[Jv])===!0:(e==null?void 0:e[t])===!0,Mw=e=>Fn(e,vv)&&!Fn(e,xv),GA=e=>Fn(e,wv),BI=e=>Fn(e,Dv),_w=(e,t,n)=>{const r="?email=&name=&referrer=",i=window.innerWidth-388,s=window.open(`${Wv}${r}`,zv,`scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no,width=364,height=533,left=${i}`);if(s){const c=window.outerHeight-(s.outerHeight+24);s.moveBy(0,c)}},Pw=(e,t)=>{const n=document.createElement("input");document.body.appendChild(n),n.value=e,n.focus(),n.select();try{const r=document.execCommand("copy");t==null||t(!r)}catch{t==null||t(!0)}n.remove()},Lw=async(e,t)=>{navigator.clipboard.writeText(e).then(()=>{pt.log("successfully copied"),t==null||t(!1)}).catch(()=>{pt.log("something went wrong while copying using navigator.clipboard function. Trying fallback copy"),Pw(e,t)})},Nw=e=>["sm.full"].some(n=>e.includes(n)),hI=e=>Object.keys(e).filter(t=>e[t]).join(" "),Ws=(e,t)=>Array.from({length:e},(n,r)=>t(r)),Ft=(e,t)=>e.replace(/:(\w+)/g,(n,r)=>String(t[r])||""),QI=(e,t)=>e.isConnectorAvailableInPlan===!1||Fn(t,e.featureKey),mI=({connector:e,isTemplate:t=!1})=>{if(t)return"not_authenticated";const{isAuthenticated:n,isEnabled:r,showUpgradeButton:o,authPending:A}=e;return o?"enabled_upgrade_available":n?r?"authenticated_enabled":"authenticated_disabled":A?"authentication_pending":"authentication_failed"},zs=(e,t)=>(...n)=>{localStorage.getItem("dev__logs")==="true"&&console[e](t||"DEV_LOG:",...n)},Ys={log:zs("log","### CONNECTOR_UI_LOGS ###"),warn:zs("warn","### CONNECTOR_UI_WARN ###"),error:zs("error","### CONNECTOR_UI_ERROR ###"),info:zs("info","### CONNECTOR_UI_INFO ###")},Js=e=>{const t=Object.values(e||{});let n=0,r=0,o=0;const A=[],a={},i={};let s="";for(const C of t){if(!(C!=null&&C.name))continue;A.push(C.name);const Q=!!C.isAuthenticated,h=!!C.isEnabled;a[C.name]=Q,i[C.name]=h,Q&&n++,h&&r++,h&&Q&&o++,C.createdAt&&(!s||new Date(C.createdAt)<new Date(s))&&(s=C.createdAt)}const c=t.length,l=A.join(",");return{total_authenticated_apps:n,total_enabled_apps:r,total_apps_activated:o,total_apps_setup:c,apps_list:l,apps_auth_status:a,apps_enabled_status:i,first_app_created_at:s}},nt={GET:"GET",POST:"POST",DELETE:"DELETE",PATCH:"PATCH",PUT:"PUT"},pe={IDLE:"idle",LOADING:"loading",FAILED:"failed",SUCCESS:"success"},Bt="/v1/api",Rw={connectorTemplates:null,connectorTemplateList:[],templateListApiStatus:pe.IDLE,connectorsApiStatus:pe.IDLE,templateDetailsApiStatus:pe.IDLE,selectedTemplateData:null},kw=Bt+"/template/list",jw=Bt+"/template/{{templateId}}",Vw=()=>Ue({url:kw,method:nt.GET}),Gw=e=>Ue({url:jw.replace("{{templateId}}",e),method:nt.GET}),bI=e=>e.templateLibrary.connectorTemplateList,HA=e=>e.templateLibrary.connectorTemplates,Hw=e=>e.templateLibrary.templateListApiStatus,Ww=e=>e.templateLibrary.templateListApiStatus,_u=e=>e.templateLibrary.templateDetailsApiStatus,zw=ni({name:"templateLibrary",initialState:Rw,reducers:{},extraReducers:e=>{e.addCase(Xs.pending,t=>{t.templateListApiStatus=pe.LOADING}).addCase(Xs.fulfilled,(t,n)=>{t.templateListApiStatus=pe.IDLE,t.connectorTemplateList=n.payload.connectorList,t.connectorTemplates=n.payload.connectors}).addCase(Xs.rejected,(t,n)=>{t.templateListApiStatus=pe.FAILED,pt.error(n.error)}).addCase(WA.pending,t=>{t.templateDetailsApiStatus=pe.LOADING}).addCase(WA.fulfilled,(t,n)=>{t.templateDetailsApiStatus=pe.IDLE;const{templateData:r,templateId:o}=n.payload;r&&o&&(t.connectorTemplates={...t.connectorTemplates,[o]:r})}).addCase(WA.rejected,(t,n)=>{t.templateDetailsApiStatus=pe.FAILED,pt.error(n.error)})}}),Xs=hn("connectorLibrary/fetchConnectorTemplates",async()=>{const e=await Vw();if(!e||!e.data||!Array.isArray(e.data))return{connectorList:[],connectors:{}};const n=e.data.sort((A,a)=>A.name.localeCompare(a.name)),r=fI(n,A=>A.id),o=II(n,A=>A.id);return{connectors:r,connectorList:o}}),WA=hn("connectorLibrary/fetchTemplateDetails",async e=>{const t=await Gw(e);return!t||!t.data?{templateId:e,templateData:null}:{templateData:t.data,templateId:e}}),Yw=zw.reducer,Jw={connectors:null,connectorList:[],connectorsApiStatus:pe.IDLE,selectedConnector:null,currentUpdatingConnectors:{},connectorDetailApiStatus:pe.IDLE,connectorDetails:null,rolesAndPermissions:null,rolesAndPermissionsApiStatus:pe.IDLE,updateEnableConnectorsApiStatus:pe.IDLE,cardCustomFields:{},cardCustomFieldsApiStatus:pe.IDLE,requireUpgradeConnectors:[],notAuthenticatedConnectors:[],fetchCustomCardsApiStatus:pe.IDLE,enableCustomCardApiStatus:{},updateConnectorByIdApiStatus:pe.IDLE},Xw=Bt+"/connectors/ug",Zw=Bt+"/connectors/:connectorId/ug",Uw=Bt+"/connectors/{{id}}",qw=Bt+"/connectors/{{id}}",yI="{{card_id}}",Kw=Bt+`/connectors/cards/${yI}`,$w=Bt+"/connectors/cards/:cardId/custom_fields",eS=Bt+"/connectors/:connectorId/custom_cards",tS=Bt+"/connectors/:connectorId/custom_cards",nS=Bt+"/connectors/:connectorId/lookup",rS=Bt+"/connectors/:connectorId/lookup-presets",oS=Bt+"/connectors/lookup/bulk",AS=`${Bt}/connectors/forms/:formId/field/:fieldName/data`,aS=`${Bt}/connectors/cards/:cardId/forms`,iS=`${Bt}/connectors/forms/:formId`,vI=`${Bt}/connectors/defaults/:entityId`,sS=`${Bt}/connectors/defaults`,xI=`${Bt}/connectors/forms/:formId/defaults`,wI="/v1/connectors/:connectorType",cS=`${wI}/admin/agency/locations`,SI=`${wI}/admin/agency/mapping`,lS=()=>Ue({url:Xw,method:nt.GET}),uS=({id:e,enabled:t})=>Ue({url:Uw.replace("{{id}}",e),method:nt.PATCH,data:{enabled:t}}),gS=e=>{const t=qw.replace("{{id}}",e);return Ue({url:t,method:nt.GET})},dS=({cardId:e,data:t})=>Ue({url:Kw.replace(yI,e),method:nt.PATCH,data:t}),CS=e=>Ue({url:Ft($w,{cardId:e}),method:nt.GET}),ES=e=>Ue({url:Ft(eS,{connectorId:e}),method:nt.GET}),fS=({connectorId:e,data:t})=>Ue({url:Ft(tS,{connectorId:e}),method:nt.PATCH,data:t}),IS=e=>Ue({url:Ft(nS,{connectorId:e}),method:nt.GET}),pS=e=>Ue({url:Ft(rS,{connectorId:e}),method:nt.GET}),BS=e=>Ue({url:oS,method:nt.PUT,data:{entries:e}}),hS=({connectorId:e,data:t})=>Ue({url:Ft(Zw,{connectorId:e}),method:nt.PATCH,data:t}),QS=e=>Ue({url:Ft(cS,{connectorType:e}),method:nt.GET}),mS=e=>{var n;const t=((n=br())==null?void 0:n.userGroupId)??"";return Ue({url:`${Ft(SI,{connectorType:e})}?ug_id=${encodeURIComponent(t)}`,method:nt.GET})},bS=({connectorType:e,smId:t,locationIds:n})=>{var o;const r=((o=br())==null?void 0:o.userGroupId)??"";return Ue({url:`${Ft(SI,{connectorType:e})}?ug_id=${encodeURIComponent(r)}`,method:nt.PUT,data:{smId:t,locationIds:n}})},yS="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='15'%20height='15'%20viewBox='0%200%2015%2015'%3e%3cpath%20fill='%23ffffff'%20fill-rule='nonzero'%20d='M8.821%207.496L14.716%201.6A.937.937%200%201%200%2013.391.275L7.496%206.17%201.6.275A.937.937%200%201%200%20.275%201.601L6.17%207.496.275%2013.39A.937.937%200%201%200%201.6%2014.716L7.496%208.82l5.895%205.895a.935.935%200%200%200%201.325%200%20.937.937%200%200%200%200-1.326L8.821%207.496z'%20opacity='.8'/%3e%3c/svg%3e",vS=g.styled(g.Box)`
|
|
68
68
|
display: flex;
|
|
69
69
|
flex-direction: row;
|
|
70
70
|
align-items: center;
|