import{u as g}from"./v_7_4_2_1_59f2e4f7-dc00-41f3-9942-b1c61b935c9919.js";import{a as i,I as c,r as n}from"./v_7_4_2_1_59f2e4f7-dc00-41f3-9942-b1c61b935c9910.js";import{c as d}from"./v_7_4_2_1_59f2e4f7-dc00-41f3-9942-b1c61b935c997.js";const C=d()(s=>({categories:[],addCategory:e=>s(o=>{const{language:t}=g.getState(),a={...e,id:n()},r=[...o.categories,a];return i("categoria",r),chrome.runtime.sendMessage({action:"addCategory",dados:a}),c({type:"Success",message:t.categoryCreated,position:"top-right"}),{categories:r}}),sortCategories:e=>s(o=>{const t=[...o.categories],[a]=t.splice(e.oldIndex,1);return t.splice(e.newIndex,0,a),i("categoria",t),chrome.runtime.sendMessage({action:"sortCategories",dados:e}),{categories:t}}),removeCategory:e=>s(o=>{const{language:t}=g.getState(),a=o.categories.filter(r=>r.id!==e);return i("categoria",a),chrome.runtime.sendMessage({action:"removeCategory",dados:e}),c({type:"Success",message:t.deletedCategory,position:"top-right"}),{categories:a}}),editCategory:e=>s(o=>{const{language:t}=g.getState(),a=o.categories.map(r=>r.id===e.id?e:r);return i("categoria",a),chrome.runtime.sendMessage({action:"editCategory",dados:e}),c({type:"Success",message:t.categoryEdited,position:"top-right"}),{categories:a}})}));export{C as u};
