1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-12-23 13:03:18 +00:00
musix-oss/node_modules/firebase/firebase-performance-standalone.js
2020-03-03 22:30:50 +02:00

3 lines
44 KiB
JavaScript

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).firebase=t()}(this,function(){"use strict";var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};var a=function(){return(a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function p(o,a,s,c){return new(s=s||Promise)(function(e,t){function n(e){try{i(c.next(e))}catch(e){t(e)}}function r(e){try{i(c.throw(e))}catch(e){t(e)}}function i(t){t.done?e(t.value):new s(function(e){e(t.value)}).then(n,r)}i((c=c.apply(o,a||[])).next())})}function l(n,r){var i,o,a,e,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,o&&(a=2&t[0]?o.return:t[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,t[1])).done)return a;switch(o=0,a&&(t=[2&t[0],a.value]),t[0]){case 0:case 1:a=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,o=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0<(a=s.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){s=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]<a[3])){s.label=t[1];break}if(6===t[0]&&s.label<a[1]){s.label=a[1],a=t;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(t);break}a[2]&&s.ops.pop(),s.trys.pop();continue}t=r.call(n,s)}catch(e){t=[6,e],o=0}finally{i=a=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}}function d(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function f(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function i(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}function m(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:return new Date(t.getTime());case Object:void 0===e&&(e={});break;case Array:e=[];break;default:return t}for(var n in t)t.hasOwnProperty(n)&&(e[n]=m(e[n],t[n]));return e}var o=(e.prototype.wrapCallback=function(n){var r=this;return function(e,t){e?r.reject(e):r.resolve(t),"function"==typeof n&&(r.promise.catch(function(){}),1===n.length?n(e):n(e,t))}},e);function e(){var n=this;this.reject=function(){},this.resolve=function(){},this.promise=new Promise(function(e,t){n.resolve=e,n.reject=t})}var t,r,s,h=(s=Error,n(t=u,r=s),void(t.prototype=null===r?Object.create(r):(c.prototype=r.prototype,new c)),u);function c(){this.constructor=t}function u(e,t){var n=s.call(this,t)||this;return n.code=e,n.name="FirebaseError",Object.setPrototypeOf(n,u.prototype),Error.captureStackTrace&&Error.captureStackTrace(n,v.prototype.create),n}var v=(g.prototype.create=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var r=t[0]||{},i=this.service+"/"+e,o=this.errors[e],a=o?function(e,r){return e.replace(y,function(e,t){var n=r[t];return null!=n?n.toString():"<"+t+"?>"})}(o,r):"Error",s=this.serviceName+": "+a+" ("+i+").",c=new h(i,s),u=0,f=Object.keys(r);u<f.length;u++){var p=f[u];"_"!==p.slice(-1)&&(p in c&&console.warn('Overwriting FirebaseError base field "'+p+'" can cause unexpected behavior.'),c[p]=r[p])}return c},g);function g(e,t,n){this.service=e,this.serviceName=t,this.errors=n}var y=/\{\$([^}]+)}/g;function b(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var w=(_.prototype.setInstantiationMode=function(e){return this.instantiationMode=e,this},_.prototype.setMultipleInstances=function(e){return this.multipleInstances=e,this},_.prototype.setServiceProps=function(e){return this.serviceProps=e,this},_);function _(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY"}var I="[DEFAULT]",S=(E.prototype.get=function(e){void 0===e&&(e=I);var t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){var n=new o;this.instancesDeferred.set(t,n);try{var r=this.getOrInitializeService(t);r&&n.resolve(r)}catch(e){}}return this.instancesDeferred.get(t).promise},E.prototype.getImmediate=function(e){var t=a({identifier:I,optional:!1},e),n=t.identifier,r=t.optional,i=this.normalizeInstanceIdentifier(n);try{var o=this.getOrInitializeService(i);if(o)return o;if(r)return null;throw Error("Service "+this.name+" is not available")}catch(e){if(r)return null;throw e}},E.prototype.getComponent=function(){return this.component},E.prototype.setComponent=function(e){var t,n;if(e.name!==this.name)throw Error("Mismatching Component "+e.name+" for Provider "+this.name+".");if(this.component)throw Error("Component for "+this.name+" has already been provided");if(function(e){return"EAGER"===e.instantiationMode}(this.component=e))try{this.getOrInitializeService(I)}catch(e){}try{for(var r=d(this.instancesDeferred.entries()),i=r.next();!i.done;i=r.next()){var o=f(i.value,2),a=o[0],s=o[1],c=this.normalizeInstanceIdentifier(a);try{var u=this.getOrInitializeService(c);s.resolve(u)}catch(e){}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}},E.prototype.clearInstance=function(e){void 0===e&&(e=I),this.instancesDeferred.delete(e),this.instances.delete(e)},E.prototype.delete=function(){return p(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return t=Array.from(this.instances.values()),[4,Promise.all(t.filter(function(e){return"INTERNAL"in e}).map(function(e){return e.INTERNAL.delete()}))];case 1:return e.sent(),[2]}})})},E.prototype.isComponentSet=function(){return null!=this.component},E.prototype.getOrInitializeService=function(e){var t=this.instances.get(e);return!t&&this.component&&(t=this.component.instanceFactory(this.container,function(e){return e===I?void 0:e}(e)),this.instances.set(e,t)),t||null},E.prototype.normalizeInstanceIdentifier=function(e){return this.component?this.component.multipleInstances?e:I:e},E);function E(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map}var T,A,N=(k.prototype.addComponent=function(e){var t=this.getProvider(e.name);if(t.isComponentSet())throw new Error("Component "+e.name+" has already been registered with "+this.name);t.setComponent(e)},k.prototype.addOrOverwriteComponent=function(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)},k.prototype.getProvider=function(e){if(this.providers.has(e))return this.providers.get(e);var t=new S(e,this);return this.providers.set(e,t),t},k.prototype.getProviders=function(){return Array.from(this.providers.values())},k);function k(e){this.name=e,this.providers=new Map}function O(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}(A=T=T||{})[A.DEBUG=0]="DEBUG",A[A.VERBOSE=1]="VERBOSE",A[A.INFO=2]="INFO",A[A.WARN=3]="WARN",A[A.ERROR=4]="ERROR",A[A.SILENT=5]="SILENT";function P(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!(t<e.logLevel)){var i=(new Date).toISOString();switch(t){case T.DEBUG:case T.VERBOSE:console.log.apply(console,O(["["+i+"] "+e.name+":"],n));break;case T.INFO:console.info.apply(console,O(["["+i+"] "+e.name+":"],n));break;case T.WARN:console.warn.apply(console,O(["["+i+"] "+e.name+":"],n));break;case T.ERROR:console.error.apply(console,O(["["+i+"] "+e.name+":"],n));break;default:throw new Error("Attempted to log a message with an invalid logType (value: "+t+")")}}}var C,D=T.INFO,j=(Object.defineProperty(R.prototype,"logLevel",{get:function(){return this._logLevel},set:function(e){if(!(e in T))throw new TypeError("Invalid value assigned to `logLevel`");this._logLevel=e},enumerable:!0,configurable:!0}),Object.defineProperty(R.prototype,"logHandler",{get:function(){return this._logHandler},set:function(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e},enumerable:!0,configurable:!0}),R.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._logHandler.apply(this,O([this,T.DEBUG],e))},R.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._logHandler.apply(this,O([this,T.VERBOSE],e))},R.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._logHandler.apply(this,O([this,T.INFO],e))},R.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._logHandler.apply(this,O([this,T.WARN],e))},R.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._logHandler.apply(this,O([this,T.ERROR],e))},R);function R(e){this.name=e,this._logLevel=D,this._logHandler=P}var M,L=((C={})["no-app"]="No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()",C["bad-app-name"]="Illegal App name: '{$appName}",C["duplicate-app"]="Firebase App named '{$appName}' already exists",C["app-deleted"]="Firebase App named '{$appName}' already deleted",C["invalid-app-argument"]="firebase.{$appName}() takes either no argument or a Firebase App instance.",C),x=new v("app","Firebase",L),B="@firebase/app",U="[DEFAULT]",F=((M={})[B]="fire-core",M["@firebase/analytics"]="fire-analytics",M["@firebase/auth"]="fire-auth",M["@firebase/database"]="fire-rtdb",M["@firebase/functions"]="fire-fn",M["@firebase/installations"]="fire-iid",M["@firebase/messaging"]="fire-fcm",M["@firebase/performance"]="fire-perf",M["@firebase/remote-config"]="fire-rc",M["@firebase/storage"]="fire-gcs",M["@firebase/firestore"]="fire-fst",M["fire-js"]="fire-js",M["firebase-wrapper"]="fire-js-all",M),q=(Object.defineProperty(V.prototype,"automaticDataCollectionEnabled",{get:function(){return this.checkDestroyed_(),this.automaticDataCollectionEnabled_},set:function(e){this.checkDestroyed_(),this.automaticDataCollectionEnabled_=e},enumerable:!0,configurable:!0}),Object.defineProperty(V.prototype,"name",{get:function(){return this.checkDestroyed_(),this.name_},enumerable:!0,configurable:!0}),Object.defineProperty(V.prototype,"options",{get:function(){return this.checkDestroyed_(),this.options_},enumerable:!0,configurable:!0}),V.prototype.delete=function(){var t=this;return new Promise(function(e){t.checkDestroyed_(),e()}).then(function(){return t.firebase_.INTERNAL.removeApp(t.name_),Promise.all(t.container.getProviders().map(function(e){return e.delete()}))}).then(function(){t.isDeleted_=!0})},V.prototype._getService=function(e,t){return void 0===t&&(t=U),this.checkDestroyed_(),this.container.getProvider(e).getImmediate({identifier:t})},V.prototype.checkDestroyed_=function(){if(this.isDeleted_)throw x.create("app-deleted",{appName:this.name_})},V);function V(e,t,n){var r,i,o=this;this.firebase_=n,this.isDeleted_=!1,this.INTERNAL={},this.name_=t.name,this.automaticDataCollectionEnabled_=t.automaticDataCollectionEnabled||!1,this.options_=function(e){return m(void 0,e)}(e),this.container=new N(t.name),this.container.addComponent(new w("app",function(){return o},"PUBLIC"));try{for(var a=d(this.firebase_.INTERNAL.components.values()),s=a.next();!s.done;s=a.next()){var c=s.value;this.container.addComponent(c)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}}var K="7.8.0",$=new j("@firebase/app");function z(c){var u={},f=new Map,p={__esModule:!0,initializeApp:function(e,t){void 0===t&&(t={});if("object"!=typeof t||null===t){t={name:t}}var n=t;void 0===n.name&&(n.name=U);var r=n.name;if("string"!=typeof r||!r)throw x.create("bad-app-name",{appName:String(r)});if(b(u,r))throw x.create("duplicate-app",{appName:r});var i=new c(e,n,p);return u[r]=i},app:l,registerVersion:function(e,t,n){var r,i=null!==(r=F[e])&&void 0!==r?r:e;n&&(i+="-"+n);var o=i.match(/\s|\//),a=t.match(/\s|\//);if(o||a){var s=['Unable to register library "'+i+'" with version "'+t+'":'];return o&&s.push('library name "'+i+'" contains illegal characters (whitespace or "/")'),o&&a&&s.push("and"),a&&s.push('version name "'+t+'" contains illegal characters (whitespace or "/")'),void $.warn(s.join(" "))}h(new w(i+"-version",function(){return{library:i,version:t}},"VERSION"))},apps:null,SDK_VERSION:K,INTERNAL:{registerComponent:h,removeApp:function(e){delete u[e]},components:f,useAsService:function(e,t){return"serverAuth"!==t?t:null}}};function l(e){if(!b(u,e=e||U))throw x.create("no-app",{appName:e});return u[e]}function h(n){var t,e,r=n.name;if(f.has(r))return $.debug("There were multiple attempts to register component "+r+"."),"PUBLIC"===n.type?p[r]:null;if(f.set(r,n),"PUBLIC"===n.type){var i=function(e){if(void 0===e&&(e=l()),"function"!=typeof e[r])throw x.create("invalid-app-argument",{appName:r});return e[r]()};void 0!==n.serviceProps&&m(i,n.serviceProps),p[r]=i,c.prototype[r]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._getService.bind(this,r).apply(this,n.multipleInstances?e:[])}}try{for(var o=d(Object.keys(u)),a=o.next();!a.done;a=o.next()){var s=a.value;u[s]._addComponent(n)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}return"PUBLIC"===n.type?p[r]:null}return p.default=p,Object.defineProperty(p,"apps",{get:function(){return Object.keys(u).map(function(e){return u[e]})}}),l.App=c,p}var H=(W.prototype.getPlatformInfoString=function(){return this.container.getProviders().map(function(e){if(function(e){var t,n=e.getComponent();return"VERSION"===(null===(t=n)||void 0===t?void 0:t.type)}(e)){var t=e.getImmediate();return t.library+"/"+t.version}return null}).filter(function(e){return e}).join(" ")},W);function W(e){this.container=e}var J,G,Z=function(){var e=z(q);e.SDK_VERSION=e.SDK_VERSION+"_LITE";var t=e.INTERNAL.registerComponent;return e.INTERNAL.registerComponent=function(e){if("PUBLIC"!==e.type||"performance"===e.name||"installations"===e.name)return t(e);throw Error(name+" cannot register with the standalone perf instance")},e}();function Y(n){return new Promise(function(e,t){n.onsuccess=function(){e(n.result)},n.onerror=function(){t(n.error)}})}function Q(n,r,i){var o,e=new Promise(function(e,t){Y(o=n[r].apply(n,i)).then(e,t)});return e.request=o,e}function X(e,n,t){t.forEach(function(t){Object.defineProperty(e.prototype,t,{get:function(){return this[n][t]},set:function(e){this[n][t]=e}})})}function ee(t,n,r,e){e.forEach(function(e){e in r.prototype&&(t.prototype[e]=function(){return Q(this[n],e,arguments)})})}function te(t,n,r,e){e.forEach(function(e){e in r.prototype&&(t.prototype[e]=function(){return this[n][e].apply(this[n],arguments)})})}function ne(t,n,r,e){e.forEach(function(e){e in r.prototype&&(t.prototype[e]=function(){return function(e,t,n){var r=Q(e,t,n);return r.then(function(e){if(e)return new ie(e,r.request)})}(this[n],e,arguments)})})}function re(e){this._index=e}function ie(e,t){this._cursor=e,this._request=t}function oe(e){this._store=e}function ae(n){this._tx=n,this.complete=new Promise(function(e,t){n.oncomplete=function(){e()},n.onerror=function(){t(n.error)},n.onabort=function(){t(n.error)}})}function se(e,t,n){this._db=e,this.oldVersion=t,this.transaction=new ae(n)}function ce(e){this._db=e}G="lite",(J=Z).INTERNAL.registerComponent(new w("platform-logger",function(e){return new H(e)},"PRIVATE")),J.registerVersion(B,"0.5.3",G),J.registerVersion("fire-js",""),X(re,"_index",["name","keyPath","multiEntry","unique"]),ee(re,"_index",IDBIndex,["get","getKey","getAll","getAllKeys","count"]),ne(re,"_index",IDBIndex,["openCursor","openKeyCursor"]),X(ie,"_cursor",["direction","key","primaryKey","value"]),ee(ie,"_cursor",IDBCursor,["update","delete"]),["advance","continue","continuePrimaryKey"].forEach(function(n){n in IDBCursor.prototype&&(ie.prototype[n]=function(){var t=this,e=arguments;return Promise.resolve().then(function(){return t._cursor[n].apply(t._cursor,e),Y(t._request).then(function(e){if(e)return new ie(e,t._request)})})})}),oe.prototype.createIndex=function(){return new re(this._store.createIndex.apply(this._store,arguments))},oe.prototype.index=function(){return new re(this._store.index.apply(this._store,arguments))},X(oe,"_store",["name","keyPath","indexNames","autoIncrement"]),ee(oe,"_store",IDBObjectStore,["put","add","delete","clear","get","getAll","getKey","getAllKeys","count"]),ne(oe,"_store",IDBObjectStore,["openCursor","openKeyCursor"]),te(oe,"_store",IDBObjectStore,["deleteIndex"]),ae.prototype.objectStore=function(){return new oe(this._tx.objectStore.apply(this._tx,arguments))},X(ae,"_tx",["objectStoreNames","mode"]),te(ae,"_tx",IDBTransaction,["abort"]),se.prototype.createObjectStore=function(){return new oe(this._db.createObjectStore.apply(this._db,arguments))},X(se,"_db",["name","version","objectStoreNames"]),te(se,"_db",IDBDatabase,["deleteObjectStore","close"]),ce.prototype.transaction=function(){return new ae(this._db.transaction.apply(this._db,arguments))},X(ce,"_db",["name","version","objectStoreNames"]),te(ce,"_db",IDBDatabase,["close"]),["openCursor","openKeyCursor"].forEach(function(i){[oe,re].forEach(function(e){i in e.prototype&&(e.prototype[i.replace("open","iterate")]=function(){var e=function(e){return Array.prototype.slice.call(e)}(arguments),t=e[e.length-1],n=this._store||this._index,r=n[i].apply(n,e.slice(0,-1));r.onsuccess=function(){t(r.result)}})})}),[re,oe].forEach(function(e){e.prototype.getAll||(e.prototype.getAll=function(e,n){var r=this,i=[];return new Promise(function(t){r.iterateCursor(e,function(e){e?(i.push(e.value),void 0===n||i.length!=n?e.continue():t(i)):t(i)})})})});var ue,fe=1e4,pe="w:0.4.1",le="FIS_v2",he="https://firebaseinstallations.googleapis.com/v1",de=36e5,me=((ue={})["missing-app-config-values"]='Missing App configuration value: "{$valueName}"',ue["not-registered"]="Firebase Installation is not registered.",ue["installation-not-found"]="Firebase Installation not found.",ue["request-failed"]='{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',ue["app-offline"]="Could not process request. Application offline.",ue["delete-pending-registration"]="Can't delete installation while there is a pending registration request.",ue),ve=new v("installations","Installations",me);function ge(e){return e instanceof h&&e.code.includes("request-failed")}function ye(e){var t=e.projectId;return he+"/projects/"+t+"/installations"}function be(e){return{token:e.token,requestStatus:2,expiresIn:function(e){return Number(e.replace("s","000"))}(e.expiresIn),creationTime:Date.now()}}function we(r,i){return p(this,void 0,void 0,function(){var t,n;return l(this,function(e){switch(e.label){case 0:return[4,i.json()];case 1:return t=e.sent(),n=t.error,[2,ve.create("request-failed",{requestName:r,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})]}})})}function _e(e){var t=e.apiKey;return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":t})}function Ie(e,t){var n=t.refreshToken,r=_e(e);return r.append("Authorization",function(e){return le+" "+e}(n)),r}function Se(n){return p(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return[4,n()];case 1:return 500<=(t=e.sent()).status&&t.status<600?[2,n()]:[2,t]}})})}function Ee(t){return new Promise(function(e){setTimeout(e,t)})}function Te(e){return btoa(String.fromCharCode.apply(String,function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(f(arguments[t]));return e}(e))).replace(/\+/g,"-").replace(/\//g,"_")}var Ae=/^[cdef][\w-]{21}$/,Ne="";function ke(){try{var e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;var t=function(e){return Te(e).substr(0,22)}(e);return Ae.test(t)?t:Ne}catch(e){return Ne}}function Oe(e){return e.appName+"!"+e.appId}var Pe=new Map;function Ce(e,t){var n=Oe(e);De(n,t),function(e,t){var n=Re();n&&n.postMessage({key:e,fid:t});Me()}(n,t)}function De(e,t){var n,r,i=Pe.get(e);if(i)try{for(var o=d(i),a=o.next();!a.done;a=o.next()){(0,a.value)(t)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}var je=null;function Re(){return!je&&"BroadcastChannel"in self&&((je=new BroadcastChannel("[Firebase] FID Change")).onmessage=function(e){De(e.data.key,e.data.fid)}),je}function Me(){0===Pe.size&&je&&(je.close(),je=null)}var Le,xe="firebase-installations-database",Be=1,Ue="firebase-installations-store",Fe=null;function qe(){return Fe=Fe||function(e,t,n){var r=Q(indexedDB,"open",[e,t]),i=r.request;return i&&(i.onupgradeneeded=function(e){n&&n(new se(i.result,e.oldVersion,i.transaction))}),r.then(function(e){return new ce(e)})}(xe,Be,function(e){switch(e.oldVersion){case 0:e.createObjectStore(Ue)}})}function Ve(a,s){return p(this,void 0,void 0,function(){var t,n,r,i,o;return l(this,function(e){switch(e.label){case 0:return t=Oe(a),[4,qe()];case 1:return n=e.sent(),r=n.transaction(Ue,"readwrite"),[4,(i=r.objectStore(Ue)).get(t)];case 2:return o=e.sent(),[4,i.put(s,t)];case 3:return e.sent(),[4,r.complete];case 4:return e.sent(),o&&o.fid===s.fid||Ce(a,s.fid),[2,s]}})})}function Ke(i){return p(this,void 0,void 0,function(){var t,n,r;return l(this,function(e){switch(e.label){case 0:return t=Oe(i),[4,qe()];case 1:return n=e.sent(),[4,(r=n.transaction(Ue,"readwrite")).objectStore(Ue).delete(t)];case 2:return e.sent(),[4,r.complete];case 3:return e.sent(),[2]}})})}function $e(s,c){return p(this,void 0,void 0,function(){var t,n,r,i,o,a;return l(this,function(e){switch(e.label){case 0:return t=Oe(s),[4,qe()];case 1:return n=e.sent(),r=n.transaction(Ue,"readwrite"),[4,(i=r.objectStore(Ue)).get(t)];case 2:return o=e.sent(),void 0!==(a=c(o))?[3,4]:[4,i.delete(t)];case 3:return e.sent(),[3,6];case 4:return[4,i.put(a,t)];case 5:e.sent(),e.label=6;case 6:return[4,r.complete];case 7:return e.sent(),!a||o&&o.fid===a.fid||Ce(s,a.fid),[2,a]}})})}function ze(i){return p(this,void 0,void 0,function(){var r,t,n;return l(this,function(e){switch(e.label){case 0:return[4,$e(i,function(e){var t=function(e){return We(e||{fid:ke(),registrationStatus:0})}(e),n=function(e,t){{if(0!==t.registrationStatus)return 1===t.registrationStatus?{installationEntry:t,registrationPromise:function(o){return p(this,void 0,void 0,function(){var t,n,r,i;return l(this,function(e){switch(e.label){case 0:return[4,He(o)];case 1:t=e.sent(),e.label=2;case 2:return 1!==t.registrationStatus?[3,5]:[4,Ee(100)];case 3:return e.sent(),[4,He(o)];case 4:return t=e.sent(),[3,2];case 5:return 0!==t.registrationStatus?[3,7]:[4,ze(o)];case 6:return n=e.sent(),r=n.installationEntry,(i=n.registrationPromise)?[2,i]:[2,r];case 7:return[2,t]}})})}(e)}:{installationEntry:t};if(!navigator.onLine){var n=Promise.reject(ve.create("app-offline"));return{installationEntry:t,registrationPromise:n}}var r={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},i=function(r,i){return p(this,void 0,void 0,function(){var t,n;return l(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,7]),[4,function(s,e){var c=e.fid;return p(this,void 0,void 0,function(){var t,n,r,i,o,a;return l(this,function(e){switch(e.label){case 0:return t=ye(s),n=_e(s),r={fid:c,authVersion:le,appId:s.appId,sdkVersion:pe},i={method:"POST",headers:n,body:JSON.stringify(r)},[4,Se(function(){return fetch(t,i)})];case 1:return(o=e.sent()).ok?[4,o.json()]:[3,3];case 2:return a=e.sent(),[2,{fid:a.fid||c,registrationStatus:2,refreshToken:a.refreshToken,authToken:be(a.authToken)}];case 3:return[4,we("Create Installation",o)];case 4:throw e.sent()}})})}(r,i)];case 1:return t=e.sent(),[2,Ve(r,t)];case 2:return ge(n=e.sent())&&409===n.serverCode?[4,Ke(r)]:[3,4];case 3:return e.sent(),[3,6];case 4:return[4,Ve(r,{fid:i.fid,registrationStatus:0})];case 5:e.sent(),e.label=6;case 6:throw n;case 7:return[2]}})})}(e,r);return{installationEntry:r,registrationPromise:i}}}(i,t);return r=n.registrationPromise,n.installationEntry})];case 1:return(t=e.sent()).fid!==Ne?[3,3]:(n={},[4,r]);case 2:return[2,(n.installationEntry=e.sent(),n)];case 3:return[2,{installationEntry:t,registrationPromise:r}]}})})}function He(e){return $e(e,function(e){if(!e)throw ve.create("installation-not-found");return We(e)})}function We(e){return function(e){return 1===e.registrationStatus&&e.registrationTime+fe<Date.now()}(e)?{fid:e.fid,registrationStatus:0}:e}function Je(e,c){var u=e.appConfig,f=e.platformLoggerProvider;return p(this,void 0,void 0,function(){var t,n,r,i,o,a,s;return l(this,function(e){switch(e.label){case 0:return t=function(e,t){var n=t.fid;return ye(e)+"/"+n+"/authTokens:generate"}(u,c),n=Ie(u,c),(r=f.getImmediate({optional:!0}))&&n.append("x-firebase-client",r.getPlatformInfoString()),i={installation:{sdkVersion:pe}},o={method:"POST",headers:n,body:JSON.stringify(i)},[4,Se(function(){return fetch(t,o)})];case 1:return(a=e.sent()).ok?[4,a.json()]:[3,3];case 2:return s=e.sent(),[2,be(s)];case 3:return[4,we("Generate Auth Token",a)];case 4:throw e.sent()}})})}function Ge(i,o){return void 0===o&&(o=!1),p(this,void 0,void 0,function(){var r,t,n;return l(this,function(e){switch(e.label){case 0:return[4,$e(i.appConfig,function(e){if(!Ye(e))throw ve.create("not-registered");var t=e.authToken;if(!o&&function(e){return 2===e.requestStatus&&!function(e){var t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+de}(e)}(t))return e;if(1===t.requestStatus)return r=function(r,i){return p(this,void 0,void 0,function(){var t,n;return l(this,function(e){switch(e.label){case 0:return[4,Ze(r.appConfig)];case 1:t=e.sent(),e.label=2;case 2:return 1!==t.authToken.requestStatus?[3,5]:[4,Ee(100)];case 3:return e.sent(),[4,Ze(r.appConfig)];case 4:return t=e.sent(),[3,2];case 5:return 0===(n=t.authToken).requestStatus?[2,Ge(r,i)]:[2,n]}})})}(i,o),e;if(!navigator.onLine)throw ve.create("app-offline");var n=function(e){var t={requestStatus:1,requestTime:Date.now()};return a(a({},e),{authToken:t})}(e);return r=function(i,o){return p(this,void 0,void 0,function(){var t,n,r;return l(this,function(e){switch(e.label){case 0:return e.trys.push([0,3,,8]),[4,Je(i,o)];case 1:return t=e.sent(),r=a(a({},o),{authToken:t}),[4,Ve(i.appConfig,r)];case 2:return e.sent(),[2,t];case 3:return!ge(n=e.sent())||401!==n.serverCode&&404!==n.serverCode?[3,5]:[4,Ke(i.appConfig)];case 4:return e.sent(),[3,7];case 5:return r=a(a({},o),{authToken:{requestStatus:0}}),[4,Ve(i.appConfig,r)];case 6:e.sent(),e.label=7;case 7:throw n;case 8:return[2]}})})}(i,n),n})];case 1:return t=e.sent(),r?[4,r]:[3,3];case 2:return n=e.sent(),[3,4];case 3:n=t.authToken,e.label=4;case 4:return[2,n]}})})}function Ze(e){return $e(e,function(e){if(!Ye(e))throw ve.create("not-registered");return function(e){return 1===e.requestStatus&&e.requestTime+fe<Date.now()}(e.authToken)?a(a({},e),{authToken:{requestStatus:0}}):e})}function Ye(e){return void 0!==e&&2===e.registrationStatus}function Qe(t,n){return void 0===n&&(n=!1),p(this,void 0,void 0,function(){return l(this,function(e){switch(e.label){case 0:return[4,function(n){return p(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return[4,ze(n)];case 1:return(t=e.sent().registrationPromise)?[4,t]:[3,3];case 2:e.sent(),e.label=3;case 3:return[2]}})})}(t.appConfig)];case 1:return e.sent(),[4,Ge(t,n)];case 2:return[2,e.sent().token]}})})}function Xe(o,a){return p(this,void 0,void 0,function(){var t,n,r,i;return l(this,function(e){switch(e.label){case 0:return t=function(e,t){var n=t.fid;return ye(e)+"/"+n}(o,a),n=Ie(o,a),r={method:"DELETE",headers:n},[4,Se(function(){return fetch(t,r)})];case 1:return(i=e.sent()).ok?[3,3]:[4,we("Delete Installation",i)];case 2:throw e.sent();case 3:return[2]}})})}function et(e,t){var n=e.appConfig;return function(e,t){Re();var n=Oe(e),r=Pe.get(n);r||(r=new Set,Pe.set(n,r)),r.add(t)}(n,t),function(){!function(e,t){var n=Oe(e),r=Pe.get(n);r&&(r.delete(t),0===r.size&&Pe.delete(n),Me())}(n,t)}}function tt(e){return ve.create("missing-app-config-values",{valueName:e})}(Le=Z).INTERNAL.registerComponent(new w("installations",function(e){var t=e.getProvider("app").getImmediate(),n={appConfig:function(e){var t,n;if(!e||!e.options)throw tt("App Configuration");if(!e.name)throw tt("App Name");try{for(var r=d(["projectId","apiKey","appId"]),i=r.next();!i.done;i=r.next()){var o=i.value;if(!e.options[o])throw tt(o)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t),platformLoggerProvider:e.getProvider("platform-logger")};return{app:t,getId:function(){return function(i){return p(this,void 0,void 0,function(){var t,n,r;return l(this,function(e){switch(e.label){case 0:return[4,ze(i.appConfig)];case 1:return t=e.sent(),n=t.installationEntry,(r=t.registrationPromise)?r.catch(console.error):Ge(i).catch(console.error),[2,n.fid]}})})}(n)},getToken:function(e){return Qe(n,e)},delete:function(){return function(r){return p(this,void 0,void 0,function(){var t,n;return l(this,function(e){switch(e.label){case 0:return[4,$e(t=r.appConfig,function(e){if(!e||0!==e.registrationStatus)return e})];case 1:if(!(n=e.sent()))return[3,6];if(1!==n.registrationStatus)return[3,2];throw ve.create("delete-pending-registration");case 2:if(2!==n.registrationStatus)return[3,6];if(navigator.onLine)return[3,3];throw ve.create("app-offline");case 3:return[4,Xe(t,n)];case 4:return e.sent(),[4,Ke(t)];case 5:e.sent(),e.label=6;case 6:return[2]}})})}(n)},onIdChange:function(e){return et(n,e)}}},"PUBLIC")),Le.registerVersion("@firebase/installations","0.4.1");var nt,rt,it,ot,at="0.2.31",st="FB-PERF-TRACE-MEASURE",ct="@firebase/performance/config",ut="@firebase/performance/configexpire",ft="Performance",pt=((nt={})["trace started"]="Trace {$traceName} was started before.",nt["trace stopped"]="Trace {$traceName} is not running.",nt["no window"]="Window is not available.",nt["no app id"]="App id is not available.",nt["no project id"]="Project id is not available.",nt["no api key"]="Api key is not available.",nt["invalid cc log"]="Attempted to queue invalid cc event",nt["FB not default"]="Performance can only start when Firebase app instance is the default one.",nt["RC response not ok"]="RC response is not ok",nt["invalid attribute name"]="Attribute name {$attributeName} is invalid.",nt["invalid attribute value"]="Attribute value {$attributeValue} is invalid.",nt["invalide custom metric name"]="Custom metric name {$customMetricName} is invalid",nt),lt=new v("performance",ft,pt),ht=(dt.prototype.getUrl=function(){return this.windowLocation.href.split("?")[0]},dt.prototype.mark=function(e){this.performance&&this.performance.mark&&this.performance.mark(e)},dt.prototype.measure=function(e,t,n){this.performance&&this.performance.measure&&this.performance.measure(e,t,n)},dt.prototype.getEntriesByType=function(e){return this.performance&&this.performance.getEntriesByType?this.performance.getEntriesByType(e):[]},dt.prototype.getEntriesByName=function(e){return this.performance&&this.performance.getEntriesByName?this.performance.getEntriesByName(e):[]},dt.prototype.getTimeOrigin=function(){return this.performance&&(this.performance.timeOrigin||this.performance.timing.navigationStart)},dt.prototype.requiredApisAvailable=function(){return!!(fetch&&Promise&&this.navigator&&this.navigator.cookieEnabled)},dt.prototype.setupObserver=function(e,i){this.PerformanceObserver&&new this.PerformanceObserver(function(e){for(var t=0,n=e.getEntries();t<n.length;t++){var r=n[t];i(r)}}).observe({entryTypes:[e]})},dt.getInstance=function(){return void 0===rt&&(rt=new dt(it)),rt},dt);function dt(e){if(!(this.window=e))throw lt.create("no window");this.performance=e.performance,this.PerformanceObserver=e.PerformanceObserver,this.windowLocation=e.location,this.navigator=e.navigator,this.document=e.document,this.navigator&&this.navigator.cookieEnabled&&(this.localStorage=e.localStorage),e.perfMetrics&&e.perfMetrics.onFirstInputDelay&&(this.onFirstInputDelay=e.perfMetrics.onFirstInputDelay)}var mt,vt,gt,yt=(bt.prototype.getAppId=function(){var e=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.appId;if(!e)throw lt.create("no app id");return e},bt.prototype.getProjectId=function(){var e=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.projectId;if(!e)throw lt.create("no project id");return e},bt.prototype.getApiKey=function(){var e=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.apiKey;if(!e)throw lt.create("no api key");return e},bt.getInstance=function(){return void 0===ot&&(ot=new bt),ot},bt);function bt(){this.instrumentationEnabled=!0,this.dataCollectionEnabled=!0,this.loggingEnabled=!1,this.tracesSamplingRate=1,this.networkRequestsSamplingRate=1,this.logEndPointUrl="https://firebaselogging.googleapis.com/v0cc/log?format=json_proto",this.logSource=462,this.logTraceAfterSampling=!1,this.logNetworkAfterSampling=!1,this.configTimeToLive=12}function wt(){return mt}(gt=vt=vt||{})[gt.UNKNOWN=0]="UNKNOWN",gt[gt.VISIBLE=1]="VISIBLE",gt[gt.HIDDEN=2]="HIDDEN";var _t=["firebase_","google_","ga_"],It=new RegExp("^[a-zA-Z]\\w*$");function St(){switch(ht.getInstance().document.visibilityState){case"visible":return vt.VISIBLE;case"hidden":return vt.HIDDEN;default:return vt.UNKNOWN}}var Et=new j(ft);Et.logLevel=T.INFO;var Tt="0.0.1",At={loggingEnabled:!0},Nt="FIREBASE_INSTALLATIONS_AUTH";function kt(e){var t=function(){var e=ht.getInstance().localStorage;if(!e)return;var t=e.getItem(ut);if(!t||!function(e){return Number(e)>Date.now()}(t))return;var n=e.getItem(ct);if(!n)return;try{return JSON.parse(n)}catch(e){return}}();return t?(Pt(t),Promise.resolve()):function(r){return function(){var e=yt.getInstance().installationsService.getToken();return e.then(function(e){}),e}().then(function(e){var t="https://firebaseremoteconfig.googleapis.com/v1/projects/"+yt.getInstance().getProjectId()+"/namespaces/fireperf:fetch?key="+yt.getInstance().getApiKey(),n=new Request(t,{method:"POST",headers:{Authorization:Nt+" "+e},body:JSON.stringify({app_instance_id:r,app_instance_id_token:e,app_id:yt.getInstance().getAppId(),app_version:at,sdk_version:Tt})});return fetch(n).then(function(e){if(e.ok)return e.json();throw lt.create("RC response not ok")})}).catch(function(){Et.info(Ot)})}(e).then(function(e){return Pt(e)}).then(function(e){return function(e){var t=ht.getInstance().localStorage;if(!e||!t)return;t.setItem(ct,JSON.stringify(e)),t.setItem(ut,String(Date.now()+60*yt.getInstance().configTimeToLive*60*1e3))}(e)},function(){})}var Ot="Could not fetch config, will use default configs";function Pt(e){if(!e)return e;var t=yt.getInstance(),n=e.entries||{};return void 0!==n.fpr_enabled?t.loggingEnabled="true"===String(n.fpr_enabled):t.loggingEnabled=At.loggingEnabled,n.fpr_log_source&&(t.logSource=Number(n.fpr_log_source)),n.fpr_log_endpoint_url&&(t.logEndPointUrl=n.fpr_log_endpoint_url),void 0!==n.fpr_vc_network_request_sampling_rate&&(t.networkRequestsSamplingRate=Number(n.fpr_vc_network_request_sampling_rate)),void 0!==n.fpr_vc_trace_sampling_rate&&(t.tracesSamplingRate=Number(n.fpr_vc_trace_sampling_rate)),t.logTraceAfterSampling=Ct(t.tracesSamplingRate),t.logNetworkAfterSampling=Ct(t.networkRequestsSamplingRate),e}function Ct(e){return Math.random()<=e}var Dt,jt=1;function Rt(){return jt=2,Dt=Dt||function(){var n=ht.getInstance().document;return new Promise(function(e){if(n&&"complete"!==n.readyState){var t=function(){"complete"===n.readyState&&(n.removeEventListener("readystatechange",t),e())};n.addEventListener("readystatechange",t)}else e()})}().then(function(){return function(){var e=yt.getInstance().installationsService.getId();return e.then(function(e){mt=e}),e}()}).then(function(e){return kt(e)}).then(function(){return Mt()},function(){return Mt()})}function Mt(){jt=3}var Lt,xt=1e4,Bt=5500,Ut=3,Ft=Ut,qt=[],Vt=!1;function Kt(){Vt||(!function r(e){setTimeout(function(){if(0!==Ft){if(!qt.length)return r(xt);var e=i(qt);qt=[];var t=e.map(function(e){return{source_extension_json_proto3:e.message,event_time_ms:String(e.eventTime)}}),n={request_time_ms:String(Date.now()),client_info:{client_type:1,js_client_info:{}},log_source:yt.getInstance().logSource,log_event:t};fetch(yt.getInstance().logEndPointUrl,{method:"POST",body:JSON.stringify(n)}).then(function(e){return e.ok||Et.info("Call to Firebase backend failed."),e.json()}).then(function(e){var t=Number(e.next_request_wait_millis),n=isNaN(t)?xt:Math.max(xt,t);Ft=Ut,r(n)}).catch(function(){qt=i(e,qt),Ft--,Et.info("Tries left: "+Ft+"."),r(xt)})}},e)}(Bt),Vt=!0)}function $t(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];!function(e){if(!e.eventTime||!e.message)throw lt.create("invalid cc log");qt=i(qt,[e])}({message:n.apply(void 0,e),eventTime:Date.now()})}}function zt(e,t){(Lt=Lt||$t(Jt))(e,t)}function Ht(e){var t=yt.getInstance();!t.instrumentationEnabled&&e.isAuto||(t.dataCollectionEnabled||e.isAuto)&&ht.getInstance().requiredApisAvailable()&&(e.isAuto&&St()!==vt.VISIBLE||t.loggingEnabled&&t.logTraceAfterSampling&&(3===jt?Wt(e):Rt().then(function(){return Wt(e)},function(){return Wt(e)})))}function Wt(e){wt()&&setTimeout(function(){return zt(e,1)},0)}function Jt(e,t){return 0===t?function(e){var t={url:e.url,http_method:e.httpMethod||0,http_response_code:200,response_payload_bytes:e.responsePayloadBytes,client_start_time_us:e.startTimeUs,time_to_response_initiated_us:e.timeToResponseInitiatedUs,time_to_response_completed_us:e.timeToResponseCompletedUs},n={application_info:Gt(),network_request_metric:t};return JSON.stringify(n)}(e):function(e){var t={name:e.name,is_auto:e.isAuto,client_start_time_us:e.startTimeUs,duration_us:e.durationUs};0!==Object.keys(e.counters).length&&(t.counters=e.counters);var n=e.getAttributes();0!==Object.keys(n).length&&(t.custom_attributes=n);var r={application_info:Gt(),trace_metric:t};return JSON.stringify(r)}(e)}function Gt(){return{google_app_id:yt.getInstance().getAppId(),app_instance_id:wt(),web_app_info:{sdk_version:at,page_url:ht.getInstance().getUrl(),service_worker_status:function(){var e=ht.getInstance().navigator;return"serviceWorker"in e?e.serviceWorker.controller?2:3:1}(),visibility_state:St(),effective_connection_type:function(){var e=ht.getInstance().navigator.connection;switch(e&&e.effectiveType){case"slow-2g":return 1;case"2g":return 2;case"3g":return 3;case"4g":return 4;default:return 0}}()},application_process_state:0}}var Zt=["_fp","_fcp","_fid"];var Yt=(Qt.prototype.start=function(){if(1!==this.state)throw lt.create("trace started",{traceName:this.name});this.api.mark(this.traceStartMark),this.state=2},Qt.prototype.stop=function(){if(2!==this.state)throw lt.create("trace stopped",{traceName:this.name});this.state=3,this.api.mark(this.traceStopMark),this.api.measure(this.traceMeasure,this.traceStartMark,this.traceStopMark),this.calculateTraceMetrics(),Ht(this)},Qt.prototype.record=function(e,t,n){if(this.durationUs=Math.floor(1e3*t),this.startTimeUs=Math.floor(1e3*e),n&&n.attributes&&(this.customAttributes=a({},n.attributes)),n&&n.metrics)for(var r=0,i=Object.keys(n.metrics);r<i.length;r++){var o=i[r];isNaN(Number(n.metrics[o]))||(this.counters[o]=Number(Math.floor(n.metrics[o])))}Ht(this)},Qt.prototype.incrementMetric=function(e,t){void 0===t&&(t=1),void 0===this.counters[e]&&this.putMetric(e,0),this.counters[e]+=t},Qt.prototype.putMetric=function(e,t){if(!function(e,t){return!(0===e.length||100<e.length)&&(t&&t.startsWith("_wt_")&&-1<Zt.indexOf(e)||!e.startsWith("_"))}(e,this.name))throw lt.create("invalide custom metric name",{customMetricName:e});this.counters[e]=t},Qt.prototype.getMetric=function(e){return this.counters[e]||0},Qt.prototype.putAttribute=function(e,t){var n=function(t){return!(0===t.length||40<t.length||_t.some(function(e){return t.startsWith(e)})||!t.match(It))}(e),r=function(e){return 0!==e.length&&e.length<=100}(t);if(n&&r)this.customAttributes[e]=t;else{if(!n)throw lt.create("invalid attribute name",{attributeName:e});if(!r)throw lt.create("invalid attribute value",{attributeValue:t})}},Qt.prototype.getAttribute=function(e){return this.customAttributes[e]},Qt.prototype.removeAttribute=function(e){void 0!==this.customAttributes[e]&&delete this.customAttributes[e]},Qt.prototype.getAttributes=function(){return a({},this.customAttributes)},Qt.prototype.setStartTime=function(e){this.startTimeUs=e},Qt.prototype.setDuration=function(e){this.durationUs=e},Qt.prototype.calculateTraceMetrics=function(){var e=this.api.getEntriesByName(this.traceMeasure),t=e&&e[0];t&&(this.durationUs=Math.floor(1e3*t.duration),this.startTimeUs=Math.floor(1e3*(t.startTime+this.api.getTimeOrigin())))},Qt.createOobTrace=function(e,t,n){var r=ht.getInstance().getUrl();if(r){var i=new Qt("_wt_"+r,!0),o=Math.floor(1e3*ht.getInstance().getTimeOrigin());if(i.setStartTime(o),e&&e[0]&&(i.setDuration(Math.floor(1e3*e[0].duration)),i.putMetric("domInteractive",Math.floor(1e3*e[0].domInteractive)),i.putMetric("domContentLoadedEventEnd",Math.floor(1e3*e[0].domContentLoadedEventEnd)),i.putMetric("loadEventEnd",Math.floor(1e3*e[0].loadEventEnd))),t){var a=t.find(function(e){return"first-paint"===e.name});a&&a.startTime&&i.putMetric("_fp",Math.floor(1e3*a.startTime));var s=t.find(function(e){return"first-contentful-paint"===e.name});s&&s.startTime&&i.putMetric("_fcp",Math.floor(1e3*s.startTime)),n&&i.putMetric("_fid",Math.floor(1e3*n))}Ht(i)}},Qt.createUserTimingTrace=function(e){Ht(new Qt(e,!1,e))},Qt);function Qt(e,t,n){void 0===t&&(t=!1),this.name=e,this.isAuto=t,this.state=1,this.customAttributes={},this.counters={},this.api=ht.getInstance(),this.randomId=Math.floor(1e6*Math.random()),this.isAuto||(this.traceStartMark="FB-PERF-TRACE-START-"+this.randomId+"-"+this.name,this.traceStopMark="FB-PERF-TRACE-STOP-"+this.randomId+"-"+this.name,this.traceMeasure=n||st+"-"+this.randomId+"-"+this.name,n&&this.calculateTraceMetrics())}function Xt(e){var t=e;if(t&&void 0!==t.responseStart){var n=ht.getInstance().getTimeOrigin(),r=Math.floor(1e3*(t.startTime+n)),i=t.responseStart?Math.floor(1e3*(t.responseStart-t.startTime)):void 0,o=Math.floor(1e3*(t.responseEnd-t.startTime));!function(e){var t=yt.getInstance();t.instrumentationEnabled&&e.url!==t.logEndPointUrl.split("?")[0]&&t.loggingEnabled&&t.logNetworkAfterSampling&&setTimeout(function(){return zt(e,0)},0)}({url:t.name&&t.name.split("?")[0],responsePayloadBytes:t.transferSize,startTimeUs:r,timeToResponseInitiatedUs:i,timeToResponseCompletedUs:o})}}var en=5e3;function tn(){wt()&&(setTimeout(function(){return function(){var e=ht.getInstance(),t=e.getEntriesByType("navigation"),n=e.getEntriesByType("paint");if(e.onFirstInputDelay){var r=setTimeout(function(){Yt.createOobTrace(t,n),r=void 0},en);e.onFirstInputDelay(function(e){r&&(clearTimeout(r),Yt.createOobTrace(t,n,e))})}else Yt.createOobTrace(t,n)}()},0),setTimeout(function(){return function(){for(var e=ht.getInstance(),t=e.getEntriesByType("resource"),n=0,r=t;n<r.length;n++){Xt(r[n])}e.setupObserver("resource",Xt)}()},0),setTimeout(function(){return function(){for(var e=ht.getInstance(),t=e.getEntriesByType("measure"),n=0,r=t;n<r.length;n++){nn(r[n])}e.setupObserver("measure",nn)}()},0))}function nn(e){var t=e.name;t.substring(0,st.length)!==st&&Yt.createUserTimingTrace(t)}var rn=(on.prototype.trace=function(e){return new Yt(e)},Object.defineProperty(on.prototype,"instrumentationEnabled",{get:function(){return yt.getInstance().instrumentationEnabled},set:function(e){yt.getInstance().instrumentationEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(on.prototype,"dataCollectionEnabled",{get:function(){return yt.getInstance().dataCollectionEnabled},set:function(e){yt.getInstance().dataCollectionEnabled=e},enumerable:!0,configurable:!0}),on);function on(e){this.app=e,ht.getInstance().requiredApisAvailable()?(Kt(),Rt().then(tn,tn)):Et.info("Firebase Performance cannot start if browser does not support fetch and Promise or cookie is disabled.")}var an;function sn(e,t){if("[DEFAULT]"!==e.name)throw lt.create("FB not default");if("undefined"==typeof window)throw lt.create("no window");return function(e){it=e}(window),yt.getInstance().firebaseAppInstance=e,yt.getInstance().installationsService=t,new rn(e)}(an=Z).INTERNAL.registerComponent(new w("performance",function(e){var t=e.getProvider("app").getImmediate(),n=e.getProvider("installations").getImmediate();return sn(t,n)},"PUBLIC")),an.registerVersion("@firebase/performance","0.2.31");return Z.registerVersion("firebase","7.8.0","lite"),Z});
//# sourceMappingURL=firebase-performance-standalone.js.map