import{v as _,L as a,u as r,H as c,_ as m,r as i,o as h,f,w as y,a as o,b as g,j as l}from"./2.3.1_index.js";import{s as k}from"./2.3.1_decor14.js";const b={components:{s_button:_,s_input:k},props:["kind","treasure"],data(){return{packages:null,found:!1,cart_details:this.empty_details(),cart:a.warehouse()}},watch:{packages(t,e){e!==null&&(console.info("packages changed",{latest:t}),this.change_quantity())}},computed:{emblem(){const t=this.treasure;return r(t,["emblem"],"")},identity(){const t=this.treasure;return r(t,["nature","identity"],"")}},methods:{empty_details(){return{packages:0}},async change_quantity(){this.emblem,this.kind;const t=parseInt(this.packages),e=this.treasure;await a.moves.change_quantity({treasure:e,packages:t})},async product_quantity(){const t=this.emblem,e=this.kind,n=this.identity;if(e==="food"){const s=await a.moves.find_FDC_ID({emblem:t,FDC_ID:n["FDC ID"]});c(s,"emblem")?(this.found=!0,this.cart_details=s):(this.found=!1,this.cart_details=this.empty_details())}else if(e==="supp"){const s=await a.moves.find_DSLD_ID({emblem:t,DSLD_ID:n["DSLD ID"]});c(s,"emblem")?(this.found=!0,this.cart_details=s):(this.found=!1,this.cart_details=this.empty_details()),this.found=!1}return this.cart_details}},created(){this.cart_monitor=a.monitor(({inaugural:t,field:e})=>{this.cart=a.warehouse(),this.product_quantity()})},async mounted(){let t=0;try{t=(await this.product_quantity()).packages}catch{}typeof t!="number"&&(t=0),this.packages=t},beforeUnmount(){this.cart_monitor.stop()}},x=b,D={style:{display:"flex",alignItems:"top",justifyContent:"right"}};function w(t,e,n,s,q,v){const u=i("s_input"),B=i("s_button"),d=i("lounge");return h(),f(d,null,{default:y(({palette:C,style:I})=>[o("div",null,[o("section",D,[o("div",null,[g(u,{modelValue:t.packages,"onUpdate:modelValue":e[0]||(e[0]=p=>t.packages=p),type:"number",min:"0",max:"1000",styles:{input:{width:"100px",height:"30px"}}},null,8,["modelValue"])]),l("",!0)]),l("",!0)])]),_:1})}const F=m(x,[["render",w]]);export{F as q};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,[encoded data, 9568 characters]
