@siberiacancode/reactuse 0.0.56 → 0.0.57

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.
Files changed (230) hide show
  1. package/dist/cjs/{_rollupPluginBabelHelpers-CiUitFXn.js → _rollupPluginBabelHelpers-B7esNF5y.js} +2 -2
  2. package/dist/cjs/_rollupPluginBabelHelpers-B7esNF5y.js.map +1 -0
  3. package/dist/cjs/hooks/index.js +2 -2
  4. package/dist/cjs/hooks/useAsync/useAsync.js +2 -2
  5. package/dist/cjs/hooks/useBattery/useBattery.js +2 -2
  6. package/dist/cjs/hooks/useBoolean/useBoolean.js +2 -2
  7. package/dist/cjs/hooks/useBreakpoints/constants/breakpoints.js +1 -1
  8. package/dist/cjs/hooks/useBreakpoints/useBreakpoints.js +2 -2
  9. package/dist/cjs/hooks/useBrowserLanguage/useBrowserLanguage.js +1 -1
  10. package/dist/cjs/hooks/useClickOutside/useClickOutside.js +2 -2
  11. package/dist/cjs/hooks/useClipboard/useClipboard.js +2 -2
  12. package/dist/cjs/hooks/useCounter/useCounter.js +2 -2
  13. package/dist/cjs/hooks/useDebounceCallback/useDebounceCallback.js +1 -1
  14. package/dist/cjs/hooks/useDebounceValue/useDebounceValue.js +2 -2
  15. package/dist/cjs/hooks/useDefault/useDefault.js +2 -2
  16. package/dist/cjs/hooks/useDidUpdate/useDidUpdate.js +1 -1
  17. package/dist/cjs/hooks/useDisclosure/useDisclosure.js +2 -2
  18. package/dist/cjs/hooks/useDocumentEvent/useDocumentEvent.js +1 -1
  19. package/dist/cjs/hooks/useDocumentTitle/useDocumentTitle.js +2 -2
  20. package/dist/cjs/hooks/useDocumentVisibility/useDocumentVisibility.js +1 -1
  21. package/dist/cjs/hooks/useEvent/useEvent.js +1 -1
  22. package/dist/cjs/hooks/useEventListener/useEventListener.js +1 -1
  23. package/dist/cjs/hooks/useEyeDropper/useEyeDropper.js +2 -2
  24. package/dist/cjs/hooks/useFavicon/useFavicon.js +2 -2
  25. package/dist/cjs/hooks/useField/useField.js +2 -2
  26. package/dist/cjs/hooks/useField/useField.js.map +1 -1
  27. package/dist/cjs/hooks/useFileDialog/useFileDialog.js +2 -2
  28. package/dist/cjs/hooks/useFps/useFps.js +2 -2
  29. package/dist/cjs/hooks/useFullscreen/useFullscreen.js +2 -2
  30. package/dist/cjs/hooks/useGeolocation/useGeolocation.js +2 -2
  31. package/dist/cjs/hooks/useGeolocation/useGeolocation.js.map +1 -1
  32. package/dist/cjs/hooks/useHash/useHash.js +2 -2
  33. package/dist/cjs/hooks/useHotkeys/useHotkeys.js +2 -2
  34. package/dist/cjs/hooks/useHotkeys/useHotkeys.js.map +1 -1
  35. package/dist/cjs/hooks/useHover/useHover.js +2 -2
  36. package/dist/cjs/hooks/useIdle/useIdle.js +2 -2
  37. package/dist/cjs/hooks/useImage/useImage.js +2 -2
  38. package/dist/cjs/hooks/useInfiniteScroll/useInfiniteScroll.js +2 -2
  39. package/dist/cjs/hooks/useIntersectionObserver/useIntersectionObserver.js +2 -2
  40. package/dist/cjs/hooks/useInterval/useInterval.js +2 -2
  41. package/dist/cjs/hooks/useIsFirstRender/useIsFirstRender.js +1 -1
  42. package/dist/cjs/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +1 -1
  43. package/dist/cjs/hooks/useKeyPress/useKeyPress.js +2 -2
  44. package/dist/cjs/hooks/useKeyPressEvent/useKeyPressEvent.js +1 -1
  45. package/dist/cjs/hooks/useKeyboard/useKeyboard.js +1 -1
  46. package/dist/cjs/hooks/useKeysPressed/useKeysPressed.js +2 -2
  47. package/dist/cjs/hooks/useKeysPressed/useKeysPressed.js.map +1 -1
  48. package/dist/cjs/hooks/useList/useList.js +2 -2
  49. package/dist/cjs/hooks/useLocalStorage/useLocalStorage.js +2 -2
  50. package/dist/cjs/hooks/useLogger/useLogger.js +2 -2
  51. package/dist/cjs/hooks/useLongPress/useLongPress.js +2 -2
  52. package/dist/cjs/hooks/useMap/useMap.js +2 -2
  53. package/dist/cjs/hooks/useMeasure/useMeasure.js +2 -2
  54. package/dist/cjs/hooks/useMediaQuery/useMediaQuery.js +1 -1
  55. package/dist/cjs/hooks/useMemory/useMemory.js +2 -2
  56. package/dist/cjs/hooks/useMount/useMount.js +1 -1
  57. package/dist/cjs/hooks/useMouse/useMouse.js +2 -2
  58. package/dist/cjs/hooks/useMutation/useMutation.js +2 -2
  59. package/dist/cjs/hooks/useMutationObserver.js +1 -1
  60. package/dist/cjs/hooks/useNetwork/useNetwork.js +2 -2
  61. package/dist/cjs/hooks/useOnline/useOnline.js +1 -1
  62. package/dist/cjs/hooks/useOperatingSystem/useOperatingSystem.js +1 -1
  63. package/dist/cjs/hooks/useOrientation/useOrientation.js +2 -2
  64. package/dist/cjs/hooks/usePageLeave/usePageLeave.js +2 -2
  65. package/dist/cjs/hooks/usePaint/helpers/Paint.js +2 -2
  66. package/dist/cjs/hooks/usePaint/helpers/Pointer.js +2 -2
  67. package/dist/cjs/hooks/usePaint/usePaint.js +2 -2
  68. package/dist/cjs/hooks/usePermission/usePermission.js +2 -2
  69. package/dist/cjs/hooks/usePreferredColorScheme/usePreferredColorScheme.js +1 -1
  70. package/dist/cjs/hooks/usePreferredContrast/usePreferredContrast.js +1 -1
  71. package/dist/cjs/hooks/usePreferredDark/usePreferredDark.js +1 -1
  72. package/dist/cjs/hooks/usePreferredLanguages/usePreferredLanguages.js +1 -1
  73. package/dist/cjs/hooks/usePreferredReducedMotion/usePreferredReducedMotion.js +1 -1
  74. package/dist/cjs/hooks/usePrevious/usePrevious.js +1 -1
  75. package/dist/cjs/hooks/useQuery/useQuery.js +2 -2
  76. package/dist/cjs/hooks/useQueue/useQueue.js +2 -2
  77. package/dist/cjs/hooks/useRafCallback/useRafCallback.js +3 -0
  78. package/dist/cjs/hooks/useRafCallback/useRafCallback.js.map +1 -0
  79. package/dist/cjs/hooks/useRafValue/useRafValue.js +3 -0
  80. package/dist/cjs/hooks/useRafValue/useRafValue.js.map +1 -0
  81. package/dist/cjs/hooks/useRenderCount/useRenderCount.js +1 -1
  82. package/dist/cjs/hooks/useRenderInfo/useRenderInfo.js +1 -1
  83. package/dist/cjs/hooks/useRerender/useRerender.js +2 -2
  84. package/dist/cjs/hooks/useResizeObserver/useResizeObserver.js +2 -2
  85. package/dist/cjs/hooks/useScript/useScript.js +2 -2
  86. package/dist/cjs/hooks/useSessionStorage/useSessionStorage.js +2 -2
  87. package/dist/cjs/hooks/useSet/useSet.js +2 -2
  88. package/dist/cjs/hooks/useShare/useShare.js +2 -2
  89. package/dist/cjs/hooks/useStep/useStep.js +2 -2
  90. package/dist/cjs/hooks/useStep/useStep.js.map +1 -1
  91. package/dist/cjs/hooks/useStopwatch/useStopwatch.js +2 -2
  92. package/dist/cjs/hooks/useStorage/useStorage.js +2 -2
  93. package/dist/cjs/hooks/useTextSelection/useTextSelection.js +2 -2
  94. package/dist/cjs/hooks/useTime/useTime.js +2 -2
  95. package/dist/cjs/hooks/useTimeout/useTimeout.js +2 -2
  96. package/dist/cjs/hooks/useToggle/useToggle.js +2 -2
  97. package/dist/cjs/hooks/useUnmount/useUnmount.js +1 -1
  98. package/dist/cjs/hooks/useWebSocket/useWebSocket.js +2 -2
  99. package/dist/cjs/hooks/useWindowEvent/useWindowEvent.js +1 -1
  100. package/dist/cjs/hooks/useWindowScroll/useWindowScroll.js +2 -2
  101. package/dist/cjs/hooks/useWindowSize/useWindowSize.js +2 -2
  102. package/dist/cjs/hooks/useWizard/useWizard.js +2 -2
  103. package/dist/cjs/{index-Cx3swBXU.js → index-B5_TrIc_.js} +2 -2
  104. package/dist/cjs/{index-Cx3swBXU.js.map → index-B5_TrIc_.js.map} +1 -1
  105. package/dist/cjs/index.js +2 -2
  106. package/dist/cjs/utils/helpers/debounce.js +1 -1
  107. package/dist/cjs/utils/helpers/getRetry.js +1 -1
  108. package/dist/cjs/utils/helpers/index.js +1 -1
  109. package/dist/cjs/utils/helpers/isClient.js +1 -1
  110. package/dist/cjs/utils/helpers/isPermissionAllowed.js +1 -1
  111. package/dist/cjs/utils/helpers/throttle.js +1 -1
  112. package/dist/cjs/utils/helpers/time/getDate.js +1 -1
  113. package/dist/cjs/utils/types/index.js +1 -1
  114. package/dist/esm/{_rollupPluginBabelHelpers-DzHsVrgu.js → _rollupPluginBabelHelpers-DmsB_Gfn.js} +2 -2
  115. package/dist/esm/_rollupPluginBabelHelpers-DmsB_Gfn.js.map +1 -0
  116. package/dist/esm/hooks/index.js +2 -2
  117. package/dist/esm/hooks/useAsync/useAsync.js +2 -2
  118. package/dist/esm/hooks/useBattery/useBattery.js +2 -2
  119. package/dist/esm/hooks/useBoolean/useBoolean.js +2 -2
  120. package/dist/esm/hooks/useBreakpoints/constants/breakpoints.js +1 -1
  121. package/dist/esm/hooks/useBreakpoints/useBreakpoints.js +2 -2
  122. package/dist/esm/hooks/useBrowserLanguage/useBrowserLanguage.js +1 -1
  123. package/dist/esm/hooks/useClickOutside/useClickOutside.js +2 -2
  124. package/dist/esm/hooks/useClipboard/useClipboard.js +2 -2
  125. package/dist/esm/hooks/useCounter/useCounter.js +2 -2
  126. package/dist/esm/hooks/useDebounceCallback/useDebounceCallback.js +1 -1
  127. package/dist/esm/hooks/useDebounceValue/useDebounceValue.js +2 -2
  128. package/dist/esm/hooks/useDefault/useDefault.js +2 -2
  129. package/dist/esm/hooks/useDidUpdate/useDidUpdate.js +1 -1
  130. package/dist/esm/hooks/useDisclosure/useDisclosure.js +2 -2
  131. package/dist/esm/hooks/useDocumentEvent/useDocumentEvent.js +1 -1
  132. package/dist/esm/hooks/useDocumentTitle/useDocumentTitle.js +2 -2
  133. package/dist/esm/hooks/useDocumentVisibility/useDocumentVisibility.js +1 -1
  134. package/dist/esm/hooks/useEvent/useEvent.js +1 -1
  135. package/dist/esm/hooks/useEventListener/useEventListener.js +1 -1
  136. package/dist/esm/hooks/useEyeDropper/useEyeDropper.js +2 -2
  137. package/dist/esm/hooks/useFavicon/useFavicon.js +2 -2
  138. package/dist/esm/hooks/useField/useField.js +2 -2
  139. package/dist/esm/hooks/useField/useField.js.map +1 -1
  140. package/dist/esm/hooks/useFileDialog/useFileDialog.js +2 -2
  141. package/dist/esm/hooks/useFps/useFps.js +2 -2
  142. package/dist/esm/hooks/useFullscreen/useFullscreen.js +2 -2
  143. package/dist/esm/hooks/useGeolocation/useGeolocation.js +2 -2
  144. package/dist/esm/hooks/useGeolocation/useGeolocation.js.map +1 -1
  145. package/dist/esm/hooks/useHash/useHash.js +2 -2
  146. package/dist/esm/hooks/useHotkeys/useHotkeys.js +2 -2
  147. package/dist/esm/hooks/useHotkeys/useHotkeys.js.map +1 -1
  148. package/dist/esm/hooks/useHover/useHover.js +2 -2
  149. package/dist/esm/hooks/useIdle/useIdle.js +2 -2
  150. package/dist/esm/hooks/useImage/useImage.js +2 -2
  151. package/dist/esm/hooks/useInfiniteScroll/useInfiniteScroll.js +2 -2
  152. package/dist/esm/hooks/useIntersectionObserver/useIntersectionObserver.js +2 -2
  153. package/dist/esm/hooks/useInterval/useInterval.js +2 -2
  154. package/dist/esm/hooks/useIsFirstRender/useIsFirstRender.js +1 -1
  155. package/dist/esm/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +1 -1
  156. package/dist/esm/hooks/useKeyPress/useKeyPress.js +2 -2
  157. package/dist/esm/hooks/useKeyPressEvent/useKeyPressEvent.js +1 -1
  158. package/dist/esm/hooks/useKeyboard/useKeyboard.js +1 -1
  159. package/dist/esm/hooks/useKeysPressed/useKeysPressed.js +2 -2
  160. package/dist/esm/hooks/useKeysPressed/useKeysPressed.js.map +1 -1
  161. package/dist/esm/hooks/useList/useList.js +2 -2
  162. package/dist/esm/hooks/useLocalStorage/useLocalStorage.js +2 -2
  163. package/dist/esm/hooks/useLogger/useLogger.js +2 -2
  164. package/dist/esm/hooks/useLongPress/useLongPress.js +2 -2
  165. package/dist/esm/hooks/useMap/useMap.js +2 -2
  166. package/dist/esm/hooks/useMeasure/useMeasure.js +2 -2
  167. package/dist/esm/hooks/useMediaQuery/useMediaQuery.js +1 -1
  168. package/dist/esm/hooks/useMemory/useMemory.js +2 -2
  169. package/dist/esm/hooks/useMount/useMount.js +1 -1
  170. package/dist/esm/hooks/useMouse/useMouse.js +2 -2
  171. package/dist/esm/hooks/useMutation/useMutation.js +2 -2
  172. package/dist/esm/hooks/useMutationObserver.js +1 -1
  173. package/dist/esm/hooks/useNetwork/useNetwork.js +2 -2
  174. package/dist/esm/hooks/useOnline/useOnline.js +1 -1
  175. package/dist/esm/hooks/useOperatingSystem/useOperatingSystem.js +1 -1
  176. package/dist/esm/hooks/useOrientation/useOrientation.js +2 -2
  177. package/dist/esm/hooks/usePageLeave/usePageLeave.js +2 -2
  178. package/dist/esm/hooks/usePaint/helpers/Paint.js +2 -2
  179. package/dist/esm/hooks/usePaint/helpers/Pointer.js +2 -2
  180. package/dist/esm/hooks/usePaint/usePaint.js +2 -2
  181. package/dist/esm/hooks/usePermission/usePermission.js +2 -2
  182. package/dist/esm/hooks/usePreferredColorScheme/usePreferredColorScheme.js +1 -1
  183. package/dist/esm/hooks/usePreferredContrast/usePreferredContrast.js +1 -1
  184. package/dist/esm/hooks/usePreferredDark/usePreferredDark.js +1 -1
  185. package/dist/esm/hooks/usePreferredLanguages/usePreferredLanguages.js +1 -1
  186. package/dist/esm/hooks/usePreferredReducedMotion/usePreferredReducedMotion.js +1 -1
  187. package/dist/esm/hooks/usePrevious/usePrevious.js +1 -1
  188. package/dist/esm/hooks/useQuery/useQuery.js +2 -2
  189. package/dist/esm/hooks/useQueue/useQueue.js +2 -2
  190. package/dist/esm/hooks/useRafCallback/useRafCallback.js +3 -0
  191. package/dist/esm/hooks/useRafCallback/useRafCallback.js.map +1 -0
  192. package/dist/esm/hooks/useRafValue/useRafValue.js +3 -0
  193. package/dist/esm/hooks/useRafValue/useRafValue.js.map +1 -0
  194. package/dist/esm/hooks/useRenderCount/useRenderCount.js +1 -1
  195. package/dist/esm/hooks/useRenderInfo/useRenderInfo.js +1 -1
  196. package/dist/esm/hooks/useRerender/useRerender.js +2 -2
  197. package/dist/esm/hooks/useResizeObserver/useResizeObserver.js +2 -2
  198. package/dist/esm/hooks/useScript/useScript.js +2 -2
  199. package/dist/esm/hooks/useSessionStorage/useSessionStorage.js +2 -2
  200. package/dist/esm/hooks/useSet/useSet.js +2 -2
  201. package/dist/esm/hooks/useShare/useShare.js +2 -2
  202. package/dist/esm/hooks/useStep/useStep.js +2 -2
  203. package/dist/esm/hooks/useStep/useStep.js.map +1 -1
  204. package/dist/esm/hooks/useStopwatch/useStopwatch.js +2 -2
  205. package/dist/esm/hooks/useStorage/useStorage.js +2 -2
  206. package/dist/esm/hooks/useTextSelection/useTextSelection.js +2 -2
  207. package/dist/esm/hooks/useTime/useTime.js +2 -2
  208. package/dist/esm/hooks/useTimeout/useTimeout.js +2 -2
  209. package/dist/esm/hooks/useToggle/useToggle.js +2 -2
  210. package/dist/esm/hooks/useUnmount/useUnmount.js +1 -1
  211. package/dist/esm/hooks/useWebSocket/useWebSocket.js +2 -2
  212. package/dist/esm/hooks/useWindowEvent/useWindowEvent.js +1 -1
  213. package/dist/esm/hooks/useWindowScroll/useWindowScroll.js +2 -2
  214. package/dist/esm/hooks/useWindowSize/useWindowSize.js +2 -2
  215. package/dist/esm/hooks/useWizard/useWizard.js +2 -2
  216. package/dist/esm/{index-Cy_RlODm.js → index-CYU_BSAR.js} +2 -2
  217. package/dist/esm/{index-Cy_RlODm.js.map → index-CYU_BSAR.js.map} +1 -1
  218. package/dist/esm/index.js +2 -2
  219. package/dist/esm/utils/helpers/debounce.js +1 -1
  220. package/dist/esm/utils/helpers/getRetry.js +1 -1
  221. package/dist/esm/utils/helpers/index.js +1 -1
  222. package/dist/esm/utils/helpers/isClient.js +1 -1
  223. package/dist/esm/utils/helpers/isPermissionAllowed.js +1 -1
  224. package/dist/esm/utils/helpers/throttle.js +1 -1
  225. package/dist/esm/utils/helpers/time/getDate.js +1 -1
  226. package/dist/esm/utils/types/index.js +1 -1
  227. package/dist/index.d.ts +57 -7
  228. package/package.json +1 -1
  229. package/dist/cjs/_rollupPluginBabelHelpers-CiUitFXn.js.map +0 -1
  230. package/dist/esm/_rollupPluginBabelHelpers-DzHsVrgu.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"useField.js","sources":["../../../../src/hooks/useField/useField.ts"],"sourcesContent":["import { useRef, useState } from 'react';\n\nimport { useRerender } from '../useRerender/useRerender';\n\n/** The use field params */\nexport interface UseFieldParams<Value> {\n /** The initial value */\n initialValue?: Value;\n /** The initial touched */\n initialTouched?: boolean;\n /** The auto focus */\n autoFocus?: boolean;\n /** The validate on mount */\n validateOnChange?: boolean;\n /** The validate on blur */\n validateOnBlur?: boolean;\n /** The validate on mount */\n validateOnMount?: boolean;\n}\n\n/** The use field register params */\nexport interface UseFieldRegisterParams {\n /** The required validation */\n required?: string;\n /** The min value validation */\n max?: {\n value: number;\n message: string;\n };\n /** The max value validation */\n min?: {\n value: number;\n message: string;\n };\n /** The max length validation */\n maxLength?: {\n value: number;\n message: string;\n };\n /** The min length validation */\n minLength?: {\n value: number;\n message: string;\n };\n /** The pattern validation */\n pattern?: {\n value: RegExp;\n message: string;\n };\n /** The custom validation */\n validate?: (value: string) => Promise<string | true>;\n}\n\n/** The use field return type */\nexport interface UseFieldReturn<Value> {\n /** The register function */\n register: (params?: UseFieldRegisterParams) => {\n onBlur: () => void;\n onChange: () => void;\n ref: (\n node: HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | null | undefined\n ) => void;\n };\n /** The get value function */\n getValue: () => Value;\n /** The set value function */\n setValue: (value: Value) => void;\n /** The dirty state */\n dirty: boolean;\n /** The error state */\n error?: string;\n /** The set error function */\n touched: boolean;\n /** The focus function */\n focus: () => void;\n /** The watch function */\n watch: () => Value;\n /** The reset function */\n reset: () => void;\n /** The set error function */\n setError: (error: string) => void;\n /** The set error function */\n clearError: () => void;\n}\n\n/**\n * @name useField\n * @description - Hook to manage a form field\n * @category Utilities\n *\n * @template Value The input value\n * @template Type The input value type\n * @param {Value} [params.initialValue] Initial value\n * @param {boolean} [params.initialTouched=false] Initial touched state\n * @param {boolean} [params.autoFocus=false] Auto focus\n * @param {boolean} [params.validateOnChange=false] Validate on change\n * @param {boolean} [params.validateOnBlur=false] Validate on blur\n * @param {boolean} [params.validateOnMount=false] Validate on mount\n * @returns {UseFieldReturn<Value>} An object containing input information\n *\n * @example\n * const { register, getValue, setValue, reset, dirty, error, setError, clearError, touched, focus, watch } = useField();\n */\nexport const useField = <\n Value extends string | boolean = string,\n Type = Value extends string ? string : boolean\n>(\n params?: UseFieldParams<Value>\n): UseFieldReturn<Type> => {\n const initialValue = (params?.initialValue ?? '') as Value;\n\n const inputRef = useRef<HTMLInputElement>();\n const watchingRef = useRef(false);\n const rerender = useRerender();\n\n const [dirty, setDirty] = useState(false);\n const [touched, setTouched] = useState(params?.initialTouched ?? false);\n const [error, setError] = useState<string | undefined>(undefined);\n\n const getValue = () => {\n if (inputRef.current?.type === 'radio' || inputRef.current?.type === 'checkbox')\n return inputRef.current.checked as Type;\n return (inputRef.current?.value ?? initialValue) as Type;\n };\n\n const setValue = (value: Type) => {\n if (inputRef.current?.type === 'radio' || inputRef.current?.type === 'checkbox') {\n inputRef.current.checked = value as boolean;\n if (watchingRef.current) return rerender.update();\n return;\n }\n\n inputRef.current!.value = value as string;\n if (watchingRef.current) return rerender.update();\n };\n\n const reset = () => {\n setValue(initialValue as unknown as Type);\n setDirty(false);\n setTouched(false);\n setError(undefined);\n };\n\n const focus = () => {\n inputRef.current!.focus();\n };\n\n const validate = (params: UseFieldRegisterParams) => {\n if (params.required && !inputRef.current!.value) {\n return setError(params.required);\n }\n\n if (params.minLength && inputRef.current!.value.length < params.minLength.value) {\n return setError(params.minLength.message);\n }\n\n if (params.maxLength && inputRef.current!.value.length > params.maxLength.value) {\n return setError(params.maxLength.message);\n }\n\n if (params.min && Number(inputRef.current!.value) < params.min.value) {\n return setError(params.min.message);\n }\n\n if (params.max && Number(inputRef.current!.value) > params.max.value) {\n return setError(params.max.message);\n }\n\n if (params.pattern && !params.pattern.value.test(inputRef.current!.value)) {\n return setError(params.pattern.message);\n }\n\n if (params.validate) {\n const error = params.validate(inputRef.current!.value);\n if (typeof error === 'string') return setError(error);\n }\n\n setError(undefined);\n };\n\n const register = (registerParams?: UseFieldRegisterParams) => ({\n ref: (node: HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | null | undefined) => {\n if (!inputRef.current && node) {\n if (params?.autoFocus) node.focus();\n inputRef.current = node as HTMLInputElement;\n if (inputRef.current.type === 'radio') {\n inputRef.current.defaultChecked = params?.initialValue === node.value;\n return;\n }\n if (inputRef.current.type === 'checkbox') {\n inputRef.current.defaultChecked = !!params?.initialValue;\n return;\n }\n inputRef.current.defaultValue = String(initialValue);\n\n if (registerParams && params?.validateOnMount) validate(registerParams);\n }\n },\n onChange: async () => {\n if (watchingRef.current) return rerender.update();\n if (inputRef.current!.value !== initialValue) setDirty(true);\n if (dirty && inputRef.current!.value === initialValue) setDirty(false);\n if (registerParams && params?.validateOnChange) await validate(registerParams);\n if (registerParams && params?.validateOnBlur) setError(undefined);\n },\n onBlur: async () => {\n if (registerParams && params?.validateOnBlur) await validate(registerParams);\n setTouched(true);\n }\n });\n\n const watch = () => {\n watchingRef.current = true;\n return getValue();\n };\n\n const clearError = () => setError(undefined);\n\n return {\n register,\n dirty,\n touched,\n error,\n setError,\n clearError,\n getValue,\n setValue,\n reset,\n watch,\n focus\n };\n};\n"],"names":["useField","params","_params$initialValue","_params$initialTouche","initialValue","inputRef","useRef","watchingRef","rerender","useRerender","_useState","useState","_useState2","_slicedToArray","dirty","setDirty","_useState3","initialTouched","_useState4","touched","setTouched","_useState5","undefined","_useState6","error","setError","getValue","_inputRef$current","_inputRef$current2","_inputRef$current$val","_inputRef$current3","current","type","checked","value","setValue","_inputRef$current4","_inputRef$current5","update","validate","required","minLength","length","message","maxLength","min","Number","max","pattern","test","register","registerParams","ref","node","autoFocus","focus","defaultChecked","defaultValue","String","validateOnMount","onChange","_onChange","_asyncToGenerator","_regeneratorRuntime","mark","_callee","wrap","_context","prev","next","abrupt","validateOnChange","validateOnBlur","stop","apply","this","arguments","onBlur","_onBlur","_callee2","_context2","clearError","reset","watch"],"mappings":"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"}
