1import{cg as xe,d0 as be,cJ as l,c6 as d,f as L,cd as b,c$ as s,ca as st,de as Q,c3 as e,cX as n,cQ as U,cc as R,c5 as y,df as Y,da as te,cx as O,cO as g,c1 as z,c4 as q,l as ot,a$ as ie,d9 as at,U as Te,dh as ge,S as fe,M as ve,co as nt,cS as lt,cy as me,cU as it,t as Le,Y as rt,ac as dt,bA as ut,dg as ct,bB as pt,b4 as ht,af as gt,bk as ft,bn as vt,bo as mt}from"./vendor-vue-C3df0gLH.js";import{i as Be}from"./iosButton-BqygnPia.js";/* empty css */import{i as ye}from"./iosDialog-3t7wGQfZ.js";import{H as _e,_ as xt}from"./index-ByVTmJon.js";import{i as bt}from"./iosDropdownButton-CHoTCOp8.js";import{j as Ee,a as yt,d as _t,f as kt,h as St,i as wt,c as Dt}from"./shop-DizDZo68.js";import{e as Ft}from"./teamUser-BZOjWWU0.js";/* empty css */import{_ as Ct}from"./CustomerServiceDialog.vue_vue_type_script_setup_true_lang-BwnnZbmt.js";import{_ as At}from"./iosInput.vue_vue_type_script_setup_true_lang-C6Ro9Mew.js";import{t as It}from"./tiktoklogo_tiktok-Bikz3O07.js";import{_ as Pt}from"./SecondaryPageNav.vue_vue_type_script_setup_true_lang-BELhEODh.js";import"./vendor-BAp2x3JD.js";import"./vendor-charts-BofaT7g3.js";/* empty css */import"./vendor-vuetify-Cd8aE-6N.js";import"./vendor-vxe-D9xzQ_Nx.js";const $t={key:0,class:"py-3"},Tt={class:"max-h-[min(620px,calc(100vh-220px))] space-y-3 overflow-y-auto pr-1"},Lt={class:"rounded-[22px] border border-[#6A5CFF]/15 bg-[#6A5CFF]/5 p-4"},Bt={class:"flex items-start gap-3"},Et={class:"min-w-0 flex-1"},Ot={class:"text-[15px] font-semibold leading-6 text-gray-900"},zt={class:"mt-0.5 text-sm leading-6 text-gray-500"},Nt={class:"mt-3 flex flex-wrap items-center gap-2"},Mt={class:"inline-flex items-center rounded-full border border-white/80 bg-white px-3 py-1.5 text-xs font-medium text-gray-700 shadow-sm"},jt={class:"mr-1.5 flex h-5 w-5 items-center justify-center rounded-full bg-[#6A5CFF] text-[11px] font-semibold text-white"},Vt={key:0,class:"h-3.5 w-3.5 text-[#6A5CFF]/25",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true"},Ut={class:"mt-3 flex items-center justify-between gap-2 rounded-2xl border border-[#6A5CFF]/15 bg-white px-4 py-3"},Rt={class:"text-lg font-semibold tracking-[0.02em] text-gray-900"},Gt={class:"flex-shrink-0 rounded-full border border-[#6A5CFF]/15 bg-[#6A5CFF]/5 px-2.5 py-1 text-xs font-medium text-[#6A5CFF]"},Ht={class:"text-sm leading-6 text-gray-500"},Kt={key:1},Wt={class:"space-y-4"},Qt={class:"block text-sm font-medium text-gray-700 mb-2"},Xt=["placeholder"],qt={class:"mb-2 block text-sm font-medium text-gray-700"},Jt=["readonly","placeholder"],Yt={key:0,class:"mt-1.5 text-xs leading-5 text-gray-500"},Zt={class:"block text-sm font-medium text-gray-700 mb-2"},es=["placeholder"],ts=["disabled"],ss={class:"flex items-center justify-between gap-3"},os=["disabled"],as=["disabled"],ns={key:2},ls=["disabled"],is=xe({__name:"AddShopDialog",emits:["updated"],setup(ke,{expose:i,emit:B}){const{t:u}=be(),{showMessage:G}=_e(),I=g(!1),C=g(!1),x=g("tiktok"),h=g(!1),S=g(!0),c=g({id:void 0,region:"GLOBAL",name:"",thirdShopId:"",status:"ENABLED",url:""}),_=z(()=>{var f;if((f=c.value)!=null&&f.id)return u("addShopDialog.editShop");switch(x.value){case"tiktok":return u("addShopDialog.bindTikTokShop");case"manual":return u("addShopDialog.createShop");default:return u("addShopDialog.addShop")}}),j=z(()=>{var f;if((f=c.value)!=null&&f.id)return"";switch(x.value){case"tiktok":return u("addShopDialog.connectTikTokAccount");case"manual":return u("addShopDialog.manualInputInfo");default:return""}}),w=f=>{f!=null&&f.id?(S.value=!(f.openId&&f.openId.length>10),c.value={id:f.id,name:f.name,status:f.status,url:f.url,region:f.region,thirdShopId:f.thirdShopId,shopCode:f.shopCode},x.value="manual"):(S.value=!0,c.value={id:void 0,shopCode:"",region:"GLOBAL",name:"",thirdShopId:"",status:"ENABLED",url:""},x.value="tiktok"),I.value=!0},m=()=>{I.value=!1,x.value="tiktok",h.value=!1,S.value=!0,c.value={id:void 0,shopCode:"",region:"GLOBAL",name:"",thirdShopId:"",status:"ENABLED",url:""}},k=()=>{c.value.region||(c.value.region="GLOBAL"),x.value="manual"},A=()=>{var f;x.value==="manual"&&!((f=c.value)!=null&&f.id)&&(x.value="tiktok")},H=B,V=async()=>
1{if(c.value){!c.value.id&&!c.value.region&&(c.value.region="GLOBAL"),h.value=!0;try{c.value.id?await Ee(c.value):await yt(c.value),m(),H("updated")}catch(f){G(f,"error")}finally{h.value=!1}}},X=["addShopDialog.installStepSellerCenter","addShopDialog.installStepAppCenter","addShopDialog.installStepSearch","addShopDialog.installStepAuthorize"];return i({selectEvent:w}),(f,p)=>{var P;return l(),d(L,null,[b(s(ye),{modelValue:I.value,"onUpdate:modelValue":p[4]||(p[4]=D=>I.value=D),title:_.value,subtitle:j.value,loading:h.value,"loading-text":x.value==="tiktok"?s(u)("addShopDialog.connectingTikTok"):s(u)("addShopDialog.saving"),"max-width":"600",scrollable:""},st({default:Q(()=>{var D,N;return[x.value==="tiktok"&&!((D=c.value)!=null&&D.id)?(l(),d("div",$t,[e("div",Tt,[e("div",Lt,[e("div",Bt,[p[6]||(p[6]=e("div",{class:"flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-2xl border border-[#6A5CFF]/15 bg-white text-[#6A5CFF] shadow-sm"},[e("svg",{class:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.8",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})])],-1)),e("div",Et,[e("h3",Ot,n(s(u)("addShopDialog.installGuideTitle")),1),e("p",zt,n(s(u)("addShopDialog.installGuideDesc")),1)])]),e("div",Nt,[(l(),d(L,null,U(X,($,se)=>(l(),d(L,{key:$},[e("span",Mt,[e("span",jt,n(se+1),1),R(" "+n(s(u)($)),1)]),se<X.length-1?(l(),d("svg",Vt,[...p[7]||(p[7]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 6 6 6-6 6"},null,-1)])])):y("",!0)],64))),64))]),e("div",Ut,[e("div",Rt,n(s(u)("addShopDialog.brandDisplayName")),1),e("span",Gt,n(s(u)("addShopDialog.searchKeywordLabel")),1)])]),e("p",Ht,[R(n(s(u)("addShopDialog.bindIssueQuestion")),1),e("button",{type:"button",class:"text-[#6A5CFF] font-medium hover:underline",onClick:p[
10]||(p[0]=$=>C.value=!0)},n(s(u)("addShopDialog.contactCustomerService")),1)])])])):x.value==="manual"?(l(),d("div",Kt,[e("div",Wt,[e("div",null,[e("label",Qt,n(s(u)("addShopDialog.shopName")),1),Y(e("input",{"onUpdate:modelValue":p[1]||(p[1]=$=>c.value.name=$),type:"text",placeholder:s(u)("addShopDialog.shopNamePlaceholder"),class:"w-full px-4 py-3 border border-gray-200 rounded-xl bg-white shadow-sm focus:outline-none focus:ring-2 focus:ring-[#6A5CFF]/30 focus:border-[#6A5CFF]/40 transition-all"},null,8,Xt),[[te,c.value.name]])]),e("div",null,[e("label",qt,n(s(u)("addShopDialog.shopRegion")),1),Y(e("input",{"onUpdate:modelValue":p[2]||(p[2]=$=>c.value.region=$),type:"text",readonly:!S.value,placeholder:s(u)("addShopDialog.shopRegionPlaceholder"),class:O(["w-full rounded-xl border px-4 py-3 shadow-sm transition-all focus:outline-none",S.value?"border-gray-200 bg-white focus:border-[#6A5CFF]/40 focus:ring-2 focus:ring-[#6A5CFF]/30":"cursor-not-allowed border-gray-200 bg-gray-50 text-gray-500"])},null,10,Jt),[[te,c.value.region]]),S.value?y("",!0):(l(),d("p",Yt,n(s(u)("addShopDialog.authorizedRegionHint")),1))]),e("div",null,[e("label",Zt,n(s(u)("addShopDialog.shopUrl")),1),Y(e("input",{"onUpdate:modelValue":p[3]||(p[3]=$=>c.value.url=$),type:"url",placeholder:s(u)("addShopDialog.shopUrlPlaceholder"),class:"w-full px-4 py-3 border border-gray-200 rounded-xl bg-white shadow-sm focus:outline-none focus:ring-2 focus:ring-[#6A5CFF]/30 focus:border-[#6A5CFF]/40 transition-all"},null,8,es),[[te,c.value.url]])]),e("button",{onClick:V,disabled:h.value,class:"w-full px-4 py-3 bg-[#6A5CFF] text-white font-medium rounded-xl hover:bg-[#5B4DFF] focus:outline-none focus:ring-2 focus:ring-[#6A5CFF]/30 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed transition-all"},n(h.value?s(u)("addShopDialog.saving"):(N=c.value)!=null&&N.id?s(u)("addShopDialog.saveChanges"):s(u)("addShopDialog.createShop")),9,ts)])])):y("",!0)]}),_:2},[(P=c.value)!=null&&P.id?void 0:{name:"footer",fn:Q(()=>{var D,N;return[e("div",ss,[x.value==="tiktok"&&!((D=c.value)!=null&&D.id)?(l(),d("button",{key:0,onClick:k,disabled:h.value,class:"inline-flex h-9 items-center rounded-xl px-3 text-[13px] font-medium text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 disabled:opacity-50"},n(s(u)("addShopDialog.manualCreateShop")),9,os)):x.value==="manual"&&!((N=c.value)!=null&&N.id)?(l(),d("button",{key:1,onClick:A,disabled:h.value,class:"inline-flex h-9 items-center rounded-xl bg-gray-100 px-3 text-[13px] font-medium text-gray-700 transition-all hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-gray-300 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"},n(s(u)("addShopDialog.back")),9,as)):(l(),d("span",ns)),e("button",{onClick:m,disabled:h.value,class:"inline-flex h-9 items-center rounded-xl px-3 text-[13px] font-medium text-gray-600 transition-all hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-300 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"},n(s(u)("addShopDialog.cancel")),9,ls)])]}),key:"0"}]),1032,["modelValue","title","subtitle","loading","loading-text"]),b(Ct,{modelValue:C.value,"onUpdate:modelValue":p[5]||(p[5]=D=>C.value=D)},null,8,["modelValue"])],64)}}}),rs={class:"flex items-center gap-3 mb-4 pb-4 border-b border-gray-200"},ds={class:"w-10 h-10 rounded-lg bg-red-500 text-white flex items-center justify-center flex-shrink-0 text-xs font-medium"},us={class:"flex-1 min-w-0"},cs={class:"font-medium text-gray-900 truncate"},ps={key:0,class:"text-xs text-gray-500 font-mono truncate"},hs={class:"text-sm text-amber-700 bg-amber-50 border border-amber-200 rounded-lg px-3 py-2 mb-4"},gs={class:"mb-4"},fs={class:"block text-sm font-medium text-gray-700 mb-2"},vs={class:"text-red-600"},ms={key:0,class:"text-sm text-red-500 mt-1"},xs={class:"flex gap-3 justify-end pt-3 border-t border-gray-200"},bs=["disabled"],ys=["disabled"],_s={key:0,class:"animate-spin h-4 w-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},ks=xe({__name:"DeleteShopDialog",emits:["deleted"],setup(ke,{expose:i,emit:B}){const{t:u}=be(),{showMessage:G}=_e(),I=g(!1),C=g(!1),x=g(""),h=g({id:void 0,region:"GLOBAL",name:"",thirdShopId:"",status:"ENABLED",url:""}),S=z(()=>x.value===h.value.name),c=m=>{m!=null&&m.id&&(h.value={id:m.id,name:m.name,status:m.status,url:m.url,regi
1on:m.region,thirdShopId:m.thirdShopId,shopCode:m.shopCode}),I.value=!0},_=()=>{I.value=!1,C.value=!1,x.value="",h.value={id:void 0,shopCode:"",region:"GLOBAL",name:"",thirdShopId:"",status:"ENABLED",url:""}},j=B,w=async()=>{var m;if(!(!((m=h.value)!=null&&m.id)||!S.value)){C.value=!0;try{await _t(h.value.id),G(u("deleteShopDialog.deleteSuccess"),"success"),_(),j("deleted")}catch(k){G(k,"error")}finally{C.value=!1}}};return i({selectEvent:c}),(m,k)=>(l(),q(s(ye),{modelValue:I.value,"onUpdate:modelValue":k[1]||(k[1]=A=>I.value=A),title:s(u)("deleteShopDialog.title"),subtitle:s(u)("deleteShopDialog.subtitle"),loading:C.value,"loading-text":s(u)("deleteShopDialog.deleting"),"max-width":"600",scrollable:""},{default:Q(()=>{var A;return[e("div",rs,[e("div",ds,n(((A=h.value.region)==null?void 0:A.slice(0,2))||s(u)("shopPage.unknown")),1),e("div",us,[e("div",cs,n(h.value.name),1),h.value.shopCode?(l(),d("p",ps,n(h.value.shopCode),1)):y("",!0)])]),e("p",hs,n(s(u)("deleteShopDialog.warningDesc")),1),e("div",gs,[e("label",fs,[R(n(s(u)("deleteShopDialog.confirmLabel"))+"ï¼",1),e("strong",vs,n(h.value.name),1)]),b(s(At),{modelValue:x.value,"onUpdate:modelValue":k[0]||(k[0]=H=>x.value=H),placeholder:s(u)("deleteShopDialog.placeholder")},null,8,["modelValue","placeholder"]),x.value&&!S.value?(l(),d("p",ms,n(s(u)("deleteShopDialog.nameMismatch")),1)):y("",!0)]),e("div",xs,[e("button",{type:"button",onClick:_,disabled:C.value,class:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 hover:border-gray-400 focus:outline-none focus:ring-2 focus:ring-gray-900 focus:ring-offset-1 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"},n(s(u)("common.cancel")),9,bs),e("button",{type:"button",onClick:w,disabled:!S.value||C.value,class:"px-4 py-2 text-sm font-medium text-white bg-red-600 border border-red-600 rounded-lg hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-1 disabled:opacity-50 disabled:cursor-not-allowed transition-colors flex items-center gap-2"},[C.value?(l(),d("svg",_s,[...k[2]||(k[2]=[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),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"},null,-1)])])):y("",!0),e("span",null,n(C.value?s(u)("deleteShopDialog.deleting"):s(u)("deleteShopDialog.confirmDelete")),1)],8,ys)])]}),_:1},8,["modelValue","title","subtitle","loading","loading-text"]))}}),Ss={class:"flex h-full min-h-0 flex-col overflow-hidden bg-[#F7F8FA]"},ws={class:"hidden sm:inline"},Ds={class:"sm:hidden"},Fs={key:1,class:"shrink-0 border-b border-gray-200/80 bg-white px-4 py-3 md:px-6"},Cs={class:"flex min-h-10 items-center gap-3"},As=["aria-label"],Is={class:"min-w-0 flex-1"},Ps={class:"truncate text-[15px] font-semibold text-gray-900 md:text-base"},$s={class:"hidden sm:inline"},Ts={class:"sm:hidden"},Ls={class:"min-h-0 flex-1 overflow-y-auto px-3 pb-4 pt-4 md:px-6 md:pt-5"},Bs={class:"mx-auto w-full max-w-[1720px] space-y-5"},Es={class:"shop-filter-panel"},Os={class:"flex min-w-0 flex-1 flex-wrap items-center gap-2"},zs={class:"shop-filter-count"},Ns={class:"relative shrink-0"},Ms={value:""},js=["value"],Vs={class:"relative shrink-0"},Us={class:"truncate"},Rs=["onClick"],Gs={class:"inline-flex min-w-0 items-center gap-2"},Hs={class:"truncate"},Ks={key:0,class:"px-3 py-2 text-[12px] text-[#687280]"},Ws={class:"ml-auto flex shrink-0 gap-2"},Qs=["disabled"],Xs={key:0,class:"flex min-h-[320px] flex-col items-center justify-center rounded-[24px] border border-gray-200/80 bg-white py-12 shadow-sm"},qs={class:"text-sm font-medium text-gray-500"},Js={key:1,class:"flex min-h-[320px] flex-col items-center justify-center rounded-[24px] border border-gray-200/80 bg-white px-4 py-12 text-center shadow-sm"},Ys={class:"mb-4 flex h-14 w-14 items-center justify-center rounded-2xl bg-gray-50 text-gray-400"},Zs={class:"mb-1.5 text-base font-semibold text-gray-900"},eo={class:"mb-5 max-w-sm text-sm leading-6 text-gray-500"},to={key:0,class:"flex min-h-[220px] items-center justify-center rounded-[24px] border border-dashed border-gray-200 bg-white/70 px-4 py-10 text-center text-sm text-gray-500"},so={key:1,class:"grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4"},oo={class:"flex items-start justify-between gap-3"},ao={class:"flex min-w-0 flex-1 gap-3"},no=["title"],lo=["src"],io={class:"min-w-0 flex-1"},ro={class:"flex flex-wrap items-center gap-x-2 gap-y-1"},uo=["title"],co={class:"mt-3 flex items-center gap-2 text-[12px] text-gray-500"},po={class:"shrink-0"},ho=["title"],go={class:"mt-3 flex min-h-6 flex-wrap gap-1.5"},fo={class:"truncate"},vo={key:0,class:"text-[11px] text-gray-400"},mo={key:1,class:"inline-flex max-w-full items-center rounded-full border border-dashed border-gray-200 bg-gray-50 px-2 py-1 text-[11px] font-medium text-gray-400"},xo={class:"mt-2 flex min-h-5 items-center gap-1.5 text-[11px] text-gray-500"},bo=["title"],yo={key:0},_o={key:1,class:"truncate text-gray-400"},ko={key:3,class:"mt-6 flex justify-center rounded-[24px] border border-gray-200/80 bg-white p-3 shadow-sm"},So={key:0,class:"flex flex-col gap-4"},wo={class:"flex items-center gap-3 rounded-xl border border-gray-200 bg-[#F7F8FA] px-3 py-2.5"},Do={class:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-[#6A5CFF]/10 text-[#6A5CFF]"},Fo={class:"min-w-0 flex-1"},Co={class:"truncate text-sm font-semibold text-[#0D1321]"},Ao={class:"mt-0.5 truncate text-xs text-[#687280]"},Io={class:"shop-editor-section"},Po={class:"flex items-center justify-between gap-3"},$o={class:"text-[13px] font-semibold text-[#0D1321]"},To={class:"mt-0.5 text-[12px] text-[#687280]"},Lo={class:"flex flex-wrap gap-2"},Bo=["onClick"],Eo={class:"truncate"},Oo={key:0,class:"text-[12px] text-gray-400"},zo={class:"flex gap-2 pt-0.5"},No=["placeholder","onKeydown"],Mo={class:"shop-editor-section"},jo={class:"flex items-center justify-between gap-3"},Vo={class:"text-[13px] font-semibold text-[#0D1321]"},Uo={class:"flex flex-wrap gap-2"},Ro=["onClick"],Go={class:"shop-owner-avatar"},Ho={class:"truncate"},Ko={key:0,class:"text-[12px] text-gray-400"},Wo={class:"space-y-2 pt-0.5"},Qo={class:"relative"},Xo=["placeholder"],qo={key:0,class:"max-h-40 overflow-y-auto rounded-xl border border-gray-200 bg-white p-1"},Jo={key:0,class:"px-3 py-2 text-[12px] text-[#687280]"},Yo=["onClick"],Zo={class:"shop-owner-avatar"},ea={class:"min-w-0 flex-1"},ta={class:"block truncate text-[13px] font-medium text-[#0D1321]"},sa={class:"block truncate text-[11px] text-[#687280]"},oa={key:2,class:"px-3 py-2 text-[12px] text-[#687280]"},aa={class:"flex gap-3 justify-end"},na=xe({__name:"ShopPage",setup(ke){const{t:i}=be(),{showMessage:B}=_e(),u=nt("inManagementHub",!1),G=g(1),I=g(100),C=g(0),x=g(!1),h=g([]),S=["#6A5CFF","#00A8A0","#F59E0B","#FF4D6D","#687280"],c=g(""),_=g([]),j=g(!1),w=g([]),m=g({}),k=g({}),A=g([]),H=g(!1),V=g(""),X=g(!1),f=g(null),p=g([]),P=g([]),D=g(""),N=g(!1),$=async()=>{x.value=!0;try{const t=await kt({pageNumber:G.value,pageSize:I.value});h.value=(t==null?void 0:t.list)||[],Ve(h.value),C.value=t.total}catch(t){console.error("Load shop list failed:",t)}finally{x.value=!1}};$();const se=z(()=>({ENABLED:i("shopPage.statusEnabled"),DISABLED:i("shopPage.statusDisabled")})),Oe=z(()=>{const t=new Set;for(const a of h.value)a.region&&t.add(a.region);return Array.from(t).sort()}),ze=z(()=>!!(c.value||_.value.length)),Ne=z(()=>{if(!_.value.length)return i("shopPage.allTags");const t=_.value.map(a=>{var r;return(r=w.value.find(o=>o.id===a))==null?void 0:r.name}
1).filter(Boolean);return t.length===1?t[0]:`${t[0]} +${t.length-1}`}),re=z(()=>h.value.filter(t=>{if(c.value&&t.region!==c.value)return!1;if(_.value.length>0){const a=ue(t);if(!_.value.some(r=>a.includes(r)))return!1}return!0})),Z=z(()=>f.value&&h.value.find(t=>t.id===f.value)||null),Se=z(()=>P.value.map(t=>A.value.find(a=>a.id===t)).filter(Boolean)),we=z(()=>{const t=V.value.trim().toLowerCase();return t?A.value.filter(a=>!P.value.includes(a.id)).filter(a=>[a.name,a.username,a.phone].filter(Boolean).some(r=>r.toLowerCase().includes(t))).slice(0,8):[]}),de=t=>t||"-",Me=t=>(Array.isArray(t.tagNames)?t.tagNames:Array.isArray(t.tags)?t.tags:[]).map((r,o)=>{if(typeof r=="string")return{id:r,name:r,color:S[o%S.length]};const v=String((r==null?void 0:r.name)||(r==null?void 0:r.tagName)||(r==null?void 0:r.label)||(r==null?void 0:r.id)||"").trim();return v?{id:String((r==null?void 0:r.id)||v),name:v,color:(r==null?void 0:r.color)||S[o%S.length]}:null}).filter(Boolean),De=t=>t.map(a=>{var r,o;return(o=(r=w.value.find(v=>v.id===a))==null?void 0:r.name)==null?void 0:o.trim()}).filter(Boolean),Fe=(t,a)=>{if(t.length!==a.length)return!1;const r=[...t].sort(),o=[...a].sort();return r.every((v,K)=>v===o[K])},Ce=t=>{const a=Number(t.userId||t.id);return Number.isFinite(a)&&a>0?String(a):""},je=t=>Array.isArray(t.managerList)?t.managerList.map(Ce).filter(Boolean):[],Ve=t=>{var W;const a=new Map,r=new Map(A.value.map(F=>[F.id,F])),o={...m.value},v={...k.value};for(const F of t){const J=(W=F.id)==null?void 0:W.toString();if(!J)continue;const ee=Me(F);for(const E of ee)a.has(E.id)||a.set(E.id,E);o[J]=ee.map(E=>E.id);const T=je(F);if(v[J]=T,Array.isArray(F.managerList))for(const E of F.managerList){const M=Ce(E);if(!M||r.has(M))continue;const he=E.displayName||`#${M}`;r.set(M,{id:M,name:he,username:"",phone:""})}}const K=new Map(w.value.map(F=>[F.id,F]));for(const F of a.values())K.has(F.id)||K.set(F.id,F);w.value=Array.from(K.values()),m.value=o,A.value=Array.from(r.values()),k.value=v},ue=t=>{var r;const a=(r=t.id)==null?void 0:r.toString();return a?m.value[a]||[]:[]},oe=t=>ue(t).map(a=>w.value.find(r=>r.id===a)).filter(Boolean),ce=t=>_.value.includes(t),Ue=t=>{_.value=ce(t)?_.value.filter(a=>a!==t):[..._.value,t]},Re=()=>{_.value=[],j.value=!1},Ge=()=>{c.value="",_.value=[],j.value=!1},ae=t=>{var r;const a=(r=t.id)==null?void 0:r.toString();return a?(k.value[a]||[]).map(o=>A.value.find(v=>v.id===o)).filter(Boolean):[]},He=t=>({id:t.id.toString(),name:t.nickname||t.username||t.phone||`#${t.id}`,username:t.username||"",phone:t.phone||""}),Ae=async()=>{if(!(H.value||A.value.length)){H.value=!0;try{const t=await Ft({pageNumber:1,pageSize:500});A.value=(t.list||[]).filter(a=>a.enabled).map(He)}catch(t){B(t||i("shopPage.loadOwnersFailed"),"error")}finally{H.value=!1}}},Ke=t=>{t.id&&(f.value=t.id,p.value=[...ue(t)],P.value=[...k.value[t.id.toString()]||[]],D.value="",V.value="",X.value=!0,Ae())},ne=()=>{X.value=!1,f.value=null,p.value=[],P.value=[],D.value="",V.value=""},We=t=>{if(p.value.includes(t)){p.value=p.value.filter(a=>a!==t);return}if(p.value.length>=10){B(i("shopPage.maxTagsWarning"),"warning");return}p.value=[...p.value,t]},Ie=()=>{const t=D.value.trim();if(!t)return;if(p.value.length>=10){B(i("shopPage.maxTagsWarning"),"warning");return}const a=w.value.find(o=>o.name===t);if(a){p.value.includes(a.id)||(p.value=[...p.value,a.id]),D.value="";return}const r={id:`custom-${Date.now()}`,name:t,color:S[w.value.length%S.length]};w.value=[...w.value,r],p.value=[...p.value,r.id],D.value=""},Qe=()=>{p.value=[]},Xe=t=>{P.value.includes(t)||(P.value=[...P.value,t]),V.value=""},qe=t=>{P.value=P.value.filter(a=>a!==t)},Je=()=>{P.value=[]},Ye=async()=>{if(N.value)return;const t=Z.value;if(!(t!=null&&t.id))return;const a=t.id.toString(),r=Array.from(new Set(p.value)),o=De(r),v=De(m.value[a]||[]),K=!Fe(v,o),W=Array.from(new Set(P.value)),F=k.value[a]||[],J=!Fe(F,W);if(!K&&!J){ne();return}const ee=W.map(T=>{const E=A.value.find(he=>he.id===T),M=Number(T);return!E||!Number.isFinite(M)||M<=0?null:{id:M,userId:M,displayName:E.name}}).filter(Boolean);N.value=!0;try{K&&(await St({id:t.id,tagNames:o}),m.value={...m.value,[a]:r},h.value=h.value.map(T=>T.id===t.id?{...T,tagNames:o}:T)),J&&(W.length===0?await wt({businessIds:[a],businessType:"SHOP"}):await Dt({userIds:W.map(Number),businessIds:[a],businessType:"SHOP",append:!1}),k.value={...k.value,[a]:W},h.value=h.value.map(T=>T.id===t.id?{...T,managerAssigned:ee.length>0,managerList:ee}:T)),B(i("shopPage.saveSettingsSuccess"),"success"),ne()}catch(T){B(T||i("shopPage.saveSettingsFailed"),"error")}finally{N.value=!1}},Pe=g(),$e=g(),pe=g(new Set),le=t=>{Pe.value.selectEvent(t)},Ze=async t=>{if(!t.id||pe.value.has(t.id))return;const a=t.status==="ENABLED"?"DISABLED":"ENABLED";pe.value.add(t.id);try{await Ee({...t,status:a}),t.status=a,B(i("shopPage.toggleStatusSuccess"),"success")}catch(r){B(r,"error")}finally{pe.value.delete(t.id)}},et=t=>{$e.value.selectEvent(t)},tt=t=>[{label:i("shopPage.editShop"),action:()=>le(t),icon:gt,danger:!1},{label:i("shopPage.manageTagsAndOwner"),action:()=>Ke(t),icon:ft,danger:!1},{label:t.status==="ENABLED"?i("shopPage.disableShop"):i("shopPage.enableShop"),action:()=>Ze(t),icon:vt,danger:!1},...t.status==="DISABLED"?[{label:i("shopPage.deleteShop"),action:()=>et(t),icon:mt,danger:!0}]:[]];return(t,a)=>{const r=lt("vxe-pager");return l(),d("div",Ss,[s(u)?(l(),q(Pt,{key:0,title:s(i)("managementHub.authorizedShopsLabel"),"show-back":"","back-label":s(i)("shopPage.back"),"max-width":"1720"},{actions:Q(()=>[e("button",{type:"button",class:"inline-flex h-8 shrink-0 items-center justify-center gap-1.5 rounded-full bg-[#6A5CFF] px-3 text-xs font-semibold text-white transition-colors duration-200 hover:bg-[#5B4DFF] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#6A5CFF]/30 active:scale-[0.98]",onClick:a[0]||(a[0]=()=>le())},[b(s(ie),{size:"15","stroke-width":"1.8"}
1),e("span",ws,n(s(i)("shopPage.addShop")),1),e("span",Ds,n(s(i)("shopPage.add")),1)])]),_:1},8,["title","back-label"])):(l(),d("header",Fs,[e("div",Cs,[e("button",{onClick:a[1]||(a[1]=o=>t.$router.back()),class:"inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl border border-gray-200 bg-white text-gray-600 shadow-sm transition-colors duration-200 hover:border-gray-300 hover:bg-gray-50 hover:text-gray-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-400/25 active:scale-[0.98]","aria-label":s(i)("shopPage.back")},[b(s(ot),{size:"20","stroke-width":"1.6"})],8,As),e("div",Is,[e("h1",Ps,n(s(i)("shopPage.title")),1)]),e("button",{onClick:a[2]||(a[2]=()=>le()),class:"inline-flex h-10 shrink-0 items-center justify-center gap-2 rounded-2xl bg-[#6A5CFF] px-4 text-[13px] font-semibold text-white shadow-sm shadow-[#6A5CFF]/20 transition-colors duration-200 hover:bg-[#5B4DFF] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#6A5CFF]/30 active:scale-[0.98]"},[b(s(ie),{size:"16","stroke-width":"1.8"}),e("span",$s,n(s(i)("shopPage.addShop")),1),e("span",Ts,n(s(i)("shopPage.add")),1)])])])),e("main",Ls,[e("div",Bs,[e("section",Es,[e("div",Os,[e("span",zs,n(re.value.length)+" / "+n(h.value.length),1),e("div",Ns,[Y(e("select",{"onUpdate:modelValue":a[3]||(a[3]=o=>c.value=o),class:"shop-filter-select"},[e("option",Ms,n(s(i)("shopPage.allCountries")),1),(l(!0),d(L,null,U(Oe.value,o=>(l(),d("option",{key:o,value:o},n(de(o)),9,js))),128))],512),[[at,c.value]]),b(s(Te),{size:"15",class:"pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-[#687280]","stroke-width":"1.8"})]),e("div",Vs,[e("button",{type:"button",class:"shop-filter-tag-trigger",onClick:a[4]||(a[4]=ge(o=>j.value=!j.value,["stop"]))},[e("span",Us,n(Ne.value),1),b(s(Te),{size:"15","stroke-width":"1.8"})]),j.value?(l(),d("div",{key:0,class:"shop-filter-tag-menu",onClick:a[5]||(a[5]=ge(()=>{},["stop"]))},[e("button",{type:"button",class:O(["shop-filter-tag-option",_.value.length===0?"font-semibold text-[#6A5CFF]":"text-[#2D3348]"]),onClick:Re},[R(n(s(i)("shopPage.allTags"))+" ",1),_.value.length===0?(l(),q(s(fe),{key:0,size:"13","stroke-width":"2"})):y("",!0)],2),(l(!0),d(L,null,U(w.value,o=>(l(),d("button",{key:o.id,type:"button",class:O(["shop-filter-tag-option",ce(o.id)?"font-semibold text-[#6A5CFF]":"text-[#2D3348]"]),onClick:v=>Ue(o.id)},[e("span",Gs,[e("span",{class:"h-2 w-2 shrink-0 rounded-full",style:me({backgroundColor:o.color})},null,4),e("span",Hs,n(o.name),1)]),ce(o.id)?(l(),q(s(fe),{key:0,size:"13","stroke-width":"2"})):y("",!0)],10,Rs))),128)),w.value.length?y("",!0):(l(),d("div",Ks,n(s(i)("shopPage.noShopTags")),1))])):y("",!0)]),e("div",Ws,[e("button",{type:"button",class:"shop-filter-secondary",disabled:!ze.value,onClick:Ge},n(s(i)("common.reset")),9,Qs)])])]),e("section",null,[x.value&&!h.value.length?(l(),d("div",Xs,[a[12]||(a[12]=e("div",{class:"mb-4 h-10 w-10 animate-spin rounded-full border-2 border-gray-200 border-t-[#6A5CFF]"},null,-1)),e("p",qs,n(s(i)("shopPage.loading")),1)])):h.value.length?(l(),d(L,{key:2},[re.value.length===0?(l(),d("div",to,n(s(i)("shopPage.noFilteredShops")),1)):(l(),d("div",so,[(l(!0),d(L,null,U(re.value,o=>(l(),d("div",{key:o.id,class:O(["group relative flex flex-col rounded-[24px] border p-4 shadow-sm transition-all duration-200 hover:z-10 hover:-translate-y-0.5 hover:shadow-md focus-within:z-10",o.status==="DISABLED"?"border-gray-200 bg-gray-50/60 hover:border-gray-300":"border-gray-200/80 bg-white hover:border-gray-300"])},[e("div",oo,[e("div",ao,[o.openId&&o.openId.length>10?(l(),d("span",{key:0,class:"relative flex h-10 w-10 shrink-0 items-center justify-center",title:s(i)("shopPage.tiktokshopAuthorized")},[e("img",{src:s(It),alt:"TikTok Shop",class:O(["h-10 w-10 object-contain transition",o.status==="DISABLED"?"opacity-50 grayscale":""])},null,10,lo),e("span",{class:O(["absolute -bottom-0.5 -right-0.5 flex h-3.5 w-3.5 items-center justify-center rounded-full border-2 border-white text-white",o.status==="DISABLED"?"bg-gray-400":"bg-teal-500"])},[(l(),q(it(o.status==="DISABLED"?s(Le):s(rt)),{size:"10","stroke-width":"2.4"}))],2)],8,no)):(l(),d("span",{key:1,class:O(["flex h-10 w-10 shrink-0 items-center justify-center rounded-xl",o.status==="DISABLED"?"bg-gray-200/70 text-gray-400":"bg-[#6A5CFF]/10 text-[#6A5CFF]"])},[b(s(ve),{size:"20","stroke-width":"1.8"})],2)),e("div",io,[e("div",ro,[e("h4",{class:O(["line-clamp-1 break-all text-[15px] font-semibold",o.status==="DISABLED"?"text-gray-500":"text-gray-900"]),title:o.name},n(o.name),11,uo),e("span",{class:O(["inline-flex shrink-0 items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium leading-none",{"bg-emerald-50 text-emerald-700":o.status==="ENABLED","bg-gray-200 text-gray-700":o.status==="DISABLED"}])},[o.status==="DISABLED"?(l(),q(s(Le),{key:0,size:"11","stroke-width":"2.2"})):y("",!0),R(" "+n(se.value[o.status]||o.status),1)],2),o.openId&&o.openId.length>10?(l(),d("span",{key:0,class:O(["inline-flex shrink-0 items-center rounded-full px-2 py-0.5 text-[11px] font-medium leading-none",o.status==="DISABLED"?"bg-gray-100 text-gray-500":"bg-teal-50 text-teal-700"])},n(s(i)("shopPage.tiktokshopAuthorized")),3)):y("",!0)])])]),b(s(bt),{label:s(i)("shopPage.actions"),items:tt(o),icon:s(dt),position:"right",width:"sm",size:"small"},null,8,["label","items","icon"])]),e("div",co,[b(s(ut),{size:"14","stroke-width":"1.8",class:"shrink-0"}),e("span",po,n(de(o.region)),1),a[13]||(a[13]=e("span",{class:"text-gray-300"},"·",-1)),e("span",{class:"truncate font-mono text-gray-600",title:o.shopCode||"-"},n(o.shopCode||"-"),9,ho)]),e("div",go,[(l(!0),d(L,null,U(oe(o).slice(0,4),v=>(l(),d("span",{key:v.id,class:"inline-flex max-w-full items-center gap-1 rounded-full border border-gray-200 bg-gray-50 px-2 py-1 text-[11px] font-medium text-[#2D3348]"},[e("span",{class:"h-1.5 w-1.5 shrink-0 rounded-full",style:me({backgroundColor:v.color})},null,4),e("span",fo,n(v.name),1)]))),128)),oe(o).length>
14?(l(),d("span",vo," +"+n(oe(o).length-4),1)):y("",!0),oe(o).length?y("",!0):(l(),d("span",mo,n(s(i)("shopPage.noShopTags")),1))]),e("div",xo,[e("span",null,n(s(i)("shopPage.owner")),1),(l(!0),d(L,null,U(ae(o).slice(0,3),v=>(l(),d("span",{key:v.id,class:"inline-flex min-h-5 items-center justify-center rounded-full bg-[#EDF9FF] px-2 py-0.5 text-[10px] font-semibold leading-4 text-[#6A5CFF]",title:v.name},n(v.name),9,bo))),128)),ae(o).length>3?(l(),d("span",yo," +"+n(ae(o).length-3),1)):y("",!0),ae(o).length?y("",!0):(l(),d("span",_o,n(s(i)("shopPage.noOwnersSelected")),1))])],2))),128))]))],64)):(l(),d("div",Js,[e("div",Ys,[b(s(ve),{size:"28","stroke-width":"1.6"})]),e("h4",Zs,n(s(i)("shopPage.noShops")),1),e("p",eo,n(s(i)("shopPage.noShopsDesc")),1),e("button",{onClick:a[6]||(a[6]=()=>le()),class:"inline-flex h-10 items-center justify-center gap-2 rounded-2xl bg-[#6A5CFF] px-4 text-[13px] font-semibold text-white shadow-sm shadow-[#6A5CFF]/20 transition-colors duration-200 hover:bg-[#5B4DFF] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#6A5CFF]/30 active:scale-[0.98]"},[b(s(ie),{size:"16","stroke-width":"1.8"}),R(" "+n(s(i)("shopPage.addFirstShop")),1)])])),h.value.length&&C.value>I.value?(l(),d("div",ko,[b(r,{currentPage:G.value,"onUpdate:currentPage":a[7]||(a[7]=o=>G.value=o),pageSize:I.value,"onUpdate:pageSize":a[8]||(a[8]=o=>I.value=o),total:C.value,onPageChange:$},null,8,["currentPage","pageSize","total"])])):y("",!0)])])]),b(is,{ref_key:"AddShopDialogRef",ref:Pe,onUpdated:$},null,512),b(ks,{ref_key:"DeleteShopDialogRef",ref:$e,onDeleted:$},null,512),b(ye,{modelValue:X.value,"onUpdate:modelValue":a[11]||(a[11]=o=>X.value=o),title:s(i)("shopPage.manageTagsAndOwner"),onClose:ne},{footer:Q(()=>[e("div",aa,[b(Be,{variant:"secondary",onClick:ne},{default:Q(()=>[R(n(s(i)("common.cancel")),1)]),_:1}),b(Be,{variant:"primary",loading:N.value,"loading-text":s(i)("common.saving"),onClick:Ye},{default:Q(()=>[R(n(s(i)("common.save")),1)]),_:1},8,["loading","loading-text"])])]),default:Q(()=>[Z.value?(l(),d("div",So,[e("div",wo,[e("span",Do,[b(s(ve),{size:"20","stroke-width":"1.8"})]),e("div",Fo,[e("p",Co,n(Z.value.name),1),e("p",Ao,n(de(Z.value.region))+" · "+n(Z.value.shopCode||"-"),1)])]),e("section",Io,[e("div",Po,[e("div",null,[e("p",$o,n(s(i)("shopPage.shopTags")),1),e("p",To,n(s(i)("shopPage.maxTagsHint")),1)]),e("button",{type:"button",class:"text-[12px] font-medium text-[#687280] transition-colors hover:text-[#0D1321]",onClick:Qe},n(s(i)("shopPage.clearTags")),1)]),e("div",Lo,[(l(!0),d(L,null,U(w.value,o=>(l(),d("button",{key:o.id,type:"button",class:O(["shop-tag-chip",p.value.includes(o.id)?"border-[#6A5CFF]/30 bg-[#F4F2FF] text-[#0D1321]":"border-gray-200 bg-white text-[#2D3348] hover:border-gray-300 hover:bg-gray-50"]),onClick:v=>We(o.id)},[e("span",{class:"h-2 w-2 shrink-0 rounded-full",style:me({backgroundColor:o.color})},null,4),e("span",Eo,n(o.name),1),p.value.includes(o.id)?(l(),q(s(fe),{key:0,size:"13",class:"shrink-0 text-[#6A5CFF]","stroke-width":"2"})):y("",!0)],10,Bo))),128)),w.value.length?y("",!0):(l(),d("span",Oo,n(s(i)("shopPage.noShopTags")),1))]),e("div",zo,[Y(e("input",{"onUpdate:modelValue":a[9]||(a[9]=o=>D.value=o),type:"text",class:"h-9 min-w-0 flex-1 rounded-xl border border-gray-200 bg-white px-3 text-[13px] text-[#0D1321] outline-none transition-colors placeholder:text-gray-400 focus:border-[#6A5CFF]/60 focus:ring-2 focus:ring-[#6A5CFF]/15",placeholder:s(i)("shopPage.customTagPlaceholder"),onKeydown:ct(ge(Ie,["prevent"]),["enter"])},null,40,No),[[te,D.value,void 0,{trim:!0}]]),e("button",{type:"button",class:"inline-flex h-9 shrink-0 items-center gap-1.5 rounded-xl border border-gray-200 bg-white px-3 text-[13px] font-semibold text-[#2D3348] transition-colors hover:bg-gray-50 active:scale-[0.98]",onClick:Ie},[b(s(ie),{size:"15","stroke-width":"1.8"}),R(" "+n(s(i)("shopPage.addTag")),1)])])]),e("section",Mo,[e("div",jo,[e("p",Vo,n(s(i)("shopPage.shopOwner")),1),e("button",{type:"button",class:"text-[12px] font-medium text-[#687280] transition-colors hover:text-[#0D1321]",onClick:Je},n(s(i)("shopPage.clearOwners")),1)]),e("div",Uo,[(l(!0),d(L,null,U(Se.value,o=>(l(),d("button",{key:o.id,type:"button",class:"shop-owner-chip border-[#6A5CFF]/30 bg-[#F4F2FF] text-[#0D1321]",onClick:v=>qe(o.id)},[e("span",Go,n(o.name.slice(0,1)),1),e("span",Ho,n(o.name),1),b(s(pt),{size:"13",class:"shrink-0 text-[#687280]","stroke-width":"2"})],8,Ro))),128)),Se.value.length?y("",!0):(l(),d("span",Ko,n(s(i)("shopPage.noOwnersSelected")),1))]),e("div",Wo,[e("div",Qo,[b(s(ht),{size:"15",class:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-gray-400","stroke-width":"1.8"}),Y(e("input",{"onUpdate:modelValue":a[10]||(a[10]=o=>V.value=o),type:"text",class:"h-9 w-full rounded-xl border border-gray-200 bg-white pl-9 pr-3 text-[13px] text-[#0D1321] outline-none transition-colors placeholder:text-gray-400 focus:border-[#6A5CFF]/60 focus:ring-2 focus:ring-[#6A5CFF]/15",placeholder:s(i)("shopPage.ownerSearchPlaceholder"),onFocus:Ae},null,40,Xo),[[te,V.value,void 0,{trim:!0}]])]),V.value?(l(),d("div",qo,[H.value?(l(),d("div",Jo,n(s(i)("shopPage.loadingOwners")),1)):we.value.length?(l(!0),d(L,{key:1},U(we.value,o=>(l(),d("button",{key:o.id,type:"button",class:"flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-left transition-colors hover:bg-gray-50",onClick:v=>Xe(o.id)},[e("span",Zo,n(o.name.slice(0,1)),1),e("span",ea,[e("span",ta,n(o.name),1),e("span",sa,n(o.phone||o.username),1)])],8,Yo))),128)):(l(),d("div",oa,n(s(i)("shopPage.noOwnersMatched")),1))])):y("",!0)])])])):y("",!0)]),_:1},8,["modelValue","title"])])}}}),wa=xt(na,[["__scopeId","data-v-1d7fcfb8"]]);export{wa 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.