import w from"./BMc5KkT2.js";import C from"./CShjTT_W.js";import{d as E,a as I,O as R,Z as N,r as _,t as S,C as l,o as z,h as t,i as a,g as o,A,v as d,I as D,B as L,b5 as T,a0 as V,_ as O}from"./BxiWQxwE.js";import P from"./BpaGfDpb.js";import{_ as Q}from"./CCb6Ii9b.js";import"./DKUQAchG.js";const j={class:"term__toggle"},q=["aria-label"],F={class:"term__actions"},M=E({__name:"term",props:{term:{type:Object,required:!0}},emits:["removed-from-basket"],setup(e,{emit:u}){const n=e,{$messages:s,$toast:i}=I(),{strikeShoppingListItem:p,deleteShoppingListTerm:f}=R(),{lastItemRemoved:h}=N(),k=_(n.term.strike),c=_(!1),g=u,x=async()=>{try{await p(n.term.id)}catch(r){i.add({id:3,text:s("error.common")}),console.error("Error while trying to strike term",r)}},m=async()=>{c.value=!0;try{h.value=n.term,await f(n.term.id)}catch(r){i.add({id:3,text:s("error.common")}),console.error(r)}finally{c.value=!1}g("removed-from-basket")};return(r,U)=>{const v=w,b=C,y=V,B=P,$=Q;return z(),S($,{onDragged:m},{default:l(()=>[t("li",null,[t("div",j,[a(v,{id:e.term.id,checked:o(k),onInput:x},null,8,["id","checked"])]),t("div",{role:"img","aria-label":e.term.content},[a(b)],8,q),t("div",{class:A(["term__content",{term__striked:e.term.strike}])},[t("h4",null,d(o(D)(e.term.content)),1),a(y,{to:`/zoeken/${e.term.content}?${o(T).TERM.REPLACE}=${e.term.id}`,"aria-label":e.term},{default:l(()=>[L(d(o(s)("basket.chooseProduct")),1)]),_:1},8,["to","aria-label"])],2),t("div",F,[a(B,{pending:o(c),"show-border":!1,onDelete:m},null,8,["pending"])])])]),_:1})}}}),K=O(M,[["__scopeId","data-v-388abdfe"]]);export{K as default};
