Path: blob/master/sites/amazonsign/password_files/21W6-DMlJGL.js
740 views
P.register("cvfVersion",function(){return{version:"0.1.0.0-2019-10-17"}});1P.when("A","cvfFormDataGenerator","ready").register("cvf-account-switcher",function(h,l){function n(c,d){c.preventDefault();var e=l.retrieveFormData(c.target),f=e.inputData.serializeArray();f.push(b(c.target));h.ajax(window.location.protocol+"//"+window.location.host+e.requestPath,{method:"POST",params:f,success:d,error:a})}function b(a){a=c(a);var b=a.attr("name");b||(b=a.closest(".cvf-account-switcher-sign-out-link").attr("data-name"));var d=a.attr("value");d||(d=a.closest(".cvf-account-switcher-sign-out-link").attr("data-value"));2return{name:b,value:d}}function a(a,b,c){h.trigger(f.error,c)}function e(a){var b=/([^@\s]+)@([a-zA-Z0-9_-]+)(\.[a-zA-Z0-9._-]+)/ig.exec(a);if(null!==b){a=b[1];a=c.trim(a);var d=a.length;if(1!==d){for(var e=a.charAt(0),f=0;f<d-2;f++)e+="*";a=e+=a.charAt(d-1)}a+="@";e=b[2];e=c.trim(e);d=e.length;e=e.charAt(0);for(f=0;f<d-1;f++)e+="*";return a+e+b[3]}b=c.trim(a);a=b.length;if(!(4>=a)){d="";for(e=0;e<a-4;e++)d+="*";b=d+b.substr(a-4,a-1)}return b}function d(){0===c(".cvf-account-switcher-check-mark:visible").length&&3(c(".cvf-account-switcher-check-mark-area").remove(),c(".cvf-account-switcher-profile-details").toggleClass("cvf-account-switcher-profile-details cvf-account-switcher-profile-details-after-account-removed"))}var c=h.$,f={success:"cvf:account_switcher:success",error:"cvf:account_switcher:error"};(function(){var a=c("#ap-account-switcher-container")[0],b=window.MutationObserver||window.WebKitMutationObserver;if(void 0!==a&&void 0!==b){var e=new b(function(a){for(var b=0;b<a.length;b++)if(null!==a[b].addedNodes){d();4e.disconnect();break}});e.observe(a,{attributes:!0,childList:!0,characterData:!0,subtree:!0})}})();(function(){c(".cvf-account-switcher-sign-out-link").live("click",function(a){n(a,function(b){if(b.redirectUrl)window.location=b.redirectUrl,h.trigger("cvf:account_switcher","redirectOnSignOut");else if(b.succeeded){var g="."+c(a.target).attr("class").match(/cvf-account-switcher-account-group-\w+/g)[0];c(g+"-hide").hide();c(g+"-name").text(c("#cvf-account-switcher-sign-out-replace-text").text());c(g+5"-claim").text(e(c(g+"-claim").text()));c(g+"-image").replaceWith(c("<div />").append(c("#cvf-account-switcher-sign-out-replace-image").clone().removeClass("cvf-hidden")).html());c(g+"-button").removeClass("cvf-widget-btn-val cvf-widget-btn-verify-account-switcher");b=b.switchedAccountId;void 0!==b&&c(".cvf-account-switcher-account-group-"+b+"-check-mark").show();d()}else h.trigger(f.error,b)})})})()});6P.when("A","cvfVersion","cvfFormDataGenerator","ready").register("cvf",function(h,l,n){function b(a){function b(a){"string"===typeof u.options.widgetMetricsScope&&"function"===typeof window.uet&&window.uex("ld",u.options.widgetMetricsScope,{wb:1});u.options.spinnerTarget&&u.options.spinnerTarget.hide();a.hasOwnProperty("error")?h.trigger(w.error,a.error):a.redirectUrl?window.location=a.redirectUrl:a.redirect?(h.trigger(w.success,a.token,a.status,a.redirect),u.options.autoDestroy?u.destroy():(e(".cvf-widget-alert").hide(),7a.status?e(".cvf-widget-status-success").show():e(".cvf-widget-status-error").show(),q()),h.trigger("cvf:verification:complete",a.status),x.find(".cvf-widget-btn").unbind("click",m),x.find(".cvf-widget-btn-val").unbind("click",m),h.off(w.success),h.off(w.error)):(x.html(a.replace(/<form/g,"<div").replace(/<\/form/g,"</div")),r())}function m(a,c){a.preventDefault();e(".cvf-widget-alert").hide();u.options.spinnerTarget&&u.options.spinnerTarget.show();var d=n.retrieveFormData(a.target),f=d.inputData.serializeArray();8c&&f.push(n.getNameValue(a.target));h.ajax(p+d.requestPath,{method:"POST",params:f,success:b,error:D})}function g(a){13===a.keyCode&&m(a)}function r(){x.find(".cvf-widget-btn").click(function(a){m(a,!1)});x.find(".cvf-widget-btn-val").click(function(a){m(a,!0)});x.find('input[name="code"]').focus().keypress(g)}function C(a){return function(b,c,d){"timeout"!==c||3<=y?h.trigger(w.error,d):h.delay(a,10*y++)}}function D(a,b,c){u.options.spinnerTarget&&u.options.spinnerTarget.hide();h.trigger(w.error,9c)}function q(){e.each(x.find("input"),function(a,b){var c=e(b);c.attr("disabled","disabled");c.hasClass("a-input-text")?c.addClass("a-form-disabled"):c.hasClass("a-button-input")?c.closest(".a-button").addClass("a-button-disabled"):c.closest(".a-input-text-wrapper").length&&c.closest(".a-input-text-wrapper").addClass("a-form-disabled")});e.each(x.find("a"),function(a,b){var c=e(b);c.hasClass("cvf-widget-link-disable-target")&&c.addClass("cvf-link-disabled")})}var u=this;c++;var w={success:"cvf:"+10c+":success",error:"cvf:"+c+":error"};u.options={};e.extend(u.options,d,a);(function(a){if(1!==e(a.target).length)throw Error("The CVF widget requires a unique element.");if(!e.isFunction(a.onSuccess))throw Error("The CVF widget requires a success callback function.");if(!e.isFunction(a.onError))throw Error("The CVF widget requires an error callback function.");})(u.options);var p=u.options.server,x=e(u.options.target);h.on(w.success,u.options.onSuccess);h.on(w.error,u.options.onError);u.start=function(){if(0===11e.trim(u.options.requestToken).length)throw Error("The CVF widget requires a request token.");var a=p+"/ap/cvf/request.embed",c=u.options.requestToken,d=u.options.requestArbToken,f={};0===e.trim(d).length?f.requestToken=c:f.arb=d;f.CVFVersion=l.version;f.AUIVersion=P.AUI_BUILD_DATE;"string"===typeof u.options.widgetMetricsScope&&"function"===typeof window.uet&&window.uet("bb",u.options.widgetMetricsScope,{wb:1});h.ajax(a,{method:"GET",params:f,success:b,error:C(u.start)})};u.destroy=function(){x.html("")};12r();var y=0;u.options.autoStart&&u.start()}function a(a){return new b(a)}var e=h.$,d={server:"",target:void 0,requestToken:void 0,requestArbToken:void 0,onSuccess:void 0,onError:void 0,spinnerTarget:void 0,autoStart:!0,autoDestroy:!0,widgetMetricsScope:void 0},c=0;h.on("cvf:verification:request",function(b){var c=e("#"+b),d=c.data("token"),g=c.data("spinnerId"),g=e("#"+g);a({target:c,spinnerTarget:g,requestToken:d,onSuccess:function(a,c,d){h.trigger("cvf:verification:complete:"+b,a,c,d)},onError:function(a){h.trigger("cvf:verification:error:"+13b,a)},autoStart:!0,autoDestroy:!1})});return{create:a}});P.when("A","cvf","ready").execute(function(h,l){var n=h.$;n(document).ready(function(){function b(a,b,c){window.location=c;console.log("Client Side: "+a)}function a(a){console.log(a)}var e=n(".cvf-widget-spinner"),d=n("#cvf-widget-content");if(1===d.length){var c=n('[name="requestToken"]').first().attr("value");l.create({target:d,spinnerTarget:e,requestToken:c,onSuccess:b,onError:a,autoStart:!1})}})});14P.when("A").execute(function(h){h.declarative("auth-popup","click",function(h){var n=h.data;h=h.$target.closest("a")[0];(n=window.open(h.href,h.target,n.windowOptions))&&n.focus()})});P.when("A","cvfFormDataGenerator","ready").execute(function(h,l){});15P.when("A","cvfFormDataGenerator","ready").execute(function(h,l){var n=h.$;n(".cvf-widget-btn-val").click(function(b){var a=n(b.target).closest(".cvf-widget-form");b=l.getNameValue(n(b.target));a.append('<input type="hidden" name="'+b.name+'" value="'+b.value+'">').submit()})});16P.when("A","ready").register("cvfFormDataGenerator",function(h){var l=h.$;return{retrieveFormData:function(h){h=l(h).closest(".cvf-widget-form");return{requestPath:h.data("use-only-form-action")?h.attr("action"):"/ap/cvf/"+h.attr("action")+".embed",inputData:h.find(".cvf-widget-input,.cvf-widget-hidden-fields,.cvf-widget-input :input"),form:h}},getNameValue:function(h){h=l(h);var b=h.attr("name");b||(b=h.closest(".cvf-widget-btn-val").attr("data-name"));var a=h.attr("value");a||(a=h.closest(".cvf-widget-btn-val").attr("data-value"));17return{name:b,value:a}}}});P.when("A","ready").register("codeResendTimer",function(h){function l(l,b,a){var e=(new Date).getTime(),d=setInterval(function(){var c=(new Date).getTime()-e,c=l-c;if(0>=c)clearInterval(d),h.$("#timer").html(a);else{var c=Math.floor(c/1E3),f=b.split(" +timeleft+ "),c=f[0].split('"').join("")+c+f[1].split('"').join("");h.$("#timer").html(c)}},100)}return{createTimer:function(h,b,a){return new l(h,b,a)}}});1819