best-unit 1.2.21 → 1.2.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/best-unit.cjs
CHANGED
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
.custom-select-dropdown::-webkit-scrollbar-track {
|
|
58
58
|
background: ${g.scrollbarTrack};
|
|
59
59
|
}
|
|
60
|
-
`}),m("div",{onClick:()=>!i&&_(w=>!w),style:{minHeight:P===f.SMALL?32:40,borderRadius:6,display:"flex",alignItems:"center",padding:P===f.SMALL?"0 10px":"0 12px",fontSize:P===f.SMALL?12:15,cursor:i?"not-allowed":"pointer",boxSizing:"border-box",transition:"border 0.2s",opacity:i?.6:1,width:"100%",...S(),...o},tabIndex:0,children:[m("span",{style:{flex:1},children:x?x.label:m("span",{style:g.placeholder,children:r||"请选择"})}),m("span",{style:{marginLeft:8,display:"flex",alignItems:"center"},children:m("svg",{width:P===f.SMALL?16:20,height:P===f.SMALL?16:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m("path",{d:"M6 8L10 12L14 8",stroke:"#bfbfbf","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})})})]}),c&&!i&&m("div",{className:`custom-select-dropdown${l?" "+l:""}`,style:{position:"absolute",left:0,right:0,top:P===f.SMALL?32:44,zIndex:10,borderRadius:6,boxShadow:g.boxShadow,maxHeight:P===f.SMALL?160:220,overflowY:"auto",...g.dropdown,...a},children:[n.length===0&&m("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:P===f.SMALL?80:120,width:"100%",userSelect:"none"},children:[m("svg",{width:P===f.SMALL?48:64,height:P===f.SMALL?32:41,viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg",children:[m("title",{children:A("暂无数据")}),m("g",{transform:"translate(0 1)",fill:"none",fillRule:"evenodd",children:[m("ellipse",{fill:"#f5f5f5",cx:"32",cy:"33",rx:"32",ry:"7"}),m("g",{fillRule:"nonzero",stroke:"#d9d9d9",children:[m("path",{d:"M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"}),m("path",{d:"M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z",fill:"#fafafa"})]})]})]}),m("div",{style:{marginTop:8,color:"#bfbfbf",fontSize:P===f.SMALL?12:15},children:A("暂无数据")})]}),n.map((w,k)=>m("div",{onClick:()=>{w.disabled||(_(!1),t?.(w.value))},onMouseEnter:()=>y(k),onMouseLeave:()=>y(null),style:{padding:P===f.SMALL?"6px 10px":"10px 16px",fontSize:P===f.SMALL?12:15,cursor:w.disabled?"not-allowed":"pointer",fontWeight:e===w.value?600:400,opacity:w.disabled?.6:1,...g.option(e===w.value,!!w.disabled,b===k)},children:w.label},w.value))]}),d]})};function jo(){const e=E("size");return{white:{label:{marginBottom:e===f.SMALL?6:8,fontSize:e===f.SMALL?12:14,color:"#222",textAlign:"left",display:"block"},input:{width:"100%",padding:e===f.SMALL?"8px 10px":"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #E5E6EB",background:"#fff",color:"#222",fontSize:e===f.SMALL?12:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},selectError:{border:"1px solid #ff4d4f"},error:{color:"#ff4d4f",fontSize:e===f.SMALL?12:13,marginTop:e===f.SMALL?2:4,textAlign:"left"},buttonCancel:{background:"#fff",color:"#222",border:"1px solid #E5E6EB",borderRadius:6,padding:e===f.SMALL?"6px 16px":"8px 24px",fontSize:e===f.SMALL?12:15,cursor:"pointer"},buttonSubmit:{background:"#1890ff",color:"#fff",border:"none",borderRadius:6,padding:e===f.SMALL?"6px 16px":"8px 24px",fontSize:e===f.SMALL?12:15,cursor:"pointer",fontWeight:600},feeTip:{marginBottom:24,padding:e===f.SMALL?"8px 10px":"12px 16px",background:"#f6ffed",border:"1px solid #b7eb8f",borderRadius:6,fontSize:e===f.SMALL?12:14,color:"#52c41a"}},dark:{label:{marginBottom:e===f.SMALL?6:8,fontSize:e===f.SMALL?12:14,color:"#fff",textAlign:"left",display:"block"},input:{width:"100%",padding:e===f.SMALL?"8px 10px":"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #374151",background:"#23262F",color:"#fff",fontSize:e===f.SMALL?12:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},selectError:{border:"1px solid #ff4d4f"},error:{color:"#ff4d4f",fontSize:e===f.SMALL?12:13,marginTop:e===f.SMALL?2:4,textAlign:"left"},buttonCancel:{background:"#23262F",color:"#fff",border:"none",borderRadius:6,padding:e===f.SMALL?"6px 16px":"8px 24px",fontSize:e===f.SMALL?12:15,cursor:"pointer"},buttonSubmit:{background:"#00E8C6",color:"#fff",border:"none",borderRadius:6,padding:e===f.SMALL?"6px 16px":"8px 24px",fontSize:e===f.SMALL?12:15,cursor:"pointer",fontWeight:600},feeTip:{marginBottom:e===f.SMALL?16:24,padding:e===f.SMALL?"8px 10px":"12px 16px",background:"#1a1a1a",border:"1px solid #333",borderRadius:6,fontSize:e===f.SMALL?12:14,color:"#52c41a"}}}}function $o(){const e=E("theme"),t=E("themeConfig"),n=e===D.WHITE,r=jo(),o=n?r.white:r.dark;if(t){const s=n?t.white:t.dark;if(s?.color)return{...o,buttonSubmit:{...o.buttonSubmit,background:s.color}}}return o}function Wo(e){return e=e.replace(/[^\d.]/g,""),e=e.replace(/\.(?=.*\.)/g,""),e=e.replace(/^(\d+)(\.\d{0,2})?.*$/,"$1$2"),e=e.replace(/^0+(\d)/,"$1"),e.startsWith(".")&&(e="0"+e),e}function qo(e){if(!e)return"";const t=parseFloat(e);return isNaN(t)?"":t.toFixed(2)}const Jo=({formState:e,setFormState:t,onClose:n,loading:r})=>{const o=JSON.parse(sessionStorage.getItem("all_dicts")||"{}"),s=o?.currency||[],i=o?.channel?.filter(_=>_.payment_support)||[],[a,u]=F(""),[l,d]=F(!1),c=$o();return de(()=>{e.currency&&e.amount&&e.rechargeChannel?Ro({channel:e.rechargeChannel,amount:e.amount,currency:e.currency}).then(_=>{u(_),d(!0)}).catch(_=>{console.error("计算支付金额失败:",_),d(!1)}):d(!1)},[e.currency,e.amount,e.rechargeChannel]),m(Q,{children:[m("div",{style:{marginBottom:18},children:[m("div",{style:c.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",A("充值币种")]}),m(et,{value:e.currency,onChange:_=>{t(h=>({...h,currency:_}))},options:s?.map(_=>({value:_.value,label:_.label})),placeholder:A("请选择充值币种")})]}),m("div",{style:{marginBottom:18},children:[m("div",{style:c.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",A("充值金额")]}),m("input",{type:"text",placeholder:A("请输入充值金额"),value:e.amount,onInput:_=>{let h=_.target.value;h=Wo(h);let b="";if(h&&!h.endsWith(".")){let y=parseFloat(h);if(!isNaN(y)&&(y<1&&(y=1),y>999999.99&&(y=999999.99),h=y.toString(),/\./.test(_.target.value))){const g=_.target.value.split(".")[1];g!==void 0&&g.length>0&&(h=y.toFixed(Math.min(g.length,2)))}}t(y=>({...y,amount:h,amountError:b}))},onBlur:_=>{let h=_.target.value;h=qo(h),t(b=>({...b,amount:h,amountError:""}))},style:{...c.input,...e.amountError?c.inputError:{}}}),e.amountError&&m("div",{style:c.error,children:e.amountError})]}),m("div",{style:{marginBottom:24},children:[m("div",{style:c.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",A("支付平台")]}),m(et,{value:e.rechargeChannel,onChange:_=>{t(h=>({...h,rechargeChannel:_,rechargeChannelError:_?"":h.rechargeChannelError}))},options:i?.map(_=>({value:_.value,label:_.label})),placeholder:A("请选择支付平台")}),e.rechargeChannelError&&m("div",{style:c.error,children:e.rechargeChannelError})]}),l&&a&&m("div",{style:c.feeTip,children:[i.find(_=>_.value===e.rechargeChannel)?.label||e.rechargeChannel,A("需要收取手续费,实际支付金额约为:"),"$",a]}),e.error&&m("div",{style:{color:"#ff4d4f",marginBottom:12},children:e.error}),m("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[m("button",{type:"button",onClick:n,style:c.buttonCancel,children:A("取消")}),m("button",{type:"submit",disabled:r,style:c.buttonSubmit,children:A(r?"提交中...":"去支付")})]})]})};function Vo(){const e=E("size");return{white:{container:{border:"1px dashed #E5E6EB",borderRadius:8,background:"#FCFCFD",padding:e===f.SMALL?16:24,textAlign:"center",cursor:"pointer",minHeight:e===f.SMALL?80:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#999",fontSize:e===f.SMALL?12:15},fileItem:{display:"flex",alignItems:"center",background:"#F7F8FA",borderRadius:8,padding:e===f.SMALL?"8px 10px":"12px 16px",marginBottom:8,fontSize:e===f.SMALL?12:15,color:"#222",justifyContent:"space-between"},removeBtn:{background:"#FF4D4F",color:"#fff",border:"none",borderRadius:6,padding:e===f.SMALL?"6px 10px":"4px 14px",fontSize:e===f.SMALL?12:15,marginLeft:e===f.SMALL?8:16,cursor:"pointer"}},dark:{container:{border:"1.5px dashed #444C5C",borderRadius:8,background:"#181A20",padding:e===f.SMALL?16:24,textAlign:"center",cursor:"pointer",minHeight:e===f.SMALL?80:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#999",fontSize:e===f.SMALL?12:15},fileItem:{display:"flex",alignItems:"center",background:"#23262F",borderRadius:8,padding:e===f.SMALL?"8px 10px":"12px 16px",marginBottom:8,fontSize:e===f.SMALL?12:15,color:"#fff",justifyContent:"space-between"},removeBtn:{background:"#FF4D4F",color:"#fff",border:"none",borderRadius:6,padding:e===f.SMALL?"6px 10px":"4px 14px",fontSize:e===f.SMALL?12:15,marginLeft:e===f.SMALL?8:16,cursor:"pointer"}}}}function Go(){const t=E("theme")===D.WHITE,n=Vo();return t?n.white:n.dark}const J=E("size"),Ko=({value:e=[],onChange:t,maxCount:n=10,accept:r=".jpg,.jpeg,.png,.pdf",multiple:o=!0,disabled:s=!1})=>{const i=Te(null),[a,u]=F(!1),[l,d]=F(0),c=Go(),_=async b=>{const y=Array.from(b.target.files).slice(0,n);if(!y.length)return;u(!0);const g=[];for(let x=0;x<y.length;x++){d(0);const S=new FormData;S.append("file",y[x]);try{const w=await ko(S,k=>d(k));w&&g.push(w)}catch{}}u(!1),d(0),t?.([...e,...g]),i.current&&(i.current.value="")},h=b=>{const y=e.filter((g,x)=>x!==b);t?.(y)};return m("div",{children:[m("div",{style:{...c.container,cursor:s?"not-allowed":c.container.cursor,opacity:s?.6:1},onClick:()=>!s&&i.current?.click(),children:[m("div",{style:{fontSize:J===f.SMALL?32:48,marginBottom:J===f.SMALL?8:12},children:"📁"}),m("div",{style:{color:"#222",fontSize:J===f.SMALL?12:15,marginBottom:J===f.SMALL?4:8},children:A("点击或拖拽文件到此处上传")}),m("div",{style:{color:"#999",fontSize:J===f.SMALL?12:13},children:[A("支持 JPG、PNG、PDF 格式,单个文件不超过 20MB,最多上传")," ",n," ",A("个文件")]}),m("input",{ref:i,type:"file",multiple:o,accept:r,style:{display:"none"},onChange:_,disabled:s}),a&&m("div",{style:{marginTop:J===f.SMALL?8:12,color:"#1677ff"},children:[A("正在上传...")," ",l,"%"]})]}),e&&e.length>0&&m("div",{style:{marginTop:J===f.SMALL?8:12},children:e.map((b,y)=>m("div",{style:c.fileItem,children:[m("div",{style:{display:"flex",alignItems:"center",flex:1},children:m("span",{style:{fontWeight:500,wordBreak:"break-all"},children:b.split("/").pop()})}),m("button",{type:"button",onClick:g=>{g.stopPropagation(),h(y)},style:c.removeBtn,disabled:s,children:A("移除")})]},b))})]})};function Xo(){const e=E("size");return{white:{label:{marginBottom:e===f.SMALL?6:8,fontSize:e===f.SMALL?12:14,color:"#222",textAlign:"left",display:"block"},input:{width:"100%",padding:e===f.SMALL?"8px 10px":"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #E5E6EB",background:"#fff",color:"#222",fontSize:e===f.SMALL?12:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},select:{width:"100%",padding:e===f.SMALL?"8px 10px":"10px 12px",borderRadius:6,border:"1px solid #E5E6EB",background:"#fff",color:"#222",fontSize:e===f.SMALL?12:15,outline:"none"},selectError:{border:"1px solid #ff4d4f"},upload:{border:"1px dashed #E5E6EB",borderRadius:8,background:"#FCFCFD",padding:e===f.SMALL?12:24,textAlign:"center",cursor:"pointer",minHeight:e===f.SMALL?100:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#999",fontSize:e===f.SMALL?12:15},uploadError:{border:"1px dashed #ff4d4f"},fileItem:{display:"flex",alignItems:"center",background:"#F7F8FA",borderRadius:8,padding:e===f.SMALL?"8px 10px":"12px 16px",marginBottom:e===f.SMALL?6:8,fontSize:e===f.SMALL?12:15,color:"#222",justifyContent:"space-between"},buttonCancel:{background:"#fff",color:"#222",border:"1px solid #E5E6EB",borderRadius:6,padding:e===f.SMALL?"6px 18px":"8px 24px",cursor:"pointer"},buttonSubmit:{background:"#1890ff",color:"#fff",border:"none",borderRadius:6,padding:e===f.SMALL?"6px 18px":"8px 24px",cursor:"pointer",fontWeight:600},removeBtn:{background:"#FF4D4F",color:"#fff",border:"none",borderRadius:6,padding:e===f.SMALL?"6px 18px":"4px 14px",fontSize:e===f.SMALL?12:15,marginLeft:e===f.SMALL?8:16,cursor:"pointer"},error:{color:"#ff4d4f",fontSize:e===f.SMALL?12:13,marginTop:e===f.SMALL?2:4,textAlign:"left"}},dark:{label:{marginBottom:e===f.SMALL?4:8,fontSize:e===f.SMALL?12:14,color:"#fff",textAlign:"left",display:"block"},input:{width:"100%",padding:e===f.SMALL?"8px 10px":"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #374151",background:"#23262F",color:"#fff",fontSize:e===f.SMALL?12:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},select:{width:"100%",padding:e===f.SMALL?"8px 10px":"10px 12px",borderRadius:6,border:"1px solid #374151",background:"#23262F",color:"#fff",fontSize:e===f.SMALL?12:15,outline:"none"},selectError:{border:"1px solid #ff4d4f"},upload:{border:"1px dashed #374151",borderRadius:8,background:"#181A20",padding:e===f.SMALL?12:24,textAlign:"center",cursor:"pointer",minHeight:e===f.SMALL?100:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#999",fontSize:e===f.SMALL?12:14},uploadError:{border:"1px dashed #ff4d4f"},fileItem:{display:"flex",alignItems:"center",background:"#23262F",borderRadius:8,padding:e===f.SMALL?"8px 10px":"12px 16px",marginBottom:e===f.SMALL?6:8,fontSize:e===f.SMALL?12:15,color:"#fff",justifyContent:"space-between"},buttonCancel:{background:"#23262F",color:"#fff",border:"none",borderRadius:6,padding:e===f.SMALL?"6px 18px":"8px 24px",fontSize:e===f.SMALL?12:15,cursor:"pointer"},buttonSubmit:{background:"#00E8C6",color:"#fff",border:"none",borderRadius:6,padding:e===f.SMALL?"6px 18px":"8px 24px",fontSize:e===f.SMALL?12:14,cursor:"pointer",fontWeight:600},removeBtn:{background:"#FF4D4F",color:"#fff",border:"none",borderRadius:6,padding:e===f.SMALL?"6px 18px":"4px 14px",fontSize:e===f.SMALL?12:15,marginLeft:e===f.SMALL?8:16,cursor:"pointer"},error:{color:"#ff4d4f",fontSize:e===f.SMALL?12:13,marginTop:e===f.SMALL?2:4,textAlign:"left"}}}}function Zo(){const e=E("theme"),t=E("themeConfig"),n=e===D.WHITE,r=Xo(),o=n?r.white:r.dark;if(console.log(t,"themeConfig"),t){const s=n?t.white:t.dark;if(s?.color)return{...o,buttonSubmit:{...o.buttonSubmit,background:s.color}}}return o}const Qo=({formState:e,setFormState:t,onClose:n,loading:r})=>{const o=JSON.parse(sessionStorage.getItem("all_dicts")||"{}");console.log(o,"allDicts");const s=o?.channel||[],i=Zo();return m("form",{onSubmit:async u=>{u.preventDefault();let l=!0;t(d=>({...d,platformError:"",transactionIdError:"",filesError:""})),e.platform||(t(d=>({...d,platformError:A("请选择支付平台")})),l=!1),e.transactionId.trim()||(t(d=>({...d,transactionIdError:A("请输入转账交易ID")})),l=!1),(!e.files||e.files.length===0)&&(t(d=>({...d,filesError:A("请上传转账凭证")})),l=!1),l&&(await To({transferChannel:e.platform,transferNo:e.transactionId,voucherUrls:e.files}),n(),Ye.success(A("离线充值创建成功")))},children:[m("div",{style:{marginBottom:18},children:[m("div",{style:i.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",A("第三方支付平台")]}),m(et,{value:e.platform,onChange:u=>{t(l=>({...l,platform:u,platformError:u?"":l.platformError}))},options:[...s?.map(u=>({value:u.value,label:u.label}))],placeholder:A("请选择支付平台")}),e.platformError&&m("div",{style:i.error,children:e.platformError})]}),m("div",{style:{marginBottom:18},children:[m("div",{style:i.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",A("交易ID")]}),m("input",{type:"text",placeholder:A("请输入转账交易ID"),value:e.transactionId,maxLength:200,onInput:u=>{let l=u.target.value;l.length>200&&(l=l.slice(0,200)),t(d=>({...d,transactionId:l,transactionIdError:l?"":d.transactionIdError}))},style:{...i.input,...e.transactionIdError?i.inputError:{}}}),e.transactionIdError&&m("div",{style:i.error,children:e.transactionIdError})]}),m("div",{style:{marginBottom:24},children:[m("div",{style:i.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",A("上传文件")]}),m(Ko,{value:e.files,onChange:u=>t(l=>({...l,files:u,filesError:""})),maxCount:10,accept:".jpg,.jpeg,.png,.pdf",multiple:!0}),e.filesError&&m("div",{style:i.error,children:e.filesError})]}),m("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[m("button",{type:"button",onClick:n,style:i.buttonCancel,children:A("取消")}),m("button",{type:"submit",disabled:r,style:i.buttonSubmit,children:A("确定")})]})]})};function Yo(){const e=E("size");return{white:{mask:"rgba(0, 0, 0, 0.45)",modalBg:"#fff",modalColor:"#222",modalBoxShadow:"0 6px 16px rgba(0, 0, 0, 0.12)",closeBtn:{position:"absolute",top:"16px",right:"16px",background:"none",border:"none",fontSize:e===f.SMALL?16:24,cursor:"pointer",color:"#999",padding:"0",width:e===f.SMALL?16:24,height:e===f.SMALL?16:24,display:"flex",alignItems:"center",justifyContent:"center"},title:{fontSize:e===f.SMALL?16:18,fontWeight:"600",marginBottom:e===f.SMALL?16:24,color:"#222"},tabBtn:(t,n)=>({flex:1,padding:e===f.SMALL?"8px 10px":"12px 16px",background:t?"#1890ff":"transparent",color:t?"#fff":"#666",border:"1px solid #d9d9d9",borderRight:n?"none":"1px solid #d9d9d9",cursor:"pointer",fontSize:e===f.SMALL?12:14,fontWeight:t?"600":"400",borderRadius:n?"6px 0 0 6px":"0 6px 6px 0"})},dark:{mask:"rgba(0, 0, 0, 0.65)",modalBg:"#23262F",modalColor:"#F5F6FA",modalBoxShadow:"0 6px 16px rgba(0,0,0,0.32)",closeBtn:{position:"absolute",top:e===f.SMALL?"12px":"16px",right:e===f.SMALL?"12px":"16px",background:"none",border:"none",fontSize:e===f.SMALL?16:24,cursor:"pointer",color:"#B5B8BE",padding:"0",width:e===f.SMALL?16:24,height:e===f.SMALL?16:24,display:"flex",alignItems:"center",justifyContent:"center"},title:{fontSize:e===f.SMALL?16:18,fontWeight:"600",marginBottom:e===f.SMALL?16:24,color:"#F5F6FA"},tabBtn:(t,n)=>({flex:1,padding:e===f.SMALL?"8px 10px":"12px 16px",background:t?"#00E8C6":"transparent",color:t?"#fff":"#B5B8BE",border:"1px solid #444C5C",borderRight:n?"none":"1px solid #444C5C",cursor:"pointer",fontSize:e===f.SMALL?12:14,fontWeight:t?"600":"400",borderRadius:n?"6px 0 0 6px":"0 6px 6px 0"})}}}function ei(){const t=E("theme")===D.WHITE,n=Yo();return t?n.white:n.dark}const _e=E("size");function ti({visible:e,onClose:t,title:n,children:r,width:o=_e===f.SMALL?300:400,maxWidth:s=_e===f.SMALL?300:400,showClose:i=!0,maskClosable:a=!0}){const[u,l]=F(!1),d=ei(),c=h=>{h.target===h.currentTarget?l(!0):l(!1)},_=h=>{h.target===h.currentTarget&&u&&a&&t(),l(!1)};return e?m("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:d.mask,display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999},onMouseDown:c,onMouseUp:_,children:m("div",{style:{background:d.modalBg,padding:_e===f.SMALL?24:32,borderRadius:_e===f.SMALL?8:12,minWidth:o,maxWidth:s,color:d.modalColor,boxShadow:d.modalBoxShadow,position:"relative"},onClick:h=>h.stopPropagation(),children:[i&&m("button",{type:"button",onClick:t,style:d.closeBtn,"aria-label":"关闭",children:"×"}),n&&m("div",{style:d.title,children:n}),r]})}):null}function ni(){const e=E("size");return{white:{tabBtn:(t,n)=>({flex:1,background:t?"#fff":"#F7F8FA",color:t?"#1890ff":"#222",border:"1px solid #F0F1F3",borderRadius:n?"8px 0 0 8px":"0 8px 8px 0",fontWeight:t?600:400,fontSize:e===f.SMALL?12:16,height:e===f.SMALL?32:48,boxShadow:t?"0 2px 8px 0 rgba(20,20,20,0.04)":"none",outline:"none",cursor:"pointer",transition:"all 0.2s"})},dark:{tabBtn:(t,n)=>({flex:1,background:t?"#23262F":"#181A20",color:t?"#00E8C6":"#fff",border:"1px solid #444C5C",borderRadius:n?"8px 0 0 8px":"0 8px 8px 0",fontWeight:t?600:400,fontSize:e===f.SMALL?12:16,height:e===f.SMALL?32:48,boxShadow:t?"0 2px 8px 0 rgba(20,20,20,0.10)":"none",outline:"none",cursor:"pointer",transition:"all 0.2s"})}}}function ri(){const e=E("theme"),t=E("themeConfig"),n=e===D.WHITE,r=ni(),o=n?r.white:r.dark;if(t){const s=n?t.white:t.dark;if(s?.color)return{...o,tabBtn:(i,a)=>({...o.tabBtn(i,a),color:i?s.color:o.tabBtn(i,a).color})}}return o}const oi=E("size");function ii({visible:e,onClose:t,onSubmit:n}){const[r,o]=F({amount:"",rechargeChannel:"",currency:"USD",loading:!1,error:"",amountError:"",rechargeChannelError:"",currencyError:""}),[s,i]=F({platform:"",transactionId:"",files:[],platformError:"",transactionIdError:"",filesError:"",loading:!1}),[a,u]=F("online"),l=ri();de(()=>{e||(u("online"),o({amount:"",rechargeChannel:"",currency:"USD",loading:!1,error:"",amountError:"",rechargeChannelError:"",currencyError:""}),i({platform:"",transactionId:"",files:[],platformError:"",transactionIdError:"",filesError:"",loading:!1}))},[e]);const d=async c=>{c.preventDefault();let _=!0;if(o(h=>({...h,amountError:"",rechargeChannelError:""})),r.amount.trim()||(o(h=>({...h,amountError:A("请输入充值金额")})),_=!1),r.rechargeChannel||(o(h=>({...h,rechargeChannelError:A("请选择支付平台")})),_=!1),!!_){o(h=>({...h,loading:!0,error:""}));try{await n({amount:r.amount,rechargeChannel:r.rechargeChannel,currency:r.currency}),t()}catch{o(h=>({...h,error:A("提交失败,请重试")}))}finally{o(h=>({...h,loading:!1}))}}};return m(ti,{visible:e,onClose:t,title:A("充值 / 转账"),children:[m("div",{style:{display:"flex",marginBottom:oi===f.SMALL?16:28},children:[m("button",{type:"button",onClick:()=>u("online"),style:l.tabBtn(a==="online",!0),children:A("在线充值")}),m("button",{type:"button",onClick:()=>u("offline"),style:l.tabBtn(a==="offline",!1),children:A("线下转账")})]}),a==="online"?m("form",{onSubmit:d,children:m(Jo,{formState:r,setFormState:o,onClose:t,loading:r.loading})}):m(Qo,{formState:s,setFormState:i,onClose:t,loading:s.loading})]})}function ct(){return(ct=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var si=["context","children"];function ai(e){this.getChildContext=function(){return e.context};var t=e.children,n=function(r,o){if(r==null)return{};var s,i,a={},u=Object.keys(r);for(i=0;i<u.length;i++)o.indexOf(s=u[i])>=0||(a[s]=r[s]);return a}(e,si);return En(t,n)}function li(){var e=new CustomEvent("_preact",{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(e),this._vdom=ee(ai,ct({},this._props,{context:e.detail.context}),function t(n,r){if(n.nodeType===3)return n.data;if(n.nodeType!==1)return null;var o=[],s={},i=0,a=n.attributes,u=n.childNodes;for(i=a.length;i--;)a[i].name!=="slot"&&(s[a[i].name]=a[i].value,s[Bn(a[i].name)]=a[i].value);for(i=u.length;i--;){var l=t(u[i],null),d=u[i].slot;d?s[d]=ee(Dt,{name:d},l):o[i]=l}var c=r?ee(Dt,null,o):o;return ee(r||n.nodeName.toLowerCase(),s,c)}(this,this._vdomComponent)),(this.hasAttribute("hydrate")?An:Ne)(this._vdom,this._root)}function Bn(e){return e.replace(/-(\w)/g,function(t,n){return n?n.toUpperCase():""})}function ci(e,t,n){if(this._vdom){var r={};r[e]=n=n??void 0,r[Bn(e)]=n,this._vdom=En(this._vdom,r),Ne(this._vdom,this._root)}}function ui(){Ne(this._vdom=null,this._root)}function Dt(e,t){var n=this;return ee("slot",ct({},e,{ref:function(r){r?(n.ref=r,n._listener||(n._listener=function(o){o.stopPropagation(),o.detail.context=t},r.addEventListener("_preact",n._listener))):n.ref.removeEventListener("_preact",n._listener)}}))}function ut(e,t,n,r){function o(){var s=Reflect.construct(HTMLElement,[],o);return s._vdomComponent=e,s._root=r&&r.shadow?s.attachShadow({mode:r.mode||"open"}):s,s}return(o.prototype=Object.create(HTMLElement.prototype)).constructor=o,o.prototype.connectedCallback=li,o.prototype.attributeChangedCallback=ci,o.prototype.disconnectedCallback=ui,n=n||e.observedAttributes||Object.keys(e.propTypes||{}),o.observedAttributes=n,n.forEach(function(s){Object.defineProperty(o.prototype,s,{get:function(){return this._vdom.props[s]},set:function(i){this._vdom?this.attributeChangedCallback(s,null,i):(this._props||(this._props={}),this._props[s]=i,this.connectedCallback());var a=typeof i;i!=null&&a!=="string"&&a!=="boolean"&&a!=="number"||this.setAttribute(s,i)}})}),customElements.define(t||e.tagName||e.displayName||e.name,o)}function di(){const[e,t]=F(!1),n=async r=>{const o=await Co({amount:r.amount,currency:r.currency,rechargeChannel:r.rechargeChannel});window.open(o,"_blank")};return m("div",{children:[m(Mn,{onClick:()=>t(!0),children:A("充值/转账")}),m(ii,{visible:e,onClose:()=>t(!1),onSubmit:n})]})}ut(di,"best-recharge",["theme"],{shadow:!1});const zt={white:{popover:{background:"#fff",color:"#222",boxShadow:"0 4px 16px rgba(0,0,0,0.12)",border:"none"},arrow:{top:"#fff",bottom:"#fff",left:"#fff",right:"#fff"}},dark:{popover:{background:"#23262F",color:"#fff",boxShadow:"0 4px 16px rgba(0,0,0,0.32)",border:"1px solid #444C5C"},arrow:{top:"#23262F",bottom:"#23262F",left:"#23262F",right:"#23262F"}}};function fi(){return E("theme")===D.WHITE?zt.white:zt.dark}const V=E("size"),pi=({popover:e,children:t,popoverWidth:n=V===f.SMALL?200:300,popoverMinWidth:r=V===f.SMALL?150:200,offsetY:o=V===f.SMALL?8:16,offsetX:s=V===f.SMALL?8:16,popoverPosition:i="top"})=>{const[a,u]=F(!1),[l,d]=F(i),c=Te(null),_=Te(null),h=fi(),b=()=>{if(_.current&&(clearTimeout(_.current),_.current=null),i==="top"||i==="bottom")if(c.current){const S=c.current.getBoundingClientRect();i==="top"&&S.top<100?d("bottom"):i==="bottom"&&window.innerHeight-S.bottom<100?d("top"):d(i)}else d(i);else d(i);u(!0)},y=()=>{_.current=window.setTimeout(()=>{u(!1)},120)};let g={position:"absolute",zIndex:999,borderRadius:6,fontSize:V===f.SMALL?12:15,minWidth:r,width:n,padding:V===f.SMALL?"6px 12px":"8px 14px",pointerEvents:"auto",textAlign:"center",animation:"fadeInUp 0.3s",...h.popover},x={position:"absolute",zIndex:11,width:0,height:0};return l==="top"?(g={...g,left:"50%",top:-48,transform:"translateX(-50%)"},x={...x,left:"50%",bottom:-8,transform:"translateX(-50%)",borderLeft:"8px solid transparent",borderRight:"8px solid transparent",borderTop:`8px solid ${h.arrow.top}`}):l==="bottom"?(g={...g,left:"50%",top:"100%",marginTop:o,transform:"translateX(-50%)"},x={...x,left:"50%",top:-8,transform:"translateX(-50%)",borderLeft:"8px solid transparent",borderRight:"8px solid transparent",borderBottom:`8px solid ${h.arrow.bottom}`}):l==="leftTop"?(g={...g,right:"100%",top:0,marginRight:s,transform:"none"},x={...x,right:-8,top:V===f.SMALL?8:12,borderTop:"8px solid transparent",borderBottom:"8px solid transparent",borderLeft:`8px solid ${h.arrow.left}`}):l==="rightTop"&&(g={...g,left:"100%",top:0,marginLeft:s,transform:"translateY(0)"},x={...x,left:-8,top:12,borderTop:"8px solid transparent",borderBottom:"8px solid transparent",borderRight:`8px solid ${h.arrow.right}`}),m("div",{ref:c,style:{position:"relative",display:"inline-block"},onMouseEnter:b,onMouseLeave:y,children:[t,a&&m("div",{style:g,onMouseEnter:b,onMouseLeave:y,children:[e,m("div",{style:x})]})]})};function hi(){const e=E("size");return{white:{popoverTitle:{fontSize:e===f.SMALL?12:16,fontWeight:600,color:"#222",marginBottom:e===f.SMALL?12:16,textAlign:"center"},detailRow:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:e===f.SMALL?"6px 0":"8px 0",borderBottom:"1px solid #e5e7eb",fontSize:e===f.SMALL?12:15},detailLabel:{display:"flex",alignItems:"center",color:"#6b7280",fontWeight:500},detailDot:t=>({display:"inline-block",width:e===f.SMALL?6:8,height:e===f.SMALL?6:8,borderRadius:"50%",background:t,marginRight:e===f.SMALL?6:8}),detailValue:t=>({color:t,fontWeight:600,fontSize:e===f.SMALL?12:15}),main:{fontSize:e===f.SMALL?18:24,fontWeight:800,color:"#111827",display:"inline-block"},currency:{fontSize:e===f.SMALL?16:18,color:"#6b7280",marginLeft:e===f.SMALL?6:8,fontWeight:600}},dark:{popoverTitle:{fontSize:e===f.SMALL?14:16,fontWeight:600,color:"#fff",marginBottom:e===f.SMALL?14:16,textAlign:"center"},detailRow:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:e===f.SMALL?"6px 0":"8px 0",borderBottom:"1px solid #374151",fontSize:e===f.SMALL?12:15},detailLabel:{display:"flex",alignItems:"center",color:"#B5B8BE",fontWeight:500},detailDot:t=>({display:"inline-block",width:e===f.SMALL?6:8,height:e===f.SMALL?6:8,borderRadius:"50%",background:t,marginRight:e===f.SMALL?6:8}),detailValue:t=>({color:t,fontWeight:600,fontSize:e===f.SMALL?12:15}),main:{fontSize:e===f.SMALL?18:24,fontWeight:800,color:"#fff",display:"inline-block"},currency:{fontSize:e===f.SMALL?16:18,color:"#B5B8BE",marginLeft:e===f.SMALL?6:8,fontWeight:600}}}}function mi(){const t=E("theme")===D.WHITE,n=hi();return t?n.white:n.dark}function Ut(e){return e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}function _i(e){const[t,n]=F({available:0,currency:"USD",symbol:"$",details:[]}),r=async()=>{try{const i=await Cn(),a=[{label:"",value:i.totalAmount,color:"#15b36b",dot:"#15b36b"},{label:"",value:i.frozenAmount,color:"#f59e0b",dot:"#f59e0b"},...i.isCredit?[{label:"",value:i.creditLimit,color:"#1890ff",dot:"#1890ff"},{label:"",value:i.creditUsed,color:"#ff0000",dot:"#ff0000"}]:[],{label:"",value:i.availableAmount,color:"#1890ff",dot:"#15b36b"}],u={available:i.availableAmount,currency:"USD",symbol:"$",details:a};n(u)}catch(i){console.error("获取余额失败:",i)}};de(()=>{r()},[]),de(()=>{const i=()=>{r()};return document.addEventListener("refresh-balance",i),()=>{document.removeEventListener("refresh-balance",i)}},[]);const o=mi(),s=[{label:A("真实金额"),value:t.details[0]?.value||0,color:"#15b36b",dot:"#15b36b"},{label:A("冻结金额"),value:t.details[1]?.value||0,color:"#f59e0b",dot:"#f59e0b"},...t.details.length>4?[{label:A("信用额度"),value:t.details[2]?.value||0,color:"#1890ff",dot:"#1890ff"},{label:A("已用额度"),value:t.details[3]?.value||0,color:"#ff0000",dot:"#ff0000"}]:[],{label:A("可用余额"),value:t.details[t.details.length-1]?.value||0,color:"#1890ff",dot:"#15b36b"}];return m(pi,{popover:m(Q,{children:[m("div",{style:o.popoverTitle,children:A("余额详情")}),s.map(i=>m("div",{style:o.detailRow,children:[m("span",{style:o.detailLabel,children:[m("span",{style:o.detailDot(i.dot)}),i.label]}),m("span",{style:o.detailValue(i.color),children:[t.symbol,Ut(i.value)]})]},i.label))]}),popoverPosition:e.popoverPosition||"bottom",children:m("div",{style:o.main,children:[t.symbol,Ut(t.available),m("span",{style:o.currency,children:t.currency})]})})}ut(_i,"best-statistical-balance");const ge={white:{background:"#1890ff",color:"#fff",border:"none",borderRadius:6,cursor:"pointer",fontWeight:600,transition:"all 0.2s ease"},dark:{background:"#00E8C6",color:"#fff",border:"none",borderRadius:6,cursor:"pointer",fontWeight:600,transition:"all 0.2s ease"}};function gi(e){return E("theme")===D.WHITE?{...ge.white,background:e||ge.white.background}:{...ge.dark,background:e||ge.dark.background}}function bi(e){switch(e){case"small":return{fontSize:"12px",gap:"2px"};case"large":return{fontSize:"18px",gap:"6px"};default:return{fontSize:"14px",gap:"4px"}}}function yi({color:e,size:t="medium",children:n}){const[r,o]=F(!1),s=gi(e),i=bi(t),a={...s,...i,display:"flex",alignItems:"center"};return m(Q,{children:[m("style",{children:`
|
|
60
|
+
`}),m("div",{onClick:()=>!i&&_(w=>!w),style:{minHeight:P===f.SMALL?32:40,borderRadius:6,display:"flex",alignItems:"center",padding:P===f.SMALL?"0 10px":"0 12px",fontSize:P===f.SMALL?12:15,cursor:i?"not-allowed":"pointer",boxSizing:"border-box",transition:"border 0.2s",opacity:i?.6:1,width:"100%",...S(),...o},tabIndex:0,children:[m("span",{style:{flex:1},children:x?x.label:m("span",{style:g.placeholder,children:r||"请选择"})}),m("span",{style:{marginLeft:8,display:"flex",alignItems:"center"},children:m("svg",{width:P===f.SMALL?16:20,height:P===f.SMALL?16:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m("path",{d:"M6 8L10 12L14 8",stroke:"#bfbfbf","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})})})]}),c&&!i&&m("div",{className:`custom-select-dropdown${l?" "+l:""}`,style:{position:"absolute",left:0,right:0,top:P===f.SMALL?32:44,zIndex:10,borderRadius:6,boxShadow:g.boxShadow,maxHeight:P===f.SMALL?160:220,overflowY:"auto",...g.dropdown,...a},children:[n.length===0&&m("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:P===f.SMALL?80:120,width:"100%",userSelect:"none"},children:[m("svg",{width:P===f.SMALL?48:64,height:P===f.SMALL?32:41,viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg",children:[m("title",{children:A("暂无数据")}),m("g",{transform:"translate(0 1)",fill:"none",fillRule:"evenodd",children:[m("ellipse",{fill:"#f5f5f5",cx:"32",cy:"33",rx:"32",ry:"7"}),m("g",{fillRule:"nonzero",stroke:"#d9d9d9",children:[m("path",{d:"M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"}),m("path",{d:"M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z",fill:"#fafafa"})]})]})]}),m("div",{style:{marginTop:8,color:"#bfbfbf",fontSize:P===f.SMALL?12:15},children:A("暂无数据")})]}),n.map((w,k)=>m("div",{onClick:()=>{w.disabled||(_(!1),t?.(w.value))},onMouseEnter:()=>y(k),onMouseLeave:()=>y(null),style:{padding:P===f.SMALL?"6px 10px":"10px 16px",fontSize:P===f.SMALL?12:15,cursor:w.disabled?"not-allowed":"pointer",fontWeight:e===w.value?600:400,opacity:w.disabled?.6:1,...g.option(e===w.value,!!w.disabled,b===k)},children:w.label},w.value))]}),d]})};function jo(){const e=E("size");return{white:{label:{marginBottom:e===f.SMALL?6:8,fontSize:e===f.SMALL?12:14,color:"#222",textAlign:"left",display:"block"},input:{width:"100%",padding:e===f.SMALL?"8px 10px":"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #E5E6EB",background:"#fff",color:"#222",fontSize:e===f.SMALL?12:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},selectError:{border:"1px solid #ff4d4f"},error:{color:"#ff4d4f",fontSize:e===f.SMALL?12:13,marginTop:e===f.SMALL?2:4,textAlign:"left"},buttonCancel:{background:"#fff",color:"#222",border:"1px solid #E5E6EB",borderRadius:6,padding:e===f.SMALL?"6px 16px":"8px 24px",fontSize:e===f.SMALL?12:15,cursor:"pointer"},buttonSubmit:{background:"#1890ff",color:"#fff",border:"none",borderRadius:6,padding:e===f.SMALL?"6px 16px":"8px 24px",fontSize:e===f.SMALL?12:15,cursor:"pointer",fontWeight:600},feeTip:{marginBottom:24,padding:e===f.SMALL?"8px 10px":"12px 16px",background:"#f6ffed",border:"1px solid #b7eb8f",borderRadius:6,fontSize:e===f.SMALL?12:14,color:"#52c41a"}},dark:{label:{marginBottom:e===f.SMALL?6:8,fontSize:e===f.SMALL?12:14,color:"#fff",textAlign:"left",display:"block"},input:{width:"100%",padding:e===f.SMALL?"8px 10px":"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #374151",background:"#23262F",color:"#fff",fontSize:e===f.SMALL?12:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},selectError:{border:"1px solid #ff4d4f"},error:{color:"#ff4d4f",fontSize:e===f.SMALL?12:13,marginTop:e===f.SMALL?2:4,textAlign:"left"},buttonCancel:{background:"#23262F",color:"#fff",border:"none",borderRadius:6,padding:e===f.SMALL?"6px 16px":"8px 24px",fontSize:e===f.SMALL?12:15,cursor:"pointer"},buttonSubmit:{background:"#00E8C6",color:"#fff",border:"none",borderRadius:6,padding:e===f.SMALL?"6px 16px":"8px 24px",fontSize:e===f.SMALL?12:15,cursor:"pointer",fontWeight:600},feeTip:{marginBottom:e===f.SMALL?16:24,padding:e===f.SMALL?"8px 10px":"12px 16px",background:"#1a1a1a",border:"1px solid #333",borderRadius:6,fontSize:e===f.SMALL?12:14,color:"#52c41a"}}}}function $o(){const e=E("theme"),t=E("themeConfig"),n=e===D.WHITE,r=jo(),o=n?r.white:r.dark;if(t){const s=n?t.white:t.dark;if(s?.color)return{...o,buttonSubmit:{...o.buttonSubmit,background:s.color}}}return o}function Wo(e){return e=e.replace(/[^\d.]/g,""),e=e.replace(/\.(?=.*\.)/g,""),e=e.replace(/^(\d+)(\.\d{0,2})?.*$/,"$1$2"),e=e.replace(/^0+(\d)/,"$1"),e.startsWith(".")&&(e="0"+e),e}function qo(e){if(!e)return"";const t=parseFloat(e);return isNaN(t)?"":t.toFixed(2)}const Jo=({formState:e,setFormState:t,onClose:n,loading:r})=>{const o=JSON.parse(sessionStorage.getItem("all_dicts")||"{}"),s=o?.currency||[],i=o?.channel?.filter(_=>_.payment_support)||[],[a,u]=F(""),[l,d]=F(!1),c=$o();return de(()=>{e.currency&&e.amount&&e.rechargeChannel?Ro({channel:e.rechargeChannel,amount:e.amount,currency:e.currency}).then(_=>{u(_),d(!0)}).catch(_=>{console.error("计算支付金额失败:",_),d(!1)}):d(!1)},[e.currency,e.amount,e.rechargeChannel]),m(Q,{children:[m("div",{style:{marginBottom:18},children:[m("div",{style:c.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",A("充值币种")]}),m(et,{value:e.currency,onChange:_=>{t(h=>({...h,currency:_}))},options:s?.map(_=>({value:_.value,label:_.label})),placeholder:A("请选择充值币种")})]}),m("div",{style:{marginBottom:18},children:[m("div",{style:c.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",A("充值金额")]}),m("input",{type:"text",placeholder:A("请输入充值金额"),value:e.amount,onInput:_=>{let h=_.target.value;h=Wo(h);let b="";if(h&&!h.endsWith(".")){let y=parseFloat(h);if(!isNaN(y)&&(y<1&&(y=1),y>999999.99&&(y=999999.99),h=y.toString(),/\./.test(_.target.value))){const g=_.target.value.split(".")[1];g!==void 0&&g.length>0&&(h=y.toFixed(Math.min(g.length,2)))}}t(y=>({...y,amount:h,amountError:b}))},onBlur:_=>{let h=_.target.value;h=qo(h),t(b=>({...b,amount:h,amountError:""}))},style:{...c.input,...e.amountError?c.inputError:{}}}),e.amountError&&m("div",{style:c.error,children:e.amountError})]}),m("div",{style:{marginBottom:24},children:[m("div",{style:c.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",A("支付平台")]}),m(et,{value:e.rechargeChannel,onChange:_=>{t(h=>({...h,rechargeChannel:_,rechargeChannelError:_?"":h.rechargeChannelError}))},options:i?.map(_=>({value:_.value,label:_.label})),placeholder:A("请选择支付平台")}),e.rechargeChannelError&&m("div",{style:c.error,children:e.rechargeChannelError})]}),l&&a&&m("div",{style:c.feeTip,children:[i.find(_=>_.value===e.rechargeChannel)?.label||e.rechargeChannel,A("需要收取手续费,实际支付金额约为:"),"$",a]}),e.error&&m("div",{style:{color:"#ff4d4f",marginBottom:12},children:e.error}),m("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[m("button",{type:"button",onClick:n,style:c.buttonCancel,children:A("取消")}),m("button",{type:"submit",disabled:r,style:c.buttonSubmit,children:A(r?"提交中...":"去支付")})]})]})};function Vo(){const e=E("size");return{white:{container:{border:"1px dashed #E5E6EB",borderRadius:8,background:"#FCFCFD",padding:e===f.SMALL?16:24,textAlign:"center",cursor:"pointer",minHeight:e===f.SMALL?80:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#999",fontSize:e===f.SMALL?12:15},fileItem:{display:"flex",alignItems:"center",background:"#F7F8FA",borderRadius:8,padding:e===f.SMALL?"8px 10px":"12px 16px",marginBottom:8,fontSize:e===f.SMALL?12:15,color:"#222",justifyContent:"space-between"},removeBtn:{background:"#FF4D4F",color:"#fff",border:"none",borderRadius:6,padding:e===f.SMALL?"6px 10px":"4px 14px",fontSize:e===f.SMALL?12:15,marginLeft:e===f.SMALL?8:16,cursor:"pointer"}},dark:{container:{border:"1.5px dashed #444C5C",borderRadius:8,background:"#181A20",padding:e===f.SMALL?16:24,textAlign:"center",cursor:"pointer",minHeight:e===f.SMALL?80:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#999",fontSize:e===f.SMALL?12:15},fileItem:{display:"flex",alignItems:"center",background:"#23262F",borderRadius:8,padding:e===f.SMALL?"8px 10px":"12px 16px",marginBottom:8,fontSize:e===f.SMALL?12:15,color:"#fff",justifyContent:"space-between"},removeBtn:{background:"#FF4D4F",color:"#fff",border:"none",borderRadius:6,padding:e===f.SMALL?"6px 10px":"4px 14px",fontSize:e===f.SMALL?12:15,marginLeft:e===f.SMALL?8:16,cursor:"pointer"}}}}function Go(){const t=E("theme")===D.WHITE,n=Vo();return t?n.white:n.dark}const J=E("size"),Ko=({value:e=[],onChange:t,maxCount:n=10,accept:r=".jpg,.jpeg,.png,.pdf",multiple:o=!0,disabled:s=!1})=>{const i=Te(null),[a,u]=F(!1),[l,d]=F(0),c=Go(),_=async b=>{const y=Array.from(b.target.files).slice(0,n);if(!y.length)return;u(!0);const g=[];for(let x=0;x<y.length;x++){d(0);const S=new FormData;S.append("file",y[x]);try{const w=await ko(S,k=>d(k));w&&g.push(w)}catch{}}u(!1),d(0),t?.([...e,...g]),i.current&&(i.current.value="")},h=b=>{const y=e.filter((g,x)=>x!==b);t?.(y)};return m("div",{children:[m("div",{style:{...c.container,cursor:s?"not-allowed":c.container.cursor,opacity:s?.6:1},onClick:()=>!s&&i.current?.click(),children:[m("div",{style:{fontSize:J===f.SMALL?32:48,marginBottom:J===f.SMALL?8:12},children:"📁"}),m("div",{style:{color:"#222",fontSize:J===f.SMALL?12:15,marginBottom:J===f.SMALL?4:8},children:A("点击或拖拽文件到此处上传")}),m("div",{style:{color:"#999",fontSize:J===f.SMALL?12:13},children:[A("支持 JPG、PNG、PDF 格式,单个文件不超过 20MB,最多上传")," ",n," ",A("个文件")]}),m("input",{ref:i,type:"file",multiple:o,accept:r,style:{display:"none"},onChange:_,disabled:s}),a&&m("div",{style:{marginTop:J===f.SMALL?8:12,color:"#1677ff"},children:[A("正在上传...")," ",l,"%"]})]}),e&&e.length>0&&m("div",{style:{marginTop:J===f.SMALL?8:12},children:e.map((b,y)=>m("div",{style:c.fileItem,children:[m("div",{style:{display:"flex",alignItems:"center",flex:1},children:m("span",{style:{fontWeight:500,wordBreak:"break-all"},children:b.split("/").pop()})}),m("button",{type:"button",onClick:g=>{g.stopPropagation(),h(y)},style:c.removeBtn,disabled:s,children:A("移除")})]},b))})]})};function Xo(){const e=E("size");return{white:{label:{marginBottom:e===f.SMALL?6:8,fontSize:e===f.SMALL?12:14,color:"#222",textAlign:"left",display:"block"},input:{width:"100%",padding:e===f.SMALL?"8px 10px":"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #E5E6EB",background:"#fff",color:"#222",fontSize:e===f.SMALL?12:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},select:{width:"100%",padding:e===f.SMALL?"8px 10px":"10px 12px",borderRadius:6,border:"1px solid #E5E6EB",background:"#fff",color:"#222",fontSize:e===f.SMALL?12:15,outline:"none"},selectError:{border:"1px solid #ff4d4f"},upload:{border:"1px dashed #E5E6EB",borderRadius:8,background:"#FCFCFD",padding:e===f.SMALL?12:24,textAlign:"center",cursor:"pointer",minHeight:e===f.SMALL?100:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#999",fontSize:e===f.SMALL?12:15},uploadError:{border:"1px dashed #ff4d4f"},fileItem:{display:"flex",alignItems:"center",background:"#F7F8FA",borderRadius:8,padding:e===f.SMALL?"8px 10px":"12px 16px",marginBottom:e===f.SMALL?6:8,fontSize:e===f.SMALL?12:15,color:"#222",justifyContent:"space-between"},buttonCancel:{background:"#fff",color:"#222",border:"1px solid #E5E6EB",borderRadius:6,padding:e===f.SMALL?"6px 18px":"8px 24px",cursor:"pointer"},buttonSubmit:{background:"#1890ff",color:"#fff",border:"none",borderRadius:6,padding:e===f.SMALL?"6px 18px":"8px 24px",cursor:"pointer",fontWeight:600},removeBtn:{background:"#FF4D4F",color:"#fff",border:"none",borderRadius:6,padding:e===f.SMALL?"6px 18px":"4px 14px",fontSize:e===f.SMALL?12:15,marginLeft:e===f.SMALL?8:16,cursor:"pointer"},error:{color:"#ff4d4f",fontSize:e===f.SMALL?12:13,marginTop:e===f.SMALL?2:4,textAlign:"left"}},dark:{label:{marginBottom:e===f.SMALL?4:8,fontSize:e===f.SMALL?12:14,color:"#fff",textAlign:"left",display:"block"},input:{width:"100%",padding:e===f.SMALL?"8px 10px":"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #374151",background:"#23262F",color:"#fff",fontSize:e===f.SMALL?12:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},select:{width:"100%",padding:e===f.SMALL?"8px 10px":"10px 12px",borderRadius:6,border:"1px solid #374151",background:"#23262F",color:"#fff",fontSize:e===f.SMALL?12:15,outline:"none"},selectError:{border:"1px solid #ff4d4f"},upload:{border:"1px dashed #374151",borderRadius:8,background:"#181A20",padding:e===f.SMALL?12:24,textAlign:"center",cursor:"pointer",minHeight:e===f.SMALL?100:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#999",fontSize:e===f.SMALL?12:14},uploadError:{border:"1px dashed #ff4d4f"},fileItem:{display:"flex",alignItems:"center",background:"#23262F",borderRadius:8,padding:e===f.SMALL?"8px 10px":"12px 16px",marginBottom:e===f.SMALL?6:8,fontSize:e===f.SMALL?12:15,color:"#fff",justifyContent:"space-between"},buttonCancel:{background:"#23262F",color:"#fff",border:"none",borderRadius:6,padding:e===f.SMALL?"6px 18px":"8px 24px",fontSize:e===f.SMALL?12:15,cursor:"pointer"},buttonSubmit:{background:"#00E8C6",color:"#fff",border:"none",borderRadius:6,padding:e===f.SMALL?"6px 18px":"8px 24px",fontSize:e===f.SMALL?12:14,cursor:"pointer",fontWeight:600},removeBtn:{background:"#FF4D4F",color:"#fff",border:"none",borderRadius:6,padding:e===f.SMALL?"6px 18px":"4px 14px",fontSize:e===f.SMALL?12:15,marginLeft:e===f.SMALL?8:16,cursor:"pointer"},error:{color:"#ff4d4f",fontSize:e===f.SMALL?12:13,marginTop:e===f.SMALL?2:4,textAlign:"left"}}}}function Zo(){const e=E("theme"),t=E("themeConfig"),n=e===D.WHITE,r=Xo(),o=n?r.white:r.dark;if(console.log(t,"themeConfig"),t){const s=n?t.white:t.dark;if(s?.color)return{...o,buttonSubmit:{...o.buttonSubmit,background:s.color}}}return o}const Qo=({formState:e,setFormState:t,onClose:n,loading:r})=>{const o=JSON.parse(sessionStorage.getItem("all_dicts")||"{}");console.log(o,"allDicts");const s=o?.channel||[],i=Zo();return m("form",{onSubmit:async u=>{u.preventDefault();let l=!0;t(d=>({...d,platformError:"",transactionIdError:"",filesError:""})),e.platform||(t(d=>({...d,platformError:A("请选择支付平台")})),l=!1),e.transactionId.trim()||(t(d=>({...d,transactionIdError:A("请输入转账交易ID")})),l=!1),(!e.files||e.files.length===0)&&(t(d=>({...d,filesError:A("请上传转账凭证")})),l=!1),l&&(await To({transferChannel:e.platform,transferNo:e.transactionId,voucherUrls:e.files}),n(),Ye.success(A("离线充值创建成功")))},children:[m("div",{style:{marginBottom:18},children:[m("div",{style:i.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",A("第三方支付平台")]}),m(et,{value:e.platform,onChange:u=>{t(l=>({...l,platform:u,platformError:u?"":l.platformError}))},options:[...s?.map(u=>({value:u.value,label:u.label}))],placeholder:A("请选择支付平台")}),e.platformError&&m("div",{style:i.error,children:e.platformError})]}),m("div",{style:{marginBottom:18},children:[m("div",{style:i.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",A("交易ID")]}),m("input",{type:"text",placeholder:A("请输入转账交易ID"),value:e.transactionId,maxLength:200,onInput:u=>{let l=u.target.value;l.length>200&&(l=l.slice(0,200)),t(d=>({...d,transactionId:l,transactionIdError:l?"":d.transactionIdError}))},style:{...i.input,...e.transactionIdError?i.inputError:{}}}),e.transactionIdError&&m("div",{style:i.error,children:e.transactionIdError})]}),m("div",{style:{marginBottom:24},children:[m("div",{style:i.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",A("上传文件")]}),m(Ko,{value:e.files,onChange:u=>t(l=>({...l,files:u,filesError:""})),maxCount:10,accept:".jpg,.jpeg,.png,.pdf",multiple:!0}),e.filesError&&m("div",{style:i.error,children:e.filesError})]}),m("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[m("button",{type:"button",onClick:n,style:i.buttonCancel,children:A("取消")}),m("button",{type:"submit",disabled:r,style:i.buttonSubmit,children:A("确定")})]})]})};function Yo(){const e=E("size");return{white:{mask:"rgba(0, 0, 0, 0.45)",modalBg:"#fff",modalColor:"#222",modalBoxShadow:"0 6px 16px rgba(0, 0, 0, 0.12)",closeBtn:{position:"absolute",top:"16px",right:"16px",background:"none",border:"none",fontSize:e===f.SMALL?16:24,cursor:"pointer",color:"#999",padding:"0",width:e===f.SMALL?16:24,height:e===f.SMALL?16:24,display:"flex",alignItems:"center",justifyContent:"center"},title:{fontSize:e===f.SMALL?16:18,fontWeight:"600",marginBottom:e===f.SMALL?16:24,color:"#222"},tabBtn:(t,n)=>({flex:1,padding:e===f.SMALL?"8px 10px":"12px 16px",background:t?"#1890ff":"transparent",color:t?"#fff":"#666",border:"1px solid #d9d9d9",borderRight:n?"none":"1px solid #d9d9d9",cursor:"pointer",fontSize:e===f.SMALL?12:14,fontWeight:t?"600":"400",borderRadius:n?"6px 0 0 6px":"0 6px 6px 0"})},dark:{mask:"rgba(0, 0, 0, 0.65)",modalBg:"#23262F",modalColor:"#F5F6FA",modalBoxShadow:"0 6px 16px rgba(0,0,0,0.32)",closeBtn:{position:"absolute",top:e===f.SMALL?"12px":"16px",right:e===f.SMALL?"12px":"16px",background:"none",border:"none",fontSize:e===f.SMALL?16:24,cursor:"pointer",color:"#B5B8BE",padding:"0",width:e===f.SMALL?16:24,height:e===f.SMALL?16:24,display:"flex",alignItems:"center",justifyContent:"center"},title:{fontSize:e===f.SMALL?16:18,fontWeight:"600",marginBottom:e===f.SMALL?16:24,color:"#F5F6FA"},tabBtn:(t,n)=>({flex:1,padding:e===f.SMALL?"8px 10px":"12px 16px",background:t?"#00E8C6":"transparent",color:t?"#fff":"#B5B8BE",border:"1px solid #444C5C",borderRight:n?"none":"1px solid #444C5C",cursor:"pointer",fontSize:e===f.SMALL?12:14,fontWeight:t?"600":"400",borderRadius:n?"6px 0 0 6px":"0 6px 6px 0"})}}}function ei(){const t=E("theme")===D.WHITE,n=Yo();return t?n.white:n.dark}const _e=E("size");function ti({visible:e,onClose:t,title:n,children:r,width:o=_e===f.SMALL?300:400,maxWidth:s=_e===f.SMALL?300:400,showClose:i=!0,maskClosable:a=!0}){const[u,l]=F(!1),d=ei(),c=h=>{h.target===h.currentTarget?l(!0):l(!1)},_=h=>{h.target===h.currentTarget&&u&&a&&t(),l(!1)};return e?m("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:d.mask,display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999},onMouseDown:c,onMouseUp:_,children:m("div",{style:{background:d.modalBg,padding:_e===f.SMALL?24:32,borderRadius:_e===f.SMALL?8:12,minWidth:o,maxWidth:s,color:d.modalColor,boxShadow:d.modalBoxShadow,position:"relative"},onClick:h=>h.stopPropagation(),children:[i&&m("button",{type:"button",onClick:t,style:d.closeBtn,"aria-label":"关闭",children:"×"}),n&&m("div",{style:d.title,children:n}),r]})}):null}function ni(){const e=E("size");return{white:{tabBtn:(t,n)=>({flex:1,background:t?"#fff":"#F7F8FA",color:t?"#1890ff":"#222",border:"1px solid #F0F1F3",borderRadius:n?"8px 0 0 8px":"0 8px 8px 0",fontWeight:500,fontSize:e===f.SMALL?12:16,height:e===f.SMALL?32:48,boxShadow:t?"0 2px 8px 0 rgba(20,20,20,0.04)":"none",outline:"none",cursor:"pointer"})},dark:{tabBtn:(t,n)=>({flex:1,background:t?"#23262F":"#181A20",color:t?"#00E8C6":"#fff",border:"1px solid #444C5C",borderRadius:n?"8px 0 0 8px":"0 8px 8px 0",fontWeight:500,fontSize:e===f.SMALL?12:16,height:e===f.SMALL?32:48,boxShadow:t?"0 2px 8px 0 rgba(20,20,20,0.10)":"none",outline:"none",cursor:"pointer"})}}}function ri(){const e=E("theme"),t=E("themeConfig"),n=e===D.WHITE,r=ni(),o=n?r.white:r.dark;if(t){const s=n?t.white:t.dark;if(s?.color)return{...o,tabBtn:(i,a)=>({...o.tabBtn(i,a),color:i?s.color:o.tabBtn(i,a).color})}}return o}const oi=E("size");function ii({visible:e,onClose:t,onSubmit:n}){const[r,o]=F({amount:"",rechargeChannel:"",currency:"USD",loading:!1,error:"",amountError:"",rechargeChannelError:"",currencyError:""}),[s,i]=F({platform:"",transactionId:"",files:[],platformError:"",transactionIdError:"",filesError:"",loading:!1}),[a,u]=F("online"),l=ri();de(()=>{e||(u("online"),o({amount:"",rechargeChannel:"",currency:"USD",loading:!1,error:"",amountError:"",rechargeChannelError:"",currencyError:""}),i({platform:"",transactionId:"",files:[],platformError:"",transactionIdError:"",filesError:"",loading:!1}))},[e]);const d=async c=>{c.preventDefault();let _=!0;if(o(h=>({...h,amountError:"",rechargeChannelError:""})),r.amount.trim()||(o(h=>({...h,amountError:A("请输入充值金额")})),_=!1),r.rechargeChannel||(o(h=>({...h,rechargeChannelError:A("请选择支付平台")})),_=!1),!!_){o(h=>({...h,loading:!0,error:""}));try{await n({amount:r.amount,rechargeChannel:r.rechargeChannel,currency:r.currency}),t()}catch{o(h=>({...h,error:A("提交失败,请重试")}))}finally{o(h=>({...h,loading:!1}))}}};return m(ti,{visible:e,onClose:t,title:A("充值 / 转账"),children:[m("div",{style:{display:"flex",marginBottom:oi===f.SMALL?16:28},children:[m("button",{type:"button",onClick:()=>u("online"),style:l.tabBtn(a==="online",!0),children:A("在线充值")}),m("button",{type:"button",onClick:()=>u("offline"),style:l.tabBtn(a==="offline",!1),children:A("线下转账")})]}),a==="online"?m("form",{onSubmit:d,children:m(Jo,{formState:r,setFormState:o,onClose:t,loading:r.loading})}):m(Qo,{formState:s,setFormState:i,onClose:t,loading:s.loading})]})}function ct(){return(ct=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var si=["context","children"];function ai(e){this.getChildContext=function(){return e.context};var t=e.children,n=function(r,o){if(r==null)return{};var s,i,a={},u=Object.keys(r);for(i=0;i<u.length;i++)o.indexOf(s=u[i])>=0||(a[s]=r[s]);return a}(e,si);return En(t,n)}function li(){var e=new CustomEvent("_preact",{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(e),this._vdom=ee(ai,ct({},this._props,{context:e.detail.context}),function t(n,r){if(n.nodeType===3)return n.data;if(n.nodeType!==1)return null;var o=[],s={},i=0,a=n.attributes,u=n.childNodes;for(i=a.length;i--;)a[i].name!=="slot"&&(s[a[i].name]=a[i].value,s[Bn(a[i].name)]=a[i].value);for(i=u.length;i--;){var l=t(u[i],null),d=u[i].slot;d?s[d]=ee(Dt,{name:d},l):o[i]=l}var c=r?ee(Dt,null,o):o;return ee(r||n.nodeName.toLowerCase(),s,c)}(this,this._vdomComponent)),(this.hasAttribute("hydrate")?An:Ne)(this._vdom,this._root)}function Bn(e){return e.replace(/-(\w)/g,function(t,n){return n?n.toUpperCase():""})}function ci(e,t,n){if(this._vdom){var r={};r[e]=n=n??void 0,r[Bn(e)]=n,this._vdom=En(this._vdom,r),Ne(this._vdom,this._root)}}function ui(){Ne(this._vdom=null,this._root)}function Dt(e,t){var n=this;return ee("slot",ct({},e,{ref:function(r){r?(n.ref=r,n._listener||(n._listener=function(o){o.stopPropagation(),o.detail.context=t},r.addEventListener("_preact",n._listener))):n.ref.removeEventListener("_preact",n._listener)}}))}function ut(e,t,n,r){function o(){var s=Reflect.construct(HTMLElement,[],o);return s._vdomComponent=e,s._root=r&&r.shadow?s.attachShadow({mode:r.mode||"open"}):s,s}return(o.prototype=Object.create(HTMLElement.prototype)).constructor=o,o.prototype.connectedCallback=li,o.prototype.attributeChangedCallback=ci,o.prototype.disconnectedCallback=ui,n=n||e.observedAttributes||Object.keys(e.propTypes||{}),o.observedAttributes=n,n.forEach(function(s){Object.defineProperty(o.prototype,s,{get:function(){return this._vdom.props[s]},set:function(i){this._vdom?this.attributeChangedCallback(s,null,i):(this._props||(this._props={}),this._props[s]=i,this.connectedCallback());var a=typeof i;i!=null&&a!=="string"&&a!=="boolean"&&a!=="number"||this.setAttribute(s,i)}})}),customElements.define(t||e.tagName||e.displayName||e.name,o)}function di(){const[e,t]=F(!1),n=async r=>{const o=await Co({amount:r.amount,currency:r.currency,rechargeChannel:r.rechargeChannel});window.open(o,"_blank")};return m("div",{children:[m(Mn,{onClick:()=>t(!0),children:A("充值/转账")}),m(ii,{visible:e,onClose:()=>t(!1),onSubmit:n})]})}ut(di,"best-recharge",["theme"],{shadow:!1});const zt={white:{popover:{background:"#fff",color:"#222",boxShadow:"0 4px 16px rgba(0,0,0,0.12)",border:"none"},arrow:{top:"#fff",bottom:"#fff",left:"#fff",right:"#fff"}},dark:{popover:{background:"#23262F",color:"#fff",boxShadow:"0 4px 16px rgba(0,0,0,0.32)",border:"1px solid #444C5C"},arrow:{top:"#23262F",bottom:"#23262F",left:"#23262F",right:"#23262F"}}};function fi(){return E("theme")===D.WHITE?zt.white:zt.dark}const V=E("size"),pi=({popover:e,children:t,popoverWidth:n=V===f.SMALL?200:300,popoverMinWidth:r=V===f.SMALL?150:200,offsetY:o=V===f.SMALL?8:16,offsetX:s=V===f.SMALL?8:16,popoverPosition:i="top"})=>{const[a,u]=F(!1),[l,d]=F(i),c=Te(null),_=Te(null),h=fi(),b=()=>{if(_.current&&(clearTimeout(_.current),_.current=null),i==="top"||i==="bottom")if(c.current){const S=c.current.getBoundingClientRect();i==="top"&&S.top<100?d("bottom"):i==="bottom"&&window.innerHeight-S.bottom<100?d("top"):d(i)}else d(i);else d(i);u(!0)},y=()=>{_.current=window.setTimeout(()=>{u(!1)},120)};let g={position:"absolute",zIndex:999,borderRadius:6,fontSize:V===f.SMALL?12:15,minWidth:r,width:n,padding:V===f.SMALL?"6px 12px":"8px 14px",pointerEvents:"auto",textAlign:"center",animation:"fadeInUp 0.3s",...h.popover},x={position:"absolute",zIndex:11,width:0,height:0};return l==="top"?(g={...g,left:"50%",top:-48,transform:"translateX(-50%)"},x={...x,left:"50%",bottom:-8,transform:"translateX(-50%)",borderLeft:"8px solid transparent",borderRight:"8px solid transparent",borderTop:`8px solid ${h.arrow.top}`}):l==="bottom"?(g={...g,left:"50%",top:"100%",marginTop:o,transform:"translateX(-50%)"},x={...x,left:"50%",top:-8,transform:"translateX(-50%)",borderLeft:"8px solid transparent",borderRight:"8px solid transparent",borderBottom:`8px solid ${h.arrow.bottom}`}):l==="leftTop"?(g={...g,right:"100%",top:0,marginRight:s,transform:"none"},x={...x,right:-8,top:V===f.SMALL?8:12,borderTop:"8px solid transparent",borderBottom:"8px solid transparent",borderLeft:`8px solid ${h.arrow.left}`}):l==="rightTop"&&(g={...g,left:"100%",top:0,marginLeft:s,transform:"translateY(0)"},x={...x,left:-8,top:12,borderTop:"8px solid transparent",borderBottom:"8px solid transparent",borderRight:`8px solid ${h.arrow.right}`}),m("div",{ref:c,style:{position:"relative",display:"inline-block"},onMouseEnter:b,onMouseLeave:y,children:[t,a&&m("div",{style:g,onMouseEnter:b,onMouseLeave:y,children:[e,m("div",{style:x})]})]})};function hi(){const e=E("size");return{white:{popoverTitle:{fontSize:e===f.SMALL?12:16,fontWeight:600,color:"#222",marginBottom:e===f.SMALL?12:16,textAlign:"center"},detailRow:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:e===f.SMALL?"6px 0":"8px 0",borderBottom:"1px solid #e5e7eb",fontSize:e===f.SMALL?12:15},detailLabel:{display:"flex",alignItems:"center",color:"#6b7280",fontWeight:500},detailDot:t=>({display:"inline-block",width:e===f.SMALL?6:8,height:e===f.SMALL?6:8,borderRadius:"50%",background:t,marginRight:e===f.SMALL?6:8}),detailValue:t=>({color:t,fontWeight:600,fontSize:e===f.SMALL?12:15}),main:{fontSize:e===f.SMALL?18:24,fontWeight:800,color:"#111827",display:"inline-block"},currency:{fontSize:e===f.SMALL?16:18,color:"#6b7280",marginLeft:e===f.SMALL?6:8,fontWeight:600}},dark:{popoverTitle:{fontSize:e===f.SMALL?14:16,fontWeight:600,color:"#fff",marginBottom:e===f.SMALL?14:16,textAlign:"center"},detailRow:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:e===f.SMALL?"6px 0":"8px 0",borderBottom:"1px solid #374151",fontSize:e===f.SMALL?12:15},detailLabel:{display:"flex",alignItems:"center",color:"#B5B8BE",fontWeight:500},detailDot:t=>({display:"inline-block",width:e===f.SMALL?6:8,height:e===f.SMALL?6:8,borderRadius:"50%",background:t,marginRight:e===f.SMALL?6:8}),detailValue:t=>({color:t,fontWeight:600,fontSize:e===f.SMALL?12:15}),main:{fontSize:e===f.SMALL?18:24,fontWeight:800,color:"#fff",display:"inline-block"},currency:{fontSize:e===f.SMALL?16:18,color:"#B5B8BE",marginLeft:e===f.SMALL?6:8,fontWeight:600}}}}function mi(){const t=E("theme")===D.WHITE,n=hi();return t?n.white:n.dark}function Ut(e){return e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}function _i(e){const[t,n]=F({available:0,currency:"USD",symbol:"$",details:[]}),r=async()=>{try{const i=await Cn(),a=[{label:"",value:i.totalAmount,color:"#15b36b",dot:"#15b36b"},{label:"",value:i.frozenAmount,color:"#f59e0b",dot:"#f59e0b"},...i.isCredit?[{label:"",value:i.creditLimit,color:"#1890ff",dot:"#1890ff"},{label:"",value:i.creditUsed,color:"#ff0000",dot:"#ff0000"}]:[],{label:"",value:i.availableAmount,color:"#1890ff",dot:"#15b36b"}],u={available:i.availableAmount,currency:"USD",symbol:"$",details:a};n(u)}catch(i){console.error("获取余额失败:",i)}};de(()=>{r()},[]),de(()=>{const i=()=>{r()};return document.addEventListener("refresh-balance",i),()=>{document.removeEventListener("refresh-balance",i)}},[]);const o=mi(),s=[{label:A("真实金额"),value:t.details[0]?.value||0,color:"#15b36b",dot:"#15b36b"},{label:A("冻结金额"),value:t.details[1]?.value||0,color:"#f59e0b",dot:"#f59e0b"},...t.details.length>4?[{label:A("信用额度"),value:t.details[2]?.value||0,color:"#1890ff",dot:"#1890ff"},{label:A("已用额度"),value:t.details[3]?.value||0,color:"#ff0000",dot:"#ff0000"}]:[],{label:A("可用余额"),value:t.details[t.details.length-1]?.value||0,color:"#1890ff",dot:"#15b36b"}];return m(pi,{popover:m(Q,{children:[m("div",{style:o.popoverTitle,children:A("余额详情")}),s.map(i=>m("div",{style:o.detailRow,children:[m("span",{style:o.detailLabel,children:[m("span",{style:o.detailDot(i.dot)}),i.label]}),m("span",{style:o.detailValue(i.color),children:[t.symbol,Ut(i.value)]})]},i.label))]}),popoverPosition:e.popoverPosition||"bottom",children:m("div",{style:o.main,children:[t.symbol,Ut(t.available),m("span",{style:o.currency,children:t.currency})]})})}ut(_i,"best-statistical-balance");const ge={white:{background:"#1890ff",color:"#fff",border:"none",borderRadius:6,cursor:"pointer",fontWeight:600,transition:"all 0.2s ease"},dark:{background:"#00E8C6",color:"#fff",border:"none",borderRadius:6,cursor:"pointer",fontWeight:600,transition:"all 0.2s ease"}};function gi(e){return E("theme")===D.WHITE?{...ge.white,background:e||ge.white.background}:{...ge.dark,background:e||ge.dark.background}}function bi(e){switch(e){case"small":return{fontSize:"12px",gap:"2px"};case"large":return{fontSize:"18px",gap:"6px"};default:return{fontSize:"14px",gap:"4px"}}}function yi({color:e,size:t="medium",children:n}){const[r,o]=F(!1),s=gi(e),i=bi(t),a={...s,...i,display:"flex",alignItems:"center"};return m(Q,{children:[m("style",{children:`
|
|
61
61
|
@keyframes spin {
|
|
62
62
|
from {
|
|
63
63
|
transform: rotate(0deg);
|
package/dist/best-unit.js
CHANGED
|
@@ -3808,13 +3808,13 @@ function Zo() {
|
|
|
3808
3808
|
color: t ? "#1890ff" : "#222",
|
|
3809
3809
|
border: "1px solid #F0F1F3",
|
|
3810
3810
|
borderRadius: n ? "8px 0 0 8px" : "0 8px 8px 0",
|
|
3811
|
-
fontWeight:
|
|
3811
|
+
fontWeight: 500,
|
|
3812
3812
|
fontSize: e === f.SMALL ? 12 : 16,
|
|
3813
3813
|
height: e === f.SMALL ? 32 : 48,
|
|
3814
3814
|
boxShadow: t ? "0 2px 8px 0 rgba(20,20,20,0.04)" : "none",
|
|
3815
3815
|
outline: "none",
|
|
3816
|
-
cursor: "pointer"
|
|
3817
|
-
transition: "
|
|
3816
|
+
cursor: "pointer"
|
|
3817
|
+
// transition: "background-color 0.2s, color 0.2s, box-shadow 0.2s",
|
|
3818
3818
|
})
|
|
3819
3819
|
},
|
|
3820
3820
|
dark: {
|
|
@@ -3824,13 +3824,13 @@ function Zo() {
|
|
|
3824
3824
|
color: t ? "#00E8C6" : "#fff",
|
|
3825
3825
|
border: "1px solid #444C5C",
|
|
3826
3826
|
borderRadius: n ? "8px 0 0 8px" : "0 8px 8px 0",
|
|
3827
|
-
fontWeight:
|
|
3827
|
+
fontWeight: 500,
|
|
3828
3828
|
fontSize: e === f.SMALL ? 12 : 16,
|
|
3829
3829
|
height: e === f.SMALL ? 32 : 48,
|
|
3830
3830
|
boxShadow: t ? "0 2px 8px 0 rgba(20,20,20,0.10)" : "none",
|
|
3831
3831
|
outline: "none",
|
|
3832
|
-
cursor: "pointer"
|
|
3833
|
-
transition: "
|
|
3832
|
+
cursor: "pointer"
|
|
3833
|
+
// transition: "background-color 0.2s, color 0.2s, box-shadow 0.2s",
|
|
3834
3834
|
})
|
|
3835
3835
|
}
|
|
3836
3836
|
};
|
package/package.json
CHANGED
|
@@ -13,13 +13,13 @@ function createRechargeThemes() {
|
|
|
13
13
|
color: active ? "#1890ff" : "#222",
|
|
14
14
|
border: "1px solid #F0F1F3",
|
|
15
15
|
borderRadius: left ? "8px 0 0 8px" : "0 8px 8px 0",
|
|
16
|
-
fontWeight:
|
|
16
|
+
fontWeight: 500,
|
|
17
17
|
fontSize: size === Size.SMALL ? 12 : 16,
|
|
18
18
|
height: size === Size.SMALL ? 32 : 48,
|
|
19
19
|
boxShadow: active ? "0 2px 8px 0 rgba(20,20,20,0.04)" : "none",
|
|
20
20
|
outline: "none",
|
|
21
21
|
cursor: "pointer",
|
|
22
|
-
transition: "
|
|
22
|
+
// transition: "background-color 0.2s, color 0.2s, box-shadow 0.2s",
|
|
23
23
|
}),
|
|
24
24
|
},
|
|
25
25
|
dark: {
|
|
@@ -29,13 +29,13 @@ function createRechargeThemes() {
|
|
|
29
29
|
color: active ? "#00E8C6" : "#fff",
|
|
30
30
|
border: "1px solid #444C5C",
|
|
31
31
|
borderRadius: left ? "8px 0 0 8px" : "0 8px 8px 0",
|
|
32
|
-
fontWeight:
|
|
32
|
+
fontWeight: 500,
|
|
33
33
|
fontSize: size === Size.SMALL ? 12 : 16,
|
|
34
34
|
height: size === Size.SMALL ? 32 : 48,
|
|
35
35
|
boxShadow: active ? "0 2px 8px 0 rgba(20,20,20,0.10)" : "none",
|
|
36
36
|
outline: "none",
|
|
37
37
|
cursor: "pointer",
|
|
38
|
-
transition: "
|
|
38
|
+
// transition: "background-color 0.2s, color 0.2s, box-shadow 0.2s",
|
|
39
39
|
}),
|
|
40
40
|
},
|
|
41
41
|
};
|