'use strict';var aa={},k=function(a){function b(c){return a.next(c)}function d(c){return a.throw(c)}return new Promise(function(c,e){function f(g){g.done?c(g.value):Promise.resolve(g.value).then(b,d).then(f,e)}f(a.next())})};/*

 Copyright 2020 Google LLC
 SPDX-License-Identifier: Apache-2.0
*/
function m(a){var b=[],d=0;for(let c=0;c<a.length;c++){let e=a.charCodeAt(c);b[d++]=e}new Uint8Array(b)};/*

 Copyright 2022 Google LLC
 SPDX-License-Identifier: Apache-2.0
*/
x(1,0);x(2,16);x(2,18);x(2,25722);x(2,1);x(2,3);x(2,1);x(2,2);m("KEM");m("HPKE");m("HPKE-v1");function x(a,b){var d=new Uint8Array(a);for(let c=0;c<a;c++)d[c]=b>>8*(a-c-1)&255};function B(a,b){return a.length>=b.length&&a.substring(0,b.length)===b};/*
 jQuery (c) 2005, 2012 jQuery Foundation, Inc. jquery.org/license.
*/
var F=/\[object (Boolean|Number|String|Function|Array|Date|RegExp)\]/,G=function(a){var b;if(!(b=!a)){var d;if(a==null)d=String(a);else{var c=F.exec(Object.prototype.toString.call(Object(a)));d=c?c[1].toLowerCase():"object"}b=d!="object"}if(b||a.nodeType||a==a.window)return!1;try{if(a.constructor&&!Object.prototype.hasOwnProperty.call(Object(a),"constructor")&&!Object.prototype.hasOwnProperty.call(Object(a.constructor.prototype),"isPrototypeOf"))return!1}catch(f){return!1}for(var e in a);return e===
void 0||Object.prototype.hasOwnProperty.call(Object(a),e)};var J=function(a,b){if(b){var d=G(b.options)?b.options:{};for(let c of Object.keys(b)){let e=b[c];switch(c){case "send_pixel":H(e,d,(f,g)=>{a.h({url:f,method:0,templates:a.templates,processResponse:!1,attributionReporting:g.attribution_reporting},I(a,g))});break;case "fetch":H(e,d,(f,g)=>{a.h({url:f,method:0,templates:a.templates,processResponse:g.process_response||!1,attributionReporting:g.attribution_reporting},I(a,g))})}}}},N=function(a,b){b=a.g+b;for(var d=b.indexOf("\n\n");d!==-1;){var c=J,e=
a,f;a:{let [l,u]=b.substring(0,d).split("\n");if(B(l,"event: message")&&B(u,"data: ")){var g=u.substring(6);try{f=JSON.parse(g);break a}catch(y){}}f=void 0}c(e,f);b=b.substring(d+2);d=b.indexOf("\n\n")}a.g=b},I=function(a,b){return()=>{var d=b.fallback_url,c=b.fallback_url_method;d&&c&&J(a,{[c]:[d],options:{}})}},H=function(a,b,d){if(Array.isArray(a))for(let c of a)typeof c==="string"&&d(c,b)},O=class{constructor(){this.g=""}};Object.freeze({attributionsrc:""});var P=Object.freeze({eventSourceEligible:!1,triggerEligible:!0});const Q=/^[0-9A-Fa-f]{64}$/;function R(a){try{return(new TextEncoder).encode(a)}catch(b){let d=[];for(let c=0;c<a.length;c++){let e=a.charCodeAt(c);e<128?d.push(e):e<2048?d.push(192|e>>6,128|e&63):e<55296||e>=57344?d.push(224|e>>12,128|e>>6&63,128|e&63):(e=65536+((e&1023)<<10|a.charCodeAt(++c)&1023),d.push(240|e>>18,128|e>>12&63,128|e>>6&63,128|e&63))}return new Uint8Array(d)}}
function S(a,b){if(a===""||a==="e0")return Promise.resolve(a);var d;if((d=b.crypto)==null?0:d.subtle){if(Q.test(a))return Promise.resolve(a);try{let c=R(a);return b.crypto.subtle.digest("SHA-256",c).then(e=>T(e,b)).catch(()=>"e2")}catch(c){return Promise.resolve("e2")}}else return Promise.resolve("e1")}function T(a,b){var d=Array.from(new Uint8Array(a)).map(c=>String.fromCharCode(c)).join("");return b.btoa(d).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")};var U={m:0,o:1,0:"GET",1:"POST"};var V=function(a,b){var d=b.url;if(!d)return{failureType:9,command:0,data:"url required."};if(b.strict)try{let c=new URL(a.g.location.href),e=new URL(d,c.origin);if(e.origin!==c.origin)return{failureType:18,command:0,data:"Cross-origin command blocked"};let f=c.pathname,g=f.indexOf("/_/service_worker"),l=g!==-1?f.substring(0,g):"";l.endsWith("/")&&(l=l.slice(0,-1));if(!(e.pathname.startsWith("/g/collect")||l&&e.pathname.startsWith(l)))return{failureType:18,command:0,data:"Invalid command path blocked"}}catch(c){return{failureType:12,
command:0,data:"Invalid command URL: "+c.message}}},X=function(a,b,d){return k(function*(){var c=yield W(a,b,d);if("failureType"in c)return c;yield ba(a,c,b);return c}())},ca=function(a,b,d,c){k(function*(){var e=b.commandType,f=b.params;if(e===0){let g=V(a,f);g?c(g):(X(a,f).catch(()=>{}),d({data:f.url}))}else c({failureType:8,command:e,data:`Command with type ${e} unknown.`})}())},fa=function(a,b,d){return k(function*(){return b.url?yield X(a,b,d):{failureType:9,command:0,data:"url required."}}())},
W=function(a,b,d){return k(function*(){function c(h){return k(function*(){var [n,p]=h.split("|"),[z,v]=n.split("."),q=v,r=u[z];r||(r=n,q="");var C=w=>k(function*(){try{return yield da(p)(w)}catch(A){throw new Y(A.message);}}());if(!q){if(typeof r==="string")return yield C(r);let w=r,A=Object.keys(w).map(K=>k(function*(){var ea=yield C(w[K]);return`${K}=${ea}`}()));return(yield Promise.all(A)).join("&")}return typeof r==="object"&&r[q]?yield C(r[q]):h}())}function e(h){return k(function*(){for(var n,
p="";h.match(D)&&p!==h;){p=h;n=h.matchAll(D);let z=[...n].map(q=>c(q[1])),v=yield Promise.all(z);v.length!==0&&(h=h.replace(D,q=>v.shift()||q))}return h}())}var {url:f,body:g}=b,{attributionReporting:l,templates:u,processResponse:y,method:L=0,referer:E,soReferrer:M}=b,D=RegExp("\\${([^${}]*?)}","g"),da=h=>{if(h==null)return p=>k(function*(){return p}());var n=a.h[h];if(n==null)throw Error(`Unknown filter: ${h}`);return p=>k(function*(){return yield n(p,b)}())};try{f=yield e(f),g=g?yield e(g):void 0}catch(h){return d==
null||d(),{failureType:9,command:0,data:`Failed to inject template values: ${h}`}}var t={method:U[L],credentials:"include",body:L===1?g:void 0,keepalive:!0,redirect:"follow"};if(E)try{t.headers={["X-Effective-Origin"]:(new URL(E)).origin,["X-Effective-Referer"]:E}}catch(h){}else M&&(t.referrer=M);y||(t.mode="no-cors");l&&(t.attributionReporting=P);try{let h=yield a.g.fetch(f,t);return t.mode==="no-cors"||h.ok?{data:y?yield h.text():f}:(d==null||d(),{failureType:9,command:0,data:"Fetch failed"})}catch(h){return d==
null||d(),{failureType:9,command:0,data:`Fetch failed: ${h}`}}}())},ba=function(a,b,d){return k(function*(){if(d.processResponse){var c=[];N(new ha(d.templates,(e,f)=>{c.push(fa(a,e,f))}),b.data);return Promise.all(c)}}())},ia=class{constructor(a){this.g=a;this.h={sha256:b=>{var d=this;return k(function*(){return yield S(b,d.g)}())},encode:b=>k(function*(){return encodeURIComponent(b)}()),encrypt:()=>k(function*(){throw new Y("Encryption not supported.");}()),encrypt_with_memo:()=>k(function*(){throw new Y("Encryption not supported.");
}())}}};class ha extends O{constructor(a,b){super();this.templates=a;this.h=b}}class Y extends Error{constructor(a){super(a)}};var ja=function(a,b,d){a.g[b]==null&&(a.g[b]=0,a.h[b]=d,a.i++);a.g[b]++;return{targetId:a.id,clientCount:a.i,totalLifeMs:Math.round(d-a.l),heartbeatCount:a.g[b],clientLifeMs:Math.round(d-a.h[b])}};class ka{constructor(a){this.l=a;this.g={};this.h={};this.i=0;this.id=String(Math.floor(Number.MAX_SAFE_INTEGER*Math.random()))}}function Z(a){return a.performance&&a.performance.now()||Date.now()}
var la=function(a,b){class d{constructor(c,e){this.h=c;this.g=e;this.i=new ka(Z(e))}j(c,e){var f=c.clientId;if(c.type===0)c.stats=ja(this.i,f,Z(this.g)),e(c);else if(c.type===1)try{this.h(c.command,g=>{c.result=g;e(c)},g=>{c.failure=g;e(c)})}catch(g){c.failure={failureType:11,data:g.toString()},e(c)}}}return new d(a,b)};(new class{constructor(a){this.g=a;var b=new ia(a);this.h=la((d,c,e)=>{ca(b,d,c,e)},a)}init(){this.g.addEventListener("install",()=>{this.g.skipWaiting()});this.g.addEventListener("activate",a=>{a.waitUntil(this.g.clients.claim())});this.g.addEventListener("message",a=>{var b=a.source;if(b){var d=a.data,c=new Promise(e=>{this.h.j(d,f=>{b.postMessage(f);e(void 0)})});a.waitUntil(c)}})}}(self)).init();
