{"version":3,"file":"HideEmptySections.DBcaJrRF.mjs","names":[],"sources":["https:/framerusercontent.com/modules/dJHCjshbhdGzaKSkV3rA/aFhVfUWg5YdFNpbYZHAZ/HideEmptySections.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";// The Merch & Packaging overview has no gallery and no credits of its own, but\n// the shared Images and Details sections still render as empty strips (20px and\n// 16px). Their common parent is a flex column with a 40px gap, so each empty\n// strip also costs an extra 40px — about 156px of dead space between the\n// description and the tiles where only 40px was intended.\n//\n// The proper fix is to add this project's slug to the shared visibility list on\n// those sections, but Framer's current DSL validator refuses to write it (it\n// demands a `collectionreference` input, even though the stored value is a\n// plain string and was written this way originally). `framer.setAttributes`\n// silently no-ops on it too. So the empty siblings are collapsed at runtime.\n//\n// This override is attached to the Merch & Packaging chooser row, which is\n// gated to that one slug — so it only ever runs on that page, and no other\n// project's Images or Details section is affected.\nconst CLASS=\"sm-mp-choices\";const MAX_EMPTY_HEIGHT=40;export function withHideEmptySections(Component){return props=>{useEffect(()=>{const el=document.querySelector(`.${CLASS}`);const parent=el?.parentElement;if(!el||!parent)return;for(const node of Array.from(parent.children)){if(node===el)continue;const sib=node;// Only collapse siblings that are genuinely empty: no media, no\n// text, and too short to be real content. The description and\n// the tile row both fail this test and are left alone.\nconst hasMedia=sib.querySelector(\"img, iframe, video, svg\");const hasText=(sib.innerText||\"\").trim().length>0;const h=sib.offsetHeight;if(!hasMedia&&!hasText&&h>0&&h<MAX_EMPTY_HEIGHT){sib.style.display=\"none\";}}},[]);return /*#__PURE__*/_jsx(Component,{...props,className:[props.className,CLASS].filter(Boolean).join(\" \")});};}// ---------------------------------------------------------------------------\n// The shared Videos container sits at the top of the Images section on every\n// project page, and each of its four Vimeo slots is individually gated on its\n// own CMS URL field. On a page with no video at all the container collapses to\n// 0px height — but it is still a flex child, so it keeps consuming the Images\n// section's 20px gap. That left dead space between the nav and the first photo\n// on every chapter page without a video.\n//\n// A CMS gate cannot express this: it would have to be \"any of these four\n// fields is set\", and a visibility transform only reads one variable (gating\n// on Hero Video alone would hide the Analog Mindset page's vertical video).\n//\n// So the rule is declarative CSS instead of a measurement pass: `:has()` means\n// the container hides exactly when it holds no player, and re-shows by itself\n// if a player mounts later — no timing assumptions, nothing to re-run.\nconst CLASS_VIDEOS=\"sm-videos-slot\";const VIDEOS_STYLE_ID=\"sm-empty-videos-style\";export function withHideEmptyVideos(Component){return props=>{useEffect(()=>{if(document.getElementById(VIDEOS_STYLE_ID))return;const style=document.createElement(\"style\");style.id=VIDEOS_STYLE_ID;style.textContent=`\n                .${CLASS_VIDEOS}:not(:has(iframe)):not(:has(video)) {\n                    display: none !important;\n                }\n            `;document.head.appendChild(style);},[]);return /*#__PURE__*/_jsx(Component,{...props,className:[props.className,CLASS_VIDEOS].filter(Boolean).join(\" \")});};}// ---------------------------------------------------------------------------\n// Framer emits link hrefs as relative paths (`./projects-page/going-places`).\n// Those resolve correctly only while the document's base URL is right. On iOS\n// Safari — ~95% of this site's traffic, largely through Instagram's in-app\n// browser — the base sometimes goes stale, and the same href then resolves two\n// different wrong ways:\n//\n//     /projects-page/projects-page/<slug>   base kept a stale project path\n//     /<slug>                               base collapsed to the site root\n//\n// Both are hard 404s the moment they leave the SPA: open-in-new-tab, copy\n// link, share, or a refresh. Analytics recorded 106 doubled clicks from 66 iOS\n// visitors in one week (and zero from Android or desktop), plus a collapsed\n// `/sneakerbox-apparel`. In-app the router was absorbing them, so nobody had\n// hit a 404 yet — this closes the hole before someone shares one.\n//\n// The fix rewrites both shapes back to the canonical `/projects-page/<slug>`\n// and stores the corrected value on the anchor, so the click and a copied link\n// are both right. It runs on mount, after history navigation, and in the\n// capture phase of a click so the router reads the corrected href.\nconst PROJECT_SLUGS=new Set([\"adish-suicoke\",\"community\",\"community-blanc\",\"community-pollex\",\"cover-art\",\"going-places\",\"going-places-records\",\"gp-1st\",\"gp-analog\",\"gp-anniversary\",\"gp-aroke\",\"gp-campaigns\",\"gp-geepees\",\"gp-gpverse\",\"gp-insidejob\",\"gp-solopack2\",\"gp-summer22\",\"gps\",\"lcs-hummus\",\"lcs-kilim\",\"lcs-sherut\",\"le-coq-sportif\",\"mayorgov\",\"merch-packaging\",\"mp-hod\",\"mp-jlamotta\",\"mp-merch\",\"mp-packaging\",\"mp-rovr\",\"mp-rumpy\",\"mp-zephyr\",\"music-graphics\",\"naot\",\"naot-aviv\",\"naot-sagie\",\"posters\",\"runatics\",\"sneakerbox\",\"sneakerbox-apparel\",\"sneakerbox-graphics\"]);const PROJECT_PREFIX=\"/projects-page/\";const DOUBLED=\"/projects-page/projects-page/\";const TAP_STYLE_ID=\"sm-link-guard-style\";// Returns the corrected pathname, or null when it is already correct.\nfunction canonicalPath(pathname){let p=pathname;while(p.indexOf(DOUBLED)!==-1)p=p.replace(DOUBLED,PROJECT_PREFIX);const bare=p.replace(/^\\//,\"\").replace(/\\/$/,\"\");if(PROJECT_SLUGS.has(bare))p=PROJECT_PREFIX+bare;return p===pathname?null:p;}function fixAnchor(a){const raw=a.getAttribute(\"href\");if(!raw||raw.startsWith(\"#\")||raw.startsWith(\"mailto:\"))return;let u;try{u=new URL(a.href);}catch{return;}if(u.origin!==window.location.origin)return;// Freeze the href as an absolute path. Correct it first if the base URL\n// already led it astray; otherwise just pin the value that resolved\n// correctly on this load, so a later stale base cannot drift it — and a\n// copied or new-tab link is always the real URL.\nconst fixed=canonicalPath(u.pathname)??u.pathname;const next=fixed+u.search+u.hash;if(a.getAttribute(\"href\")!==next)a.setAttribute(\"href\",next);}function fixAllAnchors(){const list=document.querySelectorAll(\"a[href]\");for(const a of Array.from(list))fixAnchor(a);}export function withLinkGuard(Component){return props=>{useEffect(()=>{// Correct the anchor before the router's own handler reads it.\nconst onClick=e=>{const el=e.target;const a=el&&el.closest?el.closest(\"a[href]\"):null;if(a)fixAnchor(a);};document.addEventListener(\"click\",onClick,true);window.addEventListener(\"popstate\",fixAllAnchors);// The nav's MENU control is a 43x18 tap target; Apple's guideline\n// and WCAG 2.5.5 both want at least 44x44. A slightly low tap\n// misses it entirely, which is why the menu felt unreliable on a\n// phone. The hit area is extended with a pseudo-element so the\n// target grows without moving anything on screen.\nif(!document.getElementById(TAP_STYLE_ID)){const style=document.createElement(\"style\");style.id=TAP_STYLE_ID;style.textContent=`\n                    @media (max-width: 739.98px) {\n                        /* Widen the MENU tap target. The control's row is\n                           only 18px tall and clips, so the area can grow\n                           sideways but not vertically — unclipping the row to\n                           gain height exposes a theme toggle that the clip was\n                           hiding, so height needs fixing on the canvas, not\n                           here. Sideways still roughly doubles the area. */\n                        [data-framer-name=\"Menu open/close\"] {\n                            position: relative;\n                        }\n                        [data-framer-name=\"Menu open/close\"]::after {\n                            content: \"\";\n                            position: absolute;\n                            inset: 0 -16px 0 -34px;\n                        }\n                    }\n                `;document.head.appendChild(style);}fixAllAnchors();const id=window.setTimeout(fixAllAnchors,1200);return()=>{document.removeEventListener(\"click\",onClick,true);window.removeEventListener(\"popstate\",fixAllAnchors);window.clearTimeout(id);};},[]);return /*#__PURE__*/_jsx(Component,{...props});};}// ---------------------------------------------------------------------------\n// Image weight. Measured on an iPhone-sized viewport: the homepage shipped\n// 3.0 MB and the MERCH page 8.8 MB, almost all of it images. Two causes:\n//\n//  1. Every image carries sizes=\"100vw\", so the browser assumes it fills the\n//     screen and picks a large srcset candidate. A homepage tile that renders\n//     at 201 CSS px was being served an 815-wide, 294 KB file.\n//  2. Nothing lazy-loads, so all 45 images on MERCH arrive before the visitor\n//     has scrolled a pixel.\n//\n// The fix is loading behaviour only — no layout, no styling, no markup moves.\n// `sizes` is corrected to the element's real width so the browser can choose a\n// smaller candidate on its own, and where Framer offers nothing small enough\n// the URL's ?scale-down-to= is rewritten (the CDN honours any value: that same\n// tile is 325 KB at 1024 and 75 KB at 512).\n//\n// Two things this must not do:\n//  - Re-fetch. An image that already finished loading is left completely\n//    alone; rewriting it would download it a second time and make things\n//    worse. Only images that have not started are touched.\n//  - Blur the lightbox. Anything inside the lightbox overlay is skipped, and\n//    Lightbox.tsx strips scale-down-to and asks for 2048 regardless, so\n//    tapping an image still opens it at full quality.\nconst LIGHTBOX_OVERLAY_ID=\"sm-lightbox-overlay\";const EDGE_STEP=128// round the request up to a tidy step\n;const MIN_EDGE=384// never ask for something tiny\n;const OVERSIZE_TOLERANCE=1.4// leave it alone unless meaningfully too big\n;const PERF_FLAG=\"smPerf\"// dataset marker so each image is handled once\n;function neededEdge(cssWidth){const dpr=Math.min(window.devicePixelRatio||1,2);const need=Math.ceil(cssWidth*dpr);return Math.max(MIN_EDGE,Math.ceil(need/EDGE_STEP)*EDGE_STEP);}function servedEdge(url){const m=url.match(/scale-down-to=(\\d+)/);return m?parseInt(m[1],10):null;}function tuneImage(img){if(img.dataset[PERF_FLAG])return;if(img.closest(\"#\"+LIGHTBOX_OVERLAY_ID))return;const src=img.getAttribute(\"src\")||\"\";if(!src.includes(\"framerusercontent.com\"))return;// Already downloaded — touching it now would fetch a second copy.\nif(img.complete&&img.naturalWidth>0)return;const rect=img.getBoundingClientRect();const width=rect.width||img.clientWidth;if(!width)return;// not laid out yet; a later pass will catch it\nimg.dataset[PERF_FLAG]=\"1\";// Below the first screen? Let the browser defer it.\nif(rect.top>window.innerHeight*1.25)img.loading=\"lazy\";// Tell the browser the truth about how wide this renders, so it can pick\n// a smaller candidate from the srcset by itself.\nconst want=neededEdge(width);img.sizes=Math.ceil(width)+\"px\";// If even the served size is far larger than needed, ask the CDN directly.\nconst have=servedEdge(img.currentSrc||src);if(have&&have>want*OVERSIZE_TOLERANCE){const next=src.includes(\"scale-down-to=\")?src.replace(/scale-down-to=\\d+/,\"scale-down-to=\"+want):src+(src.includes(\"?\")?\"&\":\"?\")+\"scale-down-to=\"+want;img.removeAttribute(\"srcset\")// otherwise srcset wins over src\n;img.setAttribute(\"src\",next);}}function tuneAll(){const list=document.querySelectorAll(\"img\");for(const img of Array.from(list))tuneImage(img);}export function withImagePerf(Component){return props=>{useEffect(()=>{tuneAll();// Framer mounts images progressively, so catch them as they appear\n// — before the browser has begun fetching, which is the only point\n// where changing the request is free.\nconst mo=new MutationObserver(records=>{for(const rec of records){for(const node of Array.from(rec.addedNodes)){if(!(node instanceof HTMLElement))continue;if(node.tagName===\"IMG\")tuneImage(node);else node.querySelectorAll?.(\"img\").forEach(tuneImage);}}});mo.observe(document.documentElement,{childList:true,subtree:true});const onResize=()=>tuneAll();window.addEventListener(\"resize\",onResize);return()=>{mo.disconnect();window.removeEventListener(\"resize\",onResize);};},[]);return /*#__PURE__*/_jsx(Component,{...props});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withHideEmptySections\":{\"type\":\"reactHoc\",\"name\":\"withHideEmptySections\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withLinkGuard\":{\"type\":\"reactHoc\",\"name\":\"withLinkGuard\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHideEmptyVideos\":{\"type\":\"reactHoc\",\"name\":\"withHideEmptyVideos\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withImagePerf\":{\"type\":\"reactHoc\",\"name\":\"withImagePerf\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HideEmptySections.map"],"mappings":"2HAesD,SAAgB,EAAsB,EAAU,CAAC,MAAO,KAAQ,MAAc,CAAC,IAAM,EAAG,SAAS,cAAc,IAAI,GAAO,EAAQ,EAAO,GAAI,cAAiB,MAAC,GAAI,CAAC,GAAc,IAAI,IAAM,KAAQ,MAAM,KAAK,EAAO,QAAQ,EAAE,CAAC,GAAG,IAAO,EAAG,SAAS,IAAM,EAAI,EAGjT,EAAS,EAAI,cAAc,yBAAyB,EAAQ,GAAS,EAAI,WAAW,GAAA,CAAI,KAAK,CAAC,CAAC,OAAO,EAAQ,EAAE,EAAI,aAAgB,CAAC,GAAU,CAAC,GAAS,EAAE,GAAG,EAAE,IAAkB,EAAI,MAAM,QAAQ,OAAQ,CAAC,EAAE,CAAC,CAAC,EAAsB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