Files
Ydisks-Xianyu-Helper/internal/webui/static/assets/Rules-CMO3kj4s.js
T

2 lines
59 KiB
JavaScript

import{j as e,a as o,b as De}from"./react-vendor-l-BBvuKH.js";import{k as Be,ae as lt,af as ft,m as jt,R as Ie,N as Xe,Z as Qe,u as vt,n as Ye,I as Nt,a1 as wt,X as ke,V as Fe,y as Ce,h as kt,g as Ct,a6 as St,ag as Rt,o as He,ah as At}from"./icons-vendor-Bgrth_9N.js";import{r as v,c as N}from"./index-CiBUw4Te.js";import{o as Ae,c as Ue}from"./contract-COFcZjyb.js";import"./vendor-cRYyTeIw.js";const ze=(t,s)=>t.allowed_resolutions.includes(s),Mt=(t,s)=>({runs:t.runs.filter(l=>!s||l.cookie_id===s),pending_tasks:t.pending_tasks.filter(l=>!s||l.cookie_id===s)}),Tt=t=>({external_result_unknown:"外部动作结果未知",invalid_snapshot:"历史数据无法恢复",rule_unavailable:"规则不可用",partial_failure:"部分动作失败",execution_failed:"动作执行失败"})[t]||"自动化异常",Pt=({runs:t,pendingTasks:s,onResolveRun:l,onResolveDeferredTask:x})=>e.jsxs("section",{className:"rounded-2xl border border-red-200 bg-red-50 p-5 space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Be,{className:"w-5 h-5 text-red-600 mt-0.5"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-black text-red-900",children:"需要人工处理的自动化任务"}),e.jsx("p",{className:"text-sm text-red-700 mt-1",children:"请先在闲鱼聊天、订单或商品列表中核对真实结果,再选择继续或重试。"})]})]}),e.jsxs("div",{className:"space-y-3",children:[t.map(r=>e.jsxs("div",{className:"rounded-xl border border-red-100 bg-white p-4 flex flex-col lg:flex-row lg:items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"font-bold text-gray-900",children:["账号 ",r.cookie_id," · 订单 ",r.order_id||"-"," · 已记录发送 ",r.sent_count," 条"]}),e.jsx("div",{className:"text-xs font-bold text-red-800 mt-1",children:Tt(r.issue_kind)}),e.jsx("div",{className:"text-xs text-red-700 mt-1 break-words",children:r.error_message})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 shrink-0",children:[ze(r,"continue")&&e.jsx("button",{onClick:(()=>l(r.id,"continue")),className:"px-3 py-2 rounded-lg bg-emerald-100 text-emerald-800 text-xs font-bold",children:"已执行,继续下一步"}),ze(r,"retry")&&e.jsx("button",{onClick:(()=>l(r.id,"retry")),className:"px-3 py-2 rounded-lg bg-amber-100 text-amber-800 text-xs font-bold",children:"未执行,安全重试"}),ze(r,"cancel")&&e.jsx("button",{onClick:(()=>l(r.id,"cancel")),className:"px-3 py-2 rounded-lg bg-gray-100 text-gray-700 text-xs font-bold",children:"终止"})]})]},`run-${r.id}`)),s.map(r=>e.jsxs("div",{className:"rounded-xl border border-red-100 bg-white p-4 flex flex-col lg:flex-row lg:items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"font-bold text-gray-900",children:["账号 ",r.cookie_id," · 延迟任务重试已达 ",r.attempt_count," 次"]}),e.jsx("div",{className:"text-xs text-red-700 mt-1 break-words",children:r.error_message})]}),e.jsxs("div",{className:"flex gap-2 shrink-0",children:[e.jsx("button",{onClick:(()=>x(r.id,"retry")),className:"px-3 py-2 rounded-lg bg-amber-100 text-amber-800 text-xs font-bold",children:"重新入队"}),e.jsx("button",{onClick:(()=>x(r.id,"dismiss")),className:"px-3 py-2 rounded-lg bg-gray-100 text-gray-700 text-xs font-bold",children:"忽略"})]})]},`task-${r.id}`))]})]}),Et=async t=>v(s=>N.GET("/api/v1/accounts/details",{signal:s}),t),nt=async t=>v(s=>N.GET("/api/v1/cards",{signal:s}),t),it=async(t,s)=>v(l=>N.GET("/api/v1/items",{params:{query:{cookie_id:t}},signal:l}),s),ot=t=>t.map(s=>{var l,x;return{id:String(s.id),name:s.name||"",trigger_type:s.trigger_type||"order_paid",item_keyword:s.item_title||s.item_id||"",cookie_id:s.cookie_id||"",item_id:s.item_id||"",item_title:s.item_title||"",card_group_id:Number(((l=(s.actions||[]).find(r=>r.action_type==="send_card"))==null?void 0:l.card_id)||0),card_group_name:((x=(s.actions||[]).find(r=>r.action_type==="send_card"))==null?void 0:x.card_name)||"",priority:s.priority||100,enabled:s.enabled||!1,config_json:s.config_json||"{}",actions:(s.actions||[]).map(r=>({id:r.id?String(r.id):void 0,action_type:r.action_type,card_id:Number(r.card_id||0),card_name:r.card_name||"",delivery_count:Number(r.delivery_count||1),message_template:r.message_template||"",delay_seconds:Number(r.delay_seconds||0),config_json:r.config_json||"{}",enabled:r.enabled!==!1,sort_order:Number(r.sort_order||0)})),variants:(s.actions||[]).filter(r=>r.action_type==="send_card").map(r=>{let y={};try{y=JSON.parse(r.config_json||"{}")}catch{}return{id:r.id?String(r.id):void 0,spec_name:y.spec_name||"",spec_value:y.spec_value||"",card_id:Number(r.card_id||0),card_name:r.card_name||"",delivery_count:Number(r.delivery_count||1),enabled:r.enabled!==!1,delay_override:y.delay_override===!0,delay_seconds:Number(r.delay_seconds||0),config_json:r.config_json||"{}"}})}}),$t=async()=>{const t=await v(l=>N.GET("/api/v1/automation-rules",{signal:l})),s=Ue(t,["data","rules","items"]);return ot(s)},Lt=async({cookieId:t,triggerType:s,enabled:l,search:x,page:r=1,pageSize:y=10}={})=>{const T=await v(P=>N.GET("/api/v1/automation-rules",{params:{query:{page:r,page_size:y,cookie_id:t,trigger_type:s,enabled:l,search:x==null?void 0:x.trim()}},signal:P})),R=Ae(T,["data","result"])||{},m=ot(Ue(T,["data","rules","items"]));return{success:!0,data:m,total:Number(R.total??m.length),page:Number(R.page??r),page_size:Number(R.page_size??y),total_pages:Number(R.total_pages??(m.length?1:0)),trigger_counts:Object.fromEntries(Object.entries(R.trigger_counts||{}).map(([P,z])=>[P,Number(z)]))}},Dt=(t,s)=>{if(t!=="order_paid")return s.map((r,y)=>({...r,sort_order:r.sort_order||y+1}));const l=s.filter(r=>r.action_type==="send_card").map((r,y)=>({...r,sort_order:y+1})),x=s.filter(r=>r.action_type!=="send_card"&&r.action_type!=="confirm_shipment");return[...l,...x.map((r,y)=>({...r,sort_order:l.length+y+1})),{action_type:"confirm_shipment",enabled:!0,sort_order:l.length+x.length+1}]},et=async t=>{const s=t.trigger_type||"order_paid",x=[{order_paid:"付款后自动发货",buyer_reviewed:"评价后发送赠品",review_missing_timeout:"超时未评价求评价"}[s]||"自动化规则",t.item_title||t.item_id||t.cookie_id||""].filter(Boolean).join(" - "),r=(t.actions||[]).filter(m=>m.action_type!=="send_card"&&m.action_type!=="confirm_shipment"),y=t.variants&&t.variants.length>0?[...t.variants.map((m,P)=>({action_type:"send_card",card_id:m.card_id,delivery_count:m.delivery_count||1,enabled:m.enabled!==!1,sort_order:P+1,delay_seconds:m.delay_seconds||0,config_json:JSON.stringify({spec_name:m.spec_name||"",spec_value:m.spec_value||"",delay_override:m.delay_override===!0})})),...r]:t.actions&&t.actions.length>0?t.actions:[{action_type:"send_card",card_id:t.card_group_id||0,delivery_count:1,enabled:!0,sort_order:1}],T=Dt(s,y),R={cookie_id:t.cookie_id||"",item_id:t.item_id||"",name:(t.name||"").trim()||x||"自动化规则",trigger_type:s,enabled:t.enabled??!0,priority:t.priority||100,config_json:t.config_json||"{}",actions:T.map((m,P)=>({action_type:m.action_type,card_id:m.card_id||0,delivery_count:m.delivery_count||1,message_template:m.message_template||"",delay_seconds:m.delay_seconds||0,config_json:m.config_json||"{}",enabled:m.enabled!==!1,sort_order:m.sort_order||P+1}))};return t.id?v(m=>N.PUT("/api/v1/automation-rules/{rule_id}",{params:{path:{rule_id:String(t.id)}},body:R,signal:m})):v(m=>N.POST("/api/v1/automation-rules",{body:R,signal:m}))},It=async t=>v(s=>N.DELETE("/api/v1/automation-rules/{rule_id}",{params:{path:{rule_id:t}},signal:s})),Ft=async()=>{const t=await v(l=>N.GET("/api/v1/automation-issues",{signal:l})),s=Ae(t,["data","result"])||{};return{runs:Array.isArray(s==null?void 0:s.runs)?s.runs:[],pending_tasks:Array.isArray(s==null?void 0:s.pending_tasks)?s.pending_tasks:[]}},zt=async(t,s)=>v(l=>N.POST("/api/v1/automation-runs/{run_id}/resolve",{params:{path:{run_id:String(t)}},body:{resolution:s},signal:l})),Ot=async(t,s)=>v(l=>N.POST("/api/v1/automation-pending-tasks/{task_id}/resolve",{params:{path:{task_id:String(t)}},body:{resolution:s},signal:l})),Gt=t=>({id:String((t==null?void 0:t.id)||""),keyword:(t==null?void 0:t.keyword)||"",reply:(t==null?void 0:t.reply)||"",item_id:(t==null?void 0:t.item_id)||"",type:(t==null?void 0:t.type)==="image"?"image":"text",image_url:(t==null?void 0:t.image_url)||""}),qt=async t=>{const s=await v(l=>N.GET("/api/v1/reply-rules/{cid}/typed",{params:{path:{cid:t}},signal:l}));return Ue(s,["data","items","rules"]).map(Gt)},Vt=async t=>t?(await qt(t)).map(l=>({id:l.id,keyword:l.keyword||"",reply_content:l.reply||"",match_type:"fuzzy",enabled:!0,item_id:l.item_id||"",type:l.type==="image"?"image":"text",image_url:l.image_url||""})):[],Bt=async(t,s)=>{const l=t.type||"text",x={keyword:t.keyword||"",reply:l==="text"&&t.reply_content||"",item_id:t.item_id||"",type:l,image_url:l==="image"&&t.image_url||""};return t.id?v(r=>N.PUT("/api/v1/reply-rules/{cid}/typed/{id}",{params:{path:{cid:s,id:String(t.id)}},body:x,signal:r})):v(r=>N.POST("/api/v1/reply-rules/{cid}/items",{params:{path:{cid:s}},body:x,signal:r}))},Ut=async(t,s)=>v(l=>N.DELETE("/api/v1/reply-rules/{cid}/typed/{id}",{params:{path:{cid:s,id:t}},signal:l})),tt=async()=>{const t=await v(s=>N.GET("/api/v1/default-replies",{signal:s}));return Ae(t,["data","replies","items"])||{}},Jt=async t=>{const s=await v(x=>N.GET("/api/v1/default-replies/{cid}",{params:{path:{cid:t}},signal:x})),l=Ae(s,["data","result"])||{};return{cookie_id:t,enabled:l.enabled||!1,reply_content:l.reply_content||"",reply_once:l.reply_once||!1,reply_image_url:l.reply_image_url||""}},Kt=async(t,s)=>v(l=>N.PUT("/api/v1/default-replies/{cid}",{params:{path:{cid:t}},body:{enabled:s.enabled??!1,reply_content:s.reply_content||"",reply_once:s.reply_once??!1,reply_image_url:s.reply_image_url||""},signal:l})),Wt=async t=>v(s=>N.DELETE("/api/v1/default-replies/{cid}",{params:{path:{cid:t}},signal:s})),Zt=async t=>v(s=>N.POST("/api/v1/default-replies/{cid}/clear-records",{params:{path:{cid:t}},body:{},signal:s})),Oe=()=>({submitting:!1,result:"idle"}),Ge=t=>t.submitting?t:{submitting:!0,result:"idle"},qe=(t,s)=>({...t,submitting:!1,result:s?"success":"failure"}),at=t=>t+1,Ve=(t,s,l,x)=>t===s&&l===x,Xt=t=>{const[s,l]=o.useState([]),[x,r]=o.useState({runs:[],pending_tasks:[]}),[y,T]=o.useState([]),[R,m]=o.useState({}),[P,z]=o.useState([]),[J,C]=o.useState([]),[K,I]=o.useState([]),[w,Q]=o.useState(!1),V=o.useRef(0),le=o.useRef(0),[Y,W]=o.useState(0),[ne,H]=o.useState(0),[B,ee]=o.useState({}),Z=o.useCallback(async()=>{const L=Promise.all([Et(),nt(),it(),tt()]),[_,j,F,te]=await L;z(_),C(j),I(F),m(te),t.setSelectedAccountId(ie=>{var G;return ie||((G=_[0])==null?void 0:G.id)||""})},[t.setSelectedAccountId]),i=o.useCallback(async()=>{var te;const L=at(V.current);V.current=L;const _=Ft().catch(ie=>(console.warn("加载自动化异常列表失败,不阻断规则展示",ie),null)),j=await Lt({cookieId:t.selectedAccountId||void 0,triggerType:t.automationTriggerFilter,enabled:t.automationStatusFilter==="all"?void 0:t.automationStatusFilter==="enabled",search:t.debouncedAutomationSearch,page:t.automationPage,pageSize:t.automationPageSize});if(!Ve(L,V.current,t.selectedAccountId,t.selectedAccountId))return;l(j.data),W(j.total),H(j.total_pages),ee(j.trigger_counts||{}),j.page!==t.automationPage&&((te=t.onAutomationPageChange)==null||te.call(t,j.page));const F=await _;Ve(L,V.current,t.selectedAccountId,t.selectedAccountId)&&F&&r(F)},[t.automationPage,t.automationPageSize,t.automationStatusFilter,t.automationTriggerFilter,t.debouncedAutomationSearch,t.onAutomationPageChange,t.selectedAccountId]),E=o.useCallback(async()=>{const L=at(le.current);le.current=L;const _=t.selectedAccountId;if(T([]),!_)return;const j=await Vt(_);Ve(L,le.current,_,t.selectedAccountId)&&T(j)},[t.selectedAccountId]),M=o.useCallback(async()=>{m(await tt())},[]),O=o.useCallback(async()=>{Q(!0);try{t.activeTab==="automation"?await i():t.activeTab==="reply"?await E():await M()}finally{Q(!1)}},[i,M,E,t.activeTab]);return{automationRules:s,automationIssues:x,replyRules:y,defaultReplies:R,accounts:P,cards:J,items:K,automationTotal:Y,automationTotalPages:ne,automationTriggerCounts:B,loading:w,setLoading:Q,setAutomationRules:l,setCards:C,setItems:I,loadReferenceData:Z,loadAutomationRules:i,loadReplyRules:E,loadDefaultReplies:M,refresh:O}},re={order_paid:{label:"付款后自动发货",shortLabel:"自动发货",description:"闲鱼付款系统卡片进入自动化中心后,先发送卡密,成功后再确认发货。",flow:["付款系统卡片","匹配商品/规格","发送卡密","确认发货"],accent:"blue",icon:jt},buyer_reviewed:{label:"评价后发送赠品",shortLabel:"评价赠品",description:"闲鱼评价系统卡片进入自动化中心后,给买家发送赠品卡密。",flow:["评价系统卡片","匹配商品/规格","发送赠品"],accent:"emerald",icon:ft},review_missing_timeout:{label:"超时未评价求评价",shortLabel:"求评价",description:"计划任务扫描已发货未评价订单,到期后发送求评价文案。",flow:["计划任务扫描","已发货未评价","达到等待时间","发送提醒"],accent:"amber",icon:lt}},Se=["order_paid","buyer_reviewed","review_missing_timeout"],Qt="亲,商品使用满意的话,麻烦给个评价,谢谢~",ye=()=>({spec_name:"",spec_value:"",card_id:0,delivery_count:1,enabled:!0,delay_override:!1,delay_seconds:0}),dt=t=>{if(!t)return{};try{const s=JSON.parse(t);return s&&typeof s=="object"&&!Array.isArray(s)?s:{}}catch{return{}}},me=(t,s={})=>{const l=dt(t);return JSON.stringify({after_shipped_hours:Number(l.after_shipped_hours||72),repeat_interval_hours:Number(l.repeat_interval_hours||24),max_attempts:Number(l.max_attempts||1),...s})},_e=(t,s)=>{var x;const l=((x=re[t])==null?void 0:x.label)||"自动化规则";return s?`${l} - ${s}`:l},st=t=>{const s=(t||"").trim();return s?Object.values(re).some(l=>s===l.label||s.startsWith(`${l.label} -`)):!0},fe=(t,s=0)=>{if(t==="review_missing_timeout")return[{action_type:"send_text",message_template:Qt,enabled:!0,sort_order:1}];const l={action_type:"send_card",card_id:s,delivery_count:1,enabled:!0,sort_order:1};return t==="order_paid"?[l,{action_type:"confirm_shipment",enabled:!0,sort_order:2}]:[l]},Yt=t=>{var l,x;if(t.trigger_type==="review_missing_timeout")return((x=(l=t.actions)==null?void 0:l.find(r=>r.action_type==="send_text"))==null?void 0:x.message_template)||"发送求评价文案";const s=(t.actions||[]).filter(r=>r.action_type==="send_card");return s.length?s.map(r=>r.card_name||`卡密 ${r.card_id}`).join(" / "):"未配置卡密库存"},rt=(t,s=!1)=>{const l={blue:s?"border-blue-500 bg-blue-50 text-blue-700":"border-blue-100 bg-blue-50/60 text-blue-700 hover:border-blue-300",emerald:s?"border-emerald-500 bg-emerald-50 text-emerald-700":"border-emerald-100 bg-emerald-50/60 text-emerald-700 hover:border-emerald-300",amber:s?"border-amber-500 bg-amber-50 text-amber-700":"border-amber-100 bg-amber-50/60 text-amber-700 hover:border-amber-300"};return l[t]||l.blue},Ht=t=>t?"bg-emerald-100 text-emerald-700":"bg-gray-200 text-gray-500",Re=t=>(t==null?void 0:t.nickname)||(t==null?void 0:t.remark)||(t==null?void 0:t.id)||"未知账号",ea=t=>t===!0||t===1||t==="1",ta=({selectedAccountId:t,setSelectedAccountId:s,setActiveTab:l,items:x,setAutomationRules:r,setCards:y,setItems:T,setLoading:R,loadAutomationRules:m,loadReferenceData:P,loadReplyRules:z,loadDefaultReplies:J,initialDeliveryTarget:C,onDeliveryTargetHandled:K})=>{var ue;const[I,w]=o.useState(!1),[Q,V]=o.useState(!1),[le,Y]=o.useState(!1),[W,ne]=o.useState(Oe),[H,B]=o.useState(Oe),[ee,Z]=o.useState(Oe),[i,E]=o.useState(null),[M,O]=o.useState(null),[$,L]=o.useState({cookie_id:"",enabled:!1,reply_content:"",reply_once:!1,reply_image_url:""}),_=o.useMemo(()=>i!=null&&i.cookie_id&&i.item_id?x.find(n=>n.cookie_id===i.cookie_id&&n.item_id===i.item_id):void 0,[i==null?void 0:i.cookie_id,i==null?void 0:i.item_id,x]),j=ea(_==null?void 0:_.is_multi_spec),F=(i==null?void 0:i.trigger_type)||"order_paid",te=re[F],ie=dt(i==null?void 0:i.config_json),G=(ue=i==null?void 0:i.variants)!=null&&ue.length?i.variants:[ye()],X=o.useCallback((n="order_paid",d=t,b="")=>{const p=x.find(k=>k.cookie_id===d&&k.item_id===b),h=(p==null?void 0:p.item_title)||b;return{name:_e(n,h),trigger_type:n,cookie_id:d,item_id:b,item_title:(p==null?void 0:p.item_title)||"",item_keyword:h,card_group_id:0,priority:100,enabled:!0,config_json:n==="review_missing_timeout"?me():"{}",actions:fe(n),variants:n==="review_missing_timeout"?[]:[ye()]}},[x,t]),pe=o.useCallback(n=>{var b,p;const d=n.trigger_type||"order_paid";E({...n,trigger_type:d,config_json:d==="review_missing_timeout"?me(n.config_json):n.config_json||"{}",actions:(b=n.actions)!=null&&b.length?n.actions.map(h=>({...h})):fe(d,n.card_group_id),variants:(p=n.variants)!=null&&p.length?n.variants.map(h=>({...h})):d==="review_missing_timeout"?[]:[ye()]}),w(!0)},[]);o.useEffect(()=>{if(!C)return;let n=!1;return(async()=>{l("automation"),s(C.cookieId),R(!0);try{const[b,p,h]=await Promise.all([$t(),it(),nt().catch(f=>(console.warn("加载卡密库存失败,不阻断打开自动化规则",f),[]))]);if(n)return;r(b),T(p),y(h);const k=b.find(f=>f.cookie_id===C.cookieId&&f.item_id===C.itemId&&f.trigger_type==="order_paid");if(k)pe(k);else{const f=p.find(U=>U.cookie_id===C.cookieId&&U.item_id===C.itemId);E({...X("order_paid",C.cookieId,C.itemId),item_title:(f==null?void 0:f.item_title)||"",item_keyword:(f==null?void 0:f.item_title)||C.itemId,name:_e("order_paid",(f==null?void 0:f.item_title)||C.itemId)}),w(!0)}}catch(b){console.error("打开商品自动化规则失败",b),alert("无法加载该商品的自动化规则")}finally{n||(R(!1),K==null||K())}})(),(()=>{n=!0})},[X,C,K,pe,l,r,y,T,R,s]);const Me=o.useCallback((n="order_paid")=>{if(!t){alert("请先选择账号");return}E(X(n)),w(!0)},[X,t]),je=o.useCallback(n=>{var p,h,k,f,U;if(!i)return;const d=((h=(p=i.variants)==null?void 0:p.find(se=>se.card_id))==null?void 0:h.card_id)||((f=(k=i.actions)==null?void 0:k.find(se=>se.action_type==="send_card"))==null?void 0:f.card_id)||i.card_group_id||0,b=(_==null?void 0:_.item_title)||i.item_title||i.item_id||"";E({...i,trigger_type:n,name:st(i.name)?_e(n,b):i.name,card_group_id:d,config_json:n==="review_missing_timeout"?me(i.config_json):"{}",actions:fe(n,d),variants:n==="review_missing_timeout"?[]:(U=i.variants)!=null&&U.length?i.variants:[{...ye(),card_id:d}]})},[i,_]),Te=o.useCallback(n=>{if(!i)return;const d=x.find(p=>p.cookie_id===(i.cookie_id||t)&&p.item_id===n),b=(d==null?void 0:d.item_title)||n;E({...i,item_id:n,item_title:(d==null?void 0:d.item_title)||"",item_keyword:b,name:st(i.name)?_e(F,b):i.name})},[F,i,x,t]),ge=o.useCallback((n,d)=>{var p;if(!i)return;const b=G.map((h,k)=>k===n?{...h,...d}:h);E({...i,variants:b,card_group_id:((p=b[0])==null?void 0:p.card_id)||0})},[G,i]),Pe=o.useCallback(()=>{if(!i)return;const n=G[G.length-1];E({...i,variants:[...G,{...ye(),spec_name:j&&(n==null?void 0:n.spec_name)||"",spec_value:j&&(n==null?void 0:n.spec_value)||""}]})},[G,i,j]),ve=o.useCallback(async()=>{var h,k,f,U,se;if(!i||W.submitting)return;const n=i.trigger_type||"order_paid";if(!i.cookie_id)return alert("请选择账号");const d=(h=i.variants)!=null&&h.length?i.variants:[];if(n!=="review_missing_timeout"){if(!d.length||d.some(S=>!S.card_id))return alert(n==="buyer_reviewed"?"请选择评价赠品卡密库存":"请选择发货卡密库存");if(j&&d.some(S=>!S.spec_name.trim()||!S.spec_value.trim()))return alert("多规格商品必须填写每一行的规格名称和规格值")}if(n==="review_missing_timeout"&&!(((f=(k=i.actions)==null?void 0:k.find(Ee=>Ee.action_type==="send_text"))==null?void 0:f.message_template)||"").trim())return alert("请填写求评价文案");const b=n==="review_missing_timeout"?[]:d.map(S=>({...S,spec_name:j?S.spec_name.trim():"",spec_value:j?S.spec_value.trim():"",delivery_count:Math.max(1,Number(S.delivery_count)||1),enabled:S.enabled!==!1}));ne(Ge(W));let p=!1;try{await et({...i,trigger_type:n,name:(i.name||"").trim()||_e(n,(_==null?void 0:_.item_title)||i.item_id||""),config_json:n==="review_missing_timeout"?me(i.config_json):i.config_json||"{}",actions:(U=i.actions)!=null&&U.length?i.actions:fe(n,((se=b[0])==null?void 0:se.card_id)||i.card_group_id||0),variants:b}),w(!1),await Promise.all([m(),P()]),alert("保存成功"),p=!0}catch(S){console.error("保存自动化规则失败:",S),alert("保存失败:"+S.message)}finally{ne(S=>qe(S,p))}},[W,i,j,m,P,_]),g=o.useCallback(async n=>{if(confirm("确定删除该自动化规则吗?"))try{await It(n),await m(),alert("删除成功")}catch(d){alert("删除失败:"+d.message)}},[m]),q=o.useCallback(async n=>{try{await et({...n,enabled:!n.enabled}),await m()}catch(d){alert("操作失败:"+d.message)}},[m]),A=o.useCallback(async(n,d)=>{if(confirm(d==="continue"?"确认外部动作已经执行成功,并跳到下一步吗?":d==="retry"?"确认外部动作没有执行,可以安全重试吗?错误判断可能造成重复发送。":"确认终止该自动化运行吗?"))try{await zt(n,d),await m()}catch(p){alert("处理失败:"+p.message)}},[m]),ae=o.useCallback(async(n,d)=>{if(confirm(d==="retry"?"确认重新执行该任务吗?":"确认忽略并删除该异常任务吗?"))try{await Ot(n,d),await m()}catch(b){alert("处理失败:"+b.message)}},[m]),D=o.useCallback(()=>{if(!t)return alert("请先选择账号");O({keyword:"",reply_content:"",image_url:"",item_id:"",type:"text",match_type:"fuzzy",enabled:!0}),V(!0)},[t]),oe=o.useCallback(async()=>{var b,p,h;if(!M||!t||H.submitting)return;const n=M.type==="image"?!!((b=M.image_url)!=null&&b.trim()):!!((p=M.reply_content)!=null&&p.trim());if(!((h=M.keyword)!=null&&h.trim())||!n)return alert("请填写关键词和回复内容");B(Ge(H));let d=!1;try{await Bt({...M,match_type:"fuzzy",enabled:!0},t),V(!1),await z(),alert("保存成功"),d=!0}catch(k){alert("保存失败:"+k.message)}finally{B(k=>qe(k,d))}},[M,z,H,t]),be=o.useCallback(async n=>{if(!(!t||!confirm("确定删除该回复规则吗?")))try{await Ut(n,t),await z(),alert("删除成功")}catch(d){alert("删除失败:"+d.message)}},[z,t]),de=o.useCallback(async(n=t)=>{if(!n)return alert("请先选择账号");try{const d=await Jt(n);L({cookie_id:n,enabled:d.enabled,reply_content:d.reply_content,reply_once:d.reply_once,reply_image_url:d.reply_image_url||""})}catch{L({cookie_id:n,enabled:!1,reply_content:"",reply_once:!1,reply_image_url:""})}Y(!0)},[t]),xe=o.useCallback(async()=>{if(ee.submitting)return;if(!$.cookie_id)return alert("请先选择账号");if($.enabled&&!$.reply_content.trim()&&!$.reply_image_url.trim())return alert("启用默认回复时,请填写回复内容或图片 URL");Z(Ge(ee));let n=!1;try{await Kt($.cookie_id,{enabled:$.enabled,reply_content:$.reply_content,reply_once:$.reply_once,reply_image_url:$.reply_image_url}),Y(!1),await J(),alert("保存成功"),n=!0}catch(d){alert("保存失败:"+d.message)}finally{Z(d=>qe(d,n))}},[$,ee,J]),Ne=o.useCallback(async n=>{if(confirm("确定删除该账号默认回复吗?"))try{await Wt(n),await J(),alert("删除成功")}catch(d){alert("删除失败:"+d.message)}},[J]),he=o.useCallback(async n=>{if(confirm("确定清空该账号的默认回复记录吗?清空后可重新对所有会话使用“只回复一次”。"))try{await Zt(n),alert("清空成功")}catch(d){alert("清空失败:"+d.message)}},[]);return{showAutomationModal:I,setShowAutomationModal:w,showReplyModal:Q,setShowReplyModal:V,showDefaultModal:le,setShowDefaultModal:Y,automationSubmitState:W,replySubmitState:H,defaultReplySubmitState:ee,editingAutomationRule:i,setEditingAutomationRule:E,editingReplyRule:M,setEditingReplyRule:O,defaultForm:$,setDefaultForm:L,selectedRuleItem:_,isMultiSpecRule:j,currentTrigger:F,currentMeta:te,reviewConfig:ie,displayVariants:G,buildAutomationDraft:X,openAutomationRule:pe,openNewAutomationRule:Me,handleTriggerChange:je,handleAutomationItemChange:Te,updateVariant:ge,appendDeliveryContent:Pe,handleSaveAutomationRule:ve,handleDeleteAutomation:g,handleToggleAutomation:q,handleResolveRunIssue:A,handleResolveDeferredIssue:ae,handleAddReplyRule:D,handleSaveReplyRule:oe,handleDeleteReply:be,openDefaultReplyModal:de,handleSaveDefaultReply:xe,handleDeleteDefaultReply:Ne,handleClearDefaultReplyRecords:he}},ia=({initialDeliveryTarget:t,onDeliveryTargetHandled:s})=>{var We,Ze;const[l,x]=o.useState("automation"),[r,y]=o.useState(""),[T,R]=o.useState(""),[m,P]=o.useState(""),[z,J]=o.useState(""),[C,K]=o.useState("all"),[I,w]=o.useState(1),[Q,V]=o.useState(10),le=Xt({activeTab:l,selectedAccountId:r,automationTriggerFilter:z,automationStatusFilter:C,debouncedAutomationSearch:m,automationPage:I,automationPageSize:Q,setSelectedAccountId:y,onAutomationPageChange:w}),{automationRules:Y,automationIssues:W,replyRules:ne,defaultReplies:H,accounts:B,cards:ee,items:Z,loading:i,setLoading:E,automationTotal:M,automationTotalPages:O,automationTriggerCounts:$,setAutomationRules:L,setCards:_,setItems:j,loadReferenceData:F,loadAutomationRules:te,loadReplyRules:ie,loadDefaultReplies:G,refresh:X}=le,pe=ta({selectedAccountId:r,setSelectedAccountId:y,setActiveTab:x,items:Z,setAutomationRules:L,setCards:_,setItems:j,setLoading:E,loadAutomationRules:te,loadReferenceData:F,loadReplyRules:ie,loadDefaultReplies:G,initialDeliveryTarget:t,onDeliveryTargetHandled:s}),{showAutomationModal:Me,setShowAutomationModal:je,showReplyModal:Te,setShowReplyModal:ge,showDefaultModal:Pe,setShowDefaultModal:ve,editingAutomationRule:g,setEditingAutomationRule:q,editingReplyRule:A,setEditingReplyRule:ae,defaultForm:D,setDefaultForm:oe,selectedRuleItem:be,isMultiSpecRule:de,currentTrigger:xe,currentMeta:Ne,reviewConfig:he,displayVariants:ue,openAutomationRule:n,openNewAutomationRule:d,handleTriggerChange:b,handleAutomationItemChange:p,updateVariant:h,appendDeliveryContent:k,handleSaveAutomationRule:f,handleDeleteAutomation:U,handleToggleAutomation:se,handleResolveRunIssue:S,handleResolveDeferredIssue:Ee,handleAddReplyRule:ct,handleSaveReplyRule:mt,handleDeleteReply:xt,openDefaultReplyModal:Je,handleSaveDefaultReply:ut,handleDeleteDefaultReply:pt,handleClearDefaultReplyRecords:gt}=pe;o.useEffect(()=>{const a=window.setTimeout(()=>{w(1),P(T.trim())},300);return(()=>window.clearTimeout(a))},[T]),o.useEffect(()=>{F().catch(a=>console.error("加载规则参考数据失败",a))},[F]),o.useEffect(()=>{X().catch(a=>console.error("刷新规则页面失败",a))},[X]);const $e=o.useMemo(()=>Y.filter(a=>!r||a.cookie_id===r),[Y,r]),we=o.useMemo(()=>Mt(W,r),[W,r]),Ke=o.useMemo(()=>B.filter(a=>!r||a.id===r),[B,r]),bt=o.useMemo(()=>{if(O<=1)return[];const a=Math.max(1,Math.min(I-2,O-4)),c=Math.min(O,a+4);return Array.from({length:c-a+1},(u,ce)=>a+ce)},[I,O]),Le=!!(T.trim()||z||C!=="all"),ht=()=>{R(""),P(""),J(""),K("all"),w(1)},yt=o.useMemo(()=>{const a=(g==null?void 0:g.cookie_id)||r;return Z.filter(c=>c.cookie_id===a)},[g==null?void 0:g.cookie_id,Z,r]),_t=l==="automation"?"新建自动化":l==="reply"?"新增关键词":"编辑默认回复";return e.jsxs("div",{className:"min-w-0 space-y-8 animate-fade-in",children:[e.jsxs("div",{className:"flex flex-col xl:flex-row justify-between xl:items-end gap-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-4xl font-extrabold text-gray-900 tracking-tight",children:"自动化规则"}),e.jsx("p",{className:"text-gray-500 mt-2 font-medium",children:"系统通知卡片只进入自动化判断;买家消息进入关键词、默认或 AI 回复。"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:flex-wrap gap-3",children:[e.jsxs("select",{value:r,onChange:(a=>{y(a.target.value),w(1)}),className:"ios-input w-full px-4 py-3 rounded-2xl text-sm sm:w-64",children:[e.jsx("option",{value:"",children:"全部账号"}),B.map(a=>e.jsx("option",{value:a.id,children:Re(a)},a.id))]}),e.jsxs("button",{onClick:X,className:"px-4 py-3 rounded-2xl font-bold bg-gray-100 hover:bg-gray-200 text-gray-700 flex items-center justify-center gap-2 whitespace-nowrap transition-colors",children:[e.jsx(Ie,{className:`w-4 h-4 ${i?"animate-spin":""}`}),"刷新"]}),e.jsxs("button",{onClick:l==="automation"?(()=>d("order_paid")):l==="reply"?ct:(()=>void Je()),disabled:!r,className:"ios-btn-primary px-5 py-3 rounded-2xl text-sm font-extrabold flex items-center justify-center gap-2 whitespace-nowrap disabled:opacity-50",children:[e.jsx(Xe,{className:"w-4 h-4"}),_t]})]})]}),e.jsx("div",{className:"flex flex-wrap gap-2 p-2 bg-gray-100/50 rounded-2xl",children:[{id:"automation",label:"交易自动化",icon:Qe},{id:"reply",label:"关键词回复",icon:vt},{id:"default",label:"账号默认回复",icon:Ye}].map(a=>{const c=a.icon;return e.jsxs("button",{onClick:(()=>x(a.id)),className:`inline-flex items-center gap-2 px-5 py-2.5 rounded-xl text-sm font-bold transition-all ${l===a.id?"bg-brand text-white shadow-md":"bg-white text-gray-600 hover:text-black hover:bg-gray-50"}`,children:[e.jsx(c,{className:"w-4 h-4"}),a.label]},a.id)})}),l==="automation"&&(we.runs.length>0||we.pending_tasks.length>0)&&e.jsx(Pt,{runs:we.runs,pendingTasks:we.pending_tasks,onResolveRun:((a,c)=>void S(a,c)),onResolveDeferredTask:((a,c)=>void Ee(a,c))}),l==="automation"&&e.jsxs("div",{className:"grid min-w-0 grid-cols-1 gap-6 xl:grid-cols-[minmax(270px,0.72fr)_minmax(0,1.28fr)]",children:[e.jsxs("aside",{className:"min-w-0 space-y-4",children:[e.jsxs("div",{className:"bg-white rounded-xl p-5 border border-gray-100 shadow-sm",children:[e.jsx("h3",{className:"font-black text-gray-900 mb-1",children:"新建规则"}),e.jsx("p",{className:"text-sm text-gray-500 mb-4",children:"先选自动化类型,再配置对应动作。"}),e.jsx("div",{className:"space-y-3",children:Se.map(a=>{const c=re[a],u=c.icon;return e.jsx("button",{type:"button",onClick:(()=>d(a)),className:`w-full text-left rounded-2xl border p-4 transition-colors ${rt(c.accent)}`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-white/80 flex items-center justify-center shrink-0",children:e.jsx(u,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-extrabold",children:c.label}),e.jsx("div",{className:"text-xs opacity-75 mt-1 leading-5",children:c.description})]})]})},a)})})]}),e.jsxs("div",{className:"bg-white rounded-xl p-5 border border-gray-100 shadow-sm",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between gap-3",children:[e.jsx("h3",{className:"font-black text-gray-900",children:"筛选结果构成"}),e.jsxs("span",{className:"text-xs font-bold text-gray-400",children:["共 ",M," 条"]})]}),e.jsx("div",{className:"space-y-3",children:Se.map(a=>{const c=re[a],u=c.icon;return e.jsxs("div",{className:"flex items-center justify-between rounded-2xl bg-gray-50 p-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(u,{className:"w-4 h-4 text-gray-500"}),e.jsx("span",{className:"text-sm font-bold text-gray-700",children:c.shortLabel})]}),e.jsx("span",{className:"text-sm font-black text-gray-900",children:$[a]||0})]},a)})})]})]}),e.jsxs("section",{className:"min-w-0 space-y-4",children:[e.jsxs("div",{className:"rounded-xl border border-gray-100 bg-surface-muted p-4 shadow-sm",children:[e.jsxs("div",{className:"flex flex-col gap-3 xl:flex-row xl:items-center",children:[e.jsxs("div",{className:"relative min-w-0 flex-1",children:[e.jsx(Nt,{className:"pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400"}),e.jsx("input",{type:"search","aria-label":"搜索自动化规则",placeholder:"搜索规则名、商品名或商品 ID...",value:T,onChange:(a=>{R(a.target.value),w(1)}),className:"ios-input w-full rounded-xl border-none bg-white py-2.5 pl-10 pr-4 text-sm shadow-sm"})]}),e.jsxs("div",{className:"relative xl:w-52",children:[e.jsx(wt,{className:"pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400"}),e.jsxs("select",{"aria-label":"按自动化类型筛选",value:z,onChange:(a=>{J(a.target.value),w(1)}),className:"ios-input w-full rounded-xl border-none bg-white py-2.5 pl-10 pr-9 text-sm shadow-sm",children:[e.jsx("option",{value:"",children:"全部自动化类型"}),Se.map(a=>e.jsx("option",{value:a,children:re[a].shortLabel},a))]})]}),e.jsxs("select",{"aria-label":"按启用状态筛选",value:C,onChange:(a=>{K(a.target.value),w(1)}),className:"ios-input rounded-xl border-none bg-white px-4 py-2.5 text-sm shadow-sm xl:w-36",children:[e.jsx("option",{value:"all",children:"全部状态"}),e.jsx("option",{value:"enabled",children:"已启用"}),e.jsx("option",{value:"disabled",children:"已禁用"})]}),Le&&e.jsx("button",{type:"button",onClick:ht,className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-white text-gray-500 shadow-sm transition-colors hover:bg-gray-100 hover:text-gray-900",title:"清除筛选","aria-label":"清除筛选",children:e.jsx(ke,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"mt-3 flex items-center justify-between text-xs font-bold text-gray-400",children:[e.jsxs("span",{children:["找到 ",M," 条规则"]}),i&&e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(Ie,{className:"h-3.5 w-3.5 animate-spin"}),"正在更新"]})]})]}),i&&$e.length===0?e.jsxs("div",{className:"flex min-h-56 items-center justify-center rounded-xl border border-gray-100 bg-white text-sm font-bold text-gray-400",children:[e.jsx(Ie,{className:"mr-2 h-4 w-4 animate-spin"}),"正在加载规则"]}):$e.length===0?e.jsxs("div",{className:"bg-white rounded-xl border border-dashed border-gray-200 p-16 text-center",children:[e.jsx(Qe,{className:"w-12 h-12 text-gray-300 mx-auto mb-4"}),e.jsx("h3",{className:"text-xl font-black text-gray-900",children:Le?"没有匹配的自动化规则":"还没有自动化规则"}),e.jsx("p",{className:"text-gray-500 mt-2",children:Le?"调整或清除筛选条件后再试。":"从左侧选择一个模板开始配置。"})]}):$e.map(a=>{const c=re[a.trigger_type],u=c.icon;return e.jsx("article",{className:"bg-white rounded-xl border border-gray-100 p-5 shadow-sm hover:shadow-lg transition-all",children:e.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-4 min-w-0",children:[e.jsx("div",{className:`w-12 h-12 rounded-2xl flex items-center justify-center shrink-0 ${rt(c.accent,!0)}`,children:e.jsx(u,{className:"w-5 h-5"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:[e.jsx("h3",{className:"text-lg font-black text-gray-900 truncate",children:a.name}),e.jsx("span",{className:`px-2.5 py-1 rounded-full text-xs font-bold ${Ht(a.enabled)}`,children:a.enabled?"已启用":"已禁用"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 text-xs font-bold",children:[e.jsx("span",{className:"px-2.5 py-1 rounded-lg bg-gray-100 text-gray-600",children:c.label}),e.jsx("span",{className:"px-2.5 py-1 rounded-lg bg-gray-100 text-gray-600",children:a.item_title||a.item_id||"账号级规则"}),e.jsx("span",{className:"px-2.5 py-1 rounded-lg bg-blue-50 text-blue-700",children:Yt(a)})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs("button",{onClick:(()=>n(a)),className:"px-4 py-2 rounded-xl bg-gray-100 hover:bg-gray-200 text-gray-700 text-sm font-bold flex items-center gap-2",children:[e.jsx(Fe,{className:"w-4 h-4"}),"编辑"]}),e.jsx("button",{onClick:(()=>se(a)),className:`px-4 py-2 rounded-xl text-sm font-bold ${a.enabled?"bg-amber-50 text-amber-700 hover:bg-amber-100":"bg-emerald-50 text-emerald-700 hover:bg-emerald-100"}`,children:a.enabled?"禁用":"启用"}),e.jsx("button",{onClick:(()=>U(a.id)),className:"p-2.5 rounded-xl text-red-500 hover:bg-red-50",title:"删除",children:e.jsx(Ce,{className:"w-4 h-4"})})]})]})},a.id)}),M>0&&e.jsxs("div",{className:"flex flex-col gap-3 rounded-xl border border-gray-100 bg-white px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 text-sm font-medium text-gray-500",children:[e.jsxs("span",{children:["第 ",I," / ",Math.max(O,1)," 页"]}),e.jsx("span",{className:"h-4 w-px bg-gray-200"}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"sr-only",children:"每页显示数量"}),e.jsx("select",{value:Q,onChange:(a=>{V(Number(a.target.value)),w(1)}),className:"ios-input rounded-lg border-none bg-gray-50 px-2.5 py-2 text-sm",children:[10,20,50].map(a=>e.jsxs("option",{value:a,children:[a," 条/页"]},a))})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("button",{type:"button",disabled:I<=1||i,onClick:(()=>w(a=>Math.max(1,a-1))),className:"flex h-9 w-9 items-center justify-center rounded-lg bg-gray-50 text-gray-600 transition-colors hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-40","aria-label":"上一页",title:"上一页",children:e.jsx(kt,{className:"h-4 w-4"})}),bt.map(a=>e.jsx("button",{type:"button",disabled:i,onClick:(()=>w(a)),className:`h-9 min-w-9 rounded-lg px-2 text-sm font-bold transition-colors ${a===I?"bg-brand text-white":"bg-gray-50 text-gray-600 hover:bg-gray-100"} disabled:cursor-not-allowed disabled:opacity-60`,"aria-label":`第 ${a} 页`,"aria-current":a===I?"page":void 0,children:a},a)),e.jsx("button",{type:"button",disabled:I>=O||i,onClick:(()=>w(a=>Math.min(O,a+1))),className:"flex h-9 w-9 items-center justify-center rounded-lg bg-gray-50 text-gray-600 transition-colors hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-40","aria-label":"下一页",title:"下一页",children:e.jsx(Ct,{className:"h-4 w-4"})})]})]})]})]}),l==="reply"&&e.jsxs("section",{className:"bg-white rounded-xl border border-gray-100 p-6 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-blue-700 bg-blue-50 px-4 py-2 rounded-xl mb-5 w-fit",children:[e.jsx(Be,{className:"w-4 h-4"}),"这里只处理买家用户消息;系统通知不会进入关键词或 AI 回复。"]}),e.jsxs("div",{className:"space-y-3",children:[ne.map(a=>e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between p-5 rounded-2xl border border-gray-100 bg-surface-subtle hover:bg-white hover:shadow-lg transition-all gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("span",{className:"px-3 py-1 bg-black text-white rounded-lg text-xs font-bold",children:"包含匹配"}),e.jsxs("h3",{className:"font-bold text-gray-900",children:["“",a.keyword,"”"]})]}),e.jsx("div",{className:"bg-white p-3 rounded-xl border border-gray-100 text-sm text-gray-600 leading-relaxed",children:a.type==="image"&&a.image_url?a.image_url:a.reply_content})]}),e.jsxs("div",{className:"flex items-center gap-3 border-t md:border-t-0 md:border-l border-gray-200 pt-4 md:pt-0 md:pl-6",children:[e.jsx("button",{onClick:(()=>{ae({...a}),ge(!0)}),className:"p-2 text-gray-400 hover:text-black hover:bg-gray-100 rounded-xl transition-colors",title:"编辑",children:e.jsx(Fe,{className:"w-4 h-4"})}),e.jsx("button",{onClick:(()=>xt(a.id)),className:"p-2 text-gray-400 hover:text-red-500 hover:bg-red-50 rounded-xl transition-colors",title:"删除",children:e.jsx(Ce,{className:"w-5 h-5"})})]})]},a.id)),ne.length===0&&e.jsx("div",{className:"text-center py-20 text-gray-400",children:"暂无关键词回复规则"})]})]}),l==="default"&&e.jsxs("section",{className:"bg-white rounded-xl border border-gray-100 p-6 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-blue-700 bg-blue-50 px-4 py-2 rounded-xl mb-5 w-fit",children:[e.jsx(Be,{className:"w-4 h-4"}),"默认回复只处理买家用户消息;关键词未命中且 AI 未接管时才会使用。"]}),e.jsxs("div",{className:"space-y-3",children:[Ke.map(a=>{const c=H[a.id],u=!!(c!=null&&c.enabled);return e.jsxs("div",{className:`flex flex-col md:flex-row md:items-center justify-between p-5 rounded-2xl border transition-all gap-4 ${u?"border-purple-100 bg-purple-50/50 hover:bg-white hover:shadow-lg":"border-gray-100 bg-surface-subtle hover:bg-white hover:shadow-lg"}`,children:[e.jsxs("div",{className:"flex items-center gap-4 min-w-0",children:[e.jsx("div",{className:`w-12 h-12 rounded-2xl flex items-center justify-center ${u?"bg-purple-600 text-white":"bg-gray-200 text-gray-400"}`,children:e.jsx(Ye,{className:"w-5 h-5"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("h3",{className:"font-bold text-gray-900 text-lg truncate",children:Re(a)}),e.jsx("span",{className:`px-2 py-0.5 rounded-lg text-xs font-bold ${u?"bg-green-100 text-green-700":"bg-gray-200 text-gray-500"}`,children:u?"已启用":"未启用"}),(c==null?void 0:c.reply_once)&&e.jsx("span",{className:"px-2 py-0.5 rounded-lg text-xs font-bold bg-purple-100 text-purple-700",children:"只回复一次"})]}),e.jsx("div",{className:"text-sm text-gray-600 line-clamp-2",children:u?c.reply_content||c.reply_image_url||"已配置默认回复":"未配置默认回复"})]})]}),e.jsxs("div",{className:"flex items-center gap-3 border-t md:border-t-0 md:border-l border-gray-200 pt-4 md:pt-0 md:pl-6",children:[e.jsx("button",{onClick:(()=>void Je(a.id)),className:"p-2 text-gray-400 hover:text-black hover:bg-gray-100 rounded-xl transition-colors",title:"编辑",children:e.jsx(Fe,{className:"w-4 h-4"})}),u&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:(()=>void gt(a.id)),className:"px-3 py-2 text-xs font-bold text-blue-600 hover:bg-blue-50 rounded-xl transition-colors",children:"清空记录"}),e.jsx("button",{onClick:(()=>void pt(a.id)),className:"p-2 text-gray-400 hover:text-red-500 hover:bg-red-50 rounded-xl transition-colors",title:"删除",children:e.jsx(Ce,{className:"w-5 h-5"})})]})]})]},a.id)}),Ke.length===0&&e.jsx("div",{className:"text-center py-20 text-gray-400",children:"暂无账号"})]})]}),Me&&g&&De.createPortal(e.jsx("div",{className:"modal-overlay",children:e.jsxs("div",{className:"modal-container",style:{maxWidth:"72rem",maxHeight:"92vh"},children:[e.jsxs("div",{className:"px-6 py-5 border-b border-gray-100 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-2xl font-black text-gray-900",children:g.id?"编辑自动化规则":"新建自动化规则"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:Ne.description})]}),e.jsx("button",{onClick:(()=>je(!1)),className:"w-10 h-10 rounded-2xl bg-gray-100 hover:bg-gray-200 flex items-center justify-center",title:"关闭",children:e.jsx(ke,{className:"w-5 h-5 text-gray-600"})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[320px_1fr] min-h-0",children:[e.jsxs("aside",{className:"bg-slate-900 text-white p-5 overflow-y-auto",children:[e.jsx("div",{className:"text-xs font-bold text-slate-400 mb-3",children:"选择自动化类型"}),e.jsx("div",{className:"space-y-3",children:Se.map(a=>{const c=re[a],u=c.icon,ce=xe===a;return e.jsx("button",{type:"button",onClick:(()=>b(a)),className:`w-full rounded-2xl p-4 text-left border transition-all ${ce?"bg-white text-slate-950 border-white":"bg-white/5 text-white border-white/10 hover:bg-white/10"}`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(u,{className:`w-5 h-5 mt-0.5 ${ce?"text-brand":"text-white"}`}),e.jsxs("div",{children:[e.jsx("div",{className:"font-black",children:c.label}),e.jsx("div",{className:`text-xs mt-1 leading-5 ${ce?"text-gray-500":"text-gray-400"}`,children:c.description})]})]})},a)})}),e.jsxs("div",{className:"mt-6 rounded-2xl bg-white/5 border border-white/10 p-4",children:[e.jsx("div",{className:"text-xs font-bold text-slate-400 mb-3",children:"执行流程"}),e.jsx("div",{className:"space-y-3",children:Ne.flow.map((a,c)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-6 h-6 rounded-full bg-white text-slate-950 text-xs font-black flex items-center justify-center",children:c+1}),e.jsx("span",{className:"text-sm font-bold text-gray-100",children:a})]},a))})]})]}),e.jsx("div",{className:"p-6 overflow-y-auto bg-surface-subtle",children:e.jsxs("div",{className:"space-y-5",children:[e.jsxs("section",{className:"bg-white rounded-3xl border border-gray-100 p-5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(St,{className:"w-5 h-5 text-brand"}),e.jsx("h4",{className:"font-black text-gray-900",children:"生效范围"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"规则名称"}),e.jsx("input",{type:"text",value:g.name||"",onChange:(a=>q({...g,name:a.target.value})),placeholder:"不填时按类型和商品自动生成",className:"w-full ios-input px-4 py-3 rounded-xl"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"闲鱼账号"}),e.jsxs("select",{value:g.cookie_id||"",onChange:(a=>q({...g,cookie_id:a.target.value,item_id:"",item_title:"",item_keyword:""})),className:"w-full ios-input px-4 py-3 rounded-xl",children:[e.jsx("option",{value:"",children:"选择账号"}),B.map(a=>e.jsx("option",{value:a.id,children:Re(a)},a.id))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"关联商品"}),e.jsxs("select",{value:g.item_id||"",onChange:(a=>p(a.target.value)),className:"w-full ios-input px-4 py-3 rounded-xl",children:[e.jsx("option",{value:"",children:"账号级规则(不限定商品)"}),yt.map(a=>e.jsx("option",{value:a.item_id,children:a.item_title||a.item_id},`${a.cookie_id}-${a.item_id}`))]})]})]}),be&&xe!=="review_missing_timeout"&&e.jsxs("div",{className:"mt-4 rounded-2xl bg-gray-50 border border-gray-100 p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:[e.jsx("span",{className:"px-3 py-1.5 rounded-lg bg-gray-100 text-gray-700 text-xs font-bold",children:be.item_title||be.item_id}),e.jsx("span",{className:`px-3 py-1.5 rounded-lg text-xs font-bold ${de?"bg-blue-50 text-blue-700":"bg-gray-100 text-gray-500"}`,children:de?"多规格商品":"普通商品"}),e.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs font-bold bg-emerald-50 text-emerald-700",children:"按订单购买数量自动发货"})]}),e.jsx("p",{className:"text-xs leading-5 text-gray-500",children:"多规格状态来自闲鱼商品本身,发布后不能在这里修改;系统会在买家付款后读取订单详情,按实际购买规格和数量匹配下面的发货规则。"})]})]}),xe!=="review_missing_timeout"?e.jsxs("section",{className:"bg-white rounded-3xl border border-gray-100 p-5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 mb-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Rt,{className:"w-5 h-5 text-brand"}),e.jsx("h4",{className:"font-black text-gray-900",children:xe==="buyer_reviewed"?"赠品库存":"发货库存"})]}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:de?"每条发货内容绑定一个订单规格;同一规格可添加多条内容并全部发送。":"可添加多条发货内容,买家付款后会按顺序全部发送。"})]}),e.jsxs("button",{type:"button",onClick:k,className:"px-3 py-2 rounded-xl bg-gray-900 text-white text-xs font-bold hover:bg-black flex items-center gap-1.5",children:[e.jsx(Xe,{className:"w-3.5 h-3.5"}),"添加发货内容"]})]}),e.jsx("div",{className:"space-y-3",children:ue.map((a,c)=>e.jsxs("div",{className:`grid grid-cols-1 gap-3 items-end rounded-2xl border border-gray-200 p-4 ${de?"md:grid-cols-[1fr_1fr_1.4fr_110px_40px]":"md:grid-cols-[1.4fr_110px_40px]"}`,children:[de&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-gray-600 mb-2",children:"规格名称"}),e.jsx("input",{value:a.spec_name,onChange:(u=>h(c,{spec_name:u.target.value})),className:"w-full ios-input px-3 py-2.5 rounded-lg",placeholder:"例如:套餐"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-gray-600 mb-2",children:"规格值"}),e.jsx("input",{value:a.spec_value,onChange:(u=>h(c,{spec_value:u.target.value})),className:"w-full ios-input px-3 py-2.5 rounded-lg",placeholder:"例如:30天"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-gray-600 mb-2",children:"卡密库存"}),e.jsxs("select",{value:a.card_id||"",onChange:(u=>h(c,{card_id:Number(u.target.value)})),className:"w-full ios-input px-3 py-2.5 rounded-lg",children:[e.jsx("option",{value:"",children:"请选择卡密库存"}),ee.filter(u=>u.enabled&&u.type!=="api").map(u=>e.jsx("option",{value:u.id,children:u.name},u.id))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-gray-600 mb-2",children:"每件份数"}),e.jsx("input",{type:"number",min:"1",max:"100",value:a.delivery_count,onChange:(u=>h(c,{delivery_count:Math.max(1,Number(u.target.value)||1)})),className:"w-full ios-input px-3 py-2.5 rounded-lg"})]}),e.jsxs("div",{className:"md:col-span-full flex flex-wrap items-center gap-3 rounded-xl bg-gray-50 px-3 py-2",children:[e.jsxs("label",{className:"flex items-center gap-2 text-xs font-bold text-gray-600 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:a.delay_override===!0,onChange:(u=>h(c,{delay_override:u.target.checked})),className:"accent-brand"}),"覆盖卡密默认延时"]}),a.delay_override&&e.jsx("input",{type:"number",min:"0",max:"3600",value:a.delay_seconds||0,onChange:(u=>h(c,{delay_seconds:Math.max(0,Number(u.target.value)||0)})),className:"w-28 ios-input px-2 py-1.5 rounded-lg text-xs","aria-label":"动作延时秒数"}),e.jsx("span",{className:"text-xs text-gray-500",children:a.delay_override?`本动作延时 ${a.delay_seconds||0} 秒`:"使用卡密默认延时"})]}),e.jsx("button",{type:"button",disabled:ue.length===1,onClick:(()=>q({...g,variants:ue.filter((u,ce)=>ce!==c)})),className:"w-10 h-10 flex items-center justify-center rounded-lg text-red-500 hover:bg-red-50 disabled:opacity-25",title:"删除发货内容",children:e.jsx(Ce,{className:"w-4 h-4"})})]},a.id||c))})]}):e.jsxs("section",{className:"bg-white rounded-3xl border border-gray-100 p-5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(lt,{className:"w-5 h-5 text-amber-600"}),e.jsx("h4",{className:"font-black text-gray-900",children:"求评价计划"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"发货后等待小时"}),e.jsx("input",{type:"number",min:"1",value:Number(he.after_shipped_hours||72),onChange:(a=>q({...g,config_json:me(g.config_json,{after_shipped_hours:Math.max(1,Number(a.target.value)||72)})})),className:"w-full ios-input px-4 py-3 rounded-xl"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"再次求评间隔小时"}),e.jsx("input",{type:"number",min:"1",value:Number(he.repeat_interval_hours||24),onChange:(a=>q({...g,config_json:me(g.config_json,{repeat_interval_hours:Math.max(1,Number(a.target.value)||24)})})),className:"w-full ios-input px-4 py-3 rounded-xl"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"最多求评次数"}),e.jsx("input",{type:"number",min:"1",value:Number(he.max_attempts||1),onChange:(a=>q({...g,config_json:me(g.config_json,{max_attempts:Math.max(1,Number(a.target.value)||1)})})),className:"w-full ios-input px-4 py-3 rounded-xl"})]}),e.jsxs("div",{className:"md:col-span-3",children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"求评价文案"}),e.jsx("textarea",{value:((Ze=(We=g.actions)==null?void 0:We.find(a=>a.action_type==="send_text"))==null?void 0:Ze.message_template)||"",onChange:(a=>{var c;return q({...g,actions:((c=g.actions)!=null&&c.length?g.actions:fe("review_missing_timeout")).map(u=>u.action_type==="send_text"?{...u,message_template:a.target.value}:u)})}),className:"w-full ios-input px-4 py-3 rounded-xl h-28 resize-none"})]})]})]}),e.jsx("section",{className:"bg-white rounded-3xl border border-gray-100 p-5",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] gap-4 items-end",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"优先级"}),e.jsx("p",{className:"text-xs text-gray-500 mb-2",children:"数字越小优先级越高;同一账号、商品和触发条件只执行优先级最高的一条规则。"}),e.jsx("input",{type:"number",value:g.priority||100,onChange:(a=>q({...g,priority:Number(a.target.value)||100})),min:"1",className:"w-full ios-input px-4 py-3 rounded-xl"})]}),e.jsxs("label",{className:"h-[48px] flex items-center gap-3 px-4 bg-gray-50 rounded-xl text-sm font-bold text-gray-800",children:[e.jsx("input",{type:"checkbox",checked:g.enabled!==!1,onChange:(a=>q({...g,enabled:a.target.checked})),className:"w-4 h-4 rounded"}),"启用规则"]})]})})]})})]}),e.jsxs("div",{className:"px-6 py-4 border-t border-gray-100 bg-white flex gap-3",children:[e.jsx("button",{onClick:(()=>je(!1)),className:"flex-1 px-6 py-3 rounded-2xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200",children:"取消"}),e.jsxs("button",{onClick:f,className:"flex-1 ios-btn-primary px-6 py-3 rounded-2xl font-bold flex items-center justify-center gap-2",children:[e.jsx(He,{className:"w-4 h-4"}),"保存自动化规则"]})]})]})}),document.body),Te&&A&&De.createPortal(e.jsx("div",{className:"modal-overlay",children:e.jsxs("div",{className:"modal-container",children:[e.jsx("div",{className:"modal-header",children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:A.id?"编辑回复规则":"新增回复规则"}),e.jsx("button",{onClick:(()=>ge(!1)),className:"p-2 bg-gray-100 rounded-full hover:bg-gray-200 transition-colors",children:e.jsx(ke,{className:"w-5 h-5 text-gray-600"})})]})}),e.jsxs("div",{className:"modal-body space-y-5",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"关联商品"}),e.jsxs("select",{value:A.item_id||"",onChange:(a=>ae({...A,item_id:a.target.value})),className:"w-full ios-input px-4 py-3 rounded-xl",children:[e.jsx("option",{value:"",children:"账号级回复"}),Z.filter(a=>!r||a.cookie_id===r).map(a=>e.jsx("option",{value:a.item_id,children:a.item_title||a.item_id},`${a.cookie_id}-${a.item_id}`))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"回复类型"}),e.jsxs("select",{value:A.type||"text",onChange:(a=>{const c=a.target.value;ae({...A,type:c,reply_content:c==="text"?A.reply_content:"",image_url:c==="image"?A.image_url:""})}),className:"w-full ios-input px-4 py-3 rounded-xl",children:[e.jsx("option",{value:"text",children:"文字"}),e.jsx("option",{value:"image",children:"图片"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"关键词"}),e.jsx("input",{type:"text",value:A.keyword||"",onChange:(a=>ae({...A,keyword:a.target.value})),placeholder:"买家发送的关键词",className:"w-full ios-input px-4 py-3 rounded-xl"})]}),A.type==="image"?e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"图片 URL"}),e.jsx("input",{value:A.image_url||"",onChange:(a=>ae({...A,image_url:a.target.value})),placeholder:"https://...",className:"w-full ios-input px-4 py-3 rounded-xl"})]}):e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"回复内容"}),e.jsx("textarea",{value:A.reply_content||"",onChange:(a=>ae({...A,reply_content:a.target.value})),placeholder:"自动回复的内容",className:"w-full ios-input px-4 py-3 rounded-xl h-32 resize-none"})]}),e.jsxs("div",{className:"flex gap-3 pt-4",children:[e.jsx("button",{onClick:(()=>ge(!1)),className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",children:"取消"}),e.jsxs("button",{onClick:mt,className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",children:[e.jsx(At,{className:"w-4 h-4"}),"保存规则"]})]})]})]})}),document.body),Pe&&De.createPortal(e.jsx("div",{className:"modal-overlay",children:e.jsxs("div",{className:"modal-container",children:[e.jsx("div",{className:"modal-header",children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-2xl font-extrabold text-gray-900",children:"账号默认回复"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"关键词和 AI 都未处理时,才会使用默认回复。"})]}),e.jsx("button",{onClick:(()=>ve(!1)),className:"p-2 bg-gray-100 rounded-full hover:bg-gray-200 transition-colors",title:"关闭",children:e.jsx(ke,{className:"w-5 h-5 text-gray-600"})})]})}),e.jsxs("div",{className:"modal-body space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"闲鱼账号"}),e.jsxs("select",{value:D.cookie_id,onChange:(a=>oe({...D,cookie_id:a.target.value})),className:"w-full ios-input px-4 py-3 rounded-xl",children:[e.jsx("option",{value:"",children:"选择账号"}),B.map(a=>e.jsx("option",{value:a.id,children:Re(a)},a.id))]})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50 rounded-xl",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-bold text-gray-900",children:"启用默认回复"}),e.jsx("div",{className:"text-xs text-gray-500 mt-1",children:"启用后,未命中关键词时自动发送"})]}),e.jsx("button",{type:"button",onClick:(()=>oe({...D,enabled:!D.enabled})),className:`w-14 h-8 rounded-full transition-colors duration-300 relative ${D.enabled?"bg-brand":"bg-gray-300"}`,children:e.jsx("span",{className:`absolute top-1 w-6 h-6 bg-white rounded-full shadow-md transition-transform duration-300 block ${D.enabled?"translate-x-7":"translate-x-1"}`})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"回复内容"}),e.jsx("textarea",{value:D.reply_content,onChange:(a=>oe({...D,reply_content:a.target.value})),placeholder:"输入默认回复内容",className:"w-full ios-input px-4 py-3 rounded-xl h-32 resize-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"回复图片 URL(可选)"}),e.jsx("input",{type:"text",value:D.reply_image_url,onChange:(a=>oe({...D,reply_image_url:a.target.value})),placeholder:"https://example.com/image.jpg",className:"w-full ios-input px-4 py-3 rounded-xl"})]}),e.jsxs("label",{className:"flex items-center justify-between p-4 bg-gray-50 rounded-xl text-sm font-bold text-gray-800",children:[e.jsxs("span",{children:["只回复一次",e.jsx("span",{className:"block text-xs text-gray-500 font-medium mt-1",children:"同一会话只发送一次默认回复"})]}),e.jsx("input",{type:"checkbox",checked:D.reply_once,onChange:(a=>oe({...D,reply_once:a.target.checked})),className:"w-4 h-4 rounded"})]}),e.jsxs("div",{className:"flex gap-3 pt-4",children:[e.jsx("button",{onClick:(()=>ve(!1)),className:"flex-1 px-6 py-3 rounded-xl font-bold bg-gray-100 text-gray-700 hover:bg-gray-200 transition-colors",children:"取消"}),e.jsxs("button",{onClick:ut,className:"flex-1 ios-btn-primary px-6 py-3 rounded-xl font-bold flex items-center justify-center gap-2",children:[e.jsx(He,{className:"w-4 h-4"}),"保存默认回复"]})]})]})]})}),document.body)]})};export{ia as default};