twikoo 2.0.4 → 2.0.6
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/locales/id-ID.js +1 -1
- package/dist/locales/ja-JP.js +1 -1
- package/dist/locales/ko-KR.js +1 -1
- package/dist/locales/uz-UZ.js +1 -1
- package/dist/locales/vi-VN.js +1 -1
- package/dist/locales/zh-HK.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/twikoo.all.min.js +10 -10
- package/dist/twikoo.all.nocss.js +9 -9
- package/dist/twikoo.css +1 -1
- package/dist/twikoo.min.js +29 -29
- package/dist/twikoo.nocss.js +9 -9
- package/package.json +4 -4
package/dist/twikoo.all.nocss.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.twikoo={}))})(this,function(e){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),c=(e,t)=>{let r={};for(var i in e)n(r,i,{get:e[i],enumerable:!0});return t||n(r,Symbol.toStringTag,{value:`Module`}),r},l=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,u=c.length,d;l<u;l++)d=c[l],!o.call(e,d)&&d!==a&&n(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(s=r(t,d))||s.enumerable});return e},u=(e,r,i)=>(i=e==null?{}:t(a(e)),l(r||!e||!e.__esModule||!o.call(e,`default`)?n(i,`default`,{value:e,enumerable:!0}):i,e)),d;(function(e){e.local=`local`,e.none=`none`,e.session=`session`})(d||={});var f=function(){function e(){}return e}(),p=function(){function e(){}return e}();function m(e,t,n){n===void 0&&(n={});var r=/\?/.test(t),i=``;for(var a in n)i===``?!r&&(t+=`?`):i+=`&`,i+=a+`=`+encodeURIComponent(n[a]);return t+=i,/^http(s)?\:\/\//.test(t)?t:``+e+t}var h=c({AbstractSDKRequest:()=>f,AbstractStorage:()=>p,StorageType:()=>d,formatUrl:()=>m});function g(e){this.message=e}g.prototype=Error(),g.prototype.name=`InvalidCharacterError`;var _=typeof window<`u`&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,``);if(t.length%4==1)throw new g(`'atob' failed: The string to be decoded is not correctly encoded.`);for(var n,r,i=0,a=0,o=``;r=t.charAt(a++);~r&&(n=i%4?64*n+r:r,i++%4)&&(o+=String.fromCharCode(255&n>>(-2*i&6))))r=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`.indexOf(r);return o};function v(e){var t=e.replace(/-/g,`+`).replace(/_/g,`/`);switch(t.length%4){case 0:break;case 2:t+=`==`;break;case 3:t+=`=`;break;default:throw`Illegal base64url string!`}try{return function(e){return decodeURIComponent(_(e).replace(/(.)/g,(function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n=`0`+n),`%`+n})))}(t)}catch{return _(t)}}function y(e){this.message=e}function b(e,t){if(typeof e!=`string`)throw new y(`Invalid token specified`);var n=!0===(t||={}).header?0:1;try{return JSON.parse(v(e.split(`.`)[n]))}catch(e){throw new y(`Invalid token specified: `+e.message)}}y.prototype=Error(),y.prototype.name=`InvalidTokenError`;function x(){}function S(e){return typeof e==`object`&&!!e||typeof e==`function`}var C=x;function w(e,t){try{Object.defineProperty(e,"name",{value:t,configurable:!0})}catch{}}var T=Promise,E=Promise.resolve.bind(T),D=Promise.prototype.then,ee=Promise.reject.bind(T),te=E;function O(e){return new T(e)}function k(e){return O(t=>t(e))}function A(e){return ee(e)}function ne(e,t,n){return D.call(e,t,n)}function re(e,t,n){ne(ne(e,t,n),void 0,C)}function ie(e,t){re(e,t)}function ae(e,t){re(e,void 0,t)}function oe(e,t,n){return ne(e,t,n)}function se(e){ne(e,void 0,C)}var ce=e=>{if(typeof queueMicrotask==`function`)ce=queueMicrotask;else{let e=k(void 0);ce=t=>ne(e,t)}return ce(e)};function le(e,t,n){if(typeof e!=`function`)throw TypeError(`Argument is not a function`);return Function.prototype.apply.call(e,t,n)}function ue(e,t,n){try{return k(le(e,t,n))}catch(e){return A(e)}}var de=class{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(e){let t=this._back,n=t;t._elements.length===16383&&(n={_elements:[],_next:void 0}),t._elements.push(e),n!==t&&(this._back=n,t._next=n),++this._size}shift(){let e=this._front,t=e,n=this._cursor,r=n+1,i=e._elements,a=i[n];return r===16384&&(t=e._next,r=0),--this._size,this._cursor=r,e!==t&&(this._front=t),i[n]=void 0,a}forEach(e){let t=this._cursor,n=this._front,r=n._elements;for(;!(t===r.length&&n._next===void 0||t===r.length&&(n=n._next,r=n._elements,t=0,r.length===0));)e(r[t]),++t}peek(){let e=this._front,t=this._cursor;return e._elements[t]}},fe=Symbol(`[[AbortSteps]]`),pe=Symbol(`[[ErrorSteps]]`),me=Symbol(`[[CancelSteps]]`),he=Symbol(`[[PullSteps]]`),ge=Symbol(`[[CanPullSyncSteps]]`),_e=Symbol(`[[ReleaseSteps]]`);function ve(e,t){e._ownerReadableStream=t,t._reader=e,t._state===`readable`?xe(e):t._state===`closed`?function(e){xe(e),we(e)}(e):Se(e,t._storedError)}function j(e,t){return Tr(e._ownerReadableStream,t)}function ye(e){let t=e._ownerReadableStream;t._state===`readable`?Ce(e,TypeError(`Reader was released and can no longer be used to monitor the stream's closedness`)):function(e,t){Se(e,t)}(e,TypeError(`Reader was released and can no longer be used to monitor the stream's closedness`)),t._readableStreamController[_e](),t._reader=void 0,e._ownerReadableStream=void 0}function be(e){return TypeError(`Cannot `+e+` a stream using a released reader`)}function xe(e){e._closedPromise=O((t,n)=>{e._closedPromise_resolve=t,e._closedPromise_reject=n})}function Se(e,t){xe(e),Ce(e,t)}function Ce(e,t){e._closedPromise_reject!==void 0&&(se(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function we(e){e._closedPromise_resolve!==void 0&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}var Te=Number.isFinite||function(e){return typeof e==`number`&&isFinite(e)},M=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function Ee(e,t){if(e!==void 0&&typeof(n=e)!=`object`&&typeof n!=`function`)throw TypeError(`${t} is not an object.`);var n}function N(e,t){if(typeof e!=`function`)throw TypeError(`${t} is not a function.`)}function P(e,t){if(!function(e){return typeof e==`object`&&!!e||typeof e==`function`}(e))throw TypeError(`${t} is not an object.`)}function De(e,t,n){if(e===void 0)throw TypeError(`Parameter ${t} is required in '${n}'.`)}function Oe(e,t,n){if(e===void 0)throw TypeError(`${t} is required in '${n}'.`)}function ke(e){return Number(e)}function Ae(e){return e===0?0:e}function je(e,t){let n=2**53-1,r=Number(e);if(r=Ae(r),!Te(r))throw TypeError(`${t} is not a finite number`);if(r=function(e){return Ae(M(e))}(r),r<0||r>n)throw TypeError(`${t} is outside the accepted range of 0 to ${n}, inclusive`);return Te(r)&&r!==0?r:0}function Me(e,t){if(!Cr(e))throw TypeError(`${t} is not a ReadableStream.`)}function Ne(e){return new Re(e)}function Pe(e,t){e._reader._readRequests.push(t)}function Fe(e,t,n){let r=e._reader._readRequests.shift();n?r._closeSteps():r._chunkSteps(t)}function Ie(e){return e._reader._readRequests.length}function Le(e){let t=e._reader;return t!==void 0&&!!Ve(t)}var Re=class{constructor(e){if(De(e,1,`ReadableStreamDefaultReader`),Me(e,`First parameter`),wr(e))throw TypeError(`This stream has already been locked for exclusive reading by another reader`);ve(this,e),this._readRequests=new de}get closed(){return Ve(this)?this._closedPromise:A(Ge(`closed`))}cancel(e=void 0){return Ve(this)?this._ownerReadableStream===void 0?A(be(`cancel`)):j(this,e):A(Ge(`cancel`))}read(){if(!Ve(this))return A(Ge(`read`));if(this._ownerReadableStream===void 0)return A(be(`read from`));let e=Ue(this)?new Be:new ze;return He(this,e),e._promise}releaseLock(){if(!Ve(this))throw Ge(`releaseLock`);this._ownerReadableStream!==void 0&&function(e){ye(e),We(e,TypeError(`Reader was released`))}(this)}};Object.defineProperties(Re.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),w(Re.prototype.cancel,`cancel`),w(Re.prototype.read,`read`),w(Re.prototype.releaseLock,`releaseLock`),typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(Re.prototype,Symbol.toStringTag,{value:`ReadableStreamDefaultReader`,configurable:!0});var ze=class{constructor(){this._promise=O((e,t)=>{this._resolvePromise=e,this._rejectPromise=t})}_chunkSteps(e){this._resolvePromise({value:e,done:!1})}_closeSteps(){this._resolvePromise({value:void 0,done:!0})}_errorSteps(e){this._rejectPromise(e)}},Be=class{constructor(){this._promise=void 0}_chunkSteps(e){this._promise=te({value:e,done:!1})}_closeSteps(){this._promise=te({value:void 0,done:!0})}_errorSteps(e){this._promise=A(e)}};function Ve(e){return!!S(e)&&!!Object.prototype.hasOwnProperty.call(e,`_readRequests`)&&e instanceof Re}function He(e,t){let n=e._ownerReadableStream;n._disturbed=!0,n._state===`closed`?t._closeSteps():n._state===`errored`?t._errorSteps(n._storedError):n._readableStreamController[he](t)}function Ue(e){let t=e._ownerReadableStream;return t._state===`closed`||t._state===`errored`||t._readableStreamController[ge]()}function We(e,t){let n=e._readRequests;e._readRequests=new de,n.forEach(e=>{e._errorSteps(t)})}function Ge(e){return TypeError(`ReadableStreamDefaultReader.prototype.${e} can only be used on a ReadableStreamDefaultReader`)}function Ke(e){return e.slice()}function qe(e,t,n,r,i){new Uint8Array(e).set(new Uint8Array(n,r,i),t)}var Je=e=>(Je=typeof e.transfer==`function`?e=>e.transfer():typeof structuredClone==`function`?e=>structuredClone(e,{transfer:[e]}):e=>e,Je(e)),Ye=e=>(Ye=typeof e.detached==`boolean`?e=>e.detached:e=>e.byteLength===0,Ye(e));function F(e,t,n){if(e.slice)return e.slice(t,n);let r=n-t,i=new ArrayBuffer(r);return qe(i,0,e,t,r),i}function Xe(e,t){let n=e[t];if(n!=null){if(typeof n!=`function`)throw TypeError(`${String(t)} is not a function`);return n}}function Ze(e){try{let t=e.done,n=e.value;return ne(te(n),e=>({done:t,value:e}))}catch(e){return A(e)}}var Qe=Symbol.asyncIterator??Symbol.for?.call(Symbol,`Symbol.asyncIterator`)??`@@asyncIterator`;function $e(e,t=`sync`,n){if(n===void 0){if(t===`async`){if((n=Xe(e,Qe))===void 0)return function(e){let t={next(){let t;try{t=et(e)}catch(e){return A(e)}return Ze(t)},return(t){let n;try{let r=Xe(e.iterator,`return`);if(r===void 0)return k({done:!0,value:t});n=le(r,e.iterator,[t])}catch(e){return A(e)}return S(n)?Ze(n):A(TypeError(`The iterator.return() method must return an object`))}};return{iterator:t,nextMethod:t.next,done:!1}}($e(e,`sync`,Xe(e,Symbol.iterator)))}else n=Xe(e,Symbol.iterator)}if(n===void 0)throw TypeError(`The object is not iterable`);let r=le(n,e,[]);if(!S(r))throw TypeError(`The iterator method must return an object`);return{iterator:r,nextMethod:r.next,done:!1}}function et(e){let t=le(e.nextMethod,e.iterator,[]);if(!S(t))throw TypeError(`The iterator.next() method must return an object`);return t}var I=class{constructor(e,t){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=e,this._preventCancel=t}next(){let e=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?oe(this._ongoingPromise,e,e):e(),this._ongoingPromise}return(e){let t=()=>this._returnSteps(e);return this._ongoingPromise=this._ongoingPromise?oe(this._ongoingPromise,t,t):t(),this._ongoingPromise}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});let e=this._reader,t=new tt(this);return He(e,t),t._promise}_returnSteps(e){if(this._isFinished)return Promise.resolve({value:e,done:!0});this._isFinished=!0;let t=this._reader;if(!this._preventCancel){let n=j(t,e);return ye(t),oe(n,()=>({value:e,done:!0}))}return ye(t),k({value:e,done:!0})}},tt=class{constructor(e){this._iterator=e,this._promise=O((e,t)=>{this._resolvePromise=e,this._rejectPromise=t})}_chunkSteps(e){this._iterator._ongoingPromise=void 0,ce(()=>this._resolvePromise({value:e,done:!1}))}_closeSteps(){let e=this._iterator;e._ongoingPromise=void 0,e._isFinished=!0,ye(e._reader),this._resolvePromise({value:void 0,done:!0})}_errorSteps(e){let t=this._iterator;t._ongoingPromise=void 0,t._isFinished=!0,ye(t._reader),this._rejectPromise(e)}},L={next(){return R(this)?this._asyncIteratorImpl.next():A(nt(`next`))},return(e){return R(this)?this._asyncIteratorImpl.return(e):A(nt(`return`))},[Qe](){return this}};function R(e){if(!S(e)||!Object.prototype.hasOwnProperty.call(e,`_asyncIteratorImpl`))return!1;try{return e._asyncIteratorImpl instanceof I}catch{return!1}}function nt(e){return TypeError(`ReadableStreamAsyncIterator.${e} can only be used on a ReadableSteamAsyncIterator`)}Object.defineProperty(L,Qe,{enumerable:!1});var rt=Number.isNaN||function(e){return e!=e};function it(e){let t=F(e.buffer,e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(t)}function at(e){let t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function z(e,t,n){if(typeof(r=n)!=`number`||rt(r)||r<0||n===1/0)throw RangeError(`Size must be a finite, non-NaN, non-negative number.`);var r;e._queue.push({value:t,size:n}),e._queueTotalSize+=n}function ot(e){e._queue=new de,e._queueTotalSize=0}function st(e){return e===DataView}function ct(e){return st(e)?1:e.BYTES_PER_ELEMENT}var lt=class{constructor(){throw TypeError(`Illegal constructor`)}get view(){if(!ft(this))throw Pt(`view`);return this._view}respond(e){if(!ft(this))throw Pt(`respond`);if(De(e,1,`respond`),e=je(e,`First parameter`),this._associatedReadableByteStreamController===void 0)throw TypeError(`This BYOB request has been invalidated`);if(Ye(this._view.buffer))throw TypeError(`The BYOB request's buffer has been detached and so cannot be used as a response`);jt(this._associatedReadableByteStreamController,e)}respondWithNewView(e){if(!ft(this))throw Pt(`respondWithNewView`);if(De(e,1,`respondWithNewView`),!ArrayBuffer.isView(e))throw TypeError(`You can only respond with array buffer views`);if(this._associatedReadableByteStreamController===void 0)throw TypeError(`This BYOB request has been invalidated`);if(Ye(e.buffer))throw TypeError(`The given view's buffer has been detached and so cannot be used as a response`);Mt(this._associatedReadableByteStreamController,e)}};Object.defineProperties(lt.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),w(lt.prototype.respond,`respond`),w(lt.prototype.respondWithNewView,`respondWithNewView`),typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(lt.prototype,Symbol.toStringTag,{value:`ReadableStreamBYOBRequest`,configurable:!0});var ut=class{constructor(){throw TypeError(`Illegal constructor`)}get byobRequest(){if(!dt(this))throw Ft(`byobRequest`);return kt(this)}get desiredSize(){if(!dt(this))throw Ft(`desiredSize`);return At(this)}close(){if(!dt(this))throw Ft(`close`);if(this._closeRequested)throw TypeError(`The stream has already been closed; do not close it again!`);let e=this._controlledReadableByteStream._state;if(e!==`readable`)throw TypeError(`The stream (in ${e} state) is not in the readable state and cannot be closed`);U(this)}enqueue(e){if(!dt(this))throw Ft(`enqueue`);if(De(e,1,`enqueue`),!ArrayBuffer.isView(e))throw TypeError(`chunk must be an array buffer view`);if(e.byteLength===0)throw TypeError(`chunk must have non-zero byteLength`);if(e.buffer.byteLength===0)throw TypeError(`chunk's buffer must have non-zero byteLength`);if(this._closeRequested)throw TypeError(`stream is closed or draining`);let t=this._controlledReadableByteStream._state;if(t!==`readable`)throw TypeError(`The stream (in ${t} state) is not in the readable state and cannot be enqueued to`);Et(this,e)}error(e=void 0){if(!dt(this))throw Ft(`error`);Dt(this,e)}[me](e){mt(this),ot(this);let t=this._cancelAlgorithm(e);return H(this),t}[he](e){let t=this._controlledReadableByteStream;if(this._queueTotalSize>0)return void Ot(this,e);let n=this._autoAllocateChunkSize;if(n!==void 0){let t;try{t=new ArrayBuffer(n)}catch(t){e._errorSteps(t);return}let r={buffer:t,bufferByteLength:n,byteOffset:0,byteLength:n,bytesFilled:0,minimumFill:1,elementSize:1,viewConstructor:Uint8Array,readerType:`default`};this._pendingPullIntos.push(r)}Pe(t,e),pt(this)}[ge](){return this._queueTotalSize>0}[_e](){if(this._pendingPullIntos.length>0){let e=this._pendingPullIntos.peek();e.readerType=`none`,this._pendingPullIntos=new de,this._pendingPullIntos.push(e)}}};function dt(e){return!!S(e)&&!!Object.prototype.hasOwnProperty.call(e,`_controlledReadableByteStream`)&&e instanceof ut}function ft(e){return!!S(e)&&!!Object.prototype.hasOwnProperty.call(e,`_associatedReadableByteStreamController`)&&e instanceof lt}function pt(e){if(function(e){let t=e._controlledReadableByteStream;return t._state!==`readable`||e._closeRequested||!e._started?!1:!!(Le(t)&&Ie(t)>0||Bt(t)&&zt(t)>0||At(e)>0)}(e)){if(e._pulling)return void(e._pullAgain=!0);e._pulling=!0,re(e._pullAlgorithm(),()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,pt(e)),null),t=>(Dt(e,t),null))}}function mt(e){wt(e),e._pendingPullIntos=new de}function ht(e,t){let n=!1;e._state===`closed`&&(n=!0);let r=_t(t);t.readerType==="default"?Fe(e,r,n):function(e,t,n){let r=e._reader._readIntoRequests.shift();n?r._closeSteps(t):r._chunkSteps(t)}(e,r,n)}function gt(e,t){for(let n=0;n<t.length;++n)ht(e,t[n])}function _t(e){let t=e.bytesFilled,n=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/n)}function vt(e,t,n,r){e._queue.push({buffer:t,byteOffset:n,byteLength:r}),e._queueTotalSize+=r}function yt(e,t,n,r){let i;try{i=F(t,n,n+r)}catch(t){throw Dt(e,t),t}vt(e,i,0,r)}function bt(e,t){t.bytesFilled>0&&yt(e,t.buffer,t.byteOffset,t.bytesFilled),V(e)}function xt(e,t){let n=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),r=t.bytesFilled+n,i=n,a=!1,o=r-r%t.elementSize;o>=t.minimumFill&&(i=o-t.bytesFilled,a=!0);let s=e._queue;for(;i>0;){let n=s.peek(),r=Math.min(i,n.byteLength),a=t.byteOffset+t.bytesFilled;qe(t.buffer,a,n.buffer,n.byteOffset,r),n.byteLength===r?s.shift():(n.byteOffset+=r,n.byteLength-=r),e._queueTotalSize-=r,St(e,r,t),i-=r}return a}function St(e,t,n){n.bytesFilled+=t}function Ct(e){e._queueTotalSize===0&&e._closeRequested?(H(e),Er(e._controlledReadableByteStream)):pt(e)}function wt(e){e._byobRequest!==null&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function B(e){let t=[];for(;e._pendingPullIntos.length>0&&e._queueTotalSize!==0;){let n=e._pendingPullIntos.peek();xt(e,n)&&(V(e),t.push(n))}return t}function Tt(e,t){let n=e._pendingPullIntos.peek();wt(e),e._controlledReadableByteStream._state===`closed`?function(e,t){t.readerType===`none`&&V(e);let n=e._controlledReadableByteStream;if(Bt(n)){let t=[];for(;t.length<zt(n);)t.push(V(e));gt(n,t)}}(e,n):function(e,t,n){if(St(0,t,n),n.readerType===`none`){bt(e,n);let t=B(e);gt(e._controlledReadableByteStream,t);return}if(n.bytesFilled<n.minimumFill)return;V(e);let r=n.bytesFilled%n.elementSize;if(r>0){let t=n.byteOffset+n.bytesFilled;yt(e,n.buffer,t-r,r)}n.bytesFilled-=r;let i=B(e);ht(e._controlledReadableByteStream,n),gt(e._controlledReadableByteStream,i)}(e,t,n),pt(e)}function V(e){return e._pendingPullIntos.shift()}function H(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function U(e){let t=e._controlledReadableByteStream;if(!e._closeRequested&&t._state===`readable`){if(e._queueTotalSize>0)e._closeRequested=!0;else{if(e._pendingPullIntos.length>0){let t=e._pendingPullIntos.peek();if(t.bytesFilled%t.elementSize!==0){let t=TypeError(`Insufficient bytes to fill elements in the given buffer`);throw Dt(e,t),t}}H(e),Er(t)}}}function Et(e,t){let n=e._controlledReadableByteStream;if(e._closeRequested||n._state!==`readable`)return;let{buffer:r,byteOffset:i,byteLength:a}=t;if(Ye(r))throw TypeError(`chunk's buffer is detached and so cannot be enqueued`);let o=Je(r);if(e._pendingPullIntos.length>0){let t=e._pendingPullIntos.peek();if(Ye(t.buffer))throw TypeError(`The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk`);wt(e),t.buffer=Je(t.buffer),t.readerType===`none`&&bt(e,t)}Le(n)?(function(e){let t=e._controlledReadableByteStream._reader;for(;t._readRequests.length>0;){if(e._queueTotalSize===0)return;Ot(e,t._readRequests.shift())}}(e),Ie(n)===0?vt(e,o,i,a):(e._pendingPullIntos.length>0&&V(e),Fe(n,new Uint8Array(o,i,a),!1))):Bt(n)?(vt(e,o,i,a),gt(n,B(e))):vt(e,o,i,a),pt(e)}function Dt(e,t){let n=e._controlledReadableByteStream;n._state===`readable`&&(mt(e),ot(e),H(e),Dr(n,t))}function Ot(e,t){let n=e._queue.shift();e._queueTotalSize-=n.byteLength,Ct(e);let r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);t._chunkSteps(r)}function kt(e){if(e._byobRequest===null&&e._pendingPullIntos.length>0){let t=e._pendingPullIntos.peek(),n=new Uint8Array(t.buffer,t.byteOffset+t.bytesFilled,t.byteLength-t.bytesFilled),r=Object.create(lt.prototype);(function(e,t,n){e._associatedReadableByteStreamController=t,e._view=n})(r,e,n),e._byobRequest=r}return e._byobRequest}function At(e){let t=e._controlledReadableByteStream._state;return t===`errored`?null:t===`closed`?0:e._strategyHWM-e._queueTotalSize}function jt(e,t){let n=e._pendingPullIntos.peek();if(e._controlledReadableByteStream._state===`closed`){if(t!==0)throw TypeError(`bytesWritten must be 0 when calling respond() on a closed stream`)}else{if(t===0)throw TypeError(`bytesWritten must be greater than 0 when calling respond() on a readable stream`);if(n.bytesFilled+t>n.byteLength)throw RangeError(`bytesWritten out of range`)}n.buffer=Je(n.buffer),Tt(e,t)}function Mt(e,t){let n=e._pendingPullIntos.peek();if(e._controlledReadableByteStream._state===`closed`){if(t.byteLength!==0)throw TypeError(`The view's length must be 0 when calling respondWithNewView() on a closed stream`)}else if(t.byteLength===0)throw TypeError(`The view's length must be greater than 0 when calling respondWithNewView() on a readable stream`);if(n.byteOffset+n.bytesFilled!==t.byteOffset)throw RangeError(`The region specified by view does not match byobRequest`);if(n.bufferByteLength!==t.buffer.byteLength)throw RangeError(`The buffer of view has different capacity than byobRequest`);if(n.bytesFilled+t.byteLength>n.byteLength)throw RangeError(`The region specified by view is larger than byobRequest`);let r=t.byteLength;n.buffer=Je(t.buffer),Tt(e,r)}function Nt(e,t,n,r,i,a,o){t._controlledReadableByteStream=e,t._pullAgain=!1,t._pulling=!1,t._byobRequest=null,t._queue=t._queueTotalSize=void 0,ot(t),t._closeRequested=!1,t._started=!1,t._strategyHWM=a,t._pullAlgorithm=r,t._cancelAlgorithm=i,t._autoAllocateChunkSize=o,t._pendingPullIntos=new de,e._readableStreamController=t,re(k(n()),()=>(t._started=!0,pt(t),null),e=>(Dt(t,e),null))}function Pt(e){return TypeError(`ReadableStreamBYOBRequest.prototype.${e} can only be used on a ReadableStreamBYOBRequest`)}function Ft(e){return TypeError(`ReadableByteStreamController.prototype.${e} can only be used on a ReadableByteStreamController`)}function It(e,t){if((e=`${e}`)!=`byob`)throw TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamReaderMode`);return e}function Lt(e){return new Vt(e)}function Rt(e,t){e._reader._readIntoRequests.push(t)}function zt(e){return e._reader._readIntoRequests.length}function Bt(e){let t=e._reader;return t!==void 0&&!!Wt(t)}Object.defineProperties(ut.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),w(ut.prototype.close,`close`),w(ut.prototype.enqueue,`enqueue`),w(ut.prototype.error,`error`),typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(ut.prototype,Symbol.toStringTag,{value:`ReadableByteStreamController`,configurable:!0});var Vt=class{constructor(e){if(De(e,1,`ReadableStreamBYOBReader`),Me(e,`First parameter`),wr(e))throw TypeError(`This stream has already been locked for exclusive reading by another reader`);if(!dt(e._readableStreamController))throw TypeError(`Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source`);ve(this,e),this._readIntoRequests=new de}get closed(){return Wt(this)?this._closedPromise:A(qt(`closed`))}cancel(e=void 0){return Wt(this)?this._ownerReadableStream===void 0?A(be(`cancel`)):j(this,e):A(qt(`cancel`))}read(e,t={}){if(!Wt(this))return A(qt(`read`));if(!ArrayBuffer.isView(e))return A(TypeError(`view must be an array buffer view`));if(e.byteLength===0)return A(TypeError(`view must have non-zero byteLength`));if(e.buffer.byteLength===0)return A(TypeError(`view's buffer must have non-zero byteLength`));if(Ye(e.buffer))return A(TypeError(`view's buffer has been detached`));let n;try{n=function(e,t){return Ee(e,t),{min:je(e?.min??1,`${t} has member 'min' that`)}}(t,`options`)}catch(e){return A(e)}let r=n.min;if(r===0)return A(TypeError(`options.min must be greater than 0`));if(function(e){return st(e.constructor)}(e)){if(r>e.byteLength)return A(RangeError(`options.min must be less than or equal to view's byteLength`))}else if(r>e.length)return A(RangeError(`options.min must be less than or equal to view's length`));if(this._ownerReadableStream===void 0)return A(be(`read from`));let i=function(e,t,n){let r=e._ownerReadableStream;return r._state===`errored`||function(e,t,n){let r=e._controlledReadableByteStream,i=ct(t.constructor),{byteLength:a}=t,o=n*i;return!(e._pendingPullIntos.length>0)&&(r._state===`closed`||e._queueTotalSize>=o)}(r._readableStreamController,t,n)}(this,e,r)?new Ut:new Ht;return Gt(this,e,r,i),i._promise}releaseLock(){if(!Wt(this))throw qt(`releaseLock`);this._ownerReadableStream!==void 0&&function(e){ye(e),Kt(e,TypeError(`Reader was released`))}(this)}};Object.defineProperties(Vt.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),w(Vt.prototype.cancel,`cancel`),w(Vt.prototype.read,`read`),w(Vt.prototype.releaseLock,`releaseLock`),typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(Vt.prototype,Symbol.toStringTag,{value:`ReadableStreamBYOBReader`,configurable:!0});var Ht=class{constructor(){this._promise=O((e,t)=>{this._resolvePromise=e,this._rejectPromise=t})}_chunkSteps(e){this._resolvePromise({value:e,done:!1})}_closeSteps(e){this._resolvePromise({value:e,done:!0})}_errorSteps(e){this._rejectPromise(e)}},Ut=class{constructor(){this._promise=void 0}_chunkSteps(e){this._promise=te({value:e,done:!1})}_closeSteps(e){this._promise=te({value:e,done:!0})}_errorSteps(e){this._promise=A(e)}};function Wt(e){return!!S(e)&&!!Object.prototype.hasOwnProperty.call(e,`_readIntoRequests`)&&e instanceof Vt}function Gt(e,t,n,r){let i=e._ownerReadableStream;i._disturbed=!0,i._state===`errored`?r._errorSteps(i._storedError):function(e,t,n,r){let i=e._controlledReadableByteStream,a=t.constructor,o=ct(a),{byteOffset:s,byteLength:c}=t,l=n*o,u;try{u=Je(t.buffer)}catch(e){r._errorSteps(e);return}let d={buffer:u,bufferByteLength:u.byteLength,byteOffset:s,byteLength:c,bytesFilled:0,minimumFill:l,elementSize:o,viewConstructor:a,readerType:`byob`};if(e._pendingPullIntos.length>0)return e._pendingPullIntos.push(d),void Rt(i,r);if(i._state===`closed`){let e=new a(d.buffer,d.byteOffset,0);r._closeSteps(e);return}if(e._queueTotalSize>0){if(xt(e,d)){let t=_t(d);Ct(e),r._chunkSteps(t);return}if(e._closeRequested){let t=TypeError(`Insufficient bytes to fill elements in the given buffer`);Dt(e,t),r._errorSteps(t);return}}e._pendingPullIntos.push(d),Rt(i,r),pt(e)}(i._readableStreamController,t,n,r)}function Kt(e,t){let n=e._readIntoRequests;e._readIntoRequests=new de,n.forEach(e=>{e._errorSteps(t)})}function qt(e){return TypeError(`ReadableStreamBYOBReader.prototype.${e} can only be used on a ReadableStreamBYOBReader`)}function Jt(e,t){let{highWaterMark:n}=e;if(n===void 0)return t;if(rt(n)||n<0)throw RangeError(`Invalid highWaterMark`);return n}function Yt(e){let{size:t}=e;return t||(()=>1)}function Xt(e,t){Ee(e,t);let n=e?.highWaterMark,r=e?.size;return{highWaterMark:n===void 0?void 0:ke(n),size:r===void 0?void 0:Zt(r,`${t} has member 'size' that`)}}function Zt(e,t){return N(e,t),t=>ke(e(t))}function Qt(e,t,n){return N(e,n),n=>ue(e,t,[n])}function $t(e,t,n){return N(e,n),()=>ue(e,t,[])}function en(e,t,n){return N(e,n),n=>le(e,t,[n])}function tn(e,t,n){return N(e,n),(n,r)=>ue(e,t,[n,r])}function nn(e,t){if(!sn(e))throw TypeError(`${t} is not a WritableStream.`)}var rn=class{constructor(e={},t={}){e===void 0?e=null:P(e,`First parameter`);let n=Xt(t,`Second parameter`),r=function(e,t){Ee(e,t);let n=e?.abort,r=e?.close,i=e?.start,a=e?.type,o=e?.write;return{abort:n===void 0?void 0:Qt(n,e,`${t} has member 'abort' that`),close:r===void 0?void 0:$t(r,e,`${t} has member 'close' that`),start:i===void 0?void 0:en(i,e,`${t} has member 'start' that`),write:o===void 0?void 0:tn(o,e,`${t} has member 'write' that`),type:a}}(e,`First parameter`);if(on(this),r.type!==void 0)throw RangeError(`Invalid type is specified`);let i=Yt(n);(function(e,t,n,r){let i=Object.create(Tn.prototype),a,o,s,c;a=t.start===void 0?()=>{}:()=>t.start(i),o=t.write===void 0?()=>k(void 0):e=>t.write(e,i),s=t.close===void 0?()=>k(void 0):()=>t.close(),c=t.abort===void 0?()=>k(void 0):e=>t.abort(e),Dn(e,i,a,o,s,c,n,r)})(this,r,Jt(n,1),i)}get locked(){if(!sn(this))throw Pn(`locked`);return cn(this)}abort(e=void 0){return sn(this)?cn(this)?A(TypeError(`Cannot abort a stream that already has a writer`)):ln(this,e):A(Pn(`abort`))}close(){return sn(this)?cn(this)?A(TypeError(`Cannot close a stream that already has a writer`)):mn(this)?A(TypeError(`Cannot close an already-closing stream`)):un(this):A(Pn(`close`))}getWriter(){if(!sn(this))throw Pn(`getWriter`);return an(this)}};function an(e){return new _n(e)}function on(e){e._state=`writable`,e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=new de,e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function sn(e){return!!S(e)&&!!Object.prototype.hasOwnProperty.call(e,`_writableStreamController`)&&e instanceof rn}function cn(e){return e._writer!==void 0}function ln(e,t){var n;if(e._state===`closed`||e._state===`errored`)return k(void 0);e._writableStreamController._abortReason=t,(n=e._writableStreamController._abortController)==null||n.abort(t);let r=e._state;if(r===`closed`||r===`errored`)return k(void 0);if(e._pendingAbortRequest!==void 0)return e._pendingAbortRequest._promise;let i=!1;r===`erroring`&&(i=!0,t=void 0);let a=O((n,r)=>{e._pendingAbortRequest={_promise:void 0,_resolve:n,_reject:r,_reason:t,_wasAlreadyErroring:i}});return e._pendingAbortRequest._promise=a,i||fn(e,t),a}function un(e){let t=e._state;if(t===`closed`||t===`errored`)return A(TypeError(`The stream (in ${t} state) is not in the writable state and cannot be closed`));let n=O((t,n)=>{e._closeRequest={_resolve:t,_reject:n}}),r=e._writer;var i;return r!==void 0&&e._backpressure&&t===`writable`&&Kn(r),z(i=e._writableStreamController,wn,0),An(i),n}function dn(e,t){e._state===`writable`?fn(e,t):pn(e)}function fn(e,t){let n=e._writableStreamController;e._state=`erroring`,e._storedError=t;let r=e._writer;r!==void 0&&xn(r,t),!function(e){return e._inFlightWriteRequest!==void 0||e._inFlightCloseRequest!==void 0}(e)&&n._started&&pn(e)}function pn(e){e._state=`errored`,e._writableStreamController[pe]();let t=e._storedError;if(e._writeRequests.forEach(e=>{e._reject(t)}),e._writeRequests=new de,e._pendingAbortRequest===void 0)return void hn(e);let n=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,n._wasAlreadyErroring)return n._reject(t),void hn(e);re(e._writableStreamController[fe](n._reason),()=>(n._resolve(),hn(e),null),t=>(n._reject(t),hn(e),null))}function mn(e){return e._closeRequest!==void 0||e._inFlightCloseRequest!==void 0}function hn(e){e._closeRequest!==void 0&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);let t=e._writer;t!==void 0&&Bn(t,e._storedError)}function gn(e,t){let n=e._writer;n!==void 0&&t!==e._backpressure&&(t?function(e){Hn(e)}(n):Kn(n)),e._backpressure=t}Object.defineProperties(rn.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),w(rn.prototype.abort,`abort`),w(rn.prototype.close,`close`),w(rn.prototype.getWriter,`getWriter`),typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(rn.prototype,Symbol.toStringTag,{value:`WritableStream`,configurable:!0});var _n=class{constructor(e){if(De(e,1,`WritableStreamDefaultWriter`),nn(e,`First parameter`),cn(e))throw TypeError(`This stream has already been locked for exclusive writing by another writer`);this._ownerWritableStream=e,e._writer=this;let t=e._state;if(t===`writable`)!mn(e)&&e._backpressure?Hn(this):Wn(this),Rn(this);else if(t===`erroring`)Un(this,e._storedError),Rn(this);else if(t===`closed`)Wn(this),Rn(n=this),Vn(n);else{let t=e._storedError;Un(this,t),zn(this,t)}var n}get closed(){return vn(this)?this._closedPromise:A(In(`closed`))}get desiredSize(){if(!vn(this))throw In(`desiredSize`);if(this._ownerWritableStream===void 0)throw Ln(`desiredSize`);return function(e){let t=e._ownerWritableStream,n=t._state;return n===`errored`||n===`erroring`?null:n===`closed`?0:kn(t._writableStreamController)}(this)}get ready(){return vn(this)?this._readyPromise:A(In(`ready`))}abort(e=void 0){return vn(this)?this._ownerWritableStream===void 0?A(Ln(`abort`)):function(e,t){return ln(e._ownerWritableStream,t)}(this,e):A(In(`abort`))}close(){if(!vn(this))return A(In(`close`));let e=this._ownerWritableStream;return e===void 0?A(Ln(`close`)):mn(e)?A(TypeError(`Cannot close an already-closing stream`)):yn(this)}releaseLock(){if(!vn(this))throw In(`releaseLock`);this._ownerWritableStream!==void 0&&Sn(this)}write(e=void 0){return vn(this)?this._ownerWritableStream===void 0?A(Ln(`write to`)):Cn(this,e):A(In(`write`))}};function vn(e){return!!S(e)&&!!Object.prototype.hasOwnProperty.call(e,`_ownerWritableStream`)&&e instanceof _n}function yn(e){return un(e._ownerWritableStream)}function bn(e,t){e._closedPromiseState===`pending`?Bn(e,t):function(e,t){zn(e,t)}(e,t)}function xn(e,t){e._readyPromiseState===`pending`?Gn(e,t):function(e,t){Un(e,t)}(e,t)}function Sn(e){let t=e._ownerWritableStream,n=TypeError(`Writer was released and can no longer be used to monitor the stream's closedness`);xn(e,n),bn(e,n),t._writer=void 0,e._ownerWritableStream=void 0}function Cn(e,t){let n=e._ownerWritableStream,r=n._writableStreamController,i=function(e,t){if(e._strategySizeAlgorithm===void 0)return 1;try{return e._strategySizeAlgorithm(t)}catch(t){return jn(e,t),1}}(r,t);if(n!==e._ownerWritableStream)return A(Ln(`write to`));let a=n._state;if(a===`errored`)return A(n._storedError);if(mn(n)||a===`closed`)return A(TypeError(`The stream is closing or closed and cannot be written to`));if(a===`erroring`)return A(n._storedError);let o=function(e){return O((t,n)=>{let r={_resolve:t,_reject:n};e._writeRequests.push(r)})}(n);return function(e,t,n){try{z(e,t,n)}catch(t){jn(e,t);return}let r=e._controlledWritableStream;!mn(r)&&r._state===`writable`&&gn(r,Mn(e)),An(e)}(r,t,i),o}Object.defineProperties(_n.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),w(_n.prototype.abort,`abort`),w(_n.prototype.close,`close`),w(_n.prototype.releaseLock,`releaseLock`),w(_n.prototype.write,`write`),typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(_n.prototype,Symbol.toStringTag,{value:`WritableStreamDefaultWriter`,configurable:!0});var wn={},Tn=class{constructor(){throw TypeError(`Illegal constructor`)}get abortReason(){if(!En(this))throw Fn(`abortReason`);return this._abortReason}get signal(){if(!En(this))throw Fn(`signal`);if(this._abortController===void 0)throw TypeError(`WritableStreamDefaultController.prototype.signal is not supported`);return this._abortController.signal}error(e=void 0){if(!En(this))throw Fn(`error`);this._controlledWritableStream._state===`writable`&&Nn(this,e)}[fe](e){let t=this._abortAlgorithm(e);return On(this),t}[pe](){ot(this)}};function En(e){return!!S(e)&&!!Object.prototype.hasOwnProperty.call(e,`_controlledWritableStream`)&&e instanceof Tn}function Dn(e,t,n,r,i,a,o,s){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,ot(t),t._abortReason=void 0,t._abortController=function(){if(typeof AbortController==`function`)return new AbortController}(),t._started=!1,t._strategySizeAlgorithm=s,t._strategyHWM=o,t._writeAlgorithm=r,t._closeAlgorithm=i,t._abortAlgorithm=a,gn(e,Mn(t)),re(k(n()),()=>(t._started=!0,An(t),null),n=>(t._started=!0,dn(e,n),null))}function On(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function kn(e){return e._strategyHWM-e._queueTotalSize}function An(e){let t=e._controlledWritableStream;if(!e._started||t._inFlightWriteRequest!==void 0)return;if(t._state===`erroring`)return void pn(t);if(e._queue.length===0)return;let n=e._queue.peek().value;n===wn?function(e){let t=e._controlledWritableStream;(function(e){e._inFlightCloseRequest=e._closeRequest,e._closeRequest=void 0})(t),at(e);let n=e._closeAlgorithm();On(e),re(n,()=>(function(e){e._inFlightCloseRequest._resolve(void 0),e._inFlightCloseRequest=void 0,e._state===`erroring`&&(e._storedError=void 0,e._pendingAbortRequest!==void 0&&(e._pendingAbortRequest._resolve(),e._pendingAbortRequest=void 0)),e._state=`closed`;let t=e._writer;t!==void 0&&Vn(t)}(t),null),e=>(function(e,t){e._inFlightCloseRequest._reject(t),e._inFlightCloseRequest=void 0,e._pendingAbortRequest!==void 0&&(e._pendingAbortRequest._reject(t),e._pendingAbortRequest=void 0),dn(e,t)}(t,e),null))}(e):function(e,t){let n=e._controlledWritableStream;(function(e){e._inFlightWriteRequest=e._writeRequests.shift()})(n),re(e._writeAlgorithm(t),()=>{(function(e){e._inFlightWriteRequest._resolve(void 0),e._inFlightWriteRequest=void 0})(n);let t=n._state;if(at(e),!mn(n)&&t===`writable`){let t=Mn(e);gn(n,t)}return An(e),null},t=>(n._state===`writable`&&On(e),function(e,t){e._inFlightWriteRequest._reject(t),e._inFlightWriteRequest=void 0,dn(e,t)}(n,t),null))}(e,n)}function jn(e,t){e._controlledWritableStream._state===`writable`&&Nn(e,t)}function Mn(e){return kn(e)<=0}function Nn(e,t){let n=e._controlledWritableStream;On(e),fn(n,t)}function Pn(e){return TypeError(`WritableStream.prototype.${e} can only be used on a WritableStream`)}function Fn(e){return TypeError(`WritableStreamDefaultController.prototype.${e} can only be used on a WritableStreamDefaultController`)}function In(e){return TypeError(`WritableStreamDefaultWriter.prototype.${e} can only be used on a WritableStreamDefaultWriter`)}function Ln(e){return TypeError(`Cannot `+e+` a stream using a released writer`)}function Rn(e){e._closedPromise=O((t,n)=>{e._closedPromise_resolve=t,e._closedPromise_reject=n,e._closedPromiseState=`pending`})}function zn(e,t){Rn(e),Bn(e,t)}function Bn(e,t){e._closedPromise_reject!==void 0&&(se(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState=`rejected`)}function Vn(e){e._closedPromise_resolve!==void 0&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState=`resolved`)}function Hn(e){e._readyPromise=O((t,n)=>{e._readyPromise_resolve=t,e._readyPromise_reject=n}),e._readyPromiseState=`pending`}function Un(e,t){Hn(e),Gn(e,t)}function Wn(e){Hn(e),Kn(e)}function Gn(e,t){e._readyPromise_reject!==void 0&&(se(e._readyPromise),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState=`rejected`)}function Kn(e){e._readyPromise_resolve!==void 0&&(e._readyPromise_resolve(void 0),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState=`fulfilled`)}Object.defineProperties(Tn.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(Tn.prototype,Symbol.toStringTag,{value:`WritableStreamDefaultController`,configurable:!0});var qn=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof global<`u`?global:void 0,Jn=function(){let e=qn?.DOMException;return function(e){if(typeof e!=`function`&&typeof e!=`object`||e.name!==`DOMException`)return!1;try{return new e,!0}catch{return!1}}(e)?e:void 0}()||function(){let e=function(e,t){this.message=e||``,this.name=t||`Error`,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};return w(e,`DOMException`),e.prototype=Object.create(Error.prototype),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,configurable:!0}),e}();function Yn(e,t,n,r,i,a){let o=Ne(e),s=an(t);e._disturbed=!0;let c=new Xn(s),l=new Qn(c);return O((u,d)=>{let f;if(a!==void 0){if(f=()=>{let n=a.reason===void 0?new Jn(`Aborted`,`AbortError`):a.reason,o=[];r||o.push(()=>t._state===`writable`?ln(t,n):k(void 0)),i||o.push(()=>e._state===`readable`?Tr(e,n):k(void 0)),_(()=>Promise.all(o.map(e=>e())),!0,n)},a.aborted)return void f();a.addEventListener(`abort`,f)}function p(){for(;!c._shuttingDown&&!t._backpressure&&t._state===`writable`&&!mn(t)&&e._state===`readable`&&Ue(o);)He(o,l);if(c._shuttingDown)return k(!0);if(t._backpressure)return ne(s._readyPromise,p);let n=new Zn(c);return He(o,n),n._promise}var m,h,g;if($n(e,o._closedPromise,e=>(r?v(!0,e):_(()=>ln(t,e),!0,e),null)),$n(t,s._closedPromise,t=>(i?v(!0,t):_(()=>Tr(e,t),!0,t),null)),m=e,h=o._closedPromise,g=()=>(n?v():_(()=>function(e){let t=e._ownerWritableStream,n=t._state;return mn(t)||n===`closed`?k(void 0):n===`errored`?A(t._storedError):yn(e)}(s)),null),m._state===`closed`?g():ie(h,g),mn(t)||t._state===`closed`){let t=TypeError(`the destination writable stream closed before all data could be piped to it`);i?v(!0,t):_(()=>Tr(e,t),!0,t)}function _(e,n,r){function i(){return re(e(),()=>y(n,r),e=>y(!0,e)),null}c._shuttingDown||(c._shuttingDown=!0,t._state!==`writable`||mn(t)?i():ie(c._waitForWritesToFinish(),i))}function v(e,n){c._shuttingDown||(c._shuttingDown=!0,t._state!==`writable`||mn(t)?y(e,n):ie(c._waitForWritesToFinish(),()=>y(e,n)))}function y(e,t){return Sn(s),ye(o),a!==void 0&&a.removeEventListener(`abort`,f),e?d(t):u(void 0),null}se(O((e,t)=>{(function n(r){r?e():ne(p(),n,t)})(!1)}))})}var Xn=class{constructor(e){this._writer=e,this._shuttingDown=!1,this._currentWrite=k(void 0)}_waitForWritesToFinish(){let e=this._currentWrite;return ne(this._currentWrite,()=>e===this._currentWrite?void 0:this._waitForWritesToFinish())}},Zn=class{constructor(e){this._state=e,this._promise=O((e,t)=>{this._resolvePromise=e,this._rejectPromise=t})}_chunkSteps(e){this._state._currentWrite=ne(Cn(this._state._writer,e),void 0,x),this._resolvePromise(!1)}_closeSteps(){this._resolvePromise(!0)}_errorSteps(e){this._rejectPromise(e)}},Qn=class{constructor(e){this._state=e}_chunkSteps(e){this._state._currentWrite=ne(Cn(this._state._writer,e),void 0,x)}_closeSteps(){}_errorSteps(e){}};function $n(e,t,n){e._state===`errored`?n(e._storedError):ae(t,n)}var er=class{constructor(){throw TypeError(`Illegal constructor`)}get desiredSize(){if(!tr(this))throw dr(`desiredSize`);return cr(this)}close(){if(!tr(this))throw dr(`close`);if(!lr(this))throw TypeError(`The stream is not in a state that permits close`);ar(this)}enqueue(e=void 0){if(!tr(this))throw dr(`enqueue`);if(!lr(this))throw TypeError(`The stream is not in a state that permits enqueue`);return or(this,e)}error(e=void 0){if(!tr(this))throw dr(`error`);sr(this,e)}[me](e){ot(this);let t=this._cancelAlgorithm(e);return ir(this),t}[he](e){let t=this._controlledReadableStream;if(this._queue.length>0){let n=at(this);this._closeRequested&&this._queue.length===0?(ir(this),Er(t)):nr(this),e._chunkSteps(n)}else Pe(t,e),nr(this)}[ge](){return this._queue.length>0}[_e](){}};function tr(e){return!!S(e)&&!!Object.prototype.hasOwnProperty.call(e,`_controlledReadableStream`)&&e instanceof er}function nr(e){if(rr(e)){if(e._pulling)return void(e._pullAgain=!0);e._pulling=!0,re(e._pullAlgorithm(),()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,nr(e)),null),t=>(sr(e,t),null))}}function rr(e){let t=e._controlledReadableStream;return!lr(e)||!e._started?!1:wr(t)&&Ie(t)>0?!0:cr(e)>0}function ir(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function ar(e){if(!lr(e))return;let t=e._controlledReadableStream;e._closeRequested=!0,e._queue.length===0&&(ir(e),Er(t))}function or(e,t){if(!lr(e))return;let n=e._controlledReadableStream;if(wr(n)&&Ie(n)>0)Fe(n,t,!1);else{let n;try{n=e._strategySizeAlgorithm(t)}catch(t){throw sr(e,t),t}try{z(e,t,n)}catch(t){throw sr(e,t),t}}nr(e)}function sr(e,t){let n=e._controlledReadableStream;n._state===`readable`&&(ot(e),ir(e),Dr(n,t))}function cr(e){let t=e._controlledReadableStream._state;return t===`errored`?null:t===`closed`?0:e._strategyHWM-e._queueTotalSize}function lr(e){let t=e._controlledReadableStream._state;return!e._closeRequested&&t===`readable`}function ur(e,t,n,r,i,a,o){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,ot(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=o,t._strategyHWM=a,t._pullAlgorithm=r,t._cancelAlgorithm=i,e._readableStreamController=t,re(k(n()),()=>(t._started=!0,nr(t),null),e=>(sr(t,e),null))}function dr(e){return TypeError(`ReadableStreamDefaultController.prototype.${e} can only be used on a ReadableStreamDefaultController`)}function fr(e,t){return dt(e._readableStreamController)?function(e){let t,n,r,i,a,o=Ne(e),s=!1,c=!1,l=!1,u=!1,d=!1,f=O(e=>{a=e});function p(e){ae(e._closedPromise,t=>(e!==o||(Dt(r._readableStreamController,t),Dt(i._readableStreamController,t),u&&d||a(void 0)),null))}function m(){Wt(o)&&(ye(o),o=Ne(e),p(o)),He(o,{_chunkSteps:t=>{ce(()=>{c=!1,l=!1;let n=t,o=t;if(!u&&!d)try{o=it(t)}catch(t){Dt(r._readableStreamController,t),Dt(i._readableStreamController,t),a(Tr(e,t));return}u||Et(r._readableStreamController,n),d||Et(i._readableStreamController,o),s=!1,c?g():l&&_()})},_closeSteps:()=>{s=!1,u||U(r._readableStreamController),d||U(i._readableStreamController),r._readableStreamController._pendingPullIntos.length>0&&jt(r._readableStreamController,0),i._readableStreamController._pendingPullIntos.length>0&&jt(i._readableStreamController,0),u&&d||a(void 0)},_errorSteps:()=>{s=!1}})}function h(t,n){Ve(o)&&(ye(o),o=Lt(e),p(o));let f=n?i:r,m=n?r:i;Gt(o,t,1,{_chunkSteps:t=>{ce(()=>{c=!1,l=!1;let r=n?d:u;if(n?u:d)r||Mt(f._readableStreamController,t);else{let n;try{n=it(t)}catch(t){Dt(f._readableStreamController,t),Dt(m._readableStreamController,t),a(Tr(e,t));return}r||Mt(f._readableStreamController,t),Et(m._readableStreamController,n)}s=!1,c?g():l&&_()})},_closeSteps:e=>{s=!1;let t=n?d:u,r=n?u:d;t||U(f._readableStreamController),r||U(m._readableStreamController),e!==void 0&&(t||Mt(f._readableStreamController,e),!r&&m._readableStreamController._pendingPullIntos.length>0&&jt(m._readableStreamController,0)),t&&r||a(void 0)},_errorSteps:()=>{s=!1}})}function g(){if(s)return c=!0,k(void 0);s=!0;let e=kt(r._readableStreamController);return e===null?m():h(e._view,!1),k(void 0)}function _(){if(s)return l=!0,k(void 0);s=!0;let e=kt(i._readableStreamController);return e===null?m():h(e._view,!0),k(void 0)}function v(r){if(u=!0,t=r,d){let r=Tr(e,Ke([t,n]));a(r)}return f}function y(r){if(d=!0,n=r,u){let r=Tr(e,Ke([t,n]));a(r)}return f}function b(){}return r=xr(b,g,v),i=xr(b,_,y),p(o),[r,i]}(e):function(e){let t=Ne(e),n,r,i,a,o,s=!1,c=!1,l=!1,u=!1,d=O(e=>{o=e});function f(){return s?(c=!0,k(void 0)):(s=!0,He(t,{_chunkSteps:e=>{ce(()=>{c=!1;let t=e,n=e;l||or(i._readableStreamController,t),u||or(a._readableStreamController,n),s=!1,c&&f()})},_closeSteps:()=>{s=!1,l||ar(i._readableStreamController),u||ar(a._readableStreamController),l&&u||o(void 0)},_errorSteps:()=>{s=!1}}),k(void 0))}function p(t){if(l=!0,n=t,u){let t=Tr(e,Ke([n,r]));o(t)}return d}function m(t){if(u=!0,r=t,l){let t=Tr(e,Ke([n,r]));o(t)}return d}function h(){}return i=br(h,f,p),a=br(h,f,m),ae(t._closedPromise,e=>(sr(i._readableStreamController,e),sr(a._readableStreamController,e),l&&u||o(void 0),null)),[i,a]}(e)}function pr(e){return S(t=e)&&t.getReader!==void 0?function(e){let t;function n(){let n;try{n=e.read()}catch(e){return A(e)}return oe(n,e=>{if(!S(e))throw TypeError(`The promise returned by the reader.read() method must fulfill with an object`);if(e.done)ar(t._readableStreamController);else{let n=e.value;or(t._readableStreamController,n)}})}function r(t){try{return k(e.cancel(t))}catch(e){return A(e)}}return t=br(x,n,r,0),t}(e.getReader()):function(e){let t,n=$e(e,`async`);function r(){let e;try{e=et(n)}catch(e){return A(e)}return oe(k(e),e=>{if(!S(e))throw TypeError(`The promise returned by the iterator.next() method must fulfill with an object`);if(e.done)ar(t._readableStreamController);else{let n=e.value;or(t._readableStreamController,n)}})}function i(e){let t=n.iterator,r;try{r=Xe(t,`return`)}catch(e){return A(e)}return r===void 0?k(void 0):oe(ue(r,t,[e]),e=>{if(!S(e))throw TypeError(`The promise returned by the iterator.return() method must fulfill with an object`)})}return t=br(x,r,i,0),t}(e);var t}function mr(e,t,n){return N(e,n),n=>ue(e,t,[n])}function hr(e,t,n){return N(e,n),n=>ue(e,t,[n])}function gr(e,t,n){return N(e,n),n=>le(e,t,[n])}function _r(e,t){if((e=`${e}`)!=`bytes`)throw TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamType`);return e}function vr(e,t){Ee(e,t);let n=e?.preventAbort,r=e?.preventCancel,i=e?.preventClose,a=e?.signal;return a!==void 0&&function(e,t){if(!function(e){if(typeof e!=`object`||!e)return!1;try{return typeof e.aborted==`boolean`}catch{return!1}}(e))throw TypeError(`${t} is not an AbortSignal.`)}(a,`${t} has member 'signal' that`),{preventAbort:!!n,preventCancel:!!r,preventClose:!!i,signal:a}}Object.defineProperties(er.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),w(er.prototype.close,`close`),w(er.prototype.enqueue,`enqueue`),w(er.prototype.error,`error`),typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(er.prototype,Symbol.toStringTag,{value:`ReadableStreamDefaultController`,configurable:!0});var yr=class{constructor(e={},t={}){e===void 0?e=null:P(e,`First parameter`);let n=Xt(t,`Second parameter`),r=function(e,t){Ee(e,t);let n=e,r=n?.autoAllocateChunkSize,i=n?.cancel,a=n?.pull,o=n?.start,s=n?.type;return{autoAllocateChunkSize:r===void 0?void 0:je(r,`${t} has member 'autoAllocateChunkSize' that`),cancel:i===void 0?void 0:mr(i,n,`${t} has member 'cancel' that`),pull:a===void 0?void 0:hr(a,n,`${t} has member 'pull' that`),start:o===void 0?void 0:gr(o,n,`${t} has member 'start' that`),type:s===void 0?void 0:_r(s,`${t} has member 'type' that`)}}(e,`First parameter`);if(Sr(this),r.type===`bytes`){if(n.size!==void 0)throw RangeError(`The strategy for a byte stream cannot have a size function`);(function(e,t,n){let r=Object.create(ut.prototype),i,a,o;i=t.start===void 0?()=>{}:()=>t.start(r),a=t.pull===void 0?()=>k(void 0):()=>t.pull(r),o=t.cancel===void 0?()=>k(void 0):e=>t.cancel(e);let s=t.autoAllocateChunkSize;if(s===0)throw TypeError(`autoAllocateChunkSize must be greater than 0`);Nt(e,r,i,a,o,n,s)})(this,r,Jt(n,0))}else{let e=Yt(n);(function(e,t,n,r){let i=Object.create(er.prototype),a,o,s;a=t.start===void 0?()=>{}:()=>t.start(i),o=t.pull===void 0?()=>k(void 0):()=>t.pull(i),s=t.cancel===void 0?()=>k(void 0):e=>t.cancel(e),ur(e,i,a,o,s,n,r)})(this,r,Jt(n,1),e)}}get locked(){if(!Cr(this))throw Or(`locked`);return wr(this)}cancel(e=void 0){return Cr(this)?wr(this)?A(TypeError(`Cannot cancel a stream that already has a reader`)):Tr(this,e):A(Or(`cancel`))}getReader(e=void 0){if(!Cr(this))throw Or(`getReader`);return function(e,t){Ee(e,t);let n=e?.mode;return{mode:n===void 0?void 0:It(n,`${t} has member 'mode' that`)}}(e,`First parameter`).mode===void 0?Ne(this):Lt(this)}pipeThrough(e,t={}){if(!Cr(this))throw Or(`pipeThrough`);De(e,1,`pipeThrough`);let n=function(e,t){Ee(e,t);let n=e?.readable;Oe(n,`readable`,`ReadableWritablePair`),Me(n,`${t} has member 'readable' that`);let r=e?.writable;return Oe(r,`writable`,`ReadableWritablePair`),nn(r,`${t} has member 'writable' that`),{readable:n,writable:r}}(e,`First parameter`),r=vr(t,`Second parameter`);if(wr(this))throw TypeError(`ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream`);if(cn(n.writable))throw TypeError(`ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream`);return se(Yn(this,n.writable,r.preventClose,r.preventAbort,r.preventCancel,r.signal)),n.readable}pipeTo(e,t={}){if(!Cr(this))return A(Or(`pipeTo`));if(e===void 0)return A(`Parameter 1 is required in 'pipeTo'.`);if(!sn(e))return A(TypeError(`ReadableStream.prototype.pipeTo's first argument must be a WritableStream`));let n;try{n=vr(t,`Second parameter`)}catch(e){return A(e)}return wr(this)?A(TypeError(`ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream`)):cn(e)?A(TypeError(`ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream`)):Yn(this,e,n.preventClose,n.preventAbort,n.preventCancel,n.signal)}tee(){if(!Cr(this))throw Or(`tee`);return Ke(fr(this))}values(e=void 0){if(!Cr(this))throw Or(`values`);return function(e,t){let n=new I(Ne(e),t),r=Object.create(L);return r._asyncIteratorImpl=n,r}(this,function(e,t){return Ee(e,t),{preventCancel:!!e?.preventCancel}}(e,`First parameter`).preventCancel)}[Qe](e){return this.values(e)}static from(e){return pr(e)}};function br(e,t,n,r=1,i=()=>1){let a=Object.create(yr.prototype);return Sr(a),ur(a,Object.create(er.prototype),e,t,n,r,i),a}function xr(e,t,n){let r=Object.create(yr.prototype);return Sr(r),Nt(r,Object.create(ut.prototype),e,t,n,0,void 0),r}function Sr(e){e._state=`readable`,e._reader=void 0,e._storedError=void 0,e._disturbed=!1}function Cr(e){return!!S(e)&&!!Object.prototype.hasOwnProperty.call(e,`_readableStreamController`)&&e instanceof yr}function wr(e){return e._reader!==void 0}function Tr(e,t){if(e._disturbed=!0,e._state===`closed`)return k(void 0);if(e._state===`errored`)return A(e._storedError);Er(e);let n=e._reader;if(n!==void 0&&Wt(n)){let e=n._readIntoRequests;n._readIntoRequests=new de,e.forEach(e=>{e._closeSteps(void 0)})}return oe(e._readableStreamController[me](t),x)}function Er(e){e._state=`closed`;let t=e._reader;if(t!==void 0&&(we(t),Ve(t))){let e=t._readRequests;t._readRequests=new de,e.forEach(e=>{e._closeSteps()})}}function Dr(e,t){e._state=`errored`,e._storedError=t;let n=e._reader;n!==void 0&&(Ce(n,t),Ve(n)?We(n,t):Kt(n,t))}function Or(e){return TypeError(`ReadableStream.prototype.${e} can only be used on a ReadableStream`)}function kr(e,t){Ee(e,t);let n=e?.highWaterMark;return Oe(n,`highWaterMark`,`QueuingStrategyInit`),{highWaterMark:ke(n)}}Object.defineProperties(yr,{from:{enumerable:!0}}),Object.defineProperties(yr.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),w(yr.from,`from`),w(yr.prototype.cancel,`cancel`),w(yr.prototype.getReader,`getReader`),w(yr.prototype.pipeThrough,`pipeThrough`),w(yr.prototype.pipeTo,`pipeTo`),w(yr.prototype.tee,`tee`),w(yr.prototype.values,`values`),typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(yr.prototype,Symbol.toStringTag,{value:`ReadableStream`,configurable:!0}),Object.defineProperty(yr.prototype,Qe,{value:yr.prototype.values,writable:!0,configurable:!0});var Ar=e=>e.byteLength;w(Ar,`size`);var jr=class{constructor(e){De(e,1,`ByteLengthQueuingStrategy`),e=kr(e,`First parameter`),this._byteLengthQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!Nr(this))throw Mr(`highWaterMark`);return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!Nr(this))throw Mr(`size`);return Ar}};function Mr(e){return TypeError(`ByteLengthQueuingStrategy.prototype.${e} can only be used on a ByteLengthQueuingStrategy`)}function Nr(e){return!!S(e)&&!!Object.prototype.hasOwnProperty.call(e,`_byteLengthQueuingStrategyHighWaterMark`)&&e instanceof jr}Object.defineProperties(jr.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(jr.prototype,Symbol.toStringTag,{value:`ByteLengthQueuingStrategy`,configurable:!0});var Pr=()=>1;w(Pr,`size`);var Fr=class{constructor(e){De(e,1,`CountQueuingStrategy`),e=kr(e,`First parameter`),this._countQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!Lr(this))throw Ir(`highWaterMark`);return this._countQueuingStrategyHighWaterMark}get size(){if(!Lr(this))throw Ir(`size`);return Pr}};function Ir(e){return TypeError(`CountQueuingStrategy.prototype.${e} can only be used on a CountQueuingStrategy`)}function Lr(e){return!!S(e)&&!!Object.prototype.hasOwnProperty.call(e,`_countQueuingStrategyHighWaterMark`)&&e instanceof Fr}function Rr(e,t,n){return N(e,n),n=>ue(e,t,[n])}function zr(e,t,n){return N(e,n),n=>le(e,t,[n])}function Br(e,t,n){return N(e,n),(n,r)=>ue(e,t,[n,r])}function Vr(e,t,n){return N(e,n),n=>ue(e,t,[n])}Object.defineProperties(Fr.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(Fr.prototype,Symbol.toStringTag,{value:`CountQueuingStrategy`,configurable:!0});var Hr=class{constructor(e={},t={},n={}){e===void 0&&(e=null);let r=Xt(t,`Second parameter`),i=Xt(n,`Third parameter`),a=function(e,t){Ee(e,t);let n=e?.cancel,r=e?.flush,i=e?.readableType,a=e?.start,o=e?.transform,s=e?.writableType;return{cancel:n===void 0?void 0:Vr(n,e,`${t} has member 'cancel' that`),flush:r===void 0?void 0:Rr(r,e,`${t} has member 'flush' that`),readableType:i,start:a===void 0?void 0:zr(a,e,`${t} has member 'start' that`),transform:o===void 0?void 0:Br(o,e,`${t} has member 'transform' that`),writableType:s}}(e,`First parameter`);if(a.readableType!==void 0)throw RangeError(`Invalid readableType specified`);if(a.writableType!==void 0)throw RangeError(`Invalid writableType specified`);let o=Jt(i,0),s=Yt(i),c=Jt(r,1),l=Yt(r),u;(function(e,t,n,r,i,a){function o(){return t}function s(t){return function(e,t){let n=e._transformStreamController;return e._backpressure?oe(e._backpressureChangePromise,()=>{let r=e._writable;if(r._state===`erroring`)throw r._storedError;return Qr(n,t)}):Qr(n,t)}(e,t)}function c(t){return function(e,t){let n=e._transformStreamController;if(n._finishPromise!==void 0)return n._finishPromise;let r=e._readable;n._finishPromise=O((e,t)=>{n._finishPromise_resolve=e,n._finishPromise_reject=t});let i=n._cancelAlgorithm(t);return Xr(n),re(i,()=>(r._state===`errored`?ti(n,r._storedError):(sr(r._readableStreamController,t),ei(n)),null),e=>(sr(r._readableStreamController,e),ti(n,e),null)),n._finishPromise}(e,t)}function l(){return function(e){let t=e._transformStreamController;if(t._finishPromise!==void 0)return t._finishPromise;let n=e._readable;t._finishPromise=O((e,n)=>{t._finishPromise_resolve=e,t._finishPromise_reject=n});let r=t._flushAlgorithm();return Xr(t),re(r,()=>(n._state===`errored`?ti(t,n._storedError):(ar(n._readableStreamController),ei(t)),null),e=>(sr(n._readableStreamController,e),ti(t,e),null)),t._finishPromise}(e)}function u(){return function(e){return qr(e,!1),e._backpressureChangePromise}(e)}function d(t){return function(e,t){let n=e._transformStreamController;if(n._finishPromise!==void 0)return n._finishPromise;let r=e._writable;n._finishPromise=O((e,t)=>{n._finishPromise_resolve=e,n._finishPromise_reject=t});let i=n._cancelAlgorithm(t);return Xr(n),re(i,()=>(r._state===`errored`?ti(n,r._storedError):(jn(r._writableStreamController,t),Kr(e),ei(n)),null),t=>(jn(r._writableStreamController,t),Kr(e),ti(n,t),null)),n._finishPromise}(e,t)}e._writable=function(e,t,n,r,i=1,a=()=>1){let o=Object.create(rn.prototype);return on(o),Dn(o,Object.create(Tn.prototype),e,t,n,r,i,a),o}(o,s,l,c,n,r),e._readable=br(o,u,d,i,a),e._backpressure=void 0,e._backpressureChangePromise=void 0,e._backpressureChangePromise_resolve=void 0,qr(e,!0),e._transformStreamController=void 0})(this,O(e=>{u=e}),c,l,o,s),function(e,t){let n=Object.create(Jr.prototype),r,i,a;r=t.transform===void 0?e=>{try{return Zr(n,e),k(void 0)}catch(e){return A(e)}}:e=>t.transform(e,n),i=t.flush===void 0?()=>k(void 0):()=>t.flush(n),a=t.cancel===void 0?()=>k(void 0):e=>t.cancel(e),(function(e,t,n,r,i){t._controlledTransformStream=e,e._transformStreamController=t,t._transformAlgorithm=n,t._flushAlgorithm=r,t._cancelAlgorithm=i,t._finishPromise=void 0,t._finishPromise_resolve=void 0,t._finishPromise_reject=void 0})(e,n,r,i,a)}(this,a),a.start===void 0?u(void 0):u(a.start(this._transformStreamController))}get readable(){if(!Ur(this))throw ni(`readable`);return this._readable}get writable(){if(!Ur(this))throw ni(`writable`);return this._writable}};function Ur(e){return!!S(e)&&!!Object.prototype.hasOwnProperty.call(e,`_transformStreamController`)&&e instanceof Hr}function Wr(e,t){sr(e._readable._readableStreamController,t),Gr(e,t)}function Gr(e,t){Xr(e._transformStreamController),jn(e._writable._writableStreamController,t),Kr(e)}function Kr(e){e._backpressure&&qr(e,!1)}function qr(e,t){e._backpressureChangePromise!==void 0&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=O(t=>{e._backpressureChangePromise_resolve=t}),e._backpressure=t}Object.defineProperties(Hr.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(Hr.prototype,Symbol.toStringTag,{value:`TransformStream`,configurable:!0});var Jr=class{constructor(){throw TypeError(`Illegal constructor`)}get desiredSize(){if(!Yr(this))throw $r(`desiredSize`);return cr(this._controlledTransformStream._readable._readableStreamController)}enqueue(e=void 0){if(!Yr(this))throw $r(`enqueue`);Zr(this,e)}error(e=void 0){if(!Yr(this))throw $r(`error`);var t=e;Wr(this._controlledTransformStream,t)}terminate(){if(!Yr(this))throw $r(`terminate`);(function(e){let t=e._controlledTransformStream;ar(t._readable._readableStreamController),Gr(t,TypeError(`TransformStream terminated`))})(this)}};function Yr(e){return!!S(e)&&!!Object.prototype.hasOwnProperty.call(e,`_controlledTransformStream`)&&e instanceof Jr}function Xr(e){e._transformAlgorithm=void 0,e._flushAlgorithm=void 0,e._cancelAlgorithm=void 0}function Zr(e,t){let n=e._controlledTransformStream,r=n._readable._readableStreamController;if(!lr(r))throw TypeError(`Readable side is not in a state that permits enqueue`);try{or(r,t)}catch(e){throw Gr(n,e),n._readable._storedError}(function(e){return!rr(e)})(r)!==n._backpressure&&qr(n,!0)}function Qr(e,t){return oe(e._transformAlgorithm(t),void 0,t=>{throw Wr(e._controlledTransformStream,t),t})}function $r(e){return TypeError(`TransformStreamDefaultController.prototype.${e} can only be used on a TransformStreamDefaultController`)}function ei(e){e._finishPromise_resolve!==void 0&&(e._finishPromise_resolve(),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function ti(e,t){e._finishPromise_reject!==void 0&&(se(e._finishPromise),e._finishPromise_reject(t),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function ni(e){return TypeError(`TransformStream.prototype.${e} can only be used on a TransformStream`)}Object.defineProperties(Jr.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),w(Jr.prototype.enqueue,`enqueue`),w(Jr.prototype.error,`error`),w(Jr.prototype.terminate,`terminate`),typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(Jr.prototype,Symbol.toStringTag,{value:`TransformStreamDefaultController`,configurable:!0});var ri=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),ii=function(){return ii=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ii.apply(this,arguments)},ai=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},oi=function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o={next:s(0),throw:s(1),return:s(2)};return typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(o){if(r)throw TypeError(`Generator is already executing.`);for(;n;)try{if(r=1,i&&(a=o[0]&2?i.return:o[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,o[1])).done)return a;switch(i=0,a&&(o=[o[0]&2,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,i=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){n.label=o[1];break}if(o[0]===6&&n.label<a[1]){n.label=a[1],a=o;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(o);break}a[2]&&n.ops.pop(),n.trys.pop();continue}o=t.call(e,n)}catch(e){o=[6,e],i=0}finally{r=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}},si=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};function ci(){if(typeof wx>`u`||typeof Page>`u`||!wx.getSystemInfoSync||!wx.getStorageSync||!wx.setStorageSync||!wx.connectSocket||!wx.request)return!1;try{if(!wx.getSystemInfoSync()||wx.getSystemInfoSync().AppPlatform===`qq`)return!1}catch{return!1}return!0}function li(){return typeof App>`u`&&typeof getApp>`u`&&!wx.onAppHide&&!wx.offAppHide&&!wx.onAppShow&&!wx.offAppShow}var ui=`Error when aborting requestTask`,di=function(e){ri(t,e);function t(t){t===void 0&&(t={});var n=e.call(this)||this,r=t.timeout,i=t.timeoutMsg,a=t.restrictedMethods;return n._timeout=r||0,n._timeoutMsg=i||`请求超时`,n._restrictedMethods=a||[`get`,`post`,`upload`,`download`],n}return t.prototype.post=function(e){var t=this;return new Promise(function(n,r){var i=e.url,a=e.data,o=e.headers,s=wx.request({url:m(`https:`,i),data:a,timeout:t._timeout,method:`POST`,header:o,success:function(e){e.statusCode>=200&&e.statusCode<300?n({statusCode:e.statusCode,status:e.statusCode,data:e.data}):r(e)},fail:function(e){r(e)},complete:function(e){if(e&&e.errMsg&&t._timeout&&t._restrictedMethods.indexOf(`post`)!==-1&&e.errMsg===`request:fail timeout`){console.warn(t._timeoutMsg);try{s.abort()}catch{}}}})})},t.prototype.get=function(e){var t=this;return new Promise(function(n,r){var i=e.url,a=e.body,o=e.headers,s=m(`https:`,i),c=wx.request({url:s,data:a,timeout:t._timeout,method:`GET`,header:o,success:function(e){e.statusCode>=200&&e.statusCode<300?n({statusCode:e.statusCode,status:e.statusCode,data:e.data}):r(e)},fail:function(e){r(e)},complete:function(e){if(e&&e.errMsg&&t._timeout&&t._restrictedMethods.indexOf(`get`)!==-1&&e.errMsg.includes(`timeout`)){console.warn(t._timeoutMsg);try{c.abort()}catch(e){console.warn(ui,e)}}}})})},t.prototype.upload=function(e){var t=this,n=this;return new Promise(function(r){return ai(t,void 0,void 0,function(){var t,i,a,o,s,c;return oi(this,function(l){return t=e.url,i=e.file,a=e.data,o=e.headers,s=e.onUploadProgress,c=wx.uploadFile({url:t,filePath:i,name:`file`,formData:ii({},a),header:o,timeout:this._timeout,success:function(e){var t={statusCode:e.statusCode,data:e.data||{}};e.statusCode===200&&a.success_action_status&&(t.statusCode=parseInt(a.success_action_status,10)),r(t)},fail:function(e){r(e)},complete:function(e){if(e&&e.errMsg&&n._timeout&&n._restrictedMethods.indexOf(`upload`)!==-1&&e.errMsg===`request:fail timeout`){console.warn(n._timeoutMsg);try{c.abort()}catch{}}}}),s&&c.onProgressUpdate(function(e){s(e)}),[2]})})})},t.prototype.download=function(e){var t=this,n=this;return new Promise(function(r,i){var a=e.url,o=e.headers,s=wx.downloadFile({url:m(`https:`,a),header:o,timeout:t._timeout,success:function(e){e.statusCode===200&&e.tempFilePath?r({statusCode:200,tempFilePath:e.tempFilePath}):r(e)},fail:function(e){i(e)},complete:function(e){if(e&&e.errMsg&&n._timeout&&n._restrictedMethods.indexOf(`download`)!==-1&&e.errMsg===`request:fail timeout`){console.warn(n._timeoutMsg);try{s.abort()}catch{}}}})})},t.prototype.fetch=function(e){var t=e.url,n=e.body,r=e.enableAbort,i=e.headers,a=e.method,o=e.stream,s=o!==void 0&&o,c=e.signal,l=e.timeout,u=this,d=l??this._timeout,f=null,p=new yr({start:function(e){f=e},cancel:function(){f=null}});return new Promise(function(e,o){s&&e({data:p});var l=wx.request({url:m(`https:`,t),data:n,timeout:d,method:a.toUpperCase(),header:i,success:function(t){f?.close(),!s&&e(t)},fail:function(e){if(f?.close(),o(e),s)throw e},complete:function(e){if(e&&e.errMsg&&d&&u._restrictedMethods.indexOf(`post`)!==-1&&r&&e.errMsg===`request:fail timeout`){console.warn(u._timeoutMsg);try{l.abort()}catch(e){console.warn(ui,e)}}},enableChunked:s});if(l.onChunkReceived(function(e){f?.enqueue(new Uint8Array(e.data))}),c){var h=function(){try{l.abort()}catch(e){console.warn(ui,e)}};c.aborted?h():c.addEventListener(`abort`,function(){return h()})}})},t.prototype.patch=function(e){var t=e.method,n=e.headers,r=JSON.parse(JSON.stringify(n||{}));return t.toUpperCase()===`PATCH`&&(r[`X-HTTP-Method-Override`]=`PATCH`,t=`POST`),this.post(ii(ii({},e),{method:t,headers:r}))},t}(f),fi={setItem:function(e,t){wx.setStorageSync(e,t)},getItem:function(e){return wx.getStorageSync(e)},removeItem:function(e){wx.removeStorageSync(e)},clear:function(){wx.clearStorageSync()}},pi=function(){function e(e,t){t===void 0&&(t={});var n=wx.connectSocket(ii({url:e},t));return{set onopen(e){n.onOpen(e)},set onmessage(e){n.onMessage(e)},set onclose(e){n.onClose(e)},set onerror(e){n.onError(e)},send:function(e){return n.send({data:e})},close:function(e,t){return n.close({code:e,reason:t})},get readyState(){return n.readyState},CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3}}return e}();function mi(e){var t={},n=e.replace(/^[?#]/,``);return n&&n.split(`&`).forEach(function(e){var n=e.split(`=`),r=n[0],i=n[1];r=decodeURIComponent(r),i=decodeURIComponent(i),r&&(t[r]?Array.isArray(t[r])?t[r].push(i):t[r]=[t[r],i]:t[r]=i)}),t}function hi(e){return{root:{globalThis:{}},reqClass:di,wsClass:pi,captchaOptions:{openURIWithCallback:function(t){var n=e.EventBus,r={},i=t;console.log(`openURIWithCallback`,t);var a=t.match(/^(data:.*?)(\?[^#\s]*)?$/);if(a){i=a[1],console.log(`openURIWithCallback url`,i);var o=a[2];o&&(r=mi(o))}console.log(`openURIWithCallback queryObj`,r);var s=r.token,c=si(r,[`token`]);return/^data:/.test(i)&&!s?Promise.reject({error:`invalid_argument`,error_description:`invalie captcha data: `+t}):s?new Promise(function(e){console.log(`wait for captcha...`),n.$emit(`CAPTCHA_DATA_CHANGE`,ii(ii({},c),{token:s,url:i})),n.$once(`RESOLVE_CAPTCHA_DATA`,function(t){e(t)})}):Promise.reject({error:`unimplemented`,error_description:`need to impl captcha data`})}},localStorage:fi,primaryStorage:d.local,getAppSign:function(){var e=wx.getAccountInfoSync();return li()?e&&e.plugin?e.plugin.appId:``:e&&e.miniProgram?e.miniProgram.appId:``}}}var gi={genAdapter:hi,isMatch:ci,runtime:`wx_mp`},_i={d:(e,t)=>{for(var n in t)_i.o(t,n)&&!_i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},vi={};_i.d(vi,{Z:()=>eo});var yi=`@cloudbase/js-sdk`;function bi(){return yi}var xi=`https:`,Si={INVALID_PARAMS:`INVALID_PARAMS`,INVALID_SYNTAX:`INVALID_SYNTAX`,INVALID_OPERATION:`INVALID_OPERATION`,OPERATION_FAIL:`OPERATION_FAIL`,NETWORK_ERROR:`NETWORK_ERROR`,UNKOWN_ERROR:`UNKOWN_ERROR`},Ci=(wi={AbstractSDKRequest:()=>f,AbstractStorage:()=>p,StorageType:()=>d},Ti={},_i.d(Ti,wi),Ti),wi,Ti,Ei=function(e,t){return Ei=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Ei(e,t)},Di,Oi=function(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);function n(){this.constructor=e}Ei(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)};function ki(e){return Object.prototype.toString.call(e)===`[object FormData]`}function Ai(e,t,n){n===void 0&&(n={});var r=/\?/.test(t),i=``;return Object.keys(n).forEach(function(e){i===``?!r&&(t+=`?`):i+=`&`,i+=`${e}=${encodeURIComponent(n[e])}`}),/^http(s)?:\/\//.test(t+=i)?t:`${e}${t}`}function ji(e,t){console.warn(`[${bi()}][${e}]:${t}`)}function Mi(e){var t={},n=e.match(/^(data:.*?)(\?[^#\s]*)?$/);if(n){e=n[1];var r=n[2];r&&(t=function(e){e=e.replace(/^\?/,``);var t={};return e.split(`&`).forEach(function(e){var n=e.split(`=`),r=n[0],i=n[1];r=decodeURIComponent(r),i=decodeURIComponent(i),r&&(t[r]?Array.isArray(t[r])?t[r].push(i):t[r]=[t[r],i]:t[r]=i)}),t}(r))}var i=t.token,a=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(t,[`token`]);return/^data:/.test(e)&&!i?{error:`invalid_argument`,error_description:`invalid captcha data: ${e}`}:i?{state:a.state,token:i,captchaData:e}:{error:`unimplemented`,error_description:`need to impl captcha data`}}Di=Error,Oi(function(e){var t=Di.call(this,e.msg||e.message||``)||this;return t.code=e.code||``,t.requestId=e.requestId||``,Object.defineProperty(t,"message",{value:e.msg||e.message||``,enumerable:!0,writable:!0,configurable:!0}),t},Di);var Ni,Pi=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Fi=function(){return Fi=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Fi.apply(this,arguments)},Ii=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},Li=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},Ri=function(e){function t(t){var n=e.call(this)||this,r=t.timeout,i=t.timeoutMsg,a=t.restrictedMethods;return n.timeout=r||0,n.timeoutMsg=i||`请求超时`,n.restrictedMethods=a||[`get`,`post`,`upload`,`download`],n}return Pi(t,e),t.prototype.get=function(e){return this.request(Fi(Fi({},e),{method:`get`}),this.restrictedMethods.includes(`get`))},t.prototype.post=function(e){return this.request(Fi(Fi({},e),{method:`post`}),this.restrictedMethods.includes(`post`))},t.prototype.put=function(e){return this.request(Fi(Fi({},e),{method:`put`}))},t.prototype.upload=function(e){var t=e.data,n=e.file,r=e.name,i=e.method,a=e.headers,o=a===void 0?{}:a,s={post:`post`,put:`put`}[i?.toLowerCase()]||`put`,c=new FormData;return s===`post`?(Object.keys(t).forEach(function(e){c.append(e,t[e])}),c.append(`key`,r),c.append(`file`,n),this.request(Fi(Fi({},e),{data:c,method:s}),this.restrictedMethods.includes(`upload`))):this.request(Fi(Fi({},e),{method:`put`,headers:o,body:n}),this.restrictedMethods.includes(`upload`))},t.prototype.download=function(e){return Ii(this,void 0,Promise,function(){var t,n,r,i;return Li(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.get(Fi(Fi({},e),{headers:{},responseType:`blob`}))];case 1:return t=a.sent().data,n=window.URL.createObjectURL(new Blob([t])),r=decodeURIComponent(new URL(e.url).pathname.split(`/`).pop()||``),(i=document.createElement(`a`)).href=n,i.setAttribute(`download`,r),i.style.display=`none`,document.body.appendChild(i),i.click(),window.URL.revokeObjectURL(n),document.body.removeChild(i),[3,3];case 2:return a.sent(),[3,3];case 3:return[2,new Promise(function(t){t({statusCode:200,tempFilePath:e.url})})]}})})},t.prototype.fetch=function(e){return Ii(this,void 0,Promise,function(){var t,n,r,i,a,o,s,c,l,u,d,f,p,m=this;return Li(this,function(h){switch(h.label){case 0:return t=new AbortController,n=e.url,r=e.enableAbort,i=r!==void 0&&r,a=e.stream,o=a!==void 0&&a,s=e.signal,c=e.timeout,l=e.shouldThrowOnError,u=l===void 0||l,d=c??this.timeout,s&&(s.aborted&&t.abort(),s.addEventListener(`abort`,function(){return t.abort()})),f=null,i&&d&&(f=setTimeout(function(){console.warn(m.timeoutMsg),t.abort(Error(m.timeoutMsg))},d)),[4,fetch(n,Fi(Fi({},e),{signal:t.signal})).then(function(e){return Ii(m,void 0,void 0,function(){var t,n,r;return Li(this,function(i){switch(i.label){case 0:return clearTimeout(f),u?e.ok?(t=e,[3,3]):[3,1]:[3,4];case 1:return r=(n=Promise).reject,[4,e.json()];case 2:t=r.apply(n,[i.sent()]),i.label=3;case 3:return[2,t];case 4:return[2,e]}})})}).catch(function(e){return clearTimeout(f),Promise.reject(e)})];case 1:return p=h.sent(),[2,{data:o?p.body:p.headers.get(`content-type`)?.includes(`application/json`)?p.json():p.text(),statusCode:p.status,header:p.headers,response:p}]}})})},t.prototype.request=function(e,t){var n=this;t===void 0&&(t=!1);var r=String(e.method).toLowerCase()||`get`;return new Promise(function(i){var a=e.url,o=e.headers,s=o===void 0?{}:o,c=e.data,l=e.responseType,u=e.withCredentials,d=e.body,f=e.onUploadProgress,p=Ai(xi,a,r===`get`?c:{}),m=new XMLHttpRequest;m.open(r,p),l&&(m.responseType=l);var h,g,_=e.signal;_&&(_.aborted?m.abort():_.addEventListener(`abort`,function(){return m.abort()},{once:!0})),Object.keys(s).forEach(function(e){m.setRequestHeader(e,s[e])}),f&&m.upload.addEventListener(`progress`,f),m.onreadystatechange=function(){var e={};if(m.readyState===4){var t=m.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};t.forEach(function(e){var t=e.split(`: `),r=t.shift().toLowerCase();n[r]=t.join(`: `)}),e.header=n,e.statusCode=m.status;try{e.data=l===`blob`?m.response:JSON.parse(m.responseText)}catch{e.data=l===`blob`?m.response:m.responseText}clearTimeout(h),i(e)}},t&&n.timeout&&(h=setTimeout(function(){console.warn(n.timeoutMsg),m.abort()},n.timeout)),g=ki(c)?c:s[`content-type`]===`application/x-www-form-urlencoded`?function(e){e===void 0&&(e={});var t=[];return Object.keys(e).forEach(function(n){t.push(`${n}=${encodeURIComponent(e[n])}`)}),t.join(`&`)}(c):d||(c?JSON.stringify(c):void 0),u&&(m.withCredentials=!0),m.send(g)})},t}(Ci.AbstractSDKRequest),zi=function(){return zi=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},zi.apply(this,arguments)};(function(e){e.WEB=`web`,e.WX_MP=`wx_mp`})(Ni||={});var Bi=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Vi=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},Hi=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},Ui=function(e){function t(t){var n=e.call(this)||this;return n.root=t,t.tcbCacheObject||={},n}return Bi(t,e),t.prototype.setItem=function(e,t){this.root.tcbCacheObject[e]=t},t.prototype.getItem=function(e){return this.root.tcbCacheObject[e]},t.prototype.removeItem=function(e){delete this.root.tcbCacheObject[e]},t.prototype.clear=function(){delete this.root.tcbCacheObject},t}(Ci.AbstractStorage),Wi=function(){function e(e){this.keys={};var t=e.persistence,n=e.platformInfo,r=n===void 0?{}:n,i=e.keys,a=i===void 0?{}:i;this.platformInfo=r,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||t,this.storage=function(e,t){switch(e){case`local`:default:return t.localStorage?t.localStorage:(ji(Si.INVALID_PARAMS,`localStorage is not supported on current platform`),new Ui(t.root));case`none`:return new Ui(t.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=a)}return Object.defineProperty(e.prototype,"mode",{get:function(){return this.storage.mode||`sync`},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),e.prototype.setStore=function(e,t,n){if(this.mode!==`async`){if(this.storage)try{var r={version:n||`localCachev1`,content:t};this.storage.setItem(e,JSON.stringify(r))}catch(e){throw Error(JSON.stringify({code:Si.OPERATION_FAIL,msg:`[${bi()}][${Si.OPERATION_FAIL}]setStore failed`,info:e}))}}else ji(Si.INVALID_OPERATION,`current platform's storage is asynchronous, please use setStoreAsync insteed`)},e.prototype.setStoreAsync=function(e,t,n){return Vi(this,void 0,void 0,function(){var r;return Hi(this,function(i){switch(i.label){case 0:if(!this.storage)return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),r={version:n||`localCachev1`,content:t},[4,this.storage.setItem(e,JSON.stringify(r))];case 2:return i.sent(),[3,4];case 3:return i.sent(),[2];case 4:return[2]}})})},e.prototype.getStore=function(e,t){if(this.mode!==`async`){try{if(typeof process<`u`&&{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token)return{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token;if(!this.storage)return``}catch{return``}t||=`localCachev1`;var n=this.storage.getItem(e);return n&&n.indexOf(t)>=0?JSON.parse(n).content:``}ji(Si.INVALID_OPERATION,`current platform's storage is asynchronous, please use getStoreAsync insteed`)},e.prototype.getStoreAsync=function(e,t){return Vi(this,void 0,void 0,function(){var n;return Hi(this,function(r){switch(r.label){case 0:try{if(typeof process<`u`&&{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token)return[2,{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token];if(!this.storage)return[2,``]}catch{return[2,``]}return t||=`localCachev1`,[4,this.storage.getItem(e)];case 1:return(n=r.sent())&&n.indexOf(t)>=0?[2,JSON.parse(n).content]:[2,``]}})})},e.prototype.removeStore=function(e){this.mode===`async`?ji(Si.INVALID_OPERATION,`current platform's storage is asynchronous, please use removeStoreAsync insteed`):this.storage.removeItem(e)},e.prototype.removeStoreAsync=function(e){return Vi(this,void 0,void 0,function(){return Hi(this,function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}})})},e}(),Gi=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ki=function(e,t){this.data=t||null,this.name=e},qi=function(e){function t(t,n){var r=e.call(this,`error`,{error:t,data:n})||this;return r.error=t,r}return Gi(t,e),t}(Ki),Ji=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){return function(e,t,n){n[e]=n[e]||[],n[e].push(t)}(e,t,this.listeners),this},e.prototype.off=function(e,t){return function(e,t,n){if(n?.[e]){var r=n[e].indexOf(t);r!==-1&&n[e].splice(r,1)}}(e,t,this.listeners),this},e.prototype.fire=function(e,t){if(e instanceof qi)return console.error(e.error),this;var n=typeof e==`string`?new Ki(e,t||{}):e,r=n.name;if(this.listens(r)){n.target=this;for(var i=0,a=this.listeners[r]?function(e,t,n){if(n||arguments.length===2)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||=Array.prototype.slice.call(t,0,i),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([],this.listeners[r],!0):[];i<a.length;i++)a[i].call(this,n)}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}();new Ji;var Yi=new Ji,Xi=`lang_change`;typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.indexOf(`Firefox`),(e=>{var t={};return _i.d(t,e),t})({default:()=>b}).default;var Zi=function(e,t,n){if(n||arguments.length===2)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||=Array.prototype.slice.call(t,0,i),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))},Qi=Si,$i={};function ea(e,t){var n=t.name,r=t.namespace,i=t.entity,a=t.injectEvents,o=t.IIFE,s=o!==void 0&&o;if($i[n]||r&&e[r])throw Error(JSON.stringify({code:Qi.INVALID_OPERATION,msg:`Duplicate component ${n}`}));if(s){if(!i||typeof i!=`function`)throw Error(JSON.stringify({code:Qi.INVALID_PARAMS,msg:`IIFE component's entity must be a function`}));i.call(e)}if($i[n]=t,r?e.prototype[r]=i:ta(e.prototype,i),a){var c=a.bus,l=a.events;if(!c||!l||l.length===0)return;var u=e.prototype.fire||function(){};e.prototype.events||(e.prototype.events={}),(e.prototype.events||{})[n]?e.prototype.events[n].events=Zi(Zi([],e.prototype.events[n].events,!0),l,!0):e.prototype.events[n]={bus:c,events:l},e.prototype.fire=function(e,t){u(e,t);for(var n=0,r=Object.keys(this.events);n<r.length;n++){var i=r[n],a=this.events[i],o=a.bus;if(a.events.includes(e)){o.fire(e,t);break}}}}}function ta(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:return new Date(t.getTime());case Object:e===void 0&&(e={});break;case Array:e=[];break;default:return t}for(var n=0,r=Object.keys(t);n<r.length;n++){var i=r[n];Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=ta(e[i],t[i]))}return e}var na=(e=>{var t={};return _i.d(t,e),t})({WxMpWebSocket:()=>pi,WxRequest:()=>di,default:()=>gi,parseQueryString:()=>mi,wxMpStorage:()=>fi}),ra=function(){return ra=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ra.apply(this,arguments)},ia={},aa=function(){return aa=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},aa.apply(this,arguments)},oa=Wi,sa={},ca={};function la(e){var t=e.env,n=e.platformInfo,r={userInfoKey:`user_info_${t}`};sa[t]=sa[t]||new oa(aa(aa({},e),{keys:r,platformInfo:n})),ca[t]=ca[t]||new oa(aa(aa({},e),{keys:r,platformInfo:n,persistence:`local`}))}function ua(e){return ca[e]}var da=function(){return da=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},da.apply(this,arguments)},fa=``,pa=`@cloudbase/js-sdk`;function ma(){return fa}var ha,ga=[],_a=[`env`,`endPointKey`,`region`],va=`https:`;function ya(e){return ga.find(function(t){return _a.filter(function(t){return e[t]!=null}).every(function(n){return t[n]===e[n]})})}function ba(e){e.protocol&&!/:$/.test(e.protocol)&&(e.protocol=`${e.protocol}:`);var t,n=ya(e);n?(e.baseUrl!=null&&(n.baseUrl=e.baseUrl),e.protocol!=null&&(n.protocol=e.protocol)):ga.push(da(da({},e),{protocol:e.protocol??va})),e.endPointKey===`CLOUD_API`&&(t=e.protocol??va,xi=t)}function xa(e,t,n){return ya({env:e,endPointKey:t,region:n})}function Sa(e,t){t===void 0&&(t=`CLOUD_API`);var n=xa(e,t||`CLOUD_API`);return`${n.protocol}${n.baseUrl}`.match(/(http(s)?:)?\/\/([^/?#]*)/)[0]}(function(e){e.NULL=`NULL`,e.ANONYMOUS=`ANONYMOUS`,e.WECHAT=`WECHAT`,e.WECHAT_PUBLIC=`WECHAT-PUBLIC`,e.WECHAT_OPEN=`WECHAT-OPEN`,e.CUSTOM=`CUSTOM`,e.EMAIL=`EMAIL`,e.USERNAME=`USERNAME`,e.PHONE=`PHONE`})(ha||={});var Ca=function(){return Ca=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ca.apply(this,arguments)},wa=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},Ta=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},Ea=Si,Da=ki,Oa=Ai,ka=[`auth.getJwt`,`auth.logout`,`auth.signInWithTicket`,`auth.signInAnonymously`,`auth.signIn`,`auth.fetchAccessTokenWithRefreshToken`,`auth.signUpWithEmailAndPassword`,`auth.activateEndUserMail`,`auth.sendPasswordResetEmail`,`auth.resetPasswordWithToken`,`auth.isUsernameRegistered`];function Aa(e,t,n){var r=e[t];e[t]=function(t){var i={},a={};n.forEach(function(n){var r=n.call(e,t),o=r.data,s=r.headers;Object.assign(i,o),Object.assign(a,s)});var o=t.data;return o&&(Da(o)?Object.keys(i).forEach(function(e){o.append(e,i[e])}):t.data=Ca(Ca({},o),i)),t.headers=Ca(Ca({},t.headers||{}),a),r.call(e,t)}}function ja(){var e=Math.random().toString(16).slice(2);return{data:{seqId:e},headers:{"X-SDK-Version":`@cloudbase/js-sdk/${ma()}`,"x-seqid":e}}}var Ma,Na,Pa=function(){function e(e){var t=this;this.config=e;var n={env:this.config.env,region:this.config.region,accessKey:this.config.accessKey,context:this.config.context,auth:this.config.auth,timeout:this.config.timeout,timeoutMsg:`[@cloudbase/js-sdk] 请求在${this.config.timeout/1e3}s内未完成,已中断`,restrictedMethods:[`post`,`put`]};this.reqClass=new ia.adapter.reqClass(n),this.localCache=ua(this.config.env),this.config.endPointMode!==`GATEWAY`&&(Aa(this.reqClass,`post`,[ja]),Aa(this.reqClass,`upload`,[ja]),Aa(this.reqClass,`download`,[ja])),Yi.on(Xi,function(e){t.config.i18n=e.data?.i18n||t.config.i18n})}return Object.defineProperty(e.prototype,"throwWhenRequestFail",{get:function(){var e=this.config?._fromApp?.config?.throw;return typeof e==`boolean`?e:!1!==this.config?.throw},enumerable:!1,configurable:!0}),e.prototype.getAccessToken=function(e){return e===void 0&&(e=null),wa(this,void 0,void 0,function(){var t,n,r;return Ta(this,function(i){switch(i.label){case 0:if(e!=null)return[2,e];if(!(t=this.config._fromApp).oauthInstance)throw Error(`you can't request without auth`);return n=t.oauthInstance,r=n.oauth2client,[4,this.getOauthAccessTokenV2(r)];case 1:return[2,i.sent().accessToken]}})})},e.prototype.getDefaultHeaders=function(){var e;return(e={})[this.config.i18n?.LANG_HEADER_KEY]=this.config.i18n?.lang,e[`X-SDK-Version`]=`@cloudbase/js-sdk/${ma()}`,e},e.prototype.post=function(e,t){return wa(this,void 0,Promise,function(){return Ta(this,function(n){switch(n.label){case 0:return[4,this.reqClass.post(Ca(Ca({},e),{headers:Ca(Ca({},e.headers),this.getDefaultHeaders()),customReqOpts:t}))];case 1:return[2,n.sent()]}})})},e.prototype.upload=function(e){return wa(this,void 0,Promise,function(){return Ta(this,function(t){switch(t.label){case 0:return[4,this.reqClass.upload(Ca(Ca({},e),{headers:Ca(Ca({},e.headers),this.getDefaultHeaders())}))];case 1:return[2,t.sent()]}})})},e.prototype.download=function(e){return wa(this,void 0,Promise,function(){return Ta(this,function(t){switch(t.label){case 0:return[4,this.reqClass.download(Ca(Ca({},e),{headers:Ca(Ca({},e.headers),this.getDefaultHeaders())}))];case 1:return[2,t.sent()]}})})},e.prototype.getBaseEndPoint=function(e){return e===void 0&&(e=`CLOUD_API`),Sa(this.config.env,e)},e.prototype.getOauthAccessTokenV2=function(e){return wa(this,void 0,Promise,function(){var t,n;return Ta(this,function(r){switch(r.label){case 0:return[4,e.getAccessToken()];case 1:return t=r.sent(),[4,e.getCredentials()];case 2:return n=r.sent(),[2,{accessToken:t,accessTokenExpire:new Date(n.expires_at).getTime()}]}})})},e.prototype.request=function(e,t,n,r){return wa(this,void 0,Promise,function(){var i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E;return Ta(this,function(D){switch(D.label){case 0:if(D.trys.push([0,4,,5]),i=`x-tcb-trace_${this.config.env}`,a=`application/x-www-form-urlencoded`,o=Ca({action:e,dataVersion:`2020-01-10`,env:this.config.env},t),ka.indexOf(e)!==-1)return[3,2];if(!(s=this.config._fromApp).oauthInstance)throw Error(`you can't request without auth`);return c=s.oauthInstance,l=c.oauth2client,u=o,[4,this.getOauthAccessTokenV2(l)];case 1:u.access_token=D.sent().accessToken,D.label=2;case 2:return e===`storage.uploadFile`?(d=new FormData,Object.keys(d).forEach(function(e){Object.prototype.hasOwnProperty.call(d,e)&&d[e]!==void 0&&d.append(e,o[e])}),a=`multipart/form-data`):(a=`application/json;charset=UTF-8`,d={},Object.keys(o).forEach(function(e){o[e]!==void 0&&(d[e]=o[e])})),f={headers:Ca(Ca({"content-type":a},this.getDefaultHeaders()),n?.headers)},n!=null&&n.onUploadProgress&&(f.onUploadProgress=n.onUploadProgress),this.config.region&&(f.headers[`X-TCB-Region`]=this.config.region),(p=this.localCache.getStore(i))&&(f.headers[`X-TCB-Trace`]=p),m=n?.parse===void 0?t.parse:n.parse,h=n?.inQuery===void 0?t.inQuery:n.inQuery,g=n?.search===void 0?t.search:n.search,_=Ca(Ca({},n?.defaultQuery||{}),{env:this.config.env}),m&&(_.parse=!0),h&&(_=Ca(Ca({},h),_)),v=n?.endPointMode||this.config.endPointMode||`CLOUD_API`,y=xa(this.config.env,v),b=y.baseUrl,x=y.protocol,v===`GATEWAY`&&/^((database)\.)|(auth\.wsWebSign)/.test(e)&&(S=xa(this.config.env,`CLOUD_API`),b=`${S.baseUrl.match(/\/\/([^/?#]*)/)[0]}/web`),C=void 0,C=n.pathname?Oa(x,`${Sa(this.config.env,v)?.replace(/^https?:/,``)}/${n.pathname}`,_):Oa(x,b,_),g&&(C+=g),[4,this.post(Ca({url:C,data:d},f),r)];case 3:if(w=D.sent(),(T=w.header?.[`x-tcb-trace`])&&this.localCache.setStore(i,T),Number(w.status)!==200&&Number(w.statusCode)!==200||!w.data)throw Error(`network request error`);return[2,w];case 4:E=D.sent();try{E.requestId=E.requestId||n?.headers[`x-request-id`]||n?.headers[`X-Request-Id`]||``}catch{}throw E;case 5:return[2]}})})},e.prototype.fetch=function(e){return wa(this,void 0,Promise,function(){var t,n,r,i,a,o,s,c,l=this;return Ta(this,function(u){switch(u.label){case 0:t=e.token,n=e.headers,r=n===void 0?{}:n,i=e.withCredentials,a=i===void 0||i,o=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,[`token`,`headers`,`withCredentials`]),s=function(){return wa(l,void 0,void 0,function(){var e,n,i,s;return Ta(this,function(c){switch(c.label){case 0:if(e={},!a)return[3,4];c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this.getAccessToken(t)];case 2:return(n=c.sent())&&(e.Authorization=`Bearer ${n}`),[3,4];case 3:if(i=c.sent(),typeof process>`u`||process.versions==null||process.versions.node==null)throw i;return[3,4];case 4:return s=Ca({headers:Ca(Ca(Ca({"X-SDK-Version":`@cloudbase/js-sdk/${ma()}`},e),this.getDefaultHeaders()),r),withCredentials:a},o),[2,this.reqClass.fetch(s)]}})})},u.label=1;case 1:return u.trys.push([1,3,,6]),[4,s()];case 2:return[2,u.sent()];case 3:c=u.sent();try{c.requestId=c.requestId||r[`x-request-id`]||r[`X-Request-Id`]||``}catch{}if(c?.code!==`ACCESS_TOKEN_EXPIRED`)return[3,5];if(typeof this.config?._fromApp?.oauthInstance?.authApi?.refreshTokenForce!=`function`)throw c;return[4,(this.config?._fromApp?.oauthInstance?.authApi)?.refreshTokenForce()];case 4:return u.sent(),[2,s()];case 5:throw c;case 6:return[2]}})})},e.prototype.send=function(e,t,n,r){return t===void 0&&(t={}),n===void 0&&(n={}),wa(this,void 0,Promise,function(){var i;return Ta(this,function(a){switch(a.label){case 0:return[4,this.request(e,t,Ca(Ca({},n),{onUploadProgress:t.onUploadProgress}),r)];case 1:if((i=a.sent()).data.code&&this.throwWhenRequestFail)throw Error(JSON.stringify({code:Ea.OPERATION_FAIL,msg:`[${i.data.code}] ${i.data.message}`}));return[2,i.data]}})})},e.prototype.gateWay=function(e,t){return wa(this,void 0,void 0,function(){var n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b;return Ta(this,function(x){switch(x.label){case 0:if(n=e.url,r=e.name,i=e.data,a=e.path,o=a===void 0?``:a,s=e.method,c=e.header,l=c===void 0?{}:c,!(r&&o||n))throw Error(JSON.stringify({code:Ea.INVALID_PARAMS,msg:`[gateWay] invalid function name or path or url`}));try{u=i?JSON.stringify(i):``}catch{throw Error(JSON.stringify({code:Ea.INVALID_PARAMS,msg:`[gateWay] invalid data`}))}if(S=new Date().getTime(),C=(Date==null?void 0:Date.now)&&1e3*Date.now()||0,d=`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,function(e){var t=16*Math.random();return S>0?(t=(S+t)%16|0,S=Math.floor(S/16)):(t=(C+t)%16|0,C=Math.floor(C/16)),(e===`x`?t:7&t|8).toString(16)}),f=xa(this.config.env,`GATEWAY`),p=f.baseUrl,m=f.protocol,h=`${m}${p}${n||`/${o}/${r}`}`,g=[`GET`,`HEAD`].includes((s?.toUpperCase)?.call(s)))try{_={};try{_=JSON.parse(i)}catch{_=i||{}}h=`${h}${h.includes(`?`)?`&`:`?`}${Object.keys(_).map(function(e){return`${e}=${_[e]}`}).join(`&`)}`}catch{}return[4,this.fetch(Ca(Ca({method:s||`POST`,headers:Ca({"Content-Type":`application/json; charset=utf-8`,"X-Request-Id":d},l)},g?{}:{body:u}),{url:h,customReqOpts:t,shouldThrowOnError:this.throwWhenRequestFail}))];case 1:return v=x.sent(),y=[Ca({requestId:d},v)],b={},[4,v.data];case 2:return[2,Ca.apply(void 0,y.concat([(b.data=x.sent(),b)]))]}var S,C})})},e}(),Fa={};(function(e){e.ZH=`zh-CN`,e.EN=`en-US`})(Na||={});var Ia=((Ma={})[Na.EN]={"请检查调用方式,或前往云开发 AI+ 首页查看文档":`Please check the calling method or visit the AI+ homepage to view the documentation`,"AI+ 请求出错,错误码":`AI+ request error, error code`,错误信息:`error message`,未实现:`not implemented`,"小程序不支持 wasm 加载":`wasm loading is not supported in mini programs`,"小程序不支持动态 js 加载":`dynamic js loading is not supported in mini programs`,请求超时:`request timeout`,"缺少 privatelink sdk 地址":`missing privatelink sdk address`},Ma),La=function(e,t){return Ia[t]?.[e]||e},Ra=function(e,t){var n,r=function(e){return`lang_${e.clientId||e.env}`}(t),i=(e.adapter||{}).localStorage,a=t.lang||(i?.getItem)?.call(i,r)||Na.ZH;return(n=i?.setItem)==null||n.call(i,r,a),new Proxy({t:function(e){return La(e,a)},LANG_HEADER_KEY:`Accept-Language`,lang:a},{get:function(e,t){return t===`lang`&&(i?.getItem)?.call(i,r)||e[t]},set:function(e,t,n){var a;return t===`lang`&&n!==e[t]&&(e[t]=n,e.t=function(e){return La(e,n)},(a=i?.setItem)==null||a.call(i,r,n),Yi.fire(Xi,{i18n:e})),e[t]=n,!0}})},za=new Set,Ba=function(){return Ba=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ba.apply(this,arguments)},Va=function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},Ha=function(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)},Ua=function(){return{adapter:zi({},{type:`default`,root:window,reqClass:Ri,wsClass:WebSocket,localStorage}),runtime:Ni.WEB}},Wa=Si,Ga=`https://support.qq.com/products/148793`,Ka=ji,qa=function(e){return e.mode,e.customInfo,e.title,e.messages,function(e,t,n){}},Ja={persistence:`local`},Ya=6e5,Xa={},Za=new(function(){function e(e){this.cloudbaseConfig=e||this.cloudbaseConfig,this.authInstance=null,this.oauthInstance=null,this.requestInstance=null,this.version=ma()}return Object.defineProperty(e.prototype,"config",{get:function(){return this.cloudbaseConfig},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"platform",{get:function(){return ia},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cache",{get:function(){return e=this.cloudbaseConfig.env,sa[e];var e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"localCache",{get:function(){return ua(this.cloudbaseConfig.env)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"request",{get:function(){return this.requestInstance||(e=this.cloudbaseConfig.env,Fa[e]);var e},enumerable:!1,configurable:!0}),e.prototype.init=function(t){var n,r,i,a;if(t===void 0&&(t={env:``}),t.endPointMode=t.endPointMode||`GATEWAY`,ia.adapter||this.useDefaultAdapter(),(t=this.dealNodeAdapterConfig(t)).throw=(n=t.throw??t.throwOnCode)==null||n,delete t.throwOnCode,!t.env)throw Error(JSON.stringify({code:Wa.INVALID_PARAMS,msg:`env must not be specified`}));this.isInitialized(t);var o=this.isNodeEnv()?void 0:15e3,s=t.timeout||o,c={env:t.env,region:t.region,accessKey:t.accessKey,context:t.context,auth:t.auth,timeout:s,timeoutMsg:s?`[${pa}][REQUEST TIMEOUT] request had been abort since didn't finished within${s/1e3}s`:void 0};this.requestClient=new ia.adapter.reqClass(c),this.cloudbaseConfig=Ba(Ba(Ba({},Ja),t),{timeout:s,i18n:Ra(ia,t)}),function(e){e&&typeof e==`object`&&za.add(e)}(this.cloudbaseConfig),delete this.cloudbaseConfig.lang,this.cloudbaseConfig.timeout=this.formatTimeout(this.cloudbaseConfig.timeout);var l=this.cloudbaseConfig,u=l.env,d=l.persistence,f=l.debug,p=l.timeout,m=l.oauthClient,h=l.i18n;la({env:u,persistence:d,debug:f,platformInfo:this.platform}),function(e,t){ba({env:e,region:t,baseUrl:`//${e}.${t||`ap-shanghai`}.tcb-api.tencentcloudapi.com/web`,protocol:void 0,endPointKey:`CLOUD_API`})}(u,t.region||``),function(e,t,n){var r=`//${e}.api.tcloudbasegateway.com/v1`;n&&(r=`//${e}.api.intl.tcloudbasegateway.com/v1`),ba({endPointKey:`GATEWAY`,env:e,baseUrl:r,protocol:t})}(u,va,t.intl);var g=new e(this.cloudbaseConfig);return g.requestInstance=function(e){var t=new Pa(Ca(Ca({},e),{throw:e.throw}));return Fa[e.env]=t,t}({env:u,region:t.region||``,timeout:p,oauthClient:m,_fromApp:g,i18n:h,endPointMode:t.endPointMode,auth:t.auth,context:t.context,accessKey:t.accessKey,throw:t.throw}),g.requestClient=this.requestClient,(r=this==null?void 0:this.fire)==null||r.call(this,`cloudbase_init`,g),this.try2InitAuth(g),(i=ia.adapter)!=null&&i.nodeTool&&((a=ia.adapter)==null||a.nodeTool(g,this.cloudbaseConfig)),g},e.prototype.updateConfig=function(e){var t=e.persistence,n=e.debug;this.cloudbaseConfig.persistence=t,this.cloudbaseConfig.debug=n,la({env:this.cloudbaseConfig.env,persistence:t,debug:n,platformInfo:this.platform})},e.prototype.setThrowOnCode=function(e){this.cloudbaseConfig.throw=e},e.prototype.updateLang=function(e){e&&e!==this.cloudbaseConfig.i18n?.lang&&(this.cloudbaseConfig.i18n.lang=e)},e.prototype.registerExtension=function(e){Xa[e.name]=e},e.prototype.invokeExtension=function(e,t){return n=this,r=void 0,a=function(){var n;return function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}(this,function(r){switch(r.label){case 0:if(!(n=Xa[e]))throw Error(JSON.stringify({code:Wa.INVALID_PARAMS,msg:`extension:${e} must be registered before invoke`}));return[4,n.invoke(t,this)];case 1:return[2,r.sent()]}})},new((i=void 0)||(i=Promise))(function(e,t){function o(e){try{c(a.next(e))}catch(e){t(e)}}function s(e){try{c(a.throw(e))}catch(e){t(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i(function(e){e(n)})).then(o,s)}c((a=a.apply(n,r||[])).next())});var n,r,i,a},e.prototype.useAdapters=function(e,t){var n=function(e,t){for(var n,r=0,i=(n=e,Object.prototype.toString.call(n)===`[object Array]`?e:[e]);r<i.length;r++){var a=i[r],o=a.isMatch,s=a.genAdapter,c=a.runtime;if(o())return{adapter:zi({isMatch:o},s(t)),runtime:c}}}(e,t)||{},r=n.adapter,i=n.runtime;r&&(ia.adapter=r),i&&(ia.runtime=i)},e.prototype.registerHook=function(t){(function(e,t){var n=t.entity,r=t.target;if(Object.prototype.hasOwnProperty.call(e,r))throw Error(JSON.stringify({code:Qi.INVALID_OPERATION,msg:`target:${r} is not exist`}));var i=e.prototype[r];if(typeof i!=`function`)throw Error(JSON.stringify({code:Qi.INVALID_OPERATION,msg:`target:${r} is not a function which is the only type supports hook`}));e.prototype[r]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n.call.apply(n,Zi([this],e,!1)),i.call.apply(i,Zi([this],e,!1))}})(e,t)},e.prototype.registerComponent=function(t){ea(e,t)},e.prototype.registerVersion=function(e){(function(e){fa=e})(e),this.version=e},e.prototype.registerSdkName=function(e){(function(e){pa=e,function(e){yi=e}(e)})(e)},e.prototype.isInitialized=function(e){return e===void 0&&(e=this.cloudbaseConfig),typeof e.env==`string`&&[`your-env-id`,`your-envid`,`your_env_id`,`xxx-yyy`,`xxxx-yyy`,`envId`,`env-id`,`your-environment-id`,`REPLACE_ME`].some(function(t){return e.env.toLowerCase()===t.toLowerCase()})&&Ka(Wa.INVALID_PARAMS,`[CloudBase] 检测到环境 ID "${e.env}" 可能是占位符,请替换为真实的环境 ID。
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.twikoo={}))})(this,function(e){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),c=(e,t)=>{let r={};for(var i in e)n(r,i,{get:e[i],enumerable:!0});return t||n(r,Symbol.toStringTag,{value:`Module`}),r},l=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,u=c.length,d;l<u;l++)d=c[l],!o.call(e,d)&&d!==a&&n(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(s=r(t,d))||s.enumerable});return e},u=(e,r,i)=>(i=e==null?{}:t(a(e)),l(r||!e||!e.__esModule||!o.call(e,`default`)?n(i,`default`,{value:e,enumerable:!0}):i,e)),d;(function(e){e.local=`local`,e.none=`none`,e.session=`session`})(d||={});var f=function(){function e(){}return e}(),p=function(){function e(){}return e}();function m(e,t,n){n===void 0&&(n={});var r=/\?/.test(t),i=``;for(var a in n)i===``?!r&&(t+=`?`):i+=`&`,i+=a+`=`+encodeURIComponent(n[a]);return t+=i,/^http(s)?\:\/\//.test(t)?t:``+e+t}var h=c({AbstractSDKRequest:()=>f,AbstractStorage:()=>p,StorageType:()=>d,formatUrl:()=>m});function g(e){this.message=e}g.prototype=Error(),g.prototype.name=`InvalidCharacterError`;var _=typeof window<`u`&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,``);if(t.length%4==1)throw new g(`'atob' failed: The string to be decoded is not correctly encoded.`);for(var n,r,i=0,a=0,o=``;r=t.charAt(a++);~r&&(n=i%4?64*n+r:r,i++%4)&&(o+=String.fromCharCode(255&n>>(-2*i&6))))r=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`.indexOf(r);return o};function v(e){var t=e.replace(/-/g,`+`).replace(/_/g,`/`);switch(t.length%4){case 0:break;case 2:t+=`==`;break;case 3:t+=`=`;break;default:throw`Illegal base64url string!`}try{return function(e){return decodeURIComponent(_(e).replace(/(.)/g,(function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n=`0`+n),`%`+n})))}(t)}catch{return _(t)}}function y(e){this.message=e}function b(e,t){if(typeof e!=`string`)throw new y(`Invalid token specified`);var n=!0===(t||={}).header?0:1;try{return JSON.parse(v(e.split(`.`)[n]))}catch(e){throw new y(`Invalid token specified: `+e.message)}}y.prototype=Error(),y.prototype.name=`InvalidTokenError`;function x(){}function S(e){return typeof e==`object`&&!!e||typeof e==`function`}var C=x;function w(e,t){try{Object.defineProperty(e,"name",{value:t,configurable:!0})}catch{}}var T=Promise,E=Promise.resolve.bind(T),D=Promise.prototype.then,ee=Promise.reject.bind(T),te=E;function O(e){return new T(e)}function k(e){return O(t=>t(e))}function A(e){return ee(e)}function ne(e,t,n){return D.call(e,t,n)}function re(e,t,n){ne(ne(e,t,n),void 0,C)}function ie(e,t){re(e,t)}function ae(e,t){re(e,void 0,t)}function oe(e,t,n){return ne(e,t,n)}function se(e){ne(e,void 0,C)}var ce=e=>{if(typeof queueMicrotask==`function`)ce=queueMicrotask;else{let e=k(void 0);ce=t=>ne(e,t)}return ce(e)};function le(e,t,n){if(typeof e!=`function`)throw TypeError(`Argument is not a function`);return Function.prototype.apply.call(e,t,n)}function ue(e,t,n){try{return k(le(e,t,n))}catch(e){return A(e)}}var de=class{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(e){let t=this._back,n=t;t._elements.length===16383&&(n={_elements:[],_next:void 0}),t._elements.push(e),n!==t&&(this._back=n,t._next=n),++this._size}shift(){let e=this._front,t=e,n=this._cursor,r=n+1,i=e._elements,a=i[n];return r===16384&&(t=e._next,r=0),--this._size,this._cursor=r,e!==t&&(this._front=t),i[n]=void 0,a}forEach(e){let t=this._cursor,n=this._front,r=n._elements;for(;!(t===r.length&&n._next===void 0||t===r.length&&(n=n._next,r=n._elements,t=0,r.length===0));)e(r[t]),++t}peek(){let e=this._front,t=this._cursor;return e._elements[t]}},fe=Symbol(`[[AbortSteps]]`),pe=Symbol(`[[ErrorSteps]]`),me=Symbol(`[[CancelSteps]]`),he=Symbol(`[[PullSteps]]`),ge=Symbol(`[[CanPullSyncSteps]]`),_e=Symbol(`[[ReleaseSteps]]`);function ve(e,t){e._ownerReadableStream=t,t._reader=e,t._state===`readable`?xe(e):t._state===`closed`?function(e){xe(e),we(e)}(e):Se(e,t._storedError)}function j(e,t){return Tr(e._ownerReadableStream,t)}function ye(e){let t=e._ownerReadableStream;t._state===`readable`?Ce(e,TypeError(`Reader was released and can no longer be used to monitor the stream's closedness`)):function(e,t){Se(e,t)}(e,TypeError(`Reader was released and can no longer be used to monitor the stream's closedness`)),t._readableStreamController[_e](),t._reader=void 0,e._ownerReadableStream=void 0}function be(e){return TypeError(`Cannot `+e+` a stream using a released reader`)}function xe(e){e._closedPromise=O((t,n)=>{e._closedPromise_resolve=t,e._closedPromise_reject=n})}function Se(e,t){xe(e),Ce(e,t)}function Ce(e,t){e._closedPromise_reject!==void 0&&(se(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function we(e){e._closedPromise_resolve!==void 0&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}var Te=Number.isFinite||function(e){return typeof e==`number`&&isFinite(e)},M=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function Ee(e,t){if(e!==void 0&&typeof(n=e)!=`object`&&typeof n!=`function`)throw TypeError(`${t} is not an object.`);var n}function N(e,t){if(typeof e!=`function`)throw TypeError(`${t} is not a function.`)}function P(e,t){if(!function(e){return typeof e==`object`&&!!e||typeof e==`function`}(e))throw TypeError(`${t} is not an object.`)}function De(e,t,n){if(e===void 0)throw TypeError(`Parameter ${t} is required in '${n}'.`)}function Oe(e,t,n){if(e===void 0)throw TypeError(`${t} is required in '${n}'.`)}function ke(e){return Number(e)}function Ae(e){return e===0?0:e}function je(e,t){let n=2**53-1,r=Number(e);if(r=Ae(r),!Te(r))throw TypeError(`${t} is not a finite number`);if(r=function(e){return Ae(M(e))}(r),r<0||r>n)throw TypeError(`${t} is outside the accepted range of 0 to ${n}, inclusive`);return Te(r)&&r!==0?r:0}function Me(e,t){if(!Cr(e))throw TypeError(`${t} is not a ReadableStream.`)}function Ne(e){return new Re(e)}function Pe(e,t){e._reader._readRequests.push(t)}function Fe(e,t,n){let r=e._reader._readRequests.shift();n?r._closeSteps():r._chunkSteps(t)}function Ie(e){return e._reader._readRequests.length}function Le(e){let t=e._reader;return t!==void 0&&!!Ve(t)}var Re=class{constructor(e){if(De(e,1,`ReadableStreamDefaultReader`),Me(e,`First parameter`),wr(e))throw TypeError(`This stream has already been locked for exclusive reading by another reader`);ve(this,e),this._readRequests=new de}get closed(){return Ve(this)?this._closedPromise:A(Ge(`closed`))}cancel(e=void 0){return Ve(this)?this._ownerReadableStream===void 0?A(be(`cancel`)):j(this,e):A(Ge(`cancel`))}read(){if(!Ve(this))return A(Ge(`read`));if(this._ownerReadableStream===void 0)return A(be(`read from`));let e=Ue(this)?new Be:new ze;return He(this,e),e._promise}releaseLock(){if(!Ve(this))throw Ge(`releaseLock`);this._ownerReadableStream!==void 0&&function(e){ye(e),We(e,TypeError(`Reader was released`))}(this)}};Object.defineProperties(Re.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),w(Re.prototype.cancel,`cancel`),w(Re.prototype.read,`read`),w(Re.prototype.releaseLock,`releaseLock`),typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(Re.prototype,Symbol.toStringTag,{value:`ReadableStreamDefaultReader`,configurable:!0});var ze=class{constructor(){this._promise=O((e,t)=>{this._resolvePromise=e,this._rejectPromise=t})}_chunkSteps(e){this._resolvePromise({value:e,done:!1})}_closeSteps(){this._resolvePromise({value:void 0,done:!0})}_errorSteps(e){this._rejectPromise(e)}},Be=class{constructor(){this._promise=void 0}_chunkSteps(e){this._promise=te({value:e,done:!1})}_closeSteps(){this._promise=te({value:void 0,done:!0})}_errorSteps(e){this._promise=A(e)}};function Ve(e){return!!S(e)&&!!Object.prototype.hasOwnProperty.call(e,`_readRequests`)&&e instanceof Re}function He(e,t){let n=e._ownerReadableStream;n._disturbed=!0,n._state===`closed`?t._closeSteps():n._state===`errored`?t._errorSteps(n._storedError):n._readableStreamController[he](t)}function Ue(e){let t=e._ownerReadableStream;return t._state===`closed`||t._state===`errored`||t._readableStreamController[ge]()}function We(e,t){let n=e._readRequests;e._readRequests=new de,n.forEach(e=>{e._errorSteps(t)})}function Ge(e){return TypeError(`ReadableStreamDefaultReader.prototype.${e} can only be used on a ReadableStreamDefaultReader`)}function Ke(e){return e.slice()}function qe(e,t,n,r,i){new Uint8Array(e).set(new Uint8Array(n,r,i),t)}var Je=e=>(Je=typeof e.transfer==`function`?e=>e.transfer():typeof structuredClone==`function`?e=>structuredClone(e,{transfer:[e]}):e=>e,Je(e)),Ye=e=>(Ye=typeof e.detached==`boolean`?e=>e.detached:e=>e.byteLength===0,Ye(e));function F(e,t,n){if(e.slice)return e.slice(t,n);let r=n-t,i=new ArrayBuffer(r);return qe(i,0,e,t,r),i}function Xe(e,t){let n=e[t];if(n!=null){if(typeof n!=`function`)throw TypeError(`${String(t)} is not a function`);return n}}function Ze(e){try{let t=e.done,n=e.value;return ne(te(n),e=>({done:t,value:e}))}catch(e){return A(e)}}var Qe=Symbol.asyncIterator??Symbol.for?.call(Symbol,`Symbol.asyncIterator`)??`@@asyncIterator`;function $e(e,t=`sync`,n){if(n===void 0){if(t===`async`){if((n=Xe(e,Qe))===void 0)return function(e){let t={next(){let t;try{t=et(e)}catch(e){return A(e)}return Ze(t)},return(t){let n;try{let r=Xe(e.iterator,`return`);if(r===void 0)return k({done:!0,value:t});n=le(r,e.iterator,[t])}catch(e){return A(e)}return S(n)?Ze(n):A(TypeError(`The iterator.return() method must return an object`))}};return{iterator:t,nextMethod:t.next,done:!1}}($e(e,`sync`,Xe(e,Symbol.iterator)))}else n=Xe(e,Symbol.iterator)}if(n===void 0)throw TypeError(`The object is not iterable`);let r=le(n,e,[]);if(!S(r))throw TypeError(`The iterator method must return an object`);return{iterator:r,nextMethod:r.next,done:!1}}function et(e){let t=le(e.nextMethod,e.iterator,[]);if(!S(t))throw TypeError(`The iterator.next() method must return an object`);return t}var I=class{constructor(e,t){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=e,this._preventCancel=t}next(){let e=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?oe(this._ongoingPromise,e,e):e(),this._ongoingPromise}return(e){let t=()=>this._returnSteps(e);return this._ongoingPromise=this._ongoingPromise?oe(this._ongoingPromise,t,t):t(),this._ongoingPromise}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});let e=this._reader,t=new tt(this);return He(e,t),t._promise}_returnSteps(e){if(this._isFinished)return Promise.resolve({value:e,done:!0});this._isFinished=!0;let t=this._reader;if(!this._preventCancel){let n=j(t,e);return ye(t),oe(n,()=>({value:e,done:!0}))}return ye(t),k({value:e,done:!0})}},tt=class{constructor(e){this._iterator=e,this._promise=O((e,t)=>{this._resolvePromise=e,this._rejectPromise=t})}_chunkSteps(e){this._iterator._ongoingPromise=void 0,ce(()=>this._resolvePromise({value:e,done:!1}))}_closeSteps(){let e=this._iterator;e._ongoingPromise=void 0,e._isFinished=!0,ye(e._reader),this._resolvePromise({value:void 0,done:!0})}_errorSteps(e){let t=this._iterator;t._ongoingPromise=void 0,t._isFinished=!0,ye(t._reader),this._rejectPromise(e)}},L={next(){return R(this)?this._asyncIteratorImpl.next():A(nt(`next`))},return(e){return R(this)?this._asyncIteratorImpl.return(e):A(nt(`return`))},[Qe](){return this}};function R(e){if(!S(e)||!Object.prototype.hasOwnProperty.call(e,`_asyncIteratorImpl`))return!1;try{return e._asyncIteratorImpl instanceof I}catch{return!1}}function nt(e){return TypeError(`ReadableStreamAsyncIterator.${e} can only be used on a ReadableSteamAsyncIterator`)}Object.defineProperty(L,Qe,{enumerable:!1});var rt=Number.isNaN||function(e){return e!=e};function it(e){let t=F(e.buffer,e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(t)}function at(e){let t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function z(e,t,n){if(typeof(r=n)!=`number`||rt(r)||r<0||n===1/0)throw RangeError(`Size must be a finite, non-NaN, non-negative number.`);var r;e._queue.push({value:t,size:n}),e._queueTotalSize+=n}function ot(e){e._queue=new de,e._queueTotalSize=0}function st(e){return e===DataView}function ct(e){return st(e)?1:e.BYTES_PER_ELEMENT}var lt=class{constructor(){throw TypeError(`Illegal constructor`)}get view(){if(!ft(this))throw Pt(`view`);return this._view}respond(e){if(!ft(this))throw Pt(`respond`);if(De(e,1,`respond`),e=je(e,`First parameter`),this._associatedReadableByteStreamController===void 0)throw TypeError(`This BYOB request has been invalidated`);if(Ye(this._view.buffer))throw TypeError(`The BYOB request's buffer has been detached and so cannot be used as a response`);jt(this._associatedReadableByteStreamController,e)}respondWithNewView(e){if(!ft(this))throw Pt(`respondWithNewView`);if(De(e,1,`respondWithNewView`),!ArrayBuffer.isView(e))throw TypeError(`You can only respond with array buffer views`);if(this._associatedReadableByteStreamController===void 0)throw TypeError(`This BYOB request has been invalidated`);if(Ye(e.buffer))throw TypeError(`The given view's buffer has been detached and so cannot be used as a response`);Mt(this._associatedReadableByteStreamController,e)}};Object.defineProperties(lt.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),w(lt.prototype.respond,`respond`),w(lt.prototype.respondWithNewView,`respondWithNewView`),typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(lt.prototype,Symbol.toStringTag,{value:`ReadableStreamBYOBRequest`,configurable:!0});var ut=class{constructor(){throw TypeError(`Illegal constructor`)}get byobRequest(){if(!dt(this))throw Ft(`byobRequest`);return kt(this)}get desiredSize(){if(!dt(this))throw Ft(`desiredSize`);return At(this)}close(){if(!dt(this))throw Ft(`close`);if(this._closeRequested)throw TypeError(`The stream has already been closed; do not close it again!`);let e=this._controlledReadableByteStream._state;if(e!==`readable`)throw TypeError(`The stream (in ${e} state) is not in the readable state and cannot be closed`);U(this)}enqueue(e){if(!dt(this))throw Ft(`enqueue`);if(De(e,1,`enqueue`),!ArrayBuffer.isView(e))throw TypeError(`chunk must be an array buffer view`);if(e.byteLength===0)throw TypeError(`chunk must have non-zero byteLength`);if(e.buffer.byteLength===0)throw TypeError(`chunk's buffer must have non-zero byteLength`);if(this._closeRequested)throw TypeError(`stream is closed or draining`);let t=this._controlledReadableByteStream._state;if(t!==`readable`)throw TypeError(`The stream (in ${t} state) is not in the readable state and cannot be enqueued to`);Et(this,e)}error(e=void 0){if(!dt(this))throw Ft(`error`);Dt(this,e)}[me](e){mt(this),ot(this);let t=this._cancelAlgorithm(e);return H(this),t}[he](e){let t=this._controlledReadableByteStream;if(this._queueTotalSize>0)return void Ot(this,e);let n=this._autoAllocateChunkSize;if(n!==void 0){let t;try{t=new ArrayBuffer(n)}catch(t){e._errorSteps(t);return}let r={buffer:t,bufferByteLength:n,byteOffset:0,byteLength:n,bytesFilled:0,minimumFill:1,elementSize:1,viewConstructor:Uint8Array,readerType:`default`};this._pendingPullIntos.push(r)}Pe(t,e),pt(this)}[ge](){return this._queueTotalSize>0}[_e](){if(this._pendingPullIntos.length>0){let e=this._pendingPullIntos.peek();e.readerType=`none`,this._pendingPullIntos=new de,this._pendingPullIntos.push(e)}}};function dt(e){return!!S(e)&&!!Object.prototype.hasOwnProperty.call(e,`_controlledReadableByteStream`)&&e instanceof ut}function ft(e){return!!S(e)&&!!Object.prototype.hasOwnProperty.call(e,`_associatedReadableByteStreamController`)&&e instanceof lt}function pt(e){if(function(e){let t=e._controlledReadableByteStream;return t._state!==`readable`||e._closeRequested||!e._started?!1:!!(Le(t)&&Ie(t)>0||Bt(t)&&zt(t)>0||At(e)>0)}(e)){if(e._pulling)return void(e._pullAgain=!0);e._pulling=!0,re(e._pullAlgorithm(),()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,pt(e)),null),t=>(Dt(e,t),null))}}function mt(e){wt(e),e._pendingPullIntos=new de}function ht(e,t){let n=!1;e._state===`closed`&&(n=!0);let r=_t(t);t.readerType==="default"?Fe(e,r,n):function(e,t,n){let r=e._reader._readIntoRequests.shift();n?r._closeSteps(t):r._chunkSteps(t)}(e,r,n)}function gt(e,t){for(let n=0;n<t.length;++n)ht(e,t[n])}function _t(e){let t=e.bytesFilled,n=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/n)}function vt(e,t,n,r){e._queue.push({buffer:t,byteOffset:n,byteLength:r}),e._queueTotalSize+=r}function yt(e,t,n,r){let i;try{i=F(t,n,n+r)}catch(t){throw Dt(e,t),t}vt(e,i,0,r)}function bt(e,t){t.bytesFilled>0&&yt(e,t.buffer,t.byteOffset,t.bytesFilled),V(e)}function xt(e,t){let n=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),r=t.bytesFilled+n,i=n,a=!1,o=r-r%t.elementSize;o>=t.minimumFill&&(i=o-t.bytesFilled,a=!0);let s=e._queue;for(;i>0;){let n=s.peek(),r=Math.min(i,n.byteLength),a=t.byteOffset+t.bytesFilled;qe(t.buffer,a,n.buffer,n.byteOffset,r),n.byteLength===r?s.shift():(n.byteOffset+=r,n.byteLength-=r),e._queueTotalSize-=r,St(e,r,t),i-=r}return a}function St(e,t,n){n.bytesFilled+=t}function Ct(e){e._queueTotalSize===0&&e._closeRequested?(H(e),Er(e._controlledReadableByteStream)):pt(e)}function wt(e){e._byobRequest!==null&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function B(e){let t=[];for(;e._pendingPullIntos.length>0&&e._queueTotalSize!==0;){let n=e._pendingPullIntos.peek();xt(e,n)&&(V(e),t.push(n))}return t}function Tt(e,t){let n=e._pendingPullIntos.peek();wt(e),e._controlledReadableByteStream._state===`closed`?function(e,t){t.readerType===`none`&&V(e);let n=e._controlledReadableByteStream;if(Bt(n)){let t=[];for(;t.length<zt(n);)t.push(V(e));gt(n,t)}}(e,n):function(e,t,n){if(St(0,t,n),n.readerType===`none`){bt(e,n);let t=B(e);gt(e._controlledReadableByteStream,t);return}if(n.bytesFilled<n.minimumFill)return;V(e);let r=n.bytesFilled%n.elementSize;if(r>0){let t=n.byteOffset+n.bytesFilled;yt(e,n.buffer,t-r,r)}n.bytesFilled-=r;let i=B(e);ht(e._controlledReadableByteStream,n),gt(e._controlledReadableByteStream,i)}(e,t,n),pt(e)}function V(e){return e._pendingPullIntos.shift()}function H(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function U(e){let t=e._controlledReadableByteStream;if(!e._closeRequested&&t._state===`readable`){if(e._queueTotalSize>0)e._closeRequested=!0;else{if(e._pendingPullIntos.length>0){let t=e._pendingPullIntos.peek();if(t.bytesFilled%t.elementSize!==0){let t=TypeError(`Insufficient bytes to fill elements in the given buffer`);throw Dt(e,t),t}}H(e),Er(t)}}}function Et(e,t){let n=e._controlledReadableByteStream;if(e._closeRequested||n._state!==`readable`)return;let{buffer:r,byteOffset:i,byteLength:a}=t;if(Ye(r))throw TypeError(`chunk's buffer is detached and so cannot be enqueued`);let o=Je(r);if(e._pendingPullIntos.length>0){let t=e._pendingPullIntos.peek();if(Ye(t.buffer))throw TypeError(`The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk`);wt(e),t.buffer=Je(t.buffer),t.readerType===`none`&&bt(e,t)}Le(n)?(function(e){let t=e._controlledReadableByteStream._reader;for(;t._readRequests.length>0;){if(e._queueTotalSize===0)return;Ot(e,t._readRequests.shift())}}(e),Ie(n)===0?vt(e,o,i,a):(e._pendingPullIntos.length>0&&V(e),Fe(n,new Uint8Array(o,i,a),!1))):Bt(n)?(vt(e,o,i,a),gt(n,B(e))):vt(e,o,i,a),pt(e)}function Dt(e,t){let n=e._controlledReadableByteStream;n._state===`readable`&&(mt(e),ot(e),H(e),Dr(n,t))}function Ot(e,t){let n=e._queue.shift();e._queueTotalSize-=n.byteLength,Ct(e);let r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);t._chunkSteps(r)}function kt(e){if(e._byobRequest===null&&e._pendingPullIntos.length>0){let t=e._pendingPullIntos.peek(),n=new Uint8Array(t.buffer,t.byteOffset+t.bytesFilled,t.byteLength-t.bytesFilled),r=Object.create(lt.prototype);(function(e,t,n){e._associatedReadableByteStreamController=t,e._view=n})(r,e,n),e._byobRequest=r}return e._byobRequest}function At(e){let t=e._controlledReadableByteStream._state;return t===`errored`?null:t===`closed`?0:e._strategyHWM-e._queueTotalSize}function jt(e,t){let n=e._pendingPullIntos.peek();if(e._controlledReadableByteStream._state===`closed`){if(t!==0)throw TypeError(`bytesWritten must be 0 when calling respond() on a closed stream`)}else{if(t===0)throw TypeError(`bytesWritten must be greater than 0 when calling respond() on a readable stream`);if(n.bytesFilled+t>n.byteLength)throw RangeError(`bytesWritten out of range`)}n.buffer=Je(n.buffer),Tt(e,t)}function Mt(e,t){let n=e._pendingPullIntos.peek();if(e._controlledReadableByteStream._state===`closed`){if(t.byteLength!==0)throw TypeError(`The view's length must be 0 when calling respondWithNewView() on a closed stream`)}else if(t.byteLength===0)throw TypeError(`The view's length must be greater than 0 when calling respondWithNewView() on a readable stream`);if(n.byteOffset+n.bytesFilled!==t.byteOffset)throw RangeError(`The region specified by view does not match byobRequest`);if(n.bufferByteLength!==t.buffer.byteLength)throw RangeError(`The buffer of view has different capacity than byobRequest`);if(n.bytesFilled+t.byteLength>n.byteLength)throw RangeError(`The region specified by view is larger than byobRequest`);let r=t.byteLength;n.buffer=Je(t.buffer),Tt(e,r)}function Nt(e,t,n,r,i,a,o){t._controlledReadableByteStream=e,t._pullAgain=!1,t._pulling=!1,t._byobRequest=null,t._queue=t._queueTotalSize=void 0,ot(t),t._closeRequested=!1,t._started=!1,t._strategyHWM=a,t._pullAlgorithm=r,t._cancelAlgorithm=i,t._autoAllocateChunkSize=o,t._pendingPullIntos=new de,e._readableStreamController=t,re(k(n()),()=>(t._started=!0,pt(t),null),e=>(Dt(t,e),null))}function Pt(e){return TypeError(`ReadableStreamBYOBRequest.prototype.${e} can only be used on a ReadableStreamBYOBRequest`)}function Ft(e){return TypeError(`ReadableByteStreamController.prototype.${e} can only be used on a ReadableByteStreamController`)}function It(e,t){if((e=`${e}`)!=`byob`)throw TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamReaderMode`);return e}function Lt(e){return new Vt(e)}function Rt(e,t){e._reader._readIntoRequests.push(t)}function zt(e){return e._reader._readIntoRequests.length}function Bt(e){let t=e._reader;return t!==void 0&&!!Wt(t)}Object.defineProperties(ut.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),w(ut.prototype.close,`close`),w(ut.prototype.enqueue,`enqueue`),w(ut.prototype.error,`error`),typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(ut.prototype,Symbol.toStringTag,{value:`ReadableByteStreamController`,configurable:!0});var Vt=class{constructor(e){if(De(e,1,`ReadableStreamBYOBReader`),Me(e,`First parameter`),wr(e))throw TypeError(`This stream has already been locked for exclusive reading by another reader`);if(!dt(e._readableStreamController))throw TypeError(`Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source`);ve(this,e),this._readIntoRequests=new de}get closed(){return Wt(this)?this._closedPromise:A(qt(`closed`))}cancel(e=void 0){return Wt(this)?this._ownerReadableStream===void 0?A(be(`cancel`)):j(this,e):A(qt(`cancel`))}read(e,t={}){if(!Wt(this))return A(qt(`read`));if(!ArrayBuffer.isView(e))return A(TypeError(`view must be an array buffer view`));if(e.byteLength===0)return A(TypeError(`view must have non-zero byteLength`));if(e.buffer.byteLength===0)return A(TypeError(`view's buffer must have non-zero byteLength`));if(Ye(e.buffer))return A(TypeError(`view's buffer has been detached`));let n;try{n=function(e,t){return Ee(e,t),{min:je(e?.min??1,`${t} has member 'min' that`)}}(t,`options`)}catch(e){return A(e)}let r=n.min;if(r===0)return A(TypeError(`options.min must be greater than 0`));if(function(e){return st(e.constructor)}(e)){if(r>e.byteLength)return A(RangeError(`options.min must be less than or equal to view's byteLength`))}else if(r>e.length)return A(RangeError(`options.min must be less than or equal to view's length`));if(this._ownerReadableStream===void 0)return A(be(`read from`));let i=function(e,t,n){let r=e._ownerReadableStream;return r._state===`errored`||function(e,t,n){let r=e._controlledReadableByteStream,i=ct(t.constructor),{byteLength:a}=t,o=n*i;return!(e._pendingPullIntos.length>0)&&(r._state===`closed`||e._queueTotalSize>=o)}(r._readableStreamController,t,n)}(this,e,r)?new Ut:new Ht;return Gt(this,e,r,i),i._promise}releaseLock(){if(!Wt(this))throw qt(`releaseLock`);this._ownerReadableStream!==void 0&&function(e){ye(e),Kt(e,TypeError(`Reader was released`))}(this)}};Object.defineProperties(Vt.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),w(Vt.prototype.cancel,`cancel`),w(Vt.prototype.read,`read`),w(Vt.prototype.releaseLock,`releaseLock`),typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(Vt.prototype,Symbol.toStringTag,{value:`ReadableStreamBYOBReader`,configurable:!0});var Ht=class{constructor(){this._promise=O((e,t)=>{this._resolvePromise=e,this._rejectPromise=t})}_chunkSteps(e){this._resolvePromise({value:e,done:!1})}_closeSteps(e){this._resolvePromise({value:e,done:!0})}_errorSteps(e){this._rejectPromise(e)}},Ut=class{constructor(){this._promise=void 0}_chunkSteps(e){this._promise=te({value:e,done:!1})}_closeSteps(e){this._promise=te({value:e,done:!0})}_errorSteps(e){this._promise=A(e)}};function Wt(e){return!!S(e)&&!!Object.prototype.hasOwnProperty.call(e,`_readIntoRequests`)&&e instanceof Vt}function Gt(e,t,n,r){let i=e._ownerReadableStream;i._disturbed=!0,i._state===`errored`?r._errorSteps(i._storedError):function(e,t,n,r){let i=e._controlledReadableByteStream,a=t.constructor,o=ct(a),{byteOffset:s,byteLength:c}=t,l=n*o,u;try{u=Je(t.buffer)}catch(e){r._errorSteps(e);return}let d={buffer:u,bufferByteLength:u.byteLength,byteOffset:s,byteLength:c,bytesFilled:0,minimumFill:l,elementSize:o,viewConstructor:a,readerType:`byob`};if(e._pendingPullIntos.length>0)return e._pendingPullIntos.push(d),void Rt(i,r);if(i._state===`closed`){let e=new a(d.buffer,d.byteOffset,0);r._closeSteps(e);return}if(e._queueTotalSize>0){if(xt(e,d)){let t=_t(d);Ct(e),r._chunkSteps(t);return}if(e._closeRequested){let t=TypeError(`Insufficient bytes to fill elements in the given buffer`);Dt(e,t),r._errorSteps(t);return}}e._pendingPullIntos.push(d),Rt(i,r),pt(e)}(i._readableStreamController,t,n,r)}function Kt(e,t){let n=e._readIntoRequests;e._readIntoRequests=new de,n.forEach(e=>{e._errorSteps(t)})}function qt(e){return TypeError(`ReadableStreamBYOBReader.prototype.${e} can only be used on a ReadableStreamBYOBReader`)}function Jt(e,t){let{highWaterMark:n}=e;if(n===void 0)return t;if(rt(n)||n<0)throw RangeError(`Invalid highWaterMark`);return n}function Yt(e){let{size:t}=e;return t||(()=>1)}function Xt(e,t){Ee(e,t);let n=e?.highWaterMark,r=e?.size;return{highWaterMark:n===void 0?void 0:ke(n),size:r===void 0?void 0:Zt(r,`${t} has member 'size' that`)}}function Zt(e,t){return N(e,t),t=>ke(e(t))}function Qt(e,t,n){return N(e,n),n=>ue(e,t,[n])}function $t(e,t,n){return N(e,n),()=>ue(e,t,[])}function en(e,t,n){return N(e,n),n=>le(e,t,[n])}function tn(e,t,n){return N(e,n),(n,r)=>ue(e,t,[n,r])}function nn(e,t){if(!sn(e))throw TypeError(`${t} is not a WritableStream.`)}var rn=class{constructor(e={},t={}){e===void 0?e=null:P(e,`First parameter`);let n=Xt(t,`Second parameter`),r=function(e,t){Ee(e,t);let n=e?.abort,r=e?.close,i=e?.start,a=e?.type,o=e?.write;return{abort:n===void 0?void 0:Qt(n,e,`${t} has member 'abort' that`),close:r===void 0?void 0:$t(r,e,`${t} has member 'close' that`),start:i===void 0?void 0:en(i,e,`${t} has member 'start' that`),write:o===void 0?void 0:tn(o,e,`${t} has member 'write' that`),type:a}}(e,`First parameter`);if(on(this),r.type!==void 0)throw RangeError(`Invalid type is specified`);let i=Yt(n);(function(e,t,n,r){let i=Object.create(Tn.prototype),a,o,s,c;a=t.start===void 0?()=>{}:()=>t.start(i),o=t.write===void 0?()=>k(void 0):e=>t.write(e,i),s=t.close===void 0?()=>k(void 0):()=>t.close(),c=t.abort===void 0?()=>k(void 0):e=>t.abort(e),Dn(e,i,a,o,s,c,n,r)})(this,r,Jt(n,1),i)}get locked(){if(!sn(this))throw Pn(`locked`);return cn(this)}abort(e=void 0){return sn(this)?cn(this)?A(TypeError(`Cannot abort a stream that already has a writer`)):ln(this,e):A(Pn(`abort`))}close(){return sn(this)?cn(this)?A(TypeError(`Cannot close a stream that already has a writer`)):mn(this)?A(TypeError(`Cannot close an already-closing stream`)):un(this):A(Pn(`close`))}getWriter(){if(!sn(this))throw Pn(`getWriter`);return an(this)}};function an(e){return new _n(e)}function on(e){e._state=`writable`,e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=new de,e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function sn(e){return!!S(e)&&!!Object.prototype.hasOwnProperty.call(e,`_writableStreamController`)&&e instanceof rn}function cn(e){return e._writer!==void 0}function ln(e,t){var n;if(e._state===`closed`||e._state===`errored`)return k(void 0);e._writableStreamController._abortReason=t,(n=e._writableStreamController._abortController)==null||n.abort(t);let r=e._state;if(r===`closed`||r===`errored`)return k(void 0);if(e._pendingAbortRequest!==void 0)return e._pendingAbortRequest._promise;let i=!1;r===`erroring`&&(i=!0,t=void 0);let a=O((n,r)=>{e._pendingAbortRequest={_promise:void 0,_resolve:n,_reject:r,_reason:t,_wasAlreadyErroring:i}});return e._pendingAbortRequest._promise=a,i||fn(e,t),a}function un(e){let t=e._state;if(t===`closed`||t===`errored`)return A(TypeError(`The stream (in ${t} state) is not in the writable state and cannot be closed`));let n=O((t,n)=>{e._closeRequest={_resolve:t,_reject:n}}),r=e._writer;var i;return r!==void 0&&e._backpressure&&t===`writable`&&Kn(r),z(i=e._writableStreamController,wn,0),An(i),n}function dn(e,t){e._state===`writable`?fn(e,t):pn(e)}function fn(e,t){let n=e._writableStreamController;e._state=`erroring`,e._storedError=t;let r=e._writer;r!==void 0&&xn(r,t),!function(e){return e._inFlightWriteRequest!==void 0||e._inFlightCloseRequest!==void 0}(e)&&n._started&&pn(e)}function pn(e){e._state=`errored`,e._writableStreamController[pe]();let t=e._storedError;if(e._writeRequests.forEach(e=>{e._reject(t)}),e._writeRequests=new de,e._pendingAbortRequest===void 0)return void hn(e);let n=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,n._wasAlreadyErroring)return n._reject(t),void hn(e);re(e._writableStreamController[fe](n._reason),()=>(n._resolve(),hn(e),null),t=>(n._reject(t),hn(e),null))}function mn(e){return e._closeRequest!==void 0||e._inFlightCloseRequest!==void 0}function hn(e){e._closeRequest!==void 0&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);let t=e._writer;t!==void 0&&Bn(t,e._storedError)}function gn(e,t){let n=e._writer;n!==void 0&&t!==e._backpressure&&(t?function(e){Hn(e)}(n):Kn(n)),e._backpressure=t}Object.defineProperties(rn.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),w(rn.prototype.abort,`abort`),w(rn.prototype.close,`close`),w(rn.prototype.getWriter,`getWriter`),typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(rn.prototype,Symbol.toStringTag,{value:`WritableStream`,configurable:!0});var _n=class{constructor(e){if(De(e,1,`WritableStreamDefaultWriter`),nn(e,`First parameter`),cn(e))throw TypeError(`This stream has already been locked for exclusive writing by another writer`);this._ownerWritableStream=e,e._writer=this;let t=e._state;if(t===`writable`)!mn(e)&&e._backpressure?Hn(this):Wn(this),Rn(this);else if(t===`erroring`)Un(this,e._storedError),Rn(this);else if(t===`closed`)Wn(this),Rn(n=this),Vn(n);else{let t=e._storedError;Un(this,t),zn(this,t)}var n}get closed(){return vn(this)?this._closedPromise:A(In(`closed`))}get desiredSize(){if(!vn(this))throw In(`desiredSize`);if(this._ownerWritableStream===void 0)throw Ln(`desiredSize`);return function(e){let t=e._ownerWritableStream,n=t._state;return n===`errored`||n===`erroring`?null:n===`closed`?0:kn(t._writableStreamController)}(this)}get ready(){return vn(this)?this._readyPromise:A(In(`ready`))}abort(e=void 0){return vn(this)?this._ownerWritableStream===void 0?A(Ln(`abort`)):function(e,t){return ln(e._ownerWritableStream,t)}(this,e):A(In(`abort`))}close(){if(!vn(this))return A(In(`close`));let e=this._ownerWritableStream;return e===void 0?A(Ln(`close`)):mn(e)?A(TypeError(`Cannot close an already-closing stream`)):yn(this)}releaseLock(){if(!vn(this))throw In(`releaseLock`);this._ownerWritableStream!==void 0&&Sn(this)}write(e=void 0){return vn(this)?this._ownerWritableStream===void 0?A(Ln(`write to`)):Cn(this,e):A(In(`write`))}};function vn(e){return!!S(e)&&!!Object.prototype.hasOwnProperty.call(e,`_ownerWritableStream`)&&e instanceof _n}function yn(e){return un(e._ownerWritableStream)}function bn(e,t){e._closedPromiseState===`pending`?Bn(e,t):function(e,t){zn(e,t)}(e,t)}function xn(e,t){e._readyPromiseState===`pending`?Gn(e,t):function(e,t){Un(e,t)}(e,t)}function Sn(e){let t=e._ownerWritableStream,n=TypeError(`Writer was released and can no longer be used to monitor the stream's closedness`);xn(e,n),bn(e,n),t._writer=void 0,e._ownerWritableStream=void 0}function Cn(e,t){let n=e._ownerWritableStream,r=n._writableStreamController,i=function(e,t){if(e._strategySizeAlgorithm===void 0)return 1;try{return e._strategySizeAlgorithm(t)}catch(t){return jn(e,t),1}}(r,t);if(n!==e._ownerWritableStream)return A(Ln(`write to`));let a=n._state;if(a===`errored`)return A(n._storedError);if(mn(n)||a===`closed`)return A(TypeError(`The stream is closing or closed and cannot be written to`));if(a===`erroring`)return A(n._storedError);let o=function(e){return O((t,n)=>{let r={_resolve:t,_reject:n};e._writeRequests.push(r)})}(n);return function(e,t,n){try{z(e,t,n)}catch(t){jn(e,t);return}let r=e._controlledWritableStream;!mn(r)&&r._state===`writable`&&gn(r,Mn(e)),An(e)}(r,t,i),o}Object.defineProperties(_n.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),w(_n.prototype.abort,`abort`),w(_n.prototype.close,`close`),w(_n.prototype.releaseLock,`releaseLock`),w(_n.prototype.write,`write`),typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(_n.prototype,Symbol.toStringTag,{value:`WritableStreamDefaultWriter`,configurable:!0});var wn={},Tn=class{constructor(){throw TypeError(`Illegal constructor`)}get abortReason(){if(!En(this))throw Fn(`abortReason`);return this._abortReason}get signal(){if(!En(this))throw Fn(`signal`);if(this._abortController===void 0)throw TypeError(`WritableStreamDefaultController.prototype.signal is not supported`);return this._abortController.signal}error(e=void 0){if(!En(this))throw Fn(`error`);this._controlledWritableStream._state===`writable`&&Nn(this,e)}[fe](e){let t=this._abortAlgorithm(e);return On(this),t}[pe](){ot(this)}};function En(e){return!!S(e)&&!!Object.prototype.hasOwnProperty.call(e,`_controlledWritableStream`)&&e instanceof Tn}function Dn(e,t,n,r,i,a,o,s){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,ot(t),t._abortReason=void 0,t._abortController=function(){if(typeof AbortController==`function`)return new AbortController}(),t._started=!1,t._strategySizeAlgorithm=s,t._strategyHWM=o,t._writeAlgorithm=r,t._closeAlgorithm=i,t._abortAlgorithm=a,gn(e,Mn(t)),re(k(n()),()=>(t._started=!0,An(t),null),n=>(t._started=!0,dn(e,n),null))}function On(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function kn(e){return e._strategyHWM-e._queueTotalSize}function An(e){let t=e._controlledWritableStream;if(!e._started||t._inFlightWriteRequest!==void 0)return;if(t._state===`erroring`)return void pn(t);if(e._queue.length===0)return;let n=e._queue.peek().value;n===wn?function(e){let t=e._controlledWritableStream;(function(e){e._inFlightCloseRequest=e._closeRequest,e._closeRequest=void 0})(t),at(e);let n=e._closeAlgorithm();On(e),re(n,()=>(function(e){e._inFlightCloseRequest._resolve(void 0),e._inFlightCloseRequest=void 0,e._state===`erroring`&&(e._storedError=void 0,e._pendingAbortRequest!==void 0&&(e._pendingAbortRequest._resolve(),e._pendingAbortRequest=void 0)),e._state=`closed`;let t=e._writer;t!==void 0&&Vn(t)}(t),null),e=>(function(e,t){e._inFlightCloseRequest._reject(t),e._inFlightCloseRequest=void 0,e._pendingAbortRequest!==void 0&&(e._pendingAbortRequest._reject(t),e._pendingAbortRequest=void 0),dn(e,t)}(t,e),null))}(e):function(e,t){let n=e._controlledWritableStream;(function(e){e._inFlightWriteRequest=e._writeRequests.shift()})(n),re(e._writeAlgorithm(t),()=>{(function(e){e._inFlightWriteRequest._resolve(void 0),e._inFlightWriteRequest=void 0})(n);let t=n._state;if(at(e),!mn(n)&&t===`writable`){let t=Mn(e);gn(n,t)}return An(e),null},t=>(n._state===`writable`&&On(e),function(e,t){e._inFlightWriteRequest._reject(t),e._inFlightWriteRequest=void 0,dn(e,t)}(n,t),null))}(e,n)}function jn(e,t){e._controlledWritableStream._state===`writable`&&Nn(e,t)}function Mn(e){return kn(e)<=0}function Nn(e,t){let n=e._controlledWritableStream;On(e),fn(n,t)}function Pn(e){return TypeError(`WritableStream.prototype.${e} can only be used on a WritableStream`)}function Fn(e){return TypeError(`WritableStreamDefaultController.prototype.${e} can only be used on a WritableStreamDefaultController`)}function In(e){return TypeError(`WritableStreamDefaultWriter.prototype.${e} can only be used on a WritableStreamDefaultWriter`)}function Ln(e){return TypeError(`Cannot `+e+` a stream using a released writer`)}function Rn(e){e._closedPromise=O((t,n)=>{e._closedPromise_resolve=t,e._closedPromise_reject=n,e._closedPromiseState=`pending`})}function zn(e,t){Rn(e),Bn(e,t)}function Bn(e,t){e._closedPromise_reject!==void 0&&(se(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState=`rejected`)}function Vn(e){e._closedPromise_resolve!==void 0&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState=`resolved`)}function Hn(e){e._readyPromise=O((t,n)=>{e._readyPromise_resolve=t,e._readyPromise_reject=n}),e._readyPromiseState=`pending`}function Un(e,t){Hn(e),Gn(e,t)}function Wn(e){Hn(e),Kn(e)}function Gn(e,t){e._readyPromise_reject!==void 0&&(se(e._readyPromise),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState=`rejected`)}function Kn(e){e._readyPromise_resolve!==void 0&&(e._readyPromise_resolve(void 0),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState=`fulfilled`)}Object.defineProperties(Tn.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(Tn.prototype,Symbol.toStringTag,{value:`WritableStreamDefaultController`,configurable:!0});var qn=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof global<`u`?global:void 0,Jn=function(){let e=qn?.DOMException;return function(e){if(typeof e!=`function`&&typeof e!=`object`||e.name!==`DOMException`)return!1;try{return new e,!0}catch{return!1}}(e)?e:void 0}()||function(){let e=function(e,t){this.message=e||``,this.name=t||`Error`,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};return w(e,`DOMException`),e.prototype=Object.create(Error.prototype),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,configurable:!0}),e}();function Yn(e,t,n,r,i,a){let o=Ne(e),s=an(t);e._disturbed=!0;let c=new Xn(s),l=new Qn(c);return O((u,d)=>{let f;if(a!==void 0){if(f=()=>{let n=a.reason===void 0?new Jn(`Aborted`,`AbortError`):a.reason,o=[];r||o.push(()=>t._state===`writable`?ln(t,n):k(void 0)),i||o.push(()=>e._state===`readable`?Tr(e,n):k(void 0)),_(()=>Promise.all(o.map(e=>e())),!0,n)},a.aborted)return void f();a.addEventListener(`abort`,f)}function p(){for(;!c._shuttingDown&&!t._backpressure&&t._state===`writable`&&!mn(t)&&e._state===`readable`&&Ue(o);)He(o,l);if(c._shuttingDown)return k(!0);if(t._backpressure)return ne(s._readyPromise,p);let n=new Zn(c);return He(o,n),n._promise}var m,h,g;if($n(e,o._closedPromise,e=>(r?v(!0,e):_(()=>ln(t,e),!0,e),null)),$n(t,s._closedPromise,t=>(i?v(!0,t):_(()=>Tr(e,t),!0,t),null)),m=e,h=o._closedPromise,g=()=>(n?v():_(()=>function(e){let t=e._ownerWritableStream,n=t._state;return mn(t)||n===`closed`?k(void 0):n===`errored`?A(t._storedError):yn(e)}(s)),null),m._state===`closed`?g():ie(h,g),mn(t)||t._state===`closed`){let t=TypeError(`the destination writable stream closed before all data could be piped to it`);i?v(!0,t):_(()=>Tr(e,t),!0,t)}function _(e,n,r){function i(){return re(e(),()=>y(n,r),e=>y(!0,e)),null}c._shuttingDown||(c._shuttingDown=!0,t._state!==`writable`||mn(t)?i():ie(c._waitForWritesToFinish(),i))}function v(e,n){c._shuttingDown||(c._shuttingDown=!0,t._state!==`writable`||mn(t)?y(e,n):ie(c._waitForWritesToFinish(),()=>y(e,n)))}function y(e,t){return Sn(s),ye(o),a!==void 0&&a.removeEventListener(`abort`,f),e?d(t):u(void 0),null}se(O((e,t)=>{(function n(r){r?e():ne(p(),n,t)})(!1)}))})}var Xn=class{constructor(e){this._writer=e,this._shuttingDown=!1,this._currentWrite=k(void 0)}_waitForWritesToFinish(){let e=this._currentWrite;return ne(this._currentWrite,()=>e===this._currentWrite?void 0:this._waitForWritesToFinish())}},Zn=class{constructor(e){this._state=e,this._promise=O((e,t)=>{this._resolvePromise=e,this._rejectPromise=t})}_chunkSteps(e){this._state._currentWrite=ne(Cn(this._state._writer,e),void 0,x),this._resolvePromise(!1)}_closeSteps(){this._resolvePromise(!0)}_errorSteps(e){this._rejectPromise(e)}},Qn=class{constructor(e){this._state=e}_chunkSteps(e){this._state._currentWrite=ne(Cn(this._state._writer,e),void 0,x)}_closeSteps(){}_errorSteps(e){}};function $n(e,t,n){e._state===`errored`?n(e._storedError):ae(t,n)}var er=class{constructor(){throw TypeError(`Illegal constructor`)}get desiredSize(){if(!tr(this))throw dr(`desiredSize`);return cr(this)}close(){if(!tr(this))throw dr(`close`);if(!lr(this))throw TypeError(`The stream is not in a state that permits close`);ar(this)}enqueue(e=void 0){if(!tr(this))throw dr(`enqueue`);if(!lr(this))throw TypeError(`The stream is not in a state that permits enqueue`);return or(this,e)}error(e=void 0){if(!tr(this))throw dr(`error`);sr(this,e)}[me](e){ot(this);let t=this._cancelAlgorithm(e);return ir(this),t}[he](e){let t=this._controlledReadableStream;if(this._queue.length>0){let n=at(this);this._closeRequested&&this._queue.length===0?(ir(this),Er(t)):nr(this),e._chunkSteps(n)}else Pe(t,e),nr(this)}[ge](){return this._queue.length>0}[_e](){}};function tr(e){return!!S(e)&&!!Object.prototype.hasOwnProperty.call(e,`_controlledReadableStream`)&&e instanceof er}function nr(e){if(rr(e)){if(e._pulling)return void(e._pullAgain=!0);e._pulling=!0,re(e._pullAlgorithm(),()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,nr(e)),null),t=>(sr(e,t),null))}}function rr(e){let t=e._controlledReadableStream;return!lr(e)||!e._started?!1:wr(t)&&Ie(t)>0?!0:cr(e)>0}function ir(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function ar(e){if(!lr(e))return;let t=e._controlledReadableStream;e._closeRequested=!0,e._queue.length===0&&(ir(e),Er(t))}function or(e,t){if(!lr(e))return;let n=e._controlledReadableStream;if(wr(n)&&Ie(n)>0)Fe(n,t,!1);else{let n;try{n=e._strategySizeAlgorithm(t)}catch(t){throw sr(e,t),t}try{z(e,t,n)}catch(t){throw sr(e,t),t}}nr(e)}function sr(e,t){let n=e._controlledReadableStream;n._state===`readable`&&(ot(e),ir(e),Dr(n,t))}function cr(e){let t=e._controlledReadableStream._state;return t===`errored`?null:t===`closed`?0:e._strategyHWM-e._queueTotalSize}function lr(e){let t=e._controlledReadableStream._state;return!e._closeRequested&&t===`readable`}function ur(e,t,n,r,i,a,o){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,ot(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=o,t._strategyHWM=a,t._pullAlgorithm=r,t._cancelAlgorithm=i,e._readableStreamController=t,re(k(n()),()=>(t._started=!0,nr(t),null),e=>(sr(t,e),null))}function dr(e){return TypeError(`ReadableStreamDefaultController.prototype.${e} can only be used on a ReadableStreamDefaultController`)}function fr(e,t){return dt(e._readableStreamController)?function(e){let t,n,r,i,a,o=Ne(e),s=!1,c=!1,l=!1,u=!1,d=!1,f=O(e=>{a=e});function p(e){ae(e._closedPromise,t=>(e!==o||(Dt(r._readableStreamController,t),Dt(i._readableStreamController,t),u&&d||a(void 0)),null))}function m(){Wt(o)&&(ye(o),o=Ne(e),p(o)),He(o,{_chunkSteps:t=>{ce(()=>{c=!1,l=!1;let n=t,o=t;if(!u&&!d)try{o=it(t)}catch(t){Dt(r._readableStreamController,t),Dt(i._readableStreamController,t),a(Tr(e,t));return}u||Et(r._readableStreamController,n),d||Et(i._readableStreamController,o),s=!1,c?g():l&&_()})},_closeSteps:()=>{s=!1,u||U(r._readableStreamController),d||U(i._readableStreamController),r._readableStreamController._pendingPullIntos.length>0&&jt(r._readableStreamController,0),i._readableStreamController._pendingPullIntos.length>0&&jt(i._readableStreamController,0),u&&d||a(void 0)},_errorSteps:()=>{s=!1}})}function h(t,n){Ve(o)&&(ye(o),o=Lt(e),p(o));let f=n?i:r,m=n?r:i;Gt(o,t,1,{_chunkSteps:t=>{ce(()=>{c=!1,l=!1;let r=n?d:u;if(n?u:d)r||Mt(f._readableStreamController,t);else{let n;try{n=it(t)}catch(t){Dt(f._readableStreamController,t),Dt(m._readableStreamController,t),a(Tr(e,t));return}r||Mt(f._readableStreamController,t),Et(m._readableStreamController,n)}s=!1,c?g():l&&_()})},_closeSteps:e=>{s=!1;let t=n?d:u,r=n?u:d;t||U(f._readableStreamController),r||U(m._readableStreamController),e!==void 0&&(t||Mt(f._readableStreamController,e),!r&&m._readableStreamController._pendingPullIntos.length>0&&jt(m._readableStreamController,0)),t&&r||a(void 0)},_errorSteps:()=>{s=!1}})}function g(){if(s)return c=!0,k(void 0);s=!0;let e=kt(r._readableStreamController);return e===null?m():h(e._view,!1),k(void 0)}function _(){if(s)return l=!0,k(void 0);s=!0;let e=kt(i._readableStreamController);return e===null?m():h(e._view,!0),k(void 0)}function v(r){if(u=!0,t=r,d){let r=Tr(e,Ke([t,n]));a(r)}return f}function y(r){if(d=!0,n=r,u){let r=Tr(e,Ke([t,n]));a(r)}return f}function b(){}return r=xr(b,g,v),i=xr(b,_,y),p(o),[r,i]}(e):function(e){let t=Ne(e),n,r,i,a,o,s=!1,c=!1,l=!1,u=!1,d=O(e=>{o=e});function f(){return s?(c=!0,k(void 0)):(s=!0,He(t,{_chunkSteps:e=>{ce(()=>{c=!1;let t=e,n=e;l||or(i._readableStreamController,t),u||or(a._readableStreamController,n),s=!1,c&&f()})},_closeSteps:()=>{s=!1,l||ar(i._readableStreamController),u||ar(a._readableStreamController),l&&u||o(void 0)},_errorSteps:()=>{s=!1}}),k(void 0))}function p(t){if(l=!0,n=t,u){let t=Tr(e,Ke([n,r]));o(t)}return d}function m(t){if(u=!0,r=t,l){let t=Tr(e,Ke([n,r]));o(t)}return d}function h(){}return i=br(h,f,p),a=br(h,f,m),ae(t._closedPromise,e=>(sr(i._readableStreamController,e),sr(a._readableStreamController,e),l&&u||o(void 0),null)),[i,a]}(e)}function pr(e){return S(t=e)&&t.getReader!==void 0?function(e){let t;function n(){let n;try{n=e.read()}catch(e){return A(e)}return oe(n,e=>{if(!S(e))throw TypeError(`The promise returned by the reader.read() method must fulfill with an object`);if(e.done)ar(t._readableStreamController);else{let n=e.value;or(t._readableStreamController,n)}})}function r(t){try{return k(e.cancel(t))}catch(e){return A(e)}}return t=br(x,n,r,0),t}(e.getReader()):function(e){let t,n=$e(e,`async`);function r(){let e;try{e=et(n)}catch(e){return A(e)}return oe(k(e),e=>{if(!S(e))throw TypeError(`The promise returned by the iterator.next() method must fulfill with an object`);if(e.done)ar(t._readableStreamController);else{let n=e.value;or(t._readableStreamController,n)}})}function i(e){let t=n.iterator,r;try{r=Xe(t,`return`)}catch(e){return A(e)}return r===void 0?k(void 0):oe(ue(r,t,[e]),e=>{if(!S(e))throw TypeError(`The promise returned by the iterator.return() method must fulfill with an object`)})}return t=br(x,r,i,0),t}(e);var t}function mr(e,t,n){return N(e,n),n=>ue(e,t,[n])}function hr(e,t,n){return N(e,n),n=>ue(e,t,[n])}function gr(e,t,n){return N(e,n),n=>le(e,t,[n])}function _r(e,t){if((e=`${e}`)!=`bytes`)throw TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamType`);return e}function vr(e,t){Ee(e,t);let n=e?.preventAbort,r=e?.preventCancel,i=e?.preventClose,a=e?.signal;return a!==void 0&&function(e,t){if(!function(e){if(typeof e!=`object`||!e)return!1;try{return typeof e.aborted==`boolean`}catch{return!1}}(e))throw TypeError(`${t} is not an AbortSignal.`)}(a,`${t} has member 'signal' that`),{preventAbort:!!n,preventCancel:!!r,preventClose:!!i,signal:a}}Object.defineProperties(er.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),w(er.prototype.close,`close`),w(er.prototype.enqueue,`enqueue`),w(er.prototype.error,`error`),typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(er.prototype,Symbol.toStringTag,{value:`ReadableStreamDefaultController`,configurable:!0});var yr=class{constructor(e={},t={}){e===void 0?e=null:P(e,`First parameter`);let n=Xt(t,`Second parameter`),r=function(e,t){Ee(e,t);let n=e,r=n?.autoAllocateChunkSize,i=n?.cancel,a=n?.pull,o=n?.start,s=n?.type;return{autoAllocateChunkSize:r===void 0?void 0:je(r,`${t} has member 'autoAllocateChunkSize' that`),cancel:i===void 0?void 0:mr(i,n,`${t} has member 'cancel' that`),pull:a===void 0?void 0:hr(a,n,`${t} has member 'pull' that`),start:o===void 0?void 0:gr(o,n,`${t} has member 'start' that`),type:s===void 0?void 0:_r(s,`${t} has member 'type' that`)}}(e,`First parameter`);if(Sr(this),r.type===`bytes`){if(n.size!==void 0)throw RangeError(`The strategy for a byte stream cannot have a size function`);(function(e,t,n){let r=Object.create(ut.prototype),i,a,o;i=t.start===void 0?()=>{}:()=>t.start(r),a=t.pull===void 0?()=>k(void 0):()=>t.pull(r),o=t.cancel===void 0?()=>k(void 0):e=>t.cancel(e);let s=t.autoAllocateChunkSize;if(s===0)throw TypeError(`autoAllocateChunkSize must be greater than 0`);Nt(e,r,i,a,o,n,s)})(this,r,Jt(n,0))}else{let e=Yt(n);(function(e,t,n,r){let i=Object.create(er.prototype),a,o,s;a=t.start===void 0?()=>{}:()=>t.start(i),o=t.pull===void 0?()=>k(void 0):()=>t.pull(i),s=t.cancel===void 0?()=>k(void 0):e=>t.cancel(e),ur(e,i,a,o,s,n,r)})(this,r,Jt(n,1),e)}}get locked(){if(!Cr(this))throw Or(`locked`);return wr(this)}cancel(e=void 0){return Cr(this)?wr(this)?A(TypeError(`Cannot cancel a stream that already has a reader`)):Tr(this,e):A(Or(`cancel`))}getReader(e=void 0){if(!Cr(this))throw Or(`getReader`);return function(e,t){Ee(e,t);let n=e?.mode;return{mode:n===void 0?void 0:It(n,`${t} has member 'mode' that`)}}(e,`First parameter`).mode===void 0?Ne(this):Lt(this)}pipeThrough(e,t={}){if(!Cr(this))throw Or(`pipeThrough`);De(e,1,`pipeThrough`);let n=function(e,t){Ee(e,t);let n=e?.readable;Oe(n,`readable`,`ReadableWritablePair`),Me(n,`${t} has member 'readable' that`);let r=e?.writable;return Oe(r,`writable`,`ReadableWritablePair`),nn(r,`${t} has member 'writable' that`),{readable:n,writable:r}}(e,`First parameter`),r=vr(t,`Second parameter`);if(wr(this))throw TypeError(`ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream`);if(cn(n.writable))throw TypeError(`ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream`);return se(Yn(this,n.writable,r.preventClose,r.preventAbort,r.preventCancel,r.signal)),n.readable}pipeTo(e,t={}){if(!Cr(this))return A(Or(`pipeTo`));if(e===void 0)return A(`Parameter 1 is required in 'pipeTo'.`);if(!sn(e))return A(TypeError(`ReadableStream.prototype.pipeTo's first argument must be a WritableStream`));let n;try{n=vr(t,`Second parameter`)}catch(e){return A(e)}return wr(this)?A(TypeError(`ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream`)):cn(e)?A(TypeError(`ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream`)):Yn(this,e,n.preventClose,n.preventAbort,n.preventCancel,n.signal)}tee(){if(!Cr(this))throw Or(`tee`);return Ke(fr(this))}values(e=void 0){if(!Cr(this))throw Or(`values`);return function(e,t){let n=new I(Ne(e),t),r=Object.create(L);return r._asyncIteratorImpl=n,r}(this,function(e,t){return Ee(e,t),{preventCancel:!!e?.preventCancel}}(e,`First parameter`).preventCancel)}[Qe](e){return this.values(e)}static from(e){return pr(e)}};function br(e,t,n,r=1,i=()=>1){let a=Object.create(yr.prototype);return Sr(a),ur(a,Object.create(er.prototype),e,t,n,r,i),a}function xr(e,t,n){let r=Object.create(yr.prototype);return Sr(r),Nt(r,Object.create(ut.prototype),e,t,n,0,void 0),r}function Sr(e){e._state=`readable`,e._reader=void 0,e._storedError=void 0,e._disturbed=!1}function Cr(e){return!!S(e)&&!!Object.prototype.hasOwnProperty.call(e,`_readableStreamController`)&&e instanceof yr}function wr(e){return e._reader!==void 0}function Tr(e,t){if(e._disturbed=!0,e._state===`closed`)return k(void 0);if(e._state===`errored`)return A(e._storedError);Er(e);let n=e._reader;if(n!==void 0&&Wt(n)){let e=n._readIntoRequests;n._readIntoRequests=new de,e.forEach(e=>{e._closeSteps(void 0)})}return oe(e._readableStreamController[me](t),x)}function Er(e){e._state=`closed`;let t=e._reader;if(t!==void 0&&(we(t),Ve(t))){let e=t._readRequests;t._readRequests=new de,e.forEach(e=>{e._closeSteps()})}}function Dr(e,t){e._state=`errored`,e._storedError=t;let n=e._reader;n!==void 0&&(Ce(n,t),Ve(n)?We(n,t):Kt(n,t))}function Or(e){return TypeError(`ReadableStream.prototype.${e} can only be used on a ReadableStream`)}function kr(e,t){Ee(e,t);let n=e?.highWaterMark;return Oe(n,`highWaterMark`,`QueuingStrategyInit`),{highWaterMark:ke(n)}}Object.defineProperties(yr,{from:{enumerable:!0}}),Object.defineProperties(yr.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),w(yr.from,`from`),w(yr.prototype.cancel,`cancel`),w(yr.prototype.getReader,`getReader`),w(yr.prototype.pipeThrough,`pipeThrough`),w(yr.prototype.pipeTo,`pipeTo`),w(yr.prototype.tee,`tee`),w(yr.prototype.values,`values`),typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(yr.prototype,Symbol.toStringTag,{value:`ReadableStream`,configurable:!0}),Object.defineProperty(yr.prototype,Qe,{value:yr.prototype.values,writable:!0,configurable:!0});var Ar=e=>e.byteLength;w(Ar,`size`);var jr=class{constructor(e){De(e,1,`ByteLengthQueuingStrategy`),e=kr(e,`First parameter`),this._byteLengthQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!Nr(this))throw Mr(`highWaterMark`);return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!Nr(this))throw Mr(`size`);return Ar}};function Mr(e){return TypeError(`ByteLengthQueuingStrategy.prototype.${e} can only be used on a ByteLengthQueuingStrategy`)}function Nr(e){return!!S(e)&&!!Object.prototype.hasOwnProperty.call(e,`_byteLengthQueuingStrategyHighWaterMark`)&&e instanceof jr}Object.defineProperties(jr.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(jr.prototype,Symbol.toStringTag,{value:`ByteLengthQueuingStrategy`,configurable:!0});var Pr=()=>1;w(Pr,`size`);var Fr=class{constructor(e){De(e,1,`CountQueuingStrategy`),e=kr(e,`First parameter`),this._countQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!Lr(this))throw Ir(`highWaterMark`);return this._countQueuingStrategyHighWaterMark}get size(){if(!Lr(this))throw Ir(`size`);return Pr}};function Ir(e){return TypeError(`CountQueuingStrategy.prototype.${e} can only be used on a CountQueuingStrategy`)}function Lr(e){return!!S(e)&&!!Object.prototype.hasOwnProperty.call(e,`_countQueuingStrategyHighWaterMark`)&&e instanceof Fr}function Rr(e,t,n){return N(e,n),n=>ue(e,t,[n])}function zr(e,t,n){return N(e,n),n=>le(e,t,[n])}function Br(e,t,n){return N(e,n),(n,r)=>ue(e,t,[n,r])}function Vr(e,t,n){return N(e,n),n=>ue(e,t,[n])}Object.defineProperties(Fr.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(Fr.prototype,Symbol.toStringTag,{value:`CountQueuingStrategy`,configurable:!0});var Hr=class{constructor(e={},t={},n={}){e===void 0&&(e=null);let r=Xt(t,`Second parameter`),i=Xt(n,`Third parameter`),a=function(e,t){Ee(e,t);let n=e?.cancel,r=e?.flush,i=e?.readableType,a=e?.start,o=e?.transform,s=e?.writableType;return{cancel:n===void 0?void 0:Vr(n,e,`${t} has member 'cancel' that`),flush:r===void 0?void 0:Rr(r,e,`${t} has member 'flush' that`),readableType:i,start:a===void 0?void 0:zr(a,e,`${t} has member 'start' that`),transform:o===void 0?void 0:Br(o,e,`${t} has member 'transform' that`),writableType:s}}(e,`First parameter`);if(a.readableType!==void 0)throw RangeError(`Invalid readableType specified`);if(a.writableType!==void 0)throw RangeError(`Invalid writableType specified`);let o=Jt(i,0),s=Yt(i),c=Jt(r,1),l=Yt(r),u;(function(e,t,n,r,i,a){function o(){return t}function s(t){return function(e,t){let n=e._transformStreamController;return e._backpressure?oe(e._backpressureChangePromise,()=>{let r=e._writable;if(r._state===`erroring`)throw r._storedError;return Qr(n,t)}):Qr(n,t)}(e,t)}function c(t){return function(e,t){let n=e._transformStreamController;if(n._finishPromise!==void 0)return n._finishPromise;let r=e._readable;n._finishPromise=O((e,t)=>{n._finishPromise_resolve=e,n._finishPromise_reject=t});let i=n._cancelAlgorithm(t);return Xr(n),re(i,()=>(r._state===`errored`?ti(n,r._storedError):(sr(r._readableStreamController,t),ei(n)),null),e=>(sr(r._readableStreamController,e),ti(n,e),null)),n._finishPromise}(e,t)}function l(){return function(e){let t=e._transformStreamController;if(t._finishPromise!==void 0)return t._finishPromise;let n=e._readable;t._finishPromise=O((e,n)=>{t._finishPromise_resolve=e,t._finishPromise_reject=n});let r=t._flushAlgorithm();return Xr(t),re(r,()=>(n._state===`errored`?ti(t,n._storedError):(ar(n._readableStreamController),ei(t)),null),e=>(sr(n._readableStreamController,e),ti(t,e),null)),t._finishPromise}(e)}function u(){return function(e){return qr(e,!1),e._backpressureChangePromise}(e)}function d(t){return function(e,t){let n=e._transformStreamController;if(n._finishPromise!==void 0)return n._finishPromise;let r=e._writable;n._finishPromise=O((e,t)=>{n._finishPromise_resolve=e,n._finishPromise_reject=t});let i=n._cancelAlgorithm(t);return Xr(n),re(i,()=>(r._state===`errored`?ti(n,r._storedError):(jn(r._writableStreamController,t),Kr(e),ei(n)),null),t=>(jn(r._writableStreamController,t),Kr(e),ti(n,t),null)),n._finishPromise}(e,t)}e._writable=function(e,t,n,r,i=1,a=()=>1){let o=Object.create(rn.prototype);return on(o),Dn(o,Object.create(Tn.prototype),e,t,n,r,i,a),o}(o,s,l,c,n,r),e._readable=br(o,u,d,i,a),e._backpressure=void 0,e._backpressureChangePromise=void 0,e._backpressureChangePromise_resolve=void 0,qr(e,!0),e._transformStreamController=void 0})(this,O(e=>{u=e}),c,l,o,s),function(e,t){let n=Object.create(Jr.prototype),r,i,a;r=t.transform===void 0?e=>{try{return Zr(n,e),k(void 0)}catch(e){return A(e)}}:e=>t.transform(e,n),i=t.flush===void 0?()=>k(void 0):()=>t.flush(n),a=t.cancel===void 0?()=>k(void 0):e=>t.cancel(e),(function(e,t,n,r,i){t._controlledTransformStream=e,e._transformStreamController=t,t._transformAlgorithm=n,t._flushAlgorithm=r,t._cancelAlgorithm=i,t._finishPromise=void 0,t._finishPromise_resolve=void 0,t._finishPromise_reject=void 0})(e,n,r,i,a)}(this,a),a.start===void 0?u(void 0):u(a.start(this._transformStreamController))}get readable(){if(!Ur(this))throw ni(`readable`);return this._readable}get writable(){if(!Ur(this))throw ni(`writable`);return this._writable}};function Ur(e){return!!S(e)&&!!Object.prototype.hasOwnProperty.call(e,`_transformStreamController`)&&e instanceof Hr}function Wr(e,t){sr(e._readable._readableStreamController,t),Gr(e,t)}function Gr(e,t){Xr(e._transformStreamController),jn(e._writable._writableStreamController,t),Kr(e)}function Kr(e){e._backpressure&&qr(e,!1)}function qr(e,t){e._backpressureChangePromise!==void 0&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=O(t=>{e._backpressureChangePromise_resolve=t}),e._backpressure=t}Object.defineProperties(Hr.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(Hr.prototype,Symbol.toStringTag,{value:`TransformStream`,configurable:!0});var Jr=class{constructor(){throw TypeError(`Illegal constructor`)}get desiredSize(){if(!Yr(this))throw $r(`desiredSize`);return cr(this._controlledTransformStream._readable._readableStreamController)}enqueue(e=void 0){if(!Yr(this))throw $r(`enqueue`);Zr(this,e)}error(e=void 0){if(!Yr(this))throw $r(`error`);var t=e;Wr(this._controlledTransformStream,t)}terminate(){if(!Yr(this))throw $r(`terminate`);(function(e){let t=e._controlledTransformStream;ar(t._readable._readableStreamController),Gr(t,TypeError(`TransformStream terminated`))})(this)}};function Yr(e){return!!S(e)&&!!Object.prototype.hasOwnProperty.call(e,`_controlledTransformStream`)&&e instanceof Jr}function Xr(e){e._transformAlgorithm=void 0,e._flushAlgorithm=void 0,e._cancelAlgorithm=void 0}function Zr(e,t){let n=e._controlledTransformStream,r=n._readable._readableStreamController;if(!lr(r))throw TypeError(`Readable side is not in a state that permits enqueue`);try{or(r,t)}catch(e){throw Gr(n,e),n._readable._storedError}(function(e){return!rr(e)})(r)!==n._backpressure&&qr(n,!0)}function Qr(e,t){return oe(e._transformAlgorithm(t),void 0,t=>{throw Wr(e._controlledTransformStream,t),t})}function $r(e){return TypeError(`TransformStreamDefaultController.prototype.${e} can only be used on a TransformStreamDefaultController`)}function ei(e){e._finishPromise_resolve!==void 0&&(e._finishPromise_resolve(),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function ti(e,t){e._finishPromise_reject!==void 0&&(se(e._finishPromise),e._finishPromise_reject(t),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function ni(e){return TypeError(`TransformStream.prototype.${e} can only be used on a TransformStream`)}Object.defineProperties(Jr.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),w(Jr.prototype.enqueue,`enqueue`),w(Jr.prototype.error,`error`),w(Jr.prototype.terminate,`terminate`),typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(Jr.prototype,Symbol.toStringTag,{value:`TransformStreamDefaultController`,configurable:!0});var ri=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),ii=function(){return ii=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ii.apply(this,arguments)},ai=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},oi=function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o={next:s(0),throw:s(1),return:s(2)};return typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(o){if(r)throw TypeError(`Generator is already executing.`);for(;n;)try{if(r=1,i&&(a=o[0]&2?i.return:o[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,o[1])).done)return a;switch(i=0,a&&(o=[o[0]&2,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,i=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){n.label=o[1];break}if(o[0]===6&&n.label<a[1]){n.label=a[1],a=o;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(o);break}a[2]&&n.ops.pop(),n.trys.pop();continue}o=t.call(e,n)}catch(e){o=[6,e],i=0}finally{r=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}},si=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};function ci(){if(typeof wx>`u`||typeof Page>`u`||!wx.getSystemInfoSync||!wx.getStorageSync||!wx.setStorageSync||!wx.connectSocket||!wx.request)return!1;try{if(!wx.getSystemInfoSync()||wx.getSystemInfoSync().AppPlatform===`qq`)return!1}catch{return!1}return!0}function li(){return typeof App>`u`&&typeof getApp>`u`&&!wx.onAppHide&&!wx.offAppHide&&!wx.onAppShow&&!wx.offAppShow}var ui=`Error when aborting requestTask`,di=function(e){ri(t,e);function t(t){t===void 0&&(t={});var n=e.call(this)||this,r=t.timeout,i=t.timeoutMsg,a=t.restrictedMethods;return n._timeout=r||0,n._timeoutMsg=i||`请求超时`,n._restrictedMethods=a||[`get`,`post`,`upload`,`download`],n}return t.prototype.post=function(e){var t=this;return new Promise(function(n,r){var i=e.url,a=e.data,o=e.headers,s=wx.request({url:m(`https:`,i),data:a,timeout:t._timeout,method:`POST`,header:o,success:function(e){e.statusCode>=200&&e.statusCode<300?n({statusCode:e.statusCode,status:e.statusCode,data:e.data}):r(e)},fail:function(e){r(e)},complete:function(e){if(e&&e.errMsg&&t._timeout&&t._restrictedMethods.indexOf(`post`)!==-1&&e.errMsg===`request:fail timeout`){console.warn(t._timeoutMsg);try{s.abort()}catch{}}}})})},t.prototype.get=function(e){var t=this;return new Promise(function(n,r){var i=e.url,a=e.body,o=e.headers,s=m(`https:`,i),c=wx.request({url:s,data:a,timeout:t._timeout,method:`GET`,header:o,success:function(e){e.statusCode>=200&&e.statusCode<300?n({statusCode:e.statusCode,status:e.statusCode,data:e.data}):r(e)},fail:function(e){r(e)},complete:function(e){if(e&&e.errMsg&&t._timeout&&t._restrictedMethods.indexOf(`get`)!==-1&&e.errMsg.includes(`timeout`)){console.warn(t._timeoutMsg);try{c.abort()}catch(e){console.warn(ui,e)}}}})})},t.prototype.upload=function(e){var t=this,n=this;return new Promise(function(r){return ai(t,void 0,void 0,function(){var t,i,a,o,s,c;return oi(this,function(l){return t=e.url,i=e.file,a=e.data,o=e.headers,s=e.onUploadProgress,c=wx.uploadFile({url:t,filePath:i,name:`file`,formData:ii({},a),header:o,timeout:this._timeout,success:function(e){var t={statusCode:e.statusCode,data:e.data||{}};e.statusCode===200&&a.success_action_status&&(t.statusCode=parseInt(a.success_action_status,10)),r(t)},fail:function(e){r(e)},complete:function(e){if(e&&e.errMsg&&n._timeout&&n._restrictedMethods.indexOf(`upload`)!==-1&&e.errMsg===`request:fail timeout`){console.warn(n._timeoutMsg);try{c.abort()}catch{}}}}),s&&c.onProgressUpdate(function(e){s(e)}),[2]})})})},t.prototype.download=function(e){var t=this,n=this;return new Promise(function(r,i){var a=e.url,o=e.headers,s=wx.downloadFile({url:m(`https:`,a),header:o,timeout:t._timeout,success:function(e){e.statusCode===200&&e.tempFilePath?r({statusCode:200,tempFilePath:e.tempFilePath}):r(e)},fail:function(e){i(e)},complete:function(e){if(e&&e.errMsg&&n._timeout&&n._restrictedMethods.indexOf(`download`)!==-1&&e.errMsg===`request:fail timeout`){console.warn(n._timeoutMsg);try{s.abort()}catch{}}}})})},t.prototype.fetch=function(e){var t=e.url,n=e.body,r=e.enableAbort,i=e.headers,a=e.method,o=e.stream,s=o!==void 0&&o,c=e.signal,l=e.timeout,u=this,d=l??this._timeout,f=null,p=new yr({start:function(e){f=e},cancel:function(){f=null}});return new Promise(function(e,o){s&&e({data:p});var l=wx.request({url:m(`https:`,t),data:n,timeout:d,method:a.toUpperCase(),header:i,success:function(t){f?.close(),!s&&e(t)},fail:function(e){if(f?.close(),o(e),s)throw e},complete:function(e){if(e&&e.errMsg&&d&&u._restrictedMethods.indexOf(`post`)!==-1&&r&&e.errMsg===`request:fail timeout`){console.warn(u._timeoutMsg);try{l.abort()}catch(e){console.warn(ui,e)}}},enableChunked:s});if(l.onChunkReceived(function(e){f?.enqueue(new Uint8Array(e.data))}),c){var h=function(){try{l.abort()}catch(e){console.warn(ui,e)}};c.aborted?h():c.addEventListener(`abort`,function(){return h()})}})},t.prototype.patch=function(e){var t=e.method,n=e.headers,r=JSON.parse(JSON.stringify(n||{}));return t.toUpperCase()===`PATCH`&&(r[`X-HTTP-Method-Override`]=`PATCH`,t=`POST`),this.post(ii(ii({},e),{method:t,headers:r}))},t}(f),fi={setItem:function(e,t){wx.setStorageSync(e,t)},getItem:function(e){return wx.getStorageSync(e)},removeItem:function(e){wx.removeStorageSync(e)},clear:function(){wx.clearStorageSync()}},pi=function(){function e(e,t){t===void 0&&(t={});var n=wx.connectSocket(ii({url:e},t));return{set onopen(e){n.onOpen(e)},set onmessage(e){n.onMessage(e)},set onclose(e){n.onClose(e)},set onerror(e){n.onError(e)},send:function(e){return n.send({data:e})},close:function(e,t){return n.close({code:e,reason:t})},get readyState(){return n.readyState},CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3}}return e}();function mi(e){var t={},n=e.replace(/^[?#]/,``);return n&&n.split(`&`).forEach(function(e){var n=e.split(`=`),r=n[0],i=n[1];r=decodeURIComponent(r),i=decodeURIComponent(i),r&&(t[r]?Array.isArray(t[r])?t[r].push(i):t[r]=[t[r],i]:t[r]=i)}),t}function hi(e){return{root:{globalThis:{}},reqClass:di,wsClass:pi,captchaOptions:{openURIWithCallback:function(t){var n=e.EventBus,r={},i=t;console.log(`openURIWithCallback`,t);var a=t.match(/^(data:.*?)(\?[^#\s]*)?$/);if(a){i=a[1],console.log(`openURIWithCallback url`,i);var o=a[2];o&&(r=mi(o))}console.log(`openURIWithCallback queryObj`,r);var s=r.token,c=si(r,[`token`]);return/^data:/.test(i)&&!s?Promise.reject({error:`invalid_argument`,error_description:`invalie captcha data: `+t}):s?new Promise(function(e){console.log(`wait for captcha...`),n.$emit(`CAPTCHA_DATA_CHANGE`,ii(ii({},c),{token:s,url:i})),n.$once(`RESOLVE_CAPTCHA_DATA`,function(t){e(t)})}):Promise.reject({error:`unimplemented`,error_description:`need to impl captcha data`})}},localStorage:fi,primaryStorage:d.local,getAppSign:function(){var e=wx.getAccountInfoSync();return li()?e&&e.plugin?e.plugin.appId:``:e&&e.miniProgram?e.miniProgram.appId:``}}}var gi={genAdapter:hi,isMatch:ci,runtime:`wx_mp`},_i={d:(e,t)=>{for(var n in t)_i.o(t,n)&&!_i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},vi={};_i.d(vi,{Z:()=>eo});var yi=`@cloudbase/js-sdk`;function bi(){return yi}var xi=`https:`,Si={INVALID_PARAMS:`INVALID_PARAMS`,INVALID_SYNTAX:`INVALID_SYNTAX`,INVALID_OPERATION:`INVALID_OPERATION`,OPERATION_FAIL:`OPERATION_FAIL`,NETWORK_ERROR:`NETWORK_ERROR`,UNKOWN_ERROR:`UNKOWN_ERROR`},Ci=(wi={AbstractSDKRequest:()=>f,AbstractStorage:()=>p,StorageType:()=>d},Ti={},_i.d(Ti,wi),Ti),wi,Ti,Ei=function(e,t){return Ei=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Ei(e,t)},Di,Oi=function(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);function n(){this.constructor=e}Ei(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)};function ki(e){return Object.prototype.toString.call(e)===`[object FormData]`}function Ai(e,t,n){n===void 0&&(n={});var r=/\?/.test(t),i=``;return Object.keys(n).forEach(function(e){i===``?!r&&(t+=`?`):i+=`&`,i+=`${e}=${encodeURIComponent(n[e])}`}),/^http(s)?:\/\//.test(t+=i)?t:`${e}${t}`}function ji(e,t){console.warn(`[${bi()}][${e}]:${t}`)}function Mi(e){var t={},n=e.match(/^(data:.*?)(\?[^#\s]*)?$/);if(n){e=n[1];var r=n[2];r&&(t=function(e){e=e.replace(/^\?/,``);var t={};return e.split(`&`).forEach(function(e){var n=e.split(`=`),r=n[0],i=n[1];r=decodeURIComponent(r),i=decodeURIComponent(i),r&&(t[r]?Array.isArray(t[r])?t[r].push(i):t[r]=[t[r],i]:t[r]=i)}),t}(r))}var i=t.token,a=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(t,[`token`]);return/^data:/.test(e)&&!i?{error:`invalid_argument`,error_description:`invalid captcha data: ${e}`}:i?{state:a.state,token:i,captchaData:e}:{error:`unimplemented`,error_description:`need to impl captcha data`}}Di=Error,Oi(function(e){var t=Di.call(this,e.msg||e.message||``)||this;return t.code=e.code||``,t.requestId=e.requestId||``,Object.defineProperty(t,"message",{value:e.msg||e.message||``,enumerable:!0,writable:!0,configurable:!0}),t},Di);var Ni,Pi=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Fi=function(){return Fi=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Fi.apply(this,arguments)},Ii=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},Li=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},Ri=function(e){function t(t){var n=e.call(this)||this,r=t.timeout,i=t.timeoutMsg,a=t.restrictedMethods;return n.timeout=r||0,n.timeoutMsg=i||`请求超时`,n.restrictedMethods=a||[`get`,`post`,`upload`,`download`],n}return Pi(t,e),t.prototype.get=function(e){return this.request(Fi(Fi({},e),{method:`get`}),this.restrictedMethods.includes(`get`))},t.prototype.post=function(e){return this.request(Fi(Fi({},e),{method:`post`}),this.restrictedMethods.includes(`post`))},t.prototype.put=function(e){return this.request(Fi(Fi({},e),{method:`put`}))},t.prototype.upload=function(e){var t=e.data,n=e.file,r=e.name,i=e.method,a=e.headers,o=a===void 0?{}:a,s={post:`post`,put:`put`}[i?.toLowerCase()]||`put`,c=new FormData;return s===`post`?(Object.keys(t).forEach(function(e){c.append(e,t[e])}),c.append(`key`,r),c.append(`file`,n),this.request(Fi(Fi({},e),{data:c,method:s}),this.restrictedMethods.includes(`upload`))):this.request(Fi(Fi({},e),{method:`put`,headers:o,body:n}),this.restrictedMethods.includes(`upload`))},t.prototype.download=function(e){return Ii(this,void 0,Promise,function(){var t,n,r,i;return Li(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.get(Fi(Fi({},e),{headers:{},responseType:`blob`}))];case 1:return t=a.sent().data,n=window.URL.createObjectURL(new Blob([t])),r=decodeURIComponent(new URL(e.url).pathname.split(`/`).pop()||``),(i=document.createElement(`a`)).href=n,i.setAttribute(`download`,r),i.style.display=`none`,document.body.appendChild(i),i.click(),window.URL.revokeObjectURL(n),document.body.removeChild(i),[3,3];case 2:return a.sent(),[3,3];case 3:return[2,new Promise(function(t){t({statusCode:200,tempFilePath:e.url})})]}})})},t.prototype.fetch=function(e){return Ii(this,void 0,Promise,function(){var t,n,r,i,a,o,s,c,l,u,d,f,p,m=this;return Li(this,function(h){switch(h.label){case 0:return t=new AbortController,n=e.url,r=e.enableAbort,i=r!==void 0&&r,a=e.stream,o=a!==void 0&&a,s=e.signal,c=e.timeout,l=e.shouldThrowOnError,u=l===void 0||l,d=c??this.timeout,s&&(s.aborted&&t.abort(),s.addEventListener(`abort`,function(){return t.abort()})),f=null,i&&d&&(f=setTimeout(function(){console.warn(m.timeoutMsg),t.abort(Error(m.timeoutMsg))},d)),[4,fetch(n,Fi(Fi({},e),{signal:t.signal})).then(function(e){return Ii(m,void 0,void 0,function(){var t,n,r;return Li(this,function(i){switch(i.label){case 0:return clearTimeout(f),u?e.ok?(t=e,[3,3]):[3,1]:[3,4];case 1:return r=(n=Promise).reject,[4,e.json()];case 2:t=r.apply(n,[i.sent()]),i.label=3;case 3:return[2,t];case 4:return[2,e]}})})}).catch(function(e){return clearTimeout(f),Promise.reject(e)})];case 1:return p=h.sent(),[2,{data:o?p.body:p.headers.get(`content-type`)?.includes(`application/json`)?p.json():p.text(),statusCode:p.status,header:p.headers,response:p}]}})})},t.prototype.request=function(e,t){var n=this;t===void 0&&(t=!1);var r=String(e.method).toLowerCase()||`get`;return new Promise(function(i){var a=e.url,o=e.headers,s=o===void 0?{}:o,c=e.data,l=e.responseType,u=e.withCredentials,d=e.body,f=e.onUploadProgress,p=Ai(xi,a,r===`get`?c:{}),m=new XMLHttpRequest;m.open(r,p),l&&(m.responseType=l);var h,g,_=e.signal;_&&(_.aborted?m.abort():_.addEventListener(`abort`,function(){return m.abort()},{once:!0})),Object.keys(s).forEach(function(e){m.setRequestHeader(e,s[e])}),f&&m.upload.addEventListener(`progress`,f),m.onreadystatechange=function(){var e={};if(m.readyState===4){var t=m.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};t.forEach(function(e){var t=e.split(`: `),r=t.shift().toLowerCase();n[r]=t.join(`: `)}),e.header=n,e.statusCode=m.status;try{e.data=l===`blob`?m.response:JSON.parse(m.responseText)}catch{e.data=l===`blob`?m.response:m.responseText}clearTimeout(h),i(e)}},t&&n.timeout&&(h=setTimeout(function(){console.warn(n.timeoutMsg),m.abort()},n.timeout)),g=ki(c)?c:s[`content-type`]===`application/x-www-form-urlencoded`?function(e){e===void 0&&(e={});var t=[];return Object.keys(e).forEach(function(n){t.push(`${n}=${encodeURIComponent(e[n])}`)}),t.join(`&`)}(c):d||(c?JSON.stringify(c):void 0),u&&(m.withCredentials=!0),m.send(g)})},t}(Ci.AbstractSDKRequest),zi=function(){return zi=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},zi.apply(this,arguments)};(function(e){e.WEB=`web`,e.WX_MP=`wx_mp`})(Ni||={});var Bi=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Vi=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},Hi=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},Ui=function(e){function t(t){var n=e.call(this)||this;return n.root=t,t.tcbCacheObject||={},n}return Bi(t,e),t.prototype.setItem=function(e,t){this.root.tcbCacheObject[e]=t},t.prototype.getItem=function(e){return this.root.tcbCacheObject[e]},t.prototype.removeItem=function(e){delete this.root.tcbCacheObject[e]},t.prototype.clear=function(){delete this.root.tcbCacheObject},t}(Ci.AbstractStorage),Wi=function(){function e(e){this.keys={};var t=e.persistence,n=e.platformInfo,r=n===void 0?{}:n,i=e.keys,a=i===void 0?{}:i;this.platformInfo=r,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||t,this.storage=function(e,t){switch(e){case`local`:default:return t.localStorage?t.localStorage:(ji(Si.INVALID_PARAMS,`localStorage is not supported on current platform`),new Ui(t.root));case`none`:return new Ui(t.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=a)}return Object.defineProperty(e.prototype,"mode",{get:function(){return this.storage.mode||`sync`},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),e.prototype.setStore=function(e,t,n){if(this.mode!==`async`){if(this.storage)try{var r={version:n||`localCachev1`,content:t};this.storage.setItem(e,JSON.stringify(r))}catch(e){throw Error(JSON.stringify({code:Si.OPERATION_FAIL,msg:`[${bi()}][${Si.OPERATION_FAIL}]setStore failed`,info:e}))}}else ji(Si.INVALID_OPERATION,`current platform's storage is asynchronous, please use setStoreAsync insteed`)},e.prototype.setStoreAsync=function(e,t,n){return Vi(this,void 0,void 0,function(){var r;return Hi(this,function(i){switch(i.label){case 0:if(!this.storage)return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),r={version:n||`localCachev1`,content:t},[4,this.storage.setItem(e,JSON.stringify(r))];case 2:return i.sent(),[3,4];case 3:return i.sent(),[2];case 4:return[2]}})})},e.prototype.getStore=function(e,t){if(this.mode!==`async`){try{if(typeof process<`u`&&{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token)return{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token;if(!this.storage)return``}catch{return``}t||=`localCachev1`;var n=this.storage.getItem(e);return n&&n.indexOf(t)>=0?JSON.parse(n).content:``}ji(Si.INVALID_OPERATION,`current platform's storage is asynchronous, please use getStoreAsync insteed`)},e.prototype.getStoreAsync=function(e,t){return Vi(this,void 0,void 0,function(){var n;return Hi(this,function(r){switch(r.label){case 0:try{if(typeof process<`u`&&{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token)return[2,{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token];if(!this.storage)return[2,``]}catch{return[2,``]}return t||=`localCachev1`,[4,this.storage.getItem(e)];case 1:return(n=r.sent())&&n.indexOf(t)>=0?[2,JSON.parse(n).content]:[2,``]}})})},e.prototype.removeStore=function(e){this.mode===`async`?ji(Si.INVALID_OPERATION,`current platform's storage is asynchronous, please use removeStoreAsync insteed`):this.storage.removeItem(e)},e.prototype.removeStoreAsync=function(e){return Vi(this,void 0,void 0,function(){return Hi(this,function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}})})},e}(),Gi=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ki=function(e,t){this.data=t||null,this.name=e},qi=function(e){function t(t,n){var r=e.call(this,`error`,{error:t,data:n})||this;return r.error=t,r}return Gi(t,e),t}(Ki),Ji=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){return function(e,t,n){n[e]=n[e]||[],n[e].push(t)}(e,t,this.listeners),this},e.prototype.off=function(e,t){return function(e,t,n){if(n?.[e]){var r=n[e].indexOf(t);r!==-1&&n[e].splice(r,1)}}(e,t,this.listeners),this},e.prototype.fire=function(e,t){if(e instanceof qi)return console.error(e.error),this;var n=typeof e==`string`?new Ki(e,t||{}):e,r=n.name;if(this.listens(r)){n.target=this;for(var i=0,a=this.listeners[r]?function(e,t,n){if(n||arguments.length===2)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||=Array.prototype.slice.call(t,0,i),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([],this.listeners[r],!0):[];i<a.length;i++)a[i].call(this,n)}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}();new Ji;var Yi=new Ji,Xi=`lang_change`;typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.indexOf(`Firefox`),(e=>{var t={};return _i.d(t,e),t})({default:()=>b}).default;var Zi=function(e,t,n){if(n||arguments.length===2)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||=Array.prototype.slice.call(t,0,i),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))},Qi=Si,$i={};function ea(e,t){var n=t.name,r=t.namespace,i=t.entity,a=t.injectEvents,o=t.IIFE,s=o!==void 0&&o;if($i[n]||r&&e[r])throw Error(JSON.stringify({code:Qi.INVALID_OPERATION,msg:`Duplicate component ${n}`}));if(s){if(!i||typeof i!=`function`)throw Error(JSON.stringify({code:Qi.INVALID_PARAMS,msg:`IIFE component's entity must be a function`}));i.call(e)}if($i[n]=t,r?e.prototype[r]=i:ta(e.prototype,i),a){var c=a.bus,l=a.events;if(!c||!l||l.length===0)return;var u=e.prototype.fire||function(){};e.prototype.events||(e.prototype.events={}),(e.prototype.events||{})[n]?e.prototype.events[n].events=Zi(Zi([],e.prototype.events[n].events,!0),l,!0):e.prototype.events[n]={bus:c,events:l},e.prototype.fire=function(e,t){u(e,t);for(var n=0,r=Object.keys(this.events);n<r.length;n++){var i=r[n],a=this.events[i],o=a.bus;if(a.events.includes(e)){o.fire(e,t);break}}}}}function ta(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:return new Date(t.getTime());case Object:e===void 0&&(e={});break;case Array:e=[];break;default:return t}for(var n=0,r=Object.keys(t);n<r.length;n++){var i=r[n];Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=ta(e[i],t[i]))}return e}var na=(e=>{var t={};return _i.d(t,e),t})({WxMpWebSocket:()=>pi,WxRequest:()=>di,default:()=>gi,parseQueryString:()=>mi,wxMpStorage:()=>fi}),ra=function(){return ra=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ra.apply(this,arguments)},ia={},aa=function(){return aa=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},aa.apply(this,arguments)},oa=Wi,sa={},ca={};function la(e){var t=e.env,n=e.platformInfo,r={userInfoKey:`user_info_${t}`};sa[t]=sa[t]||new oa(aa(aa({},e),{keys:r,platformInfo:n})),ca[t]=ca[t]||new oa(aa(aa({},e),{keys:r,platformInfo:n,persistence:`local`}))}function ua(e){return ca[e]}var da=function(){return da=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},da.apply(this,arguments)},fa=``,pa=`@cloudbase/js-sdk`;function ma(){return fa}var ha,ga=[],_a=[`env`,`endPointKey`,`region`],va=`https:`;function ya(e){return ga.find(function(t){return _a.filter(function(t){return e[t]!=null}).every(function(n){return t[n]===e[n]})})}function ba(e){e.protocol&&!/:$/.test(e.protocol)&&(e.protocol=`${e.protocol}:`);var t,n=ya(e);n?(e.baseUrl!=null&&(n.baseUrl=e.baseUrl),e.protocol!=null&&(n.protocol=e.protocol)):ga.push(da(da({},e),{protocol:e.protocol??va})),e.endPointKey===`CLOUD_API`&&(t=e.protocol??va,xi=t)}function xa(e,t,n){return ya({env:e,endPointKey:t,region:n})}function Sa(e,t){t===void 0&&(t=`CLOUD_API`);var n=xa(e,t||`CLOUD_API`);return`${n.protocol}${n.baseUrl}`.match(/(http(s)?:)?\/\/([^/?#]*)/)[0]}(function(e){e.NULL=`NULL`,e.ANONYMOUS=`ANONYMOUS`,e.WECHAT=`WECHAT`,e.WECHAT_PUBLIC=`WECHAT-PUBLIC`,e.WECHAT_OPEN=`WECHAT-OPEN`,e.CUSTOM=`CUSTOM`,e.EMAIL=`EMAIL`,e.USERNAME=`USERNAME`,e.PHONE=`PHONE`})(ha||={});var Ca=function(){return Ca=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ca.apply(this,arguments)},wa=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},Ta=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},Ea=Si,Da=ki,Oa=Ai,ka=[`auth.getJwt`,`auth.logout`,`auth.signInWithTicket`,`auth.signInAnonymously`,`auth.signIn`,`auth.fetchAccessTokenWithRefreshToken`,`auth.signUpWithEmailAndPassword`,`auth.activateEndUserMail`,`auth.sendPasswordResetEmail`,`auth.resetPasswordWithToken`,`auth.isUsernameRegistered`];function Aa(e,t,n){var r=e[t];e[t]=function(t){var i={},a={};n.forEach(function(n){var r=n.call(e,t),o=r.data,s=r.headers;Object.assign(i,o),Object.assign(a,s)});var o=t.data;return o&&(Da(o)?Object.keys(i).forEach(function(e){o.append(e,i[e])}):t.data=Ca(Ca({},o),i)),t.headers=Ca(Ca({},t.headers||{}),a),r.call(e,t)}}function ja(){var e=Math.random().toString(16).slice(2);return{data:{seqId:e},headers:{"X-SDK-Version":`@cloudbase/js-sdk/${ma()}`,"x-seqid":e}}}var Ma,Na,Pa=function(){function e(e){var t=this;this.config=e;var n={env:this.config.env,region:this.config.region,accessKey:this.config.accessKey,context:this.config.context,auth:this.config.auth,timeout:this.config.timeout,timeoutMsg:`[@cloudbase/js-sdk] 请求在${this.config.timeout/1e3}s内未完成,已中断`,restrictedMethods:[`post`,`put`]};this.reqClass=new ia.adapter.reqClass(n),this.localCache=ua(this.config.env),this.config.endPointMode!==`GATEWAY`&&(Aa(this.reqClass,`post`,[ja]),Aa(this.reqClass,`upload`,[ja]),Aa(this.reqClass,`download`,[ja])),Yi.on(Xi,function(e){t.config.i18n=e.data?.i18n||t.config.i18n})}return Object.defineProperty(e.prototype,"throwWhenRequestFail",{get:function(){var e=this.config?._fromApp?.config?.throw;return typeof e==`boolean`?e:!1!==this.config?.throw},enumerable:!1,configurable:!0}),e.prototype.getAccessToken=function(e){return e===void 0&&(e=null),wa(this,void 0,void 0,function(){var t,n,r;return Ta(this,function(i){switch(i.label){case 0:if(e!=null)return[2,e];if(!(t=this.config._fromApp).oauthInstance)throw Error(`you can't request without auth`);return n=t.oauthInstance,r=n.oauth2client,[4,this.getOauthAccessTokenV2(r)];case 1:return[2,i.sent().accessToken]}})})},e.prototype.getDefaultHeaders=function(){var e;return(e={})[this.config.i18n?.LANG_HEADER_KEY]=this.config.i18n?.lang,e[`X-SDK-Version`]=`@cloudbase/js-sdk/${ma()}`,e},e.prototype.post=function(e,t){return wa(this,void 0,Promise,function(){return Ta(this,function(n){switch(n.label){case 0:return[4,this.reqClass.post(Ca(Ca({},e),{headers:Ca(Ca({},e.headers),this.getDefaultHeaders()),customReqOpts:t}))];case 1:return[2,n.sent()]}})})},e.prototype.upload=function(e){return wa(this,void 0,Promise,function(){return Ta(this,function(t){switch(t.label){case 0:return[4,this.reqClass.upload(Ca(Ca({},e),{headers:Ca(Ca({},e.headers),this.getDefaultHeaders())}))];case 1:return[2,t.sent()]}})})},e.prototype.download=function(e){return wa(this,void 0,Promise,function(){return Ta(this,function(t){switch(t.label){case 0:return[4,this.reqClass.download(Ca(Ca({},e),{headers:Ca(Ca({},e.headers),this.getDefaultHeaders())}))];case 1:return[2,t.sent()]}})})},e.prototype.getBaseEndPoint=function(e){return e===void 0&&(e=`CLOUD_API`),Sa(this.config.env,e)},e.prototype.getOauthAccessTokenV2=function(e){return wa(this,void 0,Promise,function(){var t,n;return Ta(this,function(r){switch(r.label){case 0:return[4,e.getAccessToken()];case 1:return t=r.sent(),[4,e.getCredentials()];case 2:return n=r.sent(),[2,{accessToken:t,accessTokenExpire:new Date(n.expires_at).getTime()}]}})})},e.prototype.request=function(e,t,n,r){return wa(this,void 0,Promise,function(){var i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E;return Ta(this,function(D){switch(D.label){case 0:if(D.trys.push([0,4,,5]),i=`x-tcb-trace_${this.config.env}`,a=`application/x-www-form-urlencoded`,o=Ca({action:e,dataVersion:`2020-01-10`,env:this.config.env},t),ka.indexOf(e)!==-1)return[3,2];if(!(s=this.config._fromApp).oauthInstance)throw Error(`you can't request without auth`);return c=s.oauthInstance,l=c.oauth2client,u=o,[4,this.getOauthAccessTokenV2(l)];case 1:u.access_token=D.sent().accessToken,D.label=2;case 2:return e===`storage.uploadFile`?(d=new FormData,Object.keys(d).forEach(function(e){Object.prototype.hasOwnProperty.call(d,e)&&d[e]!==void 0&&d.append(e,o[e])}),a=`multipart/form-data`):(a=`application/json;charset=UTF-8`,d={},Object.keys(o).forEach(function(e){o[e]!==void 0&&(d[e]=o[e])})),f={headers:Ca(Ca({"content-type":a},this.getDefaultHeaders()),n?.headers)},n!=null&&n.onUploadProgress&&(f.onUploadProgress=n.onUploadProgress),this.config.region&&(f.headers[`X-TCB-Region`]=this.config.region),(p=this.localCache.getStore(i))&&(f.headers[`X-TCB-Trace`]=p),m=n?.parse===void 0?t.parse:n.parse,h=n?.inQuery===void 0?t.inQuery:n.inQuery,g=n?.search===void 0?t.search:n.search,_=Ca(Ca({},n?.defaultQuery||{}),{env:this.config.env}),m&&(_.parse=!0),h&&(_=Ca(Ca({},h),_)),v=n?.endPointMode||this.config.endPointMode||`CLOUD_API`,y=xa(this.config.env,v),b=y.baseUrl,x=y.protocol,v===`GATEWAY`&&/^((database)\.)|(auth\.wsWebSign)/.test(e)&&(S=xa(this.config.env,`CLOUD_API`),b=`${S.baseUrl.match(/\/\/([^/?#]*)/)[0]}/web`),C=void 0,C=n.pathname?Oa(x,`${Sa(this.config.env,v)?.replace(/^https?:/,``)}/${n.pathname}`,_):Oa(x,b,_),g&&(C+=g),[4,this.post(Ca({url:C,data:d},f),r)];case 3:if(w=D.sent(),(T=w.header?.[`x-tcb-trace`])&&this.localCache.setStore(i,T),Number(w.status)!==200&&Number(w.statusCode)!==200||!w.data)throw Error(`network request error`);return[2,w];case 4:E=D.sent();try{E.requestId=E.requestId||n?.headers[`x-request-id`]||n?.headers[`X-Request-Id`]||``}catch{}throw E;case 5:return[2]}})})},e.prototype.fetch=function(e){return wa(this,void 0,Promise,function(){var t,n,r,i,a,o,s,c,l=this;return Ta(this,function(u){switch(u.label){case 0:t=e.token,n=e.headers,r=n===void 0?{}:n,i=e.withCredentials,a=i===void 0||i,o=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,[`token`,`headers`,`withCredentials`]),s=function(){return wa(l,void 0,void 0,function(){var e,n,i,s;return Ta(this,function(c){switch(c.label){case 0:if(e={},!a)return[3,4];c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this.getAccessToken(t)];case 2:return(n=c.sent())&&(e.Authorization=`Bearer ${n}`),[3,4];case 3:if(i=c.sent(),typeof process>`u`||process.versions==null||process.versions.node==null)throw i;return[3,4];case 4:return s=Ca({headers:Ca(Ca(Ca({"X-SDK-Version":`@cloudbase/js-sdk/${ma()}`},e),this.getDefaultHeaders()),r),withCredentials:a},o),[2,this.reqClass.fetch(s)]}})})},u.label=1;case 1:return u.trys.push([1,3,,6]),[4,s()];case 2:return[2,u.sent()];case 3:c=u.sent();try{c.requestId=c.requestId||r[`x-request-id`]||r[`X-Request-Id`]||``}catch{}if(c?.code!==`ACCESS_TOKEN_EXPIRED`)return[3,5];if(typeof this.config?._fromApp?.oauthInstance?.authApi?.refreshTokenForce!=`function`)throw c;return[4,(this.config?._fromApp?.oauthInstance?.authApi)?.refreshTokenForce()];case 4:return u.sent(),[2,s()];case 5:throw c;case 6:return[2]}})})},e.prototype.send=function(e,t,n,r){return t===void 0&&(t={}),n===void 0&&(n={}),wa(this,void 0,Promise,function(){var i;return Ta(this,function(a){switch(a.label){case 0:return[4,this.request(e,t,Ca(Ca({},n),{onUploadProgress:t.onUploadProgress}),r)];case 1:if((i=a.sent()).data.code&&this.throwWhenRequestFail)throw Error(JSON.stringify({code:Ea.OPERATION_FAIL,msg:`[${i.data.code}] ${i.data.message}`}));return[2,i.data]}})})},e.prototype.gateWay=function(e,t){return wa(this,void 0,void 0,function(){var n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b;return Ta(this,function(x){switch(x.label){case 0:if(n=e.url,r=e.name,i=e.data,a=e.path,o=a===void 0?``:a,s=e.method,c=e.header,l=c===void 0?{}:c,!(r&&o||n))throw Error(JSON.stringify({code:Ea.INVALID_PARAMS,msg:`[gateWay] invalid function name or path or url`}));try{u=i?JSON.stringify(i):``}catch{throw Error(JSON.stringify({code:Ea.INVALID_PARAMS,msg:`[gateWay] invalid data`}))}if(S=new Date().getTime(),C=(Date==null?void 0:Date.now)&&1e3*Date.now()||0,d=`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,function(e){var t=16*Math.random();return S>0?(t=(S+t)%16|0,S=Math.floor(S/16)):(t=(C+t)%16|0,C=Math.floor(C/16)),(e===`x`?t:7&t|8).toString(16)}),f=xa(this.config.env,`GATEWAY`),p=f.baseUrl,m=f.protocol,h=`${m}${p}${n||`/${o}/${r}`}`,g=[`GET`,`HEAD`].includes((s?.toUpperCase)?.call(s)))try{_={};try{_=JSON.parse(i)}catch{_=i||{}}h=`${h}${h.includes(`?`)?`&`:`?`}${Object.keys(_).map(function(e){return`${e}=${_[e]}`}).join(`&`)}`}catch{}return[4,this.fetch(Ca(Ca({method:s||`POST`,headers:Ca({"Content-Type":`application/json; charset=utf-8`,"X-Request-Id":d},l)},g?{}:{body:u}),{url:h,customReqOpts:t,shouldThrowOnError:e.shouldThrowOnError??this.throwWhenRequestFail}))];case 1:return v=x.sent(),y=[Ca({requestId:d},v)],b={},[4,v.data];case 2:return[2,Ca.apply(void 0,y.concat([(b.data=x.sent(),b)]))]}var S,C})})},e}(),Fa={};(function(e){e.ZH=`zh-CN`,e.EN=`en-US`})(Na||={});var Ia=((Ma={})[Na.EN]={"请检查调用方式,或前往云开发 AI+ 首页查看文档":`Please check the calling method or visit the AI+ homepage to view the documentation`,"AI+ 请求出错,错误码":`AI+ request error, error code`,错误信息:`error message`,未实现:`not implemented`,"小程序不支持 wasm 加载":`wasm loading is not supported in mini programs`,"小程序不支持动态 js 加载":`dynamic js loading is not supported in mini programs`,请求超时:`request timeout`,"缺少 privatelink sdk 地址":`missing privatelink sdk address`},Ma),La=function(e,t){return Ia[t]?.[e]||e},Ra=function(e,t){var n,r=function(e){return`lang_${e.clientId||e.env}`}(t),i=(e.adapter||{}).localStorage,a=t.lang||(i?.getItem)?.call(i,r)||Na.ZH;return(n=i?.setItem)==null||n.call(i,r,a),new Proxy({t:function(e){return La(e,a)},LANG_HEADER_KEY:`Accept-Language`,lang:a},{get:function(e,t){return t===`lang`&&(i?.getItem)?.call(i,r)||e[t]},set:function(e,t,n){var a;return t===`lang`&&n!==e[t]&&(e[t]=n,e.t=function(e){return La(e,n)},(a=i?.setItem)==null||a.call(i,r,n),Yi.fire(Xi,{i18n:e})),e[t]=n,!0}})},za=new Set,Ba=function(){return Ba=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ba.apply(this,arguments)},Va=function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},Ha=function(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)},Ua=function(){return{adapter:zi({},{type:`default`,root:window,reqClass:Ri,wsClass:WebSocket,localStorage}),runtime:Ni.WEB}},Wa=Si,Ga=`https://support.qq.com/products/148793`,Ka=ji,qa=function(e){return e.mode,e.customInfo,e.title,e.messages,function(e,t,n){}},Ja={persistence:`local`},Ya=6e5,Xa={},Za=new(function(){function e(e){this.cloudbaseConfig=e||this.cloudbaseConfig,this.authInstance=null,this.oauthInstance=null,this.requestInstance=null,this.version=ma()}return Object.defineProperty(e.prototype,"config",{get:function(){return this.cloudbaseConfig},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"platform",{get:function(){return ia},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cache",{get:function(){return e=this.cloudbaseConfig.env,sa[e];var e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"localCache",{get:function(){return ua(this.cloudbaseConfig.env)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"request",{get:function(){return this.requestInstance||(e=this.cloudbaseConfig.env,Fa[e]);var e},enumerable:!1,configurable:!0}),e.prototype.init=function(t){var n,r,i,a;if(t===void 0&&(t={env:``}),t.endPointMode=t.endPointMode||`GATEWAY`,ia.adapter||this.useDefaultAdapter(),(t=this.dealNodeAdapterConfig(t)).throw=(n=t.throw??t.throwOnCode)==null||n,delete t.throwOnCode,!t.env)throw Error(JSON.stringify({code:Wa.INVALID_PARAMS,msg:`env must not be specified`}));this.isInitialized(t);var o=this.isNodeEnv()?void 0:15e3,s=t.timeout||o,c={env:t.env,region:t.region,accessKey:t.accessKey,context:t.context,auth:t.auth,timeout:s,timeoutMsg:s?`[${pa}][REQUEST TIMEOUT] request had been abort since didn't finished within${s/1e3}s`:void 0};this.requestClient=new ia.adapter.reqClass(c),this.cloudbaseConfig=Ba(Ba(Ba({},Ja),t),{timeout:s,i18n:Ra(ia,t)}),function(e){e&&typeof e==`object`&&za.add(e)}(this.cloudbaseConfig),delete this.cloudbaseConfig.lang,this.cloudbaseConfig.timeout=this.formatTimeout(this.cloudbaseConfig.timeout);var l=this.cloudbaseConfig,u=l.env,d=l.persistence,f=l.debug,p=l.timeout,m=l.oauthClient,h=l.i18n;la({env:u,persistence:d,debug:f,platformInfo:this.platform}),function(e,t){ba({env:e,region:t,baseUrl:`//${e}.${t||`ap-shanghai`}.tcb-api.tencentcloudapi.com/web`,protocol:void 0,endPointKey:`CLOUD_API`})}(u,t.region||``),function(e,t,n){var r=`//${e}.api.tcloudbasegateway.com/v1`;n&&(r=`//${e}.api.intl.tcloudbasegateway.com/v1`),ba({endPointKey:`GATEWAY`,env:e,baseUrl:r,protocol:t})}(u,va,t.intl);var g=new e(this.cloudbaseConfig);return g.requestInstance=function(e){var t=new Pa(Ca(Ca({},e),{throw:e.throw}));return Fa[e.env]=t,t}({env:u,region:t.region||``,timeout:p,oauthClient:m,_fromApp:g,i18n:h,endPointMode:t.endPointMode,auth:t.auth,context:t.context,accessKey:t.accessKey,throw:t.throw}),g.requestClient=this.requestClient,(r=this==null?void 0:this.fire)==null||r.call(this,`cloudbase_init`,g),this.try2InitAuth(g),(i=ia.adapter)!=null&&i.nodeTool&&((a=ia.adapter)==null||a.nodeTool(g,this.cloudbaseConfig)),g},e.prototype.updateConfig=function(e){var t=e.persistence,n=e.debug;this.cloudbaseConfig.persistence=t,this.cloudbaseConfig.debug=n,la({env:this.cloudbaseConfig.env,persistence:t,debug:n,platformInfo:this.platform})},e.prototype.setThrowOnCode=function(e){this.cloudbaseConfig.throw=e},e.prototype.updateLang=function(e){e&&e!==this.cloudbaseConfig.i18n?.lang&&(this.cloudbaseConfig.i18n.lang=e)},e.prototype.registerExtension=function(e){Xa[e.name]=e},e.prototype.invokeExtension=function(e,t){return n=this,r=void 0,a=function(){var n;return function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}(this,function(r){switch(r.label){case 0:if(!(n=Xa[e]))throw Error(JSON.stringify({code:Wa.INVALID_PARAMS,msg:`extension:${e} must be registered before invoke`}));return[4,n.invoke(t,this)];case 1:return[2,r.sent()]}})},new((i=void 0)||(i=Promise))(function(e,t){function o(e){try{c(a.next(e))}catch(e){t(e)}}function s(e){try{c(a.throw(e))}catch(e){t(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i(function(e){e(n)})).then(o,s)}c((a=a.apply(n,r||[])).next())});var n,r,i,a},e.prototype.useAdapters=function(e,t){var n=function(e,t){for(var n,r=0,i=(n=e,Object.prototype.toString.call(n)===`[object Array]`?e:[e]);r<i.length;r++){var a=i[r],o=a.isMatch,s=a.genAdapter,c=a.runtime;if(o())return{adapter:zi({isMatch:o},s(t)),runtime:c}}}(e,t)||{},r=n.adapter,i=n.runtime;r&&(ia.adapter=r),i&&(ia.runtime=i)},e.prototype.registerHook=function(t){(function(e,t){var n=t.entity,r=t.target;if(Object.prototype.hasOwnProperty.call(e,r))throw Error(JSON.stringify({code:Qi.INVALID_OPERATION,msg:`target:${r} is not exist`}));var i=e.prototype[r];if(typeof i!=`function`)throw Error(JSON.stringify({code:Qi.INVALID_OPERATION,msg:`target:${r} is not a function which is the only type supports hook`}));e.prototype[r]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n.call.apply(n,Zi([this],e,!1)),i.call.apply(i,Zi([this],e,!1))}})(e,t)},e.prototype.registerComponent=function(t){ea(e,t)},e.prototype.registerVersion=function(e){(function(e){fa=e})(e),this.version=e},e.prototype.registerSdkName=function(e){(function(e){pa=e,function(e){yi=e}(e)})(e)},e.prototype.isInitialized=function(e){return e===void 0&&(e=this.cloudbaseConfig),typeof e.env==`string`&&[`your-env-id`,`your-envid`,`your_env_id`,`xxx-yyy`,`xxxx-yyy`,`envId`,`env-id`,`your-environment-id`,`REPLACE_ME`].some(function(t){return e.env.toLowerCase()===t.toLowerCase()})&&Ka(Wa.INVALID_PARAMS,`[CloudBase] 检测到环境 ID "${e.env}" 可能是占位符,请替换为真实的环境 ID。
|
|
2
2
|
获取方式:登录腾讯云开发平台 → 环境管理 → 环境设置 → 环境 ID
|
|
3
|
-
建议通过环境变量配置:process.env.CLOUDBASE_ENV 或 import.meta.env.VITE_CLOUDBASE_ENV`),!!e?.env},e.prototype.registerEndPoint=function(e,t){ba({baseUrl:e,protocol:t,env:this.config.env,endPointKey:`CLOUD_API`})},e.prototype.registerEndPointWithKey=function(e){ba({env:this.config.env,endPointKey:e.key,baseUrl:e.url,protocol:e.protocol})},e.prototype.registerHost=function(e,t){t===void 0&&(t=`http`);var n=`//${e.replace(/^(https?:)?\/\//,``)}`;ba({baseUrl:`${n}/web`,protocol:t,env:this.config.env,endPointKey:`CLOUD_API`}),ba({baseUrl:`${n}/v1`,protocol:t,env:this.config.env,endPointKey:`GATEWAY`})},e.prototype.getEndPointWithKey=function(e){var t=xa(this.config.env,e);return{BASE_URL:t.baseUrl,PROTOCOL:t.protocol}},e.prototype.parseCaptcha=function(e){return Mi(e)},e.prototype.useDefaultAdapter=function(){var e=Ua.bind(this)(),t=e.adapter,n=e.runtime;ia.adapter=t,ia.runtime=n},e.prototype.isNodeEnv=function(){return typeof process<`u`&&!!ia.adapter?.getSecretInfo},e.prototype.formatTimeout=function(e){if(e==null)return e;switch(!0){case e>Ya:return Ka(Wa.INVALID_PARAMS,`timeout is greater than maximum value[10min]`),Ya;case e<100:return Ka(Wa.INVALID_PARAMS,`timeout is less than maximum value[100ms]`),100;default:return e}},e.prototype.try2InitAuth=function(e){try{e.auth()}catch(e){console.log(`try2InitAuth error:`,e)}},e.prototype.dealNodeAdapterConfig=function(e){if(this.isNodeEnv()){var t=ia.adapter?.getSecretInfo(e);e.env&&typeof e.env!=`symbol`||(e.env=t.env),t.credentials&&(e.auth=Ba(Ba({},e.auth),{credentials:t.credentials}));var n=e,r=n.secretId||e.auth?.secretId,i=n.secretKey||e.auth?.secretKey;if(r&&i){var a=n.sessionToken||e.auth?.sessionToken||``;e.auth=Ba(Ba({},e.auth),{secretId:r,secretKey:i,sessionToken:a,secretType:e.auth?.secretType||(a?`SESSION_SECRET`:`SECRET`)})}}return e},Va([qa({mode:`sync`,title:`Cloudbase 初始化失败`,messages:[`请确认以下各项:`,` 1 - 调用 cloudbase.init() 的语法或参数是否正确`,` 2 - 如果是非浏览器环境,是否配置了安全应用来源(https://docs.cloudbase.net/api-reference/webv3/adapter#%E7%AC%AC-2-%E6%AD%A5%E9%85%8D%E7%BD%AE%E5%AE%89%E5%85%A8%E5%BA%94%E7%94%A8%E6%9D%A5%E6%BA%90)`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${Ga}`]}),Ha(`design:type`,Function),Ha(`design:paramtypes`,[Object]),Ha(`design:returntype`,e)],e.prototype,`init`,null),Va([qa({title:`调用扩展能力失败`,messages:[`请确认以下各项:`,` 1 - 调用 invokeExtension() 的语法或参数是否正确`,` 2 - 被调用的扩展能力是否已经安装并通过 registerExtension() 注册`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${Ga}`]}),Ha(`design:type`,Function),Ha(`design:paramtypes`,[String,Object]),Ha(`design:returntype`,Promise)],e.prototype,`invokeExtension`,null),e}()),Qa=na.WxRequest===void 0?null:(na.WxRequest.prototype.upload=function(e){var t=this,n=this;return new Promise(function(r){var i=e.url,a=e.file,o=e.data,s=e.headers,c=wx.getFileSystemManager(),l=wx.request({url:i,method:e.method,header:ra({"content-type":` `},s),data:c.readFileSync(a),timeout:t._timeout,success:function(e){var t={statusCode:e.statusCode,data:e.data||{}};e.statusCode===200&&o!=null&&o.success_action_status&&(t.statusCode=parseInt(o.success_action_status,10)),r(t)},fail:function(e){r(e)},complete:function(e){if(e?.errMsg&&n._timeout&&n._restrictedMethods.indexOf(`upload`)!==-1&&e.errMsg===`request:fail timeout`){console.warn(n._timeoutMsg);try{l.abort()}catch{}}}})})},na.default.genAdapter=function(e){return{root:{globalThis:{}},reqClass:na.WxRequest,wsClass:na.WxMpWebSocket,captchaOptions:{openURIWithCallback:function(t){var n=e.EventBus,r={},i=t;console.log(`openURIWithCallback`,t);var a=t.match(/^(data:.*?)(\?[^#\s]*)?$/);if(a){i=a[1],console.log(`openURIWithCallback url`,i);var o=a[2];o&&(r=(0,na.parseQueryString)(o))}console.log(`openURIWithCallback queryObj`,r);var s=r.token,c=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(r,[`token`]);return/^data:/.test(i)&&!s?Promise.reject({error:`invalid_argument`,error_description:`invalie captcha data: ${t}`}):s?new Promise(function(e){console.log(`wait for captcha...`),n.$emit(`CAPTCHA_DATA_CHANGE`,ra(ra({},c),{token:s,url:i})),n.$once(`RESOLVE_CAPTCHA_DATA`,function(t){e(t)})}):Promise.reject({error:`unimplemented`,error_description:`need to impl captcha data`})}},localStorage:na.wxMpStorage,primaryStorage:Ci.StorageType.local,getAppSign:function(){var e=wx.getAccountInfoSync();return typeof App<`u`||typeof getApp<`u`||wx.onAppHide||wx.offAppHide||wx.onAppShow||wx.offAppShow?e&&e.miniProgram?e.miniProgram.appId:``:e&&e.plugin?e.plugin.appId:``}}},na.default);Qa&&Za.useAdapters(Qa);var $a=Za;$a.registerVersion(`3.
|
|
3
|
+
建议通过环境变量配置:process.env.CLOUDBASE_ENV 或 import.meta.env.VITE_CLOUDBASE_ENV`),!!e?.env},e.prototype.registerEndPoint=function(e,t){ba({baseUrl:e,protocol:t,env:this.config.env,endPointKey:`CLOUD_API`})},e.prototype.registerEndPointWithKey=function(e){ba({env:this.config.env,endPointKey:e.key,baseUrl:e.url,protocol:e.protocol})},e.prototype.registerHost=function(e,t){t===void 0&&(t=`http`);var n=`//${e.replace(/^(https?:)?\/\//,``)}`;ba({baseUrl:`${n}/web`,protocol:t,env:this.config.env,endPointKey:`CLOUD_API`}),ba({baseUrl:`${n}/v1`,protocol:t,env:this.config.env,endPointKey:`GATEWAY`})},e.prototype.getEndPointWithKey=function(e){var t=xa(this.config.env,e);return{BASE_URL:t.baseUrl,PROTOCOL:t.protocol}},e.prototype.parseCaptcha=function(e){return Mi(e)},e.prototype.useDefaultAdapter=function(){var e=Ua.bind(this)(),t=e.adapter,n=e.runtime;ia.adapter=t,ia.runtime=n},e.prototype.isNodeEnv=function(){return typeof process<`u`&&!!ia.adapter?.getSecretInfo},e.prototype.formatTimeout=function(e){if(e==null)return e;switch(!0){case e>Ya:return Ka(Wa.INVALID_PARAMS,`timeout is greater than maximum value[10min]`),Ya;case e<100:return Ka(Wa.INVALID_PARAMS,`timeout is less than maximum value[100ms]`),100;default:return e}},e.prototype.try2InitAuth=function(e){try{e.auth()}catch(e){console.log(`try2InitAuth error:`,e)}},e.prototype.dealNodeAdapterConfig=function(e){if(this.isNodeEnv()){var t=ia.adapter?.getSecretInfo(e);e.env&&typeof e.env!=`symbol`||(e.env=t.env),t.credentials&&(e.auth=Ba(Ba({},e.auth),{credentials:t.credentials}));var n=e,r=n.secretId||e.auth?.secretId,i=n.secretKey||e.auth?.secretKey;if(r&&i){var a=n.sessionToken||e.auth?.sessionToken||``;e.auth=Ba(Ba({},e.auth),{secretId:r,secretKey:i,sessionToken:a,secretType:e.auth?.secretType||(a?`SESSION_SECRET`:`SECRET`)})}}return e},Va([qa({mode:`sync`,title:`Cloudbase 初始化失败`,messages:[`请确认以下各项:`,` 1 - 调用 cloudbase.init() 的语法或参数是否正确`,` 2 - 如果是非浏览器环境,是否配置了安全应用来源(https://docs.cloudbase.net/api-reference/webv3/adapter#%E7%AC%AC-2-%E6%AD%A5%E9%85%8D%E7%BD%AE%E5%AE%89%E5%85%A8%E5%BA%94%E7%94%A8%E6%9D%A5%E6%BA%90)`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${Ga}`]}),Ha(`design:type`,Function),Ha(`design:paramtypes`,[Object]),Ha(`design:returntype`,e)],e.prototype,`init`,null),Va([qa({title:`调用扩展能力失败`,messages:[`请确认以下各项:`,` 1 - 调用 invokeExtension() 的语法或参数是否正确`,` 2 - 被调用的扩展能力是否已经安装并通过 registerExtension() 注册`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${Ga}`]}),Ha(`design:type`,Function),Ha(`design:paramtypes`,[String,Object]),Ha(`design:returntype`,Promise)],e.prototype,`invokeExtension`,null),e}()),Qa=na.WxRequest===void 0?null:(na.WxRequest.prototype.upload=function(e){var t=this,n=this;return new Promise(function(r){var i=e.url,a=e.file,o=e.data,s=e.headers,c=wx.getFileSystemManager(),l=wx.request({url:i,method:e.method,header:ra({"content-type":` `},s),data:c.readFileSync(a),timeout:t._timeout,success:function(e){var t={statusCode:e.statusCode,data:e.data||{}};e.statusCode===200&&o!=null&&o.success_action_status&&(t.statusCode=parseInt(o.success_action_status,10)),r(t)},fail:function(e){r(e)},complete:function(e){if(e?.errMsg&&n._timeout&&n._restrictedMethods.indexOf(`upload`)!==-1&&e.errMsg===`request:fail timeout`){console.warn(n._timeoutMsg);try{l.abort()}catch{}}}})})},na.default.genAdapter=function(e){return{root:{globalThis:{}},reqClass:na.WxRequest,wsClass:na.WxMpWebSocket,captchaOptions:{openURIWithCallback:function(t){var n=e.EventBus,r={},i=t;console.log(`openURIWithCallback`,t);var a=t.match(/^(data:.*?)(\?[^#\s]*)?$/);if(a){i=a[1],console.log(`openURIWithCallback url`,i);var o=a[2];o&&(r=(0,na.parseQueryString)(o))}console.log(`openURIWithCallback queryObj`,r);var s=r.token,c=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(r,[`token`]);return/^data:/.test(i)&&!s?Promise.reject({error:`invalid_argument`,error_description:`invalie captcha data: ${t}`}):s?new Promise(function(e){console.log(`wait for captcha...`),n.$emit(`CAPTCHA_DATA_CHANGE`,ra(ra({},c),{token:s,url:i})),n.$once(`RESOLVE_CAPTCHA_DATA`,function(t){e(t)})}):Promise.reject({error:`unimplemented`,error_description:`need to impl captcha data`})}},localStorage:na.wxMpStorage,primaryStorage:Ci.StorageType.local,getAppSign:function(){var e=wx.getAccountInfoSync();return typeof App<`u`||typeof getApp<`u`||wx.onAppHide||wx.offAppHide||wx.onAppShow||wx.offAppShow?e&&e.miniProgram?e.miniProgram.appId:``:e&&e.plugin?e.plugin.appId:``}}},na.default);Qa&&Za.useAdapters(Qa);var $a=Za;$a.registerVersion(`3.10.0`);try{window.cloudbase=$a}catch{}var eo=$a,to=vi.Z,no={171:(e,t,n)=>{var r;if(n.r(t),n.d(t,{getEncryptInfo:()=>Ee}),!globalThis.IS_MP_BUILD){var i=typeof globalThis<`u`?globalThis.navigator:window.globalThis;function a(e){return`0123456789abcdefghijklmnopqrstuvwxyz`.charAt(e)}function o(e,t){return e&t}function s(e,t){return e|t}function c(e,t){return e^t}function l(e,t){return e&~t}function u(e){if(e==0)return-1;var t=0;return 65535&e||(e>>=16,t+=16),255&e||(e>>=8,t+=8),15&e||(e>>=4,t+=4),3&e||(e>>=2,t+=2),1&e||++t,t}function d(e){for(var t=0;e!=0;)e&=e-1,++t;return t}var f=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`;function p(e){var t,n,r=``;for(t=0;t+3<=e.length;t+=3)n=parseInt(e.substring(t,t+3),16),r+=f.charAt(n>>6)+f.charAt(63&n);for(t+1==e.length?(n=parseInt(e.substring(t,t+1),16),r+=f.charAt(n<<2)):t+2==e.length&&(n=parseInt(e.substring(t,t+2),16),r+=f.charAt(n>>2)+f.charAt((3&n)<<4));(3&r.length)>0;)r+=`=`;return r}function m(e){var t,n=``,r=0,i=0;for(t=0;t<e.length&&e.charAt(t)!=`=`;++t){var o=f.indexOf(e.charAt(t));o<0||(r==0?(n+=a(o>>2),i=3&o,r=1):r==1?(n+=a(i<<2|o>>4),i=15&o,r=2):r==2?(n+=a(i),n+=a(o>>2),i=3&o,r=3):(n+=a(i<<2|o>>4),n+=a(15&o),r=0))}return r==1&&(n+=a(i<<2)),n}var h,g,_={decode:function(e){var t;if(h===void 0){var n=`0123456789ABCDEF`;for(h={},t=0;t<16;++t)h[n.charAt(t)]=t;for(n=n.toLowerCase(),t=10;t<16;++t)h[n.charAt(t)]=t;for(t=0;t<8;++t)h[` \f
|
|
4
4
|
\r \xA0\u2028\u2029`.charAt(t)]=-1}var r=[],i=0,a=0;for(t=0;t<e.length;++t){var o=e.charAt(t);if(o==`=`)break;if((o=h[o])!=-1){if(o===void 0)throw Error(`Illegal character at offset `+t);i|=o,++a>=2?(r[r.length]=i,i=0,a=0):i<<=4}}if(a)throw Error(`Hex encoding incomplete: 4 bits missing`);return r}},v={decode:function(e){var t;if(g===void 0){for(g=Object.create(null),t=0;t<64;++t)g[`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.charAt(t)]=t;for(t=0;t<9;++t)g[`= \f
|
|
5
5
|
\r \xA0\u2028\u2029`.charAt(t)]=-1}var n=[],r=0,i=0;for(t=0;t<e.length;++t){var a=e.charAt(t);if(a==`=`)break;if((a=g[a])!=-1){if(a===void 0)throw Error(`Illegal character at offset `+t);r|=a,++i>=4?(n[n.length]=r>>16,n[n.length]=r>>8&255,n[n.length]=255&r,r=0,i=0):r<<=6}}switch(i){case 1:throw Error(`Base64 encoding incomplete: at least 2 bits missing`);case 2:n[n.length]=r>>10;break;case 3:n[n.length]=r>>16,n[n.length]=r>>8&255}return n},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(e){var t=v.re.exec(e);if(t){if(t[1])e=t[1];else{if(!t[2])throw Error(`RegExp out of sync`);e=t[2]}}return v.decode(e)}},y=0x9184e72a000;class e{constructor(e){this.buf=[+e||0]}mulAdd(e,t){var n,r,i=this.buf,a=i.length;for(n=0;n<a;++n)(r=i[n]*e+t)<y?t=0:r-=(t=0|r/y)*y,i[n]=r;t>0&&(i[n]=t)}sub(e){var t,n,r=this.buf,i=r.length;for(t=0;t<i;++t)(n=r[t]-e)<0?(n+=y,e=1):e=0,r[t]=n;for(;r[r.length-1]===0;)r.pop()}toString(e){if((e||10)!=10)throw Error(`only base 10 is supported`);for(var t=this.buf,n=t[t.length-1].toString(),r=t.length-2;r>=0;--r)n+=(y+t[r]).toString().substring(1);return n}valueOf(){for(var e=this.buf,t=0,n=e.length-1;n>=0;--n)t=t*y+e[n];return t}simplify(){var e=this.buf;return e.length==1?e[0]:this}}var b,x=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,S=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function C(e,t){return e.length>t&&(e=e.substring(0,t)+`…`),e}class t{constructor(e,n){this.hexDigits=`0123456789ABCDEF`,e instanceof t?(this.enc=e.enc,this.pos=e.pos):(this.enc=e,this.pos=n)}get(e){if(e===void 0&&(e=this.pos++),e>=this.enc.length)throw Error(`Requesting byte offset `+e+` on a stream of length `+this.enc.length);return typeof this.enc==`string`?this.enc.charCodeAt(e):this.enc[e]}hexByte(e){return this.hexDigits.charAt(e>>4&15)+this.hexDigits.charAt(15&e)}hexDump(e,t,n){for(var r=``,i=e;i<t;++i)if(r+=this.hexByte(this.get(i)),!0!==n)switch(15&i){case 7:r+=` `;break;case 15:r+=`
|
|
6
6
|
`;break;default:r+=` `}return r}isASCII(e,t){for(var n=e;n<t;++n){var r=this.get(n);if(r<32||r>176)return!1}return!0}parseStringISO(e,t){for(var n=``,r=e;r<t;++r)n+=String.fromCharCode(this.get(r));return n}parseStringUTF(e,t){for(var n=``,r=e;r<t;){var i=this.get(r++);n+=i<128?String.fromCharCode(i):i>191&&i<224?String.fromCharCode((31&i)<<6|63&this.get(r++)):String.fromCharCode((15&i)<<12|(63&this.get(r++))<<6|63&this.get(r++))}return n}parseStringBMP(e,t){for(var n,r,i=``,a=e;a<t;)n=this.get(a++),r=this.get(a++),i+=String.fromCharCode(n<<8|r);return i}parseTime(e,t,n){var r=this.parseStringISO(e,t),i=(n?x:S).exec(r);return i?(n&&(i[1]=+i[1],i[1]+=+i[1]<70?2e3:1900),r=i[1]+`-`+i[2]+`-`+i[3]+` `+i[4],i[5]&&(r+=`:`+i[5],i[6]&&(r+=`:`+i[6],i[7]&&(r+=`.`+i[7]))),i[8]&&(r+=` UTC`,i[8]!=`Z`&&(r+=i[8],i[9]&&(r+=`:`+i[9]))),r):`Unrecognized time: `+r}parseInteger(t,n){for(var r,i=this.get(t),a=i>127,o=a?255:0,s=``;i==o&&++t<n;)i=this.get(t);if((r=n-t)===0)return a?-1:0;if(r>4){for(s=i,r<<=3;!(128&(+s^o));)s<<=1,--r;s=`(`+r+` bit)
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
`),c=s?/^catchErrorsDecorator\/<\/descriptor.value@.*\d$/:RegExp(`${n}\\.descriptor.value\\s*\\[as\\s${r}\\]\\s*\\(.*\\)\$`),u=s?/^catchErrorsDecorator\/<\/descriptor.value/:RegExp(`${n}\\.descriptor.value\\s*\\[as\\s${r}\\]`),d=o.findIndex(function(e){return c.test(e)});if(d!==-1){var f=o.filter(function(e,t){return t>d});f.unshift(o[d].replace(u,`${n}.${r}`).replace(l,i)),(a=Error()).stack=`${s?`@debugger`:`Error`}
|
|
12
12
|
${f.join(`
|
|
13
13
|
`)}`}return a}t.catchErrorsDecorator=function(e){var t=e.mode,n=t===void 0?`async`:t,s=e.customInfo,d=s===void 0?{}:s,f=e.title,p=e.messages,m=p===void 0?[]:p;return function(e,t,s){if(o.IS_DEBUG_MODE){var p=d.className||e.constructor.name,h=d.methodName||t,g=s.value,_=function(){var e=``,t=Error().stack.split(`
|
|
14
|
-
`),n=t.findIndex(function(e){return c.test(e)});if(n!==-1){var r=l.exec(t[n+1]||``);e=r?r[0]:``}return e}();s.value=n===`sync`?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=u({err:Error(),className:p,methodName:h,sourceLink:_});try{return g.apply(this,e)}catch(e){var r=e,i=e.message,o=e.error,s=e.error_description,c={title:f||`${p}.${h} failed`,content:[{type:`error`,body:e}]};if(i&&/^\{.*\}$/.test(i)){var l=JSON.parse(i);c.subtitle=i,l.code&&(n?(n.code=l.code,n.msg=l.msg):(e.code=l.code,e.message=l.msg),r=n||e,c.content=m.map(function(e){return{type:`info`,body:e}}))}throw o&&s&&(c.subtitle=s,n?(n.code=o,n.msg=s):(e.code=o,e.message=s),r=n||e,c.content=m.map(function(e){return{type:`info`,body:e}})),(0,a.printGroupLog)(c),r}}:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return r(this,void 0,void 0,function(){var t,n,r,o,s,c,l,d;return i(this,function(i){switch(i.label){case 0:t=u({err:Error(),className:p,methodName:h,sourceLink:_}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,g.apply(this,e)];case 2:return[2,i.sent()];case 3:throw n=i.sent(),r=n,o=n.message,s=n.error,c=n.error_description,l={title:f||`${p}.${h} failed`,content:[{type:`error`,body:n}]},o&&/^\{.*\}$/.test(o)&&(d=JSON.parse(o),l.subtitle=d,d.code&&(t?(t.code=d.code,t.message=d.msg):(n.code=d.code,n.message=d.msg),r=t||n,l.content=m.map(function(e){return{type:`info`,body:e}}))),s&&c&&(l.subtitle=c,t?(t.code=s,t.msg=c):(n.code=s,n.message=c),r=t||n,l.content=m.map(function(e){return{type:`info`,body:e}})),(0,a.printGroupLog)(l),r;case 4:return[2]}})})}}}}},141:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!(`get`in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)n==="default"||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(718),t)},197:function(e,t,n){var r,i=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);function n(){this.constructor=e}r(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}),a=this&&this.__awaiter||function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.CloudbaseCache=void 0;var s=n(149),c=n(616),l=n(794),u=function(e){function t(t){var n=e.call(this)||this;return n.root=t,t.tcbCacheObject||={},n}return i(t,e),t.prototype.setItem=function(e,t){this.root.tcbCacheObject[e]=t},t.prototype.getItem=function(e){return this.root.tcbCacheObject[e]},t.prototype.removeItem=function(e){delete this.root.tcbCacheObject[e]},t.prototype.clear=function(){delete this.root.tcbCacheObject},t}(s.AbstractStorage);t.CloudbaseCache=function(){function e(e){this.keys={};var t=e.persistence,n=e.platformInfo,r=n===void 0?{}:n,i=e.keys,a=i===void 0?{}:i;this.platformInfo=r,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||t,this.storage=function(e,t){switch(e){case`local`:default:return t.localStorage?t.localStorage:((0,c.printWarn)(l.ERRORS.INVALID_PARAMS,`localStorage is not supported on current platform`),new u(t.root));case`none`:return new u(t.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=a)}return Object.defineProperty(e.prototype,"mode",{get:function(){return this.storage.mode||`sync`},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),e.prototype.setStore=function(e,t,n){if(this.mode!==`async`){if(this.storage)try{var r={version:n||`localCachev1`,content:t};this.storage.setItem(e,JSON.stringify(r))}catch(e){throw Error(JSON.stringify({code:l.ERRORS.OPERATION_FAIL,msg:`[${(0,l.getSdkName)()}][${l.ERRORS.OPERATION_FAIL}]setStore failed`,info:e}))}}else(0,c.printWarn)(l.ERRORS.INVALID_OPERATION,`current platform's storage is asynchronous, please use setStoreAsync insteed`)},e.prototype.setStoreAsync=function(e,t,n){return a(this,void 0,void 0,function(){var r;return o(this,function(i){switch(i.label){case 0:if(!this.storage)return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),r={version:n||`localCachev1`,content:t},[4,this.storage.setItem(e,JSON.stringify(r))];case 2:return i.sent(),[3,4];case 3:return i.sent(),[2];case 4:return[2]}})})},e.prototype.getStore=function(e,t){if(this.mode!==`async`){try{if(typeof process<`u`&&{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token)return{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token;if(!this.storage)return``}catch{return``}t||=`localCachev1`;var n=this.storage.getItem(e);return n&&n.indexOf(t)>=0?JSON.parse(n).content:``}(0,c.printWarn)(l.ERRORS.INVALID_OPERATION,`current platform's storage is asynchronous, please use getStoreAsync insteed`)},e.prototype.getStoreAsync=function(e,t){return a(this,void 0,void 0,function(){var n;return o(this,function(r){switch(r.label){case 0:try{if(typeof process<`u`&&{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token)return[2,{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token];if(!this.storage)return[2,``]}catch{return[2,``]}return t||=`localCachev1`,[4,this.storage.getItem(e)];case 1:return(n=r.sent())&&n.indexOf(t)>=0?[2,JSON.parse(n).content]:[2,``]}})})},e.prototype.removeStore=function(e){this.mode===`async`?(0,c.printWarn)(l.ERRORS.INVALID_OPERATION,`current platform's storage is asynchronous, please use removeStoreAsync insteed`):this.storage.removeItem(e)},e.prototype.removeStoreAsync=function(e){return a(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}})})},e}()},689:function(e,t,n){var r,i=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);function n(){this.constructor=e}r(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}),a=this&&this.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||=Array.prototype.slice.call(t,0,i),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.removeEventListener=t.activateEvent=t.addEventListener=t.CloudbaseEventEmitter=t.IErrorEvent=t.CloudbaseEvent=void 0;var o=n(616),s=function(e,t){this.data=t||null,this.name=e};t.CloudbaseEvent=s;var c=function(e){function t(t,n){var r=e.call(this,`error`,{error:t,data:n})||this;return r.error=t,r}return i(t,e),t}(s);t.IErrorEvent=c;var l=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){return function(e,t,n){n[e]=n[e]||[],n[e].push(t)}(e,t,this.listeners),this},e.prototype.off=function(e,t){return function(e,t,n){if(n?.[e]){var r=n[e].indexOf(t);r!==-1&&n[e].splice(r,1)}}(e,t,this.listeners),this},e.prototype.fire=function(e,t){if((0,o.isInstanceOf)(e,c))return console.error(e.error),this;var n=(0,o.isString)(e)?new s(e,t||{}):e,r=n.name;if(this.listens(r)){n.target=this;for(var i=0,l=this.listeners[r]?a([],this.listeners[r],!0):[];i<l.length;i++)l[i].call(this,n)}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}();t.CloudbaseEventEmitter=l;var u=new l;t.addEventListener=function(e,t){u.on(e,t)},t.activateEvent=function(e,t){t===void 0&&(t={}),u.fire(e,t)},t.removeEventListener=function(e,t){u.off(e,t)}},616:function(e,t,n){var r,i=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);function n(){this.constructor=e}r(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}),a=this&&this.__assign||function(){return a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},a.apply(this,arguments)},o=this&&this.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};Object.defineProperty(t,"__esModule",{value:!0}),t.parseCaptcha=t.parseQueryString=t.transformPhone=t.sleep=t.printGroupLog=t.errorToResult=t.promoteGatewayError=t.maybeThrow=t.resolveThrow=t.createCloudbaseError=t.CloudbaseError=t.throwError=t.printInfo=t.printError=t.printWarn=t.execCallback=t.createPromiseCallback=t.removeParam=t.getHash=t.getQuery=t.toQueryString=t.formatUrl=t.generateRequestId=t.genSeqId=t.isFormData=t.isInstanceOf=t.isNull=t.isPalinObject=t.isUndefined=t.isString=t.isArray=void 0;var s=n(794);t.isArray=function(e){return Object.prototype.toString.call(e)===`[object Array]`},t.isString=function(e){return typeof e==`string`},t.isUndefined=function(e){return e===void 0},t.isPalinObject=function(e){return Object.prototype.toString.call(e)===`[object Object]`},t.isNull=function(e){return Object.prototype.toString.call(e)===`[object Null]`},t.isInstanceOf=function(e,t){return e instanceof t},t.isFormData=function(e){return Object.prototype.toString.call(e)===`[object FormData]`},t.genSeqId=function(){return Math.random().toString(16).slice(2)},t.generateRequestId=function(){var e=new Date().getTime(),t=(Date==null?void 0:Date.now)&&1e3*Date.now()||0;return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,function(n){var r=16*Math.random();return e>0?(r=(e+r)%16|0,e=Math.floor(e/16)):(r=(t+r)%16|0,t=Math.floor(t/16)),(n===`x`?r:7&r|8).toString(16)})},t.formatUrl=function(e,t,n){n===void 0&&(n={});var r=/\?/.test(t),i=``;return Object.keys(n).forEach(function(e){i===``?!r&&(t+=`?`):i+=`&`,i+=`${e}=${encodeURIComponent(n[e])}`}),/^http(s)?:\/\//.test(t+=i)?t:`${e}${t}`},t.toQueryString=function(e){e===void 0&&(e={});var t=[];return Object.keys(e).forEach(function(n){t.push(`${n}=${encodeURIComponent(e[n])}`)}),t.join(`&`)},t.getQuery=function(e,t){if(typeof window>`u`)return!1;var n=t||decodeURIComponent(window.location.search),r=RegExp(`(^|&)${e}=([^&]*)(&|\$)`),i=n.substr(n.indexOf(`?`)+1).match(r);return i==null?``:i[2]},t.getHash=function(e){if(typeof window>`u`)return``;var t=window.location.hash.match(RegExp(`[#?&/]${e}=([^&#]*)`));return t?t[1]:``},t.removeParam=function(e,t){var n=t.split(`?`)[0],r=[],i=t.indexOf(`?`)===-1?``:t.split(`?`)[1];if(i!==``){for(var a=(r=i.split(`&`)).length-1;a>=0;--a)r[a].split(`=`)[0]===e&&r.splice(a,1);n=`${n}?${r.join(`&`)}`}return n},t.createPromiseCallback=function(){var e={};if(!Promise){(e=function(){}).promise={};var t=function(){throw Error(`Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.`)};return Object.defineProperty(e.promise,"then",{get:t}),Object.defineProperty(e.promise,"catch",{get:t}),e}var n=new Promise(function(t,n){e=function(e,r){return e?n(e):t(r)}});return e.promise=n,e},t.execCallback=function(e,t,n){if(n===void 0&&(n=null),e&&typeof e==`function`)return e(t,n);if(t)throw t;return n},t.printWarn=function(e,t){console.warn(`[${(0,s.getSdkName)()}][${e}]:${t}`)},t.printError=function(e,t){console.error({code:e,msg:`[${(0,s.getSdkName)()}][${e}]:${t}`})},t.printInfo=function(e,t){console.log(`[${(0,s.getSdkName)()}][${e}]:${t}`)},t.throwError=function(e,t){var n=Error(JSON.stringify({code:e,msg:`[${(0,s.getSdkName)()}][${e}]:${t}`}));throw n.code=e,n};var c=function(e){function t(t){var n=e.call(this,t.msg||t.message||``)||this;return n.code=t.code||``,n.requestId=t.requestId||``,Object.defineProperty(n,"message",{value:t.msg||t.message||``,enumerable:!0,writable:!0,configurable:!0}),n}return i(t,e),t}(Error);t.CloudbaseError=c;var l=function(e){return new c(e)};function u(e,t){return(t||l)(e)}function d(e){return!e||typeof e.throw!=`boolean`||e.throw}t.createCloudbaseError=u,t.resolveThrow=d,t.maybeThrow=function(e,t){if(d(e))throw u(t,e?.errorFactory);return a({code:t.code,message:t.msg},t.requestId?{requestId:t.requestId}:{})},t.promoteGatewayError=function(e){if(e&&typeof e==`object`&&e.data&&typeof e.data==`object`){var t=e.data,n=t.code,r=t.message;if(!e.code&&n||!e.message&&r)return a(a(a({},e),!e.code&&n?{code:n}:{}),!e.message&&r?{message:r}:{})}return e},t.errorToResult=function(e){if(e instanceof Error&&typeof e.message==`string`)try{var t=JSON.parse(e.message);if(t&&typeof t.code==`string`)return{code:t.code,message:t.msg||t.message||``,requestId:t.requestId}}catch{}return e&&typeof e.code==`string`?{code:e.code,message:e.message||``,requestId:e.requestId}:{code:`UNKNOWN_ERROR`,message:String(e?.message||e||``)}},t.printGroupLog=function(e){var t,n=e.title,r=e.subtitle,i=r===void 0?``:r,a=e.content,o=a===void 0?[]:a,s=e.printTrace,c=s!==void 0&&s,l=e.collapsed;l!==void 0&&l?(console.groupCollapsed||console.error)(n,i):(console.group||console.error)(n,i);for(var u=0,d=o;u<d.length;u++){var f=d[u],p=f.type,m=f.body;switch(p){case`info`:console.log(m);break;case`warn`:console.warn(m);break;case`error`:console.error(m)}}c&&(console.trace||console.log)(`stack trace:`),(t=console.groupEnd)==null||t.call(console)},t.sleep=function(e){return e===void 0&&(e=0),new Promise(function(t){return setTimeout(t,e)})},t.transformPhone=function(e){return`+86${e}`},t.parseQueryString=function(e){e=e.replace(/^\?/,``);var t={};return e.split(`&`).forEach(function(e){var n=e.split(`=`),r=n[0],i=n[1];r=decodeURIComponent(r),i=decodeURIComponent(i),r&&(t[r]?Array.isArray(t[r])?t[r].push(i):t[r]=[t[r],i]:t[r]=i)}),t},t.parseCaptcha=function(e){var n={},r=e.match(/^(data:.*?)(\?[^#\s]*)?$/);if(r){e=r[1];var i=r[2];i&&(n=(0,t.parseQueryString)(i))}var a=n.token,s=o(n,[`token`]);return/^data:/.test(e)&&!a?{error:`invalid_argument`,error_description:`invalid captcha data: ${e}`}:a?{state:s.state,token:a,captchaData:e}:{error:`unimplemented`,error_description:`need to impl captcha data`}}},149:e=>{e.exports=h}},ro={};function io(e){var t=ro[e];if(t!==void 0)return t.exports;var n=ro[e]={exports:{}};return no[e].call(n.exports,n,n.exports,io),n.exports}io.d=(e,t)=>{for(var n in t)io.o(t,n)&&!io.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},io.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),io.r=e=>{typeof Symbol<`u`&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:`Module`}),Object.defineProperty(e,"__esModule",{value:!0})};var ao={};(()=>{io.d(ao,{W:()=>Rt});var e={};io.r(e);var t,n,r,i,a,o,s=`/auth`;(function(e){e.AUTH_SIGN_UP_URL=`/v1/signup`,e.AUTH_TOKEN_URL=`/v1/token`,e.AUTH_REVOKE_URL=`/v1/revoke`,e.WEDA_USER_URL=`/v1/plugin/weda/userinfo`,e.AUTH_RESET_PASSWORD=`/v1/reset`,e.AUTH_GET_DEVICE_CODE=`/v1/device/code`,e.CHECK_USERNAME=`/v1/checkUsername`,e.CHECK_IF_USER_EXIST=`/v1/checkIfUserExist`,e.GET_PROVIDER_TYPE=`/v1/mgr/provider/providerSubType`,e.AUTH_SIGN_IN_URL=`/v1/signin`,e.AUTH_SIGN_IN_ANONYMOUSLY_URL=`/v1/signin/anonymously`,e.AUTH_SIGN_IN_WITH_PROVIDER_URL=`/v1/signin/with/provider`,e.AUTH_SIGN_IN_WITH_WECHAT_URL=`/v1/signin/wechat/noauth`,e.AUTH_SIGN_IN_CUSTOM=`/v1/signin/custom`,e.PROVIDER_TOKEN_URL=`/v1/provider/token`,e.PROVIDER_URI_URL=`/v1/provider/uri`,e.USER_ME_URL=`/v1/user/me`,e.AUTH_SIGNOUT_URL=`/v1/user/signout`,e.USER_QUERY_URL=`/v1/user/query`,e.USER_PRIFILE_URL=`/v1/user/profile`,e.USER_BASIC_EDIT_URL=`/v1/user/basic/edit`,e.USER_TRANS_BY_PROVIDER_URL=`/v1/user/trans/by/provider`,e.PROVIDER_LIST=`/v1/user/provider`,e.PROVIDER_BIND_URL=`/v1/user/provider/bind`,e.PROVIDER_UNBIND_URL=`/v1/user/provider`,e.CHECK_PWD_URL=`/v1/user/sudo`,e.SUDO_URL=`/v1/user/sudo`,e.BIND_CONTACT_URL=`/v1/user/contact`,e.AUTH_SET_PASSWORD=`/v1/user/password`,e.AUTHORIZE_DEVICE_URL=`/v1/user/device/authorize`,e.AUTHORIZE_URL=`/v1/user/authorize`,e.AUTHORIZE_INFO_URL=`/v1/user/authorize/info`,e.AUTHORIZED_DEVICES_DELETE_URL=`/v1/user/authorized/devices/`,e.AUTH_REVOKE_ALL_URL=`/v1/user/revoke/all`,e.GET_USER_BEHAVIOR_LOG=`/v1/user/security/history`,e.VERIFICATION_URL=`/v1/verification`,e.VERIFY_URL=`/v1/verification/verify`,e.CAPTCHA_DATA_URL=`/v1/captcha/data`,e.VERIFY_CAPTCHA_DATA_URL=`/v1/captcha/data/verify`,e.GET_CAPTCHA_URL=`/v1/captcha/init`,e.GET_MINIPROGRAM_QRCODE=`/v1/qrcode/generate`,e.GET_MINIPROGRAM_QRCODE_STATUS=`/v1/qrcode/get/status`})(t||={}),function(e){e.AUTH_SIGN_IN_URL=`/v2/signin/username`,e.AUTH_TOKEN_URL=`/v2/token`,e.USER_ME_URL=`/v2/user/me`,e.VERIFY_URL=`/v2/signin/verificationcode`,e.AUTH_SIGN_IN_WITH_PROVIDER_URL=`/v2/signin/with/provider`,e.AUTH_PUBLIC_KEY=`/v2/signin/publichkey`,e.AUTH_RESET_PASSWORD=`/v2/signin/password/update`}(n||={}),function(e){e.REGISTER=`REGISTER`,e.SIGN_IN=`SIGN_IN`,e.PASSWORD_RESET=`PASSWORD_RESET`,e.EMAIL_ADDRESS_CHANGE=`EMAIL_ADDRESS_CHANGE`,e.PHONE_NUMBER_CHANGE=`PHONE_NUMBER_CHANGE`}(r||={}),(o=i||={}).UNREACHABLE=`unreachable`,o.LOCAL=`local`,o.CANCELLED=`cancelled`,o.UNKNOWN=`unknown`,o.UNAUTHENTICATED=`unauthenticated`,o.RESOURCE_EXHAUSTED=`resource_exhausted`,o.FAILED_PRECONDITION=`failed_precondition`,o.INVALID_ARGUMENT=`invalid_argument`,o.DEADLINE_EXCEEDED=`deadline_exceeded`,o.NOT_FOUND=`not_found`,o.ALREADY_EXISTS=`already_exists`,o.PERMISSION_DENIED=`permission_denied`,o.ABORTED=`aborted`,o.OUT_OF_RANGE=`out_of_range`,o.UNIMPLEMENTED=`unimplemented`,o.INTERNAL=`internal`,o.UNAVAILABLE=`unavailable`,o.DATA_LOSS=`data_loss`,o.INVALID_PASSWORD=`invalid_password`,o.PASSWORD_NOT_SET=`password_not_set`,o.INVALID_STATUS=`invalid_status`,o.USER_PENDING=`user_pending`,o.USER_BLOCKED=`user_blocked`,o.INVALID_VERIFICATION_CODE=`invalid_verification_code`,o.TWO_FACTOR_REQUIRED=`two_factor_required`,o.INVALID_TWO_FACTOR=`invalid_two_factor`,o.INVALID_TWO_FACTOR_RECOVERY=`invalid_two_factor_recovery`,o.UNDER_REVIEW=`under_review`,o.INVALID_REQUEST=`invalid_request`,o.UNAUTHORIZED_CLIENT=`unauthorized_client`,o.ACCESS_DENIED=`access_denied`,o.UNSUPPORTED_RESPONSE_TYPE=`unsupported_response_type`,o.INVALID_SCOPE=`invalid_scope`,o.INVALID_GRANT=`invalid_grant`,o.SERVER_ERROR=`server_error`,o.TEMPORARILY_UNAVAILABLE=`temporarily_unavailable`,o.INTERACTION_REQUIRED=`interaction_required`,o.LOGIN_REQUIRED=`login_required`,o.ACCOUNT_SELECTION_REQUIRED=`account_selection_required`,o.CONSENT_REQUIRED=`consent_required`,o.INVALID_REQUEST_URI=`invalid_request_uri`,o.INVALID_REQUEST_OBJECT=`invalid_request_object`,o.REQUEST_NOT_SUPPORTED=`request_not_supported`,o.REQUEST_URI_NOT_SUPPORTED=`request_uri_not_supported`,o.REGISTRATION_NOT_SUPPORTED=`registration_not_supported`,o.CAPTCHA_REQUIRED=`captcha_required`,o.CAPTCHA_INVALID=`captcha_invalid`,o.PROVIDER_NOT_ENABLED=`provider_not_enabled`,o.LOGIN_METHOD_DISABLED=`login_method_disabled`,o.INVALID_USERNAME_OR_PASSWORD=`invalid_username_or_password`,o.INVALID_CREDENTIALS=`invalid_credentials`,o.WRONG_PASSWORD=`wrong_password`,o.USER_NOT_FOUND=`user_not_found`,o.MFA_PHONE_REQUIRED=`mfa_phone_required`,o.LOGIN_TYPE_DISABLED=`login_type_disabled`,o.PROVIDER_ERROR=`provider_error`,o.MISSING_REQUIRED_PARAM=`missing_required_param`,function(e){e[e.INVALID_ARGUMENT=3]=`INVALID_ARGUMENT`,e[e.NOT_FOUND=5]=`NOT_FOUND`,e[e.PERMISSION_DENIED=7]=`PERMISSION_DENIED`,e[e.RESOURCE_EXHAUSTED=8]=`RESOURCE_EXHAUSTED`,e[e.FAILED_PRECONDITION=9]=`FAILED_PRECONDITION`,e[e.ABORTED=10]=`ABORTED`,e[e.UNIMPLEMENTED=12]=`UNIMPLEMENTED`,e[e.INTERNAL=13]=`INTERNAL`,e[e.UNAVAILABLE=14]=`UNAVAILABLE`,e[e.UNAUTHENTICATED=16]=`UNAUTHENTICATED`,e[e.MISSING_REQUIRED_PARAM=4e3]=`MISSING_REQUIRED_PARAM`,e[e.CAPTCHA_REQUIRED=4001]=`CAPTCHA_REQUIRED`,e[e.CAPTCHA_INVALID=4002]=`CAPTCHA_INVALID`,e[e.PROVIDER_ERROR=4019]=`PROVIDER_ERROR`,e[e.UNAUTHORIZED_CLIENT=4022]=`UNAUTHORIZED_CLIENT`,e[e.MFA_PHONE_REQUIRED=4042]=`MFA_PHONE_REQUIRED`,e[e.LOGIN_TYPE_DISABLED=4045]=`LOGIN_TYPE_DISABLED`}(a||={});var c,l,u=`credentials_error`,d=`SIGNED_OUT`,f=`SIGNED_IN`,p=`INITIAL_SESSION`,m=`TOKEN_REFRESHED`,h=`USER_UPDATED`,g=`BIND_IDENTITY`,_=`loginStateChanged`,v=`authStateChanged`,y=`sign_in`,x=`bind_identity`,S=`node-sdk-scope`;function C(){return`xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx`.replace(/[xy]/g,function(e){var t=16*Math.random()|0;return(e===`x`?t:3&t|8).toString(16)})}(function(e){e.EMAIL=`email`,e.RECOVERY=`recovery`,e.REAUTHENTICATION=`reauthentication`})(c||={}),function(e){e.CLIENT_ID=`client_id`,e.CLIENT_SECRET=`client_secret`,e.RESPONSE_TYPE=`response_type`,e.SCOPE=`scope`,e.STATE=`state`,e.REDIRECT_URI=`redirect_uri`,e.ERROR=`error`,e.ERROR_DESCRIPTION=`error_description`,e.ERROR_URI=`error_uri`,e.GRANT_TYPE=`grant_type`,e.CODE=`code`,e.ACCESS_TOKEN=`access_token`,e.TOKEN_TYPE=`token_type`,e.EXPIRES_IN=`expires_in`,e.USERNAME=`username`,e.PASSWORD=`password`,e.REFRESH_TOKEN=`refresh_token`}(l||={});var w=io(631),T=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},E=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},D=new Map,ee=function(){function e(e){this.clientId=e?.clientId||``,this.getScope=e?.getScope,D||=new Map}return e.prototype.run=function(e,t){return T(this,void 0,Promise,function(){var n,r,i=this;return E(this,function(a){return n=this.getScope?this.getScope():this.clientId,e=`${n}_${e}`,(r=D.get(e))||(r=new Promise(function(n,r){T(i,void 0,void 0,function(){var i,a,o;return E(this,function(s){switch(s.label){case 0:return s.trys.push([0,3,4,5]),[4,this.runIdlePromise()];case 1:return s.sent(),i=t(),a=n,[4,i];case 2:return a.apply(void 0,[s.sent()]),[3,5];case 3:return o=s.sent(),r(o),[3,5];case 4:return D.delete(e),[7];case 5:return[2]}})})}),D.set(e,r)),[2,r]})})},e.prototype.runIdlePromise=function(){return Promise.resolve()},e}(),te=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`,O=/^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/,k=function(e){if(e=String(e).replace(/[\t\n\f\r ]+/g,``),!O.test(e))throw TypeError(`Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.`);var t;e+=`==`.slice(2-(3&e.length));for(var n,r,i=``,a=0;a<e.length;)t=te.indexOf(e.charAt(a++))<<18|te.indexOf(e.charAt(a++))<<12|(n=te.indexOf(e.charAt(a++)))<<6|(r=te.indexOf(e.charAt(a++))),i+=n===64?String.fromCharCode(t>>16&255):r===64?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,255&t);return i};function A(){if(typeof globalThis>`u`)return!1;var e=globalThis.wx;if(e===void 0||globalThis.Page===void 0||!e.getDeviceInfo||!e.getStorageSync||!e.setStorageSync||!e.connectSocket||!e.request)return!1;try{if(!e.getDeviceInfo()||e.getDeviceInfo().platform===`qq`)return!1}catch{return!1}return!0}var ne=!1;function re(){ne||=window.__wxjs_environment===`miniprogram`}try{A()||(ne=ne||!!navigator.userAgent.match(/miniprogram/i)||window.__wxjs_environment===`miniprogram`,window&&window.WeixinJSBridge&&window.WeixinJSBridge.invoke?re():typeof document<`u`&&document.addEventListener(`WeixinJSBridgeReady`,re,!1))}catch{}var ie,ae,oe=`INVALID_OPERATION`,se=`OPERATION_FAIL`,ce=io(149),le=(ie=function(e,t){return ie=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},ie(e,t)},function(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);function n(){this.constructor=e}ie(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)});function ue(e,t){if(typeof window>`u`)return!1;var n=t||decodeURIComponent(window.location.search),r=RegExp(`(^|&)${e}=([^&]*)(&|\$)`),i=n.substr(n.indexOf(`?`)+1).match(r);return i==null?``:i[2]}function de(e,t){console.warn(`[@cloudbase/js-sdk][${e}]:${t}`)}ae=Error,le(function(e){var t=ae.call(this,e.msg||e.message||``)||this;return t.code=e.code||``,t.requestId=e.requestId||``,Object.defineProperty(t,"message",{value:e.msg||e.message||``,enumerable:!0,writable:!0,configurable:!0}),t},ae);var fe,pe=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),me=function(){return me=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},me.apply(this,arguments)},he=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},ge=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};(function(e){function t(t){var n=e.call(this)||this,r=t.timeout,i=t.timeoutMsg,a=t.restrictedMethods;return n.timeout=r||0,n.timeoutMsg=i||`请求超时`,n.restrictedMethods=a||[`get`,`post`,`upload`,`download`],n}pe(t,e),t.prototype.get=function(e){return this.request(me(me({},e),{method:`get`}),this.restrictedMethods.includes(`get`))},t.prototype.post=function(e){return this.request(me(me({},e),{method:`post`}),this.restrictedMethods.includes(`post`))},t.prototype.put=function(e){return this.request(me(me({},e),{method:`put`}))},t.prototype.upload=function(e){var t=e.data,n=e.file,r=e.name,i=e.method,a=e.headers,o=a===void 0?{}:a,s={post:`post`,put:`put`}[i?.toLowerCase()]||`put`,c=new FormData;return s===`post`?(Object.keys(t).forEach(function(e){c.append(e,t[e])}),c.append(`key`,r),c.append(`file`,n),this.request(me(me({},e),{data:c,method:s}),this.restrictedMethods.includes(`upload`))):this.request(me(me({},e),{method:`put`,headers:o,body:n}),this.restrictedMethods.includes(`upload`))},t.prototype.download=function(e){return he(this,void 0,Promise,function(){var t,n,r,i;return ge(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.get(me(me({},e),{headers:{},responseType:`blob`}))];case 1:return t=a.sent().data,n=window.URL.createObjectURL(new Blob([t])),r=decodeURIComponent(new URL(e.url).pathname.split(`/`).pop()||``),(i=document.createElement(`a`)).href=n,i.setAttribute(`download`,r),i.style.display=`none`,document.body.appendChild(i),i.click(),window.URL.revokeObjectURL(n),document.body.removeChild(i),[3,3];case 2:return a.sent(),[3,3];case 3:return[2,new Promise(function(t){t({statusCode:200,tempFilePath:e.url})})]}})})},t.prototype.fetch=function(e){return he(this,void 0,Promise,function(){var t,n,r,i,a,o,s,c,l,u,d,f,p,m=this;return ge(this,function(h){switch(h.label){case 0:return t=new AbortController,n=e.url,r=e.enableAbort,i=r!==void 0&&r,a=e.stream,o=a!==void 0&&a,s=e.signal,c=e.timeout,l=e.shouldThrowOnError,u=l===void 0||l,d=c??this.timeout,s&&(s.aborted&&t.abort(),s.addEventListener(`abort`,function(){return t.abort()})),f=null,i&&d&&(f=setTimeout(function(){console.warn(m.timeoutMsg),t.abort(Error(m.timeoutMsg))},d)),[4,fetch(n,me(me({},e),{signal:t.signal})).then(function(e){return he(m,void 0,void 0,function(){var t,n,r;return ge(this,function(i){switch(i.label){case 0:return clearTimeout(f),u?e.ok?(t=e,[3,3]):[3,1]:[3,4];case 1:return r=(n=Promise).reject,[4,e.json()];case 2:t=r.apply(n,[i.sent()]),i.label=3;case 3:return[2,t];case 4:return[2,e]}})})}).catch(function(e){return clearTimeout(f),Promise.reject(e)})];case 1:return p=h.sent(),[2,{data:o?p.body:p.headers.get(`content-type`)?.includes(`application/json`)?p.json():p.text(),statusCode:p.status,header:p.headers,response:p}]}})})},t.prototype.request=function(e,t){var n=this;t===void 0&&(t=!1);var r=String(e.method).toLowerCase()||`get`;return new Promise(function(i){var a=e.url,o=e.headers,s=o===void 0?{}:o,c=e.data,l=e.responseType,u=e.withCredentials,d=e.body,f=e.onUploadProgress,p=function(e,t,n){n===void 0&&(n={});var r=/\?/.test(t),i=``;return Object.keys(n).forEach(function(e){i===``?!r&&(t+=`?`):i+=`&`,i+=`${e}=${encodeURIComponent(n[e])}`}),/^http(s)?:\/\//.test(t+=i)?t:`${e}${t}`}(`https:`,a,r===`get`?c:{}),m=new XMLHttpRequest;m.open(r,p),l&&(m.responseType=l);var h,g,_,v=e.signal;v&&(v.aborted?m.abort():v.addEventListener(`abort`,function(){return m.abort()},{once:!0})),Object.keys(s).forEach(function(e){m.setRequestHeader(e,s[e])}),f&&m.upload.addEventListener(`progress`,f),m.onreadystatechange=function(){var e={};if(m.readyState===4){var t=m.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};t.forEach(function(e){var t=e.split(`: `),r=t.shift().toLowerCase();n[r]=t.join(`: `)}),e.header=n,e.statusCode=m.status;try{e.data=l===`blob`?m.response:JSON.parse(m.responseText)}catch{e.data=l===`blob`?m.response:m.responseText}clearTimeout(h),i(e)}},t&&n.timeout&&(h=setTimeout(function(){console.warn(n.timeoutMsg),m.abort()},n.timeout)),_=c,g=Object.prototype.toString.call(_)===`[object FormData]`?c:s[`content-type`]===`application/x-www-form-urlencoded`?function(e){e===void 0&&(e={});var t=[];return Object.keys(e).forEach(function(n){t.push(`${n}=${encodeURIComponent(e[n])}`)}),t.join(`&`)}(c):d||(c?JSON.stringify(c):void 0),u&&(m.withCredentials=!0),m.send(g)})}})(ce.AbstractSDKRequest),function(e){e.WEB=`web`,e.WX_MP=`wx_mp`}(fe||={});var _e=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),ve=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},j=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},ye=function(e){function t(t){var n=e.call(this)||this;return n.root=t,t.tcbCacheObject||={},n}return _e(t,e),t.prototype.setItem=function(e,t){this.root.tcbCacheObject[e]=t},t.prototype.getItem=function(e){return this.root.tcbCacheObject[e]},t.prototype.removeItem=function(e){delete this.root.tcbCacheObject[e]},t.prototype.clear=function(){delete this.root.tcbCacheObject},t}(ce.AbstractStorage);(function(){function e(e){this.keys={};var t=e.persistence,n=e.platformInfo,r=n===void 0?{}:n,i=e.keys,a=i===void 0?{}:i;this.platformInfo=r,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||t,this.storage=function(e,t){switch(e){case`local`:default:return t.localStorage?t.localStorage:(de(`INVALID_PARAMS`,`localStorage is not supported on current platform`),new ye(t.root));case`none`:return new ye(t.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=a)}Object.defineProperty(e.prototype,"mode",{get:function(){return this.storage.mode||`sync`},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),e.prototype.setStore=function(e,t,n){if(this.mode!==`async`){if(this.storage)try{var r={version:n||`localCachev1`,content:t};this.storage.setItem(e,JSON.stringify(r))}catch(e){throw Error(JSON.stringify({code:se,msg:`[@cloudbase/js-sdk][${se}]setStore failed`,info:e}))}}else de(oe,`current platform's storage is asynchronous, please use setStoreAsync insteed`)},e.prototype.setStoreAsync=function(e,t,n){return ve(this,void 0,void 0,function(){var r;return j(this,function(i){switch(i.label){case 0:if(!this.storage)return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),r={version:n||`localCachev1`,content:t},[4,this.storage.setItem(e,JSON.stringify(r))];case 2:return i.sent(),[3,4];case 3:return i.sent(),[2];case 4:return[2]}})})},e.prototype.getStore=function(e,t){if(this.mode!==`async`){try{if(typeof process<`u`&&{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token)return{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token;if(!this.storage)return``}catch{return``}t||=`localCachev1`;var n=this.storage.getItem(e);return n&&n.indexOf(t)>=0?JSON.parse(n).content:``}de(oe,`current platform's storage is asynchronous, please use getStoreAsync insteed`)},e.prototype.getStoreAsync=function(e,t){return ve(this,void 0,void 0,function(){var n;return j(this,function(r){switch(r.label){case 0:try{if(typeof process<`u`&&{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token)return[2,{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token];if(!this.storage)return[2,``]}catch{return[2,``]}return t||=`localCachev1`,[4,this.storage.getItem(e)];case 1:return(n=r.sent())&&n.indexOf(t)>=0?[2,JSON.parse(n).content]:[2,``]}})})},e.prototype.removeStore=function(e){this.mode===`async`?de(oe,`current platform's storage is asynchronous, please use removeStoreAsync insteed`):this.storage.removeItem(e)},e.prototype.removeStoreAsync=function(e){return ve(this,void 0,void 0,function(){return j(this,function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}})})}})();var be=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),xe=function(e,t){this.data=t||null,this.name=e},Se=function(e){function t(t,n){var r=e.call(this,`error`,{error:t,data:n})||this;return r.error=t,r}return be(t,e),t}(xe),Ce=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){return function(e,t,n){n[e]=n[e]||[],n[e].push(t)}(e,t,this.listeners),this},e.prototype.off=function(e,t){return function(e,t,n){if(n?.[e]){var r=n[e].indexOf(t);r!==-1&&n[e].splice(r,1)}}(e,t,this.listeners),this},e.prototype.fire=function(e,t){if(e instanceof Se)return console.error(e.error),this;var n=typeof e==`string`?new xe(e,t||{}):e,r=n.name;if(this.listens(r)){n.target=this;for(var i=0,a=this.listeners[r]?function(e,t,n){if(n||arguments.length===2)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||=Array.prototype.slice.call(t,0,i),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([],this.listeners[r],!0):[];i<a.length;i++)a[i].call(this,n)}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}();new Ce;var we=new Ce;typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.indexOf(`Firefox`),Te={default:()=>b},M={},io.d(M,Te);var Te,M,Ee=function(){return Ee=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ee.apply(this,arguments)},N=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},P=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},De=function(e,t,n){if(n||arguments.length===2)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||=Array.prototype.slice.call(t,0,i),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))},Oe=`x-request-id`,ke=`x-device-id`,Ae=`device_id`,je=function(e,t){return N(this,void 0,Promise,function(){var n,r,a,o,s;return P(this,function(c){switch(c.label){case 0:n=null,r=null,c.label=1;case 1:return c.trys.push([1,4,,5]),(a=Object.assign({},t)).method||(a.method=`GET`),a.body&&typeof a.body!=`string`&&(a.body=JSON.stringify(a.body)),[4,fetch(e,a)];case 2:return[4,c.sent().json()];case 3:return(o=c.sent())?.error?(r=o).error_uri=new URL(e).pathname:n=o,[3,5];case 4:return s=c.sent(),r={error:i.UNREACHABLE,error_description:s.message,error_uri:new URL(e).pathname},[3,5];case 5:if(r)throw r;return[2,n]}})})},Me=new(function(){function e(e){this._env=e?.env||``}return e.prototype.getItem=function(e){return N(this,void 0,Promise,function(){return P(this,function(t){return[2,window.localStorage.getItem(`${e}${this._env}`)]})})},e.prototype.removeItem=function(e){return N(this,void 0,Promise,function(){return P(this,function(t){return window.localStorage.removeItem(`${e}${this._env}`),[2]})})},e.prototype.setItem=function(e,t){return N(this,void 0,Promise,function(){return P(this,function(n){return window.localStorage.setItem(`${e}${this._env}`,t),[2]})})},e.prototype.getItemSync=function(e){return window.localStorage.getItem(`${e}${this._env}`)},e.prototype.removeItemSync=function(e){window.localStorage.removeItem(`${e}${this._env}`)},e.prototype.setItemSync=function(e,t){window.localStorage.setItem(`${e}${this._env}`,t)},e}()),Ne=function(){function e(e){var t=this;this.credentials=null,this.accessKeyCredentials=null,this.singlePromise=null,this.tokenSectionName=e.tokenSectionName,this.storage=e.storage,this.clientId=e.clientId,this.singlePromise=new ee({clientId:this.clientId,getScope:function(){return t.accessKeyCredentials?.access_token?`${t.clientId}_${t.accessKeyCredentials.access_token}`:t.clientId}}),this.credentials=e.credentials||null,this.onCredentialsChange=e.onCredentialsChange}return e.prototype.syncMemoryCredentials=function(e){this.credentials=e},e.prototype.getMemoryCredentials=function(){return this.credentials},e.prototype.getStorageCredentialsSync=function(){var e=null,t=this.storage.getItemSync(this.tokenSectionName);if(t!=null)try{(e=JSON.parse(t))!=null&&e.expires_at&&(e.expires_at=new Date(e.expires_at))}catch{this.storage.removeItem(this.tokenSectionName),e=null}return e},e.prototype.setCredentials=function(e,t){var n;return N(this,void 0,Promise,function(){var r,i;return P(this,function(a){switch(a.label){case 0:return r=!(!this.credentials||!this.credentials.access_token),e?.expires_in?(e!=null&&e.expires_at||(e.expires_at=new Date(Date.now()+1e3*(e.expires_in-30))),this.storage?(i=JSON.stringify(e),[4,this.storage.setItem(this.tokenSectionName,i)]):[3,2]):[3,3];case 1:a.sent(),a.label=2;case 2:return this.credentials=e,[3,6];case 3:return this.storage?[4,this.storage.removeItem(this.tokenSectionName)]:[3,5];case 4:a.sent(),a.label=5;case 5:this.credentials=null,a.label=6;case 6:return this.onCredentialsChange&&this.onCredentialsChange(e||null,{isInit:(n=t?.isInit)!=null&&n,hadCredentials:r}),[2]}})})},e.prototype.setAccessKeyCredentials=function(e){this.accessKeyCredentials=e,e.scope===S&&(this.credentials=e)},e.prototype.getCredentials=function(){return N(this,void 0,Promise,function(){var e=this;return P(this,function(t){return[2,this.singlePromise.run(`getCredentials`,function(){return N(e,void 0,void 0,function(){var e,t;return P(this,function(n){switch(n.label){case 0:return[4,this.getStorageCredentials()];case 1:return e=n.sent(),t=e.credentials,e.isAccessKeyCredentials?[2,t]:(this.credentials=t,[2,this.credentials])}})})})]})})},e.prototype.getStorageCredentials=function(){return N(this,void 0,Promise,function(){var e=this;return P(this,function(t){return[2,this.singlePromise.run(`_getStorageCredentials`,function(){return N(e,void 0,void 0,function(){var e,t,n;return P(this,function(r){switch(r.label){case 0:return e=null,t=!1,[4,this.storage.getItem(this.tokenSectionName)];case 1:if(!(n=r.sent()))return[3,6];r.label=2;case 2:return r.trys.push([2,3,,5]),(e=JSON.parse(n))!=null&&e.expires_at&&(e.expires_at=new Date(e.expires_at)),[3,5];case 3:return r.sent(),[4,this.storage.removeItem(this.tokenSectionName)];case 4:return r.sent(),e=null,[3,5];case 5:return[3,7];case 6:e=this.accessKeyCredentials||null,t=!0,r.label=7;case 7:return[2,{credentials:e,isAccessKeyCredentials:t}]}})})})]})})},e}(),Pe=function(){function e(t){var n,r=this;this.initializePromise=null,this.lockAcquired=!1,this.pendingInLock=[],this.singlePromise=null,this._initSessionEmitted=!1,t.clientSecret||=``,!t.clientId&&t.env&&(t.clientId=t.env),this.apiOrigin=t.apiOrigin,this.getApiOriginFunc=t.getApiOrigin,this.apiPath=t.apiPath||s,this.clientId=t.clientId,this.i18n=t.i18n,this.eventBus=t.eventBus,this.singlePromise=new ee({clientId:this.clientId}),this.retry=this.formatRetry(t.retry,e.defaultRetry),this.baseRequest=t.baseRequest?t.baseRequest:je,this.tokenInURL=t.tokenInURL,this.headers=t.headers,this.storage=t.storage||Me,this.localCredentials=new Ne({tokenSectionName:`credentials_${t.clientId}`,storage:this.storage,clientId:t.clientId,onCredentialsChange:this._handleCredentialsChange.bind(this)}),this.clientSecret=t.clientSecret,t.clientId&&(this.basicAuth=`Basic ${function(e){for(var t,n,r,i,a=``,o=0,s=(e=String(e)).length%3;o<e.length;){if((n=e.charCodeAt(o++))>255||(r=e.charCodeAt(o++))>255||(i=e.charCodeAt(o++))>255)throw TypeError(`Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.`);a+=te.charAt((t=n<<16|r<<8|i)>>18&63)+te.charAt(t>>12&63)+te.charAt(t>>6&63)+te.charAt(63&t)}return s?a.slice(0,s-3)+`===`.substring(s):a}(`${t.clientId}:${this.clientSecret}`)}`),this.wxCloud=t.wxCloud;try{A()&&(this.useWxCloud=t.useWxCloud,this.wxCloud===void 0&&t.env&&(wx.cloud.init({env:t.env}),this.wxCloud=wx.cloud))}catch{}this.refreshTokenFunc=t.refreshTokenFunc||this.defaultRefreshTokenFunc,this.anonymousSignInFunc=t.anonymousSignInFunc,this.onCredentialsError=t.onCredentialsError,this.getInitialSession=t.getInitialSession,this.onInitialSessionObtained=t.onInitialSessionObtained,this.logDebugMessages=(n=t.debug)!=null&&n,we.on(`lang_change`,function(e){r.i18n=e.data?.i18n||r.i18n}),this._initBroadcastChannel(),this._initVisibilityListener()}return e.prototype.setGetInitialSession=function(e){this.getInitialSession=e},e.prototype.setOnInitialSessionObtained=function(e){this.onInitialSessionObtained=e},e.prototype.initialize=function(e){return N(this,void 0,Promise,function(){var t=this;return P(this,function(n){switch(n.label){case 0:return this.initializePromise?[4,this.initializePromise]:[3,2];case 1:case 3:case 5:return[2,n.sent()];case 2:return e===void 0?[3,4]:(this.initializePromise=e,[4,this.initializePromise]);case 4:return this.initializePromise=N(t,void 0,void 0,function(){var e=this;return P(this,function(t){switch(t.label){case 0:return[4,this._acquireLock(-1,function(){return N(e,void 0,void 0,function(){return P(this,function(e){switch(e.label){case 0:return[4,this._initialize()];case 1:return[2,e.sent()]}})})})];case 1:return[2,t.sent()]}})}),[4,this.initializePromise]}})})},e.prototype.setCredentials=function(e){return N(this,void 0,Promise,function(){var t=this;return P(this,function(n){switch(n.label){case 0:return[4,this.initializePromise];case 1:return n.sent(),[2,this._acquireLock(-1,function(){return N(t,void 0,void 0,function(){return P(this,function(t){return[2,this.localCredentials.setCredentials(e)]})})})]}})})},Object.defineProperty(e.prototype,"initSessionEmitted",{get:function(){return this._initSessionEmitted},enumerable:!1,configurable:!0}),e.prototype.destroy=function(){try{this.broadcastChannel&&typeof this.broadcastChannel.close==`function`&&this.broadcastChannel.close()}catch(e){this._debug(`#destroy`,`close BroadcastChannel error`,e)}finally{this.broadcastChannel=null}try{var e=this.visibilityEventHandler;this.visibilityEventHandler=void 0,e&&typeof window<`u`&&typeof document<`u`&&typeof window.removeEventListener==`function`&&window.removeEventListener(`visibilitychange`,e)}catch(e){this._debug(`#destroy`,`remove visibility listener error`,e)}},e.prototype.setAccessKeyCredentials=function(e){return this.localCredentials.setAccessKeyCredentials(e)},e.prototype.getAccessToken=function(){return N(this,void 0,Promise,function(){var e,t;return P(this,function(n){switch(n.label){case 0:return[4,this.initializePromise];case 1:return n.sent(),[4,this.getCredentials()];case 2:return(e=n.sent())?.scope===S||e?.access_token?[2,Promise.resolve(e.access_token)]:(t={error:i.UNAUTHENTICATED},[2,Promise.reject(t)])}})})},e.prototype.request=function(t,n){return N(this,void 0,Promise,function(){var r,a,o,s,c,l,u,d,f,p;return P(this,function(m){switch(m.label){case 0:return n||={},r=this.formatRetry(n.retry,this.retry),n.headers=Ee(Ee({},n.headers),((p={})[this.i18n?.LANG_HEADER_KEY]=this.i18n?.lang,p)),this.headers&&(n.headers=Ee(Ee({},this.headers),n.headers)),n.headers[Oe]||(n.headers[Oe]=C()),n.headers[ke]?[3,2]:[4,this.getDeviceId()];case 1:a=m.sent(),n.headers[ke]=a,m.label=2;case 2:return n!=null&&n.withBasicAuth&&this.basicAuth&&(n.headers.Authorization=this.basicAuth),n?.withCredentials?n.getCredentials?[4,n.getCredentials()]:[3,4]:[3,7];case 3:return s=m.sent(),[3,6];case 4:return[4,this.getCredentials()];case 5:s=m.sent(),m.label=6;case 6:return(o=s)&&(this.tokenInURL?(t.indexOf(`?`)<0&&(t+=`?`),t+=`access_token=${o.access_token}`):n.headers.Authorization=`${o.token_type} ${o.access_token}`),[3,8];case 7:this.clientId&&t.indexOf(`client_id`)<0&&(t+=t.indexOf(`?`)<0?`?`:`&`,t+=`client_id=${this.clientId}`),m.label=8;case 8:t.startsWith(`/`)&&(c=this.getApiOriginFunc?this.getApiOriginFunc():this.apiOrigin,t=`${c}${this.apiPath}${t}`),l=null,u=r+1,d=0,m.label=9;case 9:if(!(d<u))return[3,21];m.label=10;case 10:return m.trys.push([10,15,,18]),n.useWxCloud||this.useWxCloud?[4,this.wxCloudCallFunction(t,n)]:[3,12];case 11:return l=m.sent(),[3,14];case 12:return[4,this.baseRequest(t,n)];case 13:l=m.sent(),m.label=14;case 14:if(l?.code)throw{error:l.code,error_description:l.message,error_uri:new URL(t).pathname};return[3,21];case 15:f=m.sent();try{f.requestId=f.requestId||n.headers[Oe]||``}catch{}return n.withCredentials&&f&&f.error===i.UNAUTHENTICATED?[4,this.setCredentials(null)]:[3,17];case 16:return m.sent(),[2,Promise.reject(f)];case 17:return d!==r&&f&&f.error===`unreachable`?[3,18]:[2,Promise.reject(f)];case 18:return[4,this.sleep(e.retryInterval)];case 19:m.sent(),m.label=20;case 20:return d++,[3,9];case 21:return[2,l]}})})},e.prototype.wxCloudCallFunction=function(e,t){return N(this,void 0,Promise,function(){var n,r,a,o,s;return P(this,function(c){switch(c.label){case 0:n=null,r=null,c.label=1;case 1:c.trys.push([1,7,,8]),a=``,c.label=2;case 2:return c.trys.push([2,4,,5]),[4,wx.getRendererUserAgent()];case 3:return a=c.sent(),[3,5];case 4:return c.sent(),[3,5];case 5:return[4,this.wxCloud.callFunction({name:`httpOverCallFunction`,data:{url:e,method:t.method,headers:Ee({origin:`https://servicewechat.com`,"User-Agent":a},t.headers),body:t.body}})];case 6:return o=c.sent().result,o?.body?.error_code?(r=o?.body).error_uri=(0,w.y)(e):n=o?.body,[3,8];case 7:return s=c.sent(),r={error:i.UNREACHABLE,error_description:s.message,error_uri:(0,w.y)(e)},[3,8];case 8:if(r)throw r;return[2,n]}})})},e.prototype.getCredentials=function(){return N(this,void 0,Promise,function(){var e=this;return P(this,function(t){switch(t.label){case 0:return[4,this.initializePromise];case 1:return t.sent(),[2,this._acquireLock(-1,function(){return N(e,void 0,void 0,function(){return P(this,function(e){return[2,this._getCredentials()]})})})]}})})},e.prototype.getCredentialsSync=function(){return this.localCredentials.getStorageCredentialsSync()},e.prototype.getCredentialsAsync=function(){return this.getCredentials()},e.prototype.getScope=function(){var e;return N(this,void 0,Promise,function(){var t,n;return P(this,function(r){switch(r.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:return(t=r.sent())?[2,t.scope]:(n=`credentials not found`,(e=this.onCredentialsError)==null||e.call(this,{msg:n}),[2,this.unAuthenticatedError(n)])}})})},e.prototype.getGroups=function(){var e;return N(this,void 0,Promise,function(){var t,n;return P(this,function(r){switch(r.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:return(t=r.sent())?[2,t.groups]:(n=`credentials not found`,(e=this.onCredentialsError)==null||e.call(this,{msg:n}),[2,this.unAuthenticatedError(n)])}})})},e.prototype.refreshToken=function(e,t){return N(this,void 0,Promise,function(){var n=this;return P(this,function(r){switch(r.label){case 0:return[4,this.initializePromise];case 1:return r.sent(),[2,this._acquireLock(-1,function(){return N(n,void 0,void 0,function(){return P(this,function(n){return[2,this._refreshToken(e,t)]})})})]}})})},e.prototype._refreshToken=function(e,t){return N(this,void 0,Promise,function(){var n=this;return P(this,function(r){return[2,this.singlePromise.run(`_refreshToken`,function(){return N(n,void 0,void 0,function(){var n,r,a,o,s,c;return P(this,function(l){switch(l.label){case 0:if(e?.scope===S)return[2,e];if(!e||!e.refresh_token)return a=`no refresh token found in credentials`,(o=this.onCredentialsError)==null||o.call(this,{msg:a}),[2,this.unAuthenticatedError(a)];l.label=1;case 1:return l.trys.push([1,4,,7]),[4,this.refreshTokenFunc(e.refresh_token,e)];case 2:return n=l.sent(),[4,this.localCredentials.setCredentials(n)];case 3:return l.sent(),[2,n];case 4:if(r=l.sent(),t?.throwError)throw r;return r.error===i.INVALID_GRANT?[4,this.localCredentials.setCredentials(null)]:[3,6];case 5:return l.sent(),a=r.error_description,(s=this.onCredentialsError)==null||s.call(this,{msg:a}),[2,this.unAuthenticatedError(a)];case 6:return(c=this.onCredentialsError)==null||c.call(this,{msg:r.error_description}),[2,Promise.reject(r)];case 7:return[2]}})})})]})})},e.prototype.anonymousLogin=function(e){return N(this,void 0,void 0,function(){var t=this;return P(this,function(n){return[2,this.singlePromise.run(`_anonymousLogin`,function(){return N(t,void 0,void 0,function(){var t,n;return P(this,function(r){switch(r.label){case 0:return this.anonymousSignInFunc?[4,this.anonymousSignInFunc(e)]:[3,4];case 1:return t=r.sent(),(n=t)?[3,3]:[4,this.localCredentials.getCredentials()];case 2:n=r.sent(),r.label=3;case 3:return e=n,[3,6];case 4:return[4,this.anonymousSignIn(e)];case 5:e=r.sent(),r.label=6;case 6:return[2,e]}})})})]})})},e.prototype.checkRetry=function(t){var n=null;if((typeof t!=`number`||t<e.minRetry||t>e.maxRetry)&&(n={error:i.UNREACHABLE,error_description:`wrong options param: retry`}),n)throw n;return t},e.prototype.formatRetry=function(e,t){return e===void 0?t:this.checkRetry(e)},e.prototype.sleep=function(e){return N(this,void 0,Promise,function(){return P(this,function(t){return[2,new Promise(function(t){setTimeout(function(){t()},e)})]})})},e.prototype.anonymousSignIn=function(e){return N(this,void 0,Promise,function(){var n=this;return P(this,function(r){return[2,this.singlePromise.run(`_anonymous`,function(){return N(n,void 0,void 0,function(){var n,r;return P(this,function(a){switch(a.label){case 0:if(!e||e.scope!==`anonymous`)return[2,this.unAuthenticatedError(`no anonymous in credentials`)];a.label=1;case 1:return a.trys.push([1,4,,7]),[4,this.request(t.AUTH_SIGN_IN_ANONYMOUSLY_URL,{method:`POST`,withBasicAuth:!0,body:{}})];case 2:return n=a.sent(),[4,this.localCredentials.setCredentials(n)];case 3:return a.sent(),[2,n];case 4:return(r=a.sent()).error===i.INVALID_GRANT?[4,this.localCredentials.setCredentials(null)]:[3,6];case 5:return a.sent(),[2,this.unAuthenticatedError(r.error_description)];case 6:return[2,Promise.reject(r)];case 7:return[2]}})})})]})})},e.prototype.defaultRefreshTokenFunc=function(e,r){var i;return N(this,void 0,Promise,function(){var a,o,s;return P(this,function(c){switch(c.label){case 0:return e===void 0||e===``?(a=`refresh token not found`,(i=this.onCredentialsError)==null||i.call(this,{msg:a}),[2,this.unAuthenticatedError(a)]):(o=t.AUTH_TOKEN_URL,r?.version===`v2`&&(o=n.AUTH_TOKEN_URL),[4,this.request(o,{method:`POST`,body:{client_id:this.clientId,client_secret:this.clientSecret,grant_type:`refresh_token`,refresh_token:e}})]);case 1:return s=c.sent(),[2,Ee(Ee({},s),{version:r?.version||`v1`})]}})})},e.prototype.getDeviceId=function(){return N(this,void 0,Promise,function(){var e;return P(this,function(t){switch(t.label){case 0:return this.deviceID?[2,this.deviceID]:[4,this.storage.getItem(Ae)];case 1:return typeof(e=t.sent())==`string`&&e.length>=16&&e.length<=48?[3,3]:(e=C(),[4,this.storage.setItem(Ae,e)]);case 2:t.sent(),t.label=3;case 3:return this.deviceID=e,[2,e]}})})},e.prototype.unAuthenticatedError=function(e){var t={error:i.UNAUTHENTICATED,error_description:e};return Promise.reject(t)},e.prototype._debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logDebugMessages&&console.log.apply(console,De([`[OAuth2Client]`],e,!1))},e.prototype._initialize=function(){return N(this,void 0,Promise,function(){var e,t,n,r,i,a;return P(this,function(o){switch(o.label){case 0:if(o.trys.push([0,11,12,13]),!this.getInitialSession)return this._debug(`#_initialize()`,`no getInitialSession callback set, skipping`),[2,{error:null}];this._debug(`#_initialize()`,`calling getInitialSession callback`),o.label=1;case 1:return o.trys.push([1,9,,10]),[4,this.getInitialSession()];case 2:return a=o.sent(),e=a.data,t=a.error,e?.session?(this._debug(`#_initialize()`,`session obtained from getInitialSession`,e.session),this._initSessionEmitted=!0,[4,this.localCredentials.setCredentials(e?.session,{isInit:!0})]):[3,4];case 3:o.sent(),o.label=4;case 4:if(!this.onInitialSessionObtained)return[3,8];this._debug(`#_initialize()`,`calling onInitialSessionObtained callback`),o.label=5;case 5:return o.trys.push([5,7,,8]),[4,this.onInitialSessionObtained(e,t)];case 6:return o.sent(),[3,8];case 7:return n=o.sent(),this._debug(`#_initialize()`,`error in onInitialSessionObtained`,n),[3,8];case 8:return t?(this._debug(`#_initialize()`,`error from getInitialSession`,t),[2,{error:t}]):[2,{error:null}];case 9:return r=o.sent(),this._debug(`#_initialize()`,`exception during getInitialSession`,r),[2,{error:r instanceof Error?r:Error(String(r))}];case 10:return[3,13];case 11:return i=o.sent(),this._debug(`#_initialize()`,`unexpected error`,i),[2,{error:i instanceof Error?i:Error(String(i))}];case 12:return this._debug(`#_initialize()`,`end`),[7];case 13:return[2]}})})},e.prototype._acquireLock=function(e,t){return N(this,void 0,Promise,function(){var n,r,i,a,o=this;return P(this,function(s){switch(s.label){case 0:this._debug(`#_acquireLock`,`begin`,e),s.label=1;case 1:if(s.trys.push([1,,10,11]),this.lockAcquired)return n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),r=N(o,void 0,void 0,function(){return P(this,function(e){switch(e.label){case 0:return[4,n];case 1:return e.sent(),[4,t()];case 2:return[2,e.sent()]}})}),this.pendingInLock.push(N(o,void 0,void 0,function(){return P(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,r];case 1:case 2:return e.sent(),[3,3];case 3:return[2]}})})),[2,r];this._debug(`#_acquireLock`,`acquiring lock for client`,this.clientId),s.label=2;case 2:return s.trys.push([2,,8,9]),this.lockAcquired=!0,i=t(),this.pendingInLock.push(N(o,void 0,void 0,function(){return P(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,i];case 1:case 2:return e.sent(),[3,3];case 3:return[2]}})})),[4,i];case 3:s.sent(),s.label=4;case 4:return this.pendingInLock.length?(a=De([],this.pendingInLock,!0),[4,Promise.all(a)]):[3,6];case 5:return s.sent(),this.pendingInLock.splice(0,a.length),[3,4];case 6:return[4,i];case 7:return[2,s.sent()];case 8:return this._debug(`#_acquireLock`,`releasing lock for client`,this.clientId),this.lockAcquired=!1,[7];case 9:return[3,11];case 10:return this._debug(`#_acquireLock`,`end`),[7];case 11:return[2]}})})},e.prototype._getCredentials=function(){var e,t,n;return N(this,void 0,Promise,function(){var r,i,a;return P(this,function(o){switch(o.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:if((r=o.sent())?.scope===S)return[2,r];if(!r)return a=`credentials not found`,(e=this.onCredentialsError)==null||e.call(this,{msg:a}),[2,this.unAuthenticatedError(a)];if(!function(e){var t=!0;return e!=null&&e.expires_at&&e!=null&&e.access_token&&(t=e.expires_at<new Date),t}(r))return[3,12];if(!r.refresh_token)return[3,9];o.label=2;case 2:return o.trys.push([2,4,,8]),[4,this._refreshToken(r)];case 3:return r=o.sent(),[3,8];case 4:return i=o.sent(),r.scope===`anonymous`?[4,this.anonymousLogin(r)]:[3,6];case 5:return r=o.sent(),[3,7];case 6:return(t=this.onCredentialsError)==null||t.call(this,{msg:i.error_description}),[2,Promise.reject(i)];case 7:return[3,8];case 8:return[3,12];case 9:return r.scope===`anonymous`?[4,this.anonymousLogin(r)]:[3,11];case 10:return r=o.sent(),[3,12];case 11:return a=`no refresh token found in credentials`,(n=this.onCredentialsError)==null||n.call(this,{msg:a}),[2,this.unAuthenticatedError(a)];case 12:return[2,r]}})})},e.prototype._isUserCredentials=function(e){return!!e?.access_token&&e.scope!==`accessKey`&&e.scope!==S},e.prototype._fireCredentialsEvents=function(e,t,n){var r,i,a,o,s,c;this._isUserCredentials(e)?t?(a=this.eventBus)==null||a.fire(v,{event:p}):n?(o=this.eventBus)==null||o.fire(v,{event:m}):((s=this.eventBus)==null||s.fire(v,{event:f}),(c=this.eventBus)==null||c.fire(_,{eventType:`sign_in`})):n&&((r=this.eventBus)==null||r.fire(v,{event:d}),(i=this.eventBus)==null||i.fire(_,{eventType:`sign_out`}))},e.prototype._handleCredentialsChange=function(e,t){this._fireCredentialsEvents(e,t.isInit,t.hadCredentials),this._broadcastCredentials(e,t)},e.prototype._initBroadcastChannel=function(){var e=this;if(this.broadcastChannel===void 0)try{typeof BroadcastChannel<`u`&&(this.broadcastChannelName=`credentials_${this.clientId}`,this.broadcastChannel=new BroadcastChannel(this.broadcastChannelName),this.broadcastChannel.addEventListener(`message`,function(t){e._handleBroadcastMessage(t.data)}),this._debug(`#_initBroadcastChannel`,`channel created: ${this.broadcastChannelName}`))}catch(e){this.broadcastChannel=null,this._debug(`#_initBroadcastChannel`,`BroadcastChannel not available, skip`,e)}},e.prototype._broadcastCredentials=function(e,t){if(this.broadcastChannel)try{this.broadcastChannel.postMessage({type:`credentials_changed`,credentials:e,context:t})}catch(e){this._debug(`#_broadcastCredentials`,`postMessage error`,e)}},e.prototype._handleBroadcastMessage=function(e){try{if(!e||e.type!==`credentials_changed`)return;var t=e.context,n=e.credentials;if(n!=null&&n.expires_at&&typeof n.expires_at==`string`&&(n=Ee(Ee({},n),{expires_at:new Date(n.expires_at)})),n?.access_token===this.localCredentials.getMemoryCredentials()?.access_token)return;var r=!!this.localCredentials.getMemoryCredentials()?.access_token;this.localCredentials.syncMemoryCredentials(n),this._fireCredentialsEvents(n,t.isInit,r)}catch(e){this._debug(`#_handleBroadcastMessage`,`error`,e)}},e.prototype._initVisibilityListener=function(){var e=this;try{if(typeof window>`u`||typeof document>`u`||typeof window.addEventListener!=`function`)return;this.visibilityEventHandler=function(){return N(e,void 0,void 0,function(){var e;return P(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._onVisibilityChanged()];case 1:return t.sent(),[3,3];case 2:return e=t.sent(),this._debug(`#visibilityChangedCallback`,`error`,e),[3,3];case 3:return[2]}})})},window.addEventListener(`visibilitychange`,this.visibilityEventHandler)}catch(e){this._debug(`#_initVisibilityListener`,e)}},e.prototype._onVisibilityChanged=function(){return N(this,void 0,Promise,function(){var e=this;return P(this,function(t){return document.visibilityState!==`visible`||this._acquireLock(-1,function(){return N(e,void 0,void 0,function(){var e,t,n,r,i,a;return P(this,function(o){switch(o.label){case 0:if(document.visibilityState!==`visible`)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),e=this.localCredentials.getMemoryCredentials(),[4,this.localCredentials.getCredentials()];case 2:return t=o.sent(),n=e?.access_token,r=t?.access_token,n===r?[2]:(i=!!n,this._fireCredentialsEvents(t,!1,i),[3,4]);case 3:return a=o.sent(),this._debug(`#_onVisibilityChanged`,`reload credentials error`,a),[3,4];case 4:return[2]}})})}),[2]})})},e.defaultRetry=2,e.minRetry=0,e.maxRetry=5,e.retryInterval=1e3,e}(),Fe=io(689),Ie=io(616),Le=function(){return Le=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Le.apply(this,arguments)},Re=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},ze=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},Be=function(e,t){var n;return function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];clearTimeout(n),n=setTimeout(function(){return e.apply(null,r)},t)}},Ve=new Fe.CloudbaseEventEmitter,He=`resolveCaptchaData`,Ue=`padding:10px 8px;background:#007bff;color:#fff;border:none;border-radius:4px;cursor:pointer;flex:1;white-space:nowrap;margin-left:10px`,We=`width:100%;padding:10px;background:#007bff;color:#fff;border:none;border-radius:4px;cursor:pointer`,Ge=`background:#6c757d;cursor:not-allowed`,Ke=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},qe=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},Je=function(){function e(e){e.openURIWithCallback||=this.getDefaultOpenURIWithCallback(),e.storage||=Me,this.config=e,this.tokenSectionName=`captcha_${e.clientId||e.env}`}return e.prototype.isMatch=function(){var e;return((e=this.config?.adapter)?.isMatch)?.call(e)||A()},e.prototype.request=function(e,t){return Ke(this,void 0,Promise,function(){var n,r,a,o;return qe(this,function(s){switch(s.label){case 0:return t||={},t.method||(t.method=`GET`),n=`${t.method}:${e}`,r=e,t.withCaptcha?[4,this.appendCaptchaTokenToURL(e,n,!1)]:[3,2];case 1:r=s.sent(),s.label=2;case 2:return s.trys.push([2,4,,7]),[4,this.config.request(r,t)];case 3:return a=s.sent(),[3,7];case 4:return(o=s.sent()).error!==i.CAPTCHA_REQUIRED&&o.error!==i.CAPTCHA_INVALID?[3,6]:[4,this.appendCaptchaTokenToURL(e,n,o.error===i.CAPTCHA_INVALID)];case 5:return e=s.sent(),[2,this.config.request(e,t)];case 6:return[2,Promise.reject(o)];case 7:return[2,a]}})})},e.prototype.getDefaultOpenURIWithCallback=function(){var e=this;return function(t){return function(e,t){return Re(void 0,void 0,Promise,function(){var n,r,i,a;return ze(this,function(o){return n=(0,Ie.parseCaptcha)(e),r=n.captchaData,i=n.state,a=n.token,function(e){var t=e.oauthInstance,n=e.captchaState,r=`captcha-image`,i=function(){return Re(void 0,void 0,void 0,function(){var e,i;return ze(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,t.createCaptchaData({state:n.state})];case 1:return e=a.sent(),n=Le(Le({},n),{captchaData:e.data,token:e.token}),document.getElementById(r).src=e.data,[3,3];case 2:return i=a.sent(),console.error(`刷新图形验证码失败`,i),[3,3];case 3:return[2]}})})},a=function(e,t,n){var r=document.createElement(e);return t&&(r.style.cssText=t),n&&(r.textContent=n),r},o=a(`div`,`position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.5);z-index:999`),s=a(`div`,`position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:320px;padding:20px;background:#fff;border-radius:8px;box-shadow:0 0 10px rgba(0,0,0,0.2);z-index:1000`);s.appendChild(a(`p`,`margin-bottom:15px`,`请输入你看到的字符:`));var c=a(`div`,`display:flex;align-items:center;justify-content:space-between;margin-bottom:15px`),l=a(`img`,`width:100%;height:auto;border:1px solid #eee`);l.id=r,l.src=n.captchaData,c.appendChild(l);var u=a(`button`,Ue,`刷新`);u.onclick=Be(function(){return Re(void 0,void 0,void 0,function(){return ze(this,function(e){switch(e.label){case 0:u.textContent=`加载中...`,u.disabled=!0,u.style.cssText=`${Ue};${Ge}`,e.label=1;case 1:return e.trys.push([1,,3,4]),[4,i()];case 2:return e.sent(),[3,4];case 3:return u.textContent=`刷新`,u.disabled=!1,u.style.cssText=Ue,[7];case 4:return[2]}})})},500),c.appendChild(u),s.appendChild(c);var d=a(`input`,`width:100%;padding:14px 16px;margin-bottom:15px;box-sizing:border-box;border:2px solid #e8ecf4;border-radius:10px;font-size:15px`);d.type=`text`,d.placeholder=`输入字符`,d.maxLength=4,s.appendChild(d);var f=a(`div`,`color:#dc3545;font-size:12px;margin-bottom:10px;display:none;padding:8px;background:#f8d7da;border:1px solid #f5c6cb;border-radius:4px`);s.appendChild(f);var p=function(e){f.textContent=e,f.style.display=`block`},m=a(`button`,We,`确定`);m.onclick=Be(function(){return Re(void 0,void 0,void 0,function(){var e,r,a,c;return ze(this,function(l){switch(l.label){case 0:if(!(e=d.value.trim()))return p(`请输入字符`),[2];f.style.display=`none`,m.textContent=`验证中...`,m.disabled=!0,m.style.cssText=`${We};${Ge}`,l.label=1;case 1:return l.trys.push([1,3,5,6]),[4,t.verifyCaptchaData({token:n.token,key:e})];case 2:return r=l.sent(),Ve.fire(He,r),console.log(`图形验证码校验成功`),document.body.removeChild(o),document.body.removeChild(s),[3,6];case 3:return a=l.sent(),console.error(`图形验证码校验失败`,a),c=a.error_description||`图形验证码校验失败`,p(c),d.value=``,d.focus(),[4,i()];case 4:return l.sent(),[3,6];case 5:return m.textContent=`确定`,m.disabled=!1,m.style.cssText=We,[7];case 6:return[2]}})})},500),s.appendChild(m),document.body.appendChild(o),document.body.appendChild(s)}({oauthInstance:t,captchaState:{captchaData:r,state:i,token:a}}),[2,new Promise(function(e){console.log(`等待图形验证码校验结果...`),Ve.on(He,function(t){e(t?.data)})})]})})}(t,e.config.oauthInstance)}},e.prototype.getCaptchaToken=function(e,n){return Ke(this,void 0,Promise,function(){var r,i,a,o;return qe(this,function(s){switch(s.label){case 0:return e?[3,2]:[4,this.findCaptchaToken()];case 1:if(r=s.sent())return[2,r];s.label=2;case 2:return[4,this.config.request(t.CAPTCHA_DATA_URL,{method:`POST`,body:{state:n,redirect_uri:``},withCredentials:!1})];case 3:return i=s.sent(),a=`${i.data}?state=${encodeURIComponent(n)}&token=${encodeURIComponent(i.token)}`,[4,this.config.openURIWithCallback(a)];case 4:return o=s.sent(),this.saveCaptchaToken(o),[2,o.captcha_token]}})})},e.prototype.appendCaptchaTokenToURL=function(e,t,n){return Ke(this,void 0,Promise,function(){var r;return qe(this,function(i){switch(i.label){case 0:return[4,this.getCaptchaToken(n,t)];case 1:return r=i.sent(),e.indexOf(`?`)>0?e+=`&captcha_token=${r}`:e+=`?captcha_token=${r}`,[2,e]}})})},e.prototype.saveCaptchaToken=function(e){return Ke(this,void 0,void 0,function(){var t;return qe(this,function(n){switch(n.label){case 0:return e.expires_at=new Date(Date.now()+1e3*(e.expires_in-10)),t=JSON.stringify(e),[4,this.config.storage.setItem(this.tokenSectionName,t)];case 1:return n.sent(),[2]}})})},e.prototype.findCaptchaToken=function(){return Ke(this,void 0,Promise,function(){var e,t;return qe(this,function(n){switch(n.label){case 0:return[4,this.config.storage.getItem(this.tokenSectionName)];case 1:if((e=n.sent())==null)return[3,5];n.label=2;case 2:return n.trys.push([2,3,,5]),(t=JSON.parse(e))!=null&&t.expires_at&&(t.expires_at=new Date(t.expires_at)),t.expires_at<new Date?[2,null]:[2,t.captcha_token];case 3:return n.sent(),[4,this.config.storage.removeItem(this.tokenSectionName)];case 4:return n.sent(),[2,null];case 5:return[2,null]}})})},e}();let Ye=function(){function e(e){if(this.params={},typeof e==`string`)this.parse(e);else if(e&&typeof e==`object`)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.append(t,e[t])}return e.prototype.parse=function(e){var t=this;e.split(`&`).forEach(function(e){var n=e.split(`=`).map(decodeURIComponent),r=n[0],i=n[1];t.append(r,i)})},e.prototype.append=function(e,t){this.params[e]?this.params[e]=this.params[e].concat([t]):this.params[e]=[t]},e.prototype.get=function(e){return this.params[e]?this.params[e][0]:null},e.prototype.getAll=function(e){return this.params[e]||[]},e.prototype.delete=function(e){delete this.params[e]},e.prototype.has=function(e){return Object.prototype.hasOwnProperty.call(this.params,e)},e.prototype.set=function(e,t){this.params[e]=[t]},e.prototype.toString=function(){var e=[],t=function(t){Object.prototype.hasOwnProperty.call(n.params,t)&&n.params[t].forEach(function(n){e.push(`${encodeURIComponent(t)}=${encodeURIComponent(n)}`)})},n=this;for(var r in this.params)t(r);return e.join(`&`)},e}();var F,Xe=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(e){e.PROVIDER_NOT_ENABLED=`PROVIDER_NOT_ENABLED`,e.INVALID_CREDENTIALS=`INVALID_CREDENTIALS`,e.USER_NOT_FOUND=`USER_NOT_FOUND`,e.USER_STATUS_ABNORMAL=`USER_STATUS_ABNORMAL`,e.SERVICE_ERROR=`SERVICE_ERROR`,e.INVALID_PARAMS=`INVALID_PARAMS`,e.AUTH_METHOD_MISMATCH=`AUTH_METHOD_MISMATCH`,e.RATE_LIMITED=`RATE_LIMITED`,e.CAPTCHA_REQUIRED=`CAPTCHA_REQUIRED`,e.CAPTCHA_INVALID=`CAPTCHA_INVALID`,e.MFA_REQUIRED=`MFA_REQUIRED`,e.PRECONDITION_FAILED=`PRECONDITION_FAILED`,e.VERIFICATION_FAILED=`VERIFICATION_FAILED`,e.UNKNOWN=`UNKNOWN`})(F||={});var Ze=`https://tcb.cloud.tencent.com/dev?envId=#/identity/login-manage`,Qe=`https://docs.cloudbase.net/api-reference/webv3/initialization`;function $e(e,t){var n=t?.method||`signIn`,r={signInWithPassword:`「用户名密码登录」`,signInAnonymously:`「匿名登录」`,signInWithOtp:`「短信验证码登录」或「邮箱验证码登录」`,signUp:`「短信验证码登录」或「邮箱验证码登录」`,signInWithOAuth:`对应的第三方身份源`,signInWithIdToken:`对应的第三方身份源`,signInWithOpenId:`「微信小程序 OpenID 登录」`,signInWithPhoneAuth:`「微信小程序手机号授权登录」`,signInWithCustomTicket:`「自定义登录」`,getVerification:`「短信验证码登录」或「邮箱验证码登录」`,verify:`「短信验证码登录」或「邮箱验证码登录」`,verifyOtp:`「短信验证码登录」或「邮箱验证码登录」`,resetPasswordForEmail:`「邮箱验证码登录」`,reauthenticate:`「短信验证码登录」或「邮箱验证码登录」`}[n]||`对应的登录方式`;switch(e){case F.PROVIDER_NOT_ENABLED:return`[CloudBase Auth] 登录方式未开启
|
|
14
|
+
`),n=t.findIndex(function(e){return c.test(e)});if(n!==-1){var r=l.exec(t[n+1]||``);e=r?r[0]:``}return e}();s.value=n===`sync`?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=u({err:Error(),className:p,methodName:h,sourceLink:_});try{return g.apply(this,e)}catch(e){var r=e,i=e.message,o=e.error,s=e.error_description,c={title:f||`${p}.${h} failed`,content:[{type:`error`,body:e}]};if(i&&/^\{.*\}$/.test(i)){var l=JSON.parse(i);c.subtitle=i,l.code&&(n?(n.code=l.code,n.msg=l.msg):(e.code=l.code,e.message=l.msg),r=n||e,c.content=m.map(function(e){return{type:`info`,body:e}}))}throw o&&s&&(c.subtitle=s,n?(n.code=o,n.msg=s):(e.code=o,e.message=s),r=n||e,c.content=m.map(function(e){return{type:`info`,body:e}})),(0,a.printGroupLog)(c),r}}:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return r(this,void 0,void 0,function(){var t,n,r,o,s,c,l,d;return i(this,function(i){switch(i.label){case 0:t=u({err:Error(),className:p,methodName:h,sourceLink:_}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,g.apply(this,e)];case 2:return[2,i.sent()];case 3:throw n=i.sent(),r=n,o=n.message,s=n.error,c=n.error_description,l={title:f||`${p}.${h} failed`,content:[{type:`error`,body:n}]},o&&/^\{.*\}$/.test(o)&&(d=JSON.parse(o),l.subtitle=d,d.code&&(t?(t.code=d.code,t.message=d.msg):(n.code=d.code,n.message=d.msg),r=t||n,l.content=m.map(function(e){return{type:`info`,body:e}}))),s&&c&&(l.subtitle=c,t?(t.code=s,t.msg=c):(n.code=s,n.message=c),r=t||n,l.content=m.map(function(e){return{type:`info`,body:e}})),(0,a.printGroupLog)(l),r;case 4:return[2]}})})}}}}},141:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!(`get`in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)n==="default"||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(718),t)},197:function(e,t,n){var r,i=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);function n(){this.constructor=e}r(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}),a=this&&this.__awaiter||function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.CloudbaseCache=void 0;var s=n(149),c=n(616),l=n(794),u=function(e){function t(t){var n=e.call(this)||this;return n.root=t,t.tcbCacheObject||={},n}return i(t,e),t.prototype.setItem=function(e,t){this.root.tcbCacheObject[e]=t},t.prototype.getItem=function(e){return this.root.tcbCacheObject[e]},t.prototype.removeItem=function(e){delete this.root.tcbCacheObject[e]},t.prototype.clear=function(){delete this.root.tcbCacheObject},t}(s.AbstractStorage);t.CloudbaseCache=function(){function e(e){this.keys={};var t=e.persistence,n=e.platformInfo,r=n===void 0?{}:n,i=e.keys,a=i===void 0?{}:i;this.platformInfo=r,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||t,this.storage=function(e,t){switch(e){case`local`:default:return t.localStorage?t.localStorage:((0,c.printWarn)(l.ERRORS.INVALID_PARAMS,`localStorage is not supported on current platform`),new u(t.root));case`none`:return new u(t.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=a)}return Object.defineProperty(e.prototype,"mode",{get:function(){return this.storage.mode||`sync`},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),e.prototype.setStore=function(e,t,n){if(this.mode!==`async`){if(this.storage)try{var r={version:n||`localCachev1`,content:t};this.storage.setItem(e,JSON.stringify(r))}catch(e){throw Error(JSON.stringify({code:l.ERRORS.OPERATION_FAIL,msg:`[${(0,l.getSdkName)()}][${l.ERRORS.OPERATION_FAIL}]setStore failed`,info:e}))}}else(0,c.printWarn)(l.ERRORS.INVALID_OPERATION,`current platform's storage is asynchronous, please use setStoreAsync insteed`)},e.prototype.setStoreAsync=function(e,t,n){return a(this,void 0,void 0,function(){var r;return o(this,function(i){switch(i.label){case 0:if(!this.storage)return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),r={version:n||`localCachev1`,content:t},[4,this.storage.setItem(e,JSON.stringify(r))];case 2:return i.sent(),[3,4];case 3:return i.sent(),[2];case 4:return[2]}})})},e.prototype.getStore=function(e,t){if(this.mode!==`async`){try{if(typeof process<`u`&&{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token)return{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token;if(!this.storage)return``}catch{return``}t||=`localCachev1`;var n=this.storage.getItem(e);return n&&n.indexOf(t)>=0?JSON.parse(n).content:``}(0,c.printWarn)(l.ERRORS.INVALID_OPERATION,`current platform's storage is asynchronous, please use getStoreAsync insteed`)},e.prototype.getStoreAsync=function(e,t){return a(this,void 0,void 0,function(){var n;return o(this,function(r){switch(r.label){case 0:try{if(typeof process<`u`&&{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token)return[2,{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token];if(!this.storage)return[2,``]}catch{return[2,``]}return t||=`localCachev1`,[4,this.storage.getItem(e)];case 1:return(n=r.sent())&&n.indexOf(t)>=0?[2,JSON.parse(n).content]:[2,``]}})})},e.prototype.removeStore=function(e){this.mode===`async`?(0,c.printWarn)(l.ERRORS.INVALID_OPERATION,`current platform's storage is asynchronous, please use removeStoreAsync insteed`):this.storage.removeItem(e)},e.prototype.removeStoreAsync=function(e){return a(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}})})},e}()},689:function(e,t,n){var r,i=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);function n(){this.constructor=e}r(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}),a=this&&this.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||=Array.prototype.slice.call(t,0,i),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.removeEventListener=t.activateEvent=t.addEventListener=t.CloudbaseEventEmitter=t.IErrorEvent=t.CloudbaseEvent=void 0;var o=n(616),s=function(e,t){this.data=t||null,this.name=e};t.CloudbaseEvent=s;var c=function(e){function t(t,n){var r=e.call(this,`error`,{error:t,data:n})||this;return r.error=t,r}return i(t,e),t}(s);t.IErrorEvent=c;var l=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){return function(e,t,n){n[e]=n[e]||[],n[e].push(t)}(e,t,this.listeners),this},e.prototype.off=function(e,t){return function(e,t,n){if(n?.[e]){var r=n[e].indexOf(t);r!==-1&&n[e].splice(r,1)}}(e,t,this.listeners),this},e.prototype.fire=function(e,t){if((0,o.isInstanceOf)(e,c))return console.error(e.error),this;var n=(0,o.isString)(e)?new s(e,t||{}):e,r=n.name;if(this.listens(r)){n.target=this;for(var i=0,l=this.listeners[r]?a([],this.listeners[r],!0):[];i<l.length;i++)l[i].call(this,n)}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}();t.CloudbaseEventEmitter=l;var u=new l;t.addEventListener=function(e,t){u.on(e,t)},t.activateEvent=function(e,t){t===void 0&&(t={}),u.fire(e,t)},t.removeEventListener=function(e,t){u.off(e,t)}},616:function(e,t,n){var r,i=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);function n(){this.constructor=e}r(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}),a=this&&this.__assign||function(){return a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},a.apply(this,arguments)},o=this&&this.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};Object.defineProperty(t,"__esModule",{value:!0}),t.parseCaptcha=t.parseQueryString=t.transformPhone=t.sleep=t.printGroupLog=t.errorToResult=t.promoteGatewayError=t.maybeThrow=t.resolveThrow=t.createCloudbaseError=t.CloudbaseError=t.throwError=t.printInfo=t.printError=t.printWarn=t.execCallback=t.createPromiseCallback=t.removeParam=t.getHash=t.getQuery=t.toQueryString=t.formatUrl=t.generateRequestId=t.genSeqId=t.isFormData=t.isInstanceOf=t.isNull=t.isPalinObject=t.isUndefined=t.isString=t.isArray=void 0;var s=n(794);t.isArray=function(e){return Object.prototype.toString.call(e)===`[object Array]`},t.isString=function(e){return typeof e==`string`},t.isUndefined=function(e){return e===void 0},t.isPalinObject=function(e){return Object.prototype.toString.call(e)===`[object Object]`},t.isNull=function(e){return Object.prototype.toString.call(e)===`[object Null]`},t.isInstanceOf=function(e,t){return e instanceof t},t.isFormData=function(e){return Object.prototype.toString.call(e)===`[object FormData]`},t.genSeqId=function(){return Math.random().toString(16).slice(2)},t.generateRequestId=function(){var e=new Date().getTime(),t=(Date==null?void 0:Date.now)&&1e3*Date.now()||0;return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,function(n){var r=16*Math.random();return e>0?(r=(e+r)%16|0,e=Math.floor(e/16)):(r=(t+r)%16|0,t=Math.floor(t/16)),(n===`x`?r:7&r|8).toString(16)})},t.formatUrl=function(e,t,n){n===void 0&&(n={});var r=/\?/.test(t),i=``;return Object.keys(n).forEach(function(e){i===``?!r&&(t+=`?`):i+=`&`,i+=`${e}=${encodeURIComponent(n[e])}`}),/^http(s)?:\/\//.test(t+=i)?t:`${e}${t}`},t.toQueryString=function(e){e===void 0&&(e={});var t=[];return Object.keys(e).forEach(function(n){t.push(`${n}=${encodeURIComponent(e[n])}`)}),t.join(`&`)},t.getQuery=function(e,t){if(typeof window>`u`)return!1;var n=t||decodeURIComponent(window.location.search),r=RegExp(`(^|&)${e}=([^&]*)(&|\$)`),i=n.substr(n.indexOf(`?`)+1).match(r);return i==null?``:i[2]},t.getHash=function(e){if(typeof window>`u`)return``;var t=window.location.hash.match(RegExp(`[#?&/]${e}=([^&#]*)`));return t?t[1]:``},t.removeParam=function(e,t){var n=t.split(`?`)[0],r=[],i=t.indexOf(`?`)===-1?``:t.split(`?`)[1];if(i!==``){for(var a=(r=i.split(`&`)).length-1;a>=0;--a)r[a].split(`=`)[0]===e&&r.splice(a,1);n=`${n}?${r.join(`&`)}`}return n},t.createPromiseCallback=function(){var e={};if(!Promise){(e=function(){}).promise={};var t=function(){throw Error(`Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.`)};return Object.defineProperty(e.promise,"then",{get:t}),Object.defineProperty(e.promise,"catch",{get:t}),e}var n=new Promise(function(t,n){e=function(e,r){return e?n(e):t(r)}});return e.promise=n,e},t.execCallback=function(e,t,n){if(n===void 0&&(n=null),e&&typeof e==`function`)return e(t,n);if(t)throw t;return n},t.printWarn=function(e,t){console.warn(`[${(0,s.getSdkName)()}][${e}]:${t}`)},t.printError=function(e,t){console.error({code:e,msg:`[${(0,s.getSdkName)()}][${e}]:${t}`})},t.printInfo=function(e,t){console.log(`[${(0,s.getSdkName)()}][${e}]:${t}`)},t.throwError=function(e,t){var n=Error(JSON.stringify({code:e,msg:`[${(0,s.getSdkName)()}][${e}]:${t}`}));throw n.code=e,n};var c=function(e){function t(t){var n=e.call(this,t.msg||t.message||``)||this;return n.code=t.code||``,n.requestId=t.requestId||``,Object.defineProperty(n,"message",{value:t.msg||t.message||``,enumerable:!0,writable:!0,configurable:!0}),n}return i(t,e),t}(Error);t.CloudbaseError=c;var l=function(e){return new c(e)};function u(e,t){return(t||l)(e)}function d(e){return!e||typeof e.throw!=`boolean`||e.throw}t.createCloudbaseError=u,t.resolveThrow=d,t.maybeThrow=function(e,t){if(d(e))throw u(a(a({},t),{msg:t.message}),e?.errorFactory);return a({code:t.code,message:t.message},t.requestId?{requestId:t.requestId}:{})},t.promoteGatewayError=function(e){if(e&&typeof e==`object`&&e.data&&typeof e.data==`object`){var t=e.data,n=t.code,r=t.message;if(!e.code&&n||!e.message&&r)return a(a(a({},e),!e.code&&n?{code:n}:{}),!e.message&&r?{message:r}:{})}return e},t.errorToResult=function(e){if(e instanceof Error&&typeof e.message==`string`)try{var t=JSON.parse(e.message);if(t&&typeof t.code==`string`)return{code:t.code,message:t.msg||t.message||``,requestId:t.requestId}}catch{}return e&&typeof e.code==`string`?{code:e.code,message:e.message||``,requestId:e.requestId}:{code:`UNKNOWN_ERROR`,message:String(e?.message||e||``)}},t.printGroupLog=function(e){var t,n=e.title,r=e.subtitle,i=r===void 0?``:r,a=e.content,o=a===void 0?[]:a,s=e.printTrace,c=s!==void 0&&s,l=e.collapsed;l!==void 0&&l?(console.groupCollapsed||console.error)(n,i):(console.group||console.error)(n,i);for(var u=0,d=o;u<d.length;u++){var f=d[u],p=f.type,m=f.body;switch(p){case`info`:console.log(m);break;case`warn`:console.warn(m);break;case`error`:console.error(m)}}c&&(console.trace||console.log)(`stack trace:`),(t=console.groupEnd)==null||t.call(console)},t.sleep=function(e){return e===void 0&&(e=0),new Promise(function(t){return setTimeout(t,e)})},t.transformPhone=function(e){return`+86${e}`},t.parseQueryString=function(e){e=e.replace(/^\?/,``);var t={};return e.split(`&`).forEach(function(e){var n=e.split(`=`),r=n[0],i=n[1];r=decodeURIComponent(r),i=decodeURIComponent(i),r&&(t[r]?Array.isArray(t[r])?t[r].push(i):t[r]=[t[r],i]:t[r]=i)}),t},t.parseCaptcha=function(e){var n={},r=e.match(/^(data:.*?)(\?[^#\s]*)?$/);if(r){e=r[1];var i=r[2];i&&(n=(0,t.parseQueryString)(i))}var a=n.token,s=o(n,[`token`]);return/^data:/.test(e)&&!a?{error:`invalid_argument`,error_description:`invalid captcha data: ${e}`}:a?{state:s.state,token:a,captchaData:e}:{error:`unimplemented`,error_description:`need to impl captcha data`}}},149:e=>{e.exports=h}},ro={};function io(e){var t=ro[e];if(t!==void 0)return t.exports;var n=ro[e]={exports:{}};return no[e].call(n.exports,n,n.exports,io),n.exports}io.d=(e,t)=>{for(var n in t)io.o(t,n)&&!io.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},io.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),io.r=e=>{typeof Symbol<`u`&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:`Module`}),Object.defineProperty(e,"__esModule",{value:!0})};var ao={};(()=>{io.d(ao,{W:()=>Rt});var e={};io.r(e);var t,n,r,i,a,o,s=`/auth`;(function(e){e.AUTH_SIGN_UP_URL=`/v1/signup`,e.AUTH_TOKEN_URL=`/v1/token`,e.AUTH_REVOKE_URL=`/v1/revoke`,e.WEDA_USER_URL=`/v1/plugin/weda/userinfo`,e.AUTH_RESET_PASSWORD=`/v1/reset`,e.AUTH_GET_DEVICE_CODE=`/v1/device/code`,e.CHECK_USERNAME=`/v1/checkUsername`,e.CHECK_IF_USER_EXIST=`/v1/checkIfUserExist`,e.GET_PROVIDER_TYPE=`/v1/mgr/provider/providerSubType`,e.AUTH_SIGN_IN_URL=`/v1/signin`,e.AUTH_SIGN_IN_ANONYMOUSLY_URL=`/v1/signin/anonymously`,e.AUTH_SIGN_IN_WITH_PROVIDER_URL=`/v1/signin/with/provider`,e.AUTH_SIGN_IN_WITH_WECHAT_URL=`/v1/signin/wechat/noauth`,e.AUTH_SIGN_IN_CUSTOM=`/v1/signin/custom`,e.PROVIDER_TOKEN_URL=`/v1/provider/token`,e.PROVIDER_URI_URL=`/v1/provider/uri`,e.USER_ME_URL=`/v1/user/me`,e.AUTH_SIGNOUT_URL=`/v1/user/signout`,e.USER_QUERY_URL=`/v1/user/query`,e.USER_PRIFILE_URL=`/v1/user/profile`,e.USER_BASIC_EDIT_URL=`/v1/user/basic/edit`,e.USER_TRANS_BY_PROVIDER_URL=`/v1/user/trans/by/provider`,e.PROVIDER_LIST=`/v1/user/provider`,e.PROVIDER_BIND_URL=`/v1/user/provider/bind`,e.PROVIDER_UNBIND_URL=`/v1/user/provider`,e.CHECK_PWD_URL=`/v1/user/sudo`,e.SUDO_URL=`/v1/user/sudo`,e.BIND_CONTACT_URL=`/v1/user/contact`,e.AUTH_SET_PASSWORD=`/v1/user/password`,e.AUTHORIZE_DEVICE_URL=`/v1/user/device/authorize`,e.AUTHORIZE_URL=`/v1/user/authorize`,e.AUTHORIZE_INFO_URL=`/v1/user/authorize/info`,e.AUTHORIZED_DEVICES_DELETE_URL=`/v1/user/authorized/devices/`,e.AUTH_REVOKE_ALL_URL=`/v1/user/revoke/all`,e.GET_USER_BEHAVIOR_LOG=`/v1/user/security/history`,e.VERIFICATION_URL=`/v1/verification`,e.VERIFY_URL=`/v1/verification/verify`,e.CAPTCHA_DATA_URL=`/v1/captcha/data`,e.VERIFY_CAPTCHA_DATA_URL=`/v1/captcha/data/verify`,e.GET_CAPTCHA_URL=`/v1/captcha/init`,e.GET_MINIPROGRAM_QRCODE=`/v1/qrcode/generate`,e.GET_MINIPROGRAM_QRCODE_STATUS=`/v1/qrcode/get/status`})(t||={}),function(e){e.AUTH_SIGN_IN_URL=`/v2/signin/username`,e.AUTH_TOKEN_URL=`/v2/token`,e.USER_ME_URL=`/v2/user/me`,e.VERIFY_URL=`/v2/signin/verificationcode`,e.AUTH_SIGN_IN_WITH_PROVIDER_URL=`/v2/signin/with/provider`,e.AUTH_PUBLIC_KEY=`/v2/signin/publichkey`,e.AUTH_RESET_PASSWORD=`/v2/signin/password/update`}(n||={}),function(e){e.REGISTER=`REGISTER`,e.SIGN_IN=`SIGN_IN`,e.PASSWORD_RESET=`PASSWORD_RESET`,e.EMAIL_ADDRESS_CHANGE=`EMAIL_ADDRESS_CHANGE`,e.PHONE_NUMBER_CHANGE=`PHONE_NUMBER_CHANGE`}(r||={}),(o=i||={}).UNREACHABLE=`unreachable`,o.LOCAL=`local`,o.CANCELLED=`cancelled`,o.UNKNOWN=`unknown`,o.UNAUTHENTICATED=`unauthenticated`,o.RESOURCE_EXHAUSTED=`resource_exhausted`,o.FAILED_PRECONDITION=`failed_precondition`,o.INVALID_ARGUMENT=`invalid_argument`,o.DEADLINE_EXCEEDED=`deadline_exceeded`,o.NOT_FOUND=`not_found`,o.ALREADY_EXISTS=`already_exists`,o.PERMISSION_DENIED=`permission_denied`,o.ABORTED=`aborted`,o.OUT_OF_RANGE=`out_of_range`,o.UNIMPLEMENTED=`unimplemented`,o.INTERNAL=`internal`,o.UNAVAILABLE=`unavailable`,o.DATA_LOSS=`data_loss`,o.INVALID_PASSWORD=`invalid_password`,o.PASSWORD_NOT_SET=`password_not_set`,o.INVALID_STATUS=`invalid_status`,o.USER_PENDING=`user_pending`,o.USER_BLOCKED=`user_blocked`,o.INVALID_VERIFICATION_CODE=`invalid_verification_code`,o.TWO_FACTOR_REQUIRED=`two_factor_required`,o.INVALID_TWO_FACTOR=`invalid_two_factor`,o.INVALID_TWO_FACTOR_RECOVERY=`invalid_two_factor_recovery`,o.UNDER_REVIEW=`under_review`,o.INVALID_REQUEST=`invalid_request`,o.UNAUTHORIZED_CLIENT=`unauthorized_client`,o.ACCESS_DENIED=`access_denied`,o.UNSUPPORTED_RESPONSE_TYPE=`unsupported_response_type`,o.INVALID_SCOPE=`invalid_scope`,o.INVALID_GRANT=`invalid_grant`,o.SERVER_ERROR=`server_error`,o.TEMPORARILY_UNAVAILABLE=`temporarily_unavailable`,o.INTERACTION_REQUIRED=`interaction_required`,o.LOGIN_REQUIRED=`login_required`,o.ACCOUNT_SELECTION_REQUIRED=`account_selection_required`,o.CONSENT_REQUIRED=`consent_required`,o.INVALID_REQUEST_URI=`invalid_request_uri`,o.INVALID_REQUEST_OBJECT=`invalid_request_object`,o.REQUEST_NOT_SUPPORTED=`request_not_supported`,o.REQUEST_URI_NOT_SUPPORTED=`request_uri_not_supported`,o.REGISTRATION_NOT_SUPPORTED=`registration_not_supported`,o.CAPTCHA_REQUIRED=`captcha_required`,o.CAPTCHA_INVALID=`captcha_invalid`,o.PROVIDER_NOT_ENABLED=`provider_not_enabled`,o.LOGIN_METHOD_DISABLED=`login_method_disabled`,o.INVALID_USERNAME_OR_PASSWORD=`invalid_username_or_password`,o.INVALID_CREDENTIALS=`invalid_credentials`,o.WRONG_PASSWORD=`wrong_password`,o.USER_NOT_FOUND=`user_not_found`,o.MFA_PHONE_REQUIRED=`mfa_phone_required`,o.LOGIN_TYPE_DISABLED=`login_type_disabled`,o.PROVIDER_ERROR=`provider_error`,o.MISSING_REQUIRED_PARAM=`missing_required_param`,function(e){e[e.INVALID_ARGUMENT=3]=`INVALID_ARGUMENT`,e[e.NOT_FOUND=5]=`NOT_FOUND`,e[e.PERMISSION_DENIED=7]=`PERMISSION_DENIED`,e[e.RESOURCE_EXHAUSTED=8]=`RESOURCE_EXHAUSTED`,e[e.FAILED_PRECONDITION=9]=`FAILED_PRECONDITION`,e[e.ABORTED=10]=`ABORTED`,e[e.UNIMPLEMENTED=12]=`UNIMPLEMENTED`,e[e.INTERNAL=13]=`INTERNAL`,e[e.UNAVAILABLE=14]=`UNAVAILABLE`,e[e.UNAUTHENTICATED=16]=`UNAUTHENTICATED`,e[e.MISSING_REQUIRED_PARAM=4e3]=`MISSING_REQUIRED_PARAM`,e[e.CAPTCHA_REQUIRED=4001]=`CAPTCHA_REQUIRED`,e[e.CAPTCHA_INVALID=4002]=`CAPTCHA_INVALID`,e[e.PROVIDER_ERROR=4019]=`PROVIDER_ERROR`,e[e.UNAUTHORIZED_CLIENT=4022]=`UNAUTHORIZED_CLIENT`,e[e.MFA_PHONE_REQUIRED=4042]=`MFA_PHONE_REQUIRED`,e[e.LOGIN_TYPE_DISABLED=4045]=`LOGIN_TYPE_DISABLED`}(a||={});var c,l,u=`credentials_error`,d=`SIGNED_OUT`,f=`SIGNED_IN`,p=`INITIAL_SESSION`,m=`TOKEN_REFRESHED`,h=`USER_UPDATED`,g=`BIND_IDENTITY`,_=`loginStateChanged`,v=`authStateChanged`,y=`sign_in`,x=`bind_identity`,S=`node-sdk-scope`;function C(){return`xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx`.replace(/[xy]/g,function(e){var t=16*Math.random()|0;return(e===`x`?t:3&t|8).toString(16)})}(function(e){e.EMAIL=`email`,e.RECOVERY=`recovery`,e.REAUTHENTICATION=`reauthentication`})(c||={}),function(e){e.CLIENT_ID=`client_id`,e.CLIENT_SECRET=`client_secret`,e.RESPONSE_TYPE=`response_type`,e.SCOPE=`scope`,e.STATE=`state`,e.REDIRECT_URI=`redirect_uri`,e.ERROR=`error`,e.ERROR_DESCRIPTION=`error_description`,e.ERROR_URI=`error_uri`,e.GRANT_TYPE=`grant_type`,e.CODE=`code`,e.ACCESS_TOKEN=`access_token`,e.TOKEN_TYPE=`token_type`,e.EXPIRES_IN=`expires_in`,e.USERNAME=`username`,e.PASSWORD=`password`,e.REFRESH_TOKEN=`refresh_token`}(l||={});var w=io(631),T=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},E=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},D=new Map,ee=function(){function e(e){this.clientId=e?.clientId||``,this.getScope=e?.getScope,D||=new Map}return e.prototype.run=function(e,t){return T(this,void 0,Promise,function(){var n,r,i=this;return E(this,function(a){return n=this.getScope?this.getScope():this.clientId,e=`${n}_${e}`,(r=D.get(e))||(r=new Promise(function(n,r){T(i,void 0,void 0,function(){var i,a,o;return E(this,function(s){switch(s.label){case 0:return s.trys.push([0,3,4,5]),[4,this.runIdlePromise()];case 1:return s.sent(),i=t(),a=n,[4,i];case 2:return a.apply(void 0,[s.sent()]),[3,5];case 3:return o=s.sent(),r(o),[3,5];case 4:return D.delete(e),[7];case 5:return[2]}})})}),D.set(e,r)),[2,r]})})},e.prototype.runIdlePromise=function(){return Promise.resolve()},e}(),te=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`,O=/^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/,k=function(e){if(e=String(e).replace(/[\t\n\f\r ]+/g,``),!O.test(e))throw TypeError(`Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.`);var t;e+=`==`.slice(2-(3&e.length));for(var n,r,i=``,a=0;a<e.length;)t=te.indexOf(e.charAt(a++))<<18|te.indexOf(e.charAt(a++))<<12|(n=te.indexOf(e.charAt(a++)))<<6|(r=te.indexOf(e.charAt(a++))),i+=n===64?String.fromCharCode(t>>16&255):r===64?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,255&t);return i};function A(){if(typeof globalThis>`u`)return!1;var e=globalThis.wx;if(e===void 0||globalThis.Page===void 0||!e.getDeviceInfo||!e.getStorageSync||!e.setStorageSync||!e.connectSocket||!e.request)return!1;try{if(!e.getDeviceInfo()||e.getDeviceInfo().platform===`qq`)return!1}catch{return!1}return!0}var ne=!1;function re(){ne||=window.__wxjs_environment===`miniprogram`}try{A()||(ne=ne||!!navigator.userAgent.match(/miniprogram/i)||window.__wxjs_environment===`miniprogram`,window&&window.WeixinJSBridge&&window.WeixinJSBridge.invoke?re():typeof document<`u`&&document.addEventListener(`WeixinJSBridgeReady`,re,!1))}catch{}var ie,ae,oe=`INVALID_OPERATION`,se=`OPERATION_FAIL`,ce=io(149),le=(ie=function(e,t){return ie=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},ie(e,t)},function(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);function n(){this.constructor=e}ie(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)});function ue(e,t){if(typeof window>`u`)return!1;var n=t||decodeURIComponent(window.location.search),r=RegExp(`(^|&)${e}=([^&]*)(&|\$)`),i=n.substr(n.indexOf(`?`)+1).match(r);return i==null?``:i[2]}function de(e,t){console.warn(`[@cloudbase/js-sdk][${e}]:${t}`)}ae=Error,le(function(e){var t=ae.call(this,e.msg||e.message||``)||this;return t.code=e.code||``,t.requestId=e.requestId||``,Object.defineProperty(t,"message",{value:e.msg||e.message||``,enumerable:!0,writable:!0,configurable:!0}),t},ae);var fe,pe=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),me=function(){return me=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},me.apply(this,arguments)},he=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},ge=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};(function(e){function t(t){var n=e.call(this)||this,r=t.timeout,i=t.timeoutMsg,a=t.restrictedMethods;return n.timeout=r||0,n.timeoutMsg=i||`请求超时`,n.restrictedMethods=a||[`get`,`post`,`upload`,`download`],n}pe(t,e),t.prototype.get=function(e){return this.request(me(me({},e),{method:`get`}),this.restrictedMethods.includes(`get`))},t.prototype.post=function(e){return this.request(me(me({},e),{method:`post`}),this.restrictedMethods.includes(`post`))},t.prototype.put=function(e){return this.request(me(me({},e),{method:`put`}))},t.prototype.upload=function(e){var t=e.data,n=e.file,r=e.name,i=e.method,a=e.headers,o=a===void 0?{}:a,s={post:`post`,put:`put`}[i?.toLowerCase()]||`put`,c=new FormData;return s===`post`?(Object.keys(t).forEach(function(e){c.append(e,t[e])}),c.append(`key`,r),c.append(`file`,n),this.request(me(me({},e),{data:c,method:s}),this.restrictedMethods.includes(`upload`))):this.request(me(me({},e),{method:`put`,headers:o,body:n}),this.restrictedMethods.includes(`upload`))},t.prototype.download=function(e){return he(this,void 0,Promise,function(){var t,n,r,i;return ge(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.get(me(me({},e),{headers:{},responseType:`blob`}))];case 1:return t=a.sent().data,n=window.URL.createObjectURL(new Blob([t])),r=decodeURIComponent(new URL(e.url).pathname.split(`/`).pop()||``),(i=document.createElement(`a`)).href=n,i.setAttribute(`download`,r),i.style.display=`none`,document.body.appendChild(i),i.click(),window.URL.revokeObjectURL(n),document.body.removeChild(i),[3,3];case 2:return a.sent(),[3,3];case 3:return[2,new Promise(function(t){t({statusCode:200,tempFilePath:e.url})})]}})})},t.prototype.fetch=function(e){return he(this,void 0,Promise,function(){var t,n,r,i,a,o,s,c,l,u,d,f,p,m=this;return ge(this,function(h){switch(h.label){case 0:return t=new AbortController,n=e.url,r=e.enableAbort,i=r!==void 0&&r,a=e.stream,o=a!==void 0&&a,s=e.signal,c=e.timeout,l=e.shouldThrowOnError,u=l===void 0||l,d=c??this.timeout,s&&(s.aborted&&t.abort(),s.addEventListener(`abort`,function(){return t.abort()})),f=null,i&&d&&(f=setTimeout(function(){console.warn(m.timeoutMsg),t.abort(Error(m.timeoutMsg))},d)),[4,fetch(n,me(me({},e),{signal:t.signal})).then(function(e){return he(m,void 0,void 0,function(){var t,n,r;return ge(this,function(i){switch(i.label){case 0:return clearTimeout(f),u?e.ok?(t=e,[3,3]):[3,1]:[3,4];case 1:return r=(n=Promise).reject,[4,e.json()];case 2:t=r.apply(n,[i.sent()]),i.label=3;case 3:return[2,t];case 4:return[2,e]}})})}).catch(function(e){return clearTimeout(f),Promise.reject(e)})];case 1:return p=h.sent(),[2,{data:o?p.body:p.headers.get(`content-type`)?.includes(`application/json`)?p.json():p.text(),statusCode:p.status,header:p.headers,response:p}]}})})},t.prototype.request=function(e,t){var n=this;t===void 0&&(t=!1);var r=String(e.method).toLowerCase()||`get`;return new Promise(function(i){var a=e.url,o=e.headers,s=o===void 0?{}:o,c=e.data,l=e.responseType,u=e.withCredentials,d=e.body,f=e.onUploadProgress,p=function(e,t,n){n===void 0&&(n={});var r=/\?/.test(t),i=``;return Object.keys(n).forEach(function(e){i===``?!r&&(t+=`?`):i+=`&`,i+=`${e}=${encodeURIComponent(n[e])}`}),/^http(s)?:\/\//.test(t+=i)?t:`${e}${t}`}(`https:`,a,r===`get`?c:{}),m=new XMLHttpRequest;m.open(r,p),l&&(m.responseType=l);var h,g,_,v=e.signal;v&&(v.aborted?m.abort():v.addEventListener(`abort`,function(){return m.abort()},{once:!0})),Object.keys(s).forEach(function(e){m.setRequestHeader(e,s[e])}),f&&m.upload.addEventListener(`progress`,f),m.onreadystatechange=function(){var e={};if(m.readyState===4){var t=m.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};t.forEach(function(e){var t=e.split(`: `),r=t.shift().toLowerCase();n[r]=t.join(`: `)}),e.header=n,e.statusCode=m.status;try{e.data=l===`blob`?m.response:JSON.parse(m.responseText)}catch{e.data=l===`blob`?m.response:m.responseText}clearTimeout(h),i(e)}},t&&n.timeout&&(h=setTimeout(function(){console.warn(n.timeoutMsg),m.abort()},n.timeout)),_=c,g=Object.prototype.toString.call(_)===`[object FormData]`?c:s[`content-type`]===`application/x-www-form-urlencoded`?function(e){e===void 0&&(e={});var t=[];return Object.keys(e).forEach(function(n){t.push(`${n}=${encodeURIComponent(e[n])}`)}),t.join(`&`)}(c):d||(c?JSON.stringify(c):void 0),u&&(m.withCredentials=!0),m.send(g)})}})(ce.AbstractSDKRequest),function(e){e.WEB=`web`,e.WX_MP=`wx_mp`}(fe||={});var _e=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),ve=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},j=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},ye=function(e){function t(t){var n=e.call(this)||this;return n.root=t,t.tcbCacheObject||={},n}return _e(t,e),t.prototype.setItem=function(e,t){this.root.tcbCacheObject[e]=t},t.prototype.getItem=function(e){return this.root.tcbCacheObject[e]},t.prototype.removeItem=function(e){delete this.root.tcbCacheObject[e]},t.prototype.clear=function(){delete this.root.tcbCacheObject},t}(ce.AbstractStorage);(function(){function e(e){this.keys={};var t=e.persistence,n=e.platformInfo,r=n===void 0?{}:n,i=e.keys,a=i===void 0?{}:i;this.platformInfo=r,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||t,this.storage=function(e,t){switch(e){case`local`:default:return t.localStorage?t.localStorage:(de(`INVALID_PARAMS`,`localStorage is not supported on current platform`),new ye(t.root));case`none`:return new ye(t.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=a)}Object.defineProperty(e.prototype,"mode",{get:function(){return this.storage.mode||`sync`},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),e.prototype.setStore=function(e,t,n){if(this.mode!==`async`){if(this.storage)try{var r={version:n||`localCachev1`,content:t};this.storage.setItem(e,JSON.stringify(r))}catch(e){throw Error(JSON.stringify({code:se,msg:`[@cloudbase/js-sdk][${se}]setStore failed`,info:e}))}}else de(oe,`current platform's storage is asynchronous, please use setStoreAsync insteed`)},e.prototype.setStoreAsync=function(e,t,n){return ve(this,void 0,void 0,function(){var r;return j(this,function(i){switch(i.label){case 0:if(!this.storage)return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),r={version:n||`localCachev1`,content:t},[4,this.storage.setItem(e,JSON.stringify(r))];case 2:return i.sent(),[3,4];case 3:return i.sent(),[2];case 4:return[2]}})})},e.prototype.getStore=function(e,t){if(this.mode!==`async`){try{if(typeof process<`u`&&{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token)return{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token;if(!this.storage)return``}catch{return``}t||=`localCachev1`;var n=this.storage.getItem(e);return n&&n.indexOf(t)>=0?JSON.parse(n).content:``}de(oe,`current platform's storage is asynchronous, please use getStoreAsync insteed`)},e.prototype.getStoreAsync=function(e,t){return ve(this,void 0,void 0,function(){var n;return j(this,function(r){switch(r.label){case 0:try{if(typeof process<`u`&&{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token)return[2,{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token];if(!this.storage)return[2,``]}catch{return[2,``]}return t||=`localCachev1`,[4,this.storage.getItem(e)];case 1:return(n=r.sent())&&n.indexOf(t)>=0?[2,JSON.parse(n).content]:[2,``]}})})},e.prototype.removeStore=function(e){this.mode===`async`?de(oe,`current platform's storage is asynchronous, please use removeStoreAsync insteed`):this.storage.removeItem(e)},e.prototype.removeStoreAsync=function(e){return ve(this,void 0,void 0,function(){return j(this,function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}})})}})();var be=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),xe=function(e,t){this.data=t||null,this.name=e},Se=function(e){function t(t,n){var r=e.call(this,`error`,{error:t,data:n})||this;return r.error=t,r}return be(t,e),t}(xe),Ce=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){return function(e,t,n){n[e]=n[e]||[],n[e].push(t)}(e,t,this.listeners),this},e.prototype.off=function(e,t){return function(e,t,n){if(n?.[e]){var r=n[e].indexOf(t);r!==-1&&n[e].splice(r,1)}}(e,t,this.listeners),this},e.prototype.fire=function(e,t){if(e instanceof Se)return console.error(e.error),this;var n=typeof e==`string`?new xe(e,t||{}):e,r=n.name;if(this.listens(r)){n.target=this;for(var i=0,a=this.listeners[r]?function(e,t,n){if(n||arguments.length===2)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||=Array.prototype.slice.call(t,0,i),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([],this.listeners[r],!0):[];i<a.length;i++)a[i].call(this,n)}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}();new Ce;var we=new Ce;typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.indexOf(`Firefox`),Te={default:()=>b},M={},io.d(M,Te);var Te,M,Ee=function(){return Ee=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ee.apply(this,arguments)},N=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},P=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},De=function(e,t,n){if(n||arguments.length===2)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||=Array.prototype.slice.call(t,0,i),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))},Oe=`x-request-id`,ke=`x-device-id`,Ae=`device_id`,je=function(e,t){return N(this,void 0,Promise,function(){var n,r,a,o,s;return P(this,function(c){switch(c.label){case 0:n=null,r=null,c.label=1;case 1:return c.trys.push([1,4,,5]),(a=Object.assign({},t)).method||(a.method=`GET`),a.body&&typeof a.body!=`string`&&(a.body=JSON.stringify(a.body)),[4,fetch(e,a)];case 2:return[4,c.sent().json()];case 3:return(o=c.sent())?.error?(r=o).error_uri=new URL(e).pathname:n=o,[3,5];case 4:return s=c.sent(),r={error:i.UNREACHABLE,error_description:s.message,error_uri:new URL(e).pathname},[3,5];case 5:if(r)throw r;return[2,n]}})})},Me=new(function(){function e(e){this._env=e?.env||``}return e.prototype.getItem=function(e){return N(this,void 0,Promise,function(){return P(this,function(t){return[2,window.localStorage.getItem(`${e}${this._env}`)]})})},e.prototype.removeItem=function(e){return N(this,void 0,Promise,function(){return P(this,function(t){return window.localStorage.removeItem(`${e}${this._env}`),[2]})})},e.prototype.setItem=function(e,t){return N(this,void 0,Promise,function(){return P(this,function(n){return window.localStorage.setItem(`${e}${this._env}`,t),[2]})})},e.prototype.getItemSync=function(e){return window.localStorage.getItem(`${e}${this._env}`)},e.prototype.removeItemSync=function(e){window.localStorage.removeItem(`${e}${this._env}`)},e.prototype.setItemSync=function(e,t){window.localStorage.setItem(`${e}${this._env}`,t)},e}()),Ne=function(){function e(e){var t=this;this.credentials=null,this.accessKeyCredentials=null,this.singlePromise=null,this.tokenSectionName=e.tokenSectionName,this.storage=e.storage,this.clientId=e.clientId,this.singlePromise=new ee({clientId:this.clientId,getScope:function(){return t.accessKeyCredentials?.access_token?`${t.clientId}_${t.accessKeyCredentials.access_token}`:t.clientId}}),this.credentials=e.credentials||null,this.onCredentialsChange=e.onCredentialsChange}return e.prototype.syncMemoryCredentials=function(e){this.credentials=e},e.prototype.getMemoryCredentials=function(){return this.credentials},e.prototype.getStorageCredentialsSync=function(){var e=null,t=this.storage.getItemSync(this.tokenSectionName);if(t!=null)try{(e=JSON.parse(t))!=null&&e.expires_at&&(e.expires_at=new Date(e.expires_at))}catch{this.storage.removeItem(this.tokenSectionName),e=null}return e},e.prototype.setCredentials=function(e,t){var n;return N(this,void 0,Promise,function(){var r,i;return P(this,function(a){switch(a.label){case 0:return r=!(!this.credentials||!this.credentials.access_token),e?.expires_in?(e!=null&&e.expires_at||(e.expires_at=new Date(Date.now()+1e3*(e.expires_in-30))),this.storage?(i=JSON.stringify(e),[4,this.storage.setItem(this.tokenSectionName,i)]):[3,2]):[3,3];case 1:a.sent(),a.label=2;case 2:return this.credentials=e,[3,6];case 3:return this.storage?[4,this.storage.removeItem(this.tokenSectionName)]:[3,5];case 4:a.sent(),a.label=5;case 5:this.credentials=null,a.label=6;case 6:return this.onCredentialsChange&&this.onCredentialsChange(e||null,{isInit:(n=t?.isInit)!=null&&n,hadCredentials:r}),[2]}})})},e.prototype.setAccessKeyCredentials=function(e){this.accessKeyCredentials=e,e.scope===S&&(this.credentials=e)},e.prototype.getCredentials=function(){return N(this,void 0,Promise,function(){var e=this;return P(this,function(t){return[2,this.singlePromise.run(`getCredentials`,function(){return N(e,void 0,void 0,function(){var e,t;return P(this,function(n){switch(n.label){case 0:return[4,this.getStorageCredentials()];case 1:return e=n.sent(),t=e.credentials,e.isAccessKeyCredentials?[2,t]:(this.credentials=t,[2,this.credentials])}})})})]})})},e.prototype.getStorageCredentials=function(){return N(this,void 0,Promise,function(){var e=this;return P(this,function(t){return[2,this.singlePromise.run(`_getStorageCredentials`,function(){return N(e,void 0,void 0,function(){var e,t,n;return P(this,function(r){switch(r.label){case 0:return e=null,t=!1,[4,this.storage.getItem(this.tokenSectionName)];case 1:if(!(n=r.sent()))return[3,6];r.label=2;case 2:return r.trys.push([2,3,,5]),(e=JSON.parse(n))!=null&&e.expires_at&&(e.expires_at=new Date(e.expires_at)),[3,5];case 3:return r.sent(),[4,this.storage.removeItem(this.tokenSectionName)];case 4:return r.sent(),e=null,[3,5];case 5:return[3,7];case 6:e=this.accessKeyCredentials||null,t=!0,r.label=7;case 7:return[2,{credentials:e,isAccessKeyCredentials:t}]}})})})]})})},e}(),Pe=function(){function e(t){var n,r=this;this.initializePromise=null,this.lockAcquired=!1,this.pendingInLock=[],this.singlePromise=null,this._initSessionEmitted=!1,t.clientSecret||=``,!t.clientId&&t.env&&(t.clientId=t.env),this.apiOrigin=t.apiOrigin,this.getApiOriginFunc=t.getApiOrigin,this.apiPath=t.apiPath||s,this.clientId=t.clientId,this.i18n=t.i18n,this.eventBus=t.eventBus,this.singlePromise=new ee({clientId:this.clientId}),this.retry=this.formatRetry(t.retry,e.defaultRetry),this.baseRequest=t.baseRequest?t.baseRequest:je,this.tokenInURL=t.tokenInURL,this.headers=t.headers,this.storage=t.storage||Me,this.localCredentials=new Ne({tokenSectionName:`credentials_${t.clientId}`,storage:this.storage,clientId:t.clientId,onCredentialsChange:this._handleCredentialsChange.bind(this)}),this.clientSecret=t.clientSecret,t.clientId&&(this.basicAuth=`Basic ${function(e){for(var t,n,r,i,a=``,o=0,s=(e=String(e)).length%3;o<e.length;){if((n=e.charCodeAt(o++))>255||(r=e.charCodeAt(o++))>255||(i=e.charCodeAt(o++))>255)throw TypeError(`Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.`);a+=te.charAt((t=n<<16|r<<8|i)>>18&63)+te.charAt(t>>12&63)+te.charAt(t>>6&63)+te.charAt(63&t)}return s?a.slice(0,s-3)+`===`.substring(s):a}(`${t.clientId}:${this.clientSecret}`)}`),this.wxCloud=t.wxCloud;try{A()&&(this.useWxCloud=t.useWxCloud,this.wxCloud===void 0&&t.env&&(wx.cloud.init({env:t.env}),this.wxCloud=wx.cloud))}catch{}this.refreshTokenFunc=t.refreshTokenFunc||this.defaultRefreshTokenFunc,this.anonymousSignInFunc=t.anonymousSignInFunc,this.onCredentialsError=t.onCredentialsError,this.getInitialSession=t.getInitialSession,this.onInitialSessionObtained=t.onInitialSessionObtained,this.logDebugMessages=(n=t.debug)!=null&&n,we.on(`lang_change`,function(e){r.i18n=e.data?.i18n||r.i18n}),this._initBroadcastChannel(),this._initVisibilityListener()}return e.prototype.setGetInitialSession=function(e){this.getInitialSession=e},e.prototype.setOnInitialSessionObtained=function(e){this.onInitialSessionObtained=e},e.prototype.initialize=function(e){return N(this,void 0,Promise,function(){var t=this;return P(this,function(n){switch(n.label){case 0:return this.initializePromise?[4,this.initializePromise]:[3,2];case 1:case 3:case 5:return[2,n.sent()];case 2:return e===void 0?[3,4]:(this.initializePromise=e,[4,this.initializePromise]);case 4:return this.initializePromise=N(t,void 0,void 0,function(){var e=this;return P(this,function(t){switch(t.label){case 0:return[4,this._acquireLock(-1,function(){return N(e,void 0,void 0,function(){return P(this,function(e){switch(e.label){case 0:return[4,this._initialize()];case 1:return[2,e.sent()]}})})})];case 1:return[2,t.sent()]}})}),[4,this.initializePromise]}})})},e.prototype.setCredentials=function(e){return N(this,void 0,Promise,function(){var t=this;return P(this,function(n){switch(n.label){case 0:return[4,this.initializePromise];case 1:return n.sent(),[2,this._acquireLock(-1,function(){return N(t,void 0,void 0,function(){return P(this,function(t){return[2,this.localCredentials.setCredentials(e)]})})})]}})})},Object.defineProperty(e.prototype,"initSessionEmitted",{get:function(){return this._initSessionEmitted},enumerable:!1,configurable:!0}),e.prototype.destroy=function(){try{this.broadcastChannel&&typeof this.broadcastChannel.close==`function`&&this.broadcastChannel.close()}catch(e){this._debug(`#destroy`,`close BroadcastChannel error`,e)}finally{this.broadcastChannel=null}try{var e=this.visibilityEventHandler;this.visibilityEventHandler=void 0,e&&typeof window<`u`&&typeof document<`u`&&typeof window.removeEventListener==`function`&&window.removeEventListener(`visibilitychange`,e)}catch(e){this._debug(`#destroy`,`remove visibility listener error`,e)}},e.prototype.setAccessKeyCredentials=function(e){return this.localCredentials.setAccessKeyCredentials(e)},e.prototype.getAccessToken=function(){return N(this,void 0,Promise,function(){var e,t;return P(this,function(n){switch(n.label){case 0:return[4,this.initializePromise];case 1:return n.sent(),[4,this.getCredentials()];case 2:return(e=n.sent())?.scope===S||e?.access_token?[2,Promise.resolve(e.access_token)]:(t={error:i.UNAUTHENTICATED},[2,Promise.reject(t)])}})})},e.prototype.request=function(t,n){return N(this,void 0,Promise,function(){var r,a,o,s,c,l,u,d,f,p;return P(this,function(m){switch(m.label){case 0:return n||={},r=this.formatRetry(n.retry,this.retry),n.headers=Ee(Ee({},n.headers),((p={})[this.i18n?.LANG_HEADER_KEY]=this.i18n?.lang,p)),this.headers&&(n.headers=Ee(Ee({},this.headers),n.headers)),n.headers[Oe]||(n.headers[Oe]=C()),n.headers[ke]?[3,2]:[4,this.getDeviceId()];case 1:a=m.sent(),n.headers[ke]=a,m.label=2;case 2:return n!=null&&n.withBasicAuth&&this.basicAuth&&(n.headers.Authorization=this.basicAuth),n?.withCredentials?n.getCredentials?[4,n.getCredentials()]:[3,4]:[3,7];case 3:return s=m.sent(),[3,6];case 4:return[4,this.getCredentials()];case 5:s=m.sent(),m.label=6;case 6:return(o=s)&&(this.tokenInURL?(t.indexOf(`?`)<0&&(t+=`?`),t+=`access_token=${o.access_token}`):n.headers.Authorization=`${o.token_type} ${o.access_token}`),[3,8];case 7:this.clientId&&t.indexOf(`client_id`)<0&&(t+=t.indexOf(`?`)<0?`?`:`&`,t+=`client_id=${this.clientId}`),m.label=8;case 8:t.startsWith(`/`)&&(c=this.getApiOriginFunc?this.getApiOriginFunc():this.apiOrigin,t=`${c}${this.apiPath}${t}`),l=null,u=r+1,d=0,m.label=9;case 9:if(!(d<u))return[3,21];m.label=10;case 10:return m.trys.push([10,15,,18]),n.useWxCloud||this.useWxCloud?[4,this.wxCloudCallFunction(t,n)]:[3,12];case 11:return l=m.sent(),[3,14];case 12:return[4,this.baseRequest(t,n)];case 13:l=m.sent(),m.label=14;case 14:if(l?.code)throw{error:l.code,error_description:l.message,error_uri:new URL(t).pathname};return[3,21];case 15:f=m.sent();try{f.requestId=f.requestId||n.headers[Oe]||``}catch{}return n.withCredentials&&f&&f.error===i.UNAUTHENTICATED?[4,this.setCredentials(null)]:[3,17];case 16:return m.sent(),[2,Promise.reject(f)];case 17:return d!==r&&f&&f.error===`unreachable`?[3,18]:[2,Promise.reject(f)];case 18:return[4,this.sleep(e.retryInterval)];case 19:m.sent(),m.label=20;case 20:return d++,[3,9];case 21:return[2,l]}})})},e.prototype.wxCloudCallFunction=function(e,t){return N(this,void 0,Promise,function(){var n,r,a,o,s;return P(this,function(c){switch(c.label){case 0:n=null,r=null,c.label=1;case 1:c.trys.push([1,7,,8]),a=``,c.label=2;case 2:return c.trys.push([2,4,,5]),[4,wx.getRendererUserAgent()];case 3:return a=c.sent(),[3,5];case 4:return c.sent(),[3,5];case 5:return[4,this.wxCloud.callFunction({name:`httpOverCallFunction`,data:{url:e,method:t.method,headers:Ee({origin:`https://servicewechat.com`,"User-Agent":a},t.headers),body:t.body}})];case 6:return o=c.sent().result,o?.body?.error_code?(r=o?.body).error_uri=(0,w.y)(e):n=o?.body,[3,8];case 7:return s=c.sent(),r={error:i.UNREACHABLE,error_description:s.message,error_uri:(0,w.y)(e)},[3,8];case 8:if(r)throw r;return[2,n]}})})},e.prototype.getCredentials=function(){return N(this,void 0,Promise,function(){var e=this;return P(this,function(t){switch(t.label){case 0:return[4,this.initializePromise];case 1:return t.sent(),[2,this._acquireLock(-1,function(){return N(e,void 0,void 0,function(){return P(this,function(e){return[2,this._getCredentials()]})})})]}})})},e.prototype.getCredentialsSync=function(){return this.localCredentials.getStorageCredentialsSync()},e.prototype.getCredentialsAsync=function(){return this.getCredentials()},e.prototype.getScope=function(){var e;return N(this,void 0,Promise,function(){var t,n;return P(this,function(r){switch(r.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:return(t=r.sent())?[2,t.scope]:(n=`credentials not found`,(e=this.onCredentialsError)==null||e.call(this,{msg:n}),[2,this.unAuthenticatedError(n)])}})})},e.prototype.getGroups=function(){var e;return N(this,void 0,Promise,function(){var t,n;return P(this,function(r){switch(r.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:return(t=r.sent())?[2,t.groups]:(n=`credentials not found`,(e=this.onCredentialsError)==null||e.call(this,{msg:n}),[2,this.unAuthenticatedError(n)])}})})},e.prototype.refreshToken=function(e,t){return N(this,void 0,Promise,function(){var n=this;return P(this,function(r){switch(r.label){case 0:return[4,this.initializePromise];case 1:return r.sent(),[2,this._acquireLock(-1,function(){return N(n,void 0,void 0,function(){return P(this,function(n){return[2,this._refreshToken(e,t)]})})})]}})})},e.prototype._refreshToken=function(e,t){return N(this,void 0,Promise,function(){var n=this;return P(this,function(r){return[2,this.singlePromise.run(`_refreshToken`,function(){return N(n,void 0,void 0,function(){var n,r,a,o,s,c;return P(this,function(l){switch(l.label){case 0:if(e?.scope===S)return[2,e];if(!e||!e.refresh_token)return a=`no refresh token found in credentials`,(o=this.onCredentialsError)==null||o.call(this,{msg:a}),[2,this.unAuthenticatedError(a)];l.label=1;case 1:return l.trys.push([1,4,,7]),[4,this.refreshTokenFunc(e.refresh_token,e)];case 2:return n=l.sent(),[4,this.localCredentials.setCredentials(n)];case 3:return l.sent(),[2,n];case 4:if(r=l.sent(),t?.throwError)throw r;return r.error===i.INVALID_GRANT?[4,this.localCredentials.setCredentials(null)]:[3,6];case 5:return l.sent(),a=r.error_description,(s=this.onCredentialsError)==null||s.call(this,{msg:a}),[2,this.unAuthenticatedError(a)];case 6:return(c=this.onCredentialsError)==null||c.call(this,{msg:r.error_description}),[2,Promise.reject(r)];case 7:return[2]}})})})]})})},e.prototype.anonymousLogin=function(e){return N(this,void 0,void 0,function(){var t=this;return P(this,function(n){return[2,this.singlePromise.run(`_anonymousLogin`,function(){return N(t,void 0,void 0,function(){var t,n;return P(this,function(r){switch(r.label){case 0:return this.anonymousSignInFunc?[4,this.anonymousSignInFunc(e)]:[3,4];case 1:return t=r.sent(),(n=t)?[3,3]:[4,this.localCredentials.getCredentials()];case 2:n=r.sent(),r.label=3;case 3:return e=n,[3,6];case 4:return[4,this.anonymousSignIn(e)];case 5:e=r.sent(),r.label=6;case 6:return[2,e]}})})})]})})},e.prototype.checkRetry=function(t){var n=null;if((typeof t!=`number`||t<e.minRetry||t>e.maxRetry)&&(n={error:i.UNREACHABLE,error_description:`wrong options param: retry`}),n)throw n;return t},e.prototype.formatRetry=function(e,t){return e===void 0?t:this.checkRetry(e)},e.prototype.sleep=function(e){return N(this,void 0,Promise,function(){return P(this,function(t){return[2,new Promise(function(t){setTimeout(function(){t()},e)})]})})},e.prototype.anonymousSignIn=function(e){return N(this,void 0,Promise,function(){var n=this;return P(this,function(r){return[2,this.singlePromise.run(`_anonymous`,function(){return N(n,void 0,void 0,function(){var n,r;return P(this,function(a){switch(a.label){case 0:if(!e||e.scope!==`anonymous`)return[2,this.unAuthenticatedError(`no anonymous in credentials`)];a.label=1;case 1:return a.trys.push([1,4,,7]),[4,this.request(t.AUTH_SIGN_IN_ANONYMOUSLY_URL,{method:`POST`,withBasicAuth:!0,body:{}})];case 2:return n=a.sent(),[4,this.localCredentials.setCredentials(n)];case 3:return a.sent(),[2,n];case 4:return(r=a.sent()).error===i.INVALID_GRANT?[4,this.localCredentials.setCredentials(null)]:[3,6];case 5:return a.sent(),[2,this.unAuthenticatedError(r.error_description)];case 6:return[2,Promise.reject(r)];case 7:return[2]}})})})]})})},e.prototype.defaultRefreshTokenFunc=function(e,r){var i;return N(this,void 0,Promise,function(){var a,o,s;return P(this,function(c){switch(c.label){case 0:return e===void 0||e===``?(a=`refresh token not found`,(i=this.onCredentialsError)==null||i.call(this,{msg:a}),[2,this.unAuthenticatedError(a)]):(o=t.AUTH_TOKEN_URL,r?.version===`v2`&&(o=n.AUTH_TOKEN_URL),[4,this.request(o,{method:`POST`,body:{client_id:this.clientId,client_secret:this.clientSecret,grant_type:`refresh_token`,refresh_token:e}})]);case 1:return s=c.sent(),[2,Ee(Ee({},s),{version:r?.version||`v1`})]}})})},e.prototype.getDeviceId=function(){return N(this,void 0,Promise,function(){var e;return P(this,function(t){switch(t.label){case 0:return this.deviceID?[2,this.deviceID]:[4,this.storage.getItem(Ae)];case 1:return typeof(e=t.sent())==`string`&&e.length>=16&&e.length<=48?[3,3]:(e=C(),[4,this.storage.setItem(Ae,e)]);case 2:t.sent(),t.label=3;case 3:return this.deviceID=e,[2,e]}})})},e.prototype.unAuthenticatedError=function(e){var t={error:i.UNAUTHENTICATED,error_description:e};return Promise.reject(t)},e.prototype._debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logDebugMessages&&console.log.apply(console,De([`[OAuth2Client]`],e,!1))},e.prototype._initialize=function(){return N(this,void 0,Promise,function(){var e,t,n,r,i,a;return P(this,function(o){switch(o.label){case 0:if(o.trys.push([0,11,12,13]),!this.getInitialSession)return this._debug(`#_initialize()`,`no getInitialSession callback set, skipping`),[2,{error:null}];this._debug(`#_initialize()`,`calling getInitialSession callback`),o.label=1;case 1:return o.trys.push([1,9,,10]),[4,this.getInitialSession()];case 2:return a=o.sent(),e=a.data,t=a.error,e?.session?(this._debug(`#_initialize()`,`session obtained from getInitialSession`,e.session),this._initSessionEmitted=!0,[4,this.localCredentials.setCredentials(e?.session,{isInit:!0})]):[3,4];case 3:o.sent(),o.label=4;case 4:if(!this.onInitialSessionObtained)return[3,8];this._debug(`#_initialize()`,`calling onInitialSessionObtained callback`),o.label=5;case 5:return o.trys.push([5,7,,8]),[4,this.onInitialSessionObtained(e,t)];case 6:return o.sent(),[3,8];case 7:return n=o.sent(),this._debug(`#_initialize()`,`error in onInitialSessionObtained`,n),[3,8];case 8:return t?(this._debug(`#_initialize()`,`error from getInitialSession`,t),[2,{error:t}]):[2,{error:null}];case 9:return r=o.sent(),this._debug(`#_initialize()`,`exception during getInitialSession`,r),[2,{error:r instanceof Error?r:Error(String(r))}];case 10:return[3,13];case 11:return i=o.sent(),this._debug(`#_initialize()`,`unexpected error`,i),[2,{error:i instanceof Error?i:Error(String(i))}];case 12:return this._debug(`#_initialize()`,`end`),[7];case 13:return[2]}})})},e.prototype._acquireLock=function(e,t){return N(this,void 0,Promise,function(){var n,r,i,a,o=this;return P(this,function(s){switch(s.label){case 0:this._debug(`#_acquireLock`,`begin`,e),s.label=1;case 1:if(s.trys.push([1,,10,11]),this.lockAcquired)return n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),r=N(o,void 0,void 0,function(){return P(this,function(e){switch(e.label){case 0:return[4,n];case 1:return e.sent(),[4,t()];case 2:return[2,e.sent()]}})}),this.pendingInLock.push(N(o,void 0,void 0,function(){return P(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,r];case 1:case 2:return e.sent(),[3,3];case 3:return[2]}})})),[2,r];this._debug(`#_acquireLock`,`acquiring lock for client`,this.clientId),s.label=2;case 2:return s.trys.push([2,,8,9]),this.lockAcquired=!0,i=t(),this.pendingInLock.push(N(o,void 0,void 0,function(){return P(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,i];case 1:case 2:return e.sent(),[3,3];case 3:return[2]}})})),[4,i];case 3:s.sent(),s.label=4;case 4:return this.pendingInLock.length?(a=De([],this.pendingInLock,!0),[4,Promise.all(a)]):[3,6];case 5:return s.sent(),this.pendingInLock.splice(0,a.length),[3,4];case 6:return[4,i];case 7:return[2,s.sent()];case 8:return this._debug(`#_acquireLock`,`releasing lock for client`,this.clientId),this.lockAcquired=!1,[7];case 9:return[3,11];case 10:return this._debug(`#_acquireLock`,`end`),[7];case 11:return[2]}})})},e.prototype._getCredentials=function(){var e,t,n;return N(this,void 0,Promise,function(){var r,i,a;return P(this,function(o){switch(o.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:if((r=o.sent())?.scope===S)return[2,r];if(!r)return a=`credentials not found`,(e=this.onCredentialsError)==null||e.call(this,{msg:a}),[2,this.unAuthenticatedError(a)];if(!function(e){var t=!0;return e!=null&&e.expires_at&&e!=null&&e.access_token&&(t=e.expires_at<new Date),t}(r))return[3,12];if(!r.refresh_token)return[3,9];o.label=2;case 2:return o.trys.push([2,4,,8]),[4,this._refreshToken(r)];case 3:return r=o.sent(),[3,8];case 4:return i=o.sent(),r.scope===`anonymous`?[4,this.anonymousLogin(r)]:[3,6];case 5:return r=o.sent(),[3,7];case 6:return(t=this.onCredentialsError)==null||t.call(this,{msg:i.error_description}),[2,Promise.reject(i)];case 7:return[3,8];case 8:return[3,12];case 9:return r.scope===`anonymous`?[4,this.anonymousLogin(r)]:[3,11];case 10:return r=o.sent(),[3,12];case 11:return a=`no refresh token found in credentials`,(n=this.onCredentialsError)==null||n.call(this,{msg:a}),[2,this.unAuthenticatedError(a)];case 12:return[2,r]}})})},e.prototype._isUserCredentials=function(e){return!!e?.access_token&&e.scope!==`accessKey`&&e.scope!==S},e.prototype._fireCredentialsEvents=function(e,t,n){var r,i,a,o,s,c;this._isUserCredentials(e)?t?(a=this.eventBus)==null||a.fire(v,{event:p}):n?(o=this.eventBus)==null||o.fire(v,{event:m}):((s=this.eventBus)==null||s.fire(v,{event:f}),(c=this.eventBus)==null||c.fire(_,{eventType:`sign_in`})):n&&((r=this.eventBus)==null||r.fire(v,{event:d}),(i=this.eventBus)==null||i.fire(_,{eventType:`sign_out`}))},e.prototype._handleCredentialsChange=function(e,t){this._fireCredentialsEvents(e,t.isInit,t.hadCredentials),this._broadcastCredentials(e,t)},e.prototype._initBroadcastChannel=function(){var e=this;if(this.broadcastChannel===void 0)try{typeof BroadcastChannel<`u`&&(this.broadcastChannelName=`credentials_${this.clientId}`,this.broadcastChannel=new BroadcastChannel(this.broadcastChannelName),this.broadcastChannel.addEventListener(`message`,function(t){e._handleBroadcastMessage(t.data)}),this._debug(`#_initBroadcastChannel`,`channel created: ${this.broadcastChannelName}`))}catch(e){this.broadcastChannel=null,this._debug(`#_initBroadcastChannel`,`BroadcastChannel not available, skip`,e)}},e.prototype._broadcastCredentials=function(e,t){if(this.broadcastChannel)try{this.broadcastChannel.postMessage({type:`credentials_changed`,credentials:e,context:t})}catch(e){this._debug(`#_broadcastCredentials`,`postMessage error`,e)}},e.prototype._handleBroadcastMessage=function(e){try{if(!e||e.type!==`credentials_changed`)return;var t=e.context,n=e.credentials;if(n!=null&&n.expires_at&&typeof n.expires_at==`string`&&(n=Ee(Ee({},n),{expires_at:new Date(n.expires_at)})),n?.access_token===this.localCredentials.getMemoryCredentials()?.access_token)return;var r=!!this.localCredentials.getMemoryCredentials()?.access_token;this.localCredentials.syncMemoryCredentials(n),this._fireCredentialsEvents(n,t.isInit,r)}catch(e){this._debug(`#_handleBroadcastMessage`,`error`,e)}},e.prototype._initVisibilityListener=function(){var e=this;try{if(typeof window>`u`||typeof document>`u`||typeof window.addEventListener!=`function`)return;this.visibilityEventHandler=function(){return N(e,void 0,void 0,function(){var e;return P(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._onVisibilityChanged()];case 1:return t.sent(),[3,3];case 2:return e=t.sent(),this._debug(`#visibilityChangedCallback`,`error`,e),[3,3];case 3:return[2]}})})},window.addEventListener(`visibilitychange`,this.visibilityEventHandler)}catch(e){this._debug(`#_initVisibilityListener`,e)}},e.prototype._onVisibilityChanged=function(){return N(this,void 0,Promise,function(){var e=this;return P(this,function(t){return document.visibilityState!==`visible`||this._acquireLock(-1,function(){return N(e,void 0,void 0,function(){var e,t,n,r,i,a;return P(this,function(o){switch(o.label){case 0:if(document.visibilityState!==`visible`)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),e=this.localCredentials.getMemoryCredentials(),[4,this.localCredentials.getCredentials()];case 2:return t=o.sent(),n=e?.access_token,r=t?.access_token,n===r?[2]:(i=!!n,this._fireCredentialsEvents(t,!1,i),[3,4]);case 3:return a=o.sent(),this._debug(`#_onVisibilityChanged`,`reload credentials error`,a),[3,4];case 4:return[2]}})})}),[2]})})},e.defaultRetry=2,e.minRetry=0,e.maxRetry=5,e.retryInterval=1e3,e}(),Fe=io(689),Ie=io(616),Le=function(){return Le=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Le.apply(this,arguments)},Re=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},ze=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},Be=function(e,t){var n;return function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];clearTimeout(n),n=setTimeout(function(){return e.apply(null,r)},t)}},Ve=new Fe.CloudbaseEventEmitter,He=`resolveCaptchaData`,Ue=`padding:10px 8px;background:#007bff;color:#fff;border:none;border-radius:4px;cursor:pointer;flex:1;white-space:nowrap;margin-left:10px`,We=`width:100%;padding:10px;background:#007bff;color:#fff;border:none;border-radius:4px;cursor:pointer`,Ge=`background:#6c757d;cursor:not-allowed`,Ke=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},qe=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},Je=function(){function e(e){e.openURIWithCallback||=this.getDefaultOpenURIWithCallback(),e.storage||=Me,this.config=e,this.tokenSectionName=`captcha_${e.clientId||e.env}`}return e.prototype.isMatch=function(){var e;return((e=this.config?.adapter)?.isMatch)?.call(e)||A()},e.prototype.request=function(e,t){return Ke(this,void 0,Promise,function(){var n,r,a,o;return qe(this,function(s){switch(s.label){case 0:return t||={},t.method||(t.method=`GET`),n=`${t.method}:${e}`,r=e,t.withCaptcha?[4,this.appendCaptchaTokenToURL(e,n,!1)]:[3,2];case 1:r=s.sent(),s.label=2;case 2:return s.trys.push([2,4,,7]),[4,this.config.request(r,t)];case 3:return a=s.sent(),[3,7];case 4:return(o=s.sent()).error!==i.CAPTCHA_REQUIRED&&o.error!==i.CAPTCHA_INVALID?[3,6]:[4,this.appendCaptchaTokenToURL(e,n,o.error===i.CAPTCHA_INVALID)];case 5:return e=s.sent(),[2,this.config.request(e,t)];case 6:return[2,Promise.reject(o)];case 7:return[2,a]}})})},e.prototype.getDefaultOpenURIWithCallback=function(){var e=this;return function(t){return function(e,t){return Re(void 0,void 0,Promise,function(){var n,r,i,a;return ze(this,function(o){return n=(0,Ie.parseCaptcha)(e),r=n.captchaData,i=n.state,a=n.token,function(e){var t=e.oauthInstance,n=e.captchaState,r=`captcha-image`,i=function(){return Re(void 0,void 0,void 0,function(){var e,i;return ze(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,t.createCaptchaData({state:n.state})];case 1:return e=a.sent(),n=Le(Le({},n),{captchaData:e.data,token:e.token}),document.getElementById(r).src=e.data,[3,3];case 2:return i=a.sent(),console.error(`刷新图形验证码失败`,i),[3,3];case 3:return[2]}})})},a=function(e,t,n){var r=document.createElement(e);return t&&(r.style.cssText=t),n&&(r.textContent=n),r},o=a(`div`,`position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.5);z-index:999`),s=a(`div`,`position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:320px;padding:20px;background:#fff;border-radius:8px;box-shadow:0 0 10px rgba(0,0,0,0.2);z-index:1000`);s.appendChild(a(`p`,`margin-bottom:15px`,`请输入你看到的字符:`));var c=a(`div`,`display:flex;align-items:center;justify-content:space-between;margin-bottom:15px`),l=a(`img`,`width:100%;height:auto;border:1px solid #eee`);l.id=r,l.src=n.captchaData,c.appendChild(l);var u=a(`button`,Ue,`刷新`);u.onclick=Be(function(){return Re(void 0,void 0,void 0,function(){return ze(this,function(e){switch(e.label){case 0:u.textContent=`加载中...`,u.disabled=!0,u.style.cssText=`${Ue};${Ge}`,e.label=1;case 1:return e.trys.push([1,,3,4]),[4,i()];case 2:return e.sent(),[3,4];case 3:return u.textContent=`刷新`,u.disabled=!1,u.style.cssText=Ue,[7];case 4:return[2]}})})},500),c.appendChild(u),s.appendChild(c);var d=a(`input`,`width:100%;padding:14px 16px;margin-bottom:15px;box-sizing:border-box;border:2px solid #e8ecf4;border-radius:10px;font-size:15px`);d.type=`text`,d.placeholder=`输入字符`,d.maxLength=4,s.appendChild(d);var f=a(`div`,`color:#dc3545;font-size:12px;margin-bottom:10px;display:none;padding:8px;background:#f8d7da;border:1px solid #f5c6cb;border-radius:4px`);s.appendChild(f);var p=function(e){f.textContent=e,f.style.display=`block`},m=a(`button`,We,`确定`);m.onclick=Be(function(){return Re(void 0,void 0,void 0,function(){var e,r,a,c;return ze(this,function(l){switch(l.label){case 0:if(!(e=d.value.trim()))return p(`请输入字符`),[2];f.style.display=`none`,m.textContent=`验证中...`,m.disabled=!0,m.style.cssText=`${We};${Ge}`,l.label=1;case 1:return l.trys.push([1,3,5,6]),[4,t.verifyCaptchaData({token:n.token,key:e})];case 2:return r=l.sent(),Ve.fire(He,r),console.log(`图形验证码校验成功`),document.body.removeChild(o),document.body.removeChild(s),[3,6];case 3:return a=l.sent(),console.error(`图形验证码校验失败`,a),c=a.error_description||`图形验证码校验失败`,p(c),d.value=``,d.focus(),[4,i()];case 4:return l.sent(),[3,6];case 5:return m.textContent=`确定`,m.disabled=!1,m.style.cssText=We,[7];case 6:return[2]}})})},500),s.appendChild(m),document.body.appendChild(o),document.body.appendChild(s)}({oauthInstance:t,captchaState:{captchaData:r,state:i,token:a}}),[2,new Promise(function(e){console.log(`等待图形验证码校验结果...`),Ve.on(He,function(t){e(t?.data)})})]})})}(t,e.config.oauthInstance)}},e.prototype.getCaptchaToken=function(e,n){return Ke(this,void 0,Promise,function(){var r,i,a,o;return qe(this,function(s){switch(s.label){case 0:return e?[3,2]:[4,this.findCaptchaToken()];case 1:if(r=s.sent())return[2,r];s.label=2;case 2:return[4,this.config.request(t.CAPTCHA_DATA_URL,{method:`POST`,body:{state:n,redirect_uri:``},withCredentials:!1})];case 3:return i=s.sent(),a=`${i.data}?state=${encodeURIComponent(n)}&token=${encodeURIComponent(i.token)}`,[4,this.config.openURIWithCallback(a)];case 4:return o=s.sent(),this.saveCaptchaToken(o),[2,o.captcha_token]}})})},e.prototype.appendCaptchaTokenToURL=function(e,t,n){return Ke(this,void 0,Promise,function(){var r;return qe(this,function(i){switch(i.label){case 0:return[4,this.getCaptchaToken(n,t)];case 1:return r=i.sent(),e.indexOf(`?`)>0?e+=`&captcha_token=${r}`:e+=`?captcha_token=${r}`,[2,e]}})})},e.prototype.saveCaptchaToken=function(e){return Ke(this,void 0,void 0,function(){var t;return qe(this,function(n){switch(n.label){case 0:return e.expires_at=new Date(Date.now()+1e3*(e.expires_in-10)),t=JSON.stringify(e),[4,this.config.storage.setItem(this.tokenSectionName,t)];case 1:return n.sent(),[2]}})})},e.prototype.findCaptchaToken=function(){return Ke(this,void 0,Promise,function(){var e,t;return qe(this,function(n){switch(n.label){case 0:return[4,this.config.storage.getItem(this.tokenSectionName)];case 1:if((e=n.sent())==null)return[3,5];n.label=2;case 2:return n.trys.push([2,3,,5]),(t=JSON.parse(e))!=null&&t.expires_at&&(t.expires_at=new Date(t.expires_at)),t.expires_at<new Date?[2,null]:[2,t.captcha_token];case 3:return n.sent(),[4,this.config.storage.removeItem(this.tokenSectionName)];case 4:return n.sent(),[2,null];case 5:return[2,null]}})})},e}();let Ye=function(){function e(e){if(this.params={},typeof e==`string`)this.parse(e);else if(e&&typeof e==`object`)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.append(t,e[t])}return e.prototype.parse=function(e){var t=this;e.split(`&`).forEach(function(e){var n=e.split(`=`).map(decodeURIComponent),r=n[0],i=n[1];t.append(r,i)})},e.prototype.append=function(e,t){this.params[e]?this.params[e]=this.params[e].concat([t]):this.params[e]=[t]},e.prototype.get=function(e){return this.params[e]?this.params[e][0]:null},e.prototype.getAll=function(e){return this.params[e]||[]},e.prototype.delete=function(e){delete this.params[e]},e.prototype.has=function(e){return Object.prototype.hasOwnProperty.call(this.params,e)},e.prototype.set=function(e,t){this.params[e]=[t]},e.prototype.toString=function(){var e=[],t=function(t){Object.prototype.hasOwnProperty.call(n.params,t)&&n.params[t].forEach(function(n){e.push(`${encodeURIComponent(t)}=${encodeURIComponent(n)}`)})},n=this;for(var r in this.params)t(r);return e.join(`&`)},e}();var F,Xe=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(e){e.PROVIDER_NOT_ENABLED=`PROVIDER_NOT_ENABLED`,e.INVALID_CREDENTIALS=`INVALID_CREDENTIALS`,e.USER_NOT_FOUND=`USER_NOT_FOUND`,e.USER_STATUS_ABNORMAL=`USER_STATUS_ABNORMAL`,e.SERVICE_ERROR=`SERVICE_ERROR`,e.INVALID_PARAMS=`INVALID_PARAMS`,e.AUTH_METHOD_MISMATCH=`AUTH_METHOD_MISMATCH`,e.RATE_LIMITED=`RATE_LIMITED`,e.CAPTCHA_REQUIRED=`CAPTCHA_REQUIRED`,e.CAPTCHA_INVALID=`CAPTCHA_INVALID`,e.MFA_REQUIRED=`MFA_REQUIRED`,e.PRECONDITION_FAILED=`PRECONDITION_FAILED`,e.VERIFICATION_FAILED=`VERIFICATION_FAILED`,e.UNKNOWN=`UNKNOWN`})(F||={});var Ze=`https://tcb.cloud.tencent.com/dev?envId=#/identity/login-manage`,Qe=`https://docs.cloudbase.net/api-reference/webv3/initialization`;function $e(e,t){var n=t?.method||`signIn`,r={signInWithPassword:`「用户名密码登录」`,signInAnonymously:`「匿名登录」`,signInWithOtp:`「短信验证码登录」或「邮箱验证码登录」`,signUp:`「短信验证码登录」或「邮箱验证码登录」`,signInWithOAuth:`对应的第三方身份源`,signInWithIdToken:`对应的第三方身份源`,signInWithOpenId:`「微信小程序 OpenID 登录」`,signInWithPhoneAuth:`「微信小程序手机号授权登录」`,signInWithCustomTicket:`「自定义登录」`,getVerification:`「短信验证码登录」或「邮箱验证码登录」`,verify:`「短信验证码登录」或「邮箱验证码登录」`,verifyOtp:`「短信验证码登录」或「邮箱验证码登录」`,resetPasswordForEmail:`「邮箱验证码登录」`,reauthenticate:`「短信验证码登录」或「邮箱验证码登录」`}[n]||`对应的登录方式`;switch(e){case F.PROVIDER_NOT_ENABLED:return`[CloudBase Auth] 登录方式未开启
|
|
15
15
|
|
|
16
16
|
当前调用的 ${n}() 所需的登录方式尚未在云开发控制台启用。
|
|
17
17
|
需要开启的登录方式:${r}
|
|
@@ -166,9 +166,9 @@ ${[`verifyOtp`,`signInWithOtp`,`signUp`].includes(n)?`
|
|
|
166
166
|
✓ 控制台已开启「短信验证码登录」或「邮箱验证码登录」`,signInWithOAuth:`当前使用「第三方 OAuth 登录」,需确保:
|
|
167
167
|
✓ 控制台已配置并开启对应的第三方身份源`}[e]||``}var I=function(e){function t(t,n){var r=this,o=function(e){return typeof e==`object`&&!!e&&`__isAuthError`in e}(t);return(r=e.call(this,o?t.message:t.error_description||t.message)||this).__isAuthError=!0,r.name=`AuthError`,o?(r.status=t.status,r.code=t.code,r.errorCode=t.errorCode,r.requestId=t.requestId,r.category=t.category,r.retryAfter=t.retryAfter,r.helpMessage=$e(r.category,{method:n?.method,errorCode:r.errorCode,code:r.code}),r.loginMethodHint=et(n?.method),r):(r.status=t.error,r.code=String(t.error||t.error_code||`unknown`).toLowerCase(),r.errorCode=typeof t.error_code==`number`?t.error_code:typeof t.error_code==`string`&&parseInt(t.error_code,10)||void 0,r.requestId=t.requestId,r.category=function(e,t,n){if(!e&&!t&&!n)return F.UNKNOWN;try{var r=(e||``).toLowerCase(),o=typeof n==`string`?parseInt(n,10):n;return o===a.MISSING_REQUIRED_PARAM||t===i.MISSING_REQUIRED_PARAM?F.INVALID_PARAMS:o===a.CAPTCHA_REQUIRED||t===i.CAPTCHA_REQUIRED?F.CAPTCHA_REQUIRED:o===a.CAPTCHA_INVALID||t===i.CAPTCHA_INVALID?F.CAPTCHA_INVALID:o===a.MFA_PHONE_REQUIRED||t===i.MFA_PHONE_REQUIRED?F.MFA_REQUIRED:o===a.LOGIN_TYPE_DISABLED||t===i.LOGIN_TYPE_DISABLED?F.PROVIDER_NOT_ENABLED:o===a.RESOURCE_EXHAUSTED||t===i.RESOURCE_EXHAUSTED?F.RATE_LIMITED:o===a.INTERNAL||o===a.UNAVAILABLE||o===a.UNIMPLEMENTED||o===a.ABORTED?F.SERVICE_ERROR:o===a.NOT_FOUND?F.USER_NOT_FOUND:o===a.UNAUTHENTICATED?F.INVALID_CREDENTIALS:o===a.INVALID_ARGUMENT&&(r.includes(`验证码`)||r.includes(`verification`)||r.includes(`verification_code`)||r.includes(`verification_id`)||r.includes(`does not match`)||r.includes(`token expired`)||r.includes(`token error`)||r.includes(`过期`))?F.VERIFICATION_FAILED:t===i.PROVIDER_NOT_ENABLED||t===i.LOGIN_METHOD_DISABLED||r.includes(`身份源`)||r.includes(`开启`)||r.includes(`identity provider`)||r.includes(`provider not enabled`)||r.includes(`login method`)||r.includes(`登录方式`)||r.includes(`not enabled`)||r.includes(`未开启`)||r.includes(`未启用`)||r.includes(`请联系开发者`)||r.includes(`anonymous login is not enabled`)||r.includes(`匿名登录未开启`)?F.PROVIDER_NOT_ENABLED:t===i.FAILED_PRECONDITION||o===a.FAILED_PRECONDITION&&!r.includes(`请联系开发者`)?r.includes(`不存在`)||r.includes(`not found`)||r.includes(`未注册`)?F.USER_NOT_FOUND:F.PRECONDITION_FAILED:t===i.INVALID_PASSWORD||t===i.INVALID_GRANT||t===i.INVALID_VERIFICATION_CODE||t===i.INVALID_USERNAME_OR_PASSWORD||t===i.INVALID_CREDENTIALS||t===i.WRONG_PASSWORD||t===i.UNAUTHENTICATED||t===i.INVALID_TWO_FACTOR||t===i.INVALID_TWO_FACTOR_RECOVERY||t===i.PASSWORD_NOT_SET||r.includes(`密码不正确`)||r.includes(`password`)||r.includes(`invalid_password`)||r.includes(`凭据`)||r.includes(`credentials`)||r.includes(`验证码`)||r.includes(`verification`)||r.includes(`invalid_verification_code`)||r.includes(`invalid_username_or_password`)||r.includes(`username or password`)||r.includes(`用户名或密码`)||r.includes(`wrong password`)||r.includes(`incorrect password`)?F.INVALID_CREDENTIALS:t===i.NOT_FOUND||t===i.USER_NOT_FOUND||r.includes(`用户不存在`)||r.includes(`not found`)||r.includes(`user not found`)||r.includes(`no such user`)||r.includes(`user does not exist`)?F.USER_NOT_FOUND:t===i.USER_BLOCKED||t===i.USER_PENDING||t===i.UNDER_REVIEW||t===i.INVALID_STATUS||r.includes(`被封禁`)||r.includes(`blocked`)||r.includes(`pending`)||r.includes(`审核`)||r.includes(`review`)||r.includes(`locked`)||r.includes(`已锁定`)?F.USER_STATUS_ABNORMAL:t===i.SERVER_ERROR||t===i.UNAVAILABLE||t===i.TEMPORARILY_UNAVAILABLE||t===i.INTERNAL||t===i.UNREACHABLE||t===i.DEADLINE_EXCEEDED||t===i.DATA_LOSS||t===i.ABORTED||r.includes(`network`)||r.includes(`timeout`)||r.includes(`timed out`)||r.includes(`超时`)||r.includes(`smtp is not set`)||r.includes(`sms sender does not config`)?F.SERVICE_ERROR:t===i.INVALID_ARGUMENT||t===i.INVALID_REQUEST||t===i.INVALID_SCOPE||t===i.INVALID_REQUEST_URI||t===i.INVALID_REQUEST_OBJECT||o===a.INVALID_ARGUMENT?F.INVALID_PARAMS:t===i.PERMISSION_DENIED||t===i.ACCESS_DENIED||t===i.UNAUTHORIZED_CLIENT?F.PROVIDER_NOT_ENABLED:F.UNKNOWN}catch{return t}}(r.message,r.status,r.errorCode),r.helpMessage=$e(r.category,{method:n?.method,errorCode:r.errorCode,code:r.code}),r.loginMethodHint=et(n?.method),r.category===F.RATE_LIMITED&&(r.retryAfter=t.retry_after||t.retryAfter||void 0),r)}return Xe(t,e),t.prototype.toJSON=function(){return{name:this.name,message:this.message,code:this.code,errorCode:this.errorCode,status:this.status,requestId:this.requestId,category:this.category,retryAfter:this.retryAfter}},t}(Error),tt=function(){return tt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},tt.apply(this,arguments)},L=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},R=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};function nt(e,t){return L(this,void 0,void 0,function(){var n,r=this;return R(this,function(i){n=function(){return L(r,void 0,void 0,function(){return R(this,function(e){switch(e.label){case 0:return e.trys.push([0,1,,6]),[2,io(171)];case 1:e.sent(),e.label=2;case 2:return e.trys.push([2,4,,5]),[4,Promise.resolve().then(io.bind(io,171))];case 3:return[2,e.sent()];case 4:return e.sent(),[2];case 5:return[3,6];case 6:return[2]}})})};try{if((t?.root?.globalThis||globalThis).IS_MP_BUILD)return[2];if(e)return[2,n()]}catch{if(e)return[2,n()]}return[2]})})}var rt=function(){function e(e){var t=e.request,n=e.credentialsClient;if(n||=new Pe({apiOrigin:e.apiOrigin,apiPath:e.apiPath,clientId:e.clientId,storage:e.storage,env:e.env,baseRequest:e.baseRequest,anonymousSignInFunc:e.anonymousSignInFunc,wxCloud:e.wxCloud,onCredentialsError:e.onCredentialsError,headers:e.headers||{},i18n:e.i18n,debug:e.debug}),!t){var r=n.request.bind(n),i=new Je(tt({env:e.env,clientId:e.clientId,request:r,storage:e.storage,adapter:e.adapter,oauthInstance:this},e.captchaOptions));t=i.request.bind(i)}this.config={env:e.env,apiOrigin:e.apiOrigin,apiPath:e.apiPath,clientId:e.clientId,request:t,credentialsClient:n,storage:e.storage||Me,adapter:e.adapter}}return e.parseParamsToSearch=function(e){return Object.keys(e).forEach(function(t){e[t]||delete e[t]}),new Ye(e).toString()},e.prototype.getParamsByVersion=function(e,r){var i=(0,w.I)(e),a={v2:n}[i?.version]?.[r]||t[r];return i&&delete i.version,{params:i,url:a}},e.prototype.signIn=function(e){return L(this,void 0,Promise,function(){var t,n,r,i;return R(this,function(a){switch(a.label){case 0:return t=e.version||`v1`,(n=this.getParamsByVersion(e,`AUTH_SIGN_IN_URL`)).params.query&&delete n.params.query,[4,this.getEncryptParams(n.params)];case 1:return r=a.sent(),[4,this.config.request(n.url,{method:`POST`,body:r})];case 2:return i=a.sent(),[4,this.config.credentialsClient.setCredentials(tt(tt({},i),{version:t}))];case 3:return a.sent(),[2,Promise.resolve(i)]}})})},e.prototype.signInAnonymously=function(e,n){return e===void 0&&(e={}),n===void 0&&(n=!1),L(this,void 0,Promise,function(){var r;return R(this,function(i){switch(i.label){case 0:return[4,this.config.request(t.AUTH_SIGN_IN_ANONYMOUSLY_URL,{method:`POST`,body:e,useWxCloud:n})];case 1:return r=i.sent(),[4,this.config.credentialsClient.setCredentials(r)];case 2:return i.sent(),[2,Promise.resolve(r)]}})})},e.prototype.signUp=function(e){return L(this,void 0,Promise,function(){var n;return R(this,function(r){switch(r.label){case 0:return[4,this.config.request(t.AUTH_SIGN_UP_URL,{method:`POST`,body:e})];case 1:return n=r.sent(),[4,this.config.credentialsClient.setCredentials(n)];case 2:return r.sent(),[2,Promise.resolve(n)]}})})},e.prototype.signOut=function(e){return L(this,void 0,Promise,function(){var n,r,a,o;return R(this,function(s){switch(s.label){case 0:if(n={},!e)return[3,6];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.config.request(t.AUTH_SIGNOUT_URL,{method:`POST`,withCredentials:!0,body:e})];case 2:return n=s.sent(),[3,4];case 3:return(r=s.sent()).error!==i.UNAUTHENTICATED&&console.log(`sign_out_error`,r),[3,4];case 4:return[4,this.config.credentialsClient.setCredentials()];case 5:return s.sent(),[2,n];case 6:return[4,this.config.credentialsClient.getAccessToken()];case 7:return a=s.sent(),[4,this.config.request(t.AUTH_REVOKE_URL,{method:`POST`,body:{token:a}})];case 8:return o=s.sent(),[4,this.config.credentialsClient.setCredentials()];case 9:return s.sent(),[2,Promise.resolve(o)]}})})},e.prototype.revokeAllDevices=function(){return L(this,void 0,Promise,function(){return R(this,function(e){switch(e.label){case 0:return[4,this.config.request(t.AUTH_REVOKE_ALL_URL,{method:`DELETE`,withCredentials:!0})];case 1:return e.sent(),[2]}})})},e.prototype.revokeDevice=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){switch(n.label){case 0:return[4,this.config.request(t.AUTHORIZED_DEVICES_DELETE_URL+e.device_id,{method:`DELETE`,withCredentials:!0})];case 1:return n.sent(),[2]}})})},e.prototype.getVerification=function(e,n){return L(this,void 0,Promise,function(){var r,i;return R(this,function(a){switch(a.label){case 0:return r=!1,e.target===`CUR_USER`?(r=!0,[3,3]):[3,1];case 1:return[4,this.hasLoginState()];case 2:a.sent()&&(r=!0),a.label=3;case 3:return(i=(0,w.I)(e)).phone_number&&!/^\+\d{1,3}\s+\d+/.test(i.phone_number)&&(i.phone_number=`+86 ${i.phone_number}`),[2,this.config.request(t.VERIFICATION_URL,{method:`POST`,body:i,withCaptcha:n?.withCaptcha||!1,withCredentials:r})]}})})},e.prototype.verify=function(e){return L(this,void 0,Promise,function(){var t,n;return R(this,function(r){switch(r.label){case 0:return t=this.getParamsByVersion(e,`VERIFY_URL`),[4,this.config.request(t.url,{method:`POST`,body:t.params})];case 1:return n=r.sent(),e?.version===`v2`?[4,this.config.credentialsClient.setCredentials(tt(tt({},n),{version:`v2`}))]:[3,3];case 2:r.sent(),r.label=3;case 3:return[2,n]}})})},e.prototype.genProviderRedirectUri=function(n){return L(this,void 0,Promise,function(){var r,i,a,o,s;return R(this,function(c){return r=n.provider_redirect_uri,i=n.other_params,a=i===void 0?{}:i,o=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(n,[`provider_redirect_uri`,`other_params`]),r&&!o.redirect_uri&&(o.redirect_uri=r),s=`${t.PROVIDER_URI_URL}?${e.parseParamsToSearch(o)}`,Object.keys(a).forEach(function(e){var t=a[e];(e!==`sign_out_uri`||t?.length>0)&&(s+=`&other_params[${e}]=${encodeURIComponent(t)}`)}),[2,this.config.request(s,{method:`GET`})]})})},e.prototype.grantProviderToken=function(e,n){return n===void 0&&(n=!1),L(this,void 0,Promise,function(){return R(this,function(r){return[2,this.config.request(t.PROVIDER_TOKEN_URL,{method:`POST`,body:e,useWxCloud:n})]})})},e.prototype.patchProviderToken=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(t.PROVIDER_TOKEN_URL,{method:`PATCH`,body:e})]})})},e.prototype.signInWithProvider=function(e,t){return t===void 0&&(t=!1),L(this,void 0,Promise,function(){var n,r;return R(this,function(i){switch(i.label){case 0:return n=this.getParamsByVersion(e,`AUTH_SIGN_IN_WITH_PROVIDER_URL`),[4,this.config.request(n.url,{method:`POST`,body:n.params,useWxCloud:t})];case 1:return r=i.sent(),[4,this.config.credentialsClient.setCredentials(tt(tt({},r),{version:e?.version||`v1`}))];case 2:return i.sent(),[2,Promise.resolve(r)]}})})},e.prototype.toBindIdentity=function(e){var t,n;return L(this,void 0,void 0,function(){var r,i,a,o;return R(this,function(s){switch(s.label){case 0:return(i=e.credentials)?[3,2]:[4,this.config.credentialsClient.localCredentials.getCredentials()];case 1:i=s.sent(),s.label=2;case 2:r=i,s.label=3;case 3:return s.trys.push([3,5,,6]),[4,this.bindWithProvider({provider_token:e.provider_token},r)];case 4:return s.sent(),a={data:{type:x,provider:e.provider},error:null},[3,6];case 5:return o=s.sent(),a={data:{type:x},error:new I(o)},[3,6];case 6:return e.fireEvent&&((n=(t=this.config.eventBus)?.fire)==null||n.call(t,v,{event:g,info:a})),[2,a]}})})},e.prototype.getInitialSession=function(){return L(this,void 0,Promise,function(){var e,t,n,r,i,a,o,s,c,l,u,d,f,p,m;return R(this,function(h){switch(h.label){case 0:e={},h.label=1;case 1:if(h.trys.push([1,12,,13]),typeof window>`u`||typeof document>`u`||(t=new URLSearchParams(location==null?void 0:location.search),n=t.get(`code`),r=t.get(`state`),!n||!r))return[2,{data:null,error:null}];i=null;try{i=JSON.parse(sessionStorage.getItem(r)||`null`)}catch{}return e={type:i?.type},a=t.get(`error`),o=t.get(`error_description`),a||o?[2,{data:e,error:new I({message:o||a||`Unknown error from OAuth provider`})}]:(s=i?.provider||t.get(`provider`))?(c=location.origin+location.pathname,[4,this.grantProviderToken({provider_id:s,provider_redirect_uri:c,provider_code:n})]):[2,{data:e,error:new I({message:`Provider is required for OAuth verification`})}];case 2:return l=h.sent().provider_token,u=void 0,d=null,f=void 0,i.type===x?[4,this.config.credentialsClient.localCredentials.getCredentials()]:[3,5];case 3:return u=h.sent(),[4,this.toBindIdentity({provider:s,provider_token:l,credentials:u})];case 4:return f=h.sent(),[3,11];case 5:return i.type===y?(f=this.getParamsByVersion({provider:s},`AUTH_SIGN_IN_WITH_PROVIDER_URL`),[4,this.config.request(f.url,{method:`POST`,body:{provider_token:l}})]):[3,11];case 6:u=h.sent(),h.label=7;case 7:return h.trys.push([7,9,,10]),[4,this.getUserInfo({credentials:u})];case 8:return d=h.sent(),[3,10];case 9:return p=h.sent(),console.error(`get user info error`,p),[3,10];case 10:f={data:tt(tt({},e),{session:u,user:d}),error:null},h.label=11;case 11:t.delete(`code`),t.delete(`state`),t.delete(`provider`),this.restoreUrlState(i?.search===void 0?`?${t.toString()}`:i.search,i?.hash||location.hash);try{sessionStorage.removeItem(r)}catch{}return[2,f];case 12:return m=h.sent(),[2,{data:e,error:new I(m)}];case 13:return[2]}})})},e.prototype.signInCustom=function(e){return L(this,void 0,Promise,function(){var n;return R(this,function(r){switch(r.label){case 0:return[4,this.config.request(t.AUTH_SIGN_IN_CUSTOM,{method:`POST`,body:e})];case 1:return n=r.sent(),[4,this.config.credentialsClient.setCredentials(n)];case 2:return r.sent(),[2,Promise.resolve(n)]}})})},e.prototype.signInWithWechat=function(e){return e===void 0&&(e={}),L(this,void 0,Promise,function(){var n;return R(this,function(r){switch(r.label){case 0:return[4,this.config.request(t.AUTH_SIGN_IN_WITH_WECHAT_URL,{method:`POST`,body:e})];case 1:return n=r.sent(),[4,this.config.credentialsClient.setCredentials(n)];case 2:return r.sent(),[2,Promise.resolve(n)]}})})},e.prototype.bindWithProvider=function(e,n){return L(this,void 0,Promise,function(){return R(this,function(r){return[2,this.config.request(t.PROVIDER_BIND_URL,{method:`POST`,body:e,withCredentials:!0,getCredentials:n?function(){return n}:void 0})]})})},e.prototype.getUserProfile=function(e){return L(this,void 0,Promise,function(){return R(this,function(t){return[2,this.getUserInfo(e)]})})},e.prototype.getUserInfo=function(e){var t;return e===void 0&&(e={}),L(this,void 0,Promise,function(){var n,r,i,a,o;return R(this,function(s){switch(s.label){case 0:return n=this.getParamsByVersion(e,`USER_ME_URL`),(t=n.params)!=null&&t.query&&(r=new Ye(n.params.query),n.url+=`?${r.toString()}`),[4,this.config.request(n.url,{method:`GET`,withCredentials:!0,getCredentials:e.credentials?function(){return e.credentials}:void 0})];case 1:if((i=s.sent()).sub&&(i.uid=i.sub),i.providers?.length)try{typeof wx<`u`&&wx.getAccountInfoSync&&(a=wx.getAccountInfoSync().miniProgram?.appId,(o=i.providers.find(function(e){return e.id===a}))!=null&&o.provider_user_id&&(i.open_id=o.provider_user_id))}catch{}return[2,i]}})})},e.prototype.getWedaUserInfo=function(){return L(this,void 0,Promise,function(){return R(this,function(e){switch(e.label){case 0:return[4,this.config.request(t.WEDA_USER_URL,{method:`GET`,withCredentials:!0})];case 1:return[2,e.sent()]}})})},e.prototype.deleteMe=function(t){return L(this,void 0,Promise,function(){var n,r;return R(this,function(i){return n=this.getParamsByVersion(t,`USER_ME_URL`),r=`${n.url}?${e.parseParamsToSearch(n.params)}`,[2,this.config.request(r,{method:`DELETE`,withCredentials:!0})]})})},e.prototype.hasLoginState=function(){return L(this,void 0,Promise,function(){return R(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.config.credentialsClient.getAccessToken()];case 1:return e.sent(),[2,!0];case 2:return e.sent(),[2,!1];case 3:return[2]}})})},e.prototype.hasLoginStateSync=function(){return this.config.credentialsClient.getCredentialsSync()},e.prototype.getLoginState=function(){return L(this,void 0,Promise,function(){return R(this,function(e){return[2,this.config.credentialsClient.getCredentialsAsync()]})})},e.prototype.transByProvider=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(t.USER_TRANS_BY_PROVIDER_URL,{method:`PATCH`,body:e,withCredentials:!0})]})})},e.prototype.grantToken=function(e){return L(this,void 0,Promise,function(){var t;return R(this,function(n){return t=this.getParamsByVersion(e,`AUTH_TOKEN_URL`),[2,this.config.request(t.url,{method:`POST`,body:t.params})]})})},e.prototype.getProviders=function(){return L(this,void 0,Promise,function(){return R(this,function(e){return[2,this.config.request(t.PROVIDER_LIST,{method:`GET`,withCredentials:!0})]})})},e.prototype.unbindProvider=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(`${t.PROVIDER_UNBIND_URL}/${e.provider_id}`,{method:`DELETE`,withCredentials:!0})]})})},e.prototype.checkPassword=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(`${t.CHECK_PWD_URL}`,{method:`POST`,withCredentials:!0,body:e})]})})},e.prototype.editContact=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(`${t.BIND_CONTACT_URL}`,{method:`PATCH`,withCredentials:!0,body:e})]})})},e.prototype.setPassword=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(`${t.AUTH_SET_PASSWORD}`,{method:`PATCH`,withCredentials:!0,body:e})]})})},e.prototype.updatePasswordByOld=function(e){return L(this,void 0,Promise,function(){var t;return R(this,function(n){switch(n.label){case 0:return[4,this.sudo({password:e.old_password})];case 1:return t=n.sent(),[2,this.setPassword({sudo_token:t.sudo_token,new_password:e.new_password})]}})})},e.prototype.sudo=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(`${t.SUDO_URL}`,{method:`POST`,withCredentials:!0,body:e})]})})},e.prototype.sendVerificationCodeToCurrentUser=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return e.target=`CUR_USER`,[2,this.config.request(t.VERIFICATION_URL,{method:`POST`,body:e,withCredentials:!0,withCaptcha:!0})]})})},e.prototype.changeBoundProvider=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(`${t.PROVIDER_LIST}/${e.provider_id}/trans`,{method:`POST`,body:{provider_trans_token:e.trans_token},withCredentials:!0})]})})},e.prototype.setUserProfile=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(t.USER_PRIFILE_URL,{method:`PATCH`,body:e,withCredentials:!0})]})})},e.prototype.updateUserBasicInfo=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(t.USER_BASIC_EDIT_URL,{method:`POST`,withCredentials:!0,body:e})]})})},e.prototype.queryUserProfile=function(e){return L(this,void 0,Promise,function(){var n;return R(this,function(r){return n=new Ye(e),[2,this.config.request(`${t.USER_QUERY_URL}?${n.toString()}`,{method:`GET`,withCredentials:!0})]})})},e.prototype.setCustomSignFunc=function(e){this.getCustomSignTicketFn=e},e.prototype.signInWithCustomTicket=function(){return L(this,void 0,Promise,function(){var e,t;return R(this,function(n){switch(n.label){case 0:return(e=this.getCustomSignTicketFn)?[4,e()]:[2,Promise.reject({error:`failed_precondition`,error_description:`please use setCustomSignFunc to set custom sign function`})];case 1:return t=n.sent(),[2,this.signInCustom({provider_id:`custom`,ticket:t})]}})})},e.prototype.resetPassword=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(t.AUTH_RESET_PASSWORD,{method:`POST`,body:e})]})})},e.prototype.authorize=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(t.AUTHORIZE_URL,{method:`POST`,withCredentials:!0,body:e})]})})},e.prototype.authorizeDevice=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(t.AUTHORIZE_DEVICE_URL,{method:`POST`,withCredentials:!0,body:e})]})})},e.prototype.deviceAuthorize=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(t.AUTH_GET_DEVICE_CODE,{method:`POST`,body:e})]})})},e.prototype.authorizeInfo=function(n){return L(this,void 0,Promise,function(){var r,i,a;return R(this,function(o){switch(o.label){case 0:return r=`${t.AUTHORIZE_INFO_URL}?${e.parseParamsToSearch(n)}`,i=!0,a=!1,[4,this.hasLoginState()];case 1:return o.sent()&&(a=!0,i=!1),[2,this.config.request(r,{method:`GET`,withBasicAuth:i,withCredentials:a})]}})})},e.prototype.checkUsername=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(t.CHECK_USERNAME,{method:`GET`,body:e,withCredentials:!0})]})})},e.prototype.checkIfUserExist=function(e){return L(this,void 0,Promise,function(){var n;return R(this,function(r){return n=new Ye(e),[2,this.config.request(`${t.CHECK_IF_USER_EXIST}?${n.toString()}`,{method:`GET`})]})})},e.prototype.loginScope=function(){return L(this,void 0,Promise,function(){return R(this,function(e){return[2,this.config.credentialsClient.getScope()]})})},e.prototype.loginGroups=function(){return L(this,void 0,Promise,function(){return R(this,function(e){return[2,this.config.credentialsClient.getGroups()]})})},e.prototype.refreshTokenForce=function(e){return L(this,void 0,void 0,function(){var t;return R(this,function(n){switch(n.label){case 0:return[4,this.config.credentialsClient.getCredentials()];case 1:return t=n.sent(),[4,this.config.credentialsClient.refreshToken(tt(tt({},t),{version:e?.version||`v1`}))];case 2:return[2,n.sent()]}})})},e.prototype.getCredentials=function(){return L(this,void 0,void 0,function(){return R(this,function(e){return[2,this.config.credentialsClient.getCredentials()]})})},e.prototype.getPublicKey=function(){return L(this,void 0,Promise,function(){return R(this,function(e){return[2,this.config.request(n.AUTH_PUBLIC_KEY,{method:`POST`,body:{}})]})})},e.prototype.getEncryptParams=function(e){return L(this,void 0,Promise,function(){var t,n,r,i,a,o;return R(this,function(s){switch(s.label){case 0:return t=e.isEncrypt,delete e.isEncrypt,n=(0,w.I)(e),[4,nt(t,this.config.adapter)];case 1:if(!(r=s.sent()))return[2,e];i=``,a=``,s.label=2;case 2:return s.trys.push([2,4,,5]),[4,this.getPublicKey()];case 3:if(o=s.sent(),i=o.public_key,a=o.public_key_thumbprint,!i||!a)throw o;return[3,5];case 4:throw s.sent();case 5:return[2,{params:r.getEncryptInfo({publicKey:i,payload:n}),public_key_thumbprint:a}]}})})},e.prototype.getProviderSubType=function(){return L(this,void 0,Promise,function(){return R(this,function(e){return[2,this.config.request(t.GET_PROVIDER_TYPE,{method:`POST`,body:{provider_id:`weda`}})]})})},e.prototype.verifyCaptchaData=function(e){var n=e.token,r=e.key;return L(this,void 0,void 0,function(){return R(this,function(e){return[2,this.config.request(t.VERIFY_CAPTCHA_DATA_URL,{method:`POST`,body:{token:n,key:r},withCredentials:!1})]})})},e.prototype.createCaptchaData=function(e){var n=e.state,r=e.redirect_uri,i=r===void 0?void 0:r;return L(this,void 0,void 0,function(){return R(this,function(e){return[2,this.config.request(t.CAPTCHA_DATA_URL,{method:`POST`,body:{state:n,redirect_uri:i},withCredentials:!1})]})})},e.prototype.getMiniProgramCode=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(t.GET_MINIPROGRAM_QRCODE,{method:`POST`,body:e})]})})},e.prototype.getMiniProgramQrCodeStatus=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(t.GET_MINIPROGRAM_QRCODE_STATUS,{method:`POST`,body:e})]})})},e.prototype.getUserBehaviorLog=function(e){return L(this,void 0,Promise,function(){var n,r;return R(this,function(i){return n={LOGIN:`query[action]=USER_LOGIN`,MODIFY:`ne_query[action]=USER_LOGIN`},r=`${t.GET_USER_BEHAVIOR_LOG}?${n[e.type]}&limit=${e.limit}${e.page_token?`&page_token=${e.page_token}`:``}`,[2,this.config.request(r,{method:`GET`,withCredentials:!0})]})})},e.prototype.modifyPassword=function(e){return L(this,void 0,Promise,function(){var n,r,i,a,o,s;return R(this,function(c){switch(c.label){case 0:return n=``,r=``,[4,nt(!0,this.config.adapter)];case 1:if(!(i=c.sent()))throw Error(`do not support encrypt, a encrypt util required.`);c.label=2;case 2:return c.trys.push([2,4,,5]),[4,this.getPublicKey()];case 3:if(a=c.sent(),n=a.public_key,r=a.public_key_thumbprint,!n||!r)throw a;return[3,5];case 4:throw c.sent();case 5:return o=e.password?i.getEncryptInfo({publicKey:n,payload:e.password}):``,s=i.getEncryptInfo({publicKey:n,payload:e.new_password}),[2,this.config.request(t.USER_BASIC_EDIT_URL,{method:`POST`,withCredentials:!0,body:{user_id:e.user_id,encrypt_password:o,encrypt_new_password:s,public_key_thumbprint:r}})]}})})},e.prototype.modifyPasswordWithoutLogin=function(e){return L(this,void 0,Promise,function(){var t,r,i,a,o,s;return R(this,function(c){switch(c.label){case 0:return t=``,r=``,[4,nt(!0,this.config.adapter)];case 1:if(!(i=c.sent()))throw Error(`do not support encrypt, a encrypt util required.`);c.label=2;case 2:return c.trys.push([2,4,,5]),[4,this.getPublicKey()];case 3:if(a=c.sent(),t=a.public_key,r=a.public_key_thumbprint,!t||!r)throw a;return[3,5];case 4:throw c.sent();case 5:return o=e.password?i.getEncryptInfo({publicKey:t,payload:e.password}):``,s=i.getEncryptInfo({publicKey:t,payload:e.new_password}),[2,this.config.request(n.AUTH_RESET_PASSWORD,{method:`POST`,body:{username:e.username,password:o,new_password:s,public_key_thumbprint:r}})]}})})},e.prototype.restoreUrlState=function(e,t){if(e!==void 0)try{var n=new URL(window.location.href);n.search=e,n.hash=t||``,window.history.replaceState(null,``,n.toString()),window.location.replace(n.toString())}catch{}},e}(),it=function(){return it=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},it.apply(this,arguments)},at=function(){function e(e){var t=e.apiOrigin,n=e.getApiOrigin,r=e.apiPath,i=r===void 0?s:r,a=e.clientId,o=e.env,c=e.storage,l=e.request,u=e.baseRequest,d=e.anonymousSignInFunc,f=e.wxCloud,p=e.adapter,m=e.onCredentialsError,h=e.headers,g=e.i18n,_=e.useWxCloud,v=e.eventBus,y=e.detectSessionInUrl,b=e.debug;if(this.detectSessionInUrl=y!=null&&y,this.oauth2client=new Pe({apiOrigin:t,getApiOrigin:n,apiPath:i,clientId:a,env:o,storage:c,baseRequest:u||l,anonymousSignInFunc:d,wxCloud:f,onCredentialsError:m,headers:h||{},i18n:g,useWxCloud:_,eventBus:v,debug:b}),this.authApi=new rt(it(it({credentialsClient:this.oauth2client},e),{request:l?this.oauth2client.request.bind(this.oauth2client):void 0,adapter:p})),y)this.oauth2client.setGetInitialSession(this.authApi.getInitialSession.bind(this.authApi));else try{var x=new URL(window.location.href),S=x.searchParams.get(`code`),C=x.searchParams.get(`state`),w=JSON.parse(sessionStorage.getItem(C)||`null`);S&&C&&w!=null&&w.hash&&(x.hash=w.hash,window.history.replaceState(null,``,x.toString()),window.location.replace(x.toString()))}catch{}}return e.prototype.initializeSession=function(e){this.detectSessionInUrl?(this.oauth2client.setOnInitialSessionObtained(e),this.oauth2client.initialize()):this.oauth2client.initialize(Promise.resolve({error:null}))},e}(),z=io(794),ot=io(141),st=io(197);let ct=(e=>{var t={};return io.d(t,e),t})({default:()=>gi});var lt=io(182),ut=function(){return ut=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ut.apply(this,arguments)},dt=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},ft=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},pt=function(){function e(e){try{this.localStorage=e?.localStorage||(e?.adapter?.root?.globalThis||globalThis).localStorage}catch{this.localStorage=e?.localStorage||{}}}return e.prototype.getItem=function(e){return dt(this,void 0,Promise,function(){return ft(this,function(t){return[2,this.localStorage.getItem(e)]})})},e.prototype.removeItem=function(e){return dt(this,void 0,void 0,function(){return ft(this,function(t){return this.localStorage.removeItem(e),[2]})})},e.prototype.setItem=function(e,t){return dt(this,void 0,Promise,function(){return ft(this,function(n){return this.localStorage.setItem(e,t),[2]})})},e.prototype.getItemSync=function(e){return this.localStorage.getItem(e)},e.prototype.setItemSync=function(e,t){this.localStorage.setItem(e,t)},e.prototype.removeItemSync=function(e){this.localStorage.removeItem(e)},e}(),mt=/^[^:]+:\/\/[^/]+(\/[^?#]+)/,ht=function(e,t){var n,r,i=t?.headers?.[`x-request-id`];return e||={},(e!=null&&e.code||(n=e?.data)!=null&&n.error_code)&&(e={error:e.code||e.data.error,error_description:e.data.error_description||e.message||e.code||e.data.error_code,request_id:e.requestId,error_code:e.data?.error_code}),e!=null&&e.request_id||(e.request_id=e.request_id||i),e?.error?(e.error_uri=(r=t?.url,mt.test(r)?RegExp.$1:r),e):e?.data||{}},gt=function(e){return e.adapter&&e.adapter.type!=="default"?function(e,t){var n=ut({},e);try{if(!(e!=null&&e.storage)&&t!=null&&t.localStorage&&(n.storage=new pt({localStorage:t.localStorage,adapter:t})),!e.captchaOptions&&t!=null&&t.captchaOptions&&(n.captchaOptions=t.captchaOptions),!e.baseRequest&&!e.request&&t?.reqClass){var r={timeout:1e4,restrictedMethods:[`get`,`post`,`upload`,`download`,`request`],auth:e.auth},i=new t.reqClass(r);n.baseRequest=function(e,t){var n,r,a;return dt(this,void 0,void 0,function(){var o,s,c,l;return ft(this,function(u){switch(u.label){case 0:if(o={},s=t.method?.toLocaleLowerCase()||`post`,typeof(c=((n=i?.[s])?.bind)?.call(n,i))!=`function`)throw Error(`invalid 【${s}】 request method`);u.label=1;case 1:return u.trys.push([1,3,,4]),(r=t.headers)!=null&&r[`content-type`]&&!((a=t.headers)!=null&&a[`content-type`].includes(`application/json`))||[`string`,`undefined`].includes(typeof t.body)||(t.data=t.data||t.body,t.body=JSON.stringify(t.body)),[4,c(ut({url:e},t))];case 2:return o=u.sent(),o=ht(o,ut(ut({},t),{url:e})),[3,4];case 3:throw l=u.sent(),o=ut(ut({},l?.data),l);case 4:if(o?.error)throw o;return[2,o]}})})}}}catch(e){console.error(`user adapter generate fail:`,e)}return n}(e,e.adapter):function(e,t){var n=ut({},e),r={};if(t!=null&&t.captchaOptions&&(n.captchaOptions=t.captchaOptions),!ct.default.isMatch()||e.storage&&e.baseRequest)return n;try{var i=ct.default.genAdapter({}),a=i.localStorage,o=i.reqClass;return a&&(r.storage=new pt({localStorage:a,adapter:t})),o&&(r.request=function(e){return function(t,n){return dt(this,void 0,void 0,function(){return ft(this,function(r){return[2,new Promise(function(r,i){var a=Object.assign({},n);a.body&&typeof a.body!=`string`&&(a.body=JSON.stringify(a.body));var o=wx.request({url:t,data:a.body,timeout:e._timeout,method:a.method||`GET`,header:a.headers,success:function(e){(e=ht(e,ut(ut({},n),{url:t}))).error&&i(e),r(e)},fail:function(e){i({error:`unreachable`,error_description:e.message})},complete:function(t){if(t&&t.errMsg&&e._timeout&&e._restrictedMethods.indexOf(`request`)!==-1&&t.errMsg===`request:fail timeout`){console.warn(e._timeoutMsg);try{o.abort()}catch{}}}})})]})})}}(new o({timeout:1e4,restrictedMethods:[`get`,`post`,`upload`,`download`,`request`]}))),n.captchaOptions&&(r.baseRequest=r.request,r.request=void 0),ut(ut({},n),r)}catch(e){console.error(`adapter generate fail:`,e)}return n}(e,e.adapter)},_t=function(){return _t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},_t.apply(this,arguments)},vt=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},yt=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},bt=function(){function e(e){}return e.prototype.signInWithRedirect=function(){throw Error(`[v1 兼容] WeixinAuthProvider.signInWithRedirect() 在当前版本中无法实现。 建议使用 auth.signInWithOAuth({ provider: 'providerId' }) 替代。`)},e.prototype.getRedirectResult=function(e){return vt(this,void 0,Promise,function(){return yt(this,function(e){throw Error(`[v1 兼容] WeixinAuthProvider.getRedirectResult() 在当前版本中无法实现。 建议使用 auth.verifyOAuth({ code, state, provider }) 替代。`)})})},e.prototype.getLinkRedirectResult=function(e){return vt(this,void 0,Promise,function(){return yt(this,function(e){throw Error(`[v1 兼容] WeixinAuthProvider.getLinkRedirectResult() 在当前版本中无法实现。 建议使用 auth.linkIdentity({ provider: 'providerId' }) 替代。`)})})},e}(),xt=function(){function e(e){this.authInstance=e.authInstance}return e.prototype.signIn=function(e){return vt(this,void 0,Promise,function(){return yt(this,function(t){switch(t.label){case 0:return[4,this.authInstance.signInWithCustomTicket(function(){return Promise.resolve(e)})];case 1:return t.sent(),[2]}})})},e}(),St=function(){function e(e){this.authInstance=e.authInstance}return e.prototype.signIn=function(){return vt(this,void 0,Promise,function(){return yt(this,function(e){switch(e.label){case 0:return[4,this.authInstance.signInAnonymously({})];case 1:return e.sent(),[2]}})})},e}(),Ct=function(){function e(){}return e.prototype.weixinAuthProvider=function(e){return new bt({authInstance:this,appid:e.appid,scope:e.scope})},e.prototype.customAuthProvider=function(){return new xt({authInstance:this})},e.prototype.anonymousAuthProvider=function(){return new St({authInstance:this})},e.prototype.signUpWithEmailAndPassword=function(e,t){return vt(this,void 0,Promise,function(){return yt(this,function(n){switch(n.label){case 0:return typeof e!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`email must be a string`),typeof t!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`password must be a string`),[4,this.signUp({email:e,password:t})];case 1:return[2,n.sent()]}})})},e.prototype.signInWithEmailAndPassword=function(e,t){return vt(this,void 0,Promise,function(){return yt(this,function(n){switch(n.label){case 0:return typeof e!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`email must be a string`),typeof t!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`password must be a string`),[4,this.signIn({username:e,password:t})];case 1:return n.sent(),[2,this.createLoginState()]}})})},e.prototype.sendPasswordResetEmail=function(e){return vt(this,void 0,Promise,function(){return yt(this,function(t){switch(t.label){case 0:return typeof e!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`email must be a string`),[4,this.getVerification({email:e})];case 1:return t.sent(),[2]}})})},e.prototype.signInWithUsernameAndPassword=function(e,t){return vt(this,void 0,Promise,function(){return yt(this,function(n){switch(n.label){case 0:return typeof e!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`username must be a string`),typeof t!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`password must be a string`),[4,this.signIn({username:e,password:t})];case 1:return n.sent(),[2,this.createLoginState()]}})})},e.prototype.sendPhoneCode=function(e){return vt(this,void 0,Promise,function(){var t;return yt(this,function(n){switch(n.label){case 0:return typeof e!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`phoneNumber must be a string`),t=this.formatPhone(e),[4,this.getVerification({phone_number:t})];case 1:return n.sent(),[2,!0]}})})},e.prototype.signUpWithPhoneCode=function(e,t,n){return vt(this,void 0,Promise,function(){var r;return yt(this,function(i){switch(i.label){case 0:return typeof e!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`phoneNumber must be a string`),typeof t!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`phoneCode must be a string`),r=this.formatPhone(e),[4,this.signUp(_t({phone_number:r,verification_code:t},n?{password:n}:{}))];case 1:return i.sent(),[2,this.createLoginState()]}})})},e.prototype.signInWithPhoneCodeOrPassword=function(e){return vt(this,void 0,Promise,function(){var t,n,r,i;return yt(this,function(a){switch(a.label){case 0:return t=e.phoneNumber,n=e.phoneCode,r=e.password,typeof t!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`phoneNumber must be a string`),i=this.formatPhone(t),r?[4,this.signIn({username:i,password:r})]:[3,2];case 1:return a.sent(),[3,5];case 2:return n?[4,this.signIn({username:i,verification_token:n})]:[3,4];case 3:return a.sent(),[3,5];case 4:(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`phoneCode or password must be provided`),a.label=5;case 5:return[2,this.createLoginState()]}})})},e.prototype.forceResetPwdByPhoneCode=function(e){return vt(this,void 0,Promise,function(){var t,n,r,i;return yt(this,function(a){switch(a.label){case 0:return t=e.phoneNumber,n=e.phoneCode,r=e.password,typeof t!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`phoneNumber must be a string`),typeof n!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`phoneCode must be a string`),typeof r!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`password must be a string`),i=this.formatPhone(t),[4,this.resetPassword({phone_number:i,new_password:r,verification_token:n})];case 1:return a.sent(),[4,this.signIn({username:i,password:r})];case 2:return a.sent(),[2,this.createLoginState()]}})})},e.prototype.shouldRefreshAccessToken=function(e){throw Error(`[v1 兼容] shouldRefreshAccessToken() 在当前版本中无法实现。 建议使用 auth.onAuthStateChange(callback) 来监听 TOKEN_REFRESHED 事件替代。`)},e.prototype.onLoginStateExpired=function(e){var t=this;this.onLoginStateChanged(function(n){n?.eventType===u&&e.call(t)})},e.prototype.onAccessTokenRefreshed=function(e){var t=this;this.onAuthStateChange(function(n){n===m&&e.call(t)})},e.prototype.onAnonymousConverted=function(e){var t=this;this.onAuthStateChange(function(n){n===f&&e.call(t)})},e.prototype.onLoginTypeChanged=function(e){var t=this;this.onAuthStateChange(function(n){n!==f&&n!==d||e.call(t)})},e}(),wt=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),B=function(){return B=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},B.apply(this,arguments)},Tt=function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},V=function(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)},H=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},U=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},Et=function(){return typeof window<`u`&&typeof document<`u`},Dt=function(e){return function(t){e.fire(_,B(B({},t),{eventType:u}))}},Ot=[`avatar_url`,`avatarUrl`];function kt(e){return typeof TextEncoder<`u`?new TextEncoder().encode(e).length:e.length}function At(e,t){if(e)for(var n=0,r=Ot;n<r.length;n++){var i=r[n],o=e[i];if(o!=null&&o!==``){var s=kt(String(o));if(s>204800)throw new I({error:`invalid_argument`,error_code:a.INVALID_ARGUMENT,error_description:`auth.${t}(params): "${i}" 超过 200KB 限制(当前 ${s} 字节),请传入图片 URL 而非文件内容`},{method:t})}}}var jt,Mt=function(){function t(e){var t=e.cache,n=e.oauthInstance;this.cache=t,this.oauthInstance=n,this.setUserInfo()}var n,r,i;return t.prototype.checkLocalInfo=function(){return H(this,void 0,void 0,function(){return U(this,function(e){return this.uid=this.getLocalUserInfo(`uid`),this.gender=this.getLocalUserInfo(`gender`),this.picture=this.getLocalUserInfo(`picture`),this.email=this.getLocalUserInfo(`email`),this.emailVerified=this.getLocalUserInfo(`email_verified`),this.phoneNumber=this.getLocalUserInfo(`phone_number`),this.username=this.getLocalUserInfo(`username`),this.name=this.getLocalUserInfo(`name`),this.birthdate=this.getLocalUserInfo(`birthdate`),this.zoneinfo=this.getLocalUserInfo(`zoneinfo`),this.locale=this.getLocalUserInfo(`locale`),this.sub=this.getLocalUserInfo(`sub`),this.createdFrom=this.getLocalUserInfo(`created_from`),this.providers=this.getLocalUserInfo(`providers`),[2]})})},t.prototype.checkLocalInfoAsync=function(){return H(this,void 0,void 0,function(){var e,t,n,r;return U(this,function(i){switch(i.label){case 0:return e=this,[4,this.getLocalUserInfoAsync(`uid`)];case 1:return e.uid=i.sent(),t=this,[4,this.getLocalUserInfoAsync(`gender`)];case 2:return t.gender=i.sent(),this.picture=this.getLocalUserInfo(`picture`),n=this,[4,this.getLocalUserInfoAsync(`email`)];case 3:return n.email=i.sent(),this.emailVerified=this.getLocalUserInfo(`email_verified`),this.phoneNumber=this.getLocalUserInfo(`phone_number`),r=this,[4,this.getLocalUserInfoAsync(`username`)];case 4:return r.username=i.sent(),this.name=this.getLocalUserInfo(`name`),this.birthdate=this.getLocalUserInfo(`birthdate`),this.zoneinfo=this.getLocalUserInfo(`zoneinfo`),this.locale=this.getLocalUserInfo(`locale`),this.sub=this.getLocalUserInfo(`sub`),this.createdFrom=this.getLocalUserInfo(`created_from`),this.providers=this.getLocalUserInfo(`providers`),[2]}})})},t.prototype.update=function(e){return H(this,void 0,Promise,function(){var t;return U(this,function(n){switch(n.label){case 0:return At(e,`update`),[4,this.oauthInstance.authApi.setUserProfile(B({},e))];case 1:return t=n.sent(),this.setLocalUserInfo(t),[2]}})})},t.prototype.updateUserBasicInfo=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){switch(t.label){case 0:return At(e,`updateUserBasicInfo`),[4,this.oauthInstance.authApi.updateUserBasicInfo(B({},e))];case 1:return t.sent(),[4,this.refresh()];case 2:return t.sent(),[2]}})})},t.prototype.updatePassword=function(e,t){return this.oauthInstance.authApi.updatePasswordByOld({old_password:t,new_password:e})},t.prototype.updateUsername=function(e){return typeof e!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`username must be a string`),this.update({username:e})},t.prototype.refresh=function(e){return H(this,void 0,Promise,function(){var t;return U(this,function(n){switch(n.label){case 0:return[4,this.oauthInstance.authApi.getUserInfo(e)];case 1:if((t=n.sent()).code===`INVALID_ACCESS_TOKEN`)throw this.setLocalUserInfo({}),t;return this.setLocalUserInfo(t),[2,t]}})})},t.prototype.getLocalUserInfo=function(e){var t=this.cache.keys.userInfoKey,n=this.cache.getStore(t);return e?n[e]:n||{}},t.prototype.setLocalUserInfo=function(e){var t=this.cache.keys.userInfoKey;this.cache.setStore(t,e),this.setUserInfo()},t.prototype.getLocalUserInfoAsync=function(e){return H(this,void 0,Promise,function(){var t;return U(this,function(n){switch(n.label){case 0:return t=this.cache.keys.userInfoKey,[4,this.cache.getStoreAsync(t)];case 1:return[2,n.sent()[e]]}})})},t.prototype.setUserInfo=function(){var e=this,t=this.cache.keys.userInfoKey,n=this.cache.getStore(t);[`uid`,`email`,`name`,`gender`,`picture`,`email_verified`,`phone_number`,`birthdate`,`zoneinfo`,`locale`,`sub`,`created_from`,`providers`,`username`,`created_at`,`open_id`].forEach(function(t){e[t]=n[t]})},Tt([(0,ot.catchErrorsDecorator)({title:`更新用户信息失败`,messages:[`请确认以下各项:`,` 1 - 调用 User.update() 的语法或参数是否正确`,` 2 - 用户信息中是否包含非法值`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[typeof(n=e.UserProfile)==`function`?n:Object]),V(`design:returntype`,typeof(r=typeof Promise<`u`&&Promise)==`function`?r:Object)],t.prototype,`update`,null),Tt([(0,ot.catchErrorsDecorator)({title:`更新密码失败`,messages:[`请确认以下各项:`,` 1 - 调用 User.updatePassword() 的语法或参数是否正确`,` 3 - 新密码中是否包含非法字符`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[String,String]),V(`design:returntype`,void 0)],t.prototype,`updatePassword`,null),Tt([(0,ot.catchErrorsDecorator)({title:`更新用户名失败`,messages:[`请确认以下各项:`,` 1 - 调用 User.updateUsername() 的语法或参数是否正确`,` 2 - 当前环境是否开通了用户名密码登录`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[String]),V(`design:returntype`,void 0)],t.prototype,`updateUsername`,null),Tt([(0,ot.catchErrorsDecorator)({title:`刷新本地用户信息失败`,messages:[`请确认以下各项:`,` 1 - 调用 User.refresh() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[Object]),V(`design:returntype`,typeof(i=typeof Promise<`u`&&Promise)==`function`?i:Object)],t.prototype,`refresh`,null),t}();(jt=Mt).prototype.linkWithTicket=function(e){return vt(this,void 0,Promise,function(){return yt(this,function(e){throw Error(`[v1 兼容] User.linkWithTicket() 在当前版本中无法实现。 建议使用 auth.signInWithCustomTicket(() => Promise.resolve(ticket)) 替代。`)})})},jt.prototype.linkWithRedirect=function(e){throw Error(`[v1 兼容] User.linkWithRedirect() 在当前版本中无法实现。 建议使用 auth.linkIdentity({ provider: 'providerId' }) 替代。`)},jt.prototype.updateEmail=function(e,t){return vt(this,void 0,Promise,function(){return yt(this,function(t){switch(t.label){case 0:return typeof e!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`newEmail must be a string`),[4,this.updateUserBasicInfo({email:e})];case 1:return t.sent(),[2]}})})},jt.prototype.linkWithPhoneNumber=function(e,t){return vt(this,void 0,Promise,function(){return yt(this,function(e){throw Error(`[v1 兼容] User.linkWithPhoneNumber() 在当前版本中无法实现。 建议使用 auth.bindPhoneNumber({ phone_number, verification_token, sudo_token }) 替代。`)})})},jt.prototype.updatePhoneNumber=function(e,t){return vt(this,void 0,Promise,function(){return yt(this,function(e){throw Error(`[v1 兼容] User.updatePhoneNumber() 在当前版本中无法实现。 建议使用 auth.updateUser({ phone: newPhoneNumber }) 替代。`)})})},jt.prototype.unlink=function(e){return vt(this,void 0,Promise,function(){return yt(this,function(e){throw Error(`[v1 兼容] User.unlink() 在当前版本中无法实现。 建议使用 auth.unlinkIdentity({ provider: loginType }) 替代。`)})})};var Nt=function(){function e(e){var t=e.envId,n=e.cache,r=e.oauthInstance;t||(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`envId is not defined`),this.cache=n,this.oauthInstance=r,this.user=new Mt({cache:this.cache,oauthInstance:r})}return e.prototype.checkLocalState=function(){this.oauthLoginState=this.oauthInstance?.authApi.hasLoginStateSync(),this.user.checkLocalInfo()},e.prototype.checkLocalStateAsync=function(){return H(this,void 0,void 0,function(){return U(this,function(e){switch(e.label){case 0:return[4,this.oauthInstance?.authApi.getLoginState()];case 1:return e.sent(),[4,this.user.checkLocalInfoAsync()];case 2:return e.sent(),[2]}})})},e}(),Pt=function(t){function n(e){var n=t.call(this)||this;return n.listeners=new Map,n.hasListenerSetUp=!1,n.config=e,n.oauthInstance=e.oauthInstance,n.cache=e.cache,n.init(),n.setAccessKey(),n}var r,i,a,o,s,l,d,m,g,b,C,w,T,E,D,ee,te,O,A,ne,re;return wt(n,t),n.prototype.signInAnonymously=function(e){return H(this,void 0,Promise,function(){var t,n,r,i,a;return U(this,function(o){switch(o.label){case 0:return o.trys.push([0,4,,5]),[4,this.oauthInstance.authApi.signInAnonymously(e)];case 1:return o.sent(),[4,this.createLoginState()];case 2:return t=o.sent(),[4,this.getSession()];case 3:return n=o.sent().data,r=(n===void 0?{}:n).session,[2,B(B({},t),{data:{user:r.user,session:r},error:null})];case 4:return i=o.sent(),(a=new I(i,{method:`signInAnonymously`})).category===F.PROVIDER_NOT_ENABLED?(console.error(a.helpMessage),console.error(`[CloudBase Auth] 提示:匿名登录需要在控制台开启「匿名登录」。
|
|
168
168
|
如果您需要使用用户名密码登录,请改用 auth.signInWithPassword({ username, password })。
|
|
169
|
-
不要在匿名登录失败后自动回退到密码登录,这两种方式的使用场景不同。`)):(console.warn(`[CloudBase Auth] signInAnonymously 失败 [${a.category}]: ${a.message}`),a.loginMethodHint&&console.warn(a.loginMethodHint)),[2,{data:{user:null,session:null},error:a}];case 5:return[2]}})})},n.prototype.signUp=function(e){return H(this,void 0,Promise,function(){var t,n,r=this;return U(this,function(i){switch(i.label){case 0:return e.phone_number||e.verification_code||e.verification_token||e.provider_token?(e.phone_number&&=this.formatPhone(e.phone_number),[4,this.oauthInstance.authApi.signUp(e)]):[3,2];case 1:return i.sent(),[2,this.createLoginState()];case 2:return i.trys.push([2,4,,5]),this.validateAtLeastOne(e,[[`email`],[`phone`]],`signUp`),[4,this.getVerification(e.email?{email:e.email,usage:c.EMAIL}:{phone_number:this.formatPhone(e.phone)})];case 3:return t=i.sent(),[2,{data:{verifyOtp:function(n){var i=n.token,a=n.messageId,o=a===void 0?t.verification_id:a;return H(r,void 0,Promise,function(){var n,r,a,s,c;return U(this,function(l){switch(l.label){case 0:return l.trys.push([0,8,,9]),[4,this.verify({verification_id:o||t.verification_id,verification_code:String(i)})];case 1:return n=l.sent(),t.is_user?[4,this.signIn({username:e.email||this.formatPhone(e.phone),verification_token:n.verification_token})]:[3,3];case 2:return l.sent(),[3,6];case 3:return delete(r=JSON.parse(JSON.stringify(e))).email,delete r.phone,[4,this.oauthInstance.authApi.signUp(B(B(B({},r),e.email?{email:e.email}:{phone_number:this.formatPhone(e.phone)}),{verification_token:n.verification_token,verification_code:i}))];case 4:return l.sent(),[4,this.createLoginState()];case 5:l.sent(),l.label=6;case 6:return[4,this.getSession()];case 7:return a=l.sent().data,[2,{data:{user:(s=(a===void 0?{}:a).session).user,session:s},error:null}];case 8:return c=l.sent(),[2,{data:{user:null,session:null},error:new I(c,{method:`signUp`})}];case 9:return[2]}})})}},error:null}];case 4:return n=i.sent(),[2,{data:{user:null,session:null},error:new I(n,{method:`signUp`})}];case 5:return[2]}})})},n.prototype.signOut=function(e){return H(this,void 0,Promise,function(){var t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),t=this.cache.keys.userInfoKey,[4,this.oauthInstance.authApi.signOut(e)];case 1:return n=i.sent(),[4,this.cache.removeStoreAsync(t)];case 2:return i.sent(),this.setAccessKey(),[2,B(B({},n),{data:{},error:null})];case 3:return r=i.sent(),[2,{data:{},error:new I(r,{method:`signOut`})}];case 4:return[2]}})})},n.prototype.onAuthStateChange=function(e){var t=this;this.hasListenerSetUp||=(this.setupListeners(),!0);var n=Math.random().toString(36);return this.listeners.has(n)||this.listeners.set(n,new Set),this.listeners.get(n).add(e),{data:{subscription:{id:n,callback:e,unsubscribe:function(){var r=t.listeners.get(n);r&&(r.delete(e),r.size===0&&t.listeners.delete(n))}}}}},n.prototype.signInWithPassword=function(e){return H(this,void 0,Promise,function(){var t,n,r,i,a,o,s,c;return U(this,function(l){switch(l.label){case 0:return l.trys.push([0,3,,4]),this.validateAtLeastOne(e,[[`username`],[`email`],[`phone`]],`signInWithPassword`),this.validateParams(e,{password:{required:!0,message:`Password is required`}},`signInWithPassword`),t=`username`in e?e.username:void 0,n=`email`in e?e.email:void 0,r=`phone`in e?e.phone:void 0,i=e.options?.is_encrypt??e.is_encrypt,[4,this.signIn(B({username:t||n||this.formatPhone(r),password:e.password},i?{isEncrypt:!0,version:`v2`}:{}))];case 1:return l.sent(),[4,this.getSession()];case 2:return a=l.sent().data,[2,{data:{user:(o=(a===void 0?{}:a).session).user,session:o},error:null}];case 3:return s=l.sent(),(c=new I(s,{method:`signInWithPassword`})).category===F.PROVIDER_NOT_ENABLED?console.error(c.helpMessage):c.category===F.INVALID_CREDENTIALS||c.category===F.USER_NOT_FOUND?console.warn(c.helpMessage):console.warn(`[CloudBase Auth] signInWithPassword 失败 [${c.category}]: ${c.message}`),c.loginMethodHint&&console.info(c.loginMethodHint),[2,{data:{user:null,session:null},error:c}];case 4:return[2]}})})},n.prototype.signInWithIdToken=function(e){return H(this,void 0,Promise,function(){var t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),this.validateParams(e,{token:{required:!0,message:`Token is required`}},`signInWithIdToken`),[4,this.signInWithProvider({provider_id:e.provider,provider_id_token:e.token})];case 1:return i.sent(),[4,this.getSession()];case 2:return t=i.sent().data,[2,{data:{user:(n=(t===void 0?{}:t).session).user,session:n},error:null}];case 3:return r=i.sent(),[2,{data:{user:null,session:null},error:new I(r,{method:`signInWithIdToken`})}];case 4:return[2]}})})},n.prototype.signInWithOtp=function(e){return H(this,void 0,Promise,function(){var t,n,r,i,a,o=this;return U(this,function(s){switch(s.label){case 0:if(t=e.options,n=`email`in e?e.email:void 0,r=`phone`in e?e.phone:void 0,!t?.emailRedirectTo&&(t?.shouldCreateUser===void 0||t?.shouldCreateUser))return[2,this.signUp(n?{email:n}:{phone:r})];s.label=1;case 1:return s.trys.push([1,3,,4]),this.validateAtLeastOne(e,[[`email`],[`phone`]],`signInWithOtp`),[4,this.getVerification(B(B({email_redirect_to:t?.emailRedirectTo},n?{email:n,usage:c.EMAIL}:{phone_number:this.formatPhone(r)}),{target:t?.emailRedirectTo&&t?.shouldCreateUser?`ANY`:`USER`}))];case 2:return i=s.sent(),[2,{data:{user:null,session:null,verifyOtp:function(e){var t=e.token,a=e.messageId,s=a===void 0?i.verification_id:a;return H(o,void 0,Promise,function(){return U(this,function(e){return[2,this.verifyOtp(n?{email:n,token:String(t),messageId:s||``}:{phone:r,token:String(t),messageId:s||``})]})})}},error:null}];case 3:return a=s.sent(),[2,{data:{user:null,session:null},error:new I(a,{method:`signInWithOtp`})}];case 4:return[2]}})})},n.prototype.verifyOAuth=function(e){return H(this,void 0,Promise,function(){var t,n,r,i,a,o,s,c,l;return U(this,function(u){switch(u.label){case 0:t={},u.label=1;case 1:return u.trys.push([1,7,,8]),n=e?.code||ue(`code`),r=e?.state||ue(`state`),n?r?(i=function(e){try{return JSON.parse(sessionStorage.getItem(e))}catch(e){return console.error(`Failed to get browser session:`,e),null}}(r),t.type=i?.type,(a=e?.provider||i?.provider||ue(`provider`))?[4,this.grantProviderToken({provider_id:a,provider_redirect_uri:location.origin+location.pathname,provider_code:n})]:[2,{data:B(B({},t),{user:null,session:null,redirectUrl:null}),error:this.missingRequiredParam(`verifyOAuth`,`provider`)}]):[2,{data:{user:null,session:null,redirectUrl:null},error:this.missingRequiredParam(`verifyOAuth`,`state`)}]:[2,{data:{user:null,session:null,redirectUrl:null},error:this.missingRequiredParam(`verifyOAuth`,`code`)}];case 2:return o=u.sent().provider_token,s=void 0,i.type===x?[4,this.oauthInstance.authApi.toBindIdentity({provider_token:o,provider:a,fireEvent:!0})]:[3,4];case 3:return s=u.sent(),[3,6];case 4:return[4,this.signInWithIdToken({token:o})];case 5:(s=u.sent()).data=B(B({},t),s.data),u.label=6;case 6:return(c=new URLSearchParams(location==null?void 0:location.search)).delete(`code`),c.delete(`state`),s.data.redirectUrl=function(e,t){if(e!==void 0){var n=new URL(window.location.href);return n.search=e,n.hash=t||n.hash,window.history.replaceState({},``,n.href),n.href}}(i?.search===void 0?`?${c.toString()}`:i?.search,i?.hash||location.hash),function(e){try{return sessionStorage.removeItem(e),!0}catch(e){return console.error(`Failed to remove browser session:`,e),null}}(r),[2,s];case 7:return l=u.sent(),[2,{data:B(B({},t),{user:null,session:null,redirectUrl:null}),error:new I(l,{method:`verifyOAuth`})}];case 8:return[2]}})})},n.prototype.signInWithOAuth=function(e){var t,n;return H(this,void 0,Promise,function(){var r,i,a,o,s,c,l,u,d;return U(this,function(f){switch(f.label){case 0:return f.trys.push([0,2,,3]),this.validateParams(e,{provider:{required:!0,message:`Provider is required`}},`signInWithOAuth`),r=e.options?.redirectTo||location.href,i=new URL(r),a=i.origin+i.pathname,o=e.options?.state||`prd-${e.provider}-${Math.random().toString(36).slice(2)}`,[4,this.genProviderRedirectUri({provider_id:e.provider,provider_redirect_uri:a,state:o})];case 1:return s=f.sent().uri,c=decodeURIComponent(s),l=c,(t=e.options)!=null&&t.queryParams&&(u=new URL(c),Object.entries(e.options.queryParams).forEach(function(e){var t=e[0],n=e[1];u.searchParams.set(t,n)}),l=u.toString()),function(e,t){try{sessionStorage.setItem(e,JSON.stringify(t))}catch(e){console.error(`Failed to save to browser session:`,e)}}(o,{provider:e.provider,search:i.search,hash:i.hash,type:e.options?.type||y}),Et()&&!((n=e.options)!=null&&n.skipBrowserRedirect)&&window.location.assign(l),[2,{data:{url:l,provider:e.provider},error:null}];case 2:return d=f.sent(),[2,{data:{url:null,provider:null},error:new I(d,{method:`signInWithOAuth`})}];case 3:return[2]}})})},n.prototype.getClaims=function(){return H(this,void 0,Promise,function(){var e;return U(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.getAccessToken()];case 1:return[2,{data:function(e){if(typeof e!=`string`)throw Error(`Invalid token specified`);try{var t=e.split(`.`).map(function(e,t){return t===2?e:JSON.parse(function(e){var t=e.replace(/-/g,`+`).replace(/_/g,`/`);switch(t.length%4){case 0:break;case 2:t+=`==`;break;case 3:t+=`=`;break;default:throw Error(`Illegal base64url string!`)}try{return function(e){return decodeURIComponent(k(e).replace(/(.)/g,function(e){var t=e.charCodeAt(0).toString(16).toUpperCase();return t.length<2&&(t=`0${t}`),`%${t}`}))}(t)}catch{return k(t)}}(e))});return{claims:t[1],header:t[0],signature:t[2]}}catch(e){throw Error(`Invalid token specified: ${e}`?e.message:0)}}(t.sent().accessToken),error:null}];case 2:return e=t.sent(),[2,{data:{claims:null,header:null,signature:null},error:new I(e,{method:`getClaims`})}];case 3:return[2]}})})},n.prototype.resetPasswordForEmail=function(e,t){return H(this,void 0,Promise,function(){var n,r,i,a,o,s,l=this;return U(this,function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),this.validateParams({emailOrPhone:e},{emailOrPhone:{required:!0,message:`Email or phone is required`}},`resetPasswordForEmail`),n=(t||{}).redirectTo,r=e.includes(`@`),i=void 0,r?i={email:e,usage:c.RECOVERY}:(a=this.formatPhone(e),i={phone_number:a}),[4,this.getVerification(B(B({},i),{target:`USER`}))];case 1:return o=u.sent(),[2,{data:{updateUser:function(t){return H(l,void 0,Promise,function(){var i,a,s,c;return U(this,function(l){switch(l.label){case 0:this.validateParams(t,{nonce:{required:!0,message:`Nonce is required`},password:{required:!0,message:`Password is required`}},`resetPasswordForEmail`),l.label=1;case 1:return l.trys.push([1,5,,6]),[4,this.verify({verification_id:o.verification_id,verification_code:t.nonce})];case 2:return i=l.sent(),[4,this.oauthInstance.authApi.resetPassword({email:r?e:void 0,phone_number:r?void 0:e,new_password:t.password,verification_token:i.verification_token})];case 3:return l.sent(),(c=this.config.eventBus)==null||c.fire(v,{event:`PASSWORD_RECOVERY`}),[4,this.signInWithPassword({email:r?e:void 0,phone:r?void 0:e,password:t.password})];case 4:return a=l.sent(),n&&Et()&&window.location.assign(n),[2,a];case 5:return s=l.sent(),[2,{data:{user:null,session:null},error:new I(s,{method:`resetPasswordForEmail`})}];case 6:return[2]}})})}},error:null}];case 2:return s=u.sent(),[2,{data:{updateUser:null},error:new I(s,{method:`resetPasswordForEmail`})}];case 3:return[2]}})})},n.prototype.resetPasswordForOld=function(e){return H(this,void 0,Promise,function(){var t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,this.oauthInstance.authApi.updatePasswordByOld({old_password:e.old_password,new_password:e.new_password})];case 1:return i.sent(),[4,this.getSession()];case 2:return t=i.sent().data,[2,{data:{user:(n=(t===void 0?{}:t).session).user,session:n},error:null}];case 3:return r=i.sent(),[2,{data:{user:null,session:null},error:new I(r,{method:`resetPasswordForOld`})}];case 4:return[2]}})})},n.prototype.verifyOtp=function(e){return H(this,void 0,Promise,function(){var t,n,r,i,a,o,s;return U(this,function(c){switch(c.label){case 0:return c.trys.push([0,6,,7]),t=e.type,n=String(e.token),r=`email`in e?e.email:void 0,i=`phone`in e?e.phone:void 0,this.validateParams(e,{token:{required:!0,message:`Token is required`},messageId:{required:!0,message:`messageId is required`}},`verifyOtp`),[`phone_change`,`email_change`].includes(t)?[4,this.verify({verification_id:e.messageId,verification_code:n})]:[3,2];case 1:return c.sent(),[3,4];case 2:return[4,this.signInWithUsername({verificationInfo:{verification_id:e.messageId,is_user:!0},verificationCode:n,username:r||this.formatPhone(i)||``,loginType:r?`email`:`phone`})];case 3:c.sent(),c.label=4;case 4:return[4,this.getSession()];case 5:return a=c.sent().data,[2,{data:{user:(o=(a===void 0?{}:a).session).user,session:o},error:null}];case 6:return s=c.sent(),[2,{data:{user:null,session:null},error:new I(s,{method:`verifyOtp`})}];case 7:return[2]}})})},n.prototype.getSession=function(){return H(this,void 0,Promise,function(){var e,t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,this.oauthInstance.oauth2client.getCredentials()];case 1:return(e=i.sent())&&e.scope!==`accessKey`?[4,this.getUser(!1)]:[2,{data:{session:null,user:null},error:null}];case 2:return t=i.sent().data,n=(t===void 0?{}:t).user,[2,{data:{session:B(B({},e),{user:n}),user:n},error:null}];case 3:return r=i.sent(),[2,{data:{session:null,user:null},error:new I(r,{method:`getSession`})}];case 4:return[2]}})})},n.prototype.refreshSession=function(e){return H(this,void 0,Promise,function(){var t,n,r,i,a;return U(this,function(o){switch(o.label){case 0:return o.trys.push([0,4,,5]),[4,this.oauthInstance.oauth2client.localCredentials.getCredentials()];case 1:return(t=o.sent()).refresh_token=e||t.refresh_token,[4,this.oauthInstance.oauth2client.refreshToken(t)];case 2:return n=o.sent(),[4,this.getUser(!1)];case 3:return r=o.sent().data,[2,{data:{user:i=(r===void 0?{}:r).user,session:B(B({},n),{user:i})},error:null}];case 4:return a=o.sent(),[2,{data:{user:null,session:null},error:new I(a,{method:`refreshSession`})}];case 5:return[2]}})})},n.prototype.getUser=function(e){return e===void 0&&(e=!0),H(this,void 0,Promise,function(){var t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,this.oauthInstance.oauth2client.getCredentials()];case 1:return(t=i.sent())&&t.scope!==`accessKey`?(n=this.convertToUser,[4,this.getCurrentUser(e)]):[2,{data:{user:null},error:null}];case 2:return[2,{data:{user:n.apply(this,[i.sent()])},error:null}];case 3:return r=i.sent(),[2,{data:{user:null},error:new I(r,{method:`getUser`})}];case 4:return[2]}})})},n.prototype.refreshUser=function(){return H(this,void 0,Promise,function(){var e,t,n;return U(this,function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),[4,this.currentUser.refresh()];case 1:return r.sent(),[4,this.getSession()];case 2:return e=r.sent().data,[2,{data:{user:(t=(e===void 0?{}:e).session).user,session:t},error:null}];case 3:return n=r.sent(),[2,{data:{user:null,session:null},error:new I(n,{method:`refreshUser`})}];case 4:return[2]}})})},n.prototype.updateUser=function(e){var t;return H(this,void 0,Promise,function(){var n,r,i,a,o,s,l,u,d,f,p,m,g,_=this;return U(this,function(y){switch(y.label){case 0:if(y.trys.push([0,8,,9]),At(e,`updateUser`),n=[`password`,`new_password`].find(function(t){var n=e[t];return n!=null&&n!==``}))throw new I({message:`updateUser 不支持更新密码,检测到传入了 "${n}" 参数。如需修改密码请使用 resetPasswordForOld(旧密码修改)、resetPasswordForEmail(验证码重置)或 reauthenticate(重新认证后改密)`});if(!Object.keys(e).some(function(t){return e[t]!==void 0&&e[t]!==null&&e[t]!==``}))throw this.missingRequiredParam(`updateUser`,`(at least one field)`);return r=e.email,i=e.phone,a=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,[`email`,`phone`]),s=i!==void 0,l={},(o=r!==void 0)||s?(u=void 0,o?(u={email:e.email,usage:c.REAUTHENTICATION},d=`email_change`):(f=this.formatPhone(e.phone),u={phone_number:f},d=`phone_change`),[4,this.getVerification(B({},u))]):[3,4];case 1:return p=y.sent(),Object.keys(a).length>0?[4,this.updateUserBasicInfo(a)]:[3,3];case 2:y.sent(),y.label=3;case 3:return l={messageId:p.verification_id,verifyOtp:function(t){return H(_,void 0,Promise,function(){var n,r,i,a;return U(this,function(s){switch(s.label){case 0:return s.trys.push([0,11,,12]),t.email&&e.email===t.email?[4,this.verifyOtp({type:`email_change`,email:e.email,token:t.token,messageId:p.verification_id||``})]:[3,3];case 1:return(n=s.sent()).error?[2,n]:[4,this.updateUserBasicInfo({email:e.email})];case 2:return s.sent(),[3,9];case 3:return t.phone&&e.phone===t.phone?[4,this.verifyOtp({type:`phone_change`,phone:e.phone,token:t.token,messageId:p.verification_id||``})]:[3,6];case 4:return(n=s.sent()).error?[2,n]:[4,this.updateUserBasicInfo({phone:this.formatPhone(e.phone)})];case 5:return s.sent(),[3,9];case 6:return[4,this.verifyOtp(o?{type:d,email:e.email,token:t.token,messageId:p.verification_id||``}:{type:d,phone:e.phone,token:t.token,messageId:p.verification_id||``})];case 7:return(n=s.sent()).error?[2,n]:[4,this.updateUserBasicInfo(e)];case 8:s.sent(),s.label=9;case 9:return[4,this.getUser(!1)];case 10:return r=s.sent().data.user,(a=this.config.eventBus)==null||a.fire(v,{event:h}),[2,{data:{user:r},error:null}];case 11:return i=s.sent(),[2,{data:{user:null},error:new I(i,{method:`updateUser`})}];case 12:return[2]}})})}},[3,6];case 4:return[4,this.updateUserBasicInfo(e)];case 5:y.sent(),y.label=6;case 6:return[4,this.getUser(!1)];case 7:return m=y.sent().data.user,Object.keys(a).length>0&&((t=this.config.eventBus)==null||t.fire(v,{event:h})),[2,{data:B({user:m},l),error:null}];case 8:return g=y.sent(),[2,{data:{user:null},error:new I(g,{method:`updateUser`})}];case 9:return[2]}})})},n.prototype.getUserIdentities=function(){return H(this,void 0,Promise,function(){var e,t;return U(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.oauthInstance.authApi.getProviders()];case 1:return e=n.sent(),[2,{data:{identities:(e?.data)?.filter(function(e){return!!e.bind})},error:null}];case 2:return t=n.sent(),[2,{data:{identities:null},error:new I(t,{method:`getUserIdentities`})}];case 3:return[2]}})})},n.prototype.linkIdentity=function(e){return H(this,void 0,Promise,function(){var t;return U(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),this.validateParams(e,{provider:{required:!0,message:`Provider is required`}},`linkIdentity`),[4,this.signInWithOAuth({provider:e.provider,options:{type:x}})];case 1:return n.sent(),[2,{data:{provider:e.provider},error:null}];case 2:return t=n.sent(),[2,{data:{provider:null},error:new I(t,{method:`linkIdentity`})}];case 3:return[2]}})})},n.prototype.unlinkIdentity=function(e){return H(this,void 0,Promise,function(){var t;return U(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),this.validateParams(e,{provider:{required:!0,message:`Provider is required`}},`unlinkIdentity`),[4,this.oauthInstance.authApi.unbindProvider({provider_id:e.provider})];case 1:return n.sent(),[2,{data:{},error:null}];case 2:return t=n.sent(),[2,{data:{},error:new I(t,{method:`unlinkIdentity`})}];case 3:return[2]}})})},n.prototype.reauthenticate=function(){return H(this,void 0,Promise,function(){var e,t,n,r,i=this;return U(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this.getUser(!1)];case 1:return e=a.sent().data.user,this.validateAtLeastOne(e,[[`email`,`phone`]],`reauthenticate`),t=e.email?{email:e.email,usage:c.REAUTHENTICATION}:{phone_number:this.formatPhone(e.phone)},[4,this.getVerification(t)];case 2:return n=a.sent(),[2,{data:{updateUser:function(e){return H(i,void 0,Promise,function(){var r,i,a,o,s;return U(this,function(c){switch(c.label){case 0:this.validateParams(e,{nonce:{required:!0,message:`Nonce is required`}},`reauthenticate`),c.label=1;case 1:return c.trys.push([1,9,,10]),e.password?[4,this.verify({verification_id:n.verification_id,verification_code:e.nonce})]:[3,5];case 2:return r=c.sent(),[4,this.oauthInstance.authApi.sudo({verification_token:r.verification_token})];case 3:return i=c.sent(),[4,this.oauthInstance.authApi.setPassword({new_password:e.password,sudo_token:i.sudo_token})];case 4:return c.sent(),[3,7];case 5:return[4,this.signInWithUsername(B(B({verificationInfo:n,verificationCode:e.nonce},t),{loginType:t.email?`email`:`phone`}))];case 6:c.sent(),c.label=7;case 7:return[4,this.getSession()];case 8:return a=c.sent().data,[2,{data:{user:(o=(a===void 0?{}:a).session).user,session:o},error:null}];case 9:return s=c.sent(),[2,{data:{user:null,session:null},error:new I(s,{method:`reauthenticate`})}];case 10:return[2]}})})}},error:null}];case 3:return r=a.sent(),[2,{data:{updateUser:null},error:new I(r,{method:`reauthenticate`})}];case 4:return[2]}})})},n.prototype.resend=function(e){return H(this,void 0,Promise,function(){var t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),this.validateAtLeastOne(e,[[`email`],[`phone`]],`resend`),t=e.type===`signup`?`ANY`:`USER`,n={target:t},`email`in e&&(n.email=e.email,n.usage=c.EMAIL),`phone`in e&&(n.phone_number=this.formatPhone(e.phone)),[4,this.oauthInstance.authApi.getVerification(n)];case 1:return[2,{data:{messageId:i.sent().verification_id},error:null}];case 2:return r=i.sent(),[2,{data:{messageId:null},error:new I(r,{method:`resend`})}];case 3:return[2]}})})},n.prototype.setSession=function(e){return H(this,void 0,Promise,function(){var t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),this.validateParams(e,{access_token:{required:!0,message:`Access token is required`},refresh_token:{required:!0,message:`Refresh token is required`}},`setSession`),[4,this.oauthInstance.oauth2client.refreshToken(e,{throwError:!0})];case 1:return i.sent(),[4,this.getSession()];case 2:return t=i.sent().data,[2,{data:{user:(n=(t===void 0?{}:t).session).user,session:n},error:null}];case 3:return r=i.sent(),[2,{data:{user:null,session:null},error:new I(r,{method:`setSession`})}];case 4:return[2]}})})},n.prototype.exchangeCodeForSession=function(){return H(this,void 0,void 0,function(){return U(this,function(e){return[2]})})},n.prototype.deleteUser=function(e){return H(this,void 0,Promise,function(){var t,n;return U(this,function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),this.validateParams(e,{password:{required:!0,message:`Password is required`}},`deleteUser`),[4,this.oauthInstance.authApi.sudo(e)];case 1:return t=r.sent().sudo_token,[4,this.oauthInstance.authApi.deleteMe({sudo_token:t})];case 2:return r.sent(),[2,{data:{},error:null}];case 3:return n=r.sent(),[2,{data:{},error:new I(n,{method:`deleteUser`})}];case 4:return[2]}})})},n.prototype.toDefaultLoginPage=function(e){return e===void 0&&(e={}),H(this,void 0,Promise,function(){var t,n,r,i,a;return U(this,function(o){try{return t=e.config_version||`env`,n=Object.keys(e.query||{}).map(function(t){return`${t}=${e.query[t]}`}).join(`&`),ct.default.isMatch()?wx.navigateTo({url:`/packages/\$wd_system/pages/login/index${n?`?${n}`:``}`}):(r=e.redirect_uri||window.location.href,i=new URL(r),a=`${i.origin}/__auth/?app_id=${e.app_id||``}&env_id=${this.config.env}&client_id=${this.config.clientId||this.config.env}&config_version=${t}&redirect_uri=${encodeURIComponent(r)}${n?`&${n}`:``}`,window.location.href=a),[2,{data:{},error:null}]}catch(e){return[2,{data:{},error:new I(e,{method:`toDefaultLoginPage`})}]}})})},n.prototype.signInWithCustomTicket=function(e){return H(this,void 0,Promise,function(){var t,n,r,i;return U(this,function(a){switch(a.label){case 0:e&&this.setCustomSignFunc(e),a.label=1;case 1:return a.trys.push([1,5,,6]),[4,this.oauthInstance.authApi.signInWithCustomTicket()];case 2:return a.sent(),[4,this.createLoginState()];case 3:return t=a.sent(),[4,this.getSession()];case 4:return n=a.sent().data,r=(n===void 0?{}:n).session,[2,B(B({},t),{data:{user:r.user,session:r},error:null})];case 5:return i=a.sent(),[2,{data:{user:null,session:null},error:new I(i,{method:`signInWithCustomTicket`})}];case 6:return[2]}})})},n.prototype.signInWithOpenId=function(e){var t=(e===void 0?{}:e).useWxCloud,n=t===void 0||t;return H(this,void 0,Promise,function(){var e,t,r,i,a,o,s=this;return U(this,function(c){switch(c.label){case 0:if(!ct.default.isMatch())throw Error(`wx api undefined`);e=wx.getAccountInfoSync().miniProgram,t=function(t){return H(s,void 0,void 0,function(){var r,i;return U(this,function(a){switch(a.label){case 0:r=void 0,i=void 0,a.label=1;case 1:return a.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_id:e?.appId,provider_code:t,provider_params:{provider_code_type:`open_id`,appid:e?.appId}},n)];case 2:if((r=a.sent())?.error_code||!r.provider_token)throw r;return[4,this.oauthInstance.authApi.signInWithProvider({provider_token:r.provider_token},n)];case 3:if((i=a.sent())?.error_code)throw i;return[3,5];case 4:throw a.sent();case 5:return[4,this.oauthInstance.oauth2client.setCredentials(i)];case 6:return a.sent(),[2]}})})},c.label=1;case 1:return c.trys.push([1,5,,6]),[4,new Promise(function(e,n){wx.login({success:function(r){return H(s,void 0,void 0,function(){var i;return U(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,t(r.code)];case 1:return a.sent(),e(!0),[3,3];case 2:return i=a.sent(),n(i),[3,3];case 3:return[2]}})})},fail:function(e){var t=Error(e?.errMsg);t.code=e?.errno,n(t)}})})];case 2:return c.sent(),[4,this.createLoginState()];case 3:return r=c.sent(),[4,this.getSession()];case 4:return i=c.sent().data,a=(i===void 0?{}:i).session,[2,B(B({},r),{data:{user:a.user,session:a},error:null})];case 5:return o=c.sent(),[2,{data:{user:null,session:null},error:new I(o,{method:`signInWithOpenId`})}];case 6:return[2]}})})},n.prototype.signInWithPhoneAuth=function(e){var t=e.phoneCode,n=t===void 0?``:t,r=e.useWxCloud,i=r!==void 0&&r;return H(this,void 0,Promise,function(){var e,t,r,a,o,s,c,l,u;return U(this,function(d){switch(d.label){case 0:return ct.default.isMatch()?(e=wx.getAccountInfoSync().miniProgram,t={provider_params:{provider_code_type:`phone`,code:n,appid:e.appId},provider_id:e.appId},[4,wx.login()]):[2,{data:{user:null,session:null},error:new I({message:`wx api undefined`})}];case 1:r=d.sent().code,t.provider_code=r,d.label=2;case 2:return d.trys.push([2,5,,6]),[4,this.oauthInstance.authApi.grantProviderToken(t,i)];case 3:if((a=d.sent()).error_code)throw a;return[4,this.oauthInstance.authApi.signInWithProvider({provider_token:a.provider_token},i)];case 4:if((o=d.sent())?.error_code)throw o;return[3,6];case 5:return s=d.sent(),[2,{data:{user:null,session:null},error:new I(s,{method:`signInWithPhoneAuth`})}];case 6:return[4,this.createLoginState()];case 7:return c=d.sent(),[4,this.getSession()];case 8:return l=d.sent().data,u=(l===void 0?{}:l).session,[2,B(B({},c),{data:{user:u.user,session:u},error:null})]}})})},n.prototype.bindPhoneNumber=function(e){return H(this,void 0,void 0,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.editContact(e)]})})},n.prototype.unbindProvider=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.unbindProvider(e)]})})},n.prototype.bindEmail=function(e){return this.oauthInstance.authApi.editContact(e)},n.prototype.verify=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.verify(e)]})})},n.prototype.getVerification=function(e,t){return H(this,void 0,Promise,function(){return U(this,function(n){return e.phone_number&&=this.formatPhone(e.phone_number),[2,this.oauthInstance.authApi.getVerification(e,t)]})})},Object.defineProperty(n.prototype,"currentUser",{get:function(){if(this.cache.mode!==`async`){var e=this.hasLoginState();return e&&e.user||null}(0,Ie.printWarn)(z.ERRORS.INVALID_OPERATION,`current platform's storage is asynchronous, please use getCurrentUser instead`)},enumerable:!1,configurable:!0}),n.prototype.getCurrentUser=function(e){return e===void 0&&(e=!0),H(this,void 0,Promise,function(){var t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,4,,5]),e?[4,this.getLoginState()]:[3,3];case 1:return(t=i.sent())?[4,t.user.refresh()]:[3,3];case 2:i.sent(),i.label=3;case 3:return[3,5];case 4:return i.sent(),[3,5];case 5:return[4,this.getLoginState()];case 6:return(n=i.sent())?(r=n.user.getLocalUserInfo(),[4,n.user.checkLocalInfoAsync()]):[3,8];case 7:return i.sent(),[2,B(B({},n.user),r)];case 8:return[2,null]}})})},n.prototype.signInAnonymouslyInWx=function(e){var t=(e===void 0?{}:e).useWxCloud;return H(this,void 0,Promise,function(){var e,n,r=this;return U(this,function(i){switch(i.label){case 0:if(!ct.default.isMatch())throw Error(`wx api undefined`);return e=wx.getAccountInfoSync().miniProgram,n=function(n){return H(r,void 0,void 0,function(){var r,i;return U(this,function(a){switch(a.label){case 0:r=void 0,i=void 0,a.label=1;case 1:return a.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_id:e?.appId,provider_code:n,provider_params:{provider_code_type:`open_id`,appid:e?.appId}},t)];case 2:if((r=a.sent())?.error_code||!r.provider_token)throw r;return[4,this.oauthInstance.authApi.signInAnonymously({provider_token:r.provider_token},t)];case 3:if((i=a.sent())?.error_code)throw i;return[3,5];case 4:throw a.sent();case 5:return[2]}})})},[4,new Promise(function(e,t){wx.login({success:function(i){return H(r,void 0,void 0,function(){var r;return U(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,n(i.code)];case 1:return a.sent(),e(!0),[3,3];case 2:return r=a.sent(),t(r),[3,3];case 3:return[2]}})})},fail:function(e){var n=Error(e?.errMsg);n.code=e?.errno,t(n)}})})];case 1:return i.sent(),[2,this.createLoginState(void 0,{asyncRefreshUser:!0})]}})})},n.prototype.bindOpenId=function(){return H(this,void 0,Promise,function(){var e,t,n=this;return U(this,function(r){switch(r.label){case 0:if(!ct.default.isMatch())throw Error(`wx api undefined`);return e=wx.getAccountInfoSync().miniProgram,t=function(t){return H(n,void 0,void 0,function(){var n;return U(this,function(r){switch(r.label){case 0:n=void 0,r.label=1;case 1:return r.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_id:e?.appId,provider_code:t,provider_params:{provider_code_type:`open_id`,appid:e?.appId}})];case 2:if((n=r.sent())?.error_code||!n.provider_token)throw n;return[4,this.oauthInstance.authApi.bindWithProvider({provider_token:n.provider_token})];case 3:return r.sent(),[3,5];case 4:throw r.sent();case 5:return[2]}})})},[4,new Promise(function(e,r){wx.login({success:function(i){return H(n,void 0,void 0,function(){var n;return U(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,t(i.code)];case 1:return a.sent(),e(!0),[3,3];case 2:return n=a.sent(),r(n),[3,3];case 3:return[2]}})})},fail:function(e){var t=Error(e?.errMsg);t.code=e?.errno,r(t)}})})];case 1:return r.sent(),[2]}})})},n.prototype.signInWithUnionId=function(){return H(this,void 0,Promise,function(){var e=this;return U(this,function(t){switch(t.label){case 0:if(!ct.default.isMatch())throw Error(`wx api undefined`);t.label=1;case 1:return t.trys.push([1,3,,4]),[4,new Promise(function(t,n){var r=wx.getAccountInfoSync().miniProgram;wx.login({success:function(i){return H(e,void 0,void 0,function(){var e,a,o,s,c;return U(this,function(l){switch(l.label){case 0:e=r?.appId,l.label=1;case 1:return l.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_code:i.code,provider_id:e,provider_params:{provider_code_type:`union_id`,appid:r?.appId}})];case 2:return a=l.sent(),(o=a.provider_token)?[4,this.oauthInstance.authApi.signInWithProvider({provider_id:e,provider_token:o})]:(n(a),[2]);case 3:return(s=l.sent())?.error_code?(n(s),[2]):(t(!0),[3,5]);case 4:return c=l.sent(),n(c),[3,5];case 5:return[2]}})})},fail:function(e){var t=Error(e?.errMsg);t.code=e?.errno,n(t)}})})];case 2:return t.sent(),[3,4];case 3:throw t.sent();case 4:return[2,this.createLoginState()]}})})},n.prototype.signInWithSms=function(e){var t=e.verificationInfo,n=t===void 0?{verification_id:``,is_user:!1}:t,r=e.verificationCode,i=r===void 0?``:r,a=e.phoneNum,o=a===void 0?``:a,s=e.bindInfo,c=s===void 0?void 0:s;return H(this,void 0,Promise,function(){return U(this,function(e){try{return[2,this.signInWithUsername({verificationInfo:n,verificationCode:i,bindInfo:c,username:o,loginType:`sms`})]}catch(e){throw e}})})},n.prototype.signInWithEmail=function(e){var t=e.verificationInfo,n=t===void 0?{verification_id:``,is_user:!1}:t,r=e.verificationCode,i=r===void 0?``:r,a=e.bindInfo,o=a===void 0?void 0:a,s=e.email,c=s===void 0?``:s;return H(this,void 0,Promise,function(){return U(this,function(e){try{return[2,this.signInWithUsername({verificationInfo:n,verificationCode:i,bindInfo:o,username:c,loginType:`email`})]}catch(e){throw e}})})},n.prototype.setCustomSignFunc=function(e){this.oauthInstance.authApi.setCustomSignFunc(e)},n.prototype.signIn=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signIn(e)];case 1:return t.sent(),[2,this.createLoginState(e)]}})})},n.prototype.setPassword=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.setPassword(e)]})})},n.prototype.isUsernameRegistered=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){switch(t.label){case 0:return typeof e!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`username must be a string`),[4,this.oauthInstance.authApi.checkIfUserExist({username:e})];case 1:return[2,t.sent().exist]}})})},n.prototype.hasLoginState=function(){if(this.cache.mode!==`async`)return this.oauthInstance?.authApi.hasLoginStateSync()?new Nt({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance}):null;(0,Ie.printWarn)(z.ERRORS.INVALID_OPERATION,`current platform's storage is asynchronous, please use getLoginState instead`)},n.prototype.getLoginState=function(){return H(this,void 0,Promise,function(){var e;return U(this,function(t){switch(t.label){case 0:e=null,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.oauthInstance.authApi.getLoginState()];case 2:return e=t.sent(),[3,4];case 3:return t.sent(),[2,null];case 4:return e?[2,new Nt({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})]:[2,null]}})})},n.prototype.getUserInfo=function(){return H(this,void 0,Promise,function(){return U(this,function(e){return[2,this.getCurrentUser()]})})},n.prototype.getWedaUserInfo=function(){return H(this,void 0,Promise,function(){return U(this,function(e){return[2,this.oauthInstance.authApi.getWedaUserInfo()]})})},n.prototype.updateUserBasicInfo=function(e){return H(this,void 0,void 0,function(){var t;return U(this,function(n){switch(n.label){case 0:return[4,this.getLoginState()];case 1:return(t=n.sent())?[4,t.user.updateUserBasicInfo(e)]:[3,3];case 2:n.sent(),n.label=3;case 3:return[2]}})})},n.prototype.getAuthHeader=function(){return console.error(`Auth.getAuthHeader API 已废弃`),{}},n.prototype.bindWithProvider=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.bindWithProvider(e)]})})},n.prototype.queryUser=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.queryUserProfile(e)]})})},n.prototype.getAccessToken=function(){return H(this,void 0,Promise,function(){return U(this,function(e){switch(e.label){case 0:return[4,this.oauthInstance.oauth2client.getAccessToken()];case 1:return[2,{accessToken:e.sent(),env:this.config.env}]}})})},n.prototype.grantProviderToken=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.grantProviderToken(e)]})})},n.prototype.patchProviderToken=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.patchProviderToken(e)]})})},n.prototype.signInWithProvider=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signInWithProvider(e)];case 1:return t.sent(),[2,this.createLoginState(e)]}})})},n.prototype.signInWithWechat=function(e){return e===void 0&&(e={}),H(this,void 0,void 0,function(){return U(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signInWithWechat(e)];case 1:return t.sent(),[2,this.createLoginState(e)]}})})},n.prototype.grantToken=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.grantToken(e)];case 1:return t.sent(),[2,this.createLoginState()]}})})},n.prototype.genProviderRedirectUri=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.genProviderRedirectUri(e)]})})},n.prototype.resetPassword=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.resetPassword(e)]})})},n.prototype.deviceAuthorize=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.deviceAuthorize(e)]})})},n.prototype.sudo=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.sudo(e)]})})},n.prototype.deleteMe=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.deleteMe(e)]})})},n.prototype.getProviders=function(){return H(this,void 0,Promise,function(){return U(this,function(e){return[2,this.oauthInstance.authApi.getProviders()]})})},n.prototype.loginScope=function(){return H(this,void 0,Promise,function(){return U(this,function(e){return[2,this.oauthInstance.authApi.loginScope()]})})},n.prototype.loginGroups=function(){return H(this,void 0,Promise,function(){return U(this,function(e){return[2,this.oauthInstance.authApi.loginGroups()]})})},n.prototype.onLoginStateChanged=function(e){var t;return H(this,void 0,void 0,function(){var n,r=this;return U(this,function(i){switch(i.label){case 0:return(t=this.config.eventBus)==null||t.on(_,function(t){return H(r,void 0,void 0,function(){var n,r;return U(this,function(i){switch(i.label){case 0:return t?.data?.eventType===u?[3,2]:[4,this.getLoginState()];case 1:return r=i.sent(),[3,3];case 2:r={},i.label=3;case 3:return n=r,e.call(this,B(B({},t),n)),[2]}})})}),[4,this.getLoginState()];case 1:return n=i.sent(),e.call(this,n),[2]}})})},n.prototype.refreshTokenForce=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.refreshTokenForce(e)]})})},n.prototype.getCredentials=function(){return H(this,void 0,Promise,function(){return U(this,function(e){return[2,this.oauthInstance.authApi.getCredentials()]})})},n.prototype.setCredentials=function(e){return H(this,void 0,void 0,function(){return U(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.oauth2client.setCredentials(e)];case 1:return t.sent(),[2]}})})},n.prototype.getProviderSubType=function(){return H(this,void 0,Promise,function(){return U(this,function(e){return[2,this.oauthInstance.authApi.getProviderSubType()]})})},n.prototype.createCaptchaData=function(e){return H(this,void 0,void 0,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.createCaptchaData(e)]})})},n.prototype.verifyCaptchaData=function(e){return H(this,void 0,void 0,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.verifyCaptchaData(e)]})})},n.prototype.getMiniProgramQrCode=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.getMiniProgramCode(e)]})})},n.prototype.getMiniProgramQrCodeStatus=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.getMiniProgramQrCodeStatus(e)]})})},n.prototype.modifyPassword=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.modifyPassword(e)]})})},n.prototype.modifyPasswordWithoutLogin=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.modifyPasswordWithoutLogin(e)]})})},n.prototype.getUserBehaviorLog=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.getUserBehaviorLog(e)]})})},n.prototype.signInWithUsername=function(e){var t=e.verificationInfo,n=t===void 0?{verification_id:``,is_user:!1}:t,r=e.verificationCode,i=r===void 0?``:r,a=e.username,o=a===void 0?``:a,s=e.bindInfo,c=s===void 0?void 0:s,l=e.loginType,u=l===void 0?``:l;return H(this,void 0,Promise,function(){var e,t,r,a,s,l,d;return U(this,function(f){switch(f.label){case 0:return f.trys.push([0,8,,9]),[4,this.oauthInstance.authApi.verify({verification_id:n.verification_id,verification_code:i})];case 1:if((e=f.sent())?.error_code)throw e;return t=e.verification_token,r=this.formatPhone(o),a={phone_number:r},u===`email`&&(a={email:r=o}),n.is_user?[4,this.oauthInstance.authApi.signIn({username:r,verification_token:t})]:[3,5];case 2:if((s=f.sent())?.error_code)throw s;return c?[4,this.oauthInstance.authApi.bindWithProvider({provider_token:c?.providerToken})]:[3,4];case 3:if((l=f.sent())?.error_code)throw l;f.label=4;case 4:return[3,7];case 5:return[4,this.oauthInstance.authApi.signUp(B(B({},a),{verification_token:t,provider_token:c?.providerId}))];case 6:if((d=f.sent())?.error_code)throw d;f.label=7;case 7:return[2,this.createLoginState()];case 8:throw f.sent();case 9:return[2]}})})},n.prototype.createLoginState=function(e,t){return H(this,void 0,Promise,function(){var n;return U(this,function(r){switch(r.label){case 0:return[4,(n=new Nt({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})).checkLocalStateAsync()];case 1:return r.sent(),t?.userInfo?(n.user.setLocalUserInfo(t.userInfo),[3,5]):[3,2];case 2:return t?.asyncRefreshUser?(n.user.refresh(e),[3,5]):[3,3];case 3:return[4,n.user.refresh(e)];case 4:r.sent(),r.label=5;case 5:return[2,n]}})})},n.prototype.setAccessKey=function(){var e,t;return H(this,void 0,void 0,function(){var n,r;return U(this,function(i){if(n=``,r=``,this.config.accessKey?(n=this.config.accessKey,r=`accessKey`):(e=this.config.auth)!=null&&e.secretId&&(t=this.config.auth)!=null&&t.secretKey&&(n=``,r=S),!r)return[2];try{this.oauthInstance.oauth2client.setAccessKeyCredentials({access_token:n,token_type:`Bearer`,scope:r,expires_at:new Date(+new Date+ +new Date),expires_in:+new Date+ +new Date})}catch(e){console.warn(`accessKey error: `,e)}return[2]})})},n.prototype.formatPhone=function(e){return!/\s+/.test(e)&&/^\+\d{1,3}\d+/.test(e)?e.replace(/^(\+\d{1,2})(\d+)$/,`$1 $2`):/^\+\d{1,3}\s+/.test(e)?e:`+86 ${e}`},n.prototype.notifyListeners=function(e,t,n){this.listeners.forEach(function(r){r.forEach(function(r){try{r(e,t,n)}catch(e){console.error(`Error in auth state change callback:`,e)}})})},n.prototype.setupListeners=function(){var e,t=this;(e=this.config.eventBus)==null||e.on(v,function(e){return H(t,void 0,void 0,function(){var t,n,r,i,a;return U(this,function(o){switch(o.label){case 0:return t=e?.data?.event,n=e?.data?.info,t!==f||n?[3,2]:[4,this.getUser(!0)];case 1:r=o.sent().data,(i=(r===void 0?{}:r).user)&&(n={user:i}),o.label=2;case 2:return[4,this.getSession()];case 3:return a=o.sent().data.session,this.notifyListeners(t,a,n),[2]}})})})},n.prototype.convertToUser=function(e){var t;if(!e)return null;var n=e?.email||``,r=e?.phone_number||``,i=e?.sub||e?.uid||``;return{id:i,aud:`authenticated`,role:((t=e.groups)?.map)?.call(t,function(e){return typeof e==`string`?e:e.id}),email:n||``,email_confirmed_at:(e?.email_verified,e.created_at),phone:r,phone_confirmed_at:r?e.created_at:void 0,confirmed_at:e.created_at,last_sign_in_at:e.last_sign_in_at,app_metadata:{provider:e.loginType?.toLowerCase()||`cloudbase`,providers:[e.loginType?.toLowerCase()||`cloudbase`]},user_metadata:{name:e?.name,picture:e?.picture,username:e?.username,gender:e?.gender,locale:e?.locale,uid:e.uid,nickName:e.nickName||e?.name,avatarUrl:e.avatarUrl||e.picture,location:e.location,hasPassword:e.hasPassword??e.password===`SET`,open_id:e?.open_id},identities:(e?.providers)?.map(function(t){return{id:t.id||``,identity_id:t.id||``,user_id:i,identity_data:{provider_id:t.id,provider_user_id:t.provider_user_id,name:t.name},provider:t.id||`cloudbase`,created_at:e.created_at,updated_at:e.updated_at,last_sign_in_at:e.last_sign_in_at}})||[],created_at:e.created_at,updated_at:e.updated_at,is_anonymous:e.name===`anonymous`}},n.prototype.missingRequiredParam=function(e,t){return new I({error:`missing_required_param`,error_code:4e3,error_description:`auth.${e}(params): missing required param '${t}'`},{method:e})},n.prototype.validateParams=function(e,t,n){for(var r=0,i=Object.entries(t);r<i.length;r++){var a=i[r],o=a[0];if(a[1].required&&(e?.[o]===void 0||e?.[o]===null||e?.[o]===``))throw this.missingRequiredParam(n,o)}},n.prototype.validateAtLeastOne=function(e,t,n){if(!t.some(function(t){return t.some(function(t){return e?.[t]!==void 0&&e?.[t]!==null&&e?.[t]!==``})}))throw this.missingRequiredParam(n,t.map(function(e){return e.join(`|`)}).join(`|`))},n.prototype.init=function(){var e;return H(this,void 0,Promise,function(){return U(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.oauthInstance.oauth2client.localCredentials.getCredentials()];case 1:return t.sent()&&!this.oauthInstance.oauth2client.initSessionEmitted&&((e=this.config.eventBus)==null||e.fire(v,{event:p})),[3,3];case 2:return t.sent(),[3,3];case 3:return[2,{error:null}]}})})},Tt([(0,ot.catchErrorsDecorator)({title:`绑定手机号失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().bindPhoneNumber() 的语法或参数是否正确`,` 2 - 当前环境是否开通了短信验证码登录`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[typeof(r=e.BindPhoneRequest)==`function`?r:Object]),V(`design:returntype`,Promise)],n.prototype,`bindPhoneNumber`,null),Tt([(0,ot.catchErrorsDecorator)({title:`解除三方绑定失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().unbindProvider() 的语法或参数是否正确`,` 2 - 当前账户是否已经与此登录方式解绑`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[typeof(i=e.UnbindProviderRequest)==`function`?i:Object]),V(`design:returntype`,typeof(a=typeof Promise<`u`&&Promise)==`function`?a:Object)],n.prototype,`unbindProvider`,null),Tt([(0,ot.catchErrorsDecorator)({title:`绑定邮箱地址失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().bindEmail() 的语法或参数是否正确`,` 2 - 当前环境是否开通了邮箱密码登录`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[typeof(o=e.BindEmailRequest)==`function`?o:Object]),V(`design:returntype`,void 0)],n.prototype,`bindEmail`,null),Tt([(0,ot.catchErrorsDecorator)({title:`验证码验证失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().verify() 的语法或参数是否正确`,` 2 - 当前环境是否开通了手机验证码/邮箱登录`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[typeof(s=e.VerifyRequest)==`function`?s:Object]),V(`design:returntype`,typeof(l=typeof Promise<`u`&&Promise)==`function`?l:Object)],n.prototype,`verify`,null),Tt([(0,ot.catchErrorsDecorator)({title:`获取验证码失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().getVerification() 的语法或参数是否正确`,` 2 - 当前环境是否开通了手机验证码/邮箱登录`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[typeof(d=e.GetVerificationRequest)==`function`?d:Object,Object]),V(`design:returntype`,typeof(m=typeof Promise<`u`&&Promise)==`function`?m:Object)],n.prototype,`getVerification`,null),Tt([(0,ot.catchErrorsDecorator)({title:`获取用户信息失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().getCurrentUser() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[Object]),V(`design:returntype`,typeof(g=typeof Promise<`u`&&Promise)==`function`?g:Object)],n.prototype,`getCurrentUser`,null),Tt([(0,ot.catchErrorsDecorator)({title:`小程序匿名登录失败`,messages:[`请确认以下各项:`,` 1 - 当前环境是否开启了匿名登录`,` 2 - 调用 auth().signInAnonymouslyInWx() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[Object]),V(`design:returntype`,typeof(b=typeof Promise<`u`&&Promise)==`function`?b:Object)],n.prototype,`signInAnonymouslyInWx`,null),Tt([(0,ot.catchErrorsDecorator)({title:`小程序绑定OpenID失败`,messages:[`请确认以下各项:`,` 1 - 当前环境是否开启了小程序openId静默登录`,` 2 - 调用 auth().bindOpenId() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[]),V(`design:returntype`,typeof(C=typeof Promise<`u`&&Promise)==`function`?C:Object)],n.prototype,`bindOpenId`,null),Tt([(0,ot.catchErrorsDecorator)({title:`小程序unionId静默登录失败`,messages:[`请确认以下各项:`,` 1 - 当前环境是否开启了小程序unionId静默登录`,` 2 - 调用 auth().signInWithUnionId() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[]),V(`design:returntype`,typeof(w=typeof Promise<`u`&&Promise)==`function`?w:Object)],n.prototype,`signInWithUnionId`,null),Tt([(0,ot.catchErrorsDecorator)({title:`短信验证码登陆`,messages:[`请确认以下各项:`,` 1 - 当前环境是否开启了小程序短信验证码登陆`,` 2 - 调用 auth().signInWithSms() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[Object]),V(`design:returntype`,typeof(T=typeof Promise<`u`&&Promise)==`function`?T:Object)],n.prototype,`signInWithSms`,null),Tt([(0,ot.catchErrorsDecorator)({title:`邮箱验证码登陆`,messages:[`请确认以下各项:`,` 1 - 当前环境是否开启了邮箱登陆`,` 2 - 调用 auth().signInWithEmail() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[Object]),V(`design:returntype`,typeof(E=typeof Promise<`u`&&Promise)==`function`?E:Object)],n.prototype,`signInWithEmail`,null),Tt([(0,ot.catchErrorsDecorator)({title:`获取用户是否被占用失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().isUsernameRegistered() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[String]),V(`design:returntype`,typeof(D=typeof Promise<`u`&&Promise)==`function`?D:Object)],n.prototype,`isUsernameRegistered`,null),Tt([(0,ot.catchErrorsDecorator)({title:`获取本地登录态失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().getLoginState() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[]),V(`design:returntype`,typeof(ee=typeof Promise<`u`&&Promise)==`function`?ee:Object)],n.prototype,`getLoginState`,null),Tt([(0,ot.catchErrorsDecorator)({title:`获取用户信息失败`,messages:[`请确认以下各项:`,` 1 - 是否已登录`,` 2 - 调用 auth().getUserInfo() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[]),V(`design:returntype`,typeof(te=typeof Promise<`u`&&Promise)==`function`?te:Object)],n.prototype,`getUserInfo`,null),Tt([(0,ot.catchErrorsDecorator)({title:`获取微搭插件用户信息失败`,messages:[`请确认以下各项:`,` 1 - 是否已登录`,` 2 - 调用 auth().getWedaUserInfo() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[]),V(`design:returntype`,typeof(O=typeof Promise<`u`&&Promise)==`function`?O:Object)],n.prototype,`getWedaUserInfo`,null),Tt([(0,ot.catchErrorsDecorator)({title:`绑定第三方登录方式失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().bindWithProvider() 的语法或参数是否正确`,` 2 - 此账户是否已经绑定此第三方`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[typeof(A=e.BindWithProviderRequest)==`function`?A:Object]),V(`design:returntype`,typeof(ne=typeof Promise<`u`&&Promise)==`function`?ne:Object)],n.prototype,`bindWithProvider`,null),Tt([(0,ot.catchErrorsDecorator)({title:`获取身份源类型`,messages:[`请确认以下各项:`,` 1 - 调用 auth().getProviderSubType() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[]),V(`design:returntype`,typeof(re=typeof Promise<`u`&&Promise)==`function`?re:Object)],n.prototype,`getProviderSubType`,null),n}(Ct),Ft=`auth`;function It(e,t){for(var n=[],r=0;r<=e.length;r++)n[r]=[r];for(var i=0;i<=t.length;i++)n[0][i]=i;for(r=1;r<=e.length;r++)for(i=1;i<=t.length;i++){var a=e[r-1].toLowerCase()===t[i-1].toLowerCase()?0:1;n[r][i]=Math.min(n[r-1][i]+1,n[r][i-1]+1,n[r-1][i-1]+a)}return n[e.length][t.length]}var Lt={name:`auth`,namespace:Ft,entity:function(e){var t=function(e){var t=this;if(this.authInstance&&!e)return this.authInstance;e||={region:``,persistence:`local`,apiPath:s};var n=this.platform.adapter,r=e.persistence||n.primaryStorage;r&&r!==this.config.persistence&&this.updateConfig({persistence:r});var i=function(e,t){var n=this,r=e.region,i=r===void 0?`ap-shanghai`:r,a=e.i18n,o=e.accessKey,c=e.useWxCloud,l=t?.platform||lt.useDefaultAdapter.bind(t)(),u=l.runtime,d=l.adapter,p=t||{},m=p.env,h=p.clientId,_=p.debug,b=p.cache,S=p.app,C=p.getApiOrigin,w=(t||{}).apiOrigin;w||=`https://${m}.${i}.tcb-api.tencentcloudapi.com`;var T={env:m,clientId:h,i18n:a,accessKey:o,useWxCloud:c,eventBus:new Fe.CloudbaseEventEmitter},E=new at(gt(B(B({},T),{apiOrigin:w,getApiOrigin:C,apiPath:e?.apiPath||s,storage:e?.storage,baseRequest:e?.baseRequest,request:e?.request,anonymousSignInFunc:e?.anonymousSignInFunc,captchaOptions:e?.captchaOptions,wxCloud:e?.wxCloud,adapter:d,onCredentialsError:Dt(T.eventBus),headers:B({"X-SDK-Version":`@cloudbase/js-sdk/${e.sdkVersion}`},e.headers||{}),detectSessionInUrl:e.detectSessionInUrl,debug:_,auth:t.app?.config?.auth}))),D=new Pt(B(B({},T),{region:i,persistence:e.persistence,debug:_,cache:b||new st.CloudbaseCache({persistence:e.persistence,keys:{userInfoKey:`user_info_${m}`},platformInfo:l}),runtime:u||`web`,_fromApp:S,oauthInstance:E,auth:t.app?.config?.auth}));return E.initializeSession(function(e,t){return H(n,void 0,void 0,function(){return U(this,function(n){return e&&(e.type===y?t?T.eventBus.fire(v,{event:f,info:B(B({},e),{error:t})}):e.user&&D.createLoginState({},{userInfo:e.user}):e.type===x&&T.eventBus.fire(v,{event:g,info:B(B({},e),{error:t})})),[2]})})}),{authInstance:D,oauthInstance:E}}(B(B({wxCloud:this.config.wxCloud,storage:this.config.storage},e),{persistence:this.config.persistence,i18n:this.config.i18n,accessKey:this.config.accessKey,useWxCloud:this.config.useWxCloud,sdkVersion:this.version,detectSessionInUrl:this.config.auth?.detectSessionInUrl}),{env:this.config.env,clientId:this.config.clientId,getApiOrigin:function(){return t.request.getBaseEndPoint(t.config.endPointMode||`CLOUD_API`)},platform:this.platform,cache:this.cache,app:this,debug:this.config.debug}),a=i.authInstance,o=i.oauthInstance;return this.oauthInstance=o,this.authInstance=a,this.authInstance},n=t.call(this,e);Object.assign(t,n),Object.setPrototypeOf(t,Object.getPrototypeOf(n));var r=typeof Proxy<`u`?new Proxy(t,{get:function(e,t,n){var r=Reflect.get(e,t,n);if(r!==void 0||typeof t!=`string`)return r;var i=function(e,t){for(var n=null,r=1/0,i=0,a=t;i<a.length;i++){var o=a[i];if(!o.startsWith(`_`)&&o!==`constructor`){var s=It(e,o);s<r&&(r=s,n=o)}}return n}(t,Object.getOwnPropertyNames(Object.getPrototypeOf(e)).concat(Object.keys(e)).filter(function(t){return typeof e[t]==`function`}));return i&&console.warn(`[CloudBase Auth] auth.${t} is not a function. Did you mean: auth.${i}() ?`),r}}):t;return this[Ft]=r,r}};try{cloudbase.registerComponent(Lt)}catch{}var Rt=function(e){try{e.registerComponent(Lt)}catch(e){console.warn(e)}};try{window.registerAuth=Rt}catch{}})(),ao.W;var oo={388:e=>{e.exports={}}},so={};function co(e){var t=so[e];if(t!==void 0)return t.exports;var n=so[e]={exports:{}};return oo[e](n,n.exports,co),n.exports}co.d=(e,t)=>{for(var n in t)co.o(t,n)&&!co.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},co.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var lo={};(()=>{co.d(lo,{r:()=>ge});var e=co(388);function t(){return`@cloudbase/js-sdk`}var n={INVALID_PARAMS:`INVALID_PARAMS`,INVALID_SYNTAX:`INVALID_SYNTAX`,INVALID_OPERATION:`INVALID_OPERATION`,OPERATION_FAIL:`OPERATION_FAIL`,NETWORK_ERROR:`NETWORK_ERROR`,UNKOWN_ERROR:`UNKOWN_ERROR`};let r=(i={AbstractSDKRequest:()=>f,AbstractStorage:()=>p},a={},co.d(a,i),a);var i,a,o,s=(o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},o(e,t)},function(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);function n(){this.constructor=e}o(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}),c=function(){return c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},c.apply(this,arguments)};function l(e,t){console.warn(`[@cloudbase/js-sdk][${e}]:${t}`)}var u=function(e){function t(t){var n=e.call(this,t.msg||t.message||``)||this;return n.code=t.code||``,n.requestId=t.requestId||``,Object.defineProperty(n,"message",{value:t.msg||t.message||``,enumerable:!0,writable:!0,configurable:!0}),n}return s(t,e),t}(Error),d=function(e){return new u(e)};function m(e,t){return(t||d)(e)}function h(e){return!e||typeof e.throw!=`boolean`||e.throw}var g,_=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),v=function(){return v=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},v.apply(this,arguments)},y=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},x=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};(function(e){function t(t){var n=e.call(this)||this,r=t.timeout,i=t.timeoutMsg,a=t.restrictedMethods;return n.timeout=r||0,n.timeoutMsg=i||`请求超时`,n.restrictedMethods=a||[`get`,`post`,`upload`,`download`],n}_(t,e),t.prototype.get=function(e){return this.request(v(v({},e),{method:`get`}),this.restrictedMethods.includes(`get`))},t.prototype.post=function(e){return this.request(v(v({},e),{method:`post`}),this.restrictedMethods.includes(`post`))},t.prototype.put=function(e){return this.request(v(v({},e),{method:`put`}))},t.prototype.upload=function(e){var t=e.data,n=e.file,r=e.name,i=e.method,a=e.headers,o=a===void 0?{}:a,s={post:`post`,put:`put`}[i?.toLowerCase()]||`put`,c=new FormData;return s===`post`?(Object.keys(t).forEach(function(e){c.append(e,t[e])}),c.append(`key`,r),c.append(`file`,n),this.request(v(v({},e),{data:c,method:s}),this.restrictedMethods.includes(`upload`))):this.request(v(v({},e),{method:`put`,headers:o,body:n}),this.restrictedMethods.includes(`upload`))},t.prototype.download=function(e){return y(this,void 0,Promise,function(){var t,n,r,i;return x(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.get(v(v({},e),{headers:{},responseType:`blob`}))];case 1:return t=a.sent().data,n=window.URL.createObjectURL(new Blob([t])),r=decodeURIComponent(new URL(e.url).pathname.split(`/`).pop()||``),(i=document.createElement(`a`)).href=n,i.setAttribute(`download`,r),i.style.display=`none`,document.body.appendChild(i),i.click(),window.URL.revokeObjectURL(n),document.body.removeChild(i),[3,3];case 2:return a.sent(),[3,3];case 3:return[2,new Promise(function(t){t({statusCode:200,tempFilePath:e.url})})]}})})},t.prototype.fetch=function(e){return y(this,void 0,Promise,function(){var t,n,r,i,a,o,s,c,l,u,d,f,p,m=this;return x(this,function(h){switch(h.label){case 0:return t=new AbortController,n=e.url,r=e.enableAbort,i=r!==void 0&&r,a=e.stream,o=a!==void 0&&a,s=e.signal,c=e.timeout,l=e.shouldThrowOnError,u=l===void 0||l,d=c??this.timeout,s&&(s.aborted&&t.abort(),s.addEventListener(`abort`,function(){return t.abort()})),f=null,i&&d&&(f=setTimeout(function(){console.warn(m.timeoutMsg),t.abort(Error(m.timeoutMsg))},d)),[4,fetch(n,v(v({},e),{signal:t.signal})).then(function(e){return y(m,void 0,void 0,function(){var t,n,r;return x(this,function(i){switch(i.label){case 0:return clearTimeout(f),u?e.ok?(t=e,[3,3]):[3,1]:[3,4];case 1:return r=(n=Promise).reject,[4,e.json()];case 2:t=r.apply(n,[i.sent()]),i.label=3;case 3:return[2,t];case 4:return[2,e]}})})}).catch(function(e){return clearTimeout(f),Promise.reject(e)})];case 1:return p=h.sent(),[2,{data:o?p.body:p.headers.get(`content-type`)?.includes(`application/json`)?p.json():p.text(),statusCode:p.status,header:p.headers,response:p}]}})})},t.prototype.request=function(e,t){var n=this;t===void 0&&(t=!1);var r=String(e.method).toLowerCase()||`get`;return new Promise(function(i){var a=e.url,o=e.headers,s=o===void 0?{}:o,c=e.data,l=e.responseType,u=e.withCredentials,d=e.body,f=e.onUploadProgress,p=function(e,t,n){n===void 0&&(n={});var r=/\?/.test(t),i=``;return Object.keys(n).forEach(function(e){i===``?!r&&(t+=`?`):i+=`&`,i+=`${e}=${encodeURIComponent(n[e])}`}),/^http(s)?:\/\//.test(t+=i)?t:`${e}${t}`}(`https:`,a,r===`get`?c:{}),m=new XMLHttpRequest;m.open(r,p),l&&(m.responseType=l);var h,g,_,v=e.signal;v&&(v.aborted?m.abort():v.addEventListener(`abort`,function(){return m.abort()},{once:!0})),Object.keys(s).forEach(function(e){m.setRequestHeader(e,s[e])}),f&&m.upload.addEventListener(`progress`,f),m.onreadystatechange=function(){var e={};if(m.readyState===4){var t=m.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};t.forEach(function(e){var t=e.split(`: `),r=t.shift().toLowerCase();n[r]=t.join(`: `)}),e.header=n,e.statusCode=m.status;try{e.data=l===`blob`?m.response:JSON.parse(m.responseText)}catch{e.data=l===`blob`?m.response:m.responseText}clearTimeout(h),i(e)}},t&&n.timeout&&(h=setTimeout(function(){console.warn(n.timeoutMsg),m.abort()},n.timeout)),_=c,g=Object.prototype.toString.call(_)===`[object FormData]`?c:s[`content-type`]===`application/x-www-form-urlencoded`?function(e){e===void 0&&(e={});var t=[];return Object.keys(e).forEach(function(n){t.push(`${n}=${encodeURIComponent(e[n])}`)}),t.join(`&`)}(c):d||(c?JSON.stringify(c):void 0),u&&(m.withCredentials=!0),m.send(g)})}})(r.AbstractSDKRequest),function(e){e.WEB=`web`,e.WX_MP=`wx_mp`}(g||={});var S=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),C=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},w=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},T=function(e){function t(t){var n=e.call(this)||this;return n.root=t,t.tcbCacheObject||={},n}return S(t,e),t.prototype.setItem=function(e,t){this.root.tcbCacheObject[e]=t},t.prototype.getItem=function(e){return this.root.tcbCacheObject[e]},t.prototype.removeItem=function(e){delete this.root.tcbCacheObject[e]},t.prototype.clear=function(){delete this.root.tcbCacheObject},t}(r.AbstractStorage);(function(){function e(e){this.keys={};var t=e.persistence,r=e.platformInfo,i=r===void 0?{}:r,a=e.keys,o=a===void 0?{}:a;this.platformInfo=i,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||t,this.storage=function(e,t){switch(e){case`local`:default:return t.localStorage?t.localStorage:(l(n.INVALID_PARAMS,`localStorage is not supported on current platform`),new T(t.root));case`none`:return new T(t.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=o)}Object.defineProperty(e.prototype,"mode",{get:function(){return this.storage.mode||`sync`},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),e.prototype.setStore=function(e,t,r){if(this.mode!==`async`){if(this.storage)try{var i={version:r||`localCachev1`,content:t};this.storage.setItem(e,JSON.stringify(i))}catch(e){throw Error(JSON.stringify({code:n.OPERATION_FAIL,msg:`[@cloudbase/js-sdk][${n.OPERATION_FAIL}]setStore failed`,info:e}))}}else l(n.INVALID_OPERATION,`current platform's storage is asynchronous, please use setStoreAsync insteed`)},e.prototype.setStoreAsync=function(e,t,n){return C(this,void 0,void 0,function(){var r;return w(this,function(i){switch(i.label){case 0:if(!this.storage)return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),r={version:n||`localCachev1`,content:t},[4,this.storage.setItem(e,JSON.stringify(r))];case 2:return i.sent(),[3,4];case 3:return i.sent(),[2];case 4:return[2]}})})},e.prototype.getStore=function(e,t){if(this.mode!==`async`){try{if(typeof process<`u`&&{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token)return{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token;if(!this.storage)return``}catch{return``}t||=`localCachev1`;var r=this.storage.getItem(e);return r&&r.indexOf(t)>=0?JSON.parse(r).content:``}l(n.INVALID_OPERATION,`current platform's storage is asynchronous, please use getStoreAsync insteed`)},e.prototype.getStoreAsync=function(e,t){return C(this,void 0,void 0,function(){var n;return w(this,function(r){switch(r.label){case 0:try{if(typeof process<`u`&&{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token)return[2,{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token];if(!this.storage)return[2,``]}catch{return[2,``]}return t||=`localCachev1`,[4,this.storage.getItem(e)];case 1:return(n=r.sent())&&n.indexOf(t)>=0?[2,JSON.parse(n).content]:[2,``]}})})},e.prototype.removeStore=function(e){this.mode===`async`?l(n.INVALID_OPERATION,`current platform's storage is asynchronous, please use removeStoreAsync insteed`):this.storage.removeItem(e)},e.prototype.removeStoreAsync=function(e){return C(this,void 0,void 0,function(){return w(this,function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}})})}})();var E=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),D=function(e,t){this.data=t||null,this.name=e},ee=function(e){function t(t,n){var r=e.call(this,`error`,{error:t,data:n})||this;return r.error=t,r}return E(t,e),t}(D),te=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){return function(e,t,n){n[e]=n[e]||[],n[e].push(t)}(e,t,this.listeners),this},e.prototype.off=function(e,t){return function(e,t,n){if(n?.[e]){var r=n[e].indexOf(t);r!==-1&&n[e].splice(r,1)}}(e,t,this.listeners),this},e.prototype.fire=function(e,t){if(e instanceof ee)return console.error(e.error),this;var n=typeof e==`string`?new D(e,t||{}):e,r=n.name;if(this.listens(r)){n.target=this;for(var i=0,a=this.listeners[r]?function(e,t,n){if(n||arguments.length===2)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||=Array.prototype.slice.call(t,0,i),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([],this.listeners[r],!0):[];i<a.length;i++)a[i].call(this,n)}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}();new te,new te,typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.indexOf(`Firefox`),(e=>{var t={};return co.d(t,e),t})({default:()=>b}).default;var O=function(){return O=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},O.apply(this,arguments)},k=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},A=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},ne=n,re=`cloudrun`;function ie(e,t){return k(this,void 0,void 0,function(){var n,r,i,a,o,s,c,l,u,d,f,p,m,h,g;return A(this,function(_){switch(_.label){case 0:if(n=e.name,r=e.data,i=e.path,a=i===void 0?``:i,o=e.method,s=e.header,c=s===void 0?{}:s,l=this.getEndPointWithKey(`GATEWAY`),u=l.BASE_URL,d=l.PROTOCOL,f=`${d}${u}/cloudrun/${n}`,p=a.startsWith(`/`)?a:`/${a}`,m=[`GET`,`HEAD`].includes((o?.toUpperCase)?.call(o)))try{h={};try{h=JSON.parse(r)}catch{h=r||{}}p=`${p}${p.includes(`?`)?`&`:`?`}${Object.keys(h).map(function(e){return`${e}=${h[e]}`}).join(`&`)}`}catch{}return[4,this.request.fetch(O(O({method:o||`POST`,headers:Object.assign({},{"Content-Type":`application/json; charset=utf-8`},c)},m?{}:{body:r}),{url:`${f}${p}`,customReqOpts:t}))];case 1:return g=_.sent(),t?.from===`node-sdk`?[2,g]:[4,g.data];case 2:return[2,_.sent()]}})})}var ae={name:re,entity:{callContainer:new(function(){function e(){}return e.prototype.callContainer=function(e,t){return k(this,void 0,void 0,function(){var n,r,i;return A(this,function(a){switch(a.label){case 0:if(n=e.name,r=e.data,!n)throw Error(JSON.stringify({code:ne.INVALID_PARAMS,msg:`[${re}.callContainer] invalid name`}));try{i=r?JSON.stringify(r):``}catch{throw Error(JSON.stringify({code:ne.INVALID_PARAMS,msg:`[${re}.callContainer] invalid data`}))}return[4,ie.call(this,O(O({},e),{data:i}),t)];case 1:return[2,a.sent()]}})})},e}())().callContainer}};try{cloudbase.registerComponent(ae)}catch{}try{window.registerCloudrun=function(e){try{e.registerComponent(ae)}catch(e){console.warn(e)}}}catch{}var oe=function(){return oe=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},oe.apply(this,arguments)},se=function(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)},ce=t,le=n,ue=function(e,t,n){if(n===void 0&&(n=null),e&&typeof e==`function`)return e(t,n);if(t)throw t;return n},de=m,fe=h,pe=function(e,t){if(h(e))throw m(t,e?.errorFactory);return c({code:t.code,message:t.msg},t.requestId?{requestId:t.requestId}:{})},me=`functions`,he={name:me,entity:{callFunction:new(function(){function t(){}var n,r,i,a;return t.prototype.callFunction=function(e,t,n){var r=this,i=void 0,a,o=function(){var r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E;return function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}(this,function(D){switch(D.label){case 0:if(r=e.name,i=e.data,a=e.query,o=e.parse,s=e.search,c=e.type,l=e.path,u=l===void 0?``:l,d=e.method,f=e.header,p=f===void 0?{}:f,h=(m=this).request,g=m.config,!r)return[2,pe(g,{code:le.INVALID_PARAMS,msg:`[${me}.callFunction] invalid function name`})];try{_=i?JSON.stringify(i):``}catch{return[2,pe(g,{code:le.INVALID_PARAMS,msg:`[${me}.callFunction] invalid data`})]}return c===`cloudrun`?(te=new Date().getTime(),O=(Date==null?void 0:Date.now)&&1e3*Date.now()||0,v=`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,function(e){var t=16*Math.random();return te>0?(t=(te+t)%16|0,te=Math.floor(te/16)):(t=(O+t)%16|0,O=Math.floor(O/16)),(e===`x`?t:7&t|8).toString(16)}),[4,ie.call(this,{name:r,data:_,path:u,method:d,header:oe(oe({},p),{"X-Request-Id":v})})]):[3,2];case 1:return[2,{result:T=D.sent(),requestId:v}];case 2:y=`functions.invokeFunction`,b={inQuery:a,parse:o,search:s,function_name:r,request_data:_},x={},S=!(g.endPointMode!==`GATEWAY`||(ee=r,ee===`lcap-common-service`||ee===`lcap-datasource-test`||ee.startsWith(`lcap-data`)||ee.startsWith(`lowcode-datasource`)||ee===`cloudbase_module`)||function(e){return e===`lowcode-wx-datasource`}(r)),D.label=3;case 3:return D.trys.push([3,8,,9]),S?[4,h.gateWay(oe(oe({},e),{path:`functions`}),n)]:[3,5];case 4:return C=D.sent(),x=oe({requestId:C.requestId},C.data?.code?C.data:{data:{response_data:C.data}}),[3,7];case 5:return[4,h.send(y,b,{endPointMode:`CLOUD_API`,defaultQuery:i?.params?.action?{action:i?.params?.action}:{}},n)];case 6:x=D.sent(),D.label=7;case 7:if(x.code){if(w=x.message||x.msg||``,function(e){return fe(e)}(g))throw de({code:x.code,msg:w,requestId:x.requestId},g?.errorFactory);return[2,ue(t,null,{code:x.code,message:w,requestId:x.requestId})]}if(T=x.data.response_data,o||S)return[2,ue(t,null,{result:T,requestId:x.requestId})];try{return T=JSON.parse(x.data.response_data),[2,ue(t,null,{result:T,requestId:x.requestId})]}catch{ue(t,Error(`[${ce()}][${le.INVALID_PARAMS}][${me}.callFunction] response data must be json`))}return[3,9];case 8:return E=D.sent(),ue(t,E),[3,9];case 9:return[2]}var ee,te,O})};return new((a=void 0)||(a=Promise))(function(e,t){function n(e){try{c(o.next(e))}catch(e){t(e)}}function s(e){try{c(o.throw(e))}catch(e){t(e)}}function c(t){var r;t.done?e(t.value):(r=t.value,r instanceof a?r:new a(function(e){e(r)})).then(n,s)}c((o=o.apply(r,i||[])).next())})},function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);a>3&&o&&Object.defineProperty(t,n,o)}([(a={customInfo:{className:`Cloudbase`,methodName:`callFunction`},title:`函数调用失败`,messages:[`请确认以下各项:`,` 1 - 调用 callFunction() 的语法或参数是否正确`,` 2 - 当前环境下是否存在此函数`,` 3 - 函数安全规则是否限制了当前登录状态访问`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:https://support.qq.com/products/148793`]},a.mode,a.customInfo,a.title,a.messages,function(e,t,n){}),se(`design:type`,Function),se(`design:paramtypes`,[typeof(n=e.ICallFunctionOptions!==void 0&&e.ICallFunctionOptions)==`function`?n:Object,typeof(r=typeof Function<`u`&&Function)==`function`?r:Object,typeof(i=e.ICustomReqOpts!==void 0&&e.ICustomReqOpts)==`function`?i:Object]),se(`design:returntype`,Promise)],t.prototype,`callFunction`,null),t}())().callFunction}};try{cloudbase.registerComponent(he)}catch{}var ge=function(e){try{e.registerComponent(he)}catch(e){console.warn(e)}};try{window.registerFunctions=ge}catch{}})(),lo.r;var uo={388:e=>{e.exports={}}},fo={};function po(e){var t=fo[e];if(t!==void 0)return t.exports;var n=fo[e]={exports:{}};return uo[e](n,n.exports,po),n.exports}po.d=(e,t)=>{for(var n in t)po.o(t,n)&&!po.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},po.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var mo={};(()=>{po.d(mo,{v:()=>ot});var e,t=(e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)},function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}),n=function(e){function n(t){var n=e.call(this,t)||this;return n.__isStorageError=!0,n.name=`StorageError`,n}return t(n,e),n}(Error);function r(e){return typeof e==`object`&&!!e&&`__isStorageError`in e}var i,a=function(e){function n(t,n,r){var i=e.call(this,t)||this;return i.name=`StorageApiError`,i.status=n,i.statusCode=r,i}return t(n,e),n.prototype.toJSON=function(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}},n}(n);function o(){return globalThis.Buffer}function s(e){var t=o();return t?t.from(e).toString(`base64`):btoa(e)}function c(e){return e.split(`/`).map(function(e){return encodeURIComponent(e)}).join(`/`)}t(function(e,t){var n=i.call(this,e)||this;return n.name=`StorageUnknownError`,n.originalError=t,n},i=n);var l=function(){return l=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},l.apply(this,arguments)},u=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},d=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},m=`/v1/storages`;function h(e,t){return u(this,void 0,Promise,function(){var i;return d(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,e()];case 1:return[2,{data:a.sent(),error:null}];case 2:if(i=a.sent(),t)throw i;return r(i)?[2,{data:null,error:i}]:[2,{data:null,error:new n(i?.message||String(i))}];case 3:return[2]}})})}var g=function(){function e(e){this.ctx=e}return Object.defineProperty(e.prototype,"request",{get:function(){return this.ctx.request},enumerable:!1,configurable:!0}),e.prototype.gatewayOrigin=function(){return this.request.getBaseEndPoint(`GATEWAY`)},e.prototype.buildUrl=function(e,t){var n=`${this.gatewayOrigin()}${m}${e}`,r=function(e){if(!e)return``;var t=[];return Object.keys(e).forEach(function(n){var r=e[n];r!=null&&t.push(`${encodeURIComponent(n)}=${encodeURIComponent(String(r))}`)}),t.join(`&`)}(t);return r&&(n+=(n.includes(`?`)?`&`:`?`)+r),n},e.prototype.toFullUrl=function(e){return e&&(/^https?:\/\//.test(e)||e.startsWith(`//`)?e:`${this.gatewayOrigin()}${m}${e.startsWith(`/`)?``:`/`}${e}`)},e.prototype.send=function(e){return u(this,void 0,Promise,function(){var t,n,r,i,a,o;return d(this,function(s){switch(s.label){case 0:return t=this.buildUrl(e.path,e.query),n=e.method.toUpperCase(),r=[`GET`,`HEAD`].includes(n),i=l({},e.headers||{}),r||(e.rawBody===void 0?e.json!==void 0&&(i[`Content-Type`]=i[`Content-Type`]||`application/json`,a=JSON.stringify(e.json)):a=e.rawBody),[4,this.request.fetch(l(l(l(l({url:t,method:n,headers:i},a===void 0?{}:{body:a}),{withCredentials:!1!==e.withCredentials,shouldThrowOnError:!1}),e.signal?{signal:e.signal}:{}),e.cache?{cache:e.cache}:{}))];case 1:return o=s.sent(),[2,this.unwrap(o,t)]}})})},e.prototype.download=function(e){return u(this,void 0,Promise,function(){var t,n,r,i;return d(this,function(o){switch(o.label){case 0:return t=this.buildUrl(e.path,e.query),[4,this.request.fetch(l(l({url:t,method:`GET`,headers:l({},e.headers||{}),stream:!0,withCredentials:!1!==e.withCredentials,shouldThrowOnError:!1},e.signal?{signal:e.signal}:{}),e.cache?{cache:e.cache}:{}))];case 1:if(n=o.sent(),e.signal?.aborted)throw new a(`The download was aborted`,0,`STORAGE_PG_ABORTED`);if((r=Number(n?.statusCode??200))===304)throw new a(`Not Modified`,r,`STORAGE_PG_NOT_MODIFIED`);if(r>=400)throw new a(`Download failed with status ${r}`,r,`STORAGE_PG_REQUEST_FAIL`);if(!(i=n?.response))throw new a(`Underlying adapter did not expose the raw Response`,r,`STORAGE_PG_NO_RESPONSE`);return[2,{response:i,status:r,header:n?.header}]}})})},e.prototype.unwrap=function(e,t){return u(this,void 0,Promise,function(){var n,r,i,o;return d(this,function(s){switch(s.label){case 0:n=Number(e?.statusCode??e?.status??200),r=e?.data,s.label=1;case 1:return s.trys.push([1,3,,4]),[4,r];case 2:return r=s.sent(),[3,4];case 3:return s.sent(),r=void 0,[3,4];case 4:if(n>=200&&n<300)return[2,r];throw i=r?.code||r?.error||`STORAGE_PG_REQUEST_FAIL`,o=r?.message||`Storage request failed with status ${n}: ${t}`,new a(o,n,i)}})})},e}(),_=function(){return _=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},_.apply(this,arguments)},v=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},y=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};function x(e){return r(e)?e:new n(e?.message||String(e))}function S(e){var t={};return e?.download!==void 0&&(t.download=!0===e.download?``:e.download),e?.cacheNonce!==void 0&&(t.cacheNonce=String(e.cacheNonce)),{headers:{},query:t}}var C=function(){function e(e){this.ctx=e}return e.prototype.then=function(e,t){return this.execute().then(e,t)},e.prototype.execute=function(){return v(this,void 0,Promise,function(){var e,t,n,r,i;return y(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),e=S(this.ctx.options),t=e.headers,n=e.query,[4,this.ctx.http.download({path:`/object/${this.ctx.bucketId}/${c(this.ctx.cleanName)}`,headers:_(_({},this.ctx.headers),t),query:n,signal:this.ctx.parameters?.signal,cache:this.ctx.parameters?.cache})];case 1:if(!(r=o.sent().response).body)throw new a(`Response body is empty`,r.status,`STORAGE_PG_EMPTY_BODY`);return[2,{data:r.body,error:null}];case 2:if(i=o.sent(),this.ctx.shouldThrowOnError)throw i;return[2,{data:null,error:x(i)}];case 3:return[2]}})})},e}(),w=function(){function e(e){this.ctx=e}return e.prototype.asStream=function(){return new C(this.ctx)},e.prototype.then=function(e,t){return this.execute().then(e,t)},e.prototype.execute=function(){return v(this,void 0,Promise,function(){var e,t,n,r,i,a;return y(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),e=S(this.ctx.options),t=e.headers,n=e.query,[4,this.ctx.http.download({path:`/object/${this.ctx.bucketId}/${c(this.ctx.cleanName)}`,headers:_(_({},this.ctx.headers),t),query:n,signal:this.ctx.parameters?.signal,cache:this.ctx.parameters?.cache})];case 1:return r=o.sent().response,a={},[4,r.blob()];case 2:return[2,(a.data=o.sent(),a.error=null,a)];case 3:if(i=o.sent(),this.ctx.shouldThrowOnError)throw i;return[2,{data:null,error:x(i)}];case 4:return[2]}})})},e}(),T=function(){return T=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},T.apply(this,arguments)},E=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},D=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},ee=`3600`,te=function(){function e(e,t,n){n===void 0&&(n=!1),this.headers={},this.http=e,this.bucketId=t,this.shouldThrowOnError=n}return e.prototype.throwOnError=function(){return this.shouldThrowOnError=!0,this},e.prototype.setHeader=function(e,t){var r;if(typeof e!=`string`||e.trim()===``)throw new n(`setHeader requires a non-empty header name`);if(/[\r\n]/.test(e)||typeof t==`string`&&/[\r\n]/.test(t))throw new n(`setHeader does not allow CR/LF characters in header name or value`);return this.headers=T(T({},this.headers),((r={})[e]=String(t),r)),this},e.prototype.upload=function(e,t,n){return E(this,void 0,Promise,function(){return D(this,function(r){return[2,this.uploadOrUpdate(`POST`,e,t,n)]})})},e.prototype.update=function(e,t,n){return E(this,void 0,Promise,function(){return D(this,function(r){return[2,this.uploadOrUpdate(`PUT`,e,t,n)]})})},e.prototype.download=function(e,t,n){return new w({http:this.http,bucketId:this.bucketId,cleanName:this.cleanPath(e),options:t,parameters:n,headers:this.headers,shouldThrowOnError:this.shouldThrowOnError})},e.prototype.list=function(e,t,n){return E(this,void 0,Promise,function(){var r=this;return D(this,function(i){return[2,h(function(){return E(r,void 0,void 0,function(){var r;return D(this,function(i){return r={prefix:e||``},t?.limit!==void 0&&(r.limit=t.limit),t?.cursor!==void 0&&(r.cursor=t.cursor),t?.withDelimiter!==void 0&&(r.with_delimiter=t.withDelimiter),t?.sortBy!==void 0&&(r.sortBy=t.sortBy),[2,this.send({method:`POST`,path:`/object/list/${this.bucketId}`,json:r,signal:n?.signal,cache:n?.cache})]})})},this.shouldThrowOnError)]})})},e.prototype.remove=function(e){return E(this,void 0,Promise,function(){var t=this;return D(this,function(n){return[2,h(function(){return E(t,void 0,void 0,function(){var t,n,r,i,a,o=this;return D(this,function(s){switch(s.label){case 0:t=e.map(function(e){return o.cleanPath(e)}),n=[],r=0,s.label=1;case 1:return r<t.length?(i=t.slice(r,r+100),[4,this.send({method:`DELETE`,path:`/object/${this.bucketId}`,json:{prefixes:i}})]):[3,4];case 2:a=s.sent(),Array.isArray(a)&&n.push.apply(n,a),s.label=3;case 3:return r+=100,[3,1];case 4:return[2,n]}})})},this.shouldThrowOnError)]})})},e.prototype.copy=function(e,t,n){return E(this,void 0,Promise,function(){var r=this;return D(this,function(i){return[2,h(function(){return E(r,void 0,void 0,function(){var r;return D(this,function(i){switch(i.label){case 0:return r=this.buildCopyMoveHeaders(n),[4,this.send({method:`POST`,path:`/object/copy`,json:{bucketId:this.bucketId,sourceKey:this.cleanPath(e),destinationKey:this.cleanPath(t),destinationBucket:n?.destinationBucket,copyMetadata:n?.copyMetadata,metadata:n?.metadata},headers:r})];case 1:return[2,{path:i.sent().Key}]}})})},this.shouldThrowOnError)]})})},e.prototype.move=function(e,t,n){return E(this,void 0,Promise,function(){var r=this;return D(this,function(i){return[2,h(function(){return E(r,void 0,void 0,function(){return D(this,function(r){switch(r.label){case 0:return[4,this.send({method:`POST`,path:`/object/move`,json:{bucketId:this.bucketId,sourceKey:this.cleanPath(e),destinationKey:this.cleanPath(t),destinationBucket:n?.destinationBucket}})];case 1:return[2,{message:r.sent().message||`Successfully moved`}]}})})},this.shouldThrowOnError)]})})},e.prototype.info=function(e){return E(this,void 0,Promise,function(){var t=this;return D(this,function(n){return[2,h(function(){return E(t,void 0,void 0,function(){var t,n;return D(this,function(r){switch(r.label){case 0:return t=this.cleanPath(e),[4,this.send({method:`GET`,path:`/object/info/${this.bucketId}/${this.encodePath(t)}`})];case 1:return[2,{id:(n=r.sent()).id,name:n.name,version:n.version,bucketId:n.bucket_id,size:n.size,contentType:n.content_type,cacheControl:n.cache_control,etag:n.etag,metadata:n.metadata,lastModified:n.last_modified,createdAt:n.created_at}]}})})},this.shouldThrowOnError)]})})},e.prototype.exists=function(e){return E(this,void 0,Promise,function(){var t,r,i;return D(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),t=this.cleanPath(e),[4,this.send({method:`GET`,path:`/object/info/${this.bucketId}/${this.encodePath(t)}`})];case 1:return a.sent(),[2,{data:!0,error:null}];case 2:if(r=a.sent(),(i=r?.status)!==void 0&&[400,404].includes(Number(i)))return[2,{data:!1,error:null}];if(this.shouldThrowOnError)throw r;return[2,{data:null,error:r instanceof n?r:new n(r?.message||String(r))}];case 3:return[2]}})})},e.prototype.createSignedUrl=function(e,t,n){return E(this,void 0,Promise,function(){var r=this;return D(this,function(i){return[2,h(function(){return E(r,void 0,void 0,function(){var r,i,a;return D(this,function(o){switch(o.label){case 0:return r=this.cleanPath(e),[4,this.send({method:`POST`,path:`/object/sign/${this.bucketId}/${this.encodePath(r)}`,json:{expiresIn:t}})];case 1:return i=o.sent(),a=i.fullSignedURL||this.http.toFullUrl(i.signedURL||``),[2,{fullSignedURL:this.appendUrlOptions(a,n)}]}})})},this.shouldThrowOnError)]})})},e.prototype.createSignedUrls=function(e,t,n){return E(this,void 0,Promise,function(){var r=this;return D(this,function(i){return[2,h(function(){return E(r,void 0,void 0,function(){var r,i,a,o,s=this;return D(this,function(c){switch(c.label){case 0:r=e.map(function(e){return s.cleanPath(e)}),i=[],a=0,c.label=1;case 1:return a<r.length?(o=r.slice(a,a+500),[4,this.send({method:`POST`,path:`/object/sign/${this.bucketId}`,json:{expiresIn:t,paths:o}})]):[3,4];case 2:c.sent().forEach(function(e){var t=e.fullSignedURL||(e.signedURL?s.http.toFullUrl(e.signedURL):null);i.push({path:e.path,fullSignedURL:t?s.appendUrlOptions(t,n):null,error:e.error??null})}),c.label=3;case 3:return a+=500,[3,1];case 4:return[2,i]}})})},this.shouldThrowOnError)]})})},e.prototype.createSignedUploadUrl=function(e,t){return E(this,void 0,Promise,function(){var n=this;return D(this,function(r){return[2,h(function(){return E(n,void 0,void 0,function(){var n,r,i;return D(this,function(a){switch(a.label){case 0:return n=this.cleanPath(e),r={},t!=null&&t.upsert&&(r[`x-upsert`]=`true`),[4,this.send({method:`POST`,path:`/object/upload/sign/${this.bucketId}/${this.encodePath(n)}`,headers:r})];case 1:return[2,{fullSignedURL:(i=a.sent()).fullURL||this.http.toFullUrl(i.url||``),path:n,token:i.token}]}})})},this.shouldThrowOnError)]})})},e.prototype.uploadToSignedUrl=function(e,t,n,r){return E(this,void 0,Promise,function(){var i=this;return D(this,function(a){return[2,h(function(){return E(i,void 0,void 0,function(){var i,a,o,s,c;return D(this,function(l){switch(l.label){case 0:return i=this.cleanPath(e),a=this.buildUploadBody(n,r),o=a.body,s=a.headers,[4,this.send({method:`PUT`,path:`/object/upload/sign/${this.bucketId}/${this.encodePath(i)}`,query:{token:t},rawBody:o,headers:s,withCredentials:!1})];case 1:return c=l.sent(),[2,{path:i,fullPath:c.Key}]}})})},this.shouldThrowOnError)]})})},e.prototype.getPublicUrl=function(e,t){var n=this.cleanPath(e),r=this.http.buildUrl(`/object/public/${this.bucketId}/${this.encodePath(n)}`);return{data:{publicUrl:this.appendUrlOptions(r,t)}}},e.prototype.send=function(e){return this.http.send(T(T({},e),{headers:T(T({},this.headers),e.headers||{})}))},e.prototype.uploadOrUpdate=function(e,t,n,r){return E(this,void 0,Promise,function(){var i=this;return D(this,function(a){return[2,h(function(){return E(i,void 0,void 0,function(){var i,a,o,s,c;return D(this,function(l){switch(l.label){case 0:return i=this.cleanPath(t),a=this.buildUploadBody(n,r),o=a.body,s=a.headers,e===`POST`&&(s[`x-upsert`]=String(!!r?.upsert)),[4,this.send({method:e,path:`/object/${this.bucketId}/${this.encodePath(i)}`,rawBody:o,headers:s})];case 1:return[2,{id:(c=l.sent()).Id,path:i,fullPath:c.Key}]}})})},this.shouldThrowOnError)]})})},e.prototype.cleanPath=function(e){var t=e.replace(/^\/+|\/+$/g,``).replace(/\/+/g,`/`);if(t.split(`/`).some(function(e){return e===`..`}))throw new n(`invalid path: ".." segment is not allowed`);return t},e.prototype.encodePath=function(e){return c(e)},e.prototype.buildUploadBody=function(e,t){var n=T({},t?.headers||{}),r=e,i=typeof FormData<`u`&&e instanceof FormData;if(typeof Blob<`u`&&e instanceof Blob||i){var a=void 0,o={};if(i){var s=this.extractFromFormData(e);a=s.file,o=s.fields}else a=e;var c=t?.cacheControl??o.cacheControl??ee,l=t?.contentType??o.contentType,u=t?.metadata===void 0?o.metadata:JSON.stringify(t.metadata),d=new FormData;c!==void 0&&d.append(`cacheControl`,String(c)),l!==void 0&&d.append(`contentType`,l),u!==void 0&&d.append(`metadata`,u),d.append(``,a),r=d}else r=e,c=t?.cacheControl??ee,l=t?.contentType??`text/plain;charset=UTF-8`,n[`cache-control`]=`max-age=${c}`,l&&(n[`content-type`]=l),t!=null&&t.metadata&&(n[`x-metadata`]=this.toBase64(JSON.stringify(t.metadata)));return{body:r,headers:n}},e.prototype.extractFromFormData=function(e){var t,r={},i=0,a=[];if(e.forEach(function(e,n){if(typeof Blob<`u`&&e instanceof Blob)return t=e,void(i+=1);n!==`cacheControl`&&n!==`contentType`&&n!==`metadata`?a.push(n):r[n]=String(e)}),a.length>0&&console.warn(`Ignored unsupported FormData field(s): [${a.join(`, `)}]. Only file, cacheControl, contentType and metadata are supported`),i===0||!t)throw new n(`FormData must contain a file`);if(i>1)throw new n(`FormData must contain exactly one file`);return{file:t,fields:r}},e.prototype.buildCopyMoveHeaders=function(e){var t={};return e!=null&&e.upsert&&(t[`x-upsert`]=`true`),!1===e?.copyMetadata&&e!=null&&e.metadata&&(t[`x-metadata`]=this.toBase64(JSON.stringify(e.metadata))),t},e.prototype.appendUrlOptions=function(e,t){var n=[];if(t?.download!==void 0){var r=!0===t.download?``:String(t.download);n.push(`download=${encodeURIComponent(r)}`)}return t?.cacheNonce!==void 0&&n.push(`cacheNonce=${encodeURIComponent(String(t.cacheNonce))}`),n.length===0?e:`${e}${e.includes(`?`)?`&`:`?`}${n.join(`&`)}`},e.prototype.toBase64=function(e){return s(e)},e}(),O=/[\x00-\x20\x7f/\\?#%]/;function k(e,t){if(typeof e!=`string`||e.length===0)throw new n(`[storage.${t}] bucketId is required`);if(e.length>256)throw new n(`[storage.${t}] invalid bucketId: length must be 1-256`);var r=O.exec(e);if(r)throw new n(`[storage.${t}] invalid bucketId "${e}": contains forbidden character ${JSON.stringify(r[0])}; must not contain whitespace, control chars, "/", "\\", "?", "#" or "%"`)}var A=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},ne=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},re=function(){function e(e,t){t===void 0&&(t=!1),this.http=new g(e),this.shouldThrowOnError=t}return e.prototype.throwOnError=function(){return this.shouldThrowOnError=!0,this},e.prototype.listBuckets=function(e){return A(this,void 0,Promise,function(){var t=this;return ne(this,function(n){return[2,h(function(){var n={};return e?.limit!==void 0&&(n.limit=e.limit),e?.offset!==void 0&&(n.offset=e.offset),e!=null&&e.sortColumn&&(n.sortColumn=e.sortColumn),e!=null&&e.sortOrder&&(n.sortOrder=e.sortOrder),e!=null&&e.search&&(n.search=e.search),t.http.send({method:`GET`,path:`/bucket/`,query:n})},this.shouldThrowOnError)]})})},e.prototype.getBucket=function(e){return A(this,void 0,Promise,function(){var t=this;return ne(this,function(n){return[2,h(function(){return k(e,`getBucket`),t.http.send({method:`GET`,path:`/bucket/${e}`})},this.shouldThrowOnError)]})})},e.prototype.createBucket=function(e,t){return A(this,void 0,Promise,function(){var n=this;return ne(this,function(r){return[2,h(function(){var r;return k(e,`createBucket`),n.http.send({method:`POST`,path:`/bucket/`,json:{id:e,name:e,public:(r=t?.public)!=null&&r,type:t?.type,file_size_limit:t?.fileSizeLimit,allowed_mime_types:t?.allowedMimeTypes}})},this.shouldThrowOnError)]})})},e.prototype.updateBucket=function(e,t){return A(this,void 0,Promise,function(){var n=this;return ne(this,function(r){return[2,h(function(){return k(e,`updateBucket`),n.http.send({method:`PUT`,path:`/bucket/${e}`,json:{public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes}})},this.shouldThrowOnError)]})})},e.prototype.deleteBucket=function(e){return A(this,void 0,Promise,function(){var t=this;return ne(this,function(n){return[2,h(function(){return k(e,`deleteBucket`),t.http.send({method:`DELETE`,path:`/bucket/${e}`})},this.shouldThrowOnError)]})})},e}();function ie(){return`@cloudbase/js-sdk`}var ae={INVALID_PARAMS:`INVALID_PARAMS`,INVALID_SYNTAX:`INVALID_SYNTAX`,INVALID_OPERATION:`INVALID_OPERATION`,OPERATION_FAIL:`OPERATION_FAIL`,NETWORK_ERROR:`NETWORK_ERROR`,UNKOWN_ERROR:`UNKOWN_ERROR`};let oe=(se={AbstractSDKRequest:()=>f,AbstractStorage:()=>p},ce={},po.d(ce,se),ce);var se,ce,le=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),ue=function(){return ue=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ue.apply(this,arguments)};function de(e){return typeof e==`string`}function fe(e,t){console.warn(`[@cloudbase/js-sdk][${e}]:${t}`)}var pe=function(e){function t(t){var n=e.call(this,t.msg||t.message||``)||this;return n.code=t.code||``,n.requestId=t.requestId||``,Object.defineProperty(n,"message",{value:t.msg||t.message||``,enumerable:!0,writable:!0,configurable:!0}),n}return le(t,e),t}(Error),me=function(e){return new pe(e)};function he(e,t){return(t||me)(e)}function ge(e){if(e&&typeof e==`object`&&e.data&&typeof e.data==`object`){var t=e.data,n=t.code,r=t.message;if(!e.code&&n||!e.message&&r)return ue(ue(ue({},e),!e.code&&n?{code:n}:{}),!e.message&&r?{message:r}:{})}return e}var _e,ve=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),j=function(){return j=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},j.apply(this,arguments)},ye=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},be=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};(function(e){function t(t){var n=e.call(this)||this,r=t.timeout,i=t.timeoutMsg,a=t.restrictedMethods;return n.timeout=r||0,n.timeoutMsg=i||`请求超时`,n.restrictedMethods=a||[`get`,`post`,`upload`,`download`],n}ve(t,e),t.prototype.get=function(e){return this.request(j(j({},e),{method:`get`}),this.restrictedMethods.includes(`get`))},t.prototype.post=function(e){return this.request(j(j({},e),{method:`post`}),this.restrictedMethods.includes(`post`))},t.prototype.put=function(e){return this.request(j(j({},e),{method:`put`}))},t.prototype.upload=function(e){var t=e.data,n=e.file,r=e.name,i=e.method,a=e.headers,o=a===void 0?{}:a,s={post:`post`,put:`put`}[i?.toLowerCase()]||`put`,c=new FormData;return s===`post`?(Object.keys(t).forEach(function(e){c.append(e,t[e])}),c.append(`key`,r),c.append(`file`,n),this.request(j(j({},e),{data:c,method:s}),this.restrictedMethods.includes(`upload`))):this.request(j(j({},e),{method:`put`,headers:o,body:n}),this.restrictedMethods.includes(`upload`))},t.prototype.download=function(e){return ye(this,void 0,Promise,function(){var t,n,r,i;return be(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.get(j(j({},e),{headers:{},responseType:`blob`}))];case 1:return t=a.sent().data,n=window.URL.createObjectURL(new Blob([t])),r=decodeURIComponent(new URL(e.url).pathname.split(`/`).pop()||``),(i=document.createElement(`a`)).href=n,i.setAttribute(`download`,r),i.style.display=`none`,document.body.appendChild(i),i.click(),window.URL.revokeObjectURL(n),document.body.removeChild(i),[3,3];case 2:return a.sent(),[3,3];case 3:return[2,new Promise(function(t){t({statusCode:200,tempFilePath:e.url})})]}})})},t.prototype.fetch=function(e){return ye(this,void 0,Promise,function(){var t,n,r,i,a,o,s,c,l,u,d,f,p,m=this;return be(this,function(h){switch(h.label){case 0:return t=new AbortController,n=e.url,r=e.enableAbort,i=r!==void 0&&r,a=e.stream,o=a!==void 0&&a,s=e.signal,c=e.timeout,l=e.shouldThrowOnError,u=l===void 0||l,d=c??this.timeout,s&&(s.aborted&&t.abort(),s.addEventListener(`abort`,function(){return t.abort()})),f=null,i&&d&&(f=setTimeout(function(){console.warn(m.timeoutMsg),t.abort(Error(m.timeoutMsg))},d)),[4,fetch(n,j(j({},e),{signal:t.signal})).then(function(e){return ye(m,void 0,void 0,function(){var t,n,r;return be(this,function(i){switch(i.label){case 0:return clearTimeout(f),u?e.ok?(t=e,[3,3]):[3,1]:[3,4];case 1:return r=(n=Promise).reject,[4,e.json()];case 2:t=r.apply(n,[i.sent()]),i.label=3;case 3:return[2,t];case 4:return[2,e]}})})}).catch(function(e){return clearTimeout(f),Promise.reject(e)})];case 1:return p=h.sent(),[2,{data:o?p.body:p.headers.get(`content-type`)?.includes(`application/json`)?p.json():p.text(),statusCode:p.status,header:p.headers,response:p}]}})})},t.prototype.request=function(e,t){var n=this;t===void 0&&(t=!1);var r=String(e.method).toLowerCase()||`get`;return new Promise(function(i){var a=e.url,o=e.headers,s=o===void 0?{}:o,c=e.data,l=e.responseType,u=e.withCredentials,d=e.body,f=e.onUploadProgress,p=function(e,t,n){n===void 0&&(n={});var r=/\?/.test(t),i=``;return Object.keys(n).forEach(function(e){i===``?!r&&(t+=`?`):i+=`&`,i+=`${e}=${encodeURIComponent(n[e])}`}),/^http(s)?:\/\//.test(t+=i)?t:`${e}${t}`}(`https:`,a,r===`get`?c:{}),m=new XMLHttpRequest;m.open(r,p),l&&(m.responseType=l);var h,g,_,v=e.signal;v&&(v.aborted?m.abort():v.addEventListener(`abort`,function(){return m.abort()},{once:!0})),Object.keys(s).forEach(function(e){m.setRequestHeader(e,s[e])}),f&&m.upload.addEventListener(`progress`,f),m.onreadystatechange=function(){var e={};if(m.readyState===4){var t=m.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};t.forEach(function(e){var t=e.split(`: `),r=t.shift().toLowerCase();n[r]=t.join(`: `)}),e.header=n,e.statusCode=m.status;try{e.data=l===`blob`?m.response:JSON.parse(m.responseText)}catch{e.data=l===`blob`?m.response:m.responseText}clearTimeout(h),i(e)}},t&&n.timeout&&(h=setTimeout(function(){console.warn(n.timeoutMsg),m.abort()},n.timeout)),_=c,g=Object.prototype.toString.call(_)===`[object FormData]`?c:s[`content-type`]===`application/x-www-form-urlencoded`?function(e){e===void 0&&(e={});var t=[];return Object.keys(e).forEach(function(n){t.push(`${n}=${encodeURIComponent(e[n])}`)}),t.join(`&`)}(c):d||(c?JSON.stringify(c):void 0),u&&(m.withCredentials=!0),m.send(g)})}})(oe.AbstractSDKRequest),function(e){e.WEB=`web`,e.WX_MP=`wx_mp`}(_e||={});var xe=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Se=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},Ce=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},we=function(e){function t(t){var n=e.call(this)||this;return n.root=t,t.tcbCacheObject||={},n}return xe(t,e),t.prototype.setItem=function(e,t){this.root.tcbCacheObject[e]=t},t.prototype.getItem=function(e){return this.root.tcbCacheObject[e]},t.prototype.removeItem=function(e){delete this.root.tcbCacheObject[e]},t.prototype.clear=function(){delete this.root.tcbCacheObject},t}(oe.AbstractStorage);(function(){function e(e){this.keys={};var t=e.persistence,n=e.platformInfo,r=n===void 0?{}:n,i=e.keys,a=i===void 0?{}:i;this.platformInfo=r,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||t,this.storage=function(e,t){switch(e){case`local`:default:return t.localStorage?t.localStorage:(fe(ae.INVALID_PARAMS,`localStorage is not supported on current platform`),new we(t.root));case`none`:return new we(t.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=a)}Object.defineProperty(e.prototype,"mode",{get:function(){return this.storage.mode||`sync`},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),e.prototype.setStore=function(e,t,n){if(this.mode!==`async`){if(this.storage)try{var r={version:n||`localCachev1`,content:t};this.storage.setItem(e,JSON.stringify(r))}catch(e){throw Error(JSON.stringify({code:ae.OPERATION_FAIL,msg:`[@cloudbase/js-sdk][${ae.OPERATION_FAIL}]setStore failed`,info:e}))}}else fe(ae.INVALID_OPERATION,`current platform's storage is asynchronous, please use setStoreAsync insteed`)},e.prototype.setStoreAsync=function(e,t,n){return Se(this,void 0,void 0,function(){var r;return Ce(this,function(i){switch(i.label){case 0:if(!this.storage)return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),r={version:n||`localCachev1`,content:t},[4,this.storage.setItem(e,JSON.stringify(r))];case 2:return i.sent(),[3,4];case 3:return i.sent(),[2];case 4:return[2]}})})},e.prototype.getStore=function(e,t){if(this.mode!==`async`){try{if(typeof process<`u`&&{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token)return{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token;if(!this.storage)return``}catch{return``}t||=`localCachev1`;var n=this.storage.getItem(e);return n&&n.indexOf(t)>=0?JSON.parse(n).content:``}fe(ae.INVALID_OPERATION,`current platform's storage is asynchronous, please use getStoreAsync insteed`)},e.prototype.getStoreAsync=function(e,t){return Se(this,void 0,void 0,function(){var n;return Ce(this,function(r){switch(r.label){case 0:try{if(typeof process<`u`&&{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token)return[2,{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token];if(!this.storage)return[2,``]}catch{return[2,``]}return t||=`localCachev1`,[4,this.storage.getItem(e)];case 1:return(n=r.sent())&&n.indexOf(t)>=0?[2,JSON.parse(n).content]:[2,``]}})})},e.prototype.removeStore=function(e){this.mode===`async`?fe(ae.INVALID_OPERATION,`current platform's storage is asynchronous, please use removeStoreAsync insteed`):this.storage.removeItem(e)},e.prototype.removeStoreAsync=function(e){return Se(this,void 0,void 0,function(){return Ce(this,function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}})})}})();var Te=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),M=function(e,t){this.data=t||null,this.name=e},Ee=function(e){function t(t,n){var r=e.call(this,`error`,{error:t,data:n})||this;return r.error=t,r}return Te(t,e),t}(M),N=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){return function(e,t,n){n[e]=n[e]||[],n[e].push(t)}(e,t,this.listeners),this},e.prototype.off=function(e,t){return function(e,t,n){if(n?.[e]){var r=n[e].indexOf(t);r!==-1&&n[e].splice(r,1)}}(e,t,this.listeners),this},e.prototype.fire=function(e,t){if(e instanceof Ee)return console.error(e.error),this;var n=de(e)?new M(e,t||{}):e,r=n.name;if(this.listens(r)){n.target=this;for(var i=0,a=this.listeners[r]?function(e,t,n){if(n||arguments.length===2)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||=Array.prototype.slice.call(t,0,i),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([],this.listeners[r],!0):[];i<a.length;i++)a[i].call(this,n)}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}();new N,new N,typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.indexOf(`Firefox`),(e=>{var t={};return po.d(t,e),t})({default:()=>b}).default;var P,De=po(388),Oe=function(){return Oe=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Oe.apply(this,arguments)},ke=function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},Ae=function(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)},je=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},Me=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};(function(e){e.put=`put`,e.post=`post`})(P||={});var Ne=ie,Pe=ae,Fe=`https://support.qq.com/products/148793`,Ie=function(e){return Object.prototype.toString.call(e)===`[object Array]`},Le=de,Re=function(e){return Object.prototype.toString.call(e)===`[object Object]`},ze=function(e,t,n){if(n===void 0&&(n=null),e&&typeof e==`function`)return e(t,n);if(t)throw t;return n},Be=function(e,t){if(function(e){return!e||typeof e.throw!=`boolean`||e.throw}(e))throw he(t,e?.errorFactory);return ue({code:t.code,message:t.msg},t.requestId?{requestId:t.requestId}:{})},Ve=fe,He=function(e){return e.mode,e.customInfo,e.title,e.messages,function(e,t,n){}},Ue=`storage`;function We(e,t){return t&&typeof t!=`function`?[Oe(Oe({},e),{customReqOpts:t}),void 0]:[e,t]}var Ge=function(e,t,n){return je(void 0,void 0,void 0,function(){var r,i;return Me(this,function(a){switch(a.label){case 0:return[4,e.gateWay({path:`storages`,name:`get-objects-upload-info`,data:[Oe({objectId:t.path},t.signedHeader?{signedHeader:t.signedHeader}:{})]},n)];case 1:return r=ge(r=a.sent()),i=r.data?.[0]||{},[2,Oe(Oe({},r),{data:Oe(Oe({},i.code?Oe({},i):{}),{authorization:i.authorization,token:i.token,url:i.uploadUrl,fileId:i.cloudObjectId,cosFileId:i.cloudObjectMeta,download_url:i.downloadUrl})})]}})})},Ke=function(e,t,n){return je(void 0,void 0,void 0,function(){var r;return Me(this,function(i){switch(i.label){case 0:return[4,e.gateWay({path:`storages`,name:`get-objects-download-info`,data:t.convertedFileList.map(function(e){return{cloudObjectId:e.fileid}})},n)];case 1:return r=ge(r=i.sent()),[2,Oe(Oe({},r),{data:{download_list:Array.isArray(r.data)?r.data.map(function(e){return{code:e.code||`SUCCESS`,message:e.message,fileid:e.cloudObjectId,download_url:e.downloadUrl,fileID:e.cloudObjectId,tempFileURL:e.downloadUrl,mime_type:e.contentType||F(null,e.cloudObjectId||``)}}):[]}})]}})})},qe=function(e,t,n){return je(void 0,void 0,void 0,function(){var r;return Me(this,function(i){switch(i.label){case 0:return[4,e.gateWay({path:`storages`,name:`delete-objects`,data:t.fileList.map(function(e){return{cloudObjectId:e}})},n)];case 1:return r=ge(r=i.sent()),[2,Oe(Oe({},r),{data:{delete_list:Array.isArray(r.data)?r.data.map(function(e){return{code:e.code||`SUCCESS`,fileID:e.cloudObjectId,message:e.message}}):[]}})]}})})},Je=function(e,t,n){return je(void 0,void 0,void 0,function(){var r;return Me(this,function(i){switch(i.label){case 0:return[4,e.gateWay({path:`storages`,name:`copy-objects`,data:t.convertedFileList.map(function(e){return{srcPath:e.src_path,dstPath:e.dst_path,overwrite:e.overwrite,removeOriginal:e.remove_original}})},n)];case 1:return r=ge(r=i.sent()),[2,Oe(Oe({},r),{data:{copy_list:Array.isArray(r.data)?r.data.map(function(e){return{code:e.code||`SUCCESS`,fileID:e.cloudObjectId,fileId:e.cloudObjectId,message:e.message}}):[]}})]}})})},Ye={txt:`text/plain`,json:`application/json`,html:`text/html`,htm:`text/html`,css:`text/css`,js:`application/javascript`,csv:`text/csv`,xml:`application/xml`,png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,svg:`image/svg+xml`,ico:`image/x-icon`,pdf:`application/pdf`,zip:`application/zip`,gz:`application/gzip`,mp4:`video/mp4`,webm:`video/webm`,mp3:`audio/mpeg`,wav:`audio/wav`};function F(e,t){if(typeof Blob<`u`&&e instanceof Blob&&e.type)return e.type;var n=/\.([a-zA-Z0-9]+)$/.exec(t||``);return Ye[n?n[1].toLowerCase():``]||`application/octet-stream`}function Xe(e,t){var n=t.toLowerCase();return Object.keys(e).some(function(e){return e.toLowerCase()===n})}function Ze(e){return Object.keys(e).reduce(function(t,n){var r;return Oe(Oe({},t),((r={})[n]=[e[n]],r))},{})}var Qe=function(){function e(e){this.context=e}var t,n,r,i,a,s,c,l,u,d,f,p,m,h,g,_;return Object.defineProperty(e.prototype,"config",{get:function(){return this.context?.config},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"request",{get:function(){return this.context?.request},enumerable:!1,configurable:!0}),e.prototype.isGateWay=function(){return(this.config.endPointMode||`CLOUD_API`)===`GATEWAY`},e.prototype.uploadFile=function(e,t){return je(this,void 0,Promise,function(){var n,r,i,a,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,ee,te,O,k,A,ne,re;return Me(this,function(ie){switch(ie.label){case 0:return k=We(e,t),e=k[0],t=k[1],n=e.cloudPath,r=e.filePath,i=e.onUploadProgress,A=e.method,a=A===void 0?`put`:A,ne=e.headers,s=ne===void 0?{}:ne,c=e.fileContent,Le(n)&&(r||c)?(l={put:P.put,post:P.post}[a.toLocaleLowerCase()]||P.put,u=this.isGateWay(),d=Oe({},s),f=Object.keys(s).reduce(function(e,t){return t.toLowerCase()!==`content-length`&&(e[t]=s[t]),e},{}),l===P.put&&u&&(Xe(d,`content-length`)||typeof(p=function(e,t){var n=e??t;if(n!==null){if(typeof Blob<`u`&&n instanceof Blob)return n.size;if(typeof ArrayBuffer<`u`&&(n instanceof ArrayBuffer||typeof ArrayBuffer.isView==`function`&&ArrayBuffer.isView(n)))return n.byteLength;if(typeof n==`string`){if(typeof Blob<`u`)return new Blob([n]).size;var r=(i=n,(a=o())?.byteLength(i));return typeof r==`number`?r:n.length}var i,a;return typeof n==`object`&&typeof n.size==`number`?n.size:void 0}}(r,c))==`number`&&(d[`content-length`]=String(p)),Xe(d,`content-type`)||(d[`content-type`]=F(r,n)),Xe(f,`content-type`)||(f[`content-type`]=F(r,n))),[4,this.getUploadMetadata({cloudPath:n,method:l,headers:l!==P.put||u?void 0:f,signedHeader:l===P.put&&u?Ze(d):void 0,customReqOpts:e.customReqOpts})]):[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.uploadFile] invalid params`})];case 1:return m=ie.sent(),h=m.data,g=m.requestId,(_=h)?.code||!_?.url?(v=_?.code||Pe.OPERATION_FAIL,y=_?.message||`get upload info failed`,[2,ze(t,Error(`[${Ne()}][${v}][${Ue}]:${y}`))]):(b=h.url,x=h.authorization,S=h.token,C=h.fileId,w=h.cosFileId,T=h.download_url,D=Oe(Oe({},E={url:b,file:r,name:n,onUploadProgress:i,fileContent:c,fileId:C,requestId:g}),{method:P.put,headers:Oe(Oe({},f),{authorization:x,"x-cos-meta-fileid":w,"x-cos-security-token":S})}),ee=Oe(Oe({},E),{method:P.post,data:{key:n,signature:x,"x-cos-meta-fileid":w,success_action_status:`201`,"x-cos-security-token":S}}),(re={})[P.put]={params:D,isSuccess:function(e){return e>=200&&e<300}},re[P.post]={params:ee,isSuccess:function(e){return e===201}},te=re,[4,this.request.upload(te[l].params)]);case 2:return O=ie.sent(),te[l].isSuccess(O.statusCode)?[2,ze(t,null,{fileID:C,download_url:T,requestId:g})]:[2,ze(t,Error(`[${Ne()}][${Pe.OPERATION_FAIL}][${Ue}]:${O.data}`))]}})})},e.prototype.getUploadMetadata=function(e,t){return je(this,void 0,Promise,function(){var n,r,i,a,o,s,c,l,u,d;return Me(this,function(f){switch(f.label){case 0:if(n=e.cloudPath,r=e.method,i=e.headers,a=e.signedHeader,!Le(n))return[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.getUploadMetadata] invalid cloudPath`})];o=this.request,s=`storage.getUploadMetadata`,f.label=1;case 1:return f.trys.push([1,6,,7]),c=void 0,l={path:n},u=this.isGateWay(),r&&(l.method=r),r===P.put&&(u&&a?l.signedHeader=a:!u&&i&&(l.headers=i)),r!==P.post&&u?[3,3]:[4,o.send(s,l,{endPointMode:`CLOUD_API`},e.customReqOpts)];case 2:return c=f.sent(),[3,5];case 3:return[4,Ge(o,l,e.customReqOpts)];case 4:c=f.sent(),f.label=5;case 5:return[2,ze(t,null,c)];case 6:return d=f.sent(),[2,ze(t,d)];case 7:return[2]}})})},e.prototype.deleteFile=function(e,t){return je(this,void 0,Promise,function(){var n,r,i,a,o,s,c,l,u;return Me(this,function(d){switch(d.label){case 0:if(u=We(e,t),e=u[0],t=u[1],!(n=e.fileList)||!Ie(n)||n.length===0)return[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.deleteFile] fileList must not be empty`})];for(r=0,i=n;r<i.length;r++)if(!(a=i[r])||!Le(a))return[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.deleteFile] fileID must be string`})];return o=`storage.batchDeleteFile`,s=this.request,c={},this.isGateWay()?[4,qe(s,{fileList:n},e.customReqOpts)]:[3,2];case 1:return c=d.sent(),[3,4];case 2:return[4,s.send(o,{fileid_list:n},e.customReqOpts)];case 3:c=d.sent(),d.label=4;case 4:return c.code?[2,ze(t,null,c)]:(l={fileList:c.data.delete_list,requestId:c.requestId},[2,ze(t,null,l)])}})})},e.prototype.getTempFileURL=function(e,t){return je(this,void 0,Promise,function(){var n,r,i,a,o,s,c,l,u,d;return Me(this,function(f){switch(f.label){case 0:if(d=We(e,t),e=d[0],t=d[1],!(n=e.fileList)||!Ie(n)||n.length===0)return[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.getTempFileURL] fileList must not be empty`})];for(r=[],i=!1,a=0,o=n;a<o.length;a++)if(s=o[a],Re(s)){if(!Object.prototype.hasOwnProperty.call(s,`fileID`))return[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.getTempFileURL] file info must include fileID`})];!i&&Object.prototype.hasOwnProperty.call(s,`maxAge`)&&(Ve(Pe.INVALID_PARAMS,`[${Ue}.getTempFileURL] maxAge 仅为兼容字段,传统模式不会用它生成下载链接,TTL 传入无效。需要可控过期请改用 app.storage.from(bucketId).createSignedUrl(path, expiresIn)(PG 模式下可用)。`),i=!0),r.push({fileid:s.fileID,max_age:s.maxAge||7200})}else{if(!Le(s))return[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.getTempFileURL] invalid fileList`})];r.push({fileid:s})}return c=`storage.batchGetDownloadUrl`,l=this.request,u={},this.isGateWay()?[4,Ke(l,{convertedFileList:r},e.customReqOpts)]:[3,2];case 1:return u=f.sent(),[3,4];case 2:return[4,l.send(c,{file_list:r},e.customReqOpts)];case 3:u=f.sent(),f.label=4;case 4:return u.code?[2,ze(t,null,u)]:[2,ze(t,null,{fileList:Array.isArray(u.data?.download_list)?u.data.download_list:[],requestId:u.requestId})]}})})},e.prototype.downloadFile=function(e,t){return je(this,void 0,Promise,function(){var n,r,i,a,o,s,c;return Me(this,function(l){switch(l.label){case 0:return c=We(e,t),e=c[0],t=c[1],n=e.fileID,Le(n)?[4,this.getTempFileURL.call(this,{fileList:[n],customReqOpts:e.customReqOpts})]:[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.getTempFileURL] fileID must be string`})];case 1:return r=l.sent(),(i=r.fileList[0]).code===`SUCCESS`?(a=this.request,o=encodeURI(i.download_url),[4,a.download({url:o,tempFilePath:e.tempFilePath})]):[2,ze(t,i)];case 2:return s=l.sent(),[2,ze(t,null,s)]}})})},e.prototype.copyFile=function(e,t){return je(this,void 0,Promise,function(){var n,r,i,a,o,s,c,l,u,d;return Me(this,function(f){switch(f.label){case 0:if(d=We(e,t),e=d[0],t=d[1],!(n=e.fileList)||!Ie(n)||n.length===0)return[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.copyFile] fileList must not be empty`})];for(r=[],i=0,a=n;i<a.length;i++){if(o=a[i],s=o.srcPath,c=o.dstPath,!s||!c||typeof s!=`string`||typeof c!=`string`)return[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.copyFile] srcPath and dstPath may not be empty`})];if(s===c)return[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.copyFile] srcPath and dstPath can not be the same`})];r.push({src_path:s,dst_path:c,overwrite:o.overwrite,remove_original:o.removeOriginal})}return l=this.request,u={},this.isGateWay()?[4,Je(l,{convertedFileList:r},e.customReqOpts)]:[3,2];case 1:return u=f.sent(),[3,4];case 2:return[4,l.send(`storage.batchCopyFile`,{file_list:r},e.customReqOpts)];case 3:u=f.sent(),f.label=4;case 4:return u.code?[2,ze(t,null,u)]:[2,ze(t,null,{fileList:u.data.copy_list,requestId:u.requestId})]}})})},e.prototype.getFileInfo=function(e){return je(this,void 0,Promise,function(){var t,n=this;return Me(this,function(r){switch(r.label){case 0:return[4,this.getTempFileURL(e)];case 1:return(t=r.sent())?.fileList&&t?.fileList?.length>0?[4,Promise.all(t.fileList.map(function(e){return je(n,void 0,void 0,function(){var t,n,r,i,a,o,s;return Me(this,function(c){switch(c.label){case 0:if(e.code!==`SUCCESS`)return[2,{code:e.code,fileID:e.fileID,tempFileURL:e.tempFileURL,message:e.message}];c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this.request.fetch({url:e.tempFileURL,method:`HEAD`})];case 2:return t=c.sent(),n=t.header,typeof Headers<`u`&&n instanceof Headers&&(r={},n.forEach(function(e,t){r[t]=e}),n=r),i=parseInt(n[`content-length`])||0,a=n[`content-type`]||``,[400,404].includes(Number(t.statusCode))?[2,{code:`FILE_NOT_FOUND`,fileID:e.fileID,tempFileURL:e.tempFileURL,message:`file not found`}]:[2,{code:e.code,fileID:e.fileID,tempFileURL:e.tempFileURL,cloudId:e.fileID,fileName:e.fileID.split(`/`).pop(),contentType:a,mime:a.split(`;`)[0].trim(),size:i,etag:n.etag||``,lastModified:n[`last-modified`]||``,cacheControl:n[`cache-control`]||``}];case 3:return o=c.sent(),s=typeof o==`object`&&o&&`message`in o?String(o.message):void 0,[2,{code:`FETCH_FILE_INFO_ERROR`,fileID:e.fileID,tempFileURL:e.tempFileURL,message:s}];case 4:return[2]}})})}))]:[3,3];case 2:return[2,{fileList:r.sent(),requestId:t.requestId}];case 3:return[2,{fileList:[],requestId:t.requestId}]}})})},ke([He({customInfo:{className:`Cloudbase`,methodName:`uploadFile`},title:`上传文件失败`,messages:[`请确认以下各项:`,` 1 - 调用 uploadFile() 的语法或参数是否正确`,` 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety`,` 3 - 云存储安全规则是否限制了当前登录状态访问`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${Fe}`]}),Ae(`design:type`,Function),Ae(`design:paramtypes`,[Object,typeof(t=typeof Function<`u`&&Function)==`function`?t:Object]),Ae(`design:returntype`,typeof(n=typeof Promise<`u`&&Promise)==`function`?n:Object)],e.prototype,`uploadFile`,null),ke([He({customInfo:{className:`Cloudbase`,methodName:`getUploadMetadata`},title:`获取上传元信息失败`,messages:[`请确认以下各项:`,` 1 - 调用 getUploadMetadata() 的语法或参数是否正确`,` 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety`,` 3 - 云存储安全规则是否限制了当前登录状态访问`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${Fe}`]}),Ae(`design:type`,Function),Ae(`design:paramtypes`,[Object,typeof(r=typeof Function<`u`&&Function)==`function`?r:Object]),Ae(`design:returntype`,typeof(i=typeof Promise<`u`&&Promise)==`function`?i:Object)],e.prototype,`getUploadMetadata`,null),ke([He({customInfo:{className:`Cloudbase`,methodName:`deleteFile`},title:`删除文件失败`,messages:[`请确认以下各项:`,` 1 - 调用 deleteFile() 的语法或参数是否正确`,` 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety`,` 3 - 云存储安全规则是否限制了当前登录状态访问`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${Fe}`]}),Ae(`design:type`,Function),Ae(`design:paramtypes`,[typeof(a=De.ICloudbaseDeleteFileParams!==void 0&&De.ICloudbaseDeleteFileParams)==`function`?a:Object,typeof(s=typeof Function<`u`&&Function)==`function`?s:Object]),Ae(`design:returntype`,typeof(c=typeof Promise<`u`&&Promise)==`function`?c:Object)],e.prototype,`deleteFile`,null),ke([He({customInfo:{className:`Cloudbase`,methodName:`getTempFileURL`},title:`获取文件下载链接`,messages:[`请确认以下各项:`,` 1 - 调用 getTempFileURL() 的语法或参数是否正确`,` 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety`,` 3 - 云存储安全规则是否限制了当前登录状态访问`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${Fe}`]}),Ae(`design:type`,Function),Ae(`design:paramtypes`,[typeof(l=De.ICloudbaseGetTempFileURLParams!==void 0&&De.ICloudbaseGetTempFileURLParams)==`function`?l:Object,typeof(u=typeof Function<`u`&&Function)==`function`?u:Object]),Ae(`design:returntype`,typeof(d=typeof Promise<`u`&&Promise)==`function`?d:Object)],e.prototype,`getTempFileURL`,null),ke([He({customInfo:{className:`Cloudbase`,methodName:`downloadFile`},title:`下载文件失败`,messages:[`请确认以下各项:`,` 1 - 调用 downloadFile() 的语法或参数是否正确`,` 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety`,` 3 - 云存储安全规则是否限制了当前登录状态访问`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${Fe}`]}),Ae(`design:type`,Function),Ae(`design:paramtypes`,[typeof(f=De.ICloudbaseDownloadFileParams!==void 0&&De.ICloudbaseDownloadFileParams)==`function`?f:Object,typeof(p=typeof Function<`u`&&Function)==`function`?p:Object]),Ae(`design:returntype`,typeof(m=typeof Promise<`u`&&Promise)==`function`?m:Object)],e.prototype,`downloadFile`,null),ke([He({customInfo:{className:`Cloudbase`,methodName:`copyFile`},title:`批量复制文件`,messages:[`请确认以下各项:`,` 1 - 调用 copyFile() 的语法或参数是否正确`,` 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety`,` 3 - 云存储安全规则是否限制了当前登录状态访问`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${Fe}`]}),Ae(`design:type`,Function),Ae(`design:paramtypes`,[typeof(h=De.ICloudbaseCopyFileParams!==void 0&&De.ICloudbaseCopyFileParams)==`function`?h:Object,typeof(g=typeof Function<`u`&&Function)==`function`?g:Object]),Ae(`design:returntype`,typeof(_=typeof Promise<`u`&&Promise)==`function`?_:Object)],e.prototype,`copyFile`,null),e}(),$e=function(){return $e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},$e.apply(this,arguments)},et=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},I=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},tt=ae,L=function(){function e(e,t){t===void 0&&(t=!1),this.shouldThrowOnError=!1,this.bucketId=``,this.context=e,this.shouldThrowOnError=t,this.storage=new Qe(e)}return Object.defineProperty(e.prototype,"config",{get:function(){return this.context?.config},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"request",{get:function(){return this.context?.request},enumerable:!1,configurable:!0}),e.prototype.throwOnError=function(){return this.shouldThrowOnError=!0,this},e.prototype.upload=function(e,t,n){return et(this,void 0,Promise,function(){var i,a,o,s,c,l,u,d,f;return I(this,function(p){switch(p.label){case 0:i=$e({upsert:!0},n),a=i.cacheControl,o=i.contentType,s=i.metadata,p.label=1;case 1:return p.trys.push([1,3,,4]),c=this.getCloudPath(e),l={cloudPath:c,filePath:t},(a||o||s)&&(u={},a&&(u[`cache-control`]=a),o&&(u[`content-type`]=o),s&&(u[`x-cos-metadata-metadata`]=this.toBase64(JSON.stringify(s))),l.headers=u),[4,this.storage.uploadFile(l)];case 2:if(!(d=p.sent()).fileID)throw Error(JSON.stringify({code:tt.OPERATION_FAIL,msg:`[${Ue}.update] no fileID returned`}));return[2,{data:{id:d.fileID,path:e,fullPath:e},error:null}];case 3:if(f=p.sent(),this.shouldThrowOnError)throw f;if(r(f))return[2,{data:null,error:f}];throw f;case 4:return[2]}})})},e.prototype.uploadToSignedUrl=function(e,t,n,r){return et(this,void 0,Promise,function(){return I(this,function(t){return[2,this.upload(e,n,r)]})})},e.prototype.createSignedUploadUrl=function(e){return et(this,void 0,Promise,function(){var t,r,i;return I(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),t=this.getCloudPath(e),[4,this.storage.getUploadMetadata({cloudPath:t})];case 1:return[2,{data:{signedUrl:(r=a.sent().data).url,token:r.token,path:e,authorization:r.authorization,id:r.fileId,cosFileId:r.cosFileId,downloadUrl:r.download_url},error:null}];case 2:if(i=a.sent(),this.shouldThrowOnError)throw i;return[2,{data:null,error:i instanceof n?i:new n(i.message)}];case 3:return[2]}})})},e.prototype.update=function(e,t,n){return et(this,void 0,Promise,function(){return I(this,function(r){return[2,this.upload(e,t,$e($e({},n),{upsert:!0}))]})})},e.prototype.move=function(e,t){return et(this,void 0,Promise,function(){var i,a;return I(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.storage.copyFile({fileList:[{srcPath:this.getCloudPath(e),dstPath:this.getCloudPath(t),overwrite:!0,removeOriginal:!0}]})];case 1:if((i=o.sent()).fileList[0].code&&i.fileList[0].code!==`SUCCESS`)throw new n(i.fileList[0].message||`Move failed`);return[2,{data:{message:`File moved from ${e} to ${t}`},error:null}];case 2:if(a=o.sent(),this.shouldThrowOnError)throw a;if(r(a))return[2,{data:null,error:a}];throw a;case 3:return[2]}})})},e.prototype.copy=function(e,t){return et(this,void 0,Promise,function(){var i,a;return I(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.storage.copyFile({fileList:[{srcPath:this.getCloudPath(e),dstPath:this.getCloudPath(t),overwrite:!0,removeOriginal:!1}]})];case 1:if((i=o.sent()).fileList[0].code&&i.fileList[0].code!==`SUCCESS`)throw new n(i.fileList[0].message||`Copy failed`);return[2,{data:{path:this.getCloudPath(t)},error:null}];case 2:if(a=o.sent(),this.shouldThrowOnError)throw a;if(r(a))return[2,{data:null,error:a}];throw a;case 3:return[2]}})})},e.prototype.createSignedUrl=function(e,t,i){return et(this,void 0,Promise,function(){var t,a,o,s,c,l,u;return I(this,function(d){switch(d.label){case 0:return d.trys.push([0,2,,3]),t=this.normalizeCloudId(e),[4,this.storage.getTempFileURL({fileList:[t]})];case 1:if((a=d.sent()).fileList[0].code!==`SUCCESS`)throw new n(`Failed to create signed URL: [${a.fileList[0].code}] ${a.fileList[0].fileID}`);return o=a.fileList[0].download_url,s=[],i?.download!==void 0&&(typeof i.download==`string`?s.push(`download=${encodeURIComponent(i.download)}`):!0===i.download&&s.push(`download=true`)),i!=null&&i.transform&&(c=this.transformOptsToQueryString(i.transform))&&s.push(c),s.length>0&&(l=o.includes(`?`)?`&`:`?`,o=`${o}${l}${s.join(`&`)}`),[2,{data:{signedUrl:o},error:null}];case 2:if(u=d.sent(),this.shouldThrowOnError)throw u;if(r(u))return[2,{data:null,error:u}];throw u;case 3:return[2]}})})},e.prototype.createSignedUrls=function(e,t){return et(this,void 0,Promise,function(){var t,n,i=this;return I(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),t=e.map(function(e){return i.normalizeCloudId(e)}),[4,this.storage.getTempFileURL({fileList:t})];case 1:return[2,{data:a.sent().fileList.map(function(t,n){return{path:e[n],signedUrl:t.tempFileURL||``,error:t.code===`SUCCESS`?null:t.message}}),error:null}];case 2:if(n=a.sent(),this.shouldThrowOnError)throw n;if(r(n))return[2,{data:null,error:n}];throw n;case 3:return[2]}})})},e.prototype.download=function(e,t){return et(this,void 0,Promise,function(){var i,a,o=this;return I(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),a={},[4,et(o,void 0,void 0,function(){var r,i,a;return I(this,function(o){switch(o.label){case 0:return[4,this.createSignedUrl(e,600,{transform:t})];case 1:if((r=o.sent()).error)throw r.error;return i=encodeURI(r.data?.signedUrl),[4,this.request.reqClass.get({url:i,headers:{},responseType:`blob`})];case 2:if(!(a=o.sent().data))throw new n(`Download failed: no file content`);return[2,new Blob([a])]}})})];case 1:return[2,(a.data=s.sent(),a.error=null,a)];case 2:if(i=s.sent(),this.shouldThrowOnError)throw i;if(r(i))return[2,{data:null,error:i}];throw i;case 3:return[2]}})})},e.prototype.info=function(e){return et(this,void 0,Promise,function(){var t,r,i,a,o,s,c,l;return I(this,function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),t=e.startsWith(`cloud://`),r=t?this.extractPathFromFileId(e):e,i=t?this.extractBucketFromFileId(e):this.bucketId,[4,this.storage.getFileInfo({fileList:[this.normalizeCloudId(e)]})];case 1:if(a=u.sent(),(o=a.fileList[0]).code!==`SUCCESS`)throw new n(o.message);return s=new Date().toISOString(),c=(o.lastModified?new Date(o.lastModified):new Date).toISOString(),[2,{data:{id:o.fileID,version:`1`,name:r,bucketId:i,updatedAt:c,createdAt:c,lastAccessedAt:s,size:o.size,cacheControl:o.cacheControl,contentType:o.contentType,etag:o.etag,lastModified:c,metadata:{}},error:null}];case 2:if(l=u.sent(),this.shouldThrowOnError)throw l;return[2,{data:null,error:l instanceof n?l:new n(l.message)}];case 3:return[2]}})})},e.prototype.exists=function(e){return et(this,void 0,Promise,function(){var t,i,a;return I(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.storage.getFileInfo({fileList:[this.normalizeCloudId(e)]})];case 1:if(t=o.sent(),(i=t.fileList[0]).code===`FILE_NOT_FOUND`)return[2,{data:!1,error:null}];if(i.code!==`SUCCESS`)throw new n(i.message);return[2,{data:!0,error:null}];case 2:if(a=o.sent(),this.shouldThrowOnError)throw a;if(r(a))return[2,{data:null,error:a}];throw a;case 3:return[2]}})})},e.prototype.getPublicUrl=function(e,t){return et(this,void 0,Promise,function(){var n;return I(this,function(r){switch(r.label){case 0:return[4,this.createSignedUrl(e,600,t)];case 1:return(n=r.sent()).data?[2,{data:{publicUrl:n.data.signedUrl}}]:[2,{data:null,error:n.error}]}})})},e.prototype.remove=function(e){return et(this,void 0,Promise,function(){var t,i,a,o,s,c,l,u,d,f,p=this;return I(this,function(m){switch(m.label){case 0:for(m.trys.push([0,3,,4]),t=10,i=[],a=0;a<e.length;a+=t)i.push(e.slice(a,a+t));return[4,Promise.all(i.map(function(e){return Promise.all(e.map(function(e){return p.info(e)}))}))];case 1:return o=m.sent(),s=new Map,o.forEach(function(n,r){n.forEach(function(n,i){n.data&&s.set(e[r*t+i],n.data)})}),c=e.map(function(e){return p.normalizeCloudId(e)}),[4,this.storage.deleteFile({fileList:c})];case 2:if(l=m.sent(),(u=l.fileList.filter(function(e){return e.code!==`SUCCESS`})).length>0)throw new n(`Delete failed for ${u.length} file(s)`);return d=new Date().toISOString(),[2,{data:e.map(function(e){var t=s.get(e);return{name:t?.name,id:t?.id,bucket_id:t?.bucketId,owner:void 0,updated_at:t?.updatedAt||d,created_at:t?.createdAt,last_accessed_at:t?.lastAccessedAt||d,metadata:t?.metadata||{},buckets:{id:t?.bucketId,name:t?.bucketId,owner:void 0,public:!1,created_at:``,updated_at:d}}}),error:null}];case 3:if(f=m.sent(),this.shouldThrowOnError)throw f;if(r(f))return[2,{data:null,error:f}];throw f;case 4:return[2]}})})},e.prototype.list=function(){return et(this,void 0,void 0,function(){return I(this,function(e){throw new n(`Not implemented`)})})},e.prototype.getCloudPath=function(e){return e.replace(/^\/|\/$/g,``).replace(/\/+/g,`/`)},e.prototype.normalizeCloudId=function(e){if(/^cloud:\/\//.test(e))return e;var t=this.getCloudPath(e);if(!this.bucketId)throw new n(`bucketId is not set`);var r=this.config?.env||``;return r?`cloud://${r}.${this.bucketId}/${t}`:void 0},e.prototype.toBase64=function(e){return s(e)},e.prototype.transformOptsToQueryString=function(e){var t=[`imageMogr2`];if(e.width||e.height){var n=e.width||``,r=e.height||``;e.resize===`fill`?t.push(`thumbnail/${n}x${r}!`):e.resize===`contain`?t.push(`thumbnail/${n}x${r}`):t.push(`thumbnail/${n}x${r}^`)}if(e.format&&e.format!==`origin`&&t.push(`format/${e.format}`),e.quality!==void 0){var i=Math.max(1,Math.min(100,e.quality));t.push(`quality/${i}`)}return t.join(`/`)},e.prototype.extractPathFromFileId=function(e){var t=e.replace(/^cloud:\/\//,``).split(`/`);return t.length<2?e:t.slice(1).join(`/`)},e.prototype.extractBucketFromFileId=function(e){var t=e.replace(/^cloud:\/\//,``).split(`/`);if(t.length<1)return``;var n=t[0],r=n.indexOf(`.`);return r===-1?n:n.substring(r+1)},e}(),R=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),nt=new Qe,rt={name:Ue,entity:{uploadFile:nt.uploadFile,deleteFile:nt.deleteFile,getTempFileURL:nt.getTempFileURL,downloadFile:nt.downloadFile,getUploadMetadata:nt.getUploadMetadata,copyFile:nt.copyFile,getFileInfo:nt.getFileInfo,isGateWay:nt.isGateWay}},it=function(e){function t(){return e!==null&&e.apply(this,arguments)||this}return R(t,e),t.prototype.from=function(e){return e?(k(e,`from`),new te(this.http,e,this.shouldThrowOnError)):new L(this.http.ctx,this.shouldThrowOnError)},t}(re),at={name:`${Ue}/supabase`,IIFE:!0,entity:function(){var e=new WeakMap;Object.defineProperty(this.prototype,"storage",{get:function(){if(e.has(this))return e.get(this);var t=this,n=new it(new Proxy({},{get:function(e,n){return n===`config`?t.config:n===`request`?t.request:void 0}}));return e.set(this,n),n},configurable:!0,enumerable:!0})}};try{cloudbase.registerComponent(rt),cloudbase.registerComponent(at)}catch{}function z(e){try{e.registerComponent(rt),e.registerComponent(at)}catch(e){console.warn(e)}}try{window.registerStorage=z}catch{}var ot=z})(),mo.v;var ho=`2.0.4`,go=[`webhook`,`qmsg`,`serverchan`,`pushplus`,`pushplushxtrip`,`dingtalk`,`wecom`,`bark`,`gocqhttp`,`onebot`,`atri`,`pushdeer`,`igot`,`telegram`,`feishu`,`ifttt`,`wecombot`,`discord`,`wxpusher`,`join`],_o=class extends Error{kind;httpStatus;rawMessage;requestId;constructor(e,t,n={}){super(t),this.name=`TwikooError`,this.kind=e,this.httpStatus=n.httpStatus,this.rawMessage=n.rawMessage??t,this.requestId=n.requestId}},vo={tcb:null,options:{}};function yo(e,t){vo.tcb=e,vo.options=t}function bo(){return vo}function xo(e){return typeof e==`string`&&/^http(s)?:\/\//.test(e)}function So(e,t){return new Promise((n,r)=>{let i=localStorage.getItem(`twikoo-access-token`),a=new XMLHttpRequest,o=Date.now();a.onreadystatechange=()=>{if(a.readyState!==4)return;let e=Date.now()-o;if(a.status===200)try{let e=JSON.parse(a.responseText);e.accessToken&&localStorage.setItem(`twikoo-access-token`,typeof e.accessToken==`string`?e.accessToken:``),n(e)}catch{r(new _o(`UNKNOWN`,`后端返回格式异常`,{rawMessage:a.responseText.slice(0,200)}))}else a.status===0?r(new _o(e>3e4?`TIMEOUT`:`CORS`,`请求被跨域策略拦截或网络不可达`,{rawMessage:a.statusText||`status 0`})):a.status===404?r(new _o(`NOT_FOUND`,`接口地址不存在`,{httpStatus:404,rawMessage:a.responseText.slice(0,200)})):a.status===401||a.status===403?r(new _o(`CLIENT_ERROR`,`认证失败,请重新登录`,{httpStatus:a.status,rawMessage:a.responseText.slice(0,200)})):a.status===429?r(new _o(`REJECTED`,`请求过于频繁`,{httpStatus:429,rawMessage:a.responseText.slice(0,200)})):a.status>=500?r(new _o(`SERVER_ERROR`,`后端异常`,{httpStatus:a.status,rawMessage:a.responseText.slice(0,200)})):r(new _o(`CLIENT_ERROR`,`请求失败(${a.status})`,{httpStatus:a.status,rawMessage:a.responseText.slice(0,200)}))};try{a.open(`POST`,e),a.setRequestHeader(`Content-Type`,`application/json`),a.send(JSON.stringify({accessToken:i,...t,envId:e}))}catch(e){r(new _o(`NETWORK`,`无法连接到后端`,{rawMessage:String(e)}))}})}async function Co(e,t,n={}){let r=e??vo.tcb,i=typeof n.envId==`string`?n.envId:typeof vo.options.envId==`string`?vo.options.envId:void 0,a=typeof n.funcName==`string`?n.funcName:typeof vo.options.funcName==`string`?vo.options.funcName:`twikoo`;if(r)return await r.app.callFunction({name:a,data:{event:t,...n}});if(typeof i==`string`&&xo(i))return await So(i,{event:t,...n});throw Error(`缺少 envId 配置 - https://twikoo.js.org`)}var wo={verbose:1,info:2,warn:3,error:4}[(typeof process<`u`&&process.env,`info`).toLowerCase()]||2,To={verbose:(...e)=>{wo<=1&&console.log(...e)},info:(...e)=>{wo<=2&&console.info(...e)},warn:(...e)=>{wo<=3&&console.warn(...e)},error:(...e)=>{wo<=4&&console.error(...e)}},Eo={ADMIN_CLIENT_VERSION:`前端版本:`,ADMIN_SERVER_VERSION:`云函数版本:`,ADMIN_COMMENT:`评论管理`,ADMIN_COMMENT_DELETE:`删除`,ADMIN_COMMENT_DELETE_CONFIRM:`确认删除?`,ADMIN_COMMENT_FILTER_ALL:`全部`,ADMIN_COMMENT_FILTER_VISIBLE:`只看可见`,ADMIN_COMMENT_FILTER_HIDDEN:`只看隐藏`,ADMIN_COMMENT_HIDE:`隐藏`,ADMIN_COMMENT_IS_SPAM_SUFFIX:` (已隐藏)`,ADMIN_COMMENT_SEARCH:`搜索`,ADMIN_COMMENT_SEARCH_PLACEHOLDER:`搜索昵称、邮箱、网址、IP、评论正文、文章地址`,ADMIN_COMMENT_SHOW:`显示`,ADMIN_COMMENT_TOP:`置顶`,ADMIN_COMMENT_UNTOP:`取消置顶`,ADMIN_COMMENT_VIEW:`查看`,ADMIN_COMMENT_SECURITY_ALERT:`评论链接与本站不同!出于安全考虑,请手动复制以下网址访问:`,ADMIN_COMMENT_PARSE_ERROR:`无法解析评论链接,请仔细检查链接后手动复制以下网址访问:`,ADMIN_CONFIG:`配置管理`,ADMIN_CONFIG_CATEGORY_COMMON:`通用`,ADMIN_CONFIG_CATEGORY_IM:`即时通知`,ADMIN_CONFIG_CATEGORY_MAIL:`邮件通知`,ADMIN_CONFIG_CATEGORY_PLUGIN:`插件`,ADMIN_CONFIG_CATEGORY_PRIVACY:`隐私`,ADMIN_CONFIG_CATEGORY_SPAM:`反垃圾`,ADMIN_CONFIG_CATEGORY_CAPTCHA:`人机验证`,ADMIN_CONFIG_IMAGE_CDN_NONE:`无(不启用图片上传)`,ADMIN_CONFIG_CAPTCHA_NONE:`无`,ADMIN_CONFIG_CAPTCHA_TURNSTILE:`Cloudflare Turnstile`,ADMIN_CONFIG_CAPTCHA_GEETEST:`极验 Geetest`,ADMIN_CONFIG_CAPTCHA_CAP:`Cap`,ADMIN_CONFIG_EMAIL_TEST:`邮件通知测试`,ADMIN_CONFIG_EMAIL_TEST_BTN:`发送测试邮件`,ADMIN_CONFIG_EMAIL_TEST_HELP:`输入一个邮箱地址,发送测试邮件`,ADMIN_CONFIG_EMAIL_TEST_RESULT:`测试结果:`,ADMIN_CONFIG_EXAMPLE:`示例:`,ADMIN_CONFIG_ITEM_AKISMET_KEY:`Akismet 反垃圾评论,用于垃圾评论检测,设为 "MANUAL_REVIEW" 开启人工审核,留空不使用反垃圾。注册:https://akismet.com`,ADMIN_CONFIG_ITEM_BLOGGER_NICK:`博主的昵称。`,ADMIN_CONFIG_ITEM_BLOGGER_EMAIL:`博主的邮箱地址,用于邮件通知、博主标识。`,ADMIN_CONFIG_ITEM_COMMENT_BG_IMG:`评论框自定义背景图片 URL 地址。`,ADMIN_CONFIG_ITEM_COMMENT_PAGE_SIZE:`评论列表分页大小,默认为 8。`,ADMIN_CONFIG_ITEM_COMMENT_PLACEHOLDER:`评论框提示信息,可用<br>换行,默认为空`,ADMIN_CONFIG_ITEM_CORS_ALLOW_ORIGIN:`CORS 安全域名,注意:如果您不了解什么是 CORS,此项请留空,错误设置会导致无法加载,默认为空,格式为 https://blog.example.com;如需添加多域名请使用,分隔`,ADMIN_CONFIG_ITEM_DEFAULT_GRAVATAR:`默认的头像显示。默认值(留空)为 "initials",可选:"404"、"mp"、"identicon"、"monsterid"、"wavatar"、"retro"、"robohash"、"blank"`,ADMIN_CONFIG_ITEM_EMOTION_CDN:`表情 CDN,英文逗号分隔。默认为:https://owo.imaegoo.com/owo.json`,ADMIN_CONFIG_ITEM_FORBIDDEN_WORDS:`违禁词配置,包含违禁词的内容会直接标记为垃圾评论。英文逗号分隔。`,ADMIN_CONFIG_ITEM_BLOCKED_WORDS:`屏蔽词配置,包含屏蔽词的内容会直接评论失败。英文逗号分隔。`,ADMIN_CONFIG_ITEM_GRAVATAR_CDN:`自定义头像 CDN 地址。如:cn.gravatar.com, weavatar.com, cravatar.cn, sdn.geekzu.org, gravatar.loli.net,默认:weavatar.com`,ADMIN_CONFIG_ITEM_HIDE_ADMIN_CRYPT:`隐藏管理面板入口。可设置一个“暗号”,只有在“昵称”一栏输入相同的“暗号”时,管理面板入口才会显示,留空则不隐藏管理入口`,ADMIN_CONFIG_ITEM_QQ_API_KEY:`QQ昵称API密钥,用于获取QQ昵称。前往 https://api.tqq.me/dashboard/api-keys 获取`,ADMIN_CONFIG_ITEM_HIGHLIGHT:`启用代码高亮功能。如果您的主题和代码高亮有冲突,请设为 false。默认:true`,ADMIN_CONFIG_ITEM_HIGHLIGHT_THEME:`代码高亮主题,可选:"default"、"coy"、"dark"、"funky"、"okaidia"、"solarizedlight"、"tomorrow"、"twilight",访问 https://prismjs.com 可预览主题效果。如果您的主题和代码高亮有冲突,请设为 none。默认:none`,ADMIN_CONFIG_ITEM_HIGHLIGHT_PLUGIN:`代码高亮插件,可选:"showLanguage"、"copyButton",分别表示:展示代码语言、展示代码拷贝按钮。可以同时设置多个选项,如果想要不添加任何代码高亮插件,请设为 none。默认:none。`,ADMIN_CONFIG_ITEM_IMAGE_CDN:`插入图片所使用的图床,目前支持:"qcloud"、"7bu (https://7bu.top)"、"see (https://s.ee)"、"lskypro"、"piclist"、"easyimage"、"chevereto"、"S3 / R2 / MinIO"`,ADMIN_CONFIG_ITEM_IMAGE_CDN_URL:`图床的 URL,仅当 IMAGE_CDN 为 "lskypro" / "piclist" / "easyimage" / "s3" 时需要填写`,ADMIN_CONFIG_ITEM_IMAGE_CDN_TOKEN:`图床 token。qcloud 图床无需设置`,ADMIN_CONFIG_ITEM_NSFW_API_URL:`NSFW 图片检测 API 地址。免费服务:nsfw.qixz.cn,项目:github.com/HG-ha/nsfwpy`,ADMIN_CONFIG_ITEM_NSFW_THRESHOLD:`NSFW 检测阈值(0-1),当检测分数高于此值时拒绝上传。默认:0.5`,ADMIN_CONFIG_ITEM_S3_REGION:`S3 存储区域,例如 us-east-1。使用兼容 S3 的服务(如 Cloudflare R2、MinIO)时可填任意值`,ADMIN_CONFIG_ITEM_S3_BUCKET:`S3 存储桶名称`,ADMIN_CONFIG_ITEM_S3_ACCESS_KEY_ID:`S3 Access Key ID`,ADMIN_CONFIG_ITEM_S3_SECRET_ACCESS_KEY:`S3 Secret Access Key`,ADMIN_CONFIG_ITEM_S3_ENDPOINT:`S3 自定义 Endpoint,使用 Cloudflare R2、MinIO 等兼容 S3 的服务时填写`,ADMIN_CONFIG_ITEM_S3_FORCE_PATH_STYLE:`设置 S3_ENDPOINT 时,是否将 S3_BUCKET 拼入上传地址路径。默认为 true,适用于 Cloudflare R2、MinIO 等 path-style S3 兼容端点;使用已绑定存储桶的自定义域名时设为 false,例如腾讯云 COS 自定义域名`,ADMIN_CONFIG_ITEM_S3_CDN_URL:`S3 图片访问域名(CDN 域名),留空则使用默认 S3/Endpoint URL`,ADMIN_CONFIG_ITEM_S3_PATH_PREFIX:`S3 图片存储路径前缀,例如 images/twikoo,留空则存储在根目录`,ADMIN_CONFIG_ITEM_LIGHTBOX:`使用简易图片点击放大效果。默认:false`,ADMIN_CONFIG_ITEM_LIMIT_PER_MINUTE:`单个 IP 发言频率限制(条/10分钟),0 为无限制,默认:10`,ADMIN_CONFIG_ITEM_LIMIT_PER_MINUTE_ALL:`全站发言频率限制(条/10分钟),0 为无限制,默认:10`,ADMIN_CONFIG_ITEM_LIMIT_LENGTH:`评论长度限制,0 为无限制,默认:500`,ADMIN_CONFIG_ITEM_MAIL_SUBJECT:`自定义通知邮件主题,留空则使用默认主题。`,ADMIN_CONFIG_ITEM_MAIL_SUBJECT_ADMIN:`自定义博主通知邮件主题,留空则使用默认主题。`,ADMIN_CONFIG_ITEM_MAIL_TEMPLATE:"自定义通知邮件模板,留空则使用默认模板。可包含的字段:${SITE_URL}, ${SITE_NAME}, ${PARENT_NICK}, ${PARENT_COMMENT}, ${NICK}, ${COMMENT}, ${POST_URL}, ${IMG}, ${PARENT_IMG}",ADMIN_CONFIG_ITEM_MAIL_TEMPLATE_ADMIN:"自定义博主通知邮件模板,留空则使用默认模板。可包含的字段:${SITE_URL}, ${SITE_NAME}, ${NICK}, ${COMMENT}, ${POST_URL}, ${IP}, ${MAIL}, ${IMG}",ADMIN_CONFIG_ITEM_MASTER_TAG:`博主标识自定义文字,默认为 “博主”。`,ADMIN_CONFIG_ITEM_NOTIFY_SPAM:`垃圾评论是否发送通知,默认:true`,ADMIN_CONFIG_ITEM_HIDE_SPAM:`前台评论区对所有人隐藏垃圾评论,包括管理员和评论作者。评论管理后台仍可审核和恢复。设为 true 开启,默认:false。`,ADMIN_CONFIG_ITEM_CAPTCHA_PROVIDER:`人机验证码提供商`,ADMIN_CONFIG_ITEM_TURNSTILE_SITE_KEY:`Turnstile 验证码的站点密钥。申请地址: https://dash.cloudflare.com/?to=/:account/turnstile`,ADMIN_CONFIG_ITEM_TURNSTILE_SECRET_KEY:`Turnstile 验证码的密钥`,ADMIN_CONFIG_ITEM_GEETEST_CAPTCHA_ID:`极验验证码的 Captcha ID。申请地址: https://console.geetest.com/sensbot/management`,ADMIN_CONFIG_ITEM_GEETEST_CAPTCHA_KEY:`极验验证码的 Captcha Key`,ADMIN_CONFIG_ITEM_CAP_API_ENDPOINT:`Cap 验证码 API 端点。留空则使用内嵌 Cap(无需额外部署);外部 Standalone 格式:https://<实例地址>/<site_key>/`,ADMIN_CONFIG_ITEM_CAP_SECRET_KEY:`Cap Secret Key(仅外部 Standalone 需要;内嵌模式可留空)`,ADMIN_CONFIG_ITEM_QCLOUD_SECRET_ID:`腾讯云 secret id,用于垃圾评论检测。同时设置腾讯云和 Akismet 时,只有腾讯云会生效。注册:https://twikoo.js.org/cms.html`,ADMIN_CONFIG_ITEM_QCLOUD_CMS_BIZTYPE:`腾讯云内容安全 Biztype 名称,用于垃圾评论策略。可以自定义垃圾拦截规则`,ADMIN_CONFIG_ITEM_QCLOUD_SECRET_KEY:`腾讯云 secret key`,ADMIN_CONFIG_ITEM_LLM_API_KEY:`LLM API Key,用于 AI 垃圾评论检测。仅在未配置腾讯云和 Akismet 时生效。`,ADMIN_CONFIG_ITEM_LLM_API_ENDPOINT:`LLM API 接口地址,默认:https://api.deepseek.com/v1`,ADMIN_CONFIG_ITEM_LLM_MODEL:`LLM 模型名称,默认:deepseek-v4-pro`,ADMIN_CONFIG_ITEM_LLM_SPAM_PROMPT:`LLM 垃圾检测提示词(可选,留空则使用默认提示词)`,ADMIN_CONFIG_ITEM_LLM_MAX_RETRIES:`LLM 检测最大重试次数(默认 3 次)`,ADMIN_CONFIG_ITEM_PUSHOO_CHANNEL:`即时消息推送平台名称,支持:"qmsg"、"serverchan"、"pushplus"、"pushplushxtrip"、"dingtalk"、"wecom"、"bark"、"gocqhttp"、"atri"、"pushdeer"、"igot"、"telegram"、"feishu" 等`,ADMIN_CONFIG_ITEM_PUSHOO_TOKEN:`即时消息推送 token。请参考 https://pushoo.js.org 里的详细说明配置`,ADMIN_CONFIG_ITEM_DISPLAYED_FIELDS:`界面上展示的输入框,默认:nick,mail,link`,ADMIN_CONFIG_ITEM_REQUIRED_FIELDS:`评论必填信息,设为 nick,mail,link 代表全必填,设为 none 代表全选填,默认:nick,mail`,ADMIN_CONFIG_ITEM_SC_MAIL_NOTIFY:`是否同时通过 IM 和邮件 2 种方式通知博主,默认只通过 IM 通知博主,默认:false`,ADMIN_CONFIG_ITEM_SENDER_EMAIL:`邮件通知邮箱地址。对于大多数邮箱服务商,SENDER_EMAIL 必须和 SMTP_USER 保持一致,否则无法发送邮件。`,ADMIN_CONFIG_ITEM_SENDER_NAME:`邮件通知标题。`,ADMIN_CONFIG_ITEM_SHOW_EMOTION:`启用插入表情功能,默认为:true`,ADMIN_CONFIG_ITEM_SHOW_IMAGE:`启用插入图片功能,默认为:true`,ADMIN_CONFIG_ITEM_SHOW_ORDER:`评论排序下拉框,默认为:true`,ADMIN_CONFIG_ITEM_SHOW_DISLIKE:`评论点踩按钮,默认为:true`,ADMIN_CONFIG_ITEM_SHOW_UA:`是否显示用户系统和浏览器,默认为:true`,ADMIN_CONFIG_ITEM_SHOW_REGION:`是否显示用户 IP 属地到省,可能不准确,不支持 IPv6,默认为:false`,ADMIN_CONFIG_ITEM_SITE_NAME:`网站名称`,ADMIN_CONFIG_ITEM_SITE_URL:`网站地址`,ADMIN_CONFIG_ITEM_SMTP_HOST:`自定义 SMTP 服务器地址。如您已配置 SMTP_SERVICE,此项请留空。`,ADMIN_CONFIG_ITEM_SMTP_PASS:`邮件通知邮箱密码,QQ、163邮箱请填写授权码。`,ADMIN_CONFIG_ITEM_SMTP_PORT:`自定义 SMTP 端口。如您已配置 SMTP_SERVICE,此项请留空。`,ADMIN_CONFIG_ITEM_SMTP_SECURE:`自定义 SMTP 是否使用TLS,请填写 true 或 false。如您已配置 SMTP_SERVICE,此项请留空。`,ADMIN_CONFIG_ITEM_SMTP_SERVICE:`邮件通知邮箱服务商。支持:"126"、"163"、"1und1"、"AOL"、"DebugMail"、"DynectEmail"、"FastMail"、"GandiMail"、"Gmail"、"Godaddy"、"GodaddyAsia"、"GodaddyEurope"、"Hotmail"、"Mail.ru"、"Maildev"、"Mailgun"、"Mailjet"、"Mailosaur"、"Mandrill"、"Naver"、"OpenMailBox"、"Outlook365"、"Postmark"、"QQ"、"QQex"、"SES"、"SES-EU-WEST-1"、"SES-US-EAST-1"、"SES-US-WEST-2"、"SendCloud"、"SendGrid"、"SendPulse"、"SendinBlue"、"Sparkpost"、"Yahoo"、"Yandex"、"Zoho"、"hot.ee"、"iCloud"、"mail.ee"、"qiye.aliyun"`,ADMIN_CONFIG_ITEM_SMTP_USER:`邮件通知邮箱用户名。`,ADMIN_CONFIG_RESET:`重置`,ADMIN_CONFIG_SAVE:`保存`,ADMIN_CREDENTIALS:`私钥文件`,ADMIN_CREDENTIALS_FAQ:`如何获得私钥`,ADMIN_CREDENTIALS_PLACEHOLDER:`请粘贴私钥文件内容`,ADMIN_FORGOT:`忘记密码`,ADMIN_EXPORT:`导出`,ADMIN_EXPORT_WARN:`将全部数据导出为 JSON 文件。如果遇到评论较多、导出失败或缺失数据,请连接数据库手动导出`,ADMIN_EXPORT_COMMENT:`导出评论`,ADMIN_EXPORT_COUNTER:`导出访问量`,ADMIN_IMPORT:`导入`,ADMIN_IMPORT_FILE_REQUIRED:`未选择文件`,ADMIN_IMPORT_IMPORTED:`完成导入 `,ADMIN_IMPORT_IMPORTING:`开始导入 `,ADMIN_IMPORT_LOG:`日志`,ADMIN_IMPORT_SELECT:`请选择`,ADMIN_IMPORT_SELECT_FILE:`选择文件`,ADMIN_IMPORT_SELECT_SOURCE:`选择源系统`,ADMIN_IMPORT_SOURCE_REQUIRED:`未选择源系统`,ADMIN_IMPORT_START:`开始导入`,ADMIN_IMPORT_STARTING:`开始导入`,ADMIN_IMPORT_TIP_ARTALK:`请上传 JSON 格式的 Artalk 导出文件,文件名通常为 comments.data.json`,ADMIN_IMPORT_TIP_DISQUS:`请上传 XML 格式的 Disqus 导出文件,文件名通常为 [网站名称]-[导出时间]-all.xml`,ADMIN_IMPORT_TIP_VALINE:`请上传 JSON 格式的 Valine 导出文件,文件名通常为 Comment.json`,ADMIN_IMPORT_UPLOADED:`上传完成 `,ADMIN_IMPORT_UPLOADING:`已上传 `,ADMIN_IMPORT_WARN:`支持从其他评论系统的备份文件导入评论。
|
|
169
|
+
不要在匿名登录失败后自动回退到密码登录,这两种方式的使用场景不同。`)):(console.warn(`[CloudBase Auth] signInAnonymously 失败 [${a.category}]: ${a.message}`),a.loginMethodHint&&console.warn(a.loginMethodHint)),[2,{data:{user:null,session:null},error:a}];case 5:return[2]}})})},n.prototype.signUp=function(e){return H(this,void 0,Promise,function(){var t,n,r=this;return U(this,function(i){switch(i.label){case 0:return e.phone_number||e.verification_code||e.verification_token||e.provider_token?(e.phone_number&&=this.formatPhone(e.phone_number),[4,this.oauthInstance.authApi.signUp(e)]):[3,2];case 1:return i.sent(),[2,this.createLoginState()];case 2:return i.trys.push([2,4,,5]),this.validateAtLeastOne(e,[[`email`],[`phone`]],`signUp`),[4,this.getVerification(e.email?{email:e.email,usage:c.EMAIL}:{phone_number:this.formatPhone(e.phone)})];case 3:return t=i.sent(),[2,{data:{verifyOtp:function(n){var i=n.token,a=n.messageId,o=a===void 0?t.verification_id:a;return H(r,void 0,Promise,function(){var n,r,a,s,c;return U(this,function(l){switch(l.label){case 0:return l.trys.push([0,8,,9]),[4,this.verify({verification_id:o||t.verification_id,verification_code:String(i)})];case 1:return n=l.sent(),t.is_user?[4,this.signIn({username:e.email||this.formatPhone(e.phone),verification_token:n.verification_token})]:[3,3];case 2:return l.sent(),[3,6];case 3:return delete(r=JSON.parse(JSON.stringify(e))).email,delete r.phone,[4,this.oauthInstance.authApi.signUp(B(B(B({},r),e.email?{email:e.email}:{phone_number:this.formatPhone(e.phone)}),{verification_token:n.verification_token,verification_code:i}))];case 4:return l.sent(),[4,this.createLoginState()];case 5:l.sent(),l.label=6;case 6:return[4,this.getSession()];case 7:return a=l.sent().data,[2,{data:{user:(s=(a===void 0?{}:a).session).user,session:s},error:null}];case 8:return c=l.sent(),[2,{data:{user:null,session:null},error:new I(c,{method:`signUp`})}];case 9:return[2]}})})}},error:null}];case 4:return n=i.sent(),[2,{data:{user:null,session:null},error:new I(n,{method:`signUp`})}];case 5:return[2]}})})},n.prototype.signOut=function(e){return H(this,void 0,Promise,function(){var t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),t=this.cache.keys.userInfoKey,[4,this.oauthInstance.authApi.signOut(e)];case 1:return n=i.sent(),[4,this.cache.removeStoreAsync(t)];case 2:return i.sent(),this.setAccessKey(),[2,B(B({},n),{data:{},error:null})];case 3:return r=i.sent(),[2,{data:{},error:new I(r,{method:`signOut`})}];case 4:return[2]}})})},n.prototype.onAuthStateChange=function(e){var t=this;this.hasListenerSetUp||=(this.setupListeners(),!0);var n=Math.random().toString(36);return this.listeners.has(n)||this.listeners.set(n,new Set),this.listeners.get(n).add(e),{data:{subscription:{id:n,callback:e,unsubscribe:function(){var r=t.listeners.get(n);r&&(r.delete(e),r.size===0&&t.listeners.delete(n))}}}}},n.prototype.signInWithPassword=function(e){return H(this,void 0,Promise,function(){var t,n,r,i,a,o,s,c;return U(this,function(l){switch(l.label){case 0:return l.trys.push([0,3,,4]),this.validateAtLeastOne(e,[[`username`],[`email`],[`phone`]],`signInWithPassword`),this.validateParams(e,{password:{required:!0,message:`Password is required`}},`signInWithPassword`),t=`username`in e?e.username:void 0,n=`email`in e?e.email:void 0,r=`phone`in e?e.phone:void 0,i=e.options?.is_encrypt??e.is_encrypt,[4,this.signIn(B({username:t||n||this.formatPhone(r),password:e.password},i?{isEncrypt:!0,version:`v2`}:{}))];case 1:return l.sent(),[4,this.getSession()];case 2:return a=l.sent().data,[2,{data:{user:(o=(a===void 0?{}:a).session).user,session:o},error:null}];case 3:return s=l.sent(),(c=new I(s,{method:`signInWithPassword`})).category===F.PROVIDER_NOT_ENABLED?console.error(c.helpMessage):c.category===F.INVALID_CREDENTIALS||c.category===F.USER_NOT_FOUND?console.warn(c.helpMessage):console.warn(`[CloudBase Auth] signInWithPassword 失败 [${c.category}]: ${c.message}`),c.loginMethodHint&&console.info(c.loginMethodHint),[2,{data:{user:null,session:null},error:c}];case 4:return[2]}})})},n.prototype.signInWithIdToken=function(e){return H(this,void 0,Promise,function(){var t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),this.validateParams(e,{token:{required:!0,message:`Token is required`}},`signInWithIdToken`),[4,this.signInWithProvider({provider_id:e.provider,provider_id_token:e.token})];case 1:return i.sent(),[4,this.getSession()];case 2:return t=i.sent().data,[2,{data:{user:(n=(t===void 0?{}:t).session).user,session:n},error:null}];case 3:return r=i.sent(),[2,{data:{user:null,session:null},error:new I(r,{method:`signInWithIdToken`})}];case 4:return[2]}})})},n.prototype.signInWithOtp=function(e){return H(this,void 0,Promise,function(){var t,n,r,i,a,o=this;return U(this,function(s){switch(s.label){case 0:if(t=e.options,n=`email`in e?e.email:void 0,r=`phone`in e?e.phone:void 0,!t?.emailRedirectTo&&(t?.shouldCreateUser===void 0||t?.shouldCreateUser))return[2,this.signUp(n?{email:n}:{phone:r})];s.label=1;case 1:return s.trys.push([1,3,,4]),this.validateAtLeastOne(e,[[`email`],[`phone`]],`signInWithOtp`),[4,this.getVerification(B(B({email_redirect_to:t?.emailRedirectTo},n?{email:n,usage:c.EMAIL}:{phone_number:this.formatPhone(r)}),{target:t?.emailRedirectTo&&t?.shouldCreateUser?`ANY`:`USER`}))];case 2:return i=s.sent(),[2,{data:{user:null,session:null,verifyOtp:function(e){var t=e.token,a=e.messageId,s=a===void 0?i.verification_id:a;return H(o,void 0,Promise,function(){return U(this,function(e){return[2,this.verifyOtp(n?{email:n,token:String(t),messageId:s||``}:{phone:r,token:String(t),messageId:s||``})]})})}},error:null}];case 3:return a=s.sent(),[2,{data:{user:null,session:null},error:new I(a,{method:`signInWithOtp`})}];case 4:return[2]}})})},n.prototype.verifyOAuth=function(e){return H(this,void 0,Promise,function(){var t,n,r,i,a,o,s,c,l;return U(this,function(u){switch(u.label){case 0:t={},u.label=1;case 1:return u.trys.push([1,7,,8]),n=e?.code||ue(`code`),r=e?.state||ue(`state`),n?r?(i=function(e){try{return JSON.parse(sessionStorage.getItem(e))}catch(e){return console.error(`Failed to get browser session:`,e),null}}(r),t.type=i?.type,(a=e?.provider||i?.provider||ue(`provider`))?[4,this.grantProviderToken({provider_id:a,provider_redirect_uri:location.origin+location.pathname,provider_code:n})]:[2,{data:B(B({},t),{user:null,session:null,redirectUrl:null}),error:this.missingRequiredParam(`verifyOAuth`,`provider`)}]):[2,{data:{user:null,session:null,redirectUrl:null},error:this.missingRequiredParam(`verifyOAuth`,`state`)}]:[2,{data:{user:null,session:null,redirectUrl:null},error:this.missingRequiredParam(`verifyOAuth`,`code`)}];case 2:return o=u.sent().provider_token,s=void 0,i.type===x?[4,this.oauthInstance.authApi.toBindIdentity({provider_token:o,provider:a,fireEvent:!0})]:[3,4];case 3:return s=u.sent(),[3,6];case 4:return[4,this.signInWithIdToken({token:o})];case 5:(s=u.sent()).data=B(B({},t),s.data),u.label=6;case 6:return(c=new URLSearchParams(location==null?void 0:location.search)).delete(`code`),c.delete(`state`),s.data.redirectUrl=function(e,t){if(e!==void 0){var n=new URL(window.location.href);return n.search=e,n.hash=t||n.hash,window.history.replaceState({},``,n.href),n.href}}(i?.search===void 0?`?${c.toString()}`:i?.search,i?.hash||location.hash),function(e){try{return sessionStorage.removeItem(e),!0}catch(e){return console.error(`Failed to remove browser session:`,e),null}}(r),[2,s];case 7:return l=u.sent(),[2,{data:B(B({},t),{user:null,session:null,redirectUrl:null}),error:new I(l,{method:`verifyOAuth`})}];case 8:return[2]}})})},n.prototype.signInWithOAuth=function(e){var t,n;return H(this,void 0,Promise,function(){var r,i,a,o,s,c,l,u,d;return U(this,function(f){switch(f.label){case 0:return f.trys.push([0,2,,3]),this.validateParams(e,{provider:{required:!0,message:`Provider is required`}},`signInWithOAuth`),r=e.options?.redirectTo||location.href,i=new URL(r),a=i.origin+i.pathname,o=e.options?.state||`prd-${e.provider}-${Math.random().toString(36).slice(2)}`,[4,this.genProviderRedirectUri({provider_id:e.provider,provider_redirect_uri:a,state:o})];case 1:return s=f.sent().uri,c=decodeURIComponent(s),l=c,(t=e.options)!=null&&t.queryParams&&(u=new URL(c),Object.entries(e.options.queryParams).forEach(function(e){var t=e[0],n=e[1];u.searchParams.set(t,n)}),l=u.toString()),function(e,t){try{sessionStorage.setItem(e,JSON.stringify(t))}catch(e){console.error(`Failed to save to browser session:`,e)}}(o,{provider:e.provider,search:i.search,hash:i.hash,type:e.options?.type||y}),Et()&&!((n=e.options)!=null&&n.skipBrowserRedirect)&&window.location.assign(l),[2,{data:{url:l,provider:e.provider},error:null}];case 2:return d=f.sent(),[2,{data:{url:null,provider:null},error:new I(d,{method:`signInWithOAuth`})}];case 3:return[2]}})})},n.prototype.getClaims=function(){return H(this,void 0,Promise,function(){var e;return U(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.getAccessToken()];case 1:return[2,{data:function(e){if(typeof e!=`string`)throw Error(`Invalid token specified`);try{var t=e.split(`.`).map(function(e,t){return t===2?e:JSON.parse(function(e){var t=e.replace(/-/g,`+`).replace(/_/g,`/`);switch(t.length%4){case 0:break;case 2:t+=`==`;break;case 3:t+=`=`;break;default:throw Error(`Illegal base64url string!`)}try{return function(e){return decodeURIComponent(k(e).replace(/(.)/g,function(e){var t=e.charCodeAt(0).toString(16).toUpperCase();return t.length<2&&(t=`0${t}`),`%${t}`}))}(t)}catch{return k(t)}}(e))});return{claims:t[1],header:t[0],signature:t[2]}}catch(e){throw Error(`Invalid token specified: ${e}`?e.message:0)}}(t.sent().accessToken),error:null}];case 2:return e=t.sent(),[2,{data:{claims:null,header:null,signature:null},error:new I(e,{method:`getClaims`})}];case 3:return[2]}})})},n.prototype.resetPasswordForEmail=function(e,t){return H(this,void 0,Promise,function(){var n,r,i,a,o,s,l=this;return U(this,function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),this.validateParams({emailOrPhone:e},{emailOrPhone:{required:!0,message:`Email or phone is required`}},`resetPasswordForEmail`),n=(t||{}).redirectTo,r=e.includes(`@`),i=void 0,r?i={email:e,usage:c.RECOVERY}:(a=this.formatPhone(e),i={phone_number:a}),[4,this.getVerification(B(B({},i),{target:`USER`}))];case 1:return o=u.sent(),[2,{data:{updateUser:function(t){return H(l,void 0,Promise,function(){var i,a,s,c;return U(this,function(l){switch(l.label){case 0:this.validateParams(t,{nonce:{required:!0,message:`Nonce is required`},password:{required:!0,message:`Password is required`}},`resetPasswordForEmail`),l.label=1;case 1:return l.trys.push([1,5,,6]),[4,this.verify({verification_id:o.verification_id,verification_code:t.nonce})];case 2:return i=l.sent(),[4,this.oauthInstance.authApi.resetPassword({email:r?e:void 0,phone_number:r?void 0:e,new_password:t.password,verification_token:i.verification_token})];case 3:return l.sent(),(c=this.config.eventBus)==null||c.fire(v,{event:`PASSWORD_RECOVERY`}),[4,this.signInWithPassword({email:r?e:void 0,phone:r?void 0:e,password:t.password})];case 4:return a=l.sent(),n&&Et()&&window.location.assign(n),[2,a];case 5:return s=l.sent(),[2,{data:{user:null,session:null},error:new I(s,{method:`resetPasswordForEmail`})}];case 6:return[2]}})})}},error:null}];case 2:return s=u.sent(),[2,{data:{updateUser:null},error:new I(s,{method:`resetPasswordForEmail`})}];case 3:return[2]}})})},n.prototype.resetPasswordForOld=function(e){return H(this,void 0,Promise,function(){var t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,this.oauthInstance.authApi.updatePasswordByOld({old_password:e.old_password,new_password:e.new_password})];case 1:return i.sent(),[4,this.getSession()];case 2:return t=i.sent().data,[2,{data:{user:(n=(t===void 0?{}:t).session).user,session:n},error:null}];case 3:return r=i.sent(),[2,{data:{user:null,session:null},error:new I(r,{method:`resetPasswordForOld`})}];case 4:return[2]}})})},n.prototype.verifyOtp=function(e){return H(this,void 0,Promise,function(){var t,n,r,i,a,o,s;return U(this,function(c){switch(c.label){case 0:return c.trys.push([0,6,,7]),t=e.type,n=String(e.token),r=`email`in e?e.email:void 0,i=`phone`in e?e.phone:void 0,this.validateParams(e,{token:{required:!0,message:`Token is required`},messageId:{required:!0,message:`messageId is required`}},`verifyOtp`),[`phone_change`,`email_change`].includes(t)?[4,this.verify({verification_id:e.messageId,verification_code:n})]:[3,2];case 1:return c.sent(),[3,4];case 2:return[4,this.signInWithUsername({verificationInfo:{verification_id:e.messageId,is_user:!0},verificationCode:n,username:r||this.formatPhone(i)||``,loginType:r?`email`:`phone`})];case 3:c.sent(),c.label=4;case 4:return[4,this.getSession()];case 5:return a=c.sent().data,[2,{data:{user:(o=(a===void 0?{}:a).session).user,session:o},error:null}];case 6:return s=c.sent(),[2,{data:{user:null,session:null},error:new I(s,{method:`verifyOtp`})}];case 7:return[2]}})})},n.prototype.getSession=function(){return H(this,void 0,Promise,function(){var e,t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,this.oauthInstance.oauth2client.getCredentials()];case 1:return(e=i.sent())&&e.scope!==`accessKey`?[4,this.getUser(!1)]:[2,{data:{session:null,user:null},error:null}];case 2:return t=i.sent().data,n=(t===void 0?{}:t).user,[2,{data:{session:B(B({},e),{user:n}),user:n},error:null}];case 3:return r=i.sent(),[2,{data:{session:null,user:null},error:new I(r,{method:`getSession`})}];case 4:return[2]}})})},n.prototype.refreshSession=function(e){return H(this,void 0,Promise,function(){var t,n,r,i,a;return U(this,function(o){switch(o.label){case 0:return o.trys.push([0,4,,5]),[4,this.oauthInstance.oauth2client.localCredentials.getCredentials()];case 1:return(t=o.sent()).refresh_token=e||t.refresh_token,[4,this.oauthInstance.oauth2client.refreshToken(t)];case 2:return n=o.sent(),[4,this.getUser(!1)];case 3:return r=o.sent().data,[2,{data:{user:i=(r===void 0?{}:r).user,session:B(B({},n),{user:i})},error:null}];case 4:return a=o.sent(),[2,{data:{user:null,session:null},error:new I(a,{method:`refreshSession`})}];case 5:return[2]}})})},n.prototype.getUser=function(e){return e===void 0&&(e=!0),H(this,void 0,Promise,function(){var t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,this.oauthInstance.oauth2client.getCredentials()];case 1:return(t=i.sent())&&t.scope!==`accessKey`?(n=this.convertToUser,[4,this.getCurrentUser(e)]):[2,{data:{user:null},error:null}];case 2:return[2,{data:{user:n.apply(this,[i.sent()])},error:null}];case 3:return r=i.sent(),[2,{data:{user:null},error:new I(r,{method:`getUser`})}];case 4:return[2]}})})},n.prototype.refreshUser=function(){return H(this,void 0,Promise,function(){var e,t,n;return U(this,function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),[4,this.currentUser.refresh()];case 1:return r.sent(),[4,this.getSession()];case 2:return e=r.sent().data,[2,{data:{user:(t=(e===void 0?{}:e).session).user,session:t},error:null}];case 3:return n=r.sent(),[2,{data:{user:null,session:null},error:new I(n,{method:`refreshUser`})}];case 4:return[2]}})})},n.prototype.updateUser=function(e){var t;return H(this,void 0,Promise,function(){var n,r,i,a,o,s,l,u,d,f,p,m,g,_=this;return U(this,function(y){switch(y.label){case 0:if(y.trys.push([0,8,,9]),At(e,`updateUser`),n=[`password`,`new_password`].find(function(t){var n=e[t];return n!=null&&n!==``}))throw new I({message:`updateUser 不支持更新密码,检测到传入了 "${n}" 参数。如需修改密码请使用 resetPasswordForOld(旧密码修改)、resetPasswordForEmail(验证码重置)或 reauthenticate(重新认证后改密)`});if(!Object.keys(e).some(function(t){return e[t]!==void 0&&e[t]!==null&&e[t]!==``}))throw this.missingRequiredParam(`updateUser`,`(at least one field)`);return r=e.email,i=e.phone,a=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,[`email`,`phone`]),s=i!==void 0,l={},(o=r!==void 0)||s?(u=void 0,o?(u={email:e.email,usage:c.REAUTHENTICATION},d=`email_change`):(f=this.formatPhone(e.phone),u={phone_number:f},d=`phone_change`),[4,this.getVerification(B({},u))]):[3,4];case 1:return p=y.sent(),Object.keys(a).length>0?[4,this.updateUserBasicInfo(a)]:[3,3];case 2:y.sent(),y.label=3;case 3:return l={messageId:p.verification_id,verifyOtp:function(t){return H(_,void 0,Promise,function(){var n,r,i,a;return U(this,function(s){switch(s.label){case 0:return s.trys.push([0,11,,12]),t.email&&e.email===t.email?[4,this.verifyOtp({type:`email_change`,email:e.email,token:t.token,messageId:p.verification_id||``})]:[3,3];case 1:return(n=s.sent()).error?[2,n]:[4,this.updateUserBasicInfo({email:e.email})];case 2:return s.sent(),[3,9];case 3:return t.phone&&e.phone===t.phone?[4,this.verifyOtp({type:`phone_change`,phone:e.phone,token:t.token,messageId:p.verification_id||``})]:[3,6];case 4:return(n=s.sent()).error?[2,n]:[4,this.updateUserBasicInfo({phone:this.formatPhone(e.phone)})];case 5:return s.sent(),[3,9];case 6:return[4,this.verifyOtp(o?{type:d,email:e.email,token:t.token,messageId:p.verification_id||``}:{type:d,phone:e.phone,token:t.token,messageId:p.verification_id||``})];case 7:return(n=s.sent()).error?[2,n]:[4,this.updateUserBasicInfo(e)];case 8:s.sent(),s.label=9;case 9:return[4,this.getUser(!1)];case 10:return r=s.sent().data.user,(a=this.config.eventBus)==null||a.fire(v,{event:h}),[2,{data:{user:r},error:null}];case 11:return i=s.sent(),[2,{data:{user:null},error:new I(i,{method:`updateUser`})}];case 12:return[2]}})})}},[3,6];case 4:return[4,this.updateUserBasicInfo(e)];case 5:y.sent(),y.label=6;case 6:return[4,this.getUser(!1)];case 7:return m=y.sent().data.user,Object.keys(a).length>0&&((t=this.config.eventBus)==null||t.fire(v,{event:h})),[2,{data:B({user:m},l),error:null}];case 8:return g=y.sent(),[2,{data:{user:null},error:new I(g,{method:`updateUser`})}];case 9:return[2]}})})},n.prototype.getUserIdentities=function(){return H(this,void 0,Promise,function(){var e,t;return U(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.oauthInstance.authApi.getProviders()];case 1:return e=n.sent(),[2,{data:{identities:(e?.data)?.filter(function(e){return!!e.bind})},error:null}];case 2:return t=n.sent(),[2,{data:{identities:null},error:new I(t,{method:`getUserIdentities`})}];case 3:return[2]}})})},n.prototype.linkIdentity=function(e){return H(this,void 0,Promise,function(){var t;return U(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),this.validateParams(e,{provider:{required:!0,message:`Provider is required`}},`linkIdentity`),[4,this.signInWithOAuth({provider:e.provider,options:{type:x}})];case 1:return n.sent(),[2,{data:{provider:e.provider},error:null}];case 2:return t=n.sent(),[2,{data:{provider:null},error:new I(t,{method:`linkIdentity`})}];case 3:return[2]}})})},n.prototype.unlinkIdentity=function(e){return H(this,void 0,Promise,function(){var t;return U(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),this.validateParams(e,{provider:{required:!0,message:`Provider is required`}},`unlinkIdentity`),[4,this.oauthInstance.authApi.unbindProvider({provider_id:e.provider})];case 1:return n.sent(),[2,{data:{},error:null}];case 2:return t=n.sent(),[2,{data:{},error:new I(t,{method:`unlinkIdentity`})}];case 3:return[2]}})})},n.prototype.reauthenticate=function(){return H(this,void 0,Promise,function(){var e,t,n,r,i=this;return U(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this.getUser(!1)];case 1:return e=a.sent().data.user,this.validateAtLeastOne(e,[[`email`,`phone`]],`reauthenticate`),t=e.email?{email:e.email,usage:c.REAUTHENTICATION}:{phone_number:this.formatPhone(e.phone)},[4,this.getVerification(t)];case 2:return n=a.sent(),[2,{data:{updateUser:function(e){return H(i,void 0,Promise,function(){var r,i,a,o,s;return U(this,function(c){switch(c.label){case 0:this.validateParams(e,{nonce:{required:!0,message:`Nonce is required`}},`reauthenticate`),c.label=1;case 1:return c.trys.push([1,9,,10]),e.password?[4,this.verify({verification_id:n.verification_id,verification_code:e.nonce})]:[3,5];case 2:return r=c.sent(),[4,this.oauthInstance.authApi.sudo({verification_token:r.verification_token})];case 3:return i=c.sent(),[4,this.oauthInstance.authApi.setPassword({new_password:e.password,sudo_token:i.sudo_token})];case 4:return c.sent(),[3,7];case 5:return[4,this.signInWithUsername(B(B({verificationInfo:n,verificationCode:e.nonce},t),{loginType:t.email?`email`:`phone`}))];case 6:c.sent(),c.label=7;case 7:return[4,this.getSession()];case 8:return a=c.sent().data,[2,{data:{user:(o=(a===void 0?{}:a).session).user,session:o},error:null}];case 9:return s=c.sent(),[2,{data:{user:null,session:null},error:new I(s,{method:`reauthenticate`})}];case 10:return[2]}})})}},error:null}];case 3:return r=a.sent(),[2,{data:{updateUser:null},error:new I(r,{method:`reauthenticate`})}];case 4:return[2]}})})},n.prototype.resend=function(e){return H(this,void 0,Promise,function(){var t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),this.validateAtLeastOne(e,[[`email`],[`phone`]],`resend`),t=e.type===`signup`?`ANY`:`USER`,n={target:t},`email`in e&&(n.email=e.email,n.usage=c.EMAIL),`phone`in e&&(n.phone_number=this.formatPhone(e.phone)),[4,this.oauthInstance.authApi.getVerification(n)];case 1:return[2,{data:{messageId:i.sent().verification_id},error:null}];case 2:return r=i.sent(),[2,{data:{messageId:null},error:new I(r,{method:`resend`})}];case 3:return[2]}})})},n.prototype.setSession=function(e){return H(this,void 0,Promise,function(){var t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),this.validateParams(e,{access_token:{required:!0,message:`Access token is required`},refresh_token:{required:!0,message:`Refresh token is required`}},`setSession`),[4,this.oauthInstance.oauth2client.refreshToken(e,{throwError:!0})];case 1:return i.sent(),[4,this.getSession()];case 2:return t=i.sent().data,[2,{data:{user:(n=(t===void 0?{}:t).session).user,session:n},error:null}];case 3:return r=i.sent(),[2,{data:{user:null,session:null},error:new I(r,{method:`setSession`})}];case 4:return[2]}})})},n.prototype.exchangeCodeForSession=function(){return H(this,void 0,void 0,function(){return U(this,function(e){return[2]})})},n.prototype.deleteUser=function(e){return H(this,void 0,Promise,function(){var t,n;return U(this,function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),this.validateParams(e,{password:{required:!0,message:`Password is required`}},`deleteUser`),[4,this.oauthInstance.authApi.sudo(e)];case 1:return t=r.sent().sudo_token,[4,this.oauthInstance.authApi.deleteMe({sudo_token:t})];case 2:return r.sent(),[2,{data:{},error:null}];case 3:return n=r.sent(),[2,{data:{},error:new I(n,{method:`deleteUser`})}];case 4:return[2]}})})},n.prototype.toDefaultLoginPage=function(e){return e===void 0&&(e={}),H(this,void 0,Promise,function(){var t,n,r,i,a;return U(this,function(o){try{return t=e.config_version||`env`,n=Object.keys(e.query||{}).map(function(t){return`${t}=${e.query[t]}`}).join(`&`),ct.default.isMatch()?wx.navigateTo({url:`/packages/\$wd_system/pages/login/index${n?`?${n}`:``}`}):(r=e.redirect_uri||window.location.href,i=new URL(r),a=`${i.origin}/__auth/?app_id=${e.app_id||``}&env_id=${this.config.env}&client_id=${this.config.clientId||this.config.env}&config_version=${t}&redirect_uri=${encodeURIComponent(r)}${n?`&${n}`:``}`,window.location.href=a),[2,{data:{},error:null}]}catch(e){return[2,{data:{},error:new I(e,{method:`toDefaultLoginPage`})}]}})})},n.prototype.signInWithCustomTicket=function(e){return H(this,void 0,Promise,function(){var t,n,r,i;return U(this,function(a){switch(a.label){case 0:e&&this.setCustomSignFunc(e),a.label=1;case 1:return a.trys.push([1,5,,6]),[4,this.oauthInstance.authApi.signInWithCustomTicket()];case 2:return a.sent(),[4,this.createLoginState()];case 3:return t=a.sent(),[4,this.getSession()];case 4:return n=a.sent().data,r=(n===void 0?{}:n).session,[2,B(B({},t),{data:{user:r.user,session:r},error:null})];case 5:return i=a.sent(),[2,{data:{user:null,session:null},error:new I(i,{method:`signInWithCustomTicket`})}];case 6:return[2]}})})},n.prototype.signInWithOpenId=function(e){var t=(e===void 0?{}:e).useWxCloud,n=t===void 0||t;return H(this,void 0,Promise,function(){var e,t,r,i,a,o,s=this;return U(this,function(c){switch(c.label){case 0:if(!ct.default.isMatch())throw Error(`wx api undefined`);e=wx.getAccountInfoSync().miniProgram,t=function(t){return H(s,void 0,void 0,function(){var r,i;return U(this,function(a){switch(a.label){case 0:r=void 0,i=void 0,a.label=1;case 1:return a.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_id:e?.appId,provider_code:t,provider_params:{provider_code_type:`open_id`,appid:e?.appId}},n)];case 2:if((r=a.sent())?.error_code||!r.provider_token)throw r;return[4,this.oauthInstance.authApi.signInWithProvider({provider_token:r.provider_token},n)];case 3:if((i=a.sent())?.error_code)throw i;return[3,5];case 4:throw a.sent();case 5:return[4,this.oauthInstance.oauth2client.setCredentials(i)];case 6:return a.sent(),[2]}})})},c.label=1;case 1:return c.trys.push([1,5,,6]),[4,new Promise(function(e,n){wx.login({success:function(r){return H(s,void 0,void 0,function(){var i;return U(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,t(r.code)];case 1:return a.sent(),e(!0),[3,3];case 2:return i=a.sent(),n(i),[3,3];case 3:return[2]}})})},fail:function(e){var t=Error(e?.errMsg);t.code=e?.errno,n(t)}})})];case 2:return c.sent(),[4,this.createLoginState()];case 3:return r=c.sent(),[4,this.getSession()];case 4:return i=c.sent().data,a=(i===void 0?{}:i).session,[2,B(B({},r),{data:{user:a.user,session:a},error:null})];case 5:return o=c.sent(),[2,{data:{user:null,session:null},error:new I(o,{method:`signInWithOpenId`})}];case 6:return[2]}})})},n.prototype.signInWithPhoneAuth=function(e){var t=e.phoneCode,n=t===void 0?``:t,r=e.useWxCloud,i=r!==void 0&&r;return H(this,void 0,Promise,function(){var e,t,r,a,o,s,c,l,u;return U(this,function(d){switch(d.label){case 0:return ct.default.isMatch()?(e=wx.getAccountInfoSync().miniProgram,t={provider_params:{provider_code_type:`phone`,code:n,appid:e.appId},provider_id:e.appId},[4,wx.login()]):[2,{data:{user:null,session:null},error:new I({message:`wx api undefined`})}];case 1:r=d.sent().code,t.provider_code=r,d.label=2;case 2:return d.trys.push([2,5,,6]),[4,this.oauthInstance.authApi.grantProviderToken(t,i)];case 3:if((a=d.sent()).error_code)throw a;return[4,this.oauthInstance.authApi.signInWithProvider({provider_token:a.provider_token},i)];case 4:if((o=d.sent())?.error_code)throw o;return[3,6];case 5:return s=d.sent(),[2,{data:{user:null,session:null},error:new I(s,{method:`signInWithPhoneAuth`})}];case 6:return[4,this.createLoginState()];case 7:return c=d.sent(),[4,this.getSession()];case 8:return l=d.sent().data,u=(l===void 0?{}:l).session,[2,B(B({},c),{data:{user:u.user,session:u},error:null})]}})})},n.prototype.bindPhoneNumber=function(e){return H(this,void 0,void 0,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.editContact(e)]})})},n.prototype.unbindProvider=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.unbindProvider(e)]})})},n.prototype.bindEmail=function(e){return this.oauthInstance.authApi.editContact(e)},n.prototype.verify=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.verify(e)]})})},n.prototype.getVerification=function(e,t){return H(this,void 0,Promise,function(){return U(this,function(n){return e.phone_number&&=this.formatPhone(e.phone_number),[2,this.oauthInstance.authApi.getVerification(e,t)]})})},Object.defineProperty(n.prototype,"currentUser",{get:function(){if(this.cache.mode!==`async`){var e=this.hasLoginState();return e&&e.user||null}(0,Ie.printWarn)(z.ERRORS.INVALID_OPERATION,`current platform's storage is asynchronous, please use getCurrentUser instead`)},enumerable:!1,configurable:!0}),n.prototype.getCurrentUser=function(e){return e===void 0&&(e=!0),H(this,void 0,Promise,function(){var t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,4,,5]),e?[4,this.getLoginState()]:[3,3];case 1:return(t=i.sent())?[4,t.user.refresh()]:[3,3];case 2:i.sent(),i.label=3;case 3:return[3,5];case 4:return i.sent(),[3,5];case 5:return[4,this.getLoginState()];case 6:return(n=i.sent())?(r=n.user.getLocalUserInfo(),[4,n.user.checkLocalInfoAsync()]):[3,8];case 7:return i.sent(),[2,B(B({},n.user),r)];case 8:return[2,null]}})})},n.prototype.signInAnonymouslyInWx=function(e){var t=(e===void 0?{}:e).useWxCloud;return H(this,void 0,Promise,function(){var e,n,r=this;return U(this,function(i){switch(i.label){case 0:if(!ct.default.isMatch())throw Error(`wx api undefined`);return e=wx.getAccountInfoSync().miniProgram,n=function(n){return H(r,void 0,void 0,function(){var r,i;return U(this,function(a){switch(a.label){case 0:r=void 0,i=void 0,a.label=1;case 1:return a.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_id:e?.appId,provider_code:n,provider_params:{provider_code_type:`open_id`,appid:e?.appId}},t)];case 2:if((r=a.sent())?.error_code||!r.provider_token)throw r;return[4,this.oauthInstance.authApi.signInAnonymously({provider_token:r.provider_token},t)];case 3:if((i=a.sent())?.error_code)throw i;return[3,5];case 4:throw a.sent();case 5:return[2]}})})},[4,new Promise(function(e,t){wx.login({success:function(i){return H(r,void 0,void 0,function(){var r;return U(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,n(i.code)];case 1:return a.sent(),e(!0),[3,3];case 2:return r=a.sent(),t(r),[3,3];case 3:return[2]}})})},fail:function(e){var n=Error(e?.errMsg);n.code=e?.errno,t(n)}})})];case 1:return i.sent(),[2,this.createLoginState(void 0,{asyncRefreshUser:!0})]}})})},n.prototype.bindOpenId=function(){return H(this,void 0,Promise,function(){var e,t,n=this;return U(this,function(r){switch(r.label){case 0:if(!ct.default.isMatch())throw Error(`wx api undefined`);return e=wx.getAccountInfoSync().miniProgram,t=function(t){return H(n,void 0,void 0,function(){var n;return U(this,function(r){switch(r.label){case 0:n=void 0,r.label=1;case 1:return r.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_id:e?.appId,provider_code:t,provider_params:{provider_code_type:`open_id`,appid:e?.appId}})];case 2:if((n=r.sent())?.error_code||!n.provider_token)throw n;return[4,this.oauthInstance.authApi.bindWithProvider({provider_token:n.provider_token})];case 3:return r.sent(),[3,5];case 4:throw r.sent();case 5:return[2]}})})},[4,new Promise(function(e,r){wx.login({success:function(i){return H(n,void 0,void 0,function(){var n;return U(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,t(i.code)];case 1:return a.sent(),e(!0),[3,3];case 2:return n=a.sent(),r(n),[3,3];case 3:return[2]}})})},fail:function(e){var t=Error(e?.errMsg);t.code=e?.errno,r(t)}})})];case 1:return r.sent(),[2]}})})},n.prototype.signInWithUnionId=function(){return H(this,void 0,Promise,function(){var e=this;return U(this,function(t){switch(t.label){case 0:if(!ct.default.isMatch())throw Error(`wx api undefined`);t.label=1;case 1:return t.trys.push([1,3,,4]),[4,new Promise(function(t,n){var r=wx.getAccountInfoSync().miniProgram;wx.login({success:function(i){return H(e,void 0,void 0,function(){var e,a,o,s,c;return U(this,function(l){switch(l.label){case 0:e=r?.appId,l.label=1;case 1:return l.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_code:i.code,provider_id:e,provider_params:{provider_code_type:`union_id`,appid:r?.appId}})];case 2:return a=l.sent(),(o=a.provider_token)?[4,this.oauthInstance.authApi.signInWithProvider({provider_id:e,provider_token:o})]:(n(a),[2]);case 3:return(s=l.sent())?.error_code?(n(s),[2]):(t(!0),[3,5]);case 4:return c=l.sent(),n(c),[3,5];case 5:return[2]}})})},fail:function(e){var t=Error(e?.errMsg);t.code=e?.errno,n(t)}})})];case 2:return t.sent(),[3,4];case 3:throw t.sent();case 4:return[2,this.createLoginState()]}})})},n.prototype.signInWithSms=function(e){var t=e.verificationInfo,n=t===void 0?{verification_id:``,is_user:!1}:t,r=e.verificationCode,i=r===void 0?``:r,a=e.phoneNum,o=a===void 0?``:a,s=e.bindInfo,c=s===void 0?void 0:s;return H(this,void 0,Promise,function(){return U(this,function(e){try{return[2,this.signInWithUsername({verificationInfo:n,verificationCode:i,bindInfo:c,username:o,loginType:`sms`})]}catch(e){throw e}})})},n.prototype.signInWithEmail=function(e){var t=e.verificationInfo,n=t===void 0?{verification_id:``,is_user:!1}:t,r=e.verificationCode,i=r===void 0?``:r,a=e.bindInfo,o=a===void 0?void 0:a,s=e.email,c=s===void 0?``:s;return H(this,void 0,Promise,function(){return U(this,function(e){try{return[2,this.signInWithUsername({verificationInfo:n,verificationCode:i,bindInfo:o,username:c,loginType:`email`})]}catch(e){throw e}})})},n.prototype.setCustomSignFunc=function(e){this.oauthInstance.authApi.setCustomSignFunc(e)},n.prototype.signIn=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signIn(e)];case 1:return t.sent(),[2,this.createLoginState(e)]}})})},n.prototype.setPassword=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.setPassword(e)]})})},n.prototype.isUsernameRegistered=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){switch(t.label){case 0:return typeof e!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`username must be a string`),[4,this.oauthInstance.authApi.checkIfUserExist({username:e})];case 1:return[2,t.sent().exist]}})})},n.prototype.hasLoginState=function(){if(this.cache.mode!==`async`)return this.oauthInstance?.authApi.hasLoginStateSync()?new Nt({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance}):null;(0,Ie.printWarn)(z.ERRORS.INVALID_OPERATION,`current platform's storage is asynchronous, please use getLoginState instead`)},n.prototype.getLoginState=function(){return H(this,void 0,Promise,function(){var e;return U(this,function(t){switch(t.label){case 0:e=null,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.oauthInstance.authApi.getLoginState()];case 2:return e=t.sent(),[3,4];case 3:return t.sent(),[2,null];case 4:return e?[2,new Nt({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})]:[2,null]}})})},n.prototype.getUserInfo=function(){return H(this,void 0,Promise,function(){return U(this,function(e){return[2,this.getCurrentUser()]})})},n.prototype.getWedaUserInfo=function(){return H(this,void 0,Promise,function(){return U(this,function(e){return[2,this.oauthInstance.authApi.getWedaUserInfo()]})})},n.prototype.updateUserBasicInfo=function(e){return H(this,void 0,void 0,function(){var t;return U(this,function(n){switch(n.label){case 0:return[4,this.getLoginState()];case 1:return(t=n.sent())?[4,t.user.updateUserBasicInfo(e)]:[3,3];case 2:n.sent(),n.label=3;case 3:return[2]}})})},n.prototype.getAuthHeader=function(){return console.error(`Auth.getAuthHeader API 已废弃`),{}},n.prototype.bindWithProvider=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.bindWithProvider(e)]})})},n.prototype.queryUser=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.queryUserProfile(e)]})})},n.prototype.getAccessToken=function(){return H(this,void 0,Promise,function(){return U(this,function(e){switch(e.label){case 0:return[4,this.oauthInstance.oauth2client.getAccessToken()];case 1:return[2,{accessToken:e.sent(),env:this.config.env}]}})})},n.prototype.grantProviderToken=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.grantProviderToken(e)]})})},n.prototype.patchProviderToken=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.patchProviderToken(e)]})})},n.prototype.signInWithProvider=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signInWithProvider(e)];case 1:return t.sent(),[2,this.createLoginState(e)]}})})},n.prototype.signInWithWechat=function(e){return e===void 0&&(e={}),H(this,void 0,void 0,function(){return U(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signInWithWechat(e)];case 1:return t.sent(),[2,this.createLoginState(e)]}})})},n.prototype.grantToken=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.grantToken(e)];case 1:return t.sent(),[2,this.createLoginState()]}})})},n.prototype.genProviderRedirectUri=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.genProviderRedirectUri(e)]})})},n.prototype.resetPassword=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.resetPassword(e)]})})},n.prototype.deviceAuthorize=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.deviceAuthorize(e)]})})},n.prototype.sudo=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.sudo(e)]})})},n.prototype.deleteMe=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.deleteMe(e)]})})},n.prototype.getProviders=function(){return H(this,void 0,Promise,function(){return U(this,function(e){return[2,this.oauthInstance.authApi.getProviders()]})})},n.prototype.loginScope=function(){return H(this,void 0,Promise,function(){return U(this,function(e){return[2,this.oauthInstance.authApi.loginScope()]})})},n.prototype.loginGroups=function(){return H(this,void 0,Promise,function(){return U(this,function(e){return[2,this.oauthInstance.authApi.loginGroups()]})})},n.prototype.onLoginStateChanged=function(e){var t;return H(this,void 0,void 0,function(){var n,r=this;return U(this,function(i){switch(i.label){case 0:return(t=this.config.eventBus)==null||t.on(_,function(t){return H(r,void 0,void 0,function(){var n,r;return U(this,function(i){switch(i.label){case 0:return t?.data?.eventType===u?[3,2]:[4,this.getLoginState()];case 1:return r=i.sent(),[3,3];case 2:r={},i.label=3;case 3:return n=r,e.call(this,B(B({},t),n)),[2]}})})}),[4,this.getLoginState()];case 1:return n=i.sent(),e.call(this,n),[2]}})})},n.prototype.refreshTokenForce=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.refreshTokenForce(e)]})})},n.prototype.getCredentials=function(){return H(this,void 0,Promise,function(){return U(this,function(e){return[2,this.oauthInstance.authApi.getCredentials()]})})},n.prototype.setCredentials=function(e){return H(this,void 0,void 0,function(){return U(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.oauth2client.setCredentials(e)];case 1:return t.sent(),[2]}})})},n.prototype.getProviderSubType=function(){return H(this,void 0,Promise,function(){return U(this,function(e){return[2,this.oauthInstance.authApi.getProviderSubType()]})})},n.prototype.createCaptchaData=function(e){return H(this,void 0,void 0,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.createCaptchaData(e)]})})},n.prototype.verifyCaptchaData=function(e){return H(this,void 0,void 0,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.verifyCaptchaData(e)]})})},n.prototype.getMiniProgramQrCode=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.getMiniProgramCode(e)]})})},n.prototype.getMiniProgramQrCodeStatus=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.getMiniProgramQrCodeStatus(e)]})})},n.prototype.modifyPassword=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.modifyPassword(e)]})})},n.prototype.modifyPasswordWithoutLogin=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.modifyPasswordWithoutLogin(e)]})})},n.prototype.getUserBehaviorLog=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.getUserBehaviorLog(e)]})})},n.prototype.signInWithUsername=function(e){var t=e.verificationInfo,n=t===void 0?{verification_id:``,is_user:!1}:t,r=e.verificationCode,i=r===void 0?``:r,a=e.username,o=a===void 0?``:a,s=e.bindInfo,c=s===void 0?void 0:s,l=e.loginType,u=l===void 0?``:l;return H(this,void 0,Promise,function(){var e,t,r,a,s,l,d;return U(this,function(f){switch(f.label){case 0:return f.trys.push([0,8,,9]),[4,this.oauthInstance.authApi.verify({verification_id:n.verification_id,verification_code:i})];case 1:if((e=f.sent())?.error_code)throw e;return t=e.verification_token,r=this.formatPhone(o),a={phone_number:r},u===`email`&&(a={email:r=o}),n.is_user?[4,this.oauthInstance.authApi.signIn({username:r,verification_token:t})]:[3,5];case 2:if((s=f.sent())?.error_code)throw s;return c?[4,this.oauthInstance.authApi.bindWithProvider({provider_token:c?.providerToken})]:[3,4];case 3:if((l=f.sent())?.error_code)throw l;f.label=4;case 4:return[3,7];case 5:return[4,this.oauthInstance.authApi.signUp(B(B({},a),{verification_token:t,provider_token:c?.providerId}))];case 6:if((d=f.sent())?.error_code)throw d;f.label=7;case 7:return[2,this.createLoginState()];case 8:throw f.sent();case 9:return[2]}})})},n.prototype.createLoginState=function(e,t){return H(this,void 0,Promise,function(){var n;return U(this,function(r){switch(r.label){case 0:return[4,(n=new Nt({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})).checkLocalStateAsync()];case 1:return r.sent(),t?.userInfo?(n.user.setLocalUserInfo(t.userInfo),[3,5]):[3,2];case 2:return t?.asyncRefreshUser?(n.user.refresh(e),[3,5]):[3,3];case 3:return[4,n.user.refresh(e)];case 4:r.sent(),r.label=5;case 5:return[2,n]}})})},n.prototype.setAccessKey=function(){var e,t;return H(this,void 0,void 0,function(){var n,r;return U(this,function(i){if(n=``,r=``,this.config.accessKey?(n=this.config.accessKey,r=`accessKey`):(e=this.config.auth)!=null&&e.secretId&&(t=this.config.auth)!=null&&t.secretKey&&(n=``,r=S),!r)return[2];try{this.oauthInstance.oauth2client.setAccessKeyCredentials({access_token:n,token_type:`Bearer`,scope:r,expires_at:new Date(+new Date+ +new Date),expires_in:+new Date+ +new Date})}catch(e){console.warn(`accessKey error: `,e)}return[2]})})},n.prototype.formatPhone=function(e){return!/\s+/.test(e)&&/^\+\d{1,3}\d+/.test(e)?e.replace(/^(\+\d{1,2})(\d+)$/,`$1 $2`):/^\+\d{1,3}\s+/.test(e)?e:`+86 ${e}`},n.prototype.notifyListeners=function(e,t,n){this.listeners.forEach(function(r){r.forEach(function(r){try{r(e,t,n)}catch(e){console.error(`Error in auth state change callback:`,e)}})})},n.prototype.setupListeners=function(){var e,t=this;(e=this.config.eventBus)==null||e.on(v,function(e){return H(t,void 0,void 0,function(){var t,n,r,i,a;return U(this,function(o){switch(o.label){case 0:return t=e?.data?.event,n=e?.data?.info,t!==f||n?[3,2]:[4,this.getUser(!0)];case 1:r=o.sent().data,(i=(r===void 0?{}:r).user)&&(n={user:i}),o.label=2;case 2:return[4,this.getSession()];case 3:return a=o.sent().data.session,this.notifyListeners(t,a,n),[2]}})})})},n.prototype.convertToUser=function(e){var t;if(!e)return null;var n=e?.email||``,r=e?.phone_number||``,i=e?.sub||e?.uid||``;return{id:i,aud:`authenticated`,role:((t=e.groups)?.map)?.call(t,function(e){return typeof e==`string`?e:e.id}),email:n||``,email_confirmed_at:(e?.email_verified,e.created_at),phone:r,phone_confirmed_at:r?e.created_at:void 0,confirmed_at:e.created_at,last_sign_in_at:e.last_sign_in_at,app_metadata:{provider:e.loginType?.toLowerCase()||`cloudbase`,providers:[e.loginType?.toLowerCase()||`cloudbase`]},user_metadata:{name:e?.name,picture:e?.picture,username:e?.username,gender:e?.gender,locale:e?.locale,uid:e.uid,nickName:e.nickName||e?.name,avatarUrl:e.avatarUrl||e.picture,location:e.location,hasPassword:e.hasPassword??e.password===`SET`,open_id:e?.open_id},identities:(e?.providers)?.map(function(t){return{id:t.id||``,identity_id:t.id||``,user_id:i,identity_data:{provider_id:t.id,provider_user_id:t.provider_user_id,name:t.name},provider:t.id||`cloudbase`,created_at:e.created_at,updated_at:e.updated_at,last_sign_in_at:e.last_sign_in_at}})||[],created_at:e.created_at,updated_at:e.updated_at,is_anonymous:e.name===`anonymous`}},n.prototype.missingRequiredParam=function(e,t){return new I({error:`missing_required_param`,error_code:4e3,error_description:`auth.${e}(params): missing required param '${t}'`},{method:e})},n.prototype.validateParams=function(e,t,n){for(var r=0,i=Object.entries(t);r<i.length;r++){var a=i[r],o=a[0];if(a[1].required&&(e?.[o]===void 0||e?.[o]===null||e?.[o]===``))throw this.missingRequiredParam(n,o)}},n.prototype.validateAtLeastOne=function(e,t,n){if(!t.some(function(t){return t.some(function(t){return e?.[t]!==void 0&&e?.[t]!==null&&e?.[t]!==``})}))throw this.missingRequiredParam(n,t.map(function(e){return e.join(`|`)}).join(`|`))},n.prototype.init=function(){var e;return H(this,void 0,Promise,function(){return U(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.oauthInstance.oauth2client.localCredentials.getCredentials()];case 1:return t.sent()&&!this.oauthInstance.oauth2client.initSessionEmitted&&((e=this.config.eventBus)==null||e.fire(v,{event:p})),[3,3];case 2:return t.sent(),[3,3];case 3:return[2,{error:null}]}})})},Tt([(0,ot.catchErrorsDecorator)({title:`绑定手机号失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().bindPhoneNumber() 的语法或参数是否正确`,` 2 - 当前环境是否开通了短信验证码登录`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[typeof(r=e.BindPhoneRequest)==`function`?r:Object]),V(`design:returntype`,Promise)],n.prototype,`bindPhoneNumber`,null),Tt([(0,ot.catchErrorsDecorator)({title:`解除三方绑定失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().unbindProvider() 的语法或参数是否正确`,` 2 - 当前账户是否已经与此登录方式解绑`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[typeof(i=e.UnbindProviderRequest)==`function`?i:Object]),V(`design:returntype`,typeof(a=typeof Promise<`u`&&Promise)==`function`?a:Object)],n.prototype,`unbindProvider`,null),Tt([(0,ot.catchErrorsDecorator)({title:`绑定邮箱地址失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().bindEmail() 的语法或参数是否正确`,` 2 - 当前环境是否开通了邮箱密码登录`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[typeof(o=e.BindEmailRequest)==`function`?o:Object]),V(`design:returntype`,void 0)],n.prototype,`bindEmail`,null),Tt([(0,ot.catchErrorsDecorator)({title:`验证码验证失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().verify() 的语法或参数是否正确`,` 2 - 当前环境是否开通了手机验证码/邮箱登录`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[typeof(s=e.VerifyRequest)==`function`?s:Object]),V(`design:returntype`,typeof(l=typeof Promise<`u`&&Promise)==`function`?l:Object)],n.prototype,`verify`,null),Tt([(0,ot.catchErrorsDecorator)({title:`获取验证码失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().getVerification() 的语法或参数是否正确`,` 2 - 当前环境是否开通了手机验证码/邮箱登录`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[typeof(d=e.GetVerificationRequest)==`function`?d:Object,Object]),V(`design:returntype`,typeof(m=typeof Promise<`u`&&Promise)==`function`?m:Object)],n.prototype,`getVerification`,null),Tt([(0,ot.catchErrorsDecorator)({title:`获取用户信息失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().getCurrentUser() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[Object]),V(`design:returntype`,typeof(g=typeof Promise<`u`&&Promise)==`function`?g:Object)],n.prototype,`getCurrentUser`,null),Tt([(0,ot.catchErrorsDecorator)({title:`小程序匿名登录失败`,messages:[`请确认以下各项:`,` 1 - 当前环境是否开启了匿名登录`,` 2 - 调用 auth().signInAnonymouslyInWx() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[Object]),V(`design:returntype`,typeof(b=typeof Promise<`u`&&Promise)==`function`?b:Object)],n.prototype,`signInAnonymouslyInWx`,null),Tt([(0,ot.catchErrorsDecorator)({title:`小程序绑定OpenID失败`,messages:[`请确认以下各项:`,` 1 - 当前环境是否开启了小程序openId静默登录`,` 2 - 调用 auth().bindOpenId() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[]),V(`design:returntype`,typeof(C=typeof Promise<`u`&&Promise)==`function`?C:Object)],n.prototype,`bindOpenId`,null),Tt([(0,ot.catchErrorsDecorator)({title:`小程序unionId静默登录失败`,messages:[`请确认以下各项:`,` 1 - 当前环境是否开启了小程序unionId静默登录`,` 2 - 调用 auth().signInWithUnionId() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[]),V(`design:returntype`,typeof(w=typeof Promise<`u`&&Promise)==`function`?w:Object)],n.prototype,`signInWithUnionId`,null),Tt([(0,ot.catchErrorsDecorator)({title:`短信验证码登陆`,messages:[`请确认以下各项:`,` 1 - 当前环境是否开启了小程序短信验证码登陆`,` 2 - 调用 auth().signInWithSms() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[Object]),V(`design:returntype`,typeof(T=typeof Promise<`u`&&Promise)==`function`?T:Object)],n.prototype,`signInWithSms`,null),Tt([(0,ot.catchErrorsDecorator)({title:`邮箱验证码登陆`,messages:[`请确认以下各项:`,` 1 - 当前环境是否开启了邮箱登陆`,` 2 - 调用 auth().signInWithEmail() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[Object]),V(`design:returntype`,typeof(E=typeof Promise<`u`&&Promise)==`function`?E:Object)],n.prototype,`signInWithEmail`,null),Tt([(0,ot.catchErrorsDecorator)({title:`获取用户是否被占用失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().isUsernameRegistered() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[String]),V(`design:returntype`,typeof(D=typeof Promise<`u`&&Promise)==`function`?D:Object)],n.prototype,`isUsernameRegistered`,null),Tt([(0,ot.catchErrorsDecorator)({title:`获取本地登录态失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().getLoginState() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[]),V(`design:returntype`,typeof(ee=typeof Promise<`u`&&Promise)==`function`?ee:Object)],n.prototype,`getLoginState`,null),Tt([(0,ot.catchErrorsDecorator)({title:`获取用户信息失败`,messages:[`请确认以下各项:`,` 1 - 是否已登录`,` 2 - 调用 auth().getUserInfo() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[]),V(`design:returntype`,typeof(te=typeof Promise<`u`&&Promise)==`function`?te:Object)],n.prototype,`getUserInfo`,null),Tt([(0,ot.catchErrorsDecorator)({title:`获取微搭插件用户信息失败`,messages:[`请确认以下各项:`,` 1 - 是否已登录`,` 2 - 调用 auth().getWedaUserInfo() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[]),V(`design:returntype`,typeof(O=typeof Promise<`u`&&Promise)==`function`?O:Object)],n.prototype,`getWedaUserInfo`,null),Tt([(0,ot.catchErrorsDecorator)({title:`绑定第三方登录方式失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().bindWithProvider() 的语法或参数是否正确`,` 2 - 此账户是否已经绑定此第三方`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[typeof(A=e.BindWithProviderRequest)==`function`?A:Object]),V(`design:returntype`,typeof(ne=typeof Promise<`u`&&Promise)==`function`?ne:Object)],n.prototype,`bindWithProvider`,null),Tt([(0,ot.catchErrorsDecorator)({title:`获取身份源类型`,messages:[`请确认以下各项:`,` 1 - 调用 auth().getProviderSubType() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[]),V(`design:returntype`,typeof(re=typeof Promise<`u`&&Promise)==`function`?re:Object)],n.prototype,`getProviderSubType`,null),n}(Ct),Ft=`auth`;function It(e,t){for(var n=[],r=0;r<=e.length;r++)n[r]=[r];for(var i=0;i<=t.length;i++)n[0][i]=i;for(r=1;r<=e.length;r++)for(i=1;i<=t.length;i++){var a=e[r-1].toLowerCase()===t[i-1].toLowerCase()?0:1;n[r][i]=Math.min(n[r-1][i]+1,n[r][i-1]+1,n[r-1][i-1]+a)}return n[e.length][t.length]}var Lt={name:`auth`,namespace:Ft,entity:function(e){var t=function(e){var t=this;if(this.authInstance&&!e)return this.authInstance;e||={region:``,persistence:`local`,apiPath:s};var n=this.platform.adapter,r=e.persistence||n.primaryStorage;r&&r!==this.config.persistence&&this.updateConfig({persistence:r});var i=function(e,t){var n=this,r=e.region,i=r===void 0?`ap-shanghai`:r,a=e.i18n,o=e.accessKey,c=e.useWxCloud,l=t?.platform||lt.useDefaultAdapter.bind(t)(),u=l.runtime,d=l.adapter,p=t||{},m=p.env,h=p.clientId,_=p.debug,b=p.cache,S=p.app,C=p.getApiOrigin,w=(t||{}).apiOrigin;w||=`https://${m}.${i}.tcb-api.tencentcloudapi.com`;var T={env:m,clientId:h,i18n:a,accessKey:o,useWxCloud:c,eventBus:new Fe.CloudbaseEventEmitter},E=new at(gt(B(B({},T),{apiOrigin:w,getApiOrigin:C,apiPath:e?.apiPath||s,storage:e?.storage,baseRequest:e?.baseRequest,request:e?.request,anonymousSignInFunc:e?.anonymousSignInFunc,captchaOptions:e?.captchaOptions,wxCloud:e?.wxCloud,adapter:d,onCredentialsError:Dt(T.eventBus),headers:B({"X-SDK-Version":`@cloudbase/js-sdk/${e.sdkVersion}`},e.headers||{}),detectSessionInUrl:e.detectSessionInUrl,debug:_,auth:t.app?.config?.auth}))),D=new Pt(B(B({},T),{region:i,persistence:e.persistence,debug:_,cache:b||new st.CloudbaseCache({persistence:e.persistence,keys:{userInfoKey:`user_info_${m}`},platformInfo:l}),runtime:u||`web`,_fromApp:S,oauthInstance:E,auth:t.app?.config?.auth}));return E.initializeSession(function(e,t){return H(n,void 0,void 0,function(){return U(this,function(n){return e&&(e.type===y?t?T.eventBus.fire(v,{event:f,info:B(B({},e),{error:t})}):e.user&&D.createLoginState({},{userInfo:e.user}):e.type===x&&T.eventBus.fire(v,{event:g,info:B(B({},e),{error:t})})),[2]})})}),{authInstance:D,oauthInstance:E}}(B(B({wxCloud:this.config.wxCloud,storage:this.config.storage},e),{persistence:this.config.persistence,i18n:this.config.i18n,accessKey:this.config.accessKey,useWxCloud:this.config.useWxCloud,sdkVersion:this.version,detectSessionInUrl:this.config.auth?.detectSessionInUrl}),{env:this.config.env,clientId:this.config.clientId,getApiOrigin:function(){return t.request.getBaseEndPoint(t.config.endPointMode||`CLOUD_API`)},platform:this.platform,cache:this.cache,app:this,debug:this.config.debug}),a=i.authInstance,o=i.oauthInstance;return this.oauthInstance=o,this.authInstance=a,this.authInstance},n=t.call(this,e);Object.assign(t,n),Object.setPrototypeOf(t,Object.getPrototypeOf(n));var r=typeof Proxy<`u`?new Proxy(t,{get:function(e,t,n){var r=Reflect.get(e,t,n);if(r!==void 0||typeof t!=`string`)return r;var i=function(e,t){for(var n=null,r=1/0,i=0,a=t;i<a.length;i++){var o=a[i];if(!o.startsWith(`_`)&&o!==`constructor`){var s=It(e,o);s<r&&(r=s,n=o)}}return n}(t,Object.getOwnPropertyNames(Object.getPrototypeOf(e)).concat(Object.keys(e)).filter(function(t){return typeof e[t]==`function`}));return i&&console.warn(`[CloudBase Auth] auth.${t} is not a function. Did you mean: auth.${i}() ?`),r}}):t;return this[Ft]=r,r}};try{cloudbase.registerComponent(Lt)}catch{}var Rt=function(e){try{e.registerComponent(Lt)}catch(e){console.warn(e)}};try{window.registerAuth=Rt}catch{}})(),ao.W;var oo={388:e=>{e.exports={}}},so={};function co(e){var t=so[e];if(t!==void 0)return t.exports;var n=so[e]={exports:{}};return oo[e](n,n.exports,co),n.exports}co.d=(e,t)=>{for(var n in t)co.o(t,n)&&!co.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},co.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var lo={};(()=>{co.d(lo,{r:()=>ve});var e=co(388);function t(){return`@cloudbase/js-sdk`}var n={INVALID_PARAMS:`INVALID_PARAMS`,INVALID_SYNTAX:`INVALID_SYNTAX`,INVALID_OPERATION:`INVALID_OPERATION`,OPERATION_FAIL:`OPERATION_FAIL`,NETWORK_ERROR:`NETWORK_ERROR`,UNKOWN_ERROR:`UNKOWN_ERROR`};let r=(i={AbstractSDKRequest:()=>f,AbstractStorage:()=>p},a={},co.d(a,i),a);var i,a,o,s=(o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},o(e,t)},function(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);function n(){this.constructor=e}o(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}),c=function(){return c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},c.apply(this,arguments)};function l(e,t){console.warn(`[@cloudbase/js-sdk][${e}]:${t}`)}var u=function(e){function t(t){var n=e.call(this,t.msg||t.message||``)||this;return n.code=t.code||``,n.requestId=t.requestId||``,Object.defineProperty(n,"message",{value:t.msg||t.message||``,enumerable:!0,writable:!0,configurable:!0}),n}return s(t,e),t}(Error),d=function(e){return new u(e)};function m(e,t){return(t||d)(e)}var h,g=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),_=function(){return _=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},_.apply(this,arguments)},v=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},y=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};(function(e){function t(t){var n=e.call(this)||this,r=t.timeout,i=t.timeoutMsg,a=t.restrictedMethods;return n.timeout=r||0,n.timeoutMsg=i||`请求超时`,n.restrictedMethods=a||[`get`,`post`,`upload`,`download`],n}g(t,e),t.prototype.get=function(e){return this.request(_(_({},e),{method:`get`}),this.restrictedMethods.includes(`get`))},t.prototype.post=function(e){return this.request(_(_({},e),{method:`post`}),this.restrictedMethods.includes(`post`))},t.prototype.put=function(e){return this.request(_(_({},e),{method:`put`}))},t.prototype.upload=function(e){var t=e.data,n=e.file,r=e.name,i=e.method,a=e.headers,o=a===void 0?{}:a,s={post:`post`,put:`put`}[i?.toLowerCase()]||`put`,c=new FormData;return s===`post`?(Object.keys(t).forEach(function(e){c.append(e,t[e])}),c.append(`key`,r),c.append(`file`,n),this.request(_(_({},e),{data:c,method:s}),this.restrictedMethods.includes(`upload`))):this.request(_(_({},e),{method:`put`,headers:o,body:n}),this.restrictedMethods.includes(`upload`))},t.prototype.download=function(e){return v(this,void 0,Promise,function(){var t,n,r,i;return y(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.get(_(_({},e),{headers:{},responseType:`blob`}))];case 1:return t=a.sent().data,n=window.URL.createObjectURL(new Blob([t])),r=decodeURIComponent(new URL(e.url).pathname.split(`/`).pop()||``),(i=document.createElement(`a`)).href=n,i.setAttribute(`download`,r),i.style.display=`none`,document.body.appendChild(i),i.click(),window.URL.revokeObjectURL(n),document.body.removeChild(i),[3,3];case 2:return a.sent(),[3,3];case 3:return[2,new Promise(function(t){t({statusCode:200,tempFilePath:e.url})})]}})})},t.prototype.fetch=function(e){return v(this,void 0,Promise,function(){var t,n,r,i,a,o,s,c,l,u,d,f,p,m=this;return y(this,function(h){switch(h.label){case 0:return t=new AbortController,n=e.url,r=e.enableAbort,i=r!==void 0&&r,a=e.stream,o=a!==void 0&&a,s=e.signal,c=e.timeout,l=e.shouldThrowOnError,u=l===void 0||l,d=c??this.timeout,s&&(s.aborted&&t.abort(),s.addEventListener(`abort`,function(){return t.abort()})),f=null,i&&d&&(f=setTimeout(function(){console.warn(m.timeoutMsg),t.abort(Error(m.timeoutMsg))},d)),[4,fetch(n,_(_({},e),{signal:t.signal})).then(function(e){return v(m,void 0,void 0,function(){var t,n,r;return y(this,function(i){switch(i.label){case 0:return clearTimeout(f),u?e.ok?(t=e,[3,3]):[3,1]:[3,4];case 1:return r=(n=Promise).reject,[4,e.json()];case 2:t=r.apply(n,[i.sent()]),i.label=3;case 3:return[2,t];case 4:return[2,e]}})})}).catch(function(e){return clearTimeout(f),Promise.reject(e)})];case 1:return p=h.sent(),[2,{data:o?p.body:p.headers.get(`content-type`)?.includes(`application/json`)?p.json():p.text(),statusCode:p.status,header:p.headers,response:p}]}})})},t.prototype.request=function(e,t){var n=this;t===void 0&&(t=!1);var r=String(e.method).toLowerCase()||`get`;return new Promise(function(i){var a=e.url,o=e.headers,s=o===void 0?{}:o,c=e.data,l=e.responseType,u=e.withCredentials,d=e.body,f=e.onUploadProgress,p=function(e,t,n){n===void 0&&(n={});var r=/\?/.test(t),i=``;return Object.keys(n).forEach(function(e){i===``?!r&&(t+=`?`):i+=`&`,i+=`${e}=${encodeURIComponent(n[e])}`}),/^http(s)?:\/\//.test(t+=i)?t:`${e}${t}`}(`https:`,a,r===`get`?c:{}),m=new XMLHttpRequest;m.open(r,p),l&&(m.responseType=l);var h,g,_,v=e.signal;v&&(v.aborted?m.abort():v.addEventListener(`abort`,function(){return m.abort()},{once:!0})),Object.keys(s).forEach(function(e){m.setRequestHeader(e,s[e])}),f&&m.upload.addEventListener(`progress`,f),m.onreadystatechange=function(){var e={};if(m.readyState===4){var t=m.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};t.forEach(function(e){var t=e.split(`: `),r=t.shift().toLowerCase();n[r]=t.join(`: `)}),e.header=n,e.statusCode=m.status;try{e.data=l===`blob`?m.response:JSON.parse(m.responseText)}catch{e.data=l===`blob`?m.response:m.responseText}clearTimeout(h),i(e)}},t&&n.timeout&&(h=setTimeout(function(){console.warn(n.timeoutMsg),m.abort()},n.timeout)),_=c,g=Object.prototype.toString.call(_)===`[object FormData]`?c:s[`content-type`]===`application/x-www-form-urlencoded`?function(e){e===void 0&&(e={});var t=[];return Object.keys(e).forEach(function(n){t.push(`${n}=${encodeURIComponent(e[n])}`)}),t.join(`&`)}(c):d||(c?JSON.stringify(c):void 0),u&&(m.withCredentials=!0),m.send(g)})}})(r.AbstractSDKRequest),function(e){e.WEB=`web`,e.WX_MP=`wx_mp`}(h||={});var x=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),S=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},C=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},w=function(e){function t(t){var n=e.call(this)||this;return n.root=t,t.tcbCacheObject||={},n}return x(t,e),t.prototype.setItem=function(e,t){this.root.tcbCacheObject[e]=t},t.prototype.getItem=function(e){return this.root.tcbCacheObject[e]},t.prototype.removeItem=function(e){delete this.root.tcbCacheObject[e]},t.prototype.clear=function(){delete this.root.tcbCacheObject},t}(r.AbstractStorage);(function(){function e(e){this.keys={};var t=e.persistence,r=e.platformInfo,i=r===void 0?{}:r,a=e.keys,o=a===void 0?{}:a;this.platformInfo=i,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||t,this.storage=function(e,t){switch(e){case`local`:default:return t.localStorage?t.localStorage:(l(n.INVALID_PARAMS,`localStorage is not supported on current platform`),new w(t.root));case`none`:return new w(t.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=o)}Object.defineProperty(e.prototype,"mode",{get:function(){return this.storage.mode||`sync`},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),e.prototype.setStore=function(e,t,r){if(this.mode!==`async`){if(this.storage)try{var i={version:r||`localCachev1`,content:t};this.storage.setItem(e,JSON.stringify(i))}catch(e){throw Error(JSON.stringify({code:n.OPERATION_FAIL,msg:`[@cloudbase/js-sdk][${n.OPERATION_FAIL}]setStore failed`,info:e}))}}else l(n.INVALID_OPERATION,`current platform's storage is asynchronous, please use setStoreAsync insteed`)},e.prototype.setStoreAsync=function(e,t,n){return S(this,void 0,void 0,function(){var r;return C(this,function(i){switch(i.label){case 0:if(!this.storage)return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),r={version:n||`localCachev1`,content:t},[4,this.storage.setItem(e,JSON.stringify(r))];case 2:return i.sent(),[3,4];case 3:return i.sent(),[2];case 4:return[2]}})})},e.prototype.getStore=function(e,t){if(this.mode!==`async`){try{if(typeof process<`u`&&{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token)return{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token;if(!this.storage)return``}catch{return``}t||=`localCachev1`;var r=this.storage.getItem(e);return r&&r.indexOf(t)>=0?JSON.parse(r).content:``}l(n.INVALID_OPERATION,`current platform's storage is asynchronous, please use getStoreAsync insteed`)},e.prototype.getStoreAsync=function(e,t){return S(this,void 0,void 0,function(){var n;return C(this,function(r){switch(r.label){case 0:try{if(typeof process<`u`&&{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token)return[2,{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token];if(!this.storage)return[2,``]}catch{return[2,``]}return t||=`localCachev1`,[4,this.storage.getItem(e)];case 1:return(n=r.sent())&&n.indexOf(t)>=0?[2,JSON.parse(n).content]:[2,``]}})})},e.prototype.removeStore=function(e){this.mode===`async`?l(n.INVALID_OPERATION,`current platform's storage is asynchronous, please use removeStoreAsync insteed`):this.storage.removeItem(e)},e.prototype.removeStoreAsync=function(e){return S(this,void 0,void 0,function(){return C(this,function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}})})}})();var T=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),E=function(e,t){this.data=t||null,this.name=e},D=function(e){function t(t,n){var r=e.call(this,`error`,{error:t,data:n})||this;return r.error=t,r}return T(t,e),t}(E),ee=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){return function(e,t,n){n[e]=n[e]||[],n[e].push(t)}(e,t,this.listeners),this},e.prototype.off=function(e,t){return function(e,t,n){if(n?.[e]){var r=n[e].indexOf(t);r!==-1&&n[e].splice(r,1)}}(e,t,this.listeners),this},e.prototype.fire=function(e,t){if(e instanceof D)return console.error(e.error),this;var n=typeof e==`string`?new E(e,t||{}):e,r=n.name;if(this.listens(r)){n.target=this;for(var i=0,a=this.listeners[r]?function(e,t,n){if(n||arguments.length===2)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||=Array.prototype.slice.call(t,0,i),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([],this.listeners[r],!0):[];i<a.length;i++)a[i].call(this,n)}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}();new ee,new ee,typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.indexOf(`Firefox`),(e=>{var t={};return co.d(t,e),t})({default:()=>b}).default;var te=function(){return te=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},te.apply(this,arguments)},O=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},k=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},A=n,ne=`cloudrun`;function re(e,t){return O(this,void 0,void 0,function(){var n,r,i,a,o,s,c,l,u,d,f,p,m,h,g;return k(this,function(_){switch(_.label){case 0:if(n=e.name,r=e.data,i=e.path,a=i===void 0?``:i,o=e.method,s=e.header,c=s===void 0?{}:s,l=this.getEndPointWithKey(`GATEWAY`),u=l.BASE_URL,d=l.PROTOCOL,f=`${d}${u}/cloudrun/${n}`,p=a.startsWith(`/`)?a:`/${a}`,m=[`GET`,`HEAD`].includes((o?.toUpperCase)?.call(o)))try{h={};try{h=JSON.parse(r)}catch{h=r||{}}p=`${p}${p.includes(`?`)?`&`:`?`}${Object.keys(h).map(function(e){return`${e}=${h[e]}`}).join(`&`)}`}catch{}return[4,this.request.fetch(te(te({method:o||`POST`,headers:Object.assign({},{"Content-Type":`application/json; charset=utf-8`},c)},m?{}:{body:r}),{url:`${f}${p}`,customReqOpts:t}))];case 1:return g=_.sent(),t?.from===`node-sdk`?[2,g]:[4,g.data];case 2:return[2,_.sent()]}})})}var ie={name:ne,entity:{callContainer:new(function(){function e(){}return e.prototype.callContainer=function(e,t){return O(this,void 0,void 0,function(){var n,r,i;return k(this,function(a){switch(a.label){case 0:if(n=e.name,r=e.data,!n)throw Error(JSON.stringify({code:A.INVALID_PARAMS,msg:`[${ne}.callContainer] invalid name`}));try{i=r?JSON.stringify(r):``}catch{throw Error(JSON.stringify({code:A.INVALID_PARAMS,msg:`[${ne}.callContainer] invalid data`}))}return[4,re.call(this,te(te({},e),{data:i}),t)];case 1:return[2,a.sent()]}})})},e}())().callContainer}};try{cloudbase.registerComponent(ie)}catch{}try{window.registerCloudrun=function(e){try{e.registerComponent(ie)}catch(e){console.warn(e)}}}catch{}var ae=function(){return ae=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ae.apply(this,arguments)},oe=function(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)},se=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},ce=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},le=t,ue=n,de=function(e,t,n){if(n===void 0&&(n=null),e&&typeof e==`function`)return e(t,n);if(t)throw t;return n},fe=function(e,t){if(function(e){return!e||typeof e.throw!=`boolean`||e.throw}(e))throw m(c(c({},t),{msg:t.message}),e?.errorFactory);return c({code:t.code,message:t.message},t.requestId?{requestId:t.requestId}:{})},pe=`functions`;function me(e){return e.length<=1024?e:`${e.slice(0,1024)}…`}function he(e,t){return{code:e?.code||ue.NETWORK_ERROR,message:e?.message||e?.msg||``,requestId:t}}function ge(e,t){if(e&&typeof e==`object`&&!Array.isArray(e))return he(e,t);if(typeof e==`string`){try{var n=JSON.parse(e);if(n&&typeof n==`object`&&!Array.isArray(n))return he(n,t)}catch{}return{code:ue.NETWORK_ERROR,message:me(e),requestId:t}}return{code:ue.NETWORK_ERROR,message:me(e==null?``:String(e)),requestId:t}}var _e={name:pe,entity:{callFunction:new(function(){function t(){}var n,r,i,a;return t.invokeCloudrun=function(e,t,n){return se(this,void 0,void 0,function(){var r,i,a,o,s,c,l;return ce(this,function(u){switch(u.label){case 0:return r=t.name,i=t.path,a=i===void 0?``:i,o=t.method,s=t.header,c=s===void 0?{}:s,d=new Date().getTime(),f=(Date==null?void 0:Date.now)&&1e3*Date.now()||0,l=`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,function(e){var t=16*Math.random();return d>0?(t=(d+t)%16|0,d=Math.floor(d/16)):(t=(f+t)%16|0,f=Math.floor(f/16)),(e===`x`?t:7&t|8).toString(16)}),[4,re.call(e,{name:r,data:n,path:a,method:o,header:ae(ae({},c),{"X-Request-Id":l})})];case 1:return[2,{result:u.sent(),requestId:l}]}var d,f})})},t.invokeGateway=function(e,t,n,r){return se(this,void 0,void 0,function(){var i,a,o,s,c;return ce(this,function(l){switch(l.label){case 0:i=e.request,a=e.config,l.label=1;case 1:return l.trys.push([1,3,,4]),[4,i.gateWay(ae(ae({},t),{path:`functions`,shouldThrowOnError:!1}),r)];case 2:return o=l.sent(),[3,4];case 3:return s=l.sent(),function(e){if(!e)return!1;if(e instanceof SyntaxError||e.name===`SyntaxError`)return!0;var t=String(e.message||``);return/not valid JSON|Unexpected token|JSON\.parse|Failed to execute 'json'/i.test(t)}(c=s)?[2,fe(a,ge(c.message,c.requestId))]:[2,de(n,c)];case 4:return Number(o?.statusCode)>=400?[2,fe(a,ge(o?.data,o?.requestId))]:[2,de(n,null,{requestId:o?.requestId,result:o?.data})]}})})},t.invokeCloudApi=function(e,t,n,r,i){return se(this,void 0,void 0,function(){var a,o,s,c,l,u,d;return ce(this,function(f){switch(f.label){case 0:return a=t.name,o=t.data,s=t.query,c=t.parse,l=t.search,[4,e.request.send(`functions.invokeFunction`,{inQuery:s,parse:c,search:l,function_name:a,request_data:n},{endPointMode:`CLOUD_API`,defaultQuery:o?.params?.action?{action:o?.params?.action}:{}},i)];case 1:if(u=f.sent(),(d=u.data?.response_data)===void 0)return[2,de(r,null,u)];if(c)return[2,de(r,null,{result:d,requestId:u.requestId})];try{return d=JSON.parse(d),[2,de(r,null,{result:d,requestId:u.requestId})]}catch{return[2,de(r,Error(`[${le()}][${ue.INVALID_PARAMS}][${pe}.callFunction] response data must be json`))]}}})})},t.prototype.callFunction=function(e,n,r){return se(this,void 0,void 0,function(){var i,a,o,s,c,l;return ce(this,function(u){switch(u.label){case 0:if(i=e.name,a=e.data,o=e.type,s=this.config,!i)return[2,fe(s,{code:ue.INVALID_PARAMS,message:`[${pe}.callFunction] invalid function name`})];try{c=a?JSON.stringify(a):``}catch{return[2,fe(s,{code:ue.INVALID_PARAMS,message:`[${pe}.callFunction] invalid data`})]}if(o===`cloudrun`)return[2,t.invokeCloudrun(this,e,c)];u.label=1;case 1:return u.trys.push([1,5,,6]),function(e,t){return e.endPointMode===`GATEWAY`&&!function(e){return e===`lcap-common-service`||e===`lcap-datasource-test`||e.startsWith(`lcap-data`)||e.startsWith(`lowcode-datasource`)||e===`cloudbase_module`}(t)&&!function(e){return e===`lowcode-wx-datasource`}(t)}(s,i)?[4,t.invokeGateway(this,e,n,r)]:[3,3];case 2:return[2,u.sent()];case 3:return[4,t.invokeCloudApi(this,e,c,n,r)];case 4:return[2,u.sent()];case 5:return l=u.sent(),de(n,l),[3,6];case 6:return[2]}})})},function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);a>3&&o&&Object.defineProperty(t,n,o)}([(a={customInfo:{className:`Cloudbase`,methodName:`callFunction`},title:`函数调用失败`,messages:[`请确认以下各项:`,` 1 - 调用 callFunction() 的语法或参数是否正确`,` 2 - 当前环境下是否存在此函数`,` 3 - 函数安全规则是否限制了当前登录状态访问`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:https://support.qq.com/products/148793`]},a.mode,a.customInfo,a.title,a.messages,function(e,t,n){}),oe(`design:type`,Function),oe(`design:paramtypes`,[typeof(n=e.ICallFunctionOptions!==void 0&&e.ICallFunctionOptions)==`function`?n:Object,typeof(r=typeof Function<`u`&&Function)==`function`?r:Object,typeof(i=e.ICustomReqOpts!==void 0&&e.ICustomReqOpts)==`function`?i:Object]),oe(`design:returntype`,Promise)],t.prototype,`callFunction`,null),t}())().callFunction}};try{cloudbase.registerComponent(_e)}catch{}var ve=function(e){try{e.registerComponent(_e)}catch(e){console.warn(e)}};try{window.registerFunctions=ve}catch{}})(),lo.r;var uo={388:e=>{e.exports={}}},fo={};function po(e){var t=fo[e];if(t!==void 0)return t.exports;var n=fo[e]={exports:{}};return uo[e](n,n.exports,po),n.exports}po.d=(e,t)=>{for(var n in t)po.o(t,n)&&!po.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},po.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var mo={};(()=>{po.d(mo,{v:()=>ot});var e,t=(e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)},function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}),n=function(e){function n(t){var n=e.call(this,t)||this;return n.__isStorageError=!0,n.name=`StorageError`,n}return t(n,e),n}(Error);function r(e){return typeof e==`object`&&!!e&&`__isStorageError`in e}var i,a=function(e){function n(t,n,r){var i=e.call(this,t)||this;return i.name=`StorageApiError`,i.status=n,i.statusCode=r,i}return t(n,e),n.prototype.toJSON=function(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}},n}(n);function o(){return globalThis.Buffer}function s(e){var t=o();return t?t.from(e).toString(`base64`):btoa(e)}function c(e){return e.split(`/`).map(function(e){return encodeURIComponent(e)}).join(`/`)}t(function(e,t){var n=i.call(this,e)||this;return n.name=`StorageUnknownError`,n.originalError=t,n},i=n);var l=function(){return l=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},l.apply(this,arguments)},u=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},d=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},m=`/v1/storages`;function h(e,t){return u(this,void 0,Promise,function(){var i;return d(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,e()];case 1:return[2,{data:a.sent(),error:null}];case 2:if(i=a.sent(),t)throw i;return r(i)?[2,{data:null,error:i}]:[2,{data:null,error:new n(i?.message||String(i))}];case 3:return[2]}})})}var g=function(){function e(e){this.ctx=e}return Object.defineProperty(e.prototype,"request",{get:function(){return this.ctx.request},enumerable:!1,configurable:!0}),e.prototype.gatewayOrigin=function(){return this.request.getBaseEndPoint(`GATEWAY`)},e.prototype.buildUrl=function(e,t){var n=`${this.gatewayOrigin()}${m}${e}`,r=function(e){if(!e)return``;var t=[];return Object.keys(e).forEach(function(n){var r=e[n];r!=null&&t.push(`${encodeURIComponent(n)}=${encodeURIComponent(String(r))}`)}),t.join(`&`)}(t);return r&&(n+=(n.includes(`?`)?`&`:`?`)+r),n},e.prototype.toFullUrl=function(e){return e&&(/^https?:\/\//.test(e)||e.startsWith(`//`)?e:`${this.gatewayOrigin()}${m}${e.startsWith(`/`)?``:`/`}${e}`)},e.prototype.send=function(e){return u(this,void 0,Promise,function(){var t,n,r,i,a,o;return d(this,function(s){switch(s.label){case 0:return t=this.buildUrl(e.path,e.query),n=e.method.toUpperCase(),r=[`GET`,`HEAD`].includes(n),i=l({},e.headers||{}),r||(e.rawBody===void 0?e.json!==void 0&&(i[`Content-Type`]=i[`Content-Type`]||`application/json`,a=JSON.stringify(e.json)):a=e.rawBody),[4,this.request.fetch(l(l(l(l({url:t,method:n,headers:i},a===void 0?{}:{body:a}),{withCredentials:!1!==e.withCredentials,shouldThrowOnError:!1}),e.signal?{signal:e.signal}:{}),e.cache?{cache:e.cache}:{}))];case 1:return o=s.sent(),[2,this.unwrap(o,t)]}})})},e.prototype.download=function(e){return u(this,void 0,Promise,function(){var t,n,r,i;return d(this,function(o){switch(o.label){case 0:return t=this.buildUrl(e.path,e.query),[4,this.request.fetch(l(l({url:t,method:`GET`,headers:l({},e.headers||{}),stream:!0,withCredentials:!1!==e.withCredentials,shouldThrowOnError:!1},e.signal?{signal:e.signal}:{}),e.cache?{cache:e.cache}:{}))];case 1:if(n=o.sent(),e.signal?.aborted)throw new a(`The download was aborted`,0,`STORAGE_PG_ABORTED`);if((r=Number(n?.statusCode??200))===304)throw new a(`Not Modified`,r,`STORAGE_PG_NOT_MODIFIED`);if(r>=400)throw new a(`Download failed with status ${r}`,r,`STORAGE_PG_REQUEST_FAIL`);if(!(i=n?.response))throw new a(`Underlying adapter did not expose the raw Response`,r,`STORAGE_PG_NO_RESPONSE`);return[2,{response:i,status:r,header:n?.header}]}})})},e.prototype.unwrap=function(e,t){return u(this,void 0,Promise,function(){var n,r,i,o;return d(this,function(s){switch(s.label){case 0:n=Number(e?.statusCode??e?.status??200),r=e?.data,s.label=1;case 1:return s.trys.push([1,3,,4]),[4,r];case 2:return r=s.sent(),[3,4];case 3:return s.sent(),r=void 0,[3,4];case 4:if(n>=200&&n<300)return[2,r];throw i=r?.code||r?.error||`STORAGE_PG_REQUEST_FAIL`,o=r?.message||`Storage request failed with status ${n}: ${t}`,new a(o,n,i)}})})},e}(),_=function(){return _=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},_.apply(this,arguments)},v=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},y=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};function x(e){return r(e)?e:new n(e?.message||String(e))}function S(e){var t={};return e?.download!==void 0&&(t.download=!0===e.download?``:e.download),e?.cacheNonce!==void 0&&(t.cacheNonce=String(e.cacheNonce)),{headers:{},query:t}}var C=function(){function e(e){this.ctx=e}return e.prototype.then=function(e,t){return this.execute().then(e,t)},e.prototype.execute=function(){return v(this,void 0,Promise,function(){var e,t,n,r,i;return y(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),e=S(this.ctx.options),t=e.headers,n=e.query,[4,this.ctx.http.download({path:`/object/${this.ctx.bucketId}/${c(this.ctx.cleanName)}`,headers:_(_({},this.ctx.headers),t),query:n,signal:this.ctx.parameters?.signal,cache:this.ctx.parameters?.cache})];case 1:if(!(r=o.sent().response).body)throw new a(`Response body is empty`,r.status,`STORAGE_PG_EMPTY_BODY`);return[2,{data:r.body,error:null}];case 2:if(i=o.sent(),this.ctx.shouldThrowOnError)throw i;return[2,{data:null,error:x(i)}];case 3:return[2]}})})},e}(),w=function(){function e(e){this.ctx=e}return e.prototype.asStream=function(){return new C(this.ctx)},e.prototype.then=function(e,t){return this.execute().then(e,t)},e.prototype.execute=function(){return v(this,void 0,Promise,function(){var e,t,n,r,i,a;return y(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),e=S(this.ctx.options),t=e.headers,n=e.query,[4,this.ctx.http.download({path:`/object/${this.ctx.bucketId}/${c(this.ctx.cleanName)}`,headers:_(_({},this.ctx.headers),t),query:n,signal:this.ctx.parameters?.signal,cache:this.ctx.parameters?.cache})];case 1:return r=o.sent().response,a={},[4,r.blob()];case 2:return[2,(a.data=o.sent(),a.error=null,a)];case 3:if(i=o.sent(),this.ctx.shouldThrowOnError)throw i;return[2,{data:null,error:x(i)}];case 4:return[2]}})})},e}(),T=function(){return T=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},T.apply(this,arguments)},E=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},D=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},ee=`3600`,te=function(){function e(e,t,n){n===void 0&&(n=!1),this.headers={},this.http=e,this.bucketId=t,this.shouldThrowOnError=n}return e.prototype.throwOnError=function(){return this.shouldThrowOnError=!0,this},e.prototype.setHeader=function(e,t){var r;if(typeof e!=`string`||e.trim()===``)throw new n(`setHeader requires a non-empty header name`);if(/[\r\n]/.test(e)||typeof t==`string`&&/[\r\n]/.test(t))throw new n(`setHeader does not allow CR/LF characters in header name or value`);return this.headers=T(T({},this.headers),((r={})[e]=String(t),r)),this},e.prototype.upload=function(e,t,n){return E(this,void 0,Promise,function(){return D(this,function(r){return[2,this.uploadOrUpdate(`POST`,e,t,n)]})})},e.prototype.update=function(e,t,n){return E(this,void 0,Promise,function(){return D(this,function(r){return[2,this.uploadOrUpdate(`PUT`,e,t,n)]})})},e.prototype.download=function(e,t,n){return new w({http:this.http,bucketId:this.bucketId,cleanName:this.cleanPath(e),options:t,parameters:n,headers:this.headers,shouldThrowOnError:this.shouldThrowOnError})},e.prototype.list=function(e,t,n){return E(this,void 0,Promise,function(){var r=this;return D(this,function(i){return[2,h(function(){return E(r,void 0,void 0,function(){var r;return D(this,function(i){return r={prefix:e||``},t?.limit!==void 0&&(r.limit=t.limit),t?.cursor!==void 0&&(r.cursor=t.cursor),t?.withDelimiter!==void 0&&(r.with_delimiter=t.withDelimiter),t?.sortBy!==void 0&&(r.sortBy=t.sortBy),[2,this.send({method:`POST`,path:`/object/list/${this.bucketId}`,json:r,signal:n?.signal,cache:n?.cache})]})})},this.shouldThrowOnError)]})})},e.prototype.remove=function(e){return E(this,void 0,Promise,function(){var t=this;return D(this,function(n){return[2,h(function(){return E(t,void 0,void 0,function(){var t,n,r,i,a,o=this;return D(this,function(s){switch(s.label){case 0:t=e.map(function(e){return o.cleanPath(e)}),n=[],r=0,s.label=1;case 1:return r<t.length?(i=t.slice(r,r+100),[4,this.send({method:`DELETE`,path:`/object/${this.bucketId}`,json:{prefixes:i}})]):[3,4];case 2:a=s.sent(),Array.isArray(a)&&n.push.apply(n,a),s.label=3;case 3:return r+=100,[3,1];case 4:return[2,n]}})})},this.shouldThrowOnError)]})})},e.prototype.copy=function(e,t,n){return E(this,void 0,Promise,function(){var r=this;return D(this,function(i){return[2,h(function(){return E(r,void 0,void 0,function(){var r;return D(this,function(i){switch(i.label){case 0:return r=this.buildCopyMoveHeaders(n),[4,this.send({method:`POST`,path:`/object/copy`,json:{bucketId:this.bucketId,sourceKey:this.cleanPath(e),destinationKey:this.cleanPath(t),destinationBucket:n?.destinationBucket,copyMetadata:n?.copyMetadata,metadata:n?.metadata},headers:r})];case 1:return[2,{path:i.sent().Key}]}})})},this.shouldThrowOnError)]})})},e.prototype.move=function(e,t,n){return E(this,void 0,Promise,function(){var r=this;return D(this,function(i){return[2,h(function(){return E(r,void 0,void 0,function(){return D(this,function(r){switch(r.label){case 0:return[4,this.send({method:`POST`,path:`/object/move`,json:{bucketId:this.bucketId,sourceKey:this.cleanPath(e),destinationKey:this.cleanPath(t),destinationBucket:n?.destinationBucket}})];case 1:return[2,{message:r.sent().message||`Successfully moved`}]}})})},this.shouldThrowOnError)]})})},e.prototype.info=function(e){return E(this,void 0,Promise,function(){var t=this;return D(this,function(n){return[2,h(function(){return E(t,void 0,void 0,function(){var t,n;return D(this,function(r){switch(r.label){case 0:return t=this.cleanPath(e),[4,this.send({method:`GET`,path:`/object/info/${this.bucketId}/${this.encodePath(t)}`})];case 1:return[2,{id:(n=r.sent()).id,name:n.name,version:n.version,bucketId:n.bucket_id,size:n.size,contentType:n.content_type,cacheControl:n.cache_control,etag:n.etag,metadata:n.metadata,lastModified:n.last_modified,createdAt:n.created_at}]}})})},this.shouldThrowOnError)]})})},e.prototype.exists=function(e){return E(this,void 0,Promise,function(){var t,r,i;return D(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),t=this.cleanPath(e),[4,this.send({method:`GET`,path:`/object/info/${this.bucketId}/${this.encodePath(t)}`})];case 1:return a.sent(),[2,{data:!0,error:null}];case 2:if(r=a.sent(),(i=r?.status)!==void 0&&[400,404].includes(Number(i)))return[2,{data:!1,error:null}];if(this.shouldThrowOnError)throw r;return[2,{data:null,error:r instanceof n?r:new n(r?.message||String(r))}];case 3:return[2]}})})},e.prototype.createSignedUrl=function(e,t,n){return E(this,void 0,Promise,function(){var r=this;return D(this,function(i){return[2,h(function(){return E(r,void 0,void 0,function(){var r,i,a;return D(this,function(o){switch(o.label){case 0:return r=this.cleanPath(e),[4,this.send({method:`POST`,path:`/object/sign/${this.bucketId}/${this.encodePath(r)}`,json:{expiresIn:t}})];case 1:return i=o.sent(),a=i.fullSignedURL||this.http.toFullUrl(i.signedURL||``),[2,{fullSignedURL:this.appendUrlOptions(a,n)}]}})})},this.shouldThrowOnError)]})})},e.prototype.createSignedUrls=function(e,t,n){return E(this,void 0,Promise,function(){var r=this;return D(this,function(i){return[2,h(function(){return E(r,void 0,void 0,function(){var r,i,a,o,s=this;return D(this,function(c){switch(c.label){case 0:r=e.map(function(e){return s.cleanPath(e)}),i=[],a=0,c.label=1;case 1:return a<r.length?(o=r.slice(a,a+500),[4,this.send({method:`POST`,path:`/object/sign/${this.bucketId}`,json:{expiresIn:t,paths:o}})]):[3,4];case 2:c.sent().forEach(function(e){var t=e.fullSignedURL||(e.signedURL?s.http.toFullUrl(e.signedURL):null);i.push({path:e.path,fullSignedURL:t?s.appendUrlOptions(t,n):null,error:e.error??null})}),c.label=3;case 3:return a+=500,[3,1];case 4:return[2,i]}})})},this.shouldThrowOnError)]})})},e.prototype.createSignedUploadUrl=function(e,t){return E(this,void 0,Promise,function(){var n=this;return D(this,function(r){return[2,h(function(){return E(n,void 0,void 0,function(){var n,r,i;return D(this,function(a){switch(a.label){case 0:return n=this.cleanPath(e),r={},t!=null&&t.upsert&&(r[`x-upsert`]=`true`),[4,this.send({method:`POST`,path:`/object/upload/sign/${this.bucketId}/${this.encodePath(n)}`,headers:r})];case 1:return[2,{fullSignedURL:(i=a.sent()).fullURL||this.http.toFullUrl(i.url||``),path:n,token:i.token}]}})})},this.shouldThrowOnError)]})})},e.prototype.uploadToSignedUrl=function(e,t,n,r){return E(this,void 0,Promise,function(){var i=this;return D(this,function(a){return[2,h(function(){return E(i,void 0,void 0,function(){var i,a,o,s,c;return D(this,function(l){switch(l.label){case 0:return i=this.cleanPath(e),a=this.buildUploadBody(n,r),o=a.body,s=a.headers,[4,this.send({method:`PUT`,path:`/object/upload/sign/${this.bucketId}/${this.encodePath(i)}`,query:{token:t},rawBody:o,headers:s,withCredentials:!1})];case 1:return c=l.sent(),[2,{path:i,fullPath:c.Key}]}})})},this.shouldThrowOnError)]})})},e.prototype.getPublicUrl=function(e,t){var n=this.cleanPath(e),r=this.http.buildUrl(`/object/public/${this.bucketId}/${this.encodePath(n)}`);return{data:{publicUrl:this.appendUrlOptions(r,t)}}},e.prototype.send=function(e){return this.http.send(T(T({},e),{headers:T(T({},this.headers),e.headers||{})}))},e.prototype.uploadOrUpdate=function(e,t,n,r){return E(this,void 0,Promise,function(){var i=this;return D(this,function(a){return[2,h(function(){return E(i,void 0,void 0,function(){var i,a,o,s,c;return D(this,function(l){switch(l.label){case 0:return i=this.cleanPath(t),a=this.buildUploadBody(n,r),o=a.body,s=a.headers,e===`POST`&&(s[`x-upsert`]=String(!!r?.upsert)),[4,this.send({method:e,path:`/object/${this.bucketId}/${this.encodePath(i)}`,rawBody:o,headers:s})];case 1:return[2,{id:(c=l.sent()).Id,path:i,fullPath:c.Key}]}})})},this.shouldThrowOnError)]})})},e.prototype.cleanPath=function(e){var t=e.replace(/^\/+|\/+$/g,``).replace(/\/+/g,`/`);if(t.split(`/`).some(function(e){return e===`..`}))throw new n(`invalid path: ".." segment is not allowed`);return t},e.prototype.encodePath=function(e){return c(e)},e.prototype.buildUploadBody=function(e,t){var n=T({},t?.headers||{}),r=e,i=typeof FormData<`u`&&e instanceof FormData;if(typeof Blob<`u`&&e instanceof Blob||i){var a=void 0,o={};if(i){var s=this.extractFromFormData(e);a=s.file,o=s.fields}else a=e;var c=t?.cacheControl??o.cacheControl??ee,l=t?.contentType??o.contentType,u=t?.metadata===void 0?o.metadata:JSON.stringify(t.metadata),d=new FormData;c!==void 0&&d.append(`cacheControl`,String(c)),l!==void 0&&d.append(`contentType`,l),u!==void 0&&d.append(`metadata`,u),d.append(``,a),r=d}else r=e,c=t?.cacheControl??ee,l=t?.contentType??`text/plain;charset=UTF-8`,n[`cache-control`]=`max-age=${c}`,l&&(n[`content-type`]=l),t!=null&&t.metadata&&(n[`x-metadata`]=this.toBase64(JSON.stringify(t.metadata)));return{body:r,headers:n}},e.prototype.extractFromFormData=function(e){var t,r={},i=0,a=[];if(e.forEach(function(e,n){if(typeof Blob<`u`&&e instanceof Blob)return t=e,void(i+=1);n!==`cacheControl`&&n!==`contentType`&&n!==`metadata`?a.push(n):r[n]=String(e)}),a.length>0&&console.warn(`Ignored unsupported FormData field(s): [${a.join(`, `)}]. Only file, cacheControl, contentType and metadata are supported`),i===0||!t)throw new n(`FormData must contain a file`);if(i>1)throw new n(`FormData must contain exactly one file`);return{file:t,fields:r}},e.prototype.buildCopyMoveHeaders=function(e){var t={};return e!=null&&e.upsert&&(t[`x-upsert`]=`true`),!1===e?.copyMetadata&&e!=null&&e.metadata&&(t[`x-metadata`]=this.toBase64(JSON.stringify(e.metadata))),t},e.prototype.appendUrlOptions=function(e,t){var n=[];if(t?.download!==void 0){var r=!0===t.download?``:String(t.download);n.push(`download=${encodeURIComponent(r)}`)}return t?.cacheNonce!==void 0&&n.push(`cacheNonce=${encodeURIComponent(String(t.cacheNonce))}`),n.length===0?e:`${e}${e.includes(`?`)?`&`:`?`}${n.join(`&`)}`},e.prototype.toBase64=function(e){return s(e)},e}(),O=/[\x00-\x20\x7f/\\?#%]/;function k(e,t){if(typeof e!=`string`||e.length===0)throw new n(`[storage.${t}] bucketId is required`);if(e.length>256)throw new n(`[storage.${t}] invalid bucketId: length must be 1-256`);var r=O.exec(e);if(r)throw new n(`[storage.${t}] invalid bucketId "${e}": contains forbidden character ${JSON.stringify(r[0])}; must not contain whitespace, control chars, "/", "\\", "?", "#" or "%"`)}var A=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},ne=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},re=function(){function e(e,t){t===void 0&&(t=!1),this.http=new g(e),this.shouldThrowOnError=t}return e.prototype.throwOnError=function(){return this.shouldThrowOnError=!0,this},e.prototype.listBuckets=function(e){return A(this,void 0,Promise,function(){var t=this;return ne(this,function(n){return[2,h(function(){var n={};return e?.limit!==void 0&&(n.limit=e.limit),e?.offset!==void 0&&(n.offset=e.offset),e!=null&&e.sortColumn&&(n.sortColumn=e.sortColumn),e!=null&&e.sortOrder&&(n.sortOrder=e.sortOrder),e!=null&&e.search&&(n.search=e.search),t.http.send({method:`GET`,path:`/bucket/`,query:n})},this.shouldThrowOnError)]})})},e.prototype.getBucket=function(e){return A(this,void 0,Promise,function(){var t=this;return ne(this,function(n){return[2,h(function(){return k(e,`getBucket`),t.http.send({method:`GET`,path:`/bucket/${e}`})},this.shouldThrowOnError)]})})},e.prototype.createBucket=function(e,t){return A(this,void 0,Promise,function(){var n=this;return ne(this,function(r){return[2,h(function(){var r;return k(e,`createBucket`),n.http.send({method:`POST`,path:`/bucket/`,json:{id:e,name:e,public:(r=t?.public)!=null&&r,type:t?.type,file_size_limit:t?.fileSizeLimit,allowed_mime_types:t?.allowedMimeTypes}})},this.shouldThrowOnError)]})})},e.prototype.updateBucket=function(e,t){return A(this,void 0,Promise,function(){var n=this;return ne(this,function(r){return[2,h(function(){return k(e,`updateBucket`),n.http.send({method:`PUT`,path:`/bucket/${e}`,json:{public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes}})},this.shouldThrowOnError)]})})},e.prototype.deleteBucket=function(e){return A(this,void 0,Promise,function(){var t=this;return ne(this,function(n){return[2,h(function(){return k(e,`deleteBucket`),t.http.send({method:`DELETE`,path:`/bucket/${e}`})},this.shouldThrowOnError)]})})},e}();function ie(){return`@cloudbase/js-sdk`}var ae={INVALID_PARAMS:`INVALID_PARAMS`,INVALID_SYNTAX:`INVALID_SYNTAX`,INVALID_OPERATION:`INVALID_OPERATION`,OPERATION_FAIL:`OPERATION_FAIL`,NETWORK_ERROR:`NETWORK_ERROR`,UNKOWN_ERROR:`UNKOWN_ERROR`};let oe=(se={AbstractSDKRequest:()=>f,AbstractStorage:()=>p},ce={},po.d(ce,se),ce);var se,ce,le=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),ue=function(){return ue=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ue.apply(this,arguments)};function de(e){return typeof e==`string`}function fe(e,t){console.warn(`[@cloudbase/js-sdk][${e}]:${t}`)}var pe=function(e){function t(t){var n=e.call(this,t.msg||t.message||``)||this;return n.code=t.code||``,n.requestId=t.requestId||``,Object.defineProperty(n,"message",{value:t.msg||t.message||``,enumerable:!0,writable:!0,configurable:!0}),n}return le(t,e),t}(Error),me=function(e){return new pe(e)};function he(e,t){return(t||me)(e)}function ge(e){if(e&&typeof e==`object`&&e.data&&typeof e.data==`object`){var t=e.data,n=t.code,r=t.message;if(!e.code&&n||!e.message&&r)return ue(ue(ue({},e),!e.code&&n?{code:n}:{}),!e.message&&r?{message:r}:{})}return e}var _e,ve=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),j=function(){return j=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},j.apply(this,arguments)},ye=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},be=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};(function(e){function t(t){var n=e.call(this)||this,r=t.timeout,i=t.timeoutMsg,a=t.restrictedMethods;return n.timeout=r||0,n.timeoutMsg=i||`请求超时`,n.restrictedMethods=a||[`get`,`post`,`upload`,`download`],n}ve(t,e),t.prototype.get=function(e){return this.request(j(j({},e),{method:`get`}),this.restrictedMethods.includes(`get`))},t.prototype.post=function(e){return this.request(j(j({},e),{method:`post`}),this.restrictedMethods.includes(`post`))},t.prototype.put=function(e){return this.request(j(j({},e),{method:`put`}))},t.prototype.upload=function(e){var t=e.data,n=e.file,r=e.name,i=e.method,a=e.headers,o=a===void 0?{}:a,s={post:`post`,put:`put`}[i?.toLowerCase()]||`put`,c=new FormData;return s===`post`?(Object.keys(t).forEach(function(e){c.append(e,t[e])}),c.append(`key`,r),c.append(`file`,n),this.request(j(j({},e),{data:c,method:s}),this.restrictedMethods.includes(`upload`))):this.request(j(j({},e),{method:`put`,headers:o,body:n}),this.restrictedMethods.includes(`upload`))},t.prototype.download=function(e){return ye(this,void 0,Promise,function(){var t,n,r,i;return be(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.get(j(j({},e),{headers:{},responseType:`blob`}))];case 1:return t=a.sent().data,n=window.URL.createObjectURL(new Blob([t])),r=decodeURIComponent(new URL(e.url).pathname.split(`/`).pop()||``),(i=document.createElement(`a`)).href=n,i.setAttribute(`download`,r),i.style.display=`none`,document.body.appendChild(i),i.click(),window.URL.revokeObjectURL(n),document.body.removeChild(i),[3,3];case 2:return a.sent(),[3,3];case 3:return[2,new Promise(function(t){t({statusCode:200,tempFilePath:e.url})})]}})})},t.prototype.fetch=function(e){return ye(this,void 0,Promise,function(){var t,n,r,i,a,o,s,c,l,u,d,f,p,m=this;return be(this,function(h){switch(h.label){case 0:return t=new AbortController,n=e.url,r=e.enableAbort,i=r!==void 0&&r,a=e.stream,o=a!==void 0&&a,s=e.signal,c=e.timeout,l=e.shouldThrowOnError,u=l===void 0||l,d=c??this.timeout,s&&(s.aborted&&t.abort(),s.addEventListener(`abort`,function(){return t.abort()})),f=null,i&&d&&(f=setTimeout(function(){console.warn(m.timeoutMsg),t.abort(Error(m.timeoutMsg))},d)),[4,fetch(n,j(j({},e),{signal:t.signal})).then(function(e){return ye(m,void 0,void 0,function(){var t,n,r;return be(this,function(i){switch(i.label){case 0:return clearTimeout(f),u?e.ok?(t=e,[3,3]):[3,1]:[3,4];case 1:return r=(n=Promise).reject,[4,e.json()];case 2:t=r.apply(n,[i.sent()]),i.label=3;case 3:return[2,t];case 4:return[2,e]}})})}).catch(function(e){return clearTimeout(f),Promise.reject(e)})];case 1:return p=h.sent(),[2,{data:o?p.body:p.headers.get(`content-type`)?.includes(`application/json`)?p.json():p.text(),statusCode:p.status,header:p.headers,response:p}]}})})},t.prototype.request=function(e,t){var n=this;t===void 0&&(t=!1);var r=String(e.method).toLowerCase()||`get`;return new Promise(function(i){var a=e.url,o=e.headers,s=o===void 0?{}:o,c=e.data,l=e.responseType,u=e.withCredentials,d=e.body,f=e.onUploadProgress,p=function(e,t,n){n===void 0&&(n={});var r=/\?/.test(t),i=``;return Object.keys(n).forEach(function(e){i===``?!r&&(t+=`?`):i+=`&`,i+=`${e}=${encodeURIComponent(n[e])}`}),/^http(s)?:\/\//.test(t+=i)?t:`${e}${t}`}(`https:`,a,r===`get`?c:{}),m=new XMLHttpRequest;m.open(r,p),l&&(m.responseType=l);var h,g,_,v=e.signal;v&&(v.aborted?m.abort():v.addEventListener(`abort`,function(){return m.abort()},{once:!0})),Object.keys(s).forEach(function(e){m.setRequestHeader(e,s[e])}),f&&m.upload.addEventListener(`progress`,f),m.onreadystatechange=function(){var e={};if(m.readyState===4){var t=m.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};t.forEach(function(e){var t=e.split(`: `),r=t.shift().toLowerCase();n[r]=t.join(`: `)}),e.header=n,e.statusCode=m.status;try{e.data=l===`blob`?m.response:JSON.parse(m.responseText)}catch{e.data=l===`blob`?m.response:m.responseText}clearTimeout(h),i(e)}},t&&n.timeout&&(h=setTimeout(function(){console.warn(n.timeoutMsg),m.abort()},n.timeout)),_=c,g=Object.prototype.toString.call(_)===`[object FormData]`?c:s[`content-type`]===`application/x-www-form-urlencoded`?function(e){e===void 0&&(e={});var t=[];return Object.keys(e).forEach(function(n){t.push(`${n}=${encodeURIComponent(e[n])}`)}),t.join(`&`)}(c):d||(c?JSON.stringify(c):void 0),u&&(m.withCredentials=!0),m.send(g)})}})(oe.AbstractSDKRequest),function(e){e.WEB=`web`,e.WX_MP=`wx_mp`}(_e||={});var xe=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Se=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},Ce=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},we=function(e){function t(t){var n=e.call(this)||this;return n.root=t,t.tcbCacheObject||={},n}return xe(t,e),t.prototype.setItem=function(e,t){this.root.tcbCacheObject[e]=t},t.prototype.getItem=function(e){return this.root.tcbCacheObject[e]},t.prototype.removeItem=function(e){delete this.root.tcbCacheObject[e]},t.prototype.clear=function(){delete this.root.tcbCacheObject},t}(oe.AbstractStorage);(function(){function e(e){this.keys={};var t=e.persistence,n=e.platformInfo,r=n===void 0?{}:n,i=e.keys,a=i===void 0?{}:i;this.platformInfo=r,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||t,this.storage=function(e,t){switch(e){case`local`:default:return t.localStorage?t.localStorage:(fe(ae.INVALID_PARAMS,`localStorage is not supported on current platform`),new we(t.root));case`none`:return new we(t.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=a)}Object.defineProperty(e.prototype,"mode",{get:function(){return this.storage.mode||`sync`},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),e.prototype.setStore=function(e,t,n){if(this.mode!==`async`){if(this.storage)try{var r={version:n||`localCachev1`,content:t};this.storage.setItem(e,JSON.stringify(r))}catch(e){throw Error(JSON.stringify({code:ae.OPERATION_FAIL,msg:`[@cloudbase/js-sdk][${ae.OPERATION_FAIL}]setStore failed`,info:e}))}}else fe(ae.INVALID_OPERATION,`current platform's storage is asynchronous, please use setStoreAsync insteed`)},e.prototype.setStoreAsync=function(e,t,n){return Se(this,void 0,void 0,function(){var r;return Ce(this,function(i){switch(i.label){case 0:if(!this.storage)return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),r={version:n||`localCachev1`,content:t},[4,this.storage.setItem(e,JSON.stringify(r))];case 2:return i.sent(),[3,4];case 3:return i.sent(),[2];case 4:return[2]}})})},e.prototype.getStore=function(e,t){if(this.mode!==`async`){try{if(typeof process<`u`&&{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token)return{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token;if(!this.storage)return``}catch{return``}t||=`localCachev1`;var n=this.storage.getItem(e);return n&&n.indexOf(t)>=0?JSON.parse(n).content:``}fe(ae.INVALID_OPERATION,`current platform's storage is asynchronous, please use getStoreAsync insteed`)},e.prototype.getStoreAsync=function(e,t){return Se(this,void 0,void 0,function(){var n;return Ce(this,function(r){switch(r.label){case 0:try{if(typeof process<`u`&&{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token)return[2,{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token];if(!this.storage)return[2,``]}catch{return[2,``]}return t||=`localCachev1`,[4,this.storage.getItem(e)];case 1:return(n=r.sent())&&n.indexOf(t)>=0?[2,JSON.parse(n).content]:[2,``]}})})},e.prototype.removeStore=function(e){this.mode===`async`?fe(ae.INVALID_OPERATION,`current platform's storage is asynchronous, please use removeStoreAsync insteed`):this.storage.removeItem(e)},e.prototype.removeStoreAsync=function(e){return Se(this,void 0,void 0,function(){return Ce(this,function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}})})}})();var Te=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),M=function(e,t){this.data=t||null,this.name=e},Ee=function(e){function t(t,n){var r=e.call(this,`error`,{error:t,data:n})||this;return r.error=t,r}return Te(t,e),t}(M),N=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){return function(e,t,n){n[e]=n[e]||[],n[e].push(t)}(e,t,this.listeners),this},e.prototype.off=function(e,t){return function(e,t,n){if(n?.[e]){var r=n[e].indexOf(t);r!==-1&&n[e].splice(r,1)}}(e,t,this.listeners),this},e.prototype.fire=function(e,t){if(e instanceof Ee)return console.error(e.error),this;var n=de(e)?new M(e,t||{}):e,r=n.name;if(this.listens(r)){n.target=this;for(var i=0,a=this.listeners[r]?function(e,t,n){if(n||arguments.length===2)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||=Array.prototype.slice.call(t,0,i),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([],this.listeners[r],!0):[];i<a.length;i++)a[i].call(this,n)}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}();new N,new N,typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.indexOf(`Firefox`),(e=>{var t={};return po.d(t,e),t})({default:()=>b}).default;var P,De=po(388),Oe=function(){return Oe=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Oe.apply(this,arguments)},ke=function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},Ae=function(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)},je=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},Me=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};(function(e){e.put=`put`,e.post=`post`})(P||={});var Ne=ie,Pe=ae,Fe=`https://support.qq.com/products/148793`,Ie=function(e){return Object.prototype.toString.call(e)===`[object Array]`},Le=de,Re=function(e){return Object.prototype.toString.call(e)===`[object Object]`},ze=function(e,t,n){if(n===void 0&&(n=null),e&&typeof e==`function`)return e(t,n);if(t)throw t;return n},Be=function(e,t){if(function(e){return!e||typeof e.throw!=`boolean`||e.throw}(e))throw he(ue(ue({},t),{msg:t.message}),e?.errorFactory);return ue({code:t.code,message:t.message},t.requestId?{requestId:t.requestId}:{})},Ve=fe,He=function(e){return e.mode,e.customInfo,e.title,e.messages,function(e,t,n){}},Ue=`storage`;function We(e,t){return t&&typeof t!=`function`?[Oe(Oe({},e),{customReqOpts:t}),void 0]:[e,t]}var Ge=function(e,t,n){return je(void 0,void 0,void 0,function(){var r,i;return Me(this,function(a){switch(a.label){case 0:return[4,e.gateWay({path:`storages`,name:`get-objects-upload-info`,data:[Oe({objectId:t.path},t.signedHeader?{signedHeader:t.signedHeader}:{})]},n)];case 1:return r=ge(r=a.sent()),i=r.data?.[0]||{},[2,Oe(Oe({},r),{data:Oe(Oe({},i.code?Oe({},i):{}),{authorization:i.authorization,token:i.token,url:i.uploadUrl,fileId:i.cloudObjectId,cosFileId:i.cloudObjectMeta,download_url:i.downloadUrl})})]}})})},Ke=function(e,t,n){return je(void 0,void 0,void 0,function(){var r;return Me(this,function(i){switch(i.label){case 0:return[4,e.gateWay({path:`storages`,name:`get-objects-download-info`,data:t.convertedFileList.map(function(e){return{cloudObjectId:e.fileid}})},n)];case 1:return r=ge(r=i.sent()),[2,Oe(Oe({},r),{data:{download_list:Array.isArray(r.data)?r.data.map(function(e){return{code:e.code||`SUCCESS`,message:e.message,fileid:e.cloudObjectId,download_url:e.downloadUrl,fileID:e.cloudObjectId,tempFileURL:e.downloadUrl,mime_type:e.contentType||F(null,e.cloudObjectId||``)}}):[]}})]}})})},qe=function(e,t,n){return je(void 0,void 0,void 0,function(){var r;return Me(this,function(i){switch(i.label){case 0:return[4,e.gateWay({path:`storages`,name:`delete-objects`,data:t.fileList.map(function(e){return{cloudObjectId:e}})},n)];case 1:return r=ge(r=i.sent()),[2,Oe(Oe({},r),{data:{delete_list:Array.isArray(r.data)?r.data.map(function(e){return{code:e.code||`SUCCESS`,fileID:e.cloudObjectId,message:e.message}}):[]}})]}})})},Je=function(e,t,n){return je(void 0,void 0,void 0,function(){var r;return Me(this,function(i){switch(i.label){case 0:return[4,e.gateWay({path:`storages`,name:`copy-objects`,data:t.convertedFileList.map(function(e){return{srcPath:e.src_path,dstPath:e.dst_path,overwrite:e.overwrite,removeOriginal:e.remove_original}})},n)];case 1:return r=ge(r=i.sent()),[2,Oe(Oe({},r),{data:{copy_list:Array.isArray(r.data)?r.data.map(function(e){return{code:e.code||`SUCCESS`,fileID:e.cloudObjectId,fileId:e.cloudObjectId,message:e.message}}):[]}})]}})})},Ye={txt:`text/plain`,json:`application/json`,html:`text/html`,htm:`text/html`,css:`text/css`,js:`application/javascript`,csv:`text/csv`,xml:`application/xml`,png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,svg:`image/svg+xml`,ico:`image/x-icon`,pdf:`application/pdf`,zip:`application/zip`,gz:`application/gzip`,mp4:`video/mp4`,webm:`video/webm`,mp3:`audio/mpeg`,wav:`audio/wav`};function F(e,t){if(typeof Blob<`u`&&e instanceof Blob&&e.type)return e.type;var n=/\.([a-zA-Z0-9]+)$/.exec(t||``);return Ye[n?n[1].toLowerCase():``]||`application/octet-stream`}function Xe(e,t){var n=t.toLowerCase();return Object.keys(e).some(function(e){return e.toLowerCase()===n})}function Ze(e){return Object.keys(e).reduce(function(t,n){var r;return Oe(Oe({},t),((r={})[n]=[e[n]],r))},{})}var Qe=function(){function e(e){this.context=e}var t,n,r,i,a,s,c,l,u,d,f,p,m,h,g,_;return Object.defineProperty(e.prototype,"config",{get:function(){return this.context?.config},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"request",{get:function(){return this.context?.request},enumerable:!1,configurable:!0}),e.prototype.isGateWay=function(){return(this.config.endPointMode||`CLOUD_API`)===`GATEWAY`},e.prototype.uploadFile=function(e,t){return je(this,void 0,Promise,function(){var n,r,i,a,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,ee,te,O,k,A,ne,re;return Me(this,function(ie){switch(ie.label){case 0:return k=We(e,t),e=k[0],t=k[1],n=e.cloudPath,r=e.filePath,i=e.onUploadProgress,A=e.method,a=A===void 0?`put`:A,ne=e.headers,s=ne===void 0?{}:ne,c=e.fileContent,Le(n)&&(r||c)?(l={put:P.put,post:P.post}[a.toLocaleLowerCase()]||P.put,u=this.isGateWay(),d=Oe({},s),f=Object.keys(s).reduce(function(e,t){return t.toLowerCase()!==`content-length`&&(e[t]=s[t]),e},{}),l===P.put&&u&&(Xe(d,`content-length`)||typeof(p=function(e,t){var n=e??t;if(n!==null){if(typeof Blob<`u`&&n instanceof Blob)return n.size;if(typeof ArrayBuffer<`u`&&(n instanceof ArrayBuffer||typeof ArrayBuffer.isView==`function`&&ArrayBuffer.isView(n)))return n.byteLength;if(typeof n==`string`){if(typeof Blob<`u`)return new Blob([n]).size;var r=(i=n,(a=o())?.byteLength(i));return typeof r==`number`?r:n.length}var i,a;return typeof n==`object`&&typeof n.size==`number`?n.size:void 0}}(r,c))==`number`&&(d[`content-length`]=String(p)),Xe(d,`content-type`)||(d[`content-type`]=F(r,n)),Xe(f,`content-type`)||(f[`content-type`]=F(r,n))),[4,this.getUploadMetadata({cloudPath:n,method:l,headers:l!==P.put||u?void 0:f,signedHeader:l===P.put&&u?Ze(d):void 0,customReqOpts:e.customReqOpts})]):[2,Be(this.config,{code:Pe.INVALID_PARAMS,message:`[${Ue}.uploadFile] invalid params`})];case 1:return m=ie.sent(),h=m.data,g=m.requestId,(_=h)?.code||!_?.url?(v=_?.code||Pe.OPERATION_FAIL,y=_?.message||`get upload info failed`,[2,ze(t,Error(`[${Ne()}][${v}][${Ue}]:${y}`))]):(b=h.url,x=h.authorization,S=h.token,C=h.fileId,w=h.cosFileId,T=h.download_url,D=Oe(Oe({},E={url:b,file:r,name:n,onUploadProgress:i,fileContent:c,fileId:C,requestId:g}),{method:P.put,headers:Oe(Oe({},f),{authorization:x,"x-cos-meta-fileid":w,"x-cos-security-token":S})}),ee=Oe(Oe({},E),{method:P.post,data:{key:n,signature:x,"x-cos-meta-fileid":w,success_action_status:`201`,"x-cos-security-token":S}}),(re={})[P.put]={params:D,isSuccess:function(e){return e>=200&&e<300}},re[P.post]={params:ee,isSuccess:function(e){return e===201}},te=re,[4,this.request.upload(te[l].params)]);case 2:return O=ie.sent(),te[l].isSuccess(O.statusCode)?[2,ze(t,null,{fileID:C,download_url:T,requestId:g})]:[2,ze(t,Error(`[${Ne()}][${Pe.OPERATION_FAIL}][${Ue}]:${O.data}`))]}})})},e.prototype.getUploadMetadata=function(e,t){return je(this,void 0,Promise,function(){var n,r,i,a,o,s,c,l,u,d;return Me(this,function(f){switch(f.label){case 0:if(n=e.cloudPath,r=e.method,i=e.headers,a=e.signedHeader,!Le(n))return[2,Be(this.config,{code:Pe.INVALID_PARAMS,message:`[${Ue}.getUploadMetadata] invalid cloudPath`})];o=this.request,s=`storage.getUploadMetadata`,f.label=1;case 1:return f.trys.push([1,6,,7]),c=void 0,l={path:n},u=this.isGateWay(),r&&(l.method=r),r===P.put&&(u&&a?l.signedHeader=a:!u&&i&&(l.headers=i)),r!==P.post&&u?[3,3]:[4,o.send(s,l,{endPointMode:`CLOUD_API`},e.customReqOpts)];case 2:return c=f.sent(),[3,5];case 3:return[4,Ge(o,l,e.customReqOpts)];case 4:c=f.sent(),f.label=5;case 5:return[2,ze(t,null,c)];case 6:return d=f.sent(),[2,ze(t,d)];case 7:return[2]}})})},e.prototype.deleteFile=function(e,t){return je(this,void 0,Promise,function(){var n,r,i,a,o,s,c,l,u;return Me(this,function(d){switch(d.label){case 0:if(u=We(e,t),e=u[0],t=u[1],!(n=e.fileList)||!Ie(n)||n.length===0)return[2,Be(this.config,{code:Pe.INVALID_PARAMS,message:`[${Ue}.deleteFile] fileList must not be empty`})];for(r=0,i=n;r<i.length;r++)if(!(a=i[r])||!Le(a))return[2,Be(this.config,{code:Pe.INVALID_PARAMS,message:`[${Ue}.deleteFile] fileID must be string`})];return o=`storage.batchDeleteFile`,s=this.request,c={},this.isGateWay()?[4,qe(s,{fileList:n},e.customReqOpts)]:[3,2];case 1:return c=d.sent(),[3,4];case 2:return[4,s.send(o,{fileid_list:n},e.customReqOpts)];case 3:c=d.sent(),d.label=4;case 4:return c.code?[2,ze(t,null,c)]:(l={fileList:c.data.delete_list,requestId:c.requestId},[2,ze(t,null,l)])}})})},e.prototype.getTempFileURL=function(e,t){return je(this,void 0,Promise,function(){var n,r,i,a,o,s,c,l,u,d;return Me(this,function(f){switch(f.label){case 0:if(d=We(e,t),e=d[0],t=d[1],!(n=e.fileList)||!Ie(n)||n.length===0)return[2,Be(this.config,{code:Pe.INVALID_PARAMS,message:`[${Ue}.getTempFileURL] fileList must not be empty`})];for(r=[],i=!1,a=0,o=n;a<o.length;a++)if(s=o[a],Re(s)){if(!Object.prototype.hasOwnProperty.call(s,`fileID`))return[2,Be(this.config,{code:Pe.INVALID_PARAMS,message:`[${Ue}.getTempFileURL] file info must include fileID`})];!i&&Object.prototype.hasOwnProperty.call(s,`maxAge`)&&(Ve(Pe.INVALID_PARAMS,`[${Ue}.getTempFileURL] maxAge 仅为兼容字段,传统模式不会用它生成下载链接,TTL 传入无效。需要可控过期请改用 app.storage.from(bucketId).createSignedUrl(path, expiresIn)(PG 模式下可用)。`),i=!0),r.push({fileid:s.fileID,max_age:s.maxAge||7200})}else{if(!Le(s))return[2,Be(this.config,{code:Pe.INVALID_PARAMS,message:`[${Ue}.getTempFileURL] invalid fileList`})];r.push({fileid:s})}return c=`storage.batchGetDownloadUrl`,l=this.request,u={},this.isGateWay()?[4,Ke(l,{convertedFileList:r},e.customReqOpts)]:[3,2];case 1:return u=f.sent(),[3,4];case 2:return[4,l.send(c,{file_list:r},e.customReqOpts)];case 3:u=f.sent(),f.label=4;case 4:return u.code?[2,ze(t,null,u)]:[2,ze(t,null,{fileList:Array.isArray(u.data?.download_list)?u.data.download_list:[],requestId:u.requestId})]}})})},e.prototype.downloadFile=function(e,t){return je(this,void 0,Promise,function(){var n,r,i,a,o,s,c;return Me(this,function(l){switch(l.label){case 0:return c=We(e,t),e=c[0],t=c[1],n=e.fileID,Le(n)?[4,this.getTempFileURL.call(this,{fileList:[n],customReqOpts:e.customReqOpts})]:[2,Be(this.config,{code:Pe.INVALID_PARAMS,message:`[${Ue}.getTempFileURL] fileID must be string`})];case 1:return r=l.sent(),(i=r.fileList[0]).code===`SUCCESS`?(a=this.request,o=encodeURI(i.download_url),[4,a.download({url:o,tempFilePath:e.tempFilePath})]):[2,ze(t,i)];case 2:return s=l.sent(),[2,ze(t,null,s)]}})})},e.prototype.copyFile=function(e,t){return je(this,void 0,Promise,function(){var n,r,i,a,o,s,c,l,u,d;return Me(this,function(f){switch(f.label){case 0:if(d=We(e,t),e=d[0],t=d[1],!(n=e.fileList)||!Ie(n)||n.length===0)return[2,Be(this.config,{code:Pe.INVALID_PARAMS,message:`[${Ue}.copyFile] fileList must not be empty`})];for(r=[],i=0,a=n;i<a.length;i++){if(o=a[i],s=o.srcPath,c=o.dstPath,!s||!c||typeof s!=`string`||typeof c!=`string`)return[2,Be(this.config,{code:Pe.INVALID_PARAMS,message:`[${Ue}.copyFile] srcPath and dstPath may not be empty`})];if(s===c)return[2,Be(this.config,{code:Pe.INVALID_PARAMS,message:`[${Ue}.copyFile] srcPath and dstPath can not be the same`})];r.push({src_path:s,dst_path:c,overwrite:o.overwrite,remove_original:o.removeOriginal})}return l=this.request,u={},this.isGateWay()?[4,Je(l,{convertedFileList:r},e.customReqOpts)]:[3,2];case 1:return u=f.sent(),[3,4];case 2:return[4,l.send(`storage.batchCopyFile`,{file_list:r},e.customReqOpts)];case 3:u=f.sent(),f.label=4;case 4:return u.code?[2,ze(t,null,u)]:[2,ze(t,null,{fileList:u.data.copy_list,requestId:u.requestId})]}})})},e.prototype.getFileInfo=function(e){return je(this,void 0,Promise,function(){var t,n=this;return Me(this,function(r){switch(r.label){case 0:return[4,this.getTempFileURL(e)];case 1:return(t=r.sent())?.fileList&&t?.fileList?.length>0?[4,Promise.all(t.fileList.map(function(e){return je(n,void 0,void 0,function(){var t,n,r,i,a,o,s;return Me(this,function(c){switch(c.label){case 0:if(e.code!==`SUCCESS`)return[2,{code:e.code,fileID:e.fileID,tempFileURL:e.tempFileURL,message:e.message}];c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this.request.fetch({url:e.tempFileURL,method:`HEAD`})];case 2:return t=c.sent(),n=t.header,typeof Headers<`u`&&n instanceof Headers&&(r={},n.forEach(function(e,t){r[t]=e}),n=r),i=parseInt(n[`content-length`])||0,a=n[`content-type`]||``,[400,404].includes(Number(t.statusCode))?[2,{code:`FILE_NOT_FOUND`,fileID:e.fileID,tempFileURL:e.tempFileURL,message:`file not found`}]:[2,{code:e.code,fileID:e.fileID,tempFileURL:e.tempFileURL,cloudId:e.fileID,fileName:e.fileID.split(`/`).pop(),contentType:a,mime:a.split(`;`)[0].trim(),size:i,etag:n.etag||``,lastModified:n[`last-modified`]||``,cacheControl:n[`cache-control`]||``}];case 3:return o=c.sent(),s=typeof o==`object`&&o&&`message`in o?String(o.message):void 0,[2,{code:`FETCH_FILE_INFO_ERROR`,fileID:e.fileID,tempFileURL:e.tempFileURL,message:s}];case 4:return[2]}})})}))]:[3,3];case 2:return[2,{fileList:r.sent(),requestId:t.requestId}];case 3:return[2,{fileList:[],requestId:t.requestId}]}})})},ke([He({customInfo:{className:`Cloudbase`,methodName:`uploadFile`},title:`上传文件失败`,messages:[`请确认以下各项:`,` 1 - 调用 uploadFile() 的语法或参数是否正确`,` 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety`,` 3 - 云存储安全规则是否限制了当前登录状态访问`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${Fe}`]}),Ae(`design:type`,Function),Ae(`design:paramtypes`,[Object,typeof(t=typeof Function<`u`&&Function)==`function`?t:Object]),Ae(`design:returntype`,typeof(n=typeof Promise<`u`&&Promise)==`function`?n:Object)],e.prototype,`uploadFile`,null),ke([He({customInfo:{className:`Cloudbase`,methodName:`getUploadMetadata`},title:`获取上传元信息失败`,messages:[`请确认以下各项:`,` 1 - 调用 getUploadMetadata() 的语法或参数是否正确`,` 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety`,` 3 - 云存储安全规则是否限制了当前登录状态访问`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${Fe}`]}),Ae(`design:type`,Function),Ae(`design:paramtypes`,[Object,typeof(r=typeof Function<`u`&&Function)==`function`?r:Object]),Ae(`design:returntype`,typeof(i=typeof Promise<`u`&&Promise)==`function`?i:Object)],e.prototype,`getUploadMetadata`,null),ke([He({customInfo:{className:`Cloudbase`,methodName:`deleteFile`},title:`删除文件失败`,messages:[`请确认以下各项:`,` 1 - 调用 deleteFile() 的语法或参数是否正确`,` 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety`,` 3 - 云存储安全规则是否限制了当前登录状态访问`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${Fe}`]}),Ae(`design:type`,Function),Ae(`design:paramtypes`,[typeof(a=De.ICloudbaseDeleteFileParams!==void 0&&De.ICloudbaseDeleteFileParams)==`function`?a:Object,typeof(s=typeof Function<`u`&&Function)==`function`?s:Object]),Ae(`design:returntype`,typeof(c=typeof Promise<`u`&&Promise)==`function`?c:Object)],e.prototype,`deleteFile`,null),ke([He({customInfo:{className:`Cloudbase`,methodName:`getTempFileURL`},title:`获取文件下载链接`,messages:[`请确认以下各项:`,` 1 - 调用 getTempFileURL() 的语法或参数是否正确`,` 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety`,` 3 - 云存储安全规则是否限制了当前登录状态访问`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${Fe}`]}),Ae(`design:type`,Function),Ae(`design:paramtypes`,[typeof(l=De.ICloudbaseGetTempFileURLParams!==void 0&&De.ICloudbaseGetTempFileURLParams)==`function`?l:Object,typeof(u=typeof Function<`u`&&Function)==`function`?u:Object]),Ae(`design:returntype`,typeof(d=typeof Promise<`u`&&Promise)==`function`?d:Object)],e.prototype,`getTempFileURL`,null),ke([He({customInfo:{className:`Cloudbase`,methodName:`downloadFile`},title:`下载文件失败`,messages:[`请确认以下各项:`,` 1 - 调用 downloadFile() 的语法或参数是否正确`,` 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety`,` 3 - 云存储安全规则是否限制了当前登录状态访问`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${Fe}`]}),Ae(`design:type`,Function),Ae(`design:paramtypes`,[typeof(f=De.ICloudbaseDownloadFileParams!==void 0&&De.ICloudbaseDownloadFileParams)==`function`?f:Object,typeof(p=typeof Function<`u`&&Function)==`function`?p:Object]),Ae(`design:returntype`,typeof(m=typeof Promise<`u`&&Promise)==`function`?m:Object)],e.prototype,`downloadFile`,null),ke([He({customInfo:{className:`Cloudbase`,methodName:`copyFile`},title:`批量复制文件`,messages:[`请确认以下各项:`,` 1 - 调用 copyFile() 的语法或参数是否正确`,` 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety`,` 3 - 云存储安全规则是否限制了当前登录状态访问`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${Fe}`]}),Ae(`design:type`,Function),Ae(`design:paramtypes`,[typeof(h=De.ICloudbaseCopyFileParams!==void 0&&De.ICloudbaseCopyFileParams)==`function`?h:Object,typeof(g=typeof Function<`u`&&Function)==`function`?g:Object]),Ae(`design:returntype`,typeof(_=typeof Promise<`u`&&Promise)==`function`?_:Object)],e.prototype,`copyFile`,null),e}(),$e=function(){return $e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},$e.apply(this,arguments)},et=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},I=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},tt=ae,L=function(){function e(e,t){t===void 0&&(t=!1),this.shouldThrowOnError=!1,this.bucketId=``,this.context=e,this.shouldThrowOnError=t,this.storage=new Qe(e)}return Object.defineProperty(e.prototype,"config",{get:function(){return this.context?.config},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"request",{get:function(){return this.context?.request},enumerable:!1,configurable:!0}),e.prototype.throwOnError=function(){return this.shouldThrowOnError=!0,this},e.prototype.upload=function(e,t,n){return et(this,void 0,Promise,function(){var i,a,o,s,c,l,u,d,f;return I(this,function(p){switch(p.label){case 0:i=$e({upsert:!0},n),a=i.cacheControl,o=i.contentType,s=i.metadata,p.label=1;case 1:return p.trys.push([1,3,,4]),c=this.getCloudPath(e),l={cloudPath:c,filePath:t},(a||o||s)&&(u={},a&&(u[`cache-control`]=a),o&&(u[`content-type`]=o),s&&(u[`x-cos-metadata-metadata`]=this.toBase64(JSON.stringify(s))),l.headers=u),[4,this.storage.uploadFile(l)];case 2:if(!(d=p.sent()).fileID)throw Error(JSON.stringify({code:tt.OPERATION_FAIL,msg:`[${Ue}.update] no fileID returned`}));return[2,{data:{id:d.fileID,path:e,fullPath:e},error:null}];case 3:if(f=p.sent(),this.shouldThrowOnError)throw f;if(r(f))return[2,{data:null,error:f}];throw f;case 4:return[2]}})})},e.prototype.uploadToSignedUrl=function(e,t,n,r){return et(this,void 0,Promise,function(){return I(this,function(t){return[2,this.upload(e,n,r)]})})},e.prototype.createSignedUploadUrl=function(e){return et(this,void 0,Promise,function(){var t,r,i;return I(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),t=this.getCloudPath(e),[4,this.storage.getUploadMetadata({cloudPath:t})];case 1:return[2,{data:{signedUrl:(r=a.sent().data).url,token:r.token,path:e,authorization:r.authorization,id:r.fileId,cosFileId:r.cosFileId,downloadUrl:r.download_url},error:null}];case 2:if(i=a.sent(),this.shouldThrowOnError)throw i;return[2,{data:null,error:i instanceof n?i:new n(i.message)}];case 3:return[2]}})})},e.prototype.update=function(e,t,n){return et(this,void 0,Promise,function(){return I(this,function(r){return[2,this.upload(e,t,$e($e({},n),{upsert:!0}))]})})},e.prototype.move=function(e,t){return et(this,void 0,Promise,function(){var i,a;return I(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.storage.copyFile({fileList:[{srcPath:this.getCloudPath(e),dstPath:this.getCloudPath(t),overwrite:!0,removeOriginal:!0}]})];case 1:if((i=o.sent()).fileList[0].code&&i.fileList[0].code!==`SUCCESS`)throw new n(i.fileList[0].message||`Move failed`);return[2,{data:{message:`File moved from ${e} to ${t}`},error:null}];case 2:if(a=o.sent(),this.shouldThrowOnError)throw a;if(r(a))return[2,{data:null,error:a}];throw a;case 3:return[2]}})})},e.prototype.copy=function(e,t){return et(this,void 0,Promise,function(){var i,a;return I(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.storage.copyFile({fileList:[{srcPath:this.getCloudPath(e),dstPath:this.getCloudPath(t),overwrite:!0,removeOriginal:!1}]})];case 1:if((i=o.sent()).fileList[0].code&&i.fileList[0].code!==`SUCCESS`)throw new n(i.fileList[0].message||`Copy failed`);return[2,{data:{path:this.getCloudPath(t)},error:null}];case 2:if(a=o.sent(),this.shouldThrowOnError)throw a;if(r(a))return[2,{data:null,error:a}];throw a;case 3:return[2]}})})},e.prototype.createSignedUrl=function(e,t,i){return et(this,void 0,Promise,function(){var t,a,o,s,c,l,u;return I(this,function(d){switch(d.label){case 0:return d.trys.push([0,2,,3]),t=this.normalizeCloudId(e),[4,this.storage.getTempFileURL({fileList:[t]})];case 1:if((a=d.sent()).fileList[0].code!==`SUCCESS`)throw new n(`Failed to create signed URL: [${a.fileList[0].code}] ${a.fileList[0].fileID}`);return o=a.fileList[0].download_url,s=[],i?.download!==void 0&&(typeof i.download==`string`?s.push(`download=${encodeURIComponent(i.download)}`):!0===i.download&&s.push(`download=true`)),i!=null&&i.transform&&(c=this.transformOptsToQueryString(i.transform))&&s.push(c),s.length>0&&(l=o.includes(`?`)?`&`:`?`,o=`${o}${l}${s.join(`&`)}`),[2,{data:{signedUrl:o},error:null}];case 2:if(u=d.sent(),this.shouldThrowOnError)throw u;if(r(u))return[2,{data:null,error:u}];throw u;case 3:return[2]}})})},e.prototype.createSignedUrls=function(e,t){return et(this,void 0,Promise,function(){var t,n,i=this;return I(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),t=e.map(function(e){return i.normalizeCloudId(e)}),[4,this.storage.getTempFileURL({fileList:t})];case 1:return[2,{data:a.sent().fileList.map(function(t,n){return{path:e[n],signedUrl:t.tempFileURL||``,error:t.code===`SUCCESS`?null:t.message}}),error:null}];case 2:if(n=a.sent(),this.shouldThrowOnError)throw n;if(r(n))return[2,{data:null,error:n}];throw n;case 3:return[2]}})})},e.prototype.download=function(e,t){return et(this,void 0,Promise,function(){var i,a,o=this;return I(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),a={},[4,et(o,void 0,void 0,function(){var r,i,a;return I(this,function(o){switch(o.label){case 0:return[4,this.createSignedUrl(e,600,{transform:t})];case 1:if((r=o.sent()).error)throw r.error;return i=encodeURI(r.data?.signedUrl),[4,this.request.reqClass.get({url:i,headers:{},responseType:`blob`})];case 2:if(!(a=o.sent().data))throw new n(`Download failed: no file content`);return[2,new Blob([a])]}})})];case 1:return[2,(a.data=s.sent(),a.error=null,a)];case 2:if(i=s.sent(),this.shouldThrowOnError)throw i;if(r(i))return[2,{data:null,error:i}];throw i;case 3:return[2]}})})},e.prototype.info=function(e){return et(this,void 0,Promise,function(){var t,r,i,a,o,s,c,l;return I(this,function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),t=e.startsWith(`cloud://`),r=t?this.extractPathFromFileId(e):e,i=t?this.extractBucketFromFileId(e):this.bucketId,[4,this.storage.getFileInfo({fileList:[this.normalizeCloudId(e)]})];case 1:if(a=u.sent(),(o=a.fileList[0]).code!==`SUCCESS`)throw new n(o.message);return s=new Date().toISOString(),c=(o.lastModified?new Date(o.lastModified):new Date).toISOString(),[2,{data:{id:o.fileID,version:`1`,name:r,bucketId:i,updatedAt:c,createdAt:c,lastAccessedAt:s,size:o.size,cacheControl:o.cacheControl,contentType:o.contentType,etag:o.etag,lastModified:c,metadata:{}},error:null}];case 2:if(l=u.sent(),this.shouldThrowOnError)throw l;return[2,{data:null,error:l instanceof n?l:new n(l.message)}];case 3:return[2]}})})},e.prototype.exists=function(e){return et(this,void 0,Promise,function(){var t,i,a;return I(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.storage.getFileInfo({fileList:[this.normalizeCloudId(e)]})];case 1:if(t=o.sent(),(i=t.fileList[0]).code===`FILE_NOT_FOUND`)return[2,{data:!1,error:null}];if(i.code!==`SUCCESS`)throw new n(i.message);return[2,{data:!0,error:null}];case 2:if(a=o.sent(),this.shouldThrowOnError)throw a;if(r(a))return[2,{data:null,error:a}];throw a;case 3:return[2]}})})},e.prototype.getPublicUrl=function(e,t){return et(this,void 0,Promise,function(){var n;return I(this,function(r){switch(r.label){case 0:return[4,this.createSignedUrl(e,600,t)];case 1:return(n=r.sent()).data?[2,{data:{publicUrl:n.data.signedUrl}}]:[2,{data:null,error:n.error}]}})})},e.prototype.remove=function(e){return et(this,void 0,Promise,function(){var t,i,a,o,s,c,l,u,d,f,p=this;return I(this,function(m){switch(m.label){case 0:for(m.trys.push([0,3,,4]),t=10,i=[],a=0;a<e.length;a+=t)i.push(e.slice(a,a+t));return[4,Promise.all(i.map(function(e){return Promise.all(e.map(function(e){return p.info(e)}))}))];case 1:return o=m.sent(),s=new Map,o.forEach(function(n,r){n.forEach(function(n,i){n.data&&s.set(e[r*t+i],n.data)})}),c=e.map(function(e){return p.normalizeCloudId(e)}),[4,this.storage.deleteFile({fileList:c})];case 2:if(l=m.sent(),(u=l.fileList.filter(function(e){return e.code!==`SUCCESS`})).length>0)throw new n(`Delete failed for ${u.length} file(s)`);return d=new Date().toISOString(),[2,{data:e.map(function(e){var t=s.get(e);return{name:t?.name,id:t?.id,bucket_id:t?.bucketId,owner:void 0,updated_at:t?.updatedAt||d,created_at:t?.createdAt,last_accessed_at:t?.lastAccessedAt||d,metadata:t?.metadata||{},buckets:{id:t?.bucketId,name:t?.bucketId,owner:void 0,public:!1,created_at:``,updated_at:d}}}),error:null}];case 3:if(f=m.sent(),this.shouldThrowOnError)throw f;if(r(f))return[2,{data:null,error:f}];throw f;case 4:return[2]}})})},e.prototype.list=function(){return et(this,void 0,void 0,function(){return I(this,function(e){throw new n(`Not implemented`)})})},e.prototype.getCloudPath=function(e){return e.replace(/^\/|\/$/g,``).replace(/\/+/g,`/`)},e.prototype.normalizeCloudId=function(e){if(/^cloud:\/\//.test(e))return e;var t=this.getCloudPath(e);if(!this.bucketId)throw new n(`bucketId is not set`);var r=this.config?.env||``;return r?`cloud://${r}.${this.bucketId}/${t}`:void 0},e.prototype.toBase64=function(e){return s(e)},e.prototype.transformOptsToQueryString=function(e){var t=[`imageMogr2`];if(e.width||e.height){var n=e.width||``,r=e.height||``;e.resize===`fill`?t.push(`thumbnail/${n}x${r}!`):e.resize===`contain`?t.push(`thumbnail/${n}x${r}`):t.push(`thumbnail/${n}x${r}^`)}if(e.format&&e.format!==`origin`&&t.push(`format/${e.format}`),e.quality!==void 0){var i=Math.max(1,Math.min(100,e.quality));t.push(`quality/${i}`)}return t.join(`/`)},e.prototype.extractPathFromFileId=function(e){var t=e.replace(/^cloud:\/\//,``).split(`/`);return t.length<2?e:t.slice(1).join(`/`)},e.prototype.extractBucketFromFileId=function(e){var t=e.replace(/^cloud:\/\//,``).split(`/`);if(t.length<1)return``;var n=t[0],r=n.indexOf(`.`);return r===-1?n:n.substring(r+1)},e}(),R=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),nt=new Qe,rt={name:Ue,entity:{uploadFile:nt.uploadFile,deleteFile:nt.deleteFile,getTempFileURL:nt.getTempFileURL,downloadFile:nt.downloadFile,getUploadMetadata:nt.getUploadMetadata,copyFile:nt.copyFile,getFileInfo:nt.getFileInfo,isGateWay:nt.isGateWay}},it=function(e){function t(){return e!==null&&e.apply(this,arguments)||this}return R(t,e),t.prototype.from=function(e){return e?(k(e,`from`),new te(this.http,e,this.shouldThrowOnError)):new L(this.http.ctx,this.shouldThrowOnError)},t}(re),at={name:`${Ue}/supabase`,IIFE:!0,entity:function(){var e=new WeakMap;Object.defineProperty(this.prototype,"storage",{get:function(){if(e.has(this))return e.get(this);var t=this,n=new it(new Proxy({},{get:function(e,n){return n===`config`?t.config:n===`request`?t.request:void 0}}));return e.set(this,n),n},configurable:!0,enumerable:!0})}};try{cloudbase.registerComponent(rt),cloudbase.registerComponent(at)}catch{}function z(e){try{e.registerComponent(rt),e.registerComponent(at)}catch(e){console.warn(e)}}try{window.registerStorage=z}catch{}var ot=z})(),mo.v;var ho=`2.0.6`,go=[`webhook`,`qmsg`,`serverchan`,`pushplus`,`pushplushxtrip`,`dingtalk`,`wecom`,`bark`,`gocqhttp`,`onebot`,`atri`,`pushdeer`,`igot`,`telegram`,`feishu`,`lark`,`ifttt`,`wecombot`,`discord`,`wxpusher`,`ntfy`,`join`],_o=class extends Error{kind;httpStatus;rawMessage;requestId;constructor(e,t,n={}){super(t),this.name=`TwikooError`,this.kind=e,this.httpStatus=n.httpStatus,this.rawMessage=n.rawMessage??t,this.requestId=n.requestId}},vo={tcb:null,options:{}};function yo(e,t){vo.tcb=e,vo.options=t}function bo(){return vo}function xo(e){return typeof e==`string`&&/^http(s)?:\/\//.test(e)}function So(e,t){return new Promise((n,r)=>{let i=localStorage.getItem(`twikoo-access-token`),a=new XMLHttpRequest,o=Date.now();a.onreadystatechange=()=>{if(a.readyState!==4)return;let e=Date.now()-o;if(a.status===200)try{let e=JSON.parse(a.responseText);e.accessToken&&localStorage.setItem(`twikoo-access-token`,typeof e.accessToken==`string`?e.accessToken:``),n(e)}catch{r(new _o(`UNKNOWN`,`后端返回格式异常`,{rawMessage:a.responseText.slice(0,200)}))}else a.status===0?r(new _o(e>3e4?`TIMEOUT`:`CORS`,`请求被跨域策略拦截或网络不可达`,{rawMessage:a.statusText||`status 0`})):a.status===404?r(new _o(`NOT_FOUND`,`接口地址不存在`,{httpStatus:404,rawMessage:a.responseText.slice(0,200)})):a.status===401||a.status===403?r(new _o(`CLIENT_ERROR`,`认证失败,请重新登录`,{httpStatus:a.status,rawMessage:a.responseText.slice(0,200)})):a.status===429?r(new _o(`REJECTED`,`请求过于频繁`,{httpStatus:429,rawMessage:a.responseText.slice(0,200)})):a.status>=500?r(new _o(`SERVER_ERROR`,`后端异常`,{httpStatus:a.status,rawMessage:a.responseText.slice(0,200)})):r(new _o(`CLIENT_ERROR`,`请求失败(${a.status})`,{httpStatus:a.status,rawMessage:a.responseText.slice(0,200)}))};try{a.open(`POST`,e),a.setRequestHeader(`Content-Type`,`application/json`),a.send(JSON.stringify({accessToken:i,...t,envId:e}))}catch(e){r(new _o(`NETWORK`,`无法连接到后端`,{rawMessage:String(e)}))}})}async function Co(e,t,n={}){let r=e??vo.tcb,i=typeof n.envId==`string`?n.envId:typeof vo.options.envId==`string`?vo.options.envId:void 0,a=typeof n.funcName==`string`?n.funcName:typeof vo.options.funcName==`string`?vo.options.funcName:`twikoo`;if(r)return await r.app.callFunction({name:a,data:{event:t,...n}});if(typeof i==`string`&&xo(i))return await So(i,{event:t,...n});throw Error(`缺少 envId 配置 - https://twikoo.js.org`)}var wo={verbose:1,info:2,warn:3,error:4}[(typeof process<`u`&&process.env,`info`).toLowerCase()]||2,To={verbose:(...e)=>{wo<=1&&console.log(...e)},info:(...e)=>{wo<=2&&console.info(...e)},warn:(...e)=>{wo<=3&&console.warn(...e)},error:(...e)=>{wo<=4&&console.error(...e)}},Eo={ADMIN_CLIENT_VERSION:`前端版本:`,ADMIN_SERVER_VERSION:`云函数版本:`,ADMIN_COMMENT:`评论管理`,ADMIN_COMMENT_DELETE:`删除`,ADMIN_COMMENT_DELETE_CONFIRM:`确认删除?`,ADMIN_COMMENT_FILTER_ALL:`全部`,ADMIN_COMMENT_FILTER_VISIBLE:`只看可见`,ADMIN_COMMENT_FILTER_HIDDEN:`只看隐藏`,ADMIN_COMMENT_HIDE:`隐藏`,ADMIN_COMMENT_IS_SPAM_SUFFIX:` (已隐藏)`,ADMIN_COMMENT_SEARCH:`搜索`,ADMIN_COMMENT_SEARCH_PLACEHOLDER:`搜索昵称、邮箱、网址、IP、评论正文、文章地址`,ADMIN_COMMENT_SHOW:`显示`,ADMIN_COMMENT_TOP:`置顶`,ADMIN_COMMENT_UNTOP:`取消置顶`,ADMIN_COMMENT_VIEW:`查看`,ADMIN_COMMENT_SECURITY_ALERT:`评论链接与本站不同!出于安全考虑,请手动复制以下网址访问:`,ADMIN_COMMENT_PARSE_ERROR:`无法解析评论链接,请仔细检查链接后手动复制以下网址访问:`,ADMIN_CONFIG:`配置管理`,ADMIN_CONFIG_CATEGORY_COMMON:`通用`,ADMIN_CONFIG_CATEGORY_IM:`即时通知`,ADMIN_CONFIG_CATEGORY_MAIL:`邮件通知`,ADMIN_CONFIG_CATEGORY_PLUGIN:`插件`,ADMIN_CONFIG_CATEGORY_PRIVACY:`隐私`,ADMIN_CONFIG_CATEGORY_SPAM:`反垃圾`,ADMIN_CONFIG_CATEGORY_CAPTCHA:`人机验证`,ADMIN_CONFIG_IMAGE_CDN_NONE:`无(不启用图片上传)`,ADMIN_CONFIG_CAPTCHA_NONE:`无`,ADMIN_CONFIG_CAPTCHA_TURNSTILE:`Cloudflare Turnstile`,ADMIN_CONFIG_CAPTCHA_GEETEST:`极验 Geetest`,ADMIN_CONFIG_CAPTCHA_CAP:`Cap`,ADMIN_CONFIG_EMAIL_TEST:`邮件通知测试`,ADMIN_CONFIG_EMAIL_TEST_BTN:`发送测试邮件`,ADMIN_CONFIG_EMAIL_TEST_HELP:`输入一个邮箱地址,发送测试邮件`,ADMIN_CONFIG_EMAIL_TEST_RESULT:`测试结果:`,ADMIN_CONFIG_EXAMPLE:`示例:`,ADMIN_CONFIG_ITEM_AKISMET_KEY:`Akismet 反垃圾评论,用于垃圾评论检测,设为 "MANUAL_REVIEW" 开启人工审核,留空不使用反垃圾。注册:https://akismet.com`,ADMIN_CONFIG_ITEM_BLOGGER_NICK:`博主的昵称。`,ADMIN_CONFIG_ITEM_BLOGGER_EMAIL:`博主的邮箱地址,用于邮件通知、博主标识。`,ADMIN_CONFIG_ITEM_COMMENT_BG_IMG:`评论框自定义背景图片 URL 地址。`,ADMIN_CONFIG_ITEM_COMMENT_PAGE_SIZE:`评论列表分页大小,默认为 8。`,ADMIN_CONFIG_ITEM_COMMENT_PLACEHOLDER:`评论框提示信息,可用<br>换行,默认为空`,ADMIN_CONFIG_ITEM_CORS_ALLOW_ORIGIN:`CORS 安全域名,注意:如果您不了解什么是 CORS,此项请留空,错误设置会导致无法加载,默认为空,格式为 https://blog.example.com;如需添加多域名请使用,分隔`,ADMIN_CONFIG_ITEM_DEFAULT_GRAVATAR:`默认的头像显示。默认值(留空)为 "initials",可选:"404"、"mp"、"identicon"、"monsterid"、"wavatar"、"retro"、"robohash"、"blank"`,ADMIN_CONFIG_ITEM_EMOTION_CDN:`表情 CDN,英文逗号分隔。默认为:https://owo.imaegoo.com/owo.json`,ADMIN_CONFIG_ITEM_FORBIDDEN_WORDS:`违禁词配置,包含违禁词的内容会直接标记为垃圾评论。英文逗号分隔。`,ADMIN_CONFIG_ITEM_BLOCKED_WORDS:`屏蔽词配置,包含屏蔽词的内容会直接评论失败。英文逗号分隔。`,ADMIN_CONFIG_ITEM_GRAVATAR_CDN:`自定义头像 CDN 地址。如:cn.gravatar.com, weavatar.com, cravatar.cn, sdn.geekzu.org, gravatar.loli.net,默认:weavatar.com`,ADMIN_CONFIG_ITEM_HIDE_ADMIN_CRYPT:`隐藏管理面板入口。可设置一个“暗号”,只有在“昵称”一栏输入相同的“暗号”时,管理面板入口才会显示,留空则不隐藏管理入口`,ADMIN_CONFIG_ITEM_QQ_API_KEY:`QQ昵称API密钥,用于获取QQ昵称。前往 https://api.tqq.me/dashboard/api-keys 获取`,ADMIN_CONFIG_ITEM_HIGHLIGHT:`启用代码高亮功能。如果您的主题和代码高亮有冲突,请设为 false。默认:true`,ADMIN_CONFIG_ITEM_HIGHLIGHT_THEME:`代码高亮主题,可选:"default"、"coy"、"dark"、"funky"、"okaidia"、"solarizedlight"、"tomorrow"、"twilight",访问 https://prismjs.com 可预览主题效果。如果您的主题和代码高亮有冲突,请设为 none。默认:none`,ADMIN_CONFIG_ITEM_HIGHLIGHT_PLUGIN:`代码高亮插件,可选:"showLanguage"、"copyButton",分别表示:展示代码语言、展示代码拷贝按钮。可以同时设置多个选项,如果想要不添加任何代码高亮插件,请设为 none。默认:none。`,ADMIN_CONFIG_ITEM_IMAGE_CDN:`插入图片所使用的图床,目前支持:"qcloud"、"7bu (https://7bu.top)"、"see (https://s.ee)"、"lskypro"、"piclist"、"easyimage"、"chevereto"、"S3 / R2 / MinIO"`,ADMIN_CONFIG_ITEM_IMAGE_CDN_URL:`图床的 URL,仅当 IMAGE_CDN 为 "lskypro" / "piclist" / "easyimage" / "s3" 时需要填写`,ADMIN_CONFIG_ITEM_IMAGE_CDN_TOKEN:`图床 token。qcloud 图床无需设置`,ADMIN_CONFIG_ITEM_NSFW_API_URL:`NSFW 图片检测 API 地址。免费服务:nsfw.qixz.cn,项目:github.com/HG-ha/nsfwpy`,ADMIN_CONFIG_ITEM_NSFW_THRESHOLD:`NSFW 检测阈值(0-1),当检测分数高于此值时拒绝上传。默认:0.5`,ADMIN_CONFIG_ITEM_S3_REGION:`S3 存储区域,例如 us-east-1。使用兼容 S3 的服务(如 Cloudflare R2、MinIO)时可填任意值`,ADMIN_CONFIG_ITEM_S3_BUCKET:`S3 存储桶名称`,ADMIN_CONFIG_ITEM_S3_ACCESS_KEY_ID:`S3 Access Key ID`,ADMIN_CONFIG_ITEM_S3_SECRET_ACCESS_KEY:`S3 Secret Access Key`,ADMIN_CONFIG_ITEM_S3_ENDPOINT:`S3 自定义 Endpoint,使用 Cloudflare R2、MinIO 等兼容 S3 的服务时填写`,ADMIN_CONFIG_ITEM_S3_FORCE_PATH_STYLE:`设置 S3_ENDPOINT 时,是否将 S3_BUCKET 拼入上传地址路径。默认为 true,适用于 Cloudflare R2、MinIO 等 path-style S3 兼容端点;使用已绑定存储桶的自定义域名时设为 false,例如腾讯云 COS 自定义域名`,ADMIN_CONFIG_ITEM_S3_CDN_URL:`S3 图片访问域名(CDN 域名),留空则使用默认 S3/Endpoint URL`,ADMIN_CONFIG_ITEM_S3_PATH_PREFIX:`S3 图片存储路径前缀,例如 images/twikoo,留空则存储在根目录`,ADMIN_CONFIG_ITEM_LIGHTBOX:`使用简易图片点击放大效果。默认:false`,ADMIN_CONFIG_ITEM_LIMIT_PER_MINUTE:`单个 IP 发言频率限制(条/10分钟),0 为无限制,默认:10`,ADMIN_CONFIG_ITEM_LIMIT_PER_MINUTE_ALL:`全站发言频率限制(条/10分钟),0 为无限制,默认:10`,ADMIN_CONFIG_ITEM_LIMIT_LENGTH:`评论长度限制,0 为无限制,默认:500`,ADMIN_CONFIG_ITEM_MAIL_SUBJECT:`自定义通知邮件主题,留空则使用默认主题。`,ADMIN_CONFIG_ITEM_MAIL_SUBJECT_ADMIN:`自定义博主通知邮件主题,留空则使用默认主题。`,ADMIN_CONFIG_ITEM_MAIL_TEMPLATE:"自定义通知邮件模板,留空则使用默认模板。可包含的字段:${SITE_URL}, ${SITE_NAME}, ${PARENT_NICK}, ${PARENT_COMMENT}, ${NICK}, ${COMMENT}, ${POST_URL}, ${IMG}, ${PARENT_IMG}",ADMIN_CONFIG_ITEM_MAIL_TEMPLATE_ADMIN:"自定义博主通知邮件模板,留空则使用默认模板。可包含的字段:${SITE_URL}, ${SITE_NAME}, ${NICK}, ${COMMENT}, ${POST_URL}, ${IP}, ${MAIL}, ${IMG}",ADMIN_CONFIG_ITEM_MASTER_TAG:`博主标识自定义文字,默认为 “博主”。`,ADMIN_CONFIG_ITEM_NOTIFY_SPAM:`垃圾评论是否发送通知,默认:true`,ADMIN_CONFIG_ITEM_HIDE_SPAM:`前台评论区对所有人隐藏垃圾评论,包括管理员和评论作者。评论管理后台仍可审核和恢复。设为 true 开启,默认:false。`,ADMIN_CONFIG_ITEM_CAPTCHA_PROVIDER:`人机验证码提供商`,ADMIN_CONFIG_ITEM_TURNSTILE_SITE_KEY:`Turnstile 验证码的站点密钥。申请地址: https://dash.cloudflare.com/?to=/:account/turnstile`,ADMIN_CONFIG_ITEM_TURNSTILE_SECRET_KEY:`Turnstile 验证码的密钥`,ADMIN_CONFIG_ITEM_GEETEST_CAPTCHA_ID:`极验验证码的 Captcha ID。申请地址: https://console.geetest.com/sensbot/management`,ADMIN_CONFIG_ITEM_GEETEST_CAPTCHA_KEY:`极验验证码的 Captcha Key`,ADMIN_CONFIG_ITEM_CAP_API_ENDPOINT:`Cap 验证码 API 端点。留空则使用内嵌 Cap(无需额外部署);外部 Standalone 格式:https://<实例地址>/<site_key>/`,ADMIN_CONFIG_ITEM_CAP_SECRET_KEY:`Cap Secret Key(仅外部 Standalone 需要;内嵌模式可留空)`,ADMIN_CONFIG_ITEM_QCLOUD_SECRET_ID:`腾讯云 secret id,用于垃圾评论检测。同时设置腾讯云和 Akismet 时,只有腾讯云会生效。注册:https://twikoo.js.org/cms.html`,ADMIN_CONFIG_ITEM_QCLOUD_CMS_BIZTYPE:`腾讯云内容安全 Biztype 名称,用于垃圾评论策略。可以自定义垃圾拦截规则`,ADMIN_CONFIG_ITEM_QCLOUD_SECRET_KEY:`腾讯云 secret key`,ADMIN_CONFIG_ITEM_LLM_API_KEY:`LLM API Key,用于 AI 垃圾评论检测。仅在未配置腾讯云和 Akismet 时生效。`,ADMIN_CONFIG_ITEM_LLM_API_ENDPOINT:`LLM API 接口地址,默认:https://api.deepseek.com/v1`,ADMIN_CONFIG_ITEM_LLM_MODEL:`LLM 模型名称,默认:deepseek-v4-pro`,ADMIN_CONFIG_ITEM_LLM_SPAM_PROMPT:`LLM 垃圾检测提示词(可选,留空则使用默认提示词)`,ADMIN_CONFIG_ITEM_LLM_MAX_RETRIES:`LLM 检测最大重试次数(默认 3 次)`,ADMIN_CONFIG_ITEM_PUSHOO_CHANNEL:`即时消息推送平台名称,支持:"qmsg"、"serverchan"、"pushplus"、"pushplushxtrip"、"dingtalk"、"wecom"、"bark"、"gocqhttp"、"atri"、"pushdeer"、"igot"、"telegram"、"feishu" 等`,ADMIN_CONFIG_ITEM_PUSHOO_TOKEN:`即时消息推送 token。请参考 https://pushoo.js.org 里的详细说明配置`,ADMIN_CONFIG_ITEM_DISPLAYED_FIELDS:`界面上展示的输入框,默认:nick,mail,link`,ADMIN_CONFIG_ITEM_REQUIRED_FIELDS:`评论必填信息,设为 nick,mail,link 代表全必填,设为 none 代表全选填,默认:nick,mail`,ADMIN_CONFIG_ITEM_SC_MAIL_NOTIFY:`是否同时通过 IM 和邮件 2 种方式通知博主,默认只通过 IM 通知博主,默认:false`,ADMIN_CONFIG_ITEM_SENDER_EMAIL:`邮件通知邮箱地址。对于大多数邮箱服务商,SENDER_EMAIL 必须和 SMTP_USER 保持一致,否则无法发送邮件。`,ADMIN_CONFIG_ITEM_SENDER_NAME:`邮件通知标题。`,ADMIN_CONFIG_ITEM_SHOW_EMOTION:`启用插入表情功能,默认为:true`,ADMIN_CONFIG_ITEM_SHOW_IMAGE:`启用插入图片功能,默认为:true`,ADMIN_CONFIG_ITEM_SHOW_ORDER:`评论排序下拉框,默认为:true`,ADMIN_CONFIG_ITEM_SHOW_DISLIKE:`评论点踩按钮,默认为:true`,ADMIN_CONFIG_ITEM_SHOW_UA:`是否显示用户系统和浏览器,默认为:true`,ADMIN_CONFIG_ITEM_SHOW_REGION:`是否显示用户 IP 属地到省,可能不准确,不支持 IPv6,默认为:false`,ADMIN_CONFIG_ITEM_SITE_NAME:`网站名称`,ADMIN_CONFIG_ITEM_SITE_URL:`网站地址`,ADMIN_CONFIG_ITEM_SMTP_HOST:`自定义 SMTP 服务器地址。如您已配置 SMTP_SERVICE,此项请留空。`,ADMIN_CONFIG_ITEM_SMTP_PASS:`邮件通知邮箱密码,QQ、163邮箱请填写授权码。`,ADMIN_CONFIG_ITEM_SMTP_PORT:`自定义 SMTP 端口。如您已配置 SMTP_SERVICE,此项请留空。`,ADMIN_CONFIG_ITEM_SMTP_SECURE:`自定义 SMTP 是否使用TLS,请填写 true 或 false。如您已配置 SMTP_SERVICE,此项请留空。`,ADMIN_CONFIG_ITEM_SMTP_SERVICE:`邮件通知邮箱服务商。支持:"126"、"163"、"1und1"、"AOL"、"DebugMail"、"DynectEmail"、"FastMail"、"GandiMail"、"Gmail"、"Godaddy"、"GodaddyAsia"、"GodaddyEurope"、"Hotmail"、"Mail.ru"、"Maildev"、"Mailgun"、"Mailjet"、"Mailosaur"、"Mandrill"、"Naver"、"OpenMailBox"、"Outlook365"、"Postmark"、"QQ"、"QQex"、"SES"、"SES-EU-WEST-1"、"SES-US-EAST-1"、"SES-US-WEST-2"、"SendCloud"、"SendGrid"、"SendPulse"、"SendinBlue"、"Sparkpost"、"Yahoo"、"Yandex"、"Zoho"、"hot.ee"、"iCloud"、"mail.ee"、"qiye.aliyun"`,ADMIN_CONFIG_ITEM_SMTP_USER:`邮件通知邮箱用户名。`,ADMIN_CONFIG_RESET:`重置`,ADMIN_CONFIG_SAVE:`保存`,ADMIN_CONFIG_EXPORT:`导出配置`,ADMIN_CONFIG_IMPORT:`导入配置`,ADMIN_CONFIG_IMPORT_FAILED:`配置导入失败:`,ADMIN_CONFIG_IMPORT_INVALID:`配置文件格式不合法`,ADMIN_CONFIG_IMPORT_SOURCE_INVALID:`配置导入仅支持 Twikoo 导出的配置文件,请将「源系统」选择为 Twikoo`,ADMIN_CONFIG_IMPORTED:`配置导入成功`,ADMIN_CONFIG_IMPORTING:`正在导入配置`,ADMIN_CREDENTIALS:`私钥文件`,ADMIN_CREDENTIALS_FAQ:`如何获得私钥`,ADMIN_CREDENTIALS_PLACEHOLDER:`请粘贴私钥文件内容`,ADMIN_FORGOT:`忘记密码`,ADMIN_EXPORT:`导出`,ADMIN_EXPORT_WARN:`将全部数据导出为 JSON 文件。如果遇到评论较多、导出失败或缺失数据,请连接数据库手动导出`,ADMIN_EXPORT_COMMENT:`导出评论`,ADMIN_EXPORT_COUNTER:`导出访问量`,ADMIN_IMPORT:`导入`,ADMIN_IMPORT_FILE_REQUIRED:`未选择文件`,ADMIN_IMPORT_IMPORTED:`完成导入 `,ADMIN_IMPORT_IMPORTING:`开始导入 `,ADMIN_IMPORT_LOG:`日志`,ADMIN_IMPORT_SELECT:`请选择`,ADMIN_IMPORT_SELECT_FILE:`选择文件`,ADMIN_IMPORT_SELECT_SOURCE:`选择源系统`,ADMIN_IMPORT_SOURCE_REQUIRED:`未选择源系统`,ADMIN_IMPORT_START:`开始导入`,ADMIN_IMPORT_COMMENT:`导入评论`,ADMIN_IMPORT_STARTING:`开始导入`,ADMIN_IMPORT_TIP_ARTALK:`请上传 JSON 格式的 Artalk 导出文件,文件名通常为 comments.data.json`,ADMIN_IMPORT_TIP_DISQUS:`请上传 XML 格式的 Disqus 导出文件,文件名通常为 [网站名称]-[导出时间]-all.xml`,ADMIN_IMPORT_TIP_VALINE:`请上传 JSON 格式的 Valine 导出文件,文件名通常为 Comment.json`,ADMIN_IMPORT_UPLOADED:`上传完成 `,ADMIN_IMPORT_UPLOADING:`已上传 `,ADMIN_IMPORT_WARN:`支持从其他评论系统的备份文件导入评论。
|
|
170
170
|
数据是安全的,导入功能完全在您的云环境进行。
|
|
171
|
-
建议在导入前备份 comment 数据库。`,ADMIN_LOGIN:`登录`,ADMIN_LOGIN_TITLE:`Twikoo 评论管理`,ADMIN_LOGOUT:`退出登录`,ADMIN_NEED_UPDATE:`若要使用评论管理,请更新 Twikoo 云函数`,ADMIN_PASSWORD:`密码`,ADMIN_PASSWORD_PLACEHOLDER:`请输入`,ADMIN_PASSWORD_REQUIRED:`请输入密码`,ADMIN_REGIST:`注册`,ADMIN_REGIST_FAILED:`注册失败`,ADMIN_SET_PASSWORD:`设置密码`,ADMIN_SET_PASSWORD_CONFIRM:`确认密码`,ADMIN_SET_PASSWORD_CONFIRM_PLACEHOLDER:`确认密码`,ADMIN_SET_PASSWORD_PLACEHOLDER:`密码`,ADMIN_TITLE:`Twikoo 管理面板`,COMMENTS_SEARCH:`搜索`,COMMENTS_SEARCH_PLACEHOLDER:`搜索评论`,COMMENTS_SEARCH_NO_RESULT:`没有找到评论`,COMMENTS_SEARCH_COUNT_PREFIX:`找到 `,COMMENTS_COUNT_SUFFIX:` 条评论`,COMMENTS_SORT_NEWEST:`最新`,COMMENTS_SORT_OLDEST:`最早`,COMMENTS_SORT_POPULAR:`热门`,COMMENTS_EXPAND:`查看更多`,COMMENTS_NO_COMMENTS:`没有评论`,COMMENT_EXPAND:`展开`,COMMENT_COLLAPSE:`收起`,COMMENT_MASTER_TAG:`博主`,COMMENT_REPLIED:`回复`,COMMENT_DELETE_CONFIRM:`确认删除你的评论?`,COMMENT_REVIEWING_TAG:`审核中`,COMMENT_TOP_TAG:`置顶`,COMMENT_FAILED:`评论失败`,META_INPUT_LINK:`网址`,META_INPUT_MAIL:`邮箱`,META_INPUT_NICK:`昵称`,META_INPUT_NOT_REQUIRED:`选填`,META_INPUT_REQUIRED:`必填`,PAGINATION_COUNT_PREFIX:`共 `,PAGINATION_COUNT_SUFFIX:` 条`,PAGINATION_GOTO_PREFIX:`前往`,PAGINATION_GOTO_SUFFIX:`页`,PAGINATION_PAGESIZE:`条/页`,SUBMIT_CANCEL:`取消`,SUBMIT_PREVIEW:`预览`,SUBMIT_SEND:`发送`,IMAGE_UPLOAD_PLACEHOLDER:`图片上传中`,IMAGE_UPLOAD_FAILED:`图片上传失败`,IMAGE_UPLOAD_NSFW:`图片包含不当内容,禁止上传`,IMAGE_UPLOAD_FAILED_NO_CONF:`博主未配置图床服务`,IMAGE_UPLOAD_PLEASE_WAIT:`图片上传中,请稍候再发送`,SUBMIT_SENDING:`发送中`,TIMEAGO_DAYS:`天前`,TIMEAGO_HOURS:`小时前`,TIMEAGO_MINUTES:`分钟前`,TIMEAGO_NOW:`刚刚`,TIMEAGO_SECONDS:`秒前`},Do={ADMIN_CLIENT_VERSION:`Client version: `,ADMIN_SERVER_VERSION:`Server version: `,ADMIN_COMMENT:`Comment`,ADMIN_COMMENT_DELETE:`Delete`,ADMIN_COMMENT_DELETE_CONFIRM:`Confirm deletion?`,ADMIN_COMMENT_FILTER_ALL:`All`,ADMIN_COMMENT_FILTER_VISIBLE:`Visible`,ADMIN_COMMENT_FILTER_HIDDEN:`Hidden`,ADMIN_COMMENT_HIDE:`Hide`,ADMIN_COMMENT_IS_SPAM_SUFFIX:` (Hidden)`,ADMIN_COMMENT_SEARCH:`Search`,ADMIN_COMMENT_SEARCH_PLACEHOLDER:`Search by nick, mail, website, IP, comment, or article path`,ADMIN_COMMENT_SHOW:`Show`,ADMIN_COMMENT_TOP:`Pin`,ADMIN_COMMENT_UNTOP:`Unpin`,ADMIN_COMMENT_VIEW:`View`,ADMIN_COMMENT_SECURITY_ALERT:`The comment link is different from this site! For security reasons, please manually copy the following URL to visit:`,ADMIN_COMMENT_PARSE_ERROR:`Unable to parse comment link. Please check and manually copy the following URL:`,ADMIN_CONFIG:`Configuration`,ADMIN_CONFIG_CATEGORY_COMMON:`General`,ADMIN_CONFIG_CATEGORY_IM:`Instant notification`,ADMIN_CONFIG_CATEGORY_MAIL:`Email notification`,ADMIN_CONFIG_CATEGORY_PLUGIN:`Plugin`,ADMIN_CONFIG_CATEGORY_PRIVACY:`Privacy`,ADMIN_CONFIG_CATEGORY_SPAM:`Spam`,ADMIN_CONFIG_CATEGORY_CAPTCHA:`CAPTCHA`,ADMIN_CONFIG_IMAGE_CDN_NONE:`None (disable image upload)`,ADMIN_CONFIG_CAPTCHA_NONE:`None`,ADMIN_CONFIG_CAPTCHA_TURNSTILE:`Cloudflare Turnstile`,ADMIN_CONFIG_CAPTCHA_GEETEST:`GeeTest`,ADMIN_CONFIG_CAPTCHA_CAP:`Cap`,ADMIN_CONFIG_EMAIL_TEST:`Email notification test`,ADMIN_CONFIG_EMAIL_TEST_BTN:`Send test mail`,ADMIN_CONFIG_EMAIL_TEST_HELP:`Input an email address & send test mail`,ADMIN_CONFIG_EMAIL_TEST_RESULT:`Test result: `,ADMIN_CONFIG_EXAMPLE:`Example: `,ADMIN_CONFIG_ITEM_AKISMET_KEY:`Akismet spam protection. Set to "MANUAL_REVIEW" to enable manual review. Leave it blank to not use anti-spam. Register Akismet: https://akismet.com`,ADMIN_CONFIG_ITEM_BLOGGER_NICK:`Admin nick name.`,ADMIN_CONFIG_ITEM_BLOGGER_EMAIL:`Admin Email address. Used for Email notification and admin identification.`,ADMIN_CONFIG_ITEM_COMMENT_BG_IMG:`URL for custom background image.`,ADMIN_CONFIG_ITEM_COMMENT_PAGE_SIZE:`Comment page size. Default: 8.`,ADMIN_CONFIG_ITEM_COMMENT_PLACEHOLDER:`Comment placeholder. Use <br> to start a newline. Default: empty.`,ADMIN_CONFIG_ITEM_CORS_ALLOW_ORIGIN:`CORS allow origin, note: incorrect settings can cause loading failure. Default: blank, format: https://blog.example.com; If you need to add multiple domain names, please use, separate`,ADMIN_CONFIG_ITEM_DEFAULT_GRAVATAR:`Avatar placeholder. Default (when empty): "initials". Choose from: "404", "mp", "identicon", "monsterid", "wavatar", "retro", "robohash", "blank"`,ADMIN_CONFIG_ITEM_EMOTION_CDN:`Emoji CDN. Separate by comma. Default: https://owo.imaegoo.com/owo.json`,ADMIN_CONFIG_ITEM_FORBIDDEN_WORDS:`Configure prohibited words. Comments containing prohibited words will be auto spammed. Separate by comma.`,ADMIN_CONFIG_ITEM_BLOCKED_WORDS:`Configure blocked words. Comments containing blocked words will fail to send. Separate by comma.`,ADMIN_CONFIG_ITEM_GRAVATAR_CDN:`Custom avator CDN. (Examples: gravatar.com) Default: weavatar.com.`,ADMIN_CONFIG_ITEM_HIDE_ADMIN_CRYPT:`Set a cipher to hide the management panel entrance, only when the same cipher is entered in the nickname field the management panel entry will be displayed. Leave it blank to not hide the management entrance.`,ADMIN_CONFIG_ITEM_QQ_API_KEY:`QQ nickname API key for fetching QQ nickname. Get it from https://api.nsuuu.com/admin/key`,ADMIN_CONFIG_ITEM_HIGHLIGHT:`Enable code highlighting. If your theme conflicts with code highlighting, please set it to false. Default: true.`,ADMIN_CONFIG_ITEM_HIGHLIGHT_THEME:`Code highlighting theme. Select from: "default", "coy", "dark", "funky", "okaidia", "solarizedlight", "tomorrow", "twilight". Visit https://prismjs.com for preview. If your theme conflicts with code highlighting, please set it to none. Default: none.`,ADMIN_CONFIG_ITEM_HIGHLIGHT_PLUGIN:`Code highlight plug-in, optional: "showLanguage", "copyButton", respectively: show code language, show code copy button. Multiple options can be set at the same time, if you want to add no code highlighting plug-ins, please set it to none. Default: none. `,ADMIN_CONFIG_ITEM_IMAGE_CDN:`The image bed for image uploading. Select from: "qcloud", "7bu (https://7bu.top)", "see (https://s.ee)", "lskypro", "piclist", "easyimage", "chevereto", "S3 / R2 / MinIO"`,ADMIN_CONFIG_ITEM_IMAGE_CDN_URL:`The URL for the image bed. Required if your IMAGE_CDN is one of these: "lskypro", "piclist", "easyimage", "s3"`,ADMIN_CONFIG_ITEM_IMAGE_CDN_TOKEN:`The image bed token. Unnessessary for qcloud`,ADMIN_CONFIG_ITEM_NSFW_API_URL:`NSFW image detection API URL. Free services: nsfw.qixz.cn, project: github.com/HG-ha/nsfwpy`,ADMIN_CONFIG_ITEM_NSFW_THRESHOLD:`NSFW detection threshold (0-1). Upload will be rejected if score exceeds this value. Default: 0.5`,ADMIN_CONFIG_ITEM_S3_REGION:`S3 region, e.g. us-east-1. Can be any value when using S3-compatible services (e.g. Cloudflare R2, MinIO)`,ADMIN_CONFIG_ITEM_S3_BUCKET:`S3 bucket name`,ADMIN_CONFIG_ITEM_S3_ACCESS_KEY_ID:`S3 Access Key ID`,ADMIN_CONFIG_ITEM_S3_SECRET_ACCESS_KEY:`S3 Secret Access Key`,ADMIN_CONFIG_ITEM_S3_ENDPOINT:`S3 custom endpoint. Required when using S3-compatible services like Cloudflare R2 or MinIO`,ADMIN_CONFIG_ITEM_S3_FORCE_PATH_STYLE:`When S3_ENDPOINT is set, whether to append S3_BUCKET to the upload URL path. Default: true. Use true for Cloudflare R2, MinIO, and other path-style S3-compatible endpoints; set false for bucket-bound custom domains, such as Tencent Cloud COS custom domains.`,ADMIN_CONFIG_ITEM_S3_CDN_URL:`S3 image access domain (CDN domain). Leave empty to use default S3/Endpoint URL`,ADMIN_CONFIG_ITEM_S3_PATH_PREFIX:`S3 image storage path prefix, e.g. images/twikoo. Leave empty to store in root`,ADMIN_CONFIG_ITEM_LIGHTBOX:`Use simple Lightbox effect. Default: false`,ADMIN_CONFIG_ITEM_LIMIT_PER_MINUTE:`How many comments can be posted by each IP every 10 minutes, 0 is unlimited, default: 10.`,ADMIN_CONFIG_ITEM_LIMIT_PER_MINUTE_ALL:`How many comments can be posted by all IPs every 10 minutes, 0 is unlimited, default: 10.`,ADMIN_CONFIG_ITEM_LIMIT_LENGTH:`Comment length limitation, 0 is unlimited, default: 500.`,ADMIN_CONFIG_ITEM_MAIL_SUBJECT:`Custom Email notification subject. Leave it blank to use the default subject.`,ADMIN_CONFIG_ITEM_MAIL_SUBJECT_ADMIN:`Custom admin Email notification subject. Leave it blank to use the default subject.`,ADMIN_CONFIG_ITEM_MAIL_TEMPLATE:"Custom Email notification template. Leave it blank to use the default template. Fields that can be included: ${SITE_URL}, ${SITE_NAME}, ${NICK}, ${COMMENT}, ${POST_URL}, ${IMG}, ${PARENT_IMG}",ADMIN_CONFIG_ITEM_MAIL_TEMPLATE_ADMIN:"Custom admin Email notification template. Leave it blank to use the default template. Fields that can be included: ${SITE_URL}, ${SITE_NAME}, ${NICK}, ${COMMENT}, ${POST_URL}, ${IP}, ${MAIL}, ${IMG}",ADMIN_CONFIG_ITEM_MASTER_TAG:`Custom admin identifier.`,ADMIN_CONFIG_ITEM_NOTIFY_SPAM:`Notifications for spam comments. Default: true.`,ADMIN_CONFIG_ITEM_HIDE_SPAM:`Hide spam comments from everyone in the public comment section, including admins and comment authors. Comments can still be reviewed and restored in the admin panel. Set to true to enable. Default: false.`,ADMIN_CONFIG_ITEM_CAPTCHA_PROVIDER:`CAPTCHA Provider`,ADMIN_CONFIG_ITEM_TURNSTILE_SITE_KEY:`Turnstile CAPTCHA Site Key. Get from: https://dash.cloudflare.com/?to=/:account/turnstile`,ADMIN_CONFIG_ITEM_TURNSTILE_SECRET_KEY:`Turnstile CAPTCHA Secret Key`,ADMIN_CONFIG_ITEM_GEETEST_CAPTCHA_ID:`GeeTest CAPTCHA ID. Get from: https://console.geetest.com/sensbot/management`,ADMIN_CONFIG_ITEM_GEETEST_CAPTCHA_KEY:`GeeTest CAPTCHA Key`,ADMIN_CONFIG_ITEM_CAP_API_ENDPOINT:`Cap CAPTCHA API endpoint. Leave empty for built-in Cap (no extra server). External Standalone format: https://<instance_url>/<site_key>/`,ADMIN_CONFIG_ITEM_CAP_SECRET_KEY:`Cap Secret Key (external Standalone only; leave empty for built-in)`,ADMIN_CONFIG_ITEM_QCLOUD_SECRET_ID:`Tencent Cloud secret id for spam detection. When Tencent Cloud and Akismet are set at the same time, only Tencent Cloud will take effect. Register: https://twikoo.js.org/cms.html`,ADMIN_CONFIG_ITEM_QCLOUD_CMS_BIZTYPE:`Tencent Cloud Content Security Biztype name for spam comment policy. Spam blocking rules can be customized`,ADMIN_CONFIG_ITEM_QCLOUD_SECRET_KEY:`Tencent Cloud secret key.`,ADMIN_CONFIG_ITEM_LLM_API_KEY:`LLM API Key, used for AI spam comment detection. Only takes effect when Tencent Cloud and Akismet are not configured.`,ADMIN_CONFIG_ITEM_LLM_API_ENDPOINT:`LLM API endpoint URL, defaults to https://api.deepseek.com/v1`,ADMIN_CONFIG_ITEM_LLM_MODEL:`LLM model name, default: deepseek-v4-pro`,ADMIN_CONFIG_ITEM_LLM_SPAM_PROMPT:`LLM spam detection prompt (optional, uses default if left empty)`,ADMIN_CONFIG_ITEM_LLM_MAX_RETRIES:`LLM detection maximum retries (default 3)`,ADMIN_CONFIG_ITEM_PUSHOO_CHANNEL:`IM notification push channel. Support: "qmsg", "serverchan", "pushplus", "pushplushxtrip", "dingtalk", "wecom", "bark", "gocqhttp", "atri", "pushdeer", "igot", "telegram", "feishu"`,ADMIN_CONFIG_ITEM_PUSHOO_TOKEN:`IM notification push token. See https://pushoo.js.org for details`,ADMIN_CONFIG_ITEM_DISPLAYED_FIELDS:`Input boxes displayed on the interface. Default: nick,mail,link`,ADMIN_CONFIG_ITEM_REQUIRED_FIELDS:`Required fields for comments. Set to "nick,mail,link" means all fields are required. Set to "none" means all fields are optional. Default: nick,mail.`,ADMIN_CONFIG_ITEM_SC_MAIL_NOTIFY:`Whether to notify admin via IM and email at the same time, the default is to notify admin only via IM. Default: false.`,ADMIN_CONFIG_ITEM_SENDER_EMAIL:`Email address for Email notification. For most email service providers, SENDER_EMAIL must be consistent with SMTP_USER, otherwise emails cannot be sent.`,ADMIN_CONFIG_ITEM_SENDER_NAME:`The title for Email notification.`,ADMIN_CONFIG_ITEM_SHOW_EMOTION:`Enable emojis. Default: true.`,ADMIN_CONFIG_ITEM_SHOW_IMAGE:`Enable picture uploading. Default: true.`,ADMIN_CONFIG_ITEM_SHOW_ORDER:`Show sort dropdown. Default: true.`,ADMIN_CONFIG_ITEM_SHOW_DISLIKE:`Show dislike button. Default: true.`,ADMIN_CONFIG_ITEM_SHOW_UA:`Show users' OS and browser. Default: true.`,ADMIN_CONFIG_ITEM_SHOW_REGION:`Show users' IP region (province). Default: false.`,ADMIN_CONFIG_ITEM_SITE_NAME:`Website name.`,ADMIN_CONFIG_ITEM_SITE_URL:`Website URL.`,ADMIN_CONFIG_ITEM_SMTP_HOST:`Custom SMTP server address. If you have configured SMTP_SERVICE, please leave it empty.`,ADMIN_CONFIG_ITEM_SMTP_PASS:`Email notification mailbox password. Enter authorization code for QQ/163 mail.`,ADMIN_CONFIG_ITEM_SMTP_PORT:`Custom SMTP port. If you have configured SMTP_SERVICE, please leave it empty.`,ADMIN_CONFIG_ITEM_SMTP_SECURE:`Custom TLS for SMTP. Enter "true" or "false". If you have configured SMTP_SERVICE, please leave it empty.`,ADMIN_CONFIG_ITEM_SMTP_SERVICE:`Email service provider for Email notification. Support: "126", "163", "1und1", "AOL", "DebugMail", "DynectEmail", "FastMail", "GandiMail", "Gmail", "Godaddy", "GodaddyAsia", "GodaddyEurope", "Hotmail", "Mail.ru", "Maildev", "Mailgun", "Mailjet", "Mailosaur", "Mandrill", "Naver", "OpenMailBox", "Outlook365", "Postmark", "QQ", "QQex", "SES", "SES-EU-WEST-1", "SES-US-EAST-1", "SES-US-WEST-2", "SendCloud", "SendGrid", "SendPulse", "SendinBlue", "Sparkpost", "Yahoo", "Yandex", "Zoho", "hot.ee", "iCloud", "mail.ee", "qiye.aliyun"`,ADMIN_CONFIG_ITEM_SMTP_USER:`Email notification mailbox username.`,ADMIN_CONFIG_RESET:`Reset`,ADMIN_CONFIG_SAVE:`Save`,ADMIN_CREDENTIALS:`Private key file`,ADMIN_CREDENTIALS_FAQ:`How to get the private key`,ADMIN_CREDENTIALS_PLACEHOLDER:`Please paste the contents of the private key file`,ADMIN_FORGOT:`Forget your password`,ADMIN_EXPORT:`Export`,ADMIN_EXPORT_WARN:`Export all data as a JSON file. If you encounter export failures or missing data, connect to the database to export manually`,ADMIN_EXPORT_COMMENT:`Export comment`,ADMIN_EXPORT_COUNTER:`Export counter`,ADMIN_IMPORT:`Import`,ADMIN_IMPORT_FILE_REQUIRED:`No file selected`,ADMIN_IMPORT_IMPORTED:`Imported `,ADMIN_IMPORT_IMPORTING:`Importing `,ADMIN_IMPORT_LOG:`Log`,ADMIN_IMPORT_SELECT:`Select`,ADMIN_IMPORT_SELECT_FILE:`Select file`,ADMIN_IMPORT_SELECT_SOURCE:`Select source`,ADMIN_IMPORT_SOURCE_REQUIRED:`No source selected.`,ADMIN_IMPORT_START:`Start import`,ADMIN_IMPORT_STARTING:`Importing`,ADMIN_IMPORT_TIP_ARTALK:`Please upload the Artalk export file in JSON format.The file name is usually comments.data.json`,ADMIN_IMPORT_TIP_DISQUS:`Please upload the Disqus export file in XML format. The file name is usually [website name]-[export time]-all.xml`,ADMIN_IMPORT_TIP_VALINE:`Please upload the Valine export file in JSON format. The file name is usually Comment.json`,ADMIN_IMPORT_UPLOADED:`Uploaded `,ADMIN_IMPORT_UPLOADING:`Uploading `,ADMIN_IMPORT_WARN:`Import comments from other comment systems.
|
|
171
|
+
建议在导入前备份 comment 数据库。`,ADMIN_LOGIN:`登录`,ADMIN_LOGIN_TITLE:`Twikoo 评论管理`,ADMIN_LOGOUT:`退出登录`,ADMIN_NEED_UPDATE:`若要使用评论管理,请更新 Twikoo 云函数`,ADMIN_PASSWORD:`密码`,ADMIN_PASSWORD_PLACEHOLDER:`请输入`,ADMIN_PASSWORD_REQUIRED:`请输入密码`,ADMIN_REGIST:`注册`,ADMIN_REGIST_FAILED:`注册失败`,ADMIN_SET_PASSWORD:`设置密码`,ADMIN_SET_PASSWORD_CONFIRM:`确认密码`,ADMIN_SET_PASSWORD_CONFIRM_PLACEHOLDER:`确认密码`,ADMIN_SET_PASSWORD_PLACEHOLDER:`密码`,ADMIN_TITLE:`Twikoo 管理面板`,COMMENTS_SEARCH:`搜索`,COMMENTS_SEARCH_PLACEHOLDER:`搜索评论`,COMMENTS_SEARCH_NO_RESULT:`没有找到评论`,COMMENTS_SEARCH_COUNT_PREFIX:`找到 `,COMMENTS_COUNT_SUFFIX:` 条评论`,COMMENTS_SORT_NEWEST:`最新`,COMMENTS_SORT_OLDEST:`最早`,COMMENTS_SORT_POPULAR:`热门`,COMMENTS_EXPAND:`查看更多`,COMMENTS_NO_COMMENTS:`没有评论`,COMMENT_EXPAND:`展开`,COMMENT_COLLAPSE:`收起`,COMMENT_MASTER_TAG:`博主`,COMMENT_REPLIED:`回复`,COMMENT_DELETE_CONFIRM:`确认删除你的评论?`,COMMENT_REVIEWING_TAG:`审核中`,COMMENT_TOP_TAG:`置顶`,COMMENT_FAILED:`评论失败`,META_INPUT_LINK:`网址`,META_INPUT_MAIL:`邮箱`,META_INPUT_NICK:`昵称`,META_INPUT_NOT_REQUIRED:`选填`,META_INPUT_REQUIRED:`必填`,PAGINATION_COUNT_PREFIX:`共 `,PAGINATION_COUNT_SUFFIX:` 条`,PAGINATION_GOTO_PREFIX:`前往`,PAGINATION_GOTO_SUFFIX:`页`,PAGINATION_PAGESIZE:`条/页`,SUBMIT_CANCEL:`取消`,SUBMIT_PREVIEW:`预览`,SUBMIT_SEND:`发送`,IMAGE_UPLOAD_PLACEHOLDER:`图片上传中`,IMAGE_UPLOAD_FAILED:`图片上传失败`,IMAGE_UPLOAD_NSFW:`图片包含不当内容,禁止上传`,IMAGE_UPLOAD_FAILED_NO_CONF:`博主未配置图床服务`,IMAGE_UPLOAD_PLEASE_WAIT:`图片上传中,请稍候再发送`,SUBMIT_SENDING:`发送中`,TIMEAGO_DAYS:`天前`,TIMEAGO_HOURS:`小时前`,TIMEAGO_MINUTES:`分钟前`,TIMEAGO_NOW:`刚刚`,TIMEAGO_SECONDS:`秒前`},Do={ADMIN_CLIENT_VERSION:`Client version: `,ADMIN_SERVER_VERSION:`Server version: `,ADMIN_COMMENT:`Comment`,ADMIN_COMMENT_DELETE:`Delete`,ADMIN_COMMENT_DELETE_CONFIRM:`Confirm deletion?`,ADMIN_COMMENT_FILTER_ALL:`All`,ADMIN_COMMENT_FILTER_VISIBLE:`Visible`,ADMIN_COMMENT_FILTER_HIDDEN:`Hidden`,ADMIN_COMMENT_HIDE:`Hide`,ADMIN_COMMENT_IS_SPAM_SUFFIX:` (Hidden)`,ADMIN_COMMENT_SEARCH:`Search`,ADMIN_COMMENT_SEARCH_PLACEHOLDER:`Search by nick, mail, website, IP, comment, or article path`,ADMIN_COMMENT_SHOW:`Show`,ADMIN_COMMENT_TOP:`Pin`,ADMIN_COMMENT_UNTOP:`Unpin`,ADMIN_COMMENT_VIEW:`View`,ADMIN_COMMENT_SECURITY_ALERT:`The comment link is different from this site! For security reasons, please manually copy the following URL to visit:`,ADMIN_COMMENT_PARSE_ERROR:`Unable to parse comment link. Please check and manually copy the following URL:`,ADMIN_CONFIG:`Configuration`,ADMIN_CONFIG_CATEGORY_COMMON:`General`,ADMIN_CONFIG_CATEGORY_IM:`Instant notification`,ADMIN_CONFIG_CATEGORY_MAIL:`Email notification`,ADMIN_CONFIG_CATEGORY_PLUGIN:`Plugin`,ADMIN_CONFIG_CATEGORY_PRIVACY:`Privacy`,ADMIN_CONFIG_CATEGORY_SPAM:`Spam`,ADMIN_CONFIG_CATEGORY_CAPTCHA:`CAPTCHA`,ADMIN_CONFIG_IMAGE_CDN_NONE:`None (disable image upload)`,ADMIN_CONFIG_CAPTCHA_NONE:`None`,ADMIN_CONFIG_CAPTCHA_TURNSTILE:`Cloudflare Turnstile`,ADMIN_CONFIG_CAPTCHA_GEETEST:`GeeTest`,ADMIN_CONFIG_CAPTCHA_CAP:`Cap`,ADMIN_CONFIG_EMAIL_TEST:`Email notification test`,ADMIN_CONFIG_EMAIL_TEST_BTN:`Send test mail`,ADMIN_CONFIG_EMAIL_TEST_HELP:`Input an email address & send test mail`,ADMIN_CONFIG_EMAIL_TEST_RESULT:`Test result: `,ADMIN_CONFIG_EXAMPLE:`Example: `,ADMIN_CONFIG_ITEM_AKISMET_KEY:`Akismet spam protection. Set to "MANUAL_REVIEW" to enable manual review. Leave it blank to not use anti-spam. Register Akismet: https://akismet.com`,ADMIN_CONFIG_ITEM_BLOGGER_NICK:`Admin nick name.`,ADMIN_CONFIG_ITEM_BLOGGER_EMAIL:`Admin Email address. Used for Email notification and admin identification.`,ADMIN_CONFIG_ITEM_COMMENT_BG_IMG:`URL for custom background image.`,ADMIN_CONFIG_ITEM_COMMENT_PAGE_SIZE:`Comment page size. Default: 8.`,ADMIN_CONFIG_ITEM_COMMENT_PLACEHOLDER:`Comment placeholder. Use <br> to start a newline. Default: empty.`,ADMIN_CONFIG_ITEM_CORS_ALLOW_ORIGIN:`CORS allow origin, note: incorrect settings can cause loading failure. Default: blank, format: https://blog.example.com; If you need to add multiple domain names, please use, separate`,ADMIN_CONFIG_ITEM_DEFAULT_GRAVATAR:`Avatar placeholder. Default (when empty): "initials". Choose from: "404", "mp", "identicon", "monsterid", "wavatar", "retro", "robohash", "blank"`,ADMIN_CONFIG_ITEM_EMOTION_CDN:`Emoji CDN. Separate by comma. Default: https://owo.imaegoo.com/owo.json`,ADMIN_CONFIG_ITEM_FORBIDDEN_WORDS:`Configure prohibited words. Comments containing prohibited words will be auto spammed. Separate by comma.`,ADMIN_CONFIG_ITEM_BLOCKED_WORDS:`Configure blocked words. Comments containing blocked words will fail to send. Separate by comma.`,ADMIN_CONFIG_ITEM_GRAVATAR_CDN:`Custom avator CDN. (Examples: gravatar.com) Default: weavatar.com.`,ADMIN_CONFIG_ITEM_HIDE_ADMIN_CRYPT:`Set a cipher to hide the management panel entrance, only when the same cipher is entered in the nickname field the management panel entry will be displayed. Leave it blank to not hide the management entrance.`,ADMIN_CONFIG_ITEM_QQ_API_KEY:`QQ nickname API key for fetching QQ nickname. Get it from https://api.nsuuu.com/admin/key`,ADMIN_CONFIG_ITEM_HIGHLIGHT:`Enable code highlighting. If your theme conflicts with code highlighting, please set it to false. Default: true.`,ADMIN_CONFIG_ITEM_HIGHLIGHT_THEME:`Code highlighting theme. Select from: "default", "coy", "dark", "funky", "okaidia", "solarizedlight", "tomorrow", "twilight". Visit https://prismjs.com for preview. If your theme conflicts with code highlighting, please set it to none. Default: none.`,ADMIN_CONFIG_ITEM_HIGHLIGHT_PLUGIN:`Code highlight plug-in, optional: "showLanguage", "copyButton", respectively: show code language, show code copy button. Multiple options can be set at the same time, if you want to add no code highlighting plug-ins, please set it to none. Default: none. `,ADMIN_CONFIG_ITEM_IMAGE_CDN:`The image bed for image uploading. Select from: "qcloud", "7bu (https://7bu.top)", "see (https://s.ee)", "lskypro", "piclist", "easyimage", "chevereto", "S3 / R2 / MinIO"`,ADMIN_CONFIG_ITEM_IMAGE_CDN_URL:`The URL for the image bed. Required if your IMAGE_CDN is one of these: "lskypro", "piclist", "easyimage", "s3"`,ADMIN_CONFIG_ITEM_IMAGE_CDN_TOKEN:`The image bed token. Unnessessary for qcloud`,ADMIN_CONFIG_ITEM_NSFW_API_URL:`NSFW image detection API URL. Free services: nsfw.qixz.cn, project: github.com/HG-ha/nsfwpy`,ADMIN_CONFIG_ITEM_NSFW_THRESHOLD:`NSFW detection threshold (0-1). Upload will be rejected if score exceeds this value. Default: 0.5`,ADMIN_CONFIG_ITEM_S3_REGION:`S3 region, e.g. us-east-1. Can be any value when using S3-compatible services (e.g. Cloudflare R2, MinIO)`,ADMIN_CONFIG_ITEM_S3_BUCKET:`S3 bucket name`,ADMIN_CONFIG_ITEM_S3_ACCESS_KEY_ID:`S3 Access Key ID`,ADMIN_CONFIG_ITEM_S3_SECRET_ACCESS_KEY:`S3 Secret Access Key`,ADMIN_CONFIG_ITEM_S3_ENDPOINT:`S3 custom endpoint. Required when using S3-compatible services like Cloudflare R2 or MinIO`,ADMIN_CONFIG_ITEM_S3_FORCE_PATH_STYLE:`When S3_ENDPOINT is set, whether to append S3_BUCKET to the upload URL path. Default: true. Use true for Cloudflare R2, MinIO, and other path-style S3-compatible endpoints; set false for bucket-bound custom domains, such as Tencent Cloud COS custom domains.`,ADMIN_CONFIG_ITEM_S3_CDN_URL:`S3 image access domain (CDN domain). Leave empty to use default S3/Endpoint URL`,ADMIN_CONFIG_ITEM_S3_PATH_PREFIX:`S3 image storage path prefix, e.g. images/twikoo. Leave empty to store in root`,ADMIN_CONFIG_ITEM_LIGHTBOX:`Use simple Lightbox effect. Default: false`,ADMIN_CONFIG_ITEM_LIMIT_PER_MINUTE:`How many comments can be posted by each IP every 10 minutes, 0 is unlimited, default: 10.`,ADMIN_CONFIG_ITEM_LIMIT_PER_MINUTE_ALL:`How many comments can be posted by all IPs every 10 minutes, 0 is unlimited, default: 10.`,ADMIN_CONFIG_ITEM_LIMIT_LENGTH:`Comment length limitation, 0 is unlimited, default: 500.`,ADMIN_CONFIG_ITEM_MAIL_SUBJECT:`Custom Email notification subject. Leave it blank to use the default subject.`,ADMIN_CONFIG_ITEM_MAIL_SUBJECT_ADMIN:`Custom admin Email notification subject. Leave it blank to use the default subject.`,ADMIN_CONFIG_ITEM_MAIL_TEMPLATE:"Custom Email notification template. Leave it blank to use the default template. Fields that can be included: ${SITE_URL}, ${SITE_NAME}, ${NICK}, ${COMMENT}, ${POST_URL}, ${IMG}, ${PARENT_IMG}",ADMIN_CONFIG_ITEM_MAIL_TEMPLATE_ADMIN:"Custom admin Email notification template. Leave it blank to use the default template. Fields that can be included: ${SITE_URL}, ${SITE_NAME}, ${NICK}, ${COMMENT}, ${POST_URL}, ${IP}, ${MAIL}, ${IMG}",ADMIN_CONFIG_ITEM_MASTER_TAG:`Custom admin identifier.`,ADMIN_CONFIG_ITEM_NOTIFY_SPAM:`Notifications for spam comments. Default: true.`,ADMIN_CONFIG_ITEM_HIDE_SPAM:`Hide spam comments from everyone in the public comment section, including admins and comment authors. Comments can still be reviewed and restored in the admin panel. Set to true to enable. Default: false.`,ADMIN_CONFIG_ITEM_CAPTCHA_PROVIDER:`CAPTCHA Provider`,ADMIN_CONFIG_ITEM_TURNSTILE_SITE_KEY:`Turnstile CAPTCHA Site Key. Get from: https://dash.cloudflare.com/?to=/:account/turnstile`,ADMIN_CONFIG_ITEM_TURNSTILE_SECRET_KEY:`Turnstile CAPTCHA Secret Key`,ADMIN_CONFIG_ITEM_GEETEST_CAPTCHA_ID:`GeeTest CAPTCHA ID. Get from: https://console.geetest.com/sensbot/management`,ADMIN_CONFIG_ITEM_GEETEST_CAPTCHA_KEY:`GeeTest CAPTCHA Key`,ADMIN_CONFIG_ITEM_CAP_API_ENDPOINT:`Cap CAPTCHA API endpoint. Leave empty for built-in Cap (no extra server). External Standalone format: https://<instance_url>/<site_key>/`,ADMIN_CONFIG_ITEM_CAP_SECRET_KEY:`Cap Secret Key (external Standalone only; leave empty for built-in)`,ADMIN_CONFIG_ITEM_QCLOUD_SECRET_ID:`Tencent Cloud secret id for spam detection. When Tencent Cloud and Akismet are set at the same time, only Tencent Cloud will take effect. Register: https://twikoo.js.org/cms.html`,ADMIN_CONFIG_ITEM_QCLOUD_CMS_BIZTYPE:`Tencent Cloud Content Security Biztype name for spam comment policy. Spam blocking rules can be customized`,ADMIN_CONFIG_ITEM_QCLOUD_SECRET_KEY:`Tencent Cloud secret key.`,ADMIN_CONFIG_ITEM_LLM_API_KEY:`LLM API Key, used for AI spam comment detection. Only takes effect when Tencent Cloud and Akismet are not configured.`,ADMIN_CONFIG_ITEM_LLM_API_ENDPOINT:`LLM API endpoint URL, defaults to https://api.deepseek.com/v1`,ADMIN_CONFIG_ITEM_LLM_MODEL:`LLM model name, default: deepseek-v4-pro`,ADMIN_CONFIG_ITEM_LLM_SPAM_PROMPT:`LLM spam detection prompt (optional, uses default if left empty)`,ADMIN_CONFIG_ITEM_LLM_MAX_RETRIES:`LLM detection maximum retries (default 3)`,ADMIN_CONFIG_ITEM_PUSHOO_CHANNEL:`IM notification push channel. Support: "qmsg", "serverchan", "pushplus", "pushplushxtrip", "dingtalk", "wecom", "bark", "gocqhttp", "atri", "pushdeer", "igot", "telegram", "feishu"`,ADMIN_CONFIG_ITEM_PUSHOO_TOKEN:`IM notification push token. See https://pushoo.js.org for details`,ADMIN_CONFIG_ITEM_DISPLAYED_FIELDS:`Input boxes displayed on the interface. Default: nick,mail,link`,ADMIN_CONFIG_ITEM_REQUIRED_FIELDS:`Required fields for comments. Set to "nick,mail,link" means all fields are required. Set to "none" means all fields are optional. Default: nick,mail.`,ADMIN_CONFIG_ITEM_SC_MAIL_NOTIFY:`Whether to notify admin via IM and email at the same time, the default is to notify admin only via IM. Default: false.`,ADMIN_CONFIG_ITEM_SENDER_EMAIL:`Email address for Email notification. For most email service providers, SENDER_EMAIL must be consistent with SMTP_USER, otherwise emails cannot be sent.`,ADMIN_CONFIG_ITEM_SENDER_NAME:`The title for Email notification.`,ADMIN_CONFIG_ITEM_SHOW_EMOTION:`Enable emojis. Default: true.`,ADMIN_CONFIG_ITEM_SHOW_IMAGE:`Enable picture uploading. Default: true.`,ADMIN_CONFIG_ITEM_SHOW_ORDER:`Show sort dropdown. Default: true.`,ADMIN_CONFIG_ITEM_SHOW_DISLIKE:`Show dislike button. Default: true.`,ADMIN_CONFIG_ITEM_SHOW_UA:`Show users' OS and browser. Default: true.`,ADMIN_CONFIG_ITEM_SHOW_REGION:`Show users' IP region (province). Default: false.`,ADMIN_CONFIG_ITEM_SITE_NAME:`Website name.`,ADMIN_CONFIG_ITEM_SITE_URL:`Website URL.`,ADMIN_CONFIG_ITEM_SMTP_HOST:`Custom SMTP server address. If you have configured SMTP_SERVICE, please leave it empty.`,ADMIN_CONFIG_ITEM_SMTP_PASS:`Email notification mailbox password. Enter authorization code for QQ/163 mail.`,ADMIN_CONFIG_ITEM_SMTP_PORT:`Custom SMTP port. If you have configured SMTP_SERVICE, please leave it empty.`,ADMIN_CONFIG_ITEM_SMTP_SECURE:`Custom TLS for SMTP. Enter "true" or "false". If you have configured SMTP_SERVICE, please leave it empty.`,ADMIN_CONFIG_ITEM_SMTP_SERVICE:`Email service provider for Email notification. Support: "126", "163", "1und1", "AOL", "DebugMail", "DynectEmail", "FastMail", "GandiMail", "Gmail", "Godaddy", "GodaddyAsia", "GodaddyEurope", "Hotmail", "Mail.ru", "Maildev", "Mailgun", "Mailjet", "Mailosaur", "Mandrill", "Naver", "OpenMailBox", "Outlook365", "Postmark", "QQ", "QQex", "SES", "SES-EU-WEST-1", "SES-US-EAST-1", "SES-US-WEST-2", "SendCloud", "SendGrid", "SendPulse", "SendinBlue", "Sparkpost", "Yahoo", "Yandex", "Zoho", "hot.ee", "iCloud", "mail.ee", "qiye.aliyun"`,ADMIN_CONFIG_ITEM_SMTP_USER:`Email notification mailbox username.`,ADMIN_CONFIG_RESET:`Reset`,ADMIN_CONFIG_SAVE:`Save`,ADMIN_CONFIG_EXPORT:`Export Config`,ADMIN_CONFIG_IMPORT:`Import Config`,ADMIN_CONFIG_IMPORT_FAILED:`Config import failed: `,ADMIN_CONFIG_IMPORT_INVALID:`Invalid config file format`,ADMIN_CONFIG_IMPORT_SOURCE_INVALID:`Config import only supports files exported by Twikoo. Please select Twikoo as the source system.`,ADMIN_CONFIG_IMPORTED:`Config imported`,ADMIN_CONFIG_IMPORTING:`Importing config`,ADMIN_CREDENTIALS:`Private key file`,ADMIN_CREDENTIALS_FAQ:`How to get the private key`,ADMIN_CREDENTIALS_PLACEHOLDER:`Please paste the contents of the private key file`,ADMIN_FORGOT:`Forget your password`,ADMIN_EXPORT:`Export`,ADMIN_EXPORT_WARN:`Export all data as a JSON file. If you encounter export failures or missing data, connect to the database to export manually`,ADMIN_EXPORT_COMMENT:`Export comment`,ADMIN_EXPORT_COUNTER:`Export counter`,ADMIN_IMPORT:`Import`,ADMIN_IMPORT_FILE_REQUIRED:`No file selected`,ADMIN_IMPORT_IMPORTED:`Imported `,ADMIN_IMPORT_IMPORTING:`Importing `,ADMIN_IMPORT_LOG:`Log`,ADMIN_IMPORT_SELECT:`Select`,ADMIN_IMPORT_SELECT_FILE:`Select file`,ADMIN_IMPORT_SELECT_SOURCE:`Select source`,ADMIN_IMPORT_SOURCE_REQUIRED:`No source selected.`,ADMIN_IMPORT_START:`Start import`,ADMIN_IMPORT_COMMENT:`Import comments`,ADMIN_IMPORT_STARTING:`Importing`,ADMIN_IMPORT_TIP_ARTALK:`Please upload the Artalk export file in JSON format.The file name is usually comments.data.json`,ADMIN_IMPORT_TIP_DISQUS:`Please upload the Disqus export file in XML format. The file name is usually [website name]-[export time]-all.xml`,ADMIN_IMPORT_TIP_VALINE:`Please upload the Valine export file in JSON format. The file name is usually Comment.json`,ADMIN_IMPORT_UPLOADED:`Uploaded `,ADMIN_IMPORT_UPLOADING:`Uploading `,ADMIN_IMPORT_WARN:`Import comments from other comment systems.
|
|
172
172
|
The data is safe, and the import function is performed entirely in your cloud environment.
|
|
173
173
|
Please backup your comment database before importing.`,ADMIN_LOGIN:`Sign in`,ADMIN_LOGIN_TITLE:`Twikoo Management Panel`,ADMIN_LOGOUT:`Sign out`,ADMIN_NEED_UPDATE:`A new version of Twikoo is required for comment management.`,ADMIN_PASSWORD:`Password`,ADMIN_PASSWORD_PLACEHOLDER:`Enter your password...`,ADMIN_PASSWORD_REQUIRED:`Please enter your password`,ADMIN_REGIST:`Register`,ADMIN_REGIST_FAILED:`Register failed`,ADMIN_SET_PASSWORD:`Set password`,ADMIN_SET_PASSWORD_CONFIRM:`Confirm password`,ADMIN_SET_PASSWORD_CONFIRM_PLACEHOLDER:`Confirm password...`,ADMIN_SET_PASSWORD_PLACEHOLDER:`Password`,ADMIN_TITLE:`Twikoo Management Panel`,COMMENTS_SEARCH:`Search`,COMMENTS_SEARCH_PLACEHOLDER:`Search comments`,COMMENTS_SEARCH_NO_RESULT:`No comments found`,COMMENTS_SEARCH_COUNT_PREFIX:`Found `,COMMENTS_COUNT_SUFFIX:` comments`,COMMENTS_SORT_NEWEST:`Newest`,COMMENTS_SORT_OLDEST:`Oldest`,COMMENTS_SORT_POPULAR:`Popular`,COMMENTS_EXPAND:`Load more`,COMMENTS_NO_COMMENTS:`No comment`,COMMENT_EXPAND:`Read more`,COMMENT_COLLAPSE:`Collapse`,COMMENT_MASTER_TAG:`Admin`,COMMENT_REPLIED:`Reply`,COMMENT_DELETE_CONFIRM:`Delete your comment?`,COMMENT_REVIEWING_TAG:`Pending`,COMMENT_TOP_TAG:`Pinned`,COMMENT_FAILED:`Comment failed`,META_INPUT_LINK:`Website`,META_INPUT_MAIL:`Email`,META_INPUT_NICK:`Nickname`,META_INPUT_NOT_REQUIRED:`Optional`,META_INPUT_REQUIRED:`Required`,PAGINATION_COUNT_PREFIX:``,PAGINATION_COUNT_SUFFIX:` entries`,PAGINATION_GOTO_PREFIX:`Goto page`,PAGINATION_GOTO_SUFFIX:``,PAGINATION_PAGESIZE:`entries/page`,SUBMIT_CANCEL:`Cancel`,SUBMIT_PREVIEW:`Preview`,SUBMIT_SEND:`Send`,IMAGE_UPLOAD_PLACEHOLDER:`Uploading image`,IMAGE_UPLOAD_FAILED:`IMAGE UPLOAD FAILED`,IMAGE_UPLOAD_NSFW:`Image contains inappropriate content, upload rejected`,IMAGE_UPLOAD_FAILED_NO_CONF:`The blogger didn't configured any image bed service`,IMAGE_UPLOAD_PLEASE_WAIT:`Uploading image, please try again later`,SUBMIT_SENDING:`Sending`,TIMEAGO_DAYS:`days ago`,TIMEAGO_HOURS:`hours ago`,TIMEAGO_MINUTES:`minutes ago`,TIMEAGO_NOW:`Just now`,TIMEAGO_SECONDS:`seconds ago`},Oo=`en`,ko={"zh-CN":Eo,en:Do},Ao={},jo={zh:`zh-CN`,"zh-cn":`zh-CN`,"zh-hk":`zh-HK`,"zh-tw":`zh-TW`,en:`en`,"en-us":`en`,"en-gb":`en`,uz:`uz-UZ`,"uz-uz":`uz-UZ`,ja:`ja-JP`,"ja-jp":`ja-JP`,ko:`ko-KR`,"ko-kr":`ko-KR`,vi:`vi-VN`,"vi-vn":`vi-VN`,id:`id-ID`,"id-id":`id-ID`},Mo=Oo,No=``;function Po(){if(typeof document>`u`)return``;let e=document.currentScript?.src??``;if(!e){let t=document.querySelectorAll(`script[src]`);for(let n=t.length-1;n>=0;--n){let r=t[n].src;if(/twikoo/i.test(r)){e=r;break}}}return e?e.slice(0,e.lastIndexOf(`/`)):``}function Fo(e={}){let t=e.lang?.toLowerCase(),n=typeof navigator>`u`?void 0:navigator.language?.toLowerCase();return t&&jo[t]||n&&jo[n]||Oo}async function Io(e={}){let t=Fo(e);if(Mo=t,ko[t]||Ao[t])return;let n=(e.localeBaseUrl||No||Po()).replace(/\/+$/,``);if(!n){console.warn(`[twikoo] 无法推导语言分片基址,${t} 回退英文`);return}let r=`${n}/locales/${t}.js`;try{let e=await import(r),n=e.default??e;n&&typeof n==`object`?Ao[t]=n:console.warn(`[twikoo] 语言分片 ${t} 形态异常,回退英文`)}catch(e){console.warn(`[twikoo] 语言分片 ${r} 加载失败,回退英文:`,e instanceof Error?e.message:String(e))}}function W(e,t){let n=t&&jo[t.toLowerCase()]||Mo;return(Ao[n]??ko[n])?.[e]??ko[Oo]?.[e]??``}function Lo(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ro(e){if(Array.isArray(e))return e}function zo(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Bo(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
174
174
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Vo(e,t){return Ro(e)||zo(e,t)||Ho(e,t)||Bo()}function Ho(e,t){if(e){if(typeof e==`string`)return Lo(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Lo(e,t):void 0}}var Uo=Object.entries,Wo=Object.setPrototypeOf,Go=Object.isFrozen,Ko=Object.getPrototypeOf,qo=Object.getOwnPropertyDescriptor,Jo=Object.freeze,Yo=Object.seal,Xo=Object.create,Zo=typeof Reflect<`u`&&Reflect,Qo=Zo.apply,$o=Zo.construct;Jo||=function(e){return e},Yo||=function(e){return e},Qo||=function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return e.apply(t,r)},$o||=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)};var es=bs(Array.prototype.forEach),ts=bs(Array.prototype.lastIndexOf),ns=bs(Array.prototype.pop),rs=bs(Array.prototype.push),is=bs(Array.prototype.splice),as=Array.isArray,os=bs(String.prototype.toLowerCase),ss=bs(String.prototype.toString),cs=bs(String.prototype.match),ls=bs(String.prototype.replace),us=bs(String.prototype.indexOf),ds=bs(String.prototype.trim),fs=bs(Number.prototype.toString),ps=bs(Boolean.prototype.toString),ms=typeof BigInt>`u`?null:bs(BigInt.prototype.toString),hs=typeof Symbol>`u`?null:bs(Symbol.prototype.toString),gs=bs(Object.prototype.hasOwnProperty),_s=bs(Object.prototype.toString),vs=bs(RegExp.prototype.test),ys=xs(TypeError);function bs(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return Qo(e,t,r)}}function xs(e){return function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return $o(e,n)}}function Ss(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:os;if(Wo&&Wo(e,null),!as(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Go(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Cs(e){for(let t=0;t<e.length;t++)gs(e,t)||(e[t]=null);return e}function ws(e){let t=Xo(null);for(let r of Uo(e)){var n=Vo(r,2);let i=n[0],a=n[1];gs(e,i)&&(t[i]=as(a)?Cs(a):a&&typeof a==`object`&&a.constructor===Object?ws(a):a)}return t}function Ts(e){switch(typeof e){case`string`:return e;case`number`:return fs(e);case`boolean`:return ps(e);case`bigint`:return ms?ms(e):`0`;case`symbol`:return hs?hs(e):`Symbol()`;case`undefined`:return _s(e);case`function`:case`object`:{if(e===null)return _s(e);let t=e,n=Es(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:_s(e)}return _s(e)}default:return _s(e)}}function Es(e,t){for(;e!==null;){let n=qo(e,t);if(n){if(n.get)return bs(n.get);if(typeof n.value==`function`)return bs(n.value)}e=Ko(e)}function n(){return null}return n}function Ds(e){try{return vs(e,``),!0}catch{return!1}}var Os=Jo(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),ks=Jo(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),As=Jo([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),js=Jo([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),Ms=Jo(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),Ns=Jo([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Ps=Jo([`#text`]),Fs=Jo(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),Is=Jo(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),Ls=Jo(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),Rs=Jo([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),zs=Yo(/{{[\w\W]*|^[\w\W]*}}/g),Bs=Yo(/<%[\w\W]*|^[\w\W]*%>/g),Vs=Yo(/\${[\w\W]*/g),Hs=Yo(/^data-[\-\w.\u00B7-\uFFFF]+$/),Us=Yo(/^aria-[\-\w]+$/),Ws=Yo(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Gs=Yo(/^(?:\w+script|data):/i),Ks=Yo(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),qs=Yo(/^html$/i),Js=Yo(/^[a-z][.\w]*(-[.\w]+)+$/i),Ys=Yo(/<[/\w!]/g),Xs=Yo(/<[/\w]/g),Zs=Yo(/<\/no(script|embed|frames)/i),Qs=Yo(/\/>/i),$s={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},ec=[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`],tc=Jo(Ss({},ec)),nc=function(){let e={};return es(ec,t=>{e[t]=Yo(RegExp(`</`+t+`(?=[\\t\\n\\f\\r />])`,`i`))}),Jo(e)}(),rc=function(){return typeof window>`u`?null:window},ic=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},ac=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},oc=function(e,t,n,r){return gs(e,t)&&as(e[t])?Ss(r.base?ws(r.base):{},e[t],r.transform):n},sc=function(e,t,n){let r=gs(e,t)?e[t]:void 0;return r&&typeof r==`object`?ws(r):n()};function cc(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:rc(),t=e=>cc(e);if(t.version=`3.4.15`,t.removed=[],!e||!e.document||e.document.nodeType!==$s.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=Es(d,`cloneNode`),p=Es(d,`remove`),m=Es(d,`removeAttributeNode`),h=Es(d,`nextSibling`),g=Es(d,`childNodes`),_=Es(d,`parentNode`),v=Es(d,`shadowRoot`),y=Es(d,`attributes`),b=o&&o.prototype?Es(o.prototype,`nodeType`):null,x=o&&o.prototype?Es(o.prototype,`nodeName`):null,S=o&&o.prototype?Es(o.prototype,`ownerDocument`):null,C=function(e){return b?b(e):e.nodeType},w=function(e){return x?x(e):e.nodeName};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let T,E=``,D,ee=!1,te=0,O=function(){if(te>0)throw ys(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},k=function(e){O(),te++;try{return T.createHTML(e)}finally{te--}},A=function(e){O(),te++;try{return T.createScriptURL(e)}finally{te--}},ne=function(){return ee||=(D=ic(u,i),!0),D},re=n,ie=re.implementation,ae=re.createNodeIterator,oe=re.createDocumentFragment,se=re.getElementsByTagName,ce=r.importNode,le=ac();t.isSupported=typeof Uo==`function`&&typeof _==`function`&&ie&&ie.createHTMLDocument!==void 0;let ue=zs,de=Bs,fe=Vs,pe=Hs,me=Us,he=Gs,ge=Ks,_e=Js,ve=Ws,j=null,ye=Ss({},[...Os,...ks,...As,...Ms,...Ps]),be=null,xe=Ss({},[...Fs,...Is,...Ls,...Rs]),Se=Object.seal(Xo(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ce=null,we=null,Te=Object.seal(Xo(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),M=!0,Ee=!0,N=!1,P=!0,De=!1,Oe=!0,ke=!1,Ae=!1,je=null,Me=null,Ne=!1,Pe=!1,Fe=!1,Ie=!1,Le=!0,Re=!1,ze=`user-content-`,Be=!0,Ve=!1,He={},Ue=null,We=Ss({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Ge=null,Ke=Ss({},[`audio`,`video`,`img`,`source`,`image`,`track`]),qe=null,Je=Ss({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Ye=`http://www.w3.org/1998/Math/MathML`,F=`http://www.w3.org/2000/svg`,Xe=`http://www.w3.org/1999/xhtml`,Ze=Xe,Qe=!1,$e=null,et=Ss({},[Ye,F,Xe],ss),I=Jo([`mi`,`mo`,`mn`,`ms`,`mtext`]),tt=Ss({},I),L=Jo([`annotation-xml`]),R=Ss({},L),nt=Ss({},[`title`,`style`,`font`,`a`,`script`]),rt=null,it=[`application/xhtml+xml`,`text/html`],at=null,z=null,ot=n.createElement(`form`),st=function(e){return e instanceof RegExp||e instanceof Function},ct=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(z&&z===e)return;(!e||typeof e!=`object`)&&(e={}),e=ws(e),rt=it.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,at=rt===`application/xhtml+xml`?ss:os,j=oc(e,`ALLOWED_TAGS`,ye,{transform:at}),be=oc(e,`ALLOWED_ATTR`,xe,{transform:at}),$e=oc(e,`ALLOWED_NAMESPACES`,et,{transform:ss}),qe=oc(e,`ADD_URI_SAFE_ATTR`,Je,{transform:at,base:Je}),Ge=oc(e,`ADD_DATA_URI_TAGS`,Ke,{transform:at,base:Ke}),Ue=oc(e,`FORBID_CONTENTS`,We,{transform:at}),Ce=oc(e,`FORBID_TAGS`,ws({}),{transform:at}),we=oc(e,`FORBID_ATTR`,ws({}),{transform:at}),He=gs(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?ws(e.USE_PROFILES):e.USE_PROFILES:!1,M=e.ALLOW_ARIA_ATTR!==!1,Ee=e.ALLOW_DATA_ATTR!==!1,N=e.ALLOW_UNKNOWN_PROTOCOLS||!1,P=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,De=e.SAFE_FOR_TEMPLATES||!1,Oe=e.SAFE_FOR_XML!==!1,ke=e.WHOLE_DOCUMENT||!1,Pe=e.RETURN_DOM||!1,Fe=e.RETURN_DOM_FRAGMENT||!1,Ie=e.RETURN_TRUSTED_TYPE||!1,Ne=e.FORCE_BODY||!1,Le=e.SANITIZE_DOM!==!1,Re=e.SANITIZE_NAMED_PROPS||!1,Be=e.KEEP_CONTENT!==!1,Ve=e.IN_PLACE||!1,ve=Ds(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Ws,Ze=typeof e.NAMESPACE==`string`?e.NAMESPACE:Xe,tt=sc(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>Ss({},I)),R=sc(e,`HTML_INTEGRATION_POINTS`,()=>Ss({},L));let t=sc(e,`CUSTOM_ELEMENT_HANDLING`,()=>Xo(null));if(Se=Xo(null),gs(t,`tagNameCheck`)&&st(t.tagNameCheck)&&(Se.tagNameCheck=t.tagNameCheck),gs(t,`attributeNameCheck`)&&st(t.attributeNameCheck)&&(Se.attributeNameCheck=t.attributeNameCheck),gs(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(Se.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),Yo(Se),De&&(Ee=!1),Fe&&(Pe=!0),He&&(j=Ss({},Ps),be=Xo(null),He.html===!0&&(Ss(j,Os),Ss(be,Fs)),He.svg===!0&&(Ss(j,ks),Ss(be,Is),Ss(be,Rs)),He.svgFilters===!0&&(Ss(j,As),Ss(be,Is),Ss(be,Rs)),He.mathMl===!0&&(Ss(j,Ms),Ss(be,Ls),Ss(be,Rs))),Te.tagCheck=null,Te.attributeCheck=null,gs(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?Te.tagCheck=e.ADD_TAGS:as(e.ADD_TAGS)&&(j===ye&&(j=ws(j)),Ss(j,e.ADD_TAGS,at))),gs(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?Te.attributeCheck=e.ADD_ATTR:as(e.ADD_ATTR)&&(be===xe&&(be=ws(be)),Ss(be,e.ADD_ATTR,at))),gs(e,`ADD_FORBID_CONTENTS`)&&as(e.ADD_FORBID_CONTENTS)&&(Ue===We&&(Ue=ws(Ue)),Ss(Ue,e.ADD_FORBID_CONTENTS,at)),Be&&(j[`#text`]=!0),ke&&Ss(j,[`html`,`head`,`body`]),j.table&&(Ss(j,[`tbody`]),delete Ce.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw ys(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw ys(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=T;T=e.TRUSTED_TYPES_POLICY;try{E=k(``)}catch(e){throw T=t,e}}else e.TRUSTED_TYPES_POLICY===null?(T=void 0,E=``):(T===void 0&&(T=ne()),T&&typeof E==`string`&&(E=k(``)));Jo&&Jo(e),z=e},lt=Ss({},[...ks,...As,...js]),ut=Ss({},[...Ms,...Ns]),dt=function(e,t,n){return t.namespaceURI===Xe?e===`svg`:t.namespaceURI===Ye?e===`svg`&&(n===`annotation-xml`||tt[n]):!!lt[e]},ft=function(e,t,n){return t.namespaceURI===Xe?e===`math`:t.namespaceURI===F?e===`math`&&R[n]:!!ut[e]},pt=function(e,t,n){return t.namespaceURI===F&&!R[n]||t.namespaceURI===Ye&&!tt[n]?!1:!ut[e]&&(nt[e]||!lt[e])},mt=function(e){let t=_(e);(!t||!t.tagName)&&(t={namespaceURI:Ze,tagName:`template`});let n=os(e.tagName),r=os(t.tagName);return $e[e.namespaceURI]?e.namespaceURI===F?dt(n,t,r):e.namespaceURI===Ye?ft(n,t,r):e.namespaceURI===Xe?pt(n,t,r):!!(rt===`application/xhtml+xml`&&$e[e.namespaceURI]):!1},ht=function(e){rs(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw ys(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},gt=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},_t=function(e){bt(e);let t=g(e);if(t){let e=[];es(t,t=>{rs(e,t)}),es(e,e=>{try{p(e)}catch{}})}let n=y(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&>(e,r,i)}},vt=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}rs(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`){if(Pe||Fe)try{ht(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},yt=function(e){let t=y(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||be[at(i)]||gt(e,r,i)}},bt=function(e){let t=[e];for(;t.length>0;){let e=t.pop();C(e)===$s.element&&yt(e);let n=g(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},xt=function(e,t){return Oe?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},St=function(e){if(!Oe)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=C(e);if(n===$s.processingInstruction||n===$s.comment&&vs(Xs,e.data)){try{p(e)}catch{}continue}if(n===$s.element){let t=e,n=at(w(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&xt(`for`,n)&&t.removeAttribute(`for`)}catch{}}let r=g(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},Ct=function(e){let t=null,r=null;if(Ne)e=`<remove></remove>`+e;else{let t=cs(e,/^[\r\n\t ]+/);r=t&&t[0]}rt===`application/xhtml+xml`&&Ze===Xe&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=T?k(e):e;if(Ze===Xe)try{t=new l().parseFromString(i,rt)}catch{}if(!t||!t.documentElement){t=ie.createDocument(Ze,`template`,null);try{t.documentElement.innerHTML=Qe?E:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Ze===Xe?se.call(t,ke?`html`:`body`)[0]:ke?t.documentElement:a},wt=function(e){let t=S?S(e):e.ownerDocument;return ae.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},B=function(e){return e=ls(e,ue,` `),e=ls(e,de,` `),e=ls(e,fe,` `),e},Tt=function(e){e.normalize();let t=S?S(e):e.ownerDocument,n=ae.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=B(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&es(i,e=>{H(e.content)&&Tt(e.content)})},V=function(e){let t=x?x(e):null;return typeof t!=`string`||at(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==y(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==g(e)},H=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===$s.documentFragment}catch{return!1}},U=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function Et(e,n,r){e.length!==0&&es(e,e=>{e.call(t,n,r,z)})}let Dt=function(e,t){return!!(Oe&&e.hasChildNodes()&&!U(e.firstElementChild)&&vs(Ys,e.textContent)&&vs(Ys,e.innerHTML)||Oe&&e.namespaceURI===Xe&&tc[t]&&(U(e.firstElementChild)||typeof e.textContent==`string`&&vs(nc[t],e.textContent))||e.nodeType===$s.processingInstruction||Oe&&e.nodeType===$s.comment&&vs(Xs,e.data))},Ot=function(e,t){if(e instanceof RegExp)return vs(e,t);if(e instanceof Function){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return!!e(t,...r)}return!1},kt=function(e,t,n){if(!Ce[t]&&Ft(t)&&Ot(Se.tagNameCheck,t))return!1;if(Be&&!Ue[t]){let t=_(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return ht(e),!0},At=function(e,t,n,r){return e.length===0?t:t===n||t===r?ws(t):t},jt=function(e,t){return e===t||_(e)!==null?!1:(Ve&&bt(e),!0)},Mt=function(e,n){if(Et(le.beforeSanitizeElements,e,null),jt(e,n))return!0;if(V(e))return ht(e),!0;let r=at(w(e));if(j=At(le.uponSanitizeElement,j,ye,je),Et(le.uponSanitizeElement,e,{tagName:r,allowedTags:j}),jt(e,n))return!0;if(Dt(e,r))return ht(e),!0;if(Ce[r]||!(Te.tagCheck instanceof Function&&Te.tagCheck(r))&&!j[r]){let t=kt(e,r,n);return t===!1&&Et(le.afterSanitizeElements,e,null),t}if(C(e)===$s.element&&!mt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&vs(Zs,e.innerHTML))return ht(e),!0;if(De&&e.nodeType===$s.text){let n=B(e.textContent);e.textContent!==n&&(rs(t.removed,{element:e.cloneNode()}),e.textContent=n)}return Et(le.afterSanitizeElements,e,null),!1},Nt=function(e,t,r){if(we[t]||xt(t,e)||Le&&(t===`id`||t===`name`)&&(r in n||r in ot))return!1;let i=be[t]||Te.attributeCheck instanceof Function&&Te.attributeCheck(t,e);return Ee&&vs(pe,t)||M&&vs(me,t)?!0:i?qe[t]||vs(ve,ls(r,ge,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&us(r,`data:`)===0&&Ge[e]||N&&!vs(he,ls(r,ge,``))?!0:!r:Ft(e)&&Ot(Se.tagNameCheck,e)&&Ot(Se.attributeNameCheck,t,e)||t===`is`&&Se.allowCustomizedBuiltInElements&&Ot(Se.tagNameCheck,r)},Pt=Ss({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Ft=function(e){return!Pt[os(e)]&&vs(_e,e)},It=function(e,t,n,r){if(T&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return k(r);case`TrustedScriptURL`:return A(r)}return r},Lt=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!V(e)||(ht(e),!1)}catch{return vt(t,e),!1}},Rt=function(e){Et(le.beforeSanitizeAttributes,e,null);let n=e.attributes;if(!n||V(e))return;be=At(le.uponSanitizeAttribute,be,xe,Me);let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:be,forceKeepAttr:void 0},i=n.length,a=at(e.nodeName);for(;i--;){let o=n[i],s=o.name,c=o.namespaceURI,l=o.value,u=at(s),d=l,f=s===`value`?d:ds(d),p=!1;if(r.attrName=u,r.attrValue=f,r.keepAttr=!0,r.forceKeepAttr=void 0,Et(le.uponSanitizeAttribute,e,r),f=r.attrValue,Re&&(u===`id`||u===`name`)&&us(f,ze)!==0&&(vt(s,e,o),f=ze+f,p=!0),Oe&&vs(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)){vt(s,e,o);continue}if(u===`attributename`&&cs(f,`href`)){vt(s,e,o);continue}if(!r.forceKeepAttr){if(!r.keepAttr){vt(s,e,o);continue}if(!P&&vs(Qs,f)){vt(s,e,o);continue}if(De&&(f=B(f)),!Nt(a,u,f)){vt(s,e,o);continue}f=It(a,u,c,f),f!==d&&Lt(e,s,c,f)&&p&&ns(t.removed)}}Et(le.afterSanitizeAttributes,e,null)},zt=function(e){let t=null,n=wt(e);for(Et(le.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(Et(le.uponSanitizeShadowNode,t,null),Mt(t,e),Rt(t),H(t.content)&&zt(t.content),C(t)===$s.element){let e=v(t);H(e)&&(Bt(e),zt(e))}Et(le.afterSanitizeShadowDOM,e,null)},Bt=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){zt(e.shadow);continue}let n=e.node,r=C(n)===$s.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=x?x(n):null;if(typeof e==`string`&&at(e)===`template`){let e=n.content;H(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);H(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(Qe=!e,Qe&&(e=`<!-->`),typeof e!=`string`&&!U(e)&&(e=Ts(e),typeof e!=`string`))throw ys(`dirty is not a string, aborting`);if(!t.isSupported)return e;Ae?(j=je,be=Me):ct(n),(le.uponSanitizeElement.length>0||le.uponSanitizeAttribute.length>0)&&(j=ws(j)),le.uponSanitizeAttribute.length>0&&(be=ws(be)),t.removed=[];let c=Ve&&typeof e!=`string`&&U(e);if(c){St(e);let t=w(e);if(typeof t==`string`){let n=at(t);if(!j[n]||Ce[n])throw _t(e),ys(`root node is forbidden and cannot be sanitized in-place`)}if(V(e))throw _t(e),ys(`root node is clobbered and cannot be sanitized in-place`);try{Bt(e)}catch(t){throw _t(e),t}}else if(U(e))i=Ct(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===$s.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Bt(i);else{if(!Pe&&!De&&!ke&&e.indexOf(`<`)===-1)return T&&Ie?k(e):e;if(i=Ct(e),!i)return Pe?null:Ie?E:``}i&&Ne&&ht(i.firstChild);let l=c?e:i;try{let e=wt(l);for(;o=e.nextNode();)Mt(o,l),Rt(o),H(o.content)&&zt(o.content)}catch(n){throw c&&(_t(e),es(t.removed,e=>{e.element&&bt(e.element)})),n}if(c)return es(t.removed,e=>{e.element&&bt(e.element)}),De&&Tt(e),e;if(Pe){if(De&&Tt(i),Fe)for(s=oe.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(be.shadowroot||be.shadowrootmode)&&(s=ce.call(r,s,!0)),s}let u=ke?i.outerHTML:i.innerHTML;return ke&&j[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&vs(qs,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
@@ -238,13 +238,13 @@ ${e}</tr>
|
|
|
238
238
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
239
239
|
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${_u(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?_u(n,!0):this.parser.parseInline(r),o=vu(e);if(o===null)return a;e=_u(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+_u(t)+`"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=vu(e);if(i===null)return _u(n);e=i;let a=`<img src="${_u(e)}" alt="${_u(n)}"`;return t&&(a+=` title="${_u(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:_u(e.text)}},ju=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},Mu=class e{options;renderer;textRenderer;constructor(e){this.options=e||Jc,this.options.renderer=this.options.renderer||new Au,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ju}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},Nu=class{options;block;constructor(e){this.options=e||Jc}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?ku.lex:ku.lexInline}provideParser(e=this.block){return e?Mu.parse:Mu.parseInline}},Pu=class{defaults=qc();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Mu;Renderer=Au;TextRenderer=ju;Lexer=ku;Tokenizer=Ou;Hooks=Nu;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new Au(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new Ou(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Nu;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=Nu.passThroughHooks.has(n)?e=>{if(this.defaults.async&&Nu.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return ku.lex(e,t??this.defaults)}parser(e,t){return Mu.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?ku.lex:ku.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?Mu.parse:Mu.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?ku.lex:ku.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?Mu.parse:Mu.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
240
240
|
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+_u(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},Fu=new Pu;function Iu(e,t){return Fu.parse(e,t)}Iu.options=Iu.setOptions=function(e){return Fu.setOptions(e),Iu.defaults=Fu.defaults,Yc(Iu.defaults),Iu},Iu.getDefaults=qc,Iu.defaults=Jc;function Lu(...e){return Fu.use(...e),Iu.defaults=Fu.defaults,Yc(Iu.defaults),Iu}Iu.use=Lu,Iu.walkTokens=function(e,t){return Fu.walkTokens(e,t)},Iu.parseInline=Fu.parseInline,Iu.Parser=Mu,Iu.parser=Mu.parse,Iu.Renderer=Au,Iu.TextRenderer=ju,Iu.Lexer=ku,Iu.lexer=ku.lex,Iu.Tokenizer=Ou,Iu.Hooks=Nu,Iu.parse=Iu,Iu.options,Iu.setOptions,Iu.walkTokens,Iu.parseInline,Mu.parse,ku.lex;var Ru={};function zu(e){Ru=e??{}}var Bu=new Pu({gfm:!0,breaks:!0});Bu.use({tokenizer:{code(){}}});var Vu=/^(\$\$[\s\S]*?\$\$|\\\[([\s\S]*?)\\\]|\\\(([\s\S]*?)\\\)|\$[^$\n]+?\$)/;Bu.use({extensions:[{name:`twikoo-math`,level:`inline`,start(e){return e.search(Vu)},tokenizer(e){let t=Vu.exec(e);if(t)return{type:`twikoo-math`,raw:t[0],text:t[0]}},renderer(e){return e.text}}]}),Bu.use({extensions:[{name:`owo`,level:`inline`,start(e){return e.indexOf(`:`)},tokenizer(e){let t=/^:([a-zA-Z0-9_+-]+):/.exec(e);if(!t)return;let n=Ru[t[1]];if(n)return{type:`owo`,raw:t[0],html:`<img class="tk-owo-emotion" loading="lazy" src="${n}">`}},renderer(e){return e.html}}]});function Hu(e){return Bu.parse(e)}var Uu=document.createElement(`template`);function Wu(e){try{return Uu.innerHTML=e,Uu.content.childNodes[0]?.src??``}catch(e){return To.warn(`OwO 表情解析失败`,e),``}}function Gu(e){return e.split(`#`).shift()?.split(`?`)?.shift()?.split(`/`).pop()??``}function Ku(e){try{for(let t of Object.values(e))if(t.type===`image`)for(let e of t.container)e.text||=Gu(Wu(e.icon));return e}catch(e){To.warn(`OwO 数据格式异常`,e);return}}function qu(e){return new Promise(t=>{let n=new XMLHttpRequest;n.onreadystatechange=()=>{if(n.readyState===4){if(n.status>=200&&n.status<300||n.status===304)try{t(Ku(JSON.parse(n.responseText))??{})}catch(e){To.warn(`OwO 数据解析失败`,e),t({})}else To.warn(`OwO 数据请求失败:${n.status}`),t({})}};try{n.open(`get`,e,!0),n.send(null)}catch(e){To.warn(`OwO 数据请求异常`,e),t({})}})}async function Ju(e){let t={},n=await Promise.all(e.split(`,`).map(e=>qu(e.trim())));return Object.assign(t,...n),t}function Yu(e){let t={};for(let n of Object.values(e??{}))for(let e of n.container??[]){let n=Wu(e.icon);n&&e.text&&(t[e.text]=n)}return zu(t),t}var Xu=`data-tk-loading`;function Zu(e){for(let t of Array.from(e.children))if(t.hasAttribute(Xu))return t;return null}function Qu(e){if(Zu(e))return;let t=document.createElement(`div`);t.setAttribute(Xu,`1`),t.className=`tk-loading-mask`;let n=document.createElement(`div`);n.className=`tk-loading-spinner`,n.innerHTML=`<svg class="circular" viewBox="25 25 50 50"><circle class="path" cx="50" cy="50" r="20" fill="none"></circle></svg>`,t.appendChild(n),e.appendChild(t)}function $u(e){Zu(e)?.remove(),e.classList.remove(`tk-loading-parent--relative`)}function ed(e,t){if(t.value){let t=getComputedStyle(e).position;(!t||t===`static`)&&e.classList.add(`tk-loading-parent--relative`),Qu(e)}else $u(e)}var td={mounted:ed,updated:ed,unmounted:$u};function nd(e,t){rd(e);let n=n=>{let r=n.target;r&&e!==r&&!e.contains(r)&&t.value?.()};e.__tkClickoutside=n,document.addEventListener(`click`,n,!0)}function rd(e){let t=e;t.__tkClickoutside&&(document.removeEventListener(`click`,t.__tkClickoutside,!0),delete t.__tkClickoutside)}var id={mounted:nd,updated:nd,unmounted:rd},ad=e=>typeof e==`string`&&/^http(s)?:\/\//.test(e),od=e=>e==null||e===``;function sd(e){return String(e).trim().toLowerCase()}function cd(e){return/^[1-9][0-9]{4,10}$/.test(e)||/^[1-9][0-9]{4,10}@qq.com$/i.test(e)}function ld(e){return e?e.substring(0,4)===`http`?e:`http://${e}`:``}function ud(e){let t=typeof e==`number`?new Date(e):e;if(!t)return``;try{let e=Date.now()-t.getTime(),n=Math.floor(e/864e5);if(n===0){let t=e%864e5,n=Math.floor(t/36e5);if(n===0){let e=t%36e5,n=Math.floor(e/6e4);return n===0?`${Math.round(e%6e4/1e3)} ${W(`TIMEAGO_SECONDS`)}`:`${n} ${W(`TIMEAGO_MINUTES`)}`}return`${n} ${W(`TIMEAGO_HOURS`)}`}return n<0?W(`TIMEAGO_NOW`):n<8?`${n} ${W(`TIMEAGO_DAYS`)}`:dd(t)}catch(e){return To.warn(`timeago 计算失败`,e),``}}function dd(e){return[fd(e.getFullYear(),2),fd(e.getMonth()+1,2),fd(e.getDate(),2)].join(`-`)}function fd(e,t){let n=e.toString();for(;n.length<t;)n=`0${n}`;return n}function pd(e){let t=e;return t&&typeof t==`object`&&t.result&&typeof t.result==`object`?t.result:e??{}}function md(e){let t=window.TWIKOO_MAGIC_PATH;if(t)return t;if(e&&typeof e==`string`)switch(e){case`location.pathname`:case`window.location.pathname`:return window.location.pathname;case`location.href`:case`window.location.href`:return window.location.href;default:return e}return window.location.pathname}function hd(e){return window.TWIKOO_MAGIC_HREF??(typeof e==`string`?e:window.location.href)}var gd=new Set([`localhost`,`127.0.0.1`,`0.0.0.0`,`::1`]);function _d(){return gd.has(window.location.hostname)}async function vd(e,t={}){let n=t.urls;if(!Array.isArray(n))throw Error(`urls 参数有误`);return n.length===0?[]:pd(await Co(e,`GET_COMMENTS_COUNT`,{envId:t.envId,funcName:t.funcName,urls:n,includeReply:t.includeReply})).data}async function yd(e,t={}){let n=pd(await Co(e,`GET_RECENT_COMMENTS`,{envId:t.envId,funcName:t.funcName,pageSize:t.pageSize,includeReply:t.includeReply})).data;if(Array.isArray(n))for(let e of n)e.relativeTime=ud(e.created);return n}async function bd(e,t={}){return pd(await Co(e,`COUNTER_GET`,{envId:t.envId,funcName:t.funcName,url:md(t.path),href:hd(t.href),title:t.title??document.title}))}async function xd(e,t={}){let n=document.getElementById(`twikoo_visitors`);if(!n||_d())return null;try{let r=await bd(e,t);return r.time!==void 0&&(n.innerHTML=String(r.time)),r}catch(e){return To.warn(`Failed to update visitors count`,e),null}}function Sd(e){return new Promise((t,n)=>{let r=new FileReader;r.readAsText(e),r.onloadend=()=>{r.error?n(r.error):t(r.result)}})}function Cd(e){return new Promise(t=>{let n=new FileReader;n.onload=e=>{let n=e.target?.result;t(typeof n==`string`?n:``)},n.readAsDataURL(e)})}async function wd(){let e=window.navigator.userAgent;try{let t=navigator.userAgentData;if(t?.platform===`Windows`||t?.platform===`macOS`){let{platformVersion:n}=await t.getHighEntropyValues([`platformVersion`]),r=parseInt(String(n).split(`.`)[0],10);t.platform===`Windows`&&r>=13?e=e.replace(/Windows NT 10\.0/i,`Windows NT 11.0`):t.platform===`macOS`&&r>=11&&(e=e.replace(/Mac OS X 10_[0-9]+_[0-9]+/i,`Mac OS X ${String(n).replace(/\./g,`_`)}`))}}catch{}return e}function Td(e){if(!e)return;let t=Array.isArray(e)?e:[e],n=[];for(let e of t)e&&n.push(...Array.from(e.getElementsByTagName(`a`)));for(let e of n)e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer nofollow ugc`)}function Ed(e,t){if(!e)return;let n=window.renderMathInElement;typeof n==`function`&&n(e,t??{delimiters:[{left:`$$`,right:`$$`,display:!0},{left:`$`,right:`$`,display:!1},{left:`\\(`,right:`\\)`,display:!1},{left:`\\[`,right:`\\]`,display:!0}],throwOnError:!1})}var Dd=[{key:`envId`,required:!0}];function Od(e){let t=Dd.filter(t=>t.required&&od(e[t.key])).map(e=>e.key);if(t.length!==0){for(let e of t)To.warn(`${e} is required`);throw Error(`Twikoo: failed to init`)}}async function kd(e,t){let n=e;Od(t);let r=n.init({env:t.envId??``,region:t.region}),i=r.auth({persistence:`local`});return i.hasLoginState?.()||await i.anonymousAuthProvider().signIn(),{app:r,auth:i}}function Ad(e){let t=Object.create(null);for(let n of e.split(`,`))t[n]=1;return e=>e in t}var jd={},Md=[],Nd=()=>{},Pd=()=>!1,Fd=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Id=e=>e.startsWith(`onUpdate:`),Ld=Object.assign,Rd=(e,t)=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)},zd=Object.prototype.hasOwnProperty,Bd=(e,t)=>zd.call(e,t),Vd=Array.isArray,Hd=e=>Zd(e)===`[object Map]`,Ud=e=>Zd(e)===`[object Set]`,Wd=e=>Zd(e)===`[object Date]`,Gd=e=>typeof e==`function`,Kd=e=>typeof e==`string`,qd=e=>typeof e==`symbol`,Jd=e=>typeof e==`object`&&!!e,Yd=e=>(Jd(e)||Gd(e))&&Gd(e.then)&&Gd(e.catch),Xd=Object.prototype.toString,Zd=e=>Xd.call(e),Qd=e=>Zd(e).slice(8,-1),$d=e=>Zd(e)===`[object Object]`,ef=e=>Kd(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,tf=Ad(`,key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted`),nf=e=>{let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},rf=/-\w/g,af=nf(e=>e.replace(rf,e=>e.slice(1).toUpperCase())),of=/\B([A-Z])/g,sf=nf(e=>e.replace(of,`-$1`).toLowerCase()),cf=nf(e=>e.charAt(0).toUpperCase()+e.slice(1)),lf=nf(e=>e?`on${cf(e)}`:``),uf=(e,t)=>!Object.is(e,t),df=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},ff=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},pf=e=>{let t=parseFloat(e);return isNaN(t)?e:t},mf,hf=()=>mf||=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{};function gf(e){if(Vd(e)){let t={};for(let n=0;n<e.length;n++){let r=e[n],i=Kd(r)?bf(r):gf(r);if(i)for(let e in i)t[e]=i[e]}return t}if(Kd(e)||Jd(e))return e}var _f=/;(?![^(]*\))/g,vf=/:([^]+)/,yf=/"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;function bf(e){let t={};return e.replace(yf,e=>e.startsWith(`/*`)?``:e).split(_f).forEach(e=>{if(e){let n=e.split(vf);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function xf(e){let t=``;if(Kd(e))t=e;else if(Vd(e))for(let n=0;n<e.length;n++){let r=xf(e[n]);r&&(t+=r+` `)}else if(Jd(e))for(let n in e)e[n]&&(t+=n+` `);return t.trim()}var Sf=`itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`,Cf=Ad(Sf);Sf+``;function wf(e){return!!e||e===``}function Tf(e,t,n){if(e.length!==t.length)return!1;let r=!0;for(let i=0;r&&i<e.length;i++)r=kf(e[i],t[i],n);return r}function Ef(e,t,n){if(e.size!==t.size)return!1;let r=Array.from(t),i=new Uint8Array(r.length);for(let t of e){let e=-1;for(let a=0;a<r.length;a++)if(!i[a]&&kf(t,r[a],n)){e=a;break}if(e<0)return!1;i[e]=1}return!0}function Df(e,t,n){let r=Hd(e),i=Hd(t);if(r||i||(r=Ud(e),i=Ud(t),r||i))return r&&i?Ef(e,t,n):!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e){let i=e.hasOwnProperty(r),a=t.hasOwnProperty(r);if(i&&!a||!i&&a||!kf(e[r],t[r],n))return!1}return String(e)===String(t)}function Of(e,t,n,r){n||=[new Map,new Map];let[i,a]=n;if(i.has(e)||a.has(t))return i.get(e)===t&&a.get(t)===e;i.set(e,t),a.set(t,e);let o=r(e,t,n);return i.delete(e),a.delete(t),o}function kf(e,t,n){if(e===t)return!0;let r=Wd(e),i=Wd(t);return r||i?r&&i?e.getTime()===t.getTime():!1:(r=qd(e),i=qd(t),r||i?e===t:(r=Vd(e),i=Vd(t),r||i?r&&i?Of(e,t,n,Tf):!1:(r=Jd(e),i=Jd(t),r||i?!r||!i?!1:Of(e,t,n,Df):String(e)===String(t))))}function Af(e,t){return e.findIndex(e=>kf(e,t))}var jf=e=>!!(e&&e.__v_isRef===!0),K=e=>Kd(e)?e:e==null?``:Vd(e)||Jd(e)&&(e.toString===Xd||!Gd(e.toString))?jf(e)?K(e.value):JSON.stringify(e,Mf,2):String(e),Mf=(e,t)=>jf(t)?Mf(e,t.value):Hd(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,n],r)=>(e[Nf(t,r)+` =>`]=n,e),{})}:Ud(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>Nf(e))}:qd(t)?Nf(t):Jd(t)&&!Vd(t)&&!$d(t)?String(t):t,Nf=(e,t=``)=>qd(e)?`Symbol(${e.description??t})`:e,Pf,Ff=class{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&Pf&&(Pf.active?(this.parent=Pf,this.index=(Pf.scopes||(Pf.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes){let n=this.scopes.slice();for(e=0,t=n.length;e<t;e++)n[e].pause()}for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes){let n=this.scopes.slice();for(e=0,t=n.length;e<t;e++)n[e].resume()}let n=this.effects.slice();for(e=0,t=n.length;e<t;e++)n[e].resume()}}run(e){if(this._active){let t=Pf;try{return Pf=this,e()}finally{Pf=t}}}on(){++this._on===1&&(this.prevScope=Pf,Pf=this)}off(){if(this._on>0&&--this._on===0){if(Pf===this)Pf=this.prevScope;else{let e=Pf;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let t,n;for(t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){let e=this.scopes.slice();for(t=0,n=e.length;t<n;t++)e[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){let e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0}}};function If(){return Pf}var Lf,Rf=new WeakSet,zf=class{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Pf&&(Pf.active?Pf.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Rf.has(this)&&(Rf.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Uf(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,np(this),Kf(this);let e=Lf,t=Qf;Lf=this,Qf=!0;try{return this.fn()}finally{qf(this),Lf=e,Qf=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Xf(e);this.deps=this.depsTail=void 0,np(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Rf.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Jf(this)&&this.run()}get dirty(){return Jf(this)}},Bf=0,Vf,Hf;function Uf(e,t=!1){if(e.flags|=8,t){e.next=Hf,Hf=e;return}e.next=Vf,Vf=e}function Wf(){Bf++}function Gf(){if(--Bf>0)return;if(Hf){let e=Hf;for(Hf=void 0;e;){let t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;Vf;){let t=Vf;for(Vf=void 0;t;){let n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(t){e||=t}t=n}}if(e)throw e}function Kf(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function qf(e){let t,n=e.depsTail,r=n;for(;r;){let e=r.prevDep;r.version===-1?(r===n&&(n=e),Xf(r),Zf(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=e}e.deps=t,e.depsTail=n}function Jf(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Yf(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Yf(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===rp)||(e.globalVersion=rp,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Jf(e))))return;e.flags|=2;let t=e.dep,n=Lf,r=Qf;Lf=e,Qf=!0;try{Kf(e);let n=e.fn(e._value);(t.version===0||uf(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(e){throw t.version++,e}finally{Lf=n,Qf=r,qf(e),e.flags&=-3}}function Xf(e,t=!1){let{dep:n,prevSub:r,nextSub:i}=e;if(r&&(r.nextSub=i,e.prevSub=void 0),i&&(i.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let e=n.computed.deps;e;e=e.nextDep)Xf(e,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Zf(e){let{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}var Qf=!0,$f=[];function ep(){$f.push(Qf),Qf=!1}function tp(){let e=$f.pop();Qf=e===void 0||e}function np(e){let{cleanup:t}=e;if(e.cleanup=void 0,t){let e=Lf;Lf=void 0;try{t()}finally{Lf=e}}}var rp=0,ip=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}},ap=class{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!Lf||!Qf||Lf===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==Lf)t=this.activeLink=new ip(Lf,this),Lf.deps?(t.prevDep=Lf.depsTail,Lf.depsTail.nextDep=t,Lf.depsTail=t):Lf.deps=Lf.depsTail=t,op(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){let e=t.nextDep;e.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=e),t.prevDep=Lf.depsTail,t.nextDep=void 0,Lf.depsTail.nextDep=t,Lf.depsTail=t,Lf.deps===t&&(Lf.deps=e)}return t}trigger(e){this.version++,rp++,this.notify(e)}notify(e){Wf();try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{Gf()}}};function op(e){if(e.dep.sc++,e.sub.flags&4){let t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let e=t.deps;e;e=e.nextDep)op(e)}let n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}var sp=new WeakMap,cp=Symbol(``),lp=Symbol(``),up=Symbol(``);function dp(e,t,n){if(Qf&&Lf){let t=sp.get(e);t||sp.set(e,t=new Map);let r=t.get(n);r||(t.set(n,r=new ap),r.map=t,r.key=n),r.track()}}function fp(e,t,n,r,i,a){let o=sp.get(e);if(!o){rp++;return}let s=e=>{e&&e.trigger()};if(Wf(),t===`clear`)o.forEach(s);else{let i=Vd(e),a=i&&ef(n);if(i&&n===`length`){let e=Number(r);o.forEach((t,n)=>{(n===`length`||n===up||!qd(n)&&n>=e)&&s(t)})}else switch((n!==void 0||o.has(void 0))&&s(o.get(n)),a&&s(o.get(up)),t){case`add`:i?a&&s(o.get(`length`)):(s(o.get(cp)),Hd(e)&&s(o.get(lp)));break;case`delete`:i||(s(o.get(cp)),Hd(e)&&s(o.get(lp)));break;case`set`:Hd(e)&&s(o.get(cp))}}Gf()}function pp(e){let t=em(e);return t===e||(dp(t,`iterate`,up),Qp(e))?t:Zp(e)?Xp(e)?t.map(e=>rm(nm(e))):t.map(rm):t.map(nm)}function mp(e){return dp(e=em(e),`iterate`,up),e}function hp(e,t){return Zp(e)?rm(Xp(e)?nm(t):t):nm(t)}var gp={__proto__:null,[Symbol.iterator](){return _p(this,Symbol.iterator,e=>hp(this,e))},concat(...e){return pp(this).concat(...e.map(e=>Vd(e)?pp(e):e))},entries(){return _p(this,`entries`,e=>(e[1]=hp(this,e[1]),e))},every(e,t){return yp(this,`every`,e,t,void 0,arguments)},filter(e,t){return yp(this,`filter`,e,t,e=>e.map(e=>hp(this,e)),arguments)},find(e,t){return yp(this,`find`,e,t,e=>hp(this,e),arguments)},findIndex(e,t){return yp(this,`findIndex`,e,t,void 0,arguments)},findLast(e,t){return yp(this,`findLast`,e,t,e=>hp(this,e),arguments)},findLastIndex(e,t){return yp(this,`findLastIndex`,e,t,void 0,arguments)},forEach(e,t){return yp(this,`forEach`,e,t,void 0,arguments)},includes(...e){return xp(this,`includes`,e)},indexOf(...e){return xp(this,`indexOf`,e)},join(e){return pp(this).join(e)},lastIndexOf(...e){return xp(this,`lastIndexOf`,e)},map(e,t){return yp(this,`map`,e,t,void 0,arguments)},pop(){return Sp(this,`pop`)},push(...e){return Sp(this,`push`,e)},reduce(e,...t){return bp(this,`reduce`,e,t)},reduceRight(e,...t){return bp(this,`reduceRight`,e,t)},shift(){return Sp(this,`shift`)},some(e,t){return yp(this,`some`,e,t,void 0,arguments)},splice(...e){return Sp(this,`splice`,e)},toReversed(){return pp(this).toReversed()},toSorted(e){return pp(this).toSorted(e)},toSpliced(...e){return pp(this).toSpliced(...e)},unshift(...e){return Sp(this,`unshift`,e)},values(){return _p(this,`values`,e=>hp(this,e))}};function _p(e,t,n){let r=mp(e),i=r[t]();return r!==e&&!Qp(e)&&(i._next=i.next,i.next=()=>{let e=i._next();return e.done||(e.value=n(e.value)),e}),i}var vp=Array.prototype;function yp(e,t,n,r,i,a){let o=mp(e),s=o!==e&&!Qp(e),c=o[t];if(c!==vp[t]){let t=c.apply(e,a);return s?nm(t):t}let l=n;o!==e&&(s?l=function(t,r){return n.call(this,hp(e,t),r,e)}:n.length>2&&(l=function(t,r){return n.call(this,t,r,e)}));let u=c.call(o,l,r);return s&&i?i(u):u}function bp(e,t,n,r){let i=mp(e),a=i!==e&&!Qp(e),o=n,s=!1;i!==e&&(a?(s=r.length===0,o=function(t,r,i){return s&&(s=!1,t=hp(e,t)),n.call(this,t,hp(e,r),i,e)}):n.length>3&&(o=function(t,r,i){return n.call(this,t,r,i,e)}));let c=i[t](o,...r);return s?hp(e,c):c}function xp(e,t,n){let r=em(e);dp(r,`iterate`,up);let i=r[t](...n);return(i===-1||i===!1)&&$p(n[0])?(n[0]=em(n[0]),r[t](...n)):i}function Sp(e,t,n=[]){ep(),Wf();let r=em(e)[t].apply(e,n);return Gf(),tp(),r}var Cp=Ad(`__proto__,__v_isRef,__isVue`),wp=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!==`arguments`&&e!==`caller`).map(e=>Symbol[e]).filter(qd));function Tp(e){qd(e)||(e=String(e));let t=em(this);return dp(t,`has`,e),t.hasOwnProperty(e)}var Ep=class{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if(t===`__v_skip`)return e.__v_skip;let r=this._isReadonly,i=this._isShallow;if(t===`__v_isReactive`)return!r;if(t===`__v_isReadonly`)return r;if(t===`__v_isShallow`)return i;if(t===`__v_raw`)return n===(r?i?Wp:Up:i?Hp:Vp).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;let a=Vd(e);if(!r){let e;if(a&&(e=gp[t]))return e;if(t===`hasOwnProperty`)return Tp}let o=Reflect.get(e,t,im(e)?e:n);if((qd(t)?wp.has(t):Cp(t))||(r||dp(e,`get`,t),i))return o;if(im(o)){let e=a&&ef(t)?o:o.value;return r&&Jd(e)?Jp(e):e}return Jd(o)?r?Jp(o):Kp(o):o}},Dp=class extends Ep{constructor(e=!1){super(!1,e)}set(e,t,n,r){let i=e[t],a=Vd(e)&&ef(t);if(!this._isShallow){let e=Zp(i);if(!Qp(n)&&!Zp(n)&&(i=em(i),n=em(n)),!a&&im(i)&&!im(n))return e||(i.value=n),!0}let o=a?Number(t)<e.length:Bd(e,t),s=Reflect.set(e,t,n,im(e)?e:r);return e===em(r)&&s&&(o?uf(n,i)&&fp(e,`set`,t,n,i):fp(e,`add`,t,n)),s}deleteProperty(e,t){let n=Bd(e,t),r=e[t],i=Reflect.deleteProperty(e,t);return i&&n&&fp(e,`delete`,t,void 0,r),i}has(e,t){let n=Reflect.has(e,t);return(!qd(t)||!wp.has(t))&&dp(e,`has`,t),n}ownKeys(e){return dp(e,`iterate`,Vd(e)?`length`:cp),Reflect.ownKeys(e)}},Op=class extends Ep{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}},kp=new Dp,Ap=new Op,jp=new Dp(!0),Mp=e=>e,Np=e=>Reflect.getPrototypeOf(e);function Pp(e,t,n){return function(...r){let i=this.__v_raw,a=em(i),o=Hd(a),s=e===`entries`||e===Symbol.iterator&&o,c=e===`keys`&&o,l=i[e](...r),u=n?Mp:t?rm:nm;return!t&&dp(a,`iterate`,c?lp:cp),Ld(Object.create(l),{next(){let{value:e,done:t}=l.next();return t?{value:e,done:t}:{value:s?[u(e[0]),u(e[1])]:u(e),done:t}}})}}function Fp(e){return function(...t){return e===`delete`?!1:e===`clear`?void 0:this}}function Ip(e,t){let n={get(n){let r=this.__v_raw,i=em(r),a=em(n);e||(uf(n,a)&&dp(i,`get`,n),dp(i,`get`,a));let{has:o}=Np(i),s=t?Mp:e?rm:nm;if(o.call(i,n))return s(r.get(n));if(o.call(i,a))return s(r.get(a));r!==i&&r.get(n)},get size(){let t=this.__v_raw;return!e&&dp(em(t),`iterate`,cp),t.size},has(t){let n=this.__v_raw,r=em(n),i=em(t);return e||(uf(t,i)&&dp(r,`has`,t),dp(r,`has`,i)),t===i?n.has(t):n.has(t)||n.has(i)},forEach(n,r){let i=this,a=i.__v_raw,o=em(a),s=t?Mp:e?rm:nm;return!e&&dp(o,`iterate`,cp),a.forEach((e,t)=>n.call(r,s(e),s(t),i))}};return Ld(n,e?{add:Fp(`add`),set:Fp(`set`),delete:Fp(`delete`),clear:Fp(`clear`)}:{add(e){let n=em(this),r=Np(n),i=em(e),a=!t&&!Qp(e)&&!Zp(e)?i:e;return r.has.call(n,a)||uf(e,a)&&r.has.call(n,e)||uf(i,a)&&r.has.call(n,i)||(n.add(a),fp(n,`add`,a,a)),this},set(e,n){!t&&!Qp(n)&&!Zp(n)&&(n=em(n));let r=em(this),{has:i,get:a}=Np(r),o=i.call(r,e);o||=(e=em(e),i.call(r,e));let s=a.call(r,e);return r.set(e,n),o?uf(n,s)&&fp(r,`set`,e,n,s):fp(r,`add`,e,n),this},delete(e){let t=em(this),{has:n,get:r}=Np(t),i=n.call(t,e);i||=(e=em(e),n.call(t,e));let a=r?r.call(t,e):void 0,o=t.delete(e);return i&&fp(t,`delete`,e,void 0,a),o},clear(){let e=em(this),t=e.size!==0,n=e.clear();return t&&fp(e,`clear`,void 0,void 0,void 0),n}}),[`keys`,`values`,`entries`,Symbol.iterator].forEach(r=>{n[r]=Pp(r,e,t)}),n}function Lp(e,t){let n=Ip(e,t);return(t,r,i)=>r===`__v_isReactive`?!e:r===`__v_isReadonly`?e:r===`__v_raw`?t:Reflect.get(Bd(n,r)&&r in t?n:t,r,i)}var Rp={get:Lp(!1,!1)},zp={get:Lp(!1,!0)},Bp={get:Lp(!0,!1)},Vp=new WeakMap,Hp=new WeakMap,Up=new WeakMap,Wp=new WeakMap;function Gp(e){switch(e){case`Object`:case`Array`:return 1;case`Map`:case`Set`:case`WeakMap`:case`WeakSet`:return 2;default:return 0}}function Kp(e){return Zp(e)?e:Yp(e,!1,kp,Rp,Vp)}function qp(e){return Yp(e,!1,jp,zp,Hp)}function Jp(e){return Yp(e,!0,Ap,Bp,Up)}function Yp(e,t,n,r,i){if(!Jd(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;let a=i.get(e);if(a)return a;let o=Gp(Qd(e));if(o===0)return e;let s=new Proxy(e,o===2?r:n);return i.set(e,s),s}function Xp(e){return Zp(e)?Xp(e.__v_raw):!!(e&&e.__v_isReactive)}function Zp(e){return!!(e&&e.__v_isReadonly)}function Qp(e){return!!(e&&e.__v_isShallow)}function $p(e){return e?!!e.__v_raw:!1}function em(e){let t=e&&e.__v_raw;return t?em(t):e}function tm(e){return!Bd(e,`__v_skip`)&&Object.isExtensible(e)&&ff(e,`__v_skip`,!0),e}var nm=e=>Jd(e)?Kp(e):e,rm=e=>Jd(e)?Jp(e):e;function im(e){return e?e.__v_isRef===!0:!1}function q(e){return am(e,!1)}function am(e,t){return im(e)?e:new om(e,t)}var om=class{constructor(e,t){this.dep=new ap,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:em(e),this._value=t?e:nm(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){let t=this._rawValue,n=this.__v_isShallow||Qp(e)||Zp(e);e=n?e:em(e),uf(e,t)&&(this._rawValue=e,this._value=n?e:nm(e),this.dep.trigger())}};function J(e){return im(e)?e.value:e}var sm={get:(e,t,n)=>t===`__v_raw`?e:J(Reflect.get(e,t,n)),set:(e,t,n,r)=>{let i=e[t];return im(i)&&!im(n)?(i.value=n,!0):Reflect.set(e,t,n,r)}};function cm(e){return Xp(e)?e:new Proxy(e,sm)}var lm=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new ap(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=rp-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&Lf!==this)return Uf(this,!0),!0}get value(){let e=this.dep.track();return Yf(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}};function um(e,t,n=!1){let r,i;return Gd(e)?r=e:(r=e.get,i=e.set),new lm(r,i,n)}var dm={},fm=new WeakMap,pm=void 0;function mm(e,t=!1,n=pm){if(n){let t=fm.get(n);t||fm.set(n,t=[]),t.push(e)}}function hm(e,t,n=jd){let{immediate:r,deep:i,once:a,scheduler:o,augmentJob:s,call:c}=n,l=e=>i?e:Qp(e)||i===!1||i===0?gm(e,1):gm(e),u,d,f,p,m=!1,h=!1;if(im(e)?(d=()=>e.value,m=Qp(e)):Xp(e)?(d=()=>l(e),m=!0):Vd(e)?(h=!0,m=e.some(e=>Xp(e)||Qp(e)),d=()=>e.map(e=>{if(im(e))return e.value;if(Xp(e))return l(e);if(Gd(e))return c?c(e,2):e()})):d=Gd(e)?t?c?()=>c(e,2):e:()=>{if(f){ep();try{f()}finally{tp()}}let t=pm;pm=u;try{return c?c(e,3,[p]):e(p)}finally{pm=t}}:Nd,t&&i){let e=d,t=i===!0?1/0:i;d=()=>gm(e(),t)}let g=If(),_=()=>{u.stop(),g&&g.active&&Rd(g.effects,u)};if(a&&t){let e=t;t=(...t)=>{let n=e(...t);return _(),n}}let v=h?Array(e.length).fill(dm):dm,y=e=>{if(u.flags&1&&(u.dirty||e)){if(t){let n=u.run();if(e||i||m||(h?n.some((e,t)=>uf(e,v[t])):uf(n,v))){f&&f();let e=pm;pm=u;try{let e=[n,v===dm?void 0:h&&v[0]===dm?[]:v,p];v=n,c?c(t,3,e):t(...e)}finally{pm=e}}}else u.run()}};return s&&s(y),u=new zf(d),u.scheduler=o?()=>o(y,!1):y,p=e=>mm(e,!1,u),f=u.onStop=()=>{let e=fm.get(u);if(e){if(c)c(e,4);else for(let t of e)t();fm.delete(u)}},t?r?y(!0):v=u.run():o?o(y.bind(null,!0),!0):u.run(),_.pause=u.pause.bind(u),_.resume=u.resume.bind(u),_.stop=_,_}function gm(e,t=1/0,n){if(t<=0||!Jd(e)||e.__v_skip||(n||=new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,im(e))gm(e.value,t,n);else if(Vd(e))for(let r=0;r<e.length;r++)gm(e[r],t,n);else if(Ud(e)||Hd(e))e.forEach(e=>{gm(e,t,n)});else if($d(e)){for(let r in e)gm(e[r],t,n);for(let r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&gm(e[r],t,n)}return e}function _m(e,t,n,r){try{return r?e(...r):e()}catch(e){ym(e,t,n)}}function vm(e,t,n,r){if(Gd(e)){let i=_m(e,t,n,r);return i&&Yd(i)&&i.catch(e=>{ym(e,t,n)}),i}if(Vd(e)){let i=[];for(let a=0;a<e.length;a++)i.push(vm(e[a],t,n,r));return i}}function ym(e,t,n,r=!0){let i=t?t.vnode:null,{errorHandler:a,throwUnhandledErrorInProduction:o}=t&&t.appContext.config||jd;if(t){let r=t.parent,i=t.proxy,o=`https://vuejs.org/error-reference/#runtime-${n}`;for(;r;){let t=r.ec;if(t){for(let n=0;n<t.length;n++)if(t[n](e,i,o)===!1)return}r=r.parent}if(a){ep(),_m(a,null,10,[e,i,o]),tp();return}}bm(e,n,i,r,o)}function bm(e,t,n,r=!0,i=!1){if(i)throw e;console.error(e)}var xm=[],Sm=-1,Cm=[],wm=null,Tm=0,Em=Promise.resolve(),Dm=null;function Om(e){let t=Dm||Em;return e?t.then(this?e.bind(this):e):t}function km(e){let t=Sm+1,n=xm.length;for(;t<n;){let r=t+n>>>1,i=xm[r],a=Fm(i);a<e||a===e&&i.flags&2?t=r+1:n=r}return t}function Am(e){if(!(e.flags&1)){let t=Fm(e),n=xm[xm.length-1];!n||!(e.flags&2)&&t>=Fm(n)?xm.push(e):xm.splice(km(t),0,e),e.flags|=1,jm()}}function jm(){Dm||=Em.then(Im)}function Mm(e){if(!Vd(e))wm&&e.id===-1?wm.splice(Tm+1,0,e):e.flags&1||(Cm.push(e),e.flags|=1);else for(let t=0;t<e.length;t++)Cm.push(e[t]);jm()}function Nm(e,t,n=Sm+1){for(;n<xm.length;n++){let t=xm[n];if(t&&t.flags&2){if(e&&t.id!==e.uid)continue;xm.splice(n,1),n--,t.flags&4&&(t.flags&=-2),t(),t.flags&4||(t.flags&=-2)}}}function Pm(e){if(Cm.length){let e=[...new Set(Cm)].sort((e,t)=>Fm(e)-Fm(t));if(Cm.length=0,wm){for(let t=0;t<e.length;t++)wm.push(e[t]);return}for(wm=e,Tm=0;Tm<wm.length;Tm++){let e=wm[Tm];e.flags&4&&(e.flags&=-2),e.flags&8||e(),e.flags&=-2}wm=null,Tm=0}}var Fm=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Im(e){try{for(Sm=0;Sm<xm.length;Sm++){let e=xm[Sm];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),_m(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;Sm<xm.length;Sm++){let e=xm[Sm];e&&(e.flags&=-2)}Sm=-1,xm.length=0,Pm(e),Dm=null,(xm.length||Cm.length)&&Im(e)}}var Lm=null,Rm=null;function zm(e){let t=Lm;return Lm=e,Rm=e&&e.type.__scopeId||null,t}function Bm(e,t=Lm,n){if(!t||e._n)return e;let r=(...n)=>{r._d&&i_(-1);let i=zm(t),a=e_.length,o;try{o=e(...n)}finally{for(let e=e_.length;e>a;e--)n_();zm(i),r._d&&i_(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function Vm(e,t){if(Lm===null)return e;let n=B_(Lm),r=e.dirs||=[];for(let e=0;e<t.length;e++){let[i,a,o,s=jd]=t[e];i&&(Gd(i)&&(i={mounted:i,updated:i}),i.deep&&gm(a),r.push({dir:i,instance:n,value:a,oldValue:void 0,arg:o,modifiers:s}))}return e}function Hm(e,t,n,r){let i=e.dirs,a=t&&t.dirs;for(let o=0;o<i.length;o++){let s=i[o];a&&(s.oldValue=a[o].value);let c=s.dir[r];c&&(ep(),vm(c,n,8,[e.el,s,e,t]),tp())}}function Um(e,t){if(w_){let n=w_.provides,r=w_.parent&&w_.parent.provides;r===n&&(n=w_.provides=Object.create(r)),n[e]=t}}function Wm(e,t,n=!1){let r=T_();if(r||og){let i=og?og._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(i&&e in i)return i[e];if(arguments.length>1)return n&&Gd(t)?t.call(r&&r.proxy):t}}var Gm=Symbol.for(`v-scx`),Km=()=>Wm(Gm);function qm(e,t,n){return Jm(e,t,n)}function Jm(e,t,n=jd){let{immediate:r,deep:i,flush:a,once:o}=n,s=Ld({},n),c=t&&r||!t&&a!==`post`,l;if(j_){if(a===`sync`){let e=Km();l=e.__watcherHandles||=[]}else if(!c){let e=()=>{};return e.stop=Nd,e.resume=Nd,e.pause=Nd,e}}let u=w_;s.call=(e,t,n)=>vm(e,u,t,n);let d=!1;a===`post`?s.scheduler=e=>{Lg(e,u&&u.suspense)}:a!==`sync`&&(d=!0,s.scheduler=(e,t)=>{t?e():Am(e)}),s.augmentJob=e=>{t&&(e.flags|=4),d&&(e.flags|=2,u&&(e.id=u.uid,e.i=u))};let f=hm(e,t,s);return j_&&(l?l.push(f):c&&f()),f}function Ym(e,t,n){let r=this.proxy,i=Kd(e)?e.includes(`.`)?Xm(r,e):()=>r[e]:e.bind(r,r),a;Gd(t)?a=t:(a=t.handler,n=t);let o=O_(this),s=Jm(i,a.bind(r),n);return o(),s}function Xm(e,t){let n=t.split(`.`);return()=>{let t=e;for(let e=0;e<n.length&&t;e++)t=t[n[e]];return t}}var Zm=Symbol(`_vte`),Qm=e=>e.__isTeleport,$m=Symbol(`_leaveCb`);function eh(e){let t=e[0];if(e.length>1){for(let n of e)if(n.type!==Qg){t=n;break}}return t}function th(e){if(!uh(e))return Qm(e.type)&&e.children?eh(e.children):e;if(e.component)return e.component.subTree;let{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&Gd(n.default))return n.default()}}function nh(e,t){if(e.shapeFlag&6&&e.component){e.transition=t;let n=e.component.subTree;nh(Qm(n.type)&&th(n)||n,t)}else e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function rh(e,t){return Gd(e)?Ld({name:e.name},t,{setup:e}):e}function ih(e){e.ids=[e.ids[0]+e.ids[2]+++`-`,0,0]}function ah(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}var oh=new WeakMap;function sh(e,t,n,r,i=!1){if(Vd(e)){e.forEach((e,a)=>sh(e,t&&(Vd(t)?t[a]:t),n,r,i));return}if(lh(r)&&!i){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&sh(e,t,n,r.component.subTree);return}let a=r.shapeFlag&4?B_(r.component):r.el,o=i?null:a,{i:s,r:c}=e,l=t&&t.r,u=s.refs===jd?s.refs={}:s.refs,d=s.setupState,f=em(d),p=d===jd?Pd:e=>!ah(u,e)&&Bd(f,e),m=(e,t)=>!(t&&ah(u,t));if(l!=null&&l!==c){if(ch(t),Kd(l))u[l]=null,p(l)&&(d[l]=null);else if(im(l)){let e=t;m(l,e.k)&&(l.value=null),e.k&&(u[e.k]=null)}}if(Gd(c))_m(c,s,12,[o,u]);else{let t=Kd(c),r=im(c);if(t||r){let s=()=>{if(e.f){let n=t?p(c)?d[c]:u[c]:m(c)||!e.k?c.value:u[e.k];if(i)Vd(n)&&Rd(n,a);else if(Vd(n))n.includes(a)||n.push(a);else if(t)u[c]=[a],p(c)&&(d[c]=u[c]);else{let t=[a];m(c,e.k)&&(c.value=t),e.k&&(u[e.k]=t)}}else t?(u[c]=o,p(c)&&(d[c]=o)):r&&(m(c,e.k)&&(c.value=o),e.k&&(u[e.k]=o))};if(o){let t=()=>{s(),oh.delete(e)};t.id=-1,oh.set(e,t),Lg(t,n)}else ch(e),s()}}}function ch(e){let t=oh.get(e);t&&(t.flags|=8,oh.delete(e))}hf().requestIdleCallback,hf().cancelIdleCallback;var lh=e=>!!e.type.__asyncLoader,uh=e=>e.type.__isKeepAlive;function dh(e,t){ph(e,`a`,t)}function fh(e,t){ph(e,`da`,t)}function ph(e,t,n=w_){let r=e.__wdc||=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()};if(hh(t,r,n),n){let e=n.parent;for(;e&&e.parent;)uh(e.parent.vnode)&&mh(r,t,n,e),e=e.parent}}function mh(e,t,n,r){let i=hh(t,e,r,!0);Sh(()=>{Rd(r[t],i)},n)}function hh(e,t,n=w_,r=!1){if(n){let i=n[e]||(n[e]=[]),a=t.__weh||=(...r)=>{ep();let i=O_(n),a=vm(t,n,e,r);return i(),tp(),a};return r?i.unshift(a):i.push(a),a}}var gh=e=>(t,n=w_)=>{(!j_||e===`sp`)&&hh(e,(...e)=>t(...e),n)},_h=gh(`bm`),vh=gh(`m`),yh=gh(`bu`),bh=gh(`u`),xh=gh(`bum`),Sh=gh(`um`),Ch=gh(`sp`),wh=gh(`rtg`),Th=gh(`rtc`);function Eh(e,t=w_){hh(`ec`,e,t)}var Dh=`components`;function Oh(e,t){return Ah(Dh,e,!0,t)||e}var kh=Symbol.for(`v-ndc`);function Ah(e,t,n=!0,r=!1){let i=Lm||w_;if(i){let n=i.type;if(e===Dh){let e=V_(n,!1);if(e&&(e===t||e===af(t)||e===cf(af(t))))return n}let a=jh(i[e]||n[e],t)||jh(i.appContext[e],t);return!a&&r?n:a}}function jh(e,t){return e&&(e[t]||e[af(t)]||e[cf(af(t))])}function Mh(e,t,n,r){let i,a=n&&n[r],o=Vd(e);if(o||Kd(e)){let n=o&&Xp(e),r=!1,s=!1;n&&(r=!Qp(e),s=Zp(e),e=mp(e)),i=Array(e.length);for(let n=0,o=e.length;n<o;n++)i[n]=t(r?s?rm(nm(e[n])):nm(e[n]):e[n],n,void 0,a&&a[n])}else if(typeof e==`number`){i=Array(e);for(let n=0;n<e;n++)i[n]=t(n+1,n,void 0,a&&a[n])}else if(Jd(e)){if(e[Symbol.iterator])i=Array.from(e,(e,n)=>t(e,n,void 0,a&&a[n]));else{let n=Object.keys(e);i=Array(n.length);for(let r=0,o=n.length;r<o;r++){let o=n[r];i[r]=t(e[o],o,r,a&&a[r])}}}else i=[];return n&&(n[r]=i),i}function Nh(e,t,n,r,i,a){if(n??={},Lm.ce||Lm.parent&&lh(Lm.parent)&&Lm.parent.ce){let e=a!=null&&n.key==null?Ld({},n,{key:a}):n,i=Object.keys(e).length>0;return t!=="default"&&(e.name=t),Y(),o_(Xg,null,[Q(`slot`,e,r&&r())],i?-2:64)}let o=e[t];o&&o._c&&(o._d=!1);let s=e_.length;Y();let c;try{let i=o&&Ph(o(n)),s=n.key||a||i&&i.key;c=o_(Xg,{key:(s&&!qd(s)?s:`_${t}`)+(!i&&r?`_fb`:``)},i||(r?r():[]),i&&e._===1?64:-2)}catch(e){for(let e=e_.length;e>s;e--)n_();throw e}finally{o&&o._c&&(o._d=!0)}return!i&&c.scopeId&&(c.slotScopeIds=[c.scopeId+`-s`]),c}function Ph(e){return e.some(e=>!s_(e)||!(e.type===Qg||e.type===Xg&&!Ph(e.children)))?e:null}var Fh=e=>e?A_(e)?B_(e):Fh(e.parent):null,Ih=Ld(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Fh(e.parent),$root:e=>Fh(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>qh(e),$forceUpdate:e=>e.f||=()=>{Am(e.update)},$nextTick:e=>e.n||=Om.bind(e.proxy),$watch:e=>Ym.bind(e)}),Lh=(e,t)=>e!==jd&&!e.__isScriptSetup&&Bd(e,t),Rh={get({_:e},t){if(t===`__v_skip`)return!0;let{ctx:n,setupState:r,data:i,props:a,accessCache:o,type:s,appContext:c}=e;if(t[0]!==`$`){let e=o[t];if(e!==void 0)switch(e){case 1:return r[t];case 2:return i[t];case 4:return n[t];case 3:return a[t]}else if(Lh(r,t))return o[t]=1,r[t];else if(i!==jd&&Bd(i,t))return o[t]=2,i[t];else if(Bd(a,t))return o[t]=3,a[t];else if(n!==jd&&Bd(n,t))return o[t]=4,n[t];else Hh&&(o[t]=0)}let l=Ih[t],u,d;if(l)return t===`$attrs`&&dp(e.attrs,`get`,``),l(e);if((u=s.__cssModules)&&(u=u[t]))return u;if(n!==jd&&Bd(n,t))return o[t]=4,n[t];if(d=c.config.globalProperties,Bd(d,t))return d[t]},set({_:e},t,n){let{data:r,setupState:i,ctx:a}=e;return Lh(i,t)?(i[t]=n,!0):r!==jd&&Bd(r,t)?(r[t]=n,!0):Bd(e.props,t)||t[0]===`$`&&t.slice(1)in e?!1:(a[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:i,props:a,type:o}},s){let c;return!!(n[s]||e!==jd&&s[0]!==`$`&&Bd(e,s)||Lh(t,s)||Bd(a,s)||Bd(r,s)||Bd(Ih,s)||Bd(i.config.globalProperties,s)||(c=o.__cssModules)&&c[s])},defineProperty(e,t,n){return n.get==null?Bd(n,`value`)&&this.set(e,t,n.value,null):e._.accessCache[t]=0,Reflect.defineProperty(e,t,n)}};function zh(){return Bh(`useSlots`).slots}function Bh(e){let t=T_();return t.setupContext||=z_(t)}function Vh(e){return Vd(e)?e.reduce((e,t)=>(e[t]=null,e),{}):e}var Hh=!0;function Uh(e){let t=qh(e),n=e.proxy,r=e.ctx;Hh=!1,t.beforeCreate&&Gh(t.beforeCreate,e,`bc`);let{data:i,computed:a,methods:o,watch:s,provide:c,inject:l,created:u,beforeMount:d,mounted:f,beforeUpdate:p,updated:m,activated:h,deactivated:g,beforeDestroy:_,beforeUnmount:v,destroyed:y,unmounted:b,render:x,renderTracked:S,renderTriggered:C,errorCaptured:w,serverPrefetch:T,expose:E,inheritAttrs:D,components:ee,directives:te,filters:O}=t;if(l&&Wh(l,r,null),o)for(let e in o){let t=o[e];Gd(t)&&(r[e]=t.bind(n))}if(i){let t=i.call(n,n);Jd(t)&&(e.data=Kp(t))}if(Hh=!0,a)for(let e in a){let t=a[e],i=U_({get:Gd(t)?t.bind(n,n):Gd(t.get)?t.get.bind(n,n):Nd,set:!Gd(t)&&Gd(t.set)?t.set.bind(n):Nd});Object.defineProperty(r,e,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e})}if(s)for(let e in s)Kh(s[e],r,n,e);if(c){let e=Gd(c)?c.call(n):c;Reflect.ownKeys(e).forEach(t=>{Um(t,e[t])})}u&&Gh(u,e,`c`);function k(e,t){Vd(t)?t.forEach(t=>e(t.bind(n))):t&&e(t.bind(n))}if(k(_h,d),k(vh,f),k(yh,p),k(bh,m),k(dh,h),k(fh,g),k(Eh,w),k(Th,S),k(wh,C),k(xh,v),k(Sh,b),k(Ch,T),Vd(E)){if(E.length){let t=e.exposed||={};E.forEach(e=>{Object.defineProperty(t,e,{get:()=>n[e],set:t=>n[e]=t,enumerable:!0})})}else e.exposed||={}}x&&e.render===Nd&&(e.render=x),D!=null&&(e.inheritAttrs=D),ee&&(e.components=ee),te&&(e.directives=te),T&&ih(e)}function Wh(e,t,n=Nd){Vd(e)&&(e=Qh(e));for(let n in e){let r=e[n],i;i=Jd(r)?`default`in r?Wm(r.from||n,r.default,!0):Wm(r.from||n):Wm(r),im(i)?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e}):t[n]=i}}function Gh(e,t,n){vm(Vd(e)?e.map(e=>e.bind(t.proxy)):e.bind(t.proxy),t,n)}function Kh(e,t,n,r){let i=r.includes(`.`)?Xm(n,r):()=>n[r];if(Kd(e)){let n=t[e];Gd(n)&&qm(i,n)}else if(Gd(e))qm(i,e.bind(n));else if(Jd(e)){if(Vd(e))e.forEach(e=>Kh(e,t,n,r));else{let r=Gd(e.handler)?e.handler.bind(n):t[e.handler];Gd(r)&&qm(i,r,e)}}}function qh(e){let t=e.type,{mixins:n,extends:r}=t,{mixins:i,optionsCache:a,config:{optionMergeStrategies:o}}=e.appContext,s=a.get(t),c;return s?c=s:!i.length&&!n&&!r?c=t:(c={},i.length&&i.forEach(e=>Jh(c,e,o,!0)),Jh(c,t,o)),Jd(t)&&a.set(t,c),c}function Jh(e,t,n,r=!1){let{mixins:i,extends:a}=t;a&&Jh(e,a,n,!0),i&&i.forEach(t=>Jh(e,t,n,!0));for(let i in t)if(!(r&&i===`expose`)){let r=Yh[i]||n&&n[i];e[i]=r?r(e[i],t[i]):t[i]}return e}var Yh={data:Xh,props:tg,emits:tg,methods:eg,computed:eg,beforeCreate:$h,created:$h,beforeMount:$h,mounted:$h,beforeUpdate:$h,updated:$h,beforeDestroy:$h,beforeUnmount:$h,destroyed:$h,unmounted:$h,activated:$h,deactivated:$h,errorCaptured:$h,serverPrefetch:$h,components:eg,directives:eg,watch:ng,provide:Xh,inject:Zh};function Xh(e,t){return t?e?function(){return Ld(Gd(e)?e.call(this,this):e,Gd(t)?t.call(this,this):t)}:t:e}function Zh(e,t){return eg(Qh(e),Qh(t))}function Qh(e){if(Vd(e)){let t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function $h(e,t){return e?[...new Set([].concat(e,t))]:t}function eg(e,t){return e?Ld(Object.create(null),e,t):t}function tg(e,t){return e?Vd(e)&&Vd(t)?[...new Set([...e,...t])]:Ld(Object.create(null),Vh(e),Vh(t??{})):t}function ng(e,t){if(!e)return t;if(!t)return e;let n=Ld(Object.create(null),e);for(let r in t)n[r]=$h(e[r],t[r]);return n}function rg(){return{app:null,config:{isNativeTag:Pd,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}var ig=0;function ag(e,t){return function(n,r=null){Gd(n)||(n=Ld({},n)),r!=null&&!Jd(r)&&(r=null);let i=rg(),a=new WeakSet,o=[],s=!1,c=i.app={_uid:ig++,_component:n,_props:r,_container:null,_context:i,_instance:null,version:W_,get config(){return i.config},set config(e){},use(e,...t){return a.has(e)||(e&&Gd(e.install)?(a.add(e),e.install(c,...t)):Gd(e)&&(a.add(e),e(c,...t))),c},mixin(e){return i.mixins.includes(e)||i.mixins.push(e),c},component(e,t){return t?(i.components[e]=t,c):i.components[e]},directive(e,t){return t?(i.directives[e]=t,c):i.directives[e]},mount(a,o,l){if(!s){let u=c._ceVNode||Q(n,r);return u.appContext=i,l===!0?l=`svg`:l===!1&&(l=void 0),o&&t?t(u,a):e(u,a,l),s=!0,c._container=a,a.__vue_app__=c,B_(u.component)}},onUnmount(e){o.push(e)},unmount(){s&&(vm(o,c._instance,16),e(null,c._container),delete c._container.__vue_app__)},provide(e,t){return i.provides[e]=t,c},runWithContext(e){let t=og;og=c;try{return e()}finally{og=t}}};return c}}var og=null,sg=(e,t)=>t===`modelValue`||t===`model-value`?e.modelModifiers:e[`${t}Modifiers`]||e[`${af(t)}Modifiers`]||e[`${sf(t)}Modifiers`];function cg(e,t,...n){if(e.isUnmounted)return;let r=e.vnode.props||jd,i=n,a=t.startsWith(`update:`),o=a&&sg(r,t.slice(7));o&&(o.trim&&(i=n.map(e=>Kd(e)?e.trim():e)),o.number&&(i=i.map(pf)));let s,c=r[s=lf(t)]||r[s=lf(af(t))];!c&&a&&(c=r[s=lf(sf(t))]),c&&vm(c,e,6,i);let l=r[s+`Once`];if(l){if(!e.emitted)e.emitted={};else if(e.emitted[s])return;e.emitted[s]=!0,vm(l,e,6,i)}}var lg=new WeakMap;function ug(e,t,n=!1){let r=n?lg:t.emitsCache,i=r.get(e);if(i!==void 0)return i;let a=e.emits,o={},s=!1;if(!Gd(e)){let r=e=>{let n=ug(e,t,!0);n&&(s=!0,Ld(o,n))};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}return!a&&!s?(Jd(e)&&r.set(e,null),null):(Vd(a)?a.forEach(e=>o[e]=null):Ld(o,a),Jd(e)&&r.set(e,o),o)}function dg(e,t){return!e||!Fd(t)?!1:(t=t.slice(2),t=t===`Once`?t:t.replace(/Once$/,``),Bd(e,t[0].toLowerCase()+t.slice(1))||Bd(e,sf(t))||Bd(e,t))}function fg(e){let{type:t,vnode:n,proxy:r,withProxy:i,propsOptions:[a],slots:o,attrs:s,emit:c,render:l,renderCache:u,props:d,data:f,setupState:p,ctx:m,inheritAttrs:h}=e,g=zm(e),_,v;try{if(n.shapeFlag&4){let e=i||r,t=e;_=g_(l.call(t,e,u,d,p,f,m)),v=s}else{let e=t;_=g_(e.length>1?e(d,{attrs:s,slots:o,emit:c}):e(d,null)),v=t.props?s:pg(s)}}catch(t){e_.length=0,ym(t,e,1),_=Q(Qg)}let y=_;if(v&&h!==!1){let e=Object.keys(v),{shapeFlag:t}=y;e.length&&t&7&&(a&&e.some(Id)&&(v=mg(v,a)),y=p_(y,v,!1,!0))}return n.dirs&&(y=p_(y,null,!1,!0),y.dirs=y.dirs?y.dirs.concat(n.dirs):n.dirs),n.transition&&nh(Qm(y.type)&&th(y)||y,n.transition),_=y,zm(g),_}var pg=e=>{let t;for(let n in e)(n===`class`||n===`style`||Fd(n))&&((t||={})[n]=e[n]);return t},mg=(e,t)=>{let n={};for(let r in e)(!Id(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function hg(e,t,n){let{props:r,children:i,component:a}=e,{props:o,children:s,patchFlag:c}=t,l=a.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&c>=0){if(c&1024)return!0;if(c&16)return r?gg(r,o,l):!!o;if(c&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let n=e[t];if(_g(o,r,n)&&!dg(l,n))return!0}}}else return(i||s)&&(!s||!s.$stable)?!0:r===o?!1:r?!o||gg(r,o,l):!!o;return!1}function gg(e,t,n){let r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let i=0;i<r.length;i++){let a=r[i];if(_g(t,e,a)&&!dg(n,a))return!0}return!1}function _g(e,t,n){let r=e[n],i=t[n];return n===`style`&&Jd(r)&&Jd(i)?!kf(r,i):r!==i}function vg({vnode:e,parent:t,suspense:n},r){for(;t;){let n=t.subTree;if(n.suspense&&n.suspense.activeBranch===e&&(n.suspense.vnode.el=n.el=r,e=n),n===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}var yg={},bg=()=>Object.create(yg),xg=e=>Object.getPrototypeOf(e)===yg;function Sg(e,t,n,r=!1){let i={},a=bg();e.propsDefaults=Object.create(null),wg(e,t,i,a);for(let t in e.propsOptions[0])t in i||(i[t]=void 0);e.props=n?r?i:qp(i):e.type.props?i:a,e.attrs=a}function Cg(e,t,n,r){let{props:i,attrs:a,vnode:{patchFlag:o}}=e,s=em(i),[c]=e.propsOptions,l=!1;if((r||o>0)&&!(o&16)){if(o&8){let n=e.vnode.dynamicProps;for(let r=0;r<n.length;r++){let o=n[r];if(dg(e.emitsOptions,o))continue;let u=t[o];if(c){if(Bd(a,o))u!==a[o]&&(a[o]=u,l=!0);else{let t=af(o);i[t]=Tg(c,s,t,u,e,!1)}}else u!==a[o]&&(a[o]=u,l=!0)}}}else{wg(e,t,i,a)&&(l=!0);let r;for(let a in s)(!t||!Bd(t,a)&&((r=sf(a))===a||!Bd(t,r)))&&(c?n&&(n[a]!==void 0||n[r]!==void 0)&&(i[a]=Tg(c,s,a,void 0,e,!0)):delete i[a]);if(a!==s)for(let e in a)(!t||!Bd(t,e))&&(delete a[e],l=!0)}l&&fp(e.attrs,`set`,``)}function wg(e,t,n,r){let[i,a]=e.propsOptions,o=!1,s;if(t)for(let c in t){if(tf(c))continue;let l=t[c],u;i&&Bd(i,u=af(c))?!a||!a.includes(u)?n[u]=l:(s||={})[u]=l:dg(e.emitsOptions,c)||(!(c in r)||l!==r[c])&&(r[c]=l,o=!0)}if(a){let t=em(n),r=s||jd;for(let o=0;o<a.length;o++){let s=a[o];n[s]=Tg(i,t,s,r[s],e,!Bd(r,s))}}return o}function Tg(e,t,n,r,i,a){let o=e[n];if(o!=null){let e=Bd(o,`default`);if(e&&r===void 0){let e=o.default;if(o.type!==Function&&!o.skipFactory&&Gd(e)){let{propsDefaults:a}=i;if(n in a)r=a[n];else{let o=O_(i);r=a[n]=e.call(null,t),o()}}else r=e;i.ce&&i.ce._setProp(n,r)}o[0]&&(a&&!e?r=!1:o[1]&&(r===``||r===sf(n))&&(r=!0))}return r}var Eg=new WeakMap;function Dg(e,t,n=!1){let r=n?Eg:t.propsCache,i=r.get(e);if(i)return i;let a=e.props,o={},s=[],c=!1;if(!Gd(e)){let r=e=>{c=!0;let[n,r]=Dg(e,t,!0);Ld(o,n),r&&s.push(...r)};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}if(!a&&!c)return Jd(e)&&r.set(e,Md),Md;if(Vd(a))for(let e=0;e<a.length;e++){let t=af(a[e]);Og(t)&&(o[t]=jd)}else if(a)for(let e in a){let t=af(e);if(Og(t)){let n=a[e],r=o[t]=Vd(n)||Gd(n)?{type:n}:Ld({},n),i=r.type,c=!1,l=!0;if(Vd(i))for(let e=0;e<i.length;++e){let t=i[e],n=Gd(t)&&t.name;if(n===`Boolean`){c=!0;break}n===`String`&&(l=!1)}else c=Gd(i)&&i.name===`Boolean`;r[0]=c,r[1]=l,(c||Bd(r,`default`))&&s.push(t)}}let l=[o,s];return Jd(e)&&r.set(e,l),l}function Og(e){return e[0]!==`$`&&!tf(e)}var kg=e=>e===`_`||e===`_ctx`||e===`$stable`,Ag=e=>Vd(e)?e.map(g_):[g_(e)],jg=(e,t,n)=>{if(t._n)return t;let r=Bm((...e)=>Ag(t(...e)),n);return r._c=!1,r},Mg=(e,t,n)=>{let r=e._ctx;for(let n in e){if(kg(n))continue;let i=e[n];if(Gd(i))t[n]=jg(n,i,r);else if(i!=null){let e=Ag(i);t[n]=()=>e}}},Ng=(e,t)=>{let n=Ag(t);e.slots.default=()=>n},Pg=(e,t,n)=>{for(let r in t)(n||!kg(r))&&(e[r]=t[r])},Fg=(e,t,n)=>{let r=e.slots=bg();if(e.vnode.shapeFlag&32){let e=t._;e?(Pg(r,t,n),n&&ff(r,`_`,e,!0)):Mg(t,r)}else t&&Ng(e,t)},Ig=(e,t,n)=>{let{vnode:r,slots:i}=e,a=!0,o=jd;if(r.shapeFlag&32){let e=t._;e?n&&e===1?a=!1:Pg(i,t,n):(a=!t.$stable,Mg(t,i)),o=t}else t&&(Ng(e,t),o={default:1});if(a)for(let e in i)!kg(e)&&o[e]==null&&delete i[e]},Lg=Yg;function Rg(e){return zg(e)}function zg(e,t){let n=hf();n.__VUE__=!0;let{insert:r,remove:i,patchProp:a,createElement:o,createText:s,createComment:c,setText:l,setElementText:u,parentNode:d,nextSibling:f,setScopeId:p=Nd,insertStaticContent:m}=e,h=(e,t,n,r=null,i=null,a=null,o=void 0,s=null,c=!!t.dynamicChildren)=>{if(e===t)return;e&&!c_(e,t)&&(r=fe(e),se(e,i,a,!0),e=null),t.patchFlag===-2&&(c=!1,t.dynamicChildren=null),t.dynamicChildren&&e&&e.dynamicChildren&&e.dynamicChildren.hasOnce&&(t.dynamicChildren===Md&&(t.dynamicChildren=[]),t.dynamicChildren.hasOnce=!0);let{type:l,ref:u,shapeFlag:d}=t;switch(l){case Zg:g(e,t,n,r);break;case Qg:_(e,t,n,r);break;case $g:e??v(t,n,r,o);break;case Xg:ee(e,t,n,r,i,a,o,s,c);break;default:d&1?x(e,t,n,r,i,a,o,s,c):d&6?te(e,t,n,r,i,a,o,s,c):(d&64||d&128)&&l.process(e,t,n,r,i,a,o,s,c,he)}u!=null&&i?sh(u,e&&e.ref,a,t||e,!t):u==null&&e&&e.ref!=null&&sh(e.ref,null,a,e,!0)},g=(e,t,n,i)=>{if(e==null)r(t.el=s(t.children),n,i);else{let n=t.el=e.el;t.children!==e.children&&l(n,t.children)}},_=(e,t,n,i)=>{e==null?r(t.el=c(t.children||``),n,i):t.el=e.el},v=(e,t,n,r)=>{[e.el,e.anchor]=m(e.children,t,n,r,e.el,e.anchor)},y=({el:e,anchor:t},n,i)=>{let a;for(;e&&e!==t;)a=f(e),r(e,n,i),e=a;r(t,n,i)},b=({el:e,anchor:t})=>{let n;for(;e&&e!==t;)n=f(e),i(e),e=n;i(t)},x=(e,t,n,r,i,a,o,s,c)=>{if(t.type===`svg`?o=`svg`:t.type===`math`&&(o=`mathml`),e==null)S(t,n,r,i,a,o,s,c);else{let n=e.el&&e.el._isVueCE?e.el:null;try{n&&n._beginPatch(),T(e,t,i,a,o,s,c)}finally{n&&n._endPatch()}}},S=(e,t,n,i,s,c,l,d)=>{let f,p,{props:m,shapeFlag:h,transition:g,dirs:_}=e;if(f=e.el=o(e.type,c,m&&m.is,m),h&8?u(f,e.children):h&16&&w(e.children,f,null,i,s,Bg(e,c),l,d),_&&Hm(e,null,i,`created`),C(f,e,e.scopeId,l,i),m){for(let e in m)e!==`value`&&!tf(e)&&a(f,e,null,m[e],c,i);`value`in m&&a(f,`value`,null,m.value,c),(p=m.onVnodeBeforeMount)&&b_(p,i,e)}_&&Hm(e,null,i,`beforeMount`);let v=Hg(s,g);v&&g.beforeEnter(f),r(f,t,n),((p=m&&m.onVnodeMounted)||v||_)&&Lg(()=>{try{p&&b_(p,i,e),v&&g.enter(f),_&&Hm(e,null,i,`mounted`)}finally{}},s)},C=(e,t,n,r,i)=>{if(n&&p(e,n),r)for(let t=0;t<r.length;t++)p(e,r[t]);if(i){let n=i.subTree;if(t===n||Jg(n.type)&&(n.ssContent===t||n.ssFallback===t)){let t=i.vnode;C(e,t,t.scopeId,t.slotScopeIds,i.parent)}}},w=(e,t,n,r,i,a,o,s,c=0)=>{for(let l=c;l<e.length;l++){let c=e[l]=s?__(e[l]):g_(e[l]);h(null,c,t,n,r,i,a,o,s)}},T=(e,t,n,r,i,o,s)=>{let c=t.el=e.el,{patchFlag:l,dynamicChildren:d,dirs:f}=t;l|=e.patchFlag&16;let p=e.props||jd,m=t.props||jd,h;if(n&&Vg(n,!1),(h=m.onVnodeBeforeUpdate)&&b_(h,n,t,e),f&&Hm(t,e,n,`beforeUpdate`),n&&Vg(n,!0),d&&(!e.dynamicChildren||e.dynamicChildren.length!==d.length)&&(l=0,s=!1,d=null),(p.innerHTML&&m.innerHTML==null||p.textContent&&m.textContent==null)&&u(c,``),d?E(e.dynamicChildren,d,c,n,r,Bg(t,i),o):s||re(e,t,c,null,n,r,Bg(t,i),o,!1),l>0){if(l&16)D(c,p,m,n,i);else if(l&2&&p.class!==m.class&&a(c,`class`,null,m.class,i),l&4&&a(c,`style`,p.style,m.style,i),l&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let r=e[t],o=p[r],s=m[r];(s!==o||r===`value`)&&a(c,r,o,s,i,n)}}l&1&&e.children!==t.children&&u(c,t.children)}else!s&&d==null&&D(c,p,m,n,i);((h=m.onVnodeUpdated)||f)&&Lg(()=>{h&&b_(h,n,t,e),f&&Hm(t,e,n,`updated`)},r)},E=(e,t,n,r,i,a,o)=>{for(let s=0;s<t.length;s++){let c=e[s],l=t[s],u=c.el&&(c.type===Xg||!c_(c,l)||c.shapeFlag&198)?d(c.el):n;h(c,l,u,null,r,i,a,o,!0)}},D=(e,t,n,r,i)=>{if(t!==n){if(t!==jd)for(let o in t)!tf(o)&&!(o in n)&&a(e,o,t[o],null,i,r);for(let o in n){if(tf(o))continue;let s=n[o],c=t[o];s!==c&&o!==`value`&&a(e,o,c,s,i,r)}`value`in n&&a(e,`value`,t.value,n.value,i)}},ee=(e,t,n,i,a,o,c,l,u)=>{let d=t.el=e?e.el:s(``),f=t.anchor=e?e.anchor:s(``),{patchFlag:p,dynamicChildren:m,slotScopeIds:h}=t;h&&(l=l?l.concat(h):h),e==null?(r(d,n,i),r(f,n,i),w(t.children||[],n,f,a,o,c,l,u)):p>0&&p&64&&m&&e.dynamicChildren&&e.dynamicChildren.length===m.length?(E(e.dynamicChildren,m,n,a,o,c,l),(t.key!=null||a&&t===a.subTree)&&Ug(e,t,!0)):re(e,t,n,f,a,o,c,l,u)},te=(e,t,n,r,i,a,o,s,c)=>{t.slotScopeIds=s,e==null?t.shapeFlag&512?i.ctx.activate(t,n,r,o,c):O(t,n,r,i,a,o,c):k(e,t,c)},O=(e,t,n,r,i,a,o)=>{let s=e.component=C_(e,r,i);if(uh(e)&&(s.ctx.renderer=he),M_(s,!1,o),s.asyncDep){if(i&&i.registerDep(s,A,o),!e.el){let r=s.subTree=Q(Qg);_(null,r,t,n),e.placeholder=r.el}}else A(s,e,t,n,i,a,o)},k=(e,t,n)=>{let r=t.component=e.component;if(hg(e,t,n)){if(r.asyncDep&&!r.asyncResolved){t.el=e.el,ne(r,t,n);return}r.next=t,r.update()}else t.el=e.el,r.vnode=t},A=(e,t,n,r,i,a,o)=>{let s=()=>{if(e.isMounted){let{next:t,bu:n,u:r,parent:s,vnode:c}=e;{let n=Gg(e);if(n){t&&(t.el=c.el,ne(e,t,o)),n.asyncDep.then(()=>{Lg(()=>{e.isUnmounted||l()},i)});return}}let u=t,f;Vg(e,!1),t?(t.el=c.el,ne(e,t,o)):t=c,n&&df(n),(f=t.props&&t.props.onVnodeBeforeUpdate)&&b_(f,s,t,c),Vg(e,!0);let p=fg(e),m=e.subTree;e.subTree=p,h(m,p,d(m.el),fe(m),e,i,a),t.el=p.el,u===null&&vg(e,p.el),r&&Lg(r,i),(f=t.props&&t.props.onVnodeUpdated)&&Lg(()=>b_(f,s,t,c),i)}else{let o,{el:s,props:c}=t,{bm:l,m:u,parent:d,root:f,type:p}=e,m=lh(t);if(Vg(e,!1),l&&df(l),!m&&(o=c&&c.onVnodeBeforeMount)&&b_(o,d,t),Vg(e,!0),s&&_e){let t=()=>{e.subTree=fg(e),_e(s,e.subTree,e,i,null)};m&&p.__asyncHydrate?p.__asyncHydrate(s,e,t):t()}else{f.ce&&f.ce._hasShadowRoot()&&f.ce._injectChildStyle(p,e.parent?e.parent.type:void 0);let o=e.subTree=fg(e);h(null,o,n,r,e,i,a),t.el=o.el}if(u&&Lg(u,i),!m&&(o=c&&c.onVnodeMounted)){let e=t;Lg(()=>b_(o,d,e),i)}(t.shapeFlag&256||d&&lh(d.vnode)&&d.vnode.shapeFlag&256)&&e.a&&Lg(e.a,i),e.isMounted=!0,t=n=r=null}};e.scope.on();let c=e.effect=new zf(s);e.scope.off();let l=e.update=c.run.bind(c),u=e.job=c.runIfDirty.bind(c);u.i=e,u.id=e.uid,c.scheduler=()=>Am(u),Vg(e,!0),l()},ne=(e,t,n)=>{t.component=e;let r=e.vnode.props;e.vnode=t,e.next=null,Cg(e,t.props,r,n),Ig(e,t.children,n),ep(),Nm(e),tp()},re=(e,t,n,r,i,a,o,s,c=!1)=>{let l=e&&e.children,d=e?e.shapeFlag:0,f=t.children,{patchFlag:p,shapeFlag:m}=t;if(p>0){if(p&128){ae(l,f,n,r,i,a,o,s,c);return}if(p&256){ie(l,f,n,r,i,a,o,s,c);return}}m&8?(d&16&&de(l,i,a),f!==l&&u(n,f)):d&16?m&16?ae(l,f,n,r,i,a,o,s,c):de(l,i,a,!0):(d&8&&u(n,``),m&16&&w(f,n,r,i,a,o,s,c))},ie=(e,t,n,r,i,a,o,s,c)=>{e||=Md,t||=Md;let l=e.length,u=t.length,d=Math.min(l,u),f=0;for(;f<d;f++){let r=t[f]=c?__(t[f]):g_(t[f]);h(e[f],r,n,null,i,a,o,s,c)}l>u?de(e,i,a,!0,!1,d):w(t,n,r,i,a,o,s,c,d)},ae=(e,t,n,r,i,a,o,s,c)=>{let l=0,u=t.length,d=e.length-1,f=u-1;for(;l<=d&&l<=f;){let r=e[l],u=t[l]=c?__(t[l]):g_(t[l]);if(c_(r,u))h(r,u,n,null,i,a,o,s,c);else break;l++}for(;l<=d&&l<=f;){let r=e[d],l=t[f]=c?__(t[f]):g_(t[f]);if(c_(r,l))h(r,l,n,null,i,a,o,s,c);else break;d--,f--}if(l>d){if(l<=f){let e=f+1,d=e<u?t[e].el:r;for(;l<=f;)h(null,t[l]=c?__(t[l]):g_(t[l]),n,d,i,a,o,s,c),l++}}else if(l>f)for(;l<=d;)se(e[l],i,a,!0),l++;else{let p=l,m=l,g=new Map;for(l=m;l<=f;l++){let e=t[l]=c?__(t[l]):g_(t[l]);e.key!=null&&g.set(e.key,l)}let _,v=0,y=f-m+1,b=!1,x=0,S=Array(y);for(l=0;l<y;l++)S[l]=0;for(l=p;l<=d;l++){let r=e[l];if(v>=y){se(r,i,a,!0);continue}let u;if(r.key!=null)u=g.get(r.key);else for(_=m;_<=f;_++)if(S[_-m]===0&&c_(r,t[_])){u=_;break}u===void 0?se(r,i,a,!0):(S[u-m]=l+1,u>=x?x=u:b=!0,h(r,t[u],n,null,i,a,o,s,c),v++)}let C=b?Wg(S):Md;for(_=C.length-1,l=y-1;l>=0;l--){let e=m+l,d=t[e],f=t[e+1],p=e+1<u?f.el||qg(f):r;S[l]===0?h(null,d,n,p,i,a,o,s,c):b&&(_<0||l!==C[_]?oe(d,n,p,2):_--)}}},oe=(e,t,n,a,o=null)=>{let{el:s,type:c,transition:l,children:u,shapeFlag:d}=e;if(d&6){oe(e.component.subTree,t,n,a);return}if(d&128){e.suspense.move(t,n,a);return}if(d&64){c.move(e,t,n,he);return}if(c===Xg){r(s,t,n);for(let e=0;e<u.length;e++)oe(u[e],t,n,a);r(e.anchor,t,n);return}if(c===$g){y(e,t,n);return}if(a!==2&&d&1&&l){if(a===0)l.persisted&&!s[$m]?r(s,t,n):(l.beforeEnter(s),r(s,t,n),Lg(()=>l.enter(s),o));else{let{leave:a,delayLeave:o,afterLeave:c}=l,u=()=>{e.ctx.isUnmounted?i(s):r(s,t,n)},d=()=>{let e=s._isLeaving||!!s[$m];s._isLeaving&&s[$m](!0),l.persisted&&!e?u():a(s,()=>{u(),c&&c()})};o?o(s,u,d):d()}}else r(s,t,n)},se=(e,t,n,r=!1,i=!1)=>{let{type:a,props:o,ref:s,children:c,dynamicChildren:l,shapeFlag:u,patchFlag:d,dirs:f,cacheIndex:p,memo:m}=e;if((d===-2||l&&l.hasOnce)&&(i=!1),s!=null&&(ep(),sh(s,null,n,e,!0),tp()),p!=null&&(!e.ctx||e.ctx===t)&&(t.renderCache[p]=void 0),u&256){t.ctx.deactivate(e);return}let h=u&1&&f,g=!lh(e),_;if(g&&(_=o&&o.onVnodeBeforeUnmount)&&b_(_,t,e),u&6)ue(e.component,n,r);else{if(u&128){e.suspense.unmount(n,r);return}h&&Hm(e,null,t,`beforeUnmount`),u&64?e.type.remove(e,t,n,he,r):l&&!l.hasOnce&&(a!==Xg||d>0&&d&64)?de(l,t,n,!1,!0):(a===Xg&&d&384||!i&&u&16)&&de(c,t,n),r&&ce(e)}let v=m!=null&&p==null;(g&&(_=o&&o.onVnodeUnmounted)||h||v)&&Lg(()=>{_&&b_(_,t,e),h&&Hm(e,null,t,`unmounted`),v&&(e.el=null)},n)},ce=e=>{let{type:t,el:n,anchor:r,transition:a}=e;if(t===Xg){le(n,r);return}if(t===$g){b(e),a&&!a.persisted&&a.afterLeave&&a.afterLeave();return}let o=()=>{i(n),a&&!a.persisted&&a.afterLeave&&a.afterLeave()};if(e.shapeFlag&1&&a&&!a.persisted){let{leave:t,delayLeave:r}=a,i=()=>t(n,o);r?r(e.el,o,i):i()}else o()},le=(e,t)=>{let n;for(;e!==t;)n=f(e),i(e),e=n;i(t)},ue=(e,t,n)=>{let{bum:r,scope:i,job:a,subTree:o,um:s,m:c,a:l}=e;Kg(c),Kg(l),r&&df(r),i.stop(),a?(a.flags|=8,se(o,e,t,n)):e.vnode.el&&o&&(o.transition=e.vnode.transition,se(o,e,t,n)),s&&Lg(s,t),Lg(()=>{e.isUnmounted=!0},t)},de=(e,t,n,r=!1,i=!1,a=0)=>{for(let o=a;o<e.length;o++)se(e[o],t,n,r,i)},fe=e=>{if(e.shapeFlag&6)return fe(e.component.subTree);if(e.shapeFlag&128)return e.suspense.next();let t=f(e.anchor||e.el),n=t&&t[Zm];return n?f(n):t},pe=!1,me=(e,t,n)=>{let r;e==null?t._vnode&&(se(t._vnode,null,null,!0),r=t._vnode.component):h(t._vnode||null,e,t,null,null,null,n),t._vnode=e,pe||=(pe=!0,Nm(r),Pm(),!1)},he={p:h,um:se,m:oe,r:ce,mt:O,mc:w,pc:re,pbc:E,n:fe,o:e},ge,_e;return t&&([ge,_e]=t(he)),{render:me,hydrate:ge,createApp:ag(me,ge)}}function Bg({type:e,props:t},n){return n===`svg`&&e===`foreignObject`||n===`mathml`&&e===`annotation-xml`&&t&&t.encoding&&t.encoding.includes(`html`)?void 0:n}function Vg({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Hg(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Ug(e,t,n=!1){let r=e.children,i=t.children;if(Vd(r)&&Vd(i))for(let e=0;e<r.length;e++){let t=r[e],a=i[e];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=i[e]=__(i[e]),a.el=t.el),!n&&a.patchFlag!==-2&&Ug(t,a)),a.type===Zg&&(a.patchFlag===-1&&(a=i[e]=__(a)),a.el=t.el),a.type===Qg&&!a.el&&(a.el=t.el)}}function Wg(e){let t=e.slice(),n=[0],r,i,a,o,s,c=e.length;for(r=0;r<c;r++){let c=e[r];if(c!==0){if(i=n[n.length-1],e[i]<c){t[r]=i,n.push(r);continue}for(a=0,o=n.length-1;a<o;)s=a+o>>1,e[n[s]]<c?a=s+1:o=s;c<e[n[a]]&&(a>0&&(t[r]=n[a-1]),n[a]=r)}}for(a=n.length,o=n[a-1];a-->0;)n[a]=o,o=t[o];return n}function Gg(e){let t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Gg(t)}function Kg(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function qg(e){if(e.placeholder)return e.placeholder;let t=e.component;return t?qg(t.subTree):null}var Jg=e=>e.__isSuspense;function Yg(e,t){t&&t.pendingBranch?Vd(e)?t.effects.push(...e):t.effects.push(e):Mm(e)}var Xg=Symbol.for(`v-fgt`),Zg=Symbol.for(`v-txt`),Qg=Symbol.for(`v-cmt`),$g=Symbol.for(`v-stc`),e_=[],t_=null;function Y(e=!1){e_.push(t_=e?null:[])}function n_(){e_.pop(),t_=e_[e_.length-1]||null}var r_=1;function i_(e,t=!1){r_+=e,e<0&&t_&&t&&(t_.hasOnce=!0)}function a_(e){return e.dynamicChildren=r_>0?t_||Md:null,n_(),r_>0&&t_&&t_.push(e),e}function X(e,t,n,r,i,a){return a_(Z(e,t,n,r,i,a,!0))}function o_(e,t,n,r,i){return a_(Q(e,t,n,r,i,!0))}function s_(e){return e?e.__v_isVNode===!0:!1}function c_(e,t){return e.type===t.type&&e.key===t.key}var l_=({key:e})=>e??null,u_=({ref:e,ref_key:t,ref_for:n})=>(typeof e==`number`&&(e=``+e),e==null?null:Kd(e)||im(e)||Gd(e)?{i:Lm,r:e,k:t,f:!!n}:e);function Z(e,t=null,n=null,r=0,i=null,a=e===Xg?0:1,o=!1,s=!1){let c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&l_(t),ref:t&&u_(t),scopeId:Rm,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:a,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:Lm};return s?(v_(c,n),a&128&&e.normalize(c)):n&&(c.shapeFlag|=Kd(n)?8:16),r_>0&&!o&&t_&&(c.patchFlag>0||a&6)&&c.patchFlag!==32&&t_.push(c),c}var Q=d_;function d_(e,t=null,n=null,r=0,i=null,a=!1){if((!e||e===kh)&&(e=Qg),s_(e)){let r=p_(e,t,!0);return n&&v_(r,n),r_>0&&!a&&t_&&(r.shapeFlag&6?t_[t_.indexOf(e)]=r:t_.push(r)),r.patchFlag=-2,r}if(H_(e)&&(e=e.__vccOpts),t){t=f_(t);let{class:e,style:n}=t;e&&!Kd(e)&&(t.class=xf(e)),Jd(n)&&($p(n)&&!Vd(n)&&(n=Ld({},n)),t.style=gf(n))}let o=Kd(e)?1:Jg(e)?128:Qm(e)?64:Jd(e)?4:Gd(e)?2:0;return Z(e,t,n,r,i,o,a,!0)}function f_(e){return e?$p(e)||xg(e)?Ld({},e):e:null}function p_(e,t,n=!1,r=!1){let{props:i,ref:a,patchFlag:o,children:s,transition:c}=e,l=t?y_(i||{},t):i,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:l,key:l&&l_(l),ref:t&&t.ref?n&&a?Vd(a)?a.concat(u_(t)):[a,u_(t)]:u_(t):a,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:s,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Xg?o===-1?16:o|16:o,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:c,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&p_(e.ssContent),ssFallback:e.ssFallback&&p_(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce,cacheIndex:e.cacheIndex};return c&&r&&nh(u,c.clone(u)),u}function m_(e=` `,t=0){return Q(Zg,null,e,t)}function h_(e,t){let n=Q($g,null,e);return n.staticCount=t,n}function $(e=``,t=!1){return t?(Y(),o_(Qg,null,e)):Q(Qg,null,e)}function g_(e){return e==null||typeof e==`boolean`?Q(Qg):Vd(e)?Q(Xg,null,e.slice()):s_(e)?__(e):Q(Zg,null,String(e))}function __(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:p_(e)}function v_(e,t){let n=0,{shapeFlag:r}=e;if(t==null)t=null;else if(Vd(t))n=16;else if(typeof t==`object`){if(r&65){let n=t.default;n&&(n._c&&(n._d=!1),v_(e,n()),n._c&&(n._d=!0));return}{n=32;let r=t._;!r&&!xg(t)?t._ctx=Lm:r===3&&Lm&&(Lm.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}}else if(Gd(t)){if(r&65){v_(e,{default:t});return}t={default:t,_ctx:Lm},n=32}else t=String(t),r&64?(n=16,t=[m_(t)]):n=8;e.children=t,e.shapeFlag|=n}function y_(...e){let t={};for(let n=0;n<e.length;n++){let r=e[n];for(let e in r)if(e===`class`)t.class!==r.class&&(t.class=xf([t.class,r.class]));else if(e===`style`)t.style=gf([t.style,r.style]);else if(Fd(e)){let n=t[e],i=r[e];i&&n!==i&&!(Vd(n)&&n.includes(i))?t[e]=n?[].concat(n,i):i:i==null&&n==null&&!Id(e)&&(t[e]=i)}else e!==``&&(t[e]=r[e])}return t}function b_(e,t,n,r=null){vm(e,t,7,[n,r])}var x_=rg(),S_=0;function C_(e,t,n){let r=e.type,i=(t?t.appContext:e.appContext)||x_,a={uid:S_++,vnode:e,type:r,parent:t,appContext:i,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Ff(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(i.provides),ids:t?t.ids:[``,0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Dg(r,i),emitsOptions:ug(r,i),emit:null,emitted:null,propsDefaults:jd,inheritAttrs:r.inheritAttrs,ctx:jd,data:jd,props:jd,attrs:jd,slots:jd,refs:jd,setupState:jd,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return a.ctx={_:a},a.root=t?t.root:a,a.emit=cg.bind(null,a),e.ce&&e.ce(a),a}var w_=null,T_=()=>w_||Lm,E_,D_;{let e=hf(),t=(t,n)=>{let r;return(r=e[t])||(r=e[t]=[]),r.push(n),e=>{r.length>1?r.forEach(t=>t(e)):r[0](e)}};E_=t(`__VUE_INSTANCE_SETTERS__`,e=>w_=e),D_=t(`__VUE_SSR_SETTERS__`,e=>j_=e)}var O_=e=>{let t=w_;return E_(e),e.scope.on(),()=>{e.scope.off(),E_(t)}},k_=()=>{w_&&w_.scope.off(),E_(null)};function A_(e){return e.vnode.shapeFlag&4}var j_=!1;function M_(e,t=!1,n=!1){t&&D_(t);let{props:r,children:i}=e.vnode,a=A_(e);Sg(e,r,a,t),Fg(e,i,n||t);let o=a?N_(e,t):void 0;return t&&D_(!1),o}function N_(e,t){let n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Rh);let{setup:r}=n;if(r){ep();let n=e.setupContext=r.length>1?z_(e):null,i=O_(e),a=_m(r,e,0,[e.props,n]),o=Yd(a);if(tp(),i(),(o||e.sp)&&!lh(e)&&ih(e),o){if(a.then(k_,k_),t)return a.then(n=>{D_(!0);try{P_(e,n,t)}finally{D_(!1)}}).catch(t=>{ym(t,e,0)});e.asyncDep=a}else P_(e,a,t)}else L_(e,t)}function P_(e,t,n){Gd(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Jd(t)&&(e.setupState=cm(t)),L_(e,n)}var F_,I_;function L_(e,t,n){let r=e.type;if(!e.render){if(!t&&F_&&!r.render){let t=r.template||qh(e).template;if(t){let{isCustomElement:n,compilerOptions:i}=e.appContext.config,{delimiters:a,compilerOptions:o}=r;r.render=F_(t,Ld(Ld({isCustomElement:n,delimiters:a},i),o))}}e.render=r.render||Nd,I_&&I_(e)}{let t=O_(e);ep();try{Uh(e)}finally{tp(),t()}}}var R_={get(e,t){return dp(e,`get`,``),e[t]}};function z_(e){return{attrs:new Proxy(e.attrs,R_),slots:e.slots,emit:e.emit,expose:t=>{e.exposed=t||{}}}}function B_(e){return e.exposed?e.exposeProxy||=new Proxy(cm(tm(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Ih)return Ih[n](e)},has(e,t){return t in e||t in Ih}}):e.proxy}function V_(e,t=!0){return Gd(e)?e.displayName||e.name:e.name||t&&e.__name}function H_(e){return Gd(e)&&`__vccOpts`in e}var U_=(e,t)=>um(e,t,j_),W_=`3.5.43`,G_=void 0,K_=typeof window<`u`&&window.trustedTypes;if(K_)try{G_=K_.createPolicy(`vue`,{createHTML:e=>e})}catch{}var q_=G_?e=>G_.createHTML(e):e=>e,J_=`http://www.w3.org/2000/svg`,Y_=`http://www.w3.org/1998/Math/MathML`,X_=typeof document<`u`?document:null,Z_=X_&&X_.createElement(`template`),Q_={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{let t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{let i=t===`svg`?X_.createElementNS(J_,e):t===`mathml`?X_.createElementNS(Y_,e):n?X_.createElement(e,{is:n}):X_.createElement(e);return e===`select`&&r&&r.multiple!=null&&i.setAttribute(`multiple`,r.multiple),i},createText:e=>X_.createTextNode(e),createComment:e=>X_.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>X_.querySelector(e),setScopeId(e,t){e.setAttribute(t,``)},insertStaticContent(e,t,n,r,i,a){let o=n?n.previousSibling:t.lastChild;if(i&&(i===a||i.nextSibling))for(;t.insertBefore(i.cloneNode(!0),n),i!==a&&(i=i.nextSibling););else{Z_.innerHTML=q_(r===`svg`?`<svg>${e}</svg>`:r===`mathml`?`<math>${e}</math>`:e);let i=Z_.content;if(r===`svg`||r===`mathml`){let e=i.firstChild;for(;e.firstChild;)i.appendChild(e.firstChild);i.removeChild(e)}t.insertBefore(i,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},$_=Symbol(`_vtc`);function ev(e,t,n){let r=e[$_];r&&(t=(t?[t,...r]:[...r]).join(` `)),t==null?e.removeAttribute(`class`):n?e.setAttribute(`class`,t):e.className=t}var tv=Symbol(`_vod`),nv=Symbol(`_vsh`),rv={name:`show`,beforeMount(e,{value:t},{transition:n}){e[tv]=e.style.display===`none`?``:e.style.display,n&&t?n.beforeEnter(e):iv(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:r}){!t!=!n&&(r?t?(r.beforeEnter(e),iv(e,!0),r.enter(e)):r.leave(e,()=>{iv(e,!1)}):iv(e,t))},beforeUnmount(e,{value:t}){iv(e,t)}};function iv(e,t){e.style.display=t?e[tv]:`none`,e[nv]=!t}var av=Symbol(``),ov=/(?:^|;)\s*display\s*:/;function sv(e,t,n){let r=e.style,i=Kd(n),a=!1;if(n&&!i){if(t){if(Kd(t))for(let e of t.split(`;`)){let t=e.slice(0,e.indexOf(`:`)).trim();n[t]??lv(r,t,``)}else for(let e in t)n[e]??lv(r,e,``)}for(let i in n){i===`display`&&(a=!0);let o=n[i];o==null?lv(r,i,``):pv(e,i,!Kd(t)&&t?t[i]:void 0,o)||lv(r,i,o)}}else if(i){if(t!==n){let e=r[av];e&&(n+=`;`+e),r.cssText=n,a=ov.test(n)}}else t&&e.removeAttribute(`style`);tv in e&&(e[tv]=a?r.display:``,e[nv]&&(r.display=`none`))}var cv=/\s*!important$/;function lv(e,t,n){if(Vd(n))n.forEach(n=>lv(e,t,n));else if(n??=``,t.startsWith(`--`))cv.test(n)?e.setProperty(t,n.replace(cv,``),`important`):e.setProperty(t,n);else{let r=fv(e,t);cv.test(n)?e.setProperty(sf(r),n.replace(cv,``),`important`):e[r]=n}}var uv=[`Webkit`,`Moz`,`ms`],dv={};function fv(e,t){let n=dv[t];if(n)return n;let r=af(t);if(r!==`filter`&&r in e)return dv[t]=r;r=cf(r);for(let n=0;n<uv.length;n++){let i=uv[n]+r;if(i in e)return dv[t]=i}return t}function pv(e,t,n,r){return e.tagName===`TEXTAREA`&&(t===`width`||t===`height`)&&Kd(r)&&n===r}var mv=`http://www.w3.org/1999/xlink`;function hv(e,t,n,r,i,a=Cf(t)){r&&t.startsWith(`xlink:`)?n==null?e.removeAttributeNS(mv,t.slice(6,t.length)):e.setAttributeNS(mv,t,n):n==null||a&&!wf(n)?e.removeAttribute(t):e.setAttribute(t,a?``:qd(n)?String(n):n)}function gv(e,t,n,r,i){if(t===`innerHTML`||t===`textContent`){n!=null&&(e[t]=t===`innerHTML`?q_(n):n);return}let a=e.tagName;if(t===`value`&&a!==`PROGRESS`&&!a.includes(`-`)){let r=a===`OPTION`?e.getAttribute(`value`)||``:e.value,i=n==null?e.type===`checkbox`?`on`:``:String(n);(r!==i||!(`_value`in e))&&(e.value=i),n??e.removeAttribute(t),e._value=n;return}let o=!1;if(n===``||n==null){let r=typeof e[t];r===`boolean`?n=wf(n):n==null&&r===`string`?(n=``,o=!0):r===`number`&&(n=0,o=!0)}try{e[t]=n}catch{}o&&e.removeAttribute(i||t)}function _v(e,t,n,r){e.addEventListener(t,n,r)}function vv(e,t,n,r){e.removeEventListener(t,n,r)}var yv=Symbol(`_vei`);function bv(e,t,n,r,i=null){let a=e[yv]||(e[yv]={}),o=a[t];if(r&&o)o.value=r;else{let[n,s]=Cv(t);r?_v(e,n,a[t]=Dv(r,i),s):o&&(vv(e,n,o,s),a[t]=void 0)}}var xv=/(Once|Passive|Capture)$/,Sv=/^on:?(?:Once|Passive|Capture)$/;function Cv(e){let t,n;for(;(n=e.match(xv))&&!Sv.test(e);)t||={},e=e.slice(0,e.length-n[1].length),t[n[1].toLowerCase()]=!0;return[e[2]===`:`?e.slice(3):sf(e.slice(2)),t]}var wv=0,Tv=Promise.resolve(),Ev=()=>wv||=(Tv.then(()=>wv=0),Date.now());function Dv(e,t){let n=e=>{if(!e._vts)e._vts=Date.now();else if(e._vts<=n.attached)return;let r=n.value;if(Vd(r)){let n=e.stopImmediatePropagation;e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0};let i=r.slice(),a=[e];for(let n=0;n<i.length&&!e._stopped;n++){let e=i[n];e&&vm(e,t,5,a)}}else vm(r,t,5,[e])};return n.value=e,n.attached=Ev(),n}var Ov=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,kv=(e,t,n,r,i,a)=>{let o=i===`svg`;t===`class`?ev(e,r,o):t===`style`?sv(e,n,r):Fd(t)?Id(t)||bv(e,t,n,r,a):(t[0]===`.`?(t=t.slice(1),1):t[0]===`^`?(t=t.slice(1),0):Av(e,t,r,o))?(gv(e,t,r),!e.tagName.includes(`-`)&&(t===`value`||t===`checked`||t===`selected`)&&hv(e,t,r,o,a,t!==`value`)):e._isVueCE&&(jv(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Kd(r)))?gv(e,af(t),r,a,t):(t===`true-value`?e._trueValue=r:t===`false-value`&&(e._falseValue=r),hv(e,t,r,o))};function Av(e,t,n,r){if(r)return!!(t===`innerHTML`||t===`textContent`||t in e&&Ov(t)&&Gd(n));if(t===`spellcheck`||t===`draggable`||t===`translate`||t===`autocorrect`||t===`sandbox`&&e.tagName===`IFRAME`||t===`form`||t===`list`&&e.tagName===`INPUT`||t===`type`&&e.tagName===`TEXTAREA`)return!1;if(t===`width`||t===`height`){let t=e.tagName;if(t===`IMG`||t===`VIDEO`||t===`CANVAS`||t===`SOURCE`)return!1}return Ov(t)&&Kd(n)?!1:t in e}function jv(e,t){let n=e._def.props;if(!n)return!1;let r=af(t);return Array.isArray(n)?n.some(e=>af(e)===r):Object.keys(n).some(e=>af(e)===r)}var Mv=e=>{let t=e.props[`onUpdate:modelValue`]||!1;return Vd(t)?e=>df(t,e):t},Nv=Symbol(`_assign`),Pv={deep:!0,created(e,{value:t,modifiers:{number:n}},r){e._modelValue=t,_v(e,`change`,()=>{let t=Array.prototype.filter.call(e.options,e=>e.selected).map(e=>n?pf(Lv(e)):Lv(e)),r=e.multiple,i=r?Ud(e._modelValue)?new Set(t):t:t[0],a=e._pendingValue=[r,r?Vd(i)?t.slice():t:i];try{e[Nv](i)}finally{Om(()=>{e._pendingValue===a&&(e._pendingValue=void 0)})}}),e[Nv]=Mv(r)},mounted(e,{value:t}){Iv(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[Nv]=Mv(n)},updated(e,{value:t}){let n=e._pendingValue;e._pendingValue=void 0,(!n||n[0]!==e.multiple||!Fv(t,n[1],n[0]))&&Iv(e,t)}};function Fv(e,t,n){if(!n||Vd(e))return kf(e,t);if(Ud(e)){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}return!1}function Iv(e,t){let n=e.multiple,r=Vd(t);if(!n||r||Ud(t)){for(let i=0,a=e.options.length;i<a;i++){let a=e.options[i],o=Lv(a);if(n){if(r){let e=typeof o;a.selected=e===`string`||e===`number`?t.some(e=>String(e)===String(o)):Af(t,o)>-1}else a.selected=t.has(o)}else if(kf(Lv(a),t)){e.selectedIndex!==i&&(e.selectedIndex=i);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Lv(e){return`_value`in e?e._value:e.value}var Rv=[`ctrl`,`shift`,`alt`,`meta`],zv={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>`button`in e&&e.button!==0,middle:e=>`button`in e&&e.button!==1,right:e=>`button`in e&&e.button!==2,exact:(e,t)=>Rv.some(n=>e[`${n}Key`]&&!t.includes(n))},Bv=(e,t)=>{if(!e)return e;let n=e._withMods||={},r=t.join(`.`);return n[r]||(n[r]=((n,...r)=>{for(let e=0;e<t.length;e++){let r=zv[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},Vv={esc:`escape`,space:` `,up:`arrow-up`,left:`arrow-left`,right:`arrow-right`,down:`arrow-down`,delete:`backspace`},Hv=(e,t)=>{let n=e._withKeys||={},r=t.join(`.`);return n[r]||(n[r]=(n=>{if(!(`key`in n))return;let r=sf(n.key);if(t.some(e=>e===r||Vv[e]===r))return e(n)}))},Uv=Ld({patchProp:kv},Q_),Wv;function Gv(){return Wv||=Rg(Uv)}var Kv=((...e)=>{let t=Gv().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=Jv(e);if(!r)return;let i=t._component;!Gd(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent=``);let a=n(r,!1,qv(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),a},t});function qv(e){if(e instanceof SVGElement)return`svg`;if(typeof MathMLElement==`function`&&e instanceof MathMLElement)return`mathml`}function Jv(e){return Kd(e)?document.querySelector(e):e}var Yv={"circle-check":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M256 512a256 256 0 1 1 0-512 256 256 0 1 1 0 512m118-366.3c-10.7-7.8-25.7-5.4-33.5 5.3L221.1 315.2 169 263.1c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l72 72c5 5 11.8 7.5 18.8 7s13.4-4.1 17.5-9.8l135.9-187c7.8-10.7 5.4-25.7-5.3-33.5"/></svg>`,"circle-exclamation":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M256 512a256 256 0 1 1 0-512 256 256 0 1 1 0 512m0-192a32 32 0 1 0 0 64 32 32 0 1 0 0-64m0-192c-18.2 0-32.7 15.5-31.4 33.7l7.4 104c.9 12.6 11.4 22.3 23.9 22.3 12.6 0 23-9.7 23.9-22.3l7.4-104c1.3-18.2-13.1-33.7-31.4-33.7z"/></svg>`,"circle-xmark":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M256 512a256 256 0 1 0 0-512 256 256 0 1 0 0 512m-89-345c9.4-9.4 24.6-9.4 33.9 0l55 55 55-55c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-55 55 55 55c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-55-55-55 55c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l55-55-55-55c-9.4-9.4-9.4-24.6 0-33.9"/></svg>`,cog:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M195.1 9.5c3-14.8 16.1-25.5 31.3-25.5h59.8c15.2 0 28.3 10.7 31.3 25.5l14.5 70c14.1 6 27.3 13.7 39.3 22.8l67.8-22.5c14.4-4.8 30.2 1.2 37.8 14.4l29.9 51.8c7.6 13.2 4.9 29.8-6.5 39.9L447 233.3c.9 7.4 1.3 15 1.3 22.7s-.5 15.3-1.3 22.7l53.4 47.5c11.4 10.1 14 26.8 6.5 39.9L477 417.9c-7.6 13.1-23.4 19.2-37.8 14.4l-67.8-22.5c-12.1 9.1-25.3 16.7-39.3 22.8l-14.4 69.9c-3.1 14.9-16.2 25.5-31.3 25.5h-59.8c-15.2 0-28.3-10.7-31.3-25.5l-14.4-69.9c-14.1-6-27.2-13.7-39.3-22.8l-68.1 22.5c-14.4 4.8-30.2-1.2-37.8-14.4L5.8 366.1c-7.6-13.2-4.9-29.8 6.5-39.9l53.4-47.5c-.9-7.4-1.3-15-1.3-22.7s.5-15.3 1.3-22.7l-53.4-47.5C.9 175.7-1.7 159 5.8 145.9l29.9-51.8c7.6-13.2 23.4-19.2 37.8-14.4l67.8 22.5c12.1-9.1 25.3-16.7 39.3-22.8zM256.3 336a80 80 0 1 0-.6-160 80 80 0 1 0 .6 160"/></svg>`,comment:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M512 240c0 132.5-114.6 240-256 240-37.1 0-72.3-7.4-104.1-20.7L33.5 510.1c-9.4 4-20.2 1.7-27.1-5.8s-8.4-18.5-3.6-27.5l48.8-92.2C19.2 344.3 0 294.3 0 240 0 107.5 114.6 0 256 0s256 107.5 256 240"/></svg>`,"comment-regular":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M51.9 384.9C19.3 344.6 0 294.4 0 240 0 107.5 114.6 0 256 0s256 107.5 256 240-114.6 240-256 240c-36.5 0-71.2-7.2-102.6-20L37 509.9c-3.7 1.6-7.5 2.1-11.5 2.1C11.4 512 0 500.6 0 486.5c0-4.3 1.1-8.5 3.1-12.2zm37.3-30.2c12.2 15.1 14.1 36.1 4.8 53.2L76 441l58.5-25.1c11.8-5.1 25.2-5.2 37.1-.3 25.7 10.5 54.2 16.4 84.3 16.4 117.8 0 208-88.8 208-192S373.8 48 256 48 48 136.8 48 240c0 42.8 15.1 82.4 41.2 114.7"/></svg>`,"face-smile":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M256 512a256 256 0 1 0 0-512 256 256 0 1 0 0 512m-90.6-190.1c20.4 28 53.4 46.1 90.6 46.1s70.2-18.1 90.6-46.1c7.8-10.7 22.8-13.1 33.5-5.3s13.1 22.8 5.3 33.5C356.3 390 309.2 416 256 416s-100.3-26-129.4-65.9c-7.8-10.7-5.4-25.7 5.3-33.5s25.7-5.4 33.5 5.3M144 208a32 32 0 1 1 64 0 32 32 0 1 1-64 0m192-32a32 32 0 1 1 0 64 32 32 0 1 1 0-64"/></svg>`,heart:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="m241 87.1 15 20.7 15-20.7C296 52.5 336.2 32 378.9 32 452.4 32 512 91.6 512 165.1v2.6c0 112.2-139.9 242.5-212.9 298.2-12.4 9.4-27.6 14.1-43.1 14.1s-30.8-4.6-43.1-14.1C139.9 410.2 0 279.9 0 167.7v-2.6C0 91.6 59.6 32 133.1 32 175.8 32 216 52.5 241 87.1"/></svg>`,image:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M64 32C28.7 32 0 60.7 0 96v320c0 35.3 28.7 64 64 64h320c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64zm64 80a48 48 0 1 1 0 96 48 48 0 1 1 0-96m144 112c8.4 0 16.1 4.4 20.5 11.5l88 144c4.5 7.4 4.7 16.7.5 24.3S368.7 416 360 416H88c-8.9 0-17.2-5-21.3-12.9s-3.5-17.5 1.6-24.8l56-80c4.5-6.4 11.8-10.2 19.7-10.2s15.2 3.8 19.7 10.2l26.4 37.8 61.4-100.5c4.4-7.1 12.1-11.5 20.5-11.5z"/></svg>`,"image-regular":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M64 80c-8.8 0-16 7.2-16 16v320c0 8.8 7.2 16 16 16h320c8.8 0 16-7.2 16-16V96c0-8.8-7.2-16-16-16zM0 96c0-35.3 28.7-64 64-64h320c35.3 0 64 28.7 64 64v320c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64zm128 32a32 32 0 1 1 0 64 32 32 0 1 1 0-64m136 72c8.5 0 16.4 4.5 20.7 11.8l80 136c4.4 7.4 4.4 16.6.1 24.1S352.6 384 344 384H104c-8.9 0-17.2-5-21.3-12.9s-3.5-17.5 1.6-24.8l56-80c4.5-6.4 11.8-10.2 19.7-10.2s15.2 3.8 19.7 10.2l17.2 24.6 46.5-79c4.3-7.3 12.2-11.8 20.7-11.8z"/></svg>`,laugh:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M256 512a256 256 0 1 0 0-512 256 256 0 1 0 0 512M101.6 314c-3.7-13.7 7.5-26 21.7-26h265.4c14.2 0 25.4 12.3 21.7 26-18.5 68-80.6 118-154.4 118s-136-50-154.4-118M144 192a32 32 0 1 1 64 0 32 32 0 1 1-64 0m192-32a32 32 0 1 1 0 64 32 32 0 1 1 0-64"/></svg>`,"laugh-regular":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M464 256a208 208 0 1 0-416 0 208 208 0 1 0 416 0M0 256a256 256 0 1 1 512 0 256 256 0 1 1-512 0m118.3 58.2c-4.2-13.7 7.1-26.2 21.4-26.2h232.6c14.3 0 25.6 12.5 21.4 26.2C375.7 373.1 320.8 416 256 416s-119.7-42.9-137.7-101.8M144 192a32 32 0 1 1 64 0 32 32 0 1 1-64 0m192-32a32 32 0 1 1 0 64 32 32 0 1 1 0-64"/></svg>`,"location-arrow":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M477.9 75.5c4.5-11.8 1.7-25.2-7.2-34.1s-22.3-11.8-34.1-7.2l-416 160C7.9 199-.3 211.2 0 224.7s9.1 25.4 21.9 29.6l176.8 58.9L257.6 490c4.3 12.8 16.1 21.6 29.6 21.9s25.7-7.9 30.6-20.5l160-416z"/></svg>`,"magnifying-glass":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M416 208c0 45.9-14.9 88.3-40 122.7l126.6 126.7c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.1-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0s208 93.1 208 208M208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288"/></svg>`,"paper-plane":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path fill="currentColor" d="M536.4-26.3c9.8-3.5 20.6-1 28 6.3s9.8 18.2 6.3 28l-178 496.9c-5 13.9-18.1 23.1-32.8 23.1-14.2 0-27-8.6-32.3-21.7l-64.2-158c-4.5-11-2.5-23.6 5.2-32.6l94.5-112.4c5.1-6.1 4.7-15-.9-20.6s-14.6-6-20.6-.9l-112.4 94.3c-9.1 7.6-21.6 9.6-32.6 5.2L38.1 216.8c-13.1-5.3-21.7-18.1-21.7-32.3 0-14.7 9.2-27.8 23.1-32.8z"/></svg>`,reply:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M204.2 18.4c12 5 19.8 16.6 19.8 29.6v80h112c97.2 0 176 78.8 176 176 0 113.3-81.5 163.9-100.2 174.1-2.5 1.4-5.3 1.9-8.1 1.9-10.9 0-19.7-8.9-19.7-19.7 0-7.5 4.3-14.4 9.8-19.5 9.4-8.8 22.2-26.4 22.2-56.7 0-53-43-96-96-96h-96v80c0 12.9-7.8 24.6-19.8 29.6s-25.7 2.2-34.9-6.9l-160-160c-12.5-12.5-12.5-32.8 0-45.3l160-160c9.2-9.2 22.9-11.9 34.9-6.9z"/></svg>`,spinner:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M208 48a48 48 0 1 1 96 0 48 48 0 1 1-96 0m0 416a48 48 0 1 1 96 0 48 48 0 1 1-96 0M48 208a48 48 0 1 1 0 96 48 48 0 1 1 0-96m368 48a48 48 0 1 1 96 0 48 48 0 1 1-96 0M75 369.1a48 48 0 1 1 67.9 67.9A48 48 0 1 1 75 369.1M75 75a48 48 0 1 1 67.9 67.9A48 48 0 1 1 75 75m362 294.1a48 48 0 1 1-67.9 67.9 48 48 0 1 1 67.9-67.9"/></svg>`,sync:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M65.9 228.5C79.2 135.5 159.3 64 256 64c53 0 101 21.5 135.8 56.2l.6.6 7.6 7.2h-47.9c-17.7 0-32 14.3-32 32s14.3 32 32 32h128c17.7 0 32-14.3 32-32V32c0-17.7-14.3-32-32-32s-32 14.3-32 32v53.4l-11.3-10.7C390.5 28.6 326.5 0 256 0 127 0 20.3 95.4 2.6 219.5c-2.5 17.5 9.6 33.7 27.1 36.2s33.7-9.7 36.2-27.1zm443.5 64c2.5-17.5-9.7-33.7-27.1-36.2s-33.7 9.7-36.2 27.1c-13.3 93-93.4 164.5-190.1 164.5-53 0-101-21.5-135.8-56.2l-.6-.6-7.6-7.2h47.9c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 320c-8.5 0-16.7 3.4-22.7 9.5S-.1 343.7 0 352.3l1 127c.1 17.7 14.6 31.9 32.3 31.7s31.9-14.6 31.7-32.3l-.4-51.5 10.7 10.1C121.6 483.4 185.5 512 256 512c129 0 235.7-95.4 253.4-219.5"/></svg>`,"thumbs-down":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M384 32c26.5 0 48 21.5 48 48 0 6.3-1.3 12.2-3.4 17.7C449 103.2 464 121.8 464 144c0 9.1-2.6 17.6-7 24.9 22.2 4.2 39 23.7 39 47.1 0 19.7-11.9 36.6-28.9 44 17 7.4 28.9 24.3 28.9 44 0 26.5-21.5 48-48 48H288l28.2 70.4c2.5 6.3 3.8 13.1 3.8 19.9v4.2c0 27.3-22.1 49.4-49.4 49.4-18.7 0-35.8-10.6-44.2-27.3l-56.3-112.3c-6.7-13.3-10.1-28-10.1-42.9V126.8c0-19.4 8.9-37.8 24-50l12.2-9.7C224.6 44.4 259.8 32 296.1 32zM80 96c17.7 0 32 14.3 32 32v256c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32V128c0-17.7 14.3-32 32-32z"/></svg>`,"thumbs-down-regular":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="m360 32 7.4.4c35 3.6 62.5 32.2 64.4 67.7 17.8 11.8 30.1 31.4 32 53.9l.2 6c0 5.7-.7 11.2-2 16.5 10.2 11.5 16.8 26.3 17.8 42.7l.2 4.8c0 13.2-3.6 25.4-9.8 36 4.9 8.4 8.2 17.9 9.3 28l.4 8c0 37.3-28.3 67.9-64.6 71.6l-7.4.4H298.2l14.1 30 3.1 7.6c12.5 35.7-1.8 75.5-34.2 95l-7.2 3.9c-37.5 17.6-81.7 3.6-102.6-31.2l-.6-.9-2.7-5-.6-1.2-30.1-64c-9.4 17.8-28 29.9-49.5 29.9h-32c-30.9 0-56-25.1-56-56L0 152c0-30.9 25.1-56 56-56h32c12.4 0 23.9 4.1 33.2 11 13.2-21.4 32-39.4 55-51.6l12.2-6.5.7-.3 6.6-3.2.7-.3 7.1-3c16.7-6.6 34.5-9.9 52.6-9.9zM255.9 80c-12 0-23.9 2.3-35.1 6.6l-4.7 2-5.3 2.6-12.2 6.5c-29.2 15.5-48.3 44.9-50.7 77.6l-.2 8v112.9l.1 4.1c.5 8.2 2.5 16.2 6 23.7l56.8 120.9 2.1 3.8c8.4 13.7 26 19.1 40.8 12.2l2.9-1.6c13-7.8 18.7-23.7 13.7-38l-1.2-3-30.2-64.2c-3.5-7.4-2.9-16.1 1.5-23.1s12-11.1 20.2-11.1h147.5l2.4-.1c11.3-1.1 20.3-10.1 21.4-21.4l.1-2.5c0-7.1-3.1-13.5-8.2-18-5.2-4.6-8.2-11.1-8.2-18s3-13.4 8.2-18c4.4-3.9 7.4-9.3 8-15.3l.2-2.7c0-8.4-4.4-15.9-11.2-20.2-10.7-6.9-14.2-20.9-8-32 1.5-2.6 2.5-5.6 2.9-8.6l.2-3.2c0-10.6-6.9-19.6-16.6-22.8-11.7-3.8-18.7-15.9-16-28 .2-.9.3-1.8.4-2.6l.2-2.6c0-12.4-9.5-22.6-21.6-23.8L360 80zM56 144c-4.4 0-8 3.6-8 8v224c0 4.4 3.6 8 8 8h32c4.4 0 8-3.6 8-8V152c0-4.4-3.6-8-8-8z"/></svg>`,"thumbs-up":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M80 160c17.7 0 32 14.3 32 32v256c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32V192c0-17.7 14.3-32 32-32zM270.6 16c27.3 0 49.4 22.1 49.4 49.4v4.2c0 6.8-1.3 13.6-3.8 19.9L288 160h160c26.5 0 48 21.5 48 48 0 19.7-11.9 36.6-28.9 44 17 7.4 28.9 24.3 28.9 44 0 23.4-16.8 42.9-39 47.1 4.4 7.3 7 15.8 7 24.9 0 22.2-15 40.8-35.4 46.3 2.2 5.5 3.4 11.5 3.4 17.7 0 26.5-21.5 48-48 48h-87.9c-36.3 0-71.6-12.4-99.9-35.1l-12.2-9.7c-15.2-12.1-24-30.5-24-50V198.6c0-14.9 3.5-29.6 10.1-42.9l56.2-112.4c8.4-16.7 25.5-27.3 44.3-27.3"/></svg>`,"thumbs-up-regular":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M171.5 38.8C192.3 4 236.5-10 274 7.6l7.2 3.8C316 32.3 330 76.5 312.4 114l-14.1 30H408l7.4.4c36.3 3.7 64.6 34.4 64.6 71.6 0 13.2-3.6 25.4-9.8 36 6.1 10.6 9.7 22.8 9.8 36 0 18.3-6.9 34.8-18 47.5 1.3 5.3 2 10.8 2 16.5 0 25.1-12.9 47-32.2 59.9-1.9 35.5-29.4 64.2-64.4 67.7l-7.4.4H255.9c-18 0-35.9-3.4-52.6-9.9l-7.1-3-.7-.3-6.6-3.2-.7-.3-12.2-6.5c-12.3-6.5-23.3-14.7-32.9-24.1-4.1 26.9-27.3 47.4-55.3 47.4h-32c-30.9 0-56-25.1-56-56L0 200c0-30.9 25.1-56 56-56h32c10.8 0 20.9 3.1 29.5 8.5L167.6 46l.6-1.2 2.7-5 .6-.9zM56 192c-4.4 0-8 3.6-8 8v224c0 4.4 3.6 8 8 8h32c4.4 0 8-3.6 8-8V200c0-4.4-3.6-8-8-8zM253.6 51c-14.8-6.9-32.3-1.6-40.7 12l-2.2 4-56.8 120.9c-3.5 7.5-5.5 15.5-6 23.7l-.1 4.2v112.9l.2 7.9c2.4 32.7 21.4 62.1 50.7 77.7l11.5 6.1 6.3 3.1c12.4 5.6 25.8 8.5 39.4 8.5H360l2.4-.1c12.1-1.2 21.6-11.5 21.6-23.9l-.2-2.6c-.1-.9-.2-1.7-.4-2.6-2.7-12.1 4.3-24.2 16-28 9.7-3.1 16.6-12.2 16.6-22.8 0-4.3-1.1-8.2-3.1-11.8-6.3-11.1-2.8-25.2 8-32 6.8-4.3 11.2-11.8 11.2-20.2 0-7.1-3.1-13.5-8.2-18-5.2-4.6-8.2-11.1-8.2-18s3-13.4 8.2-18c5.1-4.5 8.2-10.9 8.2-18l-.1-2.4c-1.1-11.3-10.1-20.3-21.4-21.4l-2.4-.1H260.7c-8.2 0-15.8-4.2-20.2-11.1s-5-15.7-1.5-23.1l30-64.3c7-15 1.4-32.7-12.5-41z"/></svg>`,times:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="currentColor" d="M55.1 73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L147.2 256 9.9 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l137.3-137.4 137.4 137.3c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.8 256l137.3-137.4c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192.5 210.7z"/></svg>`,trash:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M136.7 5.9C141.1-7.2 153.3-16 167.1-16H281c13.8 0 26 8.8 30.4 21.9L320 32h96c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 96 0 81.7 0 64s14.3-32 32-32h96zM32 144h384v304c0 35.3-28.7 64-64 64H96c-35.3 0-64-28.7-64-64zm88 64c-13.3 0-24 10.7-24 24v192c0 13.3 10.7 24 24 24s24-10.7 24-24V232c0-13.3-10.7-24-24-24m104 0c-13.3 0-24 10.7-24 24v192c0 13.3 10.7 24 24 24s24-10.7 24-24V232c0-13.3-10.7-24-24-24m104 0c-13.3 0-24 10.7-24 24v192c0 13.3 10.7 24 24 24s24-10.7 24-24V232c0-13.3-10.7-24-24-24"/></svg>`,"trash-regular":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M166.2-16c-13.3 0-25.3 8.3-30 20.8L120 48H24C10.7 48 0 58.7 0 72s10.7 24 24 24h400c13.3 0 24-10.7 24-24s-10.7-24-24-24h-96L311.8 4.8c-4.7-12.5-16.6-20.8-30-20.8zM32 144v304c0 35.3 28.7 64 64 64h256c35.3 0 64-28.7 64-64V144h-48v304c0 8.8-7.2 16-16 16H96c-8.8 0-16-7.2-16-16V144zm160 72c0-13.3-10.7-24-24-24s-24 10.7-24 24v176c0 13.3 10.7 24 24 24s24-10.7 24-24zm112 0c0-13.3-10.7-24-24-24s-24 10.7-24 24v176c0 13.3 10.7 24 24 24s24-10.7 24-24z"/></svg>`,"user-circle":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M399 384.2c-22.1-38.4-63.6-64.2-111-64.2h-64c-47.4 0-88.9 25.8-111 64.2 35.2 39.2 86.2 63.8 143 63.8s107.8-24.7 143-63.8M0 256a256 256 0 1 1 512 0 256 256 0 1 1-512 0m256 16a72 72 0 1 0 0-144 72 72 0 1 0 0 144"/></svg>`,"window-maximize":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M64 64C28.7 64 0 92.7 0 128v256c0 35.3 28.7 64 64 64h384c35.3 0 64-28.7 64-64V128c0-35.3-28.7-64-64-64zm24 64h336c13.3 0 24 10.7 24 24s-10.7 24-24 24H88c-13.3 0-24-10.7-24-24s10.7-24 24-24"/></svg>`,"window-maximize-regular":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M48 224v160c0 8.8 7.2 16 16 16h384c8.8 0 16-7.2 16-16V224zM0 128c0-35.3 28.7-64 64-64h384c35.3 0 64 28.7 64 64v256c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64z"/></svg>`,android:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path fill="currentColor" d="M131.2 61.9c5.3-.5 10.6.6 15.3 3s8.6 6.2 11.3 10.8c17 29.5 34.2 58.9 51.2 88.4q5.25-2.1 10.5-3.9c31.3-10.9 64.2-16.6 97.4-16.9h3.2c38.1 0 76.2 7 111.6 21.1L483 75.7c1.8-3.2 4.3-6 7.2-8.2s6.2-3.9 9.8-4.8c3.1-.8 6.4-1.1 9.6-.8 4.2.4 8.3 1.7 11.9 3.8 4 2.4 7.3 5.7 9.7 9.7 2 3.4 3.3 7.2 3.8 11.2s.1 8-1.2 11.7c-.6 1.9-1.4 3.7-2.4 5.5l-49.7 85.8c19.5 12.2 37.6 26.5 53.9 42.8 12.3 12.2 23.5 25.4 33.5 39.5 8.2 11.5 15.6 23.6 22.2 36.2 17.5 33.6 28.6 70.5 32.7 108.1H16c4.1-37.7 15.2-74.5 32.7-108.1 14.5-27.9 33.4-53.5 55.7-75.7 16.5-16.4 34.7-30.9 54.5-43.1l-49.5-85.4c-3.7-6.4-4.7-14.1-2.8-21.2s6.4-13.1 12.7-16.8c3.6-2.2 7.7-3.5 11.9-3.8zm67.3 215.8c-12.2-8.1-30.1-2.5-40.1 12.5s-8.2 33.8 3.9 41.9 30.1 2.5 40.1-12.5 8.2-33.8-3.9-41.9m283.6 12.5c-10-15-27.9-20.6-40.1-12.5s-13.9 26.9-3.9 41.9 27.9 20.6 40.1 12.5 13.9-26.9 3.9-41.9"/></svg>`,apple:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="currentColor" d="M319.1 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7-55.8.9-115.1 44.5-115.1 133.2 0 26.2 4.8 53.3 14.4 81.2 12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9m-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3"/></svg>`,chrome:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M0 256c0-46.6 12.5-90.4 34.3-128.9l109.8 191.2C166 357.5 207.9 384 256 384c14.3 0 27.1-2.3 40.8-6.6l-76.3 132.2C95.9 492.3 0 385.3 0 256m365.1 65.6c12.3-19.2 18.9-42.5 18.9-65.6 0-38.2-16.8-72.5-43.3-96h152.7c12 29.6 18.6 62.1 18.6 96 0 141.4-114.6 255.1-256 256zM477.8 128H256c-62.9 0-113.7 44.1-125.5 102.7L54.2 98.5C101 38.5 174 0 256 0c94.8 0 177.5 51.5 221.8 128M344 256a88 88 0 1 1-176 0 88 88 0 1 1 176 0"/></svg>`,edge:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M120.1 37.4C161.1 12.2 207.7-.8 255 0c168 0 257 123.8 257 219.5-.1 32.7-13 63.9-35.9 87.2-22.9 23.2-54 36.5-86.7 37-75.2 0-91.5-23.1-91.5-32 0-3.8 1.2-6.2 4.8-9.4l1-1.2.4-1.6c10.5-11.5 15.9-26.2 15.9-41.6 0-78.7-82.2-142.7-184-142.7-37.5-.3-74.5 8.9-107.5 26.9 27-57.5 82.7-97.6 91.3-103.8.8-.6.3-.8.3-.8zm15.6 318.1c-1.4 30 4.6 60 16.4 87.2 13.6 26.4 32.7 51 56.5 69.3-59.5-11.5-111.5-43.9-149.4-89.3C21.1 376.3 0 318.4 0 257.9c0-51.2 62.4-94.4 136-94.4 36.6-.6 72.4 10.9 101.8 32.7l-3.6 1.2c-51.5 17.6-98.5 90.7-98.5 158.1M469.8 400l-.7.1c-11.8 18.8-25.9 35.1-42.2 49.5-30.8 28-68.1 45.5-108.8 49.9-18.6.3-36.8-3.2-53.8-11.4-25.6-10.3-47.1-30-61.6-53-14.4-23.9-21.1-51.7-19-79.6-.6-20.1 5.4-40.3 15-58.2 13.9 33.1 37.5 61.3 67.6 80.8s65.5 29.5 101.4 28.6c31 .3 62.1-6.7 90.2-20.5l1.9-.9c3.9-2.3 7.7-3.9 11.6 0 4.5 4.9 1.8 9.2-1.2 14-.2.2-.3.5-.4.7"/></svg>`,"firefox-browser":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M481.6 172.9c-10.6-25.5-32.1-53-48.9-61.7 13.7 26.9 21.7 53.9 24.7 74 0 .1 0 .3.1.4-27.6-68.8-74.4-96.5-112.6-156.8-15-23.7-10.9-25.2-13.1-24.7l-.1.1c-46.7 26-75.3 78.4-82.6 122.7-16.6.9-32.9 5-47.9 12.1-1.4.6-2.5 1.7-3.1 3s-.9 2.8-.6 4.3c.2.8.6 1.6 1.1 2.3s1.2 1.3 1.9 1.7 1.6.7 2.4.8 1.7 0 2.5-.3l.5-.2c15.5-7.3 32.4-11.2 49.5-11.3 62.8-.6 97.2 44 107.6 62.3-13-9.2-36.4-18.2-58.8-14.3 87.7 43.9 64.2 194.5-57.4 189.2-59.5-2.6-97.1-51-100.5-90.8 0 0 11.2-41.9 80.6-41.9 7.5 0 28.9-20.9 29.3-27-.1-2-42.5-18.9-59.1-35.2-8.8-8.7-13.1-12.9-16.8-16.1q-3-2.55-6.3-4.8c-5.6-19.5-5.8-40-.7-59.6-25.1 11.4-44.6 29.4-58.7 45.4h-.1c-9.7-12.2-9-52.6-8.4-61.1-.1-.5-7.2 3.7-8.2 4.3-8.6 6.1-16.5 12.9-23.8 20.4-16.3 16.6-44.1 50.2-55.5 101.2-4.5 20.4-6.8 44.4-6.8 52.3 0 134.7 109.2 243.9 243.9 243.9 120.6 0 223-87.2 240.4-202.6 11.6-76.7-14.7-131.1-14.7-132z"/></svg>`,"internet-explorer":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M483.1 159.7c10.9-24.6 21.4-60.4 21.4-87.9 0-72.7-79.6-98.4-209.7-38.6C187.2 26 83.6 106.9 57.7 219.7c30.9-34.9 78.3-82.3 122-101.2C125.4 166.8 79.1 227.9 44 291.7c-20.7 37.9-44 99.2-44 145 0 98.6 92.9 86.5 180.3 42 31.4 15.4 66.6 15.6 101.7 15.6 97.1 0 184.2-54.3 216.8-146H378c-52.5 88.6-196.8 53-196.8-47.4H510c6.4-43.6-1.7-95.7-26.9-141.2M64.6 346.9c17.7 51.1 53.7 95.8 100.2 123.3C76.1 519.1-8.4 499.3 64.6 346.9M180.5 238c2-55.2 50.3-94.9 104-94.9 53.4 0 102 39.7 104 94.9zM365.1 50.4c21.4-10.3 48.6-22 72.6-22 31.4 0 54.3 21.7 54.3 53.7 0 20-7.4 49-14.6 67.9-26.3-42.3-66-81.6-112.3-99.6"/></svg>`,linux:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M220.9 123.3c1 .5 1.8 1.7 3 1.7 1.1 0 2.8-.4 2.9-1.5.2-1.4-1.9-2.3-3.2-2.9-1.7-.7-3.9-1-5.5-.1-.4.2-.8.7-.6 1.1.3 1.3 2.3 1.1 3.4 1.7M199 125c1.2 0 2-1.2 3-1.7 1.1-.6 3.1-.4 3.5-1.6.2-.4-.2-.9-.6-1.1-1.6-.9-3.8-.6-5.5.1-1.3.6-3.4 1.5-3.2 2.9.1 1 1.8 1.5 2.8 1.4m221 278.8c-3.6-4-5.3-11.6-7.2-19.7-1.8-8.1-3.9-16.8-10.5-22.4-1.3-1.1-2.6-2.1-4-2.9-1.3-.8-2.7-1.5-4.1-2 9.2-27.3 5.6-54.5-3.7-79.1-11.4-30.1-31.3-56.4-46.5-74.4-17.1-21.5-33.7-41.9-33.4-72C311.1 85.4 315.7.1 234.8 0 132.4-.2 158 103.4 156.9 135.2c-1.7 23.4-6.4 41.8-22.5 64.7-18.9 22.5-45.5 58.8-58.1 96.7-6 17.9-8.8 36.1-6.2 53.3-6.5 5.8-11.4 14.7-16.6 20.2-4.2 4.3-10.3 5.9-17 8.3s-14 6-18.5 14.5c-2.1 3.9-2.8 8.1-2.8 12.4 0 3.9.6 7.9 1.2 11.8 1.2 8.1 2.5 15.7.8 20.8-5.2 14.4-5.9 24.4-2.2 31.7 3.8 7.3 11.4 10.5 20.1 12.3 17.3 3.6 40.8 2.7 59.3 12.5 19.8 10.4 39.9 14.1 55.9 10.4 11.6-2.6 21.1-9.6 25.9-20.2 12.5-.1 26.3-5.4 48.3-6.6 14.9-1.2 33.6 5.3 55.1 4.1.6 2.3 1.4 4.6 2.5 6.7v.1c8.3 16.7 23.8 24.3 40.3 23 16.6-1.3 34.1-11 48.3-27.9 13.6-16.4 36-23.2 50.9-32.2 7.4-4.5 13.4-10.1 13.9-18.3.4-8.2-4.4-17.3-15.5-29.7M223.8 87.3c9.8-22.2 34.2-21.8 44-.4 6.5 14.2 3.6 30.9-4.3 40.4-1.6-.8-5.9-2.6-12.6-4.9 1.1-1.2 3.1-2.7 3.9-4.6 4.8-11.8-.2-27-9.1-27.3-7.3-.5-13.9 10.8-11.8 23-4.1-2-9.4-3.5-13-4.4-1-6.9-.3-14.6 2.9-21.8m-40.7-11.5c10.1 0 20.8 14.2 19.1 33.5-3.5 1-7.1 2.5-10.2 4.6 1.2-8.9-3.3-20.1-9.6-19.6-8.4.7-9.8 21.2-1.8 28.1 1 .8 1.9-.2-5.9 5.5-15.6-14.6-10.5-52.1 8.4-52.1m-13.6 60.7c6.2-4.6 13.6-10 14.1-10.5 4.7-4.4 13.5-14.2 27.9-14.2 7.1 0 15.6 2.3 25.9 8.9 6.3 4.1 11.3 4.4 22.6 9.3 8.4 3.5 13.7 9.7 10.5 18.2-2.6 7.1-11 14.4-22.7 18.1-11.1 3.6-19.8 16-38.2 14.9-3.9-.2-7-1-9.6-2.1-8-3.5-12.2-10.4-20-15-8.6-4.8-13.2-10.4-14.7-15.3q-2.1-7.35 4.2-12.3m3.3 334c-2.7 35.1-43.9 34.4-75.3 18-29.9-15.8-68.6-6.5-76.5-21.9-2.4-4.7-2.4-12.7 2.6-26.4v-.2c2.4-7.6.6-16-.6-23.9-1.2-7.8-1.8-15 .9-20 3.5-6.7 8.5-9.1 14.8-11.3 10.3-3.7 11.8-3.4 19.6-9.9 5.5-5.7 9.5-12.9 14.3-18 5.1-5.5 10-8.1 17.7-6.9 8.1 1.2 15.1 6.8 21.9 16l19.6 35.6c9.5 19.9 43.1 48.4 41 68.9m-1.4-25.9c-4.1-6.6-9.6-13.6-14.4-19.6 7.1 0 14.2-2.2 16.7-8.9 2.3-6.2 0-14.9-7.4-24.9-13.5-18.2-38.3-32.5-38.3-32.5-13.5-8.4-21.1-18.7-24.6-29.9s-3-23.3-.3-35.2c5.2-22.9 18.6-45.2 27.2-59.2 2.3-1.7.8 3.2-8.7 20.8-8.5 16.1-24.4 53.3-2.6 82.4.6-20.7 5.5-41.8 13.8-61.5 12-27.4 37.3-74.9 39.3-112.7 1.1.8 4.6 3.2 6.2 4.1 4.6 2.7 8.1 6.7 12.6 10.3 12.4 10 28.5 9.2 42.4 1.2 6.2-3.5 11.2-7.5 15.9-9 9.9-3.1 17.8-8.6 22.3-15 7.7 30.4 25.7 74.3 37.2 95.7 6.1 11.4 18.3 35.5 23.6 64.6 3.3-.1 7 .4 10.9 1.4 13.8-35.7-11.7-74.2-23.3-84.9-4.7-4.6-4.9-6.6-2.6-6.5 12.6 11.2 29.2 33.7 35.2 59 2.8 11.6 3.3 23.7.4 35.7 16.4 6.8 35.9 17.9 30.7 34.8-2.2-.1-3.2 0-4.2 0 3.2-10.1-3.9-17.6-22.8-26.1-19.6-8.6-36-8.6-38.3 12.5-12.1 4.2-18.3 14.7-21.4 27.3-2.8 11.2-3.6 24.7-4.4 39.9-.5 7.7-3.6 18-6.8 29-32.1 22.9-76.7 32.9-114.3 7.2m257.4-11.5c-.9 16.8-41.2 19.9-63.2 46.5-13.2 15.7-29.4 24.4-43.6 25.5s-26.5-4.8-33.7-19.3c-4.7-11.1-2.4-23.1 1.1-36.3 3.7-14.2 9.2-28.8 9.9-40.6.8-15.2 1.7-28.5 4.2-38.7 2.6-10.3 6.6-17.2 13.7-21.1.3-.2.7-.3 1-.5.8 13.2 7.3 26.6 18.8 29.5 12.6 3.3 30.7-7.5 38.4-16.3 9-.3 15.7-.9 22.6 5.1 9.9 8.5 7.1 30.3 17.1 41.6 10.6 11.6 14 19.5 13.7 24.6M173.4 148.7c2 1.9 4.7 4.5 8 7.1 6.6 5.2 15.8 10.6 27.3 10.6 11.6 0 22.5-5.9 31.8-10.8 4.9-2.6 10.9-7 14.8-10.4s5.9-6.3 3.1-6.6-2.6 2.6-6 5.1c-4.4 3.2-9.7 7.4-13.9 9.8-7.4 4.2-19.5 10.2-29.9 10.2s-18.7-4.8-24.9-9.7c-3.1-2.5-5.7-5-7.7-6.9-1.5-1.4-1.9-4.6-4.3-4.9-1.4-.1-1.8 3.7 1.7 6.5"/></svg>`,markdown:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path fill="currentColor" d="M593.8 59.1H46.2C20.7 59.1 0 79.8 0 105.2v301.5c0 25.5 20.7 46.2 46.2 46.2h547.7c25.5 0 46.2-20.7 46.1-46.1V105.2c0-25.4-20.7-46.1-46.2-46.1M338.5 360.6H277v-120l-61.5 76.9-61.5-76.9v120H92.3V151.4h61.5l61.5 76.9 61.5-76.9h61.5v209.2zm135.3 3.1L381.5 256H443V151.4h61.5V256H566z"/></svg>`,safari:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="m274.7 274.7-37.4-37.4L166 346zM256 8a248 248 0 1 0 0 496 248 248 0 1 0 0-496m155.8 174.8 14.8-6.1c1-.4 2-.6 3.1-.6s2.1.2 3.1.6 1.8 1 2.6 1.7 1.3 1.6 1.7 2.6.6 2 .6 3.1-.2 2.1-.6 3.1-1 1.9-1.7 2.6-1.6 1.3-2.6 1.7l-14.8 6.1c-2 .8-4.2.8-6.1 0s-3.5-2.4-4.3-4.3-.8-4.2 0-6.1 2.4-3.5 4.3-4.3zM314.4 94l6.1-14.8c.8-2 2.4-3.5 4.3-4.3s4.2-.8 6.1 0 3.5 2.4 4.3 4.3.8 4.2 0 6.1l-6.1 14.8c-.8 2-2.4 3.5-4.3 4.3s-4.2.8-6.1 0c-1-.4-1.9-1-2.6-1.7s-1.3-1.6-1.7-2.6-.6-2-.6-3.1.2-2.1.6-3.1zM256 60c2.1 0 4.2.8 5.7 2.3s2.3 3.6 2.3 5.7v16c0 2.1-.8 4.2-2.3 5.7S258.2 92 256 92s-4.2-.8-5.7-2.3-2.3-3.5-2.3-5.7V68c0-2.1.8-4.2 2.3-5.7s3.6-2.3 5.7-2.3m-75 14.9c1-.4 2-.6 3.1-.6s2.1.2 3.1.6 1.9 1 2.6 1.7 1.3 1.6 1.7 2.6l6.1 14.8c.4 1 .7 2 .7 3.1s-.2 2.1-.6 3.1-1 1.9-1.7 2.6-1.6 1.4-2.6 1.8-2 .6-3.1.6-2.1-.2-3.1-.6-1.9-1-2.6-1.8-1.3-1.7-1.7-2.7l-6.1-14.8c-.8-2-.8-4.2 0-6.1s2.4-3.5 4.3-4.3zm-63.6 42.5c1.5-1.5 3.5-2.3 5.7-2.3s4.2.8 5.7 2.3l11.2 11.3c1.5 1.5 2.3 3.5 2.3 5.6s-.8 4.1-2.3 5.6-3.5 2.3-5.7 2.3-4.2-.8-5.7-2.3l-11.3-11.3c-1.5-1.5-2.3-3.5-2.3-5.6s.8-4.1 2.3-5.6zM60 256c0-2.1.8-4.2 2.3-5.7s3.6-2.3 5.7-2.3h16c2.1 0 4.2.8 5.7 2.3s2.3 3.5 2.3 5.7-.8 4.2-2.3 5.7-3.5 2.3-5.7 2.3H68c-2.1 0-4.2-.8-5.7-2.3S60 258.1 60 256m40.2 73.2-14.8 6.1c-1 .4-2 .6-3.1.6s-2.1-.2-3.1-.6-1.9-1-2.6-1.7-1.3-1.6-1.7-2.6-.6-2-.6-3.1.2-2.1.6-3.1 1-1.9 1.7-2.6 1.6-1.3 2.6-1.7l14.8-6.1c2-.8 4.2-.8 6.1 0s3.5 2.4 4.3 4.3.8 4.2 0 6.1-2.4 3.5-4.3 4.3zm4.3-136c-.4 1-1 1.9-1.7 2.6s-1.6 1.3-2.6 1.7-2 .6-3.1.6-2.1-.2-3.1-.6l-14.8-6.1c-2-.8-3.5-2.4-4.3-4.3s-.8-4.2 0-6.1 2.4-3.5 4.3-4.3 4.2-.8 6.1 0l14.8 6.1c2 .8 3.5 2.4 4.3 4.3s.8 4.2 0 6.1zM197.6 418l-6.1 14.8c-.4 1-1 1.9-1.7 2.6s-1.6 1.3-2.6 1.7-2 .6-3.1.6-2.1-.2-3.1-.6-1.9-1-2.6-1.7-1.3-1.6-1.7-2.6-.6-2-.6-3.1.2-2.1.6-3.1l6.1-14.8c.4-1 1-1.9 1.7-2.7s1.6-1.4 2.6-1.8 2-.6 3.1-.6 2.1.2 3.1.6 1.9 1 2.6 1.8 1.3 1.7 1.7 2.6.6 2 .6 3.1-.2 2.1-.7 3.1zm66.4 26c0 2.1-.8 4.2-2.3 5.7s-3.5 2.3-5.7 2.3-4.2-.8-5.7-2.3-2.3-3.5-2.3-5.7v-16c0-2.1.8-4.2 2.3-5.7s3.5-2.3 5.7-2.3 4.2.8 5.7 2.3 2.3 3.5 2.3 5.7zm67-6.9c-1 .4-2 .6-3.1.6s-2.1-.2-3.1-.6-1.9-1-2.6-1.7-1.3-1.6-1.7-2.6l-6.1-14.8c-.8-2-.8-4.2 0-6.1s2.4-3.5 4.3-4.3 4.2-.8 6.1 0 3.5 2.4 4.3 4.3l6.1 14.8c.8 2 .8 4.2 0 6.1s-2.4 3.5-4.3 4.3zm63.6-42.5c-1.5 1.5-3.5 2.3-5.7 2.3s-4.2-.8-5.7-2.3L372 383.3c-1.5-1.5-2.3-3.5-2.3-5.6s.8-4.1 2.3-5.6 3.5-2.3 5.7-2.3 4.2.8 5.7 2.3l11.3 11.3c1.5 1.5 2.3 3.5 2.3 5.6s-.8 4.1-2.3 5.6zM286.2 286.2 110.3 401.7l115.5-175.9 175.9-115.5zM437.1 331c-.8 2-2.4 3.5-4.3 4.3s-4.2.8-6.1 0l-14.8-6.1c-2-.8-3.5-2.4-4.3-4.3s-.8-4.2 0-6.1c.4-1 1-1.9 1.7-2.6s1.6-1.3 2.6-1.7 2-.6 3.1-.6 2.1.2 3.1.6l14.8 6.1c2 .8 3.5 2.4 4.3 4.3s.8 4.2 0 6.1zm6.9-67h-16c-2.1 0-4.2-.8-5.7-2.3s-2.3-3.5-2.3-5.7.8-4.2 2.3-5.7 3.5-2.3 5.7-2.3h16c2.1 0 4.2.8 5.7 2.3s2.3 3.5 2.3 5.7-.8 4.2-2.3 5.7-3.5 2.3-5.7 2.3"/></svg>`,ubuntu:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path fill="currentColor" d="M469.2 75c0-20.1-8-39.3-22.2-53.5S413.6-.7 393.5-.7s-39.3 8-53.5 22.2-22.2 33.4-22.2 53.5 8 39.3 22.1 53.5 33.4 22.1 53.5 22.1 39.3-8 53.5-22.1S469 95.1 469 75h.1zm-315 165.7a75.6 75.6 0 1 0-151.2 0 75.6 75.6 0 1 0 151.2 0M57 346c18.6 46.9 51 87 93 115.1s91.5 42.6 142 41.7c-14.7-18.6-22.9-41.5-23.2-65.2-6.8-.9-13.3-2.1-19.5-3.4-26.8-5.7-51.9-17.3-73.6-34s-39.3-38.1-51.7-62.5c-20.9 9.9-44.5 12.8-67.1 8.2zm395.1 89.8a75.6 75.6 0 1 0-151.2 0 75.6 75.6 0 1 0 151.2 0m-8.1-84.2c18.5 14.8 31.6 35.2 37.2 58.2 33.3-41.3 52.6-92.2 54.8-145.2s-12.5-105.4-42.2-149.4c-8.6 21.5-24 39.6-43.8 51.6 15.4 28.6 22.9 60.8 21.9 93.2s-10.7 64-28 91.6zM101.1 135.4c12.4 2.7 24.3 7.5 35.1 14.3 16.6-24.2 38.9-44.1 64.8-58s54.8-21.3 84.2-21.7c.2-5.9.9-11.9 2-17.7C290.8 35.6 298.3 20 309 6.8c-47.7-3.8-95.4 6-137.6 28.5S94.3 91.7 70.8 133.4c2.7-.2 5.3-.3 8-.3 7.5 0 15 .8 22.4 2.3z"/></svg>`,windows:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="m0 93.7 183.6-25.3v177.4H0zm0 324.6 183.6 25.3V268.4H0zm203.8 28L448 480V268.4H203.8zm0-380.6v180.1H448V32z"/></svg>`},Xv=[`innerHTML`],Zv=rh({__name:`TkIcon`,props:{name:{}},setup(e){let t=e,n=U_(()=>Yv[t.name]||(console.warn(`[twikoo] 未注册的图标: ${t.name}(请在 components/icons.ts 登记)`),``));return(e,t)=>(Y(),X(Xg,null,[$(` SVG 内容来自 fontawesome-free 官方文件(构建期内联,非运行时注入用户数据) `),$(` eslint-disable-next-line vue/no-v-html `),Z(`i`,{class:`tk-icon`,innerHTML:n.value},null,8,Xv)],2112))}}),Qv={class:`tk-action`},$v={class:`tk-action-icon`},ey={class:`tk-action-icon tk-action-icon-solid`},ty={class:`tk-action-icon`},ny={class:`tk-action-icon tk-action-icon-solid`},ry={class:`tk-action-count`},iy={class:`tk-action-icon`},ay={class:`tk-action-icon tk-action-icon-solid`},oy={class:`tk-action-count`},sy={class:`tk-action-icon`},cy={class:`tk-action-icon tk-action-icon-solid`},ly={class:`tk-action-count`},uy=rh({__name:`TkAction`,props:{liked:{type:Boolean,default:!1},disliked:{type:Boolean,default:!1},likeCount:{default:0},dislikeCount:{default:0},repliesCount:{default:0},showDislike:{type:Boolean,default:!0},showDelete:{type:Boolean,default:!1}},emits:[`like`,`dislike`,`reply`,`delete`],setup(e,{emit:t}){let n=e,r=t,i=U_(()=>n.likeCount>0?`${n.likeCount}`:``),a=U_(()=>n.dislikeCount>0?`${n.dislikeCount}`:``),o=U_(()=>n.repliesCount>0?`${n.repliesCount}`:``);return(t,n)=>(Y(),X(`div`,Qv,[e.showDelete?(Y(),X(`button`,{key:0,class:`tk-action-link`,onClick:n[0]||=e=>r(`delete`)},[Z(`span`,$v,[Q(Zv,{name:`trash-regular`})]),Z(`span`,ey,[Q(Zv,{name:`trash`})]),n[4]||=Z(`span`,{class:`tk-action-count`},null,-1)])):$(`v-if`,!0),Z(`button`,{class:xf([`tk-action-link`,{"tk-liked":e.liked}]),onClick:n[1]||=e=>r(`like`)},[Z(`span`,ty,[Q(Zv,{name:`thumbs-up-regular`})]),Z(`span`,ny,[Q(Zv,{name:`thumbs-up`})]),Z(`span`,ry,K(i.value),1)],2),e.showDislike?(Y(),X(`button`,{key:1,class:xf([`tk-action-link`,{"tk-disliked":e.disliked}]),onClick:n[2]||=e=>r(`dislike`)},[Z(`span`,iy,[Q(Zv,{name:`thumbs-down-regular`})]),Z(`span`,ay,[Q(Zv,{name:`thumbs-down`})]),Z(`span`,oy,K(a.value),1)],2)):$(`v-if`,!0),Z(`button`,{class:`tk-action-link`,onClick:n[3]||=e=>r(`reply`)},[Z(`span`,sy,[Q(Zv,{name:`comment-regular`})]),Z(`span`,cy,[Q(Zv,{name:`comment`})]),Z(`span`,ly,K(o.value),1)])]))}}),dy={},fy={key:0,class:`tk-avatar-img`},py=[`src`],my=rh({__name:`TkAvatar`,props:{nick:{default:``},avatar:{default:``},mail:{default:``},mailMd5:{default:``},link:{default:``},config:{default:dy}},setup(e){let t=e,n=U_(()=>Kc({avatar:t.avatar,mailMd5:t.mailMd5,mail:t.mail,nick:t.nick},t.config));function r(){t.link&&window.open(ld(t.link),`_blank`)?.focus()}return(t,i)=>(Y(),X(`div`,{class:xf([`tk-avatar`,{"tk-clickable":!!e.link,"tk-has-avatar":!!n.value}]),onClick:r},[n.value?(Y(),X(`img`,{key:1,class:`tk-avatar-img`,src:n.value,alt:``},null,8,py)):(Y(),X(`div`,fy,[Q(Zv,{name:`user-circle`})]))],2))}}),hy={key:0,class:`tk-input-group__prepend`},gy=[`name`,`value`,`placeholder`,`rows`,`disabled`,`readonly`,`maxlength`],_y=[`type`,`name`,`value`,`placeholder`,`disabled`,`readonly`,`maxlength`,`min`,`max`],vy={key:3,class:`tk-input__suffix`},yy={key:4,class:`tk-input__count`},by={key:5,class:`tk-input-group__append`},xy=rh({__name:`TkInput`,props:{modelValue:{default:``},type:{default:`text`},placeholder:{default:``},rows:{default:2},autosize:{type:[Boolean,Object],default:!1},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},maxlength:{default:void 0},showWordLimit:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},size:{default:``},name:{default:``},min:{default:void 0},max:{default:void 0}},emits:[`update:modelValue`,`input`,`change`,`blur`,`focus`,`clear`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=zh(),o=q(),s=U_(()=>!!a.prepend),c=U_(()=>!!a.append),l=U_(()=>r.clearable&&!r.disabled&&!r.readonly&&u.value),u=U_(()=>r.modelValue!==``&&r.modelValue!==void 0&&r.modelValue!==null),d=U_(()=>String(r.modelValue??``).length);function f(e){let t=e.target.value;i(`update:modelValue`,t),i(`input`,t,e)}function p(e){i(`change`,e.target.value)}function m(e){i(`blur`,e)}function h(e){i(`focus`,e)}function g(){i(`update:modelValue`,``),i(`clear`),o.value?.focus()}function _(){o.value?.focus()}function v(){o.value?.blur()}function y(){let e=o.value;if(r.type!==`textarea`||!r.autosize||!(e instanceof HTMLTextAreaElement))return;let t=typeof r.autosize==`object`?r.autosize.minRows??r.rows:r.rows,n=getComputedStyle(e),i=parseFloat(n.lineHeight)||20,a=parseFloat(n.paddingTop)+parseFloat(n.paddingBottom),s=parseFloat(n.borderTopWidth)+parseFloat(n.borderBottomWidth),c=t*i+a+s;e.style.overflow=`hidden`,e.style.height=`auto`,e.style.height=`${Math.max(e.scrollHeight,c)}px`}return qm(()=>r.modelValue,()=>{Om(y)}),vh(()=>{Om(y)}),t({focus:_,blur:v,inputEl:o}),(t,n)=>(Y(),X(`div`,{class:xf([`tk-input`,[e.size?`tk-input--${e.size}`:``,e.type===`textarea`?`tk-textarea`:``,{"is-disabled":e.disabled,"tk-input--group":s.value||c.value}]])},[s.value?(Y(),X(`div`,hy,[Nh(t.$slots,`prepend`)])):$(`v-if`,!0),e.type===`textarea`?(Y(),X(`textarea`,{key:1,ref_key:`inputRef`,ref:o,class:`tk-input__inner tk-textarea__inner`,name:e.name,value:e.modelValue,placeholder:e.placeholder,rows:e.rows,disabled:e.disabled,readonly:e.readonly,maxlength:e.maxlength,onInput:f,onChange:p,onBlur:m,onFocus:h},null,40,gy)):(Y(),X(`input`,{key:2,ref_key:`inputRef`,ref:o,class:`tk-input__inner`,type:e.type,name:e.name,value:e.modelValue,placeholder:e.placeholder,disabled:e.disabled,readonly:e.readonly,maxlength:e.maxlength,min:e.min,max:e.max,onInput:f,onChange:p,onBlur:m,onFocus:h},null,40,_y)),l.value?(Y(),X(`span`,vy,[e.clearable&&!e.disabled&&!e.readonly&&u.value?(Y(),X(`i`,{key:0,class:`tk-input__icon tk-input__clear`,onClick:g},[Q(Zv,{name:`circle-xmark`})])):$(`v-if`,!0)])):$(`v-if`,!0),e.showWordLimit&&e.maxlength?(Y(),X(`span`,yy,K(d.value)+`/`+K(e.maxlength),1)):$(`v-if`,!0),c.value?(Y(),X(`div`,by,[Nh(t.$slots,`append`)])):$(`v-if`,!0)],2))}}),Sy=new Map,Cy=`configUpdated`,wy=`initMeta`,Ty=`showAdminEntry`;function Ey(e,t){let n=Sy.get(e)??new Set;n.add(t),Sy.set(e,n)}function Dy(e,t){Sy.get(e)?.delete(t)}function Oy(e,...t){for(let n of Sy.get(e)??[])n(...t)}var ky={class:`tk-meta-input`},Ay=rh({__name:`TkMetaInput`,props:{nick:{default:``},mail:{default:``},link:{default:``},config:{default:dy}},emits:[`update`],setup(e,{emit:t}){let n=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,r=e,i=t,a=[{key:`nick`,locale:W(`META_INPUT_NICK`),name:`nick`,type:`text`},{key:`mail`,locale:W(`META_INPUT_MAIL`),name:`mail`,type:`email`},{key:`link`,locale:W(`META_INPUT_LINK`),name:`link`,type:`text`}],o=Kp({nick:``,mail:``,link:``}),s=U_(()=>r.config??{}),c=U_(()=>{let e=s.value.DISPLAYED_FIELDS,t=typeof e==`string`?e:void 0;return{nick:!t||t.indexOf(`nick`)!==-1,mail:!t||t.indexOf(`mail`)!==-1,link:!t||t.indexOf(`link`)!==-1}}),l=U_(()=>a.filter(e=>!!c.value[e.key])),u=U_(()=>{let e=s.value.REQUIRED_FIELDS,t=typeof e==`string`?e:void 0;return{nick:!t||t.indexOf(`nick`)!==-1,mail:!t||t.indexOf(`mail`)!==-1,link:t?t.indexOf(`link`)!==-1:!1}});function d(){let e=n.test(o.mail);return(!!o.nick||!u.value.nick)&&(e||!u.value.mail)&&(!!o.link||!u.value.link)}function f(){localStorage.setItem(`twikoo`,JSON.stringify(o)),i(`update`,{meta:{...o},valid:d()})}function p(e,t){let n=t.target.name;n&&(o[n]=e,localStorage.setItem(`twikoo`,JSON.stringify(o)))}function m(){let e=localStorage.getItem(`twikoo`),t={};if(e)try{t=JSON.parse(e)}catch{t={}}o.nick=t.nick??r.nick??``,o.mail=t.mail??r.mail??``,o.link=t.link??r.link??``,f()}function h(){if(!cd(o.nick))return;let e=o.nick.replace(/@qq\.com/gi,``);o.mail=`${e}@qq.com`,_(e)}function g(){cd(o.nick)&&(o.nick=``,f())}async function _(e){try{let t=await Co(null,`GET_QQ_NICK`,{qq:e}),n=t.result??t;n.nick?(o.nick=n.nick,f()):g()}catch(e){console.warn(`获取 QQ 昵称失败:`,e),g()}}function v(){let e=s.value.HIDE_ADMIN_CRYPT;Oy(Ty,!e||e===o.nick)}function y(){h(),f(),v()}function b(){r.nick!==void 0&&o.nick!==r.nick&&(o.nick=r.nick),r.mail!==void 0&&o.mail!==r.mail&&(o.mail=r.mail),r.link!==void 0&&o.link!==r.link&&(o.link=r.link)}return qm(()=>[r.nick,r.mail,r.link],b),qm(u,()=>{i(`update`,{meta:{...o},valid:d()})}),qm(()=>s.value.VERSION,()=>{v()}),vh(()=>{Ey(wy,m),m()}),Sh(()=>{Dy(wy,m)}),(e,t)=>(Y(),X(`div`,ky,[(Y(!0),X(Xg,null,Mh(l.value,e=>(Y(),o_(xy,{key:e.key,class:`tk-meta-input__item`,name:e.name,type:e.type,"model-value":o[e.key],placeholder:u.value[e.key]?J(W)(`META_INPUT_REQUIRED`):J(W)(`META_INPUT_NOT_REQUIRED`),size:`small`,onInput:p,onChange:y},{prepend:Bm(()=>[m_(K(e.locale),1)]),_:2},1032,[`name`,`type`,`model-value`,`placeholder`]))),128))]))}}),jy=[`disabled`,`type`],My={class:`tk-button__label`},Ny=rh({__name:`TkButton`,props:{type:{default:`default`},size:{default:``},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},nativeType:{default:`button`}},emits:[`click`],setup(e,{emit:t}){let n=e,r=t;function i(e){n.disabled||n.loading||r(`click`,e)}return(t,n)=>(Y(),X(`button`,{class:xf([`tk-button`,[e.type==="default"?``:`tk-button--${e.type}`,e.size?`tk-button--${e.size}`:``,{"is-disabled":e.disabled,"is-loading":e.loading}]]),disabled:e.disabled||e.loading,type:e.nativeType,onClick:i},[e.loading?(Y(),o_(Zv,{key:0,name:`spinner`,class:`tk-button__spinner`})):$(`v-if`,!0),Z(`span`,My,[Nh(t.$slots,`default`)])],10,jy))}}),Py={logo:`OwO表情`,position:`down`,maxHeight:`250px`,odata:{}},Fy=class{container;target;odata;packagesEle;logo;area;packages;constructor(e){for(let[t,n]of Object.entries(Py))n&&!e[t]&&(e[t]=n);this.container=e.container,this.target=e.target,e.position===`up`&&this.container.classList.add(`OwO-up`),this.odata=e.odata,setTimeout(()=>{this.init(e)})}init(e){this.area=e.target,this.packages=Object.keys(this.odata);let t=`<div class="OwO-logo">${e.logo??``}</div><div class="OwO-body">`;for(let n of this.packages){let r=parseInt(e.maxHeight??`250`,10)-53;t+=`<ul class="OwO-items OwO-items-${this.odata[n]?.type??``}" style="max-height: ${r}px;">`;for(let e of this.odata[n]?.container??[])t+=`<li class="OwO-item" title="${e.text??``}">${e.icon.replace(`<img`,`<img loading="lazy"`)}</li>`;t+=`</ul>`}t+=`<div class="OwO-bar"><ul class="OwO-packages">`+this.packages.map(e=>`<li><span>${e}</span></li>`).join(``)+`</ul></div></div>`,this.container.innerHTML=t,this.logo=this.container.getElementsByClassName(`OwO-logo`)[0],this.logo.addEventListener(`click`,()=>{this.toggle()}),this.container.getElementsByClassName(`OwO-body`)[0]?.addEventListener(`click`,e=>this.onItemClick(e)),this.packagesEle=this.container.getElementsByClassName(`OwO-packages`)[0];for(let e=0;e<this.packagesEle.children.length;e++)this.packagesEle.children[e].addEventListener(`click`,()=>{this.tab(e)});this.tab(0)}onItemClick(e){let t=e.target;if(!t)return;let n=null;if(t.classList.contains(`OwO-item`)?n=t:t.parentNode instanceof HTMLElement&&t.parentNode.classList.contains(`OwO-item`)&&(n=t.parentNode),!n)return;let r=this.area.selectionEnd??this.area.value.length,i=this.area.value,a=n.innerHTML;if(a.indexOf(`<img`)!==-1){if(n.title)a=`:${n.title}: `;else{let e=a.indexOf(`src="`)+5,t=a.indexOf(`"`,e);e!==-1&&t!==-1&&(a=`})`)}}this.area.value=i.slice(0,r)+a+i.slice(r),this.area.dispatchEvent(new Event(`input`,{bubbles:!0})),this.area.focus(),this.toggle()}toggle(){this.container.classList.toggle(`OwO-open`)}tab(e){let t=this.container.getElementsByClassName(`OwO-items-show`)[0];t&&t.classList.remove(`OwO-items-show`),this.container.getElementsByClassName(`OwO-items`)[e]?.classList.add(`OwO-items-show`);let n=this.container.getElementsByClassName(`OwO-package-active`)[0];n&&n.classList.remove(`OwO-package-active`),this.packagesEle.getElementsByTagName(`li`)[e]?.classList.add(`OwO-package-active`)}},Iy={class:`tk-row`},Ly={class:`tk-col`},Ry={class:`tk-row actions`},zy={class:`tk-row-actions-start`},By=[`innerHTML`],Vy={class:`tk-submit-action-icon __markdown`,alt:`Markdown is supported`,href:`https://guides.github.com/features/mastering-markdown/`,target:`_blank`,rel:`noopener noreferrer`},Hy={key:0,ref:`commentPreviewRef`,class:`tk-preview-container`},Uy=[`innerHTML`],Wy=rh({__name:`TkSubmit`,props:{replyId:{default:``},pid:{default:``},config:{default:dy}},emits:[`load`,`cancel`,`error`],setup(e,{emit:t}){let n=[`apng`,`bmp`,`gif`,`jpeg`,`jpg`,`png`,`svg`,`tif`,`tiff`,`webp`],r=Yv[`laugh-regular`],i=e,a=t,o=q(!1),s=q(!1),c=q(!1),l=q();qm(l,e=>{e&&a(`error`,e)});let u=q(null),d=q(``),f=q(``),p=q(``),m=q(``),h=q(``),g=q(null),_=q(null),v=q(null),y=q(),b=q(),x=q(),S=q(),C=q(),w=q(),T=q(),E=q(),D=q(),ee=U_(()=>{let e=i.config;return e.CAPTCHA_PROVIDER===void 0?e.TURNSTILE_SITE_KEY?`Turnstile`:e.GEETEST_CAPTCHA_ID?`Geetest`:e.CAP_API_ENDPOINT||e.CAP_BUILTIN?`Cap`:``:e.CAPTCHA_PROVIDER}),te=U_(()=>!!i.config.IMAGE_CDN),O=U_(()=>!o.value&&c.value&&!!d.value.trim()),k=U_(()=>{let e=bo().options.placeholder??i.config.COMMENT_PLACEHOLDER;return(typeof e==`string`?e:``).replace(/<br>/g,`
|
|
241
|
-
`)}),A=U_(()=>{let e=parseInt(String(i.config.LIMIT_LENGTH),10);return Number.isNaN(e)&&(e=500),e>0?e:void 0}),ne=U_(()=>{let e=b.value?.inputEl;return e instanceof HTMLTextAreaElement?e:null});function re(){localStorage.setItem(`twikoo-draft`,d.value)}function ie(){let e=localStorage.getItem(`twikoo-draft`);!d.value&&e&&(d.value=e)}async function ae(){if(i.config.SHOW_EMOTION!==`true`)return;let e=await Ju(String(i.config.EMOTION_CDN||`https://owo.imaegoo.com/owo.json`));Yu(e),x.value&&ne.value&&(u.value=new Fy({logo:r,container:x.value,target:ne.value,odata:e,position:`down`,maxHeight:`250px`}))}function oe(){u.value?.container.classList.contains(`OwO-open`)&&u.value.toggle()}function se(e){return new Promise((t,n)=>{let r=document.createElement(`script`);r.src=e,r.onload=()=>t(),r.onerror=()=>n(Error(`脚本加载失败:${e}`)),document.head.appendChild(r)})}function ce(e,t){return{ok:e,json:()=>Promise.resolve(t)}}function le(){if(ee.value===`Turnstile`&&i.config.TURNSTILE_SITE_KEY){if(window.turnstile){g.value=Promise.resolve();return}g.value||=se(`https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit`)}}function ue(){return new Promise((e,t)=>{g.value?.then(()=>{let n=window.turnstile,r=n.render(w.value,{sitekey:i.config.TURNSTILE_SITE_KEY,callback:t=>{e(t),setTimeout(()=>n.remove(r),1e3)},"error-callback":()=>t(Error(`验证码校验失败,请重试`)),"expired-callback":()=>t(Error(`验证码已过期,请重试`)),"timeout-callback":()=>t(Error(`验证码超时,请重试`))})})})}function de(){if(ee.value===`Geetest`&&i.config.GEETEST_CAPTCHA_ID){if(window.initGeetest4){_.value=Promise.resolve();return}_.value||=se(`https://static.geetest.com/v4/gt4.js`)}}function fe(){return new Promise((e,t)=>{_.value?.then(()=>{let n=window.initGeetest4;n({captchaId:i.config.GEETEST_CAPTCHA_ID,product:`bind`,language:`zho`},n=>{n.onReady(()=>n.showCaptcha()).onSuccess(()=>{let t=n.getValidate();e({geeTestLotNumber:t.lot_number,geeTestCaptchaOutput:t.captcha_output,geeTestPassToken:t.pass_token,geeTestGenTime:t.gen_time})}).onError(e=>t(e instanceof Error?e:Error(`Geetest 验证失败,请重试`))).onClose(()=>t(Error(`验证已取消`)))})})})}function pe(){if(ee.value!==`Cap`||!i.config.CAP_API_ENDPOINT&&!i.config.CAP_BUILTIN)return;let e=window;if(i.config.CAP_BUILTIN&&(e.CAP_CUSTOM_FETCH=async(e,t={})=>{let n=String(e),r=t.body?JSON.parse(t.body):{};try{if(n.includes(`challenge`)){let e=await Co(bo().tcb,`CAP_CHALLENGE`),t=e.result??e;return t.code&&t.code!==0?ce(!1,{error:t.message??`challenge_failed`}):ce(!0,{challenge:t.challenge,token:t.token,expires:t.expires})}if(n.includes(`redeem`)){let e=await Co(bo().tcb,`CAP_REDEEM`,r),t=e.result??e;return t.code&&t.code!==0&&t.success!==!0?ce(!0,{success:!1,error:t.message??t.error??`redeem_failed`}):ce(!0,{success:t.success,token:t.token,expires:t.expires,message:t.message,error:t.error??t.message})}return ce(!1,{error:`unknown_cap_path`})}catch(e){return ce(!1,{error:e instanceof Error?e.message:`cap_fetch_failed`})}}),e.Cap||customElements.get(`cap-widget`)){v.value=Promise.resolve();return}v.value||=se(`https://cdn.jsdmirror.com/npm/@cap.js/widget`)}function me(){return new Promise((e,t)=>{v.value?.then(()=>{let n=document.createElement(`cap-widget`);n.setAttribute(`id`,`cap-widget`);let r=i.config.CAP_BUILTIN?`/`:String(i.config.CAP_API_ENDPOINT);n.setAttribute(`data-cap-api-endpoint`,r),D.value?.appendChild(n);let a=()=>{n.parentNode?.removeChild(n)};n.solve().then(n=>{a(),n.success?e(typeof n.token==`string`?n.token:``):t(Error(`Cap 验证失败`))}).catch(e=>{a(),t(e instanceof Error?e:Error(`Cap 验证失败`))})}).catch(t)})}function he(e){p.value=e.meta.nick,m.value=e.meta.mail,h.value=e.meta.link,c.value=e.valid}function ge(){a(`cancel`)}function _e(){re(),j()}function ve(){s.value=!s.value,j()}function j(){s.value&&(f.value=uc(Hu(d.value)),Om(()=>{let e=C.value;e&&(Td(e),Ed(e,bo().options.katex),i.config.HIGHLIGHT===`true`&&Tc(e,i.config.HIGHLIGHT_THEME,i.config.HIGHLIGHT_PLUGIN))}))}async function ye(){o.value=!0,l.value=void 0;try{if(d.value.match(RegExp(`!\\[${W(`IMAGE_UPLOAD_PLACEHOLDER`)}.+\\]\\(\\)`)))throw Error(W(`IMAGE_UPLOAD_PLEASE_WAIT`));let e={nick:p.value,mail:m.value,link:h.value,ua:await wd(),url:md(bo().options.path),href:hd(bo().options.href),comment:Hu(d.value),pid:i.pid?i.pid:i.replyId,rid:i.replyId};ee.value===`Turnstile`&&i.config.TURNSTILE_SITE_KEY&&(e.turnstileToken=await ue()),ee.value===`Geetest`&&i.config.GEETEST_CAPTCHA_ID&&Object.assign(e,await fe()),ee.value===`Cap`&&(i.config.CAP_API_ENDPOINT||i.config.CAP_BUILTIN)&&(e.capToken=await me());let t=await Co(bo().tcb,`COMMENT_SUBMIT`,e),n=t.result??t;if(n.id)d.value=``,l.value=void 0,a(`load`),re();else throw new _o(n.code===void 0?`UNKNOWN`:`REJECTED`,n.message??W(`COMMENT_FAILED`),{rawMessage:n.message??``})}catch(e){To.error(`评论失败`,e),l.value=e instanceof _o?e:new _o(`UNKNOWN`,`${W(`COMMENT_FAILED`)}: ${e.message}`,{rawMessage:e.message})}finally{o.value=!1}}function be(e){(e.ctrlKey||e.metaKey)&&e.key===`Enter`&&ye()}function xe(){S.value?.click()}function Se(){let e=S.value?.files?.[0];we(e)}function Ce(e){e.clipboardData&&we(e.clipboardData.files[0]??e.clipboardData.items[0]?.getAsFile()??void 0)}async function we(e){if(!e||!te.value)return;let t=e.name.split(`.`),r=t.length>1?String(t.pop()):``;if(n.indexOf(r.toLowerCase())===-1)return;let{tcb:a}=bo(),o=a?.auth?.currentUser?.uid??localStorage.getItem(`twikoo-access-token`)??``,s=`${Date.now()}-${o}`,c=t.join(`.`),l=e.type===`image/gif`,u=l?c:`${c}.webp`,d=l?r:`webp`;De(Oe(s,d));let f=String(i.config.IMAGE_CDN??``),p=await Te(e);a&&(!f||f===`qcloud`)?M(s,u,d,p):f?Ee(s,u,d,p):P(s,d,W(`IMAGE_UPLOAD_FAILED_NO_CONF`))}async function Te(e){return e.type===`image/gif`?e:new Promise(t=>{let n=new FileReader;n.onload=n=>{let r=new Image;r.onload=()=>{let n=document.createElement(`canvas`),i=r.width,a=r.height,o=1920;(i>o||a>o)&&(i>a?(a=a*o/i,i=o):(i=i*o/a,a=o)),n.width=i,n.height=a,n.getContext(`2d`)?.drawImage(r,0,0,i,a);let s=`image/webp`,c=e.name.replace(/\.[^.]+$/,`.webp`);n.toBlob(e=>t(new File([e??new Blob],c,{type:s})),s,.85)};let i=n.target?.result;r.src=typeof i==`string`?i:``},n.readAsDataURL(e)})}async function M(e,t,n,r){try{let i=bo().tcb?.app,a=await i.uploadFile({cloudPath:`tk-img/${e}.${n}`,filePath:r});if(!a.fileID)return;N(e,t,n,(await i.getTempFileURL({fileList:[a.fileID]})).fileList[0].tempFileURL)}catch(t){console.error(t),P(e,n,t.message)}}async function Ee(e,t,n,r){try{let i=await Co(bo().tcb,`UPLOAD_IMAGE`,{fileName:t,photo:await Cd(r)}),a=i.result??i;a.data?N(e,t,n,String(a.data.url)):a.code===1041?P(e,n,W(`IMAGE_UPLOAD_NSFW`)):(console.error(a),P(e,n,String(a.err)))}catch(t){console.error(t),P(e,n,t.message)}}function N(e,t,n,r){let i=t.replace(/[[\]]/g,`_`);d.value=d.value.replace(Oe(e,n),``),S.value&&(S.value.value=``)}function P(e,t,n){d.value=d.value.replace(Oe(e,t),`_${W(`IMAGE_UPLOAD_FAILED`)}: ${n}_`),S.value&&(S.value.value=``)}function De(e){let t=ne.value,n=t?.selectionStart??d.value.length,r=t?.selectionEnd??d.value.length;d.value=d.value.substring(0,n)+e+d.value.substring(r),Om(()=>{if(!t)return;let r=n+e.length;t.selectionStart=r,t.selectionEnd=r})}function Oe(e,t){return`![${W(`IMAGE_UPLOAD_PLACEHOLDER`)} ${e}.${t}]()`}function ke(){i.config.COMMENT_BG_IMG&&ne.value&&(ne.value.style[`background-image`]=`url("${String(i.config.COMMENT_BG_IMG)}")`)}function Ae(){le(),de(),pe()}return qm(()=>i.config.SHOW_EMOTION,()=>{ae()}),qm(()=>i.config.COMMENT_BG_IMG,()=>{ke()}),qm(()=>i.config.TURNSTILE_SITE_KEY,()=>{le()}),qm(()=>i.config.GEETEST_CAPTCHA_ID,()=>{de()}),qm(()=>i.config.CAP_API_ENDPOINT,()=>{pe()}),qm(ee,()=>{Ae()}),vh(()=>{i.pid&&y.value?.scrollIntoView({behavior:`instant`,block:`center`}),ie(),ne.value?.addEventListener(`paste`,Ce),ke(),Ae(),ae()}),Sh(()=>{ne.value?.removeEventListener(`paste`,Ce)}),(t,n)=>(Y(),X(`div`,{ref_key:`tkSubmitRef`,ref:y,class:`tk-submit tk-fade-in`},[Z(`div`,Iy,[Q(my,{config:e.config,mail:m.value,nick:p.value},null,8,[`config`,`mail`,`nick`]),Z(`div`,Ly,[Q(Ay,{nick:p.value,mail:m.value,link:h.value,config:e.config,onUpdate:he},null,8,[`nick`,`mail`,`link`,`config`]),Q(xy,{ref_key:`textareaRef`,ref:b,modelValue:d.value,"onUpdate:modelValue":n[0]||=e=>d.value=e,class:`tk-input`,type:`textarea`,placeholder:k.value,autosize:{minRows:3},maxlength:A.value,"show-word-limit":``,onInput:_e,onKeyup:be},null,8,[`modelValue`,`placeholder`,`maxlength`])])]),Z(`div`,Ry,[Z(`div`,zy,[$(` 表情按钮:首屏先渲染图标,随后由 OwO 面板以同样的 logo 接管容器内容 `),$(` 图标为构建期内联的 fontawesome 官方 SVG,非运行时用户数据 `),$(` eslint-disable vue/no-v-html `),Vm(Z(`div`,{ref_key:`owoRef`,ref:x,class:`tk-submit-action-icon OwO`,innerHTML:J(r)},null,8,By),[[rv,e.config.SHOW_EMOTION===`true`],[J(id),oe]]),$(` eslint-enable vue/no-v-html `),Vm(Z(`div`,{class:`tk-submit-action-icon`,onClick:xe},[Q(Zv,{name:`image-regular`})],512),[[rv,te.value]]),Z(`input`,{ref_key:`inputFileRef`,ref:S,class:`tk-input-image`,type:`file`,accept:`image/*`,value:``,onChange:Se},null,544)]),Z(`a`,Vy,[Q(Zv,{name:`markdown`})]),e.replyId?(Y(),o_(Ny,{key:0,class:`tk-cancel`,size:`small`,onClick:ge},{default:Bm(()=>[m_(K(J(W)(`SUBMIT_CANCEL`)),1)]),_:1})):$(`v-if`,!0),Q(Ny,{class:`tk-preview`,size:`small`,onClick:ve},{default:Bm(()=>[m_(K(J(W)(`SUBMIT_PREVIEW`)),1)]),_:1}),Q(Ny,{class:`tk-send`,type:`primary`,size:`small`,disabled:!O.value,onClick:ye},{default:Bm(()=>[m_(K(o.value?J(W)(`SUBMIT_SENDING`):J(W)(`SUBMIT_SEND`)),1)]),_:1},8,[`disabled`]),Vm(Z(`div`,{ref_key:`turnstileContainerRef`,ref:T,class:`tk-turnstile-container`},[Z(`div`,{ref_key:`turnstileRef`,ref:w,class:`tk-turnstile`},null,512)],512),[[rv,ee.value===`Turnstile`]]),Vm(Z(`div`,{ref_key:`geetestContainerRef`,ref:E,class:`tk-geetest-container`},null,512),[[rv,ee.value===`Geetest`]]),Vm(Z(`div`,{ref_key:`capContainerRef`,ref:D,class:`tk-cap-container`},null,512),[[rv,ee.value===`Cap`]])]),s.value?(Y(),X(`div`,Hy,[$(` 预览内容经 sanitizeHtml 消毒 `),$(` eslint-disable-next-line vue/no-v-html `),Z(`div`,{innerHTML:f.value},null,8,Uy)],512)):$(`v-if`,!0)],512))}}),Gy=Kp({serverConfig:{}});function Ky(e){Gy.serverConfig=e}function qy(){return Gy.serverConfig}var Jy=[`id`],Yy={class:`tk-main`},Xy={class:`tk-row`},Zy={class:`tk-meta`},Qy={key:0,class:`tk-nick`},$y=[`href`],eb={key:2,class:`tk-tag tk-tag-green`},tb={key:3,class:`tk-tag tk-tag-red`},nb={key:4,class:`tk-tag tk-tag-yellow`},rb={class:`tk-time`},ib=[`datetime`,`title`],ab={key:5,class:`tk-actions`},ob={key:0},sb=[`innerHTML`],cb={key:0,class:`tk-expand-wrap`},lb={key:1,class:`tk-collapse-wrap`},ub={key:2,class:`tk-extras`},db={key:0,class:`tk-extra`},fb={class:`tk-icon __comment`},pb={class:`tk-extra-text`},mb={key:1,class:`tk-extra`},hb={class:`tk-icon __comment`},gb={class:`tk-extra-text`},_b={key:2,class:`tk-extra`},vb={class:`tk-icon __comment`},yb={class:`tk-extra-text`},bb={key:4,class:`tk-expand-wrap`},xb={key:5,class:`tk-collapse-wrap`},Sb=rh({__name:`TkComment`,props:{comment:{},replyId:{default:``},replying:{type:Boolean,default:!1},config:{default:dy}},emits:[`reply`,`load`,`expand`,`refreshed`,`error`],setup(e,{emit:t}){let n=e,r=t,i={win:`windows`,mac:`apple`,ipad:`apple`,iphone:`apple`,ios:`apple`,android:`android`,ubuntu:`ubuntu`,linux:`linux`},a={edge:`edge`,chrome:`chrome`,firefox:`firefox-browser`,safari:`safari`,explorer:`internet-explorer`,ie:`internet-explorer`},o=q(``),s=q(n.comment.ups??0),c=q(n.comment.downs??0),l=q(n.comment.liked===!0),u=q(n.comment.disliked===!0),d=q(!1),f=q(!1),p=q(!1),m=q(!1),h=q(!1),g=q(!1),_=q(n.comment.isSpam===!0),v=q(n.comment.top===!0),y=q(!1),b=q(),x=q(),S=q(),C=q(),w=U_(()=>uc(n.comment.comment)),T=U_(()=>ud(n.comment.created)),E=U_(()=>new Date(n.comment.created??0).toJSON()),D=U_(()=>new Date(n.comment.created??0).toLocaleString()),ee=U_(()=>ie(n.comment.os??``,i)),te=U_(()=>ie(n.comment.browser??``,a)),O=U_(()=>p.value&&!f.value),k=U_(()=>p.value&&f.value),A=U_(()=>h.value&&!m.value),ne=U_(()=>h.value&&m.value),re=U_(()=>ld(n.comment.link));function ie(e,t){let n=e.toLowerCase();for(let e of Object.keys(t))if(n.indexOf(e)!==-1)return t[e];return`window-maximize-regular`}function ae(){let e=C.value;n.comment.replies.length>0&&e&&(p.value=e.scrollHeight>236)}function oe(){let e=x.value;e&&(h.value=h.value||e.scrollHeight>500)}function se(){x.value?.querySelectorAll(`img`).forEach(e=>{e.onload=oe})}function ce(){window.location.hash.indexOf(n.comment.id)!==-1&&(b.value?.scrollIntoView({behavior:`smooth`}),r(`expand`))}function le(e){document.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`center`})}async function ue(){if(!d.value){d.value=!0;try{await Co(bo().tcb,`COMMENT_LIKE`,{id:n.comment.id,type:`up`}),l.value?s.value--:(s.value++,u.value&&c.value--),l.value=!l.value,u.value=!1}finally{d.value=!1}}}async function de(){if(!d.value){d.value=!0;try{await Co(bo().tcb,`COMMENT_LIKE`,{id:n.comment.id,type:`down`}),u.value?c.value--:(c.value++,l.value&&s.value--),u.value=!u.value,l.value=!1}finally{d.value=!1}}}function fe(e){o.value=e,r(`reply`,n.comment.id)}async function pe(){if(!confirm(W(`COMMENT_DELETE_CONFIRM`)))return;let e=await Co(bo().tcb,`COMMENT_DELETE_FOR_USER`,{id:n.comment.id}),t=e.result??e;t.code?alert(t.message):r(`load`)}function me(e){o.value=e,r(`reply`,e?n.comment.id:``)}function he(){o.value=``,r(`reply`,``)}function ge(){o.value=``,r(`reply`,``),r(`load`),f.value=!0}function _e(){r(`refreshed`),Om(()=>{let e=C.value?.lastElementChild;n.comment.replies.length>0&&e&&e.scrollIntoView({behavior:`smooth`,block:`center`})})}async function ve(){let{tcb:e}=bo();if(e?.auth){let t=await e.auth.getCurrentUser();g.value=t.loginType===`CUSTOM`}else g.value=qy().IS_ADMIN===!0}function j(e){xe({isSpam:e})}function ye(e){xe({top:e})}function be(e){if(qy().LIGHTBOX!==`true`)return;let t=e.target;if(t.tagName!==`IMG`||t.classList.contains(`tk-owo-emotion`))return;let n=document.createElement(`div`);n.className=`tk-lightbox`;let r=document.createElement(`img`);r.className=`tk-lightbox-image`,r.src=t.src,n.appendChild(r),n.addEventListener(`click`,()=>{document.body.removeChild(n)}),document.body.appendChild(n)}async function xe(e){y.value=!0;try{await Co(bo().tcb,`COMMENT_SET_FOR_ADMIN`,{id:n.comment.id,set:e}),e.isSpam!==void 0&&(_.value=e.isSpam),e.top!==void 0&&(v.value=e.top)}finally{y.value=!1}}function Se(){let e=S.value;e&&(Td(e),Ed(e,bo().options.katex),n.config.HIGHLIGHT===`true`&&Tc(e,n.config.HIGHLIGHT_THEME,n.config.HIGHLIGHT_PLUGIN))}return qm(()=>n.comment.isSpam,e=>{_.value=e===!0}),qm(()=>n.comment.top,e=>{v.value=e===!0}),qm(()=>n.comment.ups,()=>{s.value=n.comment.ups??0,l.value=n.comment.liked===!0},{immediate:!0}),qm(()=>n.comment.downs,()=>{c.value=n.comment.downs??0,u.value=n.comment.disliked===!0},{immediate:!0}),qm(()=>n.config.HIGHLIGHT,e=>{e===`true`&&Om(Se)},{immediate:!0}),vh(()=>{Om(oe),Om(se),Om(ae),Om(ce),Om(Se),ve()}),(t,n)=>{let i=Oh(`TkComment`,!0);return Y(),X(`div`,{id:e.comment.id,ref_key:`tkCommentRef`,ref:b,class:xf([`tk-comment`,{"tk-master":e.comment.master}])},[Q(my,{config:e.config,nick:e.comment.nick,avatar:e.comment.avatar,"mail-md5":e.comment.mailMd5,link:re.value},null,8,[`config`,`nick`,`avatar`,`mail-md5`,`link`]),Z(`div`,Yy,[Z(`div`,Xy,[Z(`div`,Zy,[re.value?$(`v-if`,!0):(Y(),X(`strong`,Qy,K(e.comment.nick),1)),re.value?(Y(),X(`a`,{key:1,class:`tk-nick tk-nick-link`,href:re.value,target:`_blank`,rel:`noopener noreferrer nofollow ugc`},[Z(`strong`,null,K(e.comment.nick),1)],8,$y)):$(`v-if`,!0),e.comment.master?(Y(),X(`span`,eb,K(e.config.MASTER_TAG||J(W)(`COMMENT_MASTER_TAG`)),1)):$(`v-if`,!0),v.value?(Y(),X(`span`,tb,K(J(W)(`COMMENT_TOP_TAG`)),1)):$(`v-if`,!0),_.value?(Y(),X(`span`,nb,K(J(W)(`COMMENT_REVIEWING_TAG`)),1)):$(`v-if`,!0),Z(`small`,rb,[Z(`time`,{datetime:E.value,title:D.value},K(T.value),9,ib)]),g.value?(Y(),X(`small`,ab,[_.value?(Y(),X(`button`,{key:0,onClick:n[0]||=e=>j(!1)},K(J(W)(`ADMIN_COMMENT_SHOW`)),1)):$(`v-if`,!0),_.value?$(`v-if`,!0):(Y(),X(`button`,{key:1,onClick:n[1]||=e=>j(!0)},K(J(W)(`ADMIN_COMMENT_HIDE`)),1)),!e.comment.rid&&v.value?(Y(),X(`button`,{key:2,onClick:n[2]||=e=>ye(!1)},K(J(W)(`ADMIN_COMMENT_UNTOP`)),1)):$(`v-if`,!0),!e.comment.rid&&!v.value?(Y(),X(`button`,{key:3,onClick:n[3]||=e=>ye(!0)},K(J(W)(`ADMIN_COMMENT_TOP`)),1)):$(`v-if`,!0)])):$(`v-if`,!0)]),Q(uy,{liked:l.value,disliked:u.value,"like-count":s.value,"dislike-count":c.value,"replies-count":e.comment.replies.length,"show-dislike":e.config.SHOW_DISLIKE!==`false`,"show-delete":e.comment.isOwner===!0,onLike:ue,onDislike:de,onReply:fe,onDelete:pe},null,8,[`liked`,`disliked`,`like-count`,`dislike-count`,`replies-count`,`show-dislike`,`show-delete`])]),Z(`div`,{ref_key:`tkContentRef`,ref:x,class:xf([`tk-content`,{"tk-content-expand":m.value}])},[e.comment.pid?(Y(),X(`span`,ob,[m_(K(J(W)(`COMMENT_REPLIED`))+` `,1),Z(`a`,{class:`tk-ruser`,href:`#`,onClick:n[4]||=Bv(t=>le(e.comment.pid),[`prevent`])},K(`@${e.comment.ruser}`),1),n[12]||=m_(` : `,-1)])):$(`v-if`,!0),$(` 正文:服务端已 DOMPurify 消毒,客户端再走一次 sanitizeHtml 双保险 `),$(` eslint-disable-next-line vue/no-v-html `),Z(`span`,{ref_key:`commentRef`,ref:S,onClick:be,innerHTML:w.value},null,8,sb)],2),A.value?(Y(),X(`div`,cb,[Z(`div`,{class:`tk-expand`,onClick:n[5]||=e=>m.value=!0},K(J(W)(`COMMENT_EXPAND`)),1)])):$(`v-if`,!0),ne.value?(Y(),X(`div`,lb,[Z(`div`,{class:`tk-expand _collapse`,onClick:n[6]||=e=>m.value=!1},K(J(W)(`COMMENT_COLLAPSE`)),1)])):$(`v-if`,!0),e.comment.ipRegion||e.comment.os||e.comment.browser?(Y(),X(`div`,ub,[e.comment.ipRegion?(Y(),X(`div`,db,[Z(`span`,fb,[Q(Zv,{name:`location-arrow`})]),Z(`span`,pb,`\xA0`+K(e.comment.ipRegion),1)])):$(`v-if`,!0),e.comment.os?(Y(),X(`div`,mb,[Z(`span`,hb,[Q(Zv,{name:ee.value},null,8,[`name`])]),Z(`span`,gb,`\xA0`+K(e.comment.os),1)])):$(`v-if`,!0),e.comment.browser?(Y(),X(`div`,_b,[Z(`span`,vb,[Q(Zv,{name:te.value},null,8,[`name`])]),Z(`span`,yb,`\xA0`+K(e.comment.browser),1)])):$(`v-if`,!0)])):$(`v-if`,!0),$(` 回复框(主楼被回复时挂载;楼中楼由子评论自身挂载) `),e.replying&&!o.value?(Y(),o_(Wy,{key:3,"reply-id":e.replyId?e.replyId:e.comment.id,pid:e.comment.id,config:e.config,onLoad:ge,onCancel:he,onError:n[7]||=e=>r(`error`,e)},null,8,[`reply-id`,`pid`,`config`])):$(`v-if`,!0),$(` 回复列表 `),Z(`div`,{ref_key:`tkRepliesRef`,ref:C,class:xf([`tk-replies`,{"tk-replies-expand":f.value||!O.value||e.replying}])},[(Y(!0),X(Xg,null,Mh(e.comment.replies,t=>(Y(),o_(i,{key:t.id,comment:t,"reply-id":e.comment.id,replying:e.replying&&o.value===t.id,config:e.config,onExpand:n[8]||=e=>f.value=!0,onLoad:ge,onReply:me,onRefreshed:_e,onError:n[9]||=e=>r(`error`,e)},null,8,[`comment`,`reply-id`,`replying`,`config`]))),128))],2),O.value&&!e.replying?(Y(),X(`div`,bb,[Z(`div`,{class:`tk-expand`,onClick:n[10]||=e=>f.value=!0},K(J(W)(`COMMENT_EXPAND`)),1)])):$(`v-if`,!0),k.value&&!e.replying?(Y(),X(`div`,xb,[Z(`div`,{class:`tk-expand _collapse`,onClick:n[11]||=e=>f.value=!1},K(J(W)(`COMMENT_COLLAPSE`)),1)])):$(`v-if`,!0)])],10,Jy)}}}),Cb={class:`tk-error`},wb={class:`tk-error__icon`},Tb={class:`tk-error__body`},Eb={class:`tk-error__title`},Db={class:`tk-error__message`},Ob={class:`tk-error__detail`},kb={key:0,class:`tk-error__row`},Ab={key:1,class:`tk-error__row`},jb={key:2,class:`tk-error__raw`},Mb=rh({__name:`TkError`,props:{error:{}},setup(e){let t=e,n=q(!1),r={NETWORK:`无法连接到后端`,CORS:`请求被跨域策略拦截`,TIMEOUT:`请求超时`,REJECTED:`请求过于频繁`,NOT_FOUND:`接口地址不存在`,CLIENT_ERROR:`请求失败`,SERVER_ERROR:`后端异常`,UNKNOWN:`出现未知错误`},i=U_(()=>r[t.error.kind]??`出现错误`),a=U_(()=>{let e=t.error.rawMessage||t.error.message;return e.length>120?`${e.slice(0,120)}...`:e}),o=U_(()=>t.error.rawMessage||``),s=U_(()=>t.error.httpStatus),c=U_(()=>t.error.requestId);return(e,t)=>(Y(),X(`div`,Cb,[Z(`div`,wb,[Q(Zv,{name:`circle-exclamation`})]),Z(`div`,Tb,[Z(`div`,Eb,K(i.value),1),Z(`div`,Db,K(a.value),1),Z(`button`,{class:`tk-error__toggle`,type:`button`,onClick:t[0]||=e=>n.value=!n.value},K(n.value?`收起详情`:`展开详情`),1),Vm(Z(`div`,Ob,[s.value?(Y(),X(`div`,kb,`HTTP: `+K(s.value),1)):$(`v-if`,!0),c.value?(Y(),X(`div`,Ab,`Request ID: `+K(c.value),1)):$(`v-if`,!0),o.value?(Y(),X(`pre`,jb,K(o.value),1)):$(`v-if`,!0)],512),[[rv,n.value]])])]))}}),Nb={class:`tk-comments`},Pb={class:`tk-comments-container`},Fb={class:`tk-comments-title`},Ib={key:0},Lb={class:`tk-comments-actions`},Rb={key:0,class:`tk-comments-sort`},zb={class:`tk-comments-search`},Bb={key:1,class:`tk-comments-no`},Vb={key:0},Hb={key:1},Ub={key:2,class:`tk-expand-wrap`},Wb=rh({__name:`TkComments`,props:{showAdminEntry:{type:Boolean,default:!1}},emits:[`admin`,`refreshed`],setup(e,{emit:t}){let n=t,r=q(!0),i=q(!1),a=q(null),o=q({}),s=q([]),c=q(!0),l=q(0),u=q(``),d=q(1),f=q(`newest`),p=q(``),m=q(``),h=q(!1),g=q(0),_=q();async function v(){try{let e=await Co(bo().tcb,`GET_CONFIG`),t=e.result??e;t.config&&(o.value=t.config,Ky(t.config))}catch(e){To.warn(`加载公开配置失败`,e)}}async function y(){let e=++g.value;r.value=!0,a.value=null;let t={url:md(bo().options.path),sort:f.value,keyword:m.value};m.value&&(t.page=1),await k(t),e===g.value&&(r.value=!1)}function b(){s.value=[],d.value=1}function x(){let e=p.value.trim();p.value=e,m.value!==e&&(m.value=e,b(),y())}function S(){m.value&&(m.value=``,b(),y())}function C(){h.value=!h.value,h.value?setTimeout(()=>_.value?.focus(),0):(p.value=``,S())}function w(){b(),y()}async function T(){let e=++g.value;r.value=!0,a.value=null;try{let e=md(bo().options.path),t=d.value,n={url:e,sort:f.value,keyword:m.value};if(m.value&&(n.page=1),!await k(n))return;for(let n=2;n<=t&&await te(e,n);n++);}finally{e===g.value&&(r.value=!1)}e===g.value&&n(`refreshed`)}function E(e){f.value!==e&&(f.value=e,b(),y())}async function D(){if(!i.value){i.value=!0,d.value++;try{await te(md(bo().options.path),d.value)}finally{i.value=!1}}}function ee(){let e=1/0;for(let t of s.value)!t.top&&(t.created??1/0)<e&&(e=t.created??1/0);return e===1/0?void 0:e}async function te(e,t=d.value){if(m.value)return k({url:e,page:t,sort:f.value,keyword:m.value});let n=ee();return n!==void 0&&k({url:e,before:n,sort:f.value,keyword:m.value})}function O(){let e=bo().options.onCommentLoaded;typeof e==`function`&&e()}async function k(e){let t=g.value;try{let n=await Co(bo().tcb,`COMMENT_GET`,e);if(t!==g.value)return!1;let r=n.result??n;if(r?.message)return a.value=new _o(`CLIENT_ERROR`,r.message,{rawMessage:r.message}),!1;if(r?.data)return s.value=e.before||typeof e.page==`number`&&e.page>1?s.value.concat(r.data):r.data,c.value=r.more===!0,l.value=r.count??s.value.length,setTimeout(O,0),!0}catch(e){t===g.value&&(a.value=e instanceof _o?e:new _o(`UNKNOWN`,e.message,{rawMessage:e.message}))}return!1}function A(e){a.value=e}function ne(e){u.value=e}function re(){n(`admin`)}function ie(){v()}function ae(){T()}return vh(()=>{v(),y(),Ey(Cy,ie),Ey(Cy,ae)}),Sh(()=>{Dy(Cy,ie),Dy(Cy,ae)}),(t,n)=>(Y(),X(`div`,Nb,[Q(Wy,{config:o.value,onLoad:y,onError:A},null,8,[`config`]),Vm((Y(),X(`div`,Pb,[Z(`div`,Fb,[Z(`span`,{class:xf([`tk-comments-count`,{__hidden:r.value||!s.value.length&&!m.value}])},[m.value?(Y(),X(`span`,Ib,K(J(W)(`COMMENTS_SEARCH_COUNT_PREFIX`)),1)):$(`v-if`,!0),Z(`span`,null,K(l.value),1),Z(`span`,null,K(J(W)(`COMMENTS_COUNT_SUFFIX`)),1)],2),Z(`span`,Lb,[!r.value&&s.value.length&&o.value.SHOW_ORDER!==`false`?(Y(),X(`span`,Rb,[Z(`button`,{class:xf([`tk-sort-item`,{__active:f.value===`newest`}]),type:`button`,onClick:n[0]||=e=>E(`newest`)},K(J(W)(`COMMENTS_SORT_NEWEST`)),3),Z(`button`,{class:xf([`tk-sort-item`,{__active:f.value===`oldest`}]),type:`button`,onClick:n[1]||=e=>E(`oldest`)},K(J(W)(`COMMENTS_SORT_OLDEST`)),3),Z(`button`,{class:xf([`tk-sort-item`,{__active:f.value===`popular`}]),type:`button`,onClick:n[2]||=e=>E(`popular`)},K(J(W)(`COMMENTS_SORT_POPULAR`)),3)])):$(`v-if`,!0),!r.value&&!i.value?(Y(),X(`span`,{key:1,class:xf([`tk-icon __comments`,{__active:h.value}]),onClick:C},[Q(Zv,{name:`magnifying-glass`})],2)):$(`v-if`,!0),!r.value&&!i.value?(Y(),X(`span`,{key:2,class:`tk-icon __comments`,onClick:w},[Q(Zv,{name:`sync`})])):$(`v-if`,!0),e.showAdminEntry?(Y(),X(`span`,{key:3,class:`tk-icon __comments`,onClick:re},[Q(Zv,{name:`cog`})])):$(`v-if`,!0)])]),Vm(Z(`div`,zb,[Q(xy,{ref_key:`searchInputRef`,ref:_,modelValue:p.value,"onUpdate:modelValue":n[3]||=e=>p.value=e,size:`small`,clearable:``,maxlength:100,placeholder:J(W)(`COMMENTS_SEARCH_PLACEHOLDER`),onClear:S,onKeyup:Hv(x,[`enter`])},null,8,[`modelValue`,`placeholder`]),Q(Ny,{size:`small`,type:`primary`,onClick:x},{default:Bm(()=>[m_(K(J(W)(`COMMENTS_SEARCH`)),1)]),_:1})],512),[[rv,h.value]]),$(` 评论区唯一错误卡片:列表/提交/回复失败共用,位于空态块上方 `),a.value?(Y(),o_(Mb,{key:0,error:a.value},null,8,[`error`])):$(`v-if`,!0),!s.value.length&&!r.value&&!a.value?(Y(),X(`div`,Bb,[m.value?(Y(),X(`span`,Vb,K(J(W)(`COMMENTS_SEARCH_NO_RESULT`)),1)):$(`v-if`,!0),m.value?$(`v-if`,!0):(Y(),X(`span`,Hb,K(J(W)(`COMMENTS_NO_COMMENTS`)),1))])):$(`v-if`,!0),(Y(!0),X(Xg,null,Mh(s.value,e=>(Y(),o_(Sb,{key:e.id,comment:e,replying:u.value===e.id,config:o.value,onReply:ne,onLoad:T,onError:A},null,8,[`comment`,`replying`,`config`]))),128)),c.value&&!r.value&&!a.value?(Y(),X(`div`,Ub,[Vm((Y(),X(`div`,{class:`tk-expand`,onClick:D},[m_(K(J(W)(`COMMENTS_EXPAND`)),1)])),[[J(td),i.value]])])):$(`v-if`,!0)])),[[J(td),r.value]])]))}}),Gb={class:`tk-footer`},Kb=rh({__name:`TkFooter`,setup(e){let t=ho;return(e,n)=>(Y(),X(`div`,Gb,[n[0]||=m_(` Powered by `,-1),n[1]||=Z(`a`,{href:`https://twikoo.js.org`,target:`_blank`,rel:`noopener noreferrer`},`Twikoo`,-1),m_(` v`+K(J(t)),1)]))}}),qb={class:`tk-pagination`},Jb={key:0,class:`tk-pagination-options`},Yb={class:`tk-pagination-pagers`},Xb=[`onClick`],Zb={key:1,class:`tk-pagination-options`},Qb=rh({__name:`TkPagination`,props:{pageSize:{default:10},total:{default:0}},emits:[`current-change`,`page-size-change`],setup(e,{emit:t}){let n=e,r=t,i=q(1),a=q(0),o=q(0),s=q([]),c=U_(()=>Math.ceil(n.total/n.pageSize));function l(){let e=[];for(let t=1;t<=c.value;t++)Math.abs(i.value-t)<3||t===1||t===c.value?e.push({title:`${t}`,page:t}):Math.abs(i.value-t)<4&&e.push({title:`...`,page:t});s.value=e}function u(e){i.value=parseInt(String(e),10)||1,i.value>c.value&&(i.value=c.value),i.value<1&&(i.value=1),a.value=0,r(`current-change`,i.value),l()}function d(e){o.value=0,r(`page-size-change`,parseInt(String(e),10))}function f(e){a.value=parseInt(String(e),10)}function p(e){o.value=parseInt(String(e),10)}function m(){l()}return qm(()=>n.total,m,{immediate:!0}),qm(()=>n.pageSize,m),(t,n)=>(Y(),X(`div`,qb,[c.value?(Y(),X(`div`,Jb,[Z(`div`,null,[Z(`span`,null,K(J(W)(`PAGINATION_COUNT_PREFIX`)),1),Z(`span`,null,K(e.total),1),Z(`span`,null,K(J(W)(`PAGINATION_COUNT_SUFFIX`)),1)]),Q(xy,{class:`tk-pagination-size`,type:`number`,min:1,max:100,"model-value":o.value?o.value:e.pageSize,onInput:p,onChange:d},null,8,[`model-value`]),Z(`span`,null,K(J(W)(`PAGINATION_PAGESIZE`)),1)])):$(`v-if`,!0),Z(`div`,Yb,[(Y(!0),X(Xg,null,Mh(s.value,e=>(Y(),X(`div`,{key:e.page,class:xf([`tk-pagination-pager`,{__current:e.page===i.value}]),onClick:t=>u(e.page)},K(e.title),11,Xb))),128))]),c.value?(Y(),X(`div`,Zb,[Z(`span`,null,K(J(W)(`PAGINATION_GOTO_PREFIX`)),1),Q(xy,{class:`tk-pagination-goto`,type:`number`,min:1,max:c.value,"model-value":a.value?a.value:i.value,onInput:f,onChange:u},null,8,[`max`,`model-value`]),Z(`span`,null,K(J(W)(`PAGINATION_GOTO_SUFFIX`)),1)])):$(`v-if`,!0)]))}}),$b={class:`tk-admin-comment`},ex={key:0,class:`tk-admin-warn`},tx={class:`tk-admin-comment-filter`},nx={value:``},rx={value:`VISIBLE`},ix={value:`HIDDEN`},ax={class:`tk-admin-comment-meta`},ox={key:0},sx=[`href`],cx={key:2},lx=[`href`],ux={key:3},dx={class:`tk-time`},fx=[`title`],px=[`innerHTML`],mx={key:0,class:`tk-admin-warn tk-admin-security-alert`},hx={class:`tk-admin-security-alert-message`},gx={key:0,class:`tk-admin-security-alert-url`},_x={class:`tk-admin-actions`},vx=5,yx=rh({__name:`TkAdminComment`,setup(e){let t=qy().VERSION,n=q(!0),r=q([]),i=Kp({}),a=q(typeof t==`string`?t:``),o=ho,s=q(0),c=q(vx),l=q(1),u=Kp({keyword:``,type:``}),d=q(null),f=q();function p(e){return ud(e.created)}async function m(){n.value=!0;let e=await Co(bo().tcb,`COMMENT_GET_FOR_ADMIN`,{per:c.value,page:l.value,keyword:u.keyword,type:u.type}),t=e.result??e;t&&!t.code&&(s.value=t.count??0,r.value=(t.data??[]).map(e=>({...e,comment:uc(e.comment)}))),setTimeout(()=>{w(f.value)},0),n.value=!1}async function h(){let e=await Co(bo().tcb,`GET_CONFIG_FOR_ADMIN`),t=e.result??e;t&&!t.code&&t.config&&(Object.assign(i,t.config),a.value=typeof t.config.VERSION==`string`?t.config.VERSION:``,g())}function g(){i.HIGHLIGHT||=`true`;let e={},t=localStorage.getItem(`twikoo`);if(t)try{e=JSON.parse(t)}catch{e={}}for(let t of[`nick`,`mail`,`avatar`])i[t]=e[t]??``;!e.nick&&i.BLOGGER_NICK&&(e.nick=String(i.BLOGGER_NICK)),!e.mail&&i.BLOGGER_EMAIL&&(e.mail=String(i.BLOGGER_EMAIL)),!e.link&&i.SITE_URL&&(e.link=String(i.SITE_URL)),localStorage.setItem(`twikoo`,JSON.stringify(e))}function _(e){c.value=e,m()}function v(e){l.value=e,m()}function y(e){let t=`${e.url??``}#${e.id}`;try{if(new URL(t).hostname!==window.location.hostname){d.value={commentId:e.id,message:W(`ADMIN_COMMENT_SECURITY_ALERT`),url:t};return}window.open(t)}catch{try{new URL(t,window.location.origin),window.open(t)}catch{d.value={commentId:e.id,message:W(`ADMIN_COMMENT_PARSE_ERROR`),url:e.url}}}}async function b(e){confirm(W(`ADMIN_COMMENT_DELETE_CONFIRM`))&&(n.value=!0,await Co(bo().tcb,`COMMENT_DELETE_FOR_ADMIN`,{id:e.id}),await m(),n.value=!1)}function x(e,t){C(e,{isSpam:t})}function S(e,t){C(e,{top:t})}async function C(e,t){n.value=!0,await Co(bo().tcb,`COMMENT_SET_FOR_ADMIN`,{id:e.id,set:t}),await m(),n.value=!1}function w(e){e&&(Td(e),Ed(e,bo().options.katex),i.HIGHLIGHT===`true`&&Tc(e,i.HIGHLIGHT_THEME,i.HIGHLIGHT_PLUGIN))}return vh(async()=>{await Promise.all([h(),m()]),w(f.value)}),(e,t)=>Vm((Y(),X(`div`,$b,[J(o)===a.value?$(`v-if`,!0):(Y(),X(`div`,ex,[Z(`span`,null,K(J(W)(`ADMIN_CLIENT_VERSION`))+K(J(o))+`,`,1),Z(`span`,null,K(J(W)(`ADMIN_SERVER_VERSION`))+K(a.value)+`,`,1),$(`
|
|
241
|
+
`)}),A=U_(()=>{let e=parseInt(String(i.config.LIMIT_LENGTH),10);return Number.isNaN(e)&&(e=500),e>0?e:void 0}),ne=U_(()=>{let e=b.value?.inputEl;return e instanceof HTMLTextAreaElement?e:null});function re(){localStorage.setItem(`twikoo-draft`,d.value)}function ie(){let e=localStorage.getItem(`twikoo-draft`);!d.value&&e&&(d.value=e)}async function ae(){if(i.config.SHOW_EMOTION!==`true`)return;let e=await Ju(String(i.config.EMOTION_CDN||`https://owo.imaegoo.com/owo.json`));Yu(e),x.value&&ne.value&&(u.value=new Fy({logo:r,container:x.value,target:ne.value,odata:e,position:`down`,maxHeight:`250px`}))}function oe(){u.value?.container.classList.contains(`OwO-open`)&&u.value.toggle()}function se(e){return new Promise((t,n)=>{let r=document.createElement(`script`);r.src=e,r.onload=()=>t(),r.onerror=()=>n(Error(`脚本加载失败:${e}`)),document.head.appendChild(r)})}function ce(e,t){return{ok:e,json:()=>Promise.resolve(t)}}function le(){if(ee.value===`Turnstile`&&i.config.TURNSTILE_SITE_KEY){if(window.turnstile){g.value=Promise.resolve();return}g.value||=se(`https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit`)}}function ue(){return new Promise((e,t)=>{g.value?.then(()=>{let n=window.turnstile,r=n.render(w.value,{sitekey:i.config.TURNSTILE_SITE_KEY,callback:t=>{e(t),setTimeout(()=>n.remove(r),1e3)},"error-callback":()=>t(Error(`验证码校验失败,请重试`)),"expired-callback":()=>t(Error(`验证码已过期,请重试`)),"timeout-callback":()=>t(Error(`验证码超时,请重试`))})})})}function de(){if(ee.value===`Geetest`&&i.config.GEETEST_CAPTCHA_ID){if(window.initGeetest4){_.value=Promise.resolve();return}_.value||=se(`https://static.geetest.com/v4/gt4.js`)}}function fe(){return new Promise((e,t)=>{_.value?.then(()=>{let n=window.initGeetest4;n({captchaId:i.config.GEETEST_CAPTCHA_ID,product:`bind`,language:`zho`},n=>{n.onReady(()=>n.showCaptcha()).onSuccess(()=>{let t=n.getValidate();e({geeTestLotNumber:t.lot_number,geeTestCaptchaOutput:t.captcha_output,geeTestPassToken:t.pass_token,geeTestGenTime:t.gen_time})}).onError(e=>t(e instanceof Error?e:Error(`Geetest 验证失败,请重试`))).onClose(()=>t(Error(`验证已取消`)))})})})}function pe(){if(ee.value!==`Cap`||!i.config.CAP_API_ENDPOINT&&!i.config.CAP_BUILTIN)return;let e=window;if(i.config.CAP_BUILTIN&&(e.CAP_CUSTOM_FETCH=async(e,t={})=>{let n=String(e),r=t.body?JSON.parse(t.body):{};try{if(n.includes(`challenge`)){let e=await Co(bo().tcb,`CAP_CHALLENGE`),t=e.result??e;return t.code&&t.code!==0?ce(!1,{error:t.message??`challenge_failed`}):ce(!0,{challenge:t.challenge,token:t.token,expires:t.expires})}if(n.includes(`redeem`)){let e=await Co(bo().tcb,`CAP_REDEEM`,r),t=e.result??e;return t.code&&t.code!==0&&t.success!==!0?ce(!0,{success:!1,error:t.message??t.error??`redeem_failed`}):ce(!0,{success:t.success,token:t.token,expires:t.expires,message:t.message,error:t.error??t.message})}return ce(!1,{error:`unknown_cap_path`})}catch(e){return ce(!1,{error:e instanceof Error?e.message:`cap_fetch_failed`})}}),e.Cap||customElements.get(`cap-widget`)){v.value=Promise.resolve();return}v.value||=se(`https://cdn.jsdmirror.com/npm/@cap.js/widget`)}function me(){return new Promise((e,t)=>{v.value?.then(()=>{let n=document.createElement(`cap-widget`);n.setAttribute(`id`,`cap-widget`);let r=i.config.CAP_BUILTIN?`/`:String(i.config.CAP_API_ENDPOINT);n.setAttribute(`data-cap-api-endpoint`,r),D.value?.appendChild(n);let a=()=>{n.parentNode?.removeChild(n)};n.solve().then(n=>{a(),n.success?e(typeof n.token==`string`?n.token:``):t(Error(`Cap 验证失败`))}).catch(e=>{a(),t(e instanceof Error?e:Error(`Cap 验证失败`))})}).catch(t)})}function he(e){p.value=e.meta.nick,m.value=e.meta.mail,h.value=e.meta.link,c.value=e.valid}function ge(){a(`cancel`)}function _e(){re(),j()}function ve(){s.value=!s.value,j()}function j(){s.value&&(f.value=uc(Hu(d.value)),Om(()=>{let e=C.value;e&&(Td(e),Ed(e,bo().options.katex),i.config.HIGHLIGHT===`true`&&Tc(e,i.config.HIGHLIGHT_THEME,i.config.HIGHLIGHT_PLUGIN))}))}async function ye(){o.value=!0,l.value=void 0;try{if(d.value.match(RegExp(`!\\[${W(`IMAGE_UPLOAD_PLACEHOLDER`)}.+\\]\\(\\)`)))throw Error(W(`IMAGE_UPLOAD_PLEASE_WAIT`));let e={nick:p.value,mail:m.value,link:h.value,ua:await wd(),url:md(bo().options.path),href:hd(bo().options.href),comment:Hu(d.value),pid:i.pid?i.pid:i.replyId,rid:i.replyId};ee.value===`Turnstile`&&i.config.TURNSTILE_SITE_KEY&&(e.turnstileToken=await ue()),ee.value===`Geetest`&&i.config.GEETEST_CAPTCHA_ID&&Object.assign(e,await fe()),ee.value===`Cap`&&(i.config.CAP_API_ENDPOINT||i.config.CAP_BUILTIN)&&(e.capToken=await me());let t=await Co(bo().tcb,`COMMENT_SUBMIT`,e),n=t.result??t;if(n.id)d.value=``,l.value=void 0,a(`load`),re();else throw new _o(n.code===void 0?`UNKNOWN`:`REJECTED`,n.message??W(`COMMENT_FAILED`),{rawMessage:n.message??``})}catch(e){To.error(`评论失败`,e),l.value=e instanceof _o?e:new _o(`UNKNOWN`,`${W(`COMMENT_FAILED`)}: ${e.message}`,{rawMessage:e.message})}finally{o.value=!1}}function be(e){(e.ctrlKey||e.metaKey)&&e.key===`Enter`&&ye()}function xe(){S.value?.click()}function Se(){let e=S.value?.files?.[0];we(e)}function Ce(e){e.clipboardData&&we(e.clipboardData.files[0]??e.clipboardData.items[0]?.getAsFile()??void 0)}async function we(e){if(!e||!te.value)return;let t=e.name.split(`.`),r=t.length>1?String(t.pop()):``;if(n.indexOf(r.toLowerCase())===-1)return;let{tcb:a}=bo(),o=a?.auth?.currentUser?.uid??localStorage.getItem(`twikoo-access-token`)??``,s=`${Date.now()}-${o}`,c=t.join(`.`),l=e.type===`image/gif`,u=l?c:`${c}.webp`,d=l?r:`webp`;De(Oe(s,d));let f=String(i.config.IMAGE_CDN??``),p=await Te(e);a&&(!f||f===`qcloud`)?M(s,u,d,p):f?Ee(s,u,d,p):P(s,d,W(`IMAGE_UPLOAD_FAILED_NO_CONF`))}async function Te(e){return e.type===`image/gif`?e:new Promise(t=>{let n=new FileReader;n.onload=n=>{let r=new Image;r.onload=()=>{let n=document.createElement(`canvas`),i=r.width,a=r.height,o=1920;(i>o||a>o)&&(i>a?(a=a*o/i,i=o):(i=i*o/a,a=o)),n.width=i,n.height=a,n.getContext(`2d`)?.drawImage(r,0,0,i,a);let s=`image/webp`,c=e.name.replace(/\.[^.]+$/,`.webp`);n.toBlob(e=>t(new File([e??new Blob],c,{type:s})),s,.85)};let i=n.target?.result;r.src=typeof i==`string`?i:``},n.readAsDataURL(e)})}async function M(e,t,n,r){try{let i=bo().tcb?.app,a=await i.uploadFile({cloudPath:`tk-img/${e}.${n}`,filePath:r});if(!a.fileID)return;N(e,t,n,(await i.getTempFileURL({fileList:[a.fileID]})).fileList[0].tempFileURL)}catch(t){console.error(t),P(e,n,t.message)}}async function Ee(e,t,n,r){try{let i=await Co(bo().tcb,`UPLOAD_IMAGE`,{fileName:t,photo:await Cd(r)}),a=i.result??i;a.data?N(e,t,n,String(a.data.url)):a.code===1041?P(e,n,W(`IMAGE_UPLOAD_NSFW`)):(console.error(a),P(e,n,String(a.err)))}catch(t){console.error(t),P(e,n,t.message)}}function N(e,t,n,r){let i=t.replace(/[[\]]/g,`_`);d.value=d.value.replace(Oe(e,n),``),S.value&&(S.value.value=``)}function P(e,t,n){d.value=d.value.replace(Oe(e,t),`_${W(`IMAGE_UPLOAD_FAILED`)}: ${n}_`),S.value&&(S.value.value=``)}function De(e){let t=ne.value,n=t?.selectionStart??d.value.length,r=t?.selectionEnd??d.value.length;d.value=d.value.substring(0,n)+e+d.value.substring(r),Om(()=>{if(!t)return;let r=n+e.length;t.selectionStart=r,t.selectionEnd=r})}function Oe(e,t){return`![${W(`IMAGE_UPLOAD_PLACEHOLDER`)} ${e}.${t}]()`}function ke(){i.config.COMMENT_BG_IMG&&ne.value&&(ne.value.style[`background-image`]=`url("${String(i.config.COMMENT_BG_IMG)}")`)}function Ae(){le(),de(),pe()}return qm(()=>i.config.SHOW_EMOTION,()=>{ae()}),qm(()=>i.config.COMMENT_BG_IMG,()=>{ke()}),qm(()=>i.config.TURNSTILE_SITE_KEY,()=>{le()}),qm(()=>i.config.GEETEST_CAPTCHA_ID,()=>{de()}),qm(()=>i.config.CAP_API_ENDPOINT,()=>{pe()}),qm(ee,()=>{Ae()}),vh(()=>{i.pid&&y.value?.scrollIntoView({behavior:`instant`,block:`center`}),ie(),ne.value?.addEventListener(`paste`,Ce),ke(),Ae(),ae()}),Sh(()=>{ne.value?.removeEventListener(`paste`,Ce)}),(t,n)=>(Y(),X(`div`,{ref_key:`tkSubmitRef`,ref:y,class:`tk-submit tk-fade-in`},[Z(`div`,Iy,[Q(my,{config:e.config,mail:m.value,nick:p.value},null,8,[`config`,`mail`,`nick`]),Z(`div`,Ly,[Q(Ay,{nick:p.value,mail:m.value,link:h.value,config:e.config,onUpdate:he},null,8,[`nick`,`mail`,`link`,`config`]),Q(xy,{ref_key:`textareaRef`,ref:b,modelValue:d.value,"onUpdate:modelValue":n[0]||=e=>d.value=e,class:`tk-input`,type:`textarea`,placeholder:k.value,autosize:{minRows:3},maxlength:A.value,"show-word-limit":``,onInput:_e,onKeyup:be},null,8,[`modelValue`,`placeholder`,`maxlength`])])]),Z(`div`,Ry,[Z(`div`,zy,[$(` 表情按钮:首屏先渲染图标,随后由 OwO 面板以同样的 logo 接管容器内容 `),$(` 图标为构建期内联的 fontawesome 官方 SVG,非运行时用户数据 `),$(` eslint-disable vue/no-v-html `),Vm(Z(`div`,{ref_key:`owoRef`,ref:x,class:`tk-submit-action-icon OwO`,innerHTML:J(r)},null,8,By),[[rv,e.config.SHOW_EMOTION===`true`],[J(id),oe]]),$(` eslint-enable vue/no-v-html `),Vm(Z(`div`,{class:`tk-submit-action-icon`,onClick:xe},[Q(Zv,{name:`image-regular`})],512),[[rv,te.value]]),Z(`input`,{ref_key:`inputFileRef`,ref:S,class:`tk-input-image`,type:`file`,accept:`image/*`,value:``,onChange:Se},null,544)]),Z(`a`,Vy,[Q(Zv,{name:`markdown`})]),e.replyId?(Y(),o_(Ny,{key:0,class:`tk-cancel`,size:`small`,onClick:ge},{default:Bm(()=>[m_(K(J(W)(`SUBMIT_CANCEL`)),1)]),_:1})):$(`v-if`,!0),Q(Ny,{class:`tk-preview`,size:`small`,onClick:ve},{default:Bm(()=>[m_(K(J(W)(`SUBMIT_PREVIEW`)),1)]),_:1}),Q(Ny,{class:`tk-send`,type:`primary`,size:`small`,disabled:!O.value,onClick:ye},{default:Bm(()=>[m_(K(o.value?J(W)(`SUBMIT_SENDING`):J(W)(`SUBMIT_SEND`)),1)]),_:1},8,[`disabled`]),Vm(Z(`div`,{ref_key:`turnstileContainerRef`,ref:T,class:`tk-turnstile-container`},[Z(`div`,{ref_key:`turnstileRef`,ref:w,class:`tk-turnstile`},null,512)],512),[[rv,ee.value===`Turnstile`]]),Vm(Z(`div`,{ref_key:`geetestContainerRef`,ref:E,class:`tk-geetest-container`},null,512),[[rv,ee.value===`Geetest`]]),Vm(Z(`div`,{ref_key:`capContainerRef`,ref:D,class:`tk-cap-container`},null,512),[[rv,ee.value===`Cap`]])]),s.value?(Y(),X(`div`,Hy,[$(` 预览内容经 sanitizeHtml 消毒 `),$(` eslint-disable-next-line vue/no-v-html `),Z(`div`,{innerHTML:f.value},null,8,Uy)],512)):$(`v-if`,!0)],512))}}),Gy=Kp({serverConfig:{}});function Ky(e){Gy.serverConfig=e}function qy(){return Gy.serverConfig}var Jy=[`id`],Yy={class:`tk-main`},Xy={class:`tk-row`},Zy={class:`tk-meta`},Qy={key:0,class:`tk-nick`},$y=[`href`],eb={key:2,class:`tk-tag tk-tag-green`},tb={key:3,class:`tk-tag tk-tag-red`},nb={key:4,class:`tk-tag tk-tag-yellow`},rb={class:`tk-time`},ib=[`datetime`,`title`],ab={key:5,class:`tk-actions`},ob={key:0},sb=[`innerHTML`],cb={key:0,class:`tk-expand-wrap`},lb={key:1,class:`tk-collapse-wrap`},ub={key:2,class:`tk-extras`},db={key:0,class:`tk-extra`},fb={class:`tk-icon __comment`},pb={class:`tk-extra-text`},mb={key:1,class:`tk-extra`},hb={class:`tk-icon __comment`},gb={class:`tk-extra-text`},_b={key:2,class:`tk-extra`},vb={class:`tk-icon __comment`},yb={class:`tk-extra-text`},bb={key:4,class:`tk-expand-wrap`},xb={key:5,class:`tk-collapse-wrap`},Sb=rh({__name:`TkComment`,props:{comment:{},replyId:{default:``},replying:{type:Boolean,default:!1},config:{default:dy}},emits:[`reply`,`load`,`expand`,`refreshed`,`error`],setup(e,{emit:t}){let n=e,r=t,i={win:`windows`,mac:`apple`,ipad:`apple`,iphone:`apple`,ios:`apple`,android:`android`,ubuntu:`ubuntu`,linux:`linux`},a={edge:`edge`,chrome:`chrome`,firefox:`firefox-browser`,safari:`safari`,explorer:`internet-explorer`,ie:`internet-explorer`},o=q(``),s=q(n.comment.ups??0),c=q(n.comment.downs??0),l=q(n.comment.liked===!0),u=q(n.comment.disliked===!0),d=q(!1),f=q(!1),p=q(!1),m=q(!1),h=q(!1),g=q(!1),_=U_(()=>{let{tcb:e}=bo();return e?.auth?g.value:qy().IS_ADMIN===!0}),v=q(n.comment.isSpam===!0),y=q(n.comment.top===!0),b=q(!1),x=q(),S=q(),C=q(),w=q(),T=U_(()=>uc(n.comment.comment)),E=U_(()=>ud(n.comment.created)),D=U_(()=>new Date(n.comment.created??0).toJSON()),ee=U_(()=>new Date(n.comment.created??0).toLocaleString()),te=U_(()=>ae(n.comment.os??``,i)),O=U_(()=>ae(n.comment.browser??``,a)),k=U_(()=>p.value&&!f.value),A=U_(()=>p.value&&f.value),ne=U_(()=>h.value&&!m.value),re=U_(()=>h.value&&m.value),ie=U_(()=>ld(n.comment.link));function ae(e,t){let n=e.toLowerCase();for(let e of Object.keys(t))if(n.indexOf(e)!==-1)return t[e];return`window-maximize-regular`}function oe(){let e=w.value;n.comment.replies.length>0&&e&&(p.value=e.scrollHeight>236)}function se(){let e=S.value;e&&(h.value=h.value||e.scrollHeight>500)}function ce(){S.value?.querySelectorAll(`img`).forEach(e=>{e.onload=se})}function le(){window.location.hash.indexOf(n.comment.id)!==-1&&(x.value?.scrollIntoView({behavior:`smooth`}),r(`expand`))}function ue(e){document.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`center`})}async function de(){if(!d.value){d.value=!0;try{await Co(bo().tcb,`COMMENT_LIKE`,{id:n.comment.id,type:`up`}),l.value?s.value--:(s.value++,u.value&&c.value--),l.value=!l.value,u.value=!1}finally{d.value=!1}}}async function fe(){if(!d.value){d.value=!0;try{await Co(bo().tcb,`COMMENT_LIKE`,{id:n.comment.id,type:`down`}),u.value?c.value--:(c.value++,l.value&&s.value--),u.value=!u.value,l.value=!1}finally{d.value=!1}}}function pe(e){o.value=e,r(`reply`,n.comment.id)}async function me(){if(!confirm(W(`COMMENT_DELETE_CONFIRM`)))return;let e=await Co(bo().tcb,`COMMENT_DELETE_FOR_USER`,{id:n.comment.id}),t=e.result??e;t.code?alert(t.message):r(`load`)}function he(e){o.value=e,r(`reply`,e?n.comment.id:``)}function ge(){o.value=``,r(`reply`,``)}function _e(){o.value=``,r(`reply`,``),r(`load`),f.value=!0}function ve(){r(`refreshed`),Om(()=>{let e=w.value?.lastElementChild;n.comment.replies.length>0&&e&&e.scrollIntoView({behavior:`smooth`,block:`center`})})}async function j(){let{tcb:e}=bo();if(e?.auth){let t=await e.auth.getCurrentUser();g.value=t.loginType===`CUSTOM`}}function ye(e){Se({isSpam:e})}function be(e){Se({top:e})}function xe(e){if(qy().LIGHTBOX!==`true`)return;let t=e.target;if(t.tagName!==`IMG`||t.classList.contains(`tk-owo-emotion`))return;let n=document.createElement(`div`);n.className=`tk-lightbox`;let r=document.createElement(`img`);r.className=`tk-lightbox-image`,r.src=t.src,n.appendChild(r),n.addEventListener(`click`,()=>{document.body.removeChild(n)}),document.body.appendChild(n)}async function Se(e){b.value=!0;try{await Co(bo().tcb,`COMMENT_SET_FOR_ADMIN`,{id:n.comment.id,set:e}),e.isSpam!==void 0&&(v.value=e.isSpam),e.top!==void 0&&(y.value=e.top)}finally{b.value=!1}}function Ce(){let e=C.value;e&&(Td(e),Ed(e,bo().options.katex),n.config.HIGHLIGHT===`true`&&Tc(e,n.config.HIGHLIGHT_THEME,n.config.HIGHLIGHT_PLUGIN))}return qm(()=>n.comment.isSpam,e=>{v.value=e===!0}),qm(()=>n.comment.top,e=>{y.value=e===!0}),qm(()=>n.comment.ups,()=>{s.value=n.comment.ups??0,l.value=n.comment.liked===!0},{immediate:!0}),qm(()=>n.comment.downs,()=>{c.value=n.comment.downs??0,u.value=n.comment.disliked===!0},{immediate:!0}),qm(()=>n.config.HIGHLIGHT,e=>{e===`true`&&Om(Ce)},{immediate:!0}),vh(()=>{Om(se),Om(ce),Om(oe),Om(le),Om(Ce),j()}),(t,n)=>{let i=Oh(`TkComment`,!0);return Y(),X(`div`,{id:e.comment.id,ref_key:`tkCommentRef`,ref:x,class:xf([`tk-comment`,{"tk-master":e.comment.master}])},[Q(my,{config:e.config,nick:e.comment.nick,avatar:e.comment.avatar,"mail-md5":e.comment.mailMd5,link:ie.value},null,8,[`config`,`nick`,`avatar`,`mail-md5`,`link`]),Z(`div`,Yy,[Z(`div`,Xy,[Z(`div`,Zy,[ie.value?$(`v-if`,!0):(Y(),X(`strong`,Qy,K(e.comment.nick),1)),ie.value?(Y(),X(`a`,{key:1,class:`tk-nick tk-nick-link`,href:ie.value,target:`_blank`,rel:`noopener noreferrer nofollow ugc`},[Z(`strong`,null,K(e.comment.nick),1)],8,$y)):$(`v-if`,!0),e.comment.master?(Y(),X(`span`,eb,K(e.config.MASTER_TAG||J(W)(`COMMENT_MASTER_TAG`)),1)):$(`v-if`,!0),y.value?(Y(),X(`span`,tb,K(J(W)(`COMMENT_TOP_TAG`)),1)):$(`v-if`,!0),v.value?(Y(),X(`span`,nb,K(J(W)(`COMMENT_REVIEWING_TAG`)),1)):$(`v-if`,!0),Z(`small`,rb,[Z(`time`,{datetime:D.value,title:ee.value},K(E.value),9,ib)]),_.value?(Y(),X(`small`,ab,[v.value?(Y(),X(`button`,{key:0,onClick:n[0]||=e=>ye(!1)},K(J(W)(`ADMIN_COMMENT_SHOW`)),1)):$(`v-if`,!0),v.value?$(`v-if`,!0):(Y(),X(`button`,{key:1,onClick:n[1]||=e=>ye(!0)},K(J(W)(`ADMIN_COMMENT_HIDE`)),1)),!e.comment.rid&&y.value?(Y(),X(`button`,{key:2,onClick:n[2]||=e=>be(!1)},K(J(W)(`ADMIN_COMMENT_UNTOP`)),1)):$(`v-if`,!0),!e.comment.rid&&!y.value?(Y(),X(`button`,{key:3,onClick:n[3]||=e=>be(!0)},K(J(W)(`ADMIN_COMMENT_TOP`)),1)):$(`v-if`,!0)])):$(`v-if`,!0)]),Q(uy,{liked:l.value,disliked:u.value,"like-count":s.value,"dislike-count":c.value,"replies-count":e.comment.replies.length,"show-dislike":e.config.SHOW_DISLIKE!==`false`,"show-delete":e.comment.isOwner===!0,onLike:de,onDislike:fe,onReply:pe,onDelete:me},null,8,[`liked`,`disliked`,`like-count`,`dislike-count`,`replies-count`,`show-dislike`,`show-delete`])]),Z(`div`,{ref_key:`tkContentRef`,ref:S,class:xf([`tk-content`,{"tk-content-expand":m.value}])},[e.comment.pid?(Y(),X(`span`,ob,[m_(K(J(W)(`COMMENT_REPLIED`))+` `,1),Z(`a`,{class:`tk-ruser`,href:`#`,onClick:n[4]||=Bv(t=>ue(e.comment.pid),[`prevent`])},K(`@${e.comment.ruser}`),1),n[12]||=m_(` : `,-1)])):$(`v-if`,!0),$(` 正文:服务端已 DOMPurify 消毒,客户端再走一次 sanitizeHtml 双保险 `),$(` eslint-disable-next-line vue/no-v-html `),Z(`span`,{ref_key:`commentRef`,ref:C,onClick:xe,innerHTML:T.value},null,8,sb)],2),ne.value?(Y(),X(`div`,cb,[Z(`div`,{class:`tk-expand`,onClick:n[5]||=e=>m.value=!0},K(J(W)(`COMMENT_EXPAND`)),1)])):$(`v-if`,!0),re.value?(Y(),X(`div`,lb,[Z(`div`,{class:`tk-expand _collapse`,onClick:n[6]||=e=>m.value=!1},K(J(W)(`COMMENT_COLLAPSE`)),1)])):$(`v-if`,!0),e.comment.ipRegion||e.comment.os||e.comment.browser?(Y(),X(`div`,ub,[e.comment.ipRegion?(Y(),X(`div`,db,[Z(`span`,fb,[Q(Zv,{name:`location-arrow`})]),Z(`span`,pb,`\xA0`+K(e.comment.ipRegion),1)])):$(`v-if`,!0),e.comment.os?(Y(),X(`div`,mb,[Z(`span`,hb,[Q(Zv,{name:te.value},null,8,[`name`])]),Z(`span`,gb,`\xA0`+K(e.comment.os),1)])):$(`v-if`,!0),e.comment.browser?(Y(),X(`div`,_b,[Z(`span`,vb,[Q(Zv,{name:O.value},null,8,[`name`])]),Z(`span`,yb,`\xA0`+K(e.comment.browser),1)])):$(`v-if`,!0)])):$(`v-if`,!0),$(` 回复框(主楼被回复时挂载;楼中楼由子评论自身挂载) `),e.replying&&!o.value?(Y(),o_(Wy,{key:3,"reply-id":e.replyId?e.replyId:e.comment.id,pid:e.comment.id,config:e.config,onLoad:_e,onCancel:ge,onError:n[7]||=e=>r(`error`,e)},null,8,[`reply-id`,`pid`,`config`])):$(`v-if`,!0),$(` 回复列表 `),Z(`div`,{ref_key:`tkRepliesRef`,ref:w,class:xf([`tk-replies`,{"tk-replies-expand":f.value||!k.value||e.replying}])},[(Y(!0),X(Xg,null,Mh(e.comment.replies,t=>(Y(),o_(i,{key:t.id,comment:t,"reply-id":e.comment.id,replying:e.replying&&o.value===t.id,config:e.config,onExpand:n[8]||=e=>f.value=!0,onLoad:_e,onReply:he,onRefreshed:ve,onError:n[9]||=e=>r(`error`,e)},null,8,[`comment`,`reply-id`,`replying`,`config`]))),128))],2),k.value&&!e.replying?(Y(),X(`div`,bb,[Z(`div`,{class:`tk-expand`,onClick:n[10]||=e=>f.value=!0},K(J(W)(`COMMENT_EXPAND`)),1)])):$(`v-if`,!0),A.value&&!e.replying?(Y(),X(`div`,xb,[Z(`div`,{class:`tk-expand _collapse`,onClick:n[11]||=e=>f.value=!1},K(J(W)(`COMMENT_COLLAPSE`)),1)])):$(`v-if`,!0)])],10,Jy)}}}),Cb={class:`tk-error`},wb={class:`tk-error__icon`},Tb={class:`tk-error__body`},Eb={class:`tk-error__title`},Db={class:`tk-error__message`},Ob={class:`tk-error__detail`},kb={key:0,class:`tk-error__row`},Ab={key:1,class:`tk-error__row`},jb={key:2,class:`tk-error__raw`},Mb=rh({__name:`TkError`,props:{error:{}},setup(e){let t=e,n=q(!1),r={NETWORK:`无法连接到后端`,CORS:`请求被跨域策略拦截`,TIMEOUT:`请求超时`,REJECTED:`请求过于频繁`,NOT_FOUND:`接口地址不存在`,CLIENT_ERROR:`请求失败`,SERVER_ERROR:`后端异常`,UNKNOWN:`出现未知错误`},i=U_(()=>r[t.error.kind]??`出现错误`),a=U_(()=>{let e=t.error.rawMessage||t.error.message;return e.length>120?`${e.slice(0,120)}...`:e}),o=U_(()=>t.error.rawMessage||``),s=U_(()=>t.error.httpStatus),c=U_(()=>t.error.requestId);return(e,t)=>(Y(),X(`div`,Cb,[Z(`div`,wb,[Q(Zv,{name:`circle-exclamation`})]),Z(`div`,Tb,[Z(`div`,Eb,K(i.value),1),Z(`div`,Db,K(a.value),1),Z(`button`,{class:`tk-error__toggle`,type:`button`,onClick:t[0]||=e=>n.value=!n.value},K(n.value?`收起详情`:`展开详情`),1),Vm(Z(`div`,Ob,[s.value?(Y(),X(`div`,kb,`HTTP: `+K(s.value),1)):$(`v-if`,!0),c.value?(Y(),X(`div`,Ab,`Request ID: `+K(c.value),1)):$(`v-if`,!0),o.value?(Y(),X(`pre`,jb,K(o.value),1)):$(`v-if`,!0)],512),[[rv,n.value]])])]))}}),Nb={class:`tk-comments`},Pb={class:`tk-comments-container`},Fb={class:`tk-comments-title`},Ib={key:0},Lb={class:`tk-comments-actions`},Rb={key:0,class:`tk-comments-sort`},zb={class:`tk-comments-search`},Bb={key:1,class:`tk-comments-no`},Vb={key:0},Hb={key:1},Ub={key:2,class:`tk-expand-wrap`},Wb=rh({__name:`TkComments`,props:{showAdminEntry:{type:Boolean,default:!1}},emits:[`admin`,`refreshed`],setup(e,{emit:t}){let n=t,r=q(!0),i=q(!1),a=q(null),o=q({}),s=q([]),c=q(!0),l=q(0),u=q(``),d=q(1),f=q(`newest`),p=q(``),m=q(``),h=q(!1),g=q(0),_=q();async function v(){try{let e=await Co(bo().tcb,`GET_CONFIG`),t=e.result??e;t.config&&(o.value=t.config,Ky(t.config))}catch(e){To.warn(`加载公开配置失败`,e)}}async function y(){let e=++g.value;r.value=!0,a.value=null;let t={url:md(bo().options.path),sort:f.value,keyword:m.value};m.value&&(t.page=1),await k(t),e===g.value&&(r.value=!1)}function b(){s.value=[],d.value=1}function x(){let e=p.value.trim();p.value=e,m.value!==e&&(m.value=e,b(),y())}function S(){m.value&&(m.value=``,b(),y())}function C(){h.value=!h.value,h.value?setTimeout(()=>_.value?.focus(),0):(p.value=``,S())}function w(){b(),y()}async function T(){let e=++g.value;r.value=!0,a.value=null;try{let e=md(bo().options.path),t=d.value,n={url:e,sort:f.value,keyword:m.value};if(m.value&&(n.page=1),!await k(n))return;for(let n=2;n<=t&&await te(e,n);n++);}finally{e===g.value&&(r.value=!1)}e===g.value&&n(`refreshed`)}function E(e){f.value!==e&&(f.value=e,b(),y())}async function D(){if(!i.value){i.value=!0,d.value++;try{await te(md(bo().options.path),d.value)}finally{i.value=!1}}}function ee(){let e=1/0;for(let t of s.value)!t.top&&(t.created??1/0)<e&&(e=t.created??1/0);return e===1/0?void 0:e}async function te(e,t=d.value){if(m.value)return k({url:e,page:t,sort:f.value,keyword:m.value});let n=ee();return n!==void 0&&k({url:e,before:n,sort:f.value,keyword:m.value})}function O(){let e=bo().options.onCommentLoaded;typeof e==`function`&&e()}async function k(e){let t=g.value;try{let n=await Co(bo().tcb,`COMMENT_GET`,e);if(t!==g.value)return!1;let r=n.result??n;if(r?.message)return a.value=new _o(`CLIENT_ERROR`,r.message,{rawMessage:r.message}),!1;if(r?.data)return s.value=e.before||typeof e.page==`number`&&e.page>1?s.value.concat(r.data):r.data,c.value=r.more===!0,l.value=r.count??s.value.length,setTimeout(O,0),!0}catch(e){t===g.value&&(a.value=e instanceof _o?e:new _o(`UNKNOWN`,e.message,{rawMessage:e.message}))}return!1}function A(e){a.value=e}function ne(e){u.value=e}function re(){n(`admin`)}function ie(){v()}function ae(){T()}return vh(()=>{v(),y(),Ey(Cy,ie),Ey(Cy,ae)}),Sh(()=>{Dy(Cy,ie),Dy(Cy,ae)}),(t,n)=>(Y(),X(`div`,Nb,[Q(Wy,{config:o.value,onLoad:y,onError:A},null,8,[`config`]),Vm((Y(),X(`div`,Pb,[Z(`div`,Fb,[Z(`span`,{class:xf([`tk-comments-count`,{__hidden:r.value||!s.value.length&&!m.value}])},[m.value?(Y(),X(`span`,Ib,K(J(W)(`COMMENTS_SEARCH_COUNT_PREFIX`)),1)):$(`v-if`,!0),Z(`span`,null,K(l.value),1),Z(`span`,null,K(J(W)(`COMMENTS_COUNT_SUFFIX`)),1)],2),Z(`span`,Lb,[!r.value&&s.value.length&&o.value.SHOW_ORDER!==`false`?(Y(),X(`span`,Rb,[Z(`button`,{class:xf([`tk-sort-item`,{__active:f.value===`newest`}]),type:`button`,onClick:n[0]||=e=>E(`newest`)},K(J(W)(`COMMENTS_SORT_NEWEST`)),3),Z(`button`,{class:xf([`tk-sort-item`,{__active:f.value===`oldest`}]),type:`button`,onClick:n[1]||=e=>E(`oldest`)},K(J(W)(`COMMENTS_SORT_OLDEST`)),3),Z(`button`,{class:xf([`tk-sort-item`,{__active:f.value===`popular`}]),type:`button`,onClick:n[2]||=e=>E(`popular`)},K(J(W)(`COMMENTS_SORT_POPULAR`)),3)])):$(`v-if`,!0),!r.value&&!i.value?(Y(),X(`span`,{key:1,class:xf([`tk-icon __comments`,{__active:h.value}]),onClick:C},[Q(Zv,{name:`magnifying-glass`})],2)):$(`v-if`,!0),!r.value&&!i.value?(Y(),X(`span`,{key:2,class:`tk-icon __comments`,onClick:w},[Q(Zv,{name:`sync`})])):$(`v-if`,!0),e.showAdminEntry?(Y(),X(`span`,{key:3,class:`tk-icon __comments`,onClick:re},[Q(Zv,{name:`cog`})])):$(`v-if`,!0)])]),Vm(Z(`div`,zb,[Q(xy,{ref_key:`searchInputRef`,ref:_,modelValue:p.value,"onUpdate:modelValue":n[3]||=e=>p.value=e,size:`small`,clearable:``,maxlength:100,placeholder:J(W)(`COMMENTS_SEARCH_PLACEHOLDER`),onClear:S,onKeyup:Hv(x,[`enter`])},null,8,[`modelValue`,`placeholder`]),Q(Ny,{size:`small`,type:`primary`,onClick:x},{default:Bm(()=>[m_(K(J(W)(`COMMENTS_SEARCH`)),1)]),_:1})],512),[[rv,h.value]]),$(` 评论区唯一错误卡片:列表/提交/回复失败共用,位于空态块上方 `),a.value?(Y(),o_(Mb,{key:0,error:a.value},null,8,[`error`])):$(`v-if`,!0),!s.value.length&&!r.value&&!a.value?(Y(),X(`div`,Bb,[m.value?(Y(),X(`span`,Vb,K(J(W)(`COMMENTS_SEARCH_NO_RESULT`)),1)):$(`v-if`,!0),m.value?$(`v-if`,!0):(Y(),X(`span`,Hb,K(J(W)(`COMMENTS_NO_COMMENTS`)),1))])):$(`v-if`,!0),(Y(!0),X(Xg,null,Mh(s.value,e=>(Y(),o_(Sb,{key:e.id,comment:e,replying:u.value===e.id,config:o.value,onReply:ne,onLoad:T,onError:A},null,8,[`comment`,`replying`,`config`]))),128)),c.value&&!r.value&&!a.value?(Y(),X(`div`,Ub,[Vm((Y(),X(`div`,{class:`tk-expand`,onClick:D},[m_(K(J(W)(`COMMENTS_EXPAND`)),1)])),[[J(td),i.value]])])):$(`v-if`,!0)])),[[J(td),r.value]])]))}}),Gb={class:`tk-footer`},Kb=rh({__name:`TkFooter`,setup(e){let t=ho;return(e,n)=>(Y(),X(`div`,Gb,[n[0]||=m_(` Powered by `,-1),n[1]||=Z(`a`,{href:`https://twikoo.js.org`,target:`_blank`,rel:`noopener noreferrer`},`Twikoo`,-1),m_(` v`+K(J(t)),1)]))}}),qb={class:`tk-pagination`},Jb={key:0,class:`tk-pagination-options`},Yb={class:`tk-pagination-pagers`},Xb=[`onClick`],Zb={key:1,class:`tk-pagination-options`},Qb=rh({__name:`TkPagination`,props:{pageSize:{default:10},total:{default:0}},emits:[`current-change`,`page-size-change`],setup(e,{emit:t}){let n=e,r=t,i=q(1),a=q(0),o=q(0),s=q([]),c=U_(()=>Math.ceil(n.total/n.pageSize));function l(){let e=[];for(let t=1;t<=c.value;t++)Math.abs(i.value-t)<3||t===1||t===c.value?e.push({title:`${t}`,page:t}):Math.abs(i.value-t)<4&&e.push({title:`...`,page:t});s.value=e}function u(e){i.value=parseInt(String(e),10)||1,i.value>c.value&&(i.value=c.value),i.value<1&&(i.value=1),a.value=0,r(`current-change`,i.value),l()}function d(e){o.value=0,r(`page-size-change`,parseInt(String(e),10))}function f(e){a.value=parseInt(String(e),10)}function p(e){o.value=parseInt(String(e),10)}function m(){l()}return qm(()=>n.total,m,{immediate:!0}),qm(()=>n.pageSize,m),(t,n)=>(Y(),X(`div`,qb,[c.value?(Y(),X(`div`,Jb,[Z(`div`,null,[Z(`span`,null,K(J(W)(`PAGINATION_COUNT_PREFIX`)),1),Z(`span`,null,K(e.total),1),Z(`span`,null,K(J(W)(`PAGINATION_COUNT_SUFFIX`)),1)]),Q(xy,{class:`tk-pagination-size`,type:`number`,min:1,max:100,"model-value":o.value?o.value:e.pageSize,onInput:p,onChange:d},null,8,[`model-value`]),Z(`span`,null,K(J(W)(`PAGINATION_PAGESIZE`)),1)])):$(`v-if`,!0),Z(`div`,Yb,[(Y(!0),X(Xg,null,Mh(s.value,e=>(Y(),X(`div`,{key:e.page,class:xf([`tk-pagination-pager`,{__current:e.page===i.value}]),onClick:t=>u(e.page)},K(e.title),11,Xb))),128))]),c.value?(Y(),X(`div`,Zb,[Z(`span`,null,K(J(W)(`PAGINATION_GOTO_PREFIX`)),1),Q(xy,{class:`tk-pagination-goto`,type:`number`,min:1,max:c.value,"model-value":a.value?a.value:i.value,onInput:f,onChange:u},null,8,[`max`,`model-value`]),Z(`span`,null,K(J(W)(`PAGINATION_GOTO_SUFFIX`)),1)])):$(`v-if`,!0)]))}}),$b={class:`tk-admin-comment`},ex={key:0,class:`tk-admin-warn`},tx={class:`tk-admin-comment-filter`},nx={value:``},rx={value:`VISIBLE`},ix={value:`HIDDEN`},ax={class:`tk-admin-comment-meta`},ox={key:0},sx=[`href`],cx={key:2},lx=[`href`],ux={key:3},dx={class:`tk-time`},fx=[`title`],px=[`innerHTML`],mx={key:0,class:`tk-admin-warn tk-admin-security-alert`},hx={class:`tk-admin-security-alert-message`},gx={key:0,class:`tk-admin-security-alert-url`},_x={class:`tk-admin-actions`},vx=5,yx=rh({__name:`TkAdminComment`,setup(e){let t=qy().VERSION,n=q(!0),r=q([]),i=Kp({}),a=q(typeof t==`string`?t:``),o=ho,s=q(0),c=q(vx),l=q(1),u=Kp({keyword:``,type:``}),d=q(null),f=q();function p(e){return ud(e.created)}async function m(){n.value=!0;let e=await Co(bo().tcb,`COMMENT_GET_FOR_ADMIN`,{per:c.value,page:l.value,keyword:u.keyword,type:u.type}),t=e.result??e;t&&!t.code&&(s.value=t.count??0,r.value=(t.data??[]).map(e=>({...e,comment:uc(e.comment)}))),setTimeout(()=>{w(f.value)},0),n.value=!1}async function h(){let e=await Co(bo().tcb,`GET_CONFIG_FOR_ADMIN`),t=e.result??e;t&&!t.code&&t.config&&(Object.assign(i,t.config),a.value=typeof t.config.VERSION==`string`?t.config.VERSION:``,g())}function g(){i.HIGHLIGHT||=`true`;let e={},t=localStorage.getItem(`twikoo`);if(t)try{e=JSON.parse(t)}catch{e={}}for(let t of[`nick`,`mail`,`avatar`])i[t]=e[t]??``;!e.nick&&i.BLOGGER_NICK&&(e.nick=String(i.BLOGGER_NICK)),!e.mail&&i.BLOGGER_EMAIL&&(e.mail=String(i.BLOGGER_EMAIL)),!e.link&&i.SITE_URL&&(e.link=String(i.SITE_URL)),localStorage.setItem(`twikoo`,JSON.stringify(e))}function _(e){c.value=e,m()}function v(e){l.value=e,m()}function y(e){let t=`${e.url??``}#${e._id}`;try{if(new URL(t).hostname!==window.location.hostname){d.value={commentId:e._id,message:W(`ADMIN_COMMENT_SECURITY_ALERT`),url:t};return}window.open(t)}catch{try{new URL(t,window.location.origin),window.open(t)}catch{d.value={commentId:e._id,message:W(`ADMIN_COMMENT_PARSE_ERROR`),url:e.url}}}}async function b(e){confirm(W(`ADMIN_COMMENT_DELETE_CONFIRM`))&&(n.value=!0,await Co(bo().tcb,`COMMENT_DELETE_FOR_ADMIN`,{id:e._id}),await m(),n.value=!1)}function x(e,t){C(e,{isSpam:t})}function S(e,t){C(e,{top:t})}async function C(e,t){n.value=!0,await Co(bo().tcb,`COMMENT_SET_FOR_ADMIN`,{id:e._id,set:t}),await m(),n.value=!1}function w(e){e&&(Td(e),Ed(e,bo().options.katex),i.HIGHLIGHT===`true`&&Tc(e,i.HIGHLIGHT_THEME,i.HIGHLIGHT_PLUGIN))}return vh(async()=>{await Promise.all([h(),m()]),w(f.value)}),(e,t)=>Vm((Y(),X(`div`,$b,[J(o)===a.value?$(`v-if`,!0):(Y(),X(`div`,ex,[Z(`span`,null,K(J(W)(`ADMIN_CLIENT_VERSION`))+K(J(o))+`,`,1),Z(`span`,null,K(J(W)(`ADMIN_SERVER_VERSION`))+K(a.value)+`,`,1),$(`
|
|
242
242
|
用 prettier-ignore 保持单行:这一段的换行/缩进空白会被 Vue 3 的 condense 折叠成
|
|
243
243
|
一个空格(Vue 2 保留、HTML 同样折叠),与两侧的 叠加后会让「版本更新」
|
|
244
244
|
链接左右各宽约一个空格,而 1.x 只有 。所以必须让 与 <a> 紧贴。
|
|
245
|
-
`),$(` prettier-ignore `),t[3]||=Z(`span`,null,[m_(`请参考\xA0`),Z(`a`,{href:`https://twikoo.js.org/update.html`,target:`_blank`,rel:`noopener noreferrer`},`版本更新`),m_(`\xA0进行升级`)],-1)])),Z(`div`,tx,[Q(xy,{modelValue:u.keyword,"onUpdate:modelValue":t[0]||=e=>u.keyword=e,class:`tk-admin-comment-filter-keyword`,size:`small`,placeholder:J(W)(`ADMIN_COMMENT_SEARCH_PLACEHOLDER`),onKeyup:Hv(m,[`enter`])},null,8,[`modelValue`,`placeholder`]),Vm(Z(`select`,{"onUpdate:modelValue":t[1]||=e=>u.type=e,class:`tk-admin-comment-filter-type`},[Z(`option`,nx,K(J(W)(`ADMIN_COMMENT_FILTER_ALL`)),1),Z(`option`,rx,K(J(W)(`ADMIN_COMMENT_FILTER_VISIBLE`)),1),Z(`option`,ix,K(J(W)(`ADMIN_COMMENT_FILTER_HIDDEN`)),1)],512),[[Pv,u.type]]),Q(Ny,{size:`small`,type:`primary`,onClick:m},{default:Bm(()=>[m_(K(J(W)(`ADMIN_COMMENT_SEARCH`)),1)]),_:1})]),Z(`div`,{ref_key:`commentListRef`,ref:f,class:`tk-admin-comment-list`},[(Y(!0),X(Xg,null,Mh(r.value,e=>(Y(),X(`div`,{key:e.id,class:`tk-admin-comment-item`},[Z(`div`,ax,[Q(my,{config:i,avatar:e.avatar,nick:e.nick,mail:e.mail,link:e.link},null,8,[`config`,`avatar`,`nick`,`mail`,`link`]),e.link?$(`v-if`,!0):(Y(),X(`span`,ox,K(e.nick)+`\xA0`,1)),e.link?(Y(),X(`a`,{key:1,href:J(ld)(e.link),target:`_blank`,rel:`noopener noreferrer`},K(e.nick)+`\xA0 `,9,sx)):$(`v-if`,!0),e.mail?(Y(),X(`span`,cx,[t[4]||=m_(` (`,-1),Z(`a`,{href:`mailto:${e.mail}`},K(e.mail),9,lx),t[5]||=m_(`)\xA0 `,-1)])):$(`v-if`,!0),e.isSpam?(Y(),X(`span`,ux,K(J(W)(`ADMIN_COMMENT_IS_SPAM_SUFFIX`))+`\xA0`,1)):$(`v-if`,!0),Z(`span`,dx,K(p(e))+`\xA0`,1),Z(`span`,{title:e.ua},K(e.ipRegion),9,fx)]),$(` 管理端正文:服务端已消毒,客户端再走一次 sanitizeHtml 双保险 `),$(` eslint-disable-next-line vue/no-v-html `),Z(`div`,{class:`tk-content`,innerHTML:e.comment},null,8,px),d.value&&d.value.commentId===e.id?(Y(),X(`div`,mx,[Z(`a`,{class:`tk-admin-close`,href:`#`,onClick:t[2]||=Bv(e=>d.value=null,[`prevent`])},[Q(Zv,{name:`times`})]),Z(`div`,hx,K(d.value.message),1),d.value.url?(Y(),X(`div`,gx,[Z(`code`,null,K(d.value.url),1)])):$(`v-if`,!0)])):$(`v-if`,!0),Z(`div`,_x,[Q(Ny,{size:`mini`,type:`text`,onClick:t=>y(e)},{default:Bm(()=>[m_(K(J(W)(`ADMIN_COMMENT_VIEW`)),1)]),_:1},8,[`onClick`]),e.isSpam?(Y(),o_(Ny,{key:0,size:`mini`,type:`text`,onClick:t=>x(e,!1)},{default:Bm(()=>[m_(K(J(W)(`ADMIN_COMMENT_SHOW`)),1)]),_:1},8,[`onClick`])):$(`v-if`,!0),e.isSpam?$(`v-if`,!0):(Y(),o_(Ny,{key:1,size:`mini`,type:`text`,onClick:t=>x(e,!0)},{default:Bm(()=>[m_(K(J(W)(`ADMIN_COMMENT_HIDE`)),1)]),_:1},8,[`onClick`])),!e.rid&&e.top?(Y(),o_(Ny,{key:2,size:`mini`,type:`text`,onClick:t=>S(e,!1)},{default:Bm(()=>[m_(K(J(W)(`ADMIN_COMMENT_UNTOP`)),1)]),_:1},8,[`onClick`])):$(`v-if`,!0),!e.rid&&!e.top?(Y(),o_(Ny,{key:3,size:`mini`,type:`text`,onClick:t=>S(e,!0)},{default:Bm(()=>[m_(K(J(W)(`ADMIN_COMMENT_TOP`)),1)]),_:1},8,[`onClick`])):$(`v-if`,!0),Q(Ny,{size:`mini`,type:`text`,onClick:t=>b(e)},{default:Bm(()=>[m_(K(J(W)(`ADMIN_COMMENT_DELETE`)),1)]),_:1},8,[`onClick`])])]))),128))],512),Q(Qb,{"page-size":c.value,total:s.value,onPageSizeChange:_,onCurrentChange:v},null,8,[`page-size`,`total`])])),[[J(td),n.value]])}}),bx={class:`tk-admin-config`},xx={key:0,class:`tk-admin-warn`},Sx={class:`tk-admin-config-groups`},Cx={class:`tk-admin-config-group-title`},Tx=[`title`],Ex={class:`tk-admin-config-input`},Dx=[`onUpdate:modelValue`],Ox=[`value`],kx={class:`tk-admin-config-desc`},Ax={class:`tk-admin-config-group`},jx={class:`tk-admin-config-group-title`},Mx={class:`tk-admin-config-email-test`},Nx={class:`tk-admin-config-email-test-desc`},Px={class:`tk-admin-config-input`},Fx={class:`tk-admin-config-email-test-desc`},Ix={class:`tk-admin-config-actions`},Lx={class:`tk-admin-config-message`},Rx=rh({__name:`TkAdminConfig`,setup(e){function t(e){return Wc.includes(e(`IMAGE_CDN`))}function n(e){return!!e(`IMAGE_CDN`)&&e(`IMAGE_CDN`)!==`s3`}function r(e){return e(`IMAGE_CDN`)===`s3`}function i(e){return t=>t(`CAPTCHA_PROVIDER`)===e}let a=()=>W(`ADMIN_CONFIG_EXAMPLE`);function o(){return[{name:W(`ADMIN_CONFIG_CATEGORY_COMMON`),items:[{key:`SITE_NAME`,desc:W(`ADMIN_CONFIG_ITEM_SITE_NAME`),ph:`${a()}虹墨空间站`,value:``},{key:`SITE_URL`,desc:W(`ADMIN_CONFIG_ITEM_SITE_URL`),ph:`${a()}https://www.imaegoo.com`,value:``},{key:`CORS_ALLOW_ORIGIN`,desc:W(`ADMIN_CONFIG_ITEM_CORS_ALLOW_ORIGIN`),ph:`${a()}https://www.imaegoo.com`,value:``},{key:`BLOGGER_NICK`,desc:W(`ADMIN_CONFIG_ITEM_BLOGGER_NICK`),ph:`${a()}iMaeGoo`,value:``},{key:`BLOGGER_EMAIL`,desc:W(`ADMIN_CONFIG_ITEM_BLOGGER_EMAIL`),ph:`${a()}12345@qq.com`,value:``},{key:`COMMENT_PAGE_SIZE`,desc:W(`ADMIN_CONFIG_ITEM_COMMENT_PAGE_SIZE`),ph:`${a()}8`,value:``},{key:`MASTER_TAG`,desc:W(`ADMIN_CONFIG_ITEM_MASTER_TAG`),ph:`${a()}站长`,value:``},{key:`COMMENT_BG_IMG`,desc:W(`ADMIN_CONFIG_ITEM_COMMENT_BG_IMG`),ph:``,value:``},{key:`GRAVATAR_CDN`,desc:W(`ADMIN_CONFIG_ITEM_GRAVATAR_CDN`),ph:`${a()}sdn.geekzu.org`,value:``},{key:`DEFAULT_GRAVATAR`,desc:W(`ADMIN_CONFIG_ITEM_DEFAULT_GRAVATAR`),ph:`${a()}mp`,value:``},{key:`COMMENT_PLACEHOLDER`,desc:W(`ADMIN_CONFIG_ITEM_COMMENT_PLACEHOLDER`),ph:`${a()}`,value:``},{key:`SHOW_ORDER`,desc:W(`ADMIN_CONFIG_ITEM_SHOW_ORDER`),ph:`${a()}true`,value:``},{key:`SHOW_DISLIKE`,desc:W(`ADMIN_CONFIG_ITEM_SHOW_DISLIKE`),ph:`${a()}true`,value:``},{key:`DISPLAYED_FIELDS`,desc:W(`ADMIN_CONFIG_ITEM_DISPLAYED_FIELDS`),ph:`${a()}nick,mail,link`,value:``},{key:`REQUIRED_FIELDS`,desc:W(`ADMIN_CONFIG_ITEM_REQUIRED_FIELDS`),ph:`${a()}nick,mail,link`,value:``},{key:`HIDE_ADMIN_CRYPT`,desc:W(`ADMIN_CONFIG_ITEM_HIDE_ADMIN_CRYPT`),ph:`${a()}admin`,value:``},{key:`QQ_API_KEY`,desc:W(`ADMIN_CONFIG_ITEM_QQ_API_KEY`),ph:`${a()}your_api_key`,value:``}]},{name:W(`ADMIN_CONFIG_CATEGORY_PLUGIN`),items:[{key:`IMAGE_CDN`,desc:W(`ADMIN_CONFIG_ITEM_IMAGE_CDN`),ph:``,value:``,options:[{value:``,label:W(`ADMIN_CONFIG_IMAGE_CDN_NONE`)},{value:`qcloud`,label:`qcloud`},{value:`7bu`,label:`7bu (https://7bu.top)`},{value:`see`,label:`see (https://s.ee)`},{value:`lskypro`,label:`lskypro`},{value:`piclist`,label:`piclist`},{value:`easyimage`,label:`easyimage`},{value:`chevereto`,label:`chevereto`},{value:`s3`,label:`S3 / R2 / MinIO`}]},{key:`IMAGE_CDN_URL`,desc:W(`ADMIN_CONFIG_ITEM_IMAGE_CDN_URL`),ph:`${a()}https://piclist.example.com`,value:``,showIf:t},{key:`IMAGE_CDN_TOKEN`,desc:W(`ADMIN_CONFIG_ITEM_IMAGE_CDN_TOKEN`),ph:`${a()}example`,value:``,showIf:n},{key:`S3_REGION`,desc:W(`ADMIN_CONFIG_ITEM_S3_REGION`),ph:`${a()}us-east-1`,value:``,showIf:r},{key:`S3_BUCKET`,desc:W(`ADMIN_CONFIG_ITEM_S3_BUCKET`),ph:`${a()}my-bucket`,value:``,showIf:r},{key:`S3_ACCESS_KEY_ID`,desc:W(`ADMIN_CONFIG_ITEM_S3_ACCESS_KEY_ID`),ph:`${a()}AKIAIOSFODNN7EXAMPLE`,value:``,showIf:r},{key:`S3_SECRET_ACCESS_KEY`,desc:W(`ADMIN_CONFIG_ITEM_S3_SECRET_ACCESS_KEY`),ph:`${a()}wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY`,value:``,secret:!0,showIf:r},{key:`S3_ENDPOINT`,desc:W(`ADMIN_CONFIG_ITEM_S3_ENDPOINT`),ph:`${a()}https://xxx.r2.cloudflarestorage.com`,value:``,showIf:r},{key:`S3_FORCE_PATH_STYLE`,desc:W(`ADMIN_CONFIG_ITEM_S3_FORCE_PATH_STYLE`),ph:`${a()}true`,value:``,showIf:r},{key:`S3_CDN_URL`,desc:W(`ADMIN_CONFIG_ITEM_S3_CDN_URL`),ph:`${a()}https://cdn.example.com`,value:``,showIf:r},{key:`S3_PATH_PREFIX`,desc:W(`ADMIN_CONFIG_ITEM_S3_PATH_PREFIX`),ph:`${a()}images/twikoo`,value:``,showIf:r},{key:`NSFW_API_URL`,desc:W(`ADMIN_CONFIG_ITEM_NSFW_API_URL`),ph:`${a()}https://nsfw.example.com`,value:``},{key:`NSFW_THRESHOLD`,desc:W(`ADMIN_CONFIG_ITEM_NSFW_THRESHOLD`),ph:`${a()}0.5`,value:``},{key:`SHOW_EMOTION`,desc:W(`ADMIN_CONFIG_ITEM_SHOW_EMOTION`),ph:`${a()}false`,value:``},{key:`EMOTION_CDN`,desc:W(`ADMIN_CONFIG_ITEM_EMOTION_CDN`),ph:``,value:``},{key:`HIGHLIGHT`,desc:W(`ADMIN_CONFIG_ITEM_HIGHLIGHT`),ph:`${a()}false`,value:``},{key:`HIGHLIGHT_THEME`,desc:W(`ADMIN_CONFIG_ITEM_HIGHLIGHT_THEME`),ph:`${a()}tomorrow`,value:``},{key:`HIGHLIGHT_PLUGIN`,desc:W(`ADMIN_CONFIG_ITEM_HIGHLIGHT_PLUGIN`),ph:`${a()}showLanguage`,value:``},{key:`LIGHTBOX`,desc:W(`ADMIN_CONFIG_ITEM_LIGHTBOX`),ph:`${a()}true`,value:``}]},{name:W(`ADMIN_CONFIG_CATEGORY_PRIVACY`),items:[{key:`SHOW_UA`,desc:W(`ADMIN_CONFIG_ITEM_SHOW_UA`),ph:`${a()}false`,value:``},{key:`SHOW_REGION`,desc:W(`ADMIN_CONFIG_ITEM_SHOW_REGION`),ph:`${a()}true`,value:``}]},{name:W(`ADMIN_CONFIG_CATEGORY_SPAM`),items:[{key:`AKISMET_KEY`,desc:W(`ADMIN_CONFIG_ITEM_AKISMET_KEY`),ph:`${a()}8651783edxxx`,value:``},{key:`QCLOUD_SECRET_ID`,desc:W(`ADMIN_CONFIG_ITEM_QCLOUD_SECRET_ID`),ph:`${a()}AKI******************************IHw`,value:``},{key:`QCLOUD_SECRET_KEY`,desc:W(`ADMIN_CONFIG_ITEM_QCLOUD_SECRET_KEY`),ph:`${a()}Xrk**************************3D7`,value:``,secret:!0},{key:`QCLOUD_CMS_BIZTYPE`,desc:W(`ADMIN_CONFIG_ITEM_QCLOUD_CMS_BIZTYPE`),ph:`${a()}1787728329856520192`,value:``},{key:`LIMIT_PER_MINUTE`,desc:W(`ADMIN_CONFIG_ITEM_LIMIT_PER_MINUTE`),ph:`${a()}5`,value:``},{key:`LIMIT_PER_MINUTE_ALL`,desc:W(`ADMIN_CONFIG_ITEM_LIMIT_PER_MINUTE_ALL`),ph:`${a()}5`,value:``},{key:`LIMIT_LENGTH`,desc:W(`ADMIN_CONFIG_ITEM_LIMIT_LENGTH`),ph:`${a()}100`,value:``},{key:`FORBIDDEN_WORDS`,desc:W(`ADMIN_CONFIG_ITEM_FORBIDDEN_WORDS`),ph:`${a()}快递,空包`,value:``},{key:`BLOCKED_WORDS`,desc:W(`ADMIN_CONFIG_ITEM_BLOCKED_WORDS`),ph:`${a()}快递,空包`,value:``},{key:`NOTIFY_SPAM`,desc:W(`ADMIN_CONFIG_ITEM_NOTIFY_SPAM`),ph:`${a()}false`,value:``},{key:`HIDE_SPAM`,desc:W(`ADMIN_CONFIG_ITEM_HIDE_SPAM`),ph:`${a()}true`,value:``},{key:`LLM_API_KEY`,desc:W(`ADMIN_CONFIG_ITEM_LLM_API_KEY`),ph:`sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`,value:``,secret:!0},{key:`LLM_API_ENDPOINT`,desc:W(`ADMIN_CONFIG_ITEM_LLM_API_ENDPOINT`),ph:`https://api.deepseek.com/v1`,value:``},{key:`LLM_MODEL`,desc:W(`ADMIN_CONFIG_ITEM_LLM_MODEL`),ph:`deepseek-v4-pro`,value:``},{key:`LLM_SPAM_PROMPT`,desc:W(`ADMIN_CONFIG_ITEM_LLM_SPAM_PROMPT`),ph:``,value:``,type:`textarea`},{key:`LLM_MAX_RETRIES`,desc:W(`ADMIN_CONFIG_ITEM_LLM_MAX_RETRIES`),ph:`3`,value:``}]},{name:W(`ADMIN_CONFIG_CATEGORY_CAPTCHA`),items:[{key:`CAPTCHA_PROVIDER`,desc:W(`ADMIN_CONFIG_ITEM_CAPTCHA_PROVIDER`),ph:``,value:``,options:[{value:``,label:W(`ADMIN_CONFIG_CAPTCHA_NONE`)},{value:`Turnstile`,label:W(`ADMIN_CONFIG_CAPTCHA_TURNSTILE`)},{value:`Geetest`,label:W(`ADMIN_CONFIG_CAPTCHA_GEETEST`)},{value:`Cap`,label:W(`ADMIN_CONFIG_CAPTCHA_CAP`)}]},{key:`TURNSTILE_SITE_KEY`,desc:W(`ADMIN_CONFIG_ITEM_TURNSTILE_SITE_KEY`),ph:`${a()}0x4AAAAAAAPLTtpBr_T12345`,value:``,showIf:i(`Turnstile`)},{key:`TURNSTILE_SECRET_KEY`,desc:W(`ADMIN_CONFIG_ITEM_TURNSTILE_SECRET_KEY`),ph:`${a()}0x4AAAAAAAPLTmBm6gHmOnOqC1iwmU12345`,value:``,secret:!0,showIf:i(`Turnstile`)},{key:`GEETEST_CAPTCHA_ID`,desc:W(`ADMIN_CONFIG_ITEM_GEETEST_CAPTCHA_ID`),ph:`${a()}your_captcha_id`,value:``,showIf:i(`Geetest`)},{key:`GEETEST_CAPTCHA_KEY`,desc:W(`ADMIN_CONFIG_ITEM_GEETEST_CAPTCHA_KEY`),ph:`${a()}your_captcha_key`,value:``,secret:!0,showIf:i(`Geetest`)},{key:`CAP_API_ENDPOINT`,desc:W(`ADMIN_CONFIG_ITEM_CAP_API_ENDPOINT`),ph:`${a()}https://cap.example.com/d9256640cb53/(留空=内嵌,无需外部服务)`,value:``,showIf:i(`Cap`)},{key:`CAP_SECRET_KEY`,desc:W(`ADMIN_CONFIG_ITEM_CAP_SECRET_KEY`),ph:`${a()}仅外部 Cap 需要;内嵌模式可留空`,value:``,secret:!0,showIf:i(`Cap`)}]},{name:W(`ADMIN_CONFIG_CATEGORY_IM`),items:[{key:`PUSHOO_CHANNEL`,desc:W(`ADMIN_CONFIG_ITEM_PUSHOO_CHANNEL`),ph:`${a()}pushdeer`,value:``},{key:`PUSHOO_TOKEN`,desc:W(`ADMIN_CONFIG_ITEM_PUSHOO_TOKEN`),ph:`${a()}PDU431TfFHZICvR6lJrFBswSRN1cJ*****zzFvR`,value:``},{key:`SC_MAIL_NOTIFY`,desc:W(`ADMIN_CONFIG_ITEM_SC_MAIL_NOTIFY`),ph:`${a()}true`,value:``}]},{name:W(`ADMIN_CONFIG_CATEGORY_MAIL`),items:[{key:`SENDER_EMAIL`,desc:W(`ADMIN_CONFIG_ITEM_SENDER_EMAIL`),ph:`${a()}blog@imaegoo.com`,value:``},{key:`SENDER_NAME`,desc:W(`ADMIN_CONFIG_ITEM_SENDER_NAME`),ph:`${a()}虹墨空间站评论提醒`,value:``},{key:`SMTP_SERVICE`,desc:W(`ADMIN_CONFIG_ITEM_SMTP_SERVICE`),ph:`${a()}QQ`,value:``},{key:`SMTP_HOST`,desc:W(`ADMIN_CONFIG_ITEM_SMTP_HOST`),ph:`${a()}smtp.qq.com`,value:``},{key:`SMTP_PORT`,desc:W(`ADMIN_CONFIG_ITEM_SMTP_PORT`),ph:`${a()}465`,value:``},{key:`SMTP_SECURE`,desc:W(`ADMIN_CONFIG_ITEM_SMTP_SECURE`),ph:`${a()}true`,value:``},{key:`SMTP_USER`,desc:W(`ADMIN_CONFIG_ITEM_SMTP_USER`),ph:`${a()}blog@imaegoo.com`,value:``},{key:`SMTP_PASS`,desc:W(`ADMIN_CONFIG_ITEM_SMTP_PASS`),ph:`${a()}password`,value:``,secret:!0},{key:`MAIL_SUBJECT`,desc:W(`ADMIN_CONFIG_ITEM_MAIL_SUBJECT`),ph:`${a()}您在虹墨空间站上的评论收到了回复`,value:``},{key:`MAIL_TEMPLATE`,desc:W(`ADMIN_CONFIG_ITEM_MAIL_TEMPLATE`),ph:``,value:``,type:`textarea`},{key:`MAIL_SUBJECT_ADMIN`,desc:W(`ADMIN_CONFIG_ITEM_MAIL_SUBJECT_ADMIN`),ph:`${a()}虹墨空间站上有新评论了`,value:``},{key:`MAIL_TEMPLATE_ADMIN`,desc:W(`ADMIN_CONFIG_ITEM_MAIL_TEMPLATE_ADMIN`),ph:``,value:``,type:`textarea`}]}]}let s=Kp(o()),c=q(!0),l=Kp({}),u=q(``),d=ho,f=q(``),p=q(``),m=q(``);async function h(){c.value=!0;let e=await Co(bo().tcb,`GET_CONFIG_FOR_ADMIN`),t=e.result??e;t&&!t.code&&t.config&&(Object.assign(l,t.config),u.value=String(t.config.VERSION??``),l.CAPTCHA_PROVIDER===void 0&&(l.TURNSTILE_SITE_KEY?l.CAPTCHA_PROVIDER=`Turnstile`:l.GEETEST_CAPTCHA_ID&&(l.CAPTCHA_PROVIDER=`Geetest`)),l.IMAGE_CDN===void 0&&(l.IMAGE_CDN=``),g()),c.value=!1}function g(){for(let e of s)for(let t of e.items){let e=l[t.key];t.value=e===void 0?``:String(e)}}function _(e){return typeof e.showIf!=`function`||e.showIf(e=>{for(let t of s){let n=t.items.find(t=>t.key===e);if(n)return n.value}return``})}async function v(){c.value=!0,f.value=`正在保存`;let e={};for(let t of s)for(let n of t.items){let t=l[n.key];String(t??``)!==n.value&&(e[n.key]=n.value)}e.IMAGE_CDN!==void 0&&(e.SHOW_IMAGE=e.IMAGE_CDN?`true`:`false`),To.info(`保存配置`,e),await Co(bo().tcb,`SET_CONFIG`,{config:e}),await h(),Oy(Cy),f.value=`保存成功`,c.value=!1}async function y(){c.value=!0;let e=await Co(bo().tcb,`EMAIL_TEST`,{mail:p.value});To.info(`邮件测试`,e),m.value=JSON.stringify(e),c.value=!1}return vh(()=>{h()}),(e,t)=>Vm((Y(),X(`div`,bx,[J(d)===u.value?$(`v-if`,!0):(Y(),X(`div`,xx,[Z(`span`,null,K(J(W)(`ADMIN_CLIENT_VERSION`))+K(J(d))+`,`,1),Z(`span`,null,K(J(W)(`ADMIN_SERVER_VERSION`))+K(u.value)+`,`,1),$(`
|
|
245
|
+
`),$(` prettier-ignore `),t[3]||=Z(`span`,null,[m_(`请参考\xA0`),Z(`a`,{href:`https://twikoo.js.org/update.html`,target:`_blank`,rel:`noopener noreferrer`},`版本更新`),m_(`\xA0进行升级`)],-1)])),Z(`div`,tx,[Q(xy,{modelValue:u.keyword,"onUpdate:modelValue":t[0]||=e=>u.keyword=e,class:`tk-admin-comment-filter-keyword`,size:`small`,placeholder:J(W)(`ADMIN_COMMENT_SEARCH_PLACEHOLDER`),onKeyup:Hv(m,[`enter`])},null,8,[`modelValue`,`placeholder`]),Vm(Z(`select`,{"onUpdate:modelValue":t[1]||=e=>u.type=e,class:`tk-admin-comment-filter-type`},[Z(`option`,nx,K(J(W)(`ADMIN_COMMENT_FILTER_ALL`)),1),Z(`option`,rx,K(J(W)(`ADMIN_COMMENT_FILTER_VISIBLE`)),1),Z(`option`,ix,K(J(W)(`ADMIN_COMMENT_FILTER_HIDDEN`)),1)],512),[[Pv,u.type]]),Q(Ny,{size:`small`,type:`primary`,onClick:m},{default:Bm(()=>[m_(K(J(W)(`ADMIN_COMMENT_SEARCH`)),1)]),_:1})]),Z(`div`,{ref_key:`commentListRef`,ref:f,class:`tk-admin-comment-list`},[(Y(!0),X(Xg,null,Mh(r.value,e=>(Y(),X(`div`,{key:e._id,class:`tk-admin-comment-item`},[Z(`div`,ax,[Q(my,{config:i,avatar:e.avatar,nick:e.nick,mail:e.mail,link:e.link},null,8,[`config`,`avatar`,`nick`,`mail`,`link`]),e.link?$(`v-if`,!0):(Y(),X(`span`,ox,K(e.nick)+`\xA0`,1)),e.link?(Y(),X(`a`,{key:1,href:J(ld)(e.link),target:`_blank`,rel:`noopener noreferrer`},K(e.nick)+`\xA0 `,9,sx)):$(`v-if`,!0),e.mail?(Y(),X(`span`,cx,[t[4]||=m_(` (`,-1),Z(`a`,{href:`mailto:${e.mail}`},K(e.mail),9,lx),t[5]||=m_(`)\xA0 `,-1)])):$(`v-if`,!0),e.isSpam?(Y(),X(`span`,ux,K(J(W)(`ADMIN_COMMENT_IS_SPAM_SUFFIX`))+`\xA0`,1)):$(`v-if`,!0),Z(`span`,dx,K(p(e))+`\xA0`,1),Z(`span`,{title:e.ua},K(e.ipRegion),9,fx)]),$(` 管理端正文:服务端已消毒,客户端再走一次 sanitizeHtml 双保险 `),$(` eslint-disable-next-line vue/no-v-html `),Z(`div`,{class:`tk-content`,innerHTML:e.comment},null,8,px),d.value&&d.value.commentId===e._id?(Y(),X(`div`,mx,[Z(`a`,{class:`tk-admin-close`,href:`#`,onClick:t[2]||=Bv(e=>d.value=null,[`prevent`])},[Q(Zv,{name:`times`})]),Z(`div`,hx,K(d.value.message),1),d.value.url?(Y(),X(`div`,gx,[Z(`code`,null,K(d.value.url),1)])):$(`v-if`,!0)])):$(`v-if`,!0),Z(`div`,_x,[Q(Ny,{size:`mini`,type:`text`,onClick:t=>y(e)},{default:Bm(()=>[m_(K(J(W)(`ADMIN_COMMENT_VIEW`)),1)]),_:1},8,[`onClick`]),e.isSpam?(Y(),o_(Ny,{key:0,size:`mini`,type:`text`,onClick:t=>x(e,!1)},{default:Bm(()=>[m_(K(J(W)(`ADMIN_COMMENT_SHOW`)),1)]),_:1},8,[`onClick`])):$(`v-if`,!0),e.isSpam?$(`v-if`,!0):(Y(),o_(Ny,{key:1,size:`mini`,type:`text`,onClick:t=>x(e,!0)},{default:Bm(()=>[m_(K(J(W)(`ADMIN_COMMENT_HIDE`)),1)]),_:1},8,[`onClick`])),!e.rid&&e.top?(Y(),o_(Ny,{key:2,size:`mini`,type:`text`,onClick:t=>S(e,!1)},{default:Bm(()=>[m_(K(J(W)(`ADMIN_COMMENT_UNTOP`)),1)]),_:1},8,[`onClick`])):$(`v-if`,!0),!e.rid&&!e.top?(Y(),o_(Ny,{key:3,size:`mini`,type:`text`,onClick:t=>S(e,!0)},{default:Bm(()=>[m_(K(J(W)(`ADMIN_COMMENT_TOP`)),1)]),_:1},8,[`onClick`])):$(`v-if`,!0),Q(Ny,{size:`mini`,type:`text`,onClick:t=>b(e)},{default:Bm(()=>[m_(K(J(W)(`ADMIN_COMMENT_DELETE`)),1)]),_:1},8,[`onClick`])])]))),128))],512),Q(Qb,{"page-size":c.value,total:s.value,onPageSizeChange:_,onCurrentChange:v},null,8,[`page-size`,`total`])])),[[J(td),n.value]])}}),bx={class:`tk-admin-config`},xx={key:0,class:`tk-admin-warn`},Sx={class:`tk-admin-config-groups`},Cx={class:`tk-admin-config-group-title`},Tx=[`title`],Ex={class:`tk-admin-config-input`},Dx=[`onUpdate:modelValue`],Ox=[`value`],kx={class:`tk-admin-config-desc`},Ax={class:`tk-admin-config-group`},jx={class:`tk-admin-config-group-title`},Mx={class:`tk-admin-config-email-test`},Nx={class:`tk-admin-config-email-test-desc`},Px={class:`tk-admin-config-input`},Fx={class:`tk-admin-config-email-test-desc`},Ix={class:`tk-admin-config-actions`},Lx={class:`tk-admin-config-message`},Rx=rh({__name:`TkAdminConfig`,setup(e){function t(e){return Wc.includes(e(`IMAGE_CDN`))}function n(e){return!!e(`IMAGE_CDN`)&&e(`IMAGE_CDN`)!==`s3`}function r(e){return e(`IMAGE_CDN`)===`s3`}function i(e){return t=>t(`CAPTCHA_PROVIDER`)===e}let a=()=>W(`ADMIN_CONFIG_EXAMPLE`);function o(){return[{name:W(`ADMIN_CONFIG_CATEGORY_COMMON`),items:[{key:`SITE_NAME`,desc:W(`ADMIN_CONFIG_ITEM_SITE_NAME`),ph:`${a()}虹墨空间站`,value:``},{key:`SITE_URL`,desc:W(`ADMIN_CONFIG_ITEM_SITE_URL`),ph:`${a()}https://www.imaegoo.com`,value:``},{key:`CORS_ALLOW_ORIGIN`,desc:W(`ADMIN_CONFIG_ITEM_CORS_ALLOW_ORIGIN`),ph:`${a()}https://www.imaegoo.com`,value:``},{key:`BLOGGER_NICK`,desc:W(`ADMIN_CONFIG_ITEM_BLOGGER_NICK`),ph:`${a()}iMaeGoo`,value:``},{key:`BLOGGER_EMAIL`,desc:W(`ADMIN_CONFIG_ITEM_BLOGGER_EMAIL`),ph:`${a()}12345@qq.com`,value:``},{key:`COMMENT_PAGE_SIZE`,desc:W(`ADMIN_CONFIG_ITEM_COMMENT_PAGE_SIZE`),ph:`${a()}8`,value:``},{key:`MASTER_TAG`,desc:W(`ADMIN_CONFIG_ITEM_MASTER_TAG`),ph:`${a()}站长`,value:``},{key:`COMMENT_BG_IMG`,desc:W(`ADMIN_CONFIG_ITEM_COMMENT_BG_IMG`),ph:``,value:``},{key:`GRAVATAR_CDN`,desc:W(`ADMIN_CONFIG_ITEM_GRAVATAR_CDN`),ph:`${a()}sdn.geekzu.org`,value:``},{key:`DEFAULT_GRAVATAR`,desc:W(`ADMIN_CONFIG_ITEM_DEFAULT_GRAVATAR`),ph:`${a()}mp`,value:``},{key:`COMMENT_PLACEHOLDER`,desc:W(`ADMIN_CONFIG_ITEM_COMMENT_PLACEHOLDER`),ph:`${a()}`,value:``},{key:`SHOW_ORDER`,desc:W(`ADMIN_CONFIG_ITEM_SHOW_ORDER`),ph:`${a()}true`,value:``},{key:`SHOW_DISLIKE`,desc:W(`ADMIN_CONFIG_ITEM_SHOW_DISLIKE`),ph:`${a()}true`,value:``},{key:`DISPLAYED_FIELDS`,desc:W(`ADMIN_CONFIG_ITEM_DISPLAYED_FIELDS`),ph:`${a()}nick,mail,link`,value:``},{key:`REQUIRED_FIELDS`,desc:W(`ADMIN_CONFIG_ITEM_REQUIRED_FIELDS`),ph:`${a()}nick,mail,link`,value:``},{key:`HIDE_ADMIN_CRYPT`,desc:W(`ADMIN_CONFIG_ITEM_HIDE_ADMIN_CRYPT`),ph:`${a()}admin`,value:``},{key:`QQ_API_KEY`,desc:W(`ADMIN_CONFIG_ITEM_QQ_API_KEY`),ph:`${a()}your_api_key`,value:``}]},{name:W(`ADMIN_CONFIG_CATEGORY_PLUGIN`),items:[{key:`IMAGE_CDN`,desc:W(`ADMIN_CONFIG_ITEM_IMAGE_CDN`),ph:``,value:``,options:[{value:``,label:W(`ADMIN_CONFIG_IMAGE_CDN_NONE`)},{value:`qcloud`,label:`qcloud`},{value:`7bu`,label:`7bu (https://7bu.top)`},{value:`see`,label:`see (https://s.ee)`},{value:`lskypro`,label:`lskypro`},{value:`piclist`,label:`piclist`},{value:`easyimage`,label:`easyimage`},{value:`chevereto`,label:`chevereto`},{value:`s3`,label:`S3 / R2 / MinIO`}]},{key:`IMAGE_CDN_URL`,desc:W(`ADMIN_CONFIG_ITEM_IMAGE_CDN_URL`),ph:`${a()}https://piclist.example.com`,value:``,showIf:t},{key:`IMAGE_CDN_TOKEN`,desc:W(`ADMIN_CONFIG_ITEM_IMAGE_CDN_TOKEN`),ph:`${a()}example`,value:``,showIf:n},{key:`S3_REGION`,desc:W(`ADMIN_CONFIG_ITEM_S3_REGION`),ph:`${a()}us-east-1`,value:``,showIf:r},{key:`S3_BUCKET`,desc:W(`ADMIN_CONFIG_ITEM_S3_BUCKET`),ph:`${a()}my-bucket`,value:``,showIf:r},{key:`S3_ACCESS_KEY_ID`,desc:W(`ADMIN_CONFIG_ITEM_S3_ACCESS_KEY_ID`),ph:`${a()}AKIA****************`,value:``,showIf:r},{key:`S3_SECRET_ACCESS_KEY`,desc:W(`ADMIN_CONFIG_ITEM_S3_SECRET_ACCESS_KEY`),ph:`${a()}wJal********************************EKEY`,value:``,secret:!0,showIf:r},{key:`S3_ENDPOINT`,desc:W(`ADMIN_CONFIG_ITEM_S3_ENDPOINT`),ph:`${a()}https://xxx.r2.cloudflarestorage.com`,value:``,showIf:r},{key:`S3_FORCE_PATH_STYLE`,desc:W(`ADMIN_CONFIG_ITEM_S3_FORCE_PATH_STYLE`),ph:`${a()}true`,value:``,showIf:r},{key:`S3_CDN_URL`,desc:W(`ADMIN_CONFIG_ITEM_S3_CDN_URL`),ph:`${a()}https://cdn.example.com`,value:``,showIf:r},{key:`S3_PATH_PREFIX`,desc:W(`ADMIN_CONFIG_ITEM_S3_PATH_PREFIX`),ph:`${a()}images/twikoo`,value:``,showIf:r},{key:`NSFW_API_URL`,desc:W(`ADMIN_CONFIG_ITEM_NSFW_API_URL`),ph:`${a()}https://nsfw.example.com`,value:``},{key:`NSFW_THRESHOLD`,desc:W(`ADMIN_CONFIG_ITEM_NSFW_THRESHOLD`),ph:`${a()}0.5`,value:``},{key:`SHOW_EMOTION`,desc:W(`ADMIN_CONFIG_ITEM_SHOW_EMOTION`),ph:`${a()}false`,value:``},{key:`EMOTION_CDN`,desc:W(`ADMIN_CONFIG_ITEM_EMOTION_CDN`),ph:``,value:``},{key:`HIGHLIGHT`,desc:W(`ADMIN_CONFIG_ITEM_HIGHLIGHT`),ph:`${a()}false`,value:``},{key:`HIGHLIGHT_THEME`,desc:W(`ADMIN_CONFIG_ITEM_HIGHLIGHT_THEME`),ph:`${a()}tomorrow`,value:``},{key:`HIGHLIGHT_PLUGIN`,desc:W(`ADMIN_CONFIG_ITEM_HIGHLIGHT_PLUGIN`),ph:`${a()}showLanguage`,value:``},{key:`LIGHTBOX`,desc:W(`ADMIN_CONFIG_ITEM_LIGHTBOX`),ph:`${a()}true`,value:``}]},{name:W(`ADMIN_CONFIG_CATEGORY_PRIVACY`),items:[{key:`SHOW_UA`,desc:W(`ADMIN_CONFIG_ITEM_SHOW_UA`),ph:`${a()}false`,value:``},{key:`SHOW_REGION`,desc:W(`ADMIN_CONFIG_ITEM_SHOW_REGION`),ph:`${a()}true`,value:``}]},{name:W(`ADMIN_CONFIG_CATEGORY_SPAM`),items:[{key:`AKISMET_KEY`,desc:W(`ADMIN_CONFIG_ITEM_AKISMET_KEY`),ph:`${a()}8651783edxxx`,value:``},{key:`QCLOUD_SECRET_ID`,desc:W(`ADMIN_CONFIG_ITEM_QCLOUD_SECRET_ID`),ph:`${a()}AKI******************************IHw`,value:``},{key:`QCLOUD_SECRET_KEY`,desc:W(`ADMIN_CONFIG_ITEM_QCLOUD_SECRET_KEY`),ph:`${a()}Xrk**************************3D7`,value:``,secret:!0},{key:`QCLOUD_CMS_BIZTYPE`,desc:W(`ADMIN_CONFIG_ITEM_QCLOUD_CMS_BIZTYPE`),ph:`${a()}1787728329856520192`,value:``},{key:`LIMIT_PER_MINUTE`,desc:W(`ADMIN_CONFIG_ITEM_LIMIT_PER_MINUTE`),ph:`${a()}5`,value:``},{key:`LIMIT_PER_MINUTE_ALL`,desc:W(`ADMIN_CONFIG_ITEM_LIMIT_PER_MINUTE_ALL`),ph:`${a()}5`,value:``},{key:`LIMIT_LENGTH`,desc:W(`ADMIN_CONFIG_ITEM_LIMIT_LENGTH`),ph:`${a()}100`,value:``},{key:`FORBIDDEN_WORDS`,desc:W(`ADMIN_CONFIG_ITEM_FORBIDDEN_WORDS`),ph:`${a()}快递,空包`,value:``},{key:`BLOCKED_WORDS`,desc:W(`ADMIN_CONFIG_ITEM_BLOCKED_WORDS`),ph:`${a()}快递,空包`,value:``},{key:`NOTIFY_SPAM`,desc:W(`ADMIN_CONFIG_ITEM_NOTIFY_SPAM`),ph:`${a()}false`,value:``},{key:`HIDE_SPAM`,desc:W(`ADMIN_CONFIG_ITEM_HIDE_SPAM`),ph:`${a()}true`,value:``},{key:`LLM_API_KEY`,desc:W(`ADMIN_CONFIG_ITEM_LLM_API_KEY`),ph:`sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`,value:``,secret:!0},{key:`LLM_API_ENDPOINT`,desc:W(`ADMIN_CONFIG_ITEM_LLM_API_ENDPOINT`),ph:`https://api.deepseek.com/v1`,value:``},{key:`LLM_MODEL`,desc:W(`ADMIN_CONFIG_ITEM_LLM_MODEL`),ph:`deepseek-v4-pro`,value:``},{key:`LLM_SPAM_PROMPT`,desc:W(`ADMIN_CONFIG_ITEM_LLM_SPAM_PROMPT`),ph:``,value:``,type:`textarea`},{key:`LLM_MAX_RETRIES`,desc:W(`ADMIN_CONFIG_ITEM_LLM_MAX_RETRIES`),ph:`3`,value:``}]},{name:W(`ADMIN_CONFIG_CATEGORY_CAPTCHA`),items:[{key:`CAPTCHA_PROVIDER`,desc:W(`ADMIN_CONFIG_ITEM_CAPTCHA_PROVIDER`),ph:``,value:``,options:[{value:``,label:W(`ADMIN_CONFIG_CAPTCHA_NONE`)},{value:`Turnstile`,label:W(`ADMIN_CONFIG_CAPTCHA_TURNSTILE`)},{value:`Geetest`,label:W(`ADMIN_CONFIG_CAPTCHA_GEETEST`)},{value:`Cap`,label:W(`ADMIN_CONFIG_CAPTCHA_CAP`)}]},{key:`TURNSTILE_SITE_KEY`,desc:W(`ADMIN_CONFIG_ITEM_TURNSTILE_SITE_KEY`),ph:`${a()}0x4AAAAAAAPLTtpBr_T12345`,value:``,showIf:i(`Turnstile`)},{key:`TURNSTILE_SECRET_KEY`,desc:W(`ADMIN_CONFIG_ITEM_TURNSTILE_SECRET_KEY`),ph:`${a()}0x4AAAAAAAPLTmBm6gHmOnOqC1iwmU12345`,value:``,secret:!0,showIf:i(`Turnstile`)},{key:`GEETEST_CAPTCHA_ID`,desc:W(`ADMIN_CONFIG_ITEM_GEETEST_CAPTCHA_ID`),ph:`${a()}your_captcha_id`,value:``,showIf:i(`Geetest`)},{key:`GEETEST_CAPTCHA_KEY`,desc:W(`ADMIN_CONFIG_ITEM_GEETEST_CAPTCHA_KEY`),ph:`${a()}your_captcha_key`,value:``,secret:!0,showIf:i(`Geetest`)},{key:`CAP_API_ENDPOINT`,desc:W(`ADMIN_CONFIG_ITEM_CAP_API_ENDPOINT`),ph:`${a()}https://cap.example.com/d9256640cb53/(留空=内嵌,无需外部服务)`,value:``,showIf:i(`Cap`)},{key:`CAP_SECRET_KEY`,desc:W(`ADMIN_CONFIG_ITEM_CAP_SECRET_KEY`),ph:`${a()}仅外部 Cap 需要;内嵌模式可留空`,value:``,secret:!0,showIf:i(`Cap`)}]},{name:W(`ADMIN_CONFIG_CATEGORY_IM`),items:[{key:`PUSHOO_CHANNEL`,desc:W(`ADMIN_CONFIG_ITEM_PUSHOO_CHANNEL`),ph:`${a()}pushdeer`,value:``},{key:`PUSHOO_TOKEN`,desc:W(`ADMIN_CONFIG_ITEM_PUSHOO_TOKEN`),ph:`${a()}PDU431TfFHZICvR6lJrFBswSRN1cJ*****zzFvR`,value:``},{key:`SC_MAIL_NOTIFY`,desc:W(`ADMIN_CONFIG_ITEM_SC_MAIL_NOTIFY`),ph:`${a()}true`,value:``}]},{name:W(`ADMIN_CONFIG_CATEGORY_MAIL`),items:[{key:`SENDER_EMAIL`,desc:W(`ADMIN_CONFIG_ITEM_SENDER_EMAIL`),ph:`${a()}blog@imaegoo.com`,value:``},{key:`SENDER_NAME`,desc:W(`ADMIN_CONFIG_ITEM_SENDER_NAME`),ph:`${a()}虹墨空间站评论提醒`,value:``},{key:`SMTP_SERVICE`,desc:W(`ADMIN_CONFIG_ITEM_SMTP_SERVICE`),ph:`${a()}QQ`,value:``},{key:`SMTP_HOST`,desc:W(`ADMIN_CONFIG_ITEM_SMTP_HOST`),ph:`${a()}smtp.qq.com`,value:``},{key:`SMTP_PORT`,desc:W(`ADMIN_CONFIG_ITEM_SMTP_PORT`),ph:`${a()}465`,value:``},{key:`SMTP_SECURE`,desc:W(`ADMIN_CONFIG_ITEM_SMTP_SECURE`),ph:`${a()}true`,value:``},{key:`SMTP_USER`,desc:W(`ADMIN_CONFIG_ITEM_SMTP_USER`),ph:`${a()}blog@imaegoo.com`,value:``},{key:`SMTP_PASS`,desc:W(`ADMIN_CONFIG_ITEM_SMTP_PASS`),ph:`${a()}password`,value:``,secret:!0},{key:`MAIL_SUBJECT`,desc:W(`ADMIN_CONFIG_ITEM_MAIL_SUBJECT`),ph:`${a()}您在虹墨空间站上的评论收到了回复`,value:``},{key:`MAIL_TEMPLATE`,desc:W(`ADMIN_CONFIG_ITEM_MAIL_TEMPLATE`),ph:``,value:``,type:`textarea`},{key:`MAIL_SUBJECT_ADMIN`,desc:W(`ADMIN_CONFIG_ITEM_MAIL_SUBJECT_ADMIN`),ph:`${a()}虹墨空间站上有新评论了`,value:``},{key:`MAIL_TEMPLATE_ADMIN`,desc:W(`ADMIN_CONFIG_ITEM_MAIL_TEMPLATE_ADMIN`),ph:``,value:``,type:`textarea`}]}]}let s=Kp(o()),c=q(!0),l=Kp({}),u=q(``),d=ho,f=q(``),p=q(``),m=q(``);async function h(){c.value=!0;let e=await Co(bo().tcb,`GET_CONFIG_FOR_ADMIN`),t=e.result??e;t&&!t.code&&t.config&&(Object.assign(l,t.config),u.value=String(t.config.VERSION??``),l.CAPTCHA_PROVIDER===void 0&&(l.TURNSTILE_SITE_KEY?l.CAPTCHA_PROVIDER=`Turnstile`:l.GEETEST_CAPTCHA_ID&&(l.CAPTCHA_PROVIDER=`Geetest`)),l.IMAGE_CDN===void 0&&(l.IMAGE_CDN=``),g()),c.value=!1}function g(){for(let e of s)for(let t of e.items){let e=l[t.key];t.value=e===void 0?``:String(e)}}function _(e){return typeof e.showIf!=`function`||e.showIf(e=>{for(let t of s){let n=t.items.find(t=>t.key===e);if(n)return n.value}return``})}async function v(){c.value=!0,f.value=`正在保存`;let e={};for(let t of s)for(let n of t.items){let t=l[n.key];String(t??``)!==n.value&&(e[n.key]=n.value)}e.IMAGE_CDN!==void 0&&(e.SHOW_IMAGE=e.IMAGE_CDN?`true`:`false`),To.info(`保存配置`,e),await Co(bo().tcb,`SET_CONFIG`,{config:e}),await h(),Oy(Cy),f.value=`保存成功`,c.value=!1}async function y(){c.value=!0;let e=await Co(bo().tcb,`EMAIL_TEST`,{mail:p.value});To.info(`邮件测试`,e),m.value=JSON.stringify(e),c.value=!1}function b(){h()}return vh(()=>{h(),Ey(Cy,b)}),Sh(()=>{Dy(Cy,b)}),(e,t)=>Vm((Y(),X(`div`,bx,[J(d)===u.value?$(`v-if`,!0):(Y(),X(`div`,xx,[Z(`span`,null,K(J(W)(`ADMIN_CLIENT_VERSION`))+K(J(d))+`,`,1),Z(`span`,null,K(J(W)(`ADMIN_SERVER_VERSION`))+K(u.value)+`,`,1),$(`
|
|
246
246
|
用 prettier-ignore 保持单行:这一段的换行/缩进空白会被 Vue 3 的 condense 折叠成
|
|
247
247
|
一个空格(Vue 2 保留、HTML 同样折叠),与两侧的 叠加后会让「版本更新」
|
|
248
248
|
链接左右各宽约一个空格,而 1.x 只有 。所以必须让 与 <a> 紧贴。
|
|
249
|
-
`),$(` prettier-ignore `),t[1]||=Z(`span`,null,[m_(`请参考\xA0`),Z(`a`,{href:`https://twikoo.js.org/update.html`,target:`_blank`,rel:`noopener noreferrer`},`版本更新`),m_(`\xA0进行升级`)],-1)])),Z(`form`,{onSubmit:Bv(v,[`prevent`])},[Z(`div`,Sx,[(Y(!0),X(Xg,null,Mh(s,e=>(Y(),X(`details`,{key:e.name,class:`tk-admin-config-group`},[Z(`summary`,Cx,K(e.name),1),(Y(!0),X(Xg,null,Mh(e.items,e=>Vm((Y(),X(`div`,{key:e.key,class:`tk-admin-config-item`},[Z(`div`,{class:`tk-admin-config-title`,title:e.key},K(e.key),9,Tx),Z(`div`,Ex,[e.options?Vm((Y(),X(`select`,{key:0,"onUpdate:modelValue":t=>e.value=t,class:`tk-admin-config-select`},[(Y(!0),X(Xg,null,Mh(e.options,e=>(Y(),X(`option`,{key:e.value,value:e.value},K(e.label),9,Ox))),128))],8,Dx)),[[Pv,e.value]]):e.type===`textarea`?(Y(),o_(xy,{key:1,modelValue:e.value,"onUpdate:modelValue":t=>e.value=t,type:`textarea`,rows:5,size:`small`,placeholder:e.ph},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(Y(),o_(xy,{key:2,modelValue:e.value,"onUpdate:modelValue":t=>e.value=t,type:e.secret?`password`:`text`,size:`small`,placeholder:e.ph},null,8,[`modelValue`,`onUpdate:modelValue`,`type`,`placeholder`]))]),t[2]||=Z(`div`,null,null,-1),Z(`div`,kx,K(e.desc),1)])),[[rv,_(e)]])),128))]))),128)),Z(`details`,Ax,[Z(`summary`,jx,K(J(W)(`ADMIN_CONFIG_EMAIL_TEST`)),1),Z(`div`,Mx,[Z(`div`,Nx,K(J(W)(`ADMIN_CONFIG_EMAIL_TEST_HELP`)),1),Z(`div`,Px,[Q(xy,{modelValue:p.value,"onUpdate:modelValue":t[0]||=e=>p.value=e,size:`small`},{append:Bm(()=>[Q(Ny,{type:`info`,onClick:y},{default:Bm(()=>[m_(K(J(W)(`ADMIN_CONFIG_EMAIL_TEST_BTN`)),1)]),_:1})]),_:1},8,[`modelValue`])]),Z(`div`,Fx,K(J(W)(`ADMIN_CONFIG_EMAIL_TEST_RESULT`))+K(m.value),1)])])]),Z(`div`,Ix,[Q(Ny,{size:`small`,type:`primary`,"native-type":`submit`},{default:Bm(()=>[m_(K(J(W)(`ADMIN_CONFIG_SAVE`)),1)]),_:1}),Q(Ny,{size:`small`,type:`info`,onClick:g},{default:Bm(()=>[m_(K(J(W)(`ADMIN_CONFIG_RESET`)),1)]),_:1})])],32),Z(`div`,Lx,K(f.value),1)])),[[J(td),c.value]])}}),zx={class:`tk-admin-import`},Bx={class:`tk-admin-warn tk-admin-import-warn`},Vx={class:`tk-admin-import-label`},Hx={disabled:``,value:``},Ux={class:`tk-admin-import-label`},Wx=rh({__name:`TkAdminImport`,setup(e){let t=q(!1),n=q(``),r=q(``),i=Kp({valine:W(`ADMIN_IMPORT_TIP_VALINE`),disqus:W(`ADMIN_IMPORT_TIP_DISQUS`),artalk:W(`ADMIN_IMPORT_TIP_ARTALK`),artalk2:``,twikoo:``}),a=q(),o=q();function s(e){r.value+=`${new Date().toLocaleString()} ${e}\n`,Om(()=>{let e=o.value?.inputEl;e&&(e.scrollTop=e.scrollHeight)})}async function c(){if(!n.value){s(W(`ADMIN_IMPORT_SOURCE_REQUIRED`));return}let e=a.value?.files?.[0];if(!e){s(W(`ADMIN_IMPORT_FILE_REQUIRED`));return}s(W(`ADMIN_IMPORT_START`)),t.value=!0;try{let t=bo().tcb;if(t){let n=await t.app.uploadFile({cloudPath:`import/${Date.now()}`,filePath:e,onUploadProgress:e=>{let t=Math.round(e.loaded*100/e.total);s(`${W(`ADMIN_IMPORT_UPLOADING`)}${t}%`)}});s(`${W(`ADMIN_IMPORT_UPLOADED`)}${n.fileID}`),await l(String(n.fileID))}else await u(e)}catch(e){console.error(e),s(e.message)}t.value=!1}async function l(e){s(`${W(`ADMIN_IMPORT_IMPORTING`)}${n.value}`);let t=await Co(bo().tcb,`COMMENT_IMPORT_FOR_ADMIN`,{fileId:e,source:n.value}),i=t.result??t;r.value+=i.log??``,s(`${W(`ADMIN_IMPORT_IMPORTED`)}${n.value}`)}async function u(e){s(`${W(`ADMIN_IMPORT_IMPORTING`)}${n.value}`);let t=await Co(bo().tcb,`COMMENT_IMPORT_FOR_ADMIN`,{file:await Sd(e),source:n.value}),i=t.result??t;r.value+=i.log??``,s(`${W(`ADMIN_IMPORT_IMPORTED`)}${n.value}`)}return(e,s)=>(Y(),X(`div`,zx,[Z(`div`,Bx,[Z(`p`,null,K(J(W)(`ADMIN_IMPORT_WARN`)),1),Z(`p`,null,K(i[n.value]),1)]),Z(`div`,Vx,K(J(W)(`ADMIN_IMPORT_SELECT_SOURCE`)),1),Vm(Z(`select`,{"onUpdate:modelValue":s[0]||=e=>n.value=e},[Z(`option`,Hx,K(J(W)(`ADMIN_IMPORT_SELECT`)),1),s[2]||=h_(`<option value="valine">Valine (JSON)</option><option value="disqus">Disqus (XML)</option><option value="artalk">Artalk v1 (JSON)</option><option value="artalk2">Artalk v2 (Artrans)</option><option value="twikoo">Twikoo (JSON)</option>`,5)],512),[[Pv,n.value]]),Z(`div`,Ux,K(J(W)(`ADMIN_IMPORT_SELECT_FILE`)),1),Z(`input`,{ref_key:`inputFileRef`,ref:a,type:`file`,value:``},null,512),Q(Ny,{size:`small`,disabled:t.value,onClick:c},{default:Bm(()=>[m_(K(J(W)(`ADMIN_IMPORT_START`)),1)]),_:1},8,[`disabled`]),Q(xy,{ref_key:`logTextAreaRef`,ref:o,modelValue:r.value,"onUpdate:modelValue":s[1]||=e=>r.value=e,type:`textarea`,rows:10,readonly:``,placeholder:J(W)(`ADMIN_IMPORT_LOG`)},null,8,[`modelValue`,`placeholder`])]))}}),Gx={class:`tk-admin-export`},Kx={class:`tk-admin-warn tk-admin-import-warn`},qx=rh({__name:`TkAdminExport`,setup(e){let t=q(!1);async function n(e){t.value=!0;try{let t=await Co(bo().tcb,`COMMENT_EXPORT_FOR_ADMIN`,{collection:e}),n=t.result??t;n.data&&r(`twikoo-${e}.json`,n.data)}finally{t.value=!1}}function r(e,t){let n=t instanceof Object?JSON.stringify(t,null,2):String(t),r=new Blob([n]),i=document.createElementNS(`http://www.w3.org/1999/xhtml`,`a`);i.href=URL.createObjectURL(r),i.download=e,i.click()}return(e,r)=>(Y(),X(`div`,Gx,[Z(`div`,Kx,[Z(`p`,null,K(J(W)(`ADMIN_EXPORT_WARN`)),1)]),Q(Ny,{size:`small`,disabled:t.value,onClick:r[0]||=e=>n(`comment`)},{default:Bm(()=>[m_(K(J(W)(`ADMIN_EXPORT_COMMENT`)),1)]),_:1},8,[`disabled`]),Q(Ny,{size:`small`,disabled:t.value,onClick:r[1]||=e=>n(`counter`)},{default:Bm(()=>[m_(K(J(W)(`ADMIN_EXPORT_COUNTER`)),1)]),_:1},8,[`disabled`])]))}}),Jx={class:`tk-admin-container`},Yx={key:0,class:`tk-login-title`},Xx={key:1},Zx={key:0,class:`tk-login`},Qx={class:`tk-login-title`},$x={key:0,class:`tk-login-msg`},eS={href:`https://twikoo.js.org/faq.html`,rel:`noopener noreferrer`,target:`_blank`},tS={key:1,class:`tk-regist`},nS={class:`tk-login-title`},rS={key:0,class:`tk-login-msg`},iS={key:1,class:`tk-login-msg`},aS={href:`https://twikoo.js.org/faq.html`,rel:`noopener noreferrer`,target:`_blank`},oS={key:2,class:`tk-panel`},sS={class:`tk-panel-title`},cS={class:`tk-tabs`},lS=rh({__name:`TkAdmin`,props:{show:{type:Boolean,default:!1}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,i=q(!0),a=q(``),o=q(!1),s=q(!1),c=q(!0),l=q(!1),u=q(``),d=q(``),f=q(``),p=q(``),m=q(`comment`),h=q(),g=U_(()=>!c.value&&!!d.value&&d.value===f.value&&(l.value||!!u.value));async function _(){if(!d.value){p.value=W(`ADMIN_PASSWORD_REQUIRED`);return}i.value=!0,p.value=``;let e=(0,Ec.default)(d.value),t=bo().tcb,n=await Co(t,`LOGIN`,{password:e}),r=n.result??n;if(r.message)p.value=r.message;else if(r.ticket)try{await t?.auth?.customAuthProvider().signIn(r.ticket),To.info(`登录成功`),d.value=``,await S()}catch(e){To.error(`登录失败`,e)}else r.code===0&&(To.info(`登录成功`),localStorage.setItem(`twikoo-access-token`,e),d.value=``,await S());i.value=!1}async function v(e){e.preventDefault(),i.value=!0;let t=bo().tcb;t?.auth?(await t.auth.signOut(),await t.auth.anonymousAuthProvider().signIn()):localStorage.removeItem(`twikoo-access-token`),s.value=!1,i.value=!1}async function y(){i.value=!0;let e=(0,Ec.default)(d.value),t=await Co(bo().tcb,`SET_PASSWORD`,{password:e,credentials:u.value}),n=t.result??t;n.code?(p.value=W(`ADMIN_REGIST_FAILED`),n.message&&(p.value+=`,${n.message}`),To.warn(`Twikoo 注册失败`,t)):(c.value=!0,await _()),i.value=!1}async function b(){i.value=!0,await S(),s.value||(await C(),x()),i.value=!1}function x(){setTimeout(()=>h.value?.focus(),500)}async function S(){let e=bo().tcb;if(e?.auth){let t=await e.auth.getCurrentUser();s.value=t.loginType===`CUSTOM`}else{let t=await Co(e,`GET_CONFIG`),n=t.result??t;s.value=n?.config?.IS_ADMIN===!0}}async function C(){try{let e=await Co(bo().tcb,`GET_PASSWORD_STATUS`),t=e.result??e;a.value=t.version??``,c.value=t.status===!0,l.value=!bo().tcb}catch(e){throw o.value=!0,i.value=!1,e}}function w(){r(`close`)}return qm(()=>n.show,e=>{e&&b()}),(t,n)=>(Y(),X(`div`,Jx,[Vm((Y(),X(`div`,{class:xf([`tk-admin`,{__show:e.show}])},[Z(`button`,{class:`tk-admin-close`,onClick:w},[Q(Zv,{name:`times`})]),o.value?(Y(),X(`div`,Yx,[Z(`div`,null,K(J(W)(`ADMIN_NEED_UPDATE`)),1),n[10]||=Z(`a`,{href:`https://twikoo.js.org/update.html`,target:`_blank`,rel:`noopener noreferrer`},` https://twikoo.js.org/update.html `,-1)])):(Y(),X(`div`,Xx,[!s.value&&c.value?(Y(),X(`div`,Zx,[Z(`div`,Qx,K(J(W)(`ADMIN_LOGIN_TITLE`)),1),Z(`form`,{onSubmit:n[1]||=Bv(()=>{},[`prevent`])},[n[11]||=Z(`input`,{type:`hidden`},null,-1),Q(xy,{ref_key:`focusmeRef`,ref:h,modelValue:d.value,"onUpdate:modelValue":n[0]||=e=>d.value=e,class:`tk-password`,type:`password`,placeholder:J(W)(`ADMIN_PASSWORD_PLACEHOLDER`),onKeyup:Hv(_,[`enter`])},{prepend:Bm(()=>[m_(K(J(W)(`ADMIN_PASSWORD`)),1)]),append:Bm(()=>[Q(Ny,{onClick:_},{default:Bm(()=>[m_(K(J(W)(`ADMIN_LOGIN`)),1)]),_:1})]),_:1},8,[`modelValue`,`placeholder`])],32),p.value?(Y(),X(`div`,$x,[m_(K(p.value)+` `,1),Z(`a`,eS,K(J(W)(`ADMIN_FORGOT`)),1)])):$(`v-if`,!0)])):$(`v-if`,!0),!s.value&&!c.value?(Y(),X(`div`,tS,[Z(`div`,nS,K(J(W)(`ADMIN_LOGIN_TITLE`)),1),Z(`form`,{onSubmit:n[5]||=Bv(()=>{},[`prevent`])},[l.value?$(`v-if`,!0):(Y(),o_(xy,{key:0,ref_key:`focusmeRef`,ref:h,modelValue:u.value,"onUpdate:modelValue":n[2]||=e=>u.value=e,class:`tk-password`,placeholder:J(W)(`ADMIN_CREDENTIALS_PLACEHOLDER`)},{prepend:Bm(()=>[m_(K(J(W)(`ADMIN_CREDENTIALS`)),1)]),_:1},8,[`modelValue`,`placeholder`])),Q(xy,{modelValue:d.value,"onUpdate:modelValue":n[3]||=e=>d.value=e,class:`tk-password`,type:`password`,placeholder:J(W)(`ADMIN_SET_PASSWORD_PLACEHOLDER`)},{prepend:Bm(()=>[m_(K(J(W)(`ADMIN_SET_PASSWORD`)),1)]),_:1},8,[`modelValue`,`placeholder`]),Q(xy,{modelValue:f.value,"onUpdate:modelValue":n[4]||=e=>f.value=e,class:`tk-password`,type:`password`,placeholder:J(W)(`ADMIN_SET_PASSWORD_CONFIRM_PLACEHOLDER`)},{prepend:Bm(()=>[m_(K(J(W)(`ADMIN_SET_PASSWORD_CONFIRM`)),1)]),_:1},8,[`modelValue`,`placeholder`])],32),Q(Ny,{class:`tk-regist-button`,disabled:!g.value,onClick:y},{default:Bm(()=>[m_(K(J(W)(`ADMIN_REGIST`)),1)]),_:1},8,[`disabled`]),p.value?(Y(),X(`div`,rS,K(p.value),1)):$(`v-if`,!0),l.value?$(`v-if`,!0):(Y(),X(`div`,iS,[Z(`a`,aS,K(J(W)(`ADMIN_CREDENTIALS_FAQ`)),1)]))])):$(`v-if`,!0),s.value?(Y(),X(`div`,oS,[Z(`div`,sS,[Z(`div`,null,K(J(W)(`ADMIN_TITLE`)),1),Z(`a`,{class:`tk-panel-logout`,href:`#`,onClick:Bv(v,[`prevent`])},K(J(W)(`ADMIN_LOGOUT`)),1)]),Z(`div`,cS,[Z(`div`,{class:xf([`tk-tab`,{__active:m.value===`comment`}]),onClick:n[6]||=e=>m.value=`comment`},K(J(W)(`ADMIN_COMMENT`)),3),Z(`div`,{class:xf([`tk-tab`,{__active:m.value===`config`}]),onClick:n[7]||=e=>m.value=`config`},K(J(W)(`ADMIN_CONFIG`)),3),Z(`div`,{class:xf([`tk-tab`,{__active:m.value===`import`}]),onClick:n[8]||=e=>m.value=`import`},K(J(W)(`ADMIN_IMPORT`)),3),Z(`div`,{class:xf([`tk-tab`,{__active:m.value===`export`}]),onClick:n[9]||=e=>m.value=`export`},K(J(W)(`ADMIN_EXPORT`)),3)]),Vm(Q(yx,null,null,512),[[rv,m.value===`comment`]]),Vm(Q(Rx,null,null,512),[[rv,m.value===`config`]]),Vm(Q(Wx,null,null,512),[[rv,m.value===`import`]]),Vm(Q(qx,null,null,512),[[rv,m.value===`export`]])])):$(`v-if`,!0)]))],2)),[[J(td),i.value]])]))}}),uS={id:`twikoo`,class:`twikoo`},dS=rh({__name:`App`,setup(e){let t=q(!1),n=q(!1);function r(e){n.value=e===!0}return vh(()=>{Ey(Ty,r)}),Sh(()=>{Dy(Ty,r)}),(e,r)=>(Y(),X(`div`,uS,[Q(Wb,{"show-admin-entry":n.value,onAdmin:r[0]||=e=>t.value=!0},null,8,[`show-admin-entry`]),Q(Kb),Q(lS,{show:t.value,onClose:r[1]||=e=>t.value=!1},null,8,[`show`])]))}}),fS=null;function pS(e,t={}){return fS&&=(fS.unmount(),null),fS=Kv(dS),fS.config.globalProperties.$tcb=e,fS.config.globalProperties.$twikoo=t,yo(e,t),fS.mount(t.el||`#twikoo`),fS}var mS=()=>globalThis.cloudbase;function hS(e){mS=e}async function gS(e){if(ad(e.envId))return null;let t=mS();return t===void 0?(To.error(`Please import cloudbase firstly:
|
|
250
|
-
<script src="https://imgcache.qq.com/qcloud/cloudbase-js-sdk/1.3.3/cloudbase.full.js"><\/script>`),null):await kd(t,e)}async function
|
|
249
|
+
`),$(` prettier-ignore `),t[1]||=Z(`span`,null,[m_(`请参考\xA0`),Z(`a`,{href:`https://twikoo.js.org/update.html`,target:`_blank`,rel:`noopener noreferrer`},`版本更新`),m_(`\xA0进行升级`)],-1)])),Z(`form`,{onSubmit:Bv(v,[`prevent`])},[Z(`div`,Sx,[(Y(!0),X(Xg,null,Mh(s,e=>(Y(),X(`details`,{key:e.name,class:`tk-admin-config-group`},[Z(`summary`,Cx,K(e.name),1),(Y(!0),X(Xg,null,Mh(e.items,e=>Vm((Y(),X(`div`,{key:e.key,class:`tk-admin-config-item`},[Z(`div`,{class:`tk-admin-config-title`,title:e.key},K(e.key),9,Tx),Z(`div`,Ex,[e.options?Vm((Y(),X(`select`,{key:0,"onUpdate:modelValue":t=>e.value=t,class:`tk-admin-config-select`},[(Y(!0),X(Xg,null,Mh(e.options,e=>(Y(),X(`option`,{key:e.value,value:e.value},K(e.label),9,Ox))),128))],8,Dx)),[[Pv,e.value]]):e.type===`textarea`?(Y(),o_(xy,{key:1,modelValue:e.value,"onUpdate:modelValue":t=>e.value=t,type:`textarea`,rows:5,size:`small`,placeholder:e.ph},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(Y(),o_(xy,{key:2,modelValue:e.value,"onUpdate:modelValue":t=>e.value=t,type:e.secret?`password`:`text`,size:`small`,placeholder:e.ph},null,8,[`modelValue`,`onUpdate:modelValue`,`type`,`placeholder`]))]),t[2]||=Z(`div`,null,null,-1),Z(`div`,kx,K(e.desc),1)])),[[rv,_(e)]])),128))]))),128)),Z(`details`,Ax,[Z(`summary`,jx,K(J(W)(`ADMIN_CONFIG_EMAIL_TEST`)),1),Z(`div`,Mx,[Z(`div`,Nx,K(J(W)(`ADMIN_CONFIG_EMAIL_TEST_HELP`)),1),Z(`div`,Px,[Q(xy,{modelValue:p.value,"onUpdate:modelValue":t[0]||=e=>p.value=e,size:`small`},{append:Bm(()=>[Q(Ny,{type:`info`,onClick:y},{default:Bm(()=>[m_(K(J(W)(`ADMIN_CONFIG_EMAIL_TEST_BTN`)),1)]),_:1})]),_:1},8,[`modelValue`])]),Z(`div`,Fx,K(J(W)(`ADMIN_CONFIG_EMAIL_TEST_RESULT`))+K(m.value),1)])])]),Z(`div`,Ix,[Q(Ny,{size:`small`,type:`primary`,"native-type":`submit`},{default:Bm(()=>[m_(K(J(W)(`ADMIN_CONFIG_SAVE`)),1)]),_:1}),Q(Ny,{size:`small`,type:`info`,onClick:g},{default:Bm(()=>[m_(K(J(W)(`ADMIN_CONFIG_RESET`)),1)]),_:1})])],32),Z(`div`,Lx,K(f.value),1)])),[[J(td),c.value]])}}),zx={class:`tk-admin-import`},Bx={class:`tk-admin-warn tk-admin-import-warn`},Vx={class:`tk-admin-import-label`},Hx={disabled:``,value:``},Ux={class:`tk-admin-import-label`},Wx={class:`tk-admin-import-actions`},Gx=rh({__name:`TkAdminImport`,setup(e){let t=q(!1),n=q(``),r=q(``),i=Kp({valine:W(`ADMIN_IMPORT_TIP_VALINE`),disqus:W(`ADMIN_IMPORT_TIP_DISQUS`),artalk:W(`ADMIN_IMPORT_TIP_ARTALK`),artalk2:``,twikoo:``}),a=q(),o=q();function s(e){r.value+=`${new Date().toLocaleString()} ${e}\n`,Om(()=>{let e=o.value?.inputEl;e&&(e.scrollTop=e.scrollHeight)})}async function c(){if(!n.value){s(W(`ADMIN_IMPORT_SOURCE_REQUIRED`));return}let e=a.value?.files?.[0];if(!e){s(W(`ADMIN_IMPORT_FILE_REQUIRED`));return}s(W(`ADMIN_IMPORT_START`)),t.value=!0;try{let t=bo().tcb;if(t){let n=await t.app.uploadFile({cloudPath:`import/${Date.now()}`,filePath:e,onUploadProgress:e=>{let t=Math.round(e.loaded*100/e.total);s(`${W(`ADMIN_IMPORT_UPLOADING`)}${t}%`)}});s(`${W(`ADMIN_IMPORT_UPLOADED`)}${n.fileID}`),await l(String(n.fileID))}else await u(e)}catch(e){console.error(e),s(e.message)}t.value=!1}async function l(e){s(`${W(`ADMIN_IMPORT_IMPORTING`)}${n.value}`);let t=await Co(bo().tcb,`COMMENT_IMPORT_FOR_ADMIN`,{fileId:e,source:n.value}),i=t.result??t;r.value+=i.log??``,s(`${W(`ADMIN_IMPORT_IMPORTED`)}${n.value}`)}async function u(e){s(`${W(`ADMIN_IMPORT_IMPORTING`)}${n.value}`);let t=await Co(bo().tcb,`COMMENT_IMPORT_FOR_ADMIN`,{file:await Sd(e),source:n.value}),i=t.result??t;r.value+=i.log??``,s(`${W(`ADMIN_IMPORT_IMPORTED`)}${n.value}`)}function d(e){return!e||typeof e!=`object`||Array.isArray(e)?!1:Object.values(e).every(e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`)}async function f(){if(n.value!==`twikoo`){s(W(`ADMIN_CONFIG_IMPORT_SOURCE_INVALID`));return}let e=a.value?.files?.[0];if(!e){s(W(`ADMIN_IMPORT_FILE_REQUIRED`));return}t.value=!0;try{let t=JSON.parse(await Sd(e));if(!d(t)){s(W(`ADMIN_CONFIG_IMPORT_INVALID`));return}let n={...t};delete n.CREDENTIALS,s(W(`ADMIN_CONFIG_IMPORTING`));let r=await Co(bo().tcb,`SET_CONFIG`,{config:n}),i=r.result??r;if(i.code===0)Oy(Cy),s(W(`ADMIN_CONFIG_IMPORTED`));else{let e=typeof i.message==`string`?i.message:``;s(`${W(`ADMIN_CONFIG_IMPORT_FAILED`)}${e}`)}}catch(e){console.error(e),s(`${W(`ADMIN_CONFIG_IMPORT_FAILED`)}${e.message}`)}t.value=!1}return(e,s)=>(Y(),X(`div`,zx,[Z(`div`,Bx,[Z(`p`,null,K(J(W)(`ADMIN_IMPORT_WARN`)),1),Z(`p`,null,K(i[n.value]),1)]),Z(`div`,Vx,K(J(W)(`ADMIN_IMPORT_SELECT_SOURCE`)),1),Vm(Z(`select`,{"onUpdate:modelValue":s[0]||=e=>n.value=e},[Z(`option`,Hx,K(J(W)(`ADMIN_IMPORT_SELECT`)),1),s[2]||=h_(`<option value="valine">Valine (JSON)</option><option value="disqus">Disqus (XML)</option><option value="artalk">Artalk v1 (JSON)</option><option value="artalk2">Artalk v2 (Artrans)</option><option value="twikoo">Twikoo (JSON)</option>`,5)],512),[[Pv,n.value]]),Z(`div`,Ux,K(J(W)(`ADMIN_IMPORT_SELECT_FILE`)),1),Z(`input`,{ref_key:`inputFileRef`,ref:a,type:`file`,value:``},null,512),Z(`div`,Wx,[Q(Ny,{size:`small`,disabled:t.value,onClick:c},{default:Bm(()=>[m_(K(J(W)(`ADMIN_IMPORT_COMMENT`)),1)]),_:1},8,[`disabled`]),Q(Ny,{size:`small`,disabled:t.value,onClick:f},{default:Bm(()=>[m_(K(J(W)(`ADMIN_CONFIG_IMPORT`)),1)]),_:1},8,[`disabled`])]),Q(xy,{ref_key:`logTextAreaRef`,ref:o,modelValue:r.value,"onUpdate:modelValue":s[1]||=e=>r.value=e,type:`textarea`,rows:10,readonly:``,placeholder:J(W)(`ADMIN_IMPORT_LOG`)},null,8,[`modelValue`,`placeholder`])]))}}),Kx={class:`tk-admin-export`},qx={class:`tk-admin-warn tk-admin-import-warn`},Jx=rh({__name:`TkAdminExport`,setup(e){let t=q(!1);async function n(e){t.value=!0;try{let t=await Co(bo().tcb,`COMMENT_EXPORT_FOR_ADMIN`,{collection:e}),n=t.result??t;n.data&&i(`twikoo-${e}.json`,n.data)}finally{t.value=!1}}async function r(){t.value=!0;try{let e=await Co(bo().tcb,`GET_CONFIG_FOR_ADMIN`,{}),t=e.result??e;if(!t.config)return;let n={...t.config};delete n.VERSION,i(`twikoo-config-${new Date().toISOString().slice(0,10)}.json`,n)}finally{t.value=!1}}function i(e,t){let n=t instanceof Object?JSON.stringify(t,null,2):String(t),r=new Blob([n]),i=document.createElementNS(`http://www.w3.org/1999/xhtml`,`a`);i.href=URL.createObjectURL(r),i.download=e,i.click()}return(e,i)=>(Y(),X(`div`,Kx,[Z(`div`,qx,[Z(`p`,null,K(J(W)(`ADMIN_EXPORT_WARN`)),1)]),Q(Ny,{size:`small`,disabled:t.value,onClick:i[0]||=e=>n(`comment`)},{default:Bm(()=>[m_(K(J(W)(`ADMIN_EXPORT_COMMENT`)),1)]),_:1},8,[`disabled`]),Q(Ny,{size:`small`,disabled:t.value,onClick:i[1]||=e=>n(`counter`)},{default:Bm(()=>[m_(K(J(W)(`ADMIN_EXPORT_COUNTER`)),1)]),_:1},8,[`disabled`]),Q(Ny,{size:`small`,disabled:t.value,onClick:r},{default:Bm(()=>[m_(K(J(W)(`ADMIN_CONFIG_EXPORT`)),1)]),_:1},8,[`disabled`])]))}}),Yx={class:`tk-admin-container`},Xx={key:0,class:`tk-login-title`},Zx={key:1},Qx={key:0,class:`tk-login`},$x={class:`tk-login-title`},eS={key:0,class:`tk-login-msg`},tS={href:`https://twikoo.js.org/faq.html`,rel:`noopener noreferrer`,target:`_blank`},nS={key:1,class:`tk-regist`},rS={class:`tk-login-title`},iS={key:0,class:`tk-login-msg`},aS={key:1,class:`tk-login-msg`},oS={href:`https://twikoo.js.org/faq.html`,rel:`noopener noreferrer`,target:`_blank`},sS={key:2,class:`tk-panel`},cS={class:`tk-panel-title`},lS={class:`tk-tabs`},uS=rh({__name:`TkAdmin`,props:{show:{type:Boolean,default:!1}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,i=q(!0),a=q(``),o=q(!1),s=q(!1),c=q(!0),l=q(!1),u=q(``),d=q(``),f=q(``),p=q(``),m=q(`comment`),h=q(),g=U_(()=>!c.value&&!!d.value&&d.value===f.value&&(l.value||!!u.value));async function _(){if(!d.value){p.value=W(`ADMIN_PASSWORD_REQUIRED`);return}i.value=!0,p.value=``;let e=(0,Ec.default)(d.value),t=bo().tcb,n=await Co(t,`LOGIN`,{password:e}),r=n.result??n;if(r.message)p.value=r.message;else if(r.ticket)try{await t?.auth?.customAuthProvider().signIn(r.ticket),To.info(`登录成功`),d.value=``,await S()}catch(e){To.error(`登录失败`,e)}else r.code===0&&(To.info(`登录成功`),localStorage.setItem(`twikoo-access-token`,e),d.value=``,await S());i.value=!1}async function v(e){e.preventDefault(),i.value=!0;let t=bo().tcb;t?.auth?(await t.auth.signOut(),await t.auth.anonymousAuthProvider().signIn()):localStorage.removeItem(`twikoo-access-token`),s.value=!1,i.value=!1}async function y(){i.value=!0;let e=(0,Ec.default)(d.value),t=await Co(bo().tcb,`SET_PASSWORD`,{password:e,credentials:u.value}),n=t.result??t;n.code?(p.value=W(`ADMIN_REGIST_FAILED`),n.message&&(p.value+=`,${n.message}`),To.warn(`Twikoo 注册失败`,t)):(c.value=!0,await _()),i.value=!1}async function b(){i.value=!0,await S(),s.value||(await C(),x()),i.value=!1}function x(){setTimeout(()=>h.value?.focus(),500)}async function S(){let e=bo().tcb;if(e?.auth){let t=await e.auth.getCurrentUser();s.value=t.loginType===`CUSTOM`}else{let t=await Co(e,`GET_CONFIG`),n=t.result??t;s.value=n?.config?.IS_ADMIN===!0}}async function C(){try{let e=await Co(bo().tcb,`GET_PASSWORD_STATUS`),t=e.result??e;a.value=t.version??``,c.value=t.status===!0,l.value=!bo().tcb}catch(e){throw o.value=!0,i.value=!1,e}}function w(){r(`close`)}return qm(()=>n.show,e=>{e&&b()}),(t,n)=>(Y(),X(`div`,Yx,[Vm((Y(),X(`div`,{class:xf([`tk-admin`,{__show:e.show}])},[Z(`button`,{class:`tk-admin-close`,onClick:w},[Q(Zv,{name:`times`})]),o.value?(Y(),X(`div`,Xx,[Z(`div`,null,K(J(W)(`ADMIN_NEED_UPDATE`)),1),n[10]||=Z(`a`,{href:`https://twikoo.js.org/update.html`,target:`_blank`,rel:`noopener noreferrer`},` https://twikoo.js.org/update.html `,-1)])):(Y(),X(`div`,Zx,[!s.value&&c.value?(Y(),X(`div`,Qx,[Z(`div`,$x,K(J(W)(`ADMIN_LOGIN_TITLE`)),1),Z(`form`,{onSubmit:n[1]||=Bv(()=>{},[`prevent`])},[n[11]||=Z(`input`,{type:`hidden`},null,-1),Q(xy,{ref_key:`focusmeRef`,ref:h,modelValue:d.value,"onUpdate:modelValue":n[0]||=e=>d.value=e,class:`tk-password`,type:`password`,placeholder:J(W)(`ADMIN_PASSWORD_PLACEHOLDER`),onKeyup:Hv(_,[`enter`])},{prepend:Bm(()=>[m_(K(J(W)(`ADMIN_PASSWORD`)),1)]),append:Bm(()=>[Q(Ny,{onClick:_},{default:Bm(()=>[m_(K(J(W)(`ADMIN_LOGIN`)),1)]),_:1})]),_:1},8,[`modelValue`,`placeholder`])],32),p.value?(Y(),X(`div`,eS,[m_(K(p.value)+` `,1),Z(`a`,tS,K(J(W)(`ADMIN_FORGOT`)),1)])):$(`v-if`,!0)])):$(`v-if`,!0),!s.value&&!c.value?(Y(),X(`div`,nS,[Z(`div`,rS,K(J(W)(`ADMIN_LOGIN_TITLE`)),1),Z(`form`,{onSubmit:n[5]||=Bv(()=>{},[`prevent`])},[l.value?$(`v-if`,!0):(Y(),o_(xy,{key:0,ref_key:`focusmeRef`,ref:h,modelValue:u.value,"onUpdate:modelValue":n[2]||=e=>u.value=e,class:`tk-password`,placeholder:J(W)(`ADMIN_CREDENTIALS_PLACEHOLDER`)},{prepend:Bm(()=>[m_(K(J(W)(`ADMIN_CREDENTIALS`)),1)]),_:1},8,[`modelValue`,`placeholder`])),Q(xy,{modelValue:d.value,"onUpdate:modelValue":n[3]||=e=>d.value=e,class:`tk-password`,type:`password`,placeholder:J(W)(`ADMIN_SET_PASSWORD_PLACEHOLDER`)},{prepend:Bm(()=>[m_(K(J(W)(`ADMIN_SET_PASSWORD`)),1)]),_:1},8,[`modelValue`,`placeholder`]),Q(xy,{modelValue:f.value,"onUpdate:modelValue":n[4]||=e=>f.value=e,class:`tk-password`,type:`password`,placeholder:J(W)(`ADMIN_SET_PASSWORD_CONFIRM_PLACEHOLDER`)},{prepend:Bm(()=>[m_(K(J(W)(`ADMIN_SET_PASSWORD_CONFIRM`)),1)]),_:1},8,[`modelValue`,`placeholder`])],32),Q(Ny,{class:`tk-regist-button`,disabled:!g.value,onClick:y},{default:Bm(()=>[m_(K(J(W)(`ADMIN_REGIST`)),1)]),_:1},8,[`disabled`]),p.value?(Y(),X(`div`,iS,K(p.value),1)):$(`v-if`,!0),l.value?$(`v-if`,!0):(Y(),X(`div`,aS,[Z(`a`,oS,K(J(W)(`ADMIN_CREDENTIALS_FAQ`)),1)]))])):$(`v-if`,!0),s.value?(Y(),X(`div`,sS,[Z(`div`,cS,[Z(`div`,null,K(J(W)(`ADMIN_TITLE`)),1),Z(`a`,{class:`tk-panel-logout`,href:`#`,onClick:Bv(v,[`prevent`])},K(J(W)(`ADMIN_LOGOUT`)),1)]),Z(`div`,lS,[Z(`div`,{class:xf([`tk-tab`,{__active:m.value===`comment`}]),onClick:n[6]||=e=>m.value=`comment`},K(J(W)(`ADMIN_COMMENT`)),3),Z(`div`,{class:xf([`tk-tab`,{__active:m.value===`config`}]),onClick:n[7]||=e=>m.value=`config`},K(J(W)(`ADMIN_CONFIG`)),3),Z(`div`,{class:xf([`tk-tab`,{__active:m.value===`import`}]),onClick:n[8]||=e=>m.value=`import`},K(J(W)(`ADMIN_IMPORT`)),3),Z(`div`,{class:xf([`tk-tab`,{__active:m.value===`export`}]),onClick:n[9]||=e=>m.value=`export`},K(J(W)(`ADMIN_EXPORT`)),3)]),Vm(Q(yx,null,null,512),[[rv,m.value===`comment`]]),Vm(Q(Rx,null,null,512),[[rv,m.value===`config`]]),Vm(Q(Gx,null,null,512),[[rv,m.value===`import`]]),Vm(Q(Jx,null,null,512),[[rv,m.value===`export`]])])):$(`v-if`,!0)]))],2)),[[J(td),i.value]])]))}}),dS={id:`twikoo`,class:`twikoo`},fS=rh({__name:`App`,setup(e){let t=q(!1),n=q(!1);function r(e){n.value=e===!0}return vh(()=>{Ey(Ty,r)}),Sh(()=>{Dy(Ty,r)}),(e,r)=>(Y(),X(`div`,dS,[Q(Wb,{"show-admin-entry":n.value,onAdmin:r[0]||=e=>t.value=!0},null,8,[`show-admin-entry`]),Q(Kb),Q(uS,{show:t.value,onClose:r[1]||=e=>t.value=!1},null,8,[`show`])]))}}),pS=null;function mS(e,t={}){return pS&&=(pS.unmount(),null),pS=Kv(fS),pS.config.globalProperties.$tcb=e,pS.config.globalProperties.$twikoo=t,yo(e,t),pS.mount(t.el||`#twikoo`),pS}var hS=()=>globalThis.cloudbase;function gS(e){hS=e}async function _S(e){if(ad(e.envId))return null;let t=hS();return t===void 0?(To.error(`Please import cloudbase firstly:
|
|
250
|
+
<script src="https://imgcache.qq.com/qcloud/cloudbase-js-sdk/1.3.3/cloudbase.full.js"><\/script>`),null):await kd(t,e)}async function vS(e={}){let t=await _S(e);await Io({lang:e.lang,localeBaseUrl:e.localeBaseUrl}),mS(t,e),await xd(t,e)}async function yS(e={}){return await vd(await _S(e),e)}async function bS(e={}){return await yd(await _S(e),e)}async function xS(e={}){return await bd(await _S(e),e)}gS(()=>to),e.default=vS,e.init=vS,e.getCommentsCount=yS,e.getRecentComments=bS,e.getVisitorsCount=xS,e.setCloudbaseProvider=gS,e.version=ho});
|