1import{c as w,C as N,c3 as C,h as _,j as t,Q as k,o as b,B}from"./index-878ce38c.js";import{r as s}from"./react-0e2a0c96.js";import{ah as R}from"./images-0c2231a1.js";import{u as D}from"./useBuyNow-6ec2c793.js";import{R as S}from"./RoleRadioGroup-8405c1a8.js";const O=({app:o,item:i,event:d,channel:c,isFlashSale:u})=>{const{t:m}=w(),f=N("md"),[n,x]=C("is_buy_now",!1),e=_(),[a,p]=s.useState(),h=D(!1),[g,y]=s.useState(()=>e.isDefault&&e.data.length>1),l=s.useCallback(()=>{p(void 0),y(!1),x(null)},[x]),r=s.useCallback((v=e.role)=>{i&&h({app:o,item:i,event:d,channel:c,role:v,isFlashSale:u})},[o,h,c,d,i,e.role,u]);return s.useEffect(()=>{n&&(e.data.length===1||!e.isDefault)&&(l(),window.queueMicrotask(()=>r()))},[l,n,r,e.data.length,e.isDefault]),t(k,{appear:!0,isOpen:g,yPosition:f?"center":"end",children:b("div",{className:"flex max-h-[60vh] flex-col overflow-hidden rounded-t-lg bg-bg-popup md:w-[400px] md:rounded-b-lg",children:[b("div",{className:"relative border-line px-4 max-md:border-b md:px-6",children:[t("button",{className:"absolute my-auto h-fit text-2xl transition-opacity hover:opacity-70 max-md:inset-y-0 max-md:start-4 md:end-3 md:top-3 md:text-[#A0A0A0]",onClick:l,"aria-label":"Close",children:t(R,{})}),t("div",{className:"py-4 text-center text-lg/none font-medium text-text-title md:py-6 md:text-xl/none md:font-bold",children:m("title__select_role")})]}),t("div",{className:"shrink overflow-y-auto md:px-6",children:t(S,{isBuyNow:!0,options:e.data,value:a,onChange:p})}),t("div",{className:"p-4 md:p-6",children:t(B,{fluid:!0,isDisabled:!a,onClick:()=>{e.setRole(a),window.gtag("event","msp.select-role",{appId:(o==null?void 0:o.app_id)||0}),l(),n&&r(a)},children:m("btn__confirm")})})]})},"".concat(f))};export{O as R};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.