var content=(function(){"use strict";var N=Object.defineProperty;var A=(a,s,i)=>s in a?N(a,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[s]=i;var c=(a,s,i)=>A(a,typeof s!="symbol"?s+"":s,i);var S,f;const a={matches:["*://*.google.com/*"],main(){console.log("Hello content.")}},i=(f=(S=globalThis.browser)==null?void 0:S.runtime)!=null&&f.id?globalThis.browser:globalThis.chrome;function h(n,...t){}const I={debug:(...n)=>h(console.debug,...n),log:(...n)=>h(console.log,...n),warn:(...n)=>h(console.warn,...n),error:(...n)=>h(console.error,...n)},g=class g extends Event{constructor(t,e){super(g.EVENT_NAME,{}),this.newUrl=t,this.oldUrl=e}};c(g,"EVENT_NAME",v("wxt:locationchange"));let m=g;function v(n){var t;return`${(t=i==null?void 0:i.runtime)==null?void 0:t.id}:content:${n}`}function p(n){let t,e;return{run(){t==null&&(e=new URL(location.href),t=n.setInterval(()=>{let r=new URL(location.href);r.href!==e.href&&(window.dispatchEvent(new m(r,e)),e=r)},1e3))}}}const d=class d{constructor(t,e){c(this,"isTopFrame",window.self===window.top);c(this,"abortController");c(this,"locationWatcher",p(this));c(this,"receivedMessageIds",new Set);this.contentScriptName=t,this.options=e,this.abortController=new AbortController,this.isTopFrame?(this.listenForNewerScripts({ignoreFirstEvent:!0}),this.stopOldScripts()):this.listenForNewerScripts()}get signal(){return this.abortController.signal}abort(t){return this.abortController.abort(t)}get isInvalid(){return i.runtime.id==null&&this.notifyInvalidated(),this.signal.aborted}get isValid(){return!this.isInvalid}onInvalidated(t){return this.signal.addEventListener("abort",t),()=>this.signal.removeEventListener("abort",t)}block(){return new Promise(()=>{})}setInterval(t,e){const r=setInterval(()=>{this.isValid&&t()},e);return this.onInvalidated(()=>clearInterval(r)),r}setTimeout(t,e){const r=setTimeout(()=>{this.isValid&&t()},e);return this.onInvalidated(()=>clearTimeout(r)),r}requestAnimationFrame(t){const e=requestAnimationFrame((...r)=>{this.isValid&&t(...r)});return this.onInvalidated(()=>cancelAnimationFrame(e)),e}requestIdleCallback(t,e){const r=requestIdleCallback((...o)=>{this.signal.aborted||t(...o)},e);return this.onInvalidated(()=>cancelIdleCallback(r)),r}addEventListener(t,e,r,o){var l;e==="wxt:locationchange"&&this.isValid&&this.locationWatcher.run(),(l=t.addEventListener)==null||l.call(t,e.startsWith("wxt:")?v(e):e,r,{...o,signal:this.signal})}notifyInvalidated(){this.abort("Content script context invalidated"),I.debug(`Content script "${this.contentScriptName}" context invalidated`)}stopOldScripts(){window.postMessage({type:d.SCRIPT_STARTED_MESSAGE_TYPE,contentScriptName:this.contentScriptName,messageId:Math.random().toString(36).slice(2)},"*")}verifyScriptStartedEvent(t){var l,E,b;const e=((l=t.data)==null?void 0:l.type)===d.SCRIPT_STARTED_MESSAGE_TYPE,r=((E=t.data)==null?void 0:E.contentScriptName)===this.contentScriptName,o=!this.receivedMessageIds.has((b=t.data)==null?void 0:b.messageId);return e&&r&&o}listenForNewerScripts(t){let e=!0;const r=o=>{if(this.verifyScriptStartedEvent(o)){this.receivedMessageIds.add(o.data.messageId);const l=e;if(e=!1,l&&(t!=null&&t.ignoreFirstEvent))return;this.notifyInvalidated()}};addEventListener("message",r),this.onInvalidated(()=>removeEventListener("message",r))}};c(d,"SCRIPT_STARTED_MESSAGE_TYPE",v("wxt:content-script-started"));let w=d;function F(){}function u(n,...t){}const T={debug:(...n)=>u(console.debug,...n),log:(...n)=>u(console.log,...n),warn:(...n)=>u(console.warn,...n),error:(...n)=>u(console.error,...n)};return(async()=>{try{const{main:n,...t}=a,e=new w("content",t);return await n(e)}catch(n){throw T.error('The content script "content" crashed on startup!',n),n}})()})();
content;