3 lines
41 KiB
JavaScript
3 lines
41 KiB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-BjrV0BPa.js","assets/react-vendor-C_od1ZSF.js","assets/dateTime-DDi7rqpW.js","assets/icons-vendor-ThcsWkZG.js","assets/charts-vendor-BxxJOyEX.js","assets/vendor-D-Edl3pr.js","assets/AccountList-CMeDGrpw.js","assets/OrderList-DCxOUz7n.js","assets/CardList-CV-IXa79.js","assets/ItemList-DX-qMjnd.js","assets/Settings-j3SwRFCx.js","assets/Rules-D884-CgU.js","assets/Notifications-D65tIfCl.js","assets/Chat-ChmGl-XK.js"])))=>i.map(i=>d[i]);
|
|
import{j as n,r as p,c as ee,d as xe}from"./react-vendor-C_od1ZSF.js";import{L as we,U as je,M as Le,C as Ne,B as Se,S as ke,Z as Ce,a as Ae,b as Ee,G as Z,c as $e,d as De,e as Ie,f as D,g as H,h as I,A as G,i as Oe}from"./icons-vendor-ThcsWkZG.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function s(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(a){if(a.ep)return;a.ep=!0;const i=s(a);fetch(a.href,i)}})();const te="ydisks.sidebar.v1",Te=()=>{try{return window.localStorage.getItem(te)==="collapsed"}catch{return!1}},Pe=e=>{try{window.localStorage.setItem(te,e?"collapsed":"expanded")}catch{}},Re=({className:e="w-full h-full text-white"})=>n.jsx("svg",{className:e,viewBox:"0 0 256 256","aria-hidden":"true",children:n.jsx("g",{stroke:"none",fill:"none",fillRule:"evenodd",children:n.jsx("path",{d:"M121.73,57.0003 C138.901,57.0003 154.897,65.5053 164.52,79.7493 C166.029,81.9823 165.441,85.0143 163.209,86.5233 C160.976,88.0323 157.944,87.4433 156.436,85.2113 C148.629,73.6553 135.655,66.7563 121.73,66.7563 C104.076789,66.7563 88.6201962,77.6596007 82.5581814,93.8184545 C83.9120803,93.7133631 85.2800264,93.66 86.6602,93.66 C111.537727,93.66 132.442611,110.997575 137.926382,134.224255 L162.5425,92.109 L162.615557,91.9879406 L162.756884,91.77367 L162.911804,91.5639102 L162.98657,91.4716759 C163.351845,91.025169 163.786059,90.6571744 164.264191,90.3738733 L164.550153,90.2178351 L164.729252,90.1315693 L164.989203,90.021723 L165.230265,89.9354653 L165.542393,89.8445739 C165.666021,89.8126706 165.790834,89.7857324 165.916565,89.7637431 L166.116517,89.7342499 C166.29505,89.7098142 166.475001,89.6957386 166.655596,89.6918808 L166.7539,89.693 C196.8909,89.693 221.4079,114.21 221.4079,144.347 C221.4079,174.482 196.8909,199 166.7539,199 L125.0869,199 C122.3919,199 120.2079,196.815 120.2079,194.122 C120.2079,191.429 122.3919,189.244 125.0869,189.244 L166.7539,189.244 C191.5109,189.244 211.6519,169.104 211.6519,144.347 C211.6519,120.513406 192.985349,100.957891 169.504046,99.5322548 L112.7745,196.584 C111.8995,198.08 110.2965,199 108.5635,199 L86.6602,199 C57.6182,199 33.9902,175.373 33.9902,146.33 C33.9902,122.475163 49.9316132,102.273061 71.7206298,95.817503 L71.9446339,94.967678 C78.0600632,72.5405324 98.33054,57.0003 121.73,57.0003 Z M86.6602,103.417 C62.9972,103.417 43.7462,122.667 43.7462,146.33 C43.7462,169.992 62.9972,189.244 86.6602,189.244 L105.7645,189.244 L129.869462,148.004782 C129.678439,147.482425 129.5742,146.918336 129.5742,146.33 C129.5742,122.667 110.3232,103.417 86.6602,103.417 Z",fill:"currentColor"})})}),R=({sizeClass:e="w-12 h-12",logoClassName:t="w-full h-full text-white"})=>n.jsxs("div",{className:"relative z-10 flex items-center justify-center",children:[n.jsx("div",{className:"absolute -inset-1 bg-blue-500/20 rounded-xl blur opacity-25"}),n.jsxs("div",{className:`relative ${e} rounded-xl flex items-center justify-center group-hover:scale-105 transition-transform duration-300`,children:[n.jsxs("svg",{className:"absolute inset-0 w-full h-full",viewBox:"0 0 120 120","aria-hidden":"true",children:[n.jsx("defs",{children:n.jsxs("linearGradient",{id:"login-squircle-gradient",x1:"0",y1:"0",x2:"1",y2:"1",children:[n.jsx("stop",{offset:"0%",stopColor:"rgb(var(--color-brand))"}),n.jsx("stop",{offset:"100%",stopColor:"rgb(var(--color-brand-light))"})]})}),n.jsx("path",{d:"M 114.00 60.00 L 113.83 71.48 L 113.31 78.16 L 112.44 83.67 L 111.22 88.46 L 109.66 92.71 L 107.75 96.49 L 105.48 99.87 L 102.86 102.86 L 99.87 105.48 L 96.49 107.75 L 92.71 109.66 L 88.46 111.22 L 83.67 112.44 L 78.16 113.31 L 71.48 113.83 L 60.00 114.00 L 48.52 113.83 L 41.84 113.31 L 36.33 112.44 L 31.54 111.22 L 27.29 109.66 L 23.51 107.75 L 20.13 105.48 L 17.14 102.86 L 14.52 99.87 L 12.25 96.49 L 10.34 92.71 L 8.78 88.46 L 7.56 83.67 L 6.69 78.16 L 6.17 71.48 L 6.00 60.00 L 6.17 48.52 L 6.69 41.84 L 7.56 36.33 L 8.78 31.54 L 10.34 27.29 L 12.25 23.51 L 14.52 20.13 L 17.14 17.14 L 20.13 14.52 L 23.51 12.25 L 27.29 10.34 L 31.54 8.78 L 36.33 7.56 L 41.84 6.69 L 48.52 6.17 L 60.00 6.00 L 71.48 6.17 L 78.16 6.69 L 83.67 7.56 L 88.46 8.78 L 92.71 10.34 L 96.49 12.25 L 99.87 14.52 L 102.86 17.14 L 105.48 20.13 L 107.75 23.51 L 109.66 27.29 L 111.22 31.54 L 112.44 36.33 L 113.31 41.84 L 113.83 48.52 Z",fill:"url(#login-squircle-gradient)"})]}),n.jsx("div",{className:"relative z-10 flex items-center justify-center w-full h-full",children:n.jsx(Re,{className:t})})]})]}),ze="modulepreload",qe=function(e){return"/static/"+e},Q={},L=function(t,s,r){let a=Promise.resolve();if(s&&s.length>0){let o=function(d){return Promise.all(d.map(u=>Promise.resolve(u).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),l=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));a=o(s.map(d=>{if(d=qe(d),d in Q)return;Q[d]=!0;const u=d.endsWith(".css"),m=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${m}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":ze,u||(h.as="script"),h.crossOrigin="",h.href=d,l&&h.setAttribute("nonce",l),document.head.appendChild(h),u)return new Promise((x,v)=>{h.addEventListener("load",x),h.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${d}`)))})}))}function i(o){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=o,window.dispatchEvent(c),!c.defaultPrevented)throw o}return a.then(o=>{for(const c of o||[])c.status==="rejected"&&i(c.reason);return t().catch(i)})},Me=3e4,Be=10*6e4;let O=!1;const se=()=>{O||typeof window>"u"||(O=!0,window.dispatchEvent(new Event("auth:logout")),queueMicrotask(()=>{O=!1}))},Fe=e=>{if(!e)return"";const t=new URLSearchParams;for(const[r,a]of Object.entries(e))a!=null&&t.set(r,String(a));const s=t.toString();return s?`?${s}`:""},$=async(e,t,s={})=>{var d;const r=Fe(s.params),a=`${t}${r}`,i=ae(s.signal,s.timeoutMs??Me);let o;try{o=await fetch(a,{method:e,credentials:"include",signal:i.signal,headers:{...s.body===void 0?{}:{"Content-Type":"application/json"}},body:s.body===void 0?void 0:JSON.stringify(s.body)})}catch(u){throw i.signal.aborted?new Error((d=s.signal)!=null&&d.aborted?"请求已取消":"请求超时,请稍后重试"):u}finally{i.cleanup()}const l=(o.headers.get("content-type")||"").includes("application/json");if(!o.ok){o.status===401&&!s.skipAuthLogout&&se();const u=l?await o.json().catch(()=>{}):await o.text().catch(()=>{}),m=ne(u,o.status);throw new Error(m)}return l?await o.json():await o.text()},g=async(e,t,s)=>$("GET",e,{params:t,...s}),y=async(e,t,s)=>$("POST",e,{body:t,...s}),b=async(e,t,s)=>$("PUT",e,{body:t,...s}),j=async(e,t,s)=>$("DELETE",e,{params:t,...s}),S=async(e,t,s={})=>{var l;const r=ae(s.signal,s.timeoutMs??Be);let a;try{a=await fetch(e,{method:"POST",credentials:"include",signal:r.signal,body:t})}catch(d){throw r.signal.aborted?new Error((l=s.signal)!=null&&l.aborted?"请求已取消":"上传超时,请稍后重试"):d}finally{r.cleanup()}const c=(a.headers.get("content-type")||"").includes("application/json")?await a.json().catch(()=>{}):await a.text().catch(()=>{});if(!a.ok){a.status===401&&se();const d=ne(c,a.status),u=new Error(d);throw u.payload=c,u}return c},ae=(e,t)=>{const s=new AbortController,r=()=>s.abort(e==null?void 0:e.reason);e!=null&&e.aborted?r():e==null||e.addEventListener("abort",r,{once:!0});const a=globalThis.setTimeout(()=>s.abort(new DOMException("timeout","TimeoutError")),Math.max(1,t));return{signal:s.signal,cleanup:()=>{globalThis.clearTimeout(a),e==null||e.removeEventListener("abort",r)}}},Ve=e=>{if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.code=="string"&&typeof t.message=="string"},ne=(e,t)=>typeof e=="string"?e:Ve(e)?e.message:`请求失败: ${t}`,E=e=>{const t=e.getFullYear(),s=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${s}-${r}`},q=(e,t)=>{const s=new Date(e);return s.setHours(12,0,0,0),s.setDate(s.getDate()+t),s},z=(e,t)=>({startDate:E(q(e,-(t-1))),endDate:E(e)}),jt=(e,t=new Date,s="",r="")=>{if(e==="custom"&&s&&r){if(s>r)throw new Error("开始日期不能晚于结束日期");return{startDate:s,endDate:r}}return e==="yesterday"?z(q(t,-1),1):z(t,e==="3days"?3:e==="30days"?30:e==="today"?1:7)},Lt=e=>{const t=new Date(`${e.startDate}T12:00:00`),s=new Date(`${e.endDate}T12:00:00`),r=Math.round((s.getTime()-t.getTime())/864e5)+1,a=q(t,-1);return z(a,r)},Je=e=>{const t={...e},s=["ai_api_key","smtp_password","qq_reply_secret_key","captcha.remote_secret_key"];for(const r of s){const a=`${r}_configured`;a in t&&(t[a]=t[a]===!0||t[a]==="true")}if("renewal_log_retention_days"in t){const r=Number(t.renewal_log_retention_days);t.renewal_log_retention_days=Number.isFinite(r)?r:10}return t},Ue=async e=>y("/api/v1/session/login",e,{skipAuthLogout:!0}),Ke=async e=>y("/api/v1/session/initialize",{password:e},{skipAuthLogout:!0}),Ye=async e=>g("/api/v1/session",void 0,e),Ze=async e=>g("/health",void 0,e),He=async()=>y("/api/v1/session/logout",{}),Nt=async(e,t)=>b("/api/v1/session/credentials",e,t),Ge=(e,t)=>{const s=e.avatar_url||"";if(!s)return"";try{const r=new URL(s,window.location.origin);return r.hostname.endsWith("alicdn.com")&&r.searchParams.set("_v",t),r.toString()}catch{return s}},St=async e=>{const t=await g("/api/v1/accounts/details",void 0,e),s=Date.now().toString();return t.map(r=>({id:r.id,value:"",enabled:r.enabled,auto_confirm:r.auto_confirm,remark:r.remark,pause_duration:r.pause_duration,paused_until:Number(r.paused_until||0),paused:r.paused===!0,username:r.username||"",login_password:"",show_browser:r.show_browser===!0||r.show_browser===1||r.show_browser==="1"||r.show_browser==="true",nickname:r.nickname||r.remark||`账号 ${r.id.substring(0,6)}`,avatar_url:Ge(r,s),profile_error:r.profile_error||"",ai_enabled:!1,auto_rate_enabled:r.auto_rate_enabled,rate_content:r.rate_content||"不错的买家,交易愉快",auto_polish_enabled:r.auto_polish_enabled,polish_time:r.polish_time||"03:00",last_rate_scan_at:Number(r.last_rate_scan_at||0),last_polish_date:r.last_polish_date||"",last_polish_at:Number(r.last_polish_at||0)}))},kt=async(e,t)=>g(`/api/v1/account-tasks/${e}`,void 0,t),Ct=async(e,t,s)=>b(`/api/v1/account-tasks/${e}`,t,s),At=async(e,t,s)=>y(`/api/v1/account-tasks/${e}/run`,{task_type:t},{timeoutMs:12e4,...s}),Et=async(e,t,s,r=!1)=>{const a=await g("/api/v1/chat/sessions",{account_id:e,cursor:t,refresh:r?1:void 0},r?{timeoutMs:6e4,...s}:s);return{sessions:a.sessions||[],has_more:a.has_more===!0,next_cursor:a.next_cursor}},$t=async(e,t,s,r,a)=>{const i=await g("/api/v1/chat/messages",{account_id:e,chat_id:t,cursor:s,before_id:r},a);return{messages:i.messages||[],has_more:i.has_more===!0,next_cursor:i.next_cursor,session:i.session}},Dt=async(e,t)=>y("/api/v1/chat/messages",e,t),It=async(e,t)=>{const s=new FormData;return Object.entries(e).forEach(([r,a])=>s.append(r,a)),S("/api/v1/chat/images",s,{timeoutMs:12e4,...t})},Ot=async(e,t,s)=>y("/api/v1/chat/read",{account_id:e,chat_id:t},s),Tt=async e=>g("/api/v1/accounts/runtime-status",void 0,e),Pt=async e=>y("/api/v1/qr-login/generate",void 0,{...e,timeoutMs:(e==null?void 0:e.timeoutMs)??13e4}),Rt=async(e,t)=>g(`/api/v1/qr-login/check/${e}`,void 0,{signal:t,timeoutMs:1e4}),zt=async(e,t)=>y(`/api/v1/qr-login/complete-verification/${e}`,{target_account_id:t||""}),qt=async(e,t)=>b(`/api/v1/accounts/${e}/status`,{enabled:t}),Mt=async e=>j(`/api/v1/accounts/${e}`),Bt=async(e,t,s)=>b(`/api/v1/accounts/${e}/pause-duration`,{pause_duration:t},s),Ft=async(e,t,s)=>b(`/api/v1/accounts/${e}/settings`,t,s),Vt=async(e,t)=>g(`/api/v1/accounts/${e}/long-login`,void 0,t),Jt=async(e,t,s)=>b(`/api/v1/accounts/${e}/long-login`,{enabled:t},s),Ut=async(e,t)=>y("/api/v1/password-login",e,t),Kt=async(e,t)=>g(`/api/v1/password-login/check/${e}`,void 0,{signal:t,timeoutMs:1e4}),Yt=async(e,t)=>j(`/api/v1/password-login/cancel/${e}`,void 0,t),Zt=async e=>y(`/api/v1/accounts/${e}/refresh-profile`,{}),Ht=async e=>g("/api/v1/settings/ai-reply",void 0,e),re=e=>{const t=String(e||"");return t==="paid"?"pending_ship":["processing","pending_ship","shipped","completed","cancelled","refunding"].includes(t)?t:"unknown"},Gt=async(e,t,s=1,r=20,a,i)=>{const o={page:s,page_size:r};e&&(o.cookie_id=e),t&&t!=="all"&&(o.status=t),a!=null&&a.trim()&&(o.search=a.trim());const c=await g("/api/v1/orders",o,i),d=(c.orders||c.data||[]).map(u=>({...u,id:u.id||u.order_id,status:re(u.status||u.order_status),quantity:Number(u.quantity||1)}));return{success:!0,data:d,total:c.total||d.length,page:c.page||s,page_size:c.page_size||r,total_pages:c.total_pages||1}},Qt=async(e,t)=>b(`/api/v1/orders/${e}`,t),Wt=async e=>j(`/api/v1/orders/${e}`),Xt=async(e,t,s)=>{const r=new FormData;e&&r.append("cookie_id",e),t&&r.append("status",t);const a=await S("/api/v1/orders/refresh",r,s),i=180;let o=0;try{for(;o<i;){const c=await g(`/api/v1/orders/refresh/${a.job_id}`,void 0,s);if(c.status==="succeeded"&&c.result)return c.result;if(c.status==="failed"||c.status==="cancelled")throw new Error(c.error_message||"订单刷新任务失败");const l=500;await new Promise((d,u)=>{const m=()=>{globalThis.clearTimeout(h),u(new Error("请求已取消"))},h=globalThis.setTimeout(()=>{var x;(x=s==null?void 0:s.signal)==null||x.removeEventListener("abort",m),d()},l);s!=null&&s.signal&&(s.signal.aborted?m():s.signal.addEventListener("abort",m,{once:!0}))}),o+=1}}finally{}throw new Error("订单刷新任务等待超时")},es=async e=>y(`/api/v1/orders/${e}/refresh`),ts=async(e,t)=>y("/api/v1/orders/manual-ship",{order_ids:e,ship_mode:t}),ss=async(e,t)=>e instanceof FormData?S("/api/v1/orders/import",e,t):y("/api/v1/orders/import",e,t),as=async e=>g("/api/v1/analytics/dashboard",void 0,e),ns=async(e=7,t)=>{let s;if(typeof e=="number"){const r=new Date,a=new Date;a.setDate(a.getDate()-e),s={start_date:E(a),end_date:E(r)}}else s=e;return g("/api/v1/analytics/orders",{...s,timezone_offset_minutes:-new Date().getTimezoneOffset()},t)},rs=async(e,t)=>{const s=await g("/api/v1/analytics/orders/valid",{start_date:e.start_date,end_date:e.end_date,timezone_offset_minutes:-new Date().getTimezoneOffset()},t),a=(Array.isArray(s)?s:s.orders||[]).map(i=>({...i,id:i.id||i.order_id,status:re(i.status||i.order_status),quantity:Number(i.quantity||1)}));return{orders:a,total:Array.isArray(s)?a.length:Number(s.total??a.length),truncated:Array.isArray(s)?!1:s.truncated===!0}},Qe=e=>{let t=e.api_config;if(typeof t=="string"&&t.trim())try{t=JSON.parse(t)}catch{t=void 0}return{...e,api_config:t||void 0}},ie=e=>({...e,api_config:e.api_config?JSON.stringify(e.api_config):""}),is=async e=>{const t=await g("/api/v1/cards",void 0,e);return(Array.isArray(t)?t:t.cards||[]).map(Qe)},os=async e=>y("/api/v1/cards",ie(e)),cs=async(e,t)=>b(`/api/v1/cards/${e}`,ie(t)),ls=async e=>j(`/api/v1/cards/${e}`),ds=async(e,t)=>{const s=new FormData;return s.append("file",e),S("/api/v1/cards/batch",s,t)},us=async(e,t,s)=>y(`/api/v1/cards/${e}/append-data`,{content:t},s),T=e=>e===!0||e===1||e==="1",ps=async(e,t)=>{const s=await g("/api/v1/items",void 0,t);return(Array.isArray(s)?s:s.items||[]).map(a=>({...a,id:a.id||`${a.cookie_id}-${a.item_id}`,is_multi_spec:T(a.is_multi_spec),is_multi_qty_ship:T(a.is_multi_qty_ship??a.multi_quantity_delivery),multi_quantity_delivery:T(a.multi_quantity_delivery??a.is_multi_qty_ship)}))},gs=async e=>y("/api/v1/items/get-all-from-account",{cookie_id:e}),ys=async(e,t)=>j(`/api/v1/items/${e}/${t}`),ms=async(e,t)=>y(`/api/v1/items/${e}`,t),fs=async e=>{const t=new FormData;t.set("cookie_id",e.cookie_id),t.set("title",e.title),t.set("description",e.description),t.set("price",e.price),t.set("original_price",e.original_price||""),t.set("quantity",String(e.quantity)),t.set("postage_mode",e.postage_mode),t.set("postage",e.postage||""),e.location&&t.set("location",JSON.stringify(e.location));for(const s of e.images)t.append("images",s);return S("/api/v1/items/publish",t)},hs=async(e,t)=>y("/api/v1/items/publish-categories/recommend",{cookie_id:e,keyword:t}),_s=async e=>{const t=new FormData;return t.set("file",e.file),e.imagesZip&&t.set("images_zip",e.imagesZip),e.defaultCookieId&&t.set("default_cookie_id",e.defaultCookieId),t.set("fallback_category_id",e.fallbackCategory.catId),t.set("fallback_category_name",e.fallbackCategory.catName),t.set("fallback_channel_category_id",e.fallbackCategory.channelCatId||""),t.set("fallback_tb_category_id",e.fallbackCategory.tbCatId||""),e.location&&t.set("location",JSON.stringify(e.location)),S("/api/v1/items/publish-batches/preview",t)},vs=async e=>y("/api/v1/items/publish-batches",{preview_id:e}),bs=async e=>g(`/api/v1/items/publish-batches/${e}`),xs=async(e=20)=>{const t=await g("/api/v1/items/publish-batches",{limit:e});return Array.isArray(t)?t:t.batches||[]},ws=async e=>j(`/api/v1/items/publish-batches/${e}`),js=async e=>y(`/api/v1/items/publish-batches/${e}/cancel`,{}),Ls=async e=>y(`/api/v1/items/publish-batches/${e}/retry-failed`,{}),Ns=async(e,t,s)=>b(`/api/v1/items/${e}/${t}`,s),oe=e=>e.map(t=>{var s,r;return{id:String(t.id),name:t.name||"",trigger_type:t.trigger_type||"order_paid",item_keyword:t.item_title||t.item_id||"",cookie_id:t.cookie_id||"",item_id:t.item_id||"",item_title:t.item_title||"",card_group_id:Number(((s=(t.actions||[]).find(a=>a.action_type==="send_card"))==null?void 0:s.card_id)||0),card_group_name:((r=(t.actions||[]).find(a=>a.action_type==="send_card"))==null?void 0:r.card_name)||"",priority:t.priority||100,enabled:t.enabled||!1,config_json:t.config_json||"{}",actions:(t.actions||[]).map(a=>({id:a.id?String(a.id):void 0,action_type:a.action_type,card_id:Number(a.card_id||0),card_name:a.card_name||"",delivery_count:Number(a.delivery_count||1),message_template:a.message_template||"",delay_seconds:Number(a.delay_seconds||0),config_json:a.config_json||"{}",enabled:a.enabled!==!1,sort_order:Number(a.sort_order||0)})),variants:(t.actions||[]).filter(a=>a.action_type==="send_card").map(a=>{let i={};try{i=JSON.parse(a.config_json||"{}")}catch{}return{id:a.id?String(a.id):void 0,spec_name:i.spec_name||"",spec_value:i.spec_value||"",card_id:Number(a.card_id||0),card_name:a.card_name||"",delivery_count:Number(a.delivery_count||1),enabled:a.enabled!==!1,delay_override:i.delay_override===!0,delay_seconds:Number(a.delay_seconds||0),config_json:a.config_json||"{}"}})}}),Ss=async()=>{const e=await g("/api/v1/automation-rules"),t=Array.isArray(e)?e:e.data||[];return oe(t)},ks=async({cookieId:e,triggerType:t,enabled:s,search:r,page:a=1,pageSize:i=10}={})=>{const o=await g("/api/v1/automation-rules",{page:a,page_size:i,cookie_id:e||void 0,trigger_type:t||void 0,enabled:s,search:(r==null?void 0:r.trim())||void 0}),c=oe(Array.isArray(o)?o:o.data||[]);return{success:!0,data:c,total:Number(Array.isArray(o)?c.length:o.total??c.length),page:Number(Array.isArray(o)?a:o.page??a),page_size:Number(Array.isArray(o)?i:o.page_size??i),total_pages:Number(Array.isArray(o)?c.length?1:0:o.total_pages??(c.length?1:0)),trigger_counts:Object.fromEntries(Object.entries(Array.isArray(o)?{}:o.trigger_counts||{}).map(([l,d])=>[l,Number(d)]))}},We=(e,t)=>{if(e!=="order_paid")return t.map((a,i)=>({...a,sort_order:a.sort_order||i+1}));const s=t.filter(a=>a.action_type==="send_card").map((a,i)=>({...a,sort_order:i+1})),r=t.filter(a=>a.action_type!=="send_card"&&a.action_type!=="confirm_shipment");return[...s,...r.map((a,i)=>({...a,sort_order:s.length+i+1})),{action_type:"confirm_shipment",enabled:!0,sort_order:s.length+r.length+1}]},Cs=async e=>{const t=e.trigger_type||"order_paid",r=[{order_paid:"付款后自动发货",buyer_reviewed:"评价后发送赠品",review_missing_timeout:"超时未评价求评价"}[t]||"自动化规则",e.item_title||e.item_id||e.cookie_id||""].filter(Boolean).join(" - "),a=(e.actions||[]).filter(l=>l.action_type!=="send_card"&&l.action_type!=="confirm_shipment"),i=e.variants&&e.variants.length>0?[...e.variants.map((l,d)=>({action_type:"send_card",card_id:l.card_id,delivery_count:l.delivery_count||1,enabled:l.enabled!==!1,sort_order:d+1,delay_seconds:l.delay_seconds||0,config_json:JSON.stringify({spec_name:l.spec_name||"",spec_value:l.spec_value||"",delay_override:l.delay_override===!0})})),...a]:e.actions&&e.actions.length>0?e.actions:[{action_type:"send_card",card_id:e.card_group_id||0,delivery_count:1,enabled:!0,sort_order:1}],o=We(t,i),c={cookie_id:e.cookie_id||"",item_id:e.item_id||"",name:(e.name||"").trim()||r||"自动化规则",trigger_type:t,enabled:e.enabled??!0,priority:e.priority||100,config_json:e.config_json||"{}",actions:o.map((l,d)=>({action_type:l.action_type,card_id:l.card_id||0,delivery_count:l.delivery_count||1,message_template:l.message_template||"",delay_seconds:l.delay_seconds||0,config_json:l.config_json||"{}",enabled:l.enabled!==!1,sort_order:l.sort_order||d+1}))};return e.id?b(`/api/v1/automation-rules/${e.id}`,c):y("/api/v1/automation-rules",c)},As=async e=>j(`/api/v1/automation-rules/${e}`),Es=async()=>{const e=await g("/api/v1/automation-issues");return{runs:Array.isArray(e==null?void 0:e.runs)?e.runs:[],pending_tasks:Array.isArray(e==null?void 0:e.pending_tasks)?e.pending_tasks:[]}},$s=async(e,t)=>y(`/api/v1/automation-runs/${e}/resolve`,{resolution:t}),Ds=async(e,t)=>y(`/api/v1/automation-pending-tasks/${e}/resolve`,{resolution:t}),Xe=e=>({id:String((e==null?void 0:e.id)||""),keyword:(e==null?void 0:e.keyword)||"",reply:(e==null?void 0:e.reply)||"",item_id:(e==null?void 0:e.item_id)||"",type:(e==null?void 0:e.type)==="image"?"image":"text",image_url:(e==null?void 0:e.image_url)||""}),et=async e=>{const t=await g(`/api/v1/reply-rules/${e}/typed`);return Array.isArray(t)?t.map(Xe):[]},Is=async e=>e?(await et(e)).map(s=>({id:s.id,keyword:s.keyword||"",reply_content:s.reply||"",match_type:"fuzzy",enabled:!0,item_id:s.item_id||"",type:s.type==="image"?"image":"text",image_url:s.image_url||""})):[],Os=async(e,t)=>{const s=e.type||"text",r={keyword:e.keyword||"",reply:s==="text"&&e.reply_content||"",item_id:e.item_id||"",type:s,image_url:s==="image"&&e.image_url||""};return e.id?b(`/api/v1/reply-rules/${t}/typed/${e.id}`,r):y(`/api/v1/reply-rules/${t}/items`,r)},Ts=async(e,t)=>j(`/api/v1/reply-rules/${t}/typed/${e}`),tt=new Set(["ai_api_key","smtp_password","qq_reply_secret_key","captcha.remote_secret_key"]),st=e=>{if("values"in e||"secrets"in e)return e;const t={},s={};for(const r of Object.entries(e)){const[a,i]=r;i!=null&&(tt.has(a)?s[a]=i===""?{action:"clear"}:{action:"replace",value:String(i)}:t[a]=i)}return Object.keys(s).length>0?{values:t,secrets:s}:t},Ps=async e=>{const t=await g("/api/v1/settings/system",void 0,e);return Je(t.data||t)},Rs=async(e,t)=>{const s=st(e);return b("/api/v1/settings/system",s,t)},zs=async(e,t)=>g(`/api/v1/settings/ai-reply/${e}`,void 0,t),qs=async(e,t,s)=>{const r={ai_enabled:t.ai_enabled??!1,max_discount_percent:t.max_discount_percent??10,max_discount_amount:t.max_discount_amount??100,max_bargain_rounds:t.max_bargain_rounds??3,custom_prompts:t.custom_prompts??""};return b(`/api/v1/settings/ai-reply/${e}`,r,s)},Ms=async(e,t="",s)=>(await y("/api/v1/settings/ai-models",{base_url:e,api_key:t},s)).models||[],at=e=>{if(Array.isArray(e))return e.filter(Boolean);if(typeof e!="string"||!e.trim())return[];try{const t=JSON.parse(e);if(Array.isArray(t))return t.filter(Boolean)}catch{}return e.split(/[,\s;]+/).map(t=>t.trim()).filter(Boolean)},ce=e=>{const t=Array.from(new Set((e||[]).filter(Boolean)));return t.length>0?JSON.stringify(t):""},Bs=async e=>({success:!0,data:(await g("/api/v1/notifications/channels",void 0,e)||[]).map(r=>{let a;try{a=typeof r.config=="string"?JSON.parse(r.config):r.config}catch{a={}}return{id:String(r.id),name:r.name,type:r.type==="ding_talk"?"dingtalk":r.type==="lark"?"feishu":r.type,config:a,event_types:at(r.event_types),enabled:r.enabled,created_at:r.created_at,updated_at:r.updated_at}})}),Fs=async(e,t)=>y("/api/v1/notifications/channels",{...e,config:JSON.stringify(e.config),event_types:ce(e.event_types)},t),Vs=async(e,t,s)=>{const r={...t};return"config"in t&&(r.config=JSON.stringify(t.config)),"event_types"in t&&(r.event_types=ce(t.event_types)),b(`/api/v1/notifications/channels/${e}`,r,s)},Js=async(e,t)=>j(`/api/v1/notifications/channels/${e}`,void 0,t),Us=async(e,t)=>{const s=await g(`/api/v1/notifications/accounts/${e}/bindings`,void 0,t);return(s==null?void 0:s.channel_ids)||[]},Ks=async(e,t)=>y(`/api/v1/notifications/channels/${e}/test`,{},t),Ys=async()=>g("/api/v1/default-replies"),Zs=async e=>{const t=await g(`/api/v1/default-replies/${e}`);return{cookie_id:e,enabled:t.enabled||!1,reply_content:t.reply_content||"",reply_once:t.reply_once||!1,reply_image_url:t.reply_image_url||""}},Hs=async(e,t)=>b(`/api/v1/default-replies/${e}`,{enabled:t.enabled??!1,reply_content:t.reply_content||"",reply_once:t.reply_once??!1,reply_image_url:t.reply_image_url||""}),Gs=async e=>j(`/api/v1/default-replies/${e}`),Qs=async e=>y(`/api/v1/default-replies/${e}/clear-records`,{}),nt=({activeTab:e,isAdmin:t=!1,collapsed:s,onToggleCollapsed:r,onNavigate:a,onLogout:i})=>{const[o,c]=p.useState({version:"dev",commit:"unknown"});p.useEffect(()=>{const u=new AbortController;return Ze({signal:u.signal}).then(m=>c({version:String(m.version||"dev"),commit:String(m.commit||"unknown")})).catch(m=>{m instanceof DOMException&&m.name}),(()=>u.abort())},[]);const l=[{id:"dashboard",icon:we,label:"仪表盘"},{id:"accounts",icon:je,label:"账号管理"},{id:"chat",icon:Le,label:"在线聊天"},{id:"cards",icon:Ne,label:"卡密库存"},{id:"items",icon:Se,label:"商品列表"},{id:"orders",icon:ke,label:"订单管理"},{id:"rules",icon:Ce,label:"自动化规则"},{id:"notifications",icon:Ae,label:"通知设置"},...t?[{id:"settings",icon:Ee,label:"系统与AI"}]:[]],d=/^\d+\.\d+\.\d+$/.test(o.version)?`v${o.version}`:o.version;return n.jsxs("aside",{className:`fixed inset-y-0 left-0 z-20 flex flex-col border-r border-slate-200/80 bg-white/95 shadow-sidebar backdrop-blur-xl transition-[width] duration-300 ${s?"w-16":"w-64"}`,children:[n.jsxs("div",{className:`flex h-20 items-center border-b border-slate-100 ${s?"justify-center px-2":"gap-3 px-5"}`,children:[n.jsx(R,{sizeClass:"h-10 w-10"}),!s&&n.jsxs("div",{className:"min-w-0 leading-tight",children:[n.jsx("div",{className:"truncate text-base font-black tracking-tight text-slate-950",children:"Ydisks 闲鱼助手"}),n.jsx("div",{className:"mt-1 text-[10px] font-extrabold uppercase tracking-[0.22em] text-sky-600",children:"Operations"})]})]}),n.jsx("nav",{className:`flex-1 space-y-1.5 overflow-y-auto pt-5 ${s?"px-2":"px-3"}`,"aria-label":"主导航",children:l.map(u=>{const m=u.icon,h=e===u.id;return n.jsx(ee.Fragment,{children:n.jsxs("button",{type:"button",title:s?u.label:void 0,"aria-label":u.label,"aria-current":h?"page":void 0,onClick:(()=>a(u.id)),className:`group relative flex h-11 w-full items-center rounded-xl transition-colors ${s?"justify-center":"gap-3 px-3.5"} ${h?"bg-brand text-white shadow-brand-active":"text-slate-500 hover:bg-slate-100 hover:text-slate-900"}`,children:[n.jsx(m,{className:`h-[19px] w-[19px] shrink-0 ${h?"text-white":"text-slate-400 group-hover:text-slate-700"}`}),!s&&n.jsx("span",{className:"truncate text-sm font-bold",children:u.label}),h&&!s&&n.jsx("span",{className:"ml-auto h-1.5 w-1.5 rounded-full bg-white/90"})]})},u.id)})}),n.jsxs("div",{children:[n.jsx("div",{title:s?`版本 ${o.version} · ${o.commit}`:void 0,className:`border-y border-slate-100 bg-slate-50/70 py-2.5 ${s?"flex justify-center px-1":"px-6"}`,children:s?n.jsx(Z,{className:"h-[18px] w-[18px] text-slate-400","aria-label":`版本 ${o.version}`}):n.jsxs("div",{className:"min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-extrabold uppercase tracking-[0.18em] text-slate-400",children:[n.jsx(Z,{className:"h-3.5 w-3.5"}),"运行版本"]}),n.jsxs("div",{className:"mt-1 flex items-baseline gap-2",children:[n.jsx("span",{className:"truncate font-mono text-xs font-bold text-slate-700",children:d}),n.jsx("span",{className:"truncate font-mono text-[10px] text-slate-400",children:o.commit})]})]})}),n.jsxs("div",{className:`space-y-2 p-2 ${s?"":"p-3"}`,children:[n.jsxs("button",{type:"button",onClick:r,title:s?"展开侧边栏":"收起侧边栏","aria-label":s?"展开侧边栏":"收起侧边栏",className:`flex h-10 w-full items-center rounded-xl text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-900 ${s?"justify-center":"gap-3 px-3"}`,children:[s?n.jsx($e,{className:"h-5 w-5"}):n.jsx(De,{className:"h-5 w-5"}),!s&&n.jsx("span",{className:"text-sm font-bold",children:"收起侧边栏"})]}),n.jsxs("button",{type:"button",onClick:i,title:s?"退出登录":void 0,"aria-label":"退出登录",className:`flex h-10 w-full items-center rounded-xl text-slate-500 transition-colors hover:bg-red-50 hover:text-red-600 ${s?"justify-center":"gap-3 px-3"}`,children:[n.jsx(Ie,{className:"h-5 w-5"}),!s&&n.jsx("span",{className:"text-sm font-bold",children:"退出登录"})]})]})]})]})},P=p.lazy(()=>L(()=>import("./Dashboard-BjrV0BPa.js"),__vite__mapDeps([0,1,2,3,4,5]))),rt=p.lazy(()=>L(()=>import("./AccountList-CMeDGrpw.js"),__vite__mapDeps([6,1,3]))),it=p.lazy(()=>L(()=>import("./OrderList-DCxOUz7n.js"),__vite__mapDeps([7,1,3,2]))),ot=p.lazy(()=>L(()=>import("./CardList-CV-IXa79.js"),__vite__mapDeps([8,1,3]))),ct=p.lazy(()=>L(()=>import("./ItemList-DX-qMjnd.js"),__vite__mapDeps([9,1,3]))),lt=p.lazy(()=>L(()=>import("./Settings-j3SwRFCx.js"),__vite__mapDeps([10,1,3]))),dt=p.lazy(()=>L(()=>import("./Rules-D884-CgU.js"),__vite__mapDeps([11,1,3]))),ut=p.lazy(()=>L(()=>import("./Notifications-D65tIfCl.js"),__vite__mapDeps([12,1,3]))),pt=p.lazy(()=>L(()=>import("./Chat-ChmGl-XK.js"),__vite__mapDeps([13,1,3]))),gt=()=>n.jsx("div",{className:"flex min-h-[24rem] items-center justify-center",role:"status","aria-label":"正在加载页面",children:n.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-brand/20 border-t-brand"})}),yt=({activeTab:e,isAdmin:t,deliveryRuleTarget:s,onConfigureDelivery:r,onDeliveryTargetHandled:a})=>{const i=c=>{r({cookieId:c.cookie_id,itemId:c.item_id,requestId:Date.now()})},o=()=>{switch(e){case"dashboard":return n.jsx(P,{});case"accounts":return n.jsx(rt,{});case"chat":return n.jsx(pt,{});case"orders":return n.jsx(it,{});case"cards":return n.jsx(ot,{});case"items":return n.jsx(ct,{onConfigureDelivery:i});case"rules":return n.jsx(dt,{initialDeliveryTarget:s,onDeliveryTargetHandled:a});case"notifications":return n.jsx(ut,{isAdmin:t});case"settings":return t?n.jsx(lt,{}):n.jsx(P,{});default:return n.jsx(P,{})}};return n.jsx(p.Suspense,{fallback:n.jsx(gt,{}),children:o()})},mt=({activeTab:e,isAdmin:t,collapsed:s,deliveryRuleTarget:r,onToggleCollapsed:a,onNavigate:i,onLogout:o,onConfigureDelivery:c,onDeliveryTargetHandled:l})=>n.jsxs("div",{className:"flex min-h-screen bg-canvas text-ink",children:[n.jsx(nt,{activeTab:e,isAdmin:t,collapsed:s,onToggleCollapsed:a,onNavigate:i,onLogout:o}),n.jsxs("main",{className:`h-screen min-w-0 flex-1 overflow-x-hidden overflow-y-auto scroll-smooth transition-[margin] duration-300 ${s?"ml-16":"ml-64"} ${e==="chat"?"p-4 md:p-6":"p-8 md:p-12"}`,children:[n.jsx("div",{className:"fixed top-0 right-0 -z-10 h-[800px] w-[800px] pointer-events-none rounded-full bg-gradient-to-bl from-blue-50 to-transparent opacity-60 blur-[120px]"}),n.jsx("div",{className:`${e==="chat"?"mx-auto max-w-[1680px]":"mx-auto max-w-[1400px] pb-10"}`,children:n.jsx(yt,{activeTab:e,isAdmin:t,deliveryRuleTarget:r,onConfigureDelivery:c,onDeliveryTargetHandled:l})})]})]}),le=p.createContext(void 0),ft=({children:e})=>{const[t,s]=p.useState(!1),[r,a]=p.useState(!1),[i,o]=p.useState(!0),[c,l]=p.useState(!1),d=()=>{s(!1),a(!1)};p.useEffect(()=>{const x=new AbortController;let v=!0;Ye({signal:x.signal}).then(w=>{if(v){if((w==null?void 0:w.initialized)===!1){l(!0),d();return}l(!1),w!=null&&w.authenticated?(s(!0),a(w.is_admin===!0)):d()}}).catch(w=>{!v||w instanceof DOMException&&w.name==="AbortError"||(l(!1),d())}).finally(()=>{v&&o(!1)});const k=()=>d();return window.addEventListener("auth:logout",k),(()=>{v=!1,x.abort(),window.removeEventListener("auth:logout",k)})},[]);const u=async x=>{const v=await Ue(x);return v.success&&(l(!1),s(!0),a(v.is_admin===!0)),v},m=async x=>{const v=await Ke(x);return v.success&&(l(!1),s(!0),a(v.is_admin===!0)),v},h=async()=>{try{await He()}finally{d()}};return n.jsx(le.Provider,{value:{checkingAuth:i,isLoggedIn:t,isAdmin:r,needsInit:c,signIn:u,initialize:m,signOut:h},children:e})},ht=()=>{const e=p.useContext(le);if(!e)throw new Error("useSession 必须在 SessionProvider 内使用");return e},de={"/app/dashboard":"dashboard","/app/accounts":"accounts","/app/chat":"chat","/app/orders":"orders","/app/cards":"cards","/app/items":"items","/app/rules":"rules","/app/notifications":"notifications","/app/settings":"settings"},W=Object.fromEntries(Object.entries(de).map(([e,t])=>[t,e])),X=()=>de[window.location.pathname]||"dashboard",_t=()=>{const{checkingAuth:e,isLoggedIn:t,isAdmin:s,needsInit:r,signIn:a,initialize:i,signOut:o}=ht(),[c,l]=p.useState(X),[d,u]=p.useState(""),[m,h]=p.useState(""),[x,v]=p.useState(!1),[k,w]=p.useState(""),[A,M]=p.useState(""),[B,F]=p.useState(""),[V,J]=p.useState(!1),[U,C]=p.useState(""),[pe,K]=p.useState(),[ge,ye]=p.useState(Te),Y=f=>{const _=f==="settings"&&!s?"dashboard":f,N=W[_];N&&N!==window.location.pathname&&window.history.pushState({},"",N),l(_)};p.useEffect(()=>{const f=()=>l(X());return window.addEventListener("popstate",f),()=>window.removeEventListener("popstate",f)},[]),p.useEffect(()=>{!e&&t&&!s&&c==="settings"&&(window.history.replaceState({},"",W.dashboard),l("dashboard"))},[e,t,s,c]);const me=async f=>{f.preventDefault(),v(!0),w("");try{const _=await a({username:d,password:m});_.success||w(_.message||"登录失败")}catch(_){const N=_ instanceof Error?_.message:String(_);w(N||"登录失败")}finally{v(!1)}},fe=async f=>{if(f.preventDefault(),C(""),A.length<8){C("密码至少需要 8 个字符");return}if(A!==B){C("两次输入的密码不一致");return}J(!0);try{const _=await i(A);if(!_.success){C(_.message||"初始化失败,请重试");return}M(""),F("")}catch(_){const N=_ instanceof Error?_.message:String(_);C(N||"初始化失败,请重试")}finally{J(!1)}},he=async()=>{try{await o()}catch(f){console.error("退出登录失败",f)}};if(e)return n.jsx("div",{className:"min-h-screen flex items-center justify-center bg-surface",children:n.jsx(D,{className:"w-8 h-8 text-brand animate-spin"})});if(r)return n.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-canvas p-4 relative overflow-hidden font-sans",children:[n.jsx("div",{className:"absolute top-[-10%] left-[-10%] w-[60%] h-[60%] bg-blue-200/40 rounded-full blur-[120px] animate-pulse"}),n.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] w-[60%] h-[60%] bg-blue-200/30 rounded-full blur-[120px] animate-pulse",style:{animationDelay:"2s"}}),n.jsxs("div",{className:"bg-white/80 backdrop-blur-3xl p-8 md:p-12 rounded-xl shadow-panel w-full max-w-xl border border-white relative z-10 animate-fade-in",children:[n.jsxs("div",{className:"text-center mb-8",children:[n.jsx("div",{className:"mx-auto mb-6 flex justify-center",children:n.jsx(R,{sizeClass:"w-24 h-24"})}),n.jsx("h2",{className:"text-3xl font-extrabold text-gray-900 mb-2 tracking-tight",children:"首次设置管理员密码"}),n.jsx("p",{className:"text-gray-600 font-medium",children:"设置完成后会自动进入系统,管理员账号为 admin。"})]}),n.jsxs("form",{onSubmit:fe,className:"space-y-5",children:[n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"relative group",children:[n.jsx(H,{className:"absolute left-5 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400 group-focus-within:text-black transition-colors"}),n.jsx("input",{type:"password",placeholder:"设置管理员密码(至少 8 个字符)",value:A,onChange:f=>M(f.target.value),autoFocus:!0,className:"w-full ios-input pl-14 pr-6 py-4.5 rounded-2xl text-base h-14"})]}),n.jsxs("div",{className:"relative group",children:[n.jsx(I,{className:"absolute left-5 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400 group-focus-within:text-black transition-colors"}),n.jsx("input",{type:"password",placeholder:"再次输入密码",value:B,onChange:f=>F(f.target.value),className:"w-full ios-input pl-14 pr-6 py-4.5 rounded-2xl text-base h-14"})]})]}),U&&n.jsxs("div",{className:"p-3 rounded-xl bg-red-50 text-red-500 text-sm text-center font-bold flex items-center justify-center gap-2",children:[n.jsx(I,{className:"w-4 h-4"})," ",U]}),n.jsx("button",{type:"submit",disabled:V,className:"w-full ios-btn-primary h-14 rounded-2xl text-lg shadow-xl shadow-blue-200 mt-2 flex items-center justify-center gap-2 group disabled:opacity-70",children:V?n.jsx(D,{className:"w-5 h-5 animate-spin"}):n.jsxs(n.Fragment,{children:["设置密码并进入系统 ",n.jsx(G,{className:"w-5 h-5 group-hover:translate-x-1 transition-transform"})]})})]}),n.jsx("div",{className:"mt-8 pt-6 border-t border-gray-100 text-center",children:n.jsx("span",{className:"text-xs text-gray-400 font-medium tracking-widest uppercase",children:"Secure Bootstrap"})})]})]});if(!t)return n.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-canvas p-4 relative overflow-hidden font-sans",children:[n.jsx("div",{className:"absolute top-[-10%] left-[-10%] w-[60%] h-[60%] bg-blue-200/40 rounded-full blur-[120px] animate-pulse"}),n.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] w-[60%] h-[60%] bg-blue-200/30 rounded-full blur-[120px] animate-pulse",style:{animationDelay:"2s"}}),n.jsxs("div",{className:"bg-white/80 backdrop-blur-3xl p-8 md:p-12 rounded-xl shadow-panel w-full max-w-lg border border-white relative z-10 animate-fade-in",children:[n.jsxs("div",{className:"text-center mb-10",children:[n.jsx("div",{className:"group mx-auto mb-6 flex cursor-pointer justify-center",children:n.jsx(R,{sizeClass:"w-24 h-24",logoClassName:"w-full h-full text-white group-hover:scale-110 transition-transform"})}),n.jsx("h2",{className:"text-3xl font-extrabold text-gray-900 mb-2 tracking-tight",children:"欢迎回来"}),n.jsx("p",{className:"text-gray-500 font-medium",children:"Ydisks闲鱼助手 · 自动发货与管家系统"})]}),n.jsxs("form",{onSubmit:me,className:"space-y-5",children:[n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"relative group",children:[n.jsx(Oe,{className:"absolute left-5 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400 group-focus-within:text-black transition-colors"}),n.jsx("input",{type:"text",placeholder:"管理员账号",value:d,onChange:f=>u(f.target.value),className:"w-full ios-input pl-14 pr-6 py-4.5 rounded-2xl text-base h-14"})]}),n.jsxs("div",{className:"relative group",children:[n.jsx(H,{className:"absolute left-5 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400 group-focus-within:text-black transition-colors"}),n.jsx("input",{type:"password",placeholder:"密码",value:m,onChange:f=>h(f.target.value),className:"w-full ios-input pl-14 pr-6 py-4.5 rounded-2xl text-base h-14"})]})]}),k&&n.jsxs("div",{className:"p-3 rounded-xl bg-red-50 text-red-500 text-sm text-center font-bold flex items-center justify-center gap-2",children:[n.jsx(I,{className:"w-4 h-4"})," ",k]}),n.jsx("button",{type:"submit",disabled:x,className:"w-full ios-btn-primary h-14 rounded-2xl text-lg shadow-xl shadow-blue-200 mt-2 flex items-center justify-center gap-2 group disabled:opacity-70",children:x?n.jsx(D,{className:"w-5 h-5 animate-spin"}):n.jsxs(n.Fragment,{children:["立即登录 ",n.jsx(G,{className:"w-5 h-5 group-hover:translate-x-1 transition-transform"})]})})]}),n.jsx("div",{className:"mt-8 pt-6 border-t border-gray-100",children:n.jsx("div",{className:"mt-6 text-center",children:n.jsx("span",{className:"text-xs text-gray-400 font-medium tracking-widest uppercase",children:"Ydisks闲鱼助手 v1.0"})})})]})]});const _e=f=>{K(f),Y("rules")},ve=()=>K(void 0),be=()=>ye(f=>{const _=!f;return Pe(_),_});return n.jsx(mt,{activeTab:c,isAdmin:s,collapsed:ge,deliveryRuleTarget:pe,onToggleCollapsed:be,onNavigate:Y,onLogout:he,onConfigureDelivery:_e,onDeliveryTargetHandled:ve})},vt=()=>n.jsx(ft,{children:n.jsx(_t,{})}),ue=document.getElementById("root");if(!ue)throw new Error("Could not find root element to mount to");const bt=xe.createRoot(ue);bt.render(n.jsx(ee.StrictMode,{children:n.jsx(vt,{})}));export{ms as $,qt as A,Zt as B,Mt as C,Gt as D,ss as E,Xt as F,ts as G,Qt as H,es as I,Wt as J,is as K,ds as L,us as M,cs as N,ls as O,os as P,xs as Q,bs as R,hs as S,_s as T,vs as U,js as V,ws as W,Ls as X,gs as Y,Ns as Z,ys as _,ps as a,fs as a0,Ss as a1,Ms as a2,Ps as a3,Ye as a4,Rs as a5,Nt as a6,Ys as a7,Es as a8,ks as a9,Is as aa,Cs as ab,As as ac,$s as ad,Ds as ae,Os as af,Ts as ag,Zs as ah,Hs as ai,Gs as aj,Qs as ak,Vs as al,Fs as am,Js as an,Ks as ao,Et as ap,$t as aq,Ot as ar,Dt as as,It as at,jt as b,Lt as c,ns as d,rs as e,kt as f,as as g,St as h,Ht as i,Tt as j,Pt as k,Rt as l,zt as m,Bs as n,Us as o,Vt as p,zs as q,At as r,Jt as s,qs as t,Ct as u,Ft as v,Bt as w,Kt as x,Ut as y,Yt as z};
|