1
+ {"version":3,"file":"useField.js","sources":["../../../../src/hooks/useField/useField.ts"],"sourcesContent":["import { useRef, useState } from 'react';\n\nimport { useRerender } from '../useRerender/useRerender';\n\n/** The use field params type */\nexport interface UseFieldParams<Value> {\n /** The initial value */\n initialValue?: Value;\n /** The initial touched */\n initialTouched?: boolean;\n /** The auto focus */\n autoFocus?: boolean;\n /** The validate on mount */\n validateOnChange?: boolean;\n /** The validate on blur */\n validateOnBlur?: boolean;\n /** The validate on mount */\n validateOnMount?: boolean;\n}\n\n/** The use field register params type */\nexport interface UseFieldRegisterParams {\n /** The required validation */\n required?: string;\n /** The min value validation */\n max?: {\n value: number;\n message: string;\n };\n /** The max value validation */\n min?: {\n value: number;\n message: string;\n };\n /** The max length validation */\n maxLength?: {\n value: number;\n message: string;\n };\n /** The min length validation */\n minLength?: {\n value: number;\n message: string;\n };\n /** The pattern validation */\n pattern?: {\n value: RegExp;\n message: string;\n };\n /** The custom validation */\n validate?: (value: string) => Promise<string | true>;\n}\n\n/** The use field return type */\nexport interface UseFieldReturn<Value> {\n /** The register function */\n register: (params?: UseFieldRegisterParams) => {\n onBlur: () => void;\n onChange: () => void;\n ref: (\n node: HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | null | undefined\n ) => void;\n };\n /** The get value function */\n getValue: () => Value;\n /** The set value function */\n setValue: (value: Value) => void;\n /** The dirty state */\n dirty: boolean;\n /** The error state */\n error?: string;\n /** The set error function */\n touched: boolean;\n /** The focus function */\n focus: () => void;\n /** The watch function */\n watch: () => Value;\n /** The reset function */\n reset: () => void;\n /** The set error function */\n setError: (error: string) => void;\n /** The set error function */\n clearError: () => void;\n}\n\n/**\n * @name useField\n * @description - Hook to manage a form field\n * @category Utilities\n *\n * @template Value The input value\n * @template Type The input value type\n * @param {Value} [params.initialValue] Initial value\n * @param {boolean} [params.initialTouched=false] Initial touched state\n * @param {boolean} [params.autoFocus=false] Auto focus\n * @param {boolean} [params.validateOnChange=false] Validate on change\n * @param {boolean} [params.validateOnBlur=false] Validate on blur\n * @param {boolean} [params.validateOnMount=false] Validate on mount\n * @returns {UseFieldReturn<Value>} An object containing input information\n *\n * @example\n * const { register, getValue, setValue, reset, dirty, error, setError, clearError, touched, focus, watch } = useField();\n */\nexport const useField = <\n Value extends string | boolean = string,\n Type = Value extends string ? string : boolean\n>(\n params?: UseFieldParams<Value>\n): UseFieldReturn<Type> => {\n const initialValue = (params?.initialValue ?? '') as Value;\n\n const inputRef = useRef<HTMLInputElement>();\n const watchingRef = useRef(false);\n const rerender = useRerender();\n\n const [dirty, setDirty] = useState(false);\n const [touched, setTouched] = useState(params?.initialTouched ?? false);\n const [error, setError] = useState<string | undefined>(undefined);\n\n const getValue = () => {\n if (inputRef.current?.type === 'radio' || inputRef.current?.type === 'checkbox')\n return inputRef.current.checked as Type;\n return (inputRef.current?.value ?? initialValue) as Type;\n };\n\n const setValue = (value: Type) => {\n if (inputRef.current?.type === 'radio' || inputRef.current?.type === 'checkbox') {\n inputRef.current.checked = value as boolean;\n if (watchingRef.current) return rerender.update();\n return;\n }\n\n inputRef.current!.value = value as string;\n if (watchingRef.current) return rerender.update();\n };\n\n const reset = () => {\n setValue(initialValue as unknown as Type);\n setDirty(false);\n setTouched(false);\n setError(undefined);\n };\n\n const focus = () => {\n inputRef.current!.focus();\n };\n\n const validate = (params: UseFieldRegisterParams) => {\n if (params.required && !inputRef.current!.value) {\n return setError(params.required);\n }\n\n if (params.minLength && inputRef.current!.value.length < params.minLength.value) {\n return setError(params.minLength.message);\n }\n\n if (params.maxLength && inputRef.current!.value.length > params.maxLength.value) {\n return setError(params.maxLength.message);\n }\n\n if (params.min && Number(inputRef.current!.value) < params.min.value) {\n return setError(params.min.message);\n }\n\n if (params.max && Number(inputRef.current!.value) > params.max.value) {\n return setError(params.max.message);\n }\n\n if (params.pattern && !params.pattern.value.test(inputRef.current!.value)) {\n return setError(params.pattern.message);\n }\n\n if (params.validate) {\n const error = params.validate(inputRef.current!.value);\n if (typeof error === 'string') return setError(error);\n }\n\n setError(undefined);\n };\n\n const register = (registerParams?: UseFieldRegisterParams) => ({\n ref: (node: HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | null | undefined) => {\n if (!inputRef.current && node) {\n if (params?.autoFocus) node.focus();\n inputRef.current = node as HTMLInputElement;\n if (inputRef.current.type === 'radio') {\n inputRef.current.defaultChecked = params?.initialValue === node.value;\n return;\n }\n if (inputRef.current.type === 'checkbox') {\n inputRef.current.defaultChecked = !!params?.initialValue;\n return;\n }\n inputRef.current.defaultValue = String(initialValue);\n\n if (registerParams && params?.validateOnMount) validate(registerParams);\n }\n },\n onChange: async () => {\n if (watchingRef.current) return rerender.update();\n if (inputRef.current!.value !== initialValue) setDirty(true);\n if (dirty && inputRef.current!.value === initialValue) setDirty(false);\n if (registerParams && params?.validateOnChange) await validate(registerParams);\n if (registerParams && params?.validateOnBlur) setError(undefined);\n },\n onBlur: async () => {\n if (registerParams && params?.validateOnBlur) await validate(registerParams);\n setTouched(true);\n }\n });\n\n const watch = () => {\n watchingRef.current = true;\n return getValue();\n };\n\n const clearError = () => setError(undefined);\n\n return {\n register,\n dirty,\n touched,\n error,\n setError,\n clearError,\n getValue,\n setValue,\n reset,\n watch,\n focus\n };\n};\n"],"names":["useField","params","_params$initialValue","_params$initialTouche","initialValue","inputRef","useRef","watchingRef","rerender","useRerender","_useState","useState","_useState2","_slicedToArray","dirty","setDirty","_useState3","initialTouched","_useState4","touched","setTouched","_useState5","undefined","_useState6","error","setError","getValue","_inputRef$current","_inputRef$current2","_inputRef$current$val","_inputRef$current3","current","type","checked","value","setValue","_inputRef$current4","_inputRef$current5","update","validate","required","minLength","length","message","maxLength","min","Number","max","pattern","test","register","registerParams","ref","node","autoFocus","focus","defaultChecked","defaultValue","String","validateOnMount","onChange","_onChange","_asyncToGenerator","_regeneratorRuntime","mark","_callee","wrap","_context","prev","next","abrupt","validateOnChange","validateOnBlur","stop","apply","this","arguments","onBlur","_onBlur","_callee2","_context2","clearError","reset","watch"],"mappings":"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"}
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
2
- import{_ as l}from"../../_rollupPluginBabelHelpers-DzHsVrgu.js";import{useState as n,useRef as u,useEffect as e}from"react";var r=!0,t="*",i=!1,o=function(){var o="function"==typeof(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,c=o?arguments.length<=0?void 0:arguments[0]:arguments.length<=1?void 0:arguments[1],v=n(null),d=l(v,2),a=d[0],p=d[1],f=u(),m=u(o);m.current=o;var s=function(){var l;p(null),null===(l=m.current)||void 0===l||l.call(m,null),f.current&&(f.current.value="")};return e((function(){var l;return f.current=((l=document.createElement("input")).type="file",l.onchange=function(l){var n,u=l.target.files;p(u),null===(n=m.current)||void 0===n||n.call(m,u)},l),function(){var l;null===(l=f.current)||void 0===l||l.remove()}}),[null==c?void 0:c.multiple,null==c?void 0:c.accept,null==c?void 0:c.capture,null==c?void 0:c.reset]),{value:a,open:function(l){var n,u,e,o,v,d,a;if(f.current){f.current.multiple=null!==(n=null!==(u=null==l?void 0:l.multiple)&&void 0!==u?u:null==c?void 0:c.multiple)&&void 0!==n?n:r,f.current.accept=null!==(e=null!==(o=null==l?void 0:l.accept)&&void 0!==o?o:null==c?void 0:c.accept)&&void 0!==e?e:t;var p=null!==(v=null==l?void 0:l.capture)&&void 0!==v?v:null==c?void 0:c.capture;p&&(f.current.capture=p),(null!==(d=null!==(a=null==l?void 0:l.reset)&&void 0!==a?a:null==c?void 0:c.reset)&&void 0!==d?d:i)&&s(),f.current.click()}},reset:s}};export{o as useFileDialog};
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
+ import{_ as l}from"../../_rollupPluginBabelHelpers-DmsB_Gfn.js";import{useState as n,useRef as u,useEffect as e}from"react";var r=!0,t="*",i=!1,o=function(){var o="function"==typeof(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,c=o?arguments.length<=0?void 0:arguments[0]:arguments.length<=1?void 0:arguments[1],v=n(null),d=l(v,2),a=d[0],p=d[1],f=u(),m=u(o);m.current=o;var s=function(){var l;p(null),null===(l=m.current)||void 0===l||l.call(m,null),f.current&&(f.current.value="")};return e((function(){var l;return f.current=((l=document.createElement("input")).type="file",l.onchange=function(l){var n,u=l.target.files;p(u),null===(n=m.current)||void 0===n||n.call(m,u)},l),function(){var l;null===(l=f.current)||void 0===l||l.remove()}}),[null==c?void 0:c.multiple,null==c?void 0:c.accept,null==c?void 0:c.capture,null==c?void 0:c.reset]),{value:a,open:function(l){var n,u,e,o,v,d,a;if(f.current){f.current.multiple=null!==(n=null!==(u=null==l?void 0:l.multiple)&&void 0!==u?u:null==c?void 0:c.multiple)&&void 0!==n?n:r,f.current.accept=null!==(e=null!==(o=null==l?void 0:l.accept)&&void 0!==o?o:null==c?void 0:c.accept)&&void 0!==e?e:t;var p=null!==(v=null==l?void 0:l.capture)&&void 0!==v?v:null==c?void 0:c.capture;p&&(f.current.capture=p),(null!==(d=null!==(a=null==l?void 0:l.reset)&&void 0!==a?a:null==c?void 0:c.reset)&&void 0!==d?d:i)&&s(),f.current.click()}},reset:s}};export{o as useFileDialog};
3
3
  //# sourceMappingURL=useFileDialog.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
2
- import{_ as r}from"../../_rollupPluginBabelHelpers-DzHsVrgu.js";import{useState as n,useEffect as e}from"react";var a=function(){var a=n(0),o=r(a,2),t=o[0],i=o[1];return e((function(){var r,n=0,e=performance.now();return r=requestAnimationFrame((function a(){n+=1;var o=performance.now(),t=o-e;if(t>=1e3){var m=Math.round(1e3*n/t);i(m),n=0,e=o}r=requestAnimationFrame(a)})),function(){cancelAnimationFrame(r)}}),[]),t};export{a as useFps};
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
+ import{_ as r}from"../../_rollupPluginBabelHelpers-DmsB_Gfn.js";import{useState as n,useEffect as e}from"react";var a=function(){var a=n(0),o=r(a,2),t=o[0],i=o[1];return e((function(){var r,n=0,e=performance.now();return r=requestAnimationFrame((function a(){n+=1;var o=performance.now(),t=o-e;if(t>=1e3){var m=Math.round(1e3*n/t);i(m),n=0,e=o}r=requestAnimationFrame(a)})),function(){cancelAnimationFrame(r)}}),[]),t};export{a as useFps};
3
3
  //# sourceMappingURL=useFps.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
2
- import{_ as n,b as e}from"../../_rollupPluginBabelHelpers-DzHsVrgu.js";import{useRef as l,useState as i}from"react";import{s as o}from"../../index-Cy_RlODm.js";import{useUnmount as t}from"../useUnmount/useUnmount.js";var r=function(){var r,u=void 0===(arguments.length<=1?void 0:arguments[1])||arguments.length<=0?void 0:arguments[0],a=u?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],f=l(null),c=i(null!==(r=null==a?void 0:a.initialValue)&&void 0!==r&&r),s=n(c,2),d=s[0],v=s[1],m=function n(){if(o.isEnabled){var e,l;if(o.isFullscreen)null==a||null===(e=a.onEnter)||void 0===e||e.call(a);else o.off("change",n),null==a||null===(l=a.onExit)||void 0===l||l.call(a);v(o.isFullscreen)}},g=function(){var n=u?function(n){return"function"==typeof n?n():n instanceof Element?n:n.current}(u):f.current;if(n&&o.isEnabled)try{o.request(n),o.on("change",m)}catch(n){console.error(n)}},h=function(){o.isEnabled&&o.exit()};return t((function(){o.isEnabled&&o.off("change",m)})),e(e({},!u&&{ref:f}),{},{enter:g,exit:h,toggle:function(){if(d)return h();g()},value:d})};export{r as useFullscreen};
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
+ import{_ as n,b as e}from"../../_rollupPluginBabelHelpers-DmsB_Gfn.js";import{useRef as l,useState as i}from"react";import{s as o}from"../../index-CYU_BSAR.js";import{useUnmount as t}from"../useUnmount/useUnmount.js";var r=function(){var r,u=void 0===(arguments.length<=1?void 0:arguments[1])||arguments.length<=0?void 0:arguments[0],a=u?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],f=l(null),c=i(null!==(r=null==a?void 0:a.initialValue)&&void 0!==r&&r),s=n(c,2),d=s[0],v=s[1],m=function n(){if(o.isEnabled){var e,l;if(o.isFullscreen)null==a||null===(e=a.onEnter)||void 0===e||e.call(a);else o.off("change",n),null==a||null===(l=a.onExit)||void 0===l||l.call(a);v(o.isFullscreen)}},g=function(){var n=u?function(n){return"function"==typeof n?n():n instanceof Element?n:n.current}(u):f.current;if(n&&o.isEnabled)try{o.request(n),o.on("change",m)}catch(n){console.error(n)}},h=function(){o.isEnabled&&o.exit()};return t((function(){o.isEnabled&&o.off("change",m)})),e(e({},!u&&{ref:f}),{},{enter:g,exit:h,toggle:function(){if(d)return h();g()},value:d})};export{r as useFullscreen};
3
3
  //# sourceMappingURL=useFullscreen.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
