pusher-fake 1.12.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/pusher-fake +1 -3
- data/lib/pusher-fake.rb +3 -1
- data/lib/pusher-fake/channel.rb +4 -2
- data/lib/pusher-fake/channel/presence.rb +3 -3
- data/lib/pusher-fake/channel/private.rb +3 -1
- data/lib/pusher-fake/channel/public.rb +2 -0
- data/lib/pusher-fake/configuration.rb +4 -1
- data/lib/pusher-fake/connection.rb +10 -7
- data/lib/pusher-fake/server.rb +2 -0
- data/lib/pusher-fake/server/application.rb +4 -2
- data/lib/pusher-fake/support/base.rb +4 -2
- data/lib/pusher-fake/support/cucumber.rb +2 -0
- data/lib/pusher-fake/support/rspec.rb +2 -0
- data/lib/pusher-fake/webhook.rb +3 -1
- data/spec/features/api/channels_spec.rb +2 -0
- data/spec/features/api/users_spec.rb +2 -0
- data/spec/features/client/connect_spec.rb +2 -0
- data/spec/features/client/event_spec.rb +2 -0
- data/spec/features/client/presence_spec.rb +2 -0
- data/spec/features/client/subscribe_spec.rb +9 -5
- data/spec/features/server/event_spec.rb +2 -0
- data/spec/features/server/webhooks_spec.rb +2 -0
- data/spec/lib/pusher-fake/channel/presence_spec.rb +2 -0
- data/spec/lib/pusher-fake/channel/private_spec.rb +4 -2
- data/spec/lib/pusher-fake/channel/public_spec.rb +2 -0
- data/spec/lib/pusher-fake/channel_spec.rb +2 -0
- data/spec/lib/pusher-fake/configuration_spec.rb +9 -1
- data/spec/lib/pusher-fake/connection_spec.rb +4 -2
- data/spec/lib/pusher-fake/server/application_spec.rb +4 -2
- data/spec/lib/pusher-fake/server_spec.rb +2 -0
- data/spec/lib/pusher-fake/webhook_spec.rb +3 -1
- data/spec/lib/pusher_fake_spec.rb +2 -0
- data/spec/spec_helper.rb +3 -1
- data/spec/support/application.rb +3 -1
- data/spec/support/application/public/javascripts/vendor/polyfill.min.js +1 -0
- data/spec/support/application/public/javascripts/vendor/pusher-7.0.0.js +4565 -0
- data/spec/support/application/views/index.erb +2 -1
- data/spec/support/capybara.rb +4 -7
- data/spec/support/coveralls.rb +2 -0
- data/spec/support/helpers/connect.rb +2 -0
- data/spec/support/helpers/event.rb +2 -0
- data/spec/support/helpers/subscription.rb +2 -0
- data/spec/support/helpers/user.rb +2 -0
- data/spec/support/matchers/have_configuration_option.rb +2 -0
- data/spec/support/pusher_fake.rb +3 -1
- data/spec/support/webhooks.rb +17 -15
- metadata +104 -47
- data/lib/pusher-fake/cucumber.rb +0 -4
- data/spec/support/application/public/javascripts/vendor/pusher-4.2.2.js +0 -4183
data/spec/spec_helper.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "bundler/setup"
|
2
4
|
|
3
5
|
Bundler.require(:default, :development)
|
4
6
|
|
5
|
-
Dir[File.expand_path("support/**/*.rb", __dir__)].each do |file|
|
7
|
+
Dir[File.expand_path("support/**/*.rb", __dir__)].sort.each do |file|
|
6
8
|
require file
|
7
9
|
end
|
8
10
|
|
data/spec/support/application.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "sinatra"
|
2
4
|
require "tilt/erb"
|
3
5
|
|
@@ -22,7 +24,7 @@ module Sinatra
|
|
22
24
|
protected
|
23
25
|
|
24
26
|
def channel_data
|
25
|
-
return unless params[:channel_name]
|
27
|
+
return unless /^presence-/.match?(params[:channel_name])
|
26
28
|
|
27
29
|
{
|
28
30
|
user_id: params[:socket_id],
|
@@ -0,0 +1 @@
|
|
1
|
+
!function r(c,a,f){function o(n,t){if(!a[n]){if(!c[n]){var e="function"==typeof require&&require;if(!t&&e)return e(n,!0);if(s)return s(n,!0);var i=new Error("Cannot find module '"+n+"'");throw i.code="MODULE_NOT_FOUND",i}var u=a[n]={exports:{}};c[n][0].call(u.exports,function(t){return o(c[n][1][t]||t)},u,u.exports,r,c,a,f)}return a[n].exports}for(var s="function"==typeof require&&require,t=0;t<f.length;t++)o(f[t]);return o}({1:[function(t,n,r){t(276),t(212),t(214),t(213),t(216),t(218),t(223),t(217),t(215),t(225),t(224),t(220),t(221),t(219),t(211),t(222),t(226),t(227),t(178),t(180),t(179),t(229),t(228),t(199),t(209),t(210),t(200),t(201),t(202),t(203),t(204),t(205),t(206),t(207),t(208),t(182),t(183),t(184),t(185),t(186),t(187),t(188),t(189),t(190),t(191),t(192),t(193),t(194),t(195),t(196),t(197),t(198),t(263),t(268),t(275),t(266),t(258),t(259),t(264),t(269),t(271),t(254),t(255),t(256),t(257),t(260),t(261),t(262),t(265),t(267),t(270),t(272),t(273),t(274),t(173),t(175),t(174),t(177),t(176),t(161),t(159),t(166),t(163),t(169),t(171),t(158),t(165),t(155),t(170),t(153),t(168),t(167),t(160),t(164),t(152),t(154),t(157),t(156),t(172),t(162),t(245),t(246),t(252),t(247),t(248),t(249),t(250),t(251),t(230),t(181),t(253),t(288),t(289),t(277),t(278),t(283),t(286),t(287),t(281),t(284),t(282),t(285),t(279),t(280),t(231),t(232),t(233),t(234),t(235),t(238),t(236),t(237),t(239),t(240),t(241),t(242),t(244),t(243),n.exports=t(50)},{152:152,153:153,154:154,155:155,156:156,157:157,158:158,159:159,160:160,161:161,162:162,163:163,164:164,165:165,166:166,167:167,168:168,169:169,170:170,171:171,172:172,173:173,174:174,175:175,176:176,177:177,178:178,179:179,180:180,181:181,182:182,183:183,184:184,185:185,186:186,187:187,188:188,189:189,190:190,191:191,192:192,193:193,194:194,195:195,196:196,197:197,198:198,199:199,200:200,201:201,202:202,203:203,204:204,205:205,206:206,207:207,208:208,209:209,210:210,211:211,212:212,213:213,214:214,215:215,216:216,217:217,218:218,219:219,220:220,221:221,222:222,223:223,224:224,225:225,226:226,227:227,228:228,229:229,230:230,231:231,232:232,233:233,234:234,235:235,236:236,237:237,238:238,239:239,240:240,241:241,242:242,243:243,244:244,245:245,246:246,247:247,248:248,249:249,250:250,251:251,252:252,253:253,254:254,255:255,256:256,257:257,258:258,259:259,260:260,261:261,262:262,263:263,264:264,265:265,266:266,267:267,268:268,269:269,270:270,271:271,272:272,273:273,274:274,275:275,276:276,277:277,278:278,279:279,280:280,281:281,282:282,283:283,284:284,285:285,286:286,287:287,288:288,289:289,50:50}],2:[function(t,n,r){t(290),n.exports=t(50).Array.flatMap},{290:290,50:50}],3:[function(t,n,r){t(291),n.exports=t(50).Array.includes},{291:291,50:50}],4:[function(t,n,r){t(292),n.exports=t(50).Object.entries},{292:292,50:50}],5:[function(t,n,r){t(293),n.exports=t(50).Object.getOwnPropertyDescriptors},{293:293,50:50}],6:[function(t,n,r){t(294),n.exports=t(50).Object.values},{294:294,50:50}],7:[function(t,n,r){"use strict";t(230),t(295),n.exports=t(50).Promise.finally},{230:230,295:295,50:50}],8:[function(t,n,r){t(296),n.exports=t(50).String.padEnd},{296:296,50:50}],9:[function(t,n,r){t(297),n.exports=t(50).String.padStart},{297:297,50:50}],10:[function(t,n,r){t(299),n.exports=t(50).String.trimRight},{299:299,50:50}],11:[function(t,n,r){t(298),n.exports=t(50).String.trimLeft},{298:298,50:50}],12:[function(t,n,r){t(300),n.exports=t(149).f("asyncIterator")},{149:149,300:300}],13:[function(t,n,r){t(30),n.exports=t(16).global},{16:16,30:30}],14:[function(t,n,r){n.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},{}],15:[function(t,n,r){var e=t(26);n.exports=function(t){if(!e(t))throw TypeError(t+" is not an object!");return t}},{26:26}],16:[function(t,n,r){var e=n.exports={version:"2.6.11"};"number"==typeof __e&&(__e=e)},{}],17:[function(t,n,r){var o=t(14);n.exports=function(e,i,t){if(o(e),void 0===i)return e;switch(t){case 1:return function(t){return e.call(i,t)};case 2:return function(t,n){return e.call(i,t,n)};case 3:return function(t,n,r){return e.call(i,t,n,r)}}return function(){return e.apply(i,arguments)}}},{14:14}],18:[function(t,n,r){n.exports=!t(21)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},{21:21}],19:[function(t,n,r){var e=t(26),i=t(22).document,o=e(i)&&e(i.createElement);n.exports=function(t){return o?i.createElement(t):{}}},{22:22,26:26}],20:[function(t,n,r){var g=t(22),y=t(16),d=t(17),x=t(24),m=t(23),S="prototype",b=function(t,n,r){var e,i,o,u=t&b.F,c=t&b.G,a=t&b.S,f=t&b.P,s=t&b.B,l=t&b.W,h=c?y:y[n]||(y[n]={}),p=h[S],v=c?g:a?g[n]:(g[n]||{})[S];for(e in c&&(r=n),r)(i=!u&&v&&void 0!==v[e])&&m(h,e)||(o=i?v[e]:r[e],h[e]=c&&"function"!=typeof v[e]?r[e]:s&&i?d(o,g):l&&v[e]==o?function(e){function ib(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 ib[S]=e[S],ib}(o):f&&"function"==typeof o?d(Function.call,o):o,f&&((h.virtual||(h.virtual={}))[e]=o,t&b.R&&p&&!p[e]&&x(p,e,o)))};b.F=1,b.G=2,b.S=4,b.P=8,b.B=16,b.W=32,b.U=64,b.R=128,n.exports=b},{16:16,17:17,22:22,23:23,24:24}],21:[function(t,n,r){n.exports=function(t){try{return!!t()}catch(t){return!0}}},{}],22:[function(t,n,r){var e=n.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)},{}],23:[function(t,n,r){var e={}.hasOwnProperty;n.exports=function(t,n){return e.call(t,n)}},{}],24:[function(t,n,r){var e=t(27),i=t(28);n.exports=t(18)?function(t,n,r){return e.f(t,n,i(1,r))}:function(t,n,r){return t[n]=r,t}},{18:18,27:27,28:28}],25:[function(t,n,r){n.exports=!t(18)&&!t(21)(function(){return 7!=Object.defineProperty(t(19)("div"),"a",{get:function(){return 7}}).a})},{18:18,19:19,21:21}],26:[function(t,n,r){n.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},{}],27:[function(t,n,r){var e=t(15),i=t(25),o=t(29),u=Object.defineProperty;r.f=t(18)?Object.defineProperty:function defineProperty(t,n,r){if(e(t),n=o(n,!0),e(r),i)try{return u(t,n,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(t[n]=r.value),t}},{15:15,18:18,25:25,29:29}],28:[function(t,n,r){n.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},{}],29:[function(t,n,r){var i=t(26);n.exports=function(t,n){if(!i(t))return t;var r,e;if(n&&"function"==typeof(r=t.toString)&&!i(e=r.call(t)))return e;if("function"==typeof(r=t.valueOf)&&!i(e=r.call(t)))return e;if(!n&&"function"==typeof(r=t.toString)&&!i(e=r.call(t)))return e;throw TypeError("Can't convert object to primitive value")}},{26:26}],30:[function(t,n,r){var e=t(20);e(e.G,{global:t(22)})},{20:20,22:22}],31:[function(t,n,r){arguments[4][14][0].apply(r,arguments)},{14:14}],32:[function(t,n,r){var e=t(46);n.exports=function(t,n){if("number"!=typeof t&&"Number"!=e(t))throw TypeError(n);return+t}},{46:46}],33:[function(t,n,r){var e=t(150)("unscopables"),i=Array.prototype;null==i[e]&&t(70)(i,e,{}),n.exports=function(t){i[e][t]=!0}},{150:150,70:70}],34:[function(t,n,r){"use strict";var e=t(127)(!0);n.exports=function(t,n,r){return n+(r?e(t,n).length:1)}},{127:127}],35:[function(t,n,r){n.exports=function(t,n,r,e){if(!(t instanceof n)||void 0!==e&&e in t)throw TypeError(r+": incorrect invocation!");return t}},{}],36:[function(t,n,r){arguments[4][15][0].apply(r,arguments)},{15:15,79:79}],37:[function(t,n,r){"use strict";var f=t(140),s=t(135),l=t(139);n.exports=[].copyWithin||function copyWithin(t,n){var r=f(this),e=l(r.length),i=s(t,e),o=s(n,e),u=2<arguments.length?arguments[2]:void 0,c=Math.min((void 0===u?e:s(u,e))-o,e-i),a=1;for(o<i&&i<o+c&&(a=-1,o+=c-1,i+=c-1);0<c--;)o in r?r[i]=r[o]:delete r[i],i+=a,o+=a;return r}},{135:135,139:139,140:140}],38:[function(t,n,r){"use strict";var c=t(140),a=t(135),f=t(139);n.exports=function fill(t){for(var n=c(this),r=f(n.length),e=arguments.length,i=a(1<e?arguments[1]:void 0,r),o=2<e?arguments[2]:void 0,u=void 0===o?r:a(o,r);i<u;)n[i++]=t;return n}},{135:135,139:139,140:140}],39:[function(t,n,r){var a=t(138),f=t(139),s=t(135);n.exports=function(c){return function(t,n,r){var e,i=a(t),o=f(i.length),u=s(r,o);if(c&&n!=n){for(;u<o;)if((e=i[u++])!=e)return!0}else for(;u<o;u++)if((c||u in i)&&i[u]===n)return c||u||0;return!c&&-1}}},{135:135,138:138,139:139}],40:[function(t,n,r){var m=t(52),S=t(75),b=t(140),w=t(139),e=t(43);n.exports=function(l,t){var h=1==l,p=2==l,v=3==l,g=4==l,y=6==l,d=5==l||y,x=t||e;return function(t,n,r){for(var e,i,o=b(t),u=S(o),c=m(n,r,3),a=w(u.length),f=0,s=h?x(t,a):p?x(t,0):void 0;f<a;f++)if((d||f in u)&&(i=c(e=u[f],f,o),l))if(h)s[f]=i;else if(i)switch(l){case 3:return!0;case 5:return e;case 6:return f;case 2:s.push(e)}else if(g)return!1;return y?-1:v||g?g:s}}},{139:139,140:140,43:43,52:52,75:75}],41:[function(t,n,r){var s=t(31),l=t(140),h=t(75),p=t(139);n.exports=function(t,n,r,e,i){s(n);var o=l(t),u=h(o),c=p(o.length),a=i?c-1:0,f=i?-1:1;if(r<2)for(;;){if(a in u){e=u[a],a+=f;break}if(a+=f,i?a<0:c<=a)throw TypeError("Reduce of empty array with no initial value")}for(;i?0<=a:a<c;a+=f)a in u&&(e=n(e,u[a],a,o));return e}},{139:139,140:140,31:31,75:75}],42:[function(t,n,r){var e=t(79),i=t(77),o=t(150)("species");n.exports=function(t){var n;return i(t)&&("function"!=typeof(n=t.constructor)||n!==Array&&!i(n.prototype)||(n=void 0),e(n)&&null===(n=n[o])&&(n=void 0)),void 0===n?Array:n}},{150:150,77:77,79:79}],43:[function(t,n,r){var e=t(42);n.exports=function(t,n){return new(e(t))(n)}},{42:42}],44:[function(t,n,r){"use strict";var o=t(31),u=t(79),c=t(74),a=[].slice,f={};n.exports=Function.bind||function bind(n){var r=o(this),e=a.call(arguments,1),i=function(){var t=e.concat(a.call(arguments));return this instanceof i?function(t,n,r){if(!(n in f)){for(var e=[],i=0;i<n;i++)e[i]="a["+i+"]";f[n]=Function("F,a","return new F("+e.join(",")+")")}return f[n](t,r)}(r,t.length,t):c(r,t,n)};return u(r.prototype)&&(i.prototype=r.prototype),i}},{31:31,74:74,79:79}],45:[function(t,n,r){var i=t(46),o=t(150)("toStringTag"),u="Arguments"==i(function(){return arguments}());n.exports=function(t){var n,r,e;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=function(t,n){try{return t[n]}catch(t){}}(n=Object(t),o))?r:u?i(n):"Object"==(e=i(n))&&"function"==typeof n.callee?"Arguments":e}},{150:150,46:46}],46:[function(t,n,r){var e={}.toString;n.exports=function(t){return e.call(t).slice(8,-1)}},{}],47:[function(t,n,r){"use strict";function Uf(t,n){var r,e=p(n);if("F"!==e)return t._i[e];for(r=t._f;r;r=r.n)if(r.k==n)return r}var u=t(97).f,c=t(96),a=t(115),f=t(52),s=t(35),l=t(66),e=t(83),i=t(85),o=t(121),h=t(56),p=t(92).fastKey,v=t(147),g=h?"_s":"size";n.exports={getConstructor:function(t,o,r,e){var i=t(function(t,n){s(t,i,o,"_i"),t._t=o,t._i=c(null),t._f=void 0,t._l=void 0,t[g]=0,null!=n&&l(n,r,t[e],t)});return a(i.prototype,{clear:function clear(){for(var t=v(this,o),n=t._i,r=t._f;r;r=r.n)r.r=!0,r.p&&(r.p=r.p.n=void 0),delete n[r.i];t._f=t._l=void 0,t[g]=0},delete:function(t){var n=v(this,o),r=Uf(n,t);if(r){var e=r.n,i=r.p;delete n._i[r.i],r.r=!0,i&&(i.n=e),e&&(e.p=i),n._f==r&&(n._f=e),n._l==r&&(n._l=i),n[g]--}return!!r},forEach:function forEach(t){v(this,o);for(var n,r=f(t,1<arguments.length?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 has(t){return!!Uf(v(this,o),t)}}),h&&u(i.prototype,"size",{get:function(){return v(this,o)[g]}}),i},def:function(t,n,r){var e,i,o=Uf(t,n);return o?o.v=r:(t._l=o={i:i=p(n,!0),k:n,v:r,p:e=t._l,n:void 0,r:!1},t._f||(t._f=o),e&&(e.n=o),t[g]++,"F"!==i&&(t._i[i]=o)),t},getEntry:Uf,setStrong:function(t,r,n){e(t,r,function(t,n){this._t=v(t,r),this._k=n,this._l=void 0},function(){for(var t=this,n=t._k,r=t._l;r&&r.r;)r=r.p;return t._t&&(t._l=r=r?r.n:t._t._f)?i(0,"keys"==n?r.k:"values"==n?r.v:[r.k,r.v]):(t._t=void 0,i(1))},n?"entries":"values",!n,!0),o(r)}}},{115:115,121:121,147:147,35:35,52:52,56:56,66:66,83:83,85:85,92:92,96:96,97:97}],48:[function(t,n,r){"use strict";function Tg(t){return t._l||(t._l=new g)}function Vg(t,n){return o(t.a,function(t){return t[0]===n})}var u=t(115),c=t(92).getWeak,i=t(36),a=t(79),f=t(35),s=t(66),e=t(40),l=t(69),h=t(147),o=e(5),p=e(6),v=0,g=function(){this.a=[]};g.prototype={get:function(t){var n=Vg(this,t);if(n)return n[1]},has:function(t){return!!Vg(this,t)},set:function(t,n){var r=Vg(this,t);r?r[1]=n:this.a.push([t,n])},delete:function(n){var t=p(this.a,function(t){return t[0]===n});return~t&&this.a.splice(t,1),!!~t}},n.exports={getConstructor:function(t,r,e,i){var o=t(function(t,n){f(t,o,r,"_i"),t._t=r,t._i=v++,t._l=void 0,null!=n&&s(n,e,t[i],t)});return u(o.prototype,{delete:function(t){if(!a(t))return!1;var n=c(t);return!0===n?Tg(h(this,r)).delete(t):n&&l(n,this._i)&&delete n[this._i]},has:function has(t){if(!a(t))return!1;var n=c(t);return!0===n?Tg(h(this,r)).has(t):n&&l(n,this._i)}}),o},def:function(t,n,r){var e=c(i(n),!0);return!0===e?Tg(t).set(n,r):e[t._i]=r,t},ufstore:Tg}},{115:115,147:147,35:35,36:36,40:40,66:66,69:69,79:79,92:92}],49:[function(t,n,r){"use strict";var y=t(68),d=t(60),x=t(116),m=t(115),S=t(92),b=t(66),w=t(35),_=t(79),E=t(62),O=t(84),I=t(122),F=t(73);n.exports=function(e,t,n,r,i,o){function Wh(t){var r=f[t];x(f,t,"delete"==t?function(t){return!(o&&!_(t))&&r.call(this,0===t?0:t)}:"has"==t?function has(t){return!(o&&!_(t))&&r.call(this,0===t?0:t)}:"get"==t?function get(t){return o&&!_(t)?void 0:r.call(this,0===t?0:t)}:"add"==t?function add(t){return r.call(this,0===t?0:t),this}:function set(t,n){return r.call(this,0===t?0:t,n),this})}var u=y[e],c=u,a=i?"set":"add",f=c&&c.prototype,s={};if("function"==typeof c&&(o||f.forEach&&!E(function(){(new c).entries().next()}))){var l=new c,h=l[a](o?{}:-0,1)!=l,p=E(function(){l.has(1)}),v=O(function(t){new c(t)}),g=!o&&E(function(){for(var t=new c,n=5;n--;)t[a](n,n);return!t.has(-0)});v||(((c=t(function(t,n){w(t,c,e);var r=F(new u,t,c);return null!=n&&b(n,i,r[a],r),r})).prototype=f).constructor=c),(p||g)&&(Wh("delete"),Wh("has"),i&&Wh("get")),(g||h)&&Wh(a),o&&f.clear&&delete f.clear}else c=r.getConstructor(t,e,i,a),m(c.prototype,n),S.NEED=!0;return I(c,e),s[e]=c,d(d.G+d.W+d.F*(c!=u),s),o||r.setStrong(c,e,i),c}},{115:115,116:116,122:122,35:35,60:60,62:62,66:66,68:68,73:73,79:79,84:84,92:92}],50:[function(t,n,r){arguments[4][16][0].apply(r,arguments)},{16:16}],51:[function(t,n,r){"use strict";var e=t(97),i=t(114);n.exports=function(t,n,r){n in t?e.f(t,n,i(0,r)):t[n]=r}},{114:114,97:97}],52:[function(t,n,r){arguments[4][17][0].apply(r,arguments)},{17:17,31:31}],53:[function(t,n,r){"use strict";function Ii(t){return 9<t?t:"0"+t}var e=t(62),i=Date.prototype.getTime,o=Date.prototype.toISOString;n.exports=e(function(){return"0385-07-25T07:06:39.999Z"!=o.call(new Date(-5e13-1))})||!e(function(){o.call(new Date(NaN))})?function toISOString(){if(!isFinite(i.call(this)))throw RangeError("Invalid time value");var t=this,n=t.getUTCFullYear(),r=t.getUTCMilliseconds(),e=n<0?"-":9999<n?"+":"";return e+("00000"+Math.abs(n)).slice(e?-6:-4)+"-"+Ii(t.getUTCMonth()+1)+"-"+Ii(t.getUTCDate())+"T"+Ii(t.getUTCHours())+":"+Ii(t.getUTCMinutes())+":"+Ii(t.getUTCSeconds())+"."+(99<r?r:"0"+Ii(r))+"Z"}:o},{62:62}],54:[function(t,n,r){"use strict";var e=t(36),i=t(141);n.exports=function(t){if("string"!==t&&"number"!==t&&"default"!==t)throw TypeError("Incorrect hint");return i(e(this),"number"!=t)}},{141:141,36:36}],55:[function(t,n,r){n.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},{}],56:[function(t,n,r){arguments[4][18][0].apply(r,arguments)},{18:18,62:62}],57:[function(t,n,r){arguments[4][19][0].apply(r,arguments)},{19:19,68:68,79:79}],58:[function(t,n,r){n.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},{}],59:[function(t,n,r){var c=t(105),a=t(102),f=t(106);n.exports=function(t){var n=c(t),r=a.f;if(r)for(var e,i=r(t),o=f.f,u=0;i.length>u;)o.call(t,e=i[u++])&&n.push(e);return n}},{102:102,105:105,106:106}],60:[function(t,n,r){var g=t(68),y=t(50),d=t(70),x=t(116),m=t(52),S="prototype",b=function(t,n,r){var e,i,o,u,c=t&b.F,a=t&b.G,f=t&b.S,s=t&b.P,l=t&b.B,h=a?g:f?g[n]||(g[n]={}):(g[n]||{})[S],p=a?y:y[n]||(y[n]={}),v=p[S]||(p[S]={});for(e in a&&(r=n),r)o=((i=!c&&h&&void 0!==h[e])?h:r)[e],u=l&&i?m(o,g):s&&"function"==typeof o?m(Function.call,o):o,h&&x(h,e,o,t&b.U),p[e]!=o&&d(p,e,u),s&&v[e]!=o&&(v[e]=o)};g.core=y,b.F=1,b.G=2,b.S=4,b.P=8,b.B=16,b.W=32,b.U=64,b.R=128,n.exports=b},{116:116,50:50,52:52,68:68,70:70}],61:[function(t,n,r){var e=t(150)("match");n.exports=function(n){var r=/./;try{"/./"[n](r)}catch(t){try{return r[e]=!1,!"/./"[n](r)}catch(t){}}return!0}},{150:150}],62:[function(t,n,r){arguments[4][21][0].apply(r,arguments)},{21:21}],63:[function(t,n,r){"use strict";t(246);var s=t(116),l=t(70),h=t(62),p=t(55),v=t(150),g=t(118),y=v("species"),d=!h(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")}),x=function(){var t=/(?:)/,n=t.exec;t.exec=function(){return n.apply(this,arguments)};var r="ab".split(t);return 2===r.length&&"a"===r[0]&&"b"===r[1]}();n.exports=function(r,t,n){var e=v(r),o=!h(function(){var t={};return t[e]=function(){return 7},7!=""[r](t)}),i=o?!h(function(){var t=!1,n=/a/;return n.exec=function(){return t=!0,null},"split"===r&&(n.constructor={},n.constructor[y]=function(){return n}),n[e](""),!t}):void 0;if(!o||!i||"replace"===r&&!d||"split"===r&&!x){var u=/./[e],c=n(p,e,""[r],function maybeCallNative(t,n,r,e,i){return n.exec===g?o&&!i?{done:!0,value:u.call(n,r,e)}:{done:!0,value:t.call(r,n,e)}:{done:!1}}),a=c[0],f=c[1];s(String.prototype,r,a),l(RegExp.prototype,e,2==t?function(t,n){return f.call(t,this,n)}:function(t){return f.call(t,this)})}}},{116:116,118:118,150:150,246:246,55:55,62:62,70:70}],64:[function(t,n,r){"use strict";var e=t(36);n.exports=function(){var t=e(this),n="";return t.global&&(n+="g"),t.ignoreCase&&(n+="i"),t.multiline&&(n+="m"),t.unicode&&(n+="u"),t.sticky&&(n+="y"),n}},{36:36}],65:[function(t,n,r){"use strict";var p=t(77),v=t(79),g=t(139),y=t(52),d=t(150)("isConcatSpreadable");n.exports=function flattenIntoArray(t,n,r,e,i,o,u,c){for(var a,f,s=i,l=0,h=!!u&&y(u,c,3);l<e;){if(l in r){if(a=h?h(r[l],l,n):r[l],f=!1,v(a)&&(f=void 0!==(f=a[d])?!!f:p(a)),f&&0<o)s=flattenIntoArray(t,n,a,g(a.length),s,o-1)-1;else{if(9007199254740991<=s)throw TypeError();t[s]=a}s++}l++}return s}},{139:139,150:150,52:52,77:77,79:79}],66:[function(t,n,r){var h=t(52),p=t(81),v=t(76),g=t(36),y=t(139),d=t(151),x={},m={};(r=n.exports=function(t,n,r,e,i){var o,u,c,a,f=i?function(){return t}:d(t),s=h(r,e,n?2:1),l=0;if("function"!=typeof f)throw TypeError(t+" is not iterable!");if(v(f)){for(o=y(t.length);l<o;l++)if((a=n?s(g(u=t[l])[0],u[1]):s(t[l]))===x||a===m)return a}else for(c=f.call(t);!(u=c.next()).done;)if((a=p(c,s,u.value,n))===x||a===m)return a}).BREAK=x,r.RETURN=m},{139:139,151:151,36:36,52:52,76:76,81:81}],67:[function(t,n,r){n.exports=t(124)("native-function-to-string",Function.toString)},{124:124}],68:[function(t,n,r){arguments[4][22][0].apply(r,arguments)},{22:22}],69:[function(t,n,r){arguments[4][23][0].apply(r,arguments)},{23:23}],70:[function(t,n,r){arguments[4][24][0].apply(r,arguments)},{114:114,24:24,56:56,97:97}],71:[function(t,n,r){var e=t(68).document;n.exports=e&&e.documentElement},{68:68}],72:[function(t,n,r){arguments[4][25][0].apply(r,arguments)},{25:25,56:56,57:57,62:62}],73:[function(t,n,r){var o=t(79),u=t(120).set;n.exports=function(t,n,r){var e,i=n.constructor;return i!==r&&"function"==typeof i&&(e=i.prototype)!==r.prototype&&o(e)&&u&&u(t,e),t}},{120:120,79:79}],74:[function(t,n,r){n.exports=function(t,n,r){var e=void 0===r;switch(n.length){case 0:return e?t():t.call(r);case 1:return e?t(n[0]):t.call(r,n[0]);case 2:return e?t(n[0],n[1]):t.call(r,n[0],n[1]);case 3:return e?t(n[0],n[1],n[2]):t.call(r,n[0],n[1],n[2]);case 4:return e?t(n[0],n[1],n[2],n[3]):t.call(r,n[0],n[1],n[2],n[3])}return t.apply(r,n)}},{}],75:[function(t,n,r){var e=t(46);n.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==e(t)?t.split(""):Object(t)}},{46:46}],76:[function(t,n,r){var e=t(86),i=t(150)("iterator"),o=Array.prototype;n.exports=function(t){return void 0!==t&&(e.Array===t||o[i]===t)}},{150:150,86:86}],77:[function(t,n,r){var e=t(46);n.exports=Array.isArray||function isArray(t){return"Array"==e(t)}},{46:46}],78:[function(t,n,r){var e=t(79),i=Math.floor;n.exports=function isInteger(t){return!e(t)&&isFinite(t)&&i(t)===t}},{79:79}],79:[function(t,n,r){arguments[4][26][0].apply(r,arguments)},{26:26}],80:[function(t,n,r){var e=t(79),i=t(46),o=t(150)("match");n.exports=function(t){var n;return e(t)&&(void 0!==(n=t[o])?!!n:"RegExp"==i(t))}},{150:150,46:46,79:79}],81:[function(t,n,r){var o=t(36);n.exports=function(n,t,r,e){try{return e?t(o(r)[0],r[1]):t(r)}catch(t){var i=n.return;throw void 0!==i&&o(i.call(n)),t}}},{36:36}],82:[function(t,n,r){"use strict";var e=t(96),i=t(114),o=t(122),u={};t(70)(u,t(150)("iterator"),function(){return this}),n.exports=function(t,n,r){t.prototype=e(u,{next:i(1,r)}),o(t,n+" Iterator")}},{114:114,122:122,150:150,70:70,96:96}],83:[function(t,n,r){"use strict";function In(){return this}var x=t(87),m=t(60),S=t(116),b=t(70),w=t(86),_=t(82),E=t(122),O=t(103),I=t(150)("iterator"),F=!([].keys&&"next"in[].keys()),P="values";n.exports=function(t,n,r,e,i,o,u){_(r,n,e);function Qn(t){if(!F&&t in p)return p[t];switch(t){case"keys":return function keys(){return new r(this,t)};case P:return function values(){return new r(this,t)}}return function entries(){return new r(this,t)}}var c,a,f,s=n+" Iterator",l=i==P,h=!1,p=t.prototype,v=p[I]||p["@@iterator"]||i&&p[i],g=v||Qn(i),y=i?l?Qn("entries"):g:void 0,d="Array"==n&&p.entries||v;if(d&&(f=O(d.call(new t)))!==Object.prototype&&f.next&&(E(f,s,!0),x||"function"==typeof f[I]||b(f,I,In)),l&&v&&v.name!==P&&(h=!0,g=function values(){return v.call(this)}),x&&!u||!F&&!h&&p[I]||b(p,I,g),w[n]=g,w[s]=In,i)if(c={values:l?g:Qn(P),keys:o?g:Qn("keys"),entries:y},u)for(a in c)a in p||S(p,a,c[a]);else m(m.P+m.F*(F||h),n,c);return c}},{103:103,116:116,122:122,150:150,60:60,70:70,82:82,86:86,87:87}],84:[function(t,n,r){var o=t(150)("iterator"),u=!1;try{var e=[7][o]();e.return=function(){u=!0},Array.from(e,function(){throw 2})}catch(t){}n.exports=function(t,n){if(!n&&!u)return!1;var r=!1;try{var e=[7],i=e[o]();i.next=function(){return{done:r=!0}},e[o]=function(){return i},t(e)}catch(t){}return r}},{150:150}],85:[function(t,n,r){n.exports=function(t,n){return{value:n,done:!!t}}},{}],86:[function(t,n,r){n.exports={}},{}],87:[function(t,n,r){n.exports=!1},{}],88:[function(t,n,r){var e=Math.expm1;n.exports=!e||22025.465794806718<e(10)||e(10)<22025.465794806718||-2e-17!=e(-2e-17)?function expm1(t){return 0==(t=+t)?t:-1e-6<t&&t<1e-6?t+t*t/2:Math.exp(t)-1}:e},{}],89:[function(t,n,r){var o=t(91),e=Math.pow,u=e(2,-52),c=e(2,-23),a=e(2,127)*(2-c),f=e(2,-126);n.exports=Math.fround||function fround(t){var n,r,e=Math.abs(t),i=o(t);return e<f?i*(e/f/c+1/u-1/u)*f*c:a<(r=(n=(1+c/u)*e)-(n-e))||r!=r?i*(1/0):i*r}},{91:91}],90:[function(t,n,r){n.exports=Math.log1p||function log1p(t){return-1e-8<(t=+t)&&t<1e-8?t-t*t/2:Math.log(1+t)}},{}],91:[function(t,n,r){n.exports=Math.sign||function sign(t){return 0==(t=+t)||t!=t?t:t<0?-1:1}},{}],92:[function(t,n,r){function lp(t){u(t,e,{value:{i:"O"+ ++c,w:{}}})}var e=t(145)("meta"),i=t(79),o=t(69),u=t(97).f,c=0,a=Object.isExtensible||function(){return!0},f=!t(62)(function(){return a(Object.preventExtensions({}))}),s=n.exports={KEY:e,NEED:!1,fastKey:function(t,n){if(!i(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!o(t,e)){if(!a(t))return"F";if(!n)return"E";lp(t)}return t[e].i},getWeak:function(t,n){if(!o(t,e)){if(!a(t))return!0;if(!n)return!1;lp(t)}return t[e].w},onFreeze:function(t){return f&&s.NEED&&a(t)&&!o(t,e)&&lp(t),t}}},{145:145,62:62,69:69,79:79,97:97}],93:[function(t,n,r){var u=t(68),c=t(134).set,a=u.MutationObserver||u.WebKitMutationObserver,f=u.process,s=u.Promise,l="process"==t(46)(f);n.exports=function(){function Ip(){var t,n;for(l&&(t=f.domain)&&t.exit();r;){n=r.fn,r=r.next;try{n()}catch(t){throw r?i():e=void 0,t}}e=void 0,t&&t.enter()}var r,e,i;if(l)i=function(){f.nextTick(Ip)};else if(!a||u.navigator&&u.navigator.standalone)if(s&&s.resolve){var t=s.resolve(void 0);i=function(){t.then(Ip)}}else i=function(){c.call(u,Ip)};else{var n=!0,o=document.createTextNode("");new a(Ip).observe(o,{characterData:!0}),i=function(){o.data=n=!n}}return function(t){var n={fn:t,next:void 0};e&&(e.next=n),r||(r=n,i()),e=n}}},{134:134,46:46,68:68}],94:[function(t,n,r){"use strict";var i=t(31);function PromiseCapability(t){var r,e;this.promise=new t(function(t,n){if(void 0!==r||void 0!==e)throw TypeError("Bad Promise constructor");r=t,e=n}),this.resolve=i(r),this.reject=i(e)}n.exports.f=function(t){return new PromiseCapability(t)}},{31:31}],95:[function(t,n,r){"use strict";var h=t(56),p=t(105),v=t(102),g=t(106),y=t(140),d=t(75),i=Object.assign;n.exports=!i||t(62)(function(){var t={},n={},r=Symbol(),e="abcdefghijklmnopqrst";return t[r]=7,e.split("").forEach(function(t){n[t]=t}),7!=i({},t)[r]||Object.keys(i({},n)).join("")!=e})?function assign(t,n){for(var r=y(t),e=arguments.length,i=1,o=v.f,u=g.f;i<e;)for(var c,a=d(arguments[i++]),f=o?p(a).concat(o(a)):p(a),s=f.length,l=0;l<s;)c=f[l++],h&&!u.call(a,c)||(r[c]=a[c]);return r}:i},{102:102,105:105,106:106,140:140,56:56,62:62,75:75}],96:[function(e,t,n){function Hq(){}var i=e(36),o=e(98),u=e(58),c=e(123)("IE_PROTO"),a="prototype",f=function(){var t,n=e(57)("iframe"),r=u.length;for(n.style.display="none",e(71).appendChild(n),n.src="javascript:",(t=n.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),f=t.F;r--;)delete f[a][u[r]];return f()};t.exports=Object.create||function create(t,n){var r;return null!==t?(Hq[a]=i(t),r=new Hq,Hq[a]=null,r[c]=t):r=f(),void 0===n?r:o(r,n)}},{123:123,36:36,57:57,58:58,71:71,98:98}],97:[function(t,n,r){arguments[4][27][0].apply(r,arguments)},{141:141,27:27,36:36,56:56,72:72}],98:[function(t,n,r){var u=t(97),c=t(36),a=t(105);n.exports=t(56)?Object.defineProperties:function defineProperties(t,n){c(t);for(var r,e=a(n),i=e.length,o=0;o<i;)u.f(t,r=e[o++],n[r]);return t}},{105:105,36:36,56:56,97:97}],99:[function(t,n,r){var e=t(106),i=t(114),o=t(138),u=t(141),c=t(69),a=t(72),f=Object.getOwnPropertyDescriptor;r.f=t(56)?f:function getOwnPropertyDescriptor(t,n){if(t=o(t),n=u(n,!0),a)try{return f(t,n)}catch(t){}if(c(t,n))return i(!e.f.call(t,n),t[n])}},{106:106,114:114,138:138,141:141,56:56,69:69,72:72}],100:[function(t,n,r){var e=t(138),i=t(101).f,o={}.toString,u="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];n.exports.f=function getOwnPropertyNames(t){return u&&"[object Window]"==o.call(t)?function(t){try{return i(t)}catch(t){return u.slice()}}(t):i(e(t))}},{101:101,138:138}],101:[function(t,n,r){var e=t(104),i=t(58).concat("length","prototype");r.f=Object.getOwnPropertyNames||function getOwnPropertyNames(t){return e(t,i)}},{104:104,58:58}],102:[function(t,n,r){r.f=Object.getOwnPropertySymbols},{}],103:[function(t,n,r){var e=t(69),i=t(140),o=t(123)("IE_PROTO"),u=Object.prototype;n.exports=Object.getPrototypeOf||function(t){return t=i(t),e(t,o)?t[o]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?u:null}},{123:123,140:140,69:69}],104:[function(t,n,r){var u=t(69),c=t(138),a=t(39)(!1),f=t(123)("IE_PROTO");n.exports=function(t,n){var r,e=c(t),i=0,o=[];for(r in e)r!=f&&u(e,r)&&o.push(r);for(;n.length>i;)u(e,r=n[i++])&&(~a(o,r)||o.push(r));return o}},{123:123,138:138,39:39,69:69}],105:[function(t,n,r){var e=t(104),i=t(58);n.exports=Object.keys||function keys(t){return e(t,i)}},{104:104,58:58}],106:[function(t,n,r){r.f={}.propertyIsEnumerable},{}],107:[function(t,n,r){var i=t(60),o=t(50),u=t(62);n.exports=function(t,n){var r=(o.Object||{})[t]||Object[t],e={};e[t]=n(r),i(i.S+i.F*u(function(){r(1)}),"Object",e)}},{50:50,60:60,62:62}],108:[function(t,n,r){var a=t(56),f=t(105),s=t(138),l=t(106).f;n.exports=function(c){return function(t){for(var n,r=s(t),e=f(r),i=e.length,o=0,u=[];o<i;)n=e[o++],a&&!l.call(r,n)||u.push(c?[n,r[n]]:r[n]);return u}}},{105:105,106:106,138:138,56:56}],109:[function(t,n,r){var e=t(101),i=t(102),o=t(36),u=t(68).Reflect;n.exports=u&&u.ownKeys||function ownKeys(t){var n=e.f(o(t)),r=i.f;return r?n.concat(r(t)):n}},{101:101,102:102,36:36,68:68}],110:[function(t,n,r){var e=t(68).parseFloat,i=t(132).trim;n.exports=1/e(t(133)+"-0")!=-1/0?function parseFloat(t){var n=i(String(t),3),r=e(n);return 0===r&&"-"==n.charAt(0)?-0:r}:e},{132:132,133:133,68:68}],111:[function(t,n,r){var e=t(68).parseInt,i=t(132).trim,o=t(133),u=/^[-+]?0[xX]/;n.exports=8!==e(o+"08")||22!==e(o+"0x16")?function parseInt(t,n){var r=i(String(t),3);return e(r,n>>>0||(u.test(r)?16:10))}:e},{132:132,133:133,68:68}],112:[function(t,n,r){n.exports=function(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}}},{}],113:[function(t,n,r){var e=t(36),i=t(79),o=t(94);n.exports=function(t,n){if(e(t),i(n)&&n.constructor===t)return n;var r=o.f(t);return(0,r.resolve)(n),r.promise}},{36:36,79:79,94:94}],114:[function(t,n,r){arguments[4][28][0].apply(r,arguments)},{28:28}],115:[function(t,n,r){var i=t(116);n.exports=function(t,n,r){for(var e in n)i(t,e,n[e],r);return t}},{116:116}],116:[function(t,n,r){var o=t(68),u=t(70),c=t(69),a=t(145)("src"),e=t(67),i="toString",f=(""+e).split(i);t(50).inspectSource=function(t){return e.call(t)},(n.exports=function(t,n,r,e){var i="function"==typeof r;i&&(c(r,"name")||u(r,"name",n)),t[n]!==r&&(i&&(c(r,a)||u(r,a,t[n]?""+t[n]:f.join(String(n)))),t===o?t[n]=r:e?t[n]?t[n]=r:u(t,n,r):(delete t[n],u(t,n,r)))})(Function.prototype,i,function toString(){return"function"==typeof this&&this[a]||e.call(this)})},{145:145,50:50,67:67,68:68,69:69,70:70}],117:[function(t,n,r){"use strict";var i=t(45),o=RegExp.prototype.exec;n.exports=function(t,n){var r=t.exec;if("function"==typeof r){var e=r.call(t,n);if("object"!=typeof e)throw new TypeError("RegExp exec method returned something other than an Object or null");return e}if("RegExp"!==i(t))throw new TypeError("RegExp#exec called on incompatible receiver");return o.call(t,n)}},{45:45}],118:[function(t,n,r){"use strict";var e,i,u=t(64),c=RegExp.prototype.exec,a=String.prototype.replace,o=c,f="lastIndex",s=(e=/a/,i=/b*/g,c.call(e,"a"),c.call(i,"a"),0!==e[f]||0!==i[f]),l=void 0!==/()??/.exec("")[1];(s||l)&&(o=function exec(t){var n,r,e,i,o=this;return l&&(r=new RegExp("^"+o.source+"$(?!\\s)",u.call(o))),s&&(n=o[f]),e=c.call(o,t),s&&e&&(o[f]=o.global?e.index+e[0].length:n),l&&e&&1<e.length&&a.call(e[0],r,function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(e[i]=void 0)}),e}),n.exports=o},{64:64}],119:[function(t,n,r){n.exports=Object.is||function is(t,n){return t===n?0!==t||1/t==1/n:t!=t&&n!=n}},{}],120:[function(n,t,r){function Ou(t,n){if(i(t),!e(n)&&null!==n)throw TypeError(n+": can't set as prototype!")}var e=n(79),i=n(36);t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,r,e){try{(e=n(52)(Function.call,n(99).f(Object.prototype,"__proto__").set,2))(t,[]),r=!(t instanceof Array)}catch(t){r=!0}return function setPrototypeOf(t,n){return Ou(t,n),r?t.__proto__=n:e(t,n),t}}({},!1):void 0),check:Ou}},{36:36,52:52,79:79,99:99}],121:[function(t,n,r){"use strict";var e=t(68),i=t(97),o=t(56),u=t(150)("species");n.exports=function(t){var n=e[t];o&&n&&!n[u]&&i.f(n,u,{configurable:!0,get:function(){return this}})}},{150:150,56:56,68:68,97:97}],122:[function(t,n,r){var e=t(97).f,i=t(69),o=t(150)("toStringTag");n.exports=function(t,n,r){t&&!i(t=r?t:t.prototype,o)&&e(t,o,{configurable:!0,value:n})}},{150:150,69:69,97:97}],123:[function(t,n,r){var e=t(124)("keys"),i=t(145);n.exports=function(t){return e[t]||(e[t]=i(t))}},{124:124,145:145}],124:[function(t,n,r){var e=t(50),i=t(68),o="__core-js_shared__",u=i[o]||(i[o]={});(n.exports=function(t,n){return u[t]||(u[t]=void 0!==n?n:{})})("versions",[]).push({version:e.version,mode:t(87)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},{50:50,68:68,87:87}],125:[function(t,n,r){var i=t(36),o=t(31),u=t(150)("species");n.exports=function(t,n){var r,e=i(t).constructor;return void 0===e||null==(r=i(e)[u])?n:o(r)}},{150:150,31:31,36:36}],126:[function(t,n,r){"use strict";var e=t(62);n.exports=function(t,n){return!!t&&e(function(){n?t.call(null,function(){},1):t.call(null)})}},{62:62}],127:[function(t,n,r){var a=t(137),f=t(55);n.exports=function(c){return function(t,n){var r,e,i=String(f(t)),o=a(n),u=i.length;return o<0||u<=o?c?"":void 0:(r=i.charCodeAt(o))<55296||56319<r||o+1===u||(e=i.charCodeAt(o+1))<56320||57343<e?c?i.charAt(o):r:c?i.slice(o,o+2):e-56320+(r-55296<<10)+65536}}},{137:137,55:55}],128:[function(t,n,r){var e=t(80),i=t(55);n.exports=function(t,n,r){if(e(n))throw TypeError("String#"+r+" doesn't accept regex!");return String(i(t))}},{55:55,80:80}],129:[function(t,n,r){function sw(t,n,r,e){var i=String(u(t)),o="<"+n;return""!==r&&(o+=" "+r+'="'+String(e).replace(c,""")+'"'),o+">"+i+"</"+n+">"}var e=t(60),i=t(62),u=t(55),c=/"/g;n.exports=function(n,t){var r={};r[n]=t(sw),e(e.P+e.F*i(function(){var t=""[n]('"');return t!==t.toLowerCase()||3<t.split('"').length}),"String",r)}},{55:55,60:60,62:62}],130:[function(t,n,r){var s=t(139),l=t(131),h=t(55);n.exports=function(t,n,r,e){var i=String(h(t)),o=i.length,u=void 0===r?" ":String(r),c=s(n);if(c<=o||""==u)return i;var a=c-o,f=l.call(u,Math.ceil(a/u.length));return f.length>a&&(f=f.slice(0,a)),e?f+i:i+f}},{131:131,139:139,55:55}],131:[function(t,n,r){"use strict";var i=t(137),o=t(55);n.exports=function repeat(t){var n=String(o(this)),r="",e=i(t);if(e<0||e==1/0)throw RangeError("Count can't be negative");for(;0<e;(e>>>=1)&&(n+=n))1&e&&(r+=n);return r}},{137:137,55:55}],132:[function(t,n,r){function lx(t,n,r){var e={},i=c(function(){return!!a[t]()||"
"!="
"[t]()}),o=e[t]=i?n(s):a[t];r&&(e[r]=o),u(u.P+u.F*i,"String",e)}var u=t(60),e=t(55),c=t(62),a=t(133),i="["+a+"]",o=RegExp("^"+i+i+"*"),f=RegExp(i+i+"*$"),s=lx.trim=function(t,n){return t=String(e(t)),1&n&&(t=t.replace(o,"")),2&n&&(t=t.replace(f,"")),t};n.exports=lx},{133:133,55:55,60:60,62:62}],133:[function(t,n,r){n.exports="\t\n\v\f\r \u2028\u2029\ufeff"},{}],134:[function(t,n,r){function Rx(){var t=+this;if(d.hasOwnProperty(t)){var n=d[t];delete d[t],n()}}function Sx(t){Rx.call(t.data)}var e,i,o,u=t(52),c=t(74),a=t(71),f=t(57),s=t(68),l=s.process,h=s.setImmediate,p=s.clearImmediate,v=s.MessageChannel,g=s.Dispatch,y=0,d={},x="onreadystatechange";h&&p||(h=function setImmediate(t){for(var n=[],r=1;r<arguments.length;)n.push(arguments[r++]);return d[++y]=function(){c("function"==typeof t?t:Function(t),n)},e(y),y},p=function clearImmediate(t){delete d[t]},"process"==t(46)(l)?e=function(t){l.nextTick(u(Rx,t,1))}:g&&g.now?e=function(t){g.now(u(Rx,t,1))}:v?(o=(i=new v).port2,i.port1.onmessage=Sx,e=u(o.postMessage,o,1)):s.addEventListener&&"function"==typeof postMessage&&!s.importScripts?(e=function(t){s.postMessage(t+"","*")},s.addEventListener("message",Sx,!1)):e=x in f("script")?function(t){a.appendChild(f("script"))[x]=function(){a.removeChild(this),Rx.call(t)}}:function(t){setTimeout(u(Rx,t,1),0)}),n.exports={set:h,clear:p}},{46:46,52:52,57:57,68:68,71:71,74:74}],135:[function(t,n,r){var e=t(137),i=Math.max,o=Math.min;n.exports=function(t,n){return(t=e(t))<0?i(t+n,0):o(t,n)}},{137:137}],136:[function(t,n,r){var e=t(137),i=t(139);n.exports=function(t){if(void 0===t)return 0;var n=e(t),r=i(n);if(n!==r)throw RangeError("Wrong length!");return r}},{137:137,139:139}],137:[function(t,n,r){var e=Math.ceil,i=Math.floor;n.exports=function(t){return isNaN(t=+t)?0:(0<t?i:e)(t)}},{}],138:[function(t,n,r){var e=t(75),i=t(55);n.exports=function(t){return e(i(t))}},{55:55,75:75}],139:[function(t,n,r){var e=t(137),i=Math.min;n.exports=function(t){return 0<t?i(e(t),9007199254740991):0}},{137:137}],140:[function(t,n,r){var e=t(55);n.exports=function(t){return Object(e(t))}},{55:55}],141:[function(t,n,r){arguments[4][29][0].apply(r,arguments)},{29:29,79:79}],142:[function(t,n,r){"use strict";if(t(56)){var y=t(87),d=t(68),x=t(62),m=t(60),S=t(144),e=t(143),h=t(52),b=t(35),i=t(114),w=t(70),o=t(115),u=t(137),_=t(139),E=t(136),c=t(135),a=t(141),f=t(69),O=t(45),I=t(79),p=t(140),v=t(76),F=t(96),P=t(103),A=t(101).f,g=t(151),s=t(145),l=t(150),M=t(40),k=t(39),R=t(125),N=t(162),j=t(86),T=t(84),L=t(121),C=t(38),G=t(37),U=t(97),D=t(99),W=U.f,V=D.f,B=d.RangeError,q=d.TypeError,z=d.Uint8Array,$="ArrayBuffer",Y="Shared"+$,J="BYTES_PER_ELEMENT",H="prototype",Q=Array[H],K=e.ArrayBuffer,Z=e.DataView,X=M(0),tt=M(2),nt=M(3),rt=M(4),et=M(5),it=M(6),ot=k(!0),ut=k(!1),ct=N.values,at=N.keys,ft=N.entries,st=Q.lastIndexOf,lt=Q.reduce,ht=Q.reduceRight,pt=Q.join,vt=Q.sort,gt=Q.slice,yt=Q.toString,dt=Q.toLocaleString,xt=l("iterator"),mt=l("toStringTag"),St=s("typed_constructor"),bt=s("def_constructor"),wt=S.CONSTR,_t=S.TYPED,Et=S.VIEW,Ot="Wrong length!",It=M(1,function(t,n){return kt(R(t,t[bt]),n)}),Ft=x(function(){return 1===new z(new Uint16Array([1]).buffer)[0]}),Pt=!!z&&!!z[H].set&&x(function(){new z(1).set({})}),At=function(t,n){var r=u(t);if(r<0||r%n)throw B("Wrong offset!");return r},Mt=function(t){if(I(t)&&_t in t)return t;throw q(t+" is not a typed array!")},kt=function(t,n){if(!(I(t)&&St in t))throw q("It is not a typed array constructor!");return new t(n)},Rt=function(t,n){return Nt(R(t,t[bt]),n)},Nt=function(t,n){for(var r=0,e=n.length,i=kt(t,e);r<e;)i[r]=n[r++];return i},jt=function(t,n,r){W(t,n,{get:function(){return this._d[r]}})},Tt=function from(t){var n,r,e,i,o,u,c=p(t),a=arguments.length,f=1<a?arguments[1]:void 0,s=void 0!==f,l=g(c);if(null!=l&&!v(l)){for(u=l.call(c),e=[],n=0;!(o=u.next()).done;n++)e.push(o.value);c=e}for(s&&2<a&&(f=h(f,arguments[2],2)),n=0,r=_(c.length),i=kt(this,r);n<r;n++)i[n]=s?f(c[n],n):c[n];return i},Lt=function of(){for(var t=0,n=arguments.length,r=kt(this,n);t<n;)r[t]=arguments[t++];return r},Ct=!!z&&x(function(){dt.call(new z(1))}),Gt=function toLocaleString(){return dt.apply(Ct?gt.call(Mt(this)):Mt(this),arguments)},Ut={copyWithin:function copyWithin(t,n){return G.call(Mt(this),t,n,2<arguments.length?arguments[2]:void 0)},every:function every(t){return rt(Mt(this),t,1<arguments.length?arguments[1]:void 0)},fill:function fill(t){return C.apply(Mt(this),arguments)},filter:function filter(t){return Rt(this,tt(Mt(this),t,1<arguments.length?arguments[1]:void 0))},find:function find(t){return et(Mt(this),t,1<arguments.length?arguments[1]:void 0)},findIndex:function findIndex(t){return it(Mt(this),t,1<arguments.length?arguments[1]:void 0)},forEach:function forEach(t){X(Mt(this),t,1<arguments.length?arguments[1]:void 0)},indexOf:function indexOf(t){return ut(Mt(this),t,1<arguments.length?arguments[1]:void 0)},includes:function includes(t){return ot(Mt(this),t,1<arguments.length?arguments[1]:void 0)},join:function join(t){return pt.apply(Mt(this),arguments)},lastIndexOf:function lastIndexOf(t){return st.apply(Mt(this),arguments)},map:function map(t){return It(Mt(this),t,1<arguments.length?arguments[1]:void 0)},reduce:function reduce(t){return lt.apply(Mt(this),arguments)},reduceRight:function reduceRight(t){return ht.apply(Mt(this),arguments)},reverse:function reverse(){for(var t,n=this,r=Mt(n).length,e=Math.floor(r/2),i=0;i<e;)t=n[i],n[i++]=n[--r],n[r]=t;return n},some:function some(t){return nt(Mt(this),t,1<arguments.length?arguments[1]:void 0)},sort:function sort(t){return vt.call(Mt(this),t)},subarray:function subarray(t,n){var r=Mt(this),e=r.length,i=c(t,e);return new(R(r,r[bt]))(r.buffer,r.byteOffset+i*r.BYTES_PER_ELEMENT,_((void 0===n?e:c(n,e))-i))}},Dt=function slice(t,n){return Rt(this,gt.call(Mt(this),t,n))},Wt=function set(t){Mt(this);var n=At(arguments[1],1),r=this.length,e=p(t),i=_(e.length),o=0;if(r<i+n)throw B(Ot);for(;o<i;)this[n+o]=e[o++]},Vt={entries:function entries(){return ft.call(Mt(this))},keys:function keys(){return at.call(Mt(this))},values:function values(){return ct.call(Mt(this))}},Bt=function(t,n){return I(t)&&t[_t]&&"symbol"!=typeof n&&n in t&&String(+n)==String(n)},qt=function getOwnPropertyDescriptor(t,n){return Bt(t,n=a(n,!0))?i(2,t[n]):V(t,n)},zt=function defineProperty(t,n,r){return!(Bt(t,n=a(n,!0))&&I(r)&&f(r,"value"))||f(r,"get")||f(r,"set")||r.configurable||f(r,"writable")&&!r.writable||f(r,"enumerable")&&!r.enumerable?W(t,n,r):(t[n]=r.value,t)};wt||(D.f=qt,U.f=zt),m(m.S+m.F*!wt,"Object",{getOwnPropertyDescriptor:qt,defineProperty:zt}),x(function(){yt.call({})})&&(yt=dt=function toString(){return pt.call(this)});var $t=o({},Ut);o($t,Vt),w($t,xt,Vt.values),o($t,{slice:Dt,set:Wt,constructor:function(){},toString:yt,toLocaleString:Gt}),jt($t,"buffer","b"),jt($t,"byteOffset","o"),jt($t,"byteLength","l"),jt($t,"length","e"),W($t,mt,{get:function(){return this[_t]}}),n.exports=function(t,l,n,o){function uC(t,i){W(t,i,{get:function(){return t=i,(n=this._d).v[r](t*l+n.o,Ft);var t,n},set:function(t){return n=i,r=t,e=this._d,o&&(r=(r=Math.round(r))<0?0:255<r?255:255&r),void e.v[u](n*l+e.o,r,Ft);var n,r,e},enumerable:!0})}var h=t+((o=!!o)?"Clamped":"")+"Array",r="get"+t,u="set"+t,p=d[h],c=p||{},e=p&&P(p),i=!p||!S.ABV,a={},f=p&&p[H];i?(p=n(function(t,n,r,e){b(t,p,h,"_d");var i,o,u,c,a=0,f=0;if(I(n)){if(!(n instanceof K||(c=O(n))==$||c==Y))return _t in n?Nt(p,n):Tt.call(p,n);i=n,f=At(r,l);var s=n.byteLength;if(void 0===e){if(s%l)throw B(Ot);if((o=s-f)<0)throw B(Ot)}else if(s<(o=_(e)*l)+f)throw B(Ot);u=o/l}else u=E(n),i=new K(o=u*l);for(w(t,"_d",{b:i,o:f,l:o,e:u,v:new Z(i)});a<u;)uC(t,a++)}),f=p[H]=F($t),w(f,"constructor",p)):x(function(){p(1)})&&x(function(){new p(-1)})&&T(function(t){new p,new p(null),new p(1.5),new p(t)},!0)||(p=n(function(t,n,r,e){var i;return b(t,p,h),I(n)?n instanceof K||(i=O(n))==$||i==Y?void 0!==e?new c(n,At(r,l),e):void 0!==r?new c(n,At(r,l)):new c(n):_t in n?Nt(p,n):Tt.call(p,n):new c(E(n))}),X(e!==Function.prototype?A(c).concat(A(e)):A(c),function(t){t in p||w(p,t,c[t])}),p[H]=f,y||(f.constructor=p));var s=f[xt],v=!!s&&("values"==s.name||null==s.name),g=Vt.values;w(p,St,!0),w(f,_t,h),w(f,Et,!0),w(f,bt,p),(o?new p(1)[mt]==h:mt in f)||W(f,mt,{get:function(){return h}}),a[h]=p,m(m.G+m.W+m.F*(p!=c),a),m(m.S,h,{BYTES_PER_ELEMENT:l}),m(m.S+m.F*x(function(){c.of.call(p,1)}),h,{from:Tt,of:Lt}),J in f||w(f,J,l),m(m.P,h,Ut),L(h),m(m.P+m.F*Pt,h,{set:Wt}),m(m.P+m.F*!v,h,Vt),y||f.toString==yt||(f.toString=yt),m(m.P+m.F*x(function(){new p(1).slice()}),h,{slice:Dt}),m(m.P+m.F*(x(function(){return[1,2].toLocaleString()!=new p([1,2]).toLocaleString()})||!x(function(){f.toLocaleString.call([1,2])})),h,{toLocaleString:Gt}),j[h]=v?s:g,y||v||w(f,xt,g)}}else n.exports=function(){}},{101:101,103:103,114:114,115:115,121:121,125:125,135:135,136:136,137:137,139:139,140:140,141:141,143:143,144:144,145:145,150:150,151:151,162:162,35:35,37:37,38:38,39:39,40:40,45:45,52:52,56:56,60:60,62:62,68:68,69:69,70:70,76:76,79:79,84:84,86:86,87:87,96:96,97:97,99:99}],143:[function(t,n,r){"use strict";var e=t(68),i=t(56),o=t(87),u=t(144),c=t(70),a=t(115),f=t(62),s=t(35),l=t(137),h=t(139),p=t(136),v=t(101).f,g=t(97).f,y=t(38),d=t(122),x="ArrayBuffer",m="DataView",S="prototype",b="Wrong index!",w=e[x],_=e[m],E=e.Math,O=e.RangeError,I=e.Infinity,F=w,P=E.abs,A=E.pow,M=E.floor,k=E.log,R=E.LN2,N="byteLength",j="byteOffset",T=i?"_b":"buffer",L=i?"_l":N,C=i?"_o":j;function packIEEE754(t,n,r){var e,i,o,u=new Array(r),c=8*r-n-1,a=(1<<c)-1,f=a>>1,s=23===n?A(2,-24)-A(2,-77):0,l=0,h=t<0||0===t&&1/t<0?1:0;for((t=P(t))!=t||t===I?(i=t!=t?1:0,e=a):(e=M(k(t)/R),t*(o=A(2,-e))<1&&(e--,o*=2),2<=(t+=1<=e+f?s/o:s*A(2,1-f))*o&&(e++,o/=2),a<=e+f?(i=0,e=a):1<=e+f?(i=(t*o-1)*A(2,n),e+=f):(i=t*A(2,f-1)*A(2,n),e=0));8<=n;u[l++]=255&i,i/=256,n-=8);for(e=e<<n|i,c+=n;0<c;u[l++]=255&e,e/=256,c-=8);return u[--l]|=128*h,u}function unpackIEEE754(t,n,r){var e,i=8*r-n-1,o=(1<<i)-1,u=o>>1,c=i-7,a=r-1,f=t[a--],s=127&f;for(f>>=7;0<c;s=256*s+t[a],a--,c-=8);for(e=s&(1<<-c)-1,s>>=-c,c+=n;0<c;e=256*e+t[a],a--,c-=8);if(0===s)s=1-u;else{if(s===o)return e?NaN:f?-I:I;e+=A(2,n),s-=u}return(f?-1:1)*e*A(2,s-n)}function unpackI32(t){return t[3]<<24|t[2]<<16|t[1]<<8|t[0]}function packI8(t){return[255&t]}function packI16(t){return[255&t,t>>8&255]}function packI32(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]}function packF64(t){return packIEEE754(t,52,8)}function packF32(t){return packIEEE754(t,23,4)}function addGetter(t,n,r){g(t[S],n,{get:function(){return this[r]}})}function get(t,n,r,e){var i=p(+r);if(i+n>t[L])throw O(b);var o=t[T]._b,u=i+t[C],c=o.slice(u,u+n);return e?c:c.reverse()}function set(t,n,r,e,i,o){var u=p(+r);if(u+n>t[L])throw O(b);for(var c=t[T]._b,a=u+t[C],f=e(+i),s=0;s<n;s++)c[a+s]=f[o?s:n-s-1]}if(u.ABV){if(!f(function(){w(1)})||!f(function(){new w(-1)})||f(function(){return new w,new w(1.5),new w(NaN),w.name!=x})){for(var G,U=(w=function ArrayBuffer(t){return s(this,w),new F(p(t))})[S]=F[S],D=v(F),W=0;D.length>W;)(G=D[W++])in w||c(w,G,F[G]);o||(U.constructor=w)}var V=new _(new w(2)),B=_[S].setInt8;V.setInt8(0,2147483648),V.setInt8(1,2147483649),!V.getInt8(0)&&V.getInt8(1)||a(_[S],{setInt8:function setInt8(t,n){B.call(this,t,n<<24>>24)},setUint8:function setUint8(t,n){B.call(this,t,n<<24>>24)}},!0)}else w=function ArrayBuffer(t){s(this,w,x);var n=p(t);this._b=y.call(new Array(n),0),this[L]=n},_=function DataView(t,n,r){s(this,_,m),s(t,w,m);var e=t[L],i=l(n);if(i<0||e<i)throw O("Wrong offset!");if(e<i+(r=void 0===r?e-i:h(r)))throw O("Wrong length!");this[T]=t,this[C]=i,this[L]=r},i&&(addGetter(w,N,"_l"),addGetter(_,"buffer","_b"),addGetter(_,N,"_l"),addGetter(_,j,"_o")),a(_[S],{getInt8:function getInt8(t){return get(this,1,t)[0]<<24>>24},getUint8:function getUint8(t){return get(this,1,t)[0]},getInt16:function getInt16(t){var n=get(this,2,t,arguments[1]);return(n[1]<<8|n[0])<<16>>16},getUint16:function getUint16(t){var n=get(this,2,t,arguments[1]);return n[1]<<8|n[0]},getInt32:function getInt32(t){return unpackI32(get(this,4,t,arguments[1]))},getUint32:function getUint32(t){return unpackI32(get(this,4,t,arguments[1]))>>>0},getFloat32:function getFloat32(t){return unpackIEEE754(get(this,4,t,arguments[1]),23,4)},getFloat64:function getFloat64(t){return unpackIEEE754(get(this,8,t,arguments[1]),52,8)},setInt8:function setInt8(t,n){set(this,1,t,packI8,n)},setUint8:function setUint8(t,n){set(this,1,t,packI8,n)},setInt16:function setInt16(t,n){set(this,2,t,packI16,n,arguments[2])},setUint16:function setUint16(t,n){set(this,2,t,packI16,n,arguments[2])},setInt32:function setInt32(t,n){set(this,4,t,packI32,n,arguments[2])},setUint32:function setUint32(t,n){set(this,4,t,packI32,n,arguments[2])},setFloat32:function setFloat32(t,n){set(this,4,t,packF32,n,arguments[2])},setFloat64:function setFloat64(t,n){set(this,8,t,packF64,n,arguments[2])}});d(w,x),d(_,m),c(_[S],u.VIEW,!0),r[x]=w,r[m]=_},{101:101,115:115,122:122,136:136,137:137,139:139,144:144,35:35,38:38,56:56,62:62,68:68,70:70,87:87,97:97}],144:[function(t,n,r){for(var e,i=t(68),o=t(70),u=t(145),c=u("typed_array"),a=u("view"),f=!(!i.ArrayBuffer||!i.DataView),s=f,l=0,h="Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(",");l<9;)(e=i[h[l++]])?(o(e.prototype,c,!0),o(e.prototype,a,!0)):s=!1;n.exports={ABV:f,CONSTR:s,TYPED:c,VIEW:a}},{145:145,68:68,70:70}],145:[function(t,n,r){var e=0,i=Math.random();n.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++e+i).toString(36))}},{}],146:[function(t,n,r){var e=t(68).navigator;n.exports=e&&e.userAgent||""},{68:68}],147:[function(t,n,r){var e=t(79);n.exports=function(t,n){if(!e(t)||t._t!==n)throw TypeError("Incompatible receiver, "+n+" required!");return t}},{79:79}],148:[function(t,n,r){var e=t(68),i=t(50),o=t(87),u=t(149),c=t(97).f;n.exports=function(t){var n=i.Symbol||(i.Symbol=o?{}:e.Symbol||{});"_"==t.charAt(0)||t in n||c(n,t,{value:u.f(t)})}},{149:149,50:50,68:68,87:87,97:97}],149:[function(t,n,r){r.f=t(150)},{150:150}],150:[function(t,n,r){var e=t(124)("wks"),i=t(145),o=t(68).Symbol,u="function"==typeof o;(n.exports=function(t){return e[t]||(e[t]=u&&o[t]||(u?o:i)("Symbol."+t))}).store=e},{124:124,145:145,68:68}],151:[function(t,n,r){var e=t(45),i=t(150)("iterator"),o=t(86);n.exports=t(50).getIteratorMethod=function(t){if(null!=t)return t[i]||t["@@iterator"]||o[e(t)]}},{150:150,45:45,50:50,86:86}],152:[function(t,n,r){var e=t(60);e(e.P,"Array",{copyWithin:t(37)}),t(33)("copyWithin")},{33:33,37:37,60:60}],153:[function(t,n,r){"use strict";var e=t(60),i=t(40)(4);e(e.P+e.F*!t(126)([].every,!0),"Array",{every:function every(t){return i(this,t,arguments[1])}})},{126:126,40:40,60:60}],154:[function(t,n,r){var e=t(60);e(e.P,"Array",{fill:t(38)}),t(33)("fill")},{33:33,38:38,60:60}],155:[function(t,n,r){"use strict";var e=t(60),i=t(40)(2);e(e.P+e.F*!t(126)([].filter,!0),"Array",{filter:function filter(t){return i(this,t,arguments[1])}})},{126:126,40:40,60:60}],156:[function(t,n,r){"use strict";var e=t(60),i=t(40)(6),o="findIndex",u=!0;o in[]&&Array(1)[o](function(){u=!1}),e(e.P+e.F*u,"Array",{findIndex:function findIndex(t){return i(this,t,1<arguments.length?arguments[1]:void 0)}}),t(33)(o)},{33:33,40:40,60:60}],157:[function(t,n,r){"use strict";var e=t(60),i=t(40)(5),o="find",u=!0;o in[]&&Array(1)[o](function(){u=!1}),e(e.P+e.F*u,"Array",{find:function find(t){return i(this,t,1<arguments.length?arguments[1]:void 0)}}),t(33)(o)},{33:33,40:40,60:60}],158:[function(t,n,r){"use strict";var e=t(60),i=t(40)(0),o=t(126)([].forEach,!0);e(e.P+e.F*!o,"Array",{forEach:function forEach(t){return i(this,t,arguments[1])}})},{126:126,40:40,60:60}],159:[function(t,n,r){"use strict";var h=t(52),e=t(60),p=t(140),v=t(81),g=t(76),y=t(139),d=t(51),x=t(151);e(e.S+e.F*!t(84)(function(t){Array.from(t)}),"Array",{from:function from(t){var n,r,e,i,o=p(t),u="function"==typeof this?this:Array,c=arguments.length,a=1<c?arguments[1]:void 0,f=void 0!==a,s=0,l=x(o);if(f&&(a=h(a,2<c?arguments[2]:void 0,2)),null==l||u==Array&&g(l))for(r=new u(n=y(o.length));s<n;s++)d(r,s,f?a(o[s],s):o[s]);else for(i=l.call(o),r=new u;!(e=i.next()).done;s++)d(r,s,f?v(i,a,[e.value,s],!0):e.value);return r.length=s,r}})},{139:139,140:140,151:151,51:51,52:52,60:60,76:76,81:81,84:84}],160:[function(t,n,r){"use strict";var e=t(60),i=t(39)(!1),o=[].indexOf,u=!!o&&1/[1].indexOf(1,-0)<0;e(e.P+e.F*(u||!t(126)(o)),"Array",{indexOf:function indexOf(t){return u?o.apply(this,arguments)||0:i(this,t,arguments[1])}})},{126:126,39:39,60:60}],161:[function(t,n,r){var e=t(60);e(e.S,"Array",{isArray:t(77)})},{60:60,77:77}],162:[function(t,n,r){"use strict";var e=t(33),i=t(85),o=t(86),u=t(138);n.exports=t(83)(Array,"Array",function(t,n){this._t=u(t),this._i=0,this._k=n},function(){var t=this._t,n=this._k,r=this._i++;return!t||r>=t.length?(this._t=void 0,i(1)):i(0,"keys"==n?r:"values"==n?t[r]:[r,t[r]])},"values"),o.Arguments=o.Array,e("keys"),e("values"),e("entries")},{138:138,33:33,83:83,85:85,86:86}],163:[function(t,n,r){"use strict";var e=t(60),i=t(138),o=[].join;e(e.P+e.F*(t(75)!=Object||!t(126)(o)),"Array",{join:function join(t){return o.call(i(this),void 0===t?",":t)}})},{126:126,138:138,60:60,75:75}],164:[function(t,n,r){"use strict";var e=t(60),i=t(138),o=t(137),u=t(139),c=[].lastIndexOf,a=!!c&&1/[1].lastIndexOf(1,-0)<0;e(e.P+e.F*(a||!t(126)(c)),"Array",{lastIndexOf:function lastIndexOf(t){if(a)return c.apply(this,arguments)||0;var n=i(this),r=u(n.length),e=r-1;for(1<arguments.length&&(e=Math.min(e,o(arguments[1]))),e<0&&(e=r+e);0<=e;e--)if(e in n&&n[e]===t)return e||0;return-1}})},{126:126,137:137,138:138,139:139,60:60}],165:[function(t,n,r){"use strict";var e=t(60),i=t(40)(1);e(e.P+e.F*!t(126)([].map,!0),"Array",{map:function map(t){return i(this,t,arguments[1])}})},{126:126,40:40,60:60}],166:[function(t,n,r){"use strict";var e=t(60),i=t(51);e(e.S+e.F*t(62)(function(){function F(){}return!(Array.of.call(F)instanceof F)}),"Array",{of:function of(){for(var t=0,n=arguments.length,r=new("function"==typeof this?this:Array)(n);t<n;)i(r,t,arguments[t++]);return r.length=n,r}})},{51:51,60:60,62:62}],167:[function(t,n,r){"use strict";var e=t(60),i=t(41);e(e.P+e.F*!t(126)([].reduceRight,!0),"Array",{reduceRight:function reduceRight(t){return i(this,t,arguments.length,arguments[1],!0)}})},{126:126,41:41,60:60}],168:[function(t,n,r){"use strict";var e=t(60),i=t(41);e(e.P+e.F*!t(126)([].reduce,!0),"Array",{reduce:function reduce(t){return i(this,t,arguments.length,arguments[1],!1)}})},{126:126,41:41,60:60}],169:[function(t,n,r){"use strict";var e=t(60),i=t(71),f=t(46),s=t(135),l=t(139),h=[].slice;e(e.P+e.F*t(62)(function(){i&&h.call(i)}),"Array",{slice:function slice(t,n){var r=l(this.length),e=f(this);if(n=void 0===n?r:n,"Array"==e)return h.call(this,t,n);for(var i=s(t,r),o=s(n,r),u=l(o-i),c=new Array(u),a=0;a<u;a++)c[a]="String"==e?this.charAt(i+a):this[i+a];return c}})},{135:135,139:139,46:46,60:60,62:62,71:71}],170:[function(t,n,r){"use strict";var e=t(60),i=t(40)(3);e(e.P+e.F*!t(126)([].some,!0),"Array",{some:function some(t){return i(this,t,arguments[1])}})},{126:126,40:40,60:60}],171:[function(t,n,r){"use strict";var e=t(60),i=t(31),o=t(140),u=t(62),c=[].sort,a=[1,2,3];e(e.P+e.F*(u(function(){a.sort(void 0)})||!u(function(){a.sort(null)})||!t(126)(c)),"Array",{sort:function sort(t){return void 0===t?c.call(o(this)):c.call(o(this),i(t))}})},{126:126,140:140,31:31,60:60,62:62}],172:[function(t,n,r){t(121)("Array")},{121:121}],173:[function(t,n,r){var e=t(60);e(e.S,"Date",{now:function(){return(new Date).getTime()}})},{60:60}],174:[function(t,n,r){var e=t(60),i=t(53);e(e.P+e.F*(Date.prototype.toISOString!==i),"Date",{toISOString:i})},{53:53,60:60}],175:[function(t,n,r){"use strict";var e=t(60),i=t(140),o=t(141);e(e.P+e.F*t(62)(function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}),"Date",{toJSON:function toJSON(t){var n=i(this),r=o(n);return"number"!=typeof r||isFinite(r)?n.toISOString():null}})},{140:140,141:141,60:60,62:62}],176:[function(t,n,r){var e=t(150)("toPrimitive"),i=Date.prototype;e in i||t(70)(i,e,t(54))},{150:150,54:54,70:70}],177:[function(t,n,r){var e=Date.prototype,i="Invalid Date",o="toString",u=e[o],c=e.getTime;new Date(NaN)+""!=i&&t(116)(e,o,function toString(){var t=c.call(this);return t==t?u.call(this):i})},{116:116}],178:[function(t,n,r){var e=t(60);e(e.P,"Function",{bind:t(44)})},{44:44,60:60}],179:[function(t,n,r){"use strict";var e=t(79),i=t(103),o=t(150)("hasInstance"),u=Function.prototype;o in u||t(97).f(u,o,{value:function(t){if("function"!=typeof this||!e(t))return!1;if(!e(this.prototype))return t instanceof this;for(;t=i(t);)if(this.prototype===t)return!0;return!1}})},{103:103,150:150,79:79,97:97}],180:[function(t,n,r){var e=t(97).f,i=Function.prototype,o=/^\s*function ([^ (]*)/;"name"in i||t(56)&&e(i,"name",{configurable:!0,get:function(){try{return(""+this).match(o)[1]}catch(t){return""}}})},{56:56,97:97}],181:[function(t,n,r){"use strict";var e=t(47),i=t(147);n.exports=t(49)("Map",function(t){return function Map(){return t(this,0<arguments.length?arguments[0]:void 0)}},{get:function get(t){var n=e.getEntry(i(this,"Map"),t);return n&&n.v},set:function set(t,n){return e.def(i(this,"Map"),0===t?0:t,n)}},e,!0)},{147:147,47:47,49:49}],182:[function(t,n,r){var e=t(60),i=t(90),o=Math.sqrt,u=Math.acosh;e(e.S+e.F*!(u&&710==Math.floor(u(Number.MAX_VALUE))&&u(1/0)==1/0),"Math",{acosh:function acosh(t){return(t=+t)<1?NaN:94906265.62425156<t?Math.log(t)+Math.LN2:i(t-1+o(t-1)*o(t+1))}})},{60:60,90:90}],183:[function(t,n,r){var e=t(60),i=Math.asinh;e(e.S+e.F*!(i&&0<1/i(0)),"Math",{asinh:function asinh(t){return isFinite(t=+t)&&0!=t?t<0?-asinh(-t):Math.log(t+Math.sqrt(t*t+1)):t}})},{60:60}],184:[function(t,n,r){var e=t(60),i=Math.atanh;e(e.S+e.F*!(i&&1/i(-0)<0),"Math",{atanh:function atanh(t){return 0==(t=+t)?t:Math.log((1+t)/(1-t))/2}})},{60:60}],185:[function(t,n,r){var e=t(60),i=t(91);e(e.S,"Math",{cbrt:function cbrt(t){return i(t=+t)*Math.pow(Math.abs(t),1/3)}})},{60:60,91:91}],186:[function(t,n,r){var e=t(60);e(e.S,"Math",{clz32:function clz32(t){return(t>>>=0)?31-Math.floor(Math.log(t+.5)*Math.LOG2E):32}})},{60:60}],187:[function(t,n,r){var e=t(60),i=Math.exp;e(e.S,"Math",{cosh:function cosh(t){return(i(t=+t)+i(-t))/2}})},{60:60}],188:[function(t,n,r){var e=t(60),i=t(88);e(e.S+e.F*(i!=Math.expm1),"Math",{expm1:i})},{60:60,88:88}],189:[function(t,n,r){var e=t(60);e(e.S,"Math",{fround:t(89)})},{60:60,89:89}],190:[function(t,n,r){var e=t(60),a=Math.abs;e(e.S,"Math",{hypot:function hypot(t,n){for(var r,e,i=0,o=0,u=arguments.length,c=0;o<u;)c<(r=a(arguments[o++]))?(i=i*(e=c/r)*e+1,c=r):i+=0<r?(e=r/c)*e:r;return c===1/0?1/0:c*Math.sqrt(i)}})},{60:60}],191:[function(t,n,r){var e=t(60),i=Math.imul;e(e.S+e.F*t(62)(function(){return-5!=i(4294967295,5)||2!=i.length}),"Math",{imul:function imul(t,n){var r=65535,e=+t,i=+n,o=r&e,u=r&i;return 0|o*u+((r&e>>>16)*u+o*(r&i>>>16)<<16>>>0)}})},{60:60,62:62}],192:[function(t,n,r){var e=t(60);e(e.S,"Math",{log10:function log10(t){return Math.log(t)*Math.LOG10E}})},{60:60}],193:[function(t,n,r){var e=t(60);e(e.S,"Math",{log1p:t(90)})},{60:60,90:90}],194:[function(t,n,r){var e=t(60);e(e.S,"Math",{log2:function log2(t){return Math.log(t)/Math.LN2}})},{60:60}],195:[function(t,n,r){var e=t(60);e(e.S,"Math",{sign:t(91)})},{60:60,91:91}],196:[function(t,n,r){var e=t(60),i=t(88),o=Math.exp;e(e.S+e.F*t(62)(function(){return-2e-17!=!Math.sinh(-2e-17)}),"Math",{sinh:function sinh(t){return Math.abs(t=+t)<1?(i(t)-i(-t))/2:(o(t-1)-o(-t-1))*(Math.E/2)}})},{60:60,62:62,88:88}],197:[function(t,n,r){var e=t(60),i=t(88),o=Math.exp;e(e.S,"Math",{tanh:function tanh(t){var n=i(t=+t),r=i(-t);return n==1/0?1:r==1/0?-1:(n-r)/(o(t)+o(-t))}})},{60:60,88:88}],198:[function(t,n,r){var e=t(60);e(e.S,"Math",{trunc:function trunc(t){return(0<t?Math.floor:Math.ceil)(t)}})},{60:60}],199:[function(t,n,r){"use strict";function wN(t){var n=s(t,!1);if("string"==typeof n&&2<n.length){var r,e,i,o=(n=x?n.trim():h(n,3)).charCodeAt(0);if(43===o||45===o){if(88===(r=n.charCodeAt(2))||120===r)return NaN}else if(48===o){switch(n.charCodeAt(1)){case 66:case 98:e=2,i=49;break;case 79:case 111:e=8,i=55;break;default:return+n}for(var u,c=n.slice(2),a=0,f=c.length;a<f;a++)if((u=c.charCodeAt(a))<48||i<u)return NaN;return parseInt(c,e)}}return+n}var e=t(68),i=t(69),o=t(46),u=t(73),s=t(141),c=t(62),a=t(101).f,f=t(99).f,l=t(97).f,h=t(132).trim,p="Number",v=e[p],g=v,y=v.prototype,d=o(t(96)(y))==p,x="trim"in String.prototype;if(!v(" 0o1")||!v("0b1")||v("+0x1")){v=function Number(t){var n=arguments.length<1?0:t,r=this;return r instanceof v&&(d?c(function(){y.valueOf.call(r)}):o(r)!=p)?u(new g(wN(n)),r,v):wN(n)};for(var m,S=t(56)?a(g):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),b=0;S.length>b;b++)i(g,m=S[b])&&!i(v,m)&&l(v,m,f(g,m));(v.prototype=y).constructor=v,t(116)(e,p,v)}},{101:101,116:116,132:132,141:141,46:46,56:56,62:62,68:68,69:69,73:73,96:96,97:97,99:99}],200:[function(t,n,r){var e=t(60);e(e.S,"Number",{EPSILON:Math.pow(2,-52)})},{60:60}],201:[function(t,n,r){var e=t(60),i=t(68).isFinite;e(e.S,"Number",{isFinite:function isFinite(t){return"number"==typeof t&&i(t)}})},{60:60,68:68}],202:[function(t,n,r){var e=t(60);e(e.S,"Number",{isInteger:t(78)})},{60:60,78:78}],203:[function(t,n,r){var e=t(60);e(e.S,"Number",{isNaN:function isNaN(t){return t!=t}})},{60:60}],204:[function(t,n,r){var e=t(60),i=t(78),o=Math.abs;e(e.S,"Number",{isSafeInteger:function isSafeInteger(t){return i(t)&&o(t)<=9007199254740991}})},{60:60,78:78}],205:[function(t,n,r){var e=t(60);e(e.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},{60:60}],206:[function(t,n,r){var e=t(60);e(e.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991})},{60:60}],207:[function(t,n,r){var e=t(60),i=t(110);e(e.S+e.F*(Number.parseFloat!=i),"Number",{parseFloat:i})},{110:110,60:60}],208:[function(t,n,r){var e=t(60),i=t(111);e(e.S+e.F*(Number.parseInt!=i),"Number",{parseInt:i})},{111:111,60:60}],209:[function(t,n,r){"use strict";function PO(t,n){for(var r=-1,e=n;++r<6;)e+=t*u[r],u[r]=e%1e7,e=o(e/1e7)}function QO(t){for(var n=6,r=0;0<=--n;)r+=u[n],u[n]=o(r/t),r=r%t*1e7}function RO(){for(var t=6,n="";0<=--t;)if(""!==n||0===t||0!==u[t]){var r=String(u[t]);n=""===n?r:n+l.call("0",7-r.length)+r}return n}var e=t(60),f=t(137),s=t(32),l=t(131),i=1..toFixed,o=Math.floor,u=[0,0,0,0,0,0],h="Number.toFixed: incorrect invocation!",p=function(t,n,r){return 0===n?r:n%2==1?p(t,n-1,r*t):p(t*t,n/2,r)};e(e.P+e.F*(!!i&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!t(62)(function(){i.call({})})),"Number",{toFixed:function toFixed(t){var n,r,e,i,o=s(this,h),u=f(t),c="",a="0";if(u<0||20<u)throw RangeError(h);if(o!=o)return"NaN";if(o<=-1e21||1e21<=o)return String(o);if(o<0&&(c="-",o=-o),1e-21<o)if(r=(n=function(t){for(var n=0,r=t;4096<=r;)n+=12,r/=4096;for(;2<=r;)n+=1,r/=2;return n}(o*p(2,69,1))-69)<0?o*p(2,-n,1):o/p(2,n,1),r*=4503599627370496,0<(n=52-n)){for(PO(0,r),e=u;7<=e;)PO(1e7,0),e-=7;for(PO(p(10,e,1),0),e=n-1;23<=e;)QO(1<<23),e-=23;QO(1<<e),PO(1,1),QO(2),a=RO()}else PO(0,r),PO(1<<-n,0),a=RO()+l.call("0",u);return a=0<u?c+((i=a.length)<=u?"0."+l.call("0",u-i)+a:a.slice(0,i-u)+"."+a.slice(i-u)):c+a}})},{131:131,137:137,32:32,60:60,62:62}],210:[function(t,n,r){"use strict";var e=t(60),i=t(62),o=t(32),u=1..toPrecision;e(e.P+e.F*(i(function(){return"1"!==u.call(1,void 0)})||!i(function(){u.call({})})),"Number",{toPrecision:function toPrecision(t){var n=o(this,"Number#toPrecision: incorrect invocation!");return void 0===t?u.call(n):u.call(n,t)}})},{32:32,60:60,62:62}],211:[function(t,n,r){var e=t(60);e(e.S+e.F,"Object",{assign:t(95)})},{60:60,95:95}],212:[function(t,n,r){var e=t(60);e(e.S,"Object",{create:t(96)})},{60:60,96:96}],213:[function(t,n,r){var e=t(60);e(e.S+e.F*!t(56),"Object",{defineProperties:t(98)})},{56:56,60:60,98:98}],214:[function(t,n,r){var e=t(60);e(e.S+e.F*!t(56),"Object",{defineProperty:t(97).f})},{56:56,60:60,97:97}],215:[function(t,n,r){var e=t(79),i=t(92).onFreeze;t(107)("freeze",function(n){return function freeze(t){return n&&e(t)?n(i(t)):t}})},{107:107,79:79,92:92}],216:[function(t,n,r){var e=t(138),i=t(99).f;t(107)("getOwnPropertyDescriptor",function(){return function getOwnPropertyDescriptor(t,n){return i(e(t),n)}})},{107:107,138:138,99:99}],217:[function(t,n,r){t(107)("getOwnPropertyNames",function(){return t(100).f})},{100:100,107:107}],218:[function(t,n,r){var e=t(140),i=t(103);t(107)("getPrototypeOf",function(){return function getPrototypeOf(t){return i(e(t))}})},{103:103,107:107,140:140}],219:[function(t,n,r){var e=t(79);t(107)("isExtensible",function(n){return function isExtensible(t){return!!e(t)&&(!n||n(t))}})},{107:107,79:79}],220:[function(t,n,r){var e=t(79);t(107)("isFrozen",function(n){return function isFrozen(t){return!e(t)||!!n&&n(t)}})},{107:107,79:79}],221:[function(t,n,r){var e=t(79);t(107)("isSealed",function(n){return function isSealed(t){return!e(t)||!!n&&n(t)}})},{107:107,79:79}],222:[function(t,n,r){var e=t(60);e(e.S,"Object",{is:t(119)})},{119:119,60:60}],223:[function(t,n,r){var e=t(140),i=t(105);t(107)("keys",function(){return function keys(t){return i(e(t))}})},{105:105,107:107,140:140}],224:[function(t,n,r){var e=t(79),i=t(92).onFreeze;t(107)("preventExtensions",function(n){return function preventExtensions(t){return n&&e(t)?n(i(t)):t}})},{107:107,79:79,92:92}],225:[function(t,n,r){var e=t(79),i=t(92).onFreeze;t(107)("seal",function(n){return function seal(t){return n&&e(t)?n(i(t)):t}})},{107:107,79:79,92:92}],226:[function(t,n,r){var e=t(60);e(e.S,"Object",{setPrototypeOf:t(120).set})},{120:120,60:60}],227:[function(t,n,r){"use strict";var e=t(45),i={};i[t(150)("toStringTag")]="z",i+""!="[object z]"&&t(116)(Object.prototype,"toString",function toString(){return"[object "+e(this)+"]"},!0)},{116:116,150:150,45:45}],228:[function(t,n,r){var e=t(60),i=t(110);e(e.G+e.F*(parseFloat!=i),{parseFloat:i})},{110:110,60:60}],229:[function(t,n,r){var e=t(60),i=t(111);e(e.G+e.F*(parseInt!=i),{parseInt:i})},{111:111,60:60}],230:[function(r,t,n){"use strict";function SR(){}function ZR(t){var n;return!(!h(t)||"function"!=typeof(n=t.then))&&n}function $R(s,r){if(!s._n){s._n=!0;var e=s._c;x(function(){for(var a=s._v,f=1==s._s,t=0,n=function(t){var n,r,e,i=f?t.ok:t.fail,o=t.resolve,u=t.reject,c=t.domain;try{i?(f||(2==s._h&&j(s),s._h=1),!0===i?n=a:(c&&c.enter(),n=i(a),c&&(c.exit(),e=!0)),n===t.promise?u(E("Promise-chain cycle")):(r=ZR(n))?r.call(n,o,u):o(n)):u(a)}catch(t){c&&!e&&c.exit(),u(t)}};e.length>t;)n(e[t++]);s._c=[],s._n=!1,r&&!s._h&&R(s)})}}function cS(t){var n=this;n._d||(n._d=!0,(n=n._w||n)._v=t,n._s=2,n._a||(n._a=n._c.slice()),$R(n,!0))}var e,i,o,u,c=r(87),a=r(68),f=r(52),s=r(45),l=r(60),h=r(79),p=r(31),v=r(35),g=r(66),y=r(125),d=r(134).set,x=r(93)(),m=r(94),S=r(112),b=r(146),w=r(113),_="Promise",E=a.TypeError,O=a.process,I=O&&O.versions,F=I&&I.v8||"",P=a[_],A="process"==s(O),M=i=m.f,k=!!function(){try{var t=P.resolve(1),n=(t.constructor={})[r(150)("species")]=function(t){t(SR,SR)};return(A||"function"==typeof PromiseRejectionEvent)&&t.then(SR)instanceof n&&0!==F.indexOf("6.6")&&-1===b.indexOf("Chrome/66")}catch(t){}}(),R=function(o){d.call(a,function(){var t,n,r,e=o._v,i=N(o);if(i&&(t=S(function(){A?O.emit("unhandledRejection",e,o):(n=a.onunhandledrejection)?n({promise:o,reason:e}):(r=a.console)&&r.error&&r.error("Unhandled promise rejection",e)}),o._h=A||N(o)?2:1),o._a=void 0,i&&t.e)throw t.v})},N=function(t){return 1!==t._h&&0===(t._a||t._c).length},j=function(n){d.call(a,function(){var t;A?O.emit("rejectionHandled",n):(t=a.onrejectionhandled)&&t({promise:n,reason:n._v})})},T=function(t){var r,e=this;if(!e._d){e._d=!0,e=e._w||e;try{if(e===t)throw E("Promise can't be resolved itself");(r=ZR(t))?x(function(){var n={_w:e,_d:!1};try{r.call(t,f(T,n,1),f(cS,n,1))}catch(t){cS.call(n,t)}}):(e._v=t,e._s=1,$R(e,!1))}catch(t){cS.call({_w:e,_d:!1},t)}}};k||(P=function Promise(t){v(this,P,_,"_h"),p(t),e.call(this);try{t(f(T,this,1),f(cS,this,1))}catch(t){cS.call(this,t)}},(e=function Promise(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=r(115)(P.prototype,{then:function then(t,n){var r=M(y(this,P));return r.ok="function"!=typeof t||t,r.fail="function"==typeof n&&n,r.domain=A?O.domain:void 0,this._c.push(r),this._a&&this._a.push(r),this._s&&$R(this,!1),r.promise},catch:function(t){return this.then(void 0,t)}}),o=function(){var t=new e;this.promise=t,this.resolve=f(T,t,1),this.reject=f(cS,t,1)},m.f=M=function(t){return t===P||t===u?new o(t):i(t)}),l(l.G+l.W+l.F*!k,{Promise:P}),r(122)(P,_),r(121)(_),u=r(50)[_],l(l.S+l.F*!k,_,{reject:function reject(t){var n=M(this);return(0,n.reject)(t),n.promise}}),l(l.S+l.F*(c||!k),_,{resolve:function resolve(t){return w(c&&this===u?P:this,t)}}),l(l.S+l.F*!(k&&r(84)(function(t){P.all(t).catch(SR)})),_,{all:function all(t){var u=this,n=M(u),c=n.resolve,a=n.reject,r=S(function(){var e=[],i=0,o=1;g(t,!1,function(t){var n=i++,r=!1;e.push(void 0),o++,u.resolve(t).then(function(t){r||(r=!0,e[n]=t,--o||c(e))},a)}),--o||c(e)});return r.e&&a(r.v),n.promise},race:function race(t){var n=this,r=M(n),e=r.reject,i=S(function(){g(t,!1,function(t){n.resolve(t).then(r.resolve,e)})});return i.e&&e(i.v),r.promise}})},{112:112,113:113,115:115,121:121,122:122,125:125,134:134,146:146,150:150,31:31,35:35,45:45,50:50,52:52,60:60,66:66,68:68,79:79,84:84,87:87,93:93,94:94}],231:[function(t,n,r){var e=t(60),o=t(31),u=t(36),c=(t(68).Reflect||{}).apply,a=Function.apply;e(e.S+e.F*!t(62)(function(){c(function(){})}),"Reflect",{apply:function apply(t,n,r){var e=o(t),i=u(r);return c?c(e,n,i):a.call(e,n,i)}})},{31:31,36:36,60:60,62:62,68:68}],232:[function(t,n,r){var e=t(60),c=t(96),a=t(31),f=t(36),s=t(79),i=t(62),l=t(44),h=(t(68).Reflect||{}).construct,p=i(function(){function F(){}return!(h(function(){},[],F)instanceof F)}),v=!i(function(){h(function(){})});e(e.S+e.F*(p||v),"Reflect",{construct:function construct(t,n){a(t),f(n);var r=arguments.length<3?t:a(arguments[2]);if(v&&!p)return h(t,n,r);if(t==r){switch(n.length){case 0:return new t;case 1:return new t(n[0]);case 2:return new t(n[0],n[1]);case 3:return new t(n[0],n[1],n[2]);case 4:return new t(n[0],n[1],n[2],n[3])}var e=[null];return e.push.apply(e,n),new(l.apply(t,e))}var i=r.prototype,o=c(s(i)?i:Object.prototype),u=Function.apply.call(t,o,n);return s(u)?u:o}})},{31:31,36:36,44:44,60:60,62:62,68:68,79:79,96:96}],233:[function(t,n,r){var e=t(97),i=t(60),o=t(36),u=t(141);i(i.S+i.F*t(62)(function(){Reflect.defineProperty(e.f({},1,{value:1}),1,{value:2})}),"Reflect",{defineProperty:function defineProperty(t,n,r){o(t),n=u(n,!0),o(r);try{return e.f(t,n,r),!0}catch(t){return!1}}})},{141:141,36:36,60:60,62:62,97:97}],234:[function(t,n,r){var e=t(60),i=t(99).f,o=t(36);e(e.S,"Reflect",{deleteProperty:function deleteProperty(t,n){var r=i(o(t),n);return!(r&&!r.configurable)&&delete t[n]}})},{36:36,60:60,99:99}],235:[function(t,n,r){"use strict";function AU(t){this._t=i(t),this._i=0;var n,r=this._k=[];for(n in t)r.push(n)}var e=t(60),i=t(36);t(82)(AU,"Object",function(){var t,n=this._k;do{if(this._i>=n.length)return{value:void 0,done:!0}}while(!((t=n[this._i++])in this._t));return{value:t,done:!1}}),e(e.S,"Reflect",{enumerate:function enumerate(t){return new AU(t)}})},{36:36,60:60,82:82}],236:[function(t,n,r){var e=t(99),i=t(60),o=t(36);i(i.S,"Reflect",{getOwnPropertyDescriptor:function getOwnPropertyDescriptor(t,n){return e.f(o(t),n)}})},{36:36,60:60,99:99}],237:[function(t,n,r){var e=t(60),i=t(103),o=t(36);e(e.S,"Reflect",{getPrototypeOf:function getPrototypeOf(t){return i(o(t))}})},{103:103,36:36,60:60}],238:[function(t,n,r){var o=t(99),u=t(103),c=t(69),e=t(60),a=t(79),f=t(36);e(e.S,"Reflect",{get:function get(t,n){var r,e,i=arguments.length<3?t:arguments[2];return f(t)===i?t[n]:(r=o.f(t,n))?c(r,"value")?r.value:void 0!==r.get?r.get.call(i):void 0:a(e=u(t))?get(e,n,i):void 0}})},{103:103,36:36,60:60,69:69,79:79,99:99}],239:[function(t,n,r){var e=t(60);e(e.S,"Reflect",{has:function has(t,n){return n in t}})},{60:60}],240:[function(t,n,r){var e=t(60),i=t(36),o=Object.isExtensible;e(e.S,"Reflect",{isExtensible:function isExtensible(t){return i(t),!o||o(t)}})},{36:36,60:60}],241:[function(t,n,r){var e=t(60);e(e.S,"Reflect",{ownKeys:t(109)})},{109:109,60:60}],242:[function(t,n,r){var e=t(60),i=t(36),o=Object.preventExtensions;e(e.S,"Reflect",{preventExtensions:function preventExtensions(t){i(t);try{return o&&o(t),!0}catch(t){return!1}}})},{36:36,60:60}],243:[function(t,n,r){var e=t(60),i=t(120);i&&e(e.S,"Reflect",{setPrototypeOf:function setPrototypeOf(t,n){i.check(t,n);try{return i.set(t,n),!0}catch(t){return!1}}})},{120:120,60:60}],244:[function(t,n,r){var c=t(97),a=t(99),f=t(103),s=t(69),e=t(60),l=t(114),h=t(36),p=t(79);e(e.S,"Reflect",{set:function set(t,n,r){var e,i,o=arguments.length<4?t:arguments[3],u=a.f(h(t),n);if(!u){if(p(i=f(t)))return set(i,n,r,o);u=l(0)}if(s(u,"value")){if(!1===u.writable||!p(o))return!1;if(e=a.f(o,n)){if(e.get||e.set||!1===e.writable)return!1;e.value=r,c.f(o,n,e)}else c.f(o,n,l(0,r));return!0}return void 0!==u.set&&(u.set.call(o,r),!0)}})},{103:103,114:114,36:36,60:60,69:69,79:79,97:97,99:99}],245:[function(t,n,r){var e=t(68),o=t(73),i=t(97).f,u=t(101).f,c=t(80),a=t(64),f=e.RegExp,s=f,l=f.prototype,h=/a/g,p=/a/g,v=new f(h)!==h;if(t(56)&&(!v||t(62)(function(){return p[t(150)("match")]=!1,f(h)!=h||f(p)==p||"/a/i"!=f(h,"i")}))){f=function RegExp(t,n){var r=this instanceof f,e=c(t),i=void 0===n;return!r&&e&&t.constructor===f&&i?t:o(v?new s(e&&!i?t.source:t,n):s((e=t instanceof f)?t.source:t,e&&i?a.call(t):n),r?this:l,f)};function vW(n){n in f||i(f,n,{configurable:!0,get:function(){return s[n]},set:function(t){s[n]=t}})}for(var g=u(s),y=0;g.length>y;)vW(g[y++]);(l.constructor=f).prototype=l,t(116)(e,"RegExp",f)}t(121)("RegExp")},{101:101,116:116,121:121,150:150,56:56,62:62,64:64,68:68,73:73,80:80,97:97}],246:[function(t,n,r){"use strict";var e=t(118);t(60)({target:"RegExp",proto:!0,forced:e!==/./.exec},{exec:e})},{118:118,60:60}],247:[function(t,n,r){t(56)&&"g"!=/./g.flags&&t(97).f(RegExp.prototype,"flags",{configurable:!0,get:t(64)})},{56:56,64:64,97:97}],248:[function(t,n,r){"use strict";var l=t(36),h=t(139),p=t(34),v=t(117);t(63)("match",1,function(e,i,f,s){return[function match(t){var n=e(this),r=null==t?void 0:t[i];return void 0!==r?r.call(t,n):new RegExp(t)[i](String(n))},function(t){var n=s(f,t,this);if(n.done)return n.value;var r=l(t),e=String(this);if(!r.global)return v(r,e);for(var i,o=r.unicode,u=[],c=r.lastIndex=0;null!==(i=v(r,e));){var a=String(i[0]);""===(u[c]=a)&&(r.lastIndex=p(e,h(r.lastIndex),o)),c++}return 0===c?null:u}]})},{117:117,139:139,34:34,36:36,63:63}],249:[function(t,n,r){"use strict";var _=t(36),e=t(140),E=t(139),O=t(137),I=t(34),F=t(117),P=Math.max,A=Math.min,h=Math.floor,p=/\$([$&`']|\d\d?|<[^>]*>)/g,v=/\$([$&`']|\d\d?)/g;t(63)("replace",2,function(i,o,b,w){return[function replace(t,n){var r=i(this),e=null==t?void 0:t[o];return void 0!==e?e.call(t,r,n):b.call(String(r),t,n)},function(t,n){var r=w(b,t,this,n);if(r.done)return r.value;var e=_(t),i=String(this),o="function"==typeof n;o||(n=String(n));var u=e.global;if(u){var c=e.unicode;e.lastIndex=0}for(var a=[];;){var f=F(e,i);if(null===f)break;if(a.push(f),!u)break;""===String(f[0])&&(e.lastIndex=I(i,E(e.lastIndex),c))}for(var s,l="",h=0,p=0;p<a.length;p++){f=a[p];for(var v=String(f[0]),g=P(A(O(f.index),i.length),0),y=[],d=1;d<f.length;d++)y.push(void 0===(s=f[d])?s:String(s));var x=f.groups;if(o){var m=[v].concat(y,g,i);void 0!==x&&m.push(x);var S=String(n.apply(void 0,m))}else S=getSubstitution(v,i,g,y,x,n);h<=g&&(l+=i.slice(h,g)+S,h=g+v.length)}return l+i.slice(h)}];function getSubstitution(o,u,c,a,f,t){var s=c+o.length,l=a.length,n=v;return void 0!==f&&(f=e(f),n=p),b.call(t,n,function(t,n){var r;switch(n.charAt(0)){case"$":return"$";case"&":return o;case"`":return u.slice(0,c);case"'":return u.slice(s);case"<":r=f[n.slice(1,-1)];break;default:var e=+n;if(0==e)return t;if(l<e){var i=h(e/10);return 0===i?t:i<=l?void 0===a[i-1]?n.charAt(1):a[i-1]+n.charAt(1):t}r=a[e-1]}return void 0===r?"":r})}})},{117:117,137:137,139:139,140:140,34:34,36:36,63:63}],250:[function(t,n,r){"use strict";var a=t(36),f=t(119),s=t(117);t(63)("search",1,function(e,i,u,c){return[function search(t){var n=e(this),r=null==t?void 0:t[i];return void 0!==r?r.call(t,n):new RegExp(t)[i](String(n))},function(t){var n=c(u,t,this);if(n.done)return n.value;var r=a(t),e=String(this),i=r.lastIndex;f(i,0)||(r.lastIndex=0);var o=s(r,e);return f(r.lastIndex,i)||(r.lastIndex=i),null===o?-1:o.index}]})},{117:117,119:119,36:36,63:63}],251:[function(t,n,r){"use strict";var l=t(80),m=t(36),S=t(125),b=t(34),w=t(139),_=t(117),h=t(118),e=t(62),E=Math.min,p=[].push,u="split",v="length",g="lastIndex",O=4294967295,I=!e(function(){RegExp(O,"y")});t(63)("split",2,function(i,o,y,d){var x;return x="c"=="abbc"[u](/(b)*/)[1]||4!="test"[u](/(?:)/,-1)[v]||2!="ab"[u](/(?:ab)*/)[v]||4!="."[u](/(.?)(.?)/)[v]||1<"."[u](/()()/)[v]||""[u](/.?/)[v]?function(t,n){var r=String(this);if(void 0===t&&0===n)return[];if(!l(t))return y.call(r,t,n);for(var e,i,o,u=[],c=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),a=0,f=void 0===n?O:n>>>0,s=new RegExp(t.source,c+"g");(e=h.call(s,r))&&!(a<(i=s[g])&&(u.push(r.slice(a,e.index)),1<e[v]&&e.index<r[v]&&p.apply(u,e.slice(1)),o=e[0][v],a=i,u[v]>=f));)s[g]===e.index&&s[g]++;return a===r[v]?!o&&s.test("")||u.push(""):u.push(r.slice(a)),u[v]>f?u.slice(0,f):u}:"0"[u](void 0,0)[v]?function(t,n){return void 0===t&&0===n?[]:y.call(this,t,n)}:y,[function split(t,n){var r=i(this),e=null==t?void 0:t[o];return void 0!==e?e.call(t,r,n):x.call(String(r),t,n)},function(t,n){var r=d(x,t,this,n,x!==y);if(r.done)return r.value;var e=m(t),i=String(this),o=S(e,RegExp),u=e.unicode,c=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(I?"y":"g"),a=new o(I?e:"^(?:"+e.source+")",c),f=void 0===n?O:n>>>0;if(0==f)return[];if(0===i.length)return null===_(a,i)?[i]:[];for(var s=0,l=0,h=[];l<i.length;){a.lastIndex=I?l:0;var p,v=_(a,I?i:i.slice(l));if(null===v||(p=E(w(a.lastIndex+(I?0:l)),i.length))===s)l=b(i,l,u);else{if(h.push(i.slice(s,l)),h.length===f)return h;for(var g=1;g<=v.length-1;g++)if(h.push(v[g]),h.length===f)return h;l=s=p}}return h.push(i.slice(s)),h}]})},{117:117,118:118,125:125,139:139,34:34,36:36,62:62,63:63,80:80}],252:[function(n,t,r){"use strict";n(247);function PZ(t){n(116)(RegExp.prototype,u,t,!0)}var e=n(36),i=n(64),o=n(56),u="toString",c=/./[u];n(62)(function(){return"/a/b"!=c.call({source:"a",flags:"b"})})?PZ(function toString(){var t=e(this);return"/".concat(t.source,"/","flags"in t?t.flags:!o&&t instanceof RegExp?i.call(t):void 0)}):c.name!=u&&PZ(function toString(){return c.call(this)})},{116:116,247:247,36:36,56:56,62:62,64:64}],253:[function(t,n,r){"use strict";var e=t(47),i=t(147);n.exports=t(49)("Set",function(t){return function Set(){return t(this,0<arguments.length?arguments[0]:void 0)}},{add:function add(t){return e.def(i(this,"Set"),t=0===t?0:t,t)}},e)},{147:147,47:47,49:49}],254:[function(t,n,r){"use strict";t(129)("anchor",function(n){return function anchor(t){return n(this,"a","name",t)}})},{129:129}],255:[function(t,n,r){"use strict";t(129)("big",function(t){return function big(){return t(this,"big","","")}})},{129:129}],256:[function(t,n,r){"use strict";t(129)("blink",function(t){return function blink(){return t(this,"blink","","")}})},{129:129}],257:[function(t,n,r){"use strict";t(129)("bold",function(t){return function bold(){return t(this,"b","","")}})},{129:129}],258:[function(t,n,r){"use strict";var e=t(60),i=t(127)(!1);e(e.P,"String",{codePointAt:function codePointAt(t){return i(this,t)}})},{127:127,60:60}],259:[function(t,n,r){"use strict";var e=t(60),u=t(139),c=t(128),a="endsWith",f=""[a];e(e.P+e.F*t(61)(a),"String",{endsWith:function endsWith(t){var n=c(this,t,a),r=1<arguments.length?arguments[1]:void 0,e=u(n.length),i=void 0===r?e:Math.min(u(r),e),o=String(t);return f?f.call(n,o,i):n.slice(i-o.length,i)===o}})},{128:128,139:139,60:60,61:61}],260:[function(t,n,r){"use strict";t(129)("fixed",function(t){return function fixed(){return t(this,"tt","","")}})},{129:129}],261:[function(t,n,r){"use strict";t(129)("fontcolor",function(n){return function fontcolor(t){return n(this,"font","color",t)}})},{129:129}],262:[function(t,n,r){"use strict";t(129)("fontsize",function(n){return function fontsize(t){return n(this,"font","size",t)}})},{129:129}],263:[function(t,n,r){var e=t(60),o=t(135),u=String.fromCharCode,i=String.fromCodePoint;e(e.S+e.F*(!!i&&1!=i.length),"String",{fromCodePoint:function fromCodePoint(t){for(var n,r=[],e=arguments.length,i=0;i<e;){if(n=+arguments[i++],o(n,1114111)!==n)throw RangeError(n+" is not a valid code point");r.push(n<65536?u(n):u(55296+((n-=65536)>>10),n%1024+56320))}return r.join("")}})},{135:135,60:60}],264:[function(t,n,r){"use strict";var e=t(60),i=t(128),o="includes";e(e.P+e.F*t(61)(o),"String",{includes:function includes(t){return!!~i(this,t,o).indexOf(t,1<arguments.length?arguments[1]:void 0)}})},{128:128,60:60,61:61}],265:[function(t,n,r){"use strict";t(129)("italics",function(t){return function italics(){return t(this,"i","","")}})},{129:129}],266:[function(t,n,r){"use strict";var e=t(127)(!0);t(83)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,n=this._t,r=this._i;return r>=n.length?{value:void 0,done:!0}:(t=e(n,r),this._i+=t.length,{value:t,done:!1})})},{127:127,83:83}],267:[function(t,n,r){"use strict";t(129)("link",function(n){return function link(t){return n(this,"a","href",t)}})},{129:129}],268:[function(t,n,r){var e=t(60),u=t(138),c=t(139);e(e.S,"String",{raw:function raw(t){for(var n=u(t.raw),r=c(n.length),e=arguments.length,i=[],o=0;o<r;)i.push(String(n[o++])),o<e&&i.push(String(arguments[o]));return i.join("")}})},{138:138,139:139,60:60}],269:[function(t,n,r){var e=t(60);e(e.P,"String",{repeat:t(131)})},{131:131,60:60}],270:[function(t,n,r){"use strict";t(129)("small",function(t){return function small(){return t(this,"small","","")}})},{129:129}],271:[function(t,n,r){"use strict";var e=t(60),i=t(139),o=t(128),u="startsWith",c=""[u];e(e.P+e.F*t(61)(u),"String",{startsWith:function startsWith(t){var n=o(this,t,u),r=i(Math.min(1<arguments.length?arguments[1]:void 0,n.length)),e=String(t);return c?c.call(n,e,r):n.slice(r,r+e.length)===e}})},{128:128,139:139,60:60,61:61}],272:[function(t,n,r){"use strict";t(129)("strike",function(t){return function strike(){return t(this,"strike","","")}})},{129:129}],273:[function(t,n,r){"use strict";t(129)("sub",function(t){return function sub(){return t(this,"sub","","")}})},{129:129}],274:[function(t,n,r){"use strict";t(129)("sup",function(t){return function sup(){return t(this,"sup","","")}})},{129:129}],275:[function(t,n,r){"use strict";t(132)("trim",function(t){return function trim(){return t(this,3)}})},{132:132}],276:[function(t,n,r){"use strict";function t1(t){var n=W[t]=E(N[L]);return n._k=t,n}function w1(t,n){x(t);for(var r,e=y(n=b(n)),i=0,o=e.length;i<o;)H(t,r=e[i++],n[r]);return t}function y1(t){var n=U.call(this,t=w(t,!0));return!(this===B&&u(W,t)&&!u(V,t))&&(!(n||!u(this,t)||!u(W,t)||u(this,C)&&this[C][t])||n)}function z1(t,n){if(t=b(t),n=w(n,!0),t!==B||!u(W,n)||u(V,n)){var r=M(t,n);return!r||!u(W,n)||u(t,C)&&t[C][n]||(r.enumerable=!0),r}}function A1(t){for(var n,r=R(b(t)),e=[],i=0;r.length>i;)u(W,n=r[i++])||n==C||n==a||e.push(n);return e}function B1(t){for(var n,r=t===B,e=R(r?V:b(t)),i=[],o=0;e.length>o;)!u(W,n=e[o++])||r&&!u(B,n)||i.push(W[n]);return i}var e=t(68),u=t(69),i=t(56),o=t(60),c=t(116),a=t(92).KEY,f=t(62),s=t(124),l=t(122),h=t(145),p=t(150),v=t(149),g=t(148),y=t(59),d=t(77),x=t(36),m=t(79),S=t(140),b=t(138),w=t(141),_=t(114),E=t(96),O=t(100),I=t(99),F=t(102),P=t(97),A=t(105),M=I.f,k=P.f,R=O.f,N=e.Symbol,j=e.JSON,T=j&&j.stringify,L="prototype",C=p("_hidden"),G=p("toPrimitive"),U={}.propertyIsEnumerable,D=s("symbol-registry"),W=s("symbols"),V=s("op-symbols"),B=Object[L],q="function"==typeof N&&!!F.f,z=e.QObject,$=!z||!z[L]||!z[L].findChild,Y=i&&f(function(){return 7!=E(k({},"a",{get:function(){return k(this,"a",{value:7}).a}})).a})?function(t,n,r){var e=M(B,n);e&&delete B[n],k(t,n,r),e&&t!==B&&k(B,n,e)}:k,J=q&&"symbol"==typeof N.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof N},H=function defineProperty(t,n,r){return t===B&&H(V,n,r),x(t),n=w(n,!0),x(r),u(W,n)?(r.enumerable?(u(t,C)&&t[C][n]&&(t[C][n]=!1),r=E(r,{enumerable:_(0,!1)})):(u(t,C)||k(t,C,_(1,{})),t[C][n]=!0),Y(t,n,r)):k(t,n,r)};q||(c((N=function Symbol(){if(this instanceof N)throw TypeError("Symbol is not a constructor!");var n=h(0<arguments.length?arguments[0]:void 0),r=function(t){this===B&&r.call(V,t),u(this,C)&&u(this[C],n)&&(this[C][n]=!1),Y(this,n,_(1,t))};return i&&$&&Y(B,n,{configurable:!0,set:r}),t1(n)})[L],"toString",function toString(){return this._k}),I.f=z1,P.f=H,t(101).f=O.f=A1,t(106).f=y1,F.f=B1,i&&!t(87)&&c(B,"propertyIsEnumerable",y1,!0),v.f=function(t){return t1(p(t))}),o(o.G+o.W+o.F*!q,{Symbol:N});for(var Q="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),K=0;Q.length>K;)p(Q[K++]);for(var Z=A(p.store),X=0;Z.length>X;)g(Z[X++]);o(o.S+o.F*!q,"Symbol",{for:function(t){return u(D,t+="")?D[t]:D[t]=N(t)},keyFor:function keyFor(t){if(!J(t))throw TypeError(t+" is not a symbol!");for(var n in D)if(D[n]===t)return n},useSetter:function(){$=!0},useSimple:function(){$=!1}}),o(o.S+o.F*!q,"Object",{create:function create(t,n){return void 0===n?E(t):w1(E(t),n)},defineProperty:H,defineProperties:w1,getOwnPropertyDescriptor:z1,getOwnPropertyNames:A1,getOwnPropertySymbols:B1});var tt=f(function(){F.f(1)});o(o.S+o.F*tt,"Object",{getOwnPropertySymbols:function getOwnPropertySymbols(t){return F.f(S(t))}}),j&&o(o.S+o.F*(!q||f(function(){var t=N();return"[null]"!=T([t])||"{}"!=T({a:t})||"{}"!=T(Object(t))})),"JSON",{stringify:function stringify(t){for(var n,r,e=[t],i=1;i<arguments.length;)e.push(arguments[i++]);if(r=n=e[1],(m(n)||void 0!==t)&&!J(t))return d(n)||(n=function(t,n){if("function"==typeof r&&(n=r.call(this,t,n)),!J(n))return n}),e[1]=n,T.apply(j,e)}}),N[L][G]||t(70)(N[L],G,N[L].valueOf),l(N,"Symbol"),l(Math,"Math",!0),l(e.JSON,"JSON",!0)},{100:100,101:101,102:102,105:105,106:106,114:114,116:116,122:122,124:124,138:138,140:140,141:141,145:145,148:148,149:149,150:150,36:36,56:56,59:59,60:60,62:62,68:68,69:69,70:70,77:77,79:79,87:87,92:92,96:96,97:97,99:99}],277:[function(t,n,r){"use strict";var e=t(60),i=t(144),o=t(143),f=t(36),s=t(135),l=t(139),u=t(79),c=t(68).ArrayBuffer,h=t(125),p=o.ArrayBuffer,v=o.DataView,a=i.ABV&&c.isView,g=p.prototype.slice,y=i.VIEW,d="ArrayBuffer";e(e.G+e.W+e.F*(c!==p),{ArrayBuffer:p}),e(e.S+e.F*!i.CONSTR,d,{isView:function isView(t){return a&&a(t)||u(t)&&y in t}}),e(e.P+e.U+e.F*t(62)(function(){return!new p(2).slice(1,void 0).byteLength}),d,{slice:function slice(t,n){if(void 0!==g&&void 0===n)return g.call(f(this),t);for(var r=f(this).byteLength,e=s(t,r),i=s(void 0===n?r:n,r),o=new(h(this,p))(l(i-e)),u=new v(this),c=new v(o),a=0;e<i;)c.setUint8(a++,u.getUint8(e++));return o}}),t(121)(d)},{121:121,125:125,135:135,139:139,143:143,144:144,36:36,60:60,62:62,68:68,79:79}],278:[function(t,n,r){var e=t(60);e(e.G+e.W+e.F*!t(144).ABV,{DataView:t(143).DataView})},{143:143,144:144,60:60}],279:[function(t,n,r){t(142)("Float32",4,function(e){return function Float32Array(t,n,r){return e(this,t,n,r)}})},{142:142}],280:[function(t,n,r){t(142)("Float64",8,function(e){return function Float64Array(t,n,r){return e(this,t,n,r)}})},{142:142}],281:[function(t,n,r){t(142)("Int16",2,function(e){return function Int16Array(t,n,r){return e(this,t,n,r)}})},{142:142}],282:[function(t,n,r){t(142)("Int32",4,function(e){return function Int32Array(t,n,r){return e(this,t,n,r)}})},{142:142}],283:[function(t,n,r){t(142)("Int8",1,function(e){return function Int8Array(t,n,r){return e(this,t,n,r)}})},{142:142}],284:[function(t,n,r){t(142)("Uint16",2,function(e){return function Uint16Array(t,n,r){return e(this,t,n,r)}})},{142:142}],285:[function(t,n,r){t(142)("Uint32",4,function(e){return function Uint32Array(t,n,r){return e(this,t,n,r)}})},{142:142}],286:[function(t,n,r){t(142)("Uint8",1,function(e){return function Uint8Array(t,n,r){return e(this,t,n,r)}})},{142:142}],287:[function(t,n,r){t(142)("Uint8",1,function(e){return function Uint8ClampedArray(t,n,r){return e(this,t,n,r)}},!0)},{142:142}],288:[function(t,n,r){"use strict";function J4(t){return function WeakMap(){return t(this,0<arguments.length?arguments[0]:void 0)}}var o,e=t(68),i=t(40)(0),u=t(116),c=t(92),a=t(95),f=t(48),s=t(79),l=t(147),h=t(147),p=!e.ActiveXObject&&"ActiveXObject"in e,v="WeakMap",g=c.getWeak,y=Object.isExtensible,d=f.ufstore,x={get:function get(t){if(s(t)){var n=g(t);return!0===n?d(l(this,v)).get(t):n?n[this._i]:void 0}},set:function set(t,n){return f.def(l(this,v),t,n)}},m=n.exports=t(49)(v,J4,x,f,!0,!0);h&&p&&(a((o=f.getConstructor(J4,v)).prototype,x),c.NEED=!0,i(["delete","has","get","set"],function(e){var t=m.prototype,i=t[e];u(t,e,function(t,n){if(!s(t)||y(t))return i.call(this,t,n);this._f||(this._f=new o);var r=this._f[e](t,n);return"set"==e?this:r})}))},{116:116,147:147,40:40,48:48,49:49,68:68,79:79,92:92,95:95}],289:[function(t,n,r){"use strict";var e=t(48),i=t(147),o="WeakSet";t(49)(o,function(t){return function WeakSet(){return t(this,0<arguments.length?arguments[0]:void 0)}},{add:function add(t){return e.def(i(this,o),t,!0)}},e,!1,!0)},{147:147,48:48,49:49}],290:[function(t,n,r){"use strict";var e=t(60),i=t(65),o=t(140),u=t(139),c=t(31),a=t(43);e(e.P,"Array",{flatMap:function flatMap(t){var n,r,e=o(this);return c(t),n=u(e.length),r=a(e,0),i(r,e,e,n,0,1,t,arguments[1]),r}}),t(33)("flatMap")},{139:139,140:140,31:31,33:33,43:43,60:60,65:65}],291:[function(t,n,r){"use strict";var e=t(60),i=t(39)(!0);e(e.P,"Array",{includes:function includes(t){return i(this,t,1<arguments.length?arguments[1]:void 0)}}),t(33)("includes")},{33:33,39:39,60:60}],292:[function(t,n,r){var e=t(60),i=t(108)(!0);e(e.S,"Object",{entries:function entries(t){return i(t)}})},{108:108,60:60}],293:[function(t,n,r){var e=t(60),a=t(109),f=t(138),s=t(99),l=t(51);e(e.S,"Object",{getOwnPropertyDescriptors:function getOwnPropertyDescriptors(t){for(var n,r,e=f(t),i=s.f,o=a(e),u={},c=0;o.length>c;)void 0!==(r=i(e,n=o[c++]))&&l(u,n,r);return u}})},{109:109,138:138,51:51,60:60,99:99}],294:[function(t,n,r){var e=t(60),i=t(108)(!1);e(e.S,"Object",{values:function values(t){return i(t)}})},{108:108,60:60}],295:[function(t,n,r){"use strict";var e=t(60),i=t(50),o=t(68),u=t(125),c=t(113);e(e.P+e.R,"Promise",{finally:function(n){var r=u(this,i.Promise||o.Promise),t="function"==typeof n;return this.then(t?function(t){return c(r,n()).then(function(){return t})}:n,t?function(t){return c(r,n()).then(function(){throw t})}:n)}})},{113:113,125:125,50:50,60:60,68:68}],296:[function(t,n,r){"use strict";var e=t(60),i=t(130),o=t(146),u=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(o);e(e.P+e.F*u,"String",{padEnd:function padEnd(t){return i(this,t,1<arguments.length?arguments[1]:void 0,!1)}})},{130:130,146:146,60:60}],297:[function(t,n,r){"use strict";var e=t(60),i=t(130),o=t(146),u=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(o);e(e.P+e.F*u,"String",{padStart:function padStart(t){return i(this,t,1<arguments.length?arguments[1]:void 0,!0)}})},{130:130,146:146,60:60}],298:[function(t,n,r){"use strict";t(132)("trimLeft",function(t){return function trimLeft(){return t(this,1)}},"trimStart")},{132:132}],299:[function(t,n,r){"use strict";t(132)("trimRight",function(t){return function trimRight(){return t(this,2)}},"trimEnd")},{132:132}],300:[function(t,n,r){t(148)("asyncIterator")},{148:148}],301:[function(t,n,r){for(var e=t(162),i=t(105),o=t(116),u=t(68),c=t(70),a=t(86),f=t(150),s=f("iterator"),l=f("toStringTag"),h=a.Array,p={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},v=i(p),g=0;g<v.length;g++){var y,d=v[g],x=p[d],m=u[d],S=m&&m.prototype;if(S&&(S[s]||c(S,s,h),S[l]||c(S,l,d),a[d]=h,x))for(y in e)S[y]||o(S,y,e[y],!0)}},{105:105,116:116,150:150,162:162,68:68,70:70,86:86}],302:[function(t,n,r){var e=t(60),i=t(134);e(e.G+e.B,{setImmediate:i.set,clearImmediate:i.clear})},{134:134,60:60}],303:[function(t,n,r){function q7(i){return function(t,n){var r=2<arguments.length,e=r&&u.call(arguments,2);return i(r?function(){("function"==typeof t?t:Function(t)).apply(this,e)}:t,n)}}var e=t(68),i=t(60),o=t(146),u=[].slice,c=/MSIE .\./.test(o);i(i.G+i.B+i.F*c,{setTimeout:q7(e.setTimeout),setInterval:q7(e.setInterval)})},{146:146,60:60,68:68}],304:[function(t,n,r){t(303),t(302),t(301),n.exports=t(50)},{301:301,302:302,303:303,50:50}],305:[function(t,n,r){var e=function(u){"use strict";var c,t=Object.prototype,f=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",r=n.asyncIterator||"@@asyncIterator",e=n.toStringTag||"@@toStringTag";function wrap(t,n,r,e){var i=n&&n.prototype instanceof Generator?n:Generator,o=Object.create(i.prototype),u=new Context(e||[]);return o._invoke=function makeInvokeMethod(o,u,c){var a=s;return function invoke(t,n){if(a===h)throw new Error("Generator is already running");if(a===p){if("throw"===t)throw n;return doneResult()}for(c.method=t,c.arg=n;;){var r=c.delegate;if(r){var e=maybeInvokeDelegate(r,c);if(e){if(e===v)continue;return e}}if("next"===c.method)c.sent=c._sent=c.arg;else if("throw"===c.method){if(a===s)throw a=p,c.arg;c.dispatchException(c.arg)}else"return"===c.method&&c.abrupt("return",c.arg);a=h;var i=tryCatch(o,u,c);if("normal"===i.type){if(a=c.done?p:l,i.arg===v)continue;return{value:i.arg,done:c.done}}"throw"===i.type&&(a=p,c.method="throw",c.arg=i.arg)}}}(t,r,u),o}function tryCatch(t,n,r){try{return{type:"normal",arg:t.call(n,r)}}catch(t){return{type:"throw",arg:t}}}u.wrap=wrap;var s="suspendedStart",l="suspendedYield",h="executing",p="completed",v={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var o={};o[i]=function(){return this};var a=Object.getPrototypeOf,g=a&&a(a(values([])));g&&g!==t&&f.call(g,i)&&(o=g);var y=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(o);function defineIteratorMethods(t){["next","throw","return"].forEach(function(n){t[n]=function(t){return this._invoke(n,t)}})}function AsyncIterator(c,a){var t;this._invoke=function enqueue(r,e){function callInvokeWithMethodAndArg(){return new a(function(t,n){!function invoke(t,n,r,e){var i=tryCatch(c[t],c,n);if("throw"!==i.type){var o=i.arg,u=o.value;return u&&"object"==typeof u&&f.call(u,"__await")?a.resolve(u.__await).then(function(t){invoke("next",t,r,e)},function(t){invoke("throw",t,r,e)}):a.resolve(u).then(function(t){o.value=t,r(o)},function(t){return invoke("throw",t,r,e)})}e(i.arg)}(r,e,t,n)})}return t=t?t.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(t,n){var r=t.iterator[n.method];if(r===c){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=c,maybeInvokeDelegate(t,n),"throw"===n.method))return v;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var e=tryCatch(r,t.iterator,n.arg);if("throw"===e.type)return n.method="throw",n.arg=e.arg,n.delegate=null,v;var i=e.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=c),n.delegate=null,v):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function pushTryEntry(t){var n={tryLoc:t[0]};1 in t&&(n.catchLoc=t[1]),2 in t&&(n.finallyLoc=t[2],n.afterLoc=t[3]),this.tryEntries.push(n)}function resetTryEntry(t){var n=t.completion||{};n.type="normal",delete n.arg,t.completion=n}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0)}function values(t){if(t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,e=function next(){for(;++r<t.length;)if(f.call(t,r))return next.value=t[r],next.done=!1,next;return next.value=c,next.done=!0,next};return e.next=e}}return{next:doneResult}}function doneResult(){return{value:c,done:!0}}return GeneratorFunction.prototype=y.constructor=GeneratorFunctionPrototype,GeneratorFunctionPrototype.constructor=GeneratorFunction,GeneratorFunctionPrototype[e]=GeneratorFunction.displayName="GeneratorFunction",u.isGeneratorFunction=function(t){var n="function"==typeof t&&t.constructor;return!!n&&(n===GeneratorFunction||"GeneratorFunction"===(n.displayName||n.name))},u.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,e in t||(t[e]="GeneratorFunction")),t.prototype=Object.create(y),t},u.awrap=function(t){return{__await:t}},defineIteratorMethods(AsyncIterator.prototype),AsyncIterator.prototype[r]=function(){return this},u.AsyncIterator=AsyncIterator,u.async=function(t,n,r,e,i){void 0===i&&(i=Promise);var o=new AsyncIterator(wrap(t,n,r,e),i);return u.isGeneratorFunction(n)?o:o.next().then(function(t){return t.done?t.value:o.next()})},defineIteratorMethods(y),y[e]="Generator",y[i]=function(){return this},y.toString=function(){return"[object Generator]"},u.keys=function(n){var r=[];for(var t in n)r.push(t);return r.reverse(),function next(){for(;r.length;){var t=r.pop();if(t in n)return next.value=t,next.done=!1,next}return next.done=!0,next}},u.values=values,Context.prototype={constructor:Context,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=c,this.done=!1,this.delegate=null,this.method="next",this.arg=c,this.tryEntries.forEach(resetTryEntry),!t)for(var n in this)"t"===n.charAt(0)&&f.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=c)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function handle(t,n){return i.type="throw",i.arg=r,e.next=t,n&&(e.method="next",e.arg=c),!!n}for(var t=this.tryEntries.length-1;0<=t;--t){var n=this.tryEntries[t],i=n.completion;if("root"===n.tryLoc)return handle("end");if(n.tryLoc<=this.prev){var o=f.call(n,"catchLoc"),u=f.call(n,"finallyLoc");if(o&&u){if(this.prev<n.catchLoc)return handle(n.catchLoc,!0);if(this.prev<n.finallyLoc)return handle(n.finallyLoc)}else if(o){if(this.prev<n.catchLoc)return handle(n.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<n.finallyLoc)return handle(n.finallyLoc)}}}},abrupt:function(t,n){for(var r=this.tryEntries.length-1;0<=r;--r){var e=this.tryEntries[r];if(e.tryLoc<=this.prev&&f.call(e,"finallyLoc")&&this.prev<e.finallyLoc){var i=e;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=n&&n<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=t,o.arg=n,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(o)},complete:function(t,n){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&n&&(this.next=n),v},finish:function(t){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),v}},catch:function(t){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc===t){var e=r.completion;if("throw"===e.type){var i=e.arg;resetTryEntry(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:values(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=c),v}},u}("object"==typeof n?n.exports:{});try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}},{}],306:[function(t,n,r){"use strict";t(307);var e=function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}(t(13));e.default._babelPolyfill&&"undefined"!=typeof console&&console.warn&&console.warn("@babel/polyfill is loaded more than once on this page. This is probably not desirable/intended and may have consequences if different versions of the polyfills are applied sequentially. If you do need to load the polyfill more than once, use @babel/polyfill/noConflict instead to bypass the warning."),e.default._babelPolyfill=!0},{13:13,307:307}],307:[function(t,n,r){"use strict";t(1),t(3),t(2),t(9),t(8),t(11),t(10),t(12),t(5),t(6),t(4),t(7),t(304),t(305)},{1:1,10:10,11:11,12:12,2:2,3:3,304:304,305:305,4:4,5:5,6:6,7:7,8:8,9:9}]},{},[306]);
|
@@ -0,0 +1,4565 @@
|
|
1
|
+
/*!
|
2
|
+
* Pusher JavaScript Library v7.0.0
|
3
|
+
* https://pusher.com/
|
4
|
+
*
|
5
|
+
* Copyright 2020, Pusher
|
6
|
+
* Released under the MIT licence.
|
7
|
+
*/
|
8
|
+
|
9
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
10
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
11
|
+
module.exports = factory();
|
12
|
+
else if(typeof define === 'function' && define.amd)
|
13
|
+
define([], factory);
|
14
|
+
else if(typeof exports === 'object')
|
15
|
+
exports["Pusher"] = factory();
|
16
|
+
else
|
17
|
+
root["Pusher"] = factory();
|
18
|
+
})(window, function() {
|
19
|
+
return /******/ (function(modules) { // webpackBootstrap
|
20
|
+
/******/ // The module cache
|
21
|
+
/******/ var installedModules = {};
|
22
|
+
/******/
|
23
|
+
/******/ // The require function
|
24
|
+
/******/ function __webpack_require__(moduleId) {
|
25
|
+
/******/
|
26
|
+
/******/ // Check if module is in cache
|
27
|
+
/******/ if(installedModules[moduleId]) {
|
28
|
+
/******/ return installedModules[moduleId].exports;
|
29
|
+
/******/ }
|
30
|
+
/******/ // Create a new module (and put it into the cache)
|
31
|
+
/******/ var module = installedModules[moduleId] = {
|
32
|
+
/******/ i: moduleId,
|
33
|
+
/******/ l: false,
|
34
|
+
/******/ exports: {}
|
35
|
+
/******/ };
|
36
|
+
/******/
|
37
|
+
/******/ // Execute the module function
|
38
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
39
|
+
/******/
|
40
|
+
/******/ // Flag the module as loaded
|
41
|
+
/******/ module.l = true;
|
42
|
+
/******/
|
43
|
+
/******/ // Return the exports of the module
|
44
|
+
/******/ return module.exports;
|
45
|
+
/******/ }
|
46
|
+
/******/
|
47
|
+
/******/
|
48
|
+
/******/ // expose the modules object (__webpack_modules__)
|
49
|
+
/******/ __webpack_require__.m = modules;
|
50
|
+
/******/
|
51
|
+
/******/ // expose the module cache
|
52
|
+
/******/ __webpack_require__.c = installedModules;
|
53
|
+
/******/
|
54
|
+
/******/ // define getter function for harmony exports
|
55
|
+
/******/ __webpack_require__.d = function(exports, name, getter) {
|
56
|
+
/******/ if(!__webpack_require__.o(exports, name)) {
|
57
|
+
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
58
|
+
/******/ }
|
59
|
+
/******/ };
|
60
|
+
/******/
|
61
|
+
/******/ // define __esModule on exports
|
62
|
+
/******/ __webpack_require__.r = function(exports) {
|
63
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
64
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
65
|
+
/******/ }
|
66
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
67
|
+
/******/ };
|
68
|
+
/******/
|
69
|
+
/******/ // create a fake namespace object
|
70
|
+
/******/ // mode & 1: value is a module id, require it
|
71
|
+
/******/ // mode & 2: merge all properties of value into the ns
|
72
|
+
/******/ // mode & 4: return value when already ns object
|
73
|
+
/******/ // mode & 8|1: behave like require
|
74
|
+
/******/ __webpack_require__.t = function(value, mode) {
|
75
|
+
/******/ if(mode & 1) value = __webpack_require__(value);
|
76
|
+
/******/ if(mode & 8) return value;
|
77
|
+
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
78
|
+
/******/ var ns = Object.create(null);
|
79
|
+
/******/ __webpack_require__.r(ns);
|
80
|
+
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
81
|
+
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
82
|
+
/******/ return ns;
|
83
|
+
/******/ };
|
84
|
+
/******/
|
85
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
86
|
+
/******/ __webpack_require__.n = function(module) {
|
87
|
+
/******/ var getter = module && module.__esModule ?
|
88
|
+
/******/ function getDefault() { return module['default']; } :
|
89
|
+
/******/ function getModuleExports() { return module; };
|
90
|
+
/******/ __webpack_require__.d(getter, 'a', getter);
|
91
|
+
/******/ return getter;
|
92
|
+
/******/ };
|
93
|
+
/******/
|
94
|
+
/******/ // Object.prototype.hasOwnProperty.call
|
95
|
+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
96
|
+
/******/
|
97
|
+
/******/ // __webpack_public_path__
|
98
|
+
/******/ __webpack_require__.p = "";
|
99
|
+
/******/
|
100
|
+
/******/
|
101
|
+
/******/ // Load entry module and return exports
|
102
|
+
/******/ return __webpack_require__(__webpack_require__.s = 2);
|
103
|
+
/******/ })
|
104
|
+
/************************************************************************/
|
105
|
+
/******/ ([
|
106
|
+
/* 0 */
|
107
|
+
/***/ (function(module, exports, __webpack_require__) {
|
108
|
+
|
109
|
+
"use strict";
|
110
|
+
|
111
|
+
// Copyright (C) 2016 Dmitry Chestnykh
|
112
|
+
// MIT License. See LICENSE file for details.
|
113
|
+
var __extends = (this && this.__extends) || (function () {
|
114
|
+
var extendStatics = function (d, b) {
|
115
|
+
extendStatics = Object.setPrototypeOf ||
|
116
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
117
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
118
|
+
return extendStatics(d, b);
|
119
|
+
};
|
120
|
+
return function (d, b) {
|
121
|
+
extendStatics(d, b);
|
122
|
+
function __() { this.constructor = d; }
|
123
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
124
|
+
};
|
125
|
+
})();
|
126
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
127
|
+
/**
|
128
|
+
* Package base64 implements Base64 encoding and decoding.
|
129
|
+
*/
|
130
|
+
// Invalid character used in decoding to indicate
|
131
|
+
// that the character to decode is out of range of
|
132
|
+
// alphabet and cannot be decoded.
|
133
|
+
var INVALID_BYTE = 256;
|
134
|
+
/**
|
135
|
+
* Implements standard Base64 encoding.
|
136
|
+
*
|
137
|
+
* Operates in constant time.
|
138
|
+
*/
|
139
|
+
var Coder = /** @class */ (function () {
|
140
|
+
// TODO(dchest): methods to encode chunk-by-chunk.
|
141
|
+
function Coder(_paddingCharacter) {
|
142
|
+
if (_paddingCharacter === void 0) { _paddingCharacter = "="; }
|
143
|
+
this._paddingCharacter = _paddingCharacter;
|
144
|
+
}
|
145
|
+
Coder.prototype.encodedLength = function (length) {
|
146
|
+
if (!this._paddingCharacter) {
|
147
|
+
return (length * 8 + 5) / 6 | 0;
|
148
|
+
}
|
149
|
+
return (length + 2) / 3 * 4 | 0;
|
150
|
+
};
|
151
|
+
Coder.prototype.encode = function (data) {
|
152
|
+
var out = "";
|
153
|
+
var i = 0;
|
154
|
+
for (; i < data.length - 2; i += 3) {
|
155
|
+
var c = (data[i] << 16) | (data[i + 1] << 8) | (data[i + 2]);
|
156
|
+
out += this._encodeByte((c >>> 3 * 6) & 63);
|
157
|
+
out += this._encodeByte((c >>> 2 * 6) & 63);
|
158
|
+
out += this._encodeByte((c >>> 1 * 6) & 63);
|
159
|
+
out += this._encodeByte((c >>> 0 * 6) & 63);
|
160
|
+
}
|
161
|
+
var left = data.length - i;
|
162
|
+
if (left > 0) {
|
163
|
+
var c = (data[i] << 16) | (left === 2 ? data[i + 1] << 8 : 0);
|
164
|
+
out += this._encodeByte((c >>> 3 * 6) & 63);
|
165
|
+
out += this._encodeByte((c >>> 2 * 6) & 63);
|
166
|
+
if (left === 2) {
|
167
|
+
out += this._encodeByte((c >>> 1 * 6) & 63);
|
168
|
+
}
|
169
|
+
else {
|
170
|
+
out += this._paddingCharacter || "";
|
171
|
+
}
|
172
|
+
out += this._paddingCharacter || "";
|
173
|
+
}
|
174
|
+
return out;
|
175
|
+
};
|
176
|
+
Coder.prototype.maxDecodedLength = function (length) {
|
177
|
+
if (!this._paddingCharacter) {
|
178
|
+
return (length * 6 + 7) / 8 | 0;
|
179
|
+
}
|
180
|
+
return length / 4 * 3 | 0;
|
181
|
+
};
|
182
|
+
Coder.prototype.decodedLength = function (s) {
|
183
|
+
return this.maxDecodedLength(s.length - this._getPaddingLength(s));
|
184
|
+
};
|
185
|
+
Coder.prototype.decode = function (s) {
|
186
|
+
if (s.length === 0) {
|
187
|
+
return new Uint8Array(0);
|
188
|
+
}
|
189
|
+
var paddingLength = this._getPaddingLength(s);
|
190
|
+
var length = s.length - paddingLength;
|
191
|
+
var out = new Uint8Array(this.maxDecodedLength(length));
|
192
|
+
var op = 0;
|
193
|
+
var i = 0;
|
194
|
+
var haveBad = 0;
|
195
|
+
var v0 = 0, v1 = 0, v2 = 0, v3 = 0;
|
196
|
+
for (; i < length - 4; i += 4) {
|
197
|
+
v0 = this._decodeChar(s.charCodeAt(i + 0));
|
198
|
+
v1 = this._decodeChar(s.charCodeAt(i + 1));
|
199
|
+
v2 = this._decodeChar(s.charCodeAt(i + 2));
|
200
|
+
v3 = this._decodeChar(s.charCodeAt(i + 3));
|
201
|
+
out[op++] = (v0 << 2) | (v1 >>> 4);
|
202
|
+
out[op++] = (v1 << 4) | (v2 >>> 2);
|
203
|
+
out[op++] = (v2 << 6) | v3;
|
204
|
+
haveBad |= v0 & INVALID_BYTE;
|
205
|
+
haveBad |= v1 & INVALID_BYTE;
|
206
|
+
haveBad |= v2 & INVALID_BYTE;
|
207
|
+
haveBad |= v3 & INVALID_BYTE;
|
208
|
+
}
|
209
|
+
if (i < length - 1) {
|
210
|
+
v0 = this._decodeChar(s.charCodeAt(i));
|
211
|
+
v1 = this._decodeChar(s.charCodeAt(i + 1));
|
212
|
+
out[op++] = (v0 << 2) | (v1 >>> 4);
|
213
|
+
haveBad |= v0 & INVALID_BYTE;
|
214
|
+
haveBad |= v1 & INVALID_BYTE;
|
215
|
+
}
|
216
|
+
if (i < length - 2) {
|
217
|
+
v2 = this._decodeChar(s.charCodeAt(i + 2));
|
218
|
+
out[op++] = (v1 << 4) | (v2 >>> 2);
|
219
|
+
haveBad |= v2 & INVALID_BYTE;
|
220
|
+
}
|
221
|
+
if (i < length - 3) {
|
222
|
+
v3 = this._decodeChar(s.charCodeAt(i + 3));
|
223
|
+
out[op++] = (v2 << 6) | v3;
|
224
|
+
haveBad |= v3 & INVALID_BYTE;
|
225
|
+
}
|
226
|
+
if (haveBad !== 0) {
|
227
|
+
throw new Error("Base64Coder: incorrect characters for decoding");
|
228
|
+
}
|
229
|
+
return out;
|
230
|
+
};
|
231
|
+
// Standard encoding have the following encoded/decoded ranges,
|
232
|
+
// which we need to convert between.
|
233
|
+
//
|
234
|
+
// ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789 + /
|
235
|
+
// Index: 0 - 25 26 - 51 52 - 61 62 63
|
236
|
+
// ASCII: 65 - 90 97 - 122 48 - 57 43 47
|
237
|
+
//
|
238
|
+
// Encode 6 bits in b into a new character.
|
239
|
+
Coder.prototype._encodeByte = function (b) {
|
240
|
+
// Encoding uses constant time operations as follows:
|
241
|
+
//
|
242
|
+
// 1. Define comparison of A with B using (A - B) >>> 8:
|
243
|
+
// if A > B, then result is positive integer
|
244
|
+
// if A <= B, then result is 0
|
245
|
+
//
|
246
|
+
// 2. Define selection of C or 0 using bitwise AND: X & C:
|
247
|
+
// if X == 0, then result is 0
|
248
|
+
// if X != 0, then result is C
|
249
|
+
//
|
250
|
+
// 3. Start with the smallest comparison (b >= 0), which is always
|
251
|
+
// true, so set the result to the starting ASCII value (65).
|
252
|
+
//
|
253
|
+
// 4. Continue comparing b to higher ASCII values, and selecting
|
254
|
+
// zero if comparison isn't true, otherwise selecting a value
|
255
|
+
// to add to result, which:
|
256
|
+
//
|
257
|
+
// a) undoes the previous addition
|
258
|
+
// b) provides new value to add
|
259
|
+
//
|
260
|
+
var result = b;
|
261
|
+
// b >= 0
|
262
|
+
result += 65;
|
263
|
+
// b > 25
|
264
|
+
result += ((25 - b) >>> 8) & ((0 - 65) - 26 + 97);
|
265
|
+
// b > 51
|
266
|
+
result += ((51 - b) >>> 8) & ((26 - 97) - 52 + 48);
|
267
|
+
// b > 61
|
268
|
+
result += ((61 - b) >>> 8) & ((52 - 48) - 62 + 43);
|
269
|
+
// b > 62
|
270
|
+
result += ((62 - b) >>> 8) & ((62 - 43) - 63 + 47);
|
271
|
+
return String.fromCharCode(result);
|
272
|
+
};
|
273
|
+
// Decode a character code into a byte.
|
274
|
+
// Must return 256 if character is out of alphabet range.
|
275
|
+
Coder.prototype._decodeChar = function (c) {
|
276
|
+
// Decoding works similar to encoding: using the same comparison
|
277
|
+
// function, but now it works on ranges: result is always incremented
|
278
|
+
// by value, but this value becomes zero if the range is not
|
279
|
+
// satisfied.
|
280
|
+
//
|
281
|
+
// Decoding starts with invalid value, 256, which is then
|
282
|
+
// subtracted when the range is satisfied. If none of the ranges
|
283
|
+
// apply, the function returns 256, which is then checked by
|
284
|
+
// the caller to throw error.
|
285
|
+
var result = INVALID_BYTE; // start with invalid character
|
286
|
+
// c == 43 (c > 42 and c < 44)
|
287
|
+
result += (((42 - c) & (c - 44)) >>> 8) & (-INVALID_BYTE + c - 43 + 62);
|
288
|
+
// c == 47 (c > 46 and c < 48)
|
289
|
+
result += (((46 - c) & (c - 48)) >>> 8) & (-INVALID_BYTE + c - 47 + 63);
|
290
|
+
// c > 47 and c < 58
|
291
|
+
result += (((47 - c) & (c - 58)) >>> 8) & (-INVALID_BYTE + c - 48 + 52);
|
292
|
+
// c > 64 and c < 91
|
293
|
+
result += (((64 - c) & (c - 91)) >>> 8) & (-INVALID_BYTE + c - 65 + 0);
|
294
|
+
// c > 96 and c < 123
|
295
|
+
result += (((96 - c) & (c - 123)) >>> 8) & (-INVALID_BYTE + c - 97 + 26);
|
296
|
+
return result;
|
297
|
+
};
|
298
|
+
Coder.prototype._getPaddingLength = function (s) {
|
299
|
+
var paddingLength = 0;
|
300
|
+
if (this._paddingCharacter) {
|
301
|
+
for (var i = s.length - 1; i >= 0; i--) {
|
302
|
+
if (s[i] !== this._paddingCharacter) {
|
303
|
+
break;
|
304
|
+
}
|
305
|
+
paddingLength++;
|
306
|
+
}
|
307
|
+
if (s.length < 4 || paddingLength > 2) {
|
308
|
+
throw new Error("Base64Coder: incorrect padding");
|
309
|
+
}
|
310
|
+
}
|
311
|
+
return paddingLength;
|
312
|
+
};
|
313
|
+
return Coder;
|
314
|
+
}());
|
315
|
+
exports.Coder = Coder;
|
316
|
+
var stdCoder = new Coder();
|
317
|
+
function encode(data) {
|
318
|
+
return stdCoder.encode(data);
|
319
|
+
}
|
320
|
+
exports.encode = encode;
|
321
|
+
function decode(s) {
|
322
|
+
return stdCoder.decode(s);
|
323
|
+
}
|
324
|
+
exports.decode = decode;
|
325
|
+
/**
|
326
|
+
* Implements URL-safe Base64 encoding.
|
327
|
+
* (Same as Base64, but '+' is replaced with '-', and '/' with '_').
|
328
|
+
*
|
329
|
+
* Operates in constant time.
|
330
|
+
*/
|
331
|
+
var URLSafeCoder = /** @class */ (function (_super) {
|
332
|
+
__extends(URLSafeCoder, _super);
|
333
|
+
function URLSafeCoder() {
|
334
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
335
|
+
}
|
336
|
+
// URL-safe encoding have the following encoded/decoded ranges:
|
337
|
+
//
|
338
|
+
// ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789 - _
|
339
|
+
// Index: 0 - 25 26 - 51 52 - 61 62 63
|
340
|
+
// ASCII: 65 - 90 97 - 122 48 - 57 45 95
|
341
|
+
//
|
342
|
+
URLSafeCoder.prototype._encodeByte = function (b) {
|
343
|
+
var result = b;
|
344
|
+
// b >= 0
|
345
|
+
result += 65;
|
346
|
+
// b > 25
|
347
|
+
result += ((25 - b) >>> 8) & ((0 - 65) - 26 + 97);
|
348
|
+
// b > 51
|
349
|
+
result += ((51 - b) >>> 8) & ((26 - 97) - 52 + 48);
|
350
|
+
// b > 61
|
351
|
+
result += ((61 - b) >>> 8) & ((52 - 48) - 62 + 45);
|
352
|
+
// b > 62
|
353
|
+
result += ((62 - b) >>> 8) & ((62 - 45) - 63 + 95);
|
354
|
+
return String.fromCharCode(result);
|
355
|
+
};
|
356
|
+
URLSafeCoder.prototype._decodeChar = function (c) {
|
357
|
+
var result = INVALID_BYTE;
|
358
|
+
// c == 45 (c > 44 and c < 46)
|
359
|
+
result += (((44 - c) & (c - 46)) >>> 8) & (-INVALID_BYTE + c - 45 + 62);
|
360
|
+
// c == 95 (c > 94 and c < 96)
|
361
|
+
result += (((94 - c) & (c - 96)) >>> 8) & (-INVALID_BYTE + c - 95 + 63);
|
362
|
+
// c > 47 and c < 58
|
363
|
+
result += (((47 - c) & (c - 58)) >>> 8) & (-INVALID_BYTE + c - 48 + 52);
|
364
|
+
// c > 64 and c < 91
|
365
|
+
result += (((64 - c) & (c - 91)) >>> 8) & (-INVALID_BYTE + c - 65 + 0);
|
366
|
+
// c > 96 and c < 123
|
367
|
+
result += (((96 - c) & (c - 123)) >>> 8) & (-INVALID_BYTE + c - 97 + 26);
|
368
|
+
return result;
|
369
|
+
};
|
370
|
+
return URLSafeCoder;
|
371
|
+
}(Coder));
|
372
|
+
exports.URLSafeCoder = URLSafeCoder;
|
373
|
+
var urlSafeCoder = new URLSafeCoder();
|
374
|
+
function encodeURLSafe(data) {
|
375
|
+
return urlSafeCoder.encode(data);
|
376
|
+
}
|
377
|
+
exports.encodeURLSafe = encodeURLSafe;
|
378
|
+
function decodeURLSafe(s) {
|
379
|
+
return urlSafeCoder.decode(s);
|
380
|
+
}
|
381
|
+
exports.decodeURLSafe = decodeURLSafe;
|
382
|
+
exports.encodedLength = function (length) {
|
383
|
+
return stdCoder.encodedLength(length);
|
384
|
+
};
|
385
|
+
exports.maxDecodedLength = function (length) {
|
386
|
+
return stdCoder.maxDecodedLength(length);
|
387
|
+
};
|
388
|
+
exports.decodedLength = function (s) {
|
389
|
+
return stdCoder.decodedLength(s);
|
390
|
+
};
|
391
|
+
//# sourceMappingURL=base64.js.map
|
392
|
+
|
393
|
+
/***/ }),
|
394
|
+
/* 1 */
|
395
|
+
/***/ (function(module, exports, __webpack_require__) {
|
396
|
+
|
397
|
+
"use strict";
|
398
|
+
|
399
|
+
// Copyright (C) 2016 Dmitry Chestnykh
|
400
|
+
// MIT License. See LICENSE file for details.
|
401
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
402
|
+
/**
|
403
|
+
* Package utf8 implements UTF-8 encoding and decoding.
|
404
|
+
*/
|
405
|
+
var INVALID_UTF16 = "utf8: invalid string";
|
406
|
+
var INVALID_UTF8 = "utf8: invalid source encoding";
|
407
|
+
/**
|
408
|
+
* Encodes the given string into UTF-8 byte array.
|
409
|
+
* Throws if the source string has invalid UTF-16 encoding.
|
410
|
+
*/
|
411
|
+
function encode(s) {
|
412
|
+
// Calculate result length and allocate output array.
|
413
|
+
// encodedLength() also validates string and throws errors,
|
414
|
+
// so we don't need repeat validation here.
|
415
|
+
var arr = new Uint8Array(encodedLength(s));
|
416
|
+
var pos = 0;
|
417
|
+
for (var i = 0; i < s.length; i++) {
|
418
|
+
var c = s.charCodeAt(i);
|
419
|
+
if (c < 0x80) {
|
420
|
+
arr[pos++] = c;
|
421
|
+
}
|
422
|
+
else if (c < 0x800) {
|
423
|
+
arr[pos++] = 0xc0 | c >> 6;
|
424
|
+
arr[pos++] = 0x80 | c & 0x3f;
|
425
|
+
}
|
426
|
+
else if (c < 0xd800) {
|
427
|
+
arr[pos++] = 0xe0 | c >> 12;
|
428
|
+
arr[pos++] = 0x80 | (c >> 6) & 0x3f;
|
429
|
+
arr[pos++] = 0x80 | c & 0x3f;
|
430
|
+
}
|
431
|
+
else {
|
432
|
+
i++; // get one more character
|
433
|
+
c = (c & 0x3ff) << 10;
|
434
|
+
c |= s.charCodeAt(i) & 0x3ff;
|
435
|
+
c += 0x10000;
|
436
|
+
arr[pos++] = 0xf0 | c >> 18;
|
437
|
+
arr[pos++] = 0x80 | (c >> 12) & 0x3f;
|
438
|
+
arr[pos++] = 0x80 | (c >> 6) & 0x3f;
|
439
|
+
arr[pos++] = 0x80 | c & 0x3f;
|
440
|
+
}
|
441
|
+
}
|
442
|
+
return arr;
|
443
|
+
}
|
444
|
+
exports.encode = encode;
|
445
|
+
/**
|
446
|
+
* Returns the number of bytes required to encode the given string into UTF-8.
|
447
|
+
* Throws if the source string has invalid UTF-16 encoding.
|
448
|
+
*/
|
449
|
+
function encodedLength(s) {
|
450
|
+
var result = 0;
|
451
|
+
for (var i = 0; i < s.length; i++) {
|
452
|
+
var c = s.charCodeAt(i);
|
453
|
+
if (c < 0x80) {
|
454
|
+
result += 1;
|
455
|
+
}
|
456
|
+
else if (c < 0x800) {
|
457
|
+
result += 2;
|
458
|
+
}
|
459
|
+
else if (c < 0xd800) {
|
460
|
+
result += 3;
|
461
|
+
}
|
462
|
+
else if (c <= 0xdfff) {
|
463
|
+
if (i >= s.length - 1) {
|
464
|
+
throw new Error(INVALID_UTF16);
|
465
|
+
}
|
466
|
+
i++; // "eat" next character
|
467
|
+
result += 4;
|
468
|
+
}
|
469
|
+
else {
|
470
|
+
throw new Error(INVALID_UTF16);
|
471
|
+
}
|
472
|
+
}
|
473
|
+
return result;
|
474
|
+
}
|
475
|
+
exports.encodedLength = encodedLength;
|
476
|
+
/**
|
477
|
+
* Decodes the given byte array from UTF-8 into a string.
|
478
|
+
* Throws if encoding is invalid.
|
479
|
+
*/
|
480
|
+
function decode(arr) {
|
481
|
+
var chars = [];
|
482
|
+
for (var i = 0; i < arr.length; i++) {
|
483
|
+
var b = arr[i];
|
484
|
+
if (b & 0x80) {
|
485
|
+
var min = void 0;
|
486
|
+
if (b < 0xe0) {
|
487
|
+
// Need 1 more byte.
|
488
|
+
if (i >= arr.length) {
|
489
|
+
throw new Error(INVALID_UTF8);
|
490
|
+
}
|
491
|
+
var n1 = arr[++i];
|
492
|
+
if ((n1 & 0xc0) !== 0x80) {
|
493
|
+
throw new Error(INVALID_UTF8);
|
494
|
+
}
|
495
|
+
b = (b & 0x1f) << 6 | (n1 & 0x3f);
|
496
|
+
min = 0x80;
|
497
|
+
}
|
498
|
+
else if (b < 0xf0) {
|
499
|
+
// Need 2 more bytes.
|
500
|
+
if (i >= arr.length - 1) {
|
501
|
+
throw new Error(INVALID_UTF8);
|
502
|
+
}
|
503
|
+
var n1 = arr[++i];
|
504
|
+
var n2 = arr[++i];
|
505
|
+
if ((n1 & 0xc0) !== 0x80 || (n2 & 0xc0) !== 0x80) {
|
506
|
+
throw new Error(INVALID_UTF8);
|
507
|
+
}
|
508
|
+
b = (b & 0x0f) << 12 | (n1 & 0x3f) << 6 | (n2 & 0x3f);
|
509
|
+
min = 0x800;
|
510
|
+
}
|
511
|
+
else if (b < 0xf8) {
|
512
|
+
// Need 3 more bytes.
|
513
|
+
if (i >= arr.length - 2) {
|
514
|
+
throw new Error(INVALID_UTF8);
|
515
|
+
}
|
516
|
+
var n1 = arr[++i];
|
517
|
+
var n2 = arr[++i];
|
518
|
+
var n3 = arr[++i];
|
519
|
+
if ((n1 & 0xc0) !== 0x80 || (n2 & 0xc0) !== 0x80 || (n3 & 0xc0) !== 0x80) {
|
520
|
+
throw new Error(INVALID_UTF8);
|
521
|
+
}
|
522
|
+
b = (b & 0x0f) << 18 | (n1 & 0x3f) << 12 | (n2 & 0x3f) << 6 | (n3 & 0x3f);
|
523
|
+
min = 0x10000;
|
524
|
+
}
|
525
|
+
else {
|
526
|
+
throw new Error(INVALID_UTF8);
|
527
|
+
}
|
528
|
+
if (b < min || (b >= 0xd800 && b <= 0xdfff)) {
|
529
|
+
throw new Error(INVALID_UTF8);
|
530
|
+
}
|
531
|
+
if (b >= 0x10000) {
|
532
|
+
// Surrogate pair.
|
533
|
+
if (b > 0x10ffff) {
|
534
|
+
throw new Error(INVALID_UTF8);
|
535
|
+
}
|
536
|
+
b -= 0x10000;
|
537
|
+
chars.push(String.fromCharCode(0xd800 | (b >> 10)));
|
538
|
+
b = 0xdc00 | (b & 0x3ff);
|
539
|
+
}
|
540
|
+
}
|
541
|
+
chars.push(String.fromCharCode(b));
|
542
|
+
}
|
543
|
+
return chars.join("");
|
544
|
+
}
|
545
|
+
exports.decode = decode;
|
546
|
+
//# sourceMappingURL=utf8.js.map
|
547
|
+
|
548
|
+
/***/ }),
|
549
|
+
/* 2 */
|
550
|
+
/***/ (function(module, exports, __webpack_require__) {
|
551
|
+
|
552
|
+
// required so we don't have to do require('pusher').default etc.
|
553
|
+
module.exports = __webpack_require__(3).default;
|
554
|
+
|
555
|
+
|
556
|
+
/***/ }),
|
557
|
+
/* 3 */
|
558
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
559
|
+
|
560
|
+
"use strict";
|
561
|
+
__webpack_require__.r(__webpack_exports__);
|
562
|
+
|
563
|
+
// CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
|
564
|
+
var ScriptReceiverFactory = (function () {
|
565
|
+
function ScriptReceiverFactory(prefix, name) {
|
566
|
+
this.lastId = 0;
|
567
|
+
this.prefix = prefix;
|
568
|
+
this.name = name;
|
569
|
+
}
|
570
|
+
ScriptReceiverFactory.prototype.create = function (callback) {
|
571
|
+
this.lastId++;
|
572
|
+
var number = this.lastId;
|
573
|
+
var id = this.prefix + number;
|
574
|
+
var name = this.name + '[' + number + ']';
|
575
|
+
var called = false;
|
576
|
+
var callbackWrapper = function () {
|
577
|
+
if (!called) {
|
578
|
+
callback.apply(null, arguments);
|
579
|
+
called = true;
|
580
|
+
}
|
581
|
+
};
|
582
|
+
this[number] = callbackWrapper;
|
583
|
+
return { number: number, id: id, name: name, callback: callbackWrapper };
|
584
|
+
};
|
585
|
+
ScriptReceiverFactory.prototype.remove = function (receiver) {
|
586
|
+
delete this[receiver.number];
|
587
|
+
};
|
588
|
+
return ScriptReceiverFactory;
|
589
|
+
}());
|
590
|
+
|
591
|
+
var ScriptReceivers = new ScriptReceiverFactory('_pusher_script_', 'Pusher.ScriptReceivers');
|
592
|
+
|
593
|
+
// CONCATENATED MODULE: ./src/core/defaults.ts
|
594
|
+
var Defaults = {
|
595
|
+
VERSION: "7.0.0",
|
596
|
+
PROTOCOL: 7,
|
597
|
+
wsPort: 80,
|
598
|
+
wssPort: 443,
|
599
|
+
wsPath: '',
|
600
|
+
httpHost: 'sockjs.pusher.com',
|
601
|
+
httpPort: 80,
|
602
|
+
httpsPort: 443,
|
603
|
+
httpPath: '/pusher',
|
604
|
+
stats_host: 'stats.pusher.com',
|
605
|
+
authEndpoint: '/pusher/auth',
|
606
|
+
authTransport: 'ajax',
|
607
|
+
activityTimeout: 120000,
|
608
|
+
pongTimeout: 30000,
|
609
|
+
unavailableTimeout: 10000,
|
610
|
+
cluster: 'mt1',
|
611
|
+
cdn_http: "http://js.pusher.com",
|
612
|
+
cdn_https: "https://js.pusher.com",
|
613
|
+
dependency_suffix: ""
|
614
|
+
};
|
615
|
+
/* harmony default export */ var defaults = (Defaults);
|
616
|
+
|
617
|
+
// CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
|
618
|
+
|
619
|
+
|
620
|
+
var dependency_loader_DependencyLoader = (function () {
|
621
|
+
function DependencyLoader(options) {
|
622
|
+
this.options = options;
|
623
|
+
this.receivers = options.receivers || ScriptReceivers;
|
624
|
+
this.loading = {};
|
625
|
+
}
|
626
|
+
DependencyLoader.prototype.load = function (name, options, callback) {
|
627
|
+
var self = this;
|
628
|
+
if (self.loading[name] && self.loading[name].length > 0) {
|
629
|
+
self.loading[name].push(callback);
|
630
|
+
}
|
631
|
+
else {
|
632
|
+
self.loading[name] = [callback];
|
633
|
+
var request = runtime.createScriptRequest(self.getPath(name, options));
|
634
|
+
var receiver = self.receivers.create(function (error) {
|
635
|
+
self.receivers.remove(receiver);
|
636
|
+
if (self.loading[name]) {
|
637
|
+
var callbacks = self.loading[name];
|
638
|
+
delete self.loading[name];
|
639
|
+
var successCallback = function (wasSuccessful) {
|
640
|
+
if (!wasSuccessful) {
|
641
|
+
request.cleanup();
|
642
|
+
}
|
643
|
+
};
|
644
|
+
for (var i = 0; i < callbacks.length; i++) {
|
645
|
+
callbacks[i](error, successCallback);
|
646
|
+
}
|
647
|
+
}
|
648
|
+
});
|
649
|
+
request.send(receiver);
|
650
|
+
}
|
651
|
+
};
|
652
|
+
DependencyLoader.prototype.getRoot = function (options) {
|
653
|
+
var cdn;
|
654
|
+
var protocol = runtime.getDocument().location.protocol;
|
655
|
+
if ((options && options.useTLS) || protocol === 'https:') {
|
656
|
+
cdn = this.options.cdn_https;
|
657
|
+
}
|
658
|
+
else {
|
659
|
+
cdn = this.options.cdn_http;
|
660
|
+
}
|
661
|
+
return cdn.replace(/\/*$/, '') + '/' + this.options.version;
|
662
|
+
};
|
663
|
+
DependencyLoader.prototype.getPath = function (name, options) {
|
664
|
+
return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
|
665
|
+
};
|
666
|
+
return DependencyLoader;
|
667
|
+
}());
|
668
|
+
/* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
|
669
|
+
|
670
|
+
// CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
|
671
|
+
|
672
|
+
|
673
|
+
|
674
|
+
var DependenciesReceivers = new ScriptReceiverFactory('_pusher_dependencies', 'Pusher.DependenciesReceivers');
|
675
|
+
var Dependencies = new dependency_loader({
|
676
|
+
cdn_http: defaults.cdn_http,
|
677
|
+
cdn_https: defaults.cdn_https,
|
678
|
+
version: defaults.VERSION,
|
679
|
+
suffix: defaults.dependency_suffix,
|
680
|
+
receivers: DependenciesReceivers
|
681
|
+
});
|
682
|
+
|
683
|
+
// CONCATENATED MODULE: ./src/core/utils/url_store.ts
|
684
|
+
var urlStore = {
|
685
|
+
baseUrl: 'https://pusher.com',
|
686
|
+
urls: {
|
687
|
+
authenticationEndpoint: {
|
688
|
+
path: '/docs/authenticating_users'
|
689
|
+
},
|
690
|
+
javascriptQuickStart: {
|
691
|
+
path: '/docs/javascript_quick_start'
|
692
|
+
},
|
693
|
+
triggeringClientEvents: {
|
694
|
+
path: '/docs/client_api_guide/client_events#trigger-events'
|
695
|
+
},
|
696
|
+
encryptedChannelSupport: {
|
697
|
+
fullUrl: 'https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support'
|
698
|
+
}
|
699
|
+
}
|
700
|
+
};
|
701
|
+
var buildLogSuffix = function (key) {
|
702
|
+
var urlPrefix = 'See:';
|
703
|
+
var urlObj = urlStore.urls[key];
|
704
|
+
if (!urlObj)
|
705
|
+
return '';
|
706
|
+
var url;
|
707
|
+
if (urlObj.fullUrl) {
|
708
|
+
url = urlObj.fullUrl;
|
709
|
+
}
|
710
|
+
else if (urlObj.path) {
|
711
|
+
url = urlStore.baseUrl + urlObj.path;
|
712
|
+
}
|
713
|
+
if (!url)
|
714
|
+
return '';
|
715
|
+
return urlPrefix + " " + url;
|
716
|
+
};
|
717
|
+
/* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
|
718
|
+
|
719
|
+
// CONCATENATED MODULE: ./src/core/errors.ts
|
720
|
+
var __extends = (undefined && undefined.__extends) || (function () {
|
721
|
+
var extendStatics = function (d, b) {
|
722
|
+
extendStatics = Object.setPrototypeOf ||
|
723
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
724
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
725
|
+
return extendStatics(d, b);
|
726
|
+
};
|
727
|
+
return function (d, b) {
|
728
|
+
extendStatics(d, b);
|
729
|
+
function __() { this.constructor = d; }
|
730
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
731
|
+
};
|
732
|
+
})();
|
733
|
+
var BadEventName = (function (_super) {
|
734
|
+
__extends(BadEventName, _super);
|
735
|
+
function BadEventName(msg) {
|
736
|
+
var _newTarget = this.constructor;
|
737
|
+
var _this = _super.call(this, msg) || this;
|
738
|
+
Object.setPrototypeOf(_this, _newTarget.prototype);
|
739
|
+
return _this;
|
740
|
+
}
|
741
|
+
return BadEventName;
|
742
|
+
}(Error));
|
743
|
+
|
744
|
+
var RequestTimedOut = (function (_super) {
|
745
|
+
__extends(RequestTimedOut, _super);
|
746
|
+
function RequestTimedOut(msg) {
|
747
|
+
var _newTarget = this.constructor;
|
748
|
+
var _this = _super.call(this, msg) || this;
|
749
|
+
Object.setPrototypeOf(_this, _newTarget.prototype);
|
750
|
+
return _this;
|
751
|
+
}
|
752
|
+
return RequestTimedOut;
|
753
|
+
}(Error));
|
754
|
+
|
755
|
+
var TransportPriorityTooLow = (function (_super) {
|
756
|
+
__extends(TransportPriorityTooLow, _super);
|
757
|
+
function TransportPriorityTooLow(msg) {
|
758
|
+
var _newTarget = this.constructor;
|
759
|
+
var _this = _super.call(this, msg) || this;
|
760
|
+
Object.setPrototypeOf(_this, _newTarget.prototype);
|
761
|
+
return _this;
|
762
|
+
}
|
763
|
+
return TransportPriorityTooLow;
|
764
|
+
}(Error));
|
765
|
+
|
766
|
+
var TransportClosed = (function (_super) {
|
767
|
+
__extends(TransportClosed, _super);
|
768
|
+
function TransportClosed(msg) {
|
769
|
+
var _newTarget = this.constructor;
|
770
|
+
var _this = _super.call(this, msg) || this;
|
771
|
+
Object.setPrototypeOf(_this, _newTarget.prototype);
|
772
|
+
return _this;
|
773
|
+
}
|
774
|
+
return TransportClosed;
|
775
|
+
}(Error));
|
776
|
+
|
777
|
+
var UnsupportedFeature = (function (_super) {
|
778
|
+
__extends(UnsupportedFeature, _super);
|
779
|
+
function UnsupportedFeature(msg) {
|
780
|
+
var _newTarget = this.constructor;
|
781
|
+
var _this = _super.call(this, msg) || this;
|
782
|
+
Object.setPrototypeOf(_this, _newTarget.prototype);
|
783
|
+
return _this;
|
784
|
+
}
|
785
|
+
return UnsupportedFeature;
|
786
|
+
}(Error));
|
787
|
+
|
788
|
+
var UnsupportedTransport = (function (_super) {
|
789
|
+
__extends(UnsupportedTransport, _super);
|
790
|
+
function UnsupportedTransport(msg) {
|
791
|
+
var _newTarget = this.constructor;
|
792
|
+
var _this = _super.call(this, msg) || this;
|
793
|
+
Object.setPrototypeOf(_this, _newTarget.prototype);
|
794
|
+
return _this;
|
795
|
+
}
|
796
|
+
return UnsupportedTransport;
|
797
|
+
}(Error));
|
798
|
+
|
799
|
+
var UnsupportedStrategy = (function (_super) {
|
800
|
+
__extends(UnsupportedStrategy, _super);
|
801
|
+
function UnsupportedStrategy(msg) {
|
802
|
+
var _newTarget = this.constructor;
|
803
|
+
var _this = _super.call(this, msg) || this;
|
804
|
+
Object.setPrototypeOf(_this, _newTarget.prototype);
|
805
|
+
return _this;
|
806
|
+
}
|
807
|
+
return UnsupportedStrategy;
|
808
|
+
}(Error));
|
809
|
+
|
810
|
+
var HTTPAuthError = (function (_super) {
|
811
|
+
__extends(HTTPAuthError, _super);
|
812
|
+
function HTTPAuthError(status, msg) {
|
813
|
+
var _newTarget = this.constructor;
|
814
|
+
var _this = _super.call(this, msg) || this;
|
815
|
+
_this.status = status;
|
816
|
+
Object.setPrototypeOf(_this, _newTarget.prototype);
|
817
|
+
return _this;
|
818
|
+
}
|
819
|
+
return HTTPAuthError;
|
820
|
+
}(Error));
|
821
|
+
|
822
|
+
|
823
|
+
// CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
|
824
|
+
|
825
|
+
|
826
|
+
|
827
|
+
var ajax = function (context, socketId, callback) {
|
828
|
+
var self = this, xhr;
|
829
|
+
xhr = runtime.createXHR();
|
830
|
+
xhr.open('POST', self.options.authEndpoint, true);
|
831
|
+
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
832
|
+
for (var headerName in this.authOptions.headers) {
|
833
|
+
xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
|
834
|
+
}
|
835
|
+
xhr.onreadystatechange = function () {
|
836
|
+
if (xhr.readyState === 4) {
|
837
|
+
if (xhr.status === 200) {
|
838
|
+
var data = void 0;
|
839
|
+
var parsed = false;
|
840
|
+
try {
|
841
|
+
data = JSON.parse(xhr.responseText);
|
842
|
+
parsed = true;
|
843
|
+
}
|
844
|
+
catch (e) {
|
845
|
+
callback(new HTTPAuthError(200, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' +
|
846
|
+
xhr.responseText), { auth: '' });
|
847
|
+
}
|
848
|
+
if (parsed) {
|
849
|
+
callback(null, data);
|
850
|
+
}
|
851
|
+
}
|
852
|
+
else {
|
853
|
+
var suffix = url_store.buildLogSuffix('authenticationEndpoint');
|
854
|
+
callback(new HTTPAuthError(xhr.status, 'Unable to retrieve auth string from auth endpoint - ' +
|
855
|
+
("received status: " + xhr.status + " from " + self.options.authEndpoint + ". ") +
|
856
|
+
("Clients must be authenticated to join private or presence channels. " + suffix)), { auth: '' });
|
857
|
+
}
|
858
|
+
}
|
859
|
+
};
|
860
|
+
xhr.send(this.composeQuery(socketId));
|
861
|
+
return xhr;
|
862
|
+
};
|
863
|
+
/* harmony default export */ var xhr_auth = (ajax);
|
864
|
+
|
865
|
+
// CONCATENATED MODULE: ./src/core/base64.ts
|
866
|
+
function encode(s) {
|
867
|
+
return btoa(utob(s));
|
868
|
+
}
|
869
|
+
var fromCharCode = String.fromCharCode;
|
870
|
+
var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
871
|
+
var b64tab = {};
|
872
|
+
for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
|
873
|
+
b64tab[b64chars.charAt(base64_i)] = base64_i;
|
874
|
+
}
|
875
|
+
var cb_utob = function (c) {
|
876
|
+
var cc = c.charCodeAt(0);
|
877
|
+
return cc < 0x80
|
878
|
+
? c
|
879
|
+
: cc < 0x800
|
880
|
+
? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
|
881
|
+
: fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
|
882
|
+
fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
|
883
|
+
fromCharCode(0x80 | (cc & 0x3f));
|
884
|
+
};
|
885
|
+
var utob = function (u) {
|
886
|
+
return u.replace(/[^\x00-\x7F]/g, cb_utob);
|
887
|
+
};
|
888
|
+
var cb_encode = function (ccc) {
|
889
|
+
var padlen = [0, 2, 1][ccc.length % 3];
|
890
|
+
var ord = (ccc.charCodeAt(0) << 16) |
|
891
|
+
((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
|
892
|
+
(ccc.length > 2 ? ccc.charCodeAt(2) : 0);
|
893
|
+
var chars = [
|
894
|
+
b64chars.charAt(ord >>> 18),
|
895
|
+
b64chars.charAt((ord >>> 12) & 63),
|
896
|
+
padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
|
897
|
+
padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
|
898
|
+
];
|
899
|
+
return chars.join('');
|
900
|
+
};
|
901
|
+
var btoa = window.btoa ||
|
902
|
+
function (b) {
|
903
|
+
return b.replace(/[\s\S]{1,3}/g, cb_encode);
|
904
|
+
};
|
905
|
+
|
906
|
+
// CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
|
907
|
+
var Timer = (function () {
|
908
|
+
function Timer(set, clear, delay, callback) {
|
909
|
+
var _this = this;
|
910
|
+
this.clear = clear;
|
911
|
+
this.timer = set(function () {
|
912
|
+
if (_this.timer) {
|
913
|
+
_this.timer = callback(_this.timer);
|
914
|
+
}
|
915
|
+
}, delay);
|
916
|
+
}
|
917
|
+
Timer.prototype.isRunning = function () {
|
918
|
+
return this.timer !== null;
|
919
|
+
};
|
920
|
+
Timer.prototype.ensureAborted = function () {
|
921
|
+
if (this.timer) {
|
922
|
+
this.clear(this.timer);
|
923
|
+
this.timer = null;
|
924
|
+
}
|
925
|
+
};
|
926
|
+
return Timer;
|
927
|
+
}());
|
928
|
+
/* harmony default export */ var abstract_timer = (Timer);
|
929
|
+
|
930
|
+
// CONCATENATED MODULE: ./src/core/utils/timers/index.ts
|
931
|
+
var timers_extends = (undefined && undefined.__extends) || (function () {
|
932
|
+
var extendStatics = function (d, b) {
|
933
|
+
extendStatics = Object.setPrototypeOf ||
|
934
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
935
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
936
|
+
return extendStatics(d, b);
|
937
|
+
};
|
938
|
+
return function (d, b) {
|
939
|
+
extendStatics(d, b);
|
940
|
+
function __() { this.constructor = d; }
|
941
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
942
|
+
};
|
943
|
+
})();
|
944
|
+
|
945
|
+
function timers_clearTimeout(timer) {
|
946
|
+
window.clearTimeout(timer);
|
947
|
+
}
|
948
|
+
function timers_clearInterval(timer) {
|
949
|
+
window.clearInterval(timer);
|
950
|
+
}
|
951
|
+
var OneOffTimer = (function (_super) {
|
952
|
+
timers_extends(OneOffTimer, _super);
|
953
|
+
function OneOffTimer(delay, callback) {
|
954
|
+
return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
|
955
|
+
callback();
|
956
|
+
return null;
|
957
|
+
}) || this;
|
958
|
+
}
|
959
|
+
return OneOffTimer;
|
960
|
+
}(abstract_timer));
|
961
|
+
|
962
|
+
var PeriodicTimer = (function (_super) {
|
963
|
+
timers_extends(PeriodicTimer, _super);
|
964
|
+
function PeriodicTimer(delay, callback) {
|
965
|
+
return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
|
966
|
+
callback();
|
967
|
+
return timer;
|
968
|
+
}) || this;
|
969
|
+
}
|
970
|
+
return PeriodicTimer;
|
971
|
+
}(abstract_timer));
|
972
|
+
|
973
|
+
|
974
|
+
// CONCATENATED MODULE: ./src/core/util.ts
|
975
|
+
|
976
|
+
var Util = {
|
977
|
+
now: function () {
|
978
|
+
if (Date.now) {
|
979
|
+
return Date.now();
|
980
|
+
}
|
981
|
+
else {
|
982
|
+
return new Date().valueOf();
|
983
|
+
}
|
984
|
+
},
|
985
|
+
defer: function (callback) {
|
986
|
+
return new OneOffTimer(0, callback);
|
987
|
+
},
|
988
|
+
method: function (name) {
|
989
|
+
var args = [];
|
990
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
991
|
+
args[_i - 1] = arguments[_i];
|
992
|
+
}
|
993
|
+
var boundArguments = Array.prototype.slice.call(arguments, 1);
|
994
|
+
return function (object) {
|
995
|
+
return object[name].apply(object, boundArguments.concat(arguments));
|
996
|
+
};
|
997
|
+
}
|
998
|
+
};
|
999
|
+
/* harmony default export */ var util = (Util);
|
1000
|
+
|
1001
|
+
// CONCATENATED MODULE: ./src/core/utils/collections.ts
|
1002
|
+
|
1003
|
+
|
1004
|
+
function extend(target) {
|
1005
|
+
var sources = [];
|
1006
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
1007
|
+
sources[_i - 1] = arguments[_i];
|
1008
|
+
}
|
1009
|
+
for (var i = 0; i < sources.length; i++) {
|
1010
|
+
var extensions = sources[i];
|
1011
|
+
for (var property in extensions) {
|
1012
|
+
if (extensions[property] &&
|
1013
|
+
extensions[property].constructor &&
|
1014
|
+
extensions[property].constructor === Object) {
|
1015
|
+
target[property] = extend(target[property] || {}, extensions[property]);
|
1016
|
+
}
|
1017
|
+
else {
|
1018
|
+
target[property] = extensions[property];
|
1019
|
+
}
|
1020
|
+
}
|
1021
|
+
}
|
1022
|
+
return target;
|
1023
|
+
}
|
1024
|
+
function stringify() {
|
1025
|
+
var m = ['Pusher'];
|
1026
|
+
for (var i = 0; i < arguments.length; i++) {
|
1027
|
+
if (typeof arguments[i] === 'string') {
|
1028
|
+
m.push(arguments[i]);
|
1029
|
+
}
|
1030
|
+
else {
|
1031
|
+
m.push(safeJSONStringify(arguments[i]));
|
1032
|
+
}
|
1033
|
+
}
|
1034
|
+
return m.join(' : ');
|
1035
|
+
}
|
1036
|
+
function arrayIndexOf(array, item) {
|
1037
|
+
var nativeIndexOf = Array.prototype.indexOf;
|
1038
|
+
if (array === null) {
|
1039
|
+
return -1;
|
1040
|
+
}
|
1041
|
+
if (nativeIndexOf && array.indexOf === nativeIndexOf) {
|
1042
|
+
return array.indexOf(item);
|
1043
|
+
}
|
1044
|
+
for (var i = 0, l = array.length; i < l; i++) {
|
1045
|
+
if (array[i] === item) {
|
1046
|
+
return i;
|
1047
|
+
}
|
1048
|
+
}
|
1049
|
+
return -1;
|
1050
|
+
}
|
1051
|
+
function objectApply(object, f) {
|
1052
|
+
for (var key in object) {
|
1053
|
+
if (Object.prototype.hasOwnProperty.call(object, key)) {
|
1054
|
+
f(object[key], key, object);
|
1055
|
+
}
|
1056
|
+
}
|
1057
|
+
}
|
1058
|
+
function keys(object) {
|
1059
|
+
var keys = [];
|
1060
|
+
objectApply(object, function (_, key) {
|
1061
|
+
keys.push(key);
|
1062
|
+
});
|
1063
|
+
return keys;
|
1064
|
+
}
|
1065
|
+
function values(object) {
|
1066
|
+
var values = [];
|
1067
|
+
objectApply(object, function (value) {
|
1068
|
+
values.push(value);
|
1069
|
+
});
|
1070
|
+
return values;
|
1071
|
+
}
|
1072
|
+
function apply(array, f, context) {
|
1073
|
+
for (var i = 0; i < array.length; i++) {
|
1074
|
+
f.call(context || window, array[i], i, array);
|
1075
|
+
}
|
1076
|
+
}
|
1077
|
+
function map(array, f) {
|
1078
|
+
var result = [];
|
1079
|
+
for (var i = 0; i < array.length; i++) {
|
1080
|
+
result.push(f(array[i], i, array, result));
|
1081
|
+
}
|
1082
|
+
return result;
|
1083
|
+
}
|
1084
|
+
function mapObject(object, f) {
|
1085
|
+
var result = {};
|
1086
|
+
objectApply(object, function (value, key) {
|
1087
|
+
result[key] = f(value);
|
1088
|
+
});
|
1089
|
+
return result;
|
1090
|
+
}
|
1091
|
+
function filter(array, test) {
|
1092
|
+
test =
|
1093
|
+
test ||
|
1094
|
+
function (value) {
|
1095
|
+
return !!value;
|
1096
|
+
};
|
1097
|
+
var result = [];
|
1098
|
+
for (var i = 0; i < array.length; i++) {
|
1099
|
+
if (test(array[i], i, array, result)) {
|
1100
|
+
result.push(array[i]);
|
1101
|
+
}
|
1102
|
+
}
|
1103
|
+
return result;
|
1104
|
+
}
|
1105
|
+
function filterObject(object, test) {
|
1106
|
+
var result = {};
|
1107
|
+
objectApply(object, function (value, key) {
|
1108
|
+
if ((test && test(value, key, object, result)) || Boolean(value)) {
|
1109
|
+
result[key] = value;
|
1110
|
+
}
|
1111
|
+
});
|
1112
|
+
return result;
|
1113
|
+
}
|
1114
|
+
function flatten(object) {
|
1115
|
+
var result = [];
|
1116
|
+
objectApply(object, function (value, key) {
|
1117
|
+
result.push([key, value]);
|
1118
|
+
});
|
1119
|
+
return result;
|
1120
|
+
}
|
1121
|
+
function any(array, test) {
|
1122
|
+
for (var i = 0; i < array.length; i++) {
|
1123
|
+
if (test(array[i], i, array)) {
|
1124
|
+
return true;
|
1125
|
+
}
|
1126
|
+
}
|
1127
|
+
return false;
|
1128
|
+
}
|
1129
|
+
function collections_all(array, test) {
|
1130
|
+
for (var i = 0; i < array.length; i++) {
|
1131
|
+
if (!test(array[i], i, array)) {
|
1132
|
+
return false;
|
1133
|
+
}
|
1134
|
+
}
|
1135
|
+
return true;
|
1136
|
+
}
|
1137
|
+
function encodeParamsObject(data) {
|
1138
|
+
return mapObject(data, function (value) {
|
1139
|
+
if (typeof value === 'object') {
|
1140
|
+
value = safeJSONStringify(value);
|
1141
|
+
}
|
1142
|
+
return encodeURIComponent(encode(value.toString()));
|
1143
|
+
});
|
1144
|
+
}
|
1145
|
+
function buildQueryString(data) {
|
1146
|
+
var params = filterObject(data, function (value) {
|
1147
|
+
return value !== undefined;
|
1148
|
+
});
|
1149
|
+
var query = map(flatten(encodeParamsObject(params)), util.method('join', '=')).join('&');
|
1150
|
+
return query;
|
1151
|
+
}
|
1152
|
+
function decycleObject(object) {
|
1153
|
+
var objects = [], paths = [];
|
1154
|
+
return (function derez(value, path) {
|
1155
|
+
var i, name, nu;
|
1156
|
+
switch (typeof value) {
|
1157
|
+
case 'object':
|
1158
|
+
if (!value) {
|
1159
|
+
return null;
|
1160
|
+
}
|
1161
|
+
for (i = 0; i < objects.length; i += 1) {
|
1162
|
+
if (objects[i] === value) {
|
1163
|
+
return { $ref: paths[i] };
|
1164
|
+
}
|
1165
|
+
}
|
1166
|
+
objects.push(value);
|
1167
|
+
paths.push(path);
|
1168
|
+
if (Object.prototype.toString.apply(value) === '[object Array]') {
|
1169
|
+
nu = [];
|
1170
|
+
for (i = 0; i < value.length; i += 1) {
|
1171
|
+
nu[i] = derez(value[i], path + '[' + i + ']');
|
1172
|
+
}
|
1173
|
+
}
|
1174
|
+
else {
|
1175
|
+
nu = {};
|
1176
|
+
for (name in value) {
|
1177
|
+
if (Object.prototype.hasOwnProperty.call(value, name)) {
|
1178
|
+
nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
|
1179
|
+
}
|
1180
|
+
}
|
1181
|
+
}
|
1182
|
+
return nu;
|
1183
|
+
case 'number':
|
1184
|
+
case 'string':
|
1185
|
+
case 'boolean':
|
1186
|
+
return value;
|
1187
|
+
}
|
1188
|
+
})(object, '$');
|
1189
|
+
}
|
1190
|
+
function safeJSONStringify(source) {
|
1191
|
+
try {
|
1192
|
+
return JSON.stringify(source);
|
1193
|
+
}
|
1194
|
+
catch (e) {
|
1195
|
+
return JSON.stringify(decycleObject(source));
|
1196
|
+
}
|
1197
|
+
}
|
1198
|
+
|
1199
|
+
// CONCATENATED MODULE: ./src/core/logger.ts
|
1200
|
+
|
1201
|
+
|
1202
|
+
var logger_Logger = (function () {
|
1203
|
+
function Logger() {
|
1204
|
+
this.globalLog = function (message) {
|
1205
|
+
if (window.console && window.console.log) {
|
1206
|
+
window.console.log(message);
|
1207
|
+
}
|
1208
|
+
};
|
1209
|
+
}
|
1210
|
+
Logger.prototype.debug = function () {
|
1211
|
+
var args = [];
|
1212
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
1213
|
+
args[_i] = arguments[_i];
|
1214
|
+
}
|
1215
|
+
this.log(this.globalLog, args);
|
1216
|
+
};
|
1217
|
+
Logger.prototype.warn = function () {
|
1218
|
+
var args = [];
|
1219
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
1220
|
+
args[_i] = arguments[_i];
|
1221
|
+
}
|
1222
|
+
this.log(this.globalLogWarn, args);
|
1223
|
+
};
|
1224
|
+
Logger.prototype.error = function () {
|
1225
|
+
var args = [];
|
1226
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
1227
|
+
args[_i] = arguments[_i];
|
1228
|
+
}
|
1229
|
+
this.log(this.globalLogError, args);
|
1230
|
+
};
|
1231
|
+
Logger.prototype.globalLogWarn = function (message) {
|
1232
|
+
if (window.console && window.console.warn) {
|
1233
|
+
window.console.warn(message);
|
1234
|
+
}
|
1235
|
+
else {
|
1236
|
+
this.globalLog(message);
|
1237
|
+
}
|
1238
|
+
};
|
1239
|
+
Logger.prototype.globalLogError = function (message) {
|
1240
|
+
if (window.console && window.console.error) {
|
1241
|
+
window.console.error(message);
|
1242
|
+
}
|
1243
|
+
else {
|
1244
|
+
this.globalLogWarn(message);
|
1245
|
+
}
|
1246
|
+
};
|
1247
|
+
Logger.prototype.log = function (defaultLoggingFunction) {
|
1248
|
+
var args = [];
|
1249
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
1250
|
+
args[_i - 1] = arguments[_i];
|
1251
|
+
}
|
1252
|
+
var message = stringify.apply(this, arguments);
|
1253
|
+
if (core_pusher.log) {
|
1254
|
+
core_pusher.log(message);
|
1255
|
+
}
|
1256
|
+
else if (core_pusher.logToConsole) {
|
1257
|
+
var log = defaultLoggingFunction.bind(this);
|
1258
|
+
log(message);
|
1259
|
+
}
|
1260
|
+
};
|
1261
|
+
return Logger;
|
1262
|
+
}());
|
1263
|
+
/* harmony default export */ var logger = (new logger_Logger());
|
1264
|
+
|
1265
|
+
// CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
|
1266
|
+
|
1267
|
+
var jsonp = function (context, socketId, callback) {
|
1268
|
+
if (this.authOptions.headers !== undefined) {
|
1269
|
+
logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
|
1270
|
+
}
|
1271
|
+
var callbackName = context.nextAuthCallbackID.toString();
|
1272
|
+
context.nextAuthCallbackID++;
|
1273
|
+
var document = context.getDocument();
|
1274
|
+
var script = document.createElement('script');
|
1275
|
+
context.auth_callbacks[callbackName] = function (data) {
|
1276
|
+
callback(null, data);
|
1277
|
+
};
|
1278
|
+
var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
|
1279
|
+
script.src =
|
1280
|
+
this.options.authEndpoint +
|
1281
|
+
'?callback=' +
|
1282
|
+
encodeURIComponent(callback_name) +
|
1283
|
+
'&' +
|
1284
|
+
this.composeQuery(socketId);
|
1285
|
+
var head = document.getElementsByTagName('head')[0] || document.documentElement;
|
1286
|
+
head.insertBefore(script, head.firstChild);
|
1287
|
+
};
|
1288
|
+
/* harmony default export */ var jsonp_auth = (jsonp);
|
1289
|
+
|
1290
|
+
// CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
|
1291
|
+
var ScriptRequest = (function () {
|
1292
|
+
function ScriptRequest(src) {
|
1293
|
+
this.src = src;
|
1294
|
+
}
|
1295
|
+
ScriptRequest.prototype.send = function (receiver) {
|
1296
|
+
var self = this;
|
1297
|
+
var errorString = 'Error loading ' + self.src;
|
1298
|
+
self.script = document.createElement('script');
|
1299
|
+
self.script.id = receiver.id;
|
1300
|
+
self.script.src = self.src;
|
1301
|
+
self.script.type = 'text/javascript';
|
1302
|
+
self.script.charset = 'UTF-8';
|
1303
|
+
if (self.script.addEventListener) {
|
1304
|
+
self.script.onerror = function () {
|
1305
|
+
receiver.callback(errorString);
|
1306
|
+
};
|
1307
|
+
self.script.onload = function () {
|
1308
|
+
receiver.callback(null);
|
1309
|
+
};
|
1310
|
+
}
|
1311
|
+
else {
|
1312
|
+
self.script.onreadystatechange = function () {
|
1313
|
+
if (self.script.readyState === 'loaded' ||
|
1314
|
+
self.script.readyState === 'complete') {
|
1315
|
+
receiver.callback(null);
|
1316
|
+
}
|
1317
|
+
};
|
1318
|
+
}
|
1319
|
+
if (self.script.async === undefined &&
|
1320
|
+
document.attachEvent &&
|
1321
|
+
/opera/i.test(navigator.userAgent)) {
|
1322
|
+
self.errorScript = document.createElement('script');
|
1323
|
+
self.errorScript.id = receiver.id + '_error';
|
1324
|
+
self.errorScript.text = receiver.name + "('" + errorString + "');";
|
1325
|
+
self.script.async = self.errorScript.async = false;
|
1326
|
+
}
|
1327
|
+
else {
|
1328
|
+
self.script.async = true;
|
1329
|
+
}
|
1330
|
+
var head = document.getElementsByTagName('head')[0];
|
1331
|
+
head.insertBefore(self.script, head.firstChild);
|
1332
|
+
if (self.errorScript) {
|
1333
|
+
head.insertBefore(self.errorScript, self.script.nextSibling);
|
1334
|
+
}
|
1335
|
+
};
|
1336
|
+
ScriptRequest.prototype.cleanup = function () {
|
1337
|
+
if (this.script) {
|
1338
|
+
this.script.onload = this.script.onerror = null;
|
1339
|
+
this.script.onreadystatechange = null;
|
1340
|
+
}
|
1341
|
+
if (this.script && this.script.parentNode) {
|
1342
|
+
this.script.parentNode.removeChild(this.script);
|
1343
|
+
}
|
1344
|
+
if (this.errorScript && this.errorScript.parentNode) {
|
1345
|
+
this.errorScript.parentNode.removeChild(this.errorScript);
|
1346
|
+
}
|
1347
|
+
this.script = null;
|
1348
|
+
this.errorScript = null;
|
1349
|
+
};
|
1350
|
+
return ScriptRequest;
|
1351
|
+
}());
|
1352
|
+
/* harmony default export */ var script_request = (ScriptRequest);
|
1353
|
+
|
1354
|
+
// CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
|
1355
|
+
|
1356
|
+
|
1357
|
+
var jsonp_request_JSONPRequest = (function () {
|
1358
|
+
function JSONPRequest(url, data) {
|
1359
|
+
this.url = url;
|
1360
|
+
this.data = data;
|
1361
|
+
}
|
1362
|
+
JSONPRequest.prototype.send = function (receiver) {
|
1363
|
+
if (this.request) {
|
1364
|
+
return;
|
1365
|
+
}
|
1366
|
+
var query = buildQueryString(this.data);
|
1367
|
+
var url = this.url + '/' + receiver.number + '?' + query;
|
1368
|
+
this.request = runtime.createScriptRequest(url);
|
1369
|
+
this.request.send(receiver);
|
1370
|
+
};
|
1371
|
+
JSONPRequest.prototype.cleanup = function () {
|
1372
|
+
if (this.request) {
|
1373
|
+
this.request.cleanup();
|
1374
|
+
}
|
1375
|
+
};
|
1376
|
+
return JSONPRequest;
|
1377
|
+
}());
|
1378
|
+
/* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
|
1379
|
+
|
1380
|
+
// CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
|
1381
|
+
|
1382
|
+
|
1383
|
+
var getAgent = function (sender, useTLS) {
|
1384
|
+
return function (data, callback) {
|
1385
|
+
var scheme = 'http' + (useTLS ? 's' : '') + '://';
|
1386
|
+
var url = scheme + (sender.host || sender.options.host) + sender.options.path;
|
1387
|
+
var request = runtime.createJSONPRequest(url, data);
|
1388
|
+
var receiver = runtime.ScriptReceivers.create(function (error, result) {
|
1389
|
+
ScriptReceivers.remove(receiver);
|
1390
|
+
request.cleanup();
|
1391
|
+
if (result && result.host) {
|
1392
|
+
sender.host = result.host;
|
1393
|
+
}
|
1394
|
+
if (callback) {
|
1395
|
+
callback(error, result);
|
1396
|
+
}
|
1397
|
+
});
|
1398
|
+
request.send(receiver);
|
1399
|
+
};
|
1400
|
+
};
|
1401
|
+
var jsonp_timeline_jsonp = {
|
1402
|
+
name: 'jsonp',
|
1403
|
+
getAgent: getAgent
|
1404
|
+
};
|
1405
|
+
/* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
|
1406
|
+
|
1407
|
+
// CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
|
1408
|
+
|
1409
|
+
function getGenericURL(baseScheme, params, path) {
|
1410
|
+
var scheme = baseScheme + (params.useTLS ? 's' : '');
|
1411
|
+
var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
|
1412
|
+
return scheme + '://' + host + path;
|
1413
|
+
}
|
1414
|
+
function getGenericPath(key, queryString) {
|
1415
|
+
var path = '/app/' + key;
|
1416
|
+
var query = '?protocol=' +
|
1417
|
+
defaults.PROTOCOL +
|
1418
|
+
'&client=js' +
|
1419
|
+
'&version=' +
|
1420
|
+
defaults.VERSION +
|
1421
|
+
(queryString ? '&' + queryString : '');
|
1422
|
+
return path + query;
|
1423
|
+
}
|
1424
|
+
var ws = {
|
1425
|
+
getInitial: function (key, params) {
|
1426
|
+
var path = (params.httpPath || '') + getGenericPath(key, 'flash=false');
|
1427
|
+
return getGenericURL('ws', params, path);
|
1428
|
+
}
|
1429
|
+
};
|
1430
|
+
var http = {
|
1431
|
+
getInitial: function (key, params) {
|
1432
|
+
var path = (params.httpPath || '/pusher') + getGenericPath(key);
|
1433
|
+
return getGenericURL('http', params, path);
|
1434
|
+
}
|
1435
|
+
};
|
1436
|
+
var sockjs = {
|
1437
|
+
getInitial: function (key, params) {
|
1438
|
+
return getGenericURL('http', params, params.httpPath || '/pusher');
|
1439
|
+
},
|
1440
|
+
getPath: function (key, params) {
|
1441
|
+
return getGenericPath(key);
|
1442
|
+
}
|
1443
|
+
};
|
1444
|
+
|
1445
|
+
// CONCATENATED MODULE: ./src/core/events/callback_registry.ts
|
1446
|
+
|
1447
|
+
var callback_registry_CallbackRegistry = (function () {
|
1448
|
+
function CallbackRegistry() {
|
1449
|
+
this._callbacks = {};
|
1450
|
+
}
|
1451
|
+
CallbackRegistry.prototype.get = function (name) {
|
1452
|
+
return this._callbacks[prefix(name)];
|
1453
|
+
};
|
1454
|
+
CallbackRegistry.prototype.add = function (name, callback, context) {
|
1455
|
+
var prefixedEventName = prefix(name);
|
1456
|
+
this._callbacks[prefixedEventName] =
|
1457
|
+
this._callbacks[prefixedEventName] || [];
|
1458
|
+
this._callbacks[prefixedEventName].push({
|
1459
|
+
fn: callback,
|
1460
|
+
context: context
|
1461
|
+
});
|
1462
|
+
};
|
1463
|
+
CallbackRegistry.prototype.remove = function (name, callback, context) {
|
1464
|
+
if (!name && !callback && !context) {
|
1465
|
+
this._callbacks = {};
|
1466
|
+
return;
|
1467
|
+
}
|
1468
|
+
var names = name ? [prefix(name)] : keys(this._callbacks);
|
1469
|
+
if (callback || context) {
|
1470
|
+
this.removeCallback(names, callback, context);
|
1471
|
+
}
|
1472
|
+
else {
|
1473
|
+
this.removeAllCallbacks(names);
|
1474
|
+
}
|
1475
|
+
};
|
1476
|
+
CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
|
1477
|
+
apply(names, function (name) {
|
1478
|
+
this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
|
1479
|
+
return ((callback && callback !== binding.fn) ||
|
1480
|
+
(context && context !== binding.context));
|
1481
|
+
});
|
1482
|
+
if (this._callbacks[name].length === 0) {
|
1483
|
+
delete this._callbacks[name];
|
1484
|
+
}
|
1485
|
+
}, this);
|
1486
|
+
};
|
1487
|
+
CallbackRegistry.prototype.removeAllCallbacks = function (names) {
|
1488
|
+
apply(names, function (name) {
|
1489
|
+
delete this._callbacks[name];
|
1490
|
+
}, this);
|
1491
|
+
};
|
1492
|
+
return CallbackRegistry;
|
1493
|
+
}());
|
1494
|
+
/* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
|
1495
|
+
function prefix(name) {
|
1496
|
+
return '_' + name;
|
1497
|
+
}
|
1498
|
+
|
1499
|
+
// CONCATENATED MODULE: ./src/core/events/dispatcher.ts
|
1500
|
+
|
1501
|
+
|
1502
|
+
var dispatcher_Dispatcher = (function () {
|
1503
|
+
function Dispatcher(failThrough) {
|
1504
|
+
this.callbacks = new callback_registry();
|
1505
|
+
this.global_callbacks = [];
|
1506
|
+
this.failThrough = failThrough;
|
1507
|
+
}
|
1508
|
+
Dispatcher.prototype.bind = function (eventName, callback, context) {
|
1509
|
+
this.callbacks.add(eventName, callback, context);
|
1510
|
+
return this;
|
1511
|
+
};
|
1512
|
+
Dispatcher.prototype.bind_global = function (callback) {
|
1513
|
+
this.global_callbacks.push(callback);
|
1514
|
+
return this;
|
1515
|
+
};
|
1516
|
+
Dispatcher.prototype.unbind = function (eventName, callback, context) {
|
1517
|
+
this.callbacks.remove(eventName, callback, context);
|
1518
|
+
return this;
|
1519
|
+
};
|
1520
|
+
Dispatcher.prototype.unbind_global = function (callback) {
|
1521
|
+
if (!callback) {
|
1522
|
+
this.global_callbacks = [];
|
1523
|
+
return this;
|
1524
|
+
}
|
1525
|
+
this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
|
1526
|
+
return this;
|
1527
|
+
};
|
1528
|
+
Dispatcher.prototype.unbind_all = function () {
|
1529
|
+
this.unbind();
|
1530
|
+
this.unbind_global();
|
1531
|
+
return this;
|
1532
|
+
};
|
1533
|
+
Dispatcher.prototype.emit = function (eventName, data, metadata) {
|
1534
|
+
for (var i = 0; i < this.global_callbacks.length; i++) {
|
1535
|
+
this.global_callbacks[i](eventName, data);
|
1536
|
+
}
|
1537
|
+
var callbacks = this.callbacks.get(eventName);
|
1538
|
+
var args = [];
|
1539
|
+
if (metadata) {
|
1540
|
+
args.push(data, metadata);
|
1541
|
+
}
|
1542
|
+
else if (data) {
|
1543
|
+
args.push(data);
|
1544
|
+
}
|
1545
|
+
if (callbacks && callbacks.length > 0) {
|
1546
|
+
for (var i = 0; i < callbacks.length; i++) {
|
1547
|
+
callbacks[i].fn.apply(callbacks[i].context || window, args);
|
1548
|
+
}
|
1549
|
+
}
|
1550
|
+
else if (this.failThrough) {
|
1551
|
+
this.failThrough(eventName, data);
|
1552
|
+
}
|
1553
|
+
return this;
|
1554
|
+
};
|
1555
|
+
return Dispatcher;
|
1556
|
+
}());
|
1557
|
+
/* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
|
1558
|
+
|
1559
|
+
// CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
|
1560
|
+
var transport_connection_extends = (undefined && undefined.__extends) || (function () {
|
1561
|
+
var extendStatics = function (d, b) {
|
1562
|
+
extendStatics = Object.setPrototypeOf ||
|
1563
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
1564
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
1565
|
+
return extendStatics(d, b);
|
1566
|
+
};
|
1567
|
+
return function (d, b) {
|
1568
|
+
extendStatics(d, b);
|
1569
|
+
function __() { this.constructor = d; }
|
1570
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
1571
|
+
};
|
1572
|
+
})();
|
1573
|
+
|
1574
|
+
|
1575
|
+
|
1576
|
+
|
1577
|
+
|
1578
|
+
var transport_connection_TransportConnection = (function (_super) {
|
1579
|
+
transport_connection_extends(TransportConnection, _super);
|
1580
|
+
function TransportConnection(hooks, name, priority, key, options) {
|
1581
|
+
var _this = _super.call(this) || this;
|
1582
|
+
_this.initialize = runtime.transportConnectionInitializer;
|
1583
|
+
_this.hooks = hooks;
|
1584
|
+
_this.name = name;
|
1585
|
+
_this.priority = priority;
|
1586
|
+
_this.key = key;
|
1587
|
+
_this.options = options;
|
1588
|
+
_this.state = 'new';
|
1589
|
+
_this.timeline = options.timeline;
|
1590
|
+
_this.activityTimeout = options.activityTimeout;
|
1591
|
+
_this.id = _this.timeline.generateUniqueID();
|
1592
|
+
return _this;
|
1593
|
+
}
|
1594
|
+
TransportConnection.prototype.handlesActivityChecks = function () {
|
1595
|
+
return Boolean(this.hooks.handlesActivityChecks);
|
1596
|
+
};
|
1597
|
+
TransportConnection.prototype.supportsPing = function () {
|
1598
|
+
return Boolean(this.hooks.supportsPing);
|
1599
|
+
};
|
1600
|
+
TransportConnection.prototype.connect = function () {
|
1601
|
+
var _this = this;
|
1602
|
+
if (this.socket || this.state !== 'initialized') {
|
1603
|
+
return false;
|
1604
|
+
}
|
1605
|
+
var url = this.hooks.urls.getInitial(this.key, this.options);
|
1606
|
+
try {
|
1607
|
+
this.socket = this.hooks.getSocket(url, this.options);
|
1608
|
+
}
|
1609
|
+
catch (e) {
|
1610
|
+
util.defer(function () {
|
1611
|
+
_this.onError(e);
|
1612
|
+
_this.changeState('closed');
|
1613
|
+
});
|
1614
|
+
return false;
|
1615
|
+
}
|
1616
|
+
this.bindListeners();
|
1617
|
+
logger.debug('Connecting', { transport: this.name, url: url });
|
1618
|
+
this.changeState('connecting');
|
1619
|
+
return true;
|
1620
|
+
};
|
1621
|
+
TransportConnection.prototype.close = function () {
|
1622
|
+
if (this.socket) {
|
1623
|
+
this.socket.close();
|
1624
|
+
return true;
|
1625
|
+
}
|
1626
|
+
else {
|
1627
|
+
return false;
|
1628
|
+
}
|
1629
|
+
};
|
1630
|
+
TransportConnection.prototype.send = function (data) {
|
1631
|
+
var _this = this;
|
1632
|
+
if (this.state === 'open') {
|
1633
|
+
util.defer(function () {
|
1634
|
+
if (_this.socket) {
|
1635
|
+
_this.socket.send(data);
|
1636
|
+
}
|
1637
|
+
});
|
1638
|
+
return true;
|
1639
|
+
}
|
1640
|
+
else {
|
1641
|
+
return false;
|
1642
|
+
}
|
1643
|
+
};
|
1644
|
+
TransportConnection.prototype.ping = function () {
|
1645
|
+
if (this.state === 'open' && this.supportsPing()) {
|
1646
|
+
this.socket.ping();
|
1647
|
+
}
|
1648
|
+
};
|
1649
|
+
TransportConnection.prototype.onOpen = function () {
|
1650
|
+
if (this.hooks.beforeOpen) {
|
1651
|
+
this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
|
1652
|
+
}
|
1653
|
+
this.changeState('open');
|
1654
|
+
this.socket.onopen = undefined;
|
1655
|
+
};
|
1656
|
+
TransportConnection.prototype.onError = function (error) {
|
1657
|
+
this.emit('error', { type: 'WebSocketError', error: error });
|
1658
|
+
this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
|
1659
|
+
};
|
1660
|
+
TransportConnection.prototype.onClose = function (closeEvent) {
|
1661
|
+
if (closeEvent) {
|
1662
|
+
this.changeState('closed', {
|
1663
|
+
code: closeEvent.code,
|
1664
|
+
reason: closeEvent.reason,
|
1665
|
+
wasClean: closeEvent.wasClean
|
1666
|
+
});
|
1667
|
+
}
|
1668
|
+
else {
|
1669
|
+
this.changeState('closed');
|
1670
|
+
}
|
1671
|
+
this.unbindListeners();
|
1672
|
+
this.socket = undefined;
|
1673
|
+
};
|
1674
|
+
TransportConnection.prototype.onMessage = function (message) {
|
1675
|
+
this.emit('message', message);
|
1676
|
+
};
|
1677
|
+
TransportConnection.prototype.onActivity = function () {
|
1678
|
+
this.emit('activity');
|
1679
|
+
};
|
1680
|
+
TransportConnection.prototype.bindListeners = function () {
|
1681
|
+
var _this = this;
|
1682
|
+
this.socket.onopen = function () {
|
1683
|
+
_this.onOpen();
|
1684
|
+
};
|
1685
|
+
this.socket.onerror = function (error) {
|
1686
|
+
_this.onError(error);
|
1687
|
+
};
|
1688
|
+
this.socket.onclose = function (closeEvent) {
|
1689
|
+
_this.onClose(closeEvent);
|
1690
|
+
};
|
1691
|
+
this.socket.onmessage = function (message) {
|
1692
|
+
_this.onMessage(message);
|
1693
|
+
};
|
1694
|
+
if (this.supportsPing()) {
|
1695
|
+
this.socket.onactivity = function () {
|
1696
|
+
_this.onActivity();
|
1697
|
+
};
|
1698
|
+
}
|
1699
|
+
};
|
1700
|
+
TransportConnection.prototype.unbindListeners = function () {
|
1701
|
+
if (this.socket) {
|
1702
|
+
this.socket.onopen = undefined;
|
1703
|
+
this.socket.onerror = undefined;
|
1704
|
+
this.socket.onclose = undefined;
|
1705
|
+
this.socket.onmessage = undefined;
|
1706
|
+
if (this.supportsPing()) {
|
1707
|
+
this.socket.onactivity = undefined;
|
1708
|
+
}
|
1709
|
+
}
|
1710
|
+
};
|
1711
|
+
TransportConnection.prototype.changeState = function (state, params) {
|
1712
|
+
this.state = state;
|
1713
|
+
this.timeline.info(this.buildTimelineMessage({
|
1714
|
+
state: state,
|
1715
|
+
params: params
|
1716
|
+
}));
|
1717
|
+
this.emit(state, params);
|
1718
|
+
};
|
1719
|
+
TransportConnection.prototype.buildTimelineMessage = function (message) {
|
1720
|
+
return extend({ cid: this.id }, message);
|
1721
|
+
};
|
1722
|
+
return TransportConnection;
|
1723
|
+
}(dispatcher));
|
1724
|
+
/* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
|
1725
|
+
|
1726
|
+
// CONCATENATED MODULE: ./src/core/transports/transport.ts
|
1727
|
+
|
1728
|
+
var transport_Transport = (function () {
|
1729
|
+
function Transport(hooks) {
|
1730
|
+
this.hooks = hooks;
|
1731
|
+
}
|
1732
|
+
Transport.prototype.isSupported = function (environment) {
|
1733
|
+
return this.hooks.isSupported(environment);
|
1734
|
+
};
|
1735
|
+
Transport.prototype.createConnection = function (name, priority, key, options) {
|
1736
|
+
return new transport_connection(this.hooks, name, priority, key, options);
|
1737
|
+
};
|
1738
|
+
return Transport;
|
1739
|
+
}());
|
1740
|
+
/* harmony default export */ var transports_transport = (transport_Transport);
|
1741
|
+
|
1742
|
+
// CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
|
1743
|
+
|
1744
|
+
|
1745
|
+
|
1746
|
+
|
1747
|
+
var WSTransport = new transports_transport({
|
1748
|
+
urls: ws,
|
1749
|
+
handlesActivityChecks: false,
|
1750
|
+
supportsPing: false,
|
1751
|
+
isInitialized: function () {
|
1752
|
+
return Boolean(runtime.getWebSocketAPI());
|
1753
|
+
},
|
1754
|
+
isSupported: function () {
|
1755
|
+
return Boolean(runtime.getWebSocketAPI());
|
1756
|
+
},
|
1757
|
+
getSocket: function (url) {
|
1758
|
+
return runtime.createWebSocket(url);
|
1759
|
+
}
|
1760
|
+
});
|
1761
|
+
var httpConfiguration = {
|
1762
|
+
urls: http,
|
1763
|
+
handlesActivityChecks: false,
|
1764
|
+
supportsPing: true,
|
1765
|
+
isInitialized: function () {
|
1766
|
+
return true;
|
1767
|
+
}
|
1768
|
+
};
|
1769
|
+
var streamingConfiguration = extend({
|
1770
|
+
getSocket: function (url) {
|
1771
|
+
return runtime.HTTPFactory.createStreamingSocket(url);
|
1772
|
+
}
|
1773
|
+
}, httpConfiguration);
|
1774
|
+
var pollingConfiguration = extend({
|
1775
|
+
getSocket: function (url) {
|
1776
|
+
return runtime.HTTPFactory.createPollingSocket(url);
|
1777
|
+
}
|
1778
|
+
}, httpConfiguration);
|
1779
|
+
var xhrConfiguration = {
|
1780
|
+
isSupported: function () {
|
1781
|
+
return runtime.isXHRSupported();
|
1782
|
+
}
|
1783
|
+
};
|
1784
|
+
var XHRStreamingTransport = new transports_transport((extend({}, streamingConfiguration, xhrConfiguration)));
|
1785
|
+
var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
|
1786
|
+
var Transports = {
|
1787
|
+
ws: WSTransport,
|
1788
|
+
xhr_streaming: XHRStreamingTransport,
|
1789
|
+
xhr_polling: XHRPollingTransport
|
1790
|
+
};
|
1791
|
+
/* harmony default export */ var transports = (Transports);
|
1792
|
+
|
1793
|
+
// CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
|
1794
|
+
|
1795
|
+
|
1796
|
+
|
1797
|
+
|
1798
|
+
|
1799
|
+
|
1800
|
+
var SockJSTransport = new transports_transport({
|
1801
|
+
file: 'sockjs',
|
1802
|
+
urls: sockjs,
|
1803
|
+
handlesActivityChecks: true,
|
1804
|
+
supportsPing: false,
|
1805
|
+
isSupported: function () {
|
1806
|
+
return true;
|
1807
|
+
},
|
1808
|
+
isInitialized: function () {
|
1809
|
+
return window.SockJS !== undefined;
|
1810
|
+
},
|
1811
|
+
getSocket: function (url, options) {
|
1812
|
+
return new window.SockJS(url, null, {
|
1813
|
+
js_path: Dependencies.getPath('sockjs', {
|
1814
|
+
useTLS: options.useTLS
|
1815
|
+
}),
|
1816
|
+
ignore_null_origin: options.ignoreNullOrigin
|
1817
|
+
});
|
1818
|
+
},
|
1819
|
+
beforeOpen: function (socket, path) {
|
1820
|
+
socket.send(JSON.stringify({
|
1821
|
+
path: path
|
1822
|
+
}));
|
1823
|
+
}
|
1824
|
+
});
|
1825
|
+
var xdrConfiguration = {
|
1826
|
+
isSupported: function (environment) {
|
1827
|
+
var yes = runtime.isXDRSupported(environment.useTLS);
|
1828
|
+
return yes;
|
1829
|
+
}
|
1830
|
+
};
|
1831
|
+
var XDRStreamingTransport = new transports_transport((extend({}, streamingConfiguration, xdrConfiguration)));
|
1832
|
+
var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
|
1833
|
+
transports.xdr_streaming = XDRStreamingTransport;
|
1834
|
+
transports.xdr_polling = XDRPollingTransport;
|
1835
|
+
transports.sockjs = SockJSTransport;
|
1836
|
+
/* harmony default export */ var transports_transports = (transports);
|
1837
|
+
|
1838
|
+
// CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
|
1839
|
+
var net_info_extends = (undefined && undefined.__extends) || (function () {
|
1840
|
+
var extendStatics = function (d, b) {
|
1841
|
+
extendStatics = Object.setPrototypeOf ||
|
1842
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
1843
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
1844
|
+
return extendStatics(d, b);
|
1845
|
+
};
|
1846
|
+
return function (d, b) {
|
1847
|
+
extendStatics(d, b);
|
1848
|
+
function __() { this.constructor = d; }
|
1849
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
1850
|
+
};
|
1851
|
+
})();
|
1852
|
+
|
1853
|
+
var NetInfo = (function (_super) {
|
1854
|
+
net_info_extends(NetInfo, _super);
|
1855
|
+
function NetInfo() {
|
1856
|
+
var _this = _super.call(this) || this;
|
1857
|
+
var self = _this;
|
1858
|
+
if (window.addEventListener !== undefined) {
|
1859
|
+
window.addEventListener('online', function () {
|
1860
|
+
self.emit('online');
|
1861
|
+
}, false);
|
1862
|
+
window.addEventListener('offline', function () {
|
1863
|
+
self.emit('offline');
|
1864
|
+
}, false);
|
1865
|
+
}
|
1866
|
+
return _this;
|
1867
|
+
}
|
1868
|
+
NetInfo.prototype.isOnline = function () {
|
1869
|
+
if (window.navigator.onLine === undefined) {
|
1870
|
+
return true;
|
1871
|
+
}
|
1872
|
+
else {
|
1873
|
+
return window.navigator.onLine;
|
1874
|
+
}
|
1875
|
+
};
|
1876
|
+
return NetInfo;
|
1877
|
+
}(dispatcher));
|
1878
|
+
|
1879
|
+
var net_info_Network = new NetInfo();
|
1880
|
+
|
1881
|
+
// CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
|
1882
|
+
|
1883
|
+
|
1884
|
+
var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
|
1885
|
+
function AssistantToTheTransportManager(manager, transport, options) {
|
1886
|
+
this.manager = manager;
|
1887
|
+
this.transport = transport;
|
1888
|
+
this.minPingDelay = options.minPingDelay;
|
1889
|
+
this.maxPingDelay = options.maxPingDelay;
|
1890
|
+
this.pingDelay = undefined;
|
1891
|
+
}
|
1892
|
+
AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
|
1893
|
+
var _this = this;
|
1894
|
+
options = extend({}, options, {
|
1895
|
+
activityTimeout: this.pingDelay
|
1896
|
+
});
|
1897
|
+
var connection = this.transport.createConnection(name, priority, key, options);
|
1898
|
+
var openTimestamp = null;
|
1899
|
+
var onOpen = function () {
|
1900
|
+
connection.unbind('open', onOpen);
|
1901
|
+
connection.bind('closed', onClosed);
|
1902
|
+
openTimestamp = util.now();
|
1903
|
+
};
|
1904
|
+
var onClosed = function (closeEvent) {
|
1905
|
+
connection.unbind('closed', onClosed);
|
1906
|
+
if (closeEvent.code === 1002 || closeEvent.code === 1003) {
|
1907
|
+
_this.manager.reportDeath();
|
1908
|
+
}
|
1909
|
+
else if (!closeEvent.wasClean && openTimestamp) {
|
1910
|
+
var lifespan = util.now() - openTimestamp;
|
1911
|
+
if (lifespan < 2 * _this.maxPingDelay) {
|
1912
|
+
_this.manager.reportDeath();
|
1913
|
+
_this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
|
1914
|
+
}
|
1915
|
+
}
|
1916
|
+
};
|
1917
|
+
connection.bind('open', onOpen);
|
1918
|
+
return connection;
|
1919
|
+
};
|
1920
|
+
AssistantToTheTransportManager.prototype.isSupported = function (environment) {
|
1921
|
+
return this.manager.isAlive() && this.transport.isSupported(environment);
|
1922
|
+
};
|
1923
|
+
return AssistantToTheTransportManager;
|
1924
|
+
}());
|
1925
|
+
/* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
|
1926
|
+
|
1927
|
+
// CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
|
1928
|
+
var Protocol = {
|
1929
|
+
decodeMessage: function (messageEvent) {
|
1930
|
+
try {
|
1931
|
+
var messageData = JSON.parse(messageEvent.data);
|
1932
|
+
var pusherEventData = messageData.data;
|
1933
|
+
if (typeof pusherEventData === 'string') {
|
1934
|
+
try {
|
1935
|
+
pusherEventData = JSON.parse(messageData.data);
|
1936
|
+
}
|
1937
|
+
catch (e) { }
|
1938
|
+
}
|
1939
|
+
var pusherEvent = {
|
1940
|
+
event: messageData.event,
|
1941
|
+
channel: messageData.channel,
|
1942
|
+
data: pusherEventData
|
1943
|
+
};
|
1944
|
+
if (messageData.user_id) {
|
1945
|
+
pusherEvent.user_id = messageData.user_id;
|
1946
|
+
}
|
1947
|
+
return pusherEvent;
|
1948
|
+
}
|
1949
|
+
catch (e) {
|
1950
|
+
throw { type: 'MessageParseError', error: e, data: messageEvent.data };
|
1951
|
+
}
|
1952
|
+
},
|
1953
|
+
encodeMessage: function (event) {
|
1954
|
+
return JSON.stringify(event);
|
1955
|
+
},
|
1956
|
+
processHandshake: function (messageEvent) {
|
1957
|
+
var message = Protocol.decodeMessage(messageEvent);
|
1958
|
+
if (message.event === 'pusher:connection_established') {
|
1959
|
+
if (!message.data.activity_timeout) {
|
1960
|
+
throw 'No activity timeout specified in handshake';
|
1961
|
+
}
|
1962
|
+
return {
|
1963
|
+
action: 'connected',
|
1964
|
+
id: message.data.socket_id,
|
1965
|
+
activityTimeout: message.data.activity_timeout * 1000
|
1966
|
+
};
|
1967
|
+
}
|
1968
|
+
else if (message.event === 'pusher:error') {
|
1969
|
+
return {
|
1970
|
+
action: this.getCloseAction(message.data),
|
1971
|
+
error: this.getCloseError(message.data)
|
1972
|
+
};
|
1973
|
+
}
|
1974
|
+
else {
|
1975
|
+
throw 'Invalid handshake';
|
1976
|
+
}
|
1977
|
+
},
|
1978
|
+
getCloseAction: function (closeEvent) {
|
1979
|
+
if (closeEvent.code < 4000) {
|
1980
|
+
if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
|
1981
|
+
return 'backoff';
|
1982
|
+
}
|
1983
|
+
else {
|
1984
|
+
return null;
|
1985
|
+
}
|
1986
|
+
}
|
1987
|
+
else if (closeEvent.code === 4000) {
|
1988
|
+
return 'tls_only';
|
1989
|
+
}
|
1990
|
+
else if (closeEvent.code < 4100) {
|
1991
|
+
return 'refused';
|
1992
|
+
}
|
1993
|
+
else if (closeEvent.code < 4200) {
|
1994
|
+
return 'backoff';
|
1995
|
+
}
|
1996
|
+
else if (closeEvent.code < 4300) {
|
1997
|
+
return 'retry';
|
1998
|
+
}
|
1999
|
+
else {
|
2000
|
+
return 'refused';
|
2001
|
+
}
|
2002
|
+
},
|
2003
|
+
getCloseError: function (closeEvent) {
|
2004
|
+
if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
|
2005
|
+
return {
|
2006
|
+
type: 'PusherError',
|
2007
|
+
data: {
|
2008
|
+
code: closeEvent.code,
|
2009
|
+
message: closeEvent.reason || closeEvent.message
|
2010
|
+
}
|
2011
|
+
};
|
2012
|
+
}
|
2013
|
+
else {
|
2014
|
+
return null;
|
2015
|
+
}
|
2016
|
+
}
|
2017
|
+
};
|
2018
|
+
/* harmony default export */ var protocol_protocol = (Protocol);
|
2019
|
+
|
2020
|
+
// CONCATENATED MODULE: ./src/core/connection/connection.ts
|
2021
|
+
var connection_extends = (undefined && undefined.__extends) || (function () {
|
2022
|
+
var extendStatics = function (d, b) {
|
2023
|
+
extendStatics = Object.setPrototypeOf ||
|
2024
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
2025
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
2026
|
+
return extendStatics(d, b);
|
2027
|
+
};
|
2028
|
+
return function (d, b) {
|
2029
|
+
extendStatics(d, b);
|
2030
|
+
function __() { this.constructor = d; }
|
2031
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
2032
|
+
};
|
2033
|
+
})();
|
2034
|
+
|
2035
|
+
|
2036
|
+
|
2037
|
+
|
2038
|
+
var connection_Connection = (function (_super) {
|
2039
|
+
connection_extends(Connection, _super);
|
2040
|
+
function Connection(id, transport) {
|
2041
|
+
var _this = _super.call(this) || this;
|
2042
|
+
_this.id = id;
|
2043
|
+
_this.transport = transport;
|
2044
|
+
_this.activityTimeout = transport.activityTimeout;
|
2045
|
+
_this.bindListeners();
|
2046
|
+
return _this;
|
2047
|
+
}
|
2048
|
+
Connection.prototype.handlesActivityChecks = function () {
|
2049
|
+
return this.transport.handlesActivityChecks();
|
2050
|
+
};
|
2051
|
+
Connection.prototype.send = function (data) {
|
2052
|
+
return this.transport.send(data);
|
2053
|
+
};
|
2054
|
+
Connection.prototype.send_event = function (name, data, channel) {
|
2055
|
+
var event = { event: name, data: data };
|
2056
|
+
if (channel) {
|
2057
|
+
event.channel = channel;
|
2058
|
+
}
|
2059
|
+
logger.debug('Event sent', event);
|
2060
|
+
return this.send(protocol_protocol.encodeMessage(event));
|
2061
|
+
};
|
2062
|
+
Connection.prototype.ping = function () {
|
2063
|
+
if (this.transport.supportsPing()) {
|
2064
|
+
this.transport.ping();
|
2065
|
+
}
|
2066
|
+
else {
|
2067
|
+
this.send_event('pusher:ping', {});
|
2068
|
+
}
|
2069
|
+
};
|
2070
|
+
Connection.prototype.close = function () {
|
2071
|
+
this.transport.close();
|
2072
|
+
};
|
2073
|
+
Connection.prototype.bindListeners = function () {
|
2074
|
+
var _this = this;
|
2075
|
+
var listeners = {
|
2076
|
+
message: function (messageEvent) {
|
2077
|
+
var pusherEvent;
|
2078
|
+
try {
|
2079
|
+
pusherEvent = protocol_protocol.decodeMessage(messageEvent);
|
2080
|
+
}
|
2081
|
+
catch (e) {
|
2082
|
+
_this.emit('error', {
|
2083
|
+
type: 'MessageParseError',
|
2084
|
+
error: e,
|
2085
|
+
data: messageEvent.data
|
2086
|
+
});
|
2087
|
+
}
|
2088
|
+
if (pusherEvent !== undefined) {
|
2089
|
+
logger.debug('Event recd', pusherEvent);
|
2090
|
+
switch (pusherEvent.event) {
|
2091
|
+
case 'pusher:error':
|
2092
|
+
_this.emit('error', {
|
2093
|
+
type: 'PusherError',
|
2094
|
+
data: pusherEvent.data
|
2095
|
+
});
|
2096
|
+
break;
|
2097
|
+
case 'pusher:ping':
|
2098
|
+
_this.emit('ping');
|
2099
|
+
break;
|
2100
|
+
case 'pusher:pong':
|
2101
|
+
_this.emit('pong');
|
2102
|
+
break;
|
2103
|
+
}
|
2104
|
+
_this.emit('message', pusherEvent);
|
2105
|
+
}
|
2106
|
+
},
|
2107
|
+
activity: function () {
|
2108
|
+
_this.emit('activity');
|
2109
|
+
},
|
2110
|
+
error: function (error) {
|
2111
|
+
_this.emit('error', error);
|
2112
|
+
},
|
2113
|
+
closed: function (closeEvent) {
|
2114
|
+
unbindListeners();
|
2115
|
+
if (closeEvent && closeEvent.code) {
|
2116
|
+
_this.handleCloseEvent(closeEvent);
|
2117
|
+
}
|
2118
|
+
_this.transport = null;
|
2119
|
+
_this.emit('closed');
|
2120
|
+
}
|
2121
|
+
};
|
2122
|
+
var unbindListeners = function () {
|
2123
|
+
objectApply(listeners, function (listener, event) {
|
2124
|
+
_this.transport.unbind(event, listener);
|
2125
|
+
});
|
2126
|
+
};
|
2127
|
+
objectApply(listeners, function (listener, event) {
|
2128
|
+
_this.transport.bind(event, listener);
|
2129
|
+
});
|
2130
|
+
};
|
2131
|
+
Connection.prototype.handleCloseEvent = function (closeEvent) {
|
2132
|
+
var action = protocol_protocol.getCloseAction(closeEvent);
|
2133
|
+
var error = protocol_protocol.getCloseError(closeEvent);
|
2134
|
+
if (error) {
|
2135
|
+
this.emit('error', error);
|
2136
|
+
}
|
2137
|
+
if (action) {
|
2138
|
+
this.emit(action, { action: action, error: error });
|
2139
|
+
}
|
2140
|
+
};
|
2141
|
+
return Connection;
|
2142
|
+
}(dispatcher));
|
2143
|
+
/* harmony default export */ var connection_connection = (connection_Connection);
|
2144
|
+
|
2145
|
+
// CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
|
2146
|
+
|
2147
|
+
|
2148
|
+
|
2149
|
+
var handshake_Handshake = (function () {
|
2150
|
+
function Handshake(transport, callback) {
|
2151
|
+
this.transport = transport;
|
2152
|
+
this.callback = callback;
|
2153
|
+
this.bindListeners();
|
2154
|
+
}
|
2155
|
+
Handshake.prototype.close = function () {
|
2156
|
+
this.unbindListeners();
|
2157
|
+
this.transport.close();
|
2158
|
+
};
|
2159
|
+
Handshake.prototype.bindListeners = function () {
|
2160
|
+
var _this = this;
|
2161
|
+
this.onMessage = function (m) {
|
2162
|
+
_this.unbindListeners();
|
2163
|
+
var result;
|
2164
|
+
try {
|
2165
|
+
result = protocol_protocol.processHandshake(m);
|
2166
|
+
}
|
2167
|
+
catch (e) {
|
2168
|
+
_this.finish('error', { error: e });
|
2169
|
+
_this.transport.close();
|
2170
|
+
return;
|
2171
|
+
}
|
2172
|
+
if (result.action === 'connected') {
|
2173
|
+
_this.finish('connected', {
|
2174
|
+
connection: new connection_connection(result.id, _this.transport),
|
2175
|
+
activityTimeout: result.activityTimeout
|
2176
|
+
});
|
2177
|
+
}
|
2178
|
+
else {
|
2179
|
+
_this.finish(result.action, { error: result.error });
|
2180
|
+
_this.transport.close();
|
2181
|
+
}
|
2182
|
+
};
|
2183
|
+
this.onClosed = function (closeEvent) {
|
2184
|
+
_this.unbindListeners();
|
2185
|
+
var action = protocol_protocol.getCloseAction(closeEvent) || 'backoff';
|
2186
|
+
var error = protocol_protocol.getCloseError(closeEvent);
|
2187
|
+
_this.finish(action, { error: error });
|
2188
|
+
};
|
2189
|
+
this.transport.bind('message', this.onMessage);
|
2190
|
+
this.transport.bind('closed', this.onClosed);
|
2191
|
+
};
|
2192
|
+
Handshake.prototype.unbindListeners = function () {
|
2193
|
+
this.transport.unbind('message', this.onMessage);
|
2194
|
+
this.transport.unbind('closed', this.onClosed);
|
2195
|
+
};
|
2196
|
+
Handshake.prototype.finish = function (action, params) {
|
2197
|
+
this.callback(extend({ transport: this.transport, action: action }, params));
|
2198
|
+
};
|
2199
|
+
return Handshake;
|
2200
|
+
}());
|
2201
|
+
/* harmony default export */ var connection_handshake = (handshake_Handshake);
|
2202
|
+
|
2203
|
+
// CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
|
2204
|
+
|
2205
|
+
var pusher_authorizer_PusherAuthorizer = (function () {
|
2206
|
+
function PusherAuthorizer(channel, options) {
|
2207
|
+
this.channel = channel;
|
2208
|
+
var authTransport = options.authTransport;
|
2209
|
+
if (typeof runtime.getAuthorizers()[authTransport] === 'undefined') {
|
2210
|
+
throw "'" + authTransport + "' is not a recognized auth transport";
|
2211
|
+
}
|
2212
|
+
this.type = authTransport;
|
2213
|
+
this.options = options;
|
2214
|
+
this.authOptions = options.auth || {};
|
2215
|
+
}
|
2216
|
+
PusherAuthorizer.prototype.composeQuery = function (socketId) {
|
2217
|
+
var query = 'socket_id=' +
|
2218
|
+
encodeURIComponent(socketId) +
|
2219
|
+
'&channel_name=' +
|
2220
|
+
encodeURIComponent(this.channel.name);
|
2221
|
+
for (var i in this.authOptions.params) {
|
2222
|
+
query +=
|
2223
|
+
'&' +
|
2224
|
+
encodeURIComponent(i) +
|
2225
|
+
'=' +
|
2226
|
+
encodeURIComponent(this.authOptions.params[i]);
|
2227
|
+
}
|
2228
|
+
return query;
|
2229
|
+
};
|
2230
|
+
PusherAuthorizer.prototype.authorize = function (socketId, callback) {
|
2231
|
+
PusherAuthorizer.authorizers =
|
2232
|
+
PusherAuthorizer.authorizers || runtime.getAuthorizers();
|
2233
|
+
PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
|
2234
|
+
};
|
2235
|
+
return PusherAuthorizer;
|
2236
|
+
}());
|
2237
|
+
/* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
|
2238
|
+
|
2239
|
+
// CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
|
2240
|
+
|
2241
|
+
var timeline_sender_TimelineSender = (function () {
|
2242
|
+
function TimelineSender(timeline, options) {
|
2243
|
+
this.timeline = timeline;
|
2244
|
+
this.options = options || {};
|
2245
|
+
}
|
2246
|
+
TimelineSender.prototype.send = function (useTLS, callback) {
|
2247
|
+
if (this.timeline.isEmpty()) {
|
2248
|
+
return;
|
2249
|
+
}
|
2250
|
+
this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
|
2251
|
+
};
|
2252
|
+
return TimelineSender;
|
2253
|
+
}());
|
2254
|
+
/* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
|
2255
|
+
|
2256
|
+
// CONCATENATED MODULE: ./src/core/channels/channel.ts
|
2257
|
+
var channel_extends = (undefined && undefined.__extends) || (function () {
|
2258
|
+
var extendStatics = function (d, b) {
|
2259
|
+
extendStatics = Object.setPrototypeOf ||
|
2260
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
2261
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
2262
|
+
return extendStatics(d, b);
|
2263
|
+
};
|
2264
|
+
return function (d, b) {
|
2265
|
+
extendStatics(d, b);
|
2266
|
+
function __() { this.constructor = d; }
|
2267
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
2268
|
+
};
|
2269
|
+
})();
|
2270
|
+
|
2271
|
+
|
2272
|
+
|
2273
|
+
|
2274
|
+
|
2275
|
+
var channel_Channel = (function (_super) {
|
2276
|
+
channel_extends(Channel, _super);
|
2277
|
+
function Channel(name, pusher) {
|
2278
|
+
var _this = _super.call(this, function (event, data) {
|
2279
|
+
logger.debug('No callbacks on ' + name + ' for ' + event);
|
2280
|
+
}) || this;
|
2281
|
+
_this.name = name;
|
2282
|
+
_this.pusher = pusher;
|
2283
|
+
_this.subscribed = false;
|
2284
|
+
_this.subscriptionPending = false;
|
2285
|
+
_this.subscriptionCancelled = false;
|
2286
|
+
return _this;
|
2287
|
+
}
|
2288
|
+
Channel.prototype.authorize = function (socketId, callback) {
|
2289
|
+
return callback(null, { auth: '' });
|
2290
|
+
};
|
2291
|
+
Channel.prototype.trigger = function (event, data) {
|
2292
|
+
if (event.indexOf('client-') !== 0) {
|
2293
|
+
throw new BadEventName("Event '" + event + "' does not start with 'client-'");
|
2294
|
+
}
|
2295
|
+
if (!this.subscribed) {
|
2296
|
+
var suffix = url_store.buildLogSuffix('triggeringClientEvents');
|
2297
|
+
logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
|
2298
|
+
}
|
2299
|
+
return this.pusher.send_event(event, data, this.name);
|
2300
|
+
};
|
2301
|
+
Channel.prototype.disconnect = function () {
|
2302
|
+
this.subscribed = false;
|
2303
|
+
this.subscriptionPending = false;
|
2304
|
+
};
|
2305
|
+
Channel.prototype.handleEvent = function (event) {
|
2306
|
+
var eventName = event.event;
|
2307
|
+
var data = event.data;
|
2308
|
+
if (eventName === 'pusher_internal:subscription_succeeded') {
|
2309
|
+
this.handleSubscriptionSucceededEvent(event);
|
2310
|
+
}
|
2311
|
+
else if (eventName.indexOf('pusher_internal:') !== 0) {
|
2312
|
+
var metadata = {};
|
2313
|
+
this.emit(eventName, data, metadata);
|
2314
|
+
}
|
2315
|
+
};
|
2316
|
+
Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
|
2317
|
+
this.subscriptionPending = false;
|
2318
|
+
this.subscribed = true;
|
2319
|
+
if (this.subscriptionCancelled) {
|
2320
|
+
this.pusher.unsubscribe(this.name);
|
2321
|
+
}
|
2322
|
+
else {
|
2323
|
+
this.emit('pusher:subscription_succeeded', event.data);
|
2324
|
+
}
|
2325
|
+
};
|
2326
|
+
Channel.prototype.subscribe = function () {
|
2327
|
+
var _this = this;
|
2328
|
+
if (this.subscribed) {
|
2329
|
+
return;
|
2330
|
+
}
|
2331
|
+
this.subscriptionPending = true;
|
2332
|
+
this.subscriptionCancelled = false;
|
2333
|
+
this.authorize(this.pusher.connection.socket_id, function (error, data) {
|
2334
|
+
if (error) {
|
2335
|
+
logger.error(error.toString());
|
2336
|
+
_this.emit('pusher:subscription_error', Object.assign({}, {
|
2337
|
+
type: 'AuthError',
|
2338
|
+
error: error.message
|
2339
|
+
}, error instanceof HTTPAuthError ? { status: error.status } : {}));
|
2340
|
+
}
|
2341
|
+
else {
|
2342
|
+
_this.pusher.send_event('pusher:subscribe', {
|
2343
|
+
auth: data.auth,
|
2344
|
+
channel_data: data.channel_data,
|
2345
|
+
channel: _this.name
|
2346
|
+
});
|
2347
|
+
}
|
2348
|
+
});
|
2349
|
+
};
|
2350
|
+
Channel.prototype.unsubscribe = function () {
|
2351
|
+
this.subscribed = false;
|
2352
|
+
this.pusher.send_event('pusher:unsubscribe', {
|
2353
|
+
channel: this.name
|
2354
|
+
});
|
2355
|
+
};
|
2356
|
+
Channel.prototype.cancelSubscription = function () {
|
2357
|
+
this.subscriptionCancelled = true;
|
2358
|
+
};
|
2359
|
+
Channel.prototype.reinstateSubscription = function () {
|
2360
|
+
this.subscriptionCancelled = false;
|
2361
|
+
};
|
2362
|
+
return Channel;
|
2363
|
+
}(dispatcher));
|
2364
|
+
/* harmony default export */ var channels_channel = (channel_Channel);
|
2365
|
+
|
2366
|
+
// CONCATENATED MODULE: ./src/core/channels/private_channel.ts
|
2367
|
+
var private_channel_extends = (undefined && undefined.__extends) || (function () {
|
2368
|
+
var extendStatics = function (d, b) {
|
2369
|
+
extendStatics = Object.setPrototypeOf ||
|
2370
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
2371
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
2372
|
+
return extendStatics(d, b);
|
2373
|
+
};
|
2374
|
+
return function (d, b) {
|
2375
|
+
extendStatics(d, b);
|
2376
|
+
function __() { this.constructor = d; }
|
2377
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
2378
|
+
};
|
2379
|
+
})();
|
2380
|
+
|
2381
|
+
|
2382
|
+
var private_channel_PrivateChannel = (function (_super) {
|
2383
|
+
private_channel_extends(PrivateChannel, _super);
|
2384
|
+
function PrivateChannel() {
|
2385
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
2386
|
+
}
|
2387
|
+
PrivateChannel.prototype.authorize = function (socketId, callback) {
|
2388
|
+
var authorizer = factory.createAuthorizer(this, this.pusher.config);
|
2389
|
+
return authorizer.authorize(socketId, callback);
|
2390
|
+
};
|
2391
|
+
return PrivateChannel;
|
2392
|
+
}(channels_channel));
|
2393
|
+
/* harmony default export */ var private_channel = (private_channel_PrivateChannel);
|
2394
|
+
|
2395
|
+
// CONCATENATED MODULE: ./src/core/channels/members.ts
|
2396
|
+
|
2397
|
+
var members_Members = (function () {
|
2398
|
+
function Members() {
|
2399
|
+
this.reset();
|
2400
|
+
}
|
2401
|
+
Members.prototype.get = function (id) {
|
2402
|
+
if (Object.prototype.hasOwnProperty.call(this.members, id)) {
|
2403
|
+
return {
|
2404
|
+
id: id,
|
2405
|
+
info: this.members[id]
|
2406
|
+
};
|
2407
|
+
}
|
2408
|
+
else {
|
2409
|
+
return null;
|
2410
|
+
}
|
2411
|
+
};
|
2412
|
+
Members.prototype.each = function (callback) {
|
2413
|
+
var _this = this;
|
2414
|
+
objectApply(this.members, function (member, id) {
|
2415
|
+
callback(_this.get(id));
|
2416
|
+
});
|
2417
|
+
};
|
2418
|
+
Members.prototype.setMyID = function (id) {
|
2419
|
+
this.myID = id;
|
2420
|
+
};
|
2421
|
+
Members.prototype.onSubscription = function (subscriptionData) {
|
2422
|
+
this.members = subscriptionData.presence.hash;
|
2423
|
+
this.count = subscriptionData.presence.count;
|
2424
|
+
this.me = this.get(this.myID);
|
2425
|
+
};
|
2426
|
+
Members.prototype.addMember = function (memberData) {
|
2427
|
+
if (this.get(memberData.user_id) === null) {
|
2428
|
+
this.count++;
|
2429
|
+
}
|
2430
|
+
this.members[memberData.user_id] = memberData.user_info;
|
2431
|
+
return this.get(memberData.user_id);
|
2432
|
+
};
|
2433
|
+
Members.prototype.removeMember = function (memberData) {
|
2434
|
+
var member = this.get(memberData.user_id);
|
2435
|
+
if (member) {
|
2436
|
+
delete this.members[memberData.user_id];
|
2437
|
+
this.count--;
|
2438
|
+
}
|
2439
|
+
return member;
|
2440
|
+
};
|
2441
|
+
Members.prototype.reset = function () {
|
2442
|
+
this.members = {};
|
2443
|
+
this.count = 0;
|
2444
|
+
this.myID = null;
|
2445
|
+
this.me = null;
|
2446
|
+
};
|
2447
|
+
return Members;
|
2448
|
+
}());
|
2449
|
+
/* harmony default export */ var members = (members_Members);
|
2450
|
+
|
2451
|
+
// CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
|
2452
|
+
var presence_channel_extends = (undefined && undefined.__extends) || (function () {
|
2453
|
+
var extendStatics = function (d, b) {
|
2454
|
+
extendStatics = Object.setPrototypeOf ||
|
2455
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
2456
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
2457
|
+
return extendStatics(d, b);
|
2458
|
+
};
|
2459
|
+
return function (d, b) {
|
2460
|
+
extendStatics(d, b);
|
2461
|
+
function __() { this.constructor = d; }
|
2462
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
2463
|
+
};
|
2464
|
+
})();
|
2465
|
+
|
2466
|
+
|
2467
|
+
|
2468
|
+
|
2469
|
+
var presence_channel_PresenceChannel = (function (_super) {
|
2470
|
+
presence_channel_extends(PresenceChannel, _super);
|
2471
|
+
function PresenceChannel(name, pusher) {
|
2472
|
+
var _this = _super.call(this, name, pusher) || this;
|
2473
|
+
_this.members = new members();
|
2474
|
+
return _this;
|
2475
|
+
}
|
2476
|
+
PresenceChannel.prototype.authorize = function (socketId, callback) {
|
2477
|
+
var _this = this;
|
2478
|
+
_super.prototype.authorize.call(this, socketId, function (error, authData) {
|
2479
|
+
if (!error) {
|
2480
|
+
authData = authData;
|
2481
|
+
if (authData.channel_data === undefined) {
|
2482
|
+
var suffix = url_store.buildLogSuffix('authenticationEndpoint');
|
2483
|
+
logger.error("Invalid auth response for channel '" + _this.name + "'," +
|
2484
|
+
("expected 'channel_data' field. " + suffix));
|
2485
|
+
callback('Invalid auth response');
|
2486
|
+
return;
|
2487
|
+
}
|
2488
|
+
var channelData = JSON.parse(authData.channel_data);
|
2489
|
+
_this.members.setMyID(channelData.user_id);
|
2490
|
+
}
|
2491
|
+
callback(error, authData);
|
2492
|
+
});
|
2493
|
+
};
|
2494
|
+
PresenceChannel.prototype.handleEvent = function (event) {
|
2495
|
+
var eventName = event.event;
|
2496
|
+
if (eventName.indexOf('pusher_internal:') === 0) {
|
2497
|
+
this.handleInternalEvent(event);
|
2498
|
+
}
|
2499
|
+
else {
|
2500
|
+
var data = event.data;
|
2501
|
+
var metadata = {};
|
2502
|
+
if (event.user_id) {
|
2503
|
+
metadata.user_id = event.user_id;
|
2504
|
+
}
|
2505
|
+
this.emit(eventName, data, metadata);
|
2506
|
+
}
|
2507
|
+
};
|
2508
|
+
PresenceChannel.prototype.handleInternalEvent = function (event) {
|
2509
|
+
var eventName = event.event;
|
2510
|
+
var data = event.data;
|
2511
|
+
switch (eventName) {
|
2512
|
+
case 'pusher_internal:subscription_succeeded':
|
2513
|
+
this.handleSubscriptionSucceededEvent(event);
|
2514
|
+
break;
|
2515
|
+
case 'pusher_internal:member_added':
|
2516
|
+
var addedMember = this.members.addMember(data);
|
2517
|
+
this.emit('pusher:member_added', addedMember);
|
2518
|
+
break;
|
2519
|
+
case 'pusher_internal:member_removed':
|
2520
|
+
var removedMember = this.members.removeMember(data);
|
2521
|
+
if (removedMember) {
|
2522
|
+
this.emit('pusher:member_removed', removedMember);
|
2523
|
+
}
|
2524
|
+
break;
|
2525
|
+
}
|
2526
|
+
};
|
2527
|
+
PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
|
2528
|
+
this.subscriptionPending = false;
|
2529
|
+
this.subscribed = true;
|
2530
|
+
if (this.subscriptionCancelled) {
|
2531
|
+
this.pusher.unsubscribe(this.name);
|
2532
|
+
}
|
2533
|
+
else {
|
2534
|
+
this.members.onSubscription(event.data);
|
2535
|
+
this.emit('pusher:subscription_succeeded', this.members);
|
2536
|
+
}
|
2537
|
+
};
|
2538
|
+
PresenceChannel.prototype.disconnect = function () {
|
2539
|
+
this.members.reset();
|
2540
|
+
_super.prototype.disconnect.call(this);
|
2541
|
+
};
|
2542
|
+
return PresenceChannel;
|
2543
|
+
}(private_channel));
|
2544
|
+
/* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
|
2545
|
+
|
2546
|
+
// EXTERNAL MODULE: ./node_modules/@stablelib/utf8/lib/utf8.js
|
2547
|
+
var utf8 = __webpack_require__(1);
|
2548
|
+
|
2549
|
+
// EXTERNAL MODULE: ./node_modules/@stablelib/base64/lib/base64.js
|
2550
|
+
var base64 = __webpack_require__(0);
|
2551
|
+
|
2552
|
+
// CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
|
2553
|
+
var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
|
2554
|
+
var extendStatics = function (d, b) {
|
2555
|
+
extendStatics = Object.setPrototypeOf ||
|
2556
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
2557
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
2558
|
+
return extendStatics(d, b);
|
2559
|
+
};
|
2560
|
+
return function (d, b) {
|
2561
|
+
extendStatics(d, b);
|
2562
|
+
function __() { this.constructor = d; }
|
2563
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
2564
|
+
};
|
2565
|
+
})();
|
2566
|
+
|
2567
|
+
|
2568
|
+
|
2569
|
+
|
2570
|
+
|
2571
|
+
var encrypted_channel_EncryptedChannel = (function (_super) {
|
2572
|
+
encrypted_channel_extends(EncryptedChannel, _super);
|
2573
|
+
function EncryptedChannel(name, pusher, nacl) {
|
2574
|
+
var _this = _super.call(this, name, pusher) || this;
|
2575
|
+
_this.key = null;
|
2576
|
+
_this.nacl = nacl;
|
2577
|
+
return _this;
|
2578
|
+
}
|
2579
|
+
EncryptedChannel.prototype.authorize = function (socketId, callback) {
|
2580
|
+
var _this = this;
|
2581
|
+
_super.prototype.authorize.call(this, socketId, function (error, authData) {
|
2582
|
+
if (error) {
|
2583
|
+
callback(error, authData);
|
2584
|
+
return;
|
2585
|
+
}
|
2586
|
+
var sharedSecret = authData['shared_secret'];
|
2587
|
+
if (!sharedSecret) {
|
2588
|
+
callback(new Error("No shared_secret key in auth payload for encrypted channel: " + _this.name), null);
|
2589
|
+
return;
|
2590
|
+
}
|
2591
|
+
_this.key = Object(base64["decode"])(sharedSecret);
|
2592
|
+
delete authData['shared_secret'];
|
2593
|
+
callback(null, authData);
|
2594
|
+
});
|
2595
|
+
};
|
2596
|
+
EncryptedChannel.prototype.trigger = function (event, data) {
|
2597
|
+
throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
|
2598
|
+
};
|
2599
|
+
EncryptedChannel.prototype.handleEvent = function (event) {
|
2600
|
+
var eventName = event.event;
|
2601
|
+
var data = event.data;
|
2602
|
+
if (eventName.indexOf('pusher_internal:') === 0 ||
|
2603
|
+
eventName.indexOf('pusher:') === 0) {
|
2604
|
+
_super.prototype.handleEvent.call(this, event);
|
2605
|
+
return;
|
2606
|
+
}
|
2607
|
+
this.handleEncryptedEvent(eventName, data);
|
2608
|
+
};
|
2609
|
+
EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
|
2610
|
+
var _this = this;
|
2611
|
+
if (!this.key) {
|
2612
|
+
logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
|
2613
|
+
return;
|
2614
|
+
}
|
2615
|
+
if (!data.ciphertext || !data.nonce) {
|
2616
|
+
logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' +
|
2617
|
+
data);
|
2618
|
+
return;
|
2619
|
+
}
|
2620
|
+
var cipherText = Object(base64["decode"])(data.ciphertext);
|
2621
|
+
if (cipherText.length < this.nacl.secretbox.overheadLength) {
|
2622
|
+
logger.error("Expected encrypted event ciphertext length to be " + this.nacl.secretbox.overheadLength + ", got: " + cipherText.length);
|
2623
|
+
return;
|
2624
|
+
}
|
2625
|
+
var nonce = Object(base64["decode"])(data.nonce);
|
2626
|
+
if (nonce.length < this.nacl.secretbox.nonceLength) {
|
2627
|
+
logger.error("Expected encrypted event nonce length to be " + this.nacl.secretbox.nonceLength + ", got: " + nonce.length);
|
2628
|
+
return;
|
2629
|
+
}
|
2630
|
+
var bytes = this.nacl.secretbox.open(cipherText, nonce, this.key);
|
2631
|
+
if (bytes === null) {
|
2632
|
+
logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
|
2633
|
+
this.authorize(this.pusher.connection.socket_id, function (error, authData) {
|
2634
|
+
if (error) {
|
2635
|
+
logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
|
2636
|
+
return;
|
2637
|
+
}
|
2638
|
+
bytes = _this.nacl.secretbox.open(cipherText, nonce, _this.key);
|
2639
|
+
if (bytes === null) {
|
2640
|
+
logger.error("Failed to decrypt event with new key. Dropping encrypted event");
|
2641
|
+
return;
|
2642
|
+
}
|
2643
|
+
_this.emit(event, _this.getDataToEmit(bytes));
|
2644
|
+
return;
|
2645
|
+
});
|
2646
|
+
return;
|
2647
|
+
}
|
2648
|
+
this.emit(event, this.getDataToEmit(bytes));
|
2649
|
+
};
|
2650
|
+
EncryptedChannel.prototype.getDataToEmit = function (bytes) {
|
2651
|
+
var raw = Object(utf8["decode"])(bytes);
|
2652
|
+
try {
|
2653
|
+
return JSON.parse(raw);
|
2654
|
+
}
|
2655
|
+
catch (_a) {
|
2656
|
+
return raw;
|
2657
|
+
}
|
2658
|
+
};
|
2659
|
+
return EncryptedChannel;
|
2660
|
+
}(private_channel));
|
2661
|
+
/* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
|
2662
|
+
|
2663
|
+
// CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
|
2664
|
+
var connection_manager_extends = (undefined && undefined.__extends) || (function () {
|
2665
|
+
var extendStatics = function (d, b) {
|
2666
|
+
extendStatics = Object.setPrototypeOf ||
|
2667
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
2668
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
2669
|
+
return extendStatics(d, b);
|
2670
|
+
};
|
2671
|
+
return function (d, b) {
|
2672
|
+
extendStatics(d, b);
|
2673
|
+
function __() { this.constructor = d; }
|
2674
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
2675
|
+
};
|
2676
|
+
})();
|
2677
|
+
|
2678
|
+
|
2679
|
+
|
2680
|
+
|
2681
|
+
|
2682
|
+
var connection_manager_ConnectionManager = (function (_super) {
|
2683
|
+
connection_manager_extends(ConnectionManager, _super);
|
2684
|
+
function ConnectionManager(key, options) {
|
2685
|
+
var _this = _super.call(this) || this;
|
2686
|
+
_this.state = 'initialized';
|
2687
|
+
_this.connection = null;
|
2688
|
+
_this.key = key;
|
2689
|
+
_this.options = options;
|
2690
|
+
_this.timeline = _this.options.timeline;
|
2691
|
+
_this.usingTLS = _this.options.useTLS;
|
2692
|
+
_this.errorCallbacks = _this.buildErrorCallbacks();
|
2693
|
+
_this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
|
2694
|
+
_this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
|
2695
|
+
var Network = runtime.getNetwork();
|
2696
|
+
Network.bind('online', function () {
|
2697
|
+
_this.timeline.info({ netinfo: 'online' });
|
2698
|
+
if (_this.state === 'connecting' || _this.state === 'unavailable') {
|
2699
|
+
_this.retryIn(0);
|
2700
|
+
}
|
2701
|
+
});
|
2702
|
+
Network.bind('offline', function () {
|
2703
|
+
_this.timeline.info({ netinfo: 'offline' });
|
2704
|
+
if (_this.connection) {
|
2705
|
+
_this.sendActivityCheck();
|
2706
|
+
}
|
2707
|
+
});
|
2708
|
+
_this.updateStrategy();
|
2709
|
+
return _this;
|
2710
|
+
}
|
2711
|
+
ConnectionManager.prototype.connect = function () {
|
2712
|
+
if (this.connection || this.runner) {
|
2713
|
+
return;
|
2714
|
+
}
|
2715
|
+
if (!this.strategy.isSupported()) {
|
2716
|
+
this.updateState('failed');
|
2717
|
+
return;
|
2718
|
+
}
|
2719
|
+
this.updateState('connecting');
|
2720
|
+
this.startConnecting();
|
2721
|
+
this.setUnavailableTimer();
|
2722
|
+
};
|
2723
|
+
ConnectionManager.prototype.send = function (data) {
|
2724
|
+
if (this.connection) {
|
2725
|
+
return this.connection.send(data);
|
2726
|
+
}
|
2727
|
+
else {
|
2728
|
+
return false;
|
2729
|
+
}
|
2730
|
+
};
|
2731
|
+
ConnectionManager.prototype.send_event = function (name, data, channel) {
|
2732
|
+
if (this.connection) {
|
2733
|
+
return this.connection.send_event(name, data, channel);
|
2734
|
+
}
|
2735
|
+
else {
|
2736
|
+
return false;
|
2737
|
+
}
|
2738
|
+
};
|
2739
|
+
ConnectionManager.prototype.disconnect = function () {
|
2740
|
+
this.disconnectInternally();
|
2741
|
+
this.updateState('disconnected');
|
2742
|
+
};
|
2743
|
+
ConnectionManager.prototype.isUsingTLS = function () {
|
2744
|
+
return this.usingTLS;
|
2745
|
+
};
|
2746
|
+
ConnectionManager.prototype.startConnecting = function () {
|
2747
|
+
var _this = this;
|
2748
|
+
var callback = function (error, handshake) {
|
2749
|
+
if (error) {
|
2750
|
+
_this.runner = _this.strategy.connect(0, callback);
|
2751
|
+
}
|
2752
|
+
else {
|
2753
|
+
if (handshake.action === 'error') {
|
2754
|
+
_this.emit('error', {
|
2755
|
+
type: 'HandshakeError',
|
2756
|
+
error: handshake.error
|
2757
|
+
});
|
2758
|
+
_this.timeline.error({ handshakeError: handshake.error });
|
2759
|
+
}
|
2760
|
+
else {
|
2761
|
+
_this.abortConnecting();
|
2762
|
+
_this.handshakeCallbacks[handshake.action](handshake);
|
2763
|
+
}
|
2764
|
+
}
|
2765
|
+
};
|
2766
|
+
this.runner = this.strategy.connect(0, callback);
|
2767
|
+
};
|
2768
|
+
ConnectionManager.prototype.abortConnecting = function () {
|
2769
|
+
if (this.runner) {
|
2770
|
+
this.runner.abort();
|
2771
|
+
this.runner = null;
|
2772
|
+
}
|
2773
|
+
};
|
2774
|
+
ConnectionManager.prototype.disconnectInternally = function () {
|
2775
|
+
this.abortConnecting();
|
2776
|
+
this.clearRetryTimer();
|
2777
|
+
this.clearUnavailableTimer();
|
2778
|
+
if (this.connection) {
|
2779
|
+
var connection = this.abandonConnection();
|
2780
|
+
connection.close();
|
2781
|
+
}
|
2782
|
+
};
|
2783
|
+
ConnectionManager.prototype.updateStrategy = function () {
|
2784
|
+
this.strategy = this.options.getStrategy({
|
2785
|
+
key: this.key,
|
2786
|
+
timeline: this.timeline,
|
2787
|
+
useTLS: this.usingTLS
|
2788
|
+
});
|
2789
|
+
};
|
2790
|
+
ConnectionManager.prototype.retryIn = function (delay) {
|
2791
|
+
var _this = this;
|
2792
|
+
this.timeline.info({ action: 'retry', delay: delay });
|
2793
|
+
if (delay > 0) {
|
2794
|
+
this.emit('connecting_in', Math.round(delay / 1000));
|
2795
|
+
}
|
2796
|
+
this.retryTimer = new OneOffTimer(delay || 0, function () {
|
2797
|
+
_this.disconnectInternally();
|
2798
|
+
_this.connect();
|
2799
|
+
});
|
2800
|
+
};
|
2801
|
+
ConnectionManager.prototype.clearRetryTimer = function () {
|
2802
|
+
if (this.retryTimer) {
|
2803
|
+
this.retryTimer.ensureAborted();
|
2804
|
+
this.retryTimer = null;
|
2805
|
+
}
|
2806
|
+
};
|
2807
|
+
ConnectionManager.prototype.setUnavailableTimer = function () {
|
2808
|
+
var _this = this;
|
2809
|
+
this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
|
2810
|
+
_this.updateState('unavailable');
|
2811
|
+
});
|
2812
|
+
};
|
2813
|
+
ConnectionManager.prototype.clearUnavailableTimer = function () {
|
2814
|
+
if (this.unavailableTimer) {
|
2815
|
+
this.unavailableTimer.ensureAborted();
|
2816
|
+
}
|
2817
|
+
};
|
2818
|
+
ConnectionManager.prototype.sendActivityCheck = function () {
|
2819
|
+
var _this = this;
|
2820
|
+
this.stopActivityCheck();
|
2821
|
+
this.connection.ping();
|
2822
|
+
this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
|
2823
|
+
_this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
|
2824
|
+
_this.retryIn(0);
|
2825
|
+
});
|
2826
|
+
};
|
2827
|
+
ConnectionManager.prototype.resetActivityCheck = function () {
|
2828
|
+
var _this = this;
|
2829
|
+
this.stopActivityCheck();
|
2830
|
+
if (this.connection && !this.connection.handlesActivityChecks()) {
|
2831
|
+
this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
|
2832
|
+
_this.sendActivityCheck();
|
2833
|
+
});
|
2834
|
+
}
|
2835
|
+
};
|
2836
|
+
ConnectionManager.prototype.stopActivityCheck = function () {
|
2837
|
+
if (this.activityTimer) {
|
2838
|
+
this.activityTimer.ensureAborted();
|
2839
|
+
}
|
2840
|
+
};
|
2841
|
+
ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
|
2842
|
+
var _this = this;
|
2843
|
+
return extend({}, errorCallbacks, {
|
2844
|
+
message: function (message) {
|
2845
|
+
_this.resetActivityCheck();
|
2846
|
+
_this.emit('message', message);
|
2847
|
+
},
|
2848
|
+
ping: function () {
|
2849
|
+
_this.send_event('pusher:pong', {});
|
2850
|
+
},
|
2851
|
+
activity: function () {
|
2852
|
+
_this.resetActivityCheck();
|
2853
|
+
},
|
2854
|
+
error: function (error) {
|
2855
|
+
_this.emit('error', error);
|
2856
|
+
},
|
2857
|
+
closed: function () {
|
2858
|
+
_this.abandonConnection();
|
2859
|
+
if (_this.shouldRetry()) {
|
2860
|
+
_this.retryIn(1000);
|
2861
|
+
}
|
2862
|
+
}
|
2863
|
+
});
|
2864
|
+
};
|
2865
|
+
ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
|
2866
|
+
var _this = this;
|
2867
|
+
return extend({}, errorCallbacks, {
|
2868
|
+
connected: function (handshake) {
|
2869
|
+
_this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
|
2870
|
+
_this.clearUnavailableTimer();
|
2871
|
+
_this.setConnection(handshake.connection);
|
2872
|
+
_this.socket_id = _this.connection.id;
|
2873
|
+
_this.updateState('connected', { socket_id: _this.socket_id });
|
2874
|
+
}
|
2875
|
+
});
|
2876
|
+
};
|
2877
|
+
ConnectionManager.prototype.buildErrorCallbacks = function () {
|
2878
|
+
var _this = this;
|
2879
|
+
var withErrorEmitted = function (callback) {
|
2880
|
+
return function (result) {
|
2881
|
+
if (result.error) {
|
2882
|
+
_this.emit('error', { type: 'WebSocketError', error: result.error });
|
2883
|
+
}
|
2884
|
+
callback(result);
|
2885
|
+
};
|
2886
|
+
};
|
2887
|
+
return {
|
2888
|
+
tls_only: withErrorEmitted(function () {
|
2889
|
+
_this.usingTLS = true;
|
2890
|
+
_this.updateStrategy();
|
2891
|
+
_this.retryIn(0);
|
2892
|
+
}),
|
2893
|
+
refused: withErrorEmitted(function () {
|
2894
|
+
_this.disconnect();
|
2895
|
+
}),
|
2896
|
+
backoff: withErrorEmitted(function () {
|
2897
|
+
_this.retryIn(1000);
|
2898
|
+
}),
|
2899
|
+
retry: withErrorEmitted(function () {
|
2900
|
+
_this.retryIn(0);
|
2901
|
+
})
|
2902
|
+
};
|
2903
|
+
};
|
2904
|
+
ConnectionManager.prototype.setConnection = function (connection) {
|
2905
|
+
this.connection = connection;
|
2906
|
+
for (var event in this.connectionCallbacks) {
|
2907
|
+
this.connection.bind(event, this.connectionCallbacks[event]);
|
2908
|
+
}
|
2909
|
+
this.resetActivityCheck();
|
2910
|
+
};
|
2911
|
+
ConnectionManager.prototype.abandonConnection = function () {
|
2912
|
+
if (!this.connection) {
|
2913
|
+
return;
|
2914
|
+
}
|
2915
|
+
this.stopActivityCheck();
|
2916
|
+
for (var event in this.connectionCallbacks) {
|
2917
|
+
this.connection.unbind(event, this.connectionCallbacks[event]);
|
2918
|
+
}
|
2919
|
+
var connection = this.connection;
|
2920
|
+
this.connection = null;
|
2921
|
+
return connection;
|
2922
|
+
};
|
2923
|
+
ConnectionManager.prototype.updateState = function (newState, data) {
|
2924
|
+
var previousState = this.state;
|
2925
|
+
this.state = newState;
|
2926
|
+
if (previousState !== newState) {
|
2927
|
+
var newStateDescription = newState;
|
2928
|
+
if (newStateDescription === 'connected') {
|
2929
|
+
newStateDescription += ' with new socket ID ' + data.socket_id;
|
2930
|
+
}
|
2931
|
+
logger.debug('State changed', previousState + ' -> ' + newStateDescription);
|
2932
|
+
this.timeline.info({ state: newState, params: data });
|
2933
|
+
this.emit('state_change', { previous: previousState, current: newState });
|
2934
|
+
this.emit(newState, data);
|
2935
|
+
}
|
2936
|
+
};
|
2937
|
+
ConnectionManager.prototype.shouldRetry = function () {
|
2938
|
+
return this.state === 'connecting' || this.state === 'connected';
|
2939
|
+
};
|
2940
|
+
return ConnectionManager;
|
2941
|
+
}(dispatcher));
|
2942
|
+
/* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
|
2943
|
+
|
2944
|
+
// CONCATENATED MODULE: ./src/core/channels/channels.ts
|
2945
|
+
|
2946
|
+
|
2947
|
+
|
2948
|
+
|
2949
|
+
var channels_Channels = (function () {
|
2950
|
+
function Channels() {
|
2951
|
+
this.channels = {};
|
2952
|
+
}
|
2953
|
+
Channels.prototype.add = function (name, pusher) {
|
2954
|
+
if (!this.channels[name]) {
|
2955
|
+
this.channels[name] = createChannel(name, pusher);
|
2956
|
+
}
|
2957
|
+
return this.channels[name];
|
2958
|
+
};
|
2959
|
+
Channels.prototype.all = function () {
|
2960
|
+
return values(this.channels);
|
2961
|
+
};
|
2962
|
+
Channels.prototype.find = function (name) {
|
2963
|
+
return this.channels[name];
|
2964
|
+
};
|
2965
|
+
Channels.prototype.remove = function (name) {
|
2966
|
+
var channel = this.channels[name];
|
2967
|
+
delete this.channels[name];
|
2968
|
+
return channel;
|
2969
|
+
};
|
2970
|
+
Channels.prototype.disconnect = function () {
|
2971
|
+
objectApply(this.channels, function (channel) {
|
2972
|
+
channel.disconnect();
|
2973
|
+
});
|
2974
|
+
};
|
2975
|
+
return Channels;
|
2976
|
+
}());
|
2977
|
+
/* harmony default export */ var channels = (channels_Channels);
|
2978
|
+
function createChannel(name, pusher) {
|
2979
|
+
if (name.indexOf('private-encrypted-') === 0) {
|
2980
|
+
if (pusher.config.nacl) {
|
2981
|
+
return factory.createEncryptedChannel(name, pusher, pusher.config.nacl);
|
2982
|
+
}
|
2983
|
+
var errMsg = 'Tried to subscribe to a private-encrypted- channel but no nacl implementation available';
|
2984
|
+
var suffix = url_store.buildLogSuffix('encryptedChannelSupport');
|
2985
|
+
throw new UnsupportedFeature(errMsg + ". " + suffix);
|
2986
|
+
}
|
2987
|
+
else if (name.indexOf('private-') === 0) {
|
2988
|
+
return factory.createPrivateChannel(name, pusher);
|
2989
|
+
}
|
2990
|
+
else if (name.indexOf('presence-') === 0) {
|
2991
|
+
return factory.createPresenceChannel(name, pusher);
|
2992
|
+
}
|
2993
|
+
else {
|
2994
|
+
return factory.createChannel(name, pusher);
|
2995
|
+
}
|
2996
|
+
}
|
2997
|
+
|
2998
|
+
// CONCATENATED MODULE: ./src/core/utils/factory.ts
|
2999
|
+
|
3000
|
+
|
3001
|
+
|
3002
|
+
|
3003
|
+
|
3004
|
+
|
3005
|
+
|
3006
|
+
|
3007
|
+
|
3008
|
+
|
3009
|
+
var Factory = {
|
3010
|
+
createChannels: function () {
|
3011
|
+
return new channels();
|
3012
|
+
},
|
3013
|
+
createConnectionManager: function (key, options) {
|
3014
|
+
return new connection_manager(key, options);
|
3015
|
+
},
|
3016
|
+
createChannel: function (name, pusher) {
|
3017
|
+
return new channels_channel(name, pusher);
|
3018
|
+
},
|
3019
|
+
createPrivateChannel: function (name, pusher) {
|
3020
|
+
return new private_channel(name, pusher);
|
3021
|
+
},
|
3022
|
+
createPresenceChannel: function (name, pusher) {
|
3023
|
+
return new presence_channel(name, pusher);
|
3024
|
+
},
|
3025
|
+
createEncryptedChannel: function (name, pusher, nacl) {
|
3026
|
+
return new encrypted_channel(name, pusher, nacl);
|
3027
|
+
},
|
3028
|
+
createTimelineSender: function (timeline, options) {
|
3029
|
+
return new timeline_sender(timeline, options);
|
3030
|
+
},
|
3031
|
+
createAuthorizer: function (channel, options) {
|
3032
|
+
if (options.authorizer) {
|
3033
|
+
return options.authorizer(channel, options);
|
3034
|
+
}
|
3035
|
+
return new pusher_authorizer(channel, options);
|
3036
|
+
},
|
3037
|
+
createHandshake: function (transport, callback) {
|
3038
|
+
return new connection_handshake(transport, callback);
|
3039
|
+
},
|
3040
|
+
createAssistantToTheTransportManager: function (manager, transport, options) {
|
3041
|
+
return new assistant_to_the_transport_manager(manager, transport, options);
|
3042
|
+
}
|
3043
|
+
};
|
3044
|
+
/* harmony default export */ var factory = (Factory);
|
3045
|
+
|
3046
|
+
// CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
|
3047
|
+
|
3048
|
+
var transport_manager_TransportManager = (function () {
|
3049
|
+
function TransportManager(options) {
|
3050
|
+
this.options = options || {};
|
3051
|
+
this.livesLeft = this.options.lives || Infinity;
|
3052
|
+
}
|
3053
|
+
TransportManager.prototype.getAssistant = function (transport) {
|
3054
|
+
return factory.createAssistantToTheTransportManager(this, transport, {
|
3055
|
+
minPingDelay: this.options.minPingDelay,
|
3056
|
+
maxPingDelay: this.options.maxPingDelay
|
3057
|
+
});
|
3058
|
+
};
|
3059
|
+
TransportManager.prototype.isAlive = function () {
|
3060
|
+
return this.livesLeft > 0;
|
3061
|
+
};
|
3062
|
+
TransportManager.prototype.reportDeath = function () {
|
3063
|
+
this.livesLeft -= 1;
|
3064
|
+
};
|
3065
|
+
return TransportManager;
|
3066
|
+
}());
|
3067
|
+
/* harmony default export */ var transport_manager = (transport_manager_TransportManager);
|
3068
|
+
|
3069
|
+
// CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
|
3070
|
+
|
3071
|
+
|
3072
|
+
|
3073
|
+
var sequential_strategy_SequentialStrategy = (function () {
|
3074
|
+
function SequentialStrategy(strategies, options) {
|
3075
|
+
this.strategies = strategies;
|
3076
|
+
this.loop = Boolean(options.loop);
|
3077
|
+
this.failFast = Boolean(options.failFast);
|
3078
|
+
this.timeout = options.timeout;
|
3079
|
+
this.timeoutLimit = options.timeoutLimit;
|
3080
|
+
}
|
3081
|
+
SequentialStrategy.prototype.isSupported = function () {
|
3082
|
+
return any(this.strategies, util.method('isSupported'));
|
3083
|
+
};
|
3084
|
+
SequentialStrategy.prototype.connect = function (minPriority, callback) {
|
3085
|
+
var _this = this;
|
3086
|
+
var strategies = this.strategies;
|
3087
|
+
var current = 0;
|
3088
|
+
var timeout = this.timeout;
|
3089
|
+
var runner = null;
|
3090
|
+
var tryNextStrategy = function (error, handshake) {
|
3091
|
+
if (handshake) {
|
3092
|
+
callback(null, handshake);
|
3093
|
+
}
|
3094
|
+
else {
|
3095
|
+
current = current + 1;
|
3096
|
+
if (_this.loop) {
|
3097
|
+
current = current % strategies.length;
|
3098
|
+
}
|
3099
|
+
if (current < strategies.length) {
|
3100
|
+
if (timeout) {
|
3101
|
+
timeout = timeout * 2;
|
3102
|
+
if (_this.timeoutLimit) {
|
3103
|
+
timeout = Math.min(timeout, _this.timeoutLimit);
|
3104
|
+
}
|
3105
|
+
}
|
3106
|
+
runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
|
3107
|
+
}
|
3108
|
+
else {
|
3109
|
+
callback(true);
|
3110
|
+
}
|
3111
|
+
}
|
3112
|
+
};
|
3113
|
+
runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
|
3114
|
+
return {
|
3115
|
+
abort: function () {
|
3116
|
+
runner.abort();
|
3117
|
+
},
|
3118
|
+
forceMinPriority: function (p) {
|
3119
|
+
minPriority = p;
|
3120
|
+
if (runner) {
|
3121
|
+
runner.forceMinPriority(p);
|
3122
|
+
}
|
3123
|
+
}
|
3124
|
+
};
|
3125
|
+
};
|
3126
|
+
SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
|
3127
|
+
var timer = null;
|
3128
|
+
var runner = null;
|
3129
|
+
if (options.timeout > 0) {
|
3130
|
+
timer = new OneOffTimer(options.timeout, function () {
|
3131
|
+
runner.abort();
|
3132
|
+
callback(true);
|
3133
|
+
});
|
3134
|
+
}
|
3135
|
+
runner = strategy.connect(minPriority, function (error, handshake) {
|
3136
|
+
if (error && timer && timer.isRunning() && !options.failFast) {
|
3137
|
+
return;
|
3138
|
+
}
|
3139
|
+
if (timer) {
|
3140
|
+
timer.ensureAborted();
|
3141
|
+
}
|
3142
|
+
callback(error, handshake);
|
3143
|
+
});
|
3144
|
+
return {
|
3145
|
+
abort: function () {
|
3146
|
+
if (timer) {
|
3147
|
+
timer.ensureAborted();
|
3148
|
+
}
|
3149
|
+
runner.abort();
|
3150
|
+
},
|
3151
|
+
forceMinPriority: function (p) {
|
3152
|
+
runner.forceMinPriority(p);
|
3153
|
+
}
|
3154
|
+
};
|
3155
|
+
};
|
3156
|
+
return SequentialStrategy;
|
3157
|
+
}());
|
3158
|
+
/* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
|
3159
|
+
|
3160
|
+
// CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
|
3161
|
+
|
3162
|
+
|
3163
|
+
var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
|
3164
|
+
function BestConnectedEverStrategy(strategies) {
|
3165
|
+
this.strategies = strategies;
|
3166
|
+
}
|
3167
|
+
BestConnectedEverStrategy.prototype.isSupported = function () {
|
3168
|
+
return any(this.strategies, util.method('isSupported'));
|
3169
|
+
};
|
3170
|
+
BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
|
3171
|
+
return connect(this.strategies, minPriority, function (i, runners) {
|
3172
|
+
return function (error, handshake) {
|
3173
|
+
runners[i].error = error;
|
3174
|
+
if (error) {
|
3175
|
+
if (allRunnersFailed(runners)) {
|
3176
|
+
callback(true);
|
3177
|
+
}
|
3178
|
+
return;
|
3179
|
+
}
|
3180
|
+
apply(runners, function (runner) {
|
3181
|
+
runner.forceMinPriority(handshake.transport.priority);
|
3182
|
+
});
|
3183
|
+
callback(null, handshake);
|
3184
|
+
};
|
3185
|
+
});
|
3186
|
+
};
|
3187
|
+
return BestConnectedEverStrategy;
|
3188
|
+
}());
|
3189
|
+
/* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
|
3190
|
+
function connect(strategies, minPriority, callbackBuilder) {
|
3191
|
+
var runners = map(strategies, function (strategy, i, _, rs) {
|
3192
|
+
return strategy.connect(minPriority, callbackBuilder(i, rs));
|
3193
|
+
});
|
3194
|
+
return {
|
3195
|
+
abort: function () {
|
3196
|
+
apply(runners, abortRunner);
|
3197
|
+
},
|
3198
|
+
forceMinPriority: function (p) {
|
3199
|
+
apply(runners, function (runner) {
|
3200
|
+
runner.forceMinPriority(p);
|
3201
|
+
});
|
3202
|
+
}
|
3203
|
+
};
|
3204
|
+
}
|
3205
|
+
function allRunnersFailed(runners) {
|
3206
|
+
return collections_all(runners, function (runner) {
|
3207
|
+
return Boolean(runner.error);
|
3208
|
+
});
|
3209
|
+
}
|
3210
|
+
function abortRunner(runner) {
|
3211
|
+
if (!runner.error && !runner.aborted) {
|
3212
|
+
runner.abort();
|
3213
|
+
runner.aborted = true;
|
3214
|
+
}
|
3215
|
+
}
|
3216
|
+
|
3217
|
+
// CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
|
3218
|
+
|
3219
|
+
|
3220
|
+
|
3221
|
+
|
3222
|
+
var cached_strategy_CachedStrategy = (function () {
|
3223
|
+
function CachedStrategy(strategy, transports, options) {
|
3224
|
+
this.strategy = strategy;
|
3225
|
+
this.transports = transports;
|
3226
|
+
this.ttl = options.ttl || 1800 * 1000;
|
3227
|
+
this.usingTLS = options.useTLS;
|
3228
|
+
this.timeline = options.timeline;
|
3229
|
+
}
|
3230
|
+
CachedStrategy.prototype.isSupported = function () {
|
3231
|
+
return this.strategy.isSupported();
|
3232
|
+
};
|
3233
|
+
CachedStrategy.prototype.connect = function (minPriority, callback) {
|
3234
|
+
var usingTLS = this.usingTLS;
|
3235
|
+
var info = fetchTransportCache(usingTLS);
|
3236
|
+
var strategies = [this.strategy];
|
3237
|
+
if (info && info.timestamp + this.ttl >= util.now()) {
|
3238
|
+
var transport = this.transports[info.transport];
|
3239
|
+
if (transport) {
|
3240
|
+
this.timeline.info({
|
3241
|
+
cached: true,
|
3242
|
+
transport: info.transport,
|
3243
|
+
latency: info.latency
|
3244
|
+
});
|
3245
|
+
strategies.push(new sequential_strategy([transport], {
|
3246
|
+
timeout: info.latency * 2 + 1000,
|
3247
|
+
failFast: true
|
3248
|
+
}));
|
3249
|
+
}
|
3250
|
+
}
|
3251
|
+
var startTimestamp = util.now();
|
3252
|
+
var runner = strategies
|
3253
|
+
.pop()
|
3254
|
+
.connect(minPriority, function cb(error, handshake) {
|
3255
|
+
if (error) {
|
3256
|
+
flushTransportCache(usingTLS);
|
3257
|
+
if (strategies.length > 0) {
|
3258
|
+
startTimestamp = util.now();
|
3259
|
+
runner = strategies.pop().connect(minPriority, cb);
|
3260
|
+
}
|
3261
|
+
else {
|
3262
|
+
callback(error);
|
3263
|
+
}
|
3264
|
+
}
|
3265
|
+
else {
|
3266
|
+
storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
|
3267
|
+
callback(null, handshake);
|
3268
|
+
}
|
3269
|
+
});
|
3270
|
+
return {
|
3271
|
+
abort: function () {
|
3272
|
+
runner.abort();
|
3273
|
+
},
|
3274
|
+
forceMinPriority: function (p) {
|
3275
|
+
minPriority = p;
|
3276
|
+
if (runner) {
|
3277
|
+
runner.forceMinPriority(p);
|
3278
|
+
}
|
3279
|
+
}
|
3280
|
+
};
|
3281
|
+
};
|
3282
|
+
return CachedStrategy;
|
3283
|
+
}());
|
3284
|
+
/* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
|
3285
|
+
function getTransportCacheKey(usingTLS) {
|
3286
|
+
return 'pusherTransport' + (usingTLS ? 'TLS' : 'NonTLS');
|
3287
|
+
}
|
3288
|
+
function fetchTransportCache(usingTLS) {
|
3289
|
+
var storage = runtime.getLocalStorage();
|
3290
|
+
if (storage) {
|
3291
|
+
try {
|
3292
|
+
var serializedCache = storage[getTransportCacheKey(usingTLS)];
|
3293
|
+
if (serializedCache) {
|
3294
|
+
return JSON.parse(serializedCache);
|
3295
|
+
}
|
3296
|
+
}
|
3297
|
+
catch (e) {
|
3298
|
+
flushTransportCache(usingTLS);
|
3299
|
+
}
|
3300
|
+
}
|
3301
|
+
return null;
|
3302
|
+
}
|
3303
|
+
function storeTransportCache(usingTLS, transport, latency) {
|
3304
|
+
var storage = runtime.getLocalStorage();
|
3305
|
+
if (storage) {
|
3306
|
+
try {
|
3307
|
+
storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
|
3308
|
+
timestamp: util.now(),
|
3309
|
+
transport: transport,
|
3310
|
+
latency: latency
|
3311
|
+
});
|
3312
|
+
}
|
3313
|
+
catch (e) {
|
3314
|
+
}
|
3315
|
+
}
|
3316
|
+
}
|
3317
|
+
function flushTransportCache(usingTLS) {
|
3318
|
+
var storage = runtime.getLocalStorage();
|
3319
|
+
if (storage) {
|
3320
|
+
try {
|
3321
|
+
delete storage[getTransportCacheKey(usingTLS)];
|
3322
|
+
}
|
3323
|
+
catch (e) {
|
3324
|
+
}
|
3325
|
+
}
|
3326
|
+
}
|
3327
|
+
|
3328
|
+
// CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
|
3329
|
+
|
3330
|
+
var delayed_strategy_DelayedStrategy = (function () {
|
3331
|
+
function DelayedStrategy(strategy, _a) {
|
3332
|
+
var number = _a.delay;
|
3333
|
+
this.strategy = strategy;
|
3334
|
+
this.options = { delay: number };
|
3335
|
+
}
|
3336
|
+
DelayedStrategy.prototype.isSupported = function () {
|
3337
|
+
return this.strategy.isSupported();
|
3338
|
+
};
|
3339
|
+
DelayedStrategy.prototype.connect = function (minPriority, callback) {
|
3340
|
+
var strategy = this.strategy;
|
3341
|
+
var runner;
|
3342
|
+
var timer = new OneOffTimer(this.options.delay, function () {
|
3343
|
+
runner = strategy.connect(minPriority, callback);
|
3344
|
+
});
|
3345
|
+
return {
|
3346
|
+
abort: function () {
|
3347
|
+
timer.ensureAborted();
|
3348
|
+
if (runner) {
|
3349
|
+
runner.abort();
|
3350
|
+
}
|
3351
|
+
},
|
3352
|
+
forceMinPriority: function (p) {
|
3353
|
+
minPriority = p;
|
3354
|
+
if (runner) {
|
3355
|
+
runner.forceMinPriority(p);
|
3356
|
+
}
|
3357
|
+
}
|
3358
|
+
};
|
3359
|
+
};
|
3360
|
+
return DelayedStrategy;
|
3361
|
+
}());
|
3362
|
+
/* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
|
3363
|
+
|
3364
|
+
// CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
|
3365
|
+
var IfStrategy = (function () {
|
3366
|
+
function IfStrategy(test, trueBranch, falseBranch) {
|
3367
|
+
this.test = test;
|
3368
|
+
this.trueBranch = trueBranch;
|
3369
|
+
this.falseBranch = falseBranch;
|
3370
|
+
}
|
3371
|
+
IfStrategy.prototype.isSupported = function () {
|
3372
|
+
var branch = this.test() ? this.trueBranch : this.falseBranch;
|
3373
|
+
return branch.isSupported();
|
3374
|
+
};
|
3375
|
+
IfStrategy.prototype.connect = function (minPriority, callback) {
|
3376
|
+
var branch = this.test() ? this.trueBranch : this.falseBranch;
|
3377
|
+
return branch.connect(minPriority, callback);
|
3378
|
+
};
|
3379
|
+
return IfStrategy;
|
3380
|
+
}());
|
3381
|
+
/* harmony default export */ var if_strategy = (IfStrategy);
|
3382
|
+
|
3383
|
+
// CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
|
3384
|
+
var FirstConnectedStrategy = (function () {
|
3385
|
+
function FirstConnectedStrategy(strategy) {
|
3386
|
+
this.strategy = strategy;
|
3387
|
+
}
|
3388
|
+
FirstConnectedStrategy.prototype.isSupported = function () {
|
3389
|
+
return this.strategy.isSupported();
|
3390
|
+
};
|
3391
|
+
FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
|
3392
|
+
var runner = this.strategy.connect(minPriority, function (error, handshake) {
|
3393
|
+
if (handshake) {
|
3394
|
+
runner.abort();
|
3395
|
+
}
|
3396
|
+
callback(error, handshake);
|
3397
|
+
});
|
3398
|
+
return runner;
|
3399
|
+
};
|
3400
|
+
return FirstConnectedStrategy;
|
3401
|
+
}());
|
3402
|
+
/* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
|
3403
|
+
|
3404
|
+
// CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
|
3405
|
+
|
3406
|
+
|
3407
|
+
|
3408
|
+
|
3409
|
+
|
3410
|
+
|
3411
|
+
|
3412
|
+
function testSupportsStrategy(strategy) {
|
3413
|
+
return function () {
|
3414
|
+
return strategy.isSupported();
|
3415
|
+
};
|
3416
|
+
}
|
3417
|
+
var getDefaultStrategy = function (config, baseOptions, defineTransport) {
|
3418
|
+
var definedTransports = {};
|
3419
|
+
function defineTransportStrategy(name, type, priority, options, manager) {
|
3420
|
+
var transport = defineTransport(config, name, type, priority, options, manager);
|
3421
|
+
definedTransports[name] = transport;
|
3422
|
+
return transport;
|
3423
|
+
}
|
3424
|
+
var ws_options = Object.assign({}, baseOptions, {
|
3425
|
+
hostNonTLS: config.wsHost + ':' + config.wsPort,
|
3426
|
+
hostTLS: config.wsHost + ':' + config.wssPort,
|
3427
|
+
httpPath: config.wsPath
|
3428
|
+
});
|
3429
|
+
var wss_options = Object.assign({}, ws_options, {
|
3430
|
+
useTLS: true
|
3431
|
+
});
|
3432
|
+
var sockjs_options = Object.assign({}, baseOptions, {
|
3433
|
+
hostNonTLS: config.httpHost + ':' + config.httpPort,
|
3434
|
+
hostTLS: config.httpHost + ':' + config.httpsPort,
|
3435
|
+
httpPath: config.httpPath
|
3436
|
+
});
|
3437
|
+
var timeouts = {
|
3438
|
+
loop: true,
|
3439
|
+
timeout: 15000,
|
3440
|
+
timeoutLimit: 60000
|
3441
|
+
};
|
3442
|
+
var ws_manager = new transport_manager({
|
3443
|
+
lives: 2,
|
3444
|
+
minPingDelay: 10000,
|
3445
|
+
maxPingDelay: config.activityTimeout
|
3446
|
+
});
|
3447
|
+
var streaming_manager = new transport_manager({
|
3448
|
+
lives: 2,
|
3449
|
+
minPingDelay: 10000,
|
3450
|
+
maxPingDelay: config.activityTimeout
|
3451
|
+
});
|
3452
|
+
var ws_transport = defineTransportStrategy('ws', 'ws', 3, ws_options, ws_manager);
|
3453
|
+
var wss_transport = defineTransportStrategy('wss', 'ws', 3, wss_options, ws_manager);
|
3454
|
+
var sockjs_transport = defineTransportStrategy('sockjs', 'sockjs', 1, sockjs_options);
|
3455
|
+
var xhr_streaming_transport = defineTransportStrategy('xhr_streaming', 'xhr_streaming', 1, sockjs_options, streaming_manager);
|
3456
|
+
var xdr_streaming_transport = defineTransportStrategy('xdr_streaming', 'xdr_streaming', 1, sockjs_options, streaming_manager);
|
3457
|
+
var xhr_polling_transport = defineTransportStrategy('xhr_polling', 'xhr_polling', 1, sockjs_options);
|
3458
|
+
var xdr_polling_transport = defineTransportStrategy('xdr_polling', 'xdr_polling', 1, sockjs_options);
|
3459
|
+
var ws_loop = new sequential_strategy([ws_transport], timeouts);
|
3460
|
+
var wss_loop = new sequential_strategy([wss_transport], timeouts);
|
3461
|
+
var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
|
3462
|
+
var streaming_loop = new sequential_strategy([
|
3463
|
+
new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)
|
3464
|
+
], timeouts);
|
3465
|
+
var polling_loop = new sequential_strategy([
|
3466
|
+
new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)
|
3467
|
+
], timeouts);
|
3468
|
+
var http_loop = new sequential_strategy([
|
3469
|
+
new if_strategy(testSupportsStrategy(streaming_loop), new best_connected_ever_strategy([
|
3470
|
+
streaming_loop,
|
3471
|
+
new delayed_strategy(polling_loop, { delay: 4000 })
|
3472
|
+
]), polling_loop)
|
3473
|
+
], timeouts);
|
3474
|
+
var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
|
3475
|
+
var wsStrategy;
|
3476
|
+
if (baseOptions.useTLS) {
|
3477
|
+
wsStrategy = new best_connected_ever_strategy([
|
3478
|
+
ws_loop,
|
3479
|
+
new delayed_strategy(http_fallback_loop, { delay: 2000 })
|
3480
|
+
]);
|
3481
|
+
}
|
3482
|
+
else {
|
3483
|
+
wsStrategy = new best_connected_ever_strategy([
|
3484
|
+
ws_loop,
|
3485
|
+
new delayed_strategy(wss_loop, { delay: 2000 }),
|
3486
|
+
new delayed_strategy(http_fallback_loop, { delay: 5000 })
|
3487
|
+
]);
|
3488
|
+
}
|
3489
|
+
return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
|
3490
|
+
ttl: 1800000,
|
3491
|
+
timeline: baseOptions.timeline,
|
3492
|
+
useTLS: baseOptions.useTLS
|
3493
|
+
});
|
3494
|
+
};
|
3495
|
+
/* harmony default export */ var default_strategy = (getDefaultStrategy);
|
3496
|
+
|
3497
|
+
// CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
|
3498
|
+
|
3499
|
+
/* harmony default export */ var transport_connection_initializer = (function () {
|
3500
|
+
var self = this;
|
3501
|
+
self.timeline.info(self.buildTimelineMessage({
|
3502
|
+
transport: self.name + (self.options.useTLS ? 's' : '')
|
3503
|
+
}));
|
3504
|
+
if (self.hooks.isInitialized()) {
|
3505
|
+
self.changeState('initialized');
|
3506
|
+
}
|
3507
|
+
else if (self.hooks.file) {
|
3508
|
+
self.changeState('initializing');
|
3509
|
+
Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
|
3510
|
+
if (self.hooks.isInitialized()) {
|
3511
|
+
self.changeState('initialized');
|
3512
|
+
callback(true);
|
3513
|
+
}
|
3514
|
+
else {
|
3515
|
+
if (error) {
|
3516
|
+
self.onError(error);
|
3517
|
+
}
|
3518
|
+
self.onClose();
|
3519
|
+
callback(false);
|
3520
|
+
}
|
3521
|
+
});
|
3522
|
+
}
|
3523
|
+
else {
|
3524
|
+
self.onClose();
|
3525
|
+
}
|
3526
|
+
});
|
3527
|
+
|
3528
|
+
// CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
|
3529
|
+
|
3530
|
+
var http_xdomain_request_hooks = {
|
3531
|
+
getRequest: function (socket) {
|
3532
|
+
var xdr = new window.XDomainRequest();
|
3533
|
+
xdr.ontimeout = function () {
|
3534
|
+
socket.emit('error', new RequestTimedOut());
|
3535
|
+
socket.close();
|
3536
|
+
};
|
3537
|
+
xdr.onerror = function (e) {
|
3538
|
+
socket.emit('error', e);
|
3539
|
+
socket.close();
|
3540
|
+
};
|
3541
|
+
xdr.onprogress = function () {
|
3542
|
+
if (xdr.responseText && xdr.responseText.length > 0) {
|
3543
|
+
socket.onChunk(200, xdr.responseText);
|
3544
|
+
}
|
3545
|
+
};
|
3546
|
+
xdr.onload = function () {
|
3547
|
+
if (xdr.responseText && xdr.responseText.length > 0) {
|
3548
|
+
socket.onChunk(200, xdr.responseText);
|
3549
|
+
}
|
3550
|
+
socket.emit('finished', 200);
|
3551
|
+
socket.close();
|
3552
|
+
};
|
3553
|
+
return xdr;
|
3554
|
+
},
|
3555
|
+
abortRequest: function (xdr) {
|
3556
|
+
xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
|
3557
|
+
xdr.abort();
|
3558
|
+
}
|
3559
|
+
};
|
3560
|
+
/* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
|
3561
|
+
|
3562
|
+
// CONCATENATED MODULE: ./src/core/http/http_request.ts
|
3563
|
+
var http_request_extends = (undefined && undefined.__extends) || (function () {
|
3564
|
+
var extendStatics = function (d, b) {
|
3565
|
+
extendStatics = Object.setPrototypeOf ||
|
3566
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
3567
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
3568
|
+
return extendStatics(d, b);
|
3569
|
+
};
|
3570
|
+
return function (d, b) {
|
3571
|
+
extendStatics(d, b);
|
3572
|
+
function __() { this.constructor = d; }
|
3573
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
3574
|
+
};
|
3575
|
+
})();
|
3576
|
+
|
3577
|
+
|
3578
|
+
var MAX_BUFFER_LENGTH = 256 * 1024;
|
3579
|
+
var http_request_HTTPRequest = (function (_super) {
|
3580
|
+
http_request_extends(HTTPRequest, _super);
|
3581
|
+
function HTTPRequest(hooks, method, url) {
|
3582
|
+
var _this = _super.call(this) || this;
|
3583
|
+
_this.hooks = hooks;
|
3584
|
+
_this.method = method;
|
3585
|
+
_this.url = url;
|
3586
|
+
return _this;
|
3587
|
+
}
|
3588
|
+
HTTPRequest.prototype.start = function (payload) {
|
3589
|
+
var _this = this;
|
3590
|
+
this.position = 0;
|
3591
|
+
this.xhr = this.hooks.getRequest(this);
|
3592
|
+
this.unloader = function () {
|
3593
|
+
_this.close();
|
3594
|
+
};
|
3595
|
+
runtime.addUnloadListener(this.unloader);
|
3596
|
+
this.xhr.open(this.method, this.url, true);
|
3597
|
+
if (this.xhr.setRequestHeader) {
|
3598
|
+
this.xhr.setRequestHeader('Content-Type', 'application/json');
|
3599
|
+
}
|
3600
|
+
this.xhr.send(payload);
|
3601
|
+
};
|
3602
|
+
HTTPRequest.prototype.close = function () {
|
3603
|
+
if (this.unloader) {
|
3604
|
+
runtime.removeUnloadListener(this.unloader);
|
3605
|
+
this.unloader = null;
|
3606
|
+
}
|
3607
|
+
if (this.xhr) {
|
3608
|
+
this.hooks.abortRequest(this.xhr);
|
3609
|
+
this.xhr = null;
|
3610
|
+
}
|
3611
|
+
};
|
3612
|
+
HTTPRequest.prototype.onChunk = function (status, data) {
|
3613
|
+
while (true) {
|
3614
|
+
var chunk = this.advanceBuffer(data);
|
3615
|
+
if (chunk) {
|
3616
|
+
this.emit('chunk', { status: status, data: chunk });
|
3617
|
+
}
|
3618
|
+
else {
|
3619
|
+
break;
|
3620
|
+
}
|
3621
|
+
}
|
3622
|
+
if (this.isBufferTooLong(data)) {
|
3623
|
+
this.emit('buffer_too_long');
|
3624
|
+
}
|
3625
|
+
};
|
3626
|
+
HTTPRequest.prototype.advanceBuffer = function (buffer) {
|
3627
|
+
var unreadData = buffer.slice(this.position);
|
3628
|
+
var endOfLinePosition = unreadData.indexOf('\n');
|
3629
|
+
if (endOfLinePosition !== -1) {
|
3630
|
+
this.position += endOfLinePosition + 1;
|
3631
|
+
return unreadData.slice(0, endOfLinePosition);
|
3632
|
+
}
|
3633
|
+
else {
|
3634
|
+
return null;
|
3635
|
+
}
|
3636
|
+
};
|
3637
|
+
HTTPRequest.prototype.isBufferTooLong = function (buffer) {
|
3638
|
+
return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
|
3639
|
+
};
|
3640
|
+
return HTTPRequest;
|
3641
|
+
}(dispatcher));
|
3642
|
+
/* harmony default export */ var http_request = (http_request_HTTPRequest);
|
3643
|
+
|
3644
|
+
// CONCATENATED MODULE: ./src/core/http/state.ts
|
3645
|
+
var State;
|
3646
|
+
(function (State) {
|
3647
|
+
State[State["CONNECTING"] = 0] = "CONNECTING";
|
3648
|
+
State[State["OPEN"] = 1] = "OPEN";
|
3649
|
+
State[State["CLOSED"] = 3] = "CLOSED";
|
3650
|
+
})(State || (State = {}));
|
3651
|
+
/* harmony default export */ var state = (State);
|
3652
|
+
|
3653
|
+
// CONCATENATED MODULE: ./src/core/http/http_socket.ts
|
3654
|
+
|
3655
|
+
|
3656
|
+
|
3657
|
+
var autoIncrement = 1;
|
3658
|
+
var http_socket_HTTPSocket = (function () {
|
3659
|
+
function HTTPSocket(hooks, url) {
|
3660
|
+
this.hooks = hooks;
|
3661
|
+
this.session = randomNumber(1000) + '/' + randomString(8);
|
3662
|
+
this.location = getLocation(url);
|
3663
|
+
this.readyState = state.CONNECTING;
|
3664
|
+
this.openStream();
|
3665
|
+
}
|
3666
|
+
HTTPSocket.prototype.send = function (payload) {
|
3667
|
+
return this.sendRaw(JSON.stringify([payload]));
|
3668
|
+
};
|
3669
|
+
HTTPSocket.prototype.ping = function () {
|
3670
|
+
this.hooks.sendHeartbeat(this);
|
3671
|
+
};
|
3672
|
+
HTTPSocket.prototype.close = function (code, reason) {
|
3673
|
+
this.onClose(code, reason, true);
|
3674
|
+
};
|
3675
|
+
HTTPSocket.prototype.sendRaw = function (payload) {
|
3676
|
+
if (this.readyState === state.OPEN) {
|
3677
|
+
try {
|
3678
|
+
runtime.createSocketRequest('POST', getUniqueURL(getSendURL(this.location, this.session))).start(payload);
|
3679
|
+
return true;
|
3680
|
+
}
|
3681
|
+
catch (e) {
|
3682
|
+
return false;
|
3683
|
+
}
|
3684
|
+
}
|
3685
|
+
else {
|
3686
|
+
return false;
|
3687
|
+
}
|
3688
|
+
};
|
3689
|
+
HTTPSocket.prototype.reconnect = function () {
|
3690
|
+
this.closeStream();
|
3691
|
+
this.openStream();
|
3692
|
+
};
|
3693
|
+
HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
|
3694
|
+
this.closeStream();
|
3695
|
+
this.readyState = state.CLOSED;
|
3696
|
+
if (this.onclose) {
|
3697
|
+
this.onclose({
|
3698
|
+
code: code,
|
3699
|
+
reason: reason,
|
3700
|
+
wasClean: wasClean
|
3701
|
+
});
|
3702
|
+
}
|
3703
|
+
};
|
3704
|
+
HTTPSocket.prototype.onChunk = function (chunk) {
|
3705
|
+
if (chunk.status !== 200) {
|
3706
|
+
return;
|
3707
|
+
}
|
3708
|
+
if (this.readyState === state.OPEN) {
|
3709
|
+
this.onActivity();
|
3710
|
+
}
|
3711
|
+
var payload;
|
3712
|
+
var type = chunk.data.slice(0, 1);
|
3713
|
+
switch (type) {
|
3714
|
+
case 'o':
|
3715
|
+
payload = JSON.parse(chunk.data.slice(1) || '{}');
|
3716
|
+
this.onOpen(payload);
|
3717
|
+
break;
|
3718
|
+
case 'a':
|
3719
|
+
payload = JSON.parse(chunk.data.slice(1) || '[]');
|
3720
|
+
for (var i = 0; i < payload.length; i++) {
|
3721
|
+
this.onEvent(payload[i]);
|
3722
|
+
}
|
3723
|
+
break;
|
3724
|
+
case 'm':
|
3725
|
+
payload = JSON.parse(chunk.data.slice(1) || 'null');
|
3726
|
+
this.onEvent(payload);
|
3727
|
+
break;
|
3728
|
+
case 'h':
|
3729
|
+
this.hooks.onHeartbeat(this);
|
3730
|
+
break;
|
3731
|
+
case 'c':
|
3732
|
+
payload = JSON.parse(chunk.data.slice(1) || '[]');
|
3733
|
+
this.onClose(payload[0], payload[1], true);
|
3734
|
+
break;
|
3735
|
+
}
|
3736
|
+
};
|
3737
|
+
HTTPSocket.prototype.onOpen = function (options) {
|
3738
|
+
if (this.readyState === state.CONNECTING) {
|
3739
|
+
if (options && options.hostname) {
|
3740
|
+
this.location.base = replaceHost(this.location.base, options.hostname);
|
3741
|
+
}
|
3742
|
+
this.readyState = state.OPEN;
|
3743
|
+
if (this.onopen) {
|
3744
|
+
this.onopen();
|
3745
|
+
}
|
3746
|
+
}
|
3747
|
+
else {
|
3748
|
+
this.onClose(1006, 'Server lost session', true);
|
3749
|
+
}
|
3750
|
+
};
|
3751
|
+
HTTPSocket.prototype.onEvent = function (event) {
|
3752
|
+
if (this.readyState === state.OPEN && this.onmessage) {
|
3753
|
+
this.onmessage({ data: event });
|
3754
|
+
}
|
3755
|
+
};
|
3756
|
+
HTTPSocket.prototype.onActivity = function () {
|
3757
|
+
if (this.onactivity) {
|
3758
|
+
this.onactivity();
|
3759
|
+
}
|
3760
|
+
};
|
3761
|
+
HTTPSocket.prototype.onError = function (error) {
|
3762
|
+
if (this.onerror) {
|
3763
|
+
this.onerror(error);
|
3764
|
+
}
|
3765
|
+
};
|
3766
|
+
HTTPSocket.prototype.openStream = function () {
|
3767
|
+
var _this = this;
|
3768
|
+
this.stream = runtime.createSocketRequest('POST', getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
|
3769
|
+
this.stream.bind('chunk', function (chunk) {
|
3770
|
+
_this.onChunk(chunk);
|
3771
|
+
});
|
3772
|
+
this.stream.bind('finished', function (status) {
|
3773
|
+
_this.hooks.onFinished(_this, status);
|
3774
|
+
});
|
3775
|
+
this.stream.bind('buffer_too_long', function () {
|
3776
|
+
_this.reconnect();
|
3777
|
+
});
|
3778
|
+
try {
|
3779
|
+
this.stream.start();
|
3780
|
+
}
|
3781
|
+
catch (error) {
|
3782
|
+
util.defer(function () {
|
3783
|
+
_this.onError(error);
|
3784
|
+
_this.onClose(1006, 'Could not start streaming', false);
|
3785
|
+
});
|
3786
|
+
}
|
3787
|
+
};
|
3788
|
+
HTTPSocket.prototype.closeStream = function () {
|
3789
|
+
if (this.stream) {
|
3790
|
+
this.stream.unbind_all();
|
3791
|
+
this.stream.close();
|
3792
|
+
this.stream = null;
|
3793
|
+
}
|
3794
|
+
};
|
3795
|
+
return HTTPSocket;
|
3796
|
+
}());
|
3797
|
+
function getLocation(url) {
|
3798
|
+
var parts = /([^\?]*)\/*(\??.*)/.exec(url);
|
3799
|
+
return {
|
3800
|
+
base: parts[1],
|
3801
|
+
queryString: parts[2]
|
3802
|
+
};
|
3803
|
+
}
|
3804
|
+
function getSendURL(url, session) {
|
3805
|
+
return url.base + '/' + session + '/xhr_send';
|
3806
|
+
}
|
3807
|
+
function getUniqueURL(url) {
|
3808
|
+
var separator = url.indexOf('?') === -1 ? '?' : '&';
|
3809
|
+
return url + separator + 't=' + +new Date() + '&n=' + autoIncrement++;
|
3810
|
+
}
|
3811
|
+
function replaceHost(url, hostname) {
|
3812
|
+
var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
|
3813
|
+
return urlParts[1] + hostname + urlParts[3];
|
3814
|
+
}
|
3815
|
+
function randomNumber(max) {
|
3816
|
+
return Math.floor(Math.random() * max);
|
3817
|
+
}
|
3818
|
+
function randomString(length) {
|
3819
|
+
var result = [];
|
3820
|
+
for (var i = 0; i < length; i++) {
|
3821
|
+
result.push(randomNumber(32).toString(32));
|
3822
|
+
}
|
3823
|
+
return result.join('');
|
3824
|
+
}
|
3825
|
+
/* harmony default export */ var http_socket = (http_socket_HTTPSocket);
|
3826
|
+
|
3827
|
+
// CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
|
3828
|
+
var http_streaming_socket_hooks = {
|
3829
|
+
getReceiveURL: function (url, session) {
|
3830
|
+
return url.base + '/' + session + '/xhr_streaming' + url.queryString;
|
3831
|
+
},
|
3832
|
+
onHeartbeat: function (socket) {
|
3833
|
+
socket.sendRaw('[]');
|
3834
|
+
},
|
3835
|
+
sendHeartbeat: function (socket) {
|
3836
|
+
socket.sendRaw('[]');
|
3837
|
+
},
|
3838
|
+
onFinished: function (socket, status) {
|
3839
|
+
socket.onClose(1006, 'Connection interrupted (' + status + ')', false);
|
3840
|
+
}
|
3841
|
+
};
|
3842
|
+
/* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
|
3843
|
+
|
3844
|
+
// CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
|
3845
|
+
var http_polling_socket_hooks = {
|
3846
|
+
getReceiveURL: function (url, session) {
|
3847
|
+
return url.base + '/' + session + '/xhr' + url.queryString;
|
3848
|
+
},
|
3849
|
+
onHeartbeat: function () {
|
3850
|
+
},
|
3851
|
+
sendHeartbeat: function (socket) {
|
3852
|
+
socket.sendRaw('[]');
|
3853
|
+
},
|
3854
|
+
onFinished: function (socket, status) {
|
3855
|
+
if (status === 200) {
|
3856
|
+
socket.reconnect();
|
3857
|
+
}
|
3858
|
+
else {
|
3859
|
+
socket.onClose(1006, 'Connection interrupted (' + status + ')', false);
|
3860
|
+
}
|
3861
|
+
}
|
3862
|
+
};
|
3863
|
+
/* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
|
3864
|
+
|
3865
|
+
// CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
|
3866
|
+
|
3867
|
+
var http_xhr_request_hooks = {
|
3868
|
+
getRequest: function (socket) {
|
3869
|
+
var Constructor = runtime.getXHRAPI();
|
3870
|
+
var xhr = new Constructor();
|
3871
|
+
xhr.onreadystatechange = xhr.onprogress = function () {
|
3872
|
+
switch (xhr.readyState) {
|
3873
|
+
case 3:
|
3874
|
+
if (xhr.responseText && xhr.responseText.length > 0) {
|
3875
|
+
socket.onChunk(xhr.status, xhr.responseText);
|
3876
|
+
}
|
3877
|
+
break;
|
3878
|
+
case 4:
|
3879
|
+
if (xhr.responseText && xhr.responseText.length > 0) {
|
3880
|
+
socket.onChunk(xhr.status, xhr.responseText);
|
3881
|
+
}
|
3882
|
+
socket.emit('finished', xhr.status);
|
3883
|
+
socket.close();
|
3884
|
+
break;
|
3885
|
+
}
|
3886
|
+
};
|
3887
|
+
return xhr;
|
3888
|
+
},
|
3889
|
+
abortRequest: function (xhr) {
|
3890
|
+
xhr.onreadystatechange = null;
|
3891
|
+
xhr.abort();
|
3892
|
+
}
|
3893
|
+
};
|
3894
|
+
/* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
|
3895
|
+
|
3896
|
+
// CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
|
3897
|
+
|
3898
|
+
|
3899
|
+
|
3900
|
+
|
3901
|
+
|
3902
|
+
var HTTP = {
|
3903
|
+
createStreamingSocket: function (url) {
|
3904
|
+
return this.createSocket(http_streaming_socket, url);
|
3905
|
+
},
|
3906
|
+
createPollingSocket: function (url) {
|
3907
|
+
return this.createSocket(http_polling_socket, url);
|
3908
|
+
},
|
3909
|
+
createSocket: function (hooks, url) {
|
3910
|
+
return new http_socket(hooks, url);
|
3911
|
+
},
|
3912
|
+
createXHR: function (method, url) {
|
3913
|
+
return this.createRequest(http_xhr_request, method, url);
|
3914
|
+
},
|
3915
|
+
createRequest: function (hooks, method, url) {
|
3916
|
+
return new http_request(hooks, method, url);
|
3917
|
+
}
|
3918
|
+
};
|
3919
|
+
/* harmony default export */ var http_http = (HTTP);
|
3920
|
+
|
3921
|
+
// CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
|
3922
|
+
|
3923
|
+
|
3924
|
+
http_http.createXDR = function (method, url) {
|
3925
|
+
return this.createRequest(http_xdomain_request, method, url);
|
3926
|
+
};
|
3927
|
+
/* harmony default export */ var web_http_http = (http_http);
|
3928
|
+
|
3929
|
+
// CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
|
3930
|
+
|
3931
|
+
|
3932
|
+
|
3933
|
+
|
3934
|
+
|
3935
|
+
|
3936
|
+
|
3937
|
+
|
3938
|
+
|
3939
|
+
|
3940
|
+
|
3941
|
+
|
3942
|
+
var Runtime = {
|
3943
|
+
nextAuthCallbackID: 1,
|
3944
|
+
auth_callbacks: {},
|
3945
|
+
ScriptReceivers: ScriptReceivers,
|
3946
|
+
DependenciesReceivers: DependenciesReceivers,
|
3947
|
+
getDefaultStrategy: default_strategy,
|
3948
|
+
Transports: transports_transports,
|
3949
|
+
transportConnectionInitializer: transport_connection_initializer,
|
3950
|
+
HTTPFactory: web_http_http,
|
3951
|
+
TimelineTransport: jsonp_timeline,
|
3952
|
+
getXHRAPI: function () {
|
3953
|
+
return window.XMLHttpRequest;
|
3954
|
+
},
|
3955
|
+
getWebSocketAPI: function () {
|
3956
|
+
return window.WebSocket || window.MozWebSocket;
|
3957
|
+
},
|
3958
|
+
setup: function (PusherClass) {
|
3959
|
+
var _this = this;
|
3960
|
+
window.Pusher = PusherClass;
|
3961
|
+
var initializeOnDocumentBody = function () {
|
3962
|
+
_this.onDocumentBody(PusherClass.ready);
|
3963
|
+
};
|
3964
|
+
if (!window.JSON) {
|
3965
|
+
Dependencies.load('json2', {}, initializeOnDocumentBody);
|
3966
|
+
}
|
3967
|
+
else {
|
3968
|
+
initializeOnDocumentBody();
|
3969
|
+
}
|
3970
|
+
},
|
3971
|
+
getDocument: function () {
|
3972
|
+
return document;
|
3973
|
+
},
|
3974
|
+
getProtocol: function () {
|
3975
|
+
return this.getDocument().location.protocol;
|
3976
|
+
},
|
3977
|
+
getAuthorizers: function () {
|
3978
|
+
return { ajax: xhr_auth, jsonp: jsonp_auth };
|
3979
|
+
},
|
3980
|
+
onDocumentBody: function (callback) {
|
3981
|
+
var _this = this;
|
3982
|
+
if (document.body) {
|
3983
|
+
callback();
|
3984
|
+
}
|
3985
|
+
else {
|
3986
|
+
setTimeout(function () {
|
3987
|
+
_this.onDocumentBody(callback);
|
3988
|
+
}, 0);
|
3989
|
+
}
|
3990
|
+
},
|
3991
|
+
createJSONPRequest: function (url, data) {
|
3992
|
+
return new jsonp_request(url, data);
|
3993
|
+
},
|
3994
|
+
createScriptRequest: function (src) {
|
3995
|
+
return new script_request(src);
|
3996
|
+
},
|
3997
|
+
getLocalStorage: function () {
|
3998
|
+
try {
|
3999
|
+
return window.localStorage;
|
4000
|
+
}
|
4001
|
+
catch (e) {
|
4002
|
+
return undefined;
|
4003
|
+
}
|
4004
|
+
},
|
4005
|
+
createXHR: function () {
|
4006
|
+
if (this.getXHRAPI()) {
|
4007
|
+
return this.createXMLHttpRequest();
|
4008
|
+
}
|
4009
|
+
else {
|
4010
|
+
return this.createMicrosoftXHR();
|
4011
|
+
}
|
4012
|
+
},
|
4013
|
+
createXMLHttpRequest: function () {
|
4014
|
+
var Constructor = this.getXHRAPI();
|
4015
|
+
return new Constructor();
|
4016
|
+
},
|
4017
|
+
createMicrosoftXHR: function () {
|
4018
|
+
return new ActiveXObject('Microsoft.XMLHTTP');
|
4019
|
+
},
|
4020
|
+
getNetwork: function () {
|
4021
|
+
return net_info_Network;
|
4022
|
+
},
|
4023
|
+
createWebSocket: function (url) {
|
4024
|
+
var Constructor = this.getWebSocketAPI();
|
4025
|
+
return new Constructor(url);
|
4026
|
+
},
|
4027
|
+
createSocketRequest: function (method, url) {
|
4028
|
+
if (this.isXHRSupported()) {
|
4029
|
+
return this.HTTPFactory.createXHR(method, url);
|
4030
|
+
}
|
4031
|
+
else if (this.isXDRSupported(url.indexOf('https:') === 0)) {
|
4032
|
+
return this.HTTPFactory.createXDR(method, url);
|
4033
|
+
}
|
4034
|
+
else {
|
4035
|
+
throw 'Cross-origin HTTP requests are not supported';
|
4036
|
+
}
|
4037
|
+
},
|
4038
|
+
isXHRSupported: function () {
|
4039
|
+
var Constructor = this.getXHRAPI();
|
4040
|
+
return (Boolean(Constructor) && new Constructor().withCredentials !== undefined);
|
4041
|
+
},
|
4042
|
+
isXDRSupported: function (useTLS) {
|
4043
|
+
var protocol = useTLS ? 'https:' : 'http:';
|
4044
|
+
var documentProtocol = this.getProtocol();
|
4045
|
+
return (Boolean(window['XDomainRequest']) && documentProtocol === protocol);
|
4046
|
+
},
|
4047
|
+
addUnloadListener: function (listener) {
|
4048
|
+
if (window.addEventListener !== undefined) {
|
4049
|
+
window.addEventListener('unload', listener, false);
|
4050
|
+
}
|
4051
|
+
else if (window.attachEvent !== undefined) {
|
4052
|
+
window.attachEvent('onunload', listener);
|
4053
|
+
}
|
4054
|
+
},
|
4055
|
+
removeUnloadListener: function (listener) {
|
4056
|
+
if (window.addEventListener !== undefined) {
|
4057
|
+
window.removeEventListener('unload', listener, false);
|
4058
|
+
}
|
4059
|
+
else if (window.detachEvent !== undefined) {
|
4060
|
+
window.detachEvent('onunload', listener);
|
4061
|
+
}
|
4062
|
+
}
|
4063
|
+
};
|
4064
|
+
/* harmony default export */ var runtime = (Runtime);
|
4065
|
+
|
4066
|
+
// CONCATENATED MODULE: ./src/core/timeline/level.ts
|
4067
|
+
var TimelineLevel;
|
4068
|
+
(function (TimelineLevel) {
|
4069
|
+
TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
|
4070
|
+
TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
|
4071
|
+
TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
|
4072
|
+
})(TimelineLevel || (TimelineLevel = {}));
|
4073
|
+
/* harmony default export */ var timeline_level = (TimelineLevel);
|
4074
|
+
|
4075
|
+
// CONCATENATED MODULE: ./src/core/timeline/timeline.ts
|
4076
|
+
|
4077
|
+
|
4078
|
+
|
4079
|
+
var timeline_Timeline = (function () {
|
4080
|
+
function Timeline(key, session, options) {
|
4081
|
+
this.key = key;
|
4082
|
+
this.session = session;
|
4083
|
+
this.events = [];
|
4084
|
+
this.options = options || {};
|
4085
|
+
this.sent = 0;
|
4086
|
+
this.uniqueID = 0;
|
4087
|
+
}
|
4088
|
+
Timeline.prototype.log = function (level, event) {
|
4089
|
+
if (level <= this.options.level) {
|
4090
|
+
this.events.push(extend({}, event, { timestamp: util.now() }));
|
4091
|
+
if (this.options.limit && this.events.length > this.options.limit) {
|
4092
|
+
this.events.shift();
|
4093
|
+
}
|
4094
|
+
}
|
4095
|
+
};
|
4096
|
+
Timeline.prototype.error = function (event) {
|
4097
|
+
this.log(timeline_level.ERROR, event);
|
4098
|
+
};
|
4099
|
+
Timeline.prototype.info = function (event) {
|
4100
|
+
this.log(timeline_level.INFO, event);
|
4101
|
+
};
|
4102
|
+
Timeline.prototype.debug = function (event) {
|
4103
|
+
this.log(timeline_level.DEBUG, event);
|
4104
|
+
};
|
4105
|
+
Timeline.prototype.isEmpty = function () {
|
4106
|
+
return this.events.length === 0;
|
4107
|
+
};
|
4108
|
+
Timeline.prototype.send = function (sendfn, callback) {
|
4109
|
+
var _this = this;
|
4110
|
+
var data = extend({
|
4111
|
+
session: this.session,
|
4112
|
+
bundle: this.sent + 1,
|
4113
|
+
key: this.key,
|
4114
|
+
lib: 'js',
|
4115
|
+
version: this.options.version,
|
4116
|
+
cluster: this.options.cluster,
|
4117
|
+
features: this.options.features,
|
4118
|
+
timeline: this.events
|
4119
|
+
}, this.options.params);
|
4120
|
+
this.events = [];
|
4121
|
+
sendfn(data, function (error, result) {
|
4122
|
+
if (!error) {
|
4123
|
+
_this.sent++;
|
4124
|
+
}
|
4125
|
+
if (callback) {
|
4126
|
+
callback(error, result);
|
4127
|
+
}
|
4128
|
+
});
|
4129
|
+
return true;
|
4130
|
+
};
|
4131
|
+
Timeline.prototype.generateUniqueID = function () {
|
4132
|
+
this.uniqueID++;
|
4133
|
+
return this.uniqueID;
|
4134
|
+
};
|
4135
|
+
return Timeline;
|
4136
|
+
}());
|
4137
|
+
/* harmony default export */ var timeline_timeline = (timeline_Timeline);
|
4138
|
+
|
4139
|
+
// CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
|
4140
|
+
|
4141
|
+
|
4142
|
+
|
4143
|
+
|
4144
|
+
var transport_strategy_TransportStrategy = (function () {
|
4145
|
+
function TransportStrategy(name, priority, transport, options) {
|
4146
|
+
this.name = name;
|
4147
|
+
this.priority = priority;
|
4148
|
+
this.transport = transport;
|
4149
|
+
this.options = options || {};
|
4150
|
+
}
|
4151
|
+
TransportStrategy.prototype.isSupported = function () {
|
4152
|
+
return this.transport.isSupported({
|
4153
|
+
useTLS: this.options.useTLS
|
4154
|
+
});
|
4155
|
+
};
|
4156
|
+
TransportStrategy.prototype.connect = function (minPriority, callback) {
|
4157
|
+
var _this = this;
|
4158
|
+
if (!this.isSupported()) {
|
4159
|
+
return failAttempt(new UnsupportedStrategy(), callback);
|
4160
|
+
}
|
4161
|
+
else if (this.priority < minPriority) {
|
4162
|
+
return failAttempt(new TransportPriorityTooLow(), callback);
|
4163
|
+
}
|
4164
|
+
var connected = false;
|
4165
|
+
var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
|
4166
|
+
var handshake = null;
|
4167
|
+
var onInitialized = function () {
|
4168
|
+
transport.unbind('initialized', onInitialized);
|
4169
|
+
transport.connect();
|
4170
|
+
};
|
4171
|
+
var onOpen = function () {
|
4172
|
+
handshake = factory.createHandshake(transport, function (result) {
|
4173
|
+
connected = true;
|
4174
|
+
unbindListeners();
|
4175
|
+
callback(null, result);
|
4176
|
+
});
|
4177
|
+
};
|
4178
|
+
var onError = function (error) {
|
4179
|
+
unbindListeners();
|
4180
|
+
callback(error);
|
4181
|
+
};
|
4182
|
+
var onClosed = function () {
|
4183
|
+
unbindListeners();
|
4184
|
+
var serializedTransport;
|
4185
|
+
serializedTransport = safeJSONStringify(transport);
|
4186
|
+
callback(new TransportClosed(serializedTransport));
|
4187
|
+
};
|
4188
|
+
var unbindListeners = function () {
|
4189
|
+
transport.unbind('initialized', onInitialized);
|
4190
|
+
transport.unbind('open', onOpen);
|
4191
|
+
transport.unbind('error', onError);
|
4192
|
+
transport.unbind('closed', onClosed);
|
4193
|
+
};
|
4194
|
+
transport.bind('initialized', onInitialized);
|
4195
|
+
transport.bind('open', onOpen);
|
4196
|
+
transport.bind('error', onError);
|
4197
|
+
transport.bind('closed', onClosed);
|
4198
|
+
transport.initialize();
|
4199
|
+
return {
|
4200
|
+
abort: function () {
|
4201
|
+
if (connected) {
|
4202
|
+
return;
|
4203
|
+
}
|
4204
|
+
unbindListeners();
|
4205
|
+
if (handshake) {
|
4206
|
+
handshake.close();
|
4207
|
+
}
|
4208
|
+
else {
|
4209
|
+
transport.close();
|
4210
|
+
}
|
4211
|
+
},
|
4212
|
+
forceMinPriority: function (p) {
|
4213
|
+
if (connected) {
|
4214
|
+
return;
|
4215
|
+
}
|
4216
|
+
if (_this.priority < p) {
|
4217
|
+
if (handshake) {
|
4218
|
+
handshake.close();
|
4219
|
+
}
|
4220
|
+
else {
|
4221
|
+
transport.close();
|
4222
|
+
}
|
4223
|
+
}
|
4224
|
+
}
|
4225
|
+
};
|
4226
|
+
};
|
4227
|
+
return TransportStrategy;
|
4228
|
+
}());
|
4229
|
+
/* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
|
4230
|
+
function failAttempt(error, callback) {
|
4231
|
+
util.defer(function () {
|
4232
|
+
callback(error);
|
4233
|
+
});
|
4234
|
+
return {
|
4235
|
+
abort: function () { },
|
4236
|
+
forceMinPriority: function () { }
|
4237
|
+
};
|
4238
|
+
}
|
4239
|
+
|
4240
|
+
// CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
|
4241
|
+
|
4242
|
+
|
4243
|
+
|
4244
|
+
|
4245
|
+
|
4246
|
+
var strategy_builder_Transports = runtime.Transports;
|
4247
|
+
var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
|
4248
|
+
var transportClass = strategy_builder_Transports[type];
|
4249
|
+
if (!transportClass) {
|
4250
|
+
throw new UnsupportedTransport(type);
|
4251
|
+
}
|
4252
|
+
var enabled = (!config.enabledTransports ||
|
4253
|
+
arrayIndexOf(config.enabledTransports, name) !== -1) &&
|
4254
|
+
(!config.disabledTransports ||
|
4255
|
+
arrayIndexOf(config.disabledTransports, name) === -1);
|
4256
|
+
var transport;
|
4257
|
+
if (enabled) {
|
4258
|
+
options = Object.assign({ ignoreNullOrigin: config.ignoreNullOrigin }, options);
|
4259
|
+
transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, options);
|
4260
|
+
}
|
4261
|
+
else {
|
4262
|
+
transport = strategy_builder_UnsupportedStrategy;
|
4263
|
+
}
|
4264
|
+
return transport;
|
4265
|
+
};
|
4266
|
+
var strategy_builder_UnsupportedStrategy = {
|
4267
|
+
isSupported: function () {
|
4268
|
+
return false;
|
4269
|
+
},
|
4270
|
+
connect: function (_, callback) {
|
4271
|
+
var deferred = util.defer(function () {
|
4272
|
+
callback(new UnsupportedStrategy());
|
4273
|
+
});
|
4274
|
+
return {
|
4275
|
+
abort: function () {
|
4276
|
+
deferred.ensureAborted();
|
4277
|
+
},
|
4278
|
+
forceMinPriority: function () { }
|
4279
|
+
};
|
4280
|
+
}
|
4281
|
+
};
|
4282
|
+
|
4283
|
+
// CONCATENATED MODULE: ./src/core/config.ts
|
4284
|
+
|
4285
|
+
|
4286
|
+
function getConfig(opts) {
|
4287
|
+
var config = {
|
4288
|
+
activityTimeout: opts.activityTimeout || defaults.activityTimeout,
|
4289
|
+
authEndpoint: opts.authEndpoint || defaults.authEndpoint,
|
4290
|
+
authTransport: opts.authTransport || defaults.authTransport,
|
4291
|
+
cluster: opts.cluster || defaults.cluster,
|
4292
|
+
httpPath: opts.httpPath || defaults.httpPath,
|
4293
|
+
httpPort: opts.httpPort || defaults.httpPort,
|
4294
|
+
httpsPort: opts.httpsPort || defaults.httpsPort,
|
4295
|
+
pongTimeout: opts.pongTimeout || defaults.pongTimeout,
|
4296
|
+
statsHost: opts.statsHost || defaults.stats_host,
|
4297
|
+
unavailableTimeout: opts.unavailableTimeout || defaults.unavailableTimeout,
|
4298
|
+
wsPath: opts.wsPath || defaults.wsPath,
|
4299
|
+
wsPort: opts.wsPort || defaults.wsPort,
|
4300
|
+
wssPort: opts.wssPort || defaults.wssPort,
|
4301
|
+
enableStats: getEnableStatsConfig(opts),
|
4302
|
+
httpHost: getHttpHost(opts),
|
4303
|
+
useTLS: shouldUseTLS(opts),
|
4304
|
+
wsHost: getWebsocketHost(opts)
|
4305
|
+
};
|
4306
|
+
if ('auth' in opts)
|
4307
|
+
config.auth = opts.auth;
|
4308
|
+
if ('authorizer' in opts)
|
4309
|
+
config.authorizer = opts.authorizer;
|
4310
|
+
if ('disabledTransports' in opts)
|
4311
|
+
config.disabledTransports = opts.disabledTransports;
|
4312
|
+
if ('enabledTransports' in opts)
|
4313
|
+
config.enabledTransports = opts.enabledTransports;
|
4314
|
+
if ('ignoreNullOrigin' in opts)
|
4315
|
+
config.ignoreNullOrigin = opts.ignoreNullOrigin;
|
4316
|
+
if ('timelineParams' in opts)
|
4317
|
+
config.timelineParams = opts.timelineParams;
|
4318
|
+
if ('nacl' in opts) {
|
4319
|
+
config.nacl = opts.nacl;
|
4320
|
+
}
|
4321
|
+
return config;
|
4322
|
+
}
|
4323
|
+
function getHttpHost(opts) {
|
4324
|
+
if (opts.httpHost) {
|
4325
|
+
return opts.httpHost;
|
4326
|
+
}
|
4327
|
+
if (opts.cluster) {
|
4328
|
+
return "sockjs-" + opts.cluster + ".pusher.com";
|
4329
|
+
}
|
4330
|
+
return defaults.httpHost;
|
4331
|
+
}
|
4332
|
+
function getWebsocketHost(opts) {
|
4333
|
+
if (opts.wsHost) {
|
4334
|
+
return opts.wsHost;
|
4335
|
+
}
|
4336
|
+
if (opts.cluster) {
|
4337
|
+
return getWebsocketHostFromCluster(opts.cluster);
|
4338
|
+
}
|
4339
|
+
return getWebsocketHostFromCluster(defaults.cluster);
|
4340
|
+
}
|
4341
|
+
function getWebsocketHostFromCluster(cluster) {
|
4342
|
+
return "ws-" + cluster + ".pusher.com";
|
4343
|
+
}
|
4344
|
+
function shouldUseTLS(opts) {
|
4345
|
+
if (runtime.getProtocol() === 'https:') {
|
4346
|
+
return true;
|
4347
|
+
}
|
4348
|
+
else if (opts.forceTLS === false) {
|
4349
|
+
return false;
|
4350
|
+
}
|
4351
|
+
return true;
|
4352
|
+
}
|
4353
|
+
function getEnableStatsConfig(opts) {
|
4354
|
+
if ('enableStats' in opts) {
|
4355
|
+
return opts.enableStats;
|
4356
|
+
}
|
4357
|
+
if ('disableStats' in opts) {
|
4358
|
+
return !opts.disableStats;
|
4359
|
+
}
|
4360
|
+
return false;
|
4361
|
+
}
|
4362
|
+
|
4363
|
+
// CONCATENATED MODULE: ./src/core/pusher.ts
|
4364
|
+
|
4365
|
+
|
4366
|
+
|
4367
|
+
|
4368
|
+
|
4369
|
+
|
4370
|
+
|
4371
|
+
|
4372
|
+
|
4373
|
+
|
4374
|
+
|
4375
|
+
|
4376
|
+
var pusher_Pusher = (function () {
|
4377
|
+
function Pusher(app_key, options) {
|
4378
|
+
var _this = this;
|
4379
|
+
checkAppKey(app_key);
|
4380
|
+
options = options || {};
|
4381
|
+
if (!options.cluster && !(options.wsHost || options.httpHost)) {
|
4382
|
+
var suffix = url_store.buildLogSuffix('javascriptQuickStart');
|
4383
|
+
logger.warn("You should always specify a cluster when connecting. " + suffix);
|
4384
|
+
}
|
4385
|
+
if ('disableStats' in options) {
|
4386
|
+
logger.warn('The disableStats option is deprecated in favor of enableStats');
|
4387
|
+
}
|
4388
|
+
this.key = app_key;
|
4389
|
+
this.config = getConfig(options);
|
4390
|
+
this.channels = factory.createChannels();
|
4391
|
+
this.global_emitter = new dispatcher();
|
4392
|
+
this.sessionID = Math.floor(Math.random() * 1000000000);
|
4393
|
+
this.timeline = new timeline_timeline(this.key, this.sessionID, {
|
4394
|
+
cluster: this.config.cluster,
|
4395
|
+
features: Pusher.getClientFeatures(),
|
4396
|
+
params: this.config.timelineParams || {},
|
4397
|
+
limit: 50,
|
4398
|
+
level: timeline_level.INFO,
|
4399
|
+
version: defaults.VERSION
|
4400
|
+
});
|
4401
|
+
if (this.config.enableStats) {
|
4402
|
+
this.timelineSender = factory.createTimelineSender(this.timeline, {
|
4403
|
+
host: this.config.statsHost,
|
4404
|
+
path: '/timeline/v2/' + runtime.TimelineTransport.name
|
4405
|
+
});
|
4406
|
+
}
|
4407
|
+
var getStrategy = function (options) {
|
4408
|
+
return runtime.getDefaultStrategy(_this.config, options, strategy_builder_defineTransport);
|
4409
|
+
};
|
4410
|
+
this.connection = factory.createConnectionManager(this.key, {
|
4411
|
+
getStrategy: getStrategy,
|
4412
|
+
timeline: this.timeline,
|
4413
|
+
activityTimeout: this.config.activityTimeout,
|
4414
|
+
pongTimeout: this.config.pongTimeout,
|
4415
|
+
unavailableTimeout: this.config.unavailableTimeout,
|
4416
|
+
useTLS: Boolean(this.config.useTLS)
|
4417
|
+
});
|
4418
|
+
this.connection.bind('connected', function () {
|
4419
|
+
_this.subscribeAll();
|
4420
|
+
if (_this.timelineSender) {
|
4421
|
+
_this.timelineSender.send(_this.connection.isUsingTLS());
|
4422
|
+
}
|
4423
|
+
});
|
4424
|
+
this.connection.bind('message', function (event) {
|
4425
|
+
var eventName = event.event;
|
4426
|
+
var internal = eventName.indexOf('pusher_internal:') === 0;
|
4427
|
+
if (event.channel) {
|
4428
|
+
var channel = _this.channel(event.channel);
|
4429
|
+
if (channel) {
|
4430
|
+
channel.handleEvent(event);
|
4431
|
+
}
|
4432
|
+
}
|
4433
|
+
if (!internal) {
|
4434
|
+
_this.global_emitter.emit(event.event, event.data);
|
4435
|
+
}
|
4436
|
+
});
|
4437
|
+
this.connection.bind('connecting', function () {
|
4438
|
+
_this.channels.disconnect();
|
4439
|
+
});
|
4440
|
+
this.connection.bind('disconnected', function () {
|
4441
|
+
_this.channels.disconnect();
|
4442
|
+
});
|
4443
|
+
this.connection.bind('error', function (err) {
|
4444
|
+
logger.warn(err);
|
4445
|
+
});
|
4446
|
+
Pusher.instances.push(this);
|
4447
|
+
this.timeline.info({ instances: Pusher.instances.length });
|
4448
|
+
if (Pusher.isReady) {
|
4449
|
+
this.connect();
|
4450
|
+
}
|
4451
|
+
}
|
4452
|
+
Pusher.ready = function () {
|
4453
|
+
Pusher.isReady = true;
|
4454
|
+
for (var i = 0, l = Pusher.instances.length; i < l; i++) {
|
4455
|
+
Pusher.instances[i].connect();
|
4456
|
+
}
|
4457
|
+
};
|
4458
|
+
Pusher.getClientFeatures = function () {
|
4459
|
+
return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
|
4460
|
+
return t.isSupported({});
|
4461
|
+
}));
|
4462
|
+
};
|
4463
|
+
Pusher.prototype.channel = function (name) {
|
4464
|
+
return this.channels.find(name);
|
4465
|
+
};
|
4466
|
+
Pusher.prototype.allChannels = function () {
|
4467
|
+
return this.channels.all();
|
4468
|
+
};
|
4469
|
+
Pusher.prototype.connect = function () {
|
4470
|
+
this.connection.connect();
|
4471
|
+
if (this.timelineSender) {
|
4472
|
+
if (!this.timelineSenderTimer) {
|
4473
|
+
var usingTLS = this.connection.isUsingTLS();
|
4474
|
+
var timelineSender = this.timelineSender;
|
4475
|
+
this.timelineSenderTimer = new PeriodicTimer(60000, function () {
|
4476
|
+
timelineSender.send(usingTLS);
|
4477
|
+
});
|
4478
|
+
}
|
4479
|
+
}
|
4480
|
+
};
|
4481
|
+
Pusher.prototype.disconnect = function () {
|
4482
|
+
this.connection.disconnect();
|
4483
|
+
if (this.timelineSenderTimer) {
|
4484
|
+
this.timelineSenderTimer.ensureAborted();
|
4485
|
+
this.timelineSenderTimer = null;
|
4486
|
+
}
|
4487
|
+
};
|
4488
|
+
Pusher.prototype.bind = function (event_name, callback, context) {
|
4489
|
+
this.global_emitter.bind(event_name, callback, context);
|
4490
|
+
return this;
|
4491
|
+
};
|
4492
|
+
Pusher.prototype.unbind = function (event_name, callback, context) {
|
4493
|
+
this.global_emitter.unbind(event_name, callback, context);
|
4494
|
+
return this;
|
4495
|
+
};
|
4496
|
+
Pusher.prototype.bind_global = function (callback) {
|
4497
|
+
this.global_emitter.bind_global(callback);
|
4498
|
+
return this;
|
4499
|
+
};
|
4500
|
+
Pusher.prototype.unbind_global = function (callback) {
|
4501
|
+
this.global_emitter.unbind_global(callback);
|
4502
|
+
return this;
|
4503
|
+
};
|
4504
|
+
Pusher.prototype.unbind_all = function (callback) {
|
4505
|
+
this.global_emitter.unbind_all();
|
4506
|
+
return this;
|
4507
|
+
};
|
4508
|
+
Pusher.prototype.subscribeAll = function () {
|
4509
|
+
var channelName;
|
4510
|
+
for (channelName in this.channels.channels) {
|
4511
|
+
if (this.channels.channels.hasOwnProperty(channelName)) {
|
4512
|
+
this.subscribe(channelName);
|
4513
|
+
}
|
4514
|
+
}
|
4515
|
+
};
|
4516
|
+
Pusher.prototype.subscribe = function (channel_name) {
|
4517
|
+
var channel = this.channels.add(channel_name, this);
|
4518
|
+
if (channel.subscriptionPending && channel.subscriptionCancelled) {
|
4519
|
+
channel.reinstateSubscription();
|
4520
|
+
}
|
4521
|
+
else if (!channel.subscriptionPending &&
|
4522
|
+
this.connection.state === 'connected') {
|
4523
|
+
channel.subscribe();
|
4524
|
+
}
|
4525
|
+
return channel;
|
4526
|
+
};
|
4527
|
+
Pusher.prototype.unsubscribe = function (channel_name) {
|
4528
|
+
var channel = this.channels.find(channel_name);
|
4529
|
+
if (channel && channel.subscriptionPending) {
|
4530
|
+
channel.cancelSubscription();
|
4531
|
+
}
|
4532
|
+
else {
|
4533
|
+
channel = this.channels.remove(channel_name);
|
4534
|
+
if (channel && this.connection.state === 'connected') {
|
4535
|
+
channel.unsubscribe();
|
4536
|
+
}
|
4537
|
+
}
|
4538
|
+
};
|
4539
|
+
Pusher.prototype.send_event = function (event_name, data, channel) {
|
4540
|
+
return this.connection.send_event(event_name, data, channel);
|
4541
|
+
};
|
4542
|
+
Pusher.prototype.shouldUseTLS = function () {
|
4543
|
+
return this.config.useTLS;
|
4544
|
+
};
|
4545
|
+
Pusher.instances = [];
|
4546
|
+
Pusher.isReady = false;
|
4547
|
+
Pusher.logToConsole = false;
|
4548
|
+
Pusher.Runtime = runtime;
|
4549
|
+
Pusher.ScriptReceivers = runtime.ScriptReceivers;
|
4550
|
+
Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
|
4551
|
+
Pusher.auth_callbacks = runtime.auth_callbacks;
|
4552
|
+
return Pusher;
|
4553
|
+
}());
|
4554
|
+
/* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
|
4555
|
+
function checkAppKey(key) {
|
4556
|
+
if (key === null || key === undefined) {
|
4557
|
+
throw 'You must pass your app key when you instantiate Pusher.';
|
4558
|
+
}
|
4559
|
+
}
|
4560
|
+
runtime.setup(pusher_Pusher);
|
4561
|
+
|
4562
|
+
|
4563
|
+
/***/ })
|
4564
|
+
/******/ ]);
|
4565
|
+
});
|