'use strict';mix_d("CustomerReviewsMediaCards__cr-media-carousel:cr-media-carousel__2ZOpFiAM","exports tslib @c/browser-operations @c/aui-feature-detect @c/scoped-dom @c/metrics @c/navigation @c/dom @c/remote-operations @c/logger @p/A".split(" "),function(pb,g,Ob,Pb,Qb,qb,Rb,ia,qa,rb,Sb){function ra(a){return a&&"object"===typeof a&&"default"in a?a:{"default":a}}function sb(a,b,c){return"https://"+Aa()+"/portal/customer-reviews/media-gallery/ref="+a+"?ie=UTF8&asin="+c+"&mediaType="+b}function Aa(){var a=
Z["default"].getLocation&&Z["default"].getLocation().hostname||location.href,b=Z["default"].getLocation&&Z["default"].getLocation().host||location.host;return"localhost"===a?"pre-prod.amazon.com":b}function Sa(a){return a?a===F.IMAGE?ea.IMAGE:ea.VIDEO:ea.ALL}function Tb(a){return Object.keys(a).map(function(b){return b+"="+a[b]}).join("&")}function Ub(a,b){return g.__awaiter(this,void 0,void 0,function(){var c,d,e;return g.__generator(this,function(f){c=b.mediaType;d=b.metricsPrefix;K.logCounter(d+
"IvxClicked",1);e=Date.now();a.navigate({url:Vb(b),successCallback:function(){var h=Date.now()-e;K.logCounter(d+"IvxNavigatedDuration",h);K.logCounter(d+"IvxNavigated",1);K.logNoError("loadIVXError",c)},failCallback:function(h){K.logCounter(d+"IvxNavigated",0);tb("Failed to load SSNAP immersive modal for media: "+JSON.stringify(b)+".",h);K.logError("loadIVXError",c)}});return[2]})})}function Vb(a){var b=g.__assign,c=g.__assign,d=a.hidePivot,e=a.ingressType,f=a.isSingleReview,h=a.asin,l=a.refMarker,
m=a.metricsPrefix,q=a.reviewId,n=JSON,y=n.stringify;var k=a.mediaType===F.VIDEO;k=g.__assign({imageUrl:k?a.thumbnailUrl:a.url,physicalId:a.physicalId},k&&{videoUrl:a.url});a=b.call(g,c.call(g,{hidePivot:d,ingressType:e,isSingleReview:f,productAsin:h,refMarker:l,metricsPrefix:m,reviewId:q,viewData:y.call(n,[k])},a.filter&&{filter:a.filter}),a.mediaType===F.VIDEO?{videoUrl:a.url}:{imageUrl:a.url});return"ssnap://www.amazon.com/ive?"+Tb(a)}var H=ra(Ob),ub=ra(Pb),W=ra(Qb),Z=ra(Rb),Q=ra(ia),fa=ra(qa),
Ha=ra(Sb),F;(function(a){a.IMAGE="IMAGE";a.VIDEO="VIDEO"})(F||(F={}));var Ta=F,Ua,Wb=function(){return g.__awaiter(void 0,void 0,void 0,function(){return g.__generator(this,function(a){return[2,new Promise(function(b){P.now("mash").execute(function(c){b(c)})})]})})},Va=function(){return g.__awaiter(void 0,void 0,void 0,function(){return g.__generator(this,function(a){switch(a.label){case 0:return Ua?[3,2]:[4,Wb()];case 1:Ua=a.sent(),a.label=2;case 2:return[2,Ua]}})})},Xb=function(){return g.__awaiter(void 0,
void 0,void 0,function(){return g.__generator(this,function(a){switch(a.label){case 0:return[4,Va()];case 1:return[2,!!a.sent()]}})})},ca;(function(a){a.MWEB="mWeb";a.MSHOP="mShop";a.DESKTOP="desktop"})(ca||(ca={}));var Wa=function(){return g.__awaiter(void 0,void 0,void 0,function(){return g.__generator(this,function(a){switch(a.label){case 0:return[4,Xb()];case 1:return[2,a.sent()]}})})},vb=function(){return"true"===W["default"].cardRoot.getAttribute("data-mobile")||ub["default"].isSupported("mobile")},
Yb=function(){return g.__awaiter(void 0,void 0,void 0,function(){var a;return g.__generator(this,function(b){switch(b.label){case 0:return(a=vb())?[4,Wa()]:[3,2];case 1:a=!b.sent(),b.label=2;case 2:return[2,a]}})})},wb=function(){return g.__awaiter(void 0,void 0,void 0,function(){var a;return g.__generator(this,function(b){switch(b.label){case 0:return[4,Wa()];case 1:if(!b.sent())return[3,2];a=ca.MSHOP;return[3,4];case 2:return[4,Yb()];case 3:a=b.sent()?ca.MWEB:ca.DESKTOP,b.label=4;case 4:return[2,
a]}})})},K=function(){function a(){}a.setPrefix=function(b){this.prefix=b+"."};a.logCounter=function(b,c,d){qb.count(""+this.prefix+(d?d+"."+b:b),c)};a.logError=function(b,c){this.logCounter(b,1,c)};a.logNoError=function(b,c){this.logCounter(b,0,c)};a.prefix="";return a}(),Xa;(Xa||(Xa={})).clickHandler="CRImageThumbnailOpsClickHandler";var Zb=Xa,Ya;(Ya||(Ya={})).clickHandler="CRSeeMoreThumbnailOpsClickHandler";var $b=Ya,Za;(Za||(Za={})).clickHandler="CRVideoThumbnailClickHandler";var ac=Za,ea;(function(a){a.IMAGE=
"image";a.VIDEO="video";a.ALL="all"})(ea||(ea={}));var Ba=function(){function a(b,c){this.popover=c;this.popoverOpenEventType="a-modal"===b?"afterShow":"afterSlide"}a.prototype.showSync=function(){var b=this;return new Promise(function(c){P.when("A").execute(function(d){var e="a:popover:"+b.popoverOpenEventType+":"+b.popover.name,f=function(){d.off(e,f);c()};d.on(e,f);b.show()})})};a.prototype.show=function(){this.popover.show()};a.prototype.hide=function(){this.popover.hide()};a.prototype.updatePosition=
function(){this.popover.updatePosition()};a.getPopoverByName=function(b){return this.popovers[b]};a.prototype.isOpen=function(){return this.popover.isActive()};a.createOrGet=function(b,c,d,e,f){var h=this;return new Promise(function(l){h.popovers[c]?l(h.popovers[c]):P.when(b).execute(function(m){W["default"].scopeElement(d);m=m.create(e,f);h.popovers[c]=new a(b,m);l(h.popovers[c])})})};a.popovers={};return a}(),bc={activate:"onclick",dataStrategy:"preload",hideHeader:!0,padding:"none"},xb={dataStrategy:"preload"},
cc=function(a){function b(){return null!==a&&a.apply(this,arguments)||this}g.__extends(b,a);b.get=function(c,d,e,f){f=f?g.__assign(g.__assign({},f),{name:c}):g.__assign(g.__assign({},bc),{name:c});return a.createOrGet.call(this,"a-secondary-view",c,d,e,f)};return b}(Ba),dc=function(a){function b(){return null!==a&&a.apply(this,arguments)||this}g.__extends(b,a);b.get=function(c,d,e,f){f=f?g.__assign(g.__assign({},f),{name:c}):g.__assign(g.__assign({},xb),{name:c});return a.createOrGet.call(this,"a-modal",
c,d,e,f)};return b}(Ba),ec=function(a){function b(){return null!==a&&a.apply(this,arguments)||this}g.__extends(b,a);b.get=function(c,d,e,f){f=f?g.__assign(g.__assign({},f),{name:c}):g.__assign(g.__assign({},xb),{name:c});return a.createOrGet.call(this,"a-popover",c,d,e,f)};return b}(Ba),J=function(a){a.style.display="flex"},G=function(a){a.style.display="none"},T;(function(a){a[a.LEFT=0]="LEFT";a[a.CENTER=1]="CENTER";a[a.RIGHT=2]="RIGHT";a[a.NONE=3]="NONE"})(T||(T={}));var ua;(function(a){a[a.EXPAND=
0]="EXPAND";a[a.HIDE=1]="HIDE"})(ua||(ua={}));var Ca;(function(a){a[a.POTRAIT=0]="POTRAIT";a[a.LANDSCAPE=1]="LANDSCAPE"})(Ca||(Ca={}));var M=function(a,b){return(a=null===a||void 0===a?void 0:a.getElementsByClassName(b))?a[0]:null},Ia=function(a,b){var c;return null!==(c=null===a||void 0===a?void 0:a.querySelector(b))&&void 0!==c?c:null},w=function(a,b){a&&b(a)},yb=function(a){a=a.dataset;return{asin:a.asin,mediaType:F[a.mediatype],reviewId:a.reviewid,mediaId:a.physicalid||a.mediaid}},zb=function(a,
b){null===b||void 0===b?void 0:b.classList.remove(a)},Ab=function(a,b){null===b||void 0===b?void 0:b.classList.add(a)},fc=function(a){var b=M(a,"_Y3Itb_desktop-skeleton-container_738lf"),c=M(a,"_Y3Itb_desktop-spinner-container_1qNHr");return{show:function(){return w(b,function(d){return J(d)})},hide:function(){return w(b,function(d){return G(d)})},setLoadingAnimation:function(d){w(c,function(e){d?b&&J(e):G(e)})}}},$a;(function(a){a.SingleReviewComponent="SingleReviewComponent";a.ProfileBlock="ProfileBlock";
a.ProfileBadge="ProfileBadge";a.Rating="Rating";a.RatingAlt="RatingAlt";a.ReviewText="ReviewText";a.ReviewTitle="ReviewTitle";a.MainMedia="MainMedia";a.ImageThumbnailsBlock="ImageThumbnailsBlock";a.GalleryBlock="GalleryBlock";a.SingleReviewMediaBlock="SingleReviewMediaBlock"})($a||($a={}));var D=$a,ab;(function(a){a.MainMedia="MainMedia";a.ImageThumbnailsBlock="ImageThumbnailsBlock";a.GalleryBlock="GalleryBlock";a.SingleReviewMediaBlock="SingleReviewMediaBlock"})(ab||(ab={}));var Bb=ab,bb;(function(a){a.THANKYOU_MESSAGE_TOAST_BAR_NAME=
"thankYouMessageToastBarName";a.ERROR_MESSAGE_TOAST_BAR_NAME="errorMessageToastBarName";a.LOADPOPOVER_ERROR_TOAST_BAR_NAME="loadPopoverErrorToastBarName";a.DATA_POPOVER_NAME="data-popovername";a.DATA_ASIN="data-asin";a.DATA_MEDIATYPE="data-mediatype";a.DATA_SHOW_GALLERY_IN_MODAL="data-showgalleryinmodal";a.DATA_REVIEW_ID="data-reviewid";a.DATA_MEDIA_ID="data-mediaid";a.DATA_CSA_C_TYPE="data-csa-c-type";a.DATA_CSA_SLOT_ID="data-csa-c-slot-id";a.DATA_MULTIPLE_STARS_SUFFIX="data-multiple-starts-suffix";
a.DATA_ONE_STAR_SUFFIX="data-one-star-suffix";a.DATA_IMAGE_ALT_TEXT="data-imagealttext"})(bb||(bb={}));var I=bb,cb;(function(a){a.showMediaGalleryClickHandler="showMediaGalleryClickHandler";a.galleryItemClickHandler="galleryItemClickHandler";a.thumbnailClickHandler="thumbnailClickHandler";a.expandTextClickHandler="expandTextClickHandler";a.hideTextClickHandler="hideTextClickHandler";a.reloadMediaPopover="reloadMediaPopover";a.closeMediaPopover="closeMediaPopover";a.leftClickHandler="leftClickHandler";
a.rightClickHandler="rightClickHandler";a.openReportConfirmationDialogClickHandler="OpenReportConfirmationDialogClickHandler";a.confirmReportAbuseClickHandler="ConfirmReportAbuseClickHandler";a.noopHandler="noopHandler";a.helpfulVoteClickHandler="HelpfulVoteClickHandler"})(cb||(cb={}));var U=cb,R;(function(a){a.UPDATE_TEXT="updateText";a.UPDATE_LANG="updateLang";a.REPLACE_CLASS="replaceClass";a.DELETE_CHILDREN="deleteChildren";a.APPEND_ELEMENT="appendElement";a.UPDATE_ELEMENT="UpdateElement"})(R||
(R={}));var db=function(a,b,c){a=Ia(a,"[data-reviewbind="+D[b]+"]");c&&a&&(a=Ia(a,c));return a},Cb=function(a){var b=Q["default"].cardRoot.ownerDocument.createElement(a.tag);w(a.elementAttributes,function(c){Object.keys(c).forEach(function(d){return b.setAttribute(d,c[d])})});w(a.children,function(c){c.forEach(function(d){d=Cb(d);b.append(d)})});w(a.observer,function(c){c.observe(b)});w(a.clickHandler,function(c){c(b)});w(a.textContent,function(c){return b.textContent=c});return b},Db=function(a,
b){switch(b.type){case R.UPDATE_TEXT:w(a,function(c){var d,e=null!==(d=b.textContent)&&void 0!==d?d:"";c.textContent=e});break;case R.UPDATE_LANG:w(a,function(c){var d,e,f=c.textContent||"",h=c.dataset.reviewlanguage||"",l=c.dataset.originalText,m=null!==(d=b.textContent)&&void 0!==d?d:"";d=null===(e=c.dataset.locale)||void 0===e?void 0:e.slice(0,2);e=new Intl.DisplayNames([d],{type:"language"});l||(c.dataset.originalText=f);if("updateLang"==m){if(h=h.slice(0,2),h=e.of(h))c.textContent=f.replace("*",
h)}else l&&(c.textContent=c.dataset.originalText||"")});break;case R.REPLACE_CLASS:w(a,function(c){w(b.classPatternToBeReplaced,function(d){var e=Array.from(c.classList).find(function(f){return f.match(d)});w(e,function(f){return c.classList.remove(f)})});w(b.newClass,function(d){return c.classList.add(d)})});break;case R.APPEND_ELEMENT:w(a,function(c){var d;null===(d=b.elements)||void 0===d?void 0:d.forEach(function(e){c.append(Cb(e))})});break;case R.DELETE_CHILDREN:w(a,function(c){for(;c.lastElementChild;)c.removeChild(c.lastElementChild)});
break;case R.UPDATE_ELEMENT:w(a,function(c){w(b.elementAttributes,function(d){Object.keys(d).forEach(function(e){return c.setAttribute(e,d[e])})})})}},eb=function(a,b){a&&b.forEach(function(c){var d=db(a,c.key,c.querySelector);Db(d,c)})},gc=function(a,b){var c=b==F.IMAGE?"cm_cr_image_carousel_popover":"cm_cr_video_carousel_popover",d=H["default"].setup(),e=function(u,v){var x,B=null!==(x=v.mediaList.findIndex(b==F.IMAGE?function(L){var N;return(null===(N=L.image)||void 0===N?void 0:N.physicalId)==
u}:function(L){var N;return(null===(N=L.video)||void 0===N?void 0:N.physicalId)==u}))&&void 0!==x?x:0;return v.mediaList[B]},f=function(u,v,x){return[{type:R.UPDATE_TEXT,key:u,textContent:v,querySelector:x}]},h=function(u,v,x,B){return[{type:R.REPLACE_CLASS,key:u,classPatternToBeReplaced:v,newClass:x,querySelector:B}]},l=function(u,v,x){return[{key:u,type:R.UPDATE_ELEMENT,elementAttributes:v,querySelector:x}]},m=["_Y3Itb_media-popover-image-view-container_vTrQA","_Y3Itb_media-popover-image-view-active_2lj7U"],
q=function(u){var v=u.mediaGroup.mediaList.map(function(x){return b==F.IMAGE?x.image:x.video}).filter(function(x){return!!x}).map(function(x,B){var L,N=g.__assign,z=(L={class:u.mediaId==x.physicalId?m.join(" "):"_Y3Itb_media-popover-image-view-container_vTrQA"},L[I.DATA_MEDIA_ID]=x.physicalId,L);L=c+"_"+u.reviewId+"_"+u.reviewRank+"_"+x.physicalId+"_"+B;var r;B=(r={},r[I.DATA_CSA_C_TYPE]="element",r[I.DATA_CSA_SLOT_ID]=L,r);return{tag:"div",elementAttributes:N.call(g,z,B),children:[{tag:b==F.IMAGE?
"img":"video",elementAttributes:g.__assign({src:x.url,alt:x.altText,class:"_Y3Itb_media-popover-image-view_1FAQo"},b==F.VIDEO?{controls:"true"}:{})}]}});return[{type:R.DELETE_CHILDREN,key:D.MainMedia},{type:R.APPEND_ELEMENT,elements:v,key:D.MainMedia}]},n=function(u){if(b==F.VIDEO)return[];var v=k(D.ImageThumbnailsBlock,I.DATA_IMAGE_ALT_TEXT),x=u.mediaGroup.mediaList.map(function(B){return B.image}).filter(function(B){return!!B}).map(function(B){var L;return{tag:"li",elementAttributes:{class:"_Y3Itb_media-popover-list-item-style_1njtu"},
children:[{tag:"button",elementAttributes:(L={"aria-pressed":u.mediaId===B.physicalId?"true":"false",class:u.mediaId===B.physicalId?"_Y3Itb_media-popover-thumbnail-image-view-active_2W42O _Y3Itb_media-popover-thumbnail-image-button_1vtKQ":"_Y3Itb_media-popover-thumbnail-image-button_1vtKQ"},L[I.DATA_MEDIA_ID]=B.physicalId,L[I.DATA_MEDIATYPE]=b,L),children:[{tag:"img",elementAttributes:{src:B.thumbnailUrl,alt:v,class:"_Y3Itb_media-popover-thumbnail-image-view_3-Y40"}}],clickHandler:function(N){return d.attach(U.thumbnailClickHandler,
N)}}]}});return[{type:R.DELETE_CHILDREN,key:D.ImageThumbnailsBlock},{type:R.APPEND_ELEMENT,elements:x,key:D.ImageThumbnailsBlock}]},y=function(u,v,x){return g.__spread(f(u,x),l(u,{lang:v}))},k=function(u,v,x){var B;return(u=db(a,u,x))?null!==(B=u.getAttribute(v))&&void 0!==B?B:"":""},t=k(D.RatingAlt,I.DATA_MULTIPLE_STARS_SUFFIX),p=k(D.RatingAlt,I.DATA_ONE_STAR_SUFFIX),E=function(u,v,x){var B,L,N,z,r,A;switch(u){case D.ReviewText:return y(u,(null===(L=x.metadata)||void 0===L?void 0:L.sourceLanguage)||
"",null===(N=x.metadata)||void 0===N?void 0:N.text);case D.ReviewTitle:return y(u,(null===(z=x.metadata)||void 0===z?void 0:z.sourceLanguage)||"",null===(r=x.metadata)||void 0===r?void 0:r.title);case D.ProfileBadge:return f(u,v.mediaGroup.contributorRelationships);case D.Rating:var C=null===(A=x.metadata)||void 0===A?void 0:A.rating;void 0===C&&(C=0);return g.__spread(h(D.Rating,"^a-star-.*","a-star-"+C),f(D.Rating,C+" "+(1<C?t:p),"span"));case D.MainMedia:return q(v);case D.ProfileBlock:return A=
(A=v.mediaGroup.contributor.profile)?g.__spread(f(D.ProfileBlock,A.name,".a-profile-name"),l(D.ProfileBlock,{src:A.avatarUrl.desktop},".a-profile-avatar > img"),l(D.ProfileBlock,{href:null!==(C=A.link)&&void 0!==C?C:"javascript:void(0)"},"a.a-profile")):[],A;case D.ImageThumbnailsBlock:return n(v);case D.SingleReviewMediaBlock:return l(u,(B={},B[I.DATA_CSA_SLOT_ID]=c+"_"+v.reviewId+"_"+v.reviewRank,B));default:return[]}};return{updateReview:function(u){var v=e(u.mediaId,u.mediaGroup),x=Object.keys(D).flatMap(function(B){return E(D[B],
u,v)});eb(a,x)},updateReviewMedia:function(u){var v=e(u.mediaId,u.mediaGroup),x=Object.keys(Bb).flatMap(function(B){return E(Bb[B],u,v)});eb(a,x)},updateMedia:function(u){u=g.__spread(l(D.ImageThumbnailsBlock,{"aria-pressed":"false"},"._Y3Itb_media-popover-thumbnail-image-view-active_2W42O"),l(D.ImageThumbnailsBlock,{"aria-pressed":"true"},'button[data-mediaid="'+u+'"]'),h(D.ImageThumbnailsBlock,"_Y3Itb_media-popover-thumbnail-image-view-active_2W42O",void 0,"._Y3Itb_media-popover-thumbnail-image-view-active_2W42O"),
h(D.ImageThumbnailsBlock,void 0,"_Y3Itb_media-popover-thumbnail-image-view-active_2W42O",'button[data-mediaid="'+u+'"]'),h(D.MainMedia,"_Y3Itb_media-popover-image-view-active_2lj7U",void 0,"._Y3Itb_media-popover-image-view-active_2lj7U"),h(D.MainMedia,void 0,"_Y3Itb_media-popover-image-view-active_2lj7U",'div[data-mediaid="'+u+'"]'));eb(a,u)},updateSingleReviewContent:function(u){var v=db(a,D.SingleReviewComponent);v&&v.firstChild&&v.replaceChild(u,v.firstChild)}}},fb=function(a,b){if(!a)return!1;
b=b.some(function(c){return a.classList.contains(c)});return a.offsetHeight<a.scrollHeight&&b},hc=function(a){var b=["_Y3Itb_cr-sidepanel-truncated-text_3nfmo","_Y3Itb_cr-sidepanel-truncated-title_2w0Qj"],c=M(a,"_Y3Itb_cr-media-popover-sidepanel-header-section_3TxI7"),d=M(c,"_Y3Itb_cr-sidepanel-text_3MYCz"),e=M(c,"_Y3Itb_cr-sidepanel-title_EX93d"),f=M(c,"_Y3Itb_cr-sidepanel-expander-see-more_1sipE"),h=M(c,"_Y3Itb_cr-sidepanel-expander-see-less_1Hpji"),l=M(c,"_Y3Itb_cr-sidepanel-container-gradient_1zm2j"),
m=function(p){fb(p,b)&&(w(f,function(E){return J(E)}),w(l,function(E){return Ab("_Y3Itb_cr-sidepanel-container-gradient-truncated_3zXR9",E)}))},q=new ResizeObserver(function(p){var E;try{for(var u=g.__values(p),v=u.next();!v.done;v=u.next())m(v.value.target)}catch(B){var x={error:B}}finally{try{v&&!v.done&&(E=u.return)&&E.call(u)}finally{if(x)throw x.error;}}});w(d,function(p){q.observe(ia.unscope(p))});w(e,function(p){q.observe(ia.unscope(p))});var n=function(){k(!0);w(f,function(p){return G(p)});
w(h,function(p){return J(p)})},y=function(){k(!1);w(h,function(p){return G(p)})},k=function(p){t("_Y3Itb_cr-media-popover-sidepanel-header-section-truncated_DITiq",p,c);t("_Y3Itb_cr-sidepanel-container-gradient-truncated_3zXR9",p,l);t("_Y3Itb_cr-sidepanel-truncated-text_3nfmo",p,d);t("_Y3Itb_cr-sidepanel-truncated-title_2w0Qj",p,e)},t=function(p,E,u){E?w(u,function(v){return zb(p,v)}):w(u,function(v){return Ab(p,v)})};return{toggleText:function(){d&&fb(d,b)||e&&fb(e,b)?n():y()},hideText:y,expandText:n,
initialize:function(){w(f,function(p){return G(p)});w(l,function(p){return zb("_Y3Itb_cr-sidepanel-container-gradient-truncated_3zXR9",p)});m(d);m(e)}}},gb=function(){function a(b){this.actionButtons=b}a.getActionButtonsContainer=function(b){var c=Q["default"].cardRoot.ownerDocument.getElementsByClassName("_Y3Itb_cr-vote-report-buttons-container_1YjZZ");return Array.from(c).filter(function(d){return d.dataset.id===b})[0]};a.prototype.likeButtonClicked=function(){var b=this.actionButtons.querySelectorAll("div[data-variant='like']")[0],
c=this.actionButtons.querySelectorAll("div[data-variant='like-done']")[0];G(b);J(c)};a.prototype.resetLike=function(){var b=this.actionButtons.querySelectorAll("div[data-variant='like']")[0],c=this.actionButtons.querySelectorAll("div[data-variant='like-done']")[0];G(c);J(b)};return a}(),ic={dataStrategy:"inline",activate:"onclick",position:"triggerVertical"},jc=function(a){var b;return{openTooltipPopover:function(c){return g.__awaiter(void 0,void 0,void 0,function(){var d,e,f;return g.__generator(this,
function(h){switch(h.label){case 0:if(b)return[3,2];d="reportAbusePreload_"+a;e=M(c,"_Y3Itb_cr-report-abuse-preload-content_ve26F");null===e||void 0===e?void 0:e.classList.remove("aok-hidden");f=g.__assign(g.__assign({},ic),{name:d,content:e});return e?[4,ec.get(d,e,c,f)]:[3,2];case 1:b=h.sent(),h.label=2;case 2:return b&&b.show(),[2]}})})},closeTooltipPopover:function(){return g.__awaiter(void 0,void 0,void 0,function(){return g.__generator(this,function(c){b&&b.hide();return[2]})})},isOpen:function(){return b?
b.isOpen():!1}}},kc=function(a){var b=(a=M(a,"_Y3Itb_cr-vote-report-buttons-container_1YjZZ"))?new gb(a):void 0,c=new Set;return{initialize:function(d){c.has(d)?null===b||void 0===b?void 0:b.likeButtonClicked():null===b||void 0===b?void 0:b.resetLike()},addReviewId:function(d){null===b||void 0===b?void 0:b.likeButtonClicked();c.add(d)}}},lc=function(a,b){var c=M(a,"_Y3Itb_left-icon-container_31i2O"),d=M(a,"_Y3Itb_right-icon-container_3Qopb");return{initialize:function(e,f){w(c,J);w(d,J);b.isFirstMediaItem(e,
f)&&w(c,G);b.isLastMediaItem(e,f)&&w(d,G)},hideButtons:function(){w(c,G);w(d,G)}}},mc=function(a,b,c){a=M(a,"_Y3Itb_modal-content-container_XXRsT");var d=M(a,"_Y3Itb_cr-action-buttons-container_3vmwq"),e=lc(a,b),f=jc(c);if(!a)throw Error("modalContent element was not found");return{reportAbuse:g.__assign({},f),helpfulVote:g.__assign({},kc(a)),navigation:g.__assign({},e),toggleMediaButtonsVisibility:function(h,l,m){if(h){if(!l||!m)throw Error("reviewId or mediaId not found: "+l+", "+m);w(d,J);e.initialize(l,
m)}else f.isOpen()||(w(d,G),e.hideButtons())}}},sa=function(){function a(b,c){var d;this.toastBar=c?a.getToastBarByNameIn(b,c):a.getToastBarByName(b);this.button=null===(d=this.toastBar)||void 0===d?void 0:d.getElementsByClassName("_Y3Itb_toast-bar-button_1yIpW")[0]}a.getToastBarByName=function(b){return Q["default"].cardRoot.ownerDocument.querySelector("div[data-toast-bar-name='"+b+"']")};a.getToastBarByNameIn=function(b,c){return Ia(c,"div[data-toast-bar-name='"+b+"']")};a.prototype.setClickParams=
function(b){var c=this;b.forEach(function(d,e){var f;null===(f=c.button)||void 0===f?void 0:f.setAttribute(e,d)})};a.prototype.show=function(){w(this.toastBar,J)};a.prototype.hide=function(){w(this.toastBar,G)};return a}(),pc=function(a,b,c){var d=nc(a,b);setTimeout(function(){var e=a.querySelector(".a-cardui-body .a-reactive-container");if(e&&100<=e.scrollHeight){e=b.querySelector(".a-expander-icon");var f=b.querySelector(".a-see-more-text");if(f){f.style.display="none";a.setAttribute("data-a-expanded",
"false");if(c){var h=c.querySelector(".a-reactive-container");h&&(h.className="a-reactive-container a-reactive-container-transition")}b.style.opacity="1";b.style.display="block";f.style.display="inline";e&&(e=e.querySelector(".a-css-icon"))&&(e.className="a-css-icon a-css-icon-draw a-css-icon-expand")}oc(a,b,d)}else a.setAttribute("data-a-expanded","true")},0)},nc=function(a,b){return function(c){var d=a.querySelector(".a-cardui-body .a-reactive-container");d&&(d.style.transition="height 200ms linear",
d.style.height=c?d.scrollHeight+"px":"100px");a.setAttribute("data-a-expanded",c?"true":"false");if(d=b.querySelector(".a-css-icon"))d.className=c?"a-css-icon a-css-icon-draw a-css-icon-collapse":"a-css-icon a-css-icon-draw a-css-icon-expand";d=b.querySelector(".a-see-more-text");var e=b.querySelector(".a-see-less-text");d&&e&&(d.style.display=c?"none":"inline",e.style.display=c?"inline":"none")}},oc=function(a,b,c){(b=b.querySelector(".a-cardui-expand-control-footer-button"))&&b.addEventListener("click",
function(){var d="true"===a.getAttribute("data-a-expanded");c(!d)})},rc=function(a,b,c,d){var e=gc(b,a),f=hc(b),h=mc(b,c,a),l=new sa(I.THANKYOU_MESSAGE_TOAST_BAR_NAME,b),m=new sa(I.ERROR_MESSAGE_TOAST_BAR_NAME,b),q=fa["default"].setup(["reportAbuse"]),n=fa["default"].setup(["helpful"]),y=fa["default"].setup(["renderSingleReview"]),k={},t=new Map,p=function(z,r){w(z,function(A){k.reviewId=A});w(r,function(A){k.mediaId=A})},E=function(z,r){z=r[z];return a===F.IMAGE?z.image.physicalId:z.video.physicalId},
u=function(z){return z.map(function(r){return r.mediaType===F.IMAGE?r.image:r.video}).findIndex(function(r){return(null===r||void 0===r?void 0:r.physicalId)===k.mediaId})},v=function(){return g.__awaiter(void 0,void 0,void 0,function(){var z;return g.__generator(this,function(r){switch(r.label){case 0:if(!k.reviewId||!k.mediaId)throw Error("No reviewId present: "+k);return[4,c.fetchNextReview(k.reviewId)];case 1:return(z=r.sent())?[4,x(E(0,z.mediaGroup.mediaList),z.mediaGroup.id)]:[3,3];case 2:r.sent(),
r.label=3;case 3:return[2]}})})},x=function(z,r){return g.__awaiter(void 0,void 0,void 0,function(){var A,C;return g.__generator(this,function(O){switch(O.label){case 0:return[4,c.fetchReview(r)];case 1:A=O.sent();if(!A)throw Error("review was not fetched: "+r);C={reviewId:r,mediaId:z,reviewRank:A.reviewRank,mediaGroup:A.mediaGroup};return d?[4,B(A)]:[3,3];case 2:return O.sent(),e.updateReviewMedia(C),[3,4];case 3:e.updateReview(C),O.label=4;case 4:return p(r,z),f.hideText(),f.initialize(),h.helpfulVote.initialize(r),
h.navigation.initialize(r,z),[2]}})})},B=function(z){return g.__awaiter(void 0,void 0,void 0,function(){var r,A,C,O,X,va;return g.__generator(this,function(hb){switch(hb.label){case 0:return r=b.querySelector("div[data-reviewid]"),A=null===(va=null===(X=z.mediaGroup.mediaList.at(0))||void 0===X?void 0:X.metadata)||void 0===va?void 0:va.review,C={isMshop:"true"===r.dataset.ismshop,locale:r.dataset.locale||"",marketplaceId:r.dataset.marketplaceid||"",isKindleApp:"true"===r.dataset.iskindleapp,localeLanguageName:r.dataset.localelanguagename||
void 0,csrfT:r.dataset.csrft||"",isCustomerRecognized:"true"===r.dataset.iscustomerrecognized,isAndroidApp:"true"===r.dataset.isandroidapp,isIosApp:"true"===r.dataset.isiosapp,isLocalReview:!0,isMobile:!1,lazyLoading:!1,isSingleReviewFromSharedLibraryEnabled:!0,imageProfileLazyLoading:!1},A&&C?[4,L(A,C)]:[3,2];case 1:O=hb.sent();if(O){var wa=O.querySelector('[data-a-card-type="peekExpand"]');if(wa){var qc=wa.querySelector(".a-cardui-body"),Eb=wa.querySelector(".a-cardui-expand-control-footer"),ib=
wa.querySelector(".a-cardui-footer");wa.style.marginTop="0px";ib&&(ib.style.padding="0px",ib.style.paddingTop="0px");Eb&&pc(wa,Eb,qc)}}e.updateSingleReviewContent(O);hb.label=2;case 2:return[2]}})})},L=function(z,r){return g.__awaiter(void 0,void 0,void 0,function(){var A,C,O,X;return g.__generator(this,function(va){switch(va.label){case 0:A=z.id;if(t.has(A))return[2,t.get(A).cloneNode(!0)];C={review:z,requestContext:r};X=ia.unscope;return[4,y.renderSingleReview(C)];case 1:return O=X.apply(void 0,
[va.sent()]),t.set(A,O),[2,O]}})})},N=function(z){if(!k.reviewId)throw Error("no reviewId found while updating media: "+k.mediaId);e.updateMedia(z);p(k.reviewId,z);h.navigation.initialize(k.reviewId,z)};return{show:function(){return w(b,J)},hide:function(){return w(b,G)},update:function(z){var r=z.mediaId,A=z.reviewId;return g.__awaiter(void 0,void 0,void 0,function(){return g.__generator(this,function(C){switch(C.label){case 0:if(!r||!A)throw Error("reviewId or mediaId not found: "+A+", "+r);return[4,
x(r,A)];case 1:return C.sent(),[2]}})})},updateMedia:N,handleModalMediaProgressionClick:function(z){return g.__awaiter(void 0,void 0,void 0,function(){var r,A,C,O;return g.__generator(this,function(X){switch(X.label){case 0:if(!k.reviewId||!k.mediaId)throw Error("No reviewId or mediaId present: "+k);r=c.getReviewById(k.reviewId);A=u(r.mediaList);C=z;switch(C){case T.RIGHT:return[3,1];case T.LEFT:return[3,5]}return[3,10];case 1:if(!(A<r.mediaList.length-1))return[3,2];N(E(A+1,r.mediaList));return[3,
4];case 2:return[4,v()];case 3:X.sent(),X.label=4;case 4:return[3,10];case 5:if(!(0<A))return[3,6];N(E(A-1,r.mediaList));return[3,9];case 6:return[4,c.fetchPreviousReview(k.reviewId)];case 7:return(O=X.sent())?[4,x(E(O.mediaGroup.mediaList.length-1,O.mediaGroup.mediaList),O.mediaGroup.id)]:[3,9];case 8:X.sent(),X.label=9;case 9:return[3,10];case 10:return[2]}})})},handleExpanderClick:function(z){switch(z){case ua.EXPAND:f.expandText();break;case ua.HIDE:f.hideText()}},handleReportAbuseClick:function(z){return g.__awaiter(void 0,
void 0,void 0,function(){var r,A;return g.__generator(this,function(C){switch(C.label){case 0:if(!k.reviewId)throw Error("no reviewId found while reporting abuse: "+k);h.reportAbuse.closeTooltipPopover();C.label=1;case 1:return C.trys.push([1,5,,6]),[4,q.reportAbuse({reviewId:k.reviewId,asin:z,domain:Aa()})];case 2:r=C.sent();if(!r.success&&r.redirectUrl)return Z["default"].setLocation(r.redirectUrl),[2];if(!r.success)return[3,4];l.show();return[4,v()];case 3:return C.sent(),[2];case 4:return r.success?
[3,6]:(m.show(),[2]);case 5:throw A=C.sent(),m.show(),A;case 6:return[2]}})})},handleHelpulVoteClick:function(z){return g.__awaiter(void 0,void 0,void 0,function(){var r,A;return g.__generator(this,function(C){switch(C.label){case 0:if(!k.reviewId)throw Error("no reviewId found while handling helpfulvote call: "+k);C.label=1;case 1:return C.trys.push([1,3,,4]),[4,n.helpful({reviewId:k.reviewId,domain:Aa(),asin:z})];case 2:return r=C.sent(),!r.success&&r.redirectUrl&&Z["default"].setLocation(r.redirectUrl),
r.success?(h.helpfulVote.addReviewId(k.reviewId),[2]):r.success?[3,4]:(m.show(),[2]);case 3:throw A=C.sent(),m.show(),A;case 4:return[2]}})})},openReportAbuseTooltip:h.reportAbuse.openTooltipPopover,toggleMediaButtonsVisibility:function(z){h.toggleMediaButtonsVisibility(z,k.reviewId,k.mediaId)},getCurrentReviewDetails:function(){return k},updateReviewDetails:p,renderSingleReviewFromSharedLibrary:B}},sc=H["default"].setup(),tc=function(a){var b=0,c=function(l,m,q){var n;return n={},n[I.DATA_MEDIA_ID]=
l,n[I.DATA_MEDIATYPE]=q,n[I.DATA_REVIEW_ID]=m,n[I.DATA_SHOW_GALLERY_IN_MODAL]="false",n},d=function(l){var m;return m={},m[I.DATA_CSA_C_TYPE]="element",m[I.DATA_CSA_SLOT_ID]=l,m},e=function(l){return[{tag:"img",elementAttributes:{src:l.thumbnailUrl,alt:l.altText}}]},f=function(l,m){var q={tag:"img",elementAttributes:{src:l.thumbnailUrl,alt:l.altText}};return m?[q,{tag:"div",elementAttributes:{class:"_Y3Itb_media-gallery-item-video-overlay-container_RHWdX"},children:[{tag:"div",elementAttributes:{class:"_Y3Itb_media-gallery-item-video-overlay_cGzRu"},
children:[{tag:"i",elementAttributes:{"class":"a-icon a-icon-star-mini a-star-mini-"+m.rating}},{tag:"span",textContent:"\u25b7 "+l.videoDuration}]}]}]:[q]},h=function(l,m,q,n,y){return l.map(function(k,t){var p,E=k.mediaType==Ta.IMAGE?k.image:k.video;if(E){var u=k.mediaType==Ta.IMAGE?e(k.image):f(k.video,k.metadata),v=null===(p=k.metadata)||void 0===p?void 0:p.contributionId;if(v)return{tag:"button",elementAttributes:g.__assign(g.__assign({class:k.mediaType==Ta.IMAGE?"_Y3Itb_media-gallery-item_3LROo":
"_Y3Itb_media-gallery-item-video_1k9yY"},c(E.physicalId,v,k.mediaType)),d(y+"_"+v+"_"+E.physicalId+"_"+n)),observer:t==m?q:void 0,children:g.__spread(u),clickHandler:function(x){return sc.attach(U.galleryItemClickHandler,x)}}}}).filter(function(k){return void 0!==k})};return{updateGallery:function(l,m,q,n){l=h(l,m,q,b,n);b++;0<l.length&&Db(a,{type:R.APPEND_ELEMENT,key:D.GalleryBlock,elements:l})}}},uc=function(a,b,c){var d=M(b,"_Y3Itb_media-popover-gallery-container-grid_mLjpJ"),e=M(b,"_Y3Itb_gallery-spinner_34BcK"),
f=a===F.IMAGE?"cm_cr_image_gallery_popover":"cm_cr_video_gallery_popover",h=new IntersectionObserver(function(n,y){n.forEach(function(k){return g.__awaiter(void 0,void 0,void 0,function(){var t;return g.__generator(this,function(p){switch(p.label){case 0:if(!k.isIntersecting)return[3,4];p.label=1;case 1:return p.trys.push([1,3,,4]),w(e,J),[4,c.fetchReviewsNextPage()];case 2:return p.sent(),q(),w(e,G),y.unobserve(k.target),[3,4];case 3:throw t=p.sent(),t;case 4:return[2]}})})})},{root:ia.unscope(d),
rootMargin:"0px",threshold:.25}),l=tc(d),m=0,q=function(){for(var n=c.getAllReviews(),y=c.getAllReviewIds(),k=[],t=m;t<y.length;t++)k.push.apply(k,g.__spread(n[y[t]].mediaList)),m++;l.updateGallery(k,5<=k.length?k.length-5:-1,h,f)};return{hide:function(){return w(b,G)},show:function(){return w(b,J)},update:function(){return g.__awaiter(void 0,void 0,void 0,function(){var n;return g.__generator(this,function(y){switch(y.label){case 0:return n=c.getAllReviewIds(),0!=n.length?[3,2]:[4,c.fetchReviewsNextPage()];
case 1:y.sent(),y.label=2;case 2:return q(),[2]}})})},scrollToMediaId:function(n){n&&(n=Ia(b,'div[data-mediaid="'+n+'"]'),w(n,function(y){return y.scrollIntoView()}))}}},vc=function(a){var b=M(a,"_Y3Itb_media-popover-see-all-container_1Lmmi");return{show:function(){return w(b,function(c){return J(c)})},hide:function(){return w(b,function(c){return G(c)})}}},wc=function(a,b){var c=[],d={},e,f,h=function(){return g.__awaiter(void 0,void 0,void 0,function(){var k,t;return g.__generator(this,function(p){switch(p.label){case 0:return k=
qa.setup(["getGroupedMediaReviews"]),[4,k.getGroupedMediaReviews({asin:a,nextToken:e,mediaType:b,limit:50})];case 1:return t=p.sent(),l(t.mediaGroupList),e=t.nextToken,[2]}})})},l=function(k){k.forEach(function(t){d[t.id]=t;0>c.indexOf(t.id)&&c.push(t.id)})},m=function(k){return!!d[k]},q=function(k){return c.indexOf(k)},n=function(){return g.__awaiter(void 0,void 0,void 0,function(){var k;return g.__generator(this,function(t){switch(t.label){case 0:k=0===Object.keys(d).length;if(!k&&(k||f||!e))return[3,
5];t.label=1;case 1:return t.trys.push([1,,3,4]),[4,h()];case 2:return t.sent(),[3,4];case 3:return f=!1,[7];case 4:return[2,!0];case 5:return[2,!1]}})})},y=function(k,t){return d[k].mediaList.map(function(p){return p.mediaType===F.IMAGE?p.image:p.video}).findIndex(function(p){return(null===p||void 0===p?void 0:p.physicalId)===t})};return{fetchReview:function(k){return g.__awaiter(void 0,void 0,void 0,function(){var t,p,E,u;return g.__generator(this,function(v){switch(v.label){case 0:if(!k)throw Error("fetchReview was called without a reviewId");
t=m(k);v.label=1;case 1:return t?[3,3]:[4,n()];case 2:return p=v.sent(),t=m(k),p?[3,1]:[3,3];case 3:if(m(k))return[3,5];E=qa.setup(["getMediaGroup"]);return[4,E.getMediaGroup({reviewId:k})];case 4:u=v.sent(),l(u),e="",K.logCounter("desktop.missingReviewId",1),v.label=5;case 5:return m(k)?[2,{mediaGroup:d[k],reviewRank:q(k)}]:[2]}})})},isReviewFetched:m,fetchReviewsNextPage:n,fetchNextReview:function(k){return g.__awaiter(void 0,void 0,void 0,function(){var t,p;return g.__generator(this,function(E){switch(E.label){case 0:return t=
q(k)+1,t>=c.length?[4,n()]:[3,2];case 1:E.sent(),E.label=2;case 2:return p=c[t],m(p)?[2,{mediaGroup:d[p],reviewRank:t}]:[2]}})})},fetchPreviousReview:function(k){return g.__awaiter(void 0,void 0,void 0,function(){var t,p;return g.__generator(this,function(E){t=q(k)-1;if(0>t)return[2];p=c[t];return m(p)?[2,{mediaGroup:d[p],reviewRank:t}]:[2]})})},getReviewById:function(k){return d[k]},getReviewIndexById:q,getAllReviews:function(){return d},getAllReviewIds:function(){return c},isFirstMediaItem:function(k,
t){var p=q(k);k=y(k,t);return 0===p&&0===k},isLastMediaItem:function(k,t){var p=q(k);t=y(k,t);return!e&&p===c.length-1&&t===d[k].mediaList.length-1}}},Da=function(){var a={};return{setData:function(b,c){a[b]=c},getData:function(b){return a[b]},hasData:function(b){return b in a},removeData:function(b){delete a[b]},clearData:function(){for(var b in a)a.hasOwnProperty(b)&&delete a[b]}}}(),xc=function(a,b,c,d,e){var f=wc(b,c),h=fc(d),l=vc(d),m=new sa(I.LOADPOPOVER_ERROR_TOAST_BAR_NAME,d),q=M(d,"_Y3Itb_single-review-media-popover-container_1h9X2");
if(!q)throw Error("Unable to find singleReviewMediaPopoverContainer");var n=rc(c,q,f,e);d=M(d,"_Y3Itb_gallery-container_2pBFm");if(!d)throw Error("Unable to find mediaGalleryContainer");var y=uc(c,d,f);return{loadModal:function(k){return g.__awaiter(void 0,void 0,void 0,function(){var t;return g.__generator(this,function(p){switch(p.label){case 0:return m.hide(),n.hide(),y.hide(),h.show(),h.setLoadingAnimation(!0),k.popoverDetails.popover?[4,k.popoverDetails.popover.showSync()]:[3,2];case 1:p.sent(),
p.label=2;case 2:return p.trys.push([2,4,,5]),t=k.showGalleryInModal?y:n,[4,t.update(k)];case 3:return p.sent(),t.show(),k.showGalleryInModal?l.hide():l.show(),h.hide(),[3,5];case 4:p.sent();K.logCounter("desktop.popoverLoading.Error",1);h.setLoadingAnimation(!1);if(!k.mediaType||!k.asin)throw Error("mediaType or asin was not found while setting parameters for toastbar: "+k.mediaType+", "+k.asin);p=new Map([[I.DATA_POPOVER_NAME,k.popoverDetails.popoverName],[I.DATA_ASIN,k.asin],[I.DATA_MEDIATYPE,
k.mediaType.toString()]]);if(k.showGalleryInModal)p.set(I.DATA_SHOW_GALLERY_IN_MODAL,"true");else{if(!k.reviewId||!k.mediaId)throw Error("mediaId or reviewId was not found while setting parameters for toastbar: "+k.reviewId+", "+k.mediaId);p.set(I.DATA_REVIEW_ID,k.reviewId);p.set(I.DATA_MEDIA_ID,k.mediaId)}m.setClickParams(p);m.show();return[3,5];case 5:return[2]}})})},updateModalWithReview:function(k,t){return g.__awaiter(void 0,void 0,void 0,function(){return g.__generator(this,function(p){switch(p.label){case 0:return y.hide(),
l.show(),[4,n.update({reviewId:k,mediaId:t,asin:b,mediaType:c})];case 1:return p.sent(),n.show(),[2]}})})},showMediaGallery:function(){return g.__awaiter(void 0,void 0,void 0,function(){var k;return g.__generator(this,function(t){switch(t.label){case 0:return k=n.getCurrentReviewDetails().mediaId,n.hide(),l.hide(),h.show(),h.setLoadingAnimation(!0),[4,y.update()];case 1:return t.sent(),h.hide(),y.show(),y.scrollToMediaId(k),[2]}})})},updateMediaInModal:n.updateMedia,handleModalMediaProgressionClick:n.handleModalMediaProgressionClick,
handleExpanderClick:n.handleExpanderClick,openReportAbuseDialog:n.openReportAbuseTooltip,handleReportAbuseClick:function(){return n.handleReportAbuseClick(b)},handleHelpulVoteClick:function(){return n.handleHelpulVoteClick(b)},closeModal:function(){return Ba.getPopoverByName(a).hide()}}},yc=function(a,b){return g.__awaiter(void 0,void 0,void 0,function(){var c;return g.__generator(this,function(d){switch(d.label){case 0:return c=fa["default"].setup(["triggerWeblab"]),[4,c.triggerWeblab({weblabId:a,
isCustomerIdBasedWeblab:b})];case 1:return[2,d.sent()]}})})},zc=function(){function a(){this.desktopPopoverModalOptions={dataStrategy:"preload",hideHeader:!0,closeButton:!0,padding:"none",name:"cr-media-popover"}}a.prototype.onVideoClickHandler=function(b){return g.__awaiter(this,void 0,void 0,function(){return g.__generator(this,function(c){throw Error("Video click handler on Desktop is not yet implemented.");})})};a.prototype.onImageClickHandler=function(b){return g.__awaiter(this,void 0,void 0,
function(){return g.__generator(this,function(c){switch(c.label){case 0:return[4,this.showImagePopover(b,!1)];case 1:return c.sent(),[2]}})})};a.prototype.onSeeMoreClickHandler=function(b){var c;return g.__awaiter(this,void 0,void 0,function(){var d,e,f;return g.__generator(this,function(h){switch(h.label){case 0:return d=null===(c=b.currentTarget)||void 0===c?void 0:c.dataset,e=F[d.mediatype],f=Sa(e),f!==ea.IMAGE?[3,2]:[4,this.showImagePopover(b,!0)];case 1:return h.sent(),[3,3];case 2:throw K.logError("loadDesktopVideoGalleryError",
f),Error("Video gallery is not available on desktop.");case 3:return[2]}})})};a.prototype.showImagePopover=function(b,c){return g.__awaiter(this,void 0,void 0,function(){return g.__generator(this,function(d){switch(d.label){case 0:return[4,this.openModal(b,c)];case 1:return d.sent(),[2]}})})};a.prototype.openModal=function(b,c){return g.__awaiter(this,void 0,void 0,function(){var d,e,f,h,l,m,q,n,y,k,t,p,E,u,v,x;return g.__generator(this,function(B){switch(B.label){case 0:d=b.currentTarget;e=yb(d);
if(c&&(!e.mediaType||!e.asin))throw Error("media props are missing while trying to load the modal: "+JSON.stringify(e));if(!(c||e.mediaType&&e.asin&&e.reviewId&&e.mediaId))throw Error("media props are missing while trying to load the modal: "+JSON.stringify(e));f=e.mediaType===F.IMAGE?"_Y3Itb_cm_cr_image_popoversection_3iYPp":"_Y3Itb_cm_cr_video_popoversection_2v7yY";h=W["default"].cardRoot.getElementsByClassName(f)[0];l=h.getElementsByClassName("_Y3Itb_media-popover-container_2BBbs")[0];m=this.desktopPopoverModalOptions.name+
"_"+e.mediaType;q=h.querySelector("div[data-reviewbind=SingleReviewMediaBlock]");n=(null===q||void 0===q?void 0:q.getAttribute("data-closebuttonaria"))||"";y=(null===q||void 0===q?void 0:q.getAttribute("data-modaltitlearia"))||"";t=k=!1;if(!l)return[3,2];(p=l.querySelector("div[data-reviewid]"))&&(t="true"===p.dataset.iscustomerrecognized);return t?[4,yc("COFEE_DD_MEDIA_CARDS_MIGRATION_SHARED_LIBRARY_1247512")]:[3,2];case 1:E=B.sent(),"T1"===E.treatment&&(k=!0),B.label=2;case 2:return u=g.__assign(g.__assign({},
this.desktopPopoverModalOptions),{name:m,closeButtonLabel:n,popoverLabel:y}),[4,dc.get(m,l,d,u)];case 3:v=B.sent();x=Da.hasData(e.mediaType)?Da.getData(e.mediaType):xc(m,e.asin,e.mediaType,l,k);if(!x)throw Error("Could not load ModalManager for opening modal: "+e);return[4,x.loadModal({asin:e.asin,mediaId:e.mediaId,reviewId:e.reviewId,mediaType:e.mediaType,showGalleryInModal:c,popoverDetails:{popoverName:this.desktopPopoverModalOptions.name+"_"+e.mediaType,popover:v}})];case 4:return B.sent(),Da.hasData(e.mediaType)||
Da.setData(e.mediaType,x),v.updatePosition(),d.classList.remove("a-declarative"),[2]}})})};return a}(),tb=function(a,b){a=b?a+". Error object: "+JSON.stringify({message:b.message,name:b.name,stack:b.stack}):a;rb.log(a,"FATAL")},ja;(function(a){a.CAROUSEL="crsl";a.IMAGES_CAROUSEL="crsl_img";a.VIDEOS_CAROUSEL="crsl_vid"})(ja||(ja={}));var ka;(function(a){a.DETAIL_PAGE_WIDGET="dp";a.IMAGE_GALLERY="img";a.MEDIA_GALLERY="mg";a.OTHER="othr"})(ka||(ka={}));var la;(function(a){a.SEE_MORE="sm";a.POPOVER="pop";
a.IMAGE="img";a.VIDEO="vid"})(la||(la={}));var ma;(function(a){a.DESKTOP="d";a.MOBILE_APP="ma";a.MOBILE_BROWSER="mb";a.TABLET_APP="ta";a.TABLET_BROWSER="tb";a.UNKNOWN="unkn"})(ma||(ma={}));var xa=function(){function a(b,c,d,e){this.page=b;this.device=c;this.widget=d;this.location=e}a.prototype.toString=function(){return a.PREFIX+a.DELIMITER+this.page+a.DELIMITER+this.device+a.DELIMITER+this.widget+a.DELIMITER+this.location};a.prototype.appendToString=function(b){return b?this.toString()+a.DELIMITER+
b:this.toString()};a.MAX_LENGTH=32;a.PREFIX="cm_cr";a.DELIMITER="_";return a}(),Ac=new xa(ka.DETAIL_PAGE_WIDGET,ma.MOBILE_APP,ja.CAROUSEL,la.IMAGE),Bc=new xa(ka.DETAIL_PAGE_WIDGET,ma.MOBILE_APP,ja.CAROUSEL,la.VIDEO),Cc=new xa(ka.DETAIL_PAGE_WIDGET,ma.MOBILE_APP,ja.IMAGES_CAROUSEL,la.SEE_MORE),Dc=new xa(ka.DETAIL_PAGE_WIDGET,ma.MOBILE_APP,ja.VIDEOS_CAROUSEL,la.SEE_MORE),Ec=new xa(ka.DETAIL_PAGE_WIDGET,ma.MOBILE_BROWSER,ja.IMAGES_CAROUSEL,la.SEE_MORE),Fc=new xa(ka.DETAIL_PAGE_WIDGET,ma.MOBILE_BROWSER,
ja.CAROUSEL,la.VIDEO),Gc=function(){function a(){}a.prototype.onVideoClickHandler=function(b){return g.__awaiter(this,void 0,void 0,function(){return g.__generator(this,function(c){switch(c.label){case 0:return[4,this.onMediaClickHandler(b)];case 1:return c.sent(),[2]}})})};a.prototype.onImageClickHandler=function(b){return g.__awaiter(this,void 0,void 0,function(){return g.__generator(this,function(c){switch(c.label){case 0:return[4,this.onMediaClickHandler(b)];case 1:return c.sent(),[2]}})})};a.prototype.onSeeMoreClickHandler=
function(b){var c;return g.__awaiter(this,void 0,void 0,function(){var d,e,f;return g.__generator(this,function(h){switch(h.label){case 0:return d=null===(c=b.currentTarget)||void 0===c?void 0:c.dataset,e=F[d.mediatype],f=Sa(e),[4,this.goToGallery(b,f)];case 1:return h.sent(),[2]}})})};a.prototype.onMediaClickHandler=function(b){var c;return g.__awaiter(this,void 0,void 0,function(){var d,e,f,h,l;return g.__generator(this,function(m){switch(m.label){case 0:return d=null===(c=b.currentTarget)||void 0===
c?void 0:c.dataset,e=F[d.mediatype],f=d.rank,h={reviewId:d.reviewid,mediaType:e,url:d.url,thumbnailUrl:d.thumbnailurl,physicalId:d.physicalid,asin:d.asin,isSingleReview:!1,hidePivot:!1,refMarker:a.getIVXRefMarker(e,f),ingressType:"dpreviews",filter:e===F.IMAGE?"image":"video",metricsPrefix:e===F.IMAGE?"CarouselImageToAppX":"CarouselVideoToAppX"},[4,Va()];case 1:return l=m.sent(),l.addEventListener("com.amazon.mshop.ivx1.closed.progressPositionAndMediaIdSend",function(){this.refocusToMedia(d.physicalId);
l.removeEventListener("com.amazon.mshop.ivx1.closed.progressPositionAndMediaIdSend")}),[4,Ub(l,h)];case 2:return m.sent(),[2]}})})};a.prototype.refocusToMedia=function(b){return g.__awaiter(this,void 0,void 0,function(){return g.__generator(this,function(c){return[2,new Promise(function(d,e){var f=Q["default"].cardRoot.ownerDocument.querySelector('button[data-physicalid="'+b+'"]');setTimeout(function(){null===f||void 0===f?void 0:f.focus();d()},0)})]})})};a.prototype.goToGallery=function(b,c){var d;
return g.__awaiter(this,void 0,void 0,function(){var e,f,h,l;return g.__generator(this,function(m){switch(m.label){case 0:return e=null===(d=b.currentTarget)||void 0===d?void 0:d.dataset,f=e.asin,h=c===ea.IMAGE?Cc:Dc,[4,Va()];case 1:return l=m.sent(),l.navigate({url:sb(h.toString(),c,f),successCallback:function(){K.logNoError("loadMediaGalleryError",c)},failCallback:function(q){tb("Failed to load gallery for asin: "+f+".",q);K.logError("loadMediaGalleryError",c)}}),[2]}})})};a.getIVXRefMarker=function(b,
c){return(b===F.IMAGE?Ac:Bc).appendToString(c)};return a}(),S=function(){function a(b){var c=this;this.popover=b;this.loadMediaResources=function(){for(var d=c.popover.querySelectorAll("[data-lazyimagesource]"),e=0;e<d.length;e++){var f=d[e],h=f.getAttribute("data-lazyimagesource");f="img"===f.tagName.toLowerCase()?f:f.getElementsByTagName("img")[0];f.getAttribute("src")!=h&&f.setAttribute("src",h)}};this.getCurrentMediaIndex=function(){for(var d=c.popover.querySelectorAll("[data-mediaid]"),e=0;e<
d.length;e++)if("none"!==d[e].style.display)return e;return 0};this.getPreviousPopoverWidget=function(){return c.popover.previousElementSibling?new a(c.popover.previousElementSibling):null};this.getNextPopoverWidget=function(){return c.popover.nextElementSibling?new a(c.popover.nextElementSibling):null};this.getNumbersOfMedia=function(){return c.popover.querySelectorAll("[data-mediaid]").length};this.toggleOverlay=function(){var d=c.popover.getElementsByClassName("_Y3Itb_overlay-content-container_1ubFP")[0];
d.classList.contains("_Y3Itb_media-popover-overlay-fade-out_1eneO")?(d.classList.remove("_Y3Itb_media-popover-overlay-fade-out_1eneO"),d.classList.add("_Y3Itb_media-popover-overlay-fade-in_bZzwP")):(d.classList.add("_Y3Itb_media-popover-overlay-fade-out_1eneO"),d.classList.remove("_Y3Itb_media-popover-overlay-fade-in_bZzwP"))};this.scrollIntoSelf=function(){c.popover.scrollIntoView()};this.scrollIntoMediaByIndex=function(d){c.scrollIntoSelf();var e=!1;c.popover.querySelectorAll("[data-mediaid]").forEach(function(f,
h){e?c.removeHighlightPageIndicator(h):c.addHighlightPageIndicator(h);h==d?(J(f),e=!0):G(f)})};this.scrollIntoMediaId=function(d){c.scrollIntoSelf();c.popover.querySelectorAll("[data-mediaid]").forEach(function(e,f){e.getAttribute("data-mediaid")===d&&c.scrollIntoMediaByIndex(f)})};this.getReviewId=function(){return c.popover.getAttribute("data-reviewid")};this.getPageIndicator=function(d){var e=c.popover.getElementsByClassName("_Y3Itb_media-popover-page-indicator_36NFP")[0];if(e)return e.childNodes[d]};
this.addHighlightPageIndicator=function(d){d=c.getPageIndicator(d);null===d||void 0===d?void 0:d.classList.add("_Y3Itb_highlighted_1QxVg")};this.removeHighlightPageIndicator=function(d){d=c.getPageIndicator(d);null===d||void 0===d?void 0:d.classList.remove("_Y3Itb_highlighted_1QxVg")}}a.getPopoverWidgetById=function(b){return b?Q["default"].cardRoot.ownerDocument.getElementsByClassName("_Y3Itb_media-popover-list-container_3mcnh")[0].querySelector("div[data-reviewid='"+b+"']"):null};a.prototype.handlePopoverClick=
function(b){switch(b){case T.LEFT:if(0<this.getCurrentMediaIndex())this.scrollIntoMediaByIndex(this.getCurrentMediaIndex()-1);else if(b=this.getPreviousPopoverWidget())b.scrollIntoSelf(),b.scrollIntoMediaByIndex(b.getNumbersOfMedia()-1);break;case T.CENTER:this.toggleOverlay();break;case T.RIGHT:if(this.getCurrentMediaIndex()<this.getNumbersOfMedia()-1)this.scrollIntoMediaByIndex(this.getCurrentMediaIndex()+1);else if(b=this.getNextPopoverWidget())b.scrollIntoSelf(),b.scrollIntoMediaByIndex(0)}};
a.prototype.scrollIntoNextPopover=function(){var b=this.getNextPopoverWidget()||this.getPreviousPopoverWidget();b&&b.scrollIntoSelf()};return a}(),aa;(function(a){a.closePopoverClickHandler="ClosePopoverClickHandler";a.popoverClickHandler="PopoverClickHandler";a.desktopLeftClickHandler="DesktopLeftClickHandler";a.desktopRightClickHandler="DesktopRightClickHandler";a.openReportConfirmationDialogClickHandler="OpenReportConfirmationDialogClickHandler";a.helpfulVoteClickHandler="HelpfulVoteClickHandler";
a.confirmReportAbuseClickHandler="ConfirmReportAbuseClickHandler";a.noopHandler="noopHandler";a.loadMediaPopover="loadMediaPopover";a.closePopoverErrorDialogClickHandler="ClosePopoverErrorDialogClickHandler"})(aa||(aa={}));var Hc=function(){function a(b){this.popover=b;b=b.getElementsByClassName("_Y3Itb_cr-popover-overlay-text-container_NfghQ")[0];this.text=b.querySelector("._Y3Itb_cr-text_28H9k");this.title=b.querySelector("._Y3Itb_cr-title_3bWqW");this.expandButton=b.querySelector("._Y3Itb_cr-text-expand-button_2BWKW");
this.hideButton=b.querySelector("._Y3Itb_cr-text-hide-button_2qNi2")}a.prototype.toggleElementExpansion=function(b,c){c?(b.classList.remove("_Y3Itb_truncated_j_-Jw"),b.classList.add("_Y3Itb_expanded_2wQ4c")):(b.classList.remove("_Y3Itb_expanded_2wQ4c"),b.classList.add("_Y3Itb_truncated_j_-Jw"))};a.prototype.initResizeObserver=function(){var b=this;if(this.title||this.text)this.observer=new ResizeObserver(function(c){var d;try{for(var e=g.__values(c),f=e.next();!f.done;f=e.next())a.isTruncated(f.value.target,
"_Y3Itb_truncated_j_-Jw")&&J(b.expandButton)}catch(l){var h={error:l}}finally{try{f&&!f.done&&(d=e.return)&&d.call(e)}finally{if(h)throw h.error;}}}),this.title&&this.observer.observe(this.title),this.text&&this.observer.observe(this.text)};a.prototype.expandText=function(){this.text&&a.isTruncated(this.text,"_Y3Itb_truncated_j_-Jw")&&this.toggleElementExpansion(this.text,!0);this.title&&a.isTruncated(this.title,"_Y3Itb_truncated_j_-Jw")&&this.title.classList.remove("_Y3Itb_truncated_j_-Jw");G(this.expandButton);
J(this.hideButton);this.setPopoverOverlayGradient(!0);this.showActionButtons(!1)};a.prototype.toggleText=function(){this.text&&a.isTruncated(this.text,"_Y3Itb_truncated_j_-Jw")||this.title&&a.isTruncated(this.title,"_Y3Itb_truncated_j_-Jw")?this.expandText():this.hideText()};a.prototype.hideText=function(){this.text&&(this.text.offsetHeight<this.text.scrollHeight&&(this.text.scrollTop=0),this.toggleElementExpansion(this.text,!1));this.title&&this.title.classList.add("_Y3Itb_truncated_j_-Jw");G(this.hideButton);
this.setPopoverOverlayGradient(!1);this.showActionButtons(!0)};a.prototype.setPopoverOverlayGradient=function(b){var c=this.popover.getElementsByClassName("_Y3Itb_cr-media-popover-overlay-container_32qUq")[0];c&&(b?(c.classList.add("_Y3Itb_popover-overlay-gradient_114MI"),c.dataset.mixOperations=aa.noopHandler):c.classList.contains("_Y3Itb_popover-overlay-gradient_114MI")&&(c.classList.remove("_Y3Itb_popover-overlay-gradient_114MI"),c.dataset.mixOperations&&delete c.dataset.mixOperations))};a.prototype.showActionButtons=
function(b){var c=this.popover.getElementsByClassName("_Y3Itb_cr-action-buttons-container_28a_m")[0];c&&(b?J(c):G(c))};a.isTruncated=function(b,c){return b&&b.offsetHeight<b.scrollHeight&&b.classList.contains(c)};return a}(),jb=function(a){if(a)return(null===a||void 0===a?0:a.getElementsByClassName("_Y3Itb_cr-popover-overlay-text-container_NfghQ")[0])?new Hc(a):void 0},Ic=function(){return function(){var a=this;this.show=function(){J(a.popoverList)};this.hide=function(){G(a.popoverList)};this.getNumberOfPopoversLoaded=
function(){return a.popoverList.childNodes.length};this.getNumberOfPopoversLeft=function(){if(a.currentReviewId){var b=0;a.popoverList.childNodes.forEach(function(c,d){c.getAttribute("data-reviewid")==a.currentReviewId&&(b=a.getNumberOfPopoversLoaded()-d)});return b}return a.popoverList.childNodes.length};this.addPopovers=function(b){b.querySelectorAll("._Y3Itb_media-popover-container_15D5F").forEach(function(c){c=ia.unscope(c);var d=c.getAttribute("data-reviewid");S.getPopoverWidgetById(d)||(a.popoverList.appendChild(c),
a.observer.observe(c),c=jb(S.getPopoverWidgetById(d)),null===c||void 0===c?void 0:c.initResizeObserver())})};this.scrollTo=function(b,c){a.setCurrentReviewId(b);b=S.getPopoverWidgetById(b);(new S(b)).scrollIntoMediaId(c)};this.setCurrentReviewId=function(b){a.currentReviewId=b};this.doesPopoverExists=function(b){return null!=S.getPopoverWidgetById(b)};this.getNextToken=function(){return a.popoverList.getAttribute("data-next-token")};this.setNextToken=function(b){return a.popoverList.setAttribute("data-next-token",
b)};this.setOnScrollCallback=function(b){a.onScrollCallback=b};this.popoverList=Q["default"].cardRoot.ownerDocument.getElementsByClassName("_Y3Itb_media-popover-list-container_3mcnh")[0];this.observer=new IntersectionObserver(function(b){b.forEach(function(c){if(c.isIntersecting){c=new S(c.target);var d=c.getReviewId(),e=a.currentReviewId;a.setCurrentReviewId(d);if(a.onScrollCallback)a.onScrollCallback(d);c.loadMediaResources();c=jb(S.getPopoverWidgetById(e));null===c||void 0===c?void 0:c.hideText()}})},
{threshold:.5})}}(),Ja=function(){function a(){this.confirmationDialog=Q["default"].cardRoot.ownerDocument.querySelector("._Y3Itb_media-popover-report-abuse-confirmation-dialog_7HNIt");this.confirmButton=Q["default"].cardRoot.ownerDocument.querySelector("._Y3Itb_media-popover-report-abuse-confirmation-dialog-button_35f75")}a.prototype.setReviewId=function(b){this.confirmButton.dataset.id=b};a.prototype.setAsin=function(b){this.confirmButton.dataset.asin=b};a.prototype.show=function(){J(this.confirmationDialog)};
a.prototype.hide=function(){G(this.confirmationDialog)};return a}(),Fb=function(){function a(){this.popoverSkeleton=Q["default"].cardRoot.ownerDocument.getElementsByClassName("_Y3Itb_media-popover-skeleton-container_3DI7n")[0];this.profileSkeleton=this.popoverSkeleton.getElementsByClassName("_Y3Itb_profile-skeleton_1JfdD")[0]}a.prototype.show=function(){J(this.popoverSkeleton)};a.prototype.hide=function(){G(this.popoverSkeleton)};a.prototype.setLoadingAnimation=function(b){b?this.profileSkeleton.classList.add("_Y3Itb_loading_3908t"):
this.profileSkeleton.classList.contains("_Y3Itb_loading_3908t")&&this.profileSkeleton.classList.remove("_Y3Itb_loading_3908t")};return a}(),na;(function(a){a[a.Popover=0]="Popover";a[a.Gallery=1]="Gallery";a[a.ReportAbuseConfirmationDialog=2]="ReportAbuseConfirmationDialog"})(na||(na={}));var Ea=function(){function a(){}a.getInstance=function(){a.instance||(a.instance=new a);return a.instance};a.prototype.initPopoverWidgetList=function(){null==this.popoverWidgetList&&(this.popoverWidgetList=new Ic);
return this.popoverWidgetList};a.prototype.initPopoverSkeletonClient=function(){this.popoverSkeleton=new Fb};a.prototype.initPopover=function(b){a.currentScreen=na.Popover;a.popoverName=b;this.resetOverlayComponents();this.initPopoverWidgetList();this.initPopoverSkeletonClient()};a.prototype.loadMediaPopover=function(b){return g.__awaiter(this,void 0,void 0,function(){var c,d,e,f,h,l,m,q=this;return g.__generator(this,function(n){switch(n.label){case 0:return this.initPopover(b.popoverDetails.popoverName),
this.popoverSkeleton.show(),this.popoverWidgetList.hide(),this.popoverSkeleton.setLoadingAnimation(!0),b.popoverDetails.popover?[4,b.popoverDetails.popover.showSync()]:[3,2];case 1:n.sent(),n.label=2;case 2:c=this.popoverWidgetList.doesPopoverExists(b.reviewId),d=0,n.label=3;case 3:n.trys.push([3,9,,10]),n.label=4;case 4:if(c)return[3,6];e=0===d;return[4,this.fetchAnotherPopoversPage(b.asin,b.mediaType,e)];case 5:return f=n.sent(),c=this.popoverWidgetList.doesPopoverExists(b.reviewId),d++,f?[3,4]:
[3,6];case 6:if(c)return[3,8];h=qa.setup(["renderPopover"]);return[4,h.renderPopover({reviewId:b.reviewId})];case 7:l=n.sent(),this.popoverWidgetList.addPopovers(l),this.popoverWidgetList.setNextToken(""),c=!0,K.logCounter("mobileweb.missingReviewId",1),n.label=8;case 8:return this.popoverWidgetList.show(),c&&this.popoverWidgetList.scrollTo(b.reviewId,b.mediaId),this.popoverSkeleton.hide(),[3,10];case 9:return n.sent(),K.logCounter("mobile.popoverLoading.Error",1),this.popoverSkeleton.setLoadingAnimation(!1),
m=new sa("loadPopoverError"),m.setClickParams(new Map([["data-popovername",b.popoverDetails.popoverName],["data-asin",b.asin],["data-mediatype",b.mediaType.toString()],["data-reviewid",b.reviewId],["data-mediaid",b.mediaId]])),m.show(),[3,10];case 10:return this.popoverWidgetList.setOnScrollCallback(function(){5>=q.popoverWidgetList.getNumberOfPopoversLeft()&&q.fetchAnotherPopoversPage(b.asin,b.mediaType)}),[2]}})})};a.prototype.resetOverlayComponents=function(){(new Ja).hide();(new sa("loadPopoverError")).hide();
(new sa("reportAbuseThankYouMessage")).hide()};a.prototype.showReportAbuseConfirmationDialog=function(b,c){a.currentScreen=na.ReportAbuseConfirmationDialog;var d=new Ja;d.setReviewId(b);d.setAsin(c);d.show()};a.prototype.back=function(){switch(a.currentScreen){case na.Popover:case na.Gallery:Ba.getPopoverByName(a.popoverName).hide();break;case na.ReportAbuseConfirmationDialog:(new Ja).hide(),a.currentScreen=na.Popover}};a.prototype.fetchAnotherPopoversPage=function(b,c,d){void 0===d&&(d=!1);return g.__awaiter(this,
void 0,void 0,function(){var e,f;return g.__generator(this,function(h){switch(h.label){case 0:e=this.popoverWidgetList.getNumberOfPopoversLoaded();f=this.popoverWidgetList.getNextToken();if(!(d||!this.isAlreadyLoadingMedia&&f&&500>=e))return[3,5];this.isAlreadyLoadingMedia=!0;h.label=1;case 1:return h.trys.push([1,,3,4]),[4,this.loadPopovers(b,c,f)];case 2:return h.sent(),[3,4];case 3:return this.isAlreadyLoadingMedia=!1,[7];case 4:return[2,!0];case 5:return[2,!1]}})})};a.prototype.loadPopovers=function(b,
c,d){return g.__awaiter(this,void 0,void 0,function(){var e,f;return g.__generator(this,function(h){switch(h.label){case 0:return e=qa.setup(["renderPopoverList"]),[4,e.renderPopoverList({asin:b,nextToken:d,mediaType:c,limit:50})];case 1:return f=h.sent(),this.popoverWidgetList.addPopovers(f),d=f.getAttribute("data-next-token"),this.popoverWidgetList.setNextToken(d),[2,d]}})})};return a}().getInstance(),Jc=function(){function a(){}a.prototype.onVideoClickHandler=function(b){var c;return g.__awaiter(this,
void 0,void 0,function(){var d,e,f,h,l,m,q,n,y=this;return g.__generator(this,function(k){d=null===(c=b.currentTarget)||void 0===c?void 0:c.dataset;e=d.asin;f=d.physicalid;h=d.reviewid;l=d.extension;m=d.thumbnailurl;q=this.getRefMarker(d.rank);Ha["default"].trigger("a:declarative:reviews:open-mweb-immersive-video-modal:click",{$event:b.event,$target:b.currentTarget,data:{asin:e,filter:"video",isSingleReview:!0,mediaType:"video",metricsPrefix:"CarouselVideoToAppX",physicalId:f,refMarker:q,reviewId:h,
shouldTriggerRefTag:!0,slateImageUrl:m,url:"https://m.media-amazon.com/images/I/"+f+"."+l}});n=function(){y.refocusToMedia(f);Ha["default"].off("vse:ns:partialcomponents:vse_reviews_mobile:lightboxClosed",n)};Ha["default"].on("vse:ns:partialcomponents:vse_reviews_mobile:lightboxClosed",n);return[2]})})};a.prototype.refocusToMedia=function(b){return g.__awaiter(this,void 0,void 0,function(){return g.__generator(this,function(c){return[2,new Promise(function(d,e){var f=Q["default"].cardRoot.ownerDocument.querySelector('button[data-physicalid="'+
b+'"]');setTimeout(function(){null===f||void 0===f?void 0:f.focus();d()},0)})]})})};a.prototype.getRefMarker=function(b){return Fc.appendToString(b)};return a}(),Kc=function(){function a(){this.mWebImmersiveVideoClickHandler=new Jc}a.prototype.addMinHeightToParent=function(b){(b=Q["default"].cardRoot.ownerDocument.querySelector("."+b))&&b.parentElement&&(b.parentElement.style.minHeight="inherit")};a.prototype.onVideoClickHandler=function(b){return g.__awaiter(this,void 0,void 0,function(){return g.__generator(this,
function(c){switch(c.label){case 0:return[4,this.mWebImmersiveVideoClickHandler.onVideoClickHandler(b)];case 1:return c.sent(),[2]}})})};a.prototype.onImageClickHandler=function(b){var c;return g.__awaiter(this,void 0,void 0,function(){var d,e,f,h,l;return g.__generator(this,function(m){switch(m.label){case 0:return d=null===(c=b.currentTarget)||void 0===c?void 0:c.dataset,e=W["default"].cardRoot.getElementsByClassName("_Y3Itb_media-popover-container_2BBbs")[0],f="cr-media-popover",[4,cc.get(f,e,
b.currentTarget)];case 1:return h=m.sent(),l=F[d.mediatype],[4,Ea.loadMediaPopover({mediaType:l,asin:d.asin,reviewId:d.reviewid,mediaId:d.physicalid,popoverDetails:{popoverName:f,popover:h}})];case 2:return m.sent(),this.addMinHeightToParent("_Y3Itb_media-popover-container_2BBbs"),b.currentTarget&&b.currentTarget.classList.remove("a-declarative"),[2]}})})};a.prototype.onSeeMoreClickHandler=function(b){var c;return g.__awaiter(this,void 0,void 0,function(){var d,e,f,h;return g.__generator(this,function(l){d=
null===(c=b.currentTarget)||void 0===c?void 0:c.dataset;e=F[d.mediatype];f=Sa(e);h=d.asin;if(f===ea.IMAGE)Z["default"].setLocation(sb(Ec.toString(),ea.IMAGE,h));else throw K.logError("loadVideoGalleryError",f),Error("Video gallery is not available on mWeb.");return[2]})})};return a}(),Lc=function(){function a(){}a.getThumbnailClickHandler=function(){return g.__awaiter(this,void 0,void 0,function(){var b;return g.__generator(this,function(c){switch(c.label){case 0:return[4,wb()];case 1:b=c.sent();
switch(b){case ca.MSHOP:return[2,new Gc];case ca.MWEB:return[2,new Kc];case ca.DESKTOP:return[2,new zc]}return[2]}})})};return a}(),Mc=function(){function a(b){this.clickHandler=this.clickHandler=b}a.prototype.registerThumbnailClickHandlers=function(){this.registerCRVideoThumbnailClickHandler();this.registerCRImageThumbnailClickHandler();this.registerCRSeeMoreThumbnailClickHandler()};a.prototype.registerCRVideoThumbnailClickHandler=function(){var b=this,c=H["default"].setup().define;c(ac.clickHandler,
"click",function(d){return g.__awaiter(b,void 0,void 0,function(){return g.__generator(this,function(e){switch(e.label){case 0:return[4,this.clickHandler.onVideoClickHandler(d)];case 1:return e.sent(),K.logCounter("videoThumbnail.click",1),[2]}})})})};a.prototype.registerCRImageThumbnailClickHandler=function(){var b=this,c=H["default"].setup().define;c(Zb.clickHandler,"click",function(d){return g.__awaiter(b,void 0,void 0,function(){return g.__generator(this,function(e){switch(e.label){case 0:return[4,
this.clickHandler.onImageClickHandler(d)];case 1:return e.sent(),K.logCounter("imageThumbnail.click",1),[2]}})})})};a.prototype.registerCRSeeMoreThumbnailClickHandler=function(){var b=this,c=H["default"].setup().define;c($b.clickHandler,"click",function(d){return g.__awaiter(b,void 0,void 0,function(){var e,f;return g.__generator(this,function(h){switch(h.label){case 0:return[4,this.clickHandler.onSeeMoreClickHandler(d)];case 1:return h.sent(),e=F[null===(f=d.currentTarget)||void 0===f?void 0:f.dataset.mediatype],
K.logCounter("seeMore."+e.toLowerCase()+".click",1),[2]}})})})};return a}(),kb;(kb||(kb={})).closePopoverClickHandler="ClosePopoverClickHandler";var Nc=function(){function a(){}a.registerClosePopoverClickHandler=function(){var b=H["default"].setup().define;b(kb.closePopoverClickHandler,"click",function(c){c.stopBubble();Ea.back()})};return a}(),Fa;(function(a){a.expandTextClickHandler="expandTextClickHandler";a.hideTextClickHandler="hideTextClickHandler";a.toggleTextClickHandler="toggleTextClickHandler"})(Fa||
(Fa={}));var Oc=function(){function a(){}a.registerTextExpanderClickHandlers=function(){a.registerExpandTextClickHandler();a.registerHideTextClickHandler();a.registerToggleTextClickHandler()};a.registerExpandTextClickHandler=function(){var b=H["default"].setup().define;b(Fa.expandTextClickHandler,"click",function(c){c.stopBubble();c=a.getTextExpanderClient(c);null===c||void 0===c?void 0:c.expandText()})};a.registerHideTextClickHandler=function(){var b=H["default"].setup().define;b(Fa.hideTextClickHandler,
"click",function(c){c.stopBubble();c=a.getTextExpanderClient(c);null===c||void 0===c?void 0:c.hideText()})};a.registerToggleTextClickHandler=function(){var b=H["default"].setup().define;b(Fa.toggleTextClickHandler,"click",function(c){c.stopBubble();c=a.getTextExpanderClient(c);null===c||void 0===c?void 0:c.toggleText()})};a.getTextExpanderClient=function(b){var c;b=null===(c=b.currentTarget)||void 0===c?void 0:c.dataset.reviewid;return jb(S.getPopoverWidgetById(b))};return a}(),Gb=function(){function a(){this.errorDialog=
Q["default"].cardRoot.ownerDocument.querySelector("._Y3Itb_media-popover-error-dialog_2LoQP")}a.prototype.show=function(){J(this.errorDialog)};a.prototype.hide=function(){G(this.errorDialog)};return a}(),lb;(lb||(lb={})).closeToastBar="closeToastBarClickHandler";var Hb=function(){function a(){}a.registerCloseToastBarClickHandler=function(){var b=H["default"].setup().define;b(lb.closeToastBar,"click",function(c){c.stopBubble();c=c.currentTarget.closest("div[data-toast-bar-name='"+c.currentTarget.dataset.toastBarName+
"']");w(c,function(d){return G(d)})})};return a}(),Pc=function(){function a(){}a.prototype.registerMediaPopoverClickHandlers=function(){Nc.registerClosePopoverClickHandler();this.registerOpenPopoverReportConfirmationDialog();this.registerHelpfulVoteClickHandler();this.registerMediaOverlayClickHandlers();this.registerNoopHandler();this.registerConfirmReportAbuseClickHandler();this.registerClosePopoverErrorDialogClickHandler();this.registerLoadMediaPopoverClickHandler();Hb.registerCloseToastBarClickHandler()};
a.prototype.registerNoopHandler=function(){var b=H["default"].setup().define;b(aa.noopHandler,"click",function(c){c.stopBubble()})};a.prototype.registerMediaOverlayClickHandlers=function(){this.registerMediaOverlayNavigationClickHandlers();Oc.registerTextExpanderClickHandlers()};a.prototype.registerClosePopoverErrorDialogClickHandler=function(){var b=H["default"].setup().define;b(aa.closePopoverErrorDialogClickHandler,"click",function(c){c.stopBubble();(new Gb).hide()})};a.prototype.registerMediaOverlayNavigationClickHandlers=
function(){var b=H["default"].setup().define;b(aa.popoverClickHandler,"click",function(c){var d=c.event,e=c.currentTarget;var f=d.clientX/e.clientWidth*100;d=d.clientY/e.clientHeight*100;e=(e.clientWidth>e.clientHeight?Ca.LANDSCAPE:Ca.POTRAIT)===Ca.POTRAIT?{lowerBound:33,upperBound:67}:{lowerBound:40,upperBound:80};f=d<=e.lowerBound||d>=e.upperBound?T.NONE:25>=f?T.LEFT:75<=f?T.RIGHT:T.CENTER;(new S(S.getPopoverWidgetById(c.currentTarget.dataset.reviewid))).handlePopoverClick(f)});b(aa.desktopRightClickHandler,
"click",function(c){(new S(S.getPopoverWidgetById(c.currentTarget.dataset.reviewid))).handlePopoverClick(T.RIGHT)});b(aa.desktopLeftClickHandler,"click",function(c){(new S(S.getPopoverWidgetById(c.currentTarget.dataset.reviewid))).handlePopoverClick(T.LEFT)})};a.prototype.registerOpenPopoverReportConfirmationDialog=function(){var b=H["default"].setup().define;b(aa.openReportConfirmationDialogClickHandler,"click",function(c){c.stopBubble();Ea.showReportAbuseConfirmationDialog(c.currentTarget.dataset.id,
c.currentTarget.dataset.asin)})};a.prototype.showErrorDialog=function(){(new Ja).hide();(new Gb).show()};a.prototype.registerConfirmReportAbuseClickHandler=function(){var b=this,c=H["default"].setup().define,d=fa["default"].setup(["reportAbuse"]);c(aa.confirmReportAbuseClickHandler,"click",function(e){e.stopBubble();var f=e.currentTarget.firstChild.dataset.id;e=e.currentTarget.firstChild.dataset.asin;d.reportAbuse({reviewId:f,domain:Aa(),asin:e}).then(function(h){!h.success&&h.redirectUrl?Z["default"].setLocation(h.redirectUrl):
h.success?(Ea.back(),(new S(S.getPopoverWidgetById(f))).scrollIntoNextPopover(),(new sa("reportAbuseThankYouMessage")).show()):b.showErrorDialog()})})};a.prototype.registerHelpfulVoteClickHandler=function(){var b=this,c=H["default"].setup().define,d=fa["default"].setup(["helpful"]);c(aa.helpfulVoteClickHandler,"click",function(e){e.stopBubble();var f=e.currentTarget.dataset.id;e=e.currentTarget.dataset.asin;d.helpful({reviewId:f,domain:Aa(),asin:e}).then(function(h){!h.success&&h.redirectUrl?Z["default"].setLocation(h.redirectUrl):
h.success?(new gb(gb.getActionButtonsContainer(f))).likeButtonClicked():b.showErrorDialog()})})};a.prototype.registerLoadMediaPopoverClickHandler=function(){var b=this,c=H["default"].setup().define;c(aa.loadMediaPopover,"click",function(d){return g.__awaiter(b,void 0,void 0,function(){var e,f,h,l;return g.__generator(this,function(m){switch(m.label){case 0:return e=new Fb,f=null===(l=d.currentTarget)||void 0===l?void 0:l.dataset,h=F[f.mediatype],e.show(),e.setLoadingAnimation(!0),[4,Ea.loadMediaPopover({asin:f.asin,
mediaType:h,reviewId:f.reviewid,mediaId:f.mediaid,popoverDetails:{popoverName:f.popovername},isDesktop:!vb()})];case 1:return m.sent(),[2]}})})})};return a}(),Y=H["default"].setup().define,ba=function(a,b){w(a.currentTarget,function(c){var d=yb(c);if(!d.mediaType)throw Error("unable to extract mediaType from element: "+a.operationName+", "+c.nodeName);var e=Da.getData(d.mediaType);if(!e)throw Error("unable to get modalManager: "+a.operationName+", "+d);b(e,d,c.dataset)})},Qc=function(){Y(U.galleryItemClickHandler,
"click",function(a){return g.__awaiter(void 0,void 0,void 0,function(){return g.__generator(this,function(b){ba(a,function(c,d,e){if(!d.reviewId||!d.mediaId)throw Error("reviewId or mediaId was not found on the media gallery item: "+JSON.stringify(e));c.updateModalWithReview(d.reviewId,d.mediaId,d.mediaType)});return[2]})})})},Rc=function(){Y(U.showMediaGalleryClickHandler,"click",function(a){return g.__awaiter(void 0,void 0,void 0,function(){return g.__generator(this,function(b){ba(a,function(c){return c.showMediaGallery()});
return[2]})})})},Sc=function(){Y(U.reloadMediaPopover,"click",function(a){return g.__awaiter(void 0,void 0,void 0,function(){return g.__generator(this,function(b){ba(a,function(c,d,e){if("true"===e.showgalleryinmodal&&!d.asin)throw Error("asin was not found on the toastbar : "+JSON.stringify(e));if(!("true"===e.showgalleryinmodal||d.reviewId&&d.mediaId&&d.asin))throw Error("reviewId/mediaId/asin was not found on the toastbar : "+JSON.stringify(e));c.loadModal({asin:d.asin,mediaId:d.mediaId,reviewId:d.reviewId,
mediaType:d.mediaType,showGalleryInModal:"true"==e.showgalleryinmodal?!0:!1,popoverDetails:{popoverName:e.popovername}})});return[2]})})})},Tc=function(){Y(U.thumbnailClickHandler,"click",function(a){ba(a,function(b,c,d){if(!c.mediaId)throw Error("mediaId was not found while clicking on media thumbnail: "+d);b.updateMediaInModal(c.mediaId)})})},Uc=function(){Y(U.rightClickHandler,"click",function(a){return g.__awaiter(void 0,void 0,void 0,function(){return g.__generator(this,function(b){ba(a,function(c){return c.handleModalMediaProgressionClick(T.RIGHT)});
return[2]})})});Y(U.leftClickHandler,"click",function(a){return g.__awaiter(void 0,void 0,void 0,function(){return g.__generator(this,function(b){ba(a,function(c){return c.handleModalMediaProgressionClick(T.LEFT)});return[2]})})})},Vc=function(){Y(U.expandTextClickHandler,"click",function(a){ba(a,function(b){return b.handleExpanderClick(ua.EXPAND)})});Y(U.hideTextClickHandler,"click",function(a){ba(a,function(b){return b.handleExpanderClick(ua.HIDE)})})},Wc=function(){Y(U.openReportConfirmationDialogClickHandler,
"click",function(a){return g.__awaiter(void 0,void 0,void 0,function(){return g.__generator(this,function(b){ba(a,function(c){return g.__awaiter(void 0,void 0,void 0,function(){return g.__generator(this,function(d){c.openReportAbuseDialog(a.currentTarget);return[2]})})});return[2]})})});Y(U.confirmReportAbuseClickHandler,"click",function(a){return g.__awaiter(void 0,void 0,void 0,function(){return g.__generator(this,function(b){ba(a,function(c){return g.__awaiter(void 0,void 0,void 0,function(){return g.__generator(this,
function(d){c.handleReportAbuseClick();return[2]})})});return[2]})})})},Xc=function(){Y(U.helpfulVoteClickHandler,"click",function(a){return g.__awaiter(void 0,void 0,void 0,function(){return g.__generator(this,function(b){ba(a,function(c){return g.__awaiter(void 0,void 0,void 0,function(){return g.__generator(this,function(d){c.handleHelpulVoteClick();return[2]})})});return[2]})})})},Yc=function(){Y(U.closeMediaPopover,"click",function(a){ba(a,function(b){return g.__awaiter(void 0,void 0,void 0,
function(){return g.__generator(this,function(c){b.closeModal();return[2]})})})})},Zc=function(){Y(U.noopHandler,"click",function(a){a.stopBubble()})},$c=function(){return g.__awaiter(void 0,void 0,void 0,function(){var a,b;return g.__generator(this,function(c){switch(c.label){case 0:return[4,wb()];case 1:a=c.sent();switch(a){case ca.DESKTOP:Qc();Rc();Sc();Tc();Uc();Vc();Wc();Xc();Zc();Yc();Hb.registerCloseToastBarClickHandler();break;case ca.MWEB:b=new Pc,b.registerMediaPopoverClickHandlers()}return[2]}})})},
ta;(function(a){a.IMAGE="IMAGE";a.VIDEO="VIDEO"})(ta||(ta={}));var mb;(mb||(mb={})).helpfulVoteClickHandler="HelpfulVoteClickHandler";var Ka;(function(a){a.requestTranslationClickHandler="requestTranslationClickHandler";a.seeOriginalReviewClickHandler="seeOriginalReviewClickHandler"})(Ka||(Ka={}));var La;(function(a){a.imageClickHandler="SingleReviewMediaImageThumbnailClickHandler";a.videoClickHandler="SingleReviewMediaVideoThumbnailClickHandler"})(La||(La={}));var Ma;(function(a){a.popoverCloseButtonClickHandler=
"MediaPopoverCloseButtonClickHandler";a.popoverNextMediaClickHandler="MediaPopoverNextMediaClickHandler"})(Ma||(Ma={}));var Na;(function(a){a.VOTE="vote";a.INLINE="inline_review";a.REPORT="report";a.SHOW_ALL="show_all_top"})(Na||(Na={}));var Oa;(function(a){a.SINGLE_REVIEW_PAGE="srp";a.DETAIL_PAGE="dp";a.ALL_REVIEWS_PAGE="arp"})(Oa||(Oa={}));var Pa;(function(a){a.EDIT="edit";a.DELETE="del";a.IMAGE="img";a.VIDEO="vid"})(Pa||(Pa={}));var Qa;(function(a){a.DESKTOP="d";a.MOBILE_APP="ma";a.MOBILE_BROWSER=
"mb";a.TABLET_APP="ta";a.TABLET_BROWSER="tb";a.UNKNOWN="unkn"})(Qa||(Qa={}));var Ib=function(a){return"cm_cr_"+a.page+"_"+a.device+(a.widget?"_"+a.widget:"")+(a.location?"_"+a.location:"")},Ra=function(a,b,c){qb.count(c?c+"."+a:a,b)},bd=function(a,b){return g.__awaiter(void 0,void 0,void 0,function(){var c;return g.__generator(this,function(d){c=Date.now();a.navigate({failCallback:function(e){var f="Failed to load IVX for reviewId: "+b.reviewId+".";e=e?f+". Error object: "+JSON.stringify({message:e.message,
name:e.name,stack:e.stack}):f;rb.log(e,"FATAL");Ra("IvxMashNavigateError",1,b.mediaType)},successCallback:function(){var e=Date.now()-c;Ra("IvxMashNavigateLatency",e,b.mediaType);Ra("IvxMashNavigateError",0,b.mediaType);Ra("IvxMashNavigate",1,b.mediaType)},url:ad(b)});return[2]})})},ad=function(a){var b=g.__assign,c=g.__assign,d=a.hidePivot,e=a.ingressType,f=a.isSingleReview,h=a.metricsPrefix,l=a.asin,m=a.refMarker,q=a.reviewId,n=JSON,y=n.stringify;var k=a.mediaType===ta.VIDEO;k=g.__assign({imageUrl:k?
a.thumbnailUrl:a.url,physicalId:a.physicalId},k&&{videoUrl:a.url});a=b.call(g,c.call(g,{hidePivot:d,ingressType:e,isSingleReview:f,metricsPrefix:h,productAsin:l,refMarker:m,reviewId:q,viewData:y.call(n,[k])},a.filter&&{filter:a.filter}),a.mediaType===ta.VIDEO?{videoUrl:a.url}:{imageUrl:a.url});return"ssnap://www.amazon.com/ive?"+cd(a)},cd=function(a){return Object.keys(a).map(function(b){return b+"="+a[b]}).join("&")},nb,dd=function(){return g.__awaiter(void 0,void 0,void 0,function(){return g.__generator(this,
function(a){return[2,new Promise(function(b){P.now("mash").execute(function(c){b(c)})})]})})},Jb=function(){return g.__awaiter(void 0,void 0,void 0,function(){return g.__generator(this,function(a){switch(a.label){case 0:return nb?[3,2]:[4,dd()];case 1:nb=a.sent(),a.label=2;case 2:return[2,nb]}})})},ed=function(){return g.__awaiter(void 0,void 0,void 0,function(){return g.__generator(this,function(a){switch(a.label){case 0:return[4,Jb()];case 1:return[2,!!a.sent()]}})})},fd=function(){function a(){}
a.prototype.onVideoClickHandler=function(b){return g.__awaiter(this,void 0,void 0,function(){return g.__generator(this,function(c){switch(c.label){case 0:return[4,this.onMediaClickHandler(b)];case 1:return c.sent(),[2]}})})};a.prototype.onImageClickHandler=function(b){return g.__awaiter(this,void 0,void 0,function(){return g.__generator(this,function(c){switch(c.label){case 0:return[4,this.onMediaClickHandler(b)];case 1:return c.sent(),[2]}})})};a.prototype.onMediaClickHandler=function(b){var c;return g.__awaiter(this,
void 0,void 0,function(){var d,e,f,h,l;return g.__generator(this,function(m){switch(m.label){case 0:return d=null===(c=b.currentTarget)||void 0===c?void 0:c.dataset,e=ta[d.mediatype?d.mediatype:"IMAGE"],f=d.rank,h={reviewId:d.reviewid,mediaType:e,url:d.url,thumbnailUrl:d.thumbnailurl,physicalId:d.physicalid,asin:d.asin,isSingleReview:!0,hidePivot:!1,refMarker:a.getIVXRefMarker(e,f),ingressType:"dpreviews",metricsPrefix:e===ta.IMAGE?"InlineReviewImageToAppX":"InlineReviewVideoToAppX"},[4,Jb()];case 1:return l=
m.sent(),[4,bd(l,h)];case 2:return m.sent(),[2]}})})};a.getIVXRefMarker=function(b,c){var d={page:Oa.SINGLE_REVIEW_PAGE,device:Qa.MOBILE_APP,widget:Na.INLINE,location:Pa.IMAGE},e={page:Oa.SINGLE_REVIEW_PAGE,device:Qa.MOBILE_APP,widget:Na.INLINE,location:Pa.VIDEO};b=b===ta.IMAGE?d:e;c=c?Ib(b)+"_"+c:Ib(b);return c};return a}(),gd={activate:"onclick",dataStrategy:"preload",hideHeader:!0,padding:"none"},Kb=function(a){function b(){return null!==a&&a.apply(this,arguments)||this}g.__extends(b,a);b.get=
function(c,d,e,f){f=f?g.__assign(g.__assign({},f),{name:c}):g.__assign(g.__assign({},gd),{name:c});return a.createOrGet.call(this,c,d,e,f)};return b}(function(){function a(b){this.popover=b}a.prototype.showSync=function(){var b=this;return new Promise(function(c){P.when("A").execute(function(d){var e="a:popover:afterSlide:"+b.popover.name,f=function(){d.off(e,f);c()};d.on(e,f);b.show()})})};a.prototype.show=function(){this.popover.show()};a.prototype.hide=function(){this.popover.hide()};a.createOrGet=
function(b,c,d,e){var f=this;return new Promise(function(h){f.popovers[b]?h(f.popovers[b]):P.when("a-secondary-view").execute(function(l){W["default"].scopeElement(c);l=l.create(d,e);f.popovers[b]=new a(l);h(f.popovers[b])})})};a.popovers={};return a}()),Lb=function(){function a(){}a.prototype.onVideoClickHandler=function(b){var c;return g.__awaiter(this,void 0,void 0,function(){var d,e,f,h,l,m;return g.__generator(this,function(q){d=null===(c=b.currentTarget)||void 0===c?void 0:c.dataset;e=d.asin;
f=d.physicalid;h=d.reviewid;l=d.extension;m=d.thumbnailurl;Ha["default"].trigger("a:declarative:reviews:open-mweb-immersive-video-modal:click",{$event:b.event,$target:b.currentTarget,data:{asin:e,isSingleReview:!0,refMarker:"inline_review",metricsPrefix:"InlineRevToAppX",physicalId:f,slateImageUrl:m,hidePivot:!1,mediaType:"video",reviewId:h,url:"https://m.media-amazon.com/images/I/"+f+"."+l}});return[2]})})};a.prototype.onImageClickHandler=function(b){var c,d,e;return g.__awaiter(this,void 0,void 0,
function(){var f,h,l,m,q;return g.__generator(this,function(n){switch(n.label){case 0:return f=null===(c=b.currentTarget)||void 0===c?void 0:c.dataset,h=qa.setup(["renderPopover"]),[4,h.renderPopover({reviewId:f.reviewid})];case 1:return l=n.sent(),m=null===(e=null===(d=W["default"].cardRoot.querySelector("#a-popover-cr-media-popover"))||void 0===d?void 0:d.childNodes[0])||void 0===e?void 0:e.childNodes[0],null===m||void 0===m?void 0:m.appendChild(l),[4,Kb.get("cr-media-popover",m,b.currentTarget)];
case 2:return q=n.sent(),q.showSync(),[2]}})})};return a}(),oa;(function(a){a.MWEB="mWeb";a.MSHOP="mShop";a.DESKTOP="desktop"})(oa||(oa={}));var Mb=function(){return g.__awaiter(void 0,void 0,void 0,function(){return g.__generator(this,function(a){switch(a.label){case 0:return[4,ed()];case 1:return[2,a.sent()]}})})},hd=function(){return g.__awaiter(void 0,void 0,void 0,function(){var a;return g.__generator(this,function(b){switch(b.label){case 0:return(a="true"===W["default"].cardRoot.getAttribute("data-mobile")||
ub["default"].isSupported("mobile"))?[4,Mb()]:[3,2];case 1:a=!b.sent(),b.label=2;case 2:return[2,a]}})})},id=function(){return g.__awaiter(void 0,void 0,void 0,function(){var a;return g.__generator(this,function(b){switch(b.label){case 0:return[4,Mb()];case 1:if(!b.sent())return[3,2];a=oa.MSHOP;return[3,4];case 2:return[4,hd()];case 3:a=b.sent()?oa.MWEB:oa.DESKTOP,b.label=4;case 4:return[2,a]}})})},jd=function(){function a(){}a.getThumbnailClickHandler=function(){return g.__awaiter(this,void 0,void 0,
function(){var b;return g.__generator(this,function(c){switch(c.label){case 0:return[4,id()];case 1:b=c.sent();switch(b){case oa.MSHOP:return[2,new fd];case oa.MWEB:return[2,new Lb];case oa.DESKTOP:return[2,new Lb]}return[2]}})})};return a}(),kd=function(){function a(b){this.clickHandler=b}a.prototype.registerThumbnailClickHandlers=function(){this.registerCRVideoThumbnailClickHandler();this.registerCRImageThumbnailClickHandler()};a.prototype.registerCRVideoThumbnailClickHandler=function(){var b=this,
c=H["default"].setup().define;c(La.videoClickHandler,"click",function(d){return g.__awaiter(b,void 0,void 0,function(){return g.__generator(this,function(e){switch(e.label){case 0:return[4,this.clickHandler.onVideoClickHandler(d)];case 1:return e.sent(),[2]}})})})};a.prototype.registerCRImageThumbnailClickHandler=function(){var b=this,c=H["default"].setup().define;c(La.imageClickHandler,"click",function(d){return g.__awaiter(b,void 0,void 0,function(){return g.__generator(this,function(e){switch(e.label){case 0:return[4,
this.clickHandler.onImageClickHandler(d)];case 1:return e.sent(),[2]}})})})};return a}(),Nb=function(){return Z["default"].getLocation&&Z["default"].getLocation().host||location.host},da;(function(a){a[a.LEFT=0]="LEFT";a[a.CENTER=1]="CENTER";a[a.RIGHT=2]="RIGHT";a[a.NONE=3]="NONE"})(da||(da={}));var Ga;(function(a){a[a.POTRAIT=0]="POTRAIT";a[a.LANDSCAPE=1]="LANDSCAPE"})(Ga||(Ga={}));var ya=function(a,b){return b?b.querySelector("*[data-hook="+a+"]"):Q["default"].cardRoot.ownerDocument.querySelector("*[data-hook="+
a+"]")},pa=function(a){return Q["default"].cardRoot.ownerDocument.getElementById(a)},ha=function(a){a.style.display="flex"},V=function(a){a.style.display="none"},za=function(){function a(b){this.reviewId=b;this.reviewContainer=pa("cr-single-review-"+b);this.reviewTextContainer=ya("reviewTextContainer",this.reviewContainer);this.reviewText=ya("reviewText",this.reviewContainer);this.reviewTitle=ya("reviewTitle",this.reviewContainer);this.translateButton=ya("translateButton",this.reviewContainer);this.seeOriginalButton=
ya("seeOriginalButton",this.reviewContainer);this.translationInfo=ya("translationInfo",this.reviewContainer);this.translationSpinner=pa("translationSpinner");this.translationErrorMessage=pa("translationErrorMessage");this.helpfulVoteButton=pa("helpfulVoteButton");this.helpfulVoteErrorMessage=pa("helpfulVoteErrorMessage");this.helpfulVoteSuccessMessage=pa("helpfulVoteSuccessMessage");this.helpfulVoteLoadingMessage=pa("helpfulVoteLoadingMessage");this.shareButton=pa("shareButton");this.init()}a.prototype.init=
function(){this.hideTranslationErrorMessage();this.hideTranslationSpinner()};a.prototype.updateText=function(b){this.reviewTextContainer&&this.reviewText&&this.reviewTextContainer.replaceChild(b,this.reviewText)};a.prototype.updateTitle=function(b){this.reviewContainer&&this.reviewTitle&&this.reviewContainer.replaceChild(b,this.reviewTitle)};a.prototype.showTranslateButton=function(){this.translateButton&&this.translationInfo&&this.seeOriginalButton&&(V(this.translationInfo),V(this.seeOriginalButton),
ha(this.translateButton))};a.prototype.showSeeOriginalButton=function(){this.translateButton&&this.translationInfo&&this.seeOriginalButton&&(ha(this.translationInfo),ha(this.seeOriginalButton),V(this.translateButton))};a.prototype.showTranslationSpinner=function(){this.translationSpinner&&ha(this.translationSpinner)};a.prototype.hideTranslationSpinner=function(){this.translationSpinner&&V(this.translationSpinner)};a.prototype.showTranslationErrorMessage=function(){this.translationErrorMessage&&ha(this.translationErrorMessage)};
a.prototype.hideTranslationErrorMessage=function(){this.translationErrorMessage&&V(this.translationErrorMessage)};a.prototype.showHelpfulVoteSuccessMessage=function(){this.helpfulVoteErrorMessage&&this.helpfulVoteSuccessMessage&&this.helpfulVoteButton&&this.helpfulVoteLoadingMessage&&(V(this.helpfulVoteButton),V(this.helpfulVoteLoadingMessage),ha(this.helpfulVoteSuccessMessage),V(this.helpfulVoteErrorMessage))};a.prototype.showHelpfulVoteErrorMessage=function(){this.helpfulVoteErrorMessage&&this.helpfulVoteSuccessMessage&&
this.helpfulVoteButton&&this.helpfulVoteLoadingMessage&&(V(this.helpfulVoteButton),V(this.helpfulVoteLoadingMessage),V(this.helpfulVoteSuccessMessage),ha(this.helpfulVoteErrorMessage))};a.prototype.showHelpfulVoteLoadingMessage=function(){this.helpfulVoteErrorMessage&&this.helpfulVoteSuccessMessage&&this.helpfulVoteButton&&this.helpfulVoteLoadingMessage&&(V(this.helpfulVoteButton),ha(this.helpfulVoteLoadingMessage),V(this.helpfulVoteSuccessMessage),V(this.helpfulVoteErrorMessage))};a.prototype.updateShareReviewURL=
function(b){if(this.shareButton){var c=this.shareButton.getAttribute("data-ssf-share-icon");c=JSON.parse(c);c.url="https://"+Nb()+"/gp/aw/review/"+b+"/"+this.reviewId;this.shareButton.setAttribute("data-ssf-share-icon",JSON.stringify(c))}};a.getInstance=function(b){this.instance||(this.instance=new a(b));return this.instance};return a}(),ld=function(){function a(){}a.registerVotingClickHandlers=function(){this.registerHelpfulVoteClickHandler()};a.registerHelpfulVoteClickHandler=function(){var b=this,
c=H["default"].setup().define,d=fa["default"].setup(["helpful"]);c(mb.helpfulVoteClickHandler,"click",function(e){return g.__awaiter(b,void 0,void 0,function(){var f,h,l,m,q,n;return g.__generator(this,function(y){switch(y.label){case 0:f=e.currentTarget.dataset.id,h=e.currentTarget.dataset.asin,l=za.getInstance(f),m=Q["default"].cardRoot.ownerDocument.activeElement,y.label=1;case 1:return y.trys.push([1,3,4,5]),l.showHelpfulVoteLoadingMessage(),[4,d.helpful({reviewId:f,domain:Nb(),asin:h})];case 2:return q=
y.sent(),!q.success&&q.redirectUrl?Z["default"].setLocation(q.redirectUrl):q.success?l.showHelpfulVoteSuccessMessage():l.showHelpfulVoteErrorMessage(),[3,5];case 3:return y.sent(),l.showHelpfulVoteErrorMessage(),[3,5];case 4:return m===(null===(n=e.currentTarget)||void 0===n?void 0:n.getElementsByTagName("input")[0])&&a.moveFocusToVotingMessage(f),[7];case 5:return[2]}})})})};a.moveFocusToVotingMessage=function(b){b=new za(b);var c=b.helpfulVoteSuccessMessage||b.helpfulVoteErrorMessage;c&&(c.setAttribute("tabindex",
"-1"),setTimeout(function(){return c.focus({preventScroll:!1})},100))};return a}(),ob=function(){function a(){this.cache=new Map}a.prototype.renderTranslatedReview=function(b,c){return g.__awaiter(this,void 0,void 0,function(){var d,e,f,h,l,m,q,n,y;return g.__generator(this,function(k){switch(k.label){case 0:d=new za(b);e=fa["default"].setup(["translateReview"]);f=fa["default"].setup(["renderReviewTitle","renderReviewText"]);l=h=null;m=this.cache.get(b);if(!m)return[3,1];h=m.translatedText;l=m.translatedTitle;
return[3,7];case 1:d.showTranslationSpinner(),k.label=2;case 2:return k.trys.push([2,6,,7]),[4,e.translateReview({reviewId:b})];case 3:return q=k.sent(),n=ia.unscope,[4,f.renderReviewText({isCardExpanded:!0,language:q.targetLanguage,text:q.translatedText})];case 4:return h=n.apply(void 0,[k.sent()]),y=ia.unscope,[4,f.renderReviewTitle({language:q.targetLanguage,isMobile:c,title:q.translatedTitle})];case 5:return l=y.apply(void 0,[k.sent()]),d.hideTranslationSpinner(),this.cache.set(b,{originalText:d.reviewText,
originalTitle:d.reviewTitle,targetLanguage:q.targetLanguage,translatedText:h,translatedTitle:l}),[3,7];case 6:return k.sent(),d.hideTranslationSpinner(),d.showTranslationErrorMessage(),[3,7];case 7:return h&&l&&(d.updateText(h),d.updateTitle(l),d.showSeeOriginalButton()),[2]}})})};a.prototype.renderOriginalReview=function(b){return g.__awaiter(this,void 0,void 0,function(){var c,d;return g.__generator(this,function(e){c=new za(b);(d=this.cache.get(b))&&d.originalText&&d.originalTitle&&(c.updateText(d.originalText),
c.updateTitle(d.originalTitle),c.showTranslateButton());return[2]})})};a.getInstance=function(){a.instance||(a.instance=new a);return a.instance};return a}().getInstance(),md=function(){function a(){}a.registerTranslationClickHandlers=function(){a.registerTranslateButtonClickHandler();a.registerSeeOriginalReviewButtonClickHandler()};a.registerTranslateButtonClickHandler=function(){var b=H["default"].setup().define;b(Ka.requestTranslationClickHandler,"click",function(c){return g.__awaiter(void 0,void 0,
void 0,function(){var d,e,f,h,l;return g.__generator(this,function(m){switch(m.label){case 0:return d=null===(f=c.currentTarget)||void 0===f?void 0:f.dataset.reviewid,e="true"===(null===(h=c.currentTarget)||void 0===h?void 0:h.dataset.mobile),[4,ob.renderTranslatedReview(d,e)];case 1:return m.sent(),Q["default"].cardRoot.ownerDocument.activeElement===(null===(l=c.currentTarget)||void 0===l?void 0:l.firstChild)&&a.moveFocusToReviewText(d),[2]}})})})};a.registerSeeOriginalReviewButtonClickHandler=function(){var b=
H["default"].setup().define;b(Ka.seeOriginalReviewClickHandler,"click",function(c){return g.__awaiter(void 0,void 0,void 0,function(){var d,e,f;return g.__generator(this,function(h){switch(h.label){case 0:return d=null===(e=c.currentTarget)||void 0===e?void 0:e.dataset.reviewid,[4,ob.renderOriginalReview(d)];case 1:return h.sent(),Q["default"].cardRoot.ownerDocument.activeElement===(null===(f=c.currentTarget)||void 0===f?void 0:f.firstChild)&&a.moveFocusToReviewText(d),[2]}})})})};a.moveFocusToReviewText=
function(b){var c=new za(b);b=c.reviewText;null===b||void 0===b?void 0:b.setAttribute("tabindex","-1");b&&setTimeout(function(){var d;return null===(d=c.reviewText)||void 0===d?void 0:d.focus({preventScroll:!1})},100)};return a}(),nd=function(){function a(){this.scrollIntoMediaByIndex=function(b,c){var d,e,f,h,l=!1,m=c.children;c=null===(h=null===(f=null===(e=null===(d=null===c||void 0===c?void 0:c.parentElement)||void 0===d?void 0:d.parentElement)||void 0===e?void 0:e.firstChild)||void 0===f?void 0:
f.firstChild)||void 0===h?void 0:h.childNodes;for(d=0;d<m.length;d++)d==b?(c[d].style.backgroundColor="#008296",ha(m[d]),l=!0):(c[d].style.backgroundColor=l?"#C8CCCC":"#008296",V(m[d]))};this.indexOfVisibleElement=function(b){for(var c=0;c<b.length;c++)if("none"!==b[c].style.display)return c;return 0}}a.prototype.closeButtonClickHandler=function(b){var c,d;return g.__awaiter(this,void 0,void 0,function(){var e,f;return g.__generator(this,function(h){switch(h.label){case 0:return e=null===(d=null===
(c=W["default"].cardRoot.querySelector("#a-popover-cr-media-popover"))||void 0===c?void 0:c.childNodes[0])||void 0===d?void 0:d.childNodes[0],[4,Kb.get("cr-media-popover",e,b.currentTarget)];case 1:return f=h.sent(),f.hide(),[2]}})})};a.prototype.nextMediaClickHandler=function(b){var c,d;return g.__awaiter(this,void 0,void 0,function(){var e,f,h;return g.__generator(this,function(l){var m=b.event,q=b.currentTarget;l=m.clientX/q.clientWidth*100;m=m.clientY/q.clientHeight*100;q=(q.clientWidth>q.clientHeight?
Ga.LANDSCAPE:Ga.POTRAIT)===Ga.POTRAIT?{lowerBound:33,upperBound:67}:{lowerBound:40,upperBound:80};e=m<=q.lowerBound||m>=q.upperBound?da.NONE:25>=l?da.LEFT:75<=l?da.RIGHT:da.CENTER;f=this.indexOfVisibleElement(null===(c=b.currentTarget)||void 0===c?void 0:c.children);h=null===(d=b.currentTarget)||void 0===d?void 0:d.childElementCount;switch(e){case da.LEFT:0<f?this.scrollIntoMediaByIndex(f-1,b.currentTarget):0==f&&this.scrollIntoMediaByIndex(h-1,b.currentTarget);break;case da.CENTER:case da.RIGHT:case da.NONE:f<
h-1?this.scrollIntoMediaByIndex(f+1,b.currentTarget):f==h-1&&this.scrollIntoMediaByIndex(0,b.currentTarget)}return[2]})})};return a}(),od=function(){function a(){}a.getMediaPopoverClickHandler=function(){return g.__awaiter(this,void 0,void 0,function(){return g.__generator(this,function(b){return[2,new nd]})})};return a}(),pd=function(){function a(b){this.clickHandler=b}a.prototype.registerMediaPopoverClickHandlers=function(){this.registerCloseButtonClickHandler();this.registerNextMediaClickHandler()};
a.prototype.registerNextMediaClickHandler=function(){var b=this,c=H["default"].setup().define;c(Ma.popoverNextMediaClickHandler,"click",function(d){return g.__awaiter(b,void 0,void 0,function(){return g.__generator(this,function(e){switch(e.label){case 0:return[4,this.clickHandler.nextMediaClickHandler(d)];case 1:return e.sent(),[2]}})})})};a.prototype.registerCloseButtonClickHandler=function(){var b=this,c=H["default"].setup().define;c(Ma.popoverCloseButtonClickHandler,"click",function(d){return g.__awaiter(b,
void 0,void 0,function(){return g.__generator(this,function(e){switch(e.label){case 0:return[4,this.clickHandler.closeButtonClickHandler(d)];case 1:return e.sent(),[2]}})})})};return a}(),qd=function(){return g.__awaiter(void 0,void 0,void 0,function(){var a,b,c,d,e,f,h,l,m,q;return g.__generator(this,function(n){switch(n.label){case 0:return a=W["default"].cardRoot.getAttribute("data-reviewid"),b="true"===W["default"].cardRoot.getAttribute("data-mobile"),c=W["default"].cardRoot.getAttribute("data-asin"),
d=W["default"].cardRoot.getAttribute("data-locale"),e=W["default"].cardRoot.getAttribute("data-sourcelanguage"),[4,jd.getThumbnailClickHandler()];case 1:return f=n.sent(),h=new kd(f),h.registerThumbnailClickHandlers(),[4,od.getMediaPopoverClickHandler()];case 2:return l=n.sent(),m=new pd(l),m.registerMediaPopoverClickHandlers(),md.registerTranslationClickHandlers(),"fr-CA"!==d||"fr-CA"===e?[3,4]:[4,ob.renderTranslatedReview(a,b)];case 3:n.sent(),n.label=4;case 4:return ld.registerVotingClickHandlers(),
q=new za(a),q.updateShareReviewURL(c),[2]}})})};pb._operationNames=[];pb.card=function(){return g.__awaiter(void 0,void 0,void 0,function(){var a,b,c,d,e;return g.__generator(this,function(f){switch(f.label){case 0:return K.setPrefix("cr-media-carousel"),[4,Lc.getThumbnailClickHandler()];case 1:return a=f.sent(),b=new Mc(a),b.registerThumbnailClickHandlers(),[4,Wa()];case 2:return f.sent()?[3,4]:[4,$c()];case 3:f.sent(),f.label=4;case 4:c=qa.setup(["getTreatmentNoTrigger"]),f.label=5;case 5:return f.trys.push([5,
9,,10]),[4,c.getTreatmentNoTrigger({weblabID:"COFEE_DD_MEDIA_CARDS_MIGRATION_SHARED_LIBRARY_1247512"})];case 6:return d=f.sent(),"T1"!==d?[3,8]:[4,qd()];case 7:f.sent(),f.label=8;case 8:return[3,10];case 9:return e=f.sent(),K.logError("client.getWeblabTreatmentError",e),[3,10];case 10:return K.logCounter("client.loaded",1),[2]}})})}});
