1import{l as $t,r as v,i as ee,j as at,I as qt,g as Lt,Q as te,c as s,a as G,u as ke,h as fr,w as re,b as e,d as x,o as a,e as u,n as E,q as mr,F as V,f as ae,t as p,m as T,aq as hr,D as st,B as He,z as ot,G as kr,p as Dt,v as Ce,A as yr,C as wr,s as A,k as se,x as _r}from"./app-CGV-KKkc.js";import{a as Cr,_ as Sr,t as Se}from"./AuthenticatedLayout-Ba4VoB_-.js";import{_ as zt}from"./BarcodeScannerUI-CUQXOOSO.js";import"./browser-CHx_2FHq.js";import{S as I}from"./sweetalert2.esm.all-BZR39-dk.js";import{u as Mr}from"./useToast-DgW1jhhr.js";import{_ as jr}from"./Modal-DGE22nt6.js";import{_ as Er}from"./QrGeneratorModal-DzUPYfNd.js";import{_ as At}from"./SearchableSelect-CQGT4HrW.js";import{_ as Br}from"./LoadingOverlay-C_DaGYCz.js";import{_ as Rr}from"./OrderDetailsModal-6c5jcMxj.js";import{g as Ue}from"./OrderStatus-CPEl4X_T.js";import{u as Ir}from"./useScannerUtils-BxWYePTE.js";import{_ as Pr}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"https://cdn.jsdelivr.net/npm/@undecaf/[email protected]/dist/main.js";import"./ToastList-D_b9QKdq.js";import"./useSettings-2peX7i3H.js";import"./useUiTheme-oriybOun.js";import"./useBackgroundTasks-CslIcTpN.js";import"./debounce-ETe2odyl.js";import"./swal-CYtjA0b4.js";import"./TextInput-D2P5Wd9e.js";import"./InputLabel-_LSWszv6.js";import"./leaflet-src-DONXchnD.js";import"./LocationNormalizer-DNefYGSh.js";import"./FailureReasons-acVMU2t-.js";const $r={class:"mb-3 flex flex-col lg:flex-row justify-between items-start lg:items-center bg-white dark:bg-gray-800 p-3 rounded-xl shadow-sm gap-3 top-0 z-30 border-b border-gray-100 dark:border-gray-700"},qr={class:"flex flex-col gap-2 w-full lg:w-auto"},Lr={class:"flex flex-wrap sm:flex-nowrap gap-2 w-full lg:justify-end"},Dr={class:"mb-3 flex flex-wrap bg-gray-100 dark:bg-gray-700/50 p-1 rounded-xl shadow-inner gap-1"},zr={class:"relative"},Ar={class:"flex flex-col lg:grid lg:grid-cols-3 gap-4 lg:gap-8 lg:h-[calc(100vh-220px)] w-full"},Vr={class:"lg:col-span-2 order-2 lg:order-1 flex flex-col gap-4 h-full w-full min-w-0"},Hr={class:"flex flex-col bg-white dark:bg-gray-800 rounded-2xl shadow-sm border border-gray-100 dark:border-gray-700 flex-1 min-h-0 lg:max-h-full",id:"tour-receiving-list"},Ur={class:"p-3 sm:p-4 border-b dark:border-gray-700 bg-gray-50 dark:bg-gray-900/50 flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3"},Or={class:"flex items-center gap-2"},Tr={class:"flex-1 p-2 space-y-3 overflow-y-auto min-h-[300px]"},Nr={key:0,class:"flex flex-col gap-2"},Wr={class:"flex items-center gap-3"},Fr={key:0,class:"animate-spin rounded-full h-4 w-4 border-b-2 border-brand-start"},Gr={key:1,class:"w-5 h-5 text-red-500 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},Qr={key:0,class:"text-xs text-red-600 dark:text-red-400 mt-0.5"},Kr={key:1,class:"text-xs text-gray-500 dark:text-gray-400"},Yr=["onClick"],Jr={key:1,class:"mt-4"},Xr={class:"text-xs font-bold text-blue-600 dark:text-blue-400 uppercase tracking-wider mb-2 flex items-center justify-between"},Zr={class:"bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 px-2 py-0.5 rounded-full text-[10px]"},ea={class:"flex flex-col gap-2"},ta={class:"flex items-center gap-3"},ra={class:"text-sm font-bold text-gray-700 dark:text-gray-200"},aa={class:"text-[11px] text-gray-500 mt-0.5"},sa={class:"flex gap-1.5 shrink-0"},oa=["onClick"],na={key:2,class:"mt-4"},la={class:"flex items-center justify-between mb-2"},ia={class:"text-xs font-bold text-purple-600 dark:text-purple-400 uppercase tracking-wider flex items-center gap-2"},da={class:"bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-300 px-2 py-0.5 rounded-full text-[10px]"},ua={class:"flex flex-col gap-2"},ca={class:"flex items-center justify-between"},va={class:"flex items-center gap-3"},ga={class:"text-sm font-bold text-gray-700 dark:text-gray-200"},pa={class:"text-[11px] text-gray-500 mt-0.5"},ba={class:"flex gap-1.5 shrink-0"},xa=["onClick"],fa=["onClick"],ma={class:"flex flex-wrap gap-1 pl-11"},ha={class:"font-bold text-gray-800 dark:text-gray-100"},ka={class:"truncate max-w-[180px]"},ya={key:3,class:"text-center py-6 border-2 border-dashed border-gray-200 dark:border-gray-700 rounded-xl mt-4"},wa={class:"mt-4 border-t dark:border-gray-700 pt-3"},_a={class:"grid gap-1.5"},Ca={key:0,class:"text-center py-3 text-xs text-gray-500"},Sa={class:"font-bold text-sm text-gray-900 dark:text-white"},Ma={class:"text-[10px] text-gray-500"},ja={class:"p-3 sm:p-4 border-b dark:border-gray-700 bg-gray-50 dark:bg-gray-900/50 flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3"},Ea={class:"flex items-center gap-3 flex-wrap"},Ba={class:"flex items-center gap-2"},Ra={class:"bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-200 text-[11px] font-bold px-2.5 py-1 rounded border border-gray-200 dark:border-gray-600"},Ia={class:"bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-400 text-[11px] font-bold px-2.5 py-1 rounded border border-green-200 dark:border-green-800/30"},Pa={class:"bg-red-100 dark:bg-red-900/30 text-red-800 dark:text-red-400 text-[11px] font-bold px-2.5 py-1 rounded border border-red-200 dark:border-red-800/30"},$a={class:"flex items-center gap-2 flex-wrap sm:flex-nowrap w-full sm:w-auto mt-2 sm:mt-0"},qa={class:"flex-1 p-2 sm:p-4 space-y-3 min-h-[300px]"},La={key:0,class:"h-full flex flex-col items-center justify-center py-6 px-4"},Da={class:"max-w-md w-full space-y-4"},za={class:"grid gap-3"},Aa={key:0,class:"bg-emerald-50/50 dark:bg-emerald-900/10 border border-emerald-100 dark:border-emerald-800/30 p-3 rounded-xl flex gap-3 items-start"},Va={key:1,class:"bg-blue-50/50 dark:bg-blue-900/10 border border-blue-100 dar
1k:border-blue-800/30 p-3 rounded-xl flex gap-3 items-start"},Ha={key:2,class:"bg-red-50/50 dark:bg-red-900/10 border border-red-100 dark:border-red-800/30 p-3 rounded-xl flex gap-3 items-start"},Ua={key:3,class:"bg-purple-50/50 dark:bg-purple-900/10 border border-purple-100 dark:border-purple-800/30 p-3 rounded-xl flex gap-3 items-start"},Oa=["onClick"],Ta={class:"flex items-center gap-2 flex-1 min-w-0"},Na={class:"text-xs font-mono px-1 rounded flex-shrink-0 bg-gray-200 dark:bg-gray-800 text-gray-500"},Wa={class:"text-xs font-bold px-2 py-0.5 rounded border bg-white dark:bg-gray-600 text-gray-600 dark:text-gray-300"},Fa={class:"divide-y divide-gray-100 dark:divide-gray-700"},Ga={class:"relative flex-shrink-0"},Qa=["src"],Ka={key:0,class:"absolute inset-0 bg-white/60 dark:bg-black/60 flex items-center justify-center rounded backdrop-blur-[1px]"},Ya={key:1,class:"absolute -top-1 -right-1 bg-red-500 text-white w-4 h-4 flex items-center justify-center rounded-full"},Ja={key:2,class:"absolute -top-1 -right-1 bg-green-500 text-white w-4 h-4 flex items-center justify-center rounded-full"},Xa={class:"flex-1 min-w-0"},Za={class:"flex justify-between items-start gap-2"},es={class:"flex flex-col gap-1 w-full min-w-0"},ts={class:"text-xs font-bold text-gray-900 dark:text-white flex flex-wrap items-center gap-1.5 whitespace-normal break-words w-full"},rs={key:0,class:"text-brand-start bg-gradient-to-r from-brand-start to-brand-end border-none text-white hover:opacity-90 transition-opacity/10 px-1.5 py-0.5 rounded mr-1"},as={key:1,class:"bg-indigo-100 text-indigo-800 text-[9px] font-bold px-1.5 py-0.5 rounded border border-indigo-200 uppercase"},ss={key:2,class:"text-[11px] text-gray-900 dark:text-white font-black text-xs"},os=["title"],ns={key:0,class:"flex flex-col gap-1.5 mt-0.5"},ls={class:"text-[11px] text-red-600 dark:text-red-400 font-bold leading-tight"},is={class:"flex items-center flex-wrap gap-1.5"},ds={class:"text-[9px] font-mono bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 px-1.5 py-0.5 rounded border border-gray-300 dark:border-gray-700 break-all shadow-sm"},us={class:"flex flex-col items-end gap-1 shrink-0"},cs={key:0,class:"text-[9px] text-gray-400 whitespace-nowrap shrink-0"},vs={key:1,class:"text-[8px] font-bold text-gray-700 border px-1.5 py-1 rounded shadow-sm uppercase whitespace-nowrap"},gs={key:2,class:"text-[8px] font-bold text-gray-700 border px-1.5 py-1 rounded shadow-sm uppercase whitespace-nowrap"},ps={class:"flex items-center gap-1.5 ml-1"},bs=["onClick"],xs=["onClick"],fs={class:"p-3 sm:p-4 border-t dark:border-gray-700 mt-auto"},ms=["disabled"],hs={class:"p-6 border-b dark:border-gray-700 bg-gray-50 dark:bg-gray-900/50 flex justify-between items-start"},ks={class:"flex items-center gap-2 mb-2"},ys={class:"text-xl font-bold text-gray-900 dark:text-white"},ws={class:"text-sm text-gray-500"},_s={class:"flex-1 p-2 sm:p-4 space-y-3 bg-gray-50/50 dark:bg-gray-900/10 min-h-0"},Cs={class:"flex items-stretch gap-3 flex-1 min-w-0"},Ss={key:0,class:"flex-shrink-0 w-16 h-16 sm:w-14 sm:h-14 bg-gray-100 dark:bg-gray-700 rounded-lg overflow-hidden border border-gray-200 dark:border-gray-600"},Ms=["src"],js={class:"flex-1 min-w-0 flex flex-col justify-center py-0.5"},Es=["title"],Bs={key:0,class:"text-[10px] sm:text-xs text-gray-500 truncate mb-1"},Rs={class:"flex items-center gap-2 mt-1"},Is={key:0,class:"text-[10px] sm:text-xs font-mono font-medium bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 px-2 py-0.5 rounded border border-gray-200 dark:border-gray-700 flex-shrink-0"},Ps={class:"text-[10px] sm:text-xs font-bold bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400 px-2 py-0.5 rounded border border-blue-200 dark:border-blue-800 flex-shrink-0"},$s={class:"w-full sm:w-auto pt-2 sm:pt-0 border-t sm:border-t-0 border-gray-100 dark:border-gray-700 mt-auto sm:mt-0 flex-shrink-0"},qs=["onUpdate:modelValue"],Ls={key:0,class:"mt-4 bg-red-50 dark:bg-red-900/20 p-4 sm:p-5 rounded-xl border border-red-200"},Ds={key:0,class:"relative bg-white dark:bg-gray-800 border-2 border-dashed border-red-300 rounded-xl p-6 flex flex-col items-center justify-center"},zs={key:1,class:"relative inline-block"},As=["src"],Vs={class:"p-4 border-t dark:border-gray-700 mt-auto flex flex-col sm:flex-row gap-3"},Hs=["disabled"],Us=["disabled"],Os={class:"lg:col-span-1 order-1 lg:order-2 flex flex-col gap-4 w-full min-w-0",id:"tour-receiving-scanner"},Ts={class:"flex flex-col gap-4 relative"},Ns={class:"flex flex-col min-w-0 flex-1"},Ws={class:"flex items-center justify-between"},Fs={class:"text-sm font-black text-gray-900 dark:text-white flex items-center gap-1.5 truncate"},Gs={key:0,class:"w-2.5 h-2.5 bg-gradient-to-r from-brand-start to-brand-end border-none rounded-full animate-pulse shrink-0"},Qs={key:1,class:"w-2.5 h-2.5 bg-purple-500 rounded-full animate-pulse shrink-0"},Ks={key:2,class:"w-2.5 h-2.5 bg-green-500 rounded-full animate-pulse shrink-0"},Ys={class:"truncate"},Js={key:0,class:"flex items-center gap-2"},Xs={class:"flex-1"},Zs={class:"flex flex-col"},eo={class:"font-bold text-gray-800 dark:text-gray-200 text-sm"},to={class:"text-[10px] text-gray-500 leading-tight"},ro={key:1,class:"absolute top-1 right-1 z-40 flex gap-1"},ao={key:2,class:"absolute bottom-1 right-1 z-40 flex gap-1"},so={key:3,class:"absolute top-2 right-2 z-40"},oo={key:4,class:"absolute inset-0 z-30 flex items-center justify-center bg-black/80 backdrop-blur-sm"},no={key:0},lo={key:5,class:"absolute bottom-4 left-1/2 -translate-x-1/2 z-30 flex items-center justify-center transition-all duration-200 pointer-events-none"},io={key:6,class:"absolute top-4 left-4 right-4 bg-red-500/90 text-white p-3 rounded-lg text-center text-sm font-bold backdrop-blur-sm z-40"},uo={class:"bg-white dark:bg-gray-800 rounded-xl shadow-sm border dark:border-gray-700 overflow-hidden flex flex-col"},co={class:"p-3 border-t dark:border-gray-700 flex flex-col gap-3"},vo={class:"flex gap-2"}
1,go={class:"flex-1 min-w-0 w-full rounded-lg border border-gray-300 dark:bg-gray-700 dark:border-gray-600 flex items-center relative"},po=["disabled"],bo={key:0,class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},xo={key:1,class:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},fo={key:0,class:"fixed inset-0 z-[60] overflow-y-auto lg:hidden"},mo={class:"flex min-h-full items-center justify-center p-4 text-center"},ho={class:"relative bg-white dark:bg-gray-800 rounded-2xl w-full max-w-md shadow-2xl flex flex-col text-left"},ko={class:"p-3 flex-1 flex flex-col gap-3"},yo={class:"bg-black rounded-xl overflow-hidden shadow-md relative aspect-[4/3] w-full border-4 border-gray-900"},wo={key:0,class:"absolute inset-0 z-30 flex items-center justify-center bg-black/80 backdrop-blur-sm"},_o={key:1,class:"absolute bottom-4 left-1/2 -translate-x-1/2 z-30 flex items-center justify-center transition-all duration-200 pointer-events-none"},Co={class:"bg-white dark:bg-gray-800 rounded-xl shadow-sm border dark:border-gray-700 overflow-hidden flex flex-col"},So={class:"p-3 border-t dark:border-gray-700 flex gap-2"}
1,Mo={class:"flex-1 min-w-0 w-full rounded-lg border border-gray-300 dark:bg-gray-700 dark:border-gray-600 flex items-center relative"},jo=["disabled"],Eo={key:0,class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},Bo={key:1,class:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},Ro={key:0,class:"fixed inset-0 z-[60] overflow-y-auto"},Io={class:"flex min-h-full items-center justify-center p-4 text-center"},Po={class:"relative bg-white dark:bg-gray-800 rounded-2xl max-w-md w-full p-6 shadow-2xl flex flex-col text-left transform transition-all"},$o={class:"flex justify-between items-center mb-4 pb-3 border-b dark:border-gray-700"},qo={class:"flex bg-gray-100 dark:bg-gray-700 p-1 rounded-xl mb-4"},Lo={class:"bg-indigo-50 border border-indigo-200 rounded-lg p-3 mb-4 flex items-center gap-3 shadow-sm dark:bg-indigo-900/30 dark:border-indigo-800/50"},Do={class:"flex-1 min-w-0"},zo={class:"font-black text-indigo-900 dark:text-indigo-100 truncate"},Ao={key:0,class:"bg-yellow-50 dark:bg-yellow-900/30 border border-yellow-200 dark:border-yellow-700 rounded-lg p-3 mb-4"},Vo={key:1,class:"bg-emerald-50 dark:bg-emerald-900/30 border border-emerald-200 dark:border-emerald-700 rounded-lg p-3 mb-4"},Ho={class:"space-y-5 relative pl-4 border-l-2 border-brand-start/20 ml-2"},Uo={class:"relative"},Oo={key:0,class:"flex items-center gap-2 w-full truncate pr-4"},To={class:"truncate font-bold"},No={class:"text-xs text-gray-500 ml-auto shrink-0 hidden sm:inline-block border-l pl-2 dark:border-gray-600"},Wo={key:1,class:"text-gray-500"},Fo={key:0,class:"font-bold text-gray-900 dark:text-white py-1 flex items-center gap-2"},Go=["src"],Qo={key:0,class:"text-gray-400"},Ko=["src"],Yo={class:"flex flex-col"},Jo={class:"font-medium text-gray-800 dark:text-gray-200"},Xo={class:"text-[10px] text-gray-500"},Zo={class:"relative"},en={class:"flex flex-col gap-3 mb-1"},tn={class:"flex items-center gap-2"},rn={class:"flex items-center gap-2 cursor-pointer bg-gray-50 dark:bg-gray-700/30 p-2.5 rounded-lg border border-gray-200 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors"},an={class:"relative inline-block w-10 mr-2 align-middle select-none transition duration-200 ease-in"},sn={class:"flex flex-col"},on={class:"text-[10px] text-gray-500 leading-tight"},nn={key:0,class:"text-[10px] text-gray-500 text-center mt-1"},ln={key:0,class:"relative"},dn={class:"bg-gray-50 dark:bg-gray-700/30 p-3 rounded-xl border border-gray-200 dark:border-gray-700"},un={class:"grid grid-cols-1 gap-3"},cn=["value"],vn={key:0,class:"flex gap-2"},gn={class:"flex-1"},pn={class:"flex-1"},bn={class:"flex flex-col gap-2 mt-6"},xn={key:0,class:"flex gap-2"},fn=["disabled"],mn=["disabled"],hn=["disabled"],kn={key:1,class:"fixed inset-0 z-[65] overflow-y-auto"},yn={class:"flex min-h-full items-center justify-center p-4 text-center"},wn={class:"relative bg-white dark:bg-gray-800 rounded-2xl max-w-md w-full p-6 shadow-2xl flex flex-col text-left transform transition-all"},_n={class:"bg-gray-50 dark:bg-gray-700/30 p-3 rounded-xl border border-gray-200 dark:border-gray-700 mb-6"},Cn={class:"text-center font-bold text-gray-800 dark:text-gray-200"},Sn={class:"flex flex-col gap-3"},Mn={class:"p-6"},jn={class:"mt-6 flex justify-end"},En={key:2,class:"fixed inset-0 z-[60] flex items-center justify-center bg-black/80 backdrop-blur p-4"},Bn={class:"bg-white dark:bg-gray-800 rounded-2xl max-w-md w-full p-6 text-center shadow-2xl"},Rn={class:"flex gap-3 justify-center mt-6"},In={__name:"Index",props:{initialSession:{type:[Array,Object],default:()=>({})},initialProducts:{type:Array,default:()=>null},initialWarehouses:{type:Array,default:()=>null},initialReturnedPackages:{type:Array,default:()=>null},initialRacks:{type:Array,default:()=>null}},setup(X){var Pt;$t.locale("es");const Vt=_r(),be=A(()=>Vt.props.auth.user),nt=A(()=>{var r;return(r=be.value)==null?void 0:r.is_super_admin}),Ht=A(()=>{var r;return(r=be.value)==null?void 0:r.is_supplier}),Ut=A(()=>{var r;return((r=be.value)==null?void 0:r.is_admin)||nt.value}),Ot=A(()=>{var r;return Ht.value&&!((r=be.value)!=null&&r.parent_id)}),oe=r=>{var t,o,d;return nt.value||Ot.value?!0:Ut.value||(t=be.value)!=null&&t.parent_id?(((d=(o=be.value)==null?void 0:o.metadata)==null?void 0:d.permissions)||[]).includes(r):!0},S=X,B=Mr(),lt=v(!1),Tt=v(!1),Oe=oe("receiving_enter")?"receiving":oe("manage_stock")?"dispatching":oe("receiving_reenter")?"returns":"receiving",b=v(Oe),Me=v(S.initialProducts||[]);ee(()=>S.initialProducts,r=>{r&&(Me.value=[...r],ar())});const Te=A(()=>{const r=[];return Me.value.forEach(t=>{t.sub_products&&t.sub_products.length>
10?t.sub_products.forEach(o=>{r.push({...o,name:`${t.name} - ${o.name}`,parent_name:t.name,parent_id:t.id})}):r.push(t)}),r}),M=v(Oe==="returns"?"package":Oe==="dispatching"?"scan_product":"scan_rack"),ye=v(null),ie=v([]),it=v({code:"SALIDA",name:"Retiro/Eliminación",id:null}),dt=v([]),Ne=v([]),Y=v([]),L=v([]),f=A({get(){return b.value==="returns"?null:b.value==="receiving"?ye.value:it.value},set(r){b.value==="receiving"?ye.value=r:b.value==="dispatching"&&(it.value=r)}}),m=A({get(){return b.value==="returns"?Ne.value:b.value==="receiving"?ie.value:dt.value},set(r){b.value==="returns"?Ne.value=r:b.value==="receiving"?ie.value=r:dt.value=r}});Array.isArray(S.initialSession)?ie.value=S.initialSession:(Pt=S.initialSession)!=null&&Pt.items&&(ie.value=S.initialSession.items),ee(()=>S.initialSession,r=>{r&&ie.value.length===0&&!ye.value&&(Array.isArray(r)&&r.length>0?ie.value=r:r.items&&r.items.length>0&&(ie.value=r.items,r.rack&&(ye.value=r.rack,M.value="scan_product")))}),ee(b,r=>{r==="dispatching"?M.value="scan_product":r==="receiving"?M.value=ye.value?"scan_product":"scan_rack":r==="returns"&&(M.value="package")});let ut=null;const ct=()=>{b.value!=="returns"&&(clearTimeout(ut),ut=setTimeout(()=>{const r=m.value.filter(o=>!o.is_loading),t=b.value==="dispatching"?"supplier.inventory.dispatching.save-session":"supplier.inventory.receiving.save-session";se.post(route(t),{session_data:{rack:f.value,items:r}}).catch(o=>console.error("Error saving session:",o))},1e3))},we=v({}),je=v(null),de=v(""),N=A({get(){return f.value?f.value.id:null},set(r){var t;if(r){const o=(t=S.initialRacks)==null?void 0:t.find(d=>d.id===r);o&&Bt(o.code)}else f.value=null,b.value==="receiving"&&(M.value="scan_rack")}}),We=v(!1),Ee=v(!1),Be=v(!1),P=v(!1),ne=v(!1),Re=v(!1),Ie=v(!1),Fe=v(null),Ge=v(!1),vt=async r=>{Ie.value=!0,Ge.value=!0,Fe.value=null;try{const t=await se.get(route("supplier.inventory.orders.show",r.id));Fe.value=t.data.order}catch(t){console.error("Error loading order details:",t),B.error("Error al cargar los detalles del pedido"),Ie.value=!1}finally{Ge.value=!1}},Nt=r=>{M.value="package",H.value=r,xe.value=r.items.map(t=>({...t,status:"ok"})),ue.value=null,fe.value=null,P.value&&(me(),P.value=!1)},gt=v(Date.now());let pt;const bt=r=>r?gt.value-new Date(r).getTime()<1e4?"Justo ahora":$t(r).fromNow():"",xt=v(!1);at(()=>{const r=new URLSearchParams(window.location.search);xt.value=r.get("simulate")==="1"});const Wt=()=>{if(S.initialReturnedPackages&&S.initialReturnedPackages.length>0){const r=S.initialReturnedPackages[0];ze(r.order_code||r.short_id||r.id)}else B.warning("No hay paquetes devueltos para simular.")},Qe=v(!1),_e=A(()=>b.value==="dispatching"?Se.videos["supplier.inventory.dispatching.index"]||Se.videos["supplier.inventory.receiving.index"]:b.value==="returns"?Se.videos["supplier.inventory.returns.index"]||Se.videos["supplier.inventory.receiving.index"]:Se.videos["supplier.inventory.receiving.index"]),Ft=()=>{Qe.value=!0},H=v(null),xe=v([]),ue=v(null),fe=v(null),Q=v(null),J=v(null),me=()=>{Q.value&&Q.value.stop(),J.value&&J.value.stop()},$=v(window.innerWidth),ft=()=>{$.value=window.innerWidth};at(()=>{window.addEventListener("resize",ft),pt=setInterval(()=>{gt.value=Date.now()},1e3)}),qt(()=>{window.removeEventListener("resize",ft),clearInterval(pt)});const mt=localStorage.getItem("receiving_scanner_floating"),D=v(mt?JSON.parse(mt):!1),ht=localStorage.getItem("receiving_scanner_pos"),q=v(ht?JSON.parse(ht):{x:0,y:0});ee(q,r=>{localStorage.setItem("receiving_scanner_pos",JSON.stringify(r))},{deep:!0});const Ke=v(!1),Ye=v({x:0,y:0}),he={sm:{w:96,h:128,class:"w-24 h-32"},md:{w:144,h:192,class:"w-36 h-48"},lg:{w:192,h:256,class:"w-48 h-64"}},W=v(localStorage.getItem("receiving_scanner_size")||"sm"),Gt=A(()=>{const r=he[W.value]?W.value:"sm";return he[r].class}),Qt=async()=>{W.value==="sm"?W.value="md":W.value==="md"?W.value="lg":W.value="sm",localStorage.setItem("receiving_scanner_size",W.value);const r=he[W.value]?W.value:"sm",t=he[r];q.value.x=Math.max(0,Math.min(q.value.x,window.innerWidth-t.w)),q.value.y=Math.max(0,Math.min(q.value.y,window.innerHeight-t.h)),(P.value||$.value>=1024)&&await jt()};ee($,r=>{if(r>=1024)D.value=!1;else{const t=localStorage.getItem("receiving_scanner_floating");t&&(D.value=JSON.parse(t))}}),ee(D,async r=>{if(localStorage.setItem("receiving_scanner_floating",JSON.stringify(r)),r){const t=he[W.value];q.value.x===0&&q.value.y===0?q.value={x:window.innerWidth-(t.w+14),y:window.innerHeight-(t.h+22)}:(q.value.x=Math.max(0,Math.min(q.value.x,window.innerWidth-t.w)),q.value.y=Math.max(0,Math.min(q.value.y,window.innerHeight-t.h)))}(P.value||$.value>=1024)&&await jt()});const kt=r=>{Ke.value=!0;const t=r.touches?r.touches[0].clientX:r.clientX,o=r.touches?r.touches[0].clientY:r.clientY;Ye.value={x:t-q.value.x,y:o-q.value.y},document.addEventListener("mousemove",Pe),document.addEventListener("mouseup",$e),document.addEventListener("touchmove",Pe,{passive:!1}),document.addEventListener("touchend",$e)},Pe=r=>{if(!Ke.value)return;r.cancelable&&r.preventDefault();const t=r.touches?r.touches[0].clientX:r.clientX,o=r.touches?r.touches[0].clientY:r.clientY;let d=t-Ye.value.x,c=o-Ye.value.y;const g=he[W.value],k=g.w,l=g.h;d=Math.max(0,Math.min(d,window.innerWidth-k)),c=Math.max(0,Math.min(c,window.innerHeight-l)),q.value={x:d,y:c}},$e=()=>{Ke.value=!1,document.removeEventListener("mousemove",Pe),document.removeEventListener("mouseup",$e),document.removeEventListener("touchmove",Pe),document.removeEventListener("touchend",$e)},yt=async()=>{J.value&&await J.value.stop(),P.value=!1,D.value=!0,te(()=>{Q.value&&Q.value.start()})},Kt=async()=>{D.value=!1,Q.value&&await Q.value.stop(),P.value=!0,te(()=>{J.value&&J.value.start()})},U=r=>{window.innerWidth<768?(P.value=!0,te(()=>{J.value&&J.value.start()})):Q.value&&Q.value.start()},Yt=v("product"),Jt=v(null),wt=A(()=>{const r={};m.value.forEach(o=>{let d="SIN_UBICACION",c="Sin Ubicación";o.rack&&(d=o.rack.code||"SIN_UBICACION",c=o.rack.name||"Sin Ubicación"),r[d]||(r[d]={rack:o.rack,code:d,name:c,items:[]}),r[d].items.push(o)});const t=Object.values(r);return f.value&&t.sort((o,d)=>o.code===f.value.code?-1:d.code===f.value.code?1:0),t}),ce=v(!1),le=v("print"),qe=v(null),_=v(null),Je=v([]),Xe=v(!1),z=v(1),ve=v(!1),Le=v(!1),Z=v(null),O=v({size:"50x30",content_mode:"qr_sku_name",customWidth:50,customHeight:30}),Xt=[{id:"a4",name:"Hoja Carta / A4 (Grilla)"},{id:"29x90",name:"Térmica 29x90mm"},{id:"29x42",name:"Térmica 29x42mm"},{id:"50x30",name:"Térmica 50x30mm"},{id:"100x100",name:"Térmica 100x100mm"},{id:"150x100",name:"Térmica 150x100mm (15x10cm)"},{id:"100x150",name:"Térmica 100x150mm"}
1,{id:"custom",name:"Tamaño Personalizado"}],_t=async r=>{Xe.value=!0;try{const t=await se.get(route("supplier.inventory.products.search"),{params:{search:r}}),o=[];t.data.forEach(d=>{d.sub_products&&d.sub_products.length>0?(o.push({id:`group_${d.id}`,name:d.name,isGroup:!0,selectable:!1}),d.sub_products.forEach((c,g)=>{o.push({...c,id:`${d.id}_var_${g}`,product_id:d.id,name:c.name||c.title,parentName:d.name,isChild:!0,code:c.sku||c.internal_sku,sku:c.sku||c.internal_sku})})):o.push({...d,product_id:d.id})}),Je.value=o}catch(t){console.error("Error searching massive products:",t)}finally{Xe.value=!1}},Zt=r=>{_t(r)};ee(qe,r=>{if(r){const t=Je.value.find(o=>o.id===r);t&&(_.value=t)}else _.value=null});const Ct=()=>{if(b.value==="receiving"&&(!f.value||!f.value.id)){B.warning("Debes escanear una estanterÃa primero.","Requiere Ubicación");return}ce.value=!0,le.value=b.value==="dispatching"?"direct":"print",qe.value=null,_.value=null,z.value=1,ve.value=!1,_t("")},Ze=(r="pdf")=>{if(typeof r!="string"&&(r="pdf"),!_.value||z.value<1)return;const t={id:_.value.product_id||_.value.id,name:_.value.parentName?`${_.value.parentName} - ${_.value.name}`:_.value.name,sku:_.value.sku||_.value.code||_.value.internal_sku||"N/A",short_id:_.value.short_id,internal_sku:_.value.internal_sku||_.value.sku||_.value.code||"N/A",image:_.value.image,parent_id:_.value.isChild?_.value.product_id:null};_.value.isChild&&(t.id=_.value.id.includes("_var_")?_.value.short_id||_.value.sku:_.value.id);const o=[];if(b.value==="receiving"){const c=()=>{const k="34679ACDGHJKLMNPQRSTUVWXY";let l="";for(let y=0;y<4;y++)l+=k.charAt(Math.floor(Math.random()*k.length));return l},g=ve.value?1:z.value;for(let k=0;k<g;k++)o.push(`${c()}-${c()}`)}const d={product:t,qty:z.value,uids:o,uid:null,timestamp:new Date,rack:f.value,validationStatus:"valid",is_massive:!0,is_batch:ve.value};m.value.unshift(d),R("success"),B.success(`Agregadas ${z.value} unidades`,t.name,{position:"top"}),b.value==="receiving"&&r!=="none"?(rt(t.parent_id||t.id,t.parent_id?t.id:null,o,r),ce.value=!1,Z.value=d,setTimeout(()=>{Le.value=!0},1e3)):ce.value=!1},er=(r="pdf")=>{if(Z.value){const t=Z.value.product;rt(t.parent_id||t.id,t.parent_id?t.id:null,Z.value.uids,r)}},tr=()=>{if(Z.value){const r=m.value.indexOf(Z.value);r>-1&&(m.value.splice(r,1),B.info("Generación cancelada. El producto no fue agregado.","Cancelado",{position:"top"})),Z.value=null}Le.value=!1},rr=r=>{var t;if(r&&r.is_massive&&((t=r.uids)==null?void 0:t.length)>0){const o=r.product;rt(o.parent_id||o.id,o.parent_id?o.id:null,r.uids,"pdf")}},St=A(()=>m.value.reduce((r,t)=>r+(t.qty||1),0)),et=A(()=>{let r=0,t=0,o=0;return m.value.forEach(d=>{const c=d.qty||1;o+=c,d.validationStatus==="valid"?r+=c:d.validationStatus==="invalid"&&(t+=c)}),{valid:r,invalid:t,total:o}});let tt=null;const Mt=async(r,t=!1)=>{if(!r.uid){r.validationStatus="valid",t&&R("success");return}r.validationStatus="pending";try{const o=b.value==="dispatching"?"supplier.inventory.dispatching.check-uid":"supplier.inventory.receiving.check-uid",d=await se.get(route(o),{params:{uid:r.uid}}),c=d.data.exists,g=d.data.status;b.value==="receiving"?c&&g==="in_stock"?(r.validationStatus="invalid",r.validationError="Este producto ya figura en stock.",R("error"),B.error(`Producto ya en stock: ${r.product.name}`,"Error de Validación",{position:"top"})):(r.validationStatus="valid",r.validationError=null,t&&R("success")):b.value==="dispatching"&&(c&&(g==="in_stock"||g==="shipped"||g==="returned"||g==="dispatched"||g==="in_preparation")?(r.validationStatus="valid",r.validationError=null,t&&R("success")):(r.validationStatus="invalid",c?r.validationError=`Este producto no se puede retirar (Estado actual: ${g}).`:r.validationError="Este código QR no existe en el sistema.",R("error"),B.error(r.validationError,"Error de Validación",{position:"top"})))}catch(o){console.error("Error checking uid",o),r.validationStatus="invalid",r.validationError="Error al validar en la base de datos.",t&&R("error")}};at(()=>{tt=Lt.on("start",()=>{me()})});const ar=()=>{lt.value||(lt.value=!0,te(()=>{sr()}))},sr=()=>{const r=localStorage.getItem("receiving_session");let t=null;if(r)try{t=JSON.parse(r)}catch(o){console.error("Error restoring session",o),localStorage.removeItem("receiving_session")}S.initialSession&&(Array.isArray(S.initialSession)&&S.initialSession.length>0?t={rack:null,items:S.initialSession}:S.initialSession.items&&S.initialSession.items.length>0&&(t=S.initialSession)),t&&(t.rack||t.items&&t.items.length>0)?(f.value=t.rack,m.value=t.items||[],m.value.forEach(o=>{o.validationStatus==="pending"&&Mt(o)}),(f.value||m.value.length>0)&&(B.info("Continuando recepción...","Sesión Recuperada",{position:"top-end"}),M.value="scan_product",window.innerWidth>=1024&&te(()=>U()))):window.innerWidth>=1024?te(()=>U()):M.value!=="package"&&(P.value=!0,te(()=>U()))};ee(m,r=>{ct(),f.value||r.length>0?window.onbeforeunload=t=>{r.length>0&&(t.preventDefault(),t.returnValue="")}:window.onbeforeunload=null},{deep:!0}),ee(f,r=>{ct()});const jt=async()=>{me(),setTimeout(()=>{U()},500)},De=async()=>{P.value=!P.value,P.value?(!f.value&&M.value!=="package"&&(M.value="scan_rack"),await te(),U()):me()},Et=async()=>{try{(await navigator.mediaDevices.getUserMedia({video:!0}
1)).getTracks().forEach(t=>t.stop()),je.value=null,Ee.value=!1,U()}catch(r){console.error("Permission denied",r),Ee.value=!0}},{playSound:R,parseScannedCode:or,processScanEvent:nr}=Ir(),ge=v(!1),ze=async(r,t=null)=>{var y;if(!nr(r,t,1500))return;const{code:o,uid:d,is_json:c}=or(r);if(d&&m.value.some(C=>C.uid===d)){R("error"),B.warning("Este código ya fue escaneado","Duplicado");return}if(ge.value=!0,(y=S.initialRacks)==null?void 0:y.find(C=>C.code===o)){Bt(o),ge.value=!1;return}const k={is_loading:!0,raw_code:o,full_text:r,is_json:c,uid:d,format:(t==null?void 0:t.format)||"unknown",timestamp:new Date,rack:f.value,qty:1,validationStatus:"pending",product:{name:"Cargando...",image:null}};m.value.unshift(k);const l=m.value[0];await te(),setTimeout(()=>{ge.value=!1,lr(l)},10)},Ae=async()=>{if(!de.value)return;const r=de.value;de.value="",ze(r)},lr=async(r,t)=>{var c,g,k,l;const o=r.raw_code,d=r.uid;try{let y=Te.value.find(n=>{if(d&&n.uid===d)return!0;const i=(h,j)=>!h||!j?!1:(h=String(h).toUpperCase(),j=String(j).toUpperCase(),h===j||h==="0"+j||j==="0"+h);return i(n.sku,o)||i(n.barcode,o)||i(n.uid,o)||i(n.short_id,o)||i(n.internal_sku,o)}),C=null;if(!y)try{const n=b.value==="dispatching"?"supplier.inventory.dispatching.omni-search":"supplier.inventory.receiving.omni-search",h=(await se.post(route(n),{code:o})).data;if(h.type==="package"){if(b.value==="dispatching"){r.is_loading=!1,r.validationStatus="invalid",r.validationError="Este módulo es solo para productos, no para pedidos completos.",R("error");return}const j=m.value.indexOf(r);if(j>-1&&m.value.splice(j,1),b.value==="returns"){const w=h.order;w.items=h.items,["failed","rescheduled"].includes(w.status)?Y.value.find(K=>K.id===w.id)?(R("error"),B.warning("Este paquete ya está en la lista de ruta")):(Y.value.unshift(w),R("success"),B.success("Paquete para volver a ruta")):L.value.find(K=>K.id===w.id)?(R("error"),B.warning("Este paquete ya está en la lista de stock")):(L.value.unshift(w),R("success"),B.success("Paquete para desarmar a stock"))}else M.value="package",H.value=h.order,xe.value=h.items.map(w=>({...w,status:"ok"})),ue.value=null,fe.value=null,R("success"),B.success("Paquete encontrado");P.value&&(me(),P.value=!1);return}else h.type==="product"&&(C=h.product,new Set(Me.value.map(w=>w.id)).has(h.product.id)||Me.value.push(h.product))}catch(n){r.is_loading=!1,r.validationStatus="invalid",r.validationError=((g=(c=n.response)==null?void 0:c.data)==null?void 0:g.error)||"No encontrado",R("error");return}if(y=C||y,b.value==="returns"){r.is_loading=!1,r.validationStatus="invalid",r.validationError="Este modo es solo para escanear paquetes devueltos.",R("error");return}if(y){let n=d;if(C&&C.uid&&(n=C.uid),C&&C.variant_code&&!n){const h=Te.value.find(j=>j.id===C.id);if(h&&h.sub_products){const j=h.sub_products.find(w=>w.id===C.variant_code||w.short_id===C.variant_code||w.sku===C.variant_code);j&&(y=j)}}if(r.product=y,r.uid=n||d,!f.value){const h=m.value.indexOf(r);h>-1&&m.value.splice(h,1),R("error"),B.warning("Producto detectado. Escanea un Rack para guardarlo.","Producto sin asignar",{position:"top"});const j=y.suggested_rack_id?(l=(k=S.initialRacks)==null?void 0:k.find(xr=>xr.id===y.suggested_rack_id))==null?void 0:l.name:"Ninguna";let w="Producto Nuevo",K="info",pe="",Ve="Para guardar este producto, <b>primero debes escanear el código de una EstanterÃa (Rack)</b>.";y.item_status?y.item_status==="shipped"?(w="Producto Devuelto",K="warning",pe='<span class="inline-block bg-orange-100 text-orange-800 px-3 py-1 rounded-full text-[11px] font-bold mb-3 border border-orange-200">Viene de un envÃo previo</span>',Ve="Este producto ya habÃa salido de la bodega. Para reingresarlo, <b>primero escanea la EstanterÃa (Rack)</b> donde lo vas a dejar."):y.item_status==="in_stock"?(w="Producto Ya Guardado",K="info",pe='<span class="inline-block bg-green-100 text-green-800 px-3 py-1 rounded-full text-[11px] font-bold mb-3 border border-green-200">Ya está en el sistema</span>',Ve="Este producto ya figura dentro de la bodega. Si lo sacaste y quieres reubicarlo, <b>escanea la nueva EstanterÃa (Rack)</b>."):y.item_status==="in_preparation"?(w="Producto en Preparación",K="warning",pe='<span class="inline-block bg-blue-100 text-blue-800 px-3 py-1 rounded-full text-[11px] font-bold mb-3 border border-blue-200">Separado para pedido</span>',Ve="Este producto estaba separado para un pedido. Si necesitas devolverlo a su sitio, <b>escanea la EstanterÃa (Rack)</b> primero."):(w="Producto Encontrado",pe=`<span class="inline-block bg-gray-100 text-gray-800 px-3 py-1 rounded-full text-[11px] font-bold mb-3 border border-gray-200">Estado: ${y.item_status}</span>`):C&&(w="Producto Encontrado");const br=` 2 <div class="text-center font-sans mt-1"> 3 <div class="mb-2">${pe}</div> 4 <h4 class="text-sm sm:text-base font-bold text-gray-800 leading-tight mb-3">${y.name}</h4> 5 6 <div class="bg-gray-50 border border-gray-200 rounded-lg p-2 sm:p-3 mb-3 text-center"> 7 <p class="text-[10px] sm:text-[11px] text-gray-500 mb-0.5 uppercase tracking-wide font-bold">Sugerencia de ubicación</p> 8 <p class="text-base sm:text-lg font-black text-brand-start">${j}</p> 9 </div> 10 11 <div class="bg-blue-50 border border-blue-200 p-2 sm:p-3 text-xs text-blue-800 rounded-lg text-left"> 12 <div class="flex items-start"> 13 <svg class="w-4 h-4 mr-1.5 text-blue-500 flex-shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
13<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg> 14 <p class="leading-snug m-0">${Ve}</p> 15 </div> 16 </div> 17 </div> 18 `;window.swalRackWarningShown||(window.swalRackWarningShown=!0,I.fire({title:w,html:br,icon:K,width:"24em",customClass:{title:"text-lg sm:text-xl font-bold text-gray-800",htmlContainer:"m-0",confirmButton:"bg-brand-start text-white px-4 py-2 rounded-lg font-bold hover:bg-brand-end transition-colors w-full text-sm sm:text-base mt-2"},buttonsStyling:!1,confirmButtonText:"Entendido, escanearé un Rack"}).then(()=>{window.swalRackWarningShown=!1}));return}if(m.value.filter(h=>h.uid===r.uid&&h!==r&&h.uid).length>0){r.is_loading=!1,r.validationStatus="invalid",r.validationError="Esta etiqueta ya se encuentra en la lista.",R("error");return}if(r.uid)await Mt(r,!0),r.validationStatus==="valid"&&B.success(f.value?`En: ${f.value.name}`:"Sin Ubicación",`${y.name} (x1)`,{position:"top"});else{const{value:h,isConfirmed:j}=await I.fire({title:"Ingresar Cantidad",text:`¿Cuántas unidades de "${y.name}" deseas registrar?`,input:"number",inputValue:1,showCancelButton:!0,confirmButtonText:"Confirmar",cancelButtonText:"Cancelar",confirmButtonColor:"#10B981",inputAttributes:{min:1,step:1},inputValidator:w=>{if(!w||w<=0)return"Debes ingresar una cantidad válida mayor a 0"}});if(j&&h)r.validationStatus="valid",r.qty=parseInt(h),R("success"),B.success(f.value?`En: ${f.value.name}`:"Sin Ubicación",`${y.name} (x${r.qty})`,{position:"top"});else{const w=m.value.indexOf(r);w>-1&&m.value.splice(w,1);return}}r.is_loading=!1}else r.is_loading=!1,r.validationStatus="invalid",r.validationError="Código no reconocido",R("error")}catch(y){console.error(y),r.is_loading=!1,r.validationStatus="invalid",r.validationError="Error al procesar",R("error")}},Bt=r=>{const t=S.initialRacks.find(o=>o.code===r);t&&(f.value=t,R("success"),B.success(t.name,"¡Ubicación Confirmada!",{position:"top"}),M.value="scan_product")},F=v(!1),Rt=A(()=>m.value.some(r=>r.validationStatus==="invalid"||r.validationStatus==="pending"||r.is_loading)),ir=()=>{if(F.value||Rt.value||m.value.length===0)return;const r=b.value==="dispatching";I.fire({title:r?"¿Confirmar Salida?":"¿Confirmar Recepción?",text:r?`Se retirarán ${St.value} productos`:`Se guardarán ${St.value} productos`,icon:"question",showCancelButton:!0,confirmButtonText:"SÃ, Guardar",cancelButtonText:"Cancelar"}).then(async t=>{var o,d;if(t.isConfirmed){F.value=!0,I.fire({title:"Procesando...",text:"Por favor espere",allowOutsideClick:!1,didOpen:()=>I.showLoading()});const c={items:m.value.map(g=>({uid:g.uid,uids:g.uids||[],product_id:g.product.parent_id||g.product.id,variant_id:g.product.parent_id?g.product.id||g.product.uid||g.product.sku:null,rack_id:g.rack?g.rack.id:null,qty:g.qty||1,is_massive:g.is_massive||!1,is_batch:g.is_batch||!1}))};window.onbeforeunload=null;try{const g=r?"supplier.inventory.dispatching.store":"supplier.inventory.receiving.store";(await se.post(route(g),c)).data.success&&(m.value=[],r?(f.value={code:"SALIDA",name:"Retiro de Stock",id:null},M.value="scan_product"):(f.value=null,N.value=null,M.value="scan_rack"),I.fire("Guardado",r?"El retiro de stock se ha registrado correctamente.":"La recepción se ha registrado correctamente.","success").then(()=>{window.innerWidth>=1024&&U("reader")}))}catch(g){const k=((d=(o=g.response)==null?void 0:o.data)==null?void 0:d.error)||(r?"Hubo un problema al procesar el retiro.":"Hubo un problema al guardar la recepción.");I.fire("Error",k,"error"),console.error(g)}finally{F.value=!1,m.value.length>0&&(window.onbeforeunload=g=>{g.preventDefault(),g.returnValue=""})}}})},dr=r=>{if(r.validationStatus==="invalid"){const t=m.value.indexOf(r);t>-1&&(m.value.splice(t,1),B.success("Item eliminado"));return}I.fire({title:"¿Eliminar Item?",text:`Se eliminará ${r.product.name}`,icon:"warning",showCancelButton:!0,confirmButtonColor:"#EF4444",confirmButtonText:"SÃ, eliminar"}).then(t=>{if(t.isConfirmed){const o=m.value.indexOf(r);o>-1&&(m.value.splice(o,1),B.success("Item eliminado correctamente"))}})},ur=r=>{const t=!!we.value[r];wt.value.forEach(o=>{we.value[o.code]=!0}),t&&(we.value[r]=!1)},rt=async(r,t,o,d="pdf")=>{let c=null;for(const k of Te.value)if(k.id===r||k.parent_id===r)if(t){if(k.id===t||k.sku===t||k.short_id===t){c=k;break}}else{c=k;break}if(!c)return;const g={product_id:r,product_name:c.parent_name?`${c.parent_name} - ${c.name}`:c.name,product_sku:c.short_id||c.sku||c.internal_sku,quantity:o.length,codes:o.length,paper_size:O.value.size,custom_width:O.value.customWidth,custom_height:O.value.customHeight,type:"product",warehouse_id:"1",content_mode:O.value.content_mode,output_format:d,uids_json:JSON.stringify(o)};I.fire({title:"Generando PDF...",text:"Por favor espera",allowOutsideClick:!1,didOpen:()=>I.showLoading()});try{const k=await se.post(route("supplier.inventory.print-codes"),g,{responseType:d==="pdf"?"blob":"text"});if(I.close(),d==="html"){const l=window.open("","_blank");l?(l.document.open(),l.document.write(k.data),l.document.close()):B.error("Por favor permite los popups para poder imprimir.","Popups bloqueados");try{const y=await se.post(route("supplier.inventory.print-codes"),{...g,output_format:"pdf"},{responseType:"blob"}),C=new Blob([y.data],{type:"application/pdf"}),n=URL.createObjectURL(C),i=document.createElement("a");i.href=n;const h=new Date().toISOString().slice(0,10).replace(/-/g,""),j=new Date().toTimeStr
18ing().slice(0,8).replace(/:/g,"");i.download=`etiquetas_${c.short_id||c.sku}_${o.length}_${h}_${j}.pdf`,i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout(()=>URL.revokeObjectURL(n),1e4)}catch(y){console.error("Error generating backup PDF:",y)}}else{const l=new Blob([k.data],{type:"application/pdf"}),y=URL.createObjectURL(l),C=document.createElement("a");C.href=y;const n=new Date().toISOString().slice(0,10).replace(/-/g,""),i=new Date().toTimeString().slice(0,8).replace(/:/g,"");C.download=`etiquetas_${c.short_id||c.sku}_${o.length}_${n}_${i}.pdf`,C.style.display="none",document.body.appendChild(C),C.click(),document.body.removeChild(C),window.open(y,"_blank"),setTimeout(()=>URL.revokeObjectURL(y),1e4)}}catch(k){I.close(),console.error("Error generating labels:",k),B.error("Hubo un problema al generar las etiquetas.","Error")}},cr=r=>{const t=r.target.files[0];t&&(ue.value=t,fe.value=URL.createObjectURL(t))},vr=()=>{ue.value=null,fe.value=null},gr=()=>{F.value||L.value.length===0||I.fire({title:"¿Desarmar todos los paquetes?",text:`Se desarmarán ${L.value.length} paquetes y todos sus productos volverán a stock en buen estado.`,icon:"warning",showCancelButton:!0,confirmButtonColor:"#9333ea",cancelButtonColor:"#6b7280",confirmButtonText:"SÃ, desarmar todos",cancelButtonText:"Cancelar"}).then(async r=>{if(r.isConfirmed){F.value=!0,I.fire({title:"Procesando paquetes...",html:"Por favor no cierres esta ventana",allowOutsideClick:!1,didOpen:()=>I.showLoading()});let t=0,o=0;const d=[...L.value];for(const c of d)try{const g=new FormData;if(g.append("order_id",c.id),c.items.forEach((k,l)=>{g.append(`items[${l}][item_id]`,k.id),g.append(`items[${l}][status]`,"ok")}),await se.post(route("supplier.inventory.receiving.process-package"),g),t++,L.value=L.value.filter(k=>k.id!==c.id),S.initialReturnedPackages){const k=S.initialReturnedPackages.findIndex(l=>l.id===c.id);k>-1&&S.initialReturnedPackages.splice(k,1)}}catch(g){console.error(`Error processing package ${c.order_code}:`,g),o++}F.value=!1,o===0?(I.fire("¡Listo!",`${t} paquetes devueltos a stock exitosamente.`,"success"),R("success")):I.fire("Proceso completado con errores",`${t} procesados correctamente. ${o} fallaron.`,"warning")}})},pr=()=>{if(F.value)return;if(xe.value.some(o=>o.status==="damaged")&&!ue.value){B.error("Debe adjuntar una foto de evidencia si hay productos dañados.");return}F.value=!0,I.fire({title:"Procesando Paquete...",allowOutsideClick:!1,didOpen:()=>I.showLoading()});const t=new FormData;t.append("order_id",H.value.id),xe.value.forEach((o,d)=>{t.append(`items[${d}][item_id]`,o.id),t.append(`items[${d}][status]`,o.status)}),ue.value&&t.append("damage_photo",ue.value),Lt.post(route("supplier.inventory.receiving.process-package"),t,{preserveScroll:!0,onSuccess:()=>{if(H.value){const o=H.value.id;if(L.value=L.value.filter(d=>d.id!==o),Y.value=Y.value.filter(d=>d.id!==o),S.initialReturnedPackages){const d=S.initialReturnedPackages.findIndex(c=>c.id===o);d>-1&&S.initialReturnedPackages.splice(d,1)}}M.value=b.value==="returns"?"package":"scan_rack",f.value=null,N.value=null,m.value=[],H.value=null,localStorage.removeItem("receiving_session"),I.fire("¡Ãxito!","Paquete procesado correctamente.","success").then(()=>{window.innerWidth>=1024&&U()})},onError:o=>{I.fire("Error",Object.values(o)[0]||"Hubo un problema al procesar el paquete.","error")},onFinish:()=>{F.value=!1}})},It=()=>{m.value.length>0?I.fire({title:"¿Limpiar sin guardar?",text:"Se perderán los datos actuales.",icon:"warning",showCancelButton:!0,confirmButtonText:"SÃ, Limpiar",cancelButtonText:"Cancelar"}).then(r=>{r.isConfirmed&&(M.value=b.value==="returns"?"package":"scan_rack",f.value=null,N.value=null,m.value=[],H.value=null,localStorage.removeItem("receiving_session"),window.innerWidth>=1024&&U())}):M.value==="package"?(M.value=b.value==="returns"?"package":"scan_rack",f.value=null,N.value=null,m.value=[],H.value=null,localStorage.removeItem("receiving_session"),window.innerWidth>=1024&&U()):(M.value=b.value==="returns"?"package":"scan_rack",f.value=null,N.value=null,window.innerWidth>=1024&&U())};return qt(()=>{me(),window.onbeforeunload=null,tt&&tt()}),(r,t)=>(a(),s(V,null,[G(ke(fr),{title:"Operaciones de Bodega"}),G(Sr,null,{default:re(()=>{var o,d,c,g,k;return[e("div",$r,[e("div",{class:"flex items-center gap-3 w-full lg:w-auto"}
18,[t[40]||(t[40]=e("div",{class:"p-2 bg-brand-start/10 dark:bg-brand-start/20 rounded-lg"},[e("svg",{class:"w-5 h-5 text-brand-start dark:text-brand-end",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})])],-1)),t[41]||(t[41]=e("div",{class:"flex flex-col flex-1"},[e("h1",{class:"text-lg font-bold text-gray-900 dark:text-white leading-tight"},"Operaciones de Bodega"),e("p",{class:"text-[11px] md:text-xs text-gray-500 mt-0.5"},"Ingresa stock, despacha o procesa devoluciones.")],-1)),e("button",{onClick:Ft,class:"text-xs bg-brand-start/10 dark:bg-brand-start/20 text-brand-end dark:text-brand-start border border-brand-start/20 dark:border-brand-start/30 px-2 py-1.5 rounded-lg shadow-sm hover:bg-brand-start/20 transition-colors flex items-center gap-1.5 font-bold ml-1 shrink-0"},[...t[39]||(t[39]=[e("svg",{class:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"})],-1),x(" ¿Cómo funciona? ",-1)])])]),e("div",qr,[e("div",Lr,[b.value==="receiving"&&f.value?(a(),s("button",{key:0,onClick:Ct,class:"flex-1 sm:flex-none flex items-center justify-center gap-2 px-3 py-2 bg-gradient-to-r from-brand-start to-brand-end border-none text-white hover:opacity-90 transition-opacity border border-brand-start text-white font-bold text-xs lg:text-sm rounded-lg transition-all shadow-sm"},[...t[42]||(t[42]=[e("svg",{class:"w-4 h-4 lg:w-5 lg:h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})],-1),e("span",{class:"whitespace-nowrap"},"INGRESO MÃLTIPLE",-1)])])):u("",!0),b.value==="receiving"&&oe("receiving_labels")?(a(),s("button",{key:1,onClick:t[0]||(t[0]=l=>We.value=!0),class:"flex-1 sm:flex-none flex items-center justify-center gap-2 px-3 py-2 bg-brand-start/5 border border-brand-start/50 dark:bg-brand-start/20 dark:border-brand-start rounded-lg hover:bg-brand-start/10 dark:hover:bg-brand-start/40 text-brand-start dark:text-brand-end font-bold text-xs lg:text-sm transition-all"},[...t[43]||(t[43]=[e("svg",{class:"w-4 h-4 lg:w-5 lg:h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v1m6 11h2m-6 0h-2v4m0-11v3m0 0h.01M12 12h4.01M16 20h4M4 12h4m12 0h.01M5 8h2a1 1 0 001-1V5a1 1 0 00-1-1H5a1 1 0 00-1 1v2a1 1 0 001 1zm12 0h2a1 1 0 001-1V5a1 1 0 00-1-1h-2a1 1 0 00-1 1v2a1 1 0 001 1zM5 20h2a1 1 0 001-1v-2a1 1 0 00-1-1H5a1 1 0 00-1 1v2a1 1 0 001 1z"})],-1),e("span",{class:"whitespace-nowrap"},"GENERAR ETIQUETAS",-1)])])):u("",!0)]),P.value?u("",!0):(a(),s("button",{key:0,onClick:De,class:"lg:hidden w-full flex items-center justify-center gap-2 px-4 py-2 bg-gradient-to-r from-brand-start to-brand-end border-none text-white rounded-lg font-bold text-sm shadow-md hover:opacity-90 transition-opacity mt-1"},[...t[44]||(t[44]=[e("svg",{class:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v1m6 11h2m-6 0h-2v4m0-11v3m0 0h.01M12 12h4.01M16 20h4M4 12h4m12 0h.01M5 8h2a1 1 0 001-1V5a1 1 0 00-1-1H5a1 1 0 00-1 1v2a1 1 0 001 1zm12 0h2a1 1 0 001-1V5a1 1 0 00-1-1h-2a1 1 0 00-1 1v2a1 1 0 001 1zM5 20h2a1 1 0 001-1v-2a1 1 0 00-1-1H5a1 1 0 00-1 1v2a1 1 0 001 1z"})],-1),e("span",null,"ESCANEAR",-1)])]))])]),e("div",Dr,[oe("receiving_enter")?(a(),s("button",{key:0,onClick:t[1]||(t[1]=l=>b.value="receiving"),class:E([b.value==="receiving"?"bg-white dark:bg-gray-800 shadow-sm text-brand-start font-bold":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200","flex-auto min-w-[120px] px-3 py-2.5 text-xs sm:text-sm rounded-lg transition-all flex items-center justify-center gap-2"])}
18,[...t[45]||(t[45]=[e("svg",{class:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"})],-1),e("span",{class:"whitespace-nowrap"},"Ingreso a Stock",-1)])],2)):u("",!0),oe("manage_stock")?(a(),s("button",{key:1,onClick:t[2]||(t[2]=l=>b.value="dispatching"),class:E([b.value==="dispatching"?"bg-white dark:bg-gray-800 shadow-sm text-brand-start font-bold":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200","flex-auto min-w-[120px] px-3 py-2.5 text-xs sm:text-sm rounded-lg transition-all flex items-center justify-center gap-2"])},[...t[46]||(t[46]=[e("svg",{class:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})],-1),e("span",{class:"whitespace-nowrap"},"Retiro / Salida",-1)])],2)):u("",!0),oe("receiving_reenter")?(a(),s("button",{key:2,onClick:t[3]||(t[3]=l=>b.value="returns"),class:E([b.value==="returns"?"bg-white dark:bg-gray-800 shadow-sm text-brand-start font-bold":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200","flex-auto min-w-[120px] px-3 py-2.5 text-xs sm:text-sm rounded-lg transition-all flex items-center justify-center gap-2"])},[...t[47]||(t[47]=[e("svg",{class:"w-4 h-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M16 11V7a4 4 0 00-8 0v4M5 9h14l1 12H4L5 9z"})],-1),e("span",{class:"whitespace-nowrap"},"Devoluciones",-1)])],2)):u("",!0)]),G(ke(mr),{data:["initialProducts","initialWarehouses","initialRacks"]},{fallback:re(()=>[...t[48]||(t[48]=[e("div",{class:"flex items-center justify-center py-20"},[e("div",{class:"animate-spin rounded-full h-8 w-8 border-b-2 border-brand-start"}),e("span",{class:"ml-3 text-gray-500 dark:text-gray-400"},"Cargando recepción...")],-1)])]),default:re(()=>{var l,y,C;return[e("div",zr,[G(Br,{show:Tt.value},null,8,["show"]),e("div",Ar,[e("div",Vr,[e("div",Hr,[b.value==="returns"&&!H.value?(a(),s(V,{key:0},[e("div",Ur,[t[49]||(t[49]=e("h3",{class:"font-bold text-gray-700 dark:text-gray-200 flex items-center gap-2"},[e("svg",{class:"w-5 h-5 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M16 11V7a4 4 0 00-8 0v4M5 9h14l1 12H4L5 9z"})]),x(" Devoluciones Escaneadas ")],-1)),e("div",Or,[xt.value&&X.initialReturnedPackages&&X.initialReturnedPackages.length>0?(a(),s("button",{key:0,onClick:Wt,class:"px-3 py-1.5 bg-blue-50 dark:bg-blue-900/20 hover:bg-blue-100 dark:hover:bg-blue-900/40 text-blue-600 dark:text-blue-400 rounded-lg text-xs font-bold border border-blue-200 dark:border-blue-800/30 transition-colors shadow-sm flex items-center justify-center gap-1.5"}," Simular Escaneo ")):u("",!0),Y.value.length>0||L.value.length>0||m.value.length>0?(a(),s("button",{key:1,onClick:t[4]||(t[4]=n=>{Y.value=[],L.value=[],Ne.value=[]}),class:"px-3 py-1.5 bg-white dark:bg-gray-800 hover:bg-red-50 dark:hover:bg-red-900/20 text-red-600 dark:text-red-400 rounded-lg text-xs font-bold border border-red-200 dark:border-red-800/30 transition-colors shadow-sm flex items-center justify-center gap-1.5"}," Limpiar ")):u("",!0)])]),e("div",Tr,[m.value.length>0?(a(),s("div",Nr,[(a(!0),s(V,null,ae(m.value,(n,i)=>(a(),s("div",{key:n.uid||i,class:E(["bg-white dark:bg-gray-800 border p-2.5 rounded-xl flex items-center justify-between shadow-sm transition-all",n.validationStatus==="invalid"?"border-red-300 bg-red-50 dark:border-red-800 dark:bg-red-900/20":"border-gray-200 dark:border-gray-700"])},[e("div",Wr,[n.is_loading?(a(),s("div",Fr)):n.validationStatus==="invalid"?(a(),s("svg",Gr,[...t[50]||
18(t[50]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"},null,-1)])])):u("",!0),e("div",null,[e("div",{class:E(["text-sm font-bold",n.validationStatus==="invalid"?"text-red-800 dark:text-red-300":"text-gray-700 dark:text-gray-200"])},p(n.raw_code),3),n.validationStatus==="invalid"?(a(),s("div",Qr,p(n.validationError),1)):(a(),s("div",Kr,"Buscando paquete..."))])]),n.validationStatus==="invalid"?(a(),s("button",{key:0,onClick:h=>m.value.splice(i,1),class:"p-1.5 text-red-400 hover:text-red-600 hover:bg-red-100 dark:hover:bg-red-900/30 rounded-lg transition-colors"},[...t[51]||(t[51]=[e("svg",{class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])],8,Yr)):u("",!0)],2))),128))])):u("",!0),Y.value.length>0?(a(),s("div",Jr,[e("h4",Xr,[t[52]||(t[52]=e("span",null,"Vuelven a salir a ruta",-1)),e("span",Zr,p(Y.value.length),1)]),e("div",ea,[(a(!0),s(V,null,ae(Y.value,n=>(a(),s("div",{key:n.id,class:"bg-white dark:bg-gray-800 border border-blue-200 dark:border-blue-800/50 p-2.5 rounded-xl shadow-sm flex items-center justify-between transition-all"},[e("div",ta,[t[53]||(t[53]=e("div",{class:"w-8 h-8 rounded-full bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center shrink-0"},[e("svg",{class:"w-4 h-4 text-blue-600 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"})])],-1)),e("div",null,[e("div",ra,p(n.order_code),1),e("div",aa,"Estado: "+p(ke(Ue)(n.status)),1)])]),e("div",sa,[e("button",{onClick:i=>vt(n),class:"px-2 py-1.5 bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300 rounded-lg text-xs font-bold transition-colors shadow-sm flex items-center justify-center",title:"Ver detalles del paquete"},[...t[54]||(t[54]=[e("svg",{class:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)])],8,oa)])]))),128))])])):u("",!0),L.value.length>0?(a(),s("div",na,[e("div",la,[e("h4",ia,[t[55]||(t[55]=e("span",null,"Desarmar para entrar a stock",-1)),e("span",da,p(L.value.length),1)]),L.value.length>1?(a(),s("button",{key:0,onClick:gr,class:"px-3 py-1 bg-purple-600 hover:bg-purple-700 text-white rounded-lg text-xs font-bold transition-colors shadow-sm flex items-center gap-1.5"},[...t[56]||(t[56]=[e("svg",{class:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})],-1),x(" Desarmar Todos ",-1)])])):u("",!0)]),e("div",ua,[(a(!0),s(V,null,ae(L.value,n=>(a(),s("div",{key:n.id,class:"bg-white dark:bg-gray-800 border border-purple-200 dark:border-purple-800/50 p-2.5 rounded-xl shadow-sm flex flex-col gap-2 transition-all"},[e("div",ca,[e("div",va,[t[57]||(t[57]=e("div",{class:"w-8 h-8 rounded-full bg-purple-100 dark:bg-purple-900/30 flex items-center justify-center shrink-0"},[e("svg",{class:"w-4 h-4 text-purple-600 dark:text-purple-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4h4"})])],-1)),e("div",null,[e("div",ga,p(n.order_code),1),e("div",pa,"Estado: "+p(ke(Ue)(n.status)),1)])]),e("div",ba,[e("button",{onClick:i=>vt(n),class:"px-2 py-1.5 bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300 rounded-lg text-xs font-bold transition-colors shadow-sm flex items-center justify-center",title:"Ver detalles del paquete"},[...t[58]||(t[58]=[e("svg",{class:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)])],8,xa),e("button",{onClick:i=>Nt(n),class:"px-3 py-1.5 bg-purple-600 hover:bg-purple-700 text-white rounded-lg text-xs font-bold transition-colors shadow-sm flex items-center gap-1.5"},[...t[59]||(t[59]=[e("svg",{class:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 13l4 4L19 7"})],-1),x(" Desarmar ",-1)])],8,fa)])]),e("div",ma,[(a(!0),s(V,null,ae(n.items,i=>(a(),s("div",{key:i.id,class:"text-[10px] bg-gray-50 dark:bg-gray-700/50 px-1.5 py-0.5 rounded border border-gray-200 dark:border-gray-600 text-gray-600 dark:text-gray-300 inline-flex items-center gap-1"},[e("span",ha,p(i.quantity)+"x",1),t[60]||(t[60]=x()),e("span",ka,p(i.product_name),1)]))),128))])]))),128))])])):u("",!0),Y.value.length===0&&L.value.length===0?(a(),s("div",ya,[...t[61]||(t[61]=[e("svg",{class:"w-8 h-8 text-gray-400 mx-auto mb-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"})],-1),e("p",{class:"text-sm text-gray-500 dark:text-gray-400 font-medium"},"Escanea paquetes devueltos para clasificarlos",-1)])])):u("",!0),e("div",wa,[t[63]||(t[63]=e("h4",{class:"text-center font-bold text-sm text-gray-700 dark:text-gray-300 mb-2"},"Paquetes devueltos por transportista",-1)),e("div",_a,[!X.initialReturnedPackages||X.initialReturnedPackages.length===0?(a(),s("div",Ca,"No hay paquetes pendientes devueltos.")):u("",!0),(a(!0),s(V,null,ae(X.initialReturnedPackages,n=>(a(),s("div",{key:n.id,class:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 p-2 rounded-lg flex justify-between items-center shadow-sm"},[e("div",null,[e("div",Sa,p(n.order_code),1),e("div",Ma,p(ke(Ue)(n.status))+" ⢠"+p(bt(n.updated_at)),1)]),t[62]||(t[62]=e("span",{class:"text-[9px] text-gray-400 uppercase font-bold tracking-wide"},"Esperando escaneo",-1))]))),128))])])])],64)):M.value!=="package"?(a(),s(V,{key:1},[e("div",ja,[e("div",Ea,[t[64]||(t[64]=e("h3",{class:"font-bold text-gray-700 dark:text-gray-200 flex items-center gap-2"},[e("svg",{class:"w-5 h-5 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"})]),x(" Items Escaneados ")],-1)),e("div",Ba,[e("span",Ra,"Totales: "+p(et.value.total),1),e("span",Ia,"Listos: "+p(et.value.valid),1),e("span",Pa,"Fallados: "+p(et.value.invali
18d),1)])]),e("div",$a,[f.value?(a(),s("button",{key:0,onClick:Ct,class:"flex-1 sm:flex-none px-3 py-1.5 bg-blue-50 hover:bg-blue-100 dark:bg-blue-900/20 dark:hover:bg-blue-900/40 text-blue-700 dark:text-blue-400 border border-blue-200 dark:border-blue-800/30 rounded-lg text-xs font-bold transition-colors shadow-sm flex items-center justify-center gap-1.5 md:flex"},[...t[65]||(t[65]=[e("svg",{class:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})],-1),e("span",{class:"whitespace-nowrap"},"Ingreso Multiple",-1)])])):u("",!0),f.value||m.value.length>0||H.value?(a(),s("button",{key:1,onClick:It,class:"flex-1 sm:flex-none px-3 py-1.5 bg-white dark:bg-gray-800 hover:bg-red-50 dark:hover:bg-red-900/20 text-red-600 dark:text-red-400 rounded-lg text-xs font-bold border border-red-200 dark:border-red-800/30 transition-colors shadow-sm flex items-center justify-center gap-1.5"},[...t[66]||(t[66]=[e("svg",{class:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})],-1),e("span",{class:"whitespace-nowrap"},"Limpiar",-1)])])):u("",!0)])]),e("div",qa,[m.value.length===0?(a(),s("div",La,[e("div",Da,[t[71]||(t[71]=e("div",{class:"text-center mb-6"},[e("h3",{class:"text-lg font-bold text-gray-700 dark:text-gray-300"},"¿Qué puedes hacer aquÃ?"),e("p",{class:"text-sm text-gray-500"},"Usa el escáner para realizar cualquiera de estas acciones:")],-1)),e("div",za,[b.value==="receiving"&&oe("receiving_labels")?(a(),s("div",Aa,[...t[67]||(t[67]=[e("div",{class:"bg-emerald-100 dark:bg-emerald-800/50 p-2 rounded-lg shrink-0"},[e("svg",{class:"w-5 h-5 text-emerald-600 dark:text-emerald-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z"})])],-1),e("div",null,[e("h4",{class:"text-sm font-bold text-emerald-900 dark:text-emerald-300 leading-none"},"Generar Etiquetas"),e("p",{class:"text-[11px] sm:text-xs text-emerald-700/80 dark:text-emerald-400/80 mt-1"},"Usa los botones superiores para imprimir QRs individuales o masivos para tu stock.")],-1)])])):u("",!0),b.value==="receiving"?(a(),s("div",Va,[...t[68]||(t[68]=[e("div",{class:"bg-blue-100 dark:bg-blue-800/50 p-2 rounded-lg shrink-0"},[e("svg",{class:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4h4"})])],-1),e("div",null,[e("h4",{class:"text-sm font-bold text-blue-900 dark:text-blue-300 leading-none"},"Ingresar Stock"),e("p",{class:"text-[11px] sm:text-xs text-blue-700/80 dark:text-blue-400/80 mt-1"},[x("Escanea primero una "),e("b",null,"EstanterÃa"),x(" y luego los "),e("b",null,"Productos"),x(" que vas a guardar allÃ.")])],-1)])])):u("",!0),b.value==="dispatching"?(a(),s("div",Ha,[...t[69]||(t[69]=[e("div",{class:"bg-red-100 dark:bg-red-800/50 p-2 rounded-lg shrink-0"},[e("svg",{class:"w-5 h-5 text-red-600 dark:text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})])],-1),e("div",null,[e("h4",{class:"text-sm font-bold text-red-900 dark:text-red-300 leading-none"},"Retirar Stock"),e("p",{class:"text-[11px] sm:text-xs text-red-700/80 dark:text-red-400/80 mt-1"},[x("Escanea directamente los "),e("b",null,"Productos"),x(" que vas a retirar para darles salida del sistema.")])],-1)])])):u("",!0),b.value==="returns"?(a(),s("div",Ua,[...t[70]||(t[70]=[e("div",{class:"bg-purple-100 dar
18k:bg-purple-800/50 p-2 rounded-lg shrink-0"},[e("svg",{class:"w-5 h-5 text-purple-600 dark:text-purple-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M16 11V7a4 4 0 00-8 0v4M5 9h14l1 12H4L5 9z"})])],-1),e("div",null,[e("h4",{class:"text-sm font-bold text-purple-900 dark:text-purple-300 leading-none"},"Recibir Devoluciones"),e("p",{class:"text-[11px] sm:text-xs text-purple-700/80 dark:text-purple-400/80 mt-1"},[x("Escanea la etiqueta de un "),e("b",null,"Paquete devuelto"),x(" para revisar su estado y desarmarlo.")])],-1)])])):u("",!0)])])])):u("",!0),(a(!0),s(V,null,ae(wt.value,n=>(a(),s("div",{key:n.code,class:E(["bg-gray-50 dark:bg-gray-700/20 rounded-xl overflow-hidden border transition-all duration-300",f.value&&f.value.code===n.code?"border-brand-start shadow-md":"border-gray-100 dark:border-gray-700"])},[e("div",{onClick:i=>ur(n.code),class:E(["px-3 py-2 flex justify-between items-center cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors gap-2",f.value&&f.value.code===n.code?"bg-brand-start/10 dark:bg-brand-start/20":"bg-gray-100 dark:bg-gray-700"])},[e("div",Ta,[(a(),s("svg",{class:E(["w-4 h-4 flex-shrink-0 transition-transform duration-200",[{"-rotate-90":we.value[n.code]},(f.value&&f.value.code===n.code,"text-brand-start")]]),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[...t[72]||(t[72]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 9l-7 7-7-7"},null,-1)])],2)),e("span",{class:E(["font-bold text-sm truncate",f.value&&f.value.code===n.code?"text-brand-start dark:text-brand-end":"text-gray-800 dark:text-gray-200"])},p(n.name),3),e("span",Na,"("+p(n.code)+")",1)]),e("span",Wa,p(n.items.reduce((i,h)=>i+h.qty,0)),1)],10,Oa),T(e("div",Fa,[G(hr,{name:"list"},{default:re(()=>[(a(!0),s(V,null,ae(n.items,(i,h)=>{var j,w,K;return a(),s("div",{key:i.uid||i.raw_code||h,class:E(["flex items-center gap-2 p-2 hover:bg-white dark:hover:bg-gray-700/50 transition-all duration-300",{"bg-red-50 dark:bg-red-900/10":i.validationStatus==="invalid","bg-yellow-50 dark:bg-yellow-900/10":i.validationStatus==="pending","opacity-80":i.is_loading}])},[e("div",Ga,[e("img",{src:((j=i.product)==null?void 0:j.image)||"https://placehold.co/100x100?text=Sin+Imagen",class:"w-8 h-8 rounded bg-gray-100 object-cover border border-gray-200"},null,8,Qa),i.is_loading?(a(),s("div",Ka,[...t[73]||(t[73]=[e("svg",{class:"animate-spin w-5 h-5 text-brand-start",fill:"none",viewBox:"0 0 24 24"},[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),e("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})],-1)])])):i.validationStatus==="invalid"?(a(),s("div",Ya,[...t[74]||(t[74]=[e("svg",{class:"w-2 h-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-width":"3",d:"M6 18L18 6M6 6l12 12"})],-1)])])):i.validationStatus==="valid"?(a(),s("div",Ja,[...t[75]||(t[75]=[e("svg",{class:"w-2 h-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-width":"3",d:"M5 13l4 4L19 7"})],-1)])])):u("",!0)]),e("div",Xa,[e("div",Za,[e("div",es,[e("p",ts,[i.qty>1?(a(),s("span",rs,"x"+p(i.qty),1)):u("",!0),i.is_batch?(a(),s("span",as,"LOTE")):u("",!0),i.validationStatus==="invalid"?(a(),s("span",ss,"Eliminar y reintentar")):(a(),s(V,{key:3},[x(p(((w=i.product)==null?void 0:w.name)||"Cargando...")+" ",1),i.uid||i.raw_code&&!i.is_json&&i.raw_code.length<30?(a(),s("span",{key:0,class:"text-[10px] font-mono font-medium bg-gray-100 dark:bg-gray-800 text-gray-500 px-1.5 py-0.5 rounded ml-1 border border-gray-200 dark:border-gray-700 max-w-[200px] truncate",title:i.uid||i.raw_code},"ID: "+p(i.uid||i.raw_code),9,os)):u("",!0)],64))]),i.validationStatus==="invalid"?(a(),s("div",ns,[e("span",ls,p(i.validationError),1),e("div",is,[e("span",ds,"Lectura: "+p(i.is_json&&i.uid?i.uid:i.full_text||i.raw_code),1)])])):u("",!0)]),e("div",us,[i.timestamp?(a(),s("span",cs,p(bt(i.timestamp)),1)):u("",!0),i.format==="qr_code"||i.is_json?(a(),s("span",vs,"CÃDIGO QR")):i.format&&i.format!=="unknown"?(a(),s("span",gs,"CÃDIGO BARRA")):u("",!0)])])]),e("div",ps,[i.is_massive&&((K=i.uids)==null?void 0:K.length)>0?(a(),s("button",{key:0,onClick:st(pe=>rr(i),["stop"]),class:"p-1.5 text-brand-start hover:text-brand-end bg-white hover:bg-gray-50 border border-brand-start/30 shadow-sm transition-all rounded flex items-center justify-center",title:"Imprimir Etiquetas"}
18,[...t[76]||(t[76]=[e("svg",{class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M17 17h2a2 2 0 002-2v-4a2 2 0 00-2-2H5a2 2 0 00-2 2v4a2 2 0 002 2h2m2 4h6a2 2 0 002-2v-4a2 2 0 00-2-2H9a2 2 0 00-2 2v4a2 2 0 002 2zm8-12V5a2 2 0 00-2-2H9a2 2 0 00-2 2v4h10z"})],-1)])],8,bs)):u("",!0),e("button",{onClick:pe=>dr(i),class:"p-1.5 text-red-500 hover:text-red-600 bg-white hover:bg-red-50 border border-red-200 shadow-sm transition-all rounded flex items-center justify-center",title:"Eliminar Item"},[...t[77]||(t[77]=[e("svg",{class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})],-1)])],8,xs)])],2)}),128))]),_:2},1024)],512),[[He,!we.value[n.code]]])],2))),128))]),e("div",fs,[e("button",{onClick:ir,disabled:F.value||Rt.value,class:"w-full bg-gradient-to-r from-brand-start to-brand-end border-none text-white hover:opacity-90 disabled:opacity-50 font-bold py-3 sm:py-4 rounded-xl shadow-lg flex justify-center items-center gap-2 text-base sm:text-lg"},[e("span",null,p(b.value==="dispatching"?"CONFIRMAR SALIDA":"CONFIRMAR RECEPCIÃN"),1),t[78]||(t[78]=e("svg",{class:"w-5 h-5 sm:w-6 sm:h-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 13l4 4L19 7"})],-1))],8,ms)])],64)):M.value==="package"?(a(),s(V,{key:2},[e("div",hs,[e("div",null,[e("div",ks,[t[80]||(t[80]=e("span",{class:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-purple-100 text-purple-800"}," Desarme de Paquete ",-1)),e("button",{onClick:t[5]||(t[5]=n=>Be.value=!0),class:"text-purple-600 hover:text-purple-800 bg-purple-100 hover:bg-purple-200 rounded-full p-1 transition-colors",title:"¿Qué pasa al desarmar?"},[...t[79]||(t[79]=[e("svg",{class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)])])]),e("h2",ys,"Pedido "+p(H.value.order_code),1),e("p",ws,"Estado actual: "+p(ke(Ue)(H.value.status)),1)])]),e("div",_s,[(a(!0),s(V,null,ae(xe.value,n=>(a(),s("div",{key:n.id,class:E(["bg-white dark:bg-gray-800 p-2 sm:p-3 rounded-xl border border-gray-200 dark:border-gray-700 shadow-sm flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-3 transition-all h-full sm:h-auto",n.status==="damaged"?"border-red-300 dark:border-red-700/50 bg-red-50/30 dark:bg-red-900/10":""])},[e("div",Cs,[n.image?(a(),s("div",Ss,[e("img",{class:"h-full w-full object-cover",src:n.image},null,8,Ms)])):u("",!0),e("div",js,[e("div",{class:"text-xs sm:text-sm font-bold text-gray-900 dark:text-white leading-tight line-clamp-2 mb-1",title:n.product_name},p(n.product_name),9,Es),n.variant_name?(a(),s("div",Bs,p(n.variant_name),1)):u("",!0),e("div",Rs,[n.uid?(a(),s("div",Is," ID: "+p(n.uid),1)):u("",!0),e("div",Ps," Cantidad: "+p(n.quantity),1)])])]),e("div",$s,[T(e("select",{"onUpdate:modelValue":i=>n.status=i,class:E(["w-full sm:w-40 rounded-lg border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white shadow-sm focus:border-brand-start focus:ring-brand-start text-xs sm:text-sm py-2 px-2 font-bold transition-colors",n.status==="ok"?"text-green-700 dark:text-green-400":"text-red-700 dark:text-red-400"])},[...t[81]||(t[81]=[e("option",{value:"ok"},"â
Buen Estado",-1),e("option",{value:"damaged"},"â Dañado",-1)])],10,qs),[[ot,n.status]])])],2))),128)),xe.value.some(n=>n.status==="damaged")?(a(),s("div",Ls,[t[84]||(t[84]=e("h4",{class:"text-sm font-bold text-red-800 dark:text-red-400 mb-2"},"Evidencia de Daño Requerida",-1)),fe.value?(a(),s("div",zs,[e("img",{src:fe.value,class:"w-48 h-32 object-cover rounded-xl border border-red-200"},null,8,As),e("button",{onClick:vr,class:"absolute -top-3 -right-3 bg-red-500 text-white rounded-full p-1.5
18shadow-md"},[...t[83]||(t[83]=[e("svg",{class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])])])):(a(),s("div",Ds,[e("input",{type:"file",accept:"image/*",onChange:cr,class:"absolute inset-0 w-full h-full opacity-0 cursor-pointer"},null,32),t[82]||(t[82]=e("span",{class:"text-sm font-bold text-red-600 dark:text-red-400"},"Tocar para tomar foto",-1))]))])):u("",!0)]),e("div",Vs,[e("button",{onClick:It,disabled:F.value,class:"w-full sm:w-1/3 bg-white dark:bg-gray-800 border-2 border-gray-200 dark:border-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 font-bold py-4 rounded-xl shadow-sm flex justify-center items-center gap-2 text-lg transition-colors"},[...t[85]||(t[85]=[e("span",null,"CANCELAR",-1)])],8,Hs),e("button",{onClick:pr,disabled:F.value,class:"w-full sm:w-2/3 bg-gradient-to-r from-brand-start to-brand-end border-none text-white hover:opacity-90 disabled:opacity-50 font-bold py-4 rounded-xl shadow-lg flex justify-center items-center gap-2 text-lg"},[...t[86]||(t[86]=[e("span",null,"DESARMAR PAQUETE",-1)])],8,Us)])],64)):u("",!0)])]),e("div",Os,[T(e("div",Ts,[e("div",{class:E(["bg-white dark:bg-gray-800 p-3 rounded-xl shadow-sm border-l-4 flex flex-col gap-2 overflow-hidden",M.value==="scan_rack"?"border-brand-start":M.value==="package"?"border-purple-500":"border-green-500"])},[e("div",Ns,[e("div",Ws,[t[87]||(t[87]=e("p",{class:"text-[10px] uppercase font-bold text-gray-500 mb-0.5 leading-none"},"¿QUà DEBES HACER AHORA?",-1)),$.value<1024?(a(),s("button",{key:0,onClick:t[6]||(t[6]=n=>P.value=!1),class:"text-red-500 hover:text-red-700 bg-red-50 hover:bg-red-100 rounded px-2 py-0.5 text-xs font-bold transition-colors shrink-0 ml-2"},"Cerrar")):u("",!0)]),e("h2",Fs,[M.value==="scan_rack"?(a(),s("span",Gs)):M.value==="package"?(a(),s("span",Qs)):(a(),s("span",Ks)),e("span",Ys,p(b.value==="receiving"?M.value==="scan_rack"?"Escanea una EstanterÃa":"Escanea los Productos":b.value==="dispatching"?"Escanea productos para Retirar":H.value?"Revisa el Paquete Devuelto":"Escanea Paquete Devuelto"),1)])])],2),M.value!=="package"?(a(),s("div",Js,[e("div",Xs,[G(At,{modelValue:N.value,"onUpdate:modelValue":t[7]||(t[7]=n=>N.value=n),options:X.initialRacks,labelKey:"name",valueKey:"id",searchKeys:["name","code"],placeholder:"Buscar estanterÃa manualmente...",class:E(N.value?"ring-2 ring-brand-start bg-brand-start/10 rounded-lg":"")},{trigger:re(({selected:n,placeholder:i})=>{var h;return[e("span",{class:E(["flex items-center gap-2",N.value?"text-brand-start font-bold":""])},[(a(),s("svg",{class:E(["w-4 h-4",N.value?"text-brand-start":"text-gray-400"]),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[...t[88]||(t[88]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"},null,-1)])],2)),x(" "+p(N.value?"Activa: "+((h=X.initialRacks.find(j=>j.id===N.value))==null?void 0:h.name):i),1)],2)]}),option:re(({option:n})=>[e("div",Zs,[e("span",eo,p(n.name),1),e("span",to,"Código: "+p(n.code),1)])]),_:1},8,["modelValue","options","class"])])])):u("",!0),e("div",{class:E([D.value&&$.value<1024?"fixed z-[60] rounded-xl shadow-2xl border-2 border-black/50 bg-black/50 overflow-hidden flex flex-col "+Gt.value:"bg-transparent rounded-2xl overflow-hidden shadow-lg relative aspect-[4/3] w-full border-4 border-gray-900 group"]),style:kr(D.value&&$.value<1024?{top:q.value.y+"px",left:q.value.x+"px"}:{})},[D.value&&$.value<1024?(a(),s("div",{key:0,class:"absolute top-0 left-0 w-full h-6 bg-gradient-to-r from-brand-start to-brand-end border-none text-white hover:opacity-90 transition-opacity/90 z-30 flex items-center justify-center cursor-move",onMousedown:st(kt,["prevent"]),onTouchstart:st(kt,["prevent"])},[...t[89]||(t[89]=[e("div",{class:"w-8 h-1 bg-white/70 rounded-full pointer-events-none"},null,-1)])],32)):u("",!0),D.value&&$.value<1024?(a(),s("div",ro,[e("button",{onClick:Kt,class:"bg-black/60 text-white rounded-full p-1.5 hover:bg-black/80 shadow-sm",title:"Cerrar Flotante"},[...t[90]||(t[90]=[e("svg",{class:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])])])):u("",!0),D.value&&$.value<1024?(a(),s("div",ao,[e("button",{onClick:Qt,class:"bg-black/60 text-white rounded-full p-1.5 hover:bg-black/80 shadow-sm",title:"Cambiar Tamaño"},[...t[91]||(t[91]=[e("svg",{class:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0zM10 7v3m0 0v3m0-3h3m-3 0H7"})],-1)])])])):u("",!0),!(D.value&&$.value<1024)&&$.value<1024?(a(),s("div",so,[e("button",{onClick:yt,class:"bg-black/60 text-white rounded p-1.5 hover:bg-black/80 shadow-sm flex items-center gap-1 text-xs",title:"Modo Flotante"},[...t[92]||(t[92]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"})],-1),x(" Flotante ",-1)])])])):u("",!0),G(zt,{targetId:"reader",onScan:ze,ref_key:"scannerRefDesktop",ref:Q,startOnMount:!0,minimalUI:D.value&&$.value<1024},null,8,["minimalUI"]),!((l=Q.value)!=null&&l.isScanning)&&!ge.value||D.value&&$.value<1024&&!((y=Q.value)!=null&&y.isScanning)?(a(),s("div",oo,[e("button",{onClick:t[8]||(t[8]=n=>U("reader")),class:E([[D.value&&$.value<1024?"p-4 rounded-full":"px-6 py-3 rounded-xl"],"bg-gradient-to-r from-brand-start to-brand-end text-white font-bold shadow-lg hover:opacity-90 transition-opacity flex items-center justify-center gap-2"])}
18,[t[93]||(t[93]=e("svg",{class:"w-8 h-8",fill:"currentColor",viewBox:"0 0 24 24"},[e("path",{d:"M8 5v14l11-7z"})],-1)),D.value&&$.value<1024?u("",!0):(a(),s("span",no,"INICIAR ESCÃNER"))],2)])):u("",!0),ge.value?(a(),s("div",lo,[...t[94]||(t[94]=[e("div",{class:"bg-black/80 backdrop-blur-md px-4 py-2 rounded-full shadow-2xl flex items-center gap-3 border border-white/10"},[e("div",{class:"animate-spin rounded-full h-5 w-5 border-2 border-brand-start border-t-transparent"}),e("span",{class:"text-xs font-bold text-white uppercase tracking-wider"},"Procesando...")],-1)])])):u("",!0),je.value?(a(),s("div",io,[e("span",null,p(je.value),1),je.value.includes("Permiso")?(a(),s("button",{key:0,onClick:Et,class:"bg-white text-red-600 px-3 py-1 mt-2 rounded text-xs uppercase shadow-sm"},"Habilitar")):u("",!0)])):u("",!0)],6),e("div",uo,[e("button",{onClick:t[9]||(t[9]=n=>ne.value=!ne.value),class:"w-full p-3 flex justify-between items-center bg-gray-50 dark:bg-gray-700/50 hover:bg-gray-100"},[t[96]||(t[96]=e("span",{class:"text-xs font-bold text-gray-600 dark:text-gray-300 uppercase"},"Ingreso Manual",-1)),(a(),s("svg",{class:E(["w-4 h-4 text-gray-500",{"rotate-180":ne.value}]),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[...t[95]||(t[95]=[e("path",{"stroke-width":"2",d:"M19 9l-7 7-7-7"},null,-1)])],2))]),T(e("div",co,[e("div",vo,[e("div",go,[T(e("input",{type:"text","onUpdate:modelValue":t[10]||(t[10]=n=>de.value=n),onKeyup:Dt(Ae,["enter"]),placeholder:"Código, SKU o Paquete...",class:"w-full bg-transparent border-none focus:ring-0 uppercase font-mono text-sm py-2 px-3"},null,544),[[Ce,de.value]])]),e("button",{onClick:Ae,class:"bg-gray-900 dark:bg-gray-600 text-white px-4 rounded-lg font-bold flex-shrink-0",disabled:Re.value},[Re.value?(a(),s("svg",xo,[...t[98]||(t[98]=[e("path",{"stroke-width":"2",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"},null,-1)])])):(a(),s("svg",bo,[...t[97]||(t[97]=[e("path",{"stroke-width":"2",d:"M5 13l4 4L19 7"},null,-1)])]))],8,po)])],512),[[He,ne.value]])])],512),[[He,P.value||$.value>=1024||D.value]]),P.value?(a(),s("div",fo,[e("div",mo,[e("div",{class:"fixed inset-0 bg-black/50 backdrop-blur-sm",onClick:De}),e("div",ho,[e("div",{class:"p-3 border-b dark:border-gray-700 flex justify-between items-center bg-gray-50 dark:bg-gray-900/20 flex-shrink-0 rounded-t-2xl"},[t[101]||(t[101]=e("h3",{class:"font-bold text-sm text-gray-900 dark:text-white flex items-center gap-2"},"Escáner",-1)),e("div",{class:"flex items-center gap-2"},[e("button",{onClick:yt,class:"bg-black/60 text-white rounded p-1.5 hover:bg-black/80 shadow-sm flex items-center gap-1 text-xs",title:"Modo Flotante"},[...t[99]||(t[99]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"})],-1),x(" Flotante ",-1)])]),e("button",{onClick:De,class:"text-gray-800 bg-gray-200 dark:bg-gray-700 rounded-full p-2"},[...t[100]||(t[100]=[e("svg",{class:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])])])]),e("div",ko,[e("div",yo,[G(zt,{targetId:"reader-mobile",onScan:ze,ref_key:"scannerRefMobile",ref:J,startOnMount:!0},null,512),!((C=J.value)!=null&&C.isScanning)&&!ge.value?(a(),s("div",wo,[e("button",{onClick:t[11]||(t[11]=n=>U("reader-mobile")),class:"px-6 py-3 bg-gradient-to-r from-brand-start to-brand-end text-white font-bold rounded-xl shadow-lg hover:opacity-90 transition-opacity flex items-center gap-2"},[...t[102]||(t[102]=[e("svg",{class:"w-6 h-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"}),e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})],-1),x(" INICIAR ESCÃNER ",-1)])])])):u("",!0),ge.value?(a(),s("div",_o,[...t[103]||(t[103]=[e("div",{class:"bg-black/80 backdrop-blur-md px-4 py-2 rounded-full shadow-2xl flex items-center gap-3 border border-white/10"},[e("div",{class:"animate-spin rounded-full h-5 w-5 border-2 border-brand-start border-t-transparent"}),e("span",{class:"text-xs font-bold text-white uppercase tracking-wider"},"Procesando...")],-1)])])):u("",!0)]),e("div",Co,[e("button",{onClick:t[12]||(t[12]=n=>ne.value=!ne.value),class:"w-full p-3 flex justify-between items-center bg-gray-50 dark:bg-gray-700/50"},[t[105]||(t[105]=e("span",{class:"text-xs font-bold text-gray-600 dark:text-gray-300 uppercase"},"Ingreso Manual",-1)),(a(),s("svg",{class:E(["w-4 h-4",{"rotate-180":ne.value}]),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[...t[104]||(t[104]=[e("path",{"stroke-width":"2",d:"M19 9l-7 7-7-7"},null,-1)])],2))]),T(e("div",So,[e("div",Mo,[T(e("input",{type:"text","onUpdate:modelValue":t[13]||(t[13]=n=>de.value=n),onKeyup:Dt(Ae,["enter"]),placeholder:"Código...",class:"w-full bg-transparent border-none focus:ring-0 uppercase font-mono text-sm py-2 px-3"},null,544),[[Ce,de.value]])]),e("button",{onClick:Ae,class:"bg-gray-900 text-white px-4 roun
18ded-lg font-bold flex-shrink-0",disabled:Re.value},[Re.value?(a(),s("svg",Bo,[...t[107]||(t[107]=[e("path",{"stroke-width":"2",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"},null,-1)])])):(a(),s("svg",Eo,[...t[106]||(t[106]=[e("path",{"stroke-width":"2",d:"M5 13l4 4L19 7"},null,-1)])]))],8,jo)],512),[[He,ne.value]])])]),e("div",{class:"p-3 border-t dark:border-gray-700 bg-gray-50 dark:bg-gray-900/20 rounded-b-2xl"},[e("button",{onClick:De,class:"w-full bg-gray-200 dark:bg-gray-700 text-gray-800 dark:text-gray-200 font-bold py-3 rounded-xl border shadow-sm"},"Volver")])])])])):u("",!0)])])])]}),_:1}),G(Er,{show:We.value,"onUpdate:show":t[14]||(t[14]=l=>We.value=l),mode:Yt.value,preselected:Jt.value,warehouses:X.initialWarehouses},null,8,["show","mode","preselected","warehouses"]),G(Rr,{show:Ie.value,order:Fe.value,isLoading:Ge.value,onClose:t[15]||(t[15]=l=>Ie.value=!1)},null,8,["show","order","isLoading"]),ce.value?(a(),s("div",Ro,[e("div",Io,[e("div",{class:"fixed inset-0 bg-black/80 backdrop-blur-sm transition-opacity",onClick:t[16]||(t[16]=l=>ce.value=!1)}),e("div",Po,[e("div",$o,[t[109]||(t[109]=e("h3",{class:"text-lg font-bold text-gray-900 dark:text-white flex items-center gap-2"},[e("svg",{class:"w-5 h-5 text-brand-start",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})]),x(" Ingreso Multiple ")],-1)),e("button",{onClick:t[17]||(t[17]=l=>ce.value=!1),class:"text-gray-500 hover:text-gray-700 bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 rounded-full p-1.5 transition-colors"},[...t[108]||(t[108]=[e("svg",{class:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])])]),e("div",qo,[e("button",{onClick:t[18]||(t[18]=l=>le.value="print"),class:E([le.value==="print"?"bg-white dark:bg-gray-600 shadow-sm text-brand-start font-bold":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200","flex-1 py-2 text-xs sm:text-sm rounded-lg transition-all flex items-center justify-center gap-2"])},[...t[110]||(t[110]=[e("svg",{class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M17 17h2a2 2 0 002-2v-4a2 2 0 00-2-2H5a2 2 0 00-2 2v4a2 2 0 002 2h2m2 4h6a2 2 0 002-2v-4a2 2 0 00-2-2H9a2 2 0 00-2 2v4a2 2 0 002 2zm8-12V5a2 2 0 00-2-2H9a2 2 0 00-2 2v4h10z"})],-1),x(" Imprimir QRs ",-1)])],2),e("button",{onClick:t[19]||(t[19]=l=>le.value="direct"),class:E([le.value==="direct"?"bg-emerald-500 text-white shadow-sm font-bold":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200","flex-1 py-2 text-xs sm:text-sm rounded-lg transition-all flex items-center justify-center gap-2"])},[...t[111]||(t[111]=[e("svg",{class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 13l4 4L19 7"})],-1),x(" Directo al Estante ",-1)])],2)]),e("div",Lo,[t[113]||(t[113]=e("div",{class:"w-10 h-10 rounded-full bg-indigo-100 dark:bg-indigo-800 flex items-center justify-center shrink-0"},[e("svg",{class:"w-5 h-5 text-indigo-600 dark:text-indigo-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4h4"})])],-1)),e("div",Do,[t[112]||(t[112]=e("p",{class:"text-xs text-indigo-800 dark:text-indigo-300 uppercase font-bold truncate"},"Ubicación Destino",-1)),e("p",zo,p((o=f.value)==null?void 0:o.name)+" ("+p((d=f.value)==null?void 0:d.code)+")",1)])]),le.value==="print"?(a(),s("div",Ao,[...t[114]||(t[114]=[e("div",{class:"flex items-start gap-2"},[e("svg",{class:"w-5 h-5 text-yellow-600 dark:text-yellow-500 mt-0.5 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})]),e("div",null,[e("h4",{class:"text-xs font-bold text-yellow-800 dark:text-yellow-400 uppercase"},"Atención"),e("p",{class:"text-[11px] text-yellow-700 dark:text-yellow-300 mt-1"},[x("Esta acción generará etiquetas QR "),e("strong",null,"únicas"),x(" para cada unidad. "),e("strong",null,"¡Es OBLIGATORIO imprimir y pegar fÃsicamente una etiqueta a CADA UNO de los productos!"),x(" Asegúrate de verificar bien la cantidad, de lo contrario los productos se perderán en el inventario.")])])],-1)])])):(a(),s("div",Vo,[...t[115]||(t[115]=[e("div",{class:"flex items-start gap-2"},[e("svg",{class:"w-5 h-5 text-emerald-600 dark:text-emerald-500 mt-0.5 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})]),e("div",null,[e("h4",{class:"text-xs font-bold text-emerald-800 dark:text-emerald-400 uppercase"},"Asignación Rápida"),e("p",{class:"text-[11px] text-emerald-700 dark:text-emerald-300 mt-1"},[x("Los productos se añadirán a la lista de recepción "),e("strong",null,"sin generar etiquetas"),x(" para impresión. Usa esto solo si los productos son pequeños, ya tienen su propio código o no requieren identificación individual.")])])],-1)])])),e("div",Ho,[e("div",Uo,[t[116]||(t[116]=e("div",{class:"absolute -left-[29px] top-0 w-6 h-6 bg-white dark:bg-gray-800 border-2 border-brand-start text-brand-start rounded-full flex items-center justify-center text-xs font-bold shadow-sm"},"1",-1)),t[117]||(t[117]=e("label",{class:"block text-sm font-bold text-gray-700 dark:text-gray-300 mb-1"},"Selecciona el Producto",-1)),G(At,{modelValue:qe.value,"onUpdate:modelValue":t[20]||(t[20]=l=>qe.value=l),options:Je.value,labelKey:"name",valueKey:"id",searchKeys:["name","sku","code","internal_sku","short_id","barcode"],placeholder:"Buscar producto o variante...",onSearch:Zt,loading:Xe.value},{trigger:re(({selected:l,placeholder:y})=>[l?(a(),s("span",Oo,[e("span",To,p(l.parentName?l.parentName+" - ":"")+p(l.name),1),e("span",No," ID: "+p(l.short_id||(String(l.id).includes("_var_")?"Variante":l.id))+" | SKU: "+p(l.sku||l.code||l.internal_sku||"N/A"),1)])):(a(),s("span",Wo,p(y),1))]),option:re(({option:l})=>[l.isGroup?(a(),s("div",Fo,[l.image?(a(),s("img",{key:0,src:l.image,class:"w-6 h-6 rounded object-cover border border-gray-200 bg-white"},null,8,Go)):u("",!0),x(" "+p(l.name),1)])):(a(),s("div",{key:1,class:E([{"pl-4":l.isChild},"flex items-center gap-2"])},[l.isChild?(a(),s("span",Qo,"â")):u("",!0),l.image?(a(),s("img",{key:1,src:l.image,class:"w-8 h-8 rounded object-cover border border-gray-200 bg-white shrink-0"},null,8,Ko)):u("",!0),e("div",Yo,[e("span",Jo,p(l.name),1),e("span",Xo,"ID: "+p(l.short_id||(String(l.id).includes("_var_")?"Variante":l.id))+" | SKU: "+p(l.sku||l.code||l.internal_sku||"N/A"),1)])],2))]),_:1},8,["modelValue","options","loading"])]),e("div",Zo,[t[119]||(t[119]=e("div",{class:"absolute -left-[29px] top-0 w-6 h-6 bg-white dark:bg-gray-800 border-2 border-brand-start text-brand-start rounded-full flex items-center justify-center text-xs font-bold shadow-sm"},"2",-1)),t[120]||(t[120]=e("label",{class:"block text-sm font-bold text-gray-700 dark:text-gray-300 mb-1"},"Cantidad a Generar e Ingresar",-1)),e("div",en,[e("div",tn,[e("button",{onClick:t[21]||(t[21]=l=>z.value=Math.max(1,z.value-1)),class:"w-12 h-12 flex items-center justify-center bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 rounded-lg text-xl font-bold transition-colors select-none shrink-0 border border-gray-300 dark:border-gray-600"},"-"),T(e("input",{type:"number","onUpdate:modelValue":t[22]||(t[22]=l=>z.value=l),min:"1",max:"10000",class:"flex-1 text-center rounded-lg border-gray-300 focus:border-brand-start focus:ring-brand-start text-2xl font-bold p-2 bg-gray-50 dark:bg-gray-900 dark:border-gray-700 dark:text-white",style:{appearance:"textfield","-moz-appearance":"textfield"}},null,512),[[Ce,z.value]]),e("button",{onClick:t[23]||(t[23]=l=>z.value++),class:"w-12 h-12 flex items-center justify-center bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 rounded-lg text-xl font-bold transition-colors select-none shrink-0 border border-gray-300 dark:border-gray-600"},"+")]),e("label",rn,[e("div",an,[T(e("input",{type:"checkbox","onUpdate:modelValue":t[24]||(t[24]=l=>ve.value=l),class:"toggle-checkbox absolute block w-5 h-5 rounded-full bg-white border-4 appearance-none cursor-pointer border-gray-300 checked:border-brand-start transition-all duration-200 checked:right-0 right-5",style:{to
18p:"0",bottom:"0",margin:"auto",height:"20px",width:"20px",right:"20px",position:"absolute"}},null,512),[[yr,ve.value]]),e("div",{class:E(["toggle-label block overflow-hidden h-5 rounded-full bg-gray-300 cursor-pointer transition-colors duration-200",{"bg-brand-start":ve.value}])},null,2)]),e("div",sn,[t[118]||(t[118]=e("span",{class:"text-sm font-bold text-gray-800 dark:text-gray-200"},"Ingresar como Bulto/Lote",-1)),e("span",on,"Generará solo 1 Etiqueta Maestra (QR) que representa las "+p(z.value)+" unidades.",1)])])]),ve.value?u("",!0):(a(),s("p",nn,"Se crearán e ingresarán "+p(z.value)+" etiquetas únicas al inventario.",1))]),le.value==="print"?(a(),s("div",ln,[t[127]||(t[127]=e("div",{class:"absolute -left-[29px] top-0 w-6 h-6 bg-white dark:bg-gray-800 border-2 border-brand-start text-brand-start rounded-full flex items-center justify-center text-xs font-bold shadow-sm"},"3",-1)),e("div",dn,[t[126]||(t[126]=e("h4",{class:"text-xs font-bold text-gray-700 dark:text-gray-300 mb-2 uppercase"},"Configuración de Impresión",-1)),e("div",un,[e("div",null,[t[121]||(t[121]=e("label",{class:"block text-[10px] font-bold uppercase text-gray-500 mb-1"},"Tamaño de Etiqueta",-1)),T(e("select",{"onUpdate:modelValue":t[25]||(t[25]=l=>O.value.size=l),class:"w-full rounded-lg border-gray-300 dark:bg-gray-700 text-xs py-1.5 focus:ring-brand-start focus:border-brand-start"},[(a(),s(V,null,ae(Xt,l=>e("option",{key:l.id,value:l.id},p(l.name),9,cn)),64))],512),[[ot,O.value.size]])]),O.value.size==="custom"?(a(),s("div",vn,[e("div",gn,[t[122]||(t[122]=e("label",{class:"block text-[10px] font-bold uppercase text-gray-500 mb-1"},"Ancho (mm)",-1)),T(e("input",{type:"number","onUpdate:modelValue":t[26]||(t[26]=l=>O.value.customWidth=l),class:"w-full rounded-lg border-gray-300 dark:bg-gray-700 text-xs py-1.5 focus:ring-brand-start focus:border-brand-start"},null,512),[[Ce,O.value.customWidth]])]),e("div",pn,[t[123]||(t[123]=e("label",{class:"block text-[10px] font-bold uppercase text-gray-500 mb-1"},"Alto (mm)",-1)),T(e("input",{type:"number","onUpdate:modelValue":t[27]||(t[27]=l=>O.value.customHeight=l),class:"w-full rounded-lg border-gray-300 dark:bg-gray-700 text-xs py-1.5 focus:ring-brand-start focus:border-brand-start"},null,512),[[Ce,O.value.customHeight]])])])):u("",!0),e("div",null,[t[125]||(t[125]=e("label",{class:"block text-[10px] font-bold uppercase text-gray-500 mb-1"},"Información a Imprimir",-1)),T(e("select",{"onUpdate:modelValue":t[28]||(t[28]=l=>O.value.content_mode=l),class:"w-full rounded-lg border-gray-300 dark:bg-gray-700 text-xs py-1.5 focus:ring-brand-start focus:border-brand-start"},[...t[124]||(t[124]=[e("option",{value:"qr_sku_name"},"QR + Código + Nombre",-1),e("option",{value:"qr_sku"},"QR + Código",-1),e("option",{value:"qr_only"},"Solo QR",-1)])],512),[[ot,O.value.content_mode]])])])])])):u("",!0)]),e("div",bn,[le.value==="print"?(a(),s("div",xn,[e("button",{onClick:t[29]||(t[29]=l=>Ze("pdf")),disabled:!_.value||z.value<1,class:"flex-1 py-3 bg-gradient-to-r from-brand-start to-brand-end border-none text-white hover:opacity-90 transition-opacity disabled:opacity-50 text-white font-bold rounded-xl shadow-md transition-all flex items-center justify-center gap-2 text-xs md:text-sm"},[...t[128]||(t[128]=[e("svg",{class:"w-4 h-4 md:w-5 md:h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})],-1),x(" Descargar PDF ",-1)])],8,fn),e("button",{onClick:t[30]||(t[30]=l=>Ze("html")),disabled:!_.value||z.value<1,class:"flex-1 py-3 bg-gradient-to-r from-brand-start to-brand-end border-none text-white hover:opacity-90 transition-opacity disabled:opacity-50 text-white font-bold rounded-xl shadow-md transition-all flex items-center justify-center gap-2 text-xs md:text-sm"},[...t[129]||(t[129]=[e("svg",{class:"w-4 h-4 md:w-5 md:h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M17 17h2a2 2 0 002-2v-4a2 2 0 00-2-2H5a2 2 0 00-2 2v4a2 2 0 002 2h2m2 4h6a2 2 0 002-2v-4a2 2 0 00-2-2H9a2 2 0 00-2 2v4a2 2 0 002 2zm8-12V5a2 2 0 00-2-2H9a2 2 0 00-2 2v4h10z"})],-1),x(" Impresión Rápida ",-1)])],8,mn)])):(a(),s("button",{key:1,onClick:t[31]||(t[31]=l=>Ze("none")),disabled:!_.value||z.value<1,class:"w-full py-3 bg-emerald-500 hover:bg-emerald-600 text-white font-bold rounded-xl shadow-md transition-colors flex items-center justify-center gap-2 text-sm"},[...t[130]||(t[130]=[e("svg",{class:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 13l4 4L19 7"})],-1),x(" Confirmar Asignación Directa ",-1)])],8,hn)),e("button",{onClick:t[32]||(t[32]=l=>ce.value=!1),class:"w-full py-3 bg-gray-100 hover:bg-gray-200 text-gray-700 font-bold rounded-xl mt-1 text-sm"},"Cancelar")])])])])):u("",!0),Le.value?(a(),s("div",kn,[e("div",yn,[t[138]||(t[138]=e("div",{class:"fixed inset-0 bg-black/80 backdrop-blur-sm transition-opacity"}
18,null,-1)),e("div",wn,[t[135]||(t[135]=e("div",{class:"w-16 h-16 bg-gradient-to-r from-brand-start to-brand-end border-none text-white hover:opacity-90 transition-opacity/20 rounded-full flex items-center justify-center mx-auto mb-4 border border-brand-start/30"},[e("svg",{class:"w-8 h-8 text-brand-start",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z"})])],-1)),t[136]||(t[136]=e("h3",{class:"text-xl font-bold text-gray-900 dark:text-white mb-2 text-center"}," ¿Imprimiste y pegaste las etiquetas? ",-1)),t[137]||(t[137]=e("p",{class:"text-sm text-gray-600 dark:text-gray-300 text-center mb-6"},[x(" Es "),e("strong",{class:"text-red-600 dark:text-red-400"},"estrictamente necesario"),x(" que cada producto tenga su código pegado fÃsicamente antes de continuar. De lo contrario, se perderá la referencia de los productos al guardarlos. ")],-1)),e("div",_n,[t[131]||(t[131]=e("p",{class:"text-xs text-gray-500 mb-1 text-center font-bold uppercase"},"Resumen Generado",-1)),e("p",Cn,p((c=Z.value)==null?void 0:c.qty)+" x "+p((k=(g=Z.value)==null?void 0:g.product)==null?void 0:k.name),1)]),e("div",Sn,[e("button",{onClick:t[33]||(t[33]=l=>Le.value=!1),class:"w-full py-3.5 bg-green-500 hover:bg-green-600 text-white font-bold rounded-xl shadow-md transition-colors flex items-center justify-center gap-2"},[...t[132]||(t[132]=[e("svg",{class:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 13l4 4L19 7"})],-1),x(" SÃ, ya las pegué a todos ",-1)])]),e("button",{onClick:t[34]||(t[34]=l=>er("pdf")),class:"w-full py-3 bg-brand-start/10 hover:bg-gradient-to-r from-brand-start to-brand-end border-none text-white hover:opacity-90 transition-opacity/20 text-brand-start font-bold rounded-xl border border-brand-start/30 transition-colors flex items-center justify-center gap-2"},[...t[133]||(t[133]=[e("svg",{class:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M17 17h2a2 2 0 002-2v-4a2 2 0 00-2-2H5a2 2 0 00-2 2v4a2 2 0 002 2h2m2 4h6a2 2 0 002-2v-4a2 2 0 00-2-2H9a2 2 0 00-2 2v4a2 2 0 002 2zm8-12V5a2 2 0 00-2-2H9a2 2 0 00-2 2v4h10z"})],-1),x(" No, quiero volver a imprimirlas ",-1)])]),e("button",{onClick:tr,class:"w-full py-3 bg-red-50 hover:bg-red-100 text-red-600 font-bold rounded-xl border border-red-200 transition-colors flex items-center justify-center gap-2"},[...t[134]||(t[134]=[e("svg",{class:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1),x(" No, quiero cancelar todo ",-1)])])])])])])):u("",!0),G(jr,{show:Be.value,onClose:t[36]||(t[36]=l=>Be.value=!1),maxWidth:"md"},{default:re(()=>[e("div",Mn,[t[139]||(t[139]=e("div",{class:"flex items-center gap-3 mb-4"},[e("div",{class:"w-10 h-10 rounded-full bg-purple-100 flex items-center justify-center flex-shrink-0"},[e("svg",{class:"w-6 h-6 text-purple-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})])]),e("h3",{class:"text-lg font-bold text-gray-900 dark:text-white"}," ¿Qué sucede al desarmar un paquete? ")],-1)),t[140]||(t[140]=e("div",{class:"space-y-4 text-sm text-gray-600 dark:text-gray-300"},[e("div",{class:"bg-green-50 dark:bg-green-900/20 p-4 rounded-xl border border-green-200 dark:border-green-800/30"},[e("h4",{class:"font-bold text-green-800 dark:text-green-400 mb-1 flex items-center gap-2"},[e("span",null,"â
"),x(" Productos en Buen Estado ")]),e("p",null,[x("Volverán automáticamente a estar disponibles en tu inventario general. Se mantendrán en la misma ubicación (Rack) donde estaban antes de ser empaquetados. "),e("strong",{class:"text-green-700 dark:text-green-500"},"No necesitas volver a escanearlos"),x(" ni ubicarlos manualmente.")])]),e("div",{class:"bg-red-50 dark:bg-red-900/20 p-4 rounded-xl border border-red-200 dark:border-red-800/30"},[e("h4",{class:"font-bold text-red-800 dark:text-red-400 mb-1 flex items-center gap-2"},[e("span",null,"â"),x(" Productos Dañados ")]),e("p",null,[x("Deberás adjuntar obligatoriamente una foto como evidencia del daño. Estos productos quedarán marcados para revisión y "),e("strong",{class:"text-red-700 dark:text-red-500"},"no volverán al stock disponible"),x(" hasta que un administrador lo apruebe.")])]),e("div",{class:"bg-gray-50 dark:bg-gray-800 p-4 rounded-xl border border-gray-200 dark:border-gray-700"},[e("h4",{class:"font-bold text-gray-800 dark:text-gray-200 mb-1 flex items-center gap-2"},[e("span",null,"ð¦"),x(" Sobre el Pedido ")]),e("p",null,"El pedido original cambiará su estado a cancelado o devuelto, y la operación de desarme quedará registrada en el historial del sistema.")])],-1)),e("div",jn,[e("button",{onClick:t[35]||(t[35]=l=>Be.value=!1),class:"px-6 py-2.5 bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-800 dark:text-gray-200 font-bold rounded-xl transition-colors"}," Entendido ")])])]),_:1},8,["show"]),Ee.value?(a(),s("div",En,[e("div",Bn,[t[141]||(t[141]=e("div",{class:"w-16 h-16 bg-red-100 rounded-full flex items-center justify-center mx-auto mb-4"},[e("svg",{class:"w-8 h-8 text-red-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-width":"2",d:"M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"}),e("path",{"stroke-width":"2",d:"M3 3l18 18"})])],-1)),t[142]||(t[142]=e("h3",{class:"text-xl font-bold text-gray-900 dark:text-white mb-2"},"Acceso a Cámara Bloqueado",-1)),e("div",Rn,[e("button",{onClick:t[37]||(t[37]=l=>Ee.value=!1),class:"px-4 py-2 text-gray-500 font-bold"},"Cancelar"),e("button",{onClick:Et,class:"px-6 py-2 bg-gradient-to-r from-brand-start to-brand-end text-white rounded-lg font-bold shadow-lg"},"Intentar de Nuevo")])])])):u("",!0),_e.value?(a(),wr(Cr,{key:3,show:Qe.value,onClose:t[38]||(t[38]=l=>
18Qe.value=!1),title:_e.value.title,description:_e.value.description,gifUrl:_e.value.url,steps:_e.value.steps},null,8,["show","title","description","gifUrl","steps"])):u("",!0)]}),_:1})],64))}},sl=Pr(In,[["__scopeId","data-v-d845e383"]]);export{sl as default};
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.