var __awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(o){if(e)throw new TypeError("Generator is already executing.");while(f&&(f=0,o[0]&&(r=0)),r)try{if(e=1,u&&(i=o[0]&2?u["return"]:o[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,o[1])).done)return i;(u=0,i)&&(o=[o[0]&2,i.value]);switch(o[0]){case 0:case 1:i=o;break;case 4:return r.label++,{value:o[1],done:!1};case 5:r.label++;u=o[1];o=[0];continue;case 7:o=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(o[0]===6||o[0]===2)){r=0;continue}if(o[0]===3&&(!i||o[1]>i[0]&&o[1]span");i&&t&&(i.innerText=t)}function p(n,t){var i;return __awaiter(this,void 0,void 0,function(){var u,o,l,a,s,p,w,f,h,c,e;return __generator(this,function(b){switch(b.label){case 0:return!n||!t?[2]:(u=t.getAttribute(v),!u)?[2]:(o=sb_gt(),u==="Close")?(sj_evt.fire("GlobalActionMenuV2Wrapper.HideActionMenuContent",n),e={OverallDT:(sb_gt()-o).toString(),GetShareLinkDT:"0",UploadScreenshotDT:"0",GetShortShareLinkDT:"0"},r(n,"ShareActionClickHandlerSuccess",u,e),[2]):(u==="CopyUrl"||u==="GetUrl")&&(l=t.parentElement,l&&(a=l.getElementsByClassName(y),s=a[0],s&&s.innerText))?(h=lt(n,s.innerText),t.focus(),c=h?"ShareActionClickHandlerSuccess":"ShareActionClickHandlerFailure",e={OverallDT:(sb_gt()-o).toString(),GetShareLinkDT:"0",UploadScreenshotDT:"0",GetShortShareLinkDT:"0"},r(n,c,u,e),[2]):(p=ct(n),w=(i=p.getAttribute(d))!==null&&i!==void 0?i:"",[4,ot(n,t,!1)]);case 1:return f=b.sent(),f?(h=hi(n,t,f.shareUrl,w,f.isLoading),c=h?"ShareActionClickHandlerSuccess":"ShareActionClickHandlerFailure",e={OverallDT:(sb_gt()-o).toString(),GetShareLinkDT:f.GetShareLinkDT,UploadScreenshotDT:f.UploadScreenshotDT,GetShortShareLinkDT:f.GetShortShareLinkDT},r(n,c,u,e)):r(n,"ShareActionClickHandlerFailure",u),[2]}})})}function ot(n,r,u){var f=this;return new Promise(function(e){return __awaiter(f,void 0,void 0,function(){var o,f,l,y,p,s,w,h,b,c;return __generator(this,function(k){switch(k.label){case 0:return!n||!r?(e(null),[2,null]):(o=r.getAttribute(v),!o)?(e(null),[2,null]):(f=null,l=0,y=ci(o),p=st(n,o),s=ShareHelper.generateShareUrl(p),!s)?(e(null),[2,null]):(o==i[i.MyBing])?[4,yi(s,n,o)]:[3,2];case 1:if(w=k.sent(),w)c={shareUrl:s,shareThumbnailId:"",isLoading:y,GetShareLinkDT:"",UploadScreenshotDT:"0",GetShortShareLinkDT:"0"},e(c);else return e(null),[2,null];return[3,5];case 2:return(h=n.getAttribute(it)||n.getAttribute(a),!(u||o!==i[i.GetUrl]||t.sharingGlobalConfig.enableGetShareLinkFromServerForGetUrl))?[3,4]:(b=sb_gt(),[4,vi(n,o,s,!!h)]);case 3:f=k.sent();f&&f.ShortShareLink&&(s=f.ShortShareLink);f&&f.ThumbnailId&&(n.setAttribute(a,f.ThumbnailId),h||(h=f.ThumbnailId));l=sb_gt()-b;k.label=4;case 4:h||(h=fi);c={shareUrl:s,shareThumbnailId:h,isLoading:y,GetShareLinkDT:l.toString(),UploadScreenshotDT:f&&f.UploadScreenshotDT?f.UploadScreenshotDT:"0",GetShortShareLinkDT:f&&f.GetShortShareLinkDT?f.GetShortShareLinkDT:"0"};e(c);k.label=5;case 5:return[2]}})})})}function hi(n,r,u,e,o){var k,s=ht(n),c,tt,it,p,rt,ut,y,ft;if(!s||(c=r.getAttribute(v),!c))return!1;var d=!0,l,g=!0,a=0,nt=0,b=(k=ai(n))!==null&&k!==void 0?k:Shared.formatString(t.sharingGlobalConfig.thumbnailUrlFormat,e);if(c===i[i.Facebook])tt=location.protocol+"//www.bing.com"+t.sharingGlobalConfig.closeRedirectUrl,l=Shared.formatString(t.sharingGlobalConfig.facebookShareFormat,encodeURIComponent(u),encodeURIComponent(tt),di(s.shareKey),t.sharingGlobalConfig.facebookAppId),a=t.sharingGlobalConfig.fbInitialHeight;else if(c===i[i.FacebookMessenger])it=location.protocol+"//www.bing.com"+t.sharingGlobalConfig.closeRedirectUrl,l=Shared.formatString(t.sharingGlobalConfig.facebookMessengerUrlFormat,t.sharingGlobalConfig.facebookAppId,encodeURIComponent(u),encodeURIComponent(it)),a=t.sharingGlobalConfig.fbInitialHeight;else if(c===i[i.Twitter])y=s.shareTwitterText!=null&&s.shareTwitterText.length>2?s.shareTwitterText:s.shareDescription,l=Shared.formatString(t.sharingGlobalConfig.twitterApi,s.shareHashtags,encodeURIComponent(y),encodeURIComponent(u)),a=t.sharingGlobalConfig.twitterInitialHeight;else if(c===i[i.Pinterest])l=Shared.formatString(t.sharingGlobalConfig.pinterestUrlFormat,encodeURIComponent(u),encodeURIComponent(b),encodeURIComponent(s.shareDescription)),a=t.sharingGlobalConfig.defaultInitialHeight;else if(c===i[i.MyBing])l=t.sharingGlobalConfig.mybingRedirectUrl,a=t.sharingGlobalConfig.defaultInitialHeight;else if(c===i[i.OneNote])l=Shared.formatString(t.sharingGlobalConfig.oneNoteUrlFormat,encodeURIComponent(u),encodeURIComponent(b),encodeURIComponent(s.shareTitle),encodeURIComponent(s.shareDescription)),a=t.sharingGlobalConfig.defaultInitialHeight;else if(c===i[i.Skype])l=Shared.formatString(t.sharingGlobalConfig.skypeUrlFormat,encodeURIComponent(u),encodeURIComponent(s.shareDescription)),a=t.sharingGlobalConfig.skypeInitialHeight,nt=t.sharingGlobalConfig.skypeInitialWidth;else if(c===i[i.LinkedIn])l=Shared.formatString(t.sharingGlobalConfig.linkedInUrlFormat,encodeURIComponent(u),encodeURIComponent(s.shareTitle),encodeURIComponent(s.shareDescription)),a=t.sharingGlobalConfig.defaultInitialHeight;else if(c===i[i.Email])p=h(s.shareEmailBody,u),l=Shared.formatString(t.sharingGlobalConfig.mailLauncherUrl,encodeURIComponent(s.shareEmailSubject),encodeURIComponent(p)),g=t.sharingGlobalConfig.isUnderside;else if(c===i[i.OutlookCom])p=h(s.shareEmailBody,u),l=Shared.formatString(t.sharingGlobalConfig.outlookComLauncherUrl,encodeURIComponent(s.shareEmailSubject),encodeURIComponent(p));else if(c===i[i.Gmail])p=h(s.shareEmailBody,u),l=Shared.formatString(t.sharingGlobalConfig.gmailLauncherUrl,encodeURIComponent(s.shareEmailSubject),encodeURIComponent(p));else if(c===i[i.Sms]){if(t.sharingGlobalConfig.smsProtocol){var et=s.shareIMText?s.shareIMText.replace("%","%25"):"",ot=h(et,u),st=Shared.formatString(t.sharingGlobalConfig.smsProtocol,encodeURIComponent(ot));_w.sj_lc&&_w.sj_lc(st)}}else c===i[i.WhatsApp]?(rt=h(s.shareIMText,u),ut=Shared.formatString(t.sharingGlobalConfig.whatsAppSchema,encodeURIComponent(rt)),gi(ut,t.sharingGlobalConfig.whatsAppStoreUrl,n)):c===i[i.GetUrl]||c==="CopyUrl"?r.getAttribute("data-skipstep1")!=="true"?w(n,u,!0):(d=lt(n,u),r.focus()):c===i[i.Weibo]?(y=s.shareTwitterText!=null&&s.shareTwitterText.length>2?s.shareTwitterText:s.shareDescription,l=Shared.formatString(t.sharingGlobalConfig.weiboShareFormat,encodeURIComponent(y),encodeURIComponent(u),encodeURIComponent(b)),a=t.sharingGlobalConfig.defaultInitialHeight):c===i[i.Qzone]?(y=s.shareTwitterText!=null&&s.shareTwitterText.length>2?s.shareTwitterText:s.shareDescription,l=Shared.formatString(t.sharingGlobalConfig.qzoneShareFormat,encodeURIComponent(s.shareTitle),encodeURIComponent(y),encodeURIComponent(u),encodeURIComponent(b)),a=t.sharingGlobalConfig.defaultInitialHeight):c===i[i.Reddit]&&(ft=s.shareTitle,l=Shared.formatString(t.sharingGlobalConfig.redditShareFormat,encodeURIComponent(u),encodeURIComponent(ft)));return l&&f(!o,l,g,a,nt),d}function ci(n){var o=n===i[i.Facebook],s=n===i[i.FacebookMessenger],e=n===i[i.Twitter],h=n===i[i.Pinterest],c=n==i[i.MyBing],l=n===i[i.Skype],a=n===i[i.LinkedIn],v=n===i[i.OneNote],y=n===i[i.OutlookCom],p=n===i[i.Gmail],w=n===i[i.Weibo],b=n===i[i.Qzone],k=n===i[i.Reddit],r=t.sharingGlobalConfig.useBlankLoadingPage?"about:blank":t.sharingGlobalConfig.loadingUrl,u=!0;return o?f(!0,r,!0,t.sharingGlobalConfig.fbInitialHeight):s?f(!0,r,!0,t.sharingGlobalConfig.fbInitialHeight,t.sharingGlobalConfig.fbmInitialWidth):e?f(!0,r,!0,t.sharingGlobalConfig.twitterInitialHeight,t.sharingGlobalConfig.twitterInitialWidth):l?f(!0,r,!0,t.sharingGlobalConfig.skypeInitialHeight,t.sharingGlobalConfig.skypeInitialWidth):v?f(!0,r,!0,t.sharingGlobalConfig.oneNoteInitialHeight,t.sharingGlobalConfig.oneNoteInitialWidth):e||h||a||w||b||c||k?f(!0,r,!0,t.sharingGlobalConfig.defaultInitialHeight):y||p?f(!0,r,!0,0):u=!1,u&&t.sharingGlobalConfig.useBlankLoadingPage&&li(),u}function f(n,i,r,f,e){if(e===void 0&&(e=0),r)if(n||u==null)if(f>0){var o=e>0?e:550;u=_w.open(i,"shareW","toolbar=yes, scrollbars=yes, resizable=yes, top=500, left=500, width="+o+", height="+f)}else u=_w.open(i,"shareW");else{_w.location.origin||(_w.location.origin=_w.location.protocol+"//"+_w.location.hostname+(_w.location.port?":"+_w.location.port:""));try{t.sharingGlobalConfig.useLocationReplace?u.location.replace(i):u.location.href=i}catch(s){}u.postMessage({source:"sharing",url:i},_w.location.origin)}else _w.sj_lc&&_w.sj_lc(i)}function li(){if(u){var r=_w.location.protocol+"//"+_w.location.hostname+t.sharingGlobalConfig.loadingUrl,i=u.window.document,n=i.createElement("iframe");n.src=r;n.style.width="100%";n.style.height="300px";n.style.border="0";i.body.appendChild(n)}}function ai(n){var r,u,t,i,f;return ir()?(t=(r=n.getElementsByClassName("share-preview-content"))===null||r===void 0?void 0:r[0],!t||!Lib.CssClass.contains(t,"img"))?null:(i=(u=t.getElementsByTagName("img"))===null||u===void 0?void 0:u[0],f=i===null||i===void 0?void 0:i.src,!f)?null:f:null}function st(n,i){var r=ht(n)||{},u=r.shareTitle,c=u===void 0?"":u,f=r.shareDescription,l=f===void 0?"":f,e=r.hash,v=e===void 0?"":e,o=r.urlOverride,y=o===void 0?"":o,s=r.shareOutImageThumbnailId,p=s===void 0?"":s,h=r.sharingGuid,w=h===void 0?"":h,b=r.formCodes,k=r.cropSetting,d=n.getAttribute(it)||n.getAttribute(a)||"",nt=n.getAttribute(g),tt=ki(b,i),rt=t.sharingGlobalConfig.isCNEnglishSearch;return{shareTitle:c,shareDescription:l,hash:v,urlOverride:y,shareOutImageThumbnailId:p,shareThumbnailId:d,sharingGuid:w,shareType:i,shareScenario:nt,formCode:tt,cropSetting:k,isCNEnglishSearch:rt}}function vi(n,t,i,r){return new Promise(function(u){var h=wi(n,i,r),e,f;if(!h)return u(null),null;var o,s=ti,c=s.indexOf("?")===-1?"?":"&",l=["addloginsource","client","clientip","corpnet","features","hose","hoseassistant","logjserror","msamock","setvar","testhooks","theme","uncrunched","ptn","webthemedark","darkschemeovr"];for(e=0;e=h)&&(clearInterval(c),f||(k()?_w.open(i):_w.sj_lc(i)))},100)}else t.sharingGlobalConfig.checkAppInstall=="timeout"&&(s=sb_gt(),setTimeout(function(){var n=sb_gt();n-s-t.sharingGlobalConfig.checkAppTimeout<100&&(k()?_w.open(i):_w.sj_lc(i))},t.sharingGlobalConfig.checkAppTimeout))}function w(n,t,i){return __awaiter(this,void 0,void 0,function(){var u,e,r,s,o,f;return __generator(this,function(h){switch(h.label){case 0:return(u=n.querySelectorAll(".ga_cpy_link"),!(u&&u[0]))?[3,3]:(e=u[0],r=e.parentElement,!r)?[3,3]:(s=r.getElementsByClassName(y),o=s[0],!o)?[3,3]:!t?[4,ot(n,e,!0)]:[3,2];case 1:if(f=h.sent(),!f||!f.shareUrl)return[2];t=f.shareUrl;h.label=2;case 2:i&&(Lib.CssClass.remove(r,rt),Lib.CssClass.remove(r,ft),Lib.CssClass.add(r,ut));o.innerText=t;h.label=3;case 3:return[2]}})})}function lt(n,t){var u=n.querySelectorAll(".ga_cpy_link"),f,i,e,r;if(u&&u[0]&&(f=u[0],i=f.parentElement,i)){if(!t){if(e=i.getElementsByClassName(y),r=e[0],!r||!r.innerText)return!1;t=r.innerText}return Lib.CssClass.remove(i,rt),Lib.CssClass.remove(i,ut),Lib.CssClass.add(i,ft),nr(t)}return!1}function nr(n){var t=!0,i=function(){var i=document.createElement("textarea");i.value=n;document.body.appendChild(i);i.select();try{t=document.execCommand("copy")}catch(r){t=!1}document.body.removeChild(i)};return navigator&&navigator.clipboard?navigator.clipboard.writeText(n)["catch"](i):i(),t}function b(n){sj_pd(n);sj_sp(n)}function r(n,t,i,r){var o,u,s,c,h,e,f,l;if(i===void 0&&(i=null),r===void 0&&(r=null),o=typeof n=="string"?n:n===null||n===void 0?void 0:n.getAttribute(g),Log&&Log.Log&&o){if(t="GAMV2."+t,u=["Namespace",tr(o),"Scenario",o],i&&(u.push("ShareType"),u.push(i)),r)for(f in r)r.hasOwnProperty(f)&&r[f]&&(u.push(f),u.push(r[f]));if(s=o.indexOf("Codex_")===0?"Codex":"CI",s==="Codex"){for(c=["Namespace"],h={},e=0;e