import{_ as d}from"./BButton.vue_vue_type_script_setup_true_lang-D5Eg7-Zv-DDRCX2AG.js";import{_ as c,d as m,h as u,o as a,c as s,w as o,a as n}from"./index-D02r7Zsc.js";import"./BSpinner.vue_vue_type_script_setup_true_lang-H1MzHypA-D8AXjJB0.js";import"./dom-DVb-f0ZG-Crdf0-mU.js";import"./useDefaults-DESCdb0p-CFLjYrdG.js";import"./useColorVariantClasses-ZDE19TZw-Cvu7SygP.js";import"./BLink.vue_vue_type_script_setup_true_lang-Ct47WhzE-DDPYis_D.js";import"./object-0ALvRU0O-3BORTTD-.js";import"./stringUtils-gJJ6T6UC-g5BZrMym.js";import"./index-C0p9vHHI-DoOEDIMw.js";const p={props:{element:{type:Object,required:!0}},computed:{cartState:function(){return!this.element.recordId||!this.get("cart")?!1:this.get("cart").includes(this.element.recordId.toString())},show_cart:function(){const e=this.getConfig();return!(e.disabledElements.includes("cart")||e.opac_cart_allow==0)}},methods:{async addNoticeToCart(){this.publish("showOverlay",!0),await this.get("ws").addNoticeToCart(this.get("sessionId"),[this.element.recordId]),this.publish("showOverlay",!1)},async removeNoticeToCart(){this.publish("showOverlay",!0),await this.get("ws").deleteNoticeFromCart(this.get("sessionId"),[this.element.recordId]),this.publish("showOverlay",!1)}}},h={key:0};function f(e,t,b,y,C,r){const i=d;return r.show_cart?(a(),m("div",h,[r.cartState?(a(),s(i,{key:0,size:"sm",role:"button","aria-label":e.$t("ariaLabels.cart.removeCartItem"),variant:"transparent",onClick:t[0]||(t[0]=l=>r.removeNoticeToCart())},{default:o(()=>[...t[2]||(t[2]=[n("i",{"aria-hidden":"true",class:"bi bi-cart-fill text-primary",style:{"font-size":"1.7rem"}},null,-1)])]),_:1},8,["aria-label"])):(a(),s(i,{key:1,size:"sm",role:"button","aria-label":e.$t("ariaLabels.cart.addCartItem"),variant:"transparent",onClick:t[1]||(t[1]=l=>r.addNoticeToCart())},{default:o(()=>[...t[3]||(t[3]=[n("i",{"aria-hidden":"true",class:"bi bi-cart text-primary",style:{"font-size":"1.7rem"}},null,-1)])]),_:1},8,["aria-label"]))])):u("",!0)}const $=c(p,[["render",f]]);export{$ as default};
