/* Metro module 7738; source: modules/video_calls/native/useDraggablePip.tsx; dependencies: [57, 7715, 7722, 4017, 4504, 1305, 7739, 5321, 4577, 2] */ import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */ import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as NativeModule from '../../../design/void/native.tsx'; /* Metro dependency 1305 */ import * as ReanimatedRexportModule from '../../reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */ import * as TimingModule from '../../../design/animation/reanimated/timing/timing.tsx'; /* Metro dependency 4504 */ import * as SpringModule from '../../../design/animation/reanimated/spring/spring.tsx'; /* Metro dependency 4577 */ import * as Module05321Module from '../../../by-id/module-05321.js'; /* Metro dependency 5321 */ import * as ChannelCallStoreModule from './ChannelCallStore.tsx'; /* Metro dependency 7715 */ import * as ConstantsModule from './components/Constants.tsx'; /* Metro dependency 7722 */ import * as CheapWorkletShallowEqualModule from '../../reanimated/native/cheapWorkletShallowEqual.tsx'; /* Metro dependency 7739 */ function _fun61935(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#61935, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7916:6, offset: 0x01b4ef5b, size: 453 bytes, params: 8, frame: 18 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_6 = {'mass': 1, 'stiffness': 250, 'overshootClamping': true, 'restSpeedThreshold': 0.001, 'restDisplacementThreshold': 0.001, 'damping': 20}; object = {code: 'function useDraggablePipTsx1(){const{withTiming,pipFocus,PIP_FOCUS_SCALE,STANDARD_EASING}=this.__closure;return withTiming(pipFocus?PIP_FOCUS_SCALE:1,{easing:STANDARD_EASING,duration:250});}'}; object = {code: 'function useDraggablePipTsx2(){const{width}=this.__closure;return width;}'}; object = {code: 'function useDraggablePipTsx3(){const{height}=this.__closure;return height;}'}; object = {code: 'function useDraggablePipTsx4(){const{pipScale,width}=this.__closure;return pipScale.get()*width;}'}; object = {code: 'function useDraggablePipTsx5(){const{pipScale,height}=this.__closure;return pipScale.get()*height;}'}; object = {code: 'function useDraggablePipTsx6(){const{containerWidth}=this.__closure;return containerWidth;}'}; object = {code: 'function useDraggablePipTsx7(){const{containerHeight}=this.__closure;return containerHeight;}'}; object = {code: 'function useDraggablePipTsx8(){const{containerWidth,scaledWidthDv,xPosition}=this.__closure;return[containerWidth-scaledWidthDv.get(),xPosition.get()];}'}; object = {code: 'function useDraggablePipTsx9(result,previous){const{cheapWorkletArrayShallowEqual,clamp,xPosition,xDestination}=this.__closure;if(cheapWorkletArrayShallowEqual(result,previous!==null&&previous!==void 0?previous:undefined))return;const[containerWidthNew,xPositionNew]=result;const[containerWidthOld]=previous!==null&&previous!==void 0?previous:[0,0];if(previous!=null&&containerWidthNew!==containerWidthOld){const newX=clamp(xPositionNew*(containerWidthNew/containerWidthOld),0,containerWidthNew);xPosition.set(newX);xDestination.set(newX);}}'}; object = {code: 'function useDraggablePipTsx10(){const{containerHeight,scaledHeightDv,yPosition}=this.__closure;return[containerHeight-scaledHeightDv.get(),yPosition.get()];}'}; object = {code: 'function useDraggablePipTsx11(result,previous){const{cheapWorkletArrayShallowEqual,clamp,yPosition,yDestination}=this.__closure;if(cheapWorkletArrayShallowEqual(result,previous!==null&&previous!==void 0?previous:undefined))return;const[containerHeightNew,yPositionNew]=result;const[containerHeightOld]=previous!==null&&previous!==void 0?previous:[0,0];if(previous!=null&&containerHeightNew!==containerHeightOld){const newY=clamp(yPositionNew*(containerHeightNew/containerHeightOld),0,containerHeightNew);yPosition.set(newY);yDestination.set(newY);}}'}; object = {code: 'function useDraggablePipTsx12(event){const{xPosition,containerWidthDv,scaledWidthDv,clamp,yPosition,containerHeightDv,scaledHeightDv,snapToCorners,withSpring,spring,xDestination,yDestination}=this.__closure;const toss=0.0875;const xToss=xPosition.get()+toss*event.velocityX;const xMin=0;const xMax=containerWidthDv.get()-scaledWidthDv.get();const targetX=clamp(xToss,xMin,xMax);const yToss=yPosition.get()+toss*event.velocityY;const yMin=0;const yMax=containerHeightDv.get()-scaledHeightDv.get();const targetY=clamp(yToss,yMin,yMax);const top=targetY;const bottom=containerHeightDv.get()-scaledHeightDv.get()-targetY;const left=targetX;const right=containerWidthDv.get()-scaledWidthDv.get()-targetX;const minDistance=Math.min(top,bottom,left,right);let snapX=targetX;let snapY=targetY;switch(minDistance){case top:snapY=yMin;if(snapToCorners){snapX=left