import{o as e}from"./chunk-mlkTr37E.js";import{t}from"./api-BogCzFmd.js";import{t as n}from"./moment-BencVxx-.js";import{t as r}from"./delay-DkB8DMH7.js";import{t as i}from"./init-QitreBcL.js";var a=e(r()),o=e(n()),s={maxRetry:3,delay:1e3},c=async()=>(await i.get(`/api/marketing/v4/shop_flash_sale/time_slot/`,{params:{start_time:(0,o.default)().unix(),end_time:(0,o.default)().add(1,`month`).unix()}})).data||[],l=async e=>{let t={time_slot_id:Number(e)};return(await i.post(`/api/marketing/v4/shop_flash_sale/set/`,t)).data||null},u=async(e,t)=>{let n={flash_sale_id:Number(e),time_slot_id:Number(t),status:0};return(await i.post(`/api/marketing/v4/shop_flash_sale/set/`,n)).data||null},d=async(e=0,t=[])=>{let n={flash_sale_id:Number(e),items:t,use_global_category:!0},r=null;for(let e=0;e<s.maxRetry&&(r=(await i.post(`/api/marketing/v4/shop_flash_sale/batch_items/set/`,n)).data||null,r&&r.failed_items&&r.failed_items.length);e++)await(0,a.default)(s.delay);return r},f=async(e=0,t=[])=>{let n={flash_sale_id:Number(e),display_sequence_list:t};return(await i.post(`/api/marketing/v4/shop_flash_sale/item_seq/`,n)).data||null},p=async(e=0,t=`all`,n=10)=>(await i.get(`/api/marketing/v4/shop_flash_sale/list/`,{params:{offset:e,limit:n,type:{all:0,next:1,current:2,end:3}[t]}})).data.flash_sale_list||[],m=async e=>{let t=await i.get(`/api/marketing/v4/shop_flash_sale/batch_items/get`,{params:{flash_sale_id:Number(e),offset:0,limit:100}});return t.data&&t.data.model_info_str&&(t.data.model_info=JSON.parse(t.data.model_info_str),delete t.data.model_info_str),t.data},h=async e=>(await i.get(`/api/marketing/v4/shop_flash_sale/get/`,{params:{flash_sale_id:Number(e)}})).data,g=async(e=20,t=1)=>{let{result:n}=await i.get(`/api/mydata/v2/marketing/flash-sale/overview/`,{params:{page_size:e,page_offset:t,sort_by:`end_day.desc`,order_type:`confirmed`}});return n.items||[]},_=async e=>{try{return(await t.get(`/extension/shopee/flashsale/scheduler/list`,{params:{shopId:e}})).data||[]}catch{return[]}},v=async e=>{try{return(await t.get(`/extension/shopee/flashsale/scheduler/slot`,{params:{shopId:e}})).data||[]}catch{return[]}},y=async e=>{try{return(await t.get(`/extension/shopee/flashsale/scheduler/get/${e}`)).data}catch{return null}},b=async e=>{try{return(await t.post(`/extension/shopee/flashsale/scheduler/create`,e)).data}catch{return null}},x=async e=>t.post(`/extension/shopee/flashsale/scheduler/remove/${e}`),S=async(e,n)=>t.post(`/extension/shopee/flashsale/scheduler/set/${e}`,{flashsaleId:n}),C=async e=>{try{return(await t.get(`/extension/shopee/flashsale/campaign/list`,{params:{shopId:e}})).data||[]}catch{return[]}},w=async e=>{try{return(await t.post(`/extension/shopee/flashsale/campaign/create`,e)).data}catch{return null}},T=async(e,n)=>t.post(`/extension/shopee/flashsale/campaign/update/${e}`,n),E=async e=>t.post(`/extension/shopee/flashsale/campaign/remove/${e}`),D=async e=>{try{return(await t.get(`/extension/shopee/flashsale/campaign/get/${e}`)).data}catch{return null}};export{c as _,T as a,d as b,_ as c,v as d,l as f,p as g,g as h,E as i,x as l,m,D as n,b as o,h as p,C as r,y as s,w as t,S as u,u as v,f as y};