2
- import{_ as t,b as a}from"../../_rollupPluginBabelHelpers-DzHsVrgu.js";import{useState as e,useEffect as i}from"react";var o=function(o){var l=e({loading:!0,error:null,timestamp:Date.now(),accuracy:0,latitude:Number.POSITIVE_INFINITY,longitude:Number.POSITIVE_INFINITY,altitude:null,altitudeAccuracy:null,heading:null,speed:null}),n=t(l,2),u=n[0],r=n[1];return i((function(){var t=function(t){var e=t.coords,i=t.timestamp;r(a(a({},u),{},{loading:!1,timestamp:i,latitude:e.latitude,longitude:e.longitude,altitude:e.altitude,accuracy:e.accuracy,altitudeAccuracy:e.altitudeAccuracy,heading:e.heading,speed:e.speed}))},e=function(t){r(a(a({},u),{},{loading:!1,error:t}))};navigator.geolocation.getCurrentPosition(t,e,o);var i=navigator.geolocation.watchPosition(t,e,o);return function(){navigator.geolocation.clearWatch(i)}}),[null==o?void 0:o.enableHighAccuracy,null==o?void 0:o.maximumAge,null==o?void 0:o.timeout]),u};export{o as useGeolocation};
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
+ import{_ as t,b as a}from"../../_rollupPluginBabelHelpers-DmsB_Gfn.js";import{useState as e,useEffect as i}from"react";var o=function(o){var l=e({loading:!0,error:null,timestamp:Date.now(),accuracy:0,latitude:Number.POSITIVE_INFINITY,longitude:Number.POSITIVE_INFINITY,altitude:null,altitudeAccuracy:null,heading:null,speed:null}),n=t(l,2),u=n[0],r=n[1];return i((function(){var t=function(t){var e=t.coords,i=t.timestamp;r(a(a({},u),{},{loading:!1,timestamp:i,latitude:e.latitude,longitude:e.longitude,altitude:e.altitude,accuracy:e.accuracy,altitudeAccuracy:e.altitudeAccuracy,heading:e.heading,speed:e.speed}))},e=function(t){r(a(a({},u),{},{loading:!1,error:t}))};navigator.geolocation.getCurrentPosition(t,e,o);var i=navigator.geolocation.watchPosition(t,e,o);return function(){navigator.geolocation.clearWatch(i)}}),[null==o?void 0:o.enableHighAccuracy,null==o?void 0:o.maximumAge,null==o?void 0:o.timeout]),u};export{o as useGeolocation};
3
3
  //# sourceMappingURL=useGeolocation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useGeolocation.js","sources":["../../../../src/hooks/useGeolocation/useGeolocation.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\n/** The use geolocation return type */\nexport interface UseGeolocationReturn {\n /** The loading state */\n loading: boolean;\n /** The error of the last position update */\n error: GeolocationPositionError | null;\n /** The timestamp of the last position update */\n timestamp: number | null;\n /** The accuracy of the last position update */\n accuracy: number | null;\n /** The latitude of the last position update */\n latitude: number | null;\n /** The longitude of the last position update */\n longitude: number | null;\n /** The altitude of the last position update */\n altitude: number | null;\n /** The altitude accuracy of the last position update */\n altitudeAccuracy: number | null;\n /** The heading of the last position update */\n heading: number | null;\n /** The speed of the last position update */\n speed: number | null;\n}\n\n/** The use geolocation params */\nexport type UseGeolocationParams = PositionOptions;\n\n/**\n * @name useGeolocation\n * @description - Hook that returns the current geolocation\n * @category Browser\n *\n * @param {boolean} [params.enableHighAccuracy] Enable high accuracy\n * @param {number} [params.maximumAge] Maximum age\n * @param {number} [params.timeout] Timeout\n * @returns {UseGeolocationReturn}\n *\n * @example\n * const { loading, error, timestamp, accuracy, latitude, longitude, altitude, altitudeAccuracy, heading, speed } = useGeolocation();\n */\nexport const useGeolocation = (params?: UseGeolocationParams): UseGeolocationReturn => {\n const [value, setValue] = useState<{\n loading: boolean;\n error: GeolocationPositionError | null;\n timestamp: number | null;\n accuracy: number | null;\n latitude: number | null;\n longitude: number | null;\n altitude: number | null;\n altitudeAccuracy: number | null;\n heading: number | null;\n speed: number | null;\n }>({\n loading: true,\n error: null,\n timestamp: Date.now(),\n accuracy: 0,\n latitude: Number.POSITIVE_INFINITY,\n longitude: Number.POSITIVE_INFINITY,\n altitude: null,\n altitudeAccuracy: null,\n heading: null,\n speed: null\n });\n\n useEffect(() => {\n const onEvent = ({ coords, timestamp }: GeolocationPosition) => {\n setValue({\n ...value,\n loading: false,\n timestamp,\n latitude: coords.latitude,\n longitude: coords.longitude,\n altitude: coords.altitude,\n accuracy: coords.accuracy,\n altitudeAccuracy: coords.altitudeAccuracy,\n heading: coords.heading,\n speed: coords.speed\n });\n };\n\n const onEventError = (error: GeolocationPositionError) => {\n setValue({\n ...value,\n loading: false,\n error\n });\n };\n\n navigator.geolocation.getCurrentPosition(onEvent, onEventError, params);\n const watchId = navigator.geolocation.watchPosition(onEvent, onEventError, params);\n\n return () => {\n navigator.geolocation.clearWatch(watchId);\n };\n }, [params?.enableHighAccuracy, params?.maximumAge, params?.timeout]);\n\n return value;\n};\n"],"names":["useGeolocation","params","_useState","useState","loading","error","timestamp","Date","now","accuracy","latitude","Number","POSITIVE_INFINITY","longitude","altitude","altitudeAccuracy","heading","speed","_useState2","_slicedToArray","value","setValue","useEffect","onEvent","_ref","coords","_objectSpread","onEventError","navigator","geolocation","getCurrentPosition","watchId","watchPosition","clearWatch","enableHighAccuracy","maximumAge","timeout"],"mappings":";2HA0CaA,EAAiB,SAACC,GAC7B,IAAAC,EAA0BC,EAWvB,CACDC,SAAS,EACTC,MAAO,KACPC,UAAWC,KAAKC,MAChBC,SAAU,EACVC,SAAUC,OAAOC,kBACjBC,UAAWF,OAAOC,kBAClBE,SAAU,KACVC,iBAAkB,KAClBC,QAAS,KACTC,MAAO,OACPC,EAAAC,EAAAjB,EAAA,GAtBKkB,EAAKF,EAAA,GAAEG,EAAQH,EAAA,GAwDtB,OAhCAI,GAAU,WACR,IAAMC,EAAU,SAAHC,GAAmD,IAA7CC,EAAMD,EAANC,OAAQnB,EAASkB,EAATlB,UACzBe,EAAQK,EAAAA,KACHN,GAAK,CAAA,EAAA,CACRhB,SAAS,EACTE,UAAAA,EACAI,SAAUe,EAAOf,SACjBG,UAAWY,EAAOZ,UAClBC,SAAUW,EAAOX,SACjBL,SAAUgB,EAAOhB,SACjBM,iBAAkBU,EAAOV,iBACzBC,QAASS,EAAOT,QAChBC,MAAOQ,EAAOR,UAIZU,EAAe,SAACtB,GACpBgB,EAAQK,EAAAA,KACHN,GAAK,CAAA,EAAA,CACRhB,SAAS,EACTC,MAAAA,MAIJuB,UAAUC,YAAYC,mBAAmBP,EAASI,EAAc1B,GAChE,IAAM8B,EAAUH,UAAUC,YAAYG,cAAcT,EAASI,EAAc1B,GAE3E,OAAO,WACL2B,UAAUC,YAAYI,WAAWF,GAEpC,GAAE,CAAC9B,aAAAA,EAAAA,EAAQiC,mBAAoBjC,eAAAA,EAAQkC,WAAYlC,aAAM,EAANA,EAAQmC,UAErDhB,CACT"}
1
+ {"version":3,"file":"useGeolocation.js","sources":["../../../../src/hooks/useGeolocation/useGeolocation.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\n/** The use geolocation return type */\nexport interface UseGeolocationReturn {\n /** The loading state */\n loading: boolean;\n /** The error of the last position update */\n error: GeolocationPositionError | null;\n /** The timestamp of the last position update */\n timestamp: number | null;\n /** The accuracy of the last position update */\n accuracy: number | null;\n /** The latitude of the last position update */\n latitude: number | null;\n /** The longitude of the last position update */\n longitude: number | null;\n /** The altitude of the last position update */\n altitude: number | null;\n /** The altitude accuracy of the last position update */\n altitudeAccuracy: number | null;\n /** The heading of the last position update */\n heading: number | null;\n /** The speed of the last position update */\n speed: number | null;\n}\n\n/** The use geolocation params type */\nexport type UseGeolocationParams = PositionOptions;\n\n/**\n * @name useGeolocation\n * @description - Hook that returns the current geolocation\n * @category Browser\n *\n * @param {boolean} [params.enableHighAccuracy] Enable high accuracy\n * @param {number} [params.maximumAge] Maximum age\n * @param {number} [params.timeout] Timeout\n * @returns {UseGeolocationReturn}\n *\n * @example\n * const { loading, error, timestamp, accuracy, latitude, longitude, altitude, altitudeAccuracy, heading, speed } = useGeolocation();\n */\nexport const useGeolocation = (params?: UseGeolocationParams): UseGeolocationReturn => {\n const [value, setValue] = useState<{\n loading: boolean;\n error: GeolocationPositionError | null;\n timestamp: number | null;\n accuracy: number | null;\n latitude: number | null;\n longitude: number | null;\n altitude: number | null;\n altitudeAccuracy: number | null;\n heading: number | null;\n speed: number | null;\n }>({\n loading: true,\n error: null,\n timestamp: Date.now(),\n accuracy: 0,\n latitude: Number.POSITIVE_INFINITY,\n longitude: Number.POSITIVE_INFINITY,\n altitude: null,\n altitudeAccuracy: null,\n heading: null,\n speed: null\n });\n\n useEffect(() => {\n const onEvent = ({ coords, timestamp }: GeolocationPosition) => {\n setValue({\n ...value,\n loading: false,\n timestamp,\n latitude: coords.latitude,\n longitude: coords.longitude,\n altitude: coords.altitude,\n accuracy: coords.accuracy,\n altitudeAccuracy: coords.altitudeAccuracy,\n heading: coords.heading,\n speed: coords.speed\n });\n };\n\n const onEventError = (error: GeolocationPositionError) => {\n setValue({\n ...value,\n loading: false,\n error\n });\n };\n\n navigator.geolocation.getCurrentPosition(onEvent, onEventError, params);\n const watchId = navigator.geolocation.watchPosition(onEvent, onEventError, params);\n\n return () => {\n navigator.geolocation.clearWatch(watchId);\n };\n }, [params?.enableHighAccuracy, params?.maximumAge, params?.timeout]);\n\n return value;\n};\n"],"names":["useGeolocation","params","_useState","useState","loading","error","timestamp","Date","now","accuracy","latitude","Number","POSITIVE_INFINITY","longitude","altitude","altitudeAccuracy","heading","speed","_useState2","_slicedToArray","value","setValue","useEffect","onEvent","_ref","coords","_objectSpread","onEventError","navigator","geolocation","getCurrentPosition","watchId","watchPosition","clearWatch","enableHighAccuracy","maximumAge","timeout"],"mappings":";2HA0CaA,EAAiB,SAACC,GAC7B,IAAAC,EAA0BC,EAWvB,CACDC,SAAS,EACTC,MAAO,KACPC,UAAWC,KAAKC,MAChBC,SAAU,EACVC,SAAUC,OAAOC,kBACjBC,UAAWF,OAAOC,kBAClBE,SAAU,KACVC,iBAAkB,KAClBC,QAAS,KACTC,MAAO,OACPC,EAAAC,EAAAjB,EAAA,GAtBKkB,EAAKF,EAAA,GAAEG,EAAQH,EAAA,GAwDtB,OAhCAI,GAAU,WACR,IAAMC,EAAU,SAAHC,GAAmD,IAA7CC,EAAMD,EAANC,OAAQnB,EAASkB,EAATlB,UACzBe,EAAQK,EAAAA,KACHN,GAAK,CAAA,EAAA,CACRhB,SAAS,EACTE,UAAAA,EACAI,SAAUe,EAAOf,SACjBG,UAAWY,EAAOZ,UAClBC,SAAUW,EAAOX,SACjBL,SAAUgB,EAAOhB,SACjBM,iBAAkBU,EAAOV,iBACzBC,QAASS,EAAOT,QAChBC,MAAOQ,EAAOR,UAIZU,EAAe,SAACtB,GACpBgB,EAAQK,EAAAA,KACHN,GAAK,CAAA,EAAA,CACRhB,SAAS,EACTC,MAAAA,MAIJuB,UAAUC,YAAYC,mBAAmBP,EAASI,EAAc1B,GAChE,IAAM8B,EAAUH,UAAUC,YAAYG,cAAcT,EAASI,EAAc1B,GAE3E,OAAO,WACL2B,UAAUC,YAAYI,WAAWF,GAEpC,GAAE,CAAC9B,aAAAA,EAAAA,EAAQiC,mBAAoBjC,eAAAA,EAAQkC,WAAYlC,aAAM,EAANA,EAAQmC,UAErDhB,CACT"}
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
2
- import{_ as n}from"../../_rollupPluginBabelHelpers-DzHsVrgu.js";import{useState as o,useEffect as e}from"react";var r=function(){return decodeURIComponent(window.location.hash.replace("#",""))},t=function(){var t=o(window?r():""),i=n(t,2),a=i[0],c=i[1];return e((function(){var n=function(){return c(r())};return window.addEventListener("hashchange",n),function(){window.removeEventListener("hashchange",n)}})),[a,function(n){window.location.hash=n,c(n)}]};export{t as useHash};
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
+ import{_ as n}from"../../_rollupPluginBabelHelpers-DmsB_Gfn.js";import{useState as o,useEffect as e}from"react";var r=function(){return decodeURIComponent(window.location.hash.replace("#",""))},t=function(){var t=o(window?r():""),i=n(t,2),a=i[0],c=i[1];return e((function(){var n=function(){return c(r())};return window.addEventListener("hashchange",n),function(){window.removeEventListener("hashchange",n)}})),[a,function(n){window.location.hash=n,c(n)}]};export{t as useHash};
3
3
  //# sourceMappingURL=useHash.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
