(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-index-detail~pages-index-history"],{"035a":function(e,t,n){"use strict";n("7a82");var r=n("4ea4").default;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=r(n("0cb6")),i=r(n("b746")),o=r(n("0622")),s={en:a.default,"zh-Hans":i.default,"zh-Hant":o.default};t.default=s},"0622":function(e){e.exports=JSON.parse('{"uni-load-more.contentdown":"上拉顯示更多","uni-load-more.contentrefresh":"正在加載...","uni-load-more.contentnomore":"沒有更多數據了"}')},"0cb6":function(e){e.exports=JSON.parse('{"uni-load-more.contentdown":"Pull up to show more","uni-load-more.contentrefresh":"loading...","uni-load-more.contentnomore":"No more data"}')},"14d1":function(e,t,n){"use strict";n("7a82"),Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={pages:[{path:"pages/index/index",style:{navigationBarTitleText:"客服助手"}},{path:"pages/index/login",style:{navigationStyle:"custom"}},{path:"pages/index/history",style:{navigationBarTitleText:"客服助手",enablePullDownRefresh:!0}},{path:"pages/index/detail",style:{navigationBarTitleText:"客服助手",enablePullDownRefresh:!1}},{path:"pages/index/my",style:{navigationBarTitleText:"客服助手",enablePullDownRefresh:!1}},{path:"pages/index/wechat",style:{navigationBarTitleText:"客服助手",enablePullDownRefresh:!1}},{path:"pages/index/visitorChat",style:{navigationBarTitleText:"扫码直接聊天",enablePullDownRefresh:!1}},{path:"pages/index/webview",style:{navigationStyle:"custom"}}],globalStyle:{navigationBarTextStyle:"black",navigationBarTitleText:"客服助手",navigationBarBackgroundColor:"#F8F8F8",backgroundColor:"#F8F8F8"},tabBar:{selectedColor:"#4687f2",list:[{pagePath:"pages/index/index",iconPath:"static/comment.png",selectedIconPath:"static/comment-s.png",text:"会话"},{pagePath:"pages/index/history",iconPath:"static/browse.png",selectedIconPath:"static/browse-s.png",text:"访客"},{pagePath:"pages/index/my",iconPath:"static/user.png",selectedIconPath:"static/user-s.png",text:"我的"}]}}},1826:function(e,t,n){"use strict";var r=n("42bc"),a=n.n(r);a.a},1939:function(e,t,n){var r=n("b68d");r.__esModule&&(r=r.default),"string"===typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);var a=n("4f06").default;a("3f82e0f4",r,!0,{sourceMap:!1,shadowMode:!1})},"19e3":function(e,t,n){"use strict";var r=n("1939"),a=n.n(r);a.a},2909:function(e,t,n){"use strict";n("7a82"),Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return(0,r.default)(e)||(0,a.default)(e)||(0,i.default)(e)||(0,o.default)()};var r=s(n("6005")),a=s(n("db90")),i=s(n("06c5")),o=s(n("3427"));function s(e){return e&&e.__esModule?e:{default:e}}},3242:function(e,t,n){"use strict";n("7a82");var r=n("4ea4").default;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,n("e9c4"),n("d3b7");var a=r(n("d4ec")),i=r(n("bee2")),o=function(){function e(t,n){(0,a.default)(this,e),this.url=t,this.data=null,this.isCreate=!1,this.isConnect=!1,this.isInitiative=!1,this.timeoutNumber=n,this.heartbeatTimer=null,this.reconnectTimer=null,this.socketExamples=null,this.againTime=3,this.reconnectNum=0}return(0,i.default)(e,[{key:"initSocket",value:function(){var e=this;this.socketExamples=uni.connectSocket({url:e.url,header:{"content-type":"application/json"},success:function(t){e.isCreate=!0,console.log(t)},fail:function(t){console.error(t),e.isCreate=!1}}),this.createSocket()}},{key:"createSocket",value:function(){var e=this;if(this.isCreate){console.log("WebSocket 开始初始化");try{this.socketExamples.onOpen((function(){console.log("WebSocket 连接成功"),e.isConnect=!0,clearInterval(e.heartbeatTimer),clearTimeout(e.reconnectTimer),e.heartbeatCheck()})),this.socketExamples.onMessage((function(e){uni.$emit("message",e)})),this.socketExamples.onClose((function(){console.log("WebSocket 关闭了"),uni.showToast({icon:"loading",title:"服务重连"+e.reconnectNum+"次",duration:2e3}),e.isConnect=!1,e.reconnect()})),this.socketExamples.onError((function(t){console.log("WebSocket 出错了"),console.log(t),uni.showToast({icon:"error",title:t.errMsg,duration:2e3}),e.isInitiative=!1}))}catch(t){console.warn(t)}}else console.warn("WebSocket 初始化失败!")}},{key:"sendMsg",value:function(e){var t=this,n=JSON.stringify(e);return new Promise((function(e,r){t.socketExamples.send({data:n,success:function(){console.log("消息发送成功"),e(!0)},fail:function(e){console.log("消息发送失败"),r(e)}})}))}},{key:"heartbeatCheck",value:function(){var e=this;console.log("开启心跳"),this.data={state:1,method:"heartbeat"},this.heartbeatTimer=setInterval((function(){e.sendMsg(e.data)}),1e3*this.timeoutNumber)}},{key:"reconnect",value:function(){var e=this;clearTimeout(this.reconnectTimer),clearInterval(this.heartbeatTimer),this.isInitiative||(this.reconnectTimer=setTimeout((function(){e.reconnectNum++,e.initSocket()}),1e3*this.againTime))}},{key:"closeSocket",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"关闭",t=this;this.socketExamples.close({reason:e,success:function(){t.data=null,t.isCreate=!1,t.isConnect=!1,t.isInitiative=!0,t.socketExamples=null,clearInterval(t.heartbeatTimer),clearTimeout(t.reconnectTimer),console.log("关闭 WebSocket 成功")},fail:function(){console.log("关闭 WebSocket 失败")}})}}]),e}(),s=o;t.default=s},3427:function(e,t,n){"use strict";n("7a82"),Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},n("d9e2"),n("d401")},"42bc":function(e,t,n){var r=n("646c");r.__esModule&&(r=r.default),"string"===typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);var a=n("4f06").default;a("7e750bc2",r,!0,{sourceMap:!1,shadowMode:!1})},4478:function(e,t,n){"use strict";n("7a82"),Object.defineProperty(t,"__esModule",{value:!0}),t.default=o,n("4ae1"),n("d3b7"),n("f8c9"),n("14d9");var r=i(n("b380")),a=i(n("d967"));function i(e){return e&&e.__esModule?e:{default:e}}function o(e,n,i){return(0,a.default)()?t.default=o=Reflect.construct.bind():t.default=o=function(e,t,n){var a=[null];a.push.apply(a,t);var i=Function.bind.apply(e,a),o=new i;return n&&(0,r.default)(o,n.prototype),o},o.apply(null,arguments)}},"46d3":function(e,t,n){"use strict";n("7a82");var r=n("4ea4").default;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=r(n("53ca"));n("14d9"),n("a434"),n("fb6a"),n("c740"),n("7db0"),n("d3b7");var i=r(n("7ed6")),o=r(n("7130")),s={name:"UniDataPicker",emits:["popupopened","popupclosed","nodeclick","input","change","update:modelValue"],mixins:[i.default],components:{DataPickerView:o.default},props:{options:{type:[Object,Array],default:function(){return{}}},popupTitle:{type:String,default:"请选择"},placeholder:{type:String,default:"请选择"},heightMobile:{type:String,default:""},readonly:{type:Boolean,default:!1},clearIcon:{type:Boolean,default:!0},border:{type:Boolean,default:!0},split:{type:String,default:"/"},ellipsis:{type:Boolean,default:!0}},data:function(){return{isOpened:!1,inputSelected:[]}},created:function(){var e=this;this.form=this.getForm("uniForms"),this.formItem=this.getForm("uniFormsItem"),this.formItem&&this.formItem.name&&(this.rename=this.formItem.name,this.form.inputChildrens.push(this)),this.$nextTick((function(){e.load()}))},methods:{clear:function(){this.inputSelected.splice(0),this._dispatchEvent([])},onPropsChange:function(){this._treeData=[],this.selectedIndex=0,this.load()},load:function(){var e=this;this.readonly?this._processReadonly(this.localdata,this.dataValue):this.isLocaldata?(this.loadData(),this.inputSelected=this.selected.slice(0)):this.parentField||this.selfField||!this.hasValue?this.hasValue&&this.getTreePath((function(){e.inputSelected=e.selected.slice(0)})):this.getNodeData((function(){e.inputSelected=e.selected.slice(0)}))},getForm:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"uniForms",t=this.$parent,n=t.$options.name;while(n!==e){if(t=t.$parent,!t)return!1;n=t.$options.name}return t},show:function(){var e=this;this.isOpened=!0,this.$nextTick((function(){e.$refs.pickerView.updateData({treeData:e._treeData,selected:e.selected,selectedIndex:e.selectedIndex})})),this.$emit("popupopened")},hide:function(){this.isOpened=!1,this.$emit("popupclosed")},handleInput:function(){this.readonly||this.show()},handleClose:function(e){this.hide()},onnodeclick:function(e){this.$emit("nodeclick",e)},ondatachange:function(e){this._treeData=this.$refs.pickerView._treeData},onchange:function(e){this.hide(),this.inputSelected=e,this._dispatchEvent(e)},_processReadonly:function(e,t){var n,r=e.findIndex((function(e){return e.children}));if(r>-1)return Array.isArray(t)?(n=t[t.length-1],"object"===(0,a.default)(n)&&n.value&&(n=n.value)):n=t,void(this.inputSelected=this._findNodePath(n,this.localdata));if(this.hasValue){for(var i=[],o=0;or&&t[e.map.value]==e.selected[r].value?n("v-uni-view",{staticClass:"check"}):e._e()],1)})),1):e._e()]})),e.loading?n("v-uni-view",{staticClass:"loading-cover"},[n("uni-load-more",{staticClass:"load-more",attrs:{contentText:e.loadMore,status:"loading"}})],1):e._e(),e.errorMessage?n("v-uni-view",{staticClass:"error-message"},[n("v-uni-text",{staticClass:"error-text"},[e._v(e._s(e.errorMessage))])],1):e._e()],2)],1)},i=[]},"7a31":function(e,t,n){"use strict";n.r(t);var r=n("f525"),a=n.n(r);for(var i in r)["default"].indexOf(i)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(i);t["default"]=a.a},"7aea":function(e,t,n){var r=n("24fb");t=r(!1),t.push([e.i,'@charset "UTF-8";\r\n/**\r\n * 这里是uni-app内置的常用样式变量\r\n *\r\n * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量\r\n * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App\r\n *\r\n */\r\n/**\r\n * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能\r\n *\r\n * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件\r\n */\r\n/* 颜色变量 */\r\n/* 行为相关颜色 */\r\n/* 文字基本颜色 */\r\n/* 背景颜色 */\r\n/* 边框颜色 */\r\n/* 尺寸变量 */\r\n/* 文字尺寸 */\r\n/* 图片尺寸 */\r\n/* Border Radius */\r\n/* 水平间距 */\r\n/* 垂直间距 */\r\n/* 透明度 */\r\n/* 文章场景相关 */.uni-load-more[data-v-0af76499]{display:flex;flex-direction:row;height:40px;align-items:center;justify-content:center}.uni-load-more__text[data-v-0af76499]{font-size:14px;margin-left:8px}.uni-load-more__img[data-v-0af76499]{width:24px;height:24px}.uni-load-more__img--nvue[data-v-0af76499]{color:#666}.uni-load-more__img--android[data-v-0af76499],\r\n.uni-load-more__img--ios[data-v-0af76499]{width:24px;height:24px;-webkit-transform:rotate(0deg);transform:rotate(0deg)}.uni-load-more__img--android[data-v-0af76499]{-webkit-animation:loading-ios 1s 0s linear infinite;animation:loading-ios 1s 0s linear infinite}@-webkit-keyframes loading-android-data-v-0af76499{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes loading-android-data-v-0af76499{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.uni-load-more__img--ios-H5[data-v-0af76499]{position:relative;-webkit-animation:loading-ios-H5-data-v-0af76499 1s 0s step-end infinite;animation:loading-ios-H5-data-v-0af76499 1s 0s step-end infinite}.uni-load-more__img--ios-H5 uni-image[data-v-0af76499]{position:absolute;width:100%;height:100%;left:0;top:0}@-webkit-keyframes loading-ios-H5-data-v-0af76499{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}8%{-webkit-transform:rotate(30deg);transform:rotate(30deg)}16%{-webkit-transform:rotate(60deg);transform:rotate(60deg)}24%{-webkit-transform:rotate(90deg);transform:rotate(90deg)}32%{-webkit-transform:rotate(120deg);transform:rotate(120deg)}40%{-webkit-transform:rotate(150deg);transform:rotate(150deg)}48%{-webkit-transform:rotate(180deg);transform:rotate(180deg)}56%{-webkit-transform:rotate(210deg);transform:rotate(210deg)}64%{-webkit-transform:rotate(240deg);transform:rotate(240deg)}73%{-webkit-transform:rotate(270deg);transform:rotate(270deg)}82%{-webkit-transform:rotate(300deg);transform:rotate(300deg)}91%{-webkit-transform:rotate(330deg);transform:rotate(330deg)}100%{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes loading-ios-H5-data-v-0af76499{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}8%{-webkit-transform:rotate(30deg);transform:rotate(30deg)}16%{-webkit-transform:rotate(60deg);transform:rotate(60deg)}24%{-webkit-transform:rotate(90deg);transform:rotate(90deg)}32%{-webkit-transform:rotate(120deg);transform:rotate(120deg)}40%{-webkit-transform:rotate(150deg);transform:rotate(150deg)}48%{-webkit-transform:rotate(180deg);transform:rotate(180deg)}56%{-webkit-transform:rotate(210deg);transform:rotate(210deg)}64%{-webkit-transform:rotate(240deg);transform:rotate(240deg)}73%{-webkit-transform:rotate(270deg);transform:rotate(270deg)}82%{-webkit-transform:rotate(300deg);transform:rotate(300deg)}91%{-webkit-transform:rotate(330deg);transform:rotate(330deg)}100%{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.uni-load-more__img--android-H5[data-v-0af76499]{-webkit-animation:loading-android-H5-rotate-data-v-0af76499 2s linear infinite;animation:loading-android-H5-rotate-data-v-0af76499 2s linear infinite;-webkit-transform-origin:center center;transform-origin:center center}.uni-load-more__img--android-H5 circle[data-v-0af76499]{display:inline-block;-webkit-animation:loading-android-H5-dash-data-v-0af76499 1.5s ease-in-out infinite;animation:loading-android-H5-dash-data-v-0af76499 1.5s ease-in-out infinite;stroke:currentColor;stroke-linecap:round}@-webkit-keyframes loading-android-H5-rotate-data-v-0af76499{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes loading-android-H5-rotate-data-v-0af76499{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@-webkit-keyframes loading-android-H5-dash-data-v-0af76499{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-40}100%{stroke-dasharray:90,150;stroke-dashoffset:-120}}@keyframes loading-android-H5-dash-data-v-0af76499{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-40}100%{stroke-dasharray:90,150;stroke-dashoffset:-120}}',""]),e.exports=t},"7ed6":function(e,t,n){"use strict";(function(e){n("7a82");var r=n("4ea4").default;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=r(n("53ca"));n("a9e3"),n("14d9"),n("d3b7"),n("b64b"),n("99af"),n("498a"),n("d81d"),n("4de4");var i={props:{localdata:{type:[Array,Object],default:function(){return[]}},spaceInfo:{type:Object,default:function(){return{}}},collection:{type:String,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},getone:{type:[Boolean,String],default:!1},gettree:{type:[Boolean,String],default:!1},manual:{type:Boolean,default:!1},value:{type:[Array,String,Number],default:function(){return[]}},modelValue:{type:[Array,String,Number],default:function(){return[]}},preload:{type:Boolean,default:!1},stepSearh:{type:Boolean,default:!0},selfField:{type:String,default:""},parentField:{type:String,default:""},multiple:{type:Boolean,default:!1},map:{type:Object,default:function(){return{text:"text",value:"value"}}}},data:function(){return{loading:!1,errorMessage:"",loadMore:{contentdown:"",contentrefresh:"",contentnomore:""},dataList:[],selected:[],selectedIndex:0,page:{current:this.pageCurrent,size:this.pageSize,count:0}}},computed:{isLocaldata:function(){return!this.collection.length},postField:function(){var e=[this.field];return this.parentField&&e.push("".concat(this.parentField," as parent_value")),e.join(",")},dataValue:function(){var e=Array.isArray(this.modelValue)?this.modelValue.length>0:null!==this.modelValue||void 0!==this.modelValue;return e?this.modelValue:this.value},hasValue:function(){return"number"===typeof this.dataValue||null!=this.dataValue&&this.dataValue.length>0}},created:function(){var e=this;this.$watch((function(){var t=[];return["pageCurrent","pageSize","spaceInfo","value","modelValue","localdata","collection","action","field","orderby","where","getont","getcount","gettree"].forEach((function(n){t.push(e[n])})),t}),(function(t,n){for(var r=2;r0&&void 0!==arguments[0]?arguments[0]:{},n=e.database(this.spaceInfo),r=t.action||this.action;r&&(n=n.action(r));var a=t.collection||this.collection;n=n.collection(a);var i=t.where||this.where;i&&Object.keys(i).length&&(n=n.where(i));var o=t.field||this.field;o&&(n=n.field(o));var s=t.orderby||this.orderby;s&&(n=n.orderBy(s));var u=void 0!==t.pageCurrent?t.pageCurrent:this.page.current,c=void 0!==t.pageSize?t.pageSize:this.page.size,l=void 0!==t.getcount?t.getcount:this.getcount,d=void 0!==t.gettree?t.gettree:this.gettree,f={getCount:l,getTree:d};return t.getTreePath&&(f.getTreePath=t.getTreePath),n=n.skip(c*(u-1)).limit(c).get(f),n},getNodeData:function(e){var t=this;this.loading||(this.loading=!0,this.getCommand({field:this.postField,where:this._pathWhere()}).then((function(n){t.loading=!1,t.selected=n.result.data,e&&e()})).catch((function(e){t.loading=!1,t.errorMessage=e})))},getTreePath:function(e){var t=this;this.loading||(this.loading=!0,this.getCommand({field:this.postField,getTreePath:{startWith:"".concat(this.selfField,"=='").concat(this.dataValue,"'")}}).then((function(n){t.loading=!1;var r=[];t._extractTreePath(n.result.data,r),t.selected=r,e&&e()})).catch((function(e){t.loading=!1,t.errorMessage=e})))},loadData:function(){var e=this;this.isLocaldata?this._processLocalData():null==this.dataValue?this.stepSearh?this._loadNodeData((function(t){e._treeData=t,e._updateBindData()})):this._loadAllData((function(t){e._treeData=[],e._extractTree(t,e._treeData,null),e._updateBindData()})):this._loadNodeData((function(t){e._treeData=t,e._updateBindData(),e._updateSelected()}))},_loadAllData:function(e){var t=this;this.loading||(this.loading=!0,this.getCommand({field:this.postField,gettree:!0,startwith:"".concat(this.selfField,"=='").concat(this.dataValue,"'")}).then((function(n){t.loading=!1,e(n.result.data),t.onDataChange()})).catch((function(e){t.loading=!1,t.errorMessage=e})))},_loadNodeData:function(e,t){var n=this;this.loading||(this.loading=!0,this.getCommand({field:this.postField,where:t||this._postWhere(),pageSize:500}).then((function(t){n.loading=!1,e(t.result.data),n.onDataChange()})).catch((function(e){n.loading=!1,n.errorMessage=e})))},_pathWhere:function(){var e=[],t=this._getParentNameByField();return t&&e.push("".concat(t," == '").concat(this.dataValue,"'")),this.where?"(".concat(this.where,") && (").concat(e.join(" || "),")"):e.join(" || ")},_postWhere:function(){var e=[],t=this.selected,n=this.parentField;if(n&&e.push("".concat(n," == null || ").concat(n,' == ""')),t.length)for(var r=0;r2&&void 0!==arguments[2]?arguments[2]:[],r=this.map.text,a=this.map.value,i=0;i>>2]>>>24-i%4*8&255;t[r+i>>>2]|=o<<24-(r+i)%4*8}else for(i=0;i>>2]=n[i>>>2];return this.sigBytes+=a,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,r=[],a=function(t){t=t;var n=987654321,r=4294967295;return function(){var a=((n=36969*(65535&n)+(n>>16)&r)<<16)+(t=18e3*(65535&t)+(t>>16)&r)&r;return a/=4294967296,(a+=.5)*(e.random()>.5?1:-1)}},i=0;i>>2]>>>24-a%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new o.init(n,t/2)}},c=s.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],a=0;a>>2]>>>24-a%4*8&255;r.push(String.fromCharCode(i))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new o.init(n,t)}},l=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},d=a.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,r=n.words,a=n.sigBytes,i=this.blockSize,s=a/(4*i),u=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*i,c=e.min(4*u,a);if(u){for(var l=0;l>>24)|4278255360&(a<<24|a>>>8)}var i=this._hash.words,o=e[t+0],u=e[t+1],h=e[t+2],p=e[t+3],g=e[t+4],v=e[t+5],m=e[t+6],y=e[t+7],k=e[t+8],b=e[t+9],w=e[t+10],x=e[t+11],_=e[t+12],A=e[t+13],S=e[t+14],I=e[t+15],T=i[0],P=i[1],C=i[2],O=i[3];T=c(T,P,C,O,o,7,s[0]),O=c(O,T,P,C,u,12,s[1]),C=c(C,O,T,P,h,17,s[2]),P=c(P,C,O,T,p,22,s[3]),T=c(T,P,C,O,g,7,s[4]),O=c(O,T,P,C,v,12,s[5]),C=c(C,O,T,P,m,17,s[6]),P=c(P,C,O,T,y,22,s[7]),T=c(T,P,C,O,k,7,s[8]),O=c(O,T,P,C,b,12,s[9]),C=c(C,O,T,P,w,17,s[10]),P=c(P,C,O,T,x,22,s[11]),T=c(T,P,C,O,_,7,s[12]),O=c(O,T,P,C,A,12,s[13]),C=c(C,O,T,P,S,17,s[14]),T=l(T,P=c(P,C,O,T,I,22,s[15]),C,O,u,5,s[16]),O=l(O,T,P,C,m,9,s[17]),C=l(C,O,T,P,x,14,s[18]),P=l(P,C,O,T,o,20,s[19]),T=l(T,P,C,O,v,5,s[20]),O=l(O,T,P,C,w,9,s[21]),C=l(C,O,T,P,I,14,s[22]),P=l(P,C,O,T,g,20,s[23]),T=l(T,P,C,O,b,5,s[24]),O=l(O,T,P,C,S,9,s[25]),C=l(C,O,T,P,p,14,s[26]),P=l(P,C,O,T,k,20,s[27]),T=l(T,P,C,O,A,5,s[28]),O=l(O,T,P,C,h,9,s[29]),C=l(C,O,T,P,y,14,s[30]),T=d(T,P=l(P,C,O,T,_,20,s[31]),C,O,v,4,s[32]),O=d(O,T,P,C,k,11,s[33]),C=d(C,O,T,P,x,16,s[34]),P=d(P,C,O,T,S,23,s[35]),T=d(T,P,C,O,u,4,s[36]),O=d(O,T,P,C,g,11,s[37]),C=d(C,O,T,P,y,16,s[38]),P=d(P,C,O,T,w,23,s[39]),T=d(T,P,C,O,A,4,s[40]),O=d(O,T,P,C,o,11,s[41]),C=d(C,O,T,P,p,16,s[42]),P=d(P,C,O,T,m,23,s[43]),T=d(T,P,C,O,b,4,s[44]),O=d(O,T,P,C,_,11,s[45]),C=d(C,O,T,P,I,16,s[46]),T=f(T,P=d(P,C,O,T,h,23,s[47]),C,O,o,6,s[48]),O=f(O,T,P,C,y,10,s[49]),C=f(C,O,T,P,S,15,s[50]),P=f(P,C,O,T,v,21,s[51]),T=f(T,P,C,O,_,6,s[52]),O=f(O,T,P,C,p,10,s[53]),C=f(C,O,T,P,w,15,s[54]),P=f(P,C,O,T,u,21,s[55]),T=f(T,P,C,O,k,6,s[56]),O=f(O,T,P,C,I,10,s[57]),C=f(C,O,T,P,m,15,s[58]),P=f(P,C,O,T,A,21,s[59]),T=f(T,P,C,O,g,6,s[60]),O=f(O,T,P,C,x,10,s[61]),C=f(C,O,T,P,h,15,s[62]),P=f(P,C,O,T,b,21,s[63]),i[0]=i[0]+T|0,i[1]=i[1]+P|0,i[2]=i[2]+C|0,i[3]=i[3]+O|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,a=8*t.sigBytes;n[a>>>5]|=128<<24-a%32;var i=e.floor(r/4294967296),o=r;n[15+(a+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),n[14+(a+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),t.sigBytes=4*(n.length+1),this._process();for(var s=this._hash,u=s.words,c=0;c<4;c++){var l=u[c];u[c]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return s},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});function c(e,t,n,r,a,i,o){var s=e+(t&n|~t&r)+a+o;return(s<>>32-i)+t}function l(e,t,n,r,a,i,o){var s=e+(t&r|n&~r)+a+o;return(s<>>32-i)+t}function d(e,t,n,r,a,i,o){var s=e+(t^n^r)+a+o;return(s<>>32-i)+t}function f(e,t,n,r,a,i,o){var s=e+(n^(t|~r))+a+o;return(s<>>32-i)+t}t.MD5=i._createHelper(u),t.HmacMD5=i._createHmacHelper(u)}(Math),n.MD5)})),k((function(e,t){var n;e.exports=(n=w,void function(){var e=n,t=e.lib.Base,r=e.enc.Utf8;e.algo.HMAC=t.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=r.parse(t));var n=e.blockSize,a=4*n;t.sigBytes>a&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),o=this._iKey=t.clone(),s=i.words,u=o.words,c=0;c>>6-o%4*2;a[i>>>2]|=(s|u)<<24-i%4*8,i++}return t.create(a,i)}e.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp();for(var a=[],i=0;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,s=0;s<4&&i+.75*s>>6*(3-s)&63));var u=r.charAt(64);if(u)for(;a.length%4;)a.push(u);return a.join("")},parse:function(e){var t=e.length,n=this._map,a=this._reverseMap;if(!a){a=this._reverseMap=[];for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:{},n=t.createPromise,r=t.retryRule,a=void 0===r?R:r;(0,g.default)(this,e),this.createPromise=n,this.status=null,this.promise=null,this.retryRule=a}return(0,v.default)(e,[{key:"needRetry",get:function(){if(!this.status)return!0;switch(this.retryRule){case R:return this.status===C;case M:return this.status!==T}}},{key:"exec",value:function(){var e=this;return this.needRetry?(this.status=T,this.promise=this.createPromise().then((function(t){return e.status=P,Promise.resolve(t)}),(function(t){return e.status=C,Promise.reject(t)})),this.promise):this.promise}}]),e}();function N(e){return function(t){return new Promise((function(n,r){uni[e]((0,p.default)((0,p.default)({},t),{},{success:function(e){n(e)},fail:function(e){r(e)}}))}))}}function F(e){return e&&"string"==typeof e?JSON.parse(e):e}var j=F([]),B="web",J=(F(void 0),F([])||[]);try{(n("4f5b").default||n("4f5b")).appid}catch(Gn){}var q={};function V(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t=q,n=e,Object.prototype.hasOwnProperty.call(t,n)||(q[e]=r),q[e]}"app"===B&&(q=uni._globalUniCloudObj?uni._globalUniCloudObj:uni._globalUniCloudObj={});var W=["invoke","success","fail","complete"],H=V("_globalUniCloudInterceptor");function z(e,t){H[e]||(H[e]={}),E(t)&&Object.keys(t).forEach((function(n){W.indexOf(n)>-1&&function(e,t,n){var r=H[e][t];r||(r=H[e][t]=[]),-1===r.indexOf(n)&&D(n)&&r.push(n)}(e,n,t[n])}))}function K(e,t){H[e]||(H[e]={}),E(t)?Object.keys(t).forEach((function(n){W.indexOf(n)>-1&&function(e,t,n){var r=H[e][t];if(r){var a=r.indexOf(n);a>-1&&r.splice(a,1)}}(e,n,t[n])})):delete H[e]}function Q(e,t){return e&&0!==e.length?e.reduce((function(e,n){return e.then((function(){return n(t)}))}),Promise.resolve()):Promise.resolve()}function Y(e,t){return H[e]&&H[e][t]||[]}function G(e){z("callObject",e)}var Z=V("_globalUniCloudListener"),X="response",$="needLogin",ee="refreshToken",te="clientdb",ne="cloudfunction",re="cloudobject";function ae(e){return Z[e]||(Z[e]=[]),Z[e]}function ie(e,t){var n=ae(e);n.includes(t)||n.push(t)}function oe(e,t){var n=ae(e),r=n.indexOf(t);-1!==r&&n.splice(r,1)}function se(e,t){for(var n=ae(e),r=0;r0&&void 0!==arguments[0]?arguments[0]: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}}}]),n}((0,h.default)(Error)),ge={request:function(e){return uni.request(e)},uploadFile:function(e){return uni.uploadFile(e)},setStorageSync:function(e,t){return uni.setStorageSync(e,t)},getStorageSync:function(e){return uni.getStorageSync(e)},removeStorageSync:function(e){return uni.removeStorageSync(e)},clearStorageSync:function(){return uni.clearStorageSync()}};function ve(){return{token:ge.getStorageSync("uni_id_token")||ge.getStorageSync("uniIdToken"),tokenExpired:ge.getStorageSync("uni_id_token_expired")}}function me(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.token,n=e.tokenExpired;t&&ge.setStorageSync("uni_id_token",t),n&&ge.setStorageSync("uni_id_token_expired",n)}function ye(){return fe||(fe=uni.getSystemInfoSync()),fe}function ke(){var e=uni.getLocale&&uni.getLocale()||"en";if(he)return(0,p.default)((0,p.default)({},he),{},{locale:e,LOCALE:e});for(var t=ye(),n=t.deviceId,r=t.osName,a=t.uniPlatform,i=t.appId,o=["pixelRatio","brand","model","system","language","version","platform","host","SDKVersion","swanNativeVersion","app","AppPlatform","fontSizeSetting"],s=0;s-1)return;var n=uni.getLaunchOptionsSync(),r=n.scene,a=n.channel;e=a,t=r}}catch(e){}return{channel:e,scene:t}}()),t),(0,p.default)((0,p.default)({},he),{},{locale:e,LOCALE:e})}var be,we={sign:function(e,t){var n="";return Object.keys(e).sort().forEach((function(t){e[t]&&(n=n+"&"+t+"="+e[t])})),n=n.slice(1),x(n,t).toString()},wrappedRequest:function(e,t){return new Promise((function(n,r){t(Object.assign(e,{complete:function(e){e||(e={});var 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 r(new pe({code:"SYS_ERR",message:e.errMsg||"request:fail",requestId:t}));var a=e.data;if(a.error)return r(new pe({code:a.error.code,message:a.error.message,requestId:t}));a.result=a.data,a.requestId=t,delete a.data,n(a)}}))}))},toBase64:function(e){return A.stringify(_.parse(e))}},xe={"uniCloud.init.paramRequired":"{param} required","uniCloud.uploadFile.fileError":"filePath should be instance of File"},_e=(0,m.initVueI18n)({"zh-Hans":{"uniCloud.init.paramRequired":"缺少参数:{param}","uniCloud.uploadFile.fileError":"filePath应为File对象"},"zh-Hant":{"uniCloud.init.paramRequired":"缺少参数:{param}","uniCloud.uploadFile.fileError":"filePath应为File对象"},en:xe,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:xe},"zh-Hans"),Ae=_e.t,Se=function(){function e(t){var n=this;(0,g.default)(this,e),["spaceId","clientSecret"].forEach((function(e){if(!Object.prototype.hasOwnProperty.call(t,e))throw new Error(Ae("uniCloud.init.paramRequired",{param:e}))})),this.config=Object.assign({},{endpoint:0===t.spaceId.indexOf("mp-")?"https://api.next.bspapp.com":"https://api.bspapp.com"},t),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=ge,this._getAccessTokenPromiseHub=new U({createPromise:function(){return n.requestAuth(n.setupRequest({method:"serverless.auth.user.anonymousAuthorize",params:"{}"},"auth")).then((function(e){if(!e.result||!e.result.accessToken)throw new pe({code:"AUTH_FAILED",message:"获取accessToken失败"});n.setAccessToken(e.result.accessToken)}))},retryRule:M})}return(0,v.default)(e,[{key:"hasAccessToken",get:function(){return!!this.accessToken}},{key:"setAccessToken",value:function(e){this.accessToken=e}},{key:"requestWrapped",value:function(e){return we.wrappedRequest(e,this.adapter.request)}},{key:"requestAuth",value:function(e){return this.requestWrapped(e)}},{key:"request",value:function(e,t){var n=this;return Promise.resolve().then((function(){return n.hasAccessToken?t?n.requestWrapped(e):n.requestWrapped(e).catch((function(t){return new Promise((function(e,n){!t||"GATEWAY_INVALID_TOKEN"!==t.code&&"InvalidParameter.InvalidToken"!==t.code?n(t):e()})).then((function(){return n.getAccessToken()})).then((function(){var t=n.rebuildRequest(e);return n.request(t,!0)}))})):n.getAccessToken().then((function(){var t=n.rebuildRequest(e);return n.request(t,!0)}))}))}},{key:"rebuildRequest",value:function(e){var t=Object.assign({},e);return t.data.token=this.accessToken,t.header["x-basement-token"]=this.accessToken,t.header["x-serverless-sign"]=we.sign(t.data,this.config.clientSecret),t}},{key:"setupRequest",value:function(e,t){var n=Object.assign({},e,{spaceId:this.config.spaceId,timestamp:Date.now()}),r={"Content-Type":"application/json"};return"auth"!==t&&(n.token=this.accessToken,r["x-basement-token"]=this.accessToken),r["x-serverless-sign"]=we.sign(n,this.config.clientSecret),{url:this.config.requestUrl,method:"POST",data:n,dataType:"json",header:r}}},{key:"getAccessToken",value:function(){return this._getAccessTokenPromiseHub.exec()}},{key:"authorize",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(){return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this.getAccessToken();case 2:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"callFunction",value:function(e){var t={method:"serverless.function.runtime.invoke",params:JSON.stringify({functionTarget:e.name,functionArgs:e.data||{}})};return this.request(this.setupRequest(t))}},{key:"getOSSUploadOptionsFromPath",value:function(e){var t={method:"serverless.file.resource.generateProximalSign",params:JSON.stringify(e)};return this.request(this.setupRequest(t))}},{key:"uploadFileToOSS",value:function(e){var t=this,n=e.url,r=e.formData,a=e.name,i=e.filePath,o=e.fileType,s=e.onUploadProgress;return new Promise((function(e,u){var c=t.adapter.uploadFile({url:n,formData:r,name:a,filePath:i,fileType:o,header:{"X-OSS-server-side-encrpytion":"AES256"},success:function(t){t&&t.statusCode<400?e(t):u(new pe({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail:function(e){u(new pe({code:e.code||"UPLOAD_FAILED",message:e.message||e.errMsg||"文件上传失败"}))}});"function"==typeof s&&c&&"function"==typeof c.onProgressUpdate&&c.onProgressUpdate((function(e){s({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend})}))}))}},{key:"reportOSSUpload",value:function(e){var t={method:"serverless.file.resource.report",params:JSON.stringify(e)};return this.request(this.setupRequest(t))}},{key:"uploadFile",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(t){var n,r,a,i,o,s,u,l,d,f,h,p,g,v,m,y,k,b,w,x;return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(n=t.filePath,r=t.cloudPath,a=t.fileType,i=void 0===a?"image":a,o=t.onUploadProgress,s=t.config,"string"===O(r)){e.next=3;break}throw new pe({code:"INVALID_PARAM",message:"cloudPath必须为字符串类型"});case 3:if(r=r.trim()){e.next=5;break}throw new pe({code:"CLOUDPATH_REQUIRED",message:"cloudPath不可为空"});case 5:if(!/:\/\//.test(r)){e.next=7;break}throw new pe({code:"INVALID_PARAM",message:"cloudPath不合法"});case 7:return u=s&&s.envType||this.config.envType,e.next=10,this.getOSSUploadOptionsFromPath({env:u,filename:r});case 10:return l=e.sent.result,d="https://"+l.cdnDomain+"/"+l.ossPath,f=l.securityToken,h=l.accessKeyId,p=l.signature,g=l.host,v=l.ossPath,m=l.id,y=l.policy,k=l.ossCallbackUrl,b={"Cache-Control":"max-age=2592000","Content-Disposition":"attachment",OSSAccessKeyId:h,Signature:p,host:g,id:m,key:v,policy:y,success_action_status:200},f&&(b["x-oss-security-token"]=f),k&&(w=JSON.stringify({callbackUrl:k,callbackBody:JSON.stringify({fileId:m,spaceId:this.config.spaceId}),callbackBodyType:"application/json"}),b.callback=we.toBase64(w)),x={url:"https://"+l.host,formData:b,fileName:"file",name:"file",filePath:n,fileType:i},e.next=25,this.uploadFileToOSS(Object.assign({},x,{onUploadProgress:o}));case 25:if(!k){e.next=27;break}return e.abrupt("return",{success:!0,filePath:n,fileID:d});case 27:return e.next=29,this.reportOSSUpload({id:m});case 29:if(!e.sent.success){e.next=31;break}return e.abrupt("return",{success:!0,filePath:n,fileID:d});case 31:throw new pe({code:"UPLOAD_FAILED",message:"文件上传失败"});case 32:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"getTempFileURL",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.fileList;return new Promise((function(e,n){Array.isArray(t)&&0!==t.length||n(new pe({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"})),e({fileList:t.map((function(e){return{fileID:e,tempFileURL:e}}))})}))}},{key:"getFileInfo",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(){var t,n,r,a=arguments;return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(t=a.length>0&&void 0!==a[0]?a[0]:{},n=t.fileList,Array.isArray(n)&&0!==n.length){e.next=3;break}throw new pe({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"});case 3:return r={method:"serverless.file.resource.info",params:JSON.stringify({id:n.map((function(e){return e.split("?")[0]})).join(",")})},e.next=6,this.request(this.setupRequest(r));case 6:return e.t0=e.sent.result,e.abrupt("return",{fileList:e.t0});case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()}]),e}(),Ie={init:function(e){var t=new Se(e),n={signInAnonymously:function(){return t.authorize()},getLoginState:function(){return Promise.resolve(!1)}};return t.auth=function(){return n},t.customAuth=t.auth,t}},Te="undefined"!=typeof location&&"http:"===location.protocol?"http:":"https:";!function(e){e.local="local",e.none="none",e.session="session"}(be||(be={}));var Pe,Ce=function(){},Oe=function(){var e;if(!Promise){e=function(){},e.promise={};var t=function(){throw new pe({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}var n=new Promise((function(t,n){e=function(e,r){return e?n(e):t(r)}}));return e.promise=n,e};function Ee(e){return void 0===e}function De(e){return"[object Null]"===Object.prototype.toString.call(e)}!function(e){e.WEB="web",e.WX_MP="wx_mp"}(Pe||(Pe={}));var Le={adapter:null,runtime:void 0},Re=["anonymousUuidKey"],Me=function(e){(0,d.default)(n,e);var t=(0,f.default)(n);function n(){var e;return(0,g.default)(this,n),e=t.call(this),Le.adapter.root.tcbObject||(Le.adapter.root.tcbObject={}),e}return(0,v.default)(n,[{key:"setItem",value:function(e,t){Le.adapter.root.tcbObject[e]=t}},{key:"getItem",value:function(e){return Le.adapter.root.tcbObject[e]}},{key:"removeItem",value:function(e){delete Le.adapter.root.tcbObject[e]}},{key:"clear",value:function(){delete Le.adapter.root.tcbObject}}]),n}(Ce);function Ue(e,t){switch(e){case"local":return t.localStorage||new Me;case"none":return new Me;default:return t.sessionStorage||new Me}}var Ne=function(){function e(t){if((0,g.default)(this,e),!this._storage){this._persistence=Le.adapter.primaryStorage||t.persistence,this._storage=Ue(this._persistence,Le.adapter);var n="access_token_".concat(t.env),r="access_token_expire_".concat(t.env),a="refresh_token_".concat(t.env),i="anonymous_uuid_".concat(t.env),o="login_type_".concat(t.env),s="user_info_".concat(t.env);this.keys={accessTokenKey:n,accessTokenExpireKey:r,refreshTokenKey:a,anonymousUuidKey:i,loginTypeKey:o,userInfoKey:s}}}return(0,v.default)(e,[{key:"updatePersistence",value:function(e){if(e!==this._persistence){var t="local"===this._persistence;this._persistence=e;var n=Ue(e,Le.adapter);for(var r in this.keys){var a=this.keys[r];if(!t||!Re.includes(r)){var i=this._storage.getItem(a);Ee(i)||De(i)||(n.setItem(a,i),this._storage.removeItem(a))}}this._storage=n}}},{key:"setStore",value:function(e,t,n){if(this._storage){var r={version:n||"localCachev1",content:t},a=JSON.stringify(r);try{this._storage.setItem(e,a)}catch(e){throw e}}}},{key:"getStore",value:function(e,t){try{if(!this._storage)return}catch(e){return""}t=t||"localCachev1";var n=this._storage.getItem(e);return n&&n.indexOf(t)>=0?JSON.parse(n).content:""}},{key:"removeStore",value:function(e){this._storage.removeItem(e)}}]),e}(),Fe={},je={};function Be(e){return Fe[e]}var Je=(0,v.default)((function e(t,n){(0,g.default)(this,e),this.data=n||null,this.name=t})),qe=function(e){(0,d.default)(n,e);var t=(0,f.default)(n);function n(e,r){var a;return(0,g.default)(this,n),a=t.call(this,"error",{error:e,data:r}),a.error=e,a}return(0,v.default)(n)}(Je),Ve=new(function(){function e(){(0,g.default)(this,e),this._listeners={}}return(0,v.default)(e,[{key:"on",value:function(e,t){return function(e,t,n){n[e]=n[e]||[],n[e].push(t)}(e,t,this._listeners),this}},{key:"off",value:function(e,t){return function(e,t,n){if(n&&n[e]){var r=n[e].indexOf(t);-1!==r&&n[e].splice(r,1)}}(e,t,this._listeners),this}},{key:"fire",value:function(e,t){if(e instanceof qe)return console.error(e.error),this;var n="string"==typeof e?new Je(e,t||{}):e,r=n.name;if(this._listens(r)){n.target=this;var a,i=this._listeners[r]?(0,s.default)(this._listeners[r]):[],o=(0,u.default)(i);try{for(o.s();!(a=o.n()).done;){var c=a.value;c.call(this,n)}}catch(l){o.e(l)}finally{o.f()}}return this}},{key:"_listens",value:function(e){return this._listeners[e]&&this._listeners[e].length>0}}]),e}());function We(e,t){Ve.on(e,t)}function He(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ve.fire(e,t)}function ze(e,t){Ve.off(e,t)}var Ke,Qe="loginStateChanged",Ye="loginStateExpire",Ge="loginTypeChanged",Ze="anonymousConverted",Xe="refreshAccessToken";!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"}(Ke||(Ke={}));var $e=["auth.getJwt","auth.logout","auth.signInWithTicket","auth.signInAnonymously","auth.signIn","auth.fetchAccessTokenWithRefreshToken","auth.signUpWithEmailAndPassword","auth.activateEndUserMail","auth.sendPasswordResetEmail","auth.resetPasswordWithToken","auth.isUsernameRegistered"],et={"X-SDK-Version":"1.3.5"};function tt(e,t,n){var r=e[t];e[t]=function(t){var a={},i={};n.forEach((function(n){var r=n.call(e,t),o=r.data,s=r.headers;Object.assign(a,o),Object.assign(i,s)}));var o=t.data;return o&&function(){var e;if(e=o,"[object FormData]"!==Object.prototype.toString.call(e))t.data=(0,p.default)((0,p.default)({},o),a);else for(var n in a)o.append(n,a[n])}(),t.headers=(0,p.default)((0,p.default)({},t.headers||{}),i),r.call(e,t)}}function nt(){var e=Math.random().toString(16).slice(2);return{data:{seqId:e},headers:(0,p.default)((0,p.default)({},et),{},{"x-seqid":e})}}var rt=function(){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,g.default)(this,e),this.config=n,this._reqClass=new Le.adapter.reqClass({timeout:this.config.timeout,timeoutMsg:"请求在".concat(this.config.timeout/1e3,"s内未完成,已中断"),restrictedMethods:["post"]}),this._cache=Be(this.config.env),this._localCache=(t=this.config.env,je[t]),tt(this._reqClass,"post",[nt]),tt(this._reqClass,"upload",[nt]),tt(this._reqClass,"download",[nt])}return(0,v.default)(e,[{key:"post",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(t){return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this._reqClass.post(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"upload",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(t){return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this._reqClass.upload(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"download",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(t){return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this._reqClass.download(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"refreshAccessToken",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(){var t,n;return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return this._refreshAccessTokenPromise||(this._refreshAccessTokenPromise=this._refreshAccessToken()),e.prev=1,e.next=4,this._refreshAccessTokenPromise;case 4:t=e.sent,e.next=10;break;case 7:e.prev=7,e.t0=e["catch"](1),n=e.t0;case 10:if(this._refreshAccessTokenPromise=null,this._shouldRefreshAccessTokenHook=null,!n){e.next=12;break}throw n;case 12:return e.abrupt("return",t);case 13:case"end":return e.stop()}}),e,this,[[1,7]])})));return function(){return e.apply(this,arguments)}}()},{key:"_refreshAccessToken",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(){var t,n,r,a,i,o,s,u,l,d,f,h,p;return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(t=this._cache.keys,n=t.accessTokenKey,r=t.accessTokenExpireKey,a=t.refreshTokenKey,i=t.loginTypeKey,o=t.anonymousUuidKey,this._cache.removeStore(n),this._cache.removeStore(r),s=this._cache.getStore(a),s){e.next=5;break}throw new pe({message:"未登录CloudBase"});case 5:return u={refresh_token:s},e.next=8,this.request("auth.fetchAccessTokenWithRefreshToken",u);case 8:if(l=e.sent,!l.data.code){e.next=21;break}if(d=l.data.code,"SIGN_PARAM_INVALID"!==d&&"REFRESH_TOKEN_EXPIRED"!==d&&"INVALID_REFRESH_TOKEN"!==d){e.next=20;break}if(this._cache.getStore(i)!==Ke.ANONYMOUS||"INVALID_REFRESH_TOKEN"!==d){e.next=19;break}return f=this._cache.getStore(o),h=this._cache.getStore(a),e.next=17,this.send("auth.signInAnonymously",{anonymous_uuid:f,refresh_token:h});case 17:return p=e.sent,e.abrupt("return",(this.setRefreshToken(p.refresh_token),this._refreshAccessToken()));case 19:He(Ye),this._cache.removeStore(a);case 20:throw new pe({code:l.data.code,message:"刷新access token失败:".concat(l.data.code)});case 21:if(!l.data.access_token){e.next=23;break}return e.abrupt("return",(He(Xe),this._cache.setStore(n,l.data.access_token),this._cache.setStore(r,l.data.access_token_expire+Date.now()),{accessToken:l.data.access_token,accessTokenExpire:l.data.access_token_expire}));case 23:l.data.refresh_token&&(this._cache.removeStore(a),this._cache.setStore(a,l.data.refresh_token),this._refreshAccessToken());case 24:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"getAccessToken",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(){var t,n,r,a,i,o,s;return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(t=this._cache.keys,n=t.accessTokenKey,r=t.accessTokenExpireKey,a=t.refreshTokenKey,this._cache.getStore(a)){e.next=3;break}throw new pe({message:"refresh token不存在,登录状态异常"});case 3:if(i=this._cache.getStore(n),o=this._cache.getStore(r),s=!0,e.t0=this._shouldRefreshAccessTokenHook,!e.t0){e.next=9;break}return e.next=8,this._shouldRefreshAccessTokenHook(i,o);case 8:e.t0=!e.sent;case 9:if(e.t1=e.t0,!e.t1){e.next=12;break}s=!1;case 12:return e.abrupt("return",(!i||!o||o2&&void 0!==arguments[2]?arguments[2]:{},r=/\?/.test(t),a="";for(var i in n)""===a?!r&&(t+="?"):a+="&",a+="".concat(i,"=").concat(encodeURIComponent(n[i]));return/^http(s)?\:\/\//.test(t+=a)?t:"".concat(e).concat(t)}(Te,"//tcb-api.tencentcloudapi.com/web",y),m&&(k+=m),e.next=22,this.post((0,p.default)({url:k,data:u},f));case 22:if(b=e.sent,w=b.header&&b.header["x-tcb-trace"],w&&this._localCache.setStore(a,w),(200===Number(b.status)||200===Number(b.statusCode))&&b.data){e.next=26;break}throw new pe({code:"NETWORK_ERROR",message:"network request error"});case 26:return e.abrupt("return",b);case 27:case"end":return e.stop()}}),e,this)})));return function(t,n,r){return e.apply(this,arguments)}}()},{key:"send",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(t){var n,r,a,i=arguments;return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return n=i.length>1&&void 0!==i[1]?i[1]:{},e.next=3,this.request(t,n,{onUploadProgress:n.onUploadProgress});case 3:if(r=e.sent,"ACCESS_TOKEN_EXPIRED"!==r.data.code||-1!==$e.indexOf(t)){e.next=13;break}return e.next=7,this.refreshAccessToken();case 7:return e.next=9,this.request(t,n,{onUploadProgress:n.onUploadProgress});case 9:if(a=e.sent,!a.data.code){e.next=12;break}throw new pe({code:a.data.code,message:a.data.message});case 12:return e.abrupt("return",a.data);case 13:if(!r.data.code){e.next=15;break}throw new pe({code:r.data.code,message:r.data.message});case 15:return e.abrupt("return",r.data);case 16:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"setRefreshToken",value:function(e){var t=this._cache.keys,n=t.accessTokenKey,r=t.accessTokenExpireKey,a=t.refreshTokenKey;this._cache.removeStore(n),this._cache.removeStore(r),this._cache.setStore(a,e)}}]),e}(),at={};function it(e){return at[e]}var ot=function(){function e(t){(0,g.default)(this,e),this.config=t,this._cache=Be(t.env),this._request=it(t.env)}return(0,v.default)(e,[{key:"setRefreshToken",value:function(e){var t=this._cache.keys,n=t.accessTokenKey,r=t.accessTokenExpireKey,a=t.refreshTokenKey;this._cache.removeStore(n),this._cache.removeStore(r),this._cache.setStore(a,e)}},{key:"setAccessToken",value:function(e,t){var n=this._cache.keys,r=n.accessTokenKey,a=n.accessTokenExpireKey;this._cache.setStore(r,e),this._cache.setStore(a,t)}},{key:"refreshUserInfo",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(){var t,n;return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this._request.send("auth.getUserInfo",{});case 2:return t=e.sent,n=t.data,e.abrupt("return",(this.setLocalUserInfo(n),n));case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"setLocalUserInfo",value:function(e){var t=this._cache.keys.userInfoKey;this._cache.setStore(t,e)}}]),e}(),st=function(){function e(t){if((0,g.default)(this,e),!t)throw new pe({code:"PARAM_ERROR",message:"envId is not defined"});this._envId=t,this._cache=Be(this._envId),this._request=it(this._envId),this.setUserInfo()}return(0,v.default)(e,[{key:"linkWithTicket",value:function(e){if("string"!=typeof e)throw new pe({code:"PARAM_ERROR",message:"ticket must be string"});return this._request.send("auth.linkWithTicket",{ticket:e})}},{key:"linkWithRedirect",value:function(e){e.signInWithRedirect()}},{key:"updatePassword",value:function(e,t){return this._request.send("auth.updatePassword",{oldPassword:t,newPassword:e})}},{key:"updateEmail",value:function(e){return this._request.send("auth.updateEmail",{newEmail:e})}},{key:"updateUsername",value:function(e){if("string"!=typeof e)throw new pe({code:"PARAM_ERROR",message:"username must be a string"});return this._request.send("auth.updateUsername",{username:e})}},{key:"getLinkedUidList",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(){var t,n,r,a;return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this._request.send("auth.getLinkedUidList",{});case 2:return t=e.sent,n=t.data,r=!1,a=n.users,e.abrupt("return",(a.forEach((function(e){e.wxOpenId&&e.wxPublicId&&(r=!0)})),{users:a,hasPrimaryUid:r}));case 7:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"setPrimaryUid",value:function(e){return this._request.send("auth.setPrimaryUid",{uid:e})}},{key:"unlink",value:function(e){return this._request.send("auth.unlink",{platform:e})}},{key:"update",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(t){var n,r,a,i,o,s,u,l;return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return n=t.nickName,r=t.gender,a=t.avatarUrl,i=t.province,o=t.country,s=t.city,e.next=8,this._request.send("auth.updateUserInfo",{nickName:n,gender:r,avatarUrl:a,province:i,country:o,city:s});case 8:u=e.sent,l=u.data,this.setLocalUserInfo(l);case 11:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"refresh",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(){var t,n;return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this._request.send("auth.getUserInfo",{});case 2:return t=e.sent,n=t.data,e.abrupt("return",(this.setLocalUserInfo(n),n));case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"setUserInfo",value:function(){var e=this,t=this._cache.keys.userInfoKey,n=this._cache.getStore(t);["uid","loginType","openid","wxOpenId","wxPublicId","unionId","qqMiniOpenId","email","hasPassword","customUserId","nickName","gender","avatarUrl"].forEach((function(t){e[t]=n[t]})),this.location={country:n.country,province:n.province,city:n.city}}},{key:"setLocalUserInfo",value:function(e){var t=this._cache.keys.userInfoKey;this._cache.setStore(t,e),this.setUserInfo()}}]),e}(),ut=function(){function e(t){if((0,g.default)(this,e),!t)throw new pe({code:"PARAM_ERROR",message:"envId is not defined"});this._cache=Be(t);var n=this._cache.keys,r=n.refreshTokenKey,a=n.accessTokenKey,i=n.accessTokenExpireKey,o=this._cache.getStore(r),s=this._cache.getStore(a),u=this._cache.getStore(i);this.credential={refreshToken:o,accessToken:s,accessTokenExpire:u},this.user=new st(t)}return(0,v.default)(e,[{key:"isAnonymousAuth",get:function(){return this.loginType===Ke.ANONYMOUS}},{key:"isCustomAuth",get:function(){return this.loginType===Ke.CUSTOM}},{key:"isWeixinAuth",get:function(){return this.loginType===Ke.WECHAT||this.loginType===Ke.WECHAT_OPEN||this.loginType===Ke.WECHAT_PUBLIC}},{key:"loginType",get:function(){return this._cache.getStore(this._cache.keys.loginTypeKey)}}]),e}(),ct=function(e){(0,d.default)(n,e);var t=(0,f.default)(n);function n(){return(0,g.default)(this,n),t.apply(this,arguments)}return(0,v.default)(n,[{key:"signIn",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(){var t,n,r,a,i,o,s;return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return this._cache.updatePersistence("local"),t=this._cache.keys,n=t.anonymousUuidKey,r=t.refreshTokenKey,a=this._cache.getStore(n)||void 0,i=this._cache.getStore(r)||void 0,e.next=8,this._request.send("auth.signInAnonymously",{anonymous_uuid:a,refresh_token:i});case 8:if(o=e.sent,!o.uuid||!o.refresh_token){e.next=20;break}return this._setAnonymousUUID(o.uuid),this.setRefreshToken(o.refresh_token),e.next=14,this._request.refreshAccessToken();case 14:return He(Qe),He(Ge,{env:this.config.env,loginType:Ke.ANONYMOUS,persistence:"local"}),s=new ut(this.config.env),e.next=19,s.user.refresh();case 19:return e.abrupt("return",s);case 20:throw new pe({message:"匿名登录失败"});case 21:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"linkAndRetrieveDataWithTicket",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(t){var n,r,a,i,o,s;return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return n=this._cache.keys,r=n.anonymousUuidKey,a=n.refreshTokenKey,i=this._cache.getStore(r),o=this._cache.getStore(a),e.next=7,this._request.send("auth.linkAndRetrieveDataWithTicket",{anonymous_uuid:i,refresh_token:o,ticket:t});case 7:if(s=e.sent,!s.refresh_token){e.next=16;break}return this._clearAnonymousUUID(),this.setRefreshToken(s.refresh_token),e.next=13,this._request.refreshAccessToken();case 13:return He(Ze,{env:this.config.env}),He(Ge,{loginType:Ke.CUSTOM,persistence:"local"}),e.abrupt("return",{credential:{refreshToken:s.refresh_token}});case 16:throw new pe({message:"匿名转化失败"});case 17:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"_setAnonymousUUID",value:function(e){var t=this._cache.keys,n=t.anonymousUuidKey,r=t.loginTypeKey;this._cache.removeStore(n),this._cache.setStore(n,e),this._cache.setStore(r,Ke.ANONYMOUS)}},{key:"_clearAnonymousUUID",value:function(){this._cache.removeStore(this._cache.keys.anonymousUuidKey)}}]),n}(ot),lt=function(e){(0,d.default)(n,e);var t=(0,f.default)(n);function n(){return(0,g.default)(this,n),t.apply(this,arguments)}return(0,v.default)(n,[{key:"signIn",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(t){var n,r;return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if("string"==typeof t){e.next=2;break}throw new pe({code:"PARAM_ERROR",message:"ticket must be a string"});case 2:return n=this._cache.keys.refreshTokenKey,e.next=5,this._request.send("auth.signInWithTicket",{ticket:t,refresh_token:this._cache.getStore(n)||""});case 5:if(r=e.sent,!r.refresh_token){e.next=15;break}return this.setRefreshToken(r.refresh_token),e.next=10,this._request.refreshAccessToken();case 10:return He(Qe),He(Ge,{env:this.config.env,loginType:Ke.CUSTOM,persistence:this.config.persistence}),e.next=14,this.refreshUserInfo();case 14:return e.abrupt("return",new ut(this.config.env));case 15:throw new pe({message:"自定义登录失败"});case 16:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()}]),n}(ot),dt=function(e){(0,d.default)(n,e);var t=(0,f.default)(n);function n(){return(0,g.default)(this,n),t.apply(this,arguments)}return(0,v.default)(n,[{key:"signIn",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(t,n){var r,a,i,o,s;return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if("string"==typeof t){e.next=2;break}throw new pe({code:"PARAM_ERROR",message:"email must be a string"});case 2:return r=this._cache.keys.refreshTokenKey,e.next=5,this._request.send("auth.signIn",{loginType:"EMAIL",email:t,password:n,refresh_token:this._cache.getStore(r)||""});case 5:if(a=e.sent,i=a.refresh_token,o=a.access_token,s=a.access_token_expire,!i){e.next=22;break}if(this.setRefreshToken(i),!o||!s){e.next=15;break}this.setAccessToken(o,s),e.next=17;break;case 15:return e.next=17,this._request.refreshAccessToken();case 17:return e.next=19,this.refreshUserInfo();case 19:return He(Qe),He(Ge,{env:this.config.env,loginType:Ke.EMAIL,persistence:this.config.persistence}),e.abrupt("return",new ut(this.config.env));case 22:throw a.code?new pe({code:a.code,message:"邮箱登录失败: ".concat(a.message)}):new pe({message:"邮箱登录失败"});case 23:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"activate",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(t){return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.abrupt("return",this._request.send("auth.activateEndUserMail",{token:t}));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"resetPasswordWithToken",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(t,n){return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.abrupt("return",this._request.send("auth.resetPasswordWithToken",{token:t,newPassword:n}));case 1:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()}]),n}(ot),ft=function(e){(0,d.default)(n,e);var t=(0,f.default)(n);function n(){return(0,g.default)(this,n),t.apply(this,arguments)}return(0,v.default)(n,[{key:"signIn",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(t,n){var r,a,i,o,s;return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if("string"==typeof t){e.next=2;break}throw new pe({code:"PARAM_ERROR",message:"username must be a string"});case 2:return"string"!=typeof n&&(n="",console.warn("password is empty")),r=this._cache.keys.refreshTokenKey,e.next=6,this._request.send("auth.signIn",{loginType:Ke.USERNAME,username:t,password:n,refresh_token:this._cache.getStore(r)||""});case 6:if(a=e.sent,i=a.refresh_token,o=a.access_token_expire,s=a.access_token,!i){e.next=23;break}if(this.setRefreshToken(i),!s||!o){e.next=16;break}this.setAccessToken(s,o),e.next=18;break;case 16:return e.next=18,this._request.refreshAccessToken();case 18:return e.next=20,this.refreshUserInfo();case 20:return He(Qe),He(Ge,{env:this.config.env,loginType:Ke.USERNAME,persistence:this.config.persistence}),e.abrupt("return",new ut(this.config.env));case 23:throw a.code?new pe({code:a.code,message:"用户名密码登录失败: ".concat(a.message)}):new pe({message:"用户名密码登录失败"});case 24:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()}]),n}(ot),ht=function(){function e(t){(0,g.default)(this,e),this.config=t,this._cache=Be(t.env),this._request=it(t.env),this._onAnonymousConverted=this._onAnonymousConverted.bind(this),this._onLoginTypeChanged=this._onLoginTypeChanged.bind(this),We(Ge,this._onLoginTypeChanged)}return(0,v.default)(e,[{key:"currentUser",get:function(){var e=this.hasLoginState();return e&&e.user||null}},{key:"loginType",get:function(){return this._cache.getStore(this._cache.keys.loginTypeKey)}},{key:"anonymousAuthProvider",value:function(){return new ct(this.config)}},{key:"customAuthProvider",value:function(){return new lt(this.config)}},{key:"emailAuthProvider",value:function(){return new dt(this.config)}},{key:"usernameAuthProvider",value:function(){return new ft(this.config)}},{key:"signInAnonymously",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(){return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.abrupt("return",new ct(this.config).signIn());case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"signInWithEmailAndPassword",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(t,n){return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.abrupt("return",new dt(this.config).signIn(t,n));case 1:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"signInWithUsernameAndPassword",value:function(e,t){return new ft(this.config).signIn(e,t)}},{key:"linkAndRetrieveDataWithTicket",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(t){return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return this._anonymousAuthProvider||(this._anonymousAuthProvider=new ct(this.config)),We(Ze,this._onAnonymousConverted),e.next=3,this._anonymousAuthProvider.linkAndRetrieveDataWithTicket(t);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"signOut",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(){var t,n,r,a,i,o;return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(this.loginType!==Ke.ANONYMOUS){e.next=2;break}throw new pe({message:"匿名用户不支持登出操作"});case 2:if(t=this._cache.keys,n=t.refreshTokenKey,r=t.accessTokenKey,a=t.accessTokenExpireKey,i=this._cache.getStore(n),i){e.next=5;break}return e.abrupt("return");case 5:return e.next=7,this._request.send("auth.logout",{refresh_token:i});case 7:return o=e.sent,e.abrupt("return",(this._cache.removeStore(n),this._cache.removeStore(r),this._cache.removeStore(a),He(Qe),He(Ge,{env:this.config.env,loginType:Ke.NULL,persistence:this.config.persistence}),o));case 9:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"signUpWithEmailAndPassword",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(t,n){return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.abrupt("return",this._request.send("auth.signUpWithEmailAndPassword",{email:t,password:n}));case 1:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"sendPasswordResetEmail",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(t){return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.abrupt("return",this._request.send("auth.sendPasswordResetEmail",{email:t}));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"onLoginStateChanged",value:function(e){var t=this;We(Qe,(function(){var n=t.hasLoginState();e.call(t,n)}));var n=this.hasLoginState();e.call(this,n)}},{key:"onLoginStateExpired",value:function(e){We(Ye,e.bind(this))}},{key:"onAccessTokenRefreshed",value:function(e){We(Xe,e.bind(this))}},{key:"onAnonymousConverted",value:function(e){We(Ze,e.bind(this))}},{key:"onLoginTypeChanged",value:function(e){var t=this;We(Ge,(function(){var n=t.hasLoginState();e.call(t,n)}))}},{key:"getAccessToken",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(){return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this._request.getAccessToken();case 2:return e.t0=e.sent.accessToken,e.t1=this.config.env,e.abrupt("return",{accessToken:e.t0,env:e.t1});case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"hasLoginState",value:function(){var e=this._cache.keys.refreshTokenKey;return this._cache.getStore(e)?new ut(this.config.env):null}},{key:"isUsernameRegistered",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(t){var n,r;return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if("string"==typeof t){e.next=2;break}throw new pe({code:"PARAM_ERROR",message:"username must be a string"});case 2:return e.next=4,this._request.send("auth.isUsernameRegistered",{username:t});case 4:return n=e.sent,r=n.data,e.abrupt("return",r&&r.isRegistered);case 7:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"getLoginState",value:function(){return Promise.resolve(this.hasLoginState())}},{key:"signInWithTicket",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(t){return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.abrupt("return",new lt(this.config).signIn(t));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"shouldRefreshAccessToken",value:function(e){this._request._shouldRefreshAccessTokenHook=e.bind(this)}},{key:"getUserInfo",value:function(){return this._request.send("auth.getUserInfo",{}).then((function(e){return e.code?e:(0,p.default)((0,p.default)({},e.data),{},{requestId:e.seqId})}))}},{key:"getAuthHeader",value:function(){var e=this._cache.keys,t=e.refreshTokenKey,n=e.accessTokenKey,r=this._cache.getStore(t);return{"x-cloudbase-credentials":this._cache.getStore(n)+"/@@/"+r}}},{key:"_onAnonymousConverted",value:function(e){var t=e.data.env;t===this.config.env&&this._cache.updatePersistence(this.config.persistence)}},{key:"_onLoginTypeChanged",value:function(e){var t=e.data,n=t.loginType,r=t.persistence,a=t.env;a===this.config.env&&(this._cache.updatePersistence(r),this._cache.setStore(this._cache.keys.loginTypeKey,n))}}]),e}(),pt=function(e,t){t=t||Oe();var n=it(this.config.env),r=e.cloudPath,a=e.filePath,i=e.onUploadProgress,o=e.fileType,s=void 0===o?"image":o;return n.send("storage.getUploadMetadata",{path:r}).then((function(e){var o=e.data,u=o.url,c=o.authorization,l=o.token,d=o.fileId,f=o.cosFileId,h=e.requestId,p={key:r,signature:c,"x-cos-meta-fileid":f,success_action_status:"201","x-cos-security-token":l};n.upload({url:u,data:p,file:a,name:r,fileType:s,onUploadProgress:i}).then((function(e){201===e.statusCode?t(null,{fileID:d,requestId:h}):t(new pe({code:"STORAGE_REQUEST_FAIL",message:"STORAGE_REQUEST_FAIL: ".concat(e.data)}))})).catch((function(e){t(e)}))})).catch((function(e){t(e)})),t.promise},gt=function(e,t){t=t||Oe();var n=it(this.config.env),r=e.cloudPath;return n.send("storage.getUploadMetadata",{path:r}).then((function(e){t(null,e)})).catch((function(e){t(e)})),t.promise},vt=function(e,t){var n=e.fileList;if(t=t||Oe(),!n||!Array.isArray(n))return{code:"INVALID_PARAM",message:"fileList必须是非空的数组"};var r,a=(0,u.default)(n);try{for(a.s();!(r=a.n()).done;){var i=r.value;if(!i||"string"!=typeof i)return{code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"}}}catch(s){a.e(s)}finally{a.f()}var o={fileid_list:n};return it(this.config.env).send("storage.batchDeleteFile",o).then((function(e){e.code?t(null,e):t(null,{fileList:e.data.delete_list,requestId:e.requestId})})).catch((function(e){t(e)})),t.promise},mt=function(e,t){var n=e.fileList;t=t||Oe(),n&&Array.isArray(n)||t(null,{code:"INVALID_PARAM",message:"fileList必须是非空的数组"});var r,a=[],i=(0,u.default)(n);try{for(i.s();!(r=i.n()).done;){var s=r.value;"object"==(0,o.default)(s)?(s.hasOwnProperty("fileID")&&s.hasOwnProperty("maxAge")||t(null,{code:"INVALID_PARAM",message:"fileList的元素必须是包含fileID和maxAge的对象"}),a.push({fileid:s.fileID,max_age:s.maxAge})):"string"==typeof s?a.push({fileid:s}):t(null,{code:"INVALID_PARAM",message:"fileList的元素必须是字符串"})}}catch(l){i.e(l)}finally{i.f()}var c={file_list:a};return it(this.config.env).send("storage.batchGetDownloadUrl",c).then((function(e){e.code?t(null,e):t(null,{fileList:e.data.download_list,requestId:e.requestId})})).catch((function(e){t(e)})),t.promise},yt=function(){var e=(0,l.default)((0,c.default)().mark((function e(t,n){var r,a,i,o;return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return r=t.fileID,e.next=3,mt.call(this,{fileList:[{fileID:r,maxAge:600}]});case 3:if(a=e.sent.fileList[0],"SUCCESS"===a.code){e.next=6;break}return e.abrupt("return",n?n(a):new Promise((function(e){e(a)})));case 6:if(i=it(this.config.env),o=a.download_url,o=encodeURI(o),n){e.next=10;break}return e.abrupt("return",i.download({url:o}));case 10:return e.t0=n,e.next=13,i.download({url:o});case 13:e.t1=e.sent,(0,e.t0)(e.t1);case 15:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}(),kt=function(e,t){var n,r=e.name,a=e.data,i=e.query,o=e.parse,s=e.search,u=t||Oe();try{n=a?JSON.stringify(a):""}catch(r){return Promise.reject(r)}if(!r)return Promise.reject(new pe({code:"PARAM_ERROR",message:"函数名不能为空"}));var c={inQuery:i,parse:o,search:s,function_name:r,request_data:n};return it(this.config.env).send("functions.invokeFunction",c).then((function(e){if(e.code)u(null,e);else{var t=e.data.response_data;if(o)u(null,{result:t,requestId:e.requestId});else try{t=JSON.parse(e.data.response_data),u(null,{result:t,requestId:e.requestId})}catch(e){u(new pe({message:"response data must be json"}))}}return u.promise})).catch((function(e){u(e)})),u.promise},bt={timeout:15e3,persistence:"session"},wt={},xt=function(){function e(t){(0,g.default)(this,e),this.config=t||this.config,this.authObj=void 0}return(0,v.default)(e,[{key:"init",value:function(t){switch(Le.adapter||(this.requestClient=new Le.adapter.reqClass({timeout:t.timeout||5e3,timeoutMsg:"请求在".concat((t.timeout||5e3)/1e3,"s内未完成,已中断")})),this.config=(0,p.default)((0,p.default)({},bt),t),!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 e(this.config)}},{key:"auth",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.persistence;if(this.authObj)return this.authObj;var n,r=t||Le.adapter.primaryStorage||bt.persistence;return r!==this.config.persistence&&(this.config.persistence=r),function(e){var t=e.env;Fe[t]=new Ne(e),je[t]=new Ne((0,p.default)((0,p.default)({},e),{},{persistence:"local"}))}(this.config),n=this.config,at[n.env]=new rt(n),this.authObj=new ht(this.config),this.authObj}},{key:"on",value:function(e,t){return We.apply(this,[e,t])}},{key:"off",value:function(e,t){return ze.apply(this,[e,t])}},{key:"callFunction",value:function(e,t){return kt.apply(this,[e,t])}},{key:"deleteFile",value:function(e,t){return vt.apply(this,[e,t])}},{key:"getTempFileURL",value:function(e,t){return mt.apply(this,[e,t])}},{key:"downloadFile",value:function(e,t){return yt.apply(this,[e,t])}},{key:"uploadFile",value:function(e,t){return pt.apply(this,[e,t])}},{key:"getUploadMetadata",value:function(e,t){return gt.apply(this,[e,t])}},{key:"registerExtension",value:function(e){wt[e.name]=e}},{key:"invokeExtension",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(t,n){var r;return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(r=wt[t],r){e.next=3;break}throw new pe({message:"扩展".concat(t," 必须先注册")});case 3:return e.next=5,r.invoke(n,this);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"useAdapters",value:function(e){var t=function(e){var t,n,r=(t=e,"[object Array]"===Object.prototype.toString.call(t)?e:[e]),a=(0,u.default)(r);try{for(a.s();!(n=a.n()).done;){var i=n.value,o=i.isMatch,s=i.genAdapter,c=i.runtime;if(o())return{adapter:s(),runtime:c}}}catch(l){a.e(l)}finally{a.f()}}(e)||{},n=t.adapter,r=t.runtime;n&&(Le.adapter=n),r&&(Le.runtime=r)}}]),e}(),_t=new xt;function At(e,t,n){void 0===n&&(n={});var r=/\?/.test(t),a="";for(var i in n)""===a?!r&&(t+="?"):a+="&",a+=i+"="+encodeURIComponent(n[i]);return/^http(s)?:\/\//.test(t+=a)?t:""+e+t}var St=function(){function e(){(0,g.default)(this,e)}return(0,v.default)(e,[{key:"post",value:function(e){var t=e.url,n=e.data,r=e.headers;return new Promise((function(e,a){ge.request({url:At("https:",t),data:n,method:"POST",header:r,success:function(t){e(t)},fail:function(e){a(e)}})}))}},{key:"upload",value:function(e){return new Promise((function(t,n){var r=e.url,a=e.file,i=e.data,o=e.headers,s=e.fileType,u=ge.uploadFile({url:At("https:",r),name:"file",formData:Object.assign({},i),filePath:a,fileType:s,header:o,success:function(e){var n={statusCode:e.statusCode,data:e.data||{}};200===e.statusCode&&i.success_action_status&&(n.statusCode=parseInt(i.success_action_status,10)),t(n)},fail:function(e){n(new Error(e.errMsg||"uploadFile:fail"))}});"function"==typeof e.onUploadProgress&&u&&"function"==typeof u.onProgressUpdate&&u.onProgressUpdate((function(t){e.onUploadProgress({loaded:t.totalBytesSent,total:t.totalBytesExpectedToSend})}))}))}}]),e}(),It={setItem:function(e,t){ge.setStorageSync(e,t)},getItem:function(e){return ge.getStorageSync(e)},removeItem:function(e){ge.removeStorageSync(e)},clear:function(){ge.clearStorageSync()}},Tt={genAdapter:function(){return{root:{},reqClass:St,localStorage:It,primaryStorage:"local"}},isMatch:function(){return!0},runtime:"uni_app"};_t.useAdapters(Tt);var Pt=_t,Ct=Pt.init;Pt.init=function(e){e.env=e.spaceId;var t=Ct.call(this,e);t.config.provider="tencent",t.config.spaceId=e.spaceId;var n=t.auth;return t.auth=function(e){var t=n.call(this,e);return["linkAndRetrieveDataWithTicket","signInAnonymously","signOut","getAccessToken","getLoginState","signInWithTicket","getUserInfo"].forEach((function(e){var n;t[e]=(n=t[e],function(e){e=e||{};var t=de(e),r=t.success,a=t.fail,i=t.complete;if(!(r||a||i))return n.call(this,e);n.call(this,e).then((function(e){r&&r(e),i&&i(e)}),(function(e){a&&a(e),i&&i(e)}))}).bind(t)})),t},t.customAuth=t.auth,t};var Ot=Pt,Et=function(e){(0,d.default)(n,e);var t=(0,f.default)(n);function n(){return(0,g.default)(this,n),t.apply(this,arguments)}return(0,v.default)(n,[{key:"getAccessToken",value:function(){var e=this;return new Promise((function(t,n){var r="Anonymous_Access_token";e.setAccessToken(r),t(r)}))}},{key:"setupRequest",value:function(e,t){var n=Object.assign({},e,{spaceId:this.config.spaceId,timestamp:Date.now()}),r={"Content-Type":"application/json"};"auth"!==t&&(n.token=this.accessToken,r["x-basement-token"]=this.accessToken),r["x-serverless-sign"]=we.sign(n,this.config.clientSecret);var a=ke();r["x-client-info"]=encodeURIComponent(JSON.stringify(a));var i=ve(),o=i.token;return r["x-client-token"]=o,{url:this.config.requestUrl,method:"POST",data:n,dataType:"json",header:JSON.parse(JSON.stringify(r))}}},{key:"uploadFileToOSS",value:function(e){var t=this,n=e.url,r=e.formData,a=e.name,i=e.filePath,o=e.fileType,s=e.onUploadProgress;return new Promise((function(e,u){var c=t.adapter.uploadFile({url:n,formData:r,name:a,filePath:i,fileType:o,success:function(t){t&&t.statusCode<400?e(t):u(new pe({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail:function(e){u(new pe({code:e.code||"UPLOAD_FAILED",message:e.message||e.errMsg||"文件上传失败"}))}});"function"==typeof s&&c&&"function"==typeof c.onProgressUpdate&&c.onProgressUpdate((function(e){s({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend})}))}))}},{key:"uploadFile",value:function(e){var t,n=this,r=e.filePath,a=e.cloudPath,i=e.fileType,o=void 0===i?"image":i,s=e.onUploadProgress;if(!a)throw new pe({code:"CLOUDPATH_REQUIRED",message:"cloudPath不可为空"});return this.getOSSUploadOptionsFromPath({cloudPath:a}).then((function(e){var a=e.result,i=a.url,u=a.formData,c=a.name;t=e.result.fileUrl;var l={url:i,formData:u,name:c,filePath:r,fileType:o};return n.uploadFileToOSS(Object.assign({},l,{onUploadProgress:s}))})).then((function(){return n.reportOSSUpload({cloudPath:a})})).then((function(e){return new Promise((function(n,a){e.success?n({success:!0,filePath:r,fileID:t}):a(new pe({code:"UPLOAD_FAILED",message:"文件上传失败"}))}))}))}},{key:"deleteFile",value:function(e){var t=e.fileList,n={method:"serverless.file.resource.delete",params:JSON.stringify({fileList:t})};return this.request(this.setupRequest(n)).then((function(e){if(e.success)return e.result;throw new pe({code:"DELETE_FILE_FAILED",message:"删除文件失败"})}))}},{key:"getTempFileURL",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.fileList;if(!Array.isArray(t)||0===t.length)throw new pe({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"});var n={method:"serverless.file.resource.getTempFileURL",params:JSON.stringify({fileList:t})};return this.request(this.setupRequest(n)).then((function(e){if(e.success)return{fileList:e.result.fileList.map((function(e){return{fileID:e.fileID,tempFileURL:e.tempFileURL}}))};throw new pe({code:"GET_TEMP_FILE_URL_FAILED",message:"获取临时文件链接失败"})}))}}]),n}(Se),Dt={init:function(e){var t=new Et(e),n={signInAnonymously:function(){return t.authorize()},getLoginState:function(){return Promise.resolve(!1)}};return t.auth=function(){return n},t.customAuth=t.auth,t}};function Lt(e){var t,n=e.data;t=ke();var r=JSON.parse(JSON.stringify(n||{}));if(Object.assign(r,{clientInfo:t}),!r.uniIdToken){var a=ve(),i=a.token;i&&(r.uniIdToken=i)}return r}var Rt=[{rule:/fc_function_not_found|FUNCTION_NOT_FOUND/,content:",云函数[{functionName}]在云端不存在,请检查此云函数名称是否正确以及该云函数是否已上传到服务空间",mode:"append"}],Mt=/[\\^$.*+?()[\]{}|]/g,Ut=RegExp(Mt.source);function Nt(e,t,n){return e.replace(new RegExp((r=t)&&Ut.test(r)?r.replace(Mt,"\\$&"):r,"g"),n);var r}var Ft="request",jt="response";var Bt;Bt="0123456789abcdef";var Jt={code:2e4,message:"System error"},qt={code:20101,message:"Invalid client"};function Vt(e){var t=e||{},n=t.errSubject,r=t.subject,a=t.errCode,i=t.errMsg,o=t.code,s=t.message,u=t.cause;return new pe({subject:n||r||"uni-secure-network",code:a||o||Jt.code,message:i||s,cause:u})}var Wt;function Ht(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.secretType;return t===Ft||t===jt||"both"===t}function zt(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.name,n=e.data,r=void 0===n?{}:n;return"app"===B&&"DCloud-clientDB"===t&&"encryption"===r.redirectTo&&"getAppClientKey"===r.action}function Kt(e){e.functionName,e.result,e.logPvd}function Qt(e){var t=e.callFunction,n=function(n){var r=this,a=n.name;n.data=Lt.call(e,{data:n.data});var i={aliyun:"aliyun",tencent:"tcb",tcb:"tcb"}[this.config.provider],o=Ht(n),s=zt(n),u=o||s;return t.call(this,n).then((function(e){return e.errCode=0,!u&&Kt.call(r,{functionName:a,result:e,logPvd:i}),Promise.resolve(e)}),(function(e){return!u&&Kt.call(r,{functionName:a,result:e,logPvd:i}),e&&e.message&&(e.message=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.message,n=void 0===t?"":t,r=e.extraInfo,a=void 0===r?{}:r,i=e.formatter,o=void 0===i?[]:i,s=0;s0&&void 0!==arguments[0]?arguments[0]:{},t=e.provider,n=e.spaceId,r=e.functionName,a=ye(),i=a.appId,o=a.uniPlatform,s=a.osName,u=o;"app"===o&&(u=s);var c=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.provider,n=e.spaceId,r=j;if(!r)return{};t=function(e){return"tencent"===e?"tcb":e}(t);var a=r.find((function(e){return e.provider===t&&e.spaceId===n}));return a&&a.config}({provider:t,spaceId:n});if(!c||!c.accessControl||!c.accessControl.enable)return!1;var l=c.accessControl.function||{},d=Object.keys(l);if(0===d.length)return!0;var f=function(e,t){for(var n,r,a,i=0;i-1&&(r=o):a=o:n=o}return n||r||a}(d,r);if(!f)return!1;if((l[f]||[]).find((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.appId===i&&(e.platform||"").toLowerCase()===u.toLowerCase()})))return!0;throw console.error("此应用[appId: ".concat(i,", platform: ").concat(u,"]不在云端配置的允许访问的应用列表内,参考:https://uniapp.dcloud.net.cn/uniCloud/secure-network.html#verify-client")),Vt(qt)}({provider:o,spaceId:s,functionName:u})?new Wt({secretType:t.secretType,uniCloudIns:e}).wrapVerifyClientCallFunction(n.bind(e))(t):r(t),Object.defineProperty(a,"result",{get:function(){return console.warn("当前返回结果为Promise类型,不可直接访问其result属性,详情请参考:https://uniapp.dcloud.net.cn/uniCloud/faq?id=promise"),{}}}),a}}Wt="mp-weixin"!==B&&"app"!==B?function(){return(0,v.default)((function e(){throw(0,g.default)(this,e),Vt({message:"Platform ".concat(B," is not supported by secure network")})}))}():function(){return(0,v.default)((function e(){throw(0,g.default)(this,e),Vt({message:"Platform ".concat(B," is not enabled, please check whether secure network module is enabled in your manifest.json")})}))}();var Yt=Symbol("CLIENT_DB_INTERNAL");function Gt(e,t){return e.then="DoNotReturnProxyWithAFunctionNamedThen",e._internalType=Yt,e.inspect=null,e.__ob__=void 0,new Proxy(e,{get:function(e,n,r){if("_uniClient"===n)return null;if("symbol"==(0,o.default)(n))return e[n];if(n in e||"string"!=typeof n){var a=e[n];return"function"==typeof a?a.bind(e):a}return t.get(e,n,r)}})}function Zt(e){return{on:function(t,n){e[t]=e[t]||[],e[t].indexOf(n)>-1||e[t].push(n)},off:function(t,n){e[t]=e[t]||[];var r=e[t].indexOf(n);-1!==r&&e[t].splice(r,1)}}}var Xt=["db.Geo","db.command","command.aggregate"];function $t(e,t){return Xt.indexOf("".concat(e,".").concat(t))>-1}function en(e){switch(O(e)){case"array":return e.map((function(e){return en(e)}));case"object":return e._internalType===Yt||Object.keys(e).forEach((function(t){e[t]=en(e[t])})),e;case"regexp":return{$regexp:{source:e.source,flags:e.flags}};case"date":return{$date:e.toISOString()};default:return e}}function tn(e){return e&&e.content&&e.content.$method}var nn=function(){function e(t,n,r){(0,g.default)(this,e),this.content=t,this.prevStage=n||null,this.udb=null,this._database=r}return(0,v.default)(e,[{key:"toJSON",value:function(){for(var e=this,t=[e.content];e.prevStage;)e=e.prevStage,t.push(e.content);return{$db:t.reverse().map((function(e){return{$method:e.$method,$param:en(e.$param)}}))}}},{key:"toString",value:function(){return JSON.stringify(this.toJSON())}},{key:"getAction",value:function(){var e=this.toJSON().$db.find((function(e){return"action"===e.$method}));return e&&e.$param&&e.$param[0]}},{key:"getCommand",value:function(){return{$db:this.toJSON().$db.filter((function(e){return"action"!==e.$method}))}}},{key:"isAggregate",get:function(){for(var e=this;e;){var t=tn(e),n=tn(e.prevStage);if("aggregate"===t&&"collection"===n||"pipeline"===t)return!0;e=e.prevStage}return!1}},{key:"isCommand",get:function(){for(var e=this;e;){if("command"===tn(e))return!0;e=e.prevStage}return!1}},{key:"isAggregateCommand",get:function(){for(var e=this;e;){var t=tn(e),n=tn(e.prevStage);if("aggregate"===t&&"command"===n)return!0;e=e.prevStage}return!1}},{key:"getNextStageFn",value:function(e){var t=this;return function(){return rn({$method:e,$param:en(Array.from(arguments))},t,t._database)}}},{key:"count",get:function(){return this.isAggregate?this.getNextStageFn("count"):function(){return this._send("count",Array.from(arguments))}}},{key:"remove",get:function(){return this.isCommand?this.getNextStageFn("remove"):function(){return this._send("remove",Array.from(arguments))}}},{key:"get",value:function(){return this._send("get",Array.from(arguments))}},{key:"add",get:function(){return this.isCommand?this.getNextStageFn("add"):function(){return this._send("add",Array.from(arguments))}}},{key:"update",value:function(){return this._send("update",Array.from(arguments))}},{key:"end",value:function(){return this._send("end",Array.from(arguments))}},{key:"set",get:function(){return this.isCommand?this.getNextStageFn("set"):function(){throw new Error("JQL禁止使用set方法")}}},{key:"_send",value:function(e,t){var n=this.getAction(),r=this.getCommand();return r.$db.push({$method:e,$param:en(t)}),this._database._callCloudFunction({action:n,command:r})}}]),e}();function rn(e,t,n){return Gt(new nn(e,t,n),{get:function(e,t){var r="db";return e&&e.content&&(r=e.content.$method),$t(r,t)?rn({$method:t},e,n):function(){return rn({$method:t,$param:en(Array.from(arguments))},e,n)}}})}function an(e){var t=e.path,n=e.method;return function(){function e(){(0,g.default)(this,e),this.param=Array.from(arguments)}return(0,v.default)(e,[{key:"toJSON",value:function(){return{$newDb:[].concat((0,s.default)(t.map((function(e){return{$method:e}}))),[{$method:n,$param:this.param}])}}},{key:"toString",value:function(){return JSON.stringify(this.toJSON())}}]),e}()}function on(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Gt(new e(t),{get:function(e,t){return $t("db",t)?rn({$method:t},null,e):function(){return rn({$method:t,$param:en(Array.from(arguments))},null,e)}}})}var sn=function(e){(0,d.default)(n,e);var t=(0,f.default)(n);function n(){return(0,g.default)(this,n),t.apply(this,arguments)}return(0,v.default)(n,[{key:"_parseResult",value:function(e){return this._isJQL?e.result:e}},{key:"_callCloudFunction",value:function(e){var t=this,n=e.action,r=e.command,a=e.multiCommand,i=e.queryList;function o(e,t){if(a&&i)for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=t.uniClient,r=void 0===n?{}:n,a=t.isJQL,i=void 0!==a&&a;(0,g.default)(this,e),this._uniClient=r,this._authCallBacks={},this._dbCallBacks={},r._isDefault&&(this._dbCallBacks=V("_globalUniCloudDatabaseCallback")),i||(this.auth=Zt(this._authCallBacks)),this._isJQL=i,Object.assign(this,Zt(this._dbCallBacks)),this.env=Gt({},{get:function(e,t){return{$env:t}}}),this.Geo=Gt({},{get:function(e,t){return an({path:["Geo"],method:t})}}),this.serverDate=an({path:[],method:"serverDate"}),this.RegExp=an({path:[],method:"RegExp"})}return(0,v.default)(e,[{key:"getCloudEnv",value:function(e){if("string"!=typeof e||!e.trim())throw new Error("getCloudEnv参数错误");return{$env:e.replace("$cloudEnv_","")}}},{key:"_callback",value:function(e,t){var n=this._dbCallBacks;n[e]&&n[e].forEach((function(e){e.apply(void 0,(0,s.default)(t))}))}},{key:"_callbackAuth",value:function(e,t){var n=this._authCallBacks;n[e]&&n[e].forEach((function(e){e.apply(void 0,(0,s.default)(t))}))}},{key:"multiSend",value:function(){var e=Array.from(arguments),t=e.map((function(e){var 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})}}]),e}()),un="token无效,跳转登录页面",cn="token过期,跳转登录页面",ln={TOKEN_INVALID_TOKEN_EXPIRED:cn,TOKEN_INVALID_INVALID_CLIENTID:un,TOKEN_INVALID:un,TOKEN_INVALID_WRONG_TOKEN:un,TOKEN_INVALID_ANONYMOUS_USER:un},dn={"uni-id-token-expired":cn,"uni-id-check-token-failed":un,"uni-id-token-not-exist":un,"uni-id-check-device-feature-failed":un};function fn(e,t){var n="";return n=e?"".concat(e,"/").concat(t):t,n.replace(/^\//,"")}function hn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=[],r=[];return e.forEach((function(e){!0===e.needLogin?n.push(fn(t,e.path)):!1===e.needLogin&&r.push(fn(t,e.path))})),{needLoginPage:n,notNeedLoginPage:r}}function pn(e){return e.split("?")[0].replace(/^\//,"")}function gn(){return function(e){var t=e&&e.$page&&e.$page.fullPath||"";return t?("/"!==t.charAt(0)&&(t="/"+t),t):t}(function(){var e=getCurrentPages();return e[e.length-1]}())}function vn(){return pn(gn())}function mn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return!1;if(!(t&&t.list&&t.list.length))return!1;var n=t.list,r=pn(e);return n.some((function(e){return e.pagePath===r}))}var yn,kn=!!y.default.uniIdRouter,bn=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y.default,t=e.pages,n=void 0===t?[]:t,r=e.subPackages,a=void 0===r?[]:r,i=e.uniIdRouter,o=void 0===i?{}:i,u=e.tabBar,c=void 0===u?{}:u,l=o.loginPage,d=o.needLogin,f=void 0===d?[]:d,h=o.resToLogin,p=void 0===h||h,g=hn(n),v=g.needLoginPage,m=g.notNeedLoginPage,k=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[],n=[];return e.forEach((function(e){var r=e.root,a=e.pages,i=void 0===a?[]:a,o=hn(i,r),u=o.needLoginPage,c=o.notNeedLoginPage;t.push.apply(t,(0,s.default)(u)),n.push.apply(n,(0,s.default)(c))})),{needLoginPage:t,notNeedLoginPage:n}}(a),b=k.needLoginPage,w=k.notNeedLoginPage;return{loginPage:l,routerNeedLogin:f,resToLogin:p,needLoginPage:[].concat((0,s.default)(v),(0,s.default)(b)),notNeedLoginPage:[].concat((0,s.default)(m),(0,s.default)(w)),loginPageInTabBar:mn(l,c)}}(),wn=bn.loginPage,xn=bn.routerNeedLogin,_n=bn.resToLogin,An=bn.needLoginPage,Sn=bn.notNeedLoginPage,In=bn.loginPageInTabBar;if(An.indexOf(wn)>-1)throw new Error("Login page [".concat(wn,'] should not be "needLogin", please check your pages.json'));function Tn(e){var t=vn();if("/"===e.charAt(0))return e;var n=e.split("?"),r=(0,i.default)(n,2),a=r[0],o=r[1],s=a.replace(/^\//,"").split("/"),u=t.split("/");u.pop();for(var c=0;c-1)&&(An.indexOf(t)>-1||xn.some((function(t){return function(e,t){return new RegExp(t).test(e)}(e,t)})))}function Cn(e){var t=e.redirect,n=pn(t),r=pn(wn);return vn()!==r&&n!==r}function On(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.api,n=e.redirect;if(n&&Cn({redirect:n})){var r=function(e,t){return"/"!==e.charAt(0)&&(e="/"+e),t?e.indexOf("?")>-1?e+"&uniIdRedirectUrl=".concat(encodeURIComponent(t)):e+"?uniIdRedirectUrl=".concat(encodeURIComponent(t)):e}(wn,n);In?"navigateTo"!==t&&"redirectTo"!==t||(t="switchTab"):"switchTab"===t&&(t="navigateTo");var a={navigateTo:uni.navigateTo,redirectTo:uni.redirectTo,switchTab:uni.switchTab,reLaunch:uni.reLaunch};setTimeout((function(){a[t]({url:r})}))}}function En(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.url,n={abortLoginPageJump:!1,autoToLoginPage:!1},r=function(){var e,t=ve(),n=t.token,r=t.tokenExpired;if(n){if(r0)return setTimeout((function(){se($,r)}),0),n.abortLoginPageJump=!0,n;n.autoToLoginPage=!0}return n}function Dn(){!function(){var e=gn(),t=En({url:e}),n=t.abortLoginPageJump,r=t.autoToLoginPage;n||r&&On({api:"redirectTo",redirect:e})}();for(var e=["navigateTo","redirectTo","reLaunch","switchTab"],t=function(t){var n=e[t];uni.addInterceptor(n,{invoke:function(e){var t=En({url:e.url}),r=t.abortLoginPageJump,a=t.autoToLoginPage;return r?e:a?(On({api:n,redirect:Tn(e.url)}),!1):e}})},n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t=ae($);le().then((function(){var n=gn();if(n&&Cn({redirect:n}))return t.length>0?se($,Object.assign({uniIdRedirectUrl:n},e)):void(wn&&On({api:"navigateTo",redirect:n}))}))}(n)}))}function Rn(e){!function(e){e.onResponse=function(e){ie(X,e)},e.offResponse=function(e){oe(X,e)}}(e),function(e){e.onNeedLogin=function(e){ie($,e)},e.offNeedLogin=function(e){oe($,e)},kn&&(V("_globalUniCloudStatus").needLoginInit||(V("_globalUniCloudStatus").needLoginInit=!0,le().then((function(){Dn.call(e)})),_n&&Ln.call(e)))}(e),function(e){e.onRefreshToken=function(e){ie(ee,e)},e.offRefreshToken=function(e){oe(ee,e)}}(e)}var Mn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Un=/^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;function Nn(){var e,t,n=ve().token||"",r=n.split(".");if(!n||3!==r.length)return{uid:null,role:[],permission:[],tokenExpired:0};try{e=JSON.parse((t=r[1],decodeURIComponent(yn(t).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""))))}catch(n){throw new Error("获取当前用户信息出错,详细错误信息为:"+n.message)}return e.tokenExpired=1e3*e.exp,delete e.exp,delete e.iat,e}yn="function"!=typeof atob?function(e){if(e=String(e).replace(/[\t\n\f\r ]+/g,""),!Un.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,r,a="",i=0;i>16&255):64===r?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,255&t);return a}:atob;var Fn=k((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n="chooseAndUploadFile:ok",r="chooseAndUploadFile:fail";function a(e,t){return e.tempFiles.forEach((function(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((function(e){return e.path}))),e}function i(e,t,r){var a=r.onChooseFile,i=r.onUploadProgress;return t.then((function(e){if(a){var t=a(e);if(void 0!==t)return Promise.resolve(t).then((function(t){return void 0===t?e:t}))}return e})).then((function(t){return!1===t?{errMsg:n,tempFilePaths:[],tempFiles:[]}:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5,a=arguments.length>3?arguments[3]:void 0;(t=Object.assign({},t)).errMsg=n;var i=t.tempFiles,o=i.length,s=0;return new Promise((function(n){for(;s=o)!i.find((function(e){return!e.url&&!e.errMsg}))&&n(t);else{var c=i[r];e.uploadFile({filePath:c.path,cloudPath:c.cloudPath,fileType:c.fileType,onUploadProgress:function(e){e.index=r,e.tempFile=c,e.tempFilePath=c.path,a&&a(e)}}).then((function(e){c.url=e.fileID,r0&&void 0!==arguments[0]?arguments[0]:{type:"all"};return"image"===t.type?i(e,function(e){var t=e.count,n=e.sizeType,i=e.sourceType,o=void 0===i?["album","camera"]:i,s=e.extension;return new Promise((function(e,i){uni.chooseImage({count:t,sizeType:n,sourceType:o,extension:s,success:function(t){e(a(t,"image"))},fail:function(e){i({errMsg:e.errMsg.replace("chooseImage:fail",r)})}})}))}(t),t):"video"===t.type?i(e,function(e){var t=e.camera,n=e.compressed,i=e.maxDuration,o=e.sourceType,s=void 0===o?["album","camera"]:o,u=e.extension;return new Promise((function(e,o){uni.chooseVideo({camera:t,compressed:n,maxDuration:i,sourceType:s,extension:u,success:function(t){var n=t.tempFilePath,r=t.duration,i=t.size,o=t.height,s=t.width;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:s,height:o,duration:r,fileType:"video",cloudPath:""}]},"video"))},fail:function(e){o({errMsg:e.errMsg.replace("chooseVideo:fail",r)})}})}))}(t),t):i(e,function(e){var t=e.count,n=e.extension;return new Promise((function(e,i){var o=uni.chooseFile;if("undefined"!=typeof wx&&"function"==typeof wx.chooseMessageFile&&(o=wx.chooseMessageFile),"function"!=typeof o)return i({errMsg:r+" 请指定 type 类型,该平台仅支持选择 image 或 video。"});o({type:"all",count:t,extension:n,success:function(t){e(a(t))},fail:function(e){i({errMsg:e.errMsg.replace("chooseFile:fail",r)})}})}))}(t),t)}}})),jn=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(Fn);function Bn(e){return{props:{localdata:{type:Array,default:function(){return[]}},options:{type:[Object,Array],default:function(){return{}}},spaceInfo:{type:Object,default:function(){return{}}},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:function(){return{mixinDatacomLoading:!1,mixinDatacomHasMore:!1,mixinDatacomResData:[],mixinDatacomErrorMessage:"",mixinDatacomPage:{}}},created:function(){var e=this;this.mixinDatacomPage={current:this.pageCurrent,size:this.pageSize,count:0},this.$watch((function(){var t=[];return["pageCurrent","pageSize","localdata","collection","action","field","orderby","where","getont","getcount","gettree","groupby","groupField","distinct"].forEach((function(n){t.push(e[n])})),t}),(function(t,n){if("manual"!==e.loadtime){for(var r=!1,a=[],i=2;i0&&void 0!==arguments[0]?arguments[0]:{},n=t.getone,r=void 0!==n&&n,a=t.success,i=t.fail;this.mixinDatacomLoading||(this.mixinDatacomLoading=!0,this.mixinDatacomErrorMessage="",this.mixinDatacomGet().then((function(t){e.mixinDatacomLoading=!1;var n=t.result,i=n.data,o=n.count;e.getcount&&(e.mixinDatacomPage.count=o),e.mixinDatacomHasMore=i.length0&&void 0!==arguments[0]?arguments[0]:{},r=e.database(this.spaceInfo),a=n.action||this.action;a&&(r=r.action(a));var i=n.collection||this.collection;r=Array.isArray(i)?(t=r).collection.apply(t,(0,s.default)(i)):r.collection(i);var o=n.where||this.where;o&&Object.keys(o).length&&(r=r.where(o));var u=n.field||this.field;u&&(r=r.field(u));var c=n.foreignKey||this.foreignKey;c&&(r=r.foreignKey(c));var l=n.groupby||this.groupby;l&&(r=r.groupBy(l));var d=n.groupField||this.groupField;d&&(r=r.groupField(d)),!0===(void 0!==n.distinct?n.distinct:this.distinct)&&(r=r.distinct());var f=n.orderby||this.orderby;f&&(r=r.orderBy(f));var h=void 0!==n.pageCurrent?n.pageCurrent:this.mixinDatacomPage.current,p=void 0!==n.pageSize?n.pageSize:this.mixinDatacomPage.size,g=void 0!==n.getcount?n.getcount:this.getcount,v=void 0!==n.gettree?n.gettree:this.gettree,m=void 0!==n.gettreepath?n.gettreepath:this.gettreepath,y={getCount:g},k={limitLevel:void 0!==n.limitlevel?n.limitlevel:this.limitlevel,startWith:void 0!==n.startwith?n.startwith:this.startwith};return v&&(y.getTree=k),m&&(y.getTreePath=k),r=r.skip(p*(h-1)).limit(p).get(y),r}}}}function Jn(e){return V("_globalUniCloudSecureNetworkCache__{spaceId}".replace("{spaceId}",e.config.spaceId))}function qn(){return Vn.apply(this,arguments)}function Vn(){return Vn=(0,l.default)((0,c.default)().mark((function e(){var t,n,r,a,i,o,s,u=arguments;return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(t=u.length>0&&void 0!==u[0]?u[0]:{},n=t.openid,r=t.callLoginByWeixin,a=void 0!==r&&r,i=Jn(this),"mp-weixin"===B){e.next=4;break}throw new Error("[SecureNetwork] API `initSecureNetworkByWeixin` is not supported on platform `".concat(B,"`"));case 4:if(!n||!a){e.next=6;break}throw new Error("[SecureNetwork] openid and callLoginByWeixin cannot be passed at the same time");case 6:if(!n){e.next=8;break}return e.abrupt("return",(i.mpWeixinOpenid=n,{}));case 8:return e.next=10,new Promise((function(e,t){uni.login({success:function(t){e(t.code)},fail:function(e){t(new Error(e.errMsg))}})}));case 10:return o=e.sent,s=this.importObject("uni-id-co",{customUI:!0}),e.next=14,s.secureNetworkHandshakeByWeixin({code:o,callLoginByWeixin:a});case 14:return i.mpWeixinCode=o,e.abrupt("return",{code:o});case 16:case"end":return e.stop()}}),e,this)}))),Vn.apply(this,arguments)}function Wn(e){return Hn.apply(this,arguments)}function Hn(){return Hn=(0,l.default)((0,c.default)().mark((function e(t){var n;return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return n=Jn(this),e.abrupt("return",(n.initPromise||(n.initPromise=qn.call(this,t)),n.initPromise));case 2:case"end":return e.stop()}}),e,this)}))),Hn.apply(this,arguments)}var zn=function(e){(0,d.default)(n,e);var t=(0,f.default)(n);function n(){var e;return(0,g.default)(this,n),e=t.call(this),e._uniPushMessageCallback=e._receivePushMessage.bind((0,a.default)(e)),e._currentMessageId=-1,e._payloadQueue=[],e}return(0,v.default)(n,[{key:"init",value:function(){var e=this;return Promise.all([N("getSystemInfo")(),N("getPushClientId")()]).then((function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=(0,i.default)(t,2),r=n[0];r=void 0===r?{}:r;var a=r.appId,o=n[1];o=void 0===o?{}:o;var s=o.cid;if(!a)throw new Error("Invalid appId, please check the manifest.json file");if(!s)throw new Error("Invalid push client id");e._appId=a,e._pushClientId=s,e._seqId=Date.now()+"-"+Math.floor(9e5*Math.random()+1e5),e.emit("open"),e._initMessageListener()}),(function(t){throw e.emit("error",t),e.close(),t}))}},{key:"open",value:function(){var e=(0,l.default)((0,c.default)().mark((function e(){return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.abrupt("return",this.init());case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"_isUniCloudSSE",value:function(e){if("receive"!==e.type)return!1;var t=e&&e.data&&e.data.payload;return!(!t||"UNI_CLOUD_SSE"!==t.channel||t.seqId!==this._seqId)}},{key:"_receivePushMessage",value:function(e){if(this._isUniCloudSSE(e)){var t=e&&e.data&&e.data.payload,n=t.action,r=t.messageId,a=t.message;this._payloadQueue.push({action:n,messageId:r,message:a}),this._consumMessage()}}},{key:"_consumMessage",value:function(){for(var e=this;;){var t=this._payloadQueue.find((function(t){return t.messageId===e._currentMessageId+1}));if(!t)break;this._currentMessageId++,this._parseMessagePayload(t)}}},{key:"_parseMessagePayload",value:function(e){var t=e.action,n=e.messageId,r=e.message;"end"===t?this._end({messageId:n,message:r}):"message"===t&&this._appendMessage({messageId:n,message:r})}},{key:"_appendMessage",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(e.messageId,e.message);this.emit("message",t)}},{key:"_end",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(e.messageId,e.message);this.emit("end",t),this.close()}},{key:"_initMessageListener",value:function(){uni.onPushMessage(this._uniPushMessageCallback)}},{key:"_destroy",value:function(){uni.offPushMessage(this._uniPushMessageCallback)}},{key:"toJSON",value:function(){return{appId:this._appId,pushClientId:this._pushClientId,seqId:this._seqId}}},{key:"close",value:function(){this._destroy(),this.emit("close")}}]),n}(function(){function e(){(0,g.default)(this,e),this._callback={}}return(0,v.default)(e,[{key:"addListener",value:function(e,t){this._callback[e]||(this._callback[e]=[]),this._callback[e].push(t)}},{key:"on",value:function(e,t){return this.addListener(e,t)}},{key:"removeListener",value:function(e,t){if(!t)throw new Error('The "listener" argument must be of type function. Received undefined');var n=this._callback[e];if(n){var r=function(e,t){for(var n=e.length-1;n>=0;n--)if(e[n]===t)return n;return-1}(n,t);n.splice(r,1)}}},{key:"off",value:function(e,t){return this.removeListener(e,t)}},{key:"removeAllListener",value:function(e){delete this._callback[e]}},{key:"emit",value:function(e){for(var t=this._callback[e],n=arguments.length,r=new Array(n>1?n-1:0),a=1;a0)return e.init(t).database();if(this._database)return this._database;var n=on(sn,{uniClient:e});return this._database=n,n},e.databaseForJQL=function(t){if(t&&Object.keys(t).length>0)return e.init(t).databaseForJQL();if(this._databaseForJQL)return this._databaseForJQL;var n=on(sn,{uniClient:e,isJQL:!0});return this._databaseForJQL=n,n}}(t),function(e){e.getCurrentUserInfo=Nn,e.chooseAndUploadFile=jn.initChooseAndUploadFile(e),Object.assign(e,{get mixinDatacom(){return Bn(e)}}),e.SSEChannel=zn,e.initSecureNetworkByWeixin=function(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.openid,r=t.callLoginByWeixin,a=void 0!==r&&r;return Wn.call(e,{openid:n,callLoginByWeixin:a})}}(e),e.importObject=function(e){return function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};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"==(0,o.default)(t.secretMethods)&&(e.secretMethods=t.secretMethods),e}({customUI:!1,loadingOptions:{title:"加载中...",mask:!0},errorOptions:{type:"modal",retry:!1}},n);var r=n,a=r.customUI,i=r.loadingOptions,s=r.errorOptions,u=r.parseSystemError,d=!a;return new Proxy({},{get:function(r,a){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.fn,n=e.interceptorName,r=e.getCallbackArgs;return(0,l.default)((0,c.default)().mark((function e(){var a,i,o,s,u,l,d=arguments;return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:for(a=d.length,i=new Array(a),o=0;o0&&void 0!==s[0]?s[0]:{},n=t.title,r=t.content,a=t.showCancel,i=t.cancelText,o=t.confirmText,e.abrupt("return",new Promise((function(e,t){uni.showModal({title:n,content:r,showCancel:a,cancelText:i,confirmText:o,success:function(t){e(t)},fail:function(){e({confirm:!1,cancel:!0})}})})));case 2:case"end":return e.stop()}}),e)})))({title:"提示",content:S,showCancel:s.retry,cancelText:"取消",confirmText:s.retry?"重试":"确定"});case 33:if(T=r.sent,P=T.confirm,!s.retry||!P){r.next=37;break}return r.abrupt("return",f.apply(void 0,v));case 37:throw C=new pe({subject:w,code:x,message:_,requestId:h.requestId}),C.detail=h.result,se(X,{type:re,content:C}),C;case 39:return r.abrupt("return",(se(X,{type:re,content:h.result}),h.result));case 40:case"end":return r.stop()}}),r,null,[[5,11]])})));function f(){return r.apply(this,arguments)}return f}(),interceptorName:"callObject",getCallbackArgs:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.params;return{objectName:t,methodName:a,params:n}}})}})}}(e)}(t),["callFunction","uploadFile","deleteFile","getTempFileURL","downloadFile","chooseAndUploadFile"].forEach((function(e){if(t[e]){var n=t[e];t[e]=function(){return n.apply(t,Array.from(arguments))},t[e]=function(e,t){return function(n){var r=this,a=!1;if("callFunction"===t){var i=n&&n.type||S;a=i!==S}var o="callFunction"===t&&!a,s=this._initPromiseHub.exec();n=n||{};var u=de(n),c=u.success,l=u.fail,d=u.complete,f=s.then((function(){return a?Promise.resolve():Q(Y(t,"invoke"),n)})).then((function(){return e.call(r,n)})).then((function(e){return a?Promise.resolve(e):Q(Y(t,"success"),e).then((function(){return Q(Y(t,"complete"),e)})).then((function(){return o&&se(X,{type:ne,content:e}),Promise.resolve(e)}))}),(function(e){return a?Promise.reject(e):Q(Y(t,"fail"),e).then((function(){return Q(Y(t,"complete"),e)})).then((function(){return se(X,{type:ne,content:e}),Promise.reject(e)}))}));if(!(c||l||d))return f;f.then((function(e){c&&c(e),d&&d(e),o&&se(X,{type:ne,content:e})}),(function(e){l&&l(e),d&&d(e),o&&se(X,{type:ne,content:e})}))}}(t[e],e).bind(t)}})),t.init=this.init,t}}]),e}());(function(){var e=J,t={};if(e&&1===e.length)t=e[0],Qn=Qn.init(t),Qn._isDefault=!0;else{var n;n=e&&e.length>0?"应用有多个服务空间,请通过uniCloud.init方法指定要使用的服务空间":"应用未关联服务空间,请在uniCloud目录右键关联服务空间",["auth","callFunction","uploadFile","deleteFile","getTempFileURL","downloadFile","database","getCurrentUSerInfo","importObject"].forEach((function(e){Qn[e]=function(){return console.error(n),Promise.reject(new pe({code:"SYS_ERR",message:n}))}}))}Object.assign(Qn,{get mixinDatacom(){return Bn(Qn)}}),Rn(Qn),Qn.addInterceptor=z,Qn.removeInterceptor=K,Qn.interceptObject=G})();var Yn=Qn;t.default=Yn}).call(this,n("c8ba"))},af43:function(e,t,n){"use strict";n.r(t);var r=n("957c"),a=n.n(r);for(var i in r)["default"].indexOf(i)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(i);t["default"]=a.a},aff5:function(e,t,n){var r=n("23e7");r({target:"Number",stat:!0,nonConfigurable:!0,nonWritable:!0},{MAX_SAFE_INTEGER:9007199254740991})},b68d:function(e,t,n){var r=n("24fb");t=r(!1),t.push([e.i,'.uni-data-tree[data-v-408e9b1a]{position:relative;font-size:14px}.error-text[data-v-408e9b1a]{color:#dd524d}.input-value[data-v-408e9b1a]{\ndisplay:flex;\nflex-direction:row;align-items:center;flex-wrap:nowrap;font-size:14px;line-height:38px;padding:0 5px;overflow:hidden;\n}.input-value-border[data-v-408e9b1a]{border:1px solid #e5e5e5;border-radius:5px}.selected-area[data-v-408e9b1a]{flex:1;overflow:hidden;\ndisplay:flex;\nflex-direction:row}.load-more[data-v-408e9b1a]{\nmargin-right:auto;\n}.selected-list[data-v-408e9b1a]{\ndisplay:flex;\nflex-direction:row;flex-wrap:nowrap;padding:0 5px}.selected-item[data-v-408e9b1a]{flex-direction:row;padding:0 1px;\nwhite-space:nowrap\n}.placeholder[data-v-408e9b1a]{color:grey}.input-split-line[data-v-408e9b1a]{opacity:.5}.arrow-area[data-v-408e9b1a]{position:relative;width:20px;\nmargin-bottom:5px;margin-left:auto;display:flex;\njustify-content:center;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:center;transform-origin:center}.input-arrow[data-v-408e9b1a]{width:7px;height:7px;border-left:1px solid #999;border-bottom:1px solid #999}.uni-data-tree-cover[data-v-408e9b1a]{position:fixed;left:0;top:0;right:0;bottom:0;background-color:rgba(0,0,0,.4);\ndisplay:flex;\nflex-direction:column;z-index:100}.uni-data-tree-dialog[data-v-408e9b1a]{position:fixed;left:0;top:20%;right:0;bottom:0;background-color:#fff;border-top-left-radius:10px;border-top-right-radius:10px;\ndisplay:flex;\nflex-direction:column;z-index:102;overflow:hidden;\n}.dialog-caption[data-v-408e9b1a]{position:relative;\ndisplay:flex;\nflex-direction:row\n\t/* border-bottom: 1px solid #f0f0f0; */}.title-area[data-v-408e9b1a]{\ndisplay:flex;\nalign-items:center;\nmargin:auto;\npadding:0 10px}.dialog-title[data-v-408e9b1a]{\n\t/* font-weight: bold; */line-height:44px}.dialog-close[data-v-408e9b1a]{position:absolute;top:0;right:0;bottom:0;\ndisplay:flex;\nflex-direction:row;align-items:center;padding:0 15px}.dialog-close-plus[data-v-408e9b1a]{width:16px;height:2px;background-color:#666;border-radius:2px;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.dialog-close-rotate[data-v-408e9b1a]{position:absolute;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.picker-view[data-v-408e9b1a]{flex:1;overflow:hidden}\n@media (min-width:768px){.uni-data-tree-cover[data-v-408e9b1a]{background-color:initial}.uni-data-tree-dialog[data-v-408e9b1a]{position:absolute;top:55px;height:auto;min-height:400px;max-height:50vh;background-color:#fff;border:1px solid #ebeef5;box-shadow:0 2px 12px 0 rgba(0,0,0,.1);border-radius:4px;overflow:unset}.dialog-caption[data-v-408e9b1a]{display:none}.icon-clear[data-v-408e9b1a]{margin-right:5px}}\n\n\n\n/* picker 弹出层通用的指示小三角, todo:扩展至上下左右方向定位 */\n.uni-popper__arrow[data-v-408e9b1a],\n.uni-popper__arrow[data-v-408e9b1a]::after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid;border-width:6px}.uni-popper__arrow[data-v-408e9b1a]{-webkit-filter:drop-shadow(0 2px 12px rgba(0,0,0,.03));filter:drop-shadow(0 2px 12px rgba(0,0,0,.03));top:-6px;left:10%;margin-right:3px;border-top-width:0;border-bottom-color:#ebeef5}.uni-popper__arrow[data-v-408e9b1a]::after{content:" ";top:1px;margin-left:-6px;border-top-width:0;border-bottom-color:#fff}\n\n',""]),e.exports=t},b746:function(e){e.exports=JSON.parse('{"uni-load-more.contentdown":"上拉显示更多","uni-load-more.contentrefresh":"正在加载...","uni-load-more.contentnomore":"没有更多数据了"}')},b85c:function(e,t,n){"use strict";n("7a82"),Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=(0,r.default)(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var a=0,i=function(){};return{s:i,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){u=!0,o=e},f:function(){try{s||null==n["return"]||n["return"]()}finally{if(u)throw o}}}},n("a4d3"),n("e01a"),n("d3b7"),n("d28b"),n("3ca3"),n("ddb0"),n("d9e2"),n("d401");var r=function(e){return e&&e.__esModule?e:{default:e}}(n("06c5"))},baa5:function(e,t,n){var r=n("23e7"),a=n("e58c");r({target:"Array",proto:!0,forced:a!==[].lastIndexOf},{lastIndexOf:a})},bf19:function(e,t,n){"use strict";var r=n("23e7"),a=n("c65b");r({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return a(URL.prototype.toString,this)}})},c2da:function(e,t,n){var r=n("7aea");r.__esModule&&(r=r.default),"string"===typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);var a=n("4f06").default;a("4114ab2b",r,!0,{sourceMap:!1,shadowMode:!1})},d364:function(e,t,n){"use strict";n.d(t,"b",(function(){return a})),n.d(t,"c",(function(){return i})),n.d(t,"a",(function(){return r}));var r={uniLoadMore:n("a3f9").default,uniIcons:n("416b").default},a=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("v-uni-view",{staticClass:"uni-data-tree"},[n("v-uni-view",{staticClass:"uni-data-tree-input",on:{click:function(t){arguments[0]=t=e.$handleEvent(t),e.handleInput.apply(void 0,arguments)}}},[e._t("default",[n("v-uni-view",{staticClass:"input-value",class:{"input-value-border":e.border}},[e.errorMessage?n("v-uni-text",{staticClass:"selected-area error-text"},[e._v(e._s(e.errorMessage))]):e.loading&&!e.isOpened?n("v-uni-view",{staticClass:"selected-area"},[n("uni-load-more",{staticClass:"load-more",attrs:{contentText:e.loadMore,status:"loading"}})],1):e.inputSelected.length?n("v-uni-scroll-view",{staticClass:"selected-area",attrs:{"scroll-x":"true"}},[n("v-uni-view",{staticClass:"selected-list"},e._l(e.inputSelected,(function(t,r){return n("v-uni-view",{key:r,staticClass:"selected-item"},[n("v-uni-text",[e._v(e._s(t.text))]),r