2 lines
95 KiB
JavaScript
2 lines
95 KiB
JavaScript
import{af as e,aM as t,aI as n,aQ as s,aN as i,ak as o,al as r,v as a,a2 as c,aR as u,aS as l,aT as h,aU as d,M as g,K as p,J as f,aV as m,aW as y,j as v,n as _,aX as T,aE as w,aJ as x,aB as S,aY as k,aZ as I,a_ as P}from"./index-CH9-aFWw.js";const A={pages:[{path:"pages/index/index",style:{navigationBarTitleText:"视频",navigationStyle:"custom",navigationBarTextStyle:"white",disableScroll:!1}},{path:"pages/news/ce",style:{navigationBarTitleText:"视频",navigationStyle:"custom",navigationBarTextStyle:"white"}},{path:"pages/login/open",style:{navigationBarTitleText:"开屏页",navigationStyle:"custom",navigationBarTextStyle:"white"}},{path:"pages/login/loginPhone",style:{navigationBarTitleText:"手机号登录",navigationStyle:"custom","app-plus":{bounce:"none"}}},{path:"pages/shop/shop",style:{navigationBarTitleText:"商城",navigationStyle:"custom",onReachBottomDistance:100,enablePullDownRefresh:!0}},{path:"pages/merchant/business-operator/index",style:{navigationBarTitleText:"商家管理",onReachBottomDistance:100,navigationStyle:"custom"}},{path:"pages/merchant/order/index",style:{navigationBarTitleText:"商家订单",onReachBottomDistance:100,navigationStyle:"custom"}},{path:"pages/merchant/commodity-release/index",style:{navigationBarTitleText:"发布商品"}},{path:"pages/merchant/specifications/index",style:{navigationBarTitleText:"规格",navigationStyle:"custom"}},{path:"pages/shop/search/index",style:{navigationBarTitleText:"搜索",navigationStyle:"custom",onReachBottomDistance:100,enablePullDownRefresh:!0}},{path:"pages/shop/commodity/index",style:{navigationBarTitleText:"商品详情",navigationStyle:"custom",navigationBarTextStyle:"white"}},{path:"pages/shop/continue-pay/index",style:{navigationBarTitleText:"继续付款",navigationStyle:"custom",navigationBarTextStyle:"white"}},{path:"pages/shop/store/index",style:{navigationBarTitleText:"店铺",navigationStyle:"custom",navigationBarTextStyle:"white"}},{path:"pages/shop/order/index",style:{navigationBarTitleText:"订单",navigationStyle:"custom",navigationBarBackgroundColor:"#fff",onReachBottomDistance:100}},{path:"pages/shop/sales/index",style:{navigationBarTitleText:"售后类型",navigationBarBackgroundColor:"#fff"}},{path:"pages/shop/refund/index",style:{navigationBarTitleText:"申请退货退款",navigationBarBackgroundColor:"#fff"}},{path:"pages/shop/money-whereabouts/index",style:{navigationBarTitleText:"钱款去向",navigationStyle:"custom"}},{path:"pages/shop/after-sales/index",style:{navigationBarTitleText:"售后详情",navigationStyle:"custom"}},{path:"pages/shop/transaction-completed/index",style:{navigationBarTitleText:"交易完成"}},{path:"pages/shop/waiting-delivery/index",style:{navigationBarTitleText:"待发货"}},{path:"pages/shop/logistics-state/index",style:{navigationBarTitleText:"物流状态"}},{path:"pages/news/news",style:{navigationBarTitleText:"消息",navigationStyle:"custom","app-plus":{bounce:"none"}}},{path:"pages/news/group-chat-list/index",style:{navigationBarTitleText:"群聊列表"}},{path:"pages/news/group-chat/index",style:{navigationBarTitleText:"创建群聊",navigationBarBackgroundColor:"#fff"}},{path:"pages/news/question-answer/index",style:{navigationBarTitleText:"问答页"}},{path:"pages/news/red-envelope/index",style:{navigationBarTitleText:"红包详情"}},{path:"pages/mine/mine",style:{navigationBarTitleText:"我的",navigationStyle:"custom"}},{path:"pages/mine/set-up/index",style:{navigationBarTitleText:"设置",navigationBarBackgroundColor:"#fff"}},{path:"pages/mine/userinfo",style:{navigationBarTitleText:"个人信息",navigationBarBackgroundColor:"#fff"}},{path:"pages/mine/switch-accounts/index",style:{navigationBarTitleText:"切换账号",navigationStyle:"custom"}},{path:"pages/mine/pay-use/index",style:{navigationBarTitleText:"先用后付",navigationStyle:"custom"}},{path:"pages/mine/real-name-authentication/index",style:{navigationBarTitleText:"实名认证"}},{path:"pages/mine/delivery-address/index",style:{navigationBarTitleText:"收获地址",navigationStyle:"custom",onReachBottomDistance:100,enablePullDownRefresh:!0}},{path:"pages/mine/balance/index",style:{navigationBarTitleText:"余额",navigationStyle:"custom"}},{path:"pages/mine/balance-details/index",style:{navigationBarTitleText:"余额明细",navigationStyle:"custom",onReachBottomDistance:100}},{path:"pages/mine/historical-browsing/index",style:{navigationBarTitleText:"历史浏览",navigationBarBackgroundColor:"#fff",onReachBottomDistance:100,enablePullDownRefresh:!0}},{path:"pages/mine/browsed/index",style:{navigationBarTitleText:"选择已浏览的商品",navigationBarBackgroundColor:"#fff",onReachBottomDistance:100}},{path:"pages/mine/collection/index",style:{navigationBarTitleText:"全部收藏",navigationBarBackgroundColor:"#fff",onReachBottomDistance:100}},{path:"pages/mine/target-store/index",style:{navigationBarTitleText:"关注店铺",navigationBarBackgroundColor:"#fff",onReachBottomDistance:100}},{path:"pages/mine/coupon/index",style:{navigationBarTitleText:"优惠券",navigationBarBackgroundColor:"#fff",onReachBottomDistance:100}},{path:"pages/mine/homepage",style:{navigationBarTitleText:"个人主页",navigationStyle:"custom",navigationBarTextStyle:"white"}},{path:"pages/release/video",style:{navigationBarTitleText:"发布视频",navigationBarBackgroundColor:"#fff"}},{path:"pages/index/wallet",style:{navigationBarTitleText:"我的钱包",navigationBarBackgroundColor:"#fff"}},{path:"pages/index/myTeam",style:{navigationBarTitleText:"我的团队"}},{path:"pages/index/search",style:{navigationBarTitleText:"搜索页",navigationStyle:"custom",enablePullDownRefresh:!0}},{path:"pages/index/videoHome",style:{navigationBarTitleText:"用户视频首页",navigationStyle:"custom"}},{path:"pages/index/report",style:{navigationBarTitleText:"举报",navigationBarBackgroundColor:"#fff"}},{path:"pages/mine/collectsVideo",style:{navigationBarTitleText:"收藏夹视频",navigationBarBackgroundColor:"#fff"}},{path:"pages/index/promotion",style:{navigationBarTitleText:"选择推广视频",navigationBarBackgroundColor:"#fff"}},{path:"pages/index/myQrCode",style:{navigationBarTitleText:"我的分享"}},{path:"pages/index/deal",style:{navigationBarTitleText:"我的交易",navigationStyle:"custom"}},{path:"pages/index/durian",style:{navigationBarTitleText:"榴莲首页"}},{path:"pages/index/durainActivation",style:{navigationBarTitleText:"已激活",navigationBarBackgroundColor:"#fff"}},{path:"pages/index/trade",style:{navigationBarTitleText:"交易市场",navigationBarBackgroundColor:"#fff",enablePullDownRefresh:!0}},{path:"pages/index/orchard",style:{navigationBarTitleText:"榴莲果园",navigationStyle:"custom"}},{path:"pages/index/durianLog",style:{navigationBarTitleText:"榴莲果明细",navigationBarBackgroundColor:"#fff",enablePullDownRefresh:!0}},{path:"pages/index/extend",style:{navigationBarTitleText:"投流推广",navigationBarBackgroundColor:"#fff"}},{path:"pages/login/register",style:{navigationBarTitleText:"注册",navigationStyle:"custom"}},{path:"pages/login/invite",style:{navigationBarTitleText:"邀请",navigationStyle:"custom"}},{path:"pages/login/forget",style:{navigationBarTitleText:"忘记密码",navigationStyle:"custom"}},{path:"pages/login/retrieve",style:{navigationBarTitleText:"找回账户",navigationStyle:"custom"}},{path:"pages/shop/settle",style:{navigationBarTitleText:"商家入驻"}},{path:"pages/index/integral",style:{navigationBarTitleText:"积分",navigationBarBackgroundColor:"#fff"}},{path:"pages/index/integralLog",style:{navigationBarTitleText:"积分变动明细",navigationStyle:"custom",enablePullDownRefresh:!0}},{path:"pages/index/integralMall",style:{navigationBarTitleText:"卷轴商城",navigationBarBackgroundColor:"#fff"}},{path:"pages/index/appeal",style:{navigationBarTitleText:"交易申诉"}},{path:"pages/index/beInvited",style:{navigationBarTitleText:"受邀成功",navigationBarBackgroundColor:"#fff"}},{path:"pages/index/videoDetail",style:{navigationBarTitleText:"视频详情",navigationStyle:"custom"}},{path:"pages/news/newFriend",style:{navigationBarTitleText:"新朋友",navigationBarBackgroundColor:"#fff"}},{path:"pages/news/newAttention",style:{navigationBarTitleText:"新的关注",navigationBarBackgroundColor:"#fff"}},{path:"pages/news/newFans",style:{navigationBarTitleText:"新的粉丝",navigationBarBackgroundColor:"#fff"}},{path:"pages/news/message",style:{navigationBarTitleText:"消息",navigationBarBackgroundColor:"#fff"}},{path:"pages/index/article",style:{navigationBarTitleText:""}},{path:"pages/index/topUp",style:{navigationBarTitleText:"余额充值",navigationBarBackgroundColor:"#fff"}},{path:"pages/news/addFriend",style:{navigationBarTitleText:"添加朋友",navigationBarBackgroundColor:"#fff"}},{path:"pages/news/redPacket",style:{navigationBarTitleText:"红包"}},{path:"pages/news/audio-video/audio",style:{navigationBarTitleText:"语音"}},{path:"pages/news/audio-video/video",style:{navigationBarTitleText:"视频"}},{path:"pages/news/applyFriend",style:{navigationBarTitleText:"好友添加申请"}}],subPackages:[{root:"TUIKit",pages:[{path:"components/TUIConversation/index",style:{navigationBarTitleText:"消息"}},{path:"components/TUIChat/index",style:{navigationBarTitleText:"消息"}},{path:"components/TUIChat/video-play",style:{navigationBarTitleText:"消息"}},{path:"components/TUIChat/web-view",style:{navigationBarTitleText:"消息"}},{path:"components/TUIContact/index",style:{navigationBarTitleText:"消息"}},{path:"components/TUIGroup/index",style:{navigationBarTitleText:"消息"}},{path:"components/TUISearch/index",style:{navigationBarTitleText:"聊天记录"}}]}],tabBar:{list:[{text:"视频",pagePath:"pages/index/index"},{text:"商城",pagePath:"pages/shop/shop"},{text:"消息",pagePath:"pages/news/news"},{text:"个人中心",pagePath:"pages/mine/mine"},{text:"我的",pagePath:"pages/mine/homepage"}]},globalStyle:{navigationBarTextStyle:"black",navigationBarTitleText:"九亿",navigationBarBackgroundColor:"#F8F8F8",backgroundColor:"#F8F8F8","app-plus":{bounce:"none"}},condition:{current:0,list:[{name:"test",path:"pages/index/index"}]},uniIdRouter:{}};function b(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}var C=b((function(e,t){var n;e.exports=(n=n||function(e){var t=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),n={},s=n.lib={},i=s.Base={extend:function(e){var n=t(this);return e&&n.mixIn(e),n.hasOwnProperty("init")&&this.init!==n.init||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},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)}},o=s.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||a).stringify(this)},concat:function(e){var t=this.words,n=e.words,s=this.sigBytes,i=e.sigBytes;if(this.clamp(),s%4)for(var o=0;o<i;o++){var r=n[o>>>2]>>>24-o%4*8&255;t[s+o>>>2]|=r<<24-(s+o)%4*8}else for(o=0;o<i;o+=4)t[s+o>>>2]=n[o>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=i.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n,s=[],i=function(t){var n=987654321,s=4294967295;return function(){var i=((n=36969*(65535&n)+(n>>16)&s)<<16)+(t=18e3*(65535&t)+(t>>16)&s)&s;return i/=4294967296,(i+=.5)*(e.random()>.5?1:-1)}},r=0;r<t;r+=4){var a=i(4294967296*(n||e.random()));n=987654071*a(),s.push(4294967296*a()|0)}return new o.init(s,t)}}),r=n.enc={},a=r.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,s=[],i=0;i<n;i++){var o=t[i>>>2]>>>24-i%4*8&255;s.push((o>>>4).toString(16)),s.push((15&o).toString(16))}return s.join("")},parse:function(e){for(var t=e.length,n=[],s=0;s<t;s+=2)n[s>>>3]|=parseInt(e.substr(s,2),16)<<24-s%8*4;return new o.init(n,t/2)}},c=r.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,s=[],i=0;i<n;i++){var o=t[i>>>2]>>>24-i%4*8&255;s.push(String.fromCharCode(o))}return s.join("")},parse:function(e){for(var t=e.length,n=[],s=0;s<t;s++)n[s>>>2]|=(255&e.charCodeAt(s))<<24-s%4*8;return new o.init(n,t)}},u=r.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},l=s.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new o.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 n=this._data,s=n.words,i=n.sigBytes,r=this.blockSize,a=i/(4*r),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*r,u=e.min(4*c,i);if(c){for(var l=0;l<c;l+=r)this._doProcessBlock(s,l);var h=s.splice(0,c);n.sigBytes-=u}return new o.init(h,u)},clone:function(){var e=i.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});s.Hasher=l.extend({cfg:i.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){l.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,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new h.HMAC.init(e,n).finalize(t)}}});var h=n.algo={};return n}(Math),n)})),O=C,B=(b((function(e,t){var n;e.exports=(n=O,function(e){var t=n,s=t.lib,i=s.WordArray,o=s.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=o.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var s=t+n,i=e[s];e[s]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o=this._hash.words,r=e[t+0],c=e[t+1],g=e[t+2],p=e[t+3],f=e[t+4],m=e[t+5],y=e[t+6],v=e[t+7],_=e[t+8],T=e[t+9],w=e[t+10],x=e[t+11],S=e[t+12],k=e[t+13],I=e[t+14],P=e[t+15],A=o[0],b=o[1],C=o[2],O=o[3];A=u(A,b,C,O,r,7,a[0]),O=u(O,A,b,C,c,12,a[1]),C=u(C,O,A,b,g,17,a[2]),b=u(b,C,O,A,p,22,a[3]),A=u(A,b,C,O,f,7,a[4]),O=u(O,A,b,C,m,12,a[5]),C=u(C,O,A,b,y,17,a[6]),b=u(b,C,O,A,v,22,a[7]),A=u(A,b,C,O,_,7,a[8]),O=u(O,A,b,C,T,12,a[9]),C=u(C,O,A,b,w,17,a[10]),b=u(b,C,O,A,x,22,a[11]),A=u(A,b,C,O,S,7,a[12]),O=u(O,A,b,C,k,12,a[13]),C=u(C,O,A,b,I,17,a[14]),A=l(A,b=u(b,C,O,A,P,22,a[15]),C,O,c,5,a[16]),O=l(O,A,b,C,y,9,a[17]),C=l(C,O,A,b,x,14,a[18]),b=l(b,C,O,A,r,20,a[19]),A=l(A,b,C,O,m,5,a[20]),O=l(O,A,b,C,w,9,a[21]),C=l(C,O,A,b,P,14,a[22]),b=l(b,C,O,A,f,20,a[23]),A=l(A,b,C,O,T,5,a[24]),O=l(O,A,b,C,I,9,a[25]),C=l(C,O,A,b,p,14,a[26]),b=l(b,C,O,A,_,20,a[27]),A=l(A,b,C,O,k,5,a[28]),O=l(O,A,b,C,g,9,a[29]),C=l(C,O,A,b,v,14,a[30]),A=h(A,b=l(b,C,O,A,S,20,a[31]),C,O,m,4,a[32]),O=h(O,A,b,C,_,11,a[33]),C=h(C,O,A,b,x,16,a[34]),b=h(b,C,O,A,I,23,a[35]),A=h(A,b,C,O,c,4,a[36]),O=h(O,A,b,C,f,11,a[37]),C=h(C,O,A,b,v,16,a[38]),b=h(b,C,O,A,w,23,a[39]),A=h(A,b,C,O,k,4,a[40]),O=h(O,A,b,C,r,11,a[41]),C=h(C,O,A,b,p,16,a[42]),b=h(b,C,O,A,y,23,a[43]),A=h(A,b,C,O,T,4,a[44]),O=h(O,A,b,C,S,11,a[45]),C=h(C,O,A,b,P,16,a[46]),A=d(A,b=h(b,C,O,A,g,23,a[47]),C,O,r,6,a[48]),O=d(O,A,b,C,v,10,a[49]),C=d(C,O,A,b,I,15,a[50]),b=d(b,C,O,A,m,21,a[51]),A=d(A,b,C,O,S,6,a[52]),O=d(O,A,b,C,p,10,a[53]),C=d(C,O,A,b,w,15,a[54]),b=d(b,C,O,A,c,21,a[55]),A=d(A,b,C,O,_,6,a[56]),O=d(O,A,b,C,P,10,a[57]),C=d(C,O,A,b,y,15,a[58]),b=d(b,C,O,A,k,21,a[59]),A=d(A,b,C,O,f,6,a[60]),O=d(O,A,b,C,x,10,a[61]),C=d(C,O,A,b,g,15,a[62]),b=d(b,C,O,A,T,21,a[63]),o[0]=o[0]+A|0,o[1]=o[1]+b|0,o[2]=o[2]+C|0,o[3]=o[3]+O|0},_doFinalize:function(){var t=this._data,n=t.words,s=8*this._nDataBytes,i=8*t.sigBytes;n[i>>>5]|=128<<24-i%32;var o=e.floor(s/4294967296),r=s;n[15+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),n[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),t.sigBytes=4*(n.length+1),this._process();for(var a=this._hash,c=a.words,u=0;u<4;u++){var l=c[u];c[u]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return a},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,n,s,i,o,r){var a=e+(t&n|~t&s)+i+r;return(a<<o|a>>>32-o)+t}function l(e,t,n,s,i,o,r){var a=e+(t&s|n&~s)+i+r;return(a<<o|a>>>32-o)+t}function h(e,t,n,s,i,o,r){var a=e+(t^n^s)+i+r;return(a<<o|a>>>32-o)+t}function d(e,t,n,s,i,o,r){var a=e+(n^(t|~s))+i+r;return(a<<o|a>>>32-o)+t}t.MD5=o._createHelper(c),t.HmacMD5=o._createHmacHelper(c)}(Math),n.MD5)})),b((function(e,t){var n,s,i;e.exports=(s=(n=O).lib.Base,i=n.enc.Utf8,void(n.algo.HMAC=s.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=i.parse(t));var n=e.blockSize,s=4*n;t.sigBytes>s&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),r=this._iKey=t.clone(),a=o.words,c=r.words,u=0;u<n;u++)a[u]^=1549556828,c[u]^=909522486;o.sigBytes=r.sigBytes=s,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,n=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(n))}})))})),b((function(e,t){e.exports=O.HmacMD5}))),L=b((function(e,t){e.exports=O.enc.Utf8})),E=b((function(e,t){var n,s,i;e.exports=(i=(s=n=O).lib.WordArray,s.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,s=this._map;e.clamp();for(var i=[],o=0;o<n;o+=3)for(var r=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a<n;a++)i.push(s.charAt(r>>>6*(3-a)&63));var c=s.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(e){var t=e.length,n=this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var o=0;o<n.length;o++)s[n.charCodeAt(o)]=o}var r=n.charAt(64);if(r){var a=e.indexOf(r);-1!==a&&(t=a)}return function(e,t,n){for(var s=[],o=0,r=0;r<t;r++)if(r%4){var a=n[e.charCodeAt(r-1)]<<r%4*2,c=n[e.charCodeAt(r)]>>>6-r%4*2;s[o>>>2]|=(a|c)<<24-o%4*8,o++}return i.create(s,o)}(e,t,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},n.enc.Base64)}));const R="FUNCTION",U="pending",D="rejected";function N(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function M(e){return"object"===N(e)}function q(e){return"function"==typeof e}function F(e){return function(){try{return e.apply(e,arguments)}catch(t){console.error(t)}}}const j="REJECTED",$="NOT_PENDING";class K{constructor({createPromise:e,retryRule:t=j}={}){this.createPromise=e,this.status=null,this.promise=null,this.retryRule=t}get needRetry(){if(!this.status)return!0;switch(this.retryRule){case j:return this.status===D;case $:return this.status!==U}}exec(){return this.needRetry?(this.status=U,this.promise=this.createPromise().then((e=>(this.status="fulfilled",Promise.resolve(e))),(e=>(this.status=D,Promise.reject(e)))),this.promise):this.promise}}function H(e){return e&&"string"==typeof e?JSON.parse(e):e}const J=H([]),W="web";H("");const V=H("[]")||[];let z="";try{z="__UNI__08B31BC"}catch(Ne){}let Q={};function Y(e,t={}){var n,s;return n=Q,s=e,Object.prototype.hasOwnProperty.call(n,s)||(Q[e]=t),Q[e]}const G=["invoke","success","fail","complete"],X=Y("_globalUniCloudInterceptor");function Z(e,t){X[e]||(X[e]={}),M(t)&&Object.keys(t).forEach((n=>{G.indexOf(n)>-1&&function(e,t,n){let s=X[e][t];s||(s=X[e][t]=[]),-1===s.indexOf(n)&&q(n)&&s.push(n)}(e,n,t[n])}))}function ee(e,t){X[e]||(X[e]={}),M(t)?Object.keys(t).forEach((n=>{G.indexOf(n)>-1&&function(e,t,n){const s=X[e][t];if(!s)return;const i=s.indexOf(n);i>-1&&s.splice(i,1)}(e,n,t[n])})):delete X[e]}function te(e,t){return e&&0!==e.length?e.reduce(((e,n)=>e.then((()=>n(t)))),Promise.resolve()):Promise.resolve()}function ne(e,t){return X[e]&&X[e][t]||[]}function se(e){Z("callObject",e)}const ie=Y("_globalUniCloudListener"),oe="response",re="needLogin",ae="refreshToken",ce="clientdb",ue="cloudfunction",le="cloudobject";function he(e){return ie[e]||(ie[e]=[]),ie[e]}function de(e,t){const n=he(e);n.includes(t)||n.push(t)}function ge(e,t){const n=he(e),s=n.indexOf(t);-1!==s&&n.splice(s,1)}function pe(e,t){const n=he(e);for(let s=0;s<n.length;s++)(0,n[s])(t)}let fe,me=!1;function ye(){return fe||(fe=new Promise((e=>{me&&e(),function t(){if("function"==typeof n){const t=n();t&&t[0]&&(me=!0,e())}me||setTimeout((()=>{t()}),30)}()})),fe)}function ve(e){const t={};for(const n in e){const s=e[n];q(s)&&(t[n]=F(s))}return t}class _e 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 Te={request:e=>h(e),uploadFile:e=>d(e),setStorageSync:(e,t)=>g(e,t),getStorageSync:e=>p(e),removeStorageSync:e=>f(e),clearStorageSync:()=>m(),connectSocket:e=>y(e)};function we(e){return e&&we(e.__v_raw)||e}function xe(){return{token:Te.getStorageSync("uni_id_token")||Te.getStorageSync("uniIdToken"),tokenExpired:Te.getStorageSync("uni_id_token_expired")}}function Se({token:e,tokenExpired:t}={}){e&&Te.setStorageSync("uni_id_token",e),t&&Te.setStorageSync("uni_id_token_expired",t)}let ke,Ie;function Pe(){return ke||(ke=v()),ke}function Ae(){let e,t;try{if(P){if(P.toString().indexOf("not yet implemented")>-1)return;const{scene:n,channel:s}=P();e=s,t=n}}catch(n){}return{channel:e,scene:t}}let be={};function Ce(){const e=I&&I()||"en";if(Ie)return{...be,...Ie,locale:e,LOCALE:e};const t=Pe(),{deviceId:n,osName:s,uniPlatform:i,appId:o}=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 Ie={PLATFORM:i,OS:s,APPID:o,DEVICEID:n,...Ae(),...t},{...be,...Ie,locale:e,LOCALE:e}}var Oe=function(e,t){let n="";return Object.keys(e).sort().forEach((function(t){e[t]&&(n=n+"&"+t+"="+e[t])})),n=n.slice(1),B(n,t).toString()},Be=function(e,t){return new Promise(((n,s)=>{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 n=e.data&&e.data.error&&e.data.error.code||"SYS_ERR",i=e.data&&e.data.error&&e.data.error.message||e.errMsg||"request:fail";return s(new _e({code:n,message:i,requestId:t}))}const i=e.data;if(i.error)return s(new _e({code:i.error.code,message:i.error.message,requestId:t}));i.result=i.data,i.requestId=t,delete i.data,n(i)}}))}))},Le=function(e){return E.stringify(L.parse(e))},Ee=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=Te,this._getAccessTokenPromiseHub=new K({createPromise:()=>this.requestAuth(this.setupRequest({method:"serverless.auth.user.anonymousAuthorize",params:"{}"},"auth")).then((e=>{if(!e.result||!e.result.accessToken)throw new _e({code:"AUTH_FAILED",message:"获取accessToken失败"});this.setAccessToken(e.result.accessToken)})),retryRule:$})}get hasAccessToken(){return!!this.accessToken}setAccessToken(e){this.accessToken=e}requestWrapped(e){return Be(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,n)=>{!t||"GATEWAY_INVALID_TOKEN"!==t.code&&"InvalidParameter.InvalidToken"!==t.code?n(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"]=Oe(t.data,this.config.clientSecret),t}setupRequest(e,t){const n=Object.assign({},e,{spaceId:this.config.spaceId,timestamp:Date.now()}),s={"Content-Type":"application/json"};return"auth"!==t&&(n.token=this.accessToken,s["x-basement-token"]=this.accessToken),s["x-serverless-sign"]=Oe(n,this.config.clientSecret),{url:this.config.requestUrl,method:"POST",data:n,dataType:"json",header:s}}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),timeout:e.timeout})}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:n,filePath:s,fileType:i,onUploadProgress:o}){return new Promise(((r,a)=>{const c=this.adapter.uploadFile({url:e,formData:t,name:n,filePath:s,fileType:i,header:{"X-OSS-server-side-encrpytion":"AES256"},success(e){e&&e.statusCode<400?r(e):a(new _e({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(e){a(new _e({code:e.code||"UPLOAD_FAILED",message:e.message||e.errMsg||"文件上传失败"}))}});"function"==typeof o&&c&&"function"==typeof c.onProgressUpdate&&c.onProgressUpdate((e=>{o({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:n="image",cloudPathAsRealPath:s=!1,onUploadProgress:i,config:o}){if("string"!==N(t))throw new _e({code:"INVALID_PARAM",message:"cloudPath必须为字符串类型"});if(!(t=t.trim()))throw new _e({code:"INVALID_PARAM",message:"cloudPath不可为空"});if(/:\/\//.test(t))throw new _e({code:"INVALID_PARAM",message:"cloudPath不合法"});const r=o&&o.envType||this.config.envType;if(s&&("/"!==t[0]&&(t="/"+t),t.indexOf("\\")>-1))throw new _e({code:"INVALID_PARAM",message:"使用cloudPath作为路径时,cloudPath不可包含“\\”"});const a=(await this.getOSSUploadOptionsFromPath({env:r,filename:s?t.split("/").pop():t,fileId:s?t:void 0})).result,c="https://"+a.cdnDomain+"/"+a.ossPath,{securityToken:u,accessKeyId:l,signature:h,host:d,ossPath:g,id:p,policy:f,ossCallbackUrl:m}=a,y={"Cache-Control":"max-age=2592000","Content-Disposition":"attachment",OSSAccessKeyId:l,Signature:h,host:d,id:p,key:g,policy:f,success_action_status:200};if(u&&(y["x-oss-security-token"]=u),m){const e=JSON.stringify({callbackUrl:m,callbackBody:JSON.stringify({fileId:p,spaceId:this.config.spaceId}),callbackBodyType:"application/json"});y.callback=Le(e)}const v={url:"https://"+a.host,formData:y,fileName:"file",name:"file",filePath:e,fileType:n};if(await this.uploadFileToOSS(Object.assign({},v,{onUploadProgress:i})),m)return{success:!0,filePath:e,fileID:c};if((await this.reportOSSUpload({id:p})).success)return{success:!0,filePath:e,fileID:c};throw new _e({code:"UPLOAD_FAILED",message:"文件上传失败"})}getTempFileURL({fileList:e}={}){return new Promise(((t,n)=>{Array.isArray(e)&&0!==e.length||n(new _e({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 _e({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}}},Re={init(e){const t=new Ee(e),n={signInAnonymously:function(){return t.authorize()},getLoginState:function(){return Promise.resolve(!1)}};return t.auth=function(){return n},t.customAuth=t.auth,t}};const Ue="undefined"!=typeof location&&"http:"===location.protocol?"http:":"https:";var De,Ne;(Ne=De||(De={})).local="local",Ne.none="none",Ne.session="session";var Me=function(){},qe=b((function(e,t){var n;e.exports=(n=O,function(e){var t=n,s=t.lib,i=s.WordArray,o=s.Hasher,r=t.algo,a=[],c=[];!function(){function t(t){for(var n=e.sqrt(t),s=2;s<=n;s++)if(!(t%s))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var s=2,i=0;i<64;)t(s)&&(i<8&&(a[i]=n(e.pow(s,.5))),c[i]=n(e.pow(s,1/3)),i++),s++}();var u=[],l=r.SHA256=o.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,s=n[0],i=n[1],o=n[2],r=n[3],a=n[4],l=n[5],h=n[6],d=n[7],g=0;g<64;g++){if(g<16)u[g]=0|e[t+g];else{var p=u[g-15],f=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,m=u[g-2],y=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;u[g]=f+u[g-7]+y+u[g-16]}var v=s&i^s&o^i&o,_=(s<<30|s>>>2)^(s<<19|s>>>13)^(s<<10|s>>>22),T=d+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&h)+c[g]+u[g];d=h,h=l,l=a,a=r+T|0,r=o,o=i,i=s,s=T+(_+v)|0}n[0]=n[0]+s|0,n[1]=n[1]+i|0,n[2]=n[2]+o|0,n[3]=n[3]+r|0,n[4]=n[4]+a|0,n[5]=n[5]+l|0,n[6]=n[6]+h|0,n[7]=n[7]+d|0},_doFinalize:function(){var t=this._data,n=t.words,s=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=e.floor(s/4294967296),n[15+(i+64>>>9<<4)]=s,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(l),t.HmacSHA256=o._createHmacHelper(l)}(Math),n.SHA256)})),Fe=qe,je=b((function(e,t){e.exports=O.HmacSHA256}));const $e=()=>{let e;if(!Promise){e=()=>{},e.promise={};const t=()=>{throw new _e({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,n)=>{e=(e,s)=>e?n(e):t(s)}));return e.promise=t,e};function Ke(e){return void 0===e}function He(e){return"[object Null]"===Object.prototype.toString.call(e)}var Je;!function(e){e.WEB="web",e.WX_MP="wx_mp"}(Je||(Je={}));const We={adapter:null,runtime:void 0},Ve=["anonymousUuidKey"];class ze extends Me{constructor(){super(),We.adapter.root.tcbObject||(We.adapter.root.tcbObject={})}setItem(e,t){We.adapter.root.tcbObject[e]=t}getItem(e){return We.adapter.root.tcbObject[e]}removeItem(e){delete We.adapter.root.tcbObject[e]}clear(){delete We.adapter.root.tcbObject}}function Qe(e,t){switch(e){case"local":return t.localStorage||new ze;case"none":return new ze;default:return t.sessionStorage||new ze}}class Ye{constructor(e){if(!this._storage){this._persistence=We.adapter.primaryStorage||e.persistence,this._storage=Qe(this._persistence,We.adapter);const t=`access_token_${e.env}`,n=`access_token_expire_${e.env}`,s=`refresh_token_${e.env}`,i=`anonymous_uuid_${e.env}`,o=`login_type_${e.env}`,r=`user_info_${e.env}`;this.keys={accessTokenKey:t,accessTokenExpireKey:n,refreshTokenKey:s,anonymousUuidKey:i,loginTypeKey:o,userInfoKey:r}}}updatePersistence(e){if(e===this._persistence)return;const t="local"===this._persistence;this._persistence=e;const n=Qe(e,We.adapter);for(const s in this.keys){const e=this.keys[s];if(t&&Ve.includes(s))continue;const i=this._storage.getItem(e);Ke(i)||He(i)||(n.setItem(e,i),this._storage.removeItem(e))}this._storage=n}setStore(e,t,n){if(!this._storage)return;const s={version:n||"localCachev1",content:t},i=JSON.stringify(s);try{this._storage.setItem(e,i)}catch(o){throw o}}getStore(e,t){try{if(!this._storage)return}catch(s){return""}t=t||"localCachev1";const n=this._storage.getItem(e);return n&&n.indexOf(t)>=0?JSON.parse(n).content:""}removeStore(e){this._storage.removeItem(e)}}const Ge={},Xe={};function Ze(e){return Ge[e]}class et{constructor(e,t){this.data=t||null,this.name=e}}class tt extends et{constructor(e,t){super("error",{error:e,data:t}),this.error=e}}const nt=new class{constructor(){this._listeners={}}on(e,t){return n=e,s=t,(i=this._listeners)[n]=i[n]||[],i[n].push(s),this;var n,s,i}off(e,t){return function(e,t,n){if(n&&n[e]){const s=n[e].indexOf(t);-1!==s&&n[e].splice(s,1)}}(e,t,this._listeners),this}fire(e,t){if(e instanceof tt)return console.error(e.error),this;const n="string"==typeof e?new et(e,t||{}):e,s=n.name;if(this._listens(s)){n.target=this;const e=this._listeners[s]?[...this._listeners[s]]:[];for(const t of e)t.call(this,n)}return this}_listens(e){return this._listeners[e]&&this._listeners[e].length>0}};function st(e,t){nt.on(e,t)}function it(e,t={}){nt.fire(e,t)}function ot(e,t){nt.off(e,t)}const rt="loginStateChanged",at="loginStateExpire",ct="loginTypeChanged",ut="anonymousConverted",lt="refreshAccessToken";var ht;!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"}(ht||(ht={}));const dt=["auth.getJwt","auth.logout","auth.signInWithTicket","auth.signInAnonymously","auth.signIn","auth.fetchAccessTokenWithRefreshToken","auth.signUpWithEmailAndPassword","auth.activateEndUserMail","auth.sendPasswordResetEmail","auth.resetPasswordWithToken","auth.isUsernameRegistered"],gt={"X-SDK-Version":"1.3.5"};function pt(e,t,n){const s=e[t];e[t]=function(t){const i={},o={};n.forEach((n=>{const{data:s,headers:r}=n.call(e,t);Object.assign(i,s),Object.assign(o,r)}));const r=t.data;return r&&(()=>{var e;if(e=r,"[object FormData]"!==Object.prototype.toString.call(e))t.data={...r,...i};else for(const t in i)r.append(t,i[t])})(),t.headers={...t.headers||{},...o},s.call(e,t)}}function ft(){const e=Math.random().toString(16).slice(2);return{data:{seqId:e},headers:{...gt,"x-seqid":e}}}class mt{constructor(e={}){var t;this.config=e,this._reqClass=new We.adapter.reqClass({timeout:this.config.timeout,timeoutMsg:`请求在${this.config.timeout/1e3}s内未完成,已中断`,restrictedMethods:["post"]}),this._cache=Ze(this.config.env),this._localCache=(t=this.config.env,Xe[t]),pt(this._reqClass,"post",[ft]),pt(this._reqClass,"upload",[ft]),pt(this._reqClass,"download",[ft])}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(n){t=n}if(this._refreshAccessTokenPromise=null,this._shouldRefreshAccessTokenHook=null,t)throw t;return e}async _refreshAccessToken(){const{accessTokenKey:e,accessTokenExpireKey:t,refreshTokenKey:n,loginTypeKey:s,anonymousUuidKey:i}=this._cache.keys;this._cache.removeStore(e),this._cache.removeStore(t);let o=this._cache.getStore(n);if(!o)throw new _e({message:"未登录CloudBase"});const r={refresh_token:o},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(s)===ht.ANONYMOUS&&"INVALID_REFRESH_TOKEN"===e){const e=this._cache.getStore(i),t=this._cache.getStore(n),s=await this.send("auth.signInAnonymously",{anonymous_uuid:e,refresh_token:t});return this.setRefreshToken(s.refresh_token),this._refreshAccessToken()}it(at),this._cache.removeStore(n)}throw new _e({code:a.data.code,message:`刷新access token失败:${a.data.code}`})}if(a.data.access_token)return it(lt),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(n),this._cache.setStore(n,a.data.refresh_token),this._refreshAccessToken())}async getAccessToken(){const{accessTokenKey:e,accessTokenExpireKey:t,refreshTokenKey:n}=this._cache.keys;if(!this._cache.getStore(n))throw new _e({message:"refresh token不存在,登录状态异常"});let s=this._cache.getStore(e),i=this._cache.getStore(t),o=!0;return this._shouldRefreshAccessTokenHook&&!(await this._shouldRefreshAccessTokenHook(s,i))&&(o=!1),(!s||!i||i<Date.now())&&o?this.refreshAccessToken():{accessToken:s,accessTokenExpire:i}}async request(e,t,n){const s=`x-tcb-trace_${this.config.env}`;let i="application/x-www-form-urlencoded";const o={action:e,env:this.config.env,dataVersion:"2019-08-16",...t};if(-1===dt.indexOf(e)){const{refreshTokenKey:e}=this._cache.keys;this._cache.getStore(e)&&(o.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,o[e]);i="multipart/form-data"}else{i="application/json",r={};for(let e in o)void 0!==o[e]&&(r[e]=o[e])}let a={headers:{"content-type":i}};n&&n.timeout&&(a.timeout=n.timeout),n&&n.onUploadProgress&&(a.onUploadProgress=n.onUploadProgress);const c=this._localCache.getStore(s);c&&(a.headers["X-TCB-Trace"]=c);const{parse:u,inQuery:l,search:h}=t;let d={env:this.config.env};u&&(d.parse=!0),l&&(d={...l,...d});let g=function(e,t,n={}){const s=/\?/.test(t);let i="";for(let o in n)""===i?!s&&(t+="?"):i+="&",i+=`${o}=${encodeURIComponent(n[o])}`;return/^http(s)?\:\/\//.test(t+=i)?t:`${e}${t}`}(Ue,"//tcb-api.tencentcloudapi.com/web",d);h&&(g+=h);const p=await this.post({url:g,data:r,...a}),f=p.header&&p.header["x-tcb-trace"];if(f&&this._localCache.setStore(s,f),200!==Number(p.status)&&200!==Number(p.statusCode)||!p.data)throw new _e({code:"NETWORK_ERROR",message:"network request error"});return p}async send(e,t={},n={}){const s=await this.request(e,t,{...n,onUploadProgress:t.onUploadProgress});if("ACCESS_TOKEN_EXPIRED"===s.data.code&&-1===dt.indexOf(e)){await this.refreshAccessToken();const s=await this.request(e,t,{...n,onUploadProgress:t.onUploadProgress});if(s.data.code)throw new _e({code:s.data.code,message:s.data.message});return s.data}if(s.data.code)throw new _e({code:s.data.code,message:s.data.message});return s.data}setRefreshToken(e){const{accessTokenKey:t,accessTokenExpireKey:n,refreshTokenKey:s}=this._cache.keys;this._cache.removeStore(t),this._cache.removeStore(n),this._cache.setStore(s,e)}}const yt={};function vt(e){return yt[e]}class _t{constructor(e){this.config=e,this._cache=Ze(e.env),this._request=vt(e.env)}setRefreshToken(e){const{accessTokenKey:t,accessTokenExpireKey:n,refreshTokenKey:s}=this._cache.keys;this._cache.removeStore(t),this._cache.removeStore(n),this._cache.setStore(s,e)}setAccessToken(e,t){const{accessTokenKey:n,accessTokenExpireKey:s}=this._cache.keys;this._cache.setStore(n,e),this._cache.setStore(s,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 Tt{constructor(e){if(!e)throw new _e({code:"PARAM_ERROR",message:"envId is not defined"});this._envId=e,this._cache=Ze(this._envId),this._request=vt(this._envId),this.setUserInfo()}linkWithTicket(e){if("string"!=typeof e)throw new _e({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 _e({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:n}=e;return n.forEach((e=>{e.wxOpenId&&e.wxPublicId&&(t=!0)})),{users:n,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:n,avatarUrl:s,province:i,country:o,city:r}=e,{data:a}=await this._request.send("auth.updateUserInfo",{nickName:t,gender:n,avatarUrl:s,province:i,country:o,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 wt{constructor(e){if(!e)throw new _e({code:"PARAM_ERROR",message:"envId is not defined"});this._cache=Ze(e);const{refreshTokenKey:t,accessTokenKey:n,accessTokenExpireKey:s}=this._cache.keys,i=this._cache.getStore(t),o=this._cache.getStore(n),r=this._cache.getStore(s);this.credential={refreshToken:i,accessToken:o,accessTokenExpire:r},this.user=new Tt(e)}get isAnonymousAuth(){return this.loginType===ht.ANONYMOUS}get isCustomAuth(){return this.loginType===ht.CUSTOM}get isWeixinAuth(){return this.loginType===ht.WECHAT||this.loginType===ht.WECHAT_OPEN||this.loginType===ht.WECHAT_PUBLIC}get loginType(){return this._cache.getStore(this._cache.keys.loginTypeKey)}}class xt extends _t{async signIn(){this._cache.updatePersistence("local");const{anonymousUuidKey:e,refreshTokenKey:t}=this._cache.keys,n=this._cache.getStore(e)||void 0,s=this._cache.getStore(t)||void 0,i=await this._request.send("auth.signInAnonymously",{anonymous_uuid:n,refresh_token:s});if(i.uuid&&i.refresh_token){this._setAnonymousUUID(i.uuid),this.setRefreshToken(i.refresh_token),await this._request.refreshAccessToken(),it(rt),it(ct,{env:this.config.env,loginType:ht.ANONYMOUS,persistence:"local"});const e=new wt(this.config.env);return await e.user.refresh(),e}throw new _e({message:"匿名登录失败"})}async linkAndRetrieveDataWithTicket(e){const{anonymousUuidKey:t,refreshTokenKey:n}=this._cache.keys,s=this._cache.getStore(t),i=this._cache.getStore(n),o=await this._request.send("auth.linkAndRetrieveDataWithTicket",{anonymous_uuid:s,refresh_token:i,ticket:e});if(o.refresh_token)return this._clearAnonymousUUID(),this.setRefreshToken(o.refresh_token),await this._request.refreshAccessToken(),it(ut,{env:this.config.env}),it(ct,{loginType:ht.CUSTOM,persistence:"local"}),{credential:{refreshToken:o.refresh_token}};throw new _e({message:"匿名转化失败"})}_setAnonymousUUID(e){const{anonymousUuidKey:t,loginTypeKey:n}=this._cache.keys;this._cache.removeStore(t),this._cache.setStore(t,e),this._cache.setStore(n,ht.ANONYMOUS)}_clearAnonymousUUID(){this._cache.removeStore(this._cache.keys.anonymousUuidKey)}}class St extends _t{async signIn(e){if("string"!=typeof e)throw new _e({code:"PARAM_ERROR",message:"ticket must be a string"});const{refreshTokenKey:t}=this._cache.keys,n=await this._request.send("auth.signInWithTicket",{ticket:e,refresh_token:this._cache.getStore(t)||""});if(n.refresh_token)return this.setRefreshToken(n.refresh_token),await this._request.refreshAccessToken(),it(rt),it(ct,{env:this.config.env,loginType:ht.CUSTOM,persistence:this.config.persistence}),await this.refreshUserInfo(),new wt(this.config.env);throw new _e({message:"自定义登录失败"})}}class kt extends _t{async signIn(e,t){if("string"!=typeof e)throw new _e({code:"PARAM_ERROR",message:"email must be a string"});const{refreshTokenKey:n}=this._cache.keys,s=await this._request.send("auth.signIn",{loginType:"EMAIL",email:e,password:t,refresh_token:this._cache.getStore(n)||""}),{refresh_token:i,access_token:o,access_token_expire:r}=s;if(i)return this.setRefreshToken(i),o&&r?this.setAccessToken(o,r):await this._request.refreshAccessToken(),await this.refreshUserInfo(),it(rt),it(ct,{env:this.config.env,loginType:ht.EMAIL,persistence:this.config.persistence}),new wt(this.config.env);throw s.code?new _e({code:s.code,message:`邮箱登录失败: ${s.message}`}):new _e({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 It extends _t{async signIn(e,t){if("string"!=typeof e)throw new _e({code:"PARAM_ERROR",message:"username must be a string"});"string"!=typeof t&&(t="",console.warn("password is empty"));const{refreshTokenKey:n}=this._cache.keys,s=await this._request.send("auth.signIn",{loginType:ht.USERNAME,username:e,password:t,refresh_token:this._cache.getStore(n)||""}),{refresh_token:i,access_token_expire:o,access_token:r}=s;if(i)return this.setRefreshToken(i),r&&o?this.setAccessToken(r,o):await this._request.refreshAccessToken(),await this.refreshUserInfo(),it(rt),it(ct,{env:this.config.env,loginType:ht.USERNAME,persistence:this.config.persistence}),new wt(this.config.env);throw s.code?new _e({code:s.code,message:`用户名密码登录失败: ${s.message}`}):new _e({message:"用户名密码登录失败"})}}class Pt{constructor(e){this.config=e,this._cache=Ze(e.env),this._request=vt(e.env),this._onAnonymousConverted=this._onAnonymousConverted.bind(this),this._onLoginTypeChanged=this._onLoginTypeChanged.bind(this),st(ct,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 xt(this.config)}customAuthProvider(){return new St(this.config)}emailAuthProvider(){return new kt(this.config)}usernameAuthProvider(){return new It(this.config)}async signInAnonymously(){return new xt(this.config).signIn()}async signInWithEmailAndPassword(e,t){return new kt(this.config).signIn(e,t)}signInWithUsernameAndPassword(e,t){return new It(this.config).signIn(e,t)}async linkAndRetrieveDataWithTicket(e){return this._anonymousAuthProvider||(this._anonymousAuthProvider=new xt(this.config)),st(ut,this._onAnonymousConverted),await this._anonymousAuthProvider.linkAndRetrieveDataWithTicket(e)}async signOut(){if(this.loginType===ht.ANONYMOUS)throw new _e({message:"匿名用户不支持登出操作"});const{refreshTokenKey:e,accessTokenKey:t,accessTokenExpireKey:n}=this._cache.keys,s=this._cache.getStore(e);if(!s)return;const i=await this._request.send("auth.logout",{refresh_token:s});return this._cache.removeStore(e),this._cache.removeStore(t),this._cache.removeStore(n),it(rt),it(ct,{env:this.config.env,loginType:ht.NULL,persistence:this.config.persistence}),i}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){st(rt,(()=>{const t=this.hasLoginState();e.call(this,t)}));const t=this.hasLoginState();e.call(this,t)}onLoginStateExpired(e){st(at,e.bind(this))}onAccessTokenRefreshed(e){st(lt,e.bind(this))}onAnonymousConverted(e){st(ut,e.bind(this))}onLoginTypeChanged(e){st(ct,(()=>{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 wt(this.config.env):null}async isUsernameRegistered(e){if("string"!=typeof e)throw new _e({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 St(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,n=this._cache.getStore(e);return{"x-cloudbase-credentials":this._cache.getStore(t)+"/@@/"+n}}_onAnonymousConverted(e){const{env:t}=e.data;t===this.config.env&&this._cache.updatePersistence(this.config.persistence)}_onLoginTypeChanged(e){const{loginType:t,persistence:n,env:s}=e.data;s===this.config.env&&(this._cache.updatePersistence(n),this._cache.setStore(this._cache.keys.loginTypeKey,t))}}const At=function(e,t){t=t||$e();const n=vt(this.config.env),{cloudPath:s,filePath:i,onUploadProgress:o,fileType:r="image"}=e;return n.send("storage.getUploadMetadata",{path:s}).then((e=>{const{data:{url:a,authorization:c,token:u,fileId:l,cosFileId:h},requestId:d}=e,g={key:s,signature:c,"x-cos-meta-fileid":h,success_action_status:"201","x-cos-security-token":u};n.upload({url:a,data:g,file:i,name:s,fileType:r,onUploadProgress:o}).then((e=>{201===e.statusCode?t(null,{fileID:l,requestId:d}):t(new _e({code:"STORAGE_REQUEST_FAIL",message:`STORAGE_REQUEST_FAIL: ${e.data}`}))})).catch((e=>{t(e)}))})).catch((e=>{t(e)})),t.promise},bt=function(e,t){t=t||$e();const n=vt(this.config.env),{cloudPath:s}=e;return n.send("storage.getUploadMetadata",{path:s}).then((e=>{t(null,e)})).catch((e=>{t(e)})),t.promise},Ct=function({fileList:e},t){if(t=t||$e(),!e||!Array.isArray(e))return{code:"INVALID_PARAM",message:"fileList必须是非空的数组"};for(let s of e)if(!s||"string"!=typeof s)return{code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"};const n={fileid_list:e};return vt(this.config.env).send("storage.batchDeleteFile",n).then((e=>{e.code?t(null,e):t(null,{fileList:e.data.delete_list,requestId:e.requestId})})).catch((e=>{t(e)})),t.promise},Ot=function({fileList:e},t){t=t||$e(),e&&Array.isArray(e)||t(null,{code:"INVALID_PARAM",message:"fileList必须是非空的数组"});let n=[];for(let i of e)"object"==typeof i?(i.hasOwnProperty("fileID")&&i.hasOwnProperty("maxAge")||t(null,{code:"INVALID_PARAM",message:"fileList的元素必须是包含fileID和maxAge的对象"}),n.push({fileid:i.fileID,max_age:i.maxAge})):"string"==typeof i?n.push({fileid:i}):t(null,{code:"INVALID_PARAM",message:"fileList的元素必须是字符串"});const s={file_list:n};return vt(this.config.env).send("storage.batchGetDownloadUrl",s).then((e=>{e.code?t(null,e):t(null,{fileList:e.data.download_list,requestId:e.requestId})})).catch((e=>{t(e)})),t.promise},Bt=async function({fileID:e},t){const n=(await Ot.call(this,{fileList:[{fileID:e,maxAge:600}]})).fileList[0];if("SUCCESS"!==n.code)return t?t(n):new Promise((e=>{e(n)}));const s=vt(this.config.env);let i=n.download_url;if(i=encodeURI(i),!t)return s.download({url:i});t(await s.download({url:i}))},Lt=function({name:e,data:t,query:n,parse:s,search:i,timeout:o},r){const a=r||$e();let c;try{c=t?JSON.stringify(t):""}catch(l){return Promise.reject(l)}if(!e)return Promise.reject(new _e({code:"PARAM_ERROR",message:"函数名不能为空"}));const u={inQuery:n,parse:s,search:i,function_name:e,request_data:c};return vt(this.config.env).send("functions.invokeFunction",u,{timeout:o}).then((e=>{if(e.code)a(null,e);else{let n=e.data.response_data;if(s)a(null,{result:n,requestId:e.requestId});else try{n=JSON.parse(e.data.response_data),a(null,{result:n,requestId:e.requestId})}catch(t){a(new _e({message:"response data must be json"}))}}return a.promise})).catch((e=>{a(e)})),a.promise},Et={timeout:15e3,persistence:"session"},Rt={};class Ut{constructor(e){this.config=e||this.config,this.authObj=void 0}init(e){switch(We.adapter||(this.requestClient=new We.adapter.reqClass({timeout:e.timeout||5e3,timeoutMsg:`请求在${(e.timeout||5e3)/1e3}s内未完成,已中断`})),this.config={...Et,...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 Ut(this.config)}auth({persistence:e}={}){if(this.authObj)return this.authObj;const t=e||We.adapter.primaryStorage||Et.persistence;var n;return t!==this.config.persistence&&(this.config.persistence=t),function(e){const{env:t}=e;Ge[t]=new Ye(e),Xe[t]=new Ye({...e,persistence:"local"})}(this.config),n=this.config,yt[n.env]=new mt(n),this.authObj=new Pt(this.config),this.authObj}on(e,t){return st.apply(this,[e,t])}off(e,t){return ot.apply(this,[e,t])}callFunction(e,t){return Lt.apply(this,[e,t])}deleteFile(e,t){return Ct.apply(this,[e,t])}getTempFileURL(e,t){return Ot.apply(this,[e,t])}downloadFile(e,t){return Bt.apply(this,[e,t])}uploadFile(e,t){return At.apply(this,[e,t])}getUploadMetadata(e,t){return bt.apply(this,[e,t])}registerExtension(e){Rt[e.name]=e}async invokeExtension(e,t){const n=Rt[e];if(!n)throw new _e({message:`扩展${e} 必须先注册`});return await n.invoke(t,this)}useAdapters(e){const{adapter:t,runtime:n}=function(e){const t=(n=e,"[object Array]"===Object.prototype.toString.call(n)?e:[e]);var n;for(const s of t){const{isMatch:e,genAdapter:t,runtime:n}=s;if(e())return{adapter:t(),runtime:n}}}(e)||{};t&&(We.adapter=t),n&&(We.runtime=n)}}var Dt=new Ut;function Nt(e,t,n){void 0===n&&(n={});var s=/\?/.test(t),i="";for(var o in n)""===i?!s&&(t+="?"):i+="&",i+=o+"="+encodeURIComponent(n[o]);return/^http(s)?:\/\//.test(t+=i)?t:""+e+t}class Mt{post(e){const{url:t,data:n,headers:s,timeout:i}=e;return new Promise(((e,o)=>{Te.request({url:Nt("https:",t),data:n,method:"POST",header:s,timeout:i,success(t){e(t)},fail(e){o(e)}})}))}upload(e){return new Promise(((t,n)=>{const{url:s,file:i,data:o,headers:r,fileType:a}=e,c=Te.uploadFile({url:Nt("https:",s),name:"file",formData:Object.assign({},o),filePath:i,fileType:a,header:r,success(e){const n={statusCode:e.statusCode,data:e.data||{}};200===e.statusCode&&o.success_action_status&&(n.statusCode=parseInt(o.success_action_status,10)),t(n)},fail(e){n(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 qt={setItem(e,t){Te.setStorageSync(e,t)},getItem:e=>Te.getStorageSync(e),removeItem(e){Te.removeStorageSync(e)},clear(){Te.clearStorageSync()}};var Ft={genAdapter:function(){return{root:{},reqClass:Mt,localStorage:qt,primaryStorage:"local"}},isMatch:function(){return!0},runtime:"uni_app"};Dt.useAdapters(Ft);const jt=Dt,$t=jt.init;jt.init=function(e){e.env=e.spaceId;const t=$t.call(this,e);t.config.provider="tencent",t.config.spaceId=e.spaceId;const n=t.auth;return t.auth=function(e){const t=n.call(this,e);return["linkAndRetrieveDataWithTicket","signInAnonymously","signOut","getAccessToken","getLoginState","signInWithTicket","getUserInfo"].forEach((e=>{var n;t[e]=(n=t[e],function(e){e=e||{};const{success:t,fail:s,complete:i}=ve(e);if(!(t||s||i))return n.call(this,e);n.call(this,e).then((e=>{t&&t(e),i&&i(e)}),(e=>{s&&s(e),i&&i(e)}))}).bind(t)})),t},t.customAuth=t.auth,t};var Kt=jt;async function Ht(e,t){const n=`http://${e}:${t}/system/ping`;try{const e=await(s={url:n,timeout:500},new Promise(((e,t)=>{Te.request({...s,success(t){e(t)},fail(e){t(e)}})})));return!(!e.data||0!==e.data.code)}catch(i){return!1}var s}const Jt={"serverless.file.resource.generateProximalSign":"storage/generate-proximal-sign","serverless.file.resource.report":"storage/report","serverless.file.resource.delete":"storage/delete","serverless.file.resource.getTempFileURL":"storage/get-temp-file-url"};var Wt=class{constructor(e){if(["spaceId","clientSecret"].forEach((t=>{if(!Object.prototype.hasOwnProperty.call(e,t))throw new Error(`${t} required`)})),!e.endpoint)throw new Error("集群空间未配置ApiEndpoint,配置后需要重新关联服务空间后生效");this.config=Object.assign({},e),this.config.provider="dcloud",this.config.requestUrl=this.config.endpoint+"/client",this.config.envType=this.config.envType||"public",this.adapter=Te}async request(e,t=!0){return e=this.setupRequest(e),Promise.resolve().then((()=>Be(e,this.adapter.request)))}requestLocal(e){return new Promise(((t,n)=>{this.adapter.request(Object.assign(e,{complete(e){if(e||(e={}),!e.statusCode||e.statusCode>=400){const t=e.data&&e.data.code||"SYS_ERR",s=e.data&&e.data.message||"request:fail";return n(new _e({code:t,message:s}))}t({success:!0,result:e.data})}}))}))}setupRequest(e){const t=Object.assign({},e,{spaceId:this.config.spaceId,timestamp:Date.now()}),n={"Content-Type":"application/json"};n["x-serverless-sign"]=Oe(t,this.config.clientSecret);const s=Ce();n["x-client-info"]=encodeURIComponent(JSON.stringify(s));const{token:i}=xe();return n["x-client-token"]=i,{url:this.config.requestUrl,method:"POST",data:t,dataType:"json",header:JSON.parse(JSON.stringify(n))}}async setupLocalRequest(e){const t=Ce(),{token:n}=xe(),s=Object.assign({},e,{spaceId:this.config.spaceId,timestamp:Date.now(),clientInfo:t,token:n}),{address:i,servePort:o}=this.__dev__&&this.__dev__.debugInfo||{},{address:r}=await async function(e,t){let n;for(let s=0;s<e.length;s++){const i=e[s];if(await Ht(i,t)){n=i;break}}return{address:n,port:t}}(i,o);return{url:`http://${r}:${o}/${Jt[e.method]}`,method:"POST",data:s,dataType:"json",header:JSON.parse(JSON.stringify({"Content-Type":"application/json"}))}}callFunction(e){const t={method:"serverless.function.runtime.invoke",params:JSON.stringify({functionTarget:e.name,functionArgs:e.data||{}})};return this.request(t,!1)}getUploadFileOptions(e){const t={method:"serverless.file.resource.generateProximalSign",params:JSON.stringify(e)};return this.request(t)}reportUploadFile(e){const t={method:"serverless.file.resource.report",params:JSON.stringify(e)};return this.request(t)}uploadFile({filePath:e,cloudPath:t,fileType:n="image",onUploadProgress:s}){if(!t)throw new _e({code:"CLOUDPATH_REQUIRED",message:"cloudPath不可为空"});let i;return this.getUploadFileOptions({cloudPath:t}).then((t=>{const{url:o,formData:r,name:a}=t.result;return i=t.result.fileUrl,new Promise(((t,i)=>{const c=this.adapter.uploadFile({url:o,formData:r,name:a,filePath:e,fileType:n,success(e){e&&e.statusCode<400?t(e):i(new _e({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(e){i(new _e({code:e.code||"UPLOAD_FAILED",message:e.message||e.errMsg||"文件上传失败"}))}});"function"==typeof s&&c&&"function"==typeof c.onProgressUpdate&&c.onProgressUpdate((e=>{s({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend})}))}))})).then((()=>this.reportUploadFile({cloudPath:t}))).then((t=>new Promise(((n,s)=>{t.success?n({success:!0,filePath:e,fileID:i}):s(new _e({code:"UPLOAD_FAILED",message:"文件上传失败"}))}))))}deleteFile({fileList:e}){const t={method:"serverless.file.resource.delete",params:JSON.stringify({fileList:e})};return this.request(t).then((e=>{if(e.success)return e.result;throw new _e({code:"DELETE_FILE_FAILED",message:"删除文件失败"})}))}getTempFileURL({fileList:e,maxAge:t}={}){if(!Array.isArray(e)||0===e.length)throw new _e({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"});const n={method:"serverless.file.resource.getTempFileURL",params:JSON.stringify({fileList:e,maxAge:t})};return this.request(n).then((e=>{if(e.success)return{fileList:e.result.fileList.map((e=>({fileID:e.fileID,tempFileURL:e.tempFileURL})))};throw new _e({code:"GET_TEMP_FILE_URL_FAILED",message:"获取临时文件链接失败"})}))}},Vt={init(e){const t=new Wt(e),n={signInAnonymously:function(){return Promise.resolve()},getLoginState:function(){return Promise.resolve(!1)}};return t.auth=function(){return n},t.customAuth=t.auth,t}},zt=b((function(e,t){e.exports=O.enc.Hex}));function Qt(){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 Yt(e="",t={}){const{data:n,functionName:s,method:i,headers:o,signHeaderKeys:r=[],config:a}=t,c=Date.now(),u=Qt(),l=Object.assign({},o,{"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":s,"x-client-timestamp":c,"x-alipay-source":"client","x-request-id":u,"x-alipay-callid":u,"x-trace-id":u}),h=["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),[d="",g=""]=e.split("?")||[],p=function(e){const t=e.signedHeaders.join(";"),n=e.signedHeaders.map((t=>`${t.toLowerCase()}:${e.headers[t]}\n`)).join(""),s=Fe(e.body).toString(zt),i=`${e.method.toUpperCase()}\n${e.path}\n${e.query}\n${n}\n${t}\n${s}\n`,o=Fe(i).toString(zt),r=`HMAC-SHA256\n${e.timestamp}\n${o}\n`,a=je(r,e.secretKey).toString(zt);return`HMAC-SHA256 Credential=${e.secretId}, SignedHeaders=${t}, Signature=${a}`}({path:d,query:g,method:i,headers:l,timestamp:c,body:JSON.stringify(n),secretId:a.accessKey,secretKey:a.secretKey,signedHeaders:h.sort()});return{url:`${a.endpoint}${e}`,headers:Object.assign({},l,{Authorization:p})}}function Gt({url:e,data:t,method:n="POST",headers:s={},timeout:i}){return new Promise(((o,r)=>{Te.request({url:e,method:n,data:"object"==typeof t?JSON.stringify(t):t,header:s,dataType:"json",timeout:i,complete:(e={})=>{const t=s["x-trace-id"]||"";if(!e.statusCode||e.statusCode>=400){const{message:n,errMsg:s,trace_id:i}=e.data||{};return r(new _e({code:"SYS_ERR",message:n||s||"request:fail",requestId:i||t}))}o({status:e.statusCode,data:e.data,headers:e.header,requestId:t})}})}))}function Xt(e,t){const{path:n,data:s,method:i="GET"}=e,{url:o,headers:r}=Yt(n,{functionName:"",data:s,method:i,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 Gt({url:o,data:s,method:i,headers:r}).then((e=>{const t=e.data||{};if(!t.success)throw new _e({code:e.errCode,message:e.errMsg,requestId:e.requestId});return t.data||{}})).catch((e=>{throw new _e({code:e.errCode,message:e.errMsg,requestId:e.requestId})}))}function Zt(e=""){const t=e.trim().replace(/^cloud:\/\//,""),n=t.indexOf("/");if(n<=0)throw new _e({code:"INVALID_PARAM",message:"fileID不合法"});const s=t.substring(0,n),i=t.substring(n+1);return s!==this.config.spaceId&&console.warn("file ".concat(e," does not belong to env ").concat(this.config.spaceId)),i}function en(e=""){return"cloud://".concat(this.config.spaceId,"/").concat(e.replace(/^\/+/,""))}class tn{constructor(e){this.config=e}signedURL(e,t={}){const n=`/ws/function/${e}`,s=this.config.wsEndpoint.replace(/^ws(s)?:\/\//,""),i=Object.assign({},t,{accessKeyId:this.config.accessKey,signatureNonce:Qt(),timestamp:""+Date.now()}),o=[n,["accessKeyId","authorization","signatureNonce","timestamp"].sort().map((function(e){return i[e]?"".concat(e,"=").concat(i[e]):null})).filter(Boolean).join("&"),`host:${s}`].join("\n"),r=["HMAC-SHA256",Fe(o).toString(zt)].join("\n"),a=je(r,this.config.secretKey).toString(zt),c=Object.keys(i).map((e=>`${e}=${encodeURIComponent(i[e])}`)).join("&");return`${this.config.wsEndpoint}${n}?${c}&signature=${a}`}}var nn=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 tn(this.config)}callFunction(e){return function(e,t){const{name:n,data:s,async:i=!1,timeout:o}=e,r="POST",a={"x-to-function-name":n};i&&(a["x-function-invoke-type"]="async");const{url:c,headers:u}=Yt("/functions/invokeFunction",{functionName:n,data:s,method:r,headers:a,signHeaderKeys:["x-to-function-name"],config:t});return Gt({url:c,data:s,method:r,headers:u,timeout:o}).then((e=>{let t=0;if(i){const n=e.data||{};t="200"===n.errCode?0:n.errCode,e.data=n.data||{},e.errMsg=n.errMsg}if(0!==t)throw new _e({code:t,message:e.errMsg,requestId:e.requestId});return{errCode:t,success:0===t,requestId:e.requestId,result:e.data}})).catch((e=>{throw new _e({code:e.errCode,message:e.errMsg,requestId:e.requestId})}))}(e,this.config)}uploadFileToOSS({url:e,filePath:t,fileType:n,formData:s,onUploadProgress:i}){return new Promise(((o,r)=>{const a=Te.uploadFile({url:e,filePath:t,fileType:n,formData:s,name:"file",success(e){e&&e.statusCode<400?o(e):r(new _e({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(e){r(new _e({code:e.code||"UPLOAD_FAILED",message:e.message||e.errMsg||"文件上传失败"}))}});"function"==typeof i&&a&&"function"==typeof a.onProgressUpdate&&a.onProgressUpdate((e=>{i({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend})}))}))}async uploadFile({filePath:e,cloudPath:t="",fileType:n="image",onUploadProgress:s}){if("string"!==N(t))throw new _e({code:"INVALID_PARAM",message:"cloudPath必须为字符串类型"});if(!(t=t.trim()))throw new _e({code:"INVALID_PARAM",message:"cloudPath不可为空"});if(/:\/\//.test(t))throw new _e({code:"INVALID_PARAM",message:"cloudPath不合法"});const i=await Xt({path:"/".concat(t.replace(/^\//,""),"?post_url")},this.config),{file_id:o,upload_url:r,form_data:a}=i,c=a&&a.reduce(((e,t)=>(e[t.key]=t.value,e)),{});return this.uploadFileToOSS({url:r,filePath:e,fileType:n,formData:c,onUploadProgress:s}).then((()=>({fileID:o})))}async getTempFileURL({fileList:e}){return new Promise(((t,n)=>{(!e||e.length<0)&&n(new _e({errCode:"INVALID_PARAM",errMsg:"fileList不能为空数组"})),e.length>50&&n(new _e({errCode:"INVALID_PARAM",errMsg:"fileList数组长度不能超过50"}));const s=[];for(const i of e){"string"!==N(i)&&n(new _e({errCode:"INVALID_PARAM",errMsg:"fileList的元素必须是非空的字符串"}));const e=Zt.call(this,i);s.push({file_id:e,expire:600})}Xt({path:"/?download_url",data:{file_list:s},method:"POST"},this.config).then((e=>{const{file_list:n=[]}=e;t({fileList:n.map((e=>({fileID:en.call(this,e.file_id),tempFileURL:e.download_url})))})})).catch((e=>n(e)))}))}async connectWebSocket(e){const{name:t,query:n}=e;return Te.connectSocket({url:this._websocket.signedURL(t,n),complete:()=>{}})}},sn={init:e=>{e.provider="alipay";const t=new nn(e);return t.auth=function(){return{signInAnonymously:function(){return Promise.resolve()},getLoginState:function(){return Promise.resolve(!0)}}},t}};function on({data:e}){let t;t=Ce();const n=JSON.parse(JSON.stringify(e||{}));if(Object.assign(n,{clientInfo:t}),!n.uniIdToken){const{token:e}=xe();e&&(n.uniIdToken=e)}return n}const rn=[{rule:/fc_function_not_found|FUNCTION_NOT_FOUND/,content:",云函数[{functionName}]在云端不存在,请检查此云函数名称是否正确以及该云函数是否已上传到服务空间",mode:"append"}];var an=/[\\^$.*+?()[\]{}|]/g,cn=RegExp(an.source);function un(e,t,n){return e.replace(new RegExp((s=t)&&cn.test(s)?s.replace(an,"\\$&"):s,"g"),n);var s}const ln=2e4,hn={code:20101,message:"Invalid client"};function dn(e){const{errSubject:t,subject:n,errCode:s,errMsg:i,code:o,message:r,cause:a}=e||{};return new _e({subject:t||n||"uni-secure-network",code:s||o||ln,message:i||r,cause:a})}let gn;function pn({secretType:e}={}){return"request"===e||"response"===e||"both"===e}function fn({functionName:e,result:t,logPvd:n}){}function mn(e){const t=e.callFunction,n=function(n){const s=n.name;n.data=on.call(e,{data:n.data});const i={aliyun:"aliyun",tencent:"tcb",tcb:"tcb",alipay:"alipay",dcloud:"dcloud"}[this.config.provider],o=pn(n)||false;return t.call(this,n).then((e=>(e.errCode=0,!o&&fn.call(this,{functionName:s,result:e,logPvd:i}),Promise.resolve(e))),(e=>(!o&&fn.call(this,{functionName:s,result:e,logPvd:i}),e&&e.message&&(e.message=function({message:e="",extraInfo:t={},formatter:n=[]}={}){for(let s=0;s<n.length;s++){const{rule:i,content:o,mode:r}=n[s],a=e.match(i);if(!a)continue;let c=o;for(let e=1;e<a.length;e++)c=un(c,`{$${e}}`,a[e]);for(const e in t)c=un(c,`{${e}}`,t[e]);return"replace"===r?c:e+c}return e}({message:`[${n.name}]: ${e.message}`,formatter:rn,extraInfo:{functionName:s}})),Promise.reject(e))))};e.callFunction=function(t){const{provider:s,spaceId:i}=e.config,o=t.name;let r,a;return t.data=t.data||{},r=n,r=r.bind(e),a=pn(t)?new gn({secretType:t.secretType,uniCloudIns:e}).wrapEncryptDataCallFunction(n.bind(e))(t):function({provider:e,spaceId:t,functionName:n}={}){const{appId:s,uniPlatform:i,osName:o}=Pe();let r=i;"app"===i&&(r=o);const a=function({provider:e,spaceId:t}={}){const n=J;if(!n)return{};e=function(e){return"tencent"===e?"tcb":e}(e);const s=n.find((n=>n.provider===e&&n.spaceId===t));return s&&s.config}({provider:e,spaceId:t});if(!a||!a.accessControl||!a.accessControl.enable)return!1;const c=a.accessControl.function||{},u=Object.keys(c);if(0===u.length)return!0;const l=function(e,t){let n,s,i;for(let o=0;o<e.length;o++){const r=e[o];r!==t?"*"!==r?r.split(",").map((e=>e.trim())).indexOf(t)>-1&&(s=r):i=r:n=r}return n||s||i}(u,n);if(!l)return!1;if((c[l]||[]).find(((e={})=>e.appId===s&&(e.platform||"").toLowerCase()===r.toLowerCase())))return!0;throw console.error(`此应用[appId: ${s}, platform: ${r}]不在云端配置的允许访问的应用列表内,参考:https://uniapp.dcloud.net.cn/uniCloud/secure-network.html#verify-client`),dn(hn)}({provider:s,spaceId:i,functionName:o})?new gn({secretType:t.secretType,uniCloudIns:e}).wrapVerifyClientCallFunction(n.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)))}}gn=class{constructor(){throw dn({message:`Platform ${W} is not supported by secure network`})}};const yn=Symbol("CLIENT_DB_INTERNAL");function vn(e,t){return e.then="DoNotReturnProxyWithAFunctionNamedThen",e._internalType=yn,e.inspect=null,e.__v_raw=void 0,new Proxy(e,{get(e,n,s){if("_uniClient"===n)return null;if("symbol"==typeof n)return e[n];if(n in e||"string"!=typeof n){const t=e[n];return"function"==typeof t?t.bind(e):t}return t.get(e,n,s)}})}function _n(e){return{on:(t,n)=>{e[t]=e[t]||[],e[t].indexOf(n)>-1||e[t].push(n)},off:(t,n)=>{e[t]=e[t]||[];const s=e[t].indexOf(n);-1!==s&&e[t].splice(s,1)}}}const Tn=["db.Geo","db.command","command.aggregate"];function wn(e,t){return Tn.indexOf(`${e}.${t}`)>-1}function xn(e){switch(N(e=we(e))){case"array":return e.map((e=>xn(e)));case"object":return e._internalType===yn||Object.keys(e).forEach((t=>{e[t]=xn(e[t])})),e;case"regexp":return{$regexp:{source:e.source,flags:e.flags}};case"date":return{$date:e.toISOString()};default:return e}}function Sn(e){return e&&e.content&&e.content.$method}class kn{constructor(e,t,n){this.content=e,this.prevStage=t||null,this.udb=null,this._database=n}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:xn(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=Sn(e),n=Sn(e.prevStage);if("aggregate"===t&&"collection"===n||"pipeline"===t)return!0;e=e.prevStage}return!1}get isCommand(){let e=this;for(;e;){if("command"===Sn(e))return!0;e=e.prevStage}return!1}get isAggregateCommand(){let e=this;for(;e;){const t=Sn(e),n=Sn(e.prevStage);if("aggregate"===t&&"command"===n)return!0;e=e.prevStage}return!1}getNextStageFn(e){const t=this;return function(){return In({$method:e,$param:xn(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 n=this.getAction(),s=this.getCommand();return s.$db.push({$method:e,$param:xn(t)}),this._database._callCloudFunction({action:n,command:s})}}function In(e,t,n){return vn(new kn(e,t,n),{get(e,t){let s="db";return e&&e.content&&(s=e.content.$method),wn(s,t)?In({$method:t},e,n):function(){return In({$method:t,$param:xn(Array.from(arguments))},e,n)}}})}function Pn({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 An(e,t={}){return vn(new e(t),{get:(e,t)=>wn("db",t)?In({$method:t},null,e):function(){return In({$method:t,$param:xn(Array.from(arguments))},null,e)}})}class bn extends class{constructor({uniClient:e={},isJQL:t=!1}={}){this._uniClient=e,this._authCallBacks={},this._dbCallBacks={},e._isDefault&&(this._dbCallBacks=Y("_globalUniCloudDatabaseCallback")),t||(this.auth=_n(this._authCallBacks)),this._isJQL=t,Object.assign(this,_n(this._dbCallBacks)),this.env=vn({},{get:(e,t)=>({$env:t})}),this.Geo=vn({},{get:(e,t)=>Pn({path:["Geo"],method:t})}),this.serverDate=Pn({path:[],method:"serverDate"}),this.RegExp=Pn({path:[],method:"RegExp"})}getCloudEnv(e){if("string"!=typeof e||!e.trim())throw new Error("getCloudEnv参数错误");return{$env:e.replace("$cloudEnv_","")}}_callback(e,t){const n=this._dbCallBacks;n[e]&&n[e].forEach((e=>{e(...t)}))}_callbackAuth(e,t){const n=this._authCallBacks;n[e]&&n[e].forEach((e=>{e(...t)}))}multiSend(){const e=Array.from(arguments),t=e.map((e=>{const t=e.getAction(),n=e.getCommand();if("getTemp"!==n.$db[n.$db.length-1].$method)throw new Error("multiSend只支持子命令内使用getTemp");return{action:t,command:n}}));return this._callCloudFunction({multiCommand:t,queryList:e})}}{_parseResult(e){return this._isJQL?e.result:e}_callCloudFunction({action:e,command:t,multiCommand:n,queryList:s}){function i(e,t){if(n&&s)for(let n=0;n<s.length;n++){const i=s[n];i.udb&&"function"==typeof i.udb.setResult&&(t?i.udb.setResult(t):i.udb.setResult(e.result.dataList[n]))}}const o=this,r=this._isJQL?"databaseForJQL":"database";function a(e){return o._callback("error",[e]),te(ne(r,"fail"),e).then((()=>te(ne(r,"complete"),e))).then((()=>(i(null,e),pe(oe,{type:ce,content:e}),Promise.reject(e))))}const c=te(ne(r,"invoke")),u=this._uniClient;return c.then((()=>u.callFunction({name:"DCloud-clientDB",type:"CLIENT_DB",data:{action:e,command:t,multiCommand:n}}))).then((e=>{const{code:t,message:n,token:s,tokenExpired:c,systemInfo:u=[]}=e.result;if(u)for(let i=0;i<u.length;i++){const{level:e,message:t,detail:n}=u[i];let s="[System Info]"+t;n&&(s=`${s}\n详细信息:${n}`),(console[e]||console.log)(s)}if(t)return a(new _e({code:t,message:n,requestId:e.requestId}));e.result.errCode=e.result.errCode||e.result.code,e.result.errMsg=e.result.errMsg||e.result.message,s&&c&&(Se({token:s,tokenExpired:c}),this._callbackAuth("refreshToken",[{token:s,tokenExpired:c}]),this._callback("refreshToken",[{token:s,tokenExpired:c}]),pe(ae,{token:s,tokenExpired:c}));const l=[{prop:"affectedDocs",tips:"affectedDocs不再推荐使用,请使用inserted/deleted/updated/data.length替代"},{prop:"code",tips:"code不再推荐使用,请使用errCode替代"},{prop:"message",tips:"message不再推荐使用,请使用errMsg替代"}];for(let i=0;i<l.length;i++){const{prop:t,tips:n}=l[i];if(t in e.result){const s=e.result[t];Object.defineProperty(e.result,t,{get:()=>(console.warn(n),s)})}}return h=e,te(ne(r,"success"),h).then((()=>te(ne(r,"complete"),h))).then((()=>{i(h,null);const e=o._parseResult(h);return pe(oe,{type:ce,content:e}),Promise.resolve(e)}));var h}),(e=>(/fc_function_not_found|FUNCTION_NOT_FOUND/g.test(e.message)&&console.warn("clientDB未初始化,请在web控制台保存一次schema以开启clientDB"),a(new _e({code:e.code||"SYSTEM_ERROR",message:e.message,requestId:e.requestId})))))}}const Cn="token无效,跳转登录页面",On="token过期,跳转登录页面",Bn={TOKEN_INVALID_TOKEN_EXPIRED:On,TOKEN_INVALID_INVALID_CLIENTID:Cn,TOKEN_INVALID:Cn,TOKEN_INVALID_WRONG_TOKEN:Cn,TOKEN_INVALID_ANONYMOUS_USER:Cn},Ln={"uni-id-token-expired":On,"uni-id-check-token-failed":Cn,"uni-id-token-not-exist":Cn,"uni-id-check-device-feature-failed":Cn};function En(e,t){let n="";return n=e?`${e}/${t}`:t,n.replace(/^\//,"")}function Rn(e=[],t=""){const n=[],s=[];return e.forEach((e=>{!0===e.needLogin?n.push(En(t,e.path)):!1===e.needLogin&&s.push(En(t,e.path))})),{needLoginPage:n,notNeedLoginPage:s}}function Un(e){return e.split("?")[0].replace(/^\//,"")}function Dn(){return function(e){let t=e&&e.$page&&e.$page.fullPath||"";return t?("/"!==t.charAt(0)&&(t="/"+t),t):t}(function(){const e=n();return e[e.length-1]}())}function Nn(){return Un(Dn())}function Mn(e="",t={}){if(!e)return!1;if(!(t&&t.list&&t.list.length))return!1;const n=t.list,s=Un(e);return n.some((e=>e.pagePath===s))}const qn=!!A.uniIdRouter,{loginPage:Fn,routerNeedLogin:jn,resToLogin:$n,needLoginPage:Kn,notNeedLoginPage:Hn,loginPageInTabBar:Jn}=function({pages:e=[],subPackages:t=[],uniIdRouter:n={},tabBar:s={}}=A){const{loginPage:i,needLogin:o=[],resToLogin:r=!0}=n,{needLoginPage:a,notNeedLoginPage:c}=Rn(e),{needLoginPage:u,notNeedLoginPage:l}=function(e=[]){const t=[],n=[];return e.forEach((e=>{const{root:s,pages:i=[]}=e,{needLoginPage:o,notNeedLoginPage:r}=Rn(i,s);t.push(...o),n.push(...r)})),{needLoginPage:t,notNeedLoginPage:n}}(t);return{loginPage:i,routerNeedLogin:o,resToLogin:r,needLoginPage:[...a,...u],notNeedLoginPage:[...c,...l],loginPageInTabBar:Mn(i,s)}}();if(Kn.indexOf(Fn)>-1)throw new Error(`Login page [${Fn}] should not be "needLogin", please check your pages.json`);function Wn(e){const t=Nn();if("/"===e.charAt(0))return e;const[n,s]=e.split("?"),i=n.replace(/^\//,"").split("/"),o=t.split("/");o.pop();for(let r=0;r<i.length;r++){const e=i[r];".."===e?o.pop():"."!==e&&o.push(e)}return""===o[0]&&o.shift(),"/"+o.join("/")+(s?"?"+s:"")}function Vn({redirect:e}){const t=Un(e),n=Un(Fn);return Nn()!==n&&t!==n}function zn({api:e,redirect:t}={}){if(!t||!Vn({redirect:t}))return;const n=(i=t,"/"!==(s=Fn).charAt(0)&&(s="/"+s),i?s.indexOf("?")>-1?s+`&uniIdRedirectUrl=${encodeURIComponent(i)}`:s+`?uniIdRedirectUrl=${encodeURIComponent(i)}`:s);var s,i;Jn?"navigateTo"!==e&&"redirectTo"!==e||(e="switchTab"):"switchTab"===e&&(e="navigateTo");const o={navigateTo:_,redirectTo:T,switchTab:w,reLaunch:x};setTimeout((()=>{o[e]({url:n})}),0)}function Qn({url:e}={}){const t={abortLoginPageJump:!1,autoToLoginPage:!1},n=function(){const{token:e,tokenExpired:t}=xe();let n;if(e){if(t<Date.now()){const e="uni-id-token-expired";n={errCode:e,errMsg:Ln[e]}}}else{const e="uni-id-check-token-failed";n={errCode:e,errMsg:Ln[e]}}return n}();if(function(e){const t=Un(Wn(e));return!(Hn.indexOf(t)>-1)&&(Kn.indexOf(t)>-1||jn.some((t=>{return n=e,new RegExp(t).test(n);var n})))}(e)&&n){if(n.uniIdRedirectUrl=e,he(re).length>0)return setTimeout((()=>{pe(re,n)}),0),t.abortLoginPageJump=!0,t;t.autoToLoginPage=!0}return t}function Yn(){!function(){const e=Dn(),{abortLoginPageJump:t,autoToLoginPage:n}=Qn({url:e});t||n&&zn({api:"redirectTo",redirect:e})}();const e=["navigateTo","redirectTo","reLaunch","switchTab"];for(let t=0;t<e.length;t++){const n=e[t];s(n,{invoke(e){const{abortLoginPageJump:t,autoToLoginPage:s}=Qn({url:e.url});return t?e:s?(zn({api:n,redirect:Wn(e.url)}),!1):e}})}}function Gn(){this.onResponse((e=>{const{type:t,content:n}=e;let s=!1;switch(t){case"cloudobject":s=function(e){if("object"!=typeof e)return!1;const{errCode:t}=e||{};return t in Ln}(n);break;case"clientdb":s=function(e){if("object"!=typeof e)return!1;const{errCode:t}=e||{};return t in Bn}(n)}s&&function(e={}){const t=he(re);ye().then((()=>{const n=Dn();if(n&&Vn({redirect:n}))return t.length>0?pe(re,Object.assign({uniIdRedirectUrl:n},e)):void(Fn&&zn({api:"navigateTo",redirect:n}))}))}(n)}))}function Xn(e){var t;(t=e).onResponse=function(e){de(oe,e)},t.offResponse=function(e){ge(oe,e)},function(e){e.onNeedLogin=function(e){de(re,e)},e.offNeedLogin=function(e){ge(re,e)},qn&&(Y("_globalUniCloudStatus").needLoginInit||(Y("_globalUniCloudStatus").needLoginInit=!0,ye().then((()=>{Yn.call(e)})),$n&&Gn.call(e)))}(e),function(e){e.onRefreshToken=function(e){de(ae,e)},e.offRefreshToken=function(e){ge(ae,e)}}(e)}let Zn;const es="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",ts=/^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;function ns(){const e=xe().token||"",t=e.split(".");if(!e||3!==t.length)return{uid:null,role:[],permission:[],tokenExpired:0};let n;try{n=JSON.parse((s=t[1],decodeURIComponent(Zn(s).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""))))}catch(i){throw new Error("获取当前用户信息出错,详细错误信息为:"+i.message)}var s;return n.tokenExpired=1e3*n.exp,delete n.exp,delete n.iat,n}Zn="function"!=typeof atob?function(e){if(e=String(e).replace(/[\t\n\f\r ]+/g,""),!ts.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 n,s,i="",o=0;o<e.length;)t=es.indexOf(e.charAt(o++))<<18|es.indexOf(e.charAt(o++))<<12|(n=es.indexOf(e.charAt(o++)))<<6|(s=es.indexOf(e.charAt(o++))),i+=64===n?String.fromCharCode(t>>16&255):64===s?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,255&t);return i}:atob;var ss=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(b((function(n,s){Object.defineProperty(s,"__esModule",{value:!0});const o="chooseAndUploadFile:ok",r="chooseAndUploadFile:fail";function a(e,t){return e.tempFiles.forEach(((e,n)=>{e.name||(e.name=e.path.substring(e.path.lastIndexOf("/")+1)),t&&(e.fileType=t),e.cloudPath=Date.now()+"_"+n+e.name.substring(e.name.lastIndexOf("."))})),e.tempFilePaths||(e.tempFilePaths=e.tempFiles.map((e=>e.path))),e}function c(e,t,{onChooseFile:n,onUploadProgress:s}){return t.then((e=>{if(n){const t=n(e);if(void 0!==t)return Promise.resolve(t).then((t=>void 0===t?e:t))}return e})).then((t=>!1===t?{errMsg:o,tempFilePaths:[],tempFiles:[]}:function(e,t,n=5,s){(t=Object.assign({},t)).errMsg=o;const i=t.tempFiles,r=i.length;let a=0;return new Promise((o=>{for(;a<n;)c();function c(){const n=a++;if(n>=r)return void(!i.find((e=>!e.url&&!e.errMsg))&&o(t));const u=i[n];e.uploadFile({provider:u.provider,filePath:u.path,cloudPath:u.cloudPath,fileType:u.fileType,cloudPathAsRealPath:u.cloudPathAsRealPath,onUploadProgress(e){e.index=n,e.tempFile=u,e.tempFilePath=u.path,s&&s(e)}}).then((e=>{u.url=e.fileID,n<r&&c()})).catch((e=>{u.errMsg=e.errMsg||e.message,n<r&&c()}))}}))}(e,t,5,s)))}s.initChooseAndUploadFile=function(n){return function(s={type:"all"}){return"image"===s.type?c(n,function(t){const{count:n,sizeType:s,sourceType:i=["album","camera"],extension:o}=t;return new Promise(((t,c)=>{e({count:n,sizeType:s,sourceType:i,extension:o,success(e){t(a(e,"image"))},fail(e){c({errMsg:e.errMsg.replace("chooseImage:fail",r)})}})}))}(s),s):"video"===s.type?c(n,function(e){const{camera:n,compressed:s,maxDuration:i,sourceType:o=["album","camera"],extension:c}=e;return new Promise(((e,u)=>{t({camera:n,compressed:s,maxDuration:i,sourceType:o,extension:c,success(t){const{tempFilePath:n,duration:s,size:i,height:o,width:r}=t;e(a({errMsg:"chooseVideo:ok",tempFilePaths:[n],tempFiles:[{name:t.tempFile&&t.tempFile.name||"",path:n,size:i,type:t.tempFile&&t.tempFile.type||"",width:r,height:o,duration:s,fileType:"video",cloudPath:""}]},"video"))},fail(e){u({errMsg:e.errMsg.replace("chooseVideo:fail",r)})}})}))}(s),s):c(n,function(e){const{count:t,extension:n}=e;return new Promise(((e,s)=>{let o=i;if("undefined"!=typeof wx&&"function"==typeof wx.chooseMessageFile&&(o=wx.chooseMessageFile),"function"!=typeof o)return s({errMsg:r+" 请指定 type 类型,该平台仅支持选择 image 或 video。"});o({type:"all",count:t,extension:n,success(t){e(a(t))},fail(e){s({errMsg:e.errMsg.replace("chooseFile:fail",r)})}})}))}(s),s)}}})));function is(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 n=!1;const s=[];for(let i=2;i<e.length;i++)e[i]!==t[i]&&(s.push(e[i]),n=!0);e[0]!==t[0]&&(this.mixinDatacomPage.current=this.pageCurrent),this.mixinDatacomPage.size=this.pageSize,this.onMixinDatacomPropsChange(n,s)}))},methods:{onMixinDatacomPropsChange(e,t){},mixinDatacomEasyGet({getone:e=!1,success:t,fail:n}={}){this.mixinDatacomLoading||(this.mixinDatacomLoading=!0,this.mixinDatacomErrorMessage="",this.mixinDatacomError=null,this.mixinDatacomGet().then((n=>{this.mixinDatacomLoading=!1;const{data:s,count:i}=n.result;this.getcount&&(this.mixinDatacomPage.count=i),this.mixinDatacomHasMore=s.length<this.pageSize;const o=e?s.length?s[0]:void 0:s;this.mixinDatacomResData=o,t&&t(o)})).catch((e=>{this.mixinDatacomLoading=!1,this.mixinDatacomErrorMessage=e,this.mixinDatacomError=e,n&&n(e)})))},mixinDatacomGet(t={}){let n;t=t||{},n="undefined"!=typeof __uniX&&__uniX?e.databaseForJQL(this.spaceInfo):e.database(this.spaceInfo);const s=t.action||this.action;s&&(n=n.action(s));const i=t.collection||this.collection;n=Array.isArray(i)?n.collection(...i):n.collection(i);const o=t.where||this.where;o&&Object.keys(o).length&&(n=n.where(o));const r=t.field||this.field;r&&(n=n.field(r));const a=t.foreignKey||this.foreignKey;a&&(n=n.foreignKey(a));const c=t.groupby||this.groupby;c&&(n=n.groupBy(c));const u=t.groupField||this.groupField;u&&(n=n.groupField(u)),!0===(void 0!==t.distinct?t.distinct:this.distinct)&&(n=n.distinct());const l=t.orderby||this.orderby;l&&(n=n.orderBy(l));const h=void 0!==t.pageCurrent?t.pageCurrent:this.mixinDatacomPage.current,d=void 0!==t.pageSize?t.pageSize:this.mixinDatacomPage.size,g=void 0!==t.getcount?t.getcount:this.getcount,p=void 0!==t.gettree?t.gettree:this.gettree,f=void 0!==t.gettreepath?t.gettreepath:this.gettreepath,m={getCount:g},y={limitLevel:void 0!==t.limitlevel?t.limitlevel:this.limitlevel,startWith:void 0!==t.startwith?t.startwith:this.startwith};return p&&(m.getTree=y),f&&(m.getTreePath=y),n=n.skip(d*(h-1)).limit(d).get(m),n}}}}function os(e){return Y("_globalUniCloudSecureNetworkCache__{spaceId}".replace("{spaceId}",e.config.spaceId))}async function rs({openid:e,callLoginByWeixin:t=!1}={}){throw os(this),new Error(`[SecureNetwork] API \`initSecureNetworkByWeixin\` is not supported on platform \`${W}\``)}async function as(e){const t=os(this);return t.initPromise||(t.initPromise=rs.call(this,e).then((e=>e)).catch((e=>{throw delete t.initPromise,e}))),t.initPromise}function cs(e){be=e}function us(e){const t={getSystemInfo:S,getPushClientId:k};return function(n){return new Promise(((s,i)=>{t[e]({...n,success(e){s(e)},fail(e){i(e)}})}))}}class ls 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 n=this._callback[e];if(!n)return;const s=function(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]===t)return n;return-1}(n,t);n.splice(s,1)}off(e,t){return this.removeListener(e,t)}removeAllListener(e){delete this._callback[e]}emit(e,...t){const n=this._callback[e];if(n)for(let s=0;s<n.length;s++)n[s](...t)}}{constructor(){super(),this._uniPushMessageCallback=this._receivePushMessage.bind(this),this._currentMessageId=-1,this._payloadQueue=[]}init(){return Promise.all([us("getSystemInfo")(),us("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:n,messageId:s,message:i}=t;this._payloadQueue.push({action:n,messageId:s,message:i}),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:n,message:s}=e;"end"===t?this._end({messageId:n,message:s}):"message"===t&&this._appendMessage({messageId:n,message:s})}_appendMessage({messageId:e,message:t}={}){this.emit("message",t)}_end({messageId:e,message:t}={}){this.emit("end",t),this.close()}_initMessageListener(){u(this._uniPushMessageCallback)}_destroy(){l(this._uniPushMessageCallback)}toJSON(){return{appId:this._appId,pushClientId:this._pushClientId,seqId:this._seqId}}close(){this._destroy(),this.emit("close")}}const hs={tcb:Kt,tencent:Kt,aliyun:Re,private:Vt,dcloud:Vt,alipay:sn};let ds=new class{init(e){let t={};const n=hs[e.provider];if(!n)throw new Error("未提供正确的provider参数");var s;return t=n.init(e),function(e){e._initPromiseHub||(e._initPromiseHub=new K({createPromise:function(){let t=Promise.resolve();t=new Promise((e=>{setTimeout((()=>{e()}),1)}));const n=e.auth();return t.then((()=>n.getLoginState())).then((e=>e?Promise.resolve():n.signInAnonymously()))}}))}(t),mn(t),function(e){const t=e.uploadFile;e.uploadFile=function(e){return t.call(this,e)}}(t),(s=t).database=function(e){if(e&&Object.keys(e).length>0)return s.init(e).database();if(this._database)return this._database;const t=An(bn,{uniClient:s});return this._database=t,t},s.databaseForJQL=function(e){if(e&&Object.keys(e).length>0)return s.init(e).databaseForJQL();if(this._databaseForJQL)return this._databaseForJQL;const t=An(bn,{uniClient:s,isJQL:!0});return this._databaseForJQL=t,t},function(e){e.getCurrentUserInfo=ns,e.chooseAndUploadFile=ss.initChooseAndUploadFile(e),Object.assign(e,{get mixinDatacom(){return is(e)}}),e.SSEChannel=ls,e.initSecureNetworkByWeixin=function(e){return function({openid:t,callLoginByWeixin:n=!1}={}){return as.call(e,{openid:t,callLoginByWeixin:n})}}(e),e.setCustomClientInfo=cs,e.importObject=function(t){return function(n,s={}){s=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}},s);const{customUI:i,loadingOptions:u,errorOptions:l,parseSystemError:h}=s,d=!i;return new Proxy({},{get(i,g){switch(g){case"toString":return"[object UniCloudObject]";case"toJSON":return{}}return function({fn:e,interceptorName:t,getCallbackArgs:n}={}){return async function(...s){const i=n?n({params:s}):{};let o,r;try{return await te(ne(t,"invoke"),{...i}),o=await e(...s),await te(ne(t,"success"),{...i,result:o}),o}catch(a){throw r=a,await te(ne(t,"fail"),{...i,error:r}),r}finally{await te(ne(t,"complete"),r?{...i,error:r}:{...i,result:o})}}}({fn:async function i(...p){let f;d&&o({title:u.title,mask:u.mask});const m={name:n,type:"OBJECT",data:{method:g,params:p}};"object"==typeof s.secretMethods&&function(e,t){const n=t.data.method,s=e.secretMethods||{},i=s[n]||s["*"];i&&(t.secretType=i)}(s,m);let y=!1;try{f=await t.callFunction(m)}catch(e){y=!0,f={result:new _e(e)}}const{errSubject:v,errCode:_,errMsg:T,newToken:w}=f.result||{};if(d&&r(),w&&w.token&&w.tokenExpired&&(Se(w),pe(ae,{...w})),_){let e=T;if(y&&h&&(e=(await h({objectName:n,methodName:g,params:p,errSubject:v,errCode:_,errMsg:T})).errMsg||T),d)if("toast"===l.type)a({title:e,icon:"none"});else{if("modal"!==l.type)throw new Error(`Invalid errorOptions.type: ${l.type}`);{const{confirm:t}=await async function({title:e,content:t,showCancel:n,cancelText:s,confirmText:i}={}){return new Promise(((o,r)=>{c({title:e,content:t,showCancel:n,cancelText:s,confirmText:i,success(e){o(e)},fail(){o({confirm:!1,cancel:!0})}})}))}({title:"提示",content:e,showCancel:l.retry,cancelText:"取消",confirmText:l.retry?"重试":"确定"});if(l.retry&&t)return i(...p)}}const t=new _e({subject:v,code:_,message:T,requestId:f.requestId});throw t.detail=f.result,pe(oe,{type:le,content:t}),t}return pe(oe,{type:le,content:f.result}),f.result},interceptorName:"callObject",getCallbackArgs:function({params:e}={}){return{objectName:n,methodName:g,params:e}}})}})}}(e)}(t),["callFunction","uploadFile","deleteFile","getTempFileURL","downloadFile","chooseAndUploadFile"].forEach((e=>{if(!t[e])return;const n=t[e];t[e]=function(){return n.apply(t,Array.from(arguments))},t[e]=function(e,t){return function(n){let s=!1;if("callFunction"===t){const e=n&&n.type||R;s=e!==R}const i="callFunction"===t&&!s,o=this._initPromiseHub.exec();n=n||{};const{success:r,fail:a,complete:c}=ve(n),u=o.then((()=>s?Promise.resolve():te(ne(t,"invoke"),n))).then((()=>e.call(this,n))).then((e=>s?Promise.resolve(e):te(ne(t,"success"),e).then((()=>te(ne(t,"complete"),e))).then((()=>(i&&pe(oe,{type:ue,content:e}),Promise.resolve(e))))),(e=>s?Promise.reject(e):te(ne(t,"fail"),e).then((()=>te(ne(t,"complete"),e))).then((()=>(pe(oe,{type:ue,content:e}),Promise.reject(e))))));if(!(r||a||c))return u;u.then((e=>{r&&r(e),c&&c(e),i&&pe(oe,{type:ue,content:e})}),(e=>{a&&a(e),c&&c(e),i&&pe(oe,{type:ue,content:e})}))}}(t[e],e).bind(t)})),t.init=this.init,t}};(()=>{const e=V;let t={};if(e&&1===e.length)t=e[0],ds=ds.init(t),ds._isDefault=!0;else{const t=["auth","callFunction","uploadFile","deleteFile","getTempFileURL","downloadFile","database","getCurrentUSerInfo","importObject"];let n;n=e&&e.length>0?"应用有多个服务空间,请通过uniCloud.init方法指定要使用的服务空间":"应用未关联服务空间,请在uniCloud目录右键关联服务空间",t.forEach((e=>{ds[e]=function(){return console.error(n),Promise.reject(new _e({code:"SYS_ERR",message:n}))}}))}Object.assign(ds,{get mixinDatacom(){return is(ds)}}),Xn(ds),ds.addInterceptor=Z,ds.removeInterceptor=ee,ds.interceptObject=se})();var gs=ds;export{gs as Y};
|