2
- import{_ as e,a as o}from"../../_rollupPluginBabelHelpers-DzHsVrgu.js";import{useState as n}from"react";import{useDidUpdate as t}from"../useDidUpdate/useDidUpdate.js";import{useEventListener as r}from"../useEventListener/useEventListener.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";import"../useEvent/useEvent.js";var i=function(e,o){return e.toLowerCase().split(/[+_-]/g).map((function(e){return e.trim()})).every((function(e){return o.find((function(o){return e===o.code.toLocaleLowerCase()||e===o.key.toLocaleLowerCase()||e===o.alias.toLocaleLowerCase()}))}))},u=function(u,l,a){var s,c,d,f,v=null===(s=null==a?void 0:a.enabled)||void 0===s||s,p=null===(c=null==a?void 0:a.preventDefault)||void 0===c||c,m=n([]),y=e(m,2)[1];t((function(){y([])}),[v]),r(null!==(d=null==a?void 0:a.target)&&void 0!==d?d:window,"keydown",(function(e){p&&e.preventDefault(),v&&y((function(n){var t,r,s,c;if(n.some((function(o){return o.code===e.code})))return n;var d=null!==(t=null!==(r=null==a||null===(s=a.aliasMap)||void 0===s?void 0:s[e.key])&&void 0!==r?r:null==a||null===(c=a.aliasMap)||void 0===c?void 0:c[e.key])&&void 0!==t?t:e.code,f=[].concat(o(n),[{key:e.key,code:e.code,alias:d}]);Array.isArray(u)?u.forEach((function(o){i(o,f)&&l(e)})):i(u,f)&&l(e);return f}))})),r(null!==(f=null==a?void 0:a.target)&&void 0!==f?f:window,"keyup",(function(e){v&&y((function(o){return o.filter((function(o){return o.code!==e.code}))}))}))};export{i as isHotkeyMatch,u as useHotkeys};
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
+ import{_ as e,a as o}from"../../_rollupPluginBabelHelpers-DmsB_Gfn.js";import{useState as n}from"react";import{useDidUpdate as t}from"../useDidUpdate/useDidUpdate.js";import{useEventListener as r}from"../useEventListener/useEventListener.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";import"../useEvent/useEvent.js";var i=function(e,o){return e.toLowerCase().split(/[+_-]/g).map((function(e){return e.trim()})).every((function(e){return o.find((function(o){return e===o.code.toLocaleLowerCase()||e===o.key.toLocaleLowerCase()||e===o.alias.toLocaleLowerCase()}))}))},u=function(u,l,a){var s,c,d,f,v=null===(s=null==a?void 0:a.enabled)||void 0===s||s,p=null===(c=null==a?void 0:a.preventDefault)||void 0===c||c,m=n([]),y=e(m,2)[1];t((function(){y([])}),[v]),r(null!==(d=null==a?void 0:a.target)&&void 0!==d?d:window,"keydown",(function(e){p&&e.preventDefault(),v&&y((function(n){var t,r,s,c;if(n.some((function(o){return o.code===e.code})))return n;var d=null!==(t=null!==(r=null==a||null===(s=a.aliasMap)||void 0===s?void 0:s[e.key])&&void 0!==r?r:null==a||null===(c=a.aliasMap)||void 0===c?void 0:c[e.key])&&void 0!==t?t:e.code,f=[].concat(o(n),[{key:e.key,code:e.code,alias:d}]);Array.isArray(u)?u.forEach((function(o){i(o,f)&&l(e)})):i(u,f)&&l(e);return f}))})),r(null!==(f=null==a?void 0:a.target)&&void 0!==f?f:window,"keyup",(function(e){v&&y((function(o){return o.filter((function(o){return o.code!==e.code}))}))}))};export{i as isHotkeyMatch,u as useHotkeys};
3
3
  //# sourceMappingURL=useHotkeys.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useHotkeys.js","sources":["../../../../src/hooks/useHotkeys/useHotkeys.ts"],"sourcesContent":["import { useState } from 'react';\n\nimport { useDidUpdate } from '../useDidUpdate/useDidUpdate';\nimport type { UseEventListenerTarget } from '../useEventListener/useEventListener';\nimport { useEventListener } from '../useEventListener/useEventListener';\n\n/** The use hotkeys params */\nexport interface UseHotkeysOptions {\n /** The target to attach the event listeners to */\n target?: UseEventListenerTarget;\n /** Enable or disable the event listeners */\n enabled?: boolean;\n /** Whether to prevent the default behavior of the event */\n preventDefault?: boolean;\n /** Alias map for hotkeys */\n aliasMap?: Record<string, string>;\n}\n\nexport const isHotkeyMatch = (hotkey: string, keys: UseHotkeysKey[]) =>\n hotkey\n .toLowerCase()\n .split(/[+_-]/g)\n .map((key) => key.trim())\n .every((key) =>\n keys.find(\n (updatedKey) =>\n key === updatedKey.code.toLocaleLowerCase() ||\n key === updatedKey.key.toLocaleLowerCase() ||\n key === updatedKey.alias.toLocaleLowerCase()\n )\n );\n\nexport type UseHotkeysHotkeys = string[] | string;\nexport type UseHotkeysKey = { key: string; code: string; alias: string };\n\n/**\n * @name useHotkeys\n * @description - Hook that listens for hotkeys\n * @category Sensors\n *\n * @param {UseHotkeysHotkeys} hotkeys The key or keys to listen for\n * @param {(event: KeyboardEvent) => void} callback The callback function to be called when the hotkey is pressed\n * @param {UseEventListenerTarget} [options.target=window] The target to attach the event listeners to\n * @param {boolean} [options.enabled=true] Enable or disable the event listeners\n * @param {boolean} [options.preventDefault=true] Whether to prevent the default behavior of the event\n * @param {Record<string, string>} [options.aliasMap] Alias map for hotkeys\n * @returns {useKeysPressedReturns} Array of strings with keys that were press\n *\n * @example\n * useHotkeys('control+a', () => console.log('hotkey pressed'));\n *\n * @example\n * useHotkeys('ControlLeft+KeyA', () => console.log('hotkey pressed'));\n */\nexport const useHotkeys = (\n hotkeys: UseHotkeysHotkeys,\n callback: (event: KeyboardEvent) => void,\n options?: UseHotkeysOptions\n) => {\n const enabled = options?.enabled ?? true;\n const preventDefault = options?.preventDefault ?? true;\n const [, setKeys] = useState<UseHotkeysKey[]>([]);\n\n const onKeyDown = (event: KeyboardEvent) => {\n if (preventDefault) event.preventDefault();\n\n if (!enabled) return;\n\n setKeys((prevKeys) => {\n if (prevKeys.some(({ code }) => code === event.code)) return prevKeys;\n const alias = options?.aliasMap?.[event.key] ?? options?.aliasMap?.[event.key] ?? event.code;\n const updatedKeys = [...prevKeys, { key: event.key, code: event.code, alias }];\n\n if (Array.isArray(hotkeys)) {\n hotkeys.forEach((hotkey) => {\n const isMatch = isHotkeyMatch(hotkey, updatedKeys);\n if (isMatch) callback(event);\n });\n } else {\n const isMatch = isHotkeyMatch(hotkeys, updatedKeys);\n if (isMatch) callback(event);\n }\n\n return updatedKeys;\n });\n };\n\n const onKeyUp = (event: KeyboardEvent) => {\n if (!enabled) return;\n setKeys((prevKeys) => prevKeys.filter(({ code }) => code !== event.code));\n };\n\n useDidUpdate(() => {\n setKeys([]);\n }, [enabled]);\n\n useEventListener(options?.target ?? window, 'keydown', onKeyDown);\n useEventListener(options?.target ?? window, 'keyup', onKeyUp);\n};\n"],"names":["isHotkeyMatch","hotkey","keys","toLowerCase","split","map","key","trim","every","find","updatedKey","code","toLocaleLowerCase","alias","useHotkeys","hotkeys","callback","options","_options$enabled","_options$preventDefau","_options$target","_options$target2","enabled","preventDefault","_useState","useState","setKeys","_slicedToArray","useDidUpdate","useEventListener","target","window","event","prevKeys","_ref2","_options$aliasMap$eve","_options$aliasMap","_options$aliasMap2","some","_ref","aliasMap","updatedKeys","concat","_toConsumableArray","Array","isArray","forEach","filter","_ref3"],"mappings":";4XAkBO,IAAMA,EAAgB,SAACC,EAAgBC,GAAqB,OACjED,EACGE,cACAC,MAAM,UACNC,KAAI,SAACC,GAAG,OAAKA,EAAIC,MAAM,IACvBC,OAAM,SAACF,GAAG,OACTJ,EAAKO,MACH,SAACC,GAAU,OACTJ,IAAQI,EAAWC,KAAKC,qBACxBN,IAAQI,EAAWJ,IAAIM,qBACvBN,IAAQI,EAAWG,MAAMD,mBAAmB,GAC/C,GACF,EAwBQE,EAAa,SACxBC,EACAC,EACAC,GACG,IAAAC,EAAAC,EAAAC,EAAAC,EACGC,EAA0BJ,QAAnBA,EAAGD,aAAO,EAAPA,EAASK,eAAOJ,IAAAA,GAAAA,EAC1BK,EAAwCJ,QAA1BA,EAAGF,aAAO,EAAPA,EAASM,sBAAcJ,IAAAA,GAAAA,EAC9CK,EAAoBC,EAA0B,IAArCC,EAAwCC,EAAAH,EAAA,GAAjC,GA+BhBI,GAAa,WACXF,EAAQ,GACV,GAAG,CAACJ,IAEJO,UAAgBT,EAACH,aAAO,EAAPA,EAASa,cAAM,IAAAV,EAAAA,EAAIW,OAAQ,WAjC1B,SAACC,GACbT,GAAgBS,EAAMT,iBAErBD,GAELI,GAAQ,SAACO,GAAa,IAAAC,EAAAC,EAAAC,EAAAC,EACpB,GAAIJ,EAASK,MAAK,SAAAC,GAAO,OAAAA,EAAJ5B,OAAoBqB,EAAMrB,QAAO,OAAOsB,EAC7D,IAAMpB,EAAwE,QAAnEqB,EAAiC,QAAjCC,EAAGlB,SAAiBmB,QAAVA,EAAPnB,EAASuB,gBAATJ,IAAiBA,OAAjBA,EAAAA,EAAoBJ,EAAM1B,YAAI,IAAA6B,EAAAA,EAAIlB,SAAiB,QAAVoB,EAAPpB,EAASuB,gBAAQ,IAAAH,OAAA,EAAjBA,EAAoBL,EAAM1B,YAAI,IAAA4B,EAAAA,EAAIF,EAAMrB,KAClF8B,EAAWC,GAAAA,OAAAC,EAAOV,GAAU,CAAA,CAAE3B,IAAK0B,EAAM1B,IAAKK,KAAMqB,EAAMrB,KAAME,MAAAA,KAElE+B,MAAMC,QAAQ9B,GAChBA,EAAQ+B,SAAQ,SAAC7C,GACCD,EAAcC,EAAQwC,IACzBzB,EAASgB,EACxB,IAEgBhC,EAAce,EAAS0B,IAC1BzB,EAASgB,GAGxB,OAAOS,CACT,OAaFZ,UAAgBR,EAACJ,aAAO,EAAPA,EAASa,cAAM,IAAAT,EAAAA,EAAIU,OAAQ,SAV5B,SAACC,GACVV,GACLI,GAAQ,SAACO,GAAQ,OAAKA,EAASc,QAAO,SAAAC,GAAO,OAAAA,EAAJrC,OAAoBqB,EAAMrB,aASvE"}
