best-unit 1.0.5 → 1.0.6

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.
@@ -57,4 +57,4 @@
57
57
  .custom-select-dropdown::-webkit-scrollbar-track {
58
58
  background: ${h?"#f5f5f5":"#23262F"};
59
59
  }
60
- `}),m("div",{onClick:()=>!s&&_(E=>!E),style:{minHeight:40,borderRadius:6,display:"flex",alignItems:"center",padding:"0 12px",fontSize:15,cursor:s?"not-allowed":"pointer",boxSizing:"border-box",transition:"border 0.2s",opacity:s?.6:1,width:"100%",...y.trigger,...o},tabIndex:0,children:[m("span",{style:{flex:1},children:w?w.label:m("span",{style:y.placeholder,children:r||"请选择"})}),m("span",{style:{marginLeft:8,display:"flex",alignItems:"center"},children:m("svg",{width:"20",height:"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&&!s&&m("div",{className:`custom-select-dropdown${u?" "+u:""}`,style:{position:"absolute",left:0,right:0,top:44,zIndex:10,borderRadius:6,boxShadow:h?"0 2px 8px rgba(0,0,0,0.08)":"0 2px 8px rgba(0,0,0,0.32)",maxHeight:220,overflowY:"auto",...y.dropdown,...a},children:[n.length===0&&m("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:120,width:"100%",userSelect:"none"},children:[m("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg",children:[m("title",{children:S("暂无数据")}),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:15},children:S("暂无数据")})]}),n.map((E,T)=>m("div",{onClick:()=>{E.disabled||(_(!1),t?.(E.value))},onMouseEnter:()=>x(T),onMouseLeave:()=>x(null),style:{padding:"10px 16px",cursor:E.disabled?"not-allowed":"pointer",fontWeight:e===E.value?600:400,opacity:E.disabled?.6:1,...y.option(e===E.value,!!E.disabled,g===T)},children:E.label},E.value))]}),f]})};function Ro(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 ko(e){if(!e)return"";const t=parseFloat(e);return isNaN(t)?"":t.toFixed(2)}const Co=({formState:e,setFormState:t,onClose:n,loading:r})=>{const o=JSON.parse(sessionStorage.getItem("all_dicts")||"{}"),i=o?.currency||[],s=o?.channel?.filter(p=>p.payment_support)||[],l=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").theme===H.WHITE,[u,f]=P(""),[c,_]=P(!1);Oe(()=>{e.currency&&e.amount&&e.rechargeChannel?go({channel:e.rechargeChannel,amount:e.amount,currency:e.currency}).then(p=>{f(p),_(!0)}).catch(p=>{console.error("计算支付金额失败:",p),_(!1)}):_(!1)},[e.currency,e.amount,e.rechargeChannel]);const b=l?{label:{marginBottom:8,fontSize:14,color:"#222",textAlign:"left",display:"block"},input:{width:"100%",padding:"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #E5E6EB",background:"#fff",color:"#222",fontSize:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},error:{color:"#ff4d4f",fontSize:13,marginTop:4,textAlign:"left"}}:{label:{marginBottom:8,fontSize:14,color:"#fff",textAlign:"left",display:"block"},input:{width:"100%",padding:"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #23262F",background:"#23262F",color:"#fff",fontSize:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},error:{color:"#ff4d4f",fontSize:13,marginTop:4,textAlign:"left"}},g=l?{background:"#fff",color:"#222",border:"1px solid #E5E6EB",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer"}:{background:"#23262F",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer"},x=l?{background:"#1890ff",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer",fontWeight:600}:{background:"#00E8C6",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer",fontWeight:600};return m(Q,{children:[m("div",{style:{marginBottom:18},children:[m("div",{style:b.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",S("充值币种")]}),m(Ve,{value:e.currency,onChange:p=>{t(h=>({...h,currency:p}))},options:i?.map(p=>({value:p.value,label:p.label})),placeholder:S("请选择充值币种")})]}),m("div",{style:{marginBottom:18},children:[m("div",{style:b.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",S("充值金额")]}),m("input",{type:"text",placeholder:S("请输入充值金额"),value:e.amount,onInput:p=>{let h=p.target.value;h=Ro(h);let y="";if(h&&!h.endsWith(".")){let w=parseFloat(h);if(!isNaN(w)&&(w<1&&(w=1),w>999999.99&&(w=999999.99),h=w.toString(),/\./.test(p.target.value))){const E=p.target.value.split(".")[1];E!==void 0&&E.length>0&&(h=w.toFixed(Math.min(E.length,2)))}}t(w=>({...w,amount:h,amountError:y}))},onBlur:p=>{let h=p.target.value;h=ko(h),t(y=>({...y,amount:h,amountError:""}))},style:{...b.input,...e.amountError?b.inputError:{}}}),e.amountError&&m("div",{style:b.error,children:e.amountError})]}),m("div",{style:{marginBottom:24},children:[m("div",{style:b.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",S("支付平台")]}),m(Ve,{value:e.rechargeChannel,onChange:p=>{t(h=>({...h,rechargeChannel:p,rechargeChannelError:p?"":h.rechargeChannelError}))},options:s?.map(p=>({value:p.value,label:p.label})),placeholder:S("请选择支付平台")}),e.rechargeChannelError&&m("div",{style:b.error,children:e.rechargeChannelError})]}),c&&u&&m("div",{style:{marginBottom:24,padding:"12px 16px",background:l?"#f6ffed":"#1a1a1a",border:`1px solid ${l?"#b7eb8f":"#333"}`,borderRadius:6,fontSize:14,color:"#52c41a"},children:[s.find(p=>p.value===e.rechargeChannel)?.label||e.rechargeChannel,S("需要收取手续费,实际支付金额约为:"),"$",u]}),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:g,children:S("取消")}),m("button",{type:"submit",disabled:r,style:x,children:S(r?"提交中...":"去支付")})]})]})},Ao={white:{container:{border:"1px dashed #E5E6EB",borderRadius:8,background:"#FCFCFD",padding:24,textAlign:"center",cursor:"pointer",minHeight:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#999",fontSize:15},fileItem:{display:"flex",alignItems:"center",background:"#F7F8FA",borderRadius:8,padding:"12px 16px",marginBottom:8,fontSize:15,color:"#222",justifyContent:"space-between"},removeBtn:{background:"#FF4D4F",color:"#fff",border:"none",borderRadius:6,padding:"4px 14px",fontSize:15,marginLeft:16,cursor:"pointer"}},dark:{container:{border:"1.5px dashed #444C5C",borderRadius:8,background:"#181A20",padding:24,textAlign:"center",cursor:"pointer",minHeight:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#999",fontSize:15},fileItem:{display:"flex",alignItems:"center",background:"#23262F",borderRadius:8,padding:"12px 16px",marginBottom:8,fontSize:15,color:"#fff",justifyContent:"space-between"},removeBtn:{background:"#FF4D4F",color:"#fff",border:"none",borderRadius:6,padding:"4px 14px",fontSize:15,marginLeft:16,cursor:"pointer"}}},Oo=({value:e=[],onChange:t,maxCount:n=10,accept:r=".jpg,.jpeg,.png,.pdf",multiple:o=!0,disabled:i=!1})=>{const s=we(null),[a,l]=P(!1),[u,f]=P(0),b=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").theme===H.WHITE?"white":"dark",g=Ao[b],x=async h=>{const y=Array.from(h.target.files).slice(0,n);if(!y.length)return;l(!0);const w=[];for(let E=0;E<y.length;E++){f(0);const T=new FormData;T.append("file",y[E]);try{const k=await ho(T,I=>f(I));k&&w.push(k)}catch{}}l(!1),f(0),t?.([...e,...w]),s.current&&(s.current.value="")},p=h=>{const y=e.filter((w,E)=>E!==h);t?.(y)};return m("div",{children:[m("div",{style:{...g.container,cursor:i?"not-allowed":g.container.cursor,opacity:i?.6:1},onClick:()=>!i&&s.current?.click(),children:[m("div",{style:{fontSize:48,marginBottom:12},children:"📁"}),m("div",{style:{color:"#222",fontSize:15,marginBottom:4},children:S("点击或拖拽文件到此处上传")}),m("div",{style:{color:"#999",fontSize:13},children:[S("支持 JPG、PNG、PDF 格式,单个文件不超过 20MB,最多上传")," ",n," ",S("个文件")]}),m("input",{ref:s,type:"file",multiple:o,accept:r,style:{display:"none"},onChange:x,disabled:i}),a&&m("div",{style:{marginTop:12,color:"#1677ff"},children:[S("正在上传...")," ",u,"%"]})]}),e&&e.length>0&&m("div",{style:{marginTop:12},children:e.map((h,y)=>m("div",{style:g.fileItem,children:[m("div",{style:{display:"flex",alignItems:"center",flex:1},children:[m("span",{style:{fontWeight:500,wordBreak:"break-all"},children:h.split("/").pop()}),m("span",{style:{color:"#8C8F93",fontSize:13,marginLeft:8},children:["[",S("已上传"),"]"]})]}),m("button",{type:"button",onClick:w=>{w.stopPropagation(),p(y)},style:g.removeBtn,disabled:i,children:S("移除")})]},h))})]})},Fo=({formState:e,setFormState:t,onClose:n,loading:r})=>{const o=JSON.parse(sessionStorage.getItem("all_dicts")||"{}");console.log(o,"allDicts");const i=o?.channel||[],l=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").theme===H.WHITE?{label:{marginBottom:8,fontSize:14,color:"#222",textAlign:"left",display:"block"},input:{width:"100%",padding:"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #E5E6EB",background:"#fff",color:"#222",fontSize:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},buttonCancel:{background:"#fff",color:"#222",border:"1px solid #E5E6EB",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer"},buttonSubmit:{background:"#1890ff",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer",fontWeight:600},error:{color:"#ff4d4f",fontSize:13,marginTop:4,textAlign:"left"}}:{label:{marginBottom:8,fontSize:14,color:"#fff",textAlign:"left",display:"block"},input:{width:"100%",padding:"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #23262F",background:"#23262F",color:"#fff",fontSize:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},buttonCancel:{background:"#23262F",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer"},buttonSubmit:{background:"#00E8C6",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer",fontWeight:600},error:{color:"#ff4d4f",fontSize:13,marginTop:4,textAlign:"left"}};return m("form",{onSubmit:async f=>{f.preventDefault();let c=!0;t(_=>({..._,platformError:"",transactionIdError:"",filesError:""})),e.platform||(t(_=>({..._,platformError:S("请选择支付平台")})),c=!1),e.transactionId.trim()||(t(_=>({..._,transactionIdError:S("请输入转账交易ID")})),c=!1),(!e.files||e.files.length===0)&&(t(_=>({..._,filesError:S("请上传转账凭证")})),c=!1),c&&(await mo({transferChannel:e.platform,transferNo:e.transactionId,voucherUrls:e.files}),n(),Je.success(S("离线充值创建成功")))},children:[m("div",{style:{marginBottom:18},children:[m("div",{style:l.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",S("第三方支付平台")]}),m(Ve,{value:e.platform,onChange:f=>{t(c=>({...c,platform:f,platformError:f?"":c.platformError}))},options:[...i?.map(f=>({value:f.value,label:f.label}))],placeholder:S("请选择支付平台")}),e.platformError&&m("div",{style:l.error,children:e.platformError})]}),m("div",{style:{marginBottom:18},children:[m("div",{style:l.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",S("交易ID")]}),m("input",{type:"text",placeholder:S("请输入转账交易ID"),value:e.transactionId,maxLength:200,onInput:f=>{let c=f.target.value;c.length>200&&(c=c.slice(0,200)),t(_=>({..._,transactionId:c,transactionIdError:c?"":_.transactionIdError}))},style:{...l.input,...e.transactionIdError?l.inputError:{}}}),e.transactionIdError&&m("div",{style:l.error,children:e.transactionIdError})]}),m("div",{style:{marginBottom:24},children:[m("div",{style:l.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",S("上传文件")]}),m(Oo,{value:e.files,onChange:f=>t(c=>({...c,files:f,filesError:""})),maxCount:10,accept:".jpg,.jpeg,.png,.pdf",multiple:!0}),e.filesError&&m("div",{style:l.error,children:e.filesError})]}),m("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[m("button",{type:"button",onClick:n,style:l.buttonCancel,children:S("取消")}),m("button",{type:"submit",disabled:r,style:l.buttonSubmit,children:S("去支付")})]})]})};function Po({visible:e,onClose:t,onSubmit:n}){const[r,o]=P({amount:"",rechargeChannel:"",currency:"USD",loading:!1,error:"",amountError:"",rechargeChannelError:"",currencyError:""}),[i,s]=P("online"),[a,l]=P({platform:"",transactionId:"",files:[],platformError:"",transactionIdError:"",filesError:"",loading:!1});if(Oe(()=>{e||(s("online"),o({amount:"",rechargeChannel:"",currency:"USD",loading:!1,error:"",amountError:"",rechargeChannelError:"",currencyError:""}),l({platform:"",transactionId:"",files:[],platformError:"",transactionIdError:"",filesError:"",loading:!1}))},[e]),!e)return null;const u=async h=>{h.preventDefault();let y=!0;if(o(w=>({...w,amountError:"",rechargeChannelError:""})),r.amount.trim()||(o(w=>({...w,amountError:S("请输入充值金额")})),y=!1),r.rechargeChannel||(o(w=>({...w,rechargeChannelError:S("请选择支付平台")})),y=!1),!!y){o(w=>({...w,loading:!0,error:""}));try{await n({amount:r.amount,rechargeChannel:r.rechargeChannel,currency:r.currency}),t()}catch{o(w=>({...w,error:S("提交失败,请重试")}))}finally{o(w=>({...w,loading:!1}))}}},[f,c]=P(!1),_=h=>{h.target===h.currentTarget?c(!0):c(!1)},b=h=>{h.target===h.currentTarget&&f&&t(),c(!1)},p=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").theme===H.WHITE?{modalBg:"#fff",modalColor:"#222",modalBoxShadow:"0 4px 24px rgba(0,0,0,0.08)",mask:"rgba(0,0,0,0.3)",title:{fontWeight:600,fontSize:20,marginBottom:24,textAlign:"left",color:"#222"},closeBtn:{position:"absolute",right:16,top:16,background:"none",border:"none",color:"#222",fontSize:22,cursor:"pointer",lineHeight:1},tabBtn:(h,y)=>({flex:1,background:h?"#fff":"#F7F8FA",color:h?"#1890ff":"#222",border:"none",borderRadius:y?"8px 0 0 8px":"0 8px 8px 0",fontWeight:h?600:400,fontSize:16,height:48,boxShadow:h?"0 2px 8px 0 rgba(20,20,20,0.04)":"none",outline:"none",cursor:"pointer",borderRight:y?"1px solid #F0F1F3":void 0,borderLeft:y?void 0:"1px solid #F0F1F3",transition:"all 0.2s"})}:{modalBg:"#181A20",modalColor:"#fff",modalBoxShadow:"0 4px 24px rgba(0,0,0,0.5)",mask:"rgba(0,0,0,0.7)",title:{fontWeight:600,fontSize:20,marginBottom:24,textAlign:"left",color:"#fff"},closeBtn:{position:"absolute",right:16,top:16,background:"none",border:"none",color:"#fff",fontSize:22,cursor:"pointer",lineHeight:1},tabBtn:(h,y)=>({flex:1,background:h?"#23262F":"#181A20",color:h?"#00E8C6":"#fff",border:"none",borderRadius:y?"8px 0 0 8px":"0 8px 8px 0",fontWeight:h?600:400,fontSize:16,height:48,boxShadow:h?"0 2px 8px 0 rgba(20,20,20,0.10)":"none",outline:"none",cursor:"pointer",borderRight:y?"1px solid #23262F":void 0,borderLeft:y?void 0:"1px solid #23262F",transition:"all 0.2s"})};return m("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:p.mask,display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999},onMouseDown:_,onMouseUp:b,children:m("form",{onSubmit:u,style:{background:p.modalBg,padding:32,borderRadius:12,minWidth:400,maxWidth:400,color:p.modalColor,boxShadow:p.modalBoxShadow,position:"relative"},onClick:h=>h.stopPropagation(),children:[m("button",{type:"button",onClick:t,style:p.closeBtn,"aria-label":S("关闭"),children:"×"}),m("div",{style:p.title,children:S("充值 / 转账")}),m("div",{style:{display:"flex",marginBottom:28},children:[m("button",{type:"button",onClick:()=>s("online"),style:p.tabBtn(i==="online",!0),children:S("在线充值")}),m("button",{type:"button",onClick:()=>s("offline"),style:p.tabBtn(i==="offline",!1),children:S("线下转账")})]}),i==="online"?m(Co,{formState:r,setFormState:o,onClose:t,loading:r.loading}):m(Fo,{formState:a,setFormState:l,onClose:t,loading:a.loading})]})})}function nt(){return(nt=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 Bo=["context","children"];function No(e){this.getChildContext=function(){return e.context};var t=e.children,n=function(r,o){if(r==null)return{};var i,s,a={},l=Object.keys(r);for(s=0;s<l.length;s++)o.indexOf(i=l[s])>=0||(a[i]=r[i]);return a}(e,Bo);return hn(t,n)}function Io(){var e=new CustomEvent("_preact",{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(e),this._vdom=G(No,nt({},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=[],i={},s=0,a=n.attributes,l=n.childNodes;for(s=a.length;s--;)a[s].name!=="slot"&&(i[a[s].name]=a[s].value,i[bn(a[s].name)]=a[s].value);for(s=l.length;s--;){var u=t(l[s],null),f=l[s].slot;f?i[f]=G(Ct,{name:f},u):o[s]=u}var c=r?G(Ct,null,o):o;return G(r||n.nodeName.toLowerCase(),i,c)}(this,this._vdomComponent)),(this.hasAttribute("hydrate")?pn:Ae)(this._vdom,this._root)}function bn(e){return e.replace(/-(\w)/g,function(t,n){return n?n.toUpperCase():""})}function Do(e,t,n){if(this._vdom){var r={};r[e]=n=n??void 0,r[bn(e)]=n,this._vdom=hn(this._vdom,r),Ae(this._vdom,this._root)}}function Uo(){Ae(this._vdom=null,this._root)}function Ct(e,t){var n=this;return G("slot",nt({},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 yn(e,t,n,r){function o(){var i=Reflect.construct(HTMLElement,[],o);return i._vdomComponent=e,i._root=r&&r.shadow?i.attachShadow({mode:r.mode||"open"}):i,i}return(o.prototype=Object.create(HTMLElement.prototype)).constructor=o,o.prototype.connectedCallback=Io,o.prototype.attributeChangedCallback=Do,o.prototype.disconnectedCallback=Uo,n=n||e.observedAttributes||Object.keys(e.propTypes||{}),o.observedAttributes=n,n.forEach(function(i){Object.defineProperty(o.prototype,i,{get:function(){return this._vdom.props[i]},set:function(s){this._vdom?this.attributeChangedCallback(i,null,s):(this._props||(this._props={}),this._props[i]=s,this.connectedCallback());var a=typeof s;s!=null&&a!=="string"&&a!=="boolean"&&a!=="number"||this.setAttribute(i,s)}})}),customElements.define(t||e.tagName||e.displayName||e.name,o)}function Lo(){const[e,t]=P(!1),n=async r=>{const o=await _o({amount:r.amount,currency:r.currency,rechargeChannel:r.rechargeChannel});window.open(o,"_blank")};return m("div",{children:[m(wo,{onClick:()=>t(!0),children:S("充值/转账")}),m(Po,{visible:e,onClose:()=>t(!1),onSubmit:n})]})}yn(Lo,"best-recharge",["theme"],{shadow:!1});const zo=({popover:e,children:t,popoverWidth:n=300,popoverMinWidth:r=200,offsetY:o=16,offsetX:i=16,popoverPosition:s="top"})=>{const[a,l]=P(!1),[u,f]=P(s),c=we(null),_=we(null),b=()=>{if(_.current&&(clearTimeout(_.current),_.current=null),s==="top"||s==="bottom")if(c.current){const T=c.current.getBoundingClientRect();s==="top"&&T.top<100?f("bottom"):s==="bottom"&&window.innerHeight-T.bottom<100?f("top"):f(s)}else f(s);else f(s);l(!0)},g=()=>{_.current=window.setTimeout(()=>{l(!1)},120)},x={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"}}},h=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").theme===H.WHITE,y=x[h?"white":"dark"];let w={position:"absolute",zIndex:999,borderRadius:6,fontSize:15,minWidth:r,width:n,padding:"8px 14px",pointerEvents:"auto",textAlign:"center",animation:"fadeInUp 0.3s",...y.popover},E={position:"absolute",zIndex:11,width:0,height:0};return u==="top"?(w={...w,left:"50%",top:-48,transform:"translateX(-50%)"},E={...E,left:"50%",bottom:-8,transform:"translateX(-50%)",borderLeft:"8px solid transparent",borderRight:"8px solid transparent",borderTop:`8px solid ${y.arrow.top}`}):u==="bottom"?(w={...w,left:"50%",top:"100%",marginTop:o,transform:"translateX(-50%)"},E={...E,left:"50%",top:-8,transform:"translateX(-50%)",borderLeft:"8px solid transparent",borderRight:"8px solid transparent",borderBottom:`8px solid ${y.arrow.bottom}`}):u==="leftTop"?(w={...w,right:"100%",top:0,marginRight:i,transform:"none"},E={...E,right:-8,top:12,borderTop:"8px solid transparent",borderBottom:"8px solid transparent",borderLeft:`8px solid ${y.arrow.left}`}):u==="rightTop"&&(w={...w,left:"100%",top:0,marginLeft:i,transform:"translateY(0)"},E={...E,left:-8,top:12,borderTop:"8px solid transparent",borderBottom:"8px solid transparent",borderRight:`8px solid ${y.arrow.right}`}),m("div",{ref:c,style:{position:"relative",display:"inline-block"},onMouseEnter:b,onMouseLeave:g,children:[t,a&&m("div",{style:w,onMouseEnter:b,onMouseLeave:g,children:[e,m("div",{style:E})]})]})};function At(e){return e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}const Ho={white:{popoverTitle:{fontSize:16,fontWeight:600,color:"#222",marginBottom:16,textAlign:"center"},detailRow:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 0",borderBottom:"1px solid #e5e7eb",fontSize:15},detailLabel:{display:"flex",alignItems:"center",color:"#6b7280",fontWeight:500},detailDot:e=>({display:"inline-block",width:8,height:8,borderRadius:"50%",background:e,marginRight:8}),detailValue:e=>({color:e,fontWeight:600,fontSize:15}),main:{fontSize:24,fontWeight:800,color:"#111827",display:"inline-block"},currency:{fontSize:18,color:"#6b7280",marginLeft:8,fontWeight:600}},dark:{popoverTitle:{fontSize:16,fontWeight:600,color:"#fff",marginBottom:16,textAlign:"center"},detailRow:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 0",borderBottom:"1px solid #23262F",fontSize:15},detailLabel:{display:"flex",alignItems:"center",color:"#B5B8BE",fontWeight:500},detailDot:e=>({display:"inline-block",width:8,height:8,borderRadius:"50%",background:e,marginRight:8}),detailValue:e=>({color:e,fontWeight:600,fontSize:15}),main:{fontSize:24,fontWeight:800,color:"#fff",display:"inline-block"},currency:{fontSize:18,color:"#B5B8BE",marginLeft:8,fontWeight:600}}};function Mo(e){const[t,n]=P({available:0,currency:"USD",symbol:"$",details:[{label:S("真实金额"),value:0,color:"#15b36b",dot:"#15b36b"},{label:S("冻结金额"),value:0,color:"#f59e0b",dot:"#f59e0b"},{label:S("总可用"),value:0,color:"#1890ff",dot:"#15b36b"}]});Oe(()=>{(async()=>{try{const a=await fo(),l={available:a.availableAmount,currency:"USD",symbol:"$",details:[{label:S("真实金额"),value:a.availableAmount,color:"#15b36b",dot:"#15b36b"},{label:S("冻结金额"),value:a.frozenAmount,color:"#f59e0b",dot:"#f59e0b"},{label:S("总可用"),value:a.totalAmount,color:"#1890ff",dot:"#15b36b"}]};n(l)}catch(a){console.error("获取余额失败:",a)}})()},[]);const o=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").theme===H.WHITE,i=Ho[o?"white":"dark"];return m(zo,{popover:m(Q,{children:[m("div",{style:i.popoverTitle,children:S("余额详情")}),t.details.map(s=>m("div",{style:i.detailRow,children:[m("span",{style:i.detailLabel,children:[m("span",{style:i.detailDot(s.dot)}),s.label]}),m("span",{style:i.detailValue(s.color),children:[t.symbol,At(s.value)]})]},s.label))]}),popoverPosition:e.popoverPosition||"bottom",children:m("div",{style:i.main,children:[t.symbol,At(t.available),m("span",{style:i.currency,children:t.currency})]})})}yn(Mo,"best-statistical-balance");const jo=["best-recharge","best-statistical-balance"];exports.components=jo;exports.initFundUnit=bo;exports.npmTest=wn;exports.printCurrentTime=xn;exports.viteProxy=yo;
60
+ `}),m("div",{onClick:()=>!s&&_(E=>!E),style:{minHeight:40,borderRadius:6,display:"flex",alignItems:"center",padding:"0 12px",fontSize:15,cursor:s?"not-allowed":"pointer",boxSizing:"border-box",transition:"border 0.2s",opacity:s?.6:1,width:"100%",...y.trigger,...o},tabIndex:0,children:[m("span",{style:{flex:1},children:w?w.label:m("span",{style:y.placeholder,children:r||"请选择"})}),m("span",{style:{marginLeft:8,display:"flex",alignItems:"center"},children:m("svg",{width:"20",height:"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&&!s&&m("div",{className:`custom-select-dropdown${u?" "+u:""}`,style:{position:"absolute",left:0,right:0,top:44,zIndex:10,borderRadius:6,boxShadow:h?"0 2px 8px rgba(0,0,0,0.08)":"0 2px 8px rgba(0,0,0,0.32)",maxHeight:220,overflowY:"auto",...y.dropdown,...a},children:[n.length===0&&m("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:120,width:"100%",userSelect:"none"},children:[m("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg",children:[m("title",{children:S("暂无数据")}),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:15},children:S("暂无数据")})]}),n.map((E,T)=>m("div",{onClick:()=>{E.disabled||(_(!1),t?.(E.value))},onMouseEnter:()=>x(T),onMouseLeave:()=>x(null),style:{padding:"10px 16px",cursor:E.disabled?"not-allowed":"pointer",fontWeight:e===E.value?600:400,opacity:E.disabled?.6:1,...y.option(e===E.value,!!E.disabled,g===T)},children:E.label},E.value))]}),f]})};function Ro(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 ko(e){if(!e)return"";const t=parseFloat(e);return isNaN(t)?"":t.toFixed(2)}const Co=({formState:e,setFormState:t,onClose:n,loading:r})=>{const o=JSON.parse(sessionStorage.getItem("all_dicts")||"{}"),i=o?.currency||[],s=o?.channel?.filter(p=>p.payment_support)||[],l=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").theme===H.WHITE,[u,f]=P(""),[c,_]=P(!1);Oe(()=>{e.currency&&e.amount&&e.rechargeChannel?go({channel:e.rechargeChannel,amount:e.amount,currency:e.currency}).then(p=>{f(p),_(!0)}).catch(p=>{console.error("计算支付金额失败:",p),_(!1)}):_(!1)},[e.currency,e.amount,e.rechargeChannel]);const b=l?{label:{marginBottom:8,fontSize:14,color:"#222",textAlign:"left",display:"block"},input:{width:"100%",padding:"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #E5E6EB",background:"#fff",color:"#222",fontSize:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},error:{color:"#ff4d4f",fontSize:13,marginTop:4,textAlign:"left"}}:{label:{marginBottom:8,fontSize:14,color:"#fff",textAlign:"left",display:"block"},input:{width:"100%",padding:"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #23262F",background:"#23262F",color:"#fff",fontSize:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},error:{color:"#ff4d4f",fontSize:13,marginTop:4,textAlign:"left"}},g=l?{background:"#fff",color:"#222",border:"1px solid #E5E6EB",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer"}:{background:"#23262F",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer"},x=l?{background:"#1890ff",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer",fontWeight:600}:{background:"#00E8C6",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer",fontWeight:600};return m(Q,{children:[m("div",{style:{marginBottom:18},children:[m("div",{style:b.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",S("充值币种")]}),m(Ve,{value:e.currency,onChange:p=>{t(h=>({...h,currency:p}))},options:i?.map(p=>({value:p.value,label:p.label})),placeholder:S("请选择充值币种")})]}),m("div",{style:{marginBottom:18},children:[m("div",{style:b.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",S("充值金额")]}),m("input",{type:"text",placeholder:S("请输入充值金额"),value:e.amount,onInput:p=>{let h=p.target.value;h=Ro(h);let y="";if(h&&!h.endsWith(".")){let w=parseFloat(h);if(!isNaN(w)&&(w<1&&(w=1),w>999999.99&&(w=999999.99),h=w.toString(),/\./.test(p.target.value))){const E=p.target.value.split(".")[1];E!==void 0&&E.length>0&&(h=w.toFixed(Math.min(E.length,2)))}}t(w=>({...w,amount:h,amountError:y}))},onBlur:p=>{let h=p.target.value;h=ko(h),t(y=>({...y,amount:h,amountError:""}))},style:{...b.input,...e.amountError?b.inputError:{}}}),e.amountError&&m("div",{style:b.error,children:e.amountError})]}),m("div",{style:{marginBottom:24},children:[m("div",{style:b.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",S("支付平台")]}),m(Ve,{value:e.rechargeChannel,onChange:p=>{t(h=>({...h,rechargeChannel:p,rechargeChannelError:p?"":h.rechargeChannelError}))},options:s?.map(p=>({value:p.value,label:p.label})),placeholder:S("请选择支付平台")}),e.rechargeChannelError&&m("div",{style:b.error,children:e.rechargeChannelError})]}),c&&u&&m("div",{style:{marginBottom:24,padding:"12px 16px",background:l?"#f6ffed":"#1a1a1a",border:`1px solid ${l?"#b7eb8f":"#333"}`,borderRadius:6,fontSize:14,color:"#52c41a"},children:[s.find(p=>p.value===e.rechargeChannel)?.label||e.rechargeChannel,S("需要收取手续费,实际支付金额约为:"),"$",u]}),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:g,children:S("取消")}),m("button",{type:"submit",disabled:r,style:x,children:S(r?"提交中...":"去支付")})]})]})},Ao={white:{container:{border:"1px dashed #E5E6EB",borderRadius:8,background:"#FCFCFD",padding:24,textAlign:"center",cursor:"pointer",minHeight:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#999",fontSize:15},fileItem:{display:"flex",alignItems:"center",background:"#F7F8FA",borderRadius:8,padding:"12px 16px",marginBottom:8,fontSize:15,color:"#222",justifyContent:"space-between"},removeBtn:{background:"#FF4D4F",color:"#fff",border:"none",borderRadius:6,padding:"4px 14px",fontSize:15,marginLeft:16,cursor:"pointer"}},dark:{container:{border:"1.5px dashed #444C5C",borderRadius:8,background:"#181A20",padding:24,textAlign:"center",cursor:"pointer",minHeight:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#999",fontSize:15},fileItem:{display:"flex",alignItems:"center",background:"#23262F",borderRadius:8,padding:"12px 16px",marginBottom:8,fontSize:15,color:"#fff",justifyContent:"space-between"},removeBtn:{background:"#FF4D4F",color:"#fff",border:"none",borderRadius:6,padding:"4px 14px",fontSize:15,marginLeft:16,cursor:"pointer"}}},Oo=({value:e=[],onChange:t,maxCount:n=10,accept:r=".jpg,.jpeg,.png,.pdf",multiple:o=!0,disabled:i=!1})=>{const s=we(null),[a,l]=P(!1),[u,f]=P(0),b=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").theme===H.WHITE?"white":"dark",g=Ao[b],x=async h=>{const y=Array.from(h.target.files).slice(0,n);if(!y.length)return;l(!0);const w=[];for(let E=0;E<y.length;E++){f(0);const T=new FormData;T.append("file",y[E]);try{const k=await ho(T,I=>f(I));k&&w.push(k)}catch{}}l(!1),f(0),t?.([...e,...w]),s.current&&(s.current.value="")},p=h=>{const y=e.filter((w,E)=>E!==h);t?.(y)};return m("div",{children:[m("div",{style:{...g.container,cursor:i?"not-allowed":g.container.cursor,opacity:i?.6:1},onClick:()=>!i&&s.current?.click(),children:[m("div",{style:{fontSize:48,marginBottom:12},children:"📁"}),m("div",{style:{color:"#222",fontSize:15,marginBottom:4},children:S("点击或拖拽文件到此处上传")}),m("div",{style:{color:"#999",fontSize:13},children:[S("支持 JPG、PNG、PDF 格式,单个文件不超过 20MB,最多上传")," ",n," ",S("个文件")]}),m("input",{ref:s,type:"file",multiple:o,accept:r,style:{display:"none"},onChange:x,disabled:i}),a&&m("div",{style:{marginTop:12,color:"#1677ff"},children:[S("正在上传...")," ",u,"%"]})]}),e&&e.length>0&&m("div",{style:{marginTop:12},children:e.map((h,y)=>m("div",{style:g.fileItem,children:[m("div",{style:{display:"flex",alignItems:"center",flex:1},children:[m("span",{style:{fontWeight:500,wordBreak:"break-all"},children:h.split("/").pop()}),m("span",{style:{color:"#8C8F93",fontSize:13,marginLeft:8},children:["[",S("已上传"),"]"]})]}),m("button",{type:"button",onClick:w=>{w.stopPropagation(),p(y)},style:g.removeBtn,disabled:i,children:S("移除")})]},h))})]})},Fo=({formState:e,setFormState:t,onClose:n,loading:r})=>{const o=JSON.parse(sessionStorage.getItem("all_dicts")||"{}");console.log(o,"allDicts");const i=o?.channel||[],l=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").theme===H.WHITE?{label:{marginBottom:8,fontSize:14,color:"#222",textAlign:"left",display:"block"},input:{width:"100%",padding:"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #E5E6EB",background:"#fff",color:"#222",fontSize:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},buttonCancel:{background:"#fff",color:"#222",border:"1px solid #E5E6EB",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer"},buttonSubmit:{background:"#1890ff",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer",fontWeight:600},error:{color:"#ff4d4f",fontSize:13,marginTop:4,textAlign:"left"}}:{label:{marginBottom:8,fontSize:14,color:"#fff",textAlign:"left",display:"block"},input:{width:"100%",padding:"10px 12px",borderRadius:6,boxSizing:"border-box",border:"1px solid #23262F",background:"#23262F",color:"#fff",fontSize:15,outline:"none",marginBottom:0},inputError:{border:"1px solid #ff4d4f"},buttonCancel:{background:"#23262F",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer"},buttonSubmit:{background:"#00E8C6",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer",fontWeight:600},error:{color:"#ff4d4f",fontSize:13,marginTop:4,textAlign:"left"}};return m("form",{onSubmit:async f=>{f.preventDefault();let c=!0;t(_=>({..._,platformError:"",transactionIdError:"",filesError:""})),e.platform||(t(_=>({..._,platformError:S("请选择支付平台")})),c=!1),e.transactionId.trim()||(t(_=>({..._,transactionIdError:S("请输入转账交易ID")})),c=!1),(!e.files||e.files.length===0)&&(t(_=>({..._,filesError:S("请上传转账凭证")})),c=!1),c&&(await mo({transferChannel:e.platform,transferNo:e.transactionId,voucherUrls:e.files}),n(),Je.success(S("离线充值创建成功")))},children:[m("div",{style:{marginBottom:18},children:[m("div",{style:l.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",S("第三方支付平台")]}),m(Ve,{value:e.platform,onChange:f=>{t(c=>({...c,platform:f,platformError:f?"":c.platformError}))},options:[...i?.map(f=>({value:f.value,label:f.label}))],placeholder:S("请选择支付平台")}),e.platformError&&m("div",{style:l.error,children:e.platformError})]}),m("div",{style:{marginBottom:18},children:[m("div",{style:l.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",S("交易ID")]}),m("input",{type:"text",placeholder:S("请输入转账交易ID"),value:e.transactionId,maxLength:200,onInput:f=>{let c=f.target.value;c.length>200&&(c=c.slice(0,200)),t(_=>({..._,transactionId:c,transactionIdError:c?"":_.transactionIdError}))},style:{...l.input,...e.transactionIdError?l.inputError:{}}}),e.transactionIdError&&m("div",{style:l.error,children:e.transactionIdError})]}),m("div",{style:{marginBottom:24},children:[m("div",{style:l.label,children:[m("span",{style:{color:"#F53F3F"},children:"*"})," ",S("上传文件")]}),m(Oo,{value:e.files,onChange:f=>t(c=>({...c,files:f,filesError:""})),maxCount:10,accept:".jpg,.jpeg,.png,.pdf",multiple:!0}),e.filesError&&m("div",{style:l.error,children:e.filesError})]}),m("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[m("button",{type:"button",onClick:n,style:l.buttonCancel,children:S("取消")}),m("button",{type:"submit",disabled:r,style:l.buttonSubmit,children:S("去支付")})]})]})};function Po({visible:e,onClose:t,onSubmit:n}){const[r,o]=P({amount:"",rechargeChannel:"",currency:"USD",loading:!1,error:"",amountError:"",rechargeChannelError:"",currencyError:""}),[i,s]=P("online"),[a,l]=P({platform:"",transactionId:"",files:[],platformError:"",transactionIdError:"",filesError:"",loading:!1});if(Oe(()=>{e||(s("online"),o({amount:"",rechargeChannel:"",currency:"USD",loading:!1,error:"",amountError:"",rechargeChannelError:"",currencyError:""}),l({platform:"",transactionId:"",files:[],platformError:"",transactionIdError:"",filesError:"",loading:!1}))},[e]),!e)return null;const u=async h=>{h.preventDefault();let y=!0;if(o(w=>({...w,amountError:"",rechargeChannelError:""})),r.amount.trim()||(o(w=>({...w,amountError:S("请输入充值金额")})),y=!1),r.rechargeChannel||(o(w=>({...w,rechargeChannelError:S("请选择支付平台")})),y=!1),!!y){o(w=>({...w,loading:!0,error:""}));try{await n({amount:r.amount,rechargeChannel:r.rechargeChannel,currency:r.currency}),t()}catch{o(w=>({...w,error:S("提交失败,请重试")}))}finally{o(w=>({...w,loading:!1}))}}},[f,c]=P(!1),_=h=>{h.target===h.currentTarget?c(!0):c(!1)},b=h=>{h.target===h.currentTarget&&f&&t(),c(!1)},p=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").theme===H.WHITE?{modalBg:"#fff",modalColor:"#222",modalBoxShadow:"0 4px 24px rgba(0,0,0,0.08)",mask:"rgba(0,0,0,0.3)",title:{fontWeight:600,fontSize:20,marginBottom:24,textAlign:"left",color:"#222"},closeBtn:{position:"absolute",right:16,top:16,background:"none",border:"none",color:"#222",fontSize:22,cursor:"pointer",lineHeight:1},tabBtn:(h,y)=>({flex:1,background:h?"#fff":"#F7F8FA",color:h?"#1890ff":"#222",border:"none",borderRadius:y?"8px 0 0 8px":"0 8px 8px 0",fontWeight:h?600:400,fontSize:16,height:48,boxShadow:h?"0 2px 8px 0 rgba(20,20,20,0.04)":"none",outline:"none",cursor:"pointer",borderRight:y?"1px solid #F0F1F3":void 0,borderLeft:y?void 0:"1px solid #F0F1F3",transition:"all 0.2s"})}:{modalBg:"#181A20",modalColor:"#fff",modalBoxShadow:"0 4px 24px rgba(0,0,0,0.5)",mask:"rgba(0,0,0,0.7)",title:{fontWeight:600,fontSize:20,marginBottom:24,textAlign:"left",color:"#fff"},closeBtn:{position:"absolute",right:16,top:16,background:"none",border:"none",color:"#fff",fontSize:22,cursor:"pointer",lineHeight:1},tabBtn:(h,y)=>({flex:1,background:h?"#23262F":"#181A20",color:h?"#00E8C6":"#fff",border:"none",borderRadius:y?"8px 0 0 8px":"0 8px 8px 0",fontWeight:h?600:400,fontSize:16,height:48,boxShadow:h?"0 2px 8px 0 rgba(20,20,20,0.10)":"none",outline:"none",cursor:"pointer",borderRight:y?"1px solid #23262F":void 0,borderLeft:y?void 0:"1px solid #23262F",transition:"all 0.2s"})};return m("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:p.mask,display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999},onMouseDown:_,onMouseUp:b,children:m("form",{onSubmit:u,style:{background:p.modalBg,padding:32,borderRadius:12,minWidth:400,maxWidth:400,color:p.modalColor,boxShadow:p.modalBoxShadow,position:"relative"},onClick:h=>h.stopPropagation(),children:[m("button",{type:"button",onClick:t,style:p.closeBtn,"aria-label":S("关闭"),children:"×"}),m("div",{style:p.title,children:S("充值 / 转账")}),m("div",{style:{display:"flex",marginBottom:28},children:[m("button",{type:"button",onClick:()=>s("online"),style:p.tabBtn(i==="online",!0),children:S("在线充值")}),m("button",{type:"button",onClick:()=>s("offline"),style:p.tabBtn(i==="offline",!1),children:S("线下转账")})]}),i==="online"?m(Co,{formState:r,setFormState:o,onClose:t,loading:r.loading}):m(Fo,{formState:a,setFormState:l,onClose:t,loading:a.loading})]})})}function nt(){return(nt=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 Bo=["context","children"];function No(e){this.getChildContext=function(){return e.context};var t=e.children,n=function(r,o){if(r==null)return{};var i,s,a={},l=Object.keys(r);for(s=0;s<l.length;s++)o.indexOf(i=l[s])>=0||(a[i]=r[i]);return a}(e,Bo);return hn(t,n)}function Io(){var e=new CustomEvent("_preact",{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(e),this._vdom=G(No,nt({},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=[],i={},s=0,a=n.attributes,l=n.childNodes;for(s=a.length;s--;)a[s].name!=="slot"&&(i[a[s].name]=a[s].value,i[bn(a[s].name)]=a[s].value);for(s=l.length;s--;){var u=t(l[s],null),f=l[s].slot;f?i[f]=G(Ct,{name:f},u):o[s]=u}var c=r?G(Ct,null,o):o;return G(r||n.nodeName.toLowerCase(),i,c)}(this,this._vdomComponent)),(this.hasAttribute("hydrate")?pn:Ae)(this._vdom,this._root)}function bn(e){return e.replace(/-(\w)/g,function(t,n){return n?n.toUpperCase():""})}function Do(e,t,n){if(this._vdom){var r={};r[e]=n=n??void 0,r[bn(e)]=n,this._vdom=hn(this._vdom,r),Ae(this._vdom,this._root)}}function Uo(){Ae(this._vdom=null,this._root)}function Ct(e,t){var n=this;return G("slot",nt({},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 yn(e,t,n,r){function o(){var i=Reflect.construct(HTMLElement,[],o);return i._vdomComponent=e,i._root=r&&r.shadow?i.attachShadow({mode:r.mode||"open"}):i,i}return(o.prototype=Object.create(HTMLElement.prototype)).constructor=o,o.prototype.connectedCallback=Io,o.prototype.attributeChangedCallback=Do,o.prototype.disconnectedCallback=Uo,n=n||e.observedAttributes||Object.keys(e.propTypes||{}),o.observedAttributes=n,n.forEach(function(i){Object.defineProperty(o.prototype,i,{get:function(){return this._vdom.props[i]},set:function(s){this._vdom?this.attributeChangedCallback(i,null,s):(this._props||(this._props={}),this._props[i]=s,this.connectedCallback());var a=typeof s;s!=null&&a!=="string"&&a!=="boolean"&&a!=="number"||this.setAttribute(i,s)}})}),customElements.define(t||e.tagName||e.displayName||e.name,o)}function Lo(){const[e,t]=P(!1),n=async r=>{const o=await _o({amount:r.amount,currency:r.currency,rechargeChannel:r.rechargeChannel});window.open(o,"_blank")};return m("div",{children:[m(wo,{onClick:()=>t(!0),children:S("充值/转账")}),m(Po,{visible:e,onClose:()=>t(!1),onSubmit:n})]})}yn(Lo,"BestRecharge",["theme"],{shadow:!1});const zo=({popover:e,children:t,popoverWidth:n=300,popoverMinWidth:r=200,offsetY:o=16,offsetX:i=16,popoverPosition:s="top"})=>{const[a,l]=P(!1),[u,f]=P(s),c=we(null),_=we(null),b=()=>{if(_.current&&(clearTimeout(_.current),_.current=null),s==="top"||s==="bottom")if(c.current){const T=c.current.getBoundingClientRect();s==="top"&&T.top<100?f("bottom"):s==="bottom"&&window.innerHeight-T.bottom<100?f("top"):f(s)}else f(s);else f(s);l(!0)},g=()=>{_.current=window.setTimeout(()=>{l(!1)},120)},x={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"}}},h=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").theme===H.WHITE,y=x[h?"white":"dark"];let w={position:"absolute",zIndex:999,borderRadius:6,fontSize:15,minWidth:r,width:n,padding:"8px 14px",pointerEvents:"auto",textAlign:"center",animation:"fadeInUp 0.3s",...y.popover},E={position:"absolute",zIndex:11,width:0,height:0};return u==="top"?(w={...w,left:"50%",top:-48,transform:"translateX(-50%)"},E={...E,left:"50%",bottom:-8,transform:"translateX(-50%)",borderLeft:"8px solid transparent",borderRight:"8px solid transparent",borderTop:`8px solid ${y.arrow.top}`}):u==="bottom"?(w={...w,left:"50%",top:"100%",marginTop:o,transform:"translateX(-50%)"},E={...E,left:"50%",top:-8,transform:"translateX(-50%)",borderLeft:"8px solid transparent",borderRight:"8px solid transparent",borderBottom:`8px solid ${y.arrow.bottom}`}):u==="leftTop"?(w={...w,right:"100%",top:0,marginRight:i,transform:"none"},E={...E,right:-8,top:12,borderTop:"8px solid transparent",borderBottom:"8px solid transparent",borderLeft:`8px solid ${y.arrow.left}`}):u==="rightTop"&&(w={...w,left:"100%",top:0,marginLeft:i,transform:"translateY(0)"},E={...E,left:-8,top:12,borderTop:"8px solid transparent",borderBottom:"8px solid transparent",borderRight:`8px solid ${y.arrow.right}`}),m("div",{ref:c,style:{position:"relative",display:"inline-block"},onMouseEnter:b,onMouseLeave:g,children:[t,a&&m("div",{style:w,onMouseEnter:b,onMouseLeave:g,children:[e,m("div",{style:E})]})]})};function At(e){return e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}const Ho={white:{popoverTitle:{fontSize:16,fontWeight:600,color:"#222",marginBottom:16,textAlign:"center"},detailRow:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 0",borderBottom:"1px solid #e5e7eb",fontSize:15},detailLabel:{display:"flex",alignItems:"center",color:"#6b7280",fontWeight:500},detailDot:e=>({display:"inline-block",width:8,height:8,borderRadius:"50%",background:e,marginRight:8}),detailValue:e=>({color:e,fontWeight:600,fontSize:15}),main:{fontSize:24,fontWeight:800,color:"#111827",display:"inline-block"},currency:{fontSize:18,color:"#6b7280",marginLeft:8,fontWeight:600}},dark:{popoverTitle:{fontSize:16,fontWeight:600,color:"#fff",marginBottom:16,textAlign:"center"},detailRow:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 0",borderBottom:"1px solid #23262F",fontSize:15},detailLabel:{display:"flex",alignItems:"center",color:"#B5B8BE",fontWeight:500},detailDot:e=>({display:"inline-block",width:8,height:8,borderRadius:"50%",background:e,marginRight:8}),detailValue:e=>({color:e,fontWeight:600,fontSize:15}),main:{fontSize:24,fontWeight:800,color:"#fff",display:"inline-block"},currency:{fontSize:18,color:"#B5B8BE",marginLeft:8,fontWeight:600}}};function Mo(e){const[t,n]=P({available:0,currency:"USD",symbol:"$",details:[{label:S("真实金额"),value:0,color:"#15b36b",dot:"#15b36b"},{label:S("冻结金额"),value:0,color:"#f59e0b",dot:"#f59e0b"},{label:S("总可用"),value:0,color:"#1890ff",dot:"#15b36b"}]});Oe(()=>{(async()=>{try{const a=await fo(),l={available:a.availableAmount,currency:"USD",symbol:"$",details:[{label:S("真实金额"),value:a.availableAmount,color:"#15b36b",dot:"#15b36b"},{label:S("冻结金额"),value:a.frozenAmount,color:"#f59e0b",dot:"#f59e0b"},{label:S("总可用"),value:a.totalAmount,color:"#1890ff",dot:"#15b36b"}]};n(l)}catch(a){console.error("获取余额失败:",a)}})()},[]);const o=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").theme===H.WHITE,i=Ho[o?"white":"dark"];return m(zo,{popover:m(Q,{children:[m("div",{style:i.popoverTitle,children:S("余额详情")}),t.details.map(s=>m("div",{style:i.detailRow,children:[m("span",{style:i.detailLabel,children:[m("span",{style:i.detailDot(s.dot)}),s.label]}),m("span",{style:i.detailValue(s.color),children:[t.symbol,At(s.value)]})]},s.label))]}),popoverPosition:e.popoverPosition||"bottom",children:m("div",{style:i.main,children:[t.symbol,At(t.available),m("span",{style:i.currency,children:t.currency})]})})}yn(Mo,"best-statistical-balance");const jo=["BestRecharge","best-statistical-balance"];exports.components=jo;exports.initFundUnit=bo;exports.npmTest=wn;exports.printCurrentTime=xn;exports.viteProxy=yo;
package/dist/best-unit.js CHANGED
@@ -26,7 +26,7 @@ const Sn = Se("string"), B = Se("function"), Bt = Se("number"), ve = (e) => e !=
26
26
  return !1;
27
27
  const t = Ge(e);
28
28
  return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(Ft in e) && !(xe in e);
29
- }, Tn = D("Date"), Rn = D("File"), kn = D("Blob"), Cn = D("FileList"), An = (e) => ve(e) && B(e.pipe), On = (e) => {
29
+ }, Rn = D("Date"), Tn = D("File"), kn = D("Blob"), Cn = D("FileList"), An = (e) => ve(e) && B(e.pipe), On = (e) => {
30
30
  let t;
31
31
  return e && (typeof FormData == "function" && e instanceof FormData || B(e.append) && ((t = Ee(e)) === "formdata" || // detect form-data instance
32
32
  t === "object" && B(e.toString) && e.toString() === "[object FormData]"));
@@ -184,8 +184,8 @@ const er = (e) => {
184
184
  isResponse: Nn,
185
185
  isHeaders: In,
186
186
  isUndefined: re,
187
- isDate: Tn,
188
- isFile: Rn,
187
+ isDate: Rn,
188
+ isFile: Tn,
189
189
  isBlob: kn,
190
190
  isRegExp: Gn,
191
191
  isFunction: B,
@@ -295,7 +295,7 @@ function sr(e) {
295
295
  const ar = d.toFlatObject(d, {}, null, function(t) {
296
296
  return /^is[A-Z]/.test(t);
297
297
  });
298
- function Te(e, t, n) {
298
+ function Re(e, t, n) {
299
299
  if (!d.isObject(e))
300
300
  throw new TypeError("target must be an object");
301
301
  t = t || new FormData(), n = d.toFlatObject(n, {
@@ -373,7 +373,7 @@ function it(e) {
373
373
  });
374
374
  }
375
375
  function Ke(e, t) {
376
- this._pairs = [], e && Te(e, this, t);
376
+ this._pairs = [], e && Re(e, this, t);
377
377
  }
378
378
  const Mt = Ke.prototype;
379
379
  Mt.append = function(t, n) {
@@ -484,7 +484,7 @@ self instanceof WorkerGlobalScope && typeof self.importScripts == "function", mr
484
484
  ...dr
485
485
  };
486
486
  function gr(e, t) {
487
- return Te(e, new F.classes.URLSearchParams(), Object.assign({
487
+ return Re(e, new F.classes.URLSearchParams(), Object.assign({
488
488
  visitor: function(n, r, o, i) {
489
489
  return F.isNode && d.isBuffer(n) ? (this.append(r, n.toString("base64")), !1) : i.defaultVisitor.apply(this, arguments);
490
490
  }
@@ -546,7 +546,7 @@ const ae = {
546
546
  return gr(t, this.formSerializer).toString();
547
547
  if ((a = d.isFileList(t)) || r.indexOf("multipart/form-data") > -1) {
548
548
  const l = this.env && this.env.FormData;
549
- return Te(
549
+ return Re(
550
550
  a ? { "files[]": t } : t,
551
551
  l && new l(),
552
552
  this.formSerializer
@@ -646,10 +646,10 @@ function Be(e, t, n, r, o) {
646
646
  return r.test(t);
647
647
  }
648
648
  }
649
- function Tr(e) {
649
+ function Rr(e) {
650
650
  return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (t, n, r) => n.toUpperCase() + r);
651
651
  }
652
- function Rr(e, t) {
652
+ function Tr(e, t) {
653
653
  const n = d.toCamelCase(" " + t);
654
654
  ["get", "set", "has"].forEach((r) => {
655
655
  Object.defineProperty(e, r + n, {
@@ -742,7 +742,7 @@ let N = class {
742
742
  n[s] = fe(o), delete n[i];
743
743
  return;
744
744
  }
745
- const a = t ? Tr(i) : String(i).trim();
745
+ const a = t ? Rr(i) : String(i).trim();
746
746
  a !== i && delete n[i], n[a] = fe(o), r[a] = !0;
747
747
  }), this;
748
748
  }
@@ -781,7 +781,7 @@ let N = class {
781
781
  }).accessors, o = this.prototype;
782
782
  function i(s) {
783
783
  const a = te(s);
784
- r[a] || (Rr(o, s), r[a] = !0);
784
+ r[a] || (Tr(o, s), r[a] = !0);
785
785
  }
786
786
  return d.isArray(t) ? t.forEach(i) : i(t), this;
787
787
  }
@@ -1023,7 +1023,7 @@ const Gt = (e) => {
1023
1023
  return;
1024
1024
  const w = N.from(
1025
1025
  "getAllResponseHeaders" in p && p.getAllResponseHeaders()
1026
- ), T = {
1026
+ ), R = {
1027
1027
  data: !a || a === "text" || a === "json" ? p.responseText : p.response,
1028
1028
  status: p.status,
1029
1029
  statusText: p.statusText,
@@ -1035,7 +1035,7 @@ const Gt = (e) => {
1035
1035
  n(I), x();
1036
1036
  }, function(I) {
1037
1037
  r(I), x();
1038
- }, T), p = null;
1038
+ }, R), p = null;
1039
1039
  }
1040
1040
  "onloadend" in p ? p.onloadend = h : p.onreadystatechange = function() {
1041
1041
  !p || p.readyState !== 4 || p.status === 0 && !(p.responseURL && p.responseURL.indexOf("file:") === 0) || setTimeout(h);
@@ -1045,15 +1045,15 @@ const Gt = (e) => {
1045
1045
  r(new v("Network Error", v.ERR_NETWORK, e, p)), p = null;
1046
1046
  }, p.ontimeout = function() {
1047
1047
  let E = o.timeout ? "timeout of " + o.timeout + "ms exceeded" : "timeout exceeded";
1048
- const T = o.transitional || $t;
1048
+ const R = o.transitional || $t;
1049
1049
  o.timeoutErrorMessage && (E = o.timeoutErrorMessage), r(new v(
1050
1050
  E,
1051
- T.clarifyTimeoutError ? v.ETIMEDOUT : v.ECONNABORTED,
1051
+ R.clarifyTimeoutError ? v.ETIMEDOUT : v.ECONNABORTED,
1052
1052
  e,
1053
1053
  p
1054
1054
  )), p = null;
1055
- }, i === void 0 && s.setContentType(null), "setRequestHeader" in p && d.forEach(s.toJSON(), function(E, T) {
1056
- p.setRequestHeader(T, E);
1055
+ }, i === void 0 && s.setContentType(null), "setRequestHeader" in p && d.forEach(s.toJSON(), function(E, R) {
1056
+ p.setRequestHeader(R, E);
1057
1057
  }), d.isUndefined(o.withCredentials) || (p.withCredentials = !!o.withCredentials), a && a !== "json" && (p.responseType = o.responseType), u && ([_, g] = _e(u, !0), p.addEventListener("progress", _)), l && p.upload && ([c, b] = _e(l), p.upload.addEventListener("progress", c), p.upload.addEventListener("loadend", b)), (o.cancelToken || o.signal) && (f = (w) => {
1058
1058
  p && (r(!w || w.type ? new Z(null, e, p) : w), p.abort(), p = null);
1059
1059
  }, o.cancelToken && o.cancelToken.subscribe(f), o.signal && (o.signal.aborted ? f() : o.signal.addEventListener("abort", f)));
@@ -1144,7 +1144,7 @@ const Gt = (e) => {
1144
1144
  }, {
1145
1145
  highWaterMark: 2
1146
1146
  });
1147
- }, Re = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", Kt = Re && typeof ReadableStream == "function", Hr = Re && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((e) => (t) => e.encode(t))(new TextEncoder()) : async (e) => new Uint8Array(await new Response(e).arrayBuffer())), Xt = (e, ...t) => {
1147
+ }, Te = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", Kt = Te && typeof ReadableStream == "function", Hr = Te && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((e) => (t) => e.encode(t))(new TextEncoder()) : async (e) => new Uint8Array(await new Response(e).arrayBuffer())), Xt = (e, ...t) => {
1148
1148
  try {
1149
1149
  return !!e(...t);
1150
1150
  } catch {
@@ -1163,7 +1163,7 @@ const Gt = (e) => {
1163
1163
  }), dt = 64 * 1024, He = Kt && Xt(() => d.isReadableStream(new Response("").body)), ge = {
1164
1164
  stream: He && ((e) => e.body)
1165
1165
  };
1166
- Re && ((e) => {
1166
+ Te && ((e) => {
1167
1167
  ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((t) => {
1168
1168
  !ge[t] && (ge[t] = d.isFunction(e[t]) ? (n) => n[t]() : (n, r) => {
1169
1169
  throw new v(`Response type '${t}' is not supported`, v.ERR_NOT_SUPPORT, r);
@@ -1187,7 +1187,7 @@ const jr = async (e) => {
1187
1187
  }, $r = async (e, t) => {
1188
1188
  const n = d.toFiniteNumber(e.getContentLength());
1189
1189
  return n ?? jr(t);
1190
- }, Wr = Re && (async (e) => {
1190
+ }, Wr = Te && (async (e) => {
1191
1191
  let {
1192
1192
  url: t,
1193
1193
  method: n,
@@ -1210,17 +1210,17 @@ const jr = async (e) => {
1210
1210
  let p;
1211
1211
  try {
1212
1212
  if (l && Mr && n !== "get" && n !== "head" && (p = await $r(f, r)) !== 0) {
1213
- let T = new Request(t, {
1213
+ let R = new Request(t, {
1214
1214
  method: "POST",
1215
1215
  body: r,
1216
1216
  duplex: "half"
1217
1217
  }), k;
1218
- if (d.isFormData(r) && (k = T.headers.get("content-type")) && f.setContentType(k), T.body) {
1218
+ if (d.isFormData(r) && (k = R.headers.get("content-type")) && f.setContentType(k), R.body) {
1219
1219
  const [I, M] = lt(
1220
1220
  p,
1221
1221
  _e(ct(l))
1222
1222
  );
1223
- r = ft(T.body, dt, I, M);
1223
+ r = ft(R.body, dt, I, M);
1224
1224
  }
1225
1225
  }
1226
1226
  d.isString(c) || (c = c ? "include" : "omit");
@@ -1237,9 +1237,9 @@ const jr = async (e) => {
1237
1237
  let y = await fetch(g, _);
1238
1238
  const w = He && (u === "stream" || u === "response");
1239
1239
  if (He && (a || w && x)) {
1240
- const T = {};
1240
+ const R = {};
1241
1241
  ["status", "statusText", "headers"].forEach((j) => {
1242
- T[j] = y[j];
1242
+ R[j] = y[j];
1243
1243
  });
1244
1244
  const k = d.toFiniteNumber(y.headers.get("content-length")), [I, M] = a && lt(
1245
1245
  k,
@@ -1249,13 +1249,13 @@ const jr = async (e) => {
1249
1249
  ft(y.body, dt, I, () => {
1250
1250
  M && M(), x && x();
1251
1251
  }),
1252
- T
1252
+ R
1253
1253
  );
1254
1254
  }
1255
1255
  u = u || "text";
1256
1256
  let E = await ge[d.findKey(ge, u) || "text"](y, e);
1257
- return !w && x && x(), await new Promise((T, k) => {
1258
- Jt(T, k, {
1257
+ return !w && x && x(), await new Promise((R, k) => {
1258
+ Jt(R, k, {
1259
1259
  data: E,
1260
1260
  headers: N.from(y.headers),
1261
1261
  status: y.status,
@@ -1673,7 +1673,7 @@ A.CanceledError = Z;
1673
1673
  A.CancelToken = Vr;
1674
1674
  A.isCancel = qt;
1675
1675
  A.VERSION = Qt;
1676
- A.toFormData = Te;
1676
+ A.toFormData = Re;
1677
1677
  A.AxiosError = v;
1678
1678
  A.Cancel = A.CanceledError;
1679
1679
  A.all = function(t) {
@@ -1705,7 +1705,7 @@ const {
1705
1705
  getAdapter: ni,
1706
1706
  mergeConfig: ri
1707
1707
  } = A;
1708
- var le, R, tn, $, _t, nn, rn, on, Ze, $e, We, oe = {}, sn = [], Xr = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, Ce = Array.isArray;
1708
+ var le, T, tn, $, _t, nn, rn, on, Ze, $e, We, oe = {}, sn = [], Xr = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, Ce = Array.isArray;
1709
1709
  function z(e, t) {
1710
1710
  for (var n in t) e[n] = t[n];
1711
1711
  return e;
@@ -1721,7 +1721,7 @@ function G(e, t, n) {
1721
1721
  }
1722
1722
  function ne(e, t, n, r, o) {
1723
1723
  var i = { type: e, props: t, key: n, ref: r, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: o ?? ++tn, __i: -1, __u: 0 };
1724
- return o == null && R.vnode != null && R.vnode(i), i;
1724
+ return o == null && T.vnode != null && T.vnode(i), i;
1725
1725
  }
1726
1726
  function Q(e) {
1727
1727
  return e.children;
@@ -1745,10 +1745,10 @@ function an(e) {
1745
1745
  }
1746
1746
  }
1747
1747
  function gt(e) {
1748
- (!e.__d && (e.__d = !0) && $.push(e) && !be.__r++ || _t != R.debounceRendering) && ((_t = R.debounceRendering) || nn)(be);
1748
+ (!e.__d && (e.__d = !0) && $.push(e) && !be.__r++ || _t != T.debounceRendering) && ((_t = T.debounceRendering) || nn)(be);
1749
1749
  }
1750
1750
  function be() {
1751
- for (var e, t, n, r, o, i, s, a = 1; $.length; ) $.length > a && $.sort(rn), e = $.shift(), a = $.length, e.__d && (n = void 0, o = (r = (t = e).__v).__e, i = [], s = [], t.__P && ((n = z({}, r)).__v = r.__v + 1, R.vnode && R.vnode(n), Ye(t.__P, n, r, t.__n, t.__P.namespaceURI, 32 & r.__u ? [o] : null, i, o ?? K(r), !!(32 & r.__u), s), n.__v = r.__v, n.__.__k[n.__i] = n, un(i, n, s), n.__e != o && an(n)));
1751
+ for (var e, t, n, r, o, i, s, a = 1; $.length; ) $.length > a && $.sort(rn), e = $.shift(), a = $.length, e.__d && (n = void 0, o = (r = (t = e).__v).__e, i = [], s = [], t.__P && ((n = z({}, r)).__v = r.__v + 1, T.vnode && T.vnode(n), Ye(t.__P, n, r, t.__n, t.__P.namespaceURI, 32 & r.__u ? [o] : null, i, o ?? K(r), !!(32 & r.__u), s), n.__v = r.__v, n.__.__k[n.__i] = n, un(i, n, s), n.__e != o && an(n)));
1752
1752
  be.__r = 0;
1753
1753
  }
1754
1754
  function ln(e, t, n, r, o, i, s, a, l, u, f) {
@@ -1816,21 +1816,21 @@ function yt(e) {
1816
1816
  var n = this.l[t.type + e];
1817
1817
  if (t.t == null) t.t = Ze++;
1818
1818
  else if (t.t < n.u) return;
1819
- return n(R.event ? R.event(t) : t);
1819
+ return n(T.event ? T.event(t) : t);
1820
1820
  }
1821
1821
  };
1822
1822
  }
1823
1823
  function Ye(e, t, n, r, o, i, s, a, l, u) {
1824
- var f, c, _, b, g, x, p, h, y, w, E, T, k, I, M, j, Pe, U = t.type;
1824
+ var f, c, _, b, g, x, p, h, y, w, E, R, k, I, M, j, Pe, U = t.type;
1825
1825
  if (t.constructor != null) return null;
1826
- 128 & n.__u && (l = !!(32 & n.__u), i = [a = t.__e = n.__e]), (f = R.__b) && f(t);
1826
+ 128 & n.__u && (l = !!(32 & n.__u), i = [a = t.__e = n.__e]), (f = T.__b) && f(t);
1827
1827
  e: if (typeof U == "function") try {
1828
1828
  if (h = t.props, y = "prototype" in U && U.prototype.render, w = (f = U.contextType) && r[f.__c], E = f ? w ? w.props.value : f.__ : r, n.__c ? p = (c = t.__c = n.__c).__ = c.__E : (y ? t.__c = c = new U(h, E) : (t.__c = c = new pe(h, E), c.constructor = U, c.render = eo), w && w.sub(c), c.props = h, c.state || (c.state = {}), c.context = E, c.__n = r, _ = c.__d = !0, c.__h = [], c._sb = []), y && c.__s == null && (c.__s = c.state), y && U.getDerivedStateFromProps != null && (c.__s == c.state && (c.__s = z({}, c.__s)), z(c.__s, U.getDerivedStateFromProps(h, c.__s))), b = c.props, g = c.state, c.__v = t, _) y && U.getDerivedStateFromProps == null && c.componentWillMount != null && c.componentWillMount(), y && c.componentDidMount != null && c.__h.push(c.componentDidMount);
1829
1829
  else {
1830
1830
  if (y && U.getDerivedStateFromProps == null && h !== b && c.componentWillReceiveProps != null && c.componentWillReceiveProps(h, E), !c.__e && c.shouldComponentUpdate != null && c.shouldComponentUpdate(h, c.__s, E) === !1 || t.__v == n.__v) {
1831
1831
  for (t.__v != n.__v && (c.props = h, c.state = c.__s, c.__d = !1), t.__e = n.__e, t.__k = n.__k, t.__k.some(function(ee) {
1832
1832
  ee && (ee.__ = t);
1833
- }), T = 0; T < c._sb.length; T++) c.__h.push(c._sb[T]);
1833
+ }), R = 0; R < c._sb.length; R++) c.__h.push(c._sb[R]);
1834
1834
  c._sb = [], c.__h.length && s.push(c);
1835
1835
  break e;
1836
1836
  }
@@ -1838,7 +1838,7 @@ function Ye(e, t, n, r, o, i, s, a, l, u) {
1838
1838
  c.componentDidUpdate(b, g, x);
1839
1839
  });
1840
1840
  }
1841
- if (c.context = E, c.props = h, c.__P = e, c.__e = !1, k = R.__r, I = 0, y) {
1841
+ if (c.context = E, c.props = h, c.__P = e, c.__e = !1, k = T.__r, I = 0, y) {
1842
1842
  for (c.state = c.__s, c.__d = !1, k && k(t), f = c.render(c.props, c.state, c.context), M = 0; M < c._sb.length; M++) c.__h.push(c._sb[M]);
1843
1843
  c._sb = [];
1844
1844
  } else do
@@ -1851,20 +1851,20 @@ function Ye(e, t, n, r, o, i, s, a, l, u) {
1851
1851
  i[i.indexOf(a)] = null, t.__e = a;
1852
1852
  } else for (Pe = i.length; Pe--; ) Qe(i[Pe]);
1853
1853
  else t.__e = n.__e, t.__k = n.__k;
1854
- R.__e(ee, t, n);
1854
+ T.__e(ee, t, n);
1855
1855
  }
1856
1856
  else i == null && t.__v == n.__v ? (t.__k = n.__k, t.__e = n.__e) : a = t.__e = Yr(n.__e, t, n, r, o, i, s, l, u);
1857
- return (f = R.diffed) && f(t), 128 & t.__u ? void 0 : a;
1857
+ return (f = T.diffed) && f(t), 128 & t.__u ? void 0 : a;
1858
1858
  }
1859
1859
  function un(e, t, n) {
1860
1860
  for (var r = 0; r < n.length; r++) et(n[r], n[++r], n[++r]);
1861
- R.__c && R.__c(t, e), e.some(function(o) {
1861
+ T.__c && T.__c(t, e), e.some(function(o) {
1862
1862
  try {
1863
1863
  e = o.__h, o.__h = [], e.some(function(i) {
1864
1864
  i.call(o);
1865
1865
  });
1866
1866
  } catch (i) {
1867
- R.__e(i, o.__v);
1867
+ T.__e(i, o.__v);
1868
1868
  }
1869
1869
  });
1870
1870
  }
@@ -1881,7 +1881,7 @@ function Yr(e, t, n, r, o, i, s, a, l) {
1881
1881
  }
1882
1882
  if (e == null) {
1883
1883
  if (y == null) return document.createTextNode(h);
1884
- e = document.createElementNS(o, y, h.is && h), a && (R.__m && R.__m(t, i), a = !1), i = null;
1884
+ e = document.createElementNS(o, y, h.is && h), a && (T.__m && T.__m(t, i), a = !1), i = null;
1885
1885
  }
1886
1886
  if (y == null) p === h || a && e.data == h || (e.data = h);
1887
1887
  else {
@@ -1907,16 +1907,16 @@ function et(e, t, n) {
1907
1907
  r && e.__u(), r && t == null || (e.__u = e(t));
1908
1908
  } else e.current = t;
1909
1909
  } catch (o) {
1910
- R.__e(o, n);
1910
+ T.__e(o, n);
1911
1911
  }
1912
1912
  }
1913
1913
  function dn(e, t, n) {
1914
1914
  var r, o;
1915
- if (R.unmount && R.unmount(e), (r = e.ref) && (r.current && r.current != e.__e || et(r, null, t)), (r = e.__c) != null) {
1915
+ if (T.unmount && T.unmount(e), (r = e.ref) && (r.current && r.current != e.__e || et(r, null, t)), (r = e.__c) != null) {
1916
1916
  if (r.componentWillUnmount) try {
1917
1917
  r.componentWillUnmount();
1918
1918
  } catch (i) {
1919
- R.__e(i, t);
1919
+ T.__e(i, t);
1920
1920
  }
1921
1921
  r.base = r.__P = null;
1922
1922
  }
@@ -1928,7 +1928,7 @@ function eo(e, t, n) {
1928
1928
  }
1929
1929
  function Ae(e, t, n) {
1930
1930
  var r, o, i, s;
1931
- t == document && (t = document.documentElement), R.__ && R.__(e, t), o = (r = typeof n == "function") ? null : n && n.__k || t.__k, i = [], s = [], Ye(t, e = (!r && n || t).__k = G(Q, null, [e]), o || oe, oe, t.namespaceURI, !r && n ? [n] : o ? null : t.firstChild ? le.call(t.childNodes) : null, i, !r && n ? n : o ? o.__e : t.firstChild, r, s), un(i, e, s);
1931
+ t == document && (t = document.documentElement), T.__ && T.__(e, t), o = (r = typeof n == "function") ? null : n && n.__k || t.__k, i = [], s = [], Ye(t, e = (!r && n || t).__k = G(Q, null, [e]), o || oe, oe, t.namespaceURI, !r && n ? [n] : o ? null : t.firstChild ? le.call(t.childNodes) : null, i, !r && n ? n : o ? o.__e : t.firstChild, r, s), un(i, e, s);
1932
1932
  }
1933
1933
  function pn(e, t) {
1934
1934
  Ae(e, t, pn);
@@ -1938,7 +1938,7 @@ function hn(e, t, n) {
1938
1938
  for (i in e.type && e.type.defaultProps && (s = e.type.defaultProps), t) i == "key" ? r = t[i] : i == "ref" ? o = t[i] : a[i] = t[i] === void 0 && s != null ? s[i] : t[i];
1939
1939
  return arguments.length > 2 && (a.children = arguments.length > 3 ? le.call(arguments, 2) : n), ne(e.type, a, r || e.key, o || e.ref, null);
1940
1940
  }
1941
- le = sn.slice, R = { __e: function(e, t, n, r) {
1941
+ le = sn.slice, T = { __e: function(e, t, n, r) {
1942
1942
  for (var o, i, s; t = t.__; ) if ((o = t.__c) && !o.__) try {
1943
1943
  if ((i = o.constructor) && i.getDerivedStateFromError != null && (o.setState(i.getDerivedStateFromError(e)), s = o.__d), o.componentDidCatch != null && (o.componentDidCatch(e, r || {}), s = o.__d), s) return o.__E = o;
1944
1944
  } catch (a) {
@@ -1960,9 +1960,9 @@ function m(e, t, n, r, o, i) {
1960
1960
  if ("ref" in l) for (a in l = {}, t) a == "ref" ? s = t[a] : l[a] = t[a];
1961
1961
  var u = { type: e, props: l, key: n, ref: s, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --to, __i: -1, __u: 0, __source: o, __self: i };
1962
1962
  if (typeof e == "function" && (s = e.defaultProps)) for (a in s) l[a] === void 0 && (l[a] = s[a]);
1963
- return R.vnode && R.vnode(u), u;
1963
+ return T.vnode && T.vnode(u), u;
1964
1964
  }
1965
- var ie, C, De, wt, ye = 0, mn = [], O = R, xt = O.__b, Et = O.__r, St = O.diffed, vt = O.__c, Tt = O.unmount, Rt = O.__;
1965
+ var ie, C, De, wt, ye = 0, mn = [], O = T, xt = O.__b, Et = O.__r, St = O.diffed, vt = O.__c, Rt = O.unmount, Tt = O.__;
1966
1966
  function tt(e, t) {
1967
1967
  O.__h && O.__h(C, e, ye || t), ye = 0;
1968
1968
  var n = C.__H || (C.__H = { __: [], __h: [] });
@@ -2028,7 +2028,7 @@ function oo() {
2028
2028
  O.__b = function(e) {
2029
2029
  C = null, xt && xt(e);
2030
2030
  }, O.__ = function(e, t) {
2031
- e && t.__k && t.__k.__m && (e.__m = t.__k.__m), Rt && Rt(e, t);
2031
+ e && t.__k && t.__k.__m && (e.__m = t.__k.__m), Tt && Tt(e, t);
2032
2032
  }, O.__r = function(e) {
2033
2033
  Et && Et(e), ie = 0;
2034
2034
  var t = (C = e.__c).__H;
@@ -2054,7 +2054,7 @@ O.__b = function(e) {
2054
2054
  }
2055
2055
  }), vt && vt(e, t);
2056
2056
  }, O.unmount = function(e) {
2057
- Tt && Tt(e);
2057
+ Rt && Rt(e);
2058
2058
  var t, n = e.__c;
2059
2059
  n && n.__H && (n.__H.__.forEach(function(r) {
2060
2060
  try {
@@ -2499,9 +2499,9 @@ const Ve = ({
2499
2499
  border: "1px solid #d9d9d9",
2500
2500
  color: "#222"
2501
2501
  },
2502
- option: (E, T, k) => ({
2503
- color: T ? "#bfbfbf" : E ? "#1890ff" : "#222",
2504
- background: E ? "#e6f7ff" : k && !T || T ? "#f5f5f5" : "#fff"
2502
+ option: (E, R, k) => ({
2503
+ color: R ? "#bfbfbf" : E ? "#1890ff" : "#222",
2504
+ background: E ? "#e6f7ff" : k && !R || R ? "#f5f5f5" : "#fff"
2505
2505
  }),
2506
2506
  placeholder: { color: "#bfbfbf" }
2507
2507
  } : {
@@ -2515,16 +2515,16 @@ const Ve = ({
2515
2515
  border: "1px solid #23262F",
2516
2516
  color: "#fff"
2517
2517
  },
2518
- option: (E, T, k) => ({
2519
- color: T ? "#666" : E ? "#00E8C6" : "#fff",
2520
- background: E ? "#23262F" : k && !T ? "#333843" : "#23262F"
2518
+ option: (E, R, k) => ({
2519
+ color: R ? "#666" : E ? "#00E8C6" : "#fff",
2520
+ background: E ? "#23262F" : k && !R ? "#333843" : "#23262F"
2521
2521
  }),
2522
2522
  placeholder: { color: "#666" }
2523
2523
  };
2524
2524
  Oe(() => {
2525
2525
  if (!c) return;
2526
- const E = (T) => {
2527
- b.current && !b.current.contains(T.target) && _(!1);
2526
+ const E = (R) => {
2527
+ b.current && !b.current.contains(R.target) && _(!1);
2528
2528
  };
2529
2529
  return document.addEventListener("mousedown", E), () => document.removeEventListener("mousedown", E);
2530
2530
  }, [c]);
@@ -2666,13 +2666,13 @@ const Ve = ({
2666
2666
  ]
2667
2667
  }
2668
2668
  ),
2669
- n.map((E, T) => /* @__PURE__ */ m(
2669
+ n.map((E, R) => /* @__PURE__ */ m(
2670
2670
  "div",
2671
2671
  {
2672
2672
  onClick: () => {
2673
2673
  E.disabled || (_(!1), t?.(E.value));
2674
2674
  },
2675
- onMouseEnter: () => x(T),
2675
+ onMouseEnter: () => x(R),
2676
2676
  onMouseLeave: () => x(null),
2677
2677
  style: {
2678
2678
  padding: "10px 16px",
@@ -2682,7 +2682,7 @@ const Ve = ({
2682
2682
  ...y.option(
2683
2683
  e === E.value,
2684
2684
  !!E.disabled,
2685
- g === T
2685
+ g === R
2686
2686
  )
2687
2687
  },
2688
2688
  children: E.label
@@ -2937,7 +2937,7 @@ const vo = ({ formState: e, setFormState: t, onClose: n, loading: r }) => {
2937
2937
  /* @__PURE__ */ m("button", { type: "submit", disabled: r, style: x, children: S(r ? "提交中..." : "去支付") })
2938
2938
  ] })
2939
2939
  ] });
2940
- }, To = {
2940
+ }, Ro = {
2941
2941
  white: {
2942
2942
  container: {
2943
2943
  border: "1px dashed #E5E6EB",
@@ -3014,7 +3014,7 @@ const vo = ({ formState: e, setFormState: t, onClose: n, loading: r }) => {
3014
3014
  cursor: "pointer"
3015
3015
  }
3016
3016
  }
3017
- }, Ro = ({
3017
+ }, To = ({
3018
3018
  value: e = [],
3019
3019
  onChange: t,
3020
3020
  maxCount: n = 10,
@@ -3024,7 +3024,7 @@ const vo = ({ formState: e, setFormState: t, onClose: n, loading: r }) => {
3024
3024
  }) => {
3025
3025
  const s = we(null), [a, l] = P(!1), [u, f] = P(0), b = JSON.parse(
3026
3026
  sessionStorage.getItem("fund_unit_params") || "{}"
3027
- ).theme === H.WHITE ? "white" : "dark", g = To[b], x = async (h) => {
3027
+ ).theme === H.WHITE ? "white" : "dark", g = Ro[b], x = async (h) => {
3028
3028
  const y = Array.from(h.target.files).slice(
3029
3029
  0,
3030
3030
  n
@@ -3034,11 +3034,11 @@ const vo = ({ formState: e, setFormState: t, onClose: n, loading: r }) => {
3034
3034
  const w = [];
3035
3035
  for (let E = 0; E < y.length; E++) {
3036
3036
  f(0);
3037
- const T = new FormData();
3038
- T.append("file", y[E]);
3037
+ const R = new FormData();
3038
+ R.append("file", y[E]);
3039
3039
  try {
3040
3040
  const k = await fo(
3041
- T,
3041
+ R,
3042
3042
  (I) => f(I)
3043
3043
  );
3044
3044
  k && w.push(k);
@@ -3303,7 +3303,7 @@ const vo = ({ formState: e, setFormState: t, onClose: n, loading: r }) => {
3303
3303
  S("上传文件")
3304
3304
  ] }),
3305
3305
  /* @__PURE__ */ m(
3306
- Ro,
3306
+ To,
3307
3307
  {
3308
3308
  value: e.files,
3309
3309
  onChange: (f) => t((c) => ({
@@ -3654,7 +3654,7 @@ function No() {
3654
3654
  )
3655
3655
  ] });
3656
3656
  }
3657
- yn(No, "best-recharge", ["theme"], { shadow: !1 });
3657
+ yn(No, "BestRecharge", ["theme"], { shadow: !1 });
3658
3658
  const Io = ({
3659
3659
  popover: e,
3660
3660
  children: t,
@@ -3667,8 +3667,8 @@ const Io = ({
3667
3667
  const [a, l] = P(!1), [u, f] = P(s), c = we(null), _ = we(null), b = () => {
3668
3668
  if (_.current && (clearTimeout(_.current), _.current = null), s === "top" || s === "bottom")
3669
3669
  if (c.current) {
3670
- const T = c.current.getBoundingClientRect();
3671
- s === "top" && T.top < 100 ? f("bottom") : s === "bottom" && window.innerHeight - T.bottom < 100 ? f("top") : f(s);
3670
+ const R = c.current.getBoundingClientRect();
3671
+ s === "top" && R.top < 100 ? f("bottom") : s === "bottom" && window.innerHeight - R.bottom < 100 ? f("top") : f(s);
3672
3672
  } else
3673
3673
  f(s);
3674
3674
  else
@@ -3986,7 +3986,7 @@ function Uo(e) {
3986
3986
  );
3987
3987
  }
3988
3988
  yn(Uo, "best-statistical-balance");
3989
- const si = ["best-recharge", "best-statistical-balance"];
3989
+ const si = ["BestRecharge", "best-statistical-balance"];
3990
3990
  export {
3991
3991
  si as components,
3992
3992
  oi as initFundUnit,
@@ -49,7 +49,7 @@ declare global {
49
49
 
50
50
  namespace JSX {
51
51
  interface IntrinsicElements {
52
- "best-recharge": {
52
+ BestRecharge: {
53
53
  theme?: any;
54
54
  merchant_id?: string;
55
55
  biz_type?: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "best-unit",
3
3
  "private": false,
4
- "version": "1.0.5",
4
+ "version": "1.0.6",
5
5
  "type": "module",
6
6
  "main": "dist/best-unit.cjs",
7
7
  "module": "dist/best-unit.js",
@@ -34,6 +34,6 @@ export function BestUnit() {
34
34
  );
35
35
  }
36
36
 
37
- register(BestUnit, "best-recharge", ["theme"], { shadow: false });
37
+ register(BestUnit, "BestRecharge", ["theme"], { shadow: false });
38
38
 
39
39
  export default BestUnit;
package/src/main.ts CHANGED
@@ -6,5 +6,5 @@ import "./components/business/recharge-sdk";
6
6
  import "./components/business/statistical-balance";
7
7
 
8
8
  // 可选:导出组件列表或版本信息
9
- export const components = ["best-recharge", "best-statistical-balance"];
9
+ export const components = ["BestRecharge", "best-statistical-balance"];
10
10
  export { npmTest, printCurrentTime, initFundUnit, viteProxy };
@@ -49,7 +49,7 @@ declare global {
49
49
 
50
50
  namespace JSX {
51
51
  interface IntrinsicElements {
52
- "best-recharge": {
52
+ BestRecharge: {
53
53
  theme?: any;
54
54
  merchant_id?: string;
55
55
  biz_type?: string;