function getDeepLinkURLScheme(){return Constants.DEEP_LINK_CONFIGS[LOCALE.toUpperCase()].K_URL}function FB_fix(e){var t,o,a,n;return(-1!==navigator.userAgent.indexOf("FBAV/")||1==e)&&($(".lure-hold .get_app_btns_wrapper").hide(),e="<div>"+i18n.t("msg_facebook_please_copy_link")+"</div>",t=$("<dl id='deeplink-copy'>"),o=$("<dd>").css({"-webkit-user-select":"all","-moz-user-select":"all","user-select":"all"}),a=$("<p>").css({"-webkit-user-select":"all","-moz-user-select":"all","user-select":"all"}),t.css({"-webkit-user-select":"all","-moz-user-select":"all","user-select":"all",padding:"4px 0",color:"#EE4D2D"}),-1==(n=location.host.replace("mall.","")).indexOf("shopee.")&&(n="test.shopee.sg"),"undefined"==typeof itemid?a.text("http://"+n+"/"+username):a.text("http://"+n+"/"+username+"/"+itemid),o.append(a).appendTo(t),showProm(e+t[0].outerHTML,!0),!0)}function openApp(e,t){function o(){var e=isIOS()?3e3:500;alert_message_with_loader("",e),setTimeout(function(){t()},e)}e=getDeepLinkURLScheme()+e;if(isIOS()){window.location=e;var a=+new Date,n=setInterval(function(){var e=+new Date;2e3<e-a&&hideProm(),1500<e-a&&clearInterval(n)},100),r=setTimeout(function(){!document.hasFocus()||FB_fix()||o()},500);$(window).on("blur",function(){clearTimeout(r),hideProm()})}else if(isAndroid())if(isGasApp())t();else{var i=navigator.userAgent;if(0<=i.indexOf("Chrome/4")||0<=i.indexOf("MiuiBrowser/"))return window.location=e,void o();var c=window.open(e);TIMEOUT=500,0<=navigator.userAgent.indexOf("SM-G130H")&&(TIMEOUT=1e3),0<=navigator.userAgent.indexOf("XiaoMi")&&(TIMEOUT=800),setTimeout(function(){c&&c.window&&!function e(t){t.close(),t.window&&setTimeout(function(){e(t)},50)}(c),o()},TIMEOUT)}else t()}function addBiDataToUrl(e,t){return window._bi_addGSrcToUrl?_bi_addGSrcToUrl(e,location.pathname+location.search,t):e}function constructCollectionPageUrlJson(e,t){var o;return e.collectionId?(o=(o=window.location).protocol+"//"+o.host+"/collections/"+e.collectionId+"/",{webNav:{url:t?addBiDataToUrl(o):o}}):null}function constructCategoriesPageUrlJson(e){return!(!e.categoryId||!e.categoryName)&&{webNav:{url:location.origin+"/categories/"+e.categoryId+"/",navbar:{title:e.categoryName,searchParam:e.categoryId,searchType:1,searchPlaceholder:i18n.t("label_search_within")+": "+e.categoryName,rightItemsConfig:{items:[{type:"search"}]}}}}}function constructCategoryPageUrlJson(e){var t;return!(!e.categoryId||!e.categoryName)&&{webNav:{url:(t=window.location).protocol+"//"+t.host+"/category-item/?categoryid="+e.categoryId+"&categoryname="+encodeURIComponent(e.categoryName),tabRightButton:{type:"button",key:"filter",iconType:"filter"},navbar:{title:e.categoryName,searchParam:e.categoryId,searchPlaceholder:i18n.t("label_search_within")+": "+e.categoryName,rightItemsConfig:{items:[{type:"search"},{type:"button",key:"filter",iconType:"filter"}]}}}}}function constructShopPageUrlJson(e){var t;return e.userId&&e.username&&e.shopId?{webNav:{url:addBiDataToUrl((t=window.location).protocol+"//"+t.host+"/shop/#shopid="+e.shopId),navbar:{rightItemsConfig:{items:[{type:"more",items:[{type:"home"},{type:"reportuser",userID:e.userId}]}]}}}}:null}function constructItemPageUrlJson(e){var t;return!(!e.itemId||!e.shopId)&&{webNav:{url:addBiDataToUrl((t=window.location).protocol+"//"+t.host+"/item/#shopid="+e.shopId+"&itemid="+e.itemId),config:{},navbar:{rightItemsConfig:{items:[{type:"more",items:[{type:"home"},{type:"reportitem",itemID:e.itemId,shopID:e.shopId}]}]}}}}}function encodeDeepLinkUrl(e){return window.Base64?(e=JSON.stringify(e),encodeURIComponent(Base64.encode(e))):null}function constructGenericPageUrlJson(e){return encodeDeepLinkUrl({paths:[{webNav:{url:wrapUrlWithBridgeCMDNavigate(addBiDataToUrl(e,!0))}}]})}function updateDeepLinkMeta(e){var t=get_app_ids(),o=get_app_agent(),t=t[LOCALE][o];e||(e="home","/"!=location.pathname&&(e+="?navRoute="+constructGenericPageUrlJson(location.href))),isIOS()&&($("meta[name=apple-itunes-app]").remove(),o=", app-argument="+getDeepLinkURLScheme()+e,$("head").append('<meta name="apple-itunes-app" content="app-id=${APPID} ${APPARG}">'.replace("${APPID}",t).replace("${APPARG}",o)))}function _simple_nav_(e){var t,o,a,n,r,i,c,l;window.WebViewJavascriptBridge?(t=window.WebViewJavascriptBridge,o=(e=function(e){if(e){var t=e.split("|");e={};for(var o=0;o<t.length;o++){var a=t[o].split("=")[0],n=t[o].split("=")[1];e[a]=n}return e}return null}(e)).s,a=e.i,n=e.ca,e=e.co,o&&a?(l={url:location.origin+"/item/#shopid="+o+"&itemid="+a},n?(c="placeholder",r="home?navRoute="+encodeDeepLinkUrl({paths:[constructCategoryPageUrlJson({categoryId:n,categoryName:c=0!=(i=$("div[categoryid='{{categoryId}}']".replace("{{categoryId}}",n))).length?i.text():c}),constructItemPageUrlJson({itemId:a,shopId:o})]}),t.callHandler("jump",{path:r},function(){})):e?(r="home?navRoute="+encodeDeepLinkUrl({paths:[constructCollectionPageUrlJson({collectionId:e},!1),constructItemPageUrlJson({itemId:a,shopId:o})]}),t.callHandler("jump",{path:r},function(){})):bridgeCallHandler("navigate",l,function(){})):n?(c="placeholder",l=constructCategoryPageUrlJson({categoryId:n,categoryName:c=0!=(i=$("div[categoryid='{{categoryId}}']".replace("{{categoryId}}",n))).length?i.text():c}).webNav,bridgeCallHandler("navigate",l,function(){})):e&&(l=constructCollectionPageUrlJson({collectionId:e},!0).webNav,bridgeCallHandler("navigate",l,function(){}))):console.log("simple nav failed, bridge is not ready")}$(function(){updateDeepLinkMeta(null)});
//# sourceMappingURL=../../source_maps/common/deep_linking.js.map
