(function () { 'use strict'; function isBridgeReady() { return window.flutter_inappwebview && typeof window.flutter_inappwebview.callHandler === 'function'; } function callHandler(name, args) { if (!isBridgeReady()) return undefined; try { if (args !== undefined) { return window.flutter_inappwebview.callHandler(name, args); } return window.flutter_inappwebview.callHandler(name); } catch (e) { return undefined; } } function callHandlerSafe(name, args) { if (!isBridgeReady()) return; try { if (args !== undefined) { window.flutter_inappwebview.callHandler(name, args); } else { window.flutter_inappwebview.callHandler(name); } } catch (e) { } } async function getToken() { if (!isBridgeReady()) throw new Error('Bridge not ready'); try { const token = await window.flutter_inappwebview.callHandler('getToken'); if (token) return token; throw new Error('Bridge not ready'); } catch (e) { throw new Error('Bridge not ready'); } } async function getActivityId() { if (!isBridgeReady()) throw new Error('Bridge not ready'); try { const result = await window.flutter_inappwebview.callHandler('getActivityId'); return result || ''; } catch (e) { return ''; } } async function getLocalTime(timestamp) { // if (!isBridgeReady()) throw new Error('Bridge not ready'); try { return await window.flutter_inappwebview.callHandler('getLocalTime', timestamp); } catch (e) { return timestamp || ''; } } function closeWebview() { callHandlerSafe('closeWebview'); } function jumpToLogin() { callHandlerSafe('jumpToLogin'); } function jumpToDeposit() { callHandlerSafe('jumpToDeposit'); } function showToast(message) { callHandlerSafe('showToast', message); } function showInviteView(params) { callHandlerSafe('showInviteView', params); } function goRouterName(path) { callHandlerSafe('goRouterName', { path: path }); } window.BEXBridge = { isBridgeReady: isBridgeReady, callHandler: callHandler, callHandlerSafe: callHandlerSafe, getToken: getToken, getActivityId: getActivityId, getLocalTime: getLocalTime, closeWebview: closeWebview, jumpToLogin: jumpToLogin, jumpToDeposit: jumpToDeposit, showToast: showToast, showInviteView: showInviteView, goRouterName: goRouterName }; })();