{"version":3,"file":"GoogleReviewsStat.CSysTACC.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/Vo8krcJHuONtPVnyyv3E/xEXWpM26pk7ZSYGt5Zbx/GoogleReviewsStat.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{useEffect,useState,startTransition}from\"react\";import{PP,PP_FONT,PP_FONT_FACE,PP_API}from\"https://framerusercontent.com/modules/ntpRMZJn5GXg9XRgRRHO/UnLRxAoKdwmmhoim5Qe2/ppBrand.js\";// Every instance on a page (hero rating + hero total + testimonials stat + trust\n// strip + …) reads the same endpoint. Cache + in-flight dedup means a page with\n// N instances fires one network request instead of N.\nconst CACHE_TTL_MS=5*60*1e3;const cache=new Map;const inFlight=new Map;function fetchStats(apiUrl){const cached=cache.get(apiUrl);if(cached&&Date.now()-cached.timestamp<CACHE_TTL_MS){return Promise.resolve(cached.data);}const pending=inFlight.get(apiUrl);if(pending)return pending;const request=fetch(apiUrl).then(r=>r.ok?r.json():Promise.reject(r.status)).then(data=>{cache.set(apiUrl,{data,timestamp:Date.now()});inFlight.delete(apiUrl);return data;}).catch(err=>{inFlight.delete(apiUrl);throw err;});inFlight.set(apiUrl,request);return request;}/**\n * Small inline stat sourced live from the pp-slack-proxy /reviews/public feed\n * (mirrors the native Google Business Profile API, refreshed daily). `template`\n * supports {rating} and {total} tokens, e.g. \"{rating}/5 across {total} reviews\",\n * \"{total} Google reviews\", or just \"{rating}\" — same live fetch, different slot.\n * Falls back to static values if the fetch fails, so it never breaks the page.\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function GoogleReviewsStat(props){const apiUrl=props.apiUrl||PP_API.reviews;const template=props.template||\"{rating}/5 across {total} reviews\";const fallbackRating=props.fallbackRating??\"5.0\";const fallbackTotal=props.fallbackTotal??\"150+\";const textColor=props.textColor??PP.ink;const fontSize=props.fontSize??16;const fontWeight=props.fontWeight??700;const style=props.style;const[stat,setStat]=useState(null);useEffect(()=>{// Skip network calls while Framer is generating canvas thumbnails —\n// there's no visible result to fetch for, just wasted requests.\nif(RenderTarget.current()===RenderTarget.thumbnail)return;let cancelled=false;fetchStats(apiUrl).then(data=>{if(cancelled)return;if(typeof data.avgRating===\"number\"&&typeof data.total===\"number\"){startTransition(()=>setStat({rating:data.avgRating.toFixed(1),total:String(data.total)}));}}).catch(()=>{/* keep the static fallback — never show a broken stat */});return()=>{cancelled=true;};},[apiUrl]);const rating=stat?.rating??fallbackRating;const total=stat?.total??fallbackTotal;const text=template.replace(/\\{rating\\}/g,rating).replace(/\\{total\\}/g,total);return /*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",minWidth:\"max-content\",...style},children:[/*#__PURE__*/_jsx(\"style\",{children:PP_FONT_FACE}),/*#__PURE__*/_jsx(\"span\",{style:{fontFamily:PP_FONT,fontWeight,fontSize,lineHeight:1.2,color:textColor,letterSpacing:\"-0.005em\",whiteSpace:\"nowrap\"},children:text})]});}addPropertyControls(GoogleReviewsStat,{apiUrl:{type:ControlType.String,title:\"API URL\",defaultValue:PP_API.reviews},template:{type:ControlType.String,title:\"Template\",defaultValue:\"{rating}/5 across {total} reviews\",description:\"Use {rating} and {total} as placeholders\"},fallbackRating:{type:ControlType.String,title:\"Fallback Rating\",defaultValue:\"5.0\"},fallbackTotal:{type:ControlType.String,title:\"Fallback Total\",defaultValue:\"150+\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:PP.ink},fontSize:{type:ControlType.Number,title:\"Font Size\",defaultValue:16,min:10,max:40},fontWeight:{type:ControlType.Number,title:\"Font Weight\",defaultValue:700,min:400,max:900,step:100}})// Rebuilt 2026-08-24: PP_FONT now resolves to the private \"PP Biennale\"\n// family, mapped only to the licensed Fontspring webfonts. Framer rebuilds a\n// component only when its own file changes, so dependents of ppBrand.ts must be\n// touched for a token change to reach the published bundle.\n// Rebuild stamp 2026-08-24b: ppBrand Ink 3 / Orange Ink darkened to meet 4.5:1.\n// Endpoint moved to pp-brain-gateway (pp-slack-proxy-sandbox retired).\n// Rebuild stamp 2026-08-27: PP_API.reviews now points at gateway.panhandleproductions.net.\n;\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"GoogleReviewsStat\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./GoogleReviewsStat.map"],"mappings":"gRAGuE,SAAS,EAAW,EAAO,CAAC,IAAM,EAAO,EAAM,IAAI,CAAM,EAAE,GAAG,GAAQ,KAAK,IAAI,EAAE,EAAO,UAAU,EAAc,OAAO,QAAQ,QAAQ,EAAO,IAAI,EAAG,IAAM,EAAQ,EAAS,IAAI,CAAM,EAAE,GAAG,EAAQ,OAAO,EAAQ,IAAM,EAAQ,MAAM,CAAM,CAAC,CAAC,KAAK,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,IAAO,EAAM,IAAI,EAAO,CAAC,OAAK,UAAU,KAAK,IAAI,CAAC,CAAC,EAAE,EAAS,OAAO,CAAM,EAAS,EAAM,CAAC,CAAC,MAAM,GAAK,CAAyB,MAAxB,EAAS,OAAO,CAAM,EAAQ,CAAI,CAAC,EAA+B,OAA7B,EAAS,IAAI,EAAO,CAAO,EAAS,CAAQ,CAQhiB,SAAwB,EAAkB,EAAM,CAAC,IAAM,EAAO,EAAM,QAAQ,EAAO,QAAc,EAAS,EAAM,UAAU,oCAA0C,EAAe,EAAM,gBAAgB,MAAY,EAAc,EAAM,eAAe,OAAa,EAAU,EAAM,WAAW,EAAG,IAAU,EAAS,EAAM,UAAU,GAAS,EAAW,EAAM,YAAY,IAAU,EAAM,EAAM,MAAW,CAAC,EAA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