diff --git a/.travis.yml b/.travis.yml index 39a5352..6d319e3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ os: - linux - osx go: - - 1.12.x + - 1.13.x go_import_path: github.com/kataras/neffos install: - go get ./... diff --git a/_examples/protobuf/browser/app.js b/_examples/protobuf/browser/app.js index 524c13f..cc54d33 100644 --- a/_examples/protobuf/browser/app.js +++ b/_examples/protobuf/browser/app.js @@ -6,6 +6,7 @@ var port = document.location.port ? ":" + document.location.port : ""; var wsURL = scheme + "://" + document.location.hostname + port + "/echo"; var outputTxt = document.getElementById("output"); + function addMessage(msg) { outputTxt.innerHTML += msg + "\n"; } @@ -28,7 +29,19 @@ function handleNamespaceConnectedConn(nsConn) { const userMsg = new protos.UserMessage(); userMsg.setUsername(username); userMsg.setText(input); - nsConn.emit("chat", userMsg.serializeBinary()); + + const body = userMsg.serializeBinary() + let msg = new neffos.Message(); + msg.Namespace = "default"; + msg.Event = "chat"; + msg.Body = body; + msg.SetBinary = true; + nsConn.conn.write(msg); + // + // OR: javascript side will check if body is binary, + // and if it's it will convert it to valid utf-8 text before sending. + // To keep the data as they are, please prefer the above commented code (msg.SetBinary = true). + // nsConn.emit("chat", body); addMessage("Me: " + input); }; } @@ -47,9 +60,12 @@ async function runExample() { addMessage("disconnected from namespace: " + msg.Namespace); }, chat: function (nsConn, msg) { // "chat" event. - var serialized = new Uint8Array(msg.Body.split(",")); - const userMsg = protos.UserMessage.deserializeBinary(serialized); + console.log(msg); + const userMsg = protos.UserMessage.deserializeBinary(msg.Body); addMessage(userMsg.getUsername() + ": " + userMsg.getText()); + }, + chat_test: function (nsConn, msg) { + addMessage(new TextDecoder("utf-8").decode(msg.Body)); } } }); diff --git a/_examples/protobuf/browser/bundle.js b/_examples/protobuf/browser/bundle.js index 1c8b01c..ad6d037 100644 --- a/_examples/protobuf/browser/bundle.js +++ b/_examples/protobuf/browser/bundle.js @@ -1,6 +1,6 @@ -(function(){function s(d,e,r){function t(o,i){if(!e[o]){if(!d[o]){var l="function"==typeof require&&require;if(!i&&l)return l(o,!0);if(n)return n(o,!0);var g=new Error("Cannot find module '"+o+"'");throw g.code="MODULE_NOT_FOUND",g}var a=e[o]={exports:{}};d[o][0].call(a.exports,function(e){var r=d[o][1][e];return t(r||e)},a,a.exports,s,d,e,r)}return e[o].exports}for(var n="function"==typeof require&&require,a=0;a>16,d[l++]=255&t>>8,d[l++]=255&t;return 2===o&&(t=g[e.charCodeAt(u)]<<2|g[e.charCodeAt(u+1)]>>4,d[l++]=255&t),1===o&&(t=g[e.charCodeAt(u)]<<10|g[e.charCodeAt(u+1)]<<4|g[e.charCodeAt(u+2)]>>2,d[l++]=255&t>>8,d[l++]=255&t),d}function o(e){return p[63&e>>18]+p[63&e>>12]+p[63&e>>6]+p[63&e]}function d(e,t,r){for(var n,s=[],a=t;al?l:o+a));return 1===n?(t=e[r-1],s.push(p[t>>2]+p[63&t<<4]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],s.push(p[t>>10]+p[63&t>>4]+p[63&t<<2]+"=")),s.join("")}r.byteLength=function(e){var t=n(e),r=t[0],s=t[1];return 3*(r+s)/4-s},r.toByteArray=a,r.fromByteArray=l;for(var p=[],g=[],c="undefined"==typeof Uint8Array?Array:Uint8Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",y=0,_=u.length;y<_;++y)p[y]=u[y],g[u.charCodeAt(y)]=y;g[45]=62,g[95]=63},{}],3:[function(e,t,r){var n=Math.pow,s=String.fromCharCode,o=Math.min;(function(t){/*! +(function(){function d(s,e,n){function f(u,i){if(!e[u]){if(!s[u]){var r="function"==typeof require&&require;if(!i&&r)return r(u,!0);if(t)return t(u,!0);var o=new Error("Cannot find module '"+u+"'");throw o.code="MODULE_NOT_FOUND",o}var a=e[u]={exports:{}};s[u][0].call(a.exports,function(e){var d=s[u][1][e];return f(d||e)},a,a.exports,d,s,e,n)}return e[u].exports}for(var t="function"==typeof require&&require,u=0;uu||57343=u)r.push(65533);else if(55296<=u&&56319>=u)if(n===t-1)r.push(65533);else{var s=f.charCodeAt(n+1);if(56320<=s&&57343>=s){r.push(65536+((1023&u)<<10)+(1023&s)),n+=1}else r.push(65533)}n+=1}return r}function s(e){for(var n="",u=0,f;u=f?n+=d(f):(f-=65536,n+=d((f>>10)+55296,(1023&f)+56320));return n}function a(e){return 0<=e&&127>=e}function o(e){this.tokens=[].slice.call(e),this.tokens.reverse()}function l(e,n){if(e)throw TypeError("Decoder error");return n||65533}function p(e){throw TypeError("The code point "+e+" could not be encoded.")}function c(e){return e=(e+"").trim().toLowerCase(),Object.prototype.hasOwnProperty.call(X,e)?X[e]:null}function g(e,n){return n?n[e]||null:null}function m(e,n){var d=n.indexOf(e);return-1===d?null:d}function y(e){if(!("encoding-indexes"in i))throw Error("Indexes missing. Did you forget to include encoding-indexes.js first?");return i["encoding-indexes"][e]}function _(e){if(39419e||1237575>6*d)+i];0>6*(d-1);f.push(128|63&t),d-=1}return f}}function R(e,n){var d=n.fatal;this.handler=function(n,i){if(i===-1)return-1;if(a(i))return i;var u=e[i-128];return null===u?l(d):u}}function I(e,n){n.fatal;this.handler=function(n,d){if(-1===d)return-1;if(Y(d))return d;var i=m(d,e);return null===i&&p(d),i+128}}function N(e){var n=e.fatal,d=0,i=0,f=0;this.handler=function(e,t){if(t===-1&&0===d&&0===i&&0===f)return-1;t===-1&&(0!==d||0!==i||0!==f)&&(d=0,i=0,f=0,l(n));var r;if(0!==f){r=null,u(t,48,57)&&(r=_(10*(126*(10*(d-129)+i-48)+f-129)+t-48));var s=[i,f,t];return d=0,i=0,f=0,null===r?(e.prepend(s),l(n)):r}if(0!==i)return u(t,129,254)?(f=t,null):(e.prepend([i,t]),d=0,i=0,l(n));if(0!==d){if(u(t,48,57))return i=t,null;var o=d,p=null;d=0;var c=127>t?64:65;return(u(t,64,126)||u(t,128,254))&&(p=190*(o-129)+(t-c)),r=null===p?null:g(p,y("gb18030")),null===r&&a(t)&&e.prepend(t),null===r?l(n):r}return a(t)?t:128===t?8364:u(t,129,254)?(d=t,null):l(n)}}function U(e,n){e.fatal;this.handler=function(e,d){if(d===-1)return-1;if(Y(d))return d;if(58853===d)return p(d);if(n&&8364===d)return 128;var i=m(d,y("gb18030"));if(null!==i){var u=G(i/190)+129,f=i%190,t=63>f?64:65;return[u,f+t]}if(n)return p(d);i=S(d);var r=G(i/10/126/10);i-=10*(126*(10*r));var s=G(i/10/126);i-=126*(10*s);var a=G(i/10),o=i-10*a;return[r+129,s+48,a+129,o+48]}}function C(e){var n=e.fatal,d=0;this.handler=function(e,i){if(-1===i&&0!==d)return d=0,l(n);if(-1===i&&0===d)return-1;if(0!==d){var f=d,t=null;d=0;var r=127>i?64:98;switch((u(i,64,126)||u(i,161,254))&&(t=157*(f-129)+(i-r)),t){case 1133:return[202,772];case 1135:return[202,780];case 1164:return[234,772];case 1166:return[234,780];}var s=null===t?null:g(t,y("big5"));return null===s&&a(i)&&e.prepend(i),null===s?l(n):s}return a(i)?i:u(i,129,254)?(d=i,null):l(n)}}function w(e){e.fatal;this.handler=function(e,n){if(n===-1)return-1;if(Y(n))return n;var d=T(n);if(null===d)return p(n);var i=G(d/157)+129;if(161>i)return p(n);var u=d%157,f=63>u?64:98;return[i,u+f]}}function B(e){var n=e.fatal,d=!1,i=0;this.handler=function(e,f){if(-1===f&&0!==i)return i=0,l(n);if(-1===f&&0===i)return-1;if(142===i&&u(f,161,223))return i=0,65216+f;if(143===i&&u(f,161,254))return d=!0,i=f,null;if(0!==i){var t=i;i=0;var r=null;return u(t,161,254)&&u(f,161,254)&&(r=g(94*(t-161)+(f-161),y(d?"jis0212":"jis0208"))),d=!1,u(f,161,254)||e.prepend(f),null===r?l(n):r}return a(f)?f:142===f||143===f||u(f,161,254)?(i=f,null):l(n)}}function L(e){e.fatal;this.handler=function(e,n){if(n===-1)return-1;if(Y(n))return n;if(165===n)return 92;if(8254===n)return 126;if(u(n,65377,65439))return[142,n-65377+161];8722===n&&(n=65293);var d=m(n,y("jis0208"));if(null===d)return p(n);var i=G(d/94)+161;return[i,d%94+161]}}function M(e){var n=e.fatal,d={ASCII:0,Roman:1,Katakana:2,LeadByte:3,TrailByte:4,EscapeStart:5,Escape:6},i=d.ASCII,f=d.ASCII,t=0,r=!1;this.handler=function(e,s){switch(i){default:case d.ASCII:return 27===s?(i=d.EscapeStart,null):u(s,0,127)&&14!==s&&15!==s&&27!==s?(r=!1,s):-1===s?-1:(r=!1,l(n));case d.Roman:return 27===s?(i=d.EscapeStart,null):92===s?(r=!1,165):126===s?(r=!1,8254):u(s,0,127)&&14!==s&&15!==s&&27!==s&&92!==s&&126!==s?(r=!1,s):-1===s?-1:(r=!1,l(n));case d.Katakana:return 27===s?(i=d.EscapeStart,null):u(s,33,95)?(r=!1,65344+s):-1===s?-1:(r=!1,l(n));case d.LeadByte:return 27===s?(i=d.EscapeStart,null):u(s,33,126)?(r=!1,t=s,i=d.TrailByte,null):-1===s?-1:(r=!1,l(n));case d.TrailByte:if(27===s)return i=d.EscapeStart,l(n);if(u(s,33,126)){i=d.LeadByte;var a=94*(t-33)+s-33,o=g(a,y("jis0208"));return null===o?l(n):o}return-1===s?(i=d.LeadByte,e.prepend(s),l(n)):(i=d.LeadByte,l(n));case d.EscapeStart:return 36===s||40===s?(t=s,i=d.Escape,null):(e.prepend(s),r=!1,i=f,l(n));case d.Escape:var p=t;t=0;var c=null;if(40===p&&66===s&&(c=d.ASCII),40===p&&74===s&&(c=d.Roman),40===p&&73===s&&(c=d.Katakana),36===p&&(64===s||66===s)&&(c=d.LeadByte),null!==c){i=i=c;var m=r;return r=!0,m?l(n):null}return e.prepend([p,s]),r=!1,i=f,l(n);}}}function D(e){var n=e.fatal,d={ASCII:0,Roman:1,jis0208:2},i=d.ASCII;this.handler=function(e,n){if(-1===n&&i!==d.ASCII)return e.prepend(n),i=d.ASCII,[27,40,66];if(-1===n&&i===d.ASCII)return-1;if((i===d.ASCII||i===d.Roman)&&(14===n||15===n||27===n))return p(65533);if(i===d.ASCII&&Y(n))return n;if(i===d.Roman&&(Y(n)&&92!==n&&126!==n||165==n||8254==n)){if(Y(n))return n;if(165===n)return 92;if(8254===n)return 126}if(Y(n)&&i!==d.ASCII)return e.prepend(n),i=d.ASCII,[27,40,66];if((165===n||8254===n)&&i!==d.Roman)return e.prepend(n),i=d.Roman,[27,40,74];8722===n&&(n=65293);var u=m(n,y("jis0208"));if(null===u)return p(n);if(i!==d.jis0208)return e.prepend(n),i=d.jis0208,[27,36,66];var f=G(u/94)+33;return[f,u%94+33]}}function P(e){var n=e.fatal,d=0;this.handler=function(e,i){if(-1===i&&0!==d)return d=0,l(n);if(-1===i&&0===d)return-1;if(0!==d){var f=d,t=null;d=0;var r=127>i?64:65,s=160>f?129:193;if((u(i,64,126)||u(i,128,252))&&(t=188*(f-s)+i-r),u(t,8836,10715))return 48508+t;var o=null===t?null:g(t,y("jis0208"));return null===o&&a(i)&&e.prepend(i),null===o?l(n):o}return a(i)||128===i?i:u(i,161,223)?65216+i:u(i,129,159)||u(i,224,252)?(d=i,null):l(n)}}function F(e){e.fatal;this.handler=function(e,n){if(n===-1)return-1;if(Y(n)||128===n)return n;if(165===n)return 92;if(8254===n)return 126;if(u(n,65377,65439))return n-65377+161;8722===n&&(n=65293);var d=h(n);if(null===d)return p(n);var i=G(d/188),f=31>i?129:193,t=d%188,r=63>t?64:65;return[i+f,t+r]}}function W(e){var n=e.fatal,d=0;this.handler=function(e,i){if(-1===i&&0!==d)return d=0,l(n);if(-1===i&&0===d)return-1;if(0!==d){var f=d,t=null;d=0,u(i,65,254)&&(t=190*(f-129)+(i-65));var r=null===t?null:g(t,y("euc-kr"));return null===t&&a(i)&&e.prepend(i),null===r?l(n):r}return a(i)?i:u(i,129,254)?(d=i,null):l(n)}}function x(e){e.fatal;this.handler=function(e,n){if(n===-1)return-1;if(Y(n))return n;var d=m(n,y("euc-kr"));if(null===d)return p(n);var i=G(d/190)+129;return[i,d%190+65]}}function H(e,n){var d=e>>8,i=255&e;return n?[d,i]:[i,d]}function v(e,n){var d=n.fatal,i=null,f=null;this.handler=function(n,t){if(-1===t&&(null!==i||null!==f))return l(d);if(-1===t&&null===i&&null===f)return-1;if(null===i)return i=t,null;var r;if(r=e?(i<<8)+t:(t<<8)+i,i=null,null!==f){var s=f;return(f=null,u(r,56320,57343))?65536+1024*(s-55296)+(r-56320):(n.prepend(H(r,e)),l(d))}return u(r,55296,56319)?(f=r,null):u(r,56320,57343)?l(d):r}}function V(e,n){n.fatal;this.handler=function(n,d){if(d===-1)return-1;if(u(d,0,65535))return H(d,e);var i=H((d-65536>>10)+55296,e),f=H((1023&d-65536)+56320,e);return i.concat(f)}}function k(e){e.fatal;this.handler=function(e,n){return-1===n?-1:a(n)?n:63360+n-128}}function j(e){e.fatal;this.handler=function(e,n){return-1===n?-1:Y(n)?n:u(n,63360,63487)?n-63360+128:p(n)}}"undefined"!=typeof n&&n.exports&&!i["encoding-indexes"]&&(i["encoding-indexes"]=e("./encoding-indexes.js")["encoding-indexes"]);var G=Math.floor,Y=a,K=-1;o.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.pop():K},prepend:function(e){if(Array.isArray(e))for(var n=e;n.length;)this.tokens.push(n.pop());else this.tokens.push(e)},push:function(e){if(Array.isArray(e))for(var n=e;n.length;)this.tokens.unshift(n.shift());else this.tokens.unshift(e)}};(function(){}).prototype={handler:function(){}},function(){}.prototype={handler:function(){}};var z=[{encodings:[{labels:["unicode-1-1-utf-8","utf-8","utf8"],name:"UTF-8"}],heading:"The Encoding"},{encodings:[{labels:["866","cp866","csibm866","ibm866"],name:"IBM866"},{labels:["csisolatin2","iso-8859-2","iso-ir-101","iso8859-2","iso88592","iso_8859-2","iso_8859-2:1987","l2","latin2"],name:"ISO-8859-2"},{labels:["csisolatin3","iso-8859-3","iso-ir-109","iso8859-3","iso88593","iso_8859-3","iso_8859-3:1988","l3","latin3"],name:"ISO-8859-3"},{labels:["csisolatin4","iso-8859-4","iso-ir-110","iso8859-4","iso88594","iso_8859-4","iso_8859-4:1988","l4","latin4"],name:"ISO-8859-4"},{labels:["csisolatincyrillic","cyrillic","iso-8859-5","iso-ir-144","iso8859-5","iso88595","iso_8859-5","iso_8859-5:1988"],name:"ISO-8859-5"},{labels:["arabic","asmo-708","csiso88596e","csiso88596i","csisolatinarabic","ecma-114","iso-8859-6","iso-8859-6-e","iso-8859-6-i","iso-ir-127","iso8859-6","iso88596","iso_8859-6","iso_8859-6:1987"],name:"ISO-8859-6"},{labels:["csisolatingreek","ecma-118","elot_928","greek","greek8","iso-8859-7","iso-ir-126","iso8859-7","iso88597","iso_8859-7","iso_8859-7:1987","sun_eu_greek"],name:"ISO-8859-7"},{labels:["csiso88598e","csisolatinhebrew","hebrew","iso-8859-8","iso-8859-8-e","iso-ir-138","iso8859-8","iso88598","iso_8859-8","iso_8859-8:1988","visual"],name:"ISO-8859-8"},{labels:["csiso88598i","iso-8859-8-i","logical"],name:"ISO-8859-8-I"},{labels:["csisolatin6","iso-8859-10","iso-ir-157","iso8859-10","iso885910","l6","latin6"],name:"ISO-8859-10"},{labels:["iso-8859-13","iso8859-13","iso885913"],name:"ISO-8859-13"},{labels:["iso-8859-14","iso8859-14","iso885914"],name:"ISO-8859-14"},{labels:["csisolatin9","iso-8859-15","iso8859-15","iso885915","iso_8859-15","l9"],name:"ISO-8859-15"},{labels:["iso-8859-16"],name:"ISO-8859-16"},{labels:["cskoi8r","koi","koi8","koi8-r","koi8_r"],name:"KOI8-R"},{labels:["koi8-ru","koi8-u"],name:"KOI8-U"},{labels:["csmacintosh","mac","macintosh","x-mac-roman"],name:"macintosh"},{labels:["dos-874","iso-8859-11","iso8859-11","iso885911","tis-620","windows-874"],name:"windows-874"},{labels:["cp1250","windows-1250","x-cp1250"],name:"windows-1250"},{labels:["cp1251","windows-1251","x-cp1251"],name:"windows-1251"},{labels:["ansi_x3.4-1968","ascii","cp1252","cp819","csisolatin1","ibm819","iso-8859-1","iso-ir-100","iso8859-1","iso88591","iso_8859-1","iso_8859-1:1987","l1","latin1","us-ascii","windows-1252","x-cp1252"],name:"windows-1252"},{labels:["cp1253","windows-1253","x-cp1253"],name:"windows-1253"},{labels:["cp1254","csisolatin5","iso-8859-9","iso-ir-148","iso8859-9","iso88599","iso_8859-9","iso_8859-9:1989","l5","latin5","windows-1254","x-cp1254"],name:"windows-1254"},{labels:["cp1255","windows-1255","x-cp1255"],name:"windows-1255"},{labels:["cp1256","windows-1256","x-cp1256"],name:"windows-1256"},{labels:["cp1257","windows-1257","x-cp1257"],name:"windows-1257"},{labels:["cp1258","windows-1258","x-cp1258"],name:"windows-1258"},{labels:["x-mac-cyrillic","x-mac-ukrainian"],name:"x-mac-cyrillic"}],heading:"Legacy single-byte encodings"},{encodings:[{labels:["chinese","csgb2312","csiso58gb231280","gb2312","gb_2312","gb_2312-80","gbk","iso-ir-58","x-gbk"],name:"GBK"},{labels:["gb18030"],name:"gb18030"}],heading:"Legacy multi-byte Chinese (simplified) encodings"},{encodings:[{labels:["big5","big5-hkscs","cn-big5","csbig5","x-x-big5"],name:"Big5"}],heading:"Legacy multi-byte Chinese (traditional) encodings"},{encodings:[{labels:["cseucpkdfmtjapanese","euc-jp","x-euc-jp"],name:"EUC-JP"},{labels:["csiso2022jp","iso-2022-jp"],name:"ISO-2022-JP"},{labels:["csshiftjis","ms932","ms_kanji","shift-jis","shift_jis","sjis","windows-31j","x-sjis"],name:"Shift_JIS"}],heading:"Legacy multi-byte Japanese encodings"},{encodings:[{labels:["cseuckr","csksc56011987","euc-kr","iso-ir-149","korean","ks_c_5601-1987","ks_c_5601-1989","ksc5601","ksc_5601","windows-949"],name:"EUC-KR"}],heading:"Legacy multi-byte Korean encodings"},{encodings:[{labels:["csiso2022kr","hz-gb-2312","iso-2022-cn","iso-2022-cn-ext","iso-2022-kr"],name:"replacement"},{labels:["utf-16be"],name:"UTF-16BE"},{labels:["utf-16","utf-16le"],name:"UTF-16LE"},{labels:["x-user-defined"],name:"x-user-defined"}],heading:"Legacy miscellaneous encodings"}],X={};z.forEach(function(e){e.encodings.forEach(function(e){e.labels.forEach(function(n){X[n]=e})})});var Z={},q={},$,J;Object.defineProperty&&(Object.defineProperty(E.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}}),Object.defineProperty(E.prototype,"fatal",{get:function(){return"fatal"===this._error_mode}}),Object.defineProperty(E.prototype,"ignoreBOM",{get:function(){return this._ignoreBOM}})),E.prototype.decode=function(e,n){var d;d="object"==typeof e&&e instanceof ArrayBuffer?new Uint8Array(e):"object"==typeof e&&"buffer"in e&&e.buffer instanceof ArrayBuffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(0),n=t(n),this._do_not_flush||(this._decoder=q[this._encoding.name]({fatal:"fatal"===this._error_mode}),this._BOMseen=!1),this._do_not_flush=!!n.stream;for(var i=new o(d),u=[],r,a;(a=i.read(),a!==K)&&!(r=this._decoder.handler(i,a),-1===r);)null!==r&&(Array.isArray(r)?u.push.apply(u,r):u.push(r));if(!this._do_not_flush){do{if(r=this._decoder.handler(i,i.read()),-1===r)break;if(null===r)continue;Array.isArray(r)?u.push.apply(u,r):u.push(r)}while(!i.endOfStream());this._decoder=null}return function(e){return!f(["UTF-8","UTF-16LE","UTF-16BE"],this._encoding.name)||this._ignoreBOM||this._BOMseen||(0>16,r[s++]=255&o>>8,r[s++]=255&o;return 2===t&&(o=l[e.charCodeAt(c)]<<2|l[e.charCodeAt(c+1)]>>4,r[s++]=255&o),1===t&&(o=l[e.charCodeAt(c)]<<10|l[e.charCodeAt(c+1)]<<4|l[e.charCodeAt(c+2)]>>2,r[s++]=255&o>>8,r[s++]=255&o),r}function r(e){return o[63&e>>18]+o[63&e>>12]+o[63&e>>6]+o[63&e]}function s(e,n,d){for(var u=[],f=n,t;fr?r:t+f));return 1===d?(a=e[n-1],u.push(o[a>>2]+o[63&a<<4]+"==")):2===d&&(a=(e[n-2]<<8)+e[n-1],u.push(o[a>>10]+o[63&a>>4]+o[63&a<<2]+"=")),u.join("")}d.byteLength=function(e){var n=u(e),d=n[0],i=n[1];return 3*(d+i)/4-i},d.toByteArray=t,d.fromByteArray=a;for(var o=[],l=[],p="undefined"==typeof Uint8Array?Array:Uint8Array,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",g=0,m=c.length;g * @license MIT - */'use strict';function a(e){if(2147483647e)throw new RangeError("The value \""+e+"\" is invalid for option \"size\"")}function l(e,t,r){return d(e),0>=e?a(e):void 0===t?a(e):"string"==typeof r?a(e).fill(t,r):a(e).fill(t)}function p(e){return d(e),a(0>e?0:0|_(e))}function g(e,r){if(("string"!=typeof r||""===r)&&(r="utf8"),!t.isEncoding(r))throw new TypeError("Unknown encoding: "+r);var n=0|f(e,r),s=a(n),i=s.write(e,r);return i!==n&&(s=s.slice(0,i)),s}function c(e){for(var t=0>e.length?0:0|_(e.length),r=a(t),n=0;nr||e.byteLength=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647 .toString(16)+" bytes");return 0|e}function h(e){return+e!=e&&(e=0),t.alloc(+e)}function f(e,r){if(t.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||K(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError("The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. Received type "+typeof e);var n=e.length,s=2>>1;case"base64":return z(e).length;default:if(a)return s?-1:j(e).length;r=(""+r).toLowerCase(),a=!0;}}function A(e,t,r){var n=!1;if((void 0===t||0>t)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),0>=r)return"";if(r>>>=0,t>>>=0,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return F(this,t,r);case"utf8":case"utf-8":return M(this,t,r);case"ascii":return R(this,t,r);case"latin1":case"binary":return N(this,t,r);case"base64":return C(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0;}}function E(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function b(e,r,n,s,a){if(0===e.length)return-1;if("string"==typeof n?(s=n,n=0):2147483647n&&(n=-2147483648),n=+n,Y(n)&&(n=a?0:e.length-1),0>n&&(n=e.length+n),n>=e.length){if(a)return-1;n=e.length-1}else if(0>n)if(a)n=0;else return-1;if("string"==typeof r&&(r=t.from(r,s)),t.isBuffer(r))return 0===r.length?-1:m(e,r,n,s,a);if("number"==typeof r)return r&=255,"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(e,r,n):Uint8Array.prototype.lastIndexOf.call(e,r,n):m(e,[r],n,s,a);throw new TypeError("val must be string, number or Buffer")}function m(e,t,r,n,s){function a(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}var o=1,d=e.length,l=t.length;if(void 0!==n&&(n=(n+"").toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(2>e.length||2>t.length)return-1;o=2,d/=2,l/=2,r/=2}var p;if(s){var g=-1;for(p=r;pd&&(r=d-l),p=r;0<=p;p--){for(var c=!0,u=0;us&&(n=s)):n=s;var a=t.length;n>a/2&&(n=a/2);for(var o,d=0;da&&(d=a):2===l?(p=e[s+1],128==(192&p)&&(u=(31&a)<<6|63&p,127u||57343u&&(d=u))):void 0}null===d?(d=65533,l=1):65535>>10),d=56320|1023&d),n.push(d),s+=l}return U(n)}function U(e){var t=e.length;if(t<=4096)return s.apply(String,e);for(var r="",n=0;nt)&&(t=0),(!r||0>r||r>n)&&(r=n);for(var s="",a=t;ae)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function L(e,r,n,s,a,i){if(!t.isBuffer(e))throw new TypeError("\"buffer\" argument must be a Buffer instance");if(r>a||re.length)throw new RangeError("Index out of range")}function x(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(0>r)throw new RangeError("Index out of range")}function P(e,t,r,n,s){return t=+t,r>>>=0,s||x(e,t,r,4,34028234663852886e22,-34028234663852886e22),q.write(e,t,r,n,23,4),r+4}function v(e,t,r,n,s){return t=+t,r>>>=0,s||x(e,t,r,8,17976931348623157e292,-17976931348623157e292),q.write(e,t,r,n,52,8),r+8}function V(e){if(e=e.split("=")[0],e=e.trim().replace(J,""),2>e.length)return"";for(;0!=e.length%4;)e+="=";return e}function k(e){return 16>e?"0"+e.toString(16):e.toString(16)}function j(e,t){t=t||1/0;for(var r,n=e.length,s=null,a=[],o=0;or){if(!s){if(56319r){-1<(t-=3)&&a.push(239,191,189),s=r;continue}r=(s-55296<<10|r-56320)+65536}else s&&-1<(t-=3)&&a.push(239,191,189);if(s=null,128>r){if(0>(t-=1))break;a.push(r)}else if(2048>r){if(0>(t-=2))break;a.push(192|r>>6,128|63&r)}else if(65536>r){if(0>(t-=3))break;a.push(224|r>>12,128|63&r>>6,128|63&r)}else if(1114112>r){if(0>(t-=4))break;a.push(240|r>>18,128|63&r>>12,128|63&r>>6,128|63&r)}else throw new Error("Invalid code point")}return a}function H(e){for(var t=[],r=0;r(t-=2));++o)r=e.charCodeAt(o),n=r>>8,s=r%256,a.push(s),a.push(n);return a}function z(e){return Z.toByteArray(V(e))}function X(e,t,r,n){for(var s=0;s=t.length||s>=e.length);++s)t[s+r]=e[s];return s}function K(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Y(e){return e!==e}var Z=e("base64-js"),q=e("ieee754");r.Buffer=t,r.SlowBuffer=h,r.INSPECT_MAX_BYTES=50;r.kMaxLength=2147483647,t.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(t){return!1}}(),t.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(t.prototype,"parent",{enumerable:!0,get:function(){return t.isBuffer(this)?this.buffer:void 0}}),Object.defineProperty(t.prototype,"offset",{enumerable:!0,get:function(){return t.isBuffer(this)?this.byteOffset:void 0}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&t[Symbol.species]===t&&Object.defineProperty(t,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),t.poolSize=8192,t.from=function(e,t,r){return i(e,t,r)},t.prototype.__proto__=Uint8Array.prototype,t.__proto__=Uint8Array,t.alloc=function(e,t,r){return l(e,t,r)},t.allocUnsafe=function(e){return p(e)},t.allocUnsafeSlow=function(e){return p(e)},t.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==t.prototype},t.compare=function(e,r){if(K(e,Uint8Array)&&(e=t.from(e,e.offset,e.byteLength)),K(r,Uint8Array)&&(r=t.from(r,r.offset,r.byteLength)),!t.isBuffer(e)||!t.isBuffer(r))throw new TypeError("The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array");if(e===r)return 0;for(var n=e.length,s=r.length,d=0,l=o(n,s);dt&&(e+=" ... "),""},t.prototype.compare=function(e,r,n,s,a){if(K(e,Uint8Array)&&(e=t.from(e,e.offset,e.byteLength)),!t.isBuffer(e))throw new TypeError("The \"target\" argument must be one of type Buffer or Uint8Array. Received type "+typeof e);if(void 0===r&&(r=0),void 0===n&&(n=e?e.length:0),void 0===s&&(s=0),void 0===a&&(a=this.length),0>r||n>e.length||0>s||a>this.length)throw new RangeError("out of range index");if(s>=a&&r>=n)return 0;if(s>=a)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,s>>>=0,a>>>=0,this===e)return 0;for(var d=a-s,l=n-r,p=o(d,l),g=this.slice(s,a),c=e.slice(r,n),u=0;u>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-t;if((void 0===r||r>s)&&(r=s),0r||0>t)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return S(this,e,t,r);case"utf8":case"utf-8":return T(this,e,t,r);case"ascii":return I(this,e,t,r);case"latin1":case"binary":return B(this,e,t,r);case"base64":return O(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0;}},t.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};t.prototype.slice=function(e,r){var n=this.length;e=~~e,r=void 0===r?n:~~r,0>e?(e+=n,0>e&&(e=0)):e>n&&(e=n),0>r?(r+=n,0>r&&(r=0)):r>n&&(r=n),r>>=0,t>>>=0,r||W(e,t,this.length);for(var n=this[e],s=1,a=0;++a>>=0,t>>>=0,r||W(e,t,this.length);for(var n=this[e+--t],s=1;0>>=0,t||W(e,1,this.length),this[e]},t.prototype.readUInt16LE=function(e,t){return e>>>=0,t||W(e,2,this.length),this[e]|this[e+1]<<8},t.prototype.readUInt16BE=function(e,t){return e>>>=0,t||W(e,2,this.length),this[e]<<8|this[e+1]},t.prototype.readUInt32LE=function(e,t){return e>>>=0,t||W(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},t.prototype.readUInt32BE=function(e,t){return e>>>=0,t||W(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},t.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||W(e,t,this.length);for(var s=this[e],a=1,o=0;++o=a&&(s-=n(2,8*t)),s},t.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||W(e,t,this.length);for(var s=t,a=1,o=this[e+--s];0=a&&(o-=n(2,8*t)),o},t.prototype.readInt8=function(e,t){return e>>>=0,t||W(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},t.prototype.readInt16LE=function(e,t){e>>>=0,t||W(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},t.prototype.readInt16BE=function(e,t){e>>>=0,t||W(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},t.prototype.readInt32LE=function(e,t){return e>>>=0,t||W(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},t.prototype.readInt32BE=function(e,t){return e>>>=0,t||W(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},t.prototype.readFloatLE=function(e,t){return e>>>=0,t||W(e,4,this.length),q.read(this,e,!0,23,4)},t.prototype.readFloatBE=function(e,t){return e>>>=0,t||W(e,4,this.length),q.read(this,e,!1,23,4)},t.prototype.readDoubleLE=function(e,t){return e>>>=0,t||W(e,8,this.length),q.read(this,e,!0,52,8)},t.prototype.readDoubleBE=function(e,t){return e>>>=0,t||W(e,8,this.length),q.read(this,e,!1,52,8)},t.prototype.writeUIntLE=function(e,t,r,s){if(e=+e,t>>>=0,r>>>=0,!s){var a=n(2,8*r)-1;L(this,e,t,r,a,0)}var o=1,d=0;for(this[t]=255&e;++d>>=0,r>>>=0,!s){var a=n(2,8*r)-1;L(this,e,t,r,a,0)}var o=r-1,d=1;for(this[t+o]=255&e;0<=--o&&(d*=256);)this[t+o]=255&e/d;return t+r},t.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,1,255,0),this[t]=255&e,t+1},t.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},t.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},t.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},t.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},t.prototype.writeIntLE=function(e,t,r,s){if(e=+e,t>>>=0,!s){var a=n(2,8*r-1);L(this,e,t,r,a-1,-a)}var o=0,d=1,l=0;for(this[t]=255&e;++oe&&0===l&&0!==this[t+o-1]&&(l=1),this[t+o]=255&(e/d>>0)-l;return t+r},t.prototype.writeIntBE=function(e,t,r,s){if(e=+e,t>>>=0,!s){var a=n(2,8*r-1);L(this,e,t,r,a-1,-a)}var o=r-1,d=1,l=0;for(this[t+o]=255&e;0<=--o&&(d*=256);)0>e&&0===l&&0!==this[t+o+1]&&(l=1),this[t+o]=255&(e/d>>0)-l;return t+r},t.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,1,127,-128),0>e&&(e=255+e+1),this[t]=255&e,t+1},t.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},t.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},t.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},t.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||L(this,e,t,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},t.prototype.writeFloatLE=function(e,t,r){return P(this,e,t,!0,r)},t.prototype.writeFloatBE=function(e,t,r){return P(this,e,t,!1,r)},t.prototype.writeDoubleLE=function(e,t,r){return v(this,e,t,!0,r)},t.prototype.writeDoubleBE=function(e,t,r){return v(this,e,t,!1,r)},t.prototype.copy=function(e,r,n,s){if(!t.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),s||0===s||(s=this.length),r>=e.length&&(r=e.length),r||(r=0),0r)throw new RangeError("targetStart out of bounds");if(0>n||n>=this.length)throw new RangeError("Index out of range");if(0>s)throw new RangeError("sourceEnd out of bounds");s>this.length&&(s=this.length),e.length-ra||"latin1"===s)&&(e=a)}}else"number"==typeof e&&(e&=255);if(0>r||this.length>>=0,n=n===void 0?this.length:n>>>0,e||(e=0);var o;if("number"==typeof e)for(o=r;o=e}},"es6","es3"),$jscomp.polyfill("String.prototype.endsWith",function(e){return e?e:function(t,r){var n=$jscomp.checkStringArgs(this,t,"endsWith");t+="",void 0===r&&(r=n.length),r=_Mathmax(0,_Mathmin2(0|r,n.length));for(var s=t.length;0=s}},"es6","es3"),$jscomp.polyfill("String.prototype.repeat",function(e){return e?e:function(e){var t=$jscomp.checkStringArgs(this,null,"repeat");if(0>e||1342177279>>=1)&&(t+=t);return r}},"es6","es3"),$jscomp.polyfill("Array.prototype.find",function(e){return e?e:function(e,t){return $jscomp.findInternal(this,e,t).v}},"es6","es3");var COMPILED=!0,goog=goog||{};goog.global=this,goog.isDef=function(e){return void 0!==e},goog.isString=function(e){return"string"==typeof e},goog.isBoolean=function(e){return"boolean"==typeof e},goog.isNumber=function(e){return"number"==typeof e},goog.exportPath_=function(e,t,r){e=e.split("."),r=r||goog.global,e[0]in r||"undefined"==typeof r.execScript||r.execScript("var "+e[0]);for(var n;e.length&&(n=e.shift());)!e.length&&goog.isDef(t)?r[n]=t:r=r[n]&&r[n]!==Object.prototype[n]?r[n]:r[n]={}},goog.define=function(e,t){return goog.exportPath_(e,t),t},goog.DEBUG=!0,goog.LOCALE="en",goog.TRUSTED_SITE=!0,goog.STRICT_MODE_COMPATIBLE=!1,goog.DISALLOW_TEST_ONLY_CODE=!goog.DEBUG,goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING=!1,goog.provide=function(e){if(goog.isInModuleLoader_())throw Error("goog.provide cannot be used within a module.");goog.constructNamespace_(e)},goog.constructNamespace_=function(e,t){goog.exportPath_(e,t)},goog.getScriptNonce=function(e){return e&&e!=goog.global?goog.getScriptNonce_(e.document):(null===goog.cspNonce_&&(goog.cspNonce_=goog.getScriptNonce_(goog.global.document)),goog.cspNonce_)},goog.NONCE_PATTERN_=/^[\w+/_-]+[=]{0,2}$/,goog.cspNonce_=null,goog.getScriptNonce_=function(e){return(e=e.querySelector&&e.querySelector("script[nonce]"))&&(e=e.nonce||e.getAttribute("nonce"))&&goog.NONCE_PATTERN_.test(e)?e:""},goog.VALID_MODULE_RE_=/^[a-zA-Z_$][a-zA-Z0-9._$]*$/,goog.module=function(e){if(!goog.isString(e)||!e||-1==e.search(goog.VALID_MODULE_RE_))throw Error("Invalid module identifier");if(!goog.isInGoogModuleLoader_())throw Error("Module "+e+" has been loaded incorrectly. Note, modules cannot be loaded as normal scripts. They require some kind of pre-processing step. You're likely trying to load a module via a script tag or as a part of a concatenated bundle without rewriting the module. For more info see: https://github.com/google/closure-library/wiki/goog.module:-an-ES6-module-like-alternative-to-goog.provide.");if(goog.moduleLoaderState_.moduleName)throw Error("goog.module may only be called once per module.");goog.moduleLoaderState_.moduleName=e},goog.module.get=function(e){return goog.module.getInternal_(e)},goog.module.getInternal_=function(){return null},goog.ModuleType={ES6:"es6",GOOG:"goog"},goog.moduleLoaderState_=null,goog.isInModuleLoader_=function(){return goog.isInGoogModuleLoader_()||goog.isInEs6ModuleLoader_()},goog.isInGoogModuleLoader_=function(){return!!goog.moduleLoaderState_&&goog.moduleLoaderState_.type==goog.ModuleType.GOOG},goog.isInEs6ModuleLoader_=function(){if(goog.moduleLoaderState_&&goog.moduleLoaderState_.type==goog.ModuleType.ES6)return!0;var e=goog.global.$jscomp;return!!e&&!("function"!=typeof e.getCurrentModulePath)&&!!e.getCurrentModulePath()},goog.module.declareLegacyNamespace=function(){goog.moduleLoaderState_.declareLegacyNamespace=!0},goog.declareModuleId=function(e){if(goog.moduleLoaderState_)goog.moduleLoaderState_.moduleName=e;else{var t=goog.global.$jscomp;if(!t||"function"!=typeof t.getCurrentModulePath)throw Error("Module with namespace \""+e+"\" has been loaded incorrectly.");t=t.require(t.getCurrentModulePath()),goog.loadedModules_[e]={exports:t,type:goog.ModuleType.ES6,moduleId:e}}},goog.module.declareNamespace=goog.declareModuleId,goog.setTestOnly=function(e){if(goog.DISALLOW_TEST_ONLY_CODE)throw e=e||"",Error("Importing test-only code into non-debug environment"+(e?": "+e:"."))},goog.forwardDeclare=function(){},!0,goog.getObjectByName=function(e,t){e=e.split("."),t=t||goog.global;for(var r=0;r>>0),goog.uidCounter_=0,goog.getHashCode=goog.getUid,goog.removeHashCode=goog.removeUid,goog.cloneObject=function(e){var t=goog.typeOf(e);if("object"==t||"array"==t){if("function"==typeof e.clone)return e.clone();for(var r in t="array"==t?[]:{},e)t[r]=goog.cloneObject(e[r]);return t}return e},goog.bindNative_=function(e){return e.call.apply(e.bind,arguments)},goog.bindJs_=function(e,t){if(!e)throw Error();if(2r?_Mathmax(0,e.length+r):r,goog.isString(e))return goog.isString(t)&&1==t.length?e.indexOf(t,r):-1;for(;rr&&(r=_Mathmax(0,e.length+r)),goog.isString(e))return goog.isString(t)&&1==t.length?e.lastIndexOf(t,r):-1;for(;0<=r;r--)if(r in e&&e[r]===t)return r;return-1},goog.array.forEach=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.forEach)?function(e,t,r){goog.asserts.assert(null!=e.length),Array.prototype.forEach.call(e,t,r)}:function(t,r,n){for(var s=t.length,a=goog.isString(t)?t.split(""):t,e=0;et?null:goog.isString(e)?e.charAt(t):e[t]},goog.array.findIndex=function(t,r,n){for(var s=t.length,a=goog.isString(t)?t.split(""):t,e=0;et?null:goog.isString(e)?e.charAt(t):e[t]},goog.array.findIndexRight=function(t,r,n){var s=t.length,a=goog.isString(t)?t.split(""):t;for(--s;0<=s;s--)if(s in a&&r.call(n,a[s],s,t))return s;return-1},goog.array.contains=function(e,t){return 0<=goog.array.indexOf(e,t)},goog.array.isEmpty=function(e){return 0==e.length},goog.array.clear=function(e){if(!goog.isArray(e))for(var t=e.length-1;0<=t;t--)delete e[t];e.length=0},goog.array.insert=function(e,t){goog.array.contains(e,t)||e.push(t)},goog.array.insertAt=function(e,t,r){goog.array.splice(e,r,0,t)},goog.array.insertArrayAt=function(e,t,r){goog.partial(goog.array.splice,e,r,0).apply(null,t)},goog.array.insertBefore=function(e,t,r){var n;2==arguments.length||0>(n=goog.array.indexOf(e,r))?e.push(t):goog.array.insertAt(e,t,n)},goog.array.remove=function(e,t){t=goog.array.indexOf(e,t);var r;return(r=0<=t)&&goog.array.removeAt(e,t),r},goog.array.removeLast=function(e,t){return t=goog.array.lastIndexOf(e,t),!!(0<=t)&&(goog.array.removeAt(e,t),!0)},goog.array.removeAt=function(e,t){return goog.asserts.assert(null!=e.length),1==Array.prototype.splice.call(e,t,1).length},goog.array.removeIf=function(e,t,r){return t=goog.array.findIndex(e,t,r),!!(0<=t)&&(goog.array.removeAt(e,t),!0)},goog.array.removeAllIf=function(t,r,n){var s=0;return goog.array.forEachRight(t,function(a,e){r.call(n,a,e,t)&&goog.array.removeAt(t,e)&&s++}),s},goog.array.concat=function(){return Array.prototype.concat.apply([],arguments)},goog.array.join=function(){return Array.prototype.concat.apply([],arguments)},goog.array.toArray=function(e){var t=e.length;if(0=arguments.length?Array.prototype.slice.call(e,t):Array.prototype.slice.call(e,t,r)},goog.array.removeDuplicates=function(t,r,n){r=r||t;var s=function(e){return goog.isObject(e)?"o"+goog.getUid(e):(typeof e).charAt(0)+e};n=n||s,s={};for(var a=0,i=0;i>1,p=n?r.call(a,t[d],d,t):r(s,t[d]);0t?1:er)&&(goog.array.insertAt(e,t,-(r+1)),!0)},goog.array.binaryRemove=function(e,t,r){return t=goog.array.binarySearch(e,t,r),!!(0<=t)&&goog.array.removeAt(e,t)},goog.array.bucket=function(t,r,n){for(var s={},a=0;an*(o-i))return[];if(0o;t+=n)s.push(t);return s},goog.array.repeat=function(e,t){for(var r=[],n=0;nt&&Array.prototype.push.apply(e,e.splice(0,-t))),e},goog.array.moveItem=function(e,t,r){goog.asserts.assert(0<=t&&t>=8),n[s++]=r;return n},goog.crypt.byteArrayToString=function(e){if(8192>=e.length)return _StringfromCharCode2.apply(null,e);for(var t,r="",n=0;nr?n[s++]=r:(2048>r?n[s++]=192|r>>6:(55296==(64512&r)&&a+1>18,n[s++]=128|63&r>>12):n[s++]=224|r>>12,n[s++]=128|63&r>>6),n[s++]=128|63&r);return n},goog.crypt.utf8ByteArrayToString=function(t){for(var r,n=[],s=0,a=0;sr)n[a++]=_StringfromCharCode2(r);else if(191r){var i=t[s++];n[a++]=_StringfromCharCode2((31&r)<<6|63&i)}else if(239r){i=t[s++];var o=t[s++],l=t[s++];r=((7&r)<<18|(63&i)<<12|(63&o)<<6|63&l)-65536,n[a++]=_StringfromCharCode2(55296+(r>>10)),n[a++]=_StringfromCharCode2(56320+(1023&r))}else i=t[s++],o=t[s++],n[a++]=_StringfromCharCode2((15&r)<<12|(63&i)<<6|63&o);return n.join("")},goog.crypt.xorByteArray=function(e,t){goog.asserts.assert(e.length==t.length,"XOR array lengths must match");for(var r=[],n=0;n":"
")},goog.string.internal.htmlEscape=function(e,t){if(t)e=e.replace(goog.string.internal.AMP_RE_,"&").replace(goog.string.internal.LT_RE_,"<").replace(goog.string.internal.GT_RE_,">").replace(goog.string.internal.QUOT_RE_,""").replace(goog.string.internal.SINGLE_QUOTE_RE_,"'").replace(goog.string.internal.NULL_RE_,"�");else{if(!goog.string.internal.ALL_RE_.test(e))return e;-1!=e.indexOf("&")&&(e=e.replace(goog.string.internal.AMP_RE_,"&")),-1!=e.indexOf("<")&&(e=e.replace(goog.string.internal.LT_RE_,"<")),-1!=e.indexOf(">")&&(e=e.replace(goog.string.internal.GT_RE_,">")),-1!=e.indexOf("\"")&&(e=e.replace(goog.string.internal.QUOT_RE_,""")),-1!=e.indexOf("'")&&(e=e.replace(goog.string.internal.SINGLE_QUOTE_RE_,"'")),-1!=e.indexOf("\0")&&(e=e.replace(goog.string.internal.NULL_RE_,"�"))}return e},goog.string.internal.AMP_RE_=/&/g,goog.string.internal.LT_RE_=//g,goog.string.internal.QUOT_RE_=/"/g,goog.string.internal.SINGLE_QUOTE_RE_=/'/g,goog.string.internal.NULL_RE_=/\x00/g,goog.string.internal.ALL_RE_=/[\x00&<>"']/,goog.string.internal.whitespaceEscape=function(e,t){return goog.string.internal.newLineToBr(e.replace(/ /g,"  "),t)},goog.string.internal.contains=function(e,t){return-1!=e.indexOf(t)},goog.string.internal.caseInsensitiveContains=function(e,t){return goog.string.internal.contains(e.toLowerCase(),t.toLowerCase())},goog.string.internal.compareVersions=function(t,r){var n=0;t=goog.string.internal.trim(t+"").split("."),r=goog.string.internal.trim(r+"").split(".");for(var s=_Mathmax(t.length,r.length),i=0;0==n&&it?1:0},goog.string.DETECT_DOUBLE_ESCAPING=!1,goog.string.FORCE_NON_DOM_HTML_UNESCAPING=!1,goog.string.Unicode={NBSP:"\xA0"},goog.string.startsWith=goog.string.internal.startsWith,goog.string.endsWith=goog.string.internal.endsWith,goog.string.caseInsensitiveStartsWith=goog.string.internal.caseInsensitiveStartsWith,goog.string.caseInsensitiveEndsWith=goog.string.internal.caseInsensitiveEndsWith,goog.string.caseInsensitiveEquals=goog.string.internal.caseInsensitiveEquals,goog.string.subs=function(t){for(var r=t.split("%s"),n="",s=Array.prototype.slice.call(arguments,1);s.length&&1=e||"\x80"<=e&&"\uFFFD">=e},goog.string.stripNewlines=function(e){return e.replace(/(\r\n|\r|\n)+/g," ")},goog.string.canonicalizeNewlines=function(e){return e.replace(/(\r\n|\r|\n)/g,"\n")},goog.string.normalizeWhitespace=function(e){return e.replace(/\xa0|\s/g," ")},goog.string.normalizeSpaces=function(e){return e.replace(/\xa0|[ \t]+/g," ")},goog.string.collapseBreakingSpaces=function(e){return e.replace(/[\t\r\n ]+/g," ").replace(/^[\t\r\n ]+|[\t\r\n ]+$/g,"")},goog.string.trim=goog.string.internal.trim,goog.string.trimLeft=function(e){return e.replace(/^[\s\xa0]+/,"")},goog.string.trimRight=function(e){return e.replace(/[\s\xa0]+$/,"")},goog.string.caseInsensitiveCompare=goog.string.internal.caseInsensitiveCompare,goog.string.numberAwareCompare_=function(t,r,n){if(t==r)return 0;if(!t)return-1;if(!r)return 1;for(var s=t.toLowerCase().match(n),i=r.toLowerCase().match(n),e=_Mathmin2(s.length,i.length),o=0;o",""":"\""},n=t?t.createElement("div"):goog.global.document.createElement("div");return e.replace(goog.string.HTML_ENTITY_PATTERN_,function(t,s){var a=r[t];return a?a:("#"==s.charAt(0)&&(s=+("0"+s.substr(1)),isNaN(s)||(a=_StringfromCharCode2(s))),a||(n.innerHTML=t+" ",a=n.firstChild.nodeValue.slice(0,-1)),r[t]=a)})},goog.string.unescapePureXmlEntities_=function(e){return e.replace(/&([^;]+);/g,function(e,t){return"amp"===t?"&":"lt"===t?"<":"gt"===t?">":"quot"===t?"\"":"#"!=t.charAt(0)||(t=+("0"+t.substr(1)),isNaN(t))?e:_StringfromCharCode2(t)})},goog.string.HTML_ENTITY_PATTERN_=/&([^;\s<&]+);?/g,goog.string.whitespaceEscape=function(e,t){return goog.string.newLineToBr(e.replace(/ /g,"  "),t)},goog.string.preserveSpaces=function(e){return e.replace(/(^|[\n ]) /g,"$1"+goog.string.Unicode.NBSP)},goog.string.stripQuotes=function(t,r){for(var n,s=r.length,a=0;at&&(e=e.substring(0,t-3)+"..."),r&&(e=goog.string.htmlEscape(e)),e},goog.string.truncateMiddle=function(t,r,n,s){if(n&&(t=goog.string.unescapeEntities(t)),s&&t.length>r){s>r&&(s=r);var i=t.length-s;t=t.substring(0,r-s)+"..."+t.substring(i)}else t.length>r&&(s=_Mathfloor(r/2),i=t.length-s,t=t.substring(0,s+r%2)+"..."+t.substring(i));return n&&(t=goog.string.htmlEscape(t)),t},goog.string.specialEscapeChars_={"":"\\0","":"\\b"," ":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"," ":"\\x0B",'"':"\\\"","\\":"\\\\","<":"<"},goog.string.jsEscapeCache_={"'":"\\'"},goog.string.quote=function(t){t+="";for(var r=["\""],n=0;ni?s:goog.string.escapeChar(s))}return r.push("\""),r.join("")},goog.string.escapeString=function(e){for(var t=[],r=0;rt)var r=e;else 256>t?(r="\\x",16>t||256t&&(r+="0")),r+=t.toString(16).toUpperCase();return goog.string.jsEscapeCache_[e]=r},goog.string.contains=goog.string.internal.contains,goog.string.caseInsensitiveContains=goog.string.internal.caseInsensitiveContains,goog.string.countOf=function(e,t){return e&&t?e.split(t).length-1:0},goog.string.removeAt=function(e,t,r){var n=e;return 0<=t&&t>>0;return t},goog.string.uniqueStringCounter_=0|2147483648*Math.random(),goog.string.createUniqueString=function(){return"goog_"+goog.string.uniqueStringCounter_++},goog.string.toNumber=function(e){var t=+e;return 0==t&&goog.string.isEmptyOrWhitespace(e)?NaN:t},goog.string.isLowerCamelCase=function(e){return /^[a-z]+([A-Z][a-z]*)*$/.test(e)},goog.string.isUpperCamelCase=function(e){return /^([A-Z][a-z]*)+$/.test(e)},goog.string.toCamelCase=function(e){return(e+"").replace(/\-([a-z])/g,function(e,t){return t.toUpperCase()})},goog.string.toSelectorCase=function(e){return(e+"").replace(/([A-Z])/g,"-$1").toLowerCase()},goog.string.toTitleCase=function(e,t){return t=goog.isString(t)?goog.string.regExpEscape(t):"\\s",e.replace(new RegExp("(^"+(t?"|["+t+"]+":"")+")([a-z])","g"),function(t,r,n){return r+n.toUpperCase()})},goog.string.capitalize=function(e){return(e.charAt(0)+"").toUpperCase()+(e.substr(1)+"").toLowerCase()},goog.string.parseInt=function(e){return isFinite(e)&&(e+=""),goog.isString(e)?/^\s*-?0x/i.test(e)?parseInt(e,16):parseInt(e,10):NaN},goog.string.splitLimit=function(e,t,r){e=e.split(t);for(var n=[];0n&&(n=a)}return-1==n?t:t.slice(n+1)},goog.string.editDistance=function(t,r){var n=[],s=[];if(t==r)return 0;if(!t.length||!r.length)return _Mathmax(t.length,r.length);for(var a=0;aparseFloat(e))?t+"":e},goog.userAgent.getVersionRegexResult_=function(){var e=goog.userAgent.getUserAgentString();return goog.userAgent.GECKO?/rv:([^\);]+)(\)|;)/.exec(e):goog.userAgent.EDGE?/Edge\/([\d\.]+)/.exec(e):goog.userAgent.IE?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(e):goog.userAgent.WEBKIT?/WebKit\/(\S+)/.exec(e):goog.userAgent.OPERA?/(?:Version)[ \/]?(\S+)/.exec(e):void 0},goog.userAgent.getDocumentMode_=function(){var e=goog.global.document;return e?e.documentMode:void 0},goog.userAgent.VERSION=goog.userAgent.determineVersion_(),goog.userAgent.compare=function(e,t){return goog.string.compareVersions(e,t)},goog.userAgent.isVersionOrHigherCache_={},goog.userAgent.isVersionOrHigher=function(e){return goog.userAgent.ASSUME_ANY_VERSION||goog.reflect.cache(goog.userAgent.isVersionOrHigherCache_,e,function(){return 0<=goog.string.compareVersions(goog.userAgent.VERSION,e)})},goog.userAgent.isVersion=goog.userAgent.isVersionOrHigher,goog.userAgent.isDocumentModeOrHigher=function(e){return+goog.userAgent.DOCUMENT_MODE>=e},goog.userAgent.isDocumentMode=goog.userAgent.isDocumentModeOrHigher,goog.userAgent.DOCUMENT_MODE=function(){var e=goog.global.document,t=goog.userAgent.getDocumentMode_();if(e&&goog.userAgent.IE)return t||("CSS1Compat"==e.compatMode?parseInt(goog.userAgent.VERSION,10):5)}(),goog.userAgent.product={},goog.userAgent.product.ASSUME_FIREFOX=!1,goog.userAgent.product.ASSUME_IPHONE=!1,goog.userAgent.product.ASSUME_IPAD=!1,goog.userAgent.product.ASSUME_ANDROID=!1,goog.userAgent.product.ASSUME_CHROME=!1,goog.userAgent.product.ASSUME_SAFARI=!1,goog.userAgent.product.PRODUCT_KNOWN_=goog.userAgent.ASSUME_IE||goog.userAgent.ASSUME_EDGE||goog.userAgent.ASSUME_OPERA||goog.userAgent.product.ASSUME_FIREFOX||goog.userAgent.product.ASSUME_IPHONE||goog.userAgent.product.ASSUME_IPAD||goog.userAgent.product.ASSUME_ANDROID||goog.userAgent.product.ASSUME_CHROME||goog.userAgent.product.ASSUME_SAFARI,goog.userAgent.product.OPERA=goog.userAgent.OPERA,goog.userAgent.product.IE=goog.userAgent.IE,goog.userAgent.product.EDGE=goog.userAgent.EDGE,goog.userAgent.product.FIREFOX=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_FIREFOX:goog.labs.userAgent.browser.isFirefox(),goog.userAgent.product.isIphoneOrIpod_=function(){return goog.labs.userAgent.platform.isIphone()||goog.labs.userAgent.platform.isIpod()},goog.userAgent.product.IPHONE=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_IPHONE:goog.userAgent.product.isIphoneOrIpod_(),goog.userAgent.product.IPAD=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_IPAD:goog.labs.userAgent.platform.isIpad(),goog.userAgent.product.ANDROID=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_ANDROID:goog.labs.userAgent.browser.isAndroidBrowser(),goog.userAgent.product.CHROME=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_CHROME:goog.labs.userAgent.browser.isChrome(),goog.userAgent.product.isSafariDesktop_=function(){return goog.labs.userAgent.browser.isSafari()&&!goog.labs.userAgent.platform.isIos()},goog.userAgent.product.SAFARI=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_SAFARI:goog.userAgent.product.isSafariDesktop_(),goog.crypt.base64={},goog.crypt.base64.byteToCharMap_=null,goog.crypt.base64.charToByteMap_=null,goog.crypt.base64.byteToCharMapWebSafe_=null,goog.crypt.base64.ENCODED_VALS_BASE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",goog.crypt.base64.ENCODED_VALS=goog.crypt.base64.ENCODED_VALS_BASE+"+/=",goog.crypt.base64.ENCODED_VALS_WEBSAFE=goog.crypt.base64.ENCODED_VALS_BASE+"-_.",goog.crypt.base64.ASSUME_NATIVE_SUPPORT_=goog.userAgent.GECKO||goog.userAgent.WEBKIT&&!goog.userAgent.product.SAFARI||goog.userAgent.OPERA,goog.crypt.base64.HAS_NATIVE_ENCODE_=goog.crypt.base64.ASSUME_NATIVE_SUPPORT_||"function"==typeof goog.global.btoa,goog.crypt.base64.HAS_NATIVE_DECODE_=goog.crypt.base64.ASSUME_NATIVE_SUPPORT_||!goog.userAgent.product.SAFARI&&!goog.userAgent.IE&&"function"==typeof goog.global.atob,goog.crypt.base64.encodeByteArray=function(t,r){goog.asserts.assert(goog.isArrayLike(t),"encodeByteArray takes an array as a parameter"),goog.crypt.base64.init_(),r=r?goog.crypt.base64.byteToCharMapWebSafe_:goog.crypt.base64.byteToCharMap_;for(var n=[],s=0;s>2;a=(3&a)<<4|o>>4,o=(15&o)<<2|c>>6,c&=63,p||(c=64,i||(o=64)),n.push(r[u],r[a],r[o],r[c])}return n.join("")},goog.crypt.base64.encodeString=function(e,t){return goog.crypt.base64.HAS_NATIVE_ENCODE_&&!t?goog.global.btoa(e):goog.crypt.base64.encodeByteArray(goog.crypt.stringToByteArray(e),t)},goog.crypt.base64.decodeString=function(e,t){if(goog.crypt.base64.HAS_NATIVE_DECODE_&&!t)return goog.global.atob(e);var r="";return goog.crypt.base64.decodeStringInternal_(e,function(e){r+=_StringfromCharCode2(e)}),r},goog.crypt.base64.decodeStringToByteArray=function(e){var t=[];return goog.crypt.base64.decodeStringInternal_(e,function(e){t.push(e)}),t},goog.crypt.base64.decodeStringToUint8Array=function(t){var r=Math.ceil;goog.asserts.assert(!goog.userAgent.IE||goog.userAgent.isVersionOrHigher("10"),"Browser does not support typed arrays");var n=t.length,s=0;"="===t[n-2]?s=2:"="===t[n-1]&&(s=1);var i=new Uint8Array(r(3*n/4)-s),o=0;return goog.crypt.base64.decodeStringInternal_(t,function(e){i[o++]=e}),i.subarray(0,o)},goog.crypt.base64.decodeStringInternal_=function(t,r){function n(r){for(;s>4),64!=i&&(r(240&e<<4|i>>2),64!=o&&r(192&i<<6|o))}},goog.crypt.base64.init_=function(){if(!goog.crypt.base64.byteToCharMap_){goog.crypt.base64.byteToCharMap_={},goog.crypt.base64.charToByteMap_={},goog.crypt.base64.byteToCharMapWebSafe_={};for(var e=0;e=goog.crypt.base64.ENCODED_VALS_BASE.length&&(goog.crypt.base64.charToByteMap_[goog.crypt.base64.ENCODED_VALS_WEBSAFE.charAt(e)]=e)}},jspb.utils={},jspb.utils.split64Low=0,jspb.utils.split64High=0,jspb.utils.splitUint64=function(e){var t=e>>>0;e=_Mathfloor((e-t)/jspb.BinaryConstants.TWO_TO_32)>>>0,jspb.utils.split64Low=t,jspb.utils.split64High=e},jspb.utils.splitInt64=function(e){var t=0>e;e=_Mathabs(e);var r=e>>>0;e=_Mathfloor((e-r)/jspb.BinaryConstants.TWO_TO_32),e>>>=0,t&&(e=~e>>>0,r=(~r>>>0)+1,4294967295e;e=2*_Mathabs(e),jspb.utils.splitUint64(e),e=jspb.utils.split64Low;var r=jspb.utils.split64High;t&&(0==e?0==r?r=e=4294967295:(r--,e=4294967295):e--),jspb.utils.split64Low=e,jspb.utils.split64High=r},jspb.utils.splitFloat32=function(e){var t=Math.round,r=0>e?1:0;if(e=r?-e:e,0===e)0<1/e?(jspb.utils.split64High=0,jspb.utils.split64Low=0):(jspb.utils.split64High=0,jspb.utils.split64Low=2147483648);else if(isNaN(e))jspb.utils.split64High=0,jspb.utils.split64Low=2147483647;else if(e>jspb.BinaryConstants.FLOAT32_MAX)jspb.utils.split64High=0,jspb.utils.split64Low=(2139095040|r<<31)>>>0;else if(e>>0;else{var n=_Mathfloor(_Mathlog(e)/_MathLN);e*=_Mathpow2(2,-n),e=8388607&t(e*jspb.BinaryConstants.TWO_TO_23),jspb.utils.split64High=0,jspb.utils.split64Low=(r<<31|n+127<<23|e)>>>0}},jspb.utils.splitFloat64=function(e){var t=0>e?1:0;if(e=t?-e:e,0===e)jspb.utils.split64High=0<1/e?0:2147483648,jspb.utils.split64Low=0;else if(isNaN(e))jspb.utils.split64High=2147483647,jspb.utils.split64Low=4294967295;else if(e>jspb.BinaryConstants.FLOAT64_MAX)jspb.utils.split64High=(2146435072|t<<31)>>>0,jspb.utils.split64Low=0;else if(e>>0,jspb.utils.split64Low=r>>>0}else{var n=_Mathfloor(_Mathlog(e)/_MathLN);1024==n&&(n=1023),r=e*_Mathpow2(2,-n),e=1048575&r*jspb.BinaryConstants.TWO_TO_20,r=r*jspb.BinaryConstants.TWO_TO_52>>>0,jspb.utils.split64High=(t<<31|n+1023<<20|e)>>>0,jspb.utils.split64Low=r}},jspb.utils.splitHash64=function(t){var r=t.charCodeAt(0),n=t.charCodeAt(1),s=t.charCodeAt(2),i=t.charCodeAt(3),e=t.charCodeAt(4),o=t.charCodeAt(5),d=t.charCodeAt(6);t=t.charCodeAt(7),jspb.utils.split64Low=r+(n<<8)+(s<<16)+(i<<24)>>>0,jspb.utils.split64High=e+(o<<8)+(d<<16)+(t<<24)>>>0},jspb.utils.joinUint64=function(e,t){return t*jspb.BinaryConstants.TWO_TO_32+e},jspb.utils.joinInt64=function(e,t){var r=2147483648&t;return r&&(e=~e+1>>>0,t=~t>>>0,0==e&&(t=t+1>>>0)),e=jspb.utils.joinUint64(e,t),r?-e:e},jspb.utils.joinZigzag64=function(e,t){var r=1&e;return e=(e>>>1|t<<31)>>>0,t>>>=1,r&&(e=e+1>>>0,0==e&&(t=t+1>>>0)),e=jspb.utils.joinUint64(e,t),r?-e:e},jspb.utils.joinFloat32=function(e,t){t=2*(e>>31)+1;var r=255&e>>>23;return e&=8388607,255==r?e?NaN:1/0*t:0==r?t*_Mathpow2(2,-149)*e:t*_Mathpow2(2,r-150)*(e+_Mathpow2(2,23))},jspb.utils.joinFloat64=function(e,t){var r=2*(t>>31)+1,n=2047&t>>>20;return e=jspb.BinaryConstants.TWO_TO_32*(1048575&t)+e,2047==n?e?NaN:1/0*r:0==n?r*_Mathpow2(2,-1074)*e:r*_Mathpow2(2,n-1075)*(e+jspb.BinaryConstants.TWO_TO_52)},jspb.utils.joinHash64=function(e,t){return _StringfromCharCode2(255&e>>>0,255&e>>>8,255&e>>>16,255&e>>>24,255&t>>>0,255&t>>>8,255&t>>>16,255&t>>>24)},jspb.utils.DIGITS=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],jspb.utils.joinUnsignedDecimalString=function(t,r){function n(t){for(var r=1E7,n=0;7>n;n++){r/=10;var s=t/r%10>>>0;(0!=s||e)&&(e=!0,o+=i[s])}}if(2097151>=r)return""+(jspb.BinaryConstants.TWO_TO_32*r+t);var s=16777215&(t>>>24|r<<8)>>>0;r=65535&r>>16,t=(16777215&t)+6777216*s+6710656*r,s+=8147497*r,r*=2,1E7<=t&&(s+=_Mathfloor(t/1E7),t%=1E7),1E7<=s&&(r+=_Mathfloor(s/1E7),s%=1E7);var i=jspb.utils.DIGITS,e=!1,o="";return(r||e)&&n(r),(s||e)&&n(s),(t||e)&&n(t),o},jspb.utils.joinSignedDecimalString=function(e,t){var r=2147483648&t;return r&&(e=~e+1>>>0,t=~t+(0==e?1:0)>>>0),e=jspb.utils.joinUnsignedDecimalString(e,t),r?"-"+e:e},jspb.utils.hash64ToDecimalString=function(e,t){jspb.utils.splitHash64(e),e=jspb.utils.split64Low;var r=jspb.utils.split64High;return t?jspb.utils.joinSignedDecimalString(e,r):jspb.utils.joinUnsignedDecimalString(e,r)},jspb.utils.hash64ArrayToDecimalStrings=function(e,t){for(var r=Array(e.length),n=0;nr&&(1!==e||0>>=8}function n(){for(var e=0;8>e;e++)i[e]=255&~i[e]}goog.asserts.assert(0n;n++)r=e.charCodeAt(7-n),t[2*n+2]=jspb.utils.DIGITS[r>>4],t[2*n+3]=jspb.utils.DIGITS[15&r];return t.join("")},jspb.utils.hexStringToHash64=function(t){t=t.toLowerCase(),goog.asserts.assert(18==t.length),goog.asserts.assert("0"==t[0]),goog.asserts.assert("x"==t[1]);for(var r="",n=0;8>n;n++){var s=jspb.utils.DIGITS.indexOf(t[2*n+2]),i=jspb.utils.DIGITS.indexOf(t[2*n+3]);r=_StringfromCharCode2(16*s+i)+r}return r},jspb.utils.hash64ToNumber=function(e,t){jspb.utils.splitHash64(e),e=jspb.utils.split64Low;var r=jspb.utils.split64High;return t?jspb.utils.joinInt64(e,r):jspb.utils.joinUint64(e,r)},jspb.utils.numberToHash64=function(e){return jspb.utils.splitInt64(e),jspb.utils.joinHash64(jspb.utils.split64Low,jspb.utils.split64High)},jspb.utils.countVarints=function(t,r,n){for(var s=0,a=r;a>7;return n-r-s},jspb.utils.countVarintFields=function(t,r,n,s){var a=0;if(s=8*s+jspb.BinaryConstants.WireType.VARINT,128>s)for(;r>=7}if(t[r++]!=i)break;for(a++;i=t[r++],0!=(128&i););}return a},jspb.utils.countFixedFields_=function(t,r,n,s,a){var e=0;if(128>s)for(;r>=7}if(t[r++]!=i)break;e++,r+=a}return e},jspb.utils.countFixed32Fields=function(e,t,r,n){return jspb.utils.countFixedFields_(e,t,r,8*n+jspb.BinaryConstants.WireType.FIXED32,4)},jspb.utils.countFixed64Fields=function(e,t,r,n){return jspb.utils.countFixedFields_(e,t,r,8*n+jspb.BinaryConstants.WireType.FIXED64,8)},jspb.utils.countDelimitedFields=function(t,r,n,s){var a=0;for(s=8*s+jspb.BinaryConstants.WireType.DELIMITED;r>=7}if(t[r++]!=i)break;a++;for(var o=0,l=1;i=t[r++],o+=(127&i)*l,l*=128,0!=(128&i););r+=o}return a},jspb.utils.debugBytesToTextFormat=function(e){var t="\"";if(e){e=jspb.utils.byteSourceToUint8Array(e);for(var r=0;re[r]&&(t+="0"),t+=e[r].toString(16)}return t+"\""},jspb.utils.debugScalarToTextFormat=function(e){return goog.isString(e)?goog.string.quote(e):e.toString()},jspb.utils.stringToByteArray=function(e){for(var t,r=new Uint8Array(e.length),n=0;njspb.BinaryIterator.instanceCache_.length&&jspb.BinaryIterator.instanceCache_.push(this)},jspb.BinaryIterator.prototype.clear=function(){this.decoder_&&this.decoder_.free(),this.elements_=this.nextMethod_=this.decoder_=null,this.cursor_=0,this.nextValue_=null,this.atEnd_=!0},jspb.BinaryIterator.prototype.get=function(){return this.nextValue_},jspb.BinaryIterator.prototype.atEnd=function(){return this.atEnd_},jspb.BinaryIterator.prototype.next=function(){var e=this.nextValue_;return this.decoder_?this.decoder_.atEnd()?(this.nextValue_=null,this.atEnd_=!0):this.nextValue_=this.nextMethod_.call(this.decoder_):this.elements_&&(this.cursor_==this.elements_.length?(this.nextValue_=null,this.atEnd_=!0):this.nextValue_=this.elements_[this.cursor_++]),e},jspb.BinaryDecoder=function(e,t,r){this.bytes_=null,this.tempHigh_=this.tempLow_=this.cursor_=this.end_=this.start_=0,this.error_=!1,e&&this.setBlock(e,t,r)},jspb.BinaryDecoder.instanceCache_=[],jspb.BinaryDecoder.alloc=function(e,t,r){if(jspb.BinaryDecoder.instanceCache_.length){var n=jspb.BinaryDecoder.instanceCache_.pop();return e&&n.setBlock(e,t,r),n}return new jspb.BinaryDecoder(e,t,r)},jspb.BinaryDecoder.prototype.free=function(){this.clear(),100>jspb.BinaryDecoder.instanceCache_.length&&jspb.BinaryDecoder.instanceCache_.push(this)},jspb.BinaryDecoder.prototype.clone=function(){return jspb.BinaryDecoder.alloc(this.bytes_,this.start_,this.end_-this.start_)},jspb.BinaryDecoder.prototype.clear=function(){this.bytes_=null,this.cursor_=this.end_=this.start_=0,this.error_=!1},jspb.BinaryDecoder.prototype.getBuffer=function(){return this.bytes_},jspb.BinaryDecoder.prototype.setBlock=function(e,t,r){this.bytes_=jspb.utils.byteSourceToUint8Array(e),this.start_=goog.isDef(t)?t:0,this.end_=goog.isDef(r)?this.start_+r:this.bytes_.length,this.cursor_=this.start_},jspb.BinaryDecoder.prototype.getEnd=function(){return this.end_},jspb.BinaryDecoder.prototype.setEnd=function(e){this.end_=e},jspb.BinaryDecoder.prototype.reset=function(){this.cursor_=this.start_},jspb.BinaryDecoder.prototype.getCursor=function(){return this.cursor_},jspb.BinaryDecoder.prototype.setCursor=function(e){this.cursor_=e},jspb.BinaryDecoder.prototype.advance=function(e){this.cursor_+=e,goog.asserts.assert(this.cursor_<=this.end_)},jspb.BinaryDecoder.prototype.atEnd=function(){return this.cursor_==this.end_},jspb.BinaryDecoder.prototype.pastEnd=function(){return this.cursor_>this.end_},jspb.BinaryDecoder.prototype.getError=function(){return this.error_||0>this.cursor_||this.cursor_>this.end_},jspb.BinaryDecoder.prototype.readSplitVarint64_=function(){for(var e,t,r=0,n=0;4>n;n++)if(e=this.bytes_[this.cursor_++],r|=(127&e)<<7*n,128>e)return this.tempLow_=r>>>0,void(this.tempHigh_=0);if(e=this.bytes_[this.cursor_++],r|=(127&e)<<28,t=0|(127&e)>>4,128>e)this.tempLow_=r>>>0,this.tempHigh_=t>>>0;else{for(n=0;5>n;n++)if(e=this.bytes_[this.cursor_++],t|=(127&e)<<7*n+3,128>e)return this.tempLow_=r>>>0,void(this.tempHigh_=t>>>0);goog.asserts.fail("Failed to read varint, encoding is invalid."),this.error_=!0}},jspb.BinaryDecoder.prototype.skipVarint=function(){for(;128&this.bytes_[this.cursor_];)this.cursor_++;this.cursor_++},jspb.BinaryDecoder.prototype.unskipVarint=function(e){for(;128>>=7;this.cursor_--},jspb.BinaryDecoder.prototype.readUnsignedVarint32=function(){var e=this.bytes_,t=e[this.cursor_+0],r=127&t;return 128>t?(this.cursor_+=1,goog.asserts.assert(this.cursor_<=this.end_),r):(t=e[this.cursor_+1],r|=(127&t)<<7,128>t)?(this.cursor_+=2,goog.asserts.assert(this.cursor_<=this.end_),r):(t=e[this.cursor_+2],r|=(127&t)<<14,128>t)?(this.cursor_+=3,goog.asserts.assert(this.cursor_<=this.end_),r):(t=e[this.cursor_+3],r|=(127&t)<<21,128>t)?(this.cursor_+=4,goog.asserts.assert(this.cursor_<=this.end_),r):(t=e[this.cursor_+4],r|=(15&t)<<28,128>t)?(this.cursor_+=5,goog.asserts.assert(this.cursor_<=this.end_),r>>>0):(this.cursor_+=5,128<=e[this.cursor_++]&&128<=e[this.cursor_++]&&128<=e[this.cursor_++]&&128<=e[this.cursor_++]&&128<=e[this.cursor_++]&&goog.asserts.assert(!1),goog.asserts.assert(this.cursor_<=this.end_),r)},jspb.BinaryDecoder.prototype.readSignedVarint32=jspb.BinaryDecoder.prototype.readUnsignedVarint32,jspb.BinaryDecoder.prototype.readUnsignedVarint32String=function(){return this.readUnsignedVarint32().toString()},jspb.BinaryDecoder.prototype.readSignedVarint32String=function(){return this.readSignedVarint32().toString()},jspb.BinaryDecoder.prototype.readZigzagVarint32=function(){var e=this.readUnsignedVarint32();return e>>>1^-(1&e)},jspb.BinaryDecoder.prototype.readUnsignedVarint64=function(){return this.readSplitVarint64_(),jspb.utils.joinUint64(this.tempLow_,this.tempHigh_)},jspb.BinaryDecoder.prototype.readUnsignedVarint64String=function(){return this.readSplitVarint64_(),jspb.utils.joinUnsignedDecimalString(this.tempLow_,this.tempHigh_)},jspb.BinaryDecoder.prototype.readSignedVarint64=function(){return this.readSplitVarint64_(),jspb.utils.joinInt64(this.tempLow_,this.tempHigh_)},jspb.BinaryDecoder.prototype.readSignedVarint64String=function(){return this.readSplitVarint64_(),jspb.utils.joinSignedDecimalString(this.tempLow_,this.tempHigh_)},jspb.BinaryDecoder.prototype.readZigzagVarint64=function(){return this.readSplitVarint64_(),jspb.utils.joinZigzag64(this.tempLow_,this.tempHigh_)},jspb.BinaryDecoder.prototype.readZigzagVarint64String=function(){return this.readZigzagVarint64().toString()},jspb.BinaryDecoder.prototype.readUint8=function(){var e=this.bytes_[this.cursor_+0];return this.cursor_+=1,goog.asserts.assert(this.cursor_<=this.end_),e},jspb.BinaryDecoder.prototype.readUint16=function(){var e=this.bytes_[this.cursor_+0],t=this.bytes_[this.cursor_+1];return this.cursor_+=2,goog.asserts.assert(this.cursor_<=this.end_),e<<0|t<<8},jspb.BinaryDecoder.prototype.readUint32=function(){var e=this.bytes_[this.cursor_+0],t=this.bytes_[this.cursor_+1],r=this.bytes_[this.cursor_+2],n=this.bytes_[this.cursor_+3];return this.cursor_+=4,goog.asserts.assert(this.cursor_<=this.end_),(e<<0|t<<8|r<<16|n<<24)>>>0},jspb.BinaryDecoder.prototype.readUint64=function(){var e=this.readUint32(),t=this.readUint32();return jspb.utils.joinUint64(e,t)},jspb.BinaryDecoder.prototype.readUint64String=function(){var e=this.readUint32(),t=this.readUint32();return jspb.utils.joinUnsignedDecimalString(e,t)},jspb.BinaryDecoder.prototype.readInt8=function(){var e=this.bytes_[this.cursor_+0];return this.cursor_+=1,goog.asserts.assert(this.cursor_<=this.end_),e<<24>>24},jspb.BinaryDecoder.prototype.readInt16=function(){var e=this.bytes_[this.cursor_+0],t=this.bytes_[this.cursor_+1];return this.cursor_+=2,goog.asserts.assert(this.cursor_<=this.end_),(e<<0|t<<8)<<16>>16},jspb.BinaryDecoder.prototype.readInt32=function(){var e=this.bytes_[this.cursor_+0],t=this.bytes_[this.cursor_+1],r=this.bytes_[this.cursor_+2],n=this.bytes_[this.cursor_+3];return this.cursor_+=4,goog.asserts.assert(this.cursor_<=this.end_),e<<0|t<<8|r<<16|n<<24},jspb.BinaryDecoder.prototype.readInt64=function(){var e=this.readUint32(),t=this.readUint32();return jspb.utils.joinInt64(e,t)},jspb.BinaryDecoder.prototype.readInt64String=function(){var e=this.readUint32(),t=this.readUint32();return jspb.utils.joinSignedDecimalString(e,t)},jspb.BinaryDecoder.prototype.readFloat=function(){var e=this.readUint32();return jspb.utils.joinFloat32(e,0)},jspb.BinaryDecoder.prototype.readDouble=function(){var e=this.readUint32(),t=this.readUint32();return jspb.utils.joinFloat64(e,t)},jspb.BinaryDecoder.prototype.readBool=function(){return!!this.bytes_[this.cursor_++]},jspb.BinaryDecoder.prototype.readEnum=function(){return this.readSignedVarint32()},jspb.BinaryDecoder.prototype.readString=function(t){var r=this.bytes_,n=this.cursor_;t=n+t;for(var s,i=[],o="";ns)i.push(s);else if(192>s)continue;else if(224>s){var d=r[n++];i.push((31&s)<<6|63&d)}else if(240>s){d=r[n++];var l=r[n++];i.push((15&s)<<12|(63&d)<<6|63&l)}else if(248>s){d=r[n++],l=r[n++];var p=r[n++];s=(7&s)<<18|(63&d)<<12|(63&l)<<6|63&p,s-=65536,i.push((1023&s>>10)+55296,(1023&s)+56320)}8192<=i.length&&(o+=_StringfromCharCode2.apply(null,i),i.length=0)}return o+=goog.crypt.byteArrayToString(i),this.cursor_=n,o},jspb.BinaryDecoder.prototype.readStringWithLength=function(){var e=this.readUnsignedVarint32();return this.readString(e)},jspb.BinaryDecoder.prototype.readBytes=function(e){if(0>e||this.cursor_+e>this.bytes_.length)return this.error_=!0,goog.asserts.fail("Invalid byte length!"),new Uint8Array(0);var t=this.bytes_.subarray(this.cursor_,this.cursor_+e);return this.cursor_+=e,goog.asserts.assert(this.cursor_<=this.end_),t},jspb.BinaryDecoder.prototype.readVarintHash64=function(){return this.readSplitVarint64_(),jspb.utils.joinHash64(this.tempLow_,this.tempHigh_)},jspb.BinaryDecoder.prototype.readFixedHash64=function(){var t=this.bytes_,r=this.cursor_,n=t[r+0],s=t[r+1],i=t[r+2],e=t[r+3],o=t[r+4],d=t[r+5],l=t[r+6];return t=t[r+7],this.cursor_+=8,_StringfromCharCode2(n,s,i,e,o,d,l,t)},jspb.BinaryReader=function(e,t,r){this.decoder_=jspb.BinaryDecoder.alloc(e,t,r),this.fieldCursor_=this.decoder_.getCursor(),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID,this.error_=!1,this.readCallbacks_=null},jspb.BinaryReader.instanceCache_=[],jspb.BinaryReader.alloc=function(e,t,r){if(jspb.BinaryReader.instanceCache_.length){var n=jspb.BinaryReader.instanceCache_.pop();return e&&n.decoder_.setBlock(e,t,r),n}return new jspb.BinaryReader(e,t,r)},jspb.BinaryReader.prototype.alloc=jspb.BinaryReader.alloc,jspb.BinaryReader.prototype.free=function(){this.decoder_.clear(),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID,this.error_=!1,this.readCallbacks_=null,100>jspb.BinaryReader.instanceCache_.length&&jspb.BinaryReader.instanceCache_.push(this)},jspb.BinaryReader.prototype.getFieldCursor=function(){return this.fieldCursor_},jspb.BinaryReader.prototype.getCursor=function(){return this.decoder_.getCursor()},jspb.BinaryReader.prototype.getBuffer=function(){return this.decoder_.getBuffer()},jspb.BinaryReader.prototype.getFieldNumber=function(){return this.nextField_},jspb.BinaryReader.prototype.getWireType=function(){return this.nextWireType_},jspb.BinaryReader.prototype.isEndGroup=function(){return this.nextWireType_==jspb.BinaryConstants.WireType.END_GROUP},jspb.BinaryReader.prototype.getError=function(){return this.error_||this.decoder_.getError()},jspb.BinaryReader.prototype.setBlock=function(e,t,r){this.decoder_.setBlock(e,t,r),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID},jspb.BinaryReader.prototype.reset=function(){this.decoder_.reset(),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID},jspb.BinaryReader.prototype.advance=function(e){this.decoder_.advance(e)},jspb.BinaryReader.prototype.nextField=function(){if(this.decoder_.atEnd())return!1;if(this.getError())return goog.asserts.fail("Decoder hit an error"),!1;this.fieldCursor_=this.decoder_.getCursor();var e=this.decoder_.readUnsignedVarint32(),t=e>>>3;return(e&=7,e!=jspb.BinaryConstants.WireType.VARINT&&e!=jspb.BinaryConstants.WireType.FIXED32&&e!=jspb.BinaryConstants.WireType.FIXED64&&e!=jspb.BinaryConstants.WireType.DELIMITED&&e!=jspb.BinaryConstants.WireType.START_GROUP&&e!=jspb.BinaryConstants.WireType.END_GROUP)?(goog.asserts.fail("Invalid wire type: %s (at position %s)",e,this.fieldCursor_),this.error_=!0,!1):(this.nextField_=t,this.nextWireType_=e,!0)},jspb.BinaryReader.prototype.unskipHeader=function(){this.decoder_.unskipVarint(this.nextField_<<3|this.nextWireType_)},jspb.BinaryReader.prototype.skipMatchingFields=function(){var e=this.nextField_;for(this.unskipHeader();this.nextField()&&this.getFieldNumber()==e;)this.skipField();this.decoder_.atEnd()||this.unskipHeader()},jspb.BinaryReader.prototype.skipVarintField=function(){this.nextWireType_==jspb.BinaryConstants.WireType.VARINT?this.decoder_.skipVarint():(goog.asserts.fail("Invalid wire type for skipVarintField"),this.skipField())},jspb.BinaryReader.prototype.skipDelimitedField=function(){if(this.nextWireType_!=jspb.BinaryConstants.WireType.DELIMITED)goog.asserts.fail("Invalid wire type for skipDelimitedField"),this.skipField();else{var e=this.decoder_.readUnsignedVarint32();this.decoder_.advance(e)}},jspb.BinaryReader.prototype.skipFixed32Field=function(){this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32?this.decoder_.advance(4):(goog.asserts.fail("Invalid wire type for skipFixed32Field"),this.skipField())},jspb.BinaryReader.prototype.skipFixed64Field=function(){this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64?this.decoder_.advance(8):(goog.asserts.fail("Invalid wire type for skipFixed64Field"),this.skipField())},jspb.BinaryReader.prototype.skipGroup=function(){var e=this.nextField_;do{if(!this.nextField()){goog.asserts.fail("Unmatched start-group tag: stream EOF"),this.error_=!0;break}if(this.nextWireType_==jspb.BinaryConstants.WireType.END_GROUP){this.nextField_!=e&&(goog.asserts.fail("Unmatched end-group tag"),this.error_=!0);break}this.skipField()}while(1)},jspb.BinaryReader.prototype.skipField=function(){switch(this.nextWireType_){case jspb.BinaryConstants.WireType.VARINT:this.skipVarintField();break;case jspb.BinaryConstants.WireType.FIXED64:this.skipFixed64Field();break;case jspb.BinaryConstants.WireType.DELIMITED:this.skipDelimitedField();break;case jspb.BinaryConstants.WireType.FIXED32:this.skipFixed32Field();break;case jspb.BinaryConstants.WireType.START_GROUP:this.skipGroup();break;default:goog.asserts.fail("Invalid wire encoding for field.");}},jspb.BinaryReader.prototype.registerReadCallback=function(e,t){goog.isNull(this.readCallbacks_)&&(this.readCallbacks_={}),goog.asserts.assert(!this.readCallbacks_[e]),this.readCallbacks_[e]=t},jspb.BinaryReader.prototype.runReadCallback=function(e){return goog.asserts.assert(!goog.isNull(this.readCallbacks_)),e=this.readCallbacks_[e],goog.asserts.assert(e),e(this)},jspb.BinaryReader.prototype.readAny=function(e){this.nextWireType_=jspb.BinaryConstants.FieldTypeToWireType(e);var t=jspb.BinaryConstants.FieldType;switch(e){case t.DOUBLE:return this.readDouble();case t.FLOAT:return this.readFloat();case t.INT64:return this.readInt64();case t.UINT64:return this.readUint64();case t.INT32:return this.readInt32();case t.FIXED64:return this.readFixed64();case t.FIXED32:return this.readFixed32();case t.BOOL:return this.readBool();case t.STRING:return this.readString();case t.GROUP:goog.asserts.fail("Group field type not supported in readAny()");case t.MESSAGE:goog.asserts.fail("Message field type not supported in readAny()");case t.BYTES:return this.readBytes();case t.UINT32:return this.readUint32();case t.ENUM:return this.readEnum();case t.SFIXED32:return this.readSfixed32();case t.SFIXED64:return this.readSfixed64();case t.SINT32:return this.readSint32();case t.SINT64:return this.readSint64();case t.FHASH64:return this.readFixedHash64();case t.VHASH64:return this.readVarintHash64();default:goog.asserts.fail("Invalid field type in readAny()");}return 0},jspb.BinaryReader.prototype.readMessage=function(e,t){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var r=this.decoder_.getEnd(),n=this.decoder_.readUnsignedVarint32();n=this.decoder_.getCursor()+n,this.decoder_.setEnd(n),t(e,this),this.decoder_.setCursor(n),this.decoder_.setEnd(r)},jspb.BinaryReader.prototype.readGroup=function(e,t,r){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.START_GROUP),goog.asserts.assert(this.nextField_==e),r(t,this),this.error_||this.nextWireType_==jspb.BinaryConstants.WireType.END_GROUP||(goog.asserts.fail("Group submessage did not end with an END_GROUP tag"),this.error_=!0)},jspb.BinaryReader.prototype.getFieldDecoder=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var e=this.decoder_.readUnsignedVarint32(),t=this.decoder_.getCursor(),r=t+e;return e=jspb.BinaryDecoder.alloc(this.decoder_.getBuffer(),t,e),this.decoder_.setCursor(r),e},jspb.BinaryReader.prototype.readInt32=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint32()},jspb.BinaryReader.prototype.readInt32String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint32String()},jspb.BinaryReader.prototype.readInt64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint64()},jspb.BinaryReader.prototype.readInt64String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint64String()},jspb.BinaryReader.prototype.readUint32=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint32()},jspb.BinaryReader.prototype.readUint32String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint32String()},jspb.BinaryReader.prototype.readUint64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint64()},jspb.BinaryReader.prototype.readUint64String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint64String()},jspb.BinaryReader.prototype.readSint32=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarint32()},jspb.BinaryReader.prototype.readSint64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarint64()},jspb.BinaryReader.prototype.readSint64String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarint64String()},jspb.BinaryReader.prototype.readFixed32=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readUint32()},jspb.BinaryReader.prototype.readFixed64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readUint64()},jspb.BinaryReader.prototype.readFixed64String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readUint64String()},jspb.BinaryReader.prototype.readSfixed32=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readInt32()},jspb.BinaryReader.prototype.readSfixed32String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readInt32().toString()},jspb.BinaryReader.prototype.readSfixed64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readInt64()},jspb.BinaryReader.prototype.readSfixed64String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readInt64String()},jspb.BinaryReader.prototype.readFloat=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readFloat()},jspb.BinaryReader.prototype.readDouble=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readDouble()},jspb.BinaryReader.prototype.readBool=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),!!this.decoder_.readUnsignedVarint32()},jspb.BinaryReader.prototype.readEnum=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint64()},jspb.BinaryReader.prototype.readString=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var e=this.decoder_.readUnsignedVarint32();return this.decoder_.readString(e)},jspb.BinaryReader.prototype.readBytes=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var e=this.decoder_.readUnsignedVarint32();return this.decoder_.readBytes(e)},jspb.BinaryReader.prototype.readVarintHash64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readVarintHash64()},jspb.BinaryReader.prototype.readFixedHash64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readFixedHash64()},jspb.BinaryReader.prototype.readPackedField_=function(e){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var t=this.decoder_.readUnsignedVarint32();t=this.decoder_.getCursor()+t;for(var r=[];this.decoder_.getCursor()r.length?n.length:r.length;for(t.getJsPbMessageId()&&(s[0]=t.getJsPbMessageId(),a=1);a>>1|(1&this.hi)<<31)>>>0,this.hi>>>1>>>0)},jspb.arith.UInt64.prototype.leftShift=function(){return new jspb.arith.UInt64(this.lo<<1>>>0,(this.hi<<1|this.lo>>>31)>>>0)},jspb.arith.UInt64.prototype.msb=function(){return!!(2147483648&this.hi)},jspb.arith.UInt64.prototype.lsb=function(){return!!(1&this.lo)},jspb.arith.UInt64.prototype.zero=function(){return 0==this.lo&&0==this.hi},jspb.arith.UInt64.prototype.add=function(e){return new jspb.arith.UInt64((4294967295&this.lo+e.lo)>>>0>>>0,((4294967295&this.hi+e.hi)>>>0)+(4294967296<=this.lo+e.lo?1:0)>>>0)},jspb.arith.UInt64.prototype.sub=function(e){return new jspb.arith.UInt64((4294967295&this.lo-e.lo)>>>0>>>0,((4294967295&this.hi-e.hi)>>>0)-(0>this.lo-e.lo?1:0)>>>0)},jspb.arith.UInt64.mul32x32=function(t,r){var n=65535&t;t>>>=16;var s=65535&r,i=r>>>16;for(r=n*s+65536*(65535&n*i)+65536*(65535&t*s),n=t*i+(n*i>>>16)+(t*s>>>16);4294967296<=r;)r-=4294967296,n+=1;return new jspb.arith.UInt64(r>>>0,n>>>0)},jspb.arith.UInt64.prototype.mul=function(e){var t=jspb.arith.UInt64.mul32x32(this.lo,e);return e=jspb.arith.UInt64.mul32x32(this.hi,e),e.hi=e.lo,e.lo=0,t.add(e)},jspb.arith.UInt64.prototype.div=function(e){if(0==e)return[];var t=new jspb.arith.UInt64(0,0),r=new jspb.arith.UInt64(this.lo,this.hi);e=new jspb.arith.UInt64(e,0);for(var n=new jspb.arith.UInt64(1,0);!e.msb();)e=e.leftShift(),n=n.leftShift();for(;!n.zero();)0>=e.cmp(r)&&(t=t.add(n),r=r.sub(e)),e=e.rightShift(),n=n.rightShift();return[t,r]},jspb.arith.UInt64.prototype.toString=function(){for(var e="",t=this;!t.zero();){t=t.div(10);var r=t[0];e=t[1].lo+e,t=r}return""==e&&(e="0"),e},jspb.arith.UInt64.fromString=function(t){for(var r=new jspb.arith.UInt64(0,0),n=new jspb.arith.UInt64(0,0),s=0;st[s]||"9">>0>>>0,((4294967295&this.hi+e.hi)>>>0)+(4294967296<=this.lo+e.lo?1:0)>>>0)},jspb.arith.Int64.prototype.sub=function(e){return new jspb.arith.Int64((4294967295&this.lo-e.lo)>>>0>>>0,((4294967295&this.hi-e.hi)>>>0)-(0>this.lo-e.lo?1:0)>>>0)},jspb.arith.Int64.prototype.clone=function(){return new jspb.arith.Int64(this.lo,this.hi)},jspb.arith.Int64.prototype.toString=function(){var e=0!=(2147483648&this.hi),t=new jspb.arith.UInt64(this.lo,this.hi);return e&&(t=new jspb.arith.UInt64(0,0).sub(t)),(e?"-":"")+t.toString()},jspb.arith.Int64.fromString=function(e){var t=0>>7|t<<25)>>>0,t>>>=7;this.buffer_.push(e)},jspb.BinaryEncoder.prototype.writeSplitFixed64=function(e,t){goog.asserts.assert(e==_Mathfloor(e)),goog.asserts.assert(t==_Mathfloor(t)),goog.asserts.assert(0<=e&&e>>=7;this.buffer_.push(e)},jspb.BinaryEncoder.prototype.writeSignedVarint32=function(e){if(goog.asserts.assert(e==_Mathfloor(e)),goog.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_31&&et;t++)this.buffer_.push(128|127&e),e>>=7;this.buffer_.push(1)}},jspb.BinaryEncoder.prototype.writeUnsignedVarint64=function(e){goog.asserts.assert(e==_Mathfloor(e)),goog.asserts.assert(0<=e&&e=-jspb.BinaryConstants.TWO_TO_63&&e=-jspb.BinaryConstants.TWO_TO_31&&e>31)>>>0)},jspb.BinaryEncoder.prototype.writeZigzagVarint64=function(e){goog.asserts.assert(e==_Mathfloor(e)),goog.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_63&&ee),this.buffer_.push(255&e>>>0)},jspb.BinaryEncoder.prototype.writeUint16=function(e){goog.asserts.assert(e==_Mathfloor(e)),goog.asserts.assert(0<=e&&65536>e),this.buffer_.push(255&e>>>0),this.buffer_.push(255&e>>>8)},jspb.BinaryEncoder.prototype.writeUint32=function(e){goog.asserts.assert(e==_Mathfloor(e)),goog.asserts.assert(0<=e&&e>>0),this.buffer_.push(255&e>>>8),this.buffer_.push(255&e>>>16),this.buffer_.push(255&e>>>24)},jspb.BinaryEncoder.prototype.writeUint64=function(e){goog.asserts.assert(e==_Mathfloor(e)),goog.asserts.assert(0<=e&&ee),this.buffer_.push(255&e>>>0)},jspb.BinaryEncoder.prototype.writeInt16=function(e){goog.asserts.assert(e==_Mathfloor(e)),goog.asserts.assert(-32768<=e&&32768>e),this.buffer_.push(255&e>>>0),this.buffer_.push(255&e>>>8)},jspb.BinaryEncoder.prototype.writeInt32=function(e){goog.asserts.assert(e==_Mathfloor(e)),goog.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_31&&e>>0),this.buffer_.push(255&e>>>8),this.buffer_.push(255&e>>>16),this.buffer_.push(255&e>>>24)},jspb.BinaryEncoder.prototype.writeInt64=function(e){goog.asserts.assert(e==_Mathfloor(e)),goog.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_63&&e=-jspb.BinaryConstants.TWO_TO_63&&+e=-jspb.BinaryConstants.FLOAT32_MAX&&e<=jspb.BinaryConstants.FLOAT32_MAX),jspb.utils.splitFloat32(e),this.writeUint32(jspb.utils.split64Low)},jspb.BinaryEncoder.prototype.writeDouble=function(e){goog.asserts.assert(e>=-jspb.BinaryConstants.FLOAT64_MAX&&e<=jspb.BinaryConstants.FLOAT64_MAX),jspb.utils.splitFloat64(e),this.writeUint32(jspb.utils.split64Low),this.writeUint32(jspb.utils.split64High)},jspb.BinaryEncoder.prototype.writeBool=function(e){goog.asserts.assert(goog.isBoolean(e)||goog.isNumber(e)),this.buffer_.push(e?1:0)},jspb.BinaryEncoder.prototype.writeEnum=function(e){goog.asserts.assert(e==_Mathfloor(e)),goog.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_31&&er)this.buffer_.push(r);else if(2048>r)this.buffer_.push(192|r>>6),this.buffer_.push(128|63&r);else if(65536>r)if(55296<=r&&56319>=r&&s+1=a&&(r=1024*(r-55296)+a-56320+65536,this.buffer_.push(240|r>>18),this.buffer_.push(128|63&r>>12),this.buffer_.push(128|63&r>>6),this.buffer_.push(128|63&r),s++)}else this.buffer_.push(224|r>>12),this.buffer_.push(128|63&r>>6),this.buffer_.push(128|63&r);return this.buffer_.length-n},jspb.BinaryWriter=function(){this.blocks_=[],this.totalLength_=0,this.encoder_=new jspb.BinaryEncoder,this.bookmarks_=[]},jspb.BinaryWriter.prototype.appendUint8Array_=function(e){var t=this.encoder_.end();this.blocks_.push(t),this.blocks_.push(e),this.totalLength_+=t.length+e.length},jspb.BinaryWriter.prototype.beginDelimited_=function(e){return this.writeFieldHeader_(e,jspb.BinaryConstants.WireType.DELIMITED),e=this.encoder_.end(),this.blocks_.push(e),this.totalLength_+=e.length,e.push(this.totalLength_),e},jspb.BinaryWriter.prototype.endDelimited_=function(e){var t=e.pop();for(t=this.totalLength_+this.encoder_.length()-t,goog.asserts.assert(0<=t);127>>=7,this.totalLength_++;e.push(t),this.totalLength_++},jspb.BinaryWriter.prototype.writeSerializedMessage=function(e,t,r){this.appendUint8Array_(e.subarray(t,r))},jspb.BinaryWriter.prototype.maybeWriteSerializedMessage=function(e,t,r){null!=e&&null!=t&&null!=r&&this.writeSerializedMessage(e,t,r)},jspb.BinaryWriter.prototype.reset=function(){this.blocks_=[],this.encoder_.end(),this.totalLength_=0,this.bookmarks_=[]},jspb.BinaryWriter.prototype.getResultBuffer=function(){goog.asserts.assert(0==this.bookmarks_.length);for(var t,r=new Uint8Array(this.totalLength_+this.encoder_.length()),n=this.blocks_,s=n.length,a=0,i=0;i=-jspb.BinaryConstants.TWO_TO_31&&t=-jspb.BinaryConstants.TWO_TO_31&&t=-jspb.BinaryConstants.TWO_TO_63&&t=-jspb.BinaryConstants.TWO_TO_31&&t=-jspb.BinaryConstants.TWO_TO_63&&t=-jspb.BinaryConstants.TWO_TO_63&&+t=-jspb.BinaryConstants.TWO_TO_31&&t=-jspb.BinaryConstants.TWO_TO_63&&t=-jspb.BinaryConstants.TWO_TO_31&&t>1,_=-7,h=n?o-1:0,f=n?-1:1,d=t[r+h];for(h+=f,p=d&(1<<-_)-1,d>>=-_,_+=c;0<_;p=256*p+t[r+h],h+=f,_-=8);for(g=p&(1<<-_)-1,p>>=-_,_+=a;0<_;g=256*g+t[r+h],h+=f,_-=8);if(0===p)p=1-y;else{if(p===u)return g?NaN:(d?-1:1)*(1/0);g+=l(2,a),p-=y}return(d?-1:1)*g*l(2,p-a)},r.write=function(t,r,p,g,u,y){var _,h,f,A=8*y-u-1,E=(1<>1,S=23===u?l(2,-24)-l(2,-77):0,T=g?0:y-1,I=g?1:-1,d=0>r||0===r&&0>1/r?1:0;for(r=a(r),isNaN(r)||r===1/0?(h=isNaN(r)?1:0,_=E):(_=o(s(r)/n),1>r*(f=l(2,-_))&&(_--,f*=2),r+=1<=_+b?S/f:S*l(2,1-b),2<=r*f&&(_++,f/=2),_+b>=E?(h=0,_=E):1<=_+b?(h=(r*f-1)*l(2,u),_+=b):(h=r*l(2,b-1)*l(2,u),_=0));8<=u;t[p+T]=255&h,T+=I,h/=256,u-=8);for(_=_<o[0]&&t[1]e)throw new RangeError("The value \""+e+"\" is invalid for option \"size\"")}function o(e,n,d){return a(e),0>=e?r(e):void 0===n?r(e):"string"==typeof d?r(e).fill(n,d):r(e).fill(n)}function l(e){return a(e),r(0>e?0:0|y(e))}function p(e,d){if(("string"!=typeof d||""===d)&&(d="utf8"),!n.isEncoding(d))throw new TypeError("Unknown encoding: "+d);var i=0|S(e,d),u=r(i),f=u.write(e,d);return f!==i&&(u=u.slice(0,f)),u}function c(e){for(var n=0>e.length?0:0|y(e.length),d=r(n),u=0;ud||e.byteLength=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647 .toString(16)+" bytes");return 0|e}function _(e){return+e!=e&&(e=0),n.alloc(+e)}function S(e,d){if(n.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||z(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError("The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. Received type "+typeof e);var i=e.length,u=2>>1;case"base64":return Y(e).length;default:if(f)return u?-1:k(e).length;d=(""+d).toLowerCase(),f=!0;}}function h(e,n,d){var i=!1;if((void 0===n||0>n)&&(n=0),n>this.length)return"";if((void 0===d||d>this.length)&&(d=this.length),0>=d)return"";if(d>>>=0,n>>>=0,d<=n)return"";for(e||(e="utf8");;)switch(e){case"hex":return D(this,n,d);case"utf8":case"utf-8":return w(this,n,d);case"ascii":return L(this,n,d);case"latin1":case"binary":return M(this,n,d);case"base64":return C(this,n,d);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,n,d);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0;}}function T(e,d,n){var u=e[d];e[d]=e[n],e[n]=u}function E(e,d,i,u,f){if(0===e.length)return-1;if("string"==typeof i?(u=i,i=0):2147483647i&&(i=-2147483648),i=+i,X(i)&&(i=f?0:e.length-1),0>i&&(i=e.length+i),i>=e.length){if(f)return-1;i=e.length-1}else if(0>i)if(f)i=0;else return-1;if("string"==typeof d&&(d=n.from(d,u)),n.isBuffer(d))return 0===d.length?-1:A(e,d,i,u,f);if("number"==typeof d)return d&=255,"function"==typeof Uint8Array.prototype.indexOf?f?Uint8Array.prototype.indexOf.call(e,d,i):Uint8Array.prototype.lastIndexOf.call(e,d,i):A(e,[d],i,u,f);throw new TypeError("val must be string, number or Buffer")}function A(e,n,d,u,f){function t(e,n){return 1===r?e[n]:e.readUInt16BE(n*r)}var r=1,s=e.length,a=n.length;if(void 0!==u&&(u=(u+"").toLowerCase(),"ucs2"===u||"ucs-2"===u||"utf16le"===u||"utf-16le"===u)){if(2>e.length||2>n.length)return-1;r=2,s/=2,a/=2,d/=2}var o;if(f){var l=-1;for(o=d;os&&(d=s-a),o=d;0<=o;o--){for(var p=!0,c=0;cf&&(u=f)):u=f;var t=n.length;u>t/2&&(u=t/2);for(var r=0,s;rr&&(s=r):2===a?(o=e[t+1],128==(192&o)&&(c=(31&r)<<6|63&o,127c||57343c&&(s=c))):void 0}null===s?(s=65533,a=1):65535>>10),s=56320|1023&s),u.push(s),t+=a}return B(u)}function B(e){var n=e.length;if(n<=4096)return t.apply(String,e);for(var d="",u=0;un)&&(n=0),(!d||0>d||d>u)&&(d=u);for(var f="",t=n;te)throw new RangeError("offset is not uint");if(e+n>d)throw new RangeError("Trying to access beyond buffer length")}function W(e,d,i,u,f,t){if(!n.isBuffer(e))throw new TypeError("\"buffer\" argument must be a Buffer instance");if(d>f||de.length)throw new RangeError("Index out of range")}function x(e,n,d,i){if(d+i>e.length)throw new RangeError("Index out of range");if(0>d)throw new RangeError("Index out of range")}function H(e,n,d,i,u){return n=+n,d>>>=0,u||x(e,n,d,4,34028234663852886e22,-34028234663852886e22),q.write(e,n,d,i,23,4),d+4}function v(e,n,d,i,u){return n=+n,d>>>=0,u||x(e,n,d,8,17976931348623157e292,-17976931348623157e292),q.write(e,n,d,i,52,8),d+8}function V(e){if(e=e.split("=")[0],e=e.trim().replace(J,""),2>e.length)return"";for(;0!=e.length%4;)e+="=";return e}function k(e,n){n=n||1/0;for(var d=e.length,u=null,f=[],t=0,r;tr){if(!u){if(56319r){-1<(n-=3)&&f.push(239,191,189),u=r;continue}r=(u-55296<<10|r-56320)+65536}else u&&-1<(n-=3)&&f.push(239,191,189);if(u=null,128>r){if(0>(n-=1))break;f.push(r)}else if(2048>r){if(0>(n-=2))break;f.push(192|r>>6,128|63&r)}else if(65536>r){if(0>(n-=3))break;f.push(224|r>>12,128|63&r>>6,128|63&r)}else if(1114112>r){if(0>(n-=4))break;f.push(240|r>>18,128|63&r>>12,128|63&r>>6,128|63&r)}else throw new Error("Invalid code point")}return f}function j(e){for(var n=[],d=0;d(n-=2));++u)f=e.charCodeAt(u),t=f>>8,r=f%256,d.push(r),d.push(t);return d}function Y(e){return Z.toByteArray(V(e))}function K(e,n,d,u){for(var f=0;f=n.length||f>=e.length);++f)n[f+d]=e[f];return f}function z(e,n){return e instanceof n||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===n.name}function X(e){return e!==e}var Z=e("base64-js"),q=e("ieee754"),$="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;d.Buffer=n,d.SlowBuffer=_,d.INSPECT_MAX_BYTES=50;d.kMaxLength=2147483647,n.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),n={foo:function(){return 42}};return Object.setPrototypeOf(n,Uint8Array.prototype),Object.setPrototypeOf(e,n),42===e.foo()}catch(n){return!1}}(),n.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(n.prototype,"parent",{enumerable:!0,get:function(){return n.isBuffer(this)?this.buffer:void 0}}),Object.defineProperty(n.prototype,"offset",{enumerable:!0,get:function(){return n.isBuffer(this)?this.byteOffset:void 0}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&n[Symbol.species]===n&&Object.defineProperty(n,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),n.poolSize=8192,n.from=function(e,n,d){return s(e,n,d)},Object.setPrototypeOf(n.prototype,Uint8Array.prototype),Object.setPrototypeOf(n,Uint8Array),n.alloc=function(e,n,d){return o(e,n,d)},n.allocUnsafe=function(e){return l(e)},n.allocUnsafeSlow=function(e){return l(e)},n.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==n.prototype},n.compare=function(e,d){if(z(e,Uint8Array)&&(e=n.from(e,e.offset,e.byteLength)),z(d,Uint8Array)&&(d=n.from(d,d.offset,d.byteLength)),!n.isBuffer(e)||!n.isBuffer(d))throw new TypeError("The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array");if(e===d)return 0;for(var u=e.length,t=d.length,r=0,s=f(u,t);rn&&(e+=" ... "),""},$&&(n.prototype[$]=n.prototype.inspect),n.prototype.compare=function(e,d,u,t,r){if(z(e,Uint8Array)&&(e=n.from(e,e.offset,e.byteLength)),!n.isBuffer(e))throw new TypeError("The \"target\" argument must be one of type Buffer or Uint8Array. Received type "+typeof e);if(void 0===d&&(d=0),void 0===u&&(u=e?e.length:0),void 0===t&&(t=0),void 0===r&&(r=this.length),0>d||u>e.length||0>t||r>this.length)throw new RangeError("out of range index");if(t>=r&&d>=u)return 0;if(t>=r)return-1;if(d>=u)return 1;if(d>>>=0,u>>>=0,t>>>=0,r>>>=0,this===e)return 0;for(var s=r-t,a=u-d,o=f(s,a),l=this.slice(t,r),p=e.slice(d,u),c=0;c>>=0,isFinite(d)?(d>>>=0,void 0===i&&(i="utf8")):(i=d,d=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var u=this.length-n;if((void 0===d||d>u)&&(d=u),0d||0>n)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var f=!1;;)switch(i){case"hex":return b(this,e,n,d);case"utf8":case"utf-8":return O(this,e,n,d);case"ascii":return R(this,e,n,d);case"latin1":case"binary":return I(this,e,n,d);case"base64":return N(this,e,n,d);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,e,n,d);default:if(f)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),f=!0;}},n.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};n.prototype.slice=function(e,d){var i=this.length;e=~~e,d=void 0===d?i:~~d,0>e?(e+=i,0>e&&(e=0)):e>i&&(e=i),0>d?(d+=i,0>d&&(d=0)):d>i&&(d=i),d>>=0,n>>>=0,d||F(e,n,this.length);for(var u=this[e],f=1,t=0;++t>>=0,n>>>=0,d||F(e,n,this.length);for(var i=this[e+--n],u=1;0>>=0,n||F(e,1,this.length),this[e]},n.prototype.readUInt16LE=function(e,n){return e>>>=0,n||F(e,2,this.length),this[e]|this[e+1]<<8},n.prototype.readUInt16BE=function(e,n){return e>>>=0,n||F(e,2,this.length),this[e]<<8|this[e+1]},n.prototype.readUInt32LE=function(e,n){return e>>>=0,n||F(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},n.prototype.readUInt32BE=function(e,n){return e>>>=0,n||F(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},n.prototype.readIntLE=function(e,n,d){e>>>=0,n>>>=0,d||F(e,n,this.length);for(var f=this[e],t=1,r=0;++r=t&&(f-=u(2,8*n)),f},n.prototype.readIntBE=function(e,n,d){e>>>=0,n>>>=0,d||F(e,n,this.length);for(var f=n,t=1,r=this[e+--f];0=t&&(r-=u(2,8*n)),r},n.prototype.readInt8=function(e,n){return e>>>=0,n||F(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},n.prototype.readInt16LE=function(e,n){e>>>=0,n||F(e,2,this.length);var d=this[e]|this[e+1]<<8;return 32768&d?4294901760|d:d},n.prototype.readInt16BE=function(e,n){e>>>=0,n||F(e,2,this.length);var d=this[e+1]|this[e]<<8;return 32768&d?4294901760|d:d},n.prototype.readInt32LE=function(e,n){return e>>>=0,n||F(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},n.prototype.readInt32BE=function(e,n){return e>>>=0,n||F(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},n.prototype.readFloatLE=function(e,n){return e>>>=0,n||F(e,4,this.length),q.read(this,e,!0,23,4)},n.prototype.readFloatBE=function(e,n){return e>>>=0,n||F(e,4,this.length),q.read(this,e,!1,23,4)},n.prototype.readDoubleLE=function(e,n){return e>>>=0,n||F(e,8,this.length),q.read(this,e,!0,52,8)},n.prototype.readDoubleBE=function(e,n){return e>>>=0,n||F(e,8,this.length),q.read(this,e,!1,52,8)},n.prototype.writeUIntLE=function(e,n,d,f){if(e=+e,n>>>=0,d>>>=0,!f){var t=u(2,8*d)-1;W(this,e,n,d,t,0)}var r=1,s=0;for(this[n]=255&e;++s>>=0,d>>>=0,!f){var t=u(2,8*d)-1;W(this,e,n,d,t,0)}var r=d-1,s=1;for(this[n+r]=255&e;0<=--r&&(s*=256);)this[n+r]=255&e/s;return n+d},n.prototype.writeUInt8=function(e,n,d){return e=+e,n>>>=0,d||W(this,e,n,1,255,0),this[n]=255&e,n+1},n.prototype.writeUInt16LE=function(e,n,d){return e=+e,n>>>=0,d||W(this,e,n,2,65535,0),this[n]=255&e,this[n+1]=e>>>8,n+2},n.prototype.writeUInt16BE=function(e,n,d){return e=+e,n>>>=0,d||W(this,e,n,2,65535,0),this[n]=e>>>8,this[n+1]=255&e,n+2},n.prototype.writeUInt32LE=function(e,n,d){return e=+e,n>>>=0,d||W(this,e,n,4,4294967295,0),this[n+3]=e>>>24,this[n+2]=e>>>16,this[n+1]=e>>>8,this[n]=255&e,n+4},n.prototype.writeUInt32BE=function(e,n,d){return e=+e,n>>>=0,d||W(this,e,n,4,4294967295,0),this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=255&e,n+4},n.prototype.writeIntLE=function(e,n,d,f){if(e=+e,n>>>=0,!f){var t=u(2,8*d-1);W(this,e,n,d,t-1,-t)}var r=0,s=1,a=0;for(this[n]=255&e;++re&&0===a&&0!==this[n+r-1]&&(a=1),this[n+r]=255&(e/s>>0)-a;return n+d},n.prototype.writeIntBE=function(e,n,d,f){if(e=+e,n>>>=0,!f){var t=u(2,8*d-1);W(this,e,n,d,t-1,-t)}var r=d-1,s=1,a=0;for(this[n+r]=255&e;0<=--r&&(s*=256);)0>e&&0===a&&0!==this[n+r+1]&&(a=1),this[n+r]=255&(e/s>>0)-a;return n+d},n.prototype.writeInt8=function(e,n,d){return e=+e,n>>>=0,d||W(this,e,n,1,127,-128),0>e&&(e=255+e+1),this[n]=255&e,n+1},n.prototype.writeInt16LE=function(e,n,d){return e=+e,n>>>=0,d||W(this,e,n,2,32767,-32768),this[n]=255&e,this[n+1]=e>>>8,n+2},n.prototype.writeInt16BE=function(e,n,d){return e=+e,n>>>=0,d||W(this,e,n,2,32767,-32768),this[n]=e>>>8,this[n+1]=255&e,n+2},n.prototype.writeInt32LE=function(e,n,d){return e=+e,n>>>=0,d||W(this,e,n,4,2147483647,-2147483648),this[n]=255&e,this[n+1]=e>>>8,this[n+2]=e>>>16,this[n+3]=e>>>24,n+4},n.prototype.writeInt32BE=function(e,n,d){return e=+e,n>>>=0,d||W(this,e,n,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=255&e,n+4},n.prototype.writeFloatLE=function(e,n,d){return H(this,e,n,!0,d)},n.prototype.writeFloatBE=function(e,n,d){return H(this,e,n,!1,d)},n.prototype.writeDoubleLE=function(e,n,d){return v(this,e,n,!0,d)},n.prototype.writeDoubleBE=function(e,n,d){return v(this,e,n,!1,d)},n.prototype.copy=function(e,d,u,f){if(!n.isBuffer(e))throw new TypeError("argument should be a Buffer");if(u||(u=0),f||0===f||(f=this.length),d>=e.length&&(d=e.length),d||(d=0),0d)throw new RangeError("targetStart out of bounds");if(0>u||u>=this.length)throw new RangeError("Index out of range");if(0>f)throw new RangeError("sourceEnd out of bounds");f>this.length&&(f=this.length),e.length-dt||"latin1"===f)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=+e);if(0>d||this.length>>=0,u=u===void 0?this.length:u>>>0,e||(e=0);var r;if("number"==typeof e)for(r=d;rd;++d){u=16*d;for(var f=0;16>f;++f)n[u+f]=e[d]+e[f]}return n}()}).call(this,e("buffer").Buffer)},{"base64-js":5,buffer:6,ieee754:8}],7:[function(require,module,exports){var _MathLN=Math.LN2,_Mathlog=Math.log,_Mathabs=Math.abs,_Mathpow2=Math.pow,_Mathmin2=Math.min,_Mathfloor=Math.floor,_StringfromCharCode3=String.fromCharCode;(function(global,Buffer){var _Stringprototype=String.prototype,_Mathmax=Math.max,$jscomp=$jscomp||{};$jscomp.scope={},$jscomp.findInternal=function(n,i,u){n instanceof String&&(n=n+"");for(var t=n.length,d=0,r;d=u}},"es6","es3"),$jscomp.polyfill("Array.prototype.find",function(e){return e?e:function(e,n){return $jscomp.findInternal(this,e,n).v}},"es6","es3"),$jscomp.polyfill("String.prototype.startsWith",function(e){return e?e:function(n,d){var i=$jscomp.checkStringArgs(this,n,"startsWith");n+="";var u=i.length,e=n.length;d=_Mathmax(0,_Mathmin2(0|d,i.length));for(var f=0;f=e}},"es6","es3"),$jscomp.polyfill("String.prototype.repeat",function(e){return e?e:function(e){var n=$jscomp.checkStringArgs(this,null,"repeat");if(0>e||1342177279>>=1)&&(n+=n);return i}},"es6","es3");var COMPILED=!0,goog=goog||{};goog.global=this||self,goog.isDef=function(e){return void 0!==e},goog.isString=function(e){return"string"==typeof e},goog.isBoolean=function(e){return"boolean"==typeof e},goog.isNumber=function(e){return"number"==typeof e},goog.exportPath_=function(e,n,i){e=e.split("."),i=i||goog.global,e[0]in i||"undefined"==typeof i.execScript||i.execScript("var "+e[0]);for(var u;e.length&&(u=e.shift());)!e.length&&goog.isDef(n)?i[u]=n:i=i[u]&&i[u]!==Object.prototype[u]?i[u]:i[u]={}},goog.define=function(e,n){return n},goog.FEATURESET_YEAR=2012,goog.DEBUG=!0,goog.LOCALE="en",goog.TRUSTED_SITE=!0,goog.STRICT_MODE_COMPATIBLE=!1,goog.DISALLOW_TEST_ONLY_CODE=!goog.DEBUG,goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING=!1,goog.provide=function(e){if(goog.isInModuleLoader_())throw Error("goog.provide cannot be used within a module.");goog.constructNamespace_(e)},goog.constructNamespace_=function(e,n){goog.exportPath_(e,n)},goog.getScriptNonce=function(e){return e&&e!=goog.global?goog.getScriptNonce_(e.document):(null===goog.cspNonce_&&(goog.cspNonce_=goog.getScriptNonce_(goog.global.document)),goog.cspNonce_)},goog.NONCE_PATTERN_=/^[\w+/_-]+[=]{0,2}$/,goog.cspNonce_=null,goog.getScriptNonce_=function(e){return(e=e.querySelector&&e.querySelector("script[nonce]"))&&(e=e.nonce||e.getAttribute("nonce"))&&goog.NONCE_PATTERN_.test(e)?e:""},goog.VALID_MODULE_RE_=/^[a-zA-Z_$][a-zA-Z0-9._$]*$/,goog.module=function(e){if(!goog.isString(e)||!e||-1==e.search(goog.VALID_MODULE_RE_))throw Error("Invalid module identifier");if(!goog.isInGoogModuleLoader_())throw Error("Module "+e+" has been loaded incorrectly. Note, modules cannot be loaded as normal scripts. They require some kind of pre-processing step. You're likely trying to load a module via a script tag or as a part of a concatenated bundle without rewriting the module. For more info see: https://github.com/google/closure-library/wiki/goog.module:-an-ES6-module-like-alternative-to-goog.provide.");if(goog.moduleLoaderState_.moduleName)throw Error("goog.module may only be called once per module.");goog.moduleLoaderState_.moduleName=e},goog.module.get=function(e){return goog.module.getInternal_(e)},goog.module.getInternal_=function(){return null},goog.ModuleType={ES6:"es6",GOOG:"goog"},goog.moduleLoaderState_=null,goog.isInModuleLoader_=function(){return goog.isInGoogModuleLoader_()||goog.isInEs6ModuleLoader_()},goog.isInGoogModuleLoader_=function(){return!!goog.moduleLoaderState_&&goog.moduleLoaderState_.type==goog.ModuleType.GOOG},goog.isInEs6ModuleLoader_=function(){if(goog.moduleLoaderState_&&goog.moduleLoaderState_.type==goog.ModuleType.ES6)return!0;var e=goog.global.$jscomp;return!!e&&!("function"!=typeof e.getCurrentModulePath)&&!!e.getCurrentModulePath()},goog.module.declareLegacyNamespace=function(){goog.moduleLoaderState_.declareLegacyNamespace=!0},goog.declareModuleId=function(e){if(goog.moduleLoaderState_)goog.moduleLoaderState_.moduleName=e;else{var n=goog.global.$jscomp;if(!n||"function"!=typeof n.getCurrentModulePath)throw Error("Module with namespace \""+e+"\" has been loaded incorrectly.");n=n.require(n.getCurrentModulePath()),goog.loadedModules_[e]={exports:n,type:goog.ModuleType.ES6,moduleId:e}}},goog.setTestOnly=function(e){if(goog.DISALLOW_TEST_ONLY_CODE)throw e=e||"",Error("Importing test-only code into non-debug environment"+(e?": "+e:"."))},goog.forwardDeclare=function(){},!0,goog.getObjectByName=function(e,n){e=e.split("."),n=n||goog.global;for(var d=0;d>>0),goog.uidCounter_=0,goog.getHashCode=goog.getUid,goog.removeHashCode=goog.removeUid,goog.cloneObject=function(e){var n=goog.typeOf(e);if("object"==n||"array"==n){if("function"==typeof e.clone)return e.clone();for(var d in n="array"==n?[]:{},e)n[d]=goog.cloneObject(e[d]);return n}return e},goog.bindNative_=function(e){return e.call.apply(e.bind,arguments)},goog.bindJs_=function(e,n){if(!e)throw Error();if(2d?_Mathmax(0,e.length+d):d,goog.isString(e))return goog.isString(n)&&1==n.length?e.indexOf(n,d):-1;for(;dd&&(d=_Mathmax(0,e.length+d)),goog.isString(e))return goog.isString(n)&&1==n.length?e.lastIndexOf(n,d):-1;for(;0<=d;d--)if(d in e&&e[d]===n)return d;return-1},goog.array.forEach=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.forEach)?function(e,n,d){goog.asserts.assert(null!=e.length),Array.prototype.forEach.call(e,n,d)}:function(n,i,u){for(var t=n.length,d=goog.isString(n)?n.split(""):n,e=0;en?null:goog.isString(e)?e.charAt(n):e[n]},goog.array.findIndex=function(n,i,u){for(var t=n.length,d=goog.isString(n)?n.split(""):n,e=0;en?null:goog.isString(e)?e.charAt(n):e[n]},goog.array.findIndexRight=function(n,i,u){var f=n.length,t=goog.isString(n)?n.split(""):n;for(--f;0<=f;f--)if(f in t&&i.call(u,t[f],f,n))return f;return-1},goog.array.contains=function(e,n){return 0<=goog.array.indexOf(e,n)},goog.array.isEmpty=function(e){return 0==e.length},goog.array.clear=function(e){if(!goog.isArray(e))for(var n=e.length-1;0<=n;n--)delete e[n];e.length=0},goog.array.insert=function(e,n){goog.array.contains(e,n)||e.push(n)},goog.array.insertAt=function(e,n,d){goog.array.splice(e,d,0,n)},goog.array.insertArrayAt=function(e,n,d){goog.partial(goog.array.splice,e,d,0).apply(null,n)},goog.array.insertBefore=function(e,n,i){var u;2==arguments.length||0>(u=goog.array.indexOf(e,i))?e.push(n):goog.array.insertAt(e,n,u)},goog.array.remove=function(e,n){n=goog.array.indexOf(e,n);var d;return(d=0<=n)&&goog.array.removeAt(e,n),d},goog.array.removeLast=function(e,n){return n=goog.array.lastIndexOf(e,n),!!(0<=n)&&(goog.array.removeAt(e,n),!0)},goog.array.removeAt=function(e,n){return goog.asserts.assert(null!=e.length),1==Array.prototype.splice.call(e,n,1).length},goog.array.removeIf=function(e,n,d){return n=goog.array.findIndex(e,n,d),!!(0<=n)&&(goog.array.removeAt(e,n),!0)},goog.array.removeAllIf=function(n,i,u){var t=0;return goog.array.forEachRight(n,function(d,e){i.call(u,d,e,n)&&goog.array.removeAt(n,e)&&t++}),t},goog.array.concat=function(){return Array.prototype.concat.apply([],arguments)},goog.array.join=function(){return Array.prototype.concat.apply([],arguments)},goog.array.toArray=function(e){var n=e.length;if(0=arguments.length?Array.prototype.slice.call(e,n):Array.prototype.slice.call(e,n,d)},goog.array.removeDuplicates=function(n,i,u){i=i||n;var t=function(e){return goog.isObject(e)?"o"+goog.getUid(e):(typeof e).charAt(0)+e};u=u||t,t={};for(var r=0,s=0;s>1,o=u?i.call(d,n[a],a,n):i(t,n[a]);0n?1:ed)&&(goog.array.insertAt(e,n,-(d+1)),!0)},goog.array.binaryRemove=function(e,n,d){return n=goog.array.binarySearch(e,n,d),!!(0<=n)&&goog.array.removeAt(e,n)},goog.array.bucket=function(n,i,u){for(var t={},d=0;du*(r-d))return[];if(0r;n+=u)t.push(n);return t},goog.array.repeat=function(e,n){for(var i=[],u=0;un&&Array.prototype.push.apply(e,e.splice(0,-n))),e},goog.array.moveItem=function(e,n,d){goog.asserts.assert(0<=n&&n>=8),i[u++]=t;return i},goog.crypt.byteArrayToString=function(e){if(8192>=e.length)return _StringfromCharCode3.apply(null,e);for(var n="",i=0,u;it?i[u++]=t:(2048>t?i[u++]=192|t>>6:(55296==(64512&t)&&f+1>18,i[u++]=128|63&t>>12):i[u++]=224|t>>12,i[u++]=128|63&t>>6),i[u++]=128|63&t);return i},goog.crypt.utf8ByteArrayToString=function(n){for(var i=[],u=0,t=0,r;ur)i[t++]=_StringfromCharCode3(r);else if(191r){var s=n[u++];i[t++]=_StringfromCharCode3((31&r)<<6|63&s)}else if(239r){s=n[u++];var a=n[u++],o=n[u++];r=((7&r)<<18|(63&s)<<12|(63&a)<<6|63&o)-65536,i[t++]=_StringfromCharCode3(55296+(r>>10)),i[t++]=_StringfromCharCode3(56320+(1023&r))}else s=n[u++],a=n[u++],i[t++]=_StringfromCharCode3((15&r)<<12|(63&s)<<6|63&a);return i.join("")},goog.crypt.xorByteArray=function(e,n){goog.asserts.assert(e.length==n.length,"XOR array lengths must match");for(var i=[],u=0;u":"
")},goog.string.internal.htmlEscape=function(e,n){if(n)e=e.replace(goog.string.internal.AMP_RE_,"&").replace(goog.string.internal.LT_RE_,"<").replace(goog.string.internal.GT_RE_,">").replace(goog.string.internal.QUOT_RE_,""").replace(goog.string.internal.SINGLE_QUOTE_RE_,"'").replace(goog.string.internal.NULL_RE_,"�");else{if(!goog.string.internal.ALL_RE_.test(e))return e;-1!=e.indexOf("&")&&(e=e.replace(goog.string.internal.AMP_RE_,"&")),-1!=e.indexOf("<")&&(e=e.replace(goog.string.internal.LT_RE_,"<")),-1!=e.indexOf(">")&&(e=e.replace(goog.string.internal.GT_RE_,">")),-1!=e.indexOf("\"")&&(e=e.replace(goog.string.internal.QUOT_RE_,""")),-1!=e.indexOf("'")&&(e=e.replace(goog.string.internal.SINGLE_QUOTE_RE_,"'")),-1!=e.indexOf("\0")&&(e=e.replace(goog.string.internal.NULL_RE_,"�"))}return e},goog.string.internal.AMP_RE_=/&/g,goog.string.internal.LT_RE_=//g,goog.string.internal.QUOT_RE_=/"/g,goog.string.internal.SINGLE_QUOTE_RE_=/'/g,goog.string.internal.NULL_RE_=/\x00/g,goog.string.internal.ALL_RE_=/[\x00&<>"']/,goog.string.internal.whitespaceEscape=function(e,n){return goog.string.internal.newLineToBr(e.replace(/ /g,"  "),n)},goog.string.internal.contains=function(e,n){return-1!=e.indexOf(n)},goog.string.internal.caseInsensitiveContains=function(e,n){return goog.string.internal.contains(e.toLowerCase(),n.toLowerCase())},goog.string.internal.compareVersions=function(n,i){var u=0;n=goog.string.internal.trim(n+"").split("."),i=goog.string.internal.trim(i+"").split(".");for(var t=_Mathmax(n.length,i.length),d=0;0==u&&dn?1:0},goog.string.TypedString=function(){},goog.string.Const=function(e,n){this.stringConstValueWithSecurityContract__googStringSecurityPrivate_=e===goog.string.Const.GOOG_STRING_CONSTRUCTOR_TOKEN_PRIVATE_&&n||"",this.STRING_CONST_TYPE_MARKER__GOOG_STRING_SECURITY_PRIVATE_=goog.string.Const.TYPE_MARKER_},goog.string.Const.prototype.implementsGoogStringTypedString=!0,goog.string.Const.prototype.getTypedStringValue=function(){return this.stringConstValueWithSecurityContract__googStringSecurityPrivate_},goog.string.Const.prototype.toString=function(){return"Const{"+this.stringConstValueWithSecurityContract__googStringSecurityPrivate_+"}"},goog.string.Const.unwrap=function(e){return e instanceof goog.string.Const&&e.constructor===goog.string.Const&&e.STRING_CONST_TYPE_MARKER__GOOG_STRING_SECURITY_PRIVATE_===goog.string.Const.TYPE_MARKER_?e.stringConstValueWithSecurityContract__googStringSecurityPrivate_:(goog.asserts.fail("expected object of type Const, got '"+e+"'"),"type_error:Const")},goog.string.Const.from=function(e){return new goog.string.Const(goog.string.Const.GOOG_STRING_CONSTRUCTOR_TOKEN_PRIVATE_,e)},goog.string.Const.TYPE_MARKER_={},goog.string.Const.GOOG_STRING_CONSTRUCTOR_TOKEN_PRIVATE_={},goog.string.Const.EMPTY=goog.string.Const.from(""),goog.fs={},goog.fs.url={},goog.fs.url.createObjectUrl=function(e){return goog.fs.url.getUrlObject_().createObjectURL(e)},goog.fs.url.revokeObjectUrl=function(e){goog.fs.url.getUrlObject_().revokeObjectURL(e)},goog.fs.url.getUrlObject_=function(){var e=goog.fs.url.findUrlObject_();if(null!=e)return e;throw Error("This browser doesn't seem to support blob URLs")},goog.fs.url.findUrlObject_=function(){return goog.isDef(goog.global.URL)&&goog.isDef(goog.global.URL.createObjectURL)?goog.global.URL:goog.isDef(goog.global.webkitURL)&&goog.isDef(goog.global.webkitURL.createObjectURL)?goog.global.webkitURL:goog.isDef(goog.global.createObjectURL)?goog.global:null},goog.fs.url.browserSupportsObjectUrls=function(){return null!=goog.fs.url.findUrlObject_()},goog.html={},goog.html.trustedtypes={},goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY=goog.TRUSTED_TYPES_POLICY_NAME?goog.createTrustedTypesPolicy(goog.TRUSTED_TYPES_POLICY_NAME+"#html"):null,goog.i18n={},goog.i18n.bidi={},goog.i18n.bidi.FORCE_RTL=!1,goog.i18n.bidi.IS_RTL=goog.i18n.bidi.FORCE_RTL||("ar"==goog.LOCALE.substring(0,2).toLowerCase()||"fa"==goog.LOCALE.substring(0,2).toLowerCase()||"he"==goog.LOCALE.substring(0,2).toLowerCase()||"iw"==goog.LOCALE.substring(0,2).toLowerCase()||"ps"==goog.LOCALE.substring(0,2).toLowerCase()||"sd"==goog.LOCALE.substring(0,2).toLowerCase()||"ug"==goog.LOCALE.substring(0,2).toLowerCase()||"ur"==goog.LOCALE.substring(0,2).toLowerCase()||"yi"==goog.LOCALE.substring(0,2).toLowerCase())&&(2==goog.LOCALE.length||"-"==goog.LOCALE.substring(2,3)||"_"==goog.LOCALE.substring(2,3))||3<=goog.LOCALE.length&&"ckb"==goog.LOCALE.substring(0,3).toLowerCase()&&(3==goog.LOCALE.length||"-"==goog.LOCALE.substring(3,4)||"_"==goog.LOCALE.substring(3,4))||7<=goog.LOCALE.length&&("-"==goog.LOCALE.substring(2,3)||"_"==goog.LOCALE.substring(2,3))&&("adlm"==goog.LOCALE.substring(3,7).toLowerCase()||"arab"==goog.LOCALE.substring(3,7).toLowerCase()||"hebr"==goog.LOCALE.substring(3,7).toLowerCase()||"nkoo"==goog.LOCALE.substring(3,7).toLowerCase()||"rohg"==goog.LOCALE.substring(3,7).toLowerCase()||"thaa"==goog.LOCALE.substring(3,7).toLowerCase())||8<=goog.LOCALE.length&&("-"==goog.LOCALE.substring(3,4)||"_"==goog.LOCALE.substring(3,4))&&("adlm"==goog.LOCALE.substring(4,8).toLowerCase()||"arab"==goog.LOCALE.substring(4,8).toLowerCase()||"hebr"==goog.LOCALE.substring(4,8).toLowerCase()||"nkoo"==goog.LOCALE.substring(4,8).toLowerCase()||"rohg"==goog.LOCALE.substring(4,8).toLowerCase()||"thaa"==goog.LOCALE.substring(4,8).toLowerCase()),goog.i18n.bidi.Format={LRE:"\u202A",RLE:"\u202B",PDF:"\u202C",LRM:"\u200E",RLM:"\u200F"},goog.i18n.bidi.Dir={LTR:1,RTL:-1,NEUTRAL:0},goog.i18n.bidi.RIGHT="right",goog.i18n.bidi.LEFT="left",goog.i18n.bidi.I18N_RIGHT=goog.i18n.bidi.IS_RTL?goog.i18n.bidi.LEFT:goog.i18n.bidi.RIGHT,goog.i18n.bidi.I18N_LEFT=goog.i18n.bidi.IS_RTL?goog.i18n.bidi.RIGHT:goog.i18n.bidi.LEFT,goog.i18n.bidi.toDir=function(e,n){return"number"==typeof e?0e?goog.i18n.bidi.Dir.RTL:n?null:goog.i18n.bidi.Dir.NEUTRAL:null==e?null:e?goog.i18n.bidi.Dir.RTL:goog.i18n.bidi.Dir.LTR},goog.i18n.bidi.ltrChars_="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0900-\u1FFF\u200E\u2C00-\uD801\uD804-\uD839\uD83C-\uDBFF\uF900-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",goog.i18n.bidi.rtlChars_="\u0591-\u06EF\u06FA-\u08FF\u200F\uD802-\uD803\uD83A-\uD83B\uFB1D-\uFDFF\uFE70-\uFEFC",goog.i18n.bidi.htmlSkipReg_=/<[^>]*>|&[^;]+;/g,goog.i18n.bidi.stripHtmlIfNeeded_=function(e,n){return n?e.replace(goog.i18n.bidi.htmlSkipReg_,""):e},goog.i18n.bidi.rtlCharReg_=new RegExp("["+goog.i18n.bidi.rtlChars_+"]"),goog.i18n.bidi.ltrCharReg_=new RegExp("["+goog.i18n.bidi.ltrChars_+"]"),goog.i18n.bidi.hasAnyRtl=function(e,n){return goog.i18n.bidi.rtlCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,n))},goog.i18n.bidi.hasRtlChar=goog.i18n.bidi.hasAnyRtl,goog.i18n.bidi.hasAnyLtr=function(e,n){return goog.i18n.bidi.ltrCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,n))},goog.i18n.bidi.ltrRe_=new RegExp("^["+goog.i18n.bidi.ltrChars_+"]"),goog.i18n.bidi.rtlRe_=new RegExp("^["+goog.i18n.bidi.rtlChars_+"]"),goog.i18n.bidi.isRtlChar=function(e){return goog.i18n.bidi.rtlRe_.test(e)},goog.i18n.bidi.isLtrChar=function(e){return goog.i18n.bidi.ltrRe_.test(e)},goog.i18n.bidi.isNeutralChar=function(e){return!goog.i18n.bidi.isLtrChar(e)&&!goog.i18n.bidi.isRtlChar(e)},goog.i18n.bidi.ltrDirCheckRe_=new RegExp("^[^"+goog.i18n.bidi.rtlChars_+"]*["+goog.i18n.bidi.ltrChars_+"]"),goog.i18n.bidi.rtlDirCheckRe_=new RegExp("^[^"+goog.i18n.bidi.ltrChars_+"]*["+goog.i18n.bidi.rtlChars_+"]"),goog.i18n.bidi.startsWithRtl=function(e,n){return goog.i18n.bidi.rtlDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,n))},goog.i18n.bidi.isRtlText=goog.i18n.bidi.startsWithRtl,goog.i18n.bidi.startsWithLtr=function(e,n){return goog.i18n.bidi.ltrDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,n))},goog.i18n.bidi.isLtrText=goog.i18n.bidi.startsWithLtr,goog.i18n.bidi.isRequiredLtrRe_=/^http:\/\/.*/,goog.i18n.bidi.isNeutralText=function(e,n){return e=goog.i18n.bidi.stripHtmlIfNeeded_(e,n),goog.i18n.bidi.isRequiredLtrRe_.test(e)||!goog.i18n.bidi.hasAnyLtr(e)&&!goog.i18n.bidi.hasAnyRtl(e)},goog.i18n.bidi.ltrExitDirCheckRe_=new RegExp("["+goog.i18n.bidi.ltrChars_+"][^"+goog.i18n.bidi.rtlChars_+"]*$"),goog.i18n.bidi.rtlExitDirCheckRe_=new RegExp("["+goog.i18n.bidi.rtlChars_+"][^"+goog.i18n.bidi.ltrChars_+"]*$"),goog.i18n.bidi.endsWithLtr=function(e,n){return goog.i18n.bidi.ltrExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,n))},goog.i18n.bidi.isLtrExitText=goog.i18n.bidi.endsWithLtr,goog.i18n.bidi.endsWithRtl=function(e,n){return goog.i18n.bidi.rtlExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(e,n))},goog.i18n.bidi.isRtlExitText=goog.i18n.bidi.endsWithRtl,goog.i18n.bidi.rtlLocalesRe_=/^(ar|ckb|dv|he|iw|fa|nqo|ps|sd|ug|ur|yi|.*[-_](Adlm|Arab|Hebr|Nkoo|Rohg|Thaa))(?!.*[-_](Latn|Cyrl)($|-|_))($|-|_)/i,goog.i18n.bidi.isRtlLanguage=function(e){return goog.i18n.bidi.rtlLocalesRe_.test(e)},goog.i18n.bidi.bracketGuardTextRe_=/(\(.*?\)+)|(\[.*?\]+)|(\{.*?\}+)|(<.*?>+)/g,goog.i18n.bidi.guardBracketInText=function(e,n){return n=(void 0===n?goog.i18n.bidi.hasAnyRtl(e):n)?goog.i18n.bidi.Format.RLM:goog.i18n.bidi.Format.LRM,e.replace(goog.i18n.bidi.bracketGuardTextRe_,n+"$&"+n)},goog.i18n.bidi.enforceRtlInHtml=function(e){return"<"==e.charAt(0)?e.replace(/<\w+/,"$& dir=rtl"):"\n"+e+""},goog.i18n.bidi.enforceRtlInText=function(e){return goog.i18n.bidi.Format.RLE+e+goog.i18n.bidi.Format.PDF},goog.i18n.bidi.enforceLtrInHtml=function(e){return"<"==e.charAt(0)?e.replace(/<\w+/,"$& dir=ltr"):"\n"+e+""},goog.i18n.bidi.enforceLtrInText=function(e){return goog.i18n.bidi.Format.LRE+e+goog.i18n.bidi.Format.PDF},goog.i18n.bidi.dimensionsRe_=/:\s*([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)/g,goog.i18n.bidi.leftRe_=/left/gi,goog.i18n.bidi.rightRe_=/right/gi,goog.i18n.bidi.tempRe_=/%%%%/g,goog.i18n.bidi.mirrorCSS=function(e){return e.replace(goog.i18n.bidi.dimensionsRe_,":$1 $4 $3 $2").replace(goog.i18n.bidi.leftRe_,"%%%%").replace(goog.i18n.bidi.rightRe_,goog.i18n.bidi.LEFT).replace(goog.i18n.bidi.tempRe_,goog.i18n.bidi.RIGHT)},goog.i18n.bidi.doubleQuoteSubstituteRe_=/([\u0591-\u05f2])"/g,goog.i18n.bidi.singleQuoteSubstituteRe_=/([\u0591-\u05f2])'/g,goog.i18n.bidi.normalizeHebrewQuote=function(e){return e.replace(goog.i18n.bidi.doubleQuoteSubstituteRe_,"$1\u05F4").replace(goog.i18n.bidi.singleQuoteSubstituteRe_,"$1\u05F3")},goog.i18n.bidi.wordSeparatorRe_=/\s+/,goog.i18n.bidi.hasNumeralsRe_=/[\d\u06f0-\u06f9]/,goog.i18n.bidi.rtlDetectionThreshold_=.4,goog.i18n.bidi.estimateDirection=function(n,i){var u=0,t=0,r=!1;for(n=goog.i18n.bidi.stripHtmlIfNeeded_(n,i).split(goog.i18n.bidi.wordSeparatorRe_),i=0;igoog.i18n.bidi.rtlDetectionThreshold_?goog.i18n.bidi.Dir.RTL:goog.i18n.bidi.Dir.LTR},goog.i18n.bidi.detectRtlDirectionality=function(e,n){return goog.i18n.bidi.estimateDirection(e,n)==goog.i18n.bidi.Dir.RTL},goog.i18n.bidi.setElementDirAndAlign=function(e,n){e&&(n=goog.i18n.bidi.toDir(n))&&(e.style.textAlign=n==goog.i18n.bidi.Dir.RTL?goog.i18n.bidi.RIGHT:goog.i18n.bidi.LEFT,e.dir=n==goog.i18n.bidi.Dir.RTL?"rtl":"ltr")},goog.i18n.bidi.setElementDirByTextDirectionality=function(e,n){switch(goog.i18n.bidi.estimateDirection(n)){case goog.i18n.bidi.Dir.LTR:e.dir="ltr";break;case goog.i18n.bidi.Dir.RTL:e.dir="rtl";break;default:e.removeAttribute("dir");}},goog.i18n.bidi.DirectionalString=function(){},goog.html.TrustedResourceUrl=function(){this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_="",this.trustedURL_=null,this.TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_},goog.html.TrustedResourceUrl.prototype.implementsGoogStringTypedString=!0,goog.html.TrustedResourceUrl.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_.toString()},goog.html.TrustedResourceUrl.prototype.implementsGoogI18nBidiDirectionalString=!0,goog.html.TrustedResourceUrl.prototype.getDirection=function(){return goog.i18n.bidi.Dir.LTR},goog.html.TrustedResourceUrl.prototype.cloneWithParams=function(e,n){var i=goog.html.TrustedResourceUrl.unwrap(this);i=goog.html.TrustedResourceUrl.URL_PARAM_PARSER_.exec(i);var u=i[3]||"";return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(i[1]+goog.html.TrustedResourceUrl.stringifyParams_("?",i[2]||"",e)+goog.html.TrustedResourceUrl.stringifyParams_("#",u,n))},goog.DEBUG&&(goog.html.TrustedResourceUrl.prototype.toString=function(){return"TrustedResourceUrl{"+this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_+"}"}),goog.html.TrustedResourceUrl.unwrap=function(e){return goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(e).toString()},goog.html.TrustedResourceUrl.unwrapTrustedScriptURL=function(e){return e instanceof goog.html.TrustedResourceUrl&&e.constructor===goog.html.TrustedResourceUrl&&e.TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?e.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_:(goog.asserts.fail("expected object of type TrustedResourceUrl, got '"+e+"' of type "+goog.typeOf(e)),"type_error:TrustedResourceUrl")},goog.html.TrustedResourceUrl.unwrapTrustedURL=function(e){return e.trustedURL_?e.trustedURL_:goog.html.TrustedResourceUrl.unwrap(e)},goog.html.TrustedResourceUrl.format=function(e,n){var d=goog.string.Const.unwrap(e);if(!goog.html.TrustedResourceUrl.BASE_URL_.test(d))throw Error("Invalid TrustedResourceUrl format: "+d);return e=d.replace(goog.html.TrustedResourceUrl.FORMAT_MARKER_,function(i,u){if(!Object.prototype.hasOwnProperty.call(n,u))throw Error("Found marker, \""+u+"\", in format string, \""+d+"\", but no valid label mapping found in args: "+JSON.stringify(n));return i=n[u],i instanceof goog.string.Const?goog.string.Const.unwrap(i):encodeURIComponent(i+"")}),goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.TrustedResourceUrl.FORMAT_MARKER_=/%{(\w+)}/g,goog.html.TrustedResourceUrl.BASE_URL_=/^((https:)?\/\/[0-9a-z.:[\]-]+\/|\/[^/\\]|[^:/\\%]+\/|[^:/\\%]*[?#]|about:blank#)/i,goog.html.TrustedResourceUrl.URL_PARAM_PARSER_=/^([^?#]*)(\?[^#]*)?(#[\s\S]*)?/,goog.html.TrustedResourceUrl.formatWithParams=function(e,n,i,u){return goog.html.TrustedResourceUrl.format(e,n).cloneWithParams(i,u)},goog.html.TrustedResourceUrl.fromConstant=function(e){return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(e))},goog.html.TrustedResourceUrl.fromConstants=function(e){for(var n="",d=0;dn.length?"&":"")+encodeURIComponent(t)+"="+encodeURIComponent(s+""))}return i},goog.html.SafeUrl=function(){this.privateDoNotAccessOrElseSafeUrlWrappedValue_="",this.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_},goog.html.SafeUrl.INNOCUOUS_STRING="about:invalid#zClosurez",goog.html.SafeUrl.prototype.implementsGoogStringTypedString=!0,goog.html.SafeUrl.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeUrlWrappedValue_.toString()},goog.html.SafeUrl.prototype.implementsGoogI18nBidiDirectionalString=!0,goog.html.SafeUrl.prototype.getDirection=function(){return goog.i18n.bidi.Dir.LTR},goog.DEBUG&&(goog.html.SafeUrl.prototype.toString=function(){return"SafeUrl{"+this.privateDoNotAccessOrElseSafeUrlWrappedValue_+"}"}),goog.html.SafeUrl.unwrap=function(e){return goog.html.SafeUrl.unwrapTrustedURL(e).toString()},goog.html.SafeUrl.unwrapTrustedURL=function(e){return e instanceof goog.html.SafeUrl&&e.constructor===goog.html.SafeUrl&&e.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_?e.privateDoNotAccessOrElseSafeUrlWrappedValue_:(goog.asserts.fail("expected object of type SafeUrl, got '"+e+"' of type "+goog.typeOf(e)),"type_error:SafeUrl")},goog.html.SafeUrl.fromConstant=function(e){return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(e))},goog.html.SAFE_MIME_TYPE_PATTERN_=/^(?:audio\/(?:3gpp2|3gpp|aac|L16|midi|mp3|mp4|mpeg|oga|ogg|opus|x-m4a|x-wav|wav|webm)|image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp|x-icon)|text\/csv|video\/(?:mpeg|mp4|ogg|webm|quicktime))(?:;\w+=(?:\w+|"[\w;=]+"))*$/i,goog.html.SafeUrl.isSafeMimeType=function(e){return goog.html.SAFE_MIME_TYPE_PATTERN_.test(e)},goog.html.SafeUrl.fromBlob=function(e){return e=goog.html.SAFE_MIME_TYPE_PATTERN_.test(e.type)?goog.fs.url.createObjectUrl(e):goog.html.SafeUrl.INNOCUOUS_STRING,goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.DATA_URL_PATTERN_=/^data:([^,]*);base64,[a-z0-9+\/]+=*$/i,goog.html.SafeUrl.fromDataUrl=function(e){e=e.replace(/(%0A|%0D)/g,"");var n=e.match(goog.html.DATA_URL_PATTERN_);return n=n&&goog.html.SAFE_MIME_TYPE_PATTERN_.test(n[1]),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(n?e:goog.html.SafeUrl.INNOCUOUS_STRING)},goog.html.SafeUrl.fromTelUrl=function(e){return goog.string.internal.caseInsensitiveStartsWith(e,"tel:")||(e=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SIP_URL_PATTERN_=/^sip[s]?:[+a-z0-9_.!$%&'*\/=^`{|}~-]+@([a-z0-9-]+\.)+[a-z0-9]{2,63}$/i,goog.html.SafeUrl.fromSipUrl=function(e){return goog.html.SIP_URL_PATTERN_.test(decodeURIComponent(e))||(e=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SafeUrl.fromFacebookMessengerUrl=function(e){return goog.string.internal.caseInsensitiveStartsWith(e,"fb-messenger://share")||(e=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SafeUrl.fromWhatsAppUrl=function(e){return goog.string.internal.caseInsensitiveStartsWith(e,"whatsapp://send")||(e=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SafeUrl.fromSmsUrl=function(e){return goog.string.internal.caseInsensitiveStartsWith(e,"sms:")&&goog.html.SafeUrl.isSmsUrlBodyValid_(e)||(e=goog.html.SafeUrl.INNOCUOUS_STRING),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(e)},goog.html.SafeUrl.isSmsUrlBodyValid_=function(e){var n=e.indexOf("#");if(0+~[\]()=^$|]+$/.test(d))throw Error("Selector allows only [-_a-zA-Z0-9#.:* ,>+~[\\]()=^$|] and strings, got: "+e);if(!goog.html.SafeStyleSheet.hasBalancedBrackets_(d))throw Error("() and [] in selector must be balanced, got: "+e);return n instanceof goog.html.SafeStyle||(n=goog.html.SafeStyle.create(n)),e=e+"{"+goog.html.SafeStyle.unwrap(n).replace(/.");if(e.toUpperCase()in goog.html.SafeHtml.NOT_ALLOWED_TAG_NAMES_)throw Error("Tag name <"+e+"> is not allowed for SafeHtml.")},goog.html.SafeHtml.createIframe=function(n,i,u,f){n&&goog.html.TrustedResourceUrl.unwrap(n);var d={};return d.src=n||null,d.srcdoc=i&&goog.html.SafeHtml.unwrap(i),n=goog.html.SafeHtml.combineAttributes(d,{sandbox:""},u),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("iframe",n,f)},goog.html.SafeHtml.createSandboxIframe=function(n,i,u,f){if(!goog.html.SafeHtml.canUseSandboxIframe())throw Error("The browser does not support sandboxed iframes.");var d={};return d.src=n?goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitize(n)):null,d.srcdoc=i||null,d.sandbox="",n=goog.html.SafeHtml.combineAttributes(d,{},u),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("iframe",n,f)},goog.html.SafeHtml.canUseSandboxIframe=function(){return goog.global.HTMLIFrameElement&&"sandbox"in goog.global.HTMLIFrameElement.prototype},goog.html.SafeHtml.createScriptSrc=function(e,n){return goog.html.TrustedResourceUrl.unwrap(e),e=goog.html.SafeHtml.combineAttributes({src:e},{},n),goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("script",e)},goog.html.SafeHtml.createScript=function(e,n){for(var i in n){var u=i.toLowerCase();if("language"==u||"src"==u||"text"==u||"type"==u)throw Error("Cannot set \""+u+"\" attribute")}for(i="",e=goog.array.concat(e),u=0;u does not allow content."),t+=">"):(f=goog.html.SafeHtml.concat(u),t+=">"+goog.html.SafeHtml.unwrap(f)+"",f=f.getDirection()),(n=i&&i.dir)&&(f=/^(ltr|rtl|auto)$/i.test(n)?goog.i18n.bidi.Dir.NEUTRAL:null),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(t,f)},goog.html.SafeHtml.stringifyAttributes=function(n,i){var u="";if(i)for(var f in i){if(!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(f))throw Error("Invalid attribute name \""+f+"\".");var d=i[f];goog.isDefAndNotNull(d)&&(u+=" "+goog.html.SafeHtml.getAttrNameAndValue_(n,f,d))}return u},goog.html.SafeHtml.combineAttributes=function(n,i,u){var t={},d;for(d in n)goog.asserts.assert(d.toLowerCase()==d,"Must be lower case"),t[d]=n[d];for(d in i)goog.asserts.assert(d.toLowerCase()==d,"Must be lower case"),t[d]=i[d];for(d in u){var r=d.toLowerCase();if(r in n)throw Error("Cannot override \""+r+"\" attribute, got \""+d+"\" with value \""+u[d]+"\"");r in i&&delete t[r],t[d]=u[d]}return t},goog.html.SafeHtml.DOCTYPE_HTML=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("",goog.i18n.bidi.Dir.NEUTRAL),goog.html.SafeHtml.EMPTY=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("",goog.i18n.bidi.Dir.NEUTRAL),goog.html.SafeHtml.BR=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("
",goog.i18n.bidi.Dir.NEUTRAL),goog.html.uncheckedconversions={},goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract=function(e,n,d){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(n,d||null)},goog.html.uncheckedconversions.safeScriptFromStringKnownToSatisfyTypeContract=function(e,n){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(n)},goog.html.uncheckedconversions.safeStyleFromStringKnownToSatisfyTypeContract=function(e,n){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(n)},goog.html.uncheckedconversions.safeStyleSheetFromStringKnownToSatisfyTypeContract=function(e,n){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(n)},goog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract=function(e,n){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(n)},goog.html.uncheckedconversions.trustedResourceUrlFromStringKnownToSatisfyTypeContract=function(e,n){return goog.asserts.assertString(goog.string.Const.unwrap(e),"must provide justification"),goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(e)),"must provide non-empty justification"),goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(n)},goog.dom.asserts={},goog.dom.asserts.assertIsLocation=function(e){if(goog.asserts.ENABLE_ASSERTS){var n=goog.dom.asserts.getWindow_(e);n&&(!e||!(e instanceof n.Location)&&e instanceof n.Element)&&goog.asserts.fail("Argument is not a Location (or a non-Element mock); got: %s",goog.dom.asserts.debugStringForType_(e))}return e},goog.dom.asserts.assertIsElementType_=function(e,n){if(goog.asserts.ENABLE_ASSERTS){var d=goog.dom.asserts.getWindow_(e);d&&"undefined"!=typeof d[n]&&(e&&(e instanceof d[n]||!(e instanceof d.Location||e instanceof d.Element))||goog.asserts.fail("Argument is not a %s (or a non-Element, non-Location mock); got: %s",n,goog.dom.asserts.debugStringForType_(e)))}return e},goog.dom.asserts.assertIsHTMLAnchorElement=function(e){return goog.dom.asserts.assertIsElementType_(e,"HTMLAnchorElement")},goog.dom.asserts.assertIsHTMLButtonElement=function(e){return goog.dom.asserts.assertIsElementType_(e,"HTMLButtonElement")},goog.dom.asserts.assertIsHTMLLinkElement=function(e){return goog.dom.asserts.assertIsElementType_(e,"HTMLLinkElement")},goog.dom.asserts.assertIsHTMLImageElement=function(e){return goog.dom.asserts.assertIsElementType_(e,"HTMLImageElement")},goog.dom.asserts.assertIsHTMLAudioElement=function(e){return goog.dom.asserts.assertIsElementType_(e,"HTMLAudioElement")},goog.dom.asserts.assertIsHTMLVideoElement=function(e){return goog.dom.asserts.assertIsElementType_(e,"HTMLVideoElement")},goog.dom.asserts.assertIsHTMLInputElement=function(e){return goog.dom.asserts.assertIsElementType_(e,"HTMLInputElement")},goog.dom.asserts.assertIsHTMLTextAreaElement=function(e){return goog.dom.asserts.assertIsElementType_(e,"HTMLTextAreaElement")},goog.dom.asserts.assertIsHTMLCanvasElement=function(e){return goog.dom.asserts.assertIsElementType_(e,"HTMLCanvasElement")},goog.dom.asserts.assertIsHTMLEmbedElement=function(e){return goog.dom.asserts.assertIsElementType_(e,"HTMLEmbedElement")},goog.dom.asserts.assertIsHTMLFormElement=function(e){return goog.dom.asserts.assertIsElementType_(e,"HTMLFormElement")},goog.dom.asserts.assertIsHTMLFrameElement=function(e){return goog.dom.asserts.assertIsElementType_(e,"HTMLFrameElement")},goog.dom.asserts.assertIsHTMLIFrameElement=function(e){return goog.dom.asserts.assertIsElementType_(e,"HTMLIFrameElement")},goog.dom.asserts.assertIsHTMLObjectElement=function(e){return goog.dom.asserts.assertIsElementType_(e,"HTMLObjectElement")},goog.dom.asserts.assertIsHTMLScriptElement=function(e){return goog.dom.asserts.assertIsElementType_(e,"HTMLScriptElement")},goog.dom.asserts.debugStringForType_=function(e){if(goog.isObject(e))try{return e.constructor.displayName||e.constructor.name||Object.prototype.toString.call(e)}catch(e){return""}else return void 0===e?"undefined":null===e?"null":typeof e},goog.dom.asserts.getWindow_=function(e){try{var n=e&&e.ownerDocument,d=n&&(n.defaultView||n.parentWindow);if(d=d||goog.global,d.Element&&d.Location)return d}catch(e){}return null},goog.functions={},goog.functions.constant=function(e){return function(){return e}},goog.functions.FALSE=function(){return!1},goog.functions.TRUE=function(){return!0},goog.functions.NULL=function(){return null},goog.functions.identity=function(e){return e},goog.functions.error=function(e){return function(){throw Error(e)}},goog.functions.fail=function(e){return function(){throw e}},goog.functions.lock=function(e,n){return n=n||0,function(){return e.apply(this,Array.prototype.slice.call(arguments,0,n))}},goog.functions.nth=function(e){return function(){return arguments[e]}},goog.functions.partialRight=function(e){var n=Array.prototype.slice.call(arguments,1);return function(){var d=Array.prototype.slice.call(arguments);return d.push.apply(d,n),e.apply(this,d)}},goog.functions.withReturnValue=function(e,n){return goog.functions.sequence(e,goog.functions.constant(n))},goog.functions.equalTo=function(e,n){return function(d){return n?e==d:e===d}},goog.functions.compose=function(){var e=arguments,n=e.length;return function(){var d;n&&(d=e[n-1].apply(this,arguments));for(var i=n-2;0<=i;i--)d=e[i].call(this,d);return d}},goog.functions.sequence=function(){var n=arguments,d=n.length;return function(){for(var i=0,u;i=e||"\x80"<=e&&"\uFFFD">=e},goog.string.stripNewlines=function(e){return e.replace(/(\r\n|\r|\n)+/g," ")},goog.string.canonicalizeNewlines=function(e){return e.replace(/(\r\n|\r|\n)/g,"\n")},goog.string.normalizeWhitespace=function(e){return e.replace(/\xa0|\s/g," ")},goog.string.normalizeSpaces=function(e){return e.replace(/\xa0|[ \t]+/g," ")},goog.string.collapseBreakingSpaces=function(e){return e.replace(/[\t\r\n ]+/g," ").replace(/^[\t\r\n ]+|[\t\r\n ]+$/g,"")},goog.string.trim=goog.string.internal.trim,goog.string.trimLeft=function(e){return e.replace(/^[\s\xa0]+/,"")},goog.string.trimRight=function(e){return e.replace(/[\s\xa0]+$/,"")},goog.string.caseInsensitiveCompare=goog.string.internal.caseInsensitiveCompare,goog.string.numberAwareCompare_=function(n,i,u){if(n==i)return 0;if(!n)return-1;if(!i)return 1;for(var t=n.toLowerCase().match(u),d=i.toLowerCase().match(u),e=_Mathmin2(t.length,d.length),f=0;f",""":"\""},u=n?n.createElement("div"):goog.global.document.createElement("div");return e.replace(goog.string.HTML_ENTITY_PATTERN_,function(n,d){var f=i[n];return f?f:("#"==d.charAt(0)&&(d=+("0"+d.substr(1)),isNaN(d)||(f=_StringfromCharCode3(d))),f||(goog.dom.safe.setInnerHtml(u,goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Single HTML entity."),n+" ")),f=u.firstChild.nodeValue.slice(0,-1)),i[n]=f)})},goog.string.unescapePureXmlEntities_=function(e){return e.replace(/&([^;]+);/g,function(e,n){return"amp"===n?"&":"lt"===n?"<":"gt"===n?">":"quot"===n?"\"":"#"!=n.charAt(0)||(n=+("0"+n.substr(1)),isNaN(n))?e:_StringfromCharCode3(n)})},goog.string.HTML_ENTITY_PATTERN_=/&([^;\s<&]+);?/g,goog.string.whitespaceEscape=function(e,n){return goog.string.newLineToBr(e.replace(/ /g,"  "),n)},goog.string.preserveSpaces=function(e){return e.replace(/(^|[\n ]) /g,"$1"+goog.string.Unicode.NBSP)},goog.string.stripQuotes=function(n,i){for(var u=i.length,f=0,t;fn&&(e=e.substring(0,n-3)+"..."),d&&(e=goog.string.htmlEscape(e)),e},goog.string.truncateMiddle=function(n,i,u,f){if(u&&(n=goog.string.unescapeEntities(n)),f&&n.length>i){f>i&&(f=i);var t=n.length-f;n=n.substring(0,i-f)+"..."+n.substring(t)}else n.length>i&&(f=_Mathfloor(i/2),t=n.length-f,n=n.substring(0,f+i%2)+"..."+n.substring(t));return u&&(n=goog.string.htmlEscape(n)),n},goog.string.specialEscapeChars_={"":"\\0","":"\\b"," ":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"," ":"\\x0B",'"':"\\\"","\\":"\\\\","<":"\\u003C"},goog.string.jsEscapeCache_={"'":"\\'"},goog.string.quote=function(n){n+="";for(var i=["\""],u=0;ud?f:goog.string.escapeChar(f))}return i.push("\""),i.join("")},goog.string.escapeString=function(e){for(var n=[],d=0;dn)var d=e;else 256>n?(d="\\x",16>n||256n&&(d+="0")),d+=n.toString(16).toUpperCase();return goog.string.jsEscapeCache_[e]=d},goog.string.contains=goog.string.internal.contains,goog.string.caseInsensitiveContains=goog.string.internal.caseInsensitiveContains,goog.string.countOf=function(e,n){return e&&n?e.split(n).length-1:0},goog.string.removeAt=function(e,n,i){var u=e;return 0<=n&&n>>0;return n},goog.string.uniqueStringCounter_=0|2147483648*Math.random(),goog.string.createUniqueString=function(){return"goog_"+goog.string.uniqueStringCounter_++},goog.string.toNumber=function(e){var n=+e;return 0==n&&goog.string.isEmptyOrWhitespace(e)?NaN:n},goog.string.isLowerCamelCase=function(e){return /^[a-z]+([A-Z][a-z]*)*$/.test(e)},goog.string.isUpperCamelCase=function(e){return /^([A-Z][a-z]*)+$/.test(e)},goog.string.toCamelCase=function(e){return(e+"").replace(/\-([a-z])/g,function(e,n){return n.toUpperCase()})},goog.string.toSelectorCase=function(e){return(e+"").replace(/([A-Z])/g,"-$1").toLowerCase()},goog.string.toTitleCase=function(e,n){return n=goog.isString(n)?goog.string.regExpEscape(n):"\\s",e.replace(new RegExp("(^"+(n?"|["+n+"]+":"")+")([a-z])","g"),function(n,d,i){return d+i.toUpperCase()})},goog.string.capitalize=function(e){return(e.charAt(0)+"").toUpperCase()+(e.substr(1)+"").toLowerCase()},goog.string.parseInt=function(e){return isFinite(e)&&(e+=""),goog.isString(e)?/^\s*-?0x/i.test(e)?parseInt(e,16):parseInt(e,10):NaN},goog.string.splitLimit=function(e,n,i){e=e.split(n);for(var u=[];0u&&(u=t)}return-1==u?n:n.slice(u+1)},goog.string.editDistance=function(n,i){var u=[],t=[];if(n==i)return 0;if(!n.length||!i.length)return _Mathmax(n.length,i.length);for(var d=0;dparseFloat(e))?n+"":e},goog.userAgent.getVersionRegexResult_=function(){var e=goog.userAgent.getUserAgentString();return goog.userAgent.GECKO?/rv:([^\);]+)(\)|;)/.exec(e):goog.userAgent.EDGE?/Edge\/([\d\.]+)/.exec(e):goog.userAgent.IE?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(e):goog.userAgent.WEBKIT?/WebKit\/(\S+)/.exec(e):goog.userAgent.OPERA?/(?:Version)[ \/]?(\S+)/.exec(e):void 0},goog.userAgent.getDocumentMode_=function(){var e=goog.global.document;return e?e.documentMode:void 0},goog.userAgent.VERSION=goog.userAgent.determineVersion_(),goog.userAgent.compare=function(e,n){return goog.string.compareVersions(e,n)},goog.userAgent.isVersionOrHigherCache_={},goog.userAgent.isVersionOrHigher=function(e){return goog.userAgent.ASSUME_ANY_VERSION||goog.reflect.cache(goog.userAgent.isVersionOrHigherCache_,e,function(){return 0<=goog.string.compareVersions(goog.userAgent.VERSION,e)})},goog.userAgent.isVersion=goog.userAgent.isVersionOrHigher,goog.userAgent.isDocumentModeOrHigher=function(e){return+goog.userAgent.DOCUMENT_MODE>=e},goog.userAgent.isDocumentMode=goog.userAgent.isDocumentModeOrHigher,goog.userAgent.DOCUMENT_MODE=function(){if(goog.global.document&&goog.userAgent.IE)return goog.userAgent.getDocumentMode_()}(),goog.userAgent.product={},goog.userAgent.product.ASSUME_FIREFOX=!1,goog.userAgent.product.ASSUME_IPHONE=!1,goog.userAgent.product.ASSUME_IPAD=!1,goog.userAgent.product.ASSUME_ANDROID=!1,goog.userAgent.product.ASSUME_CHROME=!1,goog.userAgent.product.ASSUME_SAFARI=!1,goog.userAgent.product.PRODUCT_KNOWN_=goog.userAgent.ASSUME_IE||goog.userAgent.ASSUME_EDGE||goog.userAgent.ASSUME_OPERA||goog.userAgent.product.ASSUME_FIREFOX||goog.userAgent.product.ASSUME_IPHONE||goog.userAgent.product.ASSUME_IPAD||goog.userAgent.product.ASSUME_ANDROID||goog.userAgent.product.ASSUME_CHROME||goog.userAgent.product.ASSUME_SAFARI,goog.userAgent.product.OPERA=goog.userAgent.OPERA,goog.userAgent.product.IE=goog.userAgent.IE,goog.userAgent.product.EDGE=goog.userAgent.EDGE,goog.userAgent.product.FIREFOX=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_FIREFOX:goog.labs.userAgent.browser.isFirefox(),goog.userAgent.product.isIphoneOrIpod_=function(){return goog.labs.userAgent.platform.isIphone()||goog.labs.userAgent.platform.isIpod()},goog.userAgent.product.IPHONE=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_IPHONE:goog.userAgent.product.isIphoneOrIpod_(),goog.userAgent.product.IPAD=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_IPAD:goog.labs.userAgent.platform.isIpad(),goog.userAgent.product.ANDROID=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_ANDROID:goog.labs.userAgent.browser.isAndroidBrowser(),goog.userAgent.product.CHROME=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_CHROME:goog.labs.userAgent.browser.isChrome(),goog.userAgent.product.isSafariDesktop_=function(){return goog.labs.userAgent.browser.isSafari()&&!goog.labs.userAgent.platform.isIos()},goog.userAgent.product.SAFARI=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_SAFARI:goog.userAgent.product.isSafariDesktop_(),goog.crypt.base64={},goog.crypt.base64.DEFAULT_ALPHABET_COMMON_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",goog.crypt.base64.ENCODED_VALS=goog.crypt.base64.DEFAULT_ALPHABET_COMMON_+"+/=",goog.crypt.base64.ENCODED_VALS_WEBSAFE=goog.crypt.base64.DEFAULT_ALPHABET_COMMON_+"-_.",goog.crypt.base64.Alphabet={DEFAULT:0,NO_PADDING:1,WEBSAFE:2,WEBSAFE_DOT_PADDING:3,WEBSAFE_NO_PADDING:4},goog.crypt.base64.paddingChars_="=.",goog.crypt.base64.isPadding_=function(e){return goog.string.contains(goog.crypt.base64.paddingChars_,e)},goog.crypt.base64.byteToCharMaps_={},goog.crypt.base64.charToByteMap_=null,goog.crypt.base64.ASSUME_NATIVE_SUPPORT_=goog.userAgent.GECKO||goog.userAgent.WEBKIT&&!goog.userAgent.product.SAFARI||goog.userAgent.OPERA,goog.crypt.base64.HAS_NATIVE_ENCODE_=goog.crypt.base64.ASSUME_NATIVE_SUPPORT_||"function"==typeof goog.global.btoa,goog.crypt.base64.HAS_NATIVE_DECODE_=goog.crypt.base64.ASSUME_NATIVE_SUPPORT_||!goog.userAgent.product.SAFARI&&!goog.userAgent.IE&&"function"==typeof goog.global.atob,goog.crypt.base64.encodeByteArray=function(n,i){goog.asserts.assert(goog.isArrayLike(n),"encodeByteArray takes an array as a parameter"),void 0===i&&(i=goog.crypt.base64.Alphabet.DEFAULT),goog.crypt.base64.init_(),i=goog.crypt.base64.byteToCharMaps_[i];for(var u=[],t=0;t>2;r=(3&r)<<4|f>>4,f=(15&f)<<2|o>>6,o&=63,a||(o=64,s||(f=64)),u.push(i[p],i[r],i[f]||"",i[o]||"")}return u.join("")},goog.crypt.base64.encodeString=function(e,n){return goog.crypt.base64.HAS_NATIVE_ENCODE_&&!n?goog.global.btoa(e):goog.crypt.base64.encodeByteArray(goog.crypt.stringToByteArray(e),n)},goog.crypt.base64.decodeString=function(e,n){if(goog.crypt.base64.HAS_NATIVE_DECODE_&&!n)return goog.global.atob(e);var d="";return goog.crypt.base64.decodeStringInternal_(e,function(e){d+=_StringfromCharCode3(e)}),d},goog.crypt.base64.decodeStringToByteArray=function(e){var n=[];return goog.crypt.base64.decodeStringInternal_(e,function(e){n.push(e)}),n},goog.crypt.base64.decodeStringToUint8Array=function(n){goog.asserts.assert(!goog.userAgent.IE||goog.userAgent.isVersionOrHigher("10"),"Browser does not support typed arrays");var i=n.length,u=3*i/4;u%3?u=_Mathfloor(u):goog.crypt.base64.isPadding_(n[i-1])&&(u=goog.crypt.base64.isPadding_(n[i-2])?u-2:u-1);var f=new Uint8Array(u),d=0;return goog.crypt.base64.decodeStringInternal_(n,function(e){f[d++]=e}),f.subarray(0,d)},goog.crypt.base64.decodeStringInternal_=function(n,i){function u(d){for(;t>4),64!=f&&(i(240&e<<4|f>>2),64!=s&&i(192&f<<6|s))}},goog.crypt.base64.init_=function(){if(!goog.crypt.base64.charToByteMap_){goog.crypt.base64.charToByteMap_={};for(var n=goog.crypt.base64.DEFAULT_ALPHABET_COMMON_.split(""),i=["+/=","+/","-_=","-_.","-_"],u=0,t;5>u;u++){t=n.concat(i[u].split("")),goog.crypt.base64.byteToCharMaps_[u]=t;for(var r=0;r>>0;e=_Mathfloor((e-n)/jspb.BinaryConstants.TWO_TO_32)>>>0,jspb.utils.split64Low=n,jspb.utils.split64High=e},jspb.utils.splitInt64=function(e){var n=0>e;e=_Mathabs(e);var d=e>>>0;e=_Mathfloor((e-d)/jspb.BinaryConstants.TWO_TO_32),e>>>=0,n&&(e=~e>>>0,d=(~d>>>0)+1,4294967295e;e=2*_Mathabs(e),jspb.utils.splitUint64(e),e=jspb.utils.split64Low;var d=jspb.utils.split64High;n&&(0==e?0==d?d=e=4294967295:(d--,e=4294967295):e--),jspb.utils.split64Low=e,jspb.utils.split64High=d},jspb.utils.splitFloat32=function(e){var n=Math.round,d=0>e?1:0;if(e=d?-e:e,0===e)0<1/e?(jspb.utils.split64High=0,jspb.utils.split64Low=0):(jspb.utils.split64High=0,jspb.utils.split64Low=2147483648);else if(isNaN(e))jspb.utils.split64High=0,jspb.utils.split64Low=2147483647;else if(e>jspb.BinaryConstants.FLOAT32_MAX)jspb.utils.split64High=0,jspb.utils.split64Low=(2139095040|d<<31)>>>0;else if(e>>0;else{var i=_Mathfloor(_Mathlog(e)/_MathLN);e*=_Mathpow2(2,-i),e=8388607&n(e*jspb.BinaryConstants.TWO_TO_23),jspb.utils.split64High=0,jspb.utils.split64Low=(d<<31|i+127<<23|e)>>>0}},jspb.utils.splitFloat64=function(e){var n=0>e?1:0;if(e=n?-e:e,0===e)jspb.utils.split64High=0<1/e?0:2147483648,jspb.utils.split64Low=0;else if(isNaN(e))jspb.utils.split64High=2147483647,jspb.utils.split64Low=4294967295;else if(e>jspb.BinaryConstants.FLOAT64_MAX)jspb.utils.split64High=(2146435072|n<<31)>>>0,jspb.utils.split64Low=0;else if(e>>0,jspb.utils.split64Low=i>>>0}else{i=e;var u=0;if(2<=i)for(;2<=i&&1023>u;)u++,i/=2;else for(;1>i&&-1022>>0,jspb.utils.split64High=(n<<31|u+1023<<20|e)>>>0,jspb.utils.split64Low=i}},jspb.utils.splitHash64=function(n){var i=n.charCodeAt(0),u=n.charCodeAt(1),t=n.charCodeAt(2),d=n.charCodeAt(3),e=n.charCodeAt(4),f=n.charCodeAt(5),r=n.charCodeAt(6);n=n.charCodeAt(7),jspb.utils.split64Low=i+(u<<8)+(t<<16)+(d<<24)>>>0,jspb.utils.split64High=e+(f<<8)+(r<<16)+(n<<24)>>>0},jspb.utils.joinUint64=function(e,n){return n*jspb.BinaryConstants.TWO_TO_32+(e>>>0)},jspb.utils.joinInt64=function(e,n){var d=2147483648&n;return d&&(e=~e+1>>>0,n=~n>>>0,0==e&&(n=n+1>>>0)),e=jspb.utils.joinUint64(e,n),d?-e:e},jspb.utils.toZigzag64=function(e,n,i){var u=n>>31;return i(e<<1^u,(n<<1|e>>>31)^u)},jspb.utils.joinZigzag64=function(e,n){return jspb.utils.fromZigzag64(e,n,jspb.utils.joinInt64)},jspb.utils.fromZigzag64=function(e,n,i){var u=-(1&e);return i((e>>>1|n<<31)^u,n>>>1^u)},jspb.utils.joinFloat32=function(e,n){n=2*(e>>31)+1;var d=255&e>>>23;return e&=8388607,255==d?e?NaN:1/0*n:0==d?n*_Mathpow2(2,-149)*e:n*_Mathpow2(2,d-150)*(e+_Mathpow2(2,23))},jspb.utils.joinFloat64=function(e,n){var i=2*(n>>31)+1,u=2047&n>>>20;return e=jspb.BinaryConstants.TWO_TO_32*(1048575&n)+e,2047==u?e?NaN:1/0*i:0==u?i*_Mathpow2(2,-1074)*e:i*_Mathpow2(2,u-1075)*(e+jspb.BinaryConstants.TWO_TO_52)},jspb.utils.joinHash64=function(e,n){return _StringfromCharCode3(255&e>>>0,255&e>>>8,255&e>>>16,255&e>>>24,255&n>>>0,255&n>>>8,255&n>>>16,255&n>>>24)},jspb.utils.DIGITS=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],jspb.utils.ZERO_CHAR_CODE_=48,jspb.utils.A_CHAR_CODE_=97,jspb.utils.joinUnsignedDecimalString=function(e,n){function i(e,n){return e=e?e+"":"",n?"0000000".slice(e.length)+e:e}if(2097151>=n)return""+(jspb.BinaryConstants.TWO_TO_32*n+e);var u=16777215&(e>>>24|n<<8)>>>0;return n=65535&n>>16,e=(16777215&e)+6777216*u+6710656*n,u+=8147497*n,n*=2,1E7<=e&&(u+=_Mathfloor(e/1E7),e%=1E7),1E7<=u&&(n+=_Mathfloor(u/1E7),u%=1E7),i(n,0)+i(u,n)+i(e,1)},jspb.utils.joinSignedDecimalString=function(e,n){var d=2147483648&n;return d&&(e=~e+1>>>0,n=~n+(0==e?1:0)>>>0),e=jspb.utils.joinUnsignedDecimalString(e,n),d?"-"+e:e},jspb.utils.hash64ToDecimalString=function(e,n){jspb.utils.splitHash64(e),e=jspb.utils.split64Low;var d=jspb.utils.split64High;return n?jspb.utils.joinSignedDecimalString(e,d):jspb.utils.joinUnsignedDecimalString(e,d)},jspb.utils.hash64ArrayToDecimalStrings=function(e,n){for(var i=Array(e.length),u=0;ud&&(1!==e||0>>=8}function u(){for(var e=0;8>e;e++)r[e]=255&~r[e]}goog.asserts.assert(0e?jspb.utils.ZERO_CHAR_CODE_+e:jspb.utils.A_CHAR_CODE_-10+e)},jspb.utils.fromHexCharCode_=function(e){return e>=jspb.utils.A_CHAR_CODE_?e-jspb.utils.A_CHAR_CODE_+10:e-jspb.utils.ZERO_CHAR_CODE_},jspb.utils.hash64ToHexString=function(e){var n=Array(18);n[0]="0",n[1]="x";for(var i=0,u;8>i;i++)u=e.charCodeAt(7-i),n[2*i+2]=jspb.utils.toHexDigit_(u>>4),n[2*i+3]=jspb.utils.toHexDigit_(15&u);return n.join("")},jspb.utils.hexStringToHash64=function(n){n=n.toLowerCase(),goog.asserts.assert(18==n.length),goog.asserts.assert("0"==n[0]),goog.asserts.assert("x"==n[1]);for(var i="",u=0;8>u;u++){var f=jspb.utils.fromHexCharCode_(n.charCodeAt(2*u+2)),d=jspb.utils.fromHexCharCode_(n.charCodeAt(2*u+3));i=_StringfromCharCode3(16*f+d)+i}return i},jspb.utils.hash64ToNumber=function(e,n){jspb.utils.splitHash64(e),e=jspb.utils.split64Low;var d=jspb.utils.split64High;return n?jspb.utils.joinInt64(e,d):jspb.utils.joinUint64(e,d)},jspb.utils.numberToHash64=function(e){return jspb.utils.splitInt64(e),jspb.utils.joinHash64(jspb.utils.split64Low,jspb.utils.split64High)},jspb.utils.countVarints=function(n,i,u){for(var f=0,t=i;t>7;return u-i-f},jspb.utils.countVarintFields=function(n,i,u,t){var r=0;if(t=8*t+jspb.BinaryConstants.WireType.VARINT,128>t)for(;i>=7}if(n[i++]!=s)break;for(r++;s=n[i++],0!=(128&s););}return r},jspb.utils.countFixedFields_=function(n,i,u,t,d){var e=0;if(128>t)for(;i>=7}if(n[i++]!=r)break;e++,i+=d}return e},jspb.utils.countFixed32Fields=function(e,n,i,u){return jspb.utils.countFixedFields_(e,n,i,8*u+jspb.BinaryConstants.WireType.FIXED32,4)},jspb.utils.countFixed64Fields=function(e,n,i,u){return jspb.utils.countFixedFields_(e,n,i,8*u+jspb.BinaryConstants.WireType.FIXED64,8)},jspb.utils.countDelimitedFields=function(n,i,u,t){var r=0;for(t=8*t+jspb.BinaryConstants.WireType.DELIMITED;i>=7}if(n[i++]!=s)break;r++;for(var a=0,o=1;s=n[i++],a+=(127&s)*o,o*=128,0!=(128&s););i+=a}return r},jspb.utils.debugBytesToTextFormat=function(e){var n="\"";if(e){e=jspb.utils.byteSourceToUint8Array(e);for(var d=0;de[d]&&(n+="0"),n+=e[d].toString(16)}return n+"\""},jspb.utils.debugScalarToTextFormat=function(e){return"string"==typeof e?goog.string.quote(e):e.toString()},jspb.utils.stringToByteArray=function(e){for(var n=new Uint8Array(e.length),i=0,u;ijspb.BinaryDecoder.instanceCache_.length&&jspb.BinaryDecoder.instanceCache_.push(this)},jspb.BinaryDecoder.prototype.clone=function(){return jspb.BinaryDecoder.alloc(this.bytes_,this.start_,this.end_-this.start_)},jspb.BinaryDecoder.prototype.clear=function(){this.bytes_=null,this.cursor_=this.end_=this.start_=0,this.error_=!1},jspb.BinaryDecoder.prototype.getBuffer=function(){return this.bytes_},jspb.BinaryDecoder.prototype.setBlock=function(e,n,d){this.bytes_=jspb.utils.byteSourceToUint8Array(e),this.start_=void 0===n?0:n,this.end_=void 0===d?this.bytes_.length:this.start_+d,this.cursor_=this.start_},jspb.BinaryDecoder.prototype.getEnd=function(){return this.end_},jspb.BinaryDecoder.prototype.setEnd=function(e){this.end_=e},jspb.BinaryDecoder.prototype.reset=function(){this.cursor_=this.start_},jspb.BinaryDecoder.prototype.getCursor=function(){return this.cursor_},jspb.BinaryDecoder.prototype.setCursor=function(e){this.cursor_=e},jspb.BinaryDecoder.prototype.advance=function(e){this.cursor_+=e,goog.asserts.assert(this.cursor_<=this.end_)},jspb.BinaryDecoder.prototype.atEnd=function(){return this.cursor_==this.end_},jspb.BinaryDecoder.prototype.pastEnd=function(){return this.cursor_>this.end_},jspb.BinaryDecoder.prototype.getError=function(){return this.error_||0>this.cursor_||this.cursor_>this.end_},jspb.BinaryDecoder.prototype.readSplitVarint64=function(n){for(var i=128,u=0,f=0,t=0;4>t&&128<=i;t++)i=this.bytes_[this.cursor_++],u|=(127&i)<<7*t;if(128<=i&&(i=this.bytes_[this.cursor_++],u|=(127&i)<<28,f|=(127&i)>>4),128<=i)for(t=0;5>t&&128<=i;t++)i=this.bytes_[this.cursor_++],f|=(127&i)<<7*t+3;return 128>i?n(u>>>0,f>>>0):void(goog.asserts.fail("Failed to read varint, encoding is invalid."),this.error_=!0)},jspb.BinaryDecoder.prototype.readSplitZigzagVarint64=function(e){return this.readSplitVarint64(function(n,d){return jspb.utils.fromZigzag64(n,d,e)})},jspb.BinaryDecoder.prototype.readSplitFixed64=function(n){var i=this.bytes_,u=this.cursor_;this.cursor_+=8;for(var t=0,r=0,s=u+7;s>=u;s--)t=t<<8|i[s],r=r<<8|i[s+4];return n(t,r)},jspb.BinaryDecoder.prototype.skipVarint=function(){for(;128&this.bytes_[this.cursor_];)this.cursor_++;this.cursor_++},jspb.BinaryDecoder.prototype.unskipVarint=function(e){for(;128>>=7;this.cursor_--},jspb.BinaryDecoder.prototype.readUnsignedVarint32=function(){var e=this.bytes_,n=e[this.cursor_+0],d=127&n;return 128>n?(this.cursor_+=1,goog.asserts.assert(this.cursor_<=this.end_),d):(n=e[this.cursor_+1],d|=(127&n)<<7,128>n)?(this.cursor_+=2,goog.asserts.assert(this.cursor_<=this.end_),d):(n=e[this.cursor_+2],d|=(127&n)<<14,128>n)?(this.cursor_+=3,goog.asserts.assert(this.cursor_<=this.end_),d):(n=e[this.cursor_+3],d|=(127&n)<<21,128>n)?(this.cursor_+=4,goog.asserts.assert(this.cursor_<=this.end_),d):(n=e[this.cursor_+4],d|=(15&n)<<28,128>n)?(this.cursor_+=5,goog.asserts.assert(this.cursor_<=this.end_),d>>>0):(this.cursor_+=5,128<=e[this.cursor_++]&&128<=e[this.cursor_++]&&128<=e[this.cursor_++]&&128<=e[this.cursor_++]&&128<=e[this.cursor_++]&&goog.asserts.assert(!1),goog.asserts.assert(this.cursor_<=this.end_),d)},jspb.BinaryDecoder.prototype.readSignedVarint32=jspb.BinaryDecoder.prototype.readUnsignedVarint32,jspb.BinaryDecoder.prototype.readUnsignedVarint32String=function(){return this.readUnsignedVarint32().toString()},jspb.BinaryDecoder.prototype.readSignedVarint32String=function(){return this.readSignedVarint32().toString()},jspb.BinaryDecoder.prototype.readZigzagVarint32=function(){var e=this.readUnsignedVarint32();return e>>>1^-(1&e)},jspb.BinaryDecoder.prototype.readUnsignedVarint64=function(){return this.readSplitVarint64(jspb.utils.joinUint64)},jspb.BinaryDecoder.prototype.readUnsignedVarint64String=function(){return this.readSplitVarint64(jspb.utils.joinUnsignedDecimalString)},jspb.BinaryDecoder.prototype.readSignedVarint64=function(){return this.readSplitVarint64(jspb.utils.joinInt64)},jspb.BinaryDecoder.prototype.readSignedVarint64String=function(){return this.readSplitVarint64(jspb.utils.joinSignedDecimalString)},jspb.BinaryDecoder.prototype.readZigzagVarint64=function(){return this.readSplitVarint64(jspb.utils.joinZigzag64)},jspb.BinaryDecoder.prototype.readZigzagVarintHash64=function(){return this.readSplitZigzagVarint64(jspb.utils.joinHash64)},jspb.BinaryDecoder.prototype.readZigzagVarint64String=function(){return this.readSplitZigzagVarint64(jspb.utils.joinSignedDecimalString)},jspb.BinaryDecoder.prototype.readUint8=function(){var e=this.bytes_[this.cursor_+0];return this.cursor_+=1,goog.asserts.assert(this.cursor_<=this.end_),e},jspb.BinaryDecoder.prototype.readUint16=function(){var e=this.bytes_[this.cursor_+0],n=this.bytes_[this.cursor_+1];return this.cursor_+=2,goog.asserts.assert(this.cursor_<=this.end_),e<<0|n<<8},jspb.BinaryDecoder.prototype.readUint32=function(){var e=this.bytes_[this.cursor_+0],n=this.bytes_[this.cursor_+1],i=this.bytes_[this.cursor_+2],u=this.bytes_[this.cursor_+3];return this.cursor_+=4,goog.asserts.assert(this.cursor_<=this.end_),(e<<0|n<<8|i<<16|u<<24)>>>0},jspb.BinaryDecoder.prototype.readUint64=function(){var e=this.readUint32(),n=this.readUint32();return jspb.utils.joinUint64(e,n)},jspb.BinaryDecoder.prototype.readUint64String=function(){var e=this.readUint32(),n=this.readUint32();return jspb.utils.joinUnsignedDecimalString(e,n)},jspb.BinaryDecoder.prototype.readInt8=function(){var e=this.bytes_[this.cursor_+0];return this.cursor_+=1,goog.asserts.assert(this.cursor_<=this.end_),e<<24>>24},jspb.BinaryDecoder.prototype.readInt16=function(){var e=this.bytes_[this.cursor_+0],n=this.bytes_[this.cursor_+1];return this.cursor_+=2,goog.asserts.assert(this.cursor_<=this.end_),(e<<0|n<<8)<<16>>16},jspb.BinaryDecoder.prototype.readInt32=function(){var e=this.bytes_[this.cursor_+0],n=this.bytes_[this.cursor_+1],i=this.bytes_[this.cursor_+2],u=this.bytes_[this.cursor_+3];return this.cursor_+=4,goog.asserts.assert(this.cursor_<=this.end_),e<<0|n<<8|i<<16|u<<24},jspb.BinaryDecoder.prototype.readInt64=function(){var e=this.readUint32(),n=this.readUint32();return jspb.utils.joinInt64(e,n)},jspb.BinaryDecoder.prototype.readInt64String=function(){var e=this.readUint32(),n=this.readUint32();return jspb.utils.joinSignedDecimalString(e,n)},jspb.BinaryDecoder.prototype.readFloat=function(){var e=this.readUint32();return jspb.utils.joinFloat32(e,0)},jspb.BinaryDecoder.prototype.readDouble=function(){var e=this.readUint32(),n=this.readUint32();return jspb.utils.joinFloat64(e,n)},jspb.BinaryDecoder.prototype.readBool=function(){return!!this.bytes_[this.cursor_++]},jspb.BinaryDecoder.prototype.readEnum=function(){return this.readSignedVarint32()},jspb.BinaryDecoder.prototype.readString=function(n){var i=this.bytes_,u=this.cursor_;n=u+n;for(var t=[],d="",r;ur)t.push(r);else if(192>r)continue;else if(224>r){var s=i[u++];t.push((31&r)<<6|63&s)}else if(240>r){s=i[u++];var o=i[u++];t.push((15&r)<<12|(63&s)<<6|63&o)}else if(248>r){s=i[u++],o=i[u++];var l=i[u++];r=(7&r)<<18|(63&s)<<12|(63&o)<<6|63&l,r-=65536,t.push((1023&r>>10)+55296,(1023&r)+56320)}8192<=t.length&&(d+=_StringfromCharCode3.apply(null,t),t.length=0)}return d+=goog.crypt.byteArrayToString(t),this.cursor_=u,d},jspb.BinaryDecoder.prototype.readStringWithLength=function(){var e=this.readUnsignedVarint32();return this.readString(e)},jspb.BinaryDecoder.prototype.readBytes=function(e){if(0>e||this.cursor_+e>this.bytes_.length)return this.error_=!0,goog.asserts.fail("Invalid byte length!"),new Uint8Array(0);var n=this.bytes_.subarray(this.cursor_,this.cursor_+e);return this.cursor_+=e,goog.asserts.assert(this.cursor_<=this.end_),n},jspb.BinaryDecoder.prototype.readVarintHash64=function(){return this.readSplitVarint64(jspb.utils.joinHash64)},jspb.BinaryDecoder.prototype.readFixedHash64=function(){var n=this.bytes_,i=this.cursor_,u=n[i+0],t=n[i+1],d=n[i+2],e=n[i+3],f=n[i+4],r=n[i+5],s=n[i+6];return n=n[i+7],this.cursor_+=8,_StringfromCharCode3(u,t,d,e,f,r,s,n)},jspb.BinaryReader=function(e,n,d){this.decoder_=jspb.BinaryDecoder.alloc(e,n,d),this.fieldCursor_=this.decoder_.getCursor(),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID,this.error_=!1,this.readCallbacks_=null},jspb.BinaryReader.instanceCache_=[],jspb.BinaryReader.alloc=function(e,n,i){if(jspb.BinaryReader.instanceCache_.length){var u=jspb.BinaryReader.instanceCache_.pop();return e&&u.decoder_.setBlock(e,n,i),u}return new jspb.BinaryReader(e,n,i)},jspb.BinaryReader.prototype.alloc=jspb.BinaryReader.alloc,jspb.BinaryReader.prototype.free=function(){this.decoder_.clear(),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID,this.error_=!1,this.readCallbacks_=null,100>jspb.BinaryReader.instanceCache_.length&&jspb.BinaryReader.instanceCache_.push(this)},jspb.BinaryReader.prototype.getFieldCursor=function(){return this.fieldCursor_},jspb.BinaryReader.prototype.getCursor=function(){return this.decoder_.getCursor()},jspb.BinaryReader.prototype.getBuffer=function(){return this.decoder_.getBuffer()},jspb.BinaryReader.prototype.getFieldNumber=function(){return this.nextField_},jspb.BinaryReader.prototype.getWireType=function(){return this.nextWireType_},jspb.BinaryReader.prototype.isEndGroup=function(){return this.nextWireType_==jspb.BinaryConstants.WireType.END_GROUP},jspb.BinaryReader.prototype.getError=function(){return this.error_||this.decoder_.getError()},jspb.BinaryReader.prototype.setBlock=function(e,n,d){this.decoder_.setBlock(e,n,d),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID},jspb.BinaryReader.prototype.reset=function(){this.decoder_.reset(),this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER,this.nextWireType_=jspb.BinaryConstants.WireType.INVALID},jspb.BinaryReader.prototype.advance=function(e){this.decoder_.advance(e)},jspb.BinaryReader.prototype.nextField=function(){if(this.decoder_.atEnd())return!1;if(this.getError())return goog.asserts.fail("Decoder hit an error"),!1;this.fieldCursor_=this.decoder_.getCursor();var e=this.decoder_.readUnsignedVarint32(),n=e>>>3;return(e&=7,e!=jspb.BinaryConstants.WireType.VARINT&&e!=jspb.BinaryConstants.WireType.FIXED32&&e!=jspb.BinaryConstants.WireType.FIXED64&&e!=jspb.BinaryConstants.WireType.DELIMITED&&e!=jspb.BinaryConstants.WireType.START_GROUP&&e!=jspb.BinaryConstants.WireType.END_GROUP)?(goog.asserts.fail("Invalid wire type: %s (at position %s)",e,this.fieldCursor_),this.error_=!0,!1):(this.nextField_=n,this.nextWireType_=e,!0)},jspb.BinaryReader.prototype.unskipHeader=function(){this.decoder_.unskipVarint(this.nextField_<<3|this.nextWireType_)},jspb.BinaryReader.prototype.skipMatchingFields=function(){var e=this.nextField_;for(this.unskipHeader();this.nextField()&&this.getFieldNumber()==e;)this.skipField();this.decoder_.atEnd()||this.unskipHeader()},jspb.BinaryReader.prototype.skipVarintField=function(){this.nextWireType_==jspb.BinaryConstants.WireType.VARINT?this.decoder_.skipVarint():(goog.asserts.fail("Invalid wire type for skipVarintField"),this.skipField())},jspb.BinaryReader.prototype.skipDelimitedField=function(){if(this.nextWireType_!=jspb.BinaryConstants.WireType.DELIMITED)goog.asserts.fail("Invalid wire type for skipDelimitedField"),this.skipField();else{var e=this.decoder_.readUnsignedVarint32();this.decoder_.advance(e)}},jspb.BinaryReader.prototype.skipFixed32Field=function(){this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32?this.decoder_.advance(4):(goog.asserts.fail("Invalid wire type for skipFixed32Field"),this.skipField())},jspb.BinaryReader.prototype.skipFixed64Field=function(){this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64?this.decoder_.advance(8):(goog.asserts.fail("Invalid wire type for skipFixed64Field"),this.skipField())},jspb.BinaryReader.prototype.skipGroup=function(){var e=this.nextField_;do{if(!this.nextField()){goog.asserts.fail("Unmatched start-group tag: stream EOF"),this.error_=!0;break}if(this.nextWireType_==jspb.BinaryConstants.WireType.END_GROUP){this.nextField_!=e&&(goog.asserts.fail("Unmatched end-group tag"),this.error_=!0);break}this.skipField()}while(1)},jspb.BinaryReader.prototype.skipField=function(){switch(this.nextWireType_){case jspb.BinaryConstants.WireType.VARINT:this.skipVarintField();break;case jspb.BinaryConstants.WireType.FIXED64:this.skipFixed64Field();break;case jspb.BinaryConstants.WireType.DELIMITED:this.skipDelimitedField();break;case jspb.BinaryConstants.WireType.FIXED32:this.skipFixed32Field();break;case jspb.BinaryConstants.WireType.START_GROUP:this.skipGroup();break;default:goog.asserts.fail("Invalid wire encoding for field.");}},jspb.BinaryReader.prototype.registerReadCallback=function(e,n){null===this.readCallbacks_&&(this.readCallbacks_={}),goog.asserts.assert(!this.readCallbacks_[e]),this.readCallbacks_[e]=n},jspb.BinaryReader.prototype.runReadCallback=function(e){return goog.asserts.assert(null!==this.readCallbacks_),e=this.readCallbacks_[e],goog.asserts.assert(e),e(this)},jspb.BinaryReader.prototype.readAny=function(e){this.nextWireType_=jspb.BinaryConstants.FieldTypeToWireType(e);var n=jspb.BinaryConstants.FieldType;switch(e){case n.DOUBLE:return this.readDouble();case n.FLOAT:return this.readFloat();case n.INT64:return this.readInt64();case n.UINT64:return this.readUint64();case n.INT32:return this.readInt32();case n.FIXED64:return this.readFixed64();case n.FIXED32:return this.readFixed32();case n.BOOL:return this.readBool();case n.STRING:return this.readString();case n.GROUP:goog.asserts.fail("Group field type not supported in readAny()");case n.MESSAGE:goog.asserts.fail("Message field type not supported in readAny()");case n.BYTES:return this.readBytes();case n.UINT32:return this.readUint32();case n.ENUM:return this.readEnum();case n.SFIXED32:return this.readSfixed32();case n.SFIXED64:return this.readSfixed64();case n.SINT32:return this.readSint32();case n.SINT64:return this.readSint64();case n.FHASH64:return this.readFixedHash64();case n.VHASH64:return this.readVarintHash64();default:goog.asserts.fail("Invalid field type in readAny()");}return 0},jspb.BinaryReader.prototype.readMessage=function(e,n){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var i=this.decoder_.getEnd(),u=this.decoder_.readUnsignedVarint32();u=this.decoder_.getCursor()+u,this.decoder_.setEnd(u),n(e,this),this.decoder_.setCursor(u),this.decoder_.setEnd(i)},jspb.BinaryReader.prototype.readGroup=function(e,n,d){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.START_GROUP),goog.asserts.assert(this.nextField_==e),d(n,this),this.error_||this.nextWireType_==jspb.BinaryConstants.WireType.END_GROUP||(goog.asserts.fail("Group submessage did not end with an END_GROUP tag"),this.error_=!0)},jspb.BinaryReader.prototype.getFieldDecoder=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var e=this.decoder_.readUnsignedVarint32(),n=this.decoder_.getCursor(),d=n+e;return e=jspb.BinaryDecoder.alloc(this.decoder_.getBuffer(),n,e),this.decoder_.setCursor(d),e},jspb.BinaryReader.prototype.readInt32=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint32()},jspb.BinaryReader.prototype.readInt32String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint32String()},jspb.BinaryReader.prototype.readInt64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint64()},jspb.BinaryReader.prototype.readInt64String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint64String()},jspb.BinaryReader.prototype.readUint32=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint32()},jspb.BinaryReader.prototype.readUint32String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint32String()},jspb.BinaryReader.prototype.readUint64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint64()},jspb.BinaryReader.prototype.readUint64String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readUnsignedVarint64String()},jspb.BinaryReader.prototype.readSint32=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarint32()},jspb.BinaryReader.prototype.readSint64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarint64()},jspb.BinaryReader.prototype.readSint64String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarint64String()},jspb.BinaryReader.prototype.readFixed32=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readUint32()},jspb.BinaryReader.prototype.readFixed64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readUint64()},jspb.BinaryReader.prototype.readFixed64String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readUint64String()},jspb.BinaryReader.prototype.readSfixed32=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readInt32()},jspb.BinaryReader.prototype.readSfixed32String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readInt32().toString()},jspb.BinaryReader.prototype.readSfixed64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readInt64()},jspb.BinaryReader.prototype.readSfixed64String=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readInt64String()},jspb.BinaryReader.prototype.readFloat=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32),this.decoder_.readFloat()},jspb.BinaryReader.prototype.readDouble=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readDouble()},jspb.BinaryReader.prototype.readBool=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),!!this.decoder_.readUnsignedVarint32()},jspb.BinaryReader.prototype.readEnum=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSignedVarint64()},jspb.BinaryReader.prototype.readString=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var e=this.decoder_.readUnsignedVarint32();return this.decoder_.readString(e)},jspb.BinaryReader.prototype.readBytes=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var e=this.decoder_.readUnsignedVarint32();return this.decoder_.readBytes(e)},jspb.BinaryReader.prototype.readVarintHash64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readVarintHash64()},jspb.BinaryReader.prototype.readSintHash64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readZigzagVarintHash64()},jspb.BinaryReader.prototype.readSplitVarint64=function(e){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSplitVarint64(e)},jspb.BinaryReader.prototype.readSplitZigzagVarint64=function(e){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT),this.decoder_.readSplitVarint64(function(n,d){return jspb.utils.fromZigzag64(n,d,e)})},jspb.BinaryReader.prototype.readFixedHash64=function(){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readFixedHash64()},jspb.BinaryReader.prototype.readSplitFixed64=function(e){return goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64),this.decoder_.readSplitFixed64(e)},jspb.BinaryReader.prototype.readPackedField_=function(e){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var n=this.decoder_.readUnsignedVarint32();n=this.decoder_.getCursor()+n;for(var d=[];this.decoder_.getCursor()i.length?u.length:i.length;for(n.getJsPbMessageId()&&(t[0]=n.getJsPbMessageId(),d=1);d>>1|(1&this.hi)<<31)>>>0,this.hi>>>1>>>0)},jspb.arith.UInt64.prototype.leftShift=function(){return new jspb.arith.UInt64(this.lo<<1>>>0,(this.hi<<1|this.lo>>>31)>>>0)},jspb.arith.UInt64.prototype.msb=function(){return!!(2147483648&this.hi)},jspb.arith.UInt64.prototype.lsb=function(){return!!(1&this.lo)},jspb.arith.UInt64.prototype.zero=function(){return 0==this.lo&&0==this.hi},jspb.arith.UInt64.prototype.add=function(e){return new jspb.arith.UInt64((4294967295&this.lo+e.lo)>>>0>>>0,((4294967295&this.hi+e.hi)>>>0)+(4294967296<=this.lo+e.lo?1:0)>>>0)},jspb.arith.UInt64.prototype.sub=function(e){return new jspb.arith.UInt64((4294967295&this.lo-e.lo)>>>0>>>0,((4294967295&this.hi-e.hi)>>>0)-(0>this.lo-e.lo?1:0)>>>0)},jspb.arith.UInt64.mul32x32=function(n,i){var u=65535&n;n>>>=16;var f=65535&i,d=i>>>16;for(i=u*f+65536*(65535&u*d)+65536*(65535&n*f),u=n*d+(u*d>>>16)+(n*f>>>16);4294967296<=i;)i-=4294967296,u+=1;return new jspb.arith.UInt64(i>>>0,u>>>0)},jspb.arith.UInt64.prototype.mul=function(e){var n=jspb.arith.UInt64.mul32x32(this.lo,e);return e=jspb.arith.UInt64.mul32x32(this.hi,e),e.hi=e.lo,e.lo=0,n.add(e)},jspb.arith.UInt64.prototype.div=function(e){if(0==e)return[];var n=new jspb.arith.UInt64(0,0),i=new jspb.arith.UInt64(this.lo,this.hi);e=new jspb.arith.UInt64(e,0);for(var u=new jspb.arith.UInt64(1,0);!e.msb();)e=e.leftShift(),u=u.leftShift();for(;!u.zero();)0>=e.cmp(i)&&(n=n.add(u),i=i.sub(e)),e=e.rightShift(),u=u.rightShift();return[n,i]},jspb.arith.UInt64.prototype.toString=function(){for(var e="",n=this;!n.zero();){n=n.div(10);var d=n[0];e=n[1].lo+e,n=d}return""==e&&(e="0"),e},jspb.arith.UInt64.fromString=function(n){for(var i=new jspb.arith.UInt64(0,0),u=new jspb.arith.UInt64(0,0),f=0;fn[f]||"9">>0>>>0,((4294967295&this.hi+e.hi)>>>0)+(4294967296<=this.lo+e.lo?1:0)>>>0)},jspb.arith.Int64.prototype.sub=function(e){return new jspb.arith.Int64((4294967295&this.lo-e.lo)>>>0>>>0,((4294967295&this.hi-e.hi)>>>0)-(0>this.lo-e.lo?1:0)>>>0)},jspb.arith.Int64.prototype.clone=function(){return new jspb.arith.Int64(this.lo,this.hi)},jspb.arith.Int64.prototype.toString=function(){var e=0!=(2147483648&this.hi),n=new jspb.arith.UInt64(this.lo,this.hi);return e&&(n=new jspb.arith.UInt64(0,0).sub(n)),(e?"-":"")+n.toString()},jspb.arith.Int64.fromString=function(e){var n=0>>7|n<<25)>>>0,n>>>=7;this.buffer_.push(e)},jspb.BinaryEncoder.prototype.writeSplitFixed64=function(e,n){goog.asserts.assert(e==_Mathfloor(e)),goog.asserts.assert(n==_Mathfloor(n)),goog.asserts.assert(0<=e&&e>>=7;this.buffer_.push(e)},jspb.BinaryEncoder.prototype.writeSignedVarint32=function(e){if(goog.asserts.assert(e==_Mathfloor(e)),goog.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_31&&en;n++)this.buffer_.push(128|127&e),e>>=7;this.buffer_.push(1)}},jspb.BinaryEncoder.prototype.writeUnsignedVarint64=function(e){goog.asserts.assert(e==_Mathfloor(e)),goog.asserts.assert(0<=e&&e=-jspb.BinaryConstants.TWO_TO_63&&e=-jspb.BinaryConstants.TWO_TO_31&&e>31)>>>0)},jspb.BinaryEncoder.prototype.writeZigzagVarint64=function(e){goog.asserts.assert(e==_Mathfloor(e)),goog.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_63&&e>>0,i>>>0)})},jspb.BinaryEncoder.prototype.writeUint8=function(e){goog.asserts.assert(e==_Mathfloor(e)),goog.asserts.assert(0<=e&&256>e),this.buffer_.push(255&e>>>0)},jspb.BinaryEncoder.prototype.writeUint16=function(e){goog.asserts.assert(e==_Mathfloor(e)),goog.asserts.assert(0<=e&&65536>e),this.buffer_.push(255&e>>>0),this.buffer_.push(255&e>>>8)},jspb.BinaryEncoder.prototype.writeUint32=function(e){goog.asserts.assert(e==_Mathfloor(e)),goog.asserts.assert(0<=e&&e>>0),this.buffer_.push(255&e>>>8),this.buffer_.push(255&e>>>16),this.buffer_.push(255&e>>>24)},jspb.BinaryEncoder.prototype.writeUint64=function(e){goog.asserts.assert(e==_Mathfloor(e)),goog.asserts.assert(0<=e&&ee),this.buffer_.push(255&e>>>0)},jspb.BinaryEncoder.prototype.writeInt16=function(e){goog.asserts.assert(e==_Mathfloor(e)),goog.asserts.assert(-32768<=e&&32768>e),this.buffer_.push(255&e>>>0),this.buffer_.push(255&e>>>8)},jspb.BinaryEncoder.prototype.writeInt32=function(e){goog.asserts.assert(e==_Mathfloor(e)),goog.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_31&&e>>0),this.buffer_.push(255&e>>>8),this.buffer_.push(255&e>>>16),this.buffer_.push(255&e>>>24)},jspb.BinaryEncoder.prototype.writeInt64=function(e){goog.asserts.assert(e==_Mathfloor(e)),goog.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_63&&e=-jspb.BinaryConstants.TWO_TO_63&&+e=-jspb.BinaryConstants.FLOAT32_MAX&&e<=jspb.BinaryConstants.FLOAT32_MAX),jspb.utils.splitFloat32(e),this.writeUint32(jspb.utils.split64Low)},jspb.BinaryEncoder.prototype.writeDouble=function(e){goog.asserts.assert(1/0===e||-Infinity===e||isNaN(e)||e>=-jspb.BinaryConstants.FLOAT64_MAX&&e<=jspb.BinaryConstants.FLOAT64_MAX),jspb.utils.splitFloat64(e),this.writeUint32(jspb.utils.split64Low),this.writeUint32(jspb.utils.split64High)},jspb.BinaryEncoder.prototype.writeBool=function(e){goog.asserts.assert("boolean"==typeof e||"number"==typeof e),this.buffer_.push(e?1:0)},jspb.BinaryEncoder.prototype.writeEnum=function(e){goog.asserts.assert(e==_Mathfloor(e)),goog.asserts.assert(e>=-jspb.BinaryConstants.TWO_TO_31&&ef)this.buffer_.push(f);else if(2048>f)this.buffer_.push(192|f>>6),this.buffer_.push(128|63&f);else if(65536>f)if(55296<=f&&56319>=f&&u+1=t&&(f=1024*(f-55296)+t-56320+65536,this.buffer_.push(240|f>>18),this.buffer_.push(128|63&f>>12),this.buffer_.push(128|63&f>>6),this.buffer_.push(128|63&f),u++)}else this.buffer_.push(224|f>>12),this.buffer_.push(128|63&f>>6),this.buffer_.push(128|63&f);return this.buffer_.length-i},jspb.BinaryWriter=function(){this.blocks_=[],this.totalLength_=0,this.encoder_=new jspb.BinaryEncoder,this.bookmarks_=[]},jspb.BinaryWriter.prototype.appendUint8Array_=function(e){var n=this.encoder_.end();this.blocks_.push(n),this.blocks_.push(e),this.totalLength_+=n.length+e.length},jspb.BinaryWriter.prototype.beginDelimited_=function(e){return this.writeFieldHeader_(e,jspb.BinaryConstants.WireType.DELIMITED),e=this.encoder_.end(),this.blocks_.push(e),this.totalLength_+=e.length,e.push(this.totalLength_),e},jspb.BinaryWriter.prototype.endDelimited_=function(e){var n=e.pop();for(n=this.totalLength_+this.encoder_.length()-n,goog.asserts.assert(0<=n);127>>=7,this.totalLength_++;e.push(n),this.totalLength_++},jspb.BinaryWriter.prototype.writeSerializedMessage=function(e,n,d){this.appendUint8Array_(e.subarray(n,d))},jspb.BinaryWriter.prototype.maybeWriteSerializedMessage=function(e,n,d){null!=e&&null!=n&&null!=d&&this.writeSerializedMessage(e,n,d)},jspb.BinaryWriter.prototype.reset=function(){this.blocks_=[],this.encoder_.end(),this.totalLength_=0,this.bookmarks_=[]},jspb.BinaryWriter.prototype.getResultBuffer=function(){goog.asserts.assert(0==this.bookmarks_.length);for(var n=new Uint8Array(this.totalLength_+this.encoder_.length()),i=this.blocks_,u=i.length,t=0,r=0,s;r=-jspb.BinaryConstants.TWO_TO_31&&n=-jspb.BinaryConstants.TWO_TO_31&&n=-jspb.BinaryConstants.TWO_TO_63&&n=-jspb.BinaryConstants.TWO_TO_31&&n=-jspb.BinaryConstants.TWO_TO_63&&n=-jspb.BinaryConstants.TWO_TO_31&&n=-jspb.BinaryConstants.TWO_TO_63&&n=-jspb.BinaryConstants.TWO_TO_31&&n>>0,n>>>0)})},jspb.BinaryWriter.prototype.writeRepeatedInt32=function(e,n){if(null!=n)for(var d=0;d>>0,n>>>0)});this.endDelimited_(n)}},jspb.BinaryWriter.prototype.writePackedInt64String=function(e,n){if(null!=n&&n.length){e=this.beginDelimited_(e);for(var i=0,u;i>1,c=-7,g=f?a-1:0,y=f?-1:1,d=n[u+g],_,S;for(g+=y,_=d&(1<<-c)-1,d>>=-c,c+=o;0>=-c,c+=t;0>1,h=23===p?r(2,-24)-r(2,-77):0,T=l?0:g-1,E=l?1:-1,d=0>a||0===a&&0>1/a?1:0,A,b,O;for(a=t(a),isNaN(a)||a===1/0?(b=isNaN(a)?1:0,A=_):(A=s(f(a)/u),1>a*(O=r(2,-A))&&(A--,O*=2),a+=1<=A+S?h/O:h*r(2,1-S),2<=a*O&&(A++,O/=2),A+S>=_?(b=0,A=_):1<=A+S?(b=(a*O-1)*r(2,p),A+=S):(b=a*r(2,S-1)*r(2,p),A=0));8<=p;n[o+T]=255&b,T+=E,b/=256,p-=8);for(A=A<=s)return o.close(),null;var d=new Map;o.connectedNamespaces.forEach(function(e,n){var i=[];!S(e.rooms)&&0a[0]&&d[1]> ") @@ -175,7 +198,13 @@ func startClient() { if err != nil { log.Fatal(err) } - c.Emit("chat", body) + + c.Conn.Write(neffos.Message{ + Namespace: namespace, + Event: "chat", + Body: body, + SetBinary: true, + }) fmt.Fprint(os.Stdout, ">> ") } diff --git a/_examples/protobuf/user_message.proto b/_examples/protobuf/user_message.proto index 7d9046c..f9bf3b3 100644 --- a/_examples/protobuf/user_message.proto +++ b/_examples/protobuf/user_message.proto @@ -3,6 +3,6 @@ syntax="proto3"; package main; message UserMessage { - string Username =1; + string Username = 1; string Text = 2; } \ No newline at end of file diff --git a/conn.go b/conn.go index dc95a2e..d4723eb 100644 --- a/conn.go +++ b/conn.go @@ -18,12 +18,22 @@ type ( // Request returns the http request value. Request() *http.Request // ReadData reads binary or text messages from the remote connection. - ReadData(timeout time.Duration) (body []byte, err error) + ReadData(timeout time.Duration) (body []byte, typ MessageType, err error) // WriteBinary sends a binary message to the remote connection. WriteBinary(body []byte, timeout time.Duration) error // WriteText sends a text message to the remote connection. WriteText(body []byte, timeout time.Duration) error } + + // MessageType is a type for readen and to-send data, helpful to set `msg.SetBinary` + // to the rest of the clients through a Broadcast, as SetBinary is not part of the deserialization. + MessageType uint8 +) + +// See `MessageType` definition for details. +const ( + TextMessage = iota + 1 + BinaryMessage ) // Conn contains the websocket connection and the neffos communication functionality. @@ -83,7 +93,7 @@ type Conn struct { allowNativeMessages bool shouldHandleOnlyNativeMessages bool - queue [][]byte + queue map[MessageType][][]byte queueMutex sync.Mutex // used to fire `conn#Close` once. @@ -320,7 +330,7 @@ func (c *Conn) startReader() { // CLIENT is ready when ACK done // SERVER is ready when ACK is done AND `Server#OnConnected` returns with nil error. for { - b, err := c.socket.ReadData(c.readTimeout) + b, msgTyp, err := c.socket.ReadData(c.readTimeout) if err != nil { c.readiness.unwait(err) return @@ -331,19 +341,19 @@ func (c *Conn) startReader() { } if !c.isAcknowledged() { - if !c.handleACK(b) { + if !c.handleACK(msgTyp, b) { return } continue } atomic.StoreUint32(c.isInsideHandler, 1) - c.HandlePayload(b) + c.HandlePayload(msgTyp, b) atomic.StoreUint32(c.isInsideHandler, 0) } } -func (c *Conn) handleACK(b []byte) bool { +func (c *Conn) handleACK(msgTyp MessageType, b []byte) bool { switch typ := b[0]; typ { case ackBinary: // from client startup to server. @@ -383,7 +393,10 @@ func (c *Conn) handleACK(b []byte) bool { return false default: c.queueMutex.Lock() - c.queue = append(c.queue, b) + if c.queue == nil { + c.queue = make(map[MessageType][][]byte) + } + c.queue[msgTyp] = append(c.queue[msgTyp], b) c.queueMutex.Unlock() } @@ -395,11 +408,13 @@ func (c *Conn) handleQueue() { c.queueMutex.Lock() defer c.queueMutex.Unlock() - for _, b := range c.queue { - c.HandlePayload(b) - } + for msgTyp, q := range c.queue { + for _, b := range q { + c.HandlePayload(msgTyp, b) + } - c.queue = c.queue[0:0] + delete(c.queue, msgTyp) + } } // ErrInvalidPayload can be returned by the internal `handleMessage`. @@ -475,13 +490,13 @@ func (c *Conn) handleMessage(msg Message) error { } // DeserializeMessage returns a Message from the "payload". -func (c *Conn) DeserializeMessage(payload []byte) Message { - return DeserializeMessage(nil, payload, c.allowNativeMessages, c.shouldHandleOnlyNativeMessages) +func (c *Conn) DeserializeMessage(msgTyp MessageType, payload []byte) Message { + return DeserializeMessage(msgTyp, payload, c.allowNativeMessages, c.shouldHandleOnlyNativeMessages) } // HandlePayload fires manually a local event based on the "payload". -func (c *Conn) HandlePayload(payload []byte) error { - return c.handleMessage(c.DeserializeMessage(payload)) +func (c *Conn) HandlePayload(msgTyp MessageType, payload []byte) error { + return c.handleMessage(c.DeserializeMessage(msgTyp, payload)) } const syncWaitDur = 15 * time.Millisecond @@ -902,8 +917,7 @@ func (c *Conn) Write(msg Message) bool { } msg.FromExplicit = "" - b := serializeMessage(nil, msg) - return c.write(b, msg.SetBinary) + return c.write(serializeMessage(msg), msg.SetBinary) } // used when `Ask` caller cares only for successful call and not the message, for performance reasons we just use raw bytes. @@ -959,13 +973,13 @@ func (c *Conn) ask(ctx context.Context, msg Message, mustWaitOnlyTheNextMessage // msg.wait is not required on this state // but we still set it. go func() { - b, err := c.Socket().ReadData(c.readTimeout) + b, msgTyp, err := c.Socket().ReadData(c.readTimeout) if err != nil { ch <- Message{Err: err, isError: true} return } - ch <- c.DeserializeMessage(b) + ch <- c.DeserializeMessage(msgTyp, b) }() } else { c.waitingMessagesMutex.Lock() diff --git a/gobwas/socket.go b/gobwas/socket.go index e2d06cf..a6b303a 100644 --- a/gobwas/socket.go +++ b/gobwas/socket.go @@ -8,6 +8,8 @@ import ( "sync" "time" + "github.com/kataras/neffos" + gobwas "github.com/gobwas/ws" "github.com/gobwas/ws/wsutil" ) @@ -65,7 +67,7 @@ func (s *Socket) Request() *http.Request { } // ReadData reads binary or text messages from the remote connection. -func (s *Socket) ReadData(timeout time.Duration) ([]byte, error) { +func (s *Socket) ReadData(timeout time.Duration) ([]byte, neffos.MessageType, error) { for { if timeout > 0 { s.UnderlyingConn.SetReadDeadline(time.Now().Add(timeout)) @@ -74,19 +76,19 @@ func (s *Socket) ReadData(timeout time.Duration) ([]byte, error) { hdr, err := s.reader.NextFrame() if err != nil { if err == io.EOF { - return nil, io.ErrUnexpectedEOF // for io.ReadAll to return an error if connection remotely closed. + return nil, 0, io.ErrUnexpectedEOF // for io.ReadAll to return an error if connection remotely closed. } - return nil, err + return nil, 0, err } if hdr.OpCode == gobwas.OpClose { - return nil, io.ErrUnexpectedEOF // for io.ReadAll to return an error if connection remotely closed. + return nil, 0, io.ErrUnexpectedEOF // for io.ReadAll to return an error if connection remotely closed. } if hdr.OpCode.IsControl() { err = s.controlHandler(hdr, s.reader) if err != nil { - return nil, err + return nil, 0, err } continue } @@ -94,12 +96,17 @@ func (s *Socket) ReadData(timeout time.Duration) ([]byte, error) { if hdr.OpCode&gobwas.OpBinary == 0 && hdr.OpCode&gobwas.OpText == 0 { err = s.reader.Discard() if err != nil { - return nil, err + return nil, 0, err } continue } - return ioutil.ReadAll(s.reader) + b, err := ioutil.ReadAll(s.reader) + if err != nil { + return nil, 0, err + } + + return b, neffos.MessageType(hdr.OpCode), nil } // for { diff --git a/gorilla/socket.go b/gorilla/socket.go index 3dd1315..11f7b1f 100644 --- a/gorilla/socket.go +++ b/gorilla/socket.go @@ -6,6 +6,8 @@ import ( "sync" "time" + "github.com/kataras/neffos" + gorilla "github.com/gorilla/websocket" ) @@ -39,7 +41,7 @@ func (s *Socket) Request() *http.Request { } // ReadData reads binary or text messages from the remote connection. -func (s *Socket) ReadData(timeout time.Duration) ([]byte, error) { +func (s *Socket) ReadData(timeout time.Duration) ([]byte, neffos.MessageType, error) { for { if timeout > 0 { s.UnderlyingConn.SetReadDeadline(time.Now().Add(timeout)) @@ -47,7 +49,7 @@ func (s *Socket) ReadData(timeout time.Duration) ([]byte, error) { opCode, data, err := s.UnderlyingConn.ReadMessage() if err != nil { - return nil, err + return nil, 0, err } if opCode != gorilla.BinaryMessage && opCode != gorilla.TextMessage { @@ -55,7 +57,7 @@ func (s *Socket) ReadData(timeout time.Duration) ([]byte, error) { continue } - return data, err + return data, neffos.MessageType(opCode), err } } diff --git a/message.go b/message.go index 7f30e3d..7c98a51 100644 --- a/message.go +++ b/message.go @@ -96,8 +96,7 @@ type Message struct { // If true then the writer's checks will not lock connectedNamespacesMutex or roomsMutex again. May be useful in the future, keep that solution. locked bool - // if server or client should write using Binary message. - // This field is not filled on sending/receiving. + // if server or client should write using Binary message or if the incoming message was readen as binary. SetBinary bool } @@ -119,7 +118,7 @@ func (m *Message) isRoomLeft() bool { // Serialize returns this message's transport format. func (m Message) Serialize() []byte { - return serializeMessage(nil, m) + return serializeMessage(m) } type ( @@ -249,13 +248,6 @@ func genWaitStackExchange(wait string) string { return string(wait[0]+waitComesFromStackExchange) + wait[1:] } -type ( - // MessageEncrypt type kept for future use when serializing a message. - MessageEncrypt func(out []byte) []byte - // MessageDecrypt type kept for future use when deserializing a message. - MessageDecrypt func(in []byte) []byte -) - var ( trueByte = []byte{'1'} falseByte = []byte{'0'} @@ -285,7 +277,7 @@ func unescape(s string) string { return strings.Replace(s, messageFieldSeparatorReplacement, messageSeparatorString, -1) } -func serializeMessage(encrypt MessageEncrypt, msg Message) (out []byte) { +func serializeMessage(msg Message) (out []byte) { if msg.IsNative && msg.wait == "" { out = msg.Body } else { @@ -300,10 +292,6 @@ func serializeMessage(encrypt MessageEncrypt, msg Message) (out []byte) { out = serializeOutput(msg.wait, escape(msg.Namespace), escape(msg.Room), escape(msg.Event), msg.Body, msg.Err, msg.isNoOp) } - if encrypt != nil { - out = encrypt(out) - } - return out } @@ -352,11 +340,7 @@ func serializeOutput(wait, namespace, room, event string, // DeserializeMessage accepts a serialized message []byte // and returns a neffos Message. // When allowNativeMessages only Body is filled and check about message format is skipped. -func DeserializeMessage(decrypt MessageDecrypt, b []byte, allowNativeMessages, shouldHandleOnlyNativeMessages bool) Message { - if decrypt != nil { - b = decrypt(b) - } - +func DeserializeMessage(msgTyp MessageType, b []byte, allowNativeMessages, shouldHandleOnlyNativeMessages bool) Message { wait, namespace, room, event, body, err, isNoOp, isInvalid := deserializeInput(b, allowNativeMessages, shouldHandleOnlyNativeMessages) fromExplicit := "" @@ -390,7 +374,7 @@ func DeserializeMessage(decrypt MessageDecrypt, b []byte, allowNativeMessages, s IsLocal: false, IsNative: allowNativeMessages && event == OnNativeMessage, locked: false, - SetBinary: false, + SetBinary: msgTyp == BinaryMessage, } } diff --git a/message_test.go b/message_test.go index 48ef06c..55d2856 100644 --- a/message_test.go +++ b/message_test.go @@ -83,30 +83,30 @@ func TestMessageSerialization(t *testing.T) { } for i, tt := range tests { - got := serializeMessage(nil, tt.msg) + got := serializeMessage(tt.msg) if !bytes.Equal(got, tt.serialized) { t.Fatalf("[%d] serialize: expected %s but got %s", i, tt.serialized, got) } - msg := DeserializeMessage(nil, got, false, false) + msg := DeserializeMessage(TextMessage, got, false, false) if !reflect.DeepEqual(msg, tt.msg) { t.Fatalf("[%d] deserialize: expected\n%#+v but got\n%#+v", i, tt.msg, msg) } } - msg := DeserializeMessage(nil, []byte("default;chat;"), false, false) + msg := DeserializeMessage(TextMessage, []byte("default;chat;"), false, false) if !msg.isInvalid { t.Fatalf("expected message to be invalid but it seems that it is a valid one") } nativeMessage := []byte("a native websocket message") - msg = DeserializeMessage(nil, nativeMessage, true, false) + msg = DeserializeMessage(TextMessage, nativeMessage, true, false) if msg.isInvalid { t.Fatalf("expected message to be valid native/raw websocket messageeven") } nativeMessage = []byte("0;if;we;have;same;number;of;message;tokens;this should pass") - msg = DeserializeMessage(nil, nativeMessage, true, true) + msg = DeserializeMessage(TextMessage, nativeMessage, true, true) if msg.isInvalid { t.Fatalf("expected message to be valid native/raw websocket messageeven") } @@ -129,13 +129,13 @@ func TestMessageSerialization(t *testing.T) { expectedSerialized := []byte(fmt.Sprintf(";contains%ssemi;%sthis%sfor sure%s;thatdoesnot;0;0;", messageFieldSeparatorReplacement, messageFieldSeparatorReplacement, messageFieldSeparatorReplacement, messageFieldSeparatorReplacement)) - gotSerialized := serializeMessage(nil, msg) + gotSerialized := serializeMessage(msg) if !bytes.Equal(expectedSerialized, gotSerialized) { t.Fatalf("expected escaped serialized to be: %s but got: %s", string(expectedSerialized), string(gotSerialized)) } - msgGot := DeserializeMessage(nil, gotSerialized, false, false) + msgGot := DeserializeMessage(TextMessage, gotSerialized, false, false) if !reflect.DeepEqual(msg, msgGot) { t.Fatalf("expected a unescaped message to be:\n%#+v\n\tbut got:\n%#+v", msg, msgGot) } diff --git a/stackexchange/nats/stackexchange_nats.go b/stackexchange/nats/stackexchange_nats.go index 7a5cd61..96688b8 100644 --- a/stackexchange/nats/stackexchange_nats.go +++ b/stackexchange/nats/stackexchange_nats.go @@ -239,7 +239,7 @@ func (exc *StackExchange) getSubject(namespace, room, connID string) string { func makeMsgHandler(c *neffos.Conn) nats.MsgHandler { return func(m *nats.Msg) { - msg := c.DeserializeMessage(m.Data) + msg := c.DeserializeMessage(neffos.TextMessage, m.Data) msg.FromStackExchange = true c.Write(msg) @@ -321,7 +321,7 @@ func (exc *StackExchange) Ask(ctx context.Context, msg neffos.Message, token str ch := make(chan neffos.Message) sub, err := subConn.Subscribe(token, func(m *nats.Msg) { - ch <- neffos.DeserializeMessage(nil, m.Data, false, false) + ch <- neffos.DeserializeMessage(neffos.TextMessage, m.Data, false, false) }) if err != nil { diff --git a/stackexchange/redis/stackexchange_redis.go b/stackexchange/redis/stackexchange_redis.go index af6ee80..4b64bb1 100644 --- a/stackexchange/redis/stackexchange_redis.go +++ b/stackexchange/redis/stackexchange_redis.go @@ -203,8 +203,7 @@ func (exc *StackExchange) OnConnect(c *neffos.Conn) error { go func() { for redisMsg := range redisMsgCh { // neffos.Debugf("[%s] send to client: [%s]", c.ID(), string(redisMsg.Message)) - - msg := c.DeserializeMessage(redisMsg.Message) + msg := c.DeserializeMessage(neffos.TextMessage, redisMsg.Message) msg.FromStackExchange = true c.Write(msg) @@ -269,7 +268,7 @@ func (exc *StackExchange) Ask(ctx context.Context, msg neffos.Message, token str case <-ctx.Done(): err = ctx.Err() case redisMsg := <-msgCh: - response = neffos.DeserializeMessage(nil, redisMsg.Message, false, false) + response = neffos.DeserializeMessage(neffos.TextMessage, redisMsg.Message, false, false) err = response.Err }