{"version":3,"sources":["../ui/src/components/player-components/fullrate/fullrate.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\r\nimport { setFullRatePopover } from \"redux-share/slices/popoversSlice\";\r\nimport { useAppDispatch, useAppSelector } from \"redux-share/hooks\";\r\nimport { ConditionName, zIndex } from \"interfaces\";\r\nimport { conditions } from \"helpers\";\r\nimport CloseIcon from \"../../icon-components/closeIcon\";\r\nimport { shallowEqual } from 'react-redux'\r\n\r\nconst FullRate = () => {\r\n\r\n    useAppSelector(({ popovers: { fullRatePopover } }) => ({ fullRatePopover }), shallowEqual);\r\n    useAppSelector(({ videoData: { isComplexPortrait } }) => ({ isComplexPortrait }), shallowEqual);\r\n    \r\n    const [width, setWidth] = useState<number>(0);\r\n\r\n    const dispatch = useAppDispatch();\r\n\r\n    const intervalRef = useRef<any>(null)\r\n\r\n    useEffect(() => {\r\n        intervalRef.current = setInterval(() => setWidth((prev) => prev + 0.2), 10)\r\n\r\n        return () => clearInterval(intervalRef.current);\r\n    }, [])\r\n\r\n    const handleClose = (timeout:any) => {\r\n        dispatch(setFullRatePopover(false))\r\n        clearInterval(intervalRef.current);\r\n        timeout = setTimeout(() => dispatch(setFullRatePopover(undefined)), 500)\r\n    }\r\n\r\n    let timeout: any;\r\n\r\n    useEffect(() => {\r\n        if (width >= 100) handleClose(timeout)\r\n\r\n        return () => clearTimeout(timeout);\r\n    }, [width])\r\n\r\n    const fullRateStyles = () => {\r\n        let styles = \"\";\r\n\r\n        if (conditions(ConditionName.isComplexPortrait)) styles = `!pl-absolute pl-mt-12 ${conditions(ConditionName.showFullRatePopover) ? \"animate__backInRight\" : \"animate__backOutRight\"}`;\r\n        else if (conditions(ConditionName.isFullMobilePortrait)) styles = `!pl-absolute pl-top-12 pl-self-center pl-justify-center ${conditions(ConditionName.showFullRatePopover) ? \"animate__backInRight\" : \"animate__backOutRight\"}`;\r\n        else styles = `!pl-absolute pl-top-3 pl-left-3 ${conditions(ConditionName.showFullRatePopover) ? \"animate__backInDown\" : \"animate__backOutUp\"}`;\r\n\r\n        return styles;\r\n    }\r\n\r\n    return (\r\n        <div className={`pl-relative pl-flex pl-items-center pl-border pl-border-secondary-300 pl-bg-secondary-100/[0.8] dark:pl-bg-gray-800/[0.8] pl-rounded-[4px] animate__animated ${fullRateStyles()}`} style={{ zIndex: zIndex.fullrate }}>\r\n            <div className=\"pl-relative pl-bg-secondary-100 dark:pl-bg-gray-800 pl-p-2 pl-overflow-hidden pl-rounded-r-[4px]\">\r\n                <p className=\"pl-text-black dark:pl-text-white pl-text-[11px] pl-font-medium\">ترافیک اینترنت شما تمام بها محاسبه می‌شود.</p>\r\n                <div className=\"pl-absolute pl-bottom-0 pl-right-0 pl-w-full pl-h-[2px] pl-bg-dark-8\">\r\n                    <div className=\"pl-absolute pl-bottom-0 pl-right-0 pl-h-[2px] pl-bg-main-700\" style={{ width: `${width}%` }}></div>\r\n                </div>\r\n            </div>\r\n            <div className=\"pl-bg-secondary-700/[0.8] dark:pl-bg-gray-600/[0.8] pl-p-[10px] pl-cursor-pointer pl-rounded-l-[4px]\" onClick={() => handleClose(timeout)}>\r\n                <CloseIcon className=\"pl-stroke-secondary-50 pl-w-3 pl-h-3\" />\r\n            </div>\r\n        </div>\r\n    )\r\n}\r\n\r\nexport default FullRate;"],"mappings":"gNAAAA,IAAA,OAAS,aAAAC,EAAW,UAAAC,EAAQ,YAAAC,MAAgB,QAM5C,OAAS,gBAAAC,MAAoB,cA6CjB,OACI,OAAAC,EADJ,QAAAC,MAAA,oBA3CZ,IAAMC,EAAW,IAAM,CAEnBC,EAAe,CAAC,CAAE,SAAU,CAAE,gBAAAC,CAAgB,CAAE,KAAO,CAAE,gBAAAA,CAAgB,GAAIL,CAAY,EACzFI,EAAe,CAAC,CAAE,UAAW,CAAE,kBAAAE,CAAkB,CAAE,KAAO,CAAE,kBAAAA,CAAkB,GAAIN,CAAY,EAE9F,GAAM,CAACO,EAAOC,CAAQ,EAAIC,EAAiB,CAAC,EAEtCC,EAAWC,EAAe,EAE1BC,EAAcC,EAAY,IAAI,EAEpCC,EAAU,KACNF,EAAY,QAAU,YAAY,IAAMJ,EAAUO,GAASA,EAAO,EAAG,EAAG,EAAE,EAEnE,IAAM,cAAcH,EAAY,OAAO,GAC/C,CAAC,CAAC,EAEL,IAAMI,EAAeC,GAAgB,CACjCP,EAASQ,EAAmB,EAAK,CAAC,EAClC,cAAcN,EAAY,OAAO,EACjCK,EAAU,WAAW,IAAMP,EAASQ,EAAmB,MAAS,CAAC,EAAG,GAAG,CAC3E,EAEID,EAEJ,OAAAH,EAAU,KACFP,GAAS,KAAKS,EAAYC,CAAO,EAE9B,IAAM,aAAaA,CAAO,GAClC,CAACV,CAAK,CAAC,EAaNL,EAAC,OAAI,UAAW,iKAXG,IAAM,CACzB,IAAIiB,EAAS,GAEb,OAAIC,qBAA0C,EAAGD,EAAS,yBAAyBC,uBAA4C,EAAI,uBAAyB,uBAAuB,GAC1KA,wBAA6C,EAAGD,EAAS,2DAA2DC,uBAA4C,EAAI,uBAAyB,uBAAuB,GACxND,EAAS,mCAAmCC,uBAA4C,EAAI,sBAAwB,oBAAoB,GAEtID,CACX,GAGmM,CAAC,GAAI,MAAO,CAAE,SAAwB,EACjO,UAAAjB,EAAC,OAAI,UAAU,mGACX,UAAAD,EAAC,KAAE,UAAU,iEAAiE,qOAA0C,EACxHA,EAAC,OAAI,UAAU,uEACX,SAAAA,EAAC,OAAI,UAAU,+DAA+D,MAAO,CAAE,MAAO,GAAGM,CAAK,GAAI,EAAG,EACjH,GACJ,EACAN,EAAC,OAAI,UAAU,uGAAuG,QAAS,IAAMe,EAAYC,CAAO,EACpJ,SAAAhB,EAACoB,EAAA,CAAU,UAAU,uCAAuC,EAChE,GACJ,CAER,EAEOC,EAAQnB","names":["init_esm_shims","useEffect","useRef","useState","shallowEqual","jsx","jsxs","FullRate","useAppSelector","fullRatePopover","isComplexPortrait","width","setWidth","useState","dispatch","useAppDispatch","intervalRef","useRef","useEffect","prev","handleClose","timeout","setFullRatePopover","styles","conditions","closeIcon_default","fullrate_default"]}