best-unit 0.0.8 → 0.0.10
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/README.md +1 -0
- package/dist/best-unit.cjs +1 -1
- package/dist/best-unit.js +928 -491
- package/package.json +1 -1
- package/src/components/ModalForm/components/Button.tsx +7 -7
- package/src/components/ModalForm/components/OfflineTransferForm.tsx +302 -0
- package/src/components/ModalForm/components/OnlineRechargeForm.tsx +233 -0
- package/src/components/ModalForm/components/recharge.tsx +244 -0
- package/src/components/ModalForm/index.tsx +11 -8
- package/tsconfig.json +4 -1
- package/src/components/ModalForm/components/ModalForm.tsx +0 -189
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<!-- test -->
|
package/dist/best-unit.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function De(){console.log("npm package test!!!")}function Me(){console.log("Current time:",new Date().toISOString())}var D,h,ve,w,oe,ge,ye,be,X,G,J,A={},ke=[],ze=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,W=Array.isArray;function S(t,e){for(var n in e)t[n]=e[n];return t}function Z(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function $(t,e,n){var o,_,r,l={};for(r in e)r=="key"?o=e[r]:r=="ref"?_=e[r]:l[r]=e[r];if(arguments.length>2&&(l.children=arguments.length>3?D.call(arguments,2):n),typeof t=="function"&&t.defaultProps!=null)for(r in t.defaultProps)l[r]===void 0&&(l[r]=t.defaultProps[r]);return F(t,l,o,_,null)}function F(t,e,n,o,_){var r={type:t,props:e,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:_??++ve,__i:-1,__u:0};return _==null&&h.vnode!=null&&h.vnode(r),r}function I(t){return t.children}function L(t,e){this.props=t,this.context=e}function P(t,e){if(e==null)return t.__?P(t.__,t.__i+1):null;for(var n;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null)return n.__e;return typeof t.type=="function"?P(t):null}function Ce(t){var e,n;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null){t.__e=t.__c.base=n.__e;break}return Ce(t)}}function _e(t){(!t.__d&&(t.__d=!0)&&w.push(t)&&!j.__r++||oe!=h.debounceRendering)&&((oe=h.debounceRendering)||ge)(j)}function j(){for(var t,e,n,o,_,r,l,a=1;w.length;)w.length>a&&w.sort(ye),t=w.shift(),a=w.length,t.__d&&(n=void 0,_=(o=(e=t).__v).__e,r=[],l=[],e.__P&&((n=S({},o)).__v=o.__v+1,h.vnode&&h.vnode(n),ee(e.__P,n,o,e.__n,e.__P.namespaceURI,32&o.__u?[_]:null,r,_??P(o),!!(32&o.__u),l),n.__v=o.__v,n.__.__k[n.__i]=n,Ee(r,n,l),n.__e!=_&&Ce(n)));j.__r=0}function xe(t,e,n,o,_,r,l,a,u,c,s){var i,p,f,b,C,k,m=o&&o.__k||ke,v=e.length;for(u=Be(n,e,m,u,v),i=0;i<v;i++)(f=n.__k[i])!=null&&(p=f.__i==-1?A:m[f.__i]||A,f.__i=i,k=ee(t,f,p,_,r,l,a,u,c,s),b=f.__e,f.ref&&p.ref!=f.ref&&(p.ref&&te(p.ref,null,f),s.push(f.ref,f.__c||b,f)),C==null&&b!=null&&(C=b),4&f.__u||p.__k===f.__k?u=Se(f,u,t):typeof f.type=="function"&&k!==void 0?u=k:b&&(u=b.nextSibling),f.__u&=-7);return n.__e=C,u}function Be(t,e,n,o,_){var r,l,a,u,c,s=n.length,i=s,p=0;for(t.__k=new Array(_),r=0;r<_;r++)(l=e[r])!=null&&typeof l!="boolean"&&typeof l!="function"?(u=r+p,(l=t.__k[r]=typeof l=="string"||typeof l=="number"||typeof l=="bigint"||l.constructor==String?F(null,l,null,null,null):W(l)?F(I,{children:l},null,null,null):l.constructor==null&&l.__b>0?F(l.type,l.props,l.key,l.ref?l.ref:null,l.__v):l).__=t,l.__b=t.__b+1,a=null,(c=l.__i=Le(l,n,u,i))!=-1&&(i--,(a=n[c])&&(a.__u|=2)),a==null||a.__v==null?(c==-1&&(_>s?p--:_<s&&p++),typeof l.type!="function"&&(l.__u|=4)):c!=u&&(c==u-1?p--:c==u+1?p++:(c>u?p--:p++,l.__u|=4))):t.__k[r]=null;if(i)for(r=0;r<s;r++)(a=n[r])!=null&&(2&a.__u)==0&&(a.__e==o&&(o=P(a)),$e(a,a));return o}function Se(t,e,n){var o,_;if(typeof t.type=="function"){for(o=t.__k,_=0;o&&_<o.length;_++)o[_]&&(o[_].__=t,e=Se(o[_],e,n));return e}t.__e!=e&&(e&&t.type&&!n.contains(e)&&(e=P(t)),n.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function Le(t,e,n,o){var _,r,l=t.key,a=t.type,u=e[n];if(u===null&&t.key==null||u&&l==u.key&&a==u.type&&(2&u.__u)==0)return n;if(o>(u!=null&&(2&u.__u)==0?1:0))for(_=n-1,r=n+1;_>=0||r<e.length;){if(_>=0){if((u=e[_])&&(2&u.__u)==0&&l==u.key&&a==u.type)return _;_--}if(r<e.length){if((u=e[r])&&(2&u.__u)==0&&l==u.key&&a==u.type)return r;r++}}return-1}function ie(t,e,n){e[0]=="-"?t.setProperty(e,n??""):t[e]=n==null?"":typeof n!="number"||ze.test(e)?n:n+"px"}function B(t,e,n,o,_){var r,l;e:if(e=="style")if(typeof n=="string")t.style.cssText=n;else{if(typeof o=="string"&&(t.style.cssText=o=""),o)for(e in o)n&&e in n||ie(t.style,e,"");if(n)for(e in n)o&&n[e]==o[e]||ie(t.style,e,n[e])}else if(e[0]=="o"&&e[1]=="n")r=e!=(e=e.replace(be,"$1")),l=e.toLowerCase(),e=l in t||e=="onFocusOut"||e=="onFocusIn"?l.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+r]=n,n?o?n.u=o.u:(n.u=X,t.addEventListener(e,r?J:G,r)):t.removeEventListener(e,r?J:G,r);else{if(_=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&n==1?"":n))}}function le(t){return function(e){if(this.l){var n=this.l[e.type+t];if(e.t==null)e.t=X++;else if(e.t<n.u)return;return n(h.event?h.event(e):e)}}}function ee(t,e,n,o,_,r,l,a,u,c){var s,i,p,f,b,C,k,m,v,T,E,M,H,re,z,U,V,x=e.type;if(e.constructor!=null)return null;128&n.__u&&(u=!!(32&n.__u),r=[a=e.__e=n.__e]),(s=h.__b)&&s(e);e:if(typeof x=="function")try{if(m=e.props,v="prototype"in x&&x.prototype.render,T=(s=x.contextType)&&o[s.__c],E=s?T?T.props.value:s.__:o,n.__c?k=(i=e.__c=n.__c).__=i.__E:(v?e.__c=i=new x(m,E):(e.__c=i=new L(m,E),i.constructor=x,i.render=je),T&&T.sub(i),i.props=m,i.state||(i.state={}),i.context=E,i.__n=o,p=i.__d=!0,i.__h=[],i._sb=[]),v&&i.__s==null&&(i.__s=i.state),v&&x.getDerivedStateFromProps!=null&&(i.__s==i.state&&(i.__s=S({},i.__s)),S(i.__s,x.getDerivedStateFromProps(m,i.__s))),f=i.props,b=i.state,i.__v=e,p)v&&x.getDerivedStateFromProps==null&&i.componentWillMount!=null&&i.componentWillMount(),v&&i.componentDidMount!=null&&i.__h.push(i.componentDidMount);else{if(v&&x.getDerivedStateFromProps==null&&m!==f&&i.componentWillReceiveProps!=null&&i.componentWillReceiveProps(m,E),!i.__e&&i.shouldComponentUpdate!=null&&i.shouldComponentUpdate(m,i.__s,E)===!1||e.__v==n.__v){for(e.__v!=n.__v&&(i.props=m,i.state=i.__s,i.__d=!1),e.__e=n.__e,e.__k=n.__k,e.__k.some(function(N){N&&(N.__=e)}),M=0;M<i._sb.length;M++)i.__h.push(i._sb[M]);i._sb=[],i.__h.length&&l.push(i);break e}i.componentWillUpdate!=null&&i.componentWillUpdate(m,i.__s,E),v&&i.componentDidUpdate!=null&&i.__h.push(function(){i.componentDidUpdate(f,b,C)})}if(i.context=E,i.props=m,i.__P=t,i.__e=!1,H=h.__r,re=0,v){for(i.state=i.__s,i.__d=!1,H&&H(e),s=i.render(i.props,i.state,i.context),z=0;z<i._sb.length;z++)i.__h.push(i._sb[z]);i._sb=[]}else do i.__d=!1,H&&H(e),s=i.render(i.props,i.state,i.context),i.state=i.__s;while(i.__d&&++re<25);i.state=i.__s,i.getChildContext!=null&&(o=S(S({},o),i.getChildContext())),v&&!p&&i.getSnapshotBeforeUpdate!=null&&(C=i.getSnapshotBeforeUpdate(f,b)),U=s,s!=null&&s.type===I&&s.key==null&&(U=we(s.props.children)),a=xe(t,W(U)?U:[U],e,n,o,_,r,l,a,u,c),i.base=e.__e,e.__u&=-161,i.__h.length&&l.push(i),k&&(i.__E=i.__=null)}catch(N){if(e.__v=null,u||r!=null)if(N.then){for(e.__u|=u?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;r[r.indexOf(a)]=null,e.__e=a}else for(V=r.length;V--;)Z(r[V]);else e.__e=n.__e,e.__k=n.__k;h.__e(N,e,n)}else r==null&&e.__v==n.__v?(e.__k=n.__k,e.__e=n.__e):a=e.__e=Re(n.__e,e,n,o,_,r,l,u,c);return(s=h.diffed)&&s(e),128&e.__u?void 0:a}function Ee(t,e,n){for(var o=0;o<n.length;o++)te(n[o],n[++o],n[++o]);h.__c&&h.__c(e,t),t.some(function(_){try{t=_.__h,_.__h=[],t.some(function(r){r.call(_)})}catch(r){h.__e(r,_.__v)}})}function we(t){return typeof t!="object"||t==null||t.__b&&t.__b>0?t:W(t)?t.map(we):S({},t)}function Re(t,e,n,o,_,r,l,a,u){var c,s,i,p,f,b,C,k=n.props,m=e.props,v=e.type;if(v=="svg"?_="http://www.w3.org/2000/svg":v=="math"?_="http://www.w3.org/1998/Math/MathML":_||(_="http://www.w3.org/1999/xhtml"),r!=null){for(c=0;c<r.length;c++)if((f=r[c])&&"setAttribute"in f==!!v&&(v?f.localName==v:f.nodeType==3)){t=f,r[c]=null;break}}if(t==null){if(v==null)return document.createTextNode(m);t=document.createElementNS(_,v,m.is&&m),a&&(h.__m&&h.__m(e,r),a=!1),r=null}if(v==null)k===m||a&&t.data==m||(t.data=m);else{if(r=r&&D.call(t.childNodes),k=n.props||A,!a&&r!=null)for(k={},c=0;c<t.attributes.length;c++)k[(f=t.attributes[c]).name]=f.value;for(c in k)if(f=k[c],c!="children"){if(c=="dangerouslySetInnerHTML")i=f;else if(!(c in m)){if(c=="value"&&"defaultValue"in m||c=="checked"&&"defaultChecked"in m)continue;B(t,c,null,f,_)}}for(c in m)f=m[c],c=="children"?p=f:c=="dangerouslySetInnerHTML"?s=f:c=="value"?b=f:c=="checked"?C=f:a&&typeof f!="function"||k[c]===f||B(t,c,f,k[c],_);if(s)a||i&&(s.__html==i.__html||s.__html==t.innerHTML)||(t.innerHTML=s.__html),e.__k=[];else if(i&&(t.innerHTML=""),xe(e.type=="template"?t.content:t,W(p)?p:[p],e,n,o,v=="foreignObject"?"http://www.w3.org/1999/xhtml":_,r,l,r?r[0]:n.__k&&P(n,0),a,u),r!=null)for(c=r.length;c--;)Z(r[c]);a||(c="value",v=="progress"&&b==null?t.removeAttribute("value"):b!=null&&(b!==t[c]||v=="progress"&&!b||v=="option"&&b!=k[c])&&B(t,c,b,k[c],_),c="checked",C!=null&&C!=t[c]&&B(t,c,C,k[c],_))}return t}function te(t,e,n){try{if(typeof t=="function"){var o=typeof t.__u=="function";o&&t.__u(),o&&e==null||(t.__u=t(e))}else t.current=e}catch(_){h.__e(_,n)}}function $e(t,e,n){var o,_;if(h.unmount&&h.unmount(t),(o=t.ref)&&(o.current&&o.current!=t.__e||te(o,null,e)),(o=t.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(r){h.__e(r,e)}o.base=o.__P=null}if(o=t.__k)for(_=0;_<o.length;_++)o[_]&&$e(o[_],e,n||typeof t.type!="function");n||Z(t.__e),t.__c=t.__=t.__e=void 0}function je(t,e,n){return this.constructor(t,n)}function q(t,e,n){var o,_,r,l;e==document&&(e=document.documentElement),h.__&&h.__(t,e),_=(o=typeof n=="function")?null:n&&n.__k||e.__k,r=[],l=[],ee(e,t=(!o&&n||e).__k=$(I,null,[t]),_||A,A,e.namespaceURI,!o&&n?[n]:_?null:e.firstChild?D.call(e.childNodes):null,r,!o&&n?n:_?_.__e:e.firstChild,o,l),Ee(r,t,l)}function Pe(t,e){q(t,e,Pe)}function Te(t,e,n){var o,_,r,l,a=S({},t.props);for(r in t.type&&t.type.defaultProps&&(l=t.type.defaultProps),e)r=="key"?o=e[r]:r=="ref"?_=e[r]:a[r]=e[r]===void 0&&l!=null?l[r]:e[r];return arguments.length>2&&(a.children=arguments.length>3?D.call(arguments,2):n),F(t.type,a,o||t.key,_||t.ref,null)}D=ke.slice,h={__e:function(t,e,n,o){for(var _,r,l;e=e.__;)if((_=e.__c)&&!_.__)try{if((r=_.constructor)&&r.getDerivedStateFromError!=null&&(_.setState(r.getDerivedStateFromError(t)),l=_.__d),_.componentDidCatch!=null&&(_.componentDidCatch(t,o||{}),l=_.__d),l)return _.__E=_}catch(a){t=a}throw t}},ve=0,L.prototype.setState=function(t,e){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=S({},this.state),typeof t=="function"&&(t=t(S({},n),this.props)),t&&S(n,t),t!=null&&this.__v&&(e&&this._sb.push(e),_e(this))},L.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),_e(this))},L.prototype.render=I,w=[],ge=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ye=function(t,e){return t.__v.__b-e.__v.__b},j.__r=0,be=/(PointerCapture)$|Capture$/i,X=0,G=le(!1),J=le(!0);var Oe=0;function d(t,e,n,o,_,r){e||(e={});var l,a,u=e;if("ref"in u)for(a in u={},e)a=="ref"?l=e[a]:u[a]=e[a];var c={type:t,props:u,key:n,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Oe,__i:-1,__u:0,__source:_,__self:r};if(typeof t=="function"&&(l=t.defaultProps))for(a in l)u[a]===void 0&&(u[a]=l[a]);return h.vnode&&h.vnode(c),c}var O,g,Y,ae,K=0,He=[],y=h,ce=y.__b,ue=y.__r,se=y.diffed,fe=y.__c,pe=y.unmount,de=y.__;function Ue(t,e){y.__h&&y.__h(g,t,K||e),K=0;var n=g.__H||(g.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function Ne(t){return K=1,We(Fe,t)}function We(t,e,n){var o=Ue(O++,2);if(o.t=t,!o.__c&&(o.__=[Fe(void 0,e),function(a){var u=o.__N?o.__N[0]:o.__[0],c=o.t(u,a);u!==c&&(o.__N=[c,o.__[1]],o.__c.setState({}))}],o.__c=g,!g.__f)){var _=function(a,u,c){if(!o.__c.__H)return!0;var s=o.__c.__H.__.filter(function(p){return!!p.__c});if(s.every(function(p){return!p.__N}))return!r||r.call(this,a,u,c);var i=o.__c.props!==a;return s.forEach(function(p){if(p.__N){var f=p.__[0];p.__=p.__N,p.__N=void 0,f!==p.__[0]&&(i=!0)}}),r&&r.call(this,a,u,c)||i};g.__f=!0;var r=g.shouldComponentUpdate,l=g.componentWillUpdate;g.componentWillUpdate=function(a,u,c){if(this.__e){var s=r;r=void 0,_(a,u,c),r=s}l&&l.call(this,a,u,c)},g.shouldComponentUpdate=_}return o.__N||o.__}function Ie(t,e){var n=Ue(O++,3);!y.__s&&Ye(n.__H,e)&&(n.__=t,n.u=e,g.__H.__h.push(n))}function qe(){for(var t;t=He.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(R),t.__H.__h.forEach(Q),t.__H.__h=[]}catch(e){t.__H.__h=[],y.__e(e,t.__v)}}y.__b=function(t){g=null,ce&&ce(t)},y.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),de&&de(t,e)},y.__r=function(t){ue&&ue(t),O=0;var e=(g=t.__c).__H;e&&(Y===g?(e.__h=[],g.__h=[],e.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(e.__h.forEach(R),e.__h.forEach(Q),e.__h=[],O=0)),Y=g},y.diffed=function(t){se&&se(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(He.push(e)!==1&&ae===y.requestAnimationFrame||((ae=y.requestAnimationFrame)||Ve)(qe)),e.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0})),Y=g=null},y.__c=function(t,e){e.some(function(n){try{n.__h.forEach(R),n.__h=n.__h.filter(function(o){return!o.__||Q(o)})}catch(o){e.some(function(_){_.__h&&(_.__h=[])}),e=[],y.__e(o,n.__v)}}),fe&&fe(t,e)},y.unmount=function(t){pe&&pe(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.forEach(function(o){try{R(o)}catch(_){e=_}}),n.__H=void 0,e&&y.__e(e,n.__v))};var he=typeof requestAnimationFrame=="function";function Ve(t){var e,n=function(){clearTimeout(o),he&&cancelAnimationFrame(e),setTimeout(t)},o=setTimeout(n,35);he&&(e=requestAnimationFrame(n))}function R(t){var e=g,n=t.__c;typeof n=="function"&&(t.__c=void 0,n()),g=e}function Q(t){var e=g;t.__c=t.__(),g=e}function Ye(t,e){return!t||t.length!==e.length||e.some(function(n,o){return n!==t[o]})}function Fe(t,e){return typeof e=="function"?e(t):e}function Ge({onClick:t,color:e,children:n}){return d("button",{style:{background:e||"#1890ff",color:"#fff",border:"none",borderRadius:4,padding:"8px 16px",cursor:"pointer",fontSize:16},onClick:t,children:n})}function Je({visible:t,onClose:e,onSubmit:n,color:o}){const[_,r]=Ne({amount:"",rechargeChannel:"paypal",currency:"USD",loading:!1,error:"",amountError:"",rechargeChannelError:"",currencyError:""});return Ie(()=>{t||r({amount:"",rechargeChannel:"paypal",currency:"USD",loading:!1,error:"",amountError:"",rechargeChannelError:"",currencyError:""})},[t]),t?d("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"rgba(0,0,0,0.7)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999},onClick:u=>{u.target===u.currentTarget&&e()},children:d("form",{onSubmit:async u=>{u.preventDefault();let c=!0;if(r(s=>({...s,amountError:"",rechargeChannelError:""})),_.amount.trim()||(r(s=>({...s,amountError:"请输入充值金额"})),c=!1),_.rechargeChannel||(r(s=>({...s,rechargeChannelError:"请选择支付平台"})),c=!1),!!c){r(s=>({...s,loading:!0,error:""}));try{await n({amount:_.amount,rechargeChannel:_.rechargeChannel,currency:_.currency}),e()}catch{r(s=>({...s,error:"提交失败,请重试"}))}finally{r(s=>({...s,loading:!1}))}}},style:{background:"#181A20",padding:32,borderRadius:12,minWidth:360,color:o||"#fff",boxShadow:"0 4px 24px rgba(0,0,0,0.5)",position:"relative"},onClick:u=>u.stopPropagation(),children:[d("button",{type:"button",onClick:e,style:{position:"absolute",right:16,top:16,background:"none",border:"none",color:"#fff",fontSize:22,cursor:"pointer",lineHeight:1},"aria-label":"关闭",children:"×"}),d("div",{style:{fontWeight:600,fontSize:18,marginBottom:24,textAlign:"left"},children:"在线充值"}),d("div",{style:{marginBottom:18},children:[d("div",{style:{marginBottom:8,fontSize:14},children:[d("span",{style:{color:"#00E8C6"},children:"*"})," 充值金额"]}),d("input",{type:"text",placeholder:"请输入充值金额",value:_.amount,onInput:u=>{const c=u.target.value;r(s=>({...s,amount:c,amountError:c.trim()?"":s.amountError}))},style:{width:"100%",padding:"10px 12px",borderRadius:6,boxSizing:"border-box",border:_.amountError?"1px solid #ff4d4f":"1px solid #23262F",background:"#23262F",color:"#fff",fontSize:15,outline:"none",marginBottom:0}}),_.amountError&&d("div",{style:{color:"#ff4d4f",fontSize:13,marginTop:4},children:_.amountError})]}),d("div",{style:{marginBottom:18},children:[d("div",{style:{marginBottom:8,fontSize:14},children:[d("span",{style:{color:"#00E8C6"},children:"*"})," 支付平台"]}),d("select",{style:{width:"100%",padding:"10px 12px",borderRadius:6,border:_.rechargeChannelError?"1px solid #ff4d4f":"1px solid #23262F",background:"#23262F",color:"#fff",fontSize:15,outline:"none"},value:_.rechargeChannel,onInput:u=>{const c=u.target.value;r(s=>({...s,rechargeChannel:c,rechargeChannelError:c?"":s.rechargeChannelError}))},children:[d("option",{value:"alipay",children:"支付宝"}),d("option",{value:"wechat",children:"微信"}),d("option",{value:"paypal",children:"PayPal"})]}),_.rechargeChannelError&&d("div",{style:{color:"#ff4d4f",fontSize:13,marginTop:4},children:_.rechargeChannelError})]}),d("div",{style:{marginBottom:24},children:[d("div",{style:{marginBottom:8,fontSize:14},children:"币种"}),d("select",{style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid #23262F",background:"#23262F",color:"#fff",fontSize:15,outline:"none"},value:_.currency,children:[d("option",{value:"USD",children:"USD"}),d("option",{value:"CNY",children:"CNY"}),d("option",{value:"EUR",children:"EUR"})]})]}),_.error&&d("div",{style:{color:"#ff4d4f",marginBottom:12},children:_.error}),d("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[d("button",{type:"button",onClick:e,style:{background:"#23262F",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer"},children:"取消"}),d("button",{type:"submit",disabled:_.loading,style:{background:"#00E8C6",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer",fontWeight:600},children:_.loading?"提交中...":"去支付"})]})]})}):null}function ne(){return(ne=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t}).apply(this,arguments)}var Ke=["context","children"];function Qe(t){this.getChildContext=function(){return t.context};var e=t.children,n=function(o,_){if(o==null)return{};var r,l,a={},u=Object.keys(o);for(l=0;l<u.length;l++)_.indexOf(r=u[l])>=0||(a[r]=o[r]);return a}(t,Ke);return Te(e,n)}function Xe(){var t=new CustomEvent("_preact",{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(t),this._vdom=$(Qe,ne({},this._props,{context:t.detail.context}),function e(n,o){if(n.nodeType===3)return n.data;if(n.nodeType!==1)return null;var _=[],r={},l=0,a=n.attributes,u=n.childNodes;for(l=a.length;l--;)a[l].name!=="slot"&&(r[a[l].name]=a[l].value,r[Ae(a[l].name)]=a[l].value);for(l=u.length;l--;){var c=e(u[l],null),s=u[l].slot;s?r[s]=$(me,{name:s},c):_[l]=c}var i=o?$(me,null,_):_;return $(o||n.nodeName.toLowerCase(),r,i)}(this,this._vdomComponent)),(this.hasAttribute("hydrate")?Pe:q)(this._vdom,this._root)}function Ae(t){return t.replace(/-(\w)/g,function(e,n){return n?n.toUpperCase():""})}function Ze(t,e,n){if(this._vdom){var o={};o[t]=n=n??void 0,o[Ae(t)]=n,this._vdom=Te(this._vdom,o),q(this._vdom,this._root)}}function et(){q(this._vdom=null,this._root)}function me(t,e){var n=this;return $("slot",ne({},t,{ref:function(o){o?(n.ref=o,n._listener||(n._listener=function(_){_.stopPropagation(),_.detail.context=e},o.addEventListener("_preact",n._listener))):n.ref.removeEventListener("_preact",n._listener)}}))}function tt(t,e,n,o){function _(){var r=Reflect.construct(HTMLElement,[],_);return r._vdomComponent=t,r._root=r,r}return(_.prototype=Object.create(HTMLElement.prototype)).constructor=_,_.prototype.connectedCallback=Xe,_.prototype.attributeChangedCallback=Ze,_.prototype.disconnectedCallback=et,n=n||t.observedAttributes||Object.keys(t.propTypes||{}),_.observedAttributes=n,n.forEach(function(r){Object.defineProperty(_.prototype,r,{get:function(){return this._vdom.props[r]},set:function(l){this._vdom?this.attributeChangedCallback(r,null,l):(this._props||(this._props={}),this._props[r]=l,this.connectedCallback());var a=typeof l;l!=null&&a!=="string"&&a!=="boolean"&&a!=="number"||this.setAttribute(r,l)}})}),customElements.define(e,_)}function nt(t){const[e,n]=Ne(!1),o=t.theme?.primaryColor;return d("div",{children:[d(Ge,{color:o,onClick:()=>n(!0),children:"打开表单"}),d(Je,{visible:e,onClose:()=>n(!1),onSubmit:async r=>{console.log("submit",r)},color:o})]})}tt(nt,"x-best-modal-form",["theme"]);const rt=["x-greeting","x-best-modal-form"];exports.components=rt;exports.npmTest=De;exports.printCurrentTime=Me;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function He(){console.log("npm package test!!!")}function Ae(){console.log("Current time:",new Date().toISOString())}var H,g,me,w,le,be,xe,Ee,Z,K,Q,D={},ke=[],Ne=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,G=Array.isArray;function C(e,n){for(var r in n)e[r]=n[r];return e}function ee(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function S(e,n,r){var t,l,o,_={};for(o in n)o=="key"?t=n[o]:o=="ref"?l=n[o]:_[o]=n[o];if(arguments.length>2&&(_.children=arguments.length>3?H.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)_[o]===void 0&&(_[o]=e.defaultProps[o]);return I(e,_,t,l,null)}function I(e,n,r,t,l){var o={type:e,props:n,key:r,ref:t,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:l??++me,__i:-1,__u:0};return l==null&&g.vnode!=null&&g.vnode(o),o}function A(e){return e.children}function O(e,n){this.props=e,this.context=n}function B(e,n){if(n==null)return e.__?B(e.__,e.__i+1):null;for(var r;n<e.__k.length;n++)if((r=e.__k[n])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?B(e):null}function Ce(e){var n,r;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,n=0;n<e.__k.length;n++)if((r=e.__k[n])!=null&&r.__e!=null){e.__e=e.__c.base=r.__e;break}return Ce(e)}}function _e(e){(!e.__d&&(e.__d=!0)&&w.push(e)&&!W.__r++||le!=g.debounceRendering)&&((le=g.debounceRendering)||be)(W)}function W(){for(var e,n,r,t,l,o,_,a=1;w.length;)w.length>a&&w.sort(xe),e=w.shift(),a=w.length,e.__d&&(r=void 0,l=(t=(n=e).__v).__e,o=[],_=[],n.__P&&((r=C({},t)).__v=t.__v+1,g.vnode&&g.vnode(r),ne(n.__P,r,t,n.__n,n.__P.namespaceURI,32&t.__u?[l]:null,o,l??B(t),!!(32&t.__u),_),r.__v=t.__v,r.__.__k[r.__i]=r,Se(o,r,_),r.__e!=l&&Ce(r)));W.__r=0}function Fe(e,n,r,t,l,o,_,a,f,s,p){var i,d,c,h,E,x,y=t&&t.__k||ke,v=n.length;for(f=Ue(r,n,y,f,v),i=0;i<v;i++)(c=r.__k[i])!=null&&(d=c.__i==-1?D:y[c.__i]||D,c.__i=i,x=ne(e,c,d,l,o,_,a,f,s,p),h=c.__e,c.ref&&d.ref!=c.ref&&(d.ref&&re(d.ref,null,c),p.push(c.ref,c.__c||h,c)),E==null&&h!=null&&(E=h),4&c.__u||d.__k===c.__k?f=we(c,f,e):typeof c.type=="function"&&x!==void 0?f=x:h&&(f=h.nextSibling),c.__u&=-7);return r.__e=E,f}function Ue(e,n,r,t,l){var o,_,a,f,s,p=r.length,i=p,d=0;for(e.__k=new Array(l),o=0;o<l;o++)(_=n[o])!=null&&typeof _!="boolean"&&typeof _!="function"?(f=o+d,(_=e.__k[o]=typeof _=="string"||typeof _=="number"||typeof _=="bigint"||_.constructor==String?I(null,_,null,null,null):G(_)?I(A,{children:_},null,null,null):_.constructor==null&&_.__b>0?I(_.type,_.props,_.key,_.ref?_.ref:null,_.__v):_).__=e,_.__b=e.__b+1,a=null,(s=_.__i=Me(_,r,f,i))!=-1&&(i--,(a=r[s])&&(a.__u|=2)),a==null||a.__v==null?(s==-1&&(l>p?d--:l<p&&d++),typeof _.type!="function"&&(_.__u|=4)):s!=f&&(s==f-1?d--:s==f+1?d++:(s>f?d--:d++,_.__u|=4))):e.__k[o]=null;if(i)for(o=0;o<p;o++)(a=r[o])!=null&&(2&a.__u)==0&&(a.__e==t&&(t=B(a)),$e(a,a));return t}function we(e,n,r){var t,l;if(typeof e.type=="function"){for(t=e.__k,l=0;t&&l<t.length;l++)t[l]&&(t[l].__=e,n=we(t[l],n,r));return n}e.__e!=n&&(n&&e.type&&!r.contains(n)&&(n=B(e)),r.insertBefore(e.__e,n||null),n=e.__e);do n=n&&n.nextSibling;while(n!=null&&n.nodeType==8);return n}function Me(e,n,r,t){var l,o,_=e.key,a=e.type,f=n[r];if(f===null&&e.key==null||f&&_==f.key&&a==f.type&&(2&f.__u)==0)return r;if(t>(f!=null&&(2&f.__u)==0?1:0))for(l=r-1,o=r+1;l>=0||o<n.length;){if(l>=0){if((f=n[l])&&(2&f.__u)==0&&_==f.key&&a==f.type)return l;l--}if(o<n.length){if((f=n[o])&&(2&f.__u)==0&&_==f.key&&a==f.type)return o;o++}}return-1}function ae(e,n,r){n[0]=="-"?e.setProperty(n,r??""):e[n]=r==null?"":typeof r!="number"||Ne.test(n)?r:r+"px"}function M(e,n,r,t,l){var o,_;e:if(n=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof t=="string"&&(e.style.cssText=t=""),t)for(n in t)r&&n in r||ae(e.style,n,"");if(r)for(n in r)t&&r[n]==t[n]||ae(e.style,n,r[n])}else if(n[0]=="o"&&n[1]=="n")o=n!=(n=n.replace(Ee,"$1")),_=n.toLowerCase(),n=_ in e||n=="onFocusOut"||n=="onFocusIn"?_.slice(2):n.slice(2),e.l||(e.l={}),e.l[n+o]=r,r?t?r.u=t.u:(r.u=Z,e.addEventListener(n,o?Q:K,o)):e.removeEventListener(n,o?Q:K,o);else{if(l=="http://www.w3.org/2000/svg")n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(n!="width"&&n!="height"&&n!="href"&&n!="list"&&n!="form"&&n!="tabIndex"&&n!="download"&&n!="rowSpan"&&n!="colSpan"&&n!="role"&&n!="popover"&&n in e)try{e[n]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&n[4]!="-"?e.removeAttribute(n):e.setAttribute(n,n=="popover"&&r==1?"":r))}}function ce(e){return function(n){if(this.l){var r=this.l[n.type+e];if(n.t==null)n.t=Z++;else if(n.t<r.u)return;return r(g.event?g.event(n):n)}}}function ne(e,n,r,t,l,o,_,a,f,s){var p,i,d,c,h,E,x,y,v,$,F,N,z,ie,U,P,J,k=n.type;if(n.constructor!=null)return null;128&r.__u&&(f=!!(32&r.__u),o=[a=n.__e=r.__e]),(p=g.__b)&&p(n);e:if(typeof k=="function")try{if(y=n.props,v="prototype"in k&&k.prototype.render,$=(p=k.contextType)&&t[p.__c],F=p?$?$.props.value:p.__:t,r.__c?x=(i=n.__c=r.__c).__=i.__E:(v?n.__c=i=new k(y,F):(n.__c=i=new O(y,F),i.constructor=k,i.render=je),$&&$.sub(i),i.props=y,i.state||(i.state={}),i.context=F,i.__n=t,d=i.__d=!0,i.__h=[],i._sb=[]),v&&i.__s==null&&(i.__s=i.state),v&&k.getDerivedStateFromProps!=null&&(i.__s==i.state&&(i.__s=C({},i.__s)),C(i.__s,k.getDerivedStateFromProps(y,i.__s))),c=i.props,h=i.state,i.__v=n,d)v&&k.getDerivedStateFromProps==null&&i.componentWillMount!=null&&i.componentWillMount(),v&&i.componentDidMount!=null&&i.__h.push(i.componentDidMount);else{if(v&&k.getDerivedStateFromProps==null&&y!==c&&i.componentWillReceiveProps!=null&&i.componentWillReceiveProps(y,F),!i.__e&&i.shouldComponentUpdate!=null&&i.shouldComponentUpdate(y,i.__s,F)===!1||n.__v==r.__v){for(n.__v!=r.__v&&(i.props=y,i.state=i.__s,i.__d=!1),n.__e=r.__e,n.__k=r.__k,n.__k.some(function(T){T&&(T.__=n)}),N=0;N<i._sb.length;N++)i.__h.push(i._sb[N]);i._sb=[],i.__h.length&&_.push(i);break e}i.componentWillUpdate!=null&&i.componentWillUpdate(y,i.__s,F),v&&i.componentDidUpdate!=null&&i.__h.push(function(){i.componentDidUpdate(c,h,E)})}if(i.context=F,i.props=y,i.__P=e,i.__e=!1,z=g.__r,ie=0,v){for(i.state=i.__s,i.__d=!1,z&&z(n),p=i.render(i.props,i.state,i.context),U=0;U<i._sb.length;U++)i.__h.push(i._sb[U]);i._sb=[]}else do i.__d=!1,z&&z(n),p=i.render(i.props,i.state,i.context),i.state=i.__s;while(i.__d&&++ie<25);i.state=i.__s,i.getChildContext!=null&&(t=C(C({},t),i.getChildContext())),v&&!d&&i.getSnapshotBeforeUpdate!=null&&(E=i.getSnapshotBeforeUpdate(c,h)),P=p,p!=null&&p.type===A&&p.key==null&&(P=Be(p.props.children)),a=Fe(e,G(P)?P:[P],n,r,t,l,o,_,a,f,s),i.base=n.__e,n.__u&=-161,i.__h.length&&_.push(i),x&&(i.__E=i.__=null)}catch(T){if(n.__v=null,f||o!=null)if(T.then){for(n.__u|=f?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;o[o.indexOf(a)]=null,n.__e=a}else for(J=o.length;J--;)ee(o[J]);else n.__e=r.__e,n.__k=r.__k;g.__e(T,n,r)}else o==null&&n.__v==r.__v?(n.__k=r.__k,n.__e=r.__e):a=n.__e=Oe(r.__e,n,r,t,l,o,_,f,s);return(p=g.diffed)&&p(n),128&n.__u?void 0:a}function Se(e,n,r){for(var t=0;t<r.length;t++)re(r[t],r[++t],r[++t]);g.__c&&g.__c(n,e),e.some(function(l){try{e=l.__h,l.__h=[],e.some(function(o){o.call(l)})}catch(o){g.__e(o,l.__v)}})}function Be(e){return typeof e!="object"||e==null||e.__b&&e.__b>0?e:G(e)?e.map(Be):C({},e)}function Oe(e,n,r,t,l,o,_,a,f){var s,p,i,d,c,h,E,x=r.props,y=n.props,v=n.type;if(v=="svg"?l="http://www.w3.org/2000/svg":v=="math"?l="http://www.w3.org/1998/Math/MathML":l||(l="http://www.w3.org/1999/xhtml"),o!=null){for(s=0;s<o.length;s++)if((c=o[s])&&"setAttribute"in c==!!v&&(v?c.localName==v:c.nodeType==3)){e=c,o[s]=null;break}}if(e==null){if(v==null)return document.createTextNode(y);e=document.createElementNS(l,v,y.is&&y),a&&(g.__m&&g.__m(n,o),a=!1),o=null}if(v==null)x===y||a&&e.data==y||(e.data=y);else{if(o=o&&H.call(e.childNodes),x=r.props||D,!a&&o!=null)for(x={},s=0;s<e.attributes.length;s++)x[(c=e.attributes[s]).name]=c.value;for(s in x)if(c=x[s],s!="children"){if(s=="dangerouslySetInnerHTML")i=c;else if(!(s in y)){if(s=="value"&&"defaultValue"in y||s=="checked"&&"defaultChecked"in y)continue;M(e,s,null,c,l)}}for(s in y)c=y[s],s=="children"?d=c:s=="dangerouslySetInnerHTML"?p=c:s=="value"?h=c:s=="checked"?E=c:a&&typeof c!="function"||x[s]===c||M(e,s,c,x[s],l);if(p)a||i&&(p.__html==i.__html||p.__html==e.innerHTML)||(e.innerHTML=p.__html),n.__k=[];else if(i&&(e.innerHTML=""),Fe(n.type=="template"?e.content:e,G(d)?d:[d],n,r,t,v=="foreignObject"?"http://www.w3.org/1999/xhtml":l,o,_,o?o[0]:r.__k&&B(r,0),a,f),o!=null)for(s=o.length;s--;)ee(o[s]);a||(s="value",v=="progress"&&h==null?e.removeAttribute("value"):h!=null&&(h!==e[s]||v=="progress"&&!h||v=="option"&&h!=x[s])&&M(e,s,h,x[s],l),s="checked",E!=null&&E!=e[s]&&M(e,s,E,x[s],l))}return e}function re(e,n,r){try{if(typeof e=="function"){var t=typeof e.__u=="function";t&&e.__u(),t&&n==null||(e.__u=e(n))}else e.current=n}catch(l){g.__e(l,r)}}function $e(e,n,r){var t,l;if(g.unmount&&g.unmount(e),(t=e.ref)&&(t.current&&t.current!=e.__e||re(t,null,n)),(t=e.__c)!=null){if(t.componentWillUnmount)try{t.componentWillUnmount()}catch(o){g.__e(o,n)}t.base=t.__P=null}if(t=e.__k)for(l=0;l<t.length;l++)t[l]&&$e(t[l],n,r||typeof e.type!="function");r||ee(e.__e),e.__c=e.__=e.__e=void 0}function je(e,n,r){return this.constructor(e,r)}function V(e,n,r){var t,l,o,_;n==document&&(n=document.documentElement),g.__&&g.__(e,n),l=(t=typeof r=="function")?null:r&&r.__k||n.__k,o=[],_=[],ne(n,e=(!t&&r||n).__k=S(A,null,[e]),l||D,D,n.namespaceURI,!t&&r?[r]:l?null:n.firstChild?H.call(n.childNodes):null,o,!t&&r?r:l?l.__e:n.firstChild,t,_),Se(o,e,_)}function ze(e,n){V(e,n,ze)}function Pe(e,n,r){var t,l,o,_,a=C({},e.props);for(o in e.type&&e.type.defaultProps&&(_=e.type.defaultProps),n)o=="key"?t=n[o]:o=="ref"?l=n[o]:a[o]=n[o]===void 0&&_!=null?_[o]:n[o];return arguments.length>2&&(a.children=arguments.length>3?H.call(arguments,2):r),I(e.type,a,t||e.key,l||e.ref,null)}H=ke.slice,g={__e:function(e,n,r,t){for(var l,o,_;n=n.__;)if((l=n.__c)&&!l.__)try{if((o=l.constructor)&&o.getDerivedStateFromError!=null&&(l.setState(o.getDerivedStateFromError(e)),_=l.__d),l.componentDidCatch!=null&&(l.componentDidCatch(e,t||{}),_=l.__d),_)return l.__E=l}catch(a){e=a}throw e}},me=0,O.prototype.setState=function(e,n){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=C({},this.state),typeof e=="function"&&(e=e(C({},r),this.props)),e&&C(r,e),e!=null&&this.__v&&(n&&this._sb.push(n),_e(this))},O.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),_e(this))},O.prototype.render=A,w=[],be=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,xe=function(e,n){return e.__v.__b-n.__v.__b},W.__r=0,Ee=/(PointerCapture)$|Capture$/i,Z=0,K=ce(!1),Q=ce(!0);var Le=0;function u(e,n,r,t,l,o){n||(n={});var _,a,f=n;if("ref"in f)for(a in f={},n)a=="ref"?_=n[a]:f[a]=n[a];var s={type:e,props:f,key:r,ref:_,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Le,__i:-1,__u:0,__source:l,__self:o};if(typeof e=="function"&&(_=e.defaultProps))for(a in _)f[a]===void 0&&(f[a]=_[a]);return g.vnode&&g.vnode(s),s}var R,m,Y,se,q=0,Te=[],b=g,ue=b.__b,fe=b.__r,de=b.diffed,pe=b.__c,he=b.unmount,ge=b.__;function te(e,n){b.__h&&b.__h(m,e,q||n),q=0;var r=m.__H||(m.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function j(e){return q=1,We(De,e)}function We(e,n,r){var t=te(R++,2);if(t.t=e,!t.__c&&(t.__=[De(void 0,n),function(a){var f=t.__N?t.__N[0]:t.__[0],s=t.t(f,a);f!==s&&(t.__N=[s,t.__[1]],t.__c.setState({}))}],t.__c=m,!m.__f)){var l=function(a,f,s){if(!t.__c.__H)return!0;var p=t.__c.__H.__.filter(function(d){return!!d.__c});if(p.every(function(d){return!d.__N}))return!o||o.call(this,a,f,s);var i=t.__c.props!==a;return p.forEach(function(d){if(d.__N){var c=d.__[0];d.__=d.__N,d.__N=void 0,c!==d.__[0]&&(i=!0)}}),o&&o.call(this,a,f,s)||i};m.__f=!0;var o=m.shouldComponentUpdate,_=m.componentWillUpdate;m.componentWillUpdate=function(a,f,s){if(this.__e){var p=o;o=void 0,l(a,f,s),o=p}_&&_.call(this,a,f,s)},m.shouldComponentUpdate=l}return t.__N||t.__}function qe(e,n){var r=te(R++,3);!b.__s&&Ie(r.__H,n)&&(r.__=e,r.u=n,m.__H.__h.push(r))}function Ge(e){return q=5,Ve(function(){return{current:e}},[])}function Ve(e,n){var r=te(R++,7);return Ie(r.__H,n)&&(r.__=e(),r.__H=n,r.__h=e),r.__}function Je(){for(var e;e=Te.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(L),e.__H.__h.forEach(X),e.__H.__h=[]}catch(n){e.__H.__h=[],b.__e(n,e.__v)}}b.__b=function(e){m=null,ue&&ue(e)},b.__=function(e,n){e&&n.__k&&n.__k.__m&&(e.__m=n.__k.__m),ge&&ge(e,n)},b.__r=function(e){fe&&fe(e),R=0;var n=(m=e.__c).__H;n&&(Y===m?(n.__h=[],m.__h=[],n.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(n.__h.forEach(L),n.__h.forEach(X),n.__h=[],R=0)),Y=m},b.diffed=function(e){de&&de(e);var n=e.__c;n&&n.__H&&(n.__H.__h.length&&(Te.push(n)!==1&&se===b.requestAnimationFrame||((se=b.requestAnimationFrame)||Ye)(Je)),n.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),Y=m=null},b.__c=function(e,n){n.some(function(r){try{r.__h.forEach(L),r.__h=r.__h.filter(function(t){return!t.__||X(t)})}catch(t){n.some(function(l){l.__h&&(l.__h=[])}),n=[],b.__e(t,r.__v)}}),pe&&pe(e,n)},b.unmount=function(e){he&&he(e);var n,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(t){try{L(t)}catch(l){n=l}}),r.__H=void 0,n&&b.__e(n,r.__v))};var ye=typeof requestAnimationFrame=="function";function Ye(e){var n,r=function(){clearTimeout(t),ye&&cancelAnimationFrame(n),setTimeout(e)},t=setTimeout(r,35);ye&&(n=requestAnimationFrame(r))}function L(e){var n=m,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),m=n}function X(e){var n=m;e.__c=e.__(),m=n}function Ie(e,n){return!e||e.length!==n.length||n.some(function(r,t){return r!==e[t]})}function De(e,n){return typeof n=="function"?n(e):n}function Ke({onClick:e,color:n,children:r}){return u("button",{style:{background:n||"#1890ff",color:"#fff",border:"none",borderRadius:4,padding:"8px 16px",cursor:"pointer",fontSize:16},onClick:e,children:r})}const Qe=({formState:e,setFormState:n,onClose:r,loading:t,whiteTheme:l=!1})=>{const o=l?{width:"100%",padding:"10px 12px",borderRadius:6,boxSizing:"border-box",border:e.amountError?"1px solid #ff4d4f":"1px solid #E5E6EB",background:"#fff",color:"#222",fontSize:15,outline:"none",marginBottom:0}:{width:"100%",padding:"10px 12px",borderRadius:6,boxSizing:"border-box",border:e.amountError?"1px solid #ff4d4f":"1px solid #23262F",background:"#23262F",color:"#fff",fontSize:15,outline:"none",marginBottom:0},_=l?{width:"100%",padding:"10px 12px",borderRadius:6,border:e.rechargeChannelError?"1px solid #ff4d4f":"1px solid #E5E6EB",background:"#fff",color:"#222",fontSize:15,outline:"none"}:{width:"100%",padding:"10px 12px",borderRadius:6,border:e.rechargeChannelError?"1px solid #ff4d4f":"1px solid #23262F",background:"#23262F",color:"#fff",fontSize:15,outline:"none"},a=l?{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid #E5E6EB",background:"#fff",color:"#222",fontSize:15,outline:"none"}:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid #23262F",background:"#23262F",color:"#fff",fontSize:15,outline:"none"},f=l?{marginBottom:8,fontSize:14,color:"#222",textAlign:"left",display:"block"}:{marginBottom:8,fontSize:14,textAlign:"left",display:"block"},s={color:"#ff4d4f",fontSize:13,marginTop:4},p=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"},i=l?{background:"#155EEF",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 u(A,{children:[u("div",{style:{marginBottom:18},children:[u("div",{style:f,children:[u("span",{style:{color:"#F53F3F"},children:"*"})," 充值币种"]}),u("select",{style:a,value:e.currency,onInput:d=>{const c=d.target.value;n(h=>({...h,currency:c}))},children:[u("option",{value:"USD",children:"USD - 美元"}),u("option",{value:"CNY",children:"CNY - 人民币"}),u("option",{value:"EUR",children:"EUR - 欧元"})]})]}),u("div",{style:{marginBottom:18},children:[u("div",{style:f,children:[u("span",{style:{color:"#F53F3F"},children:"*"})," 充值金额"]}),u("input",{type:"text",placeholder:"请输入充值金额",value:e.amount,onInput:d=>{const c=d.target.value;n(h=>({...h,amount:c,amountError:c.trim()?"":h.amountError}))},style:o}),e.amountError&&u("div",{style:s,children:e.amountError})]}),u("div",{style:{marginBottom:24},children:[u("div",{style:f,children:[u("span",{style:{color:"#F53F3F"},children:"*"})," 支付平台"]}),u("select",{style:_,value:e.rechargeChannel,onInput:d=>{const c=d.target.value;n(h=>({...h,rechargeChannel:c,rechargeChannelError:c?"":h.rechargeChannelError}))},children:[u("option",{value:"alipay",children:"支付宝"}),u("option",{value:"wechat",children:"微信"}),u("option",{value:"paypal",children:"PayPal"})]}),e.rechargeChannelError&&u("div",{style:s,children:e.rechargeChannelError})]}),e.error&&u("div",{style:{color:"#ff4d4f",marginBottom:12},children:e.error}),u("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[u("button",{type:"button",onClick:r,style:p,children:"取消"}),u("button",{type:"submit",disabled:t,style:i,children:t?"提交中...":"去支付"})]})]})},Xe=({formState:e,setFormState:n,onClose:r,loading:t})=>{const l=Ge(null),o=i=>{const d=Array.from(i.target.files).slice(0,10);n(c=>({...c,files:d,filesError:""}))},_=i=>{i.preventDefault();const d=Array.from(i.dataTransfer.files).slice(0,10);n(c=>({...c,files:d,filesError:""}))},a=i=>{i.preventDefault()},f=i=>{n(d=>({...d,files:d.files.filter((c,h)=>h!==i)}))},s=i=>{i.preventDefault();let d=!0;n(c=>({...c,platformError:"",transactionIdError:"",filesError:""})),e.platform||(n(c=>({...c,platformError:"请选择支付平台"})),d=!1),e.transactionId.trim()||(n(c=>({...c,transactionIdError:"请输入转账交易ID"})),d=!1),(!e.files||e.files.length===0)&&(n(c=>({...c,filesError:"请上传转账凭证"})),d=!1),d&&console.log("OfflineTransferForm values:",e)},p=i=>i>1024*1024?(i/1024/1024).toFixed(2)+" MB":i>1024?(i/1024).toFixed(2)+" KB":i+" B";return u("form",{onSubmit:s,children:[u("div",{style:{marginBottom:18},children:[u("div",{style:{marginBottom:8,fontSize:14,color:"#222"},children:[u("span",{style:{color:"#F53F3F"},children:"*"})," 第三方支付平台"]}),u("select",{style:{width:"100%",padding:"10px 12px",borderRadius:6,border:e.platformError?"1px solid #ff4d4f":"1px solid #E5E6EB",background:"#fff",color:"#222",fontSize:15,outline:"none"},value:e.platform,onInput:i=>{const d=i.target.value;n(c=>({...c,platform:d,platformError:d?"":c.platformError}))},children:[u("option",{value:"paypal",children:"PayPal"}),u("option",{value:"alipay",children:"支付宝"}),u("option",{value:"wechat",children:"微信"})]}),e.platformError&&u("div",{style:{color:"#ff4d4f",fontSize:13,marginTop:4},children:e.platformError})]}),u("div",{style:{marginBottom:18},children:[u("div",{style:{marginBottom:8,fontSize:14,color:"#222"},children:[u("span",{style:{color:"#F53F3F"},children:"*"})," 交易ID"]}),u("input",{type:"text",placeholder:"请输入转账交易ID",value:e.transactionId,onInput:i=>{const d=i.target.value;n(c=>({...c,transactionId:d,transactionIdError:d?"":c.transactionIdError}))},style:{width:"100%",padding:"10px 12px",borderRadius:6,boxSizing:"border-box",border:e.transactionIdError?"1px solid #ff4d4f":"1px solid #E5E6EB",background:"#fff",color:"#222",fontSize:15,outline:"none",marginBottom:0}}),e.transactionIdError&&u("div",{style:{color:"#ff4d4f",fontSize:13,marginTop:4},children:e.transactionIdError})]}),u("div",{style:{marginBottom:24},children:[u("div",{style:{marginBottom:8,fontSize:14,color:"#222"},children:[u("span",{style:{color:"#F53F3F"},children:"*"})," 上传文件"]}),u("div",{style:{border:e.filesError?"1px dashed #ff4d4f":"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},onClick:()=>l.current?.click(),onDrop:_,onDragOver:a,children:[u("div",{style:{fontSize:48,marginBottom:12},children:u("svg",{width:"64",height:"64",viewBox:"0 0 64 64",fill:"none",children:[u("rect",{x:"8",y:"8",width:"48",height:"48",rx:"12",fill:"#F4F6FA"}),u("rect",{x:"28",y:"20",width:"8",height:"24",rx:"4",fill:"#E5E6EB"})]})}),u("div",{style:{color:"#222",fontSize:15,marginBottom:4},children:"点击或拖拽文件到此处上传"}),u("div",{style:{color:"#999",fontSize:13},children:"支持 JPG、PNG、PDF 格式,单个文件不超过 20MB,最多上传 10 个文件"}),u("input",{ref:l,type:"file",multiple:!0,accept:".jpg,.jpeg,.png,.pdf",style:{display:"none"},onChange:o})]}),e.files&&e.files.length>0&&u("div",{style:{marginTop:12},children:e.files.map((i,d)=>u("div",{style:{display:"flex",alignItems:"center",background:"#F7F8FA",borderRadius:8,padding:"12px 16px",marginBottom:8,fontSize:15,color:"#222",justifyContent:"space-between"},children:[u("div",{style:{display:"flex",alignItems:"center",flex:1},children:[u("span",{style:{fontWeight:500},children:i.name}),u("span",{style:{color:"#8C8F93",fontSize:13,marginLeft:8},children:["(",p(i.size),")"]})]}),u("button",{type:"button",onClick:c=>{c.stopPropagation(),f(d)},style:{background:"#FF4D4F",color:"#fff",border:"none",borderRadius:6,padding:"4px 14px",fontSize:15,marginLeft:16,cursor:"pointer"},children:"移除"})]},d))}),e.filesError&&u("div",{style:{color:"#ff4d4f",fontSize:13,marginTop:4},children:e.filesError})]}),u("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[u("button",{type:"button",onClick:r,style:{background:"#fff",color:"#222",border:"1px solid #E5E6EB",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer"},children:"取消"}),u("button",{type:"submit",disabled:t,style:{background:"#155EEF",color:"#fff",border:"none",borderRadius:6,padding:"8px 24px",fontSize:15,cursor:"pointer",fontWeight:600},children:"去支付"})]})]})};function Ze({visible:e,onClose:n,onSubmit:r,color:t}){console.log(1111);const[l,o]=j({amount:"",rechargeChannel:"paypal",currency:"USD",loading:!1,error:"",amountError:"",rechargeChannelError:"",currencyError:""}),[_,a]=j("online"),[f,s]=j({platform:"paypal",transactionId:"",files:[],platformError:"",transactionIdError:"",filesError:"",loading:!1});return qe(()=>{e||(a("online"),o({amount:"",rechargeChannel:"paypal",currency:"USD",loading:!1,error:"",amountError:"",rechargeChannelError:"",currencyError:""}),s({platform:"paypal",transactionId:"",files:[],platformError:"",transactionIdError:"",filesError:"",loading:!1}))},[e]),e?u("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"rgba(0,0,0,0.3)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999},onClick:d=>{d.target===d.currentTarget&&n()},children:u("form",{onSubmit:async d=>{d.preventDefault();let c=!0;if(o(h=>({...h,amountError:"",rechargeChannelError:""})),l.amount.trim()||(o(h=>({...h,amountError:"请输入充值金额"})),c=!1),l.rechargeChannel||(o(h=>({...h,rechargeChannelError:"请选择支付平台"})),c=!1),!!c){o(h=>({...h,loading:!0,error:""}));try{await r({amount:l.amount,rechargeChannel:l.rechargeChannel,currency:l.currency}),n()}catch{o(h=>({...h,error:"提交失败,请重试"}))}finally{o(h=>({...h,loading:!1}))}}},style:{background:"#fff",padding:32,borderRadius:12,minWidth:400,color:t||"#222",boxShadow:"0 4px 24px rgba(0,0,0,0.08)",position:"relative"},onClick:d=>d.stopPropagation(),children:[u("button",{type:"button",onClick:n,style:{position:"absolute",right:16,top:16,background:"none",border:"none",color:"#222",fontSize:22,cursor:"pointer",lineHeight:1},"aria-label":"关闭",children:"×"}),u("div",{style:{fontWeight:600,fontSize:20,marginBottom:24,textAlign:"left",color:"#222"},children:"充值 / 转账"}),u("div",{style:{display:"flex",marginBottom:28},children:[u("button",{type:"button",onClick:()=>a("online"),style:{flex:1,background:_==="online"?"#fff":"#F7F8FA",color:_==="online"?"#155EEF":"#222",border:"none",borderRadius:"8px 0 0 8px",fontWeight:_==="online"?600:400,fontSize:16,height:48,boxShadow:_==="online"?"0 2px 8px 0 rgba(20,20,20,0.04)":"none",outline:"none",cursor:"pointer",borderRight:"1px solid #F0F1F3",transition:"all 0.2s"},children:"在线充值"}),u("button",{type:"button",onClick:()=>a("offline"),style:{flex:1,background:_==="offline"?"#fff":"#F7F8FA",color:_==="offline"?"#155EEF":"#222",border:"none",borderRadius:"0 8px 8px 0",fontWeight:_==="offline"?600:400,fontSize:16,height:48,boxShadow:_==="offline"?"0 2px 8px 0 rgba(20,20,20,0.04)":"none",outline:"none",cursor:"pointer",borderLeft:"1px solid #F0F1F3",transition:"all 0.2s"},children:"线下转账"})]}),_==="online"?u(Qe,{formState:l,setFormState:o,onClose:n,loading:l.loading,whiteTheme:!0}):u(Xe,{formState:f,setFormState:s,onClose:n,loading:f.loading})]})}):null}function oe(){return(oe=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e}).apply(this,arguments)}var en=["context","children"];function nn(e){this.getChildContext=function(){return e.context};var n=e.children,r=function(t,l){if(t==null)return{};var o,_,a={},f=Object.keys(t);for(_=0;_<f.length;_++)l.indexOf(o=f[_])>=0||(a[o]=t[o]);return a}(e,en);return Pe(n,r)}function rn(){var e=new CustomEvent("_preact",{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(e),this._vdom=S(nn,oe({},this._props,{context:e.detail.context}),function n(r,t){if(r.nodeType===3)return r.data;if(r.nodeType!==1)return null;var l=[],o={},_=0,a=r.attributes,f=r.childNodes;for(_=a.length;_--;)a[_].name!=="slot"&&(o[a[_].name]=a[_].value,o[Re(a[_].name)]=a[_].value);for(_=f.length;_--;){var s=n(f[_],null),p=f[_].slot;p?o[p]=S(ve,{name:p},s):l[_]=s}var i=t?S(ve,null,l):l;return S(t||r.nodeName.toLowerCase(),o,i)}(this,this._vdomComponent)),(this.hasAttribute("hydrate")?ze:V)(this._vdom,this._root)}function Re(e){return e.replace(/-(\w)/g,function(n,r){return r?r.toUpperCase():""})}function tn(e,n,r){if(this._vdom){var t={};t[e]=r=r??void 0,t[Re(e)]=r,this._vdom=Pe(this._vdom,t),V(this._vdom,this._root)}}function on(){V(this._vdom=null,this._root)}function ve(e,n){var r=this;return S("slot",oe({},e,{ref:function(t){t?(r.ref=t,r._listener||(r._listener=function(l){l.stopPropagation(),l.detail.context=n},t.addEventListener("_preact",r._listener))):r.ref.removeEventListener("_preact",r._listener)}}))}function ln(e,n,r,t){function l(){var o=Reflect.construct(HTMLElement,[],l);return o._vdomComponent=e,o._root=o,o}return(l.prototype=Object.create(HTMLElement.prototype)).constructor=l,l.prototype.connectedCallback=rn,l.prototype.attributeChangedCallback=tn,l.prototype.disconnectedCallback=on,r=r||e.observedAttributes||Object.keys(e.propTypes||{}),l.observedAttributes=r,r.forEach(function(o){Object.defineProperty(l.prototype,o,{get:function(){return this._vdom.props[o]},set:function(_){this._vdom?this.attributeChangedCallback(o,null,_):(this._props||(this._props={}),this._props[o]=_,this.connectedCallback());var a=typeof _;_!=null&&a!=="string"&&a!=="boolean"&&a!=="number"||this.setAttribute(o,_)}})}),customElements.define(n,l)}function _n(e){const[n,r]=j(!1),t=e.theme?.primaryColor;return u("div",{children:[u(Ke,{color:t,onClick:()=>r(!0),children:"打开表单"}),u(Ze,{visible:n,onClose:()=>r(!1),onSubmit:async o=>{console.log("submit",o)},color:t})]})}ln(_n,"x-best-modal-form",["theme"]);const an=["x-greeting","x-best-modal-form"];exports.components=an;exports.npmTest=He;exports.printCurrentTime=Ae;
|