{"version":3,"file":"VturbPlayer.BigrwO2M.mjs","names":["useRef","useState","useCallback"],"sources":["https:/framerusercontent.com/modules/ecBL1XoVtgmf2QeLgpqb/HquU6pq1AGhnS4jV5X7I/VturbPlayer.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useRef,useEffect,useState,useCallback}from\"react\";import{addPropertyControls,ControlType}from\"framer\";export function VturbPlayer({vturbCode,secondsToDisplay,classToDisplay}){const containerRef=useRef(null);const[elementsShown,setElementsShown]=useState(false);// Função para obter a URL base sem parâmetros\nconst getBaseUrl=useCallback(()=>{const url1=new URL(window.location.href);return`${url1.origin}${url1.pathname}`;},[]);const initializePlayer=useCallback(()=>{const container=containerRef.current;// Limpa o contêiner antes de adicionar um novo player\nwhile(container.firstChild){container.removeChild(container.firstChild);}// Cria um novo elemento div para conter o código do player\nconst playerContainer=document.createElement(\"div\");playerContainer.innerHTML=vturbCode;// Adiciona o código do player ao contêiner\ncontainer.appendChild(playerContainer);// Obtém a tag script do código do player\nconst scriptTag=playerContainer.querySelector(\"script\");// Executa o código dentro da tag script\ntry{eval(scriptTag.innerHTML);}catch(error){console.error(\"Erro ao inicializar o player:\",error);}},[vturbCode]);const showEls=useCallback(()=>{const baseUrl1=getBaseUrl();const storageKey1=`alreadyElsDisplayed_${baseUrl1}`;const elements1=document.querySelectorAll(classToDisplay);elements1.forEach(element1=>{element1.classList.remove(\"esconder\");element1.style.removeProperty(\"display\");});localStorage.setItem(storageKey1,\"true\");// Força o Framer a recalcular o layout após exibir os elementos\nsetTimeout(()=>{window.dispatchEvent(new Event(\"resize\"));},100);},[classToDisplay,getBaseUrl]);const startWatchVideoProgress=useCallback(()=>{let attempts1=0;const checkPlayer1=()=>{if(typeof smartplayer===\"undefined\"||!(smartplayer.instances&&smartplayer.instances.length)){attempts1+=1;if(attempts1>=10)return;return setTimeout(checkPlayer1,1e3);}smartplayer.instances[0].on(\"timeupdate\",()=>{if(smartplayer.instances[0].video.currentTime>=secondsToDisplay){setElementsShown(true);}});};checkPlayer1();},[secondsToDisplay]);useEffect(()=>{const baseUrl1=getBaseUrl();const storageKey1=`alreadyElsDisplayed_${baseUrl1}`;initializePlayer();// Verifica se os elementos já foram exibidos anteriormente\nconst alreadyElsDisplayed1=localStorage.getItem(storageKey1);if(alreadyElsDisplayed1===\"true\"){setElementsShown(true);}else{startWatchVideoProgress();}const handleResize1=()=>{if(typeof smartplayer!==\"undefined\"&&smartplayer.instances&&smartplayer.instances.length){const currentTime1=smartplayer.instances[0].video.currentTime;if(currentTime1>=secondsToDisplay){setElementsShown(true);}}};window.addEventListener(\"resize\",handleResize1);window.addEventListener(\"orientationchange\",handleResize1);return()=>{window.removeEventListener(\"resize\",handleResize1);window.removeEventListener(\"orientationchange\",handleResize1);};},[vturbCode,secondsToDisplay,classToDisplay,getBaseUrl,initializePlayer,startWatchVideoProgress]);useEffect(()=>{if(elementsShown){showEls();}},[elementsShown,showEls]);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef});}// ... (o resto do código permanece o mesmo)\nVturbPlayer.defaultProps={vturbCode:`\n    <div id=\"vid_66577d0d150fc9000b75519d\" style=\"position:relative;width:100%;padding: 177.77777777777777% 0 0;\">\n      <img id=\"thumb_66577d0d150fc9000b75519d\" src=\"https://images.converteai.net/693742f3-b2a9-47a8-90be-b9911b88f4b5/players/66577d0d150fc9000b75519d/thumbnail.jpg\" style=\"position:absolute;top:0;left:0;width:100%;height:100%;object-fit:cover;display:block;\">\n      <div id=\"backdrop_66577d0d150fc9000b75519d\" style=\"position:absolute;top:0;width:100%;height:100%;-webkit-backdrop-filter:blur(5px);backdrop-filter:blur(5px);\"></div>\n    </div>\n    <script type=\"text/javascript\" id=\"scr_66577d0d150fc9000b75519d\">\n      var s=document.createElement(\"script\");\n      s.src=\"https://scripts.converteai.net/693742f3-b2a9-47a8-90be-b9911b88f4b5/players/66577d0d150fc9000b75519d/player.js\",\n      s.async=!0,document.head.appendChild(s);\n    </script>\n  `,secondsToDisplay:5,classToDisplay:\".esconder\"};addPropertyControls(VturbPlayer,{vturbCode:{type:ControlType.String,title:\"C\\xf3digo do Player do Vturb\",defaultValue:VturbPlayer.defaultProps.vturbCode,displayTextArea:true},secondsToDisplay:{type:ControlType.Number,title:\"Segundos para Exibir\",defaultValue:VturbPlayer.defaultProps.secondsToDisplay,min:0,step:1},classToDisplay:{type:ControlType.String,title:\"Classe dos Elementos a Exibir\",defaultValue:VturbPlayer.defaultProps.classToDisplay}});\nexport const __FramerMetadata__ = {\"exports\":{\"VturbPlayer\":{\"type\":\"reactComponent\",\"name\":\"VturbPlayer\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./VturbPlayer.map"],"mappings":"kUAAwJ,SAAgB,YAAY,CAAC,UAAU,iBAAiB,gBAAgB,CAAC,MAAM,aAAaA,GAAO,KAAK,CAAM,CAAC,cAAc,kBAAkBC,GAAS,GAAM,CAChT,WAAWC,OAAgB,CAAC,IAAM,KAAK,IAAI,IAAI,OAAO,SAAS,KAAK,CAAC,MAAM,GAAG,KAAK,SAAS,KAAK,YAAa,EAAE,CAAC,CAAO,iBAAiBA,OAAgB,CAAC,MAAM,UAAU,aAAa,QAC7L,KAAM,UAAU,YAAY,UAAU,YAAY,UAAU,WAAW,CACvE,MAAM,gBAAgB,SAAS,cAAc,MAAM,CAAC,gBAAgB,UAAU,UAC9E,UAAU,YAAY,gBAAgB,CACtC,MAAM,UAAU,gBAAgB,cAAc,SAAS,CACvD,GAAG,CAAC,KAAK,UAAU,UAAU,OAAQ,MAAM,CAAC,QAAQ,MAAM,gCAAgC,MAAM,GAAI,CAAC,UAAU,CAAC,CAAO,QAAQA,OAAgB,CAA6B,IAAM,YAAY,uBAA/B,YAAY,GAAqE,SAAS,iBAAiB,eAAe,CAAW,QAAQ,UAAU,CAAC,SAAS,UAAU,OAAO,WAAW,CAAC,SAAS,MAAM,eAAe,UAAU,EAAG,CAAC,aAAa,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