(function(){(function(){console.log("[FillyDash extension] Auto-link content script loaded on",window.location.href);var s="";function a(){try{return window.location.origin||""}catch{return""}}function l(e,n){var t=(e||"").trim().toUpperCase();if(!(!t||t.length!==6)&&s!==t){s=t;var i=(n||a()).replace(/\/$/,"");i&&chrome.runtime.sendMessage({action:"EXCHANGE_LINK_CODE",payload:{code:t,baseUrl:i}},function(o){chrome.runtime.lastError||o&&o.success&&o.linked&&window.dispatchEvent(new CustomEvent("fillydash-extension-linked",{detail:{}}))})}}function r(){var e=document.querySelector("[data-fillydash-link-code]");if(e){var n=e.getAttribute("data-fillydash-link-code"),t=e.getAttribute("data-fillydash-base-url")||a();n&&l(n,t)}}window.addEventListener("fillydash-link-code",function(e){var n=e.detail||{},t=n.code,i=n.baseUrl||a();t&&l(t,i)}),window.addEventListener("fillydash-set-token",function(e){var n=e.detail||{},t=(n.token||"").trim(),i=(n.baseUrl||a()).replace(/\/$/,"");!t||!i||chrome.runtime.sendMessage({action:"SAVE_LINK_TOKEN",payload:{token:t,baseUrl:i}},function(o){chrome.runtime.lastError||o&&o.success&&window.dispatchEvent(new CustomEvent("fillydash-extension-linked",{detail:{}}))})}),window.addEventListener("fillydash-request-extension-status",function(){chrome.runtime.sendMessage({action:"GET_EXTENSION_LINK_STATUS"},function(e){if(chrome.runtime.lastError){window.dispatchEvent(new CustomEvent("fillydash-extension-status",{detail:{linked:!1}}));return}window.dispatchEvent(new CustomEvent("fillydash-extension-status",{detail:{linked:!!(e&&e.linked)}}))})}),window.addEventListener("fillydash-revoke-link",function(){chrome.runtime.sendMessage({action:"CLEAR_LINK_TOKEN"},function(){chrome.runtime.lastError||window.dispatchEvent(new CustomEvent("fillydash-extension-status",{detail:{linked:!1}}))})}),window.addEventListener("fillydash-open-extension",function(){chrome.runtime.sendMessage({action:"OPEN_EXTENSION_TAB"},function(){chrome.runtime.lastError&&console.warn("[FillyDash extension] Could not open extension tab:",chrome.runtime.lastError.message)})}),r(),setTimeout(r,500),setTimeout(r,1500),setTimeout(r,3e3),setTimeout(r,5e3);var d=new MutationObserver(function(){r()});d.observe(document.documentElement,{childList:!0,subtree:!0})})();
//# sourceMappingURL=content-fillydash-link.js-Bm5bnR0O.js.map
})()
