import{o as e}from"./chunk-mlkTr37E.js";import{t}from"./src-BGKisWo9.js";import{t as n}from"./clone-CgApBj5z.js";var r=e(n()),i=e(t()),a=async e=>{let t={...e.product_price,...e.product_images,...e.product_attributes,...e.product_review,...e.product_meta,...e.item,shop_data:e.shop_detailed,account_data:e.account};return t.name=t.title,t.itemid=t.item_id,t.shopid=t.shop_id,t.models=(t.models||[]).map(e=>(e.modelid=e.model_id||0,e.itemid=e.item_id||t.item_id||0,e.promotionid=e.promotion_id||0,e)),t.video_info_list=[t.video],t.sold=(0,i.default)(t.models,e=>e.sold),t.historical_sold=t.global_sold,t.view_count=t.view_count||0,t.liked_count=t.liked_count||0,t.cmt_count=t.cmt_count||0,t},o=async e=>{let t=(0,r.default)({...e,weight:{unit:2,value:e.weight.toString()},description_info:{description:e.description,description_type:`normal`},pre_order_info:{pre_order:e.pre_order,days_to_ship:e.days_to_ship}});if(e.description_json){let n=e.description_json.map(e=>e.img_id?{type:1,value:e.img_id}:e.text?{type:0,value:`${e.text} \n`}:{type:0,value:`

`});t.description_info.description_type=`json`,t.description_info.description=JSON.stringify({field_list:n})}return t.dimension.width=e.dimension.width.toString(),t.dimension.length=e.dimension.length.toString(),t.dimension.height=e.dimension.height.toString(),t.std_tier_variation_list=e.tier_variation.map((e,t)=>({id:0,group_id:t.toString(),custom_value:e.name,value_list:e.options.map((t,n)=>({id:0,custom_value:t,image_id:e.images[n]}))})),t.model_list=e.model_list.sort((e,t)=>e.name<t.name?-1:1),t.enable_model_level_dts=!1,t.attributes=e.attributes.map(e=>{let t={};return e.attribute_value_id?t.value_id=Number(e.attribute_value_id):e.custom_value&&e.custom_value.raw_value&&(t.raw_value=e.custom_value.raw_value,t.unit=e.custom_value.unit),{attribute_id:e.attribute_id,attribute_values:[t]}}),t};export{a as n,o as t};