import{E as b,O as l}from"./v_7_4_2_12_5cc5c70e-17b9-46d5-a61c-750829962ec510.js";import{c as f}from"./v_7_4_2_12_5cc5c70e-17b9-46d5-a61c-750829962ec57.js";async function m(e,r,u){return new Promise((s,i)=>{const o=indexedDB.open(e,1);o.onerror=function(t){console.error("Erro ao abrir o banco de dados."),i("Erro ao abrir o banco de dados.")},o.onupgradeneeded=function(t){t.target.result.createObjectStore(r,{keyPath:"id",autoIncrement:!0})},o.onsuccess=function(t){const a=t.target.result,n=a.transaction([r],"readwrite").objectStore(r);n.clear();const c=n.add(u);c.onsuccess=function(){s(!0),a.close()},c.onerror=function(){console.error("Worker Erro ao salvar os dados da camapanha."),s(!1)}}})}const O=(e,r=!1)=>{m("useOrderLabels","orderLabels",e),b({stopPropag:r,action:"setOrderLabels",waitForResponse:!1,data:e}),d.setState({orderLabels:e})},L=l({setOrderLabels:e=>{O(e.data,!0)},getOrderLabels:()=>d.getState().orderLabels});chrome.runtime.onMessage.addListener(L);const d=f()(()=>({orderLabels:[]}));export{O as s,d as u};
