componentes-exagono 0.2.30 → 0.2.31

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/index.umd.js CHANGED
@@ -157,7 +157,7 @@ const theme2 = createTheme({ palette: {
157
157
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const n=new this(t);return r.forEach(o=>n.set(o)),n}static accessor(t){const n=(this[_f]=this[_f]={accessors:{}}).accessors,o=this.prototype;function s(i){const a=jo(i);n[a]||(px(o,i),n[a]=!0)}return z.isArray(t)?t.forEach(s):s(t),this}};sr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),z.reduceDescriptors(sr.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}}),z.freezeMethods(sr);function gc(e,t){const r=this||Oo,n=t||r,o=sr.from(n.headers);let s=n.data;return z.forEach(e,function(a){s=a.call(r,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function wf(e){return!!(e&&e.__CANCEL__)}function qn(e,t,r){Le.call(this,e??"canceled",Le.ERR_CANCELED,t,r),this.name="CanceledError"}z.inherits(qn,Le,{__CANCEL__:!0});function Sf(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new Le("Request failed with status code "+r.status,[Le.ERR_BAD_REQUEST,Le.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function hx(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function mx(e,t){e=e||10;const r=new Array(e),n=new Array(e);let o=0,s=0,i;return t=t!==void 0?t:1e3,function(c){const l=Date.now(),d=n[s];i||(i=l),r[o]=c,n[o]=l;let f=s,h=0;for(;f!==o;)h+=r[f++],f=f%e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),l-i<t)return;const v=d&&l-d;return v?Math.round(h*1e3/v):void 0}}function gx(e,t){let r=0,n=1e3/t,o,s;const i=(l,d=Date.now())=>{r=d,o=null,s&&(clearTimeout(s),s=null),e(...l)};return[(...l)=>{const d=Date.now(),f=d-r;f>=n?i(l,d):(o=l,s||(s=setTimeout(()=>{s=null,i(o)},n-f)))},()=>o&&i(o)]}const Ei=(e,t,r=3)=>{let n=0;const o=mx(50,250);return gx(s=>{const i=s.loaded,a=s.lengthComputable?s.total:void 0,c=i-n,l=o(c),d=i<=a;n=i;const f={loaded:i,total:a,progress:a?i/a:void 0,bytes:c,rate:l||void 0,estimated:l&&a&&d?(a-i)/l:void 0,event:s,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(f)},r)},Cf=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Ef=e=>(...t)=>z.asap(()=>e(...t)),vx=Xt.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,Xt.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(Xt.origin),Xt.navigator&&/(msie|trident)/i.test(Xt.navigator.userAgent)):()=>!0,yx=Xt.hasStandardBrowserEnv?{write(e,t,r,n,o,s){const i=[e+"="+encodeURIComponent(t)];z.isNumber(r)&&i.push("expires="+new Date(r).toGMTString()),z.isString(n)&&i.push("path="+n),z.isString(o)&&i.push("domain="+o),s===!0&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function bx(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function xx(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Df(e,t,r){let n=!bx(t);return e&&(n||r==!1)?xx(e,t):t}const kf=e=>e instanceof sr?{...e}:e;function bn(e,t){t=t||{};const r={};function n(l,d,f,h){return z.isPlainObject(l)&&z.isPlainObject(d)?z.merge.call({caseless:h},l,d):z.isPlainObject(d)?z.merge({},d):z.isArray(d)?d.slice():d}function o(l,d,f,h){if(z.isUndefined(d)){if(!z.isUndefined(l))return n(void 0,l,f,h)}else return n(l,d,f,h)}function s(l,d){if(!z.isUndefined(d))return n(void 0,d)}function i(l,d){if(z.isUndefined(d)){if(!z.isUndefined(l))return n(void 0,l)}else return n(void 0,d)}function a(l,d,f){if(f in t)return n(l,d);if(f in e)return n(void 0,l)}const c={url:s,method:s,data:s,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:(l,d,f)=>o(kf(l),kf(d),f,!0)};return z.forEach(Object.keys({...e,...t}),function(d){const f=c[d]||o,h=f(e[d],t[d],d);z.isUndefined(h)&&f!==a||(r[d]=h)}),r}const Af=e=>{const t=bn({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:o,xsrfCookieName:s,headers:i,auth:a}=t;t.headers=i=sr.from(i),t.url=vf(Df(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let c;if(z.isFormData(r)){if(Xt.hasStandardBrowserEnv||Xt.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if((c=i.getContentType())!==!1){const[l,...d]=c?c.split(";").map(f=>f.trim()).filter(Boolean):[];i.setContentType([l||"multipart/form-data",...d].join("; "))}}if(Xt.hasStandardBrowserEnv&&(n&&z.isFunction(n)&&(n=n(t)),n||n!==!1&&vx(t.url))){const l=o&&s&&yx.read(s);l&&i.set(o,l)}return t},_x=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,n){const o=Af(e);let s=o.data;const i=sr.from(o.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:l}=o,d,f,h,v,m;function p(){v&&v(),m&&m(),o.cancelToken&&o.cancelToken.unsubscribe(d),o.signal&&o.signal.removeEventListener("abort",d)}let b=new XMLHttpRequest;b.open(o.method.toUpperCase(),o.url,!0),b.timeout=o.timeout;function w(){if(!b)return;const E=sr.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),_={data:!a||a==="text"||a==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:E,config:e,request:b};Sf(function(D){r(D),p()},function(D){n(D),p()},_),b=null}"onloadend"in b?b.onloadend=w:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(w)},b.onabort=function(){b&&(n(new Le("Request aborted",Le.ECONNABORTED,e,b)),b=null)},b.onerror=function(){n(new Le("Network Error",Le.ERR_NETWORK,e,b)),b=null},b.ontimeout=function(){let S=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const _=o.transitional||bf;o.timeoutErrorMessage&&(S=o.timeoutErrorMessage),n(new Le(S,_.clarifyTimeoutError?Le.ETIMEDOUT:Le.ECONNABORTED,e,b)),b=null},s===void 0&&i.setContentType(null),"setRequestHeader"in b&&z.forEach(i.toJSON(),function(S,_){b.setRequestHeader(_,S)}),z.isUndefined(o.withCredentials)||(b.withCredentials=!!o.withCredentials),a&&a!=="json"&&(b.responseType=o.responseType),l&&([h,m]=Ei(l,!0),b.addEventListener("progress",h)),c&&b.upload&&([f,v]=Ei(c),b.upload.addEventListener("progress",f),b.upload.addEventListener("loadend",v)),(o.cancelToken||o.signal)&&(d=E=>{b&&(n(!E||E.type?new qn(null,e,b):E),b.abort(),b=null)},o.cancelToken&&o.cancelToken.subscribe(d),o.signal&&(o.signal.aborted?d():o.signal.addEventListener("abort",d)));const C=hx(o.url);if(C&&Xt.protocols.indexOf(C)===-1){n(new Le("Unsupported protocol "+C+":",Le.ERR_BAD_REQUEST,e));return}b.send(s||null)})},wx=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,o;const s=function(l){if(!o){o=!0,a();const d=l instanceof Error?l:this.reason;n.abort(d instanceof Le?d:new qn(d instanceof Error?d.message:d))}};let i=t&&setTimeout(()=>{i=null,s(new Le(`timeout ${t} of ms exceeded`,Le.ETIMEDOUT))},t);const a=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),e=null)};e.forEach(l=>l.addEventListener("abort",s));const{signal:c}=n;return c.unsubscribe=()=>z.asap(a),c}},Sx=function*(e,t){let r=e.byteLength;if(r<t){yield e;return}let n=0,o;for(;n<r;)o=n+t,yield e.slice(n,o),n=o},Cx=async function*(e,t){for await(const r of Ex(e))yield*Sx(r,t)},Ex=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},Tf=(e,t,r,n)=>{const o=Cx(e,t);let s=0,i,a=c=>{i||(i=!0,n&&n(c))};return new ReadableStream({async pull(c){try{const{done:l,value:d}=await o.next();if(l){a(),c.close();return}let f=d.byteLength;if(r){let h=s+=f;r(h)}c.enqueue(new Uint8Array(d))}catch(l){throw a(l),l}},cancel(c){return a(c),o.return()}},{highWaterMark:2})},Di=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",If=Di&&typeof ReadableStream=="function",Dx=Di&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Mf=(e,...t)=>{try{return!!e(...t)}catch{return!1}},kx=If&&Mf(()=>{let e=!1;const t=new Request(Xt.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Pf=64*1024,vc=If&&Mf(()=>z.isReadableStream(new Response("").body)),ki={stream:vc&&(e=>e.body)};Di&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!ki[t]&&(ki[t]=z.isFunction(e[t])?r=>r[t]():(r,n)=>{throw new Le(`Response type '${t}' is not supported`,Le.ERR_NOT_SUPPORT,n)})})})(new Response);const Ax=async e=>{if(e==null)return 0;if(z.isBlob(e))return e.size;if(z.isSpecCompliantForm(e))return(await new Request(Xt.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(z.isArrayBufferView(e)||z.isArrayBuffer(e))return e.byteLength;if(z.isURLSearchParams(e)&&(e=e+""),z.isString(e))return(await Dx(e)).byteLength},Tx=async(e,t)=>{const r=z.toFiniteNumber(e.getContentLength());return r??Ax(t)},yc={http:K1,xhr:_x,fetch:Di&&(async e=>{let{url:t,method:r,data:n,signal:o,cancelToken:s,timeout:i,onDownloadProgress:a,onUploadProgress:c,responseType:l,headers:d,withCredentials:f="same-origin",fetchOptions:h}=Af(e);l=l?(l+"").toLowerCase():"text";let v=wx([o,s&&s.toAbortSignal()],i),m;const p=v&&v.unsubscribe&&(()=>{v.unsubscribe()});let b;try{if(c&&kx&&r!=="get"&&r!=="head"&&(b=await Tx(d,n))!==0){let _=new Request(t,{method:"POST",body:n,duplex:"half"}),W;if(z.isFormData(n)&&(W=_.headers.get("content-type"))&&d.setContentType(W),_.body){const[D,A]=Cf(b,Ei(Ef(c)));n=Tf(_.body,Pf,D,A)}}z.isString(f)||(f=f?"include":"omit");const w="credentials"in Request.prototype;m=new Request(t,{...h,signal:v,method:r.toUpperCase(),headers:d.normalize().toJSON(),body:n,duplex:"half",credentials:w?f:void 0});let C=await fetch(m,h);const E=vc&&(l==="stream"||l==="response");if(vc&&(a||E&&p)){const _={};["status","statusText","headers"].forEach(M=>{_[M]=C[M]});const W=z.toFiniteNumber(C.headers.get("content-length")),[D,A]=a&&Cf(W,Ei(Ef(a),!0))||[];C=new Response(Tf(C.body,Pf,D,()=>{A&&A(),p&&p()}),_)}l=l||"text";let S=await ki[z.findKey(ki,l)||"text"](C,e);return!E&&p&&p(),await new Promise((_,W)=>{Sf(_,W,{data:S,headers:sr.from(C.headers),status:C.status,statusText:C.statusText,config:e,request:m})})}catch(w){throw p&&p(),w&&w.name==="TypeError"&&/Load failed|fetch/i.test(w.message)?Object.assign(new Le("Network Error",Le.ERR_NETWORK,e,m),{cause:w.cause||w}):Le.from(w,w&&w.code,e,m)}})};z.forEach(yc,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Of=e=>`- ${e}`,Ix=e=>z.isFunction(e)||e===null||e===!1,jf={getAdapter:e=>{e=z.isArray(e)?e:[e];const{length:t}=e;let r,n;const o={};for(let s=0;s<t;s++){r=e[s];let i;if(n=r,!Ix(r)&&(n=yc[(i=String(r)).toLowerCase()],n===void 0))throw new Le(`Unknown adapter '${i}'`);if(n)break;o[i||"#"+s]=n}if(!n){const s=Object.entries(o).map(([a,c])=>`adapter ${a} `+(c===!1?"is not supported by the environment":"is not available in the build"));let i=t?s.length>1?`since :
158
158
  `+s.map(Of).join(`
159
159
  `):" "+Of(s[0]):"as no adapter specified";throw new Le("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return n},adapters:yc};function bc(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new qn(null,e)}function Rf(e){return bc(e),e.headers=sr.from(e.headers),e.data=gc.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),jf.getAdapter(e.adapter||Oo.adapter)(e).then(function(n){return bc(e),n.data=gc.call(e,e.transformResponse,n),n.headers=sr.from(n.headers),n},function(n){return wf(n)||(bc(e),n&&n.response&&(n.response.data=gc.call(e,e.transformResponse,n.response),n.response.headers=sr.from(n.response.headers))),Promise.reject(n)})}const Nf="1.11.0",Ai={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ai[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const $f={};Ai.transitional=function(t,r,n){function o(s,i){return"[Axios v"+Nf+"] Transitional option '"+s+"'"+i+(n?". "+n:"")}return(s,i,a)=>{if(t===!1)throw new Le(o(i," has been removed"+(r?" in "+r:"")),Le.ERR_DEPRECATED);return r&&!$f[i]&&($f[i]=!0,console.warn(o(i," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(s,i,a):!0}},Ai.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function Mx(e,t,r){if(typeof e!="object")throw new Le("options must be an object",Le.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let o=n.length;for(;o-- >0;){const s=n[o],i=t[s];if(i){const a=e[s],c=a===void 0||i(a,s,e);if(c!==!0)throw new Le("option "+s+" must be "+c,Le.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new Le("Unknown option "+s,Le.ERR_BAD_OPTION)}}const Ti={assertOptions:Mx,validators:Ai},Wr=Ti.validators;let xn=class{constructor(t){this.defaults=t||{},this.interceptors={request:new yf,response:new yf}}async request(t,r){try{return await this._request(t,r)}catch(n){if(n instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const s=o.stack?o.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=`
160
- `+s):n.stack=s}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=bn(this.defaults,r);const{transitional:n,paramsSerializer:o,headers:s}=r;n!==void 0&&Ti.assertOptions(n,{silentJSONParsing:Wr.transitional(Wr.boolean),forcedJSONParsing:Wr.transitional(Wr.boolean),clarifyTimeoutError:Wr.transitional(Wr.boolean)},!1),o!=null&&(z.isFunction(o)?r.paramsSerializer={serialize:o}:Ti.assertOptions(o,{encode:Wr.function,serialize:Wr.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Ti.assertOptions(r,{baseUrl:Wr.spelling("baseURL"),withXsrfToken:Wr.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i=s&&z.merge(s.common,s[r.method]);s&&z.forEach(["delete","get","head","post","put","patch","common"],m=>{delete s[m]}),r.headers=sr.concat(i,s);const a=[];let c=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(r)===!1||(c=c&&p.synchronous,a.unshift(p.fulfilled,p.rejected))});const l=[];this.interceptors.response.forEach(function(p){l.push(p.fulfilled,p.rejected)});let d,f=0,h;if(!c){const m=[Rf.bind(this),void 0];for(m.unshift(...a),m.push(...l),h=m.length,d=Promise.resolve(r);f<h;)d=d.then(m[f++],m[f++]);return d}h=a.length;let v=r;for(f=0;f<h;){const m=a[f++],p=a[f++];try{v=m(v)}catch(b){p.call(this,b);break}}try{d=Rf.call(this,v)}catch(m){return Promise.reject(m)}for(f=0,h=l.length;f<h;)d=d.then(l[f++],l[f++]);return d}getUri(t){t=bn(this.defaults,t);const r=Df(t.baseURL,t.url,t.allowAbsoluteUrls);return vf(r,t.params,t.paramsSerializer)}};z.forEach(["delete","get","head","options"],function(t){xn.prototype[t]=function(r,n){return this.request(bn(n||{},{method:t,url:r,data:(n||{}).data}))}}),z.forEach(["post","put","patch"],function(t){function r(n){return function(s,i,a){return this.request(bn(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:i}))}}xn.prototype[t]=r(),xn.prototype[t+"Form"]=r(!0)});let Px=class p0{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(s){r=s});const n=this;this.promise.then(o=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](o);n._listeners=null}),this.promise.then=o=>{let s;const i=new Promise(a=>{n.subscribe(a),s=a}).then(o);return i.cancel=function(){n.unsubscribe(s)},i},t(function(s,i,a){n.reason||(n.reason=new qn(s,i,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new p0(function(o){t=o}),cancel:t}}};function Ox(e){return function(r){return e.apply(null,r)}}function jx(e){return z.isObject(e)&&e.isAxiosError===!0}const xc={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(xc).forEach(([e,t])=>{xc[t]=e});function Lf(e){const t=new xn(e),r=tf(xn.prototype.request,t);return z.extend(r,xn.prototype,t,{allOwnKeys:!0}),z.extend(r,t,null,{allOwnKeys:!0}),r.create=function(o){return Lf(bn(e,o))},r}const Rt=Lf(Oo);Rt.Axios=xn,Rt.CanceledError=qn,Rt.CancelToken=Px,Rt.isCancel=wf,Rt.VERSION=Nf,Rt.toFormData=Si,Rt.AxiosError=Le,Rt.Cancel=Rt.CanceledError,Rt.all=function(t){return Promise.all(t)},Rt.spread=Ox,Rt.isAxiosError=jx,Rt.mergeConfig=bn,Rt.AxiosHeaders=sr,Rt.formToJSON=e=>xf(z.isHTMLForm(e)?new FormData(e):e),Rt.getAdapter=jf.getAdapter,Rt.HttpStatusCode=xc,Rt.default=Rt;const{Axios:GT,AxiosError:KT,CanceledError:QT,isCancel:XT,CancelToken:JT,VERSION:e5,all:t5,Cancel:r5,isAxiosError:n5,spread:o5,toFormData:s5,AxiosHeaders:i5,HttpStatusCode:a5,formToJSON:c5,getAdapter:l5,mergeConfig:u5}=Rt,zf={token:null},Rx=e=>{zf.token=e},Et=Rt.create({headers:{"Content-Type":"application/json"}});Et.interceptors.request.use(e=>{const t=zf.token;return t&&(e.headers.Authorization=`Bearer ${t}`),e},e=>Promise.reject(e));const Bf=y.createContext(void 0),Nx=({config:e,children:t})=>(y.useEffect(()=>{e.getToken&&Rx(e.getToken)},[e.getToken]),u.jsx(Bf.Provider,{value:e,children:t})),_c=()=>{const e=y.useContext(Bf);if(!e)throw new Error("useApiConfig debe ser usado dentro de un ApiProvider");return e},Ii=()=>{const{calendarApiUrl:e}=_c();return{getGoogleAuthUrl:async()=>{try{const i=`${e}/api/Calendario/v1/auth-url-Google`;return(await Et.get(i)).data}catch(i){throw console.error("Error al obtener la URL de Google Auth:",i),i}},saveGoogleCredentials:async i=>{try{const a=new URLSearchParams({code:i.code,disID:String(i.disID),usrID:String(i.usrID)}).toString(),c=`${e}/api/Calendario/v1/google-auth/SaveCredential?${a}`;return(await Et.post(c,{})).data}catch(a){throw console.error("Error al guardar credenciales de Google:",a),a}},getGoogleCalendars:async(i,a)=>{try{return(await Et.get(`${e}/api/Calendario/v1/google/ObtenerTiposCalendariosGoogleAsync?usrMail=${encodeURIComponent(i)}&disID=${a}`)).data}catch(c){throw console.error("Error al obtener los calendarios de Google:",c),c}},syncGoogleEvents:async(i,a,c)=>{try{return(await Et.post(`${e}/api/Calendario/v1/google/SincronizarEnviarEventosAsync?usrMail=${encodeURIComponent(i)}&disID=${a}&UsuarioID=${c}`)).data}catch(l){throw console.error("Error al sincronizar eventos con Google Calendar:",l),l}},getGoogleEventsByMonth:async i=>{try{return(await Et.post(`${e}/api/Calendario/v1/google/ObtenerEventosGoogleAsyncXMes`,i)).data}catch(a){throw console.error("Error al obtener eventos de Google Calendar por mes:",a),a}}}},Ff="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAASFBMVEVChfRHcExDhOAWaNUZfjjkTDf////6/P7b6fu61fj7wCj7vASZv/VuoPBQjvVCr19GifE0qFM4gerrRjMubcQQaucZZ9MYgTpc4mWWAAAABnRSTlP/AFtbW/eMEQaPAAAAfUlEQVR42q3Pyw4CIQyFYVDbigKOl6Pv/6a2ZBYN08TEzL9gcb6waDqkubd1TEsEWkp7Q3e9RuvOrsvV+g0Fi+jaZIKC0sECzMDCDK51C9zR9A2gPhCC6HgOoIFL/KMD1cMfl39GNxc9NVrh7jKgHAPlCGwPgSgbnDYw9vwFKv0VRfpGYZ8AAAAASUVORK5CYII=",$x=({disID:e,usrID:t})=>{const[r,n]=y.useState(null),o=Ii(),s=async()=>{localStorage.setItem("temp_auth_disID",String(e)),localStorage.setItem("temp_auth_usrID",String(t)),n(null);try{const{url:i}=await o.getGoogleAuthUrl();window.location.href=i}catch(i){n(i.message||"Fallo al iniciar sesión con Google."),localStorage.removeItem("temp_auth_disID"),localStorage.removeItem("temp_auth_usrID")}finally{}};return u.jsxs("div",{className:"flex",children:[u.jsxs("div",{className:xe.syncButton,onClick:s,children:[u.jsx("div",{className:xe.customCheckIcon,children:u.jsx("div",{className:xe.uncheckedCircle})}),u.jsx("img",{src:Ff,width:18}),u.jsx("span",{children:"Google Calendar"})]}),r&&u.jsx("p",{className:"text-red-500 mt-2",children:r})]})},wc=()=>{const{calendarApiUrl:e}=_c();return{getOutlookAuthUrl:async()=>{try{const i=`${e}/api/Calendario/v1/auth-url-Outlook`,a=await Et.get(i);return console.log("api",a),a.data}catch(i){throw console.error("Error al obtener la URL de Outlook Auth:",i),i}},saveOutlookCredentials:async i=>{try{const a=new URLSearchParams({code:i.code,disID:String(i.disID),usrID:String(i.usrID)}).toString(),c=`${e}/api/Calendario/v1/outlook-auth/SaveCredential?${a}`;return(await Et.post(c,{})).data}catch(a){throw console.error("Error al guardar credenciales Outlook:",a),a}},syncOutlookEvents:async(i,a,c)=>{try{return(await Et.post(`${e}/api/Calendario/v1/outlook/SincronizarEnviarEventosAsync?usrMail=${encodeURIComponent(i)}&disID=${a}&UsuarioID=${c}`)).data}catch(l){throw console.error("Error al sincronizar eventos con outlook Calendar:",l),l}},getOutlookCalendars:async(i,a)=>{try{return(await Et.get(`${e}/api/Calendario/v1/outlook/ObtenerTiposCalendariosOutlookAsync?usrMail=${encodeURIComponent(i)}&disID=${a}`)).data}catch(c){throw console.error("Error al obtener los calendarios de Google:",c),c}},getOutlookEventsByMonth:async i=>{try{return(await Et.post(`${e}/api/Calendario/v1/outlook/ObtenerEventosoutlookAsyncXMes`,i)).data}catch(a){throw console.error("Error al obtener eventos de Outlook Calendar por mes:",a),a}}}},Wf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAYCAMAAAA8nnbJAAAAflBMVEUAAAAAV34AMFoAID0ATmsAL1oATXcAZZAAIUgANmQArPAAfd0BedoAacQAZbsAkuMActcAa9QAsfMAjfMAUJL///8Ame8Aht4A6v8A2v8Atvguid0AfMIAo+wAWrYA3/+q0/MAQ38ASIjB4PeHwe4AU7JlsekAdcMAXqgApf4WoQK+AAAACnRSTlMATjUWISlCbAuE1QOT9gAAAP1JREFUKM9t0GF7QzAQwPG2xiw5JGlICWVsrX3/L7i7Gyae/l944efinpzW4ktQfPrvorIgiHaW5UHZ29Hu3Dd235uTUkJnMHGj2NKISvh/TmBdX9c1W/pz5SQOOtsFFl0lBfx8YeCH6aHJhEG89X2/2aOchnLSIC1IACWwZjFdfmnwpSeDg/kSJH0AsLPLZgBoam9jsp2p8EylLK2rjDAmb89kALzLoLUaMyx3bs6rajHlh8FnZHzN+VwVxWKI+F5jFgdnW2BsaSUxUBRYYUdXrYaDMfbxydmuEU+32tJ7+5fB7QvUwBrDCcq4Z2AirJX7udCaziUMVHI+hPQLqRAg85aAu30AAAAASUVORK5CYII=",Lx=({disID:e,usrID:t})=>{const[r,n]=y.useState(null),o=wc(),s=async()=>{localStorage.setItem("temp_auth_disID",String(e)),localStorage.setItem("temp_auth_usrID",String(t)),n(null);try{const i=await o.getOutlookAuthUrl();window.location.href=i?.authUrl}catch(i){n(i.message||"Fallo al iniciar sesión con Google."),localStorage.removeItem("temp_auth_disID"),localStorage.removeItem("temp_auth_usrID")}finally{}};return u.jsxs("div",{className:"flex",children:[u.jsxs("div",{className:xe.syncButton,onClick:s,children:[u.jsx("div",{className:xe.customCheckIcon,children:u.jsx("div",{className:xe.uncheckedCircle})}),u.jsx("img",{src:Wf,width:20}),u.jsx("span",{children:"Outlook"})]}),r&&u.jsx("p",{className:"text-red-500 mt-2",children:r})]})},Uf="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='88'%20height='67'%20fill='none'%3e%3cg%20filter='url(%23a)'%20opacity='.7'%3e%3cellipse%20cx='69.302'%20cy='60.952'%20fill='%23D9D9D9'%20rx='12.698'%20ry='2.032'/%3e%3c/g%3e%3cpath%20fill='%23D6D6D6'%20fill-rule='evenodd'%20d='M60.034%2011.99c.71.001%201.37.374%201.737.982l-1.74%201.05a270%20270%200%200%201%201.74-1.048l.002.002.002.004.007.011.02.034.063.11q.08.139.21.385c.171.327.403.795.657%201.38a24.6%2024.6%200%200%201%201.527%204.811c.817%203.964.847%209.339-2.499%2014.552a2.033%202.033%200%200%201-3.242.236l1.533-1.333-1.535%201.332v-.003l-.005-.004-.01-.012-.028-.033-.082-.1a10%2010%200%200%201-.26-.34%2014%2014%200%200%201-.798-1.221%2017.3%2017.3%200%200%201-1.828-4.469c-.986-3.873-.934-9.225%202.79-15.35l.072-.11c.38-.542%201-.867%201.667-.866m1.867%2017.26q-.02.064-.042.126.091-.276.172-.552zm-1.626-14.786.004.008z'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23C2C3CC'%20d='M59.728%2035.515s-1.736-7.32%206.371-12.183c0%200%20.497%208.29-6.371%2012.183'/%3e%3cpath%20fill='%23D6D6D6'%20fill-rule='evenodd'%20d='M79.915%2011.99c.71.001%201.37.374%201.737.982l-1.74%201.05a281%20281%200%200%201%201.74-1.048l.002.002.002.004.007.011.02.034.063.11q.08.139.21.385c.171.327.402.795.657%201.38a24.6%2024.6%200%200%201%201.527%204.811c.817%203.964.847%209.339-2.5%2014.552a2.033%202.033%200%200%201-3.241.236l1.532-1.333-1.534%201.332-.001-.003-.004-.004-.011-.012-.027-.033-.082-.1a10%2010%200%200%201-.26-.34c-.211-.287-.492-.698-.799-1.221a17.3%2017.3%200%200%201-1.827-4.469c-.986-3.873-.934-9.225%202.79-15.35l.072-.11c.38-.542%201-.867%201.667-.866m2.476%209.544q.013.113.027.228-.058-.477-.135-.934z'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23C2C3CC'%20fill-rule='evenodd'%20d='M72.733%2022.085c.313-.165.691-.154.996.028l-.522.871c.522-.87.521-.871.522-.87l.004.001.007.004.021.013q.027.016.072.046.091.057.25.165c.212.145.507.357.856.635.697.556%201.62%201.383%202.52%202.474%201.803%202.183%203.562%205.475%203.201%209.764a1.016%201.016%200%200%201-1.376.863h-.002l-.004-.002-.008-.002-.023-.01-.079-.033a9.79%209.79%200%200%201-1.139-.603%2012%2012%200%200%201-2.566-2.14c-1.853-2.044-3.57-5.345-3.271-10.365l.017-.131c.057-.3.249-.563.524-.708M78.04%2034.22l.11.075a11%2011%200%200%201-.394-.282zm-4.516-11.027.334.237q0%200%20.003.002a13%2013%200%200%200-.337-.24'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23C2C3CC'%20fill-rule='evenodd'%20d='M85.456%2022.461a1.017%201.017%200%200%201%201.536.81l-1.014.061%201.014-.06v.002l.001.003v.008l.001.024.004.085q.004.108.004.301c0%20.257-.007.62-.04%201.067-.064.89-.227%202.12-.618%203.482-.781%202.723-2.5%206.038-6.237%208.156a1.018%201.018%200%200%201-1.489-.65l-.002-.006-.002-.009-.005-.025a5%205%200%200%201-.065-.367%2010%2010%200%200%201-.096-.999c-.04-.837%200-2.002.316-3.331.639-2.686%202.388-5.97%206.692-8.552'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23D6D6D6'%20fill-rule='evenodd'%20d='M70.232%205.343c.71.002%201.37.374%201.737.982l-1.74%201.05c1.739-1.05%201.74-1.048%201.74-1.048l.002.002q0%20.003.003.004l.008.014.023.04.082.142q.102.18.274.505c.227.432.535%201.053.875%201.834a33%2033%200%200%201%202.036%206.417c1.09%205.284%201.122%2012.4-3.305%2019.3a2.034%202.034%200%200%201-3.242.236l1.532-1.334a223%20223%200%200%201-1.534%201.332l-.002-.002-.004-.005-.012-.013-.033-.04-.102-.124a13%2013%200%200%201-.335-.438%2019%2019%200%200%201-1.048-1.603%2023%2023%200%200%201-2.413-5.902c-1.3-5.104-1.25-12.198%203.719-20.373l.072-.11c.38-.541%201-.867%201.667-.866m1.563%2026.818v-.002l-.003-.002v-.002z'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23AAABAD'%20fill-rule='evenodd'%20d='M60.61%2018.704c.315-.166.693-.155.998.027l-.523.871c.489-.815.52-.868.523-.87l.004.001.009.005.027.017a8%208%200%200%201%20.425.279c.282.192.676.476%201.145.85a23%2023%200%200%201%203.383%203.32c2.419%202.929%204.765%207.325%204.284%2013.05a1.017%201.017%200%200%201-1.376.864l.363-.948-.364.947h-.002l-.003-.002q-.005%200-.01-.003l-.03-.012-.1-.041a9%209%200%200%201-.341-.157c-.288-.139-.69-.35-1.164-.642a16%2016%200%200%201-3.42-2.852c-2.465-2.719-4.768-7.125-4.367-13.866l.017-.131c.058-.3.248-.562.523-.708m.436%201.974q.003-.237.011-.477v-.003a24%2024%200%200%200-.01.48'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23AAABAD'%20fill-rule='evenodd'%20d='M78.103%2019.143a1.016%201.016%200%200%201%201.419.871l-1.014.06%201.014-.06.001.002v.013l.002.032.004.11q.005.142.006.399c0%20.341-.01.83-.054%201.428a23.2%2023.2%200%200%201-.829%204.675c-1.05%203.655-3.348%208.076-8.335%2010.904a1.016%201.016%200%200%201-1.49-.65l.989-.233-.988.232-.001-.001-.001-.004-.002-.01-.007-.032q-.01-.038-.022-.104a9%209%200%200%201-.064-.372c-.047-.317-.1-.768-.127-1.326a16%2016%200%200%201%20.423-4.441c.85-3.574%203.18-7.967%208.96-11.433zm-8.499%2015.032c-.007.617.024%201.143.066%201.552q.032.308.065.524c.043.286.08.443.08.443-.003-.017-.23-.99-.21-2.52m.05-1.027q-.023.282-.036.546l.032-.511q.001-.018.004-.035'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23D6D6D6'%20d='M55.804%2031.519h28.238c.815%200%201.476.663%201.476%201.481v15.847c0%206.204-5.019%2011.241-11.2%2011.241h-8.79c-6.182%200-11.2-5.037-11.2-11.24V33c0-.818.66-1.481%201.476-1.481'/%3e%3cpath%20fill='%23E6E8ED'%20d='M68.15%2032.344v17.159c0%205.103%203.6%209.364%208.39%2010.361%205.122-1.034%208.978-5.574%208.978-11.018V33c0-.818-.66-1.481-1.476-1.481h-15.07a.823.823%200%200%200-.822.824z'/%3e%3cg%20filter='url(%23b)'%20opacity='.7'%3e%3cellipse%20cx='33.238'%20cy='60.952'%20fill='%23D9D9D9'%20rx='28.444'%20ry='3.048'/%3e%3c/g%3e%3cpath%20fill='%233856EC'%20d='M6.095%2017.27h54.857V53.84a6.095%206.095%200%200%201-6.095%206.095H12.19a6.095%206.095%200%200%201-6.095-6.095z'/%3e%3cpath%20fill='%23E2EDFB'%20d='M6.195%2050.145a8.127%208.127%200%200%200%208.127%208.127H37.9a6.1%206.1%200%200%200%204.309-1.785l16.98-16.973a6.1%206.1%200%200%200%201.785-4.31V9.586a6.095%206.095%200%200%200-6.095-6.095H12.29a6.095%206.095%200%200%200-6.095%206.095z'/%3e%3cpath%20fill='%233856EC'%20fill-rule='evenodd'%20d='M60.952%209.009a6.014%206.014%200%200%200-6.014-6.014H12.11a6.014%206.014%200%200%200-6.014%206.014v8.284h54.857zM17.77%2012.772a2.794%202.794%200%201%201%20.002-5.589%202.794%202.794%200%200%201-.002%205.59m15.965%200a2.794%202.794%200%201%201%20.001-5.588%202.794%202.794%200%200%201%200%205.588m16.763%200a2.794%202.794%200%201%201%20.001-5.588%202.794%202.794%200%200%201-.001%205.588'%20clip-rule='evenodd'/%3e%3crect%20width='7.982'%20height='7.982'%20x='11.783'%20y='22.351'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='23.756'%20y='22.351'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='34.931'%20y='22.351'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='46.904'%20y='22.351'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='11.783'%20y='33.526'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='23.756'%20y='33.526'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='34.931'%20y='33.526'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='46.904'%20y='33.526'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='11.783'%20y='44.702'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='23.756'%20y='44.702'%20fill='%23fff'%20rx='2.032'/%3e%3cpath%20fill='%23597EF7'%20d='M40.52%2057.687a6%206%200%200%200%201.665-1.174l17.027-17.021a6%206%200%200%200%201.313-1.973H48.646a8.127%208.127%200%200%200-8.127%208.127z'/%3e%3crect%20width='3.991'%20height='11.974'%20x='15.773'%20fill='%23D9D9D9'%20rx='1.996'/%3e%3crect%20width='3.991'%20height='11.974'%20x='31.738'%20fill='%23D9D9D9'%20rx='1.996'/%3e%3crect%20width='3.991'%20height='11.974'%20x='48.501'%20fill='%23D9D9D9'%20rx='1.996'/%3e%3cdefs%3e%3cfilter%20id='a'%20width='29.46'%20height='8.127'%20x='54.572'%20y='56.889'%20color-interpolation-filters='sRGB'%20filterUnits='userSpaceOnUse'%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'/%3e%3cfeBlend%20in='SourceGraphic'%20in2='BackgroundImageFix'%20result='shape'/%3e%3cfeGaussianBlur%20result='effect1_foregroundBlur_529_4322'%20stdDeviation='1.016'/%3e%3c/filter%3e%3cfilter%20id='b'%20width='60.952'%20height='10.159'%20x='2.762'%20y='55.873'%20color-interpolation-filters='sRGB'%20filterUnits='userSpaceOnUse'%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'/%3e%3cfeBlend%20in='SourceGraphic'%20in2='BackgroundImageFix'%20result='shape'/%3e%3cfeGaussianBlur%20result='effect1_foregroundBlur_529_4322'%20stdDeviation='1.016'/%3e%3c/filter%3e%3c/defs%3e%3c/svg%3e";class _n extends Error{constructor(t,r){const n=new.target.prototype;super(`${t}: Status code '${r}'`),this.statusCode=r,this.__proto__=n}}class Sc extends Error{constructor(t="A timeout occurred."){const r=new.target.prototype;super(t),this.__proto__=r}}class Ar extends Error{constructor(t="An abort occurred."){const r=new.target.prototype;super(t),this.__proto__=r}}class zx extends Error{constructor(t,r){const n=new.target.prototype;super(t),this.transport=r,this.errorType="UnsupportedTransportError",this.__proto__=n}}class Bx extends Error{constructor(t,r){const n=new.target.prototype;super(t),this.transport=r,this.errorType="DisabledTransportError",this.__proto__=n}}class Fx extends Error{constructor(t,r){const n=new.target.prototype;super(t),this.transport=r,this.errorType="FailedToStartTransportError",this.__proto__=n}}class Hf extends Error{constructor(t){const r=new.target.prototype;super(t),this.errorType="FailedToNegotiateWithServerError",this.__proto__=r}}class Wx extends Error{constructor(t,r){const n=new.target.prototype;super(t),this.innerErrors=r,this.__proto__=n}}class Vf{constructor(t,r,n){this.statusCode=t,this.statusText=r,this.content=n}}class Mi{get(t,r){return this.send({...r,method:"GET",url:t})}post(t,r){return this.send({...r,method:"POST",url:t})}delete(t,r){return this.send({...r,method:"DELETE",url:t})}getCookieString(t){return""}}var H;(function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Information=2]="Information",e[e.Warning=3]="Warning",e[e.Error=4]="Error",e[e.Critical=5]="Critical",e[e.None=6]="None"})(H||(H={}));class Ro{constructor(){}log(t,r){}}Ro.instance=new Ro;const Ux="10.0.0";class Bt{static isRequired(t,r){if(t==null)throw new Error(`The '${r}' argument is required.`)}static isNotEmpty(t,r){if(!t||t.match(/^\s*$/))throw new Error(`The '${r}' argument should not be empty.`)}static isIn(t,r,n){if(!(t in r))throw new Error(`Unknown ${n} value: ${t}.`)}}class Dt{static get isBrowser(){return!Dt.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!Dt.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!Dt.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}}function No(e,t){let r="";return wn(e)?(r=`Binary data of length ${e.byteLength}`,t&&(r+=`. Content: '${Hx(e)}'`)):typeof e=="string"&&(r=`String data of length ${e.length}`,t&&(r+=`. Content: '${e}'`)),r}function Hx(e){const t=new Uint8Array(e);let r="";return t.forEach(n=>{const o=n<16?"0":"";r+=`0x${o}${n.toString(16)} `}),r.substring(0,r.length-1)}function wn(e){return e&&typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||e.constructor&&e.constructor.name==="ArrayBuffer")}async function Yf(e,t,r,n,o,s){const i={},[a,c]=Zn();i[a]=c,e.log(H.Trace,`(${t} transport) sending data. ${No(o,s.logMessageContent)}.`);const l=wn(o)?"arraybuffer":"text",d=await r.post(n,{content:o,headers:{...i,...s.headers},responseType:l,timeout:s.timeout,withCredentials:s.withCredentials});e.log(H.Trace,`(${t} transport) request complete. Response status: ${d.statusCode}.`)}function Vx(e){return e===void 0?new Pi(H.Information):e===null?Ro.instance:e.log!==void 0?e:new Pi(e)}class Yx{constructor(t,r){this._subject=t,this._observer=r}dispose(){const t=this._subject.observers.indexOf(this._observer);t>-1&&this._subject.observers.splice(t,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(r=>{})}}class Pi{constructor(t){this._minLevel=t,this.out=console}log(t,r){if(t>=this._minLevel){const n=`[${new Date().toISOString()}] ${H[t]}: ${r}`;switch(t){case H.Critical:case H.Error:this.out.error(n);break;case H.Warning:this.out.warn(n);break;case H.Information:this.out.info(n);break;default:this.out.log(n);break}}}}function Zn(){let e="X-SignalR-User-Agent";return Dt.isNode&&(e="User-Agent"),[e,qx(Ux,Zx(),Kx(),Gx())]}function qx(e,t,r,n){let o="Microsoft SignalR/";const s=e.split(".");return o+=`${s[0]}.${s[1]}`,o+=` (${e}; `,t&&t!==""?o+=`${t}; `:o+="Unknown OS; ",o+=`${r}`,n?o+=`; ${n}`:o+="; Unknown Runtime Version",o+=")",o}function Zx(){if(Dt.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function Gx(){if(Dt.isNode)return process.versions.node}function Kx(){return Dt.isNode?"NodeJS":"Browser"}function Cc(e){return e.stack?e.stack:e.message?e.message:`${e}`}function Qx(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}class Xx extends Mi{constructor(t){if(super(),this._logger=t,typeof fetch>"u"||Dt.isNode){const r=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._jar=new(r("tough-cookie")).CookieJar,typeof fetch>"u"?this._fetchType=r("node-fetch"):this._fetchType=fetch,this._fetchType=r("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(Qx());if(typeof AbortController>"u"){const r=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._abortControllerType=r("abort-controller")}else this._abortControllerType=AbortController}async send(t){if(t.abortSignal&&t.abortSignal.aborted)throw new Ar;if(!t.method)throw new Error("No method defined.");if(!t.url)throw new Error("No url defined.");const r=new this._abortControllerType;let n;t.abortSignal&&(t.abortSignal.onabort=()=>{r.abort(),n=new Ar});let o=null;if(t.timeout){const c=t.timeout;o=setTimeout(()=>{r.abort(),this._logger.log(H.Warning,"Timeout from HTTP request."),n=new Sc},c)}t.content===""&&(t.content=void 0),t.content&&(t.headers=t.headers||{},wn(t.content)?t.headers["Content-Type"]="application/octet-stream":t.headers["Content-Type"]="text/plain;charset=UTF-8");let s;try{s=await this._fetchType(t.url,{body:t.content,cache:"no-cache",credentials:t.withCredentials===!0?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...t.headers},method:t.method,mode:"cors",redirect:"follow",signal:r.signal})}catch(c){throw n||(this._logger.log(H.Warning,`Error from HTTP request. ${c}.`),c)}finally{o&&clearTimeout(o),t.abortSignal&&(t.abortSignal.onabort=null)}if(!s.ok){const c=await qf(s,"text");throw new _n(c||s.statusText,s.status)}const a=await qf(s,t.responseType);return new Vf(s.status,s.statusText,a)}getCookieString(t){let r="";return Dt.isNode&&this._jar&&this._jar.getCookies(t,(n,o)=>r=o.join("; ")),r}}function qf(e,t){let r;switch(t){case"arraybuffer":r=e.arrayBuffer();break;case"text":r=e.text();break;case"blob":case"document":case"json":throw new Error(`${t} is not supported.`);default:r=e.text();break}return r}class Jx extends Mi{constructor(t){super(),this._logger=t}send(t){return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new Ar):t.method?t.url?new Promise((r,n)=>{const o=new XMLHttpRequest;o.open(t.method,t.url,!0),o.withCredentials=t.withCredentials===void 0?!0:t.withCredentials,o.setRequestHeader("X-Requested-With","XMLHttpRequest"),t.content===""&&(t.content=void 0),t.content&&(wn(t.content)?o.setRequestHeader("Content-Type","application/octet-stream"):o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const s=t.headers;s&&Object.keys(s).forEach(i=>{o.setRequestHeader(i,s[i])}),t.responseType&&(o.responseType=t.responseType),t.abortSignal&&(t.abortSignal.onabort=()=>{o.abort(),n(new Ar)}),t.timeout&&(o.timeout=t.timeout),o.onload=()=>{t.abortSignal&&(t.abortSignal.onabort=null),o.status>=200&&o.status<300?r(new Vf(o.status,o.statusText,o.response||o.responseText)):n(new _n(o.response||o.responseText||o.statusText,o.status))},o.onerror=()=>{this._logger.log(H.Warning,`Error from HTTP request. ${o.status}: ${o.statusText}.`),n(new _n(o.statusText,o.status))},o.ontimeout=()=>{this._logger.log(H.Warning,"Timeout from HTTP request."),n(new Sc)},o.send(t.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class e_ extends Mi{constructor(t){if(super(),typeof fetch<"u"||Dt.isNode)this._httpClient=new Xx(t);else if(typeof XMLHttpRequest<"u")this._httpClient=new Jx(t);else throw new Error("No usable HttpClient found.")}send(t){return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new Ar):t.method?t.url?this._httpClient.send(t):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(t){return this._httpClient.getCookieString(t)}}class fr{static write(t){return`${t}${fr.RecordSeparator}`}static parse(t){if(t[t.length-1]!==fr.RecordSeparator)throw new Error("Message is incomplete.");const r=t.split(fr.RecordSeparator);return r.pop(),r}}fr.RecordSeparatorCode=30,fr.RecordSeparator=String.fromCharCode(fr.RecordSeparatorCode);class t_{writeHandshakeRequest(t){return fr.write(JSON.stringify(t))}parseHandshakeResponse(t){let r,n;if(wn(t)){const a=new Uint8Array(t),c=a.indexOf(fr.RecordSeparatorCode);if(c===-1)throw new Error("Message is incomplete.");const l=c+1;r=String.fromCharCode.apply(null,Array.prototype.slice.call(a.slice(0,l))),n=a.byteLength>l?a.slice(l).buffer:null}else{const a=t,c=a.indexOf(fr.RecordSeparator);if(c===-1)throw new Error("Message is incomplete.");const l=c+1;r=a.substring(0,l),n=a.length>l?a.substring(l):null}const o=fr.parse(r),s=JSON.parse(o[0]);if(s.type)throw new Error("Expected a handshake response from the server.");return[n,s]}}var $e;(function(e){e[e.Invocation=1]="Invocation",e[e.StreamItem=2]="StreamItem",e[e.Completion=3]="Completion",e[e.StreamInvocation=4]="StreamInvocation",e[e.CancelInvocation=5]="CancelInvocation",e[e.Ping=6]="Ping",e[e.Close=7]="Close",e[e.Ack=8]="Ack",e[e.Sequence=9]="Sequence"})($e||($e={}));class r_{constructor(){this.observers=[]}next(t){for(const r of this.observers)r.next(t)}error(t){for(const r of this.observers)r.error&&r.error(t)}complete(){for(const t of this.observers)t.complete&&t.complete()}subscribe(t){return this.observers.push(t),new Yx(this,t)}}class n_{constructor(t,r,n){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=t,this._connection=r,this._bufferSize=n}async _send(t){const r=this._protocol.writeMessage(t);let n=Promise.resolve();if(this._isInvocationMessage(t)){this._totalMessageCount++;let o=()=>{},s=()=>{};wn(r)?this._bufferedByteCount+=r.byteLength:this._bufferedByteCount+=r.length,this._bufferedByteCount>=this._bufferSize&&(n=new Promise((i,a)=>{o=i,s=a})),this._messages.push(new o_(r,this._totalMessageCount,o,s))}try{this._reconnectInProgress||await this._connection.send(r)}catch{this._disconnected()}await n}_ack(t){let r=-1;for(let n=0;n<this._messages.length;n++){const o=this._messages[n];if(o._id<=t.sequenceId)r=n,wn(o._message)?this._bufferedByteCount-=o._message.byteLength:this._bufferedByteCount-=o._message.length,o._resolver();else if(this._bufferedByteCount<this._bufferSize)o._resolver();else break}r!==-1&&(this._messages=this._messages.slice(r+1))}_shouldProcessMessage(t){if(this._waitForSequenceMessage)return t.type!==$e.Sequence?!1:(this._waitForSequenceMessage=!1,!0);if(!this._isInvocationMessage(t))return!0;const r=this._nextReceivingSequenceId;return this._nextReceivingSequenceId++,r<=this._latestReceivedSequenceId?(r===this._latestReceivedSequenceId&&this._ackTimer(),!1):(this._latestReceivedSequenceId=r,this._ackTimer(),!0)}_resetSequence(t){if(t.sequenceId>this._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=t.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){const t=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:$e.Sequence,sequenceId:t}));const r=this._messages;for(const n of r)await this._connection.send(n._message);this._reconnectInProgress=!1}_dispose(t){t??(t=new Error("Unable to reconnect to server."));for(const r of this._messages)r._rejector(t)}_isInvocationMessage(t){switch(t.type){case $e.Invocation:case $e.StreamItem:case $e.Completion:case $e.StreamInvocation:case $e.CancelInvocation:return!0;case $e.Close:case $e.Sequence:case $e.Ping:case $e.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:$e.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0},1e3))}}class o_{constructor(t,r,n,o){this._message=t,this._id=r,this._resolver=n,this._rejector=o}}const s_=30*1e3,i_=15*1e3,a_=1e5;var bt;(function(e){e.Disconnected="Disconnected",e.Connecting="Connecting",e.Connected="Connected",e.Disconnecting="Disconnecting",e.Reconnecting="Reconnecting"})(bt||(bt={}));class Ec{static create(t,r,n,o,s,i,a){return new Ec(t,r,n,o,s,i,a)}constructor(t,r,n,o,s,i,a){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(H.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},Bt.isRequired(t,"connection"),Bt.isRequired(r,"logger"),Bt.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=s??s_,this.keepAliveIntervalInMilliseconds=i??i_,this._statefulReconnectBufferSize=a??a_,this._logger=r,this._protocol=n,this.connection=t,this._reconnectPolicy=o,this._handshakeProtocol=new t_,this.connection.onreceive=c=>this._processIncomingData(c),this.connection.onclose=c=>this._connectionClosed(c),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=bt.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:$e.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(t){if(this._connectionState!==bt.Disconnected&&this._connectionState!==bt.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!t)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=t}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}async _startWithStateTransitions(){if(this._connectionState!==bt.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=bt.Connecting,this._logger.log(H.Debug,"Starting HubConnection.");try{await this._startInternal(),Dt.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=bt.Connected,this._connectionStarted=!0,this._logger.log(H.Debug,"HubConnection connected successfully.")}catch(t){return this._connectionState=bt.Disconnected,this._logger.log(H.Debug,`HubConnection failed to start successfully because of error '${t}'.`),Promise.reject(t)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;const t=new Promise((r,n)=>{this._handshakeResolver=r,this._handshakeRejecter=n});await this.connection.start(this._protocol.transferFormat);try{let r=this._protocol.version;this.connection.features.reconnect||(r=1);const n={protocol:this._protocol.name,version:r};if(this._logger.log(H.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(n)),this._logger.log(H.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await t,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new n_(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(r){throw this._logger.log(H.Debug,`Hub handshake failed with error '${r}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(r),r}}async stop(){const t=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await t}catch{}}_stopInternal(t){if(this._connectionState===bt.Disconnected)return this._logger.log(H.Debug,`Call to HubConnection.stop(${t}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===bt.Disconnecting)return this._logger.log(H.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;const r=this._connectionState;return this._connectionState=bt.Disconnecting,this._logger.log(H.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(H.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(r===bt.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=t||new Ar("The connection was stopped before the hub handshake could complete."),this.connection.stop(t))}async _sendCloseMessage(){try{await this._sendWithProtocol(this._createCloseMessage())}catch{}}stream(t,...r){const[n,o]=this._replaceStreamingParams(r),s=this._createStreamInvocation(t,r,o);let i;const a=new r_;return a.cancelCallback=()=>{const c=this._createCancelInvocation(s.invocationId);return delete this._callbacks[s.invocationId],i.then(()=>this._sendWithProtocol(c))},this._callbacks[s.invocationId]=(c,l)=>{if(l){a.error(l);return}else c&&(c.type===$e.Completion?c.error?a.error(new Error(c.error)):a.complete():a.next(c.item))},i=this._sendWithProtocol(s).catch(c=>{a.error(c),delete this._callbacks[s.invocationId]}),this._launchStreams(n,i),a}_sendMessage(t){return this._resetKeepAliveInterval(),this.connection.send(t)}_sendWithProtocol(t){return this._messageBuffer?this._messageBuffer._send(t):this._sendMessage(this._protocol.writeMessage(t))}send(t,...r){const[n,o]=this._replaceStreamingParams(r),s=this._sendWithProtocol(this._createInvocation(t,r,!0,o));return this._launchStreams(n,s),s}invoke(t,...r){const[n,o]=this._replaceStreamingParams(r),s=this._createInvocation(t,r,!1,o);return new Promise((a,c)=>{this._callbacks[s.invocationId]=(d,f)=>{if(f){c(f);return}else d&&(d.type===$e.Completion?d.error?c(new Error(d.error)):a(d.result):c(new Error(`Unexpected message type: ${d.type}`)))};const l=this._sendWithProtocol(s).catch(d=>{c(d),delete this._callbacks[s.invocationId]});this._launchStreams(n,l)})}on(t,r){!t||!r||(t=t.toLowerCase(),this._methods[t]||(this._methods[t]=[]),this._methods[t].indexOf(r)===-1&&this._methods[t].push(r))}off(t,r){if(!t)return;t=t.toLowerCase();const n=this._methods[t];if(n)if(r){const o=n.indexOf(r);o!==-1&&(n.splice(o,1),n.length===0&&delete this._methods[t])}else delete this._methods[t]}onclose(t){t&&this._closedCallbacks.push(t)}onreconnecting(t){t&&this._reconnectingCallbacks.push(t)}onreconnected(t){t&&this._reconnectedCallbacks.push(t)}_processIncomingData(t){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(t=this._processHandshakeResponse(t),this._receivedHandshakeResponse=!0),t){const r=this._protocol.parseMessages(t,this._logger);for(const n of r)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(n)))switch(n.type){case $e.Invocation:this._invokeClientMethod(n).catch(o=>{this._logger.log(H.Error,`Invoke client method threw error: ${Cc(o)}`)});break;case $e.StreamItem:case $e.Completion:{const o=this._callbacks[n.invocationId];if(o){n.type===$e.Completion&&delete this._callbacks[n.invocationId];try{o(n)}catch(s){this._logger.log(H.Error,`Stream callback threw error: ${Cc(s)}`)}}break}case $e.Ping:break;case $e.Close:{this._logger.log(H.Information,"Close message received from server.");const o=n.error?new Error("Server returned an error on close: "+n.error):void 0;n.allowReconnect===!0?this.connection.stop(o):this._stopPromise=this._stopInternal(o);break}case $e.Ack:this._messageBuffer&&this._messageBuffer._ack(n);break;case $e.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(n);break;default:this._logger.log(H.Warning,`Invalid message type: ${n.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(t){let r,n;try{[n,r]=this._handshakeProtocol.parseHandshakeResponse(t)}catch(o){const s="Error parsing handshake response: "+o;this._logger.log(H.Error,s);const i=new Error(s);throw this._handshakeRejecter(i),i}if(r.error){const o="Server returned handshake error: "+r.error;this._logger.log(H.Error,o);const s=new Error(o);throw this._handshakeRejecter(s),s}else this._logger.log(H.Debug,"Server handshake complete.");return this._handshakeResolver(),n}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if(!this.connection.features||!this.connection.features.inherentKeepAlive){this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds);let t=this._nextKeepAlive-new Date().getTime();if(t<0){this._connectionState===bt.Connected&&this._trySendPingMessage();return}this._pingServerHandle===void 0&&(t<0&&(t=0),this._pingServerHandle=setTimeout(async()=>{this._connectionState===bt.Connected&&await this._trySendPingMessage()},t))}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(t){const r=t.target.toLowerCase(),n=this._methods[r];if(!n){this._logger.log(H.Warning,`No client method with the name '${r}' found.`),t.invocationId&&(this._logger.log(H.Warning,`No result given for '${r}' method and invocation ID '${t.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(t.invocationId,"Client didn't provide a result.",null)));return}const o=n.slice(),s=!!t.invocationId;let i,a,c;for(const l of o)try{const d=i;i=await l.apply(this,t.arguments),s&&i&&d&&(this._logger.log(H.Error,`Multiple results provided for '${r}'. Sending error to server.`),c=this._createCompletionMessage(t.invocationId,"Client provided multiple results.",null)),a=void 0}catch(d){a=d,this._logger.log(H.Error,`A callback for the method '${r}' threw error '${d}'.`)}c?await this._sendWithProtocol(c):s?(a?c=this._createCompletionMessage(t.invocationId,`${a}`,null):i!==void 0?c=this._createCompletionMessage(t.invocationId,null,i):(this._logger.log(H.Warning,`No result given for '${r}' method and invocation ID '${t.invocationId}'.`),c=this._createCompletionMessage(t.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(c)):i&&this._logger.log(H.Error,`Result given for '${r}' method but server is not expecting a result.`)}_connectionClosed(t){this._logger.log(H.Debug,`HubConnection.connectionClosed(${t}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||t||new Ar("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(t||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===bt.Disconnecting?this._completeClose(t):this._connectionState===bt.Connected&&this._reconnectPolicy?this._reconnect(t):this._connectionState===bt.Connected&&this._completeClose(t)}_completeClose(t){if(this._connectionStarted){this._connectionState=bt.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(t??new Error("Connection closed.")),this._messageBuffer=void 0),Dt.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(r=>r.apply(this,[t]))}catch(r){this._logger.log(H.Error,`An onclose callback called with error '${t}' threw error '${r}'.`)}}}async _reconnect(t){const r=Date.now();let n=0,o=t!==void 0?t:new Error("Attempting to reconnect due to a unknown error."),s=this._getNextRetryDelay(n,0,o);if(s===null){this._logger.log(H.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(t);return}if(this._connectionState=bt.Reconnecting,t?this._logger.log(H.Information,`Connection reconnecting because of error '${t}'.`):this._logger.log(H.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(i=>i.apply(this,[t]))}catch(i){this._logger.log(H.Error,`An onreconnecting callback called with error '${t}' threw error '${i}'.`)}if(this._connectionState!==bt.Reconnecting){this._logger.log(H.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;s!==null;){if(this._logger.log(H.Information,`Reconnect attempt number ${n+1} will start in ${s} ms.`),await new Promise(i=>{this._reconnectDelayHandle=setTimeout(i,s)}),this._reconnectDelayHandle=void 0,this._connectionState!==bt.Reconnecting){this._logger.log(H.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(await this._startInternal(),this._connectionState=bt.Connected,this._logger.log(H.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(i=>i.apply(this,[this.connection.connectionId]))}catch(i){this._logger.log(H.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${i}'.`)}return}catch(i){if(this._logger.log(H.Information,`Reconnect attempt failed because of error '${i}'.`),this._connectionState!==bt.Reconnecting){this._logger.log(H.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===bt.Disconnecting&&this._completeClose();return}n++,o=i instanceof Error?i:new Error(i.toString()),s=this._getNextRetryDelay(n,Date.now()-r,o)}}this._logger.log(H.Information,`Reconnect retries have been exhausted after ${Date.now()-r} ms and ${n} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(t,r,n){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:r,previousRetryCount:t,retryReason:n})}catch(o){return this._logger.log(H.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${t}, ${r}) threw error '${o}'.`),null}}_cancelCallbacksWithError(t){const r=this._callbacks;this._callbacks={},Object.keys(r).forEach(n=>{const o=r[n];try{o(null,t)}catch(s){this._logger.log(H.Error,`Stream 'error' callback called with '${t}' threw error: ${Cc(s)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(t,r,n,o){if(n)return o.length!==0?{target:t,arguments:r,streamIds:o,type:$e.Invocation}:{target:t,arguments:r,type:$e.Invocation};{const s=this._invocationId;return this._invocationId++,o.length!==0?{target:t,arguments:r,invocationId:s.toString(),streamIds:o,type:$e.Invocation}:{target:t,arguments:r,invocationId:s.toString(),type:$e.Invocation}}}_launchStreams(t,r){if(t.length!==0){r||(r=Promise.resolve());for(const n in t)t[n].subscribe({complete:()=>{r=r.then(()=>this._sendWithProtocol(this._createCompletionMessage(n)))},error:o=>{let s;o instanceof Error?s=o.message:o&&o.toString?s=o.toString():s="Unknown error",r=r.then(()=>this._sendWithProtocol(this._createCompletionMessage(n,s)))},next:o=>{r=r.then(()=>this._sendWithProtocol(this._createStreamItemMessage(n,o)))}})}}_replaceStreamingParams(t){const r=[],n=[];for(let o=0;o<t.length;o++){const s=t[o];if(this._isObservable(s)){const i=this._invocationId;this._invocationId++,r[i]=s,n.push(i.toString()),t.splice(o,1)}}return[r,n]}_isObservable(t){return t&&t.subscribe&&typeof t.subscribe=="function"}_createStreamInvocation(t,r,n){const o=this._invocationId;return this._invocationId++,n.length!==0?{target:t,arguments:r,invocationId:o.toString(),streamIds:n,type:$e.StreamInvocation}:{target:t,arguments:r,invocationId:o.toString(),type:$e.StreamInvocation}}_createCancelInvocation(t){return{invocationId:t,type:$e.CancelInvocation}}_createStreamItemMessage(t,r){return{invocationId:t,item:r,type:$e.StreamItem}}_createCompletionMessage(t,r,n){return r?{error:r,invocationId:t,type:$e.Completion}:{invocationId:t,result:n,type:$e.Completion}}_createCloseMessage(){return{type:$e.Close}}async _trySendPingMessage(){try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}}}const c_=[0,2e3,1e4,3e4,null];class Zf{constructor(t){this._retryDelays=t!==void 0?[...t,null]:c_}nextRetryDelayInMilliseconds(t){return this._retryDelays[t.previousRetryCount]}}class Sn{}Sn.Authorization="Authorization",Sn.Cookie="Cookie";class l_ extends Mi{constructor(t,r){super(),this._innerClient=t,this._accessTokenFactory=r}async send(t){let r=!0;this._accessTokenFactory&&(!this._accessToken||t.url&&t.url.indexOf("/negotiate?")>0)&&(r=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(t);const n=await this._innerClient.send(t);return r&&n.statusCode===401&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(t),await this._innerClient.send(t)):n}_setAuthorizationHeader(t){t.headers||(t.headers={}),this._accessToken?t.headers[Sn.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&t.headers[Sn.Authorization]&&delete t.headers[Sn.Authorization]}getCookieString(t){return this._innerClient.getCookieString(t)}}var Wt;(function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"})(Wt||(Wt={}));var Jt;(function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"})(Jt||(Jt={}));let u_=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};class Gf{get pollAborted(){return this._pollAbort.aborted}constructor(t,r,n){this._httpClient=t,this._logger=r,this._pollAbort=new u_,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}async connect(t,r){if(Bt.isRequired(t,"url"),Bt.isRequired(r,"transferFormat"),Bt.isIn(r,Jt,"transferFormat"),this._url=t,this._logger.log(H.Trace,"(LongPolling transport) Connecting."),r===Jt.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[n,o]=Zn(),s={[n]:o,...this._options.headers},i={abortSignal:this._pollAbort.signal,headers:s,timeout:1e5,withCredentials:this._options.withCredentials};r===Jt.Binary&&(i.responseType="arraybuffer");const a=`${t}&_=${Date.now()}`;this._logger.log(H.Trace,`(LongPolling transport) polling: ${a}.`);const c=await this._httpClient.get(a,i);c.statusCode!==200?(this._logger.log(H.Error,`(LongPolling transport) Unexpected response code: ${c.statusCode}.`),this._closeError=new _n(c.statusText||"",c.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,i)}async _poll(t,r){try{for(;this._running;)try{const n=`${t}&_=${Date.now()}`;this._logger.log(H.Trace,`(LongPolling transport) polling: ${n}.`);const o=await this._httpClient.get(n,r);o.statusCode===204?(this._logger.log(H.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):o.statusCode!==200?(this._logger.log(H.Error,`(LongPolling transport) Unexpected response code: ${o.statusCode}.`),this._closeError=new _n(o.statusText||"",o.statusCode),this._running=!1):o.content?(this._logger.log(H.Trace,`(LongPolling transport) data received. ${No(o.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(o.content)):this._logger.log(H.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(n){this._running?n instanceof Sc?this._logger.log(H.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=n,this._running=!1):this._logger.log(H.Trace,`(LongPolling transport) Poll errored after shutdown: ${n.message}`)}}finally{this._logger.log(H.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(t){return this._running?Yf(this._logger,"LongPolling",this._httpClient,this._url,t,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(H.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(H.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const t={},[r,n]=Zn();t[r]=n;const o={headers:{...t,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};let s;try{await this._httpClient.delete(this._url,o)}catch(i){s=i}s?s instanceof _n&&(s.statusCode===404?this._logger.log(H.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(H.Trace,`(LongPolling transport) Error sending a DELETE request: ${s}`)):this._logger.log(H.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(H.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let t="(LongPolling transport) Firing onclose event.";this._closeError&&(t+=" Error: "+this._closeError),this._logger.log(H.Trace,t),this.onclose(this._closeError)}}}class d_{constructor(t,r,n,o){this._httpClient=t,this._accessToken=r,this._logger=n,this._options=o,this.onreceive=null,this.onclose=null}async connect(t,r){return Bt.isRequired(t,"url"),Bt.isRequired(r,"transferFormat"),Bt.isIn(r,Jt,"transferFormat"),this._logger.log(H.Trace,"(SSE transport) Connecting."),this._url=t,this._accessToken&&(t+=(t.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((n,o)=>{let s=!1;if(r!==Jt.Text){o(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let i;if(Dt.isBrowser||Dt.isWebWorker)i=new this._options.EventSource(t,{withCredentials:this._options.withCredentials});else{const a=this._httpClient.getCookieString(t),c={};c.Cookie=a;const[l,d]=Zn();c[l]=d,i=new this._options.EventSource(t,{withCredentials:this._options.withCredentials,headers:{...c,...this._options.headers}})}try{i.onmessage=a=>{if(this.onreceive)try{this._logger.log(H.Trace,`(SSE transport) data received. ${No(a.data,this._options.logMessageContent)}.`),this.onreceive(a.data)}catch(c){this._close(c);return}},i.onerror=a=>{s?this._close():o(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},i.onopen=()=>{this._logger.log(H.Information,`SSE connected to ${this._url}`),this._eventSource=i,s=!0,n()}}catch(a){o(a);return}})}async send(t){return this._eventSource?Yf(this._logger,"SSE",this._httpClient,this._url,t,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(t){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(t))}}class f_{constructor(t,r,n,o,s,i){this._logger=n,this._accessTokenFactory=r,this._logMessageContent=o,this._webSocketConstructor=s,this._httpClient=t,this.onreceive=null,this.onclose=null,this._headers=i}async connect(t,r){Bt.isRequired(t,"url"),Bt.isRequired(r,"transferFormat"),Bt.isIn(r,Jt,"transferFormat"),this._logger.log(H.Trace,"(WebSockets transport) Connecting.");let n;return this._accessTokenFactory&&(n=await this._accessTokenFactory()),new Promise((o,s)=>{t=t.replace(/^http/,"ws");let i;const a=this._httpClient.getCookieString(t);let c=!1;if(Dt.isNode||Dt.isReactNative){const l={},[d,f]=Zn();l[d]=f,n&&(l[Sn.Authorization]=`Bearer ${n}`),a&&(l[Sn.Cookie]=a),i=new this._webSocketConstructor(t,void 0,{headers:{...l,...this._headers}})}else n&&(t+=(t.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(n)}`);i||(i=new this._webSocketConstructor(t)),r===Jt.Binary&&(i.binaryType="arraybuffer"),i.onopen=l=>{this._logger.log(H.Information,`WebSocket connected to ${t}.`),this._webSocket=i,c=!0,o()},i.onerror=l=>{let d=null;typeof ErrorEvent<"u"&&l instanceof ErrorEvent?d=l.error:d="There was an error with the transport",this._logger.log(H.Information,`(WebSockets transport) ${d}.`)},i.onmessage=l=>{if(this._logger.log(H.Trace,`(WebSockets transport) data received. ${No(l.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(l.data)}catch(d){this._close(d);return}},i.onclose=l=>{if(c)this._close(l);else{let d=null;typeof ErrorEvent<"u"&&l instanceof ErrorEvent?d=l.error:d="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",s(new Error(d))}}})}send(t){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(H.Trace,`(WebSockets transport) sending data. ${No(t,this._logMessageContent)}.`),this._webSocket.send(t),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(t){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(H.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(t)&&(t.wasClean===!1||t.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${t.code} (${t.reason||"no reason given"}).`)):t instanceof Error?this.onclose(t):this.onclose())}_isCloseEvent(t){return t&&typeof t.wasClean=="boolean"&&typeof t.code=="number"}}const Kf=100;class p_{constructor(t,r={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,Bt.isRequired(t,"url"),this._logger=Vx(r.logger),this.baseUrl=this._resolveUrl(t),r=r||{},r.logMessageContent=r.logMessageContent===void 0?!1:r.logMessageContent,typeof r.withCredentials=="boolean"||r.withCredentials===void 0)r.withCredentials=r.withCredentials===void 0?!0:r.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");r.timeout=r.timeout===void 0?100*1e3:r.timeout;let n=null,o=null;if(Dt.isNode&&typeof require<"u"){const s=typeof __webpack_require__=="function"?__non_webpack_require__:require;n=s("ws"),o=s("eventsource")}!Dt.isNode&&typeof WebSocket<"u"&&!r.WebSocket?r.WebSocket=WebSocket:Dt.isNode&&!r.WebSocket&&n&&(r.WebSocket=n),!Dt.isNode&&typeof EventSource<"u"&&!r.EventSource?r.EventSource=EventSource:Dt.isNode&&!r.EventSource&&typeof o<"u"&&(r.EventSource=o),this._httpClient=new l_(r.httpClient||new e_(this._logger),r.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=r,this.onreceive=null,this.onclose=null}async start(t){if(t=t||Jt.Binary,Bt.isIn(t,Jt,"transferFormat"),this._logger.log(H.Debug,`Starting connection with transfer format '${Jt[t]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(t),await this._startInternalPromise,this._connectionState==="Disconnecting"){const r="Failed to start the HttpConnection before stop() was called.";return this._logger.log(H.Error,r),await this._stopPromise,Promise.reject(new Ar(r))}else if(this._connectionState!=="Connected"){const r="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(H.Error,r),Promise.reject(new Ar(r))}this._connectionStarted=!0}send(t){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new Dc(this.transport)),this._sendQueue.send(t))}async stop(t){if(this._connectionState==="Disconnected")return this._logger.log(H.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(H.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(r=>{this._stopPromiseResolver=r}),await this._stopInternal(t),await this._stopPromise}async _stopInternal(t){this._stopError=t;try{await this._startInternalPromise}catch{}if(this.transport){try{await this.transport.stop()}catch(r){this._logger.log(H.Error,`HttpConnection.transport.stop() threw error '${r}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(H.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(t){let r=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===Wt.WebSockets)this.transport=this._constructTransport(Wt.WebSockets),await this._startTransport(r,t);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let n=null,o=0;do{if(n=await this._getNegotiationResponse(r),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new Ar("The connection was stopped during negotiation.");if(n.error)throw new Error(n.error);if(n.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(n.url&&(r=n.url),n.accessToken){const s=n.accessToken;this._accessTokenFactory=()=>s,this._httpClient._accessToken=s,this._httpClient._accessTokenFactory=void 0}o++}while(n.url&&o<Kf);if(o===Kf&&n.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(r,this._options.transport,n,t)}this.transport instanceof Gf&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(H.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(n){return this._logger.log(H.Error,"Failed to start the connection: "+n),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(n)}}async _getNegotiationResponse(t){const r={},[n,o]=Zn();r[n]=o;const s=this._resolveNegotiateUrl(t);this._logger.log(H.Debug,`Sending negotiation request: ${s}.`);try{const i=await this._httpClient.post(s,{content:"",headers:{...r,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(i.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${i.statusCode}'`));const a=JSON.parse(i.content);return(!a.negotiateVersion||a.negotiateVersion<1)&&(a.connectionToken=a.connectionId),a.useStatefulReconnect&&this._options._useStatefulReconnect!==!0?Promise.reject(new Hf("Client didn't negotiate Stateful Reconnect but the server did.")):a}catch(i){let a="Failed to complete negotiation with the server: "+i;return i instanceof _n&&i.statusCode===404&&(a=a+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(H.Error,a),Promise.reject(new Hf(a))}}_createConnectUrl(t,r){return r?t+(t.indexOf("?")===-1?"?":"&")+`id=${r}`:t}async _createTransport(t,r,n,o){let s=this._createConnectUrl(t,n.connectionToken);if(this._isITransport(r)){this._logger.log(H.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=r,await this._startTransport(s,o),this.connectionId=n.connectionId;return}const i=[],a=n.availableTransports||[];let c=n;for(const l of a){const d=this._resolveTransportOrError(l,r,o,c?.useStatefulReconnect===!0);if(d instanceof Error)i.push(`${l.transport} failed:`),i.push(d);else if(this._isITransport(d)){if(this.transport=d,!c){try{c=await this._getNegotiationResponse(t)}catch(f){return Promise.reject(f)}s=this._createConnectUrl(t,c.connectionToken)}try{await this._startTransport(s,o),this.connectionId=c.connectionId;return}catch(f){if(this._logger.log(H.Error,`Failed to start the transport '${l.transport}': ${f}`),c=void 0,i.push(new Fx(`${l.transport} failed: ${f}`,Wt[l.transport])),this._connectionState!=="Connecting"){const h="Failed to select transport before stop() was called.";return this._logger.log(H.Debug,h),Promise.reject(new Ar(h))}}}}return i.length>0?Promise.reject(new Wx(`Unable to connect to the server with any of the available transports. ${i.join(" ")}`,i)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(t){switch(t){case Wt.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new f_(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case Wt.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new d_(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case Wt.LongPolling:return new Gf(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${t}.`)}}_startTransport(t,r){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async n=>{let o=!1;if(this.features.reconnect)try{this.features.disconnected(),await this.transport.connect(t,r),await this.features.resend()}catch{o=!0}else{this._stopConnection(n);return}o&&this._stopConnection(n)}:this.transport.onclose=n=>this._stopConnection(n),this.transport.connect(t,r)}_resolveTransportOrError(t,r,n,o){const s=Wt[t.transport];if(s==null)return this._logger.log(H.Debug,`Skipping transport '${t.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${t.transport}' because it is not supported by this client.`);if(h_(r,s))if(t.transferFormats.map(a=>Jt[a]).indexOf(n)>=0){if(s===Wt.WebSockets&&!this._options.WebSocket||s===Wt.ServerSentEvents&&!this._options.EventSource)return this._logger.log(H.Debug,`Skipping transport '${Wt[s]}' because it is not supported in your environment.'`),new zx(`'${Wt[s]}' is not supported in your environment.`,s);this._logger.log(H.Debug,`Selecting transport '${Wt[s]}'.`);try{return this.features.reconnect=s===Wt.WebSockets?o:void 0,this._constructTransport(s)}catch(a){return a}}else return this._logger.log(H.Debug,`Skipping transport '${Wt[s]}' because it does not support the requested transfer format '${Jt[n]}'.`),new Error(`'${Wt[s]}' does not support ${Jt[n]}.`);else return this._logger.log(H.Debug,`Skipping transport '${Wt[s]}' because it was disabled by the client.`),new Bx(`'${Wt[s]}' is disabled by the client.`,s)}_isITransport(t){return t&&typeof t=="object"&&"connect"in t}_stopConnection(t){if(this._logger.log(H.Debug,`HttpConnection.stopConnection(${t}) called while in state ${this._connectionState}.`),this.transport=void 0,t=this._stopError||t,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(H.Debug,`Call to HttpConnection.stopConnection(${t}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(H.Warning,`Call to HttpConnection.stopConnection(${t}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${t}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),t?this._logger.log(H.Error,`Connection disconnected with error '${t}'.`):this._logger.log(H.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(r=>{this._logger.log(H.Error,`TransportSendQueue.stop() threw error '${r}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(t)}catch(r){this._logger.log(H.Error,`HttpConnection.onclose(${t}) threw error '${r}'.`)}}}_resolveUrl(t){if(t.lastIndexOf("https://",0)===0||t.lastIndexOf("http://",0)===0)return t;if(!Dt.isBrowser)throw new Error(`Cannot resolve '${t}'.`);const r=window.document.createElement("a");return r.href=t,this._logger.log(H.Information,`Normalizing '${t}' to '${r.href}'.`),r.href}_resolveNegotiateUrl(t){const r=new URL(t);r.pathname.endsWith("/")?r.pathname+="negotiate":r.pathname+="/negotiate";const n=new URLSearchParams(r.searchParams);return n.has("negotiateVersion")||n.append("negotiateVersion",this._negotiateVersion.toString()),n.has("useStatefulReconnect")?n.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&n.append("useStatefulReconnect","true"),r.search=n.toString(),r.toString()}}function h_(e,t){return!e||(t&e)!==0}class Dc{constructor(t){this._transport=t,this._buffer=[],this._executing=!0,this._sendBufferedData=new Oi,this._transportResult=new Oi,this._sendLoopPromise=this._sendLoop()}send(t){return this._bufferData(t),this._transportResult||(this._transportResult=new Oi),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(t){if(this._buffer.length&&typeof this._buffer[0]!=typeof t)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof t}`);this._buffer.push(t),this._sendBufferedData.resolve()}async _sendLoop(){for(;;){if(await this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new Oi;const t=this._transportResult;this._transportResult=void 0;const r=typeof this._buffer[0]=="string"?this._buffer.join(""):Dc._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(r),t.resolve()}catch(n){t.reject(n)}}}static _concatBuffers(t){const r=t.map(s=>s.byteLength).reduce((s,i)=>s+i),n=new Uint8Array(r);let o=0;for(const s of t)n.set(new Uint8Array(s),o),o+=s.byteLength;return n.buffer}}class Oi{constructor(){this.promise=new Promise((t,r)=>[this._resolver,this._rejecter]=[t,r])}resolve(){this._resolver()}reject(t){this._rejecter(t)}}const m_="json";class g_{constructor(){this.name=m_,this.version=2,this.transferFormat=Jt.Text}parseMessages(t,r){if(typeof t!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!t)return[];r===null&&(r=Ro.instance);const n=fr.parse(t),o=[];for(const s of n){const i=JSON.parse(s);if(typeof i.type!="number")throw new Error("Invalid payload.");switch(i.type){case $e.Invocation:this._isInvocationMessage(i);break;case $e.StreamItem:this._isStreamItemMessage(i);break;case $e.Completion:this._isCompletionMessage(i);break;case $e.Ping:break;case $e.Close:break;case $e.Ack:this._isAckMessage(i);break;case $e.Sequence:this._isSequenceMessage(i);break;default:r.log(H.Information,"Unknown message type '"+i.type+"' ignored.");continue}o.push(i)}return o}writeMessage(t){return fr.write(JSON.stringify(t))}_isInvocationMessage(t){this._assertNotEmptyString(t.target,"Invalid payload for Invocation message."),t.invocationId!==void 0&&this._assertNotEmptyString(t.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(t){if(this._assertNotEmptyString(t.invocationId,"Invalid payload for StreamItem message."),t.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(t){if(t.result&&t.error)throw new Error("Invalid payload for Completion message.");!t.result&&t.error&&this._assertNotEmptyString(t.error,"Invalid payload for Completion message."),this._assertNotEmptyString(t.invocationId,"Invalid payload for Completion message.")}_isAckMessage(t){if(typeof t.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(t){if(typeof t.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(t,r){if(typeof t!="string"||t==="")throw new Error(r)}}const v_={trace:H.Trace,debug:H.Debug,info:H.Information,information:H.Information,warn:H.Warning,warning:H.Warning,error:H.Error,critical:H.Critical,none:H.None};function y_(e){const t=v_[e.toLowerCase()];if(typeof t<"u")return t;throw new Error(`Unknown log level: ${e}`)}class b_{configureLogging(t){if(Bt.isRequired(t,"logging"),x_(t))this.logger=t;else if(typeof t=="string"){const r=y_(t);this.logger=new Pi(r)}else this.logger=new Pi(t);return this}withUrl(t,r){return Bt.isRequired(t,"url"),Bt.isNotEmpty(t,"url"),this.url=t,typeof r=="object"?this.httpConnectionOptions={...this.httpConnectionOptions,...r}:this.httpConnectionOptions={...this.httpConnectionOptions,transport:r},this}withHubProtocol(t){return Bt.isRequired(t,"protocol"),this.protocol=t,this}withAutomaticReconnect(t){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return t?Array.isArray(t)?this.reconnectPolicy=new Zf(t):this.reconnectPolicy=t:this.reconnectPolicy=new Zf,this}withServerTimeout(t){return Bt.isRequired(t,"milliseconds"),this._serverTimeoutInMilliseconds=t,this}withKeepAliveInterval(t){return Bt.isRequired(t,"milliseconds"),this._keepAliveIntervalInMilliseconds=t,this}withStatefulReconnect(t){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=t?.bufferSize,this}build(){const t=this.httpConnectionOptions||{};if(t.logger===void 0&&(t.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const r=new p_(this.url,t);return Ec.create(r,this.logger||Ro.instance,this.protocol||new g_,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}}function x_(e){return e.log!==void 0}var $o={},Qf;function __(){if(Qf)return $o;Qf=1;var e=at();Object.defineProperty($o,"__esModule",{value:!0}),$o.default=void 0;var t=e(ht()),r=ut();return $o.default=(0,t.default)((0,r.jsx)("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}),"Check"),$o}var w_=__();const Xf=it(w_);var Lo={},Jf;function S_(){if(Jf)return Lo;Jf=1;var e=at();Object.defineProperty(Lo,"__esModule",{value:!0}),Lo.default=void 0;var t=e(ht()),r=ut();return Lo.default=(0,t.default)((0,r.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"}),"Close"),Lo}var C_=S_();const Ur=it(C_);function kc(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}function zo(e){return(t,r)=>{const n=r?.context?String(r.context):"standalone";let o;if(n==="formatting"&&e.formattingValues){const i=e.defaultFormattingWidth||e.defaultWidth,a=r?.width?String(r.width):i;o=e.formattingValues[a]||e.formattingValues[i]}else{const i=e.defaultWidth,a=r?.width?String(r.width):e.defaultWidth;o=e.values[a]||e.values[i]}const s=e.argumentCallback?e.argumentCallback(t):t;return o[s]}}function Bo(e){return(t,r={})=>{const n=r.width,o=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],s=t.match(o);if(!s)return null;const i=s[0],a=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(a)?D_(a,f=>f.test(i)):E_(a,f=>f.test(i));let l;l=e.valueCallback?e.valueCallback(c):c,l=r.valueCallback?r.valueCallback(l):l;const d=t.slice(i.length);return{value:l,rest:d}}}function E_(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}function D_(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r}function k_(e){return(t,r={})=>{const n=t.match(e.matchPattern);if(!n)return null;const o=n[0],s=t.match(e.parsePattern);if(!s)return null;let i=e.valueCallback?e.valueCallback(s[0]):s[0];i=r.valueCallback?r.valueCallback(i):i;const a=t.slice(o.length);return{value:i,rest:a}}}function A_(e,...t){const r=ic.bind(null,t.find(n=>typeof n=="object"));return t.map(r)}const T_={lessThanXSeconds:{one:"menos de un segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"medio minuto",lessThanXMinutes:{one:"menos de un minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"alrededor de 1 hora",other:"alrededor de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 día",other:"{{count}} días"},aboutXWeeks:{one:"alrededor de 1 semana",other:"alrededor de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"alrededor de 1 mes",other:"alrededor de {{count}} meses"},xMonths:{one:"1 mes",other:"{{count}} meses"},aboutXYears:{one:"alrededor de 1 año",other:"alrededor de {{count}} años"},xYears:{one:"1 año",other:"{{count}} años"},overXYears:{one:"más de 1 año",other:"más de {{count}} años"},almostXYears:{one:"casi 1 año",other:"casi {{count}} años"}},I_=(e,t,r)=>{let n;const o=T_[e];return typeof o=="string"?n=o:t===1?n=o.one:n=o.other.replace("{{count}}",t.toString()),r?.addSuffix?r.comparison&&r.comparison>0?"en "+n:"hace "+n:n},M_={full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/y"},P_={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},O_={full:"{{date}} 'a las' {{time}}",long:"{{date}} 'a las' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},j_={date:kc({formats:M_,defaultWidth:"full"}),time:kc({formats:P_,defaultWidth:"full"}),dateTime:kc({formats:O_,defaultWidth:"full"})},R_={lastWeek:"'el' eeee 'pasado a la' p",yesterday:"'ayer a la' p",today:"'hoy a la' p",tomorrow:"'mañana a la' p",nextWeek:"eeee 'a la' p",other:"P"},N_={lastWeek:"'el' eeee 'pasado a las' p",yesterday:"'ayer a las' p",today:"'hoy a las' p",tomorrow:"'mañana a las' p",nextWeek:"eeee 'a las' p",other:"P"},$_=(e,t,r,n)=>t.getHours()!==1?N_[e]:R_[e],L_={narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","después de cristo"]},z_={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},B_={narrow:["e","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"],wide:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"]},F_={narrow:["d","l","m","m","j","v","s"],short:["do","lu","ma","mi","ju","vi","sá"],abbreviated:["dom","lun","mar","mié","jue","vie","sáb"],wide:["domingo","lunes","martes","miércoles","jueves","viernes","sábado"]},W_={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"}},U_={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"}},H_={ordinalNumber:(e,t)=>Number(e)+"º",era:zo({values:L_,defaultWidth:"wide"}),quarter:zo({values:z_,defaultWidth:"wide",argumentCallback:e=>Number(e)-1}),month:zo({values:B_,defaultWidth:"wide"}),day:zo({values:F_,defaultWidth:"wide"}),dayPeriod:zo({values:W_,defaultWidth:"wide",formattingValues:U_,defaultFormattingWidth:"wide"})},V_=/^(\d+)(º)?/i,Y_=/\d+/i,q_={narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,wide:/^(antes de cristo|antes de la era com[uú]n|despu[eé]s de cristo|era com[uú]n)/i},Z_={any:[/^ac/i,/^dc/i],wide:[/^(antes de cristo|antes de la era com[uú]n)/i,/^(despu[eé]s de cristo|era com[uú]n)/i]},G_={narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},K_={any:[/1/i,/2/i,/3/i,/4/i]},Q_={narrow:/^[efmajsond]/i,abbreviated:/^(ene|feb|mar|abr|may|jun|jul|ago|sep|oct|nov|dic)/i,wide:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i},X_={narrow:[/^e/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^en/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i]},J_={narrow:/^[dlmjvs]/i,short:/^(do|lu|ma|mi|ju|vi|s[áa])/i,abbreviated:/^(dom|lun|mar|mi[ée]|jue|vie|s[áa]b)/i,wide:/^(domingo|lunes|martes|mi[ée]rcoles|jueves|viernes|s[áa]bado)/i},ew={narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^do/i,/^lu/i,/^ma/i,/^mi/i,/^ju/i,/^vi/i,/^sa/i]},tw={narrow:/^(a|p|mn|md|(de la|a las) (mañana|tarde|noche))/i,any:/^([ap]\.?\s?m\.?|medianoche|mediodia|(de la|a las) (mañana|tarde|noche))/i},rw={any:{am:/^a/i,pm:/^p/i,midnight:/^mn/i,noon:/^md/i,morning:/mañana/i,afternoon:/tarde/i,evening:/tarde/i,night:/noche/i}},nw={ordinalNumber:k_({matchPattern:V_,parsePattern:Y_,valueCallback:function(e){return parseInt(e,10)}}),era:Bo({matchPatterns:q_,defaultMatchWidth:"wide",parsePatterns:Z_,defaultParseWidth:"any"}),quarter:Bo({matchPatterns:G_,defaultMatchWidth:"wide",parsePatterns:K_,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Bo({matchPatterns:Q_,defaultMatchWidth:"wide",parsePatterns:X_,defaultParseWidth:"any"}),day:Bo({matchPatterns:J_,defaultMatchWidth:"wide",parsePatterns:ew,defaultParseWidth:"any"}),dayPeriod:Bo({matchPatterns:tw,defaultMatchWidth:"any",parsePatterns:rw,defaultParseWidth:"any"})},ow={code:"es",formatDistance:I_,formatLong:j_,formatRelative:$_,localize:H_,match:nw,options:{weekStartsOn:1,firstWeekContainsDate:1}},ep="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAACpQTFRFR3BMcHCAcHBwaGx4ZWp6aG14aG54Zm14aW15aG55aG15aW55aW56aW5591zvEAAAAA10Uk5TABAQIDBBYHCAnr7g7wYb6DAAAACqSURBVHjahZJLDgMhDEM9UL7Ju/91q8KgQhcdb5D8rFiJ0JNC6Qbeczzt6izV8PWjAbiNB4uH35IkpbaRYGBpT9mcVlemtnCTOiLA8BPk+/VPIkPTR/kGalAkdUgnSNAlOegEckwS2C8wOAEWN2D4BC8HH3Xge/naYJUXaJq6Wo+S2iy7HJKW1sbHSc6B0mU7SeOIf8++CJg5nHOvypLXoF0xdwfrJTx9mzdxpgqGKfcyxQAAAABJRU5ErkJggg==",sw="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC4AAAAwCAMAAABZu7juAAAAPFBMVEUAAABobHhobnhpbnlobnhobXhpbnlpbnpobXhwcHNobHhlanlpbnlobnhobnpobXhmbXlocHhpbHZpbnlt0ET4AAAAE3RSTlMAIGDggL/f76AQQDDPsLCQcEBQZL6CzQAAALVJREFUSMft1MsOgyAQhWEGHQa82/P+71rDojhJ6dCNi9ZvZcivQUjGXWeTQHqFJvS1mgDMemkGQJV8AMB6iQHsb9K0RZ4ACCsCYOLoSccrDPH0AgWYAqm6vY9owuVAmgzq46aY84BGknM0S/nqm9Ef5tIZROXeGfyd3/lP5Kk9T+4gAGYrj68pxjiMn2sqI9iX6V0zhtOO8zO4r1k5B8F9NeBH9dsWr/ZmCLs+10VQ1S0Pd4UnLwhFRUE6UNsAAAAASUVORK5CYII=",iw=({notificacion:e,onAccept:t})=>{const{evento:r,tipo:n,leida:o}=e,s=n==="EventoCreado"||n==="EventoModificado",a={EventoCreado:{frase:"te ha invitado a",colorTitulo:"#3c4043"},EventoModificado:{frase:"ha modificado el evento",colorTitulo:"#3c4043"},EventoCancelado:{frase:"ha cancelado el evento",colorTitulo:"#d32f2f"}}[n]||{frase:"te ha notificado sobre",colorTitulo:"#3c4043"},c=r?.fechaInicio?new Date(r.fechaInicio):new Date,l=r?.fechaFin?new Date(r.fechaFin):null,d=r?.nombreAnfitrion||"Usuario",f=e?.titulo||"Sin título",h=v=>v.split(" ").filter(m=>m).map(m=>m[0]).join("").toUpperCase().substring(0,2);return u.jsxs(g.Box,{sx:{p:2,mb:1,bgcolor:"white",borderRadius:"8px",border:"1px solid #e0e0e0",boxShadow:"0 1px 2px rgba(0,0,0,0.05)",position:"relative",overflow:"hidden"},children:[u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",mb:1},children:[u.jsx(g.Avatar,{sx:{bgcolor:"#F5A623",width:34,height:34,fontSize:"14px",mr:1.5,fontWeight:"bold"},children:h(d)}),u.jsxs(g.Box,{children:[u.jsxs(g.Typography,{sx:{fontSize:"14px",color:"#5f6368",lineHeight:1.2},children:[d," ",a.frase]}),u.jsx(g.Typography,{sx:{fontSize:"15px",fontWeight:700,color:a.colorTitulo},children:f})]})]}),u.jsx(g.Divider,{sx:{mx:-2,my:1.5}}),u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",mb:0},children:[u.jsx("img",{src:sw,width:20,height:20,alt:"cal",style:{marginRight:15}}),u.jsx(g.Typography,{sx:{fontSize:"14px",color:"#3c4043",textTransform:"capitalize"},children:x.format(c,"EEEE, dd 'de' MMMM",{locale:ow})})]}),u.jsx(g.Divider,{sx:{mx:-2,my:1.5}}),u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",mb:s&&!o?2:0},children:[u.jsx("img",{src:ep,width:20,height:20,alt:"watch",style:{marginRight:15}}),u.jsxs(g.Typography,{sx:{fontSize:"14px",color:"#3c4043"},children:[x.format(c,"h:mm a").toLowerCase(),l?` - ${x.format(l,"h:mm a").toLowerCase()}`:""]})]}),s&&!o&&u.jsxs(g.Box,{sx:{display:"flex",gap:1.5,mt:1},children:[u.jsx(g.Button,{variant:"outlined",size:"small",startIcon:u.jsx(Xf,{sx:{fontSize:"16px !important"}}),onClick:()=>t?.(e,"CONFIRMADA"),sx:{flex:1,borderRadius:"8px",textTransform:"none",fontWeight:600,fontSize:"13px",color:"#1976D2",borderColor:"#1976D2",py:.8},children:"Asistiré"}),u.jsx(g.Button,{variant:"outlined",size:"small",startIcon:u.jsx(Ur,{sx:{fontSize:"16px !important"}}),onClick:()=>t?.(e,"RECHAZADA"),sx:{flex:1,borderRadius:"8px",textTransform:"none",fontWeight:600,fontSize:"13px",color:"#D32F2F",borderColor:"#D32F2F",py:.8},children:"Rechazar"})]})]})},aw="https://qa2.crm.netcar.com.mx/hubs/invitaciones",cw=({userId:e,notifications:t,onAceppInvitacion:r})=>{const[n,o]=y.useState(t),[s,i]=y.useState(null);y.useEffect(()=>{o(t)},[t]);const a=y.useCallback(c=>{const l={notificacionID:Math.random(),titulo:"Nueva invitación a evento",mensaje:c.Descripcion,tipo:"EventoCreado",leida:!1,fechaCreacion:new Date().toISOString(),tiempoTranscurrido:"Ahora",url:`/eventos/${c.EventoID}`,iconoColor:"#E1D6FB",evento:{eventoID:c.EventoID,titulo:c.Titulo,fechaInicio:c.FechaInicio,ubicacion:"",nombreAnfitrion:""}};o(d=>[l,...d])},[]);return y.useEffect(()=>{if(!e)return;const c=new b_().withUrl(aw+`?userId=${e}`).withAutomaticReconnect().build();return c.start().then(()=>{c.on("NotificarInvitacionAEvento",a)}).catch(l=>console.error("Error SignalR:",l)),()=>{c.off("NotificarInvitacionAEvento"),c.stop()}},[e,a]),u.jsx(g.Box,{sx:{width:"100%",maxHeight:"600px",overflowY:"auto"},children:u.jsx(g.List,{disablePadding:!0,children:n.length===0?u.jsxs("div",{className:xe.emptyStateContainer,children:[u.jsx("img",{src:Uf,alt:"Todo en orden",className:xe.emptyStateImage}),u.jsx("h4",{className:xe.emptyStateTitle,children:"Todo en orden aquí"}),u.jsx("p",{className:xe.emptyStateText,children:"Por el momento no tienes invitaciones pendientes."})]}):n.map(c=>u.jsx(iw,{notificacion:c,onAccept:r}))})})},lw=({onEventClick:e,upcomingEvents:t,leads30Days:r,leads90Days:n,disID:o,usrID:s,onAddEvent:i,googleCalendars:a,outlookCalendars:c,isLoadingCalendars:l,onToggleGoogle:d,onToggleOutlook:f,notifications:h,unreadCount:v,onAceppInvitacion:m})=>{const{session:p,sessionoutlook:b}=cc(),{enqueueSnackbar:w}=xs.useSnackbar(),C=N=>{const ce=new Date,fe={start:x.startOfDay(ce),end:x.endOfDay(ce)},$={start:N.fechaInicio,end:N.fechaFin};return Ud(fe,$)?"Hoy":x.isTomorrow(N.fechaInicio)?"Mañana":new Intl.DateTimeFormat("es-ES",{day:"numeric",month:"long"}).format(N.fechaInicio)},E={};t.forEach(N=>{const ce=C(N);E[ce]||(E[ce]=[]),E[ce].push(N)});const[S,_]=y.useState(!1),W=()=>{_(!S)},D=Ii(),A=wc(),M=async()=>{if(!p?.userEmail||!o||!s){console.error("Faltan datos (email, disID o usrID) para sincronizar eventos.");return}try{await D.syncGoogleEvents(p?.userEmail,o,s),w("Eventos sincronizados con Google Calendar con éxito.",{variant:"success"})}catch{w("Error al sincronizar eventos con Google Calendar.",{variant:"error"})}finally{}},I=async()=>{if(!b?.userEmail||!o||!s){console.error("Faltan datos (email, disID o usrID) para sincronizar eventos.");return}try{await A.syncOutlookEvents(b?.userEmail,o,s),w("Eventos sincronizados con Outlook Calendar con éxito.",{variant:"success"})}catch{w("Error al sincronizar eventos con Outlook Calendar.",{variant:"error"})}finally{}},[V,G]=y.useState("events"),F=N=>{G(N)},[Y,oe]=y.useState(!0),U=()=>{oe(N=>!N)};return u.jsxs("div",{className:xe.sidebarContainer,children:[u.jsxs("div",{className:xe.leadsSection,children:[u.jsxs("div",{className:xe.leadCard,children:[u.jsx("div",{className:xe.leadIcon,children:u.jsx("img",{src:Xd})}),u.jsxs("div",{className:xe.leadText,children:[u.jsx("div",{className:xe.leadDays,children:"+30 días sin atender"}),u.jsxs("div",{className:xe.leadCount,children:[r," ",u.jsx("span",{style:{fontSize:10,fontWeight:"normal"},children:"leads"})]})]})]}),u.jsxs("div",{className:xe.leadCard,children:[u.jsx("div",{className:xe.leadIcon,children:u.jsx("img",{src:Xd})}),u.jsxs("div",{className:xe.leadText,children:[u.jsx("div",{className:xe.leadDays,children:"+90 días sin atender"}),u.jsxs("div",{className:xe.leadCount,children:[n," ",u.jsx("span",{style:{fontSize:10,fontWeight:"normal"},children:"leads"})]})]})]})]}),u.jsxs("div",{className:xe.eventsSection,children:[u.jsxs("div",{className:xe.tabsContainer,children:[u.jsx("button",{className:`${xe.tabButton} ${V==="events"?xe.activeTab:""}`,onClick:()=>F("events"),children:"Eventos"}),u.jsxs("button",{className:`${xe.tabButton} ${V==="alerts"?xe.activeTab:""}`,onClick:()=>F("alerts"),children:["Alertas",v>0&&u.jsx("span",{className:xe.alertBadge,children:v>99?"99+":v})]})]}),u.jsxs("div",{className:xe.eventsContainer,children:[V==="events"&&u.jsx(u.Fragment,{children:Object.keys(E).length>0?Object.entries(E).map(([N,ce])=>u.jsxs("div",{className:`${xe.eventGroup}`,children:[u.jsxs("div",{className:xe.eventGroupDate,children:[u.jsx("img",{src:l1,width:15})," ",N]}),ce.map(fe=>{const $=De(fe.color||"#ffcc00"),Q=$.toString(),Ce=$.clone().darken(15).toString(),me=new Intl.DateTimeFormat("es-ES",{hour:"numeric",minute:"2-digit",hour12:!0});return u.jsxs("div",{className:xe.eventItem,style:{backgroundColor:Q,borderLeft:`4px solid ${Ce}`,display:"flex",alignItems:"center",padding:"10px",marginBottom:"8px",borderRadius:"4px",cursor:"pointer"},onClick:()=>e(fe),children:[u.jsxs("div",{className:xe.eventDetails,style:{flex:1},children:[u.jsx("div",{className:xe.eventTitle,style:{fontWeight:"500",fontSize:"12px",color:"#333"},children:fe.titulo.length>32?`${fe.titulo.substring(0,32)}...`:fe.titulo}),fe.nombreAnfitrion&&u.jsxs("div",{style:{display:"flex",alignItems:"center",marginTop:"4px",color:"#555"},children:[u.jsx("img",{src:Jd,width:16,style:{marginRight:"6px",opacity:.7}}),u.jsx("span",{style:{fontSize:"13px"},children:fe.nombreAnfitrion})]}),u.jsx("div",{className:xe.eventTime,style:{fontSize:"12px",marginTop:"4px",opacity:.7},children:`${me.format(fe.fechaInicio).toLowerCase()} - ${me.format(fe.fechaFin).toLowerCase()}`})]}),fe.link&&u.jsx("a",{onClick:we=>we.stopPropagation(),href:fe.link,target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",padding:"4px"},children:u.jsx("img",{src:u1,alt:"Video",width:20,style:{opacity:.8}})})]},fe.eventoID)})]},N)):u.jsxs("div",{className:xe.emptyStateContainer,children:[u.jsx("img",{src:Uf,alt:"Todo en orden",className:xe.emptyStateImage}),u.jsx("h4",{className:xe.emptyStateTitle,children:"Tu agenda está despejada"}),u.jsx("p",{className:xe.emptyStateText,children:"Parece que no tienes ningún evento en tu calendario. ¿Te gustaría añadir uno? "}),u.jsxs("button",{className:xe.addEventButton,onClick:i,children:[u.jsx("img",{src:zd}),"Agregar evento"]})]})}),V==="alerts"&&u.jsx(g.Box,{children:u.jsx(cw,{userId:s,notifications:h,onAceppInvitacion:m})})]})]}),u.jsxs("div",{className:xe.calendarsSection,children:[u.jsxs("button",{onClick:W,className:xe.collapsibleHeader,children:[u.jsxs("div",{className:xe.headerTitle,children:[u.jsx("span",{style:{fontSize:"14px"},children:"Calendarios"}),u.jsx("span",{className:xe.calendarCount,children:"1"})]}),u.jsx($2,{className:`${xe.chevronIcon} ${S?xe.collapsed:""}`})]}),u.jsxs("div",{className:`${xe.collapsibleContent} ${S?xe.hidden:""}`,children:[u.jsxs("button",{className:`${xe.calendarSelectButton} ${Y?xe.calendarSelected:""}`,onClick:U,style:{"--calendar-color":"#1976D2"},children:[u.jsx("div",{className:xe.customCheckIcon,children:u.jsx("div",{className:xe.circularCheckbox,children:u.jsx(sc,{size:16,className:xe.checkedIcon})})}),u.jsx(N2,{size:16,className:xe.calendarIcon}),u.jsx("span",{className:xe.calendarItemText,children:"Mi calendario"})]}),b.userEmail?u.jsxs("div",{className:xe.syncButton,onClick:I,children:[u.jsx("div",{className:xe.circularCheckbox,children:u.jsx(sc,{size:16,className:xe.checkedIcon})}),u.jsx("img",{src:Wf,width:20}),u.jsx("span",{style:{fontSize:"14px"},children:"Sincronizar Outlook"})]}):u.jsx(Lx,{disID:o,usrID:s}),p?.userEmail?u.jsxs("div",{className:xe.syncButton,onClick:M,children:[u.jsx("div",{className:xe.circularCheckbox,children:u.jsx(sc,{size:16,className:xe.checkedIcon})}),u.jsx("img",{src:Ff,width:18}),u.jsx("span",{style:{fontSize:"14px"},children:"Sincronizar Google"})]}):u.jsx($x,{disID:o,usrID:s}),b?.userEmail&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:xe.currentUserCalendarTitle,style:{marginTop:"10px"},children:b?.userEmail}),l?u.jsx(g.CircularProgress,{size:24}):c.length>0?u.jsx(g.List,{dense:!0,className:xe.calendarsList,children:c.map(N=>u.jsx(g.ListItem,{secondaryAction:u.jsx(g.Checkbox,{edge:"end",onChange:()=>f(N.id),checked:N.selected||!1,sx:{color:N.backgroundColor,"&.Mui-checked":{color:N.backgroundColor}}}),disablePadding:!0,children:u.jsx(g.ListItemText,{primary:N.summary.length>25?`${N.summary.substring(0,25)}...`:N.summary,className:xe.calendarItemText})},N.id))}):u.jsx("p",{style:{fontSize:"12px"},children:"No se encontraron calendarios."})]}),p?.userEmail&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:xe.currentUserCalendarTitle,style:{marginTop:"10px"},children:p?.userEmail}),l?u.jsx(g.CircularProgress,{size:24}):a.length>0?u.jsx(g.List,{dense:!0,className:xe.calendarsList,children:a.map(N=>u.jsx(g.ListItem,{secondaryAction:u.jsx(g.Checkbox,{edge:"end",onChange:()=>d(N.id),checked:N.selected||!1,sx:{color:N.backgroundColor,"&.Mui-checked":{color:N.backgroundColor}}}),disablePadding:!0,children:u.jsx(g.ListItemText,{primary:N.summary.length>25?`${N.summary.substring(0,25)}...`:N.summary,className:xe.calendarItemText})},N.id))}):u.jsx("p",{style:{fontSize:"12px"},children:"No se encontraron calendarios."})]})]})]})]})},Cn={dayCell:"_dayCell_xweup_1",dayCellContainer:"_dayCellContainer_xweup_23",dayNumber:"_dayNumber_xweup_55",dayNumberToday:"_dayNumberToday_xweup_69",notCurrentMonth:"_notCurrentMonth_xweup_91",CurrentDay:"_CurrentDay_xweup_129",eventsList:"_eventsList_xweup_137"};var Fo={},tp;function uw(){if(tp)return Fo;tp=1;var e=at();Object.defineProperty(Fo,"__esModule",{value:!0}),Fo.default=void 0,o(y);var t=e(ht()),r=ut();function n(s){if(typeof WeakMap!="function")return null;var i=new WeakMap,a=new WeakMap;return(n=function(c){return c?a:i})(s)}function o(s,i){if(s&&s.__esModule)return s;if(s===null||typeof s!="object"&&typeof s!="function")return{default:s};var a=n(i);if(a&&a.has(s))return a.get(s);var c={__proto__:null},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var d in s)if(d!=="default"&&Object.prototype.hasOwnProperty.call(s,d)){var f=l?Object.getOwnPropertyDescriptor(s,d):null;f&&(f.get||f.set)?Object.defineProperty(c,d,f):c[d]=s[d]}return c.default=s,a&&a.set(s,c),c}return Fo.default=(0,t.default)((0,r.jsx)("path",{d:"M12.545,10.239v3.821h5.445c-0.712,2.315-2.647,3.972-5.445,3.972c-3.332,0-6.033-2.701-6.033-6.032s2.701-6.032,6.033-6.032c1.498,0,2.866,0.549,3.921,1.453l2.814-2.814C17.503,2.988,15.139,2,12.545,2C7.021,2,2.543,6.477,2.543,12s4.478,10,10.002,10c8.396,0,10.249-7.85,9.426-11.748L12.545,10.239z"}),"Google"),Fo}var dw=uw();const fw=it(dw);var Wo={},rp;function pw(){if(rp)return Wo;rp=1;var e=at();Object.defineProperty(Wo,"__esModule",{value:!0}),Wo.default=void 0;var t=e(ht()),r=ut();return Wo.default=(0,t.default)((0,r.jsx)("path",{d:"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m0 14H4V8l8 5 8-5zm-8-7L4 6h16z"}),"MailOutline"),Wo}var hw=pw();const mw=it(hw),np=46,gw=22,vw=({dayNumber:e,date:t,events:r,isToday:n,isCurrentMonth:o,onDayClick:s,onEventClick:i,onSeeMoreClick:a})=>{const c=[Cn.dayCell,o?"":Cn.notCurrentMonth,Cn.CurrentDay].join(" ").trim(),l=y.useRef(null),[d,f]=y.useState(r.length),h=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});y.useLayoutEffect(()=>{const p=()=>{if(l.current){const b=l.current.clientHeight;let w=Math.floor(b/(np+4));if(w<r.length){const C=Math.floor((b-gw)/(np+4));w=Math.max(0,C)}f(w)}};return p(),window.addEventListener("resize",p),()=>window.removeEventListener("resize",p)},[r.length]);const v=r.slice(0,d===0?1:d),m=r.length-(d===0?1:d);return u.jsxs("div",{className:`${c} ${Cn.dayCellContainer}`,onClick:()=>s?.(t),style:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"},children:[u.jsx("div",{className:n?Cn.dayNumber:Cn.dayNumberToday,children:e}),u.jsxs("div",{className:Cn.eventsList,ref:l,style:{flex:1,display:"flex",flexDirection:"column",gap:"4px",padding:"0 4px 4px 4px",marginTop:"4px",overflow:"hidden"},children:[v.map(p=>{const b=p.color||"#D7EBFB",w=p.isGoogleEvent||p.isOutlookEvent;return u.jsxs(g.Box,{onClick:C=>{C.stopPropagation(),i?.(p)},sx:{backgroundColor:w?"#ffffff":p?.color,padding:"4px 8px",borderRadius:"6px",cursor:"pointer",display:"flex",flexDirection:"column",minHeight:"40px",maxHeight:"48px",position:"relative",overflow:"hidden",border:w?`1px solid ${De(b).setAlpha(.4).toRgbString()}`:"none","&:hover":{filter:"brightness(0.95)",boxShadow:"0px 2px 4px rgba(0,0,0,0.08)"}},children:[p.isGoogleEvent&&u.jsx(fw,{sx:{position:"absolute",top:4,right:4,fontSize:12,color:"#4285F4"}}),p.isOutlookEvent&&u.jsx(mw,{sx:{position:"absolute",top:4,right:4,fontSize:12,color:"#0078D4"}}),u.jsx(g.Typography,{sx:{fontSize:"10px",lineHeight:"1",color:"#3C4043",pr:w?2:0,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",wordBreak:"break-word"},children:p.titulo}),u.jsx(g.Typography,{sx:{fontSize:"9px",color:"#70757a",mt:"auto",fontWeight:400},children:`${h.format(p.fechaInicio).toLowerCase()} - ${h.format(p.fechaFin).toLowerCase()}`})]},p.eventoID)}),m>0&&u.jsxs(g.Typography,{sx:{fontSize:"10px",fontWeight:"bold",color:"#1976D2",textAlign:"left",ml:1,mt:.5,cursor:"pointer","&:hover":{textDecoration:"underline"}},onClick:p=>{p.stopPropagation(),a(r,t)},children:["+",m," más"]})]})]})},op={weekDaysContainer:"_weekDaysContainer_5h5ol_1",weekDay:"_weekDay_5h5ol_1"},yw=()=>{const e=["Lunes","Martes","Miércoles","Jueves","Viernes","Sábado","Domingo"];return u.jsx("div",{className:op.weekDaysContainer,children:e.map(t=>u.jsx("div",{className:op.weekDay,children:t},t))})},ji={calendarGridContainer:"_calendarGridContainer_1expw_1",daysContainer:"_daysContainer_1expw_23",rows5:"_rows5_1expw_37",rows6:"_rows6_1expw_45"};function bw(e,t){const[r,n]=A_(e,t.start,t.end);return{start:r,end:n}}function xw(e,t){const{start:r,end:n}=bw(t?.in,e);let o=+r>+n;const s=o?+r:+n,i=o?n:r;i.setHours(0,0,0,0);let a=1;const c=[];for(;+i<=s;)c.push(ic(r,i)),i.setDate(i.getDate()+a),i.setHours(0,0,0,0);return o?c.reverse():c}function _w(e,t){const r=t?.weekStartsOn,n=sn(e,t?.in),o=n.getDay(),s=(o<r?-7:0)+6-(o-r);return n.setDate(n.getDate()+s),n.setHours(23,59,59,999),n}function ww(e,t,r){const n=+sn(e,r?.in),[o,s]=[+sn(t.start,r?.in),+sn(t.end,r?.in)].sort((i,a)=>i-a);return n>=o&&n<=s}const Sw=({currentDate:e,events:t,onDayClick:r,onEventClick:n,onSeeMoreClick:o})=>{const s=x.startOfMonth(e),i=x.endOfMonth(e),a=x.startOfWeek(s,{weekStartsOn:1}),c=_w(i,{weekStartsOn:1}),l=xw({start:a,end:c}),d={},f=l.length/7,h=`${ji.daysContainer} ${f===5?ji.rows5:ji.rows6}`;return t.forEach(v=>{const m=x.format(v.fechaInicio,"yyyy-MM-dd");d[m]||(d[m]=[]),d[m].push(v)}),u.jsxs("div",{className:ji.calendarGridContainer,children:[u.jsx(yw,{}),u.jsx("div",{className:h,children:l.map(v=>{const m=t.filter(p=>ww(v,{start:x.startOfDay(p.fechaInicio),end:x.endOfDay(p.fechaFin)}));return u.jsx(vw,{dayNumber:v.getDate(),date:v,events:m,isToday:x.isToday(v),isCurrentMonth:x.isSameMonth(v,e),onDayClick:r,onEventClick:n,onSeeMoreClick:o},v.toISOString())})})]})},Ac=()=>{const{calendarApiUrl:e}=_c(),t=async v=>{try{return(await Et.get(`${e}/api/Calendario/v1/local/ListarEventosXUsuario/${v}`)).data.map(p=>{const b=new Date(p.fechaInicio),w=new Date(p.fechaFin),C=p.solicitudRelacionada?.[0]?.nombreCliente??null;return{...p,fechaInicio:b,fechaFin:w,client:C}})}catch(m){return console.error("Error events:",m),[]}},r=async(v,m)=>{try{const p=await Et.post(`${e}/api/Calendario/v1/local/InsertarEvento/${m}`,v);return{...p.data,fechaInicio:new Date(p.data.fechaInicio),fechaFin:new Date(p.data.fechaFin)}}catch(p){throw console.log("Error creating event:",p),p}},n=async v=>{try{const m=await Et.post(`${e}/api/Calendario/v1/local/ActualizarEvento/${v.eventoID}`,v);return{eventoID:m.data.eventoID,titulo:m.data.titulo,descripcion:m.data.descripcion,fechaInicio:new Date(m.data.fechaInicio),fechaFin:new Date(m.data.fechaFin),todoElDia:m.data.todoElDia,color:m.data.color,repetir:m.data.repetir,link:m.data.link,solID:m.data.solID,disID:m.data.disID,client:m.data.client}}catch(m){throw console.log("Error updating event:",m),m}},o=async v=>{try{const m=await Et.get(`${e}/api/Calendario/v1/local/ObtenerEvento/${v}`),p=m.data[0].solicitudRelacionada?.[0]?.nombreCliente||null;return{...m.data[0],fechaInicio:m.data[0].fechaInicio,fechaFin:m.data[0].fechaFin,client:p}}catch(m){throw console.error(`Error fetching event with ID ${v}:`,m),m}},s=async v=>{try{await Et.post(`${e}/api/Calendario/v1/local/EliminarEvento/${v}`)}catch(m){throw console.log(`Error ID ${v}:`,m),m}},i=y.useCallback(async(v,m,p,b)=>{try{const w={masNombreBD:p,usrID:b,disID:m,nombreCliente:v},E=(await Et.post(`${e}/api/Calendario/v1/local/ConsultaClientesXUsuariologgeado/`,w)).data?.data;return Array.isArray(E)?E.map(S=>({clienteID:S.clienteID,solID:S.solID,marca:S?.marca,modelo:S?.modelo,nombreCliente:S?.nombreCliente})):[]}catch(w){return console.error("Error clientes:",w),[]}},[e]),a=y.useCallback(async(v,m)=>{try{const p={disID:v,usrMail:m},w=(await Et.post(`${e}/api/Calendario/v1/Consulta_UsuariosInvitados/`,p)).data?.data;return Array.isArray(w)?w.map(C=>({usrID:C.usrID,usrNombre:C.usrNombre,usrMail:C?.usrMail,disID:C?.disID})):[]}catch(p){return console.error("Error usuarios:",p),[]}},[e]),c=async(v,m,p,b,w)=>{const C={tieneConflicto:!1,usrMail:""};try{const E={disID:v,usrMail:m,startDate:p,horaInicio:b,horaFin:w};return(await Et.post(`${e}/api/Calendario/v1/local/ConsultaConflictoInvitados`,E)).data?.data}catch(E){return console.error("Error al verificar conflicto:",E),C}},l=y.useCallback(async(v,m,p,b)=>{try{const w={disID:v,usrMail:m,startDate:p,DuracionEvento:b},E=(await Et.post(`${e}/api/Calendario/v1/local/ConsultaDisponibilidadUsuario`,w)).data?.data;return Array.isArray(E)?E.map(S=>({Fecha:S.fecha,HoraInicio:S.horaInicio,HoraFin:S.horaFin})):[]}catch(w){return console.error("Error usuarios:",w),[]}},[e]),d=y.useCallback(async(v,m=!1)=>{try{const p=await Et.post(`${e}/api/Notificaciones/v1/local/ObtenerNotificacionesPorUsuarioAsync/${v}?soloNoLeidas=${m}`);return console.log("response.data",p.data),p.data}catch(p){return console.error("Error usuarios:",p),[]}},[e]);return{getEventsByUser:t,createEvent:r,updateEvent:n,getEventById:o,deleteEvent:s,getClients:i,getUsuariosInvitados:a,VerificarConflicto:c,getDisponibilidadUsuario:l,getNotificacionesXUsuario:d,UpdateStatusEvento:async(v,m,p)=>{try{const b={EventoID:v,UsuarioID:m,status:p};return(await Et.post(`${e}/api/Calendario/v1/local/ActualizarEstadoInvitacionAsync/`,b)).data}catch(b){return console.error("Error Actualizar estatus:",b),{}}},MarcarLeido:async(v,m)=>{try{return(await Et.post(`${e}/api/Notificaciones/v1/local/MarcarComoLeidaAsync/${v}?usuarioId=${m}&marcarComoLeida=true`)).data?.data}catch(p){return console.error("Error Actualizar estatus:",p),{}}}}};var Uo={},sp;function Cw(){if(sp)return Uo;sp=1;var e=at();Object.defineProperty(Uo,"__esModule",{value:!0}),Uo.default=void 0;var t=e(ht()),r=ut();return Uo.default=(0,t.default)([(0,r.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"},"0"),(0,r.jsx)("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"},"1")],"AccessTime"),Uo}var Ew=Cw();const Tc=it(Ew);var Ho=e=>e.type==="checkbox",En=e=>e instanceof Date,rr=e=>e==null;const ip=e=>typeof e=="object";var Nt=e=>!rr(e)&&!Array.isArray(e)&&ip(e)&&!En(e),ap=e=>Nt(e)&&e.target?Ho(e.target)?e.target.checked:e.target.value:e,Dw=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,cp=(e,t)=>e.has(Dw(t)),kw=e=>{const t=e.constructor&&e.constructor.prototype;return Nt(t)&&t.hasOwnProperty("isPrototypeOf")},Ic=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ut(e){let t;const r=Array.isArray(e),n=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(!(Ic&&(e instanceof Blob||n))&&(r||Nt(e)))if(t=r?[]:Object.create(Object.getPrototypeOf(e)),!r&&!kw(e))t=e;else for(const o in e)e.hasOwnProperty(o)&&(t[o]=Ut(e[o]));else return e;return t}var Ri=e=>/^\w*$/.test(e),$t=e=>e===void 0,Mc=e=>Array.isArray(e)?e.filter(Boolean):[],Pc=e=>Mc(e.replace(/["|']|\]/g,"").split(/\.|\[/)),he=(e,t,r)=>{if(!t||!Nt(e))return r;const n=(Ri(t)?[t]:Pc(t)).reduce((o,s)=>rr(o)?o:o[s],e);return $t(n)||n===e?$t(e[t])?r:e[t]:n},pr=e=>typeof e=="boolean",ct=(e,t,r)=>{let n=-1;const o=Ri(t)?[t]:Pc(t),s=o.length,i=s-1;for(;++n<s;){const a=o[n];let c=r;if(n!==i){const l=e[a];c=Nt(l)||Array.isArray(l)?l:isNaN(+o[n+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;e[a]=c,e=e[a]}};const Ni={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Tr={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Qr={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Oc=y.createContext(null);Oc.displayName="HookFormContext";const jc=()=>y.useContext(Oc),Aw=e=>{const{children:t,...r}=e;return y.createElement(Oc.Provider,{value:r},t)};var lp=(e,t,r,n=!0)=>{const o={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(o,s,{get:()=>{const i=s;return t._proxyFormState[i]!==Tr.all&&(t._proxyFormState[i]=!n||Tr.all),r&&(r[i]=!0),e[i]}});return o};const Rc=typeof window<"u"?y.useLayoutEffect:y.useEffect;function Tw(e){const t=jc(),{control:r=t.control,disabled:n,name:o,exact:s}=e||{},[i,a]=y.useState(r._formState),c=y.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Rc(()=>r._subscribe({name:o,formState:c.current,exact:s,callback:l=>{!n&&a({...r._formState,...l})}}),[o,n,s]),y.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),y.useMemo(()=>lp(i,r,c.current,!1),[i,r])}var Hr=e=>typeof e=="string",up=(e,t,r,n,o)=>Hr(e)?(n&&t.watch.add(e),he(r,e,o)):Array.isArray(e)?e.map(s=>(n&&t.watch.add(s),he(r,s))):(n&&(t.watchAll=!0),r),Nc=e=>rr(e)||!ip(e);function Xr(e,t,r=new WeakSet){if(Nc(e)||Nc(t))return e===t;if(En(e)&&En(t))return e.getTime()===t.getTime();const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const s of n){const i=e[s];if(!o.includes(s))return!1;if(s!=="ref"){const a=t[s];if(En(i)&&En(a)||Nt(i)&&Nt(a)||Array.isArray(i)&&Array.isArray(a)?!Xr(i,a,r):i!==a)return!1}}return!0}function dp(e){const t=jc(),{control:r=t.control,name:n,defaultValue:o,disabled:s,exact:i,compute:a}=e||{},c=y.useRef(o),l=y.useRef(a),d=y.useRef(void 0);l.current=a;const f=y.useMemo(()=>r._getWatch(n,c.current),[r,n]),[h,v]=y.useState(l.current?l.current(f):f);return Rc(()=>r._subscribe({name:n,formState:{values:!0},exact:i,callback:m=>{if(!s){const p=up(n,r._names,m.values||r._formValues,!1,c.current);if(l.current){const b=l.current(p);Xr(b,d.current)||(v(b),d.current=b)}else v(p)}}}),[r,s,n,i]),y.useEffect(()=>r._removeUnmounted()),h}function Iw(e){const t=jc(),{name:r,disabled:n,control:o=t.control,shouldUnregister:s,defaultValue:i}=e,a=cp(o._names.array,r),c=y.useMemo(()=>he(o._formValues,r,he(o._defaultValues,r,i)),[o,r,i]),l=dp({control:o,name:r,defaultValue:c,exact:!0}),d=Tw({control:o,name:r,exact:!0}),f=y.useRef(e),h=y.useRef(o.register(r,{...e.rules,value:l,...pr(e.disabled)?{disabled:e.disabled}:{}}));f.current=e;const v=y.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!he(d.errors,r)},isDirty:{enumerable:!0,get:()=>!!he(d.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!he(d.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!he(d.validatingFields,r)},error:{enumerable:!0,get:()=>he(d.errors,r)}}),[d,r]),m=y.useCallback(C=>h.current.onChange({target:{value:ap(C),name:r},type:Ni.CHANGE}),[r]),p=y.useCallback(()=>h.current.onBlur({target:{value:he(o._formValues,r),name:r},type:Ni.BLUR}),[r,o._formValues]),b=y.useCallback(C=>{const E=he(o._fields,r);E&&C&&(E._f.ref={focus:()=>C.focus&&C.focus(),select:()=>C.select&&C.select(),setCustomValidity:S=>C.setCustomValidity(S),reportValidity:()=>C.reportValidity()})},[o._fields,r]),w=y.useMemo(()=>({name:r,value:l,...pr(n)||d.disabled?{disabled:d.disabled||n}:{},onChange:m,onBlur:p,ref:b}),[r,n,d.disabled,m,p,b,l]);return y.useEffect(()=>{const C=o._options.shouldUnregister||s;o.register(r,{...f.current.rules,...pr(f.current.disabled)?{disabled:f.current.disabled}:{}});const E=(S,_)=>{const W=he(o._fields,S);W&&W._f&&(W._f.mount=_)};if(E(r,!0),C){const S=Ut(he(o._options.defaultValues,r));ct(o._defaultValues,r,S),$t(he(o._formValues,r))&&ct(o._formValues,r,S)}return!a&&o.register(r),()=>{(a?C&&!o._state.action:C)?o.unregister(r):E(r,!1)}},[r,o,a,s]),y.useEffect(()=>{o._setDisabledField({disabled:n,name:r})},[n,r,o]),y.useMemo(()=>({field:w,formState:d,fieldState:v}),[w,d,v])}const hr=e=>e.render(Iw(e));var $c=(e,t,r,n,o)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:o||!0}}:{},Vo=e=>Array.isArray(e)?e:[e],fp=()=>{let e=[];return{get observers(){return e},next:o=>{for(const s of e)s.next&&s.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(s=>s!==o)}}),unsubscribe:()=>{e=[]}}},ir=e=>Nt(e)&&!Object.keys(e).length,Lc=e=>e.type==="file",Ir=e=>typeof e=="function",$i=e=>{if(!Ic)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},pp=e=>e.type==="select-multiple",zc=e=>e.type==="radio",Mw=e=>zc(e)||Ho(e),Bc=e=>$i(e)&&e.isConnected;function Pw(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=$t(e)?n++:e[t[n++]];return e}function Ow(e){for(const t in e)if(e.hasOwnProperty(t)&&!$t(e[t]))return!1;return!0}function Ft(e,t){const r=Array.isArray(t)?t:Ri(t)?[t]:Pc(t),n=r.length===1?e:Pw(e,r),o=r.length-1,s=r[o];return n&&delete n[s],o!==0&&(Nt(n)&&ir(n)||Array.isArray(n)&&Ow(n))&&Ft(e,r.slice(0,-1)),e}var hp=e=>{for(const t in e)if(Ir(e[t]))return!0;return!1};function Li(e,t={}){const r=Array.isArray(e);if(Nt(e)||r)for(const n in e)Array.isArray(e[n])||Nt(e[n])&&!hp(e[n])?(t[n]=Array.isArray(e[n])?[]:{},Li(e[n],t[n])):rr(e[n])||(t[n]=!0);return t}function mp(e,t,r){const n=Array.isArray(e);if(Nt(e)||n)for(const o in e)Array.isArray(e[o])||Nt(e[o])&&!hp(e[o])?$t(t)||Nc(r[o])?r[o]=Array.isArray(e[o])?Li(e[o],[]):{...Li(e[o])}:mp(e[o],rr(t)?{}:t[o],r[o]):r[o]=!Xr(e[o],t[o]);return r}var Yo=(e,t)=>mp(e,t,Li(t));const gp={value:!1,isValid:!1},vp={value:!0,isValid:!0};var yp=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!$t(e[0].attributes.value)?$t(e[0].value)||e[0].value===""?vp:{value:e[0].value,isValid:!0}:vp:gp}return gp},bp=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>$t(e)?e:t?e===""?NaN:e&&+e:r&&Hr(e)?new Date(e):n?n(e):e;const xp={isValid:!1,value:null};var _p=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,xp):xp;function wp(e){const t=e.ref;return Lc(t)?t.files:zc(t)?_p(e.refs).value:pp(t)?[...t.selectedOptions].map(({value:r})=>r):Ho(t)?yp(e.refs).value:bp($t(t.value)?e.ref.value:t.value,e)}var jw=(e,t,r,n)=>{const o={};for(const s of e){const i=he(t,s);i&&ct(o,s,i._f)}return{criteriaMode:r,names:[...e],fields:o,shouldUseNativeValidation:n}},zi=e=>e instanceof RegExp,qo=e=>$t(e)?e:zi(e)?e.source:Nt(e)?zi(e.value)?e.value.source:e.value:e,Sp=e=>({isOnSubmit:!e||e===Tr.onSubmit,isOnBlur:e===Tr.onBlur,isOnChange:e===Tr.onChange,isOnAll:e===Tr.all,isOnTouch:e===Tr.onTouched});const Cp="AsyncFunction";var Rw=e=>!!e&&!!e.validate&&!!(Ir(e.validate)&&e.validate.constructor.name===Cp||Nt(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Cp)),Nw=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Ep=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Zo=(e,t,r,n)=>{for(const o of r||Object.keys(e)){const s=he(e,o);if(s){const{_f:i,...a}=s;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],o)&&!n)return!0;if(i.ref&&t(i.ref,i.name)&&!n)return!0;if(Zo(a,t))break}else if(Nt(a)&&Zo(a,t))break}}};function Dp(e,t,r){const n=he(e,r);if(n||Ri(r))return{error:n,name:r};const o=r.split(".");for(;o.length;){const s=o.join("."),i=he(t,s),a=he(e,s);if(i&&!Array.isArray(i)&&r!==s)return{name:r};if(a&&a.type)return{name:s,error:a};if(a&&a.root&&a.root.type)return{name:`${s}.root`,error:a.root};o.pop()}return{name:r}}var $w=(e,t,r,n)=>{r(e);const{name:o,...s}=e;return ir(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(i=>t[i]===(!n||Tr.all))},Lw=(e,t,r)=>!e||!t||e===t||Vo(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),zw=(e,t,r,n,o)=>o.isOnAll?!1:!r&&o.isOnTouch?!(t||e):(r?n.isOnBlur:o.isOnBlur)?!e:(r?n.isOnChange:o.isOnChange)?e:!0,Bw=(e,t)=>!Mc(he(e,t)).length&&Ft(e,t),Fw=(e,t,r)=>{const n=Vo(he(e,r));return ct(n,"root",t[r]),ct(e,r,n),e},Bi=e=>Hr(e);function kp(e,t,r="validate"){if(Bi(e)||Array.isArray(e)&&e.every(Bi)||pr(e)&&!e)return{type:r,message:Bi(e)?e:"",ref:t}}var Gn=e=>Nt(e)&&!zi(e)?e:{value:e,message:""},Ap=async(e,t,r,n,o,s)=>{const{ref:i,refs:a,required:c,maxLength:l,minLength:d,min:f,max:h,pattern:v,validate:m,name:p,valueAsNumber:b,mount:w}=e._f,C=he(r,p);if(!w||t.has(p))return{};const E=a?a[0]:i,S=G=>{o&&E.reportValidity&&(E.setCustomValidity(pr(G)?"":G||""),E.reportValidity())},_={},W=zc(i),D=Ho(i),A=W||D,M=(b||Lc(i))&&$t(i.value)&&$t(C)||$i(i)&&i.value===""||C===""||Array.isArray(C)&&!C.length,I=$c.bind(null,p,n,_),V=(G,F,Y,oe=Qr.maxLength,U=Qr.minLength)=>{const N=G?F:Y;_[p]={type:G?oe:U,message:N,ref:i,...I(G?oe:U,N)}};if(s?!Array.isArray(C)||!C.length:c&&(!A&&(M||rr(C))||pr(C)&&!C||D&&!yp(a).isValid||W&&!_p(a).isValid)){const{value:G,message:F}=Bi(c)?{value:!!c,message:c}:Gn(c);if(G&&(_[p]={type:Qr.required,message:F,ref:E,...I(Qr.required,F)},!n))return S(F),_}if(!M&&(!rr(f)||!rr(h))){let G,F;const Y=Gn(h),oe=Gn(f);if(!rr(C)&&!isNaN(C)){const U=i.valueAsNumber||C&&+C;rr(Y.value)||(G=U>Y.value),rr(oe.value)||(F=U<oe.value)}else{const U=i.valueAsDate||new Date(C),N=$=>new Date(new Date().toDateString()+" "+$),ce=i.type=="time",fe=i.type=="week";Hr(Y.value)&&C&&(G=ce?N(C)>N(Y.value):fe?C>Y.value:U>new Date(Y.value)),Hr(oe.value)&&C&&(F=ce?N(C)<N(oe.value):fe?C<oe.value:U<new Date(oe.value))}if((G||F)&&(V(!!G,Y.message,oe.message,Qr.max,Qr.min),!n))return S(_[p].message),_}if((l||d)&&!M&&(Hr(C)||s&&Array.isArray(C))){const G=Gn(l),F=Gn(d),Y=!rr(G.value)&&C.length>+G.value,oe=!rr(F.value)&&C.length<+F.value;if((Y||oe)&&(V(Y,G.message,F.message),!n))return S(_[p].message),_}if(v&&!M&&Hr(C)){const{value:G,message:F}=Gn(v);if(zi(G)&&!C.match(G)&&(_[p]={type:Qr.pattern,message:F,ref:i,...I(Qr.pattern,F)},!n))return S(F),_}if(m){if(Ir(m)){const G=await m(C,r),F=kp(G,E);if(F&&(_[p]={...F,...I(Qr.validate,F.message)},!n))return S(F.message),_}else if(Nt(m)){let G={};for(const F in m){if(!ir(G)&&!n)break;const Y=kp(await m[F](C,r),E,F);Y&&(G={...Y,...I(F,Y.message)},S(Y.message),n&&(_[p]=G))}if(!ir(G)&&(_[p]={ref:E,...G},!n))return _}}return S(!0),_};const Ww={mode:Tr.onSubmit,reValidateMode:Tr.onChange,shouldFocusError:!0};function Uw(e={}){let t={...Ww,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:Ir(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},o=Nt(t.defaultValues)||Nt(t.values)?Ut(t.defaultValues||t.values)||{}:{},s=t.shouldUnregister?{}:Ut(o),i={action:!1,mount:!1,watch:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,l=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let f={...d};const h={array:fp(),state:fp()},v=t.criteriaMode===Tr.all,m=k=>P=>{clearTimeout(l),l=setTimeout(k,P)},p=async k=>{if(!t.disabled&&(d.isValid||f.isValid||k)){const P=t.resolver?ir((await D()).errors):await M(n,!0);P!==r.isValid&&h.state.next({isValid:P})}},b=(k,P)=>{!t.disabled&&(d.isValidating||d.validatingFields||f.isValidating||f.validatingFields)&&((k||Array.from(a.mount)).forEach(B=>{B&&(P?ct(r.validatingFields,B,P):Ft(r.validatingFields,B))}),h.state.next({validatingFields:r.validatingFields,isValidating:!ir(r.validatingFields)}))},w=(k,P=[],B,ue,se=!0,O=!0)=>{if(ue&&B&&!t.disabled){if(i.action=!0,O&&Array.isArray(he(n,k))){const ne=B(he(n,k),ue.argA,ue.argB);se&&ct(n,k,ne)}if(O&&Array.isArray(he(r.errors,k))){const ne=B(he(r.errors,k),ue.argA,ue.argB);se&&ct(r.errors,k,ne),Bw(r.errors,k)}if((d.touchedFields||f.touchedFields)&&O&&Array.isArray(he(r.touchedFields,k))){const ne=B(he(r.touchedFields,k),ue.argA,ue.argB);se&&ct(r.touchedFields,k,ne)}(d.dirtyFields||f.dirtyFields)&&(r.dirtyFields=Yo(o,s)),h.state.next({name:k,isDirty:V(k,P),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else ct(s,k,P)},C=(k,P)=>{ct(r.errors,k,P),h.state.next({errors:r.errors})},E=k=>{r.errors=k,h.state.next({errors:r.errors,isValid:!1})},S=(k,P,B,ue)=>{const se=he(n,k);if(se){const O=he(s,k,$t(B)?he(o,k):B);$t(O)||ue&&ue.defaultChecked||P?ct(s,k,P?O:wp(se._f)):Y(k,O),i.mount&&p()}},_=(k,P,B,ue,se)=>{let O=!1,ne=!1;const Se={name:k};if(!t.disabled){if(!B||ue){(d.isDirty||f.isDirty)&&(ne=r.isDirty,r.isDirty=Se.isDirty=V(),O=ne!==Se.isDirty);const Oe=Xr(he(o,k),P);ne=!!he(r.dirtyFields,k),Oe?Ft(r.dirtyFields,k):ct(r.dirtyFields,k,!0),Se.dirtyFields=r.dirtyFields,O=O||(d.dirtyFields||f.dirtyFields)&&ne!==!Oe}if(B){const Oe=he(r.touchedFields,k);Oe||(ct(r.touchedFields,k,B),Se.touchedFields=r.touchedFields,O=O||(d.touchedFields||f.touchedFields)&&Oe!==B)}O&&se&&h.state.next(Se)}return O?Se:{}},W=(k,P,B,ue)=>{const se=he(r.errors,k),O=(d.isValid||f.isValid)&&pr(P)&&r.isValid!==P;if(t.delayError&&B?(c=m(()=>C(k,B)),c(t.delayError)):(clearTimeout(l),c=null,B?ct(r.errors,k,B):Ft(r.errors,k)),(B?!Xr(se,B):se)||!ir(ue)||O){const ne={...ue,...O&&pr(P)?{isValid:P}:{},errors:r.errors,name:k};r={...r,...ne},h.state.next(ne)}},D=async k=>{b(k,!0);const P=await t.resolver(s,t.context,jw(k||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation));return b(k),P},A=async k=>{const{errors:P}=await D(k);if(k)for(const B of k){const ue=he(P,B);ue?ct(r.errors,B,ue):Ft(r.errors,B)}else r.errors=P;return P},M=async(k,P,B={valid:!0})=>{for(const ue in k){const se=k[ue];if(se){const{_f:O,...ne}=se;if(O){const Se=a.array.has(O.name),Oe=se._f&&Rw(se._f);Oe&&d.validatingFields&&b([ue],!0);const R=await Ap(se,a.disabled,s,v,t.shouldUseNativeValidation&&!P,Se);if(Oe&&d.validatingFields&&b([ue]),R[O.name]&&(B.valid=!1,P))break;!P&&(he(R,O.name)?Se?Fw(r.errors,R,O.name):ct(r.errors,O.name,R[O.name]):Ft(r.errors,O.name))}!ir(ne)&&await M(ne,P,B)}}return B.valid},I=()=>{for(const k of a.unMount){const P=he(n,k);P&&(P._f.refs?P._f.refs.every(B=>!Bc(B)):!Bc(P._f.ref))&&le(k)}a.unMount=new Set},V=(k,P)=>!t.disabled&&(k&&P&&ct(s,k,P),!Xr($(),o)),G=(k,P,B)=>up(k,a,{...i.mount?s:$t(P)?o:Hr(k)?{[k]:P}:P},B,P),F=k=>Mc(he(i.mount?s:o,k,t.shouldUnregister?he(o,k,[]):[])),Y=(k,P,B={})=>{const ue=he(n,k);let se=P;if(ue){const O=ue._f;O&&(!O.disabled&&ct(s,k,bp(P,O)),se=$i(O.ref)&&rr(P)?"":P,pp(O.ref)?[...O.ref.options].forEach(ne=>ne.selected=se.includes(ne.value)):O.refs?Ho(O.ref)?O.refs.forEach(ne=>{(!ne.defaultChecked||!ne.disabled)&&(Array.isArray(se)?ne.checked=!!se.find(Se=>Se===ne.value):ne.checked=se===ne.value||!!se)}):O.refs.forEach(ne=>ne.checked=ne.value===se):Lc(O.ref)?O.ref.value="":(O.ref.value=se,O.ref.type||h.state.next({name:k,values:Ut(s)})))}(B.shouldDirty||B.shouldTouch)&&_(k,se,B.shouldTouch,B.shouldDirty,!0),B.shouldValidate&&fe(k)},oe=(k,P,B)=>{for(const ue in P){if(!P.hasOwnProperty(ue))return;const se=P[ue],O=k+"."+ue,ne=he(n,O);(a.array.has(k)||Nt(se)||ne&&!ne._f)&&!En(se)?oe(O,se,B):Y(O,se,B)}},U=(k,P,B={})=>{const ue=he(n,k),se=a.array.has(k),O=Ut(P);ct(s,k,O),se?(h.array.next({name:k,values:Ut(s)}),(d.isDirty||d.dirtyFields||f.isDirty||f.dirtyFields)&&B.shouldDirty&&h.state.next({name:k,dirtyFields:Yo(o,s),isDirty:V(k,O)})):ue&&!ue._f&&!rr(O)?oe(k,O,B):Y(k,O,B),Ep(k,a)&&h.state.next({...r,name:k}),h.state.next({name:i.mount?k:void 0,values:Ut(s)})},N=async k=>{i.mount=!0;const P=k.target;let B=P.name,ue=!0;const se=he(n,B),O=Oe=>{ue=Number.isNaN(Oe)||En(Oe)&&isNaN(Oe.getTime())||Xr(Oe,he(s,B,Oe))},ne=Sp(t.mode),Se=Sp(t.reValidateMode);if(se){let Oe,R;const te=P.type?wp(se._f):ap(k),_e=k.type===Ni.BLUR||k.type===Ni.FOCUS_OUT,Ge=!Nw(se._f)&&!t.resolver&&!he(r.errors,B)&&!se._f.deps||zw(_e,he(r.touchedFields,B),r.isSubmitted,Se,ne),q=Ep(B,a,_e);ct(s,B,te),_e?(!P||!P.readOnly)&&(se._f.onBlur&&se._f.onBlur(k),c&&c(0)):se._f.onChange&&se._f.onChange(k);const de=_(B,te,_e),Ee=!ir(de)||q;if(!_e&&h.state.next({name:B,type:k.type,values:Ut(s)}),Ge)return(d.isValid||f.isValid)&&(t.mode==="onBlur"?_e&&p():_e||p()),Ee&&h.state.next({name:B,...q?{}:de});if(!_e&&q&&h.state.next({...r}),t.resolver){const{errors:Ae}=await D([B]);if(O(te),ue){const Fe=Dp(r.errors,n,B),X=Dp(Ae,n,Fe.name||B);Oe=X.error,B=X.name,R=ir(Ae)}}else b([B],!0),Oe=(await Ap(se,a.disabled,s,v,t.shouldUseNativeValidation))[B],b([B]),O(te),ue&&(Oe?R=!1:(d.isValid||f.isValid)&&(R=await M(n,!0)));ue&&(se._f.deps&&fe(se._f.deps),W(B,R,Oe,de))}},ce=(k,P)=>{if(he(r.errors,P)&&k.focus)return k.focus(),1},fe=async(k,P={})=>{let B,ue;const se=Vo(k);if(t.resolver){const O=await A($t(k)?k:se);B=ir(O),ue=k?!se.some(ne=>he(O,ne)):B}else k?(ue=(await Promise.all(se.map(async O=>{const ne=he(n,O);return await M(ne&&ne._f?{[O]:ne}:ne)}))).every(Boolean),!(!ue&&!r.isValid)&&p()):ue=B=await M(n);return h.state.next({...!Hr(k)||(d.isValid||f.isValid)&&B!==r.isValid?{}:{name:k},...t.resolver||!k?{isValid:B}:{},errors:r.errors}),P.shouldFocus&&!ue&&Zo(n,ce,k?se:a.mount),ue},$=k=>{const P={...i.mount?s:o};return $t(k)?P:Hr(k)?he(P,k):k.map(B=>he(P,B))},Q=(k,P)=>({invalid:!!he((P||r).errors,k),isDirty:!!he((P||r).dirtyFields,k),error:he((P||r).errors,k),isValidating:!!he(r.validatingFields,k),isTouched:!!he((P||r).touchedFields,k)}),Ce=k=>{k&&Vo(k).forEach(P=>Ft(r.errors,P)),h.state.next({errors:k?r.errors:{}})},me=(k,P,B)=>{const ue=(he(n,k,{_f:{}})._f||{}).ref,se=he(r.errors,k)||{},{ref:O,message:ne,type:Se,...Oe}=se;ct(r.errors,k,{...Oe,...P,ref:ue}),h.state.next({name:k,errors:r.errors,isValid:!1}),B&&B.shouldFocus&&ue&&ue.focus&&ue.focus()},we=(k,P)=>Ir(k)?h.state.subscribe({next:B=>"values"in B&&k(G(void 0,P),B)}):G(k,P,!0),ae=k=>h.state.subscribe({next:P=>{Lw(k.name,P.name,k.exact)&&$w(P,k.formState||d,Be,k.reRenderRoot)&&k.callback({values:{...s},...r,...P,defaultValues:o})}}).unsubscribe,ee=k=>(i.mount=!0,f={...f,...k.formState},ae({...k,formState:f})),le=(k,P={})=>{for(const B of k?Vo(k):a.mount)a.mount.delete(B),a.array.delete(B),P.keepValue||(Ft(n,B),Ft(s,B)),!P.keepError&&Ft(r.errors,B),!P.keepDirty&&Ft(r.dirtyFields,B),!P.keepTouched&&Ft(r.touchedFields,B),!P.keepIsValidating&&Ft(r.validatingFields,B),!t.shouldUnregister&&!P.keepDefaultValue&&Ft(o,B);h.state.next({values:Ut(s)}),h.state.next({...r,...P.keepDirty?{isDirty:V()}:{}}),!P.keepIsValid&&p()},ge=({disabled:k,name:P})=>{(pr(k)&&i.mount||k||a.disabled.has(P))&&(k?a.disabled.add(P):a.disabled.delete(P))},ie=(k,P={})=>{let B=he(n,k);const ue=pr(P.disabled)||pr(t.disabled);return ct(n,k,{...B||{},_f:{...B&&B._f?B._f:{ref:{name:k}},name:k,mount:!0,...P}}),a.mount.add(k),B?ge({disabled:pr(P.disabled)?P.disabled:t.disabled,name:k}):S(k,!0,P.value),{...ue?{disabled:P.disabled||t.disabled}:{},...t.progressive?{required:!!P.required,min:qo(P.min),max:qo(P.max),minLength:qo(P.minLength),maxLength:qo(P.maxLength),pattern:qo(P.pattern)}:{},name:k,onChange:N,onBlur:N,ref:se=>{if(se){ie(k,P),B=he(n,k);const O=$t(se.value)&&se.querySelectorAll&&se.querySelectorAll("input,select,textarea")[0]||se,ne=Mw(O),Se=B._f.refs||[];if(ne?Se.find(Oe=>Oe===O):O===B._f.ref)return;ct(n,k,{_f:{...B._f,...ne?{refs:[...Se.filter(Bc),O,...Array.isArray(he(o,k))?[{}]:[]],ref:{type:O.type,name:k}}:{ref:O}}}),S(k,!1,void 0,O)}else B=he(n,k,{}),B._f&&(B._f.mount=!1),(t.shouldUnregister||P.shouldUnregister)&&!(cp(a.array,k)&&i.action)&&a.unMount.add(k)}}},pe=()=>t.shouldFocusError&&Zo(n,ce,a.mount),Re=k=>{pr(k)&&(h.state.next({disabled:k}),Zo(n,(P,B)=>{const ue=he(n,B);ue&&(P.disabled=ue._f.disabled||k,Array.isArray(ue._f.refs)&&ue._f.refs.forEach(se=>{se.disabled=ue._f.disabled||k}))},0,!1))},j=(k,P)=>async B=>{let ue;B&&(B.preventDefault&&B.preventDefault(),B.persist&&B.persist());let se=Ut(s);if(h.state.next({isSubmitting:!0}),t.resolver){const{errors:O,values:ne}=await D();r.errors=O,se=Ut(ne)}else await M(n);if(a.disabled.size)for(const O of a.disabled)Ft(se,O);if(Ft(r.errors,"root"),ir(r.errors)){h.state.next({errors:{}});try{await k(se,B)}catch(O){ue=O}}else P&&await P({...r.errors},B),pe(),setTimeout(pe);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ir(r.errors)&&!ue,submitCount:r.submitCount+1,errors:r.errors}),ue)throw ue},We=(k,P={})=>{he(n,k)&&($t(P.defaultValue)?U(k,Ut(he(o,k))):(U(k,P.defaultValue),ct(o,k,Ut(P.defaultValue))),P.keepTouched||Ft(r.touchedFields,k),P.keepDirty||(Ft(r.dirtyFields,k),r.isDirty=P.defaultValue?V(k,Ut(he(o,k))):V()),P.keepError||(Ft(r.errors,k),d.isValid&&p()),h.state.next({...r}))},qe=(k,P={})=>{const B=k?Ut(k):o,ue=Ut(B),se=ir(k),O=se?o:ue;if(P.keepDefaultValues||(o=B),!P.keepValues){if(P.keepDirtyValues){const ne=new Set([...a.mount,...Object.keys(Yo(o,s))]);for(const Se of Array.from(ne))he(r.dirtyFields,Se)?ct(O,Se,he(s,Se)):U(Se,he(O,Se))}else{if(Ic&&$t(k))for(const ne of a.mount){const Se=he(n,ne);if(Se&&Se._f){const Oe=Array.isArray(Se._f.refs)?Se._f.refs[0]:Se._f.ref;if($i(Oe)){const R=Oe.closest("form");if(R){R.reset();break}}}}if(P.keepFieldsRef)for(const ne of a.mount)U(ne,he(O,ne));else n={}}s=t.shouldUnregister?P.keepDefaultValues?Ut(o):{}:Ut(O),h.array.next({values:{...O}}),h.state.next({values:{...O}})}a={mount:P.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!d.isValid||!!P.keepIsValid||!!P.keepDirtyValues,i.watch=!!t.shouldUnregister,h.state.next({submitCount:P.keepSubmitCount?r.submitCount:0,isDirty:se?!1:P.keepDirty?r.isDirty:!!(P.keepDefaultValues&&!Xr(k,o)),isSubmitted:P.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:se?{}:P.keepDirtyValues?P.keepDefaultValues&&s?Yo(o,s):r.dirtyFields:P.keepDefaultValues&&k?Yo(o,k):P.keepDirty?r.dirtyFields:{},touchedFields:P.keepTouched?r.touchedFields:{},errors:P.keepErrors?r.errors:{},isSubmitSuccessful:P.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:o})},Ze=(k,P)=>qe(Ir(k)?k(s):k,P),Ne=(k,P={})=>{const B=he(n,k),ue=B&&B._f;if(ue){const se=ue.refs?ue.refs[0]:ue.ref;se.focus&&(se.focus(),P.shouldSelect&&Ir(se.select)&&se.select())}},Be=k=>{r={...r,...k}},pt={control:{register:ie,unregister:le,getFieldState:Q,handleSubmit:j,setError:me,_subscribe:ae,_runSchema:D,_focusError:pe,_getWatch:G,_getDirty:V,_setValid:p,_setFieldArray:w,_setDisabledField:ge,_setErrors:E,_getFieldArray:F,_reset:qe,_resetDefaultValues:()=>Ir(t.defaultValues)&&t.defaultValues().then(k=>{Ze(k,t.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:I,_disableForm:Re,_subjects:h,_proxyFormState:d,get _fields(){return n},get _formValues(){return s},get _state(){return i},set _state(k){i=k},get _defaultValues(){return o},get _names(){return a},set _names(k){a=k},get _formState(){return r},get _options(){return t},set _options(k){t={...t,...k}}},subscribe:ee,trigger:fe,register:ie,handleSubmit:j,watch:we,setValue:U,getValues:$,reset:Ze,resetField:We,clearErrors:Ce,unregister:le,setError:me,setFocus:Ne,getFieldState:Q};return{...pt,formControl:pt}}function Tp(e={}){const t=y.useRef(void 0),r=y.useRef(void 0),[n,o]=y.useState({isDirty:!1,isValidating:!1,isLoading:Ir(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Ir(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!Ir(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:i,...a}=Uw(e);t.current={...a,formState:n}}const s=t.current.control;return s._options=e,Rc(()=>{const i=s._subscribe({formState:s._proxyFormState,callback:()=>o({...s._formState}),reRenderRoot:!0});return o(a=>({...a,isReady:!0})),s._formState.isReady=!0,i},[s]),y.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),y.useEffect(()=>{e.mode&&(s._options.mode=e.mode),e.reValidateMode&&(s._options.reValidateMode=e.reValidateMode)},[s,e.mode,e.reValidateMode]),y.useEffect(()=>{e.errors&&(s._setErrors(e.errors),s._focusError())},[s,e.errors]),y.useEffect(()=>{e.shouldUnregister&&s._subjects.state.next({values:s._getWatch()})},[s,e.shouldUnregister]),y.useEffect(()=>{if(s._proxyFormState.isDirty){const i=s._getDirty();i!==n.isDirty&&s._subjects.state.next({isDirty:i})}},[s,n.isDirty]),y.useEffect(()=>{e.values&&!Xr(e.values,r.current)?(s._reset(e.values,{keepFieldsRef:!0,...s._options.resetOptions}),r.current=e.values,o(i=>({...i}))):s._resetDefaultValues()},[s,e.values]),y.useEffect(()=>{s._state.mount||(s._setValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),t.current.formState=lp(n,s),t.current}const Ip=(e,t,r)=>{if(e&&"reportValidity"in e){const n=he(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Fc=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?Ip(n.ref,r,e):n&&n.refs&&n.refs.forEach(o=>Ip(o,r,e))}},Mp=(e,t)=>{t.shouldUseNativeValidation&&Fc(e,t);const r={};for(const n in e){const o=he(t.fields,n),s=Object.assign(e[n]||{},{ref:o&&o.ref});if(Hw(t.names||Object.keys(e),n)){const i=Object.assign({},he(r,n));ct(i,"root",s),ct(r,n,i)}else ct(r,n,s)}return r},Hw=(e,t)=>{const r=Pp(t);return e.some(n=>Pp(n).match(`^${r}\\.\\d+`))};function Pp(e){return e.replace(/\]|\[/g,"")}function Z(e,t,r){function n(a,c){var l;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(l=a._zod).traits??(l.traits=new Set),a._zod.traits.add(e),t(a,c);for(const d in i.prototype)d in a||Object.defineProperty(a,d,{value:i.prototype[d].bind(a)});a._zod.constr=i,a._zod.def=c}const o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var c;const l=r?.Parent?new s:this;n(l,a),(c=l._zod).deferred??(c.deferred=[]);for(const d of l._zod.deferred)d();return l}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class Kn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Op extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const jp={};function Dn(e){return jp}function Vw(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Wc(e,t){return typeof t=="bigint"?t.toString():t}function Uc(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Hc(e){return e==null}function Vc(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Yw(e,t){const r=(e.toString().split(".")[1]||"").length,n=t.toString();let o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){const c=n.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}const s=r>o?r:o,i=Number.parseInt(e.toFixed(s).replace(".","")),a=Number.parseInt(t.toFixed(s).replace(".",""));return i%a/10**s}const Rp=Symbol("evaluating");function gt(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Rp)return n===void 0&&(n=Rp,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function qw(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function an(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Qn(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Np(e){return JSON.stringify(e)}const $p="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Fi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Zw=Uc(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Go(e){if(Fi(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(Fi(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Lp(e){return Go(e)?{...e}:e}const Gw=new Set(["string","number","symbol"]);function Xn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function cn(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function Te(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Kw(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Qw={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Xw(e,t){const r=e._zod.def,n=Qn(e._zod.def,{get shape(){const o={};for(const s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(o[s]=r.shape[s])}return an(this,"shape",o),o},checks:[]});return cn(e,n)}function Jw(e,t){const r=e._zod.def,n=Qn(e._zod.def,{get shape(){const o={...e._zod.def.shape};for(const s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete o[s]}return an(this,"shape",o),o},checks:[]});return cn(e,n)}function eS(e,t){if(!Go(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const o=Qn(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return an(this,"shape",s),s},checks:[]});return cn(e,o)}function tS(e,t){if(!Go(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return an(this,"shape",n),n},checks:e._zod.def.checks};return cn(e,r)}function rS(e,t){const r=Qn(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return an(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return cn(e,r)}function nS(e,t,r){const n=Qn(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(r)for(const i in r){if(!(i in o))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=e?new e({type:"optional",innerType:o[i]}):o[i])}else for(const i in o)s[i]=e?new e({type:"optional",innerType:o[i]}):o[i];return an(this,"shape",s),s},checks:[]});return cn(t,n)}function oS(e,t,r){const n=Qn(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(r)for(const i in r){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=new e({type:"nonoptional",innerType:o[i]}))}else for(const i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return an(this,"shape",s),s},checks:[]});return cn(t,n)}function Jn(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function zp(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Wi(e){return typeof e=="string"?e:e?.message}function kn(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const o=Wi(e.inst?._zod.def?.error?.(e))??Wi(t?.error?.(e))??Wi(r.customError?.(e))??Wi(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Yc(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ko(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const Bp=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Wc,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},qc=Z("$ZodError",Bp),Ui=Z("$ZodError",Bp,{Parent:Error});function sS(e,t=r=>r.message){const r={},n=[];for(const o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function iS(e,t){const r=t||function(s){return s.message},n={_errors:[]},o=s=>{for(const i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a}));else if(i.code==="invalid_key")o({issues:i.issues});else if(i.code==="invalid_element")o({issues:i.issues});else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){const l=i.path[c];c===i.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(r(i))):a[l]=a[l]||{_errors:[]},a=a[l],c++}}};return o(e),n}const Hi=e=>(t,r,n,o)=>{const s=n?Object.assign(n,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Kn;if(i.issues.length){const a=new(o?.Err??e)(i.issues.map(c=>kn(c,s,Dn())));throw $p(a,o?.callee),a}return i.value},aS=Hi(Ui),Vi=e=>async(t,r,n,o)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new(o?.Err??e)(i.issues.map(c=>kn(c,s,Dn())));throw $p(a,o?.callee),a}return i.value},cS=Vi(Ui),Yi=e=>(t,r,n)=>{const o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Kn;return s.issues.length?{success:!1,error:new(e??qc)(s.issues.map(i=>kn(i,o,Dn())))}:{success:!0,data:s.value}},lS=Yi(Ui),qi=e=>async(t,r,n)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>kn(i,o,Dn())))}:{success:!0,data:s.value}},uS=qi(Ui),dS=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Hi(e)(t,r,o)},fS=e=>(t,r,n)=>Hi(e)(t,r,n),pS=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Vi(e)(t,r,o)},hS=e=>async(t,r,n)=>Vi(e)(t,r,n),mS=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Yi(e)(t,r,o)},gS=e=>(t,r,n)=>Yi(e)(t,r,n),vS=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return qi(e)(t,r,o)},yS=e=>async(t,r,n)=>qi(e)(t,r,n),bS=/^[cC][^\s-]{8,}$/,xS=/^[0-9a-z]+$/,_S=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,wS=/^[0-9a-vA-V]{20}$/,SS=/^[A-Za-z0-9]{27}$/,CS=/^[a-zA-Z0-9_-]{21}$/,ES=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,DS=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Fp=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,kS=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,AS="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function TS(){return new RegExp(AS,"u")}const IS=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,MS=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,PS=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,OS=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,jS=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Wp=/^[A-Za-z0-9_-]*$/,RS=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,NS=/^\+(?:[0-9]){6,14}[0-9]$/,Up="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",$S=new RegExp(`^${Up}$`);function Hp(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function LS(e){return new RegExp(`^${Hp(e)}$`)}function zS(e){const t=Hp({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Up}T(?:${n})$`)}const BS=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},FS=/^\d+$/,WS=/^-?\d+(?:\.\d+)?/i,US=/true|false/i,HS=/^[^A-Z]*$/,VS=/^[^a-z]*$/,ar=Z("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Vp={number:"number",bigint:"bigint",object:"date"},Yp=Z("$ZodCheckLessThan",(e,t)=>{ar.init(e,t);const r=Vp[typeof t.value];e._zod.onattach.push(n=>{const o=n._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),qp=Z("$ZodCheckGreaterThan",(e,t)=>{ar.init(e,t);const r=Vp[typeof t.value];e._zod.onattach.push(n=>{const o=n._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),YS=Z("$ZodCheckMultipleOf",(e,t)=>{ar.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Yw(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),qS=Z("$ZodCheckNumberFormat",(e,t)=>{ar.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),n=r?"int":"number",[o,s]=Qw[t.format];e._zod.onattach.push(i=>{const a=i._zod.bag;a.format=t.format,a.minimum=o,a.maximum=s,r&&(a.pattern=FS)}),e._zod.check=i=>{const a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort});return}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inst:e})}}),ZS=Z("$ZodCheckMaxLength",(e,t)=>{var r;ar.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Hc(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const o=n.value;if(o.length<=t.maximum)return;const i=Yc(o);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),GS=Z("$ZodCheckMinLength",(e,t)=>{var r;ar.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Hc(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const o=n.value;if(o.length>=t.minimum)return;const i=Yc(o);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),KS=Z("$ZodCheckLengthEquals",(e,t)=>{var r;ar.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Hc(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{const o=n.value,s=o.length;if(s===t.length)return;const i=Yc(o),a=s>t.length;n.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Zi=Z("$ZodCheckStringFormat",(e,t)=>{var r,n;ar.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),QS=Z("$ZodCheckRegex",(e,t)=>{Zi.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),XS=Z("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=HS),Zi.init(e,t)}),JS=Z("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=VS),Zi.init(e,t)}),eC=Z("$ZodCheckIncludes",(e,t)=>{ar.init(e,t);const r=Xn(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),tC=Z("$ZodCheckStartsWith",(e,t)=>{ar.init(e,t);const r=new RegExp(`^${Xn(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),rC=Z("$ZodCheckEndsWith",(e,t)=>{ar.init(e,t);const r=new RegExp(`.*${Xn(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),nC=Z("$ZodCheckOverwrite",(e,t)=>{ar.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class oC{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const n=t.split(`
160
+ `+s):n.stack=s}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=bn(this.defaults,r);const{transitional:n,paramsSerializer:o,headers:s}=r;n!==void 0&&Ti.assertOptions(n,{silentJSONParsing:Wr.transitional(Wr.boolean),forcedJSONParsing:Wr.transitional(Wr.boolean),clarifyTimeoutError:Wr.transitional(Wr.boolean)},!1),o!=null&&(z.isFunction(o)?r.paramsSerializer={serialize:o}:Ti.assertOptions(o,{encode:Wr.function,serialize:Wr.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Ti.assertOptions(r,{baseUrl:Wr.spelling("baseURL"),withXsrfToken:Wr.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i=s&&z.merge(s.common,s[r.method]);s&&z.forEach(["delete","get","head","post","put","patch","common"],m=>{delete s[m]}),r.headers=sr.concat(i,s);const a=[];let c=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(r)===!1||(c=c&&p.synchronous,a.unshift(p.fulfilled,p.rejected))});const l=[];this.interceptors.response.forEach(function(p){l.push(p.fulfilled,p.rejected)});let d,f=0,h;if(!c){const m=[Rf.bind(this),void 0];for(m.unshift(...a),m.push(...l),h=m.length,d=Promise.resolve(r);f<h;)d=d.then(m[f++],m[f++]);return d}h=a.length;let v=r;for(f=0;f<h;){const m=a[f++],p=a[f++];try{v=m(v)}catch(b){p.call(this,b);break}}try{d=Rf.call(this,v)}catch(m){return Promise.reject(m)}for(f=0,h=l.length;f<h;)d=d.then(l[f++],l[f++]);return d}getUri(t){t=bn(this.defaults,t);const r=Df(t.baseURL,t.url,t.allowAbsoluteUrls);return vf(r,t.params,t.paramsSerializer)}};z.forEach(["delete","get","head","options"],function(t){xn.prototype[t]=function(r,n){return this.request(bn(n||{},{method:t,url:r,data:(n||{}).data}))}}),z.forEach(["post","put","patch"],function(t){function r(n){return function(s,i,a){return this.request(bn(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:i}))}}xn.prototype[t]=r(),xn.prototype[t+"Form"]=r(!0)});let Px=class p0{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(s){r=s});const n=this;this.promise.then(o=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](o);n._listeners=null}),this.promise.then=o=>{let s;const i=new Promise(a=>{n.subscribe(a),s=a}).then(o);return i.cancel=function(){n.unsubscribe(s)},i},t(function(s,i,a){n.reason||(n.reason=new qn(s,i,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new p0(function(o){t=o}),cancel:t}}};function Ox(e){return function(r){return e.apply(null,r)}}function jx(e){return z.isObject(e)&&e.isAxiosError===!0}const xc={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(xc).forEach(([e,t])=>{xc[t]=e});function Lf(e){const t=new xn(e),r=tf(xn.prototype.request,t);return z.extend(r,xn.prototype,t,{allOwnKeys:!0}),z.extend(r,t,null,{allOwnKeys:!0}),r.create=function(o){return Lf(bn(e,o))},r}const Rt=Lf(Oo);Rt.Axios=xn,Rt.CanceledError=qn,Rt.CancelToken=Px,Rt.isCancel=wf,Rt.VERSION=Nf,Rt.toFormData=Si,Rt.AxiosError=Le,Rt.Cancel=Rt.CanceledError,Rt.all=function(t){return Promise.all(t)},Rt.spread=Ox,Rt.isAxiosError=jx,Rt.mergeConfig=bn,Rt.AxiosHeaders=sr,Rt.formToJSON=e=>xf(z.isHTMLForm(e)?new FormData(e):e),Rt.getAdapter=jf.getAdapter,Rt.HttpStatusCode=xc,Rt.default=Rt;const{Axios:GT,AxiosError:KT,CanceledError:QT,isCancel:XT,CancelToken:JT,VERSION:e5,all:t5,Cancel:r5,isAxiosError:n5,spread:o5,toFormData:s5,AxiosHeaders:i5,HttpStatusCode:a5,formToJSON:c5,getAdapter:l5,mergeConfig:u5}=Rt,zf={token:null},Rx=e=>{zf.token=e},Et=Rt.create({headers:{"Content-Type":"application/json"}});Et.interceptors.request.use(e=>{const t=zf.token;return t&&(e.headers.Authorization=`Bearer ${t}`),e},e=>Promise.reject(e));const Bf=y.createContext(void 0),Nx=({config:e,children:t})=>(y.useEffect(()=>{e.getToken&&Rx(e.getToken)},[e.getToken]),u.jsx(Bf.Provider,{value:e,children:t})),_c=()=>{const e=y.useContext(Bf);if(!e)throw new Error("useApiConfig debe ser usado dentro de un ApiProvider");return e},Ii=()=>{const{calendarApiUrl:e}=_c();return{getGoogleAuthUrl:async()=>{try{const i=`${e}/api/Calendario/v1/auth-url-Google`;return(await Et.get(i)).data}catch(i){throw console.error("Error al obtener la URL de Google Auth:",i),i}},saveGoogleCredentials:async i=>{try{const a=new URLSearchParams({code:i.code,disID:String(i.disID),usrID:String(i.usrID)}).toString(),c=`${e}/api/Calendario/v1/google-auth/SaveCredential?${a}`;return(await Et.post(c,{})).data}catch(a){throw console.error("Error al guardar credenciales de Google:",a),a}},getGoogleCalendars:async(i,a)=>{try{return(await Et.get(`${e}/api/Calendario/v1/google/ObtenerTiposCalendariosGoogleAsync?usrMail=${encodeURIComponent(i)}&disID=${a}`)).data}catch(c){throw console.error("Error al obtener los calendarios de Google:",c),c}},syncGoogleEvents:async(i,a,c)=>{try{return(await Et.post(`${e}/api/Calendario/v1/google/SincronizarEnviarEventosAsync?usrMail=${encodeURIComponent(i)}&disID=${a}&UsuarioID=${c}`)).data}catch(l){throw console.error("Error al sincronizar eventos con Google Calendar:",l),l}},getGoogleEventsByMonth:async i=>{try{return(await Et.post(`${e}/api/Calendario/v1/google/ObtenerEventosGoogleAsyncXMes`,i)).data}catch(a){throw console.error("Error al obtener eventos de Google Calendar por mes:",a),a}}}},Ff="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAASFBMVEVChfRHcExDhOAWaNUZfjjkTDf////6/P7b6fu61fj7wCj7vASZv/VuoPBQjvVCr19GifE0qFM4gerrRjMubcQQaucZZ9MYgTpc4mWWAAAABnRSTlP/AFtbW/eMEQaPAAAAfUlEQVR42q3Pyw4CIQyFYVDbigKOl6Pv/6a2ZBYN08TEzL9gcb6waDqkubd1TEsEWkp7Q3e9RuvOrsvV+g0Fi+jaZIKC0sECzMDCDK51C9zR9A2gPhCC6HgOoIFL/KMD1cMfl39GNxc9NVrh7jKgHAPlCGwPgSgbnDYw9vwFKv0VRfpGYZ8AAAAASUVORK5CYII=",$x=({disID:e,usrID:t})=>{const[r,n]=y.useState(null),o=Ii(),s=async()=>{localStorage.setItem("temp_auth_disID",String(e)),localStorage.setItem("temp_auth_usrID",String(t)),n(null);try{const{url:i}=await o.getGoogleAuthUrl();window.location.href=i}catch(i){n(i.message||"Fallo al iniciar sesión con Google."),localStorage.removeItem("temp_auth_disID"),localStorage.removeItem("temp_auth_usrID")}finally{}};return u.jsxs("div",{className:"flex",children:[u.jsxs("div",{className:xe.syncButton,onClick:s,children:[u.jsx("div",{className:xe.customCheckIcon,children:u.jsx("div",{className:xe.uncheckedCircle})}),u.jsx("img",{src:Ff,width:18}),u.jsx("span",{children:"Google Calendar"})]}),r&&u.jsx("p",{className:"text-red-500 mt-2",children:r})]})},wc=()=>{const{calendarApiUrl:e}=_c();return{getOutlookAuthUrl:async()=>{try{const i=`${e}/api/Calendario/v1/auth-url-Outlook`,a=await Et.get(i);return console.log("api",a),a.data}catch(i){throw console.error("Error al obtener la URL de Outlook Auth:",i),i}},saveOutlookCredentials:async i=>{try{const a=new URLSearchParams({code:i.code,disID:String(i.disID),usrID:String(i.usrID)}).toString(),c=`${e}/api/Calendario/v1/outlook-auth/SaveCredential?${a}`;return(await Et.post(c,{})).data}catch(a){throw console.error("Error al guardar credenciales Outlook:",a),a}},syncOutlookEvents:async(i,a,c)=>{try{return(await Et.post(`${e}/api/Calendario/v1/outlook/SincronizarEnviarEventosAsync?usrMail=${encodeURIComponent(i)}&disID=${a}&UsuarioID=${c}`)).data}catch(l){throw console.error("Error al sincronizar eventos con outlook Calendar:",l),l}},getOutlookCalendars:async(i,a)=>{try{return(await Et.get(`${e}/api/Calendario/v1/outlook/ObtenerTiposCalendariosOutlookAsync?usrMail=${encodeURIComponent(i)}&disID=${a}`)).data}catch(c){throw console.error("Error al obtener los calendarios de Google:",c),c}},getOutlookEventsByMonth:async i=>{try{return(await Et.post(`${e}/api/Calendario/v1/outlook/ObtenerEventosoutlookAsyncXMes`,i)).data}catch(a){throw console.error("Error al obtener eventos de Outlook Calendar por mes:",a),a}}}},Wf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAYCAMAAAA8nnbJAAAAflBMVEUAAAAAV34AMFoAID0ATmsAL1oATXcAZZAAIUgANmQArPAAfd0BedoAacQAZbsAkuMActcAa9QAsfMAjfMAUJL///8Ame8Aht4A6v8A2v8Atvguid0AfMIAo+wAWrYA3/+q0/MAQ38ASIjB4PeHwe4AU7JlsekAdcMAXqgApf4WoQK+AAAACnRSTlMATjUWISlCbAuE1QOT9gAAAP1JREFUKM9t0GF7QzAQwPG2xiw5JGlICWVsrX3/L7i7Gyae/l944efinpzW4ktQfPrvorIgiHaW5UHZ29Hu3Dd235uTUkJnMHGj2NKISvh/TmBdX9c1W/pz5SQOOtsFFl0lBfx8YeCH6aHJhEG89X2/2aOchnLSIC1IACWwZjFdfmnwpSeDg/kSJH0AsLPLZgBoam9jsp2p8EylLK2rjDAmb89kALzLoLUaMyx3bs6rajHlh8FnZHzN+VwVxWKI+F5jFgdnW2BsaSUxUBRYYUdXrYaDMfbxydmuEU+32tJ7+5fB7QvUwBrDCcq4Z2AirJX7udCaziUMVHI+hPQLqRAg85aAu30AAAAASUVORK5CYII=",Lx=({disID:e,usrID:t})=>{const[r,n]=y.useState(null),o=wc(),s=async()=>{localStorage.setItem("temp_auth_disID",String(e)),localStorage.setItem("temp_auth_usrID",String(t)),n(null);try{const i=await o.getOutlookAuthUrl();window.location.href=i?.authUrl}catch(i){n(i.message||"Fallo al iniciar sesión con Google."),localStorage.removeItem("temp_auth_disID"),localStorage.removeItem("temp_auth_usrID")}finally{}};return u.jsxs("div",{className:"flex",children:[u.jsxs("div",{className:xe.syncButton,onClick:s,children:[u.jsx("div",{className:xe.customCheckIcon,children:u.jsx("div",{className:xe.uncheckedCircle})}),u.jsx("img",{src:Wf,width:20}),u.jsx("span",{children:"Outlook"})]}),r&&u.jsx("p",{className:"text-red-500 mt-2",children:r})]})},Uf="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='88'%20height='67'%20fill='none'%3e%3cg%20filter='url(%23a)'%20opacity='.7'%3e%3cellipse%20cx='69.302'%20cy='60.952'%20fill='%23D9D9D9'%20rx='12.698'%20ry='2.032'/%3e%3c/g%3e%3cpath%20fill='%23D6D6D6'%20fill-rule='evenodd'%20d='M60.034%2011.99c.71.001%201.37.374%201.737.982l-1.74%201.05a270%20270%200%200%201%201.74-1.048l.002.002.002.004.007.011.02.034.063.11q.08.139.21.385c.171.327.403.795.657%201.38a24.6%2024.6%200%200%201%201.527%204.811c.817%203.964.847%209.339-2.499%2014.552a2.033%202.033%200%200%201-3.242.236l1.533-1.333-1.535%201.332v-.003l-.005-.004-.01-.012-.028-.033-.082-.1a10%2010%200%200%201-.26-.34%2014%2014%200%200%201-.798-1.221%2017.3%2017.3%200%200%201-1.828-4.469c-.986-3.873-.934-9.225%202.79-15.35l.072-.11c.38-.542%201-.867%201.667-.866m1.867%2017.26q-.02.064-.042.126.091-.276.172-.552zm-1.626-14.786.004.008z'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23C2C3CC'%20d='M59.728%2035.515s-1.736-7.32%206.371-12.183c0%200%20.497%208.29-6.371%2012.183'/%3e%3cpath%20fill='%23D6D6D6'%20fill-rule='evenodd'%20d='M79.915%2011.99c.71.001%201.37.374%201.737.982l-1.74%201.05a281%20281%200%200%201%201.74-1.048l.002.002.002.004.007.011.02.034.063.11q.08.139.21.385c.171.327.402.795.657%201.38a24.6%2024.6%200%200%201%201.527%204.811c.817%203.964.847%209.339-2.5%2014.552a2.033%202.033%200%200%201-3.241.236l1.532-1.333-1.534%201.332-.001-.003-.004-.004-.011-.012-.027-.033-.082-.1a10%2010%200%200%201-.26-.34c-.211-.287-.492-.698-.799-1.221a17.3%2017.3%200%200%201-1.827-4.469c-.986-3.873-.934-9.225%202.79-15.35l.072-.11c.38-.542%201-.867%201.667-.866m2.476%209.544q.013.113.027.228-.058-.477-.135-.934z'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23C2C3CC'%20fill-rule='evenodd'%20d='M72.733%2022.085c.313-.165.691-.154.996.028l-.522.871c.522-.87.521-.871.522-.87l.004.001.007.004.021.013q.027.016.072.046.091.057.25.165c.212.145.507.357.856.635.697.556%201.62%201.383%202.52%202.474%201.803%202.183%203.562%205.475%203.201%209.764a1.016%201.016%200%200%201-1.376.863h-.002l-.004-.002-.008-.002-.023-.01-.079-.033a9.79%209.79%200%200%201-1.139-.603%2012%2012%200%200%201-2.566-2.14c-1.853-2.044-3.57-5.345-3.271-10.365l.017-.131c.057-.3.249-.563.524-.708M78.04%2034.22l.11.075a11%2011%200%200%201-.394-.282zm-4.516-11.027.334.237q0%200%20.003.002a13%2013%200%200%200-.337-.24'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23C2C3CC'%20fill-rule='evenodd'%20d='M85.456%2022.461a1.017%201.017%200%200%201%201.536.81l-1.014.061%201.014-.06v.002l.001.003v.008l.001.024.004.085q.004.108.004.301c0%20.257-.007.62-.04%201.067-.064.89-.227%202.12-.618%203.482-.781%202.723-2.5%206.038-6.237%208.156a1.018%201.018%200%200%201-1.489-.65l-.002-.006-.002-.009-.005-.025a5%205%200%200%201-.065-.367%2010%2010%200%200%201-.096-.999c-.04-.837%200-2.002.316-3.331.639-2.686%202.388-5.97%206.692-8.552'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23D6D6D6'%20fill-rule='evenodd'%20d='M70.232%205.343c.71.002%201.37.374%201.737.982l-1.74%201.05c1.739-1.05%201.74-1.048%201.74-1.048l.002.002q0%20.003.003.004l.008.014.023.04.082.142q.102.18.274.505c.227.432.535%201.053.875%201.834a33%2033%200%200%201%202.036%206.417c1.09%205.284%201.122%2012.4-3.305%2019.3a2.034%202.034%200%200%201-3.242.236l1.532-1.334a223%20223%200%200%201-1.534%201.332l-.002-.002-.004-.005-.012-.013-.033-.04-.102-.124a13%2013%200%200%201-.335-.438%2019%2019%200%200%201-1.048-1.603%2023%2023%200%200%201-2.413-5.902c-1.3-5.104-1.25-12.198%203.719-20.373l.072-.11c.38-.541%201-.867%201.667-.866m1.563%2026.818v-.002l-.003-.002v-.002z'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23AAABAD'%20fill-rule='evenodd'%20d='M60.61%2018.704c.315-.166.693-.155.998.027l-.523.871c.489-.815.52-.868.523-.87l.004.001.009.005.027.017a8%208%200%200%201%20.425.279c.282.192.676.476%201.145.85a23%2023%200%200%201%203.383%203.32c2.419%202.929%204.765%207.325%204.284%2013.05a1.017%201.017%200%200%201-1.376.864l.363-.948-.364.947h-.002l-.003-.002q-.005%200-.01-.003l-.03-.012-.1-.041a9%209%200%200%201-.341-.157c-.288-.139-.69-.35-1.164-.642a16%2016%200%200%201-3.42-2.852c-2.465-2.719-4.768-7.125-4.367-13.866l.017-.131c.058-.3.248-.562.523-.708m.436%201.974q.003-.237.011-.477v-.003a24%2024%200%200%200-.01.48'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23AAABAD'%20fill-rule='evenodd'%20d='M78.103%2019.143a1.016%201.016%200%200%201%201.419.871l-1.014.06%201.014-.06.001.002v.013l.002.032.004.11q.005.142.006.399c0%20.341-.01.83-.054%201.428a23.2%2023.2%200%200%201-.829%204.675c-1.05%203.655-3.348%208.076-8.335%2010.904a1.016%201.016%200%200%201-1.49-.65l.989-.233-.988.232-.001-.001-.001-.004-.002-.01-.007-.032q-.01-.038-.022-.104a9%209%200%200%201-.064-.372c-.047-.317-.1-.768-.127-1.326a16%2016%200%200%201%20.423-4.441c.85-3.574%203.18-7.967%208.96-11.433zm-8.499%2015.032c-.007.617.024%201.143.066%201.552q.032.308.065.524c.043.286.08.443.08.443-.003-.017-.23-.99-.21-2.52m.05-1.027q-.023.282-.036.546l.032-.511q.001-.018.004-.035'%20clip-rule='evenodd'/%3e%3cpath%20fill='%23D6D6D6'%20d='M55.804%2031.519h28.238c.815%200%201.476.663%201.476%201.481v15.847c0%206.204-5.019%2011.241-11.2%2011.241h-8.79c-6.182%200-11.2-5.037-11.2-11.24V33c0-.818.66-1.481%201.476-1.481'/%3e%3cpath%20fill='%23E6E8ED'%20d='M68.15%2032.344v17.159c0%205.103%203.6%209.364%208.39%2010.361%205.122-1.034%208.978-5.574%208.978-11.018V33c0-.818-.66-1.481-1.476-1.481h-15.07a.823.823%200%200%200-.822.824z'/%3e%3cg%20filter='url(%23b)'%20opacity='.7'%3e%3cellipse%20cx='33.238'%20cy='60.952'%20fill='%23D9D9D9'%20rx='28.444'%20ry='3.048'/%3e%3c/g%3e%3cpath%20fill='%233856EC'%20d='M6.095%2017.27h54.857V53.84a6.095%206.095%200%200%201-6.095%206.095H12.19a6.095%206.095%200%200%201-6.095-6.095z'/%3e%3cpath%20fill='%23E2EDFB'%20d='M6.195%2050.145a8.127%208.127%200%200%200%208.127%208.127H37.9a6.1%206.1%200%200%200%204.309-1.785l16.98-16.973a6.1%206.1%200%200%200%201.785-4.31V9.586a6.095%206.095%200%200%200-6.095-6.095H12.29a6.095%206.095%200%200%200-6.095%206.095z'/%3e%3cpath%20fill='%233856EC'%20fill-rule='evenodd'%20d='M60.952%209.009a6.014%206.014%200%200%200-6.014-6.014H12.11a6.014%206.014%200%200%200-6.014%206.014v8.284h54.857zM17.77%2012.772a2.794%202.794%200%201%201%20.002-5.589%202.794%202.794%200%200%201-.002%205.59m15.965%200a2.794%202.794%200%201%201%20.001-5.588%202.794%202.794%200%200%201%200%205.588m16.763%200a2.794%202.794%200%201%201%20.001-5.588%202.794%202.794%200%200%201-.001%205.588'%20clip-rule='evenodd'/%3e%3crect%20width='7.982'%20height='7.982'%20x='11.783'%20y='22.351'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='23.756'%20y='22.351'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='34.931'%20y='22.351'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='46.904'%20y='22.351'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='11.783'%20y='33.526'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='23.756'%20y='33.526'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='34.931'%20y='33.526'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='46.904'%20y='33.526'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='11.783'%20y='44.702'%20fill='%23fff'%20rx='2.032'/%3e%3crect%20width='7.982'%20height='7.982'%20x='23.756'%20y='44.702'%20fill='%23fff'%20rx='2.032'/%3e%3cpath%20fill='%23597EF7'%20d='M40.52%2057.687a6%206%200%200%200%201.665-1.174l17.027-17.021a6%206%200%200%200%201.313-1.973H48.646a8.127%208.127%200%200%200-8.127%208.127z'/%3e%3crect%20width='3.991'%20height='11.974'%20x='15.773'%20fill='%23D9D9D9'%20rx='1.996'/%3e%3crect%20width='3.991'%20height='11.974'%20x='31.738'%20fill='%23D9D9D9'%20rx='1.996'/%3e%3crect%20width='3.991'%20height='11.974'%20x='48.501'%20fill='%23D9D9D9'%20rx='1.996'/%3e%3cdefs%3e%3cfilter%20id='a'%20width='29.46'%20height='8.127'%20x='54.572'%20y='56.889'%20color-interpolation-filters='sRGB'%20filterUnits='userSpaceOnUse'%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'/%3e%3cfeBlend%20in='SourceGraphic'%20in2='BackgroundImageFix'%20result='shape'/%3e%3cfeGaussianBlur%20result='effect1_foregroundBlur_529_4322'%20stdDeviation='1.016'/%3e%3c/filter%3e%3cfilter%20id='b'%20width='60.952'%20height='10.159'%20x='2.762'%20y='55.873'%20color-interpolation-filters='sRGB'%20filterUnits='userSpaceOnUse'%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'/%3e%3cfeBlend%20in='SourceGraphic'%20in2='BackgroundImageFix'%20result='shape'/%3e%3cfeGaussianBlur%20result='effect1_foregroundBlur_529_4322'%20stdDeviation='1.016'/%3e%3c/filter%3e%3c/defs%3e%3c/svg%3e";class _n extends Error{constructor(t,r){const n=new.target.prototype;super(`${t}: Status code '${r}'`),this.statusCode=r,this.__proto__=n}}class Sc extends Error{constructor(t="A timeout occurred."){const r=new.target.prototype;super(t),this.__proto__=r}}class Ar extends Error{constructor(t="An abort occurred."){const r=new.target.prototype;super(t),this.__proto__=r}}class zx extends Error{constructor(t,r){const n=new.target.prototype;super(t),this.transport=r,this.errorType="UnsupportedTransportError",this.__proto__=n}}class Bx extends Error{constructor(t,r){const n=new.target.prototype;super(t),this.transport=r,this.errorType="DisabledTransportError",this.__proto__=n}}class Fx extends Error{constructor(t,r){const n=new.target.prototype;super(t),this.transport=r,this.errorType="FailedToStartTransportError",this.__proto__=n}}class Hf extends Error{constructor(t){const r=new.target.prototype;super(t),this.errorType="FailedToNegotiateWithServerError",this.__proto__=r}}class Wx extends Error{constructor(t,r){const n=new.target.prototype;super(t),this.innerErrors=r,this.__proto__=n}}class Vf{constructor(t,r,n){this.statusCode=t,this.statusText=r,this.content=n}}class Mi{get(t,r){return this.send({...r,method:"GET",url:t})}post(t,r){return this.send({...r,method:"POST",url:t})}delete(t,r){return this.send({...r,method:"DELETE",url:t})}getCookieString(t){return""}}var H;(function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Information=2]="Information",e[e.Warning=3]="Warning",e[e.Error=4]="Error",e[e.Critical=5]="Critical",e[e.None=6]="None"})(H||(H={}));class Ro{constructor(){}log(t,r){}}Ro.instance=new Ro;const Ux="10.0.0";class Bt{static isRequired(t,r){if(t==null)throw new Error(`The '${r}' argument is required.`)}static isNotEmpty(t,r){if(!t||t.match(/^\s*$/))throw new Error(`The '${r}' argument should not be empty.`)}static isIn(t,r,n){if(!(t in r))throw new Error(`Unknown ${n} value: ${t}.`)}}class Dt{static get isBrowser(){return!Dt.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!Dt.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!Dt.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}}function No(e,t){let r="";return wn(e)?(r=`Binary data of length ${e.byteLength}`,t&&(r+=`. Content: '${Hx(e)}'`)):typeof e=="string"&&(r=`String data of length ${e.length}`,t&&(r+=`. Content: '${e}'`)),r}function Hx(e){const t=new Uint8Array(e);let r="";return t.forEach(n=>{const o=n<16?"0":"";r+=`0x${o}${n.toString(16)} `}),r.substring(0,r.length-1)}function wn(e){return e&&typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||e.constructor&&e.constructor.name==="ArrayBuffer")}async function Yf(e,t,r,n,o,s){const i={},[a,c]=Zn();i[a]=c,e.log(H.Trace,`(${t} transport) sending data. ${No(o,s.logMessageContent)}.`);const l=wn(o)?"arraybuffer":"text",d=await r.post(n,{content:o,headers:{...i,...s.headers},responseType:l,timeout:s.timeout,withCredentials:s.withCredentials});e.log(H.Trace,`(${t} transport) request complete. Response status: ${d.statusCode}.`)}function Vx(e){return e===void 0?new Pi(H.Information):e===null?Ro.instance:e.log!==void 0?e:new Pi(e)}class Yx{constructor(t,r){this._subject=t,this._observer=r}dispose(){const t=this._subject.observers.indexOf(this._observer);t>-1&&this._subject.observers.splice(t,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(r=>{})}}class Pi{constructor(t){this._minLevel=t,this.out=console}log(t,r){if(t>=this._minLevel){const n=`[${new Date().toISOString()}] ${H[t]}: ${r}`;switch(t){case H.Critical:case H.Error:this.out.error(n);break;case H.Warning:this.out.warn(n);break;case H.Information:this.out.info(n);break;default:this.out.log(n);break}}}}function Zn(){let e="X-SignalR-User-Agent";return Dt.isNode&&(e="User-Agent"),[e,qx(Ux,Zx(),Kx(),Gx())]}function qx(e,t,r,n){let o="Microsoft SignalR/";const s=e.split(".");return o+=`${s[0]}.${s[1]}`,o+=` (${e}; `,t&&t!==""?o+=`${t}; `:o+="Unknown OS; ",o+=`${r}`,n?o+=`; ${n}`:o+="; Unknown Runtime Version",o+=")",o}function Zx(){if(Dt.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function Gx(){if(Dt.isNode)return process.versions.node}function Kx(){return Dt.isNode?"NodeJS":"Browser"}function Cc(e){return e.stack?e.stack:e.message?e.message:`${e}`}function Qx(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}class Xx extends Mi{constructor(t){if(super(),this._logger=t,typeof fetch>"u"||Dt.isNode){const r=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._jar=new(r("tough-cookie")).CookieJar,typeof fetch>"u"?this._fetchType=r("node-fetch"):this._fetchType=fetch,this._fetchType=r("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(Qx());if(typeof AbortController>"u"){const r=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._abortControllerType=r("abort-controller")}else this._abortControllerType=AbortController}async send(t){if(t.abortSignal&&t.abortSignal.aborted)throw new Ar;if(!t.method)throw new Error("No method defined.");if(!t.url)throw new Error("No url defined.");const r=new this._abortControllerType;let n;t.abortSignal&&(t.abortSignal.onabort=()=>{r.abort(),n=new Ar});let o=null;if(t.timeout){const c=t.timeout;o=setTimeout(()=>{r.abort(),this._logger.log(H.Warning,"Timeout from HTTP request."),n=new Sc},c)}t.content===""&&(t.content=void 0),t.content&&(t.headers=t.headers||{},wn(t.content)?t.headers["Content-Type"]="application/octet-stream":t.headers["Content-Type"]="text/plain;charset=UTF-8");let s;try{s=await this._fetchType(t.url,{body:t.content,cache:"no-cache",credentials:t.withCredentials===!0?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...t.headers},method:t.method,mode:"cors",redirect:"follow",signal:r.signal})}catch(c){throw n||(this._logger.log(H.Warning,`Error from HTTP request. ${c}.`),c)}finally{o&&clearTimeout(o),t.abortSignal&&(t.abortSignal.onabort=null)}if(!s.ok){const c=await qf(s,"text");throw new _n(c||s.statusText,s.status)}const a=await qf(s,t.responseType);return new Vf(s.status,s.statusText,a)}getCookieString(t){let r="";return Dt.isNode&&this._jar&&this._jar.getCookies(t,(n,o)=>r=o.join("; ")),r}}function qf(e,t){let r;switch(t){case"arraybuffer":r=e.arrayBuffer();break;case"text":r=e.text();break;case"blob":case"document":case"json":throw new Error(`${t} is not supported.`);default:r=e.text();break}return r}class Jx extends Mi{constructor(t){super(),this._logger=t}send(t){return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new Ar):t.method?t.url?new Promise((r,n)=>{const o=new XMLHttpRequest;o.open(t.method,t.url,!0),o.withCredentials=t.withCredentials===void 0?!0:t.withCredentials,o.setRequestHeader("X-Requested-With","XMLHttpRequest"),t.content===""&&(t.content=void 0),t.content&&(wn(t.content)?o.setRequestHeader("Content-Type","application/octet-stream"):o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const s=t.headers;s&&Object.keys(s).forEach(i=>{o.setRequestHeader(i,s[i])}),t.responseType&&(o.responseType=t.responseType),t.abortSignal&&(t.abortSignal.onabort=()=>{o.abort(),n(new Ar)}),t.timeout&&(o.timeout=t.timeout),o.onload=()=>{t.abortSignal&&(t.abortSignal.onabort=null),o.status>=200&&o.status<300?r(new Vf(o.status,o.statusText,o.response||o.responseText)):n(new _n(o.response||o.responseText||o.statusText,o.status))},o.onerror=()=>{this._logger.log(H.Warning,`Error from HTTP request. ${o.status}: ${o.statusText}.`),n(new _n(o.statusText,o.status))},o.ontimeout=()=>{this._logger.log(H.Warning,"Timeout from HTTP request."),n(new Sc)},o.send(t.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class e_ extends Mi{constructor(t){if(super(),typeof fetch<"u"||Dt.isNode)this._httpClient=new Xx(t);else if(typeof XMLHttpRequest<"u")this._httpClient=new Jx(t);else throw new Error("No usable HttpClient found.")}send(t){return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new Ar):t.method?t.url?this._httpClient.send(t):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(t){return this._httpClient.getCookieString(t)}}class fr{static write(t){return`${t}${fr.RecordSeparator}`}static parse(t){if(t[t.length-1]!==fr.RecordSeparator)throw new Error("Message is incomplete.");const r=t.split(fr.RecordSeparator);return r.pop(),r}}fr.RecordSeparatorCode=30,fr.RecordSeparator=String.fromCharCode(fr.RecordSeparatorCode);class t_{writeHandshakeRequest(t){return fr.write(JSON.stringify(t))}parseHandshakeResponse(t){let r,n;if(wn(t)){const a=new Uint8Array(t),c=a.indexOf(fr.RecordSeparatorCode);if(c===-1)throw new Error("Message is incomplete.");const l=c+1;r=String.fromCharCode.apply(null,Array.prototype.slice.call(a.slice(0,l))),n=a.byteLength>l?a.slice(l).buffer:null}else{const a=t,c=a.indexOf(fr.RecordSeparator);if(c===-1)throw new Error("Message is incomplete.");const l=c+1;r=a.substring(0,l),n=a.length>l?a.substring(l):null}const o=fr.parse(r),s=JSON.parse(o[0]);if(s.type)throw new Error("Expected a handshake response from the server.");return[n,s]}}var $e;(function(e){e[e.Invocation=1]="Invocation",e[e.StreamItem=2]="StreamItem",e[e.Completion=3]="Completion",e[e.StreamInvocation=4]="StreamInvocation",e[e.CancelInvocation=5]="CancelInvocation",e[e.Ping=6]="Ping",e[e.Close=7]="Close",e[e.Ack=8]="Ack",e[e.Sequence=9]="Sequence"})($e||($e={}));class r_{constructor(){this.observers=[]}next(t){for(const r of this.observers)r.next(t)}error(t){for(const r of this.observers)r.error&&r.error(t)}complete(){for(const t of this.observers)t.complete&&t.complete()}subscribe(t){return this.observers.push(t),new Yx(this,t)}}class n_{constructor(t,r,n){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=t,this._connection=r,this._bufferSize=n}async _send(t){const r=this._protocol.writeMessage(t);let n=Promise.resolve();if(this._isInvocationMessage(t)){this._totalMessageCount++;let o=()=>{},s=()=>{};wn(r)?this._bufferedByteCount+=r.byteLength:this._bufferedByteCount+=r.length,this._bufferedByteCount>=this._bufferSize&&(n=new Promise((i,a)=>{o=i,s=a})),this._messages.push(new o_(r,this._totalMessageCount,o,s))}try{this._reconnectInProgress||await this._connection.send(r)}catch{this._disconnected()}await n}_ack(t){let r=-1;for(let n=0;n<this._messages.length;n++){const o=this._messages[n];if(o._id<=t.sequenceId)r=n,wn(o._message)?this._bufferedByteCount-=o._message.byteLength:this._bufferedByteCount-=o._message.length,o._resolver();else if(this._bufferedByteCount<this._bufferSize)o._resolver();else break}r!==-1&&(this._messages=this._messages.slice(r+1))}_shouldProcessMessage(t){if(this._waitForSequenceMessage)return t.type!==$e.Sequence?!1:(this._waitForSequenceMessage=!1,!0);if(!this._isInvocationMessage(t))return!0;const r=this._nextReceivingSequenceId;return this._nextReceivingSequenceId++,r<=this._latestReceivedSequenceId?(r===this._latestReceivedSequenceId&&this._ackTimer(),!1):(this._latestReceivedSequenceId=r,this._ackTimer(),!0)}_resetSequence(t){if(t.sequenceId>this._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=t.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){const t=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:$e.Sequence,sequenceId:t}));const r=this._messages;for(const n of r)await this._connection.send(n._message);this._reconnectInProgress=!1}_dispose(t){t??(t=new Error("Unable to reconnect to server."));for(const r of this._messages)r._rejector(t)}_isInvocationMessage(t){switch(t.type){case $e.Invocation:case $e.StreamItem:case $e.Completion:case $e.StreamInvocation:case $e.CancelInvocation:return!0;case $e.Close:case $e.Sequence:case $e.Ping:case $e.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:$e.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0},1e3))}}class o_{constructor(t,r,n,o){this._message=t,this._id=r,this._resolver=n,this._rejector=o}}const s_=30*1e3,i_=15*1e3,a_=1e5;var bt;(function(e){e.Disconnected="Disconnected",e.Connecting="Connecting",e.Connected="Connected",e.Disconnecting="Disconnecting",e.Reconnecting="Reconnecting"})(bt||(bt={}));class Ec{static create(t,r,n,o,s,i,a){return new Ec(t,r,n,o,s,i,a)}constructor(t,r,n,o,s,i,a){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(H.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},Bt.isRequired(t,"connection"),Bt.isRequired(r,"logger"),Bt.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=s??s_,this.keepAliveIntervalInMilliseconds=i??i_,this._statefulReconnectBufferSize=a??a_,this._logger=r,this._protocol=n,this.connection=t,this._reconnectPolicy=o,this._handshakeProtocol=new t_,this.connection.onreceive=c=>this._processIncomingData(c),this.connection.onclose=c=>this._connectionClosed(c),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=bt.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:$e.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(t){if(this._connectionState!==bt.Disconnected&&this._connectionState!==bt.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!t)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=t}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}async _startWithStateTransitions(){if(this._connectionState!==bt.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=bt.Connecting,this._logger.log(H.Debug,"Starting HubConnection.");try{await this._startInternal(),Dt.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=bt.Connected,this._connectionStarted=!0,this._logger.log(H.Debug,"HubConnection connected successfully.")}catch(t){return this._connectionState=bt.Disconnected,this._logger.log(H.Debug,`HubConnection failed to start successfully because of error '${t}'.`),Promise.reject(t)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;const t=new Promise((r,n)=>{this._handshakeResolver=r,this._handshakeRejecter=n});await this.connection.start(this._protocol.transferFormat);try{let r=this._protocol.version;this.connection.features.reconnect||(r=1);const n={protocol:this._protocol.name,version:r};if(this._logger.log(H.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(n)),this._logger.log(H.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await t,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new n_(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(r){throw this._logger.log(H.Debug,`Hub handshake failed with error '${r}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(r),r}}async stop(){const t=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await t}catch{}}_stopInternal(t){if(this._connectionState===bt.Disconnected)return this._logger.log(H.Debug,`Call to HubConnection.stop(${t}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===bt.Disconnecting)return this._logger.log(H.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;const r=this._connectionState;return this._connectionState=bt.Disconnecting,this._logger.log(H.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(H.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(r===bt.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=t||new Ar("The connection was stopped before the hub handshake could complete."),this.connection.stop(t))}async _sendCloseMessage(){try{await this._sendWithProtocol(this._createCloseMessage())}catch{}}stream(t,...r){const[n,o]=this._replaceStreamingParams(r),s=this._createStreamInvocation(t,r,o);let i;const a=new r_;return a.cancelCallback=()=>{const c=this._createCancelInvocation(s.invocationId);return delete this._callbacks[s.invocationId],i.then(()=>this._sendWithProtocol(c))},this._callbacks[s.invocationId]=(c,l)=>{if(l){a.error(l);return}else c&&(c.type===$e.Completion?c.error?a.error(new Error(c.error)):a.complete():a.next(c.item))},i=this._sendWithProtocol(s).catch(c=>{a.error(c),delete this._callbacks[s.invocationId]}),this._launchStreams(n,i),a}_sendMessage(t){return this._resetKeepAliveInterval(),this.connection.send(t)}_sendWithProtocol(t){return this._messageBuffer?this._messageBuffer._send(t):this._sendMessage(this._protocol.writeMessage(t))}send(t,...r){const[n,o]=this._replaceStreamingParams(r),s=this._sendWithProtocol(this._createInvocation(t,r,!0,o));return this._launchStreams(n,s),s}invoke(t,...r){const[n,o]=this._replaceStreamingParams(r),s=this._createInvocation(t,r,!1,o);return new Promise((a,c)=>{this._callbacks[s.invocationId]=(d,f)=>{if(f){c(f);return}else d&&(d.type===$e.Completion?d.error?c(new Error(d.error)):a(d.result):c(new Error(`Unexpected message type: ${d.type}`)))};const l=this._sendWithProtocol(s).catch(d=>{c(d),delete this._callbacks[s.invocationId]});this._launchStreams(n,l)})}on(t,r){!t||!r||(t=t.toLowerCase(),this._methods[t]||(this._methods[t]=[]),this._methods[t].indexOf(r)===-1&&this._methods[t].push(r))}off(t,r){if(!t)return;t=t.toLowerCase();const n=this._methods[t];if(n)if(r){const o=n.indexOf(r);o!==-1&&(n.splice(o,1),n.length===0&&delete this._methods[t])}else delete this._methods[t]}onclose(t){t&&this._closedCallbacks.push(t)}onreconnecting(t){t&&this._reconnectingCallbacks.push(t)}onreconnected(t){t&&this._reconnectedCallbacks.push(t)}_processIncomingData(t){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(t=this._processHandshakeResponse(t),this._receivedHandshakeResponse=!0),t){const r=this._protocol.parseMessages(t,this._logger);for(const n of r)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(n)))switch(n.type){case $e.Invocation:this._invokeClientMethod(n).catch(o=>{this._logger.log(H.Error,`Invoke client method threw error: ${Cc(o)}`)});break;case $e.StreamItem:case $e.Completion:{const o=this._callbacks[n.invocationId];if(o){n.type===$e.Completion&&delete this._callbacks[n.invocationId];try{o(n)}catch(s){this._logger.log(H.Error,`Stream callback threw error: ${Cc(s)}`)}}break}case $e.Ping:break;case $e.Close:{this._logger.log(H.Information,"Close message received from server.");const o=n.error?new Error("Server returned an error on close: "+n.error):void 0;n.allowReconnect===!0?this.connection.stop(o):this._stopPromise=this._stopInternal(o);break}case $e.Ack:this._messageBuffer&&this._messageBuffer._ack(n);break;case $e.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(n);break;default:this._logger.log(H.Warning,`Invalid message type: ${n.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(t){let r,n;try{[n,r]=this._handshakeProtocol.parseHandshakeResponse(t)}catch(o){const s="Error parsing handshake response: "+o;this._logger.log(H.Error,s);const i=new Error(s);throw this._handshakeRejecter(i),i}if(r.error){const o="Server returned handshake error: "+r.error;this._logger.log(H.Error,o);const s=new Error(o);throw this._handshakeRejecter(s),s}else this._logger.log(H.Debug,"Server handshake complete.");return this._handshakeResolver(),n}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if(!this.connection.features||!this.connection.features.inherentKeepAlive){this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds);let t=this._nextKeepAlive-new Date().getTime();if(t<0){this._connectionState===bt.Connected&&this._trySendPingMessage();return}this._pingServerHandle===void 0&&(t<0&&(t=0),this._pingServerHandle=setTimeout(async()=>{this._connectionState===bt.Connected&&await this._trySendPingMessage()},t))}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(t){const r=t.target.toLowerCase(),n=this._methods[r];if(!n){this._logger.log(H.Warning,`No client method with the name '${r}' found.`),t.invocationId&&(this._logger.log(H.Warning,`No result given for '${r}' method and invocation ID '${t.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(t.invocationId,"Client didn't provide a result.",null)));return}const o=n.slice(),s=!!t.invocationId;let i,a,c;for(const l of o)try{const d=i;i=await l.apply(this,t.arguments),s&&i&&d&&(this._logger.log(H.Error,`Multiple results provided for '${r}'. Sending error to server.`),c=this._createCompletionMessage(t.invocationId,"Client provided multiple results.",null)),a=void 0}catch(d){a=d,this._logger.log(H.Error,`A callback for the method '${r}' threw error '${d}'.`)}c?await this._sendWithProtocol(c):s?(a?c=this._createCompletionMessage(t.invocationId,`${a}`,null):i!==void 0?c=this._createCompletionMessage(t.invocationId,null,i):(this._logger.log(H.Warning,`No result given for '${r}' method and invocation ID '${t.invocationId}'.`),c=this._createCompletionMessage(t.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(c)):i&&this._logger.log(H.Error,`Result given for '${r}' method but server is not expecting a result.`)}_connectionClosed(t){this._logger.log(H.Debug,`HubConnection.connectionClosed(${t}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||t||new Ar("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(t||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===bt.Disconnecting?this._completeClose(t):this._connectionState===bt.Connected&&this._reconnectPolicy?this._reconnect(t):this._connectionState===bt.Connected&&this._completeClose(t)}_completeClose(t){if(this._connectionStarted){this._connectionState=bt.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(t??new Error("Connection closed.")),this._messageBuffer=void 0),Dt.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(r=>r.apply(this,[t]))}catch(r){this._logger.log(H.Error,`An onclose callback called with error '${t}' threw error '${r}'.`)}}}async _reconnect(t){const r=Date.now();let n=0,o=t!==void 0?t:new Error("Attempting to reconnect due to a unknown error."),s=this._getNextRetryDelay(n,0,o);if(s===null){this._logger.log(H.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(t);return}if(this._connectionState=bt.Reconnecting,t?this._logger.log(H.Information,`Connection reconnecting because of error '${t}'.`):this._logger.log(H.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(i=>i.apply(this,[t]))}catch(i){this._logger.log(H.Error,`An onreconnecting callback called with error '${t}' threw error '${i}'.`)}if(this._connectionState!==bt.Reconnecting){this._logger.log(H.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;s!==null;){if(this._logger.log(H.Information,`Reconnect attempt number ${n+1} will start in ${s} ms.`),await new Promise(i=>{this._reconnectDelayHandle=setTimeout(i,s)}),this._reconnectDelayHandle=void 0,this._connectionState!==bt.Reconnecting){this._logger.log(H.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(await this._startInternal(),this._connectionState=bt.Connected,this._logger.log(H.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(i=>i.apply(this,[this.connection.connectionId]))}catch(i){this._logger.log(H.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${i}'.`)}return}catch(i){if(this._logger.log(H.Information,`Reconnect attempt failed because of error '${i}'.`),this._connectionState!==bt.Reconnecting){this._logger.log(H.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===bt.Disconnecting&&this._completeClose();return}n++,o=i instanceof Error?i:new Error(i.toString()),s=this._getNextRetryDelay(n,Date.now()-r,o)}}this._logger.log(H.Information,`Reconnect retries have been exhausted after ${Date.now()-r} ms and ${n} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(t,r,n){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:r,previousRetryCount:t,retryReason:n})}catch(o){return this._logger.log(H.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${t}, ${r}) threw error '${o}'.`),null}}_cancelCallbacksWithError(t){const r=this._callbacks;this._callbacks={},Object.keys(r).forEach(n=>{const o=r[n];try{o(null,t)}catch(s){this._logger.log(H.Error,`Stream 'error' callback called with '${t}' threw error: ${Cc(s)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(t,r,n,o){if(n)return o.length!==0?{target:t,arguments:r,streamIds:o,type:$e.Invocation}:{target:t,arguments:r,type:$e.Invocation};{const s=this._invocationId;return this._invocationId++,o.length!==0?{target:t,arguments:r,invocationId:s.toString(),streamIds:o,type:$e.Invocation}:{target:t,arguments:r,invocationId:s.toString(),type:$e.Invocation}}}_launchStreams(t,r){if(t.length!==0){r||(r=Promise.resolve());for(const n in t)t[n].subscribe({complete:()=>{r=r.then(()=>this._sendWithProtocol(this._createCompletionMessage(n)))},error:o=>{let s;o instanceof Error?s=o.message:o&&o.toString?s=o.toString():s="Unknown error",r=r.then(()=>this._sendWithProtocol(this._createCompletionMessage(n,s)))},next:o=>{r=r.then(()=>this._sendWithProtocol(this._createStreamItemMessage(n,o)))}})}}_replaceStreamingParams(t){const r=[],n=[];for(let o=0;o<t.length;o++){const s=t[o];if(this._isObservable(s)){const i=this._invocationId;this._invocationId++,r[i]=s,n.push(i.toString()),t.splice(o,1)}}return[r,n]}_isObservable(t){return t&&t.subscribe&&typeof t.subscribe=="function"}_createStreamInvocation(t,r,n){const o=this._invocationId;return this._invocationId++,n.length!==0?{target:t,arguments:r,invocationId:o.toString(),streamIds:n,type:$e.StreamInvocation}:{target:t,arguments:r,invocationId:o.toString(),type:$e.StreamInvocation}}_createCancelInvocation(t){return{invocationId:t,type:$e.CancelInvocation}}_createStreamItemMessage(t,r){return{invocationId:t,item:r,type:$e.StreamItem}}_createCompletionMessage(t,r,n){return r?{error:r,invocationId:t,type:$e.Completion}:{invocationId:t,result:n,type:$e.Completion}}_createCloseMessage(){return{type:$e.Close}}async _trySendPingMessage(){try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}}}const c_=[0,2e3,1e4,3e4,null];class Zf{constructor(t){this._retryDelays=t!==void 0?[...t,null]:c_}nextRetryDelayInMilliseconds(t){return this._retryDelays[t.previousRetryCount]}}class Sn{}Sn.Authorization="Authorization",Sn.Cookie="Cookie";class l_ extends Mi{constructor(t,r){super(),this._innerClient=t,this._accessTokenFactory=r}async send(t){let r=!0;this._accessTokenFactory&&(!this._accessToken||t.url&&t.url.indexOf("/negotiate?")>0)&&(r=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(t);const n=await this._innerClient.send(t);return r&&n.statusCode===401&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(t),await this._innerClient.send(t)):n}_setAuthorizationHeader(t){t.headers||(t.headers={}),this._accessToken?t.headers[Sn.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&t.headers[Sn.Authorization]&&delete t.headers[Sn.Authorization]}getCookieString(t){return this._innerClient.getCookieString(t)}}var Wt;(function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"})(Wt||(Wt={}));var Jt;(function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"})(Jt||(Jt={}));let u_=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};class Gf{get pollAborted(){return this._pollAbort.aborted}constructor(t,r,n){this._httpClient=t,this._logger=r,this._pollAbort=new u_,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}async connect(t,r){if(Bt.isRequired(t,"url"),Bt.isRequired(r,"transferFormat"),Bt.isIn(r,Jt,"transferFormat"),this._url=t,this._logger.log(H.Trace,"(LongPolling transport) Connecting."),r===Jt.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[n,o]=Zn(),s={[n]:o,...this._options.headers},i={abortSignal:this._pollAbort.signal,headers:s,timeout:1e5,withCredentials:this._options.withCredentials};r===Jt.Binary&&(i.responseType="arraybuffer");const a=`${t}&_=${Date.now()}`;this._logger.log(H.Trace,`(LongPolling transport) polling: ${a}.`);const c=await this._httpClient.get(a,i);c.statusCode!==200?(this._logger.log(H.Error,`(LongPolling transport) Unexpected response code: ${c.statusCode}.`),this._closeError=new _n(c.statusText||"",c.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,i)}async _poll(t,r){try{for(;this._running;)try{const n=`${t}&_=${Date.now()}`;this._logger.log(H.Trace,`(LongPolling transport) polling: ${n}.`);const o=await this._httpClient.get(n,r);o.statusCode===204?(this._logger.log(H.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):o.statusCode!==200?(this._logger.log(H.Error,`(LongPolling transport) Unexpected response code: ${o.statusCode}.`),this._closeError=new _n(o.statusText||"",o.statusCode),this._running=!1):o.content?(this._logger.log(H.Trace,`(LongPolling transport) data received. ${No(o.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(o.content)):this._logger.log(H.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(n){this._running?n instanceof Sc?this._logger.log(H.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=n,this._running=!1):this._logger.log(H.Trace,`(LongPolling transport) Poll errored after shutdown: ${n.message}`)}}finally{this._logger.log(H.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(t){return this._running?Yf(this._logger,"LongPolling",this._httpClient,this._url,t,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(H.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(H.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const t={},[r,n]=Zn();t[r]=n;const o={headers:{...t,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};let s;try{await this._httpClient.delete(this._url,o)}catch(i){s=i}s?s instanceof _n&&(s.statusCode===404?this._logger.log(H.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(H.Trace,`(LongPolling transport) Error sending a DELETE request: ${s}`)):this._logger.log(H.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(H.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let t="(LongPolling transport) Firing onclose event.";this._closeError&&(t+=" Error: "+this._closeError),this._logger.log(H.Trace,t),this.onclose(this._closeError)}}}class d_{constructor(t,r,n,o){this._httpClient=t,this._accessToken=r,this._logger=n,this._options=o,this.onreceive=null,this.onclose=null}async connect(t,r){return Bt.isRequired(t,"url"),Bt.isRequired(r,"transferFormat"),Bt.isIn(r,Jt,"transferFormat"),this._logger.log(H.Trace,"(SSE transport) Connecting."),this._url=t,this._accessToken&&(t+=(t.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((n,o)=>{let s=!1;if(r!==Jt.Text){o(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let i;if(Dt.isBrowser||Dt.isWebWorker)i=new this._options.EventSource(t,{withCredentials:this._options.withCredentials});else{const a=this._httpClient.getCookieString(t),c={};c.Cookie=a;const[l,d]=Zn();c[l]=d,i=new this._options.EventSource(t,{withCredentials:this._options.withCredentials,headers:{...c,...this._options.headers}})}try{i.onmessage=a=>{if(this.onreceive)try{this._logger.log(H.Trace,`(SSE transport) data received. ${No(a.data,this._options.logMessageContent)}.`),this.onreceive(a.data)}catch(c){this._close(c);return}},i.onerror=a=>{s?this._close():o(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},i.onopen=()=>{this._logger.log(H.Information,`SSE connected to ${this._url}`),this._eventSource=i,s=!0,n()}}catch(a){o(a);return}})}async send(t){return this._eventSource?Yf(this._logger,"SSE",this._httpClient,this._url,t,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(t){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(t))}}class f_{constructor(t,r,n,o,s,i){this._logger=n,this._accessTokenFactory=r,this._logMessageContent=o,this._webSocketConstructor=s,this._httpClient=t,this.onreceive=null,this.onclose=null,this._headers=i}async connect(t,r){Bt.isRequired(t,"url"),Bt.isRequired(r,"transferFormat"),Bt.isIn(r,Jt,"transferFormat"),this._logger.log(H.Trace,"(WebSockets transport) Connecting.");let n;return this._accessTokenFactory&&(n=await this._accessTokenFactory()),new Promise((o,s)=>{t=t.replace(/^http/,"ws");let i;const a=this._httpClient.getCookieString(t);let c=!1;if(Dt.isNode||Dt.isReactNative){const l={},[d,f]=Zn();l[d]=f,n&&(l[Sn.Authorization]=`Bearer ${n}`),a&&(l[Sn.Cookie]=a),i=new this._webSocketConstructor(t,void 0,{headers:{...l,...this._headers}})}else n&&(t+=(t.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(n)}`);i||(i=new this._webSocketConstructor(t)),r===Jt.Binary&&(i.binaryType="arraybuffer"),i.onopen=l=>{this._logger.log(H.Information,`WebSocket connected to ${t}.`),this._webSocket=i,c=!0,o()},i.onerror=l=>{let d=null;typeof ErrorEvent<"u"&&l instanceof ErrorEvent?d=l.error:d="There was an error with the transport",this._logger.log(H.Information,`(WebSockets transport) ${d}.`)},i.onmessage=l=>{if(this._logger.log(H.Trace,`(WebSockets transport) data received. ${No(l.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(l.data)}catch(d){this._close(d);return}},i.onclose=l=>{if(c)this._close(l);else{let d=null;typeof ErrorEvent<"u"&&l instanceof ErrorEvent?d=l.error:d="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",s(new Error(d))}}})}send(t){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(H.Trace,`(WebSockets transport) sending data. ${No(t,this._logMessageContent)}.`),this._webSocket.send(t),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(t){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(H.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(t)&&(t.wasClean===!1||t.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${t.code} (${t.reason||"no reason given"}).`)):t instanceof Error?this.onclose(t):this.onclose())}_isCloseEvent(t){return t&&typeof t.wasClean=="boolean"&&typeof t.code=="number"}}const Kf=100;class p_{constructor(t,r={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,Bt.isRequired(t,"url"),this._logger=Vx(r.logger),this.baseUrl=this._resolveUrl(t),r=r||{},r.logMessageContent=r.logMessageContent===void 0?!1:r.logMessageContent,typeof r.withCredentials=="boolean"||r.withCredentials===void 0)r.withCredentials=r.withCredentials===void 0?!0:r.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");r.timeout=r.timeout===void 0?100*1e3:r.timeout;let n=null,o=null;if(Dt.isNode&&typeof require<"u"){const s=typeof __webpack_require__=="function"?__non_webpack_require__:require;n=s("ws"),o=s("eventsource")}!Dt.isNode&&typeof WebSocket<"u"&&!r.WebSocket?r.WebSocket=WebSocket:Dt.isNode&&!r.WebSocket&&n&&(r.WebSocket=n),!Dt.isNode&&typeof EventSource<"u"&&!r.EventSource?r.EventSource=EventSource:Dt.isNode&&!r.EventSource&&typeof o<"u"&&(r.EventSource=o),this._httpClient=new l_(r.httpClient||new e_(this._logger),r.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=r,this.onreceive=null,this.onclose=null}async start(t){if(t=t||Jt.Binary,Bt.isIn(t,Jt,"transferFormat"),this._logger.log(H.Debug,`Starting connection with transfer format '${Jt[t]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(t),await this._startInternalPromise,this._connectionState==="Disconnecting"){const r="Failed to start the HttpConnection before stop() was called.";return this._logger.log(H.Error,r),await this._stopPromise,Promise.reject(new Ar(r))}else if(this._connectionState!=="Connected"){const r="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(H.Error,r),Promise.reject(new Ar(r))}this._connectionStarted=!0}send(t){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new Dc(this.transport)),this._sendQueue.send(t))}async stop(t){if(this._connectionState==="Disconnected")return this._logger.log(H.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(H.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(r=>{this._stopPromiseResolver=r}),await this._stopInternal(t),await this._stopPromise}async _stopInternal(t){this._stopError=t;try{await this._startInternalPromise}catch{}if(this.transport){try{await this.transport.stop()}catch(r){this._logger.log(H.Error,`HttpConnection.transport.stop() threw error '${r}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(H.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(t){let r=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===Wt.WebSockets)this.transport=this._constructTransport(Wt.WebSockets),await this._startTransport(r,t);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let n=null,o=0;do{if(n=await this._getNegotiationResponse(r),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new Ar("The connection was stopped during negotiation.");if(n.error)throw new Error(n.error);if(n.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(n.url&&(r=n.url),n.accessToken){const s=n.accessToken;this._accessTokenFactory=()=>s,this._httpClient._accessToken=s,this._httpClient._accessTokenFactory=void 0}o++}while(n.url&&o<Kf);if(o===Kf&&n.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(r,this._options.transport,n,t)}this.transport instanceof Gf&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(H.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(n){return this._logger.log(H.Error,"Failed to start the connection: "+n),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(n)}}async _getNegotiationResponse(t){const r={},[n,o]=Zn();r[n]=o;const s=this._resolveNegotiateUrl(t);this._logger.log(H.Debug,`Sending negotiation request: ${s}.`);try{const i=await this._httpClient.post(s,{content:"",headers:{...r,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(i.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${i.statusCode}'`));const a=JSON.parse(i.content);return(!a.negotiateVersion||a.negotiateVersion<1)&&(a.connectionToken=a.connectionId),a.useStatefulReconnect&&this._options._useStatefulReconnect!==!0?Promise.reject(new Hf("Client didn't negotiate Stateful Reconnect but the server did.")):a}catch(i){let a="Failed to complete negotiation with the server: "+i;return i instanceof _n&&i.statusCode===404&&(a=a+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(H.Error,a),Promise.reject(new Hf(a))}}_createConnectUrl(t,r){return r?t+(t.indexOf("?")===-1?"?":"&")+`id=${r}`:t}async _createTransport(t,r,n,o){let s=this._createConnectUrl(t,n.connectionToken);if(this._isITransport(r)){this._logger.log(H.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=r,await this._startTransport(s,o),this.connectionId=n.connectionId;return}const i=[],a=n.availableTransports||[];let c=n;for(const l of a){const d=this._resolveTransportOrError(l,r,o,c?.useStatefulReconnect===!0);if(d instanceof Error)i.push(`${l.transport} failed:`),i.push(d);else if(this._isITransport(d)){if(this.transport=d,!c){try{c=await this._getNegotiationResponse(t)}catch(f){return Promise.reject(f)}s=this._createConnectUrl(t,c.connectionToken)}try{await this._startTransport(s,o),this.connectionId=c.connectionId;return}catch(f){if(this._logger.log(H.Error,`Failed to start the transport '${l.transport}': ${f}`),c=void 0,i.push(new Fx(`${l.transport} failed: ${f}`,Wt[l.transport])),this._connectionState!=="Connecting"){const h="Failed to select transport before stop() was called.";return this._logger.log(H.Debug,h),Promise.reject(new Ar(h))}}}}return i.length>0?Promise.reject(new Wx(`Unable to connect to the server with any of the available transports. ${i.join(" ")}`,i)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(t){switch(t){case Wt.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new f_(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case Wt.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new d_(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case Wt.LongPolling:return new Gf(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${t}.`)}}_startTransport(t,r){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async n=>{let o=!1;if(this.features.reconnect)try{this.features.disconnected(),await this.transport.connect(t,r),await this.features.resend()}catch{o=!0}else{this._stopConnection(n);return}o&&this._stopConnection(n)}:this.transport.onclose=n=>this._stopConnection(n),this.transport.connect(t,r)}_resolveTransportOrError(t,r,n,o){const s=Wt[t.transport];if(s==null)return this._logger.log(H.Debug,`Skipping transport '${t.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${t.transport}' because it is not supported by this client.`);if(h_(r,s))if(t.transferFormats.map(a=>Jt[a]).indexOf(n)>=0){if(s===Wt.WebSockets&&!this._options.WebSocket||s===Wt.ServerSentEvents&&!this._options.EventSource)return this._logger.log(H.Debug,`Skipping transport '${Wt[s]}' because it is not supported in your environment.'`),new zx(`'${Wt[s]}' is not supported in your environment.`,s);this._logger.log(H.Debug,`Selecting transport '${Wt[s]}'.`);try{return this.features.reconnect=s===Wt.WebSockets?o:void 0,this._constructTransport(s)}catch(a){return a}}else return this._logger.log(H.Debug,`Skipping transport '${Wt[s]}' because it does not support the requested transfer format '${Jt[n]}'.`),new Error(`'${Wt[s]}' does not support ${Jt[n]}.`);else return this._logger.log(H.Debug,`Skipping transport '${Wt[s]}' because it was disabled by the client.`),new Bx(`'${Wt[s]}' is disabled by the client.`,s)}_isITransport(t){return t&&typeof t=="object"&&"connect"in t}_stopConnection(t){if(this._logger.log(H.Debug,`HttpConnection.stopConnection(${t}) called while in state ${this._connectionState}.`),this.transport=void 0,t=this._stopError||t,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(H.Debug,`Call to HttpConnection.stopConnection(${t}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(H.Warning,`Call to HttpConnection.stopConnection(${t}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${t}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),t?this._logger.log(H.Error,`Connection disconnected with error '${t}'.`):this._logger.log(H.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(r=>{this._logger.log(H.Error,`TransportSendQueue.stop() threw error '${r}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(t)}catch(r){this._logger.log(H.Error,`HttpConnection.onclose(${t}) threw error '${r}'.`)}}}_resolveUrl(t){if(t.lastIndexOf("https://",0)===0||t.lastIndexOf("http://",0)===0)return t;if(!Dt.isBrowser)throw new Error(`Cannot resolve '${t}'.`);const r=window.document.createElement("a");return r.href=t,this._logger.log(H.Information,`Normalizing '${t}' to '${r.href}'.`),r.href}_resolveNegotiateUrl(t){const r=new URL(t);r.pathname.endsWith("/")?r.pathname+="negotiate":r.pathname+="/negotiate";const n=new URLSearchParams(r.searchParams);return n.has("negotiateVersion")||n.append("negotiateVersion",this._negotiateVersion.toString()),n.has("useStatefulReconnect")?n.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&n.append("useStatefulReconnect","true"),r.search=n.toString(),r.toString()}}function h_(e,t){return!e||(t&e)!==0}class Dc{constructor(t){this._transport=t,this._buffer=[],this._executing=!0,this._sendBufferedData=new Oi,this._transportResult=new Oi,this._sendLoopPromise=this._sendLoop()}send(t){return this._bufferData(t),this._transportResult||(this._transportResult=new Oi),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(t){if(this._buffer.length&&typeof this._buffer[0]!=typeof t)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof t}`);this._buffer.push(t),this._sendBufferedData.resolve()}async _sendLoop(){for(;;){if(await this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new Oi;const t=this._transportResult;this._transportResult=void 0;const r=typeof this._buffer[0]=="string"?this._buffer.join(""):Dc._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(r),t.resolve()}catch(n){t.reject(n)}}}static _concatBuffers(t){const r=t.map(s=>s.byteLength).reduce((s,i)=>s+i),n=new Uint8Array(r);let o=0;for(const s of t)n.set(new Uint8Array(s),o),o+=s.byteLength;return n.buffer}}class Oi{constructor(){this.promise=new Promise((t,r)=>[this._resolver,this._rejecter]=[t,r])}resolve(){this._resolver()}reject(t){this._rejecter(t)}}const m_="json";class g_{constructor(){this.name=m_,this.version=2,this.transferFormat=Jt.Text}parseMessages(t,r){if(typeof t!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!t)return[];r===null&&(r=Ro.instance);const n=fr.parse(t),o=[];for(const s of n){const i=JSON.parse(s);if(typeof i.type!="number")throw new Error("Invalid payload.");switch(i.type){case $e.Invocation:this._isInvocationMessage(i);break;case $e.StreamItem:this._isStreamItemMessage(i);break;case $e.Completion:this._isCompletionMessage(i);break;case $e.Ping:break;case $e.Close:break;case $e.Ack:this._isAckMessage(i);break;case $e.Sequence:this._isSequenceMessage(i);break;default:r.log(H.Information,"Unknown message type '"+i.type+"' ignored.");continue}o.push(i)}return o}writeMessage(t){return fr.write(JSON.stringify(t))}_isInvocationMessage(t){this._assertNotEmptyString(t.target,"Invalid payload for Invocation message."),t.invocationId!==void 0&&this._assertNotEmptyString(t.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(t){if(this._assertNotEmptyString(t.invocationId,"Invalid payload for StreamItem message."),t.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(t){if(t.result&&t.error)throw new Error("Invalid payload for Completion message.");!t.result&&t.error&&this._assertNotEmptyString(t.error,"Invalid payload for Completion message."),this._assertNotEmptyString(t.invocationId,"Invalid payload for Completion message.")}_isAckMessage(t){if(typeof t.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(t){if(typeof t.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(t,r){if(typeof t!="string"||t==="")throw new Error(r)}}const v_={trace:H.Trace,debug:H.Debug,info:H.Information,information:H.Information,warn:H.Warning,warning:H.Warning,error:H.Error,critical:H.Critical,none:H.None};function y_(e){const t=v_[e.toLowerCase()];if(typeof t<"u")return t;throw new Error(`Unknown log level: ${e}`)}class b_{configureLogging(t){if(Bt.isRequired(t,"logging"),x_(t))this.logger=t;else if(typeof t=="string"){const r=y_(t);this.logger=new Pi(r)}else this.logger=new Pi(t);return this}withUrl(t,r){return Bt.isRequired(t,"url"),Bt.isNotEmpty(t,"url"),this.url=t,typeof r=="object"?this.httpConnectionOptions={...this.httpConnectionOptions,...r}:this.httpConnectionOptions={...this.httpConnectionOptions,transport:r},this}withHubProtocol(t){return Bt.isRequired(t,"protocol"),this.protocol=t,this}withAutomaticReconnect(t){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return t?Array.isArray(t)?this.reconnectPolicy=new Zf(t):this.reconnectPolicy=t:this.reconnectPolicy=new Zf,this}withServerTimeout(t){return Bt.isRequired(t,"milliseconds"),this._serverTimeoutInMilliseconds=t,this}withKeepAliveInterval(t){return Bt.isRequired(t,"milliseconds"),this._keepAliveIntervalInMilliseconds=t,this}withStatefulReconnect(t){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=t?.bufferSize,this}build(){const t=this.httpConnectionOptions||{};if(t.logger===void 0&&(t.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const r=new p_(this.url,t);return Ec.create(r,this.logger||Ro.instance,this.protocol||new g_,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}}function x_(e){return e.log!==void 0}var $o={},Qf;function __(){if(Qf)return $o;Qf=1;var e=at();Object.defineProperty($o,"__esModule",{value:!0}),$o.default=void 0;var t=e(ht()),r=ut();return $o.default=(0,t.default)((0,r.jsx)("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}),"Check"),$o}var w_=__();const Xf=it(w_);var Lo={},Jf;function S_(){if(Jf)return Lo;Jf=1;var e=at();Object.defineProperty(Lo,"__esModule",{value:!0}),Lo.default=void 0;var t=e(ht()),r=ut();return Lo.default=(0,t.default)((0,r.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"}),"Close"),Lo}var C_=S_();const Ur=it(C_);function kc(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}function zo(e){return(t,r)=>{const n=r?.context?String(r.context):"standalone";let o;if(n==="formatting"&&e.formattingValues){const i=e.defaultFormattingWidth||e.defaultWidth,a=r?.width?String(r.width):i;o=e.formattingValues[a]||e.formattingValues[i]}else{const i=e.defaultWidth,a=r?.width?String(r.width):e.defaultWidth;o=e.values[a]||e.values[i]}const s=e.argumentCallback?e.argumentCallback(t):t;return o[s]}}function Bo(e){return(t,r={})=>{const n=r.width,o=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],s=t.match(o);if(!s)return null;const i=s[0],a=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(a)?D_(a,f=>f.test(i)):E_(a,f=>f.test(i));let l;l=e.valueCallback?e.valueCallback(c):c,l=r.valueCallback?r.valueCallback(l):l;const d=t.slice(i.length);return{value:l,rest:d}}}function E_(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}function D_(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r}function k_(e){return(t,r={})=>{const n=t.match(e.matchPattern);if(!n)return null;const o=n[0],s=t.match(e.parsePattern);if(!s)return null;let i=e.valueCallback?e.valueCallback(s[0]):s[0];i=r.valueCallback?r.valueCallback(i):i;const a=t.slice(o.length);return{value:i,rest:a}}}function A_(e,...t){const r=ic.bind(null,t.find(n=>typeof n=="object"));return t.map(r)}const T_={lessThanXSeconds:{one:"menos de un segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"medio minuto",lessThanXMinutes:{one:"menos de un minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"alrededor de 1 hora",other:"alrededor de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 día",other:"{{count}} días"},aboutXWeeks:{one:"alrededor de 1 semana",other:"alrededor de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"alrededor de 1 mes",other:"alrededor de {{count}} meses"},xMonths:{one:"1 mes",other:"{{count}} meses"},aboutXYears:{one:"alrededor de 1 año",other:"alrededor de {{count}} años"},xYears:{one:"1 año",other:"{{count}} años"},overXYears:{one:"más de 1 año",other:"más de {{count}} años"},almostXYears:{one:"casi 1 año",other:"casi {{count}} años"}},I_=(e,t,r)=>{let n;const o=T_[e];return typeof o=="string"?n=o:t===1?n=o.one:n=o.other.replace("{{count}}",t.toString()),r?.addSuffix?r.comparison&&r.comparison>0?"en "+n:"hace "+n:n},M_={full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/y"},P_={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},O_={full:"{{date}} 'a las' {{time}}",long:"{{date}} 'a las' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},j_={date:kc({formats:M_,defaultWidth:"full"}),time:kc({formats:P_,defaultWidth:"full"}),dateTime:kc({formats:O_,defaultWidth:"full"})},R_={lastWeek:"'el' eeee 'pasado a la' p",yesterday:"'ayer a la' p",today:"'hoy a la' p",tomorrow:"'mañana a la' p",nextWeek:"eeee 'a la' p",other:"P"},N_={lastWeek:"'el' eeee 'pasado a las' p",yesterday:"'ayer a las' p",today:"'hoy a las' p",tomorrow:"'mañana a las' p",nextWeek:"eeee 'a las' p",other:"P"},$_=(e,t,r,n)=>t.getHours()!==1?N_[e]:R_[e],L_={narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","después de cristo"]},z_={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},B_={narrow:["e","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"],wide:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"]},F_={narrow:["d","l","m","m","j","v","s"],short:["do","lu","ma","mi","ju","vi","sá"],abbreviated:["dom","lun","mar","mié","jue","vie","sáb"],wide:["domingo","lunes","martes","miércoles","jueves","viernes","sábado"]},W_={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"}},U_={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"}},H_={ordinalNumber:(e,t)=>Number(e)+"º",era:zo({values:L_,defaultWidth:"wide"}),quarter:zo({values:z_,defaultWidth:"wide",argumentCallback:e=>Number(e)-1}),month:zo({values:B_,defaultWidth:"wide"}),day:zo({values:F_,defaultWidth:"wide"}),dayPeriod:zo({values:W_,defaultWidth:"wide",formattingValues:U_,defaultFormattingWidth:"wide"})},V_=/^(\d+)(º)?/i,Y_=/\d+/i,q_={narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,wide:/^(antes de cristo|antes de la era com[uú]n|despu[eé]s de cristo|era com[uú]n)/i},Z_={any:[/^ac/i,/^dc/i],wide:[/^(antes de cristo|antes de la era com[uú]n)/i,/^(despu[eé]s de cristo|era com[uú]n)/i]},G_={narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},K_={any:[/1/i,/2/i,/3/i,/4/i]},Q_={narrow:/^[efmajsond]/i,abbreviated:/^(ene|feb|mar|abr|may|jun|jul|ago|sep|oct|nov|dic)/i,wide:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i},X_={narrow:[/^e/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^en/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i]},J_={narrow:/^[dlmjvs]/i,short:/^(do|lu|ma|mi|ju|vi|s[áa])/i,abbreviated:/^(dom|lun|mar|mi[ée]|jue|vie|s[áa]b)/i,wide:/^(domingo|lunes|martes|mi[ée]rcoles|jueves|viernes|s[áa]bado)/i},ew={narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^do/i,/^lu/i,/^ma/i,/^mi/i,/^ju/i,/^vi/i,/^sa/i]},tw={narrow:/^(a|p|mn|md|(de la|a las) (mañana|tarde|noche))/i,any:/^([ap]\.?\s?m\.?|medianoche|mediodia|(de la|a las) (mañana|tarde|noche))/i},rw={any:{am:/^a/i,pm:/^p/i,midnight:/^mn/i,noon:/^md/i,morning:/mañana/i,afternoon:/tarde/i,evening:/tarde/i,night:/noche/i}},nw={ordinalNumber:k_({matchPattern:V_,parsePattern:Y_,valueCallback:function(e){return parseInt(e,10)}}),era:Bo({matchPatterns:q_,defaultMatchWidth:"wide",parsePatterns:Z_,defaultParseWidth:"any"}),quarter:Bo({matchPatterns:G_,defaultMatchWidth:"wide",parsePatterns:K_,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Bo({matchPatterns:Q_,defaultMatchWidth:"wide",parsePatterns:X_,defaultParseWidth:"any"}),day:Bo({matchPatterns:J_,defaultMatchWidth:"wide",parsePatterns:ew,defaultParseWidth:"any"}),dayPeriod:Bo({matchPatterns:tw,defaultMatchWidth:"any",parsePatterns:rw,defaultParseWidth:"any"})},ow={code:"es",formatDistance:I_,formatLong:j_,formatRelative:$_,localize:H_,match:nw,options:{weekStartsOn:1,firstWeekContainsDate:1}},ep="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAACpQTFRFR3BMcHCAcHBwaGx4ZWp6aG14aG54Zm14aW15aG55aG15aW55aW56aW5591zvEAAAAA10Uk5TABAQIDBBYHCAnr7g7wYb6DAAAACqSURBVHjahZJLDgMhDEM9UL7Ju/91q8KgQhcdb5D8rFiJ0JNC6Qbeczzt6izV8PWjAbiNB4uH35IkpbaRYGBpT9mcVlemtnCTOiLA8BPk+/VPIkPTR/kGalAkdUgnSNAlOegEckwS2C8wOAEWN2D4BC8HH3Xge/naYJUXaJq6Wo+S2iy7HJKW1sbHSc6B0mU7SeOIf8++CJg5nHOvypLXoF0xdwfrJTx9mzdxpgqGKfcyxQAAAABJRU5ErkJggg==",sw="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC4AAAAwCAMAAABZu7juAAAAPFBMVEUAAABobHhobnhpbnlobnhobXhpbnlpbnpobXhwcHNobHhlanlpbnlobnhobnpobXhmbXlocHhpbHZpbnlt0ET4AAAAE3RSTlMAIGDggL/f76AQQDDPsLCQcEBQZL6CzQAAALVJREFUSMft1MsOgyAQhWEGHQa82/P+71rDojhJ6dCNi9ZvZcivQUjGXWeTQHqFJvS1mgDMemkGQJV8AMB6iQHsb9K0RZ4ACCsCYOLoSccrDPH0AgWYAqm6vY9owuVAmgzq46aY84BGknM0S/nqm9Ef5tIZROXeGfyd3/lP5Kk9T+4gAGYrj68pxjiMn2sqI9iX6V0zhtOO8zO4r1k5B8F9NeBH9dsWr/ZmCLs+10VQ1S0Pd4UnLwhFRUE6UNsAAAAASUVORK5CYII=",iw=({notificacion:e,onAccept:t})=>{const{evento:r,tipo:n,leida:o}=e,s=n==="EventoCreado"||n==="EventoModificado",a={EventoCreado:{frase:"te ha invitado a",colorTitulo:"#3c4043"},EventoModificado:{frase:"ha modificado el evento",colorTitulo:"#3c4043"},EventoCancelado:{frase:"ha cancelado el evento",colorTitulo:"#d32f2f"}}[n]||{frase:"te ha notificado sobre",colorTitulo:"#3c4043"},c=r?.fechaInicio?new Date(r.fechaInicio):new Date,l=r?.fechaFin?new Date(r.fechaFin):null,d=r?.nombreAnfitrion||"Usuario",f=e?.titulo||"Sin título",h=v=>v.split(" ").filter(m=>m).map(m=>m[0]).join("").toUpperCase().substring(0,2);return u.jsxs(g.Box,{sx:{p:2,mb:1,bgcolor:"white",borderRadius:"8px",border:"1px solid #e0e0e0",boxShadow:"0 1px 2px rgba(0,0,0,0.05)",position:"relative",overflow:"hidden"},children:[u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",mb:1},children:[u.jsx(g.Avatar,{sx:{bgcolor:"#F5A623",width:34,height:34,fontSize:"14px",mr:1.5,fontWeight:"bold"},children:h(d)}),u.jsxs(g.Box,{children:[u.jsxs(g.Typography,{sx:{fontSize:"14px",color:"#5f6368",lineHeight:1.2},children:[d," ",a.frase]}),u.jsx(g.Typography,{sx:{fontSize:"15px",fontWeight:700,color:a.colorTitulo},children:f})]})]}),u.jsx(g.Divider,{sx:{my:1.5,backgroundColor:"black"}}),u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",mb:0},children:[u.jsx("img",{src:sw,width:20,height:20,alt:"cal",style:{marginRight:15}}),u.jsx(g.Typography,{sx:{fontSize:"14px",color:"#3c4043",textTransform:"capitalize"},children:x.format(c,"EEEE, dd 'de' MMMM",{locale:ow})})]}),u.jsx(g.Divider,{sx:{my:1.5,backgroundColor:"black"}}),u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",mb:s&&!o?2:0},children:[u.jsx("img",{src:ep,width:20,height:20,alt:"watch",style:{marginRight:15}}),u.jsxs(g.Typography,{sx:{fontSize:"14px",color:"#3c4043"},children:[x.format(c,"h:mm a").toLowerCase(),l?` - ${x.format(l,"h:mm a").toLowerCase()}`:""]})]}),s&&!o&&u.jsxs(g.Box,{sx:{display:"flex",gap:1.5,mt:1},children:[u.jsx(g.Button,{variant:"outlined",size:"small",startIcon:u.jsx(Xf,{sx:{fontSize:"16px !important"}}),onClick:()=>t?.(e,"CONFIRMADA"),sx:{flex:1,borderRadius:"8px",textTransform:"none",fontWeight:600,fontSize:"13px",color:"#1976D2",borderColor:"#1976D2",py:.8},children:"Asistiré"}),u.jsx(g.Button,{variant:"outlined",size:"small",startIcon:u.jsx(Ur,{sx:{fontSize:"16px !important"}}),onClick:()=>t?.(e,"RECHAZADA"),sx:{flex:1,borderRadius:"8px",textTransform:"none",fontWeight:600,fontSize:"13px",color:"#D32F2F",borderColor:"#D32F2F",py:.8},children:"Rechazar"})]})]})},aw="https://qa2.crm.netcar.com.mx/hubs/invitaciones",cw=({userId:e,notifications:t,onAceppInvitacion:r})=>{const[n,o]=y.useState(t),[s,i]=y.useState(null);y.useEffect(()=>{o(t)},[t]);const a=y.useCallback(c=>{const l={notificacionID:Math.random(),titulo:"Nueva invitación a evento",mensaje:c.Descripcion,tipo:"EventoCreado",leida:!1,fechaCreacion:new Date().toISOString(),tiempoTranscurrido:"Ahora",url:`/eventos/${c.EventoID}`,iconoColor:"#E1D6FB",evento:{eventoID:c.EventoID,titulo:c.Titulo,fechaInicio:c.FechaInicio,ubicacion:"",nombreAnfitrion:""}};o(d=>[l,...d])},[]);return y.useEffect(()=>{if(!e)return;const c=new b_().withUrl(aw+`?userId=${e}`).withAutomaticReconnect().build();return c.start().then(()=>{c.on("NotificarInvitacionAEvento",a)}).catch(l=>console.error("Error SignalR:",l)),()=>{c.off("NotificarInvitacionAEvento"),c.stop()}},[e,a]),u.jsx(g.Box,{sx:{width:"100%",maxHeight:"600px",overflowY:"auto"},children:u.jsx(g.List,{disablePadding:!0,children:n.length===0?u.jsxs("div",{className:xe.emptyStateContainer,children:[u.jsx("img",{src:Uf,alt:"Todo en orden",className:xe.emptyStateImage}),u.jsx("h4",{className:xe.emptyStateTitle,children:"Todo en orden aquí"}),u.jsx("p",{className:xe.emptyStateText,children:"Por el momento no tienes invitaciones pendientes."})]}):n.map(c=>u.jsx(iw,{notificacion:c,onAccept:r}))})})},lw=({onEventClick:e,upcomingEvents:t,leads30Days:r,leads90Days:n,disID:o,usrID:s,onAddEvent:i,googleCalendars:a,outlookCalendars:c,isLoadingCalendars:l,onToggleGoogle:d,onToggleOutlook:f,notifications:h,unreadCount:v,onAceppInvitacion:m})=>{const{session:p,sessionoutlook:b}=cc(),{enqueueSnackbar:w}=xs.useSnackbar(),C=N=>{const ce=new Date,fe={start:x.startOfDay(ce),end:x.endOfDay(ce)},$={start:N.fechaInicio,end:N.fechaFin};return Ud(fe,$)?"Hoy":x.isTomorrow(N.fechaInicio)?"Mañana":new Intl.DateTimeFormat("es-ES",{day:"numeric",month:"long"}).format(N.fechaInicio)},E={};t.forEach(N=>{const ce=C(N);E[ce]||(E[ce]=[]),E[ce].push(N)});const[S,_]=y.useState(!1),W=()=>{_(!S)},D=Ii(),A=wc(),M=async()=>{if(!p?.userEmail||!o||!s){console.error("Faltan datos (email, disID o usrID) para sincronizar eventos.");return}try{await D.syncGoogleEvents(p?.userEmail,o,s),w("Eventos sincronizados con Google Calendar con éxito.",{variant:"success"})}catch{w("Error al sincronizar eventos con Google Calendar.",{variant:"error"})}finally{}},I=async()=>{if(!b?.userEmail||!o||!s){console.error("Faltan datos (email, disID o usrID) para sincronizar eventos.");return}try{await A.syncOutlookEvents(b?.userEmail,o,s),w("Eventos sincronizados con Outlook Calendar con éxito.",{variant:"success"})}catch{w("Error al sincronizar eventos con Outlook Calendar.",{variant:"error"})}finally{}},[V,G]=y.useState("events"),F=N=>{G(N)},[Y,oe]=y.useState(!0),U=()=>{oe(N=>!N)};return u.jsxs("div",{className:xe.sidebarContainer,children:[u.jsxs("div",{className:xe.leadsSection,children:[u.jsxs("div",{className:xe.leadCard,children:[u.jsx("div",{className:xe.leadIcon,children:u.jsx("img",{src:Xd})}),u.jsxs("div",{className:xe.leadText,children:[u.jsx("div",{className:xe.leadDays,children:"+30 días sin atender"}),u.jsxs("div",{className:xe.leadCount,children:[r," ",u.jsx("span",{style:{fontSize:10,fontWeight:"normal"},children:"leads"})]})]})]}),u.jsxs("div",{className:xe.leadCard,children:[u.jsx("div",{className:xe.leadIcon,children:u.jsx("img",{src:Xd})}),u.jsxs("div",{className:xe.leadText,children:[u.jsx("div",{className:xe.leadDays,children:"+90 días sin atender"}),u.jsxs("div",{className:xe.leadCount,children:[n," ",u.jsx("span",{style:{fontSize:10,fontWeight:"normal"},children:"leads"})]})]})]})]}),u.jsxs("div",{className:xe.eventsSection,children:[u.jsxs("div",{className:xe.tabsContainer,children:[u.jsx("button",{className:`${xe.tabButton} ${V==="events"?xe.activeTab:""}`,onClick:()=>F("events"),children:"Eventos"}),u.jsxs("button",{className:`${xe.tabButton} ${V==="alerts"?xe.activeTab:""}`,onClick:()=>F("alerts"),children:["Alertas",v>0&&u.jsx("span",{className:xe.alertBadge,children:v>99?"99+":v})]})]}),u.jsxs("div",{className:xe.eventsContainer,children:[V==="events"&&u.jsx(u.Fragment,{children:Object.keys(E).length>0?Object.entries(E).map(([N,ce])=>u.jsxs("div",{className:`${xe.eventGroup}`,children:[u.jsxs("div",{className:xe.eventGroupDate,children:[u.jsx("img",{src:l1,width:15})," ",N]}),ce.map(fe=>{const $=De(fe.color||"#ffcc00"),Q=$.toString(),Ce=$.clone().darken(15).toString(),me=new Intl.DateTimeFormat("es-ES",{hour:"numeric",minute:"2-digit",hour12:!0});return u.jsxs("div",{className:xe.eventItem,style:{backgroundColor:Q,borderLeft:`4px solid ${Ce}`,display:"flex",alignItems:"center",padding:"10px",marginBottom:"8px",borderRadius:"4px",cursor:"pointer"},onClick:()=>e(fe),children:[u.jsxs("div",{className:xe.eventDetails,style:{flex:1},children:[u.jsx("div",{className:xe.eventTitle,style:{fontWeight:"500",fontSize:"12px",color:"#333"},children:fe.titulo.length>32?`${fe.titulo.substring(0,32)}...`:fe.titulo}),fe.nombreAnfitrion&&u.jsxs("div",{style:{display:"flex",alignItems:"center",marginTop:"4px",color:"#555"},children:[u.jsx("img",{src:Jd,width:16,style:{marginRight:"6px",opacity:.7}}),u.jsx("span",{style:{fontSize:"13px"},children:fe.nombreAnfitrion})]}),u.jsx("div",{className:xe.eventTime,style:{fontSize:"12px",marginTop:"4px",opacity:.7},children:`${me.format(fe.fechaInicio).toLowerCase()} - ${me.format(fe.fechaFin).toLowerCase()}`})]}),fe.link&&u.jsx("a",{onClick:we=>we.stopPropagation(),href:fe.link,target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",padding:"4px"},children:u.jsx("img",{src:u1,alt:"Video",width:20,style:{opacity:.8}})})]},fe.eventoID)})]},N)):u.jsxs("div",{className:xe.emptyStateContainer,children:[u.jsx("img",{src:Uf,alt:"Todo en orden",className:xe.emptyStateImage}),u.jsx("h4",{className:xe.emptyStateTitle,children:"Tu agenda está despejada"}),u.jsx("p",{className:xe.emptyStateText,children:"Parece que no tienes ningún evento en tu calendario. ¿Te gustaría añadir uno? "}),u.jsxs("button",{className:xe.addEventButton,onClick:i,children:[u.jsx("img",{src:zd}),"Agregar evento"]})]})}),V==="alerts"&&u.jsx(g.Box,{children:u.jsx(cw,{userId:s,notifications:h,onAceppInvitacion:m})})]})]}),u.jsxs("div",{className:xe.calendarsSection,children:[u.jsxs("button",{onClick:W,className:xe.collapsibleHeader,children:[u.jsxs("div",{className:xe.headerTitle,children:[u.jsx("span",{style:{fontSize:"14px"},children:"Calendarios"}),u.jsx("span",{className:xe.calendarCount,children:"1"})]}),u.jsx($2,{className:`${xe.chevronIcon} ${S?xe.collapsed:""}`})]}),u.jsxs("div",{className:`${xe.collapsibleContent} ${S?xe.hidden:""}`,children:[u.jsxs("button",{className:`${xe.calendarSelectButton} ${Y?xe.calendarSelected:""}`,onClick:U,style:{"--calendar-color":"#1976D2"},children:[u.jsx("div",{className:xe.customCheckIcon,children:u.jsx("div",{className:xe.circularCheckbox,children:u.jsx(sc,{size:16,className:xe.checkedIcon})})}),u.jsx(N2,{size:16,className:xe.calendarIcon}),u.jsx("span",{className:xe.calendarItemText,children:"Mi calendario"})]}),b.userEmail?u.jsxs("div",{className:xe.syncButton,onClick:I,children:[u.jsx("div",{className:xe.circularCheckbox,children:u.jsx(sc,{size:16,className:xe.checkedIcon})}),u.jsx("img",{src:Wf,width:20}),u.jsx("span",{style:{fontSize:"14px"},children:"Sincronizar Outlook"})]}):u.jsx(Lx,{disID:o,usrID:s}),p?.userEmail?u.jsxs("div",{className:xe.syncButton,onClick:M,children:[u.jsx("div",{className:xe.circularCheckbox,children:u.jsx(sc,{size:16,className:xe.checkedIcon})}),u.jsx("img",{src:Ff,width:18}),u.jsx("span",{style:{fontSize:"14px"},children:"Sincronizar Google"})]}):u.jsx($x,{disID:o,usrID:s}),b?.userEmail&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:xe.currentUserCalendarTitle,style:{marginTop:"10px"},children:b?.userEmail}),l?u.jsx(g.CircularProgress,{size:24}):c.length>0?u.jsx(g.List,{dense:!0,className:xe.calendarsList,children:c.map(N=>u.jsx(g.ListItem,{secondaryAction:u.jsx(g.Checkbox,{edge:"end",onChange:()=>f(N.id),checked:N.selected||!1,sx:{color:N.backgroundColor,"&.Mui-checked":{color:N.backgroundColor}}}),disablePadding:!0,children:u.jsx(g.ListItemText,{primary:N.summary.length>25?`${N.summary.substring(0,25)}...`:N.summary,className:xe.calendarItemText})},N.id))}):u.jsx("p",{style:{fontSize:"12px"},children:"No se encontraron calendarios."})]}),p?.userEmail&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:xe.currentUserCalendarTitle,style:{marginTop:"10px"},children:p?.userEmail}),l?u.jsx(g.CircularProgress,{size:24}):a.length>0?u.jsx(g.List,{dense:!0,className:xe.calendarsList,children:a.map(N=>u.jsx(g.ListItem,{secondaryAction:u.jsx(g.Checkbox,{edge:"end",onChange:()=>d(N.id),checked:N.selected||!1,sx:{color:N.backgroundColor,"&.Mui-checked":{color:N.backgroundColor}}}),disablePadding:!0,children:u.jsx(g.ListItemText,{primary:N.summary.length>25?`${N.summary.substring(0,25)}...`:N.summary,className:xe.calendarItemText})},N.id))}):u.jsx("p",{style:{fontSize:"12px"},children:"No se encontraron calendarios."})]})]})]})]})},Cn={dayCell:"_dayCell_xweup_1",dayCellContainer:"_dayCellContainer_xweup_23",dayNumber:"_dayNumber_xweup_55",dayNumberToday:"_dayNumberToday_xweup_69",notCurrentMonth:"_notCurrentMonth_xweup_91",CurrentDay:"_CurrentDay_xweup_129",eventsList:"_eventsList_xweup_137"};var Fo={},tp;function uw(){if(tp)return Fo;tp=1;var e=at();Object.defineProperty(Fo,"__esModule",{value:!0}),Fo.default=void 0,o(y);var t=e(ht()),r=ut();function n(s){if(typeof WeakMap!="function")return null;var i=new WeakMap,a=new WeakMap;return(n=function(c){return c?a:i})(s)}function o(s,i){if(s&&s.__esModule)return s;if(s===null||typeof s!="object"&&typeof s!="function")return{default:s};var a=n(i);if(a&&a.has(s))return a.get(s);var c={__proto__:null},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var d in s)if(d!=="default"&&Object.prototype.hasOwnProperty.call(s,d)){var f=l?Object.getOwnPropertyDescriptor(s,d):null;f&&(f.get||f.set)?Object.defineProperty(c,d,f):c[d]=s[d]}return c.default=s,a&&a.set(s,c),c}return Fo.default=(0,t.default)((0,r.jsx)("path",{d:"M12.545,10.239v3.821h5.445c-0.712,2.315-2.647,3.972-5.445,3.972c-3.332,0-6.033-2.701-6.033-6.032s2.701-6.032,6.033-6.032c1.498,0,2.866,0.549,3.921,1.453l2.814-2.814C17.503,2.988,15.139,2,12.545,2C7.021,2,2.543,6.477,2.543,12s4.478,10,10.002,10c8.396,0,10.249-7.85,9.426-11.748L12.545,10.239z"}),"Google"),Fo}var dw=uw();const fw=it(dw);var Wo={},rp;function pw(){if(rp)return Wo;rp=1;var e=at();Object.defineProperty(Wo,"__esModule",{value:!0}),Wo.default=void 0;var t=e(ht()),r=ut();return Wo.default=(0,t.default)((0,r.jsx)("path",{d:"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m0 14H4V8l8 5 8-5zm-8-7L4 6h16z"}),"MailOutline"),Wo}var hw=pw();const mw=it(hw),np=46,gw=22,vw=({dayNumber:e,date:t,events:r,isToday:n,isCurrentMonth:o,onDayClick:s,onEventClick:i,onSeeMoreClick:a})=>{const c=[Cn.dayCell,o?"":Cn.notCurrentMonth,Cn.CurrentDay].join(" ").trim(),l=y.useRef(null),[d,f]=y.useState(r.length),h=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});y.useLayoutEffect(()=>{const p=()=>{if(l.current){const b=l.current.clientHeight;let w=Math.floor(b/(np+4));if(w<r.length){const C=Math.floor((b-gw)/(np+4));w=Math.max(0,C)}f(w)}};return p(),window.addEventListener("resize",p),()=>window.removeEventListener("resize",p)},[r.length]);const v=r.slice(0,d===0?1:d),m=r.length-(d===0?1:d);return u.jsxs("div",{className:`${c} ${Cn.dayCellContainer}`,onClick:()=>s?.(t),style:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"},children:[u.jsx("div",{className:n?Cn.dayNumber:Cn.dayNumberToday,children:e}),u.jsxs("div",{className:Cn.eventsList,ref:l,style:{flex:1,display:"flex",flexDirection:"column",gap:"4px",padding:"0 4px 4px 4px",marginTop:"4px",overflow:"hidden"},children:[v.map(p=>{const b=p.color||"#D7EBFB",w=p.isGoogleEvent||p.isOutlookEvent;return u.jsxs(g.Box,{onClick:C=>{C.stopPropagation(),i?.(p)},sx:{backgroundColor:w?"#ffffff":p?.color,padding:"4px 8px",borderRadius:"6px",cursor:"pointer",display:"flex",flexDirection:"column",minHeight:"40px",maxHeight:"48px",position:"relative",overflow:"hidden",border:w?`1px solid ${De(b).setAlpha(.4).toRgbString()}`:"none","&:hover":{filter:"brightness(0.95)",boxShadow:"0px 2px 4px rgba(0,0,0,0.08)"}},children:[p.isGoogleEvent&&u.jsx(fw,{sx:{position:"absolute",top:4,right:4,fontSize:12,color:"#4285F4"}}),p.isOutlookEvent&&u.jsx(mw,{sx:{position:"absolute",top:4,right:4,fontSize:12,color:"#0078D4"}}),u.jsx(g.Typography,{sx:{fontSize:"10px",lineHeight:"1",color:"#3C4043",pr:w?2:0,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",wordBreak:"break-word"},children:p.titulo}),u.jsx(g.Typography,{sx:{fontSize:"9px",color:"#70757a",mt:"auto",fontWeight:400},children:`${h.format(p.fechaInicio).toLowerCase()} - ${h.format(p.fechaFin).toLowerCase()}`})]},p.eventoID)}),m>0&&u.jsxs(g.Typography,{sx:{fontSize:"10px",fontWeight:"bold",color:"#1976D2",textAlign:"left",ml:1,mt:.5,cursor:"pointer","&:hover":{textDecoration:"underline"}},onClick:p=>{p.stopPropagation(),a(r,t)},children:["+",m," más"]})]})]})},op={weekDaysContainer:"_weekDaysContainer_5h5ol_1",weekDay:"_weekDay_5h5ol_1"},yw=()=>{const e=["Lunes","Martes","Miércoles","Jueves","Viernes","Sábado","Domingo"];return u.jsx("div",{className:op.weekDaysContainer,children:e.map(t=>u.jsx("div",{className:op.weekDay,children:t},t))})},ji={calendarGridContainer:"_calendarGridContainer_1expw_1",daysContainer:"_daysContainer_1expw_23",rows5:"_rows5_1expw_37",rows6:"_rows6_1expw_45"};function bw(e,t){const[r,n]=A_(e,t.start,t.end);return{start:r,end:n}}function xw(e,t){const{start:r,end:n}=bw(t?.in,e);let o=+r>+n;const s=o?+r:+n,i=o?n:r;i.setHours(0,0,0,0);let a=1;const c=[];for(;+i<=s;)c.push(ic(r,i)),i.setDate(i.getDate()+a),i.setHours(0,0,0,0);return o?c.reverse():c}function _w(e,t){const r=t?.weekStartsOn,n=sn(e,t?.in),o=n.getDay(),s=(o<r?-7:0)+6-(o-r);return n.setDate(n.getDate()+s),n.setHours(23,59,59,999),n}function ww(e,t,r){const n=+sn(e,r?.in),[o,s]=[+sn(t.start,r?.in),+sn(t.end,r?.in)].sort((i,a)=>i-a);return n>=o&&n<=s}const Sw=({currentDate:e,events:t,onDayClick:r,onEventClick:n,onSeeMoreClick:o})=>{const s=x.startOfMonth(e),i=x.endOfMonth(e),a=x.startOfWeek(s,{weekStartsOn:1}),c=_w(i,{weekStartsOn:1}),l=xw({start:a,end:c}),d={},f=l.length/7,h=`${ji.daysContainer} ${f===5?ji.rows5:ji.rows6}`;return t.forEach(v=>{const m=x.format(v.fechaInicio,"yyyy-MM-dd");d[m]||(d[m]=[]),d[m].push(v)}),u.jsxs("div",{className:ji.calendarGridContainer,children:[u.jsx(yw,{}),u.jsx("div",{className:h,children:l.map(v=>{const m=t.filter(p=>ww(v,{start:x.startOfDay(p.fechaInicio),end:x.endOfDay(p.fechaFin)}));return u.jsx(vw,{dayNumber:v.getDate(),date:v,events:m,isToday:x.isToday(v),isCurrentMonth:x.isSameMonth(v,e),onDayClick:r,onEventClick:n,onSeeMoreClick:o},v.toISOString())})})]})},Ac=()=>{const{calendarApiUrl:e}=_c(),t=async v=>{try{return(await Et.get(`${e}/api/Calendario/v1/local/ListarEventosXUsuario/${v}`)).data.map(p=>{const b=new Date(p.fechaInicio),w=new Date(p.fechaFin),C=p.solicitudRelacionada?.[0]?.nombreCliente??null;return{...p,fechaInicio:b,fechaFin:w,client:C}})}catch(m){return console.error("Error events:",m),[]}},r=async(v,m)=>{try{const p=await Et.post(`${e}/api/Calendario/v1/local/InsertarEvento/${m}`,v);return{...p.data,fechaInicio:new Date(p.data.fechaInicio),fechaFin:new Date(p.data.fechaFin)}}catch(p){throw console.log("Error creating event:",p),p}},n=async v=>{try{const m=await Et.post(`${e}/api/Calendario/v1/local/ActualizarEvento/${v.eventoID}`,v);return{eventoID:m.data.eventoID,titulo:m.data.titulo,descripcion:m.data.descripcion,fechaInicio:new Date(m.data.fechaInicio),fechaFin:new Date(m.data.fechaFin),todoElDia:m.data.todoElDia,color:m.data.color,repetir:m.data.repetir,link:m.data.link,solID:m.data.solID,disID:m.data.disID,client:m.data.client}}catch(m){throw console.log("Error updating event:",m),m}},o=async v=>{try{const m=await Et.get(`${e}/api/Calendario/v1/local/ObtenerEvento/${v}`),p=m.data[0].solicitudRelacionada?.[0]?.nombreCliente||null;return{...m.data[0],fechaInicio:m.data[0].fechaInicio,fechaFin:m.data[0].fechaFin,client:p}}catch(m){throw console.error(`Error fetching event with ID ${v}:`,m),m}},s=async v=>{try{await Et.post(`${e}/api/Calendario/v1/local/EliminarEvento/${v}`)}catch(m){throw console.log(`Error ID ${v}:`,m),m}},i=y.useCallback(async(v,m,p,b)=>{try{const w={masNombreBD:p,usrID:b,disID:m,nombreCliente:v},E=(await Et.post(`${e}/api/Calendario/v1/local/ConsultaClientesXUsuariologgeado/`,w)).data?.data;return Array.isArray(E)?E.map(S=>({clienteID:S.clienteID,solID:S.solID,marca:S?.marca,modelo:S?.modelo,nombreCliente:S?.nombreCliente})):[]}catch(w){return console.error("Error clientes:",w),[]}},[e]),a=y.useCallback(async(v,m)=>{try{const p={disID:v,usrMail:m},w=(await Et.post(`${e}/api/Calendario/v1/Consulta_UsuariosInvitados/`,p)).data?.data;return Array.isArray(w)?w.map(C=>({usrID:C.usrID,usrNombre:C.usrNombre,usrMail:C?.usrMail,disID:C?.disID})):[]}catch(p){return console.error("Error usuarios:",p),[]}},[e]),c=async(v,m,p,b,w)=>{const C={tieneConflicto:!1,usrMail:""};try{const E={disID:v,usrMail:m,startDate:p,horaInicio:b,horaFin:w};return(await Et.post(`${e}/api/Calendario/v1/local/ConsultaConflictoInvitados`,E)).data?.data}catch(E){return console.error("Error al verificar conflicto:",E),C}},l=y.useCallback(async(v,m,p,b)=>{try{const w={disID:v,usrMail:m,startDate:p,DuracionEvento:b},E=(await Et.post(`${e}/api/Calendario/v1/local/ConsultaDisponibilidadUsuario`,w)).data?.data;return Array.isArray(E)?E.map(S=>({Fecha:S.fecha,HoraInicio:S.horaInicio,HoraFin:S.horaFin})):[]}catch(w){return console.error("Error usuarios:",w),[]}},[e]),d=y.useCallback(async(v,m=!1)=>{try{const p=await Et.post(`${e}/api/Notificaciones/v1/local/ObtenerNotificacionesPorUsuarioAsync/${v}?soloNoLeidas=${m}`);return console.log("response.data",p.data),p.data}catch(p){return console.error("Error usuarios:",p),[]}},[e]);return{getEventsByUser:t,createEvent:r,updateEvent:n,getEventById:o,deleteEvent:s,getClients:i,getUsuariosInvitados:a,VerificarConflicto:c,getDisponibilidadUsuario:l,getNotificacionesXUsuario:d,UpdateStatusEvento:async(v,m,p)=>{try{const b={EventoID:v,UsuarioID:m,status:p};return(await Et.post(`${e}/api/Calendario/v1/local/ActualizarEstadoInvitacionAsync/`,b)).data}catch(b){return console.error("Error Actualizar estatus:",b),{}}},MarcarLeido:async(v,m)=>{try{return(await Et.post(`${e}/api/Notificaciones/v1/local/MarcarComoLeidaAsync/${v}?usuarioId=${m}&marcarComoLeida=true`)).data?.data}catch(p){return console.error("Error Actualizar estatus:",p),{}}}}};var Uo={},sp;function Cw(){if(sp)return Uo;sp=1;var e=at();Object.defineProperty(Uo,"__esModule",{value:!0}),Uo.default=void 0;var t=e(ht()),r=ut();return Uo.default=(0,t.default)([(0,r.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"},"0"),(0,r.jsx)("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"},"1")],"AccessTime"),Uo}var Ew=Cw();const Tc=it(Ew);var Ho=e=>e.type==="checkbox",En=e=>e instanceof Date,rr=e=>e==null;const ip=e=>typeof e=="object";var Nt=e=>!rr(e)&&!Array.isArray(e)&&ip(e)&&!En(e),ap=e=>Nt(e)&&e.target?Ho(e.target)?e.target.checked:e.target.value:e,Dw=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,cp=(e,t)=>e.has(Dw(t)),kw=e=>{const t=e.constructor&&e.constructor.prototype;return Nt(t)&&t.hasOwnProperty("isPrototypeOf")},Ic=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ut(e){let t;const r=Array.isArray(e),n=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(!(Ic&&(e instanceof Blob||n))&&(r||Nt(e)))if(t=r?[]:Object.create(Object.getPrototypeOf(e)),!r&&!kw(e))t=e;else for(const o in e)e.hasOwnProperty(o)&&(t[o]=Ut(e[o]));else return e;return t}var Ri=e=>/^\w*$/.test(e),$t=e=>e===void 0,Mc=e=>Array.isArray(e)?e.filter(Boolean):[],Pc=e=>Mc(e.replace(/["|']|\]/g,"").split(/\.|\[/)),he=(e,t,r)=>{if(!t||!Nt(e))return r;const n=(Ri(t)?[t]:Pc(t)).reduce((o,s)=>rr(o)?o:o[s],e);return $t(n)||n===e?$t(e[t])?r:e[t]:n},pr=e=>typeof e=="boolean",ct=(e,t,r)=>{let n=-1;const o=Ri(t)?[t]:Pc(t),s=o.length,i=s-1;for(;++n<s;){const a=o[n];let c=r;if(n!==i){const l=e[a];c=Nt(l)||Array.isArray(l)?l:isNaN(+o[n+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;e[a]=c,e=e[a]}};const Ni={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Tr={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Qr={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Oc=y.createContext(null);Oc.displayName="HookFormContext";const jc=()=>y.useContext(Oc),Aw=e=>{const{children:t,...r}=e;return y.createElement(Oc.Provider,{value:r},t)};var lp=(e,t,r,n=!0)=>{const o={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(o,s,{get:()=>{const i=s;return t._proxyFormState[i]!==Tr.all&&(t._proxyFormState[i]=!n||Tr.all),r&&(r[i]=!0),e[i]}});return o};const Rc=typeof window<"u"?y.useLayoutEffect:y.useEffect;function Tw(e){const t=jc(),{control:r=t.control,disabled:n,name:o,exact:s}=e||{},[i,a]=y.useState(r._formState),c=y.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Rc(()=>r._subscribe({name:o,formState:c.current,exact:s,callback:l=>{!n&&a({...r._formState,...l})}}),[o,n,s]),y.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),y.useMemo(()=>lp(i,r,c.current,!1),[i,r])}var Hr=e=>typeof e=="string",up=(e,t,r,n,o)=>Hr(e)?(n&&t.watch.add(e),he(r,e,o)):Array.isArray(e)?e.map(s=>(n&&t.watch.add(s),he(r,s))):(n&&(t.watchAll=!0),r),Nc=e=>rr(e)||!ip(e);function Xr(e,t,r=new WeakSet){if(Nc(e)||Nc(t))return e===t;if(En(e)&&En(t))return e.getTime()===t.getTime();const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const s of n){const i=e[s];if(!o.includes(s))return!1;if(s!=="ref"){const a=t[s];if(En(i)&&En(a)||Nt(i)&&Nt(a)||Array.isArray(i)&&Array.isArray(a)?!Xr(i,a,r):i!==a)return!1}}return!0}function dp(e){const t=jc(),{control:r=t.control,name:n,defaultValue:o,disabled:s,exact:i,compute:a}=e||{},c=y.useRef(o),l=y.useRef(a),d=y.useRef(void 0);l.current=a;const f=y.useMemo(()=>r._getWatch(n,c.current),[r,n]),[h,v]=y.useState(l.current?l.current(f):f);return Rc(()=>r._subscribe({name:n,formState:{values:!0},exact:i,callback:m=>{if(!s){const p=up(n,r._names,m.values||r._formValues,!1,c.current);if(l.current){const b=l.current(p);Xr(b,d.current)||(v(b),d.current=b)}else v(p)}}}),[r,s,n,i]),y.useEffect(()=>r._removeUnmounted()),h}function Iw(e){const t=jc(),{name:r,disabled:n,control:o=t.control,shouldUnregister:s,defaultValue:i}=e,a=cp(o._names.array,r),c=y.useMemo(()=>he(o._formValues,r,he(o._defaultValues,r,i)),[o,r,i]),l=dp({control:o,name:r,defaultValue:c,exact:!0}),d=Tw({control:o,name:r,exact:!0}),f=y.useRef(e),h=y.useRef(o.register(r,{...e.rules,value:l,...pr(e.disabled)?{disabled:e.disabled}:{}}));f.current=e;const v=y.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!he(d.errors,r)},isDirty:{enumerable:!0,get:()=>!!he(d.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!he(d.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!he(d.validatingFields,r)},error:{enumerable:!0,get:()=>he(d.errors,r)}}),[d,r]),m=y.useCallback(C=>h.current.onChange({target:{value:ap(C),name:r},type:Ni.CHANGE}),[r]),p=y.useCallback(()=>h.current.onBlur({target:{value:he(o._formValues,r),name:r},type:Ni.BLUR}),[r,o._formValues]),b=y.useCallback(C=>{const E=he(o._fields,r);E&&C&&(E._f.ref={focus:()=>C.focus&&C.focus(),select:()=>C.select&&C.select(),setCustomValidity:S=>C.setCustomValidity(S),reportValidity:()=>C.reportValidity()})},[o._fields,r]),w=y.useMemo(()=>({name:r,value:l,...pr(n)||d.disabled?{disabled:d.disabled||n}:{},onChange:m,onBlur:p,ref:b}),[r,n,d.disabled,m,p,b,l]);return y.useEffect(()=>{const C=o._options.shouldUnregister||s;o.register(r,{...f.current.rules,...pr(f.current.disabled)?{disabled:f.current.disabled}:{}});const E=(S,_)=>{const W=he(o._fields,S);W&&W._f&&(W._f.mount=_)};if(E(r,!0),C){const S=Ut(he(o._options.defaultValues,r));ct(o._defaultValues,r,S),$t(he(o._formValues,r))&&ct(o._formValues,r,S)}return!a&&o.register(r),()=>{(a?C&&!o._state.action:C)?o.unregister(r):E(r,!1)}},[r,o,a,s]),y.useEffect(()=>{o._setDisabledField({disabled:n,name:r})},[n,r,o]),y.useMemo(()=>({field:w,formState:d,fieldState:v}),[w,d,v])}const hr=e=>e.render(Iw(e));var $c=(e,t,r,n,o)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:o||!0}}:{},Vo=e=>Array.isArray(e)?e:[e],fp=()=>{let e=[];return{get observers(){return e},next:o=>{for(const s of e)s.next&&s.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(s=>s!==o)}}),unsubscribe:()=>{e=[]}}},ir=e=>Nt(e)&&!Object.keys(e).length,Lc=e=>e.type==="file",Ir=e=>typeof e=="function",$i=e=>{if(!Ic)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},pp=e=>e.type==="select-multiple",zc=e=>e.type==="radio",Mw=e=>zc(e)||Ho(e),Bc=e=>$i(e)&&e.isConnected;function Pw(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=$t(e)?n++:e[t[n++]];return e}function Ow(e){for(const t in e)if(e.hasOwnProperty(t)&&!$t(e[t]))return!1;return!0}function Ft(e,t){const r=Array.isArray(t)?t:Ri(t)?[t]:Pc(t),n=r.length===1?e:Pw(e,r),o=r.length-1,s=r[o];return n&&delete n[s],o!==0&&(Nt(n)&&ir(n)||Array.isArray(n)&&Ow(n))&&Ft(e,r.slice(0,-1)),e}var hp=e=>{for(const t in e)if(Ir(e[t]))return!0;return!1};function Li(e,t={}){const r=Array.isArray(e);if(Nt(e)||r)for(const n in e)Array.isArray(e[n])||Nt(e[n])&&!hp(e[n])?(t[n]=Array.isArray(e[n])?[]:{},Li(e[n],t[n])):rr(e[n])||(t[n]=!0);return t}function mp(e,t,r){const n=Array.isArray(e);if(Nt(e)||n)for(const o in e)Array.isArray(e[o])||Nt(e[o])&&!hp(e[o])?$t(t)||Nc(r[o])?r[o]=Array.isArray(e[o])?Li(e[o],[]):{...Li(e[o])}:mp(e[o],rr(t)?{}:t[o],r[o]):r[o]=!Xr(e[o],t[o]);return r}var Yo=(e,t)=>mp(e,t,Li(t));const gp={value:!1,isValid:!1},vp={value:!0,isValid:!0};var yp=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!$t(e[0].attributes.value)?$t(e[0].value)||e[0].value===""?vp:{value:e[0].value,isValid:!0}:vp:gp}return gp},bp=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>$t(e)?e:t?e===""?NaN:e&&+e:r&&Hr(e)?new Date(e):n?n(e):e;const xp={isValid:!1,value:null};var _p=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,xp):xp;function wp(e){const t=e.ref;return Lc(t)?t.files:zc(t)?_p(e.refs).value:pp(t)?[...t.selectedOptions].map(({value:r})=>r):Ho(t)?yp(e.refs).value:bp($t(t.value)?e.ref.value:t.value,e)}var jw=(e,t,r,n)=>{const o={};for(const s of e){const i=he(t,s);i&&ct(o,s,i._f)}return{criteriaMode:r,names:[...e],fields:o,shouldUseNativeValidation:n}},zi=e=>e instanceof RegExp,qo=e=>$t(e)?e:zi(e)?e.source:Nt(e)?zi(e.value)?e.value.source:e.value:e,Sp=e=>({isOnSubmit:!e||e===Tr.onSubmit,isOnBlur:e===Tr.onBlur,isOnChange:e===Tr.onChange,isOnAll:e===Tr.all,isOnTouch:e===Tr.onTouched});const Cp="AsyncFunction";var Rw=e=>!!e&&!!e.validate&&!!(Ir(e.validate)&&e.validate.constructor.name===Cp||Nt(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Cp)),Nw=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Ep=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Zo=(e,t,r,n)=>{for(const o of r||Object.keys(e)){const s=he(e,o);if(s){const{_f:i,...a}=s;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],o)&&!n)return!0;if(i.ref&&t(i.ref,i.name)&&!n)return!0;if(Zo(a,t))break}else if(Nt(a)&&Zo(a,t))break}}};function Dp(e,t,r){const n=he(e,r);if(n||Ri(r))return{error:n,name:r};const o=r.split(".");for(;o.length;){const s=o.join("."),i=he(t,s),a=he(e,s);if(i&&!Array.isArray(i)&&r!==s)return{name:r};if(a&&a.type)return{name:s,error:a};if(a&&a.root&&a.root.type)return{name:`${s}.root`,error:a.root};o.pop()}return{name:r}}var $w=(e,t,r,n)=>{r(e);const{name:o,...s}=e;return ir(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(i=>t[i]===(!n||Tr.all))},Lw=(e,t,r)=>!e||!t||e===t||Vo(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),zw=(e,t,r,n,o)=>o.isOnAll?!1:!r&&o.isOnTouch?!(t||e):(r?n.isOnBlur:o.isOnBlur)?!e:(r?n.isOnChange:o.isOnChange)?e:!0,Bw=(e,t)=>!Mc(he(e,t)).length&&Ft(e,t),Fw=(e,t,r)=>{const n=Vo(he(e,r));return ct(n,"root",t[r]),ct(e,r,n),e},Bi=e=>Hr(e);function kp(e,t,r="validate"){if(Bi(e)||Array.isArray(e)&&e.every(Bi)||pr(e)&&!e)return{type:r,message:Bi(e)?e:"",ref:t}}var Gn=e=>Nt(e)&&!zi(e)?e:{value:e,message:""},Ap=async(e,t,r,n,o,s)=>{const{ref:i,refs:a,required:c,maxLength:l,minLength:d,min:f,max:h,pattern:v,validate:m,name:p,valueAsNumber:b,mount:w}=e._f,C=he(r,p);if(!w||t.has(p))return{};const E=a?a[0]:i,S=G=>{o&&E.reportValidity&&(E.setCustomValidity(pr(G)?"":G||""),E.reportValidity())},_={},W=zc(i),D=Ho(i),A=W||D,M=(b||Lc(i))&&$t(i.value)&&$t(C)||$i(i)&&i.value===""||C===""||Array.isArray(C)&&!C.length,I=$c.bind(null,p,n,_),V=(G,F,Y,oe=Qr.maxLength,U=Qr.minLength)=>{const N=G?F:Y;_[p]={type:G?oe:U,message:N,ref:i,...I(G?oe:U,N)}};if(s?!Array.isArray(C)||!C.length:c&&(!A&&(M||rr(C))||pr(C)&&!C||D&&!yp(a).isValid||W&&!_p(a).isValid)){const{value:G,message:F}=Bi(c)?{value:!!c,message:c}:Gn(c);if(G&&(_[p]={type:Qr.required,message:F,ref:E,...I(Qr.required,F)},!n))return S(F),_}if(!M&&(!rr(f)||!rr(h))){let G,F;const Y=Gn(h),oe=Gn(f);if(!rr(C)&&!isNaN(C)){const U=i.valueAsNumber||C&&+C;rr(Y.value)||(G=U>Y.value),rr(oe.value)||(F=U<oe.value)}else{const U=i.valueAsDate||new Date(C),N=$=>new Date(new Date().toDateString()+" "+$),ce=i.type=="time",fe=i.type=="week";Hr(Y.value)&&C&&(G=ce?N(C)>N(Y.value):fe?C>Y.value:U>new Date(Y.value)),Hr(oe.value)&&C&&(F=ce?N(C)<N(oe.value):fe?C<oe.value:U<new Date(oe.value))}if((G||F)&&(V(!!G,Y.message,oe.message,Qr.max,Qr.min),!n))return S(_[p].message),_}if((l||d)&&!M&&(Hr(C)||s&&Array.isArray(C))){const G=Gn(l),F=Gn(d),Y=!rr(G.value)&&C.length>+G.value,oe=!rr(F.value)&&C.length<+F.value;if((Y||oe)&&(V(Y,G.message,F.message),!n))return S(_[p].message),_}if(v&&!M&&Hr(C)){const{value:G,message:F}=Gn(v);if(zi(G)&&!C.match(G)&&(_[p]={type:Qr.pattern,message:F,ref:i,...I(Qr.pattern,F)},!n))return S(F),_}if(m){if(Ir(m)){const G=await m(C,r),F=kp(G,E);if(F&&(_[p]={...F,...I(Qr.validate,F.message)},!n))return S(F.message),_}else if(Nt(m)){let G={};for(const F in m){if(!ir(G)&&!n)break;const Y=kp(await m[F](C,r),E,F);Y&&(G={...Y,...I(F,Y.message)},S(Y.message),n&&(_[p]=G))}if(!ir(G)&&(_[p]={ref:E,...G},!n))return _}}return S(!0),_};const Ww={mode:Tr.onSubmit,reValidateMode:Tr.onChange,shouldFocusError:!0};function Uw(e={}){let t={...Ww,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:Ir(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},o=Nt(t.defaultValues)||Nt(t.values)?Ut(t.defaultValues||t.values)||{}:{},s=t.shouldUnregister?{}:Ut(o),i={action:!1,mount:!1,watch:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,l=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let f={...d};const h={array:fp(),state:fp()},v=t.criteriaMode===Tr.all,m=k=>P=>{clearTimeout(l),l=setTimeout(k,P)},p=async k=>{if(!t.disabled&&(d.isValid||f.isValid||k)){const P=t.resolver?ir((await D()).errors):await M(n,!0);P!==r.isValid&&h.state.next({isValid:P})}},b=(k,P)=>{!t.disabled&&(d.isValidating||d.validatingFields||f.isValidating||f.validatingFields)&&((k||Array.from(a.mount)).forEach(B=>{B&&(P?ct(r.validatingFields,B,P):Ft(r.validatingFields,B))}),h.state.next({validatingFields:r.validatingFields,isValidating:!ir(r.validatingFields)}))},w=(k,P=[],B,ue,se=!0,O=!0)=>{if(ue&&B&&!t.disabled){if(i.action=!0,O&&Array.isArray(he(n,k))){const ne=B(he(n,k),ue.argA,ue.argB);se&&ct(n,k,ne)}if(O&&Array.isArray(he(r.errors,k))){const ne=B(he(r.errors,k),ue.argA,ue.argB);se&&ct(r.errors,k,ne),Bw(r.errors,k)}if((d.touchedFields||f.touchedFields)&&O&&Array.isArray(he(r.touchedFields,k))){const ne=B(he(r.touchedFields,k),ue.argA,ue.argB);se&&ct(r.touchedFields,k,ne)}(d.dirtyFields||f.dirtyFields)&&(r.dirtyFields=Yo(o,s)),h.state.next({name:k,isDirty:V(k,P),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else ct(s,k,P)},C=(k,P)=>{ct(r.errors,k,P),h.state.next({errors:r.errors})},E=k=>{r.errors=k,h.state.next({errors:r.errors,isValid:!1})},S=(k,P,B,ue)=>{const se=he(n,k);if(se){const O=he(s,k,$t(B)?he(o,k):B);$t(O)||ue&&ue.defaultChecked||P?ct(s,k,P?O:wp(se._f)):Y(k,O),i.mount&&p()}},_=(k,P,B,ue,se)=>{let O=!1,ne=!1;const Se={name:k};if(!t.disabled){if(!B||ue){(d.isDirty||f.isDirty)&&(ne=r.isDirty,r.isDirty=Se.isDirty=V(),O=ne!==Se.isDirty);const Oe=Xr(he(o,k),P);ne=!!he(r.dirtyFields,k),Oe?Ft(r.dirtyFields,k):ct(r.dirtyFields,k,!0),Se.dirtyFields=r.dirtyFields,O=O||(d.dirtyFields||f.dirtyFields)&&ne!==!Oe}if(B){const Oe=he(r.touchedFields,k);Oe||(ct(r.touchedFields,k,B),Se.touchedFields=r.touchedFields,O=O||(d.touchedFields||f.touchedFields)&&Oe!==B)}O&&se&&h.state.next(Se)}return O?Se:{}},W=(k,P,B,ue)=>{const se=he(r.errors,k),O=(d.isValid||f.isValid)&&pr(P)&&r.isValid!==P;if(t.delayError&&B?(c=m(()=>C(k,B)),c(t.delayError)):(clearTimeout(l),c=null,B?ct(r.errors,k,B):Ft(r.errors,k)),(B?!Xr(se,B):se)||!ir(ue)||O){const ne={...ue,...O&&pr(P)?{isValid:P}:{},errors:r.errors,name:k};r={...r,...ne},h.state.next(ne)}},D=async k=>{b(k,!0);const P=await t.resolver(s,t.context,jw(k||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation));return b(k),P},A=async k=>{const{errors:P}=await D(k);if(k)for(const B of k){const ue=he(P,B);ue?ct(r.errors,B,ue):Ft(r.errors,B)}else r.errors=P;return P},M=async(k,P,B={valid:!0})=>{for(const ue in k){const se=k[ue];if(se){const{_f:O,...ne}=se;if(O){const Se=a.array.has(O.name),Oe=se._f&&Rw(se._f);Oe&&d.validatingFields&&b([ue],!0);const R=await Ap(se,a.disabled,s,v,t.shouldUseNativeValidation&&!P,Se);if(Oe&&d.validatingFields&&b([ue]),R[O.name]&&(B.valid=!1,P))break;!P&&(he(R,O.name)?Se?Fw(r.errors,R,O.name):ct(r.errors,O.name,R[O.name]):Ft(r.errors,O.name))}!ir(ne)&&await M(ne,P,B)}}return B.valid},I=()=>{for(const k of a.unMount){const P=he(n,k);P&&(P._f.refs?P._f.refs.every(B=>!Bc(B)):!Bc(P._f.ref))&&le(k)}a.unMount=new Set},V=(k,P)=>!t.disabled&&(k&&P&&ct(s,k,P),!Xr($(),o)),G=(k,P,B)=>up(k,a,{...i.mount?s:$t(P)?o:Hr(k)?{[k]:P}:P},B,P),F=k=>Mc(he(i.mount?s:o,k,t.shouldUnregister?he(o,k,[]):[])),Y=(k,P,B={})=>{const ue=he(n,k);let se=P;if(ue){const O=ue._f;O&&(!O.disabled&&ct(s,k,bp(P,O)),se=$i(O.ref)&&rr(P)?"":P,pp(O.ref)?[...O.ref.options].forEach(ne=>ne.selected=se.includes(ne.value)):O.refs?Ho(O.ref)?O.refs.forEach(ne=>{(!ne.defaultChecked||!ne.disabled)&&(Array.isArray(se)?ne.checked=!!se.find(Se=>Se===ne.value):ne.checked=se===ne.value||!!se)}):O.refs.forEach(ne=>ne.checked=ne.value===se):Lc(O.ref)?O.ref.value="":(O.ref.value=se,O.ref.type||h.state.next({name:k,values:Ut(s)})))}(B.shouldDirty||B.shouldTouch)&&_(k,se,B.shouldTouch,B.shouldDirty,!0),B.shouldValidate&&fe(k)},oe=(k,P,B)=>{for(const ue in P){if(!P.hasOwnProperty(ue))return;const se=P[ue],O=k+"."+ue,ne=he(n,O);(a.array.has(k)||Nt(se)||ne&&!ne._f)&&!En(se)?oe(O,se,B):Y(O,se,B)}},U=(k,P,B={})=>{const ue=he(n,k),se=a.array.has(k),O=Ut(P);ct(s,k,O),se?(h.array.next({name:k,values:Ut(s)}),(d.isDirty||d.dirtyFields||f.isDirty||f.dirtyFields)&&B.shouldDirty&&h.state.next({name:k,dirtyFields:Yo(o,s),isDirty:V(k,O)})):ue&&!ue._f&&!rr(O)?oe(k,O,B):Y(k,O,B),Ep(k,a)&&h.state.next({...r,name:k}),h.state.next({name:i.mount?k:void 0,values:Ut(s)})},N=async k=>{i.mount=!0;const P=k.target;let B=P.name,ue=!0;const se=he(n,B),O=Oe=>{ue=Number.isNaN(Oe)||En(Oe)&&isNaN(Oe.getTime())||Xr(Oe,he(s,B,Oe))},ne=Sp(t.mode),Se=Sp(t.reValidateMode);if(se){let Oe,R;const te=P.type?wp(se._f):ap(k),_e=k.type===Ni.BLUR||k.type===Ni.FOCUS_OUT,Ge=!Nw(se._f)&&!t.resolver&&!he(r.errors,B)&&!se._f.deps||zw(_e,he(r.touchedFields,B),r.isSubmitted,Se,ne),q=Ep(B,a,_e);ct(s,B,te),_e?(!P||!P.readOnly)&&(se._f.onBlur&&se._f.onBlur(k),c&&c(0)):se._f.onChange&&se._f.onChange(k);const de=_(B,te,_e),Ee=!ir(de)||q;if(!_e&&h.state.next({name:B,type:k.type,values:Ut(s)}),Ge)return(d.isValid||f.isValid)&&(t.mode==="onBlur"?_e&&p():_e||p()),Ee&&h.state.next({name:B,...q?{}:de});if(!_e&&q&&h.state.next({...r}),t.resolver){const{errors:Ae}=await D([B]);if(O(te),ue){const Fe=Dp(r.errors,n,B),X=Dp(Ae,n,Fe.name||B);Oe=X.error,B=X.name,R=ir(Ae)}}else b([B],!0),Oe=(await Ap(se,a.disabled,s,v,t.shouldUseNativeValidation))[B],b([B]),O(te),ue&&(Oe?R=!1:(d.isValid||f.isValid)&&(R=await M(n,!0)));ue&&(se._f.deps&&fe(se._f.deps),W(B,R,Oe,de))}},ce=(k,P)=>{if(he(r.errors,P)&&k.focus)return k.focus(),1},fe=async(k,P={})=>{let B,ue;const se=Vo(k);if(t.resolver){const O=await A($t(k)?k:se);B=ir(O),ue=k?!se.some(ne=>he(O,ne)):B}else k?(ue=(await Promise.all(se.map(async O=>{const ne=he(n,O);return await M(ne&&ne._f?{[O]:ne}:ne)}))).every(Boolean),!(!ue&&!r.isValid)&&p()):ue=B=await M(n);return h.state.next({...!Hr(k)||(d.isValid||f.isValid)&&B!==r.isValid?{}:{name:k},...t.resolver||!k?{isValid:B}:{},errors:r.errors}),P.shouldFocus&&!ue&&Zo(n,ce,k?se:a.mount),ue},$=k=>{const P={...i.mount?s:o};return $t(k)?P:Hr(k)?he(P,k):k.map(B=>he(P,B))},Q=(k,P)=>({invalid:!!he((P||r).errors,k),isDirty:!!he((P||r).dirtyFields,k),error:he((P||r).errors,k),isValidating:!!he(r.validatingFields,k),isTouched:!!he((P||r).touchedFields,k)}),Ce=k=>{k&&Vo(k).forEach(P=>Ft(r.errors,P)),h.state.next({errors:k?r.errors:{}})},me=(k,P,B)=>{const ue=(he(n,k,{_f:{}})._f||{}).ref,se=he(r.errors,k)||{},{ref:O,message:ne,type:Se,...Oe}=se;ct(r.errors,k,{...Oe,...P,ref:ue}),h.state.next({name:k,errors:r.errors,isValid:!1}),B&&B.shouldFocus&&ue&&ue.focus&&ue.focus()},we=(k,P)=>Ir(k)?h.state.subscribe({next:B=>"values"in B&&k(G(void 0,P),B)}):G(k,P,!0),ae=k=>h.state.subscribe({next:P=>{Lw(k.name,P.name,k.exact)&&$w(P,k.formState||d,Be,k.reRenderRoot)&&k.callback({values:{...s},...r,...P,defaultValues:o})}}).unsubscribe,ee=k=>(i.mount=!0,f={...f,...k.formState},ae({...k,formState:f})),le=(k,P={})=>{for(const B of k?Vo(k):a.mount)a.mount.delete(B),a.array.delete(B),P.keepValue||(Ft(n,B),Ft(s,B)),!P.keepError&&Ft(r.errors,B),!P.keepDirty&&Ft(r.dirtyFields,B),!P.keepTouched&&Ft(r.touchedFields,B),!P.keepIsValidating&&Ft(r.validatingFields,B),!t.shouldUnregister&&!P.keepDefaultValue&&Ft(o,B);h.state.next({values:Ut(s)}),h.state.next({...r,...P.keepDirty?{isDirty:V()}:{}}),!P.keepIsValid&&p()},ge=({disabled:k,name:P})=>{(pr(k)&&i.mount||k||a.disabled.has(P))&&(k?a.disabled.add(P):a.disabled.delete(P))},ie=(k,P={})=>{let B=he(n,k);const ue=pr(P.disabled)||pr(t.disabled);return ct(n,k,{...B||{},_f:{...B&&B._f?B._f:{ref:{name:k}},name:k,mount:!0,...P}}),a.mount.add(k),B?ge({disabled:pr(P.disabled)?P.disabled:t.disabled,name:k}):S(k,!0,P.value),{...ue?{disabled:P.disabled||t.disabled}:{},...t.progressive?{required:!!P.required,min:qo(P.min),max:qo(P.max),minLength:qo(P.minLength),maxLength:qo(P.maxLength),pattern:qo(P.pattern)}:{},name:k,onChange:N,onBlur:N,ref:se=>{if(se){ie(k,P),B=he(n,k);const O=$t(se.value)&&se.querySelectorAll&&se.querySelectorAll("input,select,textarea")[0]||se,ne=Mw(O),Se=B._f.refs||[];if(ne?Se.find(Oe=>Oe===O):O===B._f.ref)return;ct(n,k,{_f:{...B._f,...ne?{refs:[...Se.filter(Bc),O,...Array.isArray(he(o,k))?[{}]:[]],ref:{type:O.type,name:k}}:{ref:O}}}),S(k,!1,void 0,O)}else B=he(n,k,{}),B._f&&(B._f.mount=!1),(t.shouldUnregister||P.shouldUnregister)&&!(cp(a.array,k)&&i.action)&&a.unMount.add(k)}}},pe=()=>t.shouldFocusError&&Zo(n,ce,a.mount),Re=k=>{pr(k)&&(h.state.next({disabled:k}),Zo(n,(P,B)=>{const ue=he(n,B);ue&&(P.disabled=ue._f.disabled||k,Array.isArray(ue._f.refs)&&ue._f.refs.forEach(se=>{se.disabled=ue._f.disabled||k}))},0,!1))},j=(k,P)=>async B=>{let ue;B&&(B.preventDefault&&B.preventDefault(),B.persist&&B.persist());let se=Ut(s);if(h.state.next({isSubmitting:!0}),t.resolver){const{errors:O,values:ne}=await D();r.errors=O,se=Ut(ne)}else await M(n);if(a.disabled.size)for(const O of a.disabled)Ft(se,O);if(Ft(r.errors,"root"),ir(r.errors)){h.state.next({errors:{}});try{await k(se,B)}catch(O){ue=O}}else P&&await P({...r.errors},B),pe(),setTimeout(pe);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ir(r.errors)&&!ue,submitCount:r.submitCount+1,errors:r.errors}),ue)throw ue},We=(k,P={})=>{he(n,k)&&($t(P.defaultValue)?U(k,Ut(he(o,k))):(U(k,P.defaultValue),ct(o,k,Ut(P.defaultValue))),P.keepTouched||Ft(r.touchedFields,k),P.keepDirty||(Ft(r.dirtyFields,k),r.isDirty=P.defaultValue?V(k,Ut(he(o,k))):V()),P.keepError||(Ft(r.errors,k),d.isValid&&p()),h.state.next({...r}))},qe=(k,P={})=>{const B=k?Ut(k):o,ue=Ut(B),se=ir(k),O=se?o:ue;if(P.keepDefaultValues||(o=B),!P.keepValues){if(P.keepDirtyValues){const ne=new Set([...a.mount,...Object.keys(Yo(o,s))]);for(const Se of Array.from(ne))he(r.dirtyFields,Se)?ct(O,Se,he(s,Se)):U(Se,he(O,Se))}else{if(Ic&&$t(k))for(const ne of a.mount){const Se=he(n,ne);if(Se&&Se._f){const Oe=Array.isArray(Se._f.refs)?Se._f.refs[0]:Se._f.ref;if($i(Oe)){const R=Oe.closest("form");if(R){R.reset();break}}}}if(P.keepFieldsRef)for(const ne of a.mount)U(ne,he(O,ne));else n={}}s=t.shouldUnregister?P.keepDefaultValues?Ut(o):{}:Ut(O),h.array.next({values:{...O}}),h.state.next({values:{...O}})}a={mount:P.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!d.isValid||!!P.keepIsValid||!!P.keepDirtyValues,i.watch=!!t.shouldUnregister,h.state.next({submitCount:P.keepSubmitCount?r.submitCount:0,isDirty:se?!1:P.keepDirty?r.isDirty:!!(P.keepDefaultValues&&!Xr(k,o)),isSubmitted:P.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:se?{}:P.keepDirtyValues?P.keepDefaultValues&&s?Yo(o,s):r.dirtyFields:P.keepDefaultValues&&k?Yo(o,k):P.keepDirty?r.dirtyFields:{},touchedFields:P.keepTouched?r.touchedFields:{},errors:P.keepErrors?r.errors:{},isSubmitSuccessful:P.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:o})},Ze=(k,P)=>qe(Ir(k)?k(s):k,P),Ne=(k,P={})=>{const B=he(n,k),ue=B&&B._f;if(ue){const se=ue.refs?ue.refs[0]:ue.ref;se.focus&&(se.focus(),P.shouldSelect&&Ir(se.select)&&se.select())}},Be=k=>{r={...r,...k}},pt={control:{register:ie,unregister:le,getFieldState:Q,handleSubmit:j,setError:me,_subscribe:ae,_runSchema:D,_focusError:pe,_getWatch:G,_getDirty:V,_setValid:p,_setFieldArray:w,_setDisabledField:ge,_setErrors:E,_getFieldArray:F,_reset:qe,_resetDefaultValues:()=>Ir(t.defaultValues)&&t.defaultValues().then(k=>{Ze(k,t.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:I,_disableForm:Re,_subjects:h,_proxyFormState:d,get _fields(){return n},get _formValues(){return s},get _state(){return i},set _state(k){i=k},get _defaultValues(){return o},get _names(){return a},set _names(k){a=k},get _formState(){return r},get _options(){return t},set _options(k){t={...t,...k}}},subscribe:ee,trigger:fe,register:ie,handleSubmit:j,watch:we,setValue:U,getValues:$,reset:Ze,resetField:We,clearErrors:Ce,unregister:le,setError:me,setFocus:Ne,getFieldState:Q};return{...pt,formControl:pt}}function Tp(e={}){const t=y.useRef(void 0),r=y.useRef(void 0),[n,o]=y.useState({isDirty:!1,isValidating:!1,isLoading:Ir(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Ir(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!Ir(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:i,...a}=Uw(e);t.current={...a,formState:n}}const s=t.current.control;return s._options=e,Rc(()=>{const i=s._subscribe({formState:s._proxyFormState,callback:()=>o({...s._formState}),reRenderRoot:!0});return o(a=>({...a,isReady:!0})),s._formState.isReady=!0,i},[s]),y.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),y.useEffect(()=>{e.mode&&(s._options.mode=e.mode),e.reValidateMode&&(s._options.reValidateMode=e.reValidateMode)},[s,e.mode,e.reValidateMode]),y.useEffect(()=>{e.errors&&(s._setErrors(e.errors),s._focusError())},[s,e.errors]),y.useEffect(()=>{e.shouldUnregister&&s._subjects.state.next({values:s._getWatch()})},[s,e.shouldUnregister]),y.useEffect(()=>{if(s._proxyFormState.isDirty){const i=s._getDirty();i!==n.isDirty&&s._subjects.state.next({isDirty:i})}},[s,n.isDirty]),y.useEffect(()=>{e.values&&!Xr(e.values,r.current)?(s._reset(e.values,{keepFieldsRef:!0,...s._options.resetOptions}),r.current=e.values,o(i=>({...i}))):s._resetDefaultValues()},[s,e.values]),y.useEffect(()=>{s._state.mount||(s._setValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),t.current.formState=lp(n,s),t.current}const Ip=(e,t,r)=>{if(e&&"reportValidity"in e){const n=he(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Fc=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?Ip(n.ref,r,e):n&&n.refs&&n.refs.forEach(o=>Ip(o,r,e))}},Mp=(e,t)=>{t.shouldUseNativeValidation&&Fc(e,t);const r={};for(const n in e){const o=he(t.fields,n),s=Object.assign(e[n]||{},{ref:o&&o.ref});if(Hw(t.names||Object.keys(e),n)){const i=Object.assign({},he(r,n));ct(i,"root",s),ct(r,n,i)}else ct(r,n,s)}return r},Hw=(e,t)=>{const r=Pp(t);return e.some(n=>Pp(n).match(`^${r}\\.\\d+`))};function Pp(e){return e.replace(/\]|\[/g,"")}function Z(e,t,r){function n(a,c){var l;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(l=a._zod).traits??(l.traits=new Set),a._zod.traits.add(e),t(a,c);for(const d in i.prototype)d in a||Object.defineProperty(a,d,{value:i.prototype[d].bind(a)});a._zod.constr=i,a._zod.def=c}const o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var c;const l=r?.Parent?new s:this;n(l,a),(c=l._zod).deferred??(c.deferred=[]);for(const d of l._zod.deferred)d();return l}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class Kn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Op extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const jp={};function Dn(e){return jp}function Vw(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Wc(e,t){return typeof t=="bigint"?t.toString():t}function Uc(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Hc(e){return e==null}function Vc(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Yw(e,t){const r=(e.toString().split(".")[1]||"").length,n=t.toString();let o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){const c=n.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}const s=r>o?r:o,i=Number.parseInt(e.toFixed(s).replace(".","")),a=Number.parseInt(t.toFixed(s).replace(".",""));return i%a/10**s}const Rp=Symbol("evaluating");function gt(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Rp)return n===void 0&&(n=Rp,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function qw(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function an(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Qn(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Np(e){return JSON.stringify(e)}const $p="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Fi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Zw=Uc(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Go(e){if(Fi(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(Fi(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Lp(e){return Go(e)?{...e}:e}const Gw=new Set(["string","number","symbol"]);function Xn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function cn(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function Te(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Kw(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Qw={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Xw(e,t){const r=e._zod.def,n=Qn(e._zod.def,{get shape(){const o={};for(const s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(o[s]=r.shape[s])}return an(this,"shape",o),o},checks:[]});return cn(e,n)}function Jw(e,t){const r=e._zod.def,n=Qn(e._zod.def,{get shape(){const o={...e._zod.def.shape};for(const s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete o[s]}return an(this,"shape",o),o},checks:[]});return cn(e,n)}function eS(e,t){if(!Go(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const o=Qn(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return an(this,"shape",s),s},checks:[]});return cn(e,o)}function tS(e,t){if(!Go(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return an(this,"shape",n),n},checks:e._zod.def.checks};return cn(e,r)}function rS(e,t){const r=Qn(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return an(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return cn(e,r)}function nS(e,t,r){const n=Qn(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(r)for(const i in r){if(!(i in o))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=e?new e({type:"optional",innerType:o[i]}):o[i])}else for(const i in o)s[i]=e?new e({type:"optional",innerType:o[i]}):o[i];return an(this,"shape",s),s},checks:[]});return cn(t,n)}function oS(e,t,r){const n=Qn(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(r)for(const i in r){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=new e({type:"nonoptional",innerType:o[i]}))}else for(const i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return an(this,"shape",s),s},checks:[]});return cn(t,n)}function Jn(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function zp(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Wi(e){return typeof e=="string"?e:e?.message}function kn(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const o=Wi(e.inst?._zod.def?.error?.(e))??Wi(t?.error?.(e))??Wi(r.customError?.(e))??Wi(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Yc(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ko(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const Bp=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Wc,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},qc=Z("$ZodError",Bp),Ui=Z("$ZodError",Bp,{Parent:Error});function sS(e,t=r=>r.message){const r={},n=[];for(const o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function iS(e,t){const r=t||function(s){return s.message},n={_errors:[]},o=s=>{for(const i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a}));else if(i.code==="invalid_key")o({issues:i.issues});else if(i.code==="invalid_element")o({issues:i.issues});else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){const l=i.path[c];c===i.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(r(i))):a[l]=a[l]||{_errors:[]},a=a[l],c++}}};return o(e),n}const Hi=e=>(t,r,n,o)=>{const s=n?Object.assign(n,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Kn;if(i.issues.length){const a=new(o?.Err??e)(i.issues.map(c=>kn(c,s,Dn())));throw $p(a,o?.callee),a}return i.value},aS=Hi(Ui),Vi=e=>async(t,r,n,o)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new(o?.Err??e)(i.issues.map(c=>kn(c,s,Dn())));throw $p(a,o?.callee),a}return i.value},cS=Vi(Ui),Yi=e=>(t,r,n)=>{const o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Kn;return s.issues.length?{success:!1,error:new(e??qc)(s.issues.map(i=>kn(i,o,Dn())))}:{success:!0,data:s.value}},lS=Yi(Ui),qi=e=>async(t,r,n)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>kn(i,o,Dn())))}:{success:!0,data:s.value}},uS=qi(Ui),dS=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Hi(e)(t,r,o)},fS=e=>(t,r,n)=>Hi(e)(t,r,n),pS=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Vi(e)(t,r,o)},hS=e=>async(t,r,n)=>Vi(e)(t,r,n),mS=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Yi(e)(t,r,o)},gS=e=>(t,r,n)=>Yi(e)(t,r,n),vS=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return qi(e)(t,r,o)},yS=e=>async(t,r,n)=>qi(e)(t,r,n),bS=/^[cC][^\s-]{8,}$/,xS=/^[0-9a-z]+$/,_S=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,wS=/^[0-9a-vA-V]{20}$/,SS=/^[A-Za-z0-9]{27}$/,CS=/^[a-zA-Z0-9_-]{21}$/,ES=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,DS=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Fp=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,kS=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,AS="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function TS(){return new RegExp(AS,"u")}const IS=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,MS=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,PS=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,OS=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,jS=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Wp=/^[A-Za-z0-9_-]*$/,RS=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,NS=/^\+(?:[0-9]){6,14}[0-9]$/,Up="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",$S=new RegExp(`^${Up}$`);function Hp(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function LS(e){return new RegExp(`^${Hp(e)}$`)}function zS(e){const t=Hp({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Up}T(?:${n})$`)}const BS=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},FS=/^\d+$/,WS=/^-?\d+(?:\.\d+)?/i,US=/true|false/i,HS=/^[^A-Z]*$/,VS=/^[^a-z]*$/,ar=Z("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Vp={number:"number",bigint:"bigint",object:"date"},Yp=Z("$ZodCheckLessThan",(e,t)=>{ar.init(e,t);const r=Vp[typeof t.value];e._zod.onattach.push(n=>{const o=n._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),qp=Z("$ZodCheckGreaterThan",(e,t)=>{ar.init(e,t);const r=Vp[typeof t.value];e._zod.onattach.push(n=>{const o=n._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),YS=Z("$ZodCheckMultipleOf",(e,t)=>{ar.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Yw(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),qS=Z("$ZodCheckNumberFormat",(e,t)=>{ar.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),n=r?"int":"number",[o,s]=Qw[t.format];e._zod.onattach.push(i=>{const a=i._zod.bag;a.format=t.format,a.minimum=o,a.maximum=s,r&&(a.pattern=FS)}),e._zod.check=i=>{const a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort});return}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inst:e})}}),ZS=Z("$ZodCheckMaxLength",(e,t)=>{var r;ar.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Hc(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const o=n.value;if(o.length<=t.maximum)return;const i=Yc(o);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),GS=Z("$ZodCheckMinLength",(e,t)=>{var r;ar.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Hc(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const o=n.value;if(o.length>=t.minimum)return;const i=Yc(o);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),KS=Z("$ZodCheckLengthEquals",(e,t)=>{var r;ar.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Hc(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{const o=n.value,s=o.length;if(s===t.length)return;const i=Yc(o),a=s>t.length;n.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Zi=Z("$ZodCheckStringFormat",(e,t)=>{var r,n;ar.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),QS=Z("$ZodCheckRegex",(e,t)=>{Zi.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),XS=Z("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=HS),Zi.init(e,t)}),JS=Z("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=VS),Zi.init(e,t)}),eC=Z("$ZodCheckIncludes",(e,t)=>{ar.init(e,t);const r=Xn(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),tC=Z("$ZodCheckStartsWith",(e,t)=>{ar.init(e,t);const r=new RegExp(`^${Xn(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),rC=Z("$ZodCheckEndsWith",(e,t)=>{ar.init(e,t);const r=new RegExp(`.*${Xn(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),nC=Z("$ZodCheckOverwrite",(e,t)=>{ar.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class oC{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const n=t.split(`
161
161
  `).filter(i=>i),o=Math.min(...n.map(i=>i.length-i.trimStart().length)),s=n.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(const i of s)this.content.push(i)}compile(){const t=Function,r=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...r,o.join(`
162
162
  `))}}const sC={major:4,minor:1,patch:5},Mt=Z("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=sC;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const o of n)for(const s of o._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(i,a,c)=>{let l=Jn(i),d;for(const f of a){if(f._zod.def.when){if(!f._zod.def.when(i))continue}else if(l)continue;const h=i.issues.length,v=f._zod.check(i);if(v instanceof Promise&&c?.async===!1)throw new Kn;if(d||v instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await v,i.issues.length!==h&&(l||(l=Jn(i,h)))});else{if(i.issues.length===h)continue;l||(l=Jn(i,h))}}return d?d.then(()=>i):i},s=(i,a,c)=>{if(Jn(i))return i.aborted=!0,i;const l=o(a,n,c);if(l instanceof Promise){if(c.async===!1)throw new Kn;return l.then(d=>e._zod.parse(d,c))}return e._zod.parse(l,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){const l=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return l instanceof Promise?l.then(d=>s(d,i,a)):s(l,i,a)}const c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Kn;return c.then(l=>o(l,n,a))}return o(c,n,a)}}e["~standard"]={validate:o=>{try{const s=lS(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return uS(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),Zc=Z("$ZodString",(e,t)=>{Mt.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??BS(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),wt=Z("$ZodStringFormat",(e,t)=>{Zi.init(e,t),Zc.init(e,t)}),iC=Z("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=DS),wt.init(e,t)}),aC=Z("$ZodUUID",(e,t)=>{if(t.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Fp(n))}else t.pattern??(t.pattern=Fp());wt.init(e,t)}),cC=Z("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=kS),wt.init(e,t)}),lC=Z("$ZodURL",(e,t)=>{wt.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:RS.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),uC=Z("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=TS()),wt.init(e,t)}),dC=Z("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=CS),wt.init(e,t)}),fC=Z("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=bS),wt.init(e,t)}),pC=Z("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=xS),wt.init(e,t)}),hC=Z("$ZodULID",(e,t)=>{t.pattern??(t.pattern=_S),wt.init(e,t)}),mC=Z("$ZodXID",(e,t)=>{t.pattern??(t.pattern=wS),wt.init(e,t)}),gC=Z("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=SS),wt.init(e,t)}),vC=Z("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=zS(t)),wt.init(e,t)}),yC=Z("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=$S),wt.init(e,t)}),bC=Z("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=LS(t)),wt.init(e,t)}),xC=Z("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ES),wt.init(e,t)}),_C=Z("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=IS),wt.init(e,t),e._zod.onattach.push(r=>{const n=r._zod.bag;n.format="ipv4"})}),wC=Z("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=MS),wt.init(e,t),e._zod.onattach.push(r=>{const n=r._zod.bag;n.format="ipv6"}),e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),SC=Z("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=PS),wt.init(e,t)}),CC=Z("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=OS),wt.init(e,t),e._zod.check=r=>{const[n,o]=r.value.split("/");try{if(!o)throw new Error;const s=Number(o);if(`${s}`!==o)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Zp(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const EC=Z("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=jS),wt.init(e,t),e._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),e._zod.check=r=>{Zp(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function DC(e){if(!Wp.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Zp(r)}const kC=Z("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Wp),wt.init(e,t),e._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),e._zod.check=r=>{DC(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),AC=Z("$ZodE164",(e,t)=>{t.pattern??(t.pattern=NS),wt.init(e,t)});function TC(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const IC=Z("$ZodJWT",(e,t)=>{wt.init(e,t),e._zod.check=r=>{TC(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Gp=Z("$ZodNumber",(e,t)=>{Mt.init(e,t),e._zod.pattern=e._zod.bag.pattern??WS,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}const o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;const s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}}),MC=Z("$ZodNumber",(e,t)=>{qS.init(e,t),Gp.init(e,t)}),PC=Z("$ZodBoolean",(e,t)=>{Mt.init(e,t),e._zod.pattern=US,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}const o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),OC=Z("$ZodUnknown",(e,t)=>{Mt.init(e,t),e._zod.parse=r=>r}),jC=Z("$ZodNever",(e,t)=>{Mt.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Kp(e,t,r){e.issues.length&&t.issues.push(...zp(r,e.issues)),t.value[r]=e.value}const RC=Z("$ZodArray",(e,t)=>{Mt.init(e,t),e._zod.parse=(r,n)=>{const o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);const s=[];for(let i=0;i<o.length;i++){const a=o[i],c=t.element._zod.run({value:a,issues:[]},n);c instanceof Promise?s.push(c.then(l=>Kp(l,r,i))):Kp(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function Gi(e,t,r,n){e.issues.length&&t.issues.push(...zp(r,e.issues)),e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Qp(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape[n]._zod.traits.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const r=Kw(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Xp(e,t,r,n,o,s){const i=[],a=o.keySet,c=o.catchall._zod,l=c.def.type;for(const d of Object.keys(t)){if(a.has(d))continue;if(l==="never"){i.push(d);continue}const f=c.run({value:t[d],issues:[]},n);f instanceof Promise?e.push(f.then(h=>Gi(h,r,d,t))):Gi(f,r,d,t)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}const NC=Z("$ZodObject",(e,t)=>{Mt.init(e,t);const r=Uc(()=>Qp(t));gt(e._zod,"propValues",()=>{const i=t.shape,a={};for(const c in i){const l=i[c]._zod;if(l.values){a[c]??(a[c]=new Set);for(const d of l.values)a[c].add(d)}}return a});const n=Fi,o=t.catchall;let s;e._zod.parse=(i,a)=>{s??(s=r.value);const c=i.value;if(!n(c))return i.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),i;i.value={};const l=[],d=s.shape;for(const f of s.keys){const v=d[f]._zod.run({value:c[f],issues:[]},a);v instanceof Promise?l.push(v.then(m=>Gi(m,i,f,c))):Gi(v,i,f,c)}return o?Xp(l,c,i,a,r.value,e):l.length?Promise.all(l).then(()=>i):i}}),$C=Z("$ZodObjectJIT",(e,t)=>{NC.init(e,t);const r=e._zod.parse,n=Uc(()=>Qp(t)),o=h=>{const v=new oC(["shape","payload","ctx"]),m=n.value,p=E=>{const S=Np(E);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};v.write("const input = payload.value;");const b=Object.create(null);let w=0;for(const E of m.keys)b[E]=`key_${w++}`;v.write("const newResult = {}");for(const E of m.keys){const S=b[E],_=Np(E);v.write(`const ${S} = ${p(E)};`),v.write(`
163
163
  if (${S}.issues.length) {