(function(v){var w=window.AmazonUIPageJS||window.P,t=w._namespace||w.attributeErrors,u=t?t("AmazonLightsaberPageAssets",""):w;u.guardFatal?u.guardFatal(v)(u,window):u.execute(function(){v(u,window)})})(function(v,w,t){(function(){var u;(function(e){e.deep=function(b){return JSON.parse(JSON.stringify(b))}})(u||(u={}));var x;(function(e){e.log=function(b){for(var a=1;a<arguments.length;a++);}})(x||(x={}));var J=this&&this.__awaiter||function(e,b,a,f){function c(b){return b instanceof a?b:new a(function(a){a(b)})}
return new (a||(a=Promise))(function(a,g){function d(a){try{l(f.next(a))}catch(m){g(m)}}function h(a){try{l(f["throw"](a))}catch(m){g(m)}}function l(b){b.done?a(b.value):c(b.value).then(d,h)}l((f=f.apply(e,b||[])).next())})},K=this&&this.__generator||function(e,b){function a(a){return function(b){return f([a,b])}}function f(a){if(h)throw new TypeError("Generator is already executing.");for(;c;)try{if(h=1,g&&(d=a[0]&2?g["return"]:a[0]?g["throw"]||((d=g["return"])&&d.call(g),0):g.next)&&!(d=d.call(g,
a[1])).done)return d;if(g=0,d)a=[a[0]&2,d.value];switch(a[0]){case 0:case 1:d=a;break;case 4:return c.label++,{value:a[1],done:!1};case 5:c.label++;g=a[1];a=[0];continue;case 7:a=c.ops.pop();c.trys.pop();continue;default:if(!(d=c.trys,d=0<d.length&&d[d.length-1])&&(6===a[0]||2===a[0])){c=0;continue}if(3===a[0]&&(!d||a[1]>d[0]&&a[1]<d[3]))c.label=a[1];else if(6===a[0]&&c.label<d[1])c.label=d[1],d=a;else if(d&&c.label<d[2])c.label=d[2],c.ops.push(a);else{d[2]&&c.ops.pop();c.trys.pop();continue}}a=b.call(e,
c)}catch(n){a=[6,n],g=0}finally{h=d=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}var c={label:0,sent:function(){if(d[0]&1)throw d[1];return d[1]},trys:[],ops:[]},h,g,d,k;return k={next:a(0),"throw":a(1),"return":a(2)},"function"===typeof Symbol&&(k[Symbol.iterator]=function(){return this}),k},z;(function(e){var b=this;e.getMatchingEntry=function(a){return J(b,void 0,void 0,function(){return K(this,function(b){return[2,new Promise(function(b,f){if("PerformanceObserver"in self&&-1<
PerformanceObserver.supportedEntryTypes.indexOf("largest-contentful-paint")){var c=new PerformanceObserver(function(c,f){c=c.getEntries();for(var d=0;d<c.length;d++){var e=c[d];if(a(e)){f.disconnect();b(e);break}}});try{c.observe({type:"largest-contentful-paint",buffered:!0})}catch(d){try{c.disconnect()}catch(k){}f(d)}}else f(Error("LCPUnsupported"))})]})})}})(z||(z={}));var r;(function(e){e.isObject=function(b){return!!b&&"object"===typeof b&&!Array.isArray(b)};e.isNonEmptyString=function(b){return"string"===
typeof b&&0<b.length};e.isPositiveInteger=function(b){return"number"===typeof b&&Math.floor(b)===b&&0<=b&&Infinity!==b};e.isFunction=function(b){return"function"===typeof b}})(r||(r={}));var F=this&&this.__awaiter||function(e,b,a,f){function c(b){return b instanceof a?b:new a(function(a){a(b)})}return new (a||(a=Promise))(function(a,g){function d(a){try{l(f.next(a))}catch(m){g(m)}}function h(a){try{l(f["throw"](a))}catch(m){g(m)}}function l(b){b.done?a(b.value):c(b.value).then(d,h)}l((f=f.apply(e,
b||[])).next())})},G=this&&this.__generator||function(e,b){function a(a){return function(b){return f([a,b])}}function f(a){if(h)throw new TypeError("Generator is already executing.");for(;c;)try{if(h=1,g&&(d=a[0]&2?g["return"]:a[0]?g["throw"]||((d=g["return"])&&d.call(g),0):g.next)&&!(d=d.call(g,a[1])).done)return d;if(g=0,d)a=[a[0]&2,d.value];switch(a[0]){case 0:case 1:d=a;break;case 4:return c.label++,{value:a[1],done:!1};case 5:c.label++;g=a[1];a=[0];continue;case 7:a=c.ops.pop();c.trys.pop();
continue;default:if(!(d=c.trys,d=0<d.length&&d[d.length-1])&&(6===a[0]||2===a[0])){c=0;continue}if(3===a[0]&&(!d||a[1]>d[0]&&a[1]<d[3]))c.label=a[1];else if(6===a[0]&&c.label<d[1])c.label=d[1],d=a;else if(d&&c.label<d[2])c.label=d[2],c.ops.push(a);else{d[2]&&c.ops.pop();c.trys.pop();continue}}a=b.call(e,c)}catch(n){a=[6,n],g=0}finally{h=d=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}var c={label:0,sent:function(){if(d[0]&1)throw d[1];return d[1]},trys:[],ops:[]},h,g,d,k;return k=
{next:a(0),"throw":a(1),"return":a(2)},"function"===typeof Symbol&&(k[Symbol.iterator]=function(){return this}),k},p;(function(e){var b=this;e.queueTask=function(a,b){return setTimeout(a,b||0)};e.queueTaskEvery=function(a,b){return setInterval(a,b)};e.clearQueuedTask=function(a){clearTimeout(a)};e.wait=function(a){return F(b,void 0,void 0,function(){return G(this,function(b){return[2,new Promise(function(b){setTimeout(b,a)})]})})};e.queueMicrotask=function(a){Promise.resolve().then(function(){a()})};
e.waitTillIdleOrTimeout=function(a){return F(b,void 0,void 0,function(){return G(this,function(b){return[2,new Promise(function(b){self.requestIdleCallback?self.requestIdleCallback(function(a){b(a)},{timeout:a}):setTimeout(function(){b({didTimeout:!0,timeRemaining:function(){return 0}})},a)})]})})}})(p||(p={}));var L=function(){function e(b){this._global=b;var a=r.isFunction;this._unsupported=!b.ue||!a(b.ue.tag)||!a(b.ue.count)||!a(b.uet)||!a(b.uex)||!a(b.ueLogError)}e.prototype.tag=function(b){this._unsupported||
(b=this._getMetricName(b),this._global.ue.tag(b),this._global.ue.isl&&this._global.uex("at"),x.log("Lightsaber:Tag:",b))};e.prototype.count=function(b,a){void 0===a&&(a=1);this._unsupported||(b=this._getMetricName(b),this._global.ue.count(b,a),x.log("Lightsaber:Counter:",b,a))};e.prototype.widgetLatency=function(b,a,f){a=this._getMetricName(a);"ld"===b?this._global.uex(b,a,{wb:1},f):this._global.uet(b,a,{wb:1},f)};e.prototype.logError=function(b,a){};e.prototype._getMetricName=function(b){return(e._METRIC_PREFIX+
":"+b).toLowerCase()};e._METRIC_PREFIX="Lightsaber:Page";e._DEFAULT_JS_ERROR_ATTRIBUTION="AmazonLightsaberPageAssets";e._DEFAULT_JS_ERROR_LOG_LEVEL="ERROR";return e}(),M={"gateway-phone-apps":"HomePage","gateway-phone-web":"HomePage",Gateway:"HomePage",SearchAW:"Search",Search:"Search",DetailWebView:"Detail",WebflowDetailWebView:"Detail",DetailAW:"Detail",WebflowDetailAW:"Detail",Detail:"Detail",WebflowDetail:"Detail",ShoppingCartWebview:"Cart",ShoppingCartAW:"Cart",ShoppingCart:"Cart",CheckoutConfirmOrderWebview:"Checkout",
CheckoutConfirmOrderAW:"Checkout",CheckoutConfirmOrder:"Checkout"},q;(function(e){e.getPageType=function(b){return b.ue_pty||"unknown"};e.getSubPageType=function(b){return b.ue_spty||"unknown"};e.getRequestId=function(b){return b.ue_id};e.getPageTypeGroup=function(b){b=e.getPageType(b);return(b=M[b])?b:"Unknown"}})(q||(q={}));var y=function(){function e(b,a,f){this.global=b;this._csmLogger=f;this._workerMessaging=a}e.prototype.getAbsoluteUrl=function(b){return(new URL(b,this.global.location.href)).href};
e.prototype.ready=function(){return this._workerMessaging.ready()};e.prototype.sendToWorker=function(b){this._workerMessaging.send(e._RENDERING_HINTS_COMMAND,b)};e.prototype.logCount=function(b,a){this._csmLogger.count("RenderingHints:Collect:"+b,a)};e.prototype.logError=function(b,a){this._csmLogger.logError(b,a)};e._RENDERING_HINTS_COMMAND="rendering_hints";return e}(),N=this&&this.__extends||function(){var e=function(b,a){e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=
b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])};return e(b,a)};return function(b,a){function f(){this.constructor=b}e(b,a);b.prototype=null===a?Object.create(a):(f.prototype=a.prototype,new f)}}(),O=this&&this.__awaiter||function(e,b,a,f){function c(b){return b instanceof a?b:new a(function(a){a(b)})}return new (a||(a=Promise))(function(a,g){function d(a){try{l(f.next(a))}catch(m){g(m)}}function h(a){try{l(f["throw"](a))}catch(m){g(m)}}function l(b){b.done?a(b.value):c(b.value).then(d,
h)}l((f=f.apply(e,b||[])).next())})},P=this&&this.__generator||function(e,b){function a(a){return function(b){return f([a,b])}}function f(a){if(h)throw new TypeError("Generator is already executing.");for(;c;)try{if(h=1,g&&(d=a[0]&2?g["return"]:a[0]?g["throw"]||((d=g["return"])&&d.call(g),0):g.next)&&!(d=d.call(g,a[1])).done)return d;if(g=0,d)a=[a[0]&2,d.value];switch(a[0]){case 0:case 1:d=a;break;case 4:return c.label++,{value:a[1],done:!1};case 5:c.label++;g=a[1];a=[0];continue;case 7:a=c.ops.pop();
c.trys.pop();continue;default:if(!(d=c.trys,d=0<d.length&&d[d.length-1])&&(6===a[0]||2===a[0])){c=0;continue}if(3===a[0]&&(!d||a[1]>d[0]&&a[1]<d[3]))c.label=a[1];else if(6===a[0]&&c.label<d[1])c.label=d[1],d=a;else if(d&&c.label<d[2])c.label=d[2],c.ops.push(a);else{d[2]&&c.ops.pop();c.trys.pop();continue}}a=b.call(e,c)}catch(n){a=[6,n],g=0}finally{h=d=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}var c={label:0,sent:function(){if(d[0]&1)throw d[1];return d[1]},trys:[],ops:[]},h,g,
d,k;return k={next:a(0),"throw":a(1),"return":a(2)},"function"===typeof Symbol&&(k[Symbol.iterator]=function(){return this}),k},A=function(e){function b(a,b,c,h){b=e.call(this,a,b,c)||this;b._queryRoot=h||a.document;return b}N(b,e);b.prototype.trigger=function(){var a=this;p.queueTask(function(){return O(a,void 0,void 0,function(){var a;return P(this,function(c){switch(c.label){case 0:return[4,p.waitTillIdleOrTimeout(b._IDLE_TIMEOUT)];case 1:c.sent();if(!this.ready())return this.logCount("NotReady"),
[2];a=this.collect(this._queryRoot);this._send(a);return[2]}})})})};b.prototype._send=function(a){var f=this,c=Object.keys(a).map(function(c){return{nature:b._RENDERING_HINTS_NATURE,target:c,data:a[c],source:f._getSource()}});this.logCount("Targets",c.length);1>c.length||this.sendToWorker(c)};b.prototype._getSource=function(){return{url:this.global.location.href,pty:q.getPageType(this.global),spty:q.getSubPageType(this.global),rid:q.getRequestId(this.global)}};b._IDLE_TIMEOUT=1E3;b._RENDERING_HINTS_NATURE=
"speculated_navigation_content";return b}(y),Q=this&&this.__extends||function(){var e=function(b,a){e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])};return e(b,a)};return function(b,a){function f(){this.constructor=b}e(b,a);b.prototype=null===a?Object.create(a):(f.prototype=a.prototype,new f)}}(),B=this&&this.__assign||function(){B=Object.assign||function(e){for(var b,a=1,f=arguments.length;a<f;a++){b=
arguments[a];for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(e[c]=b[c])}return e};return B.apply(this,arguments)},C=function(e){function b(a,f,c,h,g,d){void 0===g&&(g=!1);void 0===d&&(d=b.POLLING_FREQUENCY);var k=e.call(this,a,f,c,h)||this;a.addEventListener(b.UPDATE_NOTIFICATION_EVENT,function(){k.trigger()});g&&p.queueTaskEvery(function(){k.trigger()},d);k.trigger();return k}Q(b,e);b.update=function(a){var f=new CustomEvent(b.UPDATE_NOTIFICATION_EVENT,{bubbles:!1,cancelable:!1});a.dispatchEvent(f)};
b.prototype.collect=function(a){var f=a.querySelectorAll(b.QUERY_SELECTOR),c={};a=function(a){a=f[a];var d=B({},a.dataset),l=d[b.ATTR_TARGET];a.classList.remove(b.RENDERING_HINTS_CLASS);if(!l)return"continue";var g=e.getAbsoluteUrl(l);c[g]=c[g]||{};Object.keys(d).filter(function(a){return!!d[a]&&a!==b.ATTR_QUERY&&a!==b.ATTR_TARGET}).forEach(function(a){c[g][a]=d[a]})};for(var e=this,g=0;g<f.length;g++)a(g);return c};b.prototype.logCount=function(a,b){e.prototype.logCount.call(this,"DDHC:"+a,b)};b.RENDERING_HINTS_CLASS=
"lightsaber-rendering-hints";b.QUERY_SELECTOR='div[data-lightsaber\x3d"rendering-hints/speculated-navigation-content"].'+b.RENDERING_HINTS_CLASS;b.ATTR_QUERY="lightsaber";b.ATTR_TARGET="target";b.UPDATE_NOTIFICATION_EVENT="lightsaber:rendering-hints:declarative-dataset:update";b.POLLING_FREQUENCY=3E3;return b}(A),R=this&&this.__extends||function(){var e=function(b,a){e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&
(a[c]=b[c])};return e(b,a)};return function(b,a){function f(){this.constructor=b}e(b,a);b.prototype=null===a?Object.create(a):(f.prototype=a.prototype,new f)}}(),S=function(e){function b(a,b,c,h,g,d){var f=e.call(this,a,b,c,d)||this;if(!g.capabilities.mobile)return f;h.when("Rush","s-web-application-controller").execute(function(b,c){b.on(c.ACTIONS.LOAD_SEARCH_PAGE_COMPLETE,function(){f.trigger();C.update(a)})});f._previouslySeenTargets={};f.trigger();return f}R(b,e);b.prototype.collect=function(a){a=
a.querySelectorAll(b.FACEOUT_IMAGE_QUERY);for(var f={},c=0;c<a.length;c++){var e=a[c],g=e.closest("a");g&&(g=g.href,this._previouslySeenTargets[g]||(this._previouslySeenTargets[g]=!0,f[g]={faceoutImage:e.src,productTitle:e.alt}))}this.logCount("Query",Object.keys(f).length);return f};b.prototype.logCount=function(a,b){e.prototype.logCount.call(this,"SPHC:"+a,b)};b.FACEOUT_IMAGE_QUERY='a.s-faceout-link img.s-image[data-image-latency\x3d"s-product-image"]';return b}(A),T=this&&this.__extends||function(){var e=
function(b,a){e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])};return e(b,a)};return function(b,a){function f(){this.constructor=b}e(b,a);b.prototype=null===a?Object.create(a):(f.prototype=a.prototype,new f)}}(),U=this&&this.__awaiter||function(e,b,a,f){function c(b){return b instanceof a?b:new a(function(a){a(b)})}return new (a||(a=Promise))(function(a,g){function d(a){try{l(f.next(a))}catch(m){g(m)}}
function h(a){try{l(f["throw"](a))}catch(m){g(m)}}function l(b){b.done?a(b.value):c(b.value).then(d,h)}l((f=f.apply(e,b||[])).next())})},V=this&&this.__generator||function(e,b){function a(a){return function(b){return f([a,b])}}function f(a){if(h)throw new TypeError("Generator is already executing.");for(;c;)try{if(h=1,g&&(d=a[0]&2?g["return"]:a[0]?g["throw"]||((d=g["return"])&&d.call(g),0):g.next)&&!(d=d.call(g,a[1])).done)return d;if(g=0,d)a=[a[0]&2,d.value];switch(a[0]){case 0:case 1:d=a;break;
case 4:return c.label++,{value:a[1],done:!1};case 5:c.label++;g=a[1];a=[0];continue;case 7:a=c.ops.pop();c.trys.pop();continue;default:if(!(d=c.trys,d=0<d.length&&d[d.length-1])&&(6===a[0]||2===a[0])){c=0;continue}if(3===a[0]&&(!d||a[1]>d[0]&&a[1]<d[3]))c.label=a[1];else if(6===a[0]&&c.label<d[1])c.label=d[1],d=a;else if(d&&c.label<d[2])c.label=d[2],c.ops.push(a);else{d[2]&&c.ops.pop();c.trys.pop();continue}}a=b.call(e,c)}catch(n){a=[6,n],g=0}finally{h=d=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:
void 0,done:!0}}var c={label:0,sent:function(){if(d[0]&1)throw d[1];return d[1]},trys:[],ops:[]},h,g,d,k;return k={next:a(0),"throw":a(1),"return":a(2)},"function"===typeof Symbol&&(k[Symbol.iterator]=function(){return this}),k};A=function(e){function b(a,b,c,h){a=e.call(this,a,b,c)||this;a._queryRoot=h;return a}T(b,e);b.prototype.trigger=function(){var a=this;p.queueTask(function(){return U(a,void 0,void 0,function(){var a;return V(this,function(c){switch(c.label){case 0:return[4,p.waitTillIdleOrTimeout(b._IDLE_TIMEOUT)];
case 1:return c.sent(),this.ready()?[4,this.collect(this._queryRoot)]:(this.logCount("NotReady"),[2]);case 2:return a=c.sent(),this._send(a),[2]}})})})};b.prototype.logCount=function(a,b){e.prototype.logCount.call(this,"PAHC:"+a,b)};b.prototype._send=function(a){a=[{nature:b._RENDERING_HINTS_NATURE,data:a,source:this._getSource()}];this.logCount("Targets");this.sendToWorker(a)};b.prototype._getSource=function(){return{url:this.global.location.href,pty:q.getPageType(this.global),spty:q.getSubPageType(this.global),
rid:q.getRequestId(this.global)}};b._IDLE_TIMEOUT=1E3;b._RENDERING_HINTS_NATURE="page_attributes";return b}(y);var W=this&&this.__extends||function(){var e=function(b,a){e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])};return e(b,a)};return function(b,a){function f(){this.constructor=b}e(b,a);b.prototype=null===a?Object.create(a):(f.prototype=a.prototype,new f)}}(),H=this&&this.__awaiter||function(e,
b,a,f){function c(b){return b instanceof a?b:new a(function(a){a(b)})}return new (a||(a=Promise))(function(a,g){function d(a){try{l(f.next(a))}catch(m){g(m)}}function h(a){try{l(f["throw"](a))}catch(m){g(m)}}function l(b){b.done?a(b.value):c(b.value).then(d,h)}l((f=f.apply(e,b||[])).next())})},I=this&&this.__generator||function(e,b){function a(a){return function(b){return f([a,b])}}function f(a){if(h)throw new TypeError("Generator is already executing.");for(;c;)try{if(h=1,g&&(d=a[0]&2?g["return"]:
a[0]?g["throw"]||((d=g["return"])&&d.call(g),0):g.next)&&!(d=d.call(g,a[1])).done)return d;if(g=0,d)a=[a[0]&2,d.value];switch(a[0]){case 0:case 1:d=a;break;case 4:return c.label++,{value:a[1],done:!1};case 5:c.label++;g=a[1];a=[0];continue;case 7:a=c.ops.pop();c.trys.pop();continue;default:if(!(d=c.trys,d=0<d.length&&d[d.length-1])&&(6===a[0]||2===a[0])){c=0;continue}if(3===a[0]&&(!d||a[1]>d[0]&&a[1]<d[3]))c.label=a[1];else if(6===a[0]&&c.label<d[1])c.label=d[1],d=a;else if(d&&c.label<d[2])c.label=
d[2],c.ops.push(a);else{d[2]&&c.ops.pop();c.trys.pop();continue}}a=b.call(e,c)}catch(n){a=[6,n],g=0}finally{h=d=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}var c={label:0,sent:function(){if(d[0]&1)throw d[1];return d[1]},trys:[],ops:[]},h,g,d,k;return k={next:a(0),"throw":a(1),"return":a(2)},"function"===typeof Symbol&&(k[Symbol.iterator]=function(){return this}),k},X=function(e){function b(a,b,c,h){a=e.call(this,a,b,c,a.document)||this;if(!h.capabilities.mobile)return a;a.trigger();
return a}W(b,e);b.prototype.collect=function(a){return H(this,void 0,void 0,function(){var b,c,e;return I(this,function(f){switch(f.label){case 0:return b={},(c=this._getWDGFromUSS(a))||(c=this._getWDGFromAODScript(a)),c||(c=this._getWDGFromDPContainer(a)),c?b.wdg=c:this.logCount("WDG:NONE"),[4,this._getLCPImageUrl()];case 1:return(e=f.sent())?b.lcpImage=e:this.logCount("LCP:NONE"),[2,b]}})})};b.prototype._getWDGFromUSS=function(a){if((a=a.querySelector(b._USS_SELECTOR))&&a.value)return this.logCount("WDG:USS"),
a.value};b.prototype._getWDGFromAODScript=function(a){if((a=a.querySelector(b._AOD_SCRIPT_SELECTOR))&&(a=a.textContent)&&(a=a.match(b._AOD_SCRIPT_REGEXP))&&a[1])return this.logCount("WDG:AOD"),a[1]};b.prototype._getWDGFromDPContainer=function(a){if(a=a.querySelector(b._DP_CONTAINER_SELECTOR))if(a=a.className.trim().split(" ")[0])return this.logCount("WDG:CID"),a.replace(b._WDG_CLASS_SUFFIX,b._WDG_SUFFIX)};b.prototype._getLCPImageUrl=function(){return H(this,void 0,void 0,function(){var a,e,c;return I(this,
function(f){switch(f.label){case 0:a=function(a){var c=r.isObject,e=r.isNonEmptyString;return!(!c(a)||a.id!==b._IMAGE_BLOCK_MAIN_IMAGE_ID||!e(a.url))},f.label=1;case 1:return f.trys.push([1,3,,4]),[4,Promise.race([z.getMatchingEntry(a),p.wait(b._LCP_RESOLUTION_TIMEOUT).then(function(){return"timeout"})])];case 2:e=f.sent();if("timeout"===e)return this.logCount("LCPT"),[2];this.logCount("LCPI");return[2,e?e.url:t];case 3:return c=f.sent(),this.logCount("LCPE"),this.logError(c,{logLevel:"WARN",message:"Failed to fetch LCP image."}),
[2];case 4:return[2]}})})};b._DP_CONTAINER_SELECTOR="#dp";b._USS_SELECTOR="input#uss-mraiCategory";b._AOD_SCRIPT_SELECTOR="#all-offers-display ~ script";b._AOD_SCRIPT_REGEXP=/AOD assets for WDG:\s*(\w+)/;b._IMAGE_BLOCK_MAIN_IMAGE_ID="main-image";b._LCP_RESOLUTION_TIMEOUT=1E3;b._WDG_CLASS_SUFFIX="_mobile";b._WDG_SUFFIX="_display_on_website";return b}(A),Y=this&&this.__extends||function(){var e=function(b,a){e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,
b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])};return e(b,a)};return function(b,a){function f(){this.constructor=b}e(b,a);b.prototype=null===a?Object.create(a):(f.prototype=a.prototype,new f)}}(),Z=this&&this.__awaiter||function(e,b,a,f){function c(b){return b instanceof a?b:new a(function(a){a(b)})}return new (a||(a=Promise))(function(a,g){function d(a){try{l(f.next(a))}catch(m){g(m)}}function h(a){try{l(f["throw"](a))}catch(m){g(m)}}function l(b){b.done?a(b.value):c(b.value).then(d,h)}l((f=
f.apply(e,b||[])).next())})},aa=this&&this.__generator||function(e,b){function a(a){return function(b){return f([a,b])}}function f(a){if(h)throw new TypeError("Generator is already executing.");for(;c;)try{if(h=1,g&&(d=a[0]&2?g["return"]:a[0]?g["throw"]||((d=g["return"])&&d.call(g),0):g.next)&&!(d=d.call(g,a[1])).done)return d;if(g=0,d)a=[a[0]&2,d.value];switch(a[0]){case 0:case 1:d=a;break;case 4:return c.label++,{value:a[1],done:!1};case 5:c.label++;g=a[1];a=[0];continue;case 7:a=c.ops.pop();c.trys.pop();
continue;default:if(!(d=c.trys,d=0<d.length&&d[d.length-1])&&(6===a[0]||2===a[0])){c=0;continue}if(3===a[0]&&(!d||a[1]>d[0]&&a[1]<d[3]))c.label=a[1];else if(6===a[0]&&c.label<d[1])c.label=d[1],d=a;else if(d&&c.label<d[2])c.label=d[2],c.ops.push(a);else{d[2]&&c.ops.pop();c.trys.pop();continue}}a=b.call(e,c)}catch(n){a=[6,n],g=0}finally{h=d=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}var c={label:0,sent:function(){if(d[0]&1)throw d[1];return d[1]},trys:[],ops:[]},h,g,d,k;return k=
{next:a(0),"throw":a(1),"return":a(2)},"function"===typeof Symbol&&(k[Symbol.iterator]=function(){return this}),k},ba=function(e){function b(a,b,c,h){var f=e.call(this,a,b,c)||this;f._previouslySeen=new Set;f._buffer=[];f._pendingBufferLength=0;f._queryRoot=h;f._targetPrefix=a.location.origin;f._observer=new MutationObserver(function(a){f._handleMutations(a)});f.trigger();return f}Y(b,e);b.prototype.trigger=function(){var a=this;p.queueTask(function(){return Z(a,void 0,void 0,function(){return aa(this,
function(a){switch(a.label){case 0:return[4,p.waitTillIdleOrTimeout(b._IDLE_TIMEOUT)];case 1:a.sent();if(!this.ready())return this._logCount("NotReady"),[2];this._collectAnchorTags(this._queryRoot,!0);this._observer.observe(this._queryRoot,{childList:!0,subtree:!0});return[2]}})})})};b.prototype._collectAnchorTags=function(a,e){var c=performance.now();a=a.querySelectorAll(b._ANCHOR_SELECTOR);for(var f=0;f<a.length;f++)this._addTarget(a[f].href);c=performance.now()-c;this._logCount((e?"InitialScan":
"")+"TimeToCollectHintsDuration",c);this._queueSend()};b.prototype._handleMutations=function(a){var b=this;a.filter(function(a){return"childList"===a.type}).forEach(function(a){Array.from(a.addedNodes).forEach(function(a){if(a instanceof HTMLElement||a instanceof DocumentFragment)a instanceof HTMLAnchorElement?(b._addTarget(a.href),b._queueSend()):b._collectAnchorTags(a)})})};b.prototype._addTarget=function(a){a&&0===a.indexOf(this._targetPrefix)&&!this._previouslySeen.has(a)&&(this._previouslySeen.add(a),
this._buffer.push(a))};b.prototype._queueSend=function(){var a=this;if(1>this._buffer.length)this._pendingBufferLength=0;else{if(this._pendingSend){if(this._buffer.length<=this._pendingBufferLength)return;p.clearQueuedTask(this._pendingSend)}this._pendingSend=p.queueTask(function(){a._send(a._buffer.slice());a._pendingBufferLength=a._buffer.length=0;a._pendingSend=t},b._SEND_DEBOUNCE_MS);this._pendingBufferLength=this._buffer.length}};b.prototype._send=function(a){if(0!==a.length){var e=[{nature:b._RENDERING_HINTS_NATURE,
data:{targets:a},source:this._getSource()}];this._logCount("Targets",a.length);this.sendToWorker(e)}};b.prototype._logCount=function(a,b){e.prototype.logCount.call(this,"NTHC:"+a,b)};b.prototype._getSource=function(){return{url:this.global.location.href,pty:q.getPageType(this.global),spty:q.getSubPageType(this.global),rid:q.getRequestId(this.global)}};b._IDLE_TIMEOUT=1E3;b._RENDERING_HINTS_NATURE="navigation_targets";b._ANCHOR_SELECTOR="a[href]";b._SEND_DEBOUNCE_MS=100;return b}(y);y=function(){function e(b,
a,e,c){var f=this;this.global=b;this.csmLogger=a;this.P=e;this.A=c;"complete"===b.document.readyState?this.survey():b.addEventListener("load",function(){f.survey()})}e.prototype.getResourceTimingRecords=function(b){var a=this.global.performance.getEntriesByType("resource");return"function"===typeof b?a.filter(b):a};e.prototype.getServerTimingRecords=function(){var b=this.global.performance.getEntriesByType("navigation")[0];return b&&b.serverTiming?b.serverTiming.filter(function(a){return a.name===
e._SERVER_TIMING_NAME}).map(function(a){if(a.description)try{return JSON.parse(decodeURIComponent(a.description))}catch(f){}}).filter(function(a){return!!a}):[]};e.prototype.getEpochForPerformanceTimeline=function(b){return Math.round(this.global.performance.timeOrigin+b)};e.prototype.logTag=function(b){this.csmLogger.tag(this._getMetricName(b))};e.prototype.logCount=function(b,a){this.csmLogger.count(this._getMetricName(b),a)};e.prototype.logWidgetLatency=function(b,a,e){a=this._getMetricName(a);
this.csmLogger.widgetLatency(b,a,e)};e.prototype.logError=function(b,a){this.csmLogger.logError(b,a)};e.prototype._getMetricName=function(b){return"RenderingHints:Survey:"+b};e._SERVER_TIMING_NAME="lightsaber";return e}();var ca=this&&this.__extends||function(){var e=function(b,a){e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])};return e(b,a)};return function(b,a){function f(){this.constructor=b}e(b,
a);b.prototype=null===a?Object.create(a):(f.prototype=a.prototype,new f)}}(),D=this&&this.__awaiter||function(e,b,a,f){function c(b){return b instanceof a?b:new a(function(a){a(b)})}return new (a||(a=Promise))(function(a,g){function d(a){try{l(f.next(a))}catch(m){g(m)}}function h(a){try{l(f["throw"](a))}catch(m){g(m)}}function l(b){b.done?a(b.value):c(b.value).then(d,h)}l((f=f.apply(e,b||[])).next())})},E=this&&this.__generator||function(e,b){function a(a){return function(b){return f([a,b])}}function f(a){if(h)throw new TypeError("Generator is already executing.");
for(;c;)try{if(h=1,g&&(d=a[0]&2?g["return"]:a[0]?g["throw"]||((d=g["return"])&&d.call(g),0):g.next)&&!(d=d.call(g,a[1])).done)return d;if(g=0,d)a=[a[0]&2,d.value];switch(a[0]){case 0:case 1:d=a;break;case 4:return c.label++,{value:a[1],done:!1};case 5:c.label++;g=a[1];a=[0];continue;case 7:a=c.ops.pop();c.trys.pop();continue;default:if(!(d=c.trys,d=0<d.length&&d[d.length-1])&&(6===a[0]||2===a[0])){c=0;continue}if(3===a[0]&&(!d||a[1]>d[0]&&a[1]<d[3]))c.label=a[1];else if(6===a[0]&&c.label<d[1])c.label=
d[1],d=a;else if(d&&c.label<d[2])c.label=d[2],c.ops.push(a);else{d[2]&&c.ops.pop();c.trys.pop();continue}}a=b.call(e,c)}catch(n){a=[6,n],g=0}finally{h=d=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}var c={label:0,sent:function(){if(d[0]&1)throw d[1];return d[1]},trys:[],ops:[]},h,g,d,k;return k={next:a(0),"throw":a(1),"return":a(2)},"function"===typeof Symbol&&(k[Symbol.iterator]=function(){return this}),k},da=function(e){function b(){return null!==e&&e.apply(this,arguments)||this}
ca(b,e);b.prototype.survey=function(){return D(this,void 0,void 0,function(){return E(this,function(a){switch(a.label){case 0:return[4,this._surveyLCPImagePreload()];case 1:return a.sent(),[2]}})})};b.prototype._surveyLCPImagePreload=function(){return D(this,void 0,void 0,function(){var a,e;return E(this,function(c){switch(c.label){case 0:return[4,this._getLCPImageUrl()];case 1:a=c.sent();if(!a)return this._logCount("LCP:ImageNotFound",1),[2];e=this._getPreloadedUrlRecord(b._RECORD_PURPOSE_PREFIX+
":LCP");if(!e)return this._logCount("LCP:HintNotFound",1),[2];this._logMatch("LCP",a,e.href,e.attribution);return[2]}})})};b.prototype._getLCPImageUrl=function(){return D(this,void 0,void 0,function(){var a,e;return E(this,function(c){switch(c.label){case 0:a=function(a){var c=r.isObject,d=r.isNonEmptyString;return!(!c(a)||a.id!==b._IMAGE_BLOCK_MAIN_IMAGE_ID||!d(a.url))},c.label=1;case 1:return c.trys.push([1,3,,4]),[4,Promise.race([z.getMatchingEntry(a),p.wait(b._LCP_RESOLUTION_TIMEOUT).then(function(){return"timeout"})])];
case 2:return e=c.sent(),"timeout"===e?(this._logCount("LCP:LCPTimeout",1),[2]):[2,e?e.url:t];case 3:return c.sent(),this._logCount("LCP:LCPError",1),[2];case 4:return[2]}})})};b.prototype._getPreloadedUrlRecord=function(a){var e=this.getServerTimingRecords().filter(function(c){return c.role===b._RECORD_ROLE&&c.purpose===a.toLowerCase()&&c.as===b._RECORD_AS});return 0<e.length?e[0]:t};b.prototype._logMatch=function(a,b,c,e){var f=this._hitOrMiss(c===b);this._logCount(a+":"+f,1);e&&this._logCount(a+
":"+f+":"+e,1);c!==b&&this._logURLMismatchDetails(b,c)};b.prototype._logCount=function(a,e){this.logCount(b._METRIC_PREFIX+":"+a,e)};b.prototype._hitOrMiss=function(a){return a?"Hit":"Miss"};b.prototype._logURLMismatchDetails=function(a,b){this.logError(Error("Found URL mismatch between preloaded and LCP image URL. "+("Preload URL: "+b+" and Image URL: "+a)),{logLevel:"WARN"})};b._RECORD_ROLE="rendering-hints/preload";b._RECORD_PURPOSE_PREFIX="detail-landing-image";b._RECORD_AS="image";b._METRIC_PREFIX=
"DetailLandingImagePreload";b._IMAGE_BLOCK_MAIN_IMAGE_ID="main-image";b._LCP_RESOLUTION_TIMEOUT=1E3;return b}(y),ea=function(){function e(b,a,e,c,h){this._global=b;this._P=a;this._A=e;this._workerMessaging=c;this._csmLogger=h}e.prototype.start=function(){switch(q.getPageTypeGroup(this._global)){case "Search":var b=document.getElementById("search");new C(this._global,this._workerMessaging,this._csmLogger,b);new S(this._global,this._workerMessaging,this._csmLogger,this._P,this._A,b);break;case "Detail":b=
document.getElementById("dp"),new X(this._global,this._workerMessaging,this._csmLogger,this._A),new C(this._global,this._workerMessaging,this._csmLogger,b),new da(this._global,this._csmLogger,this._P,this._A)}this._isSupportedAndroidMshopClient()&&new ba(this._global,this._workerMessaging,this._csmLogger,document.body)};e.prototype._isSupportedAndroidMshopClient=function(){return this._A.capabilities.isAmazonApp&&this._A.capabilities.android};return e}();(function(){function e(b){this._hit=!(!b.$Lightsaber||
!b.$Lightsaber.hit);try{var a=b.$Lightsaber&&b.$Lightsaber.meta?u.deep(b.$Lightsaber.meta):t;this._meta=this._isValid(a)?a:t}catch(f){this._meta=t}}e.prototype.isHit=function(){return this._hit};e.prototype.getMeta=function(){return this._meta};e.prototype._isValid=function(b){var a=r.isObject,e=r.isNonEmptyString,c=r.isPositiveInteger;return!!(b&&a(b)&&c(b.fetchEventTimeOrigin)&&e(b.navigationRule)&&a(b.responseStrategy)&&e(b.responseStrategy.name)&&a(b.clientLib)&&e(b.clientLib.version))};return e})();
var fa=function(){function e(b){this._global=b}e.prototype.send=function(b,a){b={feature:e.FEATURE,command:b,options:a};(a=this._getCurrentController())?(x.log("ServiceWorker:PostMessage:",b),a.postMessage(b)):x.log("ServiceWorker:Unavailable:",b)};e.prototype.ready=function(){return!!this._getCurrentController()};e.prototype._getCurrentController=function(){if(this._global&&this._global.navigator&&this._global.navigator.serviceWorker&&this._global.navigator.serviceWorker.controller&&r.isFunction(this._global.navigator.serviceWorker.controller.postMessage))return this._global.navigator.serviceWorker.controller};
e.FEATURE="lightsaber";return e}();(function(){v.when("A").execute("lightsaber:page",function(e){var b=new L(w),a=new fa(w);b.count("AssetLoaded");v.now().register("lightsaber:page:rendering-metrics",function(){});v.when("ready").register("lightsaber:page:rendering-hints",function(){(new ea(w,v,e,a,b)).start()})})})()})()});