(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`n8n@2.20.10`}}catch{}})();try{(function(){var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`e9012b2d-9c5b-4be9-a27f-0e0772444920`,e._sentryDebugIdIdentifier=`sentry-dbid-e9012b2d-9c5b-4be9-a27f-0e0772444920`)})()}catch{}import{n as e,r as t}from"./comlink-Cpsegk1Y.js";var n=new SharedWorker(new URL(`/%7B%7BBASE_PATH%7D%7D/assets/worker-BbnDp7F0.js`,``+import.meta.url),{type:`module`,name:`n8n-coordinator`});n.port.start();var r=new Worker(new URL(`/%7B%7BBASE_PATH%7D%7D/assets/worker-WHIPMjr_.js`,``+import.meta.url),{type:`module`,name:`n8n-data`}),i=t(n.port),a={tabId:null,isRegistered:!1};async function o(){if(a.isRegistered&&a.tabId)return a.tabId;console.log(`[Coordinator] Registering tab...`);let t=new MessageChannel;r.postMessage({type:`connect`,port:t.port1},[t.port1]);let n=await i.registerTab(e(t.port2,[t.port2]));return a.tabId=n,a.isRegistered=!0,console.log(`[Coordinator] Registered as tab: ${n}`),c(),n}function s(){a.tabId&&=(i.unregisterTab(a.tabId).catch(console.error),a.isRegistered=!1,null)}function c(){window.addEventListener(`beforeunload`,s),window.addEventListener(`pagehide`,s),window.addEventListener(`pageshow`,e=>{e.persisted&&!a.isRegistered&&(console.log(`[Coordinator] Page restored from bfcache, re-registering...`),o().catch(console.error))}),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&!a.isRegistered&&(console.log(`[Coordinator] Page became visible, re-registering...`),o().catch(console.error))})}async function l(){await o()}async function u({version:e}){await l(),await i.initialize({version:e})}async function d(e){await l(),await i.exec(e)}async function f(e){return await l(),await i.query(e)}async function p(e,t){return await l(),await i.queryWithParams(e,t)}async function m(){return await i.isInitialized()}async function h(e){await l(),await i.loadNodeTypes(e)}async function g(e){await l(),await i.storeVersion(e)}async function _(){return await l(),await i.getStoredVersion()}export{d as exec,_ as getStoredVersion,u as initialize,m as isInitialized,h as loadNodeTypes,f as query,p as queryWithParams,g as storeVersion};
//# sourceMappingURL=workers-Bk-bCP4Q.js.map