@firebase/webchannel-wrapper 0.10.2 → 0.10.3-canary.02e2518ca

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -70,8 +70,8 @@ var id=/[#\/\?@]/g,kd=/[#\?:]/g,jd=/[#\?]/g,nd=/[#\?@]/g,ld=/#/g;function gd(a,b
70
70
  function rd(a,b){P(a);b=pd(a,b);return a.g.has(b)}n.forEach=function(a,b){P(this);this.g.forEach(function(c,d){c.forEach(function(e){a.call(b,e,d,this)},this)},this)};n.wa=function(){P(this);for(var a=Array.from(this.g.values()),b=Array.from(this.g.keys()),c=[],d=0;d<b.length;d++)for(var e=a[d],h=0;h<e.length;h++)c.push(b[d]);return c};
71
71
  n.ba=function(a){P(this);var b=[];if("string"===typeof a)rd(this,a)&&(b=b.concat(this.g.get(pd(this,a))));else{a=Array.from(this.g.values());for(var c=0;c<a.length;c++)b=b.concat(a[c])}return b};n.set=function(a,b){P(this);this.i=null;a=pd(this,a);rd(this,a)&&(this.h-=this.g.get(a).length);this.g.set(a,[b]);this.h+=1;return this};n.get=function(a,b){if(!a)return b;a=this.ba(a);return 0<a.length?String(a[0]):b};
72
72
  function yc(a,b,c){qd(a,b);0<c.length&&(a.i=null,a.g.set(pd(a,b),xa(c)),a.h+=c.length)}n.toString=function(){if(this.i)return this.i;if(!this.g)return"";for(var a=[],b=Array.from(this.g.keys()),c=0;c<b.length;c++){var d=b[c],e=encodeURIComponent(String(d));d=this.ba(d);for(var h=0;h<d.length;h++){var f=e;""!==d[h]&&(f+="="+encodeURIComponent(String(d[h])));a.push(f)}}return this.i=a.join("&")};function ed(a){var b=new gd;b.i=a.i;a.g&&(b.g=new Map(a.g),b.h=a.h);return b}
73
- function pd(a,b){b=String(b);a.j&&(b=b.toLowerCase());return b}function md(a,b){b&&!a.j&&(P(a),a.i=null,a.g.forEach(function(c,d){var e=d.toLowerCase();d!=e&&(qd(this,d),yc(this,e,c))},a));a.j=b};function sd(a,b){this.g=a;this.map=b};function td(a){this.l=a||ud;w.PerformanceNavigationTiming?(a=w.performance.getEntriesByType("navigation"),a=0<a.length&&("hq"==a[0].nextHopProtocol||"h2"==a[0].nextHopProtocol)):a=!!(w.g&&w.g.Na&&w.g.Na()&&w.g.Na().ic);this.j=a?this.l:1;this.g=null;1<this.j&&(this.g=new Set);this.h=null;this.i=[]}var ud=10;function vd(a){return a.h?!0:a.g?a.g.size>=a.j:!1}function Pc(a){return a.h?1:a.g?a.g.size:0}function Lc(a,b){return a.h?a.h==b:a.g?a.g.has(b):!1}function Qc(a,b){a.g?a.g.add(b):a.h=b}
74
- function Tc(a,b){a.h&&a.h==b?a.h=null:a.g&&a.g.has(b)&&a.g.delete(b)}td.prototype.cancel=function(){this.i=wd(this);if(this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){for(var a=q(this.g.values()),b=a.next();!b.done;b=a.next())b.value.cancel();this.g.clear()}};function wd(a){if(null!=a.h)return a.i.concat(a.h.D);if(null!=a.g&&0!==a.g.size){var b=a.i;a=q(a.g.values());for(var c=a.next();!c.done;c=a.next())b=b.concat(c.value.D);return b}return xa(a.i)};function xd(){}xd.prototype.stringify=function(a){return w.JSON.stringify(a,void 0)};xd.prototype.parse=function(a){return w.JSON.parse(a,void 0)};function yd(){this.g=new xd}function zd(a,b,c){var d=c||"";try{Zc(a,function(e,h){var f=e;na(e)&&(f=vb(e));b.push(d+h+"="+encodeURIComponent(f))})}catch(e){throw b.push(d+"type="+encodeURIComponent("_badmap")),e;}};function Ad(a,b){var c=new Tb;if(w.Image){var d=new Image;d.onload=ta(Bd,c,d,"TestLoadImage: loaded",!0,b);d.onerror=ta(Bd,c,d,"TestLoadImage: error",!1,b);d.onabort=ta(Bd,c,d,"TestLoadImage: abort",!1,b);d.ontimeout=ta(Bd,c,d,"TestLoadImage: timeout",!1,b);w.setTimeout(function(){if(d.ontimeout)d.ontimeout()},1E4);d.src=a}else b(!1)}function Bd(a,b,c,d,e){try{b.onload=null,b.onerror=null,b.onabort=null,b.ontimeout=null,e(d)}catch(h){}};function Cd(a){this.l=a.jc||null;this.j=a.rb||!1}y(Cd,hc);Cd.prototype.g=function(){return new Dd(this.l,this.j)};Cd.prototype.i=function(a){return function(){return a}}({});function Dd(a,b){C.call(this);this.D=a;this.u=b;this.m=void 0;this.readyState=Ed;this.status=0;this.responseType=this.responseText=this.response=this.statusText="";this.onreadystatechange=null;this.v=new Headers;this.h=null;this.C="GET";this.B="";this.g=!1;this.A=this.j=this.l=null}y(Dd,C);var Ed=0;n=Dd.prototype;
73
+ function pd(a,b){b=String(b);a.j&&(b=b.toLowerCase());return b}function md(a,b){b&&!a.j&&(P(a),a.i=null,a.g.forEach(function(c,d){var e=d.toLowerCase();d!=e&&(qd(this,d),yc(this,e,c))},a));a.j=b};function sd(a,b){this.g=a;this.map=b};function td(a){this.l=a||ud;w.PerformanceNavigationTiming?(a=w.performance.getEntriesByType("navigation"),a=0<a.length&&("hq"==a[0].nextHopProtocol||"h2"==a[0].nextHopProtocol)):a=!!(w.g&&w.g.Na&&w.g.Na()&&w.g.Na().hc);this.j=a?this.l:1;this.g=null;1<this.j&&(this.g=new Set);this.h=null;this.i=[]}var ud=10;function vd(a){return a.h?!0:a.g?a.g.size>=a.j:!1}function Pc(a){return a.h?1:a.g?a.g.size:0}function Lc(a,b){return a.h?a.h==b:a.g?a.g.has(b):!1}function Qc(a,b){a.g?a.g.add(b):a.h=b}
74
+ function Tc(a,b){a.h&&a.h==b?a.h=null:a.g&&a.g.has(b)&&a.g.delete(b)}td.prototype.cancel=function(){this.i=wd(this);if(this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){for(var a=q(this.g.values()),b=a.next();!b.done;b=a.next())b.value.cancel();this.g.clear()}};function wd(a){if(null!=a.h)return a.i.concat(a.h.D);if(null!=a.g&&0!==a.g.size){var b=a.i;a=q(a.g.values());for(var c=a.next();!c.done;c=a.next())b=b.concat(c.value.D);return b}return xa(a.i)};function xd(){}xd.prototype.stringify=function(a){return w.JSON.stringify(a,void 0)};xd.prototype.parse=function(a){return w.JSON.parse(a,void 0)};function yd(){this.g=new xd}function zd(a,b,c){var d=c||"";try{Zc(a,function(e,h){var f=e;na(e)&&(f=vb(e));b.push(d+h+"="+encodeURIComponent(f))})}catch(e){throw b.push(d+"type="+encodeURIComponent("_badmap")),e;}};function Ad(a,b){var c=new Tb;if(w.Image){var d=new Image;d.onload=ta(Bd,c,d,"TestLoadImage: loaded",!0,b);d.onerror=ta(Bd,c,d,"TestLoadImage: error",!1,b);d.onabort=ta(Bd,c,d,"TestLoadImage: abort",!1,b);d.ontimeout=ta(Bd,c,d,"TestLoadImage: timeout",!1,b);w.setTimeout(function(){if(d.ontimeout)d.ontimeout()},1E4);d.src=a}else b(!1)}function Bd(a,b,c,d,e){try{b.onload=null,b.onerror=null,b.onabort=null,b.ontimeout=null,e(d)}catch(h){}};function Cd(a){this.l=a.ic||null;this.j=a.rb||!1}y(Cd,hc);Cd.prototype.g=function(){return new Dd(this.l,this.j)};Cd.prototype.i=function(a){return function(){return a}}({});function Dd(a,b){C.call(this);this.D=a;this.u=b;this.m=void 0;this.readyState=Ed;this.status=0;this.responseType=this.responseText=this.response=this.statusText="";this.onreadystatechange=null;this.v=new Headers;this.h=null;this.C="GET";this.B="";this.g=!1;this.A=this.j=this.l=null}y(Dd,C);var Ed=0;n=Dd.prototype;
75
75
  n.open=function(a,b){if(this.readyState!=Ed)throw this.abort(),Error("Error reopening a connection");this.C=a;this.B=b;this.readyState=1;Fd(this)};n.send=function(a){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;var b={headers:this.v,method:this.C,credentials:this.m,cache:void 0};a&&(b.body=a);(this.D||w).fetch(new Request(this.B,b)).then(this.cb.bind(this),this.na.bind(this))};
76
76
  n.abort=function(){this.response=this.responseText="";this.v=new Headers;this.status=0;this.j&&this.j.cancel("Request was aborted.").catch(function(){});1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,Gd(this));this.readyState=Ed};
