2 lines
109 KiB
JavaScript
2 lines
109 KiB
JavaScript
import{A as e,B as t,C as s,D as n,E as o,G as i,H as r,x as a,J as c,K as l,L as u,r as d,M as h,N as f,O as p,P as m,Q as g,R as y,S as _,n as w,T as k,U as b,v,V as S,W as I,X as T,Y as x,o as A,c as P,w as C,Z as O,_ as E,f as R,p as L,b as D,k as U,t as N,j as M,d as F,e as $,$ as q,F as j,l as B,i as K,a0 as H,a1 as V,a2 as W,a3 as z,a as J,m as Y,a4 as Q,g as G}from"./index-CICgbd-2.js";const X={pages:[{path:"pages/index/index",style:{navigationStyle:"custom",navigationBarTitleText:"首页"}},{path:"pages/index/list",style:{navigationStyle:"custom",navigationBarTitleText:"搜索"}},{path:"pages/index/detail",style:{navigationStyle:"custom",navigationBarTitleText:"资源详情"}}],globalStyle:{navigationBarTextStyle:"black",navigationBarTitleText:"uni-app",navigationBarBackgroundColor:"#F8F8F8",backgroundColor:"#F8F8F8"},uniIdRouter:{}};function Z(e,t,s){return e(s={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&s.path)}},s.exports),s.exports}var ee=Z((function(e,t){var s;e.exports=(s=s||function(e,t){var s=Object.create||function(){function e(){}return function(t){var s;return e.prototype=t,s=new e,e.prototype=null,s}}(),n={},o=n.lib={},i=o.Base={extend:function(e){var t=s(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},r=o.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,s=e.words,n=this.sigBytes,o=e.sigBytes;if(this.clamp(),n%4)for(var i=0;i<o;i++){var r=s[i>>>2]>>>24-i%4*8&255;t[n+i>>>2]|=r<<24-(n+i)%4*8}else for(i=0;i<o;i+=4)t[n+i>>>2]=s[i>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,s=this.sigBytes;t[s>>>2]&=4294967295<<32-s%4*8,t.length=e.ceil(s/4)},clone:function(){var e=i.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var s,n=[],o=function(t){var s=987654321,n=4294967295;return function(){var o=((s=36969*(65535&s)+(s>>16)&n)<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n;return o/=4294967296,(o+=.5)*(e.random()>.5?1:-1)}},i=0;i<t;i+=4){var a=o(4294967296*(s||e.random()));s=987654071*a(),n.push(4294967296*a()|0)}return new r.init(n,t)}}),a=n.enc={},c=a.Hex={stringify:function(e){for(var t=e.words,s=e.sigBytes,n=[],o=0;o<s;o++){var i=t[o>>>2]>>>24-o%4*8&255;n.push((i>>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,s=[],n=0;n<t;n+=2)s[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new r.init(s,t/2)}},l=a.Latin1={stringify:function(e){for(var t=e.words,s=e.sigBytes,n=[],o=0;o<s;o++){var i=t[o>>>2]>>>24-o%4*8&255;n.push(String.fromCharCode(i))}return n.join("")},parse:function(e){for(var t=e.length,s=[],n=0;n<t;n++)s[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new r.init(s,t)}},u=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(l.stringify(e)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(e){return l.parse(unescape(encodeURIComponent(e)))}},d=o.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new r.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=u.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var s=this._data,n=s.words,o=s.sigBytes,i=this.blockSize,a=o/(4*i),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*i,l=e.min(4*c,o);if(c){for(var u=0;u<c;u+=i)this._doProcessBlock(n,u);var d=n.splice(0,c);s.sigBytes-=l}return new r.init(d,l)},clone:function(){var e=i.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});o.Hasher=d.extend({cfg:i.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){d.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,s){return new e.init(s).finalize(t)}},_createHmacHelper:function(e){return function(t,s){return new h.HMAC.init(e,s).finalize(t)}}});var h=n.algo={};return n}(Math),s)})),te=ee,se=(Z((function(e,t){var s;e.exports=(s=te,function(e){var t=s,n=t.lib,o=n.WordArray,i=n.Hasher,r=t.algo,a=[];!function(){for(var t=0;t<64;t++)a[t]=4294967296*e.abs(e.sin(t+1))|0}();var c=r.MD5=i.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var s=0;s<16;s++){var n=t+s,o=e[n];e[n]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var i=this._hash.words,r=e[t+0],c=e[t+1],f=e[t+2],p=e[t+3],m=e[t+4],g=e[t+5],y=e[t+6],_=e[t+7],w=e[t+8],k=e[t+9],b=e[t+10],v=e[t+11],S=e[t+12],I=e[t+13],T=e[t+14],x=e[t+15],A=i[0],P=i[1],C=i[2],O=i[3];A=l(A,P,C,O,r,7,a[0]),O=l(O,A,P,C,c,12,a[1]),C=l(C,O,A,P,f,17,a[2]),P=l(P,C,O,A,p,22,a[3]),A=l(A,P,C,O,m,7,a[4]),O=l(O,A,P,C,g,12,a[5]),C=l(C,O,A,P,y,17,a[6]),P=l(P,C,O,A,_,22,a[7]),A=l(A,P,C,O,w,7,a[8]),O=l(O,A,P,C,k,12,a[9]),C=l(C,O,A,P,b,17,a[10]),P=l(P,C,O,A,v,22,a[11]),A=l(A,P,C,O,S,7,a[12]),O=l(O,A,P,C,I,12,a[13]),C=l(C,O,A,P,T,17,a[14]),A=u(A,P=l(P,C,O,A,x,22,a[15]),C,O,c,5,a[16]),O=u(O,A,P,C,y,9,a[17]),C=u(C,O,A,P,v,14,a[18]),P=u(P,C,O,A,r,20,a[19]),A=u(A,P,C,O,g,5,a[20]),O=u(O,A,P,C,b,9,a[21]),C=u(C,O,A,P,x,14,a[22]),P=u(P,C,O,A,m,20,a[23]),A=u(A,P,C,O,k,5,a[24]),O=u(O,A,P,C,T,9,a[25]),C=u(C,O,A,P,p,14,a[26]),P=u(P,C,O,A,w,20,a[27]),A=u(A,P,C,O,I,5,a[28]),O=u(O,A,P,C,f,9,a[29]),C=u(C,O,A,P,_,14,a[30]),A=d(A,P=u(P,C,O,A,S,20,a[31]),C,O,g,4,a[32]),O=d(O,A,P,C,w,11,a[33]),C=d(C,O,A,P,v,16,a[34]),P=d(P,C,O,A,T,23,a[35]),A=d(A,P,C,O,c,4,a[36]),O=d(O,A,P,C,m,11,a[37]),C=d(C,O,A,P,_,16,a[38]),P=d(P,C,O,A,b,23,a[39]),A=d(A,P,C,O,I,4,a[40]),O=d(O,A,P,C,r,11,a[41]),C=d(C,O,A,P,p,16,a[42]),P=d(P,C,O,A,y,23,a[43]),A=d(A,P,C,O,k,4,a[44]),O=d(O,A,P,C,S,11,a[45]),C=d(C,O,A,P,x,16,a[46]),A=h(A,P=d(P,C,O,A,f,23,a[47]),C,O,r,6,a[48]),O=h(O,A,P,C,_,10,a[49]),C=h(C,O,A,P,T,15,a[50]),P=h(P,C,O,A,g,21,a[51]),A=h(A,P,C,O,S,6,a[52]),O=h(O,A,P,C,p,10,a[53]),C=h(C,O,A,P,b,15,a[54]),P=h(P,C,O,A,c,21,a[55]),A=h(A,P,C,O,w,6,a[56]),O=h(O,A,P,C,x,10,a[57]),C=h(C,O,A,P,y,15,a[58]),P=h(P,C,O,A,I,21,a[59]),A=h(A,P,C,O,m,6,a[60]),O=h(O,A,P,C,v,10,a[61]),C=h(C,O,A,P,f,15,a[62]),P=h(P,C,O,A,k,21,a[63]),i[0]=i[0]+A|0,i[1]=i[1]+P|0,i[2]=i[2]+C|0,i[3]=i[3]+O|0},_doFinalize:function(){var t=this._data,s=t.words,n=8*this._nDataBytes,o=8*t.sigBytes;s[o>>>5]|=128<<24-o%32;var i=e.floor(n/4294967296),r=n;s[15+(o+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),s[14+(o+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),t.sigBytes=4*(s.length+1),this._process();for(var a=this._hash,c=a.words,l=0;l<4;l++){var u=c[l];c[l]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}return a},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,s,n,o,i,r){var a=e+(t&s|~t&n)+o+r;return(a<<i|a>>>32-i)+t}function u(e,t,s,n,o,i,r){var a=e+(t&n|s&~n)+o+r;return(a<<i|a>>>32-i)+t}function d(e,t,s,n,o,i,r){var a=e+(t^s^n)+o+r;return(a<<i|a>>>32-i)+t}function h(e,t,s,n,o,i,r){var a=e+(s^(t|~n))+o+r;return(a<<i|a>>>32-i)+t}t.MD5=i._createHelper(c),t.HmacMD5=i._createHmacHelper(c)}(Math),s.MD5)})),Z((function(e,t){var s,n,o;e.exports=(n=(s=te).lib.Base,o=s.enc.Utf8,void(s.algo.HMAC=n.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=o.parse(t));var s=e.blockSize,n=4*s;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),r=this._iKey=t.clone(),a=i.words,c=r.words,l=0;l<s;l++)a[l]^=1549556828,c[l]^=909522486;i.sigBytes=r.sigBytes=n,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,s=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(s))}})))})),Z((function(e,t){e.exports=te.HmacMD5}))),ne=Z((function(e,t){e.exports=te.enc.Utf8})),oe=Z((function(e,t){var s,n,o;e.exports=(o=(n=s=te).lib.WordArray,n.enc.Base64={stringify:function(e){var t=e.words,s=e.sigBytes,n=this._map;e.clamp();for(var o=[],i=0;i<s;i+=3)for(var r=(t[i>>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,a=0;a<4&&i+.75*a<s;a++)o.push(n.charAt(r>>>6*(3-a)&63));var c=n.charAt(64);if(c)for(;o.length%4;)o.push(c);return o.join("")},parse:function(e){var t=e.length,s=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var i=0;i<s.length;i++)n[s.charCodeAt(i)]=i}var r=s.charAt(64);if(r){var a=e.indexOf(r);-1!==a&&(t=a)}return function(e,t,s){for(var n=[],i=0,r=0;r<t;r++)if(r%4){var a=s[e.charCodeAt(r-1)]<<r%4*2,c=s[e.charCodeAt(r)]>>>6-r%4*2;n[i>>>2]|=(a|c)<<24-i%4*8,i++}return o.create(n,i)}(e,t,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},s.enc.Base64)}));const ie="FUNCTION",re="pending",ae="rejected";function ce(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function le(e){return"object"===ce(e)}function ue(e){return"function"==typeof e}function de(e){return function(){try{return e.apply(e,arguments)}catch(t){console.error(t)}}}const he="REJECTED",fe="NOT_PENDING";class pe{constructor({createPromise:e,retryRule:t=he}={}){this.createPromise=e,this.status=null,this.promise=null,this.retryRule=t}get needRetry(){if(!this.status)return!0;switch(this.retryRule){case he:return this.status===ae;case fe:return this.status!==re}}exec(){return this.needRetry?(this.status=re,this.promise=this.createPromise().then((e=>(this.status="fulfilled",Promise.resolve(e))),(e=>(this.status=ae,Promise.reject(e)))),this.promise):this.promise}}function me(e){return e&&"string"==typeof e?JSON.parse(e):e}const ge=me([]);me("");const ye=me("[]")||[];let _e="";try{_e="__UNI__F9A28FF"}catch(at){}let we={};function ke(e,t={}){var s,n;return s=we,n=e,Object.prototype.hasOwnProperty.call(s,n)||(we[e]=t),we[e]}const be=["invoke","success","fail","complete"],ve=ke("_globalUniCloudInterceptor");function Se(e,t){ve[e]||(ve[e]={}),le(t)&&Object.keys(t).forEach((s=>{be.indexOf(s)>-1&&function(e,t,s){let n=ve[e][t];n||(n=ve[e][t]=[]),-1===n.indexOf(s)&&ue(s)&&n.push(s)}(e,s,t[s])}))}function Ie(e,t){ve[e]||(ve[e]={}),le(t)?Object.keys(t).forEach((s=>{be.indexOf(s)>-1&&function(e,t,s){const n=ve[e][t];if(!n)return;const o=n.indexOf(s);o>-1&&n.splice(o,1)}(e,s,t[s])})):delete ve[e]}function Te(e,t){return e&&0!==e.length?e.reduce(((e,s)=>e.then((()=>s(t)))),Promise.resolve()):Promise.resolve()}function xe(e,t){return ve[e]&&ve[e][t]||[]}function Ae(e){Se("callObject",e)}const Pe=ke("_globalUniCloudListener"),Ce="response",Oe="needLogin",Ee="refreshToken",Re="clientdb",Le="cloudfunction",De="cloudobject";function Ue(e){return Pe[e]||(Pe[e]=[]),Pe[e]}function Ne(e,t){const s=Ue(e);s.includes(t)||s.push(t)}function Me(e,t){const s=Ue(e),n=s.indexOf(t);-1!==n&&s.splice(n,1)}function Fe(e,t){const s=Ue(e);for(let n=0;n<s.length;n++)(0,s[n])(t)}let $e,qe=!1;function je(){return $e||($e=new Promise((e=>{qe&&e(),function t(){if("function"==typeof s){const t=s();t&&t[0]&&(qe=!0,e())}qe||setTimeout((()=>{t()}),30)}()})),$e)}function Be(e){const t={};for(const s in e){const n=e[s];ue(n)&&(t[s]=de(n))}return t}class Ke extends Error{constructor(e){super(e.message),this.errMsg=e.message||e.errMsg||"unknown system error",this.code=this.errCode=e.code||e.errCode||"SYSTEM_ERROR",this.errSubject=this.subject=e.subject||e.errSubject,this.cause=e.cause,this.requestId=e.requestId}toJson(e=0){if(!(e>=10))return e++,{errCode:this.errCode,errMsg:this.errMsg,errSubject:this.errSubject,cause:this.cause&&this.cause.toJson?this.cause.toJson(e):this.cause}}}var He={request:e=>d(e),uploadFile:e=>h(e),setStorageSync:(e,t)=>f(e,t),getStorageSync:e=>p(e),removeStorageSync:e=>m(e),clearStorageSync:()=>g(),connectSocket:e=>y(e)};function Ve(e){return e&&Ve(e.__v_raw)||e}function We(){return{token:He.getStorageSync("uni_id_token")||He.getStorageSync("uniIdToken"),tokenExpired:He.getStorageSync("uni_id_token_expired")}}function ze({token:e,tokenExpired:t}={}){e&&He.setStorageSync("uni_id_token",e),t&&He.setStorageSync("uni_id_token_expired",t)}let Je,Ye;function Qe(){return Je||(Je=_()),Je}function Ge(){let e,t;try{if(x){if(x.toString().indexOf("not yet implemented")>-1)return;const{scene:s,channel:n}=x();e=n,t=s}}catch(s){}return{channel:e,scene:t}}let Xe={};function Ze(){const e=T&&T()||"en";if(Ye)return{...Xe,...Ye,locale:e,LOCALE:e};const t=Qe(),{deviceId:s,osName:n,uniPlatform:o,appId:i}=t,r=["appId","appLanguage","appName","appVersion","appVersionCode","appWgtVersion","browserName","browserVersion","deviceBrand","deviceId","deviceModel","deviceType","osName","osVersion","romName","romVersion","ua","hostName","hostVersion","uniPlatform","uniRuntimeVersion","uniRuntimeVersionCode","uniCompilerVersion","uniCompilerVersionCode"];for(const a in t)Object.hasOwnProperty.call(t,a)&&-1===r.indexOf(a)&&delete t[a];return Ye={PLATFORM:o,OS:n,APPID:i,DEVICEID:s,...Ge(),...t},{...Xe,...Ye,locale:e,LOCALE:e}}var et=function(e,t){let s="";return Object.keys(e).sort().forEach((function(t){e[t]&&(s=s+"&"+t+"="+e[t])})),s=s.slice(1),se(s,t).toString()},tt=function(e,t){return new Promise(((s,n)=>{t(Object.assign(e,{complete(e){e||(e={});const t=e.data&&e.data.header&&e.data.header["x-serverless-request-id"]||e.header&&e.header["request-id"];if(!e.statusCode||e.statusCode>=400){const s=e.data&&e.data.error&&e.data.error.code||"SYS_ERR",o=e.data&&e.data.error&&e.data.error.message||e.errMsg||"request:fail";return n(new Ke({code:s,message:o,requestId:t}))}const o=e.data;if(o.error)return n(new Ke({code:o.error.code,message:o.error.message,requestId:t}));o.result=o.data,o.requestId=t,delete o.data,s(o)}}))}))},st=function(e){return oe.stringify(ne.parse(e))},nt=class{constructor(e){["spaceId","clientSecret"].forEach((t=>{if(!Object.prototype.hasOwnProperty.call(e,t))throw new Error(`${t} required`)})),this.config=Object.assign({},{endpoint:0===e.spaceId.indexOf("mp-")?"https://api.next.bspapp.com":"https://api.bspapp.com"},e),this.config.provider="aliyun",this.config.requestUrl=this.config.endpoint+"/client",this.config.envType=this.config.envType||"public",this.config.accessTokenKey="access_token_"+this.config.spaceId,this.adapter=He,this._getAccessTokenPromiseHub=new pe({createPromise:()=>this.requestAuth(this.setupRequest({method:"serverless.auth.user.anonymousAuthorize",params:"{}"},"auth")).then((e=>{if(!e.result||!e.result.accessToken)throw new Ke({code:"AUTH_FAILED",message:"获取accessToken失败"});this.setAccessToken(e.result.accessToken)})),retryRule:fe})}get hasAccessToken(){return!!this.accessToken}setAccessToken(e){this.accessToken=e}requestWrapped(e){return tt(e,this.adapter.request)}requestAuth(e){return this.requestWrapped(e)}request(e,t){return Promise.resolve().then((()=>this.hasAccessToken?t?this.requestWrapped(e):this.requestWrapped(e).catch((t=>new Promise(((e,s)=>{!t||"GATEWAY_INVALID_TOKEN"!==t.code&&"InvalidParameter.InvalidToken"!==t.code?s(t):e()})).then((()=>this.getAccessToken())).then((()=>{const t=this.rebuildRequest(e);return this.request(t,!0)})))):this.getAccessToken().then((()=>{const t=this.rebuildRequest(e);return this.request(t,!0)}))))}rebuildRequest(e){const t=Object.assign({},e);return t.data.token=this.accessToken,t.header["x-basement-token"]=this.accessToken,t.header["x-serverless-sign"]=et(t.data,this.config.clientSecret),t}setupRequest(e,t){const s=Object.assign({},e,{spaceId:this.config.spaceId,timestamp:Date.now()}),n={"Content-Type":"application/json"};return"auth"!==t&&(s.token=this.accessToken,n["x-basement-token"]=this.accessToken),n["x-serverless-sign"]=et(s,this.config.clientSecret),{url:this.config.requestUrl,method:"POST",data:s,dataType:"json",header:n}}getAccessToken(){return this._getAccessTokenPromiseHub.exec()}async authorize(){await this.getAccessToken()}callFunction(e){const t={method:"serverless.function.runtime.invoke",params:JSON.stringify({functionTarget:e.name,functionArgs:e.data||{}})};return this.request(this.setupRequest(t))}getOSSUploadOptionsFromPath(e){const t={method:"serverless.file.resource.generateProximalSign",params:JSON.stringify(e)};return this.request(this.setupRequest(t))}uploadFileToOSS({url:e,formData:t,name:s,filePath:n,fileType:o,onUploadProgress:i}){return new Promise(((r,a)=>{const c=this.adapter.uploadFile({url:e,formData:t,name:s,filePath:n,fileType:o,header:{"X-OSS-server-side-encrpytion":"AES256"},success(e){e&&e.statusCode<400?r(e):a(new Ke({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(e){a(new Ke({code:e.code||"UPLOAD_FAILED",message:e.message||e.errMsg||"文件上传失败"}))}});"function"==typeof i&&c&&"function"==typeof c.onProgressUpdate&&c.onProgressUpdate((e=>{i({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend})}))}))}reportOSSUpload(e){const t={method:"serverless.file.resource.report",params:JSON.stringify(e)};return this.request(this.setupRequest(t))}async uploadFile({filePath:e,cloudPath:t,fileType:s="image",cloudPathAsRealPath:n=!1,onUploadProgress:o,config:i}){if("string"!==ce(t))throw new Ke({code:"INVALID_PARAM",message:"cloudPath必须为字符串类型"});if(!(t=t.trim()))throw new Ke({code:"INVALID_PARAM",message:"cloudPath不可为空"});if(/:\/\//.test(t))throw new Ke({code:"INVALID_PARAM",message:"cloudPath不合法"});const r=i&&i.envType||this.config.envType;if(n&&("/"!==t[0]&&(t="/"+t),t.indexOf("\\")>-1))throw new Ke({code:"INVALID_PARAM",message:"使用cloudPath作为路径时,cloudPath不可包含“\\”"});const a=(await this.getOSSUploadOptionsFromPath({env:r,filename:n?t.split("/").pop():t,fileId:n?t:void 0})).result,c="https://"+a.cdnDomain+"/"+a.ossPath,{securityToken:l,accessKeyId:u,signature:d,host:h,ossPath:f,id:p,policy:m,ossCallbackUrl:g}=a,y={"Cache-Control":"max-age=2592000","Content-Disposition":"attachment",OSSAccessKeyId:u,Signature:d,host:h,id:p,key:f,policy:m,success_action_status:200};if(l&&(y["x-oss-security-token"]=l),g){const e=JSON.stringify({callbackUrl:g,callbackBody:JSON.stringify({fileId:p,spaceId:this.config.spaceId}),callbackBodyType:"application/json"});y.callback=st(e)}const _={url:"https://"+a.host,formData:y,fileName:"file",name:"file",filePath:e,fileType:s};if(await this.uploadFileToOSS(Object.assign({},_,{onUploadProgress:o})),g)return{success:!0,filePath:e,fileID:c};if((await this.reportOSSUpload({id:p})).success)return{success:!0,filePath:e,fileID:c};throw new Ke({code:"UPLOAD_FAILED",message:"文件上传失败"})}getTempFileURL({fileList:e}={}){return new Promise(((t,s)=>{Array.isArray(e)&&0!==e.length||s(new Ke({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"})),t({fileList:e.map((e=>({fileID:e,tempFileURL:e})))})}))}async getFileInfo({fileList:e}={}){if(!Array.isArray(e)||0===e.length)throw new Ke({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"});const t={method:"serverless.file.resource.info",params:JSON.stringify({id:e.map((e=>e.split("?")[0])).join(",")})};return{fileList:(await this.request(this.setupRequest(t))).result}}},ot={init(e){const t=new nt(e),s={signInAnonymously:function(){return t.authorize()},getLoginState:function(){return Promise.resolve(!1)}};return t.auth=function(){return s},t.customAuth=t.auth,t}};const it="undefined"!=typeof location&&"http:"===location.protocol?"http:":"https:";var rt,at;(at=rt||(rt={})).local="local",at.none="none",at.session="session";var ct=function(){},lt=Z((function(e,t){var s;e.exports=(s=te,function(e){var t=s,n=t.lib,o=n.WordArray,i=n.Hasher,r=t.algo,a=[],c=[];!function(){function t(t){for(var s=e.sqrt(t),n=2;n<=s;n++)if(!(t%n))return!1;return!0}function s(e){return 4294967296*(e-(0|e))|0}for(var n=2,o=0;o<64;)t(n)&&(o<8&&(a[o]=s(e.pow(n,.5))),c[o]=s(e.pow(n,1/3)),o++),n++}();var l=[],u=r.SHA256=i.extend({_doReset:function(){this._hash=new o.init(a.slice(0))},_doProcessBlock:function(e,t){for(var s=this._hash.words,n=s[0],o=s[1],i=s[2],r=s[3],a=s[4],u=s[5],d=s[6],h=s[7],f=0;f<64;f++){if(f<16)l[f]=0|e[t+f];else{var p=l[f-15],m=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,g=l[f-2],y=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;l[f]=m+l[f-7]+y+l[f-16]}var _=n&o^n&i^o&i,w=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),k=h+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&u^~a&d)+c[f]+l[f];h=d,d=u,u=a,a=r+k|0,r=i,i=o,o=n,n=k+(w+_)|0}s[0]=s[0]+n|0,s[1]=s[1]+o|0,s[2]=s[2]+i|0,s[3]=s[3]+r|0,s[4]=s[4]+a|0,s[5]=s[5]+u|0,s[6]=s[6]+d|0,s[7]=s[7]+h|0},_doFinalize:function(){var t=this._data,s=t.words,n=8*this._nDataBytes,o=8*t.sigBytes;return s[o>>>5]|=128<<24-o%32,s[14+(o+64>>>9<<4)]=e.floor(n/4294967296),s[15+(o+64>>>9<<4)]=n,t.sigBytes=4*s.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=i._createHelper(u),t.HmacSHA256=i._createHmacHelper(u)}(Math),s.SHA256)})),ut=lt,dt=Z((function(e,t){e.exports=te.HmacSHA256}));const ht=()=>{let e;if(!Promise){e=()=>{},e.promise={};const t=()=>{throw new Ke({message:'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}const t=new Promise(((t,s)=>{e=(e,n)=>e?s(e):t(n)}));return e.promise=t,e};function ft(e){return void 0===e}function pt(e){return"[object Null]"===Object.prototype.toString.call(e)}var mt;!function(e){e.WEB="web",e.WX_MP="wx_mp"}(mt||(mt={}));const gt={adapter:null,runtime:void 0},yt=["anonymousUuidKey"];class _t extends ct{constructor(){super(),gt.adapter.root.tcbObject||(gt.adapter.root.tcbObject={})}setItem(e,t){gt.adapter.root.tcbObject[e]=t}getItem(e){return gt.adapter.root.tcbObject[e]}removeItem(e){delete gt.adapter.root.tcbObject[e]}clear(){delete gt.adapter.root.tcbObject}}function wt(e,t){switch(e){case"local":return t.localStorage||new _t;case"none":return new _t;default:return t.sessionStorage||new _t}}class kt{constructor(e){if(!this._storage){this._persistence=gt.adapter.primaryStorage||e.persistence,this._storage=wt(this._persistence,gt.adapter);const t=`access_token_${e.env}`,s=`access_token_expire_${e.env}`,n=`refresh_token_${e.env}`,o=`anonymous_uuid_${e.env}`,i=`login_type_${e.env}`,r=`user_info_${e.env}`;this.keys={accessTokenKey:t,accessTokenExpireKey:s,refreshTokenKey:n,anonymousUuidKey:o,loginTypeKey:i,userInfoKey:r}}}updatePersistence(e){if(e===this._persistence)return;const t="local"===this._persistence;this._persistence=e;const s=wt(e,gt.adapter);for(const n in this.keys){const e=this.keys[n];if(t&&yt.includes(n))continue;const o=this._storage.getItem(e);ft(o)||pt(o)||(s.setItem(e,o),this._storage.removeItem(e))}this._storage=s}setStore(e,t,s){if(!this._storage)return;const n={version:s||"localCachev1",content:t},o=JSON.stringify(n);try{this._storage.setItem(e,o)}catch(i){throw i}}getStore(e,t){try{if(!this._storage)return}catch(n){return""}t=t||"localCachev1";const s=this._storage.getItem(e);return s&&s.indexOf(t)>=0?JSON.parse(s).content:""}removeStore(e){this._storage.removeItem(e)}}const bt={},vt={};function St(e){return bt[e]}class It{constructor(e,t){this.data=t||null,this.name=e}}class Tt extends It{constructor(e,t){super("error",{error:e,data:t}),this.error=e}}const xt=new class{constructor(){this._listeners={}}on(e,t){return s=e,n=t,(o=this._listeners)[s]=o[s]||[],o[s].push(n),this;var s,n,o}off(e,t){return function(e,t,s){if(s&&s[e]){const n=s[e].indexOf(t);-1!==n&&s[e].splice(n,1)}}(e,t,this._listeners),this}fire(e,t){if(e instanceof Tt)return console.error(e.error),this;const s="string"==typeof e?new It(e,t||{}):e,n=s.name;if(this._listens(n)){s.target=this;const e=this._listeners[n]?[...this._listeners[n]]:[];for(const t of e)t.call(this,s)}return this}_listens(e){return this._listeners[e]&&this._listeners[e].length>0}};function At(e,t){xt.on(e,t)}function Pt(e,t={}){xt.fire(e,t)}function Ct(e,t){xt.off(e,t)}const Ot="loginStateChanged",Et="loginStateExpire",Rt="loginTypeChanged",Lt="anonymousConverted",Dt="refreshAccessToken";var Ut;!function(e){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.NULL="NULL"}(Ut||(Ut={}));const Nt=["auth.getJwt","auth.logout","auth.signInWithTicket","auth.signInAnonymously","auth.signIn","auth.fetchAccessTokenWithRefreshToken","auth.signUpWithEmailAndPassword","auth.activateEndUserMail","auth.sendPasswordResetEmail","auth.resetPasswordWithToken","auth.isUsernameRegistered"],Mt={"X-SDK-Version":"1.3.5"};function Ft(e,t,s){const n=e[t];e[t]=function(t){const o={},i={};s.forEach((s=>{const{data:n,headers:r}=s.call(e,t);Object.assign(o,n),Object.assign(i,r)}));const r=t.data;return r&&(()=>{var e;if(e=r,"[object FormData]"!==Object.prototype.toString.call(e))t.data={...r,...o};else for(const t in o)r.append(t,o[t])})(),t.headers={...t.headers||{},...i},n.call(e,t)}}function $t(){const e=Math.random().toString(16).slice(2);return{data:{seqId:e},headers:{...Mt,"x-seqid":e}}}class qt{constructor(e={}){var t;this.config=e,this._reqClass=new gt.adapter.reqClass({timeout:this.config.timeout,timeoutMsg:`请求在${this.config.timeout/1e3}s内未完成,已中断`,restrictedMethods:["post"]}),this._cache=St(this.config.env),this._localCache=(t=this.config.env,vt[t]),Ft(this._reqClass,"post",[$t]),Ft(this._reqClass,"upload",[$t]),Ft(this._reqClass,"download",[$t])}async post(e){return await this._reqClass.post(e)}async upload(e){return await this._reqClass.upload(e)}async download(e){return await this._reqClass.download(e)}async refreshAccessToken(){let e,t;this._refreshAccessTokenPromise||(this._refreshAccessTokenPromise=this._refreshAccessToken());try{e=await this._refreshAccessTokenPromise}catch(s){t=s}if(this._refreshAccessTokenPromise=null,this._shouldRefreshAccessTokenHook=null,t)throw t;return e}async _refreshAccessToken(){const{accessTokenKey:e,accessTokenExpireKey:t,refreshTokenKey:s,loginTypeKey:n,anonymousUuidKey:o}=this._cache.keys;this._cache.removeStore(e),this._cache.removeStore(t);let i=this._cache.getStore(s);if(!i)throw new Ke({message:"未登录CloudBase"});const r={refresh_token:i},a=await this.request("auth.fetchAccessTokenWithRefreshToken",r);if(a.data.code){const{code:e}=a.data;if("SIGN_PARAM_INVALID"===e||"REFRESH_TOKEN_EXPIRED"===e||"INVALID_REFRESH_TOKEN"===e){if(this._cache.getStore(n)===Ut.ANONYMOUS&&"INVALID_REFRESH_TOKEN"===e){const e=this._cache.getStore(o),t=this._cache.getStore(s),n=await this.send("auth.signInAnonymously",{anonymous_uuid:e,refresh_token:t});return this.setRefreshToken(n.refresh_token),this._refreshAccessToken()}Pt(Et),this._cache.removeStore(s)}throw new Ke({code:a.data.code,message:`刷新access token失败:${a.data.code}`})}if(a.data.access_token)return Pt(Dt),this._cache.setStore(e,a.data.access_token),this._cache.setStore(t,a.data.access_token_expire+Date.now()),{accessToken:a.data.access_token,accessTokenExpire:a.data.access_token_expire};a.data.refresh_token&&(this._cache.removeStore(s),this._cache.setStore(s,a.data.refresh_token),this._refreshAccessToken())}async getAccessToken(){const{accessTokenKey:e,accessTokenExpireKey:t,refreshTokenKey:s}=this._cache.keys;if(!this._cache.getStore(s))throw new Ke({message:"refresh token不存在,登录状态异常"});let n=this._cache.getStore(e),o=this._cache.getStore(t),i=!0;return this._shouldRefreshAccessTokenHook&&!(await this._shouldRefreshAccessTokenHook(n,o))&&(i=!1),(!n||!o||o<Date.now())&&i?this.refreshAccessToken():{accessToken:n,accessTokenExpire:o}}async request(e,t,s){const n=`x-tcb-trace_${this.config.env}`;let o="application/x-www-form-urlencoded";const i={action:e,env:this.config.env,dataVersion:"2019-08-16",...t};if(-1===Nt.indexOf(e)){const{refreshTokenKey:e}=this._cache.keys;this._cache.getStore(e)&&(i.access_token=(await this.getAccessToken()).accessToken)}let r;if("storage.uploadFile"===e){r=new FormData;for(let e in r)r.hasOwnProperty(e)&&void 0!==r[e]&&r.append(e,i[e]);o="multipart/form-data"}else{o="application/json",r={};for(let e in i)void 0!==i[e]&&(r[e]=i[e])}let a={headers:{"content-type":o}};s&&s.onUploadProgress&&(a.onUploadProgress=s.onUploadProgress);const c=this._localCache.getStore(n);c&&(a.headers["X-TCB-Trace"]=c);const{parse:l,inQuery:u,search:d}=t;let h={env:this.config.env};l&&(h.parse=!0),u&&(h={...u,...h});let f=function(e,t,s={}){const n=/\?/.test(t);let o="";for(let i in s)""===o?!n&&(t+="?"):o+="&",o+=`${i}=${encodeURIComponent(s[i])}`;return/^http(s)?\:\/\//.test(t+=o)?t:`${e}${t}`}(it,"//tcb-api.tencentcloudapi.com/web",h);d&&(f+=d);const p=await this.post({url:f,data:r,...a}),m=p.header&&p.header["x-tcb-trace"];if(m&&this._localCache.setStore(n,m),200!==Number(p.status)&&200!==Number(p.statusCode)||!p.data)throw new Ke({code:"NETWORK_ERROR",message:"network request error"});return p}async send(e,t={}){const s=await this.request(e,t,{onUploadProgress:t.onUploadProgress});if("ACCESS_TOKEN_EXPIRED"===s.data.code&&-1===Nt.indexOf(e)){await this.refreshAccessToken();const s=await this.request(e,t,{onUploadProgress:t.onUploadProgress});if(s.data.code)throw new Ke({code:s.data.code,message:s.data.message});return s.data}if(s.data.code)throw new Ke({code:s.data.code,message:s.data.message});return s.data}setRefreshToken(e){const{accessTokenKey:t,accessTokenExpireKey:s,refreshTokenKey:n}=this._cache.keys;this._cache.removeStore(t),this._cache.removeStore(s),this._cache.setStore(n,e)}}const jt={};function Bt(e){return jt[e]}class Kt{constructor(e){this.config=e,this._cache=St(e.env),this._request=Bt(e.env)}setRefreshToken(e){const{accessTokenKey:t,accessTokenExpireKey:s,refreshTokenKey:n}=this._cache.keys;this._cache.removeStore(t),this._cache.removeStore(s),this._cache.setStore(n,e)}setAccessToken(e,t){const{accessTokenKey:s,accessTokenExpireKey:n}=this._cache.keys;this._cache.setStore(s,e),this._cache.setStore(n,t)}async refreshUserInfo(){const{data:e}=await this._request.send("auth.getUserInfo",{});return this.setLocalUserInfo(e),e}setLocalUserInfo(e){const{userInfoKey:t}=this._cache.keys;this._cache.setStore(t,e)}}class Ht{constructor(e){if(!e)throw new Ke({code:"PARAM_ERROR",message:"envId is not defined"});this._envId=e,this._cache=St(this._envId),this._request=Bt(this._envId),this.setUserInfo()}linkWithTicket(e){if("string"!=typeof e)throw new Ke({code:"PARAM_ERROR",message:"ticket must be string"});return this._request.send("auth.linkWithTicket",{ticket:e})}linkWithRedirect(e){e.signInWithRedirect()}updatePassword(e,t){return this._request.send("auth.updatePassword",{oldPassword:t,newPassword:e})}updateEmail(e){return this._request.send("auth.updateEmail",{newEmail:e})}updateUsername(e){if("string"!=typeof e)throw new Ke({code:"PARAM_ERROR",message:"username must be a string"});return this._request.send("auth.updateUsername",{username:e})}async getLinkedUidList(){const{data:e}=await this._request.send("auth.getLinkedUidList",{});let t=!1;const{users:s}=e;return s.forEach((e=>{e.wxOpenId&&e.wxPublicId&&(t=!0)})),{users:s,hasPrimaryUid:t}}setPrimaryUid(e){return this._request.send("auth.setPrimaryUid",{uid:e})}unlink(e){return this._request.send("auth.unlink",{platform:e})}async update(e){const{nickName:t,gender:s,avatarUrl:n,province:o,country:i,city:r}=e,{data:a}=await this._request.send("auth.updateUserInfo",{nickName:t,gender:s,avatarUrl:n,province:o,country:i,city:r});this.setLocalUserInfo(a)}async refresh(){const{data:e}=await this._request.send("auth.getUserInfo",{});return this.setLocalUserInfo(e),e}setUserInfo(){const{userInfoKey:e}=this._cache.keys,t=this._cache.getStore(e);["uid","loginType","openid","wxOpenId","wxPublicId","unionId","qqMiniOpenId","email","hasPassword","customUserId","nickName","gender","avatarUrl"].forEach((e=>{this[e]=t[e]})),this.location={country:t.country,province:t.province,city:t.city}}setLocalUserInfo(e){const{userInfoKey:t}=this._cache.keys;this._cache.setStore(t,e),this.setUserInfo()}}class Vt{constructor(e){if(!e)throw new Ke({code:"PARAM_ERROR",message:"envId is not defined"});this._cache=St(e);const{refreshTokenKey:t,accessTokenKey:s,accessTokenExpireKey:n}=this._cache.keys,o=this._cache.getStore(t),i=this._cache.getStore(s),r=this._cache.getStore(n);this.credential={refreshToken:o,accessToken:i,accessTokenExpire:r},this.user=new Ht(e)}get isAnonymousAuth(){return this.loginType===Ut.ANONYMOUS}get isCustomAuth(){return this.loginType===Ut.CUSTOM}get isWeixinAuth(){return this.loginType===Ut.WECHAT||this.loginType===Ut.WECHAT_OPEN||this.loginType===Ut.WECHAT_PUBLIC}get loginType(){return this._cache.getStore(this._cache.keys.loginTypeKey)}}class Wt extends Kt{async signIn(){this._cache.updatePersistence("local");const{anonymousUuidKey:e,refreshTokenKey:t}=this._cache.keys,s=this._cache.getStore(e)||void 0,n=this._cache.getStore(t)||void 0,o=await this._request.send("auth.signInAnonymously",{anonymous_uuid:s,refresh_token:n});if(o.uuid&&o.refresh_token){this._setAnonymousUUID(o.uuid),this.setRefreshToken(o.refresh_token),await this._request.refreshAccessToken(),Pt(Ot),Pt(Rt,{env:this.config.env,loginType:Ut.ANONYMOUS,persistence:"local"});const e=new Vt(this.config.env);return await e.user.refresh(),e}throw new Ke({message:"匿名登录失败"})}async linkAndRetrieveDataWithTicket(e){const{anonymousUuidKey:t,refreshTokenKey:s}=this._cache.keys,n=this._cache.getStore(t),o=this._cache.getStore(s),i=await this._request.send("auth.linkAndRetrieveDataWithTicket",{anonymous_uuid:n,refresh_token:o,ticket:e});if(i.refresh_token)return this._clearAnonymousUUID(),this.setRefreshToken(i.refresh_token),await this._request.refreshAccessToken(),Pt(Lt,{env:this.config.env}),Pt(Rt,{loginType:Ut.CUSTOM,persistence:"local"}),{credential:{refreshToken:i.refresh_token}};throw new Ke({message:"匿名转化失败"})}_setAnonymousUUID(e){const{anonymousUuidKey:t,loginTypeKey:s}=this._cache.keys;this._cache.removeStore(t),this._cache.setStore(t,e),this._cache.setStore(s,Ut.ANONYMOUS)}_clearAnonymousUUID(){this._cache.removeStore(this._cache.keys.anonymousUuidKey)}}class zt extends Kt{async signIn(e){if("string"!=typeof e)throw new Ke({code:"PARAM_ERROR",message:"ticket must be a string"});const{refreshTokenKey:t}=this._cache.keys,s=await this._request.send("auth.signInWithTicket",{ticket:e,refresh_token:this._cache.getStore(t)||""});if(s.refresh_token)return this.setRefreshToken(s.refresh_token),await this._request.refreshAccessToken(),Pt(Ot),Pt(Rt,{env:this.config.env,loginType:Ut.CUSTOM,persistence:this.config.persistence}),await this.refreshUserInfo(),new Vt(this.config.env);throw new Ke({message:"自定义登录失败"})}}class Jt extends Kt{async signIn(e,t){if("string"!=typeof e)throw new Ke({code:"PARAM_ERROR",message:"email must be a string"});const{refreshTokenKey:s}=this._cache.keys,n=await this._request.send("auth.signIn",{loginType:"EMAIL",email:e,password:t,refresh_token:this._cache.getStore(s)||""}),{refresh_token:o,access_token:i,access_token_expire:r}=n;if(o)return this.setRefreshToken(o),i&&r?this.setAccessToken(i,r):await this._request.refreshAccessToken(),await this.refreshUserInfo(),Pt(Ot),Pt(Rt,{env:this.config.env,loginType:Ut.EMAIL,persistence:this.config.persistence}),new Vt(this.config.env);throw n.code?new Ke({code:n.code,message:`邮箱登录失败: ${n.message}`}):new Ke({message:"邮箱登录失败"})}async activate(e){return this._request.send("auth.activateEndUserMail",{token:e})}async resetPasswordWithToken(e,t){return this._request.send("auth.resetPasswordWithToken",{token:e,newPassword:t})}}class Yt extends Kt{async signIn(e,t){if("string"!=typeof e)throw new Ke({code:"PARAM_ERROR",message:"username must be a string"});"string"!=typeof t&&(t="",console.warn("password is empty"));const{refreshTokenKey:s}=this._cache.keys,n=await this._request.send("auth.signIn",{loginType:Ut.USERNAME,username:e,password:t,refresh_token:this._cache.getStore(s)||""}),{refresh_token:o,access_token_expire:i,access_token:r}=n;if(o)return this.setRefreshToken(o),r&&i?this.setAccessToken(r,i):await this._request.refreshAccessToken(),await this.refreshUserInfo(),Pt(Ot),Pt(Rt,{env:this.config.env,loginType:Ut.USERNAME,persistence:this.config.persistence}),new Vt(this.config.env);throw n.code?new Ke({code:n.code,message:`用户名密码登录失败: ${n.message}`}):new Ke({message:"用户名密码登录失败"})}}class Qt{constructor(e){this.config=e,this._cache=St(e.env),this._request=Bt(e.env),this._onAnonymousConverted=this._onAnonymousConverted.bind(this),this._onLoginTypeChanged=this._onLoginTypeChanged.bind(this),At(Rt,this._onLoginTypeChanged)}get currentUser(){const e=this.hasLoginState();return e&&e.user||null}get loginType(){return this._cache.getStore(this._cache.keys.loginTypeKey)}anonymousAuthProvider(){return new Wt(this.config)}customAuthProvider(){return new zt(this.config)}emailAuthProvider(){return new Jt(this.config)}usernameAuthProvider(){return new Yt(this.config)}async signInAnonymously(){return new Wt(this.config).signIn()}async signInWithEmailAndPassword(e,t){return new Jt(this.config).signIn(e,t)}signInWithUsernameAndPassword(e,t){return new Yt(this.config).signIn(e,t)}async linkAndRetrieveDataWithTicket(e){return this._anonymousAuthProvider||(this._anonymousAuthProvider=new Wt(this.config)),At(Lt,this._onAnonymousConverted),await this._anonymousAuthProvider.linkAndRetrieveDataWithTicket(e)}async signOut(){if(this.loginType===Ut.ANONYMOUS)throw new Ke({message:"匿名用户不支持登出操作"});const{refreshTokenKey:e,accessTokenKey:t,accessTokenExpireKey:s}=this._cache.keys,n=this._cache.getStore(e);if(!n)return;const o=await this._request.send("auth.logout",{refresh_token:n});return this._cache.removeStore(e),this._cache.removeStore(t),this._cache.removeStore(s),Pt(Ot),Pt(Rt,{env:this.config.env,loginType:Ut.NULL,persistence:this.config.persistence}),o}async signUpWithEmailAndPassword(e,t){return this._request.send("auth.signUpWithEmailAndPassword",{email:e,password:t})}async sendPasswordResetEmail(e){return this._request.send("auth.sendPasswordResetEmail",{email:e})}onLoginStateChanged(e){At(Ot,(()=>{const t=this.hasLoginState();e.call(this,t)}));const t=this.hasLoginState();e.call(this,t)}onLoginStateExpired(e){At(Et,e.bind(this))}onAccessTokenRefreshed(e){At(Dt,e.bind(this))}onAnonymousConverted(e){At(Lt,e.bind(this))}onLoginTypeChanged(e){At(Rt,(()=>{const t=this.hasLoginState();e.call(this,t)}))}async getAccessToken(){return{accessToken:(await this._request.getAccessToken()).accessToken,env:this.config.env}}hasLoginState(){const{refreshTokenKey:e}=this._cache.keys;return this._cache.getStore(e)?new Vt(this.config.env):null}async isUsernameRegistered(e){if("string"!=typeof e)throw new Ke({code:"PARAM_ERROR",message:"username must be a string"});const{data:t}=await this._request.send("auth.isUsernameRegistered",{username:e});return t&&t.isRegistered}getLoginState(){return Promise.resolve(this.hasLoginState())}async signInWithTicket(e){return new zt(this.config).signIn(e)}shouldRefreshAccessToken(e){this._request._shouldRefreshAccessTokenHook=e.bind(this)}getUserInfo(){return this._request.send("auth.getUserInfo",{}).then((e=>e.code?e:{...e.data,requestId:e.seqId}))}getAuthHeader(){const{refreshTokenKey:e,accessTokenKey:t}=this._cache.keys,s=this._cache.getStore(e);return{"x-cloudbase-credentials":this._cache.getStore(t)+"/@@/"+s}}_onAnonymousConverted(e){const{env:t}=e.data;t===this.config.env&&this._cache.updatePersistence(this.config.persistence)}_onLoginTypeChanged(e){const{loginType:t,persistence:s,env:n}=e.data;n===this.config.env&&(this._cache.updatePersistence(s),this._cache.setStore(this._cache.keys.loginTypeKey,t))}}const Gt=function(e,t){t=t||ht();const s=Bt(this.config.env),{cloudPath:n,filePath:o,onUploadProgress:i,fileType:r="image"}=e;return s.send("storage.getUploadMetadata",{path:n}).then((e=>{const{data:{url:a,authorization:c,token:l,fileId:u,cosFileId:d},requestId:h}=e,f={key:n,signature:c,"x-cos-meta-fileid":d,success_action_status:"201","x-cos-security-token":l};s.upload({url:a,data:f,file:o,name:n,fileType:r,onUploadProgress:i}).then((e=>{201===e.statusCode?t(null,{fileID:u,requestId:h}):t(new Ke({code:"STORAGE_REQUEST_FAIL",message:`STORAGE_REQUEST_FAIL: ${e.data}`}))})).catch((e=>{t(e)}))})).catch((e=>{t(e)})),t.promise},Xt=function(e,t){t=t||ht();const s=Bt(this.config.env),{cloudPath:n}=e;return s.send("storage.getUploadMetadata",{path:n}).then((e=>{t(null,e)})).catch((e=>{t(e)})),t.promise},Zt=function({fileList:e},t){if(t=t||ht(),!e||!Array.isArray(e))return{code:"INVALID_PARAM",message:"fileList必须是非空的数组"};for(let n of e)if(!n||"string"!=typeof n)return{code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"};const s={fileid_list:e};return Bt(this.config.env).send("storage.batchDeleteFile",s).then((e=>{e.code?t(null,e):t(null,{fileList:e.data.delete_list,requestId:e.requestId})})).catch((e=>{t(e)})),t.promise},es=function({fileList:e},t){t=t||ht(),e&&Array.isArray(e)||t(null,{code:"INVALID_PARAM",message:"fileList必须是非空的数组"});let s=[];for(let o of e)"object"==typeof o?(o.hasOwnProperty("fileID")&&o.hasOwnProperty("maxAge")||t(null,{code:"INVALID_PARAM",message:"fileList的元素必须是包含fileID和maxAge的对象"}),s.push({fileid:o.fileID,max_age:o.maxAge})):"string"==typeof o?s.push({fileid:o}):t(null,{code:"INVALID_PARAM",message:"fileList的元素必须是字符串"});const n={file_list:s};return Bt(this.config.env).send("storage.batchGetDownloadUrl",n).then((e=>{e.code?t(null,e):t(null,{fileList:e.data.download_list,requestId:e.requestId})})).catch((e=>{t(e)})),t.promise},ts=async function({fileID:e},t){const s=(await es.call(this,{fileList:[{fileID:e,maxAge:600}]})).fileList[0];if("SUCCESS"!==s.code)return t?t(s):new Promise((e=>{e(s)}));const n=Bt(this.config.env);let o=s.download_url;if(o=encodeURI(o),!t)return n.download({url:o});t(await n.download({url:o}))},ss=function({name:e,data:t,query:s,parse:n,search:o},i){const r=i||ht();let a;try{a=t?JSON.stringify(t):""}catch(l){return Promise.reject(l)}if(!e)return Promise.reject(new Ke({code:"PARAM_ERROR",message:"函数名不能为空"}));const c={inQuery:s,parse:n,search:o,function_name:e,request_data:a};return Bt(this.config.env).send("functions.invokeFunction",c).then((e=>{if(e.code)r(null,e);else{let s=e.data.response_data;if(n)r(null,{result:s,requestId:e.requestId});else try{s=JSON.parse(e.data.response_data),r(null,{result:s,requestId:e.requestId})}catch(t){r(new Ke({message:"response data must be json"}))}}return r.promise})).catch((e=>{r(e)})),r.promise},ns={timeout:15e3,persistence:"session"},os={};class is{constructor(e){this.config=e||this.config,this.authObj=void 0}init(e){switch(gt.adapter||(this.requestClient=new gt.adapter.reqClass({timeout:e.timeout||5e3,timeoutMsg:`请求在${(e.timeout||5e3)/1e3}s内未完成,已中断`})),this.config={...ns,...e},!0){case this.config.timeout>6e5:console.warn("timeout大于可配置上限[10分钟],已重置为上限数值"),this.config.timeout=6e5;break;case this.config.timeout<100:console.warn("timeout小于可配置下限[100ms],已重置为下限数值"),this.config.timeout=100}return new is(this.config)}auth({persistence:e}={}){if(this.authObj)return this.authObj;const t=e||gt.adapter.primaryStorage||ns.persistence;var s;return t!==this.config.persistence&&(this.config.persistence=t),function(e){const{env:t}=e;bt[t]=new kt(e),vt[t]=new kt({...e,persistence:"local"})}(this.config),s=this.config,jt[s.env]=new qt(s),this.authObj=new Qt(this.config),this.authObj}on(e,t){return At.apply(this,[e,t])}off(e,t){return Ct.apply(this,[e,t])}callFunction(e,t){return ss.apply(this,[e,t])}deleteFile(e,t){return Zt.apply(this,[e,t])}getTempFileURL(e,t){return es.apply(this,[e,t])}downloadFile(e,t){return ts.apply(this,[e,t])}uploadFile(e,t){return Gt.apply(this,[e,t])}getUploadMetadata(e,t){return Xt.apply(this,[e,t])}registerExtension(e){os[e.name]=e}async invokeExtension(e,t){const s=os[e];if(!s)throw new Ke({message:`扩展${e} 必须先注册`});return await s.invoke(t,this)}useAdapters(e){const{adapter:t,runtime:s}=function(e){const t=(s=e,"[object Array]"===Object.prototype.toString.call(s)?e:[e]);var s;for(const n of t){const{isMatch:e,genAdapter:t,runtime:s}=n;if(e())return{adapter:t(),runtime:s}}}(e)||{};t&&(gt.adapter=t),s&&(gt.runtime=s)}}var rs=new is;function as(e,t,s){void 0===s&&(s={});var n=/\?/.test(t),o="";for(var i in s)""===o?!n&&(t+="?"):o+="&",o+=i+"="+encodeURIComponent(s[i]);return/^http(s)?:\/\//.test(t+=o)?t:""+e+t}class cs{post(e){const{url:t,data:s,headers:n}=e;return new Promise(((e,o)=>{He.request({url:as("https:",t),data:s,method:"POST",header:n,success(t){e(t)},fail(e){o(e)}})}))}upload(e){return new Promise(((t,s)=>{const{url:n,file:o,data:i,headers:r,fileType:a}=e,c=He.uploadFile({url:as("https:",n),name:"file",formData:Object.assign({},i),filePath:o,fileType:a,header:r,success(e){const s={statusCode:e.statusCode,data:e.data||{}};200===e.statusCode&&i.success_action_status&&(s.statusCode=parseInt(i.success_action_status,10)),t(s)},fail(e){s(new Error(e.errMsg||"uploadFile:fail"))}});"function"==typeof e.onUploadProgress&&c&&"function"==typeof c.onProgressUpdate&&c.onProgressUpdate((t=>{e.onUploadProgress({loaded:t.totalBytesSent,total:t.totalBytesExpectedToSend})}))}))}}const ls={setItem(e,t){He.setStorageSync(e,t)},getItem:e=>He.getStorageSync(e),removeItem(e){He.removeStorageSync(e)},clear(){He.clearStorageSync()}};var us={genAdapter:function(){return{root:{},reqClass:cs,localStorage:ls,primaryStorage:"local"}},isMatch:function(){return!0},runtime:"uni_app"};rs.useAdapters(us);const ds=rs,hs=ds.init;ds.init=function(e){e.env=e.spaceId;const t=hs.call(this,e);t.config.provider="tencent",t.config.spaceId=e.spaceId;const s=t.auth;return t.auth=function(e){const t=s.call(this,e);return["linkAndRetrieveDataWithTicket","signInAnonymously","signOut","getAccessToken","getLoginState","signInWithTicket","getUserInfo"].forEach((e=>{var s;t[e]=(s=t[e],function(e){e=e||{};const{success:t,fail:n,complete:o}=Be(e);if(!(t||n||o))return s.call(this,e);s.call(this,e).then((e=>{t&&t(e),o&&o(e)}),(e=>{n&&n(e),o&&o(e)}))}).bind(t)})),t},t.customAuth=t.auth,t};var fs=ds,ps=class extends nt{getAccessToken(){return new Promise(((e,t)=>{const s="Anonymous_Access_token";this.setAccessToken(s),e(s)}))}setupRequest(e,t){const s=Object.assign({},e,{spaceId:this.config.spaceId,timestamp:Date.now()}),n={"Content-Type":"application/json"};"auth"!==t&&(s.token=this.accessToken,n["x-basement-token"]=this.accessToken),n["x-serverless-sign"]=et(s,this.config.clientSecret);const o=Ze();n["x-client-info"]=encodeURIComponent(JSON.stringify(o));const{token:i}=We();return n["x-client-token"]=i,{url:this.config.requestUrl,method:"POST",data:s,dataType:"json",header:JSON.parse(JSON.stringify(n))}}uploadFileToOSS({url:e,formData:t,name:s,filePath:n,fileType:o,onUploadProgress:i}){return new Promise(((r,a)=>{const c=this.adapter.uploadFile({url:e,formData:t,name:s,filePath:n,fileType:o,success(e){e&&e.statusCode<400?r(e):a(new Ke({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(e){a(new Ke({code:e.code||"UPLOAD_FAILED",message:e.message||e.errMsg||"文件上传失败"}))}});"function"==typeof i&&c&&"function"==typeof c.onProgressUpdate&&c.onProgressUpdate((e=>{i({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend})}))}))}uploadFile({filePath:e,cloudPath:t,fileType:s="image",onUploadProgress:n}){if(!t)throw new Ke({code:"CLOUDPATH_REQUIRED",message:"cloudPath不可为空"});let o;return this.getOSSUploadOptionsFromPath({cloudPath:t}).then((t=>{const{url:i,formData:r,name:a}=t.result;o=t.result.fileUrl;const c={url:i,formData:r,name:a,filePath:e,fileType:s};return this.uploadFileToOSS(Object.assign({},c,{onUploadProgress:n}))})).then((()=>this.reportOSSUpload({cloudPath:t}))).then((t=>new Promise(((s,n)=>{t.success?s({success:!0,filePath:e,fileID:o}):n(new Ke({code:"UPLOAD_FAILED",message:"文件上传失败"}))}))))}deleteFile({fileList:e}){const t={method:"serverless.file.resource.delete",params:JSON.stringify({fileList:e})};return this.request(this.setupRequest(t)).then((e=>{if(e.success)return e.result;throw new Ke({code:"DELETE_FILE_FAILED",message:"删除文件失败"})}))}getTempFileURL({fileList:e,maxAge:t}={}){if(!Array.isArray(e)||0===e.length)throw new Ke({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"});const s={method:"serverless.file.resource.getTempFileURL",params:JSON.stringify({fileList:e,maxAge:t})};return this.request(this.setupRequest(s)).then((e=>{if(e.success)return{fileList:e.result.fileList.map((e=>({fileID:e.fileID,tempFileURL:e.tempFileURL})))};throw new Ke({code:"GET_TEMP_FILE_URL_FAILED",message:"获取临时文件链接失败"})}))}},ms={init(e){const t=new ps(e),s={signInAnonymously:function(){return t.authorize()},getLoginState:function(){return Promise.resolve(!1)}};return t.auth=function(){return s},t.customAuth=t.auth,t}},gs=Z((function(e,t){e.exports=te.enc.Hex}));function ys(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}function _s(e="",t={}){const{data:s,functionName:n,method:o,headers:i,signHeaderKeys:r=[],config:a}=t,c=Date.now(),l=ys(),u=Object.assign({},i,{"x-from-app-id":a.spaceAppId,"x-from-env-id":a.spaceId,"x-to-env-id":a.spaceId,"x-from-instance-id":c,"x-from-function-name":n,"x-client-timestamp":c,"x-alipay-source":"client","x-request-id":l,"x-alipay-callid":l,"x-trace-id":l}),d=["x-from-app-id","x-from-env-id","x-to-env-id","x-from-instance-id","x-from-function-name","x-client-timestamp"].concat(r),[h="",f=""]=e.split("?")||[],p=function(e){const t=e.signedHeaders.join(";"),s=e.signedHeaders.map((t=>`${t.toLowerCase()}:${e.headers[t]}\n`)).join(""),n=ut(e.body).toString(gs),o=`${e.method.toUpperCase()}\n${e.path}\n${e.query}\n${s}\n${t}\n${n}\n`,i=ut(o).toString(gs),r=`HMAC-SHA256\n${e.timestamp}\n${i}\n`,a=dt(r,e.secretKey).toString(gs);return`HMAC-SHA256 Credential=${e.secretId}, SignedHeaders=${t}, Signature=${a}`}({path:h,query:f,method:o,headers:u,timestamp:c,body:JSON.stringify(s),secretId:a.accessKey,secretKey:a.secretKey,signedHeaders:d.sort()});return{url:`${a.endpoint}${e}`,headers:Object.assign({},u,{Authorization:p})}}function ws({url:e,data:t,method:s="POST",headers:n={}}){return new Promise(((o,i)=>{He.request({url:e,method:s,data:"object"==typeof t?JSON.stringify(t):t,header:n,dataType:"json",complete:(e={})=>{const t=n["x-trace-id"]||"";if(!e.statusCode||e.statusCode>=400){const{message:s,errMsg:n,trace_id:o}=e.data||{};return i(new Ke({code:"SYS_ERR",message:s||n||"request:fail",requestId:o||t}))}o({status:e.statusCode,data:e.data,headers:e.header,requestId:t})}})}))}function ks(e,t){const{path:s,data:n,method:o="GET"}=e,{url:i,headers:r}=_s(s,{functionName:"",data:n,method:o,headers:{"x-alipay-cloud-mode":"oss","x-data-api-type":"oss","x-expire-timestamp":Date.now()+6e4},signHeaderKeys:["x-data-api-type","x-expire-timestamp"],config:t});return ws({url:i,data:n,method:o,headers:r}).then((e=>{const t=e.data||{};if(!t.success)throw new Ke({code:e.errCode,message:e.errMsg,requestId:e.requestId});return t.data||{}})).catch((e=>{throw new Ke({code:e.errCode,message:e.errMsg,requestId:e.requestId})}))}function bs(e=""){const t=e.trim().replace(/^cloud:\/\//,""),s=t.indexOf("/");if(s<=0)throw new Ke({code:"INVALID_PARAM",message:"fileID不合法"});const n=t.substring(0,s),o=t.substring(s+1);return n!==this.config.spaceId&&console.warn("file ".concat(e," does not belong to env ").concat(this.config.spaceId)),o}function vs(e=""){return"cloud://".concat(this.config.spaceId,"/").concat(e.replace(/^\/+/,""))}class Ss{constructor(e){this.config=e}signedURL(e,t={}){const s=`/ws/function/${e}`,n=this.config.wsEndpoint.replace(/^ws(s)?:\/\//,""),o=Object.assign({},t,{accessKeyId:this.config.accessKey,signatureNonce:ys(),timestamp:""+Date.now()}),i=[s,["accessKeyId","authorization","signatureNonce","timestamp"].sort().map((function(e){return o[e]?"".concat(e,"=").concat(o[e]):null})).filter(Boolean).join("&"),`host:${n}`].join("\n"),r=["HMAC-SHA256",ut(i).toString(gs)].join("\n"),a=dt(r,this.config.secretKey).toString(gs),c=Object.keys(o).map((e=>`${e}=${encodeURIComponent(o[e])}`)).join("&");return`${this.config.wsEndpoint}${s}?${c}&signature=${a}`}}var Is={init:e=>{e.provider="alipay";const t=new class{constructor(e){if(["spaceId","spaceAppId","accessKey","secretKey"].forEach((t=>{if(!Object.prototype.hasOwnProperty.call(e,t))throw new Error(`${t} required`)})),e.endpoint){if("string"!=typeof e.endpoint)throw new Error("endpoint must be string");if(!/^https:\/\//.test(e.endpoint))throw new Error("endpoint must start with https://");e.endpoint=e.endpoint.replace(/\/$/,"")}this.config=Object.assign({},e,{endpoint:e.endpoint||`https://${e.spaceId}.api-hz.cloudbasefunction.cn`,wsEndpoint:e.wsEndpoint||`wss://${e.spaceId}.api-hz.cloudbasefunction.cn`}),this._websocket=new Ss(this.config)}callFunction(e){return function(e,t){const{name:s,data:n,async:o=!1}=e,i="POST",r={"x-to-function-name":s};o&&(r["x-function-invoke-type"]="async");const{url:a,headers:c}=_s("/functions/invokeFunction",{functionName:s,data:n,method:i,headers:r,signHeaderKeys:["x-to-function-name"],config:t});return ws({url:a,data:n,method:i,headers:c}).then((e=>{let t=0;if(o){const s=e.data||{};t="200"===s.errCode?0:s.errCode,e.data=s.data||{},e.errMsg=s.errMsg}if(0!==t)throw new Ke({code:t,message:e.errMsg,requestId:e.requestId});return{errCode:t,success:0===t,requestId:e.requestId,result:e.data}})).catch((e=>{throw new Ke({code:e.errCode,message:e.errMsg,requestId:e.requestId})}))}(e,this.config)}uploadFileToOSS({url:e,filePath:t,fileType:s,formData:n,onUploadProgress:o}){return new Promise(((i,r)=>{const a=He.uploadFile({url:e,filePath:t,fileType:s,formData:n,name:"file",success(e){e&&e.statusCode<400?i(e):r(new Ke({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(e){r(new Ke({code:e.code||"UPLOAD_FAILED",message:e.message||e.errMsg||"文件上传失败"}))}});"function"==typeof o&&a&&"function"==typeof a.onProgressUpdate&&a.onProgressUpdate((e=>{o({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend})}))}))}async uploadFile({filePath:e,cloudPath:t="",fileType:s="image",onUploadProgress:n}){if("string"!==ce(t))throw new Ke({code:"INVALID_PARAM",message:"cloudPath必须为字符串类型"});if(!(t=t.trim()))throw new Ke({code:"INVALID_PARAM",message:"cloudPath不可为空"});if(/:\/\//.test(t))throw new Ke({code:"INVALID_PARAM",message:"cloudPath不合法"});const o=await ks({path:"/".concat(t.replace(/^\//,""),"?post_url")},this.config),{file_id:i,upload_url:r,form_data:a}=o,c=a&&a.reduce(((e,t)=>(e[t.key]=t.value,e)),{});return this.uploadFileToOSS({url:r,filePath:e,fileType:s,formData:c,onUploadProgress:n}).then((()=>({fileID:i})))}async getTempFileURL({fileList:e}){return new Promise(((t,s)=>{(!e||e.length<0)&&s(new Ke({errCode:"INVALID_PARAM",errMsg:"fileList不能为空数组"})),e.length>50&&s(new Ke({errCode:"INVALID_PARAM",errMsg:"fileList数组长度不能超过50"}));const n=[];for(const o of e){"string"!==ce(o)&&s(new Ke({errCode:"INVALID_PARAM",errMsg:"fileList的元素必须是非空的字符串"}));const e=bs.call(this,o);n.push({file_id:e,expire:600})}ks({path:"/?download_url",data:{file_list:n},method:"POST"},this.config).then((e=>{const{file_list:s=[]}=e;t({fileList:s.map((e=>({fileID:vs.call(this,e.file_id),tempFileURL:e.download_url})))})})).catch((e=>s(e)))}))}async connectWebSocket(e){const{name:t,query:s}=e;return He.connectSocket({url:this._websocket.signedURL(t,s),complete:()=>{}})}}(e);return t.auth=function(){return{signInAnonymously:function(){return Promise.resolve()},getLoginState:function(){return Promise.resolve(!0)}}},t}};function Ts({data:e}){let t;t=Ze();const s=JSON.parse(JSON.stringify(e||{}));if(Object.assign(s,{clientInfo:t}),!s.uniIdToken){const{token:e}=We();e&&(s.uniIdToken=e)}return s}const xs=[{rule:/fc_function_not_found|FUNCTION_NOT_FOUND/,content:",云函数[{functionName}]在云端不存在,请检查此云函数名称是否正确以及该云函数是否已上传到服务空间",mode:"append"}];var As=/[\\^$.*+?()[\]{}|]/g,Ps=RegExp(As.source);function Cs(e,t,s){return e.replace(new RegExp((n=t)&&Ps.test(n)?n.replace(As,"\\$&"):n,"g"),s);var n}const Os=2e4,Es={code:20101,message:"Invalid client"};function Rs(e){const{errSubject:t,subject:s,errCode:n,errMsg:o,code:i,message:r,cause:a}=e||{};return new Ke({subject:t||s||"uni-secure-network",code:n||i||Os,message:o||r,cause:a})}let Ls;function Ds({secretType:e}={}){return"request"===e||"response"===e||"both"===e}function Us({functionName:e,result:t,logPvd:s}){}function Ns(e){const t=e.callFunction,s=function(s){const n=s.name;s.data=Ts.call(e,{data:s.data});const o={aliyun:"aliyun",tencent:"tcb",tcb:"tcb",alipay:"alipay"}[this.config.provider],i=Ds(s)||false;return t.call(this,s).then((e=>(e.errCode=0,!i&&Us.call(this,{functionName:n,result:e,logPvd:o}),Promise.resolve(e))),(e=>(!i&&Us.call(this,{functionName:n,result:e,logPvd:o}),e&&e.message&&(e.message=function({message:e="",extraInfo:t={},formatter:s=[]}={}){for(let n=0;n<s.length;n++){const{rule:o,content:i,mode:r}=s[n],a=e.match(o);if(!a)continue;let c=i;for(let e=1;e<a.length;e++)c=Cs(c,`{$${e}}`,a[e]);for(const e in t)c=Cs(c,`{${e}}`,t[e]);return"replace"===r?c:e+c}return e}({message:`[${s.name}]: ${e.message}`,formatter:xs,extraInfo:{functionName:n}})),Promise.reject(e))))};e.callFunction=function(t){const{provider:n,spaceId:o}=e.config,i=t.name;let r,a;return t.data=t.data||{},r=s,r=r.bind(e),a=Ds(t)?new Ls({secretType:t.secretType,uniCloudIns:e}).wrapEncryptDataCallFunction(s.bind(e))(t):function({provider:e,spaceId:t,functionName:s}={}){const{appId:n,uniPlatform:o,osName:i}=Qe();let r=o;"app"===o&&(r=i);const a=function({provider:e,spaceId:t}={}){const s=ge;if(!s)return{};e=function(e){return"tencent"===e?"tcb":e}(e);const n=s.find((s=>s.provider===e&&s.spaceId===t));return n&&n.config}({provider:e,spaceId:t});if(!a||!a.accessControl||!a.accessControl.enable)return!1;const c=a.accessControl.function||{},l=Object.keys(c);if(0===l.length)return!0;const u=function(e,t){let s,n,o;for(let i=0;i<e.length;i++){const r=e[i];r!==t?"*"!==r?r.split(",").map((e=>e.trim())).indexOf(t)>-1&&(n=r):o=r:s=r}return s||n||o}(l,s);if(!u)return!1;if((c[u]||[]).find(((e={})=>e.appId===n&&(e.platform||"").toLowerCase()===r.toLowerCase())))return!0;throw console.error(`此应用[appId: ${n}, platform: ${r}]不在云端配置的允许访问的应用列表内,参考:https://uniapp.dcloud.net.cn/uniCloud/secure-network.html#verify-client`),Rs(Es)}({provider:n,spaceId:o,functionName:i})?new Ls({secretType:t.secretType,uniCloudIns:e}).wrapVerifyClientCallFunction(s.bind(e))(t):r(t),Object.defineProperty(a,"result",{get:()=>(console.warn("当前返回结果为Promise类型,不可直接访问其result属性,详情请参考:https://uniapp.dcloud.net.cn/uniCloud/faq?id=promise"),{})}),a.then((e=>("undefined"!=typeof UTSJSONObject&&(e.result=new UTSJSONObject(e.result)),e)))}}Ls=class{constructor(){throw Rs({message:"Platform web is not supported by secure network"})}};const Ms=Symbol("CLIENT_DB_INTERNAL");function Fs(e,t){return e.then="DoNotReturnProxyWithAFunctionNamedThen",e._internalType=Ms,e.inspect=null,e.__v_raw=void 0,new Proxy(e,{get(e,s,n){if("_uniClient"===s)return null;if("symbol"==typeof s)return e[s];if(s in e||"string"!=typeof s){const t=e[s];return"function"==typeof t?t.bind(e):t}return t.get(e,s,n)}})}function $s(e){return{on:(t,s)=>{e[t]=e[t]||[],e[t].indexOf(s)>-1||e[t].push(s)},off:(t,s)=>{e[t]=e[t]||[];const n=e[t].indexOf(s);-1!==n&&e[t].splice(n,1)}}}const qs=["db.Geo","db.command","command.aggregate"];function js(e,t){return qs.indexOf(`${e}.${t}`)>-1}function Bs(e){switch(ce(e=Ve(e))){case"array":return e.map((e=>Bs(e)));case"object":return e._internalType===Ms||Object.keys(e).forEach((t=>{e[t]=Bs(e[t])})),e;case"regexp":return{$regexp:{source:e.source,flags:e.flags}};case"date":return{$date:e.toISOString()};default:return e}}function Ks(e){return e&&e.content&&e.content.$method}class Hs{constructor(e,t,s){this.content=e,this.prevStage=t||null,this.udb=null,this._database=s}toJSON(){let e=this;const t=[e.content];for(;e.prevStage;)e=e.prevStage,t.push(e.content);return{$db:t.reverse().map((e=>({$method:e.$method,$param:Bs(e.$param)})))}}toString(){return JSON.stringify(this.toJSON())}getAction(){const e=this.toJSON().$db.find((e=>"action"===e.$method));return e&&e.$param&&e.$param[0]}getCommand(){return{$db:this.toJSON().$db.filter((e=>"action"!==e.$method))}}get isAggregate(){let e=this;for(;e;){const t=Ks(e),s=Ks(e.prevStage);if("aggregate"===t&&"collection"===s||"pipeline"===t)return!0;e=e.prevStage}return!1}get isCommand(){let e=this;for(;e;){if("command"===Ks(e))return!0;e=e.prevStage}return!1}get isAggregateCommand(){let e=this;for(;e;){const t=Ks(e),s=Ks(e.prevStage);if("aggregate"===t&&"command"===s)return!0;e=e.prevStage}return!1}getNextStageFn(e){const t=this;return function(){return Vs({$method:e,$param:Bs(Array.from(arguments))},t,t._database)}}get count(){return this.isAggregate?this.getNextStageFn("count"):function(){return this._send("count",Array.from(arguments))}}get remove(){return this.isCommand?this.getNextStageFn("remove"):function(){return this._send("remove",Array.from(arguments))}}get(){return this._send("get",Array.from(arguments))}get add(){return this.isCommand?this.getNextStageFn("add"):function(){return this._send("add",Array.from(arguments))}}update(){return this._send("update",Array.from(arguments))}end(){return this._send("end",Array.from(arguments))}get set(){return this.isCommand?this.getNextStageFn("set"):function(){throw new Error("JQL禁止使用set方法")}}_send(e,t){const s=this.getAction(),n=this.getCommand();return n.$db.push({$method:e,$param:Bs(t)}),this._database._callCloudFunction({action:s,command:n})}}function Vs(e,t,s){return Fs(new Hs(e,t,s),{get(e,t){let n="db";return e&&e.content&&(n=e.content.$method),js(n,t)?Vs({$method:t},e,s):function(){return Vs({$method:t,$param:Bs(Array.from(arguments))},e,s)}}})}function Ws({path:e,method:t}){return class{constructor(){this.param=Array.from(arguments)}toJSON(){return{$newDb:[...e.map((e=>({$method:e}))),{$method:t,$param:this.param}]}}toString(){return JSON.stringify(this.toJSON())}}}function zs(e,t={}){return Fs(new e(t),{get:(e,t)=>js("db",t)?Vs({$method:t},null,e):function(){return Vs({$method:t,$param:Bs(Array.from(arguments))},null,e)}})}class Js extends class{constructor({uniClient:e={},isJQL:t=!1}={}){this._uniClient=e,this._authCallBacks={},this._dbCallBacks={},e._isDefault&&(this._dbCallBacks=ke("_globalUniCloudDatabaseCallback")),t||(this.auth=$s(this._authCallBacks)),this._isJQL=t,Object.assign(this,$s(this._dbCallBacks)),this.env=Fs({},{get:(e,t)=>({$env:t})}),this.Geo=Fs({},{get:(e,t)=>Ws({path:["Geo"],method:t})}),this.serverDate=Ws({path:[],method:"serverDate"}),this.RegExp=Ws({path:[],method:"RegExp"})}getCloudEnv(e){if("string"!=typeof e||!e.trim())throw new Error("getCloudEnv参数错误");return{$env:e.replace("$cloudEnv_","")}}_callback(e,t){const s=this._dbCallBacks;s[e]&&s[e].forEach((e=>{e(...t)}))}_callbackAuth(e,t){const s=this._authCallBacks;s[e]&&s[e].forEach((e=>{e(...t)}))}multiSend(){const e=Array.from(arguments),t=e.map((e=>{const t=e.getAction(),s=e.getCommand();if("getTemp"!==s.$db[s.$db.length-1].$method)throw new Error("multiSend只支持子命令内使用getTemp");return{action:t,command:s}}));return this._callCloudFunction({multiCommand:t,queryList:e})}}{_parseResult(e){return this._isJQL?e.result:e}_callCloudFunction({action:e,command:t,multiCommand:s,queryList:n}){function o(e,t){if(s&&n)for(let s=0;s<n.length;s++){const o=n[s];o.udb&&"function"==typeof o.udb.setResult&&(t?o.udb.setResult(t):o.udb.setResult(e.result.dataList[s]))}}const i=this,r=this._isJQL?"databaseForJQL":"database";function a(e){return i._callback("error",[e]),Te(xe(r,"fail"),e).then((()=>Te(xe(r,"complete"),e))).then((()=>(o(null,e),Fe(Ce,{type:Re,content:e}),Promise.reject(e))))}const c=Te(xe(r,"invoke")),l=this._uniClient;return c.then((()=>l.callFunction({name:"DCloud-clientDB",type:"CLIENT_DB",data:{action:e,command:t,multiCommand:s}}))).then((e=>{const{code:t,message:s,token:n,tokenExpired:c,systemInfo:l=[]}=e.result;if(l)for(let o=0;o<l.length;o++){const{level:e,message:t,detail:s}=l[o],n=console[e]||console.log;let i="[System Info]"+t;s&&(i=`${i}\n详细信息:${s}`),n(i)}if(t)return a(new Ke({code:t,message:s,requestId:e.requestId}));e.result.errCode=e.result.errCode||e.result.code,e.result.errMsg=e.result.errMsg||e.result.message,n&&c&&(ze({token:n,tokenExpired:c}),this._callbackAuth("refreshToken",[{token:n,tokenExpired:c}]),this._callback("refreshToken",[{token:n,tokenExpired:c}]),Fe(Ee,{token:n,tokenExpired:c}));const u=[{prop:"affectedDocs",tips:"affectedDocs不再推荐使用,请使用inserted/deleted/updated/data.length替代"},{prop:"code",tips:"code不再推荐使用,请使用errCode替代"},{prop:"message",tips:"message不再推荐使用,请使用errMsg替代"}];for(let o=0;o<u.length;o++){const{prop:t,tips:s}=u[o];if(t in e.result){const n=e.result[t];Object.defineProperty(e.result,t,{get:()=>(console.warn(s),n)})}}return d=e,Te(xe(r,"success"),d).then((()=>Te(xe(r,"complete"),d))).then((()=>{o(d,null);const e=i._parseResult(d);return Fe(Ce,{type:Re,content:e}),Promise.resolve(e)}));var d}),(e=>(/fc_function_not_found|FUNCTION_NOT_FOUND/g.test(e.message)&&console.warn("clientDB未初始化,请在web控制台保存一次schema以开启clientDB"),a(new Ke({code:e.code||"SYSTEM_ERROR",message:e.message,requestId:e.requestId})))))}}const Ys="token无效,跳转登录页面",Qs="token过期,跳转登录页面",Gs={TOKEN_INVALID_TOKEN_EXPIRED:Qs,TOKEN_INVALID_INVALID_CLIENTID:Ys,TOKEN_INVALID:Ys,TOKEN_INVALID_WRONG_TOKEN:Ys,TOKEN_INVALID_ANONYMOUS_USER:Ys},Xs={"uni-id-token-expired":Qs,"uni-id-check-token-failed":Ys,"uni-id-token-not-exist":Ys,"uni-id-check-device-feature-failed":Ys};function Zs(e,t){let s="";return s=e?`${e}/${t}`:t,s.replace(/^\//,"")}function en(e=[],t=""){const s=[],n=[];return e.forEach((e=>{!0===e.needLogin?s.push(Zs(t,e.path)):!1===e.needLogin&&n.push(Zs(t,e.path))})),{needLoginPage:s,notNeedLoginPage:n}}function tn(e){return e.split("?")[0].replace(/^\//,"")}function sn(){return function(e){let t=e&&e.$page&&e.$page.fullPath||"";return t?("/"!==t.charAt(0)&&(t="/"+t),t):t}(function(){const e=s();return e[e.length-1]}())}function nn(){return tn(sn())}function on(e="",t={}){if(!e)return!1;if(!(t&&t.list&&t.list.length))return!1;const s=t.list,n=tn(e);return s.some((e=>e.pagePath===n))}const rn=!!X.uniIdRouter,{loginPage:an,routerNeedLogin:cn,resToLogin:ln,needLoginPage:un,notNeedLoginPage:dn,loginPageInTabBar:hn}=function({pages:e=[],subPackages:t=[],uniIdRouter:s={},tabBar:n={}}=X){const{loginPage:o,needLogin:i=[],resToLogin:r=!0}=s,{needLoginPage:a,notNeedLoginPage:c}=en(e),{needLoginPage:l,notNeedLoginPage:u}=function(e=[]){const t=[],s=[];return e.forEach((e=>{const{root:n,pages:o=[]}=e,{needLoginPage:i,notNeedLoginPage:r}=en(o,n);t.push(...i),s.push(...r)})),{needLoginPage:t,notNeedLoginPage:s}}(t);return{loginPage:o,routerNeedLogin:i,resToLogin:r,needLoginPage:[...a,...l],notNeedLoginPage:[...c,...u],loginPageInTabBar:on(o,n)}}();if(un.indexOf(an)>-1)throw new Error(`Login page [${an}] should not be "needLogin", please check your pages.json`);function fn(e){const t=nn();if("/"===e.charAt(0))return e;const[s,n]=e.split("?"),o=s.replace(/^\//,"").split("/"),i=t.split("/");i.pop();for(let r=0;r<o.length;r++){const e=o[r];".."===e?i.pop():"."!==e&&i.push(e)}return""===i[0]&&i.shift(),"/"+i.join("/")+(n?"?"+n:"")}function pn({redirect:e}){const t=tn(e),s=tn(an);return nn()!==s&&t!==s}function mn({api:e,redirect:t}={}){if(!t||!pn({redirect:t}))return;const s=(o=t,"/"!==(n=an).charAt(0)&&(n="/"+n),o?n.indexOf("?")>-1?n+`&uniIdRedirectUrl=${encodeURIComponent(o)}`:n+`?uniIdRedirectUrl=${encodeURIComponent(o)}`:n);var n,o;hn?"navigateTo"!==e&&"redirectTo"!==e||(e="switchTab"):"switchTab"===e&&(e="navigateTo");const i={navigateTo:w,redirectTo:k,switchTab:b,reLaunch:v};setTimeout((()=>{i[e]({url:s})}),0)}function gn({url:e}={}){const t={abortLoginPageJump:!1,autoToLoginPage:!1},s=function(){const{token:e,tokenExpired:t}=We();let s;if(e){if(t<Date.now()){const e="uni-id-token-expired";s={errCode:e,errMsg:Xs[e]}}}else{const e="uni-id-check-token-failed";s={errCode:e,errMsg:Xs[e]}}return s}();if(function(e){const t=tn(fn(e));return!(dn.indexOf(t)>-1)&&(un.indexOf(t)>-1||cn.some((t=>{return s=e,new RegExp(t).test(s);var s})))}(e)&&s){if(s.uniIdRedirectUrl=e,Ue(Oe).length>0)return setTimeout((()=>{Fe(Oe,s)}),0),t.abortLoginPageJump=!0,t;t.autoToLoginPage=!0}return t}function yn(){!function(){const e=sn(),{abortLoginPageJump:t,autoToLoginPage:s}=gn({url:e});t||s&&mn({api:"redirectTo",redirect:e})}();const e=["navigateTo","redirectTo","reLaunch","switchTab"];for(let t=0;t<e.length;t++){const s=e[t];n(s,{invoke(e){const{abortLoginPageJump:t,autoToLoginPage:n}=gn({url:e.url});return t?e:n?(mn({api:s,redirect:fn(e.url)}),!1):e}})}}function _n(){this.onResponse((e=>{const{type:t,content:s}=e;let n=!1;switch(t){case"cloudobject":n=function(e){if("object"!=typeof e)return!1;const{errCode:t}=e||{};return t in Xs}(s);break;case"clientdb":n=function(e){if("object"!=typeof e)return!1;const{errCode:t}=e||{};return t in Gs}(s)}n&&function(e={}){const t=Ue(Oe);je().then((()=>{const s=sn();if(s&&pn({redirect:s}))return t.length>0?Fe(Oe,Object.assign({uniIdRedirectUrl:s},e)):void(an&&mn({api:"navigateTo",redirect:s}))}))}(s)}))}function wn(e){var t;(t=e).onResponse=function(e){Ne(Ce,e)},t.offResponse=function(e){Me(Ce,e)},function(e){e.onNeedLogin=function(e){Ne(Oe,e)},e.offNeedLogin=function(e){Me(Oe,e)},rn&&(ke("_globalUniCloudStatus").needLoginInit||(ke("_globalUniCloudStatus").needLoginInit=!0,je().then((()=>{yn.call(e)})),ln&&_n.call(e)))}(e),function(e){e.onRefreshToken=function(e){Ne(Ee,e)},e.offRefreshToken=function(e){Me(Ee,e)}}(e)}let kn;const bn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",vn=/^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;function Sn(){const e=We().token||"",t=e.split(".");if(!e||3!==t.length)return{uid:null,role:[],permission:[],tokenExpired:0};let s;try{s=JSON.parse((n=t[1],decodeURIComponent(kn(n).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""))))}catch(o){throw new Error("获取当前用户信息出错,详细错误信息为:"+o.message)}var n;return s.tokenExpired=1e3*s.exp,delete s.exp,delete s.iat,s}kn="function"!=typeof atob?function(e){if(e=String(e).replace(/[\t\n\f\r ]+/g,""),!vn.test(e))throw new Error("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 s,n,o="",i=0;i<e.length;)t=bn.indexOf(e.charAt(i++))<<18|bn.indexOf(e.charAt(i++))<<12|(s=bn.indexOf(e.charAt(i++)))<<6|(n=bn.indexOf(e.charAt(i++))),o+=64===s?String.fromCharCode(t>>16&255):64===n?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,255&t);return o}:atob;var In=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(Z((function(s,n){Object.defineProperty(n,"__esModule",{value:!0});const i="chooseAndUploadFile:ok",r="chooseAndUploadFile:fail";function a(e,t){return e.tempFiles.forEach(((e,s)=>{e.name||(e.name=e.path.substring(e.path.lastIndexOf("/")+1)),t&&(e.fileType=t),e.cloudPath=Date.now()+"_"+s+e.name.substring(e.name.lastIndexOf("."))})),e.tempFilePaths||(e.tempFilePaths=e.tempFiles.map((e=>e.path))),e}function c(e,t,{onChooseFile:s,onUploadProgress:n}){return t.then((e=>{if(s){const t=s(e);if(void 0!==t)return Promise.resolve(t).then((t=>void 0===t?e:t))}return e})).then((t=>!1===t?{errMsg:i,tempFilePaths:[],tempFiles:[]}:function(e,t,s=5,n){(t=Object.assign({},t)).errMsg=i;const o=t.tempFiles,r=o.length;let a=0;return new Promise((i=>{for(;a<s;)c();function c(){const s=a++;if(s>=r)return void(!o.find((e=>!e.url&&!e.errMsg))&&i(t));const l=o[s];e.uploadFile({provider:l.provider,filePath:l.path,cloudPath:l.cloudPath,fileType:l.fileType,cloudPathAsRealPath:l.cloudPathAsRealPath,onUploadProgress(e){e.index=s,e.tempFile=l,e.tempFilePath=l.path,n&&n(e)}}).then((e=>{l.url=e.fileID,s<r&&c()})).catch((e=>{l.errMsg=e.errMsg||e.message,s<r&&c()}))}}))}(e,t,5,n)))}n.initChooseAndUploadFile=function(s){return function(n={type:"all"}){return"image"===n.type?c(s,function(t){const{count:s,sizeType:n,sourceType:o=["album","camera"],extension:i}=t;return new Promise(((t,c)=>{e({count:s,sizeType:n,sourceType:o,extension:i,success(e){t(a(e,"image"))},fail(e){c({errMsg:e.errMsg.replace("chooseImage:fail",r)})}})}))}(n),n):"video"===n.type?c(s,function(e){const{camera:s,compressed:n,maxDuration:o,sourceType:i=["album","camera"],extension:c}=e;return new Promise(((e,l)=>{t({camera:s,compressed:n,maxDuration:o,sourceType:i,extension:c,success(t){const{tempFilePath:s,duration:n,size:o,height:i,width:r}=t;e(a({errMsg:"chooseVideo:ok",tempFilePaths:[s],tempFiles:[{name:t.tempFile&&t.tempFile.name||"",path:s,size:o,type:t.tempFile&&t.tempFile.type||"",width:r,height:i,duration:n,fileType:"video",cloudPath:""}]},"video"))},fail(e){l({errMsg:e.errMsg.replace("chooseVideo:fail",r)})}})}))}(n),n):c(s,function(e){const{count:t,extension:s}=e;return new Promise(((e,n)=>{let i=o;if("undefined"!=typeof wx&&"function"==typeof wx.chooseMessageFile&&(i=wx.chooseMessageFile),"function"!=typeof i)return n({errMsg:r+" 请指定 type 类型,该平台仅支持选择 image 或 video。"});i({type:"all",count:t,extension:s,success(t){e(a(t))},fail(e){n({errMsg:e.errMsg.replace("chooseFile:fail",r)})}})}))}(n),n)}}})));function Tn(e){return{props:{localdata:{type:Array,default:()=>[]},options:{type:[Object,Array],default:()=>({})},spaceInfo:{type:Object,default:()=>({})},collection:{type:[String,Array],default:""},action:{type:String,default:""},field:{type:String,default:""},orderby:{type:String,default:""},where:{type:[String,Object],default:""},pageData:{type:String,default:"add"},pageCurrent:{type:Number,default:1},pageSize:{type:Number,default:20},getcount:{type:[Boolean,String],default:!1},gettree:{type:[Boolean,String],default:!1},gettreepath:{type:[Boolean,String],default:!1},startwith:{type:String,default:""},limitlevel:{type:Number,default:10},groupby:{type:String,default:""},groupField:{type:String,default:""},distinct:{type:[Boolean,String],default:!1},foreignKey:{type:String,default:""},loadtime:{type:String,default:"auto"},manual:{type:Boolean,default:!1}},data:()=>({mixinDatacomLoading:!1,mixinDatacomHasMore:!1,mixinDatacomResData:[],mixinDatacomErrorMessage:"",mixinDatacomPage:{},mixinDatacomError:null}),created(){this.mixinDatacomPage={current:this.pageCurrent,size:this.pageSize,count:0},this.$watch((()=>{var e=[];return["pageCurrent","pageSize","localdata","collection","action","field","orderby","where","getont","getcount","gettree","groupby","groupField","distinct"].forEach((t=>{e.push(this[t])})),e}),((e,t)=>{if("manual"===this.loadtime)return;let s=!1;const n=[];for(let o=2;o<e.length;o++)e[o]!==t[o]&&(n.push(e[o]),s=!0);e[0]!==t[0]&&(this.mixinDatacomPage.current=this.pageCurrent),this.mixinDatacomPage.size=this.pageSize,this.onMixinDatacomPropsChange(s,n)}))},methods:{onMixinDatacomPropsChange(e,t){},mixinDatacomEasyGet({getone:e=!1,success:t,fail:s}={}){this.mixinDatacomLoading||(this.mixinDatacomLoading=!0,this.mixinDatacomErrorMessage="",this.mixinDatacomError=null,this.mixinDatacomGet().then((s=>{this.mixinDatacomLoading=!1;const{data:n,count:o}=s.result;this.getcount&&(this.mixinDatacomPage.count=o),this.mixinDatacomHasMore=n.length<this.pageSize;const i=e?n.length?n[0]:void 0:n;this.mixinDatacomResData=i,t&&t(i)})).catch((e=>{this.mixinDatacomLoading=!1,this.mixinDatacomErrorMessage=e,this.mixinDatacomError=e,s&&s(e)})))},mixinDatacomGet(t={}){let s;t=t||{},s="undefined"!=typeof __uniX&&__uniX?e.databaseForJQL(this.spaceInfo):e.database(this.spaceInfo);const n=t.action||this.action;n&&(s=s.action(n));const o=t.collection||this.collection;s=Array.isArray(o)?s.collection(...o):s.collection(o);const i=t.where||this.where;i&&Object.keys(i).length&&(s=s.where(i));const r=t.field||this.field;r&&(s=s.field(r));const a=t.foreignKey||this.foreignKey;a&&(s=s.foreignKey(a));const c=t.groupby||this.groupby;c&&(s=s.groupBy(c));const l=t.groupField||this.groupField;l&&(s=s.groupField(l)),!0===(void 0!==t.distinct?t.distinct:this.distinct)&&(s=s.distinct());const u=t.orderby||this.orderby;u&&(s=s.orderBy(u));const d=void 0!==t.pageCurrent?t.pageCurrent:this.mixinDatacomPage.current,h=void 0!==t.pageSize?t.pageSize:this.mixinDatacomPage.size,f=void 0!==t.getcount?t.getcount:this.getcount,p=void 0!==t.gettree?t.gettree:this.gettree,m=void 0!==t.gettreepath?t.gettreepath:this.gettreepath,g={getCount:f},y={limitLevel:void 0!==t.limitlevel?t.limitlevel:this.limitlevel,startWith:void 0!==t.startwith?t.startwith:this.startwith};return p&&(g.getTree=y),m&&(g.getTreePath=y),s=s.skip(h*(d-1)).limit(h).get(g),s}}}}function xn(e){return ke("_globalUniCloudSecureNetworkCache__{spaceId}".replace("{spaceId}",e.config.spaceId))}async function An({openid:e,callLoginByWeixin:t=!1}={}){throw xn(this),new Error("[SecureNetwork] API `initSecureNetworkByWeixin` is not supported on platform `web`")}async function Pn(e){const t=xn(this);return t.initPromise||(t.initPromise=An.call(this,e).then((e=>e)).catch((e=>{throw delete t.initPromise,e}))),t.initPromise}function Cn(e){Xe=e}function On(e){const t={getSystemInfo:S,getPushClientId:I};return function(s){return new Promise(((n,o)=>{t[e]({...s,success(e){n(e)},fail(e){o(e)}})}))}}class En extends class{constructor(){this._callback={}}addListener(e,t){this._callback[e]||(this._callback[e]=[]),this._callback[e].push(t)}on(e,t){return this.addListener(e,t)}removeListener(e,t){if(!t)throw new Error('The "listener" argument must be of type function. Received undefined');const s=this._callback[e];if(!s)return;const n=function(e,t){for(let s=e.length-1;s>=0;s--)if(e[s]===t)return s;return-1}(s,t);s.splice(n,1)}off(e,t){return this.removeListener(e,t)}removeAllListener(e){delete this._callback[e]}emit(e,...t){const s=this._callback[e];if(s)for(let n=0;n<s.length;n++)s[n](...t)}}{constructor(){super(),this._uniPushMessageCallback=this._receivePushMessage.bind(this),this._currentMessageId=-1,this._payloadQueue=[]}init(){return Promise.all([On("getSystemInfo")(),On("getPushClientId")()]).then((([{appId:e}={},{cid:t}={}]=[])=>{if(!e)throw new Error("Invalid appId, please check the manifest.json file");if(!t)throw new Error("Invalid push client id");this._appId=e,this._pushClientId=t,this._seqId=Date.now()+"-"+Math.floor(9e5*Math.random()+1e5),this.emit("open"),this._initMessageListener()}),(e=>{throw this.emit("error",e),this.close(),e}))}async open(){return this.init()}_isUniCloudSSE(e){if("receive"!==e.type)return!1;const t=e&&e.data&&e.data.payload;return!(!t||"UNI_CLOUD_SSE"!==t.channel||t.seqId!==this._seqId)}_receivePushMessage(e){if(!this._isUniCloudSSE(e))return;const t=e&&e.data&&e.data.payload,{action:s,messageId:n,message:o}=t;this._payloadQueue.push({action:s,messageId:n,message:o}),this._consumMessage()}_consumMessage(){for(;;){const e=this._payloadQueue.find((e=>e.messageId===this._currentMessageId+1));if(!e)break;this._currentMessageId++,this._parseMessagePayload(e)}}_parseMessagePayload(e){const{action:t,messageId:s,message:n}=e;"end"===t?this._end({messageId:s,message:n}):"message"===t&&this._appendMessage({messageId:s,message:n})}_appendMessage({messageId:e,message:t}={}){this.emit("message",t)}_end({messageId:e,message:t}={}){this.emit("end",t),this.close()}_initMessageListener(){l(this._uniPushMessageCallback)}_destroy(){u(this._uniPushMessageCallback)}toJSON(){return{appId:this._appId,pushClientId:this._pushClientId,seqId:this._seqId}}close(){this._destroy(),this.emit("close")}}const Rn={tcb:fs,tencent:fs,aliyun:ot,private:ms,alipay:Is};let Ln=new class{init(e){let t={};const s=Rn[e.provider];if(!s)throw new Error("未提供正确的provider参数");var n;return t=s.init(e),function(e){e._initPromiseHub||(e._initPromiseHub=new pe({createPromise:function(){let t=Promise.resolve();t=new Promise((e=>{setTimeout((()=>{e()}),1)}));const s=e.auth();return t.then((()=>s.getLoginState())).then((e=>e?Promise.resolve():s.signInAnonymously()))}}))}(t),Ns(t),function(e){const t=e.uploadFile;e.uploadFile=function(e){return t.call(this,e)}}(t),(n=t).database=function(e){if(e&&Object.keys(e).length>0)return n.init(e).database();if(this._database)return this._database;const t=zs(Js,{uniClient:n});return this._database=t,t},n.databaseForJQL=function(e){if(e&&Object.keys(e).length>0)return n.init(e).databaseForJQL();if(this._databaseForJQL)return this._databaseForJQL;const t=zs(Js,{uniClient:n,isJQL:!0});return this._databaseForJQL=t,t},function(e){e.getCurrentUserInfo=Sn,e.chooseAndUploadFile=In.initChooseAndUploadFile(e),Object.assign(e,{get mixinDatacom(){return Tn(e)}}),e.SSEChannel=En,e.initSecureNetworkByWeixin=function(e){return function({openid:t,callLoginByWeixin:s=!1}={}){return Pn.call(e,{openid:t,callLoginByWeixin:s})}}(e),e.setCustomClientInfo=Cn,e.importObject=function(t){return function(s,n={}){n=function(e,t={}){return e.customUI=t.customUI||e.customUI,e.parseSystemError=t.parseSystemError||e.parseSystemError,Object.assign(e.loadingOptions,t.loadingOptions),Object.assign(e.errorOptions,t.errorOptions),"object"==typeof t.secretMethods&&(e.secretMethods=t.secretMethods),e}({customUI:!1,loadingOptions:{title:"加载中...",mask:!0},errorOptions:{type:"modal",retry:!1}},n);const{customUI:o,loadingOptions:l,errorOptions:u,parseSystemError:d}=n,h=!o;return new Proxy({},{get(o,f){switch(f){case"toString":return"[object UniCloudObject]";case"toJSON":return{}}return function({fn:e,interceptorName:t,getCallbackArgs:s}={}){return async function(...n){const o=s?s({params:n}):{};let i,r;try{return await Te(xe(t,"invoke"),{...o}),i=await e(...n),await Te(xe(t,"success"),{...o,result:i}),i}catch(a){throw r=a,await Te(xe(t,"fail"),{...o,error:r}),r}finally{await Te(xe(t,"complete"),r?{...o,error:r}:{...o,result:i})}}}({fn:async function o(...p){let m;h&&i({title:l.title,mask:l.mask});const g={name:s,type:"OBJECT",data:{method:f,params:p}};"object"==typeof n.secretMethods&&function(e,t){const s=t.data.method,n=e.secretMethods||{},o=n[s]||n["*"];o&&(t.secretType=o)}(n,g);let y=!1;try{m=await t.callFunction(g)}catch(e){y=!0,m={result:new Ke(e)}}const{errSubject:_,errCode:w,errMsg:k,newToken:b}=m.result||{};if(h&&r(),b&&b.token&&b.tokenExpired&&(ze(b),Fe(Ee,{...b})),w){let e=k;if(y&&d&&(e=(await d({objectName:s,methodName:f,params:p,errSubject:_,errCode:w,errMsg:k})).errMsg||k),h)if("toast"===u.type)a({title:e,icon:"none"});else{if("modal"!==u.type)throw new Error(`Invalid errorOptions.type: ${u.type}`);{const{confirm:t}=await async function({title:e,content:t,showCancel:s,cancelText:n,confirmText:o}={}){return new Promise(((i,r)=>{c({title:e,content:t,showCancel:s,cancelText:n,confirmText:o,success(e){i(e)},fail(){i({confirm:!1,cancel:!0})}})}))}({title:"提示",content:e,showCancel:u.retry,cancelText:"取消",confirmText:u.retry?"重试":"确定"});if(u.retry&&t)return o(...p)}}const t=new Ke({subject:_,code:w,message:k,requestId:m.requestId});throw t.detail=m.result,Fe(Ce,{type:De,content:t}),t}return Fe(Ce,{type:De,content:m.result}),m.result},interceptorName:"callObject",getCallbackArgs:function({params:e}={}){return{objectName:s,methodName:f,params:e}}})}})}}(e)}(t),["callFunction","uploadFile","deleteFile","getTempFileURL","downloadFile","chooseAndUploadFile"].forEach((e=>{if(!t[e])return;const s=t[e];t[e]=function(){return s.apply(t,Array.from(arguments))},t[e]=function(e,t){return function(s){let n=!1;if("callFunction"===t){const e=s&&s.type||ie;n=e!==ie}const o="callFunction"===t&&!n,i=this._initPromiseHub.exec();s=s||{};const{success:r,fail:a,complete:c}=Be(s),l=i.then((()=>n?Promise.resolve():Te(xe(t,"invoke"),s))).then((()=>e.call(this,s))).then((e=>n?Promise.resolve(e):Te(xe(t,"success"),e).then((()=>Te(xe(t,"complete"),e))).then((()=>(o&&Fe(Ce,{type:Le,content:e}),Promise.resolve(e))))),(e=>n?Promise.reject(e):Te(xe(t,"fail"),e).then((()=>Te(xe(t,"complete"),e))).then((()=>(Fe(Ce,{type:Le,content:e}),Promise.reject(e))))));if(!(r||a||c))return l;l.then((e=>{r&&r(e),c&&c(e),o&&Fe(Ce,{type:Le,content:e})}),(e=>{a&&a(e),c&&c(e),o&&Fe(Ce,{type:Le,content:e})}))}}(t[e],e).bind(t)})),t.init=this.init,t}};(()=>{const e=ye;let t={};if(e&&1===e.length)t=e[0],Ln=Ln.init(t),Ln._isDefault=!0;else{const t=["auth","callFunction","uploadFile","deleteFile","getTempFileURL","downloadFile","database","getCurrentUSerInfo","importObject"];let s;s=e&&e.length>0?"应用有多个服务空间,请通过uniCloud.init方法指定要使用的服务空间":"应用未关联服务空间,请在uniCloud目录右键关联服务空间",t.forEach((e=>{Ln[e]=function(){return console.error(s),Promise.reject(new Ke({code:"SYS_ERR",message:s}))}}))}Object.assign(Ln,{get mixinDatacom(){return Tn(Ln)}}),wn(Ln),Ln.addInterceptor=Se,Ln.removeInterceptor=Ie,Ln.interceptObject=Ae})();var Dn=Ln;const Un=[{font_class:"arrow-down",unicode:""},{font_class:"arrow-left",unicode:""},{font_class:"arrow-right",unicode:""},{font_class:"arrow-up",unicode:""},{font_class:"auth",unicode:""},{font_class:"auth-filled",unicode:""},{font_class:"back",unicode:""},{font_class:"bars",unicode:""},{font_class:"calendar",unicode:""},{font_class:"calendar-filled",unicode:""},{font_class:"camera",unicode:""},{font_class:"camera-filled",unicode:""},{font_class:"cart",unicode:""},{font_class:"cart-filled",unicode:""},{font_class:"chat",unicode:""},{font_class:"chat-filled",unicode:""},{font_class:"chatboxes",unicode:""},{font_class:"chatboxes-filled",unicode:""},{font_class:"chatbubble",unicode:""},{font_class:"chatbubble-filled",unicode:""},{font_class:"checkbox",unicode:""},{font_class:"checkbox-filled",unicode:""},{font_class:"checkmarkempty",unicode:""},{font_class:"circle",unicode:""},{font_class:"circle-filled",unicode:""},{font_class:"clear",unicode:""},{font_class:"close",unicode:""},{font_class:"closeempty",unicode:""},{font_class:"cloud-download",unicode:""},{font_class:"cloud-download-filled",unicode:""},{font_class:"cloud-upload",unicode:""},{font_class:"cloud-upload-filled",unicode:""},{font_class:"color",unicode:""},{font_class:"color-filled",unicode:""},{font_class:"compose",unicode:""},{font_class:"contact",unicode:""},{font_class:"contact-filled",unicode:""},{font_class:"down",unicode:""},{font_class:"bottom",unicode:""},{font_class:"download",unicode:""},{font_class:"download-filled",unicode:""},{font_class:"email",unicode:""},{font_class:"email-filled",unicode:""},{font_class:"eye",unicode:""},{font_class:"eye-filled",unicode:""},{font_class:"eye-slash",unicode:""},{font_class:"eye-slash-filled",unicode:""},{font_class:"fire",unicode:""},{font_class:"fire-filled",unicode:""},{font_class:"flag",unicode:""},{font_class:"flag-filled",unicode:""},{font_class:"folder-add",unicode:""},{font_class:"folder-add-filled",unicode:""},{font_class:"font",unicode:""},{font_class:"forward",unicode:""},{font_class:"gear",unicode:""},{font_class:"gear-filled",unicode:""},{font_class:"gift",unicode:""},{font_class:"gift-filled",unicode:""},{font_class:"hand-down",unicode:""},{font_class:"hand-down-filled",unicode:""},{font_class:"hand-up",unicode:""},{font_class:"hand-up-filled",unicode:""},{font_class:"headphones",unicode:""},{font_class:"heart",unicode:""},{font_class:"heart-filled",unicode:""},{font_class:"help",unicode:""},{font_class:"help-filled",unicode:""},{font_class:"home",unicode:""},{font_class:"home-filled",unicode:""},{font_class:"image",unicode:""},{font_class:"image-filled",unicode:""},{font_class:"images",unicode:""},{font_class:"images-filled",unicode:""},{font_class:"info",unicode:""},{font_class:"info-filled",unicode:""},{font_class:"left",unicode:""},{font_class:"link",unicode:""},{font_class:"list",unicode:""},{font_class:"location",unicode:""},{font_class:"location-filled",unicode:""},{font_class:"locked",unicode:""},{font_class:"locked-filled",unicode:""},{font_class:"loop",unicode:""},{font_class:"mail-open",unicode:""},{font_class:"mail-open-filled",unicode:""},{font_class:"map",unicode:""},{font_class:"map-filled",unicode:""},{font_class:"map-pin",unicode:""},{font_class:"map-pin-ellipse",unicode:""},{font_class:"medal",unicode:""},{font_class:"medal-filled",unicode:""},{font_class:"mic",unicode:""},{font_class:"mic-filled",unicode:""},{font_class:"micoff",unicode:""},{font_class:"micoff-filled",unicode:""},{font_class:"minus",unicode:""},{font_class:"minus-filled",unicode:""},{font_class:"more",unicode:""},{font_class:"more-filled",unicode:""},{font_class:"navigate",unicode:""},{font_class:"navigate-filled",unicode:""},{font_class:"notification",unicode:""},{font_class:"notification-filled",unicode:""},{font_class:"paperclip",unicode:""},{font_class:"paperplane",unicode:""},{font_class:"paperplane-filled",unicode:""},{font_class:"person",unicode:""},{font_class:"person-filled",unicode:""},{font_class:"personadd",unicode:""},{font_class:"personadd-filled",unicode:""},{font_class:"personadd-filled-copy",unicode:""},{font_class:"phone",unicode:""},{font_class:"phone-filled",unicode:""},{font_class:"plus",unicode:""},{font_class:"plus-filled",unicode:""},{font_class:"plusempty",unicode:""},{font_class:"pulldown",unicode:""},{font_class:"pyq",unicode:""},{font_class:"qq",unicode:""},{font_class:"redo",unicode:""},{font_class:"redo-filled",unicode:""},{font_class:"refresh",unicode:""},{font_class:"refresh-filled",unicode:""},{font_class:"refreshempty",unicode:""},{font_class:"reload",unicode:""},{font_class:"right",unicode:""},{font_class:"scan",unicode:""},{font_class:"search",unicode:""},{font_class:"settings",unicode:""},{font_class:"settings-filled",unicode:""},{font_class:"shop",unicode:""},{font_class:"shop-filled",unicode:""},{font_class:"smallcircle",unicode:""},{font_class:"smallcircle-filled",unicode:""},{font_class:"sound",unicode:""},{font_class:"sound-filled",unicode:""},{font_class:"spinner-cycle",unicode:""},{font_class:"staff",unicode:""},{font_class:"staff-filled",unicode:""},{font_class:"star",unicode:""},{font_class:"star-filled",unicode:""},{font_class:"starhalf",unicode:""},{font_class:"trash",unicode:""},{font_class:"trash-filled",unicode:""},{font_class:"tune",unicode:""},{font_class:"tune-filled",unicode:""},{font_class:"undo",unicode:""},{font_class:"undo-filled",unicode:""},{font_class:"up",unicode:""},{font_class:"top",unicode:""},{font_class:"upload",unicode:""},{font_class:"upload-filled",unicode:""},{font_class:"videocam",unicode:""},{font_class:"videocam-filled",unicode:""},{font_class:"vip",unicode:""},{font_class:"vip-filled",unicode:""},{font_class:"wallet",unicode:""},{font_class:"wallet-filled",unicode:""},{font_class:"weibo",unicode:""},{font_class:"weixin",unicode:""}],Nn=(e,t)=>{const s=e.__vccOpts||e;for(const[n,o]of t)s[n]=o;return s};const Mn=Nn({name:"UniIcons",emits:["click"],props:{type:{type:String,default:""},color:{type:String,default:"#333333"},size:{type:[Number,String],default:16},customPrefix:{type:String,default:""},fontFamily:{type:String,default:""}},data:()=>({icons:Un}),computed:{unicode(){let e=this.icons.find((e=>e.font_class===this.type));return e?e.unicode:""},iconSize(){return"number"==typeof(e=this.size)||/^[0-9]*$/g.test(e)?e+"px":e;var e},styleObj(){return""!==this.fontFamily?`color: ${this.color}; font-size: ${this.iconSize}; font-family: ${this.fontFamily};`:`color: ${this.color}; font-size: ${this.iconSize};`}},methods:{_onClick(){this.$emit("click")}}},[["render",function(e,t,s,n,o,i){const r=L;return A(),P(r,{style:E(i.styleObj),class:R(["uni-icons",["uniui-"+s.type,s.customPrefix,s.customPrefix?s.type:""]]),onClick:i._onClick},{default:C((()=>[O(e.$slots,"default",{},void 0,!0)])),_:3},8,["style","class","onClick"])}],["__scopeId","data-v-5610c8db"]]);function Fn(e,t){return"string"==typeof e?t:e}const $n=Nn({name:"uni-data-select",mixins:[Dn.mixinDatacom||{}],props:{localdata:{type:Array,default:()=>[]},value:{type:[String,Number],default:""},modelValue:{type:[String,Number],default:""},label:{type:String,default:""},placeholder:{type:String,default:"请选择"},emptyTips:{type:String,default:"无选项"},clear:{type:Boolean,default:!0},defItem:{type:Number,default:0},disabled:{type:Boolean,default:!1},format:{type:String,default:""},placement:{type:String,default:"bottom"}},data:()=>({showSelector:!1,current:"",mixinDatacomResData:[],apps:[],channels:[],cacheKey:"uni-data-select-lastSelectedValue"}),created(){this.debounceGet=this.debounce((()=>{this.query()}),300),this.collection&&!this.localdata.length&&this.debounceGet()},computed:{typePlaceholder(){const e=this.placeholder,t={"opendb-stat-app-versions":"版本","opendb-app-channels":"渠道","opendb-app-list":"应用"}[this.collection];return t?e+t:e},valueCom(){return this.modelValue},textShow(){let e=this.current;return e.length>10?e.slice(0,25)+"...":e},getOffsetByPlacement(){switch(this.placement){case"top":return"bottom:calc(100% + 12px);";case"bottom":return"top:calc(100% + 12px);"}}},watch:{localdata:{immediate:!0,handler(e,t){Array.isArray(e)&&t!==e&&(this.mixinDatacomResData=e)}},valueCom(e,t){this.initDefVal()},mixinDatacomResData:{immediate:!0,handler(e){e.length&&this.initDefVal()}}},methods:{debounce(e,t=100){let s=null;return function(...n){s&&clearTimeout(s),s=setTimeout((()=>{e.apply(this,n)}),t)}},query(){this.mixinDatacomEasyGet()},onMixinDatacomPropsChange(){this.collection&&this.debounceGet()},initDefVal(){let e="";if(!this.valueCom&&0!==this.valueCom||this.isDisabled(this.valueCom)){let t;if(this.collection&&(t=this.getCache()),t||0===t)e=t;else{let t="";this.defItem>0&&this.defItem<=this.mixinDatacomResData.length&&(t=this.mixinDatacomResData[this.defItem-1].value),e=t}(e||0===e)&&this.emit(e)}else e=this.valueCom;const t=this.mixinDatacomResData.find((t=>t.value===e));this.current=t?this.formatItemName(t):""},isDisabled(e){let t=!1;return this.mixinDatacomResData.forEach((s=>{s.value===e&&(t=s.disable)})),t},clearVal(){this.emit(""),this.collection&&this.removeCache()},change(e){e.disable||(this.showSelector=!1,this.current=this.formatItemName(e),this.emit(e.value))},emit(e){this.$emit("input",e),this.$emit("update:modelValue",e),this.$emit("change",e),this.collection&&this.setCache(e)},toggleSelector(){this.disabled||(this.showSelector=!this.showSelector)},formatItemName(e){let{text:t,value:s,channel_code:n}=e;if(n=n?`(${n})`:"",this.format){let t="";t=this.format;for(let s in e)t=t.replace(new RegExp(`{${s}}`,"g"),e[s]);return t}return this.collection.indexOf("app-list")>0?`${t}(${s})`:t||`未命名${n}`},getLoadData(){return this.mixinDatacomResData},getCurrentCacheKey(){return this.collection},getCache(e=this.getCurrentCacheKey()){return(p(this.cacheKey)||{})[e]},setCache(e,t=this.getCurrentCacheKey()){let s=p(this.cacheKey)||{};s[t]=e,f(this.cacheKey,s)},removeCache(e=this.getCurrentCacheKey()){let t=p(this.cacheKey)||{};delete t[e],f(this.cacheKey,t)}}},[["render",function(e,t,s,n,o,i){const r=K,a=Fn(D("uni-icons"),Mn),c=L,l=H;return A(),P(r,{class:"uni-stat__select"},{default:C((()=>[s.label?(A(),U("span",{key:0,class:"uni-label-text hide-on-phone"},N(s.label+":"),1)):M("",!0),F(r,{class:R(["uni-stat-box",{"uni-stat__actived":o.current}])},{default:C((()=>[F(r,{class:R(["uni-select",{"uni-select--disabled":s.disabled}])},{default:C((()=>[F(r,{class:"uni-select__input-box",onClick:i.toggleSelector},{default:C((()=>[o.current?(A(),P(r,{key:0,class:"uni-select__input-text"},{default:C((()=>[$(N(i.textShow),1)])),_:1})):(A(),P(r,{key:1,class:"uni-select__input-text uni-select__input-placeholder"},{default:C((()=>[$(N(i.typePlaceholder),1)])),_:1})),o.current&&s.clear&&!s.disabled?(A(),P(r,{key:2,onClick:q(i.clearVal,["stop"])},{default:C((()=>[F(a,{type:"clear",color:"#c0c4cc",size:"24"})])),_:1},8,["onClick"])):(A(),P(r,{key:3},{default:C((()=>[F(a,{type:o.showSelector?"top":"bottom",size:"14",color:"#999"},null,8,["type"])])),_:1}))])),_:1},8,["onClick"]),o.showSelector?(A(),P(r,{key:0,class:"uni-select--mask",onClick:i.toggleSelector},null,8,["onClick"])):M("",!0),o.showSelector?(A(),P(r,{key:1,class:"uni-select__selector",style:E(i.getOffsetByPlacement)},{default:C((()=>[F(r,{class:R("bottom"==s.placement?"uni-popper__arrow_bottom":"uni-popper__arrow_top")},null,8,["class"]),F(l,{"scroll-y":"true",class:"uni-select__selector-scroll"},{default:C((()=>[0===o.mixinDatacomResData.length?(A(),P(r,{key:0,class:"uni-select__selector-empty"},{default:C((()=>[F(c,null,{default:C((()=>[$(N(s.emptyTips),1)])),_:1})])),_:1})):(A(!0),U(j,{key:1},B(o.mixinDatacomResData,((e,t)=>(A(),P(r,{class:"uni-select__selector-item",key:t,onClick:t=>i.change(e)},{default:C((()=>[F(c,{class:R({"uni-select__selector__disabled":e.disable})},{default:C((()=>[$(N(i.formatItemName(e)),1)])),_:2},1032,["class"])])),_:2},1032,["onClick"])))),128))])),_:1})])),_:1},8,["style"])):M("",!0)])),_:1},8,["class"])])),_:1},8,["class"])])),_:1})}],["__scopeId","data-v-fe4b6be6"]]);class qn{constructor(e,t){this.options=e,this.animation=V({...e}),this.currentStepAnimates={},this.next=0,this.$=t}_nvuePushAnimates(e,t){let s=this.currentStepAnimates[this.next],n={};if(n=s||{styles:{},config:{}},jn.includes(e)){n.styles.transform||(n.styles.transform="");let s="";"rotate"===e&&(s="deg"),n.styles.transform+=`${e}(${t+s}) `}else n.styles[e]=`${t}`;this.currentStepAnimates[this.next]=n}_animateRun(e={},t={}){let s=this.$.$refs.ani.ref;if(s)return new Promise(((n,o)=>{nvueAnimation.transition(s,{styles:e,...t},(e=>{n()}))}))}_nvueNextAnimate(e,t=0,s){let n=e[t];if(n){let{styles:o,config:i}=n;this._animateRun(o,i).then((()=>{t+=1,this._nvueNextAnimate(e,t,s)}))}else this.currentStepAnimates={},"function"==typeof s&&s(),this.isEnd=!0}step(e={}){return this.animation.step(e),this}run(e){this.$.animationData=this.animation.export(),this.$.timer=setTimeout((()=>{"function"==typeof e&&e()}),this.$.durationTime)}}const jn=["matrix","matrix3d","rotate","rotate3d","rotateX","rotateY","rotateZ","scale","scale3d","scaleX","scaleY","scaleZ","skew","skewX","skewY","translate","translate3d","translateX","translateY","translateZ"];function Bn(e,t){if(t)return clearTimeout(t.timer),new qn(e,t)}jn.concat(["opacity","backgroundColor"],["width","height","left","right","top","bottom"]).forEach((e=>{qn.prototype[e]=function(...t){return this.animation[e](...t),this}}));const Kn=Nn({name:"uniTransition",emits:["click","change"],props:{show:{type:Boolean,default:!1},modeClass:{type:[Array,String],default:()=>"fade"},duration:{type:Number,default:300},styles:{type:Object,default:()=>({})},customClass:{type:String,default:""},onceRender:{type:Boolean,default:!1}},data:()=>({isShow:!1,transform:"",opacity:1,animationData:{},durationTime:300,config:{}}),watch:{show:{handler(e){e?this.open():this.isShow&&this.close()},immediate:!0}},computed:{stylesObject(){let e={...this.styles,"transition-duration":this.duration/1e3+"s"},t="";for(let s in e){t+=this.toLine(s)+":"+e[s]+";"}return t},transformStyles(){return"transform:"+this.transform+";opacity:"+this.opacity+";"+this.stylesObject}},created(){this.config={duration:this.duration,timingFunction:"ease",transformOrigin:"50% 50%",delay:0},this.durationTime=this.duration},methods:{init(e={}){e.duration&&(this.durationTime=e.duration),this.animation=Bn(Object.assign(this.config,e),this)},onClick(){this.$emit("click",{detail:this.isShow})},step(e,t={}){if(this.animation){for(let t in e)try{"object"==typeof e[t]?this.animation[t](...e[t]):this.animation[t](e[t])}catch(at){console.error(`方法 ${t} 不存在`)}return this.animation.step(t),this}},run(e){this.animation&&this.animation.run(e)},open(){clearTimeout(this.timer),this.transform="",this.isShow=!0;let{opacity:e,transform:t}=this.styleInit(!1);void 0!==e&&(this.opacity=e),this.transform=t,this.$nextTick((()=>{this.timer=setTimeout((()=>{this.animation=Bn(this.config,this),this.tranfromInit(!1).step(),this.animation.run(),this.$emit("change",{detail:this.isShow})}),20)}))},close(e){this.animation&&this.tranfromInit(!0).step().run((()=>{this.isShow=!1,this.animationData=null,this.animation=null;let{opacity:e,transform:t}=this.styleInit(!1);this.opacity=e||1,this.transform=t,this.$emit("change",{detail:this.isShow})}))},styleInit(e){let t={transform:""},s=(e,s)=>{"fade"===s?t.opacity=this.animationType(e)[s]:t.transform+=this.animationType(e)[s]+" "};return"string"==typeof this.modeClass?s(e,this.modeClass):this.modeClass.forEach((t=>{s(e,t)})),t},tranfromInit(e){let t=(e,t)=>{let s=null;"fade"===t?s=e?0:1:(s=e?"-100%":"0","zoom-in"===t&&(s=e?.8:1),"zoom-out"===t&&(s=e?1.2:1),"slide-right"===t&&(s=e?"100%":"0"),"slide-bottom"===t&&(s=e?"100%":"0")),this.animation[this.animationMode()[t]](s)};return"string"==typeof this.modeClass?t(e,this.modeClass):this.modeClass.forEach((s=>{t(e,s)})),this.animation},animationType:e=>({fade:e?1:0,"slide-top":`translateY(${e?"0":"-100%"})`,"slide-right":`translateX(${e?"0":"100%"})`,"slide-bottom":`translateY(${e?"0":"100%"})`,"slide-left":`translateX(${e?"0":"-100%"})`,"zoom-in":`scaleX(${e?1:.8}) scaleY(${e?1:.8})`,"zoom-out":`scaleX(${e?1:1.2}) scaleY(${e?1:1.2})`}),animationMode:()=>({fade:"opacity","slide-top":"translateY","slide-right":"translateX","slide-bottom":"translateY","slide-left":"translateX","zoom-in":"scale","zoom-out":"scale"}),toLine:e=>e.replace(/([A-Z])/g,"-$1").toLowerCase()}},[["render",function(e,t,s,n,o,i){const r=K;return W((A(),P(r,{ref:"ani",animation:o.animationData,class:R(s.customClass),style:E(i.transformStyles),onClick:i.onClick},{default:C((()=>[O(e.$slots,"default")])),_:3},8,["animation","class","style","onClick"])),[[z,o.isShow]])}]]),Hn={name:"uniPopup",components:{keypress:{name:"Keypress",props:{disable:{type:Boolean,default:!1}},mounted(){const e={esc:["Esc","Escape"],tab:"Tab",enter:"Enter",space:[" ","Spacebar"],up:["Up","ArrowUp"],left:["Left","ArrowLeft"],right:["Right","ArrowRight"],down:["Down","ArrowDown"],delete:["Backspace","Delete","Del"]};document.addEventListener("keyup",(t=>{if(this.disable)return;const s=Object.keys(e).find((s=>{const n=t.key,o=e[s];return o===n||Array.isArray(o)&&o.includes(n)}));s&&setTimeout((()=>{this.$emit(s,{})}),0)}))},render:()=>{}}},emits:["change","maskClick"],props:{animation:{type:Boolean,default:!0},type:{type:String,default:"center"},isMaskClick:{type:Boolean,default:null},maskClick:{type:Boolean,default:null},backgroundColor:{type:String,default:"none"},safeArea:{type:Boolean,default:!0},maskBackgroundColor:{type:String,default:"rgba(0, 0, 0, 0.4)"},borderRadius:{type:String}},watch:{type:{handler:function(e){this.config[e]&&this[this.config[e]](!0)},immediate:!0},isDesktop:{handler:function(e){this.config[e]&&this[this.config[this.type]](!0)},immediate:!0},maskClick:{handler:function(e){this.mkclick=e},immediate:!0},isMaskClick:{handler:function(e){this.mkclick=e},immediate:!0},showPopup(e){document.getElementsByTagName("body")[0].style.overflow=e?"hidden":"visible"}},data(){return{duration:300,ani:[],showPopup:!1,showTrans:!1,popupWidth:0,popupHeight:0,config:{top:"top",bottom:"bottom",center:"center",left:"left",right:"right",message:"top",dialog:"center",share:"bottom"},maskClass:{position:"fixed",bottom:0,top:0,left:0,right:0,backgroundColor:"rgba(0, 0, 0, 0.4)"},transClass:{backgroundColor:"transparent",borderRadius:this.borderRadius||"0",position:"fixed",left:0,right:0},maskShow:!0,mkclick:!0,popupstyle:"top"}},computed:{getStyles(){let e={backgroundColor:this.bg};return this.borderRadius,e=Object.assign(e,{borderRadius:this.borderRadius}),e},isDesktop(){return this.popupWidth>=500&&this.popupHeight>=500},bg(){return""===this.backgroundColor||"none"===this.backgroundColor?"transparent":this.backgroundColor}},mounted(){(()=>{const{windowWidth:e,windowHeight:t,windowTop:s,safeArea:n,screenHeight:o,safeAreaInsets:i}=_();this.popupWidth=e,this.popupHeight=t+(s||0),n&&this.safeArea?this.safeAreaInsets=i.bottom:this.safeAreaInsets=0})()},unmounted(){this.setH5Visible()},created(){null===this.isMaskClick&&null===this.maskClick?this.mkclick=!0:this.mkclick=null!==this.isMaskClick?this.isMaskClick:this.maskClick,this.animation?this.duration=300:this.duration=0,this.messageChild=null,this.clearPropagation=!1,this.maskClass.backgroundColor=this.maskBackgroundColor},methods:{setH5Visible(){document.getElementsByTagName("body")[0].style.overflow="visible"},closeMask(){this.maskShow=!1},disableMask(){this.mkclick=!1},clear(e){e.stopPropagation(),this.clearPropagation=!0},open(e){if(this.showPopup)return;e&&-1!==["top","center","bottom","left","right","message","dialog","share"].indexOf(e)||(e=this.type),this.config[e]?(this[this.config[e]](),this.$emit("change",{show:!0,type:e})):console.error("缺少类型:",e)},close(e){this.showTrans=!1,this.$emit("change",{show:!1,type:this.type}),clearTimeout(this.timer),this.timer=setTimeout((()=>{this.showPopup=!1}),300)},touchstart(){this.clearPropagation=!1},onTap(){this.clearPropagation?this.clearPropagation=!1:(this.$emit("maskClick"),this.mkclick&&this.close())},top(e){this.popupstyle=this.isDesktop?"fixforpc-top":"top",this.ani=["slide-top"],this.transClass={position:"fixed",left:0,right:0,backgroundColor:this.bg,borderRadius:this.borderRadius||"0"},e||(this.showPopup=!0,this.showTrans=!0,this.$nextTick((()=>{this.messageChild&&"message"===this.type&&this.messageChild.timerClose()})))},bottom(e){this.popupstyle="bottom",this.ani=["slide-bottom"],this.transClass={position:"fixed",left:0,right:0,bottom:0,paddingBottom:this.safeAreaInsets+"px",backgroundColor:this.bg,borderRadius:this.borderRadius||"0"},e||(this.showPopup=!0,this.showTrans=!0)},center(e){this.popupstyle="center",this.ani=["zoom-out","fade"],this.transClass={position:"fixed",display:"flex",flexDirection:"column",bottom:0,left:0,right:0,top:0,justifyContent:"center",alignItems:"center",borderRadius:this.borderRadius||"0"},e||(this.showPopup=!0,this.showTrans=!0)},left(e){this.popupstyle="left",this.ani=["slide-left"],this.transClass={position:"fixed",left:0,bottom:0,top:0,backgroundColor:this.bg,borderRadius:this.borderRadius||"0",display:"flex",flexDirection:"column"},e||(this.showPopup=!0,this.showTrans=!0)},right(e){this.popupstyle="right",this.ani=["slide-right"],this.transClass={position:"fixed",bottom:0,right:0,top:0,backgroundColor:this.bg,borderRadius:this.borderRadius||"0",display:"flex",flexDirection:"column"},e||(this.showPopup=!0,this.showTrans=!0)}}};const Vn=Nn(Hn,[["render",function(e,t,s,n,o,i){const r=Fn(D("uni-transition"),Kn),a=K,c=J("keypress");return o.showPopup?(A(),P(a,{key:0,class:R(["uni-popup",[o.popupstyle,i.isDesktop?"fixforpc-z-index":""]])},{default:C((()=>[F(a,{onTouchstart:i.touchstart},{default:C((()=>[o.maskShow?(A(),P(r,{key:"1",name:"mask","mode-class":"fade",styles:o.maskClass,duration:o.duration,show:o.showTrans,onClick:i.onTap},null,8,["styles","duration","show","onClick"])):M("",!0),F(r,{key:"2","mode-class":o.ani,name:"content",styles:o.transClass,duration:o.duration,show:o.showTrans,onClick:i.onTap},{default:C((()=>[F(a,{class:R(["uni-popup__wrapper",[o.popupstyle]]),style:E(i.getStyles),onClick:i.clear},{default:C((()=>[O(e.$slots,"default",{},void 0,!0)])),_:3},8,["style","class","onClick"])])),_:3},8,["mode-class","styles","duration","show","onClick"])])),_:3},8,["onTouchstart"]),o.maskShow?(A(),P(c,{key:0,onEsc:i.onTap},null,8,["onEsc"])):M("",!0)])),_:3},8,["class"])):M("",!0)}],["__scopeId","data-v-2ba3757e"]]),Wn={data:()=>({qcode:"",content:"",statusBarHeight:0}),props:{},computed:{config(){return this.$store.state.config}},created(){},methods:{goHome(){k({url:"/pages/index/index"})},save(){this.$refs.popupFeedback.open("center")},saveBtn(){if(!this.content)return a({title:"请输入你想看的资源信息~",icon:"none"});this.load||(this.load=!0,d({url:baseURL+"api/tool/feedback",data:{content:this.content},success:e=>{200==e.data.code?(a({title:e.data.message}),this.$refs.popupFeedback.close(),this.content=""):a({title:e.data.message,icon:"none"})},complete:()=>{setTimeout((()=>{this.load=!1}),1e3)}}))},showBtn(){if(this.qcode=this.config.qcode,!this.qcode)return a({title:"暂未开启该功能",icon:"none"});this.$refs.popup.open("center")},goMore(e){window.open(e)}}};const zn=Nn(Wn,[["render",function(e,t,s,n,o,i){const r=Y,a=K,c=Fn(D("uni-popup"),Vn),l=Q;return A(),U(j,null,[F(a,{class:"headerBox",style:E("padding-top: "+o.statusBarHeight+"px;")},{default:C((()=>[F(a,{class:"box"},{default:C((()=>[F(a,{class:"logoBox",onClick:i.goHome},{default:C((()=>[F(r,{class:"logo",src:i.config.logo},null,8,["src"]),F(a,{class:"title"},{default:C((()=>[$(N(i.config.app_name||""),1)])),_:1})])),_:1},8,["onClick"]),F(a,{class:"navs"},{default:C((()=>[F(a,{class:"item",onClick:i.showBtn},{default:C((()=>[$("加入群聊")])),_:1},8,["onClick"]),F(a,{class:"item",onClick:i.save},{default:C((()=>[$("提交需求")])),_:1},8,["onClick"]),F(a,{class:"item",onClick:t[0]||(t[0]=e=>i.goMore("https://www.xinyuedh.com"))},{default:C((()=>[$("更多资源")])),_:1})])),_:1})])),_:1})])),_:1},8,["style"]),F(a,{class:"hbox",style:E("padding-top: "+o.statusBarHeight+"px;")},null,8,["style"]),F(c,{ref:"popup","border-radius":"10px 10px 0 0"},{default:C((()=>[F(a,{class:"layerBox"},{default:C((()=>[F(r,{src:o.qcode,mode:"aspectFit"},null,8,["src"])])),_:1})])),_:1},512),F(c,{ref:"popupFeedback","border-radius":"10px 10px 0 0"},{default:C((()=>[F(a,{class:"layerBox"},{default:C((()=>[F(a,{class:"vname"},{default:C((()=>[$("提交需求")])),_:1}),F(l,{modelValue:o.content,"onUpdate:modelValue":t[1]||(t[1]=e=>o.content=e),placeholder:"请输入你想看的资源信息~"},null,8,["modelValue"]),F(a,{class:"vbtn",onClick:i.saveBtn},{default:C((()=>[$("提交")])),_:1},8,["onClick"])])),_:1})])),_:1},512)],64)}],["__scopeId","data-v-33910fbe"]]);const Jn=Nn({data:()=>({}),props:{},methods:{}},[["render",function(e,t,s,n,o,i){const r=K;return A(),P(r,{class:"footerBox"},{default:C((()=>[F(r,{class:"box"},{default:C((()=>[G("p",null,"声明:本站是网盘索引系统,所有内容均来自互联网所提供的公开引用资源,未提供资源上传、存储服务。"),G("p",null,[$("© 2024 心悦搜剧 Powered by "),G("a",{href:"https://www.xinyuedh.com/",target:"_blank"},"心悦导航")])])),_:1})])),_:1})}],["__scopeId","data-v-300b0a0a"]]);export{Jn as F,zn as H,Nn as _,$n as a,Mn as b,Fn as r};
|