1
+ {"version":3,"file":"useHotkeys.js","sources":["../../../../src/hooks/useHotkeys/useHotkeys.ts"],"sourcesContent":["import { useState } from 'react';\n\nimport { useDidUpdate } from '../useDidUpdate/useDidUpdate';\nimport type { UseEventListenerTarget } from '../useEventListener/useEventListener';\nimport { useEventListener } from '../useEventListener/useEventListener';\n\n/** The use hotkeys params type */\nexport interface UseHotkeysOptions {\n /** The target to attach the event listeners to */\n target?: UseEventListenerTarget;\n /** Enable or disable the event listeners */\n enabled?: boolean;\n /** Whether to prevent the default behavior of the event */\n preventDefault?: boolean;\n /** Alias map for hotkeys */\n aliasMap?: Record<string, string>;\n}\n\nexport const isHotkeyMatch = (hotkey: string, keys: UseHotkeysKey[]) =>\n hotkey\n .toLowerCase()\n .split(/[+_-]/g)\n .map((key) => key.trim())\n .every((key) =>\n keys.find(\n (updatedKey) =>\n key === updatedKey.code.toLocaleLowerCase() ||\n key === updatedKey.key.toLocaleLowerCase() ||\n key === updatedKey.alias.toLocaleLowerCase()\n )\n );\n\nexport type UseHotkeysHotkeys = string[] | string;\nexport type UseHotkeysKey = { key: string; code: string; alias: string };\n\n/**\n * @name useHotkeys\n * @description - Hook that listens for hotkeys\n * @category Sensors\n *\n * @param {UseHotkeysHotkeys} hotkeys The key or keys to listen for\n * @param {(event: KeyboardEvent) => void} callback The callback function to be called when the hotkey is pressed\n * @param {UseEventListenerTarget} [options.target=window] The target to attach the event listeners to\n * @param {boolean} [options.enabled=true] Enable or disable the event listeners\n * @param {boolean} [options.preventDefault=true] Whether to prevent the default behavior of the event\n * @param {Record<string, string>} [options.aliasMap] Alias map for hotkeys\n * @returns {useKeysPressedReturns} Array of strings with keys that were press\n *\n * @example\n * useHotkeys('control+a', () => console.log('hotkey pressed'));\n *\n * @example\n * useHotkeys('ControlLeft+KeyA', () => console.log('hotkey pressed'));\n */\nexport const useHotkeys = (\n hotkeys: UseHotkeysHotkeys,\n callback: (event: KeyboardEvent) => void,\n options?: UseHotkeysOptions\n) => {\n const enabled = options?.enabled ?? true;\n const preventDefault = options?.preventDefault ?? true;\n const [, setKeys] = useState<UseHotkeysKey[]>([]);\n\n const onKeyDown = (event: KeyboardEvent) => {\n if (preventDefault) event.preventDefault();\n\n if (!enabled) return;\n\n setKeys((prevKeys) => {\n if (prevKeys.some(({ code }) => code === event.code)) return prevKeys;\n const alias = options?.aliasMap?.[event.key] ?? options?.aliasMap?.[event.key] ?? event.code;\n const updatedKeys = [...prevKeys, { key: event.key, code: event.code, alias }];\n\n if (Array.isArray(hotkeys)) {\n hotkeys.forEach((hotkey) => {\n const isMatch = isHotkeyMatch(hotkey, updatedKeys);\n if (isMatch) callback(event);\n });\n } else {\n const isMatch = isHotkeyMatch(hotkeys, updatedKeys);\n if (isMatch) callback(event);\n }\n\n return updatedKeys;\n });\n };\n\n const onKeyUp = (event: KeyboardEvent) => {\n if (!enabled) return;\n setKeys((prevKeys) => prevKeys.filter(({ code }) => code !== event.code));\n };\n\n useDidUpdate(() => {\n setKeys([]);\n }, [enabled]);\n\n useEventListener(options?.target ?? window, 'keydown', onKeyDown);\n useEventListener(options?.target ?? window, 'keyup', onKeyUp);\n};\n"],"names":["isHotkeyMatch","hotkey","keys","toLowerCase","split","map","key","trim","every","find","updatedKey","code","toLocaleLowerCase","alias","useHotkeys","hotkeys","callback","options","_options$enabled","_options$preventDefau","_options$target","_options$target2","enabled","preventDefault","_useState","useState","setKeys","_slicedToArray","useDidUpdate","useEventListener","target","window","event","prevKeys","_ref2","_options$aliasMap$eve","_options$aliasMap","_options$aliasMap2","some","_ref","aliasMap","updatedKeys","concat","_toConsumableArray","Array","isArray","forEach","filter","_ref3"],"mappings":";4XAkBO,IAAMA,EAAgB,SAACC,EAAgBC,GAAqB,OACjED,EACGE,cACAC,MAAM,UACNC,KAAI,SAACC,GAAG,OAAKA,EAAIC,MAAM,IACvBC,OAAM,SAACF,GAAG,OACTJ,EAAKO,MACH,SAACC,GAAU,OACTJ,IAAQI,EAAWC,KAAKC,qBACxBN,IAAQI,EAAWJ,IAAIM,qBACvBN,IAAQI,EAAWG,MAAMD,mBAAmB,GAC/C,GACF,EAwBQE,EAAa,SACxBC,EACAC,EACAC,GACG,IAAAC,EAAAC,EAAAC,EAAAC,EACGC,EAA0BJ,QAAnBA,EAAGD,aAAO,EAAPA,EAASK,eAAOJ,IAAAA,GAAAA,EAC1BK,EAAwCJ,QAA1BA,EAAGF,aAAO,EAAPA,EAASM,sBAAcJ,IAAAA,GAAAA,EAC9CK,EAAoBC,EAA0B,IAArCC,EAAwCC,EAAAH,EAAA,GAAjC,GA+BhBI,GAAa,WACXF,EAAQ,GACV,GAAG,CAACJ,IAEJO,UAAgBT,EAACH,aAAO,EAAPA,EAASa,cAAM,IAAAV,EAAAA,EAAIW,OAAQ,WAjC1B,SAACC,GACbT,GAAgBS,EAAMT,iBAErBD,GAELI,GAAQ,SAACO,GAAa,IAAAC,EAAAC,EAAAC,EAAAC,EACpB,GAAIJ,EAASK,MAAK,SAAAC,GAAO,OAAAA,EAAJ5B,OAAoBqB,EAAMrB,QAAO,OAAOsB,EAC7D,IAAMpB,EAAwE,QAAnEqB,EAAiC,QAAjCC,EAAGlB,SAAiBmB,QAAVA,EAAPnB,EAASuB,gBAATJ,IAAiBA,OAAjBA,EAAAA,EAAoBJ,EAAM1B,YAAI,IAAA6B,EAAAA,EAAIlB,SAAiB,QAAVoB,EAAPpB,EAASuB,gBAAQ,IAAAH,OAAA,EAAjBA,EAAoBL,EAAM1B,YAAI,IAAA4B,EAAAA,EAAIF,EAAMrB,KAClF8B,EAAWC,GAAAA,OAAAC,EAAOV,GAAU,CAAA,CAAE3B,IAAK0B,EAAM1B,IAAKK,KAAMqB,EAAMrB,KAAME,MAAAA,KAElE+B,MAAMC,QAAQ9B,GAChBA,EAAQ+B,SAAQ,SAAC7C,GACCD,EAAcC,EAAQwC,IACzBzB,EAASgB,EACxB,IAEgBhC,EAAce,EAAS0B,IAC1BzB,EAASgB,GAGxB,OAAOS,CACT,OAaFZ,UAAgBR,EAACJ,aAAO,EAAPA,EAASa,cAAM,IAAAT,EAAAA,EAAIU,OAAQ,SAV5B,SAACC,GACVV,GACLI,GAAQ,SAACO,GAAQ,OAAKA,EAASc,QAAO,SAAAC,GAAO,OAAAA,EAAJrC,OAAoBqB,EAAMrB,aASvE"}
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
2
- import{c as n,_ as e}from"../../_rollupPluginBabelHelpers-DzHsVrgu.js";import{useState as t,useRef as o}from"react";import{useEventListener as l}from"../useEventListener/useEventListener.js";import"../useEvent/useEvent.js";var i=function(){var i=(arguments.length<=0?void 0:arguments[0])instanceof Function||!("current"in(arguments.length<=0?void 0:arguments[0])||(arguments.length<=0?void 0:arguments[0])instanceof Element)||arguments.length<=0?void 0:arguments[0],r=i?"object"===n(arguments.length<=1?void 0:arguments[1])?arguments.length<=1?void 0:arguments[1]:{onEntry:arguments.length<=1?void 0:arguments[1]}:"object"===n(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:{onEntry:arguments.length<=0?void 0:arguments[0]},v=t(!1),u=e(v,2),s=u[0],a=u[1],c=o();return l(null!=i?i:c,"mouseenter",(function(){var n;null==r||null===(n=r.onEntry)||void 0===n||n.call(r),a(!0)})),l(null!=i?i:c,"mouseleave",(function(){var n;null==r||null===(n=r.onLeave)||void 0===n||n.call(r),a(!1)})),i?s:[c,s]};export{i as useHover};
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
+ import{c as n,_ as e}from"../../_rollupPluginBabelHelpers-DmsB_Gfn.js";import{useState as t,useRef as o}from"react";import{useEventListener as l}from"../useEventListener/useEventListener.js";import"../useEvent/useEvent.js";var i=function(){var i=(arguments.length<=0?void 0:arguments[0])instanceof Function||!("current"in(arguments.length<=0?void 0:arguments[0])||(arguments.length<=0?void 0:arguments[0])instanceof Element)||arguments.length<=0?void 0:arguments[0],r=i?"object"===n(arguments.length<=1?void 0:arguments[1])?arguments.length<=1?void 0:arguments[1]:{onEntry:arguments.length<=1?void 0:arguments[1]}:"object"===n(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:{onEntry:arguments.length<=0?void 0:arguments[0]},v=t(!1),u=e(v,2),s=u[0],a=u[1],c=o();return l(null!=i?i:c,"mouseenter",(function(){var n;null==r||null===(n=r.onEntry)||void 0===n||n.call(r),a(!0)})),l(null!=i?i:c,"mouseleave",(function(){var n;null==r||null===(n=r.onLeave)||void 0===n||n.call(r),a(!1)})),i?s:[c,s]};export{i as useHover};
3
3
  //# sourceMappingURL=useHover.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
2
- import{_ as e}from"../../_rollupPluginBabelHelpers-DzHsVrgu.js";import{useState as t,useEffect as n}from"react";import"../../utils/helpers/isClient.js";import{throttle as i}from"../../utils/helpers/throttle.js";var o=["mousemove","mousedown","keydown","touchstart","wheel","resize"],r=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:6e4,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=u.initialValue,l=void 0!==s&&s,a=u.events,c=void 0===a?o:a,d=t(l),m=e(d,2),v=m[0],f=m[1],h=t(Date.now()),p=e(h,2),w=p[0],E=p[1];return n((function(){var e,t=function(){return f(!0)},n=i((function(){f(!1),E(Date.now()),clearTimeout(e),e=setTimeout(t,r)}),500),o=function(){document.hidden||n()};return e=setTimeout(t,r),c.forEach((function(e){return window.addEventListener(e,n)})),document.addEventListener("visibilitychange",o),function(){c.forEach((function(e){return window.addEventListener(e,n)})),document.removeEventListener("visibilitychange",o),clearTimeout(e)}}),[r,c]),{idle:v,lastActive:w}};export{r as useIdle};
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
+ import{_ as e}from"../../_rollupPluginBabelHelpers-DmsB_Gfn.js";import{useState as t,useEffect as n}from"react";import"../../utils/helpers/isClient.js";import{throttle as i}from"../../utils/helpers/throttle.js";var o=["mousemove","mousedown","keydown","touchstart","wheel","resize"],r=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:6e4,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=u.initialValue,l=void 0!==s&&s,a=u.events,c=void 0===a?o:a,d=t(l),m=e(d,2),v=m[0],f=m[1],h=t(Date.now()),p=e(h,2),w=p[0],E=p[1];return n((function(){var e,t=function(){return f(!0)},n=i((function(){f(!1),E(Date.now()),clearTimeout(e),e=setTimeout(t,r)}),500),o=function(){document.hidden||n()};return e=setTimeout(t,r),c.forEach((function(e){return window.addEventListener(e,n)})),document.addEventListener("visibilitychange",o),function(){c.forEach((function(e){return window.addEventListener(e,n)})),document.removeEventListener("visibilitychange",o),clearTimeout(e)}}),[r,c]),{idle:v,lastActive:w}};export{r as useIdle};
3
3
  //# sourceMappingURL=useIdle.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
2
- import{b as r,a as e,d as s,e as t}from"../../_rollupPluginBabelHelpers-DzHsVrgu.js";import{useQuery as o}from"../useQuery/useQuery.js";import"react";import"../../utils/helpers/getRetry.js";import"../../utils/helpers/isClient.js";import"../useDidUpdate/useDidUpdate.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../useMount/useMount.js";var n=function(){var r=s(t().mark((function r(e){var s,o=arguments;return t().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return s=o.length>1&&void 0!==o[1]?o[1]:{},r.abrupt("return",new Promise((function(r,t){var o=new Image,n=s.srcset,i=s.sizes,u=s.class,a=s.loading,c=s.crossorigin,p=s.referrerPolicy;o.src=e,n&&(o.srcset=n),i&&(o.sizes=i),u&&(o.className=u),a&&(o.loading=a),c&&(o.crossOrigin=c),p&&(o.referrerPolicy=p),o.onload=function(){return r(o)},o.onerror=t})));case 2:case"end":return r.stop()}}),r)})));return function(e){return r.apply(this,arguments)}}(),i=function(s,t){var i,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return o((function(){return n(s,t)}),r({keys:[s].concat(e(null!==(i=u.keys)&&void 0!==i?i:[]))},u))};export{i as useImage};
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
+ import{b as r,a as e,d as s,e as t}from"../../_rollupPluginBabelHelpers-DmsB_Gfn.js";import{useQuery as o}from"../useQuery/useQuery.js";import"react";import"../../utils/helpers/getRetry.js";import"../../utils/helpers/isClient.js";import"../useDidUpdate/useDidUpdate.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../useMount/useMount.js";var n=function(){var r=s(t().mark((function r(e){var s,o=arguments;return t().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return s=o.length>1&&void 0!==o[1]?o[1]:{},r.abrupt("return",new Promise((function(r,t){var o=new Image,n=s.srcset,i=s.sizes,u=s.class,a=s.loading,c=s.crossorigin,p=s.referrerPolicy;o.src=e,n&&(o.srcset=n),i&&(o.sizes=i),u&&(o.className=u),a&&(o.loading=a),c&&(o.crossOrigin=c),p&&(o.referrerPolicy=p),o.onload=function(){return r(o)},o.onerror=t})));case 2:case"end":return r.stop()}}),r)})));return function(e){return r.apply(this,arguments)}}(),i=function(s,t){var i,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return o((function(){return n(s,t)}),r({keys:[s].concat(e(null!==(i=u.keys)&&void 0!==i?i:[]))},u))};export{i as useImage};
3
3
  //# sourceMappingURL=useImage.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
2
- import{_ as r,d as n,e}from"../../_rollupPluginBabelHelpers-DzHsVrgu.js";import{useState as t,useRef as o,useEffect as i}from"react";import{useEvent as u}from"../useEvent/useEvent.js";import{useRerender as c}from"../useRerender/useRerender.js";var a=function(){for(var a,s,l=c(),f=arguments.length,v=new Array(f),d=0;d<f;d++)v[d]=arguments[d];var p=v[1]instanceof Function?v[0]:void 0,m=v[1]instanceof Function?v[1]:v[0],h=v[1]instanceof Function?v[2]:v[1],g=null!==(a=null==h?void 0:h.direction)&&void 0!==a?a:"bottom",b=null!==(s=null==h?void 0:h.distance)&&void 0!==s?s:10,x=t(!1),E=r(x,2),L=E[0],j=E[1],k=o(),w=o(m);w.current=m;var y=u(function(){var r=n(e().mark((function r(n){var t,o,i,u,c,a,s;return e().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!L){r.next=2;break}return r.abrupt("return");case 2:if(t=n.target,o=t.clientHeight,i=t.scrollHeight,u=t.scrollTop,c=t.clientWidth,a=t.scrollWidth,s=t.scrollLeft,!({bottom:i-(u+o),top:u,right:a-(s+c),left:s}[g]<=b)){r.next=11;break}return j(!0),r.next=10,w.current(n);case 10:j(!1);case 11:case"end":return r.stop()}}),r)})));return function(n){return r.apply(this,arguments)}}());return i((function(){var r=p?function(r){return"function"==typeof r?r():r instanceof Element?r:r.current}(p):k.current;if(r)return r.addEventListener("scroll",y),function(){r.removeEventListener("scroll",y)}}),[k.current,p,g,b]),p?L:{ref:function(r){k.current||(k.current=r,l.update())},isLoading:L}};export{a as useInfiniteScroll};
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
+ import{_ as r,d as n,e}from"../../_rollupPluginBabelHelpers-DmsB_Gfn.js";import{useState as t,useRef as o,useEffect as i}from"react";import{useEvent as u}from"../useEvent/useEvent.js";import{useRerender as c}from"../useRerender/useRerender.js";var a=function(){for(var a,s,l=c(),f=arguments.length,v=new Array(f),d=0;d<f;d++)v[d]=arguments[d];var p=v[1]instanceof Function?v[0]:void 0,m=v[1]instanceof Function?v[1]:v[0],h=v[1]instanceof Function?v[2]:v[1],g=null!==(a=null==h?void 0:h.direction)&&void 0!==a?a:"bottom",b=null!==(s=null==h?void 0:h.distance)&&void 0!==s?s:10,x=t(!1),E=r(x,2),L=E[0],j=E[1],k=o(),w=o(m);w.current=m;var y=u(function(){var r=n(e().mark((function r(n){var t,o,i,u,c,a,s;return e().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!L){r.next=2;break}return r.abrupt("return");case 2:if(t=n.target,o=t.clientHeight,i=t.scrollHeight,u=t.scrollTop,c=t.clientWidth,a=t.scrollWidth,s=t.scrollLeft,!({bottom:i-(u+o),top:u,right:a-(s+c),left:s}[g]<=b)){r.next=11;break}return j(!0),r.next=10,w.current(n);case 10:j(!1);case 11:case"end":return r.stop()}}),r)})));return function(n){return r.apply(this,arguments)}}());return i((function(){var r=p?function(r){return"function"==typeof r?r():r instanceof Element?r:r.current}(p):k.current;if(r)return r.addEventListener("scroll",y),function(){r.removeEventListener("scroll",y)}}),[k.current,p,g,b]),p?L:{ref:function(r){k.current||(k.current=r,l.update())},isLoading:L}};export{a as useInfiniteScroll};
3
3
  //# sourceMappingURL=useInfiniteScroll.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
2
- import{c as n,_ as e,b as r}from"../../_rollupPluginBabelHelpers-DzHsVrgu.js";import{useState as t,useRef as o,useEffect as i}from"react";import{useRerender as u}from"../useRerender/useRerender.js";var l=function(){var l,c=u(),d="object"!==n(arguments.length<=0?void 0:arguments[0])||"current"in(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,v=d?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],s=null===(l=null==v?void 0:v.enabled)||void 0===l||l,a=t(),f=e(a,2),g=f[0],m=f[1],h=o(),p=o();return p.current=null==v?void 0:v.onChange,i((function(){if(s&&h.current){var n=d?function(n){return"function"==typeof n?n():n instanceof Element?n:n.current}(d):h.current;if(n){var t,o=new IntersectionObserver((function(n){var r,t=e(n,1)[0];m(t),null===(r=p.current)||void 0===r||r.call(p,t)}),r(r({},v),{},{root:(t=null==v?void 0:v.root,t?t instanceof Element||t instanceof Document?t:t.current:document)}));return o.observe(n),function(){o.disconnect()}}}}),[h.current,d,null==v?void 0:v.rootMargin,null==v?void 0:v.threshold,null==v?void 0:v.root,s]),d?{entry:g,inView:!(null==g||!g.isIntersecting)}:{ref:function(n){h.current||(h.current=n,c.update())},entry:g,inView:!(null==g||!g.isIntersecting)}};export{l as useIntersectionObserver};
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
+ import{c as n,_ as e,b as r}from"../../_rollupPluginBabelHelpers-DmsB_Gfn.js";import{useState as t,useRef as o,useEffect as i}from"react";import{useRerender as u}from"../useRerender/useRerender.js";var l=function(){var l,c=u(),d="object"!==n(arguments.length<=0?void 0:arguments[0])||"current"in(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,v=d?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],s=null===(l=null==v?void 0:v.enabled)||void 0===l||l,a=t(),f=e(a,2),g=f[0],m=f[1],h=o(),p=o();return p.current=null==v?void 0:v.onChange,i((function(){if(s&&h.current){var n=d?function(n){return"function"==typeof n?n():n instanceof Element?n:n.current}(d):h.current;if(n){var t,o=new IntersectionObserver((function(n){var r,t=e(n,1)[0];m(t),null===(r=p.current)||void 0===r||r.call(p,t)}),r(r({},v),{},{root:(t=null==v?void 0:v.root,t?t instanceof Element||t instanceof Document?t:t.current:document)}));return o.observe(n),function(){o.disconnect()}}}}),[h.current,d,null==v?void 0:v.rootMargin,null==v?void 0:v.threshold,null==v?void 0:v.root,s]),d?{entry:g,inView:!(null==g||!g.isIntersecting)}:{ref:function(n){h.current||(h.current=n,c.update())},entry:g,inView:!(null==g||!g.isIntersecting)}};export{l as useIntersectionObserver};
3
3
  //# sourceMappingURL=useIntersectionObserver.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
2
- import{c as r,_ as e}from"../../_rollupPluginBabelHelpers-DzHsVrgu.js";import{useState as n,useRef as t,useEffect as l}from"react";import{useEvent as u}from"../useEvent/useEvent.js";var a=function(){for(var a,o,c=arguments.length,i=new Array(c),v=0;v<c;v++)i[v]=arguments[v];var s=i[0],f=null!==(a="number"==typeof i[1]?i[1]:i[1].interval)&&void 0!==a?a:1e3,m="object"===r(i[1])?i[1]:i[2],p=null===(o=null==m?void 0:m.enabled)||void 0===o||o,I=n(null==p||p),b=e(I,2),d=b[0],j=b[1],g=t(),y=u(s);l((function(){if(p)return g.current=setInterval(y,f),function(){clearInterval(g.current)}}),[p,f]);return{isActive:d,pause:function(){j(!1),clearInterval(g.current)},resume:function(){f<=0||(j(!0),clearInterval(g.current),g.current=setInterval(y,f))}}};export{a as useInterval};
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
+ import{c as r,_ as e}from"../../_rollupPluginBabelHelpers-DmsB_Gfn.js";import{useState as n,useRef as t,useEffect as l}from"react";import{useEvent as u}from"../useEvent/useEvent.js";var a=function(){for(var a,o,c=arguments.length,i=new Array(c),v=0;v<c;v++)i[v]=arguments[v];var s=i[0],f=null!==(a="number"==typeof i[1]?i[1]:i[1].interval)&&void 0!==a?a:1e3,m="object"===r(i[1])?i[1]:i[2],p=null===(o=null==m?void 0:m.enabled)||void 0===o||o,I=n(null==p||p),b=e(I,2),d=b[0],j=b[1],g=t(),y=u(s);l((function(){if(p)return g.current=setInterval(y,f),function(){clearInterval(g.current)}}),[p,f]);return{isActive:d,pause:function(){j(!1),clearInterval(g.current)},resume:function(){f<=0||(j(!0),clearInterval(g.current),g.current=setInterval(y,f))}}};export{a as useInterval};
3
3
  //# sourceMappingURL=useInterval.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