77
77
  n.cb=function(a){if(this.g&&(this.l=a,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=a.headers,this.readyState=2,Fd(this)),this.g&&(this.readyState=3,Fd(this),this.g)))if("arraybuffer"===this.responseType)a.arrayBuffer().then(this.ab.bind(this),this.na.bind(this));else if("undefined"!==typeof w.ReadableStream&&"body"in a){this.j=a.body.getReader();if(this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=
@@ -87,9 +87,9 @@ function Rd(a){if(a.h&&"undefined"!=typeof goog&&(!a.C[1]||4!=K(a)||2!=a.fa()))i
87
87
  6;try{var f=2<K(a)?a.g.statusText:""}catch(k){f=""}a.j=f+" ["+a.fa()+"]";Pd(a)}}finally{Qd(a)}}}function Qd(a,b){if(a.g){Nd(a);var c=a.g,d=a.C[0]?function(){}:null;a.g=null;a.C=null;b||D(a,"ready");try{c.onreadystatechange=d}catch(e){}}}function Nd(a){a.g&&a.M&&(a.g.ontimeout=null);a.A&&(w.clearTimeout(a.A),a.A=null)}n.isActive=function(){return!!this.g};function K(a){return a.g?a.g.readyState:0}n.fa=function(){try{return 2<K(this)?this.g.status:-1}catch(a){return-1}};
