Files
to_session/text/3.65.22_0/scripts/ui/chunk-JDQYOLFK.js
Administrator a0720d80dc fefdwef
2025-11-12 12:54:37 +08:00

8 lines
7.5 KiB
JavaScript

import{d as ce}from"./chunk-IQIV3LGC.js";import{a as fe}from"./chunk-TBMS7TSB.js";import{a as q,b as se,c as b,d as T}from"./chunk-Q3FZPIYZ.js";import{$ as oe,ia as $,ib as ie}from"./chunk-ZASBKUPD.js";import{c as L,e as Ne}from"./chunk-Z36WOTFJ.js";import{ka as re}from"./chunk-TUSK34X6.js";import{H as Ce,y as B}from"./chunk-SQMXULWT.js";import{G as ae,o as ne}from"./chunk-GQZAGQSC.js";import{j as Y,ra as Te}from"./chunk-GSIHKWLV.js";import{o as v,q as g}from"./chunk-QTLWQ5AJ.js";v();g();Te();Ce();v();g();v();g();function C(){return C=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},C.apply(this,arguments)}v();g();function j(e){return e.charAt(0)==="/"}function K(e,t){for(var o=t,n=o+1,a=e.length;n<a;o+=1,n+=1)e[o]=e[n];e.pop()}function be(e,t){t===void 0&&(t="");var o=e&&e.split("/")||[],n=t&&t.split("/")||[],a=e&&j(e),s=t&&j(t),i=a||s;if(e&&j(e)?n=o:o.length&&(n.pop(),n=n.concat(o)),!n.length)return"/";var d;if(n.length){var c=n[n.length-1];d=c==="."||c===".."||c===""}else d=!1;for(var u=0,f=n.length;f>=0;f--){var y=n[f];y==="."?K(n,f):y===".."?(K(n,f),u++):u&&(K(n,f),u--)}if(!i)for(;u--;u)n.unshift("..");i&&n[0]!==""&&(!n[0]||!j(n[0]))&&n.unshift("");var w=n.join("/");return d&&w.substr(-1)!=="/"&&(w+="/"),w}var ue=be;v();g();v();g();var Se=!0,he="Invariant failed";function He(e,t){if(!e)throw Se?new Error(he):new Error(he+": "+(t||""))}var de=He;function W(e){return e.charAt(0)==="/"?e:"/"+e}function le(e){return e.charAt(0)==="/"?e.substr(1):e}function ke(e,t){return e.toLowerCase().indexOf(t.toLowerCase())===0&&"/?#".indexOf(e.charAt(t.length))!==-1}function Me(e,t){return ke(e,t)?e.substr(t.length):e}function Ie(e){return e.charAt(e.length-1)==="/"?e.slice(0,-1):e}function Re(e){var t=e||"/",o="",n="",a=t.indexOf("#");a!==-1&&(n=t.substr(a),t=t.substr(0,a));var s=t.indexOf("?");return s!==-1&&(o=t.substr(s),t=t.substr(0,s)),{pathname:t,search:o==="?"?"":o,hash:n==="#"?"":n}}function P(e){var t=e.pathname,o=e.search,n=e.hash,a=t||"/";return o&&o!=="?"&&(a+=o.charAt(0)==="?"?o:"?"+o),n&&n!=="#"&&(a+=n.charAt(0)==="#"?n:"#"+n),a}function Z(e,t,o,n){var a;typeof e=="string"?(a=Re(e),a.state=t):(a=C({},e),a.pathname===void 0&&(a.pathname=""),a.search?a.search.charAt(0)!=="?"&&(a.search="?"+a.search):a.search="",a.hash?a.hash.charAt(0)!=="#"&&(a.hash="#"+a.hash):a.hash="",t!==void 0&&a.state===void 0&&(a.state=t));try{a.pathname=decodeURI(a.pathname)}catch(s){throw s instanceof URIError?new URIError('Pathname "'+a.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):s}return o&&(a.key=o),n?a.pathname?a.pathname.charAt(0)!=="/"&&(a.pathname=ue(a.pathname,n.pathname)):a.pathname=n.pathname:a.pathname||(a.pathname="/"),a}function De(){var e=null;function t(i){return e=i,function(){e===i&&(e=null)}}function o(i,d,c,u){if(e!=null){var f=typeof e=="function"?e(i,d):e;typeof f=="string"?typeof c=="function"?c(f,u):u(!0):u(f!==!1)}else u(!0)}var n=[];function a(i){var d=!0;function c(){d&&i.apply(void 0,arguments)}return n.push(c),function(){d=!1,n=n.filter(function(u){return u!==c})}}function s(){for(var i=arguments.length,d=new Array(i),c=0;c<i;c++)d[c]=arguments[c];n.forEach(function(u){return u.apply(void 0,d)})}return{setPrompt:t,confirmTransitionTo:o,appendListener:a,notifyListeners:s}}var Ue=!!(typeof window<"u"&&window.document&&window.document.createElement);function Ve(e,t){t(window.confirm(e))}function Be(){return window.navigator.userAgent.indexOf("Firefox")===-1}var pe="hashchange",$e={hashbang:{encodePath:function(t){return t.charAt(0)==="!"?t:"!/"+le(t)},decodePath:function(t){return t.charAt(0)==="!"?t.substr(1):t}},noslash:{encodePath:le,decodePath:W},slash:{encodePath:W,decodePath:W}};function ve(e){var t=e.indexOf("#");return t===-1?e:e.slice(0,t)}function H(){var e=window.location.href,t=e.indexOf("#");return t===-1?"":e.substring(t+1)}function je(e){window.location.hash=e}function z(e){window.location.replace(ve(window.location.href)+"#"+e)}function ge(e){e===void 0&&(e={}),Ue||de(!1);var t=window.history,o=Be(),n=e,a=n.getUserConfirmation,s=a===void 0?Ve:a,i=n.hashType,d=i===void 0?"slash":i,c=e.basename?Ie(W(e.basename)):"",u=$e[d],f=u.encodePath,y=u.decodePath;function w(){var r=y(H());return c&&(r=Me(r,c)),Z(r)}var E=De();function O(r){C(m,r),m.length=t.length,E.notifyListeners(m.location,m.action)}var M=!1,I=null;function me(r,h){return r.pathname===h.pathname&&r.search===h.search&&r.hash===h.hash}function J(){var r=H(),h=f(r);if(r!==h)z(h);else{var l=w(),p=m.location;if(!M&&me(p,l)||I===P(l))return;I=null,we(l)}}function we(r){if(M)M=!1,O();else{var h="POP";E.confirmTransitionTo(r,h,s,function(l){l?O({action:h,location:r}):ye(r)})}}function ye(r){var h=m.location,l=x.lastIndexOf(P(h));l===-1&&(l=0);var p=x.lastIndexOf(P(r));p===-1&&(p=0);var _=l-p;_&&(M=!0,R(_))}var Q=H(),X=f(Q);Q!==X&&z(X);var ee=w(),x=[P(ee)];function Ee(r){var h=document.querySelector("base"),l="";return h&&h.getAttribute("href")&&(l=ve(window.location.href)),l+"#"+f(c+P(r))}function Pe(r,h){var l="PUSH",p=Z(r,void 0,void 0,m.location);E.confirmTransitionTo(p,l,s,function(_){if(!!_){var A=P(p),N=f(c+A),G=H()!==N;if(G){I=A,je(N);var V=x.lastIndexOf(P(m.location)),te=x.slice(0,V+1);te.push(A),x=te,O({action:l,location:p})}else O()}})}function Oe(r,h){var l="REPLACE",p=Z(r,void 0,void 0,m.location);E.confirmTransitionTo(p,l,s,function(_){if(!!_){var A=P(p),N=f(c+A),G=H()!==N;G&&(I=A,z(N));var V=x.indexOf(P(m.location));V!==-1&&(x[V]=A),O({action:l,location:p})}})}function R(r){t.go(r)}function xe(){R(-1)}function Ae(){R(1)}var F=0;function D(r){F+=r,F===1&&r===1?window.addEventListener(pe,J):F===0&&window.removeEventListener(pe,J)}var U=!1;function _e(r){r===void 0&&(r=!1);var h=E.setPrompt(r);return U||(D(1),U=!0),function(){return U&&(U=!1,D(-1)),h()}}function Le(r){var h=E.appendListener(r);return D(1),function(){D(-1),h()}}var m={length:t.length,action:"POP",location:ee,createHref:Ee,push:Pe,replace:Oe,go:R,goBack:xe,goForward:Ae,block:_e,listen:Le};return m}Ne();var k=ge(),We=async e=>{let t={pass:!0};if(await L().getServerWalletTypeByWalletId(e)!==re.MPC_WALLET)return t;let n=await L().getMpcIdByWalletId(e);if(!n)return t;let a=!1;try{a=await L().accountCheck(n)}catch{a=!1}let s=b.FROZEN,i=T.ESCAPE,{data:d}=await ce([{mpcId:n}]);return s=Y(d,"[0].accountStatus",s),i=Y(d,"[0].mpcStatus",i),{pass:s===b.NORMAL&&i!==T.ESCAPE&&i!==T.RECOVER&&a,accountStatus:s,mpcStatus:i,loginStatus:a,walletId:e}},Et=async({callback:e,walletId:t}={})=>{try{let o=await L().getSelectedWallet(),n=t||o,{pass:a,accountStatus:s,mpcStatus:i,loginStatus:d}=await We(n);if(a)return!0;let c=async()=>{let O=B("wallet_common_okx_link");await L().setMpcAction(q.VERIFY,n),globalThis.open(`https://${O}${se}`),window.close()},u={},f=ne.prompt(u),y,w,E={};switch(d||(y=async()=>{e&&e(),await c(),f.destroyAll()},k.location.pathname.includes(oe)||(w=()=>{e&&e(),k.replace($),f.destroyAll()},E={cancelText:B("extension_wallet_error_toast_btn_switch_wallet")})),!0){case i===T.RECOVER:y=()=>{e&&e(),k.replace(`${ie}?action=${q.RECOVER}&walletId=${n}`),f.destroyAll()},w=()=>{e&&e(),k.replace($),f.destroyAll()};break;case i===T.ESCAPE:case s===b.FROZEN:case s===b.DELETE:y=()=>{e&&e(),k.replace($),f.destroyAll()};break;default:break}return u=fe({accountStatus:s,mpcStatus:i,loginStatus:d},{onConfirm:y,onCancel:w,...E}),f.update(u),!1}catch{return ae.error({title:B("extension_wallet_error_toast_signature_failed")}),!1}};export{Et as a};
window.inOKXExtension = true;
window.inMiniApp = false;
window.ASSETS_BUILD_TYPE = "publish";
//# sourceMappingURL=chunk-JDQYOLFK.js.map