2
  import{useRef as r}from"react";var t=function(){var t=r(!0);return!0===t.current?(t.current=!1,!0):t.current};export{t as useIsFirstRender};
3
3
  //# sourceMappingURL=useIsFirstRender.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
2
  import{useLayoutEffect as r,useEffect as t}from"react";import{isClient as e}from"../../utils/helpers/isClient.js";var i=e?r:t;export{i as useIsomorphicLayoutEffect};
3
3
  //# sourceMappingURL=useIsomorphicLayoutEffect.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
2
- import{_ as e}from"../../_rollupPluginBabelHelpers-DzHsVrgu.js";import{useState as r}from"react";import{useEventListener as n}from"../useEventListener/useEventListener.js";import"../useEvent/useEvent.js";var i=function(i,t){var o,u,l=r(!1),s=e(l,2),a=s[0],v=s[1];return n(null!==(o=null==t?void 0:t.target)&&void 0!==o?o:window,"keydown",(function(e){(Array.isArray(i)?i.includes(e.key):e.key===i)&&v(!0)})),n(null!==(u=null==t?void 0:t.target)&&void 0!==u?u:window,"keyup",(function(e){(Array.isArray(i)?i.includes(e.key):e.key===i)&&v(!1)})),a};export{i as useKeyPress};
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
+ import{_ as e}from"../../_rollupPluginBabelHelpers-DmsB_Gfn.js";import{useState as r}from"react";import{useEventListener as n}from"../useEventListener/useEventListener.js";import"../useEvent/useEvent.js";var i=function(i,t){var o,u,l=r(!1),s=e(l,2),a=s[0],v=s[1];return n(null!==(o=null==t?void 0:t.target)&&void 0!==o?o:window,"keydown",(function(e){(Array.isArray(i)?i.includes(e.key):e.key===i)&&v(!0)})),n(null!==(u=null==t?void 0:t.target)&&void 0!==u?u:window,"keyup",(function(e){(Array.isArray(i)?i.includes(e.key):e.key===i)&&v(!1)})),a};export{i as useKeyPress};
3
3
  //# sourceMappingURL=useKeyPress.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
2
  import{useEventListener as n}from"../useEventListener/useEventListener.js";import"react";import"../useEvent/useEvent.js";var e=function(){var e=Array.isArray(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:[arguments.length<=0?void 0:arguments[0]],t=(arguments.length<=1?void 0:arguments[1])instanceof Function?null:arguments.length<=1?void 0:arguments[1],i=t?arguments.length<=2?void 0:arguments[2]:arguments.length<=1?void 0:arguments[1];n(null!=t?t:window,"keydown",(function(n){e.includes(n.key)&&i(n)}),t?arguments.length<=3?void 0:arguments[3]:arguments.length<=2?void 0:arguments[2])};export{e as useKeyPressEvent};
3
3
  //# sourceMappingURL=useKeyPressEvent.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
2
  import{useEventListener as n}from"../useEventListener/useEventListener.js";import"react";import"../useEvent/useEvent.js";var e=function(e){var o,l;n(null!==(o=null==e?void 0:e.target)&&void 0!==o?o:window,"keydown",(function(n){var o;return null==e||null===(o=e.onKeyDown)||void 0===o?void 0:o.call(e,n)})),n(null!==(l=null==e?void 0:e.target)&&void 0!==l?l:window,"keyup",(function(n){var o;return null==e||null===(o=e.onKeyUp)||void 0===o?void 0:o.call(e,n)}))};export{e as useKeyboard};
3
3
  //# sourceMappingURL=useKeyboard.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
2
- import{_ as e,a as o}from"../../_rollupPluginBabelHelpers-DzHsVrgu.js";import{useState as t}from"react";import{useDidUpdate as n}from"../useDidUpdate/useDidUpdate.js";import{useEventListener as r}from"../useEventListener/useEventListener.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";import"../useEvent/useEvent.js";var i=function(i){var u,s,l,c=null===(u=null==i?void 0:i.enabled)||void 0===u||u,d=t([]),f=e(d,2),p=f[0],a=f[1];return n((function(){a([])}),[c]),r(null!==(s=null==i?void 0:i.target)&&void 0!==s?s:window,"keydown",(function(e){c&&a((function(t){return t.some((function(o){return o.code===e.code}))?t:[].concat(o(t),[{key:e.key,code:e.code}])}))})),r(null!==(l=null==i?void 0:i.target)&&void 0!==l?l:window,"keyup",(function(e){c&&a((function(o){return o.filter((function(o){return o.code!==e.code}))}))})),p};export{i as useKeysPressed};
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
+ import{_ as e,a as o}from"../../_rollupPluginBabelHelpers-DmsB_Gfn.js";import{useState as t}from"react";import{useDidUpdate as n}from"../useDidUpdate/useDidUpdate.js";import{useEventListener as r}from"../useEventListener/useEventListener.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";import"../useEvent/useEvent.js";var i=function(i){var u,s,l,c=null===(u=null==i?void 0:i.enabled)||void 0===u||u,d=t([]),f=e(d,2),p=f[0],a=f[1];return n((function(){a([])}),[c]),r(null!==(s=null==i?void 0:i.target)&&void 0!==s?s:window,"keydown",(function(e){c&&a((function(t){return t.some((function(o){return o.code===e.code}))?t:[].concat(o(t),[{key:e.key,code:e.code}])}))})),r(null!==(l=null==i?void 0:i.target)&&void 0!==l?l:window,"keyup",(function(e){c&&a((function(o){return o.filter((function(o){return o.code!==e.code}))}))})),p};export{i as useKeysPressed};
3
3
  //# sourceMappingURL=useKeysPressed.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useKeysPressed.js","sources":["../../../../src/hooks/useKeysPressed/useKeysPressed.ts"],"sourcesContent":["import { useState } from 'react';\n\nimport { useDidUpdate } from '../useDidUpdate/useDidUpdate';\nimport type { UseEventListenerTarget } from '../useEventListener/useEventListener';\nimport { useEventListener } from '../useEventListener/useEventListener';\n\n/** The use keys pressed params */\ninterface UseKeysPressedParams {\n /** The target to attach the event listeners to */\n target?: UseEventListenerTarget;\n /** Enable or disable the event listeners */\n enabled?: boolean;\n}\n\n/**\n * @name useKeysPressed\n * @description - Hook for get keys that were pressed\n * @category Sensors\n *\n * @param {UseEventListenerTarget} [params.target=window] The target to attach the event listeners to\n * @param {boolean} [params.enabled=bollean] Enable or disable the event listeners\n * @returns {useKeysPressedReturns} Array of strings with keys that were press\n *\n * @example\n * const pressedKeys = useKeysPressed();\n */\nexport const useKeysPressed = (params?: UseKeysPressedParams) => {\n const enabled = params?.enabled ?? true;\n const [keys, setKeys] = useState<{ key: string; code: string }[]>([]);\n\n const onKeyDown = (event: KeyboardEvent) => {\n if (!enabled) return;\n setKeys((prevKeys) => {\n if (prevKeys.some(({ code }) => code === event.code)) return prevKeys;\n return [...prevKeys, { key: event.key, code: event.code }];\n });\n };\n\n const onKeyUp = (event: KeyboardEvent) => {\n if (!enabled) return;\n setKeys((prevKeys) => prevKeys.filter(({ code }) => code !== event.code));\n };\n\n useDidUpdate(() => {\n setKeys([]);\n }, [enabled]);\n\n useEventListener(params?.target ?? window, 'keydown', onKeyDown);\n useEventListener(params?.target ?? window, 'keyup', onKeyUp);\n\n return keys;\n};\n"],"names":["useKeysPressed","params","_params$enabled","_params$target","_params$target2","enabled","_useState","useState","_useState2","_slicedToArray","keys","setKeys","useDidUpdate","useEventListener","target","window","event","prevKeys","some","_ref","code","concat","_toConsumableArray","key","filter","_ref2"],"mappings":";gYA0BaA,EAAiB,SAACC,GAAkC,IAAAC,EAAAC,EAAAC,EACzDC,EAAyBH,QAAlBA,EAAGD,aAAM,EAANA,EAAQI,eAAOH,IAAAA,GAAAA,EAC/BI,EAAwBC,EAA0C,IAAGC,EAAAC,EAAAH,EAAA,GAA9DI,EAAIF,EAAA,GAAEG,EAAOH,EAAA,GAsBpB,OAPAI,GAAa,WACXD,EAAQ,GACV,GAAG,CAACN,IAEJQ,UAAgBV,EAACF,aAAM,EAANA,EAAQa,cAAM,IAAAX,EAAAA,EAAIY,OAAQ,WAjBzB,SAACC,GACZX,GACLM,GAAQ,SAACM,GACP,OAAIA,EAASC,MAAK,SAAAC,GAAO,OAAAA,EAAJC,OAAoBJ,EAAMI,QAAcH,EAC7D,GAAAI,OAAAC,EAAWL,GAAU,CAAA,CAAEM,IAAKP,EAAMO,IAAKH,KAAMJ,EAAMI,OACrD,OAaFP,UAAgBT,EAACH,aAAM,EAANA,EAAQa,cAAM,IAAAV,EAAAA,EAAIW,OAAQ,SAV3B,SAACC,GACVX,GACLM,GAAQ,SAACM,GAAQ,OAAKA,EAASO,QAAO,SAAAC,GAAO,OAAAA,EAAJL,OAAoBJ,EAAMI,cAU9DV,CACT"}
1
+ {"version":3,"file":"useKeysPressed.js","sources":["../../../../src/hooks/useKeysPressed/useKeysPressed.ts"],"sourcesContent":["import { useState } from 'react';\n\nimport { useDidUpdate } from '../useDidUpdate/useDidUpdate';\nimport type { UseEventListenerTarget } from '../useEventListener/useEventListener';\nimport { useEventListener } from '../useEventListener/useEventListener';\n\n/** The use keys pressed params type */\ninterface UseKeysPressedParams {\n /** The target to attach the event listeners to */\n target?: UseEventListenerTarget;\n /** Enable or disable the event listeners */\n enabled?: boolean;\n}\n\n/**\n * @name useKeysPressed\n * @description - Hook for get keys that were pressed\n * @category Sensors\n *\n * @param {UseEventListenerTarget} [params.target=window] The target to attach the event listeners to\n * @param {boolean} [params.enabled=bollean] Enable or disable the event listeners\n * @returns {useKeysPressedReturns} Array of strings with keys that were press\n *\n * @example\n * const pressedKeys = useKeysPressed();\n */\nexport const useKeysPressed = (params?: UseKeysPressedParams) => {\n const enabled = params?.enabled ?? true;\n const [keys, setKeys] = useState<{ key: string; code: string }[]>([]);\n\n const onKeyDown = (event: KeyboardEvent) => {\n if (!enabled) return;\n setKeys((prevKeys) => {\n if (prevKeys.some(({ code }) => code === event.code)) return prevKeys;\n return [...prevKeys, { key: event.key, code: event.code }];\n });\n };\n\n const onKeyUp = (event: KeyboardEvent) => {\n if (!enabled) return;\n setKeys((prevKeys) => prevKeys.filter(({ code }) => code !== event.code));\n };\n\n useDidUpdate(() => {\n setKeys([]);\n }, [enabled]);\n\n useEventListener(params?.target ?? window, 'keydown', onKeyDown);\n useEventListener(params?.target ?? window, 'keyup', onKeyUp);\n\n return keys;\n};\n"],"names":["useKeysPressed","params","_params$enabled","_params$target","_params$target2","enabled","_useState","useState","_useState2","_slicedToArray","keys","setKeys","useDidUpdate","useEventListener","target","window","event","prevKeys","some","_ref","code","concat","_toConsumableArray","key","filter","_ref2"],"mappings":";gYA0BaA,EAAiB,SAACC,GAAkC,IAAAC,EAAAC,EAAAC,EACzDC,EAAyBH,QAAlBA,EAAGD,aAAM,EAANA,EAAQI,eAAOH,IAAAA,GAAAA,EAC/BI,EAAwBC,EAA0C,IAAGC,EAAAC,EAAAH,EAAA,GAA9DI,EAAIF,EAAA,GAAEG,EAAOH,EAAA,GAsBpB,OAPAI,GAAa,WACXD,EAAQ,GACV,GAAG,CAACN,IAEJQ,UAAgBV,EAACF,aAAM,EAANA,EAAQa,cAAM,IAAAX,EAAAA,EAAIY,OAAQ,WAjBzB,SAACC,GACZX,GACLM,GAAQ,SAACM,GACP,OAAIA,EAASC,MAAK,SAAAC,GAAO,OAAAA,EAAJC,OAAoBJ,EAAMI,QAAcH,EAC7D,GAAAI,OAAAC,EAAWL,GAAU,CAAA,CAAEM,IAAKP,EAAMO,IAAKH,KAAMJ,EAAMI,OACrD,OAaFP,UAAgBT,EAACH,aAAM,EAANA,EAAQa,cAAM,IAAAV,EAAAA,EAAIW,OAAQ,SAV3B,SAACC,GACVX,GACLM,GAAQ,SAACM,GAAQ,OAAKA,EAASO,QAAO,SAAAC,GAAO,OAAAA,EAAJL,OAAoBJ,EAAMI,cAU9DV,CACT"}
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
2
- import{_ as n,a as t}from"../../_rollupPluginBabelHelpers-DzHsVrgu.js";import{useState as r}from"react";var e=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],u=r(e),c=n(u,2),o=c[0],i=c[1];return{value:o,set:i,push:function(n){return i((function(r){return[].concat(t(r),[n])}))},removeAt:function(n){return i((function(r){return[].concat(t(r.slice(0,n)),t(r.slice(n+1)))}))},insertAt:function(n,r){return i((function(e){return[].concat(t(e.slice(0,n)),[r],t(e.slice(n)))}))},updateAt:function(n,t){return i((function(r){return r.map((function(r,e){return e===n?t:r}))}))},clear:function(){return i([])},reset:function(){return i(e)}}};export{e as useList};
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
+ import{_ as n,a as t}from"../../_rollupPluginBabelHelpers-DmsB_Gfn.js";import{useState as r}from"react";var e=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],u=r(e),c=n(u,2),o=c[0],i=c[1];return{value:o,set:i,push:function(n){return i((function(r){return[].concat(t(r),[n])}))},removeAt:function(n){return i((function(r){return[].concat(t(r.slice(0,n)),t(r.slice(n+1)))}))},insertAt:function(n,r){return i((function(e){return[].concat(t(e.slice(0,n)),[r],t(e.slice(n)))}))},updateAt:function(n,t){return i((function(r){return r.map((function(r,e){return e===n?t:r}))}))},clear:function(){return i([])},reset:function(){return i(e)}}};export{e as useList};
3
3
  //# sourceMappingURL=useList.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
2
- import{b as o}from"../../_rollupPluginBabelHelpers-DzHsVrgu.js";import{useStorage as r}from"../useStorage/useStorage.js";import"react";import"../../utils/helpers/isClient.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";var e=function(e,t,i){return r(e,o({initialValue:t,storage:window.localStorage},i))};export{e as useLocalStorage};
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
+ import{b as o}from"../../_rollupPluginBabelHelpers-DmsB_Gfn.js";import{useStorage as r}from"../useStorage/useStorage.js";import"react";import"../../utils/helpers/isClient.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";var e=function(e,t,i){return r(e,o({initialValue:t,storage:window.localStorage},i))};export{e as useLocalStorage};
3
3
  //# sourceMappingURL=useLocalStorage.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
2
- import{a as o}from"../../_rollupPluginBabelHelpers-DzHsVrgu.js";import{useEffect as t}from"react";import{useDidUpdate as e}from"../useDidUpdate/useDidUpdate.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";var n=function(n,c){t((function(){var t;return(t=console).log.apply(t,["".concat(n," mounted")].concat(o(c))),function(){return console.log("".concat(n," unmounted"))}}),[]),e((function(){var t;(t=console).log.apply(t,["".concat(n," updated")].concat(o(c)))}),c)};export{n as useLogger};
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
+ import{a as o}from"../../_rollupPluginBabelHelpers-DmsB_Gfn.js";import{useEffect as t}from"react";import{useDidUpdate as e}from"../useDidUpdate/useDidUpdate.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";var n=function(n,c){t((function(){var t;return(t=console).log.apply(t,["".concat(n," mounted")].concat(o(c))),function(){return console.log("".concat(n," unmounted"))}}),[]),e((function(){var t;(t=console).log.apply(t,["".concat(n," updated")].concat(o(c)))}),c)};export{n as useLogger};
3
3
  //# sourceMappingURL=useLogger.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
2
- import{_ as n}from"../../_rollupPluginBabelHelpers-DzHsVrgu.js";import{useState as l,useRef as e}from"react";import{useEventListener as t}from"../useEventListener/useEventListener.js";import"../useEvent/useEvent.js";var o=function(){var o=(arguments.length<=0?void 0:arguments[0])instanceof Function||!("current"in(arguments.length<=0?void 0:arguments[0]))||arguments.length<=0?void 0:arguments[0],r=o?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],u=o?arguments.length<=2?void 0:arguments[2]:arguments.length<=1?void 0:arguments[1],i=l(!1),c=n(i,2),v=c[0],s=c[1],a=e(),d=e(),h=e(!1),m=function(n){var l,e;null==u||null===(l=u.onStart)||void 0===l||l.call(u,n),h.current=!0,d.current=setTimeout((function(){r(n),s(!0)}),null!==(e=null==u?void 0:u.threshold)&&void 0!==e?e:400)},f=function(n){var l;if(v)null==u||null===(l=u.onFinish)||void 0===l||l.call(u,n);else if(h.current){var e;null==u||null===(e=u.onCancel)||void 0===e||e.call(u,n)}s(!1),h.current=!1,d.current&&clearTimeout(d.current)};return t(null!=o?o:a,"mousedown",m),t(null!=o?o:a,"touchstart",m),t(null!=o?o:a,"mouseup",f),t(null!=o?o:a,"touchend",f),o?v:[a,v]};export{o as useLongPress};
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
+ import{_ as n}from"../../_rollupPluginBabelHelpers-DmsB_Gfn.js";import{useState as l,useRef as e}from"react";import{useEventListener as t}from"../useEventListener/useEventListener.js";import"../useEvent/useEvent.js";var o=function(){var o=(arguments.length<=0?void 0:arguments[0])instanceof Function||!("current"in(arguments.length<=0?void 0:arguments[0]))||arguments.length<=0?void 0:arguments[0],r=o?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],u=o?arguments.length<=2?void 0:arguments[2]:arguments.length<=1?void 0:arguments[1],i=l(!1),c=n(i,2),v=c[0],s=c[1],a=e(),d=e(),h=e(!1),m=function(n){var l,e;null==u||null===(l=u.onStart)||void 0===l||l.call(u,n),h.current=!0,d.current=setTimeout((function(){r(n),s(!0)}),null!==(e=null==u?void 0:u.threshold)&&void 0!==e?e:400)},f=function(n){var l;if(v)null==u||null===(l=u.onFinish)||void 0===l||l.call(u,n);else if(h.current){var e;null==u||null===(e=u.onCancel)||void 0===e||e.call(u,n)}s(!1),h.current=!1,d.current&&clearTimeout(d.current)};return t(null!=o?o:a,"mousedown",m),t(null!=o?o:a,"touchstart",m),t(null!=o?o:a,"mouseup",f),t(null!=o?o:a,"touchend",f),o?v:[a,v]};export{o as useLongPress};
3
3
  //# sourceMappingURL=useLongPress.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
