{"version":3,"file":"GetTemplateBadge.uuqcHo-g.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/5hZgsOLGlM3F1NgBVm3d/rTsmy6y0Z9g7G9bGRgtD/GetTemplateBadge.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useRef,useState}from\"react\";/**\n * \"Get this template\" pill for Plainware preview sites.\n * It renders only on the template's own preview domain (for example aldrichmoving.framer.website). In a buyer's remix\n * the site runs on another domain, so the pill never shows there and needs no cleanup. Place the instance with a\n * The pill positions itself: fixed, bottom left, above the page. The Framer instance can stay in the layout flow.\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function GetTemplateBadge(props){const{label,price,link,previewHost,background,color,accent}=props;const[show,setShow]=useState(false);// false while the pill would lie on top of a button or link of the page (it then fades out and lets clicks through)\nconst[clear,setClear]=useState(true);const ref=useRef(null);useEffect(()=>{if(typeof window===\"undefined\")return;const host=window.location.hostname;// The Framer editor canvas shows it too, so it can be positioned.\nconst onCanvas=host.endsWith(\"framercanvas.com\")||host===\"localhost\";// Other marketplaces link the preview as ?src=cm or ?src=ui8; they forbid \"buy elsewhere\" links.\n// Remembered for the whole visit, since the pill lives on the home page and the query does not.\nlet external=false;try{const src=new URLSearchParams(window.location.search).get(\"src\");if(src)window.sessionStorage.setItem(\"plainware-src\",src.toLowerCase());const stored=window.sessionStorage.getItem(\"plainware-src\")||\"\";external=[\"cm\",\"ui8\"].includes(stored);}catch{external=/[?&]src=(cm|ui8)(&|$)/i.test(window.location.search);}const rightHost=!external&&(onCanvas||previewHost!==\"\"&&host===previewHost.trim().toLowerCase());// Phones keep the template's own call bar free; the pill is desktop only.\nconst wide=window.matchMedia(\"(min-width: 900px)\");const update=()=>setShow(rightHost&&wide.matches);update();wide.addEventListener(\"change\",update);return()=>wide.removeEventListener(\"change\",update);},[previewHost]);useEffect(()=>{if(!show||typeof window===\"undefined\")return;if(window.location.hostname.endsWith(\"framercanvas.com\"))return;// Short laptop screens put the hero's own button under the pill; small links and buttons only (<= 80 px tall),\n// large cards and decorative wordmarks may sit under it.\nconst covers=()=>{const pill=ref.current;if(!pill)return false;const b=pill.getBoundingClientRect();for(const el of Array.from(document.querySelectorAll(\"a, button, [role=button]\"))){if(el===pill||pill.contains(el)||el.closest(\"#__framer-badge-container\"))continue;const r=el.getBoundingClientRect();if(r.width<1||r.height<1||r.height>80)continue;if(r.right<=b.left||r.left>=b.right||r.bottom<=b.top||r.top>=b.bottom)continue;const cs=getComputedStyle(el);if(cs.visibility===\"hidden\"||cs.opacity===\"0\")continue;return true;}// On the first screen the hero's fact row (phone, opening hours, first offer) often sits bottom left.\n// Readable text there counts too; once the visitor scrolls, the pill floats over the page as usual.\nif(window.scrollY<40){const prev=pill.style.pointerEvents;pill.style.pointerEvents=\"none\";try{const walker=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT);const range=document.createRange();let node;while(node=walker.nextNode()){const el=node.parentElement;if(!el||!node.textContent||!node.textContent.trim())continue;if(pill.contains(el)||el.closest(\"#__framer-badge-container\"))continue;range.selectNodeContents(node);for(const r of Array.from(range.getClientRects())){if(r.right<=b.left||r.left>=b.right||r.bottom<=b.top||r.top>=b.bottom)continue;// giant display letters are decoration, the pill may sit on them\nif(parseFloat(getComputedStyle(el).fontSize)>40)break;const x=(Math.max(r.left,b.left)+Math.min(r.right,b.right))/2;const y=(Math.max(r.top,b.top)+Math.min(r.bottom,b.bottom))/2;const top=document.elementFromPoint(x,y);if(top&&(top===el||el.contains(top)||top.contains(el)))return true;}}}finally{pill.style.pointerEvents=prev;}}return false;};let frame=0;const check=()=>{if(frame)return;frame=requestAnimationFrame(()=>{frame=0;setClear(!covers());});};// appear animations move the hero after load (later on slow machines), so look again a few times\nconst timers=[0,700,1600,3200,5e3,8e3].map(t=>window.setTimeout(check,t));// buttons revealed by scroll appear animations are still transparent during the scroll, so look again once it settles\nlet settle=0;const onScroll=()=>{check();window.clearTimeout(settle);settle=window.setTimeout(check,900);};window.addEventListener(\"scroll\",onScroll,{passive:true});window.addEventListener(\"resize\",onScroll);return()=>{timers.forEach(t=>window.clearTimeout(t));window.clearTimeout(settle);if(frame)cancelAnimationFrame(frame);window.removeEventListener(\"scroll\",onScroll);window.removeEventListener(\"resize\",onScroll);};},[show]);if(!show)return null;return /*#__PURE__*/_jsxs(\"a\",{ref:ref,href:link,target:\"_blank\",rel:\"noopener\",\"aria-label\":`${label}${price?`, ${price}`:\"\"}, on the Framer Marketplace`,tabIndex:clear?undefined:-1,style:{position:\"fixed\",left:20,bottom:20,zIndex:2147483e3,display:\"inline-flex\",alignItems:\"center\",gap:10,padding:\"10px 14px 10px 12px\",borderRadius:999,background,color,textDecoration:\"none\",fontFamily:\"Inter, system-ui, sans-serif\",fontSize:14,fontWeight:600,lineHeight:1,whiteSpace:\"nowrap\",width:\"max-content\",boxShadow:\"0 6px 20px rgba(0,0,0,0.18)\",opacity:clear?1:0,pointerEvents:clear?\"auto\":\"none\",transition:\"opacity 160ms ease\"},children:[/*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":\"true\",style:{width:8,height:8,borderRadius:999,background:accent,flex:\"none\"}}),/*#__PURE__*/_jsx(\"span\",{children:label}),price?/*#__PURE__*/_jsx(\"span\",{style:{opacity:.7,fontWeight:500,fontVariantNumeric:\"tabular-nums\"},children:price}):null]});}addPropertyControls(GetTemplateBadge,{label:{type:ControlType.String,title:\"Label\",defaultValue:\"Get this template\"},price:{type:ControlType.String,title:\"Price\",defaultValue:\"$49\"},link:{type:ControlType.Link,title:\"Listing\",defaultValue:\"https://www.framer.com/marketplace/templates/dolly/\"},previewHost:{type:ControlType.String,title:\"Preview host\",description:\"Shows only on this domain, never in a buyer's remix.\",defaultValue:\"aldrichmoving.framer.website\"},background:{type:ControlType.Color,title:\"Background\",defaultValue:\"#111214\"},color:{type:ControlType.Color,title:\"Text\",defaultValue:\"#FFFFFF\"},accent:{type:ControlType.Color,title:\"Dot\",defaultValue:\"#FF6A1A\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"GetTemplateBadge\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./GetTemplateBadge.map"],"mappings":"mMAQG,SAAwB,EAAiB,EAAM,CAAC,GAAK,CAAC,QAAM,QAAM,OAAK,cAAY,aAAW,QAAM,UAAQ,EAAW,CAAC,EAAK,GAASA,EAAS,EAAK,EAClJ,CAAC,EAAM,GAAUA,EAAS,EAAI,EAAQ,EAAIC,EAAO,IAAI,EAWyY,OAXvY,MAAc,CAAC,GAAU,IAAS,OAAY,OAAO,IAAM,EAAK,EAAO,SAAS,SACtI,EAAS,EAAK,SAAS,kBAAkB,GAAG,IAAO,YAErD,EAAS,GAAM,GAAG,CAAC,IAAM,EAAI,IAAI,gBAAgB,EAAO,SAAS,MAAM,CAAC,CAAC,IAAI,KAAK,EAAK,GAAI,EAAO,eAAe,QAAQ,gBAAgB,EAAI,YAAY,CAAC,EAAE,IAAM,EAAO,EAAO,eAAe,QAAQ,eAAe,GAAG,GAAG,EAAS,CAAC,KAAK,KAAK,CAAC,CAAC,SAAS,CAAM,CAAE,MAAM,CAAC,EAAS,yBAAyB,KAAK,EAAO,SAAS,MAAM,CAAE,CAAC,IAAM,EAAU,CAAC,IAAW,GAAU,IAAc,IAAI,IAAO,EAAY,KAAK,CAAC,CAAC,YAAY,GACta,EAAK,EAAO,WAAW,oBAAoB,EAAQ,MAAW,EAAQ,GAAW,EAAK,OAAO,EAAkD,OAAhD,EAAO,EAAE,EAAK,iBAAiB,SAAS,CAAM,MAAY,EAAK,oBAAoB,SAAS,CAAM,CAAE,EAAE,CAAC,CAAW,CAAC,EAAE,MAAc,CAA8C,GAA1C,CAAC,GAAa,IAAS,Q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