best-unit 0.0.7 → 0.0.9

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 ADDED
@@ -0,0 +1 @@
1
+ <!-- test -->
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function Me(){console.log("npm package test!!!")}function De(){console.log("Current time:",new Date().toISOString())}var D,d,ye,$,oe,ge,be,ke,Z,J,K,M={},we=[],Fe=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,B=Array.isArray;function C(e,t){for(var _ in t)e[_]=t[_];return e}function ee(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function E(e,t,_){var n,o,r,l={};for(r in t)r=="key"?n=t[r]:r=="ref"?o=t[r]:l[r]=t[r];if(arguments.length>2&&(l.children=arguments.length>3?D.call(arguments,2):_),typeof e=="function"&&e.defaultProps!=null)for(r in e.defaultProps)l[r]===void 0&&(l[r]=e.defaultProps[r]);return L(e,l,n,o,null)}function L(e,t,_,n,o){var r={type:e,props:t,key:_,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++ye,__i:-1,__u:0};return o==null&&d.vnode!=null&&d.vnode(r),r}function q(e){return e.children}function I(e,t){this.props=e,this.context=t}function P(e,t){if(t==null)return e.__?P(e.__,e.__i+1):null;for(var _;t<e.__k.length;t++)if((_=e.__k[t])!=null&&_.__e!=null)return _.__e;return typeof e.type=="function"?P(e):null}function xe(e){var t,_;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((_=e.__k[t])!=null&&_.__e!=null){e.__e=e.__c.base=_.__e;break}return xe(e)}}function ie(e){(!e.__d&&(e.__d=!0)&&$.push(e)&&!R.__r++||oe!=d.debounceRendering)&&((oe=d.debounceRendering)||ge)(R)}function R(){for(var e,t,_,n,o,r,l,u=1;$.length;)$.length>u&&$.sort(be),e=$.shift(),u=$.length,e.__d&&(_=void 0,o=(n=(t=e).__v).__e,r=[],l=[],t.__P&&((_=C({},n)).__v=n.__v+1,d.vnode&&d.vnode(_),te(t.__P,_,n,t.__n,t.__P.namespaceURI,32&n.__u?[o]:null,r,o??P(n),!!(32&n.__u),l),_.__v=n.__v,_.__.__k[_.__i]=_,$e(r,_,l),_.__e!=o&&xe(_)));R.__r=0}function Ce(e,t,_,n,o,r,l,u,c,s,f){var i,p,a,g,w,b,h=n&&n.__k||we,m=t.length;for(c=Oe(_,t,h,c,m),i=0;i<m;i++)(a=_.__k[i])!=null&&(p=a.__i==-1?M:h[a.__i]||M,a.__i=i,b=te(e,a,p,o,r,l,u,c,s,f),g=a.__e,a.ref&&p.ref!=a.ref&&(p.ref&&_e(p.ref,null,a),f.push(a.ref,a.__c||g,a)),w==null&&g!=null&&(w=g),4&a.__u||p.__k===a.__k?c=Se(a,c,e):typeof a.type=="function"&&b!==void 0?c=b:g&&(c=g.nextSibling),a.__u&=-7);return _.__e=w,c}function Oe(e,t,_,n,o){var r,l,u,c,s,f=_.length,i=f,p=0;for(e.__k=new Array(o),r=0;r<o;r++)(l=t[r])!=null&&typeof l!="boolean"&&typeof l!="function"?(c=r+p,(l=e.__k[r]=typeof l=="string"||typeof l=="number"||typeof l=="bigint"||l.constructor==String?L(null,l,null,null,null):B(l)?L(q,{children:l},null,null,null):l.constructor==null&&l.__b>0?L(l.type,l.props,l.key,l.ref?l.ref:null,l.__v):l).__=e,l.__b=e.__b+1,u=null,(s=l.__i=je(l,_,c,i))!=-1&&(i--,(u=_[s])&&(u.__u|=2)),u==null||u.__v==null?(s==-1&&(o>f?p--:o<f&&p++),typeof l.type!="function"&&(l.__u|=4)):s!=c&&(s==c-1?p--:s==c+1?p++:(s>c?p--:p++,l.__u|=4))):e.__k[r]=null;if(i)for(r=0;r<f;r++)(u=_[r])!=null&&(2&u.__u)==0&&(u.__e==n&&(n=P(u)),Pe(u,u));return n}function Se(e,t,_){var n,o;if(typeof e.type=="function"){for(n=e.__k,o=0;n&&o<n.length;o++)n[o]&&(n[o].__=e,t=Se(n[o],t,_));return t}e.__e!=t&&(t&&e.type&&!_.contains(t)&&(t=P(e)),_.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function je(e,t,_,n){var o,r,l=e.key,u=e.type,c=t[_];if(c===null&&e.key==null||c&&l==c.key&&u==c.type&&(2&c.__u)==0)return _;if(n>(c!=null&&(2&c.__u)==0?1:0))for(o=_-1,r=_+1;o>=0||r<t.length;){if(o>=0){if((c=t[o])&&(2&c.__u)==0&&l==c.key&&u==c.type)return o;o--}if(r<t.length){if((c=t[r])&&(2&c.__u)==0&&l==c.key&&u==c.type)return r;r++}}return-1}function le(e,t,_){t[0]=="-"?e.setProperty(t,_??""):e[t]=_==null?"":typeof _!="number"||Fe.test(t)?_:_+"px"}function j(e,t,_,n,o){var r,l;e:if(t=="style")if(typeof _=="string")e.style.cssText=_;else{if(typeof n=="string"&&(e.style.cssText=n=""),n)for(t in n)_&&t in _||le(e.style,t,"");if(_)for(t in _)n&&_[t]==n[t]||le(e.style,t,_[t])}else if(t[0]=="o"&&t[1]=="n")r=t!=(t=t.replace(ke,"$1")),l=t.toLowerCase(),t=l in e||t=="onFocusOut"||t=="onFocusIn"?l.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+r]=_,_?n?_.u=n.u:(_.u=Z,e.addEventListener(t,r?K:J,r)):e.removeEventListener(t,r?K:J,r);else{if(o=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=_??"";break e}catch{}typeof _=="function"||(_==null||_===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&_==1?"":_))}}function ue(e){return function(t){if(this.l){var _=this.l[t.type+e];if(t.t==null)t.t=Z++;else if(t.t<_.u)return;return _(d.event?d.event(t):t)}}}function te(e,t,_,n,o,r,l,u,c,s){var f,i,p,a,g,w,b,h,m,T,S,F,H,re,O,N,V,x=t.type;if(t.constructor!=null)return null;128&_.__u&&(c=!!(32&_.__u),r=[u=t.__e=_.__e]),(f=d.__b)&&f(t);e:if(typeof x=="function")try{if(h=t.props,m="prototype"in x&&x.prototype.render,T=(f=x.contextType)&&n[f.__c],S=f?T?T.props.value:f.__:n,_.__c?b=(i=t.__c=_.__c).__=i.__E:(m?t.__c=i=new x(h,S):(t.__c=i=new I(h,S),i.constructor=x,i.render=We),T&&T.sub(i),i.props=h,i.state||(i.state={}),i.context=S,i.__n=n,p=i.__d=!0,i.__h=[],i._sb=[]),m&&i.__s==null&&(i.__s=i.state),m&&x.getDerivedStateFromProps!=null&&(i.__s==i.state&&(i.__s=C({},i.__s)),C(i.__s,x.getDerivedStateFromProps(h,i.__s))),a=i.props,g=i.state,i.__v=t,p)m&&x.getDerivedStateFromProps==null&&i.componentWillMount!=null&&i.componentWillMount(),m&&i.componentDidMount!=null&&i.__h.push(i.componentDidMount);else{if(m&&x.getDerivedStateFromProps==null&&h!==a&&i.componentWillReceiveProps!=null&&i.componentWillReceiveProps(h,S),!i.__e&&i.shouldComponentUpdate!=null&&i.shouldComponentUpdate(h,i.__s,S)===!1||t.__v==_.__v){for(t.__v!=_.__v&&(i.props=h,i.state=i.__s,i.__d=!1),t.__e=_.__e,t.__k=_.__k,t.__k.some(function(U){U&&(U.__=t)}),F=0;F<i._sb.length;F++)i.__h.push(i._sb[F]);i._sb=[],i.__h.length&&l.push(i);break e}i.componentWillUpdate!=null&&i.componentWillUpdate(h,i.__s,S),m&&i.componentDidUpdate!=null&&i.__h.push(function(){i.componentDidUpdate(a,g,w)})}if(i.context=S,i.props=h,i.__P=e,i.__e=!1,H=d.__r,re=0,m){for(i.state=i.__s,i.__d=!1,H&&H(t),f=i.render(i.props,i.state,i.context),O=0;O<i._sb.length;O++)i.__h.push(i._sb[O]);i._sb=[]}else do i.__d=!1,H&&H(t),f=i.render(i.props,i.state,i.context),i.state=i.__s;while(i.__d&&++re<25);i.state=i.__s,i.getChildContext!=null&&(n=C(C({},n),i.getChildContext())),m&&!p&&i.getSnapshotBeforeUpdate!=null&&(w=i.getSnapshotBeforeUpdate(a,g)),N=f,f!=null&&f.type===q&&f.key==null&&(N=Ee(f.props.children)),u=Ce(e,B(N)?N:[N],t,_,n,o,r,l,u,c,s),i.base=t.__e,t.__u&=-161,i.__h.length&&l.push(i),b&&(i.__E=i.__=null)}catch(U){if(t.__v=null,c||r!=null)if(U.then){for(t.__u|=c?160:128;u&&u.nodeType==8&&u.nextSibling;)u=u.nextSibling;r[r.indexOf(u)]=null,t.__e=u}else for(V=r.length;V--;)ee(r[V]);else t.__e=_.__e,t.__k=_.__k;d.__e(U,t,_)}else r==null&&t.__v==_.__v?(t.__k=_.__k,t.__e=_.__e):u=t.__e=Ie(_.__e,t,_,n,o,r,l,c,s);return(f=d.diffed)&&f(t),128&t.__u?void 0:u}function $e(e,t,_){for(var n=0;n<_.length;n++)_e(_[n],_[++n],_[++n]);d.__c&&d.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(r){r.call(o)})}catch(r){d.__e(r,o.__v)}})}function Ee(e){return typeof e!="object"||e==null||e.__b&&e.__b>0?e:B(e)?e.map(Ee):C({},e)}function Ie(e,t,_,n,o,r,l,u,c){var s,f,i,p,a,g,w,b=_.props,h=t.props,m=t.type;if(m=="svg"?o="http://www.w3.org/2000/svg":m=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),r!=null){for(s=0;s<r.length;s++)if((a=r[s])&&"setAttribute"in a==!!m&&(m?a.localName==m:a.nodeType==3)){e=a,r[s]=null;break}}if(e==null){if(m==null)return document.createTextNode(h);e=document.createElementNS(o,m,h.is&&h),u&&(d.__m&&d.__m(t,r),u=!1),r=null}if(m==null)b===h||u&&e.data==h||(e.data=h);else{if(r=r&&D.call(e.childNodes),b=_.props||M,!u&&r!=null)for(b={},s=0;s<e.attributes.length;s++)b[(a=e.attributes[s]).name]=a.value;for(s in b)if(a=b[s],s!="children"){if(s=="dangerouslySetInnerHTML")i=a;else if(!(s in h)){if(s=="value"&&"defaultValue"in h||s=="checked"&&"defaultChecked"in h)continue;j(e,s,null,a,o)}}for(s in h)a=h[s],s=="children"?p=a:s=="dangerouslySetInnerHTML"?f=a:s=="value"?g=a:s=="checked"?w=a:u&&typeof a!="function"||b[s]===a||j(e,s,a,b[s],o);if(f)u||i&&(f.__html==i.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(i&&(e.innerHTML=""),Ce(t.type=="template"?e.content:e,B(p)?p:[p],t,_,n,m=="foreignObject"?"http://www.w3.org/1999/xhtml":o,r,l,r?r[0]:_.__k&&P(_,0),u,c),r!=null)for(s=r.length;s--;)ee(r[s]);u||(s="value",m=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[s]||m=="progress"&&!g||m=="option"&&g!=b[s])&&j(e,s,g,b[s],o),s="checked",w!=null&&w!=e[s]&&j(e,s,w,b[s],o))}return e}function _e(e,t,_){try{if(typeof e=="function"){var n=typeof e.__u=="function";n&&e.__u(),n&&t==null||(e.__u=e(t))}else e.current=t}catch(o){d.__e(o,_)}}function Pe(e,t,_){var n,o;if(d.unmount&&d.unmount(e),(n=e.ref)&&(n.current&&n.current!=e.__e||_e(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(r){d.__e(r,t)}n.base=n.__P=null}if(n=e.__k)for(o=0;o<n.length;o++)n[o]&&Pe(n[o],t,_||typeof e.type!="function");_||ee(e.__e),e.__c=e.__=e.__e=void 0}function We(e,t,_){return this.constructor(e,_)}function z(e,t,_){var n,o,r,l;t==document&&(t=document.documentElement),d.__&&d.__(e,t),o=(n=typeof _=="function")?null:_&&_.__k||t.__k,r=[],l=[],te(t,e=(!n&&_||t).__k=E(q,null,[e]),o||M,M,t.namespaceURI,!n&&_?[_]:o?null:t.firstChild?D.call(t.childNodes):null,r,!n&&_?_:o?o.__e:t.firstChild,n,l),$e(r,e,l)}function Te(e,t){z(e,t,Te)}function He(e,t,_){var n,o,r,l,u=C({},e.props);for(r in e.type&&e.type.defaultProps&&(l=e.type.defaultProps),t)r=="key"?n=t[r]:r=="ref"?o=t[r]:u[r]=t[r]===void 0&&l!=null?l[r]:t[r];return arguments.length>2&&(u.children=arguments.length>3?D.call(arguments,2):_),L(e.type,u,n||e.key,o||e.ref,null)}D=we.slice,d={__e:function(e,t,_,n){for(var o,r,l;t=t.__;)if((o=t.__c)&&!o.__)try{if((r=o.constructor)&&r.getDerivedStateFromError!=null&&(o.setState(r.getDerivedStateFromError(e)),l=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,n||{}),l=o.__d),l)return o.__E=o}catch(u){e=u}throw e}},ye=0,I.prototype.setState=function(e,t){var _;_=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=C({},this.state),typeof e=="function"&&(e=e(C({},_),this.props)),e&&C(_,e),e!=null&&this.__v&&(t&&this._sb.push(t),ie(this))},I.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ie(this))},I.prototype.render=q,$=[],ge=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,be=function(e,t){return e.__v.__b-t.__v.__b},R.__r=0,ke=/(PointerCapture)$|Capture$/i,Z=0,J=ue(!1),K=ue(!0);var Re=0;function k(e,t,_,n,o,r){t||(t={});var l,u,c=t;if("ref"in c)for(u in c={},t)u=="ref"?l=t[u]:c[u]=t[u];var s={type:e,props:c,key:_,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Re,__i:-1,__u:0,__source:o,__self:r};if(typeof e=="function"&&(l=e.defaultProps))for(u in l)c[u]===void 0&&(c[u]=l[u]);return d.vnode&&d.vnode(s),s}function ne(){return(ne=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var _=arguments[t];for(var n in _)Object.prototype.hasOwnProperty.call(_,n)&&(e[n]=_[n])}return e}).apply(this,arguments)}var Be=["context","children"];function qe(e){this.getChildContext=function(){return e.context};var t=e.children,_=function(n,o){if(n==null)return{};var r,l,u={},c=Object.keys(n);for(l=0;l<c.length;l++)o.indexOf(r=c[l])>=0||(u[r]=n[r]);return u}(e,Be);return He(t,_)}function ze(){var e=new CustomEvent("_preact",{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(e),this._vdom=E(qe,ne({},this._props,{context:e.detail.context}),function t(_,n){if(_.nodeType===3)return _.data;if(_.nodeType!==1)return null;var o=[],r={},l=0,u=_.attributes,c=_.childNodes;for(l=u.length;l--;)u[l].name!=="slot"&&(r[u[l].name]=u[l].value,r[Ne(u[l].name)]=u[l].value);for(l=c.length;l--;){var s=t(c[l],null),f=c[l].slot;f?r[f]=E(se,{name:f},s):o[l]=s}var i=n?E(se,null,o):o;return E(n||_.nodeName.toLowerCase(),r,i)}(this,this._vdomComponent)),(this.hasAttribute("hydrate")?Te:z)(this._vdom,this._root)}function Ne(e){return e.replace(/-(\w)/g,function(t,_){return _?_.toUpperCase():""})}function Ve(e,t,_){if(this._vdom){var n={};n[e]=_=_??void 0,n[Ne(e)]=_,this._vdom=He(this._vdom,n),z(this._vdom,this._root)}}function Ge(){z(this._vdom=null,this._root)}function se(e,t){var _=this;return E("slot",ne({},e,{ref:function(n){n?(_.ref=n,_._listener||(_._listener=function(o){o.stopPropagation(),o.detail.context=t},n.addEventListener("_preact",_._listener))):_.ref.removeEventListener("_preact",_._listener)}}))}function Ue(e,t,_,n){function o(){var r=Reflect.construct(HTMLElement,[],o);return r._vdomComponent=e,r._root=n&&n.shadow?r.attachShadow({mode:n.mode||"open"}):r,r}return(o.prototype=Object.create(HTMLElement.prototype)).constructor=o,o.prototype.connectedCallback=ze,o.prototype.attributeChangedCallback=Ve,o.prototype.disconnectedCallback=Ge,_=_||e.observedAttributes||Object.keys(e.propTypes||{}),o.observedAttributes=_,_.forEach(function(r){Object.defineProperty(o.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 u=typeof l;l!=null&&u!=="string"&&u!=="boolean"&&u!=="number"||this.setAttribute(r,l)}})}),customElements.define(t||e.tagName||e.displayName||e.name,o)}const Je=({name:e="World"})=>k("p",{children:["Hello, ",e,"!"]});Ue(Je,"x-greeting",["name"],{shadow:!1});var Q,v,G,ce,X=0,Ae=[],y=d,ae=y.__b,fe=y.__r,pe=y.diffed,de=y.__c,he=y.unmount,me=y.__;function Ke(e,t){y.__h&&y.__h(v,e,X||t),X=0;var _=v.__H||(v.__H={__:[],__h:[]});return e>=_.__.length&&_.__.push({}),_.__[e]}function A(e){return X=1,Qe(Le,e)}function Qe(e,t,_){var n=Ke(Q++,2);if(n.t=e,!n.__c&&(n.__=[Le(void 0,t),function(u){var c=n.__N?n.__N[0]:n.__[0],s=n.t(c,u);c!==s&&(n.__N=[s,n.__[1]],n.__c.setState({}))}],n.__c=v,!v.__f)){var o=function(u,c,s){if(!n.__c.__H)return!0;var f=n.__c.__H.__.filter(function(p){return!!p.__c});if(f.every(function(p){return!p.__N}))return!r||r.call(this,u,c,s);var i=n.__c.props!==u;return f.forEach(function(p){if(p.__N){var a=p.__[0];p.__=p.__N,p.__N=void 0,a!==p.__[0]&&(i=!0)}}),r&&r.call(this,u,c,s)||i};v.__f=!0;var r=v.shouldComponentUpdate,l=v.componentWillUpdate;v.componentWillUpdate=function(u,c,s){if(this.__e){var f=r;r=void 0,o(u,c,s),r=f}l&&l.call(this,u,c,s)},v.shouldComponentUpdate=o}return n.__N||n.__}function Xe(){for(var e;e=Ae.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(W),e.__H.__h.forEach(Y),e.__H.__h=[]}catch(t){e.__H.__h=[],y.__e(t,e.__v)}}y.__b=function(e){v=null,ae&&ae(e)},y.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),me&&me(e,t)},y.__r=function(e){fe&&fe(e),Q=0;var t=(v=e.__c).__H;t&&(G===v?(t.__h=[],v.__h=[],t.__.forEach(function(_){_.__N&&(_.__=_.__N),_.u=_.__N=void 0})):(t.__h.forEach(W),t.__h.forEach(Y),t.__h=[],Q=0)),G=v},y.diffed=function(e){pe&&pe(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Ae.push(t)!==1&&ce===y.requestAnimationFrame||((ce=y.requestAnimationFrame)||Ye)(Xe)),t.__H.__.forEach(function(_){_.u&&(_.__H=_.u),_.u=void 0})),G=v=null},y.__c=function(e,t){t.some(function(_){try{_.__h.forEach(W),_.__h=_.__h.filter(function(n){return!n.__||Y(n)})}catch(n){t.some(function(o){o.__h&&(o.__h=[])}),t=[],y.__e(n,_.__v)}}),de&&de(e,t)},y.unmount=function(e){he&&he(e);var t,_=e.__c;_&&_.__H&&(_.__H.__.forEach(function(n){try{W(n)}catch(o){t=o}}),_.__H=void 0,t&&y.__e(t,_.__v))};var ve=typeof requestAnimationFrame=="function";function Ye(e){var t,_=function(){clearTimeout(n),ve&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(_,35);ve&&(t=requestAnimationFrame(_))}function W(e){var t=v,_=e.__c;typeof _=="function"&&(e.__c=void 0,_()),v=t}function Y(e){var t=v;e.__c=e.__(),v=t}function Le(e,t){return typeof t=="function"?t(e):t}function Ze({onClick:e,color:t,children:_}){return k("button",{style:{background:t||"#1890ff",color:"#fff",border:"none",borderRadius:4,padding:"8px 16px",cursor:"pointer",fontSize:16},onClick:e,children:_})}function et({visible:e,onClose:t,onSubmit:_,color:n}){const[o,r]=A(""),[l,u]=A(""),[c,s]=A(!1),[f,i]=A("");return e?k("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},children:k("form",{onSubmit:async a=>{a.preventDefault(),s(!0),i("");try{await _({name:o,email:l}),t()}catch{i("提交失败,请重试")}finally{s(!1)}},style:{background:"#fff",padding:24,borderRadius:8,minWidth:320},children:[k("h2",{style:{color:n||"#1890ff"},children:"表单"}),k("div",{style:{marginBottom:12},children:[k("input",{type:"text",placeholder:"姓名",value:o,onInput:a=>r(a.target.value),required:!0,style:{width:"100%",padding:8,marginBottom:8}}),k("input",{type:"email",placeholder:"邮箱",value:l,onInput:a=>u(a.target.value),required:!0,style:{width:"100%",padding:8}})]}),f&&k("div",{style:{color:"red",marginBottom:8},children:f}),k("button",{type:"submit",disabled:c,style:{background:n||"#1890ff",color:"#fff",border:"none",borderRadius:4,padding:"8px 16px",cursor:"pointer",fontSize:16},children:c?"提交中...":"提交"}),k("button",{type:"button",onClick:t,style:{marginLeft:12,background:"#eee",color:"#333",border:"none",borderRadius:4,padding:"8px 16px",cursor:"pointer",fontSize:16},children:"取消"})]})}):null}function tt(e){const[t,_]=A(!1),n=e.theme?.primaryColor;return k("div",{children:[k(Ze,{color:n,onClick:()=>_(!0),children:"打开表单"}),k(et,{visible:t,onClose:()=>_(!1),onSubmit:async r=>{console.log("submit",r)},color:n})]})}Ue(tt,"x-best-modal-form",["theme"],{shadow:!1});const _t=["x-greeting","x-best-modal-form"];exports.components=_t;exports.npmTest=Me;exports.printCurrentTime=De;
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,v=t&&t.__k||ke,y=n.length;for(f=Ue(r,n,v,f,y),i=0;i<y;i++)(c=r.__k[i])!=null&&(d=c.__i==-1?D:v[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,v,y,$,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(v=n.props,y="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:(y?n.__c=i=new k(v,F):(n.__c=i=new O(v,F),i.constructor=k,i.render=je),$&&$.sub(i),i.props=v,i.state||(i.state={}),i.context=F,i.__n=t,d=i.__d=!0,i.__h=[],i._sb=[]),y&&i.__s==null&&(i.__s=i.state),y&&k.getDerivedStateFromProps!=null&&(i.__s==i.state&&(i.__s=C({},i.__s)),C(i.__s,k.getDerivedStateFromProps(v,i.__s))),c=i.props,h=i.state,i.__v=n,d)y&&k.getDerivedStateFromProps==null&&i.componentWillMount!=null&&i.componentWillMount(),y&&i.componentDidMount!=null&&i.__h.push(i.componentDidMount);else{if(y&&k.getDerivedStateFromProps==null&&v!==c&&i.componentWillReceiveProps!=null&&i.componentWillReceiveProps(v,F),!i.__e&&i.shouldComponentUpdate!=null&&i.shouldComponentUpdate(v,i.__s,F)===!1||n.__v==r.__v){for(n.__v!=r.__v&&(i.props=v,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(v,i.__s,F),y&&i.componentDidUpdate!=null&&i.__h.push(function(){i.componentDidUpdate(c,h,E)})}if(i.context=F,i.props=v,i.__P=e,i.__e=!1,z=g.__r,ie=0,y){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())),y&&!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,v=n.props,y=n.type;if(y=="svg"?l="http://www.w3.org/2000/svg":y=="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==!!y&&(y?c.localName==y:c.nodeType==3)){e=c,o[s]=null;break}}if(e==null){if(y==null)return document.createTextNode(v);e=document.createElementNS(l,y,v.is&&v),a&&(g.__m&&g.__m(n,o),a=!1),o=null}if(y==null)x===v||a&&e.data==v||(e.data=v);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 v)){if(s=="value"&&"defaultValue"in v||s=="checked"&&"defaultChecked"in v)continue;M(e,s,null,c,l)}}for(s in v)c=v[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,y=="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",y=="progress"&&h==null?e.removeAttribute("value"):h!=null&&(h!==e[s]||y=="progress"&&!h||y=="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 ve=typeof requestAnimationFrame=="function";function Ye(e){var n,r=function(){clearTimeout(t),ve&&cancelAnimationFrame(n),setTimeout(e)},t=setTimeout(r,35);ve&&(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"}:{marginBottom:8,fontSize:14},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(ye,{name:p},s):l[_]=s}var i=t?S(ye,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 ye(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;