88
88
  n.ma=function(){try{return this.g?this.g.responseText:""}catch(a){return""}};n.Za=function(a){if(this.g){var b=this.g.responseText;a&&0==b.indexOf(a)&&(b=b.substring(a.length));return Id(b)}};function Ac(a){try{if(!a.g)return null;if("response"in a.g)return a.g.response;switch(a.L){case Jd:case "text":return a.g.responseText;case "arraybuffer":if("mozResponseArrayBuffer"in a.g)return a.g.mozResponseArrayBuffer}return null}catch(b){return null}}
89
89
  function Hc(a){var b={};a=(a.g&&2<=K(a)?a.g.getAllResponseHeaders()||"":"").split("\r\n");for(var c=0;c<a.length;c++)if(!Aa(a[c])){var d=Cb(a[c]),e=d[0];d=d[1];if("string"===typeof d){d=d.trim();var h=b[e]||[];b[e]=h;h.push(d)}}$a(b,function(f){return f.join(", ")})}n.La=function(){return this.m};n.Va=function(){return"string"===typeof this.j?this.j:String(this.j)};function Sd(a){var b="";Za(a,function(c,d){b+=d;b+=":";b+=c;b+="\r\n"});return b}function Td(a,b,c){a:{for(d in c){var d=!1;break a}d=!0}d||(c=Sd(c),"string"===typeof a?(encodeURIComponent(String(b)),null!=c&&encodeURIComponent(String(c))):N(a,b,c))};function Ud(a,b,c){return c&&c.internalChannelParams?c.internalChannelParams[a]||b:b}
