import{n as e,o as t,r as n}from"./_BCiCTKAo.js";import{Al as r,Ao as i,Bc as a,Br as o,Co as s,Ds as c,Es as l,Fr as u,Il as d,Ir as f,Jc as p,Lc as m,Lr as h,Ms as g,Na as _,Pa as v,Rr as y,Su as b,Uo as x,Vc as S,Wc as C,Wo as w,Xc as ee,Yc as te,_u as ne,bu as T,js as re,ko as E,ks as D,mc as O,xs as k,zr as A}from"./_V8uKgtty.js";import{Xi as j,Yi as M,ft as N,pt as P}from"./_Cr0VpRFs.js";import{n as ie,t as ae}from"./_8VdrAs0H.js";var F;function I(){return(I=e((()=>{P(),g(),c(),F=class extends re{onCreate(e){let{listings:t=[]}=e;this.state={items:[...t]}}onInput(e){let{listings:t=[],title:n,discoveryCMSOptions:r,trackableModuleId:i}=e,{logger:a,siteURLOrigin:o=`https://www.ebay.com`}=r;return this.state.items=[...t],t.length===0?(a({tags:[`info`,`dp-resell-carousel-empty`],message:JSON.stringify({message:`Resell carousel not rendered due to empty items`,moduleId:i,templateId:r.template.id,title:n})}),{...e,shouldShow:!1,siteURLOrigin:o}):{...e,shouldShow:!0,siteURLOrigin:o}}get viewport(){return l(this.input.trackableId)}handleClick(e){D(e,this.input.trackableModuleId,this.input.trackableId,this.input.discoveryCMSOptions)}handleMenuItemClick(e){let t=e.data;e.key===`DISMISS`&&this.dismissItem(t.resellLikeItemId)}log(e,t){if(!this.input)return;let{discoveryCMSOptions:n,title:r,trackableModuleId:i}=this.input,{logger:a}=n;a?.({tags:e,message:JSON.stringify({message:t,moduleId:i,templateId:n.template.id,title:r})})}async dismissItem(e){let{discoveryCMSOptions:t}=this.input,{logger:n,gql:r}=t,i=r?.fgqlClient;if(this.state.items=this.state.items.filter(t=>t.resellLikeItemId!==e),!i)this.log([`error`,`dp-resell-carousel-no-fgql-client`],`Missing fgqlClient`);else if(!e)this.log([`error`,`dp-resell-carousel-no-listingId`],`Missing listingItemId for dismiss action`);else try{let t=await N({client:i,logger:n,params:{items:[{itemId:e}]}});t?.error?this.log([`error`,`dp-resell-carousel-mutation-error`],t.error.message||`Failed to dismiss recommendation`):this.log([`info`,`dp-resell-carousel-dismiss-success`],`Successfully dismissed item: ${e}`)}catch(e){this.log([`error`,`dp-resell-carousel-unknown-error`],e.message||`Failed to dismiss recommendation`)}}}})))()}var L=n({default:()=>Z}),R,z,B,V,H,U,W,G,K,q,J,Y,X,Z,Q;function $(){return($=e((()=>{R=ne(),z=p(),B=t(s()),y(),w(),c(),d(),ie(),i(),V=t(S()),v(),H=t(a()),f(),U=m(),W=t(O()),j(),G=t(C()),o(),K=t(T()),I(),q=t(ee()),J=te(),Y=t(b()),X=`xe`,Z=(0,R.t)(X),(0,J.r)(X,()=>Z),Q=F,Z._=(0,q.default)(function(e,t,n,i,a,o){let{discoveryCMSOptions:s,trackableModuleId:c,trackableId:l,inputClasses:d={},class:f,shouldShow:p,siteURLOrigin:m}=e,g=a.items,v={resell:(0,z.t)(`components/dp-resell-carousel-module`,`resell`),seeAll:(0,z.t)(`components/dp-resell-carousel-module`,`seeAll`),orSellSomethingElse:(0,z.t)(`components/dp-resell-carousel-module`,`orSellSomethingElse`),createListing:(0,z.t)(`components/dp-resell-carousel-module`,`createListing`),readyToResell:(0,z.t)(`components/dp-resell-carousel-module`,`readyToResell`),dismiss:(0,z.t)(`components/dp-resell-carousel-module`,`dismiss`),nudgeText:(0,z.t)(`components/dp-resell-carousel-module`,`nudgeText`)},y=g?.length>=3?{text:v.seeAll,url:`${m}/mye/myebay/purchase`}:null,b=s.features?.public?.resellCarouselNudgeRedesign??`disabled`,S={title:b===`disabled`?v.orSellSomethingElse:v.nudgeText,linkText:v.createListing,url:`${m}/sl/prelist`},C=k(s.template?.pageImpressionId,c);function w(e,{title:t,linkText:r}){e.be(`div`,{class:`w-[16px] h-[16px]`,style:`margin-top: -2px`},`1`,i,null,1),(0,V.default)(E,{iconName:`EVO_LIGHTBULB`,size:`16`,discoveryCMSOptions:s},e,n,`2`),e.ee(),e.be(`div`,{class:`flex-1 hp-md:flex hp-md:justify-between hp-md:items-center`},`3`,i,null,1),e.be(`div`,{class:`text-[14px] text-[#191919] font-normal leading-[20px] tracking-[0]`,style:`font-family: var(--Family-Market-Sans, 'Market Sans')`},`4`,i,null,1),e.t(t,i),e.ee(),b===`disabled`&&(e.be(`span`,{class:`text-[14px] text-[#191919] font-semibold leading-[20px] tracking-[0] create-listing-link-text`,style:`font-family: var(--Family-Market-Sans, 'Market Sans'); text-decoration-line: underline; text-decoration-style: solid; text-decoration-skip-ink: auto; text-decoration-thickness: auto; text-underline-offset: auto; text-underline-position: from-font`},`5`,i,null,1),e.t(r,i),e.ee()),e.ee()}if(p&&g.length>0){t.be(`section`,(0,H.default)({role:`feed`,"aria-labelledby":n.elId(`title`),class:(0,K.default)([`flex flex-col gap-200 page-grid-container`,d.container,f])},B.default.viewAttributes(i.viewport)),`6`,i,null,4),t.be(`div`,{class:`flex flex-col gap-50`},`7`,i,null,1),t.be(`div`,{class:`flex items-center justify-between`},`8`,i,null,1),t.be(`h2`,{id:n.elId(`title`),class:`text-lg font-weight-bold text-primary m-0`},`9`,i,null,1),t.t(v.readyToResell,i),t.ee(),b!==`positionAbove`&&y&&(0,V.default)(_,{class:`text-primary underline hover:text-secondary see-all-link visited:text-primary`,inputHref:y.url,discoveryCMSOptions:s,...C({linkId:r.RESELL_ITEM}),renderBody:e=>{e.t(y.text,i)}},t,n,`10`),t.ee(),b===`positionAbove`&&(t.be(`div`,{class:`flex items-center justify-between`},`11`,i,null,1),t.be(`div`,{class:`text-body text-primary line-clamp-2`},`12`,i,null,1),t.t(S.title,i),t.ee(),y&&(0,V.default)(_,{class:`text-primary underline hover:text-secondary see-all-link visited:text-primary`,inputHref:y.url,discoveryCMSOptions:s,...C({linkId:r.RESELL_ITEM}),renderBody:e=>{e.t(y.text,i)}},t,n,`13`),t.ee()),t.ee(),t.be(`div`,{class:`dp-resell-carousel-module__wrapper`},`14`,i,null,1),t.be(`div`,{class:`dp-resell-carousel-module__container`},`15`,i,null,1);function e(e,{itemsPerSlide:t}){(0,V.default)(M,(0,U.i)(()=>{let e=0;for(let t of(0,W.default)(g)){let a=e++,o=`[${`@${t.resellLikeItemId}-${a}`}]`;(0,U.a)(`item`,{renderBody:e=>{e.be(`div`,{class:`relative flex flex-col flex-1`},`@${t.resellLikeItemId}`,i,null,1),(0,V.default)(_,{class:`flex items-center h-full p-150 rounded-100 border-1 border-solid bg-background-primary overflow-hidden hover:shadow-200 transition-shadow duration-200 gap-150 w-full cursor-pointer no-underline resell-tile`,style:`border-color: #E5E5E5; text-decoration: none; color: inherit;`,onClick:e=>i.handleClick(r.RESELL_ITEM),inputHref:ae(t,m),discoveryCMSOptions:s,...C({linkId:r.RESELL_ITEM}),renderBody:e=>{e.be(`div`,{class:`relative overflow-hidden rounded-100 shrink-0 w-[99px] h-[99px]`,style:`background: radial-gradient(50% 50% at 50% 50%, rgb(0 0 0 / 0%) 52.08%, rgb(0 0 0 / 3%) 100%)`},`19`+o,i,null,1),e.e(`img`,(0,H.default)({alt:t.title,class:`w-full h-full object-cover rounded-100`,src:t.image.url},x(t.image.url,`thumb`,s)),`20`+o,i,0,4),e.ee(),e.be(`div`,{class:`flex flex-col justify-between flex-1 overflow-hidden min-w-0 max-w-full`},`21`+o,i,null,1),e.be(`div`,{class:`text-[14px] text-[#191919] font-normal leading-[20px] line-clamp-2 mb-200 break-words max-w-full tracking-[0]`,style:`white-space: normal; font-feature-settings: 'liga' off, 'clig' off; font-family: var(--Family-Market-Sans, 'Market Sans'); min-height: calc(2em * var(--font-line-height-default))`},`22`+o,i,null,1),e.t(t.title,i),e.ee(),e.be(`div`,{class:`flex justify-start`},`23`+o,i,null,1),e.be(`span`,{class:`inline-flex items-center justify-center font-weight-bold text-sm cursor-pointer no-underline resell-btn`,style:`padding: 8px 16px; border-radius: var(--Radius-Full, 48px); background: var(--Background-Accent, #0968F6) !important; color: white !important; text-decoration: none; width: auto`},`24`+o,i,null,1),e.t(v.resell,i),e.ee(),e.ee(),e.ee()}},e,n,`18`+o),(0,V.default)(u,{class:[`absolute right-[12px] bottom-[18px]`],options:[h(`DISMISS`,v.dismiss,{icon:`EVO_CLOSE`,linkId:r.RESELL_CAROUSEL_ITEM_DISMISS,data:t})],discoveryCMSOptions:s,trackableId:l,trackingContext:{parentModuleId:c??void 0},kebabLinkId:r.RESELL_CAROUSEL_KEBAB},e,n,`25`+o,[[`item-click`,`handleMenuItemClick`,!1]]),e.ee()}})}},{itemsPerSlide:t,class:`m-0 mt-200 mb-0`,gap:12,mask:!1}),e,n,`17`)}(0,V.default)(A,(0,U.i)(()=>{(0,U.a)(`sm`,{renderBody:t=>{(0,G.default)(t,e,()=>({itemsPerSlide:1}),null,null,null,n,`27`)}}),(0,U.a)(`md`,{renderBody:t=>{(0,G.default)(t,e,()=>({itemsPerSlide:2}),null,null,null,n,`28`)}}),(0,U.a)(`lg`,{renderBody:t=>{(0,G.default)(t,e,()=>({itemsPerSlide:2}),null,null,null,n,`29`)}}),(0,U.a)(`xl`,{renderBody:t=>{(0,G.default)(t,e,()=>({itemsPerSlide:2}),null,null,null,n,`30`)}})}),t,n,`26`),t.ee(),t.ee(),b===`positionBelow`&&(t.be(`div`,{class:`flex items-start p-150 rounded-50 gap-[6px] no-underline create-listing-section`,style:`border-color: #E5E5E5; background: var(--Background-Secondary, #F7F7F7); text-decoration: none; color: inherit`},`31`,i,null,1),(0,G.default)(t,w,()=>({title:S.title,linkText:S.linkText}),null,null,null,n,`32`),t.ee()),b===`disabled`&&(0,V.default)(_,{class:`flex items-start p-150 rounded-50 gap-[6px] cursor-pointer hover:shadow-100 transition-shadow duration-200 no-underline create-listing-section`,style:`border-color: #E5E5E5; background: var(--Background-Secondary, #F7F7F7); text-decoration: none; color: inherit;`,onClick:e=>i.handleClick(r.RESELL_CREATE_LISTING),inputHref:S.url,discoveryCMSOptions:s,...C({linkId:r.RESELL_CREATE_LISTING}),renderBody:e=>{(0,G.default)(e,w,()=>({title:S.title,linkText:S.linkText}),null,null,null,n,`34`)}},t,n,`33`),t.ee()}},{t:X},Q),Z.Component=(0,Y.default)(Q,Z._)})))()}export{$ as n,L as t};