forked from bestony/neshouse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathav-live-query-min.js
38 lines (36 loc) · 360 KB
/
av-live-query-min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
!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=122)}([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,v=Object.keys,m=Object.create,y=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<n;i++)r[i]=arguments[i+t];switch(t){case 0:return e.call(this,r);case 1:return e.call(this,arguments[0],r);case 2:return e.call(this,arguments[0],arguments[1],r)}var o=Array(t+1);for(i=0;i<t;i++)o[i]=arguments[i];return o[t]=r,e.apply(this,o)}},T=function(e){if(!g.isObject(e))return{};if(m)return m(e);y.prototype=e;var t=new y;return y.prototype=null,t},S=function(e){return function(t){return null==t?void 0:t[e]}},O=function(e,t){return null!=e&&d.call(e,t)},A=function(e,t){for(var n=t.length,r=0;r<n;r++){if(null==e)return;e=e[t[r]]}return n?e:void 0},I=Math.pow(2,53)-1,x=S("length"),C=function(e){var t=x(e);return"number"==typeof t&&t>=0&&t<=I};g.each=g.forEach=function(e,t,n){t=b(t,n);var r,i;if(C(e))for(r=0,i=e.length;r<i;r++)t(e[r],r,e);else{var o=g.keys(e);for(r=0,i=o.length;r<i;r++)t(e[o[r]],o[r],e)}return e},g.map=g.collect=function(e,t,n){t=w(t,n);for(var r=!C(e)&&g.keys(e),i=(r||e).length,o=Array(i),s=0;s<i;s++){var a=r?r[s]:s;o[s]=t(e[a],a,e)}return o};var N=function(e){var t=function(t,n,r,i){var o=!C(t)&&g.keys(t),s=(o||t).length,a=e>0?0:s-1;for(i||(r=t[o?o[a]:a],a+=e);a>=0&&a<s;a+=e){var u=o?o[a]:a;r=n(r,t[u],u,t)}return r};return function(e,n,r,i){var o=arguments.length>=3;return t(e,b(n,i,4),r,o)}};g.reduce=g.foldl=g.inject=N(1),g.reduceRight=g.foldr=N(-1),g.find=g.detect=function(e,t,n){var r=C(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=!C(e)&&g.keys(e),i=(r||e).length,o=0;o<i;o++){var s=r?r[o]:o;if(!t(e[s],s,e))return!1}return!0},g.some=g.any=function(e,t,n){t=w(t,n);for(var r=!C(e)&&g.keys(e),i=(r||e).length,o=0;o<i;o++){var s=r?r[o]:o;if(t(e[s],s,e))return!0}return!1},g.contains=g.includes=g.include=function(e,t,n,r){return C(e)||(e=g.values(e)),("number"!=typeof n||r)&&(n=0),g.indexOf(e,t,n)>=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=C(e)?e:g.values(e);for(var a=0,u=e.length;a<u;a++)null!=(r=e[a])&&r>o&&(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=C(e)?e:g.values(e);for(var a=0,u=e.length;a<u;a++)null!=(r=e[a])&&r<o&&(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.shuffle=function(e){return g.sample(e,1/0)},g.sample=function(e,t,n){if(null==t||n)return C(e)||(e=g.values(e)),e[g.random(e.length-1)];var r=C(e)?g.clone(e):g.values(e),i=x(r);t=Math.max(Math.min(t,i),0);for(var o=i-1,s=0;s<t;s++){var a=g.random(s,o),u=r[s];r[s]=r[a],r[a]=u}return r.slice(0,t)},g.sortBy=function(e,t,n){var r=0;return t=w(t,n),g.pluck(g.map(e,function(e,n,i){return{value:e,index:r++,criteria:t(e,n,i)}}).sort(function(e,t){var n=e.criteria,r=t.criteria;if(n!==r){if(n>r||void 0===n)return 1;if(n<r||void 0===r)return-1}return e.index-t.index}),"value")};var P=function(e,t){return function(n,r,i){var o=t?[[],[]]:{};return r=w(r,i),g.each(n,function(t,i){var s=r(t,i,n);e(o,t,s)}),o}};g.groupBy=P(function(e,t,n){O(e,n)?e[n].push(t):e[n]=[t]}),g.indexBy=P(function(e,t,n){e[n]=t}),g.countBy=P(function(e,t,n){O(e,n)?e[n]++:e[n]=1});var R=/[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;g.toArray=function(e){return e?g.isArray(e)?f.call(e):g.isString(e)?e.match(R):C(e)?g.map(e,g.identity):g.values(e):[]},g.size=function(e){return null==e?0:C(e)?e.length:g.keys(e).length},g.partition=P(function(e,t,n){e[n?0:1].push(t)},!0),g.first=g.head=g.take=function(e,t,n){return null==e||e.length<1?null==t?void 0:[]:null==t||n?e[0]:g.initial(e,e.length-t)},g.initial=function(e,t,n){return f.call(e,0,Math.max(0,e.length-(null==t||n?1:t)))},g.last=function(e,t,n){return null==e||e.length<1?null==t?void 0:[]:null==t||n?e[e.length-1]:g.rest(e,Math.max(0,e.length-t))},g.rest=g.tail=g.drop=function(e,t,n){return f.call(e,null==t||n?1:t)},g.compact=function(e){return g.filter(e,Boolean)};var j=function(e,t,n,r){r=r||[];for(var i=r.length,o=0,s=x(e);o<s;o++){var a=e[o];if(C(a)&&(g.isArray(a)||g.isArguments(a)))if(t)for(var u=0,c=a.length;u<c;)r[i++]=a[u++];else j(a,t,n,r),i=r.length;else n||(r[i++]=a)}return r};g.flatten=function(e,t){return j(e,t,!1)},g.without=E(function(e,t){return g.difference(e,t)}),g.uniq=g.unique=function(e,t,n,r){g.isBoolean(t)||(r=n,n=t,t=!1),null!=n&&(n=w(n,r));for(var i=[],o=[],s=0,a=x(e);s<a;s++){var u=e[s],c=n?n(u,s,e):u;t&&!n?(s&&o===c||i.push(u),o=c):n?g.contains(o,c)||(o.push(c),i.push(u)):g.contains(i,u)||i.push(u)}return i},g.union=E(function(e){return g.uniq(j(e,!0,!0))}),g.intersection=function(e){for(var t=[],n=arguments.length,r=0,i=x(e);r<i;r++){var o=e[r];if(!g.contains(t,o)){var s;for(s=1;s<n&&g.contains(arguments[s],o);s++);s===n&&t.push(o)}}return t},g.difference=E(function(e,t){return t=j(t,!0,!0),g.filter(e,function(e){return!g.contains(t,e)})}),g.unzip=function(e){for(var t=e&&g.max(e,x).length||0,n=Array(t),r=0;r<t;r++)n[r]=g.pluck(e,r);return n},g.zip=E(g.unzip),g.object=function(e,t){for(var n={},r=0,i=x(e);r<i;r++)t?n[e[r]]=t[r]:n[e[r][0]]=e[r][1];return n};var k=function(e){return function(t,n,r){n=w(n,r);for(var i=x(t),o=e>0?0:i-1;o>=0&&o<i;o+=e)if(n(t[o],o,t))return o;return-1}};g.findIndex=k(1),g.findLastIndex=k(-1),g.sortedIndex=function(e,t,n,r){n=w(n,r,1);for(var i=n(t),o=0,s=x(e);o<s;){var a=Math.floor((o+s)/2);n(e[a])<i?o=a+1:s=a}return o};var L=function(e,t,n){return function(r,i,o){var s=0,a=x(r);if("number"==typeof o)e>0?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&&o<a;o+=e)if(r[o]===i)return o;return-1}};g.indexOf=L(1,g.findIndex,g.sortedIndex),g.lastIndexOf=L(-1,g.findLastIndex),g.range=function(e,t,n){null==t&&(t=e||0,e=0),n||(n=t<e?-1:1);for(var r=Math.max(Math.ceil((t-e)/n),0),i=Array(r),o=0;o<r;o++,e+=n)i[o]=e;return i},g.chunk=function(e,t){if(null==t||t<1)return[];for(var n=[],r=0,i=e.length;r<i;)n.push(f.call(e,r,r+=t));return n};var U=function(e,t,n,r,i){if(!(r instanceof t))return e.apply(n,i);var o=T(e.prototype),s=e.apply(o,i);return g.isObject(s)?s:o};g.bind=E(function(e,t,n){if(!g.isFunction(e))throw new TypeError("Bind must be called on a function");var r=E(function(i){return U(e,r,t,this,n.concat(i))});return r}),g.partial=E(function(e,t){var n=g.partial.placeholder,r=function(){for(var i=0,o=t.length,s=Array(o),a=0;a<o;a++)s[a]=t[a]===n?arguments[i++]:t[a];for(;i<arguments.length;)s.push(arguments[i++]);return U(e,r,this,this,s)};return r}),g.partial.placeholder=g,g.bindAll=E(function(e,t){t=j(t,!1,!1);var n=t.length;if(n<1)throw new Error("bindAll must be passed function names");for(;n--;){var r=t[n];e[r]=g.bind(e[r],e)}}),g.memoize=function(e,t){var n=function(r){var i=n.cache,o=""+(t?t.apply(this,arguments):r);return O(i,o)||(i[o]=e.apply(this,arguments)),i[o]};return n.cache={},n},g.delay=E(function(e,t,n){return setTimeout(function(){return e.apply(null,n)},t)}),g.defer=g.partial(g.delay,g,1),g.throttle=function(e,t,n){var r,i,o,s,a=0;n||(n={});var u=function(){a=!1===n.leading?0:g.now(),r=null,s=e.apply(i,o),r||(i=o=null)},c=function(){var c=g.now();a||!1!==n.leading||(a=c);var l=t-(c-a);return i=this,o=arguments,l<=0||l>t?(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 M=!{toString:null}.propertyIsEnumerable("toString"),D=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],F=function(e,t){var n=D.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=D[n])in e&&e[o]!==i[o]&&!g.contains(t,o)&&t.push(o)};g.keys=function(e){if(!g.isObject(e))return[];if(v)return v(e);var t=[];for(var n in e)O(e,n)&&t.push(n);return M&&F(e,t),t},g.allKeys=function(e){if(!g.isObject(e))return[];var t=[];for(var n in e)t.push(n);return M&&F(e,t),t},g.values=function(e){for(var t=g.keys(e),n=t.length,r=Array(n),i=0;i<n;i++)r[i]=e[t[i]];return r},g.mapObject=function(e,t,n){t=w(t,n);for(var r=g.keys(e),i=r.length,o={},s=0;s<i;s++){var a=r[s];o[a]=t(e[a],a,e)}return o},g.pairs=function(e){for(var t=g.keys(e),n=t.length,r=Array(n),i=0;i<n;i++)r[i]=[t[i],e[t[i]]];return r},g.invert=function(e){for(var t={},n=g.keys(e),r=0,i=n.length;r<i;r++)t[e[n[r]]]=n[r];return t},g.functions=g.methods=function(e){var t=[];for(var n in e)g.isFunction(e[n])&&t.push(n);return t.sort()};var q=function(e,t){return function(n){var r=arguments.length;if(t&&(n=Object(n)),r<2||null==n)return n;for(var i=1;i<r;i++)for(var o=arguments[i],s=e(o),a=s.length,u=0;u<a;u++){var c=s[u];t&&void 0!==n[c]||(n[c]=o[c])}return n}};g.extend=q(g.allKeys),g.extendOwn=g.assign=q(g.keys),g.findKey=function(e,t,n){t=w(t,n);for(var r,i=g.keys(e),o=0,s=i.length;o<s;o++)if(r=i[o],t(e[r],r,e))return r};var B=function(e,t,n){return t in n};g.pick=E(function(e,t){var n={},r=t[0];if(null==e)return n;g.isFunction(r)?(t.length>1&&(r=b(r,t[1])),t=g.allKeys(e)):(r=B,t=j(t,!1,!1),e=Object(e));for(var i=0,o=t.length;i<o;i++){var s=t[i],a=e[s];r(a,s,e)&&(n[s]=a)}return n}),g.omit=E(function(e,t){var n,r=t[0];return g.isFunction(r)?(r=g.negate(r),t.length>1&&(n=t[1])):(t=g.map(j(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<r;o++){var s=n[o];if(t[s]!==i[s]||!(s in i))return!1}return!0};var V,W;V=function(e,t,n,r){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return!1;if(e!==e)return t!==t;var i=typeof e;return("function"===i||"object"===i||"object"==typeof t)&&W(e,t,n,r)},W=function(e,t,n,r){e instanceof g&&(e=e._wrapped),t instanceof g&&(t=t._wrapped);var i=h.call(e);if(i!==h.call(t))return!1;switch(i){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:0==+e?1/+e==1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return c.valueOf.call(e)===c.valueOf.call(t)}var o="[object Array]"===i;if(!o){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,a=t.constructor;if(s!==a&&!(g.isFunction(s)&&s instanceof s&&g.isFunction(a)&&a instanceof a)&&"constructor"in e&&"constructor"in t)return!1}n=n||[],r=r||[];for(var u=n.length;u--;)if(n[u]===e)return r[u]===t;if(n.push(e),r.push(t),o){if((u=e.length)!==t.length)return!1;for(;u--;)if(!V(e[u],t[u],n,r))return!1}else{var l,f=g.keys(e);if(u=f.length,g.keys(t).length!==u)return!1;for(;u--;)if(l=f[u],!O(t,l)||!V(e[l],t[l],n,r))return!1}return n.pop(),r.pop(),!0},g.isEqual=function(e,t){return V(e,t)},g.isEmpty=function(e){return null==e||(C(e)&&(g.isArray(e)||g.isString(e)||g.isArguments(e))?0===e.length:0===g.keys(e).length)},g.isElement=function(e){return!(!e||1!==e.nodeType)},g.isArray=p||function(e){return"[object Array]"===h.call(e)},g.isObject=function(e){var t=typeof e;return"function"===t||"object"===t&&!!e},g.each(["Arguments","Function","String","Number","Date","RegExp","Error","Symbol","Map","WeakMap","Set","WeakSet"],function(e){g["is"+e]=function(t){return h.call(t)==="[object "+e+"]"}}),g.isArguments(arguments)||(g.isArguments=function(e){return O(e,"callee")});var Y=o.document&&o.document.childNodes;"function"!=typeof/./&&"object"!=typeof Int8Array&&"function"!=typeof Y&&(g.isFunction=function(e){return"function"==typeof e||!1}),g.isFinite=function(e){return!g.isSymbol(e)&&isFinite(e)&&!isNaN(parseFloat(e))},g.isNaN=function(e){return g.isNumber(e)&&isNaN(e)},g.isBoolean=function(e){return!0===e||!1===e||"[object Boolean]"===h.call(e)},g.isNull=function(e){return null===e},g.isUndefined=function(e){return void 0===e},g.has=function(e,t){if(!g.isArray(t))return O(e,t);for(var n=t.length,r=0;r<n;r++){var i=t[r];if(null==e||!d.call(e,i))return!1;e=e[i]}return!!n},g.noConflict=function(){return o._=s,this},g.identity=function(e){return e},g.constant=function(e){return function(){return e}},g.noop=function(){},g.property=function(e){return g.isArray(e)?function(t){return A(t,e)}:S(e)},g.propertyOf=function(e){return null==e?function(){}:function(t){return g.isArray(t)?A(e,t):e[t]}},g.matcher=g.matches=function(e){return e=g.extendOwn({},e),function(t){return g.isMatch(t,e)}},g.times=function(e,t,n){var r=Array(Math.max(0,e));t=b(t,n,1);for(var i=0;i<e;i++)r[i]=t(i);return r},g.random=function(e,t){return null==t&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))},g.now=Date.now||function(){return(new Date).getTime()};var z={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Q=g.invert(z),G=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=G(z),g.unescape=G(Q),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<r;i++){var o=null==e?void 0:e[t[i]];void 0===o&&(o=n,i=r),e=g.isFunction(o)?o.call(e):o}return e};var J=0;g.uniqueId=function(e){var t=++J+"";return e?e+t:t},g.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var K=/(.)^/,H={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},$=/\\|'|\r|\n|\u2028|\u2029/g,X=function(e){return"\\"+H[e]};g.template=function(e,t,n){!t&&n&&(t=n),t=g.defaults({},t,g.templateSettings);var r=RegExp([(t.escape||K).source,(t.interpolate||K).source,(t.evaluate||K).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(44),n(64)(e))},function(e,t){var n=e.exports={version:"2.6.9"};"number"==typeof __e&&(__e=n)},function(e,t,n){e.exports={default:n(126),__esModule:!0}},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){var r=n(3),i=n(1),o=n(13),s=n(14),a=n(15),u=function(e,t,n){var c,l,f,h=e&u.F,d=e&u.G,p=e&u.S,v=e&u.P,m=e&u.B,y=e&u.W,g=d?i:i[t]||(i[t]={}),_=g.prototype,b=d?r:p?r[t]:(r[t]||{}).prototype;d&&(n=t);for(c in n)(l=!h&&b&&void 0!==b[c])&&a(g,c)||(f=l?b[c]:n[c],g[c]=d&&"function"!=typeof b[c]?n[c]:m&&l?o(f,r):y&&b[c]==f?function(e){var t=function(t,n,r){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,r)}return e.apply(this,arguments)};return t.prototype=e.prototype,t}(f):v&&"function"==typeof f?o(Function.call,f):f,v&&((g.virtual||(g.virtual={}))[c]=f,e&u.R&&_&&!_[c]&&s(_,c,f)))};u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,e.exports=u},function(e,t,n){var r=n(60)("wks"),i=n(40),o=n(3).Symbol,s="function"==typeof o;(e.exports=function(e){return r[e]||(r[e]=s&&o[e]||(s?o:i)("Symbol."+e))}).store=r},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){"use strict";var r=n(2),i=function(e){return e&&e.__esModule?e:{default:e}}(r),o=n(0),s=n(168),a=n(0),u=a.extend,c=n(26),l=n(9),f=l.getSessionToken,h=n(67),d=function(e,t){var n=(new Date).getTime(),r=s(n+e);return t?r+","+n+",master":r+","+n},p=function(e,t){t?e["X-LC-Sign"]=d(c.applicationKey):e["X-LC-Key"]=c.applicationKey},v=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1],n={"X-LC-Id":c.applicationId,"Content-Type":"application/json;charset=UTF-8"},r=!1;return"boolean"==typeof e.useMasterKey?r=e.useMasterKey:"boolean"==typeof c._config.useMasterKey&&(r=c._config.useMasterKey),r?c.masterKey?t?n["X-LC-Sign"]=d(c.masterKey,!0):n["X-LC-Key"]=c.masterKey+",master":(console.warn("masterKey is not set, fall back to use appKey"),p(n,t)):p(n,t),c.hookKey&&(n["X-LC-Hook-Key"]=c.hookKey),null!==c._config.production&&(n["X-LC-Prod"]=String(c._config.production)),n["X-LC-UA"]=c._sharedConfig.userAgent,i.default.resolve().then(function(){var t=f(e);if(t)n["X-LC-Session"]=t;else if(!c._config.disableCurrentUser)return c.User.currentAsync().then(function(e){return e&&e._sessionToken&&(n["X-LC-Session"]=e._sessionToken),n});return n})},m=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=c._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},y=function(e){var t=e.service,n=e.version,r=e.method,i=e.path,s=e.query,a=e.data,u=e.authOptions,l=e.signKey,f=void 0===l||l;if(!c.applicationId||!c.applicationKey&&!c.masterKey)throw new Error("Not initialized");c._appRouter&&c._appRouter.refresh();var d=c._config.requestTimeout,p=m({service:t,path:i,version:n});return v(u,f).then(function(e){return h({method:r,url:p,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,c._sharedConfig.keepErrorRawMessage||(t.error+=" ["+(e.statusCode||"N/A")+" "+r+" "+p+"]");var n=new Error(t.error);throw delete t.error,o.extend(n,t)})})},g=function(e,t,n,r,i,o,s){var a="";if(e&&(a+="/"+e),t&&(a+="/"+t),n&&(a+="/"+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()&&(s=u({},s,i),i=null),y({method:r,path:a,query:s,data:i,authOptions:o})};c.request=y,e.exports={_request:g,request:y}},function(e,t,n){e.exports=!n(17)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(2),o=r(i),s=n(146),a=r(s),u=n(0),c=function(e){return u.isNull(e)||u.isUndefined(e)},l=function(e){return u.isArray(e)?e:void 0===e||null===e?[]:[e]},f=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=l(t).join(",")),n&&(i.include=l(n).join(",")),r&&(i.returnACL=r),i},h=function(e){return e.sessionToken?e.sessionToken:e.user&&"function"==typeof e.user.getSessionToken?e.user.getSessionToken():void 0},d=function(e){return function(t){return e(t),t}},p=function(){},v=function(e,t,n){var r;return r=t&&t.hasOwnProperty("constructor")?t.constructor:function(){e.apply(this,arguments)},u.extend(r,e),p.prototype=e.prototype,r.prototype=new p,t&&u.extend(r.prototype,t),n&&u.extend(r,n),r.prototype.constructor=r,r.__super__=e.prototype,r},m=function(e){return new Date(e)},y=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},g=function(e,t){for(var n=t.split("."),r=n[0],i=n.pop(),o=e,s=0;s<n.length;s++)if(void 0===(o=o[n[s]]))return[void 0,void 0,i];return[o[i],o,i,r]},_=function(e){return u.isObject(e)&&(0,a.default)(e)===Object.prototype},b=function e(t,n){return t()?n().then(function(){return e(t,n)}):o.default.resolve()};e.exports={isNullOrUndefined:c,ensureArray:l,transformFetchOptions:f,getSessionToken:h,tap:d,inherits:v,parseDate:m,setValue:y,findValue:g,isPlainObject:_,continueWhile:b}},function(e,t,n){var r=n(11),i=n(75),o=n(56),s=Object.defineProperty;t.f=n(8)?Object.defineProperty:function(e,t,n){if(r(e),t=o(t,!0),r(n),i)try{return s(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){var r=n(6);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){e.exports={default:n(139),__esModule:!0}},function(e,t,n){var r=n(31);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){var r=n(10),i=n(32);e.exports=n(8)?function(e,t,n){return r.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(58),i=n(53);e.exports=function(e){return r(i(e))}},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){var r=n(53);e.exports=function(e){return Object(r(e))}},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(144)(t),e.exports.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},function(e,t,n){"use strict";function r(e,t){var n=new Error(t);return n.code=e,n}n(0).extend(r,{OTHER_CAUSE:-1,INTERNAL_SERVER_ERROR:1,CONNECTION_FAILED:100,OBJECT_NOT_FOUND:101,INVALID_QUERY:102,INVALID_CLASS_NAME:103,MISSING_OBJECT_ID:104,INVALID_KEY_NAME:105,INVALID_POINTER:106,INVALID_JSON:107,COMMAND_UNAVAILABLE:108,NOT_INITIALIZED:109,INCORRECT_TYPE:111,INVALID_CHANNEL_NAME:112,PUSH_MISCONFIGURED:115,OBJECT_TOO_LARGE:116,OPERATION_FORBIDDEN:119,CACHE_MISS:120,INVALID_NESTED_KEY:121,INVALID_FILE_NAME:122,INVALID_ACL:123,TIMEOUT:124,INVALID_EMAIL_ADDRESS:125,MISSING_CONTENT_TYPE:126,MISSING_CONTENT_LENGTH:127,INVALID_CONTENT_LENGTH:128,FILE_TOO_LARGE:129,FILE_SAVE_ERROR:130,FILE_DELETE_ERROR:153,DUPLICATE_VALUE:137,INVALID_ROLE_NAME:139,EXCEEDED_QUOTA:140,SCRIPT_FAILED:141,VALIDATION_ERROR:142,INVALID_IMAGE_DATA:150,UNSAVED_FILE_ERROR:151,INVALID_PUSH_TIME_ERROR:152,USERNAME_MISSING:200,PASSWORD_MISSING:201,USERNAME_TAKEN:202,EMAIL_TAKEN:203,EMAIL_MISSING:204,EMAIL_NOT_FOUND:205,SESSION_MISSING:206,MUST_CREATE_USER_THROUGH_SIGNUP:207,ACCOUNT_ALREADY_LINKED:208,LINKED_ID_MISSING:250,INVALID_LINKED_SESSION:251,UNSUPPORTED_SERVICE:252,X_DOMAIN_REQUEST:602}),e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var i=n(46),o=r(i),s=n(28),a=r(s),u="function"==typeof a.default&&"symbol"==typeof o.default?function(e){return typeof e}:function(e){return e&&"function"==typeof a.default&&e.constructor===a.default&&e!==a.default.prototype?"symbol":typeof e};t.default="function"==typeof a.default&&"symbol"===u(o.default)?function(e){return void 0===e?"undefined":u(e)}:function(e){return e&&"function"==typeof a.default&&e.constructor===a.default&&e!==a.default.prototype?"symbol":void 0===e?"undefined":u(e)}},function(e,t,n){"use strict";var r=n(127)(!0);n(54)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t){e.exports={}},function(e,t,n){n(131);for(var r=n(3),i=n(14),o=n(23),s=n(5)("toStringTag"),a="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),u=0;u<a.length;u++){var c=a[u],l=r[c],f=l&&l.prototype;f&&!f[s]&&i(f,s,c),o[c]=o.Array}},function(e,t,n){var r=n(13),i=n(81),o=n(82),s=n(11),a=n(39),u=n(62),c={},l={},t=e.exports=function(e,t,n,f,h){var d,p,v,m,y=h?function(){return e}:u(e),g=r(n,f,t?2:1),_=0;if("function"!=typeof y)throw TypeError(e+" is not iterable!");if(o(y)){for(d=a(e.length);d>_;_++)if((m=t?g(s(p=e[_])[0],p[1]):g(e[_]))===c||m===l)return m}else for(v=y.call(e);!(p=v.next()).done;)if((m=i(v,g,p.value,t))===c||m===l)return m};t.BREAK=c,t.RETURN=l},function(e,t,n){"use strict";(function(t){function r(e){return e&&e.__esModule?e:{default:e}}var i=n(12),o=r(i),s=n(65),a=r(s),u=n(2),c=r(u),l=n(0),f=n(89),h=n(19),d=n(9),p=d.inherits,v=d.parseDate,m=n(90),y=n(27),g=y.setAdapters,_=y.adapterManager,b=t.AV||{};b._config={serverURLs:{},useMasterKey:!1,production:null,realtime:null,requestTimeout:null};var w="LeanCloud-JS-SDK/"+m;b._sharedConfig={userAgent:w,liveQueryRealtime:null},_.on("platformInfo",function(e){var t=w;if(e)if(e.userAgent)t=e.userAgent;else{var n=e.name;e.version&&(n+="/"+e.version),e.extra&&(n+="; "+e.extra),t+=" ("+n+")"}b._sharedConfig.userAgent=t}),b._getAVPath=function(e){if(!b.applicationId)throw new Error("You need to call AV.initialize before using AV.");if(e||(e=""),!l.isString(e))throw new Error("Tried to get a localStorage path that wasn't a String.");return"/"===e[0]&&(e=e.substring(1)),"AV/"+b.applicationId+"/"+e},b._installationId=null,b._getInstallationId=function(){if(b._installationId)return c.default.resolve(b._installationId);var e=b._getAVPath("installationId");return b.localStorage.getItemAsync(e).then(function(t){return b._installationId=t,b._installationId?t:(b._installationId=t=f(),b.localStorage.setItemAsync(e,t).then(function(){return t}))})},b._subscriptionId=null,b._refreshSubscriptionId=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:b._getAVPath("subscriptionId"),t=b._subscriptionId=f();return b.localStorage.setItemAsync(e,t).then(function(){return t})},b._getSubscriptionId=function(){if(b._subscriptionId)return c.default.resolve(b._subscriptionId);var e=b._getAVPath("subscriptionId");return b.localStorage.getItemAsync(e).then(function(t){return b._subscriptionId=t,b._subscriptionId||(t=b._refreshSubscriptionId(e)),t})},b._parseDate=v,b._extend=function(e,t){var n=p(this,e,t);return n.extend=this.extend,n},b._encode=function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(e instanceof b.Object){if(n)throw new Error("AV.Objects not allowed here");return t&&!l.include(t,e)&&e._hasData?e._toFullJSON(t.concat(e),r):e._toPointer()}if(e instanceof b.ACL)return e.toJSON();if(l.isDate(e))return r?{__type:"Date",iso:e.toJSON()}:e.toJSON();if(e instanceof b.GeoPoint)return e.toJSON();if(l.isArray(e))return l.map(e,function(e){return b._encode(e,t,n,r)});if(l.isRegExp(e))return e.source;if(e instanceof b.Relation)return e.toJSON();if(e instanceof b.Op)return e.toJSON();if(e instanceof b.File){if(!e.url()&&!e.id)throw new Error("Tried to save an object containing an unsaved file.");return e._toFullJSON(t,r)}return l.isObject(e)?l.mapObject(e,function(e,i){return b._encode(e,t,n,r)}):e},b._decode=function(e,t){if(!l.isObject(e)||l.isDate(e))return e;if(l.isArray(e))return l.map(e,function(e){return b._decode(e)});if(e instanceof b.Object)return e;if(e instanceof b.File)return e;if(e instanceof b.Op)return e;if(e instanceof b.GeoPoint)return e;if(e instanceof b.ACL)return e;if("ACL"===t)return new b.ACL(e);if(e.__op)return b.Op._decode(e);var n;if("Pointer"===e.__type){n=e.className;var r=b.Object._create(n);if((0,a.default)(e).length>3){var i=l.clone(e);delete i.__type,delete i.className,r._finishFetch(i,!0)}else r._finishFetch({objectId:e.objectId},!1);return r}if("Object"===e.__type){n=e.className;var o=l.clone(e);delete o.__type,delete o.className;var s=b.Object._create(n);return s._finishFetch(o,!0),s}if("Date"===e.__type)return b._parseDate(e.iso);if("GeoPoint"===e.__type)return new b.GeoPoint({latitude:e.latitude,longitude:e.longitude});if("Relation"===e.__type){if(!t)throw new Error("key missing decoding a Relation");var u=new b.Relation(null,t);return u.targetClassName=e.className,u}if("File"===e.__type){var c=new b.File(e.name),f=l.clone(e);return delete f.__type,c._finishFetch(f),c}return l.mapObject(e,b._decode)},b.parseJSON=b._decode,b.parse=function(e){return b.parseJSON(JSON.parse(e))},b.stringify=function(e){return(0,o.default)(b._encode(e,[],!1,!0))},b._encodeObjectOrArray=function(e){var t=function(e){return e&&e._toFullJSON&&(e=e._toFullJSON([])),l.mapObject(e,function(e){return b._encode(e,[])})};return l.isArray(e)?e.map(function(e){return t(e)}):t(e)},b._arrayEach=l.each,b._traverse=function(e,t,n){if(e instanceof b.Object){if(n=n||[],l.indexOf(n,e)>=0)return;return n.push(e),b._traverse(e.attributes,t,n),t(e)}return e instanceof b.Relation||e instanceof b.File?t(e):l.isArray(e)?(l.each(e,function(r,i){var o=b._traverse(r,t,n);o&&(e[i]=o)}),t(e)):l.isObject(e)?(b._each(e,function(r,i){var o=b._traverse(r,t,n);o&&(e[i]=o)}),t(e)):t(e)},b._objectEach=b._each=function(e,t){l.isObject(e)?l.each(l.keys(e),function(n){t(e[n],n)}):l.each(e,t)},b.debug={enable:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"leancloud*";return h.enable(e)},disable:h.disable},b.setAdapters=g,e.exports=b}).call(t,n(44))},function(e,t,n){"use strict";var r=n(0),i=n(91),o=n(9),s=o.inherits,a=s(i,{constructor:function(){i.apply(this),this._adapters={}},getAdapter:function(e){var t=this._adapters[e];if(void 0===t)throw new Error(e+" adapter is not configured");return t},setAdapters:function(e){var t=this;r.extend(this._adapters,e),r.keys(e).forEach(function(n){return t.emit(n,e[n])})}}),u=new a;e.exports={getAdapter:u.getAdapter.bind(u),setAdapters:u.setAdapters.bind(u),adapterManager:u}},function(e,t,n){e.exports={default:n(154),__esModule:!0}},function(e,t,n){var r=n(40)("meta"),i=n(6),o=n(15),s=n(10).f,a=0,u=Object.isExtensible||function(){return!0},c=!n(17)(function(){return u(Object.preventExtensions({}))}),l=function(e){s(e,r,{value:{i:"O"+ ++a,w:{}}})},f=function(e,t){if(!i(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!o(e,r)){if(!u(e))return"F";if(!t)return"E";l(e)}return e[r].i},h=function(e,t){if(!o(e,r)){if(!u(e))return!0;if(!t)return!1;l(e)}return e[r].w},d=function(e){return c&&p.NEED&&u(e)&&!o(e,r)&&l(e),e},p=e.exports={KEY:r,NEED:!1,fastKey:f,getWeak:h,onFreeze:d}},function(e,t){e.exports=!0},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){var r=n(77),i=n(61);e.exports=Object.keys||function(e){return r(e,i)}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var r=n(10).f,i=n(15),o=n(5)("toStringTag");e.exports=function(e,t,n){e&&!i(e=n?e:e.prototype,o)&&r(e,o,{configurable:!0,value:t})}},function(e,t,n){var r=n(6);e.exports=function(e,t){if(!r(e)||e._t!==t)throw TypeError("Incompatible receiver, "+t+" required!");return e}},function(e,t){},function(e,t,n){var r=n(11),i=n(76),o=n(61),s=n(59)("IE_PROTO"),a=function(){},u=function(){var e,t=n(55)("iframe"),r=o.length;for(t.style.display="none",n(78).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write("<script>document.F=Object<\/script>"),e.close(),u=e.F;r--;)delete u.prototype[o[r]];return u()};e.exports=Object.create||function(e,t){var n;return null!==e?(a.prototype=r(e),n=new a,a.prototype=null,n[s]=e):n=u(),void 0===t?n:i(n,t)}},function(e,t,n){var r=n(52),i=Math.min;e.exports=function(e){return e>0?i(r(e),9007199254740991):0}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t,n){var r=n(34),i=n(5)("toStringTag"),o="Arguments"==r(function(){return arguments}()),s=function(e,t){try{return e[t]}catch(e){}};e.exports=function(e){var t,n,a;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=s(t=Object(e),i))?n:o?r(t):"Object"==(a=r(t))&&"function"==typeof t.callee?"Arguments":a}},function(e,t){e.exports=function(e,t,n,r){if(!(e instanceof t)||void 0!==r&&r in e)throw TypeError(n+": incorrect invocation!");return e}},function(e,t,n){var r=n(14);e.exports=function(e,t,n){for(var i in t)n&&e[i]?e[i]=t[i]:r(e,i,t[i]);return e}},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){var r=n(4),i=n(1),o=n(17);e.exports=function(e,t){var n=(i.Object||{})[e]||Object[e],s={};s[e]=t(n),r(r.S+r.F*o(function(){n(1)}),"Object",s)}},function(e,t,n){e.exports={default:n(153),__esModule:!0}},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t){t.f={}.propertyIsEnumerable},function(e,t){},function(e,t,n){function r(e){return null==e?void 0===e?u:a:c&&c in Object(e)?o(e):s(e)}var i=n(116),o=n(268),s=n(269),a="[object Null]",u="[object Undefined]",c=i?i.toStringTag:void 0;e.exports=r},function(e,t){function n(e){return null!=e&&"object"==typeof e}e.exports=n},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){"use strict";var r=n(30),i=n(4),o=n(57),s=n(14),a=n(23),u=n(128),c=n(35),l=n(79),f=n(5)("iterator"),h=!([].keys&&"next"in[].keys()),d=function(){return this};e.exports=function(e,t,n,p,v,m,y){u(n,t,p);var g,_,b,w=function(e){if(!h&&e in O)return O[e];switch(e){case"keys":case"values":return function(){return new n(this,e)}}return function(){return new n(this,e)}},E=t+" Iterator",T="values"==v,S=!1,O=e.prototype,A=O[f]||O["@@iterator"]||v&&O[v],I=A||w(v),x=v?T?w("entries"):I:void 0,C="Array"==t?O.entries||A:A;if(C&&(b=l(C.call(new e)))!==Object.prototype&&b.next&&(c(b,E,!0),r||"function"==typeof b[f]||s(b,f,d)),T&&A&&"values"!==A.name&&(S=!0,I=function(){return A.call(this)}),r&&!y||!h&&!S&&O[f]||s(O,f,I),a[t]=I,a[E]=d,v)if(g={values:T?I:w("values"),keys:m?I:w("keys"),entries:x},y)for(_ in g)_ in O||o(O,_,g[_]);else i(i.P+i.F*(h||S),t,g);return g}},function(e,t,n){var r=n(6),i=n(3).document,o=r(i)&&r(i.createElement);e.exports=function(e){return o?i.createElement(e):{}}},function(e,t,n){var r=n(6);e.exports=function(e,t){if(!r(e))return e;var n,i;if(t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;if("function"==typeof(n=e.valueOf)&&!r(i=n.call(e)))return i;if(!t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},function(e,t,n){e.exports=n(14)},function(e,t,n){var r=n(34);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t,n){var r=n(60)("keys"),i=n(40);e.exports=function(e){return r[e]||(r[e]=i(e))}},function(e,t,n){var r=n(1),i=n(3),o=i["__core-js_shared__"]||(i["__core-js_shared__"]={});(e.exports=function(e,t){return o[e]||(o[e]=void 0!==t?t:{})})("versions",[]).push({version:r.version,mode:n(30)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){var r=n(41),i=n(5)("iterator"),o=n(23);e.exports=n(1).getIteratorMethod=function(e){if(void 0!=e)return e[i]||e["@@iterator"]||o[r(e)]}},function(e,t,n){"use strict";function r(e){var t,n;this.promise=new e(function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r}),this.resolve=i(t),this.reject=i(n)}var i=n(31);e.exports.f=function(e){return new r(e)}},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,n){e.exports={default:n(140),__esModule:!0}},function(e,t,n){e.exports={default:n(150),__esModule:!0}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(12),o=r(i),s=n(21),a=r(s),u=n(65),c=r(u),l=(n(0),n(96)),f=l.timeout,h=n(19),d=h("leancloud:request"),p=h("leancloud:request:error"),v=n(27),m=v.getAdapter,y=0,g=function(e){var t=e.method,n=e.url,r=e.query,i=e.data,s=e.headers,u=void 0===s?{}:s,l=e.timeout,v=e.onprogress;if(r){var g=(0,c.default)(r).map(function(e){var t=r[e];if(void 0!==t){var n="object"===(void 0===t?"undefined":(0,a.default)(t))?(0,o.default)(t):t;return encodeURIComponent(e)+"="+encodeURIComponent(n)}}).filter(function(e){return e}).join("&");n=n+"?"+g}var _=y++;d("request(%d) %s %s %o %o %o",_,t,n,r,i,u);var b=m("request"),w=b(n,{method:t,headers:u,data:i,onprogress:v}).then(function(e){if(d("response(%d) %d %O %o",_,e.status,e.data||e.text,e.header),!1===e.ok){var t=new Error;throw t.response=e,t}return e.data}).catch(function(e){throw e.response&&(h.enabled("leancloud:request")||p("request(%d) %s %s %o %o %o",_,t,n,r,i,u),p("response(%d) %d %O %o",_,e.response.status,e.response.data||e.response.text,e.response.header),e.statusCode=e.response.status,e.responseText=e.response.text,e.response=e.response.data),e});return l?f(w,l):w};e.exports=g},function(e,t,n){t.f=n(5)},function(e,t,n){var r=n(3),i=n(1),o=n(30),s=n(68),a=n(10).f;e.exports=function(e){var t=i.Symbol||(i.Symbol=o?{}:r.Symbol||{});"_"==e.charAt(0)||e in t||a(t,e,{value:s.f(e)})}},function(e,t,n){var r=n(77),i=n(61).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,i)}},function(e,t,n){var r=n(48),i=n(32),o=n(16),s=n(56),a=n(15),u=n(75),c=Object.getOwnPropertyDescriptor;t.f=n(8)?c:function(e,t){if(e=o(e),t=s(t,!0),u)try{return c(e,t)}catch(e){}if(a(e,t))return i(!r.f.call(e,t),e[t])}},function(e,t,n){e.exports={default:n(176),__esModule:!0}},function(e,t,n){"use strict";e.exports=n(208)},function(e,t,n){var r=n(13),i=n(58),o=n(18),s=n(39),a=n(212);e.exports=function(e,t){var n=1==e,u=2==e,c=3==e,l=4==e,f=6==e,h=5==e||f,d=t||a;return function(t,a,p){for(var v,m,y=o(t),g=i(y),_=r(a,p,3),b=s(g.length),w=0,E=n?d(t,b):u?d(t,0):void 0;b>w;w++)if((h||w in g)&&(v=g[w],m=_(v,w,y),e))if(n)E[w]=m;else if(m)switch(e){case 3:return!0;case 5:return v;case 6:return w;case 2:E.push(v)}else if(l)return!1;return f?-1:c||l?l:E}}},function(e,t,n){e.exports=!n(8)&&!n(17)(function(){return 7!=Object.defineProperty(n(55)("div"),"a",{get:function(){return 7}}).a})},function(e,t,n){var r=n(10),i=n(11),o=n(33);e.exports=n(8)?Object.defineProperties:function(e,t){i(e);for(var n,s=o(t),a=s.length,u=0;a>u;)r.f(e,n=s[u++],t[n]);return e}},function(e,t,n){var r=n(15),i=n(16),o=n(129)(!1),s=n(59)("IE_PROTO");e.exports=function(e,t){var n,a=i(e),u=0,c=[];for(n in a)n!=s&&r(a,n)&&c.push(n);for(;t.length>u;)r(a,n=t[u++])&&(~o(c,n)||c.push(n));return c}},function(e,t,n){var r=n(3).document;e.exports=r&&r.documentElement},function(e,t,n){var r=n(15),i=n(18),o=n(59)("IE_PROTO"),s=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=i(e),r(e,o)?e[o]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?s:null}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,n){var r=n(11);e.exports=function(e,t,n,i){try{return i?t(r(n)[0],n[1]):t(n)}catch(t){var o=e.return;throw void 0!==o&&r(o.call(e)),t}}},function(e,t,n){var r=n(23),i=n(5)("iterator"),o=Array.prototype;e.exports=function(e){return void 0!==e&&(r.Array===e||o[i]===e)}},function(e,t,n){var r=n(11),i=n(31),o=n(5)("species");e.exports=function(e,t){var n,s=r(e).constructor;return void 0===s||void 0==(n=r(s)[o])?t:i(n)}},function(e,t,n){var r,i,o,s=n(13),a=n(134),u=n(78),c=n(55),l=n(3),f=l.process,h=l.setImmediate,d=l.clearImmediate,p=l.MessageChannel,v=l.Dispatch,m=0,y={},g=function(){var e=+this;if(y.hasOwnProperty(e)){var t=y[e];delete y[e],t()}},_=function(e){g.call(e.data)};h&&d||(h=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return y[++m]=function(){a("function"==typeof e?e:Function(e),t)},r(m),m},d=function(e){delete y[e]},"process"==n(34)(f)?r=function(e){f.nextTick(s(g,e,1))}:v&&v.now?r=function(e){v.now(s(g,e,1))}:p?(i=new p,o=i.port2,i.port1.onmessage=_,r=s(o.postMessage,o,1)):l.addEventListener&&"function"==typeof postMessage&&!l.importScripts?(r=function(e){l.postMessage(e+"","*")},l.addEventListener("message",_,!1)):r="onreadystatechange"in c("script")?function(e){u.appendChild(c("script")).onreadystatechange=function(){u.removeChild(this),g.call(e)}}:function(e){setTimeout(s(g,e,1),0)}),e.exports={set:h,clear:d}},function(e,t){e.exports=function(e){try{return{e:!1,v:e()}}catch(e){return{e:!0,v:e}}}},function(e,t,n){var r=n(11),i=n(6),o=n(63);e.exports=function(e,t){if(r(e),i(t)&&t.constructor===e)return t;var n=o.f(e);return(0,n.resolve)(t),n.promise}},function(e,t,n){"use strict";var r=n(3),i=n(1),o=n(10),s=n(8),a=n(5)("species");e.exports=function(e){var t="function"==typeof i[e]?i[e]:r[e];s&&t&&!t[a]&&o.f(t,a,{configurable:!0,get:function(){return this}})}},function(e,t,n){var r=n(5)("iterator"),i=!1;try{var o=[7][r]();o.return=function(){i=!0},Array.from(o,function(){throw 2})}catch(e){}e.exports=function(e,t){if(!t&&!i)return!1;var n=!1;try{var o=[7],s=o[r]();s.next=function(){return{done:n=!0}},o[r]=function(){return s},e(o)}catch(e){}return n}},function(e,t,n){function r(e,t,n){var r=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null),e=e||{};var s=e.random||(e.rng||i)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var a=0;a<16;++a)t[r+a]=s[a];return t||o(s)}var i=n(142),o=n(143);e.exports=r},function(e,t,n){"use strict";e.exports="4.10.0"},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);i<o;i++)s[i]=r[i].fn;return s},o.prototype.emit=function(e,t,n,r,i,o){var s=a?a+e:e;if(!this._events[s])return!1;var u,c,l=this._events[s],f=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),f){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,n),!0;case 4:return l.fn.call(l.context,t,n,r),!0;case 5:return l.fn.call(l.context,t,n,r,i),!0;case 6:return l.fn.call(l.context,t,n,r,i,o),!0}for(c=1,u=new Array(f-1);c<f;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u)}else{var h,d=l.length;for(c=0;c<d;c++)switch(l[c].once&&this.removeListener(e,l[c].fn,void 0,!0),f){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,t);break;case 3:l[c].fn.call(l[c].context,t,n);break;case 4:l[c].fn.call(l[c].context,t,n,r);break;default:if(!u)for(h=1,u=new Array(f-1);h<f;h++)u[h-1]=arguments[h];l[c].fn.apply(l[c].context,u)}}return!0},o.prototype.on=function(e,t,n){var r=new i(t,n||this),o=a?a+e:e;return this._events[o]?this._events[o].fn?this._events[o]=[this._events[o],r]:this._events[o].push(r):(this._events[o]=r,this._eventsCount++),this},o.prototype.once=function(e,t,n){var r=new i(t,n||this,!0),o=a?a+e:e;return this._events[o]?this._events[o].fn?this._events[o]=[this._events[o],r]:this._events[o].push(r):(this._events[o]=r,this._eventsCount++),this},o.prototype.removeListener=function(e,t,n,i){var o=a?a+e:e;if(!this._events[o])return this;if(!t)return 0==--this._eventsCount?this._events=new r:delete this._events[o],this;var s=this._events[o];if(s.fn)s.fn!==t||i&&!s.once||n&&s.context!==n||(0==--this._eventsCount?this._events=new r:delete this._events[o]);else{for(var u=0,c=[],l=s.length;u<l;u++)(s[u].fn!==t||i&&!s[u].once||n&&s[u].context!==n)&&c.push(s[u]);c.length?this._events[o]=1===c.length?c[0]:c:0==--this._eventsCount?this._events=new r:delete this._events[o]}return this},o.prototype.removeAllListeners=function(e){var t;return e?(t=a?a+e:e,this._events[t]&&(0==--this._eventsCount?this._events=new r:delete this._events[t])):(this._events=new r,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prototype.setMaxListeners=function(){return this},o.prefixed=a,o.EventEmitter=o,e.exports=o},function(e,t,n){"use strict";var r=n(2),i=function(e){return e&&e.__esModule?e:{default:e}}(r),o=n(27),s=o.getAdapter,a=["getItem","setItem","removeItem","clear"],u={get async(){return s("storage").async}};a.forEach(function(e){u[e+"Async"]=function(){var t=s("storage");return i.default.resolve(t[e].apply(t,arguments))},u[e]=function(){var t=s("storage");if(!t.async)return t[e].apply(t,arguments);var n=new Error("Synchronous API ["+e+"] is not available in this runtime.");throw n.code="SYNC_API_NOT_AVAILABLE",n}}),e.exports=u},function(e,t,n){"use strict";var r=n(12),i=function(e){return e&&e.__esModule?e:{default:e}}(r),o=n(92),s=n(26),a=t.removeAsync=o.removeItemAsync.bind(o),u=function(e,t){try{e=JSON.parse(e)}catch(e){return null}if(e){return e.expiredAt&&e.expiredAt<Date.now()?a(t).then(function(){return null}):e.value}return null};t.getAsync=function(e){return e="AV/"+s.applicationId+"/"+e,o.getItemAsync(e).then(function(t){return u(t,e)})},t.setAsync=function(e,t,n){var r={value:t};return"number"==typeof n&&(r.expiredAt=Date.now()+n),o.setItemAsync("AV/"+s.applicationId+"/"+e,(0,i.default)(r))}},function(e,t,n){"use strict";var r=n(3),i=n(15),o=n(8),s=n(4),a=n(57),u=n(29).KEY,c=n(17),l=n(60),f=n(35),h=n(40),d=n(5),p=n(68),v=n(69),m=n(155),y=n(95),g=n(11),_=n(6),b=n(18),w=n(16),E=n(56),T=n(32),S=n(38),O=n(156),A=n(71),I=n(47),x=n(10),C=n(33),N=A.f,P=x.f,R=O.f,j=r.Symbol,k=r.JSON,L=k&&k.stringify,U=d("_hidden"),M=d("toPrimitive"),D={}.propertyIsEnumerable,F=l("symbol-registry"),q=l("symbols"),B=l("op-symbols"),V=Object.prototype,W="function"==typeof j&&!!I.f,Y=r.QObject,z=!Y||!Y.prototype||!Y.prototype.findChild,Q=o&&c(function(){return 7!=S(P({},"a",{get:function(){return P(this,"a",{value:7}).a}})).a})?function(e,t,n){var r=N(V,t);r&&delete V[t],P(e,t,n),r&&e!==V&&P(V,t,r)}:P,G=function(e){var t=q[e]=S(j.prototype);return t._k=e,t},J=W&&"symbol"==typeof j.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof j},K=function(e,t,n){return e===V&&K(B,t,n),g(e),t=E(t,!0),g(n),i(q,t)?(n.enumerable?(i(e,U)&&e[U][t]&&(e[U][t]=!1),n=S(n,{enumerable:T(0,!1)})):(i(e,U)||P(e,U,T(1,{})),e[U][t]=!0),Q(e,t,n)):P(e,t,n)},H=function(e,t){g(e);for(var n,r=m(t=w(t)),i=0,o=r.length;o>i;)K(e,n=r[i++],t[n]);return e},$=function(e,t){return void 0===t?S(e):H(S(e),t)},X=function(e){var t=D.call(this,e=E(e,!0));return!(this===V&&i(q,e)&&!i(B,e))&&(!(t||!i(this,e)||!i(q,e)||i(this,U)&&this[U][e])||t)},Z=function(e,t){if(e=w(e),t=E(t,!0),e!==V||!i(q,t)||i(B,t)){var n=N(e,t);return!n||!i(q,t)||i(e,U)&&e[U][t]||(n.enumerable=!0),n}},ee=function(e){for(var t,n=R(w(e)),r=[],o=0;n.length>o;)i(q,t=n[o++])||t==U||t==u||r.push(t);return r},te=function(e){for(var t,n=e===V,r=R(n?B:w(e)),o=[],s=0;r.length>s;)!i(q,t=r[s++])||n&&!i(V,t)||o.push(q[t]);return o};W||(j=function(){if(this instanceof j)throw TypeError("Symbol is not a constructor!");var e=h(arguments.length>0?arguments[0]:void 0),t=function(n){this===V&&t.call(B,n),i(this,U)&&i(this[U],e)&&(this[U][e]=!1),Q(this,e,T(1,n))};return o&&z&&Q(V,e,{configurable:!0,set:t}),G(e)},a(j.prototype,"toString",function(){return this._k}),A.f=Z,x.f=K,n(70).f=O.f=ee,n(48).f=X,I.f=te,o&&!n(30)&&a(V,"propertyIsEnumerable",X,!0),p.f=function(e){return G(d(e))}),s(s.G+s.W+s.F*!W,{Symbol:j});for(var ne="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),re=0;ne.length>re;)d(ne[re++]);for(var ie=C(d.store),oe=0;ie.length>oe;)v(ie[oe++]);s(s.S+s.F*!W,"Symbol",{for:function(e){return i(F,e+="")?F[e]:F[e]=j(e)},keyFor:function(e){if(!J(e))throw TypeError(e+" is not a symbol!");for(var t in F)if(F[t]===e)return t},useSetter:function(){z=!0},useSimple:function(){z=!1}}),s(s.S+s.F*!W,"Object",{create:$,defineProperty:K,defineProperties:H,getOwnPropertyDescriptor:Z,getOwnPropertyNames:ee,getOwnPropertySymbols:te});var se=c(function(){I.f(1)});s(s.S+s.F*se,"Object",{getOwnPropertySymbols:function(e){return I.f(b(e))}}),k&&s(s.S+s.F*(!W||c(function(){var e=j();return"[null]"!=L([e])||"{}"!=L({a:e})||"{}"!=L(Object(e))})),"JSON",{stringify:function(e){for(var t,n,r=[e],i=1;arguments.length>i;)r.push(arguments[i++]);if(n=t=r[1],(_(t)||void 0!==e)&&!J(e))return y(t)||(t=function(e,t){if("function"==typeof n&&(t=n.call(this,e,t)),!J(t))return t}),r[1]=t,L.apply(k,r)}}),j.prototype[M]||n(14)(j.prototype,M,j.prototype.valueOf),f(j,"Symbol"),f(Math,"Math",!0),f(r.JSON,"JSON",!0)},function(e,t,n){var r=n(34);e.exports=Array.isArray||function(e){return"Array"==r(e)}},function(e,t,n){"use strict";var r;e.exports.timeout=function(e,t){var n,i=new r;return Promise.race([e,new Promise(function(e,r){n=setTimeout(function(){r(i)},t)})]).then(function(e){return clearTimeout(n),e},function(e){throw clearTimeout(n),e})};r=e.exports.TimeoutError=function(){Error.call(this),this.stack=Error().stack,this.message="Timeout"},r.prototype=Object.create(Error.prototype),r.prototype.name="TimeoutError"},function(e,t){var n={utf8:{stringToBytes:function(e){return n.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(n.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t},bytesToString:function(e){for(var t=[],n=0;n<e.length;n++)t.push(String.fromCharCode(e[n]));return t.join("")}}};e.exports=n},function(e,t,n){e.exports={default:n(173),__esModule:!0}},function(e,t,n){"use strict";var r=n(195);e.exports=function(e){return e.setAdapters(r),e}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){"@babel/helpers - typeof";return(i="function"==typeof f.default&&"symbol"===(0,c.default)(a.default)?function(e){return void 0===e?"undefined":(0,c.default)(e)}:function(e){return e&&"function"==typeof f.default&&e.constructor===f.default&&e!==f.default.prototype?"symbol":void 0===e?"undefined":(0,c.default)(e)})(e)}function o(e){return null!==e&&"object"===i(e)}var s=n(46),a=r(s),u=n(21),c=r(u),l=n(28),f=r(l);e.exports=o},function(e,t,n){e.exports={default:n(205),__esModule:!0}},function(e,t,n){"use strict";var r=n(10),i=n(32);e.exports=function(e,t,n){t in e?r.f(e,t,i(0,n)):e[t]=n}},function(e,t,n){e.exports={default:n(209),__esModule:!0}},function(e,t,n){"use strict";var r=n(3),i=n(4),o=n(29),s=n(17),a=n(14),u=n(43),c=n(25),l=n(42),f=n(6),h=n(35),d=n(10).f,p=n(74)(0),v=n(8);e.exports=function(e,t,n,m,y,g){var _=r[e],b=_,w=y?"set":"add",E=b&&b.prototype,T={};return v&&"function"==typeof b&&(g||E.forEach&&!s(function(){(new b).entries().next()}))?(b=t(function(t,n){l(t,b,e,"_c"),t._c=new _,void 0!=n&&c(n,y,t[w],t)}),p("add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON".split(","),function(e){var t="add"==e||"set"==e;e in E&&(!g||"clear"!=e)&&a(b.prototype,e,function(n,r){if(l(this,b,e),!t&&g&&!f(n))return"get"==e&&void 0;var i=this._c[e](0===n?0:n,r);return t?this:i})}),g||d(b.prototype,"size",{get:function(){return this._c.size}})):(b=m.getConstructor(t,e,y,w),u(b.prototype,n),o.NEED=!0),h(b,e),T[e]=b,i(i.G+i.W+i.F,T),g||m.setStrong(b,e,y),b}},function(e,t,n){"use strict";var r=n(4);e.exports=function(e){r(r.S,e,{of:function(){for(var e=arguments.length,t=new Array(e);e--;)t[e]=arguments[e];return new this(t)}})}},function(e,t,n){"use strict";var r=n(4),i=n(31),o=n(13),s=n(25);e.exports=function(e){r(r.S,e,{from:function(e){var t,n,r,a,u=arguments[1];return i(this),t=void 0!==u,t&&i(u),void 0==e?new this:(n=[],t?(r=0,a=o(u,arguments[2],2),s(e,!1,function(e){n.push(a(e,r++))})):s(e,!1,n.push,n),new this(n))}})}},function(e,t,n){"use strict";var r=n(8),i=n(33),o=n(47),s=n(48),a=n(18),u=n(58),c=Object.assign;e.exports=!c||n(17)(function(){var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach(function(e){t[e]=e}),7!=c({},e)[n]||Object.keys(c({},t)).join("")!=r})?function(e,t){for(var n=a(e),c=arguments.length,l=1,f=o.f,h=s.f;c>l;)for(var d,p=u(arguments[l++]),v=f?i(p).concat(f(p)):i(p),m=v.length,y=0;m>y;)d=v[y++],r&&!h.call(p,d)||(n[d]=p[d]);return n}:c},function(e,t,n){e.exports={default:n(232),__esModule:!0}},function(e,t,n){e.exports={default:n(233),__esModule:!0}},function(e,t,n){e.exports={default:n(243),__esModule:!0}},function(e,t){function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}e.exports=n},function(e,t){function n(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}e.exports=n},function(e,t,n){function r(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}var i=n(111);e.exports=r},function(e,t,n){function r(e,t){var n=-1,r=e.length,o=r-1;for(t=void 0===t?r:t;++n<t;){var s=i(n,o),a=e[s];e[s]=e[n],e[n]=a}return e.length=t,e}var i=n(259);e.exports=r},function(e,t,n){function r(e){return null==e?[]:i(e,o(e))}var i=n(261),o=n(263);e.exports=r},function(e,t,n){var r=n(117),i=r.Symbol;e.exports=i},function(e,t,n){var r=n(118),i="object"==typeof self&&self&&self.Object===Object&&self,o=r||i||Function("return this")();e.exports=o},function(e,t,n){(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.exports=n}).call(t,n(44))},function(e,t){var n=Array.isArray;e.exports=n},function(e,t){function n(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}var r=9007199254740991;e.exports=n},function(e,t){function n(e,t){return function(n){return e(t(n))}}e.exports=n},function(e,t,n){"use strict";var r=n(123),i=n(207),o=n(99);e.exports=o(i(r))},function(e,t,n){"use strict";var r=n(124),i=n(99);e.exports=i(r)},function(e,t,n){"use strict";e.exports=n(125)},function(e,t,n){"use strict";var r=n(2),i=function(e){return e&&e.__esModule?e:{default:e}}(r),o=n(0),s=n(26);s._=o,s.version=n(90),s.Promise=i.default,s.localStorage=n(92),s.Cache=n(93),s.Error=n(20),n(149),n(159)(s),n(160)(s),n(161)(s),n(162)(s),n(163)(s),n(164)(s),n(172)(s),n(181)(s),n(182)(s),n(184)(s),n(185)(s),n(186)(s),n(187)(s),n(188)(s),n(189)(s),n(190)(s),n(191)(s),n(192)(s),s.Conversation=n(193),n(194),e.exports=s},function(e,t,n){n(37),n(22),n(24),n(133),n(137),n(138),e.exports=n(1).Promise},function(e,t,n){var r=n(52),i=n(53);e.exports=function(e){return function(t,n){var o,s,a=String(i(t)),u=r(n),c=a.length;return u<0||u>=c?e?"":void 0:(o=a.charCodeAt(u),o<55296||o>56319||u+1===c||(s=a.charCodeAt(u+1))<56320||s>57343?e?a.charAt(u):o:e?a.slice(u,u+2):s-56320+(o-55296<<10)+65536)}}},function(e,t,n){"use strict";var r=n(38),i=n(32),o=n(35),s={};n(14)(s,n(5)("iterator"),function(){return this}),e.exports=function(e,t,n){e.prototype=r(s,{next:i(1,n)}),o(e,t+" Iterator")}},function(e,t,n){var r=n(16),i=n(39),o=n(130);e.exports=function(e){return function(t,n,s){var a,u=r(t),c=i(u.length),l=o(s,c);if(e&&n!=n){for(;c>l;)if((a=u[l++])!=a)return!0}else for(;c>l;l++)if((e||l in u)&&u[l]===n)return e||l||0;return!e&&-1}}},function(e,t,n){var r=n(52),i=Math.max,o=Math.min;e.exports=function(e,t){return e=r(e),e<0?i(e+t,0):o(e,t)}},function(e,t,n){"use strict";var r=n(132),i=n(80),o=n(23),s=n(16);e.exports=n(54)(Array,"Array",function(e,t){this._t=s(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,i(1)):"keys"==t?i(0,n):"values"==t?i(0,e[n]):i(0,[n,e[n]])},"values"),o.Arguments=o.Array,r("keys"),r("values"),r("entries")},function(e,t){e.exports=function(){}},function(e,t,n){"use strict";var r,i,o,s,a=n(30),u=n(3),c=n(13),l=n(41),f=n(4),h=n(6),d=n(31),p=n(42),v=n(25),m=n(83),y=n(84).set,g=n(135)(),_=n(63),b=n(85),w=n(136),E=n(86),T=u.TypeError,S=u.process,O=S&&S.versions,A=O&&O.v8||"",I=u.Promise,x="process"==l(S),C=function(){},N=i=_.f,P=!!function(){try{var e=I.resolve(1),t=(e.constructor={})[n(5)("species")]=function(e){e(C,C)};return(x||"function"==typeof PromiseRejectionEvent)&&e.then(C)instanceof t&&0!==A.indexOf("6.6")&&-1===w.indexOf("Chrome/66")}catch(e){}}(),R=function(e){var t;return!(!h(e)||"function"!=typeof(t=e.then))&&t},j=function(e,t){if(!e._n){e._n=!0;var n=e._c;g(function(){for(var r=e._v,i=1==e._s,o=0;n.length>o;)!function(t){var n,o,s,a=i?t.ok:t.fail,u=t.resolve,c=t.reject,l=t.domain;try{a?(i||(2==e._h&&U(e),e._h=1),!0===a?n=r:(l&&l.enter(),n=a(r),l&&(l.exit(),s=!0)),n===t.promise?c(T("Promise-chain cycle")):(o=R(n))?o.call(n,u,c):u(n)):c(r)}catch(e){l&&!s&&l.exit(),c(e)}}(n[o++]);e._c=[],e._n=!1,t&&!e._h&&k(e)})}},k=function(e){y.call(u,function(){var t,n,r,i=e._v,o=L(e);if(o&&(t=b(function(){x?S.emit("unhandledRejection",i,e):(n=u.onunhandledrejection)?n({promise:e,reason:i}):(r=u.console)&&r.error&&r.error("Unhandled promise rejection",i)}),e._h=x||L(e)?2:1),e._a=void 0,o&&t.e)throw t.v})},L=function(e){return 1!==e._h&&0===(e._a||e._c).length},U=function(e){y.call(u,function(){var t;x?S.emit("rejectionHandled",e):(t=u.onrejectionhandled)&&t({promise:e,reason:e._v})})},M=function(e){var t=this;t._d||(t._d=!0,t=t._w||t,t._v=e,t._s=2,t._a||(t._a=t._c.slice()),j(t,!0))},D=function(e){var t,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===e)throw T("Promise can't be resolved itself");(t=R(e))?g(function(){var r={_w:n,_d:!1};try{t.call(e,c(D,r,1),c(M,r,1))}catch(e){M.call(r,e)}}):(n._v=e,n._s=1,j(n,!1))}catch(e){M.call({_w:n,_d:!1},e)}}};P||(I=function(e){p(this,I,"Promise","_h"),d(e),r.call(this);try{e(c(D,this,1),c(M,this,1))}catch(e){M.call(this,e)}},r=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},r.prototype=n(43)(I.prototype,{then:function(e,t){var n=N(m(this,I));return n.ok="function"!=typeof e||e,n.fail="function"==typeof t&&t,n.domain=x?S.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&j(this,!1),n.promise},catch:function(e){return this.then(void 0,e)}}),o=function(){var e=new r;this.promise=e,this.resolve=c(D,e,1),this.reject=c(M,e,1)},_.f=N=function(e){return e===I||e===s?new o(e):i(e)}),f(f.G+f.W+f.F*!P,{Promise:I}),n(35)(I,"Promise"),n(87)("Promise"),s=n(1).Promise,f(f.S+f.F*!P,"Promise",{reject:function(e){var t=N(this);return(0,t.reject)(e),t.promise}}),f(f.S+f.F*(a||!P),"Promise",{resolve:function(e){return E(a&&this===s?I:this,e)}}),f(f.S+f.F*!(P&&n(88)(function(e){I.all(e).catch(C)})),"Promise",{all:function(e){var t=this,n=N(t),r=n.resolve,i=n.reject,o=b(function(){var n=[],o=0,s=1;v(e,!1,function(e){var a=o++,u=!1;n.push(void 0),s++,t.resolve(e).then(function(e){u||(u=!0,n[a]=e,--s||r(n))},i)}),--s||r(n)});return o.e&&i(o.v),n.promise},race:function(e){var t=this,n=N(t),r=n.reject,i=b(function(){v(e,!1,function(e){t.resolve(e).then(n.resolve,r)})});return i.e&&r(i.v),n.promise}})},function(e,t){e.exports=function(e,t,n){var r=void 0===n;switch(t.length){case 0:return r?e():e.call(n);case 1:return r?e(t[0]):e.call(n,t[0]);case 2:return r?e(t[0],t[1]):e.call(n,t[0],t[1]);case 3:return r?e(t[0],t[1],t[2]):e.call(n,t[0],t[1],t[2]);case 4:return r?e(t[0],t[1],t[2],t[3]):e.call(n,t[0],t[1],t[2],t[3])}return e.apply(n,t)}},function(e,t,n){var r=n(3),i=n(84).set,o=r.MutationObserver||r.WebKitMutationObserver,s=r.process,a=r.Promise,u="process"==n(34)(s);e.exports=function(){var e,t,n,c=function(){var r,i;for(u&&(r=s.domain)&&r.exit();e;){i=e.fn,e=e.next;try{i()}catch(r){throw e?n():t=void 0,r}}t=void 0,r&&r.enter()};if(u)n=function(){s.nextTick(c)};else if(!o||r.navigator&&r.navigator.standalone)if(a&&a.resolve){var l=a.resolve(void 0);n=function(){l.then(c)}}else n=function(){i.call(r,c)};else{var f=!0,h=document.createTextNode("");new o(c).observe(h,{characterData:!0}),n=function(){h.data=f=!f}}return function(r){var i={fn:r,next:void 0};t&&(t.next=i),e||(e=i,n()),t=i}}},function(e,t,n){var r=n(3),i=r.navigator;e.exports=i&&i.userAgent||""},function(e,t,n){"use strict";var r=n(4),i=n(1),o=n(3),s=n(83),a=n(86);r(r.P+r.R,"Promise",{finally:function(e){var t=s(this,i.Promise||o.Promise),n="function"==typeof e;return this.then(n?function(n){return a(t,e()).then(function(){return n})}:e,n?function(n){return a(t,e()).then(function(){throw n})}:e)}})},function(e,t,n){"use strict";var r=n(4),i=n(63),o=n(85);r(r.S,"Promise",{try:function(e){var t=i.f(this),n=o(e);return(n.e?t.reject:t.resolve)(n.v),t.promise}})},function(e,t,n){var r=n(1),i=r.JSON||(r.JSON={stringify:JSON.stringify});e.exports=function(e){return i.stringify.apply(i,arguments)}},function(e,t,n){n(141),e.exports=n(1).Object.keys},function(e,t,n){var r=n(18),i=n(33);n(45)("keys",function(){return function(e){return i(r(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;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return r.colors[Math.abs(t)%r.colors.length]}function r(e){function n(){if(n.enabled){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];var o=n,a=Number(new Date),u=a-(s||a);o.diff=u,o.prev=s,o.curr=a,s=a,t[0]=r.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");var c=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,function(e,n){if("%%"===e)return e;c++;var i=r.formatters[n];if("function"==typeof i){var s=t[c];e=i.call(o,s),t.splice(c,1),c--}return e}),r.formatArgs.call(o,t);(o.log||r.log).apply(o,t)}}var s;return n.namespace=e,n.enabled=r.enabled(e),n.useColors=r.useColors(),n.color=t(e),n.destroy=i,n.extend=o,"function"==typeof r.init&&r.init(n),r.instances.push(n),n}function i(){var e=r.instances.indexOf(this);return-1!==e&&(r.instances.splice(e,1),!0)}function o(e,t){return r(this.namespace+(void 0===t?":":t)+e)}function s(e){r.save(e),r.names=[],r.skips=[];var t,n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(t=0;t<i;t++)n[t]&&(e=n[t].replace(/\*/g,".*?"),"-"===e[0]?r.skips.push(new RegExp("^"+e.substr(1)+"$")):r.names.push(new RegExp("^"+e+"$")));for(t=0;t<r.instances.length;t++){var o=r.instances[t];o.enabled=r.enabled(o.namespace)}}function a(){r.enable("")}function u(e){if("*"===e[e.length-1])return!0;var t,n;for(t=0,n=r.skips.length;t<n;t++)if(r.skips[t].test(e))return!1;for(t=0,n=r.names.length;t<n;t++)if(r.names[t].test(e))return!0;return!1}function c(e){return e instanceof Error?e.stack||e.message:e}return r.debug=r,r.default=r,r.coerce=c,r.disable=a,r.enable=s,r.enabled=u,r.humanize=n(145),Object.keys(e).forEach(function(t){r[t]=e[t]}),r.instances=[],r.names=[],r.skips=[],r.formatters={},r.selectColor=t,r.enable(r.load()),r}e.exports=r},function(e,t){function n(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\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&&isFinite(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){e.exports={default:n(147),__esModule:!0}},function(e,t,n){n(148),e.exports=n(1).Object.getPrototypeOf},function(e,t,n){var r=n(18),i=n(79);n(45)("getPrototypeOf",function(){return function(e){return i(r(e))}})},function(e,t,n){"use strict";function r(e){if(p(e))return{};var t=e.slice(0,8).toLowerCase(),n="lncldglobal.com";return{push:"https://"+t+".push."+n,stats:"https://"+t+".stats."+n,engine:"https://"+t+".engine."+n,api:"https://"+t+".api."+n,rtm:"https://"+t+".rtm."+n}}var i=n(66),o=function(e){return e&&e.__esModule?e:{default:e}}(i),s=n(26),a=n(152),u=n(9),c=u.isNullOrUndefined,l=n(0),f=l.extend,h=l.isObject,d=l.isEmpty,p=function(e){return"-MdYXbMMI"!==e.slice(-9)},v=function(e){return{push:e,stats:e,engine:e,api:e,rtm:e}},m=!1,y=!1;s.init=function(e){if(!h(e))return s.init({appId:e,appKey:arguments.length<=1?void 0:arguments[1],masterKey:arguments.length<=2?void 0:arguments[2]});var t=e.appId,n=e.appKey,i=e.masterKey,o=e.hookKey,u=e.serverURL,c=e.serverURLs,l=void 0===c?u:c,g=e.disableCurrentUser,_=e.production,b=e.realtime;if(y&&console.warn("Initializing LeanCloud Storage SDK which has already been initialized. Reinitializing the SDK might cause problems like unexpected cross-app data writing and invalid relations."),!t)throw new TypeError("appId must be a string");if(!n)throw new TypeError("appKey must be a string");if(i&&console.warn("MasterKey is not supposed to be used at client side."),p(t)&&!l&&d(s._config.serverURLs))throw new TypeError("serverURL option is required for apps from CN region");t!==s._config.applicationId?(s._config.masterKey=i,s._config.hookKey=o):(i&&(s._config.masterKey=i),o&&(s._config.hookKey=o)),s._config.applicationId=t,s._config.applicationKey=n,s.setProduction(_),void 0!==g&&(s._config.disableCurrentUser=g);var w=m||void 0!==l;if(w||(s._appRouter=new a(s)),s._setServerURLs(f({},r(t),s._config.serverURLs,"string"==typeof l?v(l):l),w),b)s._config.realtime=b;else if(s._sharedConfig.liveQueryRealtime){var E=s._config.serverURLs,T=E.api,S=E.rtm;s._config.realtime=new s._sharedConfig.liveQueryRealtime({appId:t,appKey:n,server:{api:T,RTMRouter:S}})}y=!0},s.setProduction=function(e){c(e)?s._config.production=null:s._config.production=e?1:0},s._setServerURLs=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];"string"!=typeof e?f(s._config.serverURLs,e):s._config.serverURLs=v(e),t&&(s._appRouter?s._appRouter.disable():m=!0)},s.setServerURL=function(e){return s._setServerURLs(e)},s.setServerURLs=s.setServerURL,s.keepErrorRawMessage=function(e){s._sharedConfig.keepErrorRawMessage=e},s.setRequestTimeout=function(e){s._config.requestTimeout=e},s.initialize=s.init,["applicationId","applicationKey","masterKey","hookKey"].forEach(function(e){return(0,o.default)(s,e,{get:function(){return s._config[e]},set:function(t){s._config[e]=t}})})},function(e,t,n){n(151);var r=n(1).Object;e.exports=function(e,t,n){return r.defineProperty(e,t,n)}},function(e,t,n){var r=n(4);r(r.S+r.F*!n(8),"Object",{defineProperty:n(10).f})},function(e,t,n){"use strict";function r(e){var t=this;this.AV=e,this.lockedUntil=0,o.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(67),o=n(93);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()<this.lockedUntil)){this.lock(10);return i({method:"get",url:"https://app-router.com/2/route",query:{appId:this.AV.applicationId}}).then(function(t){if(!e.disabled){var n=t.ttl;if(!n)throw new Error("missing ttl");n*=1e3;var r={push:"https://"+t.push_server,stats:"https://"+t.stats_server,engine:"https://"+t.engine_server,api:"https://"+t.api_server};return e.AV._setServerURLs(r,!1),e.lock(n),o.setAsync("serverURLs",{serverURLs:r,lockedUntil:e.lockedUntil},n)}}).catch(function(t){console.warn("refresh server URLs failed: "+t.message),e.lock(600)})}},e.exports=r},function(e,t,n){n(22),n(24),e.exports=n(68).f("iterator")},function(e,t,n){n(94),n(37),n(157),n(158),e.exports=n(1).Symbol},function(e,t,n){var r=n(33),i=n(47),o=n(48);e.exports=function(e){var t=r(e),n=i.f;if(n)for(var s,a=n(e),u=o.f,c=0;a.length>c;)u.call(e,s=a[c++])&&t.push(s);return t}},function(e,t,n){var r=n(16),i=n(70).f,o={}.toString,s="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],a=function(e){try{return i(e)}catch(e){return s.slice()}};e.exports.f=function(e){return s&&"[object Window]"==o.call(e)?a(e):i(r(e))}},function(e,t,n){n(69)("asyncIterator")},function(e,t,n){n(69)("observable")},function(e,t,n){"use strict";var r=n(0);e.exports=function(e){var t=/\s+/,n=Array.prototype.slice;e.Events={on:function(e,n,r){var i,o,s,a,u;if(!n)return this;for(e=e.split(t),i=this._callbacks||(this._callbacks={}),o=e.shift();o;)u=i[o],s=u?u.tail:{},s.next=a={},s.context=r,s.callback=n,i[o]={tail:a,next:u?u.next:s},o=e.shift();return this},off:function(e,n,i){var o,s,a,u,c,l;if(s=this._callbacks){if(!(e||n||i))return delete this._callbacks,this;for(e=e?e.split(t):r.keys(s),o=e.shift();o;)if(a=s[o],delete s[o],a&&(n||i)){for(u=a.tail,a=a.next;a!==u;)c=a.callback,l=a.context,(n&&c!==n||i&&l!==i)&&this.on(o,c,l),a=a.next;o=e.shift()}return this}},trigger:function(e){var r,i,o,s,a,u,c;if(!(o=this._callbacks))return this;for(u=o.all,e=e.split(t),c=n.call(arguments,1),r=e.shift();r;){if(i=o[r])for(s=i.tail;(i=i.next)!==s;)i.callback.apply(i.context||this,c);if(i=u)for(s=i.tail,a=[r].concat(c);(i=i.next)!==s;)i.callback.apply(i.context||this,a);r=e.shift()}return this}},e.Events.bind=e.Events.on,e.Events.unbind=e.Events.off}},function(e,t,n){"use strict";var r=n(2),i=function(e){return e&&e.__esModule?e:{default:e}}(r),o=n(0);e.exports=function(e){e.GeoPoint=function(t,n){o.isArray(t)?(e.GeoPoint._validate(t[0],t[1]),this.latitude=t[0],this.longitude=t[1]):o.isObject(t)?(e.GeoPoint._validate(t.latitude,t.longitude),this.latitude=t.latitude,this.longitude=t.longitude):o.isNumber(t)&&o.isNumber(n)?(e.GeoPoint._validate(t,n),this.latitude=t,this.longitude=n):(this.latitude=0,this.longitude=0);var r=this;this.__defineGetter__&&this.__defineSetter__&&(this._latitude=this.latitude,this._longitude=this.longitude,this.__defineGetter__("latitude",function(){return r._latitude}),this.__defineGetter__("longitude",function(){return r._longitude}),this.__defineSetter__("latitude",function(t){e.GeoPoint._validate(t,r.longitude),r._latitude=t}),this.__defineSetter__("longitude",function(t){e.GeoPoint._validate(r.latitude,t),r._longitude=t}))},e.GeoPoint._validate=function(e,t){if(e<-90)throw new Error("AV.GeoPoint latitude "+e+" < -90.0.");if(e>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.default(function(t,n){navigator.geolocation.getCurrentPosition(function(n){t(new e.GeoPoint({latitude:n.coords.latitude,longitude:n.coords.longitude}))},n)})},o.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._defaultParams.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(2),i=function(e){return e&&e.__esModule?e:{default:e}}(r),o=n(0),s=n(165),a=n(166),u=n(167),c=n(20),l=n(7)._request,f=n(9),h=f.tap,d=f.transformFetchOptions,p=n(19)("leancloud:file"),v=n(171);e.exports=function(e){var t=function(e){return o.isString(e)?e.match(/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/)[4]:""},n=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.")},r=function(e){var t=[];return t.length=Math.ceil(e.length/3),o.times(t.length,function(r){var i=e[3*r],o=e[3*r+1]||0,s=e[3*r+2]||0,a=3*r+1<e.length,u=3*r+2<e.length;t[r]=[n(i>>2&63),n(i<<4&48|o>>4&15),a?n(o<<2&60|s>>6&3):"=",u?n(63&s):"="].join("")}),t.join("")};e.File=function(n,i,s){if(this.attributes={name:n,url:"",metaData:{},base64:""},o.isString(i))throw new TypeError("Creating an AV.File from a String is not yet supported.");o.isArray(i)&&(this.attributes.metaData.size=i.length,i={base64:r(i)}),this._extName="",this._data=i,this._uploadHeaders={},i&&i.blob&&"string"==typeof i.blob.uri&&(this._extName=t(i.blob.uri)),"undefined"!=typeof Blob&&i instanceof Blob&&(i.size&&(this.attributes.metaData.size=i.size),i.name&&(this._extName=t(i.name)));var a=void 0;if(i&&i.owner)a=i.owner;else if(!e._config.disableCurrentUser)try{a=e.User.current()}catch(e){if("SYNC_API_NOT_AVAILABLE"!==e.code)throw e}this.attributes.metaData.owner=a?a.id:"unknown",this.set("mime_type",s)},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.attributes.metaData.size=0,o},e.File.createWithoutData=function(t){if(!t)throw new TypeError("The objectId must be provided");var n=new e.File;return n.id=t,n},o.extend(e.File.prototype,{className:"_File",_toFullJSON:function(t){var n=this,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=o.clone(this.attributes);return e._objectEach(i,function(n,o){i[o]=e._encode(n,t,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="File"),i},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 c(c.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;i<n;i++)r[i]=arguments[i];switch(r.length){case 1:for(var o in r[0])t(o,r[0][o]);break;case 2:t(r[0],r[1])}return this},setUploadHeader:function(e,t){return this._uploadHeaders[e]=t,this},metaData:function(e,t){return e&&t?(this.attributes.metaData[e]=t,this):e&&!t?this.attributes.metaData[e]:this.attributes.metaData},thumbnailURL:function(e,t){var n=arguments.length>2&&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?l("files",null,this.id,"DELETE",null,e):i.default.reject(new Error("The file id does not eixst."))},_fileToken:function(e,n){var r=this.attributes.name,i=t(r);!i&&this._extName&&(r+=this._extName,i=this._extName);var o={name:r,keep_file_name:n.keepFileName,key:n.key,ACL:this._acl,mime_type:e,metaData:this.attributes.metaData};return l("fileTokens",null,null,"POST",o,n)},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(r){return r.mime_type&&(n=r.mime_type,e.set("mime_type",n)),e._token=r.token,i.default.resolve().then(function(){var t=e._data;if(t&&t.base64)return v(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 i=o.extend({},t);switch(t.onprogress&&(i.onprogress=function(e){if("download"!==e.direction)return t.onprogress(e)}),r.provider){case"s3":return u(r,n,e,i);case"qcloud":return s(r,n,e,i);case"qiniu":default:return a(r,n,e,i)}}).then(h(function(){return e._callback(!0)}),function(t){throw e._callback(!1),t})})}else if(this.attributes.url&&"external"===this.attributes.metaData.__source){var r={name:this.attributes.name,ACL:this._acl,metaData:this.attributes.metaData,mime_type:this.mimeType,url:this.attributes.url};this._previousSave=l("files",null,null,"post",r,t).then(function(t){return e.id=t.objectId,e})}return this._previousSave},_callback:function(e){l("fileCallback",null,null,"post",{token:this._token,result:e}).catch(p),delete this._token,delete this._data},fetch:function(e,t){return l("files",null,this.id,"GET",d(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,o.extend(this,n),this}})}},function(e,t,n){"use strict";var r=n(27),i=r.getAdapter,o=n(19)("cos");e.exports=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};n.attributes.url=e.url,n._bucket=e.bucket,n.id=e.objectId;var s=e.upload_url+"?sign="+encodeURIComponent(e.token),a={field:"fileContent",data:t,name:n.attributes.name},u={headers:n._uploadHeaders,data:{op:"upload"},onprogress:r.onprogress};return o("url: %s, file: %o, options: %o",s,a,u),i("upload")(s,a,u).then(function(e){if(o(e.status,e.data),!1===e.ok){var t=new Error(e.status);throw t.response=e,t}return n},function(e){var t=e.response;throw t&&(o(t.status,t.data),e.statusCode=t.status,e.response=t.data),e})}},function(e,t,n){"use strict";var r=n(12),i=function(e){return e&&e.__esModule?e:{default:e}}(r),o=n(27),s=o.getAdapter,a=n(19)("leancloud:qiniu");e.exports=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};n.attributes.url=e.url,n._bucket=e.bucket,n.id=e.objectId;var o=e.token,u=e.upload_url||"https://upload.qiniup.com",c={field:"file",data:t,name:n.attributes.name},l={headers:n._uploadHeaders,data:{name:n.attributes.name,key:e.key,token:o},onprogress:r.onprogress};return a("url: %s, file: %o, options: %o",u,c,l),s("upload")(u,c,l).then(function(e){if(a(e.status,e.data),!1===e.ok){var t=e.status;e.data&&(t=e.data.error?e.data.error:(0,i.default)(e.data));var r=new Error(t);throw r.response=e,r}return n},function(e){var t=e.response;throw t&&(a(t.status,t.data),e.statusCode=t.status,e.response=t.data),e})}},function(e,t,n){"use strict";var r=n(0),i=n(67);e.exports=function(e,t,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return n.attributes.url=e.url,n._bucket=e.bucket,n.id=e.objectId,i({url:e.upload_url,method:"PUT",data:t,headers:r.extend({"Content-Type":n.get("mime_type"),"Cache-Control":"public, max-age=31536000"},n._uploadHeaders),onprogress:o.onprogress}).then(function(){return n})}},function(e,t,n){!function(){var t=n(169),r=n(97).utf8,i=n(170),o=n(97).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<a.length;d++)a[d]=16711935&(a[d]<<8|a[d]>>>24)|4278255360&(a[d]<<24|a[d]>>>8);a[u>>>5]|=128<<u%32,a[14+(u+64>>>9<<4)]=u;for(var p=s._ff,v=s._gg,m=s._hh,y=s._ii,d=0;d<a.length;d+=16){var g=c,_=l,b=f,w=h;c=p(c,l,f,h,a[d+0],7,-680876936),h=p(h,c,l,f,a[d+1],12,-389564586),f=p(f,h,c,l,a[d+2],17,606105819),l=p(l,f,h,c,a[d+3],22,-1044525330),c=p(c,l,f,h,a[d+4],7,-176418897),h=p(h,c,l,f,a[d+5],12,1200080426),f=p(f,h,c,l,a[d+6],17,-1473231341),l=p(l,f,h,c,a[d+7],22,-45705983),c=p(c,l,f,h,a[d+8],7,1770035416),h=p(h,c,l,f,a[d+9],12,-1958414417),f=p(f,h,c,l,a[d+10],17,-42063),l=p(l,f,h,c,a[d+11],22,-1990404162),c=p(c,l,f,h,a[d+12],7,1804603682),h=p(h,c,l,f,a[d+13],12,-40341101),f=p(f,h,c,l,a[d+14],17,-1502002290),l=p(l,f,h,c,a[d+15],22,1236535329),c=v(c,l,f,h,a[d+1],5,-165796510),h=v(h,c,l,f,a[d+6],9,-1069501632),f=v(f,h,c,l,a[d+11],14,643717713),l=v(l,f,h,c,a[d+0],20,-373897302),c=v(c,l,f,h,a[d+5],5,-701558691),h=v(h,c,l,f,a[d+10],9,38016083),f=v(f,h,c,l,a[d+15],14,-660478335),l=v(l,f,h,c,a[d+4],20,-405537848),c=v(c,l,f,h,a[d+9],5,568446438),h=v(h,c,l,f,a[d+14],9,-1019803690),f=v(f,h,c,l,a[d+3],14,-187363961),l=v(l,f,h,c,a[d+8],20,1163531501),c=v(c,l,f,h,a[d+13],5,-1444681467),h=v(h,c,l,f,a[d+2],9,-51403784),f=v(f,h,c,l,a[d+7],14,1735328473),l=v(l,f,h,c,a[d+12],20,-1926607734),c=m(c,l,f,h,a[d+5],4,-378558),h=m(h,c,l,f,a[d+8],11,-2022574463),f=m(f,h,c,l,a[d+11],16,1839030562),l=m(l,f,h,c,a[d+14],23,-35309556),c=m(c,l,f,h,a[d+1],4,-1530992060),h=m(h,c,l,f,a[d+4],11,1272893353),f=m(f,h,c,l,a[d+7],16,-155497632),l=m(l,f,h,c,a[d+10],23,-1094730640),c=m(c,l,f,h,a[d+13],4,681279174),h=m(h,c,l,f,a[d+0],11,-358537222),f=m(f,h,c,l,a[d+3],16,-722521979),l=m(l,f,h,c,a[d+6],23,76029189),c=m(c,l,f,h,a[d+9],4,-640364487),h=m(h,c,l,f,a[d+12],11,-421815835),f=m(f,h,c,l,a[d+15],16,530742520),l=m(l,f,h,c,a[d+2],23,-995338651),c=y(c,l,f,h,a[d+0],6,-198630844),h=y(h,c,l,f,a[d+7],10,1126891415),f=y(f,h,c,l,a[d+14],15,-1416354905),l=y(l,f,h,c,a[d+5],21,-57434055),c=y(c,l,f,h,a[d+12],6,1700485571),h=y(h,c,l,f,a[d+3],10,-1894986606),f=y(f,h,c,l,a[d+10],15,-1051523),l=y(l,f,h,c,a[d+1],21,-2054922799),c=y(c,l,f,h,a[d+8],6,1873313359),h=y(h,c,l,f,a[d+15],10,-30611744),f=y(f,h,c,l,a[d+6],15,-1560198380),l=y(l,f,h,c,a[d+13],21,1309151649),c=y(c,l,f,h,a[d+4],6,-145523070),h=y(h,c,l,f,a[d+11],10,-1120210379),f=y(f,h,c,l,a[d+2],15,718787259),l=y(l,f,h,c,a[d+9],21,-343485551),c=c+g>>>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<<o|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<<o|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<<o|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<<o|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<<t|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;t<e.length;t++)e[t]=n.endian(e[t]);return e},randomBytes:function(e){for(var t=[];e>0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,r=0;n<e.length;n++,r+=8)t[r>>>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<e.length;n++)t.push((e[n]>>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e.substr(n,2),16));return t},bytesToBase64:function(e){for(var n=[],r=0;r<e.length;r+=3)for(var i=e[r]<<16|e[r+1]<<8|e[r+2],o=0;o<4;o++)8*r+6*o<=8*e.length?n.push(t.charAt(i>>>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<e.length;i=++r%4)0!=i&&n.push((t.indexOf(e.charAt(r-1))&Math.pow(2,-2*i+8)-1)<<2*i|t.indexOf(e.charAt(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 <https://feross.org>
* @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;i<n.length;i++)r[i]=n.charCodeAt(i);return new Blob([r],{type:t})};e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){return e&&e[t]?d.isFunction(e[t])?e[t]():e[t]:null}var o=n(98),s=r(o),a=n(12),u=r(a),c=n(175),l=r(c),f=n(2),h=r(f),d=n(0),p=n(20),v=n(7),m=v._request,y=n(9),g=y.isNullOrUndefined,_=y.ensureArray,b=y.transformFetchOptions,w=y.setValue,E=y.findValue,T=y.isPlainObject,S=y.continueWhile,O=function e(t){return d.isArray(t)?t.map(e):T(t)?d.mapObject(t,e):d.isObject(t)&&t._toPointer?t._toPointer():t},A=["objectId","createdAt","updatedAt"],I=function(e){if(-1!==A.indexOf(e))throw new Error("key["+e+"] is reserved")},x=function(e){var t=d.find(e,function(e){return e instanceof Error});if(!t)return e;var n=new p(t.code,t.message);throw n.results=e,n};e.exports=function(e){e.Object=function(t,n){if(d.isString(t))return e.Object._create.apply(this,arguments);t=t||{},n&&n.parse&&(t=this.parse(t),t=this._mergeMagicFields(t));var r=i(this,"defaults");r&&(t=d.extend({},r,t)),n&&n.collection&&(this.collection=n.collection),this._serverData={},this._opSetQueue=[{}],this._flags={},this.attributes={},this._hashedJSON={},this._escapedAttributes={},this.cid=d.uniqueId("c"),this.changed={},this._silent={},this._pending={},this.set(t,{silent:!0}),this.changed={},this._silent={},this._pending={},this._hasData=!0,this._previousAttributes=d.clone(this.attributes),this.initialize.apply(this,arguments)},e.Object.saveAll=function(t,n){return e.Object._deepSaveAsync(t,null,n)},e.Object.fetchAll=function(e,t){return h.default.resolve().then(function(){return m("batch",null,null,"POST",{requests:d.map(e,function(e){if(!e.className)throw new Error("object must have className to fetch");if(!e.id)throw new Error("object must have id to fetch");if(e.dirty())throw new Error("object is modified but not saved");return{method:"GET",path:"/1.1/classes/"+e.className+"/"+e.id}})},t)}).then(function(t){var n=d.map(e,function(e,n){if(t[n].success){var r=e.parse(t[n].success);return e._cleanupUnsetKeys(r),e._finishFetch(r),e}return null===t[n].success?new p(p.OBJECT_NOT_FOUND,"Object not found."):new p(t[n].error.code,t[n].error.error)});return x(n)})},d.extend(e.Object.prototype,e.Events,{_fetchWhenSave:!1,initialize:function(){},fetchWhenSave:function(e){if(console.warn("AV.Object#fetchWhenSave is deprecated, use AV.Object#save with options.fetchWhenSave instead."),!d.isBoolean(e))throw new Error("Expect boolean value for fetchWhenSave");this._fetchWhenSave=e},getObjectId:function(){return this.id},getCreatedAt:function(){return this.createdAt},getUpdatedAt:function(){return this.updatedAt},toJSON:function(e,t){var n=arguments.length>2&&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=d.clone(this.attributes);if(d.isArray(t))var o=t.concat(this);return e._objectEach(i,function(t,n){i[n]=e._encode(t,o,void 0,r)}),e._objectEach(this._operations,function(e,t){i[t]=e}),d.has(this,"id")&&(i.objectId=this.id),d(["createdAt","updatedAt"]).each(function(e){if(d.has(n,e)){var t=n[e];i[e]=d.isDate(t)?t.toJSON():t}}),r&&(i.__type="Object",d.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():d.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=d.last(this._opSetQueue);return e?!!t[e]:!this.id||d.keys(t).length>0},dirtyKeys:function(){this._refreshCache();var e=d.last(this._opSetQueue);return d.keys(e)},_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=g(r)?"":d.escape(r.toString()),this._escapedAttributes[e]=n,n},has:function(e){return!g(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||d.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=d.first(this._opSetQueue);this._opSetQueue=d.rest(this._opSetQueue);var n=d.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=d.first(this._opSetQueue);this._opSetQueue=d.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 o=this._opSetQueue.map(d.clone);this._refreshCache(),this._opSetQueue=o,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,i){var o=E(n,i),s=(0,l.default)(o,3),a=s[0],u=s[1],c=s[2];w(n,i,t._estimate(a,r,i)),u&&u[c]===e.Op._UNSET&&delete u[c]})},_resetCacheForKey:function(t){var n=this.attributes[t];if(d.isObject(n)&&!(n instanceof e.Object)&&!(n instanceof e.File)){var r=(0,u.default)(O(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 i=r[t];if(i){var o=E(n.attributes,t),s=(0,l.default)(o,4),a=s[0],u=s[1],c=s[2],f=s[3];w(n.attributes,t,i._estimate(a,n,t)),u&&u[c]===e.Op._UNSET&&delete u[c],n._resetCacheForKey(f)}})},_rebuildAllEstimatedData:function(){var t=this,n=d.clone(this.attributes);this.attributes=d.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){d.has(n,r)||t.trigger("change:"+r,t,e,{})})},set:function(t,n,r){var i;if(d.isObject(t)||g(t)?(i=d.mapObject(t,function(t,n){return I(n),e._decode(t,n)}),r=n):(i={},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 o=d.clone(i),s=this;e._objectEach(o,function(t,n){t instanceof e.Op&&(o[n]=t._estimate(s.attributes[n],s,n),o[n]===e.Op._UNSET&&delete o[n])}),this._validate(i,r),r.changes={};var a=this._escapedAttributes;return e._arrayEach(d.keys(i),function(t){var n=i[t];n instanceof e.Relation&&(n.parent=s),n instanceof e.Op||(n=new e.Op.Set(n));var o=!0;n instanceof e.Op.Set&&d.isEqual(s.attributes[t],n.value)&&(o=!1),o&&(delete a[t],r.silent?s._silent[t]=!0:r.changes[t]=!0);var u=d.last(s._opSetQueue);u[t]=n._mergeWithPrevious(u[t]),s._rebuildEstimatedDataForKey(t),o?(s.changed[t]=s.attributes[t],r.silent||(s._pending[t]=!0)):(delete s.changed[t],delete s._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(d.isUndefined(n)||d.isNull(n))&&(n=1),this.set(t,new e.Op.Increment(n))},add:function(t,n){return this.set(t,new e.Op.Add(_(n)))},addUnique:function(t,n){return this.set(t,new e.Op.AddUnique(_(n)))},remove:function(t,n){return this.set(t,new e.Op.Remove(_(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 d.last(this._opSetQueue)[e]},clear:function(e){e=e||{},e.unset=!0;var t=d.extend(this.attributes,this._operations);return this.set(t,e)},revert:function(e){var t=d.last(this._opSetQueue);return _(e||d.keys(t)).forEach(function(e){delete t[e]}),this._rebuildAllEstimatedData(),this},_getSaveJSON:function(){var t=d.clone(d.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 m("classes",this.className,this.id,"GET",b(e),t).then(function(t){var r=n.parse(t);return n._cleanupUnsetKeys(r,e.keys?_(e.keys).join(",").split(","):void 0),n._finishFetch(r,!0),n})},_cleanupUnsetKeys:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d.keys(this._serverData);d.forEach(n,function(n){void 0===e[n]&&delete t._serverData[n]})},save:function(t,n,r){var i,o,s;d.isObject(t)||g(t)?(i=t,s=n):(i={},i[t]=n,s=r),s=d.clone(s)||{},s.wait&&(o=d.clone(this.attributes));var a=d.clone(s)||{};a.wait&&(a.silent=!0),i&&this.set(i,a);var u=this,c=[],l=[];return e.Object._findUnsavedChildren(u,c,l),c.length+l.length>1?e.Object._deepSaveAsync(this,u,s):(this._startSave(),this._saving=(this._saving||0)+1,this._allPreviousSaves=this._allPreviousSaves||h.default.resolve(),this._allPreviousSaves=this._allPreviousSaves.catch(function(e){}).then(function(){var e=u.id?"PUT":"POST",t=u._getSaveJSON(),n={};if((u._fetchWhenSave||s.fetchWhenSave)&&(n.new="true"),s._failOnNotExist&&(n.failOnNotExist="true"),s.query){var r;if("function"==typeof s.query._getParams&&(r=s.query._getParams())&&(n.where=r.where),!n.where){throw new Error("options.query is not an AV.Query")}}d.extend(t,u._flags);var c="classes",l=u.className;"_User"!==u.className||u.id||(c="users",l=null);var f=s._makeRequest||m,h=f(c,l,u.id,e,t,s,n);return h=h.then(function(e){var t=u.parse(e);return s.wait&&(t=d.extend(i||{},t)),u._finishSave(t),s.wait&&u.set(o,a),u},function(e){throw u._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(),m("classes",this.className,this.id,"DELETE",this._flags,e).then(function(){return e.wait&&n(),t})):n()},parse:function(t){var n=d.clone(t);return d(["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=d.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 o=function(e,t){r._pending[t]||r._silent[t]||delete r.changed[t]};!d.isEmpty(this._pending);)this._pending={},this.trigger("change",this,t),e._objectEach(this.changed,o),r._previousAttributes=d.clone(this.attributes);return this._changing=!1,this},previous:function(e){return arguments.length&&this._previousAttributes?this._previousAttributes[e]:null},previousAttributes:function(){return d.clone(this._previousAttributes)},isValid:function(){try{this.validate(this.attributes)}catch(e){return!1}return!0},validate:function(t){if(d.has(t,"ACL")&&!(t.ACL instanceof e.ACL))throw new p(p.OTHER_CAUSE,"ACL must be a AV.ACL.")},_validate:function(e,t){!t.silent&&this.validate&&(e=d.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){if(!d.contains(["beforeSave","afterSave","beforeUpdate","afterUpdate","beforeDelete","afterDelete"],t))throw new Error("Unsupported hookName: "+t);if(!e.hookKey)throw new Error("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(d.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}if(!n)throw new TypeError("The objectId must be provided");var o=new i;return o.id=n,o._hasData=r,o},e.Object.destroyAll=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e||0===e.length)return h.default.resolve();var n=d.groupBy(e,function(e){return(0,u.default)({className:e.className,flags:e._flags})}),r={requests:d.map(n,function(e){var t=d.map(e,"id").join(",");return{method:"DELETE",path:"/1.1/classes/"+e[0].className+"/"+t,body:e[0]._flags}})};return m("batch",null,null,"POST",r,t).then(function(e){var t=d.find(e,function(e){return!e.success});if(t)throw new p(t.error.code,t.error.error)})},e.Object._getSubclass=function(t){if(!d.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(!d.isString(t)){if(t&&d.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(d.has(e.Object._classMap,t)){var o=e.Object._classMap[t];if(!n&&!r)return o;i=o._extend(n,r)}else n=n||{},n._className=t,i=this._extend(n,r);return i.extend=function(n){if(d.isString(n)||n&&d.has(n,"className"))return e.Object.extend.apply(i,arguments);var r=[t].concat(d.toArray(arguments));return e.Object.extend.apply(i,r)},Object.defineProperty(i,"query",(0,s.default)(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:d.isArray(t)?e._arrayEach(t,function(t){e.Object._canBeSerializedAsValue(t)||(n=!1)}):d.isObject(t)&&e._objectEach(t,function(t){e.Object._canBeSerializedAsValue(t)||(n=!1)}),n},e.Object._deepSaveAsync=function(t,n,r){var i=[],o=[];e.Object._findUnsavedChildren(t,i,o);var s=h.default.resolve();d.each(o,function(e){s=s.then(function(){return e.save()})});var a=d.uniq(i),u=d.uniq(a);return s.then(function(){return S(function(){return u.length>0},function(){var t=[],n=[];if(e._arrayEach(u,function(e){e._canBeSerialized()?t.push(e):n.push(e)}),u=n,0===t.length)return h.default.reject(new p(p.OTHER_CAUSE,"Tried to save a batch with a cycle."));var i=h.default.resolve(d.map(t,function(e){return e._allPreviousSaves||h.default.resolve()})),o=i.then(function(){return m("batch",null,null,"POST",{requests:d.map(t,function(e){var t=e.id?"PUT":"POST",n=e._getSaveJSON();d.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=d.map(t,function(t,n){return e[n].success?(t._finishSave(t.parse(e[n].success)),t):(t._cancelSave(),new p(e[n].error.code,e[n].error.error))});return x(n)})});return e._arrayEach(t,function(e){e._allPreviousSaves=o}),o})}).then(function(){return t})}}},function(e,t,n){n(174);var r=n(1).Object;e.exports=function(e,t){return r.getOwnPropertyDescriptor(e,t)}},function(e,t,n){var r=n(16),i=n(71).f;n(45)("getOwnPropertyDescriptor",function(){return function(e,t){return i(r(e),t)}})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var i=n(72),o=r(i),s=n(178),a=r(s);t.default=function(){function e(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var s,u=(0,a.default)(e);!(r=(s=u.next()).done)&&(n.push(s.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{!r&&u.return&&u.return()}finally{if(i)throw o}}return n}return function(t,n){if(Array.isArray(t))return t;if((0,o.default)(Object(t)))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}()},function(e,t,n){n(24),n(22),e.exports=n(177)},function(e,t,n){var r=n(41),i=n(5)("iterator"),o=n(23);e.exports=n(1).isIterable=function(e){var t=Object(e);return void 0!==t[i]||"@@iterator"in t||o.hasOwnProperty(r(t))}},function(e,t,n){e.exports={default:n(179),__esModule:!0}},function(e,t,n){n(24),n(22),e.exports=n(180)},function(e,t,n){var r=n(11),i=n(62);e.exports=n(1).getIterator=function(e){var t=i(e);if("function"!=typeof t)throw TypeError(e+" is not iterable!");return r(t.call(e))}},function(e,t,n){"use strict";var r=n(0),i=n(20);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){return e&&e.__esModule?e:{default:e}}var i=n(12),o=r(i),s=n(183),a=r(s),u=n(2),c=r(u),l=n(0),f=n(89),h=n(20),d=n(7),p=d._request,v=d.request,m=n(27),y=m.getAdapter,g=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"weixin";return function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r.unionIdPlatform,o=void 0===i?e:i,s=r.asMainAccount,a=void 0!==s&&s;if("string"!=typeof n)throw new h(h.OTHER_CAUSE,"unionId is not a string");if("string"!=typeof o)throw new h(h.OTHER_CAUSE,"unionIdPlatform is not a string");return l.extend({},t,{platform:o,unionid:n,main_account:Boolean(a)})}};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;l.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?c.default.resolve():c.default.resolve(e.User._saveCurrentUser(this))},_linkWith:function(t,n){var r,i=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=o.failOnNotExist,u=void 0!==s&&s;return l.isString(t)?(r=t,t=e.User._authProviders[t]):r=t.getAuthType(),n?this.save({authData:(0,a.default)({},r,n)},{fetchWhenSave:!!this.get("authData"),_failOnNotExist:u}).then(function(e){return e._handleSaveResult(!0).then(function(){return e})}):t.authenticate().then(function(e){return i._linkWith(t,e)})},associateWithAuthData:function(e,t){return this._linkWith(t,e)},associateWithAuthDataAndUnionId:function(e,t,n,r){return this._linkWith(t,g()(e,n,r))},associateWithMiniApp:function(e,t){var n=this;if(void 0===e){return y("getAuthInfo")().then(function(e){return n._linkWith(e.provider,e.authData,t)})}return this._linkWith(e.provider,e.authData,t)},associateWithQQApp:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.preferUnionId,r=void 0!==n&&n,i=t.unionIdPlatform,o=void 0===i?"qq":i,s=t.asMainAccount,a=void 0===s||s;return y("getAuthInfo")({preferUnionId:r,asMainAccount:a,platform:o}).then(function(t){return t.provider="lc_qqapp",e.associateWithMiniApp(t)})},associateWithWeapp:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.preferUnionId,r=void 0!==n&&n,i=t.unionIdPlatform,o=void 0===i?"weixin":i,s=t.asMainAccount,a=void 0===s||s;return y("getAuthInfo")({preferUnionId:r,asMainAccount:a,platform:o}).then(function(t){return e.associateWithMiniApp(t)})},linkWithWeapp:function(e){return console.warn("DEPRECATED: User#linkWithWeapp 已废弃,请使用 User#associateWithWeapp 代替"),this.associateWithWeapp(e)},associateWithQQAppWithUnionId:function(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.unionIdPlatform,o=void 0===i?"qq":i,s=r.asMainAccount,a=void 0!==s&&s;return y("getAuthInfo")({platform:o}).then(function(r){return r=e.User.mergeUnionId(r,t,{asMainAccount:a}),r.provider="lc_qqapp",n.associateWithMiniApp(r)})},associateWithWeappWithUnionId:function(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.unionIdPlatform,o=void 0===i?"weixin":i,s=r.asMainAccount,a=void 0!==s&&s;return y("getAuthInfo")({platform:o}).then(function(r){return r=e.User.mergeUnionId(r,t,{asMainAccount:a}),n.associateWithMiniApp(r)})},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=l.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()&&(l.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 h(h.OTHER_CAUSE,"Cannot sign up user with an empty name.");var r=e&&e.password||this.get("password");if(!r||""===r)throw new h(h.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 h(h.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 h(h.OTHER_CAUSE,"Cannot sign up or login user by mobilePhoneNumber with an empty smsCode.");return t._makeRequest=function(e,t,n,r,i){return p("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(g()(e,n,r),t,r)},loginWithWeapp:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.preferUnionId,r=void 0!==n&&n,i=t.unionIdPlatform,o=void 0===i?"weixin":i,s=t.asMainAccount,a=void 0===s||s,u=t.failOnNotExist,c=void 0!==u&&u;return y("getAuthInfo")({preferUnionId:r,asMainAccount:a,platform:o}).then(function(t){return e.loginWithMiniApp(t,{failOnNotExist:c})})},loginWithWeappWithUnionId:function(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.unionIdPlatform,o=void 0===i?"weixin":i,s=r.asMainAccount,a=void 0!==s&&s,u=r.failOnNotExist,c=void 0!==u&&u;return y("getAuthInfo")({platform:o}).then(function(r){return r=e.User.mergeUnionId(r,t,{asMainAccount:a}),n.loginWithMiniApp(r,{failOnNotExist:c})})},loginWithQQApp:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.preferUnionId,r=void 0!==n&&n,i=t.unionIdPlatform,o=void 0===i?"qq":i,s=t.asMainAccount,a=void 0===s||s,u=t.failOnNotExist,c=void 0!==u&&u;return y("getAuthInfo")({preferUnionId:r,asMainAccount:a,platform:o}).then(function(t){return t.provider="lc_qqapp",e.loginWithMiniApp(t,{failOnNotExist:c})})},loginWithQQAppWithUnionId:function(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.unionIdPlatform,o=void 0===i?"qq":i,s=r.asMainAccount,a=void 0!==s&&s,u=r.failOnNotExist,c=void 0!==u&&u;return y("getAuthInfo")({platform:o}).then(function(r){return r=e.User.mergeUnionId(r,t,{asMainAccount:a}),r.provider="lc_qqapp",n.loginWithMiniApp(r,{failOnNotExist:c})})},loginWithMiniApp:function(e,t){var n=this;if(void 0===e){return y("getAuthInfo")().then(function(e){return n.loginWithAuthData(e.authData,e.provider,t)})}return this.loginWithAuthData(e.authData,e.provider,t)},logIn:function(){var e=this;return p("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 i,o;return l.isObject(t)||l.isNull(t)||l.isUndefined(t)?(i=t,o=n):(i={},i[t]=n,o=r),o=o||{},e.Object.prototype.save.call(this,i,o).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,i=void 0;t.user?(r=t.user,i=t.attributes):r=t;var o=l.isString(r)?r:r.id;if(!o)throw new Error("Invalid target user.");var s="users/"+this.id+"/friendship/"+o;return p(s,null,null,"POST",e._encode(i),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=l.isString(n)?n:n.id;if(!r)throw new Error("Invalid target user.");var i="users/"+this.id+"/friendship/"+r;return p(i,null,null,"DELETE",null,t)},getFollowersAndFollowees:function(t,n){if(!this.id)throw new Error("Please signin.");return v({method:"GET",path:"/users/"+this.id+"/followersAndFollowees",query:{skip:t&&t.skip,limit:t&&t.limit,include:"follower,followee",keys:"follower,followee"},authOptions:n}).then(function(t){var n=t.followers,r=t.followees;return{followers:n.map(function(t){var n=t.follower;return e._decode(n)}),followees:r.map(function(t){var n=t.followee;return e._decode(n)})}})},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=this,i="users/"+this.id+"/updatePassword";return p(i,null,null,"PUT",{old_password:e,new_password:t},n).then(function(e){return r._finishFetch(r.parse(e)),r._handleSaveResult(!0).then(function(){return e})})},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 c.default.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 p("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){if(void 0===t)return c.default.reject(new Error("The sessionToken cannot be undefined"));var n=e.Object._create("_User");return v({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(g()(e,n,r),t,r)},signUpOrlogInWithAuthDataAndUnionId:function(){return console.warn("DEPRECATED: User.signUpOrlogInWithAuthDataAndUnionId 已废弃,请使用 User#loginWithAuthDataAndUnionId 代替"),this.loginWithAuthDataAndUnionId.apply(this,arguments)},mergeUnionId:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.asMainAccount,i=void 0!==r&&r;e=JSON.parse((0,o.default)(e));var s=e,a=s.authData,u=s.platform;return a.platform=u,a.main_account=i,a.unionid=t,e},loginWithWeapp:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.preferUnionId,r=void 0!==n&&n,i=t.unionIdPlatform,o=void 0===i?"weixin":i,s=t.asMainAccount,a=void 0===s||s,u=t.failOnNotExist,c=void 0!==u&&u;return y("getAuthInfo")({preferUnionId:r,asMainAccount:a,platform:o}).then(function(t){return e.loginWithMiniApp(t,{failOnNotExist:c})})},loginWithWeappWithUnionId:function(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.unionIdPlatform,o=void 0===i?"weixin":i,s=r.asMainAccount,a=void 0!==s&&s,u=r.failOnNotExist,c=void 0!==u&&u;return y("getAuthInfo")({platform:o}).then(function(r){return r=e.User.mergeUnionId(r,t,{asMainAccount:a}),n.loginWithMiniApp(r,{failOnNotExist:c})})},loginWithQQApp:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.preferUnionId,r=void 0!==n&&n,i=t.unionIdPlatform,o=void 0===i?"qq":i,s=t.asMainAccount,a=void 0===s||s,u=t.failOnNotExist,c=void 0!==u&&u;return y("getAuthInfo")({preferUnionId:r,asMainAccount:a,platform:o}).then(function(t){return t.provider="lc_qqapp",e.loginWithMiniApp(t,{failOnNotExist:c})})},loginWithQQAppWithUnionId:function(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.unionIdPlatform,o=void 0===i?"qq":i,s=r.asMainAccount,a=void 0!==s&&s,u=r.failOnNotExist,c=void 0!==u&&u;return y("getAuthInfo")({platform:o}).then(function(r){return r=e.User.mergeUnionId(r,t,{asMainAccount:a}),r.provider="lc_qqapp",n.loginWithMiniApp(r,{failOnNotExist:c})})},loginWithMiniApp:function(e,t){var n=this;if(void 0===e){return y("getAuthInfo")().then(function(e){return n.loginWithAuthData(e.authData,e.provider,t)})}return this.loginWithAuthData(e.authData,e.provider,t)},_genId:function(){return f()},loginAnonymously:function(){return this.loginWithAuthData({id:e.User._genId()},"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"),c.default.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||!l.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||!l.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 p("requestPasswordReset",null,null,"POST",{email:e})},requestEmailVerify:function(e){return p("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),p("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),p("requestPasswordResetBySmsCode",null,null,"POST",n,t)},requestChangePhoneNumber:function(e,t,n){var r={mobilePhoneNumber:e};return t&&(r.ttl=n.ttl),n&&n.validateToken&&(r.validate_token=n.validateToken),p("requestChangePhoneNumber",null,null,"POST",r,n)},changePhoneNumber:function(e,t){return p("changePhoneNumber",null,null,"POST",{mobilePhoneNumber:e,code:t})},resetPasswordBySmsCode:function(e,t){return p("resetPasswordBySmsCode",null,e,"PUT",{password:t})},verifyMobilePhone:function(e){return p("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),p("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"),c.default.resolve(null)):e.User._currentUser?c.default.resolve(e.User._currentUser):e.User._currentUserMatchesDisk?c.default.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.localStorage.async){var t=new Error("Synchronous API User.current() is not available in this runtime. Use User.currentAsync() instead.");throw t.code="SYNC_API_NOT_AVAILABLE",t}if(e.User._currentUser)return e.User._currentUser;if(e.User._currentUserMatchesDisk)return e.User._currentUser;e.User._currentUserMatchesDisk=!0;var n=e.localStorage.getItem(e._getAVPath(e.User._CURRENT_USER_KEY));if(!n)return null;e.User._currentUser=e.Object._create("_User"),e.User._currentUser._isCurrentUser=!0;var r=JSON.parse(n);return e.User._currentUser.id=r._id,delete r._id,e.User._currentUser._sessionToken=r._sessionToken,delete r._sessionToken,e.User._currentUser._finishFetch(r),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():c.default.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),(0,o.default)(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";t.__esModule=!0;var r=n(66),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=function(e,t,n){return t in e?(0,i.default)(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(12),o=r(i),s=n(2),a=r(s),u=n(0),c=n(19)("leancloud:query"),l=n(20),f=n(7),h=f._request,d=f.request,p=n(9),v=p.ensureArray,m=p.transformFetchOptions,y=p.continueWhile,g=function(e,t){if(void 0===e)throw new Error(t)};e.exports=function(e){e.Query=function(t){u.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._defaultParams={}},e.Query.or=function(){var t=u.toArray(arguments),n=null;e._arrayEach(t,function(e){if(u.isNull(n)&&(n=e.className),n!==e.className)throw new Error("All queries must be for the same class")});var r=new e.Query(n);return r._orQuery(t),r},e.Query.and=function(){var t=u.toArray(arguments),n=null;e._arrayEach(t,function(e){if(u.isNull(n)&&(n=e.className),n!==e.className)throw new Error("All queries must be for the same class")});var r=new e.Query(n);return r._andQuery(t),r},e.Query.doCloudQuery=function(t,n,r){var i={cql:t};return u.isArray(n)?i.pvalues=n:r=n,h("cloudQuery",null,null,"GET",i,r).then(function(t){var n=new e.Query(t.className);return{results:u.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.fromJSON=function(t){var n=t.className,r=t.where,i=t.include,o=t.select,s=t.includeACL,a=t.limit,c=t.skip,l=t.order;if("string"!=typeof n)throw new TypeError("Invalid Query JSON, className must be a String.");var f=new e.Query(n);return u.extend(f,{_where:r,_include:i,_select:o,_includeACL:s,_limit:a,_skip:c,_order:l}),f},e.Query._extend=e._extend,u.extend(e.Query.prototype,{_processResult:function(e){return e},get:function(e,t){if(!u.isString(e))throw new Error("objectId must be a string");if(""===e)return a.default.reject(new l(l.OBJECT_NOT_FOUND,"Object not found."));var n=this._newObject();n.id=e;var r=this._getParams(),i={};return r.keys&&(i.keys=r.keys),r.include&&(i.include=r.include),r.includeACL&&(i.includeACL=r.includeACL),h("classes",this.className,e,"GET",m(i),t).then(function(e){if(u.isEmpty(e))throw new l(l.OBJECT_NOT_FOUND,"Object not found.");return n._finishFetch(n.parse(e),!0),n})},toJSON:function(){return{className:this.className,where:this._where,include:this._include,select:this._select,includeACL:this._includeACL,limit:this._limit,skip:this._skip,order:this._order}},_getParams:function(){var e=u.extend({},this._defaultParams,{where:this._where});return this._include.length>0&&(e.include=this._include.join(",")),this._select.length>0&&(e.keys=this._select.join(",")),void 0!==this._includeACL&&(e.returnACL=this._includeACL),this._limit>=0&&(e.limit=this._limit),this._skip>0&&(e.skip=this._skip),void 0!==this._order&&(e.order=this._order),e},_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._getParams(),t=arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"/classes/"+this.className;if(encodeURIComponent((0,o.default)(e)).length>2e3){return d({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 d({method:"GET",path:n,query:e,authOptions:t})},_parseResponse:function(e){var t=this;return u.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,r=t.batchSize,i=arguments[1],o=this._getParams();c("scan %O",o),o.order&&(console.warn("The order of the query is ignored for Query#scan. Checkout the orderedBy option of Query#scan."),delete o.order),o.skip&&(console.warn("The skip option of the query is ignored for Query#scan."),delete o.skip),o.limit&&(console.warn("The limit option of the query is ignored for Query#scan."),delete o.limit),n&&(o.scan_key=n),r&&(o.limit=r);var s=a.default.resolve([]),l=void 0,f=!1;return{next:function(){return s=s.then(function(t){return f?[]:t.length>1?t:l||0===t.length?h("scan/classes",e.className,null,"GET",l?u.extend({},o,{cursor:l}):o,i).then(function(t){return l=t.cursor,e._parseResponse(t)}).then(function(e){return e.length||(f=!0),t.concat(e)}):(f=!0,t)}),s.then(function(e){return e.shift()}).then(function(e){return{value:e,done:f}})}}},destroyAll:function(t){return this.find(t).then(function(n){return e.Object.destroyAll(n,t)})},count:function(e){var t=this._getParams();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._getParams();return n.limit=1,this._createRequest(n,e).then(function(e){return u.map(e.results,function(e){var n=t._newObject();return n._finishFetch&&n._finishFetch(t._processResult(e),!0),n})[0]})},skip:function(e){return g(e,"undefined is not a valid skip value"),this._skip=e,this},limit:function(e){return g(e,"undefined is not a valid limit value"),this._limit=e,this},equalTo:function(t,n){return g(t,"undefined is not a valid key"),g(n,"undefined is not a valid value"),this._where[t]=e._encode(n),this},_addCondition:function(t,n,r){return g(t,"undefined is not a valid condition key"),g(n,"undefined is not a valid condition"),g(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._getParams();return n.className=t.className,this._addCondition(e,"$inQuery",n),this},doesNotMatchQuery:function(e,t){var n=t._getParams();return n.className=t.className,this._addCondition(e,"$notInQuery",n),this},matchesKeyInQuery:function(e,t,n){var r=n._getParams();return r.className=n.className,this._addCondition(e,"$select",{key:t,query:r}),this},doesNotMatchKeyInQuery:function(e,t,n){var r=n._getParams();return r.className=n.className,this._addCondition(e,"$dontSelect",{key:t,query:r}),this},_orQuery:function(e){var t=u.map(e,function(e){return e._getParams().where});return this._where.$or=t,this},_andQuery:function(e){var t=u.map(e,function(e){return e._getParams().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 g(e,"undefined is not a valid key"),this._order=e,this},addAscending:function(e){return g(e,"undefined is not a valid key"),this._order?this._order+=","+e:this._order=e,this},descending:function(e){return g(e,"undefined is not a valid key"),this._order="-"+e,this},addDescending:function(e){return g(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 g(e,"undefined is not a valid key"),u.forEach(arguments,function(e){t._include=t._include.concat(v(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 g(e,"undefined is not a valid key"),u.forEach(arguments,function(e){t._select=t._select.concat(v(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 r=new Error("Cannot iterate on a query with sort, skip, or limit.");return a.default.reject(r)}var i=new e.Query(this.objectClass);i._limit=n.batchSize||100,i._where=u.clone(this._where),i._include=u.clone(this._include),i.ascending("objectId");var o=!1;return y(function(){return!o},function(){return i.find(n).then(function(e){var n=a.default.resolve();return u.each(e,function(e){n=n.then(function(){return t(e)})}),n.then(function(){e.length>=i._limit?i.greaterThan("objectId",e[e.length-1].id):o=!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(2),i=function(e){return e&&e.__esModule?e:{default:e}}(r),o=n(0),s=n(91),a=n(9),u=a.inherits,c=n(7),l=c.request,f=function(e,t){return l({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=u(s,{constructor:function(e,t,n,r){var i=this;s.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(){f(i._queryJSON,i._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 r=t.op,i=t.object,s=t.query_id,a=t.updatedKeys;if(s===n.id){var u=e.parseJSON(o.extend({__type:"_File"===i.className?"File":"Object"},i));a?n.emit(r,u,a):n.emit(r,u)}})},unsubscribe:function(){var e=this._client;return e.off("message",this._onMessage),e.off("reconnect",this._onReconnect),e.deregister(this),l({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]:{},o=r.subscriptionId,s=void 0===o?e._getSubscriptionId():o;if(t(),!(n instanceof e.Query))throw new TypeError("LiveQuery must be inited with a Query");return i.default.resolve(s).then(function(t){return e._config.realtime.createLiveQueryClient(t).then(function(r){var i=n._getParams(),o=i.where,s=i.keys,a=i.returnACL,u={where:o,keys:s,returnACL:a,className:n.className},c=f(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";var r=n(0),i=n(9),o=i.tap;e.exports=function(e){e.Captcha=function(e,t){this._options=e,this._authOptions=t,this.url=void 0,this.captchaToken=void 0,this.validateToken=void 0},e.Captcha.prototype.refresh=function(){var t=this;return e.Cloud._requestCaptcha(this._options,this._authOptions).then(function(e){var n=e.captchaToken,i=e.url;return r.extend(t,{captchaToken:n,url:i}),i})},e.Captcha.prototype.verify=function(t){var n=this;return e.Cloud.verifyCaptcha(t,this.captchaToken).then(o(function(e){return n.validateToken=e}))},e.Captcha.prototype.bind=function(e,t){var n=this,r=e.textInput,i=e.image,o=e.verifyButton,s=t.success,a=t.error;if("string"==typeof r&&!(r=document.getElementById(r)))throw new Error("textInput with id "+r+" not found");if("string"==typeof i&&!(i=document.getElementById(i)))throw new Error("image with id "+i+" not found");if("string"==typeof o&&!(o=document.getElementById(o)))throw new Error("verifyButton with id "+o+" not found");this.__refresh=function(){return n.refresh().then(function(e){i.src=e,r&&(r.value="",r.focus())}).catch(function(e){return console.warn("refresh captcha fail: "+e.message)})},i&&(this.__image=i,i.src=this.url,i.addEventListener("click",this.__refresh)),this.__verify=function(){var e=r.value;n.verify(e).catch(function(e){throw n.__refresh(),e}).then(s,a).catch(function(e){return console.warn("verify captcha fail: "+e.message)})},r&&o&&(this.__verifyButton=o,o.addEventListener("click",this.__verify))},e.Captcha.prototype.unbind=function(){this.__image&&this.__image.removeEventListener("click",this.__refresh),this.__verifyButton&&this.__verifyButton.removeEventListener("click",this.__verify)},e.Captcha.request=function(t,n){var r=new e.Captcha(t,n);return r.refresh().then(function(){return r})}}},function(e,t,n){"use strict";var r=n(2),i=function(e){return e&&e.__esModule?e:{default:e}}(r),o=n(0),s=n(7),a=s._request,u=s.request;e.exports=function(e){e.Cloud=e.Cloud||{},o.extend(e.Cloud,{run:function(t,n,r){return u({service:"engine",method:"POST",path:"/functions/"+t,data:e._encode(n,null,!0),authOptions:r}).then(function(t){return e._decode(t).result})},rpc:function(t,n,r){return o.isArray(n)?i.default.reject(new Error("Can't pass Array as the param of rpc function in JavaScript SDK.")):u({service:"engine",method:"POST",path:"/call/"+t,data:e._encodeObjectOrArray(n),authOptions:r}).then(function(t){return e._decode(t).result})},getServerDate:function(){return a("date",null,null,"GET").then(function(t){return e._decode(t)})},requestSmsCode:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(o.isString(e)&&(e={mobilePhoneNumber:e}),!e.mobilePhoneNumber)throw new Error("Missing mobilePhoneNumber.");return t.validateToken&&(e=o.extend({},e,{validate_token:t.validateToken})),a("requestSmsCode",null,null,"POST",e,t)},verifySmsCode:function(e,t){if(!e)throw new Error("Missing sms code.");var n={};return o.isString(t)&&(n.mobilePhoneNumber=t),a("verifySmsCode",e,null,"POST",n)},_requestCaptcha:function(e,t){return a("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 a("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(7).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._getParams().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_interval)throw new Error("Both expiration_time and expiration_interval can't be set");return r({service:"push",method:"POST",path:"/push",data:e,authOptions:t})}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(2),o=r(i),s=n(21),a=r(s),u=n(0),c=n(7)._request,l=n(9),f=l.getSessionToken;e.exports=function(e){var t=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return f(t)?e.User._fetchUserBySessionToken(f(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":(0,a.default)(e))?this.data=e:(e&&(this.data.image=e),t&&(this.data.message=t)),this},u.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?c("statuses",null,this.id,"DELETE",e):o.default.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=u.clone(this.data);return e._encode(t)},send:function(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!f(r)&&!e.User.current())throw new Error("Please signin an user.");return this.query?n(r).then(function(e){var n=t.query._getParams();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",c("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(!f(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",c("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 i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!f(i)&&!e.User.current())throw new Error("Please signin an user.");if(!r)throw new Error("Invalid target user.");var o=u.isString(r)?r:r.id;if(!o)throw new Error("Invalid target user.");return n(i).then(function(n){var r={};r.className="_User",r.where={objectId:o};var s={};return s.query=r,t.data=t.data||{},t.data.source=t.data.source||n,s.data=t._getDataJSON(),s.inboxType="private",t.inboxType="private",c("statuses",null,null,"POST",s,i).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",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(u.isString(r)||(i=r),!f(i)&&null==n&&!e.User.current())throw new Error("Please signin an user or pass the owner objectId.");return o.default.resolve(n||t(i)).then(function(t){var n={};return n.inboxType=e._encode(r),n.owner=e._encode(t),c("subscribe/statuses/count",null,null,"GET",n,i)})},e.Status.resetUnreadCount=function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(u.isString(r)||(i=r),!f(i)&&null==n&&!e.User.current())throw new Error("Please signin an user or pass the owner objectId.");return o.default.resolve(n||t(i)).then(function(t){var n={};return n.inboxType=e._encode(r),n.owner=e._encode(t),c("subscribe/statuses/resetUnreadCount",null,null,"POST",n,i)})},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},_getParams:function(){var t=e.InboxQuery.__super__._getParams.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(12),i=function(e){return e&&e.__esModule?e:{default:e}}(r),o=n(0),s=n(7)._request;e.exports=function(e){e.SearchSortBuilder=function(){this._sortFields=[]},o.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(0,i.default)(e._encode(this._sortFields))}}),e.SearchQuery=e.Query._extend({_sid:null,_hits:0,_queryString:null,_highlights:null,_sortBuilder:null,_clazz:null,constructor:function(t){t?this._clazz=t:t="__INVALID_CLASS",e.Query.call(this,t)},_createRequest:function(e,t){return s("search/select",null,null,"GET",e||this._getParams(),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&&o.isString(e)?o.toArray(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(e){var t=this;return this._createRequest(void 0,e).then(function(e){return e.sid?(t._oldSid=t._sid,t._sid=e.sid):(t._sid=null,t._hitEnd=!0),t._hits=e.hits||0,o.map(e.results,function(n){n.className&&(e.className=n.className);var r=t._newObject(e);return r.appURL=n._app_url,r._finishFetch(t._processResult(n),!0),r})})},_getParams:function(){var t=e.SearchQuery.__super__._getParams.call(this);if(delete t.where,this._clazz&&(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(2),i=function(e){return e&&e.__esModule?e:{default:e}}(r),o=n(0),s=n(20),a=n(7),u=a.request;e.exports=function(e){e.Insight=e.Insight||{},o.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 u({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},o.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 u({path:"/bigquery/jobs/"+this.id,method:"GET",query:t,authOptions:e,signKey:!1}).then(function(e){return e.error?i.default.reject(new s(e.code,e.error)):i.default.resolve(e)})}})}},function(e,t,n){"use strict";var r=n(0),i=n(7),o=i.request,s=n(9),a=s.getSessionToken;e.exports=function(e){e.Friendship={request:function(t,n){if(!e.User.current())throw new Error("Please signin an user.");var i=void 0,s=void 0;t.friend?(i=t.friend,s=t.attributes):i=t;var a=r.isString(i)?e.Object.createWithoutData("_User",i):i;return o({method:"POST",path:"/users/friendshipRequests",data:e._encode({user:e.User.current(),friend:a,friendship:s}),authOptions:n})},acceptRequest:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!a(n)&&!e.User.current())throw new Error("Please signin an user.");var i=void 0,s=void 0;t.request?(i=t.request,s=t.attributes):i=t;var u=r.isString(i)?i:i.id;return o({method:"PUT",path:"/users/friendshipRequests/"+u+"/accept",data:{friendship:e._encode(s)},authOptions:n})},declineRequest:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!a(n)&&!e.User.current())throw new Error("Please signin an user.");var i=r.isString(t)?t:t.id;return o({method:"PUT",path:"/users/friendshipRequests/"+i+"/decline",authOptions:n})}}}},function(e,t,n){"use strict";var r=n(12),i=function(e){return e&&e.__esModule?e:{default:e}}(r),o=n(0),s=n(7),a=s._request,u=n(26),c=function(e){return"string"==typeof e?e:"function"==typeof e.getPayload?(0,i.default)(e.getPayload()):(0,i.default)(e)};e.exports=u.Object.extend("_Conversation",{constructor:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};u.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:c(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),a("rtm","messages",null,"POST",i,r)},broadcast: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,message:c(t)};if(void 0!==n.pushData&&(i.push=n.pushData),void 0!==n.validTill){var s=n.validTill;o.isDate(s)&&(s=s.getTime()),n.valid_till=s}return a("rtm","broadcast",null,"POST",i,r)}})},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(2),o=function(e){return e&&e.__esModule?e:{default:e}}(i),s=n(0),a=n(7),u=a.request,c=n(9),l=c.ensureArray,f=c.parseDate,h=n(26);h.LeaderboardVersionChangeInterval={NEVER:"never",DAY:"day",WEEK:"week",MONTH:"month"},h.LeaderboardOrder={ASCENDING:"ascending",DESCENDING:"descending"},h.LeaderboardUpdateStrategy={BETTER:"better",LAST:"last",SUM:"sum"};var d=function(e){var t=h._decode(e);return new r({name:t.statisticName,value:t.statisticValue,version:t.version})};h.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 p=h.Leaderboard;h.Leaderboard.createWithoutData=function(e){return new p(e)},h.Leaderboard.createLeaderboard=function(e,t){var n=e.statisticName,r=e.order,i=e.versionChangeInterval,o=e.updateStrategy;return u({method:"POST",path:"/leaderboard/leaderboards",data:{statisticName:n,order:r,versionChangeInterval:i,updateStrategy:o},authOptions:t}).then(function(e){return new p(n)._finishFetch(e)})},h.Leaderboard.getLeaderboard=function(e,t){return p.createWithoutData(e).fetch(t)},h.Leaderboard.getStatistics=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.statisticNames,r=arguments[2];return o.default.resolve().then(function(){if(!e||!e.id)throw new Error("user must be an AV.User");return u({method:"GET",path:"/leaderboard/users/"+e.id+"/statistics",query:{statistics:n?l(n).join(","):void 0},authOptions:r}).then(function(e){return e.results.map(d)})})},h.Leaderboard.updateStatistics=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return o.default.resolve().then(function(){if(!e||!e.id)throw new Error("user must be an AV.User");var r=s.map(t,function(e,t){return{statisticName:t,statisticValue:e}}),i=n.overwrite;return u({method:"POST",path:"/leaderboard/users/"+e.id+"/statistics",query:{overwrite:i?1:void 0},data:r,authOptions:n}).then(function(e){return e.results.map(d)})})},h.Leaderboard.deleteStatistics=function(e,t,n){return o.default.resolve().then(function(){if(!e||!e.id)throw new Error("user must be an AV.User");return u({method:"DELETE",path:"/leaderboard/users/"+e.id+"/statistics",query:{statistics:l(t).join(",")},authOptions:n}).then(function(){})})},s.extend(p.prototype,{_finishFetch:function(e){var t=this;return s.forEach(e,function(e,n){"updatedAt"!==n&&"objectId"!==n&&("expiredAt"===n&&(n="nextResetAt"),"createdAt"===n&&(e=f(e)),e&&"Date"===e.__type&&(e=f(e.iso)),t[n]=e)}),this},fetch:function(e){var t=this;return u({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 u({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,a=e.includeUserKeys,c=e.includeStatistics,f=e.version;return u({method:"GET",path:"/leaderboard/leaderboards/"+this.statisticName+"/ranks"+(n?"/"+n:""),query:{skip:r,limit:i,selectUserKeys:s.union(l(o),l(a)).join(",")||void 0,includeUser:a?l(a).join(","):void 0,includeStatistics:c?l(c).join(","):void 0,version:f},authOptions:t}).then(function(e){return e.results.map(function(e){var t=h._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(d)}})})},getResults:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.skip,n=e.limit,r=e.selectUserKeys,i=e.includeUserKeys,o=e.includeStatistics,s=e.version,a=arguments[1];return this._getResults({skip:t,limit:n,selectUserKeys:r,includeUserKeys:i,includeStatistics:o,version:s},a)},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.includeUserKeys,s=t.includeStatistics,a=t.version;return this._getResults({limit:r,selectUserKeys:i,includeUserKeys:o,includeStatistics:s,version:a},n,e?e.id:"self")},_update:function(e,t){var n=this;return u({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 u({method:"PUT",path:"/leaderboard/leaderboards/"+this.statisticName+"/incrementVersion",authOptions:e}).then(function(e){return t._finishFetch(e)})},destroy:function(e){return h.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 u({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:f(o.iso),deactivatedAt:f(s.iso)}})})}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(196);Object.defineProperty(t,"request",{enumerable:!0,get:function(){return r.request}}),Object.defineProperty(t,"upload",{enumerable:!0,get:function(){return r.upload}});var i=window.localStorage,o=window.WebSocket,s={name:"Browser"};t.WebSocket=o,t.platformInfo=s,t.storage=i},function(e,t,n){"use strict";function r(e){return{ok:e.ok,status:e.status,headers:e.header,data:e.body}}Object.defineProperty(t,"__esModule",{value:!0}),t.upload=t.request=void 0;var i=n(197),o=n(198);t.request=function(e,t){void 0===t&&(t={});var n=t.method,s=void 0===n?"GET":n,a=t.data,u=t.headers,c=t.onprogress,l=t.signal;if(null===l||void 0===l?void 0:l.aborted)return Promise.reject(new i.AbortError("Request aborted"));var f=o(s,e);return u&&f.set(u),c&&f.on("progress",c),new Promise(function(e,t){var n=function(){t(new i.AbortError("Request aborted")),f.abort()};null===l||void 0===l||l.addEventListener("abort",n),f.send(a).then(function(t){return e(r(t))}).catch(function(n){n.response?e(r(n.response)):t(n)}).finally(function(){return null===l||void 0===l?void 0:l.removeEventListener("abort",n)})})},t.upload=function(e,t,n){void 0===n&&(n={});var s=n.method,a=void 0===s?"POST":s,u=n.data,c=n.headers,l=n.onprogress,f=n.signal;if(null===f||void 0===f?void 0:f.aborted)return Promise.reject(new i.AbortError("Request aborted"));var h=o(a,e).attach(t.field,t.data,t.name);return u&&h.field(u),c&&h.set(c),l&&h.on("progress",l),new Promise(function(e,t){var n=function(){t(new i.AbortError("Request aborted")),h.abort()};null===f||void 0===f||f.addEventListener("abort",n),h.then(function(t){return e(r(t))}).catch(function(n){n.response?e(r(n.response)):t(n)}).finally(function(){return null===f||void 0===f?void 0:f.removeEventListener("abort",n)})})}},function(e,t,n){"use strict";function r(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"AbortError",function(){return o});/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="AbortError",t}return r(t,e),t}(Error)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){"@babel/helpers - typeof";return(i="function"==typeof b.default&&"symbol"===(0,g.default)(m.default)?function(e){return void 0===e?"undefined":(0,g.default)(e)}:function(e){return e&&"function"==typeof b.default&&e.constructor===b.default&&e!==b.default.prototype?"symbol":void 0===e?"undefined":(0,g.default)(e)})(e)}function o(){}function s(e){if(!S(e))return e;var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&a(t,n,e[n]);return t.join("&")}function a(e,t,n){if(void 0!==n){if(null===n)return void e.push(encodeURI(t));if(Array.isArray(n))n.forEach(function(n){a(e,t,n)});else if(S(n))for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&a(e,"".concat(t,"[").concat(r,"]"),n[r]);else e.push(encodeURI(t)+"="+encodeURIComponent(n))}}function u(e){for(var t,n,r={},i=e.split("&"),o=0,s=i.length;o<s;++o)t=i[o],n=t.indexOf("="),-1===n?r[decodeURIComponent(t)]="":r[decodeURIComponent(t.slice(0,n))]=decodeURIComponent(t.slice(n+1));return r}function c(e){for(var t,n,r,i,o=e.split(/\r?\n/),s={},a=0,u=o.length;a<u;++a)n=o[a],-1!==(t=n.indexOf(":"))&&(r=n.slice(0,t).toLowerCase(),i=x(n.slice(t+1)),s[r]=i);return s}function l(e){return/[\/+]json($|[^-\w])/.test(e)}function f(e){this.req=e,this.xhr=this.req.xhr,this.text="HEAD"!==this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||void 0===this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText;var t=this.xhr.status;1223===t&&(t=204),this._setStatusProperties(t),this.headers=c(this.xhr.getAllResponseHeaders()),this.header=this.headers,this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),null===this.text&&e._responseType?this.body=this.xhr.response:this.body="HEAD"===this.req.method?null:this._parseBody(this.text?this.text:this.xhr.response)}function h(e,t){var n=this;this._query=this._query||[],this.method=e,this.url=t,this.header={},this._header={},this.on("end",function(){var e=null,t=null;try{t=new f(n)}catch(t){return e=new Error("Parser is unable to parse the response"),e.parse=!0,e.original=t,n.xhr?(e.rawResponse=void 0===n.xhr.responseType?n.xhr.responseText:n.xhr.response,e.status=n.xhr.status?n.xhr.status:null,e.statusCode=e.status):(e.rawResponse=null,e.status=null),n.callback(e)}n.emit("response",t);var r;try{n._isResponseOK(t)||(r=new Error(t.statusText||t.text||"Unsuccessful HTTP response"))}catch(e){r=e}r?(r.original=e,r.response=t,r.status=t.status,n.callback(r,t)):n.callback(null,t)})}function d(e,t,n){var r=I("DELETE",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r}var p,v=n(46),m=r(v),y=n(21),g=r(y),_=n(28),b=r(_);"undefined"!=typeof window?p=window:"undefined"==typeof self?(console.warn("Using browser-only version of superagent in non-browser environment"),p=void 0):p=self;var w=n(199),E=n(200),T=n(201),S=n(100),O=n(202),A=n(204);e.exports=function(e,n){return"function"==typeof n?new t.Request("GET",e).end(n):1===arguments.length?new t.Request("GET",e):new t.Request(e,n)},t=e.exports;var I=t;t.Request=h,I.getXHR=function(){if(p.XMLHttpRequest&&(!p.location||"file:"!==p.location.protocol||!p.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){}throw new Error("Browser-only version of superagent could not find XHR")};var x="".trim?function(e){return e.trim()}:function(e){return e.replace(/(^\s*|\s*$)/g,"")};I.serializeObject=s,I.parseString=u,I.types={html:"text/html",json:"application/json",xml:"text/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},I.serialize={"application/x-www-form-urlencoded":s,"application/json":E},I.parse={"application/x-www-form-urlencoded":u,"application/json":JSON.parse},O(f.prototype),f.prototype._parseBody=function(e){var t=I.parse[this.type];return this.req._parser?this.req._parser(this,e):(!t&&l(this.type)&&(t=I.parse["application/json"]),t&&e&&(e.length>0||e instanceof Object)?t(e):null)},f.prototype.toError=function(){var e=this.req,t=e.method,n=e.url,r="cannot ".concat(t," ").concat(n," (").concat(this.status,")"),i=new Error(r);return i.status=this.status,i.method=t,i.url=n,i},I.Response=f,w(h.prototype),T(h.prototype),h.prototype.type=function(e){return this.set("Content-Type",I.types[e]||e),this},h.prototype.accept=function(e){return this.set("Accept",I.types[e]||e),this},h.prototype.auth=function(e,t,n){1===arguments.length&&(t=""),"object"===i(t)&&null!==t&&(n=t,t=""),n||(n={type:"function"==typeof btoa?"basic":"auto"});var r=function(e){if("function"==typeof btoa)return btoa(e);throw new Error("Cannot use basic auth, btoa is not a function")};return this._auth(e,t,n,r)},h.prototype.query=function(e){return"string"!=typeof e&&(e=s(e)),e&&this._query.push(e),this},h.prototype.attach=function(e,t,n){if(t){if(this._data)throw new Error("superagent can't mix .send() and .attach()");this._getFormData().append(e,t,n||t.name)}return this},h.prototype._getFormData=function(){return this._formData||(this._formData=new p.FormData),this._formData},h.prototype.callback=function(e,t){if(this._shouldRetry(e,t))return this._retry();var n=this._callback;this.clearTimeout(),e&&(this._maxRetries&&(e.retries=this._retries-1),this.emit("error",e)),n(e,t)},h.prototype.crossDomainError=function(){var e=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");e.crossDomain=!0,e.status=this.status,e.method=this.method,e.url=this.url,this.callback(e)},h.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},h.prototype.ca=h.prototype.agent,h.prototype.buffer=h.prototype.ca,h.prototype.write=function(){throw new Error("Streaming is not supported in browser version of superagent")},h.prototype.pipe=h.prototype.write,h.prototype._isHost=function(e){return e&&"object"===i(e)&&!Array.isArray(e)&&"[object Object]"!==Object.prototype.toString.call(e)},h.prototype.end=function(e){this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=e||o,this._finalizeQueryString(),this._end()},h.prototype._setUploadTimeout=function(){var e=this;this._uploadTimeout&&!this._uploadTimeoutTimer&&(this._uploadTimeoutTimer=setTimeout(function(){e._timeoutError("Upload timeout of ",e._uploadTimeout,"ETIMEDOUT")},this._uploadTimeout))},h.prototype._end=function(){if(this._aborted)return this.callback(new Error("The request has been aborted even before .end() was called"));var e=this;this.xhr=I.getXHR();var t=this.xhr,n=this._formData||this._data;this._setTimeouts(),t.onreadystatechange=function(){var n=t.readyState;if(n>=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,100===n.percent&&clearTimeout(e._uploadTimeoutTimer)),n.direction=t,e.emit("progress",n)};if(this.hasListeners("progress"))try{t.addEventListener("progress",r.bind(null,"download")),t.upload&&t.upload.addEventListener("progress",r.bind(null,"upload"))}catch(e){}t.upload&&this._setUploadTimeout();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||I.serialize[i?i.split(";")[0]:""];!o&&l(i)&&(o=I.serialize["application/json"]),o&&(n=o(n))}for(var s in this.header)null!==this.header[s]&&Object.prototype.hasOwnProperty.call(this.header,s)&&t.setRequestHeader(s,this.header[s]);this._responseType&&(t.responseType=this._responseType),this.emit("request",this),t.send(void 0===n?null:n)},I.agent=function(){return new A},["GET","POST","OPTIONS","PATCH","PUT","DELETE"].forEach(function(e){A.prototype[e.toLowerCase()]=function(t,n){var r=new I.Request(e,t);return this._setDefaults(r),n&&r.end(n),r}}),A.prototype.del=A.prototype.delete,I.get=function(e,t,n){var r=I("GET",e);return"function"==typeof t&&(n=t,t=null),t&&r.query(t),n&&r.end(n),r},I.head=function(e,t,n){var r=I("HEAD",e);return"function"==typeof t&&(n=t,t=null),t&&r.query(t),n&&r.end(n),r},I.options=function(e,t,n){var r=I("OPTIONS",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},I.del=d,I.delete=d,I.patch=function(e,t,n){var r=I("PATCH",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},I.post=function(e,t,n){var r=I("POST",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},I.put=function(e,t,n){var r=I("PUT",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r}},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<n.length;i++)if((r=n[i])===t||r.fn===t){n.splice(i,1);break}return 0===n.length&&delete this._callbacks["$"+e],this},r.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,t)}return this},r.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},r.prototype.hasListeners=function(e){return!!this.listeners(e).length}},function(e,t){function n(e,t,n){r(e,"",[],void 0);var i;for(i=0===c.length?JSON.stringify(e,t,n):JSON.stringify(e,a(t),n);0!==u.length;){var o=u.pop();4===o.length?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}return i}function r(e,t,n,i){var o;if("object"==typeof e&&null!==e){for(o=0;o<n.length;o++)if(n[o]===e){var s=Object.getOwnPropertyDescriptor(i,t);return void(void 0!==s.get?s.configurable?(Object.defineProperty(i,t,{value:"[Circular]"}),u.push([i,t,e,s])):c.push([e,t]):(i[t]="[Circular]",u.push([i,t,e])))}if(n.push(e),Array.isArray(e))for(o=0;o<e.length;o++)r(e[o],o,n,e);else{var a=Object.keys(e);for(o=0;o<a.length;o++){var l=a[o];r(e[l],l,n,e)}}n.pop()}}function i(e,t){return e<t?-1:e>t?1:0}function o(e,t,n){var r,i=s(e,"",[],void 0)||e;for(r=0===c.length?JSON.stringify(i,t,n):JSON.stringify(i,a(t),n);0!==u.length;){var o=u.pop();4===o.length?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}return r}function s(e,t,n,r){var o;if("object"==typeof e&&null!==e){for(o=0;o<n.length;o++)if(n[o]===e){var a=Object.getOwnPropertyDescriptor(r,t);return void(void 0!==a.get?a.configurable?(Object.defineProperty(r,t,{value:"[Circular]"}),u.push([r,t,e,a])):c.push([e,t]):(r[t]="[Circular]",u.push([r,t,e])))}if("function"==typeof e.toJSON)return;if(n.push(e),Array.isArray(e))for(o=0;o<e.length;o++)s(e[o],o,n,e);else{var l={},f=Object.keys(e).sort(i);for(o=0;o<f.length;o++){var h=f[o];s(e[h],h,n,e),l[h]=e[h]}if(void 0===r)return l;u.push([r,t,e]),r[t]=l}n.pop()}}function a(e){return e=void 0!==e?e:function(e,t){return t},function(t,n){if(c.length>0)for(var r=0;r<c.length;r++){var i=c[r];if(i[1]===t&&i[0]===n){n="[Circular]",c.splice(r,1);break}}return e.call(this,t,n)}}e.exports=n,n.default=n,n.stable=o,n.stableStringify=o;var u=[],c=[]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){"@babel/helpers - typeof";return(i="function"==typeof p.default&&"symbol"===(0,h.default)(l.default)?function(e){return void 0===e?"undefined":(0,h.default)(e)}:function(e){return e&&"function"==typeof p.default&&e.constructor===p.default&&e!==p.default.prototype?"symbol":void 0===e?"undefined":(0,h.default)(e)})(e)}function o(e){if(e)return s(e)}function s(e){for(var t in o.prototype)Object.prototype.hasOwnProperty.call(o.prototype,t)&&(e[t]=o.prototype[t]);return e}var a=n(2),u=r(a),c=n(46),l=r(c),f=n(21),h=r(f),d=n(28),p=r(d),v=n(100);e.exports=o,o.prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),clearTimeout(this._uploadTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,delete this._uploadTimeoutTimer,this},o.prototype.parse=function(e){return this._parser=e,this},o.prototype.responseType=function(e){return this._responseType=e,this},o.prototype.serialize=function(e){return this._serializer=e,this},o.prototype.timeout=function(e){if(!e||"object"!==i(e))return this._timeout=e,this._responseTimeout=0,this._uploadTimeout=0,this;for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))switch(t){case"deadline":this._timeout=e.deadline;break;case"response":this._responseTimeout=e.response;break;case"upload":this._uploadTimeout=e.upload;break;default:console.warn("Unknown timeout option",t)}return this},o.prototype.retry=function(e,t){return 0!==arguments.length&&!0!==e||(e=1),e<=0&&(e=0),this._maxRetries=e,this._retries=0,this._retryCallback=t,this};var m=["ECONNRESET","ETIMEDOUT","EADDRINFO","ESOCKETTIMEDOUT"];o.prototype._shouldRetry=function(e,t){if(!this._maxRetries||this._retries++>=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&&m.includes(e.code))return!0;if(e.timeout&&"ECONNABORTED"===e.code)return!0;if(e.crossDomain)return!0}return!1},o.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this.timedoutError=null,this._end()},o.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 u.default(function(e,t){r.on("abort",function(){if(!(n._maxRetries&&n._maxRetries>n._retries)){if(n.timedout&&n.timedoutError)return void t(n.timedoutError);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)},o.prototype.catch=function(e){return this.then(void 0,e)},o.prototype.use=function(e){return e(this),this},o.prototype.ok=function(e){if("function"!=typeof e)throw new Error("Callback required");return this._okCallback=e,this},o.prototype._isResponseOK=function(e){return!!e&&(this._okCallback?this._okCallback(e):e.status>=200&&e.status<300)},o.prototype.get=function(e){return this._header[e.toLowerCase()]},o.prototype.getHeader=o.prototype.get,o.prototype.set=function(e,t){if(v(e)){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&this.set(n,e[n]);return this}return this._header[e.toLowerCase()]=t,this.header[e]=t,this},o.prototype.unset=function(e){return delete this._header[e.toLowerCase()],delete this.header[e],this},o.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(v(e)){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&this.field(n,e[n]);return this}if(Array.isArray(t)){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&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=String(t)),this._getFormData().append(e,t),this},o.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)},o.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},o.prototype.withCredentials=function(e){return void 0===e&&(e=!0),this._withCredentials=e,this},o.prototype.redirects=function(e){return this._maxRedirects=e,this},o.prototype.maxResponseSize=function(e){if("number"!=typeof e)throw new TypeError("Invalid argument");return this._maxResponseSize=e,this},o.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},o.prototype.send=function(e){var t=v(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 new Error("Can't merge these send calls");if(t&&v(this._data))for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(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)},o.prototype.sortQuery=function(e){return this._sort=void 0===e||e,this},o.prototype._finalizeQueryString=function(){var e=this._query.join("&");if(e&&(this.url+=(this.url.includes("?")?"&":"?")+e),this._query.length=0,this._sort){var t=this.url.indexOf("?");if(t>=0){var n=this.url.slice(t+1).split("&");"function"==typeof this._sort?n.sort(this._sort):n.sort(),this.url=this.url.slice(0,t)+"?"+n.join("&")}}},o.prototype._appendQueryString=function(){console.warn("Unsupported")},o.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.timedoutError=r,this.abort(),this.callback(r)}},o.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)Object.prototype.hasOwnProperty.call(r.prototype,t)&&(e[t]=r.prototype[t]);return e}var o=n(203);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)Object.prototype.hasOwnProperty.call(n,r)&&(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.statusCode=e,this.status=this.statusCode,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,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){return u(e)||a(e)||s(e)||o()}function o(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(e,t){if(e){if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?(0,m.default)(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}function a(e){if(void 0!==p.default&&(0,h.default)(Object(e)))return(0,m.default)(e)}function u(e){if(Array.isArray(e))return c(e)}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function l(){this._defaults=[]}var f=n(72),h=r(f),d=n(28),p=r(d),v=n(101),m=r(v);["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert","disableTLSCerts"].forEach(function(e){l.prototype[e]=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this._defaults.push({fn:e,args:n}),this}}),l.prototype._setDefaults=function(e){this._defaults.forEach(function(t){e[t.fn].apply(e,i(t.args))})},e.exports=l},function(e,t,n){n(22),n(206),e.exports=n(1).Array.from},function(e,t,n){"use strict";var r=n(13),i=n(4),o=n(18),s=n(81),a=n(82),u=n(39),c=n(102),l=n(62);i(i.S+i.F*!n(88)(function(e){Array.from(e)}),"Array",{from:function(e){var t,n,i,f,h=o(e),d="function"==typeof this?this:Array,p=arguments.length,v=p>1?arguments[1]:void 0,m=void 0!==v,y=0,g=l(h);if(m&&(v=r(v,p>2?arguments[2]:void 0,2)),void 0==g||d==Array&&a(g))for(t=u(h.length),n=new d(t);t>y;y++)c(n,y,m?v(h[y],y):h[y]);else for(f=g.call(h),n=new d;!(i=f.next()).done;y++)c(n,y,m?s(f,v,[i.value,y],!0):i.value);return n.length=y,n}})},function(e,t,n){"use strict";var r=n(73),i=r.Realtime,o=r.setAdapters,s=n(292),a=s.LiveQueryPlugin;i.__preRegisteredPlugins=[a],e.exports=function(e){e._sharedConfig.liveQueryRealtime=i;var t=e.setAdapters;return e.setAdapters=function(e){t(e),o(e)},e}},function(e,t,n){"use strict";(function(e){function r(e){return e&&e.__esModule?e:{default:e}}function i(e){return e&&"object"===(void 0===e?"undefined":(0,D.default)(e))&&"default"in e?e.default:e}function o(e,t){var n=(0,N.default)(e);if(x.default){var r=(0,x.default)(e);t&&(r=r.filter(function(t){return(0,A.default)(e,t).enumerable})),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach(function(t){Y(e,t,n[t])}):S.default?(0,E.default)(e,(0,S.default)(n)):o(Object(n)).forEach(function(t){(0,b.default)(e,t,(0,A.default)(n,t))})}return e}function a(e,t){var n=(0,N.default)(e);if(x.default){var r=(0,x.default)(e);t&&(r=r.filter(function(t){return(0,A.default)(e,t).enumerable})),n.push.apply(n,r)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach(function(t){Y(e,t,n[t])}):S.default?(0,E.default)(e,(0,S.default)(n)):a(Object(n)).forEach(function(t){(0,b.default)(e,t,(0,A.default)(n,t))})}return e}function c(e,t){var n=(0,N.default)(e);if(x.default){var r=(0,x.default)(e);t&&(r=r.filter(function(t){return(0,A.default)(e,t).enumerable})),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach(function(t){Y(e,t,n[t])}):S.default?(0,E.default)(e,(0,S.default)(n)):c(Object(n)).forEach(function(t){(0,b.default)(e,t,(0,A.default)(n,t))})}return e}var f=n(103),h=r(f),d=n(12),p=r(d),v=n(219),m=r(v),y=n(2),g=r(y),_=n(66),b=r(_),w=n(225),E=r(w),T=n(228),S=r(T),O=n(98),A=r(O),I=n(108),x=r(I),C=n(65),N=r(C),P=n(28),R=r(P),j=n(109),k=r(j),L=n(235),U=r(L),M=n(21),D=r(M);Object.defineProperty(t,"__esModule",{value:!0});var F=i(n(238)),q=i(n(242)),B=i(n(245)),V=i(n(247)),W=i(n(248)),Y=i(n(251)),z=i(n(252)),Q=i(n(254)),G=i(n(255)),J=i(n(19)),K=i(n(256)),H=i(n(115)),$=i(n(283)),X=i(n(286)),Z=i(n(287)),ee=i(n(288)),te=i(n(289)),ne=i(n(290)),re=n(96),ie=F.newBuilder({}).import({package:"push_server.messages2",syntax:"proto2",options:{objc_class_prefix:"AVIM"},messages:[{name:"JsonObjectMessage",syntax:"proto2",fields:[{rule:"required",type:"string",name:"data",id:1}]},{name:"UnreadTuple",syntax:"proto2",fields:[{rule:"required",type:"string",name:"cid",id:1},{rule:"required",type:"int32",name:"unread",id:2},{rule:"optional",type:"string",name:"mid",id:3},{rule:"optional",type:"int64",name:"timestamp",id:4},{rule:"optional",type:"string",name:"from",id:5},{rule:"optional",type:"string",name:"data",id:6},{rule:"optional",type:"int64",name:"patchTimestamp",id:7},{rule:"optional",type:"bool",name:"mentioned",id:8},{rule:"optional",type:"bytes",name:"binaryMsg",id:9},{rule:"optional",type:"int32",name:"convType",id:10}]},{name:"LogItem",syntax:"proto2",fields:[{rule:"optional",type:"string",name:"from",id:1},{rule:"optional",type:"string",name:"data",id:2},{rule:"optional",type:"int64",name:"timestamp",id:3},{rule:"optional",type:"string",name:"msgId",id:4},{rule:"optional",type:"int64",name:"ackAt",id:5},{rule:"optional",type:"int64",name:"readAt",id:6},{rule:"optional",type:"int64",name:"patchTimestamp",id:7},{rule:"optional",type:"bool",name:"mentionAll",id:8},{rule:"repeated",type:"string",name:"mentionPids",id:9},{rule:"optional",type:"bool",name:"bin",id:10},{rule:"optional",type:"int32",name:"convType",id:11}]},{name:"ConvMemberInfo",syntax:"proto2",fields:[{rule:"optional",type:"string",name:"pid",id:1},{rule:"optional",type:"string",name:"role",id:2},{rule:"optional",type:"string",name:"infoId",id:3}]},{name:"DataCommand",syntax:"proto2",fields:[{rule:"repeated",type:"string",name:"ids",id:1},{rule:"repeated",type:"JsonObjectMessage",name:"msg",id:2},{rule:"optional",type:"bool",name:"offline",id:3}]},{name:"SessionCommand",syntax:"proto2",fields:[{rule:"optional",type:"int64",name:"t",id:1},{rule:"optional",type:"string",name:"n",id:2},{rule:"optional",type:"string",name:"s",id:3},{rule:"optional",type:"string",name:"ua",id:4},{rule:"optional",type:"bool",name:"r",id:5},{rule:"optional",type:"string",name:"tag",id:6},{rule:"optional",type:"string",name:"deviceId",id:7},{rule:"repeated",type:"string",name:"sessionPeerIds",id:8},{rule:"repeated",type:"string",name:"onlineSessionPeerIds",id:9},{rule:"optional",type:"string",name:"st",id:10},{rule:"optional",type:"int32",name:"stTtl",id:11},{rule:"optional",type:"int32",name:"code",id:12},{rule:"optional",type:"string",name:"reason",id:13},{rule:"optional",type:"string",name:"deviceToken",id:14},{rule:"optional",type:"bool",name:"sp",id:15},{rule:"optional",type:"string",name:"detail",id:16},{rule:"optional",type:"int64",name:"lastUnreadNotifTime",id:17},{rule:"optional",type:"int64",name:"lastPatchTime",id:18},{rule:"optional",type:"int64",name:"configBitmap",id:19}]},{name:"ErrorCommand",syntax:"proto2",fields:[{rule:"required",type:"int32",name:"code",id:1},{rule:"required",type:"string",name:"reason",id:2},{rule:"optional",type:"int32",name:"appCode",id:3},{rule:"optional",type:"string",name:"detail",id:4},{rule:"repeated",type:"string",name:"pids",id:5},{rule:"optional",type:"string",name:"appMsg",id:6}]},{name:"DirectCommand",syntax:"proto2",fields:[{rule:"optional",type:"string",name:"msg",id:1},{rule:"optional",type:"string",name:"uid",id:2},{rule:"optional",type:"string",name:"fromPeerId",id:3},{rule:"optional",type:"int64",name:"timestamp",id:4},{rule:"optional",type:"bool",name:"offline",id:5},{rule:"optional",type:"bool",name:"hasMore",id:6},{rule:"repeated",type:"string",name:"toPeerIds",id:7},{rule:"optional",type:"bool",name:"r",id:10},{rule:"optional",type:"string",name:"cid",id:11},{rule:"optional",type:"string",name:"id",id:12},{rule:"optional",type:"bool",name:"transient",id:13},{rule:"optional",type:"string",name:"dt",id:14},{rule:"optional",type:"string",name:"roomId",id:15},{rule:"optional",type:"string",name:"pushData",id:16},{rule:"optional",type:"bool",name:"will",id:17},{rule:"optional",type:"int64",name:"patchTimestamp",id:18},{rule:"optional",type:"bytes",name:"binaryMsg",id:19},{rule:"repeated",type:"string",name:"mentionPids",id:20},{rule:"optional",type:"bool",name:"mentionAll",id:21},{rule:"optional",type:"int32",name:"convType",id:22}]},{name:"AckCommand",syntax:"proto2",fields:[{rule:"optional",type:"int32",name:"code",id:1},{rule:"optional",type:"string",name:"reason",id:2},{rule:"optional",type:"string",name:"mid",id:3},{rule:"optional",type:"string",name:"cid",id:4},{rule:"optional",type:"int64",name:"t",id:5},{rule:"optional",type:"string",name:"uid",id:6},{rule:"optional",type:"int64",name:"fromts",id:7},{rule:"optional",type:"int64",name:"tots",id:8},{rule:"optional",type:"string",name:"type",id:9},{rule:"repeated",type:"string",name:"ids",id:10},{rule:"optional",type:"int32",name:"appCode",id:11},{rule:"optional",type:"string",name:"appMsg",id:12}]},{name:"UnreadCommand",syntax:"proto2",fields:[{rule:"repeated",type:"UnreadTuple",name:"convs",id:1},{rule:"optional",type:"int64",name:"notifTime",id:2}]},{name:"ConvCommand",syntax:"proto2",fields:[{rule:"repeated",type:"string",name:"m",id:1},{rule:"optional",type:"bool",name:"transient",id:2},{rule:"optional",type:"bool",name:"unique",id:3},{rule:"optional",type:"string",name:"cid",id:4},{rule:"optional",type:"string",name:"cdate",id:5},{rule:"optional",type:"string",name:"initBy",id:6},{rule:"optional",type:"string",name:"sort",id:7},{rule:"optional",type:"int32",name:"limit",id:8},{rule:"optional",type:"int32",name:"skip",id:9},{rule:"optional",type:"int32",name:"flag",id:10},{rule:"optional",type:"int32",name:"count",id:11},{rule:"optional",type:"string",name:"udate",id:12},{rule:"optional",type:"int64",name:"t",id:13},{rule:"optional",type:"string",name:"n",id:14},{rule:"optional",type:"string",name:"s",id:15},{rule:"optional",type:"bool",name:"statusSub",id:16},{rule:"optional",type:"bool",name:"statusPub",id:17},{rule:"optional",type:"int32",name:"statusTTL",id:18},{rule:"optional",type:"string",name:"uniqueId",id:19},{rule:"optional",type:"string",name:"targetClientId",id:20},{rule:"optional",type:"int64",name:"maxReadTimestamp",id:21},{rule:"optional",type:"int64",name:"maxAckTimestamp",id:22},{rule:"optional",type:"bool",name:"queryAllMembers",id:23},{rule:"repeated",type:"MaxReadTuple",name:"maxReadTuples",id:24},{rule:"repeated",type:"string",name:"cids",id:25},{rule:"optional",type:"ConvMemberInfo",name:"info",id:26},{rule:"optional",type:"bool",name:"tempConv",id:27},{rule:"optional",type:"int32",name:"tempConvTTL",id:28},{rule:"repeated",type:"string",name:"tempConvIds",id:29},{rule:"repeated",type:"string",name:"allowedPids",id:30},{rule:"repeated",type:"ErrorCommand",name:"failedPids",id:31},{rule:"optional",type:"string",name:"next",id:40},{rule:"optional",type:"JsonObjectMessage",name:"results",id:100},{rule:"optional",type:"JsonObjectMessage",name:"where",id:101},{rule:"optional",type:"JsonObjectMessage",name:"attr",id:103},{rule:"optional",type:"JsonObjectMessage",name:"attrModified",id:104}]},{name:"RoomCommand",syntax:"proto2",fields:[{rule:"optional",type:"string",name:"roomId",id:1},{rule:"optional",type:"string",name:"s",id:2},{rule:"optional",type:"int64",name:"t",id:3},{rule:"optional",type:"string",name:"n",id:4},{rule:"optional",type:"bool",name:"transient",id:5},{rule:"repeated",type:"string",name:"roomPeerIds",id:6},{rule:"optional",type:"string",name:"byPeerId",id:7}]},{name:"LogsCommand",syntax:"proto2",fields:[{rule:"optional",type:"string",name:"cid",id:1},{rule:"optional",type:"int32",name:"l",id:2},{rule:"optional",type:"int32",name:"limit",id:3},{rule:"optional",type:"int64",name:"t",id:4},{rule:"optional",type:"int64",name:"tt",id:5},{rule:"optional",type:"string",name:"tmid",id:6},{rule:"optional",type:"string",name:"mid",id:7},{rule:"optional",type:"string",name:"checksum",id:8},{rule:"optional",type:"bool",name:"stored",id:9},{rule:"optional",type:"QueryDirection",name:"direction",id:10,options:{default:"OLD"}},{rule:"optional",type:"bool",name:"tIncluded",id:11},{rule:"optional",type:"bool",name:"ttIncluded",id:12},{rule:"optional",type:"int32",name:"lctype",id:13},{rule:"repeated",type:"LogItem",name:"logs",id:105}],enums:[{name:"QueryDirection",syntax:"proto2",values:[{name:"OLD",id:1},{name:"NEW",id:2}]}]},{name:"RcpCommand",syntax:"proto2",fields:[{rule:"optional",type:"string",name:"id",id:1},{rule:"optional",type:"string",name:"cid",id:2},{rule:"optional",type:"int64",name:"t",id:3},{rule:"optional",type:"bool",name:"read",id:4},{rule:"optional",type:"string",name:"from",id:5}]},{name:"ReadTuple",syntax:"proto2",fields:[{rule:"required",type:"string",name:"cid",id:1},{rule:"optional",type:"int64",name:"timestamp",id:2},{rule:"optional",type:"string",name:"mid",id:3}]},{name:"MaxReadTuple",syntax:"proto2",fields:[{rule:"optional",type:"string",name:"pid",id:1},{rule:"optional",type:"int64",name:"maxAckTimestamp",id:2},{rule:"optional",type:"int64",name:"maxReadTimestamp",id:3}]},{name:"ReadCommand",syntax:"proto2",fields:[{rule:"optional",type:"string",name:"cid",id:1},{rule:"repeated",type:"string",name:"cids",id:2},{rule:"repeated",type:"ReadTuple",name:"convs",id:3}]},{name:"PresenceCommand",syntax:"proto2",fields:[{rule:"optional",type:"StatusType",name:"status",id:1},{rule:"repeated",type:"string",name:"sessionPeerIds",id:2},{rule:"optional",type:"string",name:"cid",id:3}]},{name:"ReportCommand",syntax:"proto2",fields:[{rule:"optional",type:"bool",name:"initiative",id:1},{rule:"optional",type:"string",name:"type",id:2},{rule:"optional",type:"string",name:"data",id:3}]},{name:"PatchItem",syntax:"proto2",fields:[{rule:"optional",type:"string",name:"cid",id:1},{rule:"optional",type:"string",name:"mid",id:2},{rule:"optional",type:"int64",name:"timestamp",id:3},{rule:"optional",type:"bool",name:"recall",id:4},{rule:"optional",type:"string",name:"data",id:5},{rule:"optional",type:"int64",name:"patchTimestamp",id:6},{rule:"optional",type:"string",name:"from",id:7},{rule:"optional",type:"bytes",name:"binaryMsg",id:8},{rule:"optional",type:"bool",name:"mentionAll",id:9},{rule:"repeated",type:"string",name:"mentionPids",id:10},{rule:"optional",type:"int64",name:"patchCode",id:11},{rule:"optional",type:"string",name:"patchReason",id:12}]},{name:"PatchCommand",syntax:"proto2",fields:[{rule:"repeated",type:"PatchItem",name:"patches",id:1},{rule:"optional",type:"int64",name:"lastPatchTime",id:2}]},{name:"PubsubCommand",syntax:"proto2",fields:[{rule:"optional",type:"string",name:"cid",id:1},{rule:"repeated",type:"string",name:"cids",id:2},{rule:"optional",type:"string",name:"topic",id:3},{rule:"optional",type:"string",name:"subtopic",id:4},{rule:"repeated",type:"string",name:"topics",id:5},{rule:"repeated",type:"string",name:"subtopics",id:6},{rule:"optional",type:"JsonObjectMessage",name:"results",id:7}]},{name:"BlacklistCommand",syntax:"proto2",fields:[{rule:"optional",type:"string",name:"srcCid",id:1},{rule:"repeated",type:"string",name:"toPids",id:2},{rule:"optional",type:"string",name:"srcPid",id:3},{rule:"repeated",type:"string",name:"toCids",id:4},{rule:"optional",type:"int32",name:"limit",id:5},{rule:"optional",type:"string",name:"next",id:6},{rule:"repeated",type:"string",name:"blockedPids",id:8},{rule:"repeated",type:"string",name:"blockedCids",id:9},{rule:"repeated",type:"string",name:"allowedPids",id:10},{rule:"repeated",type:"ErrorCommand",name:"failedPids",id:11},{rule:"optional",type:"int64",name:"t",id:12},{rule:"optional",type:"string",name:"n",id:13},{rule:"optional",type:"string",name:"s",id:14}]},{name:"GenericCommand",syntax:"proto2",fields:[{rule:"optional",type:"CommandType",name:"cmd",id:1},{rule:"optional",type:"OpType",name:"op",id:2},{rule:"optional",type:"string",name:"appId",id:3},{rule:"optional",type:"string",name:"peerId",id:4},{rule:"optional",type:"int32",name:"i",id:5},{rule:"optional",type:"string",name:"installationId",id:6},{rule:"optional",type:"int32",name:"priority",id:7},{rule:"optional",type:"int32",name:"service",id:8},{rule:"optional",type:"int64",name:"serverTs",id:9},{rule:"optional",type:"int64",name:"clientTs",id:10},{rule:"optional",type:"int32",name:"notificationType",id:11},{rule:"optional",type:"DataCommand",name:"dataMessage",id:101},{rule:"optional",type:"SessionCommand",name:"sessionMessage",id:102},{rule:"optional",type:"ErrorCommand",name:"errorMessage",id:103},{rule:"optional",type:"DirectCommand",name:"directMessage",id:104},{rule:"optional",type:"AckCommand",name:"ackMessage",id:105},{rule:"optional",type:"UnreadCommand",name:"unreadMessage",id:106},{rule:"optional",type:"ReadCommand",name:"readMessage",id:107},{rule:"optional",type:"RcpCommand",name:"rcpMessage",id:108},{rule:"optional",type:"LogsCommand",name:"logsMessage",id:109},{rule:"optional",type:"ConvCommand",name:"convMessage",id:110},{rule:"optional",type:"RoomCommand",name:"roomMessage",id:111},{rule:"optional",type:"PresenceCommand",name:"presenceMessage",id:112},{rule:"optional",type:"ReportCommand",name:"reportMessage",id:113},{rule:"optional",type:"PatchCommand",name:"patchMessage",id:114},{rule:"optional",type:"PubsubCommand",name:"pubsubMessage",id:115},{rule:"optional",type:"BlacklistCommand",name:"blacklistMessage",id:116}]}],enums:[{name:"CommandType",syntax:"proto2",values:[{name:"session",id:0},{name:"conv",id:1},{name:"direct",id:2},{name:"ack",id:3},{name:"rcp",id:4},{name:"unread",id:5},{name:"logs",id:6},{name:"error",id:7},{name:"login",id:8},{name:"data",id:9},{name:"room",id:10},{name:"read",id:11},{name:"presence",id:12},{name:"report",id:13},{name:"echo",id:14},{name:"loggedin",id:15},{name:"logout",id:16},{name:"loggedout",id:17},{name:"patch",id:18},{name:"pubsub",id:19},{name:"blacklist",id:20},{name:"goaway",id:21}]},{name:"OpType",syntax:"proto2",values:[{name:"open",id:1},{name:"add",id:2},{name:"remove",id:3},{name:"close",id:4},{name:"opened",id:5},{name:"closed",id:6},{name:"query",id:7},{name:"query_result",id:8},{name:"conflict",id:9},{name:"added",id:10},{name:"removed",id:11},{name:"refresh",id:12},{name:"refreshed",id:13},{name:"start",id:30},{name:"started",id:31},{name:"joined",id:32},{name:"members_joined",id:33},{name:"left",id:39},{name:"members_left",id:40},{name:"results",id:42},{name:"count",id:43},{name:"result",id:44},{name:"update",id:45},{name:"updated",id:46},{name:"mute",id:47},{name:"unmute",id:48},{name:"status",id:49},{name:"members",id:50},{name:"max_read",id:51},{name:"is_member",id:52},{name:"member_info_update",id:53},{name:"member_info_updated",id:54},{name:"member_info_changed",id:55},{name:"join",id:80},{name:"invite",id:81},{name:"leave",id:82},{name:"kick",id:83},{name:"reject",id:84},{name:"invited",id:85},{name:"kicked",id:86},{name:"upload",id:100},{name:"uploaded",id:101},{name:"subscribe",id:120},{name:"subscribed",id:121},{name:"unsubscribe",id:122},{name:"unsubscribed",id:123},{name:"is_subscribed",id:124},{name:"modify",id:150},{name:"modified",id:151},{name:"block",id:170},{name:"unblock",id:171},{name:"blocked",id:172},{name:"unblocked",id:173},{name:"members_blocked",id:174},{name:"members_unblocked",id:175},{name:"check_block",id:176},{name:"check_result",id:177},{name:"add_shutup",id:180},{name:"remove_shutup",id:181},{name:"query_shutup",id:182},{name:"shutup_added",id:183},{name:"shutup_removed",id:184},{name:"shutup_result",id:185},{name:"shutuped",id:186},{name:"unshutuped",id:187},{name:"members_shutuped",id:188},{name:"members_unshutuped",id:189},{name:"check_shutup",id:190}]},{name:"StatusType",syntax:"proto2",values:[{name:"on",id:1},{name:"off",id:2}]}],isNamespace:!0}).build(),oe=ie.push_server.messages2,se=oe.JsonObjectMessage,ae=oe.UnreadTuple,ue=oe.LogItem,ce=oe.DataCommand,le=oe.SessionCommand,fe=oe.ErrorCommand,he=oe.DirectCommand,de=oe.AckCommand,pe=oe.UnreadCommand,ve=oe.ConvCommand,me=oe.RoomCommand,ye=oe.LogsCommand,ge=oe.RcpCommand,_e=oe.ReadTuple,be=oe.MaxReadTuple,we=oe.ReadCommand,Ee=oe.PresenceCommand,Te=oe.ReportCommand,Se=oe.GenericCommand,Oe=oe.BlacklistCommand,Ae=oe.PatchCommand,Ie=oe.PatchItem,xe=oe.ConvMemberInfo,Ce=oe.CommandType,Ne=oe.OpType,Pe=oe.StatusType,Re=(0,U.default)({__proto__:null,JsonObjectMessage:se,UnreadTuple:ae,LogItem:ue,DataCommand:ce,SessionCommand:le,ErrorCommand:fe,DirectCommand:he,AckCommand:de,UnreadCommand:pe,ConvCommand:ve,RoomCommand:me,LogsCommand:ye,RcpCommand:ge,ReadTuple:_e,MaxReadTuple:be,ReadCommand:we,PresenceCommand:Ee,ReportCommand:Te,GenericCommand:Se,BlacklistCommand:Oe,PatchCommand:Ae,PatchItem:Ie,ConvMemberInfo:xe,CommandType:Ce,OpType:Ne,StatusType:Pe}),je={},ke=function(e){var t=je[e];if(void 0===t)throw new Error("".concat(e," adapter is not configured"));return t},Le=function(e){(0,k.default)(je,e)},Ue=void 0!==e?e:"undefined"!=typeof window?window:{},Me=(0,R.default)("expired"),De=J("LC:Expirable"),Fe=function(){function e(e,t){this.originalValue=e,"number"==typeof t&&(this.expiredAt=Date.now()+t)}return X(e,[{key:"value",get:function(){var e=this.expiredAt&&this.expiredAt<=Date.now();return e&&De("expired: ".concat(this.originalValue)),e?Me:this.originalValue}}]),e}();Fe.EXPIRED=Me;var qe,Be=J("LC:Cache"),Ve=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!==Fe.EXPIRED)return Be("[%s] hit: %s",this.name,e),n;delete this._map[e]}return Be("[".concat(this.name,"] missed: ").concat(e)),null},t.set=function(e,t,n){Be("[%s] set: %s %d",this.name,e,n),this._map[e]=new Fe(t,n)},e}(),We={enable:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"LC*";return J.enable(e)},disable:J.disable},Ye=function e(t){var n=new g.default(t[0]);return 1===t.length?n:n.catch(function(){return e(t.slice(1))})},ze=function(e){return function(t){return e(t),t}},Qe=(Ue.navigator&&Ue.navigator.userAgent&&Ue.navigator.userAgent.indexOf("MSIE 10."),new m.default),Ge=function(e){return Qe.has(e)||Qe.set(e,{}),Qe.get(e)},Je=function e(t,n){if(!ne(t))return t;var r=s({},t);return(0,N.default)(r).forEach(function(t){var i=r[t];i===n?delete r[t]:r[t]=e(i,n)}),r},Ke=function(e){return Je(e,null)},He=function(e){return Ke(JSON.parse((0,p.default)(e)))},$e=function(e){return Array.isArray(e)?e:void 0===e||null===e?[]:[e]},Xe="object"===("undefined"==typeof wx?"undefined":te(wx))&&"function"==typeof wx.connectSocket,Ze=function(e){return"-MdYXbMMI"!==e.slice(-9)},et=function(e,t){if(!e||!t)return!1;if(e.byteLength!==t.byteLength)return!1;var n=new Uint8Array(e),r=new Uint8Array(t);return!n.some(function(e,t){return e!==r[t]})},tt=J("LC:WebSocketPlus"),nt=function(e){return Math.min(1e3*Math.pow(2,e),3e5)},rt=function(e,t,n){return u(u({},n),{},{value:function(){var e;this.checkConnectionAvailability(t);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return(e=n.value).call.apply(e,[this].concat(i))}})},it=(qe=function(e){function t(t,n){var r;return r=e.call(this)||this,r.init(),r._protocol=n,g.default.resolve("function"==typeof t?t():t).then($e).then(function(e){return r._urls=e,r._open()}).then(function(){r.__postponeTimeoutTimer=r._postponeTimeoutTimer.bind(Q(r)),Ue.addEventListener&&(r.__pause=function(){r.can("pause")&&r.pause()},r.__resume=function(){r.can("resume")&&r.resume()},Ue.addEventListener("offline",r.__pause),Ue.addEventListener("online",r.__resume)),r.open()}).catch(r.throw.bind(Q(r))),r}G(t,e),X(t,[{key:"urls",get:function(){return this._urls},set:function(e){this._urls=$e(e)}}]);var n=t.prototype;return n._open=function(){var e=this;return this._createWs(this._urls,this._protocol).then(function(t){var n=$(e._urls),r=n[0],i=n.slice(1);return e._urls=[].concat(W(i),[r]),t})},n._createWs=function(e,t){var n=this;return Ye(e.map(function(e){return function(r,i){tt("connect [".concat(e,"] ").concat(t));var o=ke("WebSocket"),s=t?new o(e,t):new o(e);s.binaryType=n.binaryType||"arraybuffer",s.onopen=function(){return r(s)},s.onclose=function(t){return i(t instanceof Error?t:new Error("Failed to connect [".concat(e,"]")))},s.onerror=s.onclose}})).then(function(e){return n._ws=e,n._ws.onclose=n._handleClose.bind(n),n._ws.onmessage=n._handleMessage.bind(n),e})},n._destroyWs=function(){var e=this._ws;e&&(e.onopen=null,e.onclose=null,e.onerror=null,e.onmessage=null,this._ws=null,e.close())},n.onbeforeevent=function(e,t,n){for(var r=arguments.length,i=new Array(r>3?r-3:0),o=3;o<r;o++)i[o-3]=arguments[o];tt("".concat(e,": ").concat(t," -> ").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="offline"===t?0:nt.call(null,i);tt("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()},function(){return r.can("fail")&&r.fail(i+1)})},n.onerror=function(e,t,n,r){this.emit("error",r)},n.onclose=function(){Ue.removeEventListener&&(this.__pause&&Ue.removeEventListener("offline",this.__pause),this.__resume&&Ue.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(){tt("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;tt("_postponeTimeoutTimer"),this._clearTimeoutTimers(),this._timeoutTimer=setTimeout(function(){tt("timeout"),e.disconnect()},38e4)},n._clearTimeoutTimers=function(){this._timeoutTimer&&clearTimeout(this._timeoutTimer)},n._startConnectionKeeper=function(){tt("start connection keeper"),this._heartbeatTimer=setInterval(this._ping.bind(this),18e4);var e=this._ws.addListener||this._ws.addEventListener;if(!e)return void tt("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(){tt("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){tt("ws closed [".concat(e.code,"] ").concat(e.reason)),this.isFinished()||this.handleClose(e)},n.handleClose=function(){this.disconnect()},n.send=function(e){tt("send",e),this._ws.send(e)},n._handleMessage=function(e){tt("message",e.data),this.handleMessage(e.data)},n.handleMessage=function(e){this.emit("message",e)},t}(q),Z(qe.prototype,"_ping",[rt],(0,A.default)(qe.prototype,"_ping"),qe.prototype),Z(qe.prototype,"send",[rt],(0,A.default)(qe.prototype,"send"),qe.prototype),qe);ee.create({target:it.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 ot=(0,U.default)({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."}}),st=(0,U.default)((0,N.default)(ot).reduce(function(e,t){return(0,k.default)(e,Y({},ot[t].name,Number(t)))},{})),at=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&&ot[t]&&(a=ot[t].name,s=ot[t].message||a),s||(s="Unknow Error: ".concat(t));var u=new Error(s);return(0,k.default)(u,{code:t,appCode:r,detail:i,name:a})},ut=J("LC:Connection"),ct=(0,R.default)("expire"),lt=function(e){return!(e.cmd===Ce.direct||e.cmd===Ce.session&&e.op===Ne.open||e.cmd===Ce.conv&&(e.op===Ne.start||e.op===Ne.update||e.op===Ne.members))},ft=function(e){function t(t,n){var r,i=n.format,o=n.version;ut("initializing Connection");var s="lc.".concat(i,".").concat(o);return r=e.call(this,t,s)||this,r._protocolFormat=i,r._commands={},r._serialId=0,r}G(t,e);var n=t.prototype;return n.send=function(){function t(e){return n.apply(this,arguments)}var n=V(B.mark(function t(n){var r,i,o,s,a,u,c=this,l=arguments;return B.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!(r=!(l.length>1&&void 0!==l[1])||l[1])){t.next=11;break}if(!lt(n)){t.next=8;break}if(i=n.toArrayBuffer(),!(s=H(this._commands).find(function(e){var t=e.buffer,r=e.command;return r.cmd===n.cmd&&r.op===n.op&&et(t,i)}))){t.next=8;break}return console.warn("Duplicated command [cmd:".concat(n.cmd," op:").concat(n.op,"] is throttled.")),t.abrupt("return",s.promise);case 8:this._serialId+=1,o=this._serialId,n.i=o;case 11:if(ut.enabled&&ut("↑ %O sent",He(n)),"proto2base64"===this._protocolFormat?a=n.toBase64():n.toArrayBuffer&&(a=n.toArrayBuffer()),a){t.next=15;break}throw new TypeError("".concat(n," is not a GenericCommand"));case 15:if(e.prototype.send.call(this,a),r){t.next=18;break}return t.abrupt("return",void 0);case 18:return u=new g.default(function(e,t){c._commands[o]={command:n,buffer:i,resolve:e,reject:t,timeout:setTimeout(function(){c._commands[o]&&(ut.enabled&&ut("✗ %O timeout",He(n)),t(at({error:"Command Timeout [cmd:".concat(n.cmd," op:").concat(n.op,"]"),name:"COMMAND_TIMEOUT"})),delete c._commands[o])},2e4)}}),this._commands[o].promise=u,t.abrupt("return",u);case 21:case"end":return t.stop()}},t,this)}));return t}(),n.handleMessage=function(e){var t;try{t=Se.decode(e),ut.enabled&&ut("↓ %O received",He(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===Ce.error?this._commands[n].reject(at(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 Ce.error:return void this.emit("error",at(t.errorMessage));case Ce.goaway:return void this.emit(ct);default:this.emit("message",t)}},n.ping=function(){return this.send(new Se({cmd:Ce.echo})).catch(function(e){return ut("ping failed:",e)})},t}(it),ht=J("LC:request"),dt=function(e){var t=e.method,n=void 0===t?"GET":t,r=e.url,i=e.query,o=e.headers,s=e.data,a=e.timeout,u=r;if(i){var c=(0,N.default)(i).map(function(e){var t=i[e];if(void 0!==t){var n=ne(t)?(0,p.default)(t):t;return"".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(n))}}).filter(function(e){return e}).join("&");u="".concat(u,"?").concat(c)}ht("Req: %O %O %O",n,u,{headers:o,data:s});var l=ke("request"),f=l(u,{method:n,headers:o,data:s}).then(function(e){if(!1===e.ok){var t=at(e.data);throw t.response=e,t}return ht("Res: %O %O %O",u,e.status,e.data),e.data}).catch(function(e){throw e.response&&ht("Error: %O %O %O",u,e.response.status,e.response.data),e});return a?re.timeout(f,a):f},pt=function(e,t){e&&e.forEach(function(e){try{e(t)}catch(t){throw e._pluginName&&(t.message+="[".concat(e._pluginName,"]")),t}})},vt=function(e,t){return $e(e).reduce(function(e,n){return e.then(function(e){return!1!==e&&n.apply(void 0,W(t))}).catch(function(e){throw n._pluginName&&(e.message+="[".concat(n._pluginName,"]")),e})},g.default.resolve(!0))},mt="5.0.0-rc.4",yt=J("LC:Realtime"),gt=new Ve("push-router"),_t={},bt=function(e){function t(n){var r,i=n.plugins,o=z(n,["plugins"]);yt("initializing Realtime %s %O",mt,o),r=e.call(this)||this;var s=o.appId;if("string"!=typeof s)throw new TypeError("appId [".concat(s,"] is not a string"));if(_t[s])throw new Error("App [".concat(s,"] is aleady initialized."));if(_t[s]=!0,"string"!=typeof o.appKey)throw new TypeError("appKey [".concat(o.appKey,"] is not a string"));if(Ze(s)&&!o.server)throw new TypeError("server option is required for apps from CN region");r._options=l({appId:void 0,appKey:void 0,pushOfflineMessages:!1,noBinary:!1,ssl:!0,RTMServerName:"undefined"!=typeof process?process.env.RTM_SERVER_NAME:void 0},o),r._cache=new Ve("endpoints");var a=Ge(Q(r));a.clients=new h.default,a.pendingClients=new h.default;var u=[].concat(W($e(t.__preRegisteredPlugins)),W($e(i)));return yt("Using plugins %o",u.map(function(e){return e.name})),r._plugins=u.reduce(function(e,t){return(0,N.default)(t).forEach(function(n){({}).hasOwnProperty.call(t,n)&&"name"!==n&&(t.name&&$e(t[n]).forEach(function(e){e._pluginName=t.name}),e[n]=$e(e[n]).concat(t[n]))}),e},{}),pt(r._plugins.onRealtimeCreate,Q(r)),r}G(t,e);var n=t.prototype;return n._request=function(){function e(e){return t.apply(this,arguments)}var t=V(B.mark(function e(t){var n,r,i,o,s,a,u,c,f,h,d,p,v,m;return B.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.method,r=t.url,i=t.version,o=void 0===i?"1.1":i,s=t.path,a=t.query,u=t.headers,c=t.data,f=r){e.next=9;break}return h=this._options,d=h.appId,p=h.server,e.next=6,this.constructor._getServerUrls({appId:d,server:p});case 6:v=e.sent,m=v.api,f="".concat(m,"/").concat(o).concat(s);case 9:return e.abrupt("return",dt({url:f,method:n,query:a,headers:l({"X-LC-Id":this._options.appId,"X-LC-Key":this._options.appKey},u),data:c}));case 10: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 g.default(function(t,n){yt("No connection established, create a new one.");var i=new ft(function(){return e._getRTMServers(e._options)},r);i.on("open",function(){return t(i)}).on("error",n).on(ct,V(B.mark(function t(){return B.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return yt("Connection expired. Refresh endpoints."),e._cache.set("endpoints",null,0),t.next=4,e._getRTMServers(e._options);case 4:i.urls=t.sent,i.disconnect();case 6:case"end":return t.stop()}},t)}))).on("message",e._dispatchCommand.bind(e)),["disconnect","reconnect","retry","schedule","offline","online"].forEach(function(t){return i.on(t,function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];yt("".concat(t," event emitted. %o"),r),e.emit.apply(e,[t].concat(r)),"reconnect"!==t&&Ge(e).clients.forEach(function(e){e.emit.apply(e,[t].concat(r))})})}),i.handleClose=function(e){[st.APP_NOT_AVAILABLE,st.INVALID_LOGIN,st.INVALID_ORIGIN].some(function(t){return t===e.code})?this.throw(at(e)):this.disconnect()},Ge(e).connection=i}),this._openPromise},n._getRTMServers=function(){function e(e){return t.apply(this,arguments)}var t=V(B.mark(function e(t){var n,r,i,o,s,a;return B.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.RTMServers){e.next=2;break}return e.abrupt("return",K($e(t.RTMServers)));case 2:if(!(r=this._cache.get("endpoints"))){e.next=7;break}n=r,e.next=14;break;case 7:return e.next=9,this.constructor._fetchRTMServers(t);case 9:if(n=e.sent,i=n,o=i.server,s=i.secondary,a=i.ttl,"string"==typeof o||"string"==typeof s||"number"==typeof a){e.next=13;break}throw new Error("malformed RTM route response: ".concat((0,p.default)(n)));case 13:this._cache.set("endpoints",n,1e3*n.ttl);case 14:return yt("endpoint info: %O",n),e.abrupt("return",[n.server,n.secondary]);case 16:case"end":return e.stop()}},e,this)}));return e}(),t._getServerUrls=function(){function e(e){return t.apply(this,arguments)}var t=V(B.mark(function e(t){var n,r,i,o;return B.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.appId,r=t.server,yt("fetch server urls"),!r){e.next=6;break}if("string"==typeof r){e.next=5;break}return e.abrupt("return",r);case 5:return e.abrupt("return",{RTMRouter:r,api:r});case 6:if(!(i=gt.get(n))){e.next=9;break}return e.abrupt("return",i);case 9:return o="https://",e.abrupt("return",dt({url:"https://app-router.com/2/route",query:{appId:n},timeout:2e4}).then(ze(yt)).then(function(e){var t=e.rtm_router_server,r=e.api_server,i=e.ttl,s=void 0===i?3600:i;if(!t)throw new Error("rtm router not exists");var a={RTMRouter:"".concat(o).concat(t),api:"".concat(o).concat(r)};return gt.set(n,a,1e3*s),a}).catch(function(){var e=n.slice(0,8).toLowerCase();return{RTMRouter:"".concat(o).concat(e,".rtm.").concat("lncldglobal.com"),api:"".concat(o).concat(e,".api.").concat("lncldglobal.com")}}));case 11:case"end":return e.stop()}},e)}));return e}(),t._fetchRTMServers=function(e){var t=e.appId,n=e.ssl,r=e.server,i=e.RTMServerName;return yt("fetch endpoint info"),this._getServerUrls({appId:t,server:r}).then(ze(yt)).then(function(e){var r=e.RTMRouter;return dt({url:"".concat(r,"/v1/route"),query:{appId:t,secure:n,features:Xe?"wechat":void 0,server:i,_t:Date.now()},timeout:2e4}).then(ze(yt))})},n._close=function(){this._openPromise&&this._openPromise.then(function(e){return e.close()}),delete this._openPromise},n.retry=function(){var e=Ge(this),t=e.connection;if(!t)throw new Error("no connection established");if(t.cannot("retry"))throw new Error("retrying not allowed when not disconnected. the connection is now ".concat(t.current));return t.retry()},n.pause=function(){var e=Ge(this),t=e.connection;t&&t.can("pause")&&t.pause()},n.resume=function(){var e=Ge(this),t=e.connection;t&&t.can("resume")&&t.resume()},n._registerPending=function(e){Ge(this).pendingClients.add(e)},n._deregisterPending=function(e){Ge(this).pendingClients.delete(e)},n._register=function(e){Ge(this).clients.add(e)},n._deregister=function(e){var t=Ge(this);t.clients.delete(e),t.clients.size+t.pendingClients.size===0&&this._close()},n._dispatchCommand=function(e){return vt(this._plugins.beforeCommandDispatch,[e,this]).then(function(t){return!!t&&yt("[WARN] Unexpected message received: %O",He(e))})},t}(q),wt=g.default;t.EventEmitter=q,t.Promise=wt,t.Protocals=Re,t.Protocols=Re,t.Realtime=bt,t.debug=We,t.getAdapter=ke,t.setAdapters=Le}).call(t,n(44))},function(e,t,n){n(37),n(22),n(24),n(210),n(214),n(217),n(218),e.exports=n(1).Set},function(e,t,n){"use strict";var r=n(211),i=n(36);e.exports=n(104)("Set",function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},{add:function(e){return r.def(i(this,"Set"),e=0===e?0:e,e)}},r)},function(e,t,n){"use strict";var r=n(10).f,i=n(38),o=n(43),s=n(13),a=n(42),u=n(25),c=n(54),l=n(80),f=n(87),h=n(8),d=n(29).fastKey,p=n(36),v=h?"_s":"size",m=function(e,t){var n,r=d(t);if("F"!==r)return e._i[r];for(n=e._f;n;n=n.n)if(n.k==t)return n};e.exports={getConstructor:function(e,t,n,c){var l=e(function(e,r){a(e,l,t,"_i"),e._t=t,e._i=i(null),e._f=void 0,e._l=void 0,e[v]=0,void 0!=r&&u(r,n,e[c],e)});return o(l.prototype,{clear:function(){for(var e=p(this,t),n=e._i,r=e._f;r;r=r.n)r.r=!0,r.p&&(r.p=r.p.n=void 0),delete n[r.i];e._f=e._l=void 0,e[v]=0},delete:function(e){var n=p(this,t),r=m(n,e);if(r){var i=r.n,o=r.p;delete n._i[r.i],r.r=!0,o&&(o.n=i),i&&(i.p=o),n._f==r&&(n._f=i),n._l==r&&(n._l=o),n[v]--}return!!r},forEach:function(e){p(this,t);for(var n,r=s(e,arguments.length>1?arguments[1]:void 0,3);n=n?n.n:this._f;)for(r(n.v,n.k,this);n&&n.r;)n=n.p},has:function(e){return!!m(p(this,t),e)}}),h&&r(l.prototype,"size",{get:function(){return p(this,t)[v]}}),l},def:function(e,t,n){var r,i,o=m(e,t);return o?o.v=n:(e._l=o={i:i=d(t,!0),k:t,v:n,p:r=e._l,n:void 0,r:!1},e._f||(e._f=o),r&&(r.n=o),e[v]++,"F"!==i&&(e._i[i]=o)),e},getEntry:m,setStrong:function(e,t,n){c(e,t,function(e,n){this._t=p(e,t),this._k=n,this._l=void 0},function(){for(var e=this,t=e._k,n=e._l;n&&n.r;)n=n.p;return e._t&&(e._l=n=n?n.n:e._t._f)?"keys"==t?l(0,n.k):"values"==t?l(0,n.v):l(0,[n.k,n.v]):(e._t=void 0,l(1))},n?"entries":"values",!n,!0),f(t)}}},function(e,t,n){var r=n(213);e.exports=function(e,t){return new(r(e))(t)}},function(e,t,n){var r=n(6),i=n(95),o=n(5)("species");e.exports=function(e){var t;return i(e)&&(t=e.constructor,"function"!=typeof t||t!==Array&&!i(t.prototype)||(t=void 0),r(t)&&null===(t=t[o])&&(t=void 0)),void 0===t?Array:t}},function(e,t,n){var r=n(4);r(r.P+r.R,"Set",{toJSON:n(215)("Set")})},function(e,t,n){var r=n(41),i=n(216);e.exports=function(e){return function(){if(r(this)!=e)throw TypeError(e+"#toJSON isn't generic");return i(this)}}},function(e,t,n){var r=n(25);e.exports=function(e,t){var n=[];return r(e,!1,n.push,n,t),n}},function(e,t,n){n(105)("Set")},function(e,t,n){n(106)("Set")},function(e,t,n){e.exports={default:n(220),__esModule:!0}},function(e,t,n){n(37),n(24),n(221),n(223),n(224),e.exports=n(1).WeakMap},function(e,t,n){"use strict";var r,i=n(3),o=n(74)(0),s=n(57),a=n(29),u=n(107),c=n(222),l=n(6),f=n(36),h=n(36),d=!i.ActiveXObject&&"ActiveXObject"in i,p=a.getWeak,v=Object.isExtensible,m=c.ufstore,y=function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},g={get:function(e){if(l(e)){var t=p(e);return!0===t?m(f(this,"WeakMap")).get(e):t?t[this._i]:void 0}},set:function(e,t){return c.def(f(this,"WeakMap"),e,t)}},_=e.exports=n(104)("WeakMap",y,g,c,!0,!0);h&&d&&(r=c.getConstructor(y,"WeakMap"),u(r.prototype,g),a.NEED=!0,o(["delete","has","get","set"],function(e){var t=_.prototype,n=t[e];s(t,e,function(t,i){if(l(t)&&!v(t)){this._f||(this._f=new r);var o=this._f[e](t,i);return"set"==e?this:o}return n.call(this,t,i)})}))},function(e,t,n){"use strict";var r=n(43),i=n(29).getWeak,o=n(11),s=n(6),a=n(42),u=n(25),c=n(74),l=n(15),f=n(36),h=c(5),d=c(6),p=0,v=function(e){return e._l||(e._l=new m)},m=function(){this.a=[]},y=function(e,t){return h(e.a,function(e){return e[0]===t})};m.prototype={get:function(e){var t=y(this,e);if(t)return t[1]},has:function(e){return!!y(this,e)},set:function(e,t){var n=y(this,e);n?n[1]=t:this.a.push([e,t])},delete:function(e){var t=d(this.a,function(t){return t[0]===e});return~t&&this.a.splice(t,1),!!~t}},e.exports={getConstructor:function(e,t,n,o){var c=e(function(e,r){a(e,c,t,"_i"),e._t=t,e._i=p++,e._l=void 0,void 0!=r&&u(r,n,e[o],e)});return r(c.prototype,{delete:function(e){if(!s(e))return!1;var n=i(e);return!0===n?v(f(this,t)).delete(e):n&&l(n,this._i)&&delete n[this._i]},has:function(e){if(!s(e))return!1;var n=i(e);return!0===n?v(f(this,t)).has(e):n&&l(n,this._i)}}),c},def:function(e,t,n){var r=i(o(t),!0);return!0===r?v(e).set(t,n):r[e._i]=n,e},ufstore:v}},function(e,t,n){n(105)("WeakMap")},function(e,t,n){n(106)("WeakMap")},function(e,t,n){e.exports={default:n(226),__esModule:!0}},function(e,t,n){n(227);var r=n(1).Object;e.exports=function(e,t){return r.defineProperties(e,t)}},function(e,t,n){var r=n(4);r(r.S+r.F*!n(8),"Object",{defineProperties:n(76)})},function(e,t,n){e.exports={default:n(229),__esModule:!0}},function(e,t,n){n(230),e.exports=n(1).Object.getOwnPropertyDescriptors},function(e,t,n){var r=n(4),i=n(231),o=n(16),s=n(71),a=n(102);r(r.S,"Object",{getOwnPropertyDescriptors:function(e){for(var t,n,r=o(e),u=s.f,c=i(r),l={},f=0;c.length>f;)void 0!==(n=u(r,t=c[f++]))&&a(l,t,n);return l}})},function(e,t,n){var r=n(70),i=n(47),o=n(11),s=n(3).Reflect;e.exports=s&&s.ownKeys||function(e){var t=r.f(o(e)),n=i.f;return n?t.concat(n(e)):t}},function(e,t,n){n(94),e.exports=n(1).Object.getOwnPropertySymbols},function(e,t,n){n(234),e.exports=n(1).Object.assign},function(e,t,n){var r=n(4);r(r.S+r.F,"Object",{assign:n(107)})},function(e,t,n){e.exports={default:n(236),__esModule:!0}},function(e,t,n){n(237),e.exports=n(1).Object.freeze},function(e,t,n){var r=n(6),i=n(29).onFreeze;n(45)("freeze",function(e){return function(t){return e&&r(t)?e(i(t)):t}})},function(e,t,n){var r,i,o;/**
* @license protobuf.js (c) 2013 Daniel Wirtz <[email protected]>
* Released under the Apache License, Version 2.0
* see: https://github.com/dcodeIO/protobuf.js for details
*/
!function(s,a){i=[n(239)],r=a,void 0!==(o="function"==typeof r?r.apply(t,i):r)&&(e.exports=o)}(0,function(e,t){"use strict";var r={};return r.ByteBuffer=e,r.Long=e.Long||null,r.VERSION="5.0.3",r.WIRE_TYPES={},r.WIRE_TYPES.VARINT=0,r.WIRE_TYPES.BITS64=1,r.WIRE_TYPES.LDELIM=2,r.WIRE_TYPES.STARTGROUP=3,r.WIRE_TYPES.ENDGROUP=4,r.WIRE_TYPES.BITS32=5,r.PACKABLE_WIRE_TYPES=[r.WIRE_TYPES.VARINT,r.WIRE_TYPES.BITS64,r.WIRE_TYPES.BITS32],r.TYPES={int32:{name:"int32",wireType:r.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:r.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:r.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:r.WIRE_TYPES.VARINT,defaultValue:r.Long?r.Long.ZERO:void 0},uint64:{name:"uint64",wireType:r.WIRE_TYPES.VARINT,defaultValue:r.Long?r.Long.UZERO:void 0},sint64:{name:"sint64",wireType:r.WIRE_TYPES.VARINT,defaultValue:r.Long?r.Long.ZERO:void 0},bool:{name:"bool",wireType:r.WIRE_TYPES.VARINT,defaultValue:!1},double:{name:"double",wireType:r.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:r.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:r.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:r.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:r.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:r.WIRE_TYPES.BITS64,defaultValue:r.Long?r.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:r.WIRE_TYPES.BITS64,defaultValue:r.Long?r.Long.ZERO:void 0},float:{name:"float",wireType:r.WIRE_TYPES.BITS32,defaultValue:0},enum:{name:"enum",wireType:r.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:r.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:r.WIRE_TYPES.STARTGROUP,defaultValue:null}},r.MAP_KEY_TYPES=[r.TYPES.int32,r.TYPES.sint32,r.TYPES.sfixed32,r.TYPES.uint32,r.TYPES.fixed32,r.TYPES.int64,r.TYPES.sint64,r.TYPES.sfixed64,r.TYPES.uint64,r.TYPES.fixed64,r.TYPES.bool,r.TYPES.string,r.TYPES.bytes],r.ID_MIN=1,r.ID_MAX=536870911,r.convertFieldsToCamelCase=!1,r.populateAccessors=!0,r.populateDefaults=!0,r.Util=function(){var e={};return e.IS_NODE=!("object"!=typeof process||process+""!="[object process]"||process.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<e.length;n++){try{t=e[n]()}catch(e){continue}break}if(!t)throw Error("XMLHttpRequest is not supported");return t},e.fetch=function(t,r){if(r&&"function"!=typeof r&&(r=null),e.IS_NODE){var i=n(241);if(r)i.readFile(t,function(e,t){r(e?null:""+t)});else try{return i.readFileSync(t)}catch(e){return null}}else{var o=e.XHR();if(o.open("GET",t,!!r),o.setRequestHeader("Accept","text/plain"),"function"==typeof o.overrideMimeType&&o.overrideMimeType("text/plain"),!r)return o.send(null),200==o.status||0==o.status&&"string"==typeof o.responseText?o.responseText:null;if(o.onreadystatechange=function(){4==o.readyState&&r(200==o.status||0==o.status&&"string"==typeof o.responseText?o.responseText:null)},4==o.readyState)return;o.send(null)}},e.toCamelCase=function(e){return e.replace(/_([a-zA-Z])/g,function(e,t){return t.toUpperCase()})},e}(),r.Lang={DELIM:/[\s\{\}=;:\[\],'"\(\)<>]/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},r.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;n<r;++n)this.children[n]instanceof e&&t.push(this.children[n]);return t},c.addChild=function(e){var t;if(t=this.getChild(e.name))if(t instanceof h.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof h.Field&&e.name!==e.originalName&&null===this.getChild(e.originalName)))throw Error("Duplicate name in namespace "+this.toString(!0)+": "+e.name);e.name=e.originalName}this.children.push(e)},c.getChild=function(e){for(var t="number"==typeof e?"id":"name",n=0,r=this.children.length;n<r;++n)if(this.children[n][t]===e)return this.children[n];return null},c.resolve=function(e,t){var n="string"==typeof e?e.split("."):e,r=this,i=0;if(""===n[i]){for(;null!==r.parent;)r=r.parent;i++}var s;do{do{if(!(r instanceof o.Namespace)){r=null;break}if(!(s=r.getChild(n[i]))||!(s instanceof o.T)||t&&!(s instanceof o.Namespace)){r=null;break}r=s,i++}while(i<n.length);if(null!=r)break;if(null!==this.parent)return this.parent.resolve(e,t)}while(null!=r);return r},c.qn=function(e){var t=[],n=e;do{t.unshift(n.name),n=n.parent}while(null!==n);for(var r=1;r<=t.length;r++){var i=t.slice(t.length-r);if(e===this.resolve(i,e instanceof o.Namespace))return i.join(".")}return e.fqn()},c.build=function(){for(var e,t={},n=this.children,r=0,i=n.length;r<i;++r)(e=n[r])instanceof u&&(t[e.name]=e.build());return Object.defineProperty&&Object.defineProperty(t,"$options",{value:this.buildOpt()}),t},c.buildOpt=function(){for(var e={},t=Object.keys(this.options),n=0,r=t.length;n<r;++n){var i=t[n],o=this.options[t[n]];e[i]=o}return e},c.getOption=function(e){return void 0===e?this.options:void 0!==this.options[e]?this.options[e]:null},o.Namespace=u;var l=function(e,n,r,i,o){if(this.type=e,this.resolvedType=n,this.isMapKey=r,this.syntax=i,this.name=o,r&&t.MAP_KEY_TYPES.indexOf(e)<0)throw Error("Invalid map key type: "+e.name)},f=l.prototype;l.defaultFieldValue=n,f.toString=function(){return(this.name||"")+(this.isMapKey?"map":"value")+" element"},f.verifyValue=function(n){function i(e,t){throw Error("Illegal value for "+o.toString(!0)+" of type "+o.type.name+": "+e+" ("+t+")")}var o=this;switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:return("number"!=typeof n||n===n&&n%1!=0)&&i(typeof n,"not an integer"),n>4294967295?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;u<s.length;u++){if(s[u].name==n)return s[u].id;if(s[u].id==n)return s[u].id}if("proto3"===this.syntax)return("number"!=typeof n||n===n&&n%1!=0)&&i(typeof n,"not an integer"),(n>4294967295||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()<o)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+o+" required but got only "+e.remaining());return i=e.clone(),i.limit=i.offset+o,e.offset+=o,i;case t.TYPES.message:return o=e.readVarint32(),this.resolvedType.decode(e,o);case t.TYPES.group:return this.resolvedType.decode(e,-1,r)}throw Error("[INTERNAL] Illegal decode type")},f.valueFromString=function(n){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:case t.TYPES.uint32:case t.TYPES.fixed32:return this.verifyValue(parseInt(n));case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:case t.TYPES.uint64:case t.TYPES.fixed64:return this.verifyValue(n);case t.TYPES.bool:return"true"===n;case t.TYPES.string:return this.verifyValue(n);case t.TYPES.bytes:return e.fromBinary(n)}},f.valueToString=function(e){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===t.TYPES.bytes?e.toString("binary"):e.toString()},o.Element=l;var h=function(e,t,n,r,i,o){u.call(this,e,t,n,r,o),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!i,this._fields=null,this._fieldsById=null,this._fieldsByName=null},d=h.prototype=Object.create(u.prototype);d.build=function(n){if(this.clazz&&!n)return this.clazz;var r=function(t,n){function r(n,i,o,s){if(null===n||"object"!=typeof n){if(s&&s instanceof t.Reflect.Enum){var a=t.Reflect.Enum.getName(s.object,n);if(null!==a)return a}return n}if(e.isByteBuffer(n))return i?n.toBase64():n.toBuffer();if(t.Long.isLong(n))return o?n.toString():t.Long.fromValue(n);var u;if(Array.isArray(n))return u=[],n.forEach(function(e,t){u[t]=r(e,i,o,s)}),u;if(u={},n instanceof t.Map){for(var c=n.entries(),l=c.next();!l.done;l=c.next())u[n.keyElem.valueToString(l.value[0])]=r(l.value[1],i,o,n.valueElem.resolvedType);return u}var f=n.$type,h=void 0;for(var d in n)n.hasOwnProperty(d)&&(f&&(h=f.getChild(d))?u[d]=r(n[d],i,o,h.resolvedType):u[d]=r(n[d],i,o));return u}var i=n.getChildren(t.Reflect.Message.Field),o=n.getChildren(t.Reflect.Message.OneOf),s=function(r,a){t.Builder.Message.call(this);for(var u=0,c=o.length;u<c;++u)this[o[u].name]=null;for(u=0,c=i.length;u<c;++u){var l=i[u];this[l.name]=l.repeated?[]:l.map?new t.Map(l):null,!l.required&&"proto3"!==n.syntax||null===l.defaultValue||(this[l.name]=l.defaultValue)}if(arguments.length>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;u<c;++u)void 0!==(f=arguments[u])&&this.$set(i[u].name,f);else this.$set(r)}},a=s.prototype=Object.create(t.Builder.Message.prototype);a.add=function(e,r,i){var o=n._fieldsByName[e];if(!i){if(!o)throw Error(this+"#"+e+" is undefined");if(!(o instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+o.toString(!0));if(!o.repeated)throw Error(this+"#"+e+" is not a repeated field");r=o.verifyValue(r,!0)}return null===this[e]&&(this[e]=[]),this[e].push(r),this},a.$add=a.add,a.set=function(e,r,i){if(e&&"object"==typeof e){i=r;for(var o in e)e.hasOwnProperty(o)&&void 0!==(r=e[o])&&void 0===n._oneofsByName[o]&&this.$set(o,r,i);return this}var s=n._fieldsByName[e];if(i)this[e]=r;else{if(!s)throw Error(this+"#"+e+" is not a field: undefined");if(!(s instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+s.toString(!0));this[s.name]=r=s.verifyValue(r)}if(s&&s.oneof){var a=this[s.oneof.name];null!==r?(null!==a&&a!==s.name&&(this[a]=null),this[s.oneof.name]=s.name):a===e&&(this[s.oneof.name]=null)}return this},a.$set=a.set,a.get=function(e,r){if(r)return this[e];var i=n._fieldsByName[e];if(!(i&&i instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: undefined");if(!(i instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+i.toString(!0));return this[i.name]},a.$get=a.get;for(var u=0;u<i.length;u++){var c=i[u];c instanceof t.Reflect.Message.ExtensionField||n.builder.options.populateAccessors&&function(e){var t=e.originalName.replace(/(_[a-zA-Z])/g,function(e){return e.toUpperCase().replace("_","")});t=t.substring(0,1).toUpperCase()+t.substring(1);var r=e.originalName.replace(/([A-Z])/g,function(e){return"_"+e}),i=function(t,n){return this[e.name]=n?t:e.verifyValue(t),this},o=function(){return this[e.name]};null===n.getChild("set"+t)&&(a["set"+t]=i),null===n.getChild("set_"+r)&&(a["set_"+r]=i),null===n.getChild("get"+t)&&(a["get"+t]=o),null===n.getChild("get_"+r)&&(a["get_"+r]=o)}(c)}a.encode=function(t,r){"boolean"==typeof t&&(r=t,t=void 0);var i=!1;t||(t=new e,i=!0);var o=t.littleEndian;try{return n.encode(this,t.LE(),r),(i?t.flip():t).LE(o)}catch(e){throw t.LE(o),e}},s.encode=function(e,t,n){return new s(e).encode(t,n)},a.calculate=function(){return n.calculate(this)},a.encodeDelimited=function(t,r){var i=!1;t||(t=new e,i=!0);var o=(new e).LE();return n.encode(this,o,r).flip(),t.writeVarint32(o.remaining()),t.append(o),i?t.flip():t},a.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toArrayBuffer()),e}},a.toArrayBuffer=a.encodeAB,a.encodeNB=function(){try{return this.encode().toBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBuffer()),e}},a.toBuffer=a.encodeNB,a.encode64=function(){try{return this.encode().toBase64()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBase64()),e}},a.toBase64=a.encode64,a.encodeHex=function(){try{return this.encode().toHex()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toHex()),e}},a.toHex=a.encodeHex,a.toRaw=function(e,t){return r(this,!!e,!!t,this.$type)},a.encodeJSON=function(){return JSON.stringify(r(this,!0,!0,this.$type))},s.decode=function(t,r,i){"string"==typeof r&&(i=r,r=-1),"string"==typeof t?t=e.wrap(t,i||"base64"):e.isByteBuffer(t)||(t=e.wrap(t));var o=t.littleEndian;try{var s=n.decode(t.LE(),r);return t.LE(o),s}catch(e){throw t.LE(o),e}},s.decodeDelimited=function(t,r){if("string"==typeof t?t=e.wrap(t,r||"base64"):e.isByteBuffer(t)||(t=e.wrap(t)),t.remaining()<1)return null;var i=t.offset,o=t.readVarint32();if(t.remaining()<o)return t.offset=i,null;try{var s=n.decode(t.slice(t.offset,t.offset+o).LE());return t.offset+=o,s}catch(e){throw t.offset+=o,e}},s.decode64=function(e){return s.decode(e,"base64")},s.decodeHex=function(e){return s.decode(e,"hex")},s.decodeJSON=function(e){return new s(JSON.parse(e))},a.toString=function(){return n.toString()};return Object.defineProperty&&(Object.defineProperty(s,"$options",{value:n.buildOpt()}),Object.defineProperty(a,"$options",{value:s.$options}),Object.defineProperty(s,"$type",{value:n}),Object.defineProperty(a,"$type",{value:n})),s}(t,this);this._fields=[],this._fieldsById={},this._fieldsByName={},this._oneofsByName={};for(var i,o=0,s=this.children.length;o<s;o++)if((i=this.children[o])instanceof g||i instanceof h||i instanceof w){if(r.hasOwnProperty(i.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+i.toString(!0)+" cannot override static property '"+i.name+"'");r[i.name]=i.build()}else if(i instanceof h.Field)i.build(),this._fields.push(i),this._fieldsById[i.id]=i,this._fieldsByName[i.name]=i;else if(i instanceof h.OneOf)this._oneofsByName[i.name]=i;else if(!(i instanceof h.OneOf||i instanceof b))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[o].toString(!0));return this.clazz=r},d.encode=function(e,t,n){for(var r,i,o=null,s=0,a=this._fields.length;s<a;++s)r=this._fields[s],i=e[r.name],r.required&&null===i?null===o&&(o=r):r.encode(n?i:r.verifyValue(i),t,e);if(null!==o){var u=Error("Missing at least one required field for "+this.toString(!0)+": "+o);throw u.encoded=t,u}return t},d.calculate=function(e){for(var t,n,r=0,i=0,o=this._fields.length;i<o;++i){if(t=this._fields[i],n=e[t.name],t.required&&null===n)throw Error("Missing at least one required field for "+this.toString(!0)+": "+t);r+=t.calculate(n,e)}return r},d.decode=function(e,n,r){"number"!=typeof n&&(n=-1);for(var o,s,a,u,c=e.offset,l=new this.clazz;e.offset<c+n||-1===n&&e.remaining()>0;){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,v=this._fields.length;p<v;++p)if(u=this._fields[p],null===l[u.name])if("proto3"===this.syntax)l[u.name]=u.defaultValue;else{if(u.required){var m=Error("Missing at least one required field for "+this.toString(!0)+": "+u.name);throw m.decoded=l,m}t.populateDefaults&&null!==u.defaultValue&&(l[u.name]=u.defaultValue)}return l},o.Message=h;var p=function(e,n,r,i,o,a,u,c,l,f){s.call(this,e,n,a),this.className="Message.Field",this.required="required"===r,this.repeated="repeated"===r,this.map="map"===r,this.keyType=i||null,this.type=o,this.resolvedType=null,this.id=u,this.options=c||{},this.defaultValue=null,this.oneof=l||null,this.syntax=f||"proto2",this.originalName=this.name,this.element=null,this.keyElement=null,!this.builder.options.convertFieldsToCamelCase||this instanceof h.ExtensionField||(this.name=t.Util.toCamelCase(this.name))},v=p.prototype=Object.create(s.prototype);v.build=function(){this.element=new l(this.type,this.resolvedType,!1,this.syntax,this.name),this.map&&(this.keyElement=new l(this.keyType,void 0,!0,this.syntax,this.name)),"proto3"!==this.syntax||this.repeated||this.map?void 0!==this.options.default&&(this.defaultValue=this.verifyValue(this.options.default)):this.defaultValue=l.defaultFieldValue(this.type)},v.verifyValue=function(e,n){function r(e,t){throw Error("Illegal value for "+i.toString(!0)+" of type "+i.type.name+": "+e+" ("+t+")")}n=n||!1;var i=this;if(null===e)return this.required&&r(typeof e,"required"),"proto3"===this.syntax&&this.type!==t.TYPES.message&&r(typeof e,"proto3 field without field presence cannot be null"),null;var o;if(this.repeated&&!n){Array.isArray(e)||(e=[e]);var s=[];for(o=0;o<e.length;o++)s.push(this.element.verifyValue(e[o]));return s}return this.map&&!n?e instanceof t.Map?e:(e instanceof Object||r(typeof e,"expected ProtoBuf.Map or raw object for map field"),new t.Map(this,e)):(!this.repeated&&Array.isArray(e)&&r(typeof e,"no array expected"),this.element.verifyValue(e))},v.hasWirePresence=function(e,n){if("proto3"!==this.syntax)return null!==e;if(this.oneof&&n[this.oneof.name]===this.name)return!0;switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:case t.TYPES.uint32:case t.TYPES.fixed32:return 0!==e;case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:case t.TYPES.uint64:case t.TYPES.fixed64:return 0!==e.low||0!==e.high;case t.TYPES.bool:return e;case t.TYPES.float:case t.TYPES.double:return 0!==e;case t.TYPES.string:return e.length>0;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}},v.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;o<n.length;o++)this.element.encodeValue(this.id,n[o],r);var a=r.offset-s,u=e.calculateVarint32(a);if(u>1){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<n.length;o++)r.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,n[o],r)}else this.map?n.forEach(function(n,i,o){var s=e.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,i)+e.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,n);r.writeVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),r.writeVarint32(s),r.writeVarint32(8|this.keyType.wireType),this.keyElement.encodeValue(1,i,r),r.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,n,r)},this):this.hasWirePresence(n,i)&&(r.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,n,r))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+n+" ("+e+")")}return r},v.calculate=function(n,r){if(n=this.verifyValue(n),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 0;var i=0;try{if(this.repeated){var o,s;if(this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(i+=e.calculateVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),s=0,o=0;o<n.length;o++)s+=this.element.calculateLength(this.id,n[o]);i+=e.calculateVarint32(s),i+=s}else for(o=0;o<n.length;o++)i+=e.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,n[o])}else this.map?n.forEach(function(n,r,o){var s=e.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,r)+e.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,n);i+=e.calculateVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),i+=e.calculateVarint32(s),i+=s},this):this.hasWirePresence(n,r)&&(i+=e.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,n))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+n+" ("+e+")")}return i},v.decode=function(e,n,r){var i,o;if(!(!this.map&&e==this.type.wireType||!r&&this.repeated&&this.options.packed&&e==t.WIRE_TYPES.LDELIM||this.map&&e==t.WIRE_TYPES.LDELIM))throw Error("Illegal wire type for field "+this.toString(!0)+": "+e+" ("+this.type.wireType+" expected)");if(e==t.WIRE_TYPES.LDELIM&&this.repeated&&this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0&&!r){o=n.readVarint32(),o=n.offset+o;for(var s=[];n.offset<o;)s.push(this.decode(this.type.wireType,n,!0));return s}if(this.map){var a=l.defaultFieldValue(this.keyType);if(i=l.defaultFieldValue(this.type),o=n.readVarint32(),n.remaining()<o)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+o+" required but got only "+n.remaining());var u=n.clone();for(u.limit=u.offset+o,n.offset+=o;u.remaining()>0;){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 y=function(e,t,n){s.call(this,e,t,n),this.fields=[]};o.Message.OneOf=y;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;i<r.length;++i)if(e[n=r[i]]===t)return n;return null},(g.prototype=Object.create(u.prototype)).build=function(e){if(this.object&&!e)return this.object;for(var n=new t.Builder.Enum,r=this.getChildren(g.Value),i=0,o=r.length;i<o;++i)n[r[i].name]=r[i].id;return Object.defineProperty&&Object.defineProperty(n,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=n},o.Enum=g;var _=function(e,t,n,r){s.call(this,e,t,n),this.className="Enum.Value",this.id=r};_.prototype=Object.create(s.prototype),o.Enum.Value=_;var b=function(e,t,n,r){s.call(this,e,t,n),this.field=r};b.prototype=Object.create(s.prototype),o.Extension=b;var w=function(e,t,n,r){u.call(this,e,t,n,r),this.className="Service",this.clazz=null};(w.prototype=Object.create(u.prototype)).build=function(n){return this.clazz&&!n?this.clazz:this.clazz=function(t,n){for(var r=function(e){t.Builder.Service.call(this),this.rpcImpl=e||function(e,t,n){setTimeout(n.bind(this,Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")),0)}},i=r.prototype=Object.create(t.Builder.Service.prototype),o=n.getChildren(t.Reflect.Service.RPCMethod),s=0;s<o.length;s++)!function(t){i[t.name]=function(r,i){try{try{r=t.resolvedRequestType.clazz.decode(e.wrap(r))}catch(e){if(!(e instanceof TypeError))throw e}if(null===r||"object"!=typeof r)throw Error("Illegal arguments");r instanceof t.resolvedRequestType.clazz||(r=new t.resolvedRequestType.clazz(r)),this.rpcImpl(t.fqn(),r,function(e,r){if(e)return void i(e);null===r&&(r="");try{r=t.resolvedResponseType.clazz.decode(r)}catch(e){}if(!(r&&r instanceof t.resolvedResponseType.clazz))return void i(Error("Illegal response type received in service method "+n.name+"#"+t.name));i(null,r)})}catch(e){setTimeout(i.bind(this,e),0)}},r[t.name]=function(e,n,i){new r(e)[t.name](n,i)},Object.defineProperty&&(Object.defineProperty(r[t.name],"$options",{value:t.buildOpt()}),Object.defineProperty(i[t.name],"$options",{value:r[t.name].$options}))}(o[s]);return Object.defineProperty&&(Object.defineProperty(r,"$options",{value:n.buildOpt()}),Object.defineProperty(i,"$options",{value:r.$options}),Object.defineProperty(r,"$type",{value:n}),Object.defineProperty(i,"$type",{value:n})),r}(t,this)},o.Service=w;var E=function(e,t,n,r){s.call(this,e,t,n),this.className="Service.Method",this.options=r||{}};(E.prototype=Object.create(s.prototype)).buildOpt=c.buildOpt,o.Service.Method=E;var T=function(e,t,n,r,i,o,s,a){E.call(this,e,t,n,a),this.className="Service.RPCMethod",this.requestName=r,this.responseName=i,this.requestStream=o,this.responseStream=s,this.resolvedRequestType=null,this.resolvedResponseType=null};return T.prototype=Object.create(E.prototype),o.Service.RPCMethod=T,o}(r),r.Builder=function(e,t,r){function i(e){e.messages&&e.messages.forEach(function(t){t.syntax=e.syntax,i(t)}),e.enums&&e.enums.forEach(function(t){t.syntax=e.syntax})}var o=function(e){this.ns=new r.Namespace(this,null,""),this.ptr=this.ns,this.resolved=!1,this.result=null,this.files={},this.importRoot=null,this.options=e||{}},s=o.prototype;return o.isMessage=function(e){return"string"==typeof e.name&&(void 0===e.values&&void 0===e.rpc)},o.isMessageField=function(e){return"string"==typeof e.rule&&"string"==typeof e.name&&"string"==typeof e.type&&void 0!==e.id},o.isEnum=function(e){return"string"==typeof e.name&&!(void 0===e.values||!Array.isArray(e.values)||0===e.values.length)},o.isService=function(e){return!("string"!=typeof e.name||"object"!=typeof e.rpc||!e.rpc)},o.isExtend=function(e){return"string"==typeof e.ref},s.reset=function(){return this.ptr=this.ns,this},s.define=function(e){if("string"!=typeof e||!t.TYPEREF.test(e))throw Error("illegal namespace: "+e);return e.split(".").forEach(function(e){var t=this.ptr.getChild(e);null===t&&this.ptr.addChild(t=new r.Namespace(this,this.ptr,e)),this.ptr=t},this),this},s.create=function(t){if(!t)return this;if(Array.isArray(t)){if(0===t.length)return this;t=t.slice()}else t=[t];for(var n=[t];n.length>0;){if(t=n.pop(),!Array.isArray(t))throw Error("not a valid namespace: "+JSON.stringify(t));for(;t.length>0;){var i=t.shift();if(o.isMessage(i)){var s=new r.Message(this,this.ptr,i.name,i.options,i.isGroup,i.syntax),a={};i.oneofs&&Object.keys(i.oneofs).forEach(function(e){s.addChild(a[e]=new r.Message.OneOf(this,s,e))},this),i.fields&&i.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 r.Message.Field(this,s,e.rule,e.keytype,e.type,e.name,e.id,e.options,t,i.syntax),t&&t.fields.push(e),s.addChild(e)},this);var u=[];if(i.enums&&i.enums.forEach(function(e){u.push(e)}),i.messages&&i.messages.forEach(function(e){u.push(e)}),i.services&&i.services.forEach(function(e){u.push(e)}),i.extensions&&("number"==typeof i.extensions[0]?s.extensions=[i.extensions]:s.extensions=i.extensions),this.ptr.addChild(s),u.length>0){n.push(t),t=u,u=null,this.ptr=s,s=null;continue}u=null}else if(o.isEnum(i))s=new r.Enum(this,this.ptr,i.name,i.options,i.syntax),i.values.forEach(function(e){s.addChild(new r.Enum.Value(this,s,e.name,e.id))},this),this.ptr.addChild(s);else if(o.isService(i))s=new r.Service(this,this.ptr,i.name,i.options),Object.keys(i.rpc).forEach(function(e){var t=i.rpc[e];s.addChild(new r.Service.RPCMethod(this,s,e,t.request,t.response,!!t.request_stream,!!t.response_stream,t.options))},this),this.ptr.addChild(s);else{if(!o.isExtend(i))throw Error("not a valid definition: "+JSON.stringify(i));if(s=this.ptr.resolve(i.ref,!0))i.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 n=!1;if(s.extensions.forEach(function(e){t.id>=e[0]&&t.id<=e[1]&&(n=!0)}),!n)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 r.Message.ExtensionField(this,s,t.rule,t.type,this.ptr.fqn()+"."+i,t.id,t.options),a=new r.Extension(this,this.ptr,t.name,o);o.extension=a,this.ptr.addChild(a),s.addChild(o)},this);else if(!/\.?google\.protobuf\./.test(i.ref))throw Error("extended message "+i.ref+" is not defined")}i=null,s=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},s.import=function(t,r){var o="/";if("string"==typeof r){if(e.Util.IS_NODE&&(r=n(49).resolve(r)),!0===this.files[r])return this.reset();this.files[r]=!0}else if("object"==typeof r){var s=r.root;e.Util.IS_NODE&&(s=n(49).resolve(s)),(s.indexOf("\\")>=0||r.file.indexOf("\\")>=0)&&(o="\\");var a;if(a=e.Util.IS_NODE?n(49).join(s,r.file):s+o+r.file,!0===this.files[a])return this.reset();this.files[a]=!0}if(t.imports&&t.imports.length>0){var u,c=!1;"object"==typeof r?(this.importRoot=r.root,c=!0,u=this.importRoot,r=r.file,(u.indexOf("\\")>=0||r.indexOf("\\")>=0)&&(o="\\")):"string"==typeof r?this.importRoot?u=this.importRoot:r.indexOf("/")>=0?""===(u=r.replace(/\/[^\/]*$/,""))&&(u="/"):r.indexOf("\\")>=0?(u=r.replace(/\\[^\\]*$/,""),o="\\"):u=".":u=null;for(var l=0;l<t.imports.length;l++)if("string"==typeof t.imports[l]){if(!u)throw Error("cannot determine import root");var f=t.imports[l];if("google/protobuf/descriptor.proto"===f)continue;if(f=e.Util.IS_NODE?n(49).join(u,f):u+o+f,!0===this.files[f])continue;/\.proto$/i.test(f)&&!e.DotProto&&(f=f.replace(/\.proto$/,".json"));var h=e.Util.fetch(f);if(null===h)throw Error("failed to import '"+f+"' in '"+r+"': file not found");/\.json$/i.test(f)?this.import(JSON.parse(h+""),f):this.import(e.DotProto.Parser.parse(h),f)}else r?/\.(\w+)$/.test(r)?this.import(t.imports[l],r.replace(/^(.+)\.(\w+)$/,function(e,t,n){return t+"_import"+l+"."+n})):this.import(t.imports[l],r+"_import"+l):this.import(t.imports[l]);c&&(this.importRoot=null)}t.package&&this.define(t.package),t.syntax&&i(t);var d=this.ptr;return t.options&&Object.keys(t.options).forEach(function(e){d.options[e]=t.options[e]}),t.messages&&(this.create(t.messages),this.ptr=d),t.enums&&(this.create(t.enums),this.ptr=d),t.services&&(this.create(t.services),this.ptr=d),t.extends&&this.create(t.extends),this.reset()},s.resolveAll=function(){var n;if(null==this.ptr||"object"==typeof this.ptr.type)return this;if(this.ptr instanceof r.Namespace)this.ptr.children.forEach(function(e){this.ptr=e,this.resolveAll()},this);else if(this.ptr instanceof r.Message.Field){if(t.TYPE.test(this.ptr.type))this.ptr.type=e.TYPES[this.ptr.type];else{if(!t.TYPEREF.test(this.ptr.type))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(!(n=(this.ptr instanceof r.Message.ExtensionField?this.ptr.extension.parent:this.ptr.parent).resolve(this.ptr.type,!0)))throw Error("unresolvable type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(this.ptr.resolvedType=n,n instanceof r.Enum){if(this.ptr.type=e.TYPES.enum,"proto3"===this.ptr.syntax&&"proto3"!==n.syntax)throw Error("proto3 message cannot reference proto2 enum")}else{if(!(n instanceof r.Message))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.type=n.isGroup?e.TYPES.group:e.TYPES.message}}if(this.ptr.map){if(!t.TYPE.test(this.ptr.keyType))throw Error("illegal key type for map field in "+this.ptr.toString(!0)+": "+this.ptr.keyType);this.ptr.keyType=e.TYPES[this.ptr.keyType]}"proto3"===this.ptr.syntax&&this.ptr.repeated&&void 0===this.ptr.options.packed&&-1!==e.PACKABLE_WIRE_TYPES.indexOf(this.ptr.type.wireType)&&(this.ptr.options.packed=!0)}else if(this.ptr instanceof e.Reflect.Service.Method){if(!(this.ptr instanceof e.Reflect.Service.RPCMethod))throw Error("illegal service type in "+this.ptr.toString(!0));if(!((n=this.ptr.parent.resolve(this.ptr.requestName,!0))&&n instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);if(this.ptr.resolvedRequestType=n,!((n=this.ptr.parent.resolve(this.ptr.responseName,!0))&&n instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=n}else if(!(this.ptr instanceof e.Reflect.Message.OneOf||this.ptr instanceof e.Reflect.Extension||this.ptr instanceof e.Reflect.Enum.Value))throw Error("illegal object in namespace: "+typeof this.ptr+": "+this.ptr);return this.reset()},s.build=function(e){if(this.reset(),this.resolved||(this.resolveAll(),this.resolved=!0,this.result=null),null===this.result&&(this.result=this.ns.build()),!e)return this.result;for(var t="string"==typeof e?e.split("."):e,n=this.result,r=0;r<t.length;r++){if(!n[t[r]]){n=null;break}n=n[t[r]]}return n},s.lookup=function(e,t){return e?this.ns.resolve(e,t):this.ns},s.toString=function(){return"Builder"},o.Message=function(){},o.Enum=function(){},o.Service=function(){},o}(r,r.Lang,r.Reflect),r.Map=function(e,t){function n(e){var t=0;return{next:function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}}}var r=function(e,n){if(!e.map)throw Error("field is not a map");if(this.field=e,this.keyElem=new t.Element(e.keyType,null,!0,e.syntax),this.valueElem=new t.Element(e.type,e.resolvedType,!1,e.syntax),this.map={},Object.defineProperty(this,"size",{get:function(){return Object.keys(this.map).length}}),n)for(var r=Object.keys(n),i=0;i<r.length;i++){var o=this.keyElem.valueFromString(r[i]),s=this.valueElem.verifyValue(n[r[i]]);this.map[this.keyElem.valueToString(o)]={key:o,value:s}}},i=r.prototype;return i.clear=function(){this.map={}},i.delete=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e)),n=t in this.map;return delete this.map[t],n},i.entries=function(){for(var e,t=[],r=Object.keys(this.map),i=0;i<r.length;i++)t.push([(e=this.map[r[i]]).key,e.value]);return n(t)},i.keys=function(){for(var e=[],t=Object.keys(this.map),r=0;r<t.length;r++)e.push(this.map[t[r]].key);return n(e)},i.values=function(){for(var e=[],t=Object.keys(this.map),r=0;r<t.length;r++)e.push(this.map[t[r]].value);return n(e)},i.forEach=function(e,t){for(var n,r=Object.keys(this.map),i=0;i<r.length;i++)e.call(t,(n=this.map[r[i]]).value,n.key,this)},i.set=function(e,t){var n=this.keyElem.verifyValue(e),r=this.valueElem.verifyValue(t);return this.map[this.keyElem.valueToString(n)]={key:n,value:r},this},i.get=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e));if(t in this.map)return this.map[t].value},i.has=function(e){return this.keyElem.valueToString(this.keyElem.verifyValue(e))in this.map},r}(0,r.Reflect),r.newBuilder=function(e){return e=e||{},void 0===e.convertFieldsToCamelCase&&(e.convertFieldsToCamelCase=r.convertFieldsToCamelCase),void 0===e.populateAccessors&&(e.populateAccessors=r.populateAccessors),new r.Builder(e)},r.loadJson=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=null),t&&"object"==typeof t||(t=r.newBuilder()),"string"==typeof e&&(e=JSON.parse(e)),t.import(e,n),t.resolveAll(),t},r.loadJsonFile=function(e,t,n){if(t&&"object"==typeof t?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return r.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,function(i){if(null===i)return void t(Error("Failed to fetch file"));try{t(null,r.loadJson(JSON.parse(i),n,e))}catch(e){t(e)}});var i=r.Util.fetch("object"==typeof e?e.root+"/"+e.file:e);return null===i?null:r.loadJson(JSON.parse(i),n,e)},r})},function(e,t,n){var r,i,o;/**
* @license bytebuffer.js (c) 2015 Daniel Wirtz <[email protected]>
* Backing buffer: ArrayBuffer, Accessor: Uint8Array
* Released under the Apache License, Version 2.0
* see: https://github.com/dcodeIO/bytebuffer.js for details
*/
!function(s,a){i=[n(240)],r=a,void 0!==(o="function"==typeof r?r.apply(t,i):r)&&(e.exports=o)}(0,function(e){"use strict";function t(e){var t=0;return function(){return t<e.length?e.charCodeAt(t++):null}}function n(){var e=[],t=[];return function(){if(0===arguments.length)return t.join("")+u.apply(String,e);e.length+arguments.length>1024&&(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<<a)-1,c=u>>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<<c)-1,f=l>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,v=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<<i|a,c+=i;c>0;e[n+d]=255&s,d+=p,s/=256,c-=8);e[n+d-p]|=128*v}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;a<u;++a)o.isByteBuffer(e[a])||(e[a]=o.wrap(e[a],t)),(i=e[a].limit-e[a].offset)>0&&(s+=i);if(0===s)return new o(0,n,r);var c,l=new o(s,n,r);for(a=0;a<u;)c=e[a++],(i=c.limit-c.offset)<=0||(l.view.set(c.view.subarray(c.offset,c.limit),l.offset),l.offset+=i);return l.limit=l.offset,l.offset=0,l},o.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},o.type=function(){return ArrayBuffer},o.wrap=function(e,t,n,r){if("string"!=typeof t&&(r=n,n=t,t=void 0),"string"==typeof e)switch(void 0===t&&(t="utf8"),t){case"base64":return o.fromBase64(e,n);case"hex":return o.fromHex(e,n);case"binary":return o.fromBinary(e,n);case"utf8":return o.fromUTF8(e,n);case"debug":return o.fromDebug(e,n);default:throw Error("Unsupported encoding: "+t)}if(null===e||"object"!=typeof e)throw TypeError("Illegal buffer");var i;if(o.isByteBuffer(e))return i=s.clone.call(e),i.markedOffset=-1,i;if(e instanceof Uint8Array)i=new o(0,n,r),e.length>0&&(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<e.length;++a)i.view[a]=e[a]}return i},s.writeBitSet=function(e,t){var n=void 0===t;if(n&&(t=this.offset),!this.noAssert){if(!(e instanceof Array))throw TypeError("Illegal BitSet: Not an array");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)}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<o){var u=0;for(r=0;a<o;)r|=(1&!!e[a++])<<u++;this.writeByte(r,t++)}return n?(this.offset=t,this):t-i},s.readBitSet=function(e){var t=void 0===e;t&&(e=this.offset);var n,r=this.readVarint32(e),i=r.value,o=i>>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<i){var u=0;for(n=this.readByte(e++);s<i;)a[s++]=!!(n>>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<o;++i)if(0===e.charCodeAt(i))throw RangeError("Illegal str: Contains NULL-characters");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)}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<e&&r<this.limit?this.view[r++]:null}.bind(this),function(e){++a,l.UTF8toUTF16(e,s)}),a!==e)throw RangeError("Illegal range: Truncated data, "+a+" == "+e);return i?(this.offset=r,s()):{string:s(),length:r-u}}if(t===o.METRICS_BYTES){if(!this.noAssert){if("number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=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<c?this.view[r++]:null}.bind(this),s=n(),this.noAssert),r!==c)throw RangeError("Illegal range: Truncated data, "+r+" == "+c);return i?(this.offset=r,s()):{string:s(),length:r-u}}throw TypeError("Unsupported metrics: "+t)},s.readString=s.readUTF8String,s.writeVString=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,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 t<e?this.resize((t*=2)>e?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<n;)this.view[t++]=e;return r&&(this.offset=t),this},s.flip=function(){return this.limit=this.offset,this.offset=0,this},s.mark=function(e){if(e=void 0===e?this.offset:e,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=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<e){var t=new ArrayBuffer(e),n=new Uint8Array(t);n.set(this.view),this.buffer=t,this.view=n}return this},s.reverse=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)}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<i;++r)n[t[r]]=r;return e.encode=function(e,n){for(var r,i;null!==(r=e());)n(t[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 e<t?this.view[e++]:null}.bind(this),r=n()),r()},o.fromBase64=function(e,n){if("string"!=typeof e)throw TypeError("str");var r=new o(e.length/4*3,n),i=0;return c.decode(t(e),function(e){r.view[i++]=e}),r.limit=i,r},o.btoa=function(e){return o.fromBinary(e).toBase64()},o.atob=function(e){return o.fromBase64(e).toBinary()},s.toBinary=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");if(e===t)return"";for(var n=[],r=[];e<t;)n.push(this.view[e++]),n.length>=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);r<i;){if((n=e.charCodeAt(r))>255)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="";n<r;){if(-1!==n&&(t=this.view[n],i+=t<16?"0"+t.toString(16).toUpperCase():t.toString(16).toUpperCase(),e&&(o+=t>32&&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<s;){switch(r=e.charAt(u++)){case"!":if(!n){if(f||h||d){p=!0;break}f=h=d=!0}a.offset=a.markedOffset=a.limit=c,l=!1;break;case"|":if(!n){if(f||d){p=!0;break}f=d=!0}a.offset=a.limit=c,l=!1;break;case"[":if(!n){if(f||h){p=!0;break}f=h=!0}a.offset=a.markedOffset=c,l=!1;break;case"<":if(!n){if(f){p=!0;break}f=!0}a.offset=c,l=!1;break;case"]":if(!n){if(d||h){p=!0;break}d=h=!0}a.limit=a.markedOffset=c,l=!1;break;case">":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<a.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+c+" < "+s)}return a},s.toHex=function(e,t){if(e=void 0===e?this.offset:e,t=void 0===t?this.limit:t,!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)}for(var n,r=new Array(t-e);e<t;)n=this.view[e++],n<16?r.push("0",n.toString(16)):r.push(n.toString(16));return r.join("")},o.fromHex=function(e,t,n){if(!n){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if(e.length%2!=0)throw TypeError("Illegal str: Length not a multiple of 2")}for(var r,i=e.length,s=new o(i/2|0,t),a=0,u=0;a<i;a+=2){if(r=parseInt(e.substring(a,a+2),16),!n&&(!isFinite(r)||r<0||r>255))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<t?this.view[e++]:null}.bind(this),r=n())}catch(n){if(e!==t)throw RangeError("Illegal range: Truncated data, "+e+" != "+t)}return r()},o.fromUTF8=function(e,n,r){if(!r&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var i=new o(l.calculateUTF16asUTF8(t(e),!0)[1],n,r),s=0;return l.encodeUTF16toUTF8(t(e),function(e){i.view[s++]=e}),i.limit=s,i},o})},function(e,t,n){var r,i,o;/**
* @license long.js (c) 2013 Daniel Wirtz <[email protected]>
* Released under the Apache License, Version 2.0
* see: https://github.com/dcodeIO/long.js for details
*/
!function(n,s){i=[],r=s,void 0!==(o="function"==typeof r?r.apply(t,i):r)&&(e.exports=o)}(0,function(){"use strict";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?v:p;if(t){if(e<0)return v;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||36<n)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)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<e.length;u+=8){var l=Math.min(8,e.length-u),f=parseInt(e.substring(u,u+l),n);if(l<8){var h=r(c(n,l));a=a.mul(h).add(r(f))}else a=a.mul(s),a=a.add(r(f))}return a.unsigned=t,a}function s(t){return t instanceof e?t:"number"==typeof t?r(t):"string"==typeof t?o(t):i(t.low,t.high,t.unsigned)}e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=t;var a={},u={};e.fromInt=n,e.fromNumber=r,e.fromBits=i;var c=Math.pow;e.fromString=o,e.fromValue=s;var l=4294967296,f=l*l,h=f/2,d=n(1<<24),p=n(0);e.ZERO=p;var v=n(0,!0);e.UZERO=v;var m=n(1);e.ONE=m;var y=n(1,!0);e.UONE=y;var g=n(-1);e.NEG_ONE=g;var _=i(-1,2147483647,!1);e.MAX_VALUE=_;var b=i(-1,-1,!0);e.MAX_UNSIGNED_VALUE=b;var w=i(0,-2147483648,!1);e.MIN_VALUE=w;var E=e.prototype;return E.toInt=function(){return this.unsigned?this.low>>>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<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(w)){var t=r(e),n=this.div(t),i=n.mul(t).sub(this);return n.toString(e)+i.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var o=r(c(e,6),this.unsigned),s=this,a="";;){var u=s.div(o),l=s.sub(u.mul(o)).toInt()>>>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<<t);t--);return 0!=this.high?t+33:t+1},E.isZero=function(){return 0===this.high&&0===this.low},E.isNegative=function(){return!this.unsigned&&this.high<0},E.isPositive=function(){return this.unsigned||this.high>=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,v=0;return v+=a+f,p+=v>>>16,v&=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|v,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,v=0,m=0,y=0,g=0;return g+=u*h,y+=g>>>16,g&=65535,y+=a*h,m+=y>>>16,y&=65535,y+=u*f,m+=y>>>16,y&=65535,m+=o*h,v+=m>>>16,m&=65535,m+=a*f,v+=m>>>16,m&=65535,m+=u*l,v+=m>>>16,m&=65535,v+=n*h+o*f+a*l+u*c,v&=65535,i(y<<16|g,v<<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?v:p;var n,i,o;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return v;if(e.gt(this.shru(1)))return y;o=v}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?v: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<<e,this.high<<e|this.low>>>32-e,this.unsigned):i(0,this.low<<e-32,this.unsigned)},E.shl=E.shiftLeft,E.shiftRight=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?i(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})},function(e,t){},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,n,r,i){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new o(n,r||e,i),a=p?p+t:t;return e._events[a]?e._events[a].fn?e._events[a]=[e._events[a],s]:e._events[a].push(s):(e._events[a]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function u(){this._events=new i,this._eventsCount=0}var c=n(108),l=r(c),f=n(110),h=r(f),d=Object.prototype.hasOwnProperty,p="~";h.default&&(i.prototype=(0,h.default)(null),(new i).__proto__||(p=!1)),u.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)d.call(e,t)&&n.push(p?t.slice(1):t);return l.default?n.concat((0,l.default)(e)):n},u.prototype.listeners=function(e){var t=p?p+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,i=n.length,o=new Array(i);r<i;r++)o[r]=n[r].fn;return o},u.prototype.listenerCount=function(e){var t=p?p+e:e,n=this._events[t];return n?n.fn?1:n.length:0},u.prototype.emit=function(e,t,n,r,i,o){var s=p?p+e:e;if(!this._events[s])return!1;var a,u,c=this._events[s],l=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,r),!0;case 5:return c.fn.call(c.context,t,n,r,i),!0;case 6:return c.fn.call(c.context,t,n,r,i,o),!0}for(u=1,a=new Array(l-1);u<l;u++)a[u-1]=arguments[u];c.fn.apply(c.context,a)}else{var f,h=c.length;for(u=0;u<h;u++)switch(c[u].once&&this.removeListener(e,c[u].fn,void 0,!0),l){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,t);break;case 3:c[u].fn.call(c[u].context,t,n);break;case 4:c[u].fn.call(c[u].context,t,n,r);break;default:if(!a)for(f=1,a=new Array(l-1);f<l;f++)a[f-1]=arguments[f];c[u].fn.apply(c[u].context,a)}}return!0},u.prototype.on=function(e,t,n){return s(this,e,t,n,!1)},u.prototype.once=function(e,t,n){return s(this,e,t,n,!0)},u.prototype.removeListener=function(e,t,n,r){var i=p?p+e:e;if(!this._events[i])return this;if(!t)return a(this,i),this;var o=this._events[i];if(o.fn)o.fn!==t||r&&!o.once||n&&o.context!==n||a(this,i);else{for(var s=0,u=[],c=o.length;s<c;s++)(o[s].fn!==t||r&&!o[s].once||n&&o[s].context!==n)&&u.push(o[s]);u.length?this._events[i]=1===u.length?u[0]:u:a(this,i)}return this},u.prototype.removeAllListeners=function(e){var t;return e?(t=p?p+e:e,this._events[t]&&a(this,t)):(this._events=new i,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=p,u.EventEmitter=u,e.exports=u},function(e,t,n){n(244);var r=n(1).Object;e.exports=function(e,t){return r.create(e,t)}},function(e,t,n){var r=n(4);r(r.S,"Object",{create:n(38)})},function(e,t,n){e.exports=n(246)},function(e,t,n){var r=function(e){"use strict";function t(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}function n(e,t,n,r){var o=t&&t.prototype instanceof i?t:i,s=Object.create(o.prototype),a=new d(r||[]);return s._invoke=c(e,n,a),s}function r(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function i(){}function o(){}function s(){}function a(e){["next","throw","return"].forEach(function(n){t(e,n,function(e){return this._invoke(n,e)})})}function u(e,t){function n(i,o,s,a){var u=r(e[i],e,o);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==typeof l&&g.call(l,"__await")?t.resolve(l.__await).then(function(e){n("next",e,s,a)},function(e){n("throw",e,s,a)}):t.resolve(l).then(function(e){c.value=e,s(c)},function(e){return n("throw",e,s,a)})}a(u.arg)}function i(e,r){function i(){return new t(function(t,i){n(e,r,t,i)})}return o=o?o.then(i,i):i()}var o;this._invoke=i}function c(e,t,n){var i=T;return function(o,s){if(i===O)throw new Error("Generator is already running");if(i===A){if("throw"===o)throw s;return v()}for(n.method=o,n.arg=s;;){var a=n.delegate;if(a){var u=l(a,n);if(u){if(u===I)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===T)throw i=A,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=O;var c=r(e,t,n);if("normal"===c.type){if(i=n.done?A:S,c.arg===I)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=A,n.method="throw",n.arg=c.arg)}}}function l(e,t){var n=e.iterator[t.method];if(n===m){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=m,l(e,t),"throw"===t.method))return I;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return I}var i=r(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,I;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=m),t.delegate=null,I):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,I)}function f(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function h(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function d(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(f,this),this.reset(!0)}function p(e){if(e){var t=e[b];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(g.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=m,t.done=!0,t};return r.next=r}}return{next:v}}function v(){return{value:m,done:!0}}var m,y=Object.prototype,g=y.hasOwnProperty,_="function"==typeof Symbol?Symbol:{},b=_.iterator||"@@iterator",w=_.asyncIterator||"@@asyncIterator",E=_.toStringTag||"@@toStringTag";try{t({},"")}catch(e){t=function(e,t,n){return e[t]=n}}e.wrap=n;var T="suspendedStart",S="suspendedYield",O="executing",A="completed",I={},x={};x[b]=function(){return this};var C=Object.getPrototypeOf,N=C&&C(C(p([])));N&&N!==y&&g.call(N,b)&&(x=N);var P=s.prototype=i.prototype=Object.create(x);return o.prototype=P.constructor=s,s.constructor=o,o.displayName=t(s,E,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===o||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,t(e,E,"GeneratorFunction")),e.prototype=Object.create(P),e},e.awrap=function(e){return{__await:e}},a(u.prototype),u.prototype[w]=function(){return this},e.AsyncIterator=u,e.async=function(t,r,i,o,s){void 0===s&&(s=Promise);var a=new u(n(t,r,i,o),s);return e.isGeneratorFunction(r)?a:a.next().then(function(e){return e.done?e.value:a.next()})},a(P),t(P,E,"Generator"),P[b]=function(){return this},P.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=p,d.prototype={constructor:d,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=m,this.done=!1,this.delegate=null,this.method="next",this.arg=m,this.tryEntries.forEach(h),!e)for(var t in this)"t"===t.charAt(0)&&g.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=m)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,r){return o.type="throw",o.arg=e,n.next=t,r&&(n.method="next",n.arg=m),!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;r>=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<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!a)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&g.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,I):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),I},finish:function(e){for(var t=this.tryEntries.length-1;t>=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}},e}(e.exports);try{regeneratorRuntime=r}catch(e){Function("r","regeneratorRuntime = r")(r)}},function(e,t){function n(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 r(e){return function(){var t=this,r=arguments;return new Promise(function(i,o){function s(e){n(u,i,o,s,a,"next",e)}function a(e){n(u,i,o,s,a,"throw",e)}var u=e.apply(t,r);s(void 0)})}}e.exports=r},function(e,t,n){function r(e){return i(e)||o(e)||s(e)||a()}var i=n(249),o=n(112),s=n(113),a=n(250);e.exports=r},function(e,t,n){function r(e){if(Array.isArray(e))return i(e)}var i=n(111);e.exports=r},function(e,t){function n(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}e.exports=n},function(e,t){function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}e.exports=n},function(e,t,n){function r(e,t){if(null==e)return{};var n,r,o=i(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var i=n(253);e.exports=r},function(e,t){function n(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}e.exports=n},function(e,t){function n(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}e.exports=n},function(e,t){function n(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}e.exports=n},function(e,t,n){function r(e){return(s(e)?i:o)(e)}var i=n(257),o=n(260),s=n(119);e.exports=r},function(e,t,n){function r(e){return o(i(e))}var i=n(258),o=n(114);e.exports=r},function(e,t){function n(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}e.exports=n},function(e,t){function n(e,t){return e+r(i()*(t-e+1))}var r=Math.floor,i=Math.random;e.exports=n},function(e,t,n){function r(e){return i(o(e))}var i=n(114),o=n(115);e.exports=r},function(e,t,n){function r(e,t){return i(t,function(t){return e[t]})}var i=n(262);e.exports=r},function(e,t){function n(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}e.exports=n},function(e,t,n){function r(e){return s(e)?i(e):o(e)}var i=n(264),o=n(277),s=n(280);e.exports=r},function(e,t,n){function r(e,t){var n=s(e),r=!n&&o(e),l=!n&&!r&&a(e),h=!n&&!r&&!l&&c(e),d=n||r||l||h,p=d?i(e.length,String):[],v=p.length;for(var m in e)!t&&!f.call(e,m)||d&&("length"==m||l&&("offset"==m||"parent"==m)||h&&("buffer"==m||"byteLength"==m||"byteOffset"==m)||u(m,v))||p.push(m);return p}var i=n(265),o=n(266),s=n(119),a=n(270),u=n(272),c=n(273),l=Object.prototype,f=l.hasOwnProperty;e.exports=r},function(e,t){function n(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}e.exports=n},function(e,t,n){var r=n(267),i=n(51),o=Object.prototype,s=o.hasOwnProperty,a=o.propertyIsEnumerable,u=r(function(){return arguments}())?r:function(e){return i(e)&&s.call(e,"callee")&&!a.call(e,"callee")};e.exports=u},function(e,t,n){function r(e){return o(e)&&i(e)==s}var i=n(50),o=n(51),s="[object Arguments]";e.exports=r},function(e,t,n){function r(e){var t=s.call(e,u),n=e[u];try{e[u]=void 0;var r=!0}catch(e){}var i=a.call(e);return r&&(t?e[u]=n:delete e[u]),i}var i=n(116),o=Object.prototype,s=o.hasOwnProperty,a=o.toString,u=i?i.toStringTag:void 0;e.exports=r},function(e,t){function n(e){return i.call(e)}var r=Object.prototype,i=r.toString;e.exports=n},function(e,t,n){(function(e){var r=n(117),i=n(271),o="object"==typeof t&&t&&!t.nodeType&&t,s=o&&"object"==typeof e&&e&&!e.nodeType&&e,a=s&&s.exports===o,u=a?r.Buffer:void 0,c=u?u.isBuffer:void 0,l=c||i;e.exports=l}).call(t,n(64)(e))},function(e,t){function n(){return!1}e.exports=n},function(e,t){function n(e,t){var n=typeof e;return!!(t=null==t?r:t)&&("number"==n||"symbol"!=n&&i.test(e))&&e>-1&&e%1==0&&e<t}var r=9007199254740991,i=/^(?:0|[1-9]\d*)$/;e.exports=n},function(e,t,n){var r=n(274),i=n(275),o=n(276),s=o&&o.isTypedArray,a=s?i(s):r;e.exports=a},function(e,t,n){function r(e){return s(e)&&o(e.length)&&!!a[i(e)]}var i=n(50),o=n(120),s=n(51),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,e.exports=r},function(e,t){function n(e){return function(t){return e(t)}}e.exports=n},function(e,t,n){(function(e){var r=n(118),i="object"==typeof t&&t&&!t.nodeType&&t,o=i&&"object"==typeof e&&e&&!e.nodeType&&e,s=o&&o.exports===i,a=s&&r.process,u=function(){try{var e=o&&o.require&&o.require("util").types;return e||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=u}).call(t,n(64)(e))},function(e,t,n){function r(e){if(!i(e))return o(e);var t=[];for(var n in Object(e))a.call(e,n)&&"constructor"!=n&&t.push(n);return t}var i=n(278),o=n(279),s=Object.prototype,a=s.hasOwnProperty;e.exports=r},function(e,t){function n(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||r)}var r=Object.prototype;e.exports=n},function(e,t,n){var r=n(121),i=r(Object.keys,Object);e.exports=i},function(e,t,n){function r(e){return null!=e&&o(e.length)&&!i(e)}var i=n(281),o=n(120);e.exports=r},function(e,t,n){function r(e){if(!o(e))return!1;var t=i(e);return t==a||t==u||t==s||t==c}var i=n(50),o=n(282),s="[object AsyncFunction]",a="[object Function]",u="[object GeneratorFunction]",c="[object Proxy]";e.exports=r},function(e,t){function n(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}e.exports=n},function(e,t,n){function r(e){return i(e)||o(e)||s(e)||a()}var i=n(284),o=n(112),s=n(113),a=n(285);e.exports=r},function(e,t){function n(e){if(Array.isArray(e))return e}e.exports=n},function(e,t){function n(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}e.exports=n},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function r(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}e.exports=r},function(e,t){function n(e,t,n,r,i){var o={};return Object.keys(r).forEach(function(e){o[e]=r[e]}),o.enumerable=!!o.enumerable,o.configurable=!!o.configurable,("value"in o||o.initializer)&&(o.writable=!0),o=n.slice().reverse().reduce(function(n,r){return r(e,t,n)||n},o),i&&void 0!==o.initializer&&(o.value=o.initializer?o.initializer.call(i):void 0,o.initializer=void 0),void 0===o.initializer&&(Object.defineProperty(e,t,o),o=null),o}e.exports=n},function(e,t,n){!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<t.length;r++)c[t[r]]=c[t[r]]||[],c[t[r]].push(e.name),u[e.name][t[r]]=e.to||t[r];e.to&&(c[e.to]=c[e.to]||[])};r&&(r.event=r.event||"startup",l({name:r.event,from:"none",to:r.state}));for(var f=0;f<s.length;f++)l(s[f]);for(var h in u)u.hasOwnProperty(h)&&(o[h]=n.buildEvent(h,u[h]));for(var h in a)a.hasOwnProperty(h)&&(o[h]=a[h]);return o.current="none",o.is=function(e){return Array.isArray(e)?e.indexOf(this.current)>=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}}};void 0!==e&&e.exports&&(t=e.exports=n),t.StateMachine=n}()},function(e,t){function n(t){"@babel/helpers - typeof";return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=n},function(e,t,n){function r(e){if(!s(e)||i(e)!=a)return!1;var t=o(e);if(null===t)return!0;var n=f.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&l.call(n)==h}var i=n(50),o=n(291),s=n(51),a="[object Object]",u=Function.prototype,c=Object.prototype,l=u.toString,f=c.hasOwnProperty,h=l.call(Object);e.exports=r},function(e,t,n){var r=n(121),i=r(Object.getPrototypeOf,Object);e.exports=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i,o,s,a=n(109),u=r(a),c=n(103),l=r(c),f=n(101),h=r(f),d=n(72),p=r(d),v=n(110),m=r(v),y=n(21),g=r(y);!function(r,a){"object"===(0,g.default)(t)&&void 0!==e?a(t,n(73)):(o=[t,n(73)],i=a,void 0!==(s="function"==typeof i?i.apply(t,o):i)&&(e.exports=s))}(0,function(e,t){function n(e,t){e.prototype=(0,m.default)(t.prototype),e.prototype.constructor=e,e.__proto__=t}function r(e){return i(e)||o(e)||s()}function i(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}function o(e){if((0,p.default)(Object(e))||"[object Arguments]"===Object.prototype.toString.call(e))return(0,h.default)(e)}function s(){throw new TypeError("Invalid attempt to spread non-iterable instance")}if(!t.Protocals)throw new Error("LeanCloud Realtime SDK not installed");var a=t.Protocals.CommandType,c=t.Protocals.GenericCommand,f=t.Protocals.AckCommand,d=function(e){return console.warn(e.message)},v=function(e){function r(n,r,i){var o;return o=e.call(this)||this,o._appId=n,o.id=r,o._connection=i,o._eventemitter=new t.EventEmitter,o._querys=new l.default,o}n(r,e);var i=r.prototype;return i._send=function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return(t=this._connection).send.apply(t,[(0,u.default)(e,{appId:this._appId,installationId:this.id,service:1})].concat(r))},i._open=function(){return this._send(new c({cmd:a.login}))},i.close=function(){var e=this._eventemitter;return e.emit("beforeclose"),this._send(new c({cmd:a.logout})).then(function(){return e.emit("close")})},i.register=function(e){this._querys.add(e)},i.deregister=function(e){var t=this;this._querys.delete(e),setTimeout(function(){t._querys.size||t.close().catch(d)},0)},i._dispatchCommand=function(e){return e.cmd!==a.data?(this.emit("unhandledmessage",e),t.Promise.resolve()):this._dispatchDataCommand(e)},i._dispatchDataCommand=function(e){var t=e.dataMessage,n=t.ids,r=t.msg;this.emit("message",r.map(function(e){var t=e.data;return JSON.parse(t)}));var i=new c({cmd:a.ack,ackMessage:new f({ids:n})});return this._send(i,!1).catch(d)},r}(t.EventEmitter),y=function(e){return[function(t){return e(),t},function(t){throw e(),t}]},g=function(e){e._liveQueryClients={},e.createLiveQueryClient=function(n){var i;if(void 0!==e._liveQueryClients[n])return t.Promise.resolve(e._liveQueryClients[n]);var o=(i=e._open().then(function(t){var r=new v(e._options.appId,n,t);return t.on("reconnect",function(){return r._open().then(function(){return r.emit("reconnect")},function(e){return r.emit("reconnecterror",e)})}),r._eventemitter.on("beforeclose",function(){delete e._liveQueryClients[r.id]},e),r._eventemitter.on("close",function(){e._deregister(r)},e),r._open().then(function(){return e._liveQueryClients[r.id]=r,e._register(r),r})})).then.apply(i,r(y(function(){e._deregisterPending&&e._deregisterPending(o)})));return e._liveQueryClients[n]=o,e._registerPending&&e._registerPending(o),o}},_=function(e,t){if(!e.installationId||1!==e.service)return!0;var n=t._liveQueryClients[e.installationId];return n?n._dispatchCommand(e).catch(function(e){return console.warn(e)}):console.warn("Unexpected message received without any live client match: %O",e),!1},b={name:"leancloud-realtime-plugin-live-query",onRealtimeCreate:g,beforeCommandDispatch:_};e.LiveQueryPlugin=b,Object.defineProperty(e,"__esModule",{value:!0})})}])});
//# sourceMappingURL=av-live-query-min.js.map