@davi-ai/retorik-framework 4.0.0 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAM,uCAAiB,CAAC,aAAE,SAAS,WAAE,OAAO,UAAE,MAAM,QAAE,IAAI,gBAAE,YAAY,eAAE,WAAW,YAAE,QAAQ,EAAuB;IACpH,MAAM,WAAW,CAAA,GAAA,kBAAU;IAC3B,MAAM,UAAU,CAAA,GAAA,kBAAU,EAAE,CAAC,QAAqB,MAAM,cAAc,CAAC,OAAO;IAC9E,MAAM,WAAW,CAAA,GAAA,kBAAU,EAAE,CAAC,QAAqB,MAAM,aAAa,CAAC,QAAQ;IAC/E,MAAM,eAAe,CAAA,GAAA,kBAAU,EAAE,CAAC,QAAqB,MAAM,cAAc,CAAC,YAAY;IACxF,MAAM,mBAAmB,CAAA,GAAA,kBAAU,EAAE,CAAC,QAAqB,MAAM,aAAa,CAAC,sBAAsB;IACrG,MAAM,yBAAyB,CAAA,GAAA,kBAAU,EAAE,CAAC,QAAqB,MAAM,aAAa,CAAC,sBAAsB;IAC3G,MAAM,eAAe,CAAA,GAAA,kBAAU,EAAE,CAAC,QAAqB,MAAM,aAAa,CAAC,iBAAiB;IAC5F,MAAM,eAAe,CAAA,GAAA,kBAAU,EAAE,CAAC,QAAqB,MAAM,aAAa,CAAC,iBAAiB;IAC5F,MAAM,iBAAiB,CAAA,GAAA,kBAAU,EAAE,CAAC,QAAqB,MAAM,aAAa,CAAC,cAAc;IAC3F,MAAM,kBAAkB,CAAA,GAAA,kBAAU,EAAE,CAAC,QAAqB,MAAM,WAAW,CAAC,eAAe;IAC3F,MAAM,WAAW,CAAA,GAAA,kBAAU,EAAE,CAAC,QAAqB,MAAM,WAAW,CAAC,QAAQ;IAE7E,MAAM,CAAC,SAAS,WAAW,GAAG,CAAA,GAAA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;oBAC/C,QAAQ,sBAAsB,eAAe,YAAY,SAAS,OAAO,CAAC,UAAU,EAAE,SAAS,OAAO,CAAC,WAAW;gBACpH;YACF;QACF;QAEA,wEAAwE;QACxE,OAAO,qBAAqB,CAAC;IAC/B;IAEA,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,gBAAgB,SAAS,OAAO,EAClC,6BAA6B;QAC7B,UAAU,YAAY,CACnB,YAAY,CAAC,0CACb,IAAI,CAAC,CAAC;YACL,IAAI,SAAS,OAAO,EAAE;gBACpB,SAAS,OAAO,CAAC,SAAS,GAAG;gBAC7B,SAAS,OAAO,CAAC,gBAAgB,CAAC,cAAc;YAClD;QACF,GACC,KAAK,CAAC,CAAC;YACN,QAAQ,KAAK,CAAC;QAChB;IAEN,GAAG;QAAC;KAAa;IAEjB,qBACE,gBAAC;QAAI,IAAG;QAAkC,WAAW,CAAC,+BAA+B,EAAE,CAAC,iBAAiB,gBAAgB;kBACvH,cAAA,gBAAC;YACC,KAAK;YACL,KAAI;YACJ,QAAQ;YACR,OAAO;gBACL,QAAQ,GAAG,SAAS,GAAG,CAAC;gBACxB,OAAO,gBAAgB,cAAc,IAAI;gBACzC,QAAQ,gBAAgB,eAAe,IAAI;YAC7C;;;AAIR;IAEA,2CAAe","sources":["src/components/ChatbotAndSubtitles/ThreeJsWrapper.tsx","src/components/ChatbotAndSubtitles/CalibrationScreen.tsx","src/components/Veille/FaceDetector.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from 'react'\r\nimport { Character, CreationTool, setCharacterState, addViseme, setVisemes, flushLipSyncData, CharacterState, presets, Object3D } from '@davi-ai/react-bodyengine-three'\r\nimport { useSelector, useDispatch } from 'react-redux'\r\nimport { RootState, storeActions } from '../../store'\r\nimport type { CalibrationData } from '../../store/models/types'\r\nimport { RecognitionState, Source3DEngine } from '../../models/enums'\r\nimport MicrophoneLoader from '../Loader/MicrophoneLoader'\r\nimport CalibrationScreen from './CalibrationScreen'\r\n\r\ninterface EyeTrackingData {\r\n webcamHeight: number\r\n webcamRotation: number\r\n ratioPixelToCentimeter: number\r\n agentEyesHeight: number\r\n distanceFromDevice: number\r\n worldDistancePerDegree: number\r\n cameraX: number\r\n cameraZ: number\r\n}\r\n\r\ninterface ThreeJsWrapperAgentData {\r\n url: string\r\n animationsUrl?: string\r\n source?: string\r\n gender: 'male' | 'female' | 'other'\r\n}\r\n\r\ninterface ThreeJsWrapperProps {\r\n agentData: ThreeJsWrapperAgentData\r\n visible: boolean\r\n height?: string | number\r\n size?: string | number\r\n cameraPreset?: keyof typeof presets\r\n calibration?: CalibrationData\r\n centered: boolean\r\n}\r\n\r\nconst ThreeJsWrapper = ({ agentData, visible, height, size, cameraPreset, calibration, centered }: ThreeJsWrapperProps): JSX.Element => {\r\n const dispatch = useDispatch()\r\n const gpuData = useSelector((state: RootState) => state.retorikReducer.gpuData)\r\n const speaking = useSelector((state: RootState) => state.speechReducer.speaking)\r\n const loaderClosed = useSelector((state: RootState) => state.retorikReducer.loaderClosed)\r\n const recognitionState = useSelector((state: RootState) => state.speechReducer.activeRecognitionState)\r\n const lastRecognitionInterim = useSelector((state: RootState) => state.speechReducer.lastRecognitionInterim)\r\n const singleViseme = useSelector((state: RootState) => state.speechReducer.singleVisemeAdded)\r\n const multiVisemes = useSelector((state: RootState) => state.speechReducer.multiVisemesAdded)\r\n const streamingQueue = useSelector((state: RootState) => state.speechReducer.streamingQueue)\r\n const characterLoaded = useSelector((state: RootState) => state.viewReducer.characterLoaded)\r\n const isMobile = useSelector((state: RootState) => state.viewReducer.isMobile)\r\n\r\n const [targets, setTargets] = useState<Array<Object3D>>([])\r\n const [dynamicData, setDynamicData] = useState<\r\n | {\r\n webcamHeight: number\r\n ratioPixelToCentimeter: number\r\n deltaAgentHeightAgentWorldHeightInCentimeters: number\r\n cameraRotationInDegrees: number\r\n distanceFromAgentToCameraInCentimeters: number\r\n }\r\n | undefined\r\n >(undefined)\r\n const [openCalibration, setOpenCalibration] = useState<boolean>(false)\r\n\r\n /**\r\n * Use model's source to get the right loader. Default to avaturn loader\r\n */\r\n const type = useMemo<CreationTool | null>(() => {\r\n if (agentData.source) {\r\n switch (agentData.source.toLowerCase()) {\r\n case Source3DEngine.avatarsdk:\r\n case Source3DEngine.avatarsdkbis:\r\n return CreationTool.avatarsdk\r\n case Source3DEngine.cc3:\r\n case Source3DEngine.cc4:\r\n return CreationTool.cc3\r\n case Source3DEngine.rpm:\r\n case Source3DEngine.readyplayerme:\r\n return CreationTool.rpm\r\n case Source3DEngine.avaturn:\r\n default:\r\n return CreationTool.avaturn\r\n }\r\n }\r\n\r\n return CreationTool.avaturn\r\n }, [agentData])\r\n\r\n useEffect(() => {\r\n if ((!calibration?.static?.enabled && !calibration?.dynamic?.enabled) || isMobile) dispatch(storeActions.view.setCalibrationCompleted(true))\r\n }, [calibration, isMobile])\r\n\r\n useEffect(() => {\r\n // Check if we should open the calibration screen or not\r\n if ((calibration?.static?.enabled || calibration?.dynamic?.enabled) && !isMobile) {\r\n // If there are some static data in the props or the local storage, we can directly set the targets without opening the calibration screen\r\n if (calibration?.static?.enabled && calibration.static.staticTarget) {\r\n const o = new Object3D()\r\n o.position.set(calibration.static.staticTarget.x, calibration.static.staticTarget.y, calibration.static.staticTarget.z)\r\n setTargets([o])\r\n setOpenCalibration(false)\r\n dispatch(storeActions.view.setCalibrationCompleted(true))\r\n } else if (calibration?.static?.enabled && calibration.static.loadStaticTargetFromLocalStorage && localStorage.getItem('Retorik.Framework.Static.Target')) {\r\n const calibrationData = JSON.parse(localStorage.getItem('Retorik.Framework.Static.Target') || '{}') as {\r\n x: number\r\n y: number\r\n z: number\r\n }\r\n const o = new Object3D()\r\n o.position.set(calibrationData.x, calibrationData.y, calibrationData.z)\r\n setTargets([o])\r\n setOpenCalibration(false)\r\n dispatch(storeActions.view.setCalibrationCompleted(true))\r\n } else if (calibration.dynamic?.enabled && calibration.dynamic.dynamicData) {\r\n // Check if all the mandatory dynamic data are in the props\r\n if (\r\n calibration.dynamic.dynamicData.webcamHeight &&\r\n calibration.dynamic.dynamicData.ratioPixelToCentimeter &&\r\n calibration.dynamic.dynamicData.deltaAgentHeightAgentWorldHeightInCentimeters &&\r\n calibration.dynamic.dynamicData.distanceFromAgentToCameraInCentimeters\r\n ) {\r\n setDynamicData({ ...calibration.dynamic.dynamicData, cameraRotationInDegrees: calibration.dynamic.dynamicData.cameraRotationInDegrees || 0 })\r\n }\r\n\r\n setOpenCalibration(true)\r\n } else if (calibration.dynamic?.enabled && calibration.dynamic.loadDynamicDataFromLocalStorage && localStorage.getItem('Retorik.Framework.Dynamic.Data')) {\r\n // Check if the local storage data is complete\r\n const calibrationData = JSON.parse(localStorage.getItem('Retorik.Framework.Dynamic.Data') || '{}')\r\n if (\r\n calibrationData.webcamHeight &&\r\n calibrationData.ratioPixelToCentimeter &&\r\n calibrationData.deltaAgentHeightAgentWorldHeightInCentimeters &&\r\n calibrationData.distanceFromAgentToCameraInCentimeters\r\n ) {\r\n setDynamicData({ ...calibrationData, cameraRotationInDegrees: calibrationData.cameraRotationInDegrees || 0 })\r\n }\r\n\r\n setOpenCalibration(true)\r\n } else {\r\n setOpenCalibration(true)\r\n }\r\n } else {\r\n setOpenCalibration(false)\r\n dispatch(storeActions.view.setCalibrationCompleted(true))\r\n }\r\n }, [calibration, isMobile])\r\n\r\n useEffect(() => {\r\n singleViseme && addViseme(singleViseme)\r\n }, [singleViseme])\r\n\r\n useEffect(() => {\r\n multiVisemes.length && setVisemes(multiVisemes)\r\n }, [multiVisemes])\r\n\r\n useEffect(() => {\r\n if (speaking || streamingQueue.length) {\r\n setCharacterState(CharacterState.speaking)\r\n } else if (recognitionState === RecognitionState.Closed) {\r\n setCharacterState(CharacterState.idle)\r\n } else if (lastRecognitionInterim) {\r\n setCharacterState(CharacterState.listening)\r\n } else {\r\n setCharacterState(CharacterState.waiting)\r\n }\r\n }, [speaking, recognitionState, lastRecognitionInterim, streamingQueue])\r\n\r\n useEffect(() => {\r\n !speaking && flushLipSyncData()\r\n }, [speaking])\r\n\r\n return (\r\n <React.Fragment>\r\n <div\r\n style={{\r\n height: size || '100%',\r\n paddingTop: height || 0,\r\n visibility: characterLoaded && visible ? 'visible' : 'hidden'\r\n }}\r\n >\r\n {type && (\r\n <Character\r\n url={agentData.url}\r\n type={type}\r\n animationsUrl={agentData?.animationsUrl || 'https://cdn.retorik.ai/bodyengine-three/animations/cc4/female/standing/'}\r\n gender={agentData?.gender === 'male' ? 'male' : 'female'}\r\n onLoadingCompleted={() => dispatch(storeActions.view.setCharacterLoaded(true))}\r\n camera={presets[cameraPreset || 'default']}\r\n targets={targets}\r\n autoLookAt={true}\r\n detectGpuData={gpuData}\r\n license='fake-license'\r\n />\r\n )}\r\n </div>\r\n {!characterLoaded && (\r\n <div className='rf-absolute rf-top-0 rf-left-0 rf-w-full rf-h-full rf-flex rf-justify-center rf-items-center'>\r\n <div className='rf-w-1/4 rf-aspect-square'>\r\n <MicrophoneLoader />\r\n </div>\r\n </div>\r\n )}\r\n\r\n {openCalibration && loaderClosed && (\r\n <CalibrationScreen\r\n centered={centered}\r\n staticCalibrationEnabled={!!calibration?.static?.enabled}\r\n dynamicCalibrationEnabled={!!calibration?.dynamic?.enabled}\r\n setTargets={(targets: Array<Object3D>) => setTargets(targets)}\r\n dynamicData={dynamicData}\r\n />\r\n )}\r\n </React.Fragment>\r\n )\r\n}\r\n\r\nexport default ThreeJsWrapper\r\nexport type { EyeTrackingData }\r\n","import React, { useEffect, useRef, useState } from 'react'\r\nimport { Object3D, getCameraPosition, getCharacterHeight, setLookAtCamera, setShowFirstTarget } from '@davi-ai/react-bodyengine-three'\r\nimport type { Detection } from '@mediapipe/tasks-vision'\r\nimport { useSelector, useDispatch } from 'react-redux'\r\nimport { RootState, storeActions } from '../../store'\r\nimport FaceDetector from '../Veille/FaceDetector'\r\n\r\ninterface CalibrationScreenProps {\r\n centered: boolean\r\n staticCalibrationEnabled: boolean\r\n dynamicCalibrationEnabled: boolean\r\n dynamicData?: {\r\n webcamHeight: number\r\n ratioPixelToCentimeter: number\r\n deltaAgentHeightAgentWorldHeightInCentimeters: number\r\n cameraRotationInDegrees: number\r\n distanceFromAgentToCameraInCentimeters: number\r\n }\r\n setTargets: (targets: Array<Object3D>) => void\r\n}\r\n\r\nenum CalibrationMode {\r\n none = 1,\r\n static,\r\n dynamic\r\n}\r\n\r\nconst CalibrationScreen = ({ centered, staticCalibrationEnabled, dynamicCalibrationEnabled, dynamicData, setTargets }: CalibrationScreenProps): JSX.Element => {\r\n const dispatch = useDispatch()\r\n const cameraPosition = getCameraPosition()\r\n const characterHeight = getCharacterHeight()\r\n const characterLoaded = useSelector((state: RootState) => state.viewReducer.characterLoaded)\r\n const calibrationCompleted = useSelector((state: RootState) => state.viewReducer.calibrationCompleted)\r\n\r\n const [calibrationMode, setCalibrationMode] = useState<CalibrationMode>(dynamicData ? CalibrationMode.dynamic : CalibrationMode.none)\r\n const [distanceFromDevice, setDistanceFromDevice] = useState<number>(dynamicData?.distanceFromAgentToCameraInCentimeters || 0)\r\n const [webcamRotation, setWebcamRotation] = useState<number>(0)\r\n const [agentEyesHeightOnScreen, setAgentEyesHeightOnScreen] = useState<number>(0)\r\n const [worldDistancePerDegree, setWorldDistancePerDegree] = useState<number>(0)\r\n const [currentAngleInDegrees, setCurrentAngleInDegrees] = useState<number>(0)\r\n const [cameraX, setCameraX] = useState<number>(0)\r\n const [cameraY, setCameraY] = useState<number>(0)\r\n const [cameraZ, setCameraZ] = useState<number>(0)\r\n\r\n const cameraXRef = useRef<number>(0)\r\n const cameraYRef = useRef<number>(0)\r\n const cameraZRef = useRef<number>(0)\r\n const currentAngleInDegreesRef = useRef<number>(0)\r\n const webcamHeightRef = useRef<number>(dynamicData?.webcamHeight || 0)\r\n const userEyesHeightRef = useRef<number>(0)\r\n const agentEyesHeightRef = useRef<number>(0)\r\n const distanceFromDeviceRef = useRef<number>(0)\r\n const webcamRotatedRef = useRef<number>(dynamicData?.cameraRotationInDegrees || 0)\r\n const deltaAgentHeightAgentWorldHeightInCentimetersRef = useRef<number>(dynamicData?.deltaAgentHeightAgentWorldHeightInCentimeters || 0)\r\n const ratioPixelToCentimeterRef = useRef<number>(dynamicData?.ratioPixelToCentimeter || 0)\r\n const calibrationCompletedRef = useRef<boolean>(calibrationCompleted)\r\n const counterRef = useRef<number>(0)\r\n\r\n useEffect(() => {\r\n // If dynamic data are given, let's validate immediately to set calibratoin as completed\r\n dynamicData && handleValidate()\r\n }, [])\r\n\r\n useEffect(() => {\r\n characterLoaded && !dynamicData && setLookAtCamera(true)\r\n\r\n return () => {\r\n setLookAtCamera(false)\r\n }\r\n }, [characterLoaded])\r\n\r\n useEffect(() => {\r\n if (worldDistancePerDegree && !dynamicData) {\r\n const o = new Object3D()\r\n o.position.set(cameraX, cameraY + currentAngleInDegrees * worldDistancePerDegree, Math.max(cameraZ / 5, 0.3))\r\n setTargets([o])\r\n }\r\n }, [currentAngleInDegrees, worldDistancePerDegree, distanceFromDevice, cameraX, cameraY, cameraZ])\r\n\r\n useEffect(() => {\r\n if (cameraPosition && !(cameraPosition.x === 0 && cameraPosition.y === 0)) {\r\n const zDistanceCameraPlusUser = cameraPosition.z + distanceFromDevice / 100\r\n setCameraX(cameraPosition.x)\r\n setCameraY(cameraPosition.y)\r\n setCameraZ(zDistanceCameraPlusUser)\r\n cameraXRef.current = cameraPosition.x\r\n cameraYRef.current = cameraPosition.y\r\n cameraZRef.current = zDistanceCameraPlusUser\r\n // Get Y world distance for one degree using tangent. The z distance is divided by 5 with 0.3 at the lowest to show a visible height bar when calibrating\r\n setWorldDistancePerDegree(Math.tan(Math.PI / 180) * Math.max(zDistanceCameraPlusUser / 5, 0.3))\r\n }\r\n }, [cameraPosition, distanceFromDevice])\r\n\r\n useEffect(() => {\r\n if (!dynamicData) {\r\n characterHeight && agentEyesHeightOnScreen && (deltaAgentHeightAgentWorldHeightInCentimetersRef.current = (characterHeight - characterHeight / 16) * 100 - agentEyesHeightOnScreen)\r\n }\r\n }, [characterHeight, agentEyesHeightOnScreen])\r\n\r\n useEffect(() => {\r\n !dynamicData && (webcamRotatedRef.current = webcamRotation)\r\n }, [webcamRotation])\r\n\r\n useEffect(() => {\r\n calibrationCompletedRef.current = calibrationCompleted\r\n }, [calibrationCompleted])\r\n\r\n useEffect(() => {\r\n if (!dynamicData && calibrationMode === CalibrationMode.static) {\r\n setShowFirstTarget(!calibrationCompleted)\r\n }\r\n }, [calibrationMode, calibrationCompleted])\r\n\r\n const handleReset = () => {\r\n setCurrentAngleInDegrees(0)\r\n currentAngleInDegreesRef.current = 0\r\n }\r\n\r\n const handleValidate = () => {\r\n setLookAtCamera(false)\r\n if (calibrationMode === CalibrationMode.static) {\r\n // In static mode, store the target in local storage to be able to reuse it later and avoid asking the user to calibrate again if the data are valid\r\n localStorage.setItem('Retorik.Framework.Static.Target', JSON.stringify({ x: cameraX, y: cameraY + currentAngleInDegrees * worldDistancePerDegree, z: cameraZ }))\r\n } else if (calibrationMode === CalibrationMode.dynamic && ratioPixelToCentimeterRef.current) {\r\n localStorage.setItem(\r\n 'Retorik.Framework.Dynamic.Data',\r\n JSON.stringify({\r\n webcamHeight: webcamHeightRef.current,\r\n ratioPixelToCentimeter: ratioPixelToCentimeterRef.current,\r\n deltaAgentHeightAgentWorldHeightInCentimeters: deltaAgentHeightAgentWorldHeightInCentimetersRef.current,\r\n cameraRotationInDegrees: webcamRotatedRef.current,\r\n distanceFromAgentToCameraInCentimeters: distanceFromDeviceRef.current\r\n })\r\n )\r\n setTargets([])\r\n }\r\n\r\n dispatch(storeActions.view.setCalibrationCompleted(true))\r\n }\r\n\r\n const handleFaceDetected = (detections?: Array<Detection>, width?: number, height?: number): void => {\r\n counterRef.current++\r\n if (detections?.length && width && height) {\r\n // The detections are inverted in X and Y axis (the origin is the top right corner of the image)\r\n const webcamPositionY = webcamRotatedRef.current === 0 ? height / 2 : width / 2\r\n const userPositionY = webcamRotatedRef.current === 0 ? height * (1 - detections[0].keypoints[0].y) : width * (1 - detections[0].keypoints[0].x)\r\n\r\n if (calibrationCompletedRef.current) {\r\n // Check if the mandatory data have been filled (webcam / agent / user heights + distance user <-> device)\r\n if (webcamHeightRef.current && ratioPixelToCentimeterRef.current && deltaAgentHeightAgentWorldHeightInCentimetersRef.current !== 0) {\r\n const deltaHeightInPixels = webcamPositionY - userPositionY\r\n const userEyesHeightInCentimeters = webcamHeightRef.current - deltaHeightInPixels * ratioPixelToCentimeterRef.current\r\n const targetYInWorldCoordinates = (userEyesHeightInCentimeters + deltaAgentHeightAgentWorldHeightInCentimetersRef.current) / 100\r\n\r\n const o = new Object3D()\r\n o.position.set(cameraXRef.current, targetYInWorldCoordinates, cameraZRef.current)\r\n setTargets([o])\r\n }\r\n } else {\r\n // The detections are inverted in X and Y axis (the origin is the top right corner of the image)\r\n if (webcamHeightRef.current && userEyesHeightRef.current && distanceFromDeviceRef.current) {\r\n // Get the difference in height between the webcam and the user's eyes in cm, then use the detection to get the same difference in pixels on the webcam's image\r\n const deltaHeightInCentimeters = Math.abs(webcamHeightRef.current - userEyesHeightRef.current)\r\n const deltaHeightInPixels = Math.abs(webcamPositionY - userPositionY)\r\n\r\n deltaHeightInPixels && (ratioPixelToCentimeterRef.current = deltaHeightInCentimeters / deltaHeightInPixels)\r\n }\r\n }\r\n }\r\n }\r\n\r\n return (\r\n <div\r\n id='retorik-framework-animation-container-calibration'\r\n className={`rf-absolute rf-top-0 rf-h-full rf-w-full rf-grid rf-grid-cols-1 rf-grid-rows-1 ${!centered && 'landscape-retorik:rf-translate-x-1/4'}`}\r\n >\r\n {calibrationMode === CalibrationMode.dynamic && (\r\n <div className='rf-relative rf-z-1 rf-h-full rf-w-full rf-col-start-1 rf-col-span-1 rf-row-start-1 rf-row-span-1 rf-flex rf-justify-start rf-items-start'>\r\n <FaceDetector detectionThreshold={0.8} onFaceDetected={handleFaceDetected} showThumbnail={!calibrationCompleted} rotation={webcamRotation} />\r\n </div>\r\n )}\r\n\r\n {!calibrationCompleted && (\r\n <React.Fragment>\r\n {calibrationMode === CalibrationMode.none ? (\r\n <div className='rf-h-full rf-w-full rf-col-start-1 rf-col-span-1 rf-row-start-1 rf-row-span-1 rf-flex rf-flex-col rf-justify-center rf-items-center rf-gap-4 rf-bg-white rf-bg-opacity-50'>\r\n <p className='rf-text-medium-size-auto'>Choisissez un mode de calibrage :</p>\r\n <div className='rf-flex rf-flex-row rf-gap-4'>\r\n {staticCalibrationEnabled && (\r\n <div\r\n className='rf-px-4 rf-py-2 rf-border rf-border-primary rf-rounded-lg rf-bg-primary rf-bg-opacity-50 rf-cursor-pointer'\r\n onClick={() => setCalibrationMode(CalibrationMode.static)}\r\n >\r\n STATIQUE\r\n </div>\r\n )}\r\n\r\n {dynamicCalibrationEnabled && (\r\n <div\r\n className='rf-px-4 rf-py-2 rf-border rf-border-primary rf-rounded-lg rf-bg-primary rf-bg-opacity-50 rf-cursor-pointer'\r\n onClick={() => setCalibrationMode(CalibrationMode.dynamic)}\r\n >\r\n DYNAMIQUE\r\n </div>\r\n )}\r\n </div>\r\n </div>\r\n ) : (\r\n <div className='rf-relative rf-h-full rf-w-full rf-col-start-1 rf-col-span-1 rf-row-start-1 rf-row-span-1 rf-flex rf-flex-col rf-justify-center rf-gap-4'>\r\n {calibrationMode === CalibrationMode.dynamic ? (\r\n <div className='rf-absolute rf-left-32 rf-flex rf-flex-col rf-justify-center rf-items-center rf-gap-4'>\r\n <div className='rf-grid rf-grid-cols-2 rf-grid-rows-3 rf-gap-4'>\r\n <p className='rf-font-bold'>Hauteur webcam (en cm)</p>\r\n <input\r\n type='number'\r\n min={0}\r\n max={300}\r\n onChange={(e: React.ChangeEvent<HTMLInputElement>) => {\r\n webcamHeightRef.current = parseInt(e.target.value!)\r\n }}\r\n />\r\n <p className='rf-font-bold'>Votre taille (en cm)</p>\r\n <input\r\n type='number'\r\n min={50}\r\n max={300}\r\n onChange={(e: React.ChangeEvent<HTMLInputElement>) => {\r\n // We estimate the height of the user's eyes is 12 cm less than their total height\r\n userEyesHeightRef.current = parseInt(e.target.value!) - 12\r\n }}\r\n />\r\n <p className='rf-font-bold'>Hauteur des yeux de l'agent (en cm)</p>\r\n <input\r\n type='number'\r\n min={50}\r\n max={300}\r\n onChange={(e: React.ChangeEvent<HTMLInputElement>) => {\r\n setAgentEyesHeightOnScreen(parseInt(e.target.value!))\r\n agentEyesHeightRef.current = parseInt(e.target.value!)\r\n }}\r\n />\r\n <p className='rf-font-bold'>Distance utilisateur - borne (en cm)</p>\r\n <input\r\n type='number'\r\n min={20}\r\n max={100}\r\n onChange={(e: React.ChangeEvent<HTMLInputElement>) => {\r\n setDistanceFromDevice(parseInt(e.target.value!))\r\n distanceFromDeviceRef.current = parseInt(e.target.value!)\r\n }}\r\n />\r\n <p className='rf-font-bold'>Rotation de la webcam (en degrés)</p>\r\n <div className='rf-flex rf-flex-row rf-gap-2'>\r\n <button\r\n className={`rf-px-2 rf-py-1 rf-border rf-border-primary rf-rounded-lg rf-bg-primary rf-bg-opacity-50 rf-cursor-pointer ${webcamRotation === 0 && 'rf-bg-opacity-100'}`}\r\n onClick={() => setWebcamRotation(0)}\r\n >\r\n 0\r\n </button>\r\n <button\r\n className={`rf-px-2 rf-py-1 rf-border rf-border-primary rf-rounded-lg rf-bg-primary rf-bg-opacity-50 rf-cursor-pointer ${webcamRotation === 90 && 'rf-bg-opacity-100'}`}\r\n onClick={() => setWebcamRotation(90)}\r\n >\r\n 90\r\n </button>\r\n <button\r\n className={`rf-px-2 rf-py-1 rf-border rf-border-primary rf-rounded-lg rf-bg-primary rf-bg-opacity-50 rf-cursor-pointer ${webcamRotation === -90 && 'rf-bg-opacity-100'}`}\r\n onClick={() => setWebcamRotation(-90)}\r\n >\r\n -90\r\n </button>\r\n </div>\r\n </div>\r\n\r\n <div className='rf-h-16 rf-w-16 rf-flex rf-justify-center rf-items-center rf-bg-white rf-border rf-border-black rf-rounded-lg hover: rf-cursor-pointer' onClick={handleValidate}>\r\n Done\r\n </div>\r\n </div>\r\n ) : (\r\n <div className='rf-ml-4 rf-flex rf-flex-col rf-gap-4'>\r\n <div className='rf-flex rf-flex-row rf-items-center rf-gap-4'>\r\n <input\r\n type='range'\r\n min={-25}\r\n max={25}\r\n step={1}\r\n value={currentAngleInDegrees}\r\n onChange={(e) => {\r\n const val = parseInt(e.target.value)\r\n setCurrentAngleInDegrees(val)\r\n currentAngleInDegreesRef.current = val\r\n }}\r\n className='rf-range-vertical rf-w-8 rf-h-80 rf-appearance-none rf-border rf-border-black rf-rounded-lg rf-cursor-pointer'\r\n style={{ writingMode: 'vertical-lr', direction: 'rtl' }}\r\n />\r\n <div className='rf-w-fit rf-p-4 rf-flex rf-flex-col rf-justify-center rf-gap-2 rf-bg-white rf-border rf-border-black rf-rounded-lg'>\r\n <p>Position actuelle de la cible : </p>\r\n <p>{`x: ${cameraX}`}</p>\r\n <p>{`y: ${cameraY + (currentAngleInDegrees ? currentAngleInDegrees * worldDistancePerDegree : 0)}`}</p>\r\n <p>{`z: ${Math.max(cameraZ / 5, 0.3)}`}</p>\r\n <p>{`angle: ${currentAngleInDegrees}°`}</p>\r\n </div>\r\n </div>\r\n\r\n <div className='rf-flex rf-flex-row rf-gap-2'>\r\n <div className='rf-h-10 rf-px-4 rf-flex rf-justify-center rf-items-center rf-bg-white rf-border rf-border-black rf-rounded-lg rf-cursor-pointer' onClick={() => handleReset()}>\r\n Reset\r\n </div>\r\n <div className='rf-h-10 rf-px-4 rf-flex rf-justify-center rf-items-center rf-bg-white rf-border rf-border-black rf-rounded-lg rf-cursor-pointer' onClick={handleValidate}>\r\n Done\r\n </div>\r\n </div>\r\n </div>\r\n )}\r\n </div>\r\n )}\r\n </React.Fragment>\r\n )}\r\n </div>\r\n )\r\n}\r\n\r\nexport default CalibrationScreen\r\n","import React, { useEffect, useState, useRef } from 'react'\r\nimport { FaceDetector as MediapipeFaceDetector, FilesetResolver, Detection } from '@mediapipe/tasks-vision'\r\n\r\ninterface FaceDetectorProps {\r\n detectionThreshold: number\r\n onFaceDetected: (detections?: Array<Detection>, imageWidth?: number, imageHeight?: number) => void\r\n showThumbnail?: boolean\r\n rotation?: number\r\n}\r\n\r\nconst runningMode = 'VIDEO'\r\nlet lastVideoTime = -1\r\nconst defaultConstraints: MediaStreamConstraints = {\r\n video: {\r\n facingMode: 'user'\r\n }\r\n}\r\n\r\nconst FaceDetector = ({ detectionThreshold, onFaceDetected, showThumbnail, rotation }: FaceDetectorProps): JSX.Element => {\r\n const [webcamWidth, setWebcamWidth] = useState<number>(0)\r\n const [webcamHeight, setWebcamHeight] = useState<number>(0)\r\n const [faceDetector, setFaceDetector] = useState<MediapipeFaceDetector | undefined>()\r\n const videoRef = useRef<HTMLVideoElement>(null)\r\n const rotationRef = useRef<number>(rotation || 0)\r\n\r\n useEffect(() => {\r\n rotationRef.current = rotation || 0\r\n }, [rotation])\r\n\r\n useEffect(() => {\r\n const createfaceDetector = async () => {\r\n const vision = await FilesetResolver.forVisionTasks('https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.0/wasm')\r\n const newFaceDetector = await MediapipeFaceDetector.createFromOptions(vision, {\r\n baseOptions: {\r\n modelAssetPath: `https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/1/blaze_face_short_range.tflite`,\r\n delegate: 'GPU'\r\n },\r\n runningMode: runningMode\r\n })\r\n\r\n newFaceDetector && setFaceDetector(newFaceDetector)\r\n }\r\n\r\n const initializefaceDetector = async () => {\r\n navigator.mediaDevices\r\n .getUserMedia(defaultConstraints)\r\n .then((display) => {\r\n const settings = display.getVideoTracks()[0].getSettings()\r\n setWebcamWidth(settings.width || 0)\r\n setWebcamHeight(settings.height || 0)\r\n createfaceDetector()\r\n })\r\n .catch((error) => console.warn('Retorik Framework > an error occured when trying to use the webcam : ', error))\r\n }\r\n\r\n initializefaceDetector()\r\n }, [])\r\n\r\n const predictWebcam = async () => {\r\n if (faceDetector && videoRef.current) {\r\n let startTimeMs = performance.now()\r\n\r\n // Detect faces using detectForVideo\r\n if (videoRef.current.currentTime !== lastVideoTime) {\r\n lastVideoTime = videoRef.current.currentTime\r\n const detections = faceDetector.detectForVideo(videoRef.current, startTimeMs, { rotationDegrees: rotationRef.current }).detections\r\n\r\n if (detections.length) {\r\n const score = detections[0].categories[0].score\r\n score > detectionThreshold && onFaceDetected(detections, videoRef.current.videoWidth, videoRef.current.videoHeight)\r\n }\r\n }\r\n }\r\n\r\n // Call this function again to keep predicting when the browser is ready\r\n window.requestAnimationFrame(predictWebcam)\r\n }\r\n\r\n useEffect(() => {\r\n if (faceDetector && videoRef.current) {\r\n // Activate the webcam stream\r\n navigator.mediaDevices\r\n .getUserMedia(defaultConstraints)\r\n .then((stream) => {\r\n if (videoRef.current) {\r\n videoRef.current.srcObject = stream\r\n videoRef.current.addEventListener('loadeddata', predictWebcam)\r\n }\r\n })\r\n .catch((err) => {\r\n console.error(err)\r\n })\r\n }\r\n }, [faceDetector])\r\n\r\n return (\r\n <div id='retorik-framework-face-detector' className={`rf-absolute rf-top-0 rf-left-0 ${!showThumbnail && 'rf-invisible'}`}>\r\n <video\r\n ref={videoRef}\r\n src=''\r\n autoPlay\r\n style={{\r\n rotate: `${rotation}deg`,\r\n width: showThumbnail ? webcamWidth / 2 : webcamWidth,\r\n height: showThumbnail ? webcamHeight / 2 : webcamHeight\r\n }}\r\n />\r\n </div>\r\n )\r\n}\r\n\r\nexport default FaceDetector\r\n"],"names":[],"version":3,"file":"ThreeJsWrapper.cb253b3a.js.map"}
@@ -55,28 +55,16 @@ var $9x9Q9 = parcelRequire("9x9Q9");
55
55
 
56
56
  var $G07Rs = parcelRequire("G07Rs");
57
57
  const $167bfc94e5487988$var$springDuration = 500;
58
- const $167bfc94e5487988$var$veilleRelatedRoutes = [
59
- (0, $7WHA7.Routes).EmptyVeille,
60
- (0, $7WHA7.Routes).NewsInVeille,
61
- (0, $7WHA7.Routes).ScreenSaver,
62
- (0, $7WHA7.Routes).SlideShow
63
- ];
64
- const $167bfc94e5487988$var$VeilleManager = ()=>{
58
+ const $167bfc94e5487988$var$VeilleManager = ({ onClose: onClose })=>{
65
59
  var _veilleConfiguration_views_screenSaver, _veilleConfiguration_views, _veilleConfiguration_views_screenSaver1, _veilleConfiguration_views1, _veilleConfiguration_views_slideShow, _veilleConfiguration_views2, _veilleConfiguration_views_slideShow1, _veilleConfiguration_views3;
66
60
  const dispatch = (0, $ehKZo$reactredux.useDispatch)();
67
- const addressData = (0, $ehKZo$reactredux.useSelector)((state)=>state.retorikReducer.addressData);
68
- const loaderClosed = (0, $ehKZo$reactredux.useSelector)((state)=>state.retorikReducer.loaderClosed);
69
- const appAvailable = (0, $ehKZo$reactredux.useSelector)((state)=>state.retorikReducer.appAvailable);
70
61
  const route = (0, $ehKZo$reactredux.useSelector)((state)=>state.viewReducer.route);
71
62
  const veilleConfiguration = (0, $ehKZo$reactredux.useSelector)((state)=>state.viewReducer.veilleConfiguration);
72
63
  const muted = (0, $ehKZo$reactredux.useSelector)((state)=>state.speechReducer.muted);
73
- const typingCount = (0, $ehKZo$reactredux.useSelector)((state)=>state.directlineReducer.typingCount);
74
- const [veilleLaunched, setVeilleLaunched] = (0, $ehKZo$react.useState)(false);
75
64
  const [loop, setLoop] = (0, $ehKZo$react.useState)(false);
76
65
  const veilleDataRef = (0, $ehKZo$react.useRef)(veilleConfiguration);
77
66
  const availableItemsToDisplayRef = (0, $ehKZo$react.useRef)([]);
78
67
  const currentItemDisplayedRef = (0, $ehKZo$react.useRef)(0);
79
- const timerRef = (0, $ehKZo$react.useRef)(null);
80
68
  const fadeTimerRef = (0, $ehKZo$react.useRef)(null);
81
69
  const oldMutedRef = (0, $ehKZo$react.useRef)(muted);
82
70
  const [spring, api] = (0, $ehKZo$reactspringweb.useSpring)(()=>({
@@ -85,7 +73,7 @@ const $167bfc94e5487988$var$VeilleManager = ()=>{
85
73
  }
86
74
  }));
87
75
  (0, $ehKZo$react.useEffect)(()=>{
88
- veilleLaunched && api.start({
76
+ api.start({
89
77
  from: {
90
78
  opacity: 0
91
79
  },
@@ -96,9 +84,7 @@ const $167bfc94e5487988$var$VeilleManager = ()=>{
96
84
  duration: $167bfc94e5487988$var$springDuration
97
85
  }
98
86
  });
99
- }, [
100
- veilleLaunched
101
- ]);
87
+ }, []);
102
88
  const handleClose = ()=>{
103
89
  api.start({
104
90
  from: {
@@ -117,51 +103,9 @@ const $167bfc94e5487988$var$VeilleManager = ()=>{
117
103
  dispatch((0, $kpW3P.storeActions).speech.setMuted(oldMutedRef.current));
118
104
  // Get back to home view
119
105
  dispatch((0, $kpW3P.storeActions).view.setRoute((0, $7WHA7.Routes).Home));
106
+ onClose();
120
107
  }, $167bfc94e5487988$var$springDuration);
121
108
  };
122
- const launchVeille = async ()=>{
123
- var // Set muted state to true if it is demanded in the configuration
124
- _veilleDataRef_current_views_news, _veilleDataRef_current_views;
125
- // Kill current directline if needed, and create a new one if the news are included in the veille
126
- if (veilleDataRef.current.killConversationOnLaunch) {
127
- var _veilleDataRef_current_views_news1, _veilleDataRef_current_views1;
128
- await dispatch((0, $kpW3P.storeActions).directline.endConversation());
129
- ((_veilleDataRef_current_views1 = veilleDataRef.current.views) === null || _veilleDataRef_current_views1 === void 0 ? void 0 : (_veilleDataRef_current_views_news1 = _veilleDataRef_current_views1.news) === null || _veilleDataRef_current_views_news1 === void 0 ? void 0 : _veilleDataRef_current_views_news1.enabled) && dispatch((0, $kpW3P.storeActions).directline.recreateDirectline({
130
- addressData: addressData,
131
- userId: `veille_${Date.now()}`,
132
- skipWelcome: true
133
- }));
134
- }
135
- ((_veilleDataRef_current_views = veilleDataRef.current.views) === null || _veilleDataRef_current_views === void 0 ? void 0 : (_veilleDataRef_current_views_news = _veilleDataRef_current_views.news) === null || _veilleDataRef_current_views_news === void 0 ? void 0 : _veilleDataRef_current_views_news.muted) && dispatch((0, $kpW3P.storeActions).speech.setMuted(true));
136
- setVeilleLaunched(true);
137
- dispatch((0, $kpW3P.storeActions).view.setRoute(availableItemsToDisplayRef.current.length ? availableItemsToDisplayRef.current[0] : (0, $7WHA7.Routes).EmptyVeille));
138
- };
139
- const refreshTimer = ()=>{
140
- timerRef.current && clearTimeout(timerRef.current);
141
- timerRef.current = setTimeout(()=>{
142
- launchVeille();
143
- }, (veilleDataRef.current.delayBeforeLaunchInSeconds || 120) * 1000);
144
- };
145
- const exitVeille = (firstTime)=>{
146
- var _veilleDataRef_current;
147
- // Recreate directline if needed
148
- if (!firstTime && ((_veilleDataRef_current = veilleDataRef.current) === null || _veilleDataRef_current === void 0 ? void 0 : _veilleDataRef_current.killConversationOnLaunch)) {
149
- var // Reset directline if a new one has already been recreated for the news inside the veille
150
- _veilleDataRef_current_views_news, _veilleDataRef_current_views;
151
- ((_veilleDataRef_current_views = veilleDataRef.current.views) === null || _veilleDataRef_current_views === void 0 ? void 0 : (_veilleDataRef_current_views_news = _veilleDataRef_current_views.news) === null || _veilleDataRef_current_views_news === void 0 ? void 0 : _veilleDataRef_current_views_news.enabled) && dispatch((0, $kpW3P.storeActions).directline.endConversation());
152
- dispatch((0, $kpW3P.storeActions).directline.recreateDirectline({
153
- addressData: addressData
154
- }));
155
- }
156
- setVeilleLaunched(false);
157
- // Set back the current item's index to 0 and clear the timeout
158
- currentItemDisplayedRef.current = 0;
159
- timerRef.current && clearTimeout(timerRef.current);
160
- // Launch the timer for veille opening
161
- refreshTimer();
162
- // Get back to home view if we came here to close the veille
163
- !firstTime && handleClose();
164
- };
165
109
  const switchComponent = ()=>{
166
110
  if (availableItemsToDisplayRef.current.length > currentItemDisplayedRef.current + 1) {
167
111
  currentItemDisplayedRef.current++;
@@ -172,34 +116,20 @@ const $167bfc94e5487988$var$VeilleManager = ()=>{
172
116
  }
173
117
  };
174
118
  (0, $ehKZo$react.useEffect)(()=>{
119
+ var _veilleConfiguration_views_screenSaver, _veilleConfiguration_views, _veilleConfiguration_views_news, _veilleConfiguration_views1, _veilleConfiguration_views_slideShow, _veilleConfiguration_views2, // Mute the sound if the news in veille has to be muted
120
+ _veilleDataRef_current_views_news, _veilleDataRef_current_views;
175
121
  veilleDataRef.current = veilleConfiguration;
176
- if (appAvailable || loaderClosed) {
177
- var _veilleConfiguration_views_screenSaver, _veilleConfiguration_views, _veilleConfiguration_views_news, _veilleConfiguration_views1, _veilleConfiguration_views_slideShow, _veilleConfiguration_views2;
178
- const tempViewArray = [];
179
- ((_veilleConfiguration_views = veilleConfiguration.views) === null || _veilleConfiguration_views === void 0 ? void 0 : (_veilleConfiguration_views_screenSaver = _veilleConfiguration_views.screenSaver) === null || _veilleConfiguration_views_screenSaver === void 0 ? void 0 : _veilleConfiguration_views_screenSaver.enabled) && tempViewArray.push((0, $7WHA7.Routes).ScreenSaver);
180
- ((_veilleConfiguration_views1 = veilleConfiguration.views) === null || _veilleConfiguration_views1 === void 0 ? void 0 : (_veilleConfiguration_views_news = _veilleConfiguration_views1.news) === null || _veilleConfiguration_views_news === void 0 ? void 0 : _veilleConfiguration_views_news.enabled) && tempViewArray.push((0, $7WHA7.Routes).NewsInVeille);
181
- ((_veilleConfiguration_views2 = veilleConfiguration.views) === null || _veilleConfiguration_views2 === void 0 ? void 0 : (_veilleConfiguration_views_slideShow = _veilleConfiguration_views2.slideShow) === null || _veilleConfiguration_views_slideShow === void 0 ? void 0 : _veilleConfiguration_views_slideShow.enabled) && tempViewArray.push((0, $7WHA7.Routes).SlideShow);
182
- // Set loop if there is only 1 item to display
183
- setLoop(tempViewArray.length === 1);
184
- availableItemsToDisplayRef.current = tempViewArray;
185
- exitVeille(true);
186
- }
187
- }, [
188
- veilleConfiguration,
189
- appAvailable,
190
- loaderClosed
191
- ]);
192
- /**
193
- * Refresh the timer of the veille on each typing activity emitted
194
- */ (0, $ehKZo$react.useEffect)(()=>{
195
- !veilleLaunched && refreshTimer();
196
- }, [
197
- typingCount,
198
- veilleLaunched
199
- ]);
200
- (0, $ehKZo$react.useEffect)(()=>{
122
+ const tempViewArray = [];
123
+ ((_veilleConfiguration_views = veilleConfiguration.views) === null || _veilleConfiguration_views === void 0 ? void 0 : (_veilleConfiguration_views_screenSaver = _veilleConfiguration_views.screenSaver) === null || _veilleConfiguration_views_screenSaver === void 0 ? void 0 : _veilleConfiguration_views_screenSaver.enabled) && tempViewArray.push((0, $7WHA7.Routes).ScreenSaver);
124
+ ((_veilleConfiguration_views1 = veilleConfiguration.views) === null || _veilleConfiguration_views1 === void 0 ? void 0 : (_veilleConfiguration_views_news = _veilleConfiguration_views1.news) === null || _veilleConfiguration_views_news === void 0 ? void 0 : _veilleConfiguration_views_news.enabled) && tempViewArray.push((0, $7WHA7.Routes).NewsInVeille);
125
+ ((_veilleConfiguration_views2 = veilleConfiguration.views) === null || _veilleConfiguration_views2 === void 0 ? void 0 : (_veilleConfiguration_views_slideShow = _veilleConfiguration_views2.slideShow) === null || _veilleConfiguration_views_slideShow === void 0 ? void 0 : _veilleConfiguration_views_slideShow.enabled) && tempViewArray.push((0, $7WHA7.Routes).SlideShow);
126
+ // Set loop if there is only 1 item to display
127
+ setLoop(tempViewArray.length === 1);
128
+ availableItemsToDisplayRef.current = tempViewArray;
129
+ currentItemDisplayedRef.current = 0;
130
+ ((_veilleDataRef_current_views = veilleDataRef.current.views) === null || _veilleDataRef_current_views === void 0 ? void 0 : (_veilleDataRef_current_views_news = _veilleDataRef_current_views.news) === null || _veilleDataRef_current_views_news === void 0 ? void 0 : _veilleDataRef_current_views_news.muted) && dispatch((0, $kpW3P.storeActions).speech.setMuted(true));
131
+ dispatch((0, $kpW3P.storeActions).view.setRoute(availableItemsToDisplayRef.current.length ? availableItemsToDisplayRef.current[0] : (0, $7WHA7.Routes).EmptyVeille));
201
132
  return ()=>{
202
- timerRef.current && clearTimeout(timerRef.current);
203
133
  (fadeTimerRef === null || fadeTimerRef === void 0 ? void 0 : fadeTimerRef.current) && clearTimeout(fadeTimerRef.current);
204
134
  // Switch back the muted state (it could have not been changed but for security let's set it)
205
135
  dispatch((0, $kpW3P.storeActions).speech.setMuted(oldMutedRef.current));
@@ -209,16 +139,15 @@ const $167bfc94e5487988$var$VeilleManager = ()=>{
209
139
  children: [
210
140
  /*#__PURE__*/ (0, $ehKZo$reactjsxruntime.jsxs)((0, $ehKZo$reactspringweb.animated).div, {
211
141
  id: "retorik-framework-veille-manager",
212
- className: "rf-relative rf-col-start-1 rf-col-span-full rf-row-start-1 rf-row-span-full rf-grid-cols-8 rf-grid-rows-12",
142
+ className: "rf-relative rf-col-start-1 rf-col-span-full rf-row-start-1 rf-row-span-full rf-grid rf-grid-cols-8 rf-grid-rows-12",
213
143
  style: {
214
- display: $167bfc94e5487988$var$veilleRelatedRoutes.includes(route) ? 'grid' : 'none',
215
144
  ...spring
216
145
  },
217
146
  children: [
218
147
  /*#__PURE__*/ (0, $ehKZo$reactjsxruntime.jsx)((0, $kL6vX.default), {}),
219
- veilleConfiguration.autoExitFromWebcam && veilleLaunched && /*#__PURE__*/ (0, $ehKZo$reactjsxruntime.jsx)((0, $8sMtK.default), {
148
+ veilleConfiguration.autoExitFromWebcam && /*#__PURE__*/ (0, $ehKZo$reactjsxruntime.jsx)((0, $8sMtK.default), {
220
149
  detectionThreshold: 0.95,
221
- onFaceDetected: ()=>exitVeille()
150
+ onFaceDetected: ()=>handleClose()
222
151
  }),
223
152
  route === (0, $7WHA7.Routes).EmptyVeille && /*#__PURE__*/ (0, $ehKZo$reactjsxruntime.jsx)((0, $8KeRZ.default), {}),
224
153
  route === (0, $7WHA7.Routes).NewsInVeille && /*#__PURE__*/ (0, $ehKZo$reactjsxruntime.jsx)((0, $2sSL9.default), {
@@ -244,9 +173,9 @@ const $167bfc94e5487988$var$VeilleManager = ()=>{
244
173
  })
245
174
  ]
246
175
  }),
247
- veilleLaunched && /*#__PURE__*/ (0, $ehKZo$reactjsxruntime.jsx)("div", {
176
+ /*#__PURE__*/ (0, $ehKZo$reactjsxruntime.jsx)("div", {
248
177
  className: "rf-z-overlay rf-col-start-1 rf-col-span-full rf-row-start-1 rf-row-span-full rf-bg-transparent rf-cursor-pointer",
249
- onClick: ()=>exitVeille()
178
+ onClick: ()=>handleClose()
250
179
  })
251
180
  ]
252
181
  });
@@ -321,18 +250,24 @@ $parcel$export(module.exports, "default", () => $8d9a75d3aaaf531b$export$2e2bcd8
321
250
 
322
251
 
323
252
 
324
-
325
253
  const $8d9a75d3aaaf531b$var$runningMode = 'VIDEO';
326
254
  let $8d9a75d3aaaf531b$var$lastVideoTime = -1;
327
- const $8d9a75d3aaaf531b$var$constraints = {
328
- video: true,
329
- facingMode: 'user'
255
+ const $8d9a75d3aaaf531b$var$defaultConstraints = {
256
+ video: {
257
+ facingMode: 'user'
258
+ }
330
259
  };
331
- const $8d9a75d3aaaf531b$var$FaceDetector = ({ detectionThreshold: detectionThreshold, onFaceDetected: onFaceDetected })=>{
332
- const currentWidth = (0, $ehKZo$reactredux.useSelector)((state)=>state.viewReducer.currentWidth);
333
- const currentHeight = (0, $ehKZo$reactredux.useSelector)((state)=>state.viewReducer.currentHeight);
260
+ const $8d9a75d3aaaf531b$var$FaceDetector = ({ detectionThreshold: detectionThreshold, onFaceDetected: onFaceDetected, showThumbnail: showThumbnail, rotation: rotation })=>{
261
+ const [webcamWidth, setWebcamWidth] = (0, $ehKZo$react.useState)(0);
262
+ const [webcamHeight, setWebcamHeight] = (0, $ehKZo$react.useState)(0);
334
263
  const [faceDetector, setFaceDetector] = (0, $ehKZo$react.useState)();
335
264
  const videoRef = (0, $ehKZo$react.useRef)(null);
265
+ const rotationRef = (0, $ehKZo$react.useRef)(rotation || 0);
266
+ (0, $ehKZo$react.useEffect)(()=>{
267
+ rotationRef.current = rotation || 0;
268
+ }, [
269
+ rotation
270
+ ]);
336
271
  (0, $ehKZo$react.useEffect)(()=>{
337
272
  const createfaceDetector = async ()=>{
338
273
  const vision = await (0, $ehKZo$mediapipetasksvision.FilesetResolver).forVisionTasks('https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.0/wasm');
@@ -346,7 +281,10 @@ const $8d9a75d3aaaf531b$var$FaceDetector = ({ detectionThreshold: detectionThres
346
281
  newFaceDetector && setFaceDetector(newFaceDetector);
347
282
  };
348
283
  const initializefaceDetector = async ()=>{
349
- navigator.mediaDevices.getUserMedia($8d9a75d3aaaf531b$var$constraints).then(()=>{
284
+ navigator.mediaDevices.getUserMedia($8d9a75d3aaaf531b$var$defaultConstraints).then((display)=>{
285
+ const settings = display.getVideoTracks()[0].getSettings();
286
+ setWebcamWidth(settings.width || 0);
287
+ setWebcamHeight(settings.height || 0);
350
288
  createfaceDetector();
351
289
  }).catch((error)=>console.warn('Retorik Framework > an error occured when trying to use the webcam : ', error));
352
290
  };
@@ -358,7 +296,9 @@ const $8d9a75d3aaaf531b$var$FaceDetector = ({ detectionThreshold: detectionThres
358
296
  // Detect faces using detectForVideo
359
297
  if (videoRef.current.currentTime !== $8d9a75d3aaaf531b$var$lastVideoTime) {
360
298
  $8d9a75d3aaaf531b$var$lastVideoTime = videoRef.current.currentTime;
361
- const detections = faceDetector.detectForVideo(videoRef.current, startTimeMs).detections;
299
+ const detections = faceDetector.detectForVideo(videoRef.current, startTimeMs, {
300
+ rotationDegrees: rotationRef.current
301
+ }).detections;
362
302
  if (detections.length) {
363
303
  const score = detections[0].categories[0].score;
364
304
  score > detectionThreshold && onFaceDetected(detections, videoRef.current.videoWidth, videoRef.current.videoHeight);
@@ -369,8 +309,8 @@ const $8d9a75d3aaaf531b$var$FaceDetector = ({ detectionThreshold: detectionThres
369
309
  window.requestAnimationFrame(predictWebcam);
370
310
  };
371
311
  (0, $ehKZo$react.useEffect)(()=>{
372
- if (faceDetector && videoRef.current) // Activate the webcam stream.
373
- navigator.mediaDevices.getUserMedia($8d9a75d3aaaf531b$var$constraints).then((stream)=>{
312
+ if (faceDetector && videoRef.current) // Activate the webcam stream
313
+ navigator.mediaDevices.getUserMedia($8d9a75d3aaaf531b$var$defaultConstraints).then((stream)=>{
374
314
  if (videoRef.current) {
375
315
  videoRef.current.srcObject = stream;
376
316
  videoRef.current.addEventListener('loadeddata', predictWebcam);
@@ -383,15 +323,15 @@ const $8d9a75d3aaaf531b$var$FaceDetector = ({ detectionThreshold: detectionThres
383
323
  ]);
384
324
  return /*#__PURE__*/ (0, $ehKZo$reactjsxruntime.jsx)("div", {
385
325
  id: "retorik-framework-face-detector",
386
- className: "rf-absolute rf-top-0 rf-left-0 rf-invisible",
326
+ className: `rf-absolute rf-top-0 rf-left-0 ${!showThumbnail && 'rf-invisible'}`,
387
327
  children: /*#__PURE__*/ (0, $ehKZo$reactjsxruntime.jsx)("video", {
388
328
  ref: videoRef,
389
329
  src: "",
390
330
  autoPlay: true,
391
331
  style: {
392
- width: currentWidth > currentHeight ? currentWidth : undefined,
393
- height: currentHeight > currentWidth ? currentHeight : undefined,
394
- aspectRatio: currentWidth / currentHeight
332
+ rotate: `${rotation}deg`,
333
+ width: showThumbnail ? webcamWidth / 2 : webcamWidth,
334
+ height: showThumbnail ? webcamHeight / 2 : webcamHeight
395
335
  }
396
336
  })
397
337
  });
@@ -566,4 +506,4 @@ var $a2463c3887d0d0a1$export$2e2bcd8739ae039 = $a2463c3887d0d0a1$var$SlideShow;
566
506
 
567
507
 
568
508
 
569
- //# sourceMappingURL=VeilleManager.443b366e.js.map
509
+ //# sourceMappingURL=VeilleManager.26dcadac.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,MAAM,uCAAiB;AAMvB,MAAM,sCAAgB,CAAC,WAAE,OAAO,EAAsB;QA0FrC,wCAAA,4BACE,yCAAA,6BAQD,sCAAA,6BACC,uCAAA;IAnGjB,MAAM,WAAW,CAAA,GAAA,6BAAU;IAC3B,MAAM,QAAQ,CAAA,GAAA,6BAAU,EAAE,CAAC,QAAqB,MAAM,WAAW,CAAC,KAAK;IACvE,MAAM,sBAAsB,CAAA,GAAA,6BAAU,EAAE,CAAC,QAAqB,MAAM,WAAW,CAAC,mBAAmB;IACnG,MAAM,QAAQ,CAAA,GAAA,6BAAU,EAAE,CAAC,QAAqB,MAAM,aAAa,CAAC,KAAK;IAEzE,MAAM,CAAC,MA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ction.tsx","src/components/Icons/Miscellaneous/TouchIcon.tsx","src/components/Veille/FaceDetector.tsx","src/components/Veille/EmptyVeille.tsx","src/components/Veille/ScreenSaver.tsx","src/components/Veille/SlideShow.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react'\r\nimport { useSpring, animated } from '@react-spring/web'\r\nimport { useSelector, useDispatch } from 'react-redux'\r\nimport { RootState, storeActions } from '../../store'\r\n\r\nimport { Routes } from '../../models/enums'\r\nimport type { VeilleConfiguration } from '../../models/types'\r\n\r\nimport NewsView from '../Views/NewsView'\r\nimport CallToAction from './CallToAction'\r\nimport FaceDetector from './FaceDetector'\r\nimport EmptyVeille from './EmptyVeille'\r\nimport ScreenSaver from './ScreenSaver'\r\nimport SlideShow from './SlideShow'\r\n\r\nconst springDuration = 500\r\n\r\ninterface VeilleManagerProps {\r\n onClose: () => void\r\n}\r\n\r\nconst VeilleManager = ({ onClose }: VeilleManagerProps) => {\r\n const dispatch = useDispatch()\r\n const route = useSelector((state: RootState) => state.viewReducer.route)\r\n const veilleConfiguration = useSelector((state: RootState) => state.viewReducer.veilleConfiguration)\r\n const muted = useSelector((state: RootState) => state.speechReducer.muted)\r\n\r\n const [loop, setLoop] = useState<boolean>(false)\r\n\r\n const veilleDataRef = useRef<VeilleConfiguration>(veilleConfiguration)\r\n const availableItemsToDisplayRef = useRef<Array<Routes>>([])\r\n const currentItemDisplayedRef = useRef<number>(0)\r\n const fadeTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)\r\n const oldMutedRef = useRef<boolean>(muted)\r\n\r\n const [spring, api] = useSpring(() => ({\r\n from: { opacity: 0 }\r\n }))\r\n\r\n useEffect(() => {\r\n api.start({\r\n from: { opacity: 0 },\r\n to: { opacity: 1 },\r\n config: { duration: springDuration }\r\n })\r\n }, [])\r\n\r\n const handleClose = (): void => {\r\n api.start({\r\n from: { opacity: 1 },\r\n to: { opacity: 0 },\r\n config: { duration: springDuration }\r\n })\r\n\r\n fadeTimerRef?.current && clearTimeout(fadeTimerRef.current)\r\n fadeTimerRef.current = setTimeout(() => {\r\n // Switch back the muted state (it could have not been changed but for security let's set it)\r\n dispatch(storeActions.speech.setMuted(oldMutedRef.current))\r\n // Get back to home view\r\n dispatch(storeActions.view.setRoute(Routes.Home))\r\n onClose()\r\n }, springDuration)\r\n }\r\n\r\n const switchComponent = (): void => {\r\n if (availableItemsToDisplayRef.current.length > currentItemDisplayedRef.current + 1) {\r\n currentItemDisplayedRef.current++\r\n dispatch(storeActions.view.setRoute(availableItemsToDisplayRef.current[currentItemDisplayedRef.current]))\r\n } else {\r\n currentItemDisplayedRef.current = 0\r\n dispatch(storeActions.view.setRoute(availableItemsToDisplayRef.current[0]))\r\n }\r\n }\r\n\r\n useEffect(() => {\r\n veilleDataRef.current = veilleConfiguration\r\n const tempViewArray: Array<Routes> = []\r\n veilleConfiguration.views?.screenSaver?.enabled && tempViewArray.push(Routes.ScreenSaver)\r\n veilleConfiguration.views?.news?.enabled && tempViewArray.push(Routes.NewsInVeille)\r\n veilleConfiguration.views?.slideShow?.enabled && tempViewArray.push(Routes.SlideShow)\r\n // Set loop if there is only 1 item to display\r\n setLoop(tempViewArray.length === 1)\r\n availableItemsToDisplayRef.current = tempViewArray\r\n currentItemDisplayedRef.current = 0\r\n // Mute the sound if the news in veille has to be muted\r\n veilleDataRef.current.views?.news?.muted && dispatch(storeActions.speech.setMuted(true))\r\n dispatch(storeActions.view.setRoute(availableItemsToDisplayRef.current.length ? availableItemsToDisplayRef.current[0] : Routes.EmptyVeille))\r\n\r\n return () => {\r\n fadeTimerRef?.current && clearTimeout(fadeTimerRef.current)\r\n // Switch back the muted state (it could have not been changed but for security let's set it)\r\n dispatch(storeActions.speech.setMuted(oldMutedRef.current))\r\n }\r\n }, [])\r\n\r\n return (\r\n <React.Fragment>\r\n <animated.div\r\n id='retorik-framework-veille-manager'\r\n className='rf-relative rf-col-start-1 rf-col-span-full rf-row-start-1 rf-row-span-full rf-grid rf-grid-cols-8 rf-grid-rows-12'\r\n style={{\r\n ...spring\r\n }}\r\n >\r\n <CallToAction />\r\n {veilleConfiguration.autoExitFromWebcam && <FaceDetector detectionThreshold={0.95} onFaceDetected={() => handleClose()} />}\r\n\r\n {route === Routes.EmptyVeille && <EmptyVeille />}\r\n {route === Routes.NewsInVeille && <NewsView hideMenu={true} isRetorikNews={true} handleEndedWithoutloop={switchComponent} loop={loop} fromVeille={true} />}\r\n {route === Routes.ScreenSaver && (\r\n <ScreenSaver\r\n url={veilleConfiguration.views?.screenSaver?.url}\r\n timer={veilleConfiguration.views?.screenSaver?.timerBeforeSwitchInSeconds}\r\n loop={loop}\r\n springDuration={springDuration}\r\n switchComponent={switchComponent}\r\n />\r\n )}\r\n {route === Routes.SlideShow && (\r\n <SlideShow\r\n urls={veilleConfiguration.views?.slideShow?.urls}\r\n timer={veilleConfiguration.views?.slideShow?.timerBeforeSwitchInSeconds}\r\n loop={loop}\r\n springDuration={springDuration}\r\n switchComponent={switchComponent}\r\n />\r\n )}\r\n </animated.div>\r\n\r\n {/* Overlay to exit the veille */}\r\n <div className='rf-z-overlay rf-col-start-1 rf-col-span-full rf-row-start-1 rf-row-span-full rf-bg-transparent rf-cursor-pointer' onClick={() => handleClose()} />\r\n </React.Fragment>\r\n )\r\n}\r\n\r\nexport default VeilleManager\r\n","import React, { useState } from 'react'\r\nimport { useSelector } from 'react-redux'\r\nimport { RootState } from '../../store'\r\nimport { getColorWithTransparency } from '../../utils/colorUtils'\r\nimport TouchIcon from '../Icons/Miscellaneous/TouchIcon'\r\n\r\nconst CallToAction = (): JSX.Element => {\r\n const themeColors = useSelector((state: RootState) => state.viewReducer.themeColors)\r\n const [colorWithTransparency] = useState<string>(getColorWithTransparency(themeColors.primary, 0.5))\r\n\r\n return (\r\n <div className='rf-absolute rf-z-ui rf-bottom-0 rf-right-0 rf-w-80 rf-h-80 rf-grid rf-grid-cols-1 rf-grid-rows-1 rf-justify-end rf-justify-items-end rf-content-end rf-items-end rf-text-center rf-overflow-hidden rf-z-10'>\r\n <div className='rf-relative rf-col-start-1 rf-col-end-2 rf-row-start-1 rf-row-end-2 rf-w-48 rf-h-36 rf-rotate-45 rf-translate-y-8' style={{ backgroundColor: colorWithTransparency }}></div>\r\n <div className='rf-relative rf-col-start-1 rf-col-end-2 rf-row-start-1 rf-row-end-2 rf-w-50 rf-h-32 rf-flex rf-flex-col rf-gap-2 rf-justify-center rf-items-center rf-text-white'>\r\n <TouchIcon />\r\n <p className='rf-mx-4'>Click on screen to start</p>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default CallToAction\r\n","import React from \"react\";\r\nimport type { IconDefaultProps } from '../../../models/types'\r\n\r\nconst TouchIcon = ({ className, color }: IconDefaultProps) => {\r\n return (\r\n <svg\r\n viewBox=\"0 0 48 67\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n stroke={color || 'currentColor'}\r\n fill={color || 'currentColor'}\r\n className={className || 'rf-h-12 rf-w-12'}\r\n >\r\n <path\r\n d=\"m41 24c-1.7 0-3.2 0.65-4.4 1.7-1.2-1.1-2.7-1.7-4.4-1.7-1.7 0-3.2 0.65-4.4 1.7-0.48-0.44-1-0.8-1.6-1.1 2.1-2.6 3.4-6 3.4-9.5 2.8e-4 -8.3-6.7-15-15-15-8.3 0-15 6.7-15 15 0 5.8 3.3 11 8.4 13v18c0 11 8.9 20 20 20 11 0 20-8.9 20-20v-16c0-3.6-2.9-6.6-6.6-6.6zm-37-8.8c0-5.9 4.8-11 11-11 5.9 0 11 4.8 11 11 0 3.4-1.6 6.5-4.1 8.5v-8.5c0-3.6-2.9-6.6-6.6-6.6-3.6 0-6.6 2.9-6.6 6.6v8.5c-2.6-2-4.1-5.1-4.1-8.5zm39 32c0 8.5-6.9 15-15 15-8.5 0-15-6.9-15-15v-20c4e-3 -0.072 4e-3 -0.14 0-0.22v-12c0-1.2 1-2.3 2.3-2.3 1.2 0 2.3 1 2.3 2.3v20c0 1.2 0.96 2.1 2.1 2.1 1.2 0 2.1-0.96 2.1-2.1v-4.7c0-1.2 1-2.3 2.3-2.3s2.3 1 2.3 2.3v4.7c0 1.2 0.96 2.1 2.1 2.1 1.2 0 2.1-0.96 2.1-2.1v-4.7c0-1.2 1-2.3 2.3-2.3 1.2 0 2.3 1 2.3 2.3v4.7c0 1.2 0.96 2.1 2.1 2.1s2.1-0.96 2.1-2.1v-4.7c0-1.2 1-2.3 2.3-2.3 1.2 0 2.3 1 2.3 2.3v16z\"\r\n strokeWidth=\".29\"\r\n />\r\n </svg>\r\n );\r\n};\r\n\r\nexport default TouchIcon;\r\n","import React, { useEffect, useState, useRef } from 'react'\r\nimport { FaceDetector as MediapipeFaceDetector, FilesetResolver, Detection } from '@mediapipe/tasks-vision'\r\n\r\ninterface FaceDetectorProps {\r\n detectionThreshold: number\r\n onFaceDetected: (detections?: Array<Detection>, imageWidth?: number, imageHeight?: number) => void\r\n showThumbnail?: boolean\r\n rotation?: number\r\n}\r\n\r\nconst runningMode = 'VIDEO'\r\nlet lastVideoTime = -1\r\nconst defaultConstraints: MediaStreamConstraints = {\r\n video: {\r\n facingMode: 'user'\r\n }\r\n}\r\n\r\nconst FaceDetector = ({ detectionThreshold, onFaceDetected, showThumbnail, rotation }: FaceDetectorProps): JSX.Element => {\r\n const [webcamWidth, setWebcamWidth] = useState<number>(0)\r\n const [webcamHeight, setWebcamHeight] = useState<number>(0)\r\n const [faceDetector, setFaceDetector] = useState<MediapipeFaceDetector | undefined>()\r\n const videoRef = useRef<HTMLVideoElement>(null)\r\n const rotationRef = useRef<number>(rotation || 0)\r\n\r\n useEffect(() => {\r\n rotationRef.current = rotation || 0\r\n }, [rotation])\r\n\r\n useEffect(() => {\r\n const createfaceDetector = async () => {\r\n const vision = await FilesetResolver.forVisionTasks('https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.0/wasm')\r\n const newFaceDetector = await MediapipeFaceDetector.createFromOptions(vision, {\r\n baseOptions: {\r\n modelAssetPath: `https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/1/blaze_face_short_range.tflite`,\r\n delegate: 'GPU'\r\n },\r\n runningMode: runningMode\r\n })\r\n\r\n newFaceDetector && setFaceDetector(newFaceDetector)\r\n }\r\n\r\n const initializefaceDetector = async () => {\r\n navigator.mediaDevices\r\n .getUserMedia(defaultConstraints)\r\n .then((display) => {\r\n const settings = display.getVideoTracks()[0].getSettings()\r\n setWebcamWidth(settings.width || 0)\r\n setWebcamHeight(settings.height || 0)\r\n createfaceDetector()\r\n })\r\n .catch((error) => console.warn('Retorik Framework > an error occured when trying to use the webcam : ', error))\r\n }\r\n\r\n initializefaceDetector()\r\n }, [])\r\n\r\n const predictWebcam = async () => {\r\n if (faceDetector && videoRef.current) {\r\n let startTimeMs = performance.now()\r\n\r\n // Detect faces using detectForVideo\r\n if (videoRef.current.currentTime !== lastVideoTime) {\r\n lastVideoTime = videoRef.current.currentTime\r\n const detections = faceDetector.detectForVideo(videoRef.current, startTimeMs, { rotationDegrees: rotationRef.current }).detections\r\n\r\n if (detections.length) {\r\n const score = detections[0].categories[0].score\r\n score > detectionThreshold && onFaceDetected(detections, videoRef.current.videoWidth, videoRef.current.videoHeight)\r\n }\r\n }\r\n }\r\n\r\n // Call this function again to keep predicting when the browser is ready\r\n window.requestAnimationFrame(predictWebcam)\r\n }\r\n\r\n useEffect(() => {\r\n if (faceDetector && videoRef.current) {\r\n // Activate the webcam stream\r\n navigator.mediaDevices\r\n .getUserMedia(defaultConstraints)\r\n .then((stream) => {\r\n if (videoRef.current) {\r\n videoRef.current.srcObject = stream\r\n videoRef.current.addEventListener('loadeddata', predictWebcam)\r\n }\r\n })\r\n .catch((err) => {\r\n console.error(err)\r\n })\r\n }\r\n }, [faceDetector])\r\n\r\n return (\r\n <div id='retorik-framework-face-detector' className={`rf-absolute rf-top-0 rf-left-0 ${!showThumbnail && 'rf-invisible'}`}>\r\n <video\r\n ref={videoRef}\r\n src=''\r\n autoPlay\r\n style={{\r\n rotate: `${rotation}deg`,\r\n width: showThumbnail ? webcamWidth / 2 : webcamWidth,\r\n height: showThumbnail ? webcamHeight / 2 : webcamHeight\r\n }}\r\n />\r\n </div>\r\n )\r\n}\r\n\r\nexport default FaceDetector\r\n","import React from 'react'\r\n\r\nconst EmptyVeille = () => {\r\n return (\r\n <div className='rf-col-start-1 rf-col-span-full rf-row-start-1 rf-row-span-full rf-bg-black rf-flex rf-justify-center rf-items-center'>\r\n <div className='rf-uppercase rf-font-bold rf-text-3xl rf-text-white rf-animate-pulse'>click or tap on the screen...</div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default EmptyVeille\r\n","import React, { useEffect, useRef } from 'react'\r\nimport { useSpring, animated } from '@react-spring/web'\r\n\r\ninterface ScreenSaverProps {\r\n url?: string\r\n timer?: number\r\n loop?: boolean\r\n springDuration: number\r\n switchComponent: () => void\r\n}\r\n\r\nconst ScreenSaver = ({ url, timer, loop, springDuration, switchComponent }: ScreenSaverProps) => {\r\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null)\r\n const fadeTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)\r\n\r\n const [spring, api] = useSpring(() => ({\r\n from: {\r\n opacity: 0\r\n }\r\n }))\r\n\r\n useEffect(() => {\r\n api.start({\r\n from: {\r\n opacity: 0\r\n },\r\n to: {\r\n opacity: 1\r\n },\r\n config: {\r\n duration: springDuration\r\n }\r\n })\r\n }, [])\r\n\r\n const handleClose = (): void => {\r\n api.start({\r\n from: {\r\n opacity: 1\r\n },\r\n to: {\r\n opacity: 0\r\n },\r\n config: {\r\n duration: springDuration\r\n }\r\n })\r\n\r\n fadeTimerRef?.current && clearTimeout(fadeTimerRef.current)\r\n fadeTimerRef.current = setTimeout(() => {\r\n // Get back to home view\r\n switchComponent()\r\n }, springDuration)\r\n }\r\n\r\n useEffect(() => {\r\n if (!loop) {\r\n timerRef.current = setTimeout(() => {\r\n handleClose()\r\n }, (timer || 8) * 1000 - springDuration)\r\n }\r\n\r\n return () => {\r\n timerRef.current && clearTimeout(timerRef.current)\r\n fadeTimerRef.current && clearTimeout(fadeTimerRef.current)\r\n }\r\n }, [])\r\n\r\n return (\r\n <animated.div\r\n className='rf-col-start-1 rf-col-span-full rf-row-start-1 rf-row-span-full'\r\n style={{\r\n backgroundImage: `url(${url})`,\r\n backgroundPosition: 'center',\r\n backgroundRepeat: 'no-repeat',\r\n backgroundSize: 'cover',\r\n ...spring\r\n }}\r\n />\r\n )\r\n}\r\n\r\nexport default ScreenSaver\r\n","import React, { useEffect, useState, useRef } from 'react'\r\nimport { useSpring, animated } from '@react-spring/web'\r\n\r\ninterface SlideShowProps {\r\n urls?: Array<string>\r\n timer?: number\r\n loop?: boolean\r\n springDuration: number\r\n switchComponent: () => void\r\n}\r\n\r\nconst SlideShow = ({ urls, timer, loop, springDuration, switchComponent }: SlideShowProps) => {\r\n const [currentIndex, setCurrentIndex] = useState<number>(0)\r\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null)\r\n const fadeTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)\r\n\r\n const [spring, api] = useSpring(() => ({\r\n from: {\r\n opacity: 0\r\n }\r\n }))\r\n\r\n useEffect(() => {\r\n api.start({\r\n from: {\r\n opacity: 0\r\n },\r\n to: {\r\n opacity: 1\r\n },\r\n config: {\r\n duration: springDuration\r\n }\r\n })\r\n }, [])\r\n\r\n const handleClose = (): void => {\r\n api.start({\r\n from: {\r\n opacity: 1\r\n },\r\n to: {\r\n opacity: 0\r\n },\r\n config: {\r\n duration: springDuration\r\n }\r\n })\r\n\r\n fadeTimerRef?.current && clearTimeout(fadeTimerRef.current)\r\n fadeTimerRef.current = setTimeout(() => {\r\n // Get back to home view\r\n switchComponent()\r\n }, springDuration)\r\n }\r\n\r\n useEffect(() => {\r\n timerRef?.current && clearTimeout(timerRef.current)\r\n if (urls?.length) {\r\n timerRef.current = setTimeout(() => {\r\n currentIndex === urls.length - 1 ? (loop ? setCurrentIndex(0) : handleClose()) : setCurrentIndex(currentIndex + 1)\r\n }, (timer || 5) * 1000)\r\n } else {\r\n switchComponent()\r\n }\r\n }, [currentIndex])\r\n\r\n useEffect(() => {\r\n return () => {\r\n timerRef?.current && clearTimeout(timerRef.current)\r\n fadeTimerRef?.current && clearTimeout(fadeTimerRef.current)\r\n }\r\n }, [])\r\n\r\n return (\r\n <animated.div className='rf-col-start-1 rf-col-span-full rf-row-start-1 rf-row-span-full rf-flex rf-justify-center rf-items-center rf-bg-black' style={{ ...spring }}>\r\n <img className={`${window.innerHeight > window.innerWidth ? 'rf-w-full' : 'rf-h-full'}`} src={urls?.[currentIndex] || ''} alt='slideshow' />\r\n </animated.div>\r\n )\r\n}\r\n\r\nexport default SlideShow\r\n"],"names":[],"version":3,"file":"VeilleManager.26dcadac.js.map","sourceRoot":"../"}