@obb871001/api-integration-sdk 1.0.50 → 1.0.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +4 -4
- package/dist/index.js +131 -130
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("react"),X=require("@tanstack/react-query"),rt=require("axios"),we=require("lodash"),tt=require("react-dom");function nt(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Ae={exports:{}},_e={};var sr;function at(){if(sr)return _e;sr=1;var r=N,
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("react"),X=require("@tanstack/react-query"),rt=require("axios"),we=require("lodash"),tt=require("react-dom");function nt(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Ae={exports:{}},_e={};var sr;function at(){if(sr)return _e;sr=1;var r=N,y=Symbol.for("react.element"),O=Symbol.for("react.fragment"),v=Object.prototype.hasOwnProperty,f=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,_={key:!0,ref:!0,__self:!0,__source:!0};function S(E,c,s){var u,a={},i=null,t=null;s!==void 0&&(i=""+s),c.key!==void 0&&(i=""+c.key),c.ref!==void 0&&(t=c.ref);for(u in c)v.call(c,u)&&!_.hasOwnProperty(u)&&(a[u]=c[u]);if(E&&E.defaultProps)for(u in c=E.defaultProps,c)a[u]===void 0&&(a[u]=c[u]);return{$$typeof:y,type:E,key:i,ref:t,props:a,_owner:f.current}}return _e.Fragment=O,_e.jsx=S,_e.jsxs=S,_e}var ye={};var lr;function ut(){return lr||(lr=1,process.env.NODE_ENV!=="production"&&(function(){var r=N,y=Symbol.for("react.element"),O=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),S=Symbol.for("react.provider"),E=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),s=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),a=Symbol.for("react.memo"),i=Symbol.for("react.lazy"),t=Symbol.for("react.offscreen"),n=Symbol.iterator,d="@@iterator";function h(e){if(e===null||typeof e!="object")return null;var l=n&&e[n]||e[d];return typeof l=="function"?l:null}var o=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function b(e){{for(var l=arguments.length,g=new Array(l>1?l-1:0),p=1;p<l;p++)g[p-1]=arguments[p];R("error",e,g)}}function R(e,l,g){{var p=o.ReactDebugCurrentFrame,w=p.getStackAddendum();w!==""&&(l+="%s",g=g.concat([w]));var P=g.map(function(C){return String(C)});P.unshift("Warning: "+l),Function.prototype.apply.call(console[e],console,P)}}var k=!1,m=!1,A=!1,I=!1,fe=!1,de;de=Symbol.for("react.module.reference");function Pe(e){return!!(typeof e=="string"||typeof e=="function"||e===v||e===_||fe||e===f||e===s||e===u||I||e===t||k||m||A||typeof e=="object"&&e!==null&&(e.$$typeof===i||e.$$typeof===a||e.$$typeof===S||e.$$typeof===E||e.$$typeof===c||e.$$typeof===de||e.getModuleId!==void 0))}function ge(e,l,g){var p=e.displayName;if(p)return p;var w=l.displayName||l.name||"";return w!==""?g+"("+w+")":g}function H(e){return e.displayName||"Context"}function j(e){if(e==null)return null;if(typeof e.tag=="number"&&b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case v:return"Fragment";case O:return"Portal";case _:return"Profiler";case f:return"StrictMode";case s:return"Suspense";case u:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case E:var l=e;return H(l)+".Consumer";case S:var g=e;return H(g._context)+".Provider";case c:return ge(e,e.render,"ForwardRef");case a:var p=e.displayName||null;return p!==null?p:j(e.type)||"Memo";case i:{var w=e,P=w._payload,C=w._init;try{return j(C(P))}catch{return null}}}return null}var J=Object.assign,ee=0,B,Oe,pe,D,U,Y,ve;function re(){}re.__reactDisabledLog=!0;function Z(){{if(ee===0){B=console.log,Oe=console.info,pe=console.warn,D=console.error,U=console.group,Y=console.groupCollapsed,ve=console.groupEnd;var e={configurable:!0,enumerable:!0,value:re,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}ee++}}function me(){{if(ee--,ee===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:J({},e,{value:B}),info:J({},e,{value:Oe}),warn:J({},e,{value:pe}),error:J({},e,{value:D}),group:J({},e,{value:U}),groupCollapsed:J({},e,{value:Y}),groupEnd:J({},e,{value:ve})})}ee<0&&b("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ce=o.ReactCurrentDispatcher,K;function ie(e,l,g){{if(K===void 0)try{throw Error()}catch(w){var p=w.stack.trim().match(/\n( *(at )?)/);K=p&&p[1]||""}return`
|
|
2
2
|
`+K+e}}var te=!1,Te;{var Pr=typeof WeakMap=="function"?WeakMap:Map;Te=new Pr}function Ke(e,l){if(!e||te)return"";{var g=Te.get(e);if(g!==void 0)return g}var p;te=!0;var w=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var P;P=ce.current,ce.current=null,Z();try{if(l){var C=function(){throw Error()};if(Object.defineProperty(C.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(C,[])}catch(F){p=F}Reflect.construct(e,[],C)}else{try{C.call()}catch(F){p=F}e.call(C.prototype)}}else{try{throw Error()}catch(F){p=F}e()}}catch(F){if(F&&p&&typeof F.stack=="string"){for(var T=F.stack.split(`
|
|
3
3
|
`),W=p.stack.split(`
|
|
4
4
|
`),M=T.length-1,L=W.length-1;M>=1&&L>=0&&T[M]!==W[L];)L--;for(;M>=1&&L>=0;M--,L--)if(T[M]!==W[L]){if(M!==1||L!==1)do if(M--,L--,L<0||T[M]!==W[L]){var G=`
|
|
5
|
-
`+T[M].replace(" at new "," at ");return e.displayName&&G.includes("<anonymous>")&&(G=G.replace("<anonymous>",e.displayName)),typeof e=="function"&&Te.set(e,G),G}while(M>=1&&L>=0);break}}}finally{te=!1,ce.current=P,me(),Error.prepareStackTrace=w}var le=e?e.displayName||e.name:"",ne=le?ie(le):"";return typeof e=="function"&&Te.set(e,ne),ne}function Ir(e,l,g){return Ke(e,!1)}function Nr(e){var l=e.prototype;return!!(l&&l.isReactComponent)}function Ce(e,l,g){if(e==null)return"";if(typeof e=="function")return Ke(e,Nr(e));if(typeof e=="string")return ie(e);switch(e){case s:return ie("Suspense");case u:return ie("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case c:return Ir(e.render);case a:return Ce(e.type,l,g);case i:{var p=e,w=p._payload,P=p._init;try{return Ce(P(w),l,g)}catch{}}}return""}var Ee=Object.prototype.hasOwnProperty,Qe={},xe=o.ReactDebugCurrentFrame;function Re(e){if(e){var l=e._owner,g=Ce(e.type,e._source,l?l.type:null);xe.setExtraStackFrame(g)}else xe.setExtraStackFrame(null)}function Mr(e,l,g,p,w){{var P=Function.call.bind(Ee);for(var C in e)if(P(e,C)){var T=void 0;try{if(typeof e[C]!="function"){var W=Error((p||"React class")+": "+g+" type `"+C+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[C]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw W.name="Invariant Violation",W}T=e[C](l,C,p,g,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(M){T=M}T&&!(T instanceof Error)&&(Re(w),b("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",p||"React class",g,C,typeof T),Re(null)),T instanceof Error&&!(T.message in Qe)&&(Qe[T.message]=!0,Re(w),b("Failed %s type: %s",g,T.message),Re(null))}}}var Lr=Array.isArray;function Ie(e){return Lr(e)}function Dr(e){{var l=typeof Symbol=="function"&&Symbol.toStringTag,g=l&&e[Symbol.toStringTag]||e.constructor.name||"Object";return g}}function jr(e){try{return ze(e),!1}catch{return!0}}function ze(e){return""+e}function Xe(e){if(jr(e))return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Dr(e)),ze(e)}var Ze=o.ReactCurrentOwner,Ur={key:!0,ref:!0,__self:!0,__source:!0},er,rr;function Wr(e){if(Ee.call(e,"ref")){var l=Object.getOwnPropertyDescriptor(e,"ref").get;if(l&&l.isReactWarning)return!1}return e.ref!==void 0}function Fr(e){if(Ee.call(e,"key")){var l=Object.getOwnPropertyDescriptor(e,"key").get;if(l&&l.isReactWarning)return!1}return e.key!==void 0}function qr(e,l){typeof e.ref=="string"&&Ze.current}function Gr(e,l){{var g=function(){er||(er=!0,b("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",l))};g.isReactWarning=!0,Object.defineProperty(e,"key",{get:g,configurable:!0})}}function Jr(e,l){{var g=function(){rr||(rr=!0,b("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",l))};g.isReactWarning=!0,Object.defineProperty(e,"ref",{get:g,configurable:!0})}}var Hr=function(e,l,g,p,w,P,C){var T={$$typeof:
|
|
5
|
+
`+T[M].replace(" at new "," at ");return e.displayName&&G.includes("<anonymous>")&&(G=G.replace("<anonymous>",e.displayName)),typeof e=="function"&&Te.set(e,G),G}while(M>=1&&L>=0);break}}}finally{te=!1,ce.current=P,me(),Error.prepareStackTrace=w}var le=e?e.displayName||e.name:"",ne=le?ie(le):"";return typeof e=="function"&&Te.set(e,ne),ne}function Ir(e,l,g){return Ke(e,!1)}function Nr(e){var l=e.prototype;return!!(l&&l.isReactComponent)}function Ce(e,l,g){if(e==null)return"";if(typeof e=="function")return Ke(e,Nr(e));if(typeof e=="string")return ie(e);switch(e){case s:return ie("Suspense");case u:return ie("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case c:return Ir(e.render);case a:return Ce(e.type,l,g);case i:{var p=e,w=p._payload,P=p._init;try{return Ce(P(w),l,g)}catch{}}}return""}var Ee=Object.prototype.hasOwnProperty,Qe={},xe=o.ReactDebugCurrentFrame;function Re(e){if(e){var l=e._owner,g=Ce(e.type,e._source,l?l.type:null);xe.setExtraStackFrame(g)}else xe.setExtraStackFrame(null)}function Mr(e,l,g,p,w){{var P=Function.call.bind(Ee);for(var C in e)if(P(e,C)){var T=void 0;try{if(typeof e[C]!="function"){var W=Error((p||"React class")+": "+g+" type `"+C+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[C]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw W.name="Invariant Violation",W}T=e[C](l,C,p,g,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(M){T=M}T&&!(T instanceof Error)&&(Re(w),b("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",p||"React class",g,C,typeof T),Re(null)),T instanceof Error&&!(T.message in Qe)&&(Qe[T.message]=!0,Re(w),b("Failed %s type: %s",g,T.message),Re(null))}}}var Lr=Array.isArray;function Ie(e){return Lr(e)}function Dr(e){{var l=typeof Symbol=="function"&&Symbol.toStringTag,g=l&&e[Symbol.toStringTag]||e.constructor.name||"Object";return g}}function jr(e){try{return ze(e),!1}catch{return!0}}function ze(e){return""+e}function Xe(e){if(jr(e))return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Dr(e)),ze(e)}var Ze=o.ReactCurrentOwner,Ur={key:!0,ref:!0,__self:!0,__source:!0},er,rr;function Wr(e){if(Ee.call(e,"ref")){var l=Object.getOwnPropertyDescriptor(e,"ref").get;if(l&&l.isReactWarning)return!1}return e.ref!==void 0}function Fr(e){if(Ee.call(e,"key")){var l=Object.getOwnPropertyDescriptor(e,"key").get;if(l&&l.isReactWarning)return!1}return e.key!==void 0}function qr(e,l){typeof e.ref=="string"&&Ze.current}function Gr(e,l){{var g=function(){er||(er=!0,b("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",l))};g.isReactWarning=!0,Object.defineProperty(e,"key",{get:g,configurable:!0})}}function Jr(e,l){{var g=function(){rr||(rr=!0,b("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",l))};g.isReactWarning=!0,Object.defineProperty(e,"ref",{get:g,configurable:!0})}}var Hr=function(e,l,g,p,w,P,C){var T={$$typeof:y,type:e,key:l,ref:g,props:C,_owner:P};return T._store={},Object.defineProperty(T._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(T,"_self",{configurable:!1,enumerable:!1,writable:!1,value:p}),Object.defineProperty(T,"_source",{configurable:!1,enumerable:!1,writable:!1,value:w}),Object.freeze&&(Object.freeze(T.props),Object.freeze(T)),T};function Vr(e,l,g,p,w){{var P,C={},T=null,W=null;g!==void 0&&(Xe(g),T=""+g),Fr(l)&&(Xe(l.key),T=""+l.key),Wr(l)&&(W=l.ref,qr(l,w));for(P in l)Ee.call(l,P)&&!Ur.hasOwnProperty(P)&&(C[P]=l[P]);if(e&&e.defaultProps){var M=e.defaultProps;for(P in M)C[P]===void 0&&(C[P]=M[P])}if(T||W){var L=typeof e=="function"?e.displayName||e.name||"Unknown":e;T&&Gr(C,L),W&&Jr(C,L)}return Hr(e,T,W,w,p,Ze.current,C)}}var Ne=o.ReactCurrentOwner,tr=o.ReactDebugCurrentFrame;function se(e){if(e){var l=e._owner,g=Ce(e.type,e._source,l?l.type:null);tr.setExtraStackFrame(g)}else tr.setExtraStackFrame(null)}var Me;Me=!1;function Le(e){return typeof e=="object"&&e!==null&&e.$$typeof===y}function nr(){{if(Ne.current){var e=j(Ne.current.type);if(e)return`
|
|
6
6
|
|
|
7
7
|
Check the render method of \``+e+"`."}return""}}function $r(e){return""}var ar={};function Br(e){{var l=nr();if(!l){var g=typeof e=="string"?e:e.displayName||e.name;g&&(l=`
|
|
8
8
|
|
|
9
|
-
Check the top-level render call using <`+g+">.")}return l}}function ur(e,l){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var g=Br(l);if(ar[g])return;ar[g]=!0;var p="";e&&e._owner&&e._owner!==Ne.current&&(p=" It was passed a child from "+j(e._owner.type)+"."),se(e),b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',g,p),se(null)}}function or(e,l){{if(typeof e!="object")return;if(Ie(e))for(var g=0;g<e.length;g++){var p=e[g];Le(p)&&ur(p,l)}else if(Le(e))e._store&&(e._store.validated=!0);else if(e){var w=h(e);if(typeof w=="function"&&w!==e.entries)for(var P=w.call(e),C;!(C=P.next()).done;)Le(C.value)&&ur(C.value,l)}}}function Yr(e){{var l=e.type;if(l==null||typeof l=="string")return;var g;if(typeof l=="function")g=l.propTypes;else if(typeof l=="object"&&(l.$$typeof===c||l.$$typeof===a))g=l.propTypes;else return;if(g){var p=j(l);Mr(g,e.props,"prop",p,e)}else if(l.PropTypes!==void 0&&!Me){Me=!0;var w=j(l);b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",w||"Unknown")}typeof l.getDefaultProps=="function"&&!l.getDefaultProps.isReactClassApproved&&b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Kr(e){{for(var l=Object.keys(e.props),g=0;g<l.length;g++){var p=l[g];if(p!=="children"&&p!=="key"){se(e),b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",p),se(null);break}}e.ref!==null&&(se(e),b("Invalid attribute `ref` supplied to `React.Fragment`."),se(null))}}var cr={};function ir(e,l,g,p,w,P){{var C=Pe(e);if(!C){var T="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(T+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var W=$r();W?T+=W:T+=nr();var M;e===null?M="null":Ie(e)?M="array":e!==void 0&&e.$$typeof===
|
|
9
|
+
Check the top-level render call using <`+g+">.")}return l}}function ur(e,l){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var g=Br(l);if(ar[g])return;ar[g]=!0;var p="";e&&e._owner&&e._owner!==Ne.current&&(p=" It was passed a child from "+j(e._owner.type)+"."),se(e),b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',g,p),se(null)}}function or(e,l){{if(typeof e!="object")return;if(Ie(e))for(var g=0;g<e.length;g++){var p=e[g];Le(p)&&ur(p,l)}else if(Le(e))e._store&&(e._store.validated=!0);else if(e){var w=h(e);if(typeof w=="function"&&w!==e.entries)for(var P=w.call(e),C;!(C=P.next()).done;)Le(C.value)&&ur(C.value,l)}}}function Yr(e){{var l=e.type;if(l==null||typeof l=="string")return;var g;if(typeof l=="function")g=l.propTypes;else if(typeof l=="object"&&(l.$$typeof===c||l.$$typeof===a))g=l.propTypes;else return;if(g){var p=j(l);Mr(g,e.props,"prop",p,e)}else if(l.PropTypes!==void 0&&!Me){Me=!0;var w=j(l);b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",w||"Unknown")}typeof l.getDefaultProps=="function"&&!l.getDefaultProps.isReactClassApproved&&b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Kr(e){{for(var l=Object.keys(e.props),g=0;g<l.length;g++){var p=l[g];if(p!=="children"&&p!=="key"){se(e),b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",p),se(null);break}}e.ref!==null&&(se(e),b("Invalid attribute `ref` supplied to `React.Fragment`."),se(null))}}var cr={};function ir(e,l,g,p,w,P){{var C=Pe(e);if(!C){var T="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(T+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var W=$r();W?T+=W:T+=nr();var M;e===null?M="null":Ie(e)?M="array":e!==void 0&&e.$$typeof===y?(M="<"+(j(e.type)||"Unknown")+" />",T=" Did you accidentally export a JSX literal instead of a component?"):M=typeof e,b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",M,T)}var L=Vr(e,l,g,w,P);if(L==null)return L;if(C){var G=l.children;if(G!==void 0)if(p)if(Ie(G)){for(var le=0;le<G.length;le++)or(G[le],e);Object.freeze&&Object.freeze(G)}else b("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else or(G,e)}if(Ee.call(l,"key")){var ne=j(e),F=Object.keys(l).filter(function(et){return et!=="key"}),De=F.length>0?"{key: someKey, "+F.join(": ..., ")+": ...}":"{key: someKey}";if(!cr[ne+De]){var Zr=F.length>0?"{"+F.join(": ..., ")+": ...}":"{}";b(`A props object containing a "key" prop is being spread into JSX:
|
|
10
10
|
let props = %s;
|
|
11
11
|
<%s {...props} />
|
|
12
12
|
React keys must be passed directly to JSX without using spread:
|
|
13
13
|
let props = %s;
|
|
14
|
-
<%s key={someKey} {...props} />`,De,ne,Zr,ne),cr[ne+De]=!0}}return e===v?Kr(L):Yr(L),L}}function Qr(e,l,g){return ir(e,l,g,!0)}function xr(e,l,g){return ir(e,l,g,!1)}var zr=xr,Xr=Qr;ye.Fragment=v,ye.jsx=zr,ye.jsxs=Xr})()),ye}var fr;function ot(){return fr||(fr=1,process.env.NODE_ENV==="production"?Ae.exports=at():Ae.exports=ut()),Ae.exports}var dr=ot();const Ge=N.createContext(null),be=()=>{const r=N.useContext(Ge);if(!r)throw new Error("useApiContext must be used within ApiProvider");return r};function ct({baseURL:r,getToken:S,timeoutMs:O=15e3,lng:v="tw",store:f,onError:_}={}){const y=rt.create({baseURL:r,timeout:O,headers:{"Content-Type":"application/json"}});return y.interceptors.request.use(async E=>{if(E.headers=E.headers||{},S){const s=await S();s&&(E.headers.Authorization=`Bearer ${s}`)}const c=f?.getState()?.isWalletCurrency;return E.headers.Currency=c,E.headers["currency-code"]=c,E.headers.lang=v,E}),y.interceptors.response.use(E=>E.data,E=>_?_(E,{instance:y}):Promise.reject(E)),y}function it({children:r,...S}){const O=N.useMemo(()=>ct(S),[S]),f=N.useMemo(()=>new X.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1}}}),[]);return dr.jsx(X.QueryClientProvider,{client:f,children:dr.jsx(Ge.Provider,{value:{client:O,...S},children:r})})}const st=()=>{const r=(v,f)=>!v&&!f,S=v=>v.startsWith("pc.");return{executeLogout:({isCallBackInvalid:v=!1,hostname:f="",shouldRedirect:_,onShowError:y,onCleanup:E,onRemoveToken:c,onRedirect:s,onGoogleLogout:u})=>{const a=S(f);r(v,a)&&y?.(),E?.(),c?.(),_&&s?.("/"),u?.()},shouldShowErrorNotice:r,isMachineDomain:S}},Je=()=>{const{client:r}=be(),S=N.useCallback(async y=>{const{mac_address:E="",app_version:c="",anydesk_id:s=""}=y,{data:u}=await r.post("/cash-register/login",{mac_address:E,app_version:c,anydesk_id:s});return u},[r]),O=N.useCallback(async()=>r.get("/member/getMemberInfo"),[r]),v=N.useCallback(async()=>await r.get("member/getGameList"),[r]),f=N.useCallback(async()=>await r.get("/member/getNowCurrencyExchange"),[r]),_=N.useCallback(async()=>await r.get("member/getFavoriteGame"),[r]);return{machineLoginApi:S,userInfoApi:O,userGameListApi:v,userFavoriteGameApi:_,userCurrencyExchangeApi:f}},lt=({otherQueryKey:r=[],options:S={}}={})=>{const{userCurrencyExchangeApi:O}=Je(),{getToken:v}=be(),{enabled:f,..._}=S,y=!!v&&(f?f.every(E=>E):!0);return X.useQueries({queries:[{queryKey:["userCurrencyExchange",...r],queryFn:()=>O(),enabled:y,..._}]})};var je={},q={},Ue={},vr;function $(){return vr||(vr=1,(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.isEventSourceSupported=r.isReactNative=r.ReadyState=r.DEFAULT_HEARTBEAT=r.UNPARSABLE_JSON_OBJECT=r.DEFAULT_RECONNECT_INTERVAL_MS=r.DEFAULT_RECONNECT_LIMIT=r.SOCKET_IO_PING_CODE=r.SOCKET_IO_PATH=r.SOCKET_IO_PING_INTERVAL=r.DEFAULT_EVENT_SOURCE_OPTIONS=r.EMPTY_EVENT_HANDLERS=r.DEFAULT_OPTIONS=void 0;var S=1,O=1e3*S;r.DEFAULT_OPTIONS={},r.EMPTY_EVENT_HANDLERS={},r.DEFAULT_EVENT_SOURCE_OPTIONS={withCredentials:!1,events:r.EMPTY_EVENT_HANDLERS},r.SOCKET_IO_PING_INTERVAL=25*O,r.SOCKET_IO_PATH="/socket.io/?EIO=3&transport=websocket",r.SOCKET_IO_PING_CODE="2",r.DEFAULT_RECONNECT_LIMIT=20,r.DEFAULT_RECONNECT_INTERVAL_MS=5e3,r.UNPARSABLE_JSON_OBJECT={},r.DEFAULT_HEARTBEAT={message:"ping",timeout:6e4,interval:25e3};var v;(function(_){_[_.UNINSTANTIATED=-1]="UNINSTANTIATED",_[_.CONNECTING=0]="CONNECTING",_[_.OPEN=1]="OPEN",_[_.CLOSING=2]="CLOSING",_[_.CLOSED=3]="CLOSED"})(v||(r.ReadyState=v={}));var f=function(){try{return"EventSource"in globalThis}catch{return!1}};r.isReactNative=typeof navigator<"u"&&navigator.product==="ReactNative",r.isEventSourceSupported=!r.isReactNative&&f()})(Ue)),Ue}var Se={},We={},Er;function He(){return Er||(Er=1,(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.resetWebSockets=r.sharedWebSockets=void 0,r.sharedWebSockets={};var S=function(O){if(O&&r.sharedWebSockets.hasOwnProperty(O))delete r.sharedWebSockets[O];else for(var v in r.sharedWebSockets)r.sharedWebSockets.hasOwnProperty(v)&&delete r.sharedWebSockets[v]};r.resetWebSockets=S})(We)),We}var ae={},Q={},_r;function Ve(){if(_r)return Q;_r=1,Object.defineProperty(Q,"__esModule",{value:!0}),Q.setUpSocketIOPing=Q.appendQueryParams=Q.parseSocketIOUrl=void 0;var r=$(),S=function(f){if(f){var _=/^https|wss/.test(f),y=f.replace(/^(https?|wss?)(:\/\/)?/,""),E=y.replace(/\/$/,""),c=_?"wss":"ws";return"".concat(c,"://").concat(E).concat(r.SOCKET_IO_PATH)}else if(f===""){var _=/^https/.test(window.location.protocol),c=_?"wss":"ws",s=window.location.port?":".concat(window.location.port):"";return"".concat(c,"://").concat(window.location.hostname).concat(s).concat(r.SOCKET_IO_PATH)}return f};Q.parseSocketIOUrl=S;var O=function(f,_){_===void 0&&(_={});var y=/\?([\w]+=[\w]+)/,E=y.test(f),c="".concat(Object.entries(_).reduce(function(s,u){var a=u[0],i=u[1];return s+"".concat(a,"=").concat(i,"&")},"").slice(0,-1));return"".concat(f).concat(E?"&":"?").concat(c)};Q.appendQueryParams=O;var v=function(f,_){_===void 0&&(_=r.SOCKET_IO_PING_INTERVAL);var y=function(){return f(r.SOCKET_IO_PING_CODE)};return window.setInterval(y,_)};return Q.setUpSocketIOPing=v,Q}var ke={},yr;function Ar(){if(yr)return ke;yr=1,Object.defineProperty(ke,"__esModule",{value:!0}),ke.heartbeat=O;var r=$();function S(v){return Array.isArray(v)?v.reduce(function(f,_){return f.current>_.current?f:_}).current:v.current}function O(v,f,_){var y=_||{},E=y.interval,c=E===void 0?r.DEFAULT_HEARTBEAT.interval:E,s=y.timeout,u=s===void 0?r.DEFAULT_HEARTBEAT.timeout:s,a=y.message,i=a===void 0?r.DEFAULT_HEARTBEAT.message:a,t=Math.max(100,c/10),n=Date.now(),d=setInterval(function(){var h=Date.now(),o=S(f);if(o+u<=h)console.warn("Heartbeat timed out, closing connection, last message received ".concat(h-o,"ms ago, last ping sent ").concat(h-n,"ms ago")),v.close();else if(o+c<=h&&n+c<=h)try{typeof i=="function"?v.send(i()):v.send(i),n=h}catch(b){console.error("Heartbeat failed, closing connection",b instanceof Error?b.message:b),v.close()}},t);return v.addEventListener("close",function(){clearInterval(d)}),function(){}}return ke}var he={},Fe={},Sr;function $e(){return Sr||(Sr=1,(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.resetSubscribers=r.removeSubscriber=r.addSubscriber=r.hasSubscribers=r.getSubscribers=void 0;var S={},O=[],v=function(c){return(0,r.hasSubscribers)(c)?Array.from(S[c]):O};r.getSubscribers=v;var f=function(c){var s;return((s=S[c])===null||s===void 0?void 0:s.size)>0};r.hasSubscribers=f;var _=function(c,s){S[c]=S[c]||new Set,S[c].add(s)};r.addSubscriber=_;var y=function(c,s){S[c].delete(s)};r.removeSubscriber=y;var E=function(c){if(c&&S.hasOwnProperty(c))delete S[c];else for(var s in S)S.hasOwnProperty(s)&&delete S[s]};r.resetSubscribers=E})(Fe)),Fe}var hr;function Be(){if(hr)return he;hr=1,Object.defineProperty(he,"__esModule",{value:!0}),he.assertIsWebSocket=O,he.resetGlobalState=v;var r=He(),S=$e();function O(f,_){if(!_&&!(f instanceof WebSocket))throw new Error("")}function v(f){(0,S.resetSubscribers)(f),(0,r.resetWebSockets)(f)}return he}var br;function ft(){if(br)return ae;br=1;var r=ae&&ae.__assign||function(){return r=Object.assign||function(u){for(var a,i=1,t=arguments.length;i<t;i++){a=arguments[i];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(u[n]=a[n])}return u},r.apply(this,arguments)};Object.defineProperty(ae,"__esModule",{value:!0}),ae.attachListeners=void 0;var S=Ve(),O=Ar(),v=$(),f=Be(),_=function(u,a,i,t){u.onmessage=function(n){var d;a.current.onMessage&&a.current.onMessage(n),typeof t?.current=="number"&&(t.current=Date.now()),!(typeof a.current.filter=="function"&&a.current.filter(n)!==!0)&&(a.current.heartbeat&&typeof a.current.heartbeat!="boolean"&&((d=a.current.heartbeat)===null||d===void 0?void 0:d.returnMessage)===n.data||i(n))}},y=function(u,a,i,t,n){u.onopen=function(d){if(a.current.onOpen&&a.current.onOpen(d),t.current=0,i(v.ReadyState.OPEN),a.current.heartbeat&&u instanceof WebSocket){var h=typeof a.current.heartbeat=="boolean"?void 0:a.current.heartbeat;n.current=Date.now(),(0,O.heartbeat)(u,n,h)}}},E=function(u,a,i,t,n){if(v.isEventSourceSupported&&u instanceof EventSource)return function(){};(0,f.assertIsWebSocket)(u,a.current.skipAssert);var d;return u.onclose=function(h){var o;if(a.current.onClose&&a.current.onClose(h),i(v.ReadyState.CLOSED),a.current.shouldReconnect&&a.current.shouldReconnect(h)){var b=(o=a.current.reconnectAttempts)!==null&&o!==void 0?o:v.DEFAULT_RECONNECT_LIMIT;if(n.current<b){var R=typeof a.current.reconnectInterval=="function"?a.current.reconnectInterval(n.current):a.current.reconnectInterval;d=window.setTimeout(function(){n.current++,t()},R??v.DEFAULT_RECONNECT_INTERVAL_MS)}else a.current.onReconnectStop&&a.current.onReconnectStop(b),console.warn("Max reconnect attempts of ".concat(b," exceeded"))}},function(){return d&&window.clearTimeout(d)}},c=function(u,a,i,t,n){var d;return u.onerror=function(h){var o;if(a.current.onError&&a.current.onError(h),v.isEventSourceSupported&&u instanceof EventSource&&(a.current.onClose&&a.current.onClose(r(r({},h),{code:1006,reason:"An error occurred with the EventSource: ".concat(h),wasClean:!1})),i(v.ReadyState.CLOSED),u.close()),a.current.retryOnError)if(n.current<((o=a.current.reconnectAttempts)!==null&&o!==void 0?o:v.DEFAULT_RECONNECT_LIMIT)){var b=typeof a.current.reconnectInterval=="function"?a.current.reconnectInterval(n.current):a.current.reconnectInterval;d=window.setTimeout(function(){n.current++,t()},b??v.DEFAULT_RECONNECT_INTERVAL_MS)}else a.current.onReconnectStop&&a.current.onReconnectStop(a.current.reconnectAttempts),console.warn("Max reconnect attempts of ".concat(a.current.reconnectAttempts," exceeded"))},function(){return d&&window.clearTimeout(d)}},s=function(u,a,i,t,n,d,h){var o=a.setLastMessage,b=a.setReadyState,R,k,m;return i.current.fromSocketIO&&(R=(0,S.setUpSocketIOPing)(h)),_(u,i,o,d),y(u,i,b,n,d),k=E(u,i,b,t,n),m=c(u,i,b,t,n),function(){b(v.ReadyState.CLOSING),k(),m(),u.close(),R&&clearInterval(R)}};return ae.attachListeners=s,ae}var ue={},gr;function dt(){if(gr)return ue;gr=1;var r=ue&&ue.__assign||function(){return r=Object.assign||function(a){for(var i,t=1,n=arguments.length;t<n;t++){i=arguments[t];for(var d in i)Object.prototype.hasOwnProperty.call(i,d)&&(a[d]=i[d])}return a},r.apply(this,arguments)};Object.defineProperty(ue,"__esModule",{value:!0}),ue.attachSharedListeners=void 0;var S=He(),O=$(),v=$e(),f=Ve(),_=Ar(),y=function(a,i,t){a.onmessage=function(n){(0,v.getSubscribers)(i).forEach(function(d){var h;d.optionsRef.current.onMessage&&d.optionsRef.current.onMessage(n),typeof((h=d?.lastMessageTime)===null||h===void 0?void 0:h.current)=="number"&&(d.lastMessageTime.current=Date.now()),!(typeof d.optionsRef.current.filter=="function"&&d.optionsRef.current.filter(n)!==!0)&&(t&&typeof t!="boolean"&&t?.returnMessage===n.data||d.setLastMessage(n))})}},E=function(a,i,t){a.onopen=function(n){var d=(0,v.getSubscribers)(i);d.forEach(function(h){h.reconnectCount.current=0,h.optionsRef.current.onOpen&&h.optionsRef.current.onOpen(n),h.setReadyState(O.ReadyState.OPEN),t&&a instanceof WebSocket&&(h.lastMessageTime.current=Date.now())}),t&&a instanceof WebSocket&&(0,_.heartbeat)(a,d.map(function(h){return h.lastMessageTime}),typeof t=="boolean"?void 0:t)}},c=function(a,i){a instanceof WebSocket&&(a.onclose=function(t){(0,v.getSubscribers)(i).forEach(function(n){n.optionsRef.current.onClose&&n.optionsRef.current.onClose(t),n.setReadyState(O.ReadyState.CLOSED)}),delete S.sharedWebSockets[i],(0,v.getSubscribers)(i).forEach(function(n){var d;if(n.optionsRef.current.shouldReconnect&&n.optionsRef.current.shouldReconnect(t)){var h=(d=n.optionsRef.current.reconnectAttempts)!==null&&d!==void 0?d:O.DEFAULT_RECONNECT_LIMIT;if(n.reconnectCount.current<h){var o=typeof n.optionsRef.current.reconnectInterval=="function"?n.optionsRef.current.reconnectInterval(n.reconnectCount.current):n.optionsRef.current.reconnectInterval;setTimeout(function(){n.reconnectCount.current++,n.reconnect.current()},o??O.DEFAULT_RECONNECT_INTERVAL_MS)}else n.optionsRef.current.onReconnectStop&&n.optionsRef.current.onReconnectStop(n.optionsRef.current.reconnectAttempts),console.warn("Max reconnect attempts of ".concat(h," exceeded"))}})})},s=function(a,i){a.onerror=function(t){(0,v.getSubscribers)(i).forEach(function(n){n.optionsRef.current.onError&&n.optionsRef.current.onError(t),O.isEventSourceSupported&&a instanceof EventSource&&(n.optionsRef.current.onClose&&n.optionsRef.current.onClose(r(r({},t),{code:1006,reason:"An error occurred with the EventSource: ".concat(t),wasClean:!1})),n.setReadyState(O.ReadyState.CLOSED))}),O.isEventSourceSupported&&a instanceof EventSource&&a.close()}},u=function(a,i,t,n){var d;return t.current.fromSocketIO&&(d=(0,f.setUpSocketIOPing)(n)),y(a,i,t.current.heartbeat),c(a,i),E(a,i,t.current.heartbeat),s(a,i),function(){d&&clearInterval(d)}};return ue.attachSharedListeners=u,ue}var Or;function vt(){if(Or)return Se;Or=1,Object.defineProperty(Se,"__esModule",{value:!0}),Se.createOrJoinSocket=void 0;var r=He(),S=$(),O=ft(),v=dt(),f=$e(),_=function(E,c,s,u,a){return function(){if((0,f.removeSubscriber)(E,c),!(0,f.hasSubscribers)(E)){try{var i=r.sharedWebSockets[E];i instanceof WebSocket&&(i.onclose=function(t){s.current.onClose&&s.current.onClose(t),u(S.ReadyState.CLOSED)}),i.close()}catch{}a&&a(),delete r.sharedWebSockets[E]}}},y=function(E,c,s,u,a,i,t,n,d){if(!S.isEventSourceSupported&&u.current.eventSourceOptions)throw S.isReactNative?new Error("EventSource is not supported in ReactNative"):new Error("EventSource is not supported");if(u.current.share){var h=null;r.sharedWebSockets[c]===void 0?(r.sharedWebSockets[c]=u.current.eventSourceOptions?new EventSource(c,u.current.eventSourceOptions):new WebSocket(c,u.current.protocols),E.current=r.sharedWebSockets[c],s(S.ReadyState.CONNECTING),h=(0,v.attachSharedListeners)(r.sharedWebSockets[c],c,u,d)):(E.current=r.sharedWebSockets[c],s(r.sharedWebSockets[c].readyState));var o={setLastMessage:a,setReadyState:s,optionsRef:u,reconnectCount:t,lastMessageTime:n,reconnect:i};return(0,f.addSubscriber)(c,o),_(c,o,u,s,h)}else{if(E.current=u.current.eventSourceOptions?new EventSource(c,u.current.eventSourceOptions):new WebSocket(c,u.current.protocols),s(S.ReadyState.CONNECTING),!E.current)throw new Error("WebSocket failed to be created");return(0,O.attachListeners)(E.current,{setLastMessage:a,setReadyState:s},u,i.current,t,n,d)}};return Se.createOrJoinSocket=y,Se}var x={},pr;function Et(){return pr||(pr=1,(function(r){var S=x&&x.__awaiter||function(c,s,u,a){function i(t){return t instanceof u?t:new u(function(n){n(t)})}return new(u||(u=Promise))(function(t,n){function d(b){try{o(a.next(b))}catch(R){n(R)}}function h(b){try{o(a.throw(b))}catch(R){n(R)}}function o(b){b.done?t(b.value):i(b.value).then(d,h)}o((a=a.apply(c,s||[])).next())})},O=x&&x.__generator||function(c,s){var u={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},a,i,t,n=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return n.next=d(0),n.throw=d(1),n.return=d(2),typeof Symbol=="function"&&(n[Symbol.iterator]=function(){return this}),n;function d(o){return function(b){return h([o,b])}}function h(o){if(a)throw new TypeError("Generator is already executing.");for(;n&&(n=0,o[0]&&(u=0)),u;)try{if(a=1,i&&(t=o[0]&2?i.return:o[0]?i.throw||((t=i.return)&&t.call(i),0):i.next)&&!(t=t.call(i,o[1])).done)return t;switch(i=0,t&&(o=[o[0]&2,t.value]),o[0]){case 0:case 1:t=o;break;case 4:return u.label++,{value:o[1],done:!1};case 5:u.label++,i=o[1],o=[0];continue;case 7:o=u.ops.pop(),u.trys.pop();continue;default:if(t=u.trys,!(t=t.length>0&&t[t.length-1])&&(o[0]===6||o[0]===2)){u=0;continue}if(o[0]===3&&(!t||o[1]>t[0]&&o[1]<t[3])){u.label=o[1];break}if(o[0]===6&&u.label<t[1]){u.label=t[1],t=o;break}if(t&&u.label<t[2]){u.label=t[2],u.ops.push(o);break}t[2]&&u.ops.pop(),u.trys.pop();continue}o=s.call(c,u)}catch(b){o=[6,b],i=0}finally{a=t=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}},v=x&&x.__spreadArray||function(c,s,u){if(u||arguments.length===2)for(var a=0,i=s.length,t;a<i;a++)(t||!(a in s))&&(t||(t=Array.prototype.slice.call(s,0,a)),t[a]=s[a]);return c.concat(t||Array.prototype.slice.call(s))};Object.defineProperty(r,"__esModule",{value:!0}),r.getUrl=void 0;var f=Ve(),_=$(),y=function(c){return new Promise(function(s){return window.setTimeout(s,c)})},E=function(c,s){for(var u=[],a=2;a<arguments.length;a++)u[a-2]=arguments[a];return S(void 0,v([c,s],u,!0),void 0,function(i,t,n){var d,h,o,b,R,k,m,A;return n===void 0&&(n=0),O(this,function(I){switch(I.label){case 0:if(typeof i!="function")return[3,10];I.label=1;case 1:return I.trys.push([1,3,,9]),[4,i()];case 2:return d=I.sent(),[3,9];case 3:return I.sent(),t.current.retryOnError?(h=(k=t.current.reconnectAttempts)!==null&&k!==void 0?k:_.DEFAULT_RECONNECT_LIMIT,n<h?(o=typeof t.current.reconnectInterval=="function"?t.current.reconnectInterval(n):t.current.reconnectInterval,[4,y(o??_.DEFAULT_RECONNECT_INTERVAL_MS)]):[3,5]):[3,7];case 4:return I.sent(),[2,(0,r.getUrl)(i,t,n+1)];case 5:return(A=(m=t.current).onReconnectStop)===null||A===void 0||A.call(m,n),[2,null];case 6:return[3,8];case 7:return[2,null];case 8:return[3,9];case 9:return[3,11];case 10:d=i,I.label=11;case 11:return b=t.current.fromSocketIO?(0,f.parseSocketIOUrl)(d):d,R=t.current.queryParams?(0,f.appendQueryParams)(b,t.current.queryParams):b,[2,R]}})})};r.getUrl=E})(x)),x}var qe={},mr;function _t(){return mr||(mr=1,(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.websocketWrapper=void 0;var S=function(O,v){return new Proxy(O,{get:function(f,_){var y=f[_];return _==="reconnect"?v:typeof y=="function"?(console.error("Calling methods directly on the websocket is not supported at this moment. You must use the methods returned by useWebSocket."),function(){}):y},set:function(f,_,y){return/^on/.test(_)?(console.warn("The websocket's event handlers should be defined through the options object passed into useWebSocket."),!1):(f[_]=y,!0)}})};r.websocketWrapper=S,r.default=r.websocketWrapper})(qe)),qe}var Tr;function Ye(){if(Tr)return q;Tr=1;var r=q&&q.__assign||function(){return r=Object.assign||function(i){for(var t,n=1,d=arguments.length;n<d;n++){t=arguments[n];for(var h in t)Object.prototype.hasOwnProperty.call(t,h)&&(i[h]=t[h])}return i},r.apply(this,arguments)},S=q&&q.__awaiter||function(i,t,n,d){function h(o){return o instanceof n?o:new n(function(b){b(o)})}return new(n||(n=Promise))(function(o,b){function R(A){try{m(d.next(A))}catch(I){b(I)}}function k(A){try{m(d.throw(A))}catch(I){b(I)}}function m(A){A.done?o(A.value):h(A.value).then(R,k)}m((d=d.apply(i,t||[])).next())})},O=q&&q.__generator||function(i,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},d,h,o,b=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return b.next=R(0),b.throw=R(1),b.return=R(2),typeof Symbol=="function"&&(b[Symbol.iterator]=function(){return this}),b;function R(m){return function(A){return k([m,A])}}function k(m){if(d)throw new TypeError("Generator is already executing.");for(;b&&(b=0,m[0]&&(n=0)),n;)try{if(d=1,h&&(o=m[0]&2?h.return:m[0]?h.throw||((o=h.return)&&o.call(h),0):h.next)&&!(o=o.call(h,m[1])).done)return o;switch(h=0,o&&(m=[m[0]&2,o.value]),m[0]){case 0:case 1:o=m;break;case 4:return n.label++,{value:m[1],done:!1};case 5:n.label++,h=m[1],m=[0];continue;case 7:m=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(m[0]===6||m[0]===2)){n=0;continue}if(m[0]===3&&(!o||m[1]>o[0]&&m[1]<o[3])){n.label=m[1];break}if(m[0]===6&&n.label<o[1]){n.label=o[1],o=m;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(m);break}o[2]&&n.ops.pop(),n.trys.pop();continue}m=t.call(i,n)}catch(A){m=[6,A],h=0}finally{d=o=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}},v=q&&q.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(q,"__esModule",{value:!0}),q.useWebSocket=void 0;var f=N,_=tt,y=$(),E=vt(),c=Et(),s=v(_t()),u=Be(),a=function(i,t,n){t===void 0&&(t=y.DEFAULT_OPTIONS),n===void 0&&(n=!0);var d=(0,f.useState)(null),h=d[0],o=d[1],b=(0,f.useState)({}),R=b[0],k=b[1],m=(0,f.useMemo)(function(){if(!t.disableJson&&h)try{return JSON.parse(h.data)}catch{return y.UNPARSABLE_JSON_OBJECT}return null},[h,t.disableJson]),A=(0,f.useRef)(null),I=(0,f.useRef)(null),fe=(0,f.useRef)(function(){}),de=(0,f.useRef)(0),Pe=(0,f.useRef)(Date.now()),ge=(0,f.useRef)([]),H=(0,f.useRef)(null),j=(0,f.useRef)(t);j.current=t;var J=A.current&&R[A.current]!==void 0?R[A.current]:i!==null&&n===!0?y.ReadyState.CONNECTING:y.ReadyState.UNINSTANTIATED,ee=t.queryParams?JSON.stringify(t.queryParams):null,B=(0,f.useCallback)(function(D,U){var Y;if(U===void 0&&(U=!0),y.isEventSourceSupported&&I.current instanceof EventSource){console.warn("Unable to send a message from an eventSource");return}((Y=I.current)===null||Y===void 0?void 0:Y.readyState)===y.ReadyState.OPEN?((0,u.assertIsWebSocket)(I.current,j.current.skipAssert),I.current.send(D)):U&&ge.current.push(D)},[]),Oe=(0,f.useCallback)(function(D,U){U===void 0&&(U=!0),B(JSON.stringify(D),U)},[B]),pe=(0,f.useCallback)(function(){return j.current.share!==!0||y.isEventSourceSupported&&I.current instanceof EventSource?I.current:(H.current===null&&I.current&&((0,u.assertIsWebSocket)(I.current,j.current.skipAssert),H.current=(0,s.default)(I.current,fe)),H.current)},[]);return(0,f.useEffect)(function(){if(i!==null&&n===!0){var D,U=!1,Y=!0,ve=function(){return S(void 0,void 0,void 0,function(){var re,Z,me;return O(this,function(ce){switch(ce.label){case 0:return re=A,[4,(0,c.getUrl)(i,j)];case 1:return re.current=ce.sent(),A.current===null?(console.error("Failed to get a valid URL. WebSocket connection aborted."),A.current="ABORTED",(0,_.flushSync)(function(){return k(function(K){return r(r({},K),{ABORTED:y.ReadyState.CLOSED})})}),[2]):(Z=function(K){U||(0,_.flushSync)(function(){return o(K)})},me=function(K){U||(0,_.flushSync)(function(){return k(function(ie){var te;return r(r({},ie),A.current&&(te={},te[A.current]=K,te))})})},Y&&(D=(0,E.createOrJoinSocket)(I,A.current,me,j,Z,fe,de,Pe,B)),[2])}})})};return fe.current=function(){U||(H.current&&(H.current=null),D?.(),ve())},ve(),function(){U=!0,Y=!1,H.current&&(H.current=null),D?.(),o(null)}}else(i===null||n===!1)&&(de.current=0,k(function(re){var Z;return r(r({},re),A.current&&(Z={},Z[A.current]=y.ReadyState.CLOSED,Z))}))},[i,n,ee,B]),(0,f.useEffect)(function(){J===y.ReadyState.OPEN&&ge.current.splice(0).forEach(function(D){B(D)})},[J]),{sendMessage:B,sendJsonMessage:Oe,lastMessage:h,lastJsonMessage:m,readyState:J,getWebSocket:pe}};return q.useWebSocket=a,q}var oe={},Cr;function yt(){if(Cr)return oe;Cr=1;var r=oe&&oe.__assign||function(){return r=Object.assign||function(E){for(var c,s=1,u=arguments.length;s<u;s++){c=arguments[s];for(var a in c)Object.prototype.hasOwnProperty.call(c,a)&&(E[a]=c[a])}return E},r.apply(this,arguments)};Object.defineProperty(oe,"__esModule",{value:!0}),oe.useSocketIO=void 0;var S=N,O=Ye(),v=$(),f={type:"empty",payload:null},_=function(E){if(!E||!E.data)return f;var c=E.data.match(/\[.*]/);if(!c)return f;var s=JSON.parse(c);return!Array.isArray(s)||!s[1]?f:{type:s[0],payload:s[1]}},y=function(E,c,s){c===void 0&&(c=v.DEFAULT_OPTIONS),s===void 0&&(s=!0);var u=(0,S.useMemo)(function(){return r(r({},c),{fromSocketIO:!0})},[]),a=(0,O.useWebSocket)(E,u,s),i=a.sendMessage,t=a.sendJsonMessage,n=a.lastMessage,d=a.readyState,h=a.getWebSocket,o=(0,S.useMemo)(function(){return _(n)},[n]);return{sendMessage:i,sendJsonMessage:t,lastMessage:o,lastJsonMessage:o,readyState:d,getWebSocket:h}};return oe.useSocketIO=y,oe}var z={},Rr;function St(){if(Rr)return z;Rr=1;var r=z&&z.__assign||function(){return r=Object.assign||function(y){for(var E,c=1,s=arguments.length;c<s;c++){E=arguments[c];for(var u in E)Object.prototype.hasOwnProperty.call(E,u)&&(y[u]=E[u])}return y},r.apply(this,arguments)},S=z&&z.__rest||function(y,E){var c={};for(var s in y)Object.prototype.hasOwnProperty.call(y,s)&&E.indexOf(s)<0&&(c[s]=y[s]);if(y!=null&&typeof Object.getOwnPropertySymbols=="function")for(var u=0,s=Object.getOwnPropertySymbols(y);u<s.length;u++)E.indexOf(s[u])<0&&Object.prototype.propertyIsEnumerable.call(y,s[u])&&(c[s[u]]=y[s[u]]);return c};Object.defineProperty(z,"__esModule",{value:!0}),z.useEventSource=void 0;var O=N,v=Ye(),f=$(),_=function(y,E,c){E===void 0&&(E=f.DEFAULT_EVENT_SOURCE_OPTIONS);var s=E.withCredentials,u=E.events,a=S(E,["withCredentials","events"]);c===void 0&&(c=!0);var i=r(r({},a),{eventSourceOptions:{withCredentials:s}}),t=(0,O.useRef)(f.EMPTY_EVENT_HANDLERS);u&&(t.current=u);var n=(0,v.useWebSocket)(y,i,c),d=n.lastMessage,h=n.readyState,o=n.getWebSocket;return(0,O.useEffect)(function(){d?.type&&Object.entries(t.current).forEach(function(b){var R=b[0],k=b[1];R===d.type&&k(d)})},[d]),{lastEvent:d,readyState:h,getEventSource:o}};return z.useEventSource=_,z}var wr;function ht(){return wr||(wr=1,(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.resetGlobalState=r.useEventSource=r.ReadyState=r.useSocketIO=r.default=void 0;var S=Ye();Object.defineProperty(r,"default",{enumerable:!0,get:function(){return S.useWebSocket}});var O=yt();Object.defineProperty(r,"useSocketIO",{enumerable:!0,get:function(){return O.useSocketIO}});var v=$();Object.defineProperty(r,"ReadyState",{enumerable:!0,get:function(){return v.ReadyState}});var f=St();Object.defineProperty(r,"useEventSource",{enumerable:!0,get:function(){return f.useEventSource}});var _=Be();Object.defineProperty(r,"resetGlobalState",{enumerable:!0,get:function(){return _.resetGlobalState}})})(je)),je}var bt=ht();const gt=nt(bt),V={DEPOSIT:"deposit",TRANS_CODE:"transCode",ERROR:"error",UPDATE_MEMBER:"update_member",MAINTAIN_NOTICE:"maintain_notice",MAINTAIN_NOTICE_MEMBER:"maintain_notice_member",RELOAD:"reload",TRANSFER_IN_GAME:"transfer_in_game",CHECK_REQUEST:"CHECK_RREQUEST",CASH_REGISTER_LIMIT:"cash_register_limit"},Ot=3e4,pt=({socketUrl:r,socketHandlers:S={},options:O={}})=>{const v=N.useRef(!1),f=N.useRef(S),{sendMessage:_,sendJsonMessage:y,lastMessage:E,readyState:c}=gt(r,{queryParams:{key:"wsky"},onOpen:()=>console.log("連線成功"),shouldReconnect:()=>v.current===!1,reconnectAttempts:9999,reconnectInterval:1e3,...O}),s=N.useMemo(()=>{try{return JSON.parse(E?.data)}catch{return null}},[E?.data]);return N.useEffect(()=>{const u=setInterval(()=>_("ping"),Ot);return()=>clearInterval(u)},[_]),N.useEffect(()=>{f.current=S},[S]),N.useEffect(()=>{if(!s)return;const{onDeposit:u,onTransCode:a,onError:i,onUpdateMember:t,onMaintainNotice:n,onMaintainNoticeMember:d,onReload:h,onTransferInGame:o,onCashRegisterLimit:b}=f.current,R=we.get(s,"type",""),k={memberInfoUid:we.get(s,"member_info_uid",null),data:we.get(s,"data",null),memo:we.get(s,"memo",null)};switch(R){case V.DEPOSIT:u?.(k);break;case V.TRANS_CODE:a?.(k);break;case V.ERROR:i?.(k);break;case V.UPDATE_MEMBER:t?.(k);break;case V.MAINTAIN_NOTICE:n?.(k);break;case V.MAINTAIN_NOTICE_MEMBER:d?.(k);break;case V.RELOAD:h?.(k);break;case V.TRANSFER_IN_GAME:case V.CHECK_REQUEST:o?.(k);break;case V.CASH_REGISTER_LIMIT:b?.(k);break;default:console.warn("Unknown socket type:",R);break}},[s]),N.useEffect(()=>()=>v.current=!0,[]),{sendMessage:_,sendJsonMessage:y,readyState:c}},kr=()=>{const{client:r}=be(),S=N.useCallback(async()=>{const{data:v}=await r.get("/carousels");return v},[r]),O=N.useCallback(async()=>await r.get("/marquees"),[r]);return{commonCarouselApi:S,commonMarqueeApi:O}},mt=()=>{const{commonCarouselApi:r}=kr();return X.useQuery({queryKey:["getCarouselList"],queryFn:async()=>await r()})},Tt=()=>{const{commonMarqueeApi:r}=kr();return X.useQuery({queryKey:["getMarqueeList"],queryFn:async()=>r()})},Ct=({refetchInterval:r=5e4,trigger:S=[],enabled:O=!0}={})=>{const{getToken:v}=be(),{userInfoApi:f}=Je(),_=X.useQueries({queries:[{queryKey:["getMemberInfo",...S],queryFn:async()=>await f(),refetchInterval:r,enabled:!!v&&O}]}),{data:y,isFetching:E,error:c}=_[0]||{};return{data:y,isFetching:E,error:c}},Rt=({enabled:r=!0}={})=>{const{userInfoApi:S,userFavoriteGameApi:O,userGameListApi:v}=Je(),f=X.useQuery({queryKey:["getMemInfo"],queryFn:async()=>S(),enabled:r}),_=X.useQuery({queryKey:["getFavoriteGame"],queryFn:async()=>O(),enabled:r&&f.isSuccess}),y=X.useQuery({queryKey:["getUserGameList"],queryFn:async()=>v(),enabled:r&&f.isSuccess&&_.isSuccess});return[f,_,y]};exports.ApiCtx=Ge;exports.ApiProvider=it;exports.createLogoutHandler=st;exports.useApiContext=be;exports.useBalanceGetter=lt;exports.useClientWebSocket=pt;exports.useGetCarouseList=mt;exports.useGetMarquee=Tt;exports.useGetMemberInfo=Ct;exports.useInitializeWithToken=Rt;
|
|
14
|
+
<%s key={someKey} {...props} />`,De,ne,Zr,ne),cr[ne+De]=!0}}return e===v?Kr(L):Yr(L),L}}function Qr(e,l,g){return ir(e,l,g,!0)}function xr(e,l,g){return ir(e,l,g,!1)}var zr=xr,Xr=Qr;ye.Fragment=v,ye.jsx=zr,ye.jsxs=Xr})()),ye}var fr;function ot(){return fr||(fr=1,process.env.NODE_ENV==="production"?Ae.exports=at():Ae.exports=ut()),Ae.exports}var dr=ot();const Ge=N.createContext(null),be=()=>{const r=N.useContext(Ge);if(!r)throw new Error("useApiContext must be used within ApiProvider");return r};function ct({baseURL:r,getToken:y,timeoutMs:O=15e3,lng:v="tw",store:f,onError:_}={}){const S=rt.create({baseURL:r,timeout:O,headers:{"Content-Type":"application/json"}});return S.interceptors.request.use(async E=>{if(E.headers=E.headers||{},y){const s=await y();s&&(E.headers.Authorization=`Bearer ${s}`)}const c=f?.getState()?.isWalletCurrency;return E.headers.Currency=c,E.headers["currency-code"]=c,E.headers.lang=v,E}),S.interceptors.response.use(E=>E.data,E=>_?_(E,{instance:S}):Promise.reject(E)),S}function it({children:r,...y}){const O=N.useMemo(()=>ct(y),[y]),f=N.useMemo(()=>new X.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1}}}),[]);return dr.jsx(X.QueryClientProvider,{client:f,children:dr.jsx(Ge.Provider,{value:{client:O,...y},children:r})})}const st=()=>{const r=(v,f)=>!v&&!f,y=v=>v.startsWith("pc.");return{executeLogout:({isCallBackInvalid:v=!1,hostname:f="",shouldRedirect:_,onShowError:S,onCleanup:E,onRemoveToken:c,onRedirect:s,onGoogleLogout:u})=>{const a=y(f);r(v,a)&&S?.(),E?.(),c?.(),_&&s?.("/"),u?.()},shouldShowErrorNotice:r,isMachineDomain:y}},Je=()=>{const{client:r}=be(),y=N.useCallback(async S=>{const{mac_address:E="",app_version:c="",anydesk_id:s=""}=S,{data:u}=await r.post("/cash-register/login",{mac_address:E,app_version:c,anydesk_id:s});return u},[r]),O=N.useCallback(async()=>r.get("/member/getMemberInfo"),[r]),v=N.useCallback(async()=>await r.get("member/getGameList"),[r]),f=N.useCallback(async()=>await r.get("/member/getNowCurrencyExchange"),[r]),_=N.useCallback(async()=>await r.get("member/getFavoriteGame"),[r]);return{machineLoginApi:y,userInfoApi:O,userGameListApi:v,userFavoriteGameApi:_,userCurrencyExchangeApi:f}},lt=({otherQueryKey:r=[],options:y={}}={})=>{const{userCurrencyExchangeApi:O}=Je(),{getToken:v}=be(),{enabled:f,..._}=y,S=!!v&&(f?f.every(E=>E):!0);return X.useQueries({queries:[{queryKey:["userCurrencyExchange",...r],queryFn:()=>O(),enabled:S,..._}]})};var je={},q={},Ue={},vr;function $(){return vr||(vr=1,(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.isEventSourceSupported=r.isReactNative=r.ReadyState=r.DEFAULT_HEARTBEAT=r.UNPARSABLE_JSON_OBJECT=r.DEFAULT_RECONNECT_INTERVAL_MS=r.DEFAULT_RECONNECT_LIMIT=r.SOCKET_IO_PING_CODE=r.SOCKET_IO_PATH=r.SOCKET_IO_PING_INTERVAL=r.DEFAULT_EVENT_SOURCE_OPTIONS=r.EMPTY_EVENT_HANDLERS=r.DEFAULT_OPTIONS=void 0;var y=1,O=1e3*y;r.DEFAULT_OPTIONS={},r.EMPTY_EVENT_HANDLERS={},r.DEFAULT_EVENT_SOURCE_OPTIONS={withCredentials:!1,events:r.EMPTY_EVENT_HANDLERS},r.SOCKET_IO_PING_INTERVAL=25*O,r.SOCKET_IO_PATH="/socket.io/?EIO=3&transport=websocket",r.SOCKET_IO_PING_CODE="2",r.DEFAULT_RECONNECT_LIMIT=20,r.DEFAULT_RECONNECT_INTERVAL_MS=5e3,r.UNPARSABLE_JSON_OBJECT={},r.DEFAULT_HEARTBEAT={message:"ping",timeout:6e4,interval:25e3};var v;(function(_){_[_.UNINSTANTIATED=-1]="UNINSTANTIATED",_[_.CONNECTING=0]="CONNECTING",_[_.OPEN=1]="OPEN",_[_.CLOSING=2]="CLOSING",_[_.CLOSED=3]="CLOSED"})(v||(r.ReadyState=v={}));var f=function(){try{return"EventSource"in globalThis}catch{return!1}};r.isReactNative=typeof navigator<"u"&&navigator.product==="ReactNative",r.isEventSourceSupported=!r.isReactNative&&f()})(Ue)),Ue}var Se={},We={},Er;function He(){return Er||(Er=1,(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.resetWebSockets=r.sharedWebSockets=void 0,r.sharedWebSockets={};var y=function(O){if(O&&r.sharedWebSockets.hasOwnProperty(O))delete r.sharedWebSockets[O];else for(var v in r.sharedWebSockets)r.sharedWebSockets.hasOwnProperty(v)&&delete r.sharedWebSockets[v]};r.resetWebSockets=y})(We)),We}var ae={},Q={},_r;function Ve(){if(_r)return Q;_r=1,Object.defineProperty(Q,"__esModule",{value:!0}),Q.setUpSocketIOPing=Q.appendQueryParams=Q.parseSocketIOUrl=void 0;var r=$(),y=function(f){if(f){var _=/^https|wss/.test(f),S=f.replace(/^(https?|wss?)(:\/\/)?/,""),E=S.replace(/\/$/,""),c=_?"wss":"ws";return"".concat(c,"://").concat(E).concat(r.SOCKET_IO_PATH)}else if(f===""){var _=/^https/.test(window.location.protocol),c=_?"wss":"ws",s=window.location.port?":".concat(window.location.port):"";return"".concat(c,"://").concat(window.location.hostname).concat(s).concat(r.SOCKET_IO_PATH)}return f};Q.parseSocketIOUrl=y;var O=function(f,_){_===void 0&&(_={});var S=/\?([\w]+=[\w]+)/,E=S.test(f),c="".concat(Object.entries(_).reduce(function(s,u){var a=u[0],i=u[1];return s+"".concat(a,"=").concat(i,"&")},"").slice(0,-1));return"".concat(f).concat(E?"&":"?").concat(c)};Q.appendQueryParams=O;var v=function(f,_){_===void 0&&(_=r.SOCKET_IO_PING_INTERVAL);var S=function(){return f(r.SOCKET_IO_PING_CODE)};return window.setInterval(S,_)};return Q.setUpSocketIOPing=v,Q}var ke={},yr;function Ar(){if(yr)return ke;yr=1,Object.defineProperty(ke,"__esModule",{value:!0}),ke.heartbeat=O;var r=$();function y(v){return Array.isArray(v)?v.reduce(function(f,_){return f.current>_.current?f:_}).current:v.current}function O(v,f,_){var S=_||{},E=S.interval,c=E===void 0?r.DEFAULT_HEARTBEAT.interval:E,s=S.timeout,u=s===void 0?r.DEFAULT_HEARTBEAT.timeout:s,a=S.message,i=a===void 0?r.DEFAULT_HEARTBEAT.message:a,t=Math.max(100,c/10),n=Date.now(),d=setInterval(function(){var h=Date.now(),o=y(f);if(o+u<=h)console.warn("Heartbeat timed out, closing connection, last message received ".concat(h-o,"ms ago, last ping sent ").concat(h-n,"ms ago")),v.close();else if(o+c<=h&&n+c<=h)try{typeof i=="function"?v.send(i()):v.send(i),n=h}catch(b){console.error("Heartbeat failed, closing connection",b instanceof Error?b.message:b),v.close()}},t);return v.addEventListener("close",function(){clearInterval(d)}),function(){}}return ke}var he={},Fe={},Sr;function $e(){return Sr||(Sr=1,(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.resetSubscribers=r.removeSubscriber=r.addSubscriber=r.hasSubscribers=r.getSubscribers=void 0;var y={},O=[],v=function(c){return(0,r.hasSubscribers)(c)?Array.from(y[c]):O};r.getSubscribers=v;var f=function(c){var s;return((s=y[c])===null||s===void 0?void 0:s.size)>0};r.hasSubscribers=f;var _=function(c,s){y[c]=y[c]||new Set,y[c].add(s)};r.addSubscriber=_;var S=function(c,s){y[c].delete(s)};r.removeSubscriber=S;var E=function(c){if(c&&y.hasOwnProperty(c))delete y[c];else for(var s in y)y.hasOwnProperty(s)&&delete y[s]};r.resetSubscribers=E})(Fe)),Fe}var hr;function Be(){if(hr)return he;hr=1,Object.defineProperty(he,"__esModule",{value:!0}),he.assertIsWebSocket=O,he.resetGlobalState=v;var r=He(),y=$e();function O(f,_){if(!_&&!(f instanceof WebSocket))throw new Error("")}function v(f){(0,y.resetSubscribers)(f),(0,r.resetWebSockets)(f)}return he}var br;function ft(){if(br)return ae;br=1;var r=ae&&ae.__assign||function(){return r=Object.assign||function(u){for(var a,i=1,t=arguments.length;i<t;i++){a=arguments[i];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(u[n]=a[n])}return u},r.apply(this,arguments)};Object.defineProperty(ae,"__esModule",{value:!0}),ae.attachListeners=void 0;var y=Ve(),O=Ar(),v=$(),f=Be(),_=function(u,a,i,t){u.onmessage=function(n){var d;a.current.onMessage&&a.current.onMessage(n),typeof t?.current=="number"&&(t.current=Date.now()),!(typeof a.current.filter=="function"&&a.current.filter(n)!==!0)&&(a.current.heartbeat&&typeof a.current.heartbeat!="boolean"&&((d=a.current.heartbeat)===null||d===void 0?void 0:d.returnMessage)===n.data||i(n))}},S=function(u,a,i,t,n){u.onopen=function(d){if(a.current.onOpen&&a.current.onOpen(d),t.current=0,i(v.ReadyState.OPEN),a.current.heartbeat&&u instanceof WebSocket){var h=typeof a.current.heartbeat=="boolean"?void 0:a.current.heartbeat;n.current=Date.now(),(0,O.heartbeat)(u,n,h)}}},E=function(u,a,i,t,n){if(v.isEventSourceSupported&&u instanceof EventSource)return function(){};(0,f.assertIsWebSocket)(u,a.current.skipAssert);var d;return u.onclose=function(h){var o;if(a.current.onClose&&a.current.onClose(h),i(v.ReadyState.CLOSED),a.current.shouldReconnect&&a.current.shouldReconnect(h)){var b=(o=a.current.reconnectAttempts)!==null&&o!==void 0?o:v.DEFAULT_RECONNECT_LIMIT;if(n.current<b){var R=typeof a.current.reconnectInterval=="function"?a.current.reconnectInterval(n.current):a.current.reconnectInterval;d=window.setTimeout(function(){n.current++,t()},R??v.DEFAULT_RECONNECT_INTERVAL_MS)}else a.current.onReconnectStop&&a.current.onReconnectStop(b),console.warn("Max reconnect attempts of ".concat(b," exceeded"))}},function(){return d&&window.clearTimeout(d)}},c=function(u,a,i,t,n){var d;return u.onerror=function(h){var o;if(a.current.onError&&a.current.onError(h),v.isEventSourceSupported&&u instanceof EventSource&&(a.current.onClose&&a.current.onClose(r(r({},h),{code:1006,reason:"An error occurred with the EventSource: ".concat(h),wasClean:!1})),i(v.ReadyState.CLOSED),u.close()),a.current.retryOnError)if(n.current<((o=a.current.reconnectAttempts)!==null&&o!==void 0?o:v.DEFAULT_RECONNECT_LIMIT)){var b=typeof a.current.reconnectInterval=="function"?a.current.reconnectInterval(n.current):a.current.reconnectInterval;d=window.setTimeout(function(){n.current++,t()},b??v.DEFAULT_RECONNECT_INTERVAL_MS)}else a.current.onReconnectStop&&a.current.onReconnectStop(a.current.reconnectAttempts),console.warn("Max reconnect attempts of ".concat(a.current.reconnectAttempts," exceeded"))},function(){return d&&window.clearTimeout(d)}},s=function(u,a,i,t,n,d,h){var o=a.setLastMessage,b=a.setReadyState,R,k,m;return i.current.fromSocketIO&&(R=(0,y.setUpSocketIOPing)(h)),_(u,i,o,d),S(u,i,b,n,d),k=E(u,i,b,t,n),m=c(u,i,b,t,n),function(){b(v.ReadyState.CLOSING),k(),m(),u.close(),R&&clearInterval(R)}};return ae.attachListeners=s,ae}var ue={},gr;function dt(){if(gr)return ue;gr=1;var r=ue&&ue.__assign||function(){return r=Object.assign||function(a){for(var i,t=1,n=arguments.length;t<n;t++){i=arguments[t];for(var d in i)Object.prototype.hasOwnProperty.call(i,d)&&(a[d]=i[d])}return a},r.apply(this,arguments)};Object.defineProperty(ue,"__esModule",{value:!0}),ue.attachSharedListeners=void 0;var y=He(),O=$(),v=$e(),f=Ve(),_=Ar(),S=function(a,i,t){a.onmessage=function(n){(0,v.getSubscribers)(i).forEach(function(d){var h;d.optionsRef.current.onMessage&&d.optionsRef.current.onMessage(n),typeof((h=d?.lastMessageTime)===null||h===void 0?void 0:h.current)=="number"&&(d.lastMessageTime.current=Date.now()),!(typeof d.optionsRef.current.filter=="function"&&d.optionsRef.current.filter(n)!==!0)&&(t&&typeof t!="boolean"&&t?.returnMessage===n.data||d.setLastMessage(n))})}},E=function(a,i,t){a.onopen=function(n){var d=(0,v.getSubscribers)(i);d.forEach(function(h){h.reconnectCount.current=0,h.optionsRef.current.onOpen&&h.optionsRef.current.onOpen(n),h.setReadyState(O.ReadyState.OPEN),t&&a instanceof WebSocket&&(h.lastMessageTime.current=Date.now())}),t&&a instanceof WebSocket&&(0,_.heartbeat)(a,d.map(function(h){return h.lastMessageTime}),typeof t=="boolean"?void 0:t)}},c=function(a,i){a instanceof WebSocket&&(a.onclose=function(t){(0,v.getSubscribers)(i).forEach(function(n){n.optionsRef.current.onClose&&n.optionsRef.current.onClose(t),n.setReadyState(O.ReadyState.CLOSED)}),delete y.sharedWebSockets[i],(0,v.getSubscribers)(i).forEach(function(n){var d;if(n.optionsRef.current.shouldReconnect&&n.optionsRef.current.shouldReconnect(t)){var h=(d=n.optionsRef.current.reconnectAttempts)!==null&&d!==void 0?d:O.DEFAULT_RECONNECT_LIMIT;if(n.reconnectCount.current<h){var o=typeof n.optionsRef.current.reconnectInterval=="function"?n.optionsRef.current.reconnectInterval(n.reconnectCount.current):n.optionsRef.current.reconnectInterval;setTimeout(function(){n.reconnectCount.current++,n.reconnect.current()},o??O.DEFAULT_RECONNECT_INTERVAL_MS)}else n.optionsRef.current.onReconnectStop&&n.optionsRef.current.onReconnectStop(n.optionsRef.current.reconnectAttempts),console.warn("Max reconnect attempts of ".concat(h," exceeded"))}})})},s=function(a,i){a.onerror=function(t){(0,v.getSubscribers)(i).forEach(function(n){n.optionsRef.current.onError&&n.optionsRef.current.onError(t),O.isEventSourceSupported&&a instanceof EventSource&&(n.optionsRef.current.onClose&&n.optionsRef.current.onClose(r(r({},t),{code:1006,reason:"An error occurred with the EventSource: ".concat(t),wasClean:!1})),n.setReadyState(O.ReadyState.CLOSED))}),O.isEventSourceSupported&&a instanceof EventSource&&a.close()}},u=function(a,i,t,n){var d;return t.current.fromSocketIO&&(d=(0,f.setUpSocketIOPing)(n)),S(a,i,t.current.heartbeat),c(a,i),E(a,i,t.current.heartbeat),s(a,i),function(){d&&clearInterval(d)}};return ue.attachSharedListeners=u,ue}var Or;function vt(){if(Or)return Se;Or=1,Object.defineProperty(Se,"__esModule",{value:!0}),Se.createOrJoinSocket=void 0;var r=He(),y=$(),O=ft(),v=dt(),f=$e(),_=function(E,c,s,u,a){return function(){if((0,f.removeSubscriber)(E,c),!(0,f.hasSubscribers)(E)){try{var i=r.sharedWebSockets[E];i instanceof WebSocket&&(i.onclose=function(t){s.current.onClose&&s.current.onClose(t),u(y.ReadyState.CLOSED)}),i.close()}catch{}a&&a(),delete r.sharedWebSockets[E]}}},S=function(E,c,s,u,a,i,t,n,d){if(!y.isEventSourceSupported&&u.current.eventSourceOptions)throw y.isReactNative?new Error("EventSource is not supported in ReactNative"):new Error("EventSource is not supported");if(u.current.share){var h=null;r.sharedWebSockets[c]===void 0?(r.sharedWebSockets[c]=u.current.eventSourceOptions?new EventSource(c,u.current.eventSourceOptions):new WebSocket(c,u.current.protocols),E.current=r.sharedWebSockets[c],s(y.ReadyState.CONNECTING),h=(0,v.attachSharedListeners)(r.sharedWebSockets[c],c,u,d)):(E.current=r.sharedWebSockets[c],s(r.sharedWebSockets[c].readyState));var o={setLastMessage:a,setReadyState:s,optionsRef:u,reconnectCount:t,lastMessageTime:n,reconnect:i};return(0,f.addSubscriber)(c,o),_(c,o,u,s,h)}else{if(E.current=u.current.eventSourceOptions?new EventSource(c,u.current.eventSourceOptions):new WebSocket(c,u.current.protocols),s(y.ReadyState.CONNECTING),!E.current)throw new Error("WebSocket failed to be created");return(0,O.attachListeners)(E.current,{setLastMessage:a,setReadyState:s},u,i.current,t,n,d)}};return Se.createOrJoinSocket=S,Se}var x={},pr;function Et(){return pr||(pr=1,(function(r){var y=x&&x.__awaiter||function(c,s,u,a){function i(t){return t instanceof u?t:new u(function(n){n(t)})}return new(u||(u=Promise))(function(t,n){function d(b){try{o(a.next(b))}catch(R){n(R)}}function h(b){try{o(a.throw(b))}catch(R){n(R)}}function o(b){b.done?t(b.value):i(b.value).then(d,h)}o((a=a.apply(c,s||[])).next())})},O=x&&x.__generator||function(c,s){var u={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},a,i,t,n=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return n.next=d(0),n.throw=d(1),n.return=d(2),typeof Symbol=="function"&&(n[Symbol.iterator]=function(){return this}),n;function d(o){return function(b){return h([o,b])}}function h(o){if(a)throw new TypeError("Generator is already executing.");for(;n&&(n=0,o[0]&&(u=0)),u;)try{if(a=1,i&&(t=o[0]&2?i.return:o[0]?i.throw||((t=i.return)&&t.call(i),0):i.next)&&!(t=t.call(i,o[1])).done)return t;switch(i=0,t&&(o=[o[0]&2,t.value]),o[0]){case 0:case 1:t=o;break;case 4:return u.label++,{value:o[1],done:!1};case 5:u.label++,i=o[1],o=[0];continue;case 7:o=u.ops.pop(),u.trys.pop();continue;default:if(t=u.trys,!(t=t.length>0&&t[t.length-1])&&(o[0]===6||o[0]===2)){u=0;continue}if(o[0]===3&&(!t||o[1]>t[0]&&o[1]<t[3])){u.label=o[1];break}if(o[0]===6&&u.label<t[1]){u.label=t[1],t=o;break}if(t&&u.label<t[2]){u.label=t[2],u.ops.push(o);break}t[2]&&u.ops.pop(),u.trys.pop();continue}o=s.call(c,u)}catch(b){o=[6,b],i=0}finally{a=t=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}},v=x&&x.__spreadArray||function(c,s,u){if(u||arguments.length===2)for(var a=0,i=s.length,t;a<i;a++)(t||!(a in s))&&(t||(t=Array.prototype.slice.call(s,0,a)),t[a]=s[a]);return c.concat(t||Array.prototype.slice.call(s))};Object.defineProperty(r,"__esModule",{value:!0}),r.getUrl=void 0;var f=Ve(),_=$(),S=function(c){return new Promise(function(s){return window.setTimeout(s,c)})},E=function(c,s){for(var u=[],a=2;a<arguments.length;a++)u[a-2]=arguments[a];return y(void 0,v([c,s],u,!0),void 0,function(i,t,n){var d,h,o,b,R,k,m,A;return n===void 0&&(n=0),O(this,function(I){switch(I.label){case 0:if(typeof i!="function")return[3,10];I.label=1;case 1:return I.trys.push([1,3,,9]),[4,i()];case 2:return d=I.sent(),[3,9];case 3:return I.sent(),t.current.retryOnError?(h=(k=t.current.reconnectAttempts)!==null&&k!==void 0?k:_.DEFAULT_RECONNECT_LIMIT,n<h?(o=typeof t.current.reconnectInterval=="function"?t.current.reconnectInterval(n):t.current.reconnectInterval,[4,S(o??_.DEFAULT_RECONNECT_INTERVAL_MS)]):[3,5]):[3,7];case 4:return I.sent(),[2,(0,r.getUrl)(i,t,n+1)];case 5:return(A=(m=t.current).onReconnectStop)===null||A===void 0||A.call(m,n),[2,null];case 6:return[3,8];case 7:return[2,null];case 8:return[3,9];case 9:return[3,11];case 10:d=i,I.label=11;case 11:return b=t.current.fromSocketIO?(0,f.parseSocketIOUrl)(d):d,R=t.current.queryParams?(0,f.appendQueryParams)(b,t.current.queryParams):b,[2,R]}})})};r.getUrl=E})(x)),x}var qe={},mr;function _t(){return mr||(mr=1,(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.websocketWrapper=void 0;var y=function(O,v){return new Proxy(O,{get:function(f,_){var S=f[_];return _==="reconnect"?v:typeof S=="function"?(console.error("Calling methods directly on the websocket is not supported at this moment. You must use the methods returned by useWebSocket."),function(){}):S},set:function(f,_,S){return/^on/.test(_)?(console.warn("The websocket's event handlers should be defined through the options object passed into useWebSocket."),!1):(f[_]=S,!0)}})};r.websocketWrapper=y,r.default=r.websocketWrapper})(qe)),qe}var Tr;function Ye(){if(Tr)return q;Tr=1;var r=q&&q.__assign||function(){return r=Object.assign||function(i){for(var t,n=1,d=arguments.length;n<d;n++){t=arguments[n];for(var h in t)Object.prototype.hasOwnProperty.call(t,h)&&(i[h]=t[h])}return i},r.apply(this,arguments)},y=q&&q.__awaiter||function(i,t,n,d){function h(o){return o instanceof n?o:new n(function(b){b(o)})}return new(n||(n=Promise))(function(o,b){function R(A){try{m(d.next(A))}catch(I){b(I)}}function k(A){try{m(d.throw(A))}catch(I){b(I)}}function m(A){A.done?o(A.value):h(A.value).then(R,k)}m((d=d.apply(i,t||[])).next())})},O=q&&q.__generator||function(i,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},d,h,o,b=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return b.next=R(0),b.throw=R(1),b.return=R(2),typeof Symbol=="function"&&(b[Symbol.iterator]=function(){return this}),b;function R(m){return function(A){return k([m,A])}}function k(m){if(d)throw new TypeError("Generator is already executing.");for(;b&&(b=0,m[0]&&(n=0)),n;)try{if(d=1,h&&(o=m[0]&2?h.return:m[0]?h.throw||((o=h.return)&&o.call(h),0):h.next)&&!(o=o.call(h,m[1])).done)return o;switch(h=0,o&&(m=[m[0]&2,o.value]),m[0]){case 0:case 1:o=m;break;case 4:return n.label++,{value:m[1],done:!1};case 5:n.label++,h=m[1],m=[0];continue;case 7:m=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(m[0]===6||m[0]===2)){n=0;continue}if(m[0]===3&&(!o||m[1]>o[0]&&m[1]<o[3])){n.label=m[1];break}if(m[0]===6&&n.label<o[1]){n.label=o[1],o=m;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(m);break}o[2]&&n.ops.pop(),n.trys.pop();continue}m=t.call(i,n)}catch(A){m=[6,A],h=0}finally{d=o=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}},v=q&&q.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(q,"__esModule",{value:!0}),q.useWebSocket=void 0;var f=N,_=tt,S=$(),E=vt(),c=Et(),s=v(_t()),u=Be(),a=function(i,t,n){t===void 0&&(t=S.DEFAULT_OPTIONS),n===void 0&&(n=!0);var d=(0,f.useState)(null),h=d[0],o=d[1],b=(0,f.useState)({}),R=b[0],k=b[1],m=(0,f.useMemo)(function(){if(!t.disableJson&&h)try{return JSON.parse(h.data)}catch{return S.UNPARSABLE_JSON_OBJECT}return null},[h,t.disableJson]),A=(0,f.useRef)(null),I=(0,f.useRef)(null),fe=(0,f.useRef)(function(){}),de=(0,f.useRef)(0),Pe=(0,f.useRef)(Date.now()),ge=(0,f.useRef)([]),H=(0,f.useRef)(null),j=(0,f.useRef)(t);j.current=t;var J=A.current&&R[A.current]!==void 0?R[A.current]:i!==null&&n===!0?S.ReadyState.CONNECTING:S.ReadyState.UNINSTANTIATED,ee=t.queryParams?JSON.stringify(t.queryParams):null,B=(0,f.useCallback)(function(D,U){var Y;if(U===void 0&&(U=!0),S.isEventSourceSupported&&I.current instanceof EventSource){console.warn("Unable to send a message from an eventSource");return}((Y=I.current)===null||Y===void 0?void 0:Y.readyState)===S.ReadyState.OPEN?((0,u.assertIsWebSocket)(I.current,j.current.skipAssert),I.current.send(D)):U&&ge.current.push(D)},[]),Oe=(0,f.useCallback)(function(D,U){U===void 0&&(U=!0),B(JSON.stringify(D),U)},[B]),pe=(0,f.useCallback)(function(){return j.current.share!==!0||S.isEventSourceSupported&&I.current instanceof EventSource?I.current:(H.current===null&&I.current&&((0,u.assertIsWebSocket)(I.current,j.current.skipAssert),H.current=(0,s.default)(I.current,fe)),H.current)},[]);return(0,f.useEffect)(function(){if(i!==null&&n===!0){var D,U=!1,Y=!0,ve=function(){return y(void 0,void 0,void 0,function(){var re,Z,me;return O(this,function(ce){switch(ce.label){case 0:return re=A,[4,(0,c.getUrl)(i,j)];case 1:return re.current=ce.sent(),A.current===null?(console.error("Failed to get a valid URL. WebSocket connection aborted."),A.current="ABORTED",(0,_.flushSync)(function(){return k(function(K){return r(r({},K),{ABORTED:S.ReadyState.CLOSED})})}),[2]):(Z=function(K){U||(0,_.flushSync)(function(){return o(K)})},me=function(K){U||(0,_.flushSync)(function(){return k(function(ie){var te;return r(r({},ie),A.current&&(te={},te[A.current]=K,te))})})},Y&&(D=(0,E.createOrJoinSocket)(I,A.current,me,j,Z,fe,de,Pe,B)),[2])}})})};return fe.current=function(){U||(H.current&&(H.current=null),D?.(),ve())},ve(),function(){U=!0,Y=!1,H.current&&(H.current=null),D?.(),o(null)}}else(i===null||n===!1)&&(de.current=0,k(function(re){var Z;return r(r({},re),A.current&&(Z={},Z[A.current]=S.ReadyState.CLOSED,Z))}))},[i,n,ee,B]),(0,f.useEffect)(function(){J===S.ReadyState.OPEN&&ge.current.splice(0).forEach(function(D){B(D)})},[J]),{sendMessage:B,sendJsonMessage:Oe,lastMessage:h,lastJsonMessage:m,readyState:J,getWebSocket:pe}};return q.useWebSocket=a,q}var oe={},Cr;function yt(){if(Cr)return oe;Cr=1;var r=oe&&oe.__assign||function(){return r=Object.assign||function(E){for(var c,s=1,u=arguments.length;s<u;s++){c=arguments[s];for(var a in c)Object.prototype.hasOwnProperty.call(c,a)&&(E[a]=c[a])}return E},r.apply(this,arguments)};Object.defineProperty(oe,"__esModule",{value:!0}),oe.useSocketIO=void 0;var y=N,O=Ye(),v=$(),f={type:"empty",payload:null},_=function(E){if(!E||!E.data)return f;var c=E.data.match(/\[.*]/);if(!c)return f;var s=JSON.parse(c);return!Array.isArray(s)||!s[1]?f:{type:s[0],payload:s[1]}},S=function(E,c,s){c===void 0&&(c=v.DEFAULT_OPTIONS),s===void 0&&(s=!0);var u=(0,y.useMemo)(function(){return r(r({},c),{fromSocketIO:!0})},[]),a=(0,O.useWebSocket)(E,u,s),i=a.sendMessage,t=a.sendJsonMessage,n=a.lastMessage,d=a.readyState,h=a.getWebSocket,o=(0,y.useMemo)(function(){return _(n)},[n]);return{sendMessage:i,sendJsonMessage:t,lastMessage:o,lastJsonMessage:o,readyState:d,getWebSocket:h}};return oe.useSocketIO=S,oe}var z={},Rr;function St(){if(Rr)return z;Rr=1;var r=z&&z.__assign||function(){return r=Object.assign||function(S){for(var E,c=1,s=arguments.length;c<s;c++){E=arguments[c];for(var u in E)Object.prototype.hasOwnProperty.call(E,u)&&(S[u]=E[u])}return S},r.apply(this,arguments)},y=z&&z.__rest||function(S,E){var c={};for(var s in S)Object.prototype.hasOwnProperty.call(S,s)&&E.indexOf(s)<0&&(c[s]=S[s]);if(S!=null&&typeof Object.getOwnPropertySymbols=="function")for(var u=0,s=Object.getOwnPropertySymbols(S);u<s.length;u++)E.indexOf(s[u])<0&&Object.prototype.propertyIsEnumerable.call(S,s[u])&&(c[s[u]]=S[s[u]]);return c};Object.defineProperty(z,"__esModule",{value:!0}),z.useEventSource=void 0;var O=N,v=Ye(),f=$(),_=function(S,E,c){E===void 0&&(E=f.DEFAULT_EVENT_SOURCE_OPTIONS);var s=E.withCredentials,u=E.events,a=y(E,["withCredentials","events"]);c===void 0&&(c=!0);var i=r(r({},a),{eventSourceOptions:{withCredentials:s}}),t=(0,O.useRef)(f.EMPTY_EVENT_HANDLERS);u&&(t.current=u);var n=(0,v.useWebSocket)(S,i,c),d=n.lastMessage,h=n.readyState,o=n.getWebSocket;return(0,O.useEffect)(function(){d?.type&&Object.entries(t.current).forEach(function(b){var R=b[0],k=b[1];R===d.type&&k(d)})},[d]),{lastEvent:d,readyState:h,getEventSource:o}};return z.useEventSource=_,z}var wr;function ht(){return wr||(wr=1,(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.resetGlobalState=r.useEventSource=r.ReadyState=r.useSocketIO=r.default=void 0;var y=Ye();Object.defineProperty(r,"default",{enumerable:!0,get:function(){return y.useWebSocket}});var O=yt();Object.defineProperty(r,"useSocketIO",{enumerable:!0,get:function(){return O.useSocketIO}});var v=$();Object.defineProperty(r,"ReadyState",{enumerable:!0,get:function(){return v.ReadyState}});var f=St();Object.defineProperty(r,"useEventSource",{enumerable:!0,get:function(){return f.useEventSource}});var _=Be();Object.defineProperty(r,"resetGlobalState",{enumerable:!0,get:function(){return _.resetGlobalState}})})(je)),je}var bt=ht();const gt=nt(bt),V={DEPOSIT:"deposit",TRANS_CODE:"transCode",ERROR:"error",UPDATE_MEMBER:"update_member",MAINTAIN_NOTICE:"maintain_notice",MAINTAIN_NOTICE_MEMBER:"maintain_notice_member",RELOAD:"reload",TRANSFER_IN_GAME:"transfer_in_game",CHECK_REQUEST:"CHECK_RREQUEST",CASH_REGISTER_LIMIT:"cash_register_limit"},Ot=3e4,pt=({socketUrl:r,socketHandlers:y={},options:O={}})=>{const v=N.useRef(!1),f=N.useRef(y),{sendMessage:_,sendJsonMessage:S,lastMessage:E,readyState:c}=gt(r,{queryParams:{key:"wsky"},onOpen:()=>console.log("連線成功"),shouldReconnect:()=>v.current===!1,reconnectAttempts:9999,reconnectInterval:1e3,...O}),s=N.useMemo(()=>{try{return JSON.parse(E?.data)}catch{return null}},[E?.data]);return N.useEffect(()=>{const u=setInterval(()=>_("ping"),Ot);return()=>clearInterval(u)},[_]),N.useEffect(()=>{f.current=y},[y]),N.useEffect(()=>{if(!s)return;const{onDeposit:u,onTransCode:a,onError:i,onUpdateMember:t,onMaintainNotice:n,onMaintainNoticeMember:d,onReload:h,onTransferInGame:o,onCashRegisterLimit:b}=f.current,R=we.get(s,"type",""),k={memberInfoUid:we.get(s,"member_info_uid",null),data:we.get(s,"data",null),memo:we.get(s,"memo",null)};switch(R){case V.DEPOSIT:u?.(k);break;case V.TRANS_CODE:a?.(k);break;case V.ERROR:i?.(k);break;case V.UPDATE_MEMBER:t?.(k);break;case V.MAINTAIN_NOTICE:n?.(k);break;case V.MAINTAIN_NOTICE_MEMBER:d?.(k);break;case V.RELOAD:h?.(k);break;case V.TRANSFER_IN_GAME:case V.CHECK_REQUEST:o?.(k);break;case V.CASH_REGISTER_LIMIT:b?.(k);break;default:console.warn("Unknown socket type:",R);break}},[s]),N.useEffect(()=>()=>v.current=!0,[]),{sendMessage:_,sendJsonMessage:S,readyState:c}},kr=()=>{const{client:r}=be(),y=N.useCallback(async()=>{const{data:v}=await r.get("/carousels");return v},[r]),O=N.useCallback(async()=>await r.get("/marquees"),[r]);return{commonCarouselApi:y,commonMarqueeApi:O}},mt=()=>{const{commonCarouselApi:r}=kr();return X.useQuery({queryKey:["getCarouselList"],queryFn:async()=>await r()})},Tt=()=>{const{commonMarqueeApi:r}=kr();return X.useQuery({queryKey:["getMarqueeList"],queryFn:async()=>r(),select:y=>y.Marquees})},Ct=({refetchInterval:r=5e4,trigger:y=[],enabled:O=!0}={})=>{const{getToken:v}=be(),{userInfoApi:f}=Je(),_=X.useQueries({queries:[{queryKey:["getMemberInfo",...y],queryFn:async()=>await f(),refetchInterval:r,enabled:!!v&&O}]}),{data:S,isFetching:E,error:c}=_[0]||{};return{data:S,isFetching:E,error:c}},Rt=({enabled:r=!0}={})=>{const{userInfoApi:y,userFavoriteGameApi:O,userGameListApi:v}=Je(),f=X.useQuery({queryKey:["getMemInfo"],queryFn:async()=>y(),enabled:r}),_=X.useQuery({queryKey:["getFavoriteGame"],queryFn:async()=>O(),enabled:r&&f.isSuccess}),S=X.useQuery({queryKey:["getUserGameList"],queryFn:async()=>v(),enabled:r&&f.isSuccess&&_.isSuccess});return[f,_,S]};exports.ApiCtx=Ge;exports.ApiProvider=it;exports.createLogoutHandler=st;exports.useApiContext=be;exports.useBalanceGetter=lt;exports.useClientWebSocket=pt;exports.useGetCarouseList=mt;exports.useGetMarquee=Tt;exports.useGetMemberInfo=Ct;exports.useInitializeWithToken=Rt;
|
package/dist/index.js
CHANGED
|
@@ -11,21 +11,21 @@ var vr;
|
|
|
11
11
|
function dt() {
|
|
12
12
|
if (vr) return Ee;
|
|
13
13
|
vr = 1;
|
|
14
|
-
var r = be,
|
|
15
|
-
function
|
|
14
|
+
var r = be, y = Symbol.for("react.element"), O = Symbol.for("react.fragment"), d = Object.prototype.hasOwnProperty, f = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, _ = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
15
|
+
function S(E, c, s) {
|
|
16
16
|
var o, a = {}, i = null, t = null;
|
|
17
17
|
s !== void 0 && (i = "" + s), c.key !== void 0 && (i = "" + c.key), c.ref !== void 0 && (t = c.ref);
|
|
18
18
|
for (o in c) d.call(c, o) && !_.hasOwnProperty(o) && (a[o] = c[o]);
|
|
19
19
|
if (E && E.defaultProps) for (o in c = E.defaultProps, c) a[o] === void 0 && (a[o] = c[o]);
|
|
20
|
-
return { $$typeof:
|
|
20
|
+
return { $$typeof: y, type: E, key: i, ref: t, props: a, _owner: f.current };
|
|
21
21
|
}
|
|
22
|
-
return Ee.Fragment = O, Ee.jsx =
|
|
22
|
+
return Ee.Fragment = O, Ee.jsx = S, Ee.jsxs = S, Ee;
|
|
23
23
|
}
|
|
24
24
|
var _e = {};
|
|
25
25
|
var dr;
|
|
26
26
|
function Et() {
|
|
27
27
|
return dr || (dr = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
28
|
-
var r = be,
|
|
28
|
+
var r = be, y = Symbol.for("react.element"), O = Symbol.for("react.portal"), d = Symbol.for("react.fragment"), f = Symbol.for("react.strict_mode"), _ = Symbol.for("react.profiler"), S = Symbol.for("react.provider"), E = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), s = Symbol.for("react.suspense"), o = Symbol.for("react.suspense_list"), a = Symbol.for("react.memo"), i = Symbol.for("react.lazy"), t = Symbol.for("react.offscreen"), n = Symbol.iterator, v = "@@iterator";
|
|
29
29
|
function h(e) {
|
|
30
30
|
if (e === null || typeof e != "object")
|
|
31
31
|
return null;
|
|
@@ -53,7 +53,7 @@ function Et() {
|
|
|
53
53
|
var P = !1, p = !1, A = !1, k = !1, le = !1, fe;
|
|
54
54
|
fe = Symbol.for("react.module.reference");
|
|
55
55
|
function Ne(e) {
|
|
56
|
-
return !!(typeof e == "string" || typeof e == "function" || e === d || e === _ || le || e === f || e === s || e === o || k || e === t || P || p || A || typeof e == "object" && e !== null && (e.$$typeof === i || e.$$typeof === a || e.$$typeof ===
|
|
56
|
+
return !!(typeof e == "string" || typeof e == "function" || e === d || e === _ || le || e === f || e === s || e === o || k || e === t || P || p || A || typeof e == "object" && e !== null && (e.$$typeof === i || e.$$typeof === a || e.$$typeof === S || e.$$typeof === E || e.$$typeof === c || // This needs to include all possible module reference object
|
|
57
57
|
// types supported by any Flight configuration anywhere since
|
|
58
58
|
// we don't know which Flight build this will end up being used
|
|
59
59
|
// with.
|
|
@@ -95,7 +95,7 @@ function Et() {
|
|
|
95
95
|
case E:
|
|
96
96
|
var l = e;
|
|
97
97
|
return J(l) + ".Consumer";
|
|
98
|
-
case
|
|
98
|
+
case S:
|
|
99
99
|
var g = e;
|
|
100
100
|
return J(g._context) + ".Provider";
|
|
101
101
|
case c:
|
|
@@ -403,7 +403,7 @@ function Et() {
|
|
|
403
403
|
var Kr = function(e, l, g, m, w, I, C) {
|
|
404
404
|
var T = {
|
|
405
405
|
// This tag allows us to uniquely identify this as a React Element
|
|
406
|
-
$$typeof:
|
|
406
|
+
$$typeof: y,
|
|
407
407
|
// Built-in properties that belong on the element
|
|
408
408
|
type: e,
|
|
409
409
|
key: l,
|
|
@@ -458,7 +458,7 @@ function Et() {
|
|
|
458
458
|
var De;
|
|
459
459
|
De = !1;
|
|
460
460
|
function je(e) {
|
|
461
|
-
return typeof e == "object" && e !== null && e.$$typeof ===
|
|
461
|
+
return typeof e == "object" && e !== null && e.$$typeof === y;
|
|
462
462
|
}
|
|
463
463
|
function or() {
|
|
464
464
|
{
|
|
@@ -567,7 +567,7 @@ Check the top-level render call using <` + g + ">.");
|
|
|
567
567
|
var U = Qr();
|
|
568
568
|
U ? T += U : T += or();
|
|
569
569
|
var N;
|
|
570
|
-
e === null ? N = "null" : Me(e) ? N = "array" : e !== void 0 && e.$$typeof ===
|
|
570
|
+
e === null ? N = "null" : Me(e) ? N = "array" : e !== void 0 && e.$$typeof === y ? (N = "<" + (D(e.type) || "Unknown") + " />", T = " Did you accidentally export a JSX literal instead of a component?") : N = typeof e, b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", N, T);
|
|
571
571
|
}
|
|
572
572
|
var M = xr(e, l, g, w, I);
|
|
573
573
|
if (M == null)
|
|
@@ -625,31 +625,31 @@ const Nr = ut(null), ke = () => {
|
|
|
625
625
|
};
|
|
626
626
|
function yt({
|
|
627
627
|
baseURL: r,
|
|
628
|
-
getToken:
|
|
628
|
+
getToken: y,
|
|
629
629
|
timeoutMs: O = 15e3,
|
|
630
630
|
lng: d = "tw",
|
|
631
631
|
store: f,
|
|
632
632
|
onError: _
|
|
633
633
|
} = {}) {
|
|
634
|
-
const
|
|
634
|
+
const S = lt.create({
|
|
635
635
|
baseURL: r,
|
|
636
636
|
timeout: O,
|
|
637
637
|
headers: { "Content-Type": "application/json" }
|
|
638
638
|
});
|
|
639
|
-
return
|
|
640
|
-
if (E.headers = E.headers || {},
|
|
641
|
-
const s = await
|
|
639
|
+
return S.interceptors.request.use(async (E) => {
|
|
640
|
+
if (E.headers = E.headers || {}, y) {
|
|
641
|
+
const s = await y();
|
|
642
642
|
s && (E.headers.Authorization = `Bearer ${s}`);
|
|
643
643
|
}
|
|
644
644
|
const c = f?.getState()?.isWalletCurrency;
|
|
645
645
|
return E.headers.Currency = c, E.headers["currency-code"] = c, E.headers.lang = d, E;
|
|
646
|
-
}),
|
|
646
|
+
}), S.interceptors.response.use(
|
|
647
647
|
(E) => E.data,
|
|
648
|
-
(E) => _ ? _(E, { instance:
|
|
649
|
-
),
|
|
648
|
+
(E) => _ ? _(E, { instance: S }) : Promise.reject(E)
|
|
649
|
+
), S;
|
|
650
650
|
}
|
|
651
|
-
function Mt({ children: r, ...
|
|
652
|
-
const O = He(() => yt(
|
|
651
|
+
function Mt({ children: r, ...y }) {
|
|
652
|
+
const O = He(() => yt(y), [y]), f = He(
|
|
653
653
|
() => new it({
|
|
654
654
|
defaultOptions: {
|
|
655
655
|
queries: {
|
|
@@ -660,31 +660,31 @@ function Mt({ children: r, ...S }) {
|
|
|
660
660
|
}),
|
|
661
661
|
[]
|
|
662
662
|
);
|
|
663
|
-
return /* @__PURE__ */ _r.jsx(st, { client: f, children: /* @__PURE__ */ _r.jsx(Nr.Provider, { value: { client: O, ...
|
|
663
|
+
return /* @__PURE__ */ _r.jsx(st, { client: f, children: /* @__PURE__ */ _r.jsx(Nr.Provider, { value: { client: O, ...y }, children: r }) });
|
|
664
664
|
}
|
|
665
665
|
const Lt = () => {
|
|
666
|
-
const r = (d, f) => !d && !f,
|
|
666
|
+
const r = (d, f) => !d && !f, y = (d) => d.startsWith("pc.");
|
|
667
667
|
return {
|
|
668
668
|
executeLogout: ({
|
|
669
669
|
isCallBackInvalid: d = !1,
|
|
670
670
|
hostname: f = "",
|
|
671
671
|
shouldRedirect: _,
|
|
672
|
-
onShowError:
|
|
672
|
+
onShowError: S,
|
|
673
673
|
onCleanup: E,
|
|
674
674
|
onRemoveToken: c,
|
|
675
675
|
onRedirect: s,
|
|
676
676
|
onGoogleLogout: o
|
|
677
677
|
}) => {
|
|
678
|
-
const a =
|
|
679
|
-
r(d, a) &&
|
|
678
|
+
const a = y(f);
|
|
679
|
+
r(d, a) && S?.(), E?.(), c?.(), _ && s?.("/"), o?.();
|
|
680
680
|
},
|
|
681
681
|
shouldShowErrorNotice: r,
|
|
682
|
-
isMachineDomain:
|
|
682
|
+
isMachineDomain: y
|
|
683
683
|
};
|
|
684
684
|
}, Ve = () => {
|
|
685
|
-
const { client: r } = ke(),
|
|
686
|
-
async (
|
|
687
|
-
const { mac_address: E = "", app_version: c = "", anydesk_id: s = "" } =
|
|
685
|
+
const { client: r } = ke(), y = oe(
|
|
686
|
+
async (S) => {
|
|
687
|
+
const { mac_address: E = "", app_version: c = "", anydesk_id: s = "" } = S, { data: o } = await r.post("/cash-register/login", {
|
|
688
688
|
mac_address: E,
|
|
689
689
|
app_version: c,
|
|
690
690
|
anydesk_id: s
|
|
@@ -694,20 +694,20 @@ const Lt = () => {
|
|
|
694
694
|
[r]
|
|
695
695
|
), O = oe(async () => r.get("/member/getMemberInfo"), [r]), d = oe(async () => await r.get("member/getGameList"), [r]), f = oe(async () => await r.get("/member/getNowCurrencyExchange"), [r]), _ = oe(async () => await r.get("member/getFavoriteGame"), [r]);
|
|
696
696
|
return {
|
|
697
|
-
machineLoginApi:
|
|
697
|
+
machineLoginApi: y,
|
|
698
698
|
userInfoApi: O,
|
|
699
699
|
userGameListApi: d,
|
|
700
700
|
userFavoriteGameApi: _,
|
|
701
701
|
userCurrencyExchangeApi: f
|
|
702
702
|
};
|
|
703
|
-
}, Dt = ({ otherQueryKey: r = [], options:
|
|
704
|
-
const { userCurrencyExchangeApi: O } = Ve(), { getToken: d } = ke(), { enabled: f, ..._ } =
|
|
703
|
+
}, Dt = ({ otherQueryKey: r = [], options: y = {} } = {}) => {
|
|
704
|
+
const { userCurrencyExchangeApi: O } = Ve(), { getToken: d } = ke(), { enabled: f, ..._ } = y, S = !!d && (f ? f.every((E) => E) : !0);
|
|
705
705
|
return kr({
|
|
706
706
|
queries: [
|
|
707
707
|
{
|
|
708
708
|
queryKey: ["userCurrencyExchange", ...r],
|
|
709
709
|
queryFn: () => O(),
|
|
710
|
-
enabled:
|
|
710
|
+
enabled: S,
|
|
711
711
|
// ← 使用合併後的條件
|
|
712
712
|
..._
|
|
713
713
|
// ← 不包含 enabled
|
|
@@ -719,7 +719,7 @@ var We = {}, F = {}, Fe = {}, yr;
|
|
|
719
719
|
function V() {
|
|
720
720
|
return yr || (yr = 1, (function(r) {
|
|
721
721
|
Object.defineProperty(r, "__esModule", { value: !0 }), r.isEventSourceSupported = r.isReactNative = r.ReadyState = r.DEFAULT_HEARTBEAT = r.UNPARSABLE_JSON_OBJECT = r.DEFAULT_RECONNECT_INTERVAL_MS = r.DEFAULT_RECONNECT_LIMIT = r.SOCKET_IO_PING_CODE = r.SOCKET_IO_PATH = r.SOCKET_IO_PING_INTERVAL = r.DEFAULT_EVENT_SOURCE_OPTIONS = r.EMPTY_EVENT_HANDLERS = r.DEFAULT_OPTIONS = void 0;
|
|
722
|
-
var
|
|
722
|
+
var y = 1, O = 1e3 * y;
|
|
723
723
|
r.DEFAULT_OPTIONS = {}, r.EMPTY_EVENT_HANDLERS = {}, r.DEFAULT_EVENT_SOURCE_OPTIONS = {
|
|
724
724
|
withCredentials: !1,
|
|
725
725
|
events: r.EMPTY_EVENT_HANDLERS
|
|
@@ -746,23 +746,23 @@ var ye = {}, qe = {}, Sr;
|
|
|
746
746
|
function $e() {
|
|
747
747
|
return Sr || (Sr = 1, (function(r) {
|
|
748
748
|
Object.defineProperty(r, "__esModule", { value: !0 }), r.resetWebSockets = r.sharedWebSockets = void 0, r.sharedWebSockets = {};
|
|
749
|
-
var
|
|
749
|
+
var y = function(O) {
|
|
750
750
|
if (O && r.sharedWebSockets.hasOwnProperty(O))
|
|
751
751
|
delete r.sharedWebSockets[O];
|
|
752
752
|
else
|
|
753
753
|
for (var d in r.sharedWebSockets)
|
|
754
754
|
r.sharedWebSockets.hasOwnProperty(d) && delete r.sharedWebSockets[d];
|
|
755
755
|
};
|
|
756
|
-
r.resetWebSockets =
|
|
756
|
+
r.resetWebSockets = y;
|
|
757
757
|
})(qe)), qe;
|
|
758
758
|
}
|
|
759
759
|
var te = {}, K = {}, hr;
|
|
760
760
|
function Be() {
|
|
761
761
|
if (hr) return K;
|
|
762
762
|
hr = 1, Object.defineProperty(K, "__esModule", { value: !0 }), K.setUpSocketIOPing = K.appendQueryParams = K.parseSocketIOUrl = void 0;
|
|
763
|
-
var r = V(),
|
|
763
|
+
var r = V(), y = function(f) {
|
|
764
764
|
if (f) {
|
|
765
|
-
var _ = /^https|wss/.test(f),
|
|
765
|
+
var _ = /^https|wss/.test(f), S = f.replace(/^(https?|wss?)(:\/\/)?/, ""), E = S.replace(/\/$/, ""), c = _ ? "wss" : "ws";
|
|
766
766
|
return "".concat(c, "://").concat(E).concat(r.SOCKET_IO_PATH);
|
|
767
767
|
} else if (f === "") {
|
|
768
768
|
var _ = /^https/.test(window.location.protocol), c = _ ? "wss" : "ws", s = window.location.port ? ":".concat(window.location.port) : "";
|
|
@@ -770,10 +770,10 @@ function Be() {
|
|
|
770
770
|
}
|
|
771
771
|
return f;
|
|
772
772
|
};
|
|
773
|
-
K.parseSocketIOUrl =
|
|
773
|
+
K.parseSocketIOUrl = y;
|
|
774
774
|
var O = function(f, _) {
|
|
775
775
|
_ === void 0 && (_ = {});
|
|
776
|
-
var
|
|
776
|
+
var S = /\?([\w]+=[\w]+)/, E = S.test(f), c = "".concat(Object.entries(_).reduce(function(s, o) {
|
|
777
777
|
var a = o[0], i = o[1];
|
|
778
778
|
return s + "".concat(a, "=").concat(i, "&");
|
|
779
779
|
}, "").slice(0, -1));
|
|
@@ -782,10 +782,10 @@ function Be() {
|
|
|
782
782
|
K.appendQueryParams = O;
|
|
783
783
|
var d = function(f, _) {
|
|
784
784
|
_ === void 0 && (_ = r.SOCKET_IO_PING_INTERVAL);
|
|
785
|
-
var
|
|
785
|
+
var S = function() {
|
|
786
786
|
return f(r.SOCKET_IO_PING_CODE);
|
|
787
787
|
};
|
|
788
|
-
return window.setInterval(
|
|
788
|
+
return window.setInterval(S, _);
|
|
789
789
|
};
|
|
790
790
|
return K.setUpSocketIOPing = d, K;
|
|
791
791
|
}
|
|
@@ -794,14 +794,14 @@ function Mr() {
|
|
|
794
794
|
if (br) return Ie;
|
|
795
795
|
br = 1, Object.defineProperty(Ie, "__esModule", { value: !0 }), Ie.heartbeat = O;
|
|
796
796
|
var r = V();
|
|
797
|
-
function
|
|
797
|
+
function y(d) {
|
|
798
798
|
return Array.isArray(d) ? d.reduce(function(f, _) {
|
|
799
799
|
return f.current > _.current ? f : _;
|
|
800
800
|
}).current : d.current;
|
|
801
801
|
}
|
|
802
802
|
function O(d, f, _) {
|
|
803
|
-
var
|
|
804
|
-
var h = Date.now(), u =
|
|
803
|
+
var S = _ || {}, E = S.interval, c = E === void 0 ? r.DEFAULT_HEARTBEAT.interval : E, s = S.timeout, o = s === void 0 ? r.DEFAULT_HEARTBEAT.timeout : s, a = S.message, i = a === void 0 ? r.DEFAULT_HEARTBEAT.message : a, t = Math.max(100, c / 10), n = Date.now(), v = setInterval(function() {
|
|
804
|
+
var h = Date.now(), u = y(f);
|
|
805
805
|
if (u + o <= h)
|
|
806
806
|
console.warn("Heartbeat timed out, closing connection, last message received ".concat(h - u, "ms ago, last ping sent ").concat(h - n, "ms ago")), d.close();
|
|
807
807
|
else if (u + c <= h && n + c <= h)
|
|
@@ -822,29 +822,29 @@ var Se = {}, Ge = {}, gr;
|
|
|
822
822
|
function Ye() {
|
|
823
823
|
return gr || (gr = 1, (function(r) {
|
|
824
824
|
Object.defineProperty(r, "__esModule", { value: !0 }), r.resetSubscribers = r.removeSubscriber = r.addSubscriber = r.hasSubscribers = r.getSubscribers = void 0;
|
|
825
|
-
var
|
|
826
|
-
return (0, r.hasSubscribers)(c) ? Array.from(
|
|
825
|
+
var y = {}, O = [], d = function(c) {
|
|
826
|
+
return (0, r.hasSubscribers)(c) ? Array.from(y[c]) : O;
|
|
827
827
|
};
|
|
828
828
|
r.getSubscribers = d;
|
|
829
829
|
var f = function(c) {
|
|
830
830
|
var s;
|
|
831
|
-
return ((s =
|
|
831
|
+
return ((s = y[c]) === null || s === void 0 ? void 0 : s.size) > 0;
|
|
832
832
|
};
|
|
833
833
|
r.hasSubscribers = f;
|
|
834
834
|
var _ = function(c, s) {
|
|
835
|
-
|
|
835
|
+
y[c] = y[c] || /* @__PURE__ */ new Set(), y[c].add(s);
|
|
836
836
|
};
|
|
837
837
|
r.addSubscriber = _;
|
|
838
|
-
var
|
|
839
|
-
|
|
838
|
+
var S = function(c, s) {
|
|
839
|
+
y[c].delete(s);
|
|
840
840
|
};
|
|
841
|
-
r.removeSubscriber =
|
|
841
|
+
r.removeSubscriber = S;
|
|
842
842
|
var E = function(c) {
|
|
843
|
-
if (c &&
|
|
844
|
-
delete
|
|
843
|
+
if (c && y.hasOwnProperty(c))
|
|
844
|
+
delete y[c];
|
|
845
845
|
else
|
|
846
|
-
for (var s in
|
|
847
|
-
|
|
846
|
+
for (var s in y)
|
|
847
|
+
y.hasOwnProperty(s) && delete y[s];
|
|
848
848
|
};
|
|
849
849
|
r.resetSubscribers = E;
|
|
850
850
|
})(Ge)), Ge;
|
|
@@ -853,13 +853,13 @@ var Or;
|
|
|
853
853
|
function Ke() {
|
|
854
854
|
if (Or) return Se;
|
|
855
855
|
Or = 1, Object.defineProperty(Se, "__esModule", { value: !0 }), Se.assertIsWebSocket = O, Se.resetGlobalState = d;
|
|
856
|
-
var r = $e(),
|
|
856
|
+
var r = $e(), y = Ye();
|
|
857
857
|
function O(f, _) {
|
|
858
858
|
if (!_ && !(f instanceof WebSocket))
|
|
859
859
|
throw new Error("");
|
|
860
860
|
}
|
|
861
861
|
function d(f) {
|
|
862
|
-
(0,
|
|
862
|
+
(0, y.resetSubscribers)(f), (0, r.resetWebSockets)(f);
|
|
863
863
|
}
|
|
864
864
|
return Se;
|
|
865
865
|
}
|
|
@@ -877,12 +877,12 @@ function St() {
|
|
|
877
877
|
}, r.apply(this, arguments);
|
|
878
878
|
};
|
|
879
879
|
Object.defineProperty(te, "__esModule", { value: !0 }), te.attachListeners = void 0;
|
|
880
|
-
var
|
|
880
|
+
var y = Be(), O = Mr(), d = V(), f = Ke(), _ = function(o, a, i, t) {
|
|
881
881
|
o.onmessage = function(n) {
|
|
882
882
|
var v;
|
|
883
883
|
a.current.onMessage && a.current.onMessage(n), typeof t?.current == "number" && (t.current = Date.now()), !(typeof a.current.filter == "function" && a.current.filter(n) !== !0) && (a.current.heartbeat && typeof a.current.heartbeat != "boolean" && ((v = a.current.heartbeat) === null || v === void 0 ? void 0 : v.returnMessage) === n.data || i(n));
|
|
884
884
|
};
|
|
885
|
-
},
|
|
885
|
+
}, S = function(o, a, i, t, n) {
|
|
886
886
|
o.onopen = function(v) {
|
|
887
887
|
if (a.current.onOpen && a.current.onOpen(v), t.current = 0, i(d.ReadyState.OPEN), a.current.heartbeat && o instanceof WebSocket) {
|
|
888
888
|
var h = typeof a.current.heartbeat == "boolean" ? void 0 : a.current.heartbeat;
|
|
@@ -927,7 +927,7 @@ function St() {
|
|
|
927
927
|
};
|
|
928
928
|
}, s = function(o, a, i, t, n, v, h) {
|
|
929
929
|
var u = a.setLastMessage, b = a.setReadyState, R, P, p;
|
|
930
|
-
return i.current.fromSocketIO && (R = (0,
|
|
930
|
+
return i.current.fromSocketIO && (R = (0, y.setUpSocketIOPing)(h)), _(o, i, u, v), S(o, i, b, n, v), P = E(o, i, b, t, n), p = c(o, i, b, t, n), function() {
|
|
931
931
|
b(d.ReadyState.CLOSING), P(), p(), o.close(), R && clearInterval(R);
|
|
932
932
|
};
|
|
933
933
|
};
|
|
@@ -947,7 +947,7 @@ function ht() {
|
|
|
947
947
|
}, r.apply(this, arguments);
|
|
948
948
|
};
|
|
949
949
|
Object.defineProperty(ne, "__esModule", { value: !0 }), ne.attachSharedListeners = void 0;
|
|
950
|
-
var
|
|
950
|
+
var y = $e(), O = V(), d = Ye(), f = Be(), _ = Mr(), S = function(a, i, t) {
|
|
951
951
|
a.onmessage = function(n) {
|
|
952
952
|
(0, d.getSubscribers)(i).forEach(function(v) {
|
|
953
953
|
var h;
|
|
@@ -967,7 +967,7 @@ function ht() {
|
|
|
967
967
|
a instanceof WebSocket && (a.onclose = function(t) {
|
|
968
968
|
(0, d.getSubscribers)(i).forEach(function(n) {
|
|
969
969
|
n.optionsRef.current.onClose && n.optionsRef.current.onClose(t), n.setReadyState(O.ReadyState.CLOSED);
|
|
970
|
-
}), delete
|
|
970
|
+
}), delete y.sharedWebSockets[i], (0, d.getSubscribers)(i).forEach(function(n) {
|
|
971
971
|
var v;
|
|
972
972
|
if (n.optionsRef.current.shouldReconnect && n.optionsRef.current.shouldReconnect(t)) {
|
|
973
973
|
var h = (v = n.optionsRef.current.reconnectAttempts) !== null && v !== void 0 ? v : O.DEFAULT_RECONNECT_LIMIT;
|
|
@@ -989,7 +989,7 @@ function ht() {
|
|
|
989
989
|
};
|
|
990
990
|
}, o = function(a, i, t, n) {
|
|
991
991
|
var v;
|
|
992
|
-
return t.current.fromSocketIO && (v = (0, f.setUpSocketIOPing)(n)),
|
|
992
|
+
return t.current.fromSocketIO && (v = (0, f.setUpSocketIOPing)(n)), S(a, i, t.current.heartbeat), c(a, i), E(a, i, t.current.heartbeat), s(a, i), function() {
|
|
993
993
|
v && clearInterval(v);
|
|
994
994
|
};
|
|
995
995
|
};
|
|
@@ -999,25 +999,25 @@ var Tr;
|
|
|
999
999
|
function bt() {
|
|
1000
1000
|
if (Tr) return ye;
|
|
1001
1001
|
Tr = 1, Object.defineProperty(ye, "__esModule", { value: !0 }), ye.createOrJoinSocket = void 0;
|
|
1002
|
-
var r = $e(),
|
|
1002
|
+
var r = $e(), y = V(), O = St(), d = ht(), f = Ye(), _ = function(E, c, s, o, a) {
|
|
1003
1003
|
return function() {
|
|
1004
1004
|
if ((0, f.removeSubscriber)(E, c), !(0, f.hasSubscribers)(E)) {
|
|
1005
1005
|
try {
|
|
1006
1006
|
var i = r.sharedWebSockets[E];
|
|
1007
1007
|
i instanceof WebSocket && (i.onclose = function(t) {
|
|
1008
|
-
s.current.onClose && s.current.onClose(t), o(
|
|
1008
|
+
s.current.onClose && s.current.onClose(t), o(y.ReadyState.CLOSED);
|
|
1009
1009
|
}), i.close();
|
|
1010
1010
|
} catch {
|
|
1011
1011
|
}
|
|
1012
1012
|
a && a(), delete r.sharedWebSockets[E];
|
|
1013
1013
|
}
|
|
1014
1014
|
};
|
|
1015
|
-
},
|
|
1016
|
-
if (!
|
|
1017
|
-
throw
|
|
1015
|
+
}, S = function(E, c, s, o, a, i, t, n, v) {
|
|
1016
|
+
if (!y.isEventSourceSupported && o.current.eventSourceOptions)
|
|
1017
|
+
throw y.isReactNative ? new Error("EventSource is not supported in ReactNative") : new Error("EventSource is not supported");
|
|
1018
1018
|
if (o.current.share) {
|
|
1019
1019
|
var h = null;
|
|
1020
|
-
r.sharedWebSockets[c] === void 0 ? (r.sharedWebSockets[c] = o.current.eventSourceOptions ? new EventSource(c, o.current.eventSourceOptions) : new WebSocket(c, o.current.protocols), E.current = r.sharedWebSockets[c], s(
|
|
1020
|
+
r.sharedWebSockets[c] === void 0 ? (r.sharedWebSockets[c] = o.current.eventSourceOptions ? new EventSource(c, o.current.eventSourceOptions) : new WebSocket(c, o.current.protocols), E.current = r.sharedWebSockets[c], s(y.ReadyState.CONNECTING), h = (0, d.attachSharedListeners)(r.sharedWebSockets[c], c, o, v)) : (E.current = r.sharedWebSockets[c], s(r.sharedWebSockets[c].readyState));
|
|
1021
1021
|
var u = {
|
|
1022
1022
|
setLastMessage: a,
|
|
1023
1023
|
setReadyState: s,
|
|
@@ -1028,7 +1028,7 @@ function bt() {
|
|
|
1028
1028
|
};
|
|
1029
1029
|
return (0, f.addSubscriber)(c, u), _(c, u, o, s, h);
|
|
1030
1030
|
} else {
|
|
1031
|
-
if (E.current = o.current.eventSourceOptions ? new EventSource(c, o.current.eventSourceOptions) : new WebSocket(c, o.current.protocols), s(
|
|
1031
|
+
if (E.current = o.current.eventSourceOptions ? new EventSource(c, o.current.eventSourceOptions) : new WebSocket(c, o.current.protocols), s(y.ReadyState.CONNECTING), !E.current)
|
|
1032
1032
|
throw new Error("WebSocket failed to be created");
|
|
1033
1033
|
return (0, O.attachListeners)(E.current, {
|
|
1034
1034
|
setLastMessage: a,
|
|
@@ -1036,12 +1036,12 @@ function bt() {
|
|
|
1036
1036
|
}, o, i.current, t, n, v);
|
|
1037
1037
|
}
|
|
1038
1038
|
};
|
|
1039
|
-
return ye.createOrJoinSocket =
|
|
1039
|
+
return ye.createOrJoinSocket = S, ye;
|
|
1040
1040
|
}
|
|
1041
1041
|
var x = {}, Cr;
|
|
1042
1042
|
function gt() {
|
|
1043
1043
|
return Cr || (Cr = 1, (function(r) {
|
|
1044
|
-
var
|
|
1044
|
+
var y = x && x.__awaiter || function(c, s, o, a) {
|
|
1045
1045
|
function i(t) {
|
|
1046
1046
|
return t instanceof o ? t : new o(function(n) {
|
|
1047
1047
|
n(t);
|
|
@@ -1132,14 +1132,14 @@ function gt() {
|
|
|
1132
1132
|
return c.concat(t || Array.prototype.slice.call(s));
|
|
1133
1133
|
};
|
|
1134
1134
|
Object.defineProperty(r, "__esModule", { value: !0 }), r.getUrl = void 0;
|
|
1135
|
-
var f = Be(), _ = V(),
|
|
1135
|
+
var f = Be(), _ = V(), S = function(c) {
|
|
1136
1136
|
return new Promise(function(s) {
|
|
1137
1137
|
return window.setTimeout(s, c);
|
|
1138
1138
|
});
|
|
1139
1139
|
}, E = function(c, s) {
|
|
1140
1140
|
for (var o = [], a = 2; a < arguments.length; a++)
|
|
1141
1141
|
o[a - 2] = arguments[a];
|
|
1142
|
-
return
|
|
1142
|
+
return y(void 0, d([c, s], o, !0), void 0, function(i, t, n) {
|
|
1143
1143
|
var v, h, u, b, R, P, p, A;
|
|
1144
1144
|
return n === void 0 && (n = 0), O(this, function(k) {
|
|
1145
1145
|
switch (k.label) {
|
|
@@ -1151,7 +1151,7 @@ function gt() {
|
|
|
1151
1151
|
case 2:
|
|
1152
1152
|
return v = k.sent(), [3, 9];
|
|
1153
1153
|
case 3:
|
|
1154
|
-
return k.sent(), t.current.retryOnError ? (h = (P = t.current.reconnectAttempts) !== null && P !== void 0 ? P : _.DEFAULT_RECONNECT_LIMIT, n < h ? (u = typeof t.current.reconnectInterval == "function" ? t.current.reconnectInterval(n) : t.current.reconnectInterval, [4,
|
|
1154
|
+
return k.sent(), t.current.retryOnError ? (h = (P = t.current.reconnectAttempts) !== null && P !== void 0 ? P : _.DEFAULT_RECONNECT_LIMIT, n < h ? (u = typeof t.current.reconnectInterval == "function" ? t.current.reconnectInterval(n) : t.current.reconnectInterval, [4, S(u ?? _.DEFAULT_RECONNECT_INTERVAL_MS)]) : [3, 5]) : [3, 7];
|
|
1155
1155
|
case 4:
|
|
1156
1156
|
return k.sent(), [2, (0, r.getUrl)(i, t, n + 1)];
|
|
1157
1157
|
case 5:
|
|
@@ -1179,19 +1179,19 @@ var Je = {}, Rr;
|
|
|
1179
1179
|
function Ot() {
|
|
1180
1180
|
return Rr || (Rr = 1, (function(r) {
|
|
1181
1181
|
Object.defineProperty(r, "__esModule", { value: !0 }), r.websocketWrapper = void 0;
|
|
1182
|
-
var
|
|
1182
|
+
var y = function(O, d) {
|
|
1183
1183
|
return new Proxy(O, {
|
|
1184
1184
|
get: function(f, _) {
|
|
1185
|
-
var
|
|
1186
|
-
return _ === "reconnect" ? d : typeof
|
|
1187
|
-
}) :
|
|
1185
|
+
var S = f[_];
|
|
1186
|
+
return _ === "reconnect" ? d : typeof S == "function" ? (console.error("Calling methods directly on the websocket is not supported at this moment. You must use the methods returned by useWebSocket."), function() {
|
|
1187
|
+
}) : S;
|
|
1188
1188
|
},
|
|
1189
|
-
set: function(f, _,
|
|
1190
|
-
return /^on/.test(_) ? (console.warn("The websocket's event handlers should be defined through the options object passed into useWebSocket."), !1) : (f[_] =
|
|
1189
|
+
set: function(f, _, S) {
|
|
1190
|
+
return /^on/.test(_) ? (console.warn("The websocket's event handlers should be defined through the options object passed into useWebSocket."), !1) : (f[_] = S, !0);
|
|
1191
1191
|
}
|
|
1192
1192
|
});
|
|
1193
1193
|
};
|
|
1194
|
-
r.websocketWrapper =
|
|
1194
|
+
r.websocketWrapper = y, r.default = r.websocketWrapper;
|
|
1195
1195
|
})(Je)), Je;
|
|
1196
1196
|
}
|
|
1197
1197
|
var wr;
|
|
@@ -1206,7 +1206,7 @@ function xe() {
|
|
|
1206
1206
|
}
|
|
1207
1207
|
return i;
|
|
1208
1208
|
}, r.apply(this, arguments);
|
|
1209
|
-
},
|
|
1209
|
+
}, y = F && F.__awaiter || function(i, t, n, v) {
|
|
1210
1210
|
function h(u) {
|
|
1211
1211
|
return u instanceof n ? u : new n(function(b) {
|
|
1212
1212
|
b(u);
|
|
@@ -1295,35 +1295,35 @@ function xe() {
|
|
|
1295
1295
|
return i && i.__esModule ? i : { default: i };
|
|
1296
1296
|
};
|
|
1297
1297
|
Object.defineProperty(F, "__esModule", { value: !0 }), F.useWebSocket = void 0;
|
|
1298
|
-
var f = be, _ = ft,
|
|
1299
|
-
t === void 0 && (t =
|
|
1298
|
+
var f = be, _ = ft, S = V(), E = bt(), c = gt(), s = d(Ot()), o = Ke(), a = function(i, t, n) {
|
|
1299
|
+
t === void 0 && (t = S.DEFAULT_OPTIONS), n === void 0 && (n = !0);
|
|
1300
1300
|
var v = (0, f.useState)(null), h = v[0], u = v[1], b = (0, f.useState)({}), R = b[0], P = b[1], p = (0, f.useMemo)(function() {
|
|
1301
1301
|
if (!t.disableJson && h)
|
|
1302
1302
|
try {
|
|
1303
1303
|
return JSON.parse(h.data);
|
|
1304
1304
|
} catch {
|
|
1305
|
-
return
|
|
1305
|
+
return S.UNPARSABLE_JSON_OBJECT;
|
|
1306
1306
|
}
|
|
1307
1307
|
return null;
|
|
1308
1308
|
}, [h, t.disableJson]), A = (0, f.useRef)(null), k = (0, f.useRef)(null), le = (0, f.useRef)(function() {
|
|
1309
1309
|
}), fe = (0, f.useRef)(0), Ne = (0, f.useRef)(Date.now()), ge = (0, f.useRef)([]), J = (0, f.useRef)(null), D = (0, f.useRef)(t);
|
|
1310
1310
|
D.current = t;
|
|
1311
|
-
var G = A.current && R[A.current] !== void 0 ? R[A.current] : i !== null && n === !0 ?
|
|
1311
|
+
var G = A.current && R[A.current] !== void 0 ? R[A.current] : i !== null && n === !0 ? S.ReadyState.CONNECTING : S.ReadyState.UNINSTANTIATED, X = t.queryParams ? JSON.stringify(t.queryParams) : null, $ = (0, f.useCallback)(function(L, j) {
|
|
1312
1312
|
var B;
|
|
1313
|
-
if (j === void 0 && (j = !0),
|
|
1313
|
+
if (j === void 0 && (j = !0), S.isEventSourceSupported && k.current instanceof EventSource) {
|
|
1314
1314
|
console.warn("Unable to send a message from an eventSource");
|
|
1315
1315
|
return;
|
|
1316
1316
|
}
|
|
1317
|
-
((B = k.current) === null || B === void 0 ? void 0 : B.readyState) ===
|
|
1317
|
+
((B = k.current) === null || B === void 0 ? void 0 : B.readyState) === S.ReadyState.OPEN ? ((0, o.assertIsWebSocket)(k.current, D.current.skipAssert), k.current.send(L)) : j && ge.current.push(L);
|
|
1318
1318
|
}, []), Oe = (0, f.useCallback)(function(L, j) {
|
|
1319
1319
|
j === void 0 && (j = !0), $(JSON.stringify(L), j);
|
|
1320
1320
|
}, [$]), me = (0, f.useCallback)(function() {
|
|
1321
|
-
return D.current.share !== !0 ||
|
|
1321
|
+
return D.current.share !== !0 || S.isEventSourceSupported && k.current instanceof EventSource ? k.current : (J.current === null && k.current && ((0, o.assertIsWebSocket)(k.current, D.current.skipAssert), J.current = (0, s.default)(k.current, le)), J.current);
|
|
1322
1322
|
}, []);
|
|
1323
1323
|
return (0, f.useEffect)(function() {
|
|
1324
1324
|
if (i !== null && n === !0) {
|
|
1325
1325
|
var L, j = !1, B = !0, ve = function() {
|
|
1326
|
-
return
|
|
1326
|
+
return y(void 0, void 0, void 0, function() {
|
|
1327
1327
|
var Z, z, pe;
|
|
1328
1328
|
return O(this, function(ue) {
|
|
1329
1329
|
switch (ue.label) {
|
|
@@ -1332,7 +1332,7 @@ function xe() {
|
|
|
1332
1332
|
case 1:
|
|
1333
1333
|
return Z.current = ue.sent(), A.current === null ? (console.error("Failed to get a valid URL. WebSocket connection aborted."), A.current = "ABORTED", (0, _.flushSync)(function() {
|
|
1334
1334
|
return P(function(Y) {
|
|
1335
|
-
return r(r({}, Y), { ABORTED:
|
|
1335
|
+
return r(r({}, Y), { ABORTED: S.ReadyState.CLOSED });
|
|
1336
1336
|
});
|
|
1337
1337
|
}), [
|
|
1338
1338
|
2
|
|
@@ -1363,10 +1363,10 @@ function xe() {
|
|
|
1363
1363
|
};
|
|
1364
1364
|
} else (i === null || n === !1) && (fe.current = 0, P(function(Z) {
|
|
1365
1365
|
var z;
|
|
1366
|
-
return r(r({}, Z), A.current && (z = {}, z[A.current] =
|
|
1366
|
+
return r(r({}, Z), A.current && (z = {}, z[A.current] = S.ReadyState.CLOSED, z));
|
|
1367
1367
|
}));
|
|
1368
1368
|
}, [i, n, X, $]), (0, f.useEffect)(function() {
|
|
1369
|
-
G ===
|
|
1369
|
+
G === S.ReadyState.OPEN && ge.current.splice(0).forEach(function(L) {
|
|
1370
1370
|
$(L);
|
|
1371
1371
|
});
|
|
1372
1372
|
}, [G]), {
|
|
@@ -1394,7 +1394,7 @@ function mt() {
|
|
|
1394
1394
|
}, r.apply(this, arguments);
|
|
1395
1395
|
};
|
|
1396
1396
|
Object.defineProperty(ae, "__esModule", { value: !0 }), ae.useSocketIO = void 0;
|
|
1397
|
-
var
|
|
1397
|
+
var y = be, O = xe(), d = V(), f = {
|
|
1398
1398
|
type: "empty",
|
|
1399
1399
|
payload: null
|
|
1400
1400
|
}, _ = function(E) {
|
|
@@ -1408,11 +1408,11 @@ function mt() {
|
|
|
1408
1408
|
type: s[0],
|
|
1409
1409
|
payload: s[1]
|
|
1410
1410
|
};
|
|
1411
|
-
},
|
|
1411
|
+
}, S = function(E, c, s) {
|
|
1412
1412
|
c === void 0 && (c = d.DEFAULT_OPTIONS), s === void 0 && (s = !0);
|
|
1413
|
-
var o = (0,
|
|
1413
|
+
var o = (0, y.useMemo)(function() {
|
|
1414
1414
|
return r(r({}, c), { fromSocketIO: !0 });
|
|
1415
|
-
}, []), a = (0, O.useWebSocket)(E, o, s), i = a.sendMessage, t = a.sendJsonMessage, n = a.lastMessage, v = a.readyState, h = a.getWebSocket, u = (0,
|
|
1415
|
+
}, []), a = (0, O.useWebSocket)(E, o, s), i = a.sendMessage, t = a.sendJsonMessage, n = a.lastMessage, v = a.readyState, h = a.getWebSocket, u = (0, y.useMemo)(function() {
|
|
1416
1416
|
return _(n);
|
|
1417
1417
|
}, [n]);
|
|
1418
1418
|
return {
|
|
@@ -1424,38 +1424,38 @@ function mt() {
|
|
|
1424
1424
|
getWebSocket: h
|
|
1425
1425
|
};
|
|
1426
1426
|
};
|
|
1427
|
-
return ae.useSocketIO =
|
|
1427
|
+
return ae.useSocketIO = S, ae;
|
|
1428
1428
|
}
|
|
1429
1429
|
var Q = {}, Pr;
|
|
1430
1430
|
function pt() {
|
|
1431
1431
|
if (Pr) return Q;
|
|
1432
1432
|
Pr = 1;
|
|
1433
1433
|
var r = Q && Q.__assign || function() {
|
|
1434
|
-
return r = Object.assign || function(
|
|
1434
|
+
return r = Object.assign || function(S) {
|
|
1435
1435
|
for (var E, c = 1, s = arguments.length; c < s; c++) {
|
|
1436
1436
|
E = arguments[c];
|
|
1437
|
-
for (var o in E) Object.prototype.hasOwnProperty.call(E, o) && (
|
|
1437
|
+
for (var o in E) Object.prototype.hasOwnProperty.call(E, o) && (S[o] = E[o]);
|
|
1438
1438
|
}
|
|
1439
|
-
return
|
|
1439
|
+
return S;
|
|
1440
1440
|
}, r.apply(this, arguments);
|
|
1441
|
-
},
|
|
1441
|
+
}, y = Q && Q.__rest || function(S, E) {
|
|
1442
1442
|
var c = {};
|
|
1443
|
-
for (var s in
|
|
1444
|
-
if (
|
|
1445
|
-
for (var o = 0, s = Object.getOwnPropertySymbols(
|
|
1446
|
-
E.indexOf(s[o]) < 0 && Object.prototype.propertyIsEnumerable.call(
|
|
1443
|
+
for (var s in S) Object.prototype.hasOwnProperty.call(S, s) && E.indexOf(s) < 0 && (c[s] = S[s]);
|
|
1444
|
+
if (S != null && typeof Object.getOwnPropertySymbols == "function")
|
|
1445
|
+
for (var o = 0, s = Object.getOwnPropertySymbols(S); o < s.length; o++)
|
|
1446
|
+
E.indexOf(s[o]) < 0 && Object.prototype.propertyIsEnumerable.call(S, s[o]) && (c[s[o]] = S[s[o]]);
|
|
1447
1447
|
return c;
|
|
1448
1448
|
};
|
|
1449
1449
|
Object.defineProperty(Q, "__esModule", { value: !0 }), Q.useEventSource = void 0;
|
|
1450
|
-
var O = be, d = xe(), f = V(), _ = function(
|
|
1450
|
+
var O = be, d = xe(), f = V(), _ = function(S, E, c) {
|
|
1451
1451
|
E === void 0 && (E = f.DEFAULT_EVENT_SOURCE_OPTIONS);
|
|
1452
|
-
var s = E.withCredentials, o = E.events, a =
|
|
1452
|
+
var s = E.withCredentials, o = E.events, a = y(E, ["withCredentials", "events"]);
|
|
1453
1453
|
c === void 0 && (c = !0);
|
|
1454
1454
|
var i = r(r({}, a), { eventSourceOptions: {
|
|
1455
1455
|
withCredentials: s
|
|
1456
1456
|
} }), t = (0, O.useRef)(f.EMPTY_EVENT_HANDLERS);
|
|
1457
1457
|
o && (t.current = o);
|
|
1458
|
-
var n = (0, d.useWebSocket)(
|
|
1458
|
+
var n = (0, d.useWebSocket)(S, i, c), v = n.lastMessage, h = n.readyState, u = n.getWebSocket;
|
|
1459
1459
|
return (0, O.useEffect)(function() {
|
|
1460
1460
|
v?.type && Object.entries(t.current).forEach(function(b) {
|
|
1461
1461
|
var R = b[0], P = b[1];
|
|
@@ -1473,9 +1473,9 @@ var Ir;
|
|
|
1473
1473
|
function Tt() {
|
|
1474
1474
|
return Ir || (Ir = 1, (function(r) {
|
|
1475
1475
|
Object.defineProperty(r, "__esModule", { value: !0 }), r.resetGlobalState = r.useEventSource = r.ReadyState = r.useSocketIO = r.default = void 0;
|
|
1476
|
-
var
|
|
1476
|
+
var y = xe();
|
|
1477
1477
|
Object.defineProperty(r, "default", { enumerable: !0, get: function() {
|
|
1478
|
-
return
|
|
1478
|
+
return y.useWebSocket;
|
|
1479
1479
|
} });
|
|
1480
1480
|
var O = mt();
|
|
1481
1481
|
Object.defineProperty(r, "useSocketIO", { enumerable: !0, get: function() {
|
|
@@ -1509,13 +1509,13 @@ const Rt = /* @__PURE__ */ vt(Ct), H = {
|
|
|
1509
1509
|
CASH_REGISTER_LIMIT: "cash_register_limit"
|
|
1510
1510
|
}, wt = 3e4, jt = ({
|
|
1511
1511
|
socketUrl: r,
|
|
1512
|
-
socketHandlers:
|
|
1512
|
+
socketHandlers: y = {},
|
|
1513
1513
|
options: O = {}
|
|
1514
1514
|
}) => {
|
|
1515
|
-
const d = fr(!1), f = fr(
|
|
1515
|
+
const d = fr(!1), f = fr(y), {
|
|
1516
1516
|
sendMessage: _,
|
|
1517
1517
|
// 發送普通訊息
|
|
1518
|
-
sendJsonMessage:
|
|
1518
|
+
sendJsonMessage: S,
|
|
1519
1519
|
// 發送 JSON 訊息
|
|
1520
1520
|
lastMessage: E,
|
|
1521
1521
|
// 最後接收到的訊息
|
|
@@ -1544,8 +1544,8 @@ const Rt = /* @__PURE__ */ vt(Ct), H = {
|
|
|
1544
1544
|
);
|
|
1545
1545
|
return () => clearInterval(o);
|
|
1546
1546
|
}, [_]), we(() => {
|
|
1547
|
-
f.current =
|
|
1548
|
-
}, [
|
|
1547
|
+
f.current = y;
|
|
1548
|
+
}, [y]), we(() => {
|
|
1549
1549
|
if (!s) return;
|
|
1550
1550
|
const {
|
|
1551
1551
|
onDeposit: o,
|
|
@@ -1597,16 +1597,16 @@ const Rt = /* @__PURE__ */ vt(Ct), H = {
|
|
|
1597
1597
|
}
|
|
1598
1598
|
}, [s]), we(() => () => d.current = !0, []), {
|
|
1599
1599
|
sendMessage: _,
|
|
1600
|
-
sendJsonMessage:
|
|
1600
|
+
sendJsonMessage: S,
|
|
1601
1601
|
readyState: c
|
|
1602
1602
|
// WebSocket 連線狀態
|
|
1603
1603
|
};
|
|
1604
1604
|
}, Lr = () => {
|
|
1605
|
-
const { client: r } = ke(),
|
|
1605
|
+
const { client: r } = ke(), y = oe(async () => {
|
|
1606
1606
|
const { data: d } = await r.get("/carousels");
|
|
1607
1607
|
return d;
|
|
1608
1608
|
}, [r]), O = oe(async () => await r.get("/marquees"), [r]);
|
|
1609
|
-
return { commonCarouselApi:
|
|
1609
|
+
return { commonCarouselApi: y, commonMarqueeApi: O };
|
|
1610
1610
|
}, Ut = () => {
|
|
1611
1611
|
const { commonCarouselApi: r } = Lr();
|
|
1612
1612
|
return he({
|
|
@@ -1617,39 +1617,40 @@ const Rt = /* @__PURE__ */ vt(Ct), H = {
|
|
|
1617
1617
|
const { commonMarqueeApi: r } = Lr();
|
|
1618
1618
|
return he({
|
|
1619
1619
|
queryKey: ["getMarqueeList"],
|
|
1620
|
-
queryFn: async () => r()
|
|
1620
|
+
queryFn: async () => r(),
|
|
1621
|
+
select: (y) => y.Marquees
|
|
1621
1622
|
});
|
|
1622
1623
|
}, Ft = ({
|
|
1623
1624
|
refetchInterval: r = 5e4,
|
|
1624
|
-
trigger:
|
|
1625
|
+
trigger: y = [],
|
|
1625
1626
|
enabled: O = !0
|
|
1626
1627
|
} = {}) => {
|
|
1627
1628
|
const { getToken: d } = ke(), { userInfoApi: f } = Ve(), _ = kr({
|
|
1628
1629
|
queries: [
|
|
1629
1630
|
{
|
|
1630
|
-
queryKey: ["getMemberInfo", ...
|
|
1631
|
+
queryKey: ["getMemberInfo", ...y],
|
|
1631
1632
|
queryFn: async () => await f(),
|
|
1632
1633
|
refetchInterval: r,
|
|
1633
1634
|
enabled: !!d && O
|
|
1634
1635
|
}
|
|
1635
1636
|
]
|
|
1636
|
-
}), { data:
|
|
1637
|
-
return { data:
|
|
1637
|
+
}), { data: S, isFetching: E, error: c } = _[0] || {};
|
|
1638
|
+
return { data: S, isFetching: E, error: c };
|
|
1638
1639
|
}, qt = ({ enabled: r = !0 } = {}) => {
|
|
1639
|
-
const { userInfoApi:
|
|
1640
|
+
const { userInfoApi: y, userFavoriteGameApi: O, userGameListApi: d } = Ve(), f = he({
|
|
1640
1641
|
queryKey: ["getMemInfo"],
|
|
1641
|
-
queryFn: async () =>
|
|
1642
|
+
queryFn: async () => y(),
|
|
1642
1643
|
enabled: r
|
|
1643
1644
|
}), _ = he({
|
|
1644
1645
|
queryKey: ["getFavoriteGame"],
|
|
1645
1646
|
queryFn: async () => O(),
|
|
1646
1647
|
enabled: r && f.isSuccess
|
|
1647
|
-
}),
|
|
1648
|
+
}), S = he({
|
|
1648
1649
|
queryKey: ["getUserGameList"],
|
|
1649
1650
|
queryFn: async () => d(),
|
|
1650
1651
|
enabled: r && f.isSuccess && _.isSuccess
|
|
1651
1652
|
});
|
|
1652
|
-
return [f, _,
|
|
1653
|
+
return [f, _, S];
|
|
1653
1654
|
};
|
|
1654
1655
|
export {
|
|
1655
1656
|
Nr as ApiCtx,
|