2
- import{_ as e}from"../../_rollupPluginBabelHelpers-DzHsVrgu.js";import{useState as r}from"react";var n=function(n){var t=r(new Map(n)),u=e(t,2),a=u[0],o=u[1];return{value:a,size:a.size,set:function(e,r){return o((function(n){return new Map(n).set(e,r)}))},has:function(e){return a.has(e)},remove:function(e){return o((function(r){if(!r.has(e))return r;var n=new Map(r);return n.delete(e),n}))},clear:function(){return o(new Map)},reset:function(){return o(new Map(n))}}};export{n as useMap};
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
+ import{_ as e}from"../../_rollupPluginBabelHelpers-DmsB_Gfn.js";import{useState as r}from"react";var n=function(n){var t=r(new Map(n)),u=e(t,2),a=u[0],o=u[1];return{value:a,size:a.size,set:function(e,r){return o((function(n){return new Map(n).set(e,r)}))},has:function(e){return a.has(e)},remove:function(e){return o((function(r){if(!r.has(e))return r;var n=new Map(r);return n.delete(e),n}))},clear:function(){return o(new Map)},reset:function(){return o(new Map(n))}}};export{n as useMap};
3
3
  //# sourceMappingURL=useMap.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
2
- import{_ as e,b as t}from"../../_rollupPluginBabelHelpers-DzHsVrgu.js";import{useRef as r,useState as o}from"react";import{useResizeObserver as i}from"../useResizeObserver/useResizeObserver.js";import"../useRerender/useRerender.js";var s=function(s){var h=r(),n=o({x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0}),f=e(n,2),l=f[0],m=f[1];return i(null!=s?s:h,{onChange:function(t){var r=e(t,1)[0];if(r){var o=r.contentRect,i=o.x,s=o.y,h=o.width,n=o.height,f=o.top,l=o.left,p=o.bottom,u=o.right;m({x:i,y:s,width:h,height:n,top:f,left:l,bottom:p,right:u})}}}),s?l:t({ref:h},l)};export{s as useMeasure};
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
+ import{_ as e,b as t}from"../../_rollupPluginBabelHelpers-DmsB_Gfn.js";import{useRef as r,useState as o}from"react";import{useResizeObserver as i}from"../useResizeObserver/useResizeObserver.js";import"../useRerender/useRerender.js";var s=function(s){var h=r(),n=o({x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0}),f=e(n,2),l=f[0],m=f[1];return i(null!=s?s:h,{onChange:function(t){var r=e(t,1)[0];if(r){var o=r.contentRect,i=o.x,s=o.y,h=o.width,n=o.height,f=o.top,l=o.left,p=o.bottom,u=o.right;m({x:i,y:s,width:h,height:n,top:f,left:l,bottom:p,right:u})}}}),s?l:t({ref:h},l)};export{s as useMeasure};
3
3
  //# sourceMappingURL=useMeasure.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
2
  import{useCallback as n,useSyncExternalStore as e}from"react";var t=function(){return!1},r=function(r){var a=n((function(n){var e=window.matchMedia(r);return e.addEventListener("change",n),function(){e.removeEventListener("change",n)}}),[r]);return e(a,(function(){return window.matchMedia(r).matches}),t)};export{r as useMediaQuery};
3
3
  //# sourceMappingURL=useMediaQuery.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
2
- import{_ as e}from"../../_rollupPluginBabelHelpers-DzHsVrgu.js";import{useState as r}from"react";import{useInterval as o}from"../useInterval/useInterval.js";import"../useEvent/useEvent.js";var t=function(){var t=performance&&"memory"in performance,a=r({jsHeapSizeLimit:0,totalJSHeapSize:0,usedJSHeapSize:0}),n=e(a,2),m=n[0],p=n[1];return o((function(){return p(performance.memory)}),1e3,{enabled:t}),{supported:t,value:m}};export{t as useMemory};
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
+ import{_ as e}from"../../_rollupPluginBabelHelpers-DmsB_Gfn.js";import{useState as r}from"react";import{useInterval as o}from"../useInterval/useInterval.js";import"../useEvent/useEvent.js";var t=function(){var t=performance&&"memory"in performance,a=r({jsHeapSizeLimit:0,totalJSHeapSize:0,usedJSHeapSize:0}),n=e(a,2),m=n[0],p=n[1];return o((function(){return p(performance.memory)}),1e3,{enabled:t}),{supported:t,value:m}};export{t as useMemory};
3
3
  //# sourceMappingURL=useMemory.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
2
  import{useEffect as r}from"react";var t=function(t){return r(t,[])};export{t as useMount};
3
3
  //# sourceMappingURL=useMount.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
2
- import{_ as e,b as n}from"../../_rollupPluginBabelHelpers-DzHsVrgu.js";import{useState as t,useRef as r,useEffect as o}from"react";import{useRerender as i}from"../useRerender/useRerender.js";var u=function(){for(var u=i(),m=arguments.length,c=new Array(m),l=0;l<m;l++)c[l]=arguments[l];var a=c[0],f=t({x:0,y:0,elementX:0,elementY:0,elementPositionX:0,elementPositionY:0}),s=e(f,2),p=s[0],v=s[1],d=r();return o((function(){if(a||d.current){var e=function(e){var t=a?function(e){return"function"==typeof e?e():e instanceof Element?e:e.current}(a):d.current;if(t){var r={x:e.pageX,y:e.pageY},o=t.getBoundingClientRect(),i=o.left,u=o.top,m=i+window.scrollX,c=u+window.scrollY,l=e.pageX-m,f=e.pageY-c;r.elementX=l,r.elementY=f,r.elementPositionX=m,r.elementPositionY=c,v((function(e){return n(n({},e),r)}))}};return document.addEventListener("mousemove",e),function(){document.removeEventListener("mousemove",e)}}}),[d.current,a]),a?p:n({ref:function(e){d.current||(d.current=e,u.update())}},p)};export{u as useMouse};
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
+ import{_ as e,b as n}from"../../_rollupPluginBabelHelpers-DmsB_Gfn.js";import{useState as t,useRef as r,useEffect as o}from"react";import{useRerender as i}from"../useRerender/useRerender.js";var u=function(){for(var u=i(),m=arguments.length,c=new Array(m),l=0;l<m;l++)c[l]=arguments[l];var a=c[0],f=t({x:0,y:0,elementX:0,elementY:0,elementPositionX:0,elementPositionY:0}),s=e(f,2),p=s[0],v=s[1],d=r();return o((function(){if(a||d.current){var e=function(e){var t=a?function(e){return"function"==typeof e?e():e instanceof Element?e:e.current}(a):d.current;if(t){var r={x:e.pageX,y:e.pageY},o=t.getBoundingClientRect(),i=o.left,u=o.top,m=i+window.scrollX,c=u+window.scrollY,l=e.pageX-m,f=e.pageY-c;r.elementX=l,r.elementY=f,r.elementPositionX=m,r.elementPositionY=c,v((function(e){return n(n({},e),r)}))}};return document.addEventListener("mousemove",e),function(){document.removeEventListener("mousemove",e)}}}),[d.current,a]),a?p:n({ref:function(e){d.current||(d.current=e,u.update())}},p)};export{u as useMouse};
3
3
  //# sourceMappingURL=useMouse.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
2
- import{_ as r,b as l,d as n,e as o}from"../../_rollupPluginBabelHelpers-DzHsVrgu.js";import{useState as u}from"react";var e=function(e,t){var i=u(!1),v=r(i,2),a=v[0],d=v[1],c=u(!1),s=r(c,2),y=s[0],f=s[1],p=u(!1),m=r(p,2),D=m[0],E=m[1],S=u(null),b=r(S,2),h=b[0],g=b[1],w=u(null),x=r(w,2),_=x[0],j=x[1],k=function r(n,o){var u;d(!0);var t=null!==(u=null==o?void 0:o.attempt)&&void 0!==u?u:0;return e(n).then((function(r){var l;return null==o||null===(l=o.onSuccess)||void 0===l||l.call(o,r),j(r),E(!0),d(!1),g(null),f(!1),r})).catch((function(u){var e,i="function"==typeof(null==o?void 0:o.retry)?null==o?void 0:o.retry(t,u):null==o?void 0:o.retry,v="function"==typeof(null==o?void 0:o.retryDelay)?null==o?void 0:o.retryDelay(t,u):null==o?void 0:o.retryDelay;return"boolean"==typeof i&&i||i&&i>t?v?void setTimeout((function(){return r(n,l(l({},o),{},{attempt:t+1}))}),v):r(n,l(l({},o),{},{attempt:t+1})):(null==o||null===(e=o.onError)||void 0===e||e.call(o,u),j(null),E(!1),d(!1),g(u),void f(!0))}))},A=function(){var r=n(o().mark((function r(l,n){var u,e,i,v,a;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return a={retry:null!==(u=null==n?void 0:n.retry)&&void 0!==u?u:null==t?void 0:t.retry,retryDelay:null!==(e=null==n?void 0:n.retryDelay)&&void 0!==e?e:null==t?void 0:t.retryDelay,onSuccess:null!==(i=null==n?void 0:n.onSuccess)&&void 0!==i?i:null==t?void 0:t.onSuccess,onError:null!==(v=null==n?void 0:n.onError)&&void 0!==v?v:null==t?void 0:t.onError},r.abrupt("return",k(l,a));case 2:case"end":return r.stop()}}),r)})));return function(l,n){return r.apply(this,arguments)}}();return{data:_,error:h,mutate:function(r,l){var n,o,u,e,i={retry:null!==(n=null==l?void 0:l.retry)&&void 0!==n?n:null==t?void 0:t.retry,retryDelay:null!==(o=null==l?void 0:l.retryDelay)&&void 0!==o?o:null==t?void 0:t.retryDelay,onSuccess:null!==(u=null==l?void 0:l.onSuccess)&&void 0!==u?u:null==t?void 0:t.onSuccess,onError:null!==(e=null==l?void 0:l.onError)&&void 0!==e?e:null==t?void 0:t.onError};k(r,i)},mutateAsync:A,isLoading:a,isError:y,isSuccess:D}};export{e as useMutation};
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
+ import{_ as r,b as l,d as n,e as o}from"../../_rollupPluginBabelHelpers-DmsB_Gfn.js";import{useState as u}from"react";var e=function(e,t){var i=u(!1),v=r(i,2),a=v[0],d=v[1],c=u(!1),s=r(c,2),y=s[0],f=s[1],p=u(!1),m=r(p,2),D=m[0],E=m[1],S=u(null),b=r(S,2),h=b[0],g=b[1],w=u(null),x=r(w,2),_=x[0],j=x[1],k=function r(n,o){var u;d(!0);var t=null!==(u=null==o?void 0:o.attempt)&&void 0!==u?u:0;return e(n).then((function(r){var l;return null==o||null===(l=o.onSuccess)||void 0===l||l.call(o,r),j(r),E(!0),d(!1),g(null),f(!1),r})).catch((function(u){var e,i="function"==typeof(null==o?void 0:o.retry)?null==o?void 0:o.retry(t,u):null==o?void 0:o.retry,v="function"==typeof(null==o?void 0:o.retryDelay)?null==o?void 0:o.retryDelay(t,u):null==o?void 0:o.retryDelay;return"boolean"==typeof i&&i||i&&i>t?v?void setTimeout((function(){return r(n,l(l({},o),{},{attempt:t+1}))}),v):r(n,l(l({},o),{},{attempt:t+1})):(null==o||null===(e=o.onError)||void 0===e||e.call(o,u),j(null),E(!1),d(!1),g(u),void f(!0))}))},A=function(){var r=n(o().mark((function r(l,n){var u,e,i,v,a;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return a={retry:null!==(u=null==n?void 0:n.retry)&&void 0!==u?u:null==t?void 0:t.retry,retryDelay:null!==(e=null==n?void 0:n.retryDelay)&&void 0!==e?e:null==t?void 0:t.retryDelay,onSuccess:null!==(i=null==n?void 0:n.onSuccess)&&void 0!==i?i:null==t?void 0:t.onSuccess,onError:null!==(v=null==n?void 0:n.onError)&&void 0!==v?v:null==t?void 0:t.onError},r.abrupt("return",k(l,a));case 2:case"end":return r.stop()}}),r)})));return function(l,n){return r.apply(this,arguments)}}();return{data:_,error:h,mutate:function(r,l){var n,o,u,e,i={retry:null!==(n=null==l?void 0:l.retry)&&void 0!==n?n:null==t?void 0:t.retry,retryDelay:null!==(o=null==l?void 0:l.retryDelay)&&void 0!==o?o:null==t?void 0:t.retryDelay,onSuccess:null!==(u=null==l?void 0:l.onSuccess)&&void 0!==u?u:null==t?void 0:t.onSuccess,onError:null!==(e=null==l?void 0:l.onError)&&void 0!==e?e:null==t?void 0:t.onError};k(r,i)},mutateAsync:A,isLoading:a,isError:y,isSuccess:D}};export{e as useMutation};
3
3
  //# sourceMappingURL=useMutation.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
2
  import{useRef as r,useEffect as n}from"react";function t(t,e,u){var c=r(),o=r(null);return n((function(){var r="function"==typeof u?u():u;return(r||o.current)&&(c.current=new MutationObserver(t),c.current.observe(r||o.current,e)),function(){var r;null===(r=c.current)||void 0===r||r.disconnect()}}),[t,e]),o}export{t as useMutationObserver};
3
3
  //# sourceMappingURL=useMutationObserver.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
2
- import{_ as n}from"../../_rollupPluginBabelHelpers-DzHsVrgu.js";import{useState as e,useEffect as i}from"react";import{isClient as o}from"../../utils/helpers/isClient.js";var t=function(){var n,e,i;return(null===(n=navigator)||void 0===n?void 0:n.connection)||(null===(e=navigator)||void 0===e?void 0:e.mozConnection)||(null===(i=navigator)||void 0===i?void 0:i.webkitConnection)},l=function(){var l=e((function(){if(!o)return{online:!1,type:void 0,effectiveType:void 0,saveData:!1,downlink:0,downlinkMax:0,rtt:0};var n=navigator.onLine,e=t();return{online:n,downlink:null==e?void 0:e.downlink,downlinkMax:null==e?void 0:e.downlinkMax,effectiveType:null==e?void 0:e.effectiveType,rtt:null==e?void 0:e.rtt,saveData:null==e?void 0:e.saveData,type:null==e?void 0:e.type}})),v=n(l,2),a=v[0],r=v[1];return i((function(){var n=function(){var n=navigator.onLine,e=t();r({online:n,downlink:null==e?void 0:e.downlink,downlinkMax:null==e?void 0:e.downlinkMax,effectiveType:null==e?void 0:e.effectiveType,rtt:null==e?void 0:e.rtt,saveData:null==e?void 0:e.saveData,type:null==e?void 0:e.type})};window.addEventListener("online",n,{passive:!0}),window.addEventListener("offline",n,{passive:!0});var e=t();return e&&e.addEventListener("change",n,{passive:!0}),function(){window.removeEventListener("online",n),window.removeEventListener("offline",n),e&&e.removeEventListener("change",n)}})),a};export{t as getConnection,l as useNetwork};
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
+ import{_ as n}from"../../_rollupPluginBabelHelpers-DmsB_Gfn.js";import{useState as e,useEffect as i}from"react";import{isClient as o}from"../../utils/helpers/isClient.js";var t=function(){var n,e,i;return(null===(n=navigator)||void 0===n?void 0:n.connection)||(null===(e=navigator)||void 0===e?void 0:e.mozConnection)||(null===(i=navigator)||void 0===i?void 0:i.webkitConnection)},l=function(){var l=e((function(){if(!o)return{online:!1,type:void 0,effectiveType:void 0,saveData:!1,downlink:0,downlinkMax:0,rtt:0};var n=navigator.onLine,e=t();return{online:n,downlink:null==e?void 0:e.downlink,downlinkMax:null==e?void 0:e.downlinkMax,effectiveType:null==e?void 0:e.effectiveType,rtt:null==e?void 0:e.rtt,saveData:null==e?void 0:e.saveData,type:null==e?void 0:e.type}})),v=n(l,2),a=v[0],r=v[1];return i((function(){var n=function(){var n=navigator.onLine,e=t();r({online:n,downlink:null==e?void 0:e.downlink,downlinkMax:null==e?void 0:e.downlinkMax,effectiveType:null==e?void 0:e.effectiveType,rtt:null==e?void 0:e.rtt,saveData:null==e?void 0:e.saveData,type:null==e?void 0:e.type})};window.addEventListener("online",n,{passive:!0}),window.addEventListener("offline",n,{passive:!0});var e=t();return e&&e.addEventListener("change",n,{passive:!0}),function(){window.removeEventListener("online",n),window.removeEventListener("offline",n),e&&e.removeEventListener("change",n)}})),a};export{t as getConnection,l as useNetwork};
3
3
  //# sourceMappingURL=useNetwork.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
2
  import{useSyncExternalStore as n}from"react";var e=function(){return navigator.onLine},t=function(){return!1},i=function(n){return window.addEventListener("online",n),window.addEventListener("offline",n),function(){window.removeEventListener("online",n),window.removeEventListener("offline",n)}},o=function(){return n(i,e,t)};export{o as useOnline};
3
3
  //# sourceMappingURL=useOnline.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
