(globalThis.webpackChunkverso=globalThis.webpackChunkverso||[]).push([[2755],{69389:(e,t,n)=>{const{asConfiguredComponent:a}=n(12892),{asThemedComponent:i}=n(20223),o=n(39416);e.exports=i(a(o,"ContentHeader"))},45771:(e,t,n)=>{const a=n(5556),i=n(96540),{useIntl:o}=n(3442),{useState:r}=n(96540),s=n(76399),l=n(96616).A,{asConfiguredComponent:d}=n(12892),{doCloseModal:c,setModalPropsMap:m}=n(4476),{trackComponent:p}=n(92716),{interactionResponse:u}=n(56187),{ReviewNoteModalBaseWrapper:g,ReviewNoteModalCloseButton:y,ReviewNoteModalContinueButton:h,ReviewNoteDiscardSection:b,ReviewNoteModalDek:w,ReviewNoteModalHed:f}=n(49038),v=({className:e,modalProps:t,confirmButtonCallback:n,isVisible:a=!1})=>{i.useEffect((()=>{(async()=>{await u(),p("ReviewNoteSubmitModal")})()}),[]);const d=()=>{c()},{formatMessage:v}=o(),[R,C]=r(a),{hed:N,dek:$,continueLabel:x,discardLabel:I}=t||{};return m(C),i.createElement(g,{className:e,closeTimeoutMS:200,isOpen:R},i.createElement(y,{isIconButton:!0,ariaLabel:v(l.closeButtonAriaLabel),label:v(l.closeButtonLabel),onClickHandler:d,role:"button",ButtonIcon:s}),i.createElement(f,null,v(l.hed,{hed:N})),i.createElement(w,null,v(l.dek,{dek:$})),i.createElement(h,{label:v(l.continueLabel,{continueLabel:x}),onClickHandler:d}),i.createElement(b,{onClickHandler:n,label:v(l.discardLabel,{discardLabel:I}),btnStyle:"text",inputKind:"link"}))};v.propTypes={className:a.string,confirmButtonCallback:a.func,isVisible:a.bool,modalProps:a.object},v.displayName="ReviewNoteModal",e.exports=d(v,"ReviewNoteModal")},4476:(e,t)=>{let n;Object.defineProperty(t,"__esModule",{value:!0}),t.doCloseModal=t.doDisplayModal=t.setModalPropsMap=void 0,t.setModalPropsMap=e=>{n=e};const a=e=>{n(e)};t.doDisplayModal=()=>{a(!0)},t.doCloseModal=()=>{a(!1)}},49038:(e,t,n)=>{const a=n(96540),i=n(20312),o=n(5556),{default:r}=n(75999),{BaseText:s}=n(76955),{calculateSpacing:l}=n(26865),{BREAKPOINTS:d,ZINDEX_MAP:c}=n(96472),m=n(73730),{ButtonLabel:p}=n(18974),{getColorToken:u,getTypographyStyles:g}=n(26865),y=r(s).withConfig({displayName:"ReviewNoteModalHed"})` margin-top: ${l(0)}; padding: ${l(2.5)} ${l(1.25)}; text-align: center; `;y.defaultProps={as:"div",colorToken:"colors.interactive.base.brand-primary",topSpacing:1,typeIdentity:"typography.definitions.consumptionEditorial.display-large"};const h=r.p.withConfig({displayName:"ReviewNoteModalDek"})` ${g("typography.definitions.consumptionEditorial.body-core")} margin-top: ${l(0)}; margin-bottom: ${l(5)}; text-align: center; color: ${u("colors.consumption.body.standard.body")}; @media (max-width: ${d.md}) { margin-bottom: ${l(5)}; } `,b=r(m.Utility).withConfig({displayName:"ReviewNoteModalButtonPrimary"})` position: absolute; top: ${l(1)}; right: ${l(1)}; padding: 0; fill: ${u("colors.interactive.base.black")}; .icon-close { padding: 6px; } &, &:focus, &:hover { border: 0; background-color: transparent; } width: 42px; height: 42px; `,w=r(m.Primary).withConfig({displayName:"ReviewNoteModalContinueButton"})` display: flex; justify-content: center; margin-bottom: ${l(1)}; padding: ${l(2)} ${l(0)}; width: 100%; ${p} { padding: 0 ${l(2.5)}; } `,f=r(m.Primary).withConfig({displayName:"ReviewNoteDiscardSection"})` display: flex; justify-content: center; padding: 17px ${l(0)}; width: 100%; text-decoration: underline; ${p} { padding: 0 ${l(2.5)}; } `;function v({className:e,...t}){const n=`${e}__content`,o=`${e}__overlay`;return a.createElement(i,{portalClassName:e,className:n,overlayClassName:o,...t})}v.propTypes={className:o.string};const R=r(v).withConfig({displayName:"ReviewNoteModalBaseWrapper"})` &__overlay { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: ${c.interstitialLayer}; background-color: rgba( ${u("colors.background.black",{rgbOnly:!0})}, 0 ); &.ReactModal__Overlay--after-open { transition: background-color 500ms; opacity: 1; background-color: rgba( ${u("colors.background.black",{rgbOnly:!0})}, 0.4 ); } &.ReactModal__Overlay--after-close { transition: background-color 500ms; background-color: rgba( ${u("colors.background.black",{rgbOnly:!0})}, 0 ); } } &__content { position: relative; top: 50%; left: 50%; transform: translateY(-50%) translateX(-50%); border-radius: ${l(1)}; box-shadow: 0 0 24px 0 rgba(0, 0, 0, 0.1); background-color: ${u("colors.background.white")}; padding: ${l(6)} ${l(5)} ${l(5)} ${l(5)}; width: ${l(57)}; height: 368px; overflow-y: auto; @media (max-width: ${d.md}) { transform: translateY(-50%) translateX(calc(-50% - ${l(2,"px")})); margin: 0 ${l(2,"px")}; padding: ${l(4)} ${l(5)} ${l(4)} ${l(5)}; width: auto; min-width: ${l(38)}; max-width: ${l(60)}; } } `;e.exports={ReviewNoteModalBaseWrapper:R,ReviewNoteModalCloseButton:b,ReviewNoteModalContinueButton:w,ReviewNoteDiscardSection:f,ReviewNoteModalDek:h,ReviewNoteModalHed:y}},96616:(e,t,n)=>{const a=n(3442);t.A=(0,a.defineMessages)({closeButtonLabel:{id:"ReviewNoteModal.CloseButtonLabel",defaultMessage:"close modal button label",description:"ReviewNoteModal component close button label"},closeButtonAriaLabel:{id:"ReviewNoteModal.CloseButtonAriaLabel",defaultMessage:"Close ReviewNoteModal Modal",description:"ReviewNoteModal component close button aria label"},hed:{id:"ReviewNoteModal.Hed",defaultMessage:"{hed}",description:"ReviewNoteModal component hed text",isConfigurable:!0},dek:{id:"ReviewNoteModal.dek",defaultMessage:"{dek}",description:"ReviewNoteModal component dek text",isConfigurable:!0},continueLabel:{id:"ReviewNoteModal.continueLabel",defaultMessage:"{continueLabel}",description:"ReviewNoteModal component continue button text",isConfigurable:!0},discardLabel:{id:"ReviewNoteModal.discardLabel",defaultMessage:"{discardLabel}",description:"ReviewNoteModal discard button text",isConfigurable:!0}})},56425:(e,t,n)=>{const a=n(96540),{useState:i,useEffect:o}=n(96540),r=n(5556),s=n(45565),{addReview:l}=n(60711),{trackContentEngagementEvent:d}=n(14307),c=({recipeId:e,commentingUrl:t,hed:n,organizationId:r,tenantID:c,reviewNoteTags:m,siteUserName:p,handleUsernameChange:u,showSavedRecipeNotes:g=(()=>{}),shouldEnableMultipleComments:y,shouldEnableMultipleRatings:h,showMessageBannerHandler:b=(()=>{}),...w})=>{const[f,v]=i("");o((()=>{const e=window.location.origin+window.location.pathname;v(e)}),[]);const R=(e,t,n)=>{{const a={type:"submit",label:"add note",rating:t,subject:"community_comment",features_list:n};e&&(a.error=e),d(a,{skipDuplicateEvent:!1})}};return a.createElement(s,{onSubmitHandler:async a=>{let i,o;const s={hed:n,storyLink:f},{reviewNote:d,rating:m,userId:p,toggleChip:u}=a||{},g=u?.reduce(((e,t)=>(t.slug&&t.active&&e.push(t.slug),e)),[]),b=g?.map((e=>({name:e.toLowerCase(),index:0,total_index:1}))),w={review:{storyID:e,siteID:r,body:d,meta:JSON.stringify(s),rating:m,ratingScale:5,reviewTags:g,tenantID:c},clientMutationId:"0",enableMultipleRatings:h,enableMultipleComments:y},v=p;try{i=await l(w,v,t,console),R(null,m,b)}catch(e){o=e.message||"",R(o,m,b),console.warn(e)}return i},handleUsernameChange:u,reviewNoteTags:m,siteUserName:p,showSavedRecipeNotes:g,showMessageBannerHandler:b,...w})};c.propTypes={commentingUrl:r.string,handleUsernameChange:r.func,hed:r.string,organizationId:r.string,recipeId:r.string,reviewNoteTags:r.array,shouldEnableMultipleComments:r.bool,shouldEnableMultipleRatings:r.bool,showMessageBannerHandler:r.func,showSavedRecipeNotes:r.func,siteUserName:r.string,tenantID:r.string,userId:r.string},e.exports=c},76584:(e,t,n)=>{e.exports=n(56425)},30488:(e,t,n)=>{const a=n(5556),i=n(96540),{useState:o}=n(96540),{connect:r}=n(67851),{useIntl:s}=n(3442),l=n(62097).A,{createNewUsername:d,validate:c}=n(67116),m=n(76399),{asConfiguredComponent:p}=n(12892),{trackComponent:u}=n(92716),{interactionResponse:g}=n(56187),{trackUserAccountEvent:y}=n(14307),{doCloseModal:h}=n(61057),{UserNameModalBaseWrapper:b,UserNameModalCloseButton:w,UserNameModalButtons:f,UserNameModalDek:v,UserNameModalHed:R,UserNameModalSubmit:C,UserNameModalTextFieldWrapper:N}=n(94823),$=({className:e,dangerousDek:t,dangerousHed:n,isVisible:a=!1,maxLength:r=23,minLength:p=2,organizationId:$,showMessageBannerHandler:x,submitButtonLabel:I,successCallback:M,userApiUrl:L,userId:S,source:E})=>{i.useEffect((()=>{(async()=>{await g(),u("UserNameModal")})()}),[]);const{formatMessage:k}=s(),[T,A]=o(""),[U,P]=o(""),B={lengthError:k(l.lengthError),specialCharError:k(l.specialCharError)};return i.createElement(b,{className:e,isOpen:a},i.createElement(w,{isIconButton:!0,ariaLabel:k(l.closeButtonLabel),label:k(l.closeButtonLabel),role:"button",onClickHandler:()=>{h(),y({type:"exit",subject:"username_modal",source_type:E}),A(null)},ButtonIcon:m}),i.createElement(R,null,n||k(l.hed)),i.createElement(v,{dangerouslySetInnerHTML:{__html:t||k(l.dek)}}),i.createElement(N,{className:"user-name-modal",hasAutoFocus:!0,shouldUseUppercase:!0,name:"username",placeholder:"YOUR_USERNAME",type:"text",onInputChange:e=>{let{value:t}=e.target;t.length>r&&(t=t.slice(0,r),e.target.value=t),P(t)},errorText:T,isInvalid:!!T,formName:"username",errorPosition:"belowTextField",hideLabel:!0,label:k(l.hed),assistiveSubtext:k(l.userNameModalAssistiveText)}),i.createElement(f,null,i.createElement(C,{label:I||k(l.submitButtonLabel),inputKind:"submit","data-testid":"UserNameModalSubmit",onClickHandler:async()=>{let e;const t=c(U,{minLength:p,maxLength:r});if(t)return void A(B[t]??"");let n;try{n=await d({name:U,organizationId:$,userId:S,url:L},console),P(n),A(null),x&&x(k(l.successMessage)),h(),M&&M(n)}catch(t){"already_taken"===t?.message?(A(k(l.alreadyTakenError)),e=t?.message):(x&&x(k(l.errorMessage)),h(),e=l.errorMessage.defaultMessage)}y({type:"submit",label:"SAVE USERNAME",subject:"username_modal",source_type:E,error:e})}})))};$.propTypes={className:a.string,dangerousDek:a.string,dangerousHed:a.string,isVisible:a.bool,maxLength:a.number,minLength:a.number,organizationId:a.string.isRequired,showMessageBannerHandler:a.func,source:a.string,submitButtonLabel:a.string,successCallback:a.func,userApiUrl:a.string.isRequired,userId:a.string.isRequired};const x=p($,"UserNameModal");e.exports=r((e=>{const{userNameModalConfig:t}=e;return{...t}}))(x)},64837:(e,t,n)=>{e.exports=n(30488)},94823:(e,t,n)=>{const a=n(96540),i=n(20312),o=n(5556),{default:r}=n(75999),{BaseText:s}=n(76955),{calculateSpacing:l,getColorStyles:d}=n(26865),{ZINDEX_MAP:c,BREAKPOINTS:m}=n(96472),p=n(73730),{getColorToken:u,getTypographyStyles:g}=n(26865),y=n(89662),{TextFieldControlInput:h}=n(60434),b=r(s).withConfig({displayName:"UserNameModalHed"})` padding-top: ${l(2.5)}; padding-bottom: ${l(2.5)}; text-align: center; `;b.defaultProps={as:"div",colorToken:"colors.interactive.base.brand-primary",topSpacing:1,typeIdentity:"typography.definitions.consumptionEditorial.display-large"};const w=r.p.withConfig({displayName:"UserNameModalDek"})` ${g("typography.definitions.consumptionEditorial.body-core")} margin: 0; text-align: center; color: ${u("colors.consumption.body.standard.body")}; `,f=r(p.Utility).withConfig({displayName:"UserNameModalCloseButton"})` position: absolute; top: ${l(1)}; right: ${l(1)}; padding: 0; fill: ${u("colors.discovery.body.light.context-tertiary")}; .icon-close { padding: 8px; } &, &:focus, &:hover { border: 0; background-color: transparent; } `,v=r(p.Utility).withConfig({displayName:"UserNameModalSubmit"})` margin-top: 0; padding: 0; `,R=r.div.withConfig({displayName:"UserNameModalButtons"})` display: flex; justify-content: center; margin-top: ${l(4)}; @media (max-width: ${m.md}) { margin-top: ${l(3)}; } width: 100%; ${v} { padding: 0; width: 100%; } `;function C({className:e,...t}){const n=`${e}__content`,o=`${e}__overlay`;return a.createElement(i,{portalClassName:e,className:n,overlayClassName:o,...t})}C.propTypes={className:o.string};const N=r(C).withConfig({displayName:"UserNameModalBaseWrapper"})` &__overlay { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: ${c.interstitialLayer}; background-color: rgba( ${u("colors.background.black",{rgbOnly:!0})}, 0 ); &.ReactModal__Overlay--after-open { transition: background-color 750ms; opacity: 1; background-color: rgba( ${u("colors.background.black",{rgbOnly:!0})}, 0.4 ); } &.ReactModal__Overlay--after-close { transition: background-color 750ms; background-color: rgba( ${u("colors.background.black",{rgbOnly:!0})}, 0 ); } } &__content { position: relative; top: 50%; left: 50%; transform: translateY(-50%) translateX(-50%); border-radius: 8px; background-color: ${u("colors.background.white")}; padding-top: ${l(12)}; padding-right: ${l(6)}; padding-bottom: ${l(7)}; padding-left: ${l(6)}; width: ${l(57)}; min-height: ${l(62)}; overflow-y: auto; @media (max-width: ${m.md}) { width: 90%; } } `,$=r(y.SingleLine).withConfig({displayName:"UserNameModalTextFieldWrapper"})` ${h} { margin-top: ${l(6)}; color: ${({theme:e})=>d(e,"color","colors.interactive.base.body")}; @media (max-width: ${m.md}) { margin-top: ${l(4)}; } } `;$.defaultProps={colorToken:"colors.interactive.base.body",typeIdentity:"typography.definitions.globalEditorial.accreditation-feature"},e.exports={UserNameModalBaseWrapper:N,UserNameModalButtons:R,UserNameModalCloseButton:f,UserNameModalDek:w,UserNameModalHed:b,UserNameModalSubmit:v,UserNameModalTextFieldWrapper:$}},62097:(e,t,n)=>{const a=n(3442);t.A=(0,a.defineMessages)({hed:{id:"UserNameModal.Hed",defaultMessage:"Create Username",description:"UserNameModal component hed text"},dek:{id:"UserNameModal.Dek",defaultMessage:"Your username will appear next to any recipe notes and replies you add.",description:"UserNameModal component description text"},submitButtonLabel:{id:"UserNameModal.SubmitButtonLabel",defaultMessage:"Save Username",description:"UserNameModal component submit button label"},closeButtonLabel:{id:"UserNameModal.CloseButtonLabel",defaultMessage:"Close User Name",description:"UserNameModal component close button label"},lengthError:{id:"UserNameModal.lengthError",defaultMessage:"Usernames must be between 2 and 23 characters.",description:"UserNameModal component length error"},specialCharError:{id:"UserNameModal.specialCharError",defaultMessage:"Usernames can only include letters, numbers and underscores (_).",description:"UserNameModal component special chars validation error"},alreadyTakenError:{id:"UserNameModal.alreadyTakenError",defaultMessage:"This Username is already taken.",description:"UserName already taken error"},userNameModalAssistiveText:{id:"UserNameModal.UserNameModalAssistiveText",defaultMessage:"Usernames must be between 2 and 23 characters and can only include letters, numbers and underscores (_).",description:"UserNameModal Assistive Text"},errorMessage:{id:"UserNameModal.ErrorMessage",defaultMessage:"Unable to save username. Please try again.",description:"UserNameModal default error message"},successMessage:{id:"UserNameModal.SuccessMessage",defaultMessage:"Your username is saved.",description:"UserNameModal success message"}})},6276:(e,t,n)=>{const a=n(75999).default,{BaseText:i}=n(76955),{calculateSpacing:o,getColorStyles:r,getColorToken:s,getTypographyStyles:l,minScreen:d,maxScreen:c}=n(26865),{BREAKPOINTS:m}=n(96472),p=n(62340),{RatingStar:u}=n(97927),g=n(6605),{applyGridSpacing:y}=n(1123),h=n(73730),b=a.div.withConfig({displayName:"Wrapper"})` margin-bottom: ${o(4)}; border-width: 2px 0; border-style: solid; padding-bottom: ${o(2)}; text-align: center; ${({theme:e})=>r(e,"border-color","colors.consumption.body.standard.divider")}; ${({disableTopPadding:e})=>!e&&`padding-top: ${o(4)};`} ${({disableTopBorder:e})=>e&&"border-top: none;"} ${({showExpandedBanner:e})=>e&&"border: none; padding-bottom: 0;"} `,w=a.div.withConfig({displayName:"SignInInfo"})` display: flex; flex-direction: column; align-items: center; justify-content: center; ${({expanded:e})=>e&&`\n height: 240px;\n ${d(m.lg)} {\n height: 185px;\n }\n `} ${({theme:e,expanded:t})=>l(e,t?"typography.definitions.consumptionEditorial.subhed-aux-primary":"typography.definitions.consumptionEditorial.subhed-aux-secondary")}; margin-bottom: ${o(4)}; background: ${({theme:e})=>s(e,"colors.interactive.base.black")}; padding: ${o(2)}; text-transform: none; color: ${({theme:e})=>s(e,"colors.interactive.base.white")}; a { color: ${({theme:e})=>s(e,"colors.interactive.base.white")}; font-weight: bold; } ${c(m.md)} { margin-left: calc(-1 * var(--grid-margin)); /* Full bleed effect */ width: calc(100% + (2 * var(--grid-margin))); } ${({expanded:e})=>!e&&`${d(m.lg)} {\n br {\n display: none;\n }\n }\n `} `,f=a.div.withConfig({displayName:"FormWrapper"})``,v=a(i).withConfig({displayName:"FormText"})` ${({isTextDisabled:e})=>e&&"opacity: 0.5;"}; `;v.defaultProps={colorToken:"colors.consumption.body.standard.body",typeIdentity:"typography.definitions.consumptionEditorial.subhed-aux-secondary"};const R=a(v).withConfig({displayName:"ErrorText"})` margin-bottom: ${o(2)}; `,C=a(g).withConfig({displayName:"ReCaptcha"})` display: inline-block; margin-top: ${o(2)}; margin-bottom: ${o(2)}; ${y("margin",!0)}; `,N=a(p).withConfig({displayName:"RatingFormRating"})` padding: ${o(3)} 0 ${o(2)}; ${u}, svg { width: 64px; height: 64px; } `,$=a(h.Utility).withConfig({displayName:"SubmitRatingWrapper"})` margin: 0 auto ${o(2)}; color: ${({theme:e})=>s(e,"colors.interactive.base.white")}; `;e.exports={Wrapper:b,SignInInfo:w,FormText:v,FormWrapper:f,ErrorText:R,RatingFormRating:N,ReCaptcha:C,SubmitRatingWrapper:$}},8101:(e,t,n)=>{const a=n(5556),i=n(96540),{useIntl:o}=n(3442),{useState:r,useCallback:s,useEffect:l}=n(96540),{trackComponent:d}=n(92716),{interactionResponse:c}=n(56187),m=n(21093),p=n(71001),u=n(32844),{ReviewListWrapper:g,ReviewListItems:y,ReviewListItem:h,ReviewListReview:b,ReviewListMeta:w,ReviewListMetaItem:f,ReviewListUsername:v,ReviewListLocation:R,ReviewListDate:C,ReviewListButton:N,ReviewListError:$,ReviewText:x,ReviewerUserName:I,ReviewListMetaData:M,ReviewListTimeStamp:L,ReviewLikeCount:S,ReviewReplyLabel:E,ReviewListMetaInfo:k,ReviewItem:T,ReviewListReactionButton:A,ReviewReplyWrapper:U,ReviewReplyMetaDataWrapper:P}=n(16631),{Comment:B,Like:D,LikeFilled:_}=n(24695),{Dot:F}=n(91470),H=n(27517),O=n(22509),{scrollToTheNoteSection:q}=n(39311),W=n(61057),{trackContentEngagementEvent:j,trackUserAccountEvent:G}=n(14307),K=n(74657).A,Y=({className:e,commentReactionHandler:t,commentingUrl:n,cta:a,hasCommunityExperienceEnabled:Y,id:z,items:Q,hasErrored:X=!1,isLoading:V=!1,user:J,reviewNotesSignInBannerHeaderOffset:Z,reviewModalProps:ee,userReactions:te,signInHed:ne,signInHedSpanTag:ae,signInMessage:ie,shouldEnableReply:oe,showMessageBannerHandler:re,replyLimit:se,updateUserReactions:le,siteUserName:de,handleUsernameChange:ce,shouldEnableRatings:me,shouldEnableUpvotes:pe})=>{i.useEffect((()=>{(async()=>{await c(),d("ReviewList")})()}),[]);const[ue,ge]=r({}),[ye,he]=r([]),{formatMessage:be}=o();l((()=>{J?.isAuthenticated&&window.location.hash.includes("leave-a-reply")&&q(Z)}),[J.isAuthenticated,Z]);const we=s((e=>{if(J?.isAuthenticated)de?(he((t=>[...t,e])),ge((t=>({...t,[e]:!0})))):void 0!==de&&(W.doDisplayModal({successCallback:t=>{ce(t),he((t=>[...t,e])),ge((t=>({...t,[e]:!0})))},source:"community_reply"}),G({type:"impression",subject:"username_modal",label:"Create Username",source_type:"community_reply"}));else{const e=`${document.location.pathname}#leave-a-reply`,t={subject:"community_comment",label:"Reply",source_type:"community_comment",type:"login"};O.doDisplayModal({dangerousDek:ie,dangerousHed:ne,dangerousHedSpanTag:ae,redirectURL:e,shouldHideIllustration:!0,source:"COMMUNITY_REPLY_CLICK",snowplowData:t})}j({type:"attempt",subject:"community_comment",label:"reply",items:[{content_id:e}]},{skipDuplicateEvent:!1})}),[de]);return i.createElement(g,{className:e,id:z,tabIndex:"-1"},Q&&Q.length>0?i.createElement(y,null,Q.map((e=>{const{id:a,commentId:o,text:r,username:s,location:l,date:d,rating:c,replies:g,replyPageInfo:y,recipeId:N,revisionId:$,tags:O}=e||{},q=!!O?.length;return Y?i.createElement(T,{key:[a,r,s,d].join("-")},i.createElement(k,null,s&&i.createElement(M,{key:s},i.createElement(I,null,s)),me&&c&&i.createElement(M,null,i.createElement(m,{averageRatingCount:c}))),i.createElement(k,null,i.createElement(M,null,O?.map((e=>i.createElement(H,{key:e},e))),q&&i.createElement(F,null),i.createElement(L,null,d))),r&&i.createElement(x,{dangerouslySetInnerHTML:{__html:r}}),i.createElement(P,null,i.createElement(k,null,pe&&i.createElement(A,{isIconButton:!0,name:"comment-reaction",label:"Reaction",onClickHandler:()=>(({item:e})=>{const n=te[e.commentId]?.viewerActionPresence?"unlike":"like";j({type:n,subject:"community_comment"},{skipDuplicateEvent:!1}),t({item:e})})({item:e}),ButtonIcon:te[o]?.viewerActionPresence?_:D}),pe&&i.createElement(S,null,te[o]?.reactionCount),oe&&i.createElement(U,{onClick:()=>we(o)},i.createElement(B,null),i.createElement(E,null,be(K.reviewReplyLabel))))),ue[o]&&ye.includes(o)&&J?.isAuthenticated&&i.createElement(p,{commentId:o,username:s,recipeId:N,revisionId:$,commentingUrl:n,onCancel:()=>(e=>{ge((t=>({...t,[e]:!1})))})(o),reviewModalProps:ee,showMessageBannerHandler:re,source:"community_comment"}),g&&g.length>0&&i.createElement(u,{username:s,replies:g,replyPageInfo:y,reviewModalProps:ee,commentReactionHandler:t,user:J,reviewNotesSignInBannerHeaderOffset:Z,userReactions:te,updateUserReactions:le,signInHed:ne,signInHedSpanTag:ae,signInMessage:ie,shouldEnableReply:oe,commentId:o,replyLimit:se,siteUserName:de,handleUsernameChange:ce,recipeId:N,showMessageBannerHandler:re,commentingUrl:n,shouldEnableUpvotes:pe})):i.createElement(h,{key:[a,r,s,l,d].join("-")},r?i.createElement(b,null,r):null,s||l||d?i.createElement(w,null,s?i.createElement(f,{key:s},i.createElement(v,null,s)):null,l?i.createElement(f,{key:l},i.createElement(R,null,l)):null,d?i.createElement(f,{key:d},i.createElement(C,null,d)):null):null)}))):null,!X&&a?.onClick&&a?.label?i.createElement(N,{inputKind:"button",onClickHandler:a.onClick,label:V?be(K.loading):a.label,isDisabled:V}):null,X?i.createElement($,null,be(K.reviewListError,{br:i.createElement("br",null)})):null)};Y.propTypes={className:a.string,commentingUrl:a.string.isRequired,commentReactionHandler:a.func,cta:a.shape({onClick:a.func,label:a.string}),handleUsernameChange:a.func,hasCommunityExperienceEnabled:a.bool,hasErrored:a.bool,id:a.string,isLoading:a.bool,items:a.arrayOf(a.shape({id:a.number,text:a.string,username:a.string,date:a.string,revisionId:a.string.isRequired,commentId:a.string.isRequired,viewerActionPresence:a.bool,reactionCount:a.number})),replyLimit:a.number,reviewModalProps:a.object,reviewNotesSignInBannerHeaderOffset:a.number,shouldEnableRatings:a.bool,shouldEnableReply:a.bool,shouldEnableUpvotes:a.bool,showMessageBannerHandler:a.func,signInHed:a.string,signInHedSpanTag:a.string,signInMessage:a.string,siteUserName:a.string,updateUserReactions:a.func,user:a.shape({isAuthenticated:a.bool.isRequired,amguuid:a.string}).isRequired,userReactions:a.objectOf(a.shape({viewerActionPresence:a.bool.isRequired,reactionCount:a.number.isRequired}).isRequired)},e.exports=Y},47125:(e,t,n)=>{e.exports=n(8101)},16631:(e,t,n)=>{const a=n(75999).default,{BaseLink:i,BaseText:o}=n(76955),{calculateSpacing:r,getColorStyles:s,getColorToken:l,getTypographyStyles:d,maxScreen:c}=n(26865),{BREAKPOINTS:m}=n(96472),p=n(43438),u=n(73730),{ToggleButton:g}=n(18161),{RatingWrapper:y,RatingStarHalf:h,RatingStar:b,RatingLabel:w,RatingInput:f}=n(97927),v=a(u.Primary).withConfig({displayName:"ReviewListButton"})` align-self: center; margin-top: ${r(4)}; margin-bottom: ${r(4)}; `,R=a(o).withConfig({displayName:"ReviewListDate"})``;R.defaultProps={as:"time"},R.defaultProps={colorToken:"colors.consumption.body.standard.body",typeIdentity:"typography.definitions.globalEditorial.accreditation-core"};const C=a(o).withConfig({displayName:"ReviewListLocation"})``;C.defaultProps={colorToken:"colors.consumption.body.standard.body",typeIdentity:"typography.definitions.globalEditorial.accreditation-core"};const N=a(o).withConfig({displayName:"ReviewListUsername"})``;N.defaultProps={colorToken:"colors.consumption.body.standard.body",typeIdentity:"typography.definitions.globalEditorial.accreditation-core"};const $=a(o).withConfig({displayName:"ReviewListMetaItem"})` display: flex; flex-direction: row; align-items: center; & + & { &::before { margin: 0 ${r(1)}; content: '·'; } } `;$.defaultProps={as:"li",colorToken:"colors.consumption.body.standard.body",typeIdentity:"typography.definitions.globalEditorial.accreditation-core"};const x=a.ul.withConfig({displayName:"ReviewListMeta"})` display: flex; flex-direction: row; flex-wrap: wrap; margin: ${r(2)} 0 0; padding: 0; list-style: none; `,I=a(o).withConfig({displayName:"ReviewListReview"})``;I.defaultProps={colorToken:"colors.consumption.body.standard.body",typeIdentity:"typography.definitions.consumptionEditorial.description-embed"};const M=a.li.withConfig({displayName:"ReviewListItem"})` margin-top: ${r(3)}; border-width: 1px 0 0; border-style: solid; ${({theme:e})=>s(e,"border-color","colors.consumption.body.standard.divider")}; padding-top: ${r(3)}; :first-child { margin-top: 0; border-top: 0; padding-top: 0; } `,L=a.ul.withConfig({displayName:"ReviewListItems"})` display: flex; flex-direction: column; margin: ${r(2)} 0 0; padding: 0; list-style: none; `,S=a(p).withConfig({displayName:"ReviewListCarat"})` margin-left: ${r(1)}; width: ${r(1)}; height: ${r(1)}; ${({theme:e})=>s(e,"fill","colors.interactive.base.black")}; path { transform: rotate(180deg); transform-origin: center; } `,E=a(i).withConfig({displayName:"ReviewListUtilityLink"})``;E.defaultProps={colorToken:"colors.interactive.base.black",typeIdentity:"typography.definitions.utility.button-bulletin"};const k=a(o).withConfig({displayName:"ReviewListTitle"})``;k.defaultProps={as:"h2",colorToken:"colors.consumption.body.standard.subhed",typeIdentity:"typography.definitions.consumptionEditorial.subhed-aux-primary"};const T=a.div.withConfig({displayName:"ReviewListTitleWrapper"})` display: flex; align-items: center; justify-content: space-between; margin: ${r(4)} 0 0; ${({disableTopBorder:e,theme:t})=>!e&&`border-width: 2px 0 0;\n border-style: solid;\n ${s(t,"border-color","colors.consumption.body.standard.divider")};\n padding-top: ${r(4)};\n `} ${({disableTopBorder:e})=>e&&`\n padding-bottom: ${r(4)};\n `} `,A=a.div.withConfig({displayName:"ReviewListWrapper"})` display: flex; flex-direction: column; outline: none; ${c(m.md)} { margin-left: calc(-1 * var(--grid-margin)); padding-right: var(--grid-margin); padding-left: var(--grid-margin); /* Full bleed effect */ width: calc(100% + (2 * var(--grid-margin))); } `,U=a(o).withConfig({displayName:"ReviewListError"})` margin: ${r(4)} 0; text-align: center; `,P=a.li.withConfig({displayName:"ReviewItem"})` margin-top: ${r(3)}; border-width: 1px 0 0; border-style: solid; ${({theme:e})=>s(e,"border-color","colors.consumption.body.standard.divider")}; padding-top: ${r(3)}; :first-child { margin-top: ${r(4)}; border-top: 0; padding-top: 0; ${c(m.md)} { margin-top: ${r(3)}; } } :last-child { margin-bottom: ${r(3)}; ${c(m.md)} { margin-bottom: ${r(3)}; } } ${g} { ${({theme:e})=>d(e,"typography.definitions.foundation.link-utility")}; background-color: rgba( ${l("colors.interactive.base.brand-secondary",{rgbOnly:!0})}, 0.2 ); ${({theme:e})=>s(e,"color","colors.interactive.base.black")}; &[aria-checked='true'] { transition: none; text-decoration: none; } &:hover, &:focus { outline: 0; box-shadow: none; cursor: unset; text-decoration: none; } } ${y} { padding: 0; } `,B=a(o).withConfig({displayName:"ReviewerUserName"})` padding-right: 10px; ${({theme:e})=>s(e,"color","colors.consumption.body.standard.body")}; ${({theme:e})=>d(e,"typography.definitions.globalEditorial.accreditation-feature")}; ${c(m.md)} { padding-right: ${r(1)}; } `,D=a(o).withConfig({displayName:"ReviewListTimeStamp"})` ${({theme:e})=>s(e,"color","colors.interactive.base.dark")}; ${({theme:e})=>d(e,"typography.definitions.foundation.meta-primary")}; `,_=a(o).withConfig({displayName:"ReviewText"})` word-wrap: break-word; white-space: pre-wrap; pointer-events: none; a { text-decoration: none; } ${({theme:e})=>s(e,"color","colors.consumption.body.standard.body")}; ${({theme:e})=>d(e,"typography.definitions.consumptionEditorial.body-core")}; `,F=a(o).withConfig({displayName:"ReviewListMetaData"})` display: flex; flex-direction: row; align-items: center; &&& { ${h} { path { ${({theme:e})=>s(e,"fill","colors.background.brand")}; } } ${b} { width: ${r(2.5)}; } ${f} { &:disabled + ${w} { cursor: unset; } } ${g}:not(:first-of-type) { margin-left: ${r()}; } } `,H=a(o).withConfig({displayName:"ReviewLikeCount"})` padding-right: ${r(2)}; ${({theme:e})=>s(e,"color","colors.interactive.base.dark")}; ${({theme:e})=>d(e,"typography.definitions.consumptionEditorial.citation")}; `,O=a(o).withConfig({displayName:"ReviewReplyLabel"})` ${({theme:e})=>s(e,"color","colors.interactive.base.dark")}; ${({theme:e})=>d(e,"typography.definitions.consumptionEditorial.citation")}; cursor: pointer; padding-right: ${r(.5)}; `,q=a.div.withConfig({displayName:"ReviewReplyWrapper"})` display: flex; flex-direction: row; `,W=a.div.withConfig({displayName:"ReviewReplyWrapper"})` margin-top: ${r(1.25)}; `,j=a.ul.withConfig({displayName:"ReviewListMetaInfo"})` display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; margin-top: ${r(4)}, ${r(4)}; padding: 0; list-style: none; :first-child { margin-bottom: 10px; ${c(m.md)} { margin-bottom: ${r(1)}; } } &:not(:first-child) { margin-bottom: ${r(1.5)}; ${c(m.md)} { margin-bottom: ${r(2)}; } } :last-child { margin-top: ${r(1.5)}; margin-bottom: ${r(1)}; ${c(m.md)} { margin-top: ${r(2)}; margin-bottom: 0; } } .icon-dots { padding-right: 6px; padding-left: 6px; ${({theme:e})=>s(e,"color","colors.interactive.base.dark")}; ${c(m.md)} { padding-right: ${r(.5)}; padding-left: ${r(.5)}; } } .icon-like, .icon-like-filled, .icon-comment { margin-top: 3px; cursor: pointer; width: ${r(4)}; height: 18px; path { ${({theme:e})=>s(e,"fill","colors.interactive.base.dark")}; ${({theme:e})=>s(e,"stroke","colors.interactive.base.dark")}; } &:hover path { ${({theme:e})=>s(e,"fill","colors.interactive.base.black")}; ${({theme:e})=>s(e,"stroke","colors.interactive.base.black")}; } } .icon-like-filled { width: ${r(4)}; height: 18px; path { ${({theme:e})=>s(e,"fill","colors.interactive.base.black")}; ${({theme:e})=>s(e,"stroke","colors.interactive.base.black")}; } } `,G=a(u.Utility).withConfig({displayName:"ReviewListReactionButton"})` padding: 0; &, &:focus, &:hover { border: 0; background-color: transparent; } `;e.exports={ReviewListWrapper:A,ReviewListTitleWrapper:T,ReviewListTitle:k,ReviewListUtilityLink:E,ReviewListCarat:S,ReviewListItems:L,ReviewListItem:M,ReviewListReactionButton:G,ReviewListReview:I,ReviewListMeta:x,ReviewListMetaItem:$,ReviewListUsername:N,ReviewListLocation:C,ReviewListDate:R,ReviewListButton:v,ReviewListError:U,ReviewerUserName:B,ReviewListMetaData:F,ReviewListTimeStamp:D,ReviewText:_,ReviewLikeCount:H,ReviewReplyLabel:O,ReviewListMetaInfo:j,ReviewItem:P,ReviewReplyWrapper:q,ReviewReplyMetaDataWrapper:W}},74657:(e,t,n)=>{const a=n(3442);t.A=(0,a.defineMessages)({loading:{id:"ReviewList.Loading",defaultMessage:"Loading…",description:"Button label while list loads"},reviewListError:{id:"ReviewList.ReviewListError",defaultMessage:"Sorry, more reviews can‘t be loaded right now. {br} Please try again later.",description:"Error message while loading list"},reviewReplyLabel:{id:"ReviewList.ReviewReplyLabel",defaultMessage:"Reply",description:"Reply Icon label"}})},5697:(e,t,n)=>{const{getFromNowDateFormat:a}=n(45526);e.exports={getFromNowDateFormat:a}},45526:(e,t,n)=>{const a=n(39965);e.exports={getFromNowDateFormat:({locale:e="en-US",date:t,formatMessage:n,includeHourAndMin:i=!1})=>{const o=new Intl.RelativeTimeFormat(e,{localeMatcher:"best fit",numeric:"always",style:"long"}),r=new Intl.DateTimeFormat(e,{hour:"2-digit",minute:"2-digit",hour12:!0,localeMatcher:"best fit"}),s=864e5,l=30*s,d=365*s,c=25*s,m=45*s,p=319*s,u=547*s;return(e=>{if(e){const t=(e=>{const t=(new Date).getTime()-new Date(e).getTime();return t<=44e3?n(a.fewSecondsAgoLabel):t<=89e3?n(a.aMinAgoLabel):t<=264e4?o.format(-Math.ceil(t/6e4),"minute"):t<=534e4?n(a.anHourAgoLabel):t<=756e5?o.format(-Math.ceil(t/36e5),"hour"):t<=126e6?n(a.aDayAgoLabel):t<=c?o.format(-Math.ceil(t/s),"day"):t<=m?n(a.aMonthAgoLabel):t<=p?o.format(-Math.ceil(t/l),"month"):t<=u?n(a.aYearAgoLabel):o.format(-Math.ceil(t/d),"year")})(e),g=r.format(new Date(e));return i?`${t}, ${g}`:t}return null})(t)}}},39965:(e,t,n)=>{const{defineMessages:a}=n(3442);e.exports=a({fewSecondsAgoLabel:{id:"LiveStory.feedFewSecondsAgoLabel",defaultMessage:"a few seconds ago",description:""},aMinAgoLabel:{id:"LiveStory.feedAMinAgoLabel",defaultMessage:"a minute ago",description:""},anHourAgoLabel:{id:"LiveStory.feedAnHourAgoLabel",defaultMessage:"an hour ago",description:""},aDayAgoLabel:{id:"LiveStory.feedADayAgoLabel",defaultMessage:"a day ago",description:""},aMonthAgoLabel:{id:"LiveStory.feedAMonthAgoLabel",defaultMessage:"a month ago",description:""},aYearAgoLabel:{id:"LiveStory.feedAYearAgoLabel",defaultMessage:"a year ago",description:""}})},5362:(e,t,n)=>{const a=n(75999).default,{getColorStyles:i,getTypographyStyles:o,calculateSpacing:r}=n(26865),{BaseText:s}=n(18730),l=a.div.withConfig({displayName:"Wrapper"})` margin-bottom: ${r(4)}; font-size: 0; ${({hasHigherMarginBottom:e})=>e&&`margin-bottom: ${r(6)};`} `,d=a(s).withConfig({displayName:"Hed"})` margin-bottom: ${r(3)}; border-bottom: 2px solid; padding-bottom: ${r(2)}; ${({theme:e})=>i(e,"border-color","colors.consumption.body.standard.divider")}; ${({hasThinBorder:e,theme:t})=>e&&`\n border-width: 0 0 1px;\n ${i(t,"border-color","colors.consumption.lead.standard.divider")};\n `} `;d.defaultProps={as:"h2",colorToken:"colors.consumption.body.standard.subhed",typeIdentity:"typography.definitions.consumptionEditorial.subhed-aux-primary"};const c=a.div.withConfig({displayName:"List"})` display: grid; grid-gap: ${r(2)}; /* prefixed version of gap for Safari */ grid-template-columns: ${({ingredientColumns:e})=>1===e?"1fr":"max-content 1fr"}; gap: ${r(2)}; & > :first-child { padding-top: 0; } `,m=a(s).withConfig({displayName:"SubHed"})` grid-column: 1/-1; padding-top: ${r(.5)}; `;m.defaultProps={as:"h3",colorToken:"colors.consumption.body.standard.subhed",typeIdentity:"typography.definitions.globalEditorial.context-title"};const p=a(s).withConfig({displayName:"Amount"})` grid-column: 1; text-align: right; `;p.defaultProps={colorToken:"colors.consumption.body.standard.body",typeIdentity:"typography.definitions.consumptionEditorial.description-core"};const u=a(s).withConfig({displayName:"Description"})` ${({hasDescriptionBodyCore:e,theme:t})=>e&&`${o(t,"typography.definitions.consumptionEditorial.body-core")};\n`} `;u.defaultProps={as:"div",colorToken:"colors.consumption.body.standard.body",typeIdentity:"typography.definitions.consumptionEditorial.description-core"},e.exports={Wrapper:l,List:c,Hed:d,SubHed:m,Amount:p,Description:u}},3890:(e,t,n)=>{const a=n(96540),i=n(5556),{useIntl:o}=n(3442),{useEffect:r,useRef:s,useState:l}=n(96540),{trackMessageUnitEvent:d}=n(14307),{trackComponent:c}=n(92716),{interactionResponse:m}=n(56187),p=n(25965),u=n(15343),g=n(99244),y=n(39321).A,h=n(61057),b=n(4476),w=n(45771),{trackUserAccountEvent:f}=n(14307),{AlertArrow:v,ReviewNoteFormWrapper:R,ReviewNoteSectionContainer:C,ReviewNoteUserInfo:N,ReviewerInfoLabel:$,ReviewerName:x,ReviewerInfoIconButtonWrapper:I,ReviewNoteRatingWrapper:M,RatingFormRating:L,ReviewNotesFormSignin:S,ReviewNotesFormMinimised:E,ReviewerRatingLabel:k,ReviewerInfoAlertToolTip:T,ReveiwerInfoText:A,ReviewTagsInfoLabel:U,ReviewNotesToggleChipListWrapper:P,ReviewNotesFormActions:B,ReviewNotesFormCancelButton:D,ReviewNotesFormTextFieldErrorText:_,ReviewNotesFormSubmitButton:F,ReviewNotesSignInMessageBanner:H,MessageBannerText:O,ReviewNoteTextField:q,ReviewNotesDivider:W}=n(37887),j=n(89662),G=n(73730),{scrollToTheNoteSection:K}=n(39311),{trackContentEngagementEvent:Y}=n(14307),{useOutsideClick:z}=n(87098),Q=({ariaLabel:e,children:t,handleUserSignInStatus:n,isSignedIn:i,onMinimise:o,hasReviewNotesFormSignIn:r,signInURL:s,trackAddNoteEvent:l,handleUsernameChange:d,siteUserName:c})=>{const m={type:"impression",label:"Create Username",subject:"username_modal",source_type:"community_comment"};return i?a.createElement(E,{role:"button",tabIndex:"0",onClick:e=>{l(),(e=>{c?o(e,c):void 0!==c&&(f(m),h.doDisplayModal({successCallback:t=>{d(t),o(e,t)},source:"community_comment"}))})(e)},onKeyPress:o,"aria-label":e},t):a.createElement(E,{onClick:e=>{n(e)}},r&&a.createElement(S,{href:s,rel:"nofollow",id:"stacy"},e),a.createElement("div",null,t))};Q.propTypes={ariaLabel:i.string.isRequired,children:i.node.isRequired,handleUsernameChange:i.func,handleUserSignInStatus:i.func,hasReviewNotesFormSignIn:i.bool,isSignedIn:i.bool.isRequired,onMinimise:i.func.isRequired,signInURL:i.string.isRequired,siteUserName:i.string,trackAddNoteEvent:i.func};const X=({className:e,reviewNoteTags:t=[],reviewerRatingLabel:n,shouldUseInteractiveBrandColor:i=!1,validations:h,modalProps:f={},minimisedReviewNotesText:S,hasReviewNotesFormSignIn:E=!0,isMinimised:X=!0,signInURL:V,userId:J,handleUsernameChange:Z,onSubmitHandler:ee,siteUserName:te,showSavedRecipeNotes:ne,reviewNotesSignInBannerHeaderOffset:ae,shouldEnableRatings:ie,showMessageBannerHandler:oe})=>{a.useEffect((()=>{(async()=>{await m(),c("ReviewNotesForm")})()}),[]);const re={reviewNote:"",toggleChip:[],...ie&&{rating:null}},se=o(),[le,de]=l(re),[ce,me]=l({}),[pe,ue]=l(""),[ge,ye]=l(!0),[he,be]=l(t),{min:we,max:fe,errorMessage:ve,remainingChar:Re}=h||{min:0,max:0},Ce={reviewNote:[{test:e=>e.length>=we&&e.length<=fe,error:"invalidReviewLength"}],rating:[{test:e=>e>=1,error:"requiredField"}]},[Ne,$e]=a.useState(X),[xe,Ie]=a.useState(!1),[Me,Le]=a.useState(!1),[Se,Ee]=l(!1);r((()=>{Ie(!!J)}),[J]),r((()=>{J&&window.location.hash.includes("leave-a-rating")&&K(ae)}),[J,ae]);const ke=S||se.formatMessage(y.defaultcommunityReviewText),Te=(e,t)=>{const n=Ce[e];if(!n)return null;for(const a of n)if(!a.test(t))return me((t=>({...t,[e]:a.error}))),a.error;return me((t=>{const{[e]:n,...a}=t;return a})),null},Ae=e=>t=>{let n;switch(e){case"reviewNote":n=t.target.value.trim(),(e=>{e.length>=fe?ue(se.formatMessage(y.maxCharLimitMet).replace("_MAX_",fe)):fe-e.length<=Re?ue(se.formatMessage(y.remainingMaxCharLimit).replace("_COUNT_",fe-e.length).replace("_MAX_",fe)):ue("")})(n);break;case"toggleChip":n=(e=>{const t=he.map((t=>t.slug===e?{...t,active:!t.active}:t));return be((e=>(((e,t)=>{const n=e.filter((e=>e.active)),a=[];if(!1===t[0].active&&!0===e[0].active||!1===t[1].active&&!0===e[1].active){const e=n.map((e=>e.slug.toLowerCase())),t=1===n.length?n[0].description:"";if(1===n.length)a.push({name:e[0],index:0,total_index:1});else{if(!["tip","question"].every((t=>e.includes(t))))return;a.push({name:"tip",index:0,total_index:1},{name:"question",index:0,total_index:1})}Y({type:"select",label:t,subject:"community_comment",features_list:a},{skipDuplicateEvent:!1})}})(t,e),t))),t})(t);break;default:n=t}de({...le,[e]:n}),"reviewNote"===e&&n.length{Y({type:"attempt",subject:"community_comment"},{skipDuplicateEvent:!1})},Pe=s(null),Be=s(null),De=a.useRef(null),_e=e=>{Pe.current&&!Pe.current.contains(e.target)&&ye(!0),Be.current&&Be.current.id!==e.target?.firstChild.id&&Le(!1)};z(Pe,(e=>_e(e))),z(Be,(e=>_e(e)));const{discardLabel:Fe}=f,He=()=>{De.current.value="",be(t),de({...re,rating:0}),me({}),$e(!0),b.doCloseModal(),ue("")},Oe=se.formatMessage(y.nonLoggedInErrorMessage),qe=(e,t)=>{const n=e[t];return n&&ve[n]?se.formatMessage(y[n],{message:ve[n]}):""},We=qe(ce,"reviewNote"),je=pe.length>0;return a.createElement(R,{className:e,"data-testid":"ReviewNotesForm"},!xe&&!J&&a.createElement(H,null,a.createElement(O,null,se.formatMessage(y.messageBannerText)),a.createElement(G.Primary,{href:V,inputKind:"link",label:se.formatMessage(y.buttonLabel),btnStyle:"outlined",target:"_self",rel:"nofollow noreferrer",onClickHandler:e=>{const t={type:"login",label:e.target.innerText,subject:"community",placement:"interstitial",state:"focused"};d(t)}})),Ne?a.createElement(Q,{ariaLabel:ke,onMinimise:(e,t)=>{e.preventDefault(),t&&$e(!1),ne(!1)},signInURL:V,isSignedIn:xe,trackAddNoteEvent:Ue,handleUserSignInStatus:e=>{e.preventDefault(),Me||Ue(),xe||Le(!0)},hasReviewNotesFormSignIn:E,handleUsernameChange:Z,siteUserName:te},a.createElement(q,{name:"isMinimised",formName:"isMinimised",label:se.formatMessage(y.textFieldLabel),placeholder:ke,hasDynamicTextArea:!0,tabIndex:"-1","aria-hidden":!0,customHeightMultiplier:12,hideLabel:!0,isInvalid:Me,inputRef:Be,isDisabled:Me}),Me&&a.createElement(_,null,Oe)):a.createElement(C,{hasError:!!We,hasWarning:je},a.createElement(j.MultiLine,{name:"reviewNoteText",placeholder:ke,hideLabel:!0,label:se.formatMessage(y.textFieldLabel),formName:"reviewNoteText",hasAutoFocus:!0,inputRef:De,errorText:We,onInputChange:Ae("reviewNote"),max:fe,errorPosition:"belowTextField",shouldDisableTypingAtMaxChar:!0,isDisabled:Se}),je&&a.createElement(_,null,pe),a.createElement(U,null,se.formatMessage(y.reviewTagsLabel)),a.createElement(P,{shouldUseInteractiveBrandColor:i},a.createElement(g,null,he.map((({slug:e,active:t,description:n})=>a.createElement(u,{key:e,isChecked:t,onChange:()=>Ae("toggleChip")(e),shouldUrlRedirect:!1,isDisabled:Se},se.formatMessage(y.reviewTags,{reviewTag:n})))))),ie&&a.createElement(M,null,a.createElement(k,null,se.formatMessage(y.reviewerRatingLabel,{reviewerRatingLabel:n})),a.createElement(L,{averageRatingCount:le.rating,isRatingDisabled:!1,onChange:Ae("rating"),shouldShowOutline:!1}),Object.keys(ce).length>0&&a.createElement(_,null,qe(ce,"rating"))),a.createElement(N,null,a.createElement($,null,se.formatMessage(y.reviewerInfoFieldLabel)),a.createElement(x,null,te),a.createElement(I,{ref:Pe},a.createElement(G.Utility,{isIconButton:!0,ButtonIcon:p,className:"review-note-user__info-button",onClickHandler:e=>(e=>{e.preventDefault(),ye(!ge)})(e),inputKind:"button",role:"button",label:se.formatMessage(y.reviewerInfoIconButtonLabel)}),!ge&&a.createElement(T,null,a.createElement(v,null),a.createElement(A,null,se.formatMessage(y.reviewerFieldInfoIconText)))),a.createElement(W,null)),a.createElement(w,{confirmButtonCallback:()=>{He(),(()=>{{const e={type:"discard",label:Fe.toUpperCase(),subject:"community_comment"};Y(e,{skipDuplicateEvent:!1})}})()},modalProps:f,isVisible:!1}),a.createElement(B,{"data-testid":"ReviewNotesFormActions"},a.createElement(F,{isDisabled:Se||Object.keys(ce).length>0,inputKind:"button",label:se.formatMessage(y.addNoteLabel),onClickHandler:async()=>{Ee(!0);const e=(e=>Object.entries(e).reduce(((e,[t,n])=>{const a=Te(t,n);return a&&(e[t]=a),e}),{}))(le);if(0===Object.keys(e).length){const e={...le,userId:J};null!=await ee(e)?(He(),ne(!0)):oe&&oe(se.formatMessage(y.AddNoteFailedToastMessage))}Ee(!1)}}),a.createElement(D,{isDisabled:Se,btnStyle:"text",inputKind:"link",type:"button",label:se.formatMessage(y.cancelNoteLabel),onClickHandler:()=>{Object.values(le).some((e=>(!Array.isArray(e)||0!==e.length)&&Boolean(e)))?b.doDisplayModal():($e(!0),me({}))}}))))};X.propTypes={className:i.string,handleUsernameChange:i.func,hasReviewNotesFormSignIn:i.bool,isMinimised:i.bool,minimisedReviewNotesText:i.string,modalProps:i.object,onSubmitHandler:i.func,reviewerRatingLabel:i.string,reviewNotesSignInBannerHeaderOffset:i.number,reviewNoteTags:i.array,shouldEnableRatings:i.bool,shouldUseInteractiveBrandColor:i.bool,showMessageBannerHandler:i.func,showSavedRecipeNotes:i.func,signInURL:i.string.isRequired,siteUserName:i.string,userId:i.string,validations:i.shape({min:i.number,max:i.number,remainingChar:i.number,errorMessage:i.shape({requiredField:i.string,invalidReviewLength:i.string})})},e.exports=X},45565:(e,t,n)=>{const{asConfiguredComponent:a}=n(12892),i=n(3890);e.exports=a(i,"ReviewNotesForm")},37887:(e,t,n)=>{const{css:a,default:i}=n(75999),{BaseText:o,BaseLink:r}=n(76955),{ButtonWrapper:s}=n(18974),{calculateSpacing:l,getColorStyles:d,getColorToken:c,getTypographyStyles:m,maxScreen:p,minScreen:u}=n(26865),{BREAKPOINTS:g}=n(96472),y=n(62340),{RatingStar:h}=n(97927),{TextFieldControlTextarea:b,TextFieldWrapper:w}=n(60434),f=n(89662),{ListWrapper:v}=n(14952),{ToggleButton:R}=n(18161),C=n(73730),{TextFieldErrorText:N}=n(60434),$=i(f.MultiLine).withConfig({displayName:"ReviewNoteTextField"})` textarea:disabled { background-color: transparent; } textarea::placeholder { line-height: 2em; } `,x=i.div.withConfig({displayName:"ReviewNoteFormWrapper"})``,I=i.div.withConfig({displayName:"ReviewNoteSectionContainer"})` border: 1px solid; ${({theme:e})=>d(e,"border-color","colors.interactive.base.light")}; padding: ${l(3)}; ${b} { margin-top: 0; padding: ${l(2)} ${l(1.5)}; ${({theme:e,hasError:t})=>d(e,"border-color",t?"colors.interactive.base.brand-secondary":"colors.interactive.base.black")}; &[disabled] { ${({theme:e})=>d(e,"background","colors.interactive.base.white")}; ${({theme:e})=>d(e,"border-color","colors.interactive.base.light")}; ${({theme:e})=>d(e,"color","colors.consumption.body.standard.subhed")}; } } ${w} { ${({hasWarning:e})=>e&&`margin-bottom: ${l(1)};`} } `,M=i.div.withConfig({displayName:"ReviewNoteUserInfo"})` margin-top: ${l(4)}; margin-bottom: ${l(4)}; `,L=i.div.withConfig({displayName:"ReviewNoteRatingWrapper"})` margin-top: ${l(4)}; margin-bottom: ${l(4)}; `,S=i.span.withConfig({displayName:"ReviewerInfoLabel"})` ${({theme:e})=>d(e,"color","colors.consumption.body.standard.body-deemphasized")}; ${({theme:e})=>m(e,"typography.definitions.globalEditorial.accreditation-core")}; `,E=i.span.withConfig({displayName:"ReviewerRatingLabel"})` ${({theme:e})=>d(e,"color","colors.consumption.body.standard.body")}; ${({theme:e})=>m(e,"typography.definitions.globalEditorial.accreditation-core")}; `,k=i.span.withConfig({displayName:"ReviewerName"})` ${({theme:e})=>d(e,"color","colors.consumption.body.standard.body")}; ${({theme:e})=>m(e,"typography.definitions.globalEditorial.accreditation-core")}; padding-left: ${l(.5)}; `,T=i.span.withConfig({displayName:"ReviewTagsInfoLabel"})` ${({theme:e})=>d(e,"color","colors.consumption.body.standard.body")}; ${({theme:e})=>m(e,"typography.definitions.globalEditorial.accreditation-core")}; `,A=i.div.withConfig({displayName:"ReviewerInfoIconButtonWrapper"})` display: inline; svg { width: 24px; height: 24px; ${({theme:e})=>d(e,"fill","colors.consumption.lead.special.context-tertiary")}; } .review-note-user__info-button { float: inline-end; margin: 0; border: 0; background-color: ${({theme:e})=>c(e,"colors.interactive.base.white")}; padding: 0; padding-left: 12px; &:hover, &:focus { border: 0; background: none; } } `,U=i.div.withConfig({displayName:"ReviewNotesToggleChipListWrapper"})` ${R} { ${({theme:e})=>m(e,"typography.definitions.foundation.link-utility")} ${({shouldUseInteractiveBrandColor:e})=>e?a` &[aria-checked='false'] { background-color: rgba( ${c("colors.interactive.base.brand-secondary",{rgbOnly:!0})}, 0.2 ); } `:`&[aria-checked='false'] {\n ${d("color","colors.interactive.base.black")}\n }`} &:focus { box-shadow: none; } &:hover { box-shadow: 0 0 0 1px ${c("colors.interactive.base.black")} inset; } ${p(g.md)} { &:focus, &:hover { box-shadow: none; } } &:disabled { box-shadow: none; } } ${v} { padding-left: 0; } `,P=i(o).withConfig({displayName:"ReveiwerInfoText"})` position: absolute; left: calc(25% - 10px); float: inline-end; z-index: -1; border-radius: 8px; box-shadow: 0 0 20px 12px rgba(0, 0, 0, 0.1); background: white; padding: 17px 22px; width: 80%; box-sizing: border-box; ${({theme:e})=>d(e,"color","colors.interactive.base.dark")}; ${({theme:e})=>m(e,"typography.definitions.utility.input-core")}; ${u(g.sm)} { padding: 12px 13px; } ${u(g.md)} { padding: 17px 22px; } `,B=i.div.withConfig({displayName:"AlertArrow"})` position: absolute; top: auto; bottom: 100%; left: calc(98% - 11px); border-width: 0 10px 13px; border-style: solid; border-color: rgb(254 254 254) transparent; `,D=i.div.withConfig({displayName:"ReviewerInfoAlertToolTip"})` position: relative; z-index: 2; margin-top: 8px; background-color: ${c("colors.background.white")}; ${u(g.sm)} { ${P} { left: calc(8% - 4px); width: 100%; } ${B} { left: calc(98% - 14px); border-width: 0 8px 12px; } } ${u(g.md)} { ${P} { left: calc(25% - 10px); width: 80%; } ${B} { left: calc(98% - 12px); border-width: 0 10px 13px; } } ${u(g.lg)} { ${P} { left: calc(7% - 10px); width: 100%; } ${B} { left: calc(98% - 14px); border-width: 0 10px 13px; } } ${u(g.xl)} { ${P} { left: calc(25% - 10px); width: 80%; } ${B} { left: calc(98% - 11px); border-width: 0 10px 13px; } } ${u(g.xxl)} { ${P} { left: calc(34% - 10px); width: 70%; } ${B} { left: calc(98% - 8px); border-width: 0 10px 13px; } } `,_=i(y).withConfig({displayName:"RatingFormRating"})` align-items: start; padding: ${l()} 0 ${l()}; ${h} { transform: scale(1.78); margin: 0 ${l(1.25)}; } `,F=i.div.withConfig({displayName:"ReviewNotesFormActions"})` ${u(g.lg)} { display: grid; grid-template-columns: repeat(2, auto); gap: 32px; } ${p(g.md)} { display: flex; flex-direction: column; } `,H=i.div.withConfig({displayName:"ReviewNotesDivider"})` margin-top: ${l(2)}; border-bottom: 1px solid; ${d("border-color","colors.consumption.body.standard.divider")}; `,O=i(C.Primary).withConfig({displayName:"ReviewFormSubmitButton"})` ${m("typography.definitions.utility.button-core")} ${({theme:e})=>d(e,"color","colors.interactive.base.brand-primary")}; margin-top: 0.5rem; margin-bottom: 20px; padding: 15px 9px; width: 100%; max-width: 100%; text-decoration: underline; `,q=i(C.Primary).withConfig({displayName:"ReviewFormSubmitButton"})` display: block; margin-top: 0.5rem; margin-bottom: 20px; padding: 15px 9px; width: 100%; max-width: 100%; height: unset; text-align: center; &:active::before { top: 0; left: 0; } `,W=i(N).withConfig({displayName:"ReviewFormTextFieldErrorText"})``,j=i(r).withConfig({displayName:"ReviewNotesFormSignin"})``,G=i.div.withConfig({displayName:"ReviewNotesFormMinimised"})` position: relative; input.text-field__control { cursor: pointer; } @media (max-width: 768px) { textarea.text-field__control { padding: ${l(2)}; } } @media (min-width: 768px) { textarea.text-field__control { padding: ${l(2)} ${l(3)}; } } textarea.text-field__control { cursor: pointer; overflow: auto; overflow-y: hidden; } ${j} { position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 1; color: transparent; } `,K=i.div.withConfig({displayName:"ReviewNotesSignInMessageBanner"})` margin-bottom: ${l(3)}; border-top: 1px solid; border-bottom: 1px solid; padding: ${l(3)}; text-align: -webkit-center; ${d("border-color","colors.consumption.body.standard.divider")}; ${s} { margin-top: ${l(2)}; } `,Y=i(o).withConfig({displayName:"MessageBannerText"})` ${d("color","colors.consumption.lead.standard.heading")}; ${m("typography.definitions.consumptionEditorial.description-feature")} `;e.exports={AlertArrow:B,ReviewNoteFormWrapper:x,ReviewNoteSectionContainer:I,ReviewNoteUserInfo:M,ReviewerInfoLabel:S,ReviewerName:k,ReviewerInfoIconButtonWrapper:A,ReviewNoteRatingWrapper:L,RatingFormRating:_,ReviewerRatingLabel:E,ReviewNotesFormSignin:j,ReviewNotesFormMinimised:G,ReviewerInfoAlertToolTip:D,ReveiwerInfoText:P,ReviewTagsInfoLabel:T,ReviewNotesToggleChipListWrapper:U,ReviewNotesFormActions:F,ReviewNotesFormCancelButton:O,ReviewNotesFormSubmitButton:q,ReviewNotesFormTextFieldErrorText:W,ReviewNotesSignInMessageBanner:K,MessageBannerText:Y,ReviewNoteTextField:$,ReviewNotesDivider:H}},39321:(e,t,n)=>{const a=n(3442);t.A=(0,a.defineMessages)({defaultcommunityReviewText:{id:"ReviewNotesForm.defaultcommunityReviewText",defaultMessage:"Ask a question or leave a helpful tip, suggestion or opinion that is relevant and respectful for the community.",description:"Appears when the form is minimised or maximised and enableCommunityExperience is true"},nonLoggedInErrorMessage:{id:"ReviewForm.nonLoggedInErrorMessage",defaultMessage:"Sign in or create an account to add note.",description:"Message to display non logged in users"},textFieldLabel:{id:"ReviewNotesForm.textFieldLabel",defaultMessage:"Your Review",description:"The label for the main review text field"},addNoteLabel:{id:"ReviewNotesForm.addNoteLabel",defaultMessage:"Add Note",description:"The label for Add Note submit button"},cancelNoteLabel:{id:"ReviewNotesForm.cancelNoteLabel",defaultMessage:"Discard",description:"The label for cancel button"},reviewerInfoFieldLabel:{id:"ReviewNotesForm.ReviewerInfoFieldLabel",defaultMessage:"Adding Note As:",description:"The label for the reviewer name field"},reviewerRatingLabel:{id:"ReviewNotesForm.ReviewerRatingLabel",defaultMessage:"{reviewerRatingLabel}",description:"The label for the reviewer rating field"},reviewerFieldInfoIconText:{id:"ReviewNotesForm.reviewerFieldInfoIconText",defaultMessage:"Your username appears next to your recipe notes and replies. Change it anytime in My Account.",description:"information text for user to change their user name"},reviewerInfoIconButtonLabel:{id:"ReviewNotesForm.reviewerInfoIconButtonLabel",defaultMessage:"user name update message",description:"Label for reviewer user name update message icon"},reviewTagsLabel:{id:"ReviewNotesForm.reviewTagsLabel",defaultMessage:"TAG YOUR NOTE (OPTIONAL)",description:"Label for adding tags"},reviewTags:{id:"FilterComponent.reviewTags",defaultMessage:"{reviewTag}",description:"Value for the tag"},invalidReviewLength:{id:"ReviewNotesForm.invalidReviewNoteLength",defaultMessage:"{message}",description:"Error message for invalid review note length"},requiredField:{id:"ReviewNotesForm.requiredField",defaultMessage:"{message}",description:"Error message for required field"},maxCharLimitMet:{id:"ReviewNotesForm.maxCharLimitMet",defaultMessage:"_MAX_ character limit met",description:"Warning message for max review note length"},remainingMaxCharLimit:{id:"ReviewNotesForm.remainingMaxCharLimit",defaultMessage:"_COUNT_ of _MAX_ character limit remaining",description:"Warning message for invalid review note length"},messageBannerText:{id:"ReviewNotesForm.messageBannerText",defaultMessage:"Join the home cook community and add recipe notes.",description:"Text for the MessageBanner body"},buttonLabel:{id:"ReviewNotesForm.buttonLabel",defaultMessage:"Sign in or create account",description:"Text for the sign in or create account button"},AddNoteFailedToastMessage:{id:"ReviewNotes.AddNoteFailedToastMessage",defaultMessage:"Unable to add your note. Please try again.",description:"Failure message to show on note save"}})},32844:(e,t,n)=>{const a=n(96540),i=n(5556),{useIntl:o}=n(3442),{useState:r,useEffect:s}=n(96540),{ReviewReplyLabel:l,ReviewReplyWrapper:d,ReviewReplyMetaDataWrapper:c}=n(16631),m=n(71001),p=n(22509),{scrollToTheNoteSection:u}=n(39311),{ReplyUserName:g,ReplyDataInfo:y,ReplyCommentsListWrapper:h,ReplyCommentItem:b,ReplyMetaData:w,ReplierUserName:f,ReplyLikeCount:v,ReplyTimeStamp:R,ReplyInfoLabel:C,ReplyText:N,ReplyReactionButton:$,ShowOrHideRepliesLabel:x,ShowOrHideRepliesLabelRule:I}=n(10959),{Comment:M,Like:L,LikeFilled:S}=n(24695),{Dot:E}=n(91470),{getRepliesByCommentId:k}=n(60711),{formatReviewDateAgo:T}=n(39311),{UserAuthenticationClient:A}=n(20656),U=n(53788).default,{oidcCookies:P}=U,B=n(61057),{trackContentEngagementEvent:D,trackUserAccountEvent:_}=n(14307),F=n(20777).A,H=({commentingUrl:e,replies:t,replyPageInfo:n,username:i,reviewModalProps:U,commentReactionHandler:H,user:O,reviewNotesSignInBannerHeaderOffset:q,signInHed:W,signInHedSpanTag:j,signInMessage:G,commentId:K,replyLimit:Y,recipeId:z,showMessageBannerHandler:Q,userReactions:X,updateUserReactions:V,siteUserName:J,handleUsernameChange:Z,shouldEnableReply:ee,shouldEnableUpvotes:te})=>{const{formatMessage:ne}=o(),[ae,ie]=r(null),[oe,re]=r(!1),[se,le]=r([]),[de,ce]=r(!1),[me,pe]=r(n.hasNextPage??!1),[ue,ge]=r(n.hasNextPage?ne(F.ShowMoreRepliesLabel):""),[ye,he]=r(!1),[be,we]=r(!1),[fe,ve]=r(n.endCursor),[Re,Ce]=r(n.hasNextPage??!1),[Ne,$e]=r([]);s((()=>{O?.isAuthenticated&&(window.location.hash.includes("reply-to-reply")||window.location.hash.includes("like-a-reply"))&&u(q)}),[O?.isAuthenticated,q]);const xe=()=>{re(!1)};s((()=>{ye?ge(ne(F.LoadingRepliesLabel)):me&&ge(ne(F.ShowMoreRepliesLabel))}),[ye,me,ne]);const Ie=t=>{const n=((e,t,n)=>e?e.map((e=>{const{id:a,body:i,createdAt:o,siteUsername:r,parent:s,actionCounts:l,viewerActionPresence:d,revision:c}=e;return{replyId:a,replyText:i,replyDate:T(o,t),replyAuthorName:r?.[0]?.name,parentAuthorName:(()=>{let e=n;return"Anonymous"===n?e=n:s?.siteUsername?.[0]?.name&&(e=s?.siteUsername?.[0]?.name),e})(),reactionCount:l?.reaction?.total||0,viewerActionPresence:d,revisionId:c?.id}})):[])(t,ne,i);return n.map((t=>{const{replyId:n,replyAuthorName:i,replyDate:o,replyText:r,parentAuthorName:s,revisionId:u}=t||{},h={commentId:n,revisionId:u};return a.createElement(b,{key:n},a.createElement(y,null,i&&a.createElement(f,null,i)),a.createElement(y,null,a.createElement(w,null,a.createElement(C,null,ne(F.ReviewReplyLabel)),s&&a.createElement(g,null,s),a.createElement(E,null),o&&a.createElement(R,null,o))),r&&a.createElement(N,{dangerouslySetInnerHTML:{__html:r}}),a.createElement(c,null,a.createElement(y,null,te&&a.createElement($,{isIconButton:!0,name:"reply-reaction",label:"Reaction",onClickHandler:()=>(e=>{if(!O?.isAuthenticated){const e=`${document.location.pathname}#like-a-reply`;p.doDisplayModal({dangerousDek:G,dangerousHed:W,dangerousHedSpanTag:j,redirectURL:e,shouldHideIllustration:!0})}H({item:e,reactionSource:"COMMUNITY_LIKE_CLICK_REPLY"});const t={type:X[e.commentId]?.viewerActionPresence?"unlike":"like",subject:"community_reply",items:[{content_id:e.commentId}]};D(t,{skipDuplicateEvent:!1})})(h),ButtonIcon:X[n]?.viewerActionPresence?S:L}),te&&a.createElement(v,null,X[n]?.reactionCount||0),ee&&a.createElement(d,{onClick:e=>((e,t)=>{if(e.preventDefault(),O?.isAuthenticated)J?(ie(t?.replyAuthorName),le((e=>[...e,t?.replyId])),re(!0)):(B.doDisplayModal({successCallback:e=>{Z(e),ie(t?.replyAuthorName),le((e=>[...e,t?.replyId])),re(!0)},source:"community_reply"}),_({type:"impression",subject:"username_modal",label:"Create Username",source_type:"community_reply"}));else{const e={subject:"community_reply",label:"Reply",source_type:"community_reply",type:"login"},t=`${document.location.pathname}#reply-to-reply`;p.doDisplayModal({dangerousDek:G,dangerousHed:W,dangerousHedSpanTag:j,redirectURL:t,shouldHideIllustration:!0,source:"COMMUNITY_REPLY_CLICK",snowplowData:e})}D({type:"attempt",subject:"community_reply",label:"reply",items:[{content_id:t?.replyId}]},{skipDuplicateEvent:!1})})(e,t)},a.createElement(M,null),a.createElement(l,null,ne(F.ReviewReplyCommentLabel))))),oe&&se.includes(n)&&O?.isAuthenticated&&J&&a.createElement(m,{commentId:n,username:ae,recipeId:z,revisionId:u,commentingUrl:e,onCancel:xe,reviewModalProps:U,showMessageBannerHandler:Q,source:"community_reply"}))}))};return a.createElement(h,null,Ie(t),!be&&Ie(Ne),a.createElement(y,null,me&&a.createElement(x,{onClick:async()=>{let t;if(we(!1),Ne.length>=1&&!Re)$e([...Ne]),ce(!0),pe(!1);else{he(!0);const a=fe??n.endCursor;try{const t=A.getCookieValue(P.id),{replies:n,page:{endCursor:i,hasNextPage:o}}=await k(K,a,e,console,t,Y);ve(i),Ce(o),o||ce(!0),pe(o),$e([...Ne,...n]),V(n)}catch(e){t=e?.message||"",console.warn(e)}he(!1)}D({type:"show_more",label:"Show more replies",subject:"community_reply",error:t},{skipDuplicateEvent:!1})}},a.createElement(I,null),ue),de&&a.createElement(x,{onClick:()=>{ce(!1),we(!0),pe(!0)}},a.createElement(I,null),ne(F.HideRepliesLabel))))};H.propTypes={commentId:i.string,commentingUrl:i.string.isRequired,commentReactionHandler:i.func,handleUsernameChange:i.func,recipeId:i.string,replies:i.array,replyLimit:i.number,replyPageInfo:i.object,reviewModalProps:i.object,reviewNotesSignInBannerHeaderOffset:i.number,shouldEnableReply:i.bool,shouldEnableUpvotes:i.bool,showMessageBannerHandler:i.func,signInHed:i.string,signInHedSpanTag:i.string,signInMessage:i.string,siteUserName:i.string,updateUserReactions:i.func,user:i.shape({isAuthenticated:i.bool.isRequired,amguuid:i.string}).isRequired,username:i.string,userReactions:i.objectOf(i.shape({reactionCount:i.number.isRequired,viewerActionPresence:i.bool.isRequired}).isRequired)},e.exports=H},10959:(e,t,n)=>{const a=n(75999).default,{getColorStyles:i,getTypographyStyles:o,maxScreen:r,calculateSpacing:s}=n(26865),{ReviewListMetaInfo:l,ReviewerUserName:d,ReviewLikeCount:c,ReviewListTimeStamp:m,ReviewReplyLabel:p,ReviewText:u,ReviewListReactionButton:g}=n(16631),{BREAKPOINTS:y}=n(96472),{BaseText:h}=n(76955),b=a(h).withConfig({displayName:"ReplyUserName"})` ${({theme:e})=>i(e,"color","colors.interactive.base.dark")}; ${({theme:e})=>o(e,"typography.definitions.globalEditorial.accreditation-feature")}; `,w=a(l).withConfig({displayName:"ReplyDataInfo"})` &:first-child { margin-bottom: ${s(1)}; } margin-left: ${s(8)}; ${r(y.md)} { margin-left: ${s(6)}; } `,f=a(d).withConfig({displayName:"ReplierUserName"})``,v=a.div.withConfig({displayName:"ReplyMetaData"})` display: flex; flex-direction: row; align-items: center; `,R=a.div.withConfig({displayName:"ReplyCommentsListWrapper"})` margin-top: ${s(1.25)}; `,C=a.div.withConfig({displayName:"ReplyCommentItem"})` margin-top: ${s(4)}; &:first-child { margin-top: ${s(2)}; } `,N=a(c).withConfig({displayName:"ReplyLikeCount"})``,$=a(m).withConfig({displayName:"ReplyTimeStamp"})` ${({theme:e})=>o(e,"typography.definitions.foundation.meta-secondary")} `,x=a(p).withConfig({displayName:"ReplyInfoLabel"})` ${({theme:e})=>o(e,"typography.definitions.foundation.meta-secondary")}; `,I=a(u).withConfig({displayName:"ReplyText"})` margin-left: ${s(8)}; ${r(y.md)} { margin-left: ${s(6)}; } `,M=a(g).withConfig({displayName:"ReplyReactionButton"})``,L=a.div.withConfig({displayName:"ShowOrHideRepliesLabel"})` display: flex; flex-direction: row; cursor: pointer; ${({theme:e})=>o(e,"typography.definitions.foundation.link-secondary")}; ${({theme:e})=>i(e,"color","colors.interactive.base.dark")}; `,S=a.hr.withConfig({displayName:"ShowOrHideRepliesLabelRule"})` ${({theme:e})=>i(e,"color","colors.discovery.body.dark.divider")}; align-self: center; margin-right: ${s(1)}; width: ${s(4)}; `;e.exports={ReplyUserName:b,ReplyDataInfo:w,ReplyCommentsListWrapper:R,ReplyCommentItem:C,ReplyMetaData:v,ReplierUserName:f,ReplyLikeCount:N,ReplyTimeStamp:$,ReplyInfoLabel:x,ReplyText:I,ReplyReactionButton:M,ShowOrHideRepliesLabel:L,ShowOrHideRepliesLabelRule:S}},20777:(e,t,n)=>{const a=n(3442);t.A=(0,a.defineMessages)({ReviewReplyLabel:{id:"ReviewReplyComment.ReviewReplyLabel",defaultMessage:"Replying to",description:"The label for the reply note field"},ShowMoreRepliesLabel:{id:"ReviewReplyComment.ShowMoreRepliesLabel",defaultMessage:"Show more replies",description:"The label to show more replies"},ReviewReplyCommentLabel:{id:"ReviewReplyComment.ReviewReplyCommentLabel",defaultMessage:"Reply",description:"The label to show reply icon"},HideRepliesLabel:{id:"ReviewReplyComment.HideRepliesLabel",defaultMessage:"Hide replies",description:"The label to hide replies"},LoadingRepliesLabel:{id:"ReviewReplyComment.LoadingRepliesLabel",defaultMessage:"Loading…",description:"The label to hide replies"}})},71001:(e,t,n)=>{const a=n(96540),i=n(5556),{useState:o,useRef:r}=n(96540),{useIntl:s}=n(3442),l=n(76833).A,{addReply:d}=n(60711),{ReviewReplyUsername:c,ReviewReplyNoteWrapper:m,ReviewReplyLabel:p,ReviewReplyCancelLink:u,ReviewReplyNoteInfo:g,ReviewReplyButton:y,ReviewReplyButtonWrapper:h,ReviewReplyMultilineTextField:b}=n(73559),w=n(45771),f=n(4476),{trackContentEngagementEvent:v}=n(14307),R=3e3,C=({commentId:e,username:t,recipeId:n,revisionId:i,commentingUrl:C,onCancel:N,reviewModalProps:$,showMessageBannerHandler:x,source:I})=>{const{formatMessage:M}=s(),[L,S]=o(!0),[E,k]=o(0),[T,A]=o(!1),U=r(null),P=e=>{const t={type:"discard",label:"YES, DISCARD IT",subject:I};e.preventDefault(),N(),v(t,{skipDuplicateEvent:!1})};return a.createElement(m,null,a.createElement(g,null,a.createElement(p,null,M(l.ReviewReplyLabel)),a.createElement(c,null,t)),a.createElement(b,{name:"reviewReplyNoteText",formName:"reviewReplyNoteText",placeholder:M(l.ReplyFieldPlaceHolder),hasAutoFocus:!0,onInputChange:e=>{const t=e.target.value;k(t.length),e.target.value=t,S(0===t.trim().length),A(!1)},customHeightMultiplier:10,label:M(l.ReplyTextFieldLabel),hideLabel:!0,errorPosition:"belowTextField",errorText:T?M(l.ReviewFieldMinLimitErrorText):E>2900&&E{k(e)},shouldDisableTypingAtMaxChar:!0}),a.createElement(w,{modalProps:$,confirmButtonCallback:e=>P(e)}),a.createElement(h,null,a.createElement(y,{inputKind:"submit",isDisabled:L,label:M(l.ReplyButtonLabel),onClickHandler:async t=>{let a;t.preventDefault();const o=U.current?.value?.trim();if(o.length<2)A(!0),S(!0);else if(o.length>0){const r={storyID:n,parentID:e,parentRevisionID:i,body:o,clientMutationId:"0"};try{await d(C,r)?(P(t),x(M(l.AddReplySuccessToastMessage))):x(M(l.AddReplyFailedToastMessage))}catch(e){a=e?.message||"",console.error("Error while posting reply:",e),x(M(l.AddReplyFailedToastMessage))}v({type:"submit",label:"Reply",subject:"community_reply",error:a},{skipDuplicateEvent:!1})}}}),a.createElement(u,{btnStyle:"text",inputKind:"link",label:M(l.CancelButtonLabel),type:"button",onClickHandler:e=>{U.current&&U.current.value.trim().length>0?f.doDisplayModal():P(e),U.current.focus()}})))};C.propTypes={commentId:i.string,commentingUrl:i.string,onCancel:i.func,recipeId:i.string,reviewModalProps:i.object,revisionId:i.string,showMessageBannerHandler:i.func,source:i.string,username:i.string},e.exports=C},73559:(e,t,n)=>{const a=n(75999).default,{getColorStyles:i,getColorToken:o,getTypographyStyles:r,maxScreen:s,minScreen:l,calculateSpacing:d}=n(26865),c=n(73730),{BaseText:m}=n(76955),{BREAKPOINTS:p}=n(96472),u=n(89662),g=a(m).withConfig({displayName:"ReviewReplyUsername"})` ${({theme:e})=>i(e,"color","colors.consumption.body.standard.body")}; ${({theme:e})=>r(e,"typography.definitions.globalEditorial.accreditation-core")}; padding-left: ${d(.5)}; `,y=a.div.withConfig({displayName:"ReviewReplyNoteWrapper"})` border: 1px solid ${o("colors.foundation.menu.dividers")}; padding: ${d(3)}; gap: ${d(1.5)}; ${s(p.md)} { margin-top: ${d(1.25)}; } `,h=a(c.Primary).withConfig({displayName:"ReviewReplyCancelLink"})` margin-top: ${d(1.25)}; ${r("typography.definitions.utility.button-core")} text-decoration: underline; ${({theme:e})=>i(e,"color","colors.interactive.base.brand-primary")}; `,b=a(u.MultiLine).withConfig({displayName:"ReviewReplyMultilineTextField"})` ${r("typography.definitions.utility.input-core")} ${({theme:e})=>i(e,"color","colors.interactive.base.light")}; `,w=a.span.withConfig({displayName:"ReviewReplyLabel"})` ${({theme:e})=>i(e,"color","colors.consumption.body.standard.body-deemphasized")}; ${({theme:e})=>r(e,"typography.definitions.globalEditorial.accreditation-core")}; `,f=a.div.withConfig({displayName:"ReviewReplyNoteInfo"})` display: flex; `,v=a(c.Primary).withConfig({displayName:"ReviewReplyButton"})` display: block; margin-top: 0.5rem; margin-bottom: 20px; padding: 15px 9px; width: 100%; max-width: 100%; height: unset; text-align: center; &:active::before { top: 0; left: 0; } `,R=a.div.withConfig({displayName:"ReviewReplyButtonWrapper"})` ${l(p.lg)} { display: grid; grid-template-columns: repeat(2, auto); gap: 32px; } ${s(p.md)} { display: flex; flex-direction: column; } `;e.exports={ReviewReplyUsername:g,ReviewReplyNoteWrapper:y,ReviewReplyCancelLink:h,ReviewReplyLabel:w,ReviewReplyNoteInfo:f,ReviewReplyButton:v,ReviewReplyButtonWrapper:R,ReviewReplyMultilineTextField:b}},76833:(e,t,n)=>{const a=n(3442);t.A=(0,a.defineMessages)({ReviewReplyLabel:{id:"ReviewReplyNote.ReviewReplyLabel",defaultMessage:"Replying To:",description:"The label for the reply note field"},ReplyFieldPlaceHolder:{id:"ReviewReplyNote.ReplyFieldPlaceHolder",defaultMessage:"Add your reply here ",description:"The placeholder for the reply note text field"},ReplyButtonLabel:{id:"ReviewReplyNote.ReplyButtonLabel",defaultMessage:"Reply",description:"The label for the reply button"},CancelButtonLabel:{id:"ReviewReplyNote.CancelButtonLabel",defaultMessage:"Discard",description:"The label for the cancel button"},ReplyTextFieldLabel:{id:"ReviewReplyNote.ReplyTextFieldLabel",defaultMessage:"Your Reply",description:"The label for the reply text field"},AddReplySuccessToastMessage:{id:"ReviewReplyNote.AddReplySuccessToastMessage",defaultMessage:"Reply added",description:"Success message to show on reply save"},AddReplyFailedToastMessage:{id:"ReviewReplyNote.AddReplyFailedToastMessage",defaultMessage:"Unable to add your reply. Please try again.",description:"Failure message to show on reply save"},ReviewFieldAlertLimitErrorText:{id:"ReviewReplyNote.ReviewFieldAlertLimitErrorText",defaultMessage:"_CHARACTER_LIMIT_CURRENT_ of _CHARACTER_LIMIT_ character limit remaining.",description:"The error message for the review field alert limit"},ReviewFieldMaxLimitErrorText:{id:"ReviewReplyNote.ReviewFieldMaxLimitErrorText",defaultMessage:"_CHARACTER_LIMIT_ character limit met.",description:"The error message for the review field max limit"},ReviewFieldMinLimitErrorText:{id:"ReviewReplyNote.ReviewFieldMinLimitErrorText",defaultMessage:"Enter 2 characters or more to add a reply.",description:"The error message for the review field min limit"}})},2264:(e,t,n)=>{const a=n(5556),i=n(96540),{useIntl:o}=n(3442),r=n(35512).A,{trackComponent:s}=n(92716),{interactionResponse:l}=n(56187),{SmallProductCardWrapper:d,SmallProductCardObject:c,SmallProductCardHeader:m,SmallProductCardImage:p,SmallProductCardBody:u,SmallProductCardOffer:g,SmallProductCardName:y,SmallProductCardLink:h,SmallProductCardPrice:b,SmallProductCardRetailerName:w,SmallProductCardSalePrice:f}=n(36766),v=n(73275),R=i.forwardRef((({className:e,hasSmallProductCardStyles:t,image:n,link:a,name:R,price:C,retailerName:N,salePrice:$},x)=>{const{formatMessage:I}=o();i.useEffect((()=>{(async()=>{await l(),s("SmallProductCard")})()}),[]);const M=((e,t,n)=>e?{label:t||e,component:t?i.createElement(i.Fragment,null,i.createElement(f,{hasSmallProductCardStyles:n},e),i.createElement(b,{hasSmallProductCardStyles:n}," ",t)):i.createElement(b,{hasSmallProductCardStyles:n},e)}:{label:null,component:null})(C,$,t),L=((e,t,n,a)=>{if(!t)return e;const o=n(r.atRetailerNameComponentText,{retailerNameText:t}),s=n(r.atRetailerNameLabel,{finalPriceLabel:e.label,retailerNameText:t}),l=n(r.buyAt,{retailerNameText:t});return{label:e.label?s:l,component:e?.component?i.createElement(i.Fragment,null,e.component,i.createElement(w,{hasSmallProductCardStyles:a}," ",o)):i.createElement(w,{hasSmallProductCardStyles:a},l)}})(M,N,I,t),{label:S,component:E}=L,k={"data-buy-button":!0,"data-offer-retailer":N||"","data-offer-url":a?.url||"","aria-label":S,href:a?.shortUrl||a?.url,onClick:a?.onClick,title:S,rel:"nofollow",target:"_blank"};let T=null;return n&&k.href?T=i.createElement("a",{...k,tabIndex:"-1"},i.createElement(v,{...n})):n&&(T=i.createElement(v,{...n})),i.createElement(d,{className:e,ref:x},i.createElement(c,null,i.createElement(m,null,i.createElement(p,null,T)),i.createElement(u,{hasSmallProductCardStyles:t},R?i.createElement(y,{hasSmallProductCardStyles:t},R):null,S&&E&&k.href?i.createElement(h,{...k},i.createElement(g,null,E)):null)))}));R.propTypes={className:a.string,hasSmallProductCardStyles:a.bool,image:a.shape(v.propTypes),link:a.shape({label:a.string,onClick:a.func,shortUrl:a.string,url:a.string}),name:a.string,price:a.string,retailerName:a.string,salePrice:a.string},e.exports=R},96482:(e,t,n)=>{const a=n(64946),i=n(2264);e.exports=a(i)},36766:(e,t,n)=>{const a=n(75999).default,{BaseLink:i,BaseText:o}=n(76955),{calculateSpacing:r,getColorStyles:s}=n(26865),l=a(o).withConfig({displayName:"SmallProductCardSalePrice"})` text-decoration: line-through; ${({hasSmallProductCardStyles:e,theme:t})=>e&&`${s(t,"color","colors.consumption.body.standard.body")};\n font-weight: 400; \n `} `;l.defaultProps={as:"span",colorToken:"colors.consumption.body.standard.link",typeIdentity:"typography.definitions.utility.button-utility"};const d=a(o).withConfig({displayName:"SmallProductCardRetailerName"})` ${({hasSmallProductCardStyles:e,theme:t})=>e&&`${s(t,"color","colors.consumption.body.standard.body")};\n font-weight: 400;\n `} `;d.defaultProps={as:"span",colorToken:"colors.consumption.body.standard.link",typeIdentity:"typography.definitions.utility.button-utility"};const c=a(o).withConfig({displayName:"SmallProductCardPrice"})` ${({hasSmallProductCardStyles:e,theme:t})=>e&&`${s(t,"color","colors.consumption.body.standard.body")};\n font-weight: 400;\n `} `;c.defaultProps={as:"span",colorToken:"colors.consumption.body.standard.link",typeIdentity:"typography.definitions.utility.button-utility"};const m=a(o).withConfig({displayName:"SmallProductCardOffer"})` /* stylelint-disable property-no-vendor-prefix,value-no-vendor-prefix */ display: -webkit-box; margin-top: ${r(1.5)}; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; /* stylelint-enable property-no-vendor-prefix,value-no-vendor-prefix */ `;m.defaultProps={colorToken:"colors.consumption.body.standard.link",typeIdentity:"typography.definitions.utility.button-utility"};const p=a(i).withConfig({displayName:"SmallProductCardLink"})` margin-top: auto; `;p.defaultProps={colorToken:"colors.consumption.body.standard.link",hasUnderline:!0,typeIdentity:"typography.definitions.utility.button-utility"};const u=a(o).withConfig({displayName:"SmallProductCardName"})` /* stylelint-disable property-no-vendor-prefix,value-no-vendor-prefix */ display: -webkit-box; margin-top: ${r(1)}; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; /* stylelint-enable property-no-vendor-prefix,value-no-vendor-prefix */ ${({hasSmallProductCardStyles:e})=>e&&"font-weight: 400;"} `;u.defaultProps={colorToken:"colors.consumption.body.standard.subhed",typeIdentity:"typography.definitions.consumptionEditorial.subhed-aux-secondary"};const g=a.div.withConfig({displayName:"SmallProductCardBody"})` display: flex; flex: 1 0 auto; flex-direction: column; padding: 0 ${r(1)} ${r(1.5)}; text-align: center; ${({hasSmallProductCardStyles:e})=>e&&"text-align: left;"} `,y=a.div.withConfig({displayName:"SmallProductCardImage"})` &::before { display: block; ${({theme:e})=>s(e,"background-color","colors.consumption.body.standard.bg-photo")}; padding-top: ${({width:e,height:t})=>e&&t?`${e} / ${t}px`:"100%"}; content: ''; } position: relative; width: 100%; overflow: hidden; picture, img { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; object-fit: cover; } `,h=a.div.withConfig({displayName:"SmallProductCardHeader"})``,b=a.div.withConfig({displayName:"SmallProductCardObject"})` display: flex; flex-direction: column; border: 1px solid; height: 100%; ${({theme:e})=>s(e,"border-color","colors.consumption.body.standard.bg-card")}; `,w=a.div.withConfig({displayName:"SmallProductCardWrapper"})` margin: 0; height: 100%; `;e.exports={SmallProductCardWrapper:w,SmallProductCardObject:b,SmallProductCardHeader:h,SmallProductCardImage:y,SmallProductCardBody:g,SmallProductCardOffer:m,SmallProductCardName:u,SmallProductCardLink:p,SmallProductCardPrice:c,SmallProductCardRetailerName:d,SmallProductCardSalePrice:l}},35512:(e,t,n)=>{const a=n(3442);t.A=(0,a.defineMessages)({atRetailerNameComponentText:{id:"SmallProductCard.AtRetailerNameComponentText",defaultMessage:"At {retailerNameText}",description:"SmallProductCard component At RetailerName text"},atRetailerNameLabel:{id:"SmallProductCard.AtRetailerNameLabel",defaultMessage:"{finalPriceLabel} At {retailerNameText}",description:"SmallProductCard component At RetailerName text with price"},buyAt:{id:"SmallProductCard.BuyAt",defaultMessage:"Buy At {retailerNameText}",description:"SmallProductCard component Buy At RetailerName text"}})},64946:(e,t,n)=>{const a=n(5556),i=n(96540);e.exports=e=>{const t=({forwardedRef:t,...n})=>{const a={...n.link,onClick:()=>{n.onClick&&n.onClick(),window.dataLayer&&window.dataLayer.push({event:"buy-button-click"})}};return i.createElement(e,{...n,link:a,ref:t})};return t.propTypes={forwardedRef:a.oneOfType([a.func,a.shape({current:a.any})]),link:a.shape({url:a.string}),onClick:a.func,retailerName:a.string},i.forwardRef(((e,n)=>i.createElement(t,{...e,forwardedRef:n})))}},43474:(e,t,n)=>{const a=n(96540),i=n(5556),{useState:o,useEffect:r,useCallback:s}=n(96540),{useIntl:l}=n(3442),d=n(47125),{formatReviewListItems:c,scrollToTheNoteSection:m}=n(39311),{getComments:p,requestGraphService:u}=n(60711),{createCommentReaction:g,removeCommentReaction:y}=n(22914),h=n(22509),b=n(12311),{default:w}=n(84708),f="removeCommentReaction",v="createCommentReaction",R=({commentAttributes:e,id:t,hasCommunityExperienceEnabled:n,page:i,entityId:R,reviews:C,reviewsCount:N,reviewDefaultSort:$,reviewLimit:x,replyLimit:I,shouldEnableFromNowDate:M,shouldEnableReply:L,showMessageBannerHandler:S,signInHed:E,signInHedSpanTag:k,signInMessage:T,reviewModalProps:A,reviewNoteTags:U,reviewNotesSignInBannerHeaderOffset:P,user:B,siteUserName:D,handleUsernameChange:_,...F})=>{const{formatMessage:H}=l(),[O,q]=o(),[W,j]=o(),[G,K]=o(),[Y,z]=o(null),[Q,X]=o(!1),V=M||!1,[J,Z]=o([]),{commentingUrl:ee}=e,[te,ne]=o({});r((()=>{const e=c(C,H,U,V);Z(e),X(i.hasNextPage??!1)}),[C,i,V,H,U]),r((()=>{ne((e=>J.reduce(((e,t)=>(e[t.commentId]||(e[t.commentId]={reactionCount:t.reactionCount,viewerActionPresence:t.viewerActionPresence}),t.replies&&t.replies.length>0&&t.replies.forEach((t=>{e[t.id]||(e[t.id]={reactionCount:t?.actionCounts?.reaction?.total,viewerActionPresence:t?.viewerActionPresence?.reaction})})),e)),{...e})))}),[J]),r((()=>{B?.isAuthenticated&&window.location.hash.includes("like-a-comment")&&m(P)}),[B?.isAuthenticated,P]);const ae=s((async({item:e,operation:t,reactionSource:n})=>{const{commentId:a,revisionId:i}=e,o=te[a]?.viewerActionPresence,r=t||(o?f:v);if(B&&B.isAuthenticated){ne((e=>({...e,[a]:{reactionCount:e[a].viewerActionPresence?--e[a].reactionCount:++e[a].reactionCount,viewerActionPresence:!e[a].viewerActionPresence}})));const e={operationName:r,query:r===v?g:y,variables:{input:{commentID:a,commentRevisionID:i,clientMutationId:"0"}}};try{await u(ee,e)}catch(e){ne((e=>({...e,[a]:{reactionCount:e[a].viewerActionPresence?--e[a].reactionCount:++e[a].reactionCount,viewerActionPresence:!e[a].viewerActionPresence}})));const t=r===v?w.likeActionErrorMessage:w.unlikeActionErrorMessage;S(H(t)),console.warn(e)}}else{const e={type:"login",source_type:n?"community_reply":"community_comment"},t=`${document.location.pathname}#like-a-comment`;h.doDisplayModal({dangerousHed:E,dangerousHedSpanTag:k,dangerousDek:T,redirectURL:t,analyticsType:"comment reaction",shouldHideIllustration:!0,source:n??"COMMUNITY_LIKE_CLICK_NOTE",snowplowData:e})}}),[B,te,ee,E,k,T,H,S]);r((()=>{if(window.document&&window.document.location){const e=b.parseQueryParams(window.location.search);e.action&&(e.action===v||e.action===f)&&e.commentId&&e.commentRevisionId&&B.isAuthenticated&&(ae({item:{commentId:e.commentId,revisionId:e.commentRevisionId},operation:e.action}),window.history.replaceState({},document.title,document.location.pathname+document.location.hash))}}),[B.isAuthenticated,ae]),r((()=>{q(Q?"Show More Notes":void 0)}),[Q,q]);const ie=Q?{onClick:async()=>{j(!0),K();const e=Y??i.endCursor;try{const{reviews:t,page:{endCursor:n,hasNextPage:a}}=await p({entityId:R,after:e,commentingUrl:ee,logger:console,defaultSort:$,reviewLimit:x});z(n),X(a);const i=c(t,H,U,V);Z([...J,...i])}catch(e){K(new Error(e))}j(!1)},label:O}:null;return J.length||G?a.createElement(d,{hasCommunityExperienceEnabled:n,items:J,id:t,commentingUrl:ee,cta:ie,isLoading:W,hasErrored:!!G,user:B,reviewNotesSignInBannerHeaderOffset:P,reviewModalProps:A,...F,commentReactionHandler:ae,userReactions:te,updateUserReactions:e=>{ne((t=>e.reduce(((e,t)=>(e[t.id]||(e[t.id]={reactionCount:t?.actionCounts?.reaction?.total,viewerActionPresence:t?.viewerActionPresence?.reaction}),e)),{...t})))},signInHed:E,signInHedSpanTag:k,signInMessage:T,showMessageBannerHandler:S,shouldEnableReply:L,replyLimit:I,siteUserName:D,handleUsernameChange:_}):null};R.propTypes={commentAttributes:i.shape({organizationId:i.string.isRequired,commentingUrl:i.string.isRequired,tenantID:i.string.isRequired}),entityId:i.string.isRequired,handleUsernameChange:i.func,hasCommunityExperienceEnabled:i.bool,id:i.string,page:i.shape({hasNextPage:i.bool,endCursor:i.string}).isRequired,replyLimit:i.number,reviewDefaultSort:i.shape({commentsOrderBy:i.string,repliesOrderBy:i.string}),reviewLimit:i.number,reviewModalProps:i.object,reviewNotesSignInBannerHeaderOffset:i.number,reviewNoteTags:i.array,reviews:i.array.isRequired,reviewsCount:i.number.isRequired,shouldEnableFromNowDate:i.bool,shouldEnableReply:i.bool,showMessageBannerHandler:i.func,signInHed:i.string,signInHedSpanTag:i.string,signInMessage:i.string,siteUserName:i.string,user:i.shape({isAuthenticated:i.bool.isRequired,amguuid:i.string}).isRequired},e.exports=R},6322:(e,t,n)=>{const a=n(75999).default,{calculateSpacing:i,getColorToken:o,getTypographyStyles:r,minScreen:s,maxScreen:l,minMaxScreen:d,firstLetterDropCap:c}=n(26865),{BREAKPOINTS:m}=n(96472),p=n(30543),{RecircListTextOverlayWrapper:u}=n(8851),g=n(19607),y=n(30830),h=n(96482),{BodyWrapper:b}=n(29912),{SocialIconsList:w}=n(51e3),f=n(59525),v=n(35676),R=n(86659),{GridItem:C}=n(40653),{InstructionsWrapper:N}=n(5362),$=n(6494),{SplitScreenContentHeaderDek:x,SplitScreenContentHeaderByline:I,SplitScreenContentHeaderRating:M,SplitScreenContentHeaderLedeBlock:L,SplitScreenContentHeaderCaption:S}=n(9481),{RubricWrapper:E}=n(6613),{getPattern:k}=n(30),{StyledTextblock:T}=n(18765),{ButtonWrapper:A}=n(18974),U=n(87339),P=n(13447),{MessageBannerTitle:B,MessageBannerContent:D}=n(8070),{SummaryCarouselRow:_}=n(34751),{CarouselListButton:F}=n(44802),{Wrapper:H}=n(5362),{ActionBarButtonText:O,ActionBarButtonIcon:q,ActionBarButton:W}=n(11586),{ActionBarWrapperContent:j}=n(97024),{RatingStar:G}=n(97927),{RatingFormRating:K}=n(6276),Y=a(y).withConfig({displayName:"RecipePageCarousel"})` &&& { ${A} { margin-top: 0; } } /* Full bleed effect */ ${d("0px",m.lg)} { > ul { margin-right: -1.5rem; margin-left: -1.5rem; padding: 0 1.5rem; li:last-child { box-sizing: content-box; padding-right: 1.5rem; } } } `,z=a(R.WithMargins).withConfig({displayName:"GridWithMarginsWrapper"})` ${C} { grid-column: 12/2; } `,Q=a(p).withConfig({displayName:"RecipePageWrapper"})` && .grid-layout--adrail { ${s(m.lg)} { grid-template-columns: repeat(8, 1fr) minmax(300px, 4fr); .grid-layout__aside { grid-column: 9 / -1; } } .grid-layout__content { min-width: 0; ${s(m.md)} { grid-column: 2 / -2; } ${s(m.lg)} { grid-column: 2 / 8; } } @media print { grid-template-columns: fit-content(100%); } } &&& .grid-layout-twoColumns { ${s(m.lg)} { grid-template-columns: repeat(12, 1fr); .grid_content_columnOne { ${H} { margin-bottom: ${i(5)}; } display: flex; grid-column: 2 / 5; flex-direction: column; } .grid_content_columnTwo { grid-column: 6 / 12; } } } ${b} { .container--body-inner { ${s(m.md)} { grid-column: 1 / -1; } .content-card-embed--side-by-side { margin-bottom: ${i(3)}; } p.has-dropcap { margin-top: ${i(4,"px")}; &::first-letter { ${c}; } &.has-dropcap__lead-standard-heading { &::first-letter { padding: 0.1em 0.05em 0 0; color: ${o("colors.consumption.lead.standard.heading")}; } } } } } ${u} { ${d("0px",m.lg)} { margin-top: ${i(4)}; } } .ad--mid-content { margin-bottom: ${i(4)}; } ${s(m.xl)} { /* CNE player changes width to 370px at xl FIXME: explore why we need to do this on recipe page only, this is not ideal */ .cne-interlude-embed figure[data-testid='cne-interlude-container-right-rail'] { width: 300px; } } .recipe-page-taboola-wrapper { --grid-margin: 1.5rem; margin: 0 auto; padding: 0 calc(1 * var(--grid-margin)); max-width: 728px; } @media print { ${E}, ${x}, ${I}, ${M}, ${L}, ${S}, ${b}, ${T}, ${Y}, ${N} .asset-embed, [data-testid="RecipePageMainContent"], .recirc-list-wrapper { display: none; } } ${K} { ${G} { transform: scale(1.78); margin: 0 ${i(1.25)}; } } `,X=a.div.withConfig({displayName:"RecipePageContentBackground"})` ${({theme:e})=>k(e,"content-background")}; padding-top: ${i(2)}; ${j} { :nth-of-type(1) { .bookmark { border-top-left-radius: 0; border-bottom-left-radius: 0; ${O} { display: none; } ${q} { margin-right: 0; } } .print { ${q} { margin-right: 0; } } ${l(m.md)} { .print { display: none; } ${W} { &:hover { background-color: transparent; } } } } @media print { display: none; } } ${j}:not(:first-child) { .print { ${q} { margin-right: 0; } } ${l(m.md)} { .print { display: none; } ${W} { &:hover { background-color: transparent; } } } .overlay-action-bar { .bookmark { border-top-left-radius: 0; border-bottom-left-radius: 0; ${O} { display: none; } ${q} { margin-right: 0; } } } @media print { display: none; } } `,V=a.div.withConfig({displayName:"OverlayActionBar"})` display: flex; justify-content: center; `,J=a(g).withConfig({displayName:"RecipePagePostArticleAd"})` ${s(m.lg)} { display: none; } `,Z=a(h).withConfig({displayName:"RecipePageCarouselCard"})` display: flex; width: 100%; height: 100%; > *:first-child { width: 100%; } `,ee=a($).withConfig({displayName:"RecipePageTagCloud"})` margin-bottom: ${i(4)}; `,te=a(v.Circular).withConfig({displayName:"RecipePageSocialIcons"})` ${s(m.lg)} { display: none; } ${w} { justify-content: center; ${({hideBookmarkMobile:e})=>e&&".social-icons__list-item--bookmark {\n display: none;\n }\n .social-icons__list-item--bookmarkactivated {\n display: none;\n }\n "} } `,ne=a.div.withConfig({displayName:"FeaturedInCarouselWrapper"})` margin: 0 0 ${i(4)} 0; background-color: ${o("colors.discovery.body.light.background")}; ${_} { background-color: ${o("colors.discovery.body.light.background")}; .summary-item__icon-button { background-color: rgba( ${o("colors.interactive.base.white",{rgbOnly:!0})}, 0.9 ); svg path { fill: ${o("colors.interactive.base.black")}; } &:hover, &:active, &:focus { background-color: rgba( ${o("colors.interactive.base.white",{rgbOnly:!0})}, 0.9 ); svg path { fill: ${o("colors.interactive.base.black")}; } } } .summary-item__dek, .summary-item__hed { /* stylelint-disable-next-line value-no-vendor-prefix */ display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; } .summary-item__dek { -webkit-line-clamp: ${({maxDekLine:e})=>e}; } .summary-item__hed.summary-item__hed { ${r("typography.definitions.discovery.hed-core-secondary")} -webkit-line-clamp: ${({maxDekLine:e})=>e}; } ${F} { top: 33%; } } `,ae=a(f).withConfig({displayName:"RecipePageInfoSlice"})` margin-bottom: ${i(4)}; `,ie=a(P).withConfig({displayName:"RecipePageMessageBanner"})` margin-top: 40px; margin-bottom: 32px; ${l(m.md)} { margin-top: 24px; margin-bottom: 24px; padding: 16px 0; } ${B} { color: ${o("colors.consumption.lead.standard.heading")}; } ${D} { ${r("typography.definitions.utility.input-core")} } `,oe=a(U).withConfig({displayName:"FeaturedInCarousel"})``,re=a.div.withConfig({displayName:"RecipePageReviewListLoaderWrapper"})` text-align: center; `;e.exports={FeaturedInCarouselWrapper:ne,FeaturedInCarousel:oe,GridWithMarginsWrapper:z,RecipePageWrapper:Q,RecipePagePostArticleAd:J,RecipePageCarousel:Y,RecipePageCarouselCard:Z,RecipePageTagCloud:ee,RecipePageSocialIcons:te,RecipePageInfoSlice:ae,RecipePageContentBackground:X,OverlayActionBar:V,RecipePageMessageBanner:ie,RecipePageReviewListLoaderWrapper:re}},39311:(e,t,n)=>{const{fetchWithTimeout:a}=n(57743),{getFromNowDateFormat:i}=n(5697),o=e=>e instanceof Date&&!isNaN(e),r=(e,t)=>{const n=new Date(e);return o(n)?i({date:n,formatMessage:t,includeHourAndMin:!1}):e},s=e=>{const t=new Date(e);return o(t)?t.toLocaleDateString("en-US"):e},l={yield:"Yield",totalTime:"Total Time"};e.exports={fetchUserRecipeRating:async(e,t)=>{if(!t)return null;let n;try{n=await a(`/api/recipe/${e}/review-ratings/${t}?verso=true`,{method:"GET"},5e3)}catch(e){return console.error(e),null}if(200===n.status){const{reviews:e,error:t}=await n.json();if(t)console.error(t);else if(e&&e.length>0){const t=e.filter((e=>Object.hasOwnProperty.call(e,"rating"))).sort(((e,t)=>{const n=new Date(e.updatedAt);return new Date(t.updatedAt)-n}));return t[0]?.rating||null}}return null},formatReviewListItemDate:s,formatReviewListItems:(e,t,n,a=!1)=>e?e.map(((e,i)=>{const{revisionId:o,viewerActionPresence:l,reactionCount:d,replyPageInfo:c,replies:m}=e,p={id:i,revisionId:o,commentId:e._id,viewerActionPresence:l,reactionCount:d,replyPageInfo:c,replies:m};e.reviewText&&(p.text=e.reviewText),e.location&&(p.location=e.location);const u=e.isAnonymous?"Anonymous":e.siteUsername||e.reviewerInfo;return u&&(p.username=u),e.rating&&(p.rating=e.rating),e.recipeId&&(p.recipeId=e.recipeId),e.updatedAt&&(p.date=a?r(e.updatedAt,t):s(e.updatedAt)),e.tags&&(p.tags=((e,t)=>e.reduce(((e,n)=>{const a=t.find((e=>e.slug===n));return a&&e.push(a.label),e}),[]))(e.tags,n)),p})):[],formatReviewListTitle:(e,t,n="")=>{const a=t||"Reviews";return e||n?`${a}${e&&e>0?` (${e})`:` ${n}`}`:a},formatInfoSliceItems:(e,t,n)=>{if(!e)return[];const a=[];return Object.keys(e).forEach((i=>{e[i]&&e[i].length&&l[i]&&a.push({key:n[l[i]]?t(n[l[i]]):l[i],value:e[i]})})),a},scrollToTheNoteSection:e=>{const t=window.document.querySelector("[data-testid^=ReviewNotesForm]").getBoundingClientRect().top+window.pageYOffset-(e||0);window.scrollTo({top:t,behavior:"smooth"}),window.history.replaceState({},document.title,document.location.pathname)},formatReviewDateAgo:r}},22914:e=>{e.exports={createCommentReaction:"\n mutation CreateCommentReaction($input: CreateCommentReactionInput!) {\n createCommentReaction(input: $input) {\n clientMutationId\n comment {\n id\n }\n }\n }\n",createReply:"\n mutation Mutation($input: CreateCommentReplyInput!) {\n createCommentReply(input: $input) {\n clientMutationId\n edge {\n cursor\n node {\n body\n id\n depth\n parentCount\n replyCount\n replies {\n nodes {\n depth\n id\n replyCount\n }\n }\n }\n }\n }\n }\n",createUserComment:"\n mutation AddReview($input: AddReviewInput!, $coralUserID: ID!) {\n addReview(input: $input, coralUserID: $coralUserID) {\n message\n }\n }\n",Comments:"\n query Comments(\n $after: Cursor\n $commentLimit: Int = 10\n $commentsOrderBy: COMMENT_SORT\n $repliesOrderBy: COMMENT_SORT\n $replyLimit: Int = 1\n $storyId: ID!\n $showPrimaryComments: Boolean\n ) {\n coralcomments(\n first: $commentLimit\n after: $after\n storyID: $storyId\n orderBy: $commentsOrderBy\n showPrimaryComments: $showPrimaryComments\n ) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n nodes {\n id\n body\n isAnonymous\n meta\n createdAt\n rating\n siteUsername {\n name\n }\n revision {\n id\n }\n reviewTags {\n code\n }\n revisionHistory {\n id\n }\n viewerActionPresence {\n reaction\n }\n actionCounts {\n reaction {\n total\n }\n }\n replies(orderBy: $repliesOrderBy, flatten: true, first: $replyLimit) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n depth\n id\n body\n createdAt\n siteUsername {\n name\n }\n revision {\n id\n }\n viewerActionPresence {\n reaction\n }\n actionCounts {\n reaction {\n total\n }\n }\n parent {\n siteUsername {\n name\n }\n }\n }\n }\n }\n }\n }\n",checkStory:"\n query Story($id: ID!) {\n story(id: $id) {\n id\n }\n }\n",addStory:"\n mutation createStory($inp: CreateStoryInput!) {\n createStory(input: $inp) {\n story {\n id\n }\n }\n }\n",addUserRating:"\n mutation addReview($inp: AddReviewInput!, $coralUserID: ID!) {\n addReview(input: $inp, coralUserID: $coralUserID) {\n message\n }\n }\n",Ratings:"\n query storyRating($storyId: String, $ratingScale: Int) {\n storyRating(storyId: $storyId, ratingScale: $ratingScale) {\n average\n count\n }\n }\n",ratingByUser:"\n query coralreviews($siteID: String!, $storyID: String!, $userID: String!) {\n coralreviews(siteID: $siteID, storyID: $storyID, userID: $userID) {\n rating {\n rating\n siteID\n storyID\n authorID\n }\n comment {\n body\n }\n }\n }\n",removeCommentReaction:"\n mutation RemoveCommentReaction($input: RemoveCommentReactionInput!) {\n removeCommentReaction(input: $input) {\n clientMutationId\n comment {\n id\n }\n }\n }\n",repliesByCommentId:"\n query CommentById(\n $replyLimit: Int = 10\n $after: Cursor\n $orderBy: COMMENT_SORT\n $commentId: ID!\n ) {\n coralcomment(id: $commentId) {\n id\n replies(\n first: $replyLimit\n after: $after\n orderBy: $orderBy\n flatten: true\n ) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n id\n body\n createdAt\n siteUsername {\n name\n }\n revision {\n id\n }\n viewerActionPresence {\n reaction\n }\n actionCounts {\n reaction {\n total\n }\n }\n parent {\n siteUsername {\n name\n }\n }\n }\n }\n }\n }\n",storyCommentsCount:"\n query Story($id: ID!) {\n story(id: $id) {\n totalPrimaryCommentsCount\n }\n }\n"}},60711:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateAndAddStory=t.getDataReviews=t.addReview=t.addReply=t.addDataStory=t.storyExists=t.getStoryCommentsCount=t.getRepliesByCommentId=t.getComments=t.requestGraphService=void 0;const a=n(22914),{GraphQLClient:i}=n(96497),{getCookie:o}=n(56892),r=n(53788).default,{oidcCookies:s}=r;t.requestGraphService=(e,t,n="")=>{const a=o(s.access)||n,r=new i(e),{query:l,variables:d}=t,c={"Access-Control-Request-Method":"POST","Access-Control-Request-Headers":"Content-Type","Content-Type":"application/json","User-Agent":"verso-client",Authorization:`Bearer ${a}`};return r.request(l,d,c)},t.getComments=async({entityId:e,after:n,commentingUrl:i,logger:o,defaultSort:r,reviewLimit:s,accessToken:l,replyLimit:d=1})=>{const c=r.commentsOrderBy||"CREATED_AT_ASC",m=r.repliesOrderBy||"CREATED_AT_DESC",p=s||15,u={operationName:"Comments",query:a.Comments,variables:{commentLimit:p,replyLimit:d,after:n,storyId:e,commentsOrderBy:c,repliesOrderBy:m,showPrimaryComments:!0}};try{const n=await(0,t.requestGraphService)(i,u,l),{pageInfo:{hasNextPage:a=!1,endCursor:o=null}={},nodes:r=[]}=n?.coralcomments??{},s=r?.map((t=>{const{isAnonymous:n,body:a,createdAt:i,id:o,meta:r,rating:s,revision:l,viewerActionPresence:d,actionCounts:c,replies:m,reviewTags:p,siteUsername:u}=t,{location:g,reviewerInfo:y,willPrepareAgain:h}=(e=>{if(!e)return{willPrepareAgain:!0,location:"No location",reviewerInfo:"ANONYMOUS"};try{const t=JSON.parse(e),{location:n,displayName:a,willPrepareAgain:i}=t;return{willPrepareAgain:i,location:n,reviewerInfo:a}}catch(e){return{willPrepareAgain:"",location:"",reviewerInfo:""}}})(r),b=l?.id||null,w=p?.map((e=>e.code))||[],f=c?.reaction?.total??0;return{isAnonymous:n,location:g,recipeId:e,reviewText:a,reviewerInfo:y,willPrepareAgain:h,createdAt:i,updatedAt:i,rating:s,_id:o,revisionId:b,viewerActionPresence:d?.reaction??!1,reactionCount:f,replies:m?.nodes,replyPageInfo:m?.pageInfo,siteUsername:u?.[0]?.name,tags:w}}));return{recipeId:e,reviews:s,reviewsCount:s.length,page:{hasNextPage:a,endCursor:o},average:0,ratingsCount:0}}catch(t){return o.warn(`Error making GQL request in getComments: ${t.message}`),{recipeId:e,reviews:[],reviewsCount:0,page:{hasNextPage:!1,endCursor:""},average:0,ratingsCount:0}}},t.getRepliesByCommentId=async(e,n,i,o,r,s=10)=>{const l=s||10,d={operationName:"CommentById",query:a.repliesByCommentId,variables:{replyLimit:l,after:n,orderBy:"CREATED_AT_DESC",commentId:e}};try{const n=await(0,t.requestGraphService)(i,d,r),{pageInfo:{hasNextPage:a=!1,endCursor:o=null}={},nodes:s=[]}=n?.coralcomment?.replies??{};return{commentId:e,replies:s,page:{hasNextPage:a,endCursor:o}}}catch(t){return o.warn(`Error making GQL request in getRepliesByCommentId: ${t.message}`),{commentId:e,replies:[],page:{hasNextPage:!1,endCursor:""}}}},t.getStoryCommentsCount=async(e,n,i)=>{const o={operationName:"Story",query:a.storyCommentsCount,variables:{id:e}};let r=null;try{const e=await(0,t.requestGraphService)(n,o),{totalPrimaryCommentsCount:a=null}=e?.story||"";r=a}catch(e){i.warn(`Error making GQL request in storyCommentsCount: ${e.message}`)}return r},t.storyExists=async(e,n,i)=>{const o={operationName:"Story",query:a.checkStory,variables:{id:e}};let r;try{r=await(0,t.requestGraphService)(n,o)}catch(e){i.warn(`Error making GQL request in storyExists: ${e.message}`)}return r},t.addDataStory=async(e,n,i,o,r)=>{const s={clientMutationId:"0",story:{id:e,siteID:n,metadata:i}},l={operationName:"createStory",query:a.addStory,variables:{inp:s}};let d=null;try{d=await(0,t.requestGraphService)(o,l)}catch(e){r.warn(`Error making GQL request in addDataStory: ${e.message}`)}return d},t.addReply=async(e,n)=>{const i={operationName:"createReply",query:a.createReply,variables:{input:n}};let o;try{o=await(0,t.requestGraphService)(e,i)}catch(e){throw console.warn(e),new Error(e)}return o},t.addReview=async(e,n,i,o)=>{const r={operationName:"addReview",query:a.createUserComment,variables:{input:e,coralUserID:n}};let s=null;try{s=await(0,t.requestGraphService)(i,r)}catch(e){throw o.warn(`Error making GQL request in addReview: ${e.message}`),new Error(e)}return s},t.getDataReviews=async({entityId:e,commentingUrl:n,logger:i,reviewLimit:o,accessToken:r,defaultSort:s,replyLimit:l})=>{let d={reviews:[],page:{hasNextPage:!1,endCursor:""}},c=0,m=0;try{if(n){const p={operationName:"storyRating",query:a.Ratings,variables:{storyId:e,ratingScale:5}},u=await(0,t.requestGraphService)(n,p);if(u){const{average:e,count:t}=u.storyRating;c=e,m=t}d=await(0,t.getComments)({entityId:e,after:null,commentingUrl:n,logger:i,reviewLimit:o,accessToken:r,defaultSort:s,replyLimit:l})}else i.warn(`Could not fetch reviews since the URL is not configured “${e}”`)}catch(a){200===a?.response?.status&&(d=await(0,t.getComments)({entityId:e,after:null,commentingUrl:n,logger:i,reviewLimit:o,accessToken:r,defaultSort:s}))}return{...d,average:c,ratingsCount:m}},t.validateAndAddStory=async({entityId:e,commentingUrl:n,organizationId:a,metadata:i,workflowContext:o})=>{let r=null;try{if(n)try{const s=await(0,t.storyExists)(e,n,o.logger);s&&s.story||(r=await(0,t.addDataStory)(e,a,i,n,o.logger))}catch(e){o.logger.warn(e)}else o.logger.warn(`Could not validateAndAddStory for “${e} since URL was not configured”`)}catch(t){o.logger.warn(`Could not validateAndAddStory for “${e}”`,t)}return r}},76497:e=>{e.exports={getUsername:"\n query getSiteUsername($authorID: String!, $siteID: String) {\n siteUsername(authorID: $authorID, siteID: $siteID) {\n id\n name\n tenantID\n authorID\n }\n }\n",createUsername:"\n mutation createUsername($input: CreateSiteUsernameInput!) {\n createSiteUsername(input: $input) {\n siteUsername {\n name\n siteID\n }\n }\n }\n",updateUsername:"\n mutation updateSiteUsername($input: UpdateSiteUsernameInput!) {\n updateSiteUsername(input: $input) {\n siteUsername {\n name\n siteID\n }\n }\n }\n"}},67116:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validate=t.createNewUsername=t.checkUsername=t.requestGraphService=void 0;const a=n(76497),i=n(16075),{GraphQLClient:o}=n(96497),{getCookie:r}=n(56892),s=n(53788).default,{oidcCookies:l}=s;t.requestGraphService=(e,t)=>{const n=r(l.access),a=new o(e),{query:i,variables:s}=t,d={"Access-Control-Request-Method":"POST","Access-Control-Request-Headers":"Content-Type","Content-Type":"application/json","User-Agent":"verso-client",Authorization:`Bearer ${n}`};return a.request(i,s,d)},t.checkUsername=async(e,n,i)=>{const o={operationName:"getSiteUsername",query:a.getUsername,variables:{authorID:e,siteID:n}};let r;try{const e=await(0,t.requestGraphService)(i,o);r=0===e?.siteUsername?.length?null:e&&e.siteUsername[0]?.name}catch(e){console.log(`Error making GQL request in checkUsername: ${e.message}`)}return r},t.createNewUsername=async(e,n)=>{const{name:i,organizationId:o,userId:r,url:s,action:l}=e,d={siteUsername:{name:i,siteID:o,authorID:r},clientMutationId:"0"},c={operationName:"UPDATE"===l?"updateSiteUsername":"createSiteUsername",query:"UPDATE"===l?a.updateUsername:a.createUsername,variables:{input:d}};try{const e=await(0,t.requestGraphService)(s,c);return e&&e["UPDATE"===l?"updateSiteUsername":"createSiteUsername"]?.siteUsername?.name}catch(e){let t;throw(null===e.response?.data&&"InternalDevelopmentError: user or username already exists"===e.response?.errors[0]?.message||"InternalDevelopmentError: Duplicate Brand Username"===e.response?.errors[0]?.message)&&(t="already_taken"),n.warn(`Error making GQL request in createNewUsername: ${e?.response?.errors[0]?.message}`),new Error(t)}},t.validate=(e,t)=>{const{minLength:n,maxLength:a}=t,o=i.string().min(n).max(a).required(),r=i.string().regex(/^[a-zA-Z0-9_]+$/).required();return o.validate(e).error?"lengthError":r.validate(e).error?"specialCharError":null}}}]);