work-workflow-prods 1.0.0 → 2.0.0
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/dist/workflow.es.js +1 -1
- package/dist/workflow.umd.js +1 -1
- package/package.json +1 -1
package/dist/workflow.es.js
CHANGED
|
@@ -12839,7 +12839,7 @@ const zR = async (e) => {
|
|
|
12839
12839
|
onConnect: h,
|
|
12840
12840
|
fitView: !0,
|
|
12841
12841
|
fitViewOptions: {
|
|
12842
|
-
|
|
12842
|
+
padding: 0.4
|
|
12843
12843
|
},
|
|
12844
12844
|
deleteKeyCode: null,
|
|
12845
12845
|
children: [
|
package/dist/workflow.umd.js
CHANGED
|
@@ -147,7 +147,7 @@ const theme2 = createTheme({ palette: {
|
|
|
147
147
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(o){return o instanceof this?o:new this(o)}static concat(o,...e){const d=new this(o);return e.forEach(t=>d.set(t)),d}static accessor(o){const d=(this[Kp]=this[Kp]={accessors:{}}).accessors,t=this.prototype;function l(i){const a=Xt(i);d[a]||(CA(t,i),d[a]=!0)}return z.isArray(o)?o.forEach(l):l(o),this}};ko.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),z.reduceDescriptors(ko.prototype,({value:r},o)=>{let e=o[0].toUpperCase()+o.slice(1);return{get:()=>r,set(d){this[e]=d}}}),z.freezeMethods(ko);function ib(r,o){const e=this||Gt,d=o||e,t=ko.from(d.headers);let l=d.data;return z.forEach(r,function(a){l=a.call(e,l,t.normalize(),o?o.status:void 0)}),t.normalize(),l}function Yp(r){return!!(r&&r.__CANCEL__)}function Hd(r,o,e){br.call(this,r??"canceled",br.ERR_CANCELED,o,e),this.name="CanceledError"}z.inherits(Hd,br,{__CANCEL__:!0});function Gp(r,o,e){const d=e.config.validateStatus;!e.status||!d||d(e.status)?r(e):o(new br("Request failed with status code "+e.status,[br.ERR_BAD_REQUEST,br.ERR_BAD_RESPONSE][Math.floor(e.status/100)-4],e.config,e.request,e))}function _A(r){const o=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return o&&o[1]||""}function IA(r,o){r=r||10;const e=new Array(r),d=new Array(r);let t=0,l=0,i;return o=o!==void 0?o:1e3,function(w){const b=Date.now(),s=d[l];i||(i=b),e[t]=w,d[t]=b;let n=l,f=0;for(;n!==t;)f+=e[n++],n=n%r;if(t=(t+1)%r,t===l&&(l=(l+1)%r),b-i<o)return;const m=s&&b-s;return m?Math.round(f*1e3/m):void 0}}function TA(r,o){let e=0,d=1e3/o,t,l;const i=(b,s=Date.now())=>{e=s,t=null,l&&(clearTimeout(l),l=null),r(...b)};return[(...b)=>{const s=Date.now(),n=s-e;n>=d?i(b,s):(t=b,l||(l=setTimeout(()=>{l=null,i(t)},d-n)))},()=>t&&i(t)]}const Ri=(r,o,e=3)=>{let d=0;const t=IA(50,250);return TA(l=>{const i=l.loaded,a=l.lengthComputable?l.total:void 0,w=i-d,b=t(w),s=i<=a;d=i;const n={loaded:i,total:a,progress:a?i/a:void 0,bytes:w,rate:b||void 0,estimated:b&&a&&s?(a-i)/b:void 0,event:l,lengthComputable:a!=null,[o?"download":"upload"]:!0};r(n)},e)},Xp=(r,o)=>{const e=r!=null;return[d=>o[0]({lengthComputable:e,total:r,loaded:d}),o[1]]},Jp=r=>(...o)=>z.asap(()=>r(...o)),NA=io.hasStandardBrowserEnv?((r,o)=>e=>(e=new URL(e,io.origin),r.protocol===e.protocol&&r.host===e.host&&(o||r.port===e.port)))(new URL(io.origin),io.navigator&&/(msie|trident)/i.test(io.navigator.userAgent)):()=>!0,PA=io.hasStandardBrowserEnv?{write(r,o,e,d,t,l){const i=[r+"="+encodeURIComponent(o)];z.isNumber(e)&&i.push("expires="+new Date(e).toGMTString()),z.isString(d)&&i.push("path="+d),z.isString(t)&&i.push("domain="+t),l===!0&&i.push("secure"),document.cookie=i.join("; ")},read(r){const o=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return o?decodeURIComponent(o[3]):null},remove(r){this.write(r,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function RA(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function OA(r,o){return o?r.replace(/\/?\/$/,"")+"/"+o.replace(/^\/+/,""):r}function Zp(r,o,e){let d=!RA(o);return r&&(d||e==!1)?OA(r,o):o}const Qp=r=>r instanceof ko?{...r}:r;function pd(r,o){o=o||{};const e={};function d(b,s,n,f){return z.isPlainObject(b)&&z.isPlainObject(s)?z.merge.call({caseless:f},b,s):z.isPlainObject(s)?z.merge({},s):z.isArray(s)?s.slice():s}function t(b,s,n,f){if(z.isUndefined(s)){if(!z.isUndefined(b))return d(void 0,b,n,f)}else return d(b,s,n,f)}function l(b,s){if(!z.isUndefined(s))return d(void 0,s)}function i(b,s){if(z.isUndefined(s)){if(!z.isUndefined(b))return d(void 0,b)}else return d(void 0,s)}function a(b,s,n){if(n in o)return d(b,s);if(n in r)return d(void 0,b)}const w={url:l,method:l,data:l,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(b,s,n)=>t(Qp(b),Qp(s),n,!0)};return z.forEach(Object.keys({...r,...o}),function(s){const n=w[s]||t,f=n(r[s],o[s],s);z.isUndefined(f)&&n!==a||(e[s]=f)}),e}const rf=r=>{const o=pd({},r);let{data:e,withXSRFToken:d,xsrfHeaderName:t,xsrfCookieName:l,headers:i,auth:a}=o;if(o.headers=i=ko.from(i),o.url=Vp(Zp(o.baseURL,o.url,o.allowAbsoluteUrls),r.params,r.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),z.isFormData(e)){if(io.hasStandardBrowserEnv||io.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(z.isFunction(e.getHeaders)){const w=e.getHeaders(),b=["content-type","content-length"];Object.entries(w).forEach(([s,n])=>{b.includes(s.toLowerCase())&&i.set(s,n)})}}if(io.hasStandardBrowserEnv&&(d&&z.isFunction(d)&&(d=d(o)),d||d!==!1&&NA(o.url))){const w=t&&l&&PA.read(l);w&&i.set(t,w)}return o},MA=typeof XMLHttpRequest<"u"&&function(r){return new Promise(function(e,d){const t=rf(r);let l=t.data;const i=ko.from(t.headers).normalize();let{responseType:a,onUploadProgress:w,onDownloadProgress:b}=t,s,n,f,m,h;function p(){m&&m(),h&&h(),t.cancelToken&&t.cancelToken.unsubscribe(s),t.signal&&t.signal.removeEventListener("abort",s)}let x=new XMLHttpRequest;x.open(t.method.toUpperCase(),t.url,!0),x.timeout=t.timeout;function g(){if(!x)return;const D=ko.from("getAllResponseHeaders"in x&&x.getAllResponseHeaders()),u={data:!a||a==="text"||a==="json"?x.responseText:x.response,status:x.status,statusText:x.statusText,headers:D,config:r,request:x};Gp(function(A){e(A),p()},function(A){d(A),p()},u),x=null}"onloadend"in x?x.onloadend=g:x.onreadystatechange=function(){!x||x.readyState!==4||x.status===0&&!(x.responseURL&&x.responseURL.indexOf("file:")===0)||setTimeout(g)},x.onabort=function(){x&&(d(new br("Request aborted",br.ECONNABORTED,r,x)),x=null)},x.onerror=function(c){const u=c&&c.message?c.message:"Network Error",B=new br(u,br.ERR_NETWORK,r,x);B.event=c||null,d(B),x=null},x.ontimeout=function(){let c=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const u=t.transitional||qp;t.timeoutErrorMessage&&(c=t.timeoutErrorMessage),d(new br(c,u.clarifyTimeoutError?br.ETIMEDOUT:br.ECONNABORTED,r,x)),x=null},l===void 0&&i.setContentType(null),"setRequestHeader"in x&&z.forEach(i.toJSON(),function(c,u){x.setRequestHeader(u,c)}),z.isUndefined(t.withCredentials)||(x.withCredentials=!!t.withCredentials),a&&a!=="json"&&(x.responseType=t.responseType),b&&([f,h]=Ri(b,!0),x.addEventListener("progress",f)),w&&x.upload&&([n,m]=Ri(w),x.upload.addEventListener("progress",n),x.upload.addEventListener("loadend",m)),(t.cancelToken||t.signal)&&(s=D=>{x&&(d(!D||D.type?new Hd(null,r,x):D),x.abort(),x=null)},t.cancelToken&&t.cancelToken.subscribe(s),t.signal&&(t.signal.aborted?s():t.signal.addEventListener("abort",s)));const E=_A(t.url);if(E&&io.protocols.indexOf(E)===-1){d(new br("Unsupported protocol "+E+":",br.ERR_BAD_REQUEST,r));return}x.send(l||null)})},$A=(r,o)=>{const{length:e}=r=r?r.filter(Boolean):[];if(o||e){let d=new AbortController,t;const l=function(b){if(!t){t=!0,a();const s=b instanceof Error?b:this.reason;d.abort(s instanceof br?s:new Hd(s instanceof Error?s.message:s))}};let i=o&&setTimeout(()=>{i=null,l(new br(`timeout ${o} of ms exceeded`,br.ETIMEDOUT))},o);const a=()=>{r&&(i&&clearTimeout(i),i=null,r.forEach(b=>{b.unsubscribe?b.unsubscribe(l):b.removeEventListener("abort",l)}),r=null)};r.forEach(b=>b.addEventListener("abort",l));const{signal:w}=d;return w.unsubscribe=()=>z.asap(a),w}},jA=function*(r,o){let e=r.byteLength;if(e<o){yield r;return}let d=0,t;for(;d<e;)t=d+o,yield r.slice(d,t),d=t},LA=async function*(r,o){for await(const e of UA(r))yield*jA(e,o)},UA=async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}const o=r.getReader();try{for(;;){const{done:e,value:d}=await o.read();if(e)break;yield d}}finally{await o.cancel()}},of=(r,o,e,d)=>{const t=LA(r,o);let l=0,i,a=w=>{i||(i=!0,d&&d(w))};return new ReadableStream({async pull(w){try{const{done:b,value:s}=await t.next();if(b){a(),w.close();return}let n=s.byteLength;if(e){let f=l+=n;e(f)}w.enqueue(new Uint8Array(s))}catch(b){throw a(b),b}},cancel(w){return a(w),t.return()}},{highWaterMark:2})},ef=64*1024,{isFunction:Oi}=z,zA=(({Request:r,Response:o})=>({Request:r,Response:o}))(z.global),{ReadableStream:df,TextEncoder:tf}=z.global,lf=(r,...o)=>{try{return!!r(...o)}catch{return!1}},VA=r=>{r=z.merge.call({skipUndefined:!0},zA,r);const{fetch:o,Request:e,Response:d}=r,t=o?Oi(o):typeof fetch=="function",l=Oi(e),i=Oi(d);if(!t)return!1;const a=t&&Oi(df),w=t&&(typeof tf=="function"?(h=>p=>h.encode(p))(new tf):async h=>new Uint8Array(await new e(h).arrayBuffer())),b=l&&a&&lf(()=>{let h=!1;const p=new e(io.origin,{body:new df,method:"POST",get duplex(){return h=!0,"half"}}).headers.has("Content-Type");return h&&!p}),s=i&&a&&lf(()=>z.isReadableStream(new d("").body)),n={stream:s&&(h=>h.body)};t&&["text","arrayBuffer","blob","formData","stream"].forEach(h=>{!n[h]&&(n[h]=(p,x)=>{let g=p&&p[h];if(g)return g.call(p);throw new br(`Response type '${h}' is not supported`,br.ERR_NOT_SUPPORT,x)})});const f=async h=>{if(h==null)return 0;if(z.isBlob(h))return h.size;if(z.isSpecCompliantForm(h))return(await new e(io.origin,{method:"POST",body:h}).arrayBuffer()).byteLength;if(z.isArrayBufferView(h)||z.isArrayBuffer(h))return h.byteLength;if(z.isURLSearchParams(h)&&(h=h+""),z.isString(h))return(await w(h)).byteLength},m=async(h,p)=>{const x=z.toFiniteNumber(h.getContentLength());return x??f(p)};return async h=>{let{url:p,method:x,data:g,signal:E,cancelToken:D,timeout:c,onDownloadProgress:u,onUploadProgress:B,responseType:A,headers:v,withCredentials:S="same-origin",fetchOptions:T}=rf(h),O=o||fetch;A=A?(A+"").toLowerCase():"text";let H=$A([E,D&&D.toAbortSignal()],c),R=null;const y=H&&H.unsubscribe&&(()=>{H.unsubscribe()});let $;try{if(B&&b&&x!=="get"&&x!=="head"&&($=await m(v,g))!==0){let P=new e(p,{method:"POST",body:g,duplex:"half"}),V;if(z.isFormData(g)&&(V=P.headers.get("content-type"))&&v.setContentType(V),P.body){const[q,U]=Xp($,Ri(Jp(B)));g=of(P.body,ef,q,U)}}z.isString(S)||(S=S?"include":"omit");const I=l&&"credentials"in e.prototype,M={...T,signal:H,method:x.toUpperCase(),headers:v.normalize().toJSON(),body:g,duplex:"half",credentials:I?S:void 0};R=l&&new e(p,M);let j=await(l?O(R,T):O(p,M));const N=s&&(A==="stream"||A==="response");if(s&&(u||N&&y)){const P={};["status","statusText","headers"].forEach(W=>{P[W]=j[W]});const V=z.toFiniteNumber(j.headers.get("content-length")),[q,U]=u&&Xp(V,Ri(Jp(u),!0))||[];j=new d(of(j.body,ef,q,()=>{U&&U(),y&&y()}),P)}A=A||"text";let C=await n[z.findKey(n,A)||"text"](j,h);return!N&&y&&y(),await new Promise((P,V)=>{Gp(P,V,{data:C,headers:ko.from(j.headers),status:j.status,statusText:j.statusText,config:h,request:R})})}catch(I){throw y&&y(),I&&I.name==="TypeError"&&/Load failed|fetch/i.test(I.message)?Object.assign(new br("Network Error",br.ERR_NETWORK,h,R),{cause:I.cause||I}):br.from(I,I&&I.code,h,R)}}},HA=new Map,af=r=>{let o=r?r.env:{};const{fetch:e,Request:d,Response:t}=o,l=[d,t,e];let i=l.length,a=i,w,b,s=HA;for(;a--;)w=l[a],b=s.get(w),b===void 0&&s.set(w,b=a?new Map:VA(o)),s=b;return b};af();const ab={http:pA,xhr:MA,fetch:{get:af}};z.forEach(ab,(r,o)=>{if(r){try{Object.defineProperty(r,"name",{value:o})}catch{}Object.defineProperty(r,"adapterName",{value:o})}});const wf=r=>`- ${r}`,qA=r=>z.isFunction(r)||r===null||r===!1,bf={getAdapter:(r,o)=>{r=z.isArray(r)?r:[r];const{length:e}=r;let d,t;const l={};for(let i=0;i<e;i++){d=r[i];let a;if(t=d,!qA(d)&&(t=ab[(a=String(d)).toLowerCase()],t===void 0))throw new br(`Unknown adapter '${a}'`);if(t&&(z.isFunction(t)||(t=t.get(o))))break;l[a||"#"+i]=t}if(!t){const i=Object.entries(l).map(([w,b])=>`adapter ${w} `+(b===!1?"is not supported by the environment":"is not available in the build"));let a=e?i.length>1?`since :
|
|
148
148
|
`+i.map(wf).join(`
|
|
149
149
|
`):" "+wf(i[0]):"as no adapter specified";throw new br("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return t},adapters:ab};function wb(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new Hd(null,r)}function sf(r){return wb(r),r.headers=ko.from(r.headers),r.data=ib.call(r,r.transformRequest),["post","put","patch"].indexOf(r.method)!==-1&&r.headers.setContentType("application/x-www-form-urlencoded",!1),bf.getAdapter(r.adapter||Gt.adapter,r)(r).then(function(d){return wb(r),d.data=ib.call(r,r.transformResponse,d),d.headers=ko.from(d.headers),d},function(d){return Yp(d)||(wb(r),d&&d.response&&(d.response.data=ib.call(r,r.transformResponse,d.response),d.response.headers=ko.from(d.response.headers))),Promise.reject(d)})}const nf="1.12.2",Mi={};["object","boolean","number","function","string","symbol"].forEach((r,o)=>{Mi[r]=function(d){return typeof d===r||"a"+(o<1?"n ":" ")+r}});const pf={};Mi.transitional=function(o,e,d){function t(l,i){return"[Axios v"+nf+"] Transitional option '"+l+"'"+i+(d?". "+d:"")}return(l,i,a)=>{if(o===!1)throw new br(t(i," has been removed"+(e?" in "+e:"")),br.ERR_DEPRECATED);return e&&!pf[i]&&(pf[i]=!0,console.warn(t(i," has been deprecated since v"+e+" and will be removed in the near future"))),o?o(l,i,a):!0}},Mi.spelling=function(o){return(e,d)=>(console.warn(`${d} is likely a misspelling of ${o}`),!0)};function WA(r,o,e){if(typeof r!="object")throw new br("options must be an object",br.ERR_BAD_OPTION_VALUE);const d=Object.keys(r);let t=d.length;for(;t-- >0;){const l=d[t],i=o[l];if(i){const a=r[l],w=a===void 0||i(a,l,r);if(w!==!0)throw new br("option "+l+" must be "+w,br.ERR_BAD_OPTION_VALUE);continue}if(e!==!0)throw new br("Unknown option "+l,br.ERR_BAD_OPTION)}}const $i={assertOptions:WA,validators:Mi},we=$i.validators;let fd=class{constructor(o){this.defaults=o||{},this.interceptors={request:new Hp,response:new Hp}}async request(o,e){try{return await this._request(o,e)}catch(d){if(d instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const l=t.stack?t.stack.replace(/^.+\n/,""):"";try{d.stack?l&&!String(d.stack).endsWith(l.replace(/^.+\n.+\n/,""))&&(d.stack+=`
|
|
150
|
-
`+l):d.stack=l}catch{}}throw d}}_request(o,e){typeof o=="string"?(e=e||{},e.url=o):e=o||{},e=pd(this.defaults,e);const{transitional:d,paramsSerializer:t,headers:l}=e;d!==void 0&&$i.assertOptions(d,{silentJSONParsing:we.transitional(we.boolean),forcedJSONParsing:we.transitional(we.boolean),clarifyTimeoutError:we.transitional(we.boolean)},!1),t!=null&&(z.isFunction(t)?e.paramsSerializer={serialize:t}:$i.assertOptions(t,{encode:we.function,serialize:we.function},!0)),e.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),$i.assertOptions(e,{baseUrl:we.spelling("baseURL"),withXsrfToken:we.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let i=l&&z.merge(l.common,l[e.method]);l&&z.forEach(["delete","get","head","post","put","patch","common"],h=>{delete l[h]}),e.headers=ko.concat(i,l);const a=[];let w=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(e)===!1||(w=w&&p.synchronous,a.unshift(p.fulfilled,p.rejected))});const b=[];this.interceptors.response.forEach(function(p){b.push(p.fulfilled,p.rejected)});let s,n=0,f;if(!w){const h=[sf.bind(this),void 0];for(h.unshift(...a),h.push(...b),f=h.length,s=Promise.resolve(e);n<f;)s=s.then(h[n++],h[n++]);return s}f=a.length;let m=e;for(;n<f;){const h=a[n++],p=a[n++];try{m=h(m)}catch(x){p.call(this,x);break}}try{s=sf.call(this,m)}catch(h){return Promise.reject(h)}for(n=0,f=b.length;n<f;)s=s.then(b[n++],b[n++]);return s}getUri(o){o=pd(this.defaults,o);const e=Zp(o.baseURL,o.url,o.allowAbsoluteUrls);return Vp(e,o.params,o.paramsSerializer)}};z.forEach(["delete","get","head","options"],function(o){fd.prototype[o]=function(e,d){return this.request(pd(d||{},{method:o,url:e,data:(d||{}).data}))}}),z.forEach(["post","put","patch"],function(o){function e(d){return function(l,i,a){return this.request(pd(a||{},{method:o,headers:d?{"Content-Type":"multipart/form-data"}:{},url:l,data:i}))}}fd.prototype[o]=e(),fd.prototype[o+"Form"]=e(!0)});let KA=class Tm{constructor(o){if(typeof o!="function")throw new TypeError("executor must be a function.");let e;this.promise=new Promise(function(l){e=l});const d=this;this.promise.then(t=>{if(!d._listeners)return;let l=d._listeners.length;for(;l-- >0;)d._listeners[l](t);d._listeners=null}),this.promise.then=t=>{let l;const i=new Promise(a=>{d.subscribe(a),l=a}).then(t);return i.cancel=function(){d.unsubscribe(l)},i},o(function(l,i,a){d.reason||(d.reason=new Hd(l,i,a),e(d.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(o){if(this.reason){o(this.reason);return}this._listeners?this._listeners.push(o):this._listeners=[o]}unsubscribe(o){if(!this._listeners)return;const e=this._listeners.indexOf(o);e!==-1&&this._listeners.splice(e,1)}toAbortSignal(){const o=new AbortController,e=d=>{o.abort(d)};return this.subscribe(e),o.signal.unsubscribe=()=>this.unsubscribe(e),o.signal}static source(){let o;return{token:new Tm(function(t){o=t}),cancel:o}}};function YA(r){return function(e){return r.apply(null,e)}}function GA(r){return z.isObject(r)&&r.isAxiosError===!0}const bb={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(bb).forEach(([r,o])=>{bb[o]=r});function ff(r){const o=new fd(r),e=Sp(fd.prototype.request,o);return z.extend(e,fd.prototype,o,{allOwnKeys:!0}),z.extend(e,o,null,{allOwnKeys:!0}),e.create=function(t){return ff(pd(r,t))},e}const Or=ff(Gt);Or.Axios=fd,Or.CanceledError=Hd,Or.CancelToken=KA,Or.isCancel=Yp,Or.VERSION=nf,Or.toFormData=Ni,Or.AxiosError=br,Or.Cancel=Or.CanceledError,Or.all=function(o){return Promise.all(o)},Or.spread=YA,Or.isAxiosError=GA,Or.mergeConfig=pd,Or.AxiosHeaders=ko,Or.formToJSON=r=>Wp(z.isHTMLForm(r)?new FormData(r):r),Or.getAdapter=bf.getAdapter,Or.HttpStatusCode=bb,Or.default=Or;const{Axios:UB,AxiosError:zB,CanceledError:VB,isCancel:HB,CancelToken:qB,VERSION:WB,all:KB,Cancel:YB,isAxiosError:GB,spread:XB,toFormData:JB,AxiosHeaders:ZB,HttpStatusCode:QB,formToJSON:rS,getAdapter:oS,mergeConfig:eS}=Or;var Jt={},hf;function XA(){if(hf)return Jt;hf=1,Object.defineProperty(Jt,"__esModule",{value:!0}),Jt.parse=i,Jt.serialize=b;const r=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,o=/^[\u0021-\u003A\u003C-\u007E]*$/,e=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,d=/^[\u0020-\u003A\u003D-\u007E]*$/,t=Object.prototype.toString,l=(()=>{const f=function(){};return f.prototype=Object.create(null),f})();function i(f,m){const h=new l,p=f.length;if(p<2)return h;const x=m?.decode||s;let g=0;do{const E=f.indexOf("=",g);if(E===-1)break;const D=f.indexOf(";",g),c=D===-1?p:D;if(E>c){g=f.lastIndexOf(";",E-1)+1;continue}const u=a(f,g,E),B=w(f,E,u),A=f.slice(u,B);if(h[A]===void 0){let v=a(f,E+1,c),S=w(f,c,v);const T=x(f.slice(v,S));h[A]=T}g=c+1}while(g<p);return h}function a(f,m,h){do{const p=f.charCodeAt(m);if(p!==32&&p!==9)return m}while(++m<h);return h}function w(f,m,h){for(;m>h;){const p=f.charCodeAt(--m);if(p!==32&&p!==9)return m+1}return h}function b(f,m,h){const p=h?.encode||encodeURIComponent;if(!r.test(f))throw new TypeError(`argument name is invalid: ${f}`);const x=p(m);if(!o.test(x))throw new TypeError(`argument val is invalid: ${m}`);let g=f+"="+x;if(!h)return g;if(h.maxAge!==void 0){if(!Number.isInteger(h.maxAge))throw new TypeError(`option maxAge is invalid: ${h.maxAge}`);g+="; Max-Age="+h.maxAge}if(h.domain){if(!e.test(h.domain))throw new TypeError(`option domain is invalid: ${h.domain}`);g+="; Domain="+h.domain}if(h.path){if(!d.test(h.path))throw new TypeError(`option path is invalid: ${h.path}`);g+="; Path="+h.path}if(h.expires){if(!n(h.expires)||!Number.isFinite(h.expires.valueOf()))throw new TypeError(`option expires is invalid: ${h.expires}`);g+="; Expires="+h.expires.toUTCString()}if(h.httpOnly&&(g+="; HttpOnly"),h.secure&&(g+="; Secure"),h.partitioned&&(g+="; Partitioned"),h.priority)switch(typeof h.priority=="string"?h.priority.toLowerCase():void 0){case"low":g+="; Priority=Low";break;case"medium":g+="; Priority=Medium";break;case"high":g+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${h.priority}`)}if(h.sameSite)switch(typeof h.sameSite=="string"?h.sameSite.toLowerCase():h.sameSite){case!0:case"strict":g+="; SameSite=Strict";break;case"lax":g+="; SameSite=Lax";break;case"none":g+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${h.sameSite}`)}return g}function s(f){if(f.indexOf("%")===-1)return f;try{return decodeURIComponent(f)}catch{return f}}function n(f){return t.call(f)==="[object Date]"}return Jt}var ji=XA();function JA(){const r=typeof global>"u"?void 0:global.TEST_HAS_DOCUMENT_COOKIE;return typeof r=="boolean"?r:typeof document=="object"&&typeof document.cookie=="string"}function ZA(r){return typeof r=="string"?ji.parse(r):typeof r=="object"&&r!==null?r:{}}function sb(r,o={}){const e=QA(r);if(!o.doNotParse)try{return JSON.parse(e)}catch{}return r}function QA(r){return r&&r[0]==="j"&&r[1]===":"?r.substr(2):r}class r8{constructor(o,e={}){this.changeListeners=[],this.HAS_DOCUMENT_COOKIE=!1,this.update=()=>{if(!this.HAS_DOCUMENT_COOKIE)return;const t=this.cookies;this.cookies=ji.parse(document.cookie),this._checkChanges(t)};const d=typeof document>"u"?"":document.cookie;this.cookies=ZA(o||d),this.defaultSetOptions=e,this.HAS_DOCUMENT_COOKIE=JA()}_emitChange(o){for(let e=0;e<this.changeListeners.length;++e)this.changeListeners[e](o)}_checkChanges(o){new Set(Object.keys(o).concat(Object.keys(this.cookies))).forEach(d=>{o[d]!==this.cookies[d]&&this._emitChange({name:d,value:sb(this.cookies[d])})})}_startPolling(){this.pollingInterval=setInterval(this.update,300)}_stopPolling(){this.pollingInterval&&clearInterval(this.pollingInterval)}get(o,e={}){return e.doNotUpdate||this.update(),sb(this.cookies[o],e)}getAll(o={}){o.doNotUpdate||this.update();const e={};for(let d in this.cookies)e[d]=sb(this.cookies[d],o);return e}set(o,e,d){d?d=Object.assign(Object.assign({},this.defaultSetOptions),d):d=this.defaultSetOptions;const t=typeof e=="string"?e:JSON.stringify(e);this.cookies=Object.assign(Object.assign({},this.cookies),{[o]:t}),this.HAS_DOCUMENT_COOKIE&&(document.cookie=ji.serialize(o,t,d)),this._emitChange({name:o,value:e,options:d})}remove(o,e){const d=e=Object.assign(Object.assign(Object.assign({},this.defaultSetOptions),e),{expires:new Date(1970,1,1,0,0,1),maxAge:0});this.cookies=Object.assign({},this.cookies),delete this.cookies[o],this.HAS_DOCUMENT_COOKIE&&(document.cookie=ji.serialize(o,"",d)),this._emitChange({name:o,value:void 0,options:e})}addChangeListener(o){this.changeListeners.push(o),this.HAS_DOCUMENT_COOKIE&&this.changeListeners.length===1&&(typeof window=="object"&&"cookieStore"in window?window.cookieStore.addEventListener("change",this.update):this._startPolling())}removeChangeListener(o){const e=this.changeListeners.indexOf(o);e>=0&&this.changeListeners.splice(e,1),this.HAS_DOCUMENT_COOKIE&&this.changeListeners.length===0&&(typeof window=="object"&&"cookieStore"in window?window.cookieStore.removeEventListener("change",this.update):this._stopPolling())}removeAllChangeListeners(){for(;this.changeListeners.length>0;)this.removeChangeListener(this.changeListeners[0])}}const nb={clientApiUrl:"https://api.doworks.com/api/client/",clientGraphqlUrl:"https://api.doworks.com/api/client/graphql",serverGraphqlUrl:"https://api.doworks.com/api/crm/graphql"},o8=nb.clientApiUrl,pb=new r8,Ee=Or.create({baseURL:o8});Ee.interceptors.request.use(r=>{const e=(()=>{const l=Object.keys(pb.getAll()).find(i=>i.endsWith("accessToken"));return l?pb.get(l):null})(),d=pb.get("workspaceId");return e&&(r.headers.Authorization=e),d&&(r.headers["x-tenant-id"]=d),r},r=>Promise.reject(r));const e8=async r=>{try{return(await Ee.post(`/workspace/${r.workspaceId}/workflow`,{...r})).data}catch(o){throw console.error("Failed to fetch table column data types:",o),o}},d8=async r=>{try{return(await Ee.put(`/workspace/${r.workspaceId}/workflow`,{...r})).data}catch(o){throw console.error("Failed to fetch table column data types:",o),o}},t8=async r=>{try{return(await Ee.post(`/workspace/${r.workspaceId}/automation`,{...r})).data}catch(o){throw console.error("Failed to fetch table column data types:",o),o}},l8=async r=>{try{return(await Ee.put(`/workspace/${r.workspaceId}/automation/automationAction`,{...r})).data}catch(o){throw console.error("Failed to fetch table column data types:",o),o}},mf=async(r,o)=>{try{return(await Ee.get(`/workspace/${o}/automation/workflowSeg/${r}`)).data}catch(e){throw console.error("Failed to fetch table column data types:",e),e}},i8=async({id:r,isActive:o,workspaceId:e})=>{try{return(await Ee.put(`/workspace/${e}/automation/activetoggle/${r}/${o}`)).data}catch(d){throw console.error("Failed to fetch table column data types:",d),d}},a8=async({id:r,workspaceId:o,selectFieldId:e})=>{try{return(await Ee.delete(`/workspace/${o}/automation/${e}/${r}`)).data}catch(d){throw console.error("Failed to fetch table column data types:",d),d}},w8=async({fieldId:r,workspaceId:o})=>{try{return(await Ee.get(`/workspace/${o}/workflow/${r}`)).data}catch(e){throw console.error("Failed to fetch table column data types:",e),e}},kf=r=>r?.toLowerCase()?.split(/[\s\-_]+/)?.map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" "),b8=(r,o,e=void 0)=>{const d=o.split(".");let t=r;for(const l of d)if(t&&typeof t=="object"&&l in t)t=t[l];else return e;return t},xf=(r,o)=>{const e=r.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(t,l,i,a)=>`#${l}${l}${i}${i}${a}${a}`),d=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return d?`rgba(${parseInt(d[1],16)}, ${parseInt(d[2],16)}, ${parseInt(d[3],16)}, ${o})`:""},gf=(r,o)=>{const e=r.match(/\d+/g);return e?`rgba(${e.join(", ")}, ${o})`:r},fb=r=>{const o=r||"rgb(154, 173, 189)";return o.startsWith("#")?xf(o,.2):gf(o,.2)},We=r=>{const o=r||"rgb(154, 173, 189)";return o.startsWith("#")?xf(o,1):gf(o,1)},cf=({data:r})=>{const[o,e]=F.useState(!1);return k.jsxs("div",{onMouseEnter:()=>e(!0),onMouseLeave:()=>e(!1),style:{backgroundColor:fb(r.color),border:`1px solid ${We(r.color)}`,position:"relative",width:264,height:40,borderRadius:8,display:"flex",alignItems:"center",justifyContent:"center"},children:[k.jsx("p",{style:{color:We(r.color),fontSize:12,fontWeight:400},children:r.label}),k.jsxs("div",{style:{opacity:o?1:0,transition:"opacity 0.2s ease"},children:[k.jsx(Oo,{id:"top-t",type:"target",position:er.Top,style:{width:8,height:8,background:"#a855f7"},onMouseEnter:()=>{}}),k.jsx(Oo,{id:"top-s",type:"source",position:er.Top,style:{width:8,height:8,background:"#a855f7",marginTop:-1}}),k.jsx(Oo,{id:"left-t",type:"target",position:er.Left,style:{width:8,height:8,background:"#a855f7"}}),k.jsx(Oo,{id:"left-s",type:"source",position:er.Left,style:{width:8,height:8,background:"#a855f7",marginLeft:-1}}),k.jsx(Oo,{id:"bottom-t",type:"target",position:er.Bottom,style:{width:8,height:8,background:"#a855f7"}}),k.jsx(Oo,{id:"bottom-s",type:"source",position:er.Bottom,style:{width:8,height:8,background:"#a855f7",marginTop:-1}}),k.jsx(Oo,{id:"right-t",type:"target",position:er.Right,style:{width:8,height:8,background:"#a855f7"}}),k.jsx(Oo,{id:"right-s",type:"source",position:er.Right,style:{width:8,height:8,background:"#a855f7",marginLeft:-1}})]})]})},uf=({id:r,sourceX:o,sourceY:e,targetX:d,targetY:t,sourcePosition:l,targetPosition:i})=>{const[a,w,b]=Gl({sourceX:o,sourceY:e,targetX:d,targetY:t,sourcePosition:l,targetPosition:i,borderRadius:20}),s=`arrow-${r}`;return k.jsxs(k.Fragment,{children:[k.jsx("svg",{width:"0",height:"0",children:k.jsx("defs",{children:k.jsx("marker",{id:s,markerWidth:"10",markerHeight:"10",viewBox:"0 0 10 10",refX:"8",refY:"5",orient:"auto-start-reverse",markerUnits:"strokeWidth",children:k.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"#B475FC"})})})}),k.jsx(vd,{id:r,path:a,markerEnd:`url(#${s})`,style:{stroke:"#B475FC",strokeWidth:1.5}}),k.jsx("foreignObject",{width:18,height:20,x:w-10,y:b-8,children:k.jsx("div",{style:{background:"#fff",border:"1px solid #ccc",borderRadius:"5px",padding:"2px 4px"},className:"d-flex align-center justify-center",children:k.jsx("img",{src:"/vector.svg",alt:"vector",style:{width:10,height:10,display:"block"}})})})]})},s8={customHandle:cf},n8={custom:uf},Ff=({setEdges:r,nodes:o,edges:e,onNodesChange:d,onEdgesChange:t,hasMiniMap:l=!0,hasControls:i=!0,hasGlobalManageAuto:a=!0,isGlobalAuto:w=!1,setIsGlobalAuto:b,updateManageAuto:s,countGlobalAuto:n})=>{const f=F.useCallback(m=>{if(e?.some(c=>c.source===m.source&&c.target===m.target))return;const p=o.find(c=>c.id===m.source),x=o.find(c=>c.id===m.target),g=p?.data?.color||"#000",E=x?.data?.color||"#000",D={...m,id:`reactflow__edge-${m.source}-${m.target}`,type:"custom",source:m.source,target:m.target,data:{sourceLabel:p?.data?.label,targetLabel:x?.data?.label,sourceColor:g,targetColor:E,permission:[],requiredColumns:[],condition:""}};r(c=>J3(D,c))},[e]);return k.jsx("div",{style:{width:"100%",height:"100%",position:"relative",flex:1},children:k.jsxs(gw,{nodes:o,edges:e,nodeTypes:s8,edgeTypes:n8,onNodesChange:d,onEdgesChange:t,onConnect:f,fitView:!0,fitViewOptions:{maxZoom:1},deleteKeyCode:null,children:[a?k.jsxs("div",{className:"mx-24 my-14 border-solid-input-border h-62px d-flex radius-8 align-center px-16 position-absolute",style:{zIndex:99,width:"calc(100% - 64px)"},children:[k.jsx("div",{className:"w-42px h-46px d-flex align-center justify-center mr-8",children:k.jsx("div",{className:"w-32px h-32px radius-100 bg-blue-lighten9 d-flex align-center justify-center",children:k.jsx("img",{src:"/vector.svg",alt:"vector",width:20,height:20})})}),k.jsxs("div",{className:"flex-1 d-flex align-center justify-between",children:[k.jsxs("div",{children:[k.jsx("p",{className:"f-14 f-w-400 txt-heading l-h-24",children:"Global Automation"}),n?k.jsxs("p",{className:"f-12 f-w-400 txt-sub-heading",children:[n," Automation rule is active"]}):k.jsx("p",{className:"f-12 f-w-400 txt-sub-heading",children:"No automations have been created yet"})]}),k.jsx(dr.Button,{variant:"outlined",color:"inherit",className:"mr-10",onClick:()=>{b&&b(!0),s&&s()},disabled:w,children:n?"Manage":"Create Automation"})]})]}):k.jsx(k.Fragment,{}),l?k.jsx(A5,{}):k.jsx(k.Fragment,{}),i?k.jsx(C5,{}):k.jsx(k.Fragment,{}),k.jsx(R5,{})]})})},p8=({edges:r,setSelectedId:o,saveToBackend:e,setEdges:d})=>k.jsx("div",{style:{top:0,right:0,height:"100%",width:"422px",background:"#fff",borderLeft:"1px solid #ccc"},children:k.jsxs("div",{className:"px-16 py-12 d-flex flex-column edge-container",children:[k.jsxs("div",{children:[k.jsx("div",{className:"h-36px d-flex align-center f-w-600 f-14 txt-darkblue px-8",children:"Configuration"}),k.jsx("div",{className:"border-solid-border1 my-12"})]}),k.jsx("div",{className:"flex-1",children:r?.map(t=>k.jsxs("div",{className:"d-flex h-36px mb-24",children:[k.jsxs("div",{style:{backgroundColor:fb(t.data?.sourceColor),border:`1px solid ${We(t.data?.sourceColor)}`},className:" flex-1 radius-8 px-12 py-6 d-flex justify-between align-center cursor-pointer mr-12 w-300px",onClick:()=>{o({id:t.id,type:"config"})},children:[k.jsx("div",{className:"f-12 f-w-400 mr-20",style:{color:We(t.data?.sourceColor)},children:t?.data?.sourceLabel}),k.jsx("img",{src:"/workflow_east.svg",alt:"arrow",className:""}),k.jsx("div",{className:"f-w-400 f-12",style:{color:We(t.data?.targetColor)},children:t?.data?.targetLabel})]}),k.jsx("div",{className:"w-36px h-36px border-solid-input-border d-flex align-center justify-center cursor-pointer mr-4 radius-6 bg-hover-blue-lighten9",onClick:()=>{o({id:t.id,type:"auto"})},children:k.jsx("img",{src:"/vector.svg",alt:"vector",width:16,height:16})}),k.jsx("div",{className:"w-36px h-36px border-solid-input-border d-flex align-center justify-center cursor-pointer radius-6",onClick:()=>{d(l=>l.filter(i=>i.id!==t?.id))},children:k.jsx("img",{src:"/workflow_delete.svg",alt:"delete",width:16,height:16})})]}))}),k.jsxs("div",{className:"d-flex justify-end",children:[k.jsx(dr.Button,{variant:"outlined",color:"inherit",className:"mr-10",onClick:()=>close(),children:"Cancel"}),k.jsx(dr.Button,{variant:"outlined",color:"primary",onClick:()=>{e()},children:"Update"})]})]})});var Zt={},Af;function f8(){if(Af)return Zt;Af=1;var r=Jo();Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.default=void 0;var o=r(ye()),e=oe();return Zt.default=(0,o.default)((0,e.jsx)("path",{d:"m8.71 11.71 2.59 2.59c.39.39 1.02.39 1.41 0l2.59-2.59c.63-.63.18-1.71-.71-1.71H9.41c-.89 0-1.33 1.08-.7 1.71"}),"ArrowDropDownRounded"),Zt}var h8=f8();const yf=No(h8),Li={"popper-border":"#eaeff4","success-disabled":"#a6aaaf"};var Qt={},Ef;function m8(){if(Ef)return Qt;Ef=1;var r=Jo();Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.default=void 0;var o=r(ye()),e=oe();return Qt.default=(0,o.default)((0,e.jsx)("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Clear"),Qt}var k8=m8();const Df=No(k8);var hb=function(r,o){return hb=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,d){e.__proto__=d}||function(e,d){for(var t in d)Object.prototype.hasOwnProperty.call(d,t)&&(e[t]=d[t])},hb(r,o)};function x8(r,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");hb(r,o);function e(){this.constructor=r}r.prototype=o===null?Object.create(o):(e.prototype=o.prototype,new e)}var Ke=function(){return Ke=Object.assign||function(o){for(var e,d=1,t=arguments.length;d<t;d++){e=arguments[d];for(var l in e)Object.prototype.hasOwnProperty.call(e,l)&&(o[l]=e[l])}return o},Ke.apply(this,arguments)};function g8(r,o){var e={};for(var d in r)Object.prototype.hasOwnProperty.call(r,d)&&o.indexOf(d)<0&&(e[d]=r[d]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var t=0,d=Object.getOwnPropertySymbols(r);t<d.length;t++)o.indexOf(d[t])<0&&Object.prototype.propertyIsEnumerable.call(r,d[t])&&(e[d[t]]=r[d[t]]);return e}function c8(r,o,e,d){function t(l){return l instanceof e?l:new e(function(i){i(l)})}return new(e||(e=Promise))(function(l,i){function a(s){try{b(d.next(s))}catch(n){i(n)}}function w(s){try{b(d.throw(s))}catch(n){i(n)}}function b(s){s.done?l(s.value):t(s.value).then(a,w)}b((d=d.apply(r,o||[])).next())})}function u8(r,o){var e={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},d,t,l,i=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return i.next=a(0),i.throw=a(1),i.return=a(2),typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(b){return function(s){return w([b,s])}}function w(b){if(d)throw new TypeError("Generator is already executing.");for(;i&&(i=0,b[0]&&(e=0)),e;)try{if(d=1,t&&(l=b[0]&2?t.return:b[0]?t.throw||((l=t.return)&&l.call(t),0):t.next)&&!(l=l.call(t,b[1])).done)return l;switch(t=0,l&&(b=[b[0]&2,l.value]),b[0]){case 0:case 1:l=b;break;case 4:return e.label++,{value:b[1],done:!1};case 5:e.label++,t=b[1],b=[0];continue;case 7:b=e.ops.pop(),e.trys.pop();continue;default:if(l=e.trys,!(l=l.length>0&&l[l.length-1])&&(b[0]===6||b[0]===2)){e=0;continue}if(b[0]===3&&(!l||b[1]>l[0]&&b[1]<l[3])){e.label=b[1];break}if(b[0]===6&&e.label<l[1]){e.label=l[1],l=b;break}if(l&&e.label<l[2]){e.label=l[2],e.ops.push(b);break}l[2]&&e.ops.pop(),e.trys.pop();continue}b=o.call(r,e)}catch(s){b=[6,s],t=0}finally{d=l=0}if(b[0]&5)throw b[1];return{value:b[0]?b[1]:void 0,done:!0}}}typeof SuppressedError=="function"&&SuppressedError;var mb="Invariant Violation",vf=Object.setPrototypeOf,F8=vf===void 0?function(r,o){return r.__proto__=o,r}:vf,Bf=function(r){x8(o,r);function o(e){e===void 0&&(e=mb);var d=r.call(this,typeof e=="number"?mb+": "+e+" (see https://github.com/apollographql/invariant-packages)":e)||this;return d.framesToPop=1,d.name=mb,F8(d,o.prototype),d}return o}(Error);function hd(r,o){if(!r)throw new Bf(o)}var Sf=["debug","log","warn","error","silent"],A8=Sf.indexOf("log");function Ui(r){return function(){if(Sf.indexOf(r)>=A8){var o=console[r]||console.log;return o.apply(console,arguments)}}}(function(r){r.debug=Ui("debug"),r.log=Ui("log"),r.warn=Ui("warn"),r.error=Ui("error")})(hd||(hd={}));var Cf="3.14.0";function qd(r){try{return r()}catch{}}const kb=qd(function(){return globalThis})||qd(function(){return window})||qd(function(){return self})||qd(function(){return global})||qd(function(){return qd.constructor("return this")()});var _f=new Map;function y8(r){var o=_f.get(r)||1;return _f.set(r,o+1),"".concat(r,":").concat(o,":").concat(Math.random().toString(36).slice(2))}function E8(r,o){var e=y8("stringifyForDisplay");return JSON.stringify(r,function(d,t){return t===void 0?e:t},o).split(JSON.stringify(e)).join("<undefined>")}function zi(r){return function(o){for(var e=[],d=1;d<arguments.length;d++)e[d-1]=arguments[d];if(typeof o=="number"){var t=o;o=gb(t),o||(o=cb(t,e),e=[])}r.apply(void 0,[o].concat(e))}}var xb=Object.assign(function(o,e){for(var d=[],t=2;t<arguments.length;t++)d[t-2]=arguments[t];o||hd(o,gb(e,d)||cb(e,d))},{debug:zi(hd.debug),log:zi(hd.log),warn:zi(hd.warn),error:zi(hd.error)});function If(r){for(var o=[],e=1;e<arguments.length;e++)o[e-1]=arguments[e];return new Bf(gb(r,o)||cb(r,o))}var Tf=Symbol.for("ApolloErrorMessageHandler_"+Cf);function Nf(r){if(typeof r=="string")return r;try{return E8(r,2).slice(0,1e3)}catch{return"<non-serializable>"}}function gb(r,o){if(o===void 0&&(o=[]),!!r)return kb[Tf]&&kb[Tf](r,o.map(Nf))}function cb(r,o){if(o===void 0&&(o=[]),!!r)return"An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({version:Cf,message:r,args:o.map(Nf)})))}function D8(r){return r.definitions.filter(function(o){return o.kind==="OperationDefinition"&&!!o.name}).map(function(o){return o.name.value})[0]||null}let oo=null;const Pf={};let v8=1;const B8=()=>class{constructor(){this.id=["slot",v8++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let o=oo;o;o=o.parent)if(this.id in o.slots){const e=o.slots[this.id];if(e===Pf)break;return o!==oo&&(oo.slots[this.id]=e),!0}return oo&&(oo.slots[this.id]=Pf),!1}getValue(){if(this.hasValue())return oo.slots[this.id]}withValue(o,e,d,t){const l={__proto__:null,[this.id]:o},i=oo;oo={parent:i,slots:l};try{return e.apply(t,d)}finally{oo=i}}static bind(o){const e=oo;return function(){const d=oo;try{return oo=e,o.apply(this,arguments)}finally{oo=d}}}static noContext(o,e,d){if(oo){const t=oo;try{return oo=null,o.apply(d,e)}finally{oo=t}}else return o.apply(d,e)}};function Rf(r){try{return r()}catch{}}const ub="@wry/context:Slot",Of=Rf(()=>globalThis)||Rf(()=>global)||Object.create(null),Fb=Of[ub]||Array[ub]||function(r){try{Object.defineProperty(Of,ub,{value:r,enumerable:!1,writable:!1,configurable:!0})}finally{return r}}(B8()),{bind:tS,noContext:lS}=Fb;new Fb;function S8(r,o){var e=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(e)return(e=e.call(r)).next.bind(e);if(Array.isArray(r)||(e=C8(r))||o){e&&(r=e);var d=0;return function(){return d>=r.length?{done:!0}:{done:!1,value:r[d++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
150
|
+
`+l):d.stack=l}catch{}}throw d}}_request(o,e){typeof o=="string"?(e=e||{},e.url=o):e=o||{},e=pd(this.defaults,e);const{transitional:d,paramsSerializer:t,headers:l}=e;d!==void 0&&$i.assertOptions(d,{silentJSONParsing:we.transitional(we.boolean),forcedJSONParsing:we.transitional(we.boolean),clarifyTimeoutError:we.transitional(we.boolean)},!1),t!=null&&(z.isFunction(t)?e.paramsSerializer={serialize:t}:$i.assertOptions(t,{encode:we.function,serialize:we.function},!0)),e.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),$i.assertOptions(e,{baseUrl:we.spelling("baseURL"),withXsrfToken:we.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let i=l&&z.merge(l.common,l[e.method]);l&&z.forEach(["delete","get","head","post","put","patch","common"],h=>{delete l[h]}),e.headers=ko.concat(i,l);const a=[];let w=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(e)===!1||(w=w&&p.synchronous,a.unshift(p.fulfilled,p.rejected))});const b=[];this.interceptors.response.forEach(function(p){b.push(p.fulfilled,p.rejected)});let s,n=0,f;if(!w){const h=[sf.bind(this),void 0];for(h.unshift(...a),h.push(...b),f=h.length,s=Promise.resolve(e);n<f;)s=s.then(h[n++],h[n++]);return s}f=a.length;let m=e;for(;n<f;){const h=a[n++],p=a[n++];try{m=h(m)}catch(x){p.call(this,x);break}}try{s=sf.call(this,m)}catch(h){return Promise.reject(h)}for(n=0,f=b.length;n<f;)s=s.then(b[n++],b[n++]);return s}getUri(o){o=pd(this.defaults,o);const e=Zp(o.baseURL,o.url,o.allowAbsoluteUrls);return Vp(e,o.params,o.paramsSerializer)}};z.forEach(["delete","get","head","options"],function(o){fd.prototype[o]=function(e,d){return this.request(pd(d||{},{method:o,url:e,data:(d||{}).data}))}}),z.forEach(["post","put","patch"],function(o){function e(d){return function(l,i,a){return this.request(pd(a||{},{method:o,headers:d?{"Content-Type":"multipart/form-data"}:{},url:l,data:i}))}}fd.prototype[o]=e(),fd.prototype[o+"Form"]=e(!0)});let KA=class Tm{constructor(o){if(typeof o!="function")throw new TypeError("executor must be a function.");let e;this.promise=new Promise(function(l){e=l});const d=this;this.promise.then(t=>{if(!d._listeners)return;let l=d._listeners.length;for(;l-- >0;)d._listeners[l](t);d._listeners=null}),this.promise.then=t=>{let l;const i=new Promise(a=>{d.subscribe(a),l=a}).then(t);return i.cancel=function(){d.unsubscribe(l)},i},o(function(l,i,a){d.reason||(d.reason=new Hd(l,i,a),e(d.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(o){if(this.reason){o(this.reason);return}this._listeners?this._listeners.push(o):this._listeners=[o]}unsubscribe(o){if(!this._listeners)return;const e=this._listeners.indexOf(o);e!==-1&&this._listeners.splice(e,1)}toAbortSignal(){const o=new AbortController,e=d=>{o.abort(d)};return this.subscribe(e),o.signal.unsubscribe=()=>this.unsubscribe(e),o.signal}static source(){let o;return{token:new Tm(function(t){o=t}),cancel:o}}};function YA(r){return function(e){return r.apply(null,e)}}function GA(r){return z.isObject(r)&&r.isAxiosError===!0}const bb={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(bb).forEach(([r,o])=>{bb[o]=r});function ff(r){const o=new fd(r),e=Sp(fd.prototype.request,o);return z.extend(e,fd.prototype,o,{allOwnKeys:!0}),z.extend(e,o,null,{allOwnKeys:!0}),e.create=function(t){return ff(pd(r,t))},e}const Or=ff(Gt);Or.Axios=fd,Or.CanceledError=Hd,Or.CancelToken=KA,Or.isCancel=Yp,Or.VERSION=nf,Or.toFormData=Ni,Or.AxiosError=br,Or.Cancel=Or.CanceledError,Or.all=function(o){return Promise.all(o)},Or.spread=YA,Or.isAxiosError=GA,Or.mergeConfig=pd,Or.AxiosHeaders=ko,Or.formToJSON=r=>Wp(z.isHTMLForm(r)?new FormData(r):r),Or.getAdapter=bf.getAdapter,Or.HttpStatusCode=bb,Or.default=Or;const{Axios:UB,AxiosError:zB,CanceledError:VB,isCancel:HB,CancelToken:qB,VERSION:WB,all:KB,Cancel:YB,isAxiosError:GB,spread:XB,toFormData:JB,AxiosHeaders:ZB,HttpStatusCode:QB,formToJSON:rS,getAdapter:oS,mergeConfig:eS}=Or;var Jt={},hf;function XA(){if(hf)return Jt;hf=1,Object.defineProperty(Jt,"__esModule",{value:!0}),Jt.parse=i,Jt.serialize=b;const r=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,o=/^[\u0021-\u003A\u003C-\u007E]*$/,e=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,d=/^[\u0020-\u003A\u003D-\u007E]*$/,t=Object.prototype.toString,l=(()=>{const f=function(){};return f.prototype=Object.create(null),f})();function i(f,m){const h=new l,p=f.length;if(p<2)return h;const x=m?.decode||s;let g=0;do{const E=f.indexOf("=",g);if(E===-1)break;const D=f.indexOf(";",g),c=D===-1?p:D;if(E>c){g=f.lastIndexOf(";",E-1)+1;continue}const u=a(f,g,E),B=w(f,E,u),A=f.slice(u,B);if(h[A]===void 0){let v=a(f,E+1,c),S=w(f,c,v);const T=x(f.slice(v,S));h[A]=T}g=c+1}while(g<p);return h}function a(f,m,h){do{const p=f.charCodeAt(m);if(p!==32&&p!==9)return m}while(++m<h);return h}function w(f,m,h){for(;m>h;){const p=f.charCodeAt(--m);if(p!==32&&p!==9)return m+1}return h}function b(f,m,h){const p=h?.encode||encodeURIComponent;if(!r.test(f))throw new TypeError(`argument name is invalid: ${f}`);const x=p(m);if(!o.test(x))throw new TypeError(`argument val is invalid: ${m}`);let g=f+"="+x;if(!h)return g;if(h.maxAge!==void 0){if(!Number.isInteger(h.maxAge))throw new TypeError(`option maxAge is invalid: ${h.maxAge}`);g+="; Max-Age="+h.maxAge}if(h.domain){if(!e.test(h.domain))throw new TypeError(`option domain is invalid: ${h.domain}`);g+="; Domain="+h.domain}if(h.path){if(!d.test(h.path))throw new TypeError(`option path is invalid: ${h.path}`);g+="; Path="+h.path}if(h.expires){if(!n(h.expires)||!Number.isFinite(h.expires.valueOf()))throw new TypeError(`option expires is invalid: ${h.expires}`);g+="; Expires="+h.expires.toUTCString()}if(h.httpOnly&&(g+="; HttpOnly"),h.secure&&(g+="; Secure"),h.partitioned&&(g+="; Partitioned"),h.priority)switch(typeof h.priority=="string"?h.priority.toLowerCase():void 0){case"low":g+="; Priority=Low";break;case"medium":g+="; Priority=Medium";break;case"high":g+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${h.priority}`)}if(h.sameSite)switch(typeof h.sameSite=="string"?h.sameSite.toLowerCase():h.sameSite){case!0:case"strict":g+="; SameSite=Strict";break;case"lax":g+="; SameSite=Lax";break;case"none":g+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${h.sameSite}`)}return g}function s(f){if(f.indexOf("%")===-1)return f;try{return decodeURIComponent(f)}catch{return f}}function n(f){return t.call(f)==="[object Date]"}return Jt}var ji=XA();function JA(){const r=typeof global>"u"?void 0:global.TEST_HAS_DOCUMENT_COOKIE;return typeof r=="boolean"?r:typeof document=="object"&&typeof document.cookie=="string"}function ZA(r){return typeof r=="string"?ji.parse(r):typeof r=="object"&&r!==null?r:{}}function sb(r,o={}){const e=QA(r);if(!o.doNotParse)try{return JSON.parse(e)}catch{}return r}function QA(r){return r&&r[0]==="j"&&r[1]===":"?r.substr(2):r}class r8{constructor(o,e={}){this.changeListeners=[],this.HAS_DOCUMENT_COOKIE=!1,this.update=()=>{if(!this.HAS_DOCUMENT_COOKIE)return;const t=this.cookies;this.cookies=ji.parse(document.cookie),this._checkChanges(t)};const d=typeof document>"u"?"":document.cookie;this.cookies=ZA(o||d),this.defaultSetOptions=e,this.HAS_DOCUMENT_COOKIE=JA()}_emitChange(o){for(let e=0;e<this.changeListeners.length;++e)this.changeListeners[e](o)}_checkChanges(o){new Set(Object.keys(o).concat(Object.keys(this.cookies))).forEach(d=>{o[d]!==this.cookies[d]&&this._emitChange({name:d,value:sb(this.cookies[d])})})}_startPolling(){this.pollingInterval=setInterval(this.update,300)}_stopPolling(){this.pollingInterval&&clearInterval(this.pollingInterval)}get(o,e={}){return e.doNotUpdate||this.update(),sb(this.cookies[o],e)}getAll(o={}){o.doNotUpdate||this.update();const e={};for(let d in this.cookies)e[d]=sb(this.cookies[d],o);return e}set(o,e,d){d?d=Object.assign(Object.assign({},this.defaultSetOptions),d):d=this.defaultSetOptions;const t=typeof e=="string"?e:JSON.stringify(e);this.cookies=Object.assign(Object.assign({},this.cookies),{[o]:t}),this.HAS_DOCUMENT_COOKIE&&(document.cookie=ji.serialize(o,t,d)),this._emitChange({name:o,value:e,options:d})}remove(o,e){const d=e=Object.assign(Object.assign(Object.assign({},this.defaultSetOptions),e),{expires:new Date(1970,1,1,0,0,1),maxAge:0});this.cookies=Object.assign({},this.cookies),delete this.cookies[o],this.HAS_DOCUMENT_COOKIE&&(document.cookie=ji.serialize(o,"",d)),this._emitChange({name:o,value:void 0,options:e})}addChangeListener(o){this.changeListeners.push(o),this.HAS_DOCUMENT_COOKIE&&this.changeListeners.length===1&&(typeof window=="object"&&"cookieStore"in window?window.cookieStore.addEventListener("change",this.update):this._startPolling())}removeChangeListener(o){const e=this.changeListeners.indexOf(o);e>=0&&this.changeListeners.splice(e,1),this.HAS_DOCUMENT_COOKIE&&this.changeListeners.length===0&&(typeof window=="object"&&"cookieStore"in window?window.cookieStore.removeEventListener("change",this.update):this._stopPolling())}removeAllChangeListeners(){for(;this.changeListeners.length>0;)this.removeChangeListener(this.changeListeners[0])}}const nb={clientApiUrl:"https://api.doworks.com/api/client/",clientGraphqlUrl:"https://api.doworks.com/api/client/graphql",serverGraphqlUrl:"https://api.doworks.com/api/crm/graphql"},o8=nb.clientApiUrl,pb=new r8,Ee=Or.create({baseURL:o8});Ee.interceptors.request.use(r=>{const e=(()=>{const l=Object.keys(pb.getAll()).find(i=>i.endsWith("accessToken"));return l?pb.get(l):null})(),d=pb.get("workspaceId");return e&&(r.headers.Authorization=e),d&&(r.headers["x-tenant-id"]=d),r},r=>Promise.reject(r));const e8=async r=>{try{return(await Ee.post(`/workspace/${r.workspaceId}/workflow`,{...r})).data}catch(o){throw console.error("Failed to fetch table column data types:",o),o}},d8=async r=>{try{return(await Ee.put(`/workspace/${r.workspaceId}/workflow`,{...r})).data}catch(o){throw console.error("Failed to fetch table column data types:",o),o}},t8=async r=>{try{return(await Ee.post(`/workspace/${r.workspaceId}/automation`,{...r})).data}catch(o){throw console.error("Failed to fetch table column data types:",o),o}},l8=async r=>{try{return(await Ee.put(`/workspace/${r.workspaceId}/automation/automationAction`,{...r})).data}catch(o){throw console.error("Failed to fetch table column data types:",o),o}},mf=async(r,o)=>{try{return(await Ee.get(`/workspace/${o}/automation/workflowSeg/${r}`)).data}catch(e){throw console.error("Failed to fetch table column data types:",e),e}},i8=async({id:r,isActive:o,workspaceId:e})=>{try{return(await Ee.put(`/workspace/${e}/automation/activetoggle/${r}/${o}`)).data}catch(d){throw console.error("Failed to fetch table column data types:",d),d}},a8=async({id:r,workspaceId:o,selectFieldId:e})=>{try{return(await Ee.delete(`/workspace/${o}/automation/${e}/${r}`)).data}catch(d){throw console.error("Failed to fetch table column data types:",d),d}},w8=async({fieldId:r,workspaceId:o})=>{try{return(await Ee.get(`/workspace/${o}/workflow/${r}`)).data}catch(e){throw console.error("Failed to fetch table column data types:",e),e}},kf=r=>r?.toLowerCase()?.split(/[\s\-_]+/)?.map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" "),b8=(r,o,e=void 0)=>{const d=o.split(".");let t=r;for(const l of d)if(t&&typeof t=="object"&&l in t)t=t[l];else return e;return t},xf=(r,o)=>{const e=r.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(t,l,i,a)=>`#${l}${l}${i}${i}${a}${a}`),d=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return d?`rgba(${parseInt(d[1],16)}, ${parseInt(d[2],16)}, ${parseInt(d[3],16)}, ${o})`:""},gf=(r,o)=>{const e=r.match(/\d+/g);return e?`rgba(${e.join(", ")}, ${o})`:r},fb=r=>{const o=r||"rgb(154, 173, 189)";return o.startsWith("#")?xf(o,.2):gf(o,.2)},We=r=>{const o=r||"rgb(154, 173, 189)";return o.startsWith("#")?xf(o,1):gf(o,1)},cf=({data:r})=>{const[o,e]=F.useState(!1);return k.jsxs("div",{onMouseEnter:()=>e(!0),onMouseLeave:()=>e(!1),style:{backgroundColor:fb(r.color),border:`1px solid ${We(r.color)}`,position:"relative",width:264,height:40,borderRadius:8,display:"flex",alignItems:"center",justifyContent:"center"},children:[k.jsx("p",{style:{color:We(r.color),fontSize:12,fontWeight:400},children:r.label}),k.jsxs("div",{style:{opacity:o?1:0,transition:"opacity 0.2s ease"},children:[k.jsx(Oo,{id:"top-t",type:"target",position:er.Top,style:{width:8,height:8,background:"#a855f7"},onMouseEnter:()=>{}}),k.jsx(Oo,{id:"top-s",type:"source",position:er.Top,style:{width:8,height:8,background:"#a855f7",marginTop:-1}}),k.jsx(Oo,{id:"left-t",type:"target",position:er.Left,style:{width:8,height:8,background:"#a855f7"}}),k.jsx(Oo,{id:"left-s",type:"source",position:er.Left,style:{width:8,height:8,background:"#a855f7",marginLeft:-1}}),k.jsx(Oo,{id:"bottom-t",type:"target",position:er.Bottom,style:{width:8,height:8,background:"#a855f7"}}),k.jsx(Oo,{id:"bottom-s",type:"source",position:er.Bottom,style:{width:8,height:8,background:"#a855f7",marginTop:-1}}),k.jsx(Oo,{id:"right-t",type:"target",position:er.Right,style:{width:8,height:8,background:"#a855f7"}}),k.jsx(Oo,{id:"right-s",type:"source",position:er.Right,style:{width:8,height:8,background:"#a855f7",marginLeft:-1}})]})]})},uf=({id:r,sourceX:o,sourceY:e,targetX:d,targetY:t,sourcePosition:l,targetPosition:i})=>{const[a,w,b]=Gl({sourceX:o,sourceY:e,targetX:d,targetY:t,sourcePosition:l,targetPosition:i,borderRadius:20}),s=`arrow-${r}`;return k.jsxs(k.Fragment,{children:[k.jsx("svg",{width:"0",height:"0",children:k.jsx("defs",{children:k.jsx("marker",{id:s,markerWidth:"10",markerHeight:"10",viewBox:"0 0 10 10",refX:"8",refY:"5",orient:"auto-start-reverse",markerUnits:"strokeWidth",children:k.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"#B475FC"})})})}),k.jsx(vd,{id:r,path:a,markerEnd:`url(#${s})`,style:{stroke:"#B475FC",strokeWidth:1.5}}),k.jsx("foreignObject",{width:18,height:20,x:w-10,y:b-8,children:k.jsx("div",{style:{background:"#fff",border:"1px solid #ccc",borderRadius:"5px",padding:"2px 4px"},className:"d-flex align-center justify-center",children:k.jsx("img",{src:"/vector.svg",alt:"vector",style:{width:10,height:10,display:"block"}})})})]})},s8={customHandle:cf},n8={custom:uf},Ff=({setEdges:r,nodes:o,edges:e,onNodesChange:d,onEdgesChange:t,hasMiniMap:l=!0,hasControls:i=!0,hasGlobalManageAuto:a=!0,isGlobalAuto:w=!1,setIsGlobalAuto:b,updateManageAuto:s,countGlobalAuto:n})=>{const f=F.useCallback(m=>{if(e?.some(c=>c.source===m.source&&c.target===m.target))return;const p=o.find(c=>c.id===m.source),x=o.find(c=>c.id===m.target),g=p?.data?.color||"#000",E=x?.data?.color||"#000",D={...m,id:`reactflow__edge-${m.source}-${m.target}`,type:"custom",source:m.source,target:m.target,data:{sourceLabel:p?.data?.label,targetLabel:x?.data?.label,sourceColor:g,targetColor:E,permission:[],requiredColumns:[],condition:""}};r(c=>J3(D,c))},[e]);return k.jsx("div",{style:{width:"100%",height:"100%",position:"relative",flex:1},children:k.jsxs(gw,{nodes:o,edges:e,nodeTypes:s8,edgeTypes:n8,onNodesChange:d,onEdgesChange:t,onConnect:f,fitView:!0,fitViewOptions:{padding:.4},deleteKeyCode:null,children:[a?k.jsxs("div",{className:"mx-24 my-14 border-solid-input-border h-62px d-flex radius-8 align-center px-16 position-absolute",style:{zIndex:99,width:"calc(100% - 64px)"},children:[k.jsx("div",{className:"w-42px h-46px d-flex align-center justify-center mr-8",children:k.jsx("div",{className:"w-32px h-32px radius-100 bg-blue-lighten9 d-flex align-center justify-center",children:k.jsx("img",{src:"/vector.svg",alt:"vector",width:20,height:20})})}),k.jsxs("div",{className:"flex-1 d-flex align-center justify-between",children:[k.jsxs("div",{children:[k.jsx("p",{className:"f-14 f-w-400 txt-heading l-h-24",children:"Global Automation"}),n?k.jsxs("p",{className:"f-12 f-w-400 txt-sub-heading",children:[n," Automation rule is active"]}):k.jsx("p",{className:"f-12 f-w-400 txt-sub-heading",children:"No automations have been created yet"})]}),k.jsx(dr.Button,{variant:"outlined",color:"inherit",className:"mr-10",onClick:()=>{b&&b(!0),s&&s()},disabled:w,children:n?"Manage":"Create Automation"})]})]}):k.jsx(k.Fragment,{}),l?k.jsx(A5,{}):k.jsx(k.Fragment,{}),i?k.jsx(C5,{}):k.jsx(k.Fragment,{}),k.jsx(R5,{})]})})},p8=({edges:r,setSelectedId:o,saveToBackend:e,setEdges:d})=>k.jsx("div",{style:{top:0,right:0,height:"100%",width:"422px",background:"#fff",borderLeft:"1px solid #ccc"},children:k.jsxs("div",{className:"px-16 py-12 d-flex flex-column edge-container",children:[k.jsxs("div",{children:[k.jsx("div",{className:"h-36px d-flex align-center f-w-600 f-14 txt-darkblue px-8",children:"Configuration"}),k.jsx("div",{className:"border-solid-border1 my-12"})]}),k.jsx("div",{className:"flex-1",children:r?.map(t=>k.jsxs("div",{className:"d-flex h-36px mb-24",children:[k.jsxs("div",{style:{backgroundColor:fb(t.data?.sourceColor),border:`1px solid ${We(t.data?.sourceColor)}`},className:" flex-1 radius-8 px-12 py-6 d-flex justify-between align-center cursor-pointer mr-12 w-300px",onClick:()=>{o({id:t.id,type:"config"})},children:[k.jsx("div",{className:"f-12 f-w-400 mr-20",style:{color:We(t.data?.sourceColor)},children:t?.data?.sourceLabel}),k.jsx("img",{src:"/workflow_east.svg",alt:"arrow",className:""}),k.jsx("div",{className:"f-w-400 f-12",style:{color:We(t.data?.targetColor)},children:t?.data?.targetLabel})]}),k.jsx("div",{className:"w-36px h-36px border-solid-input-border d-flex align-center justify-center cursor-pointer mr-4 radius-6 bg-hover-blue-lighten9",onClick:()=>{o({id:t.id,type:"auto"})},children:k.jsx("img",{src:"/vector.svg",alt:"vector",width:16,height:16})}),k.jsx("div",{className:"w-36px h-36px border-solid-input-border d-flex align-center justify-center cursor-pointer radius-6",onClick:()=>{d(l=>l.filter(i=>i.id!==t?.id))},children:k.jsx("img",{src:"/workflow_delete.svg",alt:"delete",width:16,height:16})})]}))}),k.jsxs("div",{className:"d-flex justify-end",children:[k.jsx(dr.Button,{variant:"outlined",color:"inherit",className:"mr-10",onClick:()=>close(),children:"Cancel"}),k.jsx(dr.Button,{variant:"outlined",color:"primary",onClick:()=>{e()},children:"Update"})]})]})});var Zt={},Af;function f8(){if(Af)return Zt;Af=1;var r=Jo();Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.default=void 0;var o=r(ye()),e=oe();return Zt.default=(0,o.default)((0,e.jsx)("path",{d:"m8.71 11.71 2.59 2.59c.39.39 1.02.39 1.41 0l2.59-2.59c.63-.63.18-1.71-.71-1.71H9.41c-.89 0-1.33 1.08-.7 1.71"}),"ArrowDropDownRounded"),Zt}var h8=f8();const yf=No(h8),Li={"popper-border":"#eaeff4","success-disabled":"#a6aaaf"};var Qt={},Ef;function m8(){if(Ef)return Qt;Ef=1;var r=Jo();Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.default=void 0;var o=r(ye()),e=oe();return Qt.default=(0,o.default)((0,e.jsx)("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Clear"),Qt}var k8=m8();const Df=No(k8);var hb=function(r,o){return hb=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,d){e.__proto__=d}||function(e,d){for(var t in d)Object.prototype.hasOwnProperty.call(d,t)&&(e[t]=d[t])},hb(r,o)};function x8(r,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");hb(r,o);function e(){this.constructor=r}r.prototype=o===null?Object.create(o):(e.prototype=o.prototype,new e)}var Ke=function(){return Ke=Object.assign||function(o){for(var e,d=1,t=arguments.length;d<t;d++){e=arguments[d];for(var l in e)Object.prototype.hasOwnProperty.call(e,l)&&(o[l]=e[l])}return o},Ke.apply(this,arguments)};function g8(r,o){var e={};for(var d in r)Object.prototype.hasOwnProperty.call(r,d)&&o.indexOf(d)<0&&(e[d]=r[d]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var t=0,d=Object.getOwnPropertySymbols(r);t<d.length;t++)o.indexOf(d[t])<0&&Object.prototype.propertyIsEnumerable.call(r,d[t])&&(e[d[t]]=r[d[t]]);return e}function c8(r,o,e,d){function t(l){return l instanceof e?l:new e(function(i){i(l)})}return new(e||(e=Promise))(function(l,i){function a(s){try{b(d.next(s))}catch(n){i(n)}}function w(s){try{b(d.throw(s))}catch(n){i(n)}}function b(s){s.done?l(s.value):t(s.value).then(a,w)}b((d=d.apply(r,o||[])).next())})}function u8(r,o){var e={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},d,t,l,i=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return i.next=a(0),i.throw=a(1),i.return=a(2),typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(b){return function(s){return w([b,s])}}function w(b){if(d)throw new TypeError("Generator is already executing.");for(;i&&(i=0,b[0]&&(e=0)),e;)try{if(d=1,t&&(l=b[0]&2?t.return:b[0]?t.throw||((l=t.return)&&l.call(t),0):t.next)&&!(l=l.call(t,b[1])).done)return l;switch(t=0,l&&(b=[b[0]&2,l.value]),b[0]){case 0:case 1:l=b;break;case 4:return e.label++,{value:b[1],done:!1};case 5:e.label++,t=b[1],b=[0];continue;case 7:b=e.ops.pop(),e.trys.pop();continue;default:if(l=e.trys,!(l=l.length>0&&l[l.length-1])&&(b[0]===6||b[0]===2)){e=0;continue}if(b[0]===3&&(!l||b[1]>l[0]&&b[1]<l[3])){e.label=b[1];break}if(b[0]===6&&e.label<l[1]){e.label=l[1],l=b;break}if(l&&e.label<l[2]){e.label=l[2],e.ops.push(b);break}l[2]&&e.ops.pop(),e.trys.pop();continue}b=o.call(r,e)}catch(s){b=[6,s],t=0}finally{d=l=0}if(b[0]&5)throw b[1];return{value:b[0]?b[1]:void 0,done:!0}}}typeof SuppressedError=="function"&&SuppressedError;var mb="Invariant Violation",vf=Object.setPrototypeOf,F8=vf===void 0?function(r,o){return r.__proto__=o,r}:vf,Bf=function(r){x8(o,r);function o(e){e===void 0&&(e=mb);var d=r.call(this,typeof e=="number"?mb+": "+e+" (see https://github.com/apollographql/invariant-packages)":e)||this;return d.framesToPop=1,d.name=mb,F8(d,o.prototype),d}return o}(Error);function hd(r,o){if(!r)throw new Bf(o)}var Sf=["debug","log","warn","error","silent"],A8=Sf.indexOf("log");function Ui(r){return function(){if(Sf.indexOf(r)>=A8){var o=console[r]||console.log;return o.apply(console,arguments)}}}(function(r){r.debug=Ui("debug"),r.log=Ui("log"),r.warn=Ui("warn"),r.error=Ui("error")})(hd||(hd={}));var Cf="3.14.0";function qd(r){try{return r()}catch{}}const kb=qd(function(){return globalThis})||qd(function(){return window})||qd(function(){return self})||qd(function(){return global})||qd(function(){return qd.constructor("return this")()});var _f=new Map;function y8(r){var o=_f.get(r)||1;return _f.set(r,o+1),"".concat(r,":").concat(o,":").concat(Math.random().toString(36).slice(2))}function E8(r,o){var e=y8("stringifyForDisplay");return JSON.stringify(r,function(d,t){return t===void 0?e:t},o).split(JSON.stringify(e)).join("<undefined>")}function zi(r){return function(o){for(var e=[],d=1;d<arguments.length;d++)e[d-1]=arguments[d];if(typeof o=="number"){var t=o;o=gb(t),o||(o=cb(t,e),e=[])}r.apply(void 0,[o].concat(e))}}var xb=Object.assign(function(o,e){for(var d=[],t=2;t<arguments.length;t++)d[t-2]=arguments[t];o||hd(o,gb(e,d)||cb(e,d))},{debug:zi(hd.debug),log:zi(hd.log),warn:zi(hd.warn),error:zi(hd.error)});function If(r){for(var o=[],e=1;e<arguments.length;e++)o[e-1]=arguments[e];return new Bf(gb(r,o)||cb(r,o))}var Tf=Symbol.for("ApolloErrorMessageHandler_"+Cf);function Nf(r){if(typeof r=="string")return r;try{return E8(r,2).slice(0,1e3)}catch{return"<non-serializable>"}}function gb(r,o){if(o===void 0&&(o=[]),!!r)return kb[Tf]&&kb[Tf](r,o.map(Nf))}function cb(r,o){if(o===void 0&&(o=[]),!!r)return"An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({version:Cf,message:r,args:o.map(Nf)})))}function D8(r){return r.definitions.filter(function(o){return o.kind==="OperationDefinition"&&!!o.name}).map(function(o){return o.name.value})[0]||null}let oo=null;const Pf={};let v8=1;const B8=()=>class{constructor(){this.id=["slot",v8++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let o=oo;o;o=o.parent)if(this.id in o.slots){const e=o.slots[this.id];if(e===Pf)break;return o!==oo&&(oo.slots[this.id]=e),!0}return oo&&(oo.slots[this.id]=Pf),!1}getValue(){if(this.hasValue())return oo.slots[this.id]}withValue(o,e,d,t){const l={__proto__:null,[this.id]:o},i=oo;oo={parent:i,slots:l};try{return e.apply(t,d)}finally{oo=i}}static bind(o){const e=oo;return function(){const d=oo;try{return oo=e,o.apply(this,arguments)}finally{oo=d}}}static noContext(o,e,d){if(oo){const t=oo;try{return oo=null,o.apply(d,e)}finally{oo=t}}else return o.apply(d,e)}};function Rf(r){try{return r()}catch{}}const ub="@wry/context:Slot",Of=Rf(()=>globalThis)||Rf(()=>global)||Object.create(null),Fb=Of[ub]||Array[ub]||function(r){try{Object.defineProperty(Of,ub,{value:r,enumerable:!1,writable:!1,configurable:!0})}finally{return r}}(B8()),{bind:tS,noContext:lS}=Fb;new Fb;function S8(r,o){var e=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(e)return(e=e.call(r)).next.bind(e);if(Array.isArray(r)||(e=C8(r))||o){e&&(r=e);var d=0;return function(){return d>=r.length?{done:!0}:{done:!1,value:r[d++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
151
151
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function C8(r,o){if(r){if(typeof r=="string")return Mf(r,o);var e=Object.prototype.toString.call(r).slice(8,-1);if(e==="Object"&&r.constructor&&(e=r.constructor.name),e==="Map"||e==="Set")return Array.from(r);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return Mf(r,o)}}function Mf(r,o){(o==null||o>r.length)&&(o=r.length);for(var e=0,d=new Array(o);e<o;e++)d[e]=r[e];return d}function $f(r,o){for(var e=0;e<o.length;e++){var d=o[e];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(r,d.key,d)}}function Ab(r,o,e){return o&&$f(r.prototype,o),e&&$f(r,e),Object.defineProperty(r,"prototype",{writable:!1}),r}var yb=function(){return typeof Symbol=="function"},Eb=function(r){return yb()&&!!Symbol[r]},Db=function(r){return Eb(r)?Symbol[r]:"@@"+r};yb()&&!Eb("observable")&&(Symbol.observable=Symbol("observable"));var _8=Db("iterator"),vb=Db("observable"),jf=Db("species");function Vi(r,o){var e=r[o];if(e!=null){if(typeof e!="function")throw new TypeError(e+" is not a function");return e}}function rl(r){var o=r.constructor;return o!==void 0&&(o=o[jf],o===null&&(o=void 0)),o!==void 0?o:ao}function I8(r){return r instanceof ao}function Wd(r){Wd.log?Wd.log(r):setTimeout(function(){throw r})}function Hi(r){Promise.resolve().then(function(){try{r()}catch(o){Wd(o)}})}function Lf(r){var o=r._cleanup;if(o!==void 0&&(r._cleanup=void 0,!!o))try{if(typeof o=="function")o();else{var e=Vi(o,"unsubscribe");e&&e.call(o)}}catch(d){Wd(d)}}function Bb(r){r._observer=void 0,r._queue=void 0,r._state="closed"}function T8(r){var o=r._queue;if(o){r._queue=void 0,r._state="ready";for(var e=0;e<o.length&&(Uf(r,o[e].type,o[e].value),r._state!=="closed");++e);}}function Uf(r,o,e){r._state="running";var d=r._observer;try{var t=Vi(d,o);switch(o){case"next":t&&t.call(d,e);break;case"error":if(Bb(r),t)t.call(d,e);else throw e;break;case"complete":Bb(r),t&&t.call(d);break}}catch(l){Wd(l)}r._state==="closed"?Lf(r):r._state==="running"&&(r._state="ready")}function Sb(r,o,e){if(r._state!=="closed"){if(r._state==="buffering"){r._queue.push({type:o,value:e});return}if(r._state!=="ready"){r._state="buffering",r._queue=[{type:o,value:e}],Hi(function(){return T8(r)});return}Uf(r,o,e)}}var N8=function(){function r(e,d){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";var t=new P8(this);try{this._cleanup=d.call(void 0,t)}catch(l){t.error(l)}this._state==="initializing"&&(this._state="ready")}var o=r.prototype;return o.unsubscribe=function(){this._state!=="closed"&&(Bb(this),Lf(this))},Ab(r,[{key:"closed",get:function(){return this._state==="closed"}}]),r}(),P8=function(){function r(e){this._subscription=e}var o=r.prototype;return o.next=function(d){Sb(this._subscription,"next",d)},o.error=function(d){Sb(this._subscription,"error",d)},o.complete=function(){Sb(this._subscription,"complete")},Ab(r,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),r}(),ao=function(){function r(e){if(!(this instanceof r))throw new TypeError("Observable cannot be called as a function");if(typeof e!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=e}var o=r.prototype;return o.subscribe=function(d){return(typeof d!="object"||d===null)&&(d={next:d,error:arguments[1],complete:arguments[2]}),new N8(d,this._subscriber)},o.forEach=function(d){var t=this;return new Promise(function(l,i){if(typeof d!="function"){i(new TypeError(d+" is not a function"));return}function a(){w.unsubscribe(),l()}var w=t.subscribe({next:function(b){try{d(b,a)}catch(s){i(s),w.unsubscribe()}},error:i,complete:l})})},o.map=function(d){var t=this;if(typeof d!="function")throw new TypeError(d+" is not a function");var l=rl(this);return new l(function(i){return t.subscribe({next:function(a){try{a=d(a)}catch(w){return i.error(w)}i.next(a)},error:function(a){i.error(a)},complete:function(){i.complete()}})})},o.filter=function(d){var t=this;if(typeof d!="function")throw new TypeError(d+" is not a function");var l=rl(this);return new l(function(i){return t.subscribe({next:function(a){try{if(!d(a))return}catch(w){return i.error(w)}i.next(a)},error:function(a){i.error(a)},complete:function(){i.complete()}})})},o.reduce=function(d){var t=this;if(typeof d!="function")throw new TypeError(d+" is not a function");var l=rl(this),i=arguments.length>1,a=!1,w=arguments[1],b=w;return new l(function(s){return t.subscribe({next:function(n){var f=!a;if(a=!0,!f||i)try{b=d(b,n)}catch(m){return s.error(m)}else b=n},error:function(n){s.error(n)},complete:function(){if(!a&&!i)return s.error(new TypeError("Cannot reduce an empty sequence"));s.next(b),s.complete()}})})},o.concat=function(){for(var d=this,t=arguments.length,l=new Array(t),i=0;i<t;i++)l[i]=arguments[i];var a=rl(this);return new a(function(w){var b,s=0;function n(f){b=f.subscribe({next:function(m){w.next(m)},error:function(m){w.error(m)},complete:function(){s===l.length?(b=void 0,w.complete()):n(a.from(l[s++]))}})}return n(d),function(){b&&(b.unsubscribe(),b=void 0)}})},o.flatMap=function(d){var t=this;if(typeof d!="function")throw new TypeError(d+" is not a function");var l=rl(this);return new l(function(i){var a=[],w=t.subscribe({next:function(s){if(d)try{s=d(s)}catch(f){return i.error(f)}var n=l.from(s).subscribe({next:function(f){i.next(f)},error:function(f){i.error(f)},complete:function(){var f=a.indexOf(n);f>=0&&a.splice(f,1),b()}});a.push(n)},error:function(s){i.error(s)},complete:function(){b()}});function b(){w.closed&&a.length===0&&i.complete()}return function(){a.forEach(function(s){return s.unsubscribe()}),w.unsubscribe()}})},o[vb]=function(){return this},r.from=function(d){var t=typeof this=="function"?this:r;if(d==null)throw new TypeError(d+" is not an object");var l=Vi(d,vb);if(l){var i=l.call(d);if(Object(i)!==i)throw new TypeError(i+" is not an object");return I8(i)&&i.constructor===t?i:new t(function(a){return i.subscribe(a)})}if(Eb("iterator")&&(l=Vi(d,_8),l))return new t(function(a){Hi(function(){if(!a.closed){for(var w=S8(l.call(d)),b;!(b=w()).done;){var s=b.value;if(a.next(s),a.closed)return}a.complete()}})});if(Array.isArray(d))return new t(function(a){Hi(function(){if(!a.closed){for(var w=0;w<d.length;++w)if(a.next(d[w]),a.closed)return;a.complete()}})});throw new TypeError(d+" is not observable")},r.of=function(){for(var d=arguments.length,t=new Array(d),l=0;l<d;l++)t[l]=arguments[l];var i=typeof this=="function"?this:r;return new i(function(a){Hi(function(){if(!a.closed){for(var w=0;w<t.length;++w)if(a.next(t[w]),a.closed)return;a.complete()}})})},Ab(r,null,[{key:jf,get:function(){return this}}]),r}();yb()&&Object.defineProperty(ao,Symbol("extensions"),{value:{symbol:vb,hostReportError:Wd},configurable:!0});function R8(r){var o,e=r.Symbol;if(typeof e=="function")if(e.observable)o=e.observable;else{typeof e.for=="function"?o=e.for("https://github.com/benlesh/symbol-observable"):o=e("https://github.com/benlesh/symbol-observable");try{e.observable=o}catch{}}else o="@@observable";return o}var Kd;typeof self<"u"?Kd=self:typeof window<"u"?Kd=window:typeof global<"u"?Kd=global:typeof module<"u"?Kd=module:Kd=Function("return this")(),R8(Kd);var zf=ao.prototype,Vf="@@observable";zf[Vf]||(zf[Vf]=function(){return this});function O8(r){for(var o=["query","operationName","variables","extensions","context"],e=0,d=Object.keys(r);e<d.length;e++){var t=d[e];if(o.indexOf(t)<0)throw If(58,t)}return r}function M8(r,o){var e=Ke({},r),d=function(l){typeof l=="function"?e=Ke(Ke({},e),l(e)):e=Ke(Ke({},e),l)},t=function(){return Ke({},e)};return Object.defineProperty(o,"setContext",{enumerable:!1,value:d}),Object.defineProperty(o,"getContext",{enumerable:!1,value:t}),o}function $8(r){var o={variables:r.variables||{},extensions:r.extensions||{},operationName:r.operationName,query:r.query};return o.operationName||(o.operationName=typeof o.query!="string"?D8(o.query)||void 0:""),o}var j8=Symbol.for("apollo.deprecations"),L8=kb,U8=new Fb;function z8(r){return L8[j8]||(U8.getValue()||[]).includes(r)}function V8(r,o){z8(r)||o()}function Hf(r,o){return o?o(r):ao.of()}function ol(r){return typeof r=="function"?new qf(r):r}function qi(r){return r.request.length<=1}var qf=function(){function r(o){o&&(this.request=o)}return r.empty=function(){return new r(function(){return ao.of()})},r.from=function(o){return o.length===0?r.empty():o.map(ol).reduce(function(e,d){return e.concat(d)})},r.split=function(o,e,d){var t=ol(e),l=ol(d||new r(Hf)),i;return qi(t)&&qi(l)?i=new r(function(a){return o(a)?t.request(a)||ao.of():l.request(a)||ao.of()}):i=new r(function(a,w){return o(a)?t.request(a,w)||ao.of():l.request(a,w)||ao.of()}),Object.assign(i,{left:t,right:l})},r.execute=function(o,e){return o.request(M8(e.context,$8(O8(e))))||ao.of()},r.concat=function(o,e){var d=ol(o);if(qi(d))return globalThis.__DEV__!==!1&&xb.warn(47,d),d;var t=ol(e),l;return qi(t)?l=new r(function(i){return d.request(i,function(a){return t.request(a)||ao.of()})||ao.of()}):l=new r(function(i,a){return d.request(i,function(w){return t.request(w,a)||ao.of()})||ao.of()}),Object.assign(l,{left:d,right:t})},r.prototype.split=function(o,e,d){return this.concat(r.split(o,e,d||new r(Hf)))},r.prototype.concat=function(o){return r.concat(this,o)},r.prototype.request=function(o,e){throw If(48)},r.prototype.onError=function(o,e){if(globalThis.__DEV__!==!1&&V8("onError",function(){globalThis.__DEV__!==!1&&xb.warn(49)}),e&&e.error)return e.error(o),!1;throw o},r.prototype.setOnError=function(o){return globalThis.__DEV__!==!1&&globalThis.__DEV__!==!1&&xb.warn(50),this.onError=o,this},r}();function H8(r){return new qf(function(o,e){var d=g8(o,[]);return new ao(function(t){var l,i=!1;return Promise.resolve(d).then(function(a){return r(a,o.getContext())}).then(o.setContext).then(function(){i||(l=e(o).subscribe({next:t.next.bind(t),error:t.error.bind(t),complete:t.complete.bind(t)}))}).catch(t.error.bind(t)),function(){i=!0,l&&l.unsubscribe()}})})}/*! js-cookie v3.0.5 | MIT */function Wi(r){for(var o=1;o<arguments.length;o++){var e=arguments[o];for(var d in e)r[d]=e[d]}return r}var q8={read:function(r){return r[0]==='"'&&(r=r.slice(1,-1)),r.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(r){return encodeURIComponent(r).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function Cb(r,o){function e(t,l,i){if(!(typeof document>"u")){i=Wi({},o,i),typeof i.expires=="number"&&(i.expires=new Date(Date.now()+i.expires*864e5)),i.expires&&(i.expires=i.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var a="";for(var w in i)i[w]&&(a+="; "+w,i[w]!==!0&&(a+="="+i[w].split(";")[0]));return document.cookie=t+"="+r.write(l,t)+a}}function d(t){if(!(typeof document>"u"||arguments.length&&!t)){for(var l=document.cookie?document.cookie.split("; "):[],i={},a=0;a<l.length;a++){var w=l[a].split("="),b=w.slice(1).join("=");try{var s=decodeURIComponent(w[0]);if(i[s]=r.read(b,s),t===s)break}catch{}}return t?i[t]:i}}return Object.create({set:e,get:d,remove:function(t,l){e(t,"",Wi({},l,{expires:-1}))},withAttributes:function(t){return Cb(this.converter,Wi({},this.attributes,t))},withConverter:function(t){return Cb(Wi({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(o)},converter:{value:Object.freeze(r)}})}var el=Cb(q8,{path:"/"});const md={NOTIFY:"notify",UPDATE_FIELD:"update_field",MOVE_RECORD:"move_record",COPY_RECORD_TO_OTHER_WORKSPACE:"copy_record_to_other_workspace",meeting:"meeting",task:"task"},Ki={Config:"config",Auto:"auto"},W8={login:"/auth/login"},Wf={workspaceId:"workspaceId"},K8="Logging",Y8="NoHubcallbackProvidedException";var Do;(function(r){r.DEBUG="DEBUG",r.ERROR="ERROR",r.INFO="INFO",r.WARN="WARN",r.VERBOSE="VERBOSE",r.NONE="NONE"})(Do||(Do={}));const Kf={VERBOSE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5,NONE:6};class vo{constructor(o,e=Do.WARN){this.name=o,this.level=e,this._pluggables=[]}_padding(o){return o<10?"0"+o:""+o}_ts(){const o=new Date;return[this._padding(o.getMinutes()),this._padding(o.getSeconds())].join(":")+"."+o.getMilliseconds()}configure(o){return o?(this._config=o,this._config):this._config}_log(o,...e){let d=this.level;vo.LOG_LEVEL&&(d=vo.LOG_LEVEL),typeof window<"u"&&window.LOG_LEVEL&&(d=window.LOG_LEVEL);const t=Kf[d];if(!(Kf[o]>=t))return;let i=console.log.bind(console);o===Do.ERROR&&console.error&&(i=console.error.bind(console)),o===Do.WARN&&console.warn&&(i=console.warn.bind(console)),vo.BIND_ALL_LOG_LEVELS&&(o===Do.INFO&&console.info&&(i=console.info.bind(console)),o===Do.DEBUG&&console.debug&&(i=console.debug.bind(console)));const a=`[${o}] ${this._ts()} ${this.name}`;let w="";if(e.length===1&&typeof e[0]=="string")w=`${a} - ${e[0]}`,i(w);else if(e.length===1)w=`${a} ${e[0]}`,i(a,e[0]);else if(typeof e[0]=="string"){let b=e.slice(1);b.length===1&&(b=b[0]),w=`${a} - ${e[0]} ${b}`,i(`${a} - ${e[0]}`,b)}else w=`${a} ${e}`,i(a,e);for(const b of this._pluggables){const s={message:w,timestamp:Date.now()};b.pushLogs([s])}}log(...o){this._log(Do.INFO,...o)}info(...o){this._log(Do.INFO,...o)}warn(...o){this._log(Do.WARN,...o)}error(...o){this._log(Do.ERROR,...o)}debug(...o){this._log(Do.DEBUG,...o)}verbose(...o){this._log(Do.VERBOSE,...o)}addPluggable(o){o&&o.getCategoryName()===K8&&(this._pluggables.push(o),o.configure(this._config))}listPluggables(){return this._pluggables}}vo.LOG_LEVEL=null,vo.BIND_ALL_LOG_LEVELS=!1;class xo extends Error{constructor({message:o,name:e,recoverySuggestion:d,underlyingError:t,metadata:l}){if(super(o),this.name=e,this.underlyingError=t,this.recoverySuggestion=d,l){const{extendedRequestId:i,httpStatusCode:a,requestId:w}=l;this.metadata={extendedRequestId:i,httpStatusCode:a,requestId:w}}this.constructor=xo,Object.setPrototypeOf(this,xo.prototype)}}var Ye;(function(r){r.NoEndpointId="NoEndpointId",r.PlatformNotSupported="PlatformNotSupported",r.Unknown="Unknown",r.NetworkError="NetworkError"})(Ye||(Ye={}));const _b=(r,o=xo)=>(e,d,t)=>{const{message:l,recoverySuggestion:i}=r[d];if(!e)throw new o({name:d,message:t?`${l} ${t}`:l,recoverySuggestion:i})},kd=typeof Symbol<"u"?Symbol("amplify_default"):"@@amplify_default",dl=new vo("Hub");class Yf{constructor(o){this.listeners=new Map,this.protectedChannels=["core","auth","api","analytics","interactions","pubsub","storage","ui","xr"],this.name=o}_remove(o,e){const d=this.listeners.get(o);if(!d){dl.warn(`No listeners for ${o}`);return}this.listeners.set(o,[...d.filter(({callback:t})=>t!==e)])}dispatch(o,e,d,t){typeof o=="string"&&this.protectedChannels.indexOf(o)>-1&&(t===kd||dl.warn(`WARNING: ${o} is protected and dispatching on it can have unintended consequences`));const l={channel:o,payload:{...e},source:d,patternInfo:[]};try{this._toListeners(l)}catch(i){dl.error(i)}}listen(o,e,d="noname"){let t;if(typeof e!="function")throw new xo({name:Y8,message:"No callback supplied to Hub"});t=e;let l=this.listeners.get(o);return l||(l=[],this.listeners.set(o,l)),l.push({name:d,callback:t}),()=>{this._remove(o,t)}}_toListeners(o){const{channel:e,payload:d}=o,t=this.listeners.get(e);t&&t.forEach(l=>{dl.debug(`Dispatching to ${e} with `,d);try{l.callback(o)}catch(i){dl.error(i)}})}}const Yd=new Yf("__default__"),Yi=new Yf("internal-hub"),G8=()=>{if(typeof window=="object"&&typeof window.crypto=="object")return window.crypto;if(typeof crypto=="object")return crypto;throw new xo({name:"MissingPolyfill",message:"Cannot resolve the `crypto` function from the environment."})},X8=()=>{if(typeof window<"u"&&typeof window.btoa=="function")return window.btoa;if(typeof btoa=="function")return btoa;throw new xo({name:"Base64EncoderError",message:"Cannot resolve the `btoa` function from the environment."})},J8=()=>{if(typeof window<"u"&&typeof window.atob=="function")return window.atob;if(typeof atob=="function")return atob;throw new xo({name:"Base64EncoderError",message:"Cannot resolve the `atob` function from the environment."})},Ib={convert(r,o){let e=r;return o?.urlSafe&&(e=e.replace(/-/g,"+").replace(/_/g,"/")),J8()(e)}};var be;(function(r){r.AuthTokenConfigException="AuthTokenConfigException",r.AuthUserPoolAndIdentityPoolException="AuthUserPoolAndIdentityPoolException",r.AuthUserPoolException="AuthUserPoolException",r.InvalidIdentityPoolIdException="InvalidIdentityPoolIdException",r.OAuthNotConfigureException="OAuthNotConfigureException"})(be||(be={}));const Z8={[be.AuthTokenConfigException]:{message:"Auth Token Provider not configured.",recoverySuggestion:"Make sure to call Amplify.configure in your app."},[be.AuthUserPoolAndIdentityPoolException]:{message:"Auth UserPool or IdentityPool not configured.",recoverySuggestion:"Make sure to call Amplify.configure in your app with UserPoolId and IdentityPoolId."},[be.AuthUserPoolException]:{message:"Auth UserPool not configured.",recoverySuggestion:"Make sure to call Amplify.configure in your app with userPoolId and userPoolClientId."},[be.InvalidIdentityPoolIdException]:{message:"Invalid identity pool id provided.",recoverySuggestion:"Make sure a valid identityPoolId is given in the config."},[be.OAuthNotConfigureException]:{message:"oauth param not configured.",recoverySuggestion:"Make sure to call Amplify.configure with oauth parameter in your app."}},Tb=_b(Z8);function Br(r){let o=!0;r?o=!!r.userPoolId&&!!r.userPoolClientId:o=!1,Tb(o,be.AuthUserPoolException)}function Gf(r){const o=!!r?.loginWith?.oauth?.domain&&!!r?.loginWith?.oauth?.redirectSignOut&&!!r?.loginWith?.oauth?.redirectSignIn&&!!r?.loginWith?.oauth?.responseType;Tb(o,be.OAuthNotConfigureException)}function Gi(r){const o=!!r?.identityPoolId;Tb(o,be.InvalidIdentityPoolIdException)}function xd(r){const o=r.split(".");if(o.length!==3)throw new Error("Invalid token");try{const d=o[1].replace(/-/g,"+").replace(/_/g,"/"),t=decodeURIComponent(Ib.convert(d).split("").map(i=>`%${`00${i.charCodeAt(0).toString(16)}`.slice(-2)}`).join("")),l=JSON.parse(t);return{toString:()=>r,payload:l}}catch{throw new Error("Invalid token payload")}}const Xf=r=>{const o=Reflect.ownKeys(r);for(const e of o){const d=r[e];(d&&typeof d=="object"||typeof d=="function")&&Xf(d)}return Object.freeze(r)},Q8=new vo("parseAWSExports"),ry={API_KEY:"apiKey",AWS_IAM:"iam",AMAZON_COGNITO_USER_POOLS:"userPool",OPENID_CONNECT:"oidc",NONE:"none",AWS_LAMBDA:"lambda",LAMBDA:"lambda"},oy=(r={})=>{if(!Object.prototype.hasOwnProperty.call(r,"aws_project_region"))throw new xo({name:"InvalidParameterException",message:"Invalid config parameter.",recoverySuggestion:"Ensure passing the config object imported from `amplifyconfiguration.json`."});const{aws_appsync_apiKey:o,aws_appsync_authenticationType:e,aws_appsync_graphqlEndpoint:d,aws_appsync_region:t,aws_bots_config:l,aws_cognito_identity_pool_id:i,aws_cognito_sign_up_verification_method:a,aws_cognito_mfa_configuration:w,aws_cognito_mfa_types:b,aws_cognito_password_protection_settings:s,aws_cognito_verification_mechanisms:n,aws_cognito_signup_attributes:f,aws_cognito_social_providers:m,aws_cognito_username_attributes:h,aws_mandatory_sign_in:p,aws_mobile_analytics_app_id:x,aws_mobile_analytics_app_region:g,aws_user_files_s3_bucket:E,aws_user_files_s3_bucket_region:D,aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing:c,aws_user_pools_id:u,aws_user_pools_web_client_id:B,geo:A,oauth:v,predictions:S,aws_cloud_logic_custom:T,Notifications:O,modelIntrospection:H}=r,R={};x&&(R.Analytics={Pinpoint:{appId:x,region:g}});const{InAppMessaging:y,Push:$}=O??{};if(y?.AWSPinpoint||$?.AWSPinpoint){if(y?.AWSPinpoint){const{appId:U,region:W}=y.AWSPinpoint;R.Notifications={InAppMessaging:{Pinpoint:{appId:U,region:W}}}}if($?.AWSPinpoint){const{appId:U,region:W}=$.AWSPinpoint;R.Notifications={...R.Notifications,PushNotification:{Pinpoint:{appId:U,region:W}}}}}if(Array.isArray(l)&&(R.Interactions={LexV1:Object.fromEntries(l.map(U=>[U.name,U]))}),d){const U=ry[e];U||Q8.debug(`Invalid authentication type ${e}. Falling back to IAM.`),R.API={GraphQL:{endpoint:d,apiKey:o,region:t,defaultAuthMode:U??"iam"}},H&&(R.API.GraphQL.modelIntrospection=H)}const I=w?{status:w&&w.toLowerCase(),totpEnabled:b?.includes("TOTP")??!1,smsEnabled:b?.includes("SMS")??!1}:void 0,M=s?{minLength:s.passwordPolicyMinLength,requireLowercase:s.passwordPolicyCharacters?.includes("REQUIRES_LOWERCASE")??!1,requireUppercase:s.passwordPolicyCharacters?.includes("REQUIRES_UPPERCASE")??!1,requireNumbers:s.passwordPolicyCharacters?.includes("REQUIRES_NUMBERS")??!1,requireSpecialCharacters:s.passwordPolicyCharacters?.includes("REQUIRES_SYMBOLS")??!1}:void 0,N=Array.from(new Set([...n??[],...f??[]])).reduce((U,W)=>({...U,[W.toLowerCase()]:{required:!0}}),{}),C=h?.includes("EMAIL")??!1,P=h?.includes("PHONE_NUMBER")??!1;(i||u)&&(R.Auth={Cognito:{identityPoolId:i,allowGuestAccess:p!=="enable",signUpVerificationMethod:a,userAttributes:N,userPoolClientId:B,userPoolId:u,mfa:I,passwordFormat:M,loginWith:{username:!(C||P),email:C,phone:P}}});const V=v?Object.keys(v).length>0:!1,q=m?m.length>0:!1;if(R.Auth&&V&&(R.Auth.Cognito.loginWith={...R.Auth.Cognito.loginWith,oauth:{...ey(v),...q&&{providers:dy(m)}}}),E&&(R.Storage={S3:{bucket:E,region:D,dangerouslyConnectToHttpEndpointForTesting:c}}),A){const{amazon_location_service:U}=A;R.Geo={LocationService:{maps:U.maps,geofenceCollections:U.geofenceCollections,searchIndices:U.search_indices,region:U.region}}}if(T&&(R.API={...R.API,REST:T.reduce((U,W)=>{const{name:Y,endpoint:X,region:G,service:Z}=W;return{...U,[Y]:{endpoint:X,...Z?{service:Z}:void 0,...G?{region:G}:void 0}}},{})}),S){const{VoiceId:U}=S?.convert?.speechGenerator?.defaults??{};R.Predictions=U?{...S,convert:{...S.convert,speechGenerator:{...S.convert.speechGenerator,defaults:{voiceId:U}}}}:S}return R},Jf=r=>r?.split(",")??[],ey=({domain:r,scope:o,redirectSignIn:e,redirectSignOut:d,responseType:t})=>({domain:r,scopes:o,redirectSignIn:Jf(e),redirectSignOut:Jf(d),responseType:t}),dy=r=>r.map(o=>{const e=o.toLowerCase();return e.charAt(0).toUpperCase()+e.slice(1)}),ty=Symbol("oauth-listener"),eo=[];for(let r=0;r<256;++r)eo.push((r+256).toString(16).slice(1));function ly(r,o=0){return(eo[r[o+0]]+eo[r[o+1]]+eo[r[o+2]]+eo[r[o+3]]+"-"+eo[r[o+4]]+eo[r[o+5]]+"-"+eo[r[o+6]]+eo[r[o+7]]+"-"+eo[r[o+8]]+eo[r[o+9]]+"-"+eo[r[o+10]]+eo[r[o+11]]+eo[r[o+12]]+eo[r[o+13]]+eo[r[o+14]]+eo[r[o+15]]).toLowerCase()}let Nb;const iy=new Uint8Array(16);function ay(){if(!Nb){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Nb=crypto.getRandomValues.bind(crypto)}return Nb(iy)}const Zf={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function wy(r,o,e){if(Zf.randomUUID&&!o&&!r)return Zf.randomUUID();r=r||{};const d=r.random??r.rng?.()??ay();if(d.length<16)throw new Error("Random bytes length must be >= 16");if(d[6]=d[6]&15|64,d[8]=d[8]&63|128,o){if(e=e||0,e<0||e+16>o.length)throw new RangeError(`UUID byte range ${e}:${e+15} is out of buffer bounds`);for(let t=0;t<16;++t)o[e+t]=d[t];return o}return ly(d)}function by(r){const{version:o}=r;return o?o.startsWith("1"):!1}function sy(r){if(!r)return;const{bucket_name:o,aws_region:e,buckets:d}=r;return{S3:{bucket:o,region:e,buckets:d&&Fy(d)}}}function ny(r){if(!r)return;const{user_pool_id:o,user_pool_client_id:e,identity_pool_id:d,password_policy:t,mfa_configuration:l,mfa_methods:i,unauthenticated_identities_enabled:a,oauth:w,username_attributes:b,standard_required_attributes:s,groups:n}=r,f={Cognito:{userPoolId:o,userPoolClientId:e,groups:n}};return d&&(f.Cognito={...f.Cognito,identityPoolId:d}),t&&(f.Cognito.passwordFormat={requireLowercase:t.require_lowercase,requireNumbers:t.require_numbers,requireUppercase:t.require_uppercase,requireSpecialCharacters:t.require_symbols,minLength:t.min_length??6}),l&&(f.Cognito.mfa={status:uy(l),smsEnabled:i?.includes("SMS"),totpEnabled:i?.includes("TOTP")}),a&&(f.Cognito.allowGuestAccess=a),w&&(f.Cognito.loginWith={oauth:{domain:w.domain,redirectSignIn:w.redirect_sign_in_uri,redirectSignOut:w.redirect_sign_out_uri,responseType:w.response_type==="token"?"token":"code",scopes:w.scopes,providers:cy(w.identity_providers)}}),b&&(f.Cognito.loginWith={...f.Cognito.loginWith,email:b.includes("email"),phone:b.includes("phone_number"),username:b.includes("username")}),s&&(f.Cognito.userAttributes=s.reduce((m,h)=>({...m,[h]:{required:!0}}),{})),f}function py(r){if(!r?.amazon_pinpoint)return;const{amazon_pinpoint:o}=r;return{Pinpoint:{appId:o.app_id,region:o.aws_region}}}function fy(r){if(!r)return;const{aws_region:o,geofence_collections:e,maps:d,search_indices:t}=r;return{LocationService:{region:o,searchIndices:t,geofenceCollections:e,maps:d}}}function hy(r){if(!r)return;const{aws_region:o,default_authorization_type:e,url:d,api_key:t,model_introspection:l}=r;return{GraphQL:{endpoint:d,defaultAuthMode:Qf(e),region:o,apiKey:t,modelIntrospection:l}}}function my(r){if(!r?.events)return;const{url:o,aws_region:e,api_key:d,default_authorization_type:t}=r.events;return{Events:{endpoint:o,defaultAuthMode:Qf(t),region:e,apiKey:d}}}function ky(r){if(!r)return;const{aws_region:o,channels:e,amazon_pinpoint_app_id:d}=r,t=e.includes("IN_APP_MESSAGING"),l=e.includes("APNS")||e.includes("FCM");if(!(t||l))return;const i={};return t&&(i.InAppMessaging={Pinpoint:{appId:d,region:o}}),l&&(i.PushNotification={Pinpoint:{appId:d,region:o}}),i}function xy(r){const o={};if(r.storage&&(o.Storage=sy(r.storage)),r.auth&&(o.Auth=ny(r.auth)),r.analytics&&(o.Analytics=py(r.analytics)),r.geo&&(o.Geo=fy(r.geo)),r.data&&(o.API=hy(r.data)),r.custom){const e=my(r.custom);e&&"Events"in e&&(o.API={...o.API,...e})}return r.notifications&&(o.Notifications=ky(r.notifications)),o}const gy={AMAZON_COGNITO_USER_POOLS:"userPool",API_KEY:"apiKey",AWS_IAM:"iam",AWS_LAMBDA:"lambda",OPENID_CONNECT:"oidc"};function Qf(r){return gy[r]}const rh={GOOGLE:"Google",LOGIN_WITH_AMAZON:"Amazon",FACEBOOK:"Facebook",SIGN_IN_WITH_APPLE:"Apple"};function cy(r=[]){return r.reduce((o,e)=>(rh[e]!==void 0&&o.push(rh[e]),o),[])}function uy(r){return r==="OPTIONAL"?"optional":r==="REQUIRED"?"on":"off"}function Fy(r){const o={};return r.forEach(({name:e,bucket_name:d,aws_region:t,paths:l})=>{if(e in o)throw new Error(`Duplicate friendly name found: ${e}. Name must be unique.`);const i=l?Object.entries(l).reduce((a,[w,b])=>(b!==void 0&&(a[w]=b),a),{}):void 0;o[e]={bucketName:d,region:t,paths:i}}),o}const oh=r=>Object.keys(r).some(o=>o.startsWith("aws_"))?oy(r):by(r)?xy(r):r;var jo=64,Ay=32,yy=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ey=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],Dy=Math.pow(2,53)-1,Xi=function(){function r(){this.state=Int32Array.from(Ey),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return r.prototype.update=function(o){if(this.finished)throw new Error("Attempted to update an already finished hash.");var e=0,d=o.byteLength;if(this.bytesHashed+=d,this.bytesHashed*8>Dy)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;d>0;)this.buffer[this.bufferLength++]=o[e++],d--,this.bufferLength===jo&&(this.hashBuffer(),this.bufferLength=0)},r.prototype.digest=function(){if(!this.finished){var o=this.bytesHashed*8,e=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),d=this.bufferLength;if(e.setUint8(this.bufferLength++,128),d%jo>=jo-8){for(var t=this.bufferLength;t<jo;t++)e.setUint8(t,0);this.hashBuffer(),this.bufferLength=0}for(var t=this.bufferLength;t<jo-8;t++)e.setUint8(t,0);e.setUint32(jo-8,Math.floor(o/4294967296),!0),e.setUint32(jo-4,o),this.hashBuffer(),this.finished=!0}for(var l=new Uint8Array(Ay),t=0;t<8;t++)l[t*4]=this.state[t]>>>24&255,l[t*4+1]=this.state[t]>>>16&255,l[t*4+2]=this.state[t]>>>8&255,l[t*4+3]=this.state[t]>>>0&255;return l},r.prototype.hashBuffer=function(){for(var o=this,e=o.buffer,d=o.state,t=d[0],l=d[1],i=d[2],a=d[3],w=d[4],b=d[5],s=d[6],n=d[7],f=0;f<jo;f++){if(f<16)this.temp[f]=(e[f*4]&255)<<24|(e[f*4+1]&255)<<16|(e[f*4+2]&255)<<8|e[f*4+3]&255;else{var m=this.temp[f-2],h=(m>>>17|m<<15)^(m>>>19|m<<13)^m>>>10;m=this.temp[f-15];var p=(m>>>7|m<<25)^(m>>>18|m<<14)^m>>>3;this.temp[f]=(h+this.temp[f-7]|0)+(p+this.temp[f-16]|0)}var x=(((w>>>6|w<<26)^(w>>>11|w<<21)^(w>>>25|w<<7))+(w&b^~w&s)|0)+(n+(yy[f]+this.temp[f]|0)|0)|0,g=((t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10))+(t&l^t&i^l&i)|0;n=s,s=b,b=w,w=a+x|0,a=i,i=l,l=t,t=x+g|0}d[0]+=t,d[1]+=l,d[2]+=i,d[3]+=a,d[4]+=w,d[5]+=b,d[6]+=s,d[7]+=n},r}();const vy=r=>new TextEncoder().encode(r);var By=typeof Buffer<"u"&&Buffer.from?function(r){return Buffer.from(r,"utf8")}:vy;function eh(r){return r instanceof Uint8Array?r:typeof r=="string"?By(r):ArrayBuffer.isView(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(r)}function Sy(r){return typeof r=="string"?r.length===0:r.byteLength===0}var Ji=function(){function r(o){this.secret=o,this.hash=new Xi,this.reset()}return r.prototype.update=function(o){if(!(Sy(o)||this.error))try{this.hash.update(eh(o))}catch(e){this.error=e}},r.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},r.prototype.digest=function(){return c8(this,void 0,void 0,function(){return u8(this,function(o){return[2,this.digestSync()]})})},r.prototype.reset=function(){if(this.hash=new Xi,this.secret){this.outer=new Xi;var o=Cy(this.secret),e=new Uint8Array(jo);e.set(o);for(var d=0;d<jo;d++)o[d]^=54,e[d]^=92;this.hash.update(o),this.outer.update(e);for(var d=0;d<o.byteLength;d++)o[d]=0}},r}();function Cy(r){var o=eh(r);if(o.byteLength>jo){var e=new Xi;e.update(o),o=e.digest()}var d=new Uint8Array(jo);return d.set(o),d}for(let r=0;r<256;r++){let o=r.toString(16).toLowerCase();o.length===1&&(o=`0${o}`)}var Wr;(function(r){r.WebUnknown="0",r.React="1",r.NextJs="2",r.Angular="3",r.VueJs="4",r.Nuxt="5",r.Svelte="6",r.ServerSideUnknown="100",r.ReactSSR="101",r.NextJsSSR="102",r.AngularSSR="103",r.VueJsSSR="104",r.NuxtSSR="105",r.SvelteSSR="106",r.ReactNative="201",r.Expo="202"})(Wr||(Wr={}));var Pb;(function(r){r.AI="ai",r.API="api",r.Auth="auth",r.Analytics="analytics",r.DataStore="datastore",r.Geo="geo",r.InAppMessaging="inappmessaging",r.Interactions="interactions",r.Predictions="predictions",r.PubSub="pubsub",r.PushNotification="pushnotification",r.Storage="storage"})(Pb||(Pb={}));var dh;(function(r){r.CreateConversation="1",r.GetConversation="2",r.ListConversations="3",r.DeleteConversation="4",r.SendMessage="5",r.ListMessages="6",r.OnMessage="7",r.Generation="8",r.UpdateConversation="9"})(dh||(dh={}));var th;(function(r){r.Record="1",r.IdentifyUser="2"})(th||(th={}));var lh;(function(r){r.GraphQl="1",r.Get="2",r.Post="3",r.Put="4",r.Patch="5",r.Del="6",r.Head="7"})(lh||(lh={}));var wo;(function(r){r.SignUp="1",r.ConfirmSignUp="2",r.ResendSignUpCode="3",r.SignIn="4",r.FetchMFAPreference="6",r.UpdateMFAPreference="7",r.SetUpTOTP="10",r.VerifyTOTPSetup="11",r.ConfirmSignIn="12",r.DeleteUserAttributes="15",r.DeleteUser="16",r.UpdateUserAttributes="17",r.FetchUserAttributes="18",r.ConfirmUserAttribute="22",r.SignOut="26",r.UpdatePassword="27",r.ResetPassword="28",r.ConfirmResetPassword="29",r.FederatedSignIn="30",r.RememberDevice="32",r.ForgetDevice="33",r.FetchDevices="34",r.SendUserAttributeVerificationCode="35",r.SignInWithRedirect="36",r.StartWebAuthnRegistration="37",r.CompleteWebAuthnRegistration="38",r.ListWebAuthnCredentials="39",r.DeleteWebAuthnCredential="40"})(wo||(wo={}));var ih;(function(r){r.Subscribe="1",r.GraphQl="2"})(ih||(ih={}));var ah;(function(r){r.SearchByText="0",r.SearchByCoordinates="1",r.SearchForSuggestions="2",r.SearchByPlaceId="3",r.SaveGeofences="4",r.GetGeofence="5",r.ListGeofences="6",r.DeleteGeofences="7"})(ah||(ah={}));var wh;(function(r){r.SyncMessages="1",r.IdentifyUser="2",r.NotifyMessageInteraction="3"})(wh||(wh={}));var bh;(function(r){r.None="0"})(bh||(bh={}));var sh;(function(r){r.Convert="1",r.Identify="2",r.Interpret="3"})(sh||(sh={}));var nh;(function(r){r.Subscribe="1"})(nh||(nh={}));var ph;(function(r){r.InitializePushNotifications="1",r.IdentifyUser="2"})(ph||(ph={}));var fh;(function(r){r.UploadData="1",r.DownloadData="2",r.List="3",r.Copy="4",r.Remove="5",r.GetProperties="6",r.GetUrl="7",r.GetDataAccess="8",r.ListCallerAccessGrants="9"})(fh||(fh={}));const _y="6.15.5",Zi=()=>typeof global<"u",Gd=()=>typeof window<"u",hh=()=>typeof document<"u",Rb=()=>typeof process<"u",tl=(r,o)=>!!Object.keys(r).find(e=>e.startsWith(o));function Iy(){const r=d=>d.startsWith("_react")||d.startsWith("__react"),o=d=>Object.keys(d).find(r),e=()=>Array.from(document.querySelectorAll("[id]"));return hh()&&e().some(o)}function Ty(){return Rb()&&typeof process.env<"u"&&!!Object.keys(process.env).find(r=>r.includes("react"))}function Ny(){return Gd()&&tl(window,"__VUE")}function Py(){return Zi()&&tl(global,"__VUE")}function Ry(){return Gd()&&tl(window,"__SVELTE")}function Oy(){return Rb()&&typeof process.env<"u"&&!!Object.keys(process.env).find(r=>r.includes("svelte"))}function My(){return Gd()&&window.next&&typeof window.next=="object"}function $y(){return Zi()&&(tl(global,"__next")||tl(global,"__NEXT"))}function jy(){return Gd()&&(window.__NUXT__!==void 0||window.$nuxt!==void 0)}function Ly(){return Zi()&&typeof global.__NUXT_PATHS__<"u"}function Uy(){const r=!!(hh()&&document.querySelector("[ng-version]")),o=!!(Gd()&&typeof window.ng<"u");return r||o}function zy(){return Rb()&&typeof process.env=="object"&&process.env.npm_lifecycle_script?.startsWith("ng ")||!1}function Vy(){return typeof navigator<"u"&&typeof navigator.product<"u"&&navigator.product==="ReactNative"}function Hy(){return Zi()&&typeof global.expo<"u"}function qy(){return Gd()}const Wy=[{platform:Wr.Expo,detectionMethod:Hy},{platform:Wr.ReactNative,detectionMethod:Vy},{platform:Wr.NextJs,detectionMethod:My},{platform:Wr.Nuxt,detectionMethod:jy},{platform:Wr.Angular,detectionMethod:Uy},{platform:Wr.React,detectionMethod:Iy},{platform:Wr.VueJs,detectionMethod:Ny},{platform:Wr.Svelte,detectionMethod:Ry},{platform:Wr.WebUnknown,detectionMethod:qy},{platform:Wr.NextJsSSR,detectionMethod:$y},{platform:Wr.NuxtSSR,detectionMethod:Ly},{platform:Wr.ReactSSR,detectionMethod:Ty},{platform:Wr.VueJsSSR,detectionMethod:Py},{platform:Wr.AngularSSR,detectionMethod:zy},{platform:Wr.SvelteSSR,detectionMethod:Oy}];function Ky(){return Wy.find(r=>r.detectionMethod())?.platform||Wr.ServerSideUnknown}let ll;const Ob=[];let Mb=!1;const Yy=10,Gy=10,Xy=1e3,mh=()=>{if(!ll){if(ll=Ky(),Mb)for(;Ob.length;)Ob.pop()?.();else Ob.forEach(r=>{r()});kh(Wr.ServerSideUnknown,Yy),kh(Wr.WebUnknown,Gy)}return ll};function Jy(){ll=void 0}function kh(r,o){ll===r&&!Mb&&setTimeout(()=>{Jy(),Mb=!0,setTimeout(mh,Xy)},o)}const Zy={},Qy=(r,o)=>Zy[r]?.[o]?.additionalDetails,r7="aws-amplify",o7=r=>r.replace(/\+.*/,""),e7=({category:r,action:o}={})=>{const e=[[r7,o7(_y)]];if(r&&e.push([r,o]),e.push(["framework",mh()]),r&&o){const d=Qy(r,o);d&&d.forEach(t=>{e.push(t)})}return e},Qi=r=>e7(r).map(([d,t])=>d&&t?`${d}/${t}`:d).join(" "),xh=()=>typeof window<"u"&&typeof window.document<"u",gh=new vo("Auth");class d7{configure(o,e){this.authConfig=o,this.authOptions=e,o&&o.Cognito?.userPoolEndpoint&&gh.warn(ch("Amazon Cognito User Pool")),o&&o.Cognito?.identityPoolEndpoint&&gh.warn(ch("Amazon Cognito Identity Pool"))}async fetchAuthSession(o={}){let e,d;const t=await this.getTokens(o);return t?(d=t.accessToken?.payload?.sub,e=await this.authOptions?.credentialsProvider?.getCredentialsAndIdentityId({authConfig:this.authConfig,tokens:t,authenticated:!0,forceRefresh:o.forceRefresh})):e=await this.authOptions?.credentialsProvider?.getCredentialsAndIdentityId({authConfig:this.authConfig,authenticated:!1,forceRefresh:o.forceRefresh}),{tokens:t,credentials:e?.credentials,identityId:e?.identityId,userSub:d}}async clearCredentials(){await this.authOptions?.credentialsProvider?.clearCredentialsAndIdentityId()}async getTokens(o){return await this.authOptions?.tokenProvider?.getTokens(o)??void 0}}const ch=r=>`You are using a custom Amazon ${r} endpoint, ensure the endpoint is correct.`;class t7{constructor(){this.oAuthListener=void 0,this.isConfigured=!1,this.resourcesConfig={},this.libraryOptions={},this.Auth=new d7}configure(o,e){const d=oh(o);this.resourcesConfig=d,e&&(this.libraryOptions=e),this.resourcesConfig=Xf(this.resourcesConfig),this.Auth.configure(this.resourcesConfig.Auth,this.libraryOptions.Auth),Yd.dispatch("core",{event:"configure",data:this.resourcesConfig},"Configure",kd),this.notifyOAuthListener(),this.isConfigured=!0}getConfig(){return this.isConfigured||console.warn("Amplify has not been configured. Please call Amplify.configure() before using this service."),this.resourcesConfig}[ty](o){this.resourcesConfig.Auth?.Cognito.loginWith?.oauth?o(this.resourcesConfig.Auth?.Cognito):this.oAuthListener=o}notifyOAuthListener(){!this.resourcesConfig.Auth?.Cognito.loginWith?.oauth||!this.oAuthListener||(this.oAuthListener(this.resourcesConfig.Auth?.Cognito),this.oAuthListener=void 0)}}const Tr=new t7,l7=(r,o)=>r.Auth.fetchAuthSession(o),uh=r=>l7(Tr,r);function Fh(){return Tr.Auth.clearCredentials()}const ra=r=>{const{headers:o,statusCode:e}=r;return{...i7(r)?r.$metadata:{},httpStatusCode:e,requestId:o["x-amzn-requestid"]??o["x-amzn-request-id"]??o["x-amz-request-id"],extendedRequestId:o["x-amz-id-2"],cfId:o["x-amz-cf-id"]}},i7=r=>typeof r?.$metadata=="object",Xd=async r=>{if(!r||r.statusCode<300)return;const o=await il(r),d=(i=>{const[a]=i.toString().split(/[,:]+/);return a.includes("#")?a.split("#")[1]:a})(r.headers["x-amzn-errortype"]??o.code??o.__type??"UnknownError"),t=o.message??o.Message??"Unknown error",l=new Error(t);return Object.assign(l,{name:d,$metadata:ra(r)})},il=async r=>{if(!r.body)throw new Error("Missing response payload");const o=await r.body.json();return Object.assign(o,{$metadata:ra(r)})},no=(r,o,e,d)=>async(t,l)=>{const i={...d,...t},a=await i.endpointResolver(i,l),w=await o(l,a),b=await r(w,{...i});return e(b)},a7=300*1e3;function w7(r=a7){return d=>{const t=2**d*100+100*Math.random();return t>r?!1:t}}const Ah=3,yh="amz-sdk-invocation-id",b7="amz-sdk-request",Eh=300*1e3,Dh=r=>{const e=w7(Eh)(r);return e===!1?Eh:e},s7=["AuthFailure","InvalidSignatureException","RequestExpired","RequestInTheFuture","RequestTimeTooSkewed","SignatureDoesNotMatch","BadRequestException"],n7=r=>!!r&&s7.includes(r),vh=r=>async(o,e)=>{const d=e??await r(o)??void 0,t=d?.code||d?.name,l=o?.statusCode;return{retryable:m7(e)||h7(l,t)||n7(t)||k7(l,t)}},p7=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException"],f7=["TimeoutError","RequestTimeout","RequestTimeoutException"],h7=(r,o)=>r===429||!!o&&p7.includes(o),m7=r=>[Ye.NetworkError,"ERR_NETWORK"].includes(r?.name),k7=(r,o)=>!!r&&[500,502,503,504].includes(r)||!!o&&f7.includes(o),Bh="cognito-identity",Sh={service:Bh,retryDecider:vh(Xd),computeDelay:Dh,cache:"no-store"},x7=({maxAttempts:r=Ah,retryDecider:o,computeDelay:e,abortSignal:d})=>{if(r<1)throw new Error("maxAttempts must be greater than 0");return(t,l)=>async function(a){let w,b=l.attemptsCount??0,s;const n=()=>{if(s)return Ch(s,b),s;throw Ch(w,b),w};for(;!d?.aborted&&b<r;){try{s=await t(a),w=void 0}catch(h){w=h,s=void 0}b=(l.attemptsCount??0)>b?l.attemptsCount??0:b+1,l.attemptsCount=b;const{isCredentialsExpiredError:f,retryable:m}=await o(s,w,l);if(m){if(l.isCredentialsExpired=!!f,!d?.aborted&&b<r){const h=e(b);await g7(h,d)}continue}else return n()}if(d?.aborted)throw new Error("Request aborted.");return n()}},g7=(r,o)=>{if(o?.aborted)return Promise.resolve();let e,d;const t=new Promise(l=>{d=l,e=setTimeout(l,r)});return o?.addEventListener("abort",function l(i){clearTimeout(e),o?.removeEventListener("abort",l),d()}),t},Ch=(r,o)=>{Object.prototype.toString.call(r)==="[object Object]"&&(r.$metadata={...r.$metadata??{},attempts:o})},c7=wy,u7=()=>r=>async function(e){return e.headers[yh]||(e.headers[yh]=c7()),r(e)},F7=({maxAttempts:r=Ah})=>(o,e)=>async function(t){const l=e.attemptsCount??0;return t.headers[b7]=`attempt=${l+1}; max=${r}`,o(t)},A7=({userAgentHeader:r="x-amz-user-agent",userAgentValue:o=""})=>e=>async function(t){if(o.trim().length===0)return await e(t);{const l=r.toLowerCase();return t.headers[l]=t.headers[l]?`${t.headers[l]} ${o}`:o,await e(t)}},$b=(r,o)=>(e,d)=>{const t={};let l=i=>r(i,d);for(let i=o.length-1;i>=0;i--){const a=o[i];l=a(d)(l,t)}return l(e)},jb=r=>{let o;return()=>(o||(o=r()),o)},y7=r=>!["HEAD","GET"].includes(r.toUpperCase()),_h=$b(async({url:r,method:o,headers:e,body:d},{abortSignal:t,cache:l,withCrossDomainCredentials:i})=>{let a;try{a=await fetch(r,{method:o,headers:e,body:y7(o)?d:void 0,signal:t,cache:l,credentials:i?"include":"same-origin"})}catch(n){throw n instanceof TypeError?new xo({name:Ye.NetworkError,message:"A network error has occurred.",underlyingError:n}):n}const w={};a.headers?.forEach((n,f)=>{w[f.toLowerCase()]=n});const b={statusCode:a.status,headers:w,body:null},s=Object.assign(a.body??{},{text:jb(()=>a.text()),blob:jb(()=>a.blob()),json:jb(()=>a.json())});return{...b,body:s}},[A7,u7,x7,F7]),Ih=$b(_h,[()=>r=>async function(e){return e.headers["cache-control"]="no-store",r(e)}]),Th=r=>(o,e)=>{const d=E7(r),t=JSON.stringify(o);return D7(e,d,t)},E7=r=>({"content-type":"application/x-amz-json-1.1","x-amz-target":`AWSCognitoIdentityService.${r}`}),D7=({url:r},o,e)=>({headers:o,url:r,body:e,method:"POST"}),Nh=r=>no(Ih,Th("GetCredentialsForIdentity"),v7,{...Sh,...r,userAgentValue:Qi()}),v7=async r=>{if(r.statusCode>=300)throw await Xd(r);const o=await il(r);return{IdentityId:o.IdentityId,Credentials:B7(o.Credentials),$metadata:ra(r)}},B7=({Expiration:r,...o}={})=>({...o,Expiration:r&&new Date(r*1e3)}),S7=r=>no(Ih,Th("GetId"),C7,{...Sh,...r,userAgentValue:Qi()}),C7=async r=>{if(r.statusCode>=300)throw await Xd(r);return{IdentityId:(await il(r)).IdentityId,$metadata:ra(r)}},Ph={id:"aws",outputs:{dnsSuffix:"amazonaws.com"},regionRegex:"^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$",regions:["aws-global"]},_7={partitions:[Ph,{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn"},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:["aws-cn-global"]}]},Rh=r=>{const{partitions:o}=_7;for(const{regions:e,outputs:d,regionRegex:t}of o){const l=new RegExp(t);if(e.includes(r)||l.test(r))return d.dnsSuffix}return Ph.outputs.dnsSuffix},al=URL,I7=({region:r})=>({url:new al(`https://${Bh}.${r}.${Rh(r)}`)});class wl extends xo{constructor(){super({name:Ye.PlatformNotSupported,message:"Function not supported on current platform"})}}class Oh{constructor(o){this.storage=o}async setItem(o,e){if(!this.storage)throw new wl;this.storage.setItem(o,e)}async getItem(o){if(!this.storage)throw new wl;return this.storage.getItem(o)}async removeItem(o){if(!this.storage)throw new wl;this.storage.removeItem(o)}async clear(){if(!this.storage)throw new wl;this.storage.clear()}}class Mh{constructor(){this.storage=new Map}get length(){return this.storage.size}key(o){return o>this.length-1?null:Array.from(this.storage.keys())[o]}setItem(o,e){this.storage.set(o,e)}getItem(o){return this.storage.get(o)??null}removeItem(o){this.storage.delete(o)}clear(){this.storage.clear()}}const $h=new vo("CoreStorageUtils"),T7=()=>{try{if(typeof window<"u"&&window.localStorage)return window.localStorage}catch{$h.info("localStorage not found. InMemoryStorage is used as a fallback.")}return new Mh},jh=()=>{try{if(typeof window<"u"&&window.sessionStorage)return window.sessionStorage.getItem("test"),window.sessionStorage;throw new Error("sessionStorage is not defined")}catch{return $h.info("sessionStorage not found. InMemoryStorage is used as a fallback."),new Mh}};class N7 extends Oh{constructor(){super(T7())}}class P7 extends Oh{constructor(){super(jh())}}class R7{constructor(o){this._storage=o}get storage(){if(!this._storage)throw new wl;return this._storage}setItem(o,e){this.storage.setItem(o,e)}getItem(o){return this.storage.getItem(o)}removeItem(o){this.storage.removeItem(o)}clear(){this.storage.clear()}}class O7 extends R7{constructor(){super(jh())}}class Lh{constructor(o={}){const{path:e,domain:d,expires:t,sameSite:l,secure:i}=o;if(this.domain=d,this.path=e||"/",this.expires=Object.prototype.hasOwnProperty.call(o,"expires")?t:365,this.secure=Object.prototype.hasOwnProperty.call(o,"secure")?i:!0,Object.prototype.hasOwnProperty.call(o,"sameSite")){if(!l||!["strict","lax","none"].includes(l))throw new Error('The sameSite value of cookieStorage must be "lax", "strict" or "none".');if(l==="none"&&!this.secure)throw new Error("sameSite = None requires the Secure attribute in latest browser versions.");this.sameSite=l}}async setItem(o,e){el.set(o,e,this.getData())}async getItem(o){return el.get(o)??null}async removeItem(o){el.remove(o,this.getData())}async clear(){const o=el.get(),e=Object.keys(o).map(d=>this.removeItem(d));await Promise.all(e)}getData(){return{path:this.path,expires:this.expires,domain:this.domain,secure:this.secure,...this.sameSite&&{sameSite:this.sameSite}}}}const bl=new N7;new P7;const De=new O7,M7=r=>{let o;return async(...e)=>o||(o=new Promise((d,t)=>{r(...e).then(l=>{d(l)}).catch(l=>{t(l)}).finally(()=>{o=void 0})}),o)};function Uh({expiresAt:r,clockDrift:o,tolerance:e=5e3}){return Date.now()+o+e>r}const $7=async()=>{const{userAgentData:r}=navigator;if(!r)return navigator.userAgent;const{platform:o="",platformVersion:e="",model:d="",architecture:t="",fullVersionList:l=[]}=await r.getHighEntropyValues(["platform","platformVersion","architecture","model","fullVersionList"]),i=l.map(w=>`${w.brand}/${w.version}`).join(";");return[o,e,t,d,o,i].filter(w=>w).join(" ")||navigator.userAgent};function j7(r){return Array.from(r,o=>String.fromCodePoint(o)).join("")}const sl={convert(r,o={urlSafe:!1,skipPadding:!1}){const e=typeof r=="string"?r:j7(r);let d=X8()(e);return o.urlSafe&&(d=d.replace(/\+/g,"-").replace(/\//g,"_")),o.skipPadding&&(d=d.replace(/=/g,"")),d}};function L7(){return G8().getRandomValues(new Uint32Array(1))[0]}function U7(r){const{words:o}=r,{sigBytes:e}=r,d=[];for(let t=0;t<e;t++){const l=o[t>>>2]>>>24-t%4*8&255;d.push((l>>>4).toString(16)),d.push((l&15).toString(16))}return d.join("")}class Lb{constructor(o,e){this.words=[];let d=o;d=this.words=d||[],e!==void 0?this.sigBytes=e:this.sigBytes=d.length*4}random(o){const e=[];for(let d=0;d<o;d+=4)e.push(L7());return new Lb(e,o)}toString(){return U7(this)}}var nr;(function(r){r.EmptySignInUsername="EmptySignInUsername",r.EmptySignInPassword="EmptySignInPassword",r.CustomAuthSignInPassword="CustomAuthSignInPassword",r.EmptySignUpUsername="EmptySignUpUsername",r.EmptySignUpPassword="EmptySignUpPassword",r.EmptyConfirmSignUpUsername="EmptyConfirmSignUpUsername",r.EmptyConfirmSignUpCode="EmptyConfirmSignUpCode",r.EmptyResendSignUpCodeUsername="EmptyresendSignUpCodeUsername",r.EmptyChallengeResponse="EmptyChallengeResponse",r.EmptyConfirmResetPasswordUsername="EmptyConfirmResetPasswordUsername",r.EmptyConfirmResetPasswordNewPassword="EmptyConfirmResetPasswordNewPassword",r.EmptyConfirmResetPasswordConfirmationCode="EmptyConfirmResetPasswordConfirmationCode",r.EmptyResetPasswordUsername="EmptyResetPasswordUsername",r.EmptyVerifyTOTPSetupCode="EmptyVerifyTOTPSetupCode",r.EmptyConfirmUserAttributeCode="EmptyConfirmUserAttributeCode",r.IncorrectMFAMethod="IncorrectMFAMethod",r.EmptyUpdatePassword="EmptyUpdatePassword"})(nr||(nr={}));const zh={[nr.EmptyChallengeResponse]:{message:"challengeResponse is required to confirmSignIn"},[nr.EmptyConfirmResetPasswordUsername]:{message:"username is required to confirmResetPassword"},[nr.EmptyConfirmSignUpCode]:{message:"code is required to confirmSignUp"},[nr.EmptyConfirmSignUpUsername]:{message:"username is required to confirmSignUp"},[nr.EmptyConfirmResetPasswordConfirmationCode]:{message:"confirmationCode is required to confirmResetPassword"},[nr.EmptyConfirmResetPasswordNewPassword]:{message:"newPassword is required to confirmResetPassword"},[nr.EmptyResendSignUpCodeUsername]:{message:"username is required to confirmSignUp"},[nr.EmptyResetPasswordUsername]:{message:"username is required to resetPassword"},[nr.EmptySignInPassword]:{message:"password is required to signIn"},[nr.EmptySignInUsername]:{message:"username is required to signIn"},[nr.EmptySignUpPassword]:{message:"password is required to signUp"},[nr.EmptySignUpUsername]:{message:"username is required to signUp"},[nr.CustomAuthSignInPassword]:{message:"A password is not needed when signing in with CUSTOM_WITHOUT_SRP",recoverySuggestion:"Do not include a password in your signIn call."},[nr.IncorrectMFAMethod]:{message:"Incorrect MFA method was chosen. It should be either SMS, TOTP, or EMAIL",recoverySuggestion:"Try to pass SMS, TOTP, or EMAIL as the challengeResponse"},[nr.EmptyVerifyTOTPSetupCode]:{message:"code is required to verifyTotpSetup"},[nr.EmptyUpdatePassword]:{message:"oldPassword and newPassword are required to changePassword"},[nr.EmptyConfirmUserAttributeCode]:{message:"confirmation code is required to confirmUserAttribute"}};var Vh;(function(r){r.DEFAULT_MSG="Authentication Error",r.EMPTY_EMAIL="Email cannot be empty",r.EMPTY_PHONE="Phone number cannot be empty",r.EMPTY_USERNAME="Username cannot be empty",r.INVALID_USERNAME="The username should either be a string or one of the sign in types",r.EMPTY_PASSWORD="Password cannot be empty",r.EMPTY_CODE="Confirmation code cannot be empty",r.SIGN_UP_ERROR="Error creating account",r.NO_MFA="No valid MFA method provided",r.INVALID_MFA="Invalid MFA type",r.EMPTY_CHALLENGE="Challenge response cannot be empty",r.NO_USER_SESSION="Failed to get the session because the user is empty",r.NETWORK_ERROR="Network Error",r.DEVICE_CONFIG="Device tracking has not been configured in this User Pool",r.AUTOSIGNIN_ERROR="Please use your credentials to sign in",r.OAUTH_ERROR="Couldn't finish OAuth flow, check your User Pool HostedUI settings"})(Vh||(Vh={}));var Jd;(function(r){r.SignInException="SignInException",r.OAuthSignInError="OAuthSignInException"})(Jd||(Jd={}));class ar extends xo{constructor(o){super(o),this.constructor=ar,Object.setPrototypeOf(this,ar.prototype)}}function Vr(r,o){const{message:e,recoverySuggestion:d}=zh[o];if(!r)throw new ar({name:o,message:e,recoverySuggestion:d})}function Kr(r){const o=r?.split("_")[0];if(!r||r.indexOf("_")<0||!o||typeof o!="string")throw new ar({name:"InvalidUserPoolId",message:"Invalid user pool id provided."});return o}function Ub(r){if(!r||!r.includes(":"))throw new ar({name:"InvalidIdentityPoolIdException",message:"Invalid identity pool id provided.",recoverySuggestion:"Make sure a valid identityPoolId is given in the config."});return r.split(":")[0]}function Hh(r){return Object.entries(r).map(([o,e])=>({Name:o,Value:e}))}var qh;(function(r){r.ConcurrentModificationException="ConcurrentModificationException",r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidParameterException="InvalidParameterException",r.NotAuthorizedException="NotAuthorizedException",r.ResourceNotFoundException="ResourceNotFoundException",r.SoftwareTokenMFANotFoundException="SoftwareTokenMFANotFoundException"})(qh||(qh={}));var Wh;(function(r){r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidParameterException="InvalidParameterException",r.InvalidPasswordException="InvalidPasswordException",r.LimitExceededException="LimitExceededException",r.NotAuthorizedException="NotAuthorizedException",r.PasswordResetRequiredException="PasswordResetRequiredException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(Wh||(Wh={}));var Kh;(function(r){r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidLambdaResponseException="InvalidLambdaResponseException",r.InvalidParameterException="InvalidParameterException",r.InvalidPasswordException="InvalidPasswordException",r.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",r.NotAuthorizedException="NotAuthorizedException",r.PasswordResetRequiredException="PasswordResetRequiredException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UsernameExistsException="UsernameExistsException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(Kh||(Kh={}));var Yh;(function(r){r.CodeMismatchException="CodeMismatchException",r.ExpiredCodeException="ExpiredCodeException",r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidLambdaResponseException="InvalidLambdaResponseException",r.InvalidParameterException="InvalidParameterException",r.InvalidPasswordException="InvalidPasswordException",r.LimitExceededException="LimitExceededException",r.NotAuthorizedException="NotAuthorizedException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyFailedAttemptsException="TooManyFailedAttemptsException",r.TooManyRequestsException="TooManyRequestsException",r.UnexpectedLambdaException="UnexpectedLambdaException",r.UserLambdaValidationException="UserLambdaValidationException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(Yh||(Yh={}));var Gh;(function(r){r.AliasExistsException="AliasExistsException",r.CodeMismatchException="CodeMismatchException",r.ExpiredCodeException="ExpiredCodeException",r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidLambdaResponseException="InvalidLambdaResponseException",r.InvalidParameterException="InvalidParameterException",r.LimitExceededException="LimitExceededException",r.NotAuthorizedException="NotAuthorizedException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyFailedAttemptsException="TooManyFailedAttemptsException",r.TooManyRequestsException="TooManyRequestsException",r.UnexpectedLambdaException="UnexpectedLambdaException",r.UserLambdaValidationException="UserLambdaValidationException",r.UserNotFoundException="UserNotFoundException"})(Gh||(Gh={}));var Xh;(function(r){r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidParameterException="InvalidParameterException",r.NotAuthorizedException="NotAuthorizedException",r.PasswordResetRequiredException="PasswordResetRequiredException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(Xh||(Xh={}));var Jh;(function(r){r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidParameterException="InvalidParameterException",r.NotAuthorizedException="NotAuthorizedException",r.PasswordResetRequiredException="PasswordResetRequiredException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(Jh||(Jh={}));var Zh;(function(r){r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidParameterException="InvalidParameterException",r.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",r.NotAuthorizedException="NotAuthorizedException",r.PasswordResetRequiredException="PasswordResetRequiredException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(Zh||(Zh={}));var Qh;(function(r){r.CodeDeliveryFailureException="CodeDeliveryFailureException",r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidEmailRoleAccessPolicyException="InvalidEmailRoleAccessPolicyException",r.InvalidLambdaResponseException="InvalidLambdaResponseException",r.InvalidParameterException="InvalidParameterException",r.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",r.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",r.LimitExceededException="LimitExceededException",r.NotAuthorizedException="NotAuthorizedException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UnexpectedLambdaException="UnexpectedLambdaException",r.UserLambdaValidationException="UserLambdaValidationException",r.UserNotFoundException="UserNotFoundException"})(Qh||(Qh={}));var r0;(function(r){r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidParameterException="InvalidParameterException",r.NotAuthorizedException="NotAuthorizedException",r.PasswordResetRequiredException="PasswordResetRequiredException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(r0||(r0={}));var o0;(function(r){r.ExternalServiceException="ExternalServiceException",r.InternalErrorException="InternalErrorException",r.InvalidParameterException="InvalidParameterException",r.LimitExceededException="LimitExceededException",r.NotAuthorizedException="NotAuthorizedException",r.ResourceConflictException="ResourceConflictException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException"})(o0||(o0={}));var e0;(function(r){r.ExternalServiceException="ExternalServiceException",r.InternalErrorException="InternalErrorException",r.InvalidIdentityPoolConfigurationException="InvalidIdentityPoolConfigurationException",r.InvalidParameterException="InvalidParameterException",r.NotAuthorizedException="NotAuthorizedException",r.ResourceConflictException="ResourceConflictException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException"})(e0||(e0={}));var d0;(function(r){r.CodeDeliveryFailureException="CodeDeliveryFailureException",r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidEmailRoleAccessPolicyException="InvalidEmailRoleAccessPolicyException",r.InvalidLambdaResponseException="InvalidLambdaResponseException",r.InvalidParameterException="InvalidParameterException",r.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",r.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",r.LimitExceededException="LimitExceededException",r.NotAuthorizedException="NotAuthorizedException",r.PasswordResetRequiredException="PasswordResetRequiredException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UnexpectedLambdaException="UnexpectedLambdaException",r.UserLambdaValidationException="UserLambdaValidationException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(d0||(d0={}));var t0;(function(r){r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidParameterException="InvalidParameterException",r.NotAuthorizedException="NotAuthorizedException",r.PasswordResetRequiredException="PasswordResetRequiredException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UserNotConfirmedException="UserNotConfirmedException"})(t0||(t0={}));var oa;(function(r){r.PasswordResetRequiredException="PasswordResetRequiredException",r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidLambdaResponseException="InvalidLambdaResponseException",r.InvalidParameterException="InvalidParameterException",r.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",r.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",r.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",r.NotAuthorizedException="NotAuthorizedException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UnexpectedLambdaException="UnexpectedLambdaException",r.UserLambdaValidationException="UserLambdaValidationException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(oa||(oa={}));var l0;(function(r){r.CodeDeliveryFailureException="CodeDeliveryFailureException",r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidEmailRoleAccessPolicyException="InvalidEmailRoleAccessPolicyException",r.InvalidLambdaResponseException="InvalidLambdaResponseException",r.InvalidParameterException="InvalidParameterException",r.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",r.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",r.LimitExceededException="LimitExceededException",r.NotAuthorizedException="NotAuthorizedException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UnexpectedLambdaException="UnexpectedLambdaException",r.UserLambdaValidationException="UserLambdaValidationException",r.UserNotFoundException="UserNotFoundException"})(l0||(l0={}));var i0;(function(r){r.AliasExistsException="AliasExistsException",r.CodeMismatchException="CodeMismatchException",r.ExpiredCodeException="ExpiredCodeException",r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidLambdaResponseException="InvalidLambdaResponseException",r.InvalidParameterException="InvalidParameterException",r.InvalidPasswordException="InvalidPasswordException",r.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",r.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",r.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",r.MFAMethodNotFoundException="MFAMethodNotFoundException",r.NotAuthorizedException="NotAuthorizedException",r.PasswordResetRequiredException="PasswordResetRequiredException",r.ResourceNotFoundException="ResourceNotFoundException",r.SoftwareTokenMFANotFoundException="SoftwareTokenMFANotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UnexpectedLambdaException="UnexpectedLambdaException",r.UserLambdaValidationException="UserLambdaValidationException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(i0||(i0={}));var a0;(function(r){r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidParameterException="InvalidParameterException",r.NotAuthorizedException="NotAuthorizedException",r.PasswordResetRequiredException="PasswordResetRequiredException",r.ResourceNotFoundException="ResourceNotFoundException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(a0||(a0={}));var zb;(function(r){r.CodeDeliveryFailureException="CodeDeliveryFailureException",r.InternalErrorException="InternalErrorException",r.InvalidEmailRoleAccessPolicyException="InvalidEmailRoleAccessPolicyException",r.InvalidLambdaResponseException="InvalidLambdaResponseException",r.InvalidParameterException="InvalidParameterException",r.InvalidPasswordException="InvalidPasswordException",r.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",r.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",r.NotAuthorizedException="NotAuthorizedException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UnexpectedLambdaException="UnexpectedLambdaException",r.UserLambdaValidationException="UserLambdaValidationException",r.UsernameExistsException="UsernameExistsException"})(zb||(zb={}));var w0;(function(r){r.AliasExistsException="AliasExistsException",r.CodeDeliveryFailureException="CodeDeliveryFailureException",r.CodeMismatchException="CodeMismatchException",r.ExpiredCodeException="ExpiredCodeException",r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidEmailRoleAccessPolicyException="InvalidEmailRoleAccessPolicyException",r.InvalidLambdaResponseException="InvalidLambdaResponseException",r.InvalidParameterException="InvalidParameterException",r.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",r.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",r.NotAuthorizedException="NotAuthorizedException",r.PasswordResetRequiredException="PasswordResetRequiredException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UnexpectedLambdaException="UnexpectedLambdaException",r.UserLambdaValidationException="UserLambdaValidationException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(w0||(w0={}));var b0;(function(r){r.CodeMismatchException="CodeMismatchException",r.EnableSoftwareTokenMFAException="EnableSoftwareTokenMFAException",r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidParameterException="InvalidParameterException",r.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",r.NotAuthorizedException="NotAuthorizedException",r.PasswordResetRequiredException="PasswordResetRequiredException",r.ResourceNotFoundException="ResourceNotFoundException",r.SoftwareTokenMFANotFoundException="SoftwareTokenMFANotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(b0||(b0={}));var s0;(function(r){r.AliasExistsException="AliasExistsException",r.CodeMismatchException="CodeMismatchException",r.ExpiredCodeException="ExpiredCodeException",r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidParameterException="InvalidParameterException",r.LimitExceededException="LimitExceededException",r.NotAuthorizedException="NotAuthorizedException",r.PasswordResetRequiredException="PasswordResetRequiredException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(s0||(s0={}));var n0;(function(r){r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidParameterException="InvalidParameterException",r.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",r.NotAuthorizedException="NotAuthorizedException",r.PasswordResetRequiredException="PasswordResetRequiredException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(n0||(n0={}));var p0;(function(r){r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidParameterException="InvalidParameterException",r.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",r.NotAuthorizedException="NotAuthorizedException",r.PasswordResetRequiredException="PasswordResetRequiredException",r.ResourceNotFoundException="ResourceNotFoundException",r.TooManyRequestsException="TooManyRequestsException",r.UserNotConfirmedException="UserNotConfirmedException",r.UserNotFoundException="UserNotFoundException"})(p0||(p0={}));const ea="UserUnAuthenticatedException",z7="UserAlreadyAuthenticatedException",V7="DeviceMetadataNotFoundException",f0="AutoSignInException",H7="InvalidRedirectException",q7="InvalidAppSchemeException",W7="InvalidPreferredRedirectUrlException",K7=new ar({name:H7,message:"signInRedirect or signOutRedirect had an invalid format or was not found.",recoverySuggestion:"Please make sure the signIn/Out redirect in your oauth config is valid."});new ar({name:q7,message:"A valid non-http app scheme was not found in the config.",recoverySuggestion:"Please make sure a valid custom app scheme is present in the config."});const Y7=new ar({name:W7,message:"The given preferredRedirectUrl does not match any items in the redirectSignOutUrls array from the config.",recoverySuggestion:"Please make sure a matching preferredRedirectUrl is provided."}),G7="InvalidOriginException",X7=new ar({name:G7,message:"redirect is coming from a different origin. The oauth flow needs to be initiated from the same origin",recoverySuggestion:"Please call signInWithRedirect from the same origin."}),J7="OAuthSignOutException",Z7="TokenRefreshException",Q7="UnexpectedSignInInterruptionException";function Vb(r){if(!r||!r.accessToken)throw new ar({name:ea,message:"User needs to be authenticated to call this API.",recoverySuggestion:"Sign in before calling this API again."})}function rE(r){if(!r||!r.idToken)throw new ar({name:ea,message:"User needs to be authenticated to call this API.",recoverySuggestion:"Sign in before calling this API again."})}const oE=new ar({name:Z7,message:`Token refresh is not supported when authenticated with the 'implicit grant' (token) oauth flow.
|
|
152
152
|
Please change your oauth configuration to use 'code grant' flow.`,recoverySuggestion:`Please logout and change your Amplify configuration to use "code grant" flow.
|
|
153
153
|
E.g { responseType: 'code' }`}),eE=new ar({name:ea,message:"User needs to be authenticated to call this API.",recoverySuggestion:"Sign in before calling this API again."});function h0(r){if(lE(r))throw oE;if(!tE(r))throw eE}function m0(r){if(!r||!r.deviceKey||!r.deviceGroupKey||!r.randomPassword)throw new ar({name:V7,message:"Either deviceKey, deviceGroupKey or secretPassword were not found during the sign-in process.",recoverySuggestion:"Make sure to not clear storage after calling the signIn API."})}const dE={inflightOAuth:"inflightOAuth",oauthSignIn:"oauthSignIn",oauthPKCE:"oauthPKCE",oauthState:"oauthState"};function k0(r){return r?.accessToken||r?.idToken}function tE(r){return k0(r)&&r?.refreshToken}function lE(r){return k0(r)&&!r?.refreshToken}const iE=async r=>{const o=r.getConfig().Auth?.Cognito;Br(o);const e=await r.Auth.getTokens({forceRefresh:!1});Vb(e);const{"cognito:username":d,sub:t}=e.idToken?.payload??{},l={username:d,userId:t},i=aE(e);return i&&(l.signInDetails=i),l};function aE(r){return r?.signInDetails}const x0=async()=>iE(Tr),go=(r,o)=>Qi({category:Pb.Auth,action:r,...o}),Bo=r=>(o,e)=>{const d=wE(r),t=JSON.stringify(o);return bE(e,d,t)},wE=r=>({"content-type":"application/x-amz-json-1.1","x-amz-target":`AWSCognitoIdentityProviderService.${r}`}),bE=({url:r},o,e)=>({headers:o,url:r,body:e,method:"POST"});function Qo(r){if(!r||r.name==="Error"||r instanceof TypeError)throw new ar({name:Ye.Unknown,message:"An unknown error has occurred.",underlyingError:r})}const Lo=()=>async r=>{if(r.statusCode>=300){const o=await Xd(r);throw Qo(o),new ar({name:o.name,message:o.message,metadata:o.$metadata})}return il(r)},So=$b(_h,[()=>(r,o)=>async function(d){return d.headers["cache-control"]="no-store",r(d)}]),g0="cognito-idp",Co={service:g0,retryDecider:vh(Xd),computeDelay:Dh,get userAgentValue(){return Qi()},cache:"no-store"},nl=r=>no(So,Bo("InitiateAuth"),Lo(),{...Co,...r}),da=r=>no(So,Bo("RespondToAuthChallenge"),Lo(),{...Co,...r}),sE=r=>no(So,Bo("AssociateSoftwareToken"),Lo(),{...Co,...r}),nE=({region:r})=>({url:new al(`https://${g0}.${r}.${Rh(r)}`)}),Yr=({endpointOverride:r})=>o=>r?{url:new al(r)}:nE(o),pE=r=>no(So,Bo("GetTokensFromRefreshToken"),Lo(),{...Co,...r}),fE=M7(async({tokens:r,authConfig:o,username:e})=>{Br(o?.Cognito);const{userPoolId:d,userPoolClientId:t,userPoolEndpoint:l}=o.Cognito,i=Kr(d);h0(r);const a=pE({endpointResolver:Yr({endpointOverride:l})}),{AuthenticationResult:w}=await a({region:i},{ClientId:t,RefreshToken:r.refreshToken,DeviceKey:r.deviceMetadata?.deviceKey}),b=xd(w?.AccessToken??""),s=w?.IdToken?xd(w.IdToken):void 0,{iat:n}=b.payload;if(!n)throw new ar({name:"iatNotFoundException",message:"iat not found in access token"});const f=n*1e3-new Date().getTime();return{accessToken:b,idToken:s,clockDrift:f,refreshToken:w?.RefreshToken??r.refreshToken,username:e}}),hE={accessToken:"accessToken",idToken:"idToken",oidcProvider:"oidcProvider",clockDrift:"clockDrift",refreshToken:"refreshToken",deviceKey:"deviceKey",randomPasswordKey:"randomPasswordKey",deviceGroupKey:"deviceGroupKey",signInDetails:"signInDetails",oauthMetadata:"oauthMetadata"};var ta;(function(r){r.InvalidAuthTokens="InvalidAuthTokens"})(ta||(ta={}));const mE={[ta.InvalidAuthTokens]:{message:"Invalid tokens.",recoverySuggestion:"Make sure the tokens are valid."}},kE=_b(mE),c0="CognitoIdentityServiceProvider";class xE{getKeyValueStorage(){if(!this.keyValueStorage)throw new ar({name:"KeyValueStorageNotFoundException",message:"KeyValueStorage was not found in TokenStore"});return this.keyValueStorage}setKeyValueStorage(o){this.keyValueStorage=o}setAuthConfig(o){this.authConfig=o}async loadTokens(){try{const o=await this.getAuthKeys(),e=await this.getKeyValueStorage().getItem(o.accessToken);if(!e)throw new ar({name:"NoSessionFoundException",message:"Auth session was not found. Make sure to call signIn."});const d=xd(e),t=await this.getKeyValueStorage().getItem(o.idToken),l=t?xd(t):void 0,i=await this.getKeyValueStorage().getItem(o.refreshToken)??void 0,a=await this.getKeyValueStorage().getItem(o.clockDrift)??"0",w=Number.parseInt(a),b=await this.getKeyValueStorage().getItem(o.signInDetails),s={accessToken:d,idToken:l,refreshToken:i,deviceMetadata:await this.getDeviceMetadata()??void 0,clockDrift:w,username:await this.getLastAuthUser()};return b&&(s.signInDetails=JSON.parse(b)),s}catch{return null}}async storeTokens(o){kE(o!==void 0,ta.InvalidAuthTokens);const e=o.username;await this.getKeyValueStorage().setItem(this.getLastAuthUserKey(),e);const d=await this.getAuthKeys();await this.getKeyValueStorage().setItem(d.accessToken,o.accessToken.toString()),o.idToken?await this.getKeyValueStorage().setItem(d.idToken,o.idToken.toString()):await this.getKeyValueStorage().removeItem(d.idToken),o.refreshToken?await this.getKeyValueStorage().setItem(d.refreshToken,o.refreshToken):await this.getKeyValueStorage().removeItem(d.refreshToken),o.deviceMetadata&&(o.deviceMetadata.deviceKey&&await this.getKeyValueStorage().setItem(d.deviceKey,o.deviceMetadata.deviceKey),o.deviceMetadata.deviceGroupKey&&await this.getKeyValueStorage().setItem(d.deviceGroupKey,o.deviceMetadata.deviceGroupKey),await this.getKeyValueStorage().setItem(d.randomPasswordKey,o.deviceMetadata.randomPassword)),o.signInDetails?await this.getKeyValueStorage().setItem(d.signInDetails,JSON.stringify(o.signInDetails)):await this.getKeyValueStorage().removeItem(d.signInDetails),await this.getKeyValueStorage().setItem(d.clockDrift,`${o.clockDrift}`)}async clearTokens(){const o=await this.getAuthKeys();await Promise.all([this.getKeyValueStorage().removeItem(o.accessToken),this.getKeyValueStorage().removeItem(o.idToken),this.getKeyValueStorage().removeItem(o.clockDrift),this.getKeyValueStorage().removeItem(o.refreshToken),this.getKeyValueStorage().removeItem(o.signInDetails),this.getKeyValueStorage().removeItem(this.getLastAuthUserKey()),this.getKeyValueStorage().removeItem(o.oauthMetadata)])}async getDeviceMetadata(o){const e=await this.getAuthKeys(o),d=await this.getKeyValueStorage().getItem(e.deviceKey),t=await this.getKeyValueStorage().getItem(e.deviceGroupKey),l=await this.getKeyValueStorage().getItem(e.randomPasswordKey);return l&&t&&d?{deviceKey:d,deviceGroupKey:t,randomPassword:l}:null}async clearDeviceMetadata(o){const e=await this.getAuthKeys(o);await Promise.all([this.getKeyValueStorage().removeItem(e.deviceKey),this.getKeyValueStorage().removeItem(e.deviceGroupKey),this.getKeyValueStorage().removeItem(e.randomPasswordKey)])}async getAuthKeys(o){Br(this.authConfig?.Cognito);const e=o??await this.getLastAuthUser();return gE(c0,`${this.authConfig.Cognito.userPoolClientId}.${e}`)}getLastAuthUserKey(){Br(this.authConfig?.Cognito);const o=this.authConfig.Cognito.userPoolClientId;return`${c0}.${o}.LastAuthUser`}async getLastAuthUser(){return await this.getKeyValueStorage().getItem(this.getLastAuthUserKey())??"username"}async setOAuthMetadata(o){const{oauthMetadata:e}=await this.getAuthKeys();await this.getKeyValueStorage().setItem(e,JSON.stringify(o))}async getOAuthMetadata(){const{oauthMetadata:o}=await this.getAuthKeys(),e=await this.getKeyValueStorage().getItem(o);return e&&JSON.parse(e)}}const gE=(r,o)=>Hb(hE)(`${r}`,o);function Hb(r){const o=Object.values({...r});return(e,d)=>o.reduce((t,l)=>({...t,[l]:`${e}.${d}.${l}`}),{})}const u0="amplify-signin-with-hostedUI",se="CognitoIdentityServiceProvider";class F0{constructor(o){this.keyValueStorage=o}async clearOAuthInflightData(){Br(this.cognitoConfig);const o=ne(se,this.cognitoConfig.userPoolClientId);await Promise.all([this.keyValueStorage.removeItem(o.inflightOAuth),this.keyValueStorage.removeItem(o.oauthPKCE),this.keyValueStorage.removeItem(o.oauthState)])}async clearOAuthData(){Br(this.cognitoConfig);const o=ne(se,this.cognitoConfig.userPoolClientId);return await this.clearOAuthInflightData(),await this.keyValueStorage.removeItem(u0),this.keyValueStorage.removeItem(o.oauthSignIn)}loadOAuthState(){Br(this.cognitoConfig);const o=ne(se,this.cognitoConfig.userPoolClientId);return this.keyValueStorage.getItem(o.oauthState)}storeOAuthState(o){Br(this.cognitoConfig);const e=ne(se,this.cognitoConfig.userPoolClientId);return this.keyValueStorage.setItem(e.oauthState,o)}loadPKCE(){Br(this.cognitoConfig);const o=ne(se,this.cognitoConfig.userPoolClientId);return this.keyValueStorage.getItem(o.oauthPKCE)}storePKCE(o){Br(this.cognitoConfig);const e=ne(se,this.cognitoConfig.userPoolClientId);return this.keyValueStorage.setItem(e.oauthPKCE,o)}setAuthConfig(o){this.cognitoConfig=o}async loadOAuthInFlight(){Br(this.cognitoConfig);const o=ne(se,this.cognitoConfig.userPoolClientId);return await this.keyValueStorage.getItem(o.inflightOAuth)==="true"}async storeOAuthInFlight(o){Br(this.cognitoConfig);const e=ne(se,this.cognitoConfig.userPoolClientId);await this.keyValueStorage.setItem(e.inflightOAuth,`${o}`)}async loadOAuthSignIn(){Br(this.cognitoConfig);const o=ne(se,this.cognitoConfig.userPoolClientId),e=await this.keyValueStorage.getItem(u0),[d,t]=(await this.keyValueStorage.getItem(o.oauthSignIn))?.split(",")??[];return{isOAuthSignIn:d==="true"||e==="true",preferPrivateSession:t==="true"}}async storeOAuthSignIn(o,e=!1){Br(this.cognitoConfig);const d=ne(se,this.cognitoConfig.userPoolClientId);await this.keyValueStorage.setItem(d.oauthSignIn,`${o},${e}`)}}const ne=(r,o)=>Hb(dE)(r,o),A0=new F0(bl);class cE{constructor(){this.waitForInflightOAuth=xh()?async()=>{if(await A0.loadOAuthInFlight())return this.inflightPromise?this.inflightPromise:(this.inflightPromise=new Promise((o,e)=>{}),this.inflightPromise)}:async()=>{}}setAuthConfig(o){A0.setAuthConfig(o.Cognito),this.authConfig=o}setTokenRefresher(o){this.tokenRefresher=o}setAuthTokenStore(o){this.tokenStore=o}getTokenStore(){if(!this.tokenStore)throw new ar({name:"EmptyTokenStoreException",message:"TokenStore not set"});return this.tokenStore}getTokenRefresher(){if(!this.tokenRefresher)throw new ar({name:"EmptyTokenRefresherException",message:"TokenRefresher not set"});return this.tokenRefresher}async getTokens(o){let e;try{Br(this.authConfig?.Cognito)}catch{return null}await this.waitForInflightOAuth(),this.inflightPromise=void 0,e=await this.getTokenStore().loadTokens();const d=await this.getTokenStore().getLastAuthUser();if(e===null)return null;const t=!!e?.idToken&&Uh({expiresAt:(e.idToken?.payload?.exp??0)*1e3,clockDrift:e.clockDrift??0}),l=Uh({expiresAt:(e.accessToken?.payload?.exp??0)*1e3,clockDrift:e.clockDrift??0});return(o?.forceRefresh||t||l)&&(e=await this.refreshTokens({tokens:e,username:d}),e===null)?null:{accessToken:e?.accessToken,idToken:e?.idToken,signInDetails:e?.signInDetails}}async refreshTokens({tokens:o,username:e}){try{const{signInDetails:d}=o,t=await this.getTokenRefresher()({tokens:o,authConfig:this.authConfig,username:e});return t.signInDetails=d,await this.setTokens({tokens:t}),Yd.dispatch("auth",{event:"tokenRefresh"},"Auth",kd),t}catch(d){return this.handleErrors(d)}}handleErrors(o){if(Qo(o),o.name!==Ye.NetworkError&&this.clearTokens(),Yd.dispatch("auth",{event:"tokenRefresh_failure",data:{error:o}},"Auth",kd),o.name.startsWith("NotAuthorizedException"))return null;throw o}async setTokens({tokens:o}){return this.getTokenStore().storeTokens(o)}async clearTokens(){return this.getTokenStore().clearTokens()}getDeviceMetadata(o){return this.getTokenStore().getDeviceMetadata(o)}clearDeviceMetadata(o){return this.getTokenStore().clearDeviceMetadata(o)}setOAuthMetadata(o){return this.getTokenStore().setOAuthMetadata(o)}getOAuthMetadata(){return this.getTokenStore().getOAuthMetadata()}}class uE{constructor(){this.authTokenStore=new xE,this.authTokenStore.setKeyValueStorage(bl),this.tokenOrchestrator=new cE,this.tokenOrchestrator.setAuthTokenStore(this.authTokenStore),this.tokenOrchestrator.setTokenRefresher(fE)}getTokens({forceRefresh:o}={forceRefresh:!1}){return this.tokenOrchestrator.getTokens({forceRefresh:o})}setKeyValueStorage(o){this.authTokenStore.setKeyValueStorage(o)}setAuthConfig(o){this.authTokenStore.setAuthConfig(o),this.tokenOrchestrator.setAuthConfig(o)}}const Zd=new uE,{tokenOrchestrator:_o}=Zd;async function Qd(r){if(r.AccessToken){const o=xd(r.AccessToken),e=(o.payload.iat||0)*1e3,d=new Date().getTime(),t=e>0?e-d:0;let l,i,a;r.RefreshToken&&(i=r.RefreshToken),r.IdToken&&(l=xd(r.IdToken)),r?.NewDeviceMetadata&&(a=r.NewDeviceMetadata);const w={accessToken:o,idToken:l,refreshToken:i,clockDrift:t,deviceMetadata:a,username:r.username};r?.signInDetails&&(w.signInDetails=r.signInDetails),await _o.setTokens({tokens:w})}else throw new xo({message:"Invalid tokens",name:"InvalidTokens",recoverySuggestion:"Check Cognito UserPool settings"})}const FE="Unable to get user session following successful sign-in.",rt=async()=>{try{Yd.dispatch("auth",{event:"signedIn",data:await x0()},"Auth",kd)}catch(r){throw r.name===ea?new ar({name:Q7,message:FE,recoverySuggestion:"This most likely is due to auth tokens not being persisted. If you are using cookie store, please ensure cookies can be correctly set from your server."}):r}};function y0(){return{active:!1}}const Ge=(r=>{let o=r(y0(),{type:"RESET"});return{getState:()=>o,dispatch:e=>{o=r(o,e)}}})((r,o)=>{switch(o.type){case"SET_USERNAME":return{...r,username:o.value};case"SET_SESSION":return{...r,session:o.value};case"START":return{...r,active:!0};case"RESET":return y0();default:return r}}),AE=180*1e3,la="CognitoSignInState",ve={username:`${la}.username`,challengeName:`${la}.challengeName`,signInSession:`${la}.signInSession`,expiry:`${la}.expiry`},yE=(r,o)=>{switch(o.type){case"SET_SIGN_IN_SESSION":return ia({signInSession:o.value}),{...r,signInSession:o.value};case"SET_SIGN_IN_STATE":return ia(o.value),{...o.value};case"SET_CHALLENGE_NAME":return ia({challengeName:o.value}),{...r,challengeName:o.value};case"SET_USERNAME":return ia({username:o.value}),{...r,username:o.value};case"SET_INITIAL_STATE":return DE();case"RESET_STATE":return E0(),qb();default:return r}},EE=r=>{const o=Number(r),e=Date.now();return o<=e},pe=()=>{Xe.dispatch({type:"RESET_STATE"})},E0=()=>{for(const r of Object.values(ve))De.removeItem(r)},qb=()=>({username:void 0,challengeName:void 0,signInSession:void 0}),DE=()=>{const r=De.getItem(ve.expiry);if(!r||EE(r))return E0(),qb();const o=De.getItem(ve.username)??void 0,e=De.getItem(ve.challengeName)??void 0,d=De.getItem(ve.signInSession)??void 0;return{username:o,challengeName:e,signInSession:d}},Xe=(r=>{let o=r(qb(),{type:"SET_INITIAL_STATE"});return{getState:()=>o,dispatch:e=>{o=r(o,e)}}})(yE);function ot(r){Xe.dispatch({type:"SET_SIGN_IN_STATE",value:r})}const ia=({challengeName:r,signInSession:o,username:e})=>{e&&De.setItem(ve.username,e),r&&De.setItem(ve.challengeName,r),o&&(De.setItem(ve.signInSession,o),De.setItem(ve.expiry,String(Date.now()+AE)))};class Be extends xo{constructor(o){super(o),this.constructor=Be,Object.setPrototypeOf(this,Be.prototype)}}var Hr;(function(r){r.PasskeyNotSupported="PasskeyNotSupported",r.PasskeyAlreadyExists="PasskeyAlreadyExists",r.InvalidPasskeyRegistrationOptions="InvalidPasskeyRegistrationOptions",r.InvalidPasskeyAuthenticationOptions="InvalidPasskeyAuthenticationOptions",r.RelyingPartyMismatch="RelyingPartyMismatch",r.PasskeyRegistrationFailed="PasskeyRegistrationFailed",r.PasskeyRetrievalFailed="PasskeyRetrievalFailed",r.PasskeyRegistrationCanceled="PasskeyRegistrationCanceled",r.PasskeyAuthenticationCanceled="PasskeyAuthenticationCanceled",r.PasskeyOperationAborted="PasskeyOperationAborted"})(Hr||(Hr={}));const D0="Passkeys may not be supported on this device. Ensure your application is running in a secure context (HTTPS) and Web Authentication API is supported.",Wb="User may have canceled the ceremony or another interruption has occurred. Check underlying error for details.",v0="Ensure your user pool is configured to support the WEB_AUTHN as an authentication factor.",aa={[Hr.PasskeyNotSupported]:{message:"Passkeys may not be supported on this device.",recoverySuggestion:D0},[Hr.InvalidPasskeyRegistrationOptions]:{message:"Invalid passkey registration options.",recoverySuggestion:v0},[Hr.InvalidPasskeyAuthenticationOptions]:{message:"Invalid passkey authentication options.",recoverySuggestion:v0},[Hr.PasskeyRegistrationFailed]:{message:"Device failed to create passkey.",recoverySuggestion:D0},[Hr.PasskeyRetrievalFailed]:{message:"Device failed to retrieve passkey.",recoverySuggestion:"Passkeys may not be available on this device. Try an alternative authentication factor like PASSWORD, EMAIL_OTP, or SMS_OTP."},[Hr.PasskeyAlreadyExists]:{message:"Passkey already exists in authenticator.",recoverySuggestion:"Proceed with existing passkey or try again after deleting the credential."},[Hr.PasskeyRegistrationCanceled]:{message:"Passkey registration ceremony has been canceled.",recoverySuggestion:Wb},[Hr.PasskeyAuthenticationCanceled]:{message:"Passkey authentication ceremony has been canceled.",recoverySuggestion:Wb},[Hr.PasskeyOperationAborted]:{message:"Passkey operation has been aborted.",recoverySuggestion:Wb},[Hr.RelyingPartyMismatch]:{message:"Relying party does not match current domain.",recoverySuggestion:"Ensure relying party identifier matches current domain."}},Kb=_b(aa,Be),vE=r=>{if(r instanceof Be)return r;if(r instanceof Error&&r.name==="NotAllowedError"){const{message:o,recoverySuggestion:e}=aa[Hr.PasskeyAuthenticationCanceled];return new Be({name:Hr.PasskeyAuthenticationCanceled,message:o,recoverySuggestion:e,underlyingError:r})}return BE(r)},BE=r=>{if(r instanceof Error){if(r.name==="AbortError"){const{message:o,recoverySuggestion:e}=aa[Hr.PasskeyOperationAborted];return new Be({name:Hr.PasskeyOperationAborted,message:o,recoverySuggestion:e,underlyingError:r})}if(r.name==="SecurityError"){const{message:o,recoverySuggestion:e}=aa[Hr.RelyingPartyMismatch];return new Be({name:Hr.RelyingPartyMismatch,message:o,recoverySuggestion:e,underlyingError:r})}}return new Be({name:Ye.Unknown,message:"An unknown error has occurred.",underlyingError:r})},SE=()=>xh()&&window.isSecureContext&&"credentials"in navigator&&typeof window.PublicKeyCredential=="function",pl=r=>sl.convert(new Uint8Array(r),{urlSafe:!0,skipPadding:!0}),B0=r=>Uint8Array.from(Ib.convert(r,{urlSafe:!0}),o=>o.charCodeAt(0)).buffer,CE=r=>{const o=B0(r.challenge),e=(r.allowCredentials||[]).map(d=>({...d,id:B0(d.id)}));return{...r,challenge:o,allowCredentials:e}},_E=r=>{const o={clientDataJSON:pl(r.response.clientDataJSON),authenticatorData:pl(r.response.authenticatorData),signature:pl(r.response.signature)};r.response.userHandle&&(o.userHandle=pl(r.response.userHandle));const e={id:r.id,rawId:pl(r.rawId),type:r.type,clientExtensionResults:r.getClientExtensionResults(),response:o};return r.authenticatorAttachment&&(e.authenticatorAttachment=r.authenticatorAttachment),e};function IE(r){Kb(r&&r instanceof PublicKeyCredential&&r.response instanceof AuthenticatorAssertionResponse,Hr.PasskeyRetrievalFailed)}const TE=async r=>{try{const o=SE();Kb(o,Hr.PasskeyNotSupported);const e=CE(r),d=await navigator.credentials.get({publicKey:e});return IE(d),_E(d)}catch(o){throw vE(o)}},NE=r=>no(So,Bo("ConfirmDevice"),Lo(),{...Co,...r}),wa={convert(r){return new TextEncoder().encode(r)}};function rr(r,o){r!=null&&this.fromString(r,o)}function po(){return new rr(null,null)}let Je;const S0=(0xdeadbeefcafe&16777215)===15715070;function PE(r,o,e,d,t,l){for(;--l>=0;){const i=o*this[r++]+e[d]+t;t=Math.floor(i/67108864),e[d++]=i&67108863}return t}function RE(r,o,e,d,t,l){const i=o&32767,a=o>>15;for(;--l>=0;){let w=this[r]&32767;const b=this[r++]>>15,s=a*w+b*i;w=i*w+((s&32767)<<15)+e[d]+(t&1073741823),t=(w>>>30)+(s>>>15)+a*b+(t>>>30),e[d++]=w&1073741823}return t}function OE(r,o,e,d,t,l){const i=o&16383,a=o>>14;for(;--l>=0;){let w=this[r]&16383;const b=this[r++]>>14,s=a*w+b*i;w=i*w+((s&16383)<<14)+e[d]+t,t=(w>>28)+(s>>14)+a*b,e[d++]=w&268435455}return t}const C0=typeof navigator<"u";C0&&S0&&navigator.appName==="Microsoft Internet Explorer"?(rr.prototype.am=RE,Je=30):C0&&S0&&navigator.appName!=="Netscape"?(rr.prototype.am=PE,Je=26):(rr.prototype.am=OE,Je=28),rr.prototype.DB=Je,rr.prototype.DM=(1<<Je)-1,rr.prototype.DV=1<<Je;const Yb=52;rr.prototype.FV=Math.pow(2,Yb),rr.prototype.F1=Yb-Je,rr.prototype.F2=2*Je-Yb;const ME="0123456789abcdefghijklmnopqrstuvwxyz",ba=[];let et,Uo;for(et=48,Uo=0;Uo<=9;++Uo)ba[et++]=Uo;for(et=97,Uo=10;Uo<36;++Uo)ba[et++]=Uo;for(et=65,Uo=10;Uo<36;++Uo)ba[et++]=Uo;function _0(r){return ME.charAt(r)}function $E(r,o){const e=ba[r.charCodeAt(o)];return e??-1}function jE(r){for(let o=this.t-1;o>=0;--o)r[o]=this[o];r.t=this.t,r.s=this.s}function LE(r){this.t=1,this.s=r<0?-1:0,r>0?this[0]=r:r<-1?this[0]=r+this.DV:this.t=0}function Gb(r){const o=po();return o.fromInt(r),o}function UE(r,o){let e;if(o===16)e=4;else if(o===8)e=3;else if(o===2)e=1;else if(o===32)e=5;else if(o===4)e=2;else throw new Error("Only radix 2, 4, 8, 16, 32 are supported");this.t=0,this.s=0;let d=r.length,t=!1,l=0;for(;--d>=0;){const i=$E(r,d);if(i<0){r.charAt(d)==="-"&&(t=!0);continue}t=!1,l===0?this[this.t++]=i:l+e>this.DB?(this[this.t-1]|=(i&(1<<this.DB-l)-1)<<l,this[this.t++]=i>>this.DB-l):this[this.t-1]|=i<<l,l+=e,l>=this.DB&&(l-=this.DB)}this.clamp(),t&&rr.ZERO.subTo(this,this)}function zE(){const r=this.s&this.DM;for(;this.t>0&&this[this.t-1]==r;)--this.t}function VE(r){if(this.s<0)return"-"+this.negate().toString(r);let o;if(r==16)o=4;else if(r===8)o=3;else if(r===2)o=1;else if(r===32)o=5;else if(r===4)o=2;else throw new Error("Only radix 2, 4, 8, 16, 32 are supported");const e=(1<<o)-1;let d,t=!1,l="",i=this.t,a=this.DB-i*this.DB%o;if(i-- >0)for(a<this.DB&&(d=this[i]>>a)>0&&(t=!0,l=_0(d));i>=0;)a<o?(d=(this[i]&(1<<a)-1)<<o-a,d|=this[--i]>>(a+=this.DB-o)):(d=this[i]>>(a-=o)&e,a<=0&&(a+=this.DB,--i)),d>0&&(t=!0),t&&(l+=_0(d));return t?l:"0"}function HE(){const r=po();return rr.ZERO.subTo(this,r),r}function qE(){return this.s<0?this.negate():this}function WE(r){let o=this.s-r.s;if(o!=0)return o;let e=this.t;if(o=e-r.t,o!=0)return this.s<0?-o:o;for(;--e>=0;)if((o=this[e]-r[e])!=0)return o;return 0}function Xb(r){let o=1,e;return(e=r>>>16)!==0&&(r=e,o+=16),(e=r>>8)!==0&&(r=e,o+=8),(e=r>>4)!==0&&(r=e,o+=4),(e=r>>2)!==0&&(r=e,o+=2),(e=r>>1)!==0&&(r=e,o+=1),o}function KE(){return this.t<=0?0:this.DB*(this.t-1)+Xb(this[this.t-1]^this.s&this.DM)}function YE(r,o){let e;for(e=this.t-1;e>=0;--e)o[e+r]=this[e];for(e=r-1;e>=0;--e)o[e]=0;o.t=this.t+r,o.s=this.s}function GE(r,o){for(let e=r;e<this.t;++e)o[e-r]=this[e];o.t=Math.max(this.t-r,0),o.s=this.s}function XE(r,o){const e=r%this.DB,d=this.DB-e,t=(1<<d)-1,l=Math.floor(r/this.DB);let i=this.s<<e&this.DM,a;for(a=this.t-1;a>=0;--a)o[a+l+1]=this[a]>>d|i,i=(this[a]&t)<<e;for(a=l-1;a>=0;--a)o[a]=0;o[l]=i,o.t=this.t+l+1,o.s=this.s,o.clamp()}function JE(r,o){o.s=this.s;const e=Math.floor(r/this.DB);if(e>=this.t){o.t=0;return}const d=r%this.DB,t=this.DB-d,l=(1<<d)-1;o[0]=this[e]>>d;for(let i=e+1;i<this.t;++i)o[i-e-1]|=(this[i]&l)<<t,o[i-e]=this[i]>>d;d>0&&(o[this.t-e-1]|=(this.s&l)<<t),o.t=this.t-e,o.clamp()}function ZE(r,o){let e=0,d=0;const t=Math.min(r.t,this.t);for(;e<t;)d+=this[e]-r[e],o[e++]=d&this.DM,d>>=this.DB;if(r.t<this.t){for(d-=r.s;e<this.t;)d+=this[e],o[e++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;e<r.t;)d-=r[e],o[e++]=d&this.DM,d>>=this.DB;d-=r.s}o.s=d<0?-1:0,d<-1?o[e++]=this.DV+d:d>0&&(o[e++]=d),o.t=e,o.clamp()}function QE(r,o){const e=this.abs(),d=r.abs();let t=e.t;for(o.t=t+d.t;--t>=0;)o[t]=0;for(t=0;t<d.t;++t)o[t+e.t]=e.am(0,d[t],o,t,0,e.t);o.s=0,o.clamp(),this.s!==r.s&&rr.ZERO.subTo(o,o)}function rD(r){const o=this.abs();let e=r.t=2*o.t;for(;--e>=0;)r[e]=0;for(e=0;e<o.t-1;++e){const d=o.am(e,o[e],r,2*e,0,1);(r[e+o.t]+=o.am(e+1,2*o[e],r,2*e+1,d,o.t-e-1))>=o.DV&&(r[e+o.t]-=o.DV,r[e+o.t+1]=1)}r.t>0&&(r[r.t-1]+=o.am(e,o[e],r,2*e,0,1)),r.s=0,r.clamp()}function oD(r,o,e){const d=r.abs();if(d.t<=0)return;const t=this.abs();if(t.t<d.t){o?.fromInt(0),e!=null&&this.copyTo(e);return}e===null&&(e=po());const l=po(),i=this.s,a=r.s,w=this.DB-Xb(d[d.t-1]);w>0?(d.lShiftTo(w,l),t.lShiftTo(w,e)):(d.copyTo(l),t.copyTo(e));const b=l.t,s=l[b-1];if(s===0)return;const n=s*(1<<this.F1)+(b>1?l[b-2]>>this.F2:0),f=this.FV/n,m=(1<<this.F1)/n,h=1<<this.F2;let p=e.t,x=p-b;const g=o===null?po():o;for(l.dlShiftTo(x,g),e.compareTo(g)>=0&&(e[e.t++]=1,e.subTo(g,e)),rr.ONE.dlShiftTo(b,g),g.subTo(l,l);l.t<b;)l[l.t++]=0;for(;--x>=0;){let E=e[--p]===s?this.DM:Math.floor(e[p]*f+(e[p-1]+h)*m);if((e[p]+=l.am(0,E,e,x,0,b))<E)for(l.dlShiftTo(x,g),e.subTo(g,e);e[p]<--E;)e.subTo(g,e)}o!==null&&(e.drShiftTo(b,o),i!==a&&rr.ZERO.subTo(o,o)),e.t=b,e.clamp(),w>0&&e.rShiftTo(w,e),i<0&&rr.ZERO.subTo(e,e)}function eD(r){const o=po();return this.abs().divRemTo(r,null,o),this.s<0&&o.compareTo(rr.ZERO)>0&&r.subTo(o,o),o}function dD(){if(this.t<1)return 0;const r=this[0];if((r&1)===0)return 0;let o=r&3;return o=o*(2-(r&15)*o)&15,o=o*(2-(r&255)*o)&255,o=o*(2-((r&65535)*o&65535))&65535,o=o*(2-r*o%this.DV)%this.DV,o>0?this.DV-o:-o}function tD(r){return this.compareTo(r)===0}function lD(r,o){let e=0,d=0;const t=Math.min(r.t,this.t);for(;e<t;)d+=this[e]+r[e],o[e++]=d&this.DM,d>>=this.DB;if(r.t<this.t){for(d+=r.s;e<this.t;)d+=this[e],o[e++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;e<r.t;)d+=r[e],o[e++]=d&this.DM,d>>=this.DB;d+=r.s}o.s=d<0?-1:0,d>0?o[e++]=d:d<-1&&(o[e++]=this.DV+d),o.t=e,o.clamp()}function iD(r){const o=po();return this.addTo(r,o),o}function aD(r){const o=po();return this.subTo(r,o),o}function wD(r){const o=po();return this.multiplyTo(r,o),o}function bD(r){const o=po();return this.divRemTo(r,o,null),o}function dt(r){this.m=r,this.mp=r.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<r.DB-15)-1,this.mt2=2*r.t}function sD(r){const o=po();return r.abs().dlShiftTo(this.m.t,o),o.divRemTo(this.m,null,o),r.s<0&&o.compareTo(rr.ZERO)>0&&this.m.subTo(o,o),o}function nD(r){const o=po();return r.copyTo(o),this.reduce(o),o}function pD(r){for(;r.t<=this.mt2;)r[r.t++]=0;for(let o=0;o<this.m.t;++o){let e=r[o]&32767;const d=e*this.mpl+((e*this.mph+(r[o]>>15)*this.mpl&this.um)<<15)&r.DM;for(e=o+this.m.t,r[e]+=this.m.am(0,d,r,o,0,this.m.t);r[e]>=r.DV;)r[e]-=r.DV,r[++e]++}r.clamp(),r.drShiftTo(this.m.t,r),r.compareTo(this.m)>=0&&r.subTo(this.m,r)}function fD(r,o){r.squareTo(o),this.reduce(o)}function hD(r,o,e){r.multiplyTo(o,e),this.reduce(e)}dt.prototype.convert=sD,dt.prototype.revert=nD,dt.prototype.reduce=pD,dt.prototype.mulTo=hD,dt.prototype.sqrTo=fD;function mD(r,o,e){let d=r.bitLength(),t,l=Gb(1);const i=new dt(o);if(d<=0)return l;d<18?t=1:d<48?t=3:d<144?t=4:d<768?t=5:t=6;const a=[];let w=3;const b=t-1,s=(1<<t)-1;if(a[1]=i.convert(this),t>1){const g=po();for(i.sqrTo(a[1],g);w<=s;)a[w]=po(),i.mulTo(g,a[w-2],a[w]),w+=2}let n=r.t-1,f,m=!0,h=po(),p;for(d=Xb(r[n])-1;n>=0;){for(d>=b?f=r[n]>>d-b&s:(f=(r[n]&(1<<d+1)-1)<<b-d,n>0&&(f|=r[n-1]>>this.DB+d-b)),w=t;(f&1)===0;)f>>=1,--w;if((d-=w)<0&&(d+=this.DB,--n),m)a[f].copyTo(l),m=!1;else{for(;w>1;)i.sqrTo(l,h),i.sqrTo(h,l),w-=2;w>0?i.sqrTo(l,h):(p=l,l=h,h=p),i.mulTo(h,a[f],l)}for(;n>=0&&(r[n]&1<<d)===0;)i.sqrTo(l,h),p=l,l=h,h=p,--d<0&&(d=this.DB-1,--n)}const x=i.revert(l);return e(null,x),x}rr.prototype.copyTo=jE,rr.prototype.fromInt=LE,rr.prototype.fromString=UE,rr.prototype.clamp=zE,rr.prototype.dlShiftTo=YE,rr.prototype.drShiftTo=GE,rr.prototype.lShiftTo=XE,rr.prototype.rShiftTo=JE,rr.prototype.subTo=ZE,rr.prototype.multiplyTo=QE,rr.prototype.squareTo=rD,rr.prototype.divRemTo=oD,rr.prototype.invDigit=dD,rr.prototype.addTo=lD,rr.prototype.toString=VE,rr.prototype.negate=HE,rr.prototype.abs=qE,rr.prototype.compareTo=WE,rr.prototype.bitLength=KE,rr.prototype.mod=eD,rr.prototype.equals=tD,rr.prototype.add=iD,rr.prototype.subtract=aD,rr.prototype.multiply=wD,rr.prototype.divide=bD,rr.prototype.modPow=mD,rr.ZERO=Gb(0),rr.ONE=Gb(1);const kD=async({a:r,g:o,k:e,x:d,B:t,N:l,U:i})=>new Promise((a,w)=>{o.modPow(d,l,(b,s)=>{if(b){w(b);return}t.subtract(e.multiply(s)).modPow(r.add(i.multiply(d)),l,(n,f)=>{if(n){w(n);return}a(f.mod(l))})})}),xD="FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF",I0={},Jb={};for(let r=0;r<256;r++){let o=r.toString(16).toLowerCase();o.length===1&&(o=`0${o}`),I0[r]=o,Jb[o]=r}const tt=r=>{if(r.length%2!==0)throw new Error("Hex encoded strings must have an even number length");const o=new Uint8Array(r.length/2);for(let e=0;e<r.length;e+=2){const d=r.slice(e,e+2).toLowerCase();if(d in Jb)o[e/2]=Jb[d];else throw new Error(`Cannot decode unrecognized sequence ${d} as hexadecimal`)}return o},Zb=r=>{let o="";for(let e=0;e<r.byteLength;e++)o+=I0[r[e]];return o},Qb=r=>{const o=new Ji;o.update(r);const e=o.digestSync(),d=Zb(e);return new Array(64-d.length).join("0")+d},sa=r=>Qb(tt(r)),gD=/^[89a-f]/i,Se=r=>{if(!(r instanceof rr))throw new Error("Not a BigInteger");const o=r.compareTo(rr.ZERO)<0;let e=r.abs().toString(16);if(e=e.length%2!==0?`0${e}`:e,e=gD.test(e)?`00${e}`:e,o){const d=e.split("").map(l=>{const i=~parseInt(l,16)&15;return"0123456789ABCDEF".charAt(i)}).join("");e=new rr(d,16).add(rr.ONE).toString(16),e.toUpperCase().startsWith("FF8")&&(e=e.substring(2))}return e},cD=({A:r,B:o})=>{const e=new rr(sa(Se(r)+Se(o)),16);if(e.equals(rr.ZERO))throw new Error("U cannot be zero.");return e},uD=(r,o,e)=>{const d=new Ji(o);d.update(r);const t=d.digestSync(),l=new Ji(t);return l.update(e),l.digestSync().slice(0,16)},r4=r=>{const o=new Lb().random(r).toString();return tt(o)},FD=()=>sl.convert(r4(40));class AD{constructor({userPoolName:o,a:e,g:d,A:t,N:l}){this.encoder=wa,this.userPoolName=o,this.a=e,this.g=d,this.A=t,this.N=l,this.k=new rr(sa(`${Se(l)}${Se(d)}`),16)}getRandomPassword(){if(!this.randomPassword)throw new ar({name:"EmptyBigIntegerRandomPassword",message:"random password is empty"});return this.randomPassword}getSaltToHashDevices(){if(!this.saltToHashDevices)throw new ar({name:"EmptyBigIntegersaltToHashDevices",message:"saltToHashDevices is empty"});return this.saltToHashDevices}getVerifierDevices(){if(!this.verifierDevices)throw new ar({name:"EmptyBigIntegerVerifierDevices",message:"verifyDevices is empty"});return this.verifierDevices}async generateHashDevice(o,e){this.randomPassword=FD();const d=`${o}${e}:${this.randomPassword}`,t=Qb(d),l=Zb(r4(16));return this.saltToHashDevices=Se(new rr(l,16)),new Promise((i,a)=>{this.g.modPow(new rr(sa(this.saltToHashDevices+t),16),this.N,(w,b)=>{if(w){a(w);return}this.verifierDevices=Se(b),i()})})}async getPasswordAuthenticationKey({username:o,password:e,serverBValue:d,salt:t}){if(d.mod(this.N).equals(rr.ZERO))throw new Error("B cannot be zero.");const l=cD({A:this.A,B:d}),i=`${this.userPoolName}${o}:${e}`,a=Qb(i),w=new rr(sa(Se(t)+a),16),b=await kD({a:this.a,g:this.g,k:this.k,x:w,B:d,N:this.N,U:l}),s=this.encoder.convert("Caldera Derived Key"),n=this.encoder.convert(""),f=new Uint8Array(s.byteLength+n.byteLength);return f.set(s,0),f.set(n,s.byteLength),uD(tt(Se(b)),tt(Se(l)),f)}}const yD=async({a:r,g:o,N:e})=>new Promise((d,t)=>{o.modPow(r,e,(l,i)=>{if(l){t(l);return}if(i.mod(e).equals(rr.ZERO)){t(new Error("Illegal parameter. A mod N cannot be 0."));return}d(i)})}),na=async r=>{const o=new rr(xD,16),e=new rr("2",16),d=ED(),t=await yD({a:d,g:e,N:o});return new AD({userPoolName:r,a:d,g:e,A:t,N:o})},ED=()=>{const r=Zb(r4(128));return new rr(r,16)};async function lt({userPoolId:r,userPoolEndpoint:o,newDeviceMetadata:e,accessToken:d}){if(!e)return;const t=r.split("_")[1]||"",l=await na(t),i=e?.DeviceKey,a=e?.DeviceGroupKey;try{await l.generateHashDevice(a??"",i??"")}catch{return}const w={Salt:sl.convert(tt(l.getSaltToHashDevices())),PasswordVerifier:sl.convert(tt(l.getVerifierDevices()))},b=l.getRandomPassword();try{return await NE({endpointResolver:Yr({endpointOverride:o})})({region:Kr(r)},{AccessToken:d,DeviceName:await $7(),DeviceKey:e?.DeviceKey,DeviceSecretVerifierConfig:w}),{deviceKey:i,deviceGroupKey:a,randomPassword:b}}catch{return}}async function DD(r){const o=Tr.getConfig().Auth?.Cognito;Br(o);const{username:e,signInSession:d,signInDetails:t,challengeName:l}=Xe.getState();if(l!=="WEB_AUTHN"||!e)throw new ar({name:Jd.SignInException,message:"Unable to proceed due to invalid sign in state."});const{CREDENTIAL_REQUEST_OPTIONS:i}=r;Kb(!!i,Hr.InvalidPasskeyAuthenticationOptions);const a=await TE(JSON.parse(i)),w=da({endpointResolver:Yr({endpointOverride:o.userPoolEndpoint})}),{ChallengeName:b,ChallengeParameters:s,AuthenticationResult:n,Session:f}=await w({region:Kr(o.userPoolId),userAgentValue:go(wo.ConfirmSignIn)},{ChallengeName:"WEB_AUTHN",ChallengeResponses:{USERNAME:e,CREDENTIAL:JSON.stringify(a)},ClientId:o.userPoolClientId,Session:d});if(ot({signInSession:f,username:e,challengeName:b,signInDetails:t}),n)return await Qd({...n,username:e,NewDeviceMetadata:await lt({userPoolId:o.userPoolId,userPoolEndpoint:o.userPoolEndpoint,newDeviceMetadata:n.NewDeviceMetadata,accessToken:n.AccessToken}),signInDetails:t}),Xe.dispatch({type:"RESET_STATE"}),await rt(),{isSignedIn:!0,nextStep:{signInStep:"DONE"}};if(b==="WEB_AUTHN")throw new ar({name:Jd.SignInException,message:"Sequential WEB_AUTHN challenges returned from underlying service cannot be handled."});return{challengeName:b,challengeParameters:s}}function zo({username:r,userPoolId:o,userPoolClientId:e}){if(typeof window>"u")return;const d=window.AmazonCognitoAdvancedSecurityData;if(typeof d>"u")return;const t=d.getData(r,o,e);return t?{EncodedData:t}:{}}const vD=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],BD=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],T0=()=>{const r=new Date,o=BD[r.getUTCDay()],e=vD[r.getUTCMonth()],d=r.getUTCDate();let t=r.getUTCHours();t<10&&(t=`0${t}`);let l=r.getUTCMinutes();l<10&&(l=`0${l}`);let i=r.getUTCSeconds();i<10&&(i=`0${i}`);const a=r.getUTCFullYear();return`${o} ${e} ${d} ${t}:${l}:${i} UTC ${a}`},N0=({userPoolName:r,username:o,challengeParameters:e,dateNow:d,hkdf:t})=>{const l=wa.convert(r),i=wa.convert(o),a=SD(e.SECRET_BLOCK),w=wa.convert(d),b=new Uint8Array(l.byteLength+i.byteLength+a.byteLength+w.byteLength);b.set(l,0),b.set(i,l.byteLength),b.set(a,l.byteLength+i.byteLength),b.set(w,l.byteLength+i.byteLength+a.byteLength);const s=new Ji(t);s.update(b);const n=s.digestSync();return sl.convert(n)},SD=r=>{const o="=".repeat((4-r.length%4)%4),e=(r+o).replace(/-/g,"+").replace(/_/g,"/"),d=Ib.convert(e),t=new Uint8Array(d.length);for(let l=0;l<d.length;++l)t[l]=d.charCodeAt(l);return t};async function o4({username:r,config:o,clientMetadata:e,session:d,tokenOrchestrator:t}){const{userPoolId:l,userPoolEndpoint:i}=o,a=o.userPoolClientId,w=await t?.getDeviceMetadata(r);m0(w);const b=await na(w.deviceGroupKey),s={USERNAME:r,SRP_A:b.A.toString(16),DEVICE_KEY:w.deviceKey},n={ChallengeName:"DEVICE_SRP_AUTH",ClientId:a,ChallengeResponses:s,ClientMetadata:e,Session:d},f=da({endpointResolver:Yr({endpointOverride:i})}),{ChallengeParameters:m,Session:h}=await f({region:Kr(l)},n);return CD(r,m,e,h,b,o,t)}async function CD(r,o,e,d,t,{userPoolId:l,userPoolClientId:i,userPoolEndpoint:a},w){const b=await w?.getDeviceMetadata(r);m0(b);const s=new rr(o?.SRP_B,16),n=new rr(o?.SALT,16),{deviceKey:f}=b,{deviceGroupKey:m}=b,h=await t.getPasswordAuthenticationKey({username:b.deviceKey,password:b.randomPassword,serverBValue:s,salt:n}),p=T0(),x={USERNAME:o?.USERNAME??r,PASSWORD_CLAIM_SECRET_BLOCK:o?.SECRET_BLOCK,TIMESTAMP:p,PASSWORD_CLAIM_SIGNATURE:N0({username:f,userPoolName:m,challengeParameters:o,dateNow:p,hkdf:h}),DEVICE_KEY:f},g=zo({username:r,userPoolId:l,userPoolClientId:i}),E={ChallengeName:"DEVICE_PASSWORD_VERIFIER",ClientId:i,ChallengeResponses:x,Session:d,ClientMetadata:e,UserContextData:g};return da({endpointResolver:Yr({endpointOverride:a})})({region:Kr(l)},E)}async function P0(r,o,e,d,t,l,i){const{userPoolId:a,userPoolClientId:w,userPoolEndpoint:b}=l,s=a?.split("_")[1]||"",n=new rr(o?.SRP_B,16),f=new rr(o?.SALT,16),m=o?.USER_ID_FOR_SRP;if(!m)throw new ar({name:"EmptyUserIdForSRPException",message:"USER_ID_FOR_SRP was not found in challengeParameters"});const h=await t.getPasswordAuthenticationKey({username:m,password:r,serverBValue:n,salt:f}),p=T0(),x={USERNAME:m,PASSWORD_CLAIM_SECRET_BLOCK:o?.SECRET_BLOCK,TIMESTAMP:p,PASSWORD_CLAIM_SIGNATURE:N0({username:m,userPoolName:s,challengeParameters:o,dateNow:p,hkdf:h})},g=await i.getDeviceMetadata(m);g&&g.deviceKey&&(x.DEVICE_KEY=g.deviceKey);const E=zo({username:m,userPoolId:a,userPoolClientId:w}),D={ChallengeName:"PASSWORD_VERIFIER",ChallengeResponses:x,ClientMetadata:e,Session:d,ClientId:w,UserContextData:E},u=await da({endpointResolver:Yr({endpointOverride:b})})({region:Kr(a)},D);return u.ChallengeName==="DEVICE_SRP_AUTH"?o4({username:m,config:l,clientMetadata:e,session:u.Session,tokenOrchestrator:i}):u}async function pa(r,o,e,d){try{return await r(...o)}catch(t){if(t instanceof ar&&t.name==="ResourceNotFoundException"&&t.message.includes("Device does not exist."))return await d.clearDeviceMetadata(e),r(...o);throw t}}function fl(r){const{dispatch:o}=Xe;o({type:"SET_USERNAME",value:r})}async function R0({username:r,password:o,clientMetadata:e,config:d,tokenOrchestrator:t,authFlow:l,preferredChallenge:i}){const{userPoolId:a,userPoolClientId:w,userPoolEndpoint:b}=d,s=a?.split("_")[1]||"",n=await na(s),f={USERNAME:r,SRP_A:n.A.toString(16)};l==="USER_AUTH"&&i&&(f.PREFERRED_CHALLENGE=i);const m=zo({username:r,userPoolId:a,userPoolClientId:w}),h={AuthFlow:l,AuthParameters:f,ClientMetadata:e,ClientId:w,UserContextData:m},x=await nl({endpointResolver:Yr({endpointOverride:b})})({region:Kr(a),userAgentValue:go(wo.SignIn)},h),{ChallengeParameters:g,Session:E}=x,D=g?.USERNAME??r;return fl(D),x.ChallengeName==="PASSWORD_VERIFIER"?pa(P0,[o,g,e,E,n,d,t],D,t):x}const O0="userAttributes.";function _D(r){return"isSignedIn"in r&&"nextStep"in r}async function ID(r,o,e,d,t){const{userPoolClientId:l,userPoolId:i,userPoolEndpoint:a}=d,w={USERNAME:r,PASSWORD:o},b=await t.getDeviceMetadata(r);b&&b.deviceKey&&(w.DEVICE_KEY=b.deviceKey);const s=zo({username:r,userPoolId:i,userPoolClientId:l}),n={AuthFlow:"USER_PASSWORD_AUTH",AuthParameters:w,ClientMetadata:e,ClientId:l,UserContextData:s},m=await nl({endpointResolver:Yr({endpointOverride:a})})({region:Kr(i),userAgentValue:go(wo.SignIn)},n),h=m.ChallengeParameters?.USERNAME??m.ChallengeParameters?.USER_ID_FOR_SRP??r;return fl(h),m.ChallengeName==="DEVICE_SRP_AUTH"?o4({username:h,config:d,clientMetadata:e,session:m.Session,tokenOrchestrator:t}):m}async function TD(r,o,e,d,t){return R0({username:r,password:o,clientMetadata:e,config:d,tokenOrchestrator:t,authFlow:"USER_SRP_AUTH"})}async function ND(r,o,e,d){const{userPoolClientId:t,userPoolId:l,userPoolEndpoint:i}=e,a={USERNAME:r},w=await d.getDeviceMetadata(r);w&&w.deviceKey&&(a.DEVICE_KEY=w.deviceKey);const b=zo({username:r,userPoolId:l,userPoolClientId:t}),s={AuthFlow:"CUSTOM_AUTH",AuthParameters:a,ClientMetadata:o,ClientId:t,UserContextData:b},f=await nl({endpointResolver:Yr({endpointOverride:i})})({region:Kr(l),userAgentValue:go(wo.SignIn)},s),m=f.ChallengeParameters?.USERNAME??r;return fl(m),f.ChallengeName==="DEVICE_SRP_AUTH"?o4({username:m,config:e,clientMetadata:o,session:f.Session,tokenOrchestrator:d}):f}async function PD(r,o,e,d,t){Br(d);const{userPoolId:l,userPoolClientId:i,userPoolEndpoint:a}=d,w=l?.split("_")[1]||"",b=await na(w),s={USERNAME:r,SRP_A:b.A.toString(16),CHALLENGE_NAME:"SRP_A"},n=zo({username:r,userPoolId:l,userPoolClientId:i}),f={AuthFlow:"CUSTOM_AUTH",AuthParameters:s,ClientMetadata:e,ClientId:i,UserContextData:n},m=nl({endpointResolver:Yr({endpointOverride:a})}),{ChallengeParameters:h,Session:p}=await m({region:Kr(l),userAgentValue:go(wo.SignIn)},f),x=h?.USERNAME??r;return fl(x),pa(P0,[o,h,e,p,b,d,t],x,t)}async function it(r){const{challengeName:o,challengeParameters:e,availableChallenges:d}=r,t=Tr.getConfig().Auth?.Cognito;switch(Br(t),o){case"CUSTOM_CHALLENGE":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_CUSTOM_CHALLENGE",additionalInfo:e}};case"MFA_SETUP":{const{signInSession:l,username:i}=Xe.getState(),a=M0($0(e.MFAS_CAN_SETUP))||[],w=$D(a),b=w.includes("TOTP"),s=w.includes("EMAIL");if(b&&s)return{isSignedIn:!1,nextStep:{signInStep:"CONTINUE_SIGN_IN_WITH_MFA_SETUP_SELECTION",allowedMFATypes:w}};if(s)return{isSignedIn:!1,nextStep:{signInStep:"CONTINUE_SIGN_IN_WITH_EMAIL_SETUP"}};if(b){const n=sE({endpointResolver:Yr({endpointOverride:t.userPoolEndpoint})}),{Session:f,SecretCode:m}=await n({region:Kr(t.userPoolId)},{Session:l});return Xe.dispatch({type:"SET_SIGN_IN_SESSION",value:f}),{isSignedIn:!1,nextStep:{signInStep:"CONTINUE_SIGN_IN_WITH_TOTP_SETUP",totpSetupDetails:RD(m,i)}}}throw new ar({name:Jd.SignInException,message:`Cannot initiate MFA setup from available types: ${a}`})}case"NEW_PASSWORD_REQUIRED":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_NEW_PASSWORD_REQUIRED",missingAttributes:OD(e.requiredAttributes)}};case"SELECT_MFA_TYPE":return{isSignedIn:!1,nextStep:{signInStep:"CONTINUE_SIGN_IN_WITH_MFA_SELECTION",allowedMFATypes:M0($0(e.MFAS_CAN_CHOOSE))}};case"SMS_OTP":case"SMS_MFA":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_SMS_CODE",codeDeliveryDetails:{deliveryMedium:e.CODE_DELIVERY_DELIVERY_MEDIUM,destination:e.CODE_DELIVERY_DESTINATION}}};case"SOFTWARE_TOKEN_MFA":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_TOTP_CODE"}};case"EMAIL_OTP":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_EMAIL_CODE",codeDeliveryDetails:{deliveryMedium:e.CODE_DELIVERY_DELIVERY_MEDIUM,destination:e.CODE_DELIVERY_DESTINATION}}};case"WEB_AUTHN":{const l=await DD(e);return _D(l)?l:it(l)}case"PASSWORD":case"PASSWORD_SRP":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_PASSWORD"}};case"SELECT_CHALLENGE":return{isSignedIn:!1,nextStep:{signInStep:"CONTINUE_SIGN_IN_WITH_FIRST_FACTOR_SELECTION",availableChallenges:d}}}throw new ar({name:Jd.SignInException,message:`An error occurred during the sign in process. ${o} challengeName returned by the underlying service was not addressed.`})}function RD(r,o){return{sharedSecret:r,getSetupUri:(e,d)=>{const t=`otpauth://totp/${e}:${d??o}?secret=${r}&issuer=${e}`;return new al(t)}}}function hl(r){if(r===oa.PasswordResetRequiredException)return{isSignedIn:!1,nextStep:{signInStep:"RESET_PASSWORD"}};if(r===oa.UserNotConfirmedException)return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_UP"}}}function OD(r){return r?JSON.parse(r).map(e=>e.includes(O0)?e.replace(O0,""):e):[]}function MD(r){if(r==="SMS_MFA")return"SMS";if(r==="SOFTWARE_TOKEN_MFA")return"TOTP";if(r==="EMAIL_OTP")return"EMAIL"}function M0(r){if(r)return r.map(MD).filter(Boolean)}function $0(r){return r?JSON.parse(r):[]}function $D(r){return r.filter(o=>o==="EMAIL"||o==="TOTP")}async function jD(){let r;try{r=await x0()}catch{}if(r&&r.userId&&r.username)throw new ar({name:z7,message:"There is already a signed in user.",recoverySuggestion:"Call signOut before calling signIn again."})}function ml(r){return Xe.getState().username??r}async function LD(r){const o=Tr.getConfig().Auth?.Cognito;Br(o);const{username:e,password:d,options:t}=r,l={loginId:e,authFlowType:"CUSTOM_WITHOUT_SRP"},i=t?.clientMetadata;Vr(!!e,nr.EmptySignInUsername),Vr(!d,nr.CustomAuthSignInPassword);try{const{ChallengeName:a,ChallengeParameters:w,AuthenticationResult:b,Session:s}=await pa(ND,[e,i,o,_o],e,_o),n=ml(e);return ot({signInSession:s,username:n,challengeName:a,signInDetails:l}),b?(await Qd({username:n,...b,NewDeviceMetadata:await lt({userPoolId:o.userPoolId,userPoolEndpoint:o.userPoolEndpoint,newDeviceMetadata:b.NewDeviceMetadata,accessToken:b.AccessToken}),signInDetails:l}),pe(),await rt(),{isSignedIn:!0,nextStep:{signInStep:"DONE"}}):it({challengeName:a,challengeParameters:w})}catch(a){pe(),Qo(a);const w=hl(a.name);if(w)return w;throw a}}async function UD(r){const{username:o,password:e,options:d}=r,t={loginId:o,authFlowType:"CUSTOM_WITH_SRP"},l=Tr.getConfig().Auth?.Cognito;Br(l);const i=d?.clientMetadata;Vr(!!o,nr.EmptySignInUsername),Vr(!!e,nr.EmptySignInPassword);try{const{ChallengeName:a,ChallengeParameters:w,AuthenticationResult:b,Session:s}=await PD(o,e,i,l,_o),n=ml(o);return ot({signInSession:s,username:n,challengeName:a,signInDetails:t}),b?(await Qd({username:n,...b,NewDeviceMetadata:await lt({userPoolId:l.userPoolId,userPoolEndpoint:l.userPoolEndpoint,newDeviceMetadata:b.NewDeviceMetadata,accessToken:b.AccessToken}),signInDetails:t}),pe(),await rt(),{isSignedIn:!0,nextStep:{signInStep:"DONE"}}):it({challengeName:a,challengeParameters:w})}catch(a){pe(),Qo(a);const w=hl(a.name);if(w)return w;throw a}}const j0=async()=>{throw new ar({name:f0,message:"The autoSignIn flow has not started, or has been cancelled/completed.",recoverySuggestion:"Please try to use the signIn API or log out before starting a new autoSignIn flow."})};let e4=j0;function d4(r){e4=r}function co(r=!0){r&&(e4=j0),Ge.dispatch({type:"RESET"})}async function L0(r){const{username:o,password:e}=r,d=Tr.getConfig().Auth?.Cognito,t={loginId:o,authFlowType:"USER_SRP_AUTH"};Br(d);const l=r.options?.clientMetadata;Vr(!!o,nr.EmptySignInUsername),Vr(!!e,nr.EmptySignInPassword);try{const{ChallengeName:i,ChallengeParameters:a,AuthenticationResult:w,Session:b}=await TD(o,e,l,d,_o),s=ml(o);return ot({signInSession:b,username:s,challengeName:i,signInDetails:t}),w?(await Qd({username:s,...w,NewDeviceMetadata:await lt({userPoolId:d.userPoolId,userPoolEndpoint:d.userPoolEndpoint,newDeviceMetadata:w.NewDeviceMetadata,accessToken:w.AccessToken}),signInDetails:t}),pe(),await rt(),co(),{isSignedIn:!0,nextStep:{signInStep:"DONE"}}):it({challengeName:i,challengeParameters:a})}catch(i){pe(),co(),Qo(i);const a=hl(i.name);if(a)return a;throw i}}async function zD(r){const{username:o,password:e,options:d}=r,t=Tr.getConfig().Auth?.Cognito,l={loginId:o,authFlowType:"USER_PASSWORD_AUTH"};Br(t);const i=d?.clientMetadata;Vr(!!o,nr.EmptySignInUsername),Vr(!!e,nr.EmptySignInPassword);try{const{ChallengeName:a,ChallengeParameters:w,AuthenticationResult:b,Session:s}=await pa(ID,[o,e,i,t,_o],o,_o),n=ml(o);return ot({signInSession:s,username:n,challengeName:a,signInDetails:l}),b?(await Qd({...b,username:n,NewDeviceMetadata:await lt({userPoolId:t.userPoolId,userPoolEndpoint:t.userPoolEndpoint,newDeviceMetadata:b.NewDeviceMetadata,accessToken:b.AccessToken}),signInDetails:l}),pe(),await rt(),co(),{isSignedIn:!0,nextStep:{signInStep:"DONE"}}):it({challengeName:a,challengeParameters:w})}catch(a){pe(),co(),Qo(a);const w=hl(a.name);if(w)return w;throw a}}async function VD({username:r,clientMetadata:o,config:e,tokenOrchestrator:d,preferredChallenge:t,password:l,session:i}){const{userPoolId:a,userPoolClientId:w,userPoolEndpoint:b}=e,s=zo({username:r,userPoolId:a,userPoolClientId:w}),n={USERNAME:r};if(t){if(t==="PASSWORD_SRP")return Vr(!!l,nr.EmptySignInPassword),R0({username:r,password:l,clientMetadata:o,config:e,tokenOrchestrator:d,authFlow:"USER_AUTH",preferredChallenge:t});t==="PASSWORD"&&(Vr(!!l,nr.EmptySignInPassword),n.PASSWORD=l),n.PREFERRED_CHALLENGE=t}const f={AuthFlow:"USER_AUTH",AuthParameters:n,ClientMetadata:o,ClientId:w,UserContextData:s};i&&(f.Session=i);const h=await nl({endpointResolver:Yr({endpointOverride:b})})({region:Kr(a),userAgentValue:go(wo.SignIn)},f);return fl(r),h}async function U0(r){const{username:o,password:e,options:d}=r,t=Tr.getConfig().Auth?.Cognito,l={loginId:o,authFlowType:"USER_AUTH"};Br(t);const i=d?.clientMetadata,a=d?.preferredChallenge;Vr(!!o,nr.EmptySignInUsername);try{const w={username:o,config:t,tokenOrchestrator:_o,clientMetadata:i,preferredChallenge:a,password:e},b=Ge.getState();b.active&&b.username===o&&(w.session=b.session);const s=await VD(w),n=ml(o);return ot({signInSession:s.Session,username:n,challengeName:s.ChallengeName,signInDetails:l}),s.AuthenticationResult?(await Qd({username:n,...s.AuthenticationResult,NewDeviceMetadata:await lt({userPoolId:t.userPoolId,userPoolEndpoint:t.userPoolEndpoint,newDeviceMetadata:s.AuthenticationResult.NewDeviceMetadata,accessToken:s.AuthenticationResult.AccessToken}),signInDetails:l}),pe(),await rt(),co(),{isSignedIn:!0,nextStep:{signInStep:"DONE"}}):it({challengeName:s.ChallengeName,challengeParameters:s.ChallengeParameters,availableChallenges:"AvailableChallenges"in s?s.AvailableChallenges:void 0})}catch(w){pe(),co(),Qo(w);const b=hl(w.name);if(b)return b;throw w}}async function t4(r){co(!1);const o=r.options?.authFlowType;switch(await jD(),o){case"USER_SRP_AUTH":return L0(r);case"USER_PASSWORD_AUTH":return zD(r);case"CUSTOM_WITHOUT_SRP":return LD(r);case"CUSTOM_WITH_SRP":return UD(r);case"USER_AUTH":return U0(r);default:return L0(r)}}const z0=180*1e3;function HD(r){const o=Yi.listen("auth-internal",async({payload:d})=>{switch(d.event){case"confirmSignUp":d.data?.isSignUpComplete&&(Yi.dispatch("auth-internal",{event:"autoSignIn"}),d4(H0(r)),o())}}),e=setTimeout(()=>{o(),clearTimeout(e),co()},z0)}function V0(r,o){let e;return d=>{e||r(...d),clearTimeout(e),e=setTimeout(()=>{e=void 0},o)}}function qD(r,o,e){const d=Date.now(),t=setInterval(async()=>{if(Date.now()-d>z0)clearInterval(t),e(new ar({name:f0,message:"The account was not confirmed on time.",recoverySuggestion:"Try to verify your account by clicking the link sent your email or phone and then login manually."})),co();else try{const a=await t4(r);a.nextStep.signInStep!=="CONFIRM_SIGN_UP"&&(o(a),clearInterval(t),co())}catch(a){clearInterval(t),e(a),co()}},5e3)}const WD=V0(qD,300),KD=V0(GD,300);function YD(r){return async()=>new Promise((o,e)=>{WD([r,o,e])})}async function GD(r,o,e){try{const d=r?.options?.authFlowType==="USER_AUTH"?await U0(r):await t4(r);o(d),co()}catch(d){e(d),co()}}function H0(r){return async()=>new Promise((o,e)=>{KD([r,o,e])})}const XD=H0,JD=()=>async r=>{if(r.statusCode>=300){const o=await Xd(r);if(Qo(o),o.name===zb.InvalidParameterException&&/'password'/.test(o.message)&&/Member must not be null/.test(o.message)){const e=nr.EmptySignUpPassword,{message:d,recoverySuggestion:t}=zh[e];throw new ar({name:e,message:d,recoverySuggestion:t})}throw new ar({name:o.name,message:o.message})}return il(r)},ZD=r=>no(So,Bo("SignUp"),JD(),{...Co,...r});async function QD(r){const{username:o,password:e,options:d}=r,t=Tr.getConfig().Auth?.Cognito,l=t?.signUpVerificationMethod??"code",{clientMetadata:i,validationData:a,autoSignIn:w}=r.options??{};Br(t),Vr(!!o,nr.EmptySignUpUsername);const b=typeof w!="boolean"?w:void 0,s={username:o,options:b};b?.authFlowType!=="CUSTOM_WITHOUT_SRP"&&(s.password=e);const{userPoolId:n,userPoolClientId:f,userPoolEndpoint:m}=t,h=ZD({endpointResolver:Yr({endpointOverride:m})}),p={Username:o,Password:void 0,UserAttributes:d?.userAttributes&&Hh(d?.userAttributes),ClientMetadata:i,ValidationData:a&&Hh(a),ClientId:f,UserContextData:zo({username:o,userPoolId:n,userPoolClientId:f})};e&&(p.Password=e);const{UserSub:x,CodeDeliveryDetails:g,UserConfirmed:E,Session:D}=await h({region:Kr(n),userAgentValue:go(wo.SignUp)},p);(b||w===!0)&&(Ge.dispatch({type:"START"}),Ge.dispatch({type:"SET_USERNAME",value:o}),Ge.dispatch({type:"SET_SESSION",value:D}));const c={destination:g?.Destination,deliveryMedium:g?.DeliveryMedium,attributeName:g?.AttributeName},u=!!E,B=Ge.getState().active;if(u)return B?(d4(XD(s)),{isSignUpComplete:!0,nextStep:{signUpStep:"COMPLETE_AUTO_SIGN_IN"},userId:x}):{isSignUpComplete:!0,nextStep:{signUpStep:"DONE"},userId:x};if(B){if(l==="link")return d4(YD(s)),{isSignUpComplete:!1,nextStep:{signUpStep:"COMPLETE_AUTO_SIGN_IN",codeDeliveryDetails:c},userId:x};HD(s)}return{isSignUpComplete:!1,nextStep:{signUpStep:"CONFIRM_SIGN_UP",codeDeliveryDetails:c},userId:x}}const r9=r=>no(So,Bo("ForgotPassword"),Lo(),{...Co,...r});async function o9(r){const{username:o}=r;Vr(!!o,nr.EmptyResetPasswordUsername);const e=Tr.getConfig().Auth?.Cognito;Br(e);const{userPoolClientId:d,userPoolId:t,userPoolEndpoint:l}=e,i=r.options?.clientMetadata,a=zo({username:o,userPoolId:t,userPoolClientId:d}),s=(await r9({endpointResolver:Yr({endpointOverride:l})})({region:Kr(t),userAgentValue:go(wo.ResetPassword)},{Username:o,ClientMetadata:i,ClientId:d,UserContextData:a})).CodeDeliveryDetails;return{isPasswordReset:!1,nextStep:{resetPasswordStep:"CONFIRM_RESET_PASSWORD_WITH_CODE",codeDeliveryDetails:{deliveryMedium:s?.DeliveryMedium,destination:s?.Destination,attributeName:s?.AttributeName}}}}const e9=r=>no(So,Bo("ConfirmForgotPassword"),Lo(),{...Co,...r});async function d9(r){const o=Tr.getConfig().Auth?.Cognito;Br(o);const{userPoolClientId:e,userPoolId:d,userPoolEndpoint:t}=o,{username:l,newPassword:i}=r;Vr(!!l,nr.EmptyConfirmResetPasswordUsername),Vr(!!i,nr.EmptyConfirmResetPasswordNewPassword);const a=r.confirmationCode;Vr(!!a,nr.EmptyConfirmResetPasswordConfirmationCode);const w=r.options?.clientMetadata,b=zo({username:l,userPoolId:d,userPoolClientId:e});await e9({endpointResolver:Yr({endpointOverride:t})})({region:Kr(o.userPoolId),userAgentValue:go(wo.ConfirmResetPassword)},{Username:l,ConfirmationCode:a,Password:i,ClientMetadata:w,ClientId:o.userPoolClientId,UserContextData:b})}const t9=r=>no(So,Bo("ResendConfirmationCode"),Lo(),{...Co,...r});async function l9(r){const{username:o}=r;Vr(!!o,nr.EmptySignUpUsername);const e=Tr.getConfig().Auth?.Cognito;Br(e);const{userPoolClientId:d,userPoolId:t,userPoolEndpoint:l}=e,i=r.options?.clientMetadata,a=zo({username:o,userPoolId:t,userPoolClientId:d}),w=t9({endpointResolver:Yr({endpointOverride:l})}),{CodeDeliveryDetails:b}=await w({region:Kr(e.userPoolId),userAgentValue:go(wo.ResendSignUpCode)},{Username:o,ClientMetadata:i,ClientId:e.userPoolClientId,UserContextData:a}),{DeliveryMedium:s,AttributeName:n,Destination:f}={...b};return{destination:f,deliveryMedium:s,attributeName:n||void 0}}const i9=r=>no(So,Bo("ConfirmSignUp"),Lo(),{...Co,...r});async function a9(r){const{username:o,confirmationCode:e,options:d}=r,t=Tr.getConfig().Auth?.Cognito;Br(t);const{userPoolId:l,userPoolClientId:i,userPoolEndpoint:a}=t,w=d?.clientMetadata;Vr(!!o,nr.EmptyConfirmSignUpUsername),Vr(!!e,nr.EmptyConfirmSignUpCode);const b=zo({username:o,userPoolId:l,userPoolClientId:i}),s=i9({endpointResolver:Yr({endpointOverride:a})}),{Session:n}=await s({region:Kr(t.userPoolId),userAgentValue:go(wo.ConfirmSignUp)},{Username:o,ConfirmationCode:e,ClientMetadata:w,ForceAliasCreation:d?.forceAliasCreation,ClientId:t.userPoolClientId,UserContextData:b});return new Promise((f,m)=>{try{const h={isSignUpComplete:!0,nextStep:{signUpStep:"DONE"}},p=Ge.getState();if(!p.active||p.username!==o){f(h),co();return}Ge.dispatch({type:"SET_SESSION",value:n});const x=Yi.listen("auth-internal",({payload:g})=>{switch(g.event){case"autoSignIn":f({isSignUpComplete:!0,nextStep:{signUpStep:"COMPLETE_AUTO_SIGN_IN"}}),x()}});Yi.dispatch("auth-internal",{event:"confirmSignUp",data:h})}catch(h){m(h)}})}const w9=r=>no(So,Bo("ChangePassword"),Lo(),{...Co,...r});async function b9(r){const o=Tr.getConfig().Auth?.Cognito;Br(o);const{userPoolEndpoint:e,userPoolId:d}=o,{oldPassword:t,newPassword:l}=r;Vr(!!t,nr.EmptyUpdatePassword),Vr(!!l,nr.EmptyUpdatePassword);const{tokens:i}=await uh({forceRefresh:!1});Vb(i),await w9({endpointResolver:Yr({endpointOverride:e})})({region:Kr(d),userAgentValue:go(wo.UpdatePassword)},{AccessToken:i.accessToken.toString(),PreviousPassword:t,ProposedPassword:l})}function s9(r,o){if(o){const e=r?.find(d=>d===o);if(!e)throw Y7;return e}else{const e=r?.find(n9)??r?.find(p9),d=r?.find(h9)??r?.find(f9);if(e)return e;throw d?X7:K7}}const n9=r=>r.startsWith(String(window.location.origin+(window.location.pathname||"/"))),p9=r=>r.includes(String(window.location.hostname)),f9=r=>r.startsWith("http://"),h9=r=>r.startsWith("https://"),m9=async r=>{window?.location&&(window.location.href=r.replace("http://","https://"))},k9=async r=>{await r.clearOAuthData(),_o.clearTokens(),await Fh(),Yd.dispatch("auth",{event:"signedOut"},"Auth",kd)},x9=async(r,o=!1,e)=>{Gf(r);const{loginWith:d,userPoolClientId:t}=r,{domain:l,redirectSignOut:i}=d.oauth,a=s9(i,e),w=`https://${l}/logout?${Object.entries({client_id:t,logout_uri:encodeURIComponent(a)}).map(([b,s])=>`${b}=${s}`).join("&")}`;return m9(w)},g9=async(r,o,e,d)=>{const{isOAuthSignIn:t}=await o.loadOAuthSignIn(),l=await e.getOAuthMetadata();if(await k9(o),t||l?.oauthSignIn)return x9(r,!1,d)},c9=r=>no(So,Bo("RevokeToken"),Lo(),{...Co,...r}),u9=r=>no(So,Bo("GlobalSignOut"),Lo(),{...Co,...r}),q0=new vo("Auth");async function F9(r){const o=Tr.getConfig().Auth?.Cognito;Br(o),r?.global?await y9(o):await A9(o);let e;try{Gf(o),e=!0}catch{e=!1}if(e){const d=new F0(bl);d.setAuthConfig(o);const{type:t}=await g9(o,d,_o,r?.oauth?.redirectUrl)??{};if(t==="error")throw new ar({name:J7,message:"An error occurred when attempting to log out from OAuth provider."})}else _o.clearTokens(),await Fh(),Yd.dispatch("auth",{event:"signedOut"},"Auth",kd)}async function A9(r){try{const{userPoolEndpoint:o,userPoolId:e,userPoolClientId:d}=r,t=await _o.getTokenStore().loadTokens();h0(t),E9(t.accessToken)&&await c9({endpointResolver:Yr({endpointOverride:o})})({region:Kr(e),userAgentValue:go(wo.SignOut)},{ClientId:d,Token:t.refreshToken})}catch{q0.debug("Client signOut error caught but will proceed with token removal")}}async function y9(r){try{const{userPoolEndpoint:o,userPoolId:e}=r,d=await _o.getTokenStore().loadTokens();Vb(d),await u9({endpointResolver:Yr({endpointOverride:o})})({region:Kr(e),userAgentValue:go(wo.SignOut)},{AccessToken:d.accessToken.toString()})}catch{q0.debug("Global signOut error caught but will proceed with token removal")}}const E9=r=>!!r?.payload?.origin_jti,D9={identityId:"identityId"},v9=new vo("DefaultIdentityIdStore");class W0{setAuthConfig(o){Gi(o.Cognito),this.authConfig=o,this._authKeys=B9("Cognito",o.Cognito.identityPoolId)}constructor(o){this._authKeys={},this._hasGuestIdentityId=!1,this.keyValueStorage=o}async loadIdentityId(){Gi(this.authConfig?.Cognito);try{if(this._primaryIdentityId)return{id:this._primaryIdentityId,type:"primary"};{const o=await this.keyValueStorage.getItem(this._authKeys.identityId);return o?(this._hasGuestIdentityId=!0,{id:o,type:"guest"}):null}}catch(o){return v9.log("Error getting stored IdentityId.",o),null}}async storeIdentityId(o){Gi(this.authConfig?.Cognito),o.type==="guest"?(this.keyValueStorage.setItem(this._authKeys.identityId,o.id),this._primaryIdentityId=void 0,this._hasGuestIdentityId=!0):(this._primaryIdentityId=o.id,this._hasGuestIdentityId&&(this.keyValueStorage.removeItem(this._authKeys.identityId),this._hasGuestIdentityId=!1))}async clearIdentityId(){this._primaryIdentityId=void 0,await this.keyValueStorage.removeItem(this._authKeys.identityId)}}const B9=(r,o)=>Hb(D9)(`com.amplify.${r}`,o),l4=({endpointOverride:r})=>o=>r?{url:new al(r)}:I7(o);function K0(r){const o=xd(r).payload.iss,e={};if(!o)throw new ar({name:"InvalidIdTokenException",message:"Invalid Idtoken."});const d=o.replace(/(^\w+:|^)\/\//,"");return e[d]=r,e}async function S9({tokens:r,authConfig:o,identityIdStore:e}){e.setAuthConfig({Cognito:o});const d=await e.loadIdentityId();if(d)return d.id;const t=r?.idToken?K0(r.idToken.toString()):{},l=await C9(t,o);return e.storeIdentityId({id:l,type:r?"primary":"guest"}),l}async function C9(r,o){const e=o?.identityPoolId,d=Ub(e),t=S7({endpointResolver:l4({endpointOverride:o.identityPoolEndpoint})});let l;try{l=(await t({region:d},{IdentityPoolId:e,Logins:r})).IdentityId}catch(i){throw Qo(i),new ar(i)}if(!l)throw new ar({name:"GetIdResponseException",message:"Received undefined response from getId operation",recoverySuggestion:"Make sure to pass a valid identityPoolId in the configuration."});return l}const fa=new vo("CognitoCredentialsProvider"),Y0=3e3*1e3;class G0{constructor(o){this._nextCredentialsRefresh=0,this._identityIdStore=o}async clearCredentialsAndIdentityId(){fa.debug("Clearing out credentials and identityId"),this._credentialsAndIdentityId=void 0,await this._identityIdStore.clearIdentityId()}async clearCredentials(){fa.debug("Clearing out in-memory credentials"),this._credentialsAndIdentityId=void 0}async getCredentialsAndIdentityId(o){const e=o.authenticated,{tokens:d}=o,{authConfig:t}=o;try{Gi(t?.Cognito)}catch{return}if(!e&&!t.Cognito.allowGuestAccess)return;const{forceRefresh:l}=o,i=this.hasTokenChanged(d),a=await S9({tokens:d,authConfig:t.Cognito,identityIdStore:this._identityIdStore});return(l||i)&&this.clearCredentials(),e?(rE(d),this.credsForOIDCTokens(t.Cognito,d,a)):this.getGuestCredentials(a,t.Cognito)}async getGuestCredentials(o,e){if(this._credentialsAndIdentityId&&!this.isPastTTL()&&this._credentialsAndIdentityId.isAuthenticatedCreds===!1)return fa.info("returning stored credentials as they neither past TTL nor expired."),this._credentialsAndIdentityId;this.clearCredentials();const d=Ub(e.identityPoolId),t=Nh({endpointResolver:l4({endpointOverride:e.identityPoolEndpoint})});let l;try{l=await t({region:d},{IdentityId:o})}catch(i){throw Qo(i),new ar(i)}if(l?.Credentials?.AccessKeyId&&l?.Credentials?.SecretKey){this._nextCredentialsRefresh=new Date().getTime()+Y0;const i={credentials:{accessKeyId:l.Credentials.AccessKeyId,secretAccessKey:l.Credentials.SecretKey,sessionToken:l.Credentials.SessionToken,expiration:l.Credentials.Expiration},identityId:o};return l.IdentityId&&(i.identityId=l.IdentityId,this._identityIdStore.storeIdentityId({id:l.IdentityId,type:"guest"})),this._credentialsAndIdentityId={...i,isAuthenticatedCreds:!1},i}else throw new ar({name:"CredentialsNotFoundException",message:"Cognito did not respond with either Credentials, AccessKeyId or SecretKey."})}async credsForOIDCTokens(o,e,d){if(this._credentialsAndIdentityId&&!this.isPastTTL()&&this._credentialsAndIdentityId.isAuthenticatedCreds===!0)return fa.debug("returning stored credentials as they neither past TTL nor expired."),this._credentialsAndIdentityId;this.clearCredentials();const t=e.idToken?K0(e.idToken.toString()):{},l=Ub(o.identityPoolId),i=Nh({endpointResolver:l4({endpointOverride:o.identityPoolEndpoint})});let a;try{a=await i({region:l},{IdentityId:d,Logins:t})}catch(w){throw Qo(w),new ar(w)}if(a?.Credentials?.AccessKeyId&&a?.Credentials?.SecretKey){this._nextCredentialsRefresh=new Date().getTime()+Y0;const w={credentials:{accessKeyId:a.Credentials.AccessKeyId,secretAccessKey:a.Credentials.SecretKey,sessionToken:a.Credentials.SessionToken,expiration:a.Credentials.Expiration},identityId:d};return a.IdentityId&&(w.identityId=a.IdentityId,this._identityIdStore.storeIdentityId({id:a.IdentityId,type:"primary"})),this._credentialsAndIdentityId={...w,isAuthenticatedCreds:!0,associatedIdToken:e.idToken?.toString()},w}else throw new ar({name:"CredentialsException",message:"Cognito did not respond with either Credentials, AccessKeyId or SecretKey."})}isPastTTL(){return this._nextCredentialsRefresh===void 0?!0:this._nextCredentialsRefresh<=Date.now()}hasTokenChanged(o){return!!o&&!!this._credentialsAndIdentityId?.associatedIdToken&&o.idToken?.toString()!==this._credentialsAndIdentityId.associatedIdToken}}const _9=new G0(new W0(bl)),I9={configure(r,o){const e=oh(r),d=new Lh({sameSite:"lax"}),t=o?.ssr?d:bl,l=o?.ssr?new G0(new W0(d)):_9;if(!e.Auth){Tr.configure(e,o);return}if(o?.Auth){Tr.configure(e,o);return}if(!Tr.libraryOptions.Auth){Zd.setAuthConfig(e.Auth),Zd.setKeyValueStorage(t),Tr.configure(e,{...o,Auth:{tokenProvider:Zd,credentialsProvider:l}});return}if(o){const i=Tr.libraryOptions.Auth;o.ssr!==void 0&&(Zd.setKeyValueStorage(t),i.credentialsProvider=l),Tr.configure(e,{Auth:i,...o});return}Tr.configure(e)},getConfig(){return Tr.getConfig()}},T9={Auth:{Cognito:{userPoolId:"ap-south-1_es4yWY1O9",userPoolClientId:"7hte1nkjug6rqsf9air6021aqr",userPoolEndpoint:"https://cognito-idp.ap-south-1.amazonaws.com/"}}};I9.configure(T9),Zd.setKeyValueStorage(new Lh({domain:"localhost",secure:!0,path:"/",expires:30}));const X0={signIn:t4,autoSignIn:e4,signUp:QD,fetchAuthSession:uh,resetPassword:o9,confirmResetPassword:d9,resendSignUpCode:l9,confirmSignUp:a9,updatePassword:b9,signOut:F9},kl=r=>{if(typeof window<"u"){const{cookie:o}=document,e=o?.split(";")?.find(t=>t?.includes(r));if(!e)return["",""];const d=e?.split("=");return d.length<=1?["",""]:d}return["",""]},J0=(r,o,e)=>{const d=new Date;d.setTime(d.getTime()+e*24*60*60*1e3);const t="expires="+d.toUTCString();document.cookie=r+"="+o+";"+t+";domain=."+process.env.NEXT_PUBLIC_DOMAIN+";path=/"};function Z0(r){const o=typeof r=="string"?new Date(r):r,d=new Date().getTime()-o.getTime(),t=Math.floor(d/1e3),l=Math.floor(t/60),i=Math.floor(l/60),a=Math.floor(i/24);return a>2?o.toISOString().split("T")[0]:a===2?"2 days ago":a===1?"yesterday":i>=1?`${i} hour${i>1?"s":""} ago`:l>=1?`${l} minute${l>1?"s":""} ago`:t>5?`${t} seconds ago`:"just now"}async function N9(){try{await X0.signOut()}catch(r){console.log("error signing out: ",r)}}const Q0={jwtExpired:"jwt expired",notLogin:"User must be logged in"},i4=el.get();typeof i4=="object"&&Object.entries(i4).length&&Object?.entries(i4)?.forEach(([r,o])=>{r.endsWith("accessToken")});let ha="";typeof window<"u"&&(ha=window.location.href),ha.includes("invite-user")||ha.includes("mailOpened")||ha.includes("/email?"),Or.interceptors.request.use(async r=>{const o=window.location.pathname?.split("/").find(d=>parseInt(d))??kl(Wf.workspaceId)[1];r.headers["x-tenant-id"]||(r.headers["x-tenant-id"]=o?o.toString():"");const e=kl("accessToken");return r.headers.authorization=`${e[1]}`,{...r}},r=>Promise.reject(r)),Or.interceptors.response.use(r=>r,async r=>{const e=b8(r.config,"url","").split("/");return((r.response?.data?.message??"")===Q0.jwtExpired||(r.response?.data?.message??"")===Q0.notLogin)&&(kl("count")[1]==="1"&&(await N9(),J0("count","0",0),window.location.href.includes("auth/")||(window.location.pathname=W8.login)),await X0.fetchAuthSession(),window.location.href.includes("auth/")||(J0("count","1",1),window.location.reload())),r.response?.status===401&&!e.includes("validate-user")&&window.location.reload(),Promise.reject(r.response)});const P9=()=>{const r=window.location.pathname.split("/").find(e=>parseInt(e))??kl(Wf.workspaceId)[1],o=kl("accessToken");return{"x-tenant-id":r?r.toString():"",authorization:`${o[1]}`}},rm=H8((r,{headers:o})=>({headers:{...o,...P9()}})),R9=Zr.createHttpLink({uri:nb.clientGraphqlUrl}),O9=Zr.createHttpLink({uri:nb.serverGraphqlUrl}),a4=new Zr.ApolloClient({cache:new Zr.InMemoryCache({}),link:Zr.ApolloLink.from([rm,R9]),queryDeduplication:!1,devtools:{enabled:!0}}),om=new Zr.ApolloClient({cache:new Zr.InMemoryCache({}),link:Zr.ApolloLink.from([rm,O9]),queryDeduplication:!1,devtools:{enabled:!0}}),M9=Zr.gql`
|