{"version":3,"file":"Chatbot.DXw6PROp.mjs","names":["React.useMemo","React.useState"],"sources":["https:/framerusercontent.com/modules/wf1q64VhKnP3PodndRFS/7KzgI3nssc0L28XXlOtc/Chatbot.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";function loadScriptOnce(src,id){return new Promise((resolve,reject)=>{const existing=document.getElementById(id);if(existing){if(existing.__loaded)return resolve();existing.addEventListener(\"load\",()=>resolve());existing.addEventListener(\"error\",()=>reject(new Error(`Failed: ${src}`)));return;}const s=document.createElement(\"script\");s.id=id;s.src=src;s.async=true;s.onload=()=>{s.__loaded=true;resolve();};s.onerror=()=>reject(new Error(`Failed: ${src}`));document.head.appendChild(s);});}export default function BotpressResizableChat(props){const{configUrl,injectUrl,defaultOpen,buttonLabel,corner,offsetX,offsetY,zIndex,borderRadius,shadow}=props;const containerId=React.useMemo(()=>`bp-container-${Math.random().toString(36).slice(2)}`,[]);const[isOpen,setIsOpen]=React.useState(defaultOpen);const[isReady,setIsReady]=React.useState(false);const cornerStyle=React.useMemo(()=>{const base={position:\"fixed\",zIndex};if(corner.includes(\"b\"))base.bottom=offsetY;if(corner.includes(\"t\"))base.top=offsetY;if(corner.includes(\"r\"))base.right=offsetX;if(corner.includes(\"l\"))base.left=offsetX;return base;},[corner,offsetX,offsetY,zIndex]);React.useEffect(()=>{let cancelled=false;async function boot(){try{await loadScriptOnce(injectUrl,\"bp-webchat-inject\");await loadScriptOnce(configUrl,`bp-webchat-config-${btoa(configUrl).slice(0,12)}`);if(cancelled)return;// Espera o Botpress existir\nconst start=Date.now();while(!window.botpress&&Date.now()-start<8e3){await new Promise(r=>setTimeout(r,50));}if(cancelled)return;setIsReady(Boolean(window.botpress));// Se abrir por padrão\nif(defaultOpen&&window.botpress?.open){window.botpress.open();}}catch(e){// Se algo falhar, a UI ainda aparece (botão),\n// mas não marcamos como ready.\nif(!cancelled)setIsReady(false);}}boot();return()=>{cancelled=true;};},[injectUrl,configUrl,defaultOpen]);React.useEffect(()=>{const bp=window.botpress;if(!bp)return;if(isOpen)bp.open?.();else bp.close?.();},[isOpen]);const panelStyle={width:\"100%\",height:\"100%\",borderRadius,overflow:\"hidden\",background:\"transparent\",boxShadow:shadow?\"0 18px 60px rgba(0,0,0,0.25)\":\"none\",pointerEvents:isOpen?\"auto\":\"none\",opacity:isOpen?1:0,transform:isOpen?\"translateY(0px)\":\"translateY(8px)\",transition:\"opacity 180ms ease, transform 180ms ease\"};const buttonStyle={position:\"absolute\",right:12,bottom:12,pointerEvents:\"auto\",borderRadius:999,border:\"none\",padding:\"12px 14px\",cursor:\"pointer\",fontSize:14,lineHeight:\"14px\",background:\"#111\",color:\"#fff\"};return /*#__PURE__*/_jsxs(\"div\",{style:{...cornerStyle,width:props.width,height:props.height},children:[/*#__PURE__*/_jsx(\"style\",{children:`\n        #${containerId} {\n          position: relative;\n          width: 100%;\n          height: 100%;\n        }\n\n        /* Esconde o FAB padr\\xe3o do Botpress (o \\xedcone dele) */\n        #${containerId} .bpFab {\n          display: none !important;\n        }\n\n        /* For\\xe7a o webchat a respeitar o container */\n        #${containerId} .bpWebchat {\n          position: absolute !important;\n          inset: 0 !important;\n          width: 100% !important;\n          height: 100% !important;\n          max-height: 100% !important;\n        }\n      `}),/*#__PURE__*/_jsx(\"div\",{id:containerId,style:panelStyle})]});}BotpressResizableChat.defaultProps={injectUrl:\"https://cdn.botpress.cloud/webchat/v3.6/inject.js\",configUrl:\"https://files.bpcontent.cloud/2026/02/19/20/20260219201536-428DWP53.js\",defaultOpen:false,buttonLabel:\"Chat\",corner:\"br\",offsetX:18,offsetY:18,zIndex:9999,borderRadius:20,shadow:true};addPropertyControls(BotpressResizableChat,{configUrl:{type:ControlType.String,title:\"Config URL\"},injectUrl:{type:ControlType.String,title:\"Inject URL\"},defaultOpen:{type:ControlType.Boolean,title:\"Abre aberto\"},buttonLabel:{type:ControlType.String,title:\"Texto bot\\xe3o\"},corner:{type:ControlType.Enum,title:\"Canto\",options:[\"br\",\"bl\",\"tr\",\"tl\"],optionTitles:[\"Bottom Right\",\"Bottom Left\",\"Top Right\",\"Top Left\"]},offsetX:{type:ControlType.Number,title:\"Offset X\",min:0,max:200,step:1},offsetY:{type:ControlType.Number,title:\"Offset Y\",min:0,max:200,step:1},zIndex:{type:ControlType.Number,title:\"Z Index\",min:1,max:99999,step:1},borderRadius:{type:ControlType.Number,title:\"Radius\",min:0,max:48,step:1},shadow:{type:ControlType.Boolean,title:\"Sombra\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"BotpressResizableChat\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Chatbot.map"],"mappings":"6MAAyI,SAAS,EAAe,EAAI,EAAG,CAAC,OAAO,IAAI,SAAS,EAAQ,IAAS,CAAC,IAAM,EAAS,SAAS,eAAe,EAAG,CAAC,GAAG,EAAS,CAAC,GAAG,EAAS,SAAS,OAAO,GAAS,CAAC,EAAS,iBAAiB,WAAW,GAAS,CAAC,CAAC,EAAS,iBAAiB,YAAY,EAAW,MAAM,WAAW,IAAM,CAAC,CAAC,CAAC,OAAQ,IAAM,EAAE,SAAS,cAAc,SAAS,CAAC,EAAE,GAAG,EAAG,EAAE,IAAI,EAAI,EAAE,MAAM,GAAK,EAAE,WAAW,CAAC,EAAE,SAAS,GAAK,GAAS,EAAG,EAAE,YAAY,EAAW,MAAM,WAAW,IAAM,CAAC,CAAC,SAAS,KAAK,YAAY,EAAE,EAAG,CAAE,SAAwB,EAAsB,EAAM,CAAC,GAAK,CAAC,YAAU,YAAU,cAAY,cAAY,SAAO,UAAQ,UAAQ,SAAO,eAAa,UAAQ,EAAY,EAAYA,MAAkB,gBAAgB,KAAK,QAAQ,CAAC,SAAS,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAM,CAAC,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