90
- function Vd(a){this.Ja=0;this.j=[];this.l=new Tb;this.sa=this.za=this.I=this.aa=this.g=this.Ga=this.D=this.qa=this.o=this.W=this.s=null;this.ib=this.Y=0;this.gb=Ud("failFast",!1,a);this.G=this.v=this.u=this.m=this.h=null;this.ca=!0;this.Ia=this.X=-1;this.da=this.A=this.C=0;this.eb=Ud("baseRetryDelayMs",5E3,a);this.kb=Ud("retryDelaySeedMs",1E4,a);this.hb=Ud("forwardChannelMaxRetries",2,a);this.Aa=Ud("forwardChannelRequestTimeoutMs",2E4,a);this.ya=a&&a.xmlHttpFactory||void 0;this.Ka=a&&a.hc||!1;this.M=
91
- void 0;this.J=a&&a.supportsCrossDomainXhr||!1;this.L="";this.i=new td(a&&a.concurrentRequestLimit);this.Ma=new yd;this.R=a&&a.fastHandshake||!1;this.P=a&&a.encodeInitMessageHeaders||!1;this.R&&this.P&&(this.P=!1);this.fb=a&&a.ec||!1;a&&a.Ha&&this.l.Ha();a&&a.forceLongPolling&&(this.ca=!1);this.ea=!this.R&&this.ca&&a&&a.detectBufferingProxy||!1;this.ta=void 0;a&&a.longPollingTimeout&&0<a.longPollingTimeout&&(this.ta=a.longPollingTimeout);this.ra=void 0;this.T=0;this.N=!1;this.pa=this.B=null}n=Vd.prototype;
92
- n.ua=8;n.H=1;function Wc(a){Wd(a);if(3==a.H){var b=a.Y++,c=J(a.I);N(c,"SID",a.L);N(c,"RID",b);N(c,"TYPE","terminate");Xd(a,c);b=new pc(a,a.l,b);b.M=2;b.v=vc(J(c));c=!1;if(w.navigator&&w.navigator.sendBeacon)try{c=w.navigator.sendBeacon(b.v.toString(),"")}catch(d){}!c&&w.Image&&((new Image).src=b.v,c=!0);c||(b.g=zc(b.l,null),b.g.ja(b.v));b.G=Date.now();xc(b)}Yd(a)}function Nc(a){a.g&&(Jc(a),a.g.cancel(),a.g=null)}
90
+ function Vd(a){this.Ja=0;this.j=[];this.l=new Tb;this.sa=this.za=this.I=this.aa=this.g=this.Ga=this.D=this.qa=this.o=this.W=this.s=null;this.ib=this.Y=0;this.gb=Ud("failFast",!1,a);this.G=this.v=this.u=this.m=this.h=null;this.ca=!0;this.Ia=this.X=-1;this.da=this.A=this.C=0;this.eb=Ud("baseRetryDelayMs",5E3,a);this.kb=Ud("retryDelaySeedMs",1E4,a);this.hb=Ud("forwardChannelMaxRetries",2,a);this.Aa=Ud("forwardChannelRequestTimeoutMs",2E4,a);this.ya=a&&a.xmlHttpFactory||void 0;this.Ka=a&&a.useFetchStreams||
91
+ !1;this.M=void 0;this.J=a&&a.supportsCrossDomainXhr||!1;this.L="";this.i=new td(a&&a.concurrentRequestLimit);this.Ma=new yd;this.R=a&&a.fastHandshake||!1;this.P=a&&a.encodeInitMessageHeaders||!1;this.R&&this.P&&(this.P=!1);this.fb=a&&a.ec||!1;a&&a.Ha&&this.l.Ha();a&&a.forceLongPolling&&(this.ca=!1);this.ea=!this.R&&this.ca&&a&&a.detectBufferingProxy||!1;this.ta=void 0;a&&a.longPollingTimeout&&0<a.longPollingTimeout&&(this.ta=a.longPollingTimeout);this.ra=void 0;this.T=0;this.N=!1;this.pa=this.B=null}
92
+ n=Vd.prototype;n.ua=8;n.H=1;function Wc(a){Wd(a);if(3==a.H){var b=a.Y++,c=J(a.I);N(c,"SID",a.L);N(c,"RID",b);N(c,"TYPE","terminate");Xd(a,c);b=new pc(a,a.l,b);b.M=2;b.v=vc(J(c));c=!1;if(w.navigator&&w.navigator.sendBeacon)try{c=w.navigator.sendBeacon(b.v.toString(),"")}catch(d){}!c&&w.Image&&((new Image).src=b.v,c=!0);c||(b.g=zc(b.l,null),b.g.ja(b.v));b.G=Date.now();xc(b)}Yd(a)}function Nc(a){a.g&&(Jc(a),a.g.cancel(),a.g=null)}
93
93
  function Wd(a){Nc(a);a.u&&(w.clearTimeout(a.u),a.u=null);Mc(a);a.i.cancel();a.m&&("number"===typeof a.m&&w.clearTimeout(a.m),a.m=null)}function Vc(a){vd(a.i)||a.m||(a.m=!0,Gb(a.Qa,a),a.C=0)}function Zd(a,b){if(Pc(a.i)>=a.i.j-(a.m?1:0))return!1;if(a.m)return a.j=b.D.concat(a.j),!0;if(1==a.H||2==a.H||a.C>=(a.gb?0:a.hb))return!1;a.m=ec(x(a.Qa,a,b),$d(a,a.C));a.C++;return!0}
