(function(p){var q=window.AmazonUIPageJS||window.P,w=q._namespace||q.attributeErrors,m=w?w("DetailPageOffersDebugAssets",""):q;m.guardFatal?m.guardFatal(p)(m,window):m.execute(function(){p(m,window)})})(function(p,q,w){function m(b){for(var k="",e=0;e<b;e++)k+="\x26nbsp;\x26nbsp;";return k}function D(b,k){for(var e=1,f="",l=1,n=!0,d="",u=0;u<b.length;u++){var g=b[u];"{"===g||"["===g?(d+=g,d+='\x3cspan id\x3d"'+k+l+'separator" class\x3d"debugger-hide-item"\x3e . . . \x3c/span\x3e',d+='\x3cspan id\x3d"'+
k+l+'collapse"\x3e',0!==f.length&&(f+="\x3ci id\x3d'"+k+l+"' class\x3d'a-icon a-icon-collapse custom-icon collapsable-debag-element'\x3e\x3c/i\x3e "),f+=d,d="",n=!0,l++,e+=2):"}"===g||"]"===g?(e--,f+=d,f+="\x3cbr /\x3e"+m(e)+"\x3c/span\x3e",f+=g,d="",e--):","===g?(f+=d,f+=g,d="",n=!0):(n&&0!==f.length&&(f+="\x3cbr /\x3e"+m(e)),d+=g,n=!1);0>e&&(e=0)}return f+d}function E(b){b.preventDefault();var k=v-b.clientX,e=z-b.clientY;v=b.clientX;z=b.clientY;r.style.top=r.offsetTop-e+"px";r.style.left=r.offsetLeft-
k+"px"}function F(){document.onmouseup=null;document.onmousemove=null}p.when("jQuery","ready").register("offers-debug-main",function(b){function k(b){if(x!==w){var a=x.indexOf(v);x[a+1]="offersDebug-"+b+"\x3d1";b=y.split("?");b[1]=x.join("\x26");y=b.join("?");q.history.replaceState("","",y)}}function e(a){b(g).removeClass("clicked-color");g=a;b(g).addClass("clicked-color")}var f=b("#buybox"),l=100+f.position().left-f.offset().left,n=f.offset().top;f.offset().top!==f.position().top&&(n=0);b("#offersDebug").css({left:l,
top:n});var d=b("#links"),u=d,g=b("#linksSelector"),a=b("#linksSelector"),c=b("#links");a.click(function(){d.hide();c.show();d=c;e(a);k(b(this).attr("id"))});var h=b("#mbosSelector"),A=b("#mbos");h.click(function(){d.hide();A.show();d=A;e(h);k(b(this).attr("id"))});b(".aapiSelector").click(function(){var a=b(this).attr("id"),c=a.split("-")[1];c=b("#aapi-"+c);d.hide();c.show();d=c;e("#"+a);k(a)});b(".featureSelector").click(function(){var a=b(this).attr("id"),c=a.split("-");c=b("#feature-"+(c[2]+"_"+
c[1]+"_"+c[3]));d.hide();c.show();d=c;e("#"+a);k(a)});b(".moduleSelector").click(function(){var a=b(this).attr("id"),c=a.split("-");c=c[2]+"_"+c[5]+"_"+c[3];var h=b("#module-"+c);d.hide();h.show();d=h;e("#"+a);k(a);a=c.split("_");c=b("#"+a[0]);a=c.length?c.find("#"+a[1]+"_feature_div"):b("#"+a[1]+"_feature_div");u.css({"outline-style":""});a.css({"outline-style":"dotted"});u=a});var m=b("#logsSelector"),p=b("#logs");m.click(function(){d.hide();p.show();d=p;e(m);k(b(this).attr("id"))});var r=b("#metricsSelector"),
t=b("#metrics");r.click(function(){d.hide();t.show();d=t;e(r);k(b(this).attr("id"))});b(".collapsable-debag-element").click(function(){var a=b(this).attr("id"),c=b("#"+a+"collapse"),h=b("#"+a+"separator");a=b("#"+a);"none"===c.css("display")?(c.show(),h.hide(),a.removeClass("a-icon-expand"),a.addClass("a-icon-collapse")):(c.hide(),h.show(),a.removeClass("a-icon-collapse"),a.addClass("a-icon-expand"))});var v="offersDebug\x3d1",y=q.location.href,x=function(a){a=a.split("?")[1].split(/[&,#]/);var c=
a.indexOf(v);if(c<a.length-1){var h=a[c+1].split(/[-,=]/);if(0===h.indexOf("offersDebug")){var d=h[1];if("linksSelector"===d||"mbosSelector"===d||"logsSelector"===d||"metricsSelector"===d)b("#"+d).click();else if("aapiSelector"===d)d=a[c+1].indexOf("-"),d=a[c+1].slice(d+1,-2),b("#aapiExpander").click(),b("#"+d).click();else if("featureSelector"===d||"moduleSelector"===d){var e=a[c+1].indexOf("-");c=a[c+1].slice(e+1,-2);b("#"+c).click();var f=h[2];c=h[3];e=h[4];h=h[5];"moduleSelector"===d&&(d="featureModulesExpander-"+
[f,c,e,h].join("-"),b("#"+d).click());for(;f!==h;)d="featureExpander-"+[f,c,e,h].join("-"),b("#"+d).click(),f=h,h=document.querySelector("[id^\x3d"+("featureExpander-"+f+"-"+c+"-"+e)+"]").getAttribute("id").split("-")[4],d="subFeaturesExpander-"+[f,c,e,h].join("-"),b("#"+d).click();d="featureExpander-"+[f,c,e,h].join("-");b("#"+d).click();b("#featuresExpander").click()}}else a.splice(c+1,0,"")}else a.push("");return a}(y)});"use strict";for(var B=document.getElementsByClassName("debugJson"),t=0;t<
B.length;t++){var C=B[t];C.innerHTML=D(C.innerHTML,"debugJson"+t+"_")}"use strict";var v=0,z=0;document.getElementById("offersDebugHeader").onmousedown=function(b){b.preventDefault();v=b.clientX;z=b.clientY;document.onmouseup=F;document.onmousemove=E};var r=document.getElementById("offersDebug");"use strict";p.when("jQuery","ready").register("offers-debug-mobile",function(b){function k(a){for(var c=a[0],b=1;b<a.length;++b)c+="-"+a[b];return c}function e(a,c){for(var b="",d=0;d<a.length;++d)b+=a[d]+
"-";return b+c}function f(a){var c="";if(3>=a.length)for(var b=0;b<a.length;++b)c+=a[b].split("_")[0]+" / ";else c+=a[0]+"/.../"+a[a.length-1].split("_")[0];return c}var l=[],n=b("#gsodDebugViewableContent"),d=b("#mobileBackButton"),m=b("#currentPath");if(0===l.length){var g=b('div[data-unitfor\x3d"home"]').html();b("#gsodDebugViewableContent").html(g);l.push("home")}n.click(function(a){if(a.target.classList.contains("navigational-link")||a.target.classList.contains("copy-link")){var c=a.target.getAttribute("data-navigationName"),
h=e(l,c),g="";b('#gsodDebugAllFeatures div[data-unitfor\x3d"'+h.toString()+'"]').each(function(a,c){g+=c.innerHTML});a.target.classList.contains("copy-link")?navigator.clipboard&&q.isSecureContext?navigator.clipboard.writeText(JSON.stringify(g,w,4)).then(function(a){alert("Copied "+c)}).catch(function(a){alert("Failed to copy "+c+a)}):(a=document.createElement("textarea"),a.value=g,a.style.position="absolute",a.style.left="-999999px",document.body.prepend(a),a.select(),document.execCommand("copy"),
a.remove(),alert("Copied "+c)):(n.html(""),l.push(c),n.html(g),m.text(f(l)),d.removeClass("aok-hidden"))}});d.click(function(){l.pop();var a=k(l);1===l.length&&d.addClass("aok-hidden");var c="";b('div[data-unitfor\x3d"'+a.toString()+'"]').each(function(a,b){c+=b.innerHTML});n.html("");n.html(c);m.text(f(l))});p.when("offers-debug-icdp").execute(function(a){a.init()})});"use strict";p.when("jQuery","icdp","ready").register("offers-debug-icdp",function(b,k){function e(){var a=new URLSearchParams(q.location.search),
c=a.has("icdpClientId")?a.get("icdpClientId"):"buyAgain",b=a.has("icdpExperience")?a.get("icdpExperience"):"inspiration";a=a.has("icdpTreatment")?a.get("icdpTreatment"):"T1";c={state:{clientId:c,experience:b,treatment:a},callbacks:{success:function(){console.debug("\x3e\x3e\x3eicdpTest; ICDP registered successfully")},failure:function(a){console.error("\x3e\x3e\x3eicdpTest; ICDP registration failed",a)}},viewCallbacks:{beforeSheetShow:function(){console.debug("\x3e\x3e\x3eicdpTest; beforeSheetShow")},
afterSheetShow:function(){console.debug("\x3e\x3e\x3eicdpTest; afterSheetShow")},beforeSheetHide:function(){console.debug("\x3e\x3e\x3eicdpTest; beforeSheetHide")},afterSheetHide:function(){console.debug("\x3e\x3e\x3eicdpTest; afterSheetHide")}}};g||(g=new k(c));console.debug("\x3e\x3e\x3eicdpTest; instance created",g)}function f(a){var c={};location.search&&location.search.substring(1).split("\x26").forEach(function(b){var d=b.split("\x3d");b=d[0];d=d[1];b&&b.endsWith(a)&&d&&(c[b.slice(0,-a.length)]=
decodeURIComponent(d.replace(/\+/g," ")))});return c}function l(a){console.warn("\x3e\x3e\x3eicdpTest; openIcdpFunc() currently only supports opening 1 ASIN, opening...",a[0]);a=a[0];var b=f("_icdp");console.log("\x3e\x3e\x3eicdp urlParameters\x3e\x3e"+b);g&&g.loadICDP({state:{selectedIndex:0,list:[{asin:a,urlParameters:b}]}})}function n(a){if(g&&"function"===typeof g.prefetchICDP&&a&&a.length){var b=Object.assign({},f("_icdp"),f("_pre-icdp"));console.log("\x3e\x3e\x3eicdp prefetch urlParameters\x3e\x3e"+
b);var d=[];a.forEach(function(a){d.push({asin:a,urlParameters:b});console.log("\x3e\x3e\x3eicdp prefetching asin\x3e\x3e"+a)});g.prefetchICDP(d)}}function d(a){console.debug("\x3e\x3e\x3eicdpTest; injecting icdp links into page...");var c='\x3cdiv class\x3d"icdp-test-links"\x3e\x3ch3\x3eICDP Test Links\x3c/h3\x3e';a.forEach(function(a){c+='\x3cbutton id\x3d"icdp-container-'+a+'" class\x3d"icdp-link"\x3e'+a+"\x3c/button\x3e\x3cbr/\x3e"});c+="\x3c/div\x3e";b("span:contains(GSOD Debug Tool)").first().after(c);
b(document).delegate(".icdp-link","click",function(a){l([a.target.textContent])})}function m(a){console.debug("\x3e\x3e\x3eicdpTest; injecting icdp link into gsod tool menu v2...");document.querySelector("#gsodDebugViewableContent .a-section").insertAdjacentHTML("beforeend",'\x3ca class\x3d"a-link-normal" href\x3d"javascript:void(0)"\x3e\x3cdiv data-navigationname\x3d"icdp" class\x3d"a-section navigational-link"\x3eICDP\x3c/div\x3e\x3c/a\x3e');document.querySelector('#gsodDebugAllFeatures div[data-unitfor\x3d"home"] .a-section').insertAdjacentHTML("beforeend",
'\x3ca class\x3d"a-link-normal" href\x3d"javascript:void(0)"\x3e\x3cdiv data-navigationname\x3d"icdp" class\x3d"a-section navigational-link"\x3eICDP\x3c/div\x3e\x3c/a\x3e');a='\x3cdiv class"a-section" data-unitfor\x3d"home-icdp"\x3e\x3ca href\x3d"#" class\x3d"open-icdp"\x3eOpen ICDP with ASINs\x3c/a\x3e\x3cinput type\x3d"text" class\x3d"icdp-asins" name\x3d"icdp-asins" value\x3d"'+a.join(",")+'"/\x3e\x3c/div\x3e';document.querySelector("#gsodDebugAllFeatures").insertAdjacentHTML("beforeend",a);b(document).delegate(".open-icdp",
"click",function(a){a=a.target.parentElement.querySelector(".icdp-asins").value;a=(a?a:"").split(",");l(a)})}console.debug("\x3e\x3e\x3eicdpTest; icdpTestInit() start");var g;return{init:function(){var a=new URLSearchParams(q.location.search),b=a.has("icdpAsins")?a.get("icdpAsins"):"";a=a.has("icdpPrefetchAsins")?a.get("icdpPrefetchAsins"):"";b=b.split(",");a=a.split(",");e();n(a);d(b);m(b);console.debug("\x3e\x3e\x3eicdpTest; icdpTestInit() end")},open:l,prefetch:n}})});