2
  import{useRef as n}from"react";var i=function(){if("undefined"==typeof window)return"undetermined";var n=window.navigator.userAgent;return/(Macintosh)|(MacIntel)|(MacPPC)|(Mac68K)/i.test(n)?"macos":/(iPhone)|(iPad)|(iPod)/i.test(n)?"ios":/(Win32)|(Win64)|(Windows)|(WinCE)/i.test(n)?"windows":/Android/i.test(n)?"android":/Linux/i.test(n)?"linux":"undetermined"},t=function(){return n(i()).current};export{i as getOperatingSystem,t as useOperatingSystem};
3
3
  //# sourceMappingURL=useOperatingSystem.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
2
- import{_ as e}from"../../_rollupPluginBabelHelpers-DzHsVrgu.js";import{useState as n}from"react";import{useIsomorphicLayoutEffect as r}from"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";var o=function(){var o=n({angle:0,type:"landscape-primary"}),t=e(o,2),i=t[0],a=t[1];return r((function(){var e,n=function(){var e=window.screen.orientation,n=e.angle,r=e.type;a({angle:n,type:r})};return null===(e=window.screen.orientation)||void 0===e||e.addEventListener("change",n),function(){var e;return null===(e=window.screen.orientation)||void 0===e?void 0:e.removeEventListener("change",n)}}),[]),i};export{o as useOrientation};
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
+ import{_ as e}from"../../_rollupPluginBabelHelpers-DmsB_Gfn.js";import{useState as n}from"react";import{useIsomorphicLayoutEffect as r}from"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";var o=function(){var o=n({angle:0,type:"landscape-primary"}),t=e(o,2),i=t[0],a=t[1];return r((function(){var e,n=function(){var e=window.screen.orientation,n=e.angle,r=e.type;a({angle:n,type:r})};return null===(e=window.screen.orientation)||void 0===e||e.addEventListener("change",n),function(){var e;return null===(e=window.screen.orientation)||void 0===e?void 0:e.removeEventListener("change",n)}}),[]),i};export{o as useOrientation};
3
3
  //# sourceMappingURL=useOrientation.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
2
- import{_ as e}from"../../_rollupPluginBabelHelpers-DzHsVrgu.js";import{useState as n,useEffect as t}from"react";import{useEvent as r}from"../useEvent/useEvent.js";var o=function(o){var u=n(!1),s=e(u,2),m=s[0],i=s[1],v=r((function(){if(m)return i(!1);null==o||o(),i(!0)}));return t((function(){return document.addEventListener("mouseleave",v,{passive:!0}),document.addEventListener("mouseenter",v,{passive:!0}),function(){document.removeEventListener("mouseenter",v),document.removeEventListener("mouseleave",v)}}),[]),m};export{o as usePageLeave};
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
+ import{_ as e}from"../../_rollupPluginBabelHelpers-DmsB_Gfn.js";import{useState as n,useEffect as t}from"react";import{useEvent as r}from"../useEvent/useEvent.js";var o=function(o){var u=n(!1),s=e(u,2),m=s[0],i=s[1],v=r((function(){if(m)return i(!1);null==o||o(),i(!0)}));return t((function(){return document.addEventListener("mouseleave",v,{passive:!0}),document.addEventListener("mouseenter",v,{passive:!0}),function(){document.removeEventListener("mouseenter",v),document.removeEventListener("mouseleave",v)}}),[]),m};export{o as usePageLeave};
3
3
  //# sourceMappingURL=usePageLeave.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
2
- import{g as t,h as s,i}from"../../../_rollupPluginBabelHelpers-DzHsVrgu.js";import{Pointer as r}from"./Pointer.js";var h=function(){return t((function t(h){var e=h.x,o=h.y,n=h.radius,u=h.smooth;s(this,t),i(this,"smooth",!1),i(this,"points",[]),i(this,"lines",[]),this.smooth=u,this.pointer=new r(e,o),this.brush=new r(e,o),this.radius=n,this.points=[],this.lines=[]}),[{key:"getBrushCoordinates",value:function(){return{x:this.brush.x,y:this.brush.y}}},{key:"getPointerCoordinates",value:function(){return{x:this.pointer.x,y:this.pointer.y}}},{key:"update",value:function(t){if(this.pointer.equalsTo(t))return!1;if(this.pointer.update(t),!this.smooth)return this.brush.update(t),this.points.push(this.getBrushCoordinates()),!0;var s=this.pointer.getDistanceTo(this.brush),i=this.pointer.getAngleTo(this.brush);if(Math.round(10*(s-this.radius))/10>0){var r=i+Math.PI/2;return this.brush.update({x:this.brush.x+Math.sin(r)*(s-this.radius),y:this.brush.y-Math.cos(r)*(s-this.radius)}),this.points.push(this.getBrushCoordinates()),!0}return!1}}])}();export{h as Paint};
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
+ import{g as t,h as s,i}from"../../../_rollupPluginBabelHelpers-DmsB_Gfn.js";import{Pointer as r}from"./Pointer.js";var h=function(){return t((function t(h){var e=h.x,o=h.y,n=h.radius,u=h.smooth;s(this,t),i(this,"smooth",!1),i(this,"points",[]),i(this,"lines",[]),this.smooth=u,this.pointer=new r(e,o),this.brush=new r(e,o),this.radius=n,this.points=[],this.lines=[]}),[{key:"getBrushCoordinates",value:function(){return{x:this.brush.x,y:this.brush.y}}},{key:"getPointerCoordinates",value:function(){return{x:this.pointer.x,y:this.pointer.y}}},{key:"update",value:function(t){if(this.pointer.equalsTo(t))return!1;if(this.pointer.update(t),!this.smooth)return this.brush.update(t),this.points.push(this.getBrushCoordinates()),!0;var s=this.pointer.getDistanceTo(this.brush),i=this.pointer.getAngleTo(this.brush);if(Math.round(10*(s-this.radius))/10>0){var r=i+Math.PI/2;return this.brush.update({x:this.brush.x+Math.sin(r)*(s-this.radius),y:this.brush.y-Math.cos(r)*(s-this.radius)}),this.points.push(this.getBrushCoordinates()),!0}return!1}}])}();export{h as Paint};
3
3
  //# sourceMappingURL=Paint.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
2
- import{g as t,h as e}from"../../../_rollupPluginBabelHelpers-DzHsVrgu.js";var n=function(){function n(t,i){e(this,n),this.x=t,this.y=i}return t(n,[{key:"update",value:function(t){this.x=t.x,this.y=t.y}},{key:"getDifferenceTo",value:function(t){return new n(this.x-t.x,this.y-t.y)}},{key:"getDistanceTo",value:function(t){var e=this.getDifferenceTo(t);return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}},{key:"getAngleTo",value:function(t){var e=this.getDifferenceTo(t);return Math.atan2(e.y,e.x)}},{key:"equalsTo",value:function(t){return this.x===t.x&&this.y===t.y}},{key:"moveByAngle",value:function(t,e){var n=t+Math.PI/2;return this.x+=Math.sin(n)*e,this.y-=Math.cos(n)*e,this}}])}();export{n as Pointer};
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
+ import{g as t,h as e}from"../../../_rollupPluginBabelHelpers-DmsB_Gfn.js";var n=function(){function n(t,i){e(this,n),this.x=t,this.y=i}return t(n,[{key:"update",value:function(t){this.x=t.x,this.y=t.y}},{key:"getDifferenceTo",value:function(t){return new n(this.x-t.x,this.y-t.y)}},{key:"getDistanceTo",value:function(t){var e=this.getDifferenceTo(t);return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}},{key:"getAngleTo",value:function(t){var e=this.getDifferenceTo(t);return Math.atan2(e.y,e.x)}},{key:"equalsTo",value:function(t){return this.x===t.x&&this.y===t.y}},{key:"moveByAngle",value:function(t,e){var n=t+Math.PI/2;return this.x+=Math.sin(n)*e,this.y-=Math.cos(n)*e,this}}])}();export{n as Pointer};
3
3
  //# sourceMappingURL=Pointer.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
2
- import{c as n,_ as r}from"../../_rollupPluginBabelHelpers-DzHsVrgu.js";import{useRef as e,useState as t,useEffect as o}from"react";import{useEvent as u}from"../useEvent/useEvent.js";import{Paint as i}from"./helpers/Paint.js";import"./helpers/Pointer.js";var c=function(n){return"function"==typeof n?n():n instanceof Element?n:n.current},l=function(){var l,s,a,v,d,f="object"!==n(arguments.length<=0?void 0:arguments[0])||"current"in(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,p=f?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],h=null!==(l=null==p?void 0:p.color)&&void 0!==l?l:"black",m=null!==(s=null==p?void 0:p.opacity)&&void 0!==s?s:1,y=null!==(a=null==p?void 0:p.radius)&&void 0!==a?a:10,g=e(new i({x:0,y:0,radius:null!==(v=null==p?void 0:p.radius)&&void 0!==v?v:10,smooth:null!==(d=null==p?void 0:p.smooth)&&void 0!==d&&d})),x=t(!1),E=r(x,2),w=E[0],L=E[1],b=e(null),j=e(null),M=function(n,r,e,t){if(j.current){j.current.globalAlpha=e,j.current.strokeStyle=r,j.current.lineWidth=2*t,j.current.lineCap="round",j.current.lineJoin="round";var o=n[0],u=n[1];j.current.beginPath();for(var i=1;i<n.length;i+=1){var c={x:o.x+(u.x-o.x)/2,y:o.y+(u.y-o.y)/2};j.current.quadraticCurveTo(o.x,o.y,c.x,c.y),o=n[i],u=n[i+1]}j.current.lineTo(o.x,o.y),j.current.stroke()}},P=function(){j.current&&j.current.clearRect(0,0,j.current.canvas.width,j.current.canvas.height)},k=u((function(n){var r;if(w){null==p||null===(r=p.onMouseMove)||void 0===r||r.call(p,n,g.current);var e={x:n.offsetX,y:n.offsetY};g.current.update(e)&&j.current&&(P(),j.current.clearRect(0,0,j.current.canvas.width,j.current.canvas.height),g.current.lines.forEach((function(n){var r=n.points,e=n.color,t=n.opacity,o=n.radius;return M(r,e,t,o)})),M(g.current.points,h,m,y))}})),C=u((function(n){var r;if(j.current){var e={x:n.offsetX,y:n.offsetY};g.current.brush.update(e),g.current.points.push(e),M(g.current.points,h,m,y),null==p||null===(r=p.onMouseDown)||void 0===r||r.call(p,n,g.current),L(!0)}})),R=u((function(n){var r;j.current&&(g.current.points.length&&(g.current.lines.push({points:g.current.points,color:h,opacity:m,radius:y}),g.current.points=[]),null==p||null===(r=p.onMouseUp)||void 0===r||r.call(p,n,g.current),L(!1))})),T=function(){j.current&&(P(),g.current.lines=[],g.current.points=[])},X=function(){j.current&&(P(),g.current.lines.pop(),g.current.lines.forEach((function(n){var r=n.points,e=n.color,t=n.opacity,o=n.radius;return M(r,e,t,o)})))};return o((function(){var n=f?c(f):b.current;if(n)return j.current=n.getContext("2d"),null!=p&&p.initialLines&&(g.current.lines=p.initialLines,p.initialLines.forEach((function(n){var r=n.points,e=n.color,t=n.opacity,o=n.radius;return M(r,e,t,o)}))),n.addEventListener("mousedown",C),n.addEventListener("mousemove",k),n.addEventListener("mouseup",R),function(){n&&(n.removeEventListener("mousedown",C),n.removeEventListener("mousemove",k),n.removeEventListener("mouseup",R))}}),[]),f?{drawing:w,clear:T,undo:X,draw:M,lines:g.current.lines}:{ref:b,drawing:w,clear:T,undo:X,draw:M,lines:g.current.lines}};export{c as getElement,l as usePaint};
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
+ import{c as n,_ as r}from"../../_rollupPluginBabelHelpers-DmsB_Gfn.js";import{useRef as e,useState as t,useEffect as o}from"react";import{useEvent as u}from"../useEvent/useEvent.js";import{Paint as i}from"./helpers/Paint.js";import"./helpers/Pointer.js";var c=function(n){return"function"==typeof n?n():n instanceof Element?n:n.current},l=function(){var l,s,a,v,d,f="object"!==n(arguments.length<=0?void 0:arguments[0])||"current"in(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,p=f?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],h=null!==(l=null==p?void 0:p.color)&&void 0!==l?l:"black",m=null!==(s=null==p?void 0:p.opacity)&&void 0!==s?s:1,y=null!==(a=null==p?void 0:p.radius)&&void 0!==a?a:10,g=e(new i({x:0,y:0,radius:null!==(v=null==p?void 0:p.radius)&&void 0!==v?v:10,smooth:null!==(d=null==p?void 0:p.smooth)&&void 0!==d&&d})),x=t(!1),E=r(x,2),w=E[0],L=E[1],b=e(null),j=e(null),M=function(n,r,e,t){if(j.current){j.current.globalAlpha=e,j.current.strokeStyle=r,j.current.lineWidth=2*t,j.current.lineCap="round",j.current.lineJoin="round";var o=n[0],u=n[1];j.current.beginPath();for(var i=1;i<n.length;i+=1){var c={x:o.x+(u.x-o.x)/2,y:o.y+(u.y-o.y)/2};j.current.quadraticCurveTo(o.x,o.y,c.x,c.y),o=n[i],u=n[i+1]}j.current.lineTo(o.x,o.y),j.current.stroke()}},P=function(){j.current&&j.current.clearRect(0,0,j.current.canvas.width,j.current.canvas.height)},k=u((function(n){var r;if(w){null==p||null===(r=p.onMouseMove)||void 0===r||r.call(p,n,g.current);var e={x:n.offsetX,y:n.offsetY};g.current.update(e)&&j.current&&(P(),j.current.clearRect(0,0,j.current.canvas.width,j.current.canvas.height),g.current.lines.forEach((function(n){var r=n.points,e=n.color,t=n.opacity,o=n.radius;return M(r,e,t,o)})),M(g.current.points,h,m,y))}})),C=u((function(n){var r;if(j.current){var e={x:n.offsetX,y:n.offsetY};g.current.brush.update(e),g.current.points.push(e),M(g.current.points,h,m,y),null==p||null===(r=p.onMouseDown)||void 0===r||r.call(p,n,g.current),L(!0)}})),R=u((function(n){var r;j.current&&(g.current.points.length&&(g.current.lines.push({points:g.current.points,color:h,opacity:m,radius:y}),g.current.points=[]),null==p||null===(r=p.onMouseUp)||void 0===r||r.call(p,n,g.current),L(!1))})),T=function(){j.current&&(P(),g.current.lines=[],g.current.points=[])},X=function(){j.current&&(P(),g.current.lines.pop(),g.current.lines.forEach((function(n){var r=n.points,e=n.color,t=n.opacity,o=n.radius;return M(r,e,t,o)})))};return o((function(){var n=f?c(f):b.current;if(n)return j.current=n.getContext("2d"),null!=p&&p.initialLines&&(g.current.lines=p.initialLines,p.initialLines.forEach((function(n){var r=n.points,e=n.color,t=n.opacity,o=n.radius;return M(r,e,t,o)}))),n.addEventListener("mousedown",C),n.addEventListener("mousemove",k),n.addEventListener("mouseup",R),function(){n&&(n.removeEventListener("mousedown",C),n.removeEventListener("mousemove",k),n.removeEventListener("mouseup",R))}}),[]),f?{drawing:w,clear:T,undo:X,draw:M,lines:g.current.lines}:{ref:b,drawing:w,clear:T,undo:X,draw:M,lines:g.current.lines}};export{c as getElement,l as usePaint};
3
3
  //# sourceMappingURL=usePaint.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
2
- import{_ as r,d as e,e as t}from"../../_rollupPluginBabelHelpers-DzHsVrgu.js";import{useState as n,useEffect as a}from"react";import{useEvent as s}from"../useEvent/useEvent.js";var o=function(o){var u=n("prompt"),i=r(u,2),p=i[0],c=i[1],m=navigator&&"permissions"in navigator,v={name:o},f=s(e(t().mark((function r(){var e;return t().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,navigator.permissions.query(v);case 3:return e=r.sent,c(e.state),r.abrupt("return",e.state);case 8:return r.prev=8,r.t0=r.catch(0),c("prompt"),r.abrupt("return","prompt");case 12:case"end":return r.stop()}}),r,null,[[0,8]])}))));return a((function(){if(m)return f(),window.addEventListener("change",f),function(){window.removeEventListener("change",f)}}),[o]),{state:p,supported:m,query:f}};export{o as usePermission};
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
+ import{_ as r,d as e,e as t}from"../../_rollupPluginBabelHelpers-DmsB_Gfn.js";import{useState as n,useEffect as a}from"react";import{useEvent as s}from"../useEvent/useEvent.js";var o=function(o){var u=n("prompt"),i=r(u,2),p=i[0],c=i[1],m=navigator&&"permissions"in navigator,v={name:o},f=s(e(t().mark((function r(){var e;return t().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,navigator.permissions.query(v);case 3:return e=r.sent,c(e.state),r.abrupt("return",e.state);case 8:return r.prev=8,r.t0=r.catch(0),c("prompt"),r.abrupt("return","prompt");case 12:case"end":return r.stop()}}),r,null,[[0,8]])}))));return a((function(){if(m)return f(),window.addEventListener("change",f),function(){window.removeEventListener("change",f)}}),[o]),{state:p,supported:m,query:f}};export{o as usePermission};
3
3
  //# sourceMappingURL=usePermission.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
2
  import{useMediaQuery as e}from"../useMediaQuery/useMediaQuery.js";import"react";var r=function(){var r=e("(prefers-color-scheme: light)"),o=e("(prefers-color-scheme: dark)");return r?"light":o?"dark":"no-preference"};export{r as usePreferredColorScheme};
3
3
  //# sourceMappingURL=usePreferredColorScheme.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.56 */
1
+ /* @license @siberiacancode/reactuse v0.0.57 */
2
2
  import{useMediaQuery as r}from"../useMediaQuery/useMediaQuery.js";import"react";var e=function(){var e=r("(prefers-contrast: more)"),s=r("(prefers-contrast: less)"),t=r("(prefers-contrast: custom)");return e?"more":s?"less":t?"custom":"no-preference"};export{e as usePreferredContrast};
3
3
  //# sourceMappingURL=usePreferredContrast.js.map