Files
vben-app/web/dist/js/basic-BwP-QBBp.js
2026-10-01 17:05:05 +08:00

2 lines
65 KiB
JavaScript

var we=Object.defineProperty,be=Object.defineProperties;var Se=Object.getOwnPropertyDescriptors;var ee=Object.getOwnPropertySymbols;var ye=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable;var te=(s,e,t)=>e in s?we(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,_=(s,e)=>{for(var t in e||(e={}))ye.call(e,t)&&te(s,t,e[t]);if(ee)for(var t of ee(e))ve.call(e,t)&&te(s,t,e[t]);return s},L=(s,e)=>be(s,Se(e));var g=(s,e,t)=>new Promise((n,o)=>{var r=l=>{try{c(t.next(l))}catch(u){o(u)}},a=l=>{try{c(t.throw(l))}catch(u){o(u)}},c=l=>l.done?n(l.value):Promise.resolve(l.value).then(r,a);c((t=t.apply(s,e)).next())});import{$ as R,aA as le,be as he,aS as ue,aj as de,bf as Ce,E as ge,bg as ke,q as Ie,d as Ee,a as Te,V as ne,bh as Pe}from"./bootstrap-Dvp__AlY.js";import{e as Re,G as $e}from"./index-CxpPjm1h.js";import{h as xe}from"./index-DUhZmPwr.js";import{T as $,aa as De,aG as Ae,n as Me,a3 as He,a7 as fe,by as Ne,bz as Le,a0 as X,J as H,ar as We,aw as _e,x as P,aO as T,aq as S,as as Be,a$ as Ue,k as je,bY as j,a4 as V,a9 as Oe,aN as ze}from"../jse/index-index-D97IFaZ_.js";import{_ as Fe}from"./login.vue_vue_type_script_setup_true_lang-C5JXsio4.js";import{c as qe}from"./createLucideIcon-B9d-1YxK.js";import{_ as Ve,N as Je,a as Xe,b as Ke}from"./layout.vue_vue_type_script_setup_true_lang-Du4EvZGy.js";import{u as Ge}from"./use-modal-iXH0O8r_.js";import{_ as Ye}from"./avatar.vue_vue_type_script_setup_true_lang-DNmRJH43.js";import{J as Ze}from"./index-BxB7tkPU.js";import{C as Qe}from"./index-716VZXl8.js";import"./index-jihHkv57.js";import"./captcha-kpTg2ArF.js";import"./oauth-common-aTeJY-lH.js";import"./oauth-login.vue_vue_type_script_setup_true_lang-BhzpWc8o.js";import"./login.vue_vue_type_script_setup_true_lang-ByE81mGm.js";import"./auth-title-DUTB-FBf.js";import"./index-Daxo2R3k.js";import"./icon-button.vue_vue_type_script_setup_true_lang-BNfvxet2.js";import"./button.vue_vue_type_script_setup_true_lang-Cnud1zeX.js";import"./index-DAGJ8zqP.js";import"./tooltip.vue_vue_type_script_setup_true_lang-DLk_2tU2.js";import"./checkbox.vue_vue_type_script_setup_true_lang-DpRAqPyp.js";import"./use-vben-form-CzQERwQP.js";import"./render-content.vue_vue_type_script_lang-PQhVSt_C.js";import"./theme-toggle.vue_vue_type_script_setup_true_lang-BgDpPCxF.js";import"./icon.vue_vue_type_script_setup_true_lang-B47nGo6N.js";import"./TabsList.vue_vue_type_script_setup_true_lang-6XsdB6V-.js";import"./rotate-cw-C9mo1fdH.js";import"./use-tabs-_Cji5SS7.js";import"./chevrons-right-D3hiknXC.js";const et=qe("book-open-text",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M16 12h2",key:"7q9ll5"}],["path",{d:"M16 8h2",key:"msurwy"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}],["path",{d:"M6 12h2",key:"32wvfc"}],["path",{d:"M6 8h2",key:"30oboj"}]]),tt="data:image/svg+xml,%3csvg%20t='1727417479543'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='4291'%20width='64'%20height='64'%3e%3cpath%20d='M240%20658.08h220.784l55.744%2065.04%2055.744-65.04h220.768V272H240v386.08z%20m-48%2032V240a16%2016%200%200%201%2016-16h617.04a16%2016%200%200%201%2016%2016v450.08a16%2016%200%200%201-16%2016H594.336l-65.664%2076.64a16%2016%200%200%201-24.304%200l-65.664-76.64H208a16%2016%200%200%201-16-16zM366.256%20498.56a33.488%2033.488%200%201%201%200-66.992%2033.488%2033.488%200%200%201%200%2066.992z%20m150.272%200a33.488%2033.488%200%201%201%200-66.992%2033.488%2033.488%200%200%201%200%2066.992z%20m150.24%200a33.488%2033.488%200%201%201%200-66.992%2033.488%2033.488%200%200%201%200%2066.992z'%20fill='%231677ff'%20p-id='4292'%3e%3c/path%3e%3c/svg%3e",E=$(),oe=$(!1),O=$({advancedStyle:{colorStops:[{color:"gray",offset:0},{color:"gray",offset:1}],type:"linear"},content:"",contentType:"multi-line-text",globalAlpha:.25,gridLayoutOptions:{cols:2,gap:[20,20],matrix:[[1,0],[0,1]],rows:2},height:200,layout:"grid",rotate:30,width:160});function nt(){function s(n){return g(this,null,function*(){var r;const{Watermark:o}=yield He(()=>g(null,null,function*(){const{Watermark:a}=yield import("./index.esm-j49SPltB.js");return{Watermark:a}}),[]);O.value=_(_({},O.value),n),E.value=new o(O.value),yield(r=E.value)==null?void 0:r.create()})}function e(n){return g(this,null,function*(){var o;E.value?(yield Me(),yield(o=E.value)==null?void 0:o.changeOptions(_(_({},O.value),n))):yield s(n)})}function t(){E.value&&(E.value.destroy(),E.value=void 0)}return oe.value||(oe.value=!0,De(()=>{t()})),{destroyWatermark:t,updateWatermark:e,watermark:Ae(E)}}const ot=fe({name:"LoginExpiredModal",__name:"login-expired-modal",props:Ne({avatar:{default:""},zIndex:{default:0},codeLoginPath:{},forgetPasswordPath:{},loading:{type:Boolean},qrCodeLoginPath:{},registerPath:{},showCodeLogin:{type:Boolean},showForgetPassword:{type:Boolean},showQrcodeLogin:{type:Boolean},showRegister:{type:Boolean},showRememberMe:{type:Boolean},showThirdPartyLogin:{type:Boolean},subTitle:{},title:{},submitButtonText:{}},{open:{type:Boolean},openModifiers:{}}),emits:["update:open"],setup(s){const e=s,t=Le(s,"open"),[n,o]=Ge();X(()=>t.value,u=>{o.setState({isOpen:u})});const r=H(()=>e.zIndex||l()),a=["ant-message","loading"];function c(u){return a.some(h=>u.classList.contains(h))}function l(){let u=0;return[...document.querySelectorAll("*")].forEach(m=>{const y=window.getComputedStyle(m).getPropertyValue("z-index");y&&!Number.isNaN(Number.parseInt(y))&&!c(m)&&(u=Math.max(u,Number.parseInt(y)))}),u+1}return(u,h)=>(_e(),We("div",null,[P(S(n),{closable:!1,"close-on-click-modal":!1,"close-on-press-escape":!1,footer:!1,"fullscreen-button":!1,header:!1,"z-index":r.value,class:"border-none px-10 py-6 text-center shadow-xl sm:w-[600px] sm:rounded-2xl md:h-[unset]"},{default:T(()=>[P(S(Ye),{src:s.avatar,class:"mx-auto mb-6 size-20"},null,8,["src"]),P(S(Ze),{"show-forget-password":!1,"show-register":!1,"show-remember-me":!1,"sub-title":S(R)("authentication.loginAgainSubTitle"),title:S(R)("authentication.loginAgainTitle")},{default:T(()=>[Be(u.$slots,"default")]),_:3},8,["sub-title","title"])]),_:3},8,["z-index"])]))}});class x extends Error{constructor(e,t){const n=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=n}}class K extends Error{constructor(e="A timeout occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class k extends Error{constructor(e="An abort occurred."){const t=new.target.prototype;super(e),this.__proto__=t}}class st extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=n}}class rt extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=n}}class it extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=n}}class se extends Error{constructor(e){const t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}}class at extends Error{constructor(e,t){const n=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=n}}class pe{constructor(e,t,n){this.statusCode=e,this.statusText=t,this.content=n}}class q{get(e,t){return this.send(L(_({},t),{method:"GET",url:e}))}post(e,t){return this.send(L(_({},t),{method:"POST",url:e}))}delete(e,t){return this.send(L(_({},t),{method:"DELETE",url:e}))}getCookieString(e){return""}}var i;(function(s){s[s.Trace=0]="Trace",s[s.Debug=1]="Debug",s[s.Information=2]="Information",s[s.Warning=3]="Warning",s[s.Error=4]="Error",s[s.Critical=5]="Critical",s[s.None=6]="None"})(i||(i={}));class W{constructor(){}log(e,t){}}W.instance=new W;const ct="8.0.17";class b{static isRequired(e,t){if(e==null)throw new Error(`The '${t}' argument is required.`)}static isNotEmpty(e,t){if(!e||e.match(/^\s*$/))throw new Error(`The '${t}' argument should not be empty.`)}static isIn(e,t,n){if(!(e in t))throw new Error(`Unknown ${n} value: ${e}.`)}}class p{static get isBrowser(){return!p.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!p.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!p.isNode&&typeof window=="object"&&typeof window.document=="undefined"}static get isNode(){return typeof process!="undefined"&&process.release&&process.release.name==="node"}}function B(s,e){let t="";return A(s)?(t=`Binary data of length ${s.byteLength}`,e&&(t+=`. Content: '${lt(s)}'`)):typeof s=="string"&&(t=`String data of length ${s.length}`,e&&(t+=`. Content: '${s}'`)),t}function lt(s){const e=new Uint8Array(s);let t="";return e.forEach(n=>{const o=n<16?"0":"";t+=`0x${o}${n.toString(16)} `}),t.substr(0,t.length-1)}function A(s){return s&&typeof ArrayBuffer!="undefined"&&(s instanceof ArrayBuffer||s.constructor&&s.constructor.name==="ArrayBuffer")}function me(s,e,t,n,o,r){return g(this,null,function*(){const a={},[c,l]=N();a[c]=l,s.log(i.Trace,`(${e} transport) sending data. ${B(o,r.logMessageContent)}.`);const u=A(o)?"arraybuffer":"text",h=yield t.post(n,{content:o,headers:_(_({},a),r.headers),responseType:u,timeout:r.timeout,withCredentials:r.withCredentials});s.log(i.Trace,`(${e} transport) request complete. Response status: ${h.statusCode}.`)})}function ht(s){return s===void 0?new F(i.Information):s===null?W.instance:s.log!==void 0?s:new F(s)}class ut{constructor(e,t){this._subject=e,this._observer=t}dispose(){const e=this._subject.observers.indexOf(this._observer);e>-1&&this._subject.observers.splice(e,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(t=>{})}}class F{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){const n=`[${new Date().toISOString()}] ${i[e]}: ${t}`;switch(e){case i.Critical:case i.Error:this.out.error(n);break;case i.Warning:this.out.warn(n);break;case i.Information:this.out.info(n);break;default:this.out.log(n);break}}}}function N(){let s="X-SignalR-User-Agent";return p.isNode&&(s="User-Agent"),[s,dt(ct,gt(),_t(),ft())]}function dt(s,e,t,n){let o="Microsoft SignalR/";const r=s.split(".");return o+=`${r[0]}.${r[1]}`,o+=` (${s}; `,e&&e!==""?o+=`${e}; `:o+="Unknown OS; ",o+=`${t}`,n?o+=`; ${n}`:o+="; Unknown Runtime Version",o+=")",o}function gt(){if(p.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function ft(){if(p.isNode)return process.versions.node}function _t(){return p.isNode?"NodeJS":"Browser"}function J(s){return s.stack?s.stack:s.message?s.message:`${s}`}function pt(){if(typeof globalThis!="undefined")return globalThis;if(typeof self!="undefined")return self;if(typeof window!="undefined")return window;if(typeof global!="undefined")return global;throw new Error("could not find global")}class mt extends q{constructor(e){if(super(),this._logger=e,typeof fetch=="undefined"||p.isNode){const t=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._jar=new(t("tough-cookie")).CookieJar,typeof fetch=="undefined"?this._fetchType=t("node-fetch"):this._fetchType=fetch,this._fetchType=t("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(pt());if(typeof AbortController=="undefined"){const t=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._abortControllerType=t("abort-controller")}else this._abortControllerType=AbortController}send(e){return g(this,null,function*(){if(e.abortSignal&&e.abortSignal.aborted)throw new k;if(!e.method)throw new Error("No method defined.");if(!e.url)throw new Error("No url defined.");const t=new this._abortControllerType;let n;e.abortSignal&&(e.abortSignal.onabort=()=>{t.abort(),n=new k});let o=null;if(e.timeout){const l=e.timeout;o=setTimeout(()=>{t.abort(),this._logger.log(i.Warning,"Timeout from HTTP request."),n=new K},l)}e.content===""&&(e.content=void 0),e.content&&(e.headers=e.headers||{},A(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");let r;try{r=yield this._fetchType(e.url,{body:e.content,cache:"no-cache",credentials:e.withCredentials===!0?"include":"same-origin",headers:_({"X-Requested-With":"XMLHttpRequest"},e.headers),method:e.method,mode:"cors",redirect:"follow",signal:t.signal})}catch(l){throw n||(this._logger.log(i.Warning,`Error from HTTP request. ${l}.`),l)}finally{o&&clearTimeout(o),e.abortSignal&&(e.abortSignal.onabort=null)}if(!r.ok){const l=yield re(r,"text");throw new x(l||r.statusText,r.status)}const c=yield re(r,e.responseType);return new pe(r.status,r.statusText,c)})}getCookieString(e){let t="";return p.isNode&&this._jar&&this._jar.getCookies(e,(n,o)=>t=o.join("; ")),t}}function re(s,e){let t;switch(e){case"arraybuffer":t=s.arrayBuffer();break;case"text":t=s.text();break;case"blob":case"document":case"json":throw new Error(`${e} is not supported.`);default:t=s.text();break}return t}class wt extends q{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new k):e.method?e.url?new Promise((t,n)=>{const o=new XMLHttpRequest;o.open(e.method,e.url,!0),o.withCredentials=e.withCredentials===void 0?!0:e.withCredentials,o.setRequestHeader("X-Requested-With","XMLHttpRequest"),e.content===""&&(e.content=void 0),e.content&&(A(e.content)?o.setRequestHeader("Content-Type","application/octet-stream"):o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const r=e.headers;r&&Object.keys(r).forEach(a=>{o.setRequestHeader(a,r[a])}),e.responseType&&(o.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{o.abort(),n(new k)}),e.timeout&&(o.timeout=e.timeout),o.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),o.status>=200&&o.status<300?t(new pe(o.status,o.statusText,o.response||o.responseText)):n(new x(o.response||o.responseText||o.statusText,o.status))},o.onerror=()=>{this._logger.log(i.Warning,`Error from HTTP request. ${o.status}: ${o.statusText}.`),n(new x(o.statusText,o.status))},o.ontimeout=()=>{this._logger.log(i.Warning,"Timeout from HTTP request."),n(new K)},o.send(e.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class bt extends q{constructor(e){if(super(),typeof fetch!="undefined"||p.isNode)this._httpClient=new mt(e);else if(typeof XMLHttpRequest!="undefined")this._httpClient=new wt(e);else throw new Error("No usable HttpClient found.")}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new k):e.method?e.url?this._httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(e){return this._httpClient.getCookieString(e)}}class C{static write(e){return`${e}${C.RecordSeparator}`}static parse(e){if(e[e.length-1]!==C.RecordSeparator)throw new Error("Message is incomplete.");const t=e.split(C.RecordSeparator);return t.pop(),t}}C.RecordSeparatorCode=30;C.RecordSeparator=String.fromCharCode(C.RecordSeparatorCode);class St{writeHandshakeRequest(e){return C.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,n;if(A(e)){const c=new Uint8Array(e),l=c.indexOf(C.RecordSeparatorCode);if(l===-1)throw new Error("Message is incomplete.");const u=l+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(c.slice(0,u))),n=c.byteLength>u?c.slice(u).buffer:null}else{const c=e,l=c.indexOf(C.RecordSeparator);if(l===-1)throw new Error("Message is incomplete.");const u=l+1;t=c.substring(0,u),n=c.length>u?c.substring(u):null}const o=C.parse(t),r=JSON.parse(o[0]);if(r.type)throw new Error("Expected a handshake response from the server.");return[n,r]}}var d;(function(s){s[s.Invocation=1]="Invocation",s[s.StreamItem=2]="StreamItem",s[s.Completion=3]="Completion",s[s.StreamInvocation=4]="StreamInvocation",s[s.CancelInvocation=5]="CancelInvocation",s[s.Ping=6]="Ping",s[s.Close=7]="Close",s[s.Ack=8]="Ack",s[s.Sequence=9]="Sequence"})(d||(d={}));class yt{constructor(){this.observers=[]}next(e){for(const t of this.observers)t.next(e)}error(e){for(const t of this.observers)t.error&&t.error(e)}complete(){for(const e of this.observers)e.complete&&e.complete()}subscribe(e){return this.observers.push(e),new ut(this,e)}}class vt{constructor(e,t,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=e,this._connection=t,this._bufferSize=n}_send(e){return g(this,null,function*(){const t=this._protocol.writeMessage(e);let n=Promise.resolve();if(this._isInvocationMessage(e)){this._totalMessageCount++;let o=()=>{},r=()=>{};A(t)?this._bufferedByteCount+=t.byteLength:this._bufferedByteCount+=t.length,this._bufferedByteCount>=this._bufferSize&&(n=new Promise((a,c)=>{o=a,r=c})),this._messages.push(new Ct(t,this._totalMessageCount,o,r))}try{this._reconnectInProgress||(yield this._connection.send(t))}catch(o){this._disconnected()}yield n})}_ack(e){let t=-1;for(let n=0;n<this._messages.length;n++){const o=this._messages[n];if(o._id<=e.sequenceId)t=n,A(o._message)?this._bufferedByteCount-=o._message.byteLength:this._bufferedByteCount-=o._message.length,o._resolver();else if(this._bufferedByteCount<this._bufferSize)o._resolver();else break}t!==-1&&(this._messages=this._messages.slice(t+1))}_shouldProcessMessage(e){if(this._waitForSequenceMessage)return e.type!==d.Sequence?!1:(this._waitForSequenceMessage=!1,!0);if(!this._isInvocationMessage(e))return!0;const t=this._nextReceivingSequenceId;return this._nextReceivingSequenceId++,t<=this._latestReceivedSequenceId?(t===this._latestReceivedSequenceId&&this._ackTimer(),!1):(this._latestReceivedSequenceId=t,this._ackTimer(),!0)}_resetSequence(e){if(e.sequenceId>this._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=e.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}_resend(){return g(this,null,function*(){const e=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;yield this._connection.send(this._protocol.writeMessage({type:d.Sequence,sequenceId:e}));const t=this._messages;for(const n of t)yield this._connection.send(n._message);this._reconnectInProgress=!1})}_dispose(e){e!=null||(e=new Error("Unable to reconnect to server."));for(const t of this._messages)t._rejector(e)}_isInvocationMessage(e){switch(e.type){case d.Invocation:case d.StreamItem:case d.Completion:case d.StreamInvocation:case d.CancelInvocation:return!0;case d.Close:case d.Sequence:case d.Ping:case d.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(()=>g(this,null,function*(){try{this._reconnectInProgress||(yield this._connection.send(this._protocol.writeMessage({type:d.Ack,sequenceId:this._latestReceivedSequenceId})))}catch(e){}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0}),1e3))}}class Ct{constructor(e,t,n,o){this._message=e,this._id=t,this._resolver=n,this._rejector=o}}const kt=30*1e3,It=15*1e3,Et=1e5;var f;(function(s){s.Disconnected="Disconnected",s.Connecting="Connecting",s.Connected="Connected",s.Disconnecting="Disconnecting",s.Reconnecting="Reconnecting"})(f||(f={}));class G{static create(e,t,n,o,r,a,c){return new G(e,t,n,o,r,a,c)}constructor(e,t,n,o,r,a,c){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(i.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")},b.isRequired(e,"connection"),b.isRequired(t,"logger"),b.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=r!=null?r:kt,this.keepAliveIntervalInMilliseconds=a!=null?a:It,this._statefulReconnectBufferSize=c!=null?c:Et,this._logger=t,this._protocol=n,this.connection=e,this._reconnectPolicy=o,this._handshakeProtocol=new St,this.connection.onreceive=l=>this._processIncomingData(l),this.connection.onclose=l=>this._connectionClosed(l),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=f.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:d.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(e){if(this._connectionState!==f.Disconnected&&this._connectionState!==f.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!e)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=e}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}_startWithStateTransitions(){return g(this,null,function*(){if(this._connectionState!==f.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=f.Connecting,this._logger.log(i.Debug,"Starting HubConnection.");try{yield this._startInternal(),p.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=f.Connected,this._connectionStarted=!0,this._logger.log(i.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=f.Disconnected,this._logger.log(i.Debug,`HubConnection failed to start successfully because of error '${e}'.`),Promise.reject(e)}})}_startInternal(){return g(this,null,function*(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;const e=new Promise((t,n)=>{this._handshakeResolver=t,this._handshakeRejecter=n});yield this.connection.start(this._protocol.transferFormat);try{let t=this._protocol.version;this.connection.features.reconnect||(t=1);const n={protocol:this._protocol.name,version:t};if(this._logger.log(i.Debug,"Sending handshake request."),yield this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(n)),this._logger.log(i.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),yield e,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new vt(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||(yield this._sendMessage(this._cachedPingMessage))}catch(t){throw this._logger.log(i.Debug,`Hub handshake failed with error '${t}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),yield this.connection.stop(t),t}})}stop(){return g(this,null,function*(){const e=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),yield this._stopPromise;try{yield e}catch(t){}})}_stopInternal(e){if(this._connectionState===f.Disconnected)return this._logger.log(i.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===f.Disconnecting)return this._logger.log(i.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;const t=this._connectionState;return this._connectionState=f.Disconnecting,this._logger.log(i.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(i.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(t===f.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new k("The connection was stopped before the hub handshake could complete."),this.connection.stop(e))}_sendCloseMessage(){return g(this,null,function*(){try{yield this._sendWithProtocol(this._createCloseMessage())}catch(e){}})}stream(e,...t){const[n,o]=this._replaceStreamingParams(t),r=this._createStreamInvocation(e,t,o);let a;const c=new yt;return c.cancelCallback=()=>{const l=this._createCancelInvocation(r.invocationId);return delete this._callbacks[r.invocationId],a.then(()=>this._sendWithProtocol(l))},this._callbacks[r.invocationId]=(l,u)=>{if(u){c.error(u);return}else l&&(l.type===d.Completion?l.error?c.error(new Error(l.error)):c.complete():c.next(l.item))},a=this._sendWithProtocol(r).catch(l=>{c.error(l),delete this._callbacks[r.invocationId]}),this._launchStreams(n,a),c}_sendMessage(e){return this._resetKeepAliveInterval(),this.connection.send(e)}_sendWithProtocol(e){return this._messageBuffer?this._messageBuffer._send(e):this._sendMessage(this._protocol.writeMessage(e))}send(e,...t){const[n,o]=this._replaceStreamingParams(t),r=this._sendWithProtocol(this._createInvocation(e,t,!0,o));return this._launchStreams(n,r),r}invoke(e,...t){const[n,o]=this._replaceStreamingParams(t),r=this._createInvocation(e,t,!1,o);return new Promise((c,l)=>{this._callbacks[r.invocationId]=(h,m)=>{if(m){l(m);return}else h&&(h.type===d.Completion?h.error?l(new Error(h.error)):c(h.result):l(new Error(`Unexpected message type: ${h.type}`)))};const u=this._sendWithProtocol(r).catch(h=>{l(h),delete this._callbacks[r.invocationId]});this._launchStreams(n,u)})}on(e,t){!e||!t||(e=e.toLowerCase(),this._methods[e]||(this._methods[e]=[]),this._methods[e].indexOf(t)===-1&&this._methods[e].push(t))}off(e,t){if(!e)return;e=e.toLowerCase();const n=this._methods[e];if(n)if(t){const o=n.indexOf(t);o!==-1&&(n.splice(o,1),n.length===0&&delete this._methods[e])}else delete this._methods[e]}onclose(e){e&&this._closedCallbacks.push(e)}onreconnecting(e){e&&this._reconnectingCallbacks.push(e)}onreconnected(e){e&&this._reconnectedCallbacks.push(e)}_processIncomingData(e){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(e=this._processHandshakeResponse(e),this._receivedHandshakeResponse=!0),e){const t=this._protocol.parseMessages(e,this._logger);for(const n of t)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(n)))switch(n.type){case d.Invocation:this._invokeClientMethod(n).catch(o=>{this._logger.log(i.Error,`Invoke client method threw error: ${J(o)}`)});break;case d.StreamItem:case d.Completion:{const o=this._callbacks[n.invocationId];if(o){n.type===d.Completion&&delete this._callbacks[n.invocationId];try{o(n)}catch(r){this._logger.log(i.Error,`Stream callback threw error: ${J(r)}`)}}break}case d.Ping:break;case d.Close:{this._logger.log(i.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 d.Ack:this._messageBuffer&&this._messageBuffer._ack(n);break;case d.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(n);break;default:this._logger.log(i.Warning,`Invalid message type: ${n.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(e){let t,n;try{[n,t]=this._handshakeProtocol.parseHandshakeResponse(e)}catch(o){const r="Error parsing handshake response: "+o;this._logger.log(i.Error,r);const a=new Error(r);throw this._handshakeRejecter(a),a}if(t.error){const o="Server returned handshake error: "+t.error;this._logger.log(i.Error,o);const r=new Error(o);throw this._handshakeRejecter(r),r}else this._logger.log(i.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),this._pingServerHandle===void 0)){let e=this._nextKeepAlive-new Date().getTime();e<0&&(e=0),this._pingServerHandle=setTimeout(()=>g(this,null,function*(){if(this._connectionState===f.Connected)try{yield this._sendMessage(this._cachedPingMessage)}catch(t){this._cleanupPingTimer()}}),e)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}_invokeClientMethod(e){return g(this,null,function*(){const t=e.target.toLowerCase(),n=this._methods[t];if(!n){this._logger.log(i.Warning,`No client method with the name '${t}' found.`),e.invocationId&&(this._logger.log(i.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),yield this._sendWithProtocol(this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)));return}const o=n.slice(),r=!!e.invocationId;let a,c,l;for(const u of o)try{const h=a;a=yield u.apply(this,e.arguments),r&&a&&h&&(this._logger.log(i.Error,`Multiple results provided for '${t}'. Sending error to server.`),l=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),c=void 0}catch(h){c=h,this._logger.log(i.Error,`A callback for the method '${t}' threw error '${h}'.`)}l?yield this._sendWithProtocol(l):r?(c?l=this._createCompletionMessage(e.invocationId,`${c}`,null):a!==void 0?l=this._createCompletionMessage(e.invocationId,null,a):(this._logger.log(i.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),l=this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)),yield this._sendWithProtocol(l)):a&&this._logger.log(i.Error,`Result given for '${t}' method but server is not expecting a result.`)})}_connectionClosed(e){this._logger.log(i.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new k("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(e||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===f.Disconnecting?this._completeClose(e):this._connectionState===f.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===f.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=f.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(e!=null?e:new Error("Connection closed.")),this._messageBuffer=void 0),p.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(t=>t.apply(this,[e]))}catch(t){this._logger.log(i.Error,`An onclose callback called with error '${e}' threw error '${t}'.`)}}}_reconnect(e){return g(this,null,function*(){const t=Date.now();let n=0,o=e!==void 0?e:new Error("Attempting to reconnect due to a unknown error."),r=this._getNextRetryDelay(n++,0,o);if(r===null){this._logger.log(i.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(e);return}if(this._connectionState=f.Reconnecting,e?this._logger.log(i.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(i.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(a=>a.apply(this,[e]))}catch(a){this._logger.log(i.Error,`An onreconnecting callback called with error '${e}' threw error '${a}'.`)}if(this._connectionState!==f.Reconnecting){this._logger.log(i.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;r!==null;){if(this._logger.log(i.Information,`Reconnect attempt number ${n} will start in ${r} ms.`),yield new Promise(a=>{this._reconnectDelayHandle=setTimeout(a,r)}),this._reconnectDelayHandle=void 0,this._connectionState!==f.Reconnecting){this._logger.log(i.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(yield this._startInternal(),this._connectionState=f.Connected,this._logger.log(i.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(a=>a.apply(this,[this.connection.connectionId]))}catch(a){this._logger.log(i.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${a}'.`)}return}catch(a){if(this._logger.log(i.Information,`Reconnect attempt failed because of error '${a}'.`),this._connectionState!==f.Reconnecting){this._logger.log(i.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===f.Disconnecting&&this._completeClose();return}o=a instanceof Error?a:new Error(a.toString()),r=this._getNextRetryDelay(n++,Date.now()-t,o)}}this._logger.log(i.Information,`Reconnect retries have been exhausted after ${Date.now()-t} ms and ${n} failed attempts. Connection disconnecting.`),this._completeClose()})}_getNextRetryDelay(e,t,n){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:t,previousRetryCount:e,retryReason:n})}catch(o){return this._logger.log(i.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${e}, ${t}) threw error '${o}'.`),null}}_cancelCallbacksWithError(e){const t=this._callbacks;this._callbacks={},Object.keys(t).forEach(n=>{const o=t[n];try{o(null,e)}catch(r){this._logger.log(i.Error,`Stream 'error' callback called with '${e}' threw error: ${J(r)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(e,t,n,o){if(n)return o.length!==0?{arguments:t,streamIds:o,target:e,type:d.Invocation}:{arguments:t,target:e,type:d.Invocation};{const r=this._invocationId;return this._invocationId++,o.length!==0?{arguments:t,invocationId:r.toString(),streamIds:o,target:e,type:d.Invocation}:{arguments:t,invocationId:r.toString(),target:e,type:d.Invocation}}}_launchStreams(e,t){if(e.length!==0){t||(t=Promise.resolve());for(const n in e)e[n].subscribe({complete:()=>{t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(n)))},error:o=>{let r;o instanceof Error?r=o.message:o&&o.toString?r=o.toString():r="Unknown error",t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(n,r)))},next:o=>{t=t.then(()=>this._sendWithProtocol(this._createStreamItemMessage(n,o)))}})}}_replaceStreamingParams(e){const t=[],n=[];for(let o=0;o<e.length;o++){const r=e[o];if(this._isObservable(r)){const a=this._invocationId;this._invocationId++,t[a]=r,n.push(a.toString()),e.splice(o,1)}}return[t,n]}_isObservable(e){return e&&e.subscribe&&typeof e.subscribe=="function"}_createStreamInvocation(e,t,n){const o=this._invocationId;return this._invocationId++,n.length!==0?{arguments:t,invocationId:o.toString(),streamIds:n,target:e,type:d.StreamInvocation}:{arguments:t,invocationId:o.toString(),target:e,type:d.StreamInvocation}}_createCancelInvocation(e){return{invocationId:e,type:d.CancelInvocation}}_createStreamItemMessage(e,t){return{invocationId:e,item:t,type:d.StreamItem}}_createCompletionMessage(e,t,n){return t?{error:t,invocationId:e,type:d.Completion}:{invocationId:e,result:n,type:d.Completion}}_createCloseMessage(){return{type:d.Close}}}const Tt=[0,2e3,1e4,3e4,null];class ie{constructor(e){this._retryDelays=e!==void 0?[...e,null]:Tt}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}}class D{}D.Authorization="Authorization";D.Cookie="Cookie";class Pt extends q{constructor(e,t){super(),this._innerClient=e,this._accessTokenFactory=t}send(e){return g(this,null,function*(){let t=!0;this._accessTokenFactory&&(!this._accessToken||e.url&&e.url.indexOf("/negotiate?")>0)&&(t=!1,this._accessToken=yield this._accessTokenFactory()),this._setAuthorizationHeader(e);const n=yield this._innerClient.send(e);return t&&n.statusCode===401&&this._accessTokenFactory?(this._accessToken=yield this._accessTokenFactory(),this._setAuthorizationHeader(e),yield this._innerClient.send(e)):n})}_setAuthorizationHeader(e){e.headers||(e.headers={}),this._accessToken?e.headers[D.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[D.Authorization]&&delete e.headers[D.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}}var w;(function(s){s[s.None=0]="None",s[s.WebSockets=1]="WebSockets",s[s.ServerSentEvents=2]="ServerSentEvents",s[s.LongPolling=4]="LongPolling"})(w||(w={}));var v;(function(s){s[s.Text=1]="Text",s[s.Binary=2]="Binary"})(v||(v={}));let Rt=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 ae{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,n){this._httpClient=e,this._logger=t,this._pollAbort=new Rt,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}connect(e,t){return g(this,null,function*(){if(b.isRequired(e,"url"),b.isRequired(t,"transferFormat"),b.isIn(t,v,"transferFormat"),this._url=e,this._logger.log(i.Trace,"(LongPolling transport) Connecting."),t===v.Binary&&typeof XMLHttpRequest!="undefined"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[n,o]=N(),r=_({[n]:o},this._options.headers),a={abortSignal:this._pollAbort.signal,headers:r,timeout:1e5,withCredentials:this._options.withCredentials};t===v.Binary&&(a.responseType="arraybuffer");const c=`${e}&_=${Date.now()}`;this._logger.log(i.Trace,`(LongPolling transport) polling: ${c}.`);const l=yield this._httpClient.get(c,a);l.statusCode!==200?(this._logger.log(i.Error,`(LongPolling transport) Unexpected response code: ${l.statusCode}.`),this._closeError=new x(l.statusText||"",l.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,a)})}_poll(e,t){return g(this,null,function*(){try{for(;this._running;)try{const n=`${e}&_=${Date.now()}`;this._logger.log(i.Trace,`(LongPolling transport) polling: ${n}.`);const o=yield this._httpClient.get(n,t);o.statusCode===204?(this._logger.log(i.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):o.statusCode!==200?(this._logger.log(i.Error,`(LongPolling transport) Unexpected response code: ${o.statusCode}.`),this._closeError=new x(o.statusText||"",o.statusCode),this._running=!1):o.content?(this._logger.log(i.Trace,`(LongPolling transport) data received. ${B(o.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(o.content)):this._logger.log(i.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(n){this._running?n instanceof K?this._logger.log(i.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=n,this._running=!1):this._logger.log(i.Trace,`(LongPolling transport) Poll errored after shutdown: ${n.message}`)}}finally{this._logger.log(i.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}})}send(e){return g(this,null,function*(){return this._running?me(this._logger,"LongPolling",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))})}stop(){return g(this,null,function*(){this._logger.log(i.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{yield this._receiving,this._logger.log(i.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[t,n]=N();e[t]=n;const o={headers:_(_({},e),this._options.headers),timeout:this._options.timeout,withCredentials:this._options.withCredentials};let r;try{yield this._httpClient.delete(this._url,o)}catch(a){r=a}r?r instanceof x&&(r.statusCode===404?this._logger.log(i.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(i.Trace,`(LongPolling transport) Error sending a DELETE request: ${r}`)):this._logger.log(i.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(i.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}})}_raiseOnClose(){if(this.onclose){let e="(LongPolling transport) Firing onclose event.";this._closeError&&(e+=" Error: "+this._closeError),this._logger.log(i.Trace,e),this.onclose(this._closeError)}}}class $t{constructor(e,t,n,o){this._httpClient=e,this._accessToken=t,this._logger=n,this._options=o,this.onreceive=null,this.onclose=null}connect(e,t){return g(this,null,function*(){return b.isRequired(e,"url"),b.isRequired(t,"transferFormat"),b.isIn(t,v,"transferFormat"),this._logger.log(i.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((n,o)=>{let r=!1;if(t!==v.Text){o(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let a;if(p.isBrowser||p.isWebWorker)a=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{const c=this._httpClient.getCookieString(e),l={};l.Cookie=c;const[u,h]=N();l[u]=h,a=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:_(_({},l),this._options.headers)})}try{a.onmessage=c=>{if(this.onreceive)try{this._logger.log(i.Trace,`(SSE transport) data received. ${B(c.data,this._options.logMessageContent)}.`),this.onreceive(c.data)}catch(l){this._close(l);return}},a.onerror=c=>{r?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."))},a.onopen=()=>{this._logger.log(i.Information,`SSE connected to ${this._url}`),this._eventSource=a,r=!0,n()}}catch(c){o(c);return}})})}send(e){return g(this,null,function*(){return this._eventSource?me(this._logger,"SSE",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))})}stop(){return this._close(),Promise.resolve()}_close(e){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(e))}}class xt{constructor(e,t,n,o,r,a){this._logger=n,this._accessTokenFactory=t,this._logMessageContent=o,this._webSocketConstructor=r,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=a}connect(e,t){return g(this,null,function*(){b.isRequired(e,"url"),b.isRequired(t,"transferFormat"),b.isIn(t,v,"transferFormat"),this._logger.log(i.Trace,"(WebSockets transport) Connecting.");let n;return this._accessTokenFactory&&(n=yield this._accessTokenFactory()),new Promise((o,r)=>{e=e.replace(/^http/,"ws");let a;const c=this._httpClient.getCookieString(e);let l=!1;if(p.isNode||p.isReactNative){const u={},[h,m]=N();u[h]=m,n&&(u[D.Authorization]=`Bearer ${n}`),c&&(u[D.Cookie]=c),a=new this._webSocketConstructor(e,void 0,{headers:_(_({},u),this._headers)})}else n&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(n)}`);a||(a=new this._webSocketConstructor(e)),t===v.Binary&&(a.binaryType="arraybuffer"),a.onopen=u=>{this._logger.log(i.Information,`WebSocket connected to ${e}.`),this._webSocket=a,l=!0,o()},a.onerror=u=>{let h=null;typeof ErrorEvent!="undefined"&&u instanceof ErrorEvent?h=u.error:h="There was an error with the transport",this._logger.log(i.Information,`(WebSockets transport) ${h}.`)},a.onmessage=u=>{if(this._logger.log(i.Trace,`(WebSockets transport) data received. ${B(u.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(u.data)}catch(h){this._close(h);return}},a.onclose=u=>{if(l)this._close(u);else{let h=null;typeof ErrorEvent!="undefined"&&u instanceof ErrorEvent?h=u.error:h="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.",r(new Error(h))}}})})}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(i.Trace,`(WebSockets transport) sending data. ${B(e,this._logMessageContent)}.`),this._webSocket.send(e),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(e){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(i.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(e)&&(e.wasClean===!1||e.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${e.code} (${e.reason||"no reason given"}).`)):e instanceof Error?this.onclose(e):this.onclose())}_isCloseEvent(e){return e&&typeof e.wasClean=="boolean"&&typeof e.code=="number"}}const ce=100;class Dt{constructor(e,t={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,b.isRequired(e,"url"),this._logger=ht(t.logger),this.baseUrl=this._resolveUrl(e),t=t||{},t.logMessageContent=t.logMessageContent===void 0?!1:t.logMessageContent,typeof t.withCredentials=="boolean"||t.withCredentials===void 0)t.withCredentials=t.withCredentials===void 0?!0:t.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");t.timeout=t.timeout===void 0?100*1e3:t.timeout;let n=null,o=null;if(p.isNode&&typeof require!="undefined"){const r=typeof __webpack_require__=="function"?__non_webpack_require__:require;n=r("ws"),o=r("eventsource")}!p.isNode&&typeof WebSocket!="undefined"&&!t.WebSocket?t.WebSocket=WebSocket:p.isNode&&!t.WebSocket&&n&&(t.WebSocket=n),!p.isNode&&typeof EventSource!="undefined"&&!t.EventSource?t.EventSource=EventSource:p.isNode&&!t.EventSource&&typeof o!="undefined"&&(t.EventSource=o),this._httpClient=new Pt(t.httpClient||new bt(this._logger),t.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=t,this.onreceive=null,this.onclose=null}start(e){return g(this,null,function*(){if(e=e||v.Binary,b.isIn(e,v,"transferFormat"),this._logger.log(i.Debug,`Starting connection with transfer format '${v[e]}'.`),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(e),yield this._startInternalPromise,this._connectionState==="Disconnecting"){const t="Failed to start the HttpConnection before stop() was called.";return this._logger.log(i.Error,t),yield this._stopPromise,Promise.reject(new k(t))}else if(this._connectionState!=="Connected"){const t="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(i.Error,t),Promise.reject(new k(t))}this._connectionStarted=!0})}send(e){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 Y(this.transport)),this._sendQueue.send(e))}stop(e){return g(this,null,function*(){if(this._connectionState==="Disconnected")return this._logger.log(i.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(i.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(t=>{this._stopPromiseResolver=t}),yield this._stopInternal(e),yield this._stopPromise})}_stopInternal(e){return g(this,null,function*(){this._stopError=e;try{yield this._startInternalPromise}catch(t){}if(this.transport){try{yield this.transport.stop()}catch(t){this._logger.log(i.Error,`HttpConnection.transport.stop() threw error '${t}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(i.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")})}_startInternal(e){return g(this,null,function*(){let t=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===w.WebSockets)this.transport=this._constructTransport(w.WebSockets),yield this._startTransport(t,e);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let n=null,o=0;do{if(n=yield this._getNegotiationResponse(t),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new k("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&&(t=n.url),n.accessToken){const r=n.accessToken;this._accessTokenFactory=()=>r,this._httpClient._accessToken=r,this._httpClient._accessTokenFactory=void 0}o++}while(n.url&&o<ce);if(o===ce&&n.url)throw new Error("Negotiate redirection limit exceeded.");yield this._createTransport(t,this._options.transport,n,e)}this.transport instanceof ae&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(i.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(n){return this._logger.log(i.Error,"Failed to start the connection: "+n),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(n)}})}_getNegotiationResponse(e){return g(this,null,function*(){const t={},[n,o]=N();t[n]=o;const r=this._resolveNegotiateUrl(e);this._logger.log(i.Debug,`Sending negotiation request: ${r}.`);try{const a=yield this._httpClient.post(r,{content:"",headers:_(_({},t),this._options.headers),timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(a.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${a.statusCode}'`));const c=JSON.parse(a.content);return(!c.negotiateVersion||c.negotiateVersion<1)&&(c.connectionToken=c.connectionId),c.useStatefulReconnect&&this._options._useStatefulReconnect!==!0?Promise.reject(new se("Client didn't negotiate Stateful Reconnect but the server did.")):c}catch(a){let c="Failed to complete negotiation with the server: "+a;return a instanceof x&&a.statusCode===404&&(c=c+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(i.Error,c),Promise.reject(new se(c))}})}_createConnectUrl(e,t){return t?e+(e.indexOf("?")===-1?"?":"&")+`id=${t}`:e}_createTransport(e,t,n,o){return g(this,null,function*(){let r=this._createConnectUrl(e,n.connectionToken);if(this._isITransport(t)){this._logger.log(i.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=t,yield this._startTransport(r,o),this.connectionId=n.connectionId;return}const a=[],c=n.availableTransports||[];let l=n;for(const u of c){const h=this._resolveTransportOrError(u,t,o,(l==null?void 0:l.useStatefulReconnect)===!0);if(h instanceof Error)a.push(`${u.transport} failed:`),a.push(h);else if(this._isITransport(h)){if(this.transport=h,!l){try{l=yield this._getNegotiationResponse(e)}catch(m){return Promise.reject(m)}r=this._createConnectUrl(e,l.connectionToken)}try{yield this._startTransport(r,o),this.connectionId=l.connectionId;return}catch(m){if(this._logger.log(i.Error,`Failed to start the transport '${u.transport}': ${m}`),l=void 0,a.push(new it(`${u.transport} failed: ${m}`,w[u.transport])),this._connectionState!=="Connecting"){const I="Failed to select transport before stop() was called.";return this._logger.log(i.Debug,I),Promise.reject(new k(I))}}}}return a.length>0?Promise.reject(new at(`Unable to connect to the server with any of the available transports. ${a.join(" ")}`,a)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))})}_constructTransport(e){switch(e){case w.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new xt(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case w.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new $t(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case w.LongPolling:return new ae(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=n=>g(this,null,function*(){let o=!1;if(this.features.reconnect)try{this.features.disconnected(),yield this.transport.connect(e,t),yield this.features.resend()}catch(r){o=!0}else{this._stopConnection(n);return}o&&this._stopConnection(n)}):this.transport.onclose=n=>this._stopConnection(n),this.transport.connect(e,t)}_resolveTransportOrError(e,t,n,o){const r=w[e.transport];if(r==null)return this._logger.log(i.Debug,`Skipping transport '${e.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${e.transport}' because it is not supported by this client.`);if(At(t,r))if(e.transferFormats.map(c=>v[c]).indexOf(n)>=0){if(r===w.WebSockets&&!this._options.WebSocket||r===w.ServerSentEvents&&!this._options.EventSource)return this._logger.log(i.Debug,`Skipping transport '${w[r]}' because it is not supported in your environment.'`),new st(`'${w[r]}' is not supported in your environment.`,r);this._logger.log(i.Debug,`Selecting transport '${w[r]}'.`);try{return this.features.reconnect=r===w.WebSockets?o:void 0,this._constructTransport(r)}catch(c){return c}}else return this._logger.log(i.Debug,`Skipping transport '${w[r]}' because it does not support the requested transfer format '${v[n]}'.`),new Error(`'${w[r]}' does not support ${v[n]}.`);else return this._logger.log(i.Debug,`Skipping transport '${w[r]}' because it was disabled by the client.`),new rt(`'${w[r]}' is disabled by the client.`,r)}_isITransport(e){return e&&typeof e=="object"&&"connect"in e}_stopConnection(e){if(this._logger.log(i.Debug,`HttpConnection.stopConnection(${e}) called while in state ${this._connectionState}.`),this.transport=void 0,e=this._stopError||e,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(i.Debug,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(i.Warning,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${e}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),e?this._logger.log(i.Error,`Connection disconnected with error '${e}'.`):this._logger.log(i.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(t=>{this._logger.log(i.Error,`TransportSendQueue.stop() threw error '${t}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(e)}catch(t){this._logger.log(i.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}_resolveUrl(e){if(e.lastIndexOf("https://",0)===0||e.lastIndexOf("http://",0)===0)return e;if(!p.isBrowser)throw new Error(`Cannot resolve '${e}'.`);const t=window.document.createElement("a");return t.href=e,this._logger.log(i.Information,`Normalizing '${e}' to '${t.href}'.`),t.href}_resolveNegotiateUrl(e){const t=new URL(e);t.pathname.endsWith("/")?t.pathname+="negotiate":t.pathname+="/negotiate";const n=new URLSearchParams(t.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"),t.search=n.toString(),t.toString()}}function At(s,e){return!s||(e&s)!==0}class Y{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new z,this._transportResult=new z,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new z),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(e){if(this._buffer.length&&typeof this._buffer[0]!=typeof e)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof e}`);this._buffer.push(e),this._sendBufferedData.resolve()}_sendLoop(){return g(this,null,function*(){for(;;){if(yield this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new z;const e=this._transportResult;this._transportResult=void 0;const t=typeof this._buffer[0]=="string"?this._buffer.join(""):Y._concatBuffers(this._buffer);this._buffer.length=0;try{yield this._transport.send(t),e.resolve()}catch(n){e.reject(n)}}})}static _concatBuffers(e){const t=e.map(r=>r.byteLength).reduce((r,a)=>r+a),n=new Uint8Array(t);let o=0;for(const r of e)n.set(new Uint8Array(r),o),o+=r.byteLength;return n.buffer}}class z{constructor(){this.promise=new Promise((e,t)=>[this._resolver,this._rejecter]=[e,t])}resolve(){this._resolver()}reject(e){this._rejecter(e)}}const Mt="json";class Ht{constructor(){this.name=Mt,this.version=2,this.transferFormat=v.Text}parseMessages(e,t){if(typeof e!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!e)return[];t===null&&(t=W.instance);const n=C.parse(e),o=[];for(const r of n){const a=JSON.parse(r);if(typeof a.type!="number")throw new Error("Invalid payload.");switch(a.type){case d.Invocation:this._isInvocationMessage(a);break;case d.StreamItem:this._isStreamItemMessage(a);break;case d.Completion:this._isCompletionMessage(a);break;case d.Ping:break;case d.Close:break;case d.Ack:this._isAckMessage(a);break;case d.Sequence:this._isSequenceMessage(a);break;default:t.log(i.Information,"Unknown message type '"+a.type+"' ignored.");continue}o.push(a)}return o}writeMessage(e){return C.write(JSON.stringify(e))}_isInvocationMessage(e){this._assertNotEmptyString(e.target,"Invalid payload for Invocation message."),e.invocationId!==void 0&&this._assertNotEmptyString(e.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(e){if(this._assertNotEmptyString(e.invocationId,"Invalid payload for StreamItem message."),e.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(e){if(e.result&&e.error)throw new Error("Invalid payload for Completion message.");!e.result&&e.error&&this._assertNotEmptyString(e.error,"Invalid payload for Completion message."),this._assertNotEmptyString(e.invocationId,"Invalid payload for Completion message.")}_isAckMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(e,t){if(typeof e!="string"||e==="")throw new Error(t)}}const Nt={trace:i.Trace,debug:i.Debug,info:i.Information,information:i.Information,warn:i.Warning,warning:i.Warning,error:i.Error,critical:i.Critical,none:i.None};function Lt(s){const e=Nt[s.toLowerCase()];if(typeof e!="undefined")return e;throw new Error(`Unknown log level: ${s}`)}class Wt{configureLogging(e){if(b.isRequired(e,"logging"),Bt(e))this.logger=e;else if(typeof e=="string"){const t=Lt(e);this.logger=new F(t)}else this.logger=new F(e);return this}withUrl(e,t){return b.isRequired(e,"url"),b.isNotEmpty(e,"url"),this.url=e,typeof t=="object"?this.httpConnectionOptions=_(_({},this.httpConnectionOptions),t):this.httpConnectionOptions=L(_({},this.httpConnectionOptions),{transport:t}),this}withHubProtocol(e){return b.isRequired(e,"protocol"),this.protocol=e,this}withAutomaticReconnect(e){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return e?Array.isArray(e)?this.reconnectPolicy=new ie(e):this.reconnectPolicy=e:this.reconnectPolicy=new ie,this}withServerTimeout(e){return b.isRequired(e,"milliseconds"),this._serverTimeoutInMilliseconds=e,this}withKeepAliveInterval(e){return b.isRequired(e,"milliseconds"),this._keepAliveIntervalInMilliseconds=e,this}withStatefulReconnect(e){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=e==null?void 0:e.bufferSize,this}build(){const e=this.httpConnectionOptions||{};if(e.logger===void 0&&(e.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const t=new Dt(this.url,e);return G.create(t,this.logger||W.instance,this.protocol||new Ht,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}}function Bt(s){return s.log!==void 0}const Ut=()=>{const s=le(),e=new Wt().configureLogging(i.Information).withUrl(`/api/hubs/onlineUser?token=${s.accessToken}`,{transport:w.WebSockets,skipNegotiation:!0}).withAutomaticReconnect({nextRetryDelayInMilliseconds:()=>5e3}).build();return e.keepAliveIntervalInMilliseconds=15*1e3,e.serverTimeoutInMilliseconds=30*60*1e3,e.start().then(()=>{console.log("启动连接")}),e.onclose(()=>g(null,null,function*(){console.log("断开连接")})),e.onreconnecting(()=>{he({title:"提示",message:"服务器已断线...",type:"error",position:"bottom-right"})}),e.onreconnected(()=>{console.log("重连成功")}),e.on("OnlineUserList",()=>{}),e},jt=ue("app-notify",()=>{const s=$([]),e=de(),t=H(()=>{var h;return((h=e.userInfo)==null?void 0:h.userId)||"0"}),n=H(()=>s.value.filter(h=>h.userId===t.value));function o(){"false"==="true"&&Ut();const m=Ce();if(!m)return;const{data:I}=m;X(I,y=>{y&&(console.log(`接收到消息: ${y}`),he({type:"success",title:R("component.notice.received"),message:y,duration:3e3}),s.value.unshift({avatar:tt,date:Ue().format("YYYY-MM-DD HH:mm:ss"),isRead:!1,message:y,title:R("component.notice.title"),userId:t.value}),I.value=null)})}function r(){s.value.filter(h=>h.userId===t.value).forEach(h=>{h.isRead=!0})}function a(h){!h.isRead&&(h.isRead=!0),ge.info(h.message)}function c(){s.value=s.value.filter(h=>h.userId!==t.value)}function l(){}const u=H(()=>s.value.filter(h=>h.userId===t.value).some(h=>!h.isRead));return{$reset:l,clearAllMessage:c,notificationList:s,notifications:n,setAllRead:r,setRead:a,showDot:u,startListeningMessage:o}},{persist:{pick:["notificationList"]}}),Ot=ue("app-tenant",()=>{const s=$(!1),e=$(!0),t=$([]);function n(){return g(this,null,function*(){const{tenantEnabled:a,voList:c}=yield ke();e.value=a,t.value=c})}function o(a){return g(this,null,function*(){s.value=a})}function r(){s.value=!1,e.value=!0,t.value=[]}return{$reset:r,checked:s,initTenant:n,setChecked:o,tenantEnable:e,tenantList:t}}),Cn=fe({__name:"basic",setup(s){const e=de(),t=Ie(),n=le(),o=Ee(),{destroyWatermark:r,updateWatermark:a}=nt(),c=Ot(),l=H(()=>{const y=[{handler:()=>{j(Te,{target:"_blank"})},icon:et,text:R("ui.widgets.document")},{handler:()=>{o.push("/profile")},icon:Re,text:R("ui.widgets.profile")},{handler:()=>{j("https://gitee.com/vben",{target:"_blank"})},icon:()=>je($e,{class:"text-red-800"}),text:"Gitee项目地址"},{handler:()=>{j(ne,{target:"_blank"})},icon:xe,text:"Vben官方地址"},{handler:()=>{j(`${ne}/issues`,{target:"_blank"})},icon:Qe,text:R("ui.widgets.qa")}];return c.checked&&y.splice(1,1),y}),u=H(()=>{var y;return((y=e.userInfo)==null?void 0:y.avatar)||V.app.defaultAvatar});function h(){return g(this,null,function*(){yield t.logout(!1),Pe()})}const m=jt();Oe(()=>m.startListeningMessage());function I(){ge.warning("暂未开放")}return X(()=>({enable:V.app.watermark,content:V.app.watermarkContent}),U=>g(null,[U],function*({enable:y,content:M}){var Z,Q;y?yield a({content:M||`${(Z=e.userInfo)==null?void 0:Z.username} - ${(Q=e.userInfo)==null?void 0:Q.realName}`}):r()}),{immediate:!0}),(y,M)=>(_e(),ze(S(Ke),{onClearPreferencesAndLogout:h},{"header-right-1":T(()=>[...M[1]||(M[1]=[])]),"user-dropdown":T(()=>{var U;return[P(S(Xe),{avatar:u.value,menus:l.value,text:(U=S(e).userInfo)==null?void 0:U.realName,description:"ann.vben@gmail.com","tag-text":"Pro",onLogout:h},null,8,["avatar","menus","text"])]}),notification:T(()=>[P(S(Je),{dot:S(m).showDot,notifications:S(m).notifications,onClear:S(m).clearAllMessage,onMakeAll:S(m).setAllRead,onRead:S(m).setRead,onViewAll:I},null,8,["dot","notifications","onClear","onMakeAll","onRead"])]),extra:T(()=>[P(S(ot),{open:S(n).loginExpired,"onUpdate:open":M[0]||(M[0]=U=>S(n).loginExpired=U),avatar:u.value},{default:T(()=>[P(Fe)]),_:1},8,["open","avatar"])]),"lock-screen":T(()=>[P(S(Ve),{avatar:u.value,onToLogin:h},null,8,["avatar"])]),_:1}))}});export{Cn as default};