var window={};var XMLHttpRequest;var navigator;var localStorage; !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.AV=t():e.AV=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=24)}([function(e,t,n){(function(e,n){var r,i;!function(){var o="object"==typeof self&&self.self===self&&self||"object"==typeof e&&e.global===e&&e||this||{},s=o._,a=Array.prototype,u=Object.prototype,c="undefined"!=typeof Symbol?Symbol.prototype:null,l=a.push,f=a.slice,h=u.toString,d=u.hasOwnProperty,p=Array.isArray,y=Object.keys,m=Object.create,v=function(){},g=function(e){return e instanceof g?e:this instanceof g?void(this._wrapped=e):new g(e)};void 0===t||t.nodeType?o._=g:(void 0!==n&&!n.nodeType&&n.exports&&(t=n.exports=g),t._=g),g.VERSION="1.9.1";var _,b=function(e,t,n){if(void 0===t)return e;switch(null==n?3:n){case 1:return function(n){return e.call(t,n)};case 3:return function(n,r,i){return e.call(t,n,r,i)};case 4:return function(n,r,i,o){return e.call(t,n,r,i,o)}}return function(){return e.apply(t,arguments)}},w=function(e,t,n){return g.iteratee!==_?g.iteratee(e,t):null==e?g.identity:g.isFunction(e)?b(e,t,n):g.isObject(e)&&!g.isArray(e)?g.matcher(e):g.property(e)};g.iteratee=_=function(e,t){return w(e,t,1/0)};var E=function(e,t){return t=null==t?e.length-1:+t,function(){for(var n=Math.max(arguments.length-t,0),r=Array(n),i=0;i=0&&t<=C};g.each=g.forEach=function(e,t,n){t=b(t,n);var r,i;if(N(e))for(r=0,i=e.length;r0?0:s-1;for(i||(r=t[o?o[a]:a],a+=e);a>=0&&a=3;return t(e,b(n,i,4),r,o)}};g.reduce=g.foldl=g.inject=x(1),g.reduceRight=g.foldr=x(-1),g.find=g.detect=function(e,t,n){var r=N(e)?g.findIndex:g.findKey,i=r(e,t,n);if(void 0!==i&&-1!==i)return e[i]},g.filter=g.select=function(e,t,n){var r=[];return t=w(t,n),g.each(e,function(e,n,i){t(e,n,i)&&r.push(e)}),r},g.reject=function(e,t,n){return g.filter(e,g.negate(w(t)),n)},g.every=g.all=function(e,t,n){t=w(t,n);for(var r=!N(e)&&g.keys(e),i=(r||e).length,o=0;o=0},g.invoke=E(function(e,t,n){var r,i;return g.isFunction(t)?i=t:g.isArray(t)&&(r=t.slice(0,-1),t=t[t.length-1]),g.map(e,function(e){var o=i;if(!o){if(r&&r.length&&(e=A(e,r)),null==e)return;o=e[t]}return null==o?o:o.apply(e,n)})}),g.pluck=function(e,t){return g.map(e,g.property(t))},g.where=function(e,t){return g.filter(e,g.matcher(t))},g.findWhere=function(e,t){return g.find(e,g.matcher(t))},g.max=function(e,t,n){var r,i,o=-1/0,s=-1/0;if(null==t||"number"==typeof t&&"object"!=typeof e[0]&&null!=e){e=N(e)?e:g.values(e);for(var a=0,u=e.length;ao&&(o=r)}else t=w(t,n),g.each(e,function(e,n,r){((i=t(e,n,r))>s||i===-1/0&&o===-1/0)&&(o=e,s=i)});return o},g.min=function(e,t,n){var r,i,o=1/0,s=1/0;if(null==t||"number"==typeof t&&"object"!=typeof e[0]&&null!=e){e=N(e)?e:g.values(e);for(var a=0,u=e.length;ar||void 0===n)return 1;if(n0?0:i-1;o>=0&&o0?s=o>=0?o:Math.max(o+a,s):a=o>=0?Math.min(o+1,a):o+a+1;else if(n&&o&&a)return o=n(r,i),r[o]===i?o:-1;if(i!==i)return o=t(f.call(r,s,a),g.isNaN),o>=0?o+s:-1;for(o=e>0?s:a-1;o>=0&&ot?(r&&(clearTimeout(r),r=null),a=c,s=e.apply(i,o),r||(i=o=null)):r||!1===n.trailing||(r=setTimeout(u,l)),s};return c.cancel=function(){clearTimeout(r),a=0,r=i=o=null},c},g.debounce=function(e,t,n){var r,i,o=function(t,n){r=null,n&&(i=e.apply(t,n))},s=E(function(s){if(r&&clearTimeout(r),n){var a=!r;r=setTimeout(o,t),a&&(i=e.apply(this,s))}else r=g.delay(o,t,this,s);return i});return s.cancel=function(){clearTimeout(r),r=null},s},g.wrap=function(e,t){return g.partial(t,e)},g.negate=function(e){return function(){return!e.apply(this,arguments)}},g.compose=function(){var e=arguments,t=e.length-1;return function(){for(var n=t,r=e[t].apply(this,arguments);n--;)r=e[n].call(this,r);return r}},g.after=function(e,t){return function(){if(--e<1)return t.apply(this,arguments)}},g.before=function(e,t){var n;return function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=null),n}},g.once=g.partial(g.before,2),g.restArguments=E;var D=!{toString:null}.propertyIsEnumerable("toString"),F=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],M=function(e,t){var n=F.length,r=e.constructor,i=g.isFunction(r)&&r.prototype||u,o="constructor";for(O(e,o)&&!g.contains(t,o)&&t.push(o);n--;)(o=F[n])in e&&e[o]!==i[o]&&!g.contains(t,o)&&t.push(o)};g.keys=function(e){if(!g.isObject(e))return[];if(y)return y(e);var t=[];for(var n in e)O(e,n)&&t.push(n);return D&&M(e,t),t},g.allKeys=function(e){if(!g.isObject(e))return[];var t=[];for(var n in e)t.push(n);return D&&M(e,t),t},g.values=function(e){for(var t=g.keys(e),n=t.length,r=Array(n),i=0;i1&&(r=b(r,t[1])),t=g.allKeys(e)):(r=B,t=P(t,!1,!1),e=Object(e));for(var i=0,o=t.length;i1&&(n=t[1])):(t=g.map(P(t,!1,!1),String),r=function(e,n){return!g.contains(t,n)}),g.pick(e,r,n)}),g.defaults=q(g.allKeys,!0),g.create=function(e,t){var n=T(e);return t&&g.extendOwn(n,t),n},g.clone=function(e){return g.isObject(e)?g.isArray(e)?e.slice():g.extend({},e):e},g.tap=function(e,t){return t(e),e},g.isMatch=function(e,t){var n=g.keys(t),r=n.length;if(null==e)return!r;for(var i=Object(e),o=0;o":">",'"':""","'":"'","`":"`"},G=g.invert(z),H=function(e){var t=function(t){return e[t]},n="(?:"+g.keys(e).join("|")+")",r=RegExp(n),i=RegExp(n,"g");return function(e){return e=null==e?"":""+e,r.test(e)?e.replace(i,t):e}};g.escape=H(z),g.unescape=H(G),g.result=function(e,t,n){g.isArray(t)||(t=[t]);var r=t.length;if(!r)return g.isFunction(n)?n.call(e):n;for(var i=0;i/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var Q=/(.)^/,K={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},$=/\\|'|\r|\n|\u2028|\u2029/g,X=function(e){return"\\"+K[e]};g.template=function(e,t,n){!t&&n&&(t=n),t=g.defaults({},t,g.templateSettings);var r=RegExp([(t.escape||Q).source,(t.interpolate||Q).source,(t.evaluate||Q).source].join("|")+"|$","g"),i=0,o="__p+='";e.replace(r,function(t,n,r,s,a){return o+=e.slice(i,a).replace($,X),i=a+t.length,n?o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'":r?o+="'+\n((__t=("+r+"))==null?'':__t)+\n'":s&&(o+="';\n"+s+"\n__p+='"),t}),o+="';\n",t.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";var s;try{s=new Function(t.variable||"obj","_",o)}catch(e){throw e.source=o,e}var a=function(e){return s.call(this,e,g)};return a.source="function("+(t.variable||"obj")+"){\n"+o+"}",a},g.chain=function(e){var t=g(e);return t._chain=!0,t};var Z=function(e,t){return e._chain?g(t).chain():t};g.mixin=function(e){return g.each(g.functions(e),function(t){var n=g[t]=e[t];g.prototype[t]=function(){var e=[this._wrapped];return l.apply(e,arguments),Z(this,n.apply(g,e))}}),g},g.mixin(g),g.each(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=a[e];g.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),"shift"!==e&&"splice"!==e||0!==n.length||delete n[0],Z(this,n)}}),g.each(["concat","join","slice"],function(e){var t=a[e];g.prototype[e]=function(){return Z(this,t.apply(this._wrapped,arguments))}}),g.prototype.value=function(){return this._wrapped},g.prototype.valueOf=g.prototype.toJSON=g.prototype.value,g.prototype.toString=function(){return String(this._wrapped)},r=[],void 0!==(i=function(){return g}.apply(t,r))&&(n.exports=i)}()}).call(t,n(5),n(32)(e))},function(e,t,n){"use strict";var r=n(44).Promise;r._continueWhile=function(e,t){return e()?t().then(function(){return r._continueWhile(e,t)}):r.resolve()},e.exports=r},function(e,t,n){"use strict";var r=n(0),i=n(59),o=n(0),s=o.extend,a=n(1),u=n(6),c=n(3),l=c.getSessionToken,f=c.ajax,h=function(e,t){var n=(new Date).getTime(),r=i(n+e);return t?r+","+n+",master":r+","+n},d=function(e,t){t?e["X-LC-Sign"]=h(u.applicationKey):e["X-LC-Key"]=u.applicationKey},p=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1],n={"X-LC-Id":u.applicationId,"Content-Type":"application/json;charset=UTF-8"},r=!1;return"boolean"==typeof e.useMasterKey?r=e.useMasterKey:"boolean"==typeof u._config.useMasterKey&&(r=u._config.useMasterKey),r?u.masterKey?t?n["X-LC-Sign"]=h(u.masterKey,!0):n["X-LC-Key"]=u.masterKey+",master":(console.warn("masterKey is not set, fall back to use appKey"),d(n,t)):d(n,t),u.hookKey&&(n["X-LC-Hook-Key"]=u.hookKey),null!==u._config.production&&(n["X-LC-Prod"]=String(u._config.production)),n["X-LC-UA"]=u._sharedConfig.userAgent,a.resolve().then(function(){var t=l(e);if(t)n["X-LC-Session"]=t;else if(!u._config.disableCurrentUser)return u.User.currentAsync().then(function(e){return e&&e._sessionToken&&(n["X-LC-Session"]=e._sessionToken),n});return n})},y=function(e){var t=e.service,n=void 0===t?"api":t,r=e.version,i=void 0===r?"1.1":r,o=e.path,s=u._config.serverURLs[n];if(!s)throw new Error("undefined server URL for "+n);return"/"!==s.charAt(s.length-1)&&(s+="/"),s+=i,o&&(s+=o),s},m=function(e){var t=e.service,n=e.version,i=e.method,o=e.path,s=e.query,a=e.data,c=e.authOptions,l=e.signKey,h=void 0===l||l;if(!u.applicationId||!u.applicationKey&&!u.masterKey)throw new Error("Not initialized");u._appRouter.refresh();var d=u._config.requestTimeout,m=y({service:t,path:o,version:n});return p(c,h).then(function(e){return f({method:i,url:m,query:s,data:a,headers:e,timeout:d}).catch(function(e){var t={code:e.code||-1,error:e.message||e.responseText};if(e.response&&e.response.code)t=e.response;else if(e.responseText)try{t=JSON.parse(e.responseText)}catch(e){}t.rawMessage=t.rawMessage||t.error,u._sharedConfig.keepErrorRawMessage||(t.error+=" ["+(e.statusCode||"N/A")+" "+i+" "+m+"]");var n=new Error(t.error);throw delete t.error,r.extend(n,t)})})},v=function(e,t,n,r,i,o,a){var u="";if(e&&(u+="/"+e),t&&(u+="/"+t),n&&(u+="/"+n),i&&i._fetchWhenSave)throw new Error("_fetchWhenSave should be in the query");if(i&&i._where)throw new Error("_where should be in the query");return r&&"get"===r.toLowerCase()&&(a=s({},a,i),i=null),m({method:r,path:u,query:a,data:i,authOptions:o})};u.request=m,e.exports={_request:v,request:m}},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=n(0),o=n(8),s=n(7),a=s("leancloud:request"),u=s("leancloud:request:error"),c=n(1),l=0,f=function(e){var t=e.method,n=e.url,i=e.query,f=e.data,h=e.headers,d=void 0===h?{}:h,p=e.onprogress,y=e.timeout,m={};if(i)for(var v in i){var g=i[v];void 0!==g&&("object"===(void 0===g?"undefined":r(g))?m[v]=JSON.stringify(g):m[v]=g)}var _=l++;return a("request(%d) %s %s %o %o %o",_,t,n,m,f,d),new c(function(e,r){var c=o(t,n).set(d).query(m).send(f);p&&c.on("progress",p),y&&c.timeout(y),c.end(function(o,c){return o?(c&&(s.enabled("leancloud:request")||u("request(%d) %s %s %o %o %o",_,t,n,i,f,d),u("response(%d) %d %O %o",_,c.status,c.body||c.text,c.header),o.statusCode=c.status,o.responseText=c.text,o.response=c.body),r(o)):(a("response(%d) %d %O %o",_,c.status,c.body||c.text,c.header),e(c.body))})})},h=function(e){return i.isNull(e)||i.isUndefined(e)},d=function(e){return i.isArray(e)?e:void 0===e||null===e?[]:[e]},p=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.keys,n=e.include,r=e.includeACL,i={};return t&&(i.keys=d(t).join(",")),n&&(i.include=d(n).join(",")),r&&(i.returnACL=r),i},y=function(e){return e.sessionToken?e.sessionToken:e.user&&"function"==typeof e.user.getSessionToken?e.user.getSessionToken():void 0},m=function(e){return function(t){return e(t),t}},v=function(){},g=function(e,t,n){var r;return r=t&&t.hasOwnProperty("constructor")?t.constructor:function(){e.apply(this,arguments)},i.extend(r,e),v.prototype=e.prototype,r.prototype=new v,t&&i.extend(r.prototype,t),n&&i.extend(r,n),r.prototype.constructor=r,r.__super__=e.prototype,r},_=function(e){return new Date(e)},b=function(e,t,n){var r=t.split("."),i=r.pop(),o=e;return r.forEach(function(e){void 0===o[e]&&(o[e]={}),o=o[e]}),o[i]=n,e},w=function(e,t){for(var n=t.split("."),r=n[0],i=n.pop(),o=e,s=0;s0&&void 0!==arguments[0]?arguments[0]:f._getAVPath("subscriptionId"),t=f._subscriptionId=i();return f.localStorage.setItemAsync(e,t).then(function(){return t})},f._getSubscriptionId=function(){if(f._subscriptionId)return l.resolve(f._subscriptionId);var e=f._getAVPath("subscriptionId");return f.localStorage.getItemAsync(e).then(function(t){return f._subscriptionId=t,f._subscriptionId||(t=f._refreshSubscriptionId(e)),t})},f._parseDate=c,f._extend=function(e,t){var n=u(this,e,t);return n.extend=this.extend,n},f._encode=function(e,t,n){var i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(e instanceof f.Object){if(n)throw new Error("AV.Objects not allowed here");return t&&!r.include(t,e)&&e._hasData?e._toFullJSON(t.concat(e),i):e._toPointer()}if(e instanceof f.ACL)return e.toJSON();if(r.isDate(e))return i?{__type:"Date",iso:e.toJSON()}:e.toJSON();if(e instanceof f.GeoPoint)return e.toJSON();if(r.isArray(e))return r.map(e,function(e){return f._encode(e,t,n,i)});if(r.isRegExp(e))return e.source;if(e instanceof f.Relation)return e.toJSON();if(e instanceof f.Op)return e.toJSON();if(e instanceof f.File){if(!e.url()&&!e.id)throw new Error("Tried to save an object containing an unsaved file.");return e._toFullJSON(t,i)}return r.isObject(e)?r.mapObject(e,function(e,r){return f._encode(e,t,n,i)}):e},f._decode=function(e,t){if(!r.isObject(e)||r.isDate(e))return e;if(r.isArray(e))return r.map(e,function(e){return f._decode(e)});if(e instanceof f.Object)return e;if(e instanceof f.File)return e;if(e instanceof f.Op)return e;if(e instanceof f.GeoPoint)return e;if(e instanceof f.ACL)return e;if("ACL"===t)return new f.ACL(e);if(e.__op)return f.Op._decode(e);var n;if("Pointer"===e.__type){n=e.className;var i=f.Object._create(n);if(Object.keys(e).length>3){var o=r.clone(e);delete o.__type,delete o.className,i._finishFetch(o,!0)}else i._finishFetch({objectId:e.objectId},!1);return i}if("Object"===e.__type){n=e.className;var s=r.clone(e);delete s.__type,delete s.className;var a=f.Object._create(n);return a._finishFetch(s,!0),a}if("Date"===e.__type)return f._parseDate(e.iso);if("GeoPoint"===e.__type)return new f.GeoPoint({latitude:e.latitude,longitude:e.longitude});if("Relation"===e.__type){if(!t)throw new Error("key missing decoding a Relation");var u=new f.Relation(null,t);return u.targetClassName=e.className,u}if("File"===e.__type){var c=new f.File(e.name),l=r.clone(e);return delete l.__type,c._finishFetch(l),c}return r.mapObject(e,f._decode)},f.parseJSON=f._decode,f.parse=function(e){return f.parseJSON(JSON.parse(e))},f.stringify=function(e){return JSON.stringify(f._encode(e,[],!1,!0))},f._encodeObjectOrArray=function(e){var t=function(e){return e&&e._toFullJSON&&(e=e._toFullJSON([])),r.mapObject(e,function(e){return f._encode(e,[])})};return r.isArray(e)?e.map(function(e){return t(e)}):t(e)},f._arrayEach=r.each,f._traverse=function(e,t,n){if(e instanceof f.Object){if(n=n||[],r.indexOf(n,e)>=0)return;return n.push(e),f._traverse(e.attributes,t,n),t(e)}return e instanceof f.Relation||e instanceof f.File?t(e):r.isArray(e)?(r.each(e,function(r,i){var o=f._traverse(r,t,n);o&&(e[i]=o)}),t(e)):r.isObject(e)?(f._each(e,function(r,i){var o=f._traverse(r,t,n);o&&(e[i]=o)}),t(e)):t(e)},f._objectEach=f._each=function(e,t){r.isObject(e)?r.each(r.keys(e),function(n){t(e[n],n)}):r.each(e,t)},f.debug={enable:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"leancloud*";return o.enable(e)},disable:o.disable},e.exports=f}).call(t,n(5))},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),this.useColors){var n="color: "+this.color;t.splice(1,0,n,"color: inherit");var r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(r++,"%c"===e&&(i=r))}),t.splice(i,0,n)}}function s(){var e;return"object"===("undefined"==typeof console?"undefined":r(console))&&console.log&&(e=console).log.apply(e,arguments)}function a(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}}function u(){var e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}t.log=s,t.formatArgs=o,t.save=a,t.load=u,t.useColors=i,t.storage=function(){try{return localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports=n(35)(t),e.exports.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},function(e,t,n){function r(){}function i(e){if(!y(e))return e;var t=[];for(var n in e)o(t,n,e[n]);return t.join("&")}function o(e,t,n){if(null!=n)if(Array.isArray(n))n.forEach(function(n){o(e,t,n)});else if(y(n))for(var r in n)o(e,t+"["+r+"]",n[r]);else e.push(encodeURIComponent(t)+"="+encodeURIComponent(n));else null===n&&e.push(encodeURIComponent(t))}function s(e){for(var t,n,r={},i=e.split("&"),o=0,s=i.length;o=2&&e._responseTimeoutTimer&&clearTimeout(e._responseTimeoutTimer),4==n){var r;try{r=t.status}catch(e){r=0}if(!r){if(e.timedout||e._aborted)return;return e.crossDomainError()}e.emit("end")}};var r=function(t,n){n.total>0&&(n.percent=n.loaded/n.total*100),n.direction=t,e.emit("progress",n)};if(this.hasListeners("progress"))try{t.onprogress=r.bind(null,"download"),t.upload&&(t.upload.onprogress=r.bind(null,"upload"))}catch(e){}try{this.username&&this.password?t.open(this.method,this.url,!0,this.username,this.password):t.open(this.method,this.url,!0)}catch(e){return this.callback(e)}if(this._withCredentials&&(t.withCredentials=!0),!this._formData&&"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof n&&!this._isHost(n)){var i=this._header["content-type"],o=this._serializer||g.serialize[i?i.split(";")[0]:""];!o&&u(i)&&(o=g.serialize["application/json"]),o&&(n=o(n))}for(var s in this.header)null!=this.header[s]&&this.header.hasOwnProperty(s)&&t.setRequestHeader(s,this.header[s]);return this._responseType&&(t.responseType=this._responseType),this.emit("request",this),t.send(void 0!==n?n:null),this},g.agent=function(){return new v},["GET","POST","OPTIONS","PATCH","PUT","DELETE"].forEach(function(e){v.prototype[e.toLowerCase()]=function(t,n){var r=new g.Request(e,t);return this._setDefaults(r),n&&r.end(n),r}}),v.prototype.del=v.prototype.delete,g.get=function(e,t,n){var r=g("GET",e);return"function"==typeof t&&(n=t,t=null),t&&r.query(t),n&&r.end(n),r},g.head=function(e,t,n){var r=g("HEAD",e);return"function"==typeof t&&(n=t,t=null),t&&r.query(t),n&&r.end(n),r},g.options=function(e,t,n){var r=g("OPTIONS",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},g.del=f,g.delete=f,g.patch=function(e,t,n){var r=g("PATCH",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},g.post=function(e,t,n){var r=g("POST",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},g.put=function(e,t,n){var r=g("PUT",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r}},function(e,t,n){"use strict";var r=n(10),i=n(29),o=n(30),s=r.LISTENERS,a=r.CAPTURE,u=r.BUBBLE,c=r.ATTRIBUTE,l=r.newNode,f=i.defineCustomEventTarget,h=o.createEventWrapper,d=o.STOP_IMMEDIATE_PROPAGATION_FLAG,p="undefined"!=typeof window&&void 0!==window.EventTarget,y=e.exports=function e(){if(!(this instanceof e)){if(1===arguments.length&&Array.isArray(arguments[0]))return f(e,arguments[0]);if(arguments.length>0){for(var t=Array(arguments.length),n=0;n2&&void 0!==arguments[2])||arguments[2];if(this.readyState!==h)throw new Error("request is already opened");if(!n)throw new Error("sync request is not supported");this._method=e,this._url=t,this.readyState=1,this.dispatchEvent({type:"readystatechange"})}},{key:"setRequestHeader",value:function(e,t){if(1!==this.readyState)throw new Error("request is not opened");this._headers[e.toLowerCase()]=t}},{key:"send",value:function(e){var t=this;if(1!==this.readyState)throw new Error("request is not opened");if(e instanceof f){var n=e.entries(),i=n.filter(function(e){return"string"!=typeof e[1]});if(0===i.length)throw new Error("Must specify a Blob field in FormData");i.length>1&&console.warn("Only the first Blob will be send in Weapp");var o=n.filter(function(e){return"string"==typeof e[1]}).reduce(function(e,t){return c(e,r({},t[0],t[1]))},{});this._request=wx.uploadFile({url:this._url,name:i[0][0],filePath:i[0][1].uri,formData:o,header:this._headers,success:a.bind(this),fail:function(e){t.status=0,t.readyState=d,t.dispatchEvent({type:"readystatechange"}),t.dispatchEvent({type:"error"})}}),this._request&&this._request.onProgressUpdate&&this._request.onProgressUpdate(function(e){var n=e.totalBytesSent,r=e.totalBytesExpectedToSend;t.upload.dispatchEvent({type:"progress",loaded:n,total:r})})}else this._request=wx.request({url:this._url,data:e||"",method:this._method.toUpperCase(),header:this._headers,success:a.bind(this),fail:function(e){t.status=0,t.readyState=d,t.dispatchEvent({type:"readystatechange"}),t.dispatchEvent({type:"error"})}})}}]),t}(l(p));c(v,{UNSENT:h,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:d}),e.exports=v},function(e,t,n){"use strict";function r(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}/* object-assign (c) Sindre Sorhus @license MIT */ var i=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,a,u=r(e),c=1;c0&&void 0!==arguments[0]?arguments[0]:t||window;if("object"!==(void 0===e?"undefined":r(e)))throw new Error("polyfill target is not an Object");var n={localStorage:i,XMLHttpRequest:o,FormData:s,WebSocket:a,Object:Object,navigator:c};for(var l in n)e[l]||(e[l]=n[l]);u.polyfill(e),e.navigator.product="ReactNative"},localStorage:i,XMLHttpRequest:o,FormData:s,WebSocket:a}}).call(t,n(5))},function(e,t,n){"use strict";function r(e,t){for(var n=e[s][t];null!=n;){if(n.kind===a)return n.listener;n=n.next}return null}function i(e,t,n){"function"!=typeof n&&"object"!=typeof n&&(n=null);for(var r=null,i=e[s][t];null!=i;)i.kind===a?null==r?e[s][t]=i.next:r.next=i.next:r=i,i=i.next;null!=n&&(null==r?e[s][t]=u(n,a):r.next=u(n,a))}var o=n(10),s=o.LISTENERS,a=o.ATTRIBUTE,u=o.newNode;t.defineCustomEventTarget=function(e,t){function n(){e.call(this)}var o={constructor:{value:n,configurable:!0,writable:!0}};return t.forEach(function(e){o["on"+e]={get:function(){return r(this,e)},set:function(t){i(this,e,t)},configurable:!0,enumerable:!0}}),n.prototype=Object.create(e.prototype,o),n}},function(e,t,n){"use strict";var r=n(10).createUniqueKey,i=r("stop_immediate_propagation_flag"),o=r("canceled_flag"),s=r("original_event"),a=Object.freeze({stopPropagation:Object.freeze({value:function(){var e=this[s];"function"==typeof e.stopPropagation&&e.stopPropagation()},writable:!0,configurable:!0}),stopImmediatePropagation:Object.freeze({value:function(){this[i]=!0;var e=this[s];"function"==typeof e.stopImmediatePropagation&&e.stopImmediatePropagation()},writable:!0,configurable:!0}),preventDefault:Object.freeze({value:function(){!0===this.cancelable&&(this[o]=!0);var e=this[s];"function"==typeof e.preventDefault&&e.preventDefault()},writable:!0,configurable:!0}),defaultPrevented:Object.freeze({get:function(){return this[o]},enumerable:!0,configurable:!0})});t.STOP_IMMEDIATE_PROPAGATION_FLAG=i,t.createEventWrapper=function(e,t){var n="number"==typeof e.timeStamp?e.timeStamp:Date.now(),r={type:{value:e.type,enumerable:!0},target:{value:t,enumerable:!0},currentTarget:{value:t,enumerable:!0},eventPhase:{value:2,enumerable:!0},bubbles:{value:Boolean(e.bubbles),enumerable:!0},cancelable:{value:Boolean(e.cancelable),enumerable:!0},timeStamp:{value:n,enumerable:!0},isTrusted:{value:!1,enumerable:!0}};return r[i]={value:!1,writable:!0},r[o]={value:!1,writable:!0},r[s]={value:e},void 0!==e.detail&&(r.detail={value:e.detail,enumerable:!0}),Object.create(Object.create(e,a),r)}},function(e,t,n){"use strict";var r=n(9);t.polyfill=function(e){if(wx.onNetworkStatusChange&&!e.__onlineOfflinePolyfilled){e.__onlineOfflinePolyfilled=!0;var t=new r;e.dispatchEvent||(e.addEventListener=t.addEventListener.bind(t),e.removeEventListener=t.removeEventListener.bind(t),e.dispatchEvent=t.dispatchEvent.bind(t),"function"!=typeof postMessage||e.importScripts||(e.importScripts=function(){throw new Error("mocked")})),wx.getNetworkType({success:function(t){var n=t.networkType;e.onLine="none"!==n,wx.onNetworkStatusChange(function(t){var n=t.isConnected;e.onLine!==n&&(e.onLine=n,e.dispatchEvent({type:n?"online":"offline"}))})}})}}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);e.exports=function(){return n(r),r}}else{var i=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}}},function(e,t){function n(e,t){var n=t||0,i=r;return[i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]]].join("")}for(var r=[],i=0;i<256;++i)r[i]=(i+256).toString(16).substr(1);e.exports=n},function(e,t,n){"use strict";function r(e){function t(e){for(var t=0,n=0;n100)){var t=/^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*f;case"weeks":case"week":case"w":return n*l;case"days":case"day":case"d":return n*c;case"hours":case"hour":case"hrs":case"hr":case"h":return n*u;case"minutes":case"minute":case"mins":case"min":case"m":return n*a;case"seconds":case"second":case"secs":case"sec":case"s":return n*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function r(e){var t=Math.abs(e);return t>=c?Math.round(e/c)+"d":t>=u?Math.round(e/u)+"h":t>=a?Math.round(e/a)+"m":t>=s?Math.round(e/s)+"s":e+"ms"}function i(e){var t=Math.abs(e);return t>=c?o(e,t,c,"day"):t>=u?o(e,t,u,"hour"):t>=a?o(e,t,a,"minute"):t>=s?o(e,t,s,"second"):e+" ms"}function o(e,t,n,r){var i=t>=1.5*n;return Math.round(e/n)+" "+r+(i?"s":"")}var s=1e3,a=60*s,u=60*a,c=24*u,l=7*c,f=365.25*c;e.exports=function(e,t){t=t||{};var o=typeof e;if("string"===o&&e.length>0)return n(e);if("number"===o&&!1===isNaN(e))return t.long?i(e):r(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,n){"use strict";var r=n(18),i=["Weapp"].concat(n(38));e.exports="LeanCloud-JS-SDK/"+r+" ("+i.join("; ")+")"},function(e,t,n){"use strict";e.exports=[]},function(e,t,n){function r(e){if(e)return i(e)}function i(e){for(var t in r.prototype)e[t]=r.prototype[t];return e}e.exports=r,r.prototype.on=r.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},r.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var r,i=0;i=this._maxRetries)return!1;if(this._retryCallback)try{var n=this._retryCallback(e,t);if(!0===n)return!0;if(!1===n)return!1}catch(e){console.error(e)}if(t&&t.status&&t.status>=500&&501!=t.status)return!0;if(e){if(e.code&&~s.indexOf(e.code))return!0;if(e.timeout&&"ECONNABORTED"==e.code)return!0;if(e.crossDomain)return!0}return!1},r.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this._end()},r.prototype.then=function(e,t){if(!this._fullfilledPromise){var n=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise(function(e,t){n.end(function(n,r){n?t(n):e(r)})})}return this._fullfilledPromise.then(e,t)},r.prototype.catch=function(e){return this.then(void 0,e)},r.prototype.use=function(e){return e(this),this},r.prototype.ok=function(e){if("function"!=typeof e)throw Error("Callback required");return this._okCallback=e,this},r.prototype._isResponseOK=function(e){return!!e&&(this._okCallback?this._okCallback(e):e.status>=200&&e.status<300)},r.prototype.get=function(e){return this._header[e.toLowerCase()]},r.prototype.getHeader=r.prototype.get,r.prototype.set=function(e,t){if(o(e)){for(var n in e)this.set(n,e[n]);return this}return this._header[e.toLowerCase()]=t,this.header[e]=t,this},r.prototype.unset=function(e){return delete this._header[e.toLowerCase()],delete this.header[e],this},r.prototype.field=function(e,t){if(null===e||void 0===e)throw new Error(".field(name, val) name can not be empty");if(this._data&&console.error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()"),o(e)){for(var n in e)this.field(n,e[n]);return this}if(Array.isArray(t)){for(var r in t)this.field(e,t[r]);return this}if(null===t||void 0===t)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof t&&(t=""+t),this._getFormData().append(e,t),this},r.prototype.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},r.prototype._auth=function(e,t,n,r){switch(n.type){case"basic":this.set("Authorization","Basic "+r(e+":"+t));break;case"auto":this.username=e,this.password=t;break;case"bearer":this.set("Authorization","Bearer "+e)}return this},r.prototype.withCredentials=function(e){return void 0==e&&(e=!0),this._withCredentials=e,this},r.prototype.redirects=function(e){return this._maxRedirects=e,this},r.prototype.maxResponseSize=function(e){if("number"!=typeof e)throw TypeError("Invalid argument");return this._maxResponseSize=e,this},r.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},r.prototype.send=function(e){var t=o(e),n=this._header["content-type"];if(this._formData&&console.error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()"),t&&!this._data)Array.isArray(e)?this._data=[]:this._isHost(e)||(this._data={});else if(e&&this._data&&this._isHost(this._data))throw Error("Can't merge these send calls");if(t&&o(this._data))for(var r in e)this._data[r]=e[r];else"string"==typeof e?(n||this.type("form"),n=this._header["content-type"],this._data="application/x-www-form-urlencoded"==n?this._data?this._data+"&"+e:e:(this._data||"")+e):this._data=e;return!t||this._isHost(e)?this:(n||this.type("json"),this)},r.prototype.sortQuery=function(e){return this._sort=void 0===e||e,this},r.prototype._finalizeQueryString=function(){var e=this._query.join("&");if(e&&(this.url+=(this.url.indexOf("?")>=0?"&":"?")+e),this._query.length=0,this._sort){var t=this.url.indexOf("?");if(t>=0){var n=this.url.substring(t+1).split("&");"function"==typeof this._sort?n.sort(this._sort):n.sort(),this.url=this.url.substring(0,t)+"?"+n.join("&")}}},r.prototype._appendQueryString=function(){console.trace("Unsupported")},r.prototype._timeoutError=function(e,t,n){if(!this._aborted){var r=new Error(e+t+"ms exceeded");r.timeout=t,r.code="ECONNABORTED",r.errno=n,this.timedout=!0,this.abort(),this.callback(r)}},r.prototype._setTimeouts=function(){var e=this;this._timeout&&!this._timer&&(this._timer=setTimeout(function(){e._timeoutError("Timeout of ",e._timeout,"ETIME")},this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout(function(){e._timeoutError("Response timeout of ",e._responseTimeout,"ETIMEDOUT")},this._responseTimeout))}},function(e,t,n){"use strict";function r(e){if(e)return i(e)}function i(e){for(var t in r.prototype)e[t]=r.prototype[t];return e}var o=n(42);e.exports=r,r.prototype.get=function(e){return this.header[e.toLowerCase()]},r.prototype._setHeaderProperties=function(e){var t=e["content-type"]||"";this.type=o.type(t);var n=o.params(t);for(var r in n)this[r]=n[r];this.links={};try{e.link&&(this.links=o.parseLinks(e.link))}catch(e){}},r.prototype._setStatusProperties=function(e){var t=e/100|0;this.status=this.statusCode=e,this.statusType=t,this.info=1==t,this.ok=2==t,this.redirect=3==t,this.clientError=4==t,this.serverError=5==t,this.error=(4==t||5==t)&&this.toError(),this.created=201==e,this.accepted=202==e,this.noContent=204==e,this.badRequest=400==e,this.unauthorized=401==e,this.notAcceptable=406==e,this.forbidden=403==e,this.notFound=404==e,this.unprocessableEntity=422==e}},function(e,t,n){"use strict";t.type=function(e){return e.split(/ *; */).shift()},t.params=function(e){return e.split(/ *; */).reduce(function(e,t){var n=t.split(/ *= */),r=n.shift(),i=n.shift();return r&&i&&(e[r]=i),e},{})},t.parseLinks=function(e){return e.split(/ *, */).reduce(function(e,t){var n=t.split(/ *; */),r=n[0].slice(1,-1);return e[n[1].split(/ *= */)[1].slice(1,-1)]=r,e},{})},t.cleanHeader=function(e,t){return delete e["content-type"],delete e["content-length"],delete e["transfer-encoding"],delete e.host,t&&(delete e.authorization,delete e.cookie),e}},function(e,t){function n(){this._defaults=[]}["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert"].forEach(function(e){n.prototype[e]=function(){return this._defaults.push({fn:e,arguments:arguments}),this}}),n.prototype._setDefaults=function(e){this._defaults.forEach(function(t){e[t.fn].apply(e,t.arguments)})},e.exports=n},function(e,t,n){(function(t){/*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) * @license Licensed under MIT license * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE * @version v4.2.3+b33f4734 */ !function(t,n){e.exports=n()}(0,function(){"use strict";function e(e){var t=typeof e;return null!==e&&("object"===t||"function"===t)}function r(e){return"function"==typeof e}function i(e){B=e}function o(e){V=e}function s(){return void 0!==q?function(){q(u)}:a()}function a(){var e=setTimeout;return function(){return e(u,1)}}function u(){for(var e=0;e1&&void 0!==arguments[1])||arguments[1];"string"!=typeof e?c(i._config.serverURLs,e):i._config.serverURLs=f(e),t&&(i._appRouter?i._appRouter.disable():h=!0)},i.setServerURLs=function(e){return i._setServerURLs(e)},i.keepErrorRawMessage=function(e){i._sharedConfig.keepErrorRawMessage=e},i.setRequestTimeout=function(e){i._config.requestTimeout=e},i.initialize=i.init,["applicationId","applicationKey","masterKey","hookKey"].forEach(function(e){return Object.defineProperty(i,e,{get:function(){return i._config[e]},set:function(t){i._config[e]=t}})})},function(e,t,n){"use strict";function r(e){var t=this;this.AV=e,this.lockedUntil=0,s.getAsync("serverURLs").then(function(e){if(!t.disabled){if(!e)return t.lock(0);var n=e.serverURLs,r=e.lockedUntil;t.AV._setServerURLs(n,!1),t.lockedUntil=r}}).catch(function(){return t.lock(0)})}var i=n(3),o=i.ajax,s=n(21);r.prototype.disable=function(){this.disabled=!0},r.prototype.lock=function(e){this.lockedUntil=Date.now()+e},r.prototype.refresh=function(){var e=this;if(!(this.disabled||Date.now()90)throw new Error("AV.GeoPoint latitude "+e+" > 90.0.");if(t<-180)throw new Error("AV.GeoPoint longitude "+t+" < -180.0.");if(t>180)throw new Error("AV.GeoPoint longitude "+t+" > 180.0.")},e.GeoPoint.current=function(){return new i(function(t,n){navigator.geolocation.getCurrentPosition(function(n){t(new e.GeoPoint({latitude:n.coords.latitude,longitude:n.coords.longitude}))},n)})},r.extend(e.GeoPoint.prototype,{toJSON:function(){return e.GeoPoint._validate(this.latitude,this.longitude),{__type:"GeoPoint",latitude:this.latitude,longitude:this.longitude}},radiansTo:function(e){var t=Math.PI/180,n=this.latitude*t,r=this.longitude*t,i=e.latitude*t,o=e.longitude*t,s=n-i,a=r-o,u=Math.sin(s/2),c=Math.sin(a/2),l=u*u+Math.cos(n)*Math.cos(i)*c*c;return l=Math.min(1,l),2*Math.asin(Math.sqrt(l))},kilometersTo:function(e){return 6371*this.radiansTo(e)},milesTo:function(e){return 3958.8*this.radiansTo(e)}})}},function(e,t,n){"use strict";var r=n(0);e.exports=function(e){e.ACL=function(t){var n=this;if(n.permissionsById={},r.isObject(t))if(t instanceof e.User)n.setReadAccess(t,!0),n.setWriteAccess(t,!0);else{if(r.isFunction(t))throw new Error("AV.ACL() called with a function. Did you forget ()?");e._objectEach(t,function(t,i){if(!r.isString(i))throw new Error("Tried to create an ACL with an invalid userId.");n.permissionsById[i]={},e._objectEach(t,function(e,t){if("read"!==t&&"write"!==t)throw new Error("Tried to create an ACL with an invalid permission type.");if(!r.isBoolean(e))throw new Error("Tried to create an ACL with an invalid permission value.");n.permissionsById[i][t]=e})})}},e.ACL.prototype.toJSON=function(){return r.clone(this.permissionsById)},e.ACL.prototype._setAccess=function(t,n,i){if(n instanceof e.User?n=n.id:n instanceof e.Role&&(n="role:"+n.getName()),!r.isString(n))throw new Error("userId must be a string.");if(!r.isBoolean(i))throw new Error("allowed must be either true or false.");var o=this.permissionsById[n];if(!o){if(!i)return;o={},this.permissionsById[n]=o}i?this.permissionsById[n][t]=!0:(delete o[t],r.isEmpty(o)&&delete this.permissionsById[n])},e.ACL.prototype._getAccess=function(t,n){n instanceof e.User?n=n.id:n instanceof e.Role&&(n="role:"+n.getName());var r=this.permissionsById[n];return!!r&&!!r[t]},e.ACL.prototype.setReadAccess=function(e,t){this._setAccess("read",e,t)},e.ACL.prototype.getReadAccess=function(e){return this._getAccess("read",e)},e.ACL.prototype.setWriteAccess=function(e,t){this._setAccess("write",e,t)},e.ACL.prototype.getWriteAccess=function(e){return this._getAccess("write",e)},e.ACL.prototype.setPublicReadAccess=function(e){this.setReadAccess("*",e)},e.ACL.prototype.getPublicReadAccess=function(){return this.getReadAccess("*")},e.ACL.prototype.setPublicWriteAccess=function(e){this.setWriteAccess("*",e)},e.ACL.prototype.getPublicWriteAccess=function(){return this.getWriteAccess("*")},e.ACL.prototype.getRoleReadAccess=function(t){if(t instanceof e.Role&&(t=t.getName()),r.isString(t))return this.getReadAccess("role:"+t);throw new Error("role must be a AV.Role or a String")},e.ACL.prototype.getRoleWriteAccess=function(t){if(t instanceof e.Role&&(t=t.getName()),r.isString(t))return this.getWriteAccess("role:"+t);throw new Error("role must be a AV.Role or a String")},e.ACL.prototype.setRoleReadAccess=function(t,n){if(t instanceof e.Role&&(t=t.getName()),r.isString(t))return void this.setReadAccess("role:"+t,n);throw new Error("role must be a AV.Role or a String")},e.ACL.prototype.setRoleWriteAccess=function(t,n){if(t instanceof e.Role&&(t=t.getName()),r.isString(t))return void this.setWriteAccess("role:"+t,n);throw new Error("role must be a AV.Role or a String")}}},function(e,t,n){"use strict";var r=n(0);e.exports=function(e){e.Op=function(){this._initialize.apply(this,arguments)},r.extend(e.Op.prototype,{_initialize:function(){}}),r.extend(e.Op,{_extend:e._extend,_opDecoderMap:{},_registerDecoder:function(t,n){e.Op._opDecoderMap[t]=n},_decode:function(t){var n=e.Op._opDecoderMap[t.__op];return n?n(t):void 0}}),e.Op._registerDecoder("Batch",function(t){var n=null;return e._arrayEach(t.ops,function(t){t=e.Op._decode(t),n=t._mergeWithPrevious(n)}),n}),e.Op.Set=e.Op._extend({_initialize:function(e){this._value=e},value:function(){return this._value},toJSON:function(){return e._encode(this.value())},_mergeWithPrevious:function(e){return this},_estimate:function(e){return this.value()}}),e.Op._UNSET={},e.Op.Unset=e.Op._extend({toJSON:function(){return{__op:"Delete"}},_mergeWithPrevious:function(e){return this},_estimate:function(t){return e.Op._UNSET}}),e.Op._registerDecoder("Delete",function(t){return new e.Op.Unset}),e.Op.Increment=e.Op._extend({_initialize:function(e){this._amount=e},amount:function(){return this._amount},toJSON:function(){return{__op:"Increment",amount:this._amount}},_mergeWithPrevious:function(t){if(t){if(t instanceof e.Op.Unset)return new e.Op.Set(this.amount());if(t instanceof e.Op.Set)return new e.Op.Set(t.value()+this.amount());if(t instanceof e.Op.Increment)return new e.Op.Increment(this.amount()+t.amount());throw new Error("Op is invalid after previous op.")}return this},_estimate:function(e){return e?e+this.amount():this.amount()}}),e.Op._registerDecoder("Increment",function(t){return new e.Op.Increment(t.amount)}),e.Op.BitAnd=e.Op._extend({_initialize:function(e){this._value=e},value:function(){return this._value},toJSON:function(){return{__op:"BitAnd",value:this.value()}},_mergeWithPrevious:function(t){if(t){if(t instanceof e.Op.Unset)return new e.Op.Set(0);if(t instanceof e.Op.Set)return new e.Op.Set(t.value()&this.value());throw new Error("Op is invalid after previous op.")}return this},_estimate:function(e){return e&this.value()}}),e.Op._registerDecoder("BitAnd",function(t){return new e.Op.BitAnd(t.value)}),e.Op.BitOr=e.Op._extend({_initialize:function(e){this._value=e},value:function(){return this._value},toJSON:function(){return{__op:"BitOr",value:this.value()}},_mergeWithPrevious:function(t){if(t){if(t instanceof e.Op.Unset)return new e.Op.Set(this.value());if(t instanceof e.Op.Set)return new e.Op.Set(t.value()|this.value());throw new Error("Op is invalid after previous op.")}return this},_estimate:function(e){return e|this.value()}}),e.Op._registerDecoder("BitOr",function(t){return new e.Op.BitOr(t.value)}),e.Op.BitXor=e.Op._extend({_initialize:function(e){this._value=e},value:function(){return this._value},toJSON:function(){return{__op:"BitXor",value:this.value()}},_mergeWithPrevious:function(t){if(t){if(t instanceof e.Op.Unset)return new e.Op.Set(this.value());if(t instanceof e.Op.Set)return new e.Op.Set(t.value()^this.value());throw new Error("Op is invalid after previous op.")}return this},_estimate:function(e){return e^this.value()}}),e.Op._registerDecoder("BitXor",function(t){return new e.Op.BitXor(t.value)}),e.Op.Add=e.Op._extend({_initialize:function(e){this._objects=e},objects:function(){return this._objects},toJSON:function(){return{__op:"Add",objects:e._encode(this.objects())}},_mergeWithPrevious:function(t){if(t){if(t instanceof e.Op.Unset)return new e.Op.Set(this.objects());if(t instanceof e.Op.Set)return new e.Op.Set(this._estimate(t.value()));if(t instanceof e.Op.Add)return new e.Op.Add(t.objects().concat(this.objects()));throw new Error("Op is invalid after previous op.")}return this},_estimate:function(e){return e?e.concat(this.objects()):r.clone(this.objects())}}),e.Op._registerDecoder("Add",function(t){return new e.Op.Add(e._decode(t.objects))}),e.Op.AddUnique=e.Op._extend({_initialize:function(e){this._objects=r.uniq(e)},objects:function(){return this._objects},toJSON:function(){return{__op:"AddUnique",objects:e._encode(this.objects())}},_mergeWithPrevious:function(t){if(t){if(t instanceof e.Op.Unset)return new e.Op.Set(this.objects());if(t instanceof e.Op.Set)return new e.Op.Set(this._estimate(t.value()));if(t instanceof e.Op.AddUnique)return new e.Op.AddUnique(this._estimate(t.objects()));throw new Error("Op is invalid after previous op.")}return this},_estimate:function(t){if(t){var n=r.clone(t);return e._arrayEach(this.objects(),function(t){if(t instanceof e.Object&&t.id){var i=r.find(n,function(n){return n instanceof e.Object&&n.id===t.id});if(i){var o=r.indexOf(n,i);n[o]=t}else n.push(t)}else r.contains(n,t)||n.push(t)}),n}return r.clone(this.objects())}}),e.Op._registerDecoder("AddUnique",function(t){return new e.Op.AddUnique(e._decode(t.objects))}),e.Op.Remove=e.Op._extend({_initialize:function(e){this._objects=r.uniq(e)},objects:function(){return this._objects},toJSON:function(){return{__op:"Remove",objects:e._encode(this.objects())}},_mergeWithPrevious:function(t){if(t){if(t instanceof e.Op.Unset)return t;if(t instanceof e.Op.Set)return new e.Op.Set(this._estimate(t.value()));if(t instanceof e.Op.Remove)return new e.Op.Remove(r.union(t.objects(),this.objects()));throw new Error("Op is invalid after previous op.")}return this},_estimate:function(t){if(t){var n=r.difference(t,this.objects());return e._arrayEach(this.objects(),function(t){t instanceof e.Object&&t.id&&(n=r.reject(n,function(n){return n instanceof e.Object&&n.id===t.id}))}),n}return[]}}),e.Op._registerDecoder("Remove",function(t){return new e.Op.Remove(e._decode(t.objects))}),e.Op.Relation=e.Op._extend({_initialize:function(t,n){this._targetClassName=null;var i=this,o=function(t){if(t instanceof e.Object){if(!t.id)throw new Error("You can't add an unsaved AV.Object to a relation.");if(i._targetClassName||(i._targetClassName=t.className),i._targetClassName!==t.className)throw new Error("Tried to create a AV.Relation with 2 different types: "+i._targetClassName+" and "+t.className+".");return t.id}return t};this.relationsToAdd=r.uniq(r.map(t,o)),this.relationsToRemove=r.uniq(r.map(n,o))},added:function(){var t=this;return r.map(this.relationsToAdd,function(n){var r=e.Object._create(t._targetClassName);return r.id=n,r})},removed:function(){var t=this;return r.map(this.relationsToRemove,function(n){var r=e.Object._create(t._targetClassName);return r.id=n,r})},toJSON:function(){var e=null,t=null,n=this,i=function(e){return{__type:"Pointer",className:n._targetClassName,objectId:e}},o=null;return this.relationsToAdd.length>0&&(o=r.map(this.relationsToAdd,i),e={__op:"AddRelation",objects:o}),this.relationsToRemove.length>0&&(o=r.map(this.relationsToRemove,i),t={__op:"RemoveRelation",objects:o}),e&&t?{__op:"Batch",ops:[e,t]}:e||t||{}},_mergeWithPrevious:function(t){if(t){if(t instanceof e.Op.Unset)throw new Error("You can't modify a relation after deleting it.");if(t instanceof e.Op.Relation){if(t._targetClassName&&t._targetClassName!==this._targetClassName)throw new Error("Related object must be of class "+t._targetClassName+", but "+this._targetClassName+" was passed in.");var n=r.union(r.difference(t.relationsToAdd,this.relationsToRemove),this.relationsToAdd),i=r.union(r.difference(t.relationsToRemove,this.relationsToAdd),this.relationsToRemove),o=new e.Op.Relation(n,i);return o._targetClassName=this._targetClassName,o}throw new Error("Op is invalid after previous op.")}return this},_estimate:function(t,n,r){if(t){if(t instanceof e.Relation){if(this._targetClassName)if(t.targetClassName){if(t.targetClassName!==this._targetClassName)throw new Error("Related object must be a "+t.targetClassName+", but a "+this._targetClassName+" was passed in.")}else t.targetClassName=this._targetClassName;return t}throw new Error("Op is invalid after previous op.")}new e.Relation(n,r).targetClassName=this._targetClassName}}),e.Op._registerDecoder("AddRelation",function(t){return new e.Op.Relation(e._decode(t.objects),[])}),e.Op._registerDecoder("RemoveRelation",function(t){return new e.Op.Relation([],e._decode(t.objects))})}},function(e,t,n){"use strict";var r=n(0);e.exports=function(e){e.Relation=function(e,t){if(!r.isString(t))throw new TypeError("key must be a string");this.parent=e,this.key=t,this.targetClassName=null},e.Relation.reverseQuery=function(t,n,r){var i=new e.Query(t);return i.equalTo(n,r._toPointer()),i},r.extend(e.Relation.prototype,{_ensureParentAndKey:function(e,t){if(this.parent=this.parent||e,this.key=this.key||t,this.parent!==e)throw new Error("Internal Error. Relation retrieved from two different Objects.");if(this.key!==t)throw new Error("Internal Error. Relation retrieved from two different keys.")},add:function(t){r.isArray(t)||(t=[t]);var n=new e.Op.Relation(t,[]);this.parent.set(this.key,n),this.targetClassName=n._targetClassName},remove:function(t){r.isArray(t)||(t=[t]);var n=new e.Op.Relation([],t);this.parent.set(this.key,n),this.targetClassName=n._targetClassName},toJSON:function(){return{__type:"Relation",className:this.targetClassName}},query:function(){var t,n;return this.targetClassName?(t=e.Object._getSubclass(this.targetClassName),n=new e.Query(t)):(t=e.Object._getSubclass(this.parent.className),n=new e.Query(t),n._extraOptions.redirectClassNameForKey=this.key),n._addCondition("$relatedTo","object",this.parent._toPointer()),n._addCondition("$relatedTo","key",this.key),n}})}},function(e,t,n){"use strict";var r=n(0),i=n(56),o=n(57),s=n(58),a=n(4),u=n(2)._request,c=n(1),l=n(3),f=l.tap,h=l.transformFetchOptions,d=n(7)("leancloud:file"),p=n(62);e.exports=function(e){var t=function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)},n=function(e){return r.isString(e)?e.match(/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/)[4]:""},l=function(e){if(e<26)return String.fromCharCode(65+e);if(e<52)return String.fromCharCode(e-26+97);if(e<62)return String.fromCharCode(e-52+48);if(62===e)return"+";if(63===e)return"/";throw new Error("Tried to encode large digit "+e+" in base64.")},y=function(e){var t=[];return t.length=Math.ceil(e.length/3),r.times(t.length,function(n){var r=e[3*n],i=e[3*n+1]||0,o=e[3*n+2]||0,s=3*n+1>2&63),l(r<<4&48|i>>4&15),s?l(i<<2&60|o>>6&3):"=",a?l(63&o):"="].join("")}),t.join("")};e.File=function(t,i,o){if(this.attributes={name:t,url:"",metaData:{},base64:""},r.isString(i))throw new TypeError("Creating an AV.File from a String is not yet supported.");r.isArray(i)&&(this.attributes.metaData.size=i.length,i={base64:y(i)}),this._extName="",this._data=i,this._uploadHeaders={},i&&i.blob&&(this._extName=n(i.blob.uri)),"undefined"!=typeof Blob&&i instanceof Blob&&(i.size&&(this.attributes.metaData.size=i.size),i.name&&(this._extName=n(i.name)));var s=void 0;if(i&&i.owner)s=i.owner;else if(!e._config.disableCurrentUser)try{s=e.User.current()}catch(e){if("SYNC_API_NOT_AVAILABLE"!==e.code)throw e}this.attributes.metaData.owner=s?s.id:"unknown",this.set("mime_type",o)},e.File.withURL=function(t,n,r,i){if(!t||!n)throw new Error("Please provide file name and url");var o=new e.File(t,null,i);if(r)for(var s in r)o.attributes.metaData[s]||(o.attributes.metaData[s]=r[s]);return o.attributes.url=n,o.attributes.metaData.__source="external",o},e.File.createWithoutData=function(t){var n=new e.File;return n.id=t,n},r.extend(e.File.prototype,{className:"_File",_toFullJSON:function(t){var n=this,i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=r.clone(this.attributes);return e._objectEach(o,function(n,r){o[r]=e._encode(n,t,void 0,i)}),e._objectEach(this._operations,function(e,t){o[t]=e}),r.has(this,"id")&&(o.objectId=this.id),r(["createdAt","updatedAt"]).each(function(e){if(r.has(n,e)){var t=n[e];o[e]=r.isDate(t)?t.toJSON():t}}),i&&(o.__type="File"),o},toFullJSON:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this._toFullJSON(e)},toJSON:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[this];return this._toFullJSON(n,!1)},_toPointer:function(){return{__type:"Pointer",className:this.className,objectId:this.id}},getACL:function(){return this._acl},setACL:function(t){return t instanceof e.ACL?(this._acl=t,this):new a(a.OTHER_CAUSE,"ACL must be a AV.ACL.")},name:function(){return this.get("name")},url:function(){return this.get("url")},get:function(e){switch(e){case"objectId":return this.id;case"url":case"name":case"mime_type":case"metaData":case"createdAt":case"updatedAt":return this.attributes[e];default:return this.attributes.metaData[e]}},set:function(){for(var e=this,t=function(t,n){switch(t){case"name":case"url":case"mime_type":case"base64":case"metaData":e.attributes[t]=n;break;default:e.attributes.metaData[t]=n}},n=arguments.length,r=Array(n),i=0;i2&&void 0!==arguments[2]?arguments[2]:100,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"png",o=this.attributes.url;if(!o)throw new Error("Invalid url.");if(!e||!t||e<=0||t<=0)throw new Error("Invalid width or height value.");if(n<=0||n>100)throw new Error("Invalid quality value.");return o+"?imageView/"+(r?2:1)+"/w/"+e+"/h/"+t+"/q/"+n+"/format/"+i},size:function(){return this.metaData().size},ownerId:function(){return this.metaData().owner},destroy:function(e){return this.id?u("files",null,this.id,"DELETE",null,e):c.reject(new Error("The file id does not eixst."))},_fileToken:function(e,r){var i=this.attributes.name,o=n(i);!o&&this._extName&&(i+=this._extName,o=this._extName);var s=t()+t()+t()+t()+t()+o,a={key:s,name:i,keep_file_name:r.keepFileName,ACL:this._acl,mime_type:e,metaData:this.attributes.metaData};return this._qiniu_key=s,u("fileTokens",null,null,"POST",a,r)},save:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.id)throw new Error("File is already saved.");if(!this._previousSave)if(this._data){var n=this.get("mime_type");this._previousSave=this._fileToken(n,t).then(function(a){return a.mime_type&&(n=a.mime_type,e.set("mime_type",n)),e._token=a.token,c.resolve().then(function(){var t=e._data;if(t&&t.base64)return p(t.base64,n);if(t&&t.blob)return!t.blob.type&&n&&(t.blob.type=n),t.blob.name||(t.blob.name=e.get("name")),t.blob;if("undefined"!=typeof Blob&&t instanceof Blob)return t;throw new TypeError("malformed file data")}).then(function(n){var u=r.extend({},t);switch(t.onprogress&&(u.onprogress=function(e){if("download"!==e.direction)return t.onprogress(e)}),a.provider){case"s3":return s(a,n,e,u);case"qcloud":return i(a,n,e,u);case"qiniu":default:return o(a,n,e,u)}}).then(f(function(){return e._callback(!0)}),function(t){throw e._callback(!1),t})})}else if(this.attributes.url&&"external"===this.attributes.metaData.__source){var a={name:this.attributes.name,ACL:this._acl,metaData:this.attributes.metaData,mime_type:this.mimeType,url:this.attributes.url};this._previousSave=u("files",this.attributes.name,null,"post",a,t).then(function(t){return e.attributes.name=t.name,e.attributes.url=t.url,e.id=t.objectId,t.size&&(e.attributes.metaData.size=t.size),e})}return this._previousSave},_callback:function(e){u("fileCallback",null,null,"post",{token:this._token,result:e}).catch(d),delete this._token,delete this._data},fetch:function(e,t){return u("files",null,this.id,"GET",h(e),t).then(this._finishFetch.bind(this))},_finishFetch:function(t){var n=e.Object.prototype.parse(t);return n.attributes={name:n.name,url:n.url,mime_type:n.mime_type,bucket:n.bucket},n.attributes.metaData=n.metaData||{},n.id=n.objectId,delete n.objectId,delete n.metaData,delete n.url,delete n.name,delete n.mime_type,delete n.bucket,r.extend(this,n),this}})}},function(e,t,n){"use strict";var r=n(8),i=n(7)("cos"),o=n(1);e.exports=function(e,t,n){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};n.attributes.url=e.url,n._bucket=e.bucket,n.id=e.objectId;var a=e.upload_url+"?sign="+encodeURIComponent(e.token);return new o(function(e,o){var u=r("POST",a).set(n._uploadHeaders).attach("fileContent",t,n.attributes.name).field("op","upload");s.onprogress&&u.on("progress",s.onprogress),u.end(function(t,r){if(r&&i(r.status,r.body,r.text),t)return r&&(t.statusCode=r.status,t.responseText=r.text,t.response=r.body),o(t);e(n)})})}},function(e,t,n){"use strict";var r=n(8),i=n(1),o=n(7)("qiniu");e.exports=function(e,t,n){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};n.attributes.url=e.url,n._bucket=e.bucket,n.id=e.objectId;var a=e.token,u=e.upload_url||"https://upload.qiniup.com";return new i(function(i,c){var l=r("POST",u).set(n._uploadHeaders).attach("file",t,n.attributes.name).field("name",n.attributes.name).field("key",e.key||n._qiniu_key).field("token",a);s.onprogress&&l.on("progress",s.onprogress),l.end(function(e,t){if(t&&o(t.status,t.body,t.text),e)return t&&(e.statusCode=t.status,e.responseText=t.text,e.response=t.body),c(e);i(n)})})}},function(e,t,n){"use strict";var r=n(8),i=n(1),o=function(e,t){return t&&(e.statusCode=t.status,e.responseText=t.text,e.response=t.body),e};e.exports=function(e,t,n){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return n.attributes.url=e.url,n._bucket=e.bucket,n.id=e.objectId,new i(function(i,a){var u=r("PUT",e.upload_url).set(Object.assign({"Content-Type":n.get("mime_type"),"Cache-Control":"public, max-age=31536000"},n._uploadHeaders));s.onprogress&&u.on("progress",s.onprogress),u.on("response",function(e){if(e.ok)return i(n);a(o(e.error,e))}),u.on("error",function(e,t){return a(o(e,t))}),u.send(t).end()})}},function(e,t,n){!function(){var t=n(60),r=n(22).utf8,i=n(61),o=n(22).bin,s=function(e,n){e.constructor==String?e=n&&"binary"===n.encoding?o.stringToBytes(e):r.stringToBytes(e):i(e)?e=Array.prototype.slice.call(e,0):Array.isArray(e)||(e=e.toString());for(var a=t.bytesToWords(e),u=8*e.length,c=1732584193,l=-271733879,f=-1732584194,h=271733878,d=0;d>>24)|4278255360&(a[d]<<24|a[d]>>>8);a[u>>>5]|=128<>>9<<4)]=u;for(var p=s._ff,y=s._gg,m=s._hh,v=s._ii,d=0;d>>0,l=l+_>>>0,f=f+b>>>0,h=h+w>>>0}return t.endian([c,l,f,h])};s._ff=function(e,t,n,r,i,o,s){var a=e+(t&n|~t&r)+(i>>>0)+s;return(a<>>32-o)+t},s._gg=function(e,t,n,r,i,o,s){var a=e+(t&r|n&~r)+(i>>>0)+s;return(a<>>32-o)+t},s._hh=function(e,t,n,r,i,o,s){var a=e+(t^n^r)+(i>>>0)+s;return(a<>>32-o)+t},s._ii=function(e,t,n,r,i,o,s){var a=e+(n^(t|~r))+(i>>>0)+s;return(a<>>32-o)+t},s._blocksize=16,s._digestsize=16,e.exports=function(e,n){if(void 0===e||null===e)throw new Error("Illegal argument "+e);var r=t.wordsToBytes(s(e,n));return n&&n.asBytes?r:n&&n.asString?o.bytesToString(r):t.bytesToHex(r)}}()},function(e,t){!function(){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(e,t){return e<>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&n.rotl(e,8)|4278255360&n.rotl(e,24);for(var t=0;t0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,r=0;n>>5]|=e[n]<<24-r%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n>>6*(3-o)&63)):n.push("=");return n.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var n=[],r=0,i=0;r>>6-2*i);return n}};e.exports=n}()},function(e,t){function n(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function r(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&n(e.slice(0,0))}/*! * Determine if an object is a Buffer * * @author Feross Aboukhadijeh * @license MIT */ e.exports=function(e){return null!=e&&(n(e)||r(e)||!!e._isBuffer)}},function(e,t,n){"use strict";var r=function(e,t){var n;e.indexOf("base64")<0?n=atob(e):e.split(",")[0].indexOf("base64")>=0?(t=t||e.split(",")[0].split(":")[1].split(";")[0],n=atob(e.split(",")[1])):n=unescape(e.split(",")[1]);for(var r=new Uint8Array(n.length),i=0;i2&&void 0!==arguments[2]?arguments[2]:[];return this._toFullJSON(n,!1)},toFullJSON:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this._toFullJSON(e)},_toFullJSON:function(t){var n=this,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=o.clone(this.attributes);if(o.isArray(t))var s=t.concat(this);return e._objectEach(i,function(t,n){i[n]=e._encode(t,s,void 0,r)}),e._objectEach(this._operations,function(e,t){i[t]=e}),o.has(this,"id")&&(i.objectId=this.id),o(["createdAt","updatedAt"]).each(function(e){if(o.has(n,e)){var t=n[e];i[e]=o.isDate(t)?t.toJSON():t}}),r&&(i.__type="Object",o.isArray(t)&&t.length&&(i.__type="Pointer"),i.className=this.className),i},_refreshCache:function(){var t=this;t._refreshingCache||(t._refreshingCache=!0,e._objectEach(this.attributes,function(n,r){n instanceof e.Object?n._refreshCache():o.isObject(n)&&t._resetCacheForKey(r)&&t.set(r,new e.Op.Set(n),{silent:!0})}),delete t._refreshingCache)},dirty:function(e){this._refreshCache();var t=o.last(this._opSetQueue);return e?!!t[e]:!this.id||o.keys(t).length>0},_toPointer:function(){return{__type:"Pointer",className:this.className,objectId:this.id}},get:function(e){switch(e){case"objectId":return this.id;case"createdAt":case"updatedAt":return this[e];default:return this.attributes[e]}},relation:function(t){var n=this.get(t);if(n){if(!(n instanceof e.Relation))throw new Error("Called relation() on non-relation field "+t);return n._ensureParentAndKey(this,t),n}return new e.Relation(this,t)},escape:function(e){var t=this._escapedAttributes[e];if(t)return t;var n,r=this.attributes[e];return n=f(r)?"":o.escape(r.toString()),this._escapedAttributes[e]=n,n},has:function(e){return!f(this.attributes[e])},_mergeMagicFields:function(t){var n=this,r=["objectId","createdAt","updatedAt"];return e._arrayEach(r,function(r){t[r]&&("objectId"===r?n.id=t[r]:"createdAt"!==r&&"updatedAt"!==r||o.isDate(t[r])?n[r]=t[r]:n[r]=e._parseDate(t[r]),delete t[r])}),t},_startSave:function(){this._opSetQueue.push({})},_cancelSave:function(){var t=o.first(this._opSetQueue);this._opSetQueue=o.rest(this._opSetQueue);var n=o.first(this._opSetQueue);e._objectEach(t,function(e,r){var i=t[r],o=n[r];i&&o?n[r]=o._mergeWithPrevious(i):i&&(n[r]=i)}),this._saving=this._saving-1},_finishSave:function(t){var n={};e._traverse(this.attributes,function(t){t instanceof e.Object&&t.id&&t._hasData&&(n[t.id]=t)});var r=o.first(this._opSetQueue);this._opSetQueue=o.rest(this._opSetQueue),this._applyOpSet(r,this._serverData),this._mergeMagicFields(t);var i=this;e._objectEach(t,function(t,r){i._serverData[r]=e._decode(t,r);var o=e._traverse(i._serverData[r],function(t){if(t instanceof e.Object&&n[t.id])return n[t.id]});o&&(i._serverData[r]=o)}),this._rebuildAllEstimatedData();var s=this._opSetQueue.map(o.clone);this._refreshCache(),this._opSetQueue=s,this._saving=this._saving-1},_finishFetch:function(t,n){this._opSetQueue=[{}],this._mergeMagicFields(t);var r=this;e._objectEach(t,function(t,n){r._serverData[n]=e._decode(t,n)}),this._rebuildAllEstimatedData(),this._refreshCache(),this._opSetQueue=[{}],this._hasData=n},_applyOpSet:function(t,n){var r=this;e._objectEach(t,function(t,o){var s=y(n,o),a=i(s,3),u=a[0],c=a[1],l=a[2];p(n,o,t._estimate(u,r,o)),c&&c[l]===e.Op._UNSET&&delete c[l]})},_resetCacheForKey:function(t){var n=this.attributes[t];if(o.isObject(n)&&!(n instanceof e.Object)&&!(n instanceof e.File)){var r=JSON.stringify(v(n));if(this._hashedJSON[t]!==r){var i=!!this._hashedJSON[t];return this._hashedJSON[t]=r,i}}return!1},_rebuildEstimatedDataForKey:function(t){var n=this;delete this.attributes[t],this._serverData[t]&&(this.attributes[t]=this._serverData[t]),e._arrayEach(this._opSetQueue,function(r){var o=r[t];if(o){var s=y(n.attributes,t),a=i(s,4),u=a[0],c=a[1],l=a[2],f=a[3];p(n.attributes,t,o._estimate(u,n,t)),c&&c[l]===e.Op._UNSET&&delete c[l],n._resetCacheForKey(f)}})},_rebuildAllEstimatedData:function(){var t=this,n=o.clone(this.attributes);this.attributes=o.clone(this._serverData),e._arrayEach(this._opSetQueue,function(n){t._applyOpSet(n,t.attributes),e._objectEach(n,function(e,n){t._resetCacheForKey(n)})}),e._objectEach(n,function(e,n){t.attributes[n]!==e&&t.trigger("change:"+n,t,t.attributes[n],{})}),e._objectEach(this.attributes,function(e,r){o.has(n,r)||t.trigger("change:"+r,t,e,{})})},set:function(t,n,r){var i;if(o.isObject(t)||f(t)?(i=o.mapObject(t,function(t,n){return _(n),e._decode(t,n)}),r=n):(i={},_(t),i[t]=e._decode(n,t)),r=r||{},!i)return this;i instanceof e.Object&&(i=i.attributes),r.unset&&e._objectEach(i,function(t,n){i[n]=new e.Op.Unset});var s=o.clone(i),a=this;e._objectEach(s,function(t,n){t instanceof e.Op&&(s[n]=t._estimate(a.attributes[n],a,n),s[n]===e.Op._UNSET&&delete s[n])}),this._validate(i,r),r.changes={};var u=this._escapedAttributes;return e._arrayEach(o.keys(i),function(t){var n=i[t];n instanceof e.Relation&&(n.parent=a),n instanceof e.Op||(n=new e.Op.Set(n));var s=!0;n instanceof e.Op.Set&&o.isEqual(a.attributes[t],n.value)&&(s=!1),s&&(delete u[t],r.silent?a._silent[t]=!0:r.changes[t]=!0);var c=o.last(a._opSetQueue);c[t]=n._mergeWithPrevious(c[t]),a._rebuildEstimatedDataForKey(t),s?(a.changed[t]=a.attributes[t],r.silent||(a._pending[t]=!0)):(delete a.changed[t],delete a._pending[t])}),r.silent||this.change(r),this},unset:function(e,t){return t=t||{},t.unset=!0,this.set(e,null,t)},increment:function(t,n){return(o.isUndefined(n)||o.isNull(n))&&(n=1),this.set(t,new e.Op.Increment(n))},add:function(t,n){return this.set(t,new e.Op.Add(h(n)))},addUnique:function(t,n){return this.set(t,new e.Op.AddUnique(h(n)))},remove:function(t,n){return this.set(t,new e.Op.Remove(h(n)))},bitAnd:function(t,n){return this.set(t,new e.Op.BitAnd(n))},bitOr:function(t,n){return this.set(t,new e.Op.BitOr(n))},bitXor:function(t,n){return this.set(t,new e.Op.BitXor(n))},op:function(e){return o.last(this._opSetQueue)[e]},clear:function(e){e=e||{},e.unset=!0;var t=o.extend(this.attributes,this._operations);return this.set(t,e)},revert:function(e){var t=o.last(this._opSetQueue);return h(e||o.keys(t)).forEach(function(e){delete t[e]}),this._rebuildAllEstimatedData(),this},_getSaveJSON:function(){var t=o.clone(o.first(this._opSetQueue));return e._objectEach(t,function(e,n){t[n]=e.toJSON()}),t},_canBeSerialized:function(){return e.Object._canBeSerializedAsValue(this.attributes)},fetch:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1],n=this;return c("classes",this.className,this.id,"GET",d(e),t).then(function(t){var r=n.parse(t);return e.keys||n._cleanupUnsetKeys(r),n._finishFetch(r,!0),n})},_cleanupUnsetKeys:function(t){var n=this;e._objectEach(this._serverData,function(e,r){void 0===t[r]&&delete n._serverData[r]})},save:function(t,n,r){var i,s,u;o.isObject(t)||f(t)?(i=t,u=n):(i={},i[t]=n,u=r),u=o.clone(u)||{},u.wait&&(s=o.clone(this.attributes));var l=o.clone(u)||{};l.wait&&(l.silent=!0),i&&this.set(i,l);var h=this,d=[],p=[];return e.Object._findUnsavedChildren(h,d,p),d.length+p.length>1?e.Object._deepSaveAsync(this,h,u):(this._startSave(),this._saving=(this._saving||0)+1,this._allPreviousSaves=this._allPreviousSaves||a.resolve(),this._allPreviousSaves=this._allPreviousSaves.catch(function(e){}).then(function(){var e=h.id?"PUT":"POST",t=h._getSaveJSON(),n={};if((h._fetchWhenSave||u.fetchWhenSave)&&(n.new="true"),u._failOnNotExist&&(n.failOnNotExist="true"),u.query){var r;if("function"==typeof u.query.toJSON&&(r=u.query.toJSON())&&(n.where=r.where),!n.where){throw new Error("options.query is not an AV.Query")}}o.extend(t,h._flags);var a="classes",f=h.className;"_User"!==h.className||h.id||(a="users",f=null);var d=u._makeRequest||c,p=d(a,f,h.id,e,t,u,n);return p=p.then(function(e){var t=h.parse(e);return u.wait&&(t=o.extend(i||{},t)),h._finishSave(t),u.wait&&h.set(s,l),h},function(e){throw h._cancelSave(),e})}),this._allPreviousSaves)},destroy:function(e){e=e||{};var t=this,n=function(){t.trigger("destroy",t,t.collection,e)};return this.id?(e.wait||n(),c("classes",this.className,this.id,"DELETE",this._flags,e).then(function(){return e.wait&&n(),t})):n()},parse:function(t){var n=o.clone(t);return o(["createdAt","updatedAt"]).each(function(t){n[t]&&(n[t]=e._parseDate(n[t]))}),n.createdAt&&!n.updatedAt&&(n.updatedAt=n.createdAt),n},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return!this.id},change:function(t){t=t||{};var n=this._changing;this._changing=!0;var r=this;e._objectEach(this._silent,function(e){r._pending[e]=!0});var i=o.extend({},t.changes,this._silent);if(this._silent={},e._objectEach(i,function(e,n){r.trigger("change:"+n,r,r.get(n),t)}),n)return this;for(var s=function(e,t){r._pending[t]||r._silent[t]||delete r.changed[t]};!o.isEmpty(this._pending);)this._pending={},this.trigger("change",this,t),e._objectEach(this.changed,s),r._previousAttributes=o.clone(this.attributes);return this._changing=!1,this},hasChanged:function(e){return arguments.length?this.changed&&o.has(this.changed,e):!o.isEmpty(this.changed)},changedAttributes:function(t){if(!t)return!!this.hasChanged()&&o.clone(this.changed);var n={},r=this._previousAttributes;return e._objectEach(t,function(e,t){o.isEqual(r[t],e)||(n[t]=e)}),n},previous:function(e){return arguments.length&&this._previousAttributes?this._previousAttributes[e]:null},previousAttributes:function(){return o.clone(this._previousAttributes)},isValid:function(){try{this.validate(this.attributes)}catch(e){return!1}return!0},validate:function(t){if(o.has(t,"ACL")&&!(t.ACL instanceof e.ACL))throw new s(s.OTHER_CAUSE,"ACL must be a AV.ACL.")},_validate:function(e,t){!t.silent&&this.validate&&(e=o.extend({},this.attributes,e),this.validate(e))},getACL:function(){return this.get("ACL")},setACL:function(e,t){return this.set("ACL",e,t)},disableBeforeHook:function(){this.ignoreHook("beforeSave"),this.ignoreHook("beforeUpdate"),this.ignoreHook("beforeDelete")},disableAfterHook:function(){this.ignoreHook("afterSave"),this.ignoreHook("afterUpdate"),this.ignoreHook("afterDelete")},ignoreHook:function(t){o.contains(["beforeSave","afterSave","beforeUpdate","afterUpdate","beforeDelete","afterDelete"],t)||console.trace("Unsupported hookName: "+t),e.hookKey||console.trace("ignoreHook required hookKey"),this._flags.__ignore_hooks||(this._flags.__ignore_hooks=[]),this._flags.__ignore_hooks.push(t)}}),e.Object.createWithoutData=function(t,n,r){var i=void 0;if(o.isString(t))i=e.Object._getSubclass(t);else{if(!(t.prototype&&t.prototype instanceof e.Object))throw new Error("class must be a string or a subclass of AV.Object.");i=t}var s=new i;return s.id=n,s._hasData=r,s},e.Object.destroyAll=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e||0===e.length)return a.resolve();var n=o.groupBy(e,function(e){return JSON.stringify({className:e.className,flags:e._flags})}),r={requests:o.map(n,function(e){var t=o.map(e,"id").join(",");return{method:"DELETE",path:"/1.1/classes/"+e[0].className+"/"+t,body:e[0]._flags}})};return c("batch",null,null,"POST",r,t).then(function(e){var t=o.find(e,function(e){return!e.success});if(t)throw new s(t.error.code,t.error.error)})},e.Object._getSubclass=function(t){if(!o.isString(t))throw new Error("AV.Object._getSubclass requires a string argument.");var n=e.Object._classMap[t];return n||(n=e.Object.extend(t),e.Object._classMap[t]=n),n},e.Object._create=function(t,n,r){return new(e.Object._getSubclass(t))(n,r)},e.Object._classMap={},e.Object._extend=e._extend,e.Object.new=function(t,n){return new e.Object(t,n)},e.Object.extend=function(t,n,r){if(!o.isString(t)){if(t&&o.has(t,"className"))return e.Object.extend(t.className,t,n);throw new Error("AV.Object.extend's first argument should be the className.")}"User"===t&&(t="_User");var i=null;if(o.has(e.Object._classMap,t)){var s=e.Object._classMap[t];if(!n&&!r)return s;i=s._extend(n,r)}else n=n||{},n._className=t,i=this._extend(n,r);return i.extend=function(n){if(o.isString(n)||n&&o.has(n,"className"))return e.Object.extend.apply(i,arguments);var r=[t].concat(o.toArray(arguments));return e.Object.extend.apply(i,r)},Object.defineProperty(i,"query",Object.getOwnPropertyDescriptor(e.Object,"query")),i.new=function(e,t){return new i(e,t)},e.Object._classMap[t]=i,i},Object.defineProperty(e.Object.prototype,"className",{get:function(){var e=this._className||this.constructor._LCClassName||this.constructor.name;return"User"===e?"_User":e}}),e.Object.register=function(t,n){if(!(t.prototype instanceof e.Object))throw new Error("registered class is not a subclass of AV.Object");var r=n||t.name;if(!r.length)throw new Error("registered class must be named");n&&(t._LCClassName=n),e.Object._classMap[r]=t},Object.defineProperty(e.Object,"query",{get:function(){return new e.Query(this.prototype.className)}}),e.Object._findUnsavedChildren=function(t,n,r){e._traverse(t,function(t){return t instanceof e.Object?void(t.dirty()&&n.push(t)):t instanceof e.File?void(t.id||r.push(t)):void 0})},e.Object._canBeSerializedAsValue=function(t){var n=!0;return t instanceof e.Object||t instanceof e.File?n=!!t.id:o.isArray(t)?e._arrayEach(t,function(t){e.Object._canBeSerializedAsValue(t)||(n=!1)}):o.isObject(t)&&e._objectEach(t,function(t){e.Object._canBeSerializedAsValue(t)||(n=!1)}),n},e.Object._deepSaveAsync=function(t,n,r){var i=[],u=[];e.Object._findUnsavedChildren(t,i,u);var l=a.resolve();o.each(u,function(e){l=l.then(function(){return e.save()})});var f=o.uniq(i),h=o.uniq(f);return l.then(function(){return a._continueWhile(function(){return h.length>0},function(){var t=[],n=[];if(e._arrayEach(h,function(e){if(t.length>20)return void n.push(e);e._canBeSerialized()?t.push(e):n.push(e)}),h=n,0===t.length)return a.reject(new s(s.OTHER_CAUSE,"Tried to save a batch with a cycle."));var i=a.resolve(o.map(t,function(e){return e._allPreviousSaves||a.resolve()})),u=i.then(function(){return c("batch",null,null,"POST",{requests:o.map(t,function(e){var t=e.id?"PUT":"POST",n=e._getSaveJSON();o.extend(n,e._flags);var r=e.className,i="/classes/"+r;"_User"!==e.className||e.id||(i="/users");var i="/1.1"+i;return e.id&&(i=i+"/"+e.id),e._startSave(),{method:t,path:i,body:n}})},r).then(function(e){var n=o.map(t,function(t,n){return e[n].success?(t._finishSave(t.parse(e[n].success)),t):(t._cancelSave(),new s(e[n].error.code,e[n].error.error))});return b(n)})});return e._arrayEach(t,function(e){e._allPreviousSaves=u}),u})}).then(function(){return t})}}},function(e,t,n){"use strict";var r=n(0),i=n(4);e.exports=function(e){e.Role=e.Object.extend("_Role",{constructor:function(t,n){if(r.isString(t)?(e.Object.prototype.constructor.call(this,null,null),this.setName(t)):e.Object.prototype.constructor.call(this,t,n),n){if(!(n instanceof e.ACL))throw new TypeError("acl must be an instance of AV.ACL");this.setACL(n)}},getName:function(){return this.get("name")},setName:function(e,t){return this.set("name",e,t)},getUsers:function(){return this.relation("users")},getRoles:function(){return this.relation("roles")},validate:function(t,n){if("name"in t&&t.name!==this.getName()){var o=t.name;if(this.id&&this.id!==t.objectId)return new i(i.OTHER_CAUSE,"A role's name can only be set before it has been saved.");if(!r.isString(o))return new i(i.OTHER_CAUSE,"A role's name must be a String.");if(!/^[0-9a-zA-Z\-_ ]+$/.test(o))return new i(i.OTHER_CAUSE,"A role's name can only contain alphanumeric characters, _, -, and spaces.")}return!!e.Object.prototype.validate&&e.Object.prototype.validate.call(this,t,n)}})}},function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var i=n(0),o=n(17),s=n(4),a=n(2),u=a._request,c=a.request,l=n(1),f=function(){if("undefined"==typeof wx||"function"!=typeof wx.login)throw new Error("Weapp Login is only available in Weapp");return new l(function(e,t){wx.login({success:function(n){var r=n.code,i=n.errMsg;r?e(r):t(new Error(i))},fail:function(){return t(new Error("wx.login 失败"))}})})},h=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.preferUnionId,r=t.unionIdPlatform,i=void 0===r?"weixin":r,o=t.asMainAccount,s=void 0===o||o;return n?{platform:i,main_account:s,code:e}:{code:e}},d=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.unionIdPlatform,o=void 0===r?"weixin":r,a=n.asMainAccount,u=void 0!==a&&a;if("string"!=typeof t)throw new s(s.OTHER_CAUSE,"unionId is not a string");if("string"!=typeof o)throw new s(s.OTHER_CAUSE,"unionIdPlatform is not a string");return i.extend({},e,{platform:o,unionid:t,main_account:Boolean(u)})};e.exports=function(e){e.User=e.Object.extend("_User",{_isCurrentUser:!1,_mergeMagicFields:function(t){return t.sessionToken&&(this._sessionToken=t.sessionToken,delete t.sessionToken),e.User.__super__._mergeMagicFields.call(this,t)},_cleanupAuthData:function(){if(this.isCurrent()){var t=this.get("authData");t&&e._objectEach(this.get("authData"),function(e,n){t[n]||delete t[n]})}},_synchronizeAllAuthData:function(){if(this.get("authData")){var t=this;e._objectEach(this.get("authData"),function(e,n){t._synchronizeAuthData(n)})}},_synchronizeAuthData:function(t){if(this.isCurrent()){var n;i.isString(t)?(n=t,t=e.User._authProviders[n]):n=t.getAuthType();var r=this.get("authData");if(r&&t){t.restoreAuthentication(r[n])||this.dissociateAuthData(t)}}},_handleSaveResult:function(t){return t&&!e._config.disableCurrentUser&&(this._isCurrentUser=!0),this._cleanupAuthData(),this._synchronizeAllAuthData(),delete this._serverData.password,this._rebuildEstimatedDataForKey("password"),this._refreshCache(),!t&&!this.isCurrent()||e._config.disableCurrentUser?l.resolve():l.resolve(e.User._saveCurrentUser(this))},_linkWith:function(t,n){var o,s=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},u=a.failOnNotExist,c=void 0!==u&&u;return i.isString(t)?(o=t,t=e.User._authProviders[t]):o=t.getAuthType(),n?this.save({authData:r({},o,n)},{fetchWhenSave:!!this.get("authData"),_failOnNotExist:c}).then(function(e){return e._handleSaveResult(!0).then(function(){return e})}):t.authenticate().then(function(e){return s._linkWith(t,e)})},associateWithAuthData:function(e,t){return this._linkWith(t,e)},associateWithAuthDataAndUnionId:function(e,t,n,r){return this._linkWith(t,d(e,n,r))},associateWithWeapp:function(e){var t=this;return f().then(function(n){return t._linkWith("lc_weapp",h(n,e))})},linkWithWeapp:function(e){return console.warn("DEPRECATED: User#linkWithWeapp 已废弃,请使用 User#associateWithWeapp 代替"),this.associateWithWeapp(e)},associateWithWeappWithUnionId:function(e,t){var n=this;return f().then(function(r){return n._linkWith("lc_weapp",d({code:r},e,t))})},dissociateAuthData:function(e){return this.unset("authData."+e),this.save().then(function(e){return e._handleSaveResult(!0).then(function(){return e})})},_unlinkFrom:function(e){return console.warn("DEPRECATED: User#_unlinkFrom 已废弃,请使用 User#dissociateAuthData 代替"),this.dissociateAuthData(e)},_isLinked:function(e){var t;return t=i.isString(e)?e:e.getAuthType(),!!(this.get("authData")||{})[t]},isAnonymous:function(){return this._isLinked("anonymous")},logOut:function(){this._logOutWithAll(),this._isCurrentUser=!1},_logOutWithAll:function(){if(this.get("authData")){var t=this;e._objectEach(this.get("authData"),function(e,n){t._logOutWith(n)})}},_logOutWith:function(t){this.isCurrent()&&(i.isString(t)&&(t=e.User._authProviders[t]),t&&t.deauthenticate&&t.deauthenticate())},signUp:function(e,t){var n=e&&e.username||this.get("username");if(!n||""===n)throw new s(s.OTHER_CAUSE,"Cannot sign up user with an empty name.");var r=e&&e.password||this.get("password");if(!r||""===r)throw new s(s.OTHER_CAUSE,"Cannot sign up user with an empty password.");return this.save(e,t).then(function(e){return e.isAnonymous()&&(e.unset("authData.anonymous"),e._opSetQueue=[{}]),e._handleSaveResult(!0).then(function(){return e})})},signUpOrlogInWithMobilePhone:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e&&e.mobilePhoneNumber||this.get("mobilePhoneNumber");if(!n||""===n)throw new s(s.OTHER_CAUSE,"Cannot sign up or login user by mobilePhoneNumber with an empty mobilePhoneNumber.");var r=e&&e.smsCode||this.get("smsCode");if(!r||""===r)throw new s(s.OTHER_CAUSE,"Cannot sign up or login user by mobilePhoneNumber with an empty smsCode.");return t._makeRequest=function(e,t,n,r,i){return u("usersByMobilePhone",null,null,"POST",i)},this.save(e,t).then(function(e){return delete e.attributes.smsCode,delete e._serverData.smsCode,e._handleSaveResult(!0).then(function(){return e})})},loginWithAuthData:function(e,t,n){return this._linkWith(t,e,n)},loginWithAuthDataAndUnionId:function(e,t,n,r){return this.loginWithAuthData(d(e,n,r),t,r)},loginWithWeapp:function(e){var t=this;return f().then(function(n){return t.loginWithAuthData(h(n,e),"lc_weapp",e)})},loginWithWeappWithUnionId:function(e,t){var n=this;return f().then(function(r){return n.loginWithAuthData(d({code:r},e,t),"lc_weapp",t)})},logIn:function(){var e=this;return u("login",null,null,"POST",this.toJSON()).then(function(t){var n=e.parse(t);return e._finishFetch(n),e._handleSaveResult(!0).then(function(){return n.smsCode||delete e.attributes.smsCode,e})})},save:function(t,n,r){var o,s;return i.isObject(t)||i.isNull(t)||i.isUndefined(t)?(o=t,s=n):(o={},o[t]=n,s=r),s=s||{},e.Object.prototype.save.call(this,o,s).then(function(e){return e._handleSaveResult(!1).then(function(){return e})})},follow:function(t,n){if(!this.id)throw new Error("Please signin.");var r=void 0,o=void 0;t.user?(r=t.user,o=t.attributes):r=t;var s=i.isString(r)?r:r.id;if(!s)throw new Error("Invalid target user.");var a="users/"+this.id+"/friendship/"+s;return u(a,null,null,"POST",e._encode(o),n)},unfollow:function(e,t){if(!this.id)throw new Error("Please signin.");var n=void 0;n=e.user?e.user:e;var r=i.isString(n)?n:n.id;if(!r)throw new Error("Invalid target user.");var o="users/"+this.id+"/friendship/"+r;return u(o,null,null,"DELETE",null,t)},followerQuery:function(){return e.User.followerQuery(this.id)},followeeQuery:function(){return e.User.followeeQuery(this.id)},fetch:function(t,n){return e.Object.prototype.fetch.call(this,t,n).then(function(e){return e._handleSaveResult(!1).then(function(){return e})})},updatePassword:function(e,t,n){var r="users/"+this.id+"/updatePassword";return u(r,null,null,"PUT",{old_password:e,new_password:t},n)},isCurrent:function(){return this._isCurrentUser},getUsername:function(){return this.get("username")},getMobilePhoneNumber:function(){return this.get("mobilePhoneNumber")},setMobilePhoneNumber:function(e,t){return this.set("mobilePhoneNumber",e,t)},setUsername:function(e,t){return this.set("username",e,t)},setPassword:function(e,t){return this.set("password",e,t)},getEmail:function(){return this.get("email")},setEmail:function(e,t){return this.set("email",e,t)},authenticated:function(){return console.warn("DEPRECATED: 如果要判断当前用户的登录状态是否有效,请使用 currentUser.isAuthenticated().then(),如果要判断该用户是否是当前登录用户,请使用 user.id === currentUser.id。"),!!this._sessionToken&&!e._config.disableCurrentUser&&e.User.current()&&e.User.current().id===this.id},isAuthenticated:function(){var t=this;return l.resolve().then(function(){return!!t._sessionToken&&e.User._fetchUserBySessionToken(t._sessionToken).then(function(){return!0},function(e){if(211===e.code)return!1;throw e})})},getSessionToken:function(){return this._sessionToken},refreshSessionToken:function(e){var t=this;return u("users/"+this.id+"/refreshSessionToken",null,null,"PUT",null,e).then(function(e){return t._finishFetch(e),t._handleSaveResult(!0).then(function(){return t})})},getRoles:function(t){return e.Relation.reverseQuery("_Role","users",this).find(t)}},{_currentUser:null,_currentUserMatchesDisk:!1,_CURRENT_USER_KEY:"currentUser",_authProviders:{},signUp:function(t,n,r,i){return r=r||{},r.username=t,r.password=n,e.Object._create("_User").signUp(r,i)},logIn:function(t,n){var r=e.Object._create("_User");return r._finishFetch({username:t,password:n}),r.logIn()},become:function(e){return this._fetchUserBySessionToken(e).then(function(e){return e._handleSaveResult(!0).then(function(){return e})})},_fetchUserBySessionToken:function(t){var n=e.Object._create("_User");return c({method:"GET",path:"/users/me",authOptions:{sessionToken:t}}).then(function(e){var t=n.parse(e);return n._finishFetch(t),n})},logInWithMobilePhoneSmsCode:function(t,n){var r=e.Object._create("_User");return r._finishFetch({mobilePhoneNumber:t,smsCode:n}),r.logIn()},signUpOrlogInWithMobilePhone:function(t,n,r,i){return r=r||{},r.mobilePhoneNumber=t,r.smsCode=n,e.Object._create("_User").signUpOrlogInWithMobilePhone(r,i)},logInWithMobilePhone:function(t,n){var r=e.Object._create("_User");return r._finishFetch({mobilePhoneNumber:t,password:n}),r.logIn()},loginWithEmail:function(t,n){var r=e.Object._create("_User");return r._finishFetch({email:t,password:n}),r.logIn()},loginWithAuthData:function(t,n,r){return e.User._logInWith(n,t,r)},signUpOrlogInWithAuthData:function(){return console.warn("DEPRECATED: User.signUpOrlogInWithAuthData 已废弃,请使用 User#loginWithAuthData 代替"),this.loginWithAuthData.apply(this,arguments)},loginWithAuthDataAndUnionId:function(e,t,n,r){return this.loginWithAuthData(d(e,n,r),t,r)},signUpOrlogInWithAuthDataAndUnionId:function(){return console.warn("DEPRECATED: User.signUpOrlogInWithAuthDataAndUnionId 已废弃,请使用 User#loginWithAuthDataAndUnionId 代替"),this.loginWithAuthDataAndUnionId.apply(this,arguments)},loginWithWeapp:function(e){var t=this;return f().then(function(n){return t.loginWithAuthData(h(n,e),"lc_weapp",e)})},loginWithWeappWithUnionId:function(e,t){var n=this;return f().then(function(r){return n.loginWithAuthData(d({code:r},e,t),"lc_weapp",t)})},loginAnonymously:function(){return this.loginWithAuthData({id:o()},"anonymous")},associateWithAuthData:function(e,t,n){return console.warn("DEPRECATED: User.associateWithAuthData 已废弃,请使用 User#associateWithAuthData 代替"),e._linkWith(t,n)},logOut:function(){return e._config.disableCurrentUser?(console.warn("AV.User.current() was disabled in multi-user environment, call logOut() from user object instead https://leancloud.cn/docs/leanengine-node-sdk-upgrade-1.html"),l.resolve(null)):(null!==e.User._currentUser&&(e.User._currentUser._logOutWithAll(),e.User._currentUser._isCurrentUser=!1),e.User._currentUserMatchesDisk=!0,e.User._currentUser=null,e.localStorage.removeItemAsync(e._getAVPath(e.User._CURRENT_USER_KEY)).then(function(){return e._refreshSubscriptionId()}))},followerQuery:function(t){if(!t||!i.isString(t))throw new Error("Invalid user object id.");var n=new e.FriendShipQuery("_Follower");return n._friendshipTag="follower",n.equalTo("user",e.Object.createWithoutData("_User",t)),n},followeeQuery:function(t){if(!t||!i.isString(t))throw new Error("Invalid user object id.");var n=new e.FriendShipQuery("_Followee");return n._friendshipTag="followee",n.equalTo("user",e.Object.createWithoutData("_User",t)),n},requestPasswordReset:function(e){return u("requestPasswordReset",null,null,"POST",{email:e})},requestEmailVerify:function(e){return u("requestEmailVerify",null,null,"POST",{email:e})},requestMobilePhoneVerify:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={mobilePhoneNumber:e};return t.validateToken&&(n.validate_token=t.validateToken),u("requestMobilePhoneVerify",null,null,"POST",n,t)},requestPasswordResetBySmsCode:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={mobilePhoneNumber:e};return t.validateToken&&(n.validate_token=t.validateToken),u("requestPasswordResetBySmsCode",null,null,"POST",n,t)},resetPasswordBySmsCode:function(e,t){return u("resetPasswordBySmsCode",null,e,"PUT",{password:t})},verifyMobilePhone:function(e){return u("verifyMobilePhone",null,e,"POST",null)},requestLoginSmsCode:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={mobilePhoneNumber:e};return t.validateToken&&(n.validate_token=t.validateToken),u("requestLoginSmsCode",null,null,"POST",n,t)},currentAsync:function(){return e._config.disableCurrentUser?(console.warn("AV.User.currentAsync() was disabled in multi-user environment, access user from request instead https://leancloud.cn/docs/leanengine-node-sdk-upgrade-1.html"),l.resolve(null)):e.User._currentUser?l.resolve(e.User._currentUser):e.User._currentUserMatchesDisk?l.resolve(e.User._currentUser):e.localStorage.getItemAsync(e._getAVPath(e.User._CURRENT_USER_KEY)).then(function(t){if(!t)return null;e.User._currentUserMatchesDisk=!0,e.User._currentUser=e.Object._create("_User"),e.User._currentUser._isCurrentUser=!0;var n=JSON.parse(t);return e.User._currentUser.id=n._id,delete n._id,e.User._currentUser._sessionToken=n._sessionToken,delete n._sessionToken,e.User._currentUser._finishFetch(n),e.User._currentUser._synchronizeAllAuthData(),e.User._currentUser._refreshCache(),e.User._currentUser._opSetQueue=[{}],e.User._currentUser})},current:function(){if(e._config.disableCurrentUser)return console.warn("AV.User.current() was disabled in multi-user environment, access user from request instead https://leancloud.cn/docs/leanengine-node-sdk-upgrade-1.html"),null;if(e.User._currentUser)return e.User._currentUser;if(e.User._currentUserMatchesDisk)return e.User._currentUser;e.User._currentUserMatchesDisk=!0;var t=e.localStorage.getItem(e._getAVPath(e.User._CURRENT_USER_KEY));if(!t)return null;e.User._currentUser=e.Object._create("_User"),e.User._currentUser._isCurrentUser=!0;var n=JSON.parse(t);return e.User._currentUser.id=n._id,delete n._id,e.User._currentUser._sessionToken=n._sessionToken,delete n._sessionToken,e.User._currentUser._finishFetch(n),e.User._currentUser._synchronizeAllAuthData(),e.User._currentUser._refreshCache(),e.User._currentUser._opSetQueue=[{}],e.User._currentUser},_saveCurrentUser:function(t){var n;return n=e.User._currentUser!==t?e.User.logOut():l.resolve(),n.then(function(){t._isCurrentUser=!0,e.User._currentUser=t;var n=t._toFullJSON();return n._id=t.id,n._sessionToken=t._sessionToken,e.localStorage.setItemAsync(e._getAVPath(e.User._CURRENT_USER_KEY),JSON.stringify(n)).then(function(){return e.User._currentUserMatchesDisk=!0,e._refreshSubscriptionId()})})},_registerAuthenticationProvider:function(t){e.User._authProviders[t.getAuthType()]=t,!e._config.disableCurrentUser&&e.User.current()&&e.User.current()._synchronizeAuthData(t.getAuthType())},_logInWith:function(t,n,r){return e.Object._create("_User")._linkWith(t,n,r)}})}},function(e,t,n){"use strict";var r=n(0),i=n(7)("leancloud:query"),o=n(1),s=n(4),a=n(2),u=a._request,c=a.request,l=n(3),f=l.ensureArray,h=l.transformFetchOptions,d=function(e,t){if(void 0===e)throw new Error(t)};e.exports=function(e){e.Query=function(t){r.isString(t)&&(t=e.Object._getSubclass(t)),this.objectClass=t,this.className=t.prototype.className,this._where={},this._include=[],this._select=[],this._limit=-1,this._skip=0,this._extraOptions={}},e.Query.or=function(){var t=r.toArray(arguments),n=null;e._arrayEach(t,function(e){if(r.isNull(n)&&(n=e.className),n!==e.className)throw new Error("All queries must be for the same class")});var i=new e.Query(n);return i._orQuery(t),i},e.Query.and=function(){var t=r.toArray(arguments),n=null;e._arrayEach(t,function(e){if(r.isNull(n)&&(n=e.className),n!==e.className)throw new Error("All queries must be for the same class")});var i=new e.Query(n);return i._andQuery(t),i},e.Query.doCloudQuery=function(t,n,i){var o={cql:t};return r.isArray(n)?o.pvalues=n:i=n,u("cloudQuery",null,null,"GET",o,i).then(function(t){var n=new e.Query(t.className);return{results:r.map(t.results,function(e){var r=n._newObject(t);return r._finishFetch&&r._finishFetch(n._processResult(e),!0),r}),count:t.count,className:t.className}})},e.Query._extend=e._extend,r.extend(e.Query.prototype,{_processResult:function(e){return e},get:function(e,t){if(!r.isString(e))throw new Error("objectId must be a string");if(""===e)return o.reject(new s(s.OBJECT_NOT_FOUND,"Object not found."));var n=this._newObject();n.id=e;var i=this.toJSON(),a={};return i.keys&&(a.keys=i.keys),i.include&&(a.include=i.include),i.includeACL&&(a.includeACL=i.includeACL),u("classes",this.className,e,"GET",h(a),t).then(function(e){if(r.isEmpty(e))throw new s(s.OBJECT_NOT_FOUND,"Object not found.");return n._finishFetch(n.parse(e),!0),n})},toJSON:function(){var t={where:this._where};return this._include.length>0&&(t.include=this._include.join(",")),this._select.length>0&&(t.keys=this._select.join(",")),void 0!==this._includeACL&&(t.returnACL=this._includeACL),this._limit>=0&&(t.limit=this._limit),this._skip>0&&(t.skip=this._skip),void 0!==this._order&&(t.order=this._order),e._objectEach(this._extraOptions,function(e,n){t[n]=e}),t},_newObject:function(t){return t&&t.className?new e.Object(t.className):new this.objectClass},_createRequest:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.toJSON(),t=arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"/classes/"+this.className;if(encodeURIComponent(JSON.stringify(e)).length>2e3){return c({path:"/batch",method:"POST",data:{requests:[{method:"GET",path:"/1.1"+n,params:e}]},authOptions:t}).then(function(e){var t=e[0];if(t.success)return t.success;var n=new Error(t.error.error||"Unknown batch error");throw n.code=t.error.code,n})}return c({method:"GET",path:n,query:e,authOptions:t})},_parseResponse:function(e){var t=this;return r.map(e.results,function(n){var r=t._newObject(e);return r._finishFetch&&r._finishFetch(t._processResult(n),!0),r})},find:function(e){return this._createRequest(void 0,e).then(this._parseResponse.bind(this))},scan:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.orderedBy,s=t.batchSize,a=arguments[1],c=this.toJSON();i("scan %O",c),c.order&&(console.warn("The order of the query is ignored for Query#scan. Checkout the orderedBy option of Query#scan."),delete c.order),c.skip&&(console.warn("The skip option of the query is ignored for Query#scan."),delete c.skip),c.limit&&(console.warn("The limit option of the query is ignored for Query#scan."),delete c.limit),n&&(c.scan_key=n),s&&(c.limit=s);var l=o.resolve([]),f=void 0,h=!1;return{next:function(){return l=l.then(function(t){return h?[]:t.length>1?t:f||0===t.length?u("scan/classes",e.className,null,"GET",f?r.extend({},c,{cursor:f}):c,a).then(function(t){return f=t.cursor,e._parseResponse(t)}).then(function(e){return e.length||(h=!0),t.concat(e)}):(h=!0,t)}),l.then(function(e){return e.shift()}).then(function(e){return{value:e,done:h}})}}},destroyAll:function(t){return this.find(t).then(function(n){return e.Object.destroyAll(n,t)})},count:function(e){var t=this.toJSON();return t.limit=0,t.count=1,this._createRequest(t,e).then(function(e){return e.count})},first:function(e){var t=this,n=this.toJSON();return n.limit=1,this._createRequest(n,e).then(function(e){return r.map(e.results,function(e){var n=t._newObject();return n._finishFetch&&n._finishFetch(t._processResult(e),!0),n})[0]})},skip:function(e){return d(e,"undefined is not a valid skip value"),this._skip=e,this},limit:function(e){return d(e,"undefined is not a valid limit value"),this._limit=e,this},equalTo:function(t,n){return d(t,"undefined is not a valid key"),d(n,"undefined is not a valid value"),this._where[t]=e._encode(n),this},_addCondition:function(t,n,r){return d(t,"undefined is not a valid condition key"),d(n,"undefined is not a valid condition"),d(r,"undefined is not a valid condition value"),this._where[t]||(this._where[t]={}),this._where[t][n]=e._encode(r),this},sizeEqualTo:function(e,t){return this._addCondition(e,"$size",t),this},notEqualTo:function(e,t){return this._addCondition(e,"$ne",t),this},lessThan:function(e,t){return this._addCondition(e,"$lt",t),this},greaterThan:function(e,t){return this._addCondition(e,"$gt",t),this},lessThanOrEqualTo:function(e,t){return this._addCondition(e,"$lte",t),this},greaterThanOrEqualTo:function(e,t){return this._addCondition(e,"$gte",t),this},containedIn:function(e,t){return this._addCondition(e,"$in",t),this},notContainedIn:function(e,t){return this._addCondition(e,"$nin",t),this},containsAll:function(e,t){return this._addCondition(e,"$all",t),this},exists:function(e){return this._addCondition(e,"$exists",!0),this},doesNotExist:function(e){return this._addCondition(e,"$exists",!1),this},matches:function(e,t,n){return this._addCondition(e,"$regex",t),n||(n=""),t.ignoreCase&&(n+="i"),t.multiline&&(n+="m"),n&&n.length&&this._addCondition(e,"$options",n),this},matchesQuery:function(e,t){var n=t.toJSON();return n.className=t.className,this._addCondition(e,"$inQuery",n),this},doesNotMatchQuery:function(e,t){var n=t.toJSON();return n.className=t.className,this._addCondition(e,"$notInQuery",n),this},matchesKeyInQuery:function(e,t,n){var r=n.toJSON();return r.className=n.className,this._addCondition(e,"$select",{key:t,query:r}),this},doesNotMatchKeyInQuery:function(e,t,n){var r=n.toJSON();return r.className=n.className,this._addCondition(e,"$dontSelect",{key:t,query:r}),this},_orQuery:function(e){var t=r.map(e,function(e){return e.toJSON().where});return this._where.$or=t,this},_andQuery:function(e){var t=r.map(e,function(e){return e.toJSON().where});return this._where.$and=t,this},_quote:function(e){return"\\Q"+e.replace("\\E","\\E\\\\E\\Q")+"\\E"},contains:function(e,t){return this._addCondition(e,"$regex",this._quote(t)),this},startsWith:function(e,t){return this._addCondition(e,"$regex","^"+this._quote(t)),this},endsWith:function(e,t){return this._addCondition(e,"$regex",this._quote(t)+"$"),this},ascending:function(e){return d(e,"undefined is not a valid key"),this._order=e,this},addAscending:function(e){return d(e,"undefined is not a valid key"),this._order?this._order+=","+e:this._order=e,this},descending:function(e){return d(e,"undefined is not a valid key"),this._order="-"+e,this},addDescending:function(e){return d(e,"undefined is not a valid key"),this._order?this._order+=",-"+e:this._order="-"+e,this},near:function(t,n){return n instanceof e.GeoPoint||(n=new e.GeoPoint(n)),this._addCondition(t,"$nearSphere",n),this},withinRadians:function(e,t,n){return this.near(e,t),this._addCondition(e,"$maxDistance",n),this},withinMiles:function(e,t,n){return this.withinRadians(e,t,n/3958.8)},withinKilometers:function(e,t,n){return this.withinRadians(e,t,n/6371)},withinGeoBox:function(t,n,r){return n instanceof e.GeoPoint||(n=new e.GeoPoint(n)),r instanceof e.GeoPoint||(r=new e.GeoPoint(r)),this._addCondition(t,"$within",{$box:[n,r]}),this},include:function(e){var t=this;return d(e,"undefined is not a valid key"),r(arguments).forEach(function(e){t._include=t._include.concat(f(e))}),this},includeACL:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._includeACL=e,this},select:function(e){var t=this;return d(e,"undefined is not a valid key"),r(arguments).forEach(function(e){t._select=t._select.concat(f(e))}),this},each:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._order||this._skip||this._limit>=0){var i=new Error("Cannot iterate on a query with sort, skip, or limit.");return o.reject(i)}var s=new e.Query(this.objectClass);s._limit=n.batchSize||100,s._where=r.clone(this._where),s._include=r.clone(this._include),s.ascending("objectId");var a=!1;return o._continueWhile(function(){return!a},function(){return s.find(n).then(function(e){var n=o.resolve();return r.each(e,function(e){n=n.then(function(){return t(e)})}),n.then(function(){e.length>=s._limit?s.greaterThan("objectId",e[e.length-1].id):a=!0})})})},subscribe:function(t){return e.LiveQuery.init(this,t)}}),e.FriendShipQuery=e.Query._extend({_newObject:function(){return new(e.Object._getSubclass("_User"))},_processResult:function(e){if(e&&e[this._friendshipTag]){var t=e[this._friendshipTag];return"Pointer"===t.__type&&"_User"===t.className&&(delete t.__type,delete t.className),t}return null}})}},function(e,t,n){"use strict";var r=n(0),i=n(68),o=n(1),s=n(3),a=s.inherits,u=n(2),c=u.request,l=function(e,t){return c({method:"POST",path:"/LiveQuery/subscribe",data:{query:e,id:t}})};e.exports=function(e){var t=function(){if(!e._config.realtime)throw new Error("LiveQuery not supported. Please use the LiveQuery bundle. https://url.leanapp.cn/enable-live-query")};e.LiveQuery=a(i,{constructor:function(e,t,n,r){var o=this;i.apply(this),this.id=e,this._client=t,this._client.register(this),this._queryJSON=n,this._subscriptionId=r,this._onMessage=this._dispatch.bind(this),this._onReconnect=function(){l(o._queryJSON,o._subscriptionId).catch(function(e){return console.error("LiveQuery resubscribe error: "+e.message)})},t.on("message",this._onMessage),t.on("reconnect",this._onReconnect)},_dispatch:function(t){var n=this;t.forEach(function(t){var i=t.op,o=t.object,s=t.query_id,a=t.updatedKeys;if(s===n.id){var u=e.parseJSON(r.extend({__type:"_File"===o.className?"File":"Object"},o));a?n.emit(i,u,a):n.emit(i,u)}})},unsubscribe:function(){var e=this._client;return e.off("message",this._onMessage),e.off("reconnect",this._onReconnect),e.deregister(this),c({method:"POST",path:"/LiveQuery/unsubscribe",data:{id:e.id,query_id:this.id}})}},{init:function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.subscriptionId,s=void 0===i?e._getSubscriptionId():i;if(t(),!(n instanceof e.Query))throw new TypeError("LiveQuery must be inited with a Query");return o.resolve(s).then(function(t){return e._config.realtime.createLiveQueryClient(t).then(function(r){var i=n.toJSON(),o=i.where,s=i.keys,a=i.returnACL,u={where:o,keys:s,returnACL:a,className:n.className},c=l(u,t).then(function(n){var i=n.query_id;return new e.LiveQuery(i,r,u,t)}).finally(function(){r.deregister(c)});return r.register(c),c})})},pause:function(){return t(),e._config.realtime.pause()},resume:function(){return t(),e._config.realtime.resume()}})}},function(e,t,n){"use strict";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(){this._events=new r,this._eventsCount=0}var s=Object.prototype.hasOwnProperty,a="~";Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(a=!1)),o.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)s.call(e,t)&&n.push(a?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},o.prototype.listeners=function(e,t){var n=a?a+e:e,r=this._events[n];if(t)return!!r;if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,s=new Array(o);i1&&void 0!==arguments[1]?arguments[1]:{};if(r.isString(e)&&(e={mobilePhoneNumber:e}),!e.mobilePhoneNumber)throw new Error("Missing mobilePhoneNumber.");return t.validateToken&&(e=r.extend({},e,{validate_token:t.validateToken})),o("requestSmsCode",null,null,"POST",e,t)},verifySmsCode:function(e,t){if(!e)throw new Error("Missing sms code.");var n={};return r.isString(t)&&(n.mobilePhoneNumber=t),o("verifySmsCode",e,null,"POST",n)},_requestCaptcha:function(e,t){return o("requestCaptcha",null,null,"GET",e,t).then(function(e){var t=e.captcha_url;return{captchaToken:e.captcha_token,url:t}})},requestCaptcha:e.Captcha.request,verifyCaptcha:function(e,t){return o("verifyCaptcha",null,null,"POST",{captcha_code:e,captcha_token:t}).then(function(e){return e.validate_token})}})}},function(e,t,n){"use strict";var r=n(2).request;e.exports=function(e){e.Installation=e.Object.extend("_Installation"),e.Push=e.Push||{},e.Push.send=function(e,t){if(e.where&&(e.where=e.where.toJSON().where),e.where&&e.cql)throw new Error("Both where and cql can't be set");if(e.push_time&&(e.push_time=e.push_time.toJSON()),e.expiration_time&&(e.expiration_time=e.expiration_time.toJSON()),e.expiration_time&&e.expiration_time_interval)throw new Error("Both expiration_time and expiration_time_interval can't be set");return r({service:"push",method:"POST",path:"/push",data:e,authOptions:t})}}},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=n(0),o=n(1),s=n(2)._request,a=n(3),u=a.getSessionToken;e.exports=function(e){var t=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return u(t)?e.User._fetchUserBySessionToken(u(t)):e.User.currentAsync()},n=function(n){return t(n).then(function(t){return e.Object.createWithoutData("_User",t.id)._toPointer()})};e.Status=function(e,t){return this.data={},this.inboxType="default",this.query=null,e&&"object"===(void 0===e?"undefined":r(e))?this.data=e:(e&&(this.data.image=e),t&&(this.data.message=t)),this},i.extend(e.Status.prototype,{get:function(e){return this.data[e]},set:function(e,t){return this.data[e]=t,this},destroy:function(e){return this.id?s("statuses",null,this.id,"DELETE",e):o.reject(new Error("The status id is not exists."))},toObject:function(){return this.id?e.Object.createWithoutData("_Status",this.id):null},_getDataJSON:function(){var t=i.clone(this.data);return e._encode(t)},send:function(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!u(r)&&!e.User.current())throw new Error("Please signin an user.");return this.query?n(r).then(function(e){var n=t.query.toJSON();n.className=t.query.className;var i={};return i.query=n,t.data=t.data||{},t.data.source=t.data.source||e,i.data=t._getDataJSON(),i.inboxType=t.inboxType||"default",s("statuses",null,null,"POST",i,r)}).then(function(n){return t.id=n.objectId,t.createdAt=e._parseDate(n.createdAt),t}):e.Status.sendStatusToFollowers(this,r)},_finishFetch:function(t){this.id=t.objectId,this.createdAt=e._parseDate(t.createdAt),this.updatedAt=e._parseDate(t.updatedAt),this.messageId=t.messageId,delete t.messageId,delete t.objectId,delete t.createdAt,delete t.updatedAt,this.data=e._decode(t)}}),e.Status.sendStatusToFollowers=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!u(r)&&!e.User.current())throw new Error("Please signin an user.");return n(r).then(function(n){var i={};i.className="_Follower",i.keys="follower",i.where={user:n};var o={};return o.query=i,t.data=t.data||{},t.data.source=t.data.source||n,o.data=t._getDataJSON(),o.inboxType=t.inboxType||"default",s("statuses",null,null,"POST",o,r).then(function(n){return t.id=n.objectId,t.createdAt=e._parseDate(n.createdAt),t})})},e.Status.sendPrivateStatus=function(t,r){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!u(o)&&!e.User.current())throw new Error("Please signin an user.");if(!r)throw new Error("Invalid target user.");var a=i.isString(r)?r:r.id;if(!a)throw new Error("Invalid target user.");return n(o).then(function(n){var r={};r.className="_User",r.where={objectId:a};var i={};return i.query=r,t.data=t.data||{},t.data.source=t.data.source||n,i.data=t._getDataJSON(),i.inboxType="private",t.inboxType="private",s("statuses",null,null,"POST",i,o).then(function(n){return t.id=n.objectId,t.createdAt=e._parseDate(n.createdAt),t})})},e.Status.countUnreadStatuses=function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(i.isString(r)||(a=r),!u(a)&&null==n&&!e.User.current())throw new Error("Please signin an user or pass the owner objectId.");return o.resolve(n||t(a)).then(function(t){var n={};return n.inboxType=e._encode(r),n.owner=e._encode(t),s("subscribe/statuses/count",null,null,"GET",n,a)})},e.Status.resetUnreadCount=function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(i.isString(r)||(a=r),!u(a)&&null==n&&!e.User.current())throw new Error("Please signin an user or pass the owner objectId.");return o.resolve(n||t(a)).then(function(t){var n={};return n.inboxType=e._encode(r),n.owner=e._encode(t),s("subscribe/statuses/resetUnreadCount",null,null,"POST",n,a)})},e.Status.statusQuery=function(t){var n=new e.Query("_Status");return t&&n.equalTo("source",t),n},e.InboxQuery=e.Query._extend({_objectClass:e.Status,_sinceId:0,_maxId:0,_inboxType:"default",_owner:null,_newObject:function(){return new e.Status},_createRequest:function(t,n){return e.InboxQuery.__super__._createRequest.call(this,t,n,"/subscribe/statuses")},sinceId:function(e){return this._sinceId=e,this},maxId:function(e){return this._maxId=e,this},owner:function(e){return this._owner=e,this},inboxType:function(e){return this._inboxType=e,this},toJSON:function(){var t=e.InboxQuery.__super__.toJSON.call(this);return t.owner=e._encode(this._owner),t.inboxType=e._encode(this._inboxType),t.sinceId=e._encode(this._sinceId),t.maxId=e._encode(this._maxId),t}}),e.Status.inboxQuery=function(t,n){var r=new e.InboxQuery(e.Status);return t&&(r._owner=t),n&&(r._inboxType=n),r}}},function(e,t,n){"use strict";var r=n(0),i=n(2)._request;e.exports=function(e){e.SearchSortBuilder=function(){this._sortFields=[]},r.extend(e.SearchSortBuilder.prototype,{_addField:function(e,t,n,r){var i={};return i[e]={order:t||"asc",mode:n||"avg",missing:"_"+(r||"last")},this._sortFields.push(i),this},ascending:function(e,t,n){return this._addField(e,"asc",t,n)},descending:function(e,t,n){return this._addField(e,"desc",t,n)},whereNear:function(e,t,n){n=n||{};var r={},i={lat:t.latitude,lon:t.longitude},o={order:n.order||"asc",mode:n.mode||"avg",unit:n.unit||"km"};return o[e]=i,r._geo_distance=o,this._sortFields.push(r),this},build:function(){return JSON.stringify(e._encode(this._sortFields))}}),e.SearchQuery=e.Query._extend({_sid:null,_hits:0,_queryString:null,_highlights:null,_sortBuilder:null,_createRequest:function(e,t){return i("search/select",null,null,"GET",e||this.toJSON(),t)},sid:function(e){return this._sid=e,this},queryString:function(e){return this._queryString=e,this},highlights:function(e){var t;return t=e&&r.isString(e)?arguments:e,this._highlights=t,this},sortBy:function(e){return this._sortBuilder=e,this},hits:function(){return this._hits||(this._hits=0),this._hits},_processResult:function(e){return delete e.className,delete e._app_url,delete e._deeplink,e},hasMore:function(){return!this._hitEnd},reset:function(){this._hitEnd=!1,this._sid=null,this._hits=0},find:function(){var e=this;return this._createRequest().then(function(t){return t.sid?(e._oldSid=e._sid,e._sid=t.sid):(e._sid=null,e._hitEnd=!0),e._hits=t.hits||0,r.map(t.results,function(n){n.className&&(t.className=n.className);var r=e._newObject(t);return r.appURL=n._app_url,r._finishFetch(e._processResult(n),!0),r})})},toJSON:function(){var t=e.SearchQuery.__super__.toJSON.call(this);if(delete t.where,this.className&&(t.clazz=this.className),this._sid&&(t.sid=this._sid),!this._queryString)throw new Error("Please set query string.");if(t.q=this._queryString,this._highlights&&(t.highlights=this._highlights.join(",")),this._sortBuilder&&t.order)throw new Error("sort and order can not be set at same time.");return this._sortBuilder&&(t.sort=this._sortBuilder.build()),t}})}},function(e,t,n){"use strict";var r=n(0),i=n(4),o=n(2),s=o.request,a=n(1);e.exports=function(e){e.Insight=e.Insight||{},r.extend(e.Insight,{startJob:function(t,n){if(!t||!t.sql)throw new Error("Please provide the sql to run the job.");var r={jobConfig:t,appId:e.applicationId};return s({path:"/bigquery/jobs",method:"POST",data:e._encode(r,null,!0),authOptions:n,signKey:!1}).then(function(t){return e._decode(t).id})},on:function(e,t){}}),e.Insight.JobQuery=function(e,t){if(!e)throw new Error("Please provide the job id.");this.id=e,this.className=t,this._skip=0,this._limit=100},r.extend(e.Insight.JobQuery.prototype,{skip:function(e){return this._skip=e,this},limit:function(e){return this._limit=e,this},find:function(e){var t={skip:this._skip,limit:this._limit};return s({path:"/bigquery/jobs/"+this.id,method:"GET",query:t,authOptions:e,signKey:!1}).then(function(e){return e.error?a.reject(new i(e.code,e.error)):a.resolve(e)})}})}},function(e,t,n){"use strict";var r=n(0),i=n(2),o=i._request,s=n(6),a=function(e){return"string"==typeof e?e:"function"==typeof e.getPayload?JSON.stringify(e.getPayload()):JSON.stringify(e)};e.exports=s.Object.extend("_Conversation",{constructor:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s.Object.prototype.constructor.call(this,null,null),this.set("name",e),void 0!==t.isSystem&&this.set("sys",!!t.isSystem),void 0!==t.isTransient&&this.set("tr",!!t.isTransient)},getCreator:function(){return this.get("c")},getLastMessageAt:function(){return this.get("lm")},getMembers:function(){return this.get("m")},addMember:function(e){return this.add("m",e)},getMutedMembers:function(){return this.get("mu")},getName:function(){return this.get("name")},isTransient:function(){return this.get("tr")},isSystem:function(){return this.get("sys")},send:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i={from_peer:e,conv_id:this.id,transient:!1,message:a(t)};return void 0!==n.toClients&&(i.to_peers=n.toClients),void 0!==n.transient&&(i.transient=!!n.transient),void 0!==n.pushData&&(i.push_data=n.pushData),o("rtm","messages",null,"POST",i,r)},broadcast:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s={from_peer:e,conv_id:this.id,message:a(t)};if(void 0!==n.pushData&&(s.push=n.pushData),void 0!==n.validTill){var u=n.validTill;r.isDate(u)&&(u=u.getTime()),n.valid_till=u}return o("rtm","broadcast",null,"POST",s,i)}})},function(e,t,n){"use strict";function r(e){var t=e.name,n=e.value,r=e.version;this.name=t,this.value=n,this.version=r}var i=n(0),o=n(1),s=n(2),a=s.request,u=n(3),c=u.ensureArray,l=u.parseDate,f=n(6);f.LeaderboardVersionChangeInterval={NEVER:"never",DAY:"day",WEEK:"week",MONTH:"month"},f.LeaderboardOrder={ASCENDING:"ascending",DESCENDING:"descending"},f.LeaderboardUpdateStrategy={BETTER:"better",LAST:"last",SUM:"sum"};var h=function(e){var t=f._decode(e);return new r({name:t.statisticName,value:t.statisticValue,version:t.version})};f.Leaderboard=function(e){this.statisticName=e,this.order=void 0,this.updateStrategy=void 0,this.versionChangeInterval=void 0,this.version=void 0,this.nextResetAt=void 0,this.createdAt=void 0};var d=f.Leaderboard;f.Leaderboard.createWithoutData=function(e){return new d(e)},f.Leaderboard.createLeaderboard=function(e,t){var n=e.statisticName,r=e.order,i=e.versionChangeInterval,o=e.updateStrategy;return a({method:"POST",path:"/leaderboard/leaderboards",data:{statisticName:n,order:r,versionChangeInterval:i,updateStrategy:o},authOptions:t}).then(function(e){return new d(n)._finishFetch(e)})},f.Leaderboard.getLeaderboard=function(e,t){return d.createWithoutData(e).fetch(t)},f.Leaderboard.getStatistics=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.statisticNames,r=arguments[2];return o.resolve().then(function(){if(!e||!e.id)throw new Error("user must be an AV.User");return a({method:"GET",path:"/leaderboard/users/"+e.id+"/statistics",query:{statistics:n?c(n).join(","):void 0},authOptions:r}).then(function(e){return e.results.map(h)})})},f.Leaderboard.updateStatistics=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return o.resolve().then(function(){if(!e||!e.id)throw new Error("user must be an AV.User");var r=i.map(t,function(e,t){return{statisticName:t,statisticValue:e}}),o=n.overwrite;return a({method:"POST",path:"/leaderboard/users/"+e.id+"/statistics",query:{overwrite:o?1:void 0},data:r,authOptions:n}).then(function(e){return e.results.map(h)})})},f.Leaderboard.deleteStatistics=function(e,t,n){return o.resolve().then(function(){if(!e||!e.id)throw new Error("user must be an AV.User");return a({method:"DELETE",path:"/leaderboard/users/"+e.id+"/statistics",query:{statistics:c(t).join(",")},authOptions:n}).then(function(){})})},i.extend(d.prototype,{_finishFetch:function(e){var t=this;return i.forEach(e,function(e,n){"updatedAt"!==n&&"objectId"!==n&&("expiredAt"===n&&(n="nextResetAt"),"createdAt"===n&&(e=l(e)),e&&"Date"===e.__type&&(e=l(e.iso)),t[n]=e)}),this},fetch:function(e){var t=this;return a({method:"GET",path:"/leaderboard/leaderboards/"+this.statisticName,authOptions:e}).then(function(e){return t._finishFetch(e)})},count:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.version,n=arguments[1];return a({method:"GET",path:"/leaderboard/leaderboards/"+this.statisticName+"/ranks",query:{count:1,limit:0,version:t},authOptions:n}).then(function(e){return e.count})},_getResults:function(e,t,n){var r=e.skip,i=e.limit,o=e.selectUserKeys,s=e.includeStatistics,u=e.version;return a({method:"GET",path:"/leaderboard/leaderboards/"+this.statisticName+"/ranks"+(n?"/"+n:""),query:{skip:r,limit:i,includeUser:o?c(o).join(","):void 0,includeStatistics:s?c(s).join(","):void 0,version:u},authOptions:t}).then(function(e){return e.results.map(function(e){var t=f._decode(e),n=t.user,r=t.statisticValue,i=t.rank,o=t.statistics;return{user:n,value:r,rank:i,includedStatistics:(void 0===o?[]:o).map(h)}})})},getResults:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.skip,n=e.limit,r=e.selectUserKeys,i=e.includeStatistics,o=e.version,s=arguments[1];return this._getResults({skip:t,limit:n,selectUserKeys:r,includeStatistics:i,version:o},s)},getResultsAroundUser:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2];if(e&&"string"!=typeof e.id)return this.getResultsAroundUser(void 0,e,t);var r=t.limit,i=t.selectUserKeys,o=t.includeStatistics,s=t.version;return this._getResults({limit:r,selectUserKeys:i,includeStatistics:o,version:s},n,e?e.id:"self")},_update:function(e,t){var n=this;return a({method:"PUT",path:"/leaderboard/leaderboards/"+this.statisticName,data:e,authOptions:t}).then(function(e){return n._finishFetch(e)})},updateVersionChangeInterval:function(e,t){return this._update({versionChangeInterval:e},t)},updateUpdateStrategy:function(e,t){return this._update({updateStrategy:e},t)},reset:function(e){var t=this;return a({method:"PUT",path:"/leaderboard/leaderboards/"+this.statisticName+"/incrementVersion",authOptions:e}).then(function(e){return t._finishFetch(e)})},destroy:function(e){return f.request({method:"DELETE",path:"/leaderboard/leaderboards/"+this.statisticName,authOptions:e}).then(function(){})},getArchives:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.skip,r=t.limit,i=arguments[1];return a({method:"GET",path:"/leaderboard/leaderboards/"+this.statisticName+"/archives",query:{skip:n,limit:r},authOptions:i}).then(function(t){return t.results.map(function(t){var n=t.version,r=t.status,i=t.url,o=t.activatedAt,s=t.deactivatedAt;return{statisticName:e.statisticName,version:n,status:r,url:i,activatedAt:l(o.iso),deactivatedAt:l(s.iso)}})})}})},function(e,t,n){(function(e){!function(e,n){n(t)}(0,function(t){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t,n,r,i,o,s){try{var a=e[o](s),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,i)}function i(e){return function(){var t=this,n=arguments;return new Promise(function(i,o){function s(e){r(u,i,o,s,a,"next",e)}function a(e){r(u,i,o,s,a,"throw",e)}var u=e.apply(t,n);s(void 0)})}}function o(e,t){for(var n=0;n=0||(i[n]=e[n]);return i}function f(e,t){if(null==e)return{};var n,r,i=l(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e){return m(e)||v(e)||_()}function p(e){return y(e)||v(e)||g()}function y(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t100)){var t=/^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*Ht;case"weeks":case"week":case"w":return n*Gt;case"days":case"day":case"d":return n*zt;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Wt;case"minutes":case"minute":case"mins":case"min":case"m":return n*Yt;case"seconds":case"second":case"secs":case"sec":case"s":return n*Vt;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function I(e){var t=Math.abs(e);return t>=zt?Math.round(e/zt)+"d":t>=Wt?Math.round(e/Wt)+"h":t>=Yt?Math.round(e/Yt)+"m":t>=Vt?Math.round(e/Vt)+"s":e+"ms"}function N(e){var t=Math.abs(e);return t>=zt?x(e,t,zt,"day"):t>=Wt?x(e,t,Wt,"hour"):t>=Yt?x(e,t,Yt,"minute"):t>=Vt?x(e,t,Vt,"second"):e+" ms"}function x(e,t,n,r){var i=t>=1.5*n;return Math.round(e/n)+" "+r+(i?"s":"")}function R(e){function t(e){for(var t=0,r=0;r-1&&e%1==0&&e-1&&e%1==0&&e<=Zn}function Z(e){return Fn(e)&&er(e.length)&&!!tr[Dn(e)]}function ee(e){return function(t){return e(t)}}function te(e,t){var n=Hn(e),r=!n&&zn(e),i=!n&&!r&&Qn(e),o=!n&&!r&&!i&&ar(e),s=n||r||i||o,a=s?gn(e.length,String):[],u=a.length;for(var c in e)!t&&!cr.call(e,c)||s&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Xn(c,u))||a.push(c);return a}function ne(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||fr)}function re(e,t){return function(n){return e(t(n))}}function ie(e){if(!hr(e))return yr(e);var t=[];for(var n in Object(e))vr.call(e,n)&&"constructor"!=n&&t.push(n);return t}function oe(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function se(e){if(!_r(e))return!1;var t=Dn(e);return t==wr||t==Er||t==br||t==Tr}function ae(e){return null!=e&&er(e.length)&&!Sr(e)}function ue(e){return Or(e)?lr(e):gr(e)}function ce(e){return null==e?[]:vn(e,Ar(e))}function le(e){return pn(Cr(e))}function fe(e){return(Hn(e)?yn:Ir)(e)}function he(e){if(!Fn(e)||Dn(e)!=Pr)return!1;var t=kr(e);if(null===t)return!0;var n=Dr.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Ur.call(n)==Fr}var de="undefined"!=typeof window&&window.process||{};de.env=de.env||{};var pe="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},ye=function(){function e(){}var t=e.prototype;return t.getItem=function(e){return wx.getStorageSync(e)},t.setItem=function(e,t){return wx.setStorageSync(e,t)},t.removeItem=function(e){return this.setItem(e,"")},t.clear=function(){return wx.clearStorageSync()},e}(),me=new ye,ve=Object.getOwnPropertySymbols,ge=Object.prototype.hasOwnProperty,_e=Object.prototype.propertyIsEnumerable,be=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,r,i=T(e),o=1;o0){for(var n=Array(arguments.length),r=0;r2&&void 0!==arguments[2])||arguments[2];if(this.readyState!==Fe)throw new Error("request is already opened");if(!n)throw new Error("sync request is not supported");this._method=e,this._url=t,this.readyState=1,this.dispatchEvent({type:"readystatechange"})},n.setRequestHeader=function(e,t){if(1!==this.readyState)throw new Error("request is not opened");this._headers[e.toLowerCase()]=t},n.send=function(e){var t=this;if(1!==this.readyState)throw new Error("request is not opened");if(e instanceof De){var n=e.entries(),r=n.filter(function(e){return"string"!=typeof e[1]});if(0===r.length)throw new Error("Must specify a Blob field in FormData");r.length>1&&console.warn("Only the first Blob will be send in Weapp");var i=n.filter(function(e){return"string"==typeof e[1]}).reduce(function(e,t){return be(e,a({},t[0],t[1]))},{});this._request=wx.uploadFile({url:this._url,name:r[0][0],filePath:r[0][1].uri,formData:i,header:this._headers,success:A.bind(this),fail:function(e){t.status=0,t.readyState=Me,t.dispatchEvent({type:"readystatechange"}),t.dispatchEvent({type:"error"})}}),this._request&&this._request.onProgressUpdate&&this._request.onProgressUpdate(function(e){var n=e.totalBytesSent,r=e.totalBytesExpectedToSend;t.upload.dispatchEvent({type:"progress",loaded:n,total:r})})}else this._request=wx.request({url:this._url,data:e||"",method:this._method.toUpperCase(),header:this._headers,success:A.bind(this),fail:function(e){t.status=0,t.readyState=Me,t.dispatchEvent({type:"readystatechange"}),t.dispatchEvent({type:"error"})}})},t}(Le(qe));be(Ye,{UNSENT:Fe,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:Me});var We=Ye,ze=0,Ge=1,He=3,Je=["open","error","message","close"],Qe=function(e){function t(t,n){var r;if(!t)throw new TypeError("Failed to construct 'WebSocket': url required");if(n&&(!wx.canIUse||!wx.canIUse("connectSocket.object.protocols")))throw new Error("subprotocal not supported in weapp");r=e.call(this)||this,r._url=t,r._protocal=n||"",r._readyState=ze;var i=function(e){r._readyState=He,r.dispatchEvent({type:"error",message:e.errMsg})},o=wx.connectSocket({url:t,protocals:r._protocal,fail:function(e){return setTimeout(function(){return i(e)},0)}});return r._socketTask=o,o.onOpen(function(e){r._readyState=Ge,r.dispatchEvent({type:"open"})}),o.onError(i),o.onMessage(function(e){var t=e.data,n=e.origin,i=e.ports,o=e.source;r.dispatchEvent({data:t,origin:n,ports:i,source:o,type:"message"})}),o.onClose(function(e){r._readyState=He;var t=e.code,n=e.reason,i=e.wasClean;r.dispatchEvent({code:t,reason:n,wasClean:i,type:"close"})}),r}c(t,e);var n=t.prototype;return n.close=function(){this.readyState!==He&&(this.readyState===ze&&console.warn("close WebSocket which is connecting might not work"),this._socketTask.close())},n.send=function(e){if(this.readyState!==Ge)throw new Error("INVALID_STATE_ERR");if(!("string"==typeof e||e instanceof ArrayBuffer))throw new TypeError("only String/ArrayBuffer supported");this._socketTask.send({data:e})},s(t,[{key:"url",get:function(){return this._url}},{key:"protocal",get:function(){return this._protocal}},{key:"readyState",get:function(){return this._readyState}}]),t}(Le(Je));be(Qe,{CONNECTING:ze,OPEN:Ge,CLOSING:2,CLOSED:He});var Ke=Qe,$e=function(e){if(wx.onNetworkStatusChange&&!e.__onlineOfflinePolyfilled){e.__onlineOfflinePolyfilled=!0;var t=new Le;e.dispatchEvent||(e.addEventListener=t.addEventListener.bind(t),e.removeEventListener=t.removeEventListener.bind(t),e.dispatchEvent=t.dispatchEvent.bind(t),"function"!=typeof postMessage||e.importScripts||(e.importScripts=function(){throw new Error("mocked")})),wx.getNetworkType({success:function(t){var n=t.networkType;e.onLine="none"!==n,wx.onNetworkStatusChange(function(t){var n=t.isConnected;e.onLine!==n&&(e.onLine=n,e.dispatchEvent({type:n?"online":"offline"}))})}})}},Xe={polyfill:$e},Ze={},et={polyfill:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:pe||window;if("object"!==n(e))throw new Error("polyfill target is not an Object");var t={localStorage:me,XMLHttpRequest:We,FormData:De,WebSocket:Ke,Object:Object,navigator:Ze};for(var r in t)e[r]||(e[r]=t[r]);Xe.polyfill(e),e.navigator.product="ReactNative"},localStorage:me,XMLHttpRequest:We,FormData:De,WebSocket:Ke},tt=et.polyfill;try{tt()}catch(e){}try{tt(GameGlobal)}catch(e){}try{window=window||{},tt(window)}catch(e){}try{localStorage=localStorage||me}catch(e){}try{XMLHttpRequest=XMLHttpRequest||We}catch(e){}try{FormData=FormData||De}catch(e){}try{WebSocket=WebSocket||Ke}catch(e){}try{navigator=navigator||Ze}catch(e){}var nt=E(function(e){/** * @license long.js (c) 2013 Daniel Wirtz * Released under the Apache License, Version 2.0 * see: https://github.com/dcodeIO/long.js for details */ !function(t,n){"function"==typeof w&&e&&e.exports?e.exports=n():(t.dcodeIO=t.dcodeIO||{}).Long=n()}(pe,function(){function e(e,t,n){this.low=0|e,this.high=0|t,this.unsigned=!!n}function t(e){return!0===(e&&e.__isLong__)}function n(e,t){var n,r,o;return t?(e>>>=0,(o=0<=e&&e<256)&&(r=u[e])?r:(n=i(e,(0|e)<0?-1:0,!0),o&&(u[e]=n),n)):(e|=0,(o=-128<=e&&e<128)&&(r=a[e])?r:(n=i(e,e<0?-1:0,!1),o&&(a[e]=n),n))}function r(e,t){if(isNaN(e)||!isFinite(e))return t?y:p;if(t){if(e<0)return y;if(e>=f)return b}else{if(e<=-h)return w;if(e+1>=h)return _}return e<0?r(-e,t).neg():i(e%l|0,e/l|0,t)}function i(t,n,r){return new e(t,n,r)}function o(e,t,n){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return p;if("number"==typeof t?(n=t,t=!1):t=!!t,(n=n||10)<2||360)throw Error("interior hyphen");if(0===i)return o(e.substring(1),t,n).neg();for(var s=r(c(n,8)),a=p,u=0;u>>0:this.low},E.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},E.toString=function(e){if((e=e||10)<2||36>>0,f=l.toString(e);if(s=u,s.isZero())return f+a;for(;f.length<6;)f="0"+f;a=""+f+a}},E.getHighBits=function(){return this.high},E.getHighBitsUnsigned=function(){return this.high>>>0},E.getLowBits=function(){return this.low},E.getLowBitsUnsigned=function(){return this.low>>>0},E.getNumBitsAbs=function(){if(this.isNegative())return this.eq(w)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<=0},E.isOdd=function(){return 1==(1&this.low)},E.isEven=function(){return 0==(1&this.low)},E.equals=function(e){return t(e)||(e=s(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},E.eq=E.equals,E.notEquals=function(e){return!this.eq(e)},E.neq=E.notEquals,E.lessThan=function(e){return this.comp(e)<0},E.lt=E.lessThan,E.lessThanOrEqual=function(e){return this.comp(e)<=0},E.lte=E.lessThanOrEqual,E.greaterThan=function(e){return this.comp(e)>0},E.gt=E.greaterThan,E.greaterThanOrEqual=function(e){return this.comp(e)>=0},E.gte=E.greaterThanOrEqual,E.compare=function(e){if(t(e)||(e=s(e)),this.eq(e))return 0;var n=this.isNegative(),r=e.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},E.comp=E.compare,E.negate=function(){return!this.unsigned&&this.eq(w)?w:this.not().add(m)},E.neg=E.negate,E.add=function(e){t(e)||(e=s(e));var n=this.high>>>16,r=65535&this.high,o=this.low>>>16,a=65535&this.low,u=e.high>>>16,c=65535&e.high,l=e.low>>>16,f=65535&e.low,h=0,d=0,p=0,y=0;return y+=a+f,p+=y>>>16,y&=65535,p+=o+l,d+=p>>>16,p&=65535,d+=r+c,h+=d>>>16,d&=65535,h+=n+u,h&=65535,i(p<<16|y,h<<16|d,this.unsigned)},E.subtract=function(e){return t(e)||(e=s(e)),this.add(e.neg())},E.sub=E.subtract,E.multiply=function(e){if(this.isZero())return p;if(t(e)||(e=s(e)),e.isZero())return p;if(this.eq(w))return e.isOdd()?w:p;if(e.eq(w))return this.isOdd()?w:p;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(d)&&e.lt(d))return r(this.toNumber()*e.toNumber(),this.unsigned);var n=this.high>>>16,o=65535&this.high,a=this.low>>>16,u=65535&this.low,c=e.high>>>16,l=65535&e.high,f=e.low>>>16,h=65535&e.low,y=0,m=0,v=0,g=0;return g+=u*h,v+=g>>>16,g&=65535,v+=a*h,m+=v>>>16,v&=65535,v+=u*f,m+=v>>>16,v&=65535,m+=o*h,y+=m>>>16,m&=65535,m+=a*f,y+=m>>>16,m&=65535,m+=u*l,y+=m>>>16,m&=65535,y+=n*h+o*f+a*l+u*c,y&=65535,i(v<<16|g,y<<16|m,this.unsigned)},E.mul=E.multiply,E.divide=function(e){if(t(e)||(e=s(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?y:p;var n,i,o;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return y;if(e.gt(this.shru(1)))return v;o=y}else{if(this.eq(w)){if(e.eq(m)||e.eq(g))return w;if(e.eq(w))return m;return n=this.shr(1).div(e).shl(1),n.eq(p)?e.isNegative()?m:g:(i=this.sub(e.mul(n)),o=n.add(i.div(e)))}if(e.eq(w))return this.unsigned?y:p;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=p}for(i=this;i.gte(e);){n=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(n)/Math.LN2),u=a<=48?1:c(2,a-48),l=r(n),f=l.mul(e);f.isNegative()||f.gt(i);)n-=u,l=r(n,this.unsigned),f=l.mul(e);l.isZero()&&(l=m),o=o.add(l),i=i.sub(f)}return o},E.div=E.divide,E.modulo=function(e){return t(e)||(e=s(e)),this.sub(this.div(e).mul(e))},E.mod=E.modulo,E.not=function(){return i(~this.low,~this.high,this.unsigned)},E.and=function(e){return t(e)||(e=s(e)),i(this.low&e.low,this.high&e.high,this.unsigned)},E.or=function(e){return t(e)||(e=s(e)),i(this.low|e.low,this.high|e.high,this.unsigned)},E.xor=function(e){return t(e)||(e=s(e)),i(this.low^e.low,this.high^e.high,this.unsigned)},E.shiftLeft=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?i(this.low<>>32-e,this.unsigned):i(0,this.low<>>e|this.high<<32-e,this.high>>e,this.unsigned):i(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},E.shr=E.shiftRight,E.shiftRightUnsigned=function(e){if(t(e)&&(e=e.toInt()),0===(e&=63))return this;var n=this.high;if(e<32){return i(this.low>>>e|n<<32-e,n>>>e,this.unsigned)}return 32===e?i(n,0,this.unsigned):i(n>>>e-32,0,this.unsigned)},E.shru=E.shiftRightUnsigned,E.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},E.toUnsigned=function(){return this.unsigned?this:i(this.low,this.high,!0)},E.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},E.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24&255,255&e,e>>>8&255,e>>>16&255,e>>>24&255]},E.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t]},e})}),rt=E(function(e){/** * @license bytebuffer.js (c) 2015 Daniel Wirtz * Backing buffer: ArrayBuffer, Accessor: Uint8Array * Released under the Apache License, Version 2.0 * see: https://github.com/dcodeIO/bytebuffer.js for details */ !function(t,n){"function"==typeof w&&e&&e.exports?e.exports=function(){var e;try{e=nt}catch(e){}return n(e)}():(t.dcodeIO=t.dcodeIO||{}).ByteBuffer=n(t.dcodeIO.Long)}(pe,function(e){function t(e){var t=0;return function(){return t1024&&(t.push(u.apply(String,e)),e.length=0),Array.prototype.push.apply(e,arguments)}}function r(e,t,n,r,i){var o,s,a=8*i-r-1,u=(1<>1,l=-7,f=n?i-1:0,h=n?-1:1,d=e[t+f];for(f+=h,o=d&(1<<-l)-1,d>>=-l,l+=a;l>0;o=256*o+e[t+f],f+=h,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=256*s+e[t+f],f+=h,l-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),o-=c}return(d?-1:1)*s*Math.pow(2,o-r)}function i(e,t,n,r,i,o){var s,a,u,c=8*o-i-1,l=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),t+=s+f>=1?h/u:h*Math.pow(2,1-f),t*u>=2&&(s++,u/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(t*u-1)*Math.pow(2,i),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;e[n+d]=255&a,d+=p,a/=256,i-=8);for(s=s<0;e[n+d]=255&s,d+=p,s/=256,c-=8);e[n+d-p]|=128*y}var o=function(e,t,n){if(void 0===e&&(e=o.DEFAULT_CAPACITY),void 0===t&&(t=o.DEFAULT_ENDIAN),void 0===n&&(n=o.DEFAULT_NOASSERT),!n){if((e|=0)<0)throw RangeError("Illegal capacity");t=!!t,n=!!n}this.buffer=0===e?a:new ArrayBuffer(e),this.view=0===e?null:new Uint8Array(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=e,this.littleEndian=t,this.noAssert=n};o.VERSION="5.0.1",o.LITTLE_ENDIAN=!0,o.BIG_ENDIAN=!1,o.DEFAULT_CAPACITY=16,o.DEFAULT_ENDIAN=o.BIG_ENDIAN,o.DEFAULT_NOASSERT=!1,o.Long=e||null;var s=o.prototype;s.__isByteBuffer__,Object.defineProperty(s,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1});var a=new ArrayBuffer(0),u=String.fromCharCode;o.accessor=function(){return Uint8Array},o.allocate=function(e,t,n){return new o(e,t,n)},o.concat=function(e,t,n,r){"boolean"!=typeof t&&"string"==typeof t||(r=n,n=t,t=void 0);for(var i,s=0,a=0,u=e.length;a0&&(s+=i);if(0===s)return new o(0,n,r);var c,l=new o(s,n,r);for(a=0;a0&&(i.buffer=e.buffer,i.offset=e.byteOffset,i.limit=e.byteOffset+e.byteLength,i.view=new Uint8Array(e.buffer));else if(e instanceof ArrayBuffer)i=new o(0,n,r),e.byteLength>0&&(i.buffer=e,i.offset=0,i.limit=e.byteLength,i.view=e.byteLength>0?new Uint8Array(e):null);else{if("[object Array]"!==Object.prototype.toString.call(e))throw TypeError("Illegal buffer");i=new o(e.length,n,r),i.limit=e.length;for(var a=0;a>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}var r,i=t,o=e.length,s=o>>3,a=0;for(t+=this.writeVarint32(o,t);s--;)r=1&!!e[a++]|(1&!!e[a++])<<1|(1&!!e[a++])<<2|(1&!!e[a++])<<3|(1&!!e[a++])<<4|(1&!!e[a++])<<5|(1&!!e[a++])<<6|(1&!!e[a++])<<7,this.writeByte(r,t++);if(a>3,s=0,a=[];for(e+=r.length;o--;)n=this.readByte(e++),a[s++]=!!(1&n),a[s++]=!!(2&n),a[s++]=!!(4&n),a[s++]=!!(8&n),a[s++]=!!(16&n),a[s++]=!!(32&n),a[s++]=!!(64&n),a[s++]=!!(128&n);if(s>u++&1)}return t&&(this.offset=e),a},s.readBytes=function(e,t){var n=void 0===t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+"+e+") <= "+this.buffer.byteLength)}var r=this.slice(t,t+e);return n&&(this.offset+=e),r},s.writeBytes=s.append,s.writeInt8=function(e,t){var n=void 0===t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=1;var r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r:t),t-=1,this.view[t]=e,n&&(this.offset+=1),this},s.writeByte=s.writeInt8,s.readInt8=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var n=this.view[e];return 128==(128&n)&&(n=-(255-n+1)),t&&(this.offset+=1),n},s.readByte=s.readInt8,s.writeUint8=function(e,t){var n=void 0===t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=1;var r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r:t),t-=1,this.view[t]=e,n&&(this.offset+=1),this},s.writeUInt8=s.writeUint8,s.readUint8=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var n=this.view[e];return t&&(this.offset+=1),n},s.readUInt8=s.readUint8,s.writeInt16=function(e,t){var n=void 0===t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=2;var r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r:t),t-=2,this.littleEndian?(this.view[t+1]=(65280&e)>>>8,this.view[t]=255&e):(this.view[t]=(65280&e)>>>8,this.view[t+1]=255&e),n&&(this.offset+=2),this},s.writeShort=s.writeInt16,s.readInt16=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}var n=0;return this.littleEndian?(n=this.view[e],n|=this.view[e+1]<<8):(n=this.view[e]<<8,n|=this.view[e+1]),32768==(32768&n)&&(n=-(65535-n+1)),t&&(this.offset+=2),n},s.readShort=s.readInt16,s.writeUint16=function(e,t){var n=void 0===t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=2;var r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r:t),t-=2,this.littleEndian?(this.view[t+1]=(65280&e)>>>8,this.view[t]=255&e):(this.view[t]=(65280&e)>>>8,this.view[t+1]=255&e),n&&(this.offset+=2),this},s.writeUInt16=s.writeUint16,s.readUint16=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}var n=0;return this.littleEndian?(n=this.view[e],n|=this.view[e+1]<<8):(n=this.view[e]<<8,n|=this.view[e+1]),t&&(this.offset+=2),n},s.readUInt16=s.readUint16,s.writeInt32=function(e,t){var n=void 0===t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=4;var r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r:t),t-=4,this.littleEndian?(this.view[t+3]=e>>>24&255,this.view[t+2]=e>>>16&255,this.view[t+1]=e>>>8&255,this.view[t]=255&e):(this.view[t]=e>>>24&255,this.view[t+1]=e>>>16&255,this.view[t+2]=e>>>8&255,this.view[t+3]=255&e),n&&(this.offset+=4),this},s.writeInt=s.writeInt32,s.readInt32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var n=0;return this.littleEndian?(n=this.view[e+2]<<16,n|=this.view[e+1]<<8,n|=this.view[e],n+=this.view[e+3]<<24>>>0):(n=this.view[e+1]<<16,n|=this.view[e+2]<<8,n|=this.view[e+3],n+=this.view[e]<<24>>>0),n|=0,t&&(this.offset+=4),n},s.readInt=s.readInt32,s.writeUint32=function(e,t){var n=void 0===t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=4;var r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r:t),t-=4,this.littleEndian?(this.view[t+3]=e>>>24&255,this.view[t+2]=e>>>16&255,this.view[t+1]=e>>>8&255,this.view[t]=255&e):(this.view[t]=e>>>24&255,this.view[t+1]=e>>>16&255,this.view[t+2]=e>>>8&255,this.view[t+3]=255&e),n&&(this.offset+=4),this},s.writeUInt32=s.writeUint32,s.readUint32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var n=0;return this.littleEndian?(n=this.view[e+2]<<16,n|=this.view[e+1]<<8,n|=this.view[e],n+=this.view[e+3]<<24>>>0):(n=this.view[e+1]<<16,n|=this.view[e+2]<<8,n|=this.view[e+3],n+=this.view[e]<<24>>>0),t&&(this.offset+=4),n},s.readUInt32=s.readUint32,e&&(s.writeInt64=function(t,n){var r=void 0===n;if(r&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),n+=8;var i=this.buffer.byteLength;n>i&&this.resize((i*=2)>n?i:n),n-=8;var o=t.low,s=t.high;return this.littleEndian?(this.view[n+3]=o>>>24&255,this.view[n+2]=o>>>16&255,this.view[n+1]=o>>>8&255,this.view[n]=255&o,n+=4,this.view[n+3]=s>>>24&255,this.view[n+2]=s>>>16&255,this.view[n+1]=s>>>8&255,this.view[n]=255&s):(this.view[n]=s>>>24&255,this.view[n+1]=s>>>16&255,this.view[n+2]=s>>>8&255,this.view[n+3]=255&s,n+=4,this.view[n]=o>>>24&255,this.view[n+1]=o>>>16&255,this.view[n+2]=o>>>8&255,this.view[n+3]=255&o),r&&(this.offset+=8),this},s.writeLong=s.writeInt64,s.readInt64=function(t){var n=void 0===t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}var r=0,i=0;this.littleEndian?(r=this.view[t+2]<<16,r|=this.view[t+1]<<8,r|=this.view[t],r+=this.view[t+3]<<24>>>0,t+=4,i=this.view[t+2]<<16,i|=this.view[t+1]<<8,i|=this.view[t],i+=this.view[t+3]<<24>>>0):(i=this.view[t+1]<<16,i|=this.view[t+2]<<8,i|=this.view[t+3],i+=this.view[t]<<24>>>0,t+=4,r=this.view[t+1]<<16,r|=this.view[t+2]<<8,r|=this.view[t+3],r+=this.view[t]<<24>>>0);var o=new e(r,i,!1);return n&&(this.offset+=8),o},s.readLong=s.readInt64,s.writeUint64=function(t,n){var r=void 0===n;if(r&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),n+=8;var i=this.buffer.byteLength;n>i&&this.resize((i*=2)>n?i:n),n-=8;var o=t.low,s=t.high;return this.littleEndian?(this.view[n+3]=o>>>24&255,this.view[n+2]=o>>>16&255,this.view[n+1]=o>>>8&255,this.view[n]=255&o,n+=4,this.view[n+3]=s>>>24&255,this.view[n+2]=s>>>16&255,this.view[n+1]=s>>>8&255,this.view[n]=255&s):(this.view[n]=s>>>24&255,this.view[n+1]=s>>>16&255,this.view[n+2]=s>>>8&255,this.view[n+3]=255&s,n+=4,this.view[n]=o>>>24&255,this.view[n+1]=o>>>16&255,this.view[n+2]=o>>>8&255,this.view[n+3]=255&o),r&&(this.offset+=8),this},s.writeUInt64=s.writeUint64,s.readUint64=function(t){var n=void 0===t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}var r=0,i=0;this.littleEndian?(r=this.view[t+2]<<16,r|=this.view[t+1]<<8,r|=this.view[t],r+=this.view[t+3]<<24>>>0,t+=4,i=this.view[t+2]<<16,i|=this.view[t+1]<<8,i|=this.view[t],i+=this.view[t+3]<<24>>>0):(i=this.view[t+1]<<16,i|=this.view[t+2]<<8,i|=this.view[t+3],i+=this.view[t]<<24>>>0,t+=4,r=this.view[t+1]<<16,r|=this.view[t+2]<<8,r|=this.view[t+3],r+=this.view[t]<<24>>>0);var o=new e(r,i,!0);return n&&(this.offset+=8),o},s.readUInt64=s.readUint64),s.writeFloat32=function(e,t){var n=void 0===t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=4;var r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r:t),t-=4,i(this.view,e,t,this.littleEndian,23,4),n&&(this.offset+=4),this},s.writeFloat=s.writeFloat32,s.readFloat32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var n=r(this.view,e,this.littleEndian,23,4);return t&&(this.offset+=4),n},s.readFloat=s.readFloat32,s.writeFloat64=function(e,t){var n=void 0===t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=8;var r=this.buffer.byteLength;return t>r&&this.resize((r*=2)>t?r:t),t-=8,i(this.view,e,t,this.littleEndian,52,8),n&&(this.offset+=8),this},s.writeDouble=s.writeFloat64,s.readFloat64=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+8) <= "+this.buffer.byteLength)}var n=r(this.view,e,this.littleEndian,52,8);return t&&(this.offset+=8),n},s.readDouble=s.readFloat64,o.MAX_VARINT32_BYTES=5,o.calculateVarint32=function(e){return e>>>=0,e<128?1:e<16384?2:e<1<<21?3:e<1<<28?4:5},o.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},o.zigZagDecode32=function(e){return e>>>1^-(1&e)|0},s.writeVarint32=function(e,t){var n=void 0===t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}var r,i=o.calculateVarint32(e);t+=i;var s=this.buffer.byteLength;for(t>s&&this.resize((s*=2)>t?s:t),t-=i,e>>>=0;e>=128;)r=127&e|128,this.view[t++]=r,e>>>=7;return this.view[t++]=e,n?(this.offset=t,this):i},s.writeVarint32ZigZag=function(e,t){return this.writeVarint32(o.zigZagEncode32(e),t)},s.readVarint32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var n,r=0,i=0;do{if(!this.noAssert&&e>this.limit){var o=Error("Truncated");throw o.truncated=!0,o}n=this.view[e++],r<5&&(i|=(127&n)<<7*r),++r}while(0!=(128&n));return i|=0,t?(this.offset=e,i):{value:i,length:r}},s.readVarint32ZigZag=function(e){var t=this.readVarint32(e);return"object"==typeof t?t.value=o.zigZagDecode32(t.value):t=o.zigZagDecode32(t),t},e&&(o.MAX_VARINT64_BYTES=10,o.calculateVarint64=function(t){"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t));var n=t.toInt()>>>0,r=t.shiftRightUnsigned(28).toInt()>>>0,i=t.shiftRightUnsigned(56).toInt()>>>0;return 0==i?0==r?n<16384?n<128?1:2:n<1<<21?3:4:r<16384?r<128?5:6:r<1<<21?7:8:i<128?9:10},o.zigZagEncode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftLeft(1).xor(t.shiftRight(63)).toUnsigned()},o.zigZagDecode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftRightUnsigned(1).xor(t.and(e.ONE).toSigned().negate()).toSigned()},s.writeVarint64=function(t,n){var r=void 0===n;if(r&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned());var i=o.calculateVarint64(t),s=t.toInt()>>>0,a=t.shiftRightUnsigned(28).toInt()>>>0,u=t.shiftRightUnsigned(56).toInt()>>>0;n+=i;var c=this.buffer.byteLength;switch(n>c&&this.resize((c*=2)>n?c:n),n-=i,i){case 10:this.view[n+9]=u>>>7&1;case 9:this.view[n+8]=9!==i?128|u:127&u;case 8:this.view[n+7]=8!==i?a>>>21|128:a>>>21&127;case 7:this.view[n+6]=7!==i?a>>>14|128:a>>>14&127;case 6:this.view[n+5]=6!==i?a>>>7|128:a>>>7&127;case 5:this.view[n+4]=5!==i?128|a:127&a;case 4:this.view[n+3]=4!==i?s>>>21|128:s>>>21&127;case 3:this.view[n+2]=3!==i?s>>>14|128:s>>>14&127;case 2:this.view[n+1]=2!==i?s>>>7|128:s>>>7&127;case 1:this.view[n]=1!==i?128|s:127&s}return r?(this.offset+=i,this):i},s.writeVarint64ZigZag=function(e,t){return this.writeVarint64(o.zigZagEncode64(e),t)},s.readVarint64=function(t){var n=void 0===t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}var r=t,i=0,o=0,s=0,a=0;if(a=this.view[t++],i=127&a,128&a&&(a=this.view[t++],i|=(127&a)<<7,(128&a||this.noAssert&&void 0===a)&&(a=this.view[t++],i|=(127&a)<<14,(128&a||this.noAssert&&void 0===a)&&(a=this.view[t++],i|=(127&a)<<21,(128&a||this.noAssert&&void 0===a)&&(a=this.view[t++],o=127&a,(128&a||this.noAssert&&void 0===a)&&(a=this.view[t++],o|=(127&a)<<7,(128&a||this.noAssert&&void 0===a)&&(a=this.view[t++],o|=(127&a)<<14,(128&a||this.noAssert&&void 0===a)&&(a=this.view[t++],o|=(127&a)<<21,(128&a||this.noAssert&&void 0===a)&&(a=this.view[t++],s=127&a,(128&a||this.noAssert&&void 0===a)&&(a=this.view[t++],s|=(127&a)<<7,128&a||this.noAssert&&void 0===a))))))))))throw Error("Buffer overrun");var u=e.fromBits(i|o<<28,o>>>4|s<<24,!1);return n?(this.offset=t,u):{value:u,length:t-r}},s.readVarint64ZigZag=function(t){var n=this.readVarint64(t);return n&&n.value instanceof e?n.value=o.zigZagDecode64(n.value):n=o.zigZagDecode64(n),n}),s.writeCString=function(e,n){var r=void 0===n;r&&(n=this.offset);var i,o=e.length;if(!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");for(i=0;i>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}o=l.calculateUTF16asUTF8(t(e))[1],n+=o+1;var s=this.buffer.byteLength;return n>s&&this.resize((s*=2)>n?s:n),n-=o+1,l.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),this.view[n++]=0,r?(this.offset=n,this):o},s.readCString=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var r,i=e,o=-1;return l.decodeUTF8toUTF16(function(){if(0===o)return null;if(e>=this.limit)throw RangeError("Illegal range: Truncated data, "+e+" < "+this.limit);return o=this.view[e++],0===o?null:o}.bind(this),r=n(),!0),t?(this.offset=e,r()):{string:r(),length:e-i}},s.writeIString=function(e,n){var r=void 0===n;if(r&&(n=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}var i,o=n;i=l.calculateUTF16asUTF8(t(e),this.noAssert)[1],n+=4+i;var s=this.buffer.byteLength;if(n>s&&this.resize((s*=2)>n?s:n),n-=4+i,this.littleEndian?(this.view[n+3]=i>>>24&255,this.view[n+2]=i>>>16&255,this.view[n+1]=i>>>8&255,this.view[n]=255&i):(this.view[n]=i>>>24&255,this.view[n+1]=i>>>16&255,this.view[n+2]=i>>>8&255,this.view[n+3]=255&i),n+=4,l.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==o+4+i)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+4+i));return r?(this.offset=n,this):n-o},s.readIString=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var n=e,r=this.readUint32(e),i=this.readUTF8String(r,o.METRICS_BYTES,e+=4);return e+=i.length,t?(this.offset=e,i.string):{string:i.string,length:e-n}},o.METRICS_CHARS="c",o.METRICS_BYTES="b",s.writeUTF8String=function(e,n){var r=void 0===n;if(r&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}var i,o=n;i=l.calculateUTF16asUTF8(t(e))[1],n+=i;var s=this.buffer.byteLength;return n>s&&this.resize((s*=2)>n?s:n),n-=i,l.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),r?(this.offset=n,this):n-o},s.writeString=s.writeUTF8String,o.calculateUTF8Chars=function(e){return l.calculateUTF16asUTF8(t(e))[0]},o.calculateUTF8Bytes=function(e){return l.calculateUTF16asUTF8(t(e))[1]},o.calculateString=o.calculateUTF8Bytes,s.readUTF8String=function(e,t,r){"number"==typeof t&&(r=t,t=void 0);var i=void 0===r;if(i&&(r=this.offset),void 0===t&&(t=o.METRICS_CHARS),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");if(e|=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}var s,a=0,u=r;if(t===o.METRICS_CHARS){if(s=n(),l.decodeUTF8(function(){return a>>=0)<0||r+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+"+e+") <= "+this.buffer.byteLength)}var c=r+e;if(l.decodeUTF8toUTF16(function(){return r>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}var i,s,a=n;i=l.calculateUTF16asUTF8(t(e),this.noAssert)[1],s=o.calculateVarint32(i),n+=s+i;var u=this.buffer.byteLength;if(n>u&&this.resize((u*=2)>n?u:n),n-=s+i,n+=this.writeVarint32(i,n),l.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==a+i+s)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+i+s));return r?(this.offset=n,this):n-a},s.readVString=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var n=e,r=this.readVarint32(e),i=this.readUTF8String(r.value,o.METRICS_BYTES,e+=r.length);return e+=i.length,t?(this.offset=e,i.string):{string:i.string,length:e-n}},s.append=function(e,t,n){"number"!=typeof t&&"string"==typeof t||(n=t,t=void 0);var r=void 0===n;if(r&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}e instanceof o||(e=o.wrap(e,t));var i=e.limit-e.offset;if(i<=0)return this;n+=i;var s=this.buffer.byteLength;return n>s&&this.resize((s*=2)>n?s:n),n-=i,this.view.set(e.view.subarray(e.offset,e.limit),n),e.offset+=i,r&&(this.offset+=i),this},s.appendTo=function(e,t){return e.append(this,t),this},s.assert=function(e){return this.noAssert=!e,this},s.capacity=function(){return this.buffer.byteLength},s.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},s.clone=function(e){var t=new o(0,this.littleEndian,this.noAssert);return e?(t.buffer=new ArrayBuffer(this.buffer.byteLength),t.view=new Uint8Array(t.buffer)):(t.buffer=this.buffer,t.view=this.view),t.offset=this.offset,t.markedOffset=this.markedOffset,t.limit=this.limit,t},s.compact=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}if(0===e&&t===this.buffer.byteLength)return this;var n=t-e;if(0===n)return this.buffer=a,this.view=null,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=0,this;var r=new ArrayBuffer(n),i=new Uint8Array(r);return i.set(this.view.subarray(e,t)),this.buffer=r,this.view=i,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=n,this},s.copy=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}if(e===t)return new o(0,this.littleEndian,this.noAssert);var n=t-e,r=new o(n,this.littleEndian,this.noAssert);return r.offset=0,r.limit=n,r.markedOffset>=0&&(r.markedOffset-=e),this.copyTo(r,0,e,t),r},s.copyTo=function(e,t,n,r){var i,s;if(!this.noAssert&&!o.isByteBuffer(e))throw TypeError("Illegal target: Not a ByteBuffer");if(t=(s=void 0===t)?e.offset:0|t,n=(i=void 0===n)?this.offset:0|n,r=void 0===r?this.limit:0|r,t<0||t>e.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+t+" <= "+e.buffer.byteLength);if(n<0||r>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+n+" <= "+this.buffer.byteLength);var a=r-n;return 0===a?e:(e.ensureCapacity(t+a),e.view.set(this.view.subarray(n,r),t),i&&(this.offset+=a),s&&(e.offset+=a),this)},s.ensureCapacity=function(e){var t=this.buffer.byteLength;return te?t:e):this},s.fill=function(e,t,n){var r=void 0===t;if(r&&(t=this.offset),"string"==typeof e&&e.length>0&&(e=e.charCodeAt(0)),void 0===t&&(t=this.offset),void 0===n&&(n=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof n||n%1!=0)throw TypeError("Illegal end: Not an integer");if(n>>>=0,t<0||t>n||n>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+n+" <= "+this.buffer.byteLength)}if(t>=n)return this;for(;t>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}return this.markedOffset=e,this},s.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},s.LE=function(e){return this.littleEndian=void 0===e||!!e,this},s.BE=function(e){return this.littleEndian=void 0!==e&&!e,this},s.prepend=function(e,t,n){"number"!=typeof t&&"string"==typeof t||(n=t,t=void 0);var r=void 0===n;if(r&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}e instanceof o||(e=o.wrap(e,t));var i=e.limit-e.offset;if(i<=0)return this;var s=i-n;if(s>0){var a=new ArrayBuffer(this.buffer.byteLength+s),u=new Uint8Array(a);u.set(this.view.subarray(n,this.buffer.byteLength),i),this.buffer=a,this.view=u,this.offset+=s,this.markedOffset>=0&&(this.markedOffset+=s),this.limit+=s,n+=s}else{new Uint8Array(this.buffer)}return this.view.set(e.view.subarray(e.offset,e.limit),n-i),e.offset=e.limit,r&&(this.offset-=i),this},s.prependTo=function(e,t){return e.prepend(this,t),this},s.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},s.remaining=function(){return this.limit-this.offset},s.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},s.resize=function(e){if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal capacity: "+e+" (not an integer)");if((e|=0)<0)throw RangeError("Illegal capacity: 0 <= "+e)}if(this.buffer.byteLength>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}return e===t?this:(Array.prototype.reverse.call(this.view.subarray(e,t)),this)},s.skip=function(e){if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");e|=0}var t=this.offset+e;if(!this.noAssert&&(t<0||t>this.buffer.byteLength))throw RangeError("Illegal length: 0 <= "+this.offset+" + "+e+" <= "+this.buffer.byteLength);return this.offset=t,this},s.slice=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var n=this.clone();return n.offset=e,n.limit=t,n},s.toBuffer=function(e){var t=this.offset,n=this.limit;if(!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: Not an integer");if(t>>>=0,"number"!=typeof n||n%1!=0)throw TypeError("Illegal limit: Not an integer");if(n>>>=0,t<0||t>n||n>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+n+" <= "+this.buffer.byteLength)}if(!e&&0===t&&n===this.buffer.byteLength)return this.buffer;if(t===n)return a;var r=new ArrayBuffer(n-t);return new Uint8Array(r).set(new Uint8Array(this.buffer).subarray(t,n),0),r},s.toArrayBuffer=s.toBuffer,s.toString=function(e,t,n){if(void 0===e)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch("number"==typeof e&&(e="utf8",t=e,n=t),e){case"utf8":return this.toUTF8(t,n);case"base64":return this.toBase64(t,n);case"hex":return this.toHex(t,n);case"binary":return this.toBinary(t,n);case"debug":return this.toDebug();case"columns":return this.toColumns();default:throw Error("Unsupported encoding: "+e)}};var c=function(){for(var e={},t=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],n=[],r=0,i=t.length;r>2&63]),i=(3&r)<<4,null!==(r=e())?(i|=r>>4&15,n(t[63&(i|r>>4&15)]),i=(15&r)<<2,null!==(r=e())?(n(t[63&(i|r>>6&3)]),n(t[63&r])):(n(t[63&i]),n(61))):(n(t[63&i]),n(61),n(61))},e.decode=function(e,t){function r(e){throw Error("Illegal character code: "+e)}for(var i,o,s;null!==(i=e());)if(o=n[i],void 0===o&&r(i),null!==(i=e())&&(s=n[i],void 0===s&&r(i),t(o<<2>>>0|(48&s)>>4),null!==(i=e()))){if(void 0===(o=n[i])){if(61===i)break;r(i)}if(t((15&s)<<4>>>0|(60&o)>>2),null!==(i=e())){if(void 0===(s=n[i])){if(61===i)break;r(i)}t((3&o)<<6>>>0|s)}}},e.test=function(e){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e)},e}();s.toBase64=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),e|=0,t|=0,e<0||t>this.capacity||e>t)throw RangeError("begin, end");var r;return c.encode(function(){return ethis.capacity()||e>t)throw RangeError("begin, end");if(e===t)return"";for(var n=[],r=[];e=1024&&(r.push(String.fromCharCode.apply(String,n)),n=[]);return r.join("")+String.fromCharCode.apply(String,n)},o.fromBinary=function(e,t){if("string"!=typeof e)throw TypeError("str");for(var n,r=0,i=e.length,s=new o(i,t);r255)throw RangeError("illegal char code: "+n);s.view[r++]=n}return s.limit=i,s},s.toDebug=function(e){for(var t,n=-1,r=this.buffer.byteLength,i="",o="",s="";n32&&t<127?String.fromCharCode(t):".")),++n,e&&n>0&&n%16==0&&n!==r){for(;i.length<51;)i+=" ";s+=i+o+"\n",i=o=""}n===this.offset&&n===this.limit?i+=n===this.markedOffset?"!":"|":n===this.offset?i+=n===this.markedOffset?"[":"<":n===this.limit?i+=n===this.markedOffset?"]":">":i+=n===this.markedOffset?"'":e||0!==n&&n!==r?" ":""}if(e&&" "!==i){for(;i.length<51;)i+=" ";s+=i+o+"\n"}return e?s:i},o.fromDebug=function(e,t,n){for(var r,i,s=e.length,a=new o((s+1)/3|0,t,n),u=0,c=0,l=!1,f=!1,h=!1,d=!1,p=!1;u":if(!n){if(d){p=!0;break}d=!0}a.limit=c,l=!1;break;case"'":if(!n){if(h){p=!0;break}h=!0}a.markedOffset=c,l=!1;break;case" ":l=!1;break;default:if(!n&&l){p=!0;break}if(i=parseInt(r+e.charAt(u++),16),!n&&(isNaN(i)||i<0||i>255))throw TypeError("Illegal str: Not a debug encoded string");a.view[c++]=i,l=!0}if(p)throw TypeError("Illegal str: Invalid symbol at "+u)}if(!n){if(!f||!d)throw TypeError("Illegal str: Missing offset or limit");if(c>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}for(var n,r=new Array(t-e);e255))throw TypeError("Illegal str: Contains non-hex characters");s.view[u++]=r}return s.limit=u,s};var l=function(){var e={};return e.MAX_CODEPOINT=1114111,e.encodeUTF8=function(e,t){var n=null;for("number"==typeof e&&(n=e,e=function(){return null});null!==n||null!==(n=e());)n<128?t(127&n):n<2048?(t(n>>6&31|192),t(63&n|128)):n<65536?(t(n>>12&15|224),t(n>>6&63|128),t(63&n|128)):(t(n>>18&7|240),t(n>>12&63|128),t(n>>6&63|128),t(63&n|128)),n=null},e.decodeUTF8=function(e,t){for(var n,r,i,o,s=function(e){e=e.slice(0,e.indexOf(null));var t=Error(e.toString());throw t.name="TruncatedError",t.bytes=e,t};null!==(n=e());)if(0==(128&n))t(n);else if(192==(224&n))null===(r=e())&&s([n,r]),t((31&n)<<6|63&r);else if(224==(240&n))(null===(r=e())||null===(i=e()))&&s([n,r,i]),t((15&n)<<12|(63&r)<<6|63&i);else{if(240!=(248&n))throw RangeError("Illegal starting byte: "+n);(null===(r=e())||null===(i=e())||null===(o=e()))&&s([n,r,i,o]),t((7&n)<<18|(63&r)<<12|(63&i)<<6|63&o)}},e.UTF16toUTF8=function(e,t){for(var n,r=null;;){if(null===(n=null!==r?r:e()))break;n>=55296&&n<=57343&&null!==(r=e())&&r>=56320&&r<=57343?(t(1024*(n-55296)+r-56320+65536),r=null):t(n)}null!==r&&t(r)},e.UTF8toUTF16=function(e,t){var n=null;for("number"==typeof e&&(n=e,e=function(){return null});null!==n||null!==(n=e());)n<=65535?t(n):(n-=65536,t(55296+(n>>10)),t(n%1024+56320)),n=null},e.encodeUTF16toUTF8=function(t,n){e.UTF16toUTF8(t,function(t){e.encodeUTF8(t,n)})},e.decodeUTF8toUTF16=function(t,n){e.decodeUTF8(t,function(t){e.UTF8toUTF16(t,n)})},e.calculateCodePoint=function(e){return e<128?1:e<2048?2:e<65536?3:4},e.calculateUTF8=function(e){for(var t,n=0;null!==(t=e());)n+=t<128?1:t<2048?2:t<65536?3:4;return n},e.calculateUTF16asUTF8=function(t){var n=0,r=0;return e.UTF16toUTF8(t,function(e){++n,r+=e<128?1:e<2048?2:e<65536?3:4}),[n,r]},e}();return s.toUTF8=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var r;try{l.decodeUTF8toUTF16(function(){return e * Released under the Apache License, Version 2.0 * see: https://github.com/dcodeIO/protobuf.js for details */ !function(t,n){"function"==typeof w&&e&&e.exports?e.exports=n(rt,!0):(t.dcodeIO=t.dcodeIO||{}).ProtoBuf=n(t.dcodeIO.ByteBuffer)}(pe,function(e,t){var n={};return n.ByteBuffer=e,n.Long=e.Long||null,n.VERSION="5.0.3",n.WIRE_TYPES={},n.WIRE_TYPES.VARINT=0,n.WIRE_TYPES.BITS64=1,n.WIRE_TYPES.LDELIM=2,n.WIRE_TYPES.STARTGROUP=3,n.WIRE_TYPES.ENDGROUP=4,n.WIRE_TYPES.BITS32=5,n.PACKABLE_WIRE_TYPES=[n.WIRE_TYPES.VARINT,n.WIRE_TYPES.BITS64,n.WIRE_TYPES.BITS32],n.TYPES={int32:{name:"int32",wireType:n.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:n.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:n.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:n.WIRE_TYPES.VARINT,defaultValue:n.Long?n.Long.ZERO:void 0},uint64:{name:"uint64",wireType:n.WIRE_TYPES.VARINT,defaultValue:n.Long?n.Long.UZERO:void 0},sint64:{name:"sint64",wireType:n.WIRE_TYPES.VARINT,defaultValue:n.Long?n.Long.ZERO:void 0},bool:{name:"bool",wireType:n.WIRE_TYPES.VARINT,defaultValue:!1},double:{name:"double",wireType:n.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:n.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:n.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:n.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:n.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:n.WIRE_TYPES.BITS64,defaultValue:n.Long?n.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:n.WIRE_TYPES.BITS64,defaultValue:n.Long?n.Long.ZERO:void 0},float:{name:"float",wireType:n.WIRE_TYPES.BITS32,defaultValue:0},enum:{name:"enum",wireType:n.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:n.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:n.WIRE_TYPES.STARTGROUP,defaultValue:null}},n.MAP_KEY_TYPES=[n.TYPES.int32,n.TYPES.sint32,n.TYPES.sfixed32,n.TYPES.uint32,n.TYPES.fixed32,n.TYPES.int64,n.TYPES.sint64,n.TYPES.sfixed64,n.TYPES.uint64,n.TYPES.fixed64,n.TYPES.bool,n.TYPES.string,n.TYPES.bytes],n.ID_MIN=1,n.ID_MAX=536870911,n.convertFieldsToCamelCase=!1,n.populateAccessors=!0,n.populateDefaults=!0,n.Util=function(){var e={};return e.IS_NODE=!("object"!=typeof de||de+""!="[object process]"||de.browser),e.XHR=function(){for(var e=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],t=null,n=0;n]/g,RULE:/^(?:required|optional|repeated|map)$/,TYPE:/^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,NAME:/^[a-zA-Z_][a-zA-Z_0-9]*$/,TYPEDEF:/^[a-zA-Z][a-zA-Z_0-9]*$/,TYPEREF:/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,FQTYPEREF:/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/,NUMBER:/^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,NUMBER_DEC:/^(?:[1-9][0-9]*|0)$/,NUMBER_HEX:/^0[xX][0-9a-fA-F]+$/,NUMBER_OCT:/^0[0-7]+$/,NUMBER_FLT:/^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,BOOL:/^(?:true|false)$/i,ID:/^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,NEGID:/^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,WHITESPACE:/\s/,STRING:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,STRING_DQ:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,STRING_SQ:/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g},n.Reflect=function(t){function n(n){if("string"==typeof n&&(n=t.TYPES[n]),void 0===n.defaultValue)throw Error("default value for type "+n.name+" is not supported");return n==t.TYPES.bytes?new e(0):n.defaultValue}function r(e,n){if(e&&"number"==typeof e.low&&"number"==typeof e.high&&"boolean"==typeof e.unsigned&&e.low===e.low&&e.high===e.high)return new t.Long(e.low,e.high,void 0===n?e.unsigned:n);if("string"==typeof e)return t.Long.fromString(e,n||!1,10);if("number"==typeof e)return t.Long.fromNumber(e,n||!1);throw Error("not convertible to Long")}function i(e,n){var r=n.readVarint32(),o=7&r,s=r>>>3;switch(o){case t.WIRE_TYPES.VARINT:do{r=n.readUint8()}while(128==(128&r));break;case t.WIRE_TYPES.BITS64:n.offset+=8;break;case t.WIRE_TYPES.LDELIM:r=n.readVarint32(),n.offset+=r;break;case t.WIRE_TYPES.STARTGROUP:i(s,n);break;case t.WIRE_TYPES.ENDGROUP:if(s===e)return!1;throw Error("Illegal GROUPEND after unknown group: "+s+" ("+e+" expected)");case t.WIRE_TYPES.BITS32:n.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+e+": "+o)}return!0}var o={},s=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},a=s.prototype;a.fqn=function(){for(var e=this.name,t=this;;){if(null==(t=t.parent))break;e=t.name+"."+e}return e},a.toString=function(e){return(e?this.className+" ":"")+this.fqn()},a.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},o.T=s;var u=function(e,t,n,r,i){s.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=r||{},this.syntax=i||"proto2"},c=u.prototype=Object.create(s.prototype);c.getChildren=function(e){if(null==(e=e||null))return this.children.slice();for(var t=[],n=0,r=this.children.length;n4294967295?0|n:n;case t.TYPES.uint32:case t.TYPES.fixed32:return("number"!=typeof n||n===n&&n%1!=0)&&i(typeof n,"not an integer"),n<0?n>>>0:n;case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:if(t.Long)try{return r(n,!1)}catch(e){i(typeof n,e.message)}else i(typeof n,"requires Long.js");case t.TYPES.uint64:case t.TYPES.fixed64:if(t.Long)try{return r(n,!0)}catch(e){i(typeof n,e.message)}else i(typeof n,"requires Long.js");case t.TYPES.bool:return"boolean"!=typeof n&&i(typeof n,"not a boolean"),n;case t.TYPES.float:case t.TYPES.double:return"number"!=typeof n&&i(typeof n,"not a number"),n;case t.TYPES.string:return"string"==typeof n||n&&n instanceof String||i(typeof n,"not a string"),""+n;case t.TYPES.bytes:return e.isByteBuffer(n)?n:e.wrap(n,"base64");case t.TYPES.enum:var s=this.resolvedType.getChildren(t.Reflect.Enum.Value);for(u=0;u4294967295||n<0)&&i(typeof n,"not in range for uint32"),n;i(n,"not a valid enum value");case t.TYPES.group:case t.TYPES.message:if(n&&"object"==typeof n||i(typeof n,"object expected"),n instanceof this.resolvedType.clazz)return n;if(n instanceof t.Builder.Message){var a={};for(var u in n)n.hasOwnProperty(u)&&(a[u]=n[u]);n=a}return new this.resolvedType.clazz(n)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+n+" (undefined type "+this.type+")")},f.calculateLength=function(n,r){if(null===r)return 0;var i;switch(this.type){case t.TYPES.int32:return r<0?e.calculateVarint64(r):e.calculateVarint32(r);case t.TYPES.uint32:return e.calculateVarint32(r);case t.TYPES.sint32:return e.calculateVarint32(e.zigZagEncode32(r));case t.TYPES.fixed32:case t.TYPES.sfixed32:case t.TYPES.float:return 4;case t.TYPES.int64:case t.TYPES.uint64:return e.calculateVarint64(r);case t.TYPES.sint64:return e.calculateVarint64(e.zigZagEncode64(r));case t.TYPES.fixed64:case t.TYPES.sfixed64:return 8;case t.TYPES.bool:return 1;case t.TYPES.enum:return e.calculateVarint32(r);case t.TYPES.double:return 8;case t.TYPES.string:return i=e.calculateUTF8Bytes(r),e.calculateVarint32(i)+i;case t.TYPES.bytes:if(r.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+r.remaining()+" bytes remaining");return e.calculateVarint32(r.remaining())+r.remaining();case t.TYPES.message:return i=this.resolvedType.calculate(r),e.calculateVarint32(i)+i;case t.TYPES.group:return(i=this.resolvedType.calculate(r))+e.calculateVarint32(n<<3|t.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+r+" (unknown type)")},f.encodeValue=function(n,r,i){if(null===r)return i;switch(this.type){case t.TYPES.int32:r<0?i.writeVarint64(r):i.writeVarint32(r);break;case t.TYPES.uint32:i.writeVarint32(r);break;case t.TYPES.sint32:i.writeVarint32ZigZag(r);break;case t.TYPES.fixed32:i.writeUint32(r);break;case t.TYPES.sfixed32:i.writeInt32(r);break;case t.TYPES.int64:case t.TYPES.uint64:i.writeVarint64(r);break;case t.TYPES.sint64:i.writeVarint64ZigZag(r);break;case t.TYPES.fixed64:i.writeUint64(r);break;case t.TYPES.sfixed64:i.writeInt64(r);break;case t.TYPES.bool:"string"==typeof r?i.writeVarint32("false"===r.toLowerCase()?0:!!r):i.writeVarint32(r?1:0);break;case t.TYPES.enum:i.writeVarint32(r);break;case t.TYPES.float:i.writeFloat32(r);break;case t.TYPES.double:i.writeFloat64(r);break;case t.TYPES.string:i.writeVString(r);break;case t.TYPES.bytes:if(r.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+r.remaining()+" bytes remaining");var o=r.offset;i.writeVarint32(r.remaining()),i.append(r),r.offset=o;break;case t.TYPES.message:var s=(new e).LE();this.resolvedType.encode(r,s),i.writeVarint32(s.offset),i.append(s.flip());break;case t.TYPES.group:this.resolvedType.encode(r,i),i.writeVarint32(n<<3|t.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+r+" (unknown type)")}return i},f.decode=function(e,n,r){if(n!=this.type.wireType)throw Error("Unexpected wire type for element");var i,o;switch(this.type){case t.TYPES.int32:return 0|e.readVarint32();case t.TYPES.uint32:return e.readVarint32()>>>0;case t.TYPES.sint32:return 0|e.readVarint32ZigZag();case t.TYPES.fixed32:return e.readUint32()>>>0;case t.TYPES.sfixed32:return 0|e.readInt32();case t.TYPES.int64:return e.readVarint64();case t.TYPES.uint64:return e.readVarint64().toUnsigned();case t.TYPES.sint64:return e.readVarint64ZigZag();case t.TYPES.fixed64:return e.readUint64();case t.TYPES.sfixed64:return e.readInt64();case t.TYPES.bool:return!!e.readVarint32();case t.TYPES.enum:return e.readVarint32();case t.TYPES.float:return e.readFloat();case t.TYPES.double:return e.readDouble();case t.TYPES.string:return e.readVString();case t.TYPES.bytes:if(o=e.readVarint32(),e.remaining()0){var f;if(1!==arguments.length||null===r||"object"!=typeof r||!("function"!=typeof r.encode||r instanceof s)||Array.isArray(r)||r instanceof t.Map||e.isByteBuffer(r)||r instanceof ArrayBuffer||t.Long&&r instanceof t.Long)for(u=0,c=arguments.length;u0;){if(o=e.readVarint32(),s=7&o,a=o>>>3,s===t.WIRE_TYPES.ENDGROUP){if(a!==r)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+a+" ("+(r?r+" expected":"not a group")+")");break}if(u=this._fieldsById[a]){if(u.repeated&&!u.options.packed)l[u.name].push(u.decode(s,e));else if(u.map){var f=u.decode(s,e);l[u.name].set(f[0],f[1])}else if(l[u.name]=u.decode(s,e),u.oneof){var h=l[u.oneof.name];null!==h&&h!==u.name&&(l[h]=null),l[u.oneof.name]=u.name}}else switch(s){case t.WIRE_TYPES.VARINT:e.readVarint32();break;case t.WIRE_TYPES.BITS32:e.offset+=4;break;case t.WIRE_TYPES.BITS64:e.offset+=8;break;case t.WIRE_TYPES.LDELIM:var d=e.readVarint32();e.offset+=d;break;case t.WIRE_TYPES.STARTGROUP:for(;i(a,e););break;default:throw Error("Illegal wire type for unknown field "+a+" in "+this.toString(!0)+"#decode: "+s)}}for(var p=0,y=this._fields.length;p0;case t.TYPES.bytes:return e.remaining()>0;case t.TYPES.enum:return 0!==e;case t.TYPES.message:return null!==e;default:return!0}},y.encode=function(n,r,i){if(null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===n||this.repeated&&0==n.length)return r;try{if(this.repeated){var o;if(this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){r.writeVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),r.ensureCapacity(r.offset+=1);var s=r.offset;for(o=0;o1){var c=r.slice(s,r.offset);s+=u-1,r.offset=s,r.append(c)}r.writeVarint32(a,s-u)}else for(o=0;o=0){for(i+=e.calculateVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),s=0,o=0;o=0&&!r){o=n.readVarint32(),o=n.offset+o;for(var s=[];n.offset0;){var c=u.readVarint32();e=7&c;var f=c>>>3;if(1===f)a=this.keyElement.decode(u,e,f);else{if(2!==f)throw Error("Unexpected tag in map field key/value submessage");i=this.element.decode(u,e,f)}}return[a,i]}return this.element.decode(n,e,this.id)},o.Message.Field=p;var m=function(e,t,n,r,i,o,s){p.call(this,e,t,n,null,r,i,o,s),this.extension};m.prototype=Object.create(p.prototype),o.Message.ExtensionField=m;var v=function(e,t,n){s.call(this,e,t,n),this.fields=[]};o.Message.OneOf=v;var g=function(e,t,n,r,i){u.call(this,e,t,n,r,i),this.className="Enum",this.object=null};g.getName=function(e,t){for(var n,r=Object.keys(e),i=0;i0;){if(t=r.pop(),!Array.isArray(t))throw Error("not a valid namespace: "+JSON.stringify(t));for(;t.length>0;){var o=t.shift();if(i.isMessage(o)){var s=new n.Message(this,this.ptr,o.name,o.options,o.isGroup,o.syntax),a={};o.oneofs&&Object.keys(o.oneofs).forEach(function(e){s.addChild(a[e]=new n.Message.OneOf(this,s,e))},this),o.fields&&o.fields.forEach(function(e){if(null!==s.getChild(0|e.id))throw Error("duplicate or invalid field id in "+s.name+": "+e.id);if(e.options&&"object"!=typeof e.options)throw Error("illegal field options in "+s.name+"#"+e.name);var t=null;if("string"==typeof e.oneof&&!(t=a[e.oneof]))throw Error("illegal oneof in "+s.name+"#"+e.name+": "+e.oneof);e=new n.Message.Field(this,s,e.rule,e.keytype,e.type,e.name,e.id,e.options,t,o.syntax),t&&t.fields.push(e),s.addChild(e)},this);var u=[];if(o.enums&&o.enums.forEach(function(e){u.push(e)}),o.messages&&o.messages.forEach(function(e){u.push(e)}),o.services&&o.services.forEach(function(e){u.push(e)}),o.extensions&&("number"==typeof o.extensions[0]?s.extensions=[o.extensions]:s.extensions=o.extensions),this.ptr.addChild(s),u.length>0){r.push(t),t=u,u=null,this.ptr=s,s=null;continue}u=null}else if(i.isEnum(o))s=new n.Enum(this,this.ptr,o.name,o.options,o.syntax),o.values.forEach(function(e){s.addChild(new n.Enum.Value(this,s,e.name,e.id))},this),this.ptr.addChild(s);else if(i.isService(o))s=new n.Service(this,this.ptr,o.name,o.options),Object.keys(o.rpc).forEach(function(e){var t=o.rpc[e];s.addChild(new n.Service.RPCMethod(this,s,e,t.request,t.response,!!t.request_stream,!!t.response_stream,t.options))},this),this.ptr.addChild(s);else{if(!i.isExtend(o))throw Error("not a valid definition: "+JSON.stringify(o));if(s=this.ptr.resolve(o.ref,!0))o.fields.forEach(function(t){if(null!==s.getChild(0|t.id))throw Error("duplicate extended field id in "+s.name+": "+t.id);if(s.extensions){var r=!1;if(s.extensions.forEach(function(e){t.id>=e[0]&&t.id<=e[1]&&(r=!0)}),!r)throw Error("illegal extended field id in "+s.name+": "+t.id+" (not within valid ranges)")}var i=t.name;this.options.convertFieldsToCamelCase&&(i=e.Util.toCamelCase(i));var o=new n.Message.ExtensionField(this,s,t.rule,t.type,this.ptr.fqn()+"."+i,t.id,t.options),a=new n.Extension(this,this.ptr,t.name,o);o.extension=a,this.ptr.addChild(a),s.addChild(o)},this);else if(!/\.?google\.protobuf\./.test(o.ref))throw Error("extended message "+o.ref+" is not defined")}o=null,s=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},o.import=function(t,n){var i="/";if("string"==typeof n){if(e.Util.IS_NODE&&(n=it.resolve(n)),!0===this.files[n])return this.reset();this.files[n]=!0}else if("object"==typeof n){var o=n.root;e.Util.IS_NODE&&(o=it.resolve(o)),(o.indexOf("\\")>=0||n.file.indexOf("\\")>=0)&&(i="\\");var s;if(s=e.Util.IS_NODE?it.join(o,n.file):o+i+n.file,!0===this.files[s])return this.reset();this.files[s]=!0}if(t.imports&&t.imports.length>0){var a,u=!1;"object"==typeof n?(this.importRoot=n.root,u=!0,a=this.importRoot,n=n.file,(a.indexOf("\\")>=0||n.indexOf("\\")>=0)&&(i="\\")):"string"==typeof n?this.importRoot?a=this.importRoot:n.indexOf("/")>=0?""===(a=n.replace(/\/[^\/]*$/,""))&&(a="/"):n.indexOf("\\")>=0?(a=n.replace(/\\[^\\]*$/,""),i="\\"):a=".":a=null;for(var c=0;c=0;--r){var i=this.tryEntries[r],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var s=g.call(i,"catchLoc"),a=g.call(i,"finallyLoc");if(s&&a){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&g.call(r,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),h(n),I}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;h(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:p(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=m),I}}}(function(){return this||"object"==typeof self&&self}()||Function("return this")())}),Dt=function(){return this||"object"==typeof self&&self}()||Function("return this")(),Ft=Dt.regeneratorRuntime&&Object.getOwnPropertyNames(Dt).indexOf("regeneratorRuntime")>=0,Mt=Ft&&Dt.regeneratorRuntime;Dt.regeneratorRuntime=void 0;var qt=Ut;if(Ft)Dt.regeneratorRuntime=Mt;else try{delete Dt.regeneratorRuntime}catch(e){Dt.regeneratorRuntime=void 0}var Bt=qt,Vt=1e3,Yt=60*Vt,Wt=60*Yt,zt=24*Wt,Gt=7*zt,Ht=365.25*zt,Jt=function(e,t){t=t||{};var n=typeof e;if("string"===n&&e.length>0)return C(e);if("number"===n&&!1===isNaN(e))return t.long?N(e):I(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))},Qt=R,Kt=E(function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function i(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),this.useColors){var n="color: "+this.color;t.splice(1,0,n,"color: inherit");var r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(r++,"%c"===e&&(i=r))}),t.splice(i,0,n)}}function o(){var e;return"object"===("undefined"==typeof console?"undefined":n(console))&&console.log&&(e=console).log.apply(e,arguments)}function s(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}}function a(){var e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&void 0!==de&&"env"in de&&(e=de.env.DEBUG),e}t.log=o,t.formatArgs=i,t.save=s,t.load=a,t.useColors=r,t.storage=function(){try{return localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports=Qt(t),e.exports.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}),$t=(Kt.log,Kt.formatArgs,Kt.save,Kt.load,Kt.useColors,Kt.storage,Kt.colors,E(function(e){function t(e){if(e)return n(e)}function n(e){for(var n in t.prototype)e[n]=t.prototype[n];return e}e.exports=t,t.prototype.on=t.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},t.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var r,i=0;i=this._maxRetries)return!1;if(this._retryCallback)try{var n=this._retryCallback(e,t);if(!0===n)return!0;if(!1===n)return!1}catch(e){console.error(e)}if(t&&t.status&&t.status>=500&&501!=t.status)return!0;if(e){if(e.code&&~en.indexOf(e.code))return!0;if(e.timeout&&"ECONNABORTED"==e.code)return!0;if(e.crossDomain)return!0}return!1},P.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this._end()},P.prototype.then=function(e,t){var n=this;if(!this._fullfilledPromise){var r=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise(function(e,t){r.on("error",t),r.on("abort",function(){var e=new Error("Aborted");e.code="ABORTED",e.status=n.status,e.method=n.method,e.url=n.url,t(e)}),r.end(function(n,r){n?t(n):e(r)})})}return this._fullfilledPromise.then(e,t)},P.prototype.catch=function(e){return this.then(void 0,e)},P.prototype.use=function(e){return e(this),this},P.prototype.ok=function(e){if("function"!=typeof e)throw Error("Callback required");return this._okCallback=e,this},P.prototype._isResponseOK=function(e){return!!e&&(this._okCallback?this._okCallback(e):e.status>=200&&e.status<300)},P.prototype.get=function(e){return this._header[e.toLowerCase()]},P.prototype.getHeader=P.prototype.get,P.prototype.set=function(e,t){if(Xt(e)){for(var n in e)this.set(n,e[n]);return this}return this._header[e.toLowerCase()]=t,this.header[e]=t,this},P.prototype.unset=function(e){return delete this._header[e.toLowerCase()],delete this.header[e],this},P.prototype.field=function(e,t){if(null===e||void 0===e)throw new Error(".field(name, val) name can not be empty");if(this._data)throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()");if(Xt(e)){for(var n in e)this.field(n,e[n]);return this}if(Array.isArray(t)){for(var r in t)this.field(e,t[r]);return this}if(null===t||void 0===t)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof t&&(t=""+t),this._getFormData().append(e,t),this},P.prototype.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},P.prototype._auth=function(e,t,n,r){switch(n.type){case"basic":this.set("Authorization","Basic ".concat(r("".concat(e,":").concat(t))));break;case"auto":this.username=e,this.password=t;break;case"bearer":this.set("Authorization","Bearer ".concat(e))}return this},P.prototype.withCredentials=function(e){return void 0==e&&(e=!0),this._withCredentials=e,this},P.prototype.redirects=function(e){return this._maxRedirects=e,this},P.prototype.maxResponseSize=function(e){if("number"!=typeof e)throw TypeError("Invalid argument");return this._maxResponseSize=e,this},P.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},P.prototype.send=function(e){var t=Xt(e),n=this._header["content-type"];if(this._formData)throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()");if(t&&!this._data)Array.isArray(e)?this._data=[]:this._isHost(e)||(this._data={});else if(e&&this._data&&this._isHost(this._data))throw Error("Can't merge these send calls");if(t&&Xt(this._data))for(var r in e)this._data[r]=e[r];else"string"==typeof e?(n||this.type("form"),n=this._header["content-type"],this._data="application/x-www-form-urlencoded"==n?this._data?"".concat(this._data,"&").concat(e):e:(this._data||"")+e):this._data=e;return!t||this._isHost(e)?this:(n||this.type("json"),this)},P.prototype.sortQuery=function(e){return this._sort=void 0===e||e,this},P.prototype._finalizeQueryString=function(){var e=this._query.join("&");if(e&&(this.url+=(this.url.indexOf("?")>=0?"&":"?")+e),this._query.length=0,this._sort){var t=this.url.indexOf("?");if(t>=0){var n=this.url.substring(t+1).split("&");"function"==typeof this._sort?n.sort(this._sort):n.sort(),this.url=this.url.substring(0,t)+"?"+n.join("&")}}},P.prototype._appendQueryString=function(){console.trace("Unsupported")},P.prototype._timeoutError=function(e,t,n){if(!this._aborted){var r=new Error("".concat(e+t,"ms exceeded"));r.timeout=t,r.code="ECONNABORTED",r.errno=n,this.timedout=!0,this.abort(),this.callback(r)}},P.prototype._setTimeouts=function(){var e=this;this._timeout&&!this._timer&&(this._timer=setTimeout(function(){e._timeoutError("Timeout of ",e._timeout,"ETIME")},this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout(function(){e._timeoutError("Response timeout of ",e._responseTimeout,"ETIMEDOUT")},this._responseTimeout))};var tn=function(e){return e.split(/ *; */).shift()},nn=function(e){return e.split(/ *; */).reduce(function(e,t){var n=t.split(/ *= */),r=n.shift(),i=n.shift();return r&&i&&(e[r]=i),e},{})},rn=function(e){return e.split(/ *, */).reduce(function(e,t){var n=t.split(/ *; */),r=n[0].slice(1,-1);return e[n[1].split(/ *= */)[1].slice(1,-1)]=r,e},{})},on=function(e,t){return delete e["content-type"],delete e["content-length"],delete e["transfer-encoding"],delete e.host,t&&(delete e.authorization,delete e.cookie),e},sn={type:tn,params:nn,parseLinks:rn,cleanHeader:on},an=L;L.prototype.get=function(e){return this.header[e.toLowerCase()]},L.prototype._setHeaderProperties=function(e){var t=e["content-type"]||"";this.type=sn.type(t);var n=sn.params(t);for(var r in n)this[r]=n[r];this.links={};try{e.link&&(this.links=sn.parseLinks(e.link))}catch(e){}},L.prototype._setStatusProperties=function(e){var t=e/100|0;this.status=this.statusCode=e,this.statusType=t,this.info=1==t,this.ok=2==t,this.redirect=3==t,this.clientError=4==t,this.serverError=5==t,this.error=(4==t||5==t)&&this.toError(),this.created=201==e,this.accepted=202==e,this.noContent=204==e,this.badRequest=400==e,this.unauthorized=401==e,this.notAcceptable=406==e,this.forbidden=403==e,this.notFound=404==e,this.unprocessableEntity=422==e},["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert"].forEach(function(e){D.prototype[e]=function(){for(var t=arguments.length,n=new Array(t),r=0;r=2&&e._responseTimeoutTimer&&clearTimeout(e._responseTimeoutTimer),4==n){var r;try{r=t.status}catch(e){r=0}if(!r){if(e.timedout||e._aborted)return;return e.crossDomainError()}e.emit("end")}};var r=function(t,n){n.total>0&&(n.percent=n.loaded/n.total*100),n.direction=t,e.emit("progress",n)};if(this.hasListeners("progress"))try{t.onprogress=r.bind(null,"download"),t.upload&&(t.upload.onprogress=r.bind(null,"upload"))}catch(e){}try{this.username&&this.password?t.open(this.method,this.url,!0,this.username,this.password):t.open(this.method,this.url,!0)}catch(e){return this.callback(e)}if(this._withCredentials&&(t.withCredentials=!0),!this._formData&&"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof n&&!this._isHost(n)){var i=this._header["content-type"],o=this._serializer||d.serialize[i?i.split(";")[0]:""];!o&&u(i)&&(o=d.serialize["application/json"]),o&&(n=o(n))}for(var s in this.header)null!=this.header[s]&&this.header.hasOwnProperty(s)&&t.setRequestHeader(s,this.header[s]);this._responseType&&(t.responseType=this._responseType),this.emit("request",this),t.send(void 0!==n?n:null)},d.agent=function(){return new un},["GET","POST","OPTIONS","PATCH","PUT","DELETE"].forEach(function(e){un.prototype[e.toLowerCase()]=function(t,n){var r=new d.Request(e,t);return this._setDefaults(r),n&&r.end(n),r}}),un.prototype.del=un.prototype.delete,d.get=function(e,t,n){var r=d("GET",e);return"function"==typeof t&&(n=t,t=null),t&&r.query(t),n&&r.end(n),r},d.head=function(e,t,n){var r=d("HEAD",e);return"function"==typeof t&&(n=t,t=null),t&&r.query(t),n&&r.end(n),r},d.options=function(e,t,n){var r=d("OPTIONS",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},d.del=f,d.delete=f,d.patch=function(e,t,n){var r=d("PATCH",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},d.post=function(e,t,n){var r=d("POST",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},d.put=function(e,t,n){var r=d("PUT",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r}}),ln=(cn.Request,F),fn=Math.floor,hn=Math.random,dn=M,pn=q,yn=B,mn=V,vn=Y,gn=W,_n="object"==typeof pe&&pe&&pe.Object===Object&&pe,bn=_n,wn="object"==typeof self&&self&&self.Object===Object&&self,En=bn||wn||Function("return this")(),Tn=En,Sn=Tn.Symbol,On=Sn,An=Object.prototype,Cn=An.hasOwnProperty,In=An.toString,Nn=On?On.toStringTag:void 0,xn=z,Rn=Object.prototype,kn=Rn.toString,Pn=G,jn="[object Null]",Ln="[object Undefined]",Un=On?On.toStringTag:void 0,Dn=H,Fn=J,Mn="[object Arguments]",qn=Q,Bn=Object.prototype,Vn=Bn.hasOwnProperty,Yn=Bn.propertyIsEnumerable,Wn=qn(function(){return arguments}())?qn:function(e){return Fn(e)&&Vn.call(e,"callee")&&!Yn.call(e,"callee")},zn=Wn,Gn=Array.isArray,Hn=Gn,Jn=K,Qn=E(function(e,t){var n=t&&!t.nodeType&&t,r=n&&!0&&e&&!e.nodeType&&e,i=r&&r.exports===n,o=i?Tn.Buffer:void 0,s=o?o.isBuffer:void 0,a=s||Jn;e.exports=a}),Kn=9007199254740991,$n=/^(?:0|[1-9]\d*)$/,Xn=$,Zn=9007199254740991,er=X,tr={};tr["[object Float32Array]"]=tr["[object Float64Array]"]=tr["[object Int8Array]"]=tr["[object Int16Array]"]=tr["[object Int32Array]"]=tr["[object Uint8Array]"]=tr["[object Uint8ClampedArray]"]=tr["[object Uint16Array]"]=tr["[object Uint32Array]"]=!0,tr["[object Arguments]"]=tr["[object Array]"]=tr["[object ArrayBuffer]"]=tr["[object Boolean]"]=tr["[object DataView]"]=tr["[object Date]"]=tr["[object Error]"]=tr["[object Function]"]=tr["[object Map]"]=tr["[object Number]"]=tr["[object Object]"]=tr["[object RegExp]"]=tr["[object Set]"]=tr["[object String]"]=tr["[object WeakMap]"]=!1;var nr=Z,rr=ee,ir=E(function(e,t){var n=t&&!t.nodeType&&t,r=n&&!0&&e&&!e.nodeType&&e,i=r&&r.exports===n,o=i&&bn.process,s=function(){try{var e=r&&r.require&&r.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=s}),or=ir&&ir.isTypedArray,sr=or?rr(or):nr,ar=sr,ur=Object.prototype,cr=ur.hasOwnProperty,lr=te,fr=Object.prototype,hr=ne,dr=re,pr=dr(Object.keys,Object),yr=pr,mr=Object.prototype,vr=mr.hasOwnProperty,gr=ie,_r=oe,br="[object AsyncFunction]",wr="[object Function]",Er="[object GeneratorFunction]",Tr="[object Proxy]",Sr=se,Or=ae,Ar=ue,Cr=ce,Ir=le,Nr=fe,xr=E(function(e,t){!function(){var n={VERSION:"2.4.0",Result:{SUCCEEDED:1,NOTRANSITION:2,CANCELLED:3,PENDING:4},Error:{INVALID_TRANSITION:100,PENDING_TRANSITION:200,INVALID_CALLBACK:300},WILDCARD:"*",ASYNC:"async",create:function(e,t){var r="string"==typeof e.initial?{state:e.initial}:e.initial,i=e.terminal||e.final,o=t||e.target||{},s=e.events||[],a=e.callbacks||{},u={},c={},l=function(e){var t=Array.isArray(e.from)?e.from:e.from?[e.from]:[n.WILDCARD];u[e.name]=u[e.name]||{};for(var r=0;r=0:this.current===e},o.can=function(e){return!this.transition&&void 0!==u[e]&&(u[e].hasOwnProperty(this.current)||u[e].hasOwnProperty(n.WILDCARD))},o.cannot=function(e){return!this.can(e)},o.transitions=function(){return(c[this.current]||[]).concat(c[n.WILDCARD]||[])},o.isFinished=function(){return this.is(i)},o.error=e.error||function(e,t,n,r,i,o,s){throw s||o},o.states=function(){return Object.keys(c).sort()},r&&!r.defer&&o[r.event](),o},doCallback:function(e,t,r,i,o,s){if(t)try{return t.apply(e,[r,i,o].concat(s))}catch(t){return e.error(r,i,o,s,n.Error.INVALID_CALLBACK,"an exception occurred in a caller-provided callback function",t)}},beforeAnyEvent:function(e,t,r,i,o){return n.doCallback(e,e.onbeforeevent,t,r,i,o)},afterAnyEvent:function(e,t,r,i,o){return n.doCallback(e,e.onafterevent||e.onevent,t,r,i,o)},leaveAnyState:function(e,t,r,i,o){return n.doCallback(e,e.onleavestate,t,r,i,o)},enterAnyState:function(e,t,r,i,o){return n.doCallback(e,e.onenterstate||e.onstate,t,r,i,o)},changeState:function(e,t,r,i,o){return n.doCallback(e,e.onchangestate,t,r,i,o)},beforeThisEvent:function(e,t,r,i,o){return n.doCallback(e,e["onbefore"+t],t,r,i,o)},afterThisEvent:function(e,t,r,i,o){return n.doCallback(e,e["onafter"+t]||e["on"+t],t,r,i,o)},leaveThisState:function(e,t,r,i,o){return n.doCallback(e,e["onleave"+r],t,r,i,o)},enterThisState:function(e,t,r,i,o){return n.doCallback(e,e["onenter"+i]||e["on"+i],t,r,i,o)},beforeEvent:function(e,t,r,i,o){if(!1===n.beforeThisEvent(e,t,r,i,o)||!1===n.beforeAnyEvent(e,t,r,i,o))return!1},afterEvent:function(e,t,r,i,o){n.afterThisEvent(e,t,r,i,o),n.afterAnyEvent(e,t,r,i,o)},leaveState:function(e,t,r,i,o){var s=n.leaveThisState(e,t,r,i,o),a=n.leaveAnyState(e,t,r,i,o);return!1!==s&&!1!==a&&(n.ASYNC===s||n.ASYNC===a?n.ASYNC:void 0)},enterState:function(e,t,r,i,o){n.enterThisState(e,t,r,i,o),n.enterAnyState(e,t,r,i,o)},buildEvent:function(e,t){return function(){var r=this.current,i=t[r]||(t[n.WILDCARD]!=n.WILDCARD?t[n.WILDCARD]:r)||r,o=Array.prototype.slice.call(arguments);if(this.transition)return this.error(e,r,i,o,n.Error.PENDING_TRANSITION,"event "+e+" inappropriate because previous transition did not complete");if(this.cannot(e))return this.error(e,r,i,o,n.Error.INVALID_TRANSITION,"event "+e+" inappropriate in current state "+this.current);if(!1===n.beforeEvent(this,e,r,i,o))return n.Result.CANCELLED;if(r===i)return n.afterEvent(this,e,r,i,o),n.Result.NOTRANSITION;var s=this;this.transition=function(){return s.transition=null,s.current=i,n.enterState(s,e,r,i,o),n.changeState(s,e,r,i,o),n.afterEvent(s,e,r,i,o),n.Result.SUCCEEDED},this.transition.cancel=function(){s.transition=null,n.afterEvent(s,e,r,i,o)};var a=n.leaveState(this,e,r,i,o);return!1===a?(this.transition=null,n.Result.CANCELLED):n.ASYNC===a?n.Result.PENDING:this.transition?this.transition():void 0}}};e.exports&&(t=e.exports=n),t.StateMachine=n}()}),Rr=(xr.StateMachine,dr(Object.getPrototypeOf,Object)),kr=Rr,Pr="[object Object]",jr=Function.prototype,Lr=Object.prototype,Ur=jr.toString,Dr=Lr.hasOwnProperty,Fr=Ur.call(Object),Mr=he,qr=void 0!==e?e:"undefined"!=typeof window?window:{},Br=Symbol("expired"),Vr=Kt("LC:Expirable"),Yr=function(){function e(e,t){this.originalValue=e,"number"==typeof t&&(this.expiredAt=Date.now()+t)}return s(e,[{key:"value",get:function(){var e=this.expiredAt&&this.expiredAt<=Date.now();return e&&Vr("expired: ".concat(this.originalValue)),e?Br:this.originalValue}}]),e}();Yr.EXPIRED=Br;var Wr,zr=Kt("LC:Cache"),Gr=function(){function e(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"anonymous";this.name=e,this._map={}}var t=e.prototype;return t.get=function(e){var t=this._map[e];if(t){var n=t.value;if(n!==Yr.EXPIRED)return zr("[%s] hit: %s",this.name,e),n;delete this._map[e]}return zr("[".concat(this.name,"] missed: ").concat(e)),null},t.set=function(e,t,n){zr("[%s] set: %s %d",this.name,e,n),this._map[e]=new Yr(t,n)},e}(),Hr={enable:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"LC*";return Kt.enable(e)},disable:Kt.disable},Jr=function e(t){var n=new Promise(t[0]);return 1===t.length?n:n.catch(function(){return e(t.slice(1))})},Qr=function(e){return function(t){return e(t),t}},Kr=(qr.navigator&&qr.navigator.userAgent&&qr.navigator.userAgent.indexOf("MSIE 10."),new WeakMap),$r=function(e){return Kr.has(e)||Kr.set(e,{}),Kr.get(e)},Xr=function e(t,n){if(!Mr(t))return t;var r=Object.assign({},t);for(var i in r)if({}.hasOwnProperty.call(r,i)){var o=r[i];o===n?delete r[i]:r[i]=e(o,n)}return r},Zr=function(e){return Xr(e,null)},ei=function(e){return Zr(JSON.parse(JSON.stringify(e)))},ti=function(e){return Array.isArray(e)?e:void 0===e||null===e?[]:[e]},ni="object"===("undefined"==typeof wx?"undefined":n(wx))&&"function"==typeof wx.connectSocket,ri=Kt("LC:WebSocketPlus"),ii=function(e){return Math.min(1e3*Math.pow(2,e),3e5)},oi=function(e,t,n){return Object.assign({},n,{value:function(){var e;this.checkConnectionAvailability(t);for(var r=arguments.length,i=new Array(r),o=0;o3?r-3:0),o=3;o ").concat(n," %o"),i)},n.onopen=function(){this.emit("open")},n.onconnected=function(){this._startConnectionKeeper()},n.onleaveconnected=function(e,t,n){this._stopConnectionKeeper(),this._destroyWs(),"offline"!==n&&"disconnected"!==n||this.emit("disconnect")},n.onpause=function(){this.emit("offline")},n.onbeforeresume=function(){this.emit("online")},n.onreconnect=function(){this.emit("reconnect")},n.ondisconnected=function(e,t,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=ii.call(null,i);ri("schedule attempt=".concat(i," delay=").concat(o)),this.emit("schedule",i,o),this.__scheduledRetry&&clearTimeout(this.__scheduledRetry),this.__scheduledRetry=setTimeout(function(){r.is("disconnected")&&r.retry(i)},o)},n.onretry=function(e,t,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;this.emit("retry",i),this._open().then(function(){return r.can("reconnect")?r.reconnect():r._destroyWs()},function(){return r.can("fail")&&r.fail(i+1)})},n.onerror=function(e,t,n,r){this.emit("error",r)},n.onclose=function(){qr.removeEventListener&&(this.__pause&&qr.removeEventListener("offline",this.__pause),this.__resume&&qr.removeEventListener("online",this.__resume))},n.checkConnectionAvailability=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"API";if(!this.is("connected")){var t=this.current;throw console.warn("".concat(e," should not be called when the connection is ").concat(t)),(this.is("disconnected")||this.is("reconnecting"))&&console.warn("disconnect and reconnect event should be handled to avoid such calls."),new Error("Connection unavailable")}},n._ping=function(){ri("ping");try{this.ping()}catch(e){console.warn("websocket ping error: ".concat(e.message))}},n.ping=function(){this._ws.ping?this._ws.ping():console.warn("The WebSocket implement does not support sending ping frame.\n Override ping method to use application defined ping/pong mechanism.")},n._postponeTimeoutTimer=function(){var e=this;ri("_postponeTimeoutTimer"),this._clearTimeoutTimers(),this._timeoutTimer=setTimeout(function(){ri("timeout"),e.disconnect()},38e4)},n._clearTimeoutTimers=function(){this._timeoutTimer&&clearTimeout(this._timeoutTimer)},n._startConnectionKeeper=function(){ri("start connection keeper"),this._heartbeatTimer=setInterval(this._ping.bind(this),18e4);var e=this._ws.addListener||this._ws.addEventListener;if(!e)return void ri("connection keeper disabled due to the lack of #addEventListener.");e.call(this._ws,"message",this.__postponeTimeoutTimer),e.call(this._ws,"pong",this.__postponeTimeoutTimer),this._postponeTimeoutTimer()},n._stopConnectionKeeper=function(){ri("stop connection keeper");var e=this._ws.removeListener||this._ws.removeEventListener;e&&(e.call(this._ws,"message",this.__postponeTimeoutTimer),e.call(this._ws,"pong",this.__postponeTimeoutTimer),this._clearTimeoutTimers()),this._heartbeatTimer&&clearInterval(this._heartbeatTimer)},n._handleClose=function(e){ri("ws closed [".concat(e.code,"] ").concat(e.reason)),this.isFinished()||this.handleClose(e)},n.handleClose=function(){this.disconnect()},n.send=function(e){ri("send",e),this._ws.send(e)},n._handleMessage=function(e){ri("message",e.data),this.handleMessage(e.data)},n.handleMessage=function(e){this.emit("message",e)},t}(Lt),b(Wr.prototype,"_ping",[oi],Object.getOwnPropertyDescriptor(Wr.prototype,"_ping"),Wr.prototype),b(Wr.prototype,"send",[oi],Object.getOwnPropertyDescriptor(Wr.prototype,"send"),Wr.prototype),Wr);xr.create({target:si.prototype,initial:{state:"initialized",event:"init",defer:!0},terminal:"closed",events:[{name:"open",from:"initialized",to:"connected"},{name:"disconnect",from:"connected",to:"disconnected"},{name:"retry",from:"disconnected",to:"reconnecting"},{name:"fail",from:"reconnecting",to:"disconnected"},{name:"reconnect",from:"reconnecting",to:"connected"},{name:"pause",from:["connected","disconnected","reconnecting"],to:"offline"},{},{name:"resume",from:"offline",to:"disconnected"},{name:"close",from:["connected","disconnected","reconnecting","offline"],to:"closed"},{name:"throw",from:"*",to:"error"}]});var ai=Object.freeze({1e3:{name:"CLOSE_NORMAL"},1006:{name:"CLOSE_ABNORMAL"},4100:{name:"APP_NOT_AVAILABLE",message:"App not exists or realtime message service is disabled."},4102:{name:"SIGNATURE_FAILED",message:"Login signature mismatch."},4103:{name:"INVALID_LOGIN",message:"Malformed clientId."},4105:{name:"SESSION_REQUIRED",message:"Message sent before session opened."},4107:{name:"READ_TIMEOUT"},4108:{name:"LOGIN_TIMEOUT"},4109:{name:"FRAME_TOO_LONG"},4110:{name:"INVALID_ORIGIN",message:"Access denied by domain whitelist."},4111:{name:"SESSION_CONFLICT"},4112:{name:"SESSION_TOKEN_EXPIRED"},4113:{name:"APP_QUOTA_EXCEEDED",message:"The daily active users limit exceeded."},4116:{name:"MESSAGE_SENT_QUOTA_EXCEEDED",message:"Command sent too fast."},4200:{name:"INTERNAL_ERROR",message:"Internal error, please contact LeanCloud for support."},4301:{name:"CONVERSATION_API_FAILED",message:"Upstream Conversatoin API failed, see error.detail for details."},4302:{name:"CONVERSATION_SIGNATURE_FAILED",message:"Conversation action signature mismatch."},4303:{name:"CONVERSATION_NOT_FOUND"},4304:{name:"CONVERSATION_FULL"},4305:{name:"CONVERSATION_REJECTED_BY_APP",message:"Conversation action rejected by hook."},4306:{name:"CONVERSATION_UPDATE_FAILED"},4307:{name:"CONVERSATION_READ_ONLY"},4308:{name:"CONVERSATION_NOT_ALLOWED"},4309:{name:"CONVERSATION_UPDATE_REJECTED",message:"Conversation update rejected because the client is not a member."},4310:{name:"CONVERSATION_QUERY_FAILED",message:"Conversation query failed because it is too expansive."},4311:{name:"CONVERSATION_LOG_FAILED"},4312:{name:"CONVERSATION_LOG_REJECTED",message:"Message query rejected because the client is not a member of the conversation."},4313:{name:"SYSTEM_CONVERSATION_REQUIRED"},4314:{name:"NORMAL_CONVERSATION_REQUIRED"},4315:{name:"CONVERSATION_BLACKLISTED",message:"Blacklisted in the conversation."},4316:{name:"TRANSIENT_CONVERSATION_REQUIRED"},4317:{name:"CONVERSATION_MEMBERSHIP_REQUIRED"},4318:{name:"CONVERSATION_API_QUOTA_EXCEEDED",message:"LeanCloud API quota exceeded. You may upgrade your plan."},4323:{name:"TEMPORARY_CONVERSATION_EXPIRED",message:"Temporary conversation expired or does not exist."},4401:{name:"INVALID_MESSAGING_TARGET",message:"Conversation does not exist or client is not a member."},4402:{name:"MESSAGE_REJECTED_BY_APP",message:"Message rejected by hook."},4403:{name:"MESSAGE_OWNERSHIP_REQUIRED"},4404:{name:"MESSAGE_NOT_FOUND"},4405:{name:"MESSAGE_UPDATE_REJECTED_BY_APP",message:"Message update rejected by hook."},4406:{name:"MESSAGE_EDIT_DISABLED"},4407:{name:"MESSAGE_RECALL_DISABLED"},5130:{name:"OWNER_PROMOTION_NOT_ALLOWED",message:"Updating a member's role to owner is not allowed."}}),ui=Object.freeze(Object.keys(ai).reduce(function(e,t){return Object.assign(e,a({},ai[t].name,Number(t)))},{})),ci=function(e){var t=e.code,n=e.reason,r=e.appCode,i=e.detail,o=e.error,s=n||i||o,a=n;!s&&ai[t]&&(a=ai[t].name,s=ai[t].message||a),s||(s="Unknow Error: ".concat(t));var u=new Error(s);return Object.assign(u,{code:t,appCode:r,detail:i,name:a})},li=Kt("LC:Connection"),fi=Symbol("expire"),hi=function(e){function t(t,n){var r,i=n.format,o=n.version;li("initializing Connection");var s="lc.".concat(i,".").concat(o);return r=ni?e.call(this,t().then(function(e){return e.map(function(e){return"".concat(e).concat(-1===e.indexOf("?")?"?":"&","subprotocol=").concat(encodeURIComponent(s))})}))||this:e.call(this,t,s)||this,r._protocalFormat=i,r._commands={},r._serialId=0,h(r)}c(t,e);var n=t.prototype;return n.send=function(){function t(e){return n.apply(this,arguments)}var n=i(Bt.mark(function t(n){var r,i,o,s=this,a=arguments;return Bt.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(r=!(a.length>1&&void 0!==a[1])||a[1],r&&(this._serialId+=1,i=this._serialId,n.i=i),li.enabled&&li("↑ %O sent",ei(n)),"proto2base64"===this._protocalFormat?o=n.toBase64():n.toArrayBuffer&&(o=n.toArrayBuffer()),o){t.next=6;break}throw new TypeError("".concat(n," is not a GenericCommand"));case 6:if(e.prototype.send.call(this,o),r){t.next=9;break}return t.abrupt("return",void 0);case 9:return t.abrupt("return",new Promise(function(e,t){s._commands[i]={resolve:e,reject:t,timeout:setTimeout(function(){s._commands[i]&&(li.enabled&&li("✗ %O timeout",ei(n)),t(ci({error:"Command Timeout [cmd:".concat(n.cmd," op:").concat(n.op,"]"),name:"COMMAND_TIMEOUT"})),delete s._commands[i])},2e4)}}));case 10:case"end":return t.stop()}},t,this)}));return t}(),n.handleMessage=function(e){var t;try{t=At.decode(e),li.enabled&&li("↓ %O received",ei(t))}catch(t){return void console.warn("Decode message failed:",t.message,e)}var n=t.i;if(n)this._commands[n]?(clearTimeout(this._commands[n].timeout),t.cmd===Rt.error?this._commands[n].reject(ci(t.errorMessage)):this._commands[n].resolve(t),delete this._commands[n]):console.warn("Unexpected command received with serialId [".concat(n,"],\n which have timed out or never been requested."));else switch(t.cmd){case Rt.error:return void this.emit("error",ci(t.errorMessage));case Rt.goaway:return void this.emit(fi);default:this.emit("message",t)}},n.ping=function(){return this.send(new At({cmd:Rt.echo})).catch(function(e){return li("ping failed:",e)})},t}(si),di=function(e,t){e&&e.forEach(function(e){try{e(t)}catch(t){throw e._pluginName&&(t.message+="[".concat(e._pluginName,"]")),t}})},pi=function(e,t){return ti(e).reduce(function(e,n){return e.then(function(e){return!1!==e&&n.apply(void 0,p(t))}).catch(function(e){throw n._pluginName&&(e.message+="[".concat(n._pluginName,"]")),e})},Promise.resolve(!0))},yi="5.0.0-alpha.3",mi=Kt("LC:Realtime"),vi=Kt("LC:request"),gi=new Gr("push-router"),_i=function(e){function t(n){var r,i=n.plugins,o=f(n,["plugins"]);if(mi("initializing Realtime %s %O",yi,o),r=e.call(this)||this,"string"!=typeof o.appId)throw new TypeError("appId [".concat(o.appId,"] is not a string"));if("string"!=typeof o.appKey)throw new TypeError("appKey [".concat(o.appKey,"] is not a string"));r._options=Object.assign({appId:void 0,appKey:void 0,pushOfflineMessages:!1,noBinary:!1,ssl:!0,RTMServerName:de.env.RTM_SERVER_NAME},o),r._cache=new Gr("endpoints");var s=$r(h(r));s.clients=new Set,s.pendingClients=new Set;var a=[].concat(p(ti(t.__preRegisteredPlugins)),p(ti(i)));return mi("Using plugins %o",a.map(function(e){return e.name})),r._plugins=a.reduce(function(e,t){for(var n in t)({}).hasOwnProperty.call(t,n)&&"name"!==n&&(t.name&&ti(t[n]).forEach(function(e){e._pluginName=t.name}),e[n]=ti(e[n]).concat(t[n]));return e},{}),di(r._plugins.onRealtimeCreate,h(r)),r}c(t,e);var n=t.prototype;return n._request=function(){function e(e){return t.apply(this,arguments)}var t=i(Bt.mark(function e(t){var n,r,i,o,s,a,c,l,f,h,d,p,y,m;return Bt.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.method,r=t.version,i=void 0===r?"1.1":r,o=t.path,s=t.query,a=t.headers,c=t.data,l=void 0===c?{}:c,f=this._options,h=f.appId,d=f.server,e.next=4,this.constructor._getServerUrls({appId:h,server:d});case 4:return p=e.sent,y=p.api,m="".concat(y,"/").concat(i).concat(o),vi("Req: %O %O %O",n,m,{query:s,headers:a,data:l}),e.abrupt("return",cn(n,m).set(u({"X-LC-Id":this._options.appId,"X-LC-Key":this._options.appKey},a)).query(s).send(l).then(function(e){return vi("Res: %O %O %O",m,e.status,e.body),e.body},function(e){if(vi("Error: %O %O %O",m,e.response.status,e.response.body),e.response&&e.response.body&&e.response.body.code)throw ci(e.response.body);throw e}));case 9:case"end":return e.stop()}},e,this)}));return e}(),n._open=function(){var e=this;if(this._openPromise)return this._openPromise;var t="protobuf2";this._options.noBinary&&(t="proto2base64");var n=3;this._options.pushOfflineMessages&&(n=1);var r={format:t,version:n};return this._openPromise=new Promise(function(t,n){mi("No connection established, create a new one.");var o=new hi(function(){return e._getRTMServers(e._options)},r);o.on("open",function(){return t(o)}).on("error",n).on(fi,i(Bt.mark(function t(){return Bt.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return mi("Connection expired. Refresh endpoints."),e._cache.set("endpoints",null,0),t.next=4,e._getRTMServers(e._options);case 4:o.urls=t.sent,o.disconnect();case 6:case"end":return t.stop()}},t,this)}))).on("message",e._dispatchCommand.bind(e)),["disconnect","reconnect","retry","schedule","offline","online"].forEach(function(t){return o.on(t,function(){for(var n=arguments.length,r=new Array(n),i=0;i1?n-1:0),i=1;i