"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.navigateToConfiguredWebview=exports.isJumpFeatureEnabled=exports.getWebviewUrlPath=exports.getJumpConfig=exports.JUMP_FEATURES=void 0;var JUMP_FEATURES={CARD:"card",FLOATING_CARD:"floatingCard",AD_FLOATING:"adFloating",LOTTERY_TICKET:"lotteryTicket",LIVE_BONUS_LOTTERY_TICKET:"liveBonusLotteryTicket",LIVE_BONUS_CASH_WITHDRAW:"liveBonusCashWithdraw",IMAGE_TEXT_LINK:"imageTextLink",ANNOUNCEMENT_LINK:"announcementLink",RICH_TEXT_LINK:"richTextLink",LUCKYMONEY_WITHDRAWAL:"luckymoneyWithdrawal"};exports.JUMP_FEATURES=JUMP_FEATURES;var normalizeFeatureList=function(e){return Array.isArray(e)&&e.length?e.filter(Boolean).map(String):null},getJumpConfig=function(e){var r,t;return((null==e||null===(r=e.store)||void 0===r||null===(t=r.get)||void 0===t?void 0:t.call(r,"mainInfo.options"))||{}).jumpConfig||{}};exports.getJumpConfig=getJumpConfig;var getWebviewUrlPath=function(e){var r=getJumpConfig(e);return String(r.webviewUrlPath||"").trim()};exports.getWebviewUrlPath=getWebviewUrlPath;var isJumpFeatureEnabled=function(e,r){if(!getWebviewUrlPath(e)||!r)return!1;var t=normalizeFeatureList(getJumpConfig(e).features);return!t||t.includes(r)};exports.isJumpFeatureEnabled=isJumpFeatureEnabled;var navigateToConfiguredWebview=function(e,r,t){var i=String(t||"").trim(),n=getWebviewUrlPath(e);if(!i||!isJumpFeatureEnabled(e,r))return!1;var a=n.includes("?")?"&":"?";return wx.navigateTo({url:"".concat(n).concat(a,"url=").concat(encodeURIComponent(i)),success:function(){var t;null==e||null===(t=e.reportTea)||void 0===t||t.call(e,"mini_sdk_external_link_jump_success",{feature:r,targetUrl:i,webviewUrlPath:n})},fail:function(t){var a;null==e||null===(a=e.reportTea)||void 0===a||a.call(e,"mini_sdk_external_link_jump_fail",{feature:r,targetUrl:i,webviewUrlPath:n,error:t}),console.warn("[volc-live-mini-sdk] external link jump failed",{feature:r,targetUrl:i,webviewUrlPath:n,error:t})}}),!0};exports.navigateToConfiguredWebview=navigateToConfiguredWebview;