pages-me-apply-apply.f106c6c2.js 85.2 KB
import{Q as e,R as t,S as s,T as n,U as r,V as i,W as o,X as a,I as c,Y as l,Z as u,_ as h,$ as d,a0 as f,z as p,x as g,a1 as m,y,a2 as _,a3 as w,a4 as v,K as k,a5 as T,a6 as b,a7 as S,a8 as P,a9 as I,r as A,b as x,o as C,c as O,w as R,e as E,t as D,h as L,f as U,j as N,g as F,aa as q,F as M,G as j,C as B,k as $,ab as K,u as W,p as J,q as V,s as z,D as H,ac as Q,ad as G,P as Y,v as X}from"./index-cc160fad.js";import{_ as Z}from"./uni-icons.0366203f.js";import{_ as ee}from"./_plugin-vue_export-helper.1b428a4d.js";const te={easycom:{autoscan:!0,custom:{"^n-(.*)":"@/ty/components/n-$1/n-$1.vue","^nu-(.*)":"@/ty/ui/nu-$1/nu-$1.vue"}},pages:[{path:"pages/index/index",aliasPath:"/",style:{navigationBarTitleText:"首页",enablePullDownRefresh:!1},meta:{auth:!1,sync:!0,title:"首页",group:"模板"}},{path:"pages/me/index",style:{navigationBarTitleText:"个人中心",enablePullDownRefresh:!1},meta:{auth:!0,sync:!0,title:"我的",group:"模板"}},{path:"pages/myOrder/myOrder",style:{navigationBarTitleText:"我的订单",enablePullDownRefresh:!1,onReachBottomDistance:50}},{path:"pages/activity/activity",style:{navigationBarTitleText:"举办活动",enablePullDownRefresh:!1},meta:{auth:!1,sync:!0,title:"举办活动"}},{path:"pages/me/apply/apply",style:{navigationBarTitleText:"申请代理人",enablePullDownRefresh:!1}},{path:"pages/me/apply/apply_success",style:{navigationBarTitleText:"申请代理人通过",enablePullDownRefresh:!1}},{path:"pages/orderDetail/orderDetail",style:{navigationBarTitleText:"订单详情",enablePullDownRefresh:!0}},{path:"pages/achievement/achievement",style:{navigationBarTitleText:"个人业绩",enablePullDownRefresh:!1}},{path:"pages/achievement/searchachievement",style:{navigationBarTitleText:"个人业绩",enablePullDownRefresh:!1}},{path:"pages/map/map",style:{navigationBarTitleText:"地图",enablePullDownRefresh:!1}},{path:"pages/myGift/myGift",style:{navigationBarTitleText:"我的礼品",enablePullDownRefresh:!0}},{path:"pages/useCoupon/useCoupon",style:{navigationBarTitleText:"用卷",enablePullDownRefresh:!1}},{path:"pages/invite/invite",style:{navigationBarTitleText:"邀请有礼",enablePullDownRefresh:!1}},{path:"pages/verification/verification",style:{navigationBarTitleText:"扫码核销",enablePullDownRefresh:!1}},{path:"pages/me/envelope/envelope",style:{navigationBarTitleText:"我的红包",enablePullDownRefresh:!1}},{path:"pages/me/order/order",style:{navigationBarTitleText:"订单管理",enablePullDownRefresh:!1}},{path:"pages/me/order/orderdetail",style:{navigationBarTitleText:"订单管理",enablePullDownRefresh:!1}},{path:"pages/verification/allverification",style:{navigationBarTitleText:"核销记录",enablePullDownRefresh:!1,onReachBottomDistance:20}},{path:"pages/me/user/user",style:{navigationBarTitleText:"用户角色",enablePullDownRefresh:!1}},{path:"pages/businesscenter/businesscenter",style:{navigationBarTitleText:"商家中心",enablePullDownRefresh:!1}}],subPackages:[{root:"pages/login",pages:[{path:"login",aliasPath:"/",style:{navigationBarTitleText:"登录",navigationBarBackgroundColor:"#FFFFFF"}}]}],globalStyle:{navigationBarTextStyle:"black",navigationBarTitleText:"通用模板",navigationBarBackgroundColor:"#F8F8F8",backgroundColor:"#F8F8F8"},tabBar:{borderStyle:"white",selectedColor:"#1F78FF",backgroundColor:"#FFFFFF",color:"#999999",list:[{pagePath:"pages/index/index",iconPath:"static/images/tabbar/flowerg.png",selectedIconPath:"static/images/tabbar/flower.png",text:"精选活动"},{pagePath:"pages/myOrder/myOrder",iconPath:"static/images/tabbar/order.png",selectedIconPath:"static/images/tabbar/orderb.png",text:"我的订单"},{pagePath:"pages/me/index",iconPath:"static/images/tabbar/user.png",selectedIconPath:"static/images/tabbar/userb.png",text:"个人中心"}]}};function se(e,t,s){return e(s={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&s.path)}},s.exports),s.exports}var ne=se((function(e,t){var s;e.exports=(s=s||function(e,t){var s=Object.create||function(){function e(){}return function(t){var s;return e.prototype=t,s=new e,e.prototype=null,s}}(),n={},r=n.lib={},i=r.Base={extend:function(e){var t=s(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},o=r.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,s=e.words,n=this.sigBytes,r=e.sigBytes;if(this.clamp(),n%4)for(var i=0;i<r;i++){var o=s[i>>>2]>>>24-i%4*8&255;t[n+i>>>2]|=o<<24-(n+i)%4*8}else for(i=0;i<r;i+=4)t[n+i>>>2]=s[i>>>2];return this.sigBytes+=r,this},clamp:function(){var t=this.words,s=this.sigBytes;t[s>>>2]&=4294967295<<32-s%4*8,t.length=e.ceil(s/4)},clone:function(){var e=i.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var s,n=[],r=function(t){var s=987654321,n=4294967295;return function(){var r=((s=36969*(65535&s)+(s>>16)&n)<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n;return r/=4294967296,(r+=.5)*(e.random()>.5?1:-1)}},i=0;i<t;i+=4){var a=r(4294967296*(s||e.random()));s=987654071*a(),n.push(4294967296*a()|0)}return new o.init(n,t)}}),a=n.enc={},c=a.Hex={stringify:function(e){for(var t=e.words,s=e.sigBytes,n=[],r=0;r<s;r++){var i=t[r>>>2]>>>24-r%4*8&255;n.push((i>>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,s=[],n=0;n<t;n+=2)s[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new o.init(s,t/2)}},l=a.Latin1={stringify:function(e){for(var t=e.words,s=e.sigBytes,n=[],r=0;r<s;r++){var i=t[r>>>2]>>>24-r%4*8&255;n.push(String.fromCharCode(i))}return n.join("")},parse:function(e){for(var t=e.length,s=[],n=0;n<t;n++)s[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new o.init(s,t)}},u=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(l.stringify(e)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(e){return l.parse(unescape(encodeURIComponent(e)))}},h=r.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 s=this._data,n=s.words,r=s.sigBytes,i=this.blockSize,a=r/(4*i),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*i,l=e.min(4*c,r);if(c){for(var u=0;u<c;u+=i)this._doProcessBlock(n,u);var h=n.splice(0,c);s.sigBytes-=l}return new o.init(h,l)},clone:function(){var e=i.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});r.Hasher=h.extend({cfg:i.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){h.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,s){return new e.init(s).finalize(t)}},_createHmacHelper:function(e){return function(t,s){return new d.HMAC.init(e,s).finalize(t)}}});var d=n.algo={};return n}(Math),s)})),re=ne,ie=(se((function(e,t){var s;e.exports=(s=re,function(e){var t=s,n=t.lib,r=n.WordArray,i=n.Hasher,o=t.algo,a=[];!function(){for(var t=0;t<64;t++)a[t]=4294967296*e.abs(e.sin(t+1))|0}();var c=o.MD5=i.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var s=0;s<16;s++){var n=t+s,r=e[n];e[n]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}var i=this._hash.words,o=e[t+0],c=e[t+1],f=e[t+2],p=e[t+3],g=e[t+4],m=e[t+5],y=e[t+6],_=e[t+7],w=e[t+8],v=e[t+9],k=e[t+10],T=e[t+11],b=e[t+12],S=e[t+13],P=e[t+14],I=e[t+15],A=i[0],x=i[1],C=i[2],O=i[3];A=l(A,x,C,O,o,7,a[0]),O=l(O,A,x,C,c,12,a[1]),C=l(C,O,A,x,f,17,a[2]),x=l(x,C,O,A,p,22,a[3]),A=l(A,x,C,O,g,7,a[4]),O=l(O,A,x,C,m,12,a[5]),C=l(C,O,A,x,y,17,a[6]),x=l(x,C,O,A,_,22,a[7]),A=l(A,x,C,O,w,7,a[8]),O=l(O,A,x,C,v,12,a[9]),C=l(C,O,A,x,k,17,a[10]),x=l(x,C,O,A,T,22,a[11]),A=l(A,x,C,O,b,7,a[12]),O=l(O,A,x,C,S,12,a[13]),C=l(C,O,A,x,P,17,a[14]),A=u(A,x=l(x,C,O,A,I,22,a[15]),C,O,c,5,a[16]),O=u(O,A,x,C,y,9,a[17]),C=u(C,O,A,x,T,14,a[18]),x=u(x,C,O,A,o,20,a[19]),A=u(A,x,C,O,m,5,a[20]),O=u(O,A,x,C,k,9,a[21]),C=u(C,O,A,x,I,14,a[22]),x=u(x,C,O,A,g,20,a[23]),A=u(A,x,C,O,v,5,a[24]),O=u(O,A,x,C,P,9,a[25]),C=u(C,O,A,x,p,14,a[26]),x=u(x,C,O,A,w,20,a[27]),A=u(A,x,C,O,S,5,a[28]),O=u(O,A,x,C,f,9,a[29]),C=u(C,O,A,x,_,14,a[30]),A=h(A,x=u(x,C,O,A,b,20,a[31]),C,O,m,4,a[32]),O=h(O,A,x,C,w,11,a[33]),C=h(C,O,A,x,T,16,a[34]),x=h(x,C,O,A,P,23,a[35]),A=h(A,x,C,O,c,4,a[36]),O=h(O,A,x,C,g,11,a[37]),C=h(C,O,A,x,_,16,a[38]),x=h(x,C,O,A,k,23,a[39]),A=h(A,x,C,O,S,4,a[40]),O=h(O,A,x,C,o,11,a[41]),C=h(C,O,A,x,p,16,a[42]),x=h(x,C,O,A,y,23,a[43]),A=h(A,x,C,O,v,4,a[44]),O=h(O,A,x,C,b,11,a[45]),C=h(C,O,A,x,I,16,a[46]),A=d(A,x=h(x,C,O,A,f,23,a[47]),C,O,o,6,a[48]),O=d(O,A,x,C,_,10,a[49]),C=d(C,O,A,x,P,15,a[50]),x=d(x,C,O,A,m,21,a[51]),A=d(A,x,C,O,b,6,a[52]),O=d(O,A,x,C,p,10,a[53]),C=d(C,O,A,x,k,15,a[54]),x=d(x,C,O,A,c,21,a[55]),A=d(A,x,C,O,w,6,a[56]),O=d(O,A,x,C,I,10,a[57]),C=d(C,O,A,x,y,15,a[58]),x=d(x,C,O,A,S,21,a[59]),A=d(A,x,C,O,g,6,a[60]),O=d(O,A,x,C,T,10,a[61]),C=d(C,O,A,x,f,15,a[62]),x=d(x,C,O,A,v,21,a[63]),i[0]=i[0]+A|0,i[1]=i[1]+x|0,i[2]=i[2]+C|0,i[3]=i[3]+O|0},_doFinalize:function(){var t=this._data,s=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;s[r>>>5]|=128<<24-r%32;var i=e.floor(n/4294967296),o=n;s[15+(r+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),s[14+(r+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),t.sigBytes=4*(s.length+1),this._process();for(var a=this._hash,c=a.words,l=0;l<4;l++){var u=c[l];c[l]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}return a},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,s,n,r,i,o){var a=e+(t&s|~t&n)+r+o;return(a<<i|a>>>32-i)+t}function u(e,t,s,n,r,i,o){var a=e+(t&n|s&~n)+r+o;return(a<<i|a>>>32-i)+t}function h(e,t,s,n,r,i,o){var a=e+(t^s^n)+r+o;return(a<<i|a>>>32-i)+t}function d(e,t,s,n,r,i,o){var a=e+(s^(t|~n))+r+o;return(a<<i|a>>>32-i)+t}t.MD5=i._createHelper(c),t.HmacMD5=i._createHmacHelper(c)}(Math),s.MD5)})),se((function(e,t){var s,n,r;e.exports=(n=(s=re).lib.Base,r=s.enc.Utf8,void(s.algo.HMAC=n.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=r.parse(t));var s=e.blockSize,n=4*s;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),o=this._iKey=t.clone(),a=i.words,c=o.words,l=0;l<s;l++)a[l]^=1549556828,c[l]^=909522486;i.sigBytes=o.sigBytes=n,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,s=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(s))}})))})),se((function(e,t){e.exports=re.HmacMD5}))),oe=se((function(e,t){e.exports=re.enc.Utf8})),ae=se((function(e,t){var s,n,r;e.exports=(r=(n=s=re).lib.WordArray,n.enc.Base64={stringify:function(e){var t=e.words,s=e.sigBytes,n=this._map;e.clamp();for(var r=[],i=0;i<s;i+=3)for(var o=(t[i>>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,a=0;a<4&&i+.75*a<s;a++)r.push(n.charAt(o>>>6*(3-a)&63));var c=n.charAt(64);if(c)for(;r.length%4;)r.push(c);return r.join("")},parse:function(e){var t=e.length,s=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var i=0;i<s.length;i++)n[s.charCodeAt(i)]=i}var o=s.charAt(64);if(o){var a=e.indexOf(o);-1!==a&&(t=a)}return function(e,t,s){for(var n=[],i=0,o=0;o<t;o++)if(o%4){var a=s[e.charCodeAt(o-1)]<<o%4*2,c=s[e.charCodeAt(o)]>>>6-o%4*2;n[i>>>2]|=(a|c)<<24-i%4*8,i++}return r.create(n,i)}(e,t,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},s.enc.Base64)}));const ce="FUNCTION",le="pending",ue="rejected";function he(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function de(e){return"object"===he(e)}function fe(e){return"function"==typeof e}function pe(e){return function(){try{return e.apply(e,arguments)}catch(t){console.error(t)}}}const ge="REJECTED",me="NOT_PENDING";class ye{constructor({createPromise:e,retryRule:t=ge}={}){this.createPromise=e,this.status=null,this.promise=null,this.retryRule=t}get needRetry(){if(!this.status)return!0;switch(this.retryRule){case ge:return this.status===ue;case me:return this.status!==le}}exec(){return this.needRetry?(this.status=le,this.promise=this.createPromise().then((e=>(this.status="fullfilled",Promise.resolve(e))),(e=>(this.status=ue,Promise.reject(e)))),this.promise):this.promise}}function _e(e){return e&&"string"==typeof e?JSON.parse(e):e}const we=_e([]);_e("");const ve=_e("[]")||[];let ke="";try{ke="__UNI__92322DB"}catch(ht){}let Te={};function be(e,t={}){var s,n;return s=Te,n=e,Object.prototype.hasOwnProperty.call(s,n)||(Te[e]=t),Te[e]}const Se=["invoke","success","fail","complete"],Pe=be("_globalUniCloudInterceptor");function Ie(e,t){Pe[e]||(Pe[e]={}),de(t)&&Object.keys(t).forEach((s=>{Se.indexOf(s)>-1&&function(e,t,s){let n=Pe[e][t];n||(n=Pe[e][t]=[]),-1===n.indexOf(s)&&fe(s)&&n.push(s)}(e,s,t[s])}))}function Ae(e,t){Pe[e]||(Pe[e]={}),de(t)?Object.keys(t).forEach((s=>{Se.indexOf(s)>-1&&function(e,t,s){const n=Pe[e][t];if(!n)return;const r=n.indexOf(s);r>-1&&n.splice(r,1)}(e,s,t[s])})):delete Pe[e]}function xe(e,t){return e&&0!==e.length?e.reduce(((e,s)=>e.then((()=>s(t)))),Promise.resolve()):Promise.resolve()}function Ce(e,t){return Pe[e]&&Pe[e][t]||[]}function Oe(e){Ie("callObject",e)}const Re=be("_globalUniCloudListener"),Ee="response",De="needLogin",Le="refreshToken",Ue="clientdb",Ne="cloudfunction",Fe="cloudobject";function qe(e){return Re[e]||(Re[e]=[]),Re[e]}function Me(e,t){const s=qe(e);s.includes(t)||s.push(t)}function je(e,t){const s=qe(e),n=s.indexOf(t);-1!==n&&s.splice(n,1)}function Be(e,t){const s=qe(e);for(let n=0;n<s.length;n++)(0,s[n])(t)}let $e,Ke=!1;function We(){return $e||($e=new Promise((e=>{Ke&&e(),function t(){if("function"==typeof n){const t=n();t&&t[0]&&(Ke=!0,e())}Ke||setTimeout((()=>{t()}),30)}()})),$e)}function Je(e){const t={};for(const s in e){const n=e[s];fe(n)&&(t[s]=pe(n))}return t}class Ve 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 ze={request:e=>d(e),uploadFile:e=>f(e),setStorageSync:(e,t)=>p(e,t),getStorageSync:e=>g(e),removeStorageSync:e=>m(e),clearStorageSync:()=>y()};function He(e){return e&&He(e.__v_raw)||e}function Qe(){return{token:ze.getStorageSync("uni_id_token")||ze.getStorageSync("uniIdToken"),tokenExpired:ze.getStorageSync("uni_id_token_expired")}}function Ge({token:e,tokenExpired:t}={}){e&&ze.setStorageSync("uni_id_token",e),t&&ze.setStorageSync("uni_id_token_expired",t)}let Ye,Xe;function Ze(){return Ye||(Ye=_()),Ye}function et(){let e,t;try{if(I){if(I.toString().indexOf("not yet implemented")>-1)return;const{scene:s,channel:n}=I();e=n,t=s}}catch(s){}return{channel:e,scene:t}}function tt(){const e=P&&P()||"en";if(Xe)return{...Xe,locale:e,LOCALE:e};const t=Ze(),{deviceId:s,osName:n,uniPlatform:r,appId:i}=t,o=["pixelRatio","brand","model","system","language","version","platform","host","SDKVersion","swanNativeVersion","app","AppPlatform","fontSizeSetting"];for(let a=0;a<o.length;a++)delete t[o[a]];return Xe={PLATFORM:r,OS:n,APPID:i,DEVICEID:s,...et(),...t},{...Xe,locale:e,LOCALE:e}}var st=function(e,t){let s="";return Object.keys(e).sort().forEach((function(t){e[t]&&(s=s+"&"+t+"="+e[t])})),s=s.slice(1),ie(s,t).toString()},nt=function(e,t){return new Promise(((s,n)=>{t(Object.assign(e,{complete(e){e||(e={});const t=e.data&&e.data.header&&e.data.header["x-serverless-request-id"]||e.header&&e.header["request-id"];if(!e.statusCode||e.statusCode>=400)return n(new Ve({code:"SYS_ERR",message:e.errMsg||"request:fail",requestId:t}));const r=e.data;if(r.error)return n(new Ve({code:r.error.code,message:r.error.message,requestId:t}));r.result=r.data,r.requestId=t,delete r.data,s(r)}}))}))},rt=function(e){return ae.stringify(oe.parse(e))},it={"uniCloud.init.paramRequired":"{param} required","uniCloud.uploadFile.fileError":"filePath should be instance of File"};const{t:ot}=e({"zh-Hans":{"uniCloud.init.paramRequired":"缺少参数:{param}","uniCloud.uploadFile.fileError":"filePath应为File对象"},"zh-Hant":{"uniCloud.init.paramRequired":"缺少参数:{param}","uniCloud.uploadFile.fileError":"filePath应为File对象"},en:it,fr:{"uniCloud.init.paramRequired":"{param} required","uniCloud.uploadFile.fileError":"filePath should be instance of File"},es:{"uniCloud.init.paramRequired":"{param} required","uniCloud.uploadFile.fileError":"filePath should be instance of File"},ja:it},"zh-Hans");var at=class{constructor(e){["spaceId","clientSecret"].forEach((t=>{if(!Object.prototype.hasOwnProperty.call(e,t))throw new Error(ot("uniCloud.init.paramRequired",{param:t}))})),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=ze,this._getAccessTokenPromiseHub=new ye({createPromise:()=>this.requestAuth(this.setupRequest({method:"serverless.auth.user.anonymousAuthorize",params:"{}"},"auth")).then((e=>{if(!e.result||!e.result.accessToken)throw new Ve({code:"AUTH_FAILED",message:"获取accessToken失败"});this.setAccessToken(e.result.accessToken)})),retryRule:me})}get hasAccessToken(){return!!this.accessToken}setAccessToken(e){this.accessToken=e}requestWrapped(e){return nt(e,this.adapter.request)}requestAuth(e){return this.requestWrapped(e)}request(e,t){return Promise.resolve().then((()=>this.hasAccessToken?t?this.requestWrapped(e):this.requestWrapped(e).catch((t=>new Promise(((e,s)=>{!t||"GATEWAY_INVALID_TOKEN"!==t.code&&"InvalidParameter.InvalidToken"!==t.code?s(t):e()})).then((()=>this.getAccessToken())).then((()=>{const t=this.rebuildRequest(e);return this.request(t,!0)})))):this.getAccessToken().then((()=>{const t=this.rebuildRequest(e);return this.request(t,!0)}))))}rebuildRequest(e){const t=Object.assign({},e);return t.data.token=this.accessToken,t.header["x-basement-token"]=this.accessToken,t.header["x-serverless-sign"]=st(t.data,this.config.clientSecret),t}setupRequest(e,t){const s=Object.assign({},e,{spaceId:this.config.spaceId,timestamp:Date.now()}),n={"Content-Type":"application/json"};return"auth"!==t&&(s.token=this.accessToken,n["x-basement-token"]=this.accessToken),n["x-serverless-sign"]=st(s,this.config.clientSecret),{url:this.config.requestUrl,method:"POST",data:s,dataType:"json",header:n}}getAccessToken(){return this._getAccessTokenPromiseHub.exec()}async authorize(){await this.getAccessToken()}callFunction(e){const t={method:"serverless.function.runtime.invoke",params:JSON.stringify({functionTarget:e.name,functionArgs:e.data||{}})};return this.request(this.setupRequest(t))}getOSSUploadOptionsFromPath(e){const t={method:"serverless.file.resource.generateProximalSign",params:JSON.stringify(e)};return this.request(this.setupRequest(t))}uploadFileToOSS({url:e,formData:t,name:s,filePath:n,fileType:r,onUploadProgress:i}){return new Promise(((o,a)=>{const c=this.adapter.uploadFile({url:e,formData:t,name:s,filePath:n,fileType:r,header:{"X-OSS-server-side-encrpytion":"AES256"},success(e){e&&e.statusCode<400?o(e):a(new Ve({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(e){a(new Ve({code:e.code||"UPLOAD_FAILED",message:e.message||e.errMsg||"文件上传失败"}))}});"function"==typeof i&&c&&"function"==typeof c.onProgressUpdate&&c.onProgressUpdate((e=>{i({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend})}))}))}reportOSSUpload(e){const t={method:"serverless.file.resource.report",params:JSON.stringify(e)};return this.request(this.setupRequest(t))}async uploadFile({filePath:e,cloudPath:t,fileType:s="image",onUploadProgress:n,config:r}){if("string"!==he(t))throw new Ve({code:"INVALID_PARAM",message:"cloudPath必须为字符串类型"});if(!(t=t.trim()))throw new Ve({code:"CLOUDPATH_REQUIRED",message:"cloudPath不可为空"});if(/:\/\//.test(t))throw new Ve({code:"INVALID_PARAM",message:"cloudPath不合法"});const i=r&&r.envType||this.config.envType,o=(await this.getOSSUploadOptionsFromPath({env:i,filename:t})).result,a="https://"+o.cdnDomain+"/"+o.ossPath,{securityToken:c,accessKeyId:l,signature:u,host:h,ossPath:d,id:f,policy:p,ossCallbackUrl:g}=o,m={"Cache-Control":"max-age=2592000","Content-Disposition":"attachment",OSSAccessKeyId:l,Signature:u,host:h,id:f,key:d,policy:p,success_action_status:200};if(c&&(m["x-oss-security-token"]=c),g){const e=JSON.stringify({callbackUrl:g,callbackBody:JSON.stringify({fileId:f,spaceId:this.config.spaceId}),callbackBodyType:"application/json"});m.callback=rt(e)}const y={url:"https://"+o.host,formData:m,fileName:"file",name:"file",filePath:e,fileType:s};if(await this.uploadFileToOSS(Object.assign({},y,{onUploadProgress:n})),g)return{success:!0,filePath:e,fileID:a};if((await this.reportOSSUpload({id:f})).success)return{success:!0,filePath:e,fileID:a};throw new Ve({code:"UPLOAD_FAILED",message:"文件上传失败"})}getTempFileURL({fileList:e}={}){return new Promise(((t,s)=>{Array.isArray(e)&&0!==e.length||s(new Ve({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 Ve({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}}},ct={init(e){const t=new at(e),s={signInAnonymously:function(){return t.authorize()},getLoginState:function(){return Promise.resolve(!1)}};return t.auth=function(){return s},t.customAuth=t.auth,t}};const lt="undefined"!=typeof location&&"http:"===location.protocol?"http:":"https:";var ut,ht;(ht=ut||(ut={})).local="local",ht.none="none",ht.session="session";var dt=function(){};const ft=()=>{let e;if(!Promise){e=()=>{},e.promise={};const t=()=>{throw new Ve({message:'Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.'})};return Object.defineProperty(e.promise,"then",{get:t}),Object.defineProperty(e.promise,"catch",{get:t}),e}const t=new Promise(((t,s)=>{e=(e,n)=>e?s(e):t(n)}));return e.promise=t,e};function pt(e){return void 0===e}function gt(e){return"[object Null]"===Object.prototype.toString.call(e)}var mt;!function(e){e.WEB="web",e.WX_MP="wx_mp"}(mt||(mt={}));const yt={adapter:null,runtime:void 0},_t=["anonymousUuidKey"];class wt extends dt{constructor(){super(),yt.adapter.root.tcbObject||(yt.adapter.root.tcbObject={})}setItem(e,t){yt.adapter.root.tcbObject[e]=t}getItem(e){return yt.adapter.root.tcbObject[e]}removeItem(e){delete yt.adapter.root.tcbObject[e]}clear(){delete yt.adapter.root.tcbObject}}function vt(e,t){switch(e){case"local":return t.localStorage||new wt;case"none":return new wt;default:return t.sessionStorage||new wt}}class kt{constructor(e){if(!this._storage){this._persistence=yt.adapter.primaryStorage||e.persistence,this._storage=vt(this._persistence,yt.adapter);const t=`access_token_${e.env}`,s=`access_token_expire_${e.env}`,n=`refresh_token_${e.env}`,r=`anonymous_uuid_${e.env}`,i=`login_type_${e.env}`,o=`user_info_${e.env}`;this.keys={accessTokenKey:t,accessTokenExpireKey:s,refreshTokenKey:n,anonymousUuidKey:r,loginTypeKey:i,userInfoKey:o}}}updatePersistence(e){if(e===this._persistence)return;const t="local"===this._persistence;this._persistence=e;const s=vt(e,yt.adapter);for(const n in this.keys){const e=this.keys[n];if(t&&_t.includes(n))continue;const r=this._storage.getItem(e);pt(r)||gt(r)||(s.setItem(e,r),this._storage.removeItem(e))}this._storage=s}setStore(e,t,s){if(!this._storage)return;const n={version:s||"localCachev1",content:t},r=JSON.stringify(n);try{this._storage.setItem(e,r)}catch(i){throw i}}getStore(e,t){try{if(!this._storage)return}catch(n){return""}t=t||"localCachev1";const s=this._storage.getItem(e);return s&&s.indexOf(t)>=0?JSON.parse(s).content:""}removeStore(e){this._storage.removeItem(e)}}const Tt={},bt={};function St(e){return Tt[e]}class Pt{constructor(e,t){this.data=t||null,this.name=e}}class It extends Pt{constructor(e,t){super("error",{error:e,data:t}),this.error=e}}const At=new class{constructor(){this._listeners={}}on(e,t){return s=e,n=t,(r=this._listeners)[s]=r[s]||[],r[s].push(n),this;var s,n,r}off(e,t){return function(e,t,s){if(s&&s[e]){const n=s[e].indexOf(t);-1!==n&&s[e].splice(n,1)}}(e,t,this._listeners),this}fire(e,t){if(e instanceof It)return console.error(e.error),this;const s="string"==typeof e?new Pt(e,t||{}):e,n=s.name;if(this._listens(n)){s.target=this;const e=this._listeners[n]?[...this._listeners[n]]:[];for(const t of e)t.call(this,s)}return this}_listens(e){return this._listeners[e]&&this._listeners[e].length>0}};function xt(e,t){At.on(e,t)}function Ct(e,t={}){At.fire(e,t)}function Ot(e,t){At.off(e,t)}const Rt="loginStateChanged",Et="loginStateExpire",Dt="loginTypeChanged",Lt="anonymousConverted",Ut="refreshAccessToken";var Nt;!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"}(Nt||(Nt={}));const Ft=["auth.getJwt","auth.logout","auth.signInWithTicket","auth.signInAnonymously","auth.signIn","auth.fetchAccessTokenWithRefreshToken","auth.signUpWithEmailAndPassword","auth.activateEndUserMail","auth.sendPasswordResetEmail","auth.resetPasswordWithToken","auth.isUsernameRegistered"],qt={"X-SDK-Version":"1.3.5"};function Mt(e,t,s){const n=e[t];e[t]=function(t){const r={},i={};s.forEach((s=>{const{data:n,headers:o}=s.call(e,t);Object.assign(r,n),Object.assign(i,o)}));const o=t.data;return o&&(()=>{var e;if(e=o,"[object FormData]"!==Object.prototype.toString.call(e))t.data={...o,...r};else for(const t in r)o.append(t,r[t])})(),t.headers={...t.headers||{},...i},n.call(e,t)}}function jt(){const e=Math.random().toString(16).slice(2);return{data:{seqId:e},headers:{...qt,"x-seqid":e}}}class Bt{constructor(e={}){var t;this.config=e,this._reqClass=new yt.adapter.reqClass({timeout:this.config.timeout,timeoutMsg:`请求在${this.config.timeout/1e3}s内未完成,已中断`,restrictedMethods:["post"]}),this._cache=St(this.config.env),this._localCache=(t=this.config.env,bt[t]),Mt(this._reqClass,"post",[jt]),Mt(this._reqClass,"upload",[jt]),Mt(this._reqClass,"download",[jt])}async post(e){return await this._reqClass.post(e)}async upload(e){return await this._reqClass.upload(e)}async download(e){return await this._reqClass.download(e)}async refreshAccessToken(){let e,t;this._refreshAccessTokenPromise||(this._refreshAccessTokenPromise=this._refreshAccessToken());try{e=await this._refreshAccessTokenPromise}catch(s){t=s}if(this._refreshAccessTokenPromise=null,this._shouldRefreshAccessTokenHook=null,t)throw t;return e}async _refreshAccessToken(){const{accessTokenKey:e,accessTokenExpireKey:t,refreshTokenKey:s,loginTypeKey:n,anonymousUuidKey:r}=this._cache.keys;this._cache.removeStore(e),this._cache.removeStore(t);let i=this._cache.getStore(s);if(!i)throw new Ve({message:"未登录CloudBase"});const o={refresh_token:i},a=await this.request("auth.fetchAccessTokenWithRefreshToken",o);if(a.data.code){const{code:e}=a.data;if("SIGN_PARAM_INVALID"===e||"REFRESH_TOKEN_EXPIRED"===e||"INVALID_REFRESH_TOKEN"===e){if(this._cache.getStore(n)===Nt.ANONYMOUS&&"INVALID_REFRESH_TOKEN"===e){const e=this._cache.getStore(r),t=this._cache.getStore(s),n=await this.send("auth.signInAnonymously",{anonymous_uuid:e,refresh_token:t});return this.setRefreshToken(n.refresh_token),this._refreshAccessToken()}Ct(Et),this._cache.removeStore(s)}throw new Ve({code:a.data.code,message:`刷新access token失败:${a.data.code}`})}if(a.data.access_token)return Ct(Ut),this._cache.setStore(e,a.data.access_token),this._cache.setStore(t,a.data.access_token_expire+Date.now()),{accessToken:a.data.access_token,accessTokenExpire:a.data.access_token_expire};a.data.refresh_token&&(this._cache.removeStore(s),this._cache.setStore(s,a.data.refresh_token),this._refreshAccessToken())}async getAccessToken(){const{accessTokenKey:e,accessTokenExpireKey:t,refreshTokenKey:s}=this._cache.keys;if(!this._cache.getStore(s))throw new Ve({message:"refresh token不存在,登录状态异常"});let n=this._cache.getStore(e),r=this._cache.getStore(t),i=!0;return this._shouldRefreshAccessTokenHook&&!(await this._shouldRefreshAccessTokenHook(n,r))&&(i=!1),(!n||!r||r<Date.now())&&i?this.refreshAccessToken():{accessToken:n,accessTokenExpire:r}}async request(e,t,s){const n=`x-tcb-trace_${this.config.env}`;let r="application/x-www-form-urlencoded";const i={action:e,env:this.config.env,dataVersion:"2019-08-16",...t};if(-1===Ft.indexOf(e)){const{refreshTokenKey:e}=this._cache.keys;this._cache.getStore(e)&&(i.access_token=(await this.getAccessToken()).accessToken)}let o;if("storage.uploadFile"===e){o=new FormData;for(let e in o)o.hasOwnProperty(e)&&void 0!==o[e]&&o.append(e,i[e]);r="multipart/form-data"}else{r="application/json",o={};for(let e in i)void 0!==i[e]&&(o[e]=i[e])}let a={headers:{"content-type":r}};s&&s.onUploadProgress&&(a.onUploadProgress=s.onUploadProgress);const c=this._localCache.getStore(n);c&&(a.headers["X-TCB-Trace"]=c);const{parse:l,inQuery:u,search:h}=t;let d={env:this.config.env};l&&(d.parse=!0),u&&(d={...u,...d});let f=function(e,t,s={}){const n=/\?/.test(t);let r="";for(let i in s)""===r?!n&&(t+="?"):r+="&",r+=`${i}=${encodeURIComponent(s[i])}`;return/^http(s)?\:\/\//.test(t+=r)?t:`${e}${t}`}(lt,"//tcb-api.tencentcloudapi.com/web",d);h&&(f+=h);const p=await this.post({url:f,data:o,...a}),g=p.header&&p.header["x-tcb-trace"];if(g&&this._localCache.setStore(n,g),200!==Number(p.status)&&200!==Number(p.statusCode)||!p.data)throw new Ve({code:"NETWORK_ERROR",message:"network request error"});return p}async send(e,t={}){const s=await this.request(e,t,{onUploadProgress:t.onUploadProgress});if("ACCESS_TOKEN_EXPIRED"===s.data.code&&-1===Ft.indexOf(e)){await this.refreshAccessToken();const s=await this.request(e,t,{onUploadProgress:t.onUploadProgress});if(s.data.code)throw new Ve({code:s.data.code,message:s.data.message});return s.data}if(s.data.code)throw new Ve({code:s.data.code,message:s.data.message});return s.data}setRefreshToken(e){const{accessTokenKey:t,accessTokenExpireKey:s,refreshTokenKey:n}=this._cache.keys;this._cache.removeStore(t),this._cache.removeStore(s),this._cache.setStore(n,e)}}const $t={};function Kt(e){return $t[e]}class Wt{constructor(e){this.config=e,this._cache=St(e.env),this._request=Kt(e.env)}setRefreshToken(e){const{accessTokenKey:t,accessTokenExpireKey:s,refreshTokenKey:n}=this._cache.keys;this._cache.removeStore(t),this._cache.removeStore(s),this._cache.setStore(n,e)}setAccessToken(e,t){const{accessTokenKey:s,accessTokenExpireKey:n}=this._cache.keys;this._cache.setStore(s,e),this._cache.setStore(n,t)}async refreshUserInfo(){const{data:e}=await this._request.send("auth.getUserInfo",{});return this.setLocalUserInfo(e),e}setLocalUserInfo(e){const{userInfoKey:t}=this._cache.keys;this._cache.setStore(t,e)}}class Jt{constructor(e){if(!e)throw new Ve({code:"PARAM_ERROR",message:"envId is not defined"});this._envId=e,this._cache=St(this._envId),this._request=Kt(this._envId),this.setUserInfo()}linkWithTicket(e){if("string"!=typeof e)throw new Ve({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 Ve({code:"PARAM_ERROR",message:"username must be a string"});return this._request.send("auth.updateUsername",{username:e})}async getLinkedUidList(){const{data:e}=await this._request.send("auth.getLinkedUidList",{});let t=!1;const{users:s}=e;return s.forEach((e=>{e.wxOpenId&&e.wxPublicId&&(t=!0)})),{users:s,hasPrimaryUid:t}}setPrimaryUid(e){return this._request.send("auth.setPrimaryUid",{uid:e})}unlink(e){return this._request.send("auth.unlink",{platform:e})}async update(e){const{nickName:t,gender:s,avatarUrl:n,province:r,country:i,city:o}=e,{data:a}=await this._request.send("auth.updateUserInfo",{nickName:t,gender:s,avatarUrl:n,province:r,country:i,city:o});this.setLocalUserInfo(a)}async refresh(){const{data:e}=await this._request.send("auth.getUserInfo",{});return this.setLocalUserInfo(e),e}setUserInfo(){const{userInfoKey:e}=this._cache.keys,t=this._cache.getStore(e);["uid","loginType","openid","wxOpenId","wxPublicId","unionId","qqMiniOpenId","email","hasPassword","customUserId","nickName","gender","avatarUrl"].forEach((e=>{this[e]=t[e]})),this.location={country:t.country,province:t.province,city:t.city}}setLocalUserInfo(e){const{userInfoKey:t}=this._cache.keys;this._cache.setStore(t,e),this.setUserInfo()}}class Vt{constructor(e){if(!e)throw new Ve({code:"PARAM_ERROR",message:"envId is not defined"});this._cache=St(e);const{refreshTokenKey:t,accessTokenKey:s,accessTokenExpireKey:n}=this._cache.keys,r=this._cache.getStore(t),i=this._cache.getStore(s),o=this._cache.getStore(n);this.credential={refreshToken:r,accessToken:i,accessTokenExpire:o},this.user=new Jt(e)}get isAnonymousAuth(){return this.loginType===Nt.ANONYMOUS}get isCustomAuth(){return this.loginType===Nt.CUSTOM}get isWeixinAuth(){return this.loginType===Nt.WECHAT||this.loginType===Nt.WECHAT_OPEN||this.loginType===Nt.WECHAT_PUBLIC}get loginType(){return this._cache.getStore(this._cache.keys.loginTypeKey)}}class zt extends Wt{async signIn(){this._cache.updatePersistence("local");const{anonymousUuidKey:e,refreshTokenKey:t}=this._cache.keys,s=this._cache.getStore(e)||void 0,n=this._cache.getStore(t)||void 0,r=await this._request.send("auth.signInAnonymously",{anonymous_uuid:s,refresh_token:n});if(r.uuid&&r.refresh_token){this._setAnonymousUUID(r.uuid),this.setRefreshToken(r.refresh_token),await this._request.refreshAccessToken(),Ct(Rt),Ct(Dt,{env:this.config.env,loginType:Nt.ANONYMOUS,persistence:"local"});const e=new Vt(this.config.env);return await e.user.refresh(),e}throw new Ve({message:"匿名登录失败"})}async linkAndRetrieveDataWithTicket(e){const{anonymousUuidKey:t,refreshTokenKey:s}=this._cache.keys,n=this._cache.getStore(t),r=this._cache.getStore(s),i=await this._request.send("auth.linkAndRetrieveDataWithTicket",{anonymous_uuid:n,refresh_token:r,ticket:e});if(i.refresh_token)return this._clearAnonymousUUID(),this.setRefreshToken(i.refresh_token),await this._request.refreshAccessToken(),Ct(Lt,{env:this.config.env}),Ct(Dt,{loginType:Nt.CUSTOM,persistence:"local"}),{credential:{refreshToken:i.refresh_token}};throw new Ve({message:"匿名转化失败"})}_setAnonymousUUID(e){const{anonymousUuidKey:t,loginTypeKey:s}=this._cache.keys;this._cache.removeStore(t),this._cache.setStore(t,e),this._cache.setStore(s,Nt.ANONYMOUS)}_clearAnonymousUUID(){this._cache.removeStore(this._cache.keys.anonymousUuidKey)}}class Ht extends Wt{async signIn(e){if("string"!=typeof e)throw new Ve({code:"PARAM_ERROR",message:"ticket must be a string"});const{refreshTokenKey:t}=this._cache.keys,s=await this._request.send("auth.signInWithTicket",{ticket:e,refresh_token:this._cache.getStore(t)||""});if(s.refresh_token)return this.setRefreshToken(s.refresh_token),await this._request.refreshAccessToken(),Ct(Rt),Ct(Dt,{env:this.config.env,loginType:Nt.CUSTOM,persistence:this.config.persistence}),await this.refreshUserInfo(),new Vt(this.config.env);throw new Ve({message:"自定义登录失败"})}}class Qt extends Wt{async signIn(e,t){if("string"!=typeof e)throw new Ve({code:"PARAM_ERROR",message:"email must be a string"});const{refreshTokenKey:s}=this._cache.keys,n=await this._request.send("auth.signIn",{loginType:"EMAIL",email:e,password:t,refresh_token:this._cache.getStore(s)||""}),{refresh_token:r,access_token:i,access_token_expire:o}=n;if(r)return this.setRefreshToken(r),i&&o?this.setAccessToken(i,o):await this._request.refreshAccessToken(),await this.refreshUserInfo(),Ct(Rt),Ct(Dt,{env:this.config.env,loginType:Nt.EMAIL,persistence:this.config.persistence}),new Vt(this.config.env);throw n.code?new Ve({code:n.code,message:`邮箱登录失败: ${n.message}`}):new Ve({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 Gt extends Wt{async signIn(e,t){if("string"!=typeof e)throw new Ve({code:"PARAM_ERROR",message:"username must be a string"});"string"!=typeof t&&(t="",console.warn("password is empty"));const{refreshTokenKey:s}=this._cache.keys,n=await this._request.send("auth.signIn",{loginType:Nt.USERNAME,username:e,password:t,refresh_token:this._cache.getStore(s)||""}),{refresh_token:r,access_token_expire:i,access_token:o}=n;if(r)return this.setRefreshToken(r),o&&i?this.setAccessToken(o,i):await this._request.refreshAccessToken(),await this.refreshUserInfo(),Ct(Rt),Ct(Dt,{env:this.config.env,loginType:Nt.USERNAME,persistence:this.config.persistence}),new Vt(this.config.env);throw n.code?new Ve({code:n.code,message:`用户名密码登录失败: ${n.message}`}):new Ve({message:"用户名密码登录失败"})}}class Yt{constructor(e){this.config=e,this._cache=St(e.env),this._request=Kt(e.env),this._onAnonymousConverted=this._onAnonymousConverted.bind(this),this._onLoginTypeChanged=this._onLoginTypeChanged.bind(this),xt(Dt,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 zt(this.config)}customAuthProvider(){return new Ht(this.config)}emailAuthProvider(){return new Qt(this.config)}usernameAuthProvider(){return new Gt(this.config)}async signInAnonymously(){return new zt(this.config).signIn()}async signInWithEmailAndPassword(e,t){return new Qt(this.config).signIn(e,t)}signInWithUsernameAndPassword(e,t){return new Gt(this.config).signIn(e,t)}async linkAndRetrieveDataWithTicket(e){return this._anonymousAuthProvider||(this._anonymousAuthProvider=new zt(this.config)),xt(Lt,this._onAnonymousConverted),await this._anonymousAuthProvider.linkAndRetrieveDataWithTicket(e)}async signOut(){if(this.loginType===Nt.ANONYMOUS)throw new Ve({message:"匿名用户不支持登出操作"});const{refreshTokenKey:e,accessTokenKey:t,accessTokenExpireKey:s}=this._cache.keys,n=this._cache.getStore(e);if(!n)return;const r=await this._request.send("auth.logout",{refresh_token:n});return this._cache.removeStore(e),this._cache.removeStore(t),this._cache.removeStore(s),Ct(Rt),Ct(Dt,{env:this.config.env,loginType:Nt.NULL,persistence:this.config.persistence}),r}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){xt(Rt,(()=>{const t=this.hasLoginState();e.call(this,t)}));const t=this.hasLoginState();e.call(this,t)}onLoginStateExpired(e){xt(Et,e.bind(this))}onAccessTokenRefreshed(e){xt(Ut,e.bind(this))}onAnonymousConverted(e){xt(Lt,e.bind(this))}onLoginTypeChanged(e){xt(Dt,(()=>{const t=this.hasLoginState();e.call(this,t)}))}async getAccessToken(){return{accessToken:(await this._request.getAccessToken()).accessToken,env:this.config.env}}hasLoginState(){const{refreshTokenKey:e}=this._cache.keys;return this._cache.getStore(e)?new Vt(this.config.env):null}async isUsernameRegistered(e){if("string"!=typeof e)throw new Ve({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 Ht(this.config).signIn(e)}shouldRefreshAccessToken(e){this._request._shouldRefreshAccessTokenHook=e.bind(this)}getUserInfo(){return this._request.send("auth.getUserInfo",{}).then((e=>e.code?e:{...e.data,requestId:e.seqId}))}getAuthHeader(){const{refreshTokenKey:e,accessTokenKey:t}=this._cache.keys,s=this._cache.getStore(e);return{"x-cloudbase-credentials":this._cache.getStore(t)+"/@@/"+s}}_onAnonymousConverted(e){const{env:t}=e.data;t===this.config.env&&this._cache.updatePersistence(this.config.persistence)}_onLoginTypeChanged(e){const{loginType:t,persistence:s,env:n}=e.data;n===this.config.env&&(this._cache.updatePersistence(s),this._cache.setStore(this._cache.keys.loginTypeKey,t))}}const Xt=function(e,t){t=t||ft();const s=Kt(this.config.env),{cloudPath:n,filePath:r,onUploadProgress:i,fileType:o="image"}=e;return s.send("storage.getUploadMetadata",{path:n}).then((e=>{const{data:{url:a,authorization:c,token:l,fileId:u,cosFileId:h},requestId:d}=e,f={key:n,signature:c,"x-cos-meta-fileid":h,success_action_status:"201","x-cos-security-token":l};s.upload({url:a,data:f,file:r,name:n,fileType:o,onUploadProgress:i}).then((e=>{201===e.statusCode?t(null,{fileID:u,requestId:d}):t(new Ve({code:"STORAGE_REQUEST_FAIL",message:`STORAGE_REQUEST_FAIL: ${e.data}`}))})).catch((e=>{t(e)}))})).catch((e=>{t(e)})),t.promise},Zt=function(e,t){t=t||ft();const s=Kt(this.config.env),{cloudPath:n}=e;return s.send("storage.getUploadMetadata",{path:n}).then((e=>{t(null,e)})).catch((e=>{t(e)})),t.promise},es=function({fileList:e},t){if(t=t||ft(),!e||!Array.isArray(e))return{code:"INVALID_PARAM",message:"fileList必须是非空的数组"};for(let n of e)if(!n||"string"!=typeof n)return{code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"};const s={fileid_list:e};return Kt(this.config.env).send("storage.batchDeleteFile",s).then((e=>{e.code?t(null,e):t(null,{fileList:e.data.delete_list,requestId:e.requestId})})).catch((e=>{t(e)})),t.promise},ts=function({fileList:e},t){t=t||ft(),e&&Array.isArray(e)||t(null,{code:"INVALID_PARAM",message:"fileList必须是非空的数组"});let s=[];for(let r of e)"object"==typeof r?(r.hasOwnProperty("fileID")&&r.hasOwnProperty("maxAge")||t(null,{code:"INVALID_PARAM",message:"fileList的元素必须是包含fileID和maxAge的对象"}),s.push({fileid:r.fileID,max_age:r.maxAge})):"string"==typeof r?s.push({fileid:r}):t(null,{code:"INVALID_PARAM",message:"fileList的元素必须是字符串"});const n={file_list:s};return Kt(this.config.env).send("storage.batchGetDownloadUrl",n).then((e=>{e.code?t(null,e):t(null,{fileList:e.data.download_list,requestId:e.requestId})})).catch((e=>{t(e)})),t.promise},ss=async function({fileID:e},t){const s=(await ts.call(this,{fileList:[{fileID:e,maxAge:600}]})).fileList[0];if("SUCCESS"!==s.code)return t?t(s):new Promise((e=>{e(s)}));const n=Kt(this.config.env);let r=s.download_url;if(r=encodeURI(r),!t)return n.download({url:r});t(await n.download({url:r}))},ns=function({name:e,data:t,query:s,parse:n,search:r},i){const o=i||ft();let a;try{a=t?JSON.stringify(t):""}catch(l){return Promise.reject(l)}if(!e)return Promise.reject(new Ve({code:"PARAM_ERROR",message:"函数名不能为空"}));const c={inQuery:s,parse:n,search:r,function_name:e,request_data:a};return Kt(this.config.env).send("functions.invokeFunction",c).then((e=>{if(e.code)o(null,e);else{let s=e.data.response_data;if(n)o(null,{result:s,requestId:e.requestId});else try{s=JSON.parse(e.data.response_data),o(null,{result:s,requestId:e.requestId})}catch(t){o(new Ve({message:"response data must be json"}))}}return o.promise})).catch((e=>{o(e)})),o.promise},rs={timeout:15e3,persistence:"session"},is={};class os{constructor(e){this.config=e||this.config,this.authObj=void 0}init(e){switch(yt.adapter||(this.requestClient=new yt.adapter.reqClass({timeout:e.timeout||5e3,timeoutMsg:`请求在${(e.timeout||5e3)/1e3}s内未完成,已中断`})),this.config={...rs,...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 os(this.config)}auth({persistence:e}={}){if(this.authObj)return this.authObj;const t=e||yt.adapter.primaryStorage||rs.persistence;var s;return t!==this.config.persistence&&(this.config.persistence=t),function(e){const{env:t}=e;Tt[t]=new kt(e),bt[t]=new kt({...e,persistence:"local"})}(this.config),s=this.config,$t[s.env]=new Bt(s),this.authObj=new Yt(this.config),this.authObj}on(e,t){return xt.apply(this,[e,t])}off(e,t){return Ot.apply(this,[e,t])}callFunction(e,t){return ns.apply(this,[e,t])}deleteFile(e,t){return es.apply(this,[e,t])}getTempFileURL(e,t){return ts.apply(this,[e,t])}downloadFile(e,t){return ss.apply(this,[e,t])}uploadFile(e,t){return Xt.apply(this,[e,t])}getUploadMetadata(e,t){return Zt.apply(this,[e,t])}registerExtension(e){is[e.name]=e}async invokeExtension(e,t){const s=is[e];if(!s)throw new Ve({message:`扩展${e} 必须先注册`});return await s.invoke(t,this)}useAdapters(e){const{adapter:t,runtime:s}=function(e){const t=(s=e,"[object Array]"===Object.prototype.toString.call(s)?e:[e]);var s;for(const n of t){const{isMatch:e,genAdapter:t,runtime:s}=n;if(e())return{adapter:t(),runtime:s}}}(e)||{};t&&(yt.adapter=t),s&&(yt.runtime=s)}}var as=new os;function cs(e,t,s){void 0===s&&(s={});var n=/\?/.test(t),r="";for(var i in s)""===r?!n&&(t+="?"):r+="&",r+=i+"="+encodeURIComponent(s[i]);return/^http(s)?:\/\//.test(t+=r)?t:""+e+t}class ls{post(e){const{url:t,data:s,headers:n}=e;return new Promise(((e,r)=>{ze.request({url:cs("https:",t),data:s,method:"POST",header:n,success(t){e(t)},fail(e){r(e)}})}))}upload(e){return new Promise(((t,s)=>{const{url:n,file:r,data:i,headers:o,fileType:a}=e,c=ze.uploadFile({url:cs("https:",n),name:"file",formData:Object.assign({},i),filePath:r,fileType:a,header:o,success(e){const s={statusCode:e.statusCode,data:e.data||{}};200===e.statusCode&&i.success_action_status&&(s.statusCode=parseInt(i.success_action_status,10)),t(s)},fail(e){s(new Error(e.errMsg||"uploadFile:fail"))}});"function"==typeof e.onUploadProgress&&c&&"function"==typeof c.onProgressUpdate&&c.onProgressUpdate((t=>{e.onUploadProgress({loaded:t.totalBytesSent,total:t.totalBytesExpectedToSend})}))}))}}const us={setItem(e,t){ze.setStorageSync(e,t)},getItem:e=>ze.getStorageSync(e),removeItem(e){ze.removeStorageSync(e)},clear(){ze.clearStorageSync()}};var hs={genAdapter:function(){return{root:{},reqClass:ls,localStorage:us,primaryStorage:"local"}},isMatch:function(){return!0},runtime:"uni_app"};as.useAdapters(hs);const ds=as,fs=ds.init;ds.init=function(e){e.env=e.spaceId;const t=fs.call(this,e);t.config.provider="tencent",t.config.spaceId=e.spaceId;const s=t.auth;return t.auth=function(e){const t=s.call(this,e);return["linkAndRetrieveDataWithTicket","signInAnonymously","signOut","getAccessToken","getLoginState","signInWithTicket","getUserInfo"].forEach((e=>{var s;t[e]=(s=t[e],function(e){e=e||{};const{success:t,fail:n,complete:r}=Je(e);if(!(t||n||r))return s.call(this,e);s.call(this,e).then((e=>{t&&t(e),r&&r(e)}),(e=>{n&&n(e),r&&r(e)}))}).bind(t)})),t},t.customAuth=t.auth,t};var ps=ds,gs=class extends at{getAccessToken(){return new Promise(((e,t)=>{const s="Anonymous_Access_token";this.setAccessToken(s),e(s)}))}setupRequest(e,t){const s=Object.assign({},e,{spaceId:this.config.spaceId,timestamp:Date.now()}),n={"Content-Type":"application/json"};"auth"!==t&&(s.token=this.accessToken,n["x-basement-token"]=this.accessToken),n["x-serverless-sign"]=st(s,this.config.clientSecret);const r=tt();n["x-client-info"]=encodeURIComponent(JSON.stringify(r));const{token:i}=Qe();return n["x-client-token"]=i,{url:this.config.requestUrl,method:"POST",data:s,dataType:"json",header:JSON.parse(JSON.stringify(n))}}uploadFileToOSS({url:e,formData:t,name:s,filePath:n,fileType:r,onUploadProgress:i}){return new Promise(((o,a)=>{const c=this.adapter.uploadFile({url:e,formData:t,name:s,filePath:n,fileType:r,success(e){e&&e.statusCode<400?o(e):a(new Ve({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(e){a(new Ve({code:e.code||"UPLOAD_FAILED",message:e.message||e.errMsg||"文件上传失败"}))}});"function"==typeof i&&c&&"function"==typeof c.onProgressUpdate&&c.onProgressUpdate((e=>{i({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend})}))}))}uploadFile({filePath:e,cloudPath:t,fileType:s="image",onUploadProgress:n}){if(!t)throw new Ve({code:"CLOUDPATH_REQUIRED",message:"cloudPath不可为空"});let r;return this.getOSSUploadOptionsFromPath({cloudPath:t}).then((t=>{const{url:i,formData:o,name:a}=t.result;r=t.result.fileUrl;const c={url:i,formData:o,name:a,filePath:e,fileType:s};return this.uploadFileToOSS(Object.assign({},c,{onUploadProgress:n}))})).then((()=>this.reportOSSUpload({cloudPath:t}))).then((t=>new Promise(((s,n)=>{t.success?s({success:!0,filePath:e,fileID:r}):n(new Ve({code:"UPLOAD_FAILED",message:"文件上传失败"}))}))))}deleteFile({fileList:e}){const t={method:"serverless.file.resource.delete",params:JSON.stringify({fileList:e})};return this.request(this.setupRequest(t)).then((e=>{if(e.success)return e.result;throw new Ve({code:"DELETE_FILE_FAILED",message:"删除文件失败"})}))}getTempFileURL({fileList:e}={}){if(!Array.isArray(e)||0===e.length)throw new Ve({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"});const t={method:"serverless.file.resource.getTempFileURL",params:JSON.stringify({fileList:e})};return this.request(this.setupRequest(t)).then((e=>{if(e.success)return{fileList:e.result.fileList.map((e=>({fileID:e.fileID,tempFileURL:e.tempFileURL})))};throw new Ve({code:"GET_TEMP_FILE_URL_FAILED",message:"获取临时文件链接失败"})}))}},ms={init(e){const t=new gs(e),s={signInAnonymously:function(){return t.authorize()},getLoginState:function(){return Promise.resolve(!1)}};return t.auth=function(){return s},t.customAuth=t.auth,t}};function ys({data:e}){let t;t=tt();const s=JSON.parse(JSON.stringify(e||{}));if(Object.assign(s,{clientInfo:t}),!s.uniIdToken){const{token:e}=Qe();e&&(s.uniIdToken=e)}return s}const _s=[{rule:/fc_function_not_found|FUNCTION_NOT_FOUND/,content:",云函数[{functionName}]在云端不存在,请检查此云函数名称是否正确以及该云函数是否已上传到服务空间",mode:"append"}];var ws=/[\\^$.*+?()[\]{}|]/g,vs=RegExp(ws.source);function ks(e,t,s){return e.replace(new RegExp((n=t)&&vs.test(n)?n.replace(ws,"\\$&"):n,"g"),s);var n}const Ts=2e4,bs={code:20101,message:"Invalid client"};function Ss(e){const{errSubject:t,subject:s,errCode:n,errMsg:r,code:i,message:o,cause:a}=e||{};return new Ve({subject:t||s||"uni-secure-network",code:n||i||Ts,message:r||o,cause:a})}let Ps;function Is({secretType:e}={}){return"request"===e||"response"===e||"both"===e}function As({functionName:e,result:t,logPvd:s}){}function xs(e){const t=e.callFunction,s=function(s){const n=s.name;s.data=ys.call(e,{data:s.data});const r={aliyun:"aliyun",tencent:"tcb",tcb:"tcb"}[this.config.provider],i=Is(s)||false;return t.call(this,s).then((e=>(e.errCode=0,!i&&As.call(this,{functionName:n,result:e,logPvd:r}),Promise.resolve(e))),(e=>(!i&&As.call(this,{functionName:n,result:e,logPvd:r}),e&&e.message&&(e.message=function({message:e="",extraInfo:t={},formatter:s=[]}={}){for(let n=0;n<s.length;n++){const{rule:r,content:i,mode:o}=s[n],a=e.match(r);if(!a)continue;let c=i;for(let e=1;e<a.length;e++)c=ks(c,`{$${e}}`,a[e]);for(const e in t)c=ks(c,`{${e}}`,t[e]);return"replace"===o?c:e+c}return e}({message:`[${s.name}]: ${e.message}`,formatter:_s,extraInfo:{functionName:n}})),Promise.reject(e))))};e.callFunction=function(t){const{provider:n,spaceId:r}=e.config,i=t.name;let o,a;return t.data=t.data||{},o=s,o=o.bind(e),a=Is(t)?new Ps({secretType:t.secretType,uniCloudIns:e}).wrapEncryptDataCallFunction(s.bind(e))(t):function({provider:e,spaceId:t,functionName:s}={}){const{appId:n,uniPlatform:r,osName:i}=Ze();let o=r;"app"===r&&(o=i);const a=function({provider:e,spaceId:t}={}){if(!we)return{};var s;e="tencent"===(s=e)?"tcb":s;const n=we.find((s=>s.provider===e&&s.spaceId===t));return n&&n.config}({provider:e,spaceId:t});if(!a||!a.accessControl||!a.accessControl.enable)return!1;const c=a.accessControl.function||{},l=Object.keys(c);if(0===l.length)return!0;const u=function(e,t){let s,n,r;for(let i=0;i<e.length;i++){const o=e[i];o!==t?"*"!==o?o.split(",").map((e=>e.trim())).indexOf(t)>-1&&(n=o):r=o:s=o}return s||n||r}(l,s);if(!u)return!1;if((c[u]||[]).find(((e={})=>e.appId===n&&(e.platform||"").toLowerCase()===o.toLowerCase())))return!0;throw console.error(`此应用[appId: ${n}, platform: ${o}]不在云端配置的允许访问的应用列表内,参考:https://uniapp.dcloud.net.cn/uniCloud/secure-network.html#verify-client`),Ss(bs)}({provider:n,spaceId:r,functionName:i})?new Ps({secretType:t.secretType,uniCloudIns:e}).wrapVerifyClientCallFunction(s.bind(e))(t):o(t),Object.defineProperty(a,"result",{get:()=>(console.warn("当前返回结果为Promise类型,不可直接访问其result属性,详情请参考:https://uniapp.dcloud.net.cn/uniCloud/faq?id=promise"),{})}),a}}Ps=class{constructor(){throw Ss({message:"Platform web is not supported by secure network"})}};const Cs=Symbol("CLIENT_DB_INTERNAL");function Os(e,t){return e.then="DoNotReturnProxyWithAFunctionNamedThen",e._internalType=Cs,e.inspect=null,e.__v_raw=void 0,new Proxy(e,{get(e,s,n){if("_uniClient"===s)return null;if("symbol"==typeof s)return e[s];if(s in e||"string"!=typeof s){const t=e[s];return"function"==typeof t?t.bind(e):t}return t.get(e,s,n)}})}function Rs(e){return{on:(t,s)=>{e[t]=e[t]||[],e[t].indexOf(s)>-1||e[t].push(s)},off:(t,s)=>{e[t]=e[t]||[];const n=e[t].indexOf(s);-1!==n&&e[t].splice(n,1)}}}const Es=["db.Geo","db.command","command.aggregate"];function Ds(e,t){return Es.indexOf(`${e}.${t}`)>-1}function Ls(e){switch(he(e=He(e))){case"array":return e.map((e=>Ls(e)));case"object":return e._internalType===Cs||Object.keys(e).forEach((t=>{e[t]=Ls(e[t])})),e;case"regexp":return{$regexp:{source:e.source,flags:e.flags}};case"date":return{$date:e.toISOString()};default:return e}}function Us(e){return e&&e.content&&e.content.$method}class Ns{constructor(e,t,s){this.content=e,this.prevStage=t||null,this.udb=null,this._database=s}toJSON(){let e=this;const t=[e.content];for(;e.prevStage;)e=e.prevStage,t.push(e.content);return{$db:t.reverse().map((e=>({$method:e.$method,$param:Ls(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=Us(e),s=Us(e.prevStage);if("aggregate"===t&&"collection"===s||"pipeline"===t)return!0;e=e.prevStage}return!1}get isCommand(){let e=this;for(;e;){if("command"===Us(e))return!0;e=e.prevStage}return!1}get isAggregateCommand(){let e=this;for(;e;){const t=Us(e),s=Us(e.prevStage);if("aggregate"===t&&"command"===s)return!0;e=e.prevStage}return!1}getNextStageFn(e){const t=this;return function(){return Fs({$method:e,$param:Ls(Array.from(arguments))},t,t._database)}}get count(){return this.isAggregate?this.getNextStageFn("count"):function(){return this._send("count",Array.from(arguments))}}get remove(){return this.isCommand?this.getNextStageFn("remove"):function(){return this._send("remove",Array.from(arguments))}}get(){return this._send("get",Array.from(arguments))}get add(){return this.isCommand?this.getNextStageFn("add"):function(){return this._send("add",Array.from(arguments))}}update(){return this._send("update",Array.from(arguments))}end(){return this._send("end",Array.from(arguments))}get set(){return this.isCommand?this.getNextStageFn("set"):function(){throw new Error("JQL禁止使用set方法")}}_send(e,t){const s=this.getAction(),n=this.getCommand();return n.$db.push({$method:e,$param:Ls(t)}),this._database._callCloudFunction({action:s,command:n})}}function Fs(e,t,s){return Os(new Ns(e,t,s),{get(e,t){let n="db";return e&&e.content&&(n=e.content.$method),Ds(n,t)?Fs({$method:t},e,s):function(){return Fs({$method:t,$param:Ls(Array.from(arguments))},e,s)}}})}function qs({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 Ms(e,t={}){return Os(new e(t),{get:(e,t)=>Ds("db",t)?Fs({$method:t},null,e):function(){return Fs({$method:t,$param:Ls(Array.from(arguments))},null,e)}})}class js extends class{constructor({uniClient:e={},isJQL:t=!1}={}){this._uniClient=e,this._authCallBacks={},this._dbCallBacks={},e._isDefault&&(this._dbCallBacks=be("_globalUniCloudDatabaseCallback")),t||(this.auth=Rs(this._authCallBacks)),this._isJQL=t,Object.assign(this,Rs(this._dbCallBacks)),this.env=Os({},{get:(e,t)=>({$env:t})}),this.Geo=Os({},{get:(e,t)=>qs({path:["Geo"],method:t})}),this.serverDate=qs({path:[],method:"serverDate"}),this.RegExp=qs({path:[],method:"RegExp"})}getCloudEnv(e){if("string"!=typeof e||!e.trim())throw new Error("getCloudEnv参数错误");return{$env:e.replace("$cloudEnv_","")}}_callback(e,t){const s=this._dbCallBacks;s[e]&&s[e].forEach((e=>{e(...t)}))}_callbackAuth(e,t){const s=this._authCallBacks;s[e]&&s[e].forEach((e=>{e(...t)}))}multiSend(){const e=Array.from(arguments),t=e.map((e=>{const t=e.getAction(),s=e.getCommand();if("getTemp"!==s.$db[s.$db.length-1].$method)throw new Error("multiSend只支持子命令内使用getTemp");return{action:t,command:s}}));return this._callCloudFunction({multiCommand:t,queryList:e})}}{_parseResult(e){return this._isJQL?e.result:e}_callCloudFunction({action:e,command:t,multiCommand:s,queryList:n}){function r(e,t){if(s&&n)for(let s=0;s<n.length;s++){const r=n[s];r.udb&&"function"==typeof r.udb.setResult&&(t?r.udb.setResult(t):r.udb.setResult(e.result.dataList[s]))}}const i=this,o=this._isJQL?"databaseForJQL":"database";function a(e){return i._callback("error",[e]),xe(Ce(o,"fail"),e).then((()=>xe(Ce(o,"complete"),e))).then((()=>(r(null,e),Be(Ee,{type:Ue,content:e}),Promise.reject(e))))}const c=xe(Ce(o,"invoke")),l=this._uniClient;return c.then((()=>l.callFunction({name:"DCloud-clientDB",type:"CLIENT_DB",data:{action:e,command:t,multiCommand:s}}))).then((e=>{const{code:t,message:s,token:n,tokenExpired:c,systemInfo:l=[]}=e.result;if(l)for(let r=0;r<l.length;r++){const{level:e,message:t,detail:s}=l[r],n=console[e]||console.log;let i="[System Info]"+t;s&&(i=`${i}\n详细信息:${s}`),n(i)}if(t)return a(new Ve({code:t,message:s,requestId:e.requestId}));e.result.errCode=e.result.errCode||e.result.code,e.result.errMsg=e.result.errMsg||e.result.message,n&&c&&(Ge({token:n,tokenExpired:c}),this._callbackAuth("refreshToken",[{token:n,tokenExpired:c}]),this._callback("refreshToken",[{token:n,tokenExpired:c}]),Be(Le,{token:n,tokenExpired:c}));const u=[{prop:"affectedDocs",tips:"affectedDocs不再推荐使用,请使用inserted/deleted/updated/data.length替代"},{prop:"code",tips:"code不再推荐使用,请使用errCode替代"},{prop:"message",tips:"message不再推荐使用,请使用errMsg替代"}];for(let r=0;r<u.length;r++){const{prop:t,tips:s}=u[r];if(t in e.result){const n=e.result[t];Object.defineProperty(e.result,t,{get:()=>(console.warn(s),n)})}}return h=e,xe(Ce(o,"success"),h).then((()=>xe(Ce(o,"complete"),h))).then((()=>{r(h,null);const e=i._parseResult(h);return Be(Ee,{type:Ue,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 Ve({code:e.code||"SYSTEM_ERROR",message:e.message,requestId:e.requestId})))))}}const Bs="token无效,跳转登录页面",$s="token过期,跳转登录页面",Ks={TOKEN_INVALID_TOKEN_EXPIRED:$s,TOKEN_INVALID_INVALID_CLIENTID:Bs,TOKEN_INVALID:Bs,TOKEN_INVALID_WRONG_TOKEN:Bs,TOKEN_INVALID_ANONYMOUS_USER:Bs},Ws={"uni-id-token-expired":$s,"uni-id-check-token-failed":Bs,"uni-id-token-not-exist":Bs,"uni-id-check-device-feature-failed":Bs};function Js(e,t){let s="";return s=e?`${e}/${t}`:t,s.replace(/^\//,"")}function Vs(e=[],t=""){const s=[],n=[];return e.forEach((e=>{!0===e.needLogin?s.push(Js(t,e.path)):!1===e.needLogin&&n.push(Js(t,e.path))})),{needLoginPage:s,notNeedLoginPage:n}}function zs(e){return e.split("?")[0].replace(/^\//,"")}function Hs(){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 Qs(){return zs(Hs())}function Gs(e="",t={}){if(!e)return!1;if(!(t&&t.list&&t.list.length))return!1;const s=t.list,n=zs(e);return s.some((e=>e.pagePath===n))}const Ys=!!te.uniIdRouter,{loginPage:Xs,routerNeedLogin:Zs,resToLogin:en,needLoginPage:tn,notNeedLoginPage:sn,loginPageInTabBar:nn}=function({pages:e=[],subPackages:t=[],uniIdRouter:s={},tabBar:n={}}=te){const{loginPage:r,needLogin:i=[],resToLogin:o=!0}=s,{needLoginPage:a,notNeedLoginPage:c}=Vs(e),{needLoginPage:l,notNeedLoginPage:u}=function(e=[]){const t=[],s=[];return e.forEach((e=>{const{root:n,pages:r=[]}=e,{needLoginPage:i,notNeedLoginPage:o}=Vs(r,n);t.push(...i),s.push(...o)})),{needLoginPage:t,notNeedLoginPage:s}}(t);return{loginPage:r,routerNeedLogin:i,resToLogin:o,needLoginPage:[...a,...l],notNeedLoginPage:[...c,...u],loginPageInTabBar:Gs(r,n)}}();if(tn.indexOf(Xs)>-1)throw new Error(`Login page [${Xs}] should not be "needLogin", please check your pages.json`);function rn(e){const t=Qs();if("/"===e.charAt(0))return e;const[s,n]=e.split("?"),r=s.replace(/^\//,"").split("/"),i=t.split("/");i.pop();for(let o=0;o<r.length;o++){const e=r[o];".."===e?i.pop():"."!==e&&i.push(e)}return""===i[0]&&i.shift(),"/"+i.join("/")+(n?"?"+n:"")}function on({redirect:e}){const t=zs(e),s=zs(Xs);return Qs()!==s&&t!==s}function an({api:e,redirect:t}={}){if(!t||!on({redirect:t}))return;const s=(r=t,"/"!==(n=Xs).charAt(0)&&(n="/"+n),r?n.indexOf("?")>-1?n+`&uniIdRedirectUrl=${encodeURIComponent(r)}`:n+`?uniIdRedirectUrl=${encodeURIComponent(r)}`:n);var n,r;nn?"navigateTo"!==e&&"redirectTo"!==e||(e="switchTab"):"switchTab"===e&&(e="navigateTo");const i={navigateTo:w,redirectTo:v,switchTab:k,reLaunch:T};setTimeout((()=>{i[e]({url:s})}))}function cn({url:e}={}){const t={abortLoginPageJump:!1,autoToLoginPage:!1},s=function(){const{token:e,tokenExpired:t}=Qe();let s;if(e){if(t<Date.now()){const e="uni-id-token-expired";s={errCode:e,errMsg:Ws[e]}}}else{const e="uni-id-check-token-failed";s={errCode:e,errMsg:Ws[e]}}return s}();if(function(e){const t=zs(rn(e));return!(sn.indexOf(t)>-1)&&(tn.indexOf(t)>-1||Zs.some((t=>{return s=e,new RegExp(t).test(s);var s})))}(e)&&s){if(s.uniIdRedirectUrl=e,qe(De).length>0)return setTimeout((()=>{Be(De,s)}),0),t.abortLoginPageJump=!0,t;t.autoToLoginPage=!0}return t}function ln(){!function(){const e=Hs(),{abortLoginPageJump:t,autoToLoginPage:s}=cn({url:e});t||s&&an({api:"redirectTo",redirect:e})}();const e=["navigateTo","redirectTo","reLaunch","switchTab"];for(let t=0;t<e.length;t++){const s=e[t];r(s,{invoke(e){const{abortLoginPageJump:t,autoToLoginPage:n}=cn({url:e.url});return t?e:n?(an({api:s,redirect:rn(e.url)}),!1):e}})}}function un(){this.onResponse((e=>{const{type:t,content:s}=e;let n=!1;switch(t){case"cloudobject":n=function(e){if("object"!=typeof e)return!1;const{errCode:t}=e||{};return t in Ws}(s);break;case"clientdb":n=function(e){if("object"!=typeof e)return!1;const{errCode:t}=e||{};return t in Ks}(s)}n&&function(e={}){const t=qe(De);We().then((()=>{const s=Hs();if(s&&on({redirect:s}))return t.length>0?Be(De,Object.assign({uniIdRedirectUrl:s},e)):void(Xs&&an({api:"navigateTo",redirect:s}))}))}(s)}))}function hn(e){var t;(t=e).onResponse=function(e){Me(Ee,e)},t.offResponse=function(e){je(Ee,e)},function(e){e.onNeedLogin=function(e){Me(De,e)},e.offNeedLogin=function(e){je(De,e)},Ys&&(be("_globalUniCloudStatus").needLoginInit||(be("_globalUniCloudStatus").needLoginInit=!0,We().then((()=>{ln.call(e)})),en&&un.call(e)))}(e),function(e){e.onRefreshToken=function(e){Me(Le,e)},e.offRefreshToken=function(e){je(Le,e)}}(e)}let dn;const fn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",pn=/^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;function gn(){const e=Qe().token||"",t=e.split(".");if(!e||3!==t.length)return{uid:null,role:[],permission:[],tokenExpired:0};let s;try{s=JSON.parse((n=t[1],decodeURIComponent(dn(n).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""))))}catch(r){throw new Error("获取当前用户信息出错,详细错误信息为:"+r.message)}var n;return s.tokenExpired=1e3*s.exp,delete s.exp,delete s.iat,s}dn="function"!=typeof atob?function(e){if(e=String(e).replace(/[\t\n\f\r ]+/g,""),!pn.test(e))throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");var t;e+="==".slice(2-(3&e.length));for(var s,n,r="",i=0;i<e.length;)t=fn.indexOf(e.charAt(i++))<<18|fn.indexOf(e.charAt(i++))<<12|(s=fn.indexOf(e.charAt(i++)))<<6|(n=fn.indexOf(e.charAt(i++))),r+=64===s?String.fromCharCode(t>>16&255):64===n?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,255&t);return r}:atob;var mn=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(se((function(e,n){Object.defineProperty(n,"__esModule",{value:!0});const r="chooseAndUploadFile:ok",o="chooseAndUploadFile:fail";function a(e,t){return e.tempFiles.forEach(((e,s)=>{e.name||(e.name=e.path.substring(e.path.lastIndexOf("/")+1)),t&&(e.fileType=t),e.cloudPath=Date.now()+"_"+s+e.name.substring(e.name.lastIndexOf("."))})),e.tempFilePaths||(e.tempFilePaths=e.tempFiles.map((e=>e.path))),e}function c(e,t,{onChooseFile:s,onUploadProgress:n}){return t.then((e=>{if(s){const t=s(e);if(void 0!==t)return Promise.resolve(t).then((t=>void 0===t?e:t))}return e})).then((t=>!1===t?{errMsg:r,tempFilePaths:[],tempFiles:[]}:function(e,t,s=5,n){(t=Object.assign({},t)).errMsg=r;const i=t.tempFiles,o=i.length;let a=0;return new Promise((r=>{for(;a<s;)c();function c(){const s=a++;if(s>=o)return void(!i.find((e=>!e.url&&!e.errMsg))&&r(t));const l=i[s];e.uploadFile({filePath:l.path,cloudPath:l.cloudPath,fileType:l.fileType,onUploadProgress(e){e.index=s,e.tempFile=l,e.tempFilePath=l.path,n&&n(e)}}).then((e=>{l.url=e.fileID,s<o&&c()})).catch((e=>{l.errMsg=e.errMsg||e.message,s<o&&c()}))}}))}(e,t,5,n)))}n.initChooseAndUploadFile=function(e){return function(n={type:"all"}){return"image"===n.type?c(e,function(e){const{count:s,sizeType:n,sourceType:r=["album","camera"],extension:i}=e;return new Promise(((e,c)=>{t({count:s,sizeType:n,sourceType:r,extension:i,success(t){e(a(t,"image"))},fail(e){c({errMsg:e.errMsg.replace("chooseImage:fail",o)})}})}))}(n),n):"video"===n.type?c(e,function(e){const{camera:t,compressed:n,maxDuration:r,sourceType:i=["album","camera"],extension:c}=e;return new Promise(((e,l)=>{s({camera:t,compressed:n,maxDuration:r,sourceType:i,extension:c,success(t){const{tempFilePath:s,duration:n,size:r,height:i,width:o}=t;e(a({errMsg:"chooseVideo:ok",tempFilePaths:[s],tempFiles:[{name:t.tempFile&&t.tempFile.name||"",path:s,size:r,type:t.tempFile&&t.tempFile.type||"",width:o,height:i,duration:n,fileType:"video",cloudPath:""}]},"video"))},fail(e){l({errMsg:e.errMsg.replace("chooseVideo:fail",o)})}})}))}(n),n):c(e,function(e){const{count:t,extension:s}=e;return new Promise(((e,n)=>{let r=i;if("undefined"!=typeof wx&&"function"==typeof wx.chooseMessageFile&&(r=wx.chooseMessageFile),"function"!=typeof r)return n({errMsg:o+" 请指定 type 类型,该平台仅支持选择 image 或 video。"});r({type:"all",count:t,extension:s,success(t){e(a(t))},fail(e){n({errMsg:e.errMsg.replace("chooseFile:fail",o)})}})}))}(n),n)}}})));function yn(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:{}}),created(){this.mixinDatacomPage={current:this.pageCurrent,size:this.pageSize,count:0},this.$watch((()=>{var e=[];return["pageCurrent","pageSize","localdata","collection","action","field","orderby","where","getont","getcount","gettree","groupby","groupField","distinct"].forEach((t=>{e.push(this[t])})),e}),((e,t)=>{if("manual"===this.loadtime)return;let s=!1;const n=[];for(let r=2;r<e.length;r++)e[r]!==t[r]&&(n.push(e[r]),s=!0);e[0]!==t[0]&&(this.mixinDatacomPage.current=this.pageCurrent),this.mixinDatacomPage.size=this.pageSize,this.onMixinDatacomPropsChange(s,n)}))},methods:{onMixinDatacomPropsChange(e,t){},mixinDatacomEasyGet({getone:e=!1,success:t,fail:s}={}){this.mixinDatacomLoading||(this.mixinDatacomLoading=!0,this.mixinDatacomErrorMessage="",this.mixinDatacomGet().then((s=>{this.mixinDatacomLoading=!1;const{data:n,count:r}=s.result;this.getcount&&(this.mixinDatacomPage.count=r),this.mixinDatacomHasMore=n.length<this.pageSize;const i=e?n.length?n[0]:void 0:n;this.mixinDatacomResData=i,t&&t(i)})).catch((e=>{this.mixinDatacomLoading=!1,this.mixinDatacomErrorMessage=e,s&&s(e)})))},mixinDatacomGet(t={}){let s=e.database(this.spaceInfo);const n=t.action||this.action;n&&(s=s.action(n));const r=t.collection||this.collection;s=Array.isArray(r)?s.collection(...r):s.collection(r);const i=t.where||this.where;i&&Object.keys(i).length&&(s=s.where(i));const o=t.field||this.field;o&&(s=s.field(o));const a=t.foreignKey||this.foreignKey;a&&(s=s.foreignKey(a));const c=t.groupby||this.groupby;c&&(s=s.groupBy(c));const l=t.groupField||this.groupField;l&&(s=s.groupField(l)),!0===(void 0!==t.distinct?t.distinct:this.distinct)&&(s=s.distinct());const u=t.orderby||this.orderby;u&&(s=s.orderBy(u));const h=void 0!==t.pageCurrent?t.pageCurrent:this.mixinDatacomPage.current,d=void 0!==t.pageSize?t.pageSize:this.mixinDatacomPage.size,f=void 0!==t.getcount?t.getcount:this.getcount,p=void 0!==t.gettree?t.gettree:this.gettree,g=void 0!==t.gettreepath?t.gettreepath:this.gettreepath,m={getCount:f},y={limitLevel:void 0!==t.limitlevel?t.limitlevel:this.limitlevel,startWith:void 0!==t.startwith?t.startwith:this.startwith};return p&&(m.getTree=y),g&&(m.getTreePath=y),s=s.skip(d*(h-1)).limit(d).get(m),s}}}}function _n(e){return be("_globalUniCloudSecureNetworkCache__{spaceId}".replace("{spaceId}",e.config.spaceId))}async function wn({openid:e,callLoginByWeixin:t=!1}={}){throw _n(this),new Error("[SecureNetwork] API `initSecureNetworkByWeixin` is not supported on platform `web`")}async function vn(e){const t=_n(this);return t.initPromise||(t.initPromise=wn.call(this,e)),t.initPromise}function kn(e){const t={getSystemInfo:b,getPushClientId:S};return function(s){return new Promise(((n,r)=>{t[e]({...s,success(e){n(e)},fail(e){r(e)}})}))}}class Tn extends class{constructor(){this._callback={}}addListener(e,t){this._callback[e]||(this._callback[e]=[]),this._callback[e].push(t)}on(e,t){return this.addListener(e,t)}removeListener(e,t){if(!t)throw new Error('The "listener" argument must be of type function. Received undefined');const s=this._callback[e];if(!s)return;const n=function(e,t){for(let s=e.length-1;s>=0;s--)if(e[s]===t)return s;return-1}(s,t);s.splice(n,1)}off(e,t){return this.removeListener(e,t)}removeAllListener(e){delete this._callback[e]}emit(e,...t){const s=this._callback[e];if(s)for(let n=0;n<s.length;n++)s[n](...t)}}{constructor(){super(),this._uniPushMessageCallback=this._receivePushMessage.bind(this),this._currentMessageId=-1,this._payloadQueue=[]}init(){return Promise.all([kn("getSystemInfo")(),kn("getPushClientId")()]).then((([{appId:e}={},{cid:t}={}]=[])=>{if(!e)throw new Error("Invalid appId, please check the manifest.json file");if(!t)throw new Error("Invalid push client id");this._appId=e,this._pushClientId=t,this._seqId=Date.now()+"-"+Math.floor(9e5*Math.random()+1e5),this.emit("open"),this._initMessageListener()}),(e=>{throw this.emit("error",e),this.close(),e}))}async open(){return this.init()}_isUniCloudSSE(e){if("receive"!==e.type)return!1;const t=e&&e.data&&e.data.payload;return!(!t||"UNI_CLOUD_SSE"!==t.channel||t.seqId!==this._seqId)}_receivePushMessage(e){if(!this._isUniCloudSSE(e))return;const t=e&&e.data&&e.data.payload,{action:s,messageId:n,message:r}=t;this._payloadQueue.push({action:s,messageId:n,message:r}),this._consumMessage()}_consumMessage(){for(;;){const e=this._payloadQueue.find((e=>e.messageId===this._currentMessageId+1));if(!e)break;this._currentMessageId++,this._parseMessagePayload(e)}}_parseMessagePayload(e){const{action:t,messageId:s,message:n}=e;"end"===t?this._end({messageId:s,message:n}):"message"===t&&this._appendMessage({messageId:s,message:n})}_appendMessage({messageId:e,message:t}={}){this.emit("message",t)}_end({messageId:e,message:t}={}){this.emit("end",t),this.close()}_initMessageListener(){u(this._uniPushMessageCallback)}_destroy(){h(this._uniPushMessageCallback)}toJSON(){return{appId:this._appId,pushClientId:this._pushClientId,seqId:this._seqId}}close(){this._destroy(),this.emit("close")}}const bn={tcb:ps,tencent:ps,aliyun:ct,private:ms};let Sn=new class{init(e){let t={};const s=bn[e.provider];if(!s)throw new Error("未提供正确的provider参数");var n;return t=s.init(e),function(e){e._initPromiseHub||(e._initPromiseHub=new ye({createPromise:function(){let t=Promise.resolve();t=new Promise((e=>{setTimeout((()=>{e()}),1)}));const s=e.auth();return t.then((()=>s.getLoginState())).then((e=>e?Promise.resolve():s.signInAnonymously()))}}))}(t),xs(t),function(e){const t=e.uploadFile;e.uploadFile=function(e){return t.call(this,e)}}(t),(n=t).database=function(e){if(e&&Object.keys(e).length>0)return n.init(e).database();if(this._database)return this._database;const t=Ms(js,{uniClient:n});return this._database=t,t},n.databaseForJQL=function(e){if(e&&Object.keys(e).length>0)return n.init(e).databaseForJQL();if(this._databaseForJQL)return this._databaseForJQL;const t=Ms(js,{uniClient:n,isJQL:!0});return this._databaseForJQL=t,t},function(e){e.getCurrentUserInfo=gn,e.chooseAndUploadFile=mn.initChooseAndUploadFile(e),Object.assign(e,{get mixinDatacom(){return yn(e)}}),e.SSEChannel=Tn,e.initSecureNetworkByWeixin=function(e){return function({openid:t,callLoginByWeixin:s=!1}={}){return vn.call(e,{openid:t,callLoginByWeixin:s})}}(e),e.importObject=function(t){return function(s,n={}){n=function(e,t={}){return e.customUI=t.customUI||e.customUI,e.parseSystemError=t.parseSystemError||e.parseSystemError,Object.assign(e.loadingOptions,t.loadingOptions),Object.assign(e.errorOptions,t.errorOptions),"object"==typeof t.secretMethods&&(e.secretMethods=t.secretMethods),e}({customUI:!1,loadingOptions:{title:"加载中...",mask:!0},errorOptions:{type:"modal",retry:!1}},n);const{customUI:r,loadingOptions:i,errorOptions:u,parseSystemError:h}=n,d=!r;return new Proxy({},{get:(r,f)=>function({fn:e,interceptorName:t,getCallbackArgs:s}={}){return async function(...n){const r=s?s({params:n}):{};let i,o;try{return await xe(Ce(t,"invoke"),{...r}),i=await e(...n),await xe(Ce(t,"success"),{...r,result:i}),i}catch(a){throw o=a,await xe(Ce(t,"fail"),{...r,error:o}),o}finally{await xe(Ce(t,"complete"),o?{...r,error:o}:{...r,result:i})}}}({fn:async function r(...p){let g;d&&o({title:i.title,mask:i.mask});const m={name:s,type:"OBJECT",data:{method:f,params:p}};"object"==typeof n.secretMethods&&function(e,t){const s=t.data.method,n=e.secretMethods||{},r=n[s]||n["*"];r&&(t.secretType=r)}(n,m);let y=!1;try{g=await t.callFunction(m)}catch(e){y=!0,g={result:new Ve(e)}}const{errSubject:_,errCode:w,errMsg:v,newToken:k}=g.result||{};if(d&&a(),k&&k.token&&k.tokenExpired&&(Ge(k),Be(Le,{...k})),w){let e=v;if(y&&h&&(e=(await h({objectName:s,methodName:f,params:p,errSubject:_,errCode:w,errMsg:v})).errMsg||v),d)if("toast"===u.type)c({title:e,icon:"none"});else{if("modal"!==u.type)throw new Error(`Invalid errorOptions.type: ${u.type}`);{const{confirm:t}=await async function({title:e,content:t,showCancel:s,cancelText:n,confirmText:r}={}){return new Promise(((i,o)=>{l({title:e,content:t,showCancel:s,cancelText:n,confirmText:r,success(e){i(e)},fail(){i({confirm:!1,cancel:!0})}})}))}({title:"提示",content:e,showCancel:u.retry,cancelText:"取消",confirmText:u.retry?"重试":"确定"});if(u.retry&&t)return r(...p)}}const t=new Ve({subject:_,code:w,message:v,requestId:g.requestId});throw t.detail=g.result,Be(Ee,{type:Fe,content:t}),t}return Be(Ee,{type:Fe,content:g.result}),g.result},interceptorName:"callObject",getCallbackArgs:function({params:e}={}){return{objectName:s,methodName:f,params:e}}})})}}(e)}(t),["callFunction","uploadFile","deleteFile","getTempFileURL","downloadFile","chooseAndUploadFile"].forEach((e=>{if(!t[e])return;const s=t[e];var n,r;t[e]=function(){return s.apply(t,Array.from(arguments))},t[e]=(n=t[e],r=e,function(e){let t=!1;if("callFunction"===r){const s=e&&e.type||ce;t=s!==ce}const s="callFunction"===r&&!t,i=this._initPromiseHub.exec();e=e||{};const{success:o,fail:a,complete:c}=Je(e),l=i.then((()=>t?Promise.resolve():xe(Ce(r,"invoke"),e))).then((()=>n.call(this,e))).then((e=>t?Promise.resolve(e):xe(Ce(r,"success"),e).then((()=>xe(Ce(r,"complete"),e))).then((()=>(s&&Be(Ee,{type:Ne,content:e}),Promise.resolve(e))))),(e=>t?Promise.reject(e):xe(Ce(r,"fail"),e).then((()=>xe(Ce(r,"complete"),e))).then((()=>(Be(Ee,{type:Ne,content:e}),Promise.reject(e))))));if(!(o||a||c))return l;l.then((e=>{o&&o(e),c&&c(e),s&&Be(Ee,{type:Ne,content:e})}),(e=>{a&&a(e),c&&c(e),s&&Be(Ee,{type:Ne,content:e})}))}).bind(t)})),t.init=this.init,t}};(()=>{const e=ve;let t={};if(e&&1===e.length)t=e[0],Sn=Sn.init(t),Sn._isDefault=!0;else{const t=["auth","callFunction","uploadFile","deleteFile","getTempFileURL","downloadFile","database","getCurrentUSerInfo","importObject"];let s;s=e&&e.length>0?"应用有多个服务空间,请通过uniCloud.init方法指定要使用的服务空间":"应用未关联服务空间,请在uniCloud目录右键关联服务空间",t.forEach((e=>{Sn[e]=function(){return console.error(s),Promise.reject(new Ve({code:"SYS_ERR",message:s}))}}))}Object.assign(Sn,{get mixinDatacom(){return yn(Sn)}}),hn(Sn),Sn.addInterceptor=Ie,Sn.removeInterceptor=Ae,Sn.interceptObject=Oe})();const Pn=ee({name:"uni-data-select",mixins:[Sn.mixinDatacom||{}],props:{localdata:{type:Array,default:()=>[]},value:{type:[String,Number],default:""},modelValue:{type:[String,Number],default:""},label:{type:String,default:""},placeholder:{type:String,default:"请选择"},emptyTips:{type:String,default:"无选项"},clear:{type:Boolean,default:!0},defItem:{type:Number,default:0},disabled:{type:Boolean,default:!1},format:{type:String,default:""}},data:()=>({showSelector:!1,current:"",mixinDatacomResData:[],apps:[],channels:[],cacheKey:"uni-data-select-lastSelectedValue"}),created(){this.debounceGet=this.debounce((()=>{this.query()}),300),this.collection&&!this.localdata.length&&this.debounceGet()},computed:{typePlaceholder(){const e=this.placeholder,t={"opendb-stat-app-versions":"版本","opendb-app-channels":"渠道","opendb-app-list":"应用"}[this.collection];return t?e+t:e},valueCom(){return this.modelValue}},watch:{localdata:{immediate:!0,handler(e,t){Array.isArray(e)&&t!==e&&(this.mixinDatacomResData=e)}},valueCom(e,t){this.initDefVal()},mixinDatacomResData:{immediate:!0,handler(e){e.length&&this.initDefVal()}}},methods:{debounce(e,t=100){let s=null;return function(...n){s&&clearTimeout(s),s=setTimeout((()=>{e.apply(this,n)}),t)}},query(){this.mixinDatacomEasyGet()},onMixinDatacomPropsChange(){this.collection&&this.debounceGet()},initDefVal(){let e="";if(!this.valueCom&&0!==this.valueCom||this.isDisabled(this.valueCom)){let t;if(this.collection&&(t=this.getCache()),t||0===t)e=t;else{let t="";this.defItem>0&&this.defItem<=this.mixinDatacomResData.length&&(t=this.mixinDatacomResData[this.defItem-1].value),e=t}(e||0===e)&&this.emit(e)}else e=this.valueCom;const t=this.mixinDatacomResData.find((t=>t.value===e));this.current=t?this.formatItemName(t):""},isDisabled(e){let t=!1;return this.mixinDatacomResData.forEach((s=>{s.value===e&&(t=s.disable)})),t},clearVal(){this.emit(""),this.collection&&this.removeCache()},change(e){e.disable||(this.showSelector=!1,this.current=this.formatItemName(e),this.emit(e.value))},emit(e){this.$emit("input",e),this.$emit("update:modelValue",e),this.$emit("change",e),this.collection&&this.setCache(e)},toggleSelector(){this.disabled||(this.showSelector=!this.showSelector)},formatItemName(e){let{text:t,value:s,channel_code:n}=e;if(n=n?`(${n})`:"",this.format){let t="";t=this.format;for(let s in e)t=t.replace(new RegExp(`{${s}}`,"g"),e[s]);return t}return this.collection.indexOf("app-list")>0?`${t}(${s})`:t||`未命名${n}`},getLoadData(){return this.mixinDatacomResData},getCurrentCacheKey(){return this.collection},getCache(e=this.getCurrentCacheKey()){return(g(this.cacheKey)||{})[e]},setCache(e,t=this.getCurrentCacheKey()){let s=g(this.cacheKey)||{};s[t]=e,p(this.cacheKey,s)},removeCache(e=this.getCurrentCacheKey()){let t=g(this.cacheKey)||{};delete t[e],p(this.cacheKey,t)}}},[["render",function(e,t,s,n,r,i){const o=B,a=A(x("uni-icons"),Z),c=$,l=K;return C(),O(o,{class:"uni-stat__select"},{default:R((()=>[s.label?(C(),E("span",{key:0,class:"uni-label-text hide-on-phone"},D(s.label+":"),1)):L("",!0),U(o,{class:N(["uni-stat-box",{"uni-stat__actived":r.current}])},{default:R((()=>[U(o,{class:N(["uni-select",{"uni-select--disabled":s.disabled}])},{default:R((()=>[U(o,{class:"uni-select__input-box",onClick:i.toggleSelector},{default:R((()=>[r.current?(C(),O(o,{key:0,class:"uni-select__input-text"},{default:R((()=>[F(D(r.current),1)])),_:1})):(C(),O(o,{key:1,class:"uni-select__input-text uni-select__input-placeholder"},{default:R((()=>[F(D(i.typePlaceholder),1)])),_:1})),r.current&&s.clear&&!s.disabled?(C(),O(o,{key:2,onClick:q(i.clearVal,["stop"])},{default:R((()=>[U(a,{type:"clear",color:"#c0c4cc",size:"24"})])),_:1},8,["onClick"])):(C(),O(o,{key:3},{default:R((()=>[U(a,{type:r.showSelector?"top":"bottom",size:"14",color:"#999"},null,8,["type"])])),_:1}))])),_:1},8,["onClick"]),r.showSelector?(C(),O(o,{key:0,class:"uni-select--mask",onClick:i.toggleSelector},null,8,["onClick"])):L("",!0),r.showSelector?(C(),O(o,{key:1,class:"uni-select__selector"},{default:R((()=>[U(o,{class:"uni-popper__arrow"}),U(l,{"scroll-y":"true",class:"uni-select__selector-scroll"},{default:R((()=>[0===r.mixinDatacomResData.length?(C(),O(o,{key:0,class:"uni-select__selector-empty"},{default:R((()=>[U(c,null,{default:R((()=>[F(D(s.emptyTips),1)])),_:1})])),_:1})):(C(!0),E(M,{key:1},j(r.mixinDatacomResData,((e,t)=>(C(),O(o,{class:"uni-select__selector-item",key:t,onClick:t=>i.change(e)},{default:R((()=>[U(c,{class:N({"uni-select__selector__disabled":e.disable})},{default:R((()=>[F(D(i.formatItemName(e)),1)])),_:2},1032,["class"])])),_:2},1032,["onClick"])))),128))])),_:1})])),_:1})):L("",!0)])),_:1},8,["class"])])),_:1},8,["class"])])),_:1})}],["__scopeId","data-v-a0be3707"]]),In={__name:"apply",setup(e){W(),J("");let t=J(""),s=J(""),n=J(0),r=J(0),i=J(""),o=V([{value:1,text:"直销"},{value:2,text:"代销"},{value:3,text:"电销"}]),a=e=>{console.log("e",e),r=e};z((e=>{i.value=e.store_id}));let l=()=>{let e={name:s._value,phone:t._value,group:r-1,store_id:i._value};X.$api.user.agentinvite(e).then((e=>{console.log("res",e),0==e.code?c({title:e.msg,duration:2e3,icon:"none"}):(setTimeout((()=>{X.$router.go("/pages/me/apply/apply_success?store_id="+i._value)}),1e3),c({title:"提交成功",duration:1e3,icon:"none"}))}))};return(e,r)=>{const i=B,c=A(x("uni-data-select"),Pn),u=G("uni-section"),h=Y;return C(),O(i,{class:""},{default:R((()=>[U(i,{class:"content"},{default:R((()=>[U(i,{class:"items"},{default:R((()=>[U(i,{class:"",style:{width:"20%"}},{default:R((()=>[F(" 分组 ")])),_:1}),U(i,{class:"",style:{display:"flex","justify-content":"space-between",width:"80%"}},{default:R((()=>[U(u,{title:"",type:"line",style:{width:"100%",display:"flex","align-items":"center"}},{default:R((()=>[U(c,{modelValue:H(n),"onUpdate:modelValue":r[0]||(r[0]=e=>Q(n)?n.value=e:n=e),localdata:H(o),onChange:H(a),"custom-class":"ipt",label:"应用选择"},null,8,["modelValue","localdata","onChange"])])),_:1})])),_:1})])),_:1}),U(i,{class:"items"},{default:R((()=>[U(i,{class:"",style:{width:"20%"}},{default:R((()=>[F(" 姓名 ")])),_:1}),U(i,{class:"",style:{display:"flex","justify-content":"space-between",width:"80%"}},{default:R((()=>[U(h,{type:"text",placeholder:"请输入姓名","placeholder-style":"color:#7985A4;font-size:28rpx;",modelValue:H(s),"onUpdate:modelValue":r[1]||(r[1]=e=>Q(s)?s.value=e:s=e)},null,8,["modelValue"])])),_:1})])),_:1}),U(i,{class:"items"},{default:R((()=>[U(i,{class:"",style:{width:"20%"}},{default:R((()=>[F(" 电话 ")])),_:1}),U(i,{class:"",style:{display:"flex","justify-content":"space-between",width:"80%"}},{default:R((()=>[U(h,{type:"text",placeholder:"请输入电话","placeholder-style":"color:#7985A4;font-size:28rpx;",modelValue:H(t),"onUpdate:modelValue":r[2]||(r[2]=e=>Q(t)?t.value=e:t=e)},null,8,["modelValue"])])),_:1})])),_:1})])),_:1}),U(i,{class:"btm"},{default:R((()=>[H(s)&&H(t)&&H(n)?(C(),O(i,{key:0,class:"btn blue",onClick:H(l)},{default:R((()=>[F(" 提交申请 ")])),_:1},8,["onClick"])):(C(),O(i,{key:1,class:"btn"},{default:R((()=>[F(" 提交申请 ")])),_:1}))])),_:1})])),_:1})}}},An=ee(In,[["__scopeId","data-v-2c2497ab"]]);export{An as default};