94
94
  n.Qa=function(a){if(this.m)if(this.m=null,1==this.H){if(!a){this.Y=Math.floor(1E5*Math.random());a=this.Y++;var b=new pc(this,this.l,a),c=this.s;this.W&&(c?(c=ab(c),cb(c,this.W)):c=this.W);null!==this.o||this.P||(b.I=c,c=null);var d;if(this.R)a:{for(var e=d=0;e<this.j.length;e++){b:{var h=this.j[e];if("__data__"in h.map&&(h=h.map.__data__,"string"===typeof h)){h=h.length;break b}h=void 0}if(void 0===h)break;d+=h;if(4096<d){d=e;break a}if(4096===d||e===this.j.length-1){d=e+1;break a}}d=1E3}else d=
95
95
  1E3;d=ae(this,b,d);e=J(this.I);N(e,"RID",a);N(e,"CVER",22);this.D&&N(e,"X-HTTP-Session-Id",this.D);Xd(this,e);c&&(this.P?d="headers="+encodeURIComponent(String(Sd(c)))+"&"+d:this.o&&Td(e,this.o,c));Qc(this.i,b);this.fb&&N(e,"TYPE","init");this.R?(N(e,"$req",d),N(e,"SID","null"),b.ca=!0,uc(b,e,null)):uc(b,e,d);this.H=2}}else 3==this.H&&(a?be(this,a):0==this.j.length||vd(this.i)||be(this))};