import{d as te,B as m,r as n,H as ie,z as U,M as B,P as ae,a as F,x as oe,w as u,y as se,a4 as re,f as A,i as o,A as b,j as s,G as S,h as c,Q as ne,R as C,V as M,t as P,g as ue,m as le,N as z,dn as H,_ as ce}from"./index-LX-5rALE.js";import{N as j}from"./noData-IsWEUHkL.js";import{V as pe,a as _}from"./VTabs-DHDBIuNu.js";import{V as J}from"./VDataTable-DGNgPLyG.js";import{V as me}from"./VRow-Cb28_O-Q.js";import{V as x}from"./VCol-D0s5AJIV.js";import{V as K}from"./VAutocomplete-DPtFfbq9.js";import{V as de}from"./VNumberInput-o6tv28xp.js";import"./VSlideGroup-gvVX_Ab-.js";import"./VPagination-R1ziSq8a.js";import"./VSelect-Dn_Pb07C.js";import"./VList-C6UgPLrR.js";import"./VMenu-CUrPXPOk.js";import"./VChip-BGcYkRzt.js";import"./VTable-Cj-oOvx1.js";import"./filter-C9H7r7l-.js";/* empty css              */const ve=["innerHTML"],fe={class:"no-data-box align-content-sm-center",style:{height:"484px"}},he={class:"pt-7 shipping-table-box"},ge={key:0,class:"mt-5 table-top-border"},ye={class:"no-data-box align-content-sm-center",style:{height:"484px"}},Ne=te({inheritAttrs:!1,__name:"productSpecificInfo",props:["blankDescToC","skuList","shippingRateInfos","finalSkuId","scrollStatus"],setup(O){const r=O;m.DP=4;const h=n("Description"),g=n([]),k=n([{title:"Region",value:"countryGroupName"}]),f=ie([]),d=n([]),L=n([]),y=n(0),V=n(0),N=n(1),Q=()=>{r.skuList.forEach(t=>{t.id===y.value&&(V.value=t.weight)})},D=()=>{r.shippingRateInfos.forEach((t,i)=>{const e=`${I(t.name)}Time`,v=`${I(t.name)}PcsFirstPrice`,l=`${I(t.name)}PcsNextPrice`;k.value.push({title:t.name,align:"center",children:[{title:t.type===4?"Per piece - First piece price":"Weight - First Weight Price",align:"center",value:t.type===4?v:"firstWeightPrice"},{title:t.type===4?"Per piece - Next item price":"External weight price",align:"center",value:t.type===4?l:"externalWeightPrice"},{title:"Delivery Time",align:"center",value:e}]}),t.items.forEach(a=>{t.type===4?d.value.push({countryGroupId:a.countryGroupId,countryGroupName:a.countryGroupName,[e]:a.deliveryTime,[v]:z(a.pcsFirstPrice),[l]:z(a.pcsNextPrice),countryItems:a.countryItems}):d.value.push({countryGroupId:a.countryGroupId,countryGroupName:a.countryGroupName,[e]:a.deliveryTime,countryItems:a.countryItems,priceItems:a.priceItems})})}),d.value=H(d.value),R.value=H(d.value),d.value.sort((t,i)=>+(t.countryGroupName.toLowerCase()==="other")-+(i.countryGroupName.toLowerCase()==="other"))},I=t=>t.split(" ").map((i,e)=>e===0?i.toLowerCase():i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()).join(""),$=n([]),q=async()=>{const t=await re();$.value=t.data.countryInfoList},R=n([]),X=()=>{if(g.value.length<=0){k.value=[{title:"Region",value:"countryGroupName"}],D();return}d.value=[],g.value.forEach(t=>{R.value.forEach(i=>{i.countryItems.forEach(e=>{t===e.countryCode&&d.value.push(i)})})}),d.value=Y(d.value)};function Y(t){return[...new Set(t)]}q();const W=U(()=>(t,i,e,v)=>{const l=new m(t||1).times(e).toNumber(),a=new m(l).div(1e3).toNumber(),p=n(0),T=n(0);i.forEach(w=>{a>=w.weightMin&&a<=w.weightMax&&(p.value=w.pricePerKilo,T.value=w.registrationFee)});const ee=new m(p.value).times(a).toNumber(),E=new m(ee).div(e).toNumber();return v===1?p.value===0?"/":`${G(new m(E).plus(T.value).toNumber())}`:p.value===0?"/":`${G(E)}`});n(!0),B(()=>r.skuList,t=>{if(t){r.skuList[0].option1Name&&f.push({title:r.skuList[0].option1Name,align:"center",value:"option1Value"}),r.skuList[0].option2Name&&f.push({title:r.skuList[0].option2Name,align:"center",value:"option2Value"}),r.skuList[0].option3Name&&f.push({title:r.skuList[0].option3Name,align:"center",value:"option3Value"});const i=n(0),e=n(0),v=n(0);r.skuList.forEach((l,a)=>{l.width&&(i.value+=1),l.height&&(e.value+=1),l.length&&(v.value+=1)}),i.value>0&&f.push({title:"Width",align:"center",value:"width"}),e.value>0&&f.push({title:"Height",align:"center",value:"height"}),v.value>0&&f.push({title:"Length",align:"center",value:"length"}),f.push({title:"Price",align:"center",value:"price"}),L.value=r.skuList,y.value=r.skuList[0].id,V.value=r.skuList[0].weight}},{immediate:!0}),B(()=>r.shippingRateInfos,t=>{t&&D()},{immediate:!0}),ae(()=>{r.scrollStatus&&(h.value="Shipping")});const G=t=>{const i=localStorage.getItem("ChooseCurrency"),e=JSON.parse(i),l=F().$state.currentData,a=n(0),p=t||0;return l.currencyRate?(a.value=new m(p).times(l.currencyRate).toNumber(),`${l.name} ${a.value}`):e&&e.currencyRate?(a.value=new m(p).times(e.currencyRate).toNumber(),`${e.name} ${a.value}`):(a.value=new m(p).times(1).toNumber(),`$ ${a.value}`)},Z=U(()=>t=>{const i=localStorage.getItem("ChooseCurrency"),e=JSON.parse(i),l=F().$state.currentData,a=n(0),p=t||0;return l.currencyRate?(a.value=new m(p).times(l.currencyRate).toNumber(),`${l.name} ${a.value}`):e&&e.currencyRate?(a.value=new m(p).times(e.currencyRate).toNumber(),`${e.name} ${a.value}`):(a.value=new m(p).times(1).toNumber(),`$ ${a.value}`)});return(t,i)=>(A(),oe(se,{id:"test-scroll",class:"pa-5 mt-5"},{default:u(()=>[o(pe,{modelValue:s(h),"onUpdate:modelValue":i[0]||(i[0]=e=>b(h)?h.value=e:null)},{default:u(()=>[o(_,{value:"Description"},{default:u(()=>[o(S,{icon:"custom-file-text-line",class:"mb-1 mr-2"}),i[5]||(i[5]=c("div",null,"Description",-1))]),_:1,__:[5]}),o(_,{value:"SizeWeight"},{default:u(()=>[o(S,{icon:"custom-pencil-ruler-2-line",class:"mb-1 mr-2"}),i[6]||(i[6]=c("div",null,"Size & Weight",-1))]),_:1,__:[6]}),o(_,{value:"Shipping"},{default:u(()=>[o(S,{icon:"custom-truck-line",class:"mb-1 mr-2"}),i[7]||(i[7]=c("div",null,"Shipping",-1))]),_:1,__:[7]})]),_:1},8,["modelValue"]),o(ne,{modelValue:s(h),"onUpdate:modelValue":i[4]||(i[4]=e=>b(h)?h.value=e:null)},{default:u(()=>[o(C,{value:"Description"},{default:u(()=>[c("div",{class:"pt-7 description-box",innerHTML:r.blankDescToC},null,8,ve)]),_:1}),o(C,{value:"SizeWeight"},{default:u(()=>[o(J,{"items-per-page":-1,headers:s(f),"disable-sort":"",items:s(L),"hide-default-footer":"","item-key":"name"},{"item.price":u(({item:e})=>[c("div",null,[c("div",null,P(s(Z)(e.price)),1)])]),"no-data":u(()=>[c("div",fe,[o(M,{width:310,"aspect-ratio":"16/9",cover:"",src:s(j)},null,8,["src"])])]),_:1},8,["headers","items"])]),_:1}),o(C,{value:"Shipping"},{default:u(()=>[c("div",he,[o(me,null,{default:u(()=>[o(x,{md:"6",cols:"12"},{default:u(()=>[o(K,{modelValue:s(g),"onUpdate:modelValue":[i[1]||(i[1]=e=>b(g)?g.value=e:null),X],chips:"","closable-chips":"",multiple:"","item-title":"enName","item-value":"countryCode",label:"Country",variant:"outlined",items:s($),"return-object":!1},null,8,["modelValue","items"])]),_:1}),o(x,{md:"3",cols:"12"},{default:u(()=>[o(K,{modelValue:s(y),"onUpdate:modelValue":[i[2]||(i[2]=e=>b(y)?y.value=e:null),Q],"item-title":"skuName","item-value":"id",label:"SKU",variant:"outlined",items:r.skuList,"return-object":!1},null,8,["modelValue","items"])]),_:1}),o(x,{md:"3",cols:"12"},{default:u(()=>[o(de,{modelValue:s(N),"onUpdate:modelValue":i[3]||(i[3]=e=>b(N)?N.value=e:null),"control-variant":"stacked",inset:"",precision:0,variant:"outlined",height:"50",min:1},null,8,["modelValue"])]),_:1})]),_:1})]),r.shippingRateInfos?(A(),ue("div",ge,[o(J,{"items-per-page":-1,headers:s(k),items:s(d),"disable-sort":"","hide-default-footer":"","item-key":"countryGroupId"},{"item.firstWeightPrice":u(({item:e})=>[c("div",null,[c("div",null,P(s(W)(s(V),e.priceItems,s(N),1)),1)])]),"item.externalWeightPrice":u(({item:e})=>[c("div",null,[c("div",null,P(s(W)(s(V),e.priceItems,s(N),2)),1)])]),"no-data":u(()=>[c("div",ye,[o(M,{width:310,"aspect-ratio":"16/9",cover:"",src:s(j)},null,8,["src"])])]),_:1},8,["headers","items"])])):le("",!0)]),_:1})]),_:1},8,["modelValue"]),i[8]||(i[8]=c("div",{class:"text-center mt-5",style:{"font-size":"16px","font-weight":"500"}},"END",-1))]),_:1,__:[8]}))}}),Ee=ce(Ne,[["__scopeId","data-v-35dfc274"]]);export{Ee as default};