{"version":3,"file":"Slider_compras.DPrlpop0.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/UgKW46jp2FsMmQ6lDsPC/lMsy7c3sg5kfTXMMnrMB/Slider_compras.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState,useRef}from\"react\";import{motion,useSpring,useTransform,useMotionValue}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";export function ProgressoVendas({initialPercent=0,updateInterval=6e4,barHeight=24,primaryColor=\"#D93630\",secondaryColor=\"#FF6B6B\",webhookUrl=\"https://n8n.octowave.com.br/webhook/745028f4-1a16-4b7a-8908-e02bc2b506be\",labelText=\"Ingressos vendidos | LOTE 6\"}){const[percent,setPercent]=useState(initialPercent);const progressValue=useMotionValue(initialPercent);const smoothProgress=useSpring(progressValue,{stiffness:60,damping:20});const widthPercentage=useTransform(smoothProgress,v=>`${v}%`);// ✅ NOVO — guard contra chamadas duplicadas\nconst lastFetchRef=useRef(0);const fetchData=async()=>{if(!webhookUrl)return;// ✅ NOVO — ignora se a última chamada foi há menos de 5s\nconst now=Date.now();if(now-lastFetchRef.current<5e3)return;lastFetchRef.current=now;try{const response=await fetch(webhookUrl);if(!response.ok)throw new Error(`HTTP error! status: ${response.status}`);const data=await response.json();const salesPercent=data.percentual||0;setPercent(salesPercent);progressValue.set(salesPercent);}catch(error){console.error(\"Erro ao buscar dados:\",error);}};useEffect(()=>{fetchData();const intervalId=setInterval(fetchData,updateInterval);return()=>clearInterval(intervalId);},[updateInterval,webhookUrl]);// --- ESTILOS (tudo igual) ---\n// ...resto do componente sem alteração\n// --- ESTILOS ---\nconst wrapperStyle={width:\"100%\",display:\"flex\",flexDirection:\"column\",gap:\"10px\",fontFamily:\"Inter, sans-serif\"};const trackStyle={width:\"100%\",height:`${barHeight}px`,backgroundColor:\"rgba(255, 255, 255, 0.1)\",borderRadius:\"99px\",overflow:\"hidden\",boxShadow:\"inset 0px 2px 4px rgba(0,0,0,0.3)\",position:\"relative\"};const fillStyle={height:\"100%\",background:`linear-gradient(90deg, ${primaryColor} 0%, ${secondaryColor} 100%)`,borderRadius:\"99px\",boxShadow:`0px 0px 15px ${primaryColor}80`,position:\"relative\"};const highlightStyle={position:\"absolute\",top:0,left:0,right:0,height:\"50%\",background:\"linear-gradient(180deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 100%)\",borderRadius:\"99px 99px 0 0\"};const labelContainerStyle={display:\"flex\",justifyContent:\"space-between\",alignItems:\"center\",color:\"#fff\",fontSize:\"18px\"};return /*#__PURE__*/_jsxs(\"div\",{style:wrapperStyle,children:[/*#__PURE__*/_jsxs(\"div\",{style:labelContainerStyle,children:[/*#__PURE__*/_jsx(\"span\",{style:{opacity:.9},children:labelText}),/*#__PURE__*/_jsxs(\"span\",{style:{fontWeight:\"bold\",fontSize:\"32px\",color:secondaryColor},children:[percent,\"%\"]})]}),/*#__PURE__*/_jsx(\"div\",{style:trackStyle,children:/*#__PURE__*/_jsx(motion.div,{style:{...fillStyle,width:widthPercentage},children:/*#__PURE__*/_jsx(\"div\",{style:highlightStyle})})}),/*#__PURE__*/_jsx(\"div\",{style:{fontSize:\"14px\",opacity:.8,textAlign:\"right\",color:\"white\"},children:\"Garanta o seu antes que fique mais caro!\"})]});}// 5. Controles do painel lateral atualizados\naddPropertyControls(ProgressoVendas,{webhookUrl:{type:ControlType.String,title:\"URL do Webhook\",defaultValue:\"https://n8n.octowave.com.br/webhook/745028f4-1a16-4b7a-8908-e02bc2b506be\"},labelText:{type:ControlType.String,title:\"Texto do Lote\",defaultValue:\"Ingressos vendidos | LOTE 6\"},initialPercent:{type:ControlType.Number,title:\"Percentual Vendas\",min:0,max:100},updateInterval:{type:ControlType.Number,title:\"Intervalo (ms)\",defaultValue:6e4},barHeight:{type:ControlType.Number,title:\"Altura da Barra\",defaultValue:24,min:10,max:60},primaryColor:{type:ControlType.Color,title:\"Cor Prim\\xe1ria\",defaultValue:\"#D93630\"},secondaryColor:{type:ControlType.Color,title:\"Cor Secund\\xe1ria\",defaultValue:\"#FF6B6B\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"ProgressoVendas\":{\"type\":\"reactComponent\",\"name\":\"ProgressoVendas\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Slider_compras.map"],"mappings":"qQAAkO,SAAgB,EAAgB,CAAC,iBAAe,EAAE,iBAAe,IAAI,YAAU,GAAG,eAAa,UAAU,iBAAe,UAAU,aAAW,2EAA2E,YAAU,+BAA+B,CAAC,GAAK,CAAC,EAAQ,GAAYA,EAAS,EAAe,CAAO,EAAc,EAAe,EAAe,CAA+E,EAAgB,EAAzE,EAAU,EAAc,CAAC,UAAU,GAAG,QAAQ,GAAG,CAAC,CAAmD,GAAG,GAAG,EAAE,GAAG,CACzsB,EAAaC,EAAO,EAAE,CAAO,EAAU,SAAS,CAAC,GAAG,CAAC,EAAW,OACtE,IAAM,EAAI,KAAK,KAAK,CAAI,OAAI,EAAa,QAAQ,KAAW,GAAa,QAAQ,EAAI,GAAG,CAAC,IAAM,EAAS,MAAM,MAAM,EAAW,CAAC,GAAG,CAAC,EAAS,GAAG,MAAU,MAAM,uBAAuB,EAAS,SAAS,CAAkC,IAAM,GAA5B,MAAM,EAAS,MAAM,EAAyB,YAAY,EAAE,EAAW,EAAa,CAAC,EAAc,IAAI,EAAa,OAAQ,EAAM,CAAC,QAAQ,MAAM,wBAAwB,EAAM,IAAI,MAAc,CAAC,GAAW,CAAC,IAAM,EAAW,YAAY,EAAU,EAAe,CAAC,UAAU,cAAc,EAAW,EAAG,CAAC,EAAe,EAAW,CAAC,CAG5hB,IAAM,EAAa,CAAC,MAAM,OAAO,QAAQ,OAAO,cAAc,SAAS,IAAI,OAAO,WAAW,oBAAoB,CAAO,EAAW,CAAC,MAAM,OAAO,OAAO,GAAG,EAAU,IAAI,gBAAgB,2BAA2B,aAAa,OAAO,SAAS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