!function(){"use strict";function e(e,t){browser.tabs.executeScript(e.id,{code:"window.qwcContentScriptInjected === true"},function(n){n[0]?t():browser.tabs.executeScript(e.id,{file:"content.js"},t)})}window.browser=window.browser||window.chrome,browser.browserAction.onClicked.addListener(t=>{e(t,()=>{browser.tabs.sendMessage(t.id,{name:"toggleOverlay"})})}),browser.runtime.onInstalled.addListener(function(){browser.contextMenus.create({id:"QuiverContextMenu",title:"Clip to Quiver",contexts:["selection"]}),browser.contextMenus.create({id:"QuiverContextMenuClipAsText",parentId:"QuiverContextMenu",title:"As Text",contexts:["selection"]}),browser.contextMenus.create({id:"QuiverContextMenuClipAsMarkdown",parentId:"QuiverContextMenu",title:"As Markdown",contexts:["selection"]})}),browser.contextMenus.onClicked.addListener((t,n)=>{e(n,()=>{"QuiverContextMenuClipAsText"===t.menuItemId?browser.tabs.sendMessage(n.id,{name:"clipSelectionAsText"}):"QuiverContextMenuClipAsMarkdown"===t.menuItemId&&browser.tabs.sendMessage(n.id,{name:"clipSelectionAsMarkdown"})})}),browser.runtime.onMessage.addListener(e=>{switch(e.name){case"clipToQuiver":{let{type:t,title:n}=e.data,o=`quiver://actions/create-note?type=${t}&title=${encodeURIComponent(n)}`;browser.tabs.executeScript(null,{code:`window.open("${o}", "_self")`})}}})}();
