{"version":3,"file":"RowMenu.CsL2wlGF.mjs","names":["React.useState","React.useMemo","_Fragment","Popover.Root","Popover.Trigger","Popover.Portal","Popover.Content"],"sources":["https:/framerusercontent.com/modules/jUfrK8MfKpQBn73ZLkel/2ZHj3m0EHPX42SKjrlpN/RowMenu.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import*as React from\"react\";// Same specifier as SoundeePopover on purpose: two spellings of the same\n// package resolve to two module instances.\nimport{AnimatePresence,motion}from\"framer-motion\";import*as Popover from\"https://esm.sh/@radix-ui/react-popover@1?external=react,react-dom\";import{SoundeeIcon}from\"https://framerusercontent.com/modules/jztQr8fR84sBOB7CCVtd/8766T8UA8RyZqWPXr9oV/icons.js\";import{SoundeeDialog}from\"https://framerusercontent.com/modules/O60C240xSqPv1FtQHfho/BNNTr9XGVYgx4a2QxMiB/SoundeeDialog.js\";import SoundeeChipList from\"https://framerusercontent.com/modules/PC57mgvaDV9A9sP8uwDw/HY0Vq8zZqPW3gy618EL5/SoundeeChipList.js\";import{HoverButton,tint}from\"https://framerusercontent.com/modules/zp2tRJqH3ga0tv6J2W6H/pIeiwjQ1RSwN5Tc4srqa/hover_button.js\";import{menuItemHover,menuItemStyle}from\"https://framerusercontent.com/modules/BN0w3b2Q9pvHMH4QxWME/xMMhTsux80yfi1WGGuc8/SoundeeMenu.js\";import{resolveEntityActions}from\"https://framerusercontent.com/modules/y33CnMbsLsRpKYyVdkip/IIlWZNaRyUQLMp8a9N7A/entity_actions.js\";import{useCmsLinkTemplate,followCmsLink,useResolvedCmsHref}from\"https://framerusercontent.com/modules/W9fjsr5lFdL2bnlC2Asr/R91C0VuHCylhoauWeXKa/cms_link_slot.js\";import{resolveEntityUrlTemplates}from\"https://framerusercontent.com/modules/3k8Y3cHpFSqmVB6KTjnO/s65FUl5xx6pBzHU53VMb/entity_url.js\";import{useSoundeeConfig}from\"https://framerusercontent.com/modules/MnaOjDKPmXIgElrPjVea/ZQ1wYfs8GsvC6PAUJeGJ/config.js\";import{openSoundeeOverlay}from\"https://framerusercontent.com/modules/JWE25h6PrJ9N8RSe2d8l/tQb6fJhUfosOrDEfybJG/open_overlay.js\";import{hasSoundeeModals,useModalTheme}from\"https://framerusercontent.com/modules/0GpgGzS00VxJis3gSiB4/Be8F8psyG0Q4dWp72XOm/registry.js\";import{ROW_METRICS}from\"https://framerusercontent.com/modules/8841CNm8EKjvZRVrjFfe/5lsDQvs24cfQFIpryahc/tokens.js\";// The row already has its own Add To Cart and Like affordances; repeating them\n// in the menu would give two controls for the same thing.\nconst MENU_ACTION_TYPES=[\"viewDetails\",\"share\",\"download\"];export function RowMenu({track,tokens,subtitleTypes,titleGap,liked,onToggleLike,isCanvas,isMobile,trigger}){const[open,setOpen]=React.useState(false);const cfg=useSoundeeConfig();const modalTheme=useModalTheme();// Every floating panel on the page is styled from one place. This menu is\n// a popover on desktop and a sheet on mobile, and the sheet was already\n// drawing itself from SoundeeModals through SoundeeDialog — so the popover\n// taking its surface from the track row meant the same menu looked like the\n// row on one breakpoint and like the modals on the other.\n//\n// The row's own tokens remain the fallback: nothing here should stop\n// working on a page where no SoundeeModals was placed.\nconst modals=hasSoundeeModals();const menu=React.useMemo(()=>({surface:modals?modalTheme.surface:tokens.menuSurface,border:modals?modalTheme.border:tokens.border,radius:modals?modalTheme.radius:tokens.radius,accent:modals?modalTheme.accent:tokens.accent,textPrimary:modals?modalTheme.textPrimary:tokens.textPrimary,textSecondary:modals?modalTheme.textSecondary:tokens.textSecondary,fontTitle:modals?modalTheme.fontTitle:tokens.fontTitle,fontBody:modals?modalTheme.fontBody:tokens.fontMeta}),[modals,modalTheme,tokens]);const templates=React.useMemo(()=>resolveEntityUrlTemplates(null,cfg.urlTemplates),[cfg.urlTemplates]);// Reuses the shared action resolver rather than restating the rules here —\n// it already knows Demo Download only applies when `canDemoDownload`, and\n// which actions make sense per entity type.\nconst cmsHref=useResolvedCmsHref(track.entityId);const hasCmsLinks=!!useCmsLinkTemplate();const actions=React.useMemo(()=>{return resolveEntityActions({entity:track,entityId:track.entityId,templates,detailsHref:cmsHref,isLiked:liked,origin:typeof window===\"undefined\"?undefined:window.location.origin}).filter(action=>MENU_ACTION_TYPES.includes(action.type))// Share needs somewhere to point. When this store links to CMS\n// pages, an item that has none has nothing to share, and offering\n// it is a dead end — a sync covers a subset of a catalogue, and a\n// track added an hour ago is in none of it.\n//\n// Only when a link component is actually placed: without one\n// nothing resolves an address here, and hiding on that basis would\n// take Share off every site that does not use it. Both values come\n// from hooks, so the menu re-renders when an address lands rather\n// than answering from whatever was known at first paint.\n.filter(action=>action.type!==\"share\"||!hasCmsLinks||!!cmsHref)// View Details needs a page that exists, and the only thing that\n// knows one does is the link component that found it. The url\n// templates behind this action have defaults — `/tracks/{slug}` and\n// the rest — so without this it offers a confident link to a page\n// nobody built, for every item a sync has not reached.\n//\n// Unconditional, unlike Share: a store with no link component has\n// no detail pages to point at, and a guessed address is worse than\n// no menu row.\n.filter(action=>action.type!==\"viewDetails\"||!!cmsHref);},[track,templates,liked,hasCmsLinks,cmsHref]);function runAction(action){if(isCanvas)return;if(action.href){// Through Framer's router when the link component has an anchor\n// standing by, which is a route change rather than a reload of the\n// whole site. The address is the fallback, not the first choice.\nif(!followCmsLink(track.entityId)){window.location.href=action.href;}}else if(action.modalName){openSoundeeOverlay({name:action.modalName,withEntity:true,entityId:track.entityId});}if(action.closeOnAction!==false)setOpen(false);}// Shared with the account menu, which draws the same rows. This is where\n// both copies used to be, until there were two.\nconst itemStyle=menuItemStyle(menu,isMobile);const itemHover=menuItemHover(menu);const panelStyle={border:`1px solid ${menu.border}`,// Opaque, not the translucent row surface: a menu floating over content\n// needs to be readable, and the row token is deliberately near-clear.\nbackground:menu.surface,overflow:\"hidden\"};const panel=/*#__PURE__*/_jsxs(_Fragment,{children:[isMobile&&/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",alignItems:\"center\",gap:14,padding:\"6px 18px 18px\",borderBottom:`1px solid ${menu.border}`},children:[/*#__PURE__*/_jsx(\"div\",{style:{width:52,height:52,flexShrink:0,borderRadius:Math.min(menu.radius,10),overflow:\"hidden\",background:track.artworkColor||menu.border},children:track.artworkUrlSmall&&/*#__PURE__*/_jsx(\"img\",{src:track.artworkUrlSmall,alt:\"\",loading:\"lazy\",style:{width:\"100%\",height:\"100%\",objectFit:\"cover\",display:\"block\"}})}),/*#__PURE__*/_jsxs(\"div\",{style:{flex:1,minWidth:0,display:\"flex\",flexDirection:\"column\",gap:titleGap},children:[/*#__PURE__*/_jsx(\"div\",{style:{color:menu.textPrimary,overflow:\"hidden\",textOverflow:\"ellipsis\",whiteSpace:\"nowrap\",...menu.fontTitle},children:track.title}),subtitleTypes.length>0&&/*#__PURE__*/_jsx(SoundeeChipList,{entityID:track.entityId,chipTypes:subtitleTypes,// Same configuration as the row's subtitle,\n// so the same track doesn't read differently\n// in the menu than in the list.\nitemLimit:\"auto\",maxChips:8,showRemaining:false,truncate:true,gap:4,textStyle:{font:menu.fontBody,color:menu.textSecondary,separator:\",\"}})]}),/*#__PURE__*/_jsx(HoverButton,{onClick:onToggleLike,\"aria-label\":liked?\"Unlike\":\"Like\",\"aria-pressed\":liked,hoverStyle:{background:tint(menu.accent,12),color:menu.accent},style:{display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",width:36,height:36,flexShrink:0,border:\"none\",background:\"transparent\",borderRadius:999,color:liked?menu.accent:menu.textSecondary,cursor:\"pointer\"},children:/*#__PURE__*/_jsx(SoundeeIcon,{name:\"heart\",size:20,filled:liked})})]}),/*#__PURE__*/_jsx(\"div\",{style:{padding:isMobile?\"6px 0 10px\":\"6px\",display:\"flex\",flexDirection:\"column\",// A hairline, so two rows never merge while one is\n// held down.\ngap:1},children:actions.map(action=>/*#__PURE__*/_jsx(HoverButton,{onClick:()=>runAction(action),disabled:action.disabled,hoverStyle:itemHover,style:{...itemStyle,opacity:action.disabled?.4:1,cursor:action.disabled?\"not-allowed\":\"pointer\"},children:action.type===\"download\"?\"Demo Download\":action.label},action.type))})]});// Same `Row Layout` the row itself uses, rather than a media query: one\n// source of truth, set per Framer breakpoint, and no server render that\n// guesses the wrong variant and corrects after hydration.\nif(isMobile){// Reuses the shared dialog rather than a second sheet implementation:\n// exit animation, focus trap and scroll lock then behave identically to\n// the license picker, and there is one place to fix them.\nreturn /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"span\",{onClick:()=>!isCanvas&&setOpen(true),children:trigger}),/*#__PURE__*/_jsx(SoundeeDialog,{open:open,onOpenChange:setOpen,theme:modalTheme,sheet:true,label:track.title,children:panel})]});}return /*#__PURE__*/_jsxs(Popover.Root,{open:open,onOpenChange:isCanvas?undefined:setOpen,children:[/*#__PURE__*/_jsx(Popover.Trigger,{asChild:true,children:trigger}),/*#__PURE__*/_jsx(AnimatePresence,{children:open&&/*#__PURE__*/_jsx(Popover.Portal,{forceMount:true,children:/*#__PURE__*/_jsx(Popover.Content,{asChild:true,forceMount:true,align:\"end\",sideOffset:8,collisionPadding:12,onOpenAutoFocus:event=>event.preventDefault(),children:/*#__PURE__*/_jsx(motion.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:modalTheme.transition,style:{...panelStyle,zIndex:9999,// Hugs its labels. They are identical on\n// every track now that the header is gone,\n// so there is nothing left to resize\n// between one row and the next.\nwidth:\"max-content\",minWidth:ROW_METRICS.menuMinWidth,borderRadius:menu.radius,boxShadow:\"0 18px 48px rgba(0,0,0,0.45)\"},children:panel})})})})]});}\nexport const __FramerMetadata__ = {\"exports\":{\"RowMenu\":{\"type\":\"reactComponent\",\"name\":\"RowMenu\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],"mappings":"iiBAI2D,SAAgB,EAAQ,CAAC,QAAM,SAAO,gBAAc,WAAS,QAAM,eAAa,WAAS,WAAS,WAAS,CAAC,GAAK,CAAC,EAAK,GAASA,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