PageSourceSearch

https://repuestos-d6c3d.firebaseapp.com/_nuxt/D-GNixRz.js

js repuestos-d6c3d.firebaseapp.com collected 2026-10-03 08:13:43 UTC 1,497 bytes, 1 lines download raw bytes

1import{_ as k}from"./BsqTxom4.js";import{r as w,l as s,j as I}from"#entry";const r=w([]),S=()=>{{const e=localStorage.getItem("carrito");if(e)try{r.value=JSON.parse(e)}catch(a){console.error("Error cargando carrito desde localStorage:",a),r.value=[]}}const o=()=>{localStorage.setItem("carrito",JSON.stringify(r.value))},l=e=>{const a=r.value.find(t=>t.id===e.id);a?a.cantidad+=e.cantidad||1:r.value.push({...e,cantidad:e.cantidad||1}),o()},d=e=>{const a=r.value.findIndex(t=>t.id===e);a>-1&&(r.value.splice(a,1),o())},u=(e,a)=>{const t=r.value.find(i=>i.id===e);t&&(a<=0?d(e):(t.cantidad=a,o()))},f=()=>{r.value=[],o()},p=s(()=>r.value.reduce((e,a)=>e+a.precio*a.cantidad,0)),v=s(()=>r.value.reduce((e,a)=>e+a.cantidad,0)),h=s(()=>r.value.length===0);return{carrito:r,agregarAlCarrito:l,eliminarDelCarrito:d,actualizarCantidad:u,limpiarCarrito:f,total:p,cantidadItems:v,estaVacio:h,iniciarCheckout:async(e,a,t)=>{try{const{$firebaseAuth:i,$firebaseFunctions:m}=I(),{httpsCallable:C}=await k(async()=>{const{httpsCallable:c}=await import("#entry").then(E=>E.aE);return{httpsCallable:c}},[],import.meta.url),g=r.value.map(c=>({id:c.id,cantidad:c.cantidad})),_=i.currentUser?.uid||null,n=await C(m,"createCheckoutPreference")({items:g,email:e,nombre:a||void 0,apellido:t||void 0,userId:_});if(n.data?.success&&n.data?.init_point)return n.data.init_point;throw new Error("No se pudo crear la preferencia de pago")}catch(i){throw console.error("❌ Error iniciando checkout:",i),i}}}};export{S as u};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.