From e4ce95ff4e457ca9e6b71651a1accf2aedce8925 Mon Sep 17 00:00:00 2001
From: ssi02014
Date: Tue, 14 Jan 2025 16:14:51 +0000
Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20modern-a?=
=?UTF-8?q?gile-team/modern-kit@afa85a18d0e8f7ad9559d779c56cd54fa7038c64?=
=?UTF-8?q?=20=F0=9F=9A=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
404.html | 4 ++--
assets/js/0468e7c7.54a90a5f.js | 1 -
assets/js/0468e7c7.69aa168d.js | 1 +
assets/js/069bf6ce.37c76340.js | 1 -
assets/js/069bf6ce.5a1773f5.js | 1 +
assets/js/087cca41.64dcef64.js | 1 -
assets/js/087cca41.8c16c0a3.js | 1 +
assets/js/0ed4549e.bb34a41a.js | 1 -
assets/js/0ed4549e.f00dd43e.js | 1 +
assets/js/11738f66.0f506a6b.js | 1 +
assets/js/11738f66.1ad6e8ce.js | 1 -
assets/js/1c2388cf.a9138072.js | 1 -
assets/js/1c2388cf.d917f60e.js | 1 +
assets/js/1ebcacad.43280e43.js | 1 +
assets/js/1ebcacad.ece260fc.js | 1 -
assets/js/225c6dfe.4dfdc544.js | 1 +
assets/js/225c6dfe.7b9830ad.js | 1 -
assets/js/24c74d07.b0f51709.js | 1 -
assets/js/24c74d07.f02220dd.js | 1 +
assets/js/295f1714.2f90ba2f.js | 1 -
assets/js/295f1714.8387b2be.js | 1 +
assets/js/308b5f81.80461474.js | 1 +
assets/js/308b5f81.db118fd1.js | 1 -
assets/js/36bebd15.56b57b2c.js | 1 +
assets/js/36bebd15.da7fd56a.js | 1 -
assets/js/3bdef6d7.4c300635.js | 1 -
assets/js/3bdef6d7.85d88013.js | 1 +
assets/js/3e5d9272.5b90e6a3.js | 1 +
assets/js/3e5d9272.fe03afa2.js | 1 -
assets/js/42a77533.0d5c5bad.js | 1 -
assets/js/42a77533.4dc4c694.js | 1 +
assets/js/54102c04.35ce4b40.js | 1 -
assets/js/54102c04.d0fd9f95.js | 1 +
assets/js/5d610355.79411896.js | 1 +
assets/js/5d610355.9c05908f.js | 1 -
assets/js/61a35b61.4c79d1bb.js | 1 -
assets/js/61a35b61.53efbb03.js | 1 +
assets/js/63f47a7c.23b9a51e.js | 1 +
assets/js/63f47a7c.f5e54242.js | 1 -
assets/js/67c089fb.04be0bd6.js | 1 -
assets/js/67c089fb.835c1131.js | 1 +
assets/js/67c0cc0e.49a8fe54.js | 1 +
assets/js/67c0cc0e.f6b6fd72.js | 1 -
assets/js/6dde689d.a296f296.js | 1 +
assets/js/6dde689d.fedb5911.js | 1 -
assets/js/771be322.5aeede07.js | 1 -
assets/js/771be322.c8085557.js | 1 +
assets/js/78bcb238.70a9a9dd.js | 1 +
assets/js/78bcb238.ec590572.js | 1 -
assets/js/7b61a3fa.7e7d5f1c.js | 1 +
assets/js/7b61a3fa.962828ef.js | 1 -
assets/js/{7b7be0e1.5bac0365.js => 7b7be0e1.041efcab.js} | 2 +-
assets/js/7da35ef8.5f20f679.js | 1 +
assets/js/7da35ef8.af433888.js | 1 -
assets/js/8053496e.1a9e1459.js | 2 ++
...0d0d27.js.LICENSE.txt => 8053496e.1a9e1459.js.LICENSE.txt} | 0
assets/js/8053496e.52db90d6.js | 1 -
assets/js/8079f804.405bc534.js | 1 -
assets/js/8079f804.846a7d09.js | 1 +
assets/js/83b4ba0b.337ac227.js | 1 +
assets/js/83b4ba0b.925129e0.js | 1 -
assets/js/8a16b8e9.81b7a2bd.js | 1 -
assets/js/8a16b8e9.b6ef01ce.js | 1 +
assets/js/932ca9ec.70922df5.js | 1 +
assets/js/932ca9ec.db37b8df.js | 1 -
assets/js/9358.cf0d0d27.js | 2 --
assets/js/9602.e7bd29f4.js | 1 +
assets/js/9be130a4.4d76744e.js | 1 +
assets/js/9be130a4.7890da22.js | 1 -
assets/js/a45fe377.41d28a11.js | 1 +
assets/js/a45fe377.4da78159.js | 1 -
assets/js/aa089504.030a7252.js | 1 -
assets/js/aa089504.c58fc7eb.js | 1 +
assets/js/ab7af1d3.d2f1107c.js | 1 -
assets/js/ab7af1d3.e6628944.js | 1 +
assets/js/ad8813a3.4fede0e4.js | 1 -
assets/js/ad8813a3.b73e934f.js | 1 +
assets/js/af3233c2.b6ff46a8.js | 1 -
assets/js/af3233c2.e18844a5.js | 1 +
assets/js/b35b1276.32da6ca7.js | 1 -
assets/js/b35b1276.f4904be4.js | 1 +
assets/js/b3bf5b56.15e7497a.js | 1 +
assets/js/b3bf5b56.3de72384.js | 1 -
assets/js/b506dfd1.75ad62c0.js | 1 -
assets/js/b506dfd1.a3ce067b.js | 1 +
assets/js/b743ea75.67047af2.js | 1 +
assets/js/b743ea75.ef78621a.js | 1 -
assets/js/b862475b.723acd2d.js | 1 +
assets/js/b862475b.bee34558.js | 1 -
assets/js/bf0dbc92.22073d5b.js | 1 +
assets/js/bf0dbc92.786703fe.js | 1 -
assets/js/c060fdc4.e3c170be.js | 1 -
assets/js/c060fdc4.f6ac9307.js | 1 +
assets/js/c55bf516.d54c1b72.js | 1 -
assets/js/c55bf516.dc1b8151.js | 1 +
assets/js/c55c9b0f.2c631495.js | 1 -
assets/js/c55c9b0f.b843329f.js | 1 +
assets/js/cb3f6f96.467289bb.js | 1 +
assets/js/cb3f6f96.981f1a69.js | 1 -
assets/js/cc0ca23c.3f2a29ee.js | 1 +
assets/js/cc0ca23c.6e15d121.js | 1 -
assets/js/e3446db6.0af37d96.js | 1 -
assets/js/e3446db6.60006c6a.js | 1 +
assets/js/eb0f0f4b.a2aa0ab8.js | 1 +
assets/js/eb0f0f4b.a3f4489a.js | 1 -
assets/js/{eea24eaa.a4df495e.js => eea24eaa.4dae6214.js} | 2 +-
assets/js/f5098664.1709d859.js | 1 +
assets/js/f5098664.d9107365.js | 1 -
assets/js/fbe6690a.6440acf8.js | 1 +
assets/js/fbe6690a.828a8885.js | 1 -
assets/js/main.1e9414e3.js | 2 ++
...n.ec90acce.js.LICENSE.txt => main.1e9414e3.js.LICENSE.txt} | 0
assets/js/main.ec90acce.js | 2 --
.../js/{runtime~main.cb3f84d6.js => runtime~main.a3be8a28.js} | 2 +-
docs/introduce/index.html | 4 ++--
docs/react/components/AspectRatio/index.html | 4 ++--
docs/react/components/ClientGate/index.html | 4 ++--
docs/react/components/DebounceHandler/index.html | 4 ++--
docs/react/components/FallbackLazyImage/index.html | 4 ++--
docs/react/components/IfElse/index.html | 4 ++--
docs/react/components/InView/index.html | 4 ++--
docs/react/components/InfiniteScroll/index.html | 4 ++--
docs/react/components/Iterator/index.html | 4 ++--
docs/react/components/LazyImage/index.html | 4 ++--
docs/react/components/Mounted/index.html | 4 ++--
docs/react/components/OutsidePointerDownHandler/index.html | 4 ++--
docs/react/components/Portal/index.html | 4 ++--
docs/react/components/SeparatedIterator/index.html | 4 ++--
docs/react/components/Slot/index.html | 4 ++--
docs/react/components/SwithCase/index.html | 4 ++--
docs/react/components/When/index.html | 4 ++--
docs/react/hooks/useAsyncEffect/index.html | 4 ++--
docs/react/hooks/useBeforeUnload/index.html | 4 ++--
docs/react/hooks/useBlockMultipleAsyncCalls/index.html | 4 ++--
docs/react/hooks/useClipboard/index.html | 4 ++--
docs/react/hooks/useColorScheme/index.html | 4 ++--
docs/react/hooks/useCounter/index.html | 4 ++--
docs/react/hooks/useCycleList/index.html | 4 ++--
docs/react/hooks/useDebounce/index.html | 4 ++--
docs/react/hooks/useDebouncedInputValue/index.html | 4 ++--
docs/react/hooks/useDebouncedState/index.html | 4 ++--
docs/react/hooks/useDependencyTimeout/index.html | 4 ++--
docs/react/hooks/useDocumentTitle/index.html | 4 ++--
docs/react/hooks/useEventListener/index.html | 4 ++--
docs/react/hooks/useFileReader/index.html | 4 ++--
docs/react/hooks/useFocus/index.html | 4 ++--
docs/react/hooks/useForceUpdate/index.html | 4 ++--
docs/react/hooks/useHover/index.html | 4 ++--
docs/react/hooks/useImageStatus/index.html | 4 ++--
docs/react/hooks/useIntersectionObserver/index.html | 4 ++--
docs/react/hooks/useInterval/index.html | 4 ++--
docs/react/hooks/useIsMounted/index.html | 4 ++--
docs/react/hooks/useIsomorphicLayoutEffect/index.html | 4 ++--
docs/react/hooks/useKeyDown/index.html | 4 ++--
docs/react/hooks/useLocalStorage/index.html | 4 ++--
docs/react/hooks/useMediaQuery/index.html | 4 ++--
docs/react/hooks/useMergeRefs/index.html | 4 ++--
docs/react/hooks/useMouse/index.html | 4 ++--
docs/react/hooks/useNetwork/index.html | 4 ++--
docs/react/hooks/useOutsidePointerDown/index.html | 4 ++--
docs/react/hooks/usePreferredColorScheme/index.html | 4 ++--
docs/react/hooks/usePreservedCallback/index.html | 4 ++--
docs/react/hooks/usePreservedState/index.html | 4 ++--
docs/react/hooks/usePrevious/index.html | 4 ++--
docs/react/hooks/useResizeObserver/index.html | 4 ++--
docs/react/hooks/useScrollLock/index.html | 4 ++--
docs/react/hooks/useScrollTo/index.html | 4 ++--
docs/react/hooks/useSessionStorage/index.html | 4 ++--
docs/react/hooks/useStep/index.html | 4 ++--
docs/react/hooks/useStepState/index.html | 4 ++--
docs/react/hooks/useThrottle/index.html | 4 ++--
docs/react/hooks/useTimeout/index.html | 4 ++--
docs/react/hooks/useToggle/index.html | 4 ++--
docs/react/hooks/useToggleState/index.html | 4 ++--
docs/react/hooks/useUnmount/index.html | 4 ++--
docs/react/hooks/useUserAgent/index.html | 4 ++--
docs/react/hooks/useVhProperty/index.html | 4 ++--
docs/react/hooks/useVisibilityChange/index.html | 4 ++--
docs/react/hooks/useWindowSize/index.html | 4 ++--
docs/utils/array/at/index.html | 4 ++--
docs/utils/array/chunk/index.html | 4 ++--
docs/utils/array/compact/index.html | 4 ++--
docs/utils/array/contains/index.html | 4 ++--
docs/utils/array/countOccurrencesInArray/index.html | 4 ++--
docs/utils/array/difference/index.html | 4 ++--
docs/utils/array/drop/index.html | 4 ++--
docs/utils/array/excludeElements/index.html | 4 ++--
docs/utils/array/fill/index.html | 4 ++--
docs/utils/array/flatMap/index.html | 4 ++--
docs/utils/array/flatMapDeep/index.html | 4 ++--
docs/utils/array/flatten/index.html | 4 ++--
docs/utils/array/flattenDeep/index.html | 4 ++--
docs/utils/array/flattenDeepThenMap/index.html | 4 ++--
docs/utils/array/forEachRight/index.html | 4 ++--
docs/utils/array/groupBy/index.html | 4 ++--
docs/utils/array/intersection/index.html | 4 ++--
docs/utils/array/mapRight/index.html | 4 ++--
docs/utils/array/partition/index.html | 4 ++--
docs/utils/array/shuffle/index.html | 4 ++--
docs/utils/array/swap/index.html | 4 ++--
docs/utils/array/take/index.html | 4 ++--
docs/utils/array/union/index.html | 4 ++--
docs/utils/array/uniq/index.html | 4 ++--
docs/utils/array/xor/index.html | 4 ++--
docs/utils/clipboard/copyClipboardImage/index.html | 4 ++--
docs/utils/clipboard/copyClipboardText/index.html | 4 ++--
docs/utils/clipboard/copyFallbackClipboardText/index.html | 4 ++--
docs/utils/clipboard/readClipboardContents/index.html | 4 ++--
docs/utils/clipboard/readClipboardText/index.html | 4 ++--
docs/utils/common/abRandom/index.html | 4 ++--
docs/utils/common/asyncNoop/index.html | 4 ++--
docs/utils/common/cloneDeep/index.html | 4 ++--
docs/utils/common/delay/index.html | 4 ++--
docs/utils/common/getUniqId/index.html | 4 ++--
docs/utils/common/getUniqTime/index.html | 4 ++--
docs/utils/common/getViewportSize/index.html | 4 ++--
docs/utils/common/hexToRgba/index.html | 4 ++--
docs/utils/common/identity/index.html | 4 ++--
docs/utils/common/noop/index.html | 4 ++--
docs/utils/common/once/index.html | 4 ++--
docs/utils/common/parseJSON/index.html | 4 ++--
docs/utils/common/pickFalsy/index.html | 4 ++--
docs/utils/common/size/index.html | 4 ++--
docs/utils/common/wrapInArray/index.html | 4 ++--
docs/utils/date/getAge/index.html | 4 ++--
docs/utils/date/getDDay/index.html | 4 ++--
docs/utils/date/isAfterDate/index.html | 4 ++--
docs/utils/date/isBeforeDate/index.html | 4 ++--
docs/utils/date/isDateInRange/index.html | 4 ++--
docs/utils/date/isUnderAge/index.html | 4 ++--
docs/utils/device/getOS/index.html | 4 ++--
docs/utils/device/isClient/index.html | 4 ++--
docs/utils/device/isMobile/index.html | 4 ++--
docs/utils/device/isSever/index.html | 4 ++--
docs/utils/file/convertImageToBase64/index.html | 4 ++--
docs/utils/file/convertImageToBlob/index.html | 4 ++--
docs/utils/file/getBlobFromUrl/index.html | 4 ++--
docs/utils/file/getMIMEType/index.html | 4 ++--
docs/utils/file/getMIMETypeFromFile/index.html | 4 ++--
docs/utils/file/getMIMETypeFromResponse/index.html | 4 ++--
docs/utils/file/getMIMETypeFromUrl/index.html | 4 ++--
docs/utils/formatter/formatNumberWithCommas/index.html | 4 ++--
docs/utils/formatter/formatNumberWithUnits/index.html | 4 ++--
docs/utils/formatter/formatPhoneNumber/index.html | 4 ++--
docs/utils/formatter/formatValueWithSymbol/index.html | 4 ++--
docs/utils/math/average/index.html | 4 ++--
docs/utils/math/clamp/index.html | 4 ++--
docs/utils/math/max/index.html | 4 ++--
docs/utils/math/min/index.html | 4 ++--
docs/utils/math/range/index.html | 4 ++--
docs/utils/math/sum/index.html | 4 ++--
docs/utils/object/deleteEmptyProperties/index.html | 4 ++--
docs/utils/object/findKey/index.html | 4 ++--
docs/utils/object/findLastKey/index.html | 4 ++--
docs/utils/object/invert/index.html | 4 ++--
docs/utils/object/mapKeys/index.html | 4 ++--
docs/utils/object/mapValues/index.html | 4 ++--
docs/utils/object/merge/index.html | 4 ++--
docs/utils/object/objectEntries/index.html | 4 ++--
docs/utils/object/objectKeys/index.html | 4 ++--
docs/utils/object/objectValues/index.html | 4 ++--
docs/utils/object/omit/index.html | 4 ++--
docs/utils/object/omitBy/index.html | 4 ++--
docs/utils/object/pick/index.html | 4 ++--
docs/utils/object/pickBy/index.html | 4 ++--
docs/utils/string/countSubstringOccurrences/index.html | 4 ++--
docs/utils/string/extractLetters/index.html | 4 ++--
docs/utils/string/extractNumber/index.html | 4 ++--
docs/utils/string/removeSpecialCharacters/index.html | 4 ++--
docs/utils/string/repeatCharacters/index.html | 4 ++--
docs/utils/string/reverseString/index.html | 4 ++--
docs/utils/string/serialize/index.html | 4 ++--
docs/utils/style/formatSizeStyleValue/index.html | 4 ++--
docs/utils/style/rem/index.html | 4 ++--
docs/utils/validator/hasProperty/index.html | 4 ++--
docs/utils/validator/isArray/index.html | 4 ++--
docs/utils/validator/isBoolean/index.html | 4 ++--
docs/utils/validator/isDate/index.html | 4 ++--
docs/utils/validator/isEqual/index.html | 4 ++--
docs/utils/validator/isFloat/index.html | 4 ++--
docs/utils/validator/isFuntion/index.html | 4 ++--
docs/utils/validator/isInRange/index.html | 4 ++--
docs/utils/validator/isMIMEType/index.html | 4 ++--
docs/utils/validator/isNil/index.html | 4 ++--
docs/utils/validator/isNotNil/index.html | 4 ++--
docs/utils/validator/isNumber/index.html | 4 ++--
docs/utils/validator/isNumericString/index.html | 4 ++--
docs/utils/validator/isPlainObject/index.html | 4 ++--
docs/utils/validator/isPrimitive/index.html | 4 ++--
docs/utils/validator/isPromise/index.html | 4 ++--
docs/utils/validator/isReference/index.html | 4 ++--
docs/utils/validator/isString/index.html | 4 ++--
docs/utils/validator/isSubset/index.html | 4 ++--
docs/utils/validator/isValidEmail/index.html | 4 ++--
docs/utils/validator/isValidPassword/index.html | 4 ++--
docs/utils/validator/isValidPhoneNumber/index.html | 4 ++--
docs/utils/validator/isWindow/index.html | 4 ++--
index.html | 4 ++--
298 files changed, 429 insertions(+), 429 deletions(-)
delete mode 100644 assets/js/0468e7c7.54a90a5f.js
create mode 100644 assets/js/0468e7c7.69aa168d.js
delete mode 100644 assets/js/069bf6ce.37c76340.js
create mode 100644 assets/js/069bf6ce.5a1773f5.js
delete mode 100644 assets/js/087cca41.64dcef64.js
create mode 100644 assets/js/087cca41.8c16c0a3.js
delete mode 100644 assets/js/0ed4549e.bb34a41a.js
create mode 100644 assets/js/0ed4549e.f00dd43e.js
create mode 100644 assets/js/11738f66.0f506a6b.js
delete mode 100644 assets/js/11738f66.1ad6e8ce.js
delete mode 100644 assets/js/1c2388cf.a9138072.js
create mode 100644 assets/js/1c2388cf.d917f60e.js
create mode 100644 assets/js/1ebcacad.43280e43.js
delete mode 100644 assets/js/1ebcacad.ece260fc.js
create mode 100644 assets/js/225c6dfe.4dfdc544.js
delete mode 100644 assets/js/225c6dfe.7b9830ad.js
delete mode 100644 assets/js/24c74d07.b0f51709.js
create mode 100644 assets/js/24c74d07.f02220dd.js
delete mode 100644 assets/js/295f1714.2f90ba2f.js
create mode 100644 assets/js/295f1714.8387b2be.js
create mode 100644 assets/js/308b5f81.80461474.js
delete mode 100644 assets/js/308b5f81.db118fd1.js
create mode 100644 assets/js/36bebd15.56b57b2c.js
delete mode 100644 assets/js/36bebd15.da7fd56a.js
delete mode 100644 assets/js/3bdef6d7.4c300635.js
create mode 100644 assets/js/3bdef6d7.85d88013.js
create mode 100644 assets/js/3e5d9272.5b90e6a3.js
delete mode 100644 assets/js/3e5d9272.fe03afa2.js
delete mode 100644 assets/js/42a77533.0d5c5bad.js
create mode 100644 assets/js/42a77533.4dc4c694.js
delete mode 100644 assets/js/54102c04.35ce4b40.js
create mode 100644 assets/js/54102c04.d0fd9f95.js
create mode 100644 assets/js/5d610355.79411896.js
delete mode 100644 assets/js/5d610355.9c05908f.js
delete mode 100644 assets/js/61a35b61.4c79d1bb.js
create mode 100644 assets/js/61a35b61.53efbb03.js
create mode 100644 assets/js/63f47a7c.23b9a51e.js
delete mode 100644 assets/js/63f47a7c.f5e54242.js
delete mode 100644 assets/js/67c089fb.04be0bd6.js
create mode 100644 assets/js/67c089fb.835c1131.js
create mode 100644 assets/js/67c0cc0e.49a8fe54.js
delete mode 100644 assets/js/67c0cc0e.f6b6fd72.js
create mode 100644 assets/js/6dde689d.a296f296.js
delete mode 100644 assets/js/6dde689d.fedb5911.js
delete mode 100644 assets/js/771be322.5aeede07.js
create mode 100644 assets/js/771be322.c8085557.js
create mode 100644 assets/js/78bcb238.70a9a9dd.js
delete mode 100644 assets/js/78bcb238.ec590572.js
create mode 100644 assets/js/7b61a3fa.7e7d5f1c.js
delete mode 100644 assets/js/7b61a3fa.962828ef.js
rename assets/js/{7b7be0e1.5bac0365.js => 7b7be0e1.041efcab.js} (98%)
create mode 100644 assets/js/7da35ef8.5f20f679.js
delete mode 100644 assets/js/7da35ef8.af433888.js
create mode 100644 assets/js/8053496e.1a9e1459.js
rename assets/js/{9358.cf0d0d27.js.LICENSE.txt => 8053496e.1a9e1459.js.LICENSE.txt} (100%)
delete mode 100644 assets/js/8053496e.52db90d6.js
delete mode 100644 assets/js/8079f804.405bc534.js
create mode 100644 assets/js/8079f804.846a7d09.js
create mode 100644 assets/js/83b4ba0b.337ac227.js
delete mode 100644 assets/js/83b4ba0b.925129e0.js
delete mode 100644 assets/js/8a16b8e9.81b7a2bd.js
create mode 100644 assets/js/8a16b8e9.b6ef01ce.js
create mode 100644 assets/js/932ca9ec.70922df5.js
delete mode 100644 assets/js/932ca9ec.db37b8df.js
delete mode 100644 assets/js/9358.cf0d0d27.js
create mode 100644 assets/js/9602.e7bd29f4.js
create mode 100644 assets/js/9be130a4.4d76744e.js
delete mode 100644 assets/js/9be130a4.7890da22.js
create mode 100644 assets/js/a45fe377.41d28a11.js
delete mode 100644 assets/js/a45fe377.4da78159.js
delete mode 100644 assets/js/aa089504.030a7252.js
create mode 100644 assets/js/aa089504.c58fc7eb.js
delete mode 100644 assets/js/ab7af1d3.d2f1107c.js
create mode 100644 assets/js/ab7af1d3.e6628944.js
delete mode 100644 assets/js/ad8813a3.4fede0e4.js
create mode 100644 assets/js/ad8813a3.b73e934f.js
delete mode 100644 assets/js/af3233c2.b6ff46a8.js
create mode 100644 assets/js/af3233c2.e18844a5.js
delete mode 100644 assets/js/b35b1276.32da6ca7.js
create mode 100644 assets/js/b35b1276.f4904be4.js
create mode 100644 assets/js/b3bf5b56.15e7497a.js
delete mode 100644 assets/js/b3bf5b56.3de72384.js
delete mode 100644 assets/js/b506dfd1.75ad62c0.js
create mode 100644 assets/js/b506dfd1.a3ce067b.js
create mode 100644 assets/js/b743ea75.67047af2.js
delete mode 100644 assets/js/b743ea75.ef78621a.js
create mode 100644 assets/js/b862475b.723acd2d.js
delete mode 100644 assets/js/b862475b.bee34558.js
create mode 100644 assets/js/bf0dbc92.22073d5b.js
delete mode 100644 assets/js/bf0dbc92.786703fe.js
delete mode 100644 assets/js/c060fdc4.e3c170be.js
create mode 100644 assets/js/c060fdc4.f6ac9307.js
delete mode 100644 assets/js/c55bf516.d54c1b72.js
create mode 100644 assets/js/c55bf516.dc1b8151.js
delete mode 100644 assets/js/c55c9b0f.2c631495.js
create mode 100644 assets/js/c55c9b0f.b843329f.js
create mode 100644 assets/js/cb3f6f96.467289bb.js
delete mode 100644 assets/js/cb3f6f96.981f1a69.js
create mode 100644 assets/js/cc0ca23c.3f2a29ee.js
delete mode 100644 assets/js/cc0ca23c.6e15d121.js
delete mode 100644 assets/js/e3446db6.0af37d96.js
create mode 100644 assets/js/e3446db6.60006c6a.js
create mode 100644 assets/js/eb0f0f4b.a2aa0ab8.js
delete mode 100644 assets/js/eb0f0f4b.a3f4489a.js
rename assets/js/{eea24eaa.a4df495e.js => eea24eaa.4dae6214.js} (98%)
create mode 100644 assets/js/f5098664.1709d859.js
delete mode 100644 assets/js/f5098664.d9107365.js
create mode 100644 assets/js/fbe6690a.6440acf8.js
delete mode 100644 assets/js/fbe6690a.828a8885.js
create mode 100644 assets/js/main.1e9414e3.js
rename assets/js/{main.ec90acce.js.LICENSE.txt => main.1e9414e3.js.LICENSE.txt} (100%)
delete mode 100644 assets/js/main.ec90acce.js
rename assets/js/{runtime~main.cb3f84d6.js => runtime~main.a3be8a28.js} (61%)
diff --git a/404.html b/404.html
index a96db99c5..2637b29aa 100644
--- a/404.html
+++ b/404.html
@@ -4,8 +4,8 @@
Page Not Found | @modern-kit
-
-
+
+
Page Not Found
We could not find what you were looking for.
Please contact the owner of the site that linked you to the original URL and let them know their link is broken.
diff --git a/assets/js/0468e7c7.54a90a5f.js b/assets/js/0468e7c7.54a90a5f.js
deleted file mode 100644
index 1ec5d0c98..000000000
--- a/assets/js/0468e7c7.54a90a5f.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[5951],{6768:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>d,assets:()=>u,contentTitle:()=>a,default:()=>p,frontMatter:()=>l,metadata:()=>r,toc:()=>f});const r=JSON.parse('{"id":"react/hooks/useDependencyTimeout","title":"useDependencyTimeout","description":"useTimeout \uc744 \uc0ac\uc6a9\ud574 \uc778\uc790\ub85c \uc804\ub2ec\ud558\ub294 \uc758\uc874\uc131 \ubc30\uc5f4\uc758 \uac12\uc774 \ubcc0\uacbd\ub418\uba74 Timeout\uc744 \uc7ac\uc124\uc815\ud558\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useDependencyTimeout.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useDependencyTimeout","permalink":"/modern-kit/docs/react/hooks/useDependencyTimeout","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useDebouncedState","permalink":"/modern-kit/docs/react/hooks/useDebouncedState"},"next":{"title":"useDocumentTitle","permalink":"/modern-kit/docs/react/hooks/useDocumentTitle"}}');var o=n(6206),i=n(3267),s=n(4027),c=n(4382);const l={},a="useDependencyTimeout",u={},d=()=>{const e={button:"button",div:"div",p:"p",...(0,i.R)()},[t,n]=(0,c.useState)(0),[r,l]=(0,c.useState)(!1),{set:a,reset:u,clear:d}=(0,s.Y1)((()=>{n(t+1)}),1e3,[r]);return(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.p,{children:t}),(0,o.jsx)(e.button,{onClick:()=>l(!r),children:"Toggle \uc758\uc874\uc131 \ubc30\uc5f4 \uc218\uc815"}),(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.button,{onClick:()=>a(),children:"set"}),(0,o.jsx)(e.button,{onClick:()=>u(),children:"reset"}),(0,o.jsx)(e.button,{onClick:()=>d(),children:"clear"})]})]})},f=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function h(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",strong:"strong",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"usedependencytimeout",children:"useDependencyTimeout"})}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.strong,{children:(0,o.jsx)(t.a,{href:"https://modern-agile-team.github.io/modern-kit/docs/react/hooks/useTimeout",children:"useTimeout"})})," \uc744 \uc0ac\uc6a9\ud574 \uc778\uc790\ub85c \uc804\ub2ec\ud558\ub294 \uc758\uc874\uc131 \ubc30\uc5f4\uc758 \uac12\uc774 \ubcc0\uacbd\ub418\uba74 ",(0,o.jsx)(t.code,{children:"Timeout"}),"\uc744 \uc7ac\uc124\uc815\ud558\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:["\uccab \ubc88\uc9f8 \uc778\uc790\ub85c ",(0,o.jsx)(t.code,{children:"callback"})," \ud568\uc218\ub97c \ubc1b\uc2b5\ub2c8\ub2e4.\n\ub450 \ubc88\uc9f8 \uc778\uc790\ub85c ",(0,o.jsx)(t.code,{children:"delay"})," \uc22b\uc790 \ud639\uc740 ",(0,o.jsx)(t.code,{children:"TimerOptions"}),"\ub97c \ubc1b\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4. ",(0,o.jsx)(t.code,{children:"TimerOptions"}),"\ub294 ",(0,o.jsx)(t.code,{children:"delay"}),"\uc640 ",(0,o.jsx)(t.code,{children:"enabled"}),"\ub97c \ud3ec\ud568\ud558\ub294 \uac1d\uccb4\uc785\ub2c8\ub2e4.\n\uc138 \ubc88\uc9f8 \uc778\uc790\ub294 \uc758\uc874\uc131 \ubc30\uc5f4\uc778 ",(0,o.jsx)(t.code,{children:"deps"})," \uc785\ub2c8\ub2e4. \ud574\ub2f9 \uc758\uc874\uc131 \ubc30\uc5f4 \ub0b4 \uac12\uc774 \ubc14\ub00c\uba74 ",(0,o.jsx)(t.code,{children:"Timeout"}),"\uc744 \uc7ac\uc124\uc815\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"Timeout"}),"\uc744 \uc9c1\uc811 \ud578\ub4e4\ub9c1 \ud560 \uc218 \uc788\ub294 ",(0,o.jsx)(t.code,{children:"set"}),", ",(0,o.jsx)(t.code,{children:"reset"}),", ",(0,o.jsx)(t.code,{children:"clear"})," \ud568\uc218\ub97c \ud3ec\ud568\ud55c \uac1d\uccb4\ub97c \ubc18\ud658\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useDependencyTimeout/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"export function useDependencyTimeout(\n callback: () => void,\n delay: number,\n deps: DependencyList\n): ReturnType;\n\nexport function useDependencyTimeout(\n callback: () => void,\n options: TimeoutOptions,\n deps: DependencyList\n): ReturnType;\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useDependencyTimeout } from '@modern-kit/react';\n\nconst Example = () => {\n const [number, setNumber] = useState(0);\n const [boolean, setBoolean] = useState(false);\n\n const { set, reset, clear } = useDependencyTimeout(() => {\n setNumber(number + 1);\n }, 1000, [boolean]);\n \n /*\n * useDependencyTimeout(() => {\n * setNumber(number + 1);\n * }, { delay: 1000, enabled: true });\n */\n\n return (\n \n
{number}
\n
\n
\n \n \n \n
\n
\n );\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(d,{})]})}function p(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(h,{...e})}):h(e)}},4027:(e,t,n)=>{n.d(t,{$$:()=>Me,$I:()=>oe,AE:()=>Be,BL:()=>H,DX:()=>N,FT:()=>ct,Fo:()=>et,Hn:()=>it,I5:()=>Ee,JF:()=>$e,K:()=>ae,K$:()=>Je,M0:()=>Re,ML:()=>ne,Mj:()=>ve,Mk:()=>Le,Mo:()=>ie,NT:()=>Ye,QV:()=>Ue,Ub:()=>ke,Ut:()=>je,W7:()=>U,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>We,Zu:()=>le,_1:()=>Oe,_g:()=>nt,aL:()=>J,aY:()=>Ne,bB:()=>X,d7:()=>z,eG:()=>st,fN:()=>ce,fm:()=>G,gl:()=>M,hN:()=>A,iD:()=>de,iQ:()=>Fe,jd:()=>se,lW:()=>at,oD:()=>K,oo:()=>Te,pL:()=>q,qi:()=>ue,rN:()=>Ie,tD:()=>Se,u8:()=>Q,wY:()=>ze,xV:()=>F,xh:()=>tt,zy:()=>Z});var r=n(6206),o=n(4382),i=n(3683),s=n(5086),c=n(7197),l=(n(1604),n(5938));function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function m(){return typeof window>"u"}function b(){return!m()}function g(e){return f(this,0,void 0,(function*(){if(!b())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const w=e=>f(void 0,0,void 0,(function*(){return g(yield(yield fetch(e)).text())}));function y(e,t){var n;return f(this,0,void 0,(function*(){if(!b())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return w(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const i=yield p(e,h[t]);n(i)}catch(i){console.error(`Failed to load image. message: ${i.mesaage}`),r(i)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const v=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i=0;i{if(e===t||C(e)&&C(t)&&isNaN(e)&&isNaN(t))return!0;if(S(e)&&S(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return v(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!x(o,t.get(r),n))return!1;return!0}return v(e,t,n)};function k(e,t){return x(e,t,new WeakMap)}function S(e){return"function"==typeof e}function C(e){return"number"==typeof e}function j(e){return!function(e){return Object(e)!==e}(e)}function E(){}function T(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const O=(...e)=>t=>e.forEach((e=>{if(S(e))e(t);else if(null!=e){e.current=t}}));function R(...e){return(0,o.useCallback)(O(...e),e)}const N=o.forwardRef(((e,t)=>{const{children:n}=e,i=a(e,["children"]),s=o.Children.toArray(n),c=s.find(L);if(c){const e=c.props.children,n=s.map((t=>t===c?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(I,Object.assign({},i,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(I,Object.assign({},i,{ref:t,children:n}))}));N.displayName="Slot";const I=o.forwardRef(((e,t)=>{const{children:n}=e,r=a(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),i):"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?O(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));I.displayName="SlotClone";const F=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function L(e){return o.isValidElement(e)&&e.type===F}var D="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const M=d(((e,t)=>{var{ratio:n,style:o,as:s="div",asChild:c=!1}=e,l=a(e,["ratio","style","as","asChild"]);const u=c?N:s,d=Object.assign({aspectRatio:n},o),f=c?l.className:i(D,l.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},l))})),$=()=>E,P=()=>!1,Y=()=>!0;function X({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)($,P,Y)?e:t}function V(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const A=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>V()?(0,r.jsx)(r.Fragment,{children:t}):e;function B(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function W(e){const t=B(e);(0,o.useEffect)((()=>()=>t()),[t])}function _(e,t=k){const[n,r]=(0,o.useState)(e),i=B(t);return(0,o.useEffect)((()=>{i(n,e)||r(e)}),[i,n,e]),n}function z(e,t,n){const r=B(e),i=_(n),c=(0,o.useMemo)((()=>(0,s.A)(r,t,i)),[r,t,i]);return W((()=>c.cancel())),c}const J=({children:e,capture:t,wait:n,options:r})=>{const i=o.Children.only(e),s=z(((...e)=>{const n=i?.props;if(n&&S(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(i,{[t]:s})};function H({onIntersectStart:e=E,onIntersectEnd:t=E,enabled:n=!0,calledOnce:r=!1,root:i=null,threshold:s=0,rootMargin:c="0px 0px 0px 0px"}){const l=(0,o.useRef)(0),a=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=B((([n],o)=>{if(!n)return;const i=n.target;n.isIntersecting?(a.current=!0,l.current+=1,e(n)):a.current&&(a.current=!1,l.current+=1,t(n)),r&&l.current>1&&o.unobserve(i)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:s,root:i,rootMargin:c}),u.current.observe(e))}),[n,s,i,c,d])}}const K=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:i,rootMargin:s}=e,c=a(e,["src","threshold","root","rootMargin"]);const{ref:l}=H({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:i,rootMargin:s});return(0,r.jsx)("img",Object.assign({ref:R(t,l)},c))}));K.displayName="LazyImage";const U=(0,o.forwardRef)(((e,t)=>{var{width:n,height:i,fallback:s,className:c,style:l,duration:u="0.2s",onLoad:d}=e,f=a(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,p]=(0,o.useState)(!1),m=!h,b=(0,o.useMemo)((()=>({position:"relative",width:n,height:i})),[n,i]),g=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:m?0:1,transition:`opacity ${u}`},l)),[m,u,l]),w=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),y=c?`lazy-image-wrapper ${c}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:y,style:b,children:[m&&s,(0,r.jsx)(K,Object.assign({ref:t,width:n,height:i,style:g,onLoad:w},f))]})}));U.displayName="FallbackLazyImage";const Z=({condition:e,trueComponent:t,falseComponent:n})=>{const i=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:i?t:n})},Q=({onScrollAction:e,children:t,root:n,threshold:o,enabled:i,triggerPosition:s="after",rootMargin:c="150px 0px"})=>{const{ref:l}=H({onIntersectStart:e,root:n,threshold:o,enabled:i,rootMargin:c});return(0,r.jsxs)(r.Fragment,{children:["before"===s&&(0,r.jsx)("div",{ref:l}),t,"after"===s&&(0,r.jsx)("div",{ref:l})]})},q=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1}=e,c=a(e,["children","as","asChild"]);const l=s?N:i,{ref:u}=H(c);if(s&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(l,Object.assign({ref:O(t,u)},c,{children:n}))})),G=({items:e=[],itemKey:t,renderItem:n})=>{const i=(0,o.useCallback)(((e,n)=>function(e){return j(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},i(e,t))))})},ee=b()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=B(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),i=(0,o.useMemo)((()=>function(){if(m())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,i,(({target:t})=>{if(!r.current)return;const o=r.current,i=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!i&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1,onPointerDown:c,excludeRefs:l=[]}=e,u=a(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(c,{excludeRefs:l}),f=s?N:i;if(s&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:O(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const ie=({itemKey:e,items:t=[],separator:n,renderItem:i,separatorInterval:s=1,includeLastSeparator:c=!1})=>{const l=(0,o.useCallback)((e=>e===t.length-1?c:(e+1)%s==0),[c,s,t.length]);return(0,r.jsx)(G,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[i(e,t),l(t)&&n]})})},se=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ce=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function le(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function ae(e=!0){const t=S(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!i.current){i.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{i.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),i=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield g(e);return t(n),!0}catch{return t(null),!1}}))),[]),s=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield y(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!b())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),l=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!b())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:i,copyImage:s,readText:c,readContents:l}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",pe={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},me=e=>pe[e],be=me("localStorage"),ge=e=>window.localStorage.getItem(e),we=e=>JSON.stringify(e),ye=e=>(be.subscribe(e),()=>{be.unsubscribe(e)});function ve(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=S(n)?n():n,i=(0,o.useSyncExternalStore)(ye,(()=>ge(t)),(()=>we(r)));return{state:(0,o.useMemo)((()=>i?T(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=ge(t),o=n?T(n):r,i=S(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(i)),be.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),be.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const xe=(e,t)=>b()?window.matchMedia(e).matches:t??!1;function ke(e,t){const[n,r]=(0,o.useState)(xe(e,t)),i=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",i),n}function Se(){return ke("(prefers-color-scheme: dark)")?"dark":"light"}const Ce="color-scheme";function je({defaultValue:e,key:t=Ce,shouldSetBodyClass:n=!1}={}){const r=Se(),i=S(e)?e():e,{state:s,setState:c}=ve({key:t,initialValue:i??r}),l=(0,o.useCallback)((()=>{c((e=>"dark"===e?"light":"dark"))}),[c]),a=(0,o.useCallback)((()=>{c("dark")}),[c]),u=(0,o.useCallback)((()=>{c("light")}),[c]),d=(0,o.useCallback)((()=>{c(r)}),[c,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(s),()=>{n&&document.body.classList.remove(s)})),[s,n]),{colorScheme:s,preferredColorScheme:r,setToggleMode:l,setDarkMode:a,setLightMode:u,setPreferredMode:d}}function Ee(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),i=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),s=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:i,reset:s}}function Te({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,i]=(0,o.useState)(t),s=r0,l=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),a=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const s=l(e,t);o&&o({prev:r,next:s}),i(s)}),[n,r,l]),u=(0,o.useCallback)((e=>{a("nextStep",!s,e)}),[s,a]),d=(0,o.useCallback)((e=>{a("prevStep",!c,e)}),[c,a]),f=(0,o.useCallback)(((t,n)=>{const o=S(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void i(t);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),i(t)}),[r,t]);return{currentStep:r,hasNextStep:s,hasPrevStep:c,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Oe(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:i,resetStep:s}=Te({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:i,resetIndex:s}}function Re(e,t,n={}){const[r,i]=(0,o.useState)(e);return[r,z(i,t,n)]}function Ne(e,t={}){const[n,r]=(0,o.useState)(""),[i,s]=Re("",e,t);return{value:n,debouncedValue:i,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),s(t)}),[s]),onReset:(0,o.useCallback)((()=>{r(""),s("")}),[s])}}function Ie(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Fe({onFocus:e=E,onBlur:t=E}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=B((t=>{r(!0),e(t)})),c=B((e=>{r(!1),t(e)})),l=(0,o.useCallback)((()=>{i.current&&(i.current.focus(),r(!0))}),[]);return ne(i,"focus",s),ne(i,"blur",c),{ref:i,isFocus:n,setFocus:l}}function Le({onEnter:e=E,onLeave:t=E}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=B((t=>{r(!0),e(t)})),c=B((e=>{r(!1),t(e)}));return ne(i,"mouseenter",s),ne(i,"mouseleave",c),{ref:i,isHovered:n}}const De=e=>{var t;return C(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function Me(e,t){const n=(0,o.useRef)(),r=B(e),{delay:i,enabled:s}=De(t),c=(0,o.useCallback)((()=>{n.current=window.setInterval(r,i)}),[r,i]),l=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),c()}),[l,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>l()}),[l,c,s,i]),{set:c,reset:a,clear:l}}function $e({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),i=B((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];S(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",i),()=>t.removeEventListener("keydown",i)}),[e,i]),r}const Pe={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function Ye(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)(Pe),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:l}=t;let a=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();a=i-t.left,u=s-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:l,elementRelativeX:a,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const Xe=()=>navigator.onLine,Ve=()=>!0,Ae=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function Be({onlineAction:e=E,offlineAction:t=E}={}){const n=B((n=>Ae(n,e,t)));return(0,o.useSyncExternalStore)(n,Xe,Ve)}function We(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const _e={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function ze(e=E){const[t,n]=(0,o.useState)(_e),r=(0,o.useRef)(null),i=B((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(i);return t.observe(e),()=>{t.unobserve(e)}}),[i]),{ref:r,contentRect:t}}function Je({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),i=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>i())),[e,r,i]),{ref:t,lock:r,unlock:i}}const He=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,Ke=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:i=0,alignY:s="start",alignX:c="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+i+He(window.innerHeight,r.height,s),left:r.left+window.scrollX+o+He(window.innerWidth,r.width,c)};const l=e.getBoundingClientRect();return{top:r.top-l.top+e.scrollTop+i+He(l.height,r.height,s),left:r.left-l.left+e.scrollLeft+o+He(l.width,r.width,c)}};function Ue(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:i,top:s}=Ke(r,t,n);r.scrollTo({top:s,left:i,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ze=me("sessionStorage"),Qe=e=>window.sessionStorage.getItem(e),qe=e=>JSON.stringify(e),Ge=e=>(Ze.subscribe(e),()=>{Ze.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=S(n)?n():n,i=(0,o.useSyncExternalStore)(Ge,(()=>Qe(t)),(()=>qe(r)));return{state:(0,o.useMemo)((()=>i?T(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=Qe(t),o=n?T(n):r,i=S(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(i)),Ze.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ze.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:i}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[s,c]=(0,o.useState)(n),l=(0,o.useCallback)((e=>{c((t=>{const n=S(e)?e(t):e;return r&&i&&function(e,t,n){if(!b())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=S(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,i,n),n}))}),[r,i]),a=(0,o.useCallback)((()=>{r&&i&&function(e,t){if(!b())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,i),c(null)}),[r,i]);return Object.assign({state:s,setState:l,clearState:a},Te(e))}function nt(e,t,n={}){const r=B(e),i=_(n),s=(0,o.useMemo)((()=>(0,c.A)(r,t,i)),[r,t,i]);return W((()=>s.cancel())),s}const rt=e=>{var t;return C(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=B(e),{delay:i,enabled:s}=rt(t),c=(0,o.useCallback)((()=>{n.current=setTimeout(r,i)}),[r,i]),l=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),c()}),[l,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>l()}),[c,l,i,s]),{set:c,reset:a,clear:l}}function it(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function st(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new l.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function ct({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const lt={width:null,height:null};function at({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>m()?lt:{width:window.innerWidth,height:window.innerHeight})),r=z(n,e),i=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",i),t}function ut(e,t,n){const{delay:r,enabled:i}=rt(t),{set:s,reset:c,clear:l}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!i||c()}),[r,i,c,...n]),{set:s,reset:c,clear:l}}}}]);
\ No newline at end of file
diff --git a/assets/js/0468e7c7.69aa168d.js b/assets/js/0468e7c7.69aa168d.js
new file mode 100644
index 000000000..2df5f1327
--- /dev/null
+++ b/assets/js/0468e7c7.69aa168d.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[5951],{8391:(e,n,t)=>{t.r(n),t.d(n,{Example:()=>m,assets:()=>p,contentTitle:()=>l,default:()=>b,frontMatter:()=>d,metadata:()=>r,toc:()=>f});const r=JSON.parse('{"id":"react/hooks/useDependencyTimeout","title":"useDependencyTimeout","description":"useTimeout \uc744 \uc0ac\uc6a9\ud574 \uc778\uc790\ub85c \uc804\ub2ec\ud558\ub294 \uc758\uc874\uc131 \ubc30\uc5f4\uc758 \uac12\uc774 \ubcc0\uacbd\ub418\uba74 Timeout\uc744 \uc7ac\uc124\uc815\ud558\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useDependencyTimeout.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useDependencyTimeout","permalink":"/modern-kit/docs/react/hooks/useDependencyTimeout","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useDebouncedState","permalink":"/modern-kit/docs/react/hooks/useDebouncedState"},"next":{"title":"useDocumentTitle","permalink":"/modern-kit/docs/react/hooks/useDocumentTitle"}}');var o=t(6206),i=t(3267),c=t(4382),s=t(9545),a=t(9340);function u(e,n,t){const{delay:r,enabled:o}=(e=>{var n;return(0,a.Et)(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(n=null==e?void 0:e.enabled)||void 0===n||n}})(n),{set:i,reset:u,clear:d}=(0,s.Z)(e,{delay:r,enabled:!1});return(0,c.useEffect)((()=>{r<0||!o||u()}),[r,o,u,...t]),{set:i,reset:u,clear:d}}const d={},l="useDependencyTimeout",p={},m=()=>{const e={button:"button",div:"div",p:"p",...(0,i.R)()},[n,t]=(0,c.useState)(0),[r,s]=(0,c.useState)(!1),{set:a,reset:d,clear:l}=u((()=>{t(n+1)}),1e3,[r]);return(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.p,{children:n}),(0,o.jsx)(e.button,{onClick:()=>s(!r),children:"Toggle \uc758\uc874\uc131 \ubc30\uc5f4 \uc218\uc815"}),(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.button,{onClick:()=>a(),children:"set"}),(0,o.jsx)(e.button,{onClick:()=>d(),children:"reset"}),(0,o.jsx)(e.button,{onClick:()=>l(),children:"clear"})]})]})},f=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function h(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",strong:"strong",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.header,{children:(0,o.jsx)(n.h1,{id:"usedependencytimeout",children:"useDependencyTimeout"})}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.strong,{children:(0,o.jsx)(n.a,{href:"https://modern-agile-team.github.io/modern-kit/docs/react/hooks/useTimeout",children:"useTimeout"})})," \uc744 \uc0ac\uc6a9\ud574 \uc778\uc790\ub85c \uc804\ub2ec\ud558\ub294 \uc758\uc874\uc131 \ubc30\uc5f4\uc758 \uac12\uc774 \ubcc0\uacbd\ub418\uba74 ",(0,o.jsx)(n.code,{children:"Timeout"}),"\uc744 \uc7ac\uc124\uc815\ud558\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(n.p,{children:["\uccab \ubc88\uc9f8 \uc778\uc790\ub85c ",(0,o.jsx)(n.code,{children:"callback"})," \ud568\uc218\ub97c \ubc1b\uc2b5\ub2c8\ub2e4.\n\ub450 \ubc88\uc9f8 \uc778\uc790\ub85c ",(0,o.jsx)(n.code,{children:"delay"})," \uc22b\uc790 \ud639\uc740 ",(0,o.jsx)(n.code,{children:"TimerOptions"}),"\ub97c \ubc1b\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4. ",(0,o.jsx)(n.code,{children:"TimerOptions"}),"\ub294 ",(0,o.jsx)(n.code,{children:"delay"}),"\uc640 ",(0,o.jsx)(n.code,{children:"enabled"}),"\ub97c \ud3ec\ud568\ud558\ub294 \uac1d\uccb4\uc785\ub2c8\ub2e4.\n\uc138 \ubc88\uc9f8 \uc778\uc790\ub294 \uc758\uc874\uc131 \ubc30\uc5f4\uc778 ",(0,o.jsx)(n.code,{children:"deps"})," \uc785\ub2c8\ub2e4. \ud574\ub2f9 \uc758\uc874\uc131 \ubc30\uc5f4 \ub0b4 \uac12\uc774 \ubc14\ub00c\uba74 ",(0,o.jsx)(n.code,{children:"Timeout"}),"\uc744 \uc7ac\uc124\uc815\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.code,{children:"Timeout"}),"\uc744 \uc9c1\uc811 \ud578\ub4e4\ub9c1 \ud560 \uc218 \uc788\ub294 ",(0,o.jsx)(n.code,{children:"set"}),", ",(0,o.jsx)(n.code,{children:"reset"}),", ",(0,o.jsx)(n.code,{children:"clear"})," \ud568\uc218\ub97c \ud3ec\ud568\ud55c \uac1d\uccb4\ub97c \ubc18\ud658\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(n.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useDependencyTimeout/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(n.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"export function useDependencyTimeout(\n callback: () => void,\n delay: number,\n deps: DependencyList\n): ReturnType;\n\nexport function useDependencyTimeout(\n callback: () => void,\n options: TimeoutOptions,\n deps: DependencyList\n): ReturnType;\n"})}),"\n",(0,o.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useDependencyTimeout } from '@modern-kit/react';\n\nconst Example = () => {\n const [number, setNumber] = useState(0);\n const [boolean, setBoolean] = useState(false);\n\n const { set, reset, clear } = useDependencyTimeout(() => {\n setNumber(number + 1);\n }, 1000, [boolean]);\n \n /*\n * useDependencyTimeout(() => {\n * setNumber(number + 1);\n * }, { delay: 1000, enabled: true });\n */\n\n return (\n \n
{number}
\n
\n
\n \n \n \n
\n
\n );\n};\n"})}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(m,{})]})}function b(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(h,{...e})}):h(e)}},3267:(e,n,t)=>{t.d(n,{R:()=>c,x:()=>s});var r=t(4382);const o={},i=r.createContext(o);function c(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:c(e.components),r.createElement(i.Provider,{value:n},e.children)}},6765:(e,n,t)=>{t.d(n,{p:()=>o});var r=t(4382);function o(e){const n=(0,r.useRef)(e);return n.current=e,(0,r.useCallback)(((...e)=>n.current(...e)),[])}},9545:(e,n,t)=>{t.d(n,{Z:()=>s});var r=t(4382),o=t(6765),i=t(9340);const c=e=>{var n;return(0,i.Et)(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(n=null==e?void 0:e.enabled)||void 0===n||n}};function s(e,n){const t=(0,r.useRef)(),i=(0,o.p)(e),{delay:s,enabled:a}=c(n),u=(0,r.useCallback)((()=>{t.current=setTimeout(i,s)}),[i,s]),d=(0,r.useCallback)((()=>{t.current&&(clearTimeout(t.current),t.current=null)}),[]),l=(0,r.useCallback)((()=>{d(),u()}),[d,u]);return(0,r.useEffect)((()=>{if(!(s<0)&&a)return u(),()=>d()}),[u,d,s,a]),{set:u,reset:l,clear:d}}},9340:(e,n,t)=>{function r(e,n,t,r){return new(t||(t=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(n){i(n)}}function s(e){try{a(r.throw(e))}catch(n){i(n)}}function a(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(c,s)}a((r=r.apply(e,n||[])).next())}))}t.d(n,{Et:()=>v,Fr:()=>s,Gp:()=>y,Ol:()=>C,Qd:()=>j,S$:()=>c,Tn:()=>g,Zp:()=>p,dK:()=>u,fl:()=>S,gD:()=>x,i5:()=>f,if:()=>m,l6:()=>k,lQ:()=>T,nS:()=>l,ni:()=>O,oc:()=>a}),"function"==typeof SuppressedError&&SuppressedError;const o={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};const i=(e,n)=>new Promise(((t,r)=>{e.toBlob((e=>{e?t(e):r(new Error(`Failed to create blob with format ${n}`))}),n)}));function c(){return"undefined"==typeof window}function s(){if(c())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}function a(){return!c()}function u(e){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const n=document.createElement("textarea");n.value=e,n.style.opacity="0",document.body.appendChild(n),n.focus(),n.select();try{return document.execCommand("copy"),e}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}finally{document.body.removeChild(n)}}(e)}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}}))}const d=e=>r(void 0,void 0,void 0,(function*(){const n=yield fetch(e);return u(yield n.text())}));function l(e,n){var t;return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator))return d(e);if(!("write"in window.navigator.clipboard))return d(e);if(null!==(t=null==n?void 0:n.toText)&&void 0!==t&&t)return d(e);const c=yield function(e,n="png"){return new Promise(((t,c)=>{const s=new Image;s.onload=()=>r(this,void 0,void 0,(function*(){const e=document.createElement("canvas");e.width=s.width,e.height=s.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(s,0,0);const c=yield i(e,o[n]);t(c)}catch(r){console.error(`Failed to load image. message: ${r.mesaage}`),c(r)}})),s.onerror=()=>{c(new Error("Failed to load image"))},s.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[c.type]:c})]),c}catch(c){throw console.error(`Failed to copy to clipboard. message: ${c.message}`),c}}))}function p(){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function m(){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function f(e,n){return Object.prototype.hasOwnProperty.call(e,n)}const h=(e,n,t)=>{const r=Object.keys(e),o=Object.keys(n);if(r.length!==o.length)return!1;for(let i=0;i{if(e===n)return!0;if(v(e)&&v(n)&&isNaN(e)&&isNaN(n))return!0;if(g(e)&&g(n))return e.toString()===n.toString();if("object"!=typeof e||"object"!=typeof n||null===e||null===n)return!1;if(t.has(e)&&t.get(e)===n)return!0;if(t.set(e,n),e.constructor!==n.constructor)return!1;if(e instanceof Set){if(e.size!==n.size)return!1;const r=[...e],o=[...n];return h(r,o,t)}if(e instanceof Map){if(e.size!==n.size)return!1;for(const[r,o]of e)if(!n.has(r)||!b(o,n.get(r),t))return!1;return!0}return h(e,n,t)};function y(e,n){return b(e,n,new WeakMap)}function g(e){return"function"==typeof e}function x(e){return null==e}function v(e){return"number"==typeof e}function w(e){return!function(e){return Object(e)!==e}(e)}function j(e){return w(e)&&"[object Object]"===Object.prototype.toString.call(e)}function k(e){return e===window}function T(){}function C(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(n){throw new Error(`Failed to parse data: ${n}`)}}function E(e){return Object.keys(e)}const D={days:864e5,hours:36e5,minutes:6e4,seconds:1e3};E(D);function S(e,n){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(n)}catch(t){throw new Error(`Failed to remove key "${n}" from ${e}: ${t}`)}}function O(e,n,t){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=g(t)?t():t;r.setItem(n,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${n}" in ${e}: ${r}`)}}}}]);
\ No newline at end of file
diff --git a/assets/js/069bf6ce.37c76340.js b/assets/js/069bf6ce.37c76340.js
deleted file mode 100644
index af23192e8..000000000
--- a/assets/js/069bf6ce.37c76340.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[4676],{4303:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>u,assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>c,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"react/hooks/useBeforeUnload","title":"useBeforeUnload","description":"beforeunload \uc774\ubca4\ud2b8\ub97c \ub9ac\uc561\ud2b8\uc5d0\uc11c \uc27d\uac8c \ub2e4\ub8f0 \uc218 \uc788\ub294 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useBeforeUnload.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useBeforeUnload","permalink":"/modern-kit/docs/react/hooks/useBeforeUnload","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useAsyncEffect","permalink":"/modern-kit/docs/react/hooks/useAsyncEffect"},"next":{"title":"useBlockMultipleAsyncCalls","permalink":"/modern-kit/docs/react/hooks/useBlockMultipleAsyncCalls"}}');var o=n(6206),i=n(3267),s=n(4027);const c={},a="useBeforeUnload",l={},u=()=>{const e={div:"div",...(0,i.R)()};return(0,s.K)(),(0,o.jsx)(e.div,{children:"\ud398\uc774\uc9c0\ub97c \ub5a0\ub098\ubcf4\uc138\uc694."})},d=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function f(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",strong:"strong",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"usebeforeunload",children:"useBeforeUnload"})}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.strong,{children:(0,o.jsx)(t.a,{href:"https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event",children:"beforeunload"})})," \uc774\ubca4\ud2b8\ub97c \ub9ac\uc561\ud2b8\uc5d0\uc11c \uc27d\uac8c \ub2e4\ub8f0 \uc218 \uc788\ub294 \ud6c5\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"beforeunload"})," \uc774\ubca4\ud2b8\ub294 \uc0ac\uc6a9\uc790\uac00 \ud398\uc774\uc9c0\ub97c \ub5a0\ub0a0 \ub54c \ubc1c\uc0dd\ud558\ub294 \uc774\ubca4\ud2b8\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsx)(t.p,{children:"beforeunload \uc774\ubca4\ud2b8\uc758 \uc8fc\uc694 \uc0ac\ub840\ub294 \uc6f9 \ud398\uc774\uc9c0\uc5d0\uc11c \uc0ac\uc6a9\uc790\uc5d0\uac8c \uc2e4\uc81c\ub85c \ud398\uc774\uc9c0\ub97c \ub5a0\ub0a0 \uac83\uc778\uc9c0 \ubb3b\ub294 \ud655\uc778 \ub300\ud654 \uc0c1\uc790\ub97c \ud45c\uc2dc\ud574 \ud655\uc778\ud558\ub294 \uac83\uc785\ub2c8\ub2e4."}),"\n",(0,o.jsx)(t.p,{children:"\uc0ac\uc6a9\uc790\uac00 \ud655\uc778 \ubc84\ud2bc\uc744 \ub204\ub97c \uacbd\uc6b0 \ube0c\ub77c\uc6b0\uc800\ub294 \uc0c8 \ud398\uc774\uc9c0\ub85c \uc774\ub3d9\ud558\uace0 \uadf8\ub807\uc9c0 \uc54a\uc73c\uba74 \ud0d0\uc0c9\uc744 \ucde8\uc18c\ud558\uace0 \ud604\uc7ac \ud398\uc774\uc9c0\uc5d0 \uba38\ubb34\ub985\ub2c8\ub2e4."}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useBeforeUnload/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"function useBeforeUnload(enabled?: boolean | (() => boolean) = true): void\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useBeforeUnload } from '@modern-kit/react'\n\nconst Example = () => {\n useBeforeUnload();\n return \ud398\uc774\uc9c0\ub97c \ub5a0\ub098\ubcf4\uc138\uc694.
;\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(u,{})]})}function h(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(f,{...e})}):f(e)}},4027:(e,t,n)=>{n.d(t,{$$:()=>$e,$I:()=>oe,AE:()=>Ve,BL:()=>J,DX:()=>F,FT:()=>ct,Fo:()=>et,Hn:()=>it,I5:()=>je,JF:()=>Be,K:()=>le,K$:()=>ze,M0:()=>Ie,ML:()=>ne,Mj:()=>ye,Mk:()=>Me,Mo:()=>ie,NT:()=>Ae,QV:()=>Ke,Ub:()=>ke,Ut:()=>Ee,W7:()=>K,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>We,Zu:()=>ae,_1:()=>Oe,_g:()=>nt,aL:()=>z,aY:()=>Fe,bB:()=>Y,d7:()=>_,eG:()=>st,fN:()=>ce,fm:()=>G,gl:()=>$,hN:()=>X,iD:()=>de,iQ:()=>Le,jd:()=>se,lW:()=>lt,oD:()=>H,oo:()=>Re,pL:()=>q,qi:()=>ue,rN:()=>Ne,tD:()=>Se,u8:()=>Q,wY:()=>_e,xV:()=>L,xh:()=>tt,zy:()=>Z});var r=n(6206),o=n(4382),i=n(3683),s=n(5086),c=n(7197),a=(n(1604),n(5938));function l(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function m(){return typeof window>"u"}function g(){return!m()}function w(e){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const b=e=>f(void 0,0,void 0,(function*(){return w(yield(yield fetch(e)).text())}));function v(e,t){var n;return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return b(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const i=yield p(e,h[t]);n(i)}catch(i){console.error(`Failed to load image. message: ${i.mesaage}`),r(i)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i=0;i{if(e===t||C(e)&&C(t)&&isNaN(e)&&isNaN(t))return!0;if(S(e)&&S(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return y(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!x(o,t.get(r),n))return!1;return!0}return y(e,t,n)};function k(e,t){return x(e,t,new WeakMap)}function S(e){return"function"==typeof e}function C(e){return"number"==typeof e}function E(e){return!function(e){return Object(e)!==e}(e)}function j(){}function R(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const O=(...e)=>t=>e.forEach((e=>{if(S(e))e(t);else if(null!=e){e.current=t}}));function I(...e){return(0,o.useCallback)(O(...e),e)}const F=o.forwardRef(((e,t)=>{const{children:n}=e,i=l(e,["children"]),s=o.Children.toArray(n),c=s.find(M);if(c){const e=c.props.children,n=s.map((t=>t===c?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(N,Object.assign({},i,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(N,Object.assign({},i,{ref:t,children:n}))}));F.displayName="Slot";const N=o.forwardRef(((e,t)=>{const{children:n}=e,r=l(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),i):"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?O(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));N.displayName="SlotClone";const L=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function M(e){return o.isValidElement(e)&&e.type===L}var P="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const $=d(((e,t)=>{var{ratio:n,style:o,as:s="div",asChild:c=!1}=e,a=l(e,["ratio","style","as","asChild"]);const u=c?F:s,d=Object.assign({aspectRatio:n},o),f=c?a.className:i(P,a.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},a))})),B=()=>j,T=()=>!1,A=()=>!0;function Y({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)(B,T,A)?e:t}function U(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const X=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>U()?(0,r.jsx)(r.Fragment,{children:t}):e;function V(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function W(e){const t=V(e);(0,o.useEffect)((()=>()=>t()),[t])}function D(e,t=k){const[n,r]=(0,o.useState)(e),i=V(t);return(0,o.useEffect)((()=>{i(n,e)||r(e)}),[i,n,e]),n}function _(e,t,n){const r=V(e),i=D(n),c=(0,o.useMemo)((()=>(0,s.A)(r,t,i)),[r,t,i]);return W((()=>c.cancel())),c}const z=({children:e,capture:t,wait:n,options:r})=>{const i=o.Children.only(e),s=_(((...e)=>{const n=i?.props;if(n&&S(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(i,{[t]:s})};function J({onIntersectStart:e=j,onIntersectEnd:t=j,enabled:n=!0,calledOnce:r=!1,root:i=null,threshold:s=0,rootMargin:c="0px 0px 0px 0px"}){const a=(0,o.useRef)(0),l=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=V((([n],o)=>{if(!n)return;const i=n.target;n.isIntersecting?(l.current=!0,a.current+=1,e(n)):l.current&&(l.current=!1,a.current+=1,t(n)),r&&a.current>1&&o.unobserve(i)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:s,root:i,rootMargin:c}),u.current.observe(e))}),[n,s,i,c,d])}}const H=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:i,rootMargin:s}=e,c=l(e,["src","threshold","root","rootMargin"]);const{ref:a}=J({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:i,rootMargin:s});return(0,r.jsx)("img",Object.assign({ref:I(t,a)},c))}));H.displayName="LazyImage";const K=(0,o.forwardRef)(((e,t)=>{var{width:n,height:i,fallback:s,className:c,style:a,duration:u="0.2s",onLoad:d}=e,f=l(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,p]=(0,o.useState)(!1),m=!h,g=(0,o.useMemo)((()=>({position:"relative",width:n,height:i})),[n,i]),w=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:m?0:1,transition:`opacity ${u}`},a)),[m,u,a]),b=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),v=c?`lazy-image-wrapper ${c}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:v,style:g,children:[m&&s,(0,r.jsx)(H,Object.assign({ref:t,width:n,height:i,style:w,onLoad:b},f))]})}));K.displayName="FallbackLazyImage";const Z=({condition:e,trueComponent:t,falseComponent:n})=>{const i=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:i?t:n})},Q=({onScrollAction:e,children:t,root:n,threshold:o,enabled:i,triggerPosition:s="after",rootMargin:c="150px 0px"})=>{const{ref:a}=J({onIntersectStart:e,root:n,threshold:o,enabled:i,rootMargin:c});return(0,r.jsxs)(r.Fragment,{children:["before"===s&&(0,r.jsx)("div",{ref:a}),t,"after"===s&&(0,r.jsx)("div",{ref:a})]})},q=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1}=e,c=l(e,["children","as","asChild"]);const a=s?F:i,{ref:u}=J(c);if(s&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(a,Object.assign({ref:O(t,u)},c,{children:n}))})),G=({items:e=[],itemKey:t,renderItem:n})=>{const i=(0,o.useCallback)(((e,n)=>function(e){return E(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},i(e,t))))})},ee=g()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=V(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),i=(0,o.useMemo)((()=>function(){if(m())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,i,(({target:t})=>{if(!r.current)return;const o=r.current,i=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!i&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1,onPointerDown:c,excludeRefs:a=[]}=e,u=l(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(c,{excludeRefs:a}),f=s?F:i;if(s&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:O(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const ie=({itemKey:e,items:t=[],separator:n,renderItem:i,separatorInterval:s=1,includeLastSeparator:c=!1})=>{const a=(0,o.useCallback)((e=>e===t.length-1?c:(e+1)%s==0),[c,s,t.length]);return(0,r.jsx)(G,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[i(e,t),a(t)&&n]})})},se=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ce=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function ae(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function le(e=!0){const t=S(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!i.current){i.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{i.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),i=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield w(e);return t(n),!0}catch{return t(null),!1}}))),[]),s=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield v(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),a=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:i,copyImage:s,readText:c,readContents:a}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",pe={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},me=e=>pe[e],ge=me("localStorage"),we=e=>window.localStorage.getItem(e),be=e=>JSON.stringify(e),ve=e=>(ge.subscribe(e),()=>{ge.unsubscribe(e)});function ye(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=S(n)?n():n,i=(0,o.useSyncExternalStore)(ve,(()=>we(t)),(()=>be(r)));return{state:(0,o.useMemo)((()=>i?R(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=we(t),o=n?R(n):r,i=S(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(i)),ge.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),ge.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const xe=(e,t)=>g()?window.matchMedia(e).matches:t??!1;function ke(e,t){const[n,r]=(0,o.useState)(xe(e,t)),i=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",i),n}function Se(){return ke("(prefers-color-scheme: dark)")?"dark":"light"}const Ce="color-scheme";function Ee({defaultValue:e,key:t=Ce,shouldSetBodyClass:n=!1}={}){const r=Se(),i=S(e)?e():e,{state:s,setState:c}=ye({key:t,initialValue:i??r}),a=(0,o.useCallback)((()=>{c((e=>"dark"===e?"light":"dark"))}),[c]),l=(0,o.useCallback)((()=>{c("dark")}),[c]),u=(0,o.useCallback)((()=>{c("light")}),[c]),d=(0,o.useCallback)((()=>{c(r)}),[c,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(s),()=>{n&&document.body.classList.remove(s)})),[s,n]),{colorScheme:s,preferredColorScheme:r,setToggleMode:a,setDarkMode:l,setLightMode:u,setPreferredMode:d}}function je(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),i=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),s=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:i,reset:s}}function Re({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,i]=(0,o.useState)(t),s=r0,a=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),l=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const s=a(e,t);o&&o({prev:r,next:s}),i(s)}),[n,r,a]),u=(0,o.useCallback)((e=>{l("nextStep",!s,e)}),[s,l]),d=(0,o.useCallback)((e=>{l("prevStep",!c,e)}),[c,l]),f=(0,o.useCallback)(((t,n)=>{const o=S(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void i(t);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),i(t)}),[r,t]);return{currentStep:r,hasNextStep:s,hasPrevStep:c,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Oe(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:i,resetStep:s}=Re({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:i,resetIndex:s}}function Ie(e,t,n={}){const[r,i]=(0,o.useState)(e);return[r,_(i,t,n)]}function Fe(e,t={}){const[n,r]=(0,o.useState)(""),[i,s]=Ie("",e,t);return{value:n,debouncedValue:i,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),s(t)}),[s]),onReset:(0,o.useCallback)((()=>{r(""),s("")}),[s])}}function Ne(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Le({onFocus:e=j,onBlur:t=j}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=V((t=>{r(!0),e(t)})),c=V((e=>{r(!1),t(e)})),a=(0,o.useCallback)((()=>{i.current&&(i.current.focus(),r(!0))}),[]);return ne(i,"focus",s),ne(i,"blur",c),{ref:i,isFocus:n,setFocus:a}}function Me({onEnter:e=j,onLeave:t=j}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=V((t=>{r(!0),e(t)})),c=V((e=>{r(!1),t(e)}));return ne(i,"mouseenter",s),ne(i,"mouseleave",c),{ref:i,isHovered:n}}const Pe=e=>{var t;return C(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function $e(e,t){const n=(0,o.useRef)(),r=V(e),{delay:i,enabled:s}=Pe(t),c=(0,o.useCallback)((()=>{n.current=window.setInterval(r,i)}),[r,i]),a=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{a(),c()}),[a,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>a()}),[a,c,s,i]),{set:c,reset:l,clear:a}}function Be({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),i=V((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];S(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",i),()=>t.removeEventListener("keydown",i)}),[e,i]),r}const Te={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function Ae(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)(Te),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:a}=t;let l=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();l=i-t.left,u=s-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:a,elementRelativeX:l,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const Ye=()=>navigator.onLine,Ue=()=>!0,Xe=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function Ve({onlineAction:e=j,offlineAction:t=j}={}){const n=V((n=>Xe(n,e,t)));return(0,o.useSyncExternalStore)(n,Ye,Ue)}function We(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const De={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function _e(e=j){const[t,n]=(0,o.useState)(De),r=(0,o.useRef)(null),i=V((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(i);return t.observe(e),()=>{t.unobserve(e)}}),[i]),{ref:r,contentRect:t}}function ze({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),i=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>i())),[e,r,i]),{ref:t,lock:r,unlock:i}}const Je=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,He=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:i=0,alignY:s="start",alignX:c="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+i+Je(window.innerHeight,r.height,s),left:r.left+window.scrollX+o+Je(window.innerWidth,r.width,c)};const a=e.getBoundingClientRect();return{top:r.top-a.top+e.scrollTop+i+Je(a.height,r.height,s),left:r.left-a.left+e.scrollLeft+o+Je(a.width,r.width,c)}};function Ke(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:i,top:s}=He(r,t,n);r.scrollTo({top:s,left:i,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ze=me("sessionStorage"),Qe=e=>window.sessionStorage.getItem(e),qe=e=>JSON.stringify(e),Ge=e=>(Ze.subscribe(e),()=>{Ze.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=S(n)?n():n,i=(0,o.useSyncExternalStore)(Ge,(()=>Qe(t)),(()=>qe(r)));return{state:(0,o.useMemo)((()=>i?R(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=Qe(t),o=n?R(n):r,i=S(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(i)),Ze.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ze.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:i}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[s,c]=(0,o.useState)(n),a=(0,o.useCallback)((e=>{c((t=>{const n=S(e)?e(t):e;return r&&i&&function(e,t,n){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=S(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,i,n),n}))}),[r,i]),l=(0,o.useCallback)((()=>{r&&i&&function(e,t){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,i),c(null)}),[r,i]);return Object.assign({state:s,setState:a,clearState:l},Re(e))}function nt(e,t,n={}){const r=V(e),i=D(n),s=(0,o.useMemo)((()=>(0,c.A)(r,t,i)),[r,t,i]);return W((()=>s.cancel())),s}const rt=e=>{var t;return C(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=V(e),{delay:i,enabled:s}=rt(t),c=(0,o.useCallback)((()=>{n.current=setTimeout(r,i)}),[r,i]),a=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{a(),c()}),[a,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>a()}),[c,a,i,s]),{set:c,reset:l,clear:a}}function it(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function st(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new a.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function ct({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const at={width:null,height:null};function lt({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>m()?at:{width:window.innerWidth,height:window.innerHeight})),r=_(n,e),i=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",i),t}function ut(e,t,n){const{delay:r,enabled:i}=rt(t),{set:s,reset:c,clear:a}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!i||c()}),[r,i,c,...n]),{set:s,reset:c,clear:a}}}}]);
\ No newline at end of file
diff --git a/assets/js/069bf6ce.5a1773f5.js b/assets/js/069bf6ce.5a1773f5.js
new file mode 100644
index 000000000..59d045879
--- /dev/null
+++ b/assets/js/069bf6ce.5a1773f5.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[4676],{749:(e,n,t)=>{t.r(n),t.d(n,{Example:()=>u,assets:()=>l,contentTitle:()=>d,default:()=>h,frontMatter:()=>a,metadata:()=>r,toc:()=>f});const r=JSON.parse('{"id":"react/hooks/useBeforeUnload","title":"useBeforeUnload","description":"beforeunload \uc774\ubca4\ud2b8\ub97c \ub9ac\uc561\ud2b8\uc5d0\uc11c \uc27d\uac8c \ub2e4\ub8f0 \uc218 \uc788\ub294 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useBeforeUnload.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useBeforeUnload","permalink":"/modern-kit/docs/react/hooks/useBeforeUnload","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useAsyncEffect","permalink":"/modern-kit/docs/react/hooks/useAsyncEffect"},"next":{"title":"useBlockMultipleAsyncCalls","permalink":"/modern-kit/docs/react/hooks/useBlockMultipleAsyncCalls"}}');var o=t(6206),i=t(3267),c=t(9340),s=t(4382);const a={},d="useBeforeUnload",l={},u=()=>{const e={div:"div",...(0,i.R)()};return function(e=!0){const n=(0,c.Tn)(e)?e():e;(0,s.useEffect)((()=>{if(!n)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[n])}(),(0,o.jsx)(e.div,{children:"\ud398\uc774\uc9c0\ub97c \ub5a0\ub098\ubcf4\uc138\uc694."})},f=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function p(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",strong:"strong",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.header,{children:(0,o.jsx)(n.h1,{id:"usebeforeunload",children:"useBeforeUnload"})}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.strong,{children:(0,o.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event",children:"beforeunload"})})," \uc774\ubca4\ud2b8\ub97c \ub9ac\uc561\ud2b8\uc5d0\uc11c \uc27d\uac8c \ub2e4\ub8f0 \uc218 \uc788\ub294 \ud6c5\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.code,{children:"beforeunload"})," \uc774\ubca4\ud2b8\ub294 \uc0ac\uc6a9\uc790\uac00 \ud398\uc774\uc9c0\ub97c \ub5a0\ub0a0 \ub54c \ubc1c\uc0dd\ud558\ub294 \uc774\ubca4\ud2b8\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsx)(n.p,{children:"beforeunload \uc774\ubca4\ud2b8\uc758 \uc8fc\uc694 \uc0ac\ub840\ub294 \uc6f9 \ud398\uc774\uc9c0\uc5d0\uc11c \uc0ac\uc6a9\uc790\uc5d0\uac8c \uc2e4\uc81c\ub85c \ud398\uc774\uc9c0\ub97c \ub5a0\ub0a0 \uac83\uc778\uc9c0 \ubb3b\ub294 \ud655\uc778 \ub300\ud654 \uc0c1\uc790\ub97c \ud45c\uc2dc\ud574 \ud655\uc778\ud558\ub294 \uac83\uc785\ub2c8\ub2e4."}),"\n",(0,o.jsx)(n.p,{children:"\uc0ac\uc6a9\uc790\uac00 \ud655\uc778 \ubc84\ud2bc\uc744 \ub204\ub97c \uacbd\uc6b0 \ube0c\ub77c\uc6b0\uc800\ub294 \uc0c8 \ud398\uc774\uc9c0\ub85c \uc774\ub3d9\ud558\uace0 \uadf8\ub807\uc9c0 \uc54a\uc73c\uba74 \ud0d0\uc0c9\uc744 \ucde8\uc18c\ud558\uace0 \ud604\uc7ac \ud398\uc774\uc9c0\uc5d0 \uba38\ubb34\ub985\ub2c8\ub2e4."}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(n.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useBeforeUnload/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(n.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"function useBeforeUnload(enabled?: boolean | (() => boolean) = true): void\n"})}),"\n",(0,o.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useBeforeUnload } from '@modern-kit/react'\n\nconst Example = () => {\n useBeforeUnload();\n return \ud398\uc774\uc9c0\ub97c \ub5a0\ub098\ubcf4\uc138\uc694.
;\n};\n"})}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(u,{})]})}function h(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(p,{...e})}):p(e)}},3267:(e,n,t)=>{t.d(n,{R:()=>c,x:()=>s});var r=t(4382);const o={},i=r.createContext(o);function c(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:c(e.components),r.createElement(i.Provider,{value:n},e.children)}},9340:(e,n,t)=>{function r(e,n,t,r){return new(t||(t=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(n){i(n)}}function s(e){try{a(r.throw(e))}catch(n){i(n)}}function a(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(c,s)}a((r=r.apply(e,n||[])).next())}))}t.d(n,{Et:()=>y,Fr:()=>s,Gp:()=>w,Ol:()=>C,Qd:()=>j,S$:()=>c,Tn:()=>v,Zp:()=>f,dK:()=>d,fl:()=>F,gD:()=>b,i5:()=>h,if:()=>p,l6:()=>k,lQ:()=>E,nS:()=>u,ni:()=>O,oc:()=>a}),"function"==typeof SuppressedError&&SuppressedError;const o={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};const i=(e,n)=>new Promise(((t,r)=>{e.toBlob((e=>{e?t(e):r(new Error(`Failed to create blob with format ${n}`))}),n)}));function c(){return"undefined"==typeof window}function s(){if(c())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}function a(){return!c()}function d(e){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const n=document.createElement("textarea");n.value=e,n.style.opacity="0",document.body.appendChild(n),n.focus(),n.select();try{return document.execCommand("copy"),e}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}finally{document.body.removeChild(n)}}(e)}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}}))}const l=e=>r(void 0,void 0,void 0,(function*(){const n=yield fetch(e);return d(yield n.text())}));function u(e,n){var t;return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator))return l(e);if(!("write"in window.navigator.clipboard))return l(e);if(null!==(t=null==n?void 0:n.toText)&&void 0!==t&&t)return l(e);const c=yield function(e,n="png"){return new Promise(((t,c)=>{const s=new Image;s.onload=()=>r(this,void 0,void 0,(function*(){const e=document.createElement("canvas");e.width=s.width,e.height=s.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(s,0,0);const c=yield i(e,o[n]);t(c)}catch(r){console.error(`Failed to load image. message: ${r.mesaage}`),c(r)}})),s.onerror=()=>{c(new Error("Failed to load image"))},s.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[c.type]:c})]),c}catch(c){throw console.error(`Failed to copy to clipboard. message: ${c.message}`),c}}))}function f(){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function p(){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function h(e,n){return Object.prototype.hasOwnProperty.call(e,n)}const m=(e,n,t)=>{const r=Object.keys(e),o=Object.keys(n);if(r.length!==o.length)return!1;for(let i=0;i{if(e===n)return!0;if(y(e)&&y(n)&&isNaN(e)&&isNaN(n))return!0;if(v(e)&&v(n))return e.toString()===n.toString();if("object"!=typeof e||"object"!=typeof n||null===e||null===n)return!1;if(t.has(e)&&t.get(e)===n)return!0;if(t.set(e,n),e.constructor!==n.constructor)return!1;if(e instanceof Set){if(e.size!==n.size)return!1;const r=[...e],o=[...n];return m(r,o,t)}if(e instanceof Map){if(e.size!==n.size)return!1;for(const[r,o]of e)if(!n.has(r)||!g(o,n.get(r),t))return!1;return!0}return m(e,n,t)};function w(e,n){return g(e,n,new WeakMap)}function v(e){return"function"==typeof e}function b(e){return null==e}function y(e){return"number"==typeof e}function x(e){return!function(e){return Object(e)!==e}(e)}function j(e){return x(e)&&"[object Object]"===Object.prototype.toString.call(e)}function k(e){return e===window}function E(){}function C(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(n){throw new Error(`Failed to parse data: ${n}`)}}function B(e){return Object.keys(e)}const $={days:864e5,hours:36e5,minutes:6e4,seconds:1e3};B($);function F(e,n){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(n)}catch(t){throw new Error(`Failed to remove key "${n}" from ${e}: ${t}`)}}function O(e,n,t){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=v(t)?t():t;r.setItem(n,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${n}" in ${e}: ${r}`)}}}}]);
\ No newline at end of file
diff --git a/assets/js/087cca41.64dcef64.js b/assets/js/087cca41.64dcef64.js
deleted file mode 100644
index 22a4f730f..000000000
--- a/assets/js/087cca41.64dcef64.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[7168],{555:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>u,assets:()=>l,contentTitle:()=>c,default:()=>h,frontMatter:()=>a,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"react/hooks/useLocalStorage","title":"useLocalStorage","description":"React v18\ubd80\ud130 \uc9c0\uc6d0\ud558\ub294 useSyncExternalStore \uc744 \ud65c\uc6a9\ud574 \ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 \ub0b4\uc758 \ud2b9\uc815 key \ub370\uc774\ud130\ub97c \uad6c\ub3c5\ud558\uace0, \uad6c\ub3c5 \uc911\uc778 \ub370\uc774\ud130\uc5d0 \ubcc0\ud654\uac00 \uc788\uc744 \uc2dc \uc774\ub97c \ub3d9\uae30\ud654\ud574\uc8fc\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useLocalStorage.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useLocalStorage","permalink":"/modern-kit/docs/react/hooks/useLocalStorage","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useKeyDown","permalink":"/modern-kit/docs/react/hooks/useKeyDown"},"next":{"title":"useMediaQuery","permalink":"/modern-kit/docs/react/hooks/useMediaQuery"}}');var o=n(6206),s=n(3267),i=n(4027);const a={},c="useLocalStorage",l={},u=()=>{const e={button:"button",div:"div",p:"p",...(0,s.R)()},{state:t,setState:n,removeState:r}=(0,i.Mj)({key:"test",initialValue:"default"});return(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.p,{children:"\uac1c\ubc1c\uc790 \ub3c4\uad6c\uc5d0\uc11c \ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0\ub97c \ud655\uc778\ud574\ubcf4\uc138\uc694!"}),(0,o.jsxs)(e.p,{children:["state: ",t]}),(0,o.jsx)(e.button,{onClick:()=>n("foo"),children:'\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "test"key\uc5d0 "foo"\ub370\uc774\ud130 \uc800\uc7a5'}),(0,o.jsx)(e.button,{onClick:()=>n("bar"),children:'\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "test"key\uc5d0 "bar"\ub370\uc774\ud130 \uc800\uc7a5'}),(0,o.jsx)(e.button,{onClick:()=>r(),children:'\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "test"key \uc81c\uac70'})]})},d=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function f(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",strong:"strong",...(0,s.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"uselocalstorage",children:"useLocalStorage"})}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"React v18"}),"\ubd80\ud130 \uc9c0\uc6d0\ud558\ub294 ",(0,o.jsx)(t.strong,{children:(0,o.jsx)(t.a,{href:"https://react.dev/reference/react/useSyncExternalStore",children:"useSyncExternalStore"})})," \uc744 \ud65c\uc6a9\ud574 \ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 \ub0b4\uc758 \ud2b9\uc815 ",(0,o.jsx)(t.code,{children:"key"})," \ub370\uc774\ud130\ub97c \uad6c\ub3c5\ud558\uace0, \uad6c\ub3c5 \uc911\uc778 \ub370\uc774\ud130\uc5d0 \ubcc0\ud654\uac00 \uc788\uc744 \uc2dc \uc774\ub97c \ub3d9\uae30\ud654\ud574\uc8fc\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:["\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0\uc5d0 \uad6c\ub3c5\ud558\uace0\uc790 \ud558\ub294 ",(0,o.jsx)(t.code,{children:"key"}),"\uac00 \uc5c6\uc744 \uacbd\uc6b0 \ubc18\ud658\ud560 ",(0,o.jsx)(t.code,{children:"initialValue"}),"\ub85c \ucd08\uae30\uac12\uc744 \uc124\uc815\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \ub610\ud55c, ",(0,o.jsx)(t.code,{children:"\uc11c\ubc84 \uc0ac\uc774\ub4dc \ub80c\ub354\ub9c1(SSR)"}),"\uc758 \uacbd\uc6b0 \ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0\uac00 \ub3d9\uc791\ud558\uc9c0 \uc54a\uae30 \ub54c\ubb38\uc5d0 ",(0,o.jsx)(t.code,{children:"initialValue"}),"\uac00 \ubc18\ud658\ub429\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"setState"}),"\ub294 \uac12 \uc790\uccb4\ub97c \ub118\uae38 \uc218 \uc788\uc73c\uba70, \ud568\uc218\ub3c4 \ub118\uae38 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \ud568\uc218\ub85c \ud65c\uc6a9 \uc2dc\uc5d0 \uc778\uc790\ub85c state\ub97c \uac00\uc838\uc62c \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",children:"const { state, setState, removeState } = useLocalStorage({\n key: 'test',\n initialValue: [1, 2],\n});\n\nsetState([1, 2, 3]);\nsetState(state => [...state, 3]);\n"})}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsxs)(t.p,{children:["initialValue\ub97c \ub118\uaca8\uc8fc\uba74 \ub354\uc6b1 ",(0,o.jsx)(t.code,{children:"\uba85\ud655\ud55c \ud0c0\uc785 \ucd94\ub860"}),"\uc774 \uac00\ub2a5\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",children:"const { state, setState } = useLocalStorage({\n key: 'test',\n});\n\nstate; // number[] | null\nsetState(state => {\n state; // number[] | null\n});\n"})}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",children:"const { state, setState } = useLocalStorage({\n key: 'test',\n initialValue: [],\n});\n\nstate; // number[]\nsetState(state => {\n state; // number[]\n});\n"})}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useLocalStorage/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"interface UseLocalStorageWithoutInitialValueProps {\n key: string;\n}\n\ninterface UseLocalStorageWithInitialValueProps {\n key: string;\n initialValue: T | (() => T);\n}\n\ntype UseLocalStorageProps =\n | UseLocalStorageWithoutInitialValueProps\n | UseLocalStorageWithInitialValueProps;\n"})}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",children:"// \ud568\uc218 \uc624\ubc84\ub85c\ub529\nfunction useLocalStorage({\n key,\n initialValue,\n}: UseLocalStorageWithInitialValueProps): {\n state: T;\n setState: Dispatch>;\n removeState: () => void;\n};\n\nfunction useLocalStorage({\n key,\n}: UseLocalStorageWithoutInitialValueProps): {\n state: T | null;\n setState: Dispatch>;\n removeState: () => void;\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useLocalStorage } from '@modern-kit/react';\n\nconst Example = () => {\n const { state, setState, removeState } = useLocalStorage({\n key: 'test',\n initialValue: 'default',\n });\n\n return (\n \n
\uac1c\ubc1c\uc790 \ub3c4\uad6c\uc5d0\uc11c \ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0\ub97c \ud655\uc778\ud574\ubcf4\uc138\uc694!
\n
state: {state}
\n
\n
\n
\n
\n );\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(u,{})]})}function h(e={}){const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(f,{...e})}):f(e)}},4027:(e,t,n)=>{n.d(t,{$$:()=>Me,$I:()=>oe,AE:()=>Xe,BL:()=>J,DX:()=>I,FT:()=>at,Fo:()=>et,Hn:()=>st,I5:()=>Ee,JF:()=>Ve,K:()=>le,K$:()=>Ue,M0:()=>Oe,ML:()=>ne,Mj:()=>ye,Mk:()=>Te,Mo:()=>se,NT:()=>We,QV:()=>He,Ub:()=>xe,Ut:()=>Ce,W7:()=>H,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>_e,Zu:()=>ce,_1:()=>Re,_g:()=>nt,aL:()=>U,aY:()=>Ie,bB:()=>Y,d7:()=>B,eG:()=>it,fN:()=>ae,fm:()=>G,gl:()=>M,hN:()=>A,iD:()=>de,iQ:()=>Pe,jd:()=>ie,lW:()=>lt,oD:()=>K,oo:()=>Le,pL:()=>q,qi:()=>ue,rN:()=>Ne,tD:()=>ke,u8:()=>Z,wY:()=>Be,xV:()=>P,xh:()=>tt,zy:()=>Q});var r=n(6206),o=n(4382),s=n(3683),i=n(5086),a=n(7197),c=(n(1604),n(5938));function l(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function g(){return typeof window>"u"}function m(){return!g()}function w(e){return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const b=e=>f(void 0,0,void 0,(function*(){return w(yield(yield fetch(e)).text())}));function v(e,t){var n;return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return b(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const s=yield p(e,h[t]);n(s)}catch(s){console.error(`Failed to load image. message: ${s.mesaage}`),r(s)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let s=0;s{if(e===t||j(e)&&j(t)&&isNaN(e)&&isNaN(t))return!0;if(k(e)&&k(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return y(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!S(o,t.get(r),n))return!1;return!0}return y(e,t,n)};function x(e,t){return S(e,t,new WeakMap)}function k(e){return"function"==typeof e}function j(e){return"number"==typeof e}function C(e){return!function(e){return Object(e)!==e}(e)}function E(){}function L(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const R=(...e)=>t=>e.forEach((e=>{if(k(e))e(t);else if(null!=e){e.current=t}}));function O(...e){return(0,o.useCallback)(R(...e),e)}const I=o.forwardRef(((e,t)=>{const{children:n}=e,s=l(e,["children"]),i=o.Children.toArray(n),a=i.find(T);if(a){const e=a.props.children,n=i.map((t=>t===a?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(N,Object.assign({},s,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(N,Object.assign({},s,{ref:t,children:n}))}));I.displayName="Slot";const N=o.forwardRef(((e,t)=>{const{children:n}=e,r=l(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...e)=>{s(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),s):"className"===r&&(n[r]=[o,s].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?R(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));N.displayName="SlotClone";const P=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function T(e){return o.isValidElement(e)&&e.type===P}var F="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const M=d(((e,t)=>{var{ratio:n,style:o,as:i="div",asChild:a=!1}=e,c=l(e,["ratio","style","as","asChild"]);const u=a?I:i,d=Object.assign({aspectRatio:n},o),f=a?c.className:s(F,c.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},c))})),V=()=>E,$=()=>!1,W=()=>!0;function Y({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)(V,$,W)?e:t}function D(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const A=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>D()?(0,r.jsx)(r.Fragment,{children:t}):e;function X(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function _(e){const t=X(e);(0,o.useEffect)((()=>()=>t()),[t])}function z(e,t=x){const[n,r]=(0,o.useState)(e),s=X(t);return(0,o.useEffect)((()=>{s(n,e)||r(e)}),[s,n,e]),n}function B(e,t,n){const r=X(e),s=z(n),a=(0,o.useMemo)((()=>(0,i.A)(r,t,s)),[r,t,s]);return _((()=>a.cancel())),a}const U=({children:e,capture:t,wait:n,options:r})=>{const s=o.Children.only(e),i=B(((...e)=>{const n=s?.props;if(n&&k(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(s,{[t]:i})};function J({onIntersectStart:e=E,onIntersectEnd:t=E,enabled:n=!0,calledOnce:r=!1,root:s=null,threshold:i=0,rootMargin:a="0px 0px 0px 0px"}){const c=(0,o.useRef)(0),l=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=X((([n],o)=>{if(!n)return;const s=n.target;n.isIntersecting?(l.current=!0,c.current+=1,e(n)):l.current&&(l.current=!1,c.current+=1,t(n)),r&&c.current>1&&o.unobserve(s)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:i,root:s,rootMargin:a}),u.current.observe(e))}),[n,i,s,a,d])}}const K=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:s,rootMargin:i}=e,a=l(e,["src","threshold","root","rootMargin"]);const{ref:c}=J({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:s,rootMargin:i});return(0,r.jsx)("img",Object.assign({ref:O(t,c)},a))}));K.displayName="LazyImage";const H=(0,o.forwardRef)(((e,t)=>{var{width:n,height:s,fallback:i,className:a,style:c,duration:u="0.2s",onLoad:d}=e,f=l(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,p]=(0,o.useState)(!1),g=!h,m=(0,o.useMemo)((()=>({position:"relative",width:n,height:s})),[n,s]),w=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:g?0:1,transition:`opacity ${u}`},c)),[g,u,c]),b=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),v=a?`lazy-image-wrapper ${a}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:v,style:m,children:[g&&i,(0,r.jsx)(K,Object.assign({ref:t,width:n,height:s,style:w,onLoad:b},f))]})}));H.displayName="FallbackLazyImage";const Q=({condition:e,trueComponent:t,falseComponent:n})=>{const s=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:s?t:n})},Z=({onScrollAction:e,children:t,root:n,threshold:o,enabled:s,triggerPosition:i="after",rootMargin:a="150px 0px"})=>{const{ref:c}=J({onIntersectStart:e,root:n,threshold:o,enabled:s,rootMargin:a});return(0,r.jsxs)(r.Fragment,{children:["before"===i&&(0,r.jsx)("div",{ref:c}),t,"after"===i&&(0,r.jsx)("div",{ref:c})]})},q=d(((e,t)=>{var{children:n,as:s="div",asChild:i=!1}=e,a=l(e,["children","as","asChild"]);const c=i?I:s,{ref:u}=J(a);if(i&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(c,Object.assign({ref:R(t,u)},a,{children:n}))})),G=({items:e=[],itemKey:t,renderItem:n})=>{const s=(0,o.useCallback)(((e,n)=>function(e){return C(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},s(e,t))))})},ee=m()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=X(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),s=(0,o.useMemo)((()=>function(){if(g())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,s,(({target:t})=>{if(!r.current)return;const o=r.current,s=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!s&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:s="div",asChild:i=!1,onPointerDown:a,excludeRefs:c=[]}=e,u=l(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(a,{excludeRefs:c}),f=i?I:s;if(i&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:R(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const se=({itemKey:e,items:t=[],separator:n,renderItem:s,separatorInterval:i=1,includeLastSeparator:a=!1})=>{const c=(0,o.useCallback)((e=>e===t.length-1?a:(e+1)%i==0),[a,i,t.length]);return(0,r.jsx)(G,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[s(e,t),c(t)&&n]})})},ie=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ae=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function ce(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function le(e=!0){const t=k(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!s.current){s.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{s.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),s=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield w(e);return t(n),!0}catch{return t(null),!1}}))),[]),i=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield v(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),a=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:s,copyImage:i,readText:a,readContents:c}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",pe={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},ge=e=>pe[e],me=ge("localStorage"),we=e=>window.localStorage.getItem(e),be=e=>JSON.stringify(e),ve=e=>(me.subscribe(e),()=>{me.unsubscribe(e)});function ye(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=k(n)?n():n,s=(0,o.useSyncExternalStore)(ve,(()=>we(t)),(()=>be(r)));return{state:(0,o.useMemo)((()=>s?L(s):r),[s,r]),setState:(0,o.useCallback)((e=>{try{const n=we(t),o=n?L(n):r,s=k(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(s)),me.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),me.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const Se=(e,t)=>m()?window.matchMedia(e).matches:t??!1;function xe(e,t){const[n,r]=(0,o.useState)(Se(e,t)),s=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",s),n}function ke(){return xe("(prefers-color-scheme: dark)")?"dark":"light"}const je="color-scheme";function Ce({defaultValue:e,key:t=je,shouldSetBodyClass:n=!1}={}){const r=ke(),s=k(e)?e():e,{state:i,setState:a}=ye({key:t,initialValue:s??r}),c=(0,o.useCallback)((()=>{a((e=>"dark"===e?"light":"dark"))}),[a]),l=(0,o.useCallback)((()=>{a("dark")}),[a]),u=(0,o.useCallback)((()=>{a("light")}),[a]),d=(0,o.useCallback)((()=>{a(r)}),[a,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(i),()=>{n&&document.body.classList.remove(i)})),[i,n]),{colorScheme:i,preferredColorScheme:r,setToggleMode:c,setDarkMode:l,setLightMode:u,setPreferredMode:d}}function Ee(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),s=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),i=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:s,reset:i}}function Le({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,s]=(0,o.useState)(t),i=r0,c=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),l=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const i=c(e,t);o&&o({prev:r,next:i}),s(i)}),[n,r,c]),u=(0,o.useCallback)((e=>{l("nextStep",!i,e)}),[i,l]),d=(0,o.useCallback)((e=>{l("prevStep",!a,e)}),[a,l]),f=(0,o.useCallback)(((t,n)=>{const o=k(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void s(t);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),s(t)}),[r,t]);return{currentStep:r,hasNextStep:i,hasPrevStep:a,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Re(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:s,resetStep:i}=Le({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:s,resetIndex:i}}function Oe(e,t,n={}){const[r,s]=(0,o.useState)(e);return[r,B(s,t,n)]}function Ie(e,t={}){const[n,r]=(0,o.useState)(""),[s,i]=Oe("",e,t);return{value:n,debouncedValue:s,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),i(t)}),[i]),onReset:(0,o.useCallback)((()=>{r(""),i("")}),[i])}}function Ne(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Pe({onFocus:e=E,onBlur:t=E}={}){const[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(null),i=X((t=>{r(!0),e(t)})),a=X((e=>{r(!1),t(e)})),c=(0,o.useCallback)((()=>{s.current&&(s.current.focus(),r(!0))}),[]);return ne(s,"focus",i),ne(s,"blur",a),{ref:s,isFocus:n,setFocus:c}}function Te({onEnter:e=E,onLeave:t=E}={}){const[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(null),i=X((t=>{r(!0),e(t)})),a=X((e=>{r(!1),t(e)}));return ne(s,"mouseenter",i),ne(s,"mouseleave",a),{ref:s,isHovered:n}}const Fe=e=>{var t;return j(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function Me(e,t){const n=(0,o.useRef)(),r=X(e),{delay:s,enabled:i}=Fe(t),a=(0,o.useCallback)((()=>{n.current=window.setInterval(r,s)}),[r,s]),c=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{c(),a()}),[c,a]);return(0,o.useEffect)((()=>{if(!(s<0)&&i)return a(),()=>c()}),[c,a,i,s]),{set:a,reset:l,clear:c}}function Ve({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),s=X((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];k(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",s),()=>t.removeEventListener("keydown",s)}),[e,s]),r}const $e={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function We(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)($e),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:s,clientY:i,pageX:a,pageY:c}=t;let l=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();l=s-t.left,u=i-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:s,clientY:i,pageX:a,pageY:c,elementRelativeX:l,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const Ye=()=>navigator.onLine,De=()=>!0,Ae=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function Xe({onlineAction:e=E,offlineAction:t=E}={}){const n=X((n=>Ae(n,e,t)));return(0,o.useSyncExternalStore)(n,Ye,De)}function _e(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const ze={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Be(e=E){const[t,n]=(0,o.useState)(ze),r=(0,o.useRef)(null),s=X((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(s);return t.observe(e),()=>{t.unobserve(e)}}),[s]),{ref:r,contentRect:t}}function Ue({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),s=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>s())),[e,r,s]),{ref:t,lock:r,unlock:s}}const Je=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,Ke=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:s=0,alignY:i="start",alignX:a="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+s+Je(window.innerHeight,r.height,i),left:r.left+window.scrollX+o+Je(window.innerWidth,r.width,a)};const c=e.getBoundingClientRect();return{top:r.top-c.top+e.scrollTop+s+Je(c.height,r.height,i),left:r.left-c.left+e.scrollLeft+o+Je(c.width,r.width,a)}};function He(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:s,top:i}=Ke(r,t,n);r.scrollTo({top:i,left:s,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Qe=ge("sessionStorage"),Ze=e=>window.sessionStorage.getItem(e),qe=e=>JSON.stringify(e),Ge=e=>(Qe.subscribe(e),()=>{Qe.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=k(n)?n():n,s=(0,o.useSyncExternalStore)(Ge,(()=>Ze(t)),(()=>qe(r)));return{state:(0,o.useMemo)((()=>s?L(s):r),[s,r]),setState:(0,o.useCallback)((e=>{try{const n=Ze(t),o=n?L(n):r,s=k(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(s)),Qe.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Qe.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:s}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[i,a]=(0,o.useState)(n),c=(0,o.useCallback)((e=>{a((t=>{const n=k(e)?e(t):e;return r&&s&&function(e,t,n){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=k(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,s,n),n}))}),[r,s]),l=(0,o.useCallback)((()=>{r&&s&&function(e,t){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,s),a(null)}),[r,s]);return Object.assign({state:i,setState:c,clearState:l},Le(e))}function nt(e,t,n={}){const r=X(e),s=z(n),i=(0,o.useMemo)((()=>(0,a.A)(r,t,s)),[r,t,s]);return _((()=>i.cancel())),i}const rt=e=>{var t;return j(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=X(e),{delay:s,enabled:i}=rt(t),a=(0,o.useCallback)((()=>{n.current=setTimeout(r,s)}),[r,s]),c=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{c(),a()}),[c,a]);return(0,o.useEffect)((()=>{if(!(s<0)&&i)return a(),()=>c()}),[a,c,s,i]),{set:a,reset:l,clear:c}}function st(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function it(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new c.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function at({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const ct={width:null,height:null};function lt({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>g()?ct:{width:window.innerWidth,height:window.innerHeight})),r=B(n,e),s=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",s),t}function ut(e,t,n){const{delay:r,enabled:s}=rt(t),{set:i,reset:a,clear:c}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!s||a()}),[r,s,a,...n]),{set:i,reset:a,clear:c}}}}]);
\ No newline at end of file
diff --git a/assets/js/087cca41.8c16c0a3.js b/assets/js/087cca41.8c16c0a3.js
new file mode 100644
index 000000000..282f439d8
--- /dev/null
+++ b/assets/js/087cca41.8c16c0a3.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[7168],{555:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>u,assets:()=>l,contentTitle:()=>c,default:()=>p,frontMatter:()=>s,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"react/hooks/useLocalStorage","title":"useLocalStorage","description":"React v18\ubd80\ud130 \uc9c0\uc6d0\ud558\ub294 useSyncExternalStore \uc744 \ud65c\uc6a9\ud574 \ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 \ub0b4\uc758 \ud2b9\uc815 key \ub370\uc774\ud130\ub97c \uad6c\ub3c5\ud558\uace0, \uad6c\ub3c5 \uc911\uc778 \ub370\uc774\ud130\uc5d0 \ubcc0\ud654\uac00 \uc788\uc744 \uc2dc \uc774\ub97c \ub3d9\uae30\ud654\ud574\uc8fc\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useLocalStorage.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useLocalStorage","permalink":"/modern-kit/docs/react/hooks/useLocalStorage","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useKeyDown","permalink":"/modern-kit/docs/react/hooks/useKeyDown"},"next":{"title":"useMediaQuery","permalink":"/modern-kit/docs/react/hooks/useMediaQuery"}}');var o=n(6206),i=n(3267),a=n(8211);const s={},c="useLocalStorage",l={},u=()=>{const e={button:"button",div:"div",p:"p",...(0,i.R)()},{state:t,setState:n,removeState:r}=(0,a.M)({key:"test",initialValue:"default"});return(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.p,{children:"\uac1c\ubc1c\uc790 \ub3c4\uad6c\uc5d0\uc11c \ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0\ub97c \ud655\uc778\ud574\ubcf4\uc138\uc694!"}),(0,o.jsxs)(e.p,{children:["state: ",t]}),(0,o.jsx)(e.button,{onClick:()=>n("foo"),children:'\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "test"key\uc5d0 "foo"\ub370\uc774\ud130 \uc800\uc7a5'}),(0,o.jsx)(e.button,{onClick:()=>n("bar"),children:'\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "test"key\uc5d0 "bar"\ub370\uc774\ud130 \uc800\uc7a5'}),(0,o.jsx)(e.button,{onClick:()=>r(),children:'\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "test"key \uc81c\uac70'})]})},d=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function h(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",strong:"strong",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"uselocalstorage",children:"useLocalStorage"})}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"React v18"}),"\ubd80\ud130 \uc9c0\uc6d0\ud558\ub294 ",(0,o.jsx)(t.strong,{children:(0,o.jsx)(t.a,{href:"https://react.dev/reference/react/useSyncExternalStore",children:"useSyncExternalStore"})})," \uc744 \ud65c\uc6a9\ud574 \ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 \ub0b4\uc758 \ud2b9\uc815 ",(0,o.jsx)(t.code,{children:"key"})," \ub370\uc774\ud130\ub97c \uad6c\ub3c5\ud558\uace0, \uad6c\ub3c5 \uc911\uc778 \ub370\uc774\ud130\uc5d0 \ubcc0\ud654\uac00 \uc788\uc744 \uc2dc \uc774\ub97c \ub3d9\uae30\ud654\ud574\uc8fc\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:["\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0\uc5d0 \uad6c\ub3c5\ud558\uace0\uc790 \ud558\ub294 ",(0,o.jsx)(t.code,{children:"key"}),"\uac00 \uc5c6\uc744 \uacbd\uc6b0 \ubc18\ud658\ud560 ",(0,o.jsx)(t.code,{children:"initialValue"}),"\ub85c \ucd08\uae30\uac12\uc744 \uc124\uc815\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \ub610\ud55c, ",(0,o.jsx)(t.code,{children:"\uc11c\ubc84 \uc0ac\uc774\ub4dc \ub80c\ub354\ub9c1(SSR)"}),"\uc758 \uacbd\uc6b0 \ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0\uac00 \ub3d9\uc791\ud558\uc9c0 \uc54a\uae30 \ub54c\ubb38\uc5d0 ",(0,o.jsx)(t.code,{children:"initialValue"}),"\uac00 \ubc18\ud658\ub429\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"setState"}),"\ub294 \uac12 \uc790\uccb4\ub97c \ub118\uae38 \uc218 \uc788\uc73c\uba70, \ud568\uc218\ub3c4 \ub118\uae38 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \ud568\uc218\ub85c \ud65c\uc6a9 \uc2dc\uc5d0 \uc778\uc790\ub85c state\ub97c \uac00\uc838\uc62c \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",children:"const { state, setState, removeState } = useLocalStorage({\n key: 'test',\n initialValue: [1, 2],\n});\n\nsetState([1, 2, 3]);\nsetState(state => [...state, 3]);\n"})}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsxs)(t.p,{children:["initialValue\ub97c \ub118\uaca8\uc8fc\uba74 \ub354\uc6b1 ",(0,o.jsx)(t.code,{children:"\uba85\ud655\ud55c \ud0c0\uc785 \ucd94\ub860"}),"\uc774 \uac00\ub2a5\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",children:"const { state, setState } = useLocalStorage({\n key: 'test',\n});\n\nstate; // number[] | null\nsetState(state => {\n state; // number[] | null\n});\n"})}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",children:"const { state, setState } = useLocalStorage({\n key: 'test',\n initialValue: [],\n});\n\nstate; // number[]\nsetState(state => {\n state; // number[]\n});\n"})}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useLocalStorage/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"interface UseLocalStorageWithoutInitialValueProps {\n key: string;\n}\n\ninterface UseLocalStorageWithInitialValueProps {\n key: string;\n initialValue: T | (() => T);\n}\n\ntype UseLocalStorageProps =\n | UseLocalStorageWithoutInitialValueProps\n | UseLocalStorageWithInitialValueProps;\n"})}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",children:"// \ud568\uc218 \uc624\ubc84\ub85c\ub529\nfunction useLocalStorage({\n key,\n initialValue,\n}: UseLocalStorageWithInitialValueProps): {\n state: T;\n setState: Dispatch>;\n removeState: () => void;\n};\n\nfunction useLocalStorage({\n key,\n}: UseLocalStorageWithoutInitialValueProps): {\n state: T | null;\n setState: Dispatch>;\n removeState: () => void;\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useLocalStorage } from '@modern-kit/react';\n\nconst Example = () => {\n const { state, setState, removeState } = useLocalStorage({\n key: 'test',\n initialValue: 'default',\n });\n\n return (\n \n
\uac1c\ubc1c\uc790 \ub3c4\uad6c\uc5d0\uc11c \ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0\ub97c \ud655\uc778\ud574\ubcf4\uc138\uc694!
\n
state: {state}
\n
\n
\n
\n
\n );\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(u,{})]})}function p(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(h,{...e})}):h(e)}},3267:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>s});var r=n(4382);const o={},i=r.createContext(o);function a(e){const t=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function s(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:a(e.components),r.createElement(i.Provider,{value:t},e.children)}},8211:(e,t,n)=>{n.d(t,{M:()=>u});var r=n(9340),o=n(4382);const i="modern-kit-local-storage",a={key:i,subscribe:e=>{window.addEventListener(i,e)},unsubscribe:e=>{window.removeEventListener(i,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(i))}},s=e=>window.localStorage.getItem(e),c=e=>JSON.stringify(e),l=e=>(a.subscribe(e),()=>{a.unsubscribe(e)});function u(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,i=(0,r.Tn)(n)?n():n,u=(0,o.useSyncExternalStore)(l,(()=>s(t)),(()=>c(i)));return{state:(0,o.useMemo)((()=>u?(0,r.Ol)(u):i),[u,i]),setState:(0,o.useCallback)((e=>{try{const n=s(t),o=n?(0,r.Ol)(n):i,c=(0,r.Tn)(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(c)),a.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,i]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),a.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}},9340:(e,t,n)=>{function r(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(t){i(t)}}function s(e){try{c(r.throw(e))}catch(t){i(t)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))}n.d(t,{Et:()=>x,Fr:()=>s,Gp:()=>y,Ol:()=>E,Qd:()=>S,S$:()=>a,Tn:()=>w,Zp:()=>h,dK:()=>l,fl:()=>T,gD:()=>b,i5:()=>f,if:()=>p,l6:()=>k,lQ:()=>j,nS:()=>d,ni:()=>$,oc:()=>c}),"function"==typeof SuppressedError&&SuppressedError;const o={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};const i=(e,t)=>new Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function a(){return"undefined"==typeof window}function s(){if(a())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}function c(){return!a()}function l(e){return r(this,void 0,void 0,(function*(){if(!c())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const u=e=>r(void 0,void 0,void 0,(function*(){const t=yield fetch(e);return l(yield t.text())}));function d(e,t){var n;return r(this,void 0,void 0,(function*(){if(!c())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator))return u(e);if(!("write"in window.navigator.clipboard))return u(e);if(null!==(n=null==t?void 0:t.toText)&&void 0!==n&&n)return u(e);const a=yield function(e,t="png"){return new Promise(((n,a)=>{const s=new Image;s.onload=()=>r(this,void 0,void 0,(function*(){const e=document.createElement("canvas");e.width=s.width,e.height=s.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(s,0,0);const a=yield i(e,o[t]);n(a)}catch(r){console.error(`Failed to load image. message: ${r.mesaage}`),a(r)}})),s.onerror=()=>{a(new Error("Failed to load image"))},s.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[a.type]:a})]),a}catch(a){throw console.error(`Failed to copy to clipboard. message: ${a.message}`),a}}))}function h(){return r(this,void 0,void 0,(function*(){if(!c())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function p(){return r(this,void 0,void 0,(function*(){if(!c())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function f(e,t){return Object.prototype.hasOwnProperty.call(e,t)}const g=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i=0;i{if(e===t)return!0;if(x(e)&&x(t)&&isNaN(e)&&isNaN(t))return!0;if(w(e)&&w(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return g(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!m(o,t.get(r),n))return!1;return!0}return g(e,t,n)};function y(e,t){return m(e,t,new WeakMap)}function w(e){return"function"==typeof e}function b(e){return null==e}function x(e){return"number"==typeof e}function v(e){return!function(e){return Object(e)!==e}(e)}function S(e){return v(e)&&"[object Object]"===Object.prototype.toString.call(e)}function k(e){return e===window}function j(){}function E(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}function C(e){return Object.keys(e)}const L={days:864e5,hours:36e5,minutes:6e4,seconds:1e3};C(L);function T(e,t){if(!c())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}function $(e,t,n){if(!c())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=w(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}}}]);
\ No newline at end of file
diff --git a/assets/js/0ed4549e.bb34a41a.js b/assets/js/0ed4549e.bb34a41a.js
deleted file mode 100644
index ba87e8a32..000000000
--- a/assets/js/0ed4549e.bb34a41a.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[9647],{8588:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>u,assets:()=>l,contentTitle:()=>c,default:()=>h,frontMatter:()=>a,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"react/hooks/useSessionStorage","title":"useSessionStorage","description":"React v18\ubd80\ud130 \uc9c0\uc6d0\ud558\ub294 useSyncExternalStore \uc744 \ud65c\uc6a9\ud574 \uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 \ub0b4\uc758 \ud2b9\uc815 key \ub370\uc774\ud130\ub97c \uad6c\ub3c5\ud558\uace0, \uad6c\ub3c5 \uc911\uc778 \ub370\uc774\ud130\uc5d0 \ubcc0\ud654\uac00 \uc788\uc744 \uc2dc \uc774\ub97c \ub3d9\uae30\ud654\ud574\uc8fc\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useSessionStorage.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useSessionStorage","permalink":"/modern-kit/docs/react/hooks/useSessionStorage","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useScrollTo","permalink":"/modern-kit/docs/react/hooks/useScrollTo"},"next":{"title":"useStep","permalink":"/modern-kit/docs/react/hooks/useStep"}}');var o=n(6206),s=n(3267),i=n(4027);const a={},c="useSessionStorage",l={},u=()=>{const e={button:"button",div:"div",p:"p",...(0,s.R)()},{state:t,setState:n,removeState:r}=(0,i.Fo)({key:"test",initialValue:"default"});return(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.p,{children:"\uac1c\ubc1c\uc790 \ub3c4\uad6c\uc5d0\uc11c \uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0\ub97c \ud655\uc778\ud574\ubcf4\uc138\uc694!"}),(0,o.jsxs)(e.p,{children:["state: ",t]}),(0,o.jsx)(e.button,{onClick:()=>n("foo"),children:'\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "test"key\uc5d0 "foo"\ub370\uc774\ud130 \uc800\uc7a5'}),(0,o.jsx)(e.button,{onClick:()=>n("bar"),children:'\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "test"key\uc5d0 "bar"\ub370\uc774\ud130 \uc800\uc7a5'}),(0,o.jsx)(e.button,{onClick:()=>r(),children:'\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "test"key \uc81c\uac70'})]})},d=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function f(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",strong:"strong",...(0,s.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"usesessionstorage",children:"useSessionStorage"})}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"React v18"}),"\ubd80\ud130 \uc9c0\uc6d0\ud558\ub294 ",(0,o.jsx)(t.strong,{children:(0,o.jsx)(t.a,{href:"https://react.dev/reference/react/useSyncExternalStore",children:"useSyncExternalStore"})})," \uc744 \ud65c\uc6a9\ud574 \uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 \ub0b4\uc758 \ud2b9\uc815 ",(0,o.jsx)(t.code,{children:"key"})," \ub370\uc774\ud130\ub97c \uad6c\ub3c5\ud558\uace0, \uad6c\ub3c5 \uc911\uc778 \ub370\uc774\ud130\uc5d0 \ubcc0\ud654\uac00 \uc788\uc744 \uc2dc \uc774\ub97c \ub3d9\uae30\ud654\ud574\uc8fc\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:["\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0\uc5d0 \uad6c\ub3c5\ud558\uace0\uc790 \ud558\ub294 ",(0,o.jsx)(t.code,{children:"key"}),"\uac00 \uc5c6\uc744 \uacbd\uc6b0 \ubc18\ud658\ud560 ",(0,o.jsx)(t.code,{children:"initialValue"}),"\ub85c \ucd08\uae30\uac12\uc744 \uc124\uc815\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \ub610\ud55c, ",(0,o.jsx)(t.code,{children:"\uc11c\ubc84 \uc0ac\uc774\ub4dc \ub80c\ub354\ub9c1(SSR)"}),"\uc758 \uacbd\uc6b0 \uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0\uac00 \ub3d9\uc791\ud558\uc9c0 \uc54a\uae30 \ub54c\ubb38\uc5d0 ",(0,o.jsx)(t.code,{children:"initialValue"}),"\uac00 \ubc18\ud658\ub429\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"setState"}),"\ub294 \uac12 \uc790\uccb4\ub97c \ub118\uae38 \uc218 \uc788\uc73c\uba70, \ud568\uc218\ub3c4 \ub118\uae38 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \ud568\uc218\ub85c \ud65c\uc6a9 \uc2dc\uc5d0 \uc778\uc790\ub85c state\ub97c \uac00\uc838\uc62c \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",children:"const { state, setState, removeState } = useSessionStorage({\n key: 'test',\n initialValue: [1, 2],\n});\n\nsetState([1, 2, 3]);\nsetState(state => [...state, 3]);\n"})}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsxs)(t.p,{children:["initialValue\ub97c \ub118\uaca8\uc8fc\uba74 \ub354\uc6b1 ",(0,o.jsx)(t.code,{children:"\uba85\ud655\ud55c \ud0c0\uc785 \ucd94\ub860"}),"\uc774 \uac00\ub2a5\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",children:"const { state, setState } = useSessionStorage({\n key: 'test',\n});\n\nstate; // number[] | null\nsetState(state => {\n state; // number[] | null\n});\n"})}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",children:"const { state, setState } = useSessionStorage({\n key: 'test',\n initialValue: [],\n});\n\nstate; // number[]\nsetState(state => {\n state; // number[]\n});\n"})}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useSessionStorage/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"interface UseSessionStorageWithoutInitialValueProps {\n key: string;\n}\n\ninterface UseSessionStorageWithInitialValueProps {\n key: string;\n initialValue: T | (() => T);\n}\n\ntype UseSessionStorageProps =\n | UseSessionStorageWithoutInitialValueProps\n | UseSessionStorageWithInitialValueProps;\n"})}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",children:"// \ud568\uc218 \uc624\ubc84\ub85c\ub529\nfunction useSessionStorage({\n key,\n initialValue,\n}: UseSessionStorageWithInitialValueProps): {\n state: T;\n setState: Dispatch>;\n removeState: () => void;\n};\n\nfunction useSessionStorage({\n key,\n}: UseSessionStorageWithoutInitialValueProps): {\n state: T | null;\n setState: Dispatch>;\n removeState: () => void;\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useSessionStorage } from '@modern-kit/react';\n\nconst Example = () => {\n const { state, setState, removeState } = useSessionStorage({\n key: 'test',\n initialValue: 'default',\n });\n\n return (\n \n
\uac1c\ubc1c\uc790 \ub3c4\uad6c\uc5d0\uc11c \uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0\ub97c \ud655\uc778\ud574\ubcf4\uc138\uc694!
\n
state: {state}
\n
\n
\n
\n
\n );\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(u,{})]})}function h(e={}){const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(f,{...e})}):f(e)}},4027:(e,t,n)=>{n.d(t,{$$:()=>Me,$I:()=>oe,AE:()=>Xe,BL:()=>J,DX:()=>N,FT:()=>at,Fo:()=>et,Hn:()=>st,I5:()=>Ee,JF:()=>Ve,K:()=>le,K$:()=>Ue,M0:()=>Ie,ML:()=>ne,Mj:()=>ye,Mk:()=>Pe,Mo:()=>se,NT:()=>We,QV:()=>Ke,Ub:()=>xe,Ut:()=>Ce,W7:()=>K,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>_e,Zu:()=>ce,_1:()=>Oe,_g:()=>nt,aL:()=>U,aY:()=>Ne,bB:()=>Y,d7:()=>B,eG:()=>it,fN:()=>ae,fm:()=>G,gl:()=>M,hN:()=>D,iD:()=>de,iQ:()=>Fe,jd:()=>ie,lW:()=>lt,oD:()=>H,oo:()=>Re,pL:()=>q,qi:()=>ue,rN:()=>Te,tD:()=>ke,u8:()=>Q,wY:()=>Be,xV:()=>F,xh:()=>tt,zy:()=>Z});var r=n(6206),o=n(4382),s=n(3683),i=n(5086),a=n(7197),c=(n(1604),n(5938));function l(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function g(){return typeof window>"u"}function m(){return!g()}function b(e){return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const w=e=>f(void 0,0,void 0,(function*(){return b(yield(yield fetch(e)).text())}));function v(e,t){var n;return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return w(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const s=yield p(e,h[t]);n(s)}catch(s){console.error(`Failed to load image. message: ${s.mesaage}`),r(s)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let s=0;s{if(e===t||j(e)&&j(t)&&isNaN(e)&&isNaN(t))return!0;if(k(e)&&k(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return y(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!S(o,t.get(r),n))return!1;return!0}return y(e,t,n)};function x(e,t){return S(e,t,new WeakMap)}function k(e){return"function"==typeof e}function j(e){return"number"==typeof e}function C(e){return!function(e){return Object(e)!==e}(e)}function E(){}function R(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const O=(...e)=>t=>e.forEach((e=>{if(k(e))e(t);else if(null!=e){e.current=t}}));function I(...e){return(0,o.useCallback)(O(...e),e)}const N=o.forwardRef(((e,t)=>{const{children:n}=e,s=l(e,["children"]),i=o.Children.toArray(n),a=i.find(P);if(a){const e=a.props.children,n=i.map((t=>t===a?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(T,Object.assign({},s,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(T,Object.assign({},s,{ref:t,children:n}))}));N.displayName="Slot";const T=o.forwardRef(((e,t)=>{const{children:n}=e,r=l(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...e)=>{s(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),s):"className"===r&&(n[r]=[o,s].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?O(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));T.displayName="SlotClone";const F=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function P(e){return o.isValidElement(e)&&e.type===F}var L="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const M=d(((e,t)=>{var{ratio:n,style:o,as:i="div",asChild:a=!1}=e,c=l(e,["ratio","style","as","asChild"]);const u=a?N:i,d=Object.assign({aspectRatio:n},o),f=a?c.className:s(L,c.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},c))})),V=()=>E,$=()=>!1,W=()=>!0;function Y({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)(V,$,W)?e:t}function A(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const D=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>A()?(0,r.jsx)(r.Fragment,{children:t}):e;function X(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function _(e){const t=X(e);(0,o.useEffect)((()=>()=>t()),[t])}function z(e,t=x){const[n,r]=(0,o.useState)(e),s=X(t);return(0,o.useEffect)((()=>{s(n,e)||r(e)}),[s,n,e]),n}function B(e,t,n){const r=X(e),s=z(n),a=(0,o.useMemo)((()=>(0,i.A)(r,t,s)),[r,t,s]);return _((()=>a.cancel())),a}const U=({children:e,capture:t,wait:n,options:r})=>{const s=o.Children.only(e),i=B(((...e)=>{const n=s?.props;if(n&&k(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(s,{[t]:i})};function J({onIntersectStart:e=E,onIntersectEnd:t=E,enabled:n=!0,calledOnce:r=!1,root:s=null,threshold:i=0,rootMargin:a="0px 0px 0px 0px"}){const c=(0,o.useRef)(0),l=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=X((([n],o)=>{if(!n)return;const s=n.target;n.isIntersecting?(l.current=!0,c.current+=1,e(n)):l.current&&(l.current=!1,c.current+=1,t(n)),r&&c.current>1&&o.unobserve(s)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:i,root:s,rootMargin:a}),u.current.observe(e))}),[n,i,s,a,d])}}const H=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:s,rootMargin:i}=e,a=l(e,["src","threshold","root","rootMargin"]);const{ref:c}=J({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:s,rootMargin:i});return(0,r.jsx)("img",Object.assign({ref:I(t,c)},a))}));H.displayName="LazyImage";const K=(0,o.forwardRef)(((e,t)=>{var{width:n,height:s,fallback:i,className:a,style:c,duration:u="0.2s",onLoad:d}=e,f=l(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,p]=(0,o.useState)(!1),g=!h,m=(0,o.useMemo)((()=>({position:"relative",width:n,height:s})),[n,s]),b=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:g?0:1,transition:`opacity ${u}`},c)),[g,u,c]),w=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),v=a?`lazy-image-wrapper ${a}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:v,style:m,children:[g&&i,(0,r.jsx)(H,Object.assign({ref:t,width:n,height:s,style:b,onLoad:w},f))]})}));K.displayName="FallbackLazyImage";const Z=({condition:e,trueComponent:t,falseComponent:n})=>{const s=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:s?t:n})},Q=({onScrollAction:e,children:t,root:n,threshold:o,enabled:s,triggerPosition:i="after",rootMargin:a="150px 0px"})=>{const{ref:c}=J({onIntersectStart:e,root:n,threshold:o,enabled:s,rootMargin:a});return(0,r.jsxs)(r.Fragment,{children:["before"===i&&(0,r.jsx)("div",{ref:c}),t,"after"===i&&(0,r.jsx)("div",{ref:c})]})},q=d(((e,t)=>{var{children:n,as:s="div",asChild:i=!1}=e,a=l(e,["children","as","asChild"]);const c=i?N:s,{ref:u}=J(a);if(i&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(c,Object.assign({ref:O(t,u)},a,{children:n}))})),G=({items:e=[],itemKey:t,renderItem:n})=>{const s=(0,o.useCallback)(((e,n)=>function(e){return C(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},s(e,t))))})},ee=m()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=X(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),s=(0,o.useMemo)((()=>function(){if(g())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,s,(({target:t})=>{if(!r.current)return;const o=r.current,s=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!s&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:s="div",asChild:i=!1,onPointerDown:a,excludeRefs:c=[]}=e,u=l(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(a,{excludeRefs:c}),f=i?N:s;if(i&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:O(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const se=({itemKey:e,items:t=[],separator:n,renderItem:s,separatorInterval:i=1,includeLastSeparator:a=!1})=>{const c=(0,o.useCallback)((e=>e===t.length-1?a:(e+1)%i==0),[a,i,t.length]);return(0,r.jsx)(G,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[s(e,t),c(t)&&n]})})},ie=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ae=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function ce(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function le(e=!0){const t=k(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!s.current){s.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{s.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),s=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield b(e);return t(n),!0}catch{return t(null),!1}}))),[]),i=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield v(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),a=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:s,copyImage:i,readText:a,readContents:c}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",pe={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},ge=e=>pe[e],me=ge("localStorage"),be=e=>window.localStorage.getItem(e),we=e=>JSON.stringify(e),ve=e=>(me.subscribe(e),()=>{me.unsubscribe(e)});function ye(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=k(n)?n():n,s=(0,o.useSyncExternalStore)(ve,(()=>be(t)),(()=>we(r)));return{state:(0,o.useMemo)((()=>s?R(s):r),[s,r]),setState:(0,o.useCallback)((e=>{try{const n=be(t),o=n?R(n):r,s=k(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(s)),me.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),me.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const Se=(e,t)=>m()?window.matchMedia(e).matches:t??!1;function xe(e,t){const[n,r]=(0,o.useState)(Se(e,t)),s=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",s),n}function ke(){return xe("(prefers-color-scheme: dark)")?"dark":"light"}const je="color-scheme";function Ce({defaultValue:e,key:t=je,shouldSetBodyClass:n=!1}={}){const r=ke(),s=k(e)?e():e,{state:i,setState:a}=ye({key:t,initialValue:s??r}),c=(0,o.useCallback)((()=>{a((e=>"dark"===e?"light":"dark"))}),[a]),l=(0,o.useCallback)((()=>{a("dark")}),[a]),u=(0,o.useCallback)((()=>{a("light")}),[a]),d=(0,o.useCallback)((()=>{a(r)}),[a,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(i),()=>{n&&document.body.classList.remove(i)})),[i,n]),{colorScheme:i,preferredColorScheme:r,setToggleMode:c,setDarkMode:l,setLightMode:u,setPreferredMode:d}}function Ee(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),s=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),i=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:s,reset:i}}function Re({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,s]=(0,o.useState)(t),i=r0,c=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),l=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const i=c(e,t);o&&o({prev:r,next:i}),s(i)}),[n,r,c]),u=(0,o.useCallback)((e=>{l("nextStep",!i,e)}),[i,l]),d=(0,o.useCallback)((e=>{l("prevStep",!a,e)}),[a,l]),f=(0,o.useCallback)(((t,n)=>{const o=k(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void s(t);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),s(t)}),[r,t]);return{currentStep:r,hasNextStep:i,hasPrevStep:a,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Oe(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:s,resetStep:i}=Re({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:s,resetIndex:i}}function Ie(e,t,n={}){const[r,s]=(0,o.useState)(e);return[r,B(s,t,n)]}function Ne(e,t={}){const[n,r]=(0,o.useState)(""),[s,i]=Ie("",e,t);return{value:n,debouncedValue:s,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),i(t)}),[i]),onReset:(0,o.useCallback)((()=>{r(""),i("")}),[i])}}function Te(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Fe({onFocus:e=E,onBlur:t=E}={}){const[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(null),i=X((t=>{r(!0),e(t)})),a=X((e=>{r(!1),t(e)})),c=(0,o.useCallback)((()=>{s.current&&(s.current.focus(),r(!0))}),[]);return ne(s,"focus",i),ne(s,"blur",a),{ref:s,isFocus:n,setFocus:c}}function Pe({onEnter:e=E,onLeave:t=E}={}){const[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(null),i=X((t=>{r(!0),e(t)})),a=X((e=>{r(!1),t(e)}));return ne(s,"mouseenter",i),ne(s,"mouseleave",a),{ref:s,isHovered:n}}const Le=e=>{var t;return j(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function Me(e,t){const n=(0,o.useRef)(),r=X(e),{delay:s,enabled:i}=Le(t),a=(0,o.useCallback)((()=>{n.current=window.setInterval(r,s)}),[r,s]),c=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{c(),a()}),[c,a]);return(0,o.useEffect)((()=>{if(!(s<0)&&i)return a(),()=>c()}),[c,a,i,s]),{set:a,reset:l,clear:c}}function Ve({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),s=X((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];k(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",s),()=>t.removeEventListener("keydown",s)}),[e,s]),r}const $e={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function We(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)($e),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:s,clientY:i,pageX:a,pageY:c}=t;let l=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();l=s-t.left,u=i-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:s,clientY:i,pageX:a,pageY:c,elementRelativeX:l,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const Ye=()=>navigator.onLine,Ae=()=>!0,De=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function Xe({onlineAction:e=E,offlineAction:t=E}={}){const n=X((n=>De(n,e,t)));return(0,o.useSyncExternalStore)(n,Ye,Ae)}function _e(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const ze={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Be(e=E){const[t,n]=(0,o.useState)(ze),r=(0,o.useRef)(null),s=X((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(s);return t.observe(e),()=>{t.unobserve(e)}}),[s]),{ref:r,contentRect:t}}function Ue({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),s=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>s())),[e,r,s]),{ref:t,lock:r,unlock:s}}const Je=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,He=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:s=0,alignY:i="start",alignX:a="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+s+Je(window.innerHeight,r.height,i),left:r.left+window.scrollX+o+Je(window.innerWidth,r.width,a)};const c=e.getBoundingClientRect();return{top:r.top-c.top+e.scrollTop+s+Je(c.height,r.height,i),left:r.left-c.left+e.scrollLeft+o+Je(c.width,r.width,a)}};function Ke(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:s,top:i}=He(r,t,n);r.scrollTo({top:i,left:s,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ze=ge("sessionStorage"),Qe=e=>window.sessionStorage.getItem(e),qe=e=>JSON.stringify(e),Ge=e=>(Ze.subscribe(e),()=>{Ze.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=k(n)?n():n,s=(0,o.useSyncExternalStore)(Ge,(()=>Qe(t)),(()=>qe(r)));return{state:(0,o.useMemo)((()=>s?R(s):r),[s,r]),setState:(0,o.useCallback)((e=>{try{const n=Qe(t),o=n?R(n):r,s=k(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(s)),Ze.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ze.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:s}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[i,a]=(0,o.useState)(n),c=(0,o.useCallback)((e=>{a((t=>{const n=k(e)?e(t):e;return r&&s&&function(e,t,n){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=k(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,s,n),n}))}),[r,s]),l=(0,o.useCallback)((()=>{r&&s&&function(e,t){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,s),a(null)}),[r,s]);return Object.assign({state:i,setState:c,clearState:l},Re(e))}function nt(e,t,n={}){const r=X(e),s=z(n),i=(0,o.useMemo)((()=>(0,a.A)(r,t,s)),[r,t,s]);return _((()=>i.cancel())),i}const rt=e=>{var t;return j(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=X(e),{delay:s,enabled:i}=rt(t),a=(0,o.useCallback)((()=>{n.current=setTimeout(r,s)}),[r,s]),c=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{c(),a()}),[c,a]);return(0,o.useEffect)((()=>{if(!(s<0)&&i)return a(),()=>c()}),[a,c,s,i]),{set:a,reset:l,clear:c}}function st(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function it(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new c.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function at({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const ct={width:null,height:null};function lt({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>g()?ct:{width:window.innerWidth,height:window.innerHeight})),r=B(n,e),s=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",s),t}function ut(e,t,n){const{delay:r,enabled:s}=rt(t),{set:i,reset:a,clear:c}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!s||a()}),[r,s,a,...n]),{set:i,reset:a,clear:c}}}}]);
\ No newline at end of file
diff --git a/assets/js/0ed4549e.f00dd43e.js b/assets/js/0ed4549e.f00dd43e.js
new file mode 100644
index 000000000..ce34c23f1
--- /dev/null
+++ b/assets/js/0ed4549e.f00dd43e.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[9647],{2166:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>w,assets:()=>S,contentTitle:()=>m,default:()=>v,frontMatter:()=>g,metadata:()=>r,toc:()=>y});const r=JSON.parse('{"id":"react/hooks/useSessionStorage","title":"useSessionStorage","description":"React v18\ubd80\ud130 \uc9c0\uc6d0\ud558\ub294 useSyncExternalStore \uc744 \ud65c\uc6a9\ud574 \uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 \ub0b4\uc758 \ud2b9\uc815 key \ub370\uc774\ud130\ub97c \uad6c\ub3c5\ud558\uace0, \uad6c\ub3c5 \uc911\uc778 \ub370\uc774\ud130\uc5d0 \ubcc0\ud654\uac00 \uc788\uc744 \uc2dc \uc774\ub97c \ub3d9\uae30\ud654\ud574\uc8fc\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useSessionStorage.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useSessionStorage","permalink":"/modern-kit/docs/react/hooks/useSessionStorage","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useScrollTo","permalink":"/modern-kit/docs/react/hooks/useScrollTo"},"next":{"title":"useStep","permalink":"/modern-kit/docs/react/hooks/useStep"}}');var o=n(6206),i=n(3267),s=n(9340),a=n(4382);const c="modern-kit-session-storage",l=e=>{window.addEventListener(c,e)},u=e=>{window.removeEventListener(c,e)},d=()=>{window.dispatchEvent(new StorageEvent(c))},h=e=>window.sessionStorage.getItem(e),p=e=>(l(e),()=>{u(e)});function f(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=(0,s.Tn)(n)?n():n,o=(0,a.useSyncExternalStore)(p,(()=>h(t)),(()=>(e=>JSON.stringify(e))(r)));return{state:(0,a.useMemo)((()=>o?(0,s.Ol)(o):r),[o,r]),setState:(0,a.useCallback)((e=>{try{const n=h(t),o=n?(0,s.Ol)(n):r,i=(0,s.Tn)(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(i)),d()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,a.useCallback)((()=>{try{window.sessionStorage.removeItem(t),d()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const g={},m="useSessionStorage",S={},w=()=>{const e={button:"button",div:"div",p:"p",...(0,i.R)()},{state:t,setState:n,removeState:r}=f({key:"test",initialValue:"default"});return(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.p,{children:"\uac1c\ubc1c\uc790 \ub3c4\uad6c\uc5d0\uc11c \uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0\ub97c \ud655\uc778\ud574\ubcf4\uc138\uc694!"}),(0,o.jsxs)(e.p,{children:["state: ",t]}),(0,o.jsx)(e.button,{onClick:()=>n("foo"),children:'\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "test"key\uc5d0 "foo"\ub370\uc774\ud130 \uc800\uc7a5'}),(0,o.jsx)(e.button,{onClick:()=>n("bar"),children:'\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "test"key\uc5d0 "bar"\ub370\uc774\ud130 \uc800\uc7a5'}),(0,o.jsx)(e.button,{onClick:()=>r(),children:'\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "test"key \uc81c\uac70'})]})},y=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function x(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",strong:"strong",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"usesessionstorage",children:"useSessionStorage"})}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"React v18"}),"\ubd80\ud130 \uc9c0\uc6d0\ud558\ub294 ",(0,o.jsx)(t.strong,{children:(0,o.jsx)(t.a,{href:"https://react.dev/reference/react/useSyncExternalStore",children:"useSyncExternalStore"})})," \uc744 \ud65c\uc6a9\ud574 \uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 \ub0b4\uc758 \ud2b9\uc815 ",(0,o.jsx)(t.code,{children:"key"})," \ub370\uc774\ud130\ub97c \uad6c\ub3c5\ud558\uace0, \uad6c\ub3c5 \uc911\uc778 \ub370\uc774\ud130\uc5d0 \ubcc0\ud654\uac00 \uc788\uc744 \uc2dc \uc774\ub97c \ub3d9\uae30\ud654\ud574\uc8fc\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:["\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0\uc5d0 \uad6c\ub3c5\ud558\uace0\uc790 \ud558\ub294 ",(0,o.jsx)(t.code,{children:"key"}),"\uac00 \uc5c6\uc744 \uacbd\uc6b0 \ubc18\ud658\ud560 ",(0,o.jsx)(t.code,{children:"initialValue"}),"\ub85c \ucd08\uae30\uac12\uc744 \uc124\uc815\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \ub610\ud55c, ",(0,o.jsx)(t.code,{children:"\uc11c\ubc84 \uc0ac\uc774\ub4dc \ub80c\ub354\ub9c1(SSR)"}),"\uc758 \uacbd\uc6b0 \uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0\uac00 \ub3d9\uc791\ud558\uc9c0 \uc54a\uae30 \ub54c\ubb38\uc5d0 ",(0,o.jsx)(t.code,{children:"initialValue"}),"\uac00 \ubc18\ud658\ub429\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"setState"}),"\ub294 \uac12 \uc790\uccb4\ub97c \ub118\uae38 \uc218 \uc788\uc73c\uba70, \ud568\uc218\ub3c4 \ub118\uae38 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \ud568\uc218\ub85c \ud65c\uc6a9 \uc2dc\uc5d0 \uc778\uc790\ub85c state\ub97c \uac00\uc838\uc62c \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",children:"const { state, setState, removeState } = useSessionStorage({\n key: 'test',\n initialValue: [1, 2],\n});\n\nsetState([1, 2, 3]);\nsetState(state => [...state, 3]);\n"})}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsxs)(t.p,{children:["initialValue\ub97c \ub118\uaca8\uc8fc\uba74 \ub354\uc6b1 ",(0,o.jsx)(t.code,{children:"\uba85\ud655\ud55c \ud0c0\uc785 \ucd94\ub860"}),"\uc774 \uac00\ub2a5\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",children:"const { state, setState } = useSessionStorage({\n key: 'test',\n});\n\nstate; // number[] | null\nsetState(state => {\n state; // number[] | null\n});\n"})}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",children:"const { state, setState } = useSessionStorage({\n key: 'test',\n initialValue: [],\n});\n\nstate; // number[]\nsetState(state => {\n state; // number[]\n});\n"})}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useSessionStorage/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"interface UseSessionStorageWithoutInitialValueProps {\n key: string;\n}\n\ninterface UseSessionStorageWithInitialValueProps {\n key: string;\n initialValue: T | (() => T);\n}\n\ntype UseSessionStorageProps =\n | UseSessionStorageWithoutInitialValueProps\n | UseSessionStorageWithInitialValueProps;\n"})}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",children:"// \ud568\uc218 \uc624\ubc84\ub85c\ub529\nfunction useSessionStorage({\n key,\n initialValue,\n}: UseSessionStorageWithInitialValueProps): {\n state: T;\n setState: Dispatch>;\n removeState: () => void;\n};\n\nfunction useSessionStorage({\n key,\n}: UseSessionStorageWithoutInitialValueProps): {\n state: T | null;\n setState: Dispatch>;\n removeState: () => void;\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useSessionStorage } from '@modern-kit/react';\n\nconst Example = () => {\n const { state, setState, removeState } = useSessionStorage({\n key: 'test',\n initialValue: 'default',\n });\n\n return (\n \n
\uac1c\ubc1c\uc790 \ub3c4\uad6c\uc5d0\uc11c \uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0\ub97c \ud655\uc778\ud574\ubcf4\uc138\uc694!
\n
state: {state}
\n
\n
\n
\n
\n );\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(w,{})]})}function v(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(x,{...e})}):x(e)}},3267:(e,t,n)=>{n.d(t,{R:()=>s,x:()=>a});var r=n(4382);const o={},i=r.createContext(o);function s(e){const t=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:s(e.components),r.createElement(i.Provider,{value:t},e.children)}},9340:(e,t,n)=>{function r(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(t){i(t)}}function a(e){try{c(r.throw(e))}catch(t){i(t)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}n.d(t,{Et:()=>x,Fr:()=>a,Gp:()=>S,Ol:()=>E,Qd:()=>b,S$:()=>s,Tn:()=>w,Zp:()=>h,dK:()=>l,fl:()=>$,gD:()=>y,i5:()=>f,if:()=>p,l6:()=>k,lQ:()=>j,nS:()=>d,ni:()=>O,oc:()=>c}),"function"==typeof SuppressedError&&SuppressedError;const o={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};const i=(e,t)=>new Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function s(){return"undefined"==typeof window}function a(){if(s())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}function c(){return!s()}function l(e){return r(this,void 0,void 0,(function*(){if(!c())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const u=e=>r(void 0,void 0,void 0,(function*(){const t=yield fetch(e);return l(yield t.text())}));function d(e,t){var n;return r(this,void 0,void 0,(function*(){if(!c())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator))return u(e);if(!("write"in window.navigator.clipboard))return u(e);if(null!==(n=null==t?void 0:t.toText)&&void 0!==n&&n)return u(e);const s=yield function(e,t="png"){return new Promise(((n,s)=>{const a=new Image;a.onload=()=>r(this,void 0,void 0,(function*(){const e=document.createElement("canvas");e.width=a.width,e.height=a.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(a,0,0);const s=yield i(e,o[t]);n(s)}catch(r){console.error(`Failed to load image. message: ${r.mesaage}`),s(r)}})),a.onerror=()=>{s(new Error("Failed to load image"))},a.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[s.type]:s})]),s}catch(s){throw console.error(`Failed to copy to clipboard. message: ${s.message}`),s}}))}function h(){return r(this,void 0,void 0,(function*(){if(!c())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function p(){return r(this,void 0,void 0,(function*(){if(!c())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function f(e,t){return Object.prototype.hasOwnProperty.call(e,t)}const g=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i=0;i{if(e===t)return!0;if(x(e)&&x(t)&&isNaN(e)&&isNaN(t))return!0;if(w(e)&&w(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return g(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!m(o,t.get(r),n))return!1;return!0}return g(e,t,n)};function S(e,t){return m(e,t,new WeakMap)}function w(e){return"function"==typeof e}function y(e){return null==e}function x(e){return"number"==typeof e}function v(e){return!function(e){return Object(e)!==e}(e)}function b(e){return v(e)&&"[object Object]"===Object.prototype.toString.call(e)}function k(e){return e===window}function j(){}function E(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}function C(e){return Object.keys(e)}const T={days:864e5,hours:36e5,minutes:6e4,seconds:1e3};C(T);function $(e,t){if(!c())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}function O(e,t,n){if(!c())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=w(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}}}]);
\ No newline at end of file
diff --git a/assets/js/11738f66.0f506a6b.js b/assets/js/11738f66.0f506a6b.js
new file mode 100644
index 000000000..a8b784299
--- /dev/null
+++ b/assets/js/11738f66.0f506a6b.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[6021],{7424:(e,n,t)=>{t.r(n),t.d(n,{ResizeObserver:()=>h,assets:()=>f,contentTitle:()=>l,default:()=>b,frontMatter:()=>d,metadata:()=>r,toc:()=>p});const r=JSON.parse('{"id":"react/hooks/useResizeObserver","title":"useResizeObserver","description":"ref\ub97c \ud560\ub2f9\ud55c \ud0c0\uac9f \uc5d8\ub9ac\uba3c\ud2b8\uc758 DOM \ud06c\uae30 \ubcc0\ud654\ub97c \uac10\uc9c0\ud558\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useResizeObserver.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useResizeObserver","permalink":"/modern-kit/docs/react/hooks/useResizeObserver","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"usePrevious","permalink":"/modern-kit/docs/react/hooks/usePrevious"},"next":{"title":"useScrollLock","permalink":"/modern-kit/docs/react/hooks/useScrollLock"}}');var o=t(6206),i=t(3267),s=t(9340),c=t(6765),a=t(4382);const u={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};const d={},l="useResizeObserver",f={},h=()=>{const e={br:"br",div:"div",...(0,i.R)()},{ref:n,contentRect:t}=function(e=s.lQ){const[n,t]=(0,a.useState)(u),r=(0,a.useRef)(null),o=(0,c.p)((([n])=>{n&&(e(n),t(n.contentRect))}));return(0,a.useEffect)((()=>{if(!r.current)return;const e=r.current,n=new ResizeObserver(o);return n.observe(e),()=>{n.unobserve(e)}}),[o]),{ref:r,contentRect:n}}((e=>{console.log("resize",e)}));return(0,o.jsxs)(e.div,{ref:n,style:{width:"100%",height:"400px",background:"#439966",fontSize:"2rem",color:"#fff"},children:["\ube0c\ub77c\uc6b0\uc800 \ub108\ube44\ub97c \uc904\uc5ec\ubcf4\uc138\uc694. ",(0,o.jsx)(e.br,{}),`width: ${t.width}, height: ${t.height}`]})},p=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Note",id:"note",level:2}];function m(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.header,{children:(0,o.jsx)(n.h1,{id:"useresizeobserver",children:"useResizeObserver"})}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.code,{children:"ref"}),"\ub97c \ud560\ub2f9\ud55c \ud0c0\uac9f \uc5d8\ub9ac\uba3c\ud2b8\uc758 DOM \ud06c\uae30 \ubcc0\ud654\ub97c \uac10\uc9c0\ud558\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(n.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useResizeObserver/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(n.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"/*\n * type ContentRect = {\n readonly bottom: number;\n readonly height: number;\n readonly left: number;\n readonly right: number;\n readonly top: number;\n readonly width: number;\n readonly x: number;\n readonly y: number;\n }\n */\ntype ContentRect = Omit;\n\nconst useResizeObserver: (\n action?: (entry: ResizeObserverEntry) => void\n) => {\n ref: React.RefObject;\n contentRect: ContentRect;\n};\n"})}),"\n",(0,o.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-tsx",metastring:'title="typescript"',children:"import React, { forwardRef, useRef } from 'react';\nimport { useResizeObserver } from '@modern-kit/react';\n\nconst Example = () => {\n const { ref, contentRect } = useResizeObserver((entry) => {\n console.log('resize', entry);\n });\n\n const boxStyle = useMemo(() => {\n return {\n width: '100%', \n height: '400px', \n background: '#439966', \n fontSize: '2rem',\n color: '#fff',\n }\n }, []);\n\n return (\n \n \ube0c\ub77c\uc6b0\uc800 \ub108\ube44\ub97c \uc904\uc5ec\ubcf4\uc138\uc694.
\n {`width: ${contentRect.width}, height: ${contentRect.height}`}\n
\n );\n};\n"})}),"\n","\n",(0,o.jsx)(h,{}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(n.h2,{id:"note",children:"Note"}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsx)(n.li,{children:(0,o.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver",children:"ResizeObserver API"})}),"\n"]})]})}function b(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(m,{...e})}):m(e)}},3267:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>c});var r=t(4382);const o={},i=r.createContext(o);function s(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:s(e.components),r.createElement(i.Provider,{value:n},e.children)}},6765:(e,n,t)=>{t.d(n,{p:()=>o});var r=t(4382);function o(e){const n=(0,r.useRef)(e);return n.current=e,(0,r.useCallback)(((...e)=>n.current(...e)),[])}},9340:(e,n,t)=>{function r(e,n,t,r){return new(t||(t=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(n){i(n)}}function c(e){try{a(r.throw(e))}catch(n){i(n)}}function a(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(s,c)}a((r=r.apply(e,n||[])).next())}))}t.d(n,{Et:()=>y,Fr:()=>c,Gp:()=>g,Ol:()=>k,Qd:()=>j,S$:()=>s,Tn:()=>v,Zp:()=>f,dK:()=>u,fl:()=>C,gD:()=>w,i5:()=>p,if:()=>h,l6:()=>R,lQ:()=>O,nS:()=>l,ni:()=>S,oc:()=>a}),"function"==typeof SuppressedError&&SuppressedError;const o={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};const i=(e,n)=>new Promise(((t,r)=>{e.toBlob((e=>{e?t(e):r(new Error(`Failed to create blob with format ${n}`))}),n)}));function s(){return"undefined"==typeof window}function c(){if(s())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}function a(){return!s()}function u(e){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const n=document.createElement("textarea");n.value=e,n.style.opacity="0",document.body.appendChild(n),n.focus(),n.select();try{return document.execCommand("copy"),e}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}finally{document.body.removeChild(n)}}(e)}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}}))}const d=e=>r(void 0,void 0,void 0,(function*(){const n=yield fetch(e);return u(yield n.text())}));function l(e,n){var t;return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator))return d(e);if(!("write"in window.navigator.clipboard))return d(e);if(null!==(t=null==n?void 0:n.toText)&&void 0!==t&&t)return d(e);const s=yield function(e,n="png"){return new Promise(((t,s)=>{const c=new Image;c.onload=()=>r(this,void 0,void 0,(function*(){const e=document.createElement("canvas");e.width=c.width,e.height=c.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(c,0,0);const s=yield i(e,o[n]);t(s)}catch(r){console.error(`Failed to load image. message: ${r.mesaage}`),s(r)}})),c.onerror=()=>{s(new Error("Failed to load image"))},c.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[s.type]:s})]),s}catch(s){throw console.error(`Failed to copy to clipboard. message: ${s.message}`),s}}))}function f(){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function h(){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function p(e,n){return Object.prototype.hasOwnProperty.call(e,n)}const m=(e,n,t)=>{const r=Object.keys(e),o=Object.keys(n);if(r.length!==o.length)return!1;for(let i=0;i{if(e===n)return!0;if(y(e)&&y(n)&&isNaN(e)&&isNaN(n))return!0;if(v(e)&&v(n))return e.toString()===n.toString();if("object"!=typeof e||"object"!=typeof n||null===e||null===n)return!1;if(t.has(e)&&t.get(e)===n)return!0;if(t.set(e,n),e.constructor!==n.constructor)return!1;if(e instanceof Set){if(e.size!==n.size)return!1;const r=[...e],o=[...n];return m(r,o,t)}if(e instanceof Map){if(e.size!==n.size)return!1;for(const[r,o]of e)if(!n.has(r)||!b(o,n.get(r),t))return!1;return!0}return m(e,n,t)};function g(e,n){return b(e,n,new WeakMap)}function v(e){return"function"==typeof e}function w(e){return null==e}function y(e){return"number"==typeof e}function x(e){return!function(e){return Object(e)!==e}(e)}function j(e){return x(e)&&"[object Object]"===Object.prototype.toString.call(e)}function R(e){return e===window}function O(){}function k(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(n){throw new Error(`Failed to parse data: ${n}`)}}function z(e){return Object.keys(e)}const E={days:864e5,hours:36e5,minutes:6e4,seconds:1e3};z(E);function C(e,n){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(n)}catch(t){throw new Error(`Failed to remove key "${n}" from ${e}: ${t}`)}}function S(e,n,t){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=v(t)?t():t;r.setItem(n,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${n}" in ${e}: ${r}`)}}}}]);
\ No newline at end of file
diff --git a/assets/js/11738f66.1ad6e8ce.js b/assets/js/11738f66.1ad6e8ce.js
deleted file mode 100644
index 2169452ba..000000000
--- a/assets/js/11738f66.1ad6e8ce.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[6021],{7827:(e,t,n)=>{n.r(t),n.d(t,{ResizeObserver:()=>u,assets:()=>a,contentTitle:()=>l,default:()=>h,frontMatter:()=>c,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"react/hooks/useResizeObserver","title":"useResizeObserver","description":"ref\ub97c \ud560\ub2f9\ud55c \ud0c0\uac9f \uc5d8\ub9ac\uba3c\ud2b8\uc758 DOM \ud06c\uae30 \ubcc0\ud654\ub97c \uac10\uc9c0\ud558\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useResizeObserver.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useResizeObserver","permalink":"/modern-kit/docs/react/hooks/useResizeObserver","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"usePrevious","permalink":"/modern-kit/docs/react/hooks/usePrevious"},"next":{"title":"useScrollLock","permalink":"/modern-kit/docs/react/hooks/useScrollLock"}}');var o=n(6206),i=n(3267),s=n(4027);const c={},l="useResizeObserver",a={},u=()=>{const e={br:"br",div:"div",...(0,i.R)()},{ref:t,contentRect:n}=(0,s.wY)((e=>{console.log("resize",e)}));return(0,o.jsxs)(e.div,{ref:t,style:{width:"100%",height:"400px",background:"#439966",fontSize:"2rem",color:"#fff"},children:["\ube0c\ub77c\uc6b0\uc800 \ub108\ube44\ub97c \uc904\uc5ec\ubcf4\uc138\uc694. ",(0,o.jsx)(e.br,{}),`width: ${n.width}, height: ${n.height}`]})},d=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Note",id:"note",level:2}];function f(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"useresizeobserver",children:"useResizeObserver"})}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"ref"}),"\ub97c \ud560\ub2f9\ud55c \ud0c0\uac9f \uc5d8\ub9ac\uba3c\ud2b8\uc758 DOM \ud06c\uae30 \ubcc0\ud654\ub97c \uac10\uc9c0\ud558\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useResizeObserver/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"/*\n * type ContentRect = {\n readonly bottom: number;\n readonly height: number;\n readonly left: number;\n readonly right: number;\n readonly top: number;\n readonly width: number;\n readonly x: number;\n readonly y: number;\n }\n */\ntype ContentRect = Omit;\n\nconst useResizeObserver: (\n action?: (entry: ResizeObserverEntry) => void\n) => {\n ref: React.RefObject;\n contentRect: ContentRect;\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import React, { forwardRef, useRef } from 'react';\nimport { useResizeObserver } from '@modern-kit/react';\n\nconst Example = () => {\n const { ref, contentRect } = useResizeObserver((entry) => {\n console.log('resize', entry);\n });\n\n const boxStyle = useMemo(() => {\n return {\n width: '100%', \n height: '400px', \n background: '#439966', \n fontSize: '2rem',\n color: '#fff',\n }\n }, []);\n\n return (\n \n \ube0c\ub77c\uc6b0\uc800 \ub108\ube44\ub97c \uc904\uc5ec\ubcf4\uc138\uc694.
\n {`width: ${contentRect.width}, height: ${contentRect.height}`}\n
\n );\n};\n"})}),"\n","\n",(0,o.jsx)(u,{}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"note",children:"Note"}),"\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsx)(t.li,{children:(0,o.jsx)(t.a,{href:"https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver",children:"ResizeObserver API"})}),"\n"]})]})}function h(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(f,{...e})}):f(e)}},4027:(e,t,n)=>{n.d(t,{$$:()=>ze,$I:()=>oe,AE:()=>Ve,BL:()=>J,DX:()=>L,FT:()=>ct,Fo:()=>et,Hn:()=>it,I5:()=>je,JF:()=>Pe,K:()=>ae,K$:()=>He,M0:()=>Ie,ML:()=>ne,Mj:()=>ye,Mk:()=>Fe,Mo:()=>ie,NT:()=>Ye,QV:()=>Ke,Ub:()=>ke,Ut:()=>Ee,W7:()=>K,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>We,Zu:()=>le,_1:()=>Oe,_g:()=>nt,aL:()=>H,aY:()=>Le,bB:()=>D,d7:()=>B,eG:()=>st,fN:()=>ce,fm:()=>G,gl:()=>z,hN:()=>X,iD:()=>de,iQ:()=>Ne,jd:()=>se,lW:()=>at,oD:()=>U,oo:()=>Re,pL:()=>q,qi:()=>ue,rN:()=>Me,tD:()=>Se,u8:()=>Q,wY:()=>Be,xV:()=>N,xh:()=>tt,zy:()=>Z});var r=n(6206),o=n(4382),i=n(3683),s=n(5086),c=n(7197),l=(n(1604),n(5938));function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function m(){return typeof window>"u"}function b(){return!m()}function g(e){return f(this,0,void 0,(function*(){if(!b())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const w=e=>f(void 0,0,void 0,(function*(){return g(yield(yield fetch(e)).text())}));function v(e,t){var n;return f(this,0,void 0,(function*(){if(!b())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return w(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const i=yield p(e,h[t]);n(i)}catch(i){console.error(`Failed to load image. message: ${i.mesaage}`),r(i)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i=0;i{if(e===t||C(e)&&C(t)&&isNaN(e)&&isNaN(t))return!0;if(S(e)&&S(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return y(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!x(o,t.get(r),n))return!1;return!0}return y(e,t,n)};function k(e,t){return x(e,t,new WeakMap)}function S(e){return"function"==typeof e}function C(e){return"number"==typeof e}function E(e){return!function(e){return Object(e)!==e}(e)}function j(){}function R(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const O=(...e)=>t=>e.forEach((e=>{if(S(e))e(t);else if(null!=e){e.current=t}}));function I(...e){return(0,o.useCallback)(O(...e),e)}const L=o.forwardRef(((e,t)=>{const{children:n}=e,i=a(e,["children"]),s=o.Children.toArray(n),c=s.find(F);if(c){const e=c.props.children,n=s.map((t=>t===c?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(M,Object.assign({},i,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(M,Object.assign({},i,{ref:t,children:n}))}));L.displayName="Slot";const M=o.forwardRef(((e,t)=>{const{children:n}=e,r=a(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),i):"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?O(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));M.displayName="SlotClone";const N=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function F(e){return o.isValidElement(e)&&e.type===N}var $="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const z=d(((e,t)=>{var{ratio:n,style:o,as:s="div",asChild:c=!1}=e,l=a(e,["ratio","style","as","asChild"]);const u=c?L:s,d=Object.assign({aspectRatio:n},o),f=c?l.className:i($,l.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},l))})),P=()=>j,T=()=>!1,Y=()=>!0;function D({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)(P,T,Y)?e:t}function A(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const X=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>A()?(0,r.jsx)(r.Fragment,{children:t}):e;function V(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function W(e){const t=V(e);(0,o.useEffect)((()=>()=>t()),[t])}function _(e,t=k){const[n,r]=(0,o.useState)(e),i=V(t);return(0,o.useEffect)((()=>{i(n,e)||r(e)}),[i,n,e]),n}function B(e,t,n){const r=V(e),i=_(n),c=(0,o.useMemo)((()=>(0,s.A)(r,t,i)),[r,t,i]);return W((()=>c.cancel())),c}const H=({children:e,capture:t,wait:n,options:r})=>{const i=o.Children.only(e),s=B(((...e)=>{const n=i?.props;if(n&&S(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(i,{[t]:s})};function J({onIntersectStart:e=j,onIntersectEnd:t=j,enabled:n=!0,calledOnce:r=!1,root:i=null,threshold:s=0,rootMargin:c="0px 0px 0px 0px"}){const l=(0,o.useRef)(0),a=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=V((([n],o)=>{if(!n)return;const i=n.target;n.isIntersecting?(a.current=!0,l.current+=1,e(n)):a.current&&(a.current=!1,l.current+=1,t(n)),r&&l.current>1&&o.unobserve(i)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:s,root:i,rootMargin:c}),u.current.observe(e))}),[n,s,i,c,d])}}const U=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:i,rootMargin:s}=e,c=a(e,["src","threshold","root","rootMargin"]);const{ref:l}=J({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:i,rootMargin:s});return(0,r.jsx)("img",Object.assign({ref:I(t,l)},c))}));U.displayName="LazyImage";const K=(0,o.forwardRef)(((e,t)=>{var{width:n,height:i,fallback:s,className:c,style:l,duration:u="0.2s",onLoad:d}=e,f=a(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,p]=(0,o.useState)(!1),m=!h,b=(0,o.useMemo)((()=>({position:"relative",width:n,height:i})),[n,i]),g=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:m?0:1,transition:`opacity ${u}`},l)),[m,u,l]),w=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),v=c?`lazy-image-wrapper ${c}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:v,style:b,children:[m&&s,(0,r.jsx)(U,Object.assign({ref:t,width:n,height:i,style:g,onLoad:w},f))]})}));K.displayName="FallbackLazyImage";const Z=({condition:e,trueComponent:t,falseComponent:n})=>{const i=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:i?t:n})},Q=({onScrollAction:e,children:t,root:n,threshold:o,enabled:i,triggerPosition:s="after",rootMargin:c="150px 0px"})=>{const{ref:l}=J({onIntersectStart:e,root:n,threshold:o,enabled:i,rootMargin:c});return(0,r.jsxs)(r.Fragment,{children:["before"===s&&(0,r.jsx)("div",{ref:l}),t,"after"===s&&(0,r.jsx)("div",{ref:l})]})},q=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1}=e,c=a(e,["children","as","asChild"]);const l=s?L:i,{ref:u}=J(c);if(s&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(l,Object.assign({ref:O(t,u)},c,{children:n}))})),G=({items:e=[],itemKey:t,renderItem:n})=>{const i=(0,o.useCallback)(((e,n)=>function(e){return E(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},i(e,t))))})},ee=b()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=V(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),i=(0,o.useMemo)((()=>function(){if(m())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,i,(({target:t})=>{if(!r.current)return;const o=r.current,i=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!i&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1,onPointerDown:c,excludeRefs:l=[]}=e,u=a(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(c,{excludeRefs:l}),f=s?L:i;if(s&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:O(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const ie=({itemKey:e,items:t=[],separator:n,renderItem:i,separatorInterval:s=1,includeLastSeparator:c=!1})=>{const l=(0,o.useCallback)((e=>e===t.length-1?c:(e+1)%s==0),[c,s,t.length]);return(0,r.jsx)(G,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[i(e,t),l(t)&&n]})})},se=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ce=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function le(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function ae(e=!0){const t=S(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!i.current){i.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{i.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),i=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield g(e);return t(n),!0}catch{return t(null),!1}}))),[]),s=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield v(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!b())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),l=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!b())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:i,copyImage:s,readText:c,readContents:l}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",pe={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},me=e=>pe[e],be=me("localStorage"),ge=e=>window.localStorage.getItem(e),we=e=>JSON.stringify(e),ve=e=>(be.subscribe(e),()=>{be.unsubscribe(e)});function ye(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=S(n)?n():n,i=(0,o.useSyncExternalStore)(ve,(()=>ge(t)),(()=>we(r)));return{state:(0,o.useMemo)((()=>i?R(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=ge(t),o=n?R(n):r,i=S(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(i)),be.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),be.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const xe=(e,t)=>b()?window.matchMedia(e).matches:t??!1;function ke(e,t){const[n,r]=(0,o.useState)(xe(e,t)),i=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",i),n}function Se(){return ke("(prefers-color-scheme: dark)")?"dark":"light"}const Ce="color-scheme";function Ee({defaultValue:e,key:t=Ce,shouldSetBodyClass:n=!1}={}){const r=Se(),i=S(e)?e():e,{state:s,setState:c}=ye({key:t,initialValue:i??r}),l=(0,o.useCallback)((()=>{c((e=>"dark"===e?"light":"dark"))}),[c]),a=(0,o.useCallback)((()=>{c("dark")}),[c]),u=(0,o.useCallback)((()=>{c("light")}),[c]),d=(0,o.useCallback)((()=>{c(r)}),[c,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(s),()=>{n&&document.body.classList.remove(s)})),[s,n]),{colorScheme:s,preferredColorScheme:r,setToggleMode:l,setDarkMode:a,setLightMode:u,setPreferredMode:d}}function je(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),i=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),s=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:i,reset:s}}function Re({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,i]=(0,o.useState)(t),s=r0,l=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),a=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const s=l(e,t);o&&o({prev:r,next:s}),i(s)}),[n,r,l]),u=(0,o.useCallback)((e=>{a("nextStep",!s,e)}),[s,a]),d=(0,o.useCallback)((e=>{a("prevStep",!c,e)}),[c,a]),f=(0,o.useCallback)(((t,n)=>{const o=S(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void i(t);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),i(t)}),[r,t]);return{currentStep:r,hasNextStep:s,hasPrevStep:c,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Oe(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:i,resetStep:s}=Re({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:i,resetIndex:s}}function Ie(e,t,n={}){const[r,i]=(0,o.useState)(e);return[r,B(i,t,n)]}function Le(e,t={}){const[n,r]=(0,o.useState)(""),[i,s]=Ie("",e,t);return{value:n,debouncedValue:i,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),s(t)}),[s]),onReset:(0,o.useCallback)((()=>{r(""),s("")}),[s])}}function Me(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Ne({onFocus:e=j,onBlur:t=j}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=V((t=>{r(!0),e(t)})),c=V((e=>{r(!1),t(e)})),l=(0,o.useCallback)((()=>{i.current&&(i.current.focus(),r(!0))}),[]);return ne(i,"focus",s),ne(i,"blur",c),{ref:i,isFocus:n,setFocus:l}}function Fe({onEnter:e=j,onLeave:t=j}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=V((t=>{r(!0),e(t)})),c=V((e=>{r(!1),t(e)}));return ne(i,"mouseenter",s),ne(i,"mouseleave",c),{ref:i,isHovered:n}}const $e=e=>{var t;return C(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ze(e,t){const n=(0,o.useRef)(),r=V(e),{delay:i,enabled:s}=$e(t),c=(0,o.useCallback)((()=>{n.current=window.setInterval(r,i)}),[r,i]),l=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),c()}),[l,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>l()}),[l,c,s,i]),{set:c,reset:a,clear:l}}function Pe({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),i=V((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];S(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",i),()=>t.removeEventListener("keydown",i)}),[e,i]),r}const Te={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function Ye(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)(Te),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:l}=t;let a=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();a=i-t.left,u=s-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:l,elementRelativeX:a,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const De=()=>navigator.onLine,Ae=()=>!0,Xe=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function Ve({onlineAction:e=j,offlineAction:t=j}={}){const n=V((n=>Xe(n,e,t)));return(0,o.useSyncExternalStore)(n,De,Ae)}function We(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const _e={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Be(e=j){const[t,n]=(0,o.useState)(_e),r=(0,o.useRef)(null),i=V((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(i);return t.observe(e),()=>{t.unobserve(e)}}),[i]),{ref:r,contentRect:t}}function He({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),i=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>i())),[e,r,i]),{ref:t,lock:r,unlock:i}}const Je=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,Ue=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:i=0,alignY:s="start",alignX:c="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+i+Je(window.innerHeight,r.height,s),left:r.left+window.scrollX+o+Je(window.innerWidth,r.width,c)};const l=e.getBoundingClientRect();return{top:r.top-l.top+e.scrollTop+i+Je(l.height,r.height,s),left:r.left-l.left+e.scrollLeft+o+Je(l.width,r.width,c)}};function Ke(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:i,top:s}=Ue(r,t,n);r.scrollTo({top:s,left:i,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ze=me("sessionStorage"),Qe=e=>window.sessionStorage.getItem(e),qe=e=>JSON.stringify(e),Ge=e=>(Ze.subscribe(e),()=>{Ze.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=S(n)?n():n,i=(0,o.useSyncExternalStore)(Ge,(()=>Qe(t)),(()=>qe(r)));return{state:(0,o.useMemo)((()=>i?R(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=Qe(t),o=n?R(n):r,i=S(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(i)),Ze.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ze.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:i}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[s,c]=(0,o.useState)(n),l=(0,o.useCallback)((e=>{c((t=>{const n=S(e)?e(t):e;return r&&i&&function(e,t,n){if(!b())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=S(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,i,n),n}))}),[r,i]),a=(0,o.useCallback)((()=>{r&&i&&function(e,t){if(!b())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,i),c(null)}),[r,i]);return Object.assign({state:s,setState:l,clearState:a},Re(e))}function nt(e,t,n={}){const r=V(e),i=_(n),s=(0,o.useMemo)((()=>(0,c.A)(r,t,i)),[r,t,i]);return W((()=>s.cancel())),s}const rt=e=>{var t;return C(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=V(e),{delay:i,enabled:s}=rt(t),c=(0,o.useCallback)((()=>{n.current=setTimeout(r,i)}),[r,i]),l=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),c()}),[l,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>l()}),[c,l,i,s]),{set:c,reset:a,clear:l}}function it(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function st(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new l.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function ct({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const lt={width:null,height:null};function at({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>m()?lt:{width:window.innerWidth,height:window.innerHeight})),r=B(n,e),i=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",i),t}function ut(e,t,n){const{delay:r,enabled:i}=rt(t),{set:s,reset:c,clear:l}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!i||c()}),[r,i,c,...n]),{set:s,reset:c,clear:l}}}}]);
\ No newline at end of file
diff --git a/assets/js/1c2388cf.a9138072.js b/assets/js/1c2388cf.a9138072.js
deleted file mode 100644
index 806fcd5ad..000000000
--- a/assets/js/1c2388cf.a9138072.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[8933],{4609:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>u,assets:()=>l,contentTitle:()=>c,default:()=>p,frontMatter:()=>s,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"react/components/SeparatedIterator","title":"SeparatedIterator","description":"Iterator\ub97c \ud655\uc7a5\ud574 items props\ub85c \uc8fc\uc5b4\uc9c4 \ubc30\uc5f4\uc744 \ubc18\ubcf5\ud558\uba74\uc11c \uac01 \ud56d\ubaa9\uc5d0 \ub300\ud574 \ud2b9\uc815 \uc694\uc18c \ubc0f \ucef4\ud3ec\ub10c\ud2b8\ub97c \ub80c\ub354\ub9c1\ud558\uba70, \ub3d9\uc2dc\uc5d0 \uac01 \uc694\uc18c \uc0ac\uc774\uc5d0 \uad6c\ubd84\uc790(Separator)\ub97c \ub80c\ub354\ub9c1 \ud558\ub294 \ucef4\ud3ec\ub10c\ud2b8\uc785\ub2c8\ub2e4.","source":"@site/docs/react/components/SeparatedIterator.mdx","sourceDirName":"react/components","slug":"/react/components/SeparatedIterator","permalink":"/modern-kit/docs/react/components/SeparatedIterator","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"Portal","permalink":"/modern-kit/docs/react/components/Portal"},"next":{"title":"Slot","permalink":"/modern-kit/docs/react/components/Slot"}}');var o=n(6206),i=n(3267),a=n(4027);const s={},c="SeparatedIterator",l={},u=()=>{const e={div:"div",h3:"h3",...(0,i.R)()};return(0,o.jsx)(a.Mo,{items:[{id:1,name:"Gromit"},{id:2,name:"Dylan"},{id:3,name:"Minjae"}],renderItem:t=>(0,o.jsxs)(e.h3,{children:["id: ",t.id,", name: ",t.name]}),separator:(0,o.jsx)(e.div,{style:{height:"3px",backgroundColor:"gray"}})})},d=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function f(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"separatediterator",children:"SeparatedIterator"})}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.a,{href:"https://modern-agile-team.github.io/modern-kit/docs/react/components/Iterator",children:"Iterator"}),"\ub97c \ud655\uc7a5\ud574 ",(0,o.jsx)(t.code,{children:"items props"}),"\ub85c \uc8fc\uc5b4\uc9c4 \ubc30\uc5f4\uc744 \ubc18\ubcf5\ud558\uba74\uc11c \uac01 \ud56d\ubaa9\uc5d0 \ub300\ud574 ",(0,o.jsx)(t.code,{children:"\ud2b9\uc815 \uc694\uc18c \ubc0f \ucef4\ud3ec\ub10c\ud2b8"}),"\ub97c \ub80c\ub354\ub9c1\ud558\uba70, \ub3d9\uc2dc\uc5d0 \uac01 \uc694\uc18c \uc0ac\uc774\uc5d0 ",(0,o.jsx)(t.code,{children:"\uad6c\ubd84\uc790(Separator)"}),"\ub97c \ub80c\ub354\ub9c1 \ud558\ub294 \ucef4\ud3ec\ub10c\ud2b8\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:["\uae30\ubcf8\uc801\uc73c\ub85c \ub9c8\uc9c0\ub9c9 \uc694\uc18c\uc758 ",(0,o.jsx)(t.code,{children:"Separator"}),"\ub294 \uc81c\uc678\ub429\ub2c8\ub2e4. \ud558\uc9c0\ub9cc, ",(0,o.jsx)(t.code,{children:"includeLastSeparator"}),"\ub97c ",(0,o.jsx)(t.code,{children:"true"}),"\ub85c \uc124\uc815\ud558\uba74 \ud3ec\ud568\uc2dc\ud0ac \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:["\ub610\ud55c, ",(0,o.jsx)(t.code,{children:"separatorInterval"}),"\ub97c \ud65c\uc6a9\ud574 \ud2b9\uc815 ",(0,o.jsx)(t.code,{children:"\uac04\uaca9"})," \ub9cc\ud07c Separator\ub97c \ub80c\ub354\ub9c1 \ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/components/SeparatedIterator/index.tsx",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"interface SeparatedIteratorProps extends IteratorProps {\n separator: JSX.Element;\n separatorInterval?: number; // default: 1\n includeLastSeparator?: boolean; // default: false\n}\n\nconst SeparatedIterator: ({\n itemKey,\n items,\n separator,\n renderItem,\n separatorInterval,\n includeLastSeparator,\n}: SeparatedIteratorProps) => JSX.Element;\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { SeparatedIterator } from '@modern-kit/react';\n\ninterface Item {\n id: number;\n name: string;\n}\n\nconst Example = () => {\n const items: Item[] = [\n { id: 1, name: 'Gromit' },\n { id: 2, name: 'Dylan' },\n { id: 3, name: 'Minjae' },\n ];\n\n return (\n (\n \n id: {item.id}, name: {item.name}\n
\n )}\n separator={}\n />\n );\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(u,{})]})}function p(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(f,{...e})}):f(e)}},4027:(e,t,n)=>{n.d(t,{$$:()=>$e,$I:()=>oe,AE:()=>We,BL:()=>H,DX:()=>L,FT:()=>st,Fo:()=>et,Hn:()=>it,I5:()=>Ee,JF:()=>Te,K:()=>le,K$:()=>Je,M0:()=>Oe,ML:()=>ne,Mj:()=>ye,Mk:()=>Ne,Mo:()=>ie,NT:()=>Xe,QV:()=>Ue,Ub:()=>Se,Ut:()=>je,W7:()=>U,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>_e,Zu:()=>ce,_1:()=>Re,_g:()=>nt,aL:()=>J,aY:()=>Le,bB:()=>D,d7:()=>B,eG:()=>at,fN:()=>se,fm:()=>q,gl:()=>$,hN:()=>A,iD:()=>de,iQ:()=>Me,jd:()=>ae,lW:()=>lt,oD:()=>K,oo:()=>Ie,pL:()=>Q,qi:()=>ue,rN:()=>Fe,tD:()=>ke,u8:()=>G,wY:()=>Be,xV:()=>M,xh:()=>tt,zy:()=>Z});var r=n(6206),o=n(4382),i=n(3683),a=n(5086),s=n(7197),c=(n(1604),n(5938));function l(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function m(){return typeof window>"u"}function g(){return!m()}function w(e){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const b=e=>f(void 0,0,void 0,(function*(){return w(yield(yield fetch(e)).text())}));function v(e,t){var n;return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return b(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const i=yield h(e,p[t]);n(i)}catch(i){console.error(`Failed to load image. message: ${i.mesaage}`),r(i)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i=0;i{if(e===t||C(e)&&C(t)&&isNaN(e)&&isNaN(t))return!0;if(k(e)&&k(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return y(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!x(o,t.get(r),n))return!1;return!0}return y(e,t,n)};function S(e,t){return x(e,t,new WeakMap)}function k(e){return"function"==typeof e}function C(e){return"number"==typeof e}function j(e){return!function(e){return Object(e)!==e}(e)}function E(){}function I(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const R=(...e)=>t=>e.forEach((e=>{if(k(e))e(t);else if(null!=e){e.current=t}}));function O(...e){return(0,o.useCallback)(R(...e),e)}const L=o.forwardRef(((e,t)=>{const{children:n}=e,i=l(e,["children"]),a=o.Children.toArray(n),s=a.find(N);if(s){const e=s.props.children,n=a.map((t=>t===s?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(F,Object.assign({},i,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(F,Object.assign({},i,{ref:t,children:n}))}));L.displayName="Slot";const F=o.forwardRef(((e,t)=>{const{children:n}=e,r=l(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),i):"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?R(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));F.displayName="SlotClone";const M=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function N(e){return o.isValidElement(e)&&e.type===M}var P="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const $=d(((e,t)=>{var{ratio:n,style:o,as:a="div",asChild:s=!1}=e,c=l(e,["ratio","style","as","asChild"]);const u=s?L:a,d=Object.assign({aspectRatio:n},o),f=s?c.className:i(P,c.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},c))})),T=()=>E,Y=()=>!1,X=()=>!0;function D({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)(T,Y,X)?e:t}function V(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const A=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>V()?(0,r.jsx)(r.Fragment,{children:t}):e;function W(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function _(e){const t=W(e);(0,o.useEffect)((()=>()=>t()),[t])}function z(e,t=S){const[n,r]=(0,o.useState)(e),i=W(t);return(0,o.useEffect)((()=>{i(n,e)||r(e)}),[i,n,e]),n}function B(e,t,n){const r=W(e),i=z(n),s=(0,o.useMemo)((()=>(0,a.A)(r,t,i)),[r,t,i]);return _((()=>s.cancel())),s}const J=({children:e,capture:t,wait:n,options:r})=>{const i=o.Children.only(e),a=B(((...e)=>{const n=i?.props;if(n&&k(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(i,{[t]:a})};function H({onIntersectStart:e=E,onIntersectEnd:t=E,enabled:n=!0,calledOnce:r=!1,root:i=null,threshold:a=0,rootMargin:s="0px 0px 0px 0px"}){const c=(0,o.useRef)(0),l=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=W((([n],o)=>{if(!n)return;const i=n.target;n.isIntersecting?(l.current=!0,c.current+=1,e(n)):l.current&&(l.current=!1,c.current+=1,t(n)),r&&c.current>1&&o.unobserve(i)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:a,root:i,rootMargin:s}),u.current.observe(e))}),[n,a,i,s,d])}}const K=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:i,rootMargin:a}=e,s=l(e,["src","threshold","root","rootMargin"]);const{ref:c}=H({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:i,rootMargin:a});return(0,r.jsx)("img",Object.assign({ref:O(t,c)},s))}));K.displayName="LazyImage";const U=(0,o.forwardRef)(((e,t)=>{var{width:n,height:i,fallback:a,className:s,style:c,duration:u="0.2s",onLoad:d}=e,f=l(e,["width","height","fallback","className","style","duration","onLoad"]);const[p,h]=(0,o.useState)(!1),m=!p,g=(0,o.useMemo)((()=>({position:"relative",width:n,height:i})),[n,i]),w=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:m?0:1,transition:`opacity ${u}`},c)),[m,u,c]),b=(0,o.useCallback)((e=>{d&&d(e),h(!0)}),[d]),v=s?`lazy-image-wrapper ${s}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:v,style:g,children:[m&&a,(0,r.jsx)(K,Object.assign({ref:t,width:n,height:i,style:w,onLoad:b},f))]})}));U.displayName="FallbackLazyImage";const Z=({condition:e,trueComponent:t,falseComponent:n})=>{const i=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:i?t:n})},G=({onScrollAction:e,children:t,root:n,threshold:o,enabled:i,triggerPosition:a="after",rootMargin:s="150px 0px"})=>{const{ref:c}=H({onIntersectStart:e,root:n,threshold:o,enabled:i,rootMargin:s});return(0,r.jsxs)(r.Fragment,{children:["before"===a&&(0,r.jsx)("div",{ref:c}),t,"after"===a&&(0,r.jsx)("div",{ref:c})]})},Q=d(((e,t)=>{var{children:n,as:i="div",asChild:a=!1}=e,s=l(e,["children","as","asChild"]);const c=a?L:i,{ref:u}=H(s);if(a&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(c,Object.assign({ref:R(t,u)},s,{children:n}))})),q=({items:e=[],itemKey:t,renderItem:n})=>{const i=(0,o.useCallback)(((e,n)=>function(e){return j(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},i(e,t))))})},ee=g()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=W(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),i=(0,o.useMemo)((()=>function(){if(m())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,i,(({target:t})=>{if(!r.current)return;const o=r.current,i=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!i&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:i="div",asChild:a=!1,onPointerDown:s,excludeRefs:c=[]}=e,u=l(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(s,{excludeRefs:c}),f=a?L:i;if(a&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:R(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const ie=({itemKey:e,items:t=[],separator:n,renderItem:i,separatorInterval:a=1,includeLastSeparator:s=!1})=>{const c=(0,o.useCallback)((e=>e===t.length-1?s:(e+1)%a==0),[s,a,t.length]);return(0,r.jsx)(q,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[i(e,t),c(t)&&n]})})},ae=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),se=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function ce(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function le(e=!0){const t=k(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!i.current){i.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{i.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),i=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield w(e);return t(n),!0}catch{return t(null),!1}}))),[]),a=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield v(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),s=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:i,copyImage:a,readText:s,readContents:c}}const fe="modern-kit-local-storage",pe="modern-kit-session-storage",he={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:pe,subscribe:e=>{window.addEventListener(pe,e)},unsubscribe:e=>{window.removeEventListener(pe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(pe))}}},me=e=>he[e],ge=me("localStorage"),we=e=>window.localStorage.getItem(e),be=e=>JSON.stringify(e),ve=e=>(ge.subscribe(e),()=>{ge.unsubscribe(e)});function ye(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=k(n)?n():n,i=(0,o.useSyncExternalStore)(ve,(()=>we(t)),(()=>be(r)));return{state:(0,o.useMemo)((()=>i?I(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=we(t),o=n?I(n):r,i=k(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(i)),ge.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),ge.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const xe=(e,t)=>g()?window.matchMedia(e).matches:t??!1;function Se(e,t){const[n,r]=(0,o.useState)(xe(e,t)),i=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",i),n}function ke(){return Se("(prefers-color-scheme: dark)")?"dark":"light"}const Ce="color-scheme";function je({defaultValue:e,key:t=Ce,shouldSetBodyClass:n=!1}={}){const r=ke(),i=k(e)?e():e,{state:a,setState:s}=ye({key:t,initialValue:i??r}),c=(0,o.useCallback)((()=>{s((e=>"dark"===e?"light":"dark"))}),[s]),l=(0,o.useCallback)((()=>{s("dark")}),[s]),u=(0,o.useCallback)((()=>{s("light")}),[s]),d=(0,o.useCallback)((()=>{s(r)}),[s,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(a),()=>{n&&document.body.classList.remove(a)})),[a,n]),{colorScheme:a,preferredColorScheme:r,setToggleMode:c,setDarkMode:l,setLightMode:u,setPreferredMode:d}}function Ee(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),i=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),a=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:i,reset:a}}function Ie({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,i]=(0,o.useState)(t),a=r0,c=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),l=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const a=c(e,t);o&&o({prev:r,next:a}),i(a)}),[n,r,c]),u=(0,o.useCallback)((e=>{l("nextStep",!a,e)}),[a,l]),d=(0,o.useCallback)((e=>{l("prevStep",!s,e)}),[s,l]),f=(0,o.useCallback)(((t,n)=>{const o=k(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void i(t);throw new Error("Step not valid")}),[r,e]),p=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),i(t)}),[r,t]);return{currentStep:r,hasNextStep:a,hasPrevStep:s,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:p}}function Re(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:i,resetStep:a}=Ie({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:i,resetIndex:a}}function Oe(e,t,n={}){const[r,i]=(0,o.useState)(e);return[r,B(i,t,n)]}function Le(e,t={}){const[n,r]=(0,o.useState)(""),[i,a]=Oe("",e,t);return{value:n,debouncedValue:i,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),a(t)}),[a]),onReset:(0,o.useCallback)((()=>{r(""),a("")}),[a])}}function Fe(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Me({onFocus:e=E,onBlur:t=E}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),a=W((t=>{r(!0),e(t)})),s=W((e=>{r(!1),t(e)})),c=(0,o.useCallback)((()=>{i.current&&(i.current.focus(),r(!0))}),[]);return ne(i,"focus",a),ne(i,"blur",s),{ref:i,isFocus:n,setFocus:c}}function Ne({onEnter:e=E,onLeave:t=E}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),a=W((t=>{r(!0),e(t)})),s=W((e=>{r(!1),t(e)}));return ne(i,"mouseenter",a),ne(i,"mouseleave",s),{ref:i,isHovered:n}}const Pe=e=>{var t;return C(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function $e(e,t){const n=(0,o.useRef)(),r=W(e),{delay:i,enabled:a}=Pe(t),s=(0,o.useCallback)((()=>{n.current=window.setInterval(r,i)}),[r,i]),c=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{c(),s()}),[c,s]);return(0,o.useEffect)((()=>{if(!(i<0)&&a)return s(),()=>c()}),[c,s,a,i]),{set:s,reset:l,clear:c}}function Te({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),i=W((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];k(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",i),()=>t.removeEventListener("keydown",i)}),[e,i]),r}const Ye={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function Xe(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)(Ye),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:i,clientY:a,pageX:s,pageY:c}=t;let l=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();l=i-t.left,u=a-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:i,clientY:a,pageX:s,pageY:c,elementRelativeX:l,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const De=()=>navigator.onLine,Ve=()=>!0,Ae=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function We({onlineAction:e=E,offlineAction:t=E}={}){const n=W((n=>Ae(n,e,t)));return(0,o.useSyncExternalStore)(n,De,Ve)}function _e(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const ze={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Be(e=E){const[t,n]=(0,o.useState)(ze),r=(0,o.useRef)(null),i=W((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(i);return t.observe(e),()=>{t.unobserve(e)}}),[i]),{ref:r,contentRect:t}}function Je({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),i=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>i())),[e,r,i]),{ref:t,lock:r,unlock:i}}const He=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,Ke=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:i=0,alignY:a="start",alignX:s="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+i+He(window.innerHeight,r.height,a),left:r.left+window.scrollX+o+He(window.innerWidth,r.width,s)};const c=e.getBoundingClientRect();return{top:r.top-c.top+e.scrollTop+i+He(c.height,r.height,a),left:r.left-c.left+e.scrollLeft+o+He(c.width,r.width,s)}};function Ue(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:i,top:a}=Ke(r,t,n);r.scrollTo({top:a,left:i,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ze=me("sessionStorage"),Ge=e=>window.sessionStorage.getItem(e),Qe=e=>JSON.stringify(e),qe=e=>(Ze.subscribe(e),()=>{Ze.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=k(n)?n():n,i=(0,o.useSyncExternalStore)(qe,(()=>Ge(t)),(()=>Qe(r)));return{state:(0,o.useMemo)((()=>i?I(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=Ge(t),o=n?I(n):r,i=k(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(i)),Ze.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ze.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:i}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[a,s]=(0,o.useState)(n),c=(0,o.useCallback)((e=>{s((t=>{const n=k(e)?e(t):e;return r&&i&&function(e,t,n){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=k(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,i,n),n}))}),[r,i]),l=(0,o.useCallback)((()=>{r&&i&&function(e,t){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,i),s(null)}),[r,i]);return Object.assign({state:a,setState:c,clearState:l},Ie(e))}function nt(e,t,n={}){const r=W(e),i=z(n),a=(0,o.useMemo)((()=>(0,s.A)(r,t,i)),[r,t,i]);return _((()=>a.cancel())),a}const rt=e=>{var t;return C(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=W(e),{delay:i,enabled:a}=rt(t),s=(0,o.useCallback)((()=>{n.current=setTimeout(r,i)}),[r,i]),c=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{c(),s()}),[c,s]);return(0,o.useEffect)((()=>{if(!(i<0)&&a)return s(),()=>c()}),[s,c,i,a]),{set:s,reset:l,clear:c}}function it(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function at(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new c.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function st({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const ct={width:null,height:null};function lt({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>m()?ct:{width:window.innerWidth,height:window.innerHeight})),r=B(n,e),i=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",i),t}function ut(e,t,n){const{delay:r,enabled:i}=rt(t),{set:a,reset:s,clear:c}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!i||s()}),[r,i,s,...n]),{set:a,reset:s,clear:c}}}}]);
\ No newline at end of file
diff --git a/assets/js/1c2388cf.d917f60e.js b/assets/js/1c2388cf.d917f60e.js
new file mode 100644
index 000000000..87cae0abd
--- /dev/null
+++ b/assets/js/1c2388cf.d917f60e.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[8933],{3038:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>p,assets:()=>u,contentTitle:()=>l,default:()=>h,frontMatter:()=>d,metadata:()=>r,toc:()=>m});const r=JSON.parse('{"id":"react/components/SeparatedIterator","title":"SeparatedIterator","description":"Iterator\ub97c \ud655\uc7a5\ud574 items props\ub85c \uc8fc\uc5b4\uc9c4 \ubc30\uc5f4\uc744 \ubc18\ubcf5\ud558\uba74\uc11c \uac01 \ud56d\ubaa9\uc5d0 \ub300\ud574 \ud2b9\uc815 \uc694\uc18c \ubc0f \ucef4\ud3ec\ub10c\ud2b8\ub97c \ub80c\ub354\ub9c1\ud558\uba70, \ub3d9\uc2dc\uc5d0 \uac01 \uc694\uc18c \uc0ac\uc774\uc5d0 \uad6c\ubd84\uc790(Separator)\ub97c \ub80c\ub354\ub9c1 \ud558\ub294 \ucef4\ud3ec\ub10c\ud2b8\uc785\ub2c8\ub2e4.","source":"@site/docs/react/components/SeparatedIterator.mdx","sourceDirName":"react/components","slug":"/react/components/SeparatedIterator","permalink":"/modern-kit/docs/react/components/SeparatedIterator","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"Portal","permalink":"/modern-kit/docs/react/components/Portal"},"next":{"title":"Slot","permalink":"/modern-kit/docs/react/components/Slot"}}');var o=n(6206),i=n(3267),a=n(4382),c=n(8111);const s=({itemKey:e,items:t=[],separator:n,renderItem:r,separatorInterval:i=1,includeLastSeparator:s=!1})=>{const d=(0,a.useCallback)((e=>e===t.length-1?s:(e+1)%i==0),[s,i,t.length]);return(0,o.jsx)(c.f,{items:t,itemKey:e,renderItem:(e,t)=>(0,o.jsxs)(o.Fragment,{children:[r(e,t),d(t)&&n]})})},d={},l="SeparatedIterator",u={},p=()=>{const e={div:"div",h3:"h3",...(0,i.R)()};return(0,o.jsx)(s,{items:[{id:1,name:"Gromit"},{id:2,name:"Dylan"},{id:3,name:"Minjae"}],renderItem:t=>(0,o.jsxs)(e.h3,{children:["id: ",t.id,", name: ",t.name]}),separator:(0,o.jsx)(e.div,{style:{height:"3px",backgroundColor:"gray"}})})},m=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function f(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"separatediterator",children:"SeparatedIterator"})}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.a,{href:"https://modern-agile-team.github.io/modern-kit/docs/react/components/Iterator",children:"Iterator"}),"\ub97c \ud655\uc7a5\ud574 ",(0,o.jsx)(t.code,{children:"items props"}),"\ub85c \uc8fc\uc5b4\uc9c4 \ubc30\uc5f4\uc744 \ubc18\ubcf5\ud558\uba74\uc11c \uac01 \ud56d\ubaa9\uc5d0 \ub300\ud574 ",(0,o.jsx)(t.code,{children:"\ud2b9\uc815 \uc694\uc18c \ubc0f \ucef4\ud3ec\ub10c\ud2b8"}),"\ub97c \ub80c\ub354\ub9c1\ud558\uba70, \ub3d9\uc2dc\uc5d0 \uac01 \uc694\uc18c \uc0ac\uc774\uc5d0 ",(0,o.jsx)(t.code,{children:"\uad6c\ubd84\uc790(Separator)"}),"\ub97c \ub80c\ub354\ub9c1 \ud558\ub294 \ucef4\ud3ec\ub10c\ud2b8\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:["\uae30\ubcf8\uc801\uc73c\ub85c \ub9c8\uc9c0\ub9c9 \uc694\uc18c\uc758 ",(0,o.jsx)(t.code,{children:"Separator"}),"\ub294 \uc81c\uc678\ub429\ub2c8\ub2e4. \ud558\uc9c0\ub9cc, ",(0,o.jsx)(t.code,{children:"includeLastSeparator"}),"\ub97c ",(0,o.jsx)(t.code,{children:"true"}),"\ub85c \uc124\uc815\ud558\uba74 \ud3ec\ud568\uc2dc\ud0ac \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:["\ub610\ud55c, ",(0,o.jsx)(t.code,{children:"separatorInterval"}),"\ub97c \ud65c\uc6a9\ud574 \ud2b9\uc815 ",(0,o.jsx)(t.code,{children:"\uac04\uaca9"})," \ub9cc\ud07c Separator\ub97c \ub80c\ub354\ub9c1 \ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/components/SeparatedIterator/index.tsx",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"interface SeparatedIteratorProps extends IteratorProps {\n separator: JSX.Element;\n separatorInterval?: number; // default: 1\n includeLastSeparator?: boolean; // default: false\n}\n\nconst SeparatedIterator: ({\n itemKey,\n items,\n separator,\n renderItem,\n separatorInterval,\n includeLastSeparator,\n}: SeparatedIteratorProps) => JSX.Element;\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { SeparatedIterator } from '@modern-kit/react';\n\ninterface Item {\n id: number;\n name: string;\n}\n\nconst Example = () => {\n const items: Item[] = [\n { id: 1, name: 'Gromit' },\n { id: 2, name: 'Dylan' },\n { id: 3, name: 'Minjae' },\n ];\n\n return (\n (\n \n id: {item.id}, name: {item.name}\n
\n )}\n separator={}\n />\n );\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(p,{})]})}function h(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(f,{...e})}):f(e)}},3267:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>c});var r=n(4382);const o={},i=r.createContext(o);function a(e){const t=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:a(e.components),r.createElement(i.Provider,{value:t},e.children)}},8111:(e,t,n)=>{n.d(t,{f:()=>a});var r=n(6206),o=n(9340),i=n(4382);const a=({items:e=[],itemKey:t,renderItem:n})=>{const a=(0,i.useCallback)(((e,n)=>(0,o.Qd)(e)?(null==e?void 0:e[t])||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(i.Fragment,{children:n(e,t)},a(e,t))))})}},9340:(e,t,n)=>{function r(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(t){i(t)}}function c(e){try{s(r.throw(e))}catch(t){i(t)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))}n.d(t,{Et:()=>y,Fr:()=>c,Gp:()=>x,Ol:()=>k,Qd:()=>j,S$:()=>a,Tn:()=>w,Zp:()=>p,dK:()=>d,fl:()=>F,gD:()=>v,i5:()=>f,if:()=>m,l6:()=>S,lQ:()=>I,nS:()=>u,ni:()=>$,oc:()=>s}),"function"==typeof SuppressedError&&SuppressedError;const o={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};const i=(e,t)=>new Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function a(){return"undefined"==typeof window}function c(){if(a())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}function s(){return!a()}function d(e){return r(this,void 0,void 0,(function*(){if(!s())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const l=e=>r(void 0,void 0,void 0,(function*(){const t=yield fetch(e);return d(yield t.text())}));function u(e,t){var n;return r(this,void 0,void 0,(function*(){if(!s())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator))return l(e);if(!("write"in window.navigator.clipboard))return l(e);if(null!==(n=null==t?void 0:t.toText)&&void 0!==n&&n)return l(e);const a=yield function(e,t="png"){return new Promise(((n,a)=>{const c=new Image;c.onload=()=>r(this,void 0,void 0,(function*(){const e=document.createElement("canvas");e.width=c.width,e.height=c.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(c,0,0);const a=yield i(e,o[t]);n(a)}catch(r){console.error(`Failed to load image. message: ${r.mesaage}`),a(r)}})),c.onerror=()=>{a(new Error("Failed to load image"))},c.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[a.type]:a})]),a}catch(a){throw console.error(`Failed to copy to clipboard. message: ${a.message}`),a}}))}function p(){return r(this,void 0,void 0,(function*(){if(!s())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function m(){return r(this,void 0,void 0,(function*(){if(!s())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function f(e,t){return Object.prototype.hasOwnProperty.call(e,t)}const h=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i=0;i{if(e===t)return!0;if(y(e)&&y(t)&&isNaN(e)&&isNaN(t))return!0;if(w(e)&&w(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return h(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!g(o,t.get(r),n))return!1;return!0}return h(e,t,n)};function x(e,t){return g(e,t,new WeakMap)}function w(e){return"function"==typeof e}function v(e){return null==e}function y(e){return"number"==typeof e}function b(e){return!function(e){return Object(e)!==e}(e)}function j(e){return b(e)&&"[object Object]"===Object.prototype.toString.call(e)}function S(e){return e===window}function I(){}function k(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}function E(e){return Object.keys(e)}const C={days:864e5,hours:36e5,minutes:6e4,seconds:1e3};E(C);function F(e,t){if(!s())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}function $(e,t,n){if(!s())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=w(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}}}]);
\ No newline at end of file
diff --git a/assets/js/1ebcacad.43280e43.js b/assets/js/1ebcacad.43280e43.js
new file mode 100644
index 000000000..bcc1bc268
--- /dev/null
+++ b/assets/js/1ebcacad.43280e43.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[1623],{4872:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>u,assets:()=>p,contentTitle:()=>d,default:()=>g,frontMatter:()=>l,metadata:()=>r,toc:()=>S});const r=JSON.parse('{"id":"react/hooks/useStepState","title":"useStepState","description":"useStep \uc744 \ud655\uc7a5\ud574 multi-step process\uc758 step\uc744 \uad00\ub9ac \ubc0f \ucd94\uc801\ud558\uba70 \ub3d9\uc2dc\uc5d0 \ub0b4\ubd80 \uc0c1\ud0dc\ub97c \uad00\ub9ac \ud560 \uc218 \uc788\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useStepState.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useStepState","permalink":"/modern-kit/docs/react/hooks/useStepState","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useStep","permalink":"/modern-kit/docs/react/hooks/useStep"},"next":{"title":"useThrottle","permalink":"/modern-kit/docs/react/hooks/useThrottle"}}');var o=n(6206),i=n(3267),s=n(9340),a=n(4731),c=n(4382);const l={},d="useStepState",p={},u=()=>{const e={button:"button",div:"div",p:"p",...(0,i.R)()},{state:t,setState:n,clearState:r,currentStep:l,goToNextStep:d,goToPrevStep:p}=function(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:o}=null!==(t=null==e?void 0:e.storageOptions)&&void 0!==t?t:{},[i,l]=(0,c.useState)(n),d=(0,c.useCallback)((e=>{l((t=>{const n=(0,s.Tn)(e)?e(t):e;return r&&o&&(0,s.ni)(r,o,n),n}))}),[r,o]),p=(0,c.useCallback)((()=>{r&&o&&(0,s.fl)(r,o),l(null)}),[r,o]);return Object.assign({state:i,setState:d,clearState:p},(0,a.o)(e))}({maxStep:2,initialState:{name:""},storageOptions:{key:"stepState",type:"sessionStorage"}}),u={width:"300px",height:"120px",fontSize:"21px"};return(0,o.jsxs)(e.div,{children:[(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.button,{onClick:()=>{p((({prevStep:e,nextStep:t})=>{console.log(`${e}\uc5d0\uc11c ${t}\ub85c \uc774\ub3d9`),n({name:"foo"})}))},children:"\uc774\uc804 \uc2a4\ud0ed"}),(0,o.jsx)(e.button,{onClick:()=>{d((({prevStep:e,nextStep:t})=>{console.log(`${e}\uc5d0\uc11c ${t}\ub85c \uc774\ub3d9`),n({name:"bar"})}))},children:"\ub2e4\uc74c \uc2a4\ud0ed"}),(0,o.jsx)(e.button,{onClick:r,children:"\uc0c1\ud0dc \ucd08\uae30\ud654"})]}),(0,o.jsxs)(e.div,{children:[(0,o.jsxs)(e.p,{children:["currentStep: ",l]}),(0,o.jsxs)(e.p,{children:["state: ",JSON.stringify(t)]})]}),(0,o.jsxs)(e.div,{children:[1===l&&(0,o.jsx)(e.div,{style:{...u,backgroundColor:"red"},children:"1\ubc88 Step Box"}),2===l&&(0,o.jsx)(e.div,{style:{...u,backgroundColor:"green"},children:"2\ubc88 Step Box"})]})]})},S=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2},{value:"Best Practice",id:"best-practice",level:2}];function h(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"usestepstate",children:"useStepState"})}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.strong,{children:(0,o.jsx)(t.a,{href:"https://modern-agile-team.github.io/modern-kit/docs/react/hooks/useStep",children:"useStep"})})," \uc744 \ud655\uc7a5\ud574 ",(0,o.jsx)(t.code,{children:"multi-step process"}),"\uc758 ",(0,o.jsx)(t.code,{children:"step"}),"\uc744 \uad00\ub9ac \ubc0f \ucd94\uc801\ud558\uba70 \ub3d9\uc2dc\uc5d0 ",(0,o.jsx)(t.code,{children:"\ub0b4\ubd80 \uc0c1\ud0dc"}),"\ub97c \uad00\ub9ac \ud560 \uc218 \uc788\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"storageOptions"}),"\ub97c \ud65c\uc6a9\ud574 ",(0,o.jsx)(t.code,{children:"setState"})," \uc2dc\uc5d0 \ube0c\ub77c\uc6b0\uc800 \uc2a4\ud1a0\ub9ac\uc9c0(",(0,o.jsx)(t.code,{children:"sessionStorage"}),", ",(0,o.jsx)(t.code,{children:"localStorage"}),")\uc5d0 \uc0c1\ud0dc\ub97c \uc800\uc7a5 \ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"clearState"}),"\ub294 state\ub97c ",(0,o.jsx)(t.code,{children:"null"}),"\ub85c \ucd08\uae30\ud654\ud569\ub2c8\ub2e4. ",(0,o.jsx)(t.code,{children:"storageOptions"}),"\uac00 \uc788\uc744 \uacbd\uc6b0 \ud574\ub2f9 ",(0,o.jsx)(t.code,{children:"options"}),"\uc5d0 \ub300\uc751\ud558\ub294 \uc2a4\ud1a0\ub9ac\uc9c0 \ub370\uc774\ud130\ub97c \uc81c\uac70\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useStepState/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"interface StorageOptions {\n key: string;\n type: 'localStorage' | 'sessionStorage';\n}\n\ninterface UseStepWithInitialState extends UseStepProps {\n initialState: T;\n storageOptions?: StorageOptions;\n}\n\ninterface UseStepWithoutInitialState extends UseStepProps {\n storageOptions?: StorageOptions;\n}\n"})}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"// \ud568\uc218 \uc624\ubc84\ub85c\ub529\nexport function useStepState({\n initialState,\n ...props\n}: UseStepWithInitialState): ReturnType & {\n readonly state: T;\n readonly setState: (newState: SetStateAction) => void;\n readonly clearState: () => void;\n};\n\nexport function useStepState(props: UseStepWithoutInitialState): ReturnType<\n typeof useStep\n> & {\n readonly state: T | null;\n readonly setState: (newState: SetStateAction) => void;\n readonly clearState: () => void;\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useStepState } from '@modern-kit/react';\n\nexport const Example = () => {\n const { state, setState, clearState, currentStep, goToNextStep, goToPrevStep } =\n useStepState({\n maxStep: 2,\n initialState: { name: '' },\n storageOptions: { key: 'stepState', type: 'sessionStorage' },\n });\n\n const handleGoToNextStep = () => {\n goToNextStep(({ prevStep, nextStep }) => {\n console.log(`${prevStep}\uc5d0\uc11c ${nextStep}\ub85c \uc774\ub3d9`);\n setState({ name: 'bar' });\n });\n };\n\n const handleGoToPrevStep = () => {\n goToPrevStep(({ prevStep, nextStep }) => {\n console.log(`${prevStep}\uc5d0\uc11c ${nextStep}\ub85c \uc774\ub3d9`);\n setState({ name: 'foo' });\n });\n };\n\n const boxStyle = {\n width: '300px',\n height: '120px',\n fontSize: '21px',\n };\n\n return (\n \n
\n \n \n \n
\n
\n
currentStep: {currentStep}
\n
state: {JSON.stringify(state)}
\n
\n
\n {currentStep === 1 && (\n
\n 1\ubc88 Step Box\n
\n )}\n {currentStep === 2 && (\n
\n 2\ubc88 Step Box\n
\n )}\n
\n
\n );\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(u,{}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"best-practice",children:"Best Practice"}),"\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsxs)(t.li,{children:["\ube0c\ub77c\uc6b0\uc800 \uc0c8\ub85c\uace0\uce68 \uc2dc \uc0c1\ud0dc\ub97c \uc801\uc808\ud558\uac8c \uc720\uc9c0\ud558\uace0 \uc2f6\ub2e4\uba74 ",(0,o.jsx)(t.code,{children:"queryString"}),"\uacfc ",(0,o.jsx)(t.code,{children:"react-router-dom"}),"\uc744 \ud568\uaed8 \uc0ac\uc6a9\ud558\ub294 \uac83\uc744 \uad8c\uc7a5\ud569\ub2c8\ub2e4."]}),"\n"]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",children:"import { useStepState } from '@modern-kit/react';\nimport { useNavigate } from 'react-router-dom'\nimport qs from 'query-string'\n\nconst Example = () => {\n const parsedStorage = JSON.parse(sessionStorage.getItem('stepState'));\n const parsedQuery = qs.parse(location.search);\n\n const navigate = useNavigate();\n\n const { state, setState, goToNextStep, goToPrevStep } = useStepState({\n maxStep: 5,\n initialState: parsedStorage,\n initialStep: parsedQuery.step,\n storageOptions: { key: 'stepState', type: 'sessionStorage' },\n });\n\n const handleGoToNextStep = () => {\n goToNextStep(({ nextStep }) => {\n setState({\n /* ... */\n });\n navigate(`/test?step=${nextStep}`);\n });\n };\n\n const handleGoToPrevStep = () => {\n goToNextStep(({ nextStep }) => {\n setState({\n /* ... */\n });\n navigate(`/test?step=${nextStep}`);\n });\n };\n\n // ...\n return (\n // ...\n );\n};\n"})})]})}function g(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(h,{...e})}):h(e)}},3267:(e,t,n)=>{n.d(t,{R:()=>s,x:()=>a});var r=n(4382);const o={},i=r.createContext(o);function s(e){const t=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:s(e.components),r.createElement(i.Provider,{value:t},e.children)}},4731:(e,t,n)=>{n.d(t,{o:()=>i});var r=n(4382),o=n(9340);function i({maxStep:e,initialStep:t=0,infinite:n=!1}){const[i,s]=(0,r.useState)(t),a=i0,l=(0,r.useCallback)(((t,n)=>{const r="nextStep"===t;return n?r?0:e:r?i+1:i-1}),[e,i]),d=(0,r.useCallback)(((e,t,r)=>{if(t&&!n)return;const o=l(e,t);r&&r({prev:i,next:o}),s(o)}),[n,i,l]),p=(0,r.useCallback)((e=>{d("nextStep",!a,e)}),[a,d]),u=(0,r.useCallback)((e=>{d("prevStep",!c,e)}),[c,d]),S=(0,r.useCallback)(((t,n)=>{const r=(0,o.Tn)(t)?t(i):t;if(r>=0&&r<=e)return n&&n({prev:i,next:r}),void s(t);throw new Error("Step not valid")}),[i,e]),h=(0,r.useCallback)((e=>{e&&e({prev:i,next:t}),s(t)}),[i,t]);return{currentStep:i,hasNextStep:a,hasPrevStep:c,goToNextStep:p,goToPrevStep:u,setStep:S,resetStep:h}}},9340:(e,t,n)=>{function r(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(t){i(t)}}function a(e){try{c(r.throw(e))}catch(t){i(t)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}n.d(t,{Et:()=>y,Fr:()=>a,Gp:()=>f,Ol:()=>T,Qd:()=>w,S$:()=>s,Tn:()=>m,Zp:()=>u,dK:()=>l,fl:()=>N,gD:()=>v,i5:()=>h,if:()=>S,l6:()=>j,lQ:()=>k,nS:()=>p,ni:()=>E,oc:()=>c}),"function"==typeof SuppressedError&&SuppressedError;const o={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};const i=(e,t)=>new Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function s(){return"undefined"==typeof window}function a(){if(s())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}function c(){return!s()}function l(e){return r(this,void 0,void 0,(function*(){if(!c())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const d=e=>r(void 0,void 0,void 0,(function*(){const t=yield fetch(e);return l(yield t.text())}));function p(e,t){var n;return r(this,void 0,void 0,(function*(){if(!c())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator))return d(e);if(!("write"in window.navigator.clipboard))return d(e);if(null!==(n=null==t?void 0:t.toText)&&void 0!==n&&n)return d(e);const s=yield function(e,t="png"){return new Promise(((n,s)=>{const a=new Image;a.onload=()=>r(this,void 0,void 0,(function*(){const e=document.createElement("canvas");e.width=a.width,e.height=a.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(a,0,0);const s=yield i(e,o[t]);n(s)}catch(r){console.error(`Failed to load image. message: ${r.mesaage}`),s(r)}})),a.onerror=()=>{s(new Error("Failed to load image"))},a.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[s.type]:s})]),s}catch(s){throw console.error(`Failed to copy to clipboard. message: ${s.message}`),s}}))}function u(){return r(this,void 0,void 0,(function*(){if(!c())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function S(){return r(this,void 0,void 0,(function*(){if(!c())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function h(e,t){return Object.prototype.hasOwnProperty.call(e,t)}const g=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i=0;i{if(e===t)return!0;if(y(e)&&y(t)&&isNaN(e)&&isNaN(t))return!0;if(m(e)&&m(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return g(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!x(o,t.get(r),n))return!1;return!0}return g(e,t,n)};function f(e,t){return x(e,t,new WeakMap)}function m(e){return"function"==typeof e}function v(e){return null==e}function y(e){return"number"==typeof e}function b(e){return!function(e){return Object(e)!==e}(e)}function w(e){return b(e)&&"[object Object]"===Object.prototype.toString.call(e)}function j(e){return e===window}function k(){}function T(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}function C(e){return Object.keys(e)}const O={days:864e5,hours:36e5,minutes:6e4,seconds:1e3};C(O);function N(e,t){if(!c())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}function E(e,t,n){if(!c())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=m(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}}}]);
\ No newline at end of file
diff --git a/assets/js/1ebcacad.ece260fc.js b/assets/js/1ebcacad.ece260fc.js
deleted file mode 100644
index a8bfb2d76..000000000
--- a/assets/js/1ebcacad.ece260fc.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[1623],{2639:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>u,assets:()=>l,contentTitle:()=>c,default:()=>f,frontMatter:()=>a,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"react/hooks/useStepState","title":"useStepState","description":"useStep \uc744 \ud655\uc7a5\ud574 multi-step process\uc758 step\uc744 \uad00\ub9ac \ubc0f \ucd94\uc801\ud558\uba70 \ub3d9\uc2dc\uc5d0 \ub0b4\ubd80 \uc0c1\ud0dc\ub97c \uad00\ub9ac \ud560 \uc218 \uc788\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useStepState.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useStepState","permalink":"/modern-kit/docs/react/hooks/useStepState","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useStep","permalink":"/modern-kit/docs/react/hooks/useStep"},"next":{"title":"useThrottle","permalink":"/modern-kit/docs/react/hooks/useThrottle"}}');var o=n(6206),s=n(3267),i=n(4027);n(4382);const a={},c="useStepState",l={},u=()=>{const e={button:"button",div:"div",p:"p",...(0,s.R)()},{state:t,setState:n,clearState:r,currentStep:a,goToNextStep:c,goToPrevStep:l}=(0,i.xh)({maxStep:2,initialState:{name:""},storageOptions:{key:"stepState",type:"sessionStorage"}}),u={width:"300px",height:"120px",fontSize:"21px"};return(0,o.jsxs)(e.div,{children:[(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.button,{onClick:()=>{l((({prevStep:e,nextStep:t})=>{console.log(`${e}\uc5d0\uc11c ${t}\ub85c \uc774\ub3d9`),n({name:"foo"})}))},children:"\uc774\uc804 \uc2a4\ud0ed"}),(0,o.jsx)(e.button,{onClick:()=>{c((({prevStep:e,nextStep:t})=>{console.log(`${e}\uc5d0\uc11c ${t}\ub85c \uc774\ub3d9`),n({name:"bar"})}))},children:"\ub2e4\uc74c \uc2a4\ud0ed"}),(0,o.jsx)(e.button,{onClick:r,children:"\uc0c1\ud0dc \ucd08\uae30\ud654"})]}),(0,o.jsxs)(e.div,{children:[(0,o.jsxs)(e.p,{children:["currentStep: ",a]}),(0,o.jsxs)(e.p,{children:["state: ",JSON.stringify(t)]})]}),(0,o.jsxs)(e.div,{children:[1===a&&(0,o.jsx)(e.div,{style:{...u,backgroundColor:"red"},children:"1\ubc88 Step Box"}),2===a&&(0,o.jsx)(e.div,{style:{...u,backgroundColor:"green"},children:"2\ubc88 Step Box"})]})]})},d=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2},{value:"Best Practice",id:"best-practice",level:2}];function p(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,s.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"usestepstate",children:"useStepState"})}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.strong,{children:(0,o.jsx)(t.a,{href:"https://modern-agile-team.github.io/modern-kit/docs/react/hooks/useStep",children:"useStep"})})," \uc744 \ud655\uc7a5\ud574 ",(0,o.jsx)(t.code,{children:"multi-step process"}),"\uc758 ",(0,o.jsx)(t.code,{children:"step"}),"\uc744 \uad00\ub9ac \ubc0f \ucd94\uc801\ud558\uba70 \ub3d9\uc2dc\uc5d0 ",(0,o.jsx)(t.code,{children:"\ub0b4\ubd80 \uc0c1\ud0dc"}),"\ub97c \uad00\ub9ac \ud560 \uc218 \uc788\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"storageOptions"}),"\ub97c \ud65c\uc6a9\ud574 ",(0,o.jsx)(t.code,{children:"setState"})," \uc2dc\uc5d0 \ube0c\ub77c\uc6b0\uc800 \uc2a4\ud1a0\ub9ac\uc9c0(",(0,o.jsx)(t.code,{children:"sessionStorage"}),", ",(0,o.jsx)(t.code,{children:"localStorage"}),")\uc5d0 \uc0c1\ud0dc\ub97c \uc800\uc7a5 \ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"clearState"}),"\ub294 state\ub97c ",(0,o.jsx)(t.code,{children:"null"}),"\ub85c \ucd08\uae30\ud654\ud569\ub2c8\ub2e4. ",(0,o.jsx)(t.code,{children:"storageOptions"}),"\uac00 \uc788\uc744 \uacbd\uc6b0 \ud574\ub2f9 ",(0,o.jsx)(t.code,{children:"options"}),"\uc5d0 \ub300\uc751\ud558\ub294 \uc2a4\ud1a0\ub9ac\uc9c0 \ub370\uc774\ud130\ub97c \uc81c\uac70\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useStepState/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"interface StorageOptions {\n key: string;\n type: 'localStorage' | 'sessionStorage';\n}\n\ninterface UseStepWithInitialState extends UseStepProps {\n initialState: T;\n storageOptions?: StorageOptions;\n}\n\ninterface UseStepWithoutInitialState extends UseStepProps {\n storageOptions?: StorageOptions;\n}\n"})}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"// \ud568\uc218 \uc624\ubc84\ub85c\ub529\nexport function useStepState({\n initialState,\n ...props\n}: UseStepWithInitialState): ReturnType & {\n readonly state: T;\n readonly setState: (newState: SetStateAction) => void;\n readonly clearState: () => void;\n};\n\nexport function useStepState(props: UseStepWithoutInitialState): ReturnType<\n typeof useStep\n> & {\n readonly state: T | null;\n readonly setState: (newState: SetStateAction) => void;\n readonly clearState: () => void;\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useStepState } from '@modern-kit/react';\n\nexport const Example = () => {\n const { state, setState, clearState, currentStep, goToNextStep, goToPrevStep } =\n useStepState({\n maxStep: 2,\n initialState: { name: '' },\n storageOptions: { key: 'stepState', type: 'sessionStorage' },\n });\n\n const handleGoToNextStep = () => {\n goToNextStep(({ prevStep, nextStep }) => {\n console.log(`${prevStep}\uc5d0\uc11c ${nextStep}\ub85c \uc774\ub3d9`);\n setState({ name: 'bar' });\n });\n };\n\n const handleGoToPrevStep = () => {\n goToPrevStep(({ prevStep, nextStep }) => {\n console.log(`${prevStep}\uc5d0\uc11c ${nextStep}\ub85c \uc774\ub3d9`);\n setState({ name: 'foo' });\n });\n };\n\n const boxStyle = {\n width: '300px',\n height: '120px',\n fontSize: '21px',\n };\n\n return (\n \n
\n \n \n \n
\n
\n
currentStep: {currentStep}
\n
state: {JSON.stringify(state)}
\n
\n
\n {currentStep === 1 && (\n
\n 1\ubc88 Step Box\n
\n )}\n {currentStep === 2 && (\n
\n 2\ubc88 Step Box\n
\n )}\n
\n
\n );\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(u,{}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"best-practice",children:"Best Practice"}),"\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsxs)(t.li,{children:["\ube0c\ub77c\uc6b0\uc800 \uc0c8\ub85c\uace0\uce68 \uc2dc \uc0c1\ud0dc\ub97c \uc801\uc808\ud558\uac8c \uc720\uc9c0\ud558\uace0 \uc2f6\ub2e4\uba74 ",(0,o.jsx)(t.code,{children:"queryString"}),"\uacfc ",(0,o.jsx)(t.code,{children:"react-router-dom"}),"\uc744 \ud568\uaed8 \uc0ac\uc6a9\ud558\ub294 \uac83\uc744 \uad8c\uc7a5\ud569\ub2c8\ub2e4."]}),"\n"]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",children:"import { useStepState } from '@modern-kit/react';\nimport { useNavigate } from 'react-router-dom'\nimport qs from 'query-string'\n\nconst Example = () => {\n const parsedStorage = JSON.parse(sessionStorage.getItem('stepState'));\n const parsedQuery = qs.parse(location.search);\n\n const navigate = useNavigate();\n\n const { state, setState, goToNextStep, goToPrevStep } = useStepState({\n maxStep: 5,\n initialState: parsedStorage,\n initialStep: parsedQuery.step,\n storageOptions: { key: 'stepState', type: 'sessionStorage' },\n });\n\n const handleGoToNextStep = () => {\n goToNextStep(({ nextStep }) => {\n setState({\n /* ... */\n });\n navigate(`/test?step=${nextStep}`);\n });\n };\n\n const handleGoToPrevStep = () => {\n goToNextStep(({ nextStep }) => {\n setState({\n /* ... */\n });\n navigate(`/test?step=${nextStep}`);\n });\n };\n\n // ...\n return (\n // ...\n );\n};\n"})})]})}function f(e={}){const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(p,{...e})}):p(e)}},4027:(e,t,n)=>{n.d(t,{$$:()=>Le,$I:()=>oe,AE:()=>Ve,BL:()=>J,DX:()=>N,FT:()=>at,Fo:()=>et,Hn:()=>st,I5:()=>Ee,JF:()=>Me,K:()=>le,K$:()=>Ue,M0:()=>Te,ML:()=>ne,Mj:()=>be,Mk:()=>$e,Mo:()=>se,NT:()=>Be,QV:()=>He,Ub:()=>xe,Ut:()=>Ce,W7:()=>H,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>ze,Zu:()=>ce,_1:()=>Re,_g:()=>nt,aL:()=>U,aY:()=>Ne,bB:()=>W,d7:()=>_,eG:()=>it,fN:()=>ae,fm:()=>Z,gl:()=>L,hN:()=>X,iD:()=>de,iQ:()=>Pe,jd:()=>ie,lW:()=>lt,oD:()=>G,oo:()=>Oe,pL:()=>Q,qi:()=>ue,rN:()=>Ie,tD:()=>ke,u8:()=>q,wY:()=>_e,xV:()=>P,xh:()=>tt,zy:()=>K});var r=n(6206),o=n(4382),s=n(3683),i=n(5086),a=n(7197),c=(n(1604),n(5938));function l(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function g(){return typeof window>"u"}function m(){return!g()}function S(e){return p(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const v=e=>p(void 0,0,void 0,(function*(){return S(yield(yield fetch(e)).text())}));function w(e,t){var n;return p(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return v(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>p(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const s=yield h(e,f[t]);n(s)}catch(s){console.error(`Failed to load image. message: ${s.mesaage}`),r(s)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const b=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let s=0;s{if(e===t||j(e)&&j(t)&&isNaN(e)&&isNaN(t))return!0;if(k(e)&&k(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return b(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!y(o,t.get(r),n))return!1;return!0}return b(e,t,n)};function x(e,t){return y(e,t,new WeakMap)}function k(e){return"function"==typeof e}function j(e){return"number"==typeof e}function C(e){return!function(e){return Object(e)!==e}(e)}function E(){}function O(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const R=(...e)=>t=>e.forEach((e=>{if(k(e))e(t);else if(null!=e){e.current=t}}));function T(...e){return(0,o.useCallback)(R(...e),e)}const N=o.forwardRef(((e,t)=>{const{children:n}=e,s=l(e,["children"]),i=o.Children.toArray(n),a=i.find($);if(a){const e=a.props.children,n=i.map((t=>t===a?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(I,Object.assign({},s,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(I,Object.assign({},s,{ref:t,children:n}))}));N.displayName="Slot";const I=o.forwardRef(((e,t)=>{const{children:n}=e,r=l(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...e)=>{s(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),s):"className"===r&&(n[r]=[o,s].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?R(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));I.displayName="SlotClone";const P=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function $(e){return o.isValidElement(e)&&e.type===P}var F="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const L=d(((e,t)=>{var{ratio:n,style:o,as:i="div",asChild:a=!1}=e,c=l(e,["ratio","style","as","asChild"]);const u=a?N:i,d=Object.assign({aspectRatio:n},o),p=a?c.className:s(F,c.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:p},c))})),M=()=>E,Y=()=>!1,B=()=>!0;function W({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)(M,Y,B)?e:t}function A(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const X=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>A()?(0,r.jsx)(r.Fragment,{children:t}):e;function V(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function z(e){const t=V(e);(0,o.useEffect)((()=>()=>t()),[t])}function D(e,t=x){const[n,r]=(0,o.useState)(e),s=V(t);return(0,o.useEffect)((()=>{s(n,e)||r(e)}),[s,n,e]),n}function _(e,t,n){const r=V(e),s=D(n),a=(0,o.useMemo)((()=>(0,i.A)(r,t,s)),[r,t,s]);return z((()=>a.cancel())),a}const U=({children:e,capture:t,wait:n,options:r})=>{const s=o.Children.only(e),i=_(((...e)=>{const n=s?.props;if(n&&k(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(s,{[t]:i})};function J({onIntersectStart:e=E,onIntersectEnd:t=E,enabled:n=!0,calledOnce:r=!1,root:s=null,threshold:i=0,rootMargin:a="0px 0px 0px 0px"}){const c=(0,o.useRef)(0),l=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=V((([n],o)=>{if(!n)return;const s=n.target;n.isIntersecting?(l.current=!0,c.current+=1,e(n)):l.current&&(l.current=!1,c.current+=1,t(n)),r&&c.current>1&&o.unobserve(s)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:i,root:s,rootMargin:a}),u.current.observe(e))}),[n,i,s,a,d])}}const G=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:s,rootMargin:i}=e,a=l(e,["src","threshold","root","rootMargin"]);const{ref:c}=J({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:s,rootMargin:i});return(0,r.jsx)("img",Object.assign({ref:T(t,c)},a))}));G.displayName="LazyImage";const H=(0,o.forwardRef)(((e,t)=>{var{width:n,height:s,fallback:i,className:a,style:c,duration:u="0.2s",onLoad:d}=e,p=l(e,["width","height","fallback","className","style","duration","onLoad"]);const[f,h]=(0,o.useState)(!1),g=!f,m=(0,o.useMemo)((()=>({position:"relative",width:n,height:s})),[n,s]),S=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:g?0:1,transition:`opacity ${u}`},c)),[g,u,c]),v=(0,o.useCallback)((e=>{d&&d(e),h(!0)}),[d]),w=a?`lazy-image-wrapper ${a}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:w,style:m,children:[g&&i,(0,r.jsx)(G,Object.assign({ref:t,width:n,height:s,style:S,onLoad:v},p))]})}));H.displayName="FallbackLazyImage";const K=({condition:e,trueComponent:t,falseComponent:n})=>{const s=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:s?t:n})},q=({onScrollAction:e,children:t,root:n,threshold:o,enabled:s,triggerPosition:i="after",rootMargin:a="150px 0px"})=>{const{ref:c}=J({onIntersectStart:e,root:n,threshold:o,enabled:s,rootMargin:a});return(0,r.jsxs)(r.Fragment,{children:["before"===i&&(0,r.jsx)("div",{ref:c}),t,"after"===i&&(0,r.jsx)("div",{ref:c})]})},Q=d(((e,t)=>{var{children:n,as:s="div",asChild:i=!1}=e,a=l(e,["children","as","asChild"]);const c=i?N:s,{ref:u}=J(a);if(i&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(c,Object.assign({ref:R(t,u)},a,{children:n}))})),Z=({items:e=[],itemKey:t,renderItem:n})=>{const s=(0,o.useCallback)(((e,n)=>function(e){return C(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},s(e,t))))})},ee=m()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=V(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),s=(0,o.useMemo)((()=>function(){if(g())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,s,(({target:t})=>{if(!r.current)return;const o=r.current,s=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!s&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:s="div",asChild:i=!1,onPointerDown:a,excludeRefs:c=[]}=e,u=l(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(a,{excludeRefs:c}),p=i?N:s;if(i&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(p,Object.assign({ref:R(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const se=({itemKey:e,items:t=[],separator:n,renderItem:s,separatorInterval:i=1,includeLastSeparator:a=!1})=>{const c=(0,o.useCallback)((e=>e===t.length-1?a:(e+1)%i==0),[a,i,t.length]);return(0,r.jsx)(Z,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[s(e,t),c(t)&&n]})})},ie=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ae=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function ce(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function le(e=!0){const t=k(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!s.current){s.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{s.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),s=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield S(e);return t(n),!0}catch{return t(null),!1}}))),[]),i=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield w(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),a=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return p(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return p(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:s,copyImage:i,readText:a,readContents:c}}const pe="modern-kit-local-storage",fe="modern-kit-session-storage",he={localStorage:{key:pe,subscribe:e=>{window.addEventListener(pe,e)},unsubscribe:e=>{window.removeEventListener(pe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(pe))}},sessionStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}}},ge=e=>he[e],me=ge("localStorage"),Se=e=>window.localStorage.getItem(e),ve=e=>JSON.stringify(e),we=e=>(me.subscribe(e),()=>{me.unsubscribe(e)});function be(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=k(n)?n():n,s=(0,o.useSyncExternalStore)(we,(()=>Se(t)),(()=>ve(r)));return{state:(0,o.useMemo)((()=>s?O(s):r),[s,r]),setState:(0,o.useCallback)((e=>{try{const n=Se(t),o=n?O(n):r,s=k(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(s)),me.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),me.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const ye=(e,t)=>m()?window.matchMedia(e).matches:t??!1;function xe(e,t){const[n,r]=(0,o.useState)(ye(e,t)),s=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",s),n}function ke(){return xe("(prefers-color-scheme: dark)")?"dark":"light"}const je="color-scheme";function Ce({defaultValue:e,key:t=je,shouldSetBodyClass:n=!1}={}){const r=ke(),s=k(e)?e():e,{state:i,setState:a}=be({key:t,initialValue:s??r}),c=(0,o.useCallback)((()=>{a((e=>"dark"===e?"light":"dark"))}),[a]),l=(0,o.useCallback)((()=>{a("dark")}),[a]),u=(0,o.useCallback)((()=>{a("light")}),[a]),d=(0,o.useCallback)((()=>{a(r)}),[a,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(i),()=>{n&&document.body.classList.remove(i)})),[i,n]),{colorScheme:i,preferredColorScheme:r,setToggleMode:c,setDarkMode:l,setLightMode:u,setPreferredMode:d}}function Ee(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),s=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),i=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:s,reset:i}}function Oe({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,s]=(0,o.useState)(t),i=r0,c=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),l=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const i=c(e,t);o&&o({prev:r,next:i}),s(i)}),[n,r,c]),u=(0,o.useCallback)((e=>{l("nextStep",!i,e)}),[i,l]),d=(0,o.useCallback)((e=>{l("prevStep",!a,e)}),[a,l]),p=(0,o.useCallback)(((t,n)=>{const o=k(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void s(t);throw new Error("Step not valid")}),[r,e]),f=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),s(t)}),[r,t]);return{currentStep:r,hasNextStep:i,hasPrevStep:a,goToNextStep:u,goToPrevStep:d,setStep:p,resetStep:f}}function Re(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:s,resetStep:i}=Oe({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:s,resetIndex:i}}function Te(e,t,n={}){const[r,s]=(0,o.useState)(e);return[r,_(s,t,n)]}function Ne(e,t={}){const[n,r]=(0,o.useState)(""),[s,i]=Te("",e,t);return{value:n,debouncedValue:s,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),i(t)}),[i]),onReset:(0,o.useCallback)((()=>{r(""),i("")}),[i])}}function Ie(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Pe({onFocus:e=E,onBlur:t=E}={}){const[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(null),i=V((t=>{r(!0),e(t)})),a=V((e=>{r(!1),t(e)})),c=(0,o.useCallback)((()=>{s.current&&(s.current.focus(),r(!0))}),[]);return ne(s,"focus",i),ne(s,"blur",a),{ref:s,isFocus:n,setFocus:c}}function $e({onEnter:e=E,onLeave:t=E}={}){const[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(null),i=V((t=>{r(!0),e(t)})),a=V((e=>{r(!1),t(e)}));return ne(s,"mouseenter",i),ne(s,"mouseleave",a),{ref:s,isHovered:n}}const Fe=e=>{var t;return j(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function Le(e,t){const n=(0,o.useRef)(),r=V(e),{delay:s,enabled:i}=Fe(t),a=(0,o.useCallback)((()=>{n.current=window.setInterval(r,s)}),[r,s]),c=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{c(),a()}),[c,a]);return(0,o.useEffect)((()=>{if(!(s<0)&&i)return a(),()=>c()}),[c,a,i,s]),{set:a,reset:l,clear:c}}function Me({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),s=V((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];k(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",s),()=>t.removeEventListener("keydown",s)}),[e,s]),r}const Ye={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function Be(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)(Ye),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:s,clientY:i,pageX:a,pageY:c}=t;let l=null,u=null,d=null,p=null;if(e.current){const t=e.current.getBoundingClientRect();l=s-t.left,u=i-t.top,d=t.left+window.scrollX,p=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:s,clientY:i,pageX:a,pageY:c,elementRelativeX:l,elementRelativeY:u,elementPositionX:d,elementPositionY:p})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const We=()=>navigator.onLine,Ae=()=>!0,Xe=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function Ve({onlineAction:e=E,offlineAction:t=E}={}){const n=V((n=>Xe(n,e,t)));return(0,o.useSyncExternalStore)(n,We,Ae)}function ze(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const De={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function _e(e=E){const[t,n]=(0,o.useState)(De),r=(0,o.useRef)(null),s=V((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(s);return t.observe(e),()=>{t.unobserve(e)}}),[s]),{ref:r,contentRect:t}}function Ue({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),s=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>s())),[e,r,s]),{ref:t,lock:r,unlock:s}}const Je=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,Ge=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:s=0,alignY:i="start",alignX:a="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+s+Je(window.innerHeight,r.height,i),left:r.left+window.scrollX+o+Je(window.innerWidth,r.width,a)};const c=e.getBoundingClientRect();return{top:r.top-c.top+e.scrollTop+s+Je(c.height,r.height,i),left:r.left-c.left+e.scrollLeft+o+Je(c.width,r.width,a)}};function He(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:s,top:i}=Ge(r,t,n);r.scrollTo({top:i,left:s,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ke=ge("sessionStorage"),qe=e=>window.sessionStorage.getItem(e),Qe=e=>JSON.stringify(e),Ze=e=>(Ke.subscribe(e),()=>{Ke.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=k(n)?n():n,s=(0,o.useSyncExternalStore)(Ze,(()=>qe(t)),(()=>Qe(r)));return{state:(0,o.useMemo)((()=>s?O(s):r),[s,r]),setState:(0,o.useCallback)((e=>{try{const n=qe(t),o=n?O(n):r,s=k(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(s)),Ke.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ke.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:s}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[i,a]=(0,o.useState)(n),c=(0,o.useCallback)((e=>{a((t=>{const n=k(e)?e(t):e;return r&&s&&function(e,t,n){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=k(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,s,n),n}))}),[r,s]),l=(0,o.useCallback)((()=>{r&&s&&function(e,t){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,s),a(null)}),[r,s]);return Object.assign({state:i,setState:c,clearState:l},Oe(e))}function nt(e,t,n={}){const r=V(e),s=D(n),i=(0,o.useMemo)((()=>(0,a.A)(r,t,s)),[r,t,s]);return z((()=>i.cancel())),i}const rt=e=>{var t;return j(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=V(e),{delay:s,enabled:i}=rt(t),a=(0,o.useCallback)((()=>{n.current=setTimeout(r,s)}),[r,s]),c=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{c(),a()}),[c,a]);return(0,o.useEffect)((()=>{if(!(s<0)&&i)return a(),()=>c()}),[a,c,s,i]),{set:a,reset:l,clear:c}}function st(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function it(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new c.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function at({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const ct={width:null,height:null};function lt({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>g()?ct:{width:window.innerWidth,height:window.innerHeight})),r=_(n,e),s=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",s),t}function ut(e,t,n){const{delay:r,enabled:s}=rt(t),{set:i,reset:a,clear:c}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!s||a()}),[r,s,a,...n]),{set:i,reset:a,clear:c}}}}]);
\ No newline at end of file
diff --git a/assets/js/225c6dfe.4dfdc544.js b/assets/js/225c6dfe.4dfdc544.js
new file mode 100644
index 000000000..474e9a0bc
--- /dev/null
+++ b/assets/js/225c6dfe.4dfdc544.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[8034],{8177:(e,n,t)=>{t.r(n),t.d(n,{Example:()=>f,assets:()=>p,contentTitle:()=>d,default:()=>g,frontMatter:()=>u,metadata:()=>r,toc:()=>m});const r=JSON.parse('{"id":"react/hooks/useMouse","title":"useMouse","description":"\ub300\uc0c1 \uc5d8\ub9ac\uba3c\ud2b8\ub97c \uae30\uc900\uc73c\ub85c \ub9c8\uc6b0\uc2a4\uc758 \uc704\uce58\ub97c \ucd94\uc801\ud558\ub294 Hook\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useMouse.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useMouse","permalink":"/modern-kit/docs/react/hooks/useMouse","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useMergeRefs","permalink":"/modern-kit/docs/react/hooks/useMergeRefs"},"next":{"title":"useNetwork","permalink":"/modern-kit/docs/react/hooks/useNetwork"}}');var o=t(6206),i=t(3267),s=t(4382),c=t(1351);const l={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};var a=t(9010);const u={},d="useMouse",p={},f=()=>{const e={div:"div",p:"p",...(0,i.R)()},{ref:n,position:t}=function(){const e=(0,s.useRef)(null),[n,t]=(0,s.useState)(l),r=(0,s.useCallback)((n=>{const{screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:l}=n;let a=null,u=null,d=null,p=null;if(e.current){const n=e.current.getBoundingClientRect();a=i-n.left,u=s-n.top,d=n.left+window.scrollX,p=n.top+window.scrollY}t({screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:l,elementRelativeX:a,elementRelativeY:u,elementPositionX:d,elementPositionY:p})}),[]);return(0,c.M)(document,"mousemove",r),{ref:e,position:n}}(),r=(0,s.useMemo)((()=>({display:"flex",alignItems:"center",justifyContent:"center",width:"500px",height:"500px",background:"#439966",fontSize:"2rem",color:"#fff"})),[]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(e.div,{ref:n,style:r,children:"\ub9c8\uc6b0\uc2a4\ub97c \uc6c0\uc9c1\uc5ec\ubcf4\uc138\uc694."}),(0,o.jsxs)(e.p,{children:["\uc0ac\uc6a9\uc790 \ubaa8\ub2c8\ud130 \ub0b4 X\uc88c\ud45c: ",t.screenX]}),(0,o.jsxs)(e.p,{children:["\uc0ac\uc6a9\uc790 \ubaa8\ub2c8\ud130 \ub0b4 Y\uc88c\ud45c: ",t.screenY]}),(0,o.jsxs)(e.p,{children:["\uc2a4\ud06c\ub9b0 \uc601\uc5ed \ub0b4 X\uc88c\ud45c: ",t.clientX]}),(0,o.jsxs)(e.p,{children:["\uc2a4\ud06c\ub9b0 \uc601\uc5ed \ub0b4 Y\uc88c\ud45c: ",t.clientY]}),(0,o.jsxs)(e.p,{children:["\uc804\uccb4 \ubb38\uc11c \uae30\uc900 X\uc88c\ud45c: ",t.pageX]}),(0,o.jsxs)(e.p,{children:["\uc804\uccb4 \ubb38\uc11c \uae30\uc900 Y\uc88c\ud45c: ",t.pageY]}),(0,o.jsxs)(e.p,{children:["\ub300\uc0c1 \uc5d8\ub9ac\uba3c\ud2b8 \uae30\uc900 X\uc88c\ud45c: ",t.elementRelativeX]}),(0,o.jsxs)(e.p,{children:["\ub300\uc0c1 \uc5d8\ub9ac\uba3c\ud2b8 \uae30\uc900 Y\uc88c\ud45c: ",t.elementRelativeY]}),(0,o.jsxs)(e.p,{children:["\ub300\uc0c1 \uc5d8\ub9ac\uba3c\ud2b8\uc758 X\uc88c\ud45c : ",t.elementPositionX]}),(0,o.jsxs)(e.p,{children:["\ub300\uc0c1 \uc5d8\ub9ac\uba3c\ud2b8\uc758 Y\uc88c\ud45c : ",t.elementPositionY]})]})},m=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function h(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.header,{children:(0,o.jsx)(n.h1,{id:"usemouse",children:"useMouse"})}),"\n",(0,o.jsx)(n.p,{children:"\ub300\uc0c1 \uc5d8\ub9ac\uba3c\ud2b8\ub97c \uae30\uc900\uc73c\ub85c \ub9c8\uc6b0\uc2a4\uc758 \uc704\uce58\ub97c \ucd94\uc801\ud558\ub294 Hook\uc785\ub2c8\ub2e4."}),"\n",(0,o.jsx)(n.p,{children:"\ud604\uc7ac \uc2a4\ud06c\ub9b0\uc5d0\uc11c\uc758 \uc704\uce58, \uc2a4\ud06c\ub9b0 \uc601\uc5ed \ub0b4\uc758 \uc704\uce58, \uc804\uccb4 \ubb38\uc11c\uc5d0\uc11c\uc758 \uc704\uce58, \ub300\uc0c1 \uc5d8\ub9ac\uba3c\ud2b8 \uae30\uc900 \uc704\uce58, \ud574\ub2f9 \uc5d8\ub9ac\uba3c\ud2b8\uc758 \uc704\uce58\ub97c \uc81c\uacf5\ud569\ub2c8\ub2e4."}),"\n",(0,o.jsx)(n.p,{children:"\ub300\uc0c1 \uc5d8\ub9ac\uba3c\ud2b8\uac00 \uc5c6\ub294 \uacbd\uc6b0 \uc0c1\ub300\uc801\uc778 \uc704\uce58\uc640 \ud574\ub2f9 \uc5d8\ub9ac\uba3c\ud2b8\uc758 \uc704\uce58\ub294 \uc81c\uacf5\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(n.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useMouse/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(n.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"\ninterface CursorPosition {\n screenX: number | null;\n screenY: number | null;\n clientX: number | null;\n clientY: number | null;\n pageX: number | null;\n pageY: number | null;\n elementRelativeX: number | null;\n elementRelativeY: number | null;\n elementPositionX: number | null;\n elementPositionY: number | null;\n}\n\nfunction useMouse(): {\n ref: React.RefObject;\n position: CursorPosition;\n}\n"})}),"\n",(0,o.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useMouse } from '@modern-kit/react';\n\nconst Example = () => {\n const { ref, position } = useMouse();\n const boxStyle = useMemo(() => {\n return {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '500px', \n height: '500px',\n background: '#439966',\n fontSize: '2rem',\n color: '#fff',\n }\n }, []);\n\n return (\n <>\n \n \ub9c8\uc6b0\uc2a4\ub97c \uc6c0\uc9c1\uc5ec\ubcf4\uc138\uc694.\n
\n \uc0ac\uc6a9\uc790 \ubaa8\ub2c8\ud130 \ub0b4 X\uc88c\ud45c: {position.screenX}
\n \uc0ac\uc6a9\uc790 \ubaa8\ub2c8\ud130 \ub0b4 Y\uc88c\ud45c: {position.screenY}
\n \uc2a4\ud06c\ub9b0 \uc601\uc5ed \ub0b4 X\uc88c\ud45c: {position.clientX}
\n \uc2a4\ud06c\ub9b0 \uc601\uc5ed \ub0b4 Y\uc88c\ud45c: {position.clientY}
\n \uc804\uccb4 \ubb38\uc11c \uae30\uc900 X\uc88c\ud45c: {position.pageX}
\n \uc804\uccb4 \ubb38\uc11c \uae30\uc900 Y\uc88c\ud45c: {position.pageY}
\n \ub300\uc0c1 \uc5d8\ub9ac\uba3c\ud2b8 \uae30\uc900 X\uc88c\ud45c: {position.elementRelativeX}
\n \ub300\uc0c1 \uc5d8\ub9ac\uba3c\ud2b8 \uae30\uc900 Y\uc88c\ud45c: {position.elementRelativeY}
\n \ub300\uc0c1 \uc5d8\ub9ac\uba3c\ud2b8\uc758 X\uc88c\ud45c : {position.elementPositionX}
\n \ub300\uc0c1 \uc5d8\ub9ac\uba3c\ud2b8\uc758 Y\uc88c\ud45c : {position.elementPositionY}
\n
\n );\n};\n"})}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(a.A,{children:()=>(0,o.jsx)(f,{})})]})}function g(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(h,{...e})}):h(e)}},9010:(e,n,t)=>{t.d(n,{A:()=>i});t(4382);var r=t(3555),o=t(6206);function i(e){let{children:n,fallback:t}=e;return(0,r.A)()?(0,o.jsx)(o.Fragment,{children:n?.()}):t??null}},3267:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>c});var r=t(4382);const o={},i=r.createContext(o);function s(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:s(e.components),r.createElement(i.Provider,{value:n},e.children)}},1351:(e,n,t)=>{t.d(n,{M:()=>c});var r=t(6765),o=t(5907),i=t(9340);t(4382);const s=e=>!!e&&(0,i.i5)(e,"current");function c(e,n,t,i){const c=(0,r.p)(t);(0,o.E)((()=>{const t=s(e)?e.current:e;if(t)return t.addEventListener(n,c,i),()=>{t.removeEventListener(n,c,i)}}),[n,e,i,c])}},5907:(e,n,t)=>{t.d(n,{E:()=>i});var r=t(9340),o=t(4382);const i=(0,r.oc)()?o.useLayoutEffect:o.useEffect},6765:(e,n,t)=>{t.d(n,{p:()=>o});var r=t(4382);function o(e){const n=(0,r.useRef)(e);return n.current=e,(0,r.useCallback)(((...e)=>n.current(...e)),[])}},9340:(e,n,t)=>{function r(e,n,t,r){return new(t||(t=Promise))((function(o,i){function s(e){try{l(r.next(e))}catch(n){i(n)}}function c(e){try{l(r.throw(e))}catch(n){i(n)}}function l(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(s,c)}l((r=r.apply(e,n||[])).next())}))}t.d(n,{Et:()=>b,Fr:()=>c,Gp:()=>v,Ol:()=>Y,Qd:()=>j,S$:()=>s,Tn:()=>w,Zp:()=>p,dK:()=>a,fl:()=>C,gD:()=>x,i5:()=>m,if:()=>f,l6:()=>k,lQ:()=>X,nS:()=>d,ni:()=>P,oc:()=>l}),"function"==typeof SuppressedError&&SuppressedError;const o={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};const i=(e,n)=>new Promise(((t,r)=>{e.toBlob((e=>{e?t(e):r(new Error(`Failed to create blob with format ${n}`))}),n)}));function s(){return"undefined"==typeof window}function c(){if(s())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}function l(){return!s()}function a(e){return r(this,void 0,void 0,(function*(){if(!l())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const n=document.createElement("textarea");n.value=e,n.style.opacity="0",document.body.appendChild(n),n.focus(),n.select();try{return document.execCommand("copy"),e}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}finally{document.body.removeChild(n)}}(e)}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}}))}const u=e=>r(void 0,void 0,void 0,(function*(){const n=yield fetch(e);return a(yield n.text())}));function d(e,n){var t;return r(this,void 0,void 0,(function*(){if(!l())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator))return u(e);if(!("write"in window.navigator.clipboard))return u(e);if(null!==(t=null==n?void 0:n.toText)&&void 0!==t&&t)return u(e);const s=yield function(e,n="png"){return new Promise(((t,s)=>{const c=new Image;c.onload=()=>r(this,void 0,void 0,(function*(){const e=document.createElement("canvas");e.width=c.width,e.height=c.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(c,0,0);const s=yield i(e,o[n]);t(s)}catch(r){console.error(`Failed to load image. message: ${r.mesaage}`),s(r)}})),c.onerror=()=>{s(new Error("Failed to load image"))},c.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[s.type]:s})]),s}catch(s){throw console.error(`Failed to copy to clipboard. message: ${s.message}`),s}}))}function p(){return r(this,void 0,void 0,(function*(){if(!l())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function f(){return r(this,void 0,void 0,(function*(){if(!l())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function m(e,n){return Object.prototype.hasOwnProperty.call(e,n)}const h=(e,n,t)=>{const r=Object.keys(e),o=Object.keys(n);if(r.length!==o.length)return!1;for(let i=0;i{if(e===n)return!0;if(b(e)&&b(n)&&isNaN(e)&&isNaN(n))return!0;if(w(e)&&w(n))return e.toString()===n.toString();if("object"!=typeof e||"object"!=typeof n||null===e||null===n)return!1;if(t.has(e)&&t.get(e)===n)return!0;if(t.set(e,n),e.constructor!==n.constructor)return!1;if(e instanceof Set){if(e.size!==n.size)return!1;const r=[...e],o=[...n];return h(r,o,t)}if(e instanceof Map){if(e.size!==n.size)return!1;for(const[r,o]of e)if(!n.has(r)||!g(o,n.get(r),t))return!1;return!0}return h(e,n,t)};function v(e,n){return g(e,n,new WeakMap)}function w(e){return"function"==typeof e}function x(e){return null==e}function b(e){return"number"==typeof e}function y(e){return!function(e){return Object(e)!==e}(e)}function j(e){return y(e)&&"[object Object]"===Object.prototype.toString.call(e)}function k(e){return e===window}function X(){}function Y(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(n){throw new Error(`Failed to parse data: ${n}`)}}function E(e){return Object.keys(e)}const M={days:864e5,hours:36e5,minutes:6e4,seconds:1e3};E(M);function C(e,n){if(!l())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(n)}catch(t){throw new Error(`Failed to remove key "${n}" from ${e}: ${t}`)}}function P(e,n,t){if(!l())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=w(t)?t():t;r.setItem(n,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${n}" in ${e}: ${r}`)}}}}]);
\ No newline at end of file
diff --git a/assets/js/225c6dfe.7b9830ad.js b/assets/js/225c6dfe.7b9830ad.js
deleted file mode 100644
index 6b0922d17..000000000
--- a/assets/js/225c6dfe.7b9830ad.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[8034],{252:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>f,assets:()=>d,contentTitle:()=>u,default:()=>m,frontMatter:()=>a,metadata:()=>r,toc:()=>p});const r=JSON.parse('{"id":"react/hooks/useMouse","title":"useMouse","description":"\ub300\uc0c1 \uc5d8\ub9ac\uba3c\ud2b8\ub97c \uae30\uc900\uc73c\ub85c \ub9c8\uc6b0\uc2a4\uc758 \uc704\uce58\ub97c \ucd94\uc801\ud558\ub294 Hook\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useMouse.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useMouse","permalink":"/modern-kit/docs/react/hooks/useMouse","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useMergeRefs","permalink":"/modern-kit/docs/react/hooks/useMergeRefs"},"next":{"title":"useNetwork","permalink":"/modern-kit/docs/react/hooks/useNetwork"}}');var o=n(6206),i=n(3267),s=n(4382),c=n(4027),l=n(9010);const a={},u="useMouse",d={},f=()=>{const e={div:"div",p:"p",...(0,i.R)()},{ref:t,position:n}=(0,c.NT)(),r=(0,s.useMemo)((()=>({display:"flex",alignItems:"center",justifyContent:"center",width:"500px",height:"500px",background:"#439966",fontSize:"2rem",color:"#fff"})),[]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(e.div,{ref:t,style:r,children:"\ub9c8\uc6b0\uc2a4\ub97c \uc6c0\uc9c1\uc5ec\ubcf4\uc138\uc694."}),(0,o.jsxs)(e.p,{children:["\uc0ac\uc6a9\uc790 \ubaa8\ub2c8\ud130 \ub0b4 X\uc88c\ud45c: ",n.screenX]}),(0,o.jsxs)(e.p,{children:["\uc0ac\uc6a9\uc790 \ubaa8\ub2c8\ud130 \ub0b4 Y\uc88c\ud45c: ",n.screenY]}),(0,o.jsxs)(e.p,{children:["\uc2a4\ud06c\ub9b0 \uc601\uc5ed \ub0b4 X\uc88c\ud45c: ",n.clientX]}),(0,o.jsxs)(e.p,{children:["\uc2a4\ud06c\ub9b0 \uc601\uc5ed \ub0b4 Y\uc88c\ud45c: ",n.clientY]}),(0,o.jsxs)(e.p,{children:["\uc804\uccb4 \ubb38\uc11c \uae30\uc900 X\uc88c\ud45c: ",n.pageX]}),(0,o.jsxs)(e.p,{children:["\uc804\uccb4 \ubb38\uc11c \uae30\uc900 Y\uc88c\ud45c: ",n.pageY]}),(0,o.jsxs)(e.p,{children:["\ub300\uc0c1 \uc5d8\ub9ac\uba3c\ud2b8 \uae30\uc900 X\uc88c\ud45c: ",n.elementRelativeX]}),(0,o.jsxs)(e.p,{children:["\ub300\uc0c1 \uc5d8\ub9ac\uba3c\ud2b8 \uae30\uc900 Y\uc88c\ud45c: ",n.elementRelativeY]}),(0,o.jsxs)(e.p,{children:["\ub300\uc0c1 \uc5d8\ub9ac\uba3c\ud2b8\uc758 X\uc88c\ud45c : ",n.elementPositionX]}),(0,o.jsxs)(e.p,{children:["\ub300\uc0c1 \uc5d8\ub9ac\uba3c\ud2b8\uc758 Y\uc88c\ud45c : ",n.elementPositionY]})]})},p=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function h(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"usemouse",children:"useMouse"})}),"\n",(0,o.jsx)(t.p,{children:"\ub300\uc0c1 \uc5d8\ub9ac\uba3c\ud2b8\ub97c \uae30\uc900\uc73c\ub85c \ub9c8\uc6b0\uc2a4\uc758 \uc704\uce58\ub97c \ucd94\uc801\ud558\ub294 Hook\uc785\ub2c8\ub2e4."}),"\n",(0,o.jsx)(t.p,{children:"\ud604\uc7ac \uc2a4\ud06c\ub9b0\uc5d0\uc11c\uc758 \uc704\uce58, \uc2a4\ud06c\ub9b0 \uc601\uc5ed \ub0b4\uc758 \uc704\uce58, \uc804\uccb4 \ubb38\uc11c\uc5d0\uc11c\uc758 \uc704\uce58, \ub300\uc0c1 \uc5d8\ub9ac\uba3c\ud2b8 \uae30\uc900 \uc704\uce58, \ud574\ub2f9 \uc5d8\ub9ac\uba3c\ud2b8\uc758 \uc704\uce58\ub97c \uc81c\uacf5\ud569\ub2c8\ub2e4."}),"\n",(0,o.jsx)(t.p,{children:"\ub300\uc0c1 \uc5d8\ub9ac\uba3c\ud2b8\uac00 \uc5c6\ub294 \uacbd\uc6b0 \uc0c1\ub300\uc801\uc778 \uc704\uce58\uc640 \ud574\ub2f9 \uc5d8\ub9ac\uba3c\ud2b8\uc758 \uc704\uce58\ub294 \uc81c\uacf5\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useMouse/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"\ninterface CursorPosition {\n screenX: number | null;\n screenY: number | null;\n clientX: number | null;\n clientY: number | null;\n pageX: number | null;\n pageY: number | null;\n elementRelativeX: number | null;\n elementRelativeY: number | null;\n elementPositionX: number | null;\n elementPositionY: number | null;\n}\n\nfunction useMouse(): {\n ref: React.RefObject;\n position: CursorPosition;\n}\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useMouse } from '@modern-kit/react';\n\nconst Example = () => {\n const { ref, position } = useMouse();\n const boxStyle = useMemo(() => {\n return {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '500px', \n height: '500px',\n background: '#439966',\n fontSize: '2rem',\n color: '#fff',\n }\n }, []);\n\n return (\n <>\n \n \ub9c8\uc6b0\uc2a4\ub97c \uc6c0\uc9c1\uc5ec\ubcf4\uc138\uc694.\n
\n \uc0ac\uc6a9\uc790 \ubaa8\ub2c8\ud130 \ub0b4 X\uc88c\ud45c: {position.screenX}
\n \uc0ac\uc6a9\uc790 \ubaa8\ub2c8\ud130 \ub0b4 Y\uc88c\ud45c: {position.screenY}
\n \uc2a4\ud06c\ub9b0 \uc601\uc5ed \ub0b4 X\uc88c\ud45c: {position.clientX}
\n \uc2a4\ud06c\ub9b0 \uc601\uc5ed \ub0b4 Y\uc88c\ud45c: {position.clientY}
\n \uc804\uccb4 \ubb38\uc11c \uae30\uc900 X\uc88c\ud45c: {position.pageX}
\n \uc804\uccb4 \ubb38\uc11c \uae30\uc900 Y\uc88c\ud45c: {position.pageY}
\n \ub300\uc0c1 \uc5d8\ub9ac\uba3c\ud2b8 \uae30\uc900 X\uc88c\ud45c: {position.elementRelativeX}
\n \ub300\uc0c1 \uc5d8\ub9ac\uba3c\ud2b8 \uae30\uc900 Y\uc88c\ud45c: {position.elementRelativeY}
\n \ub300\uc0c1 \uc5d8\ub9ac\uba3c\ud2b8\uc758 X\uc88c\ud45c : {position.elementPositionX}
\n \ub300\uc0c1 \uc5d8\ub9ac\uba3c\ud2b8\uc758 Y\uc88c\ud45c : {position.elementPositionY}
\n \n );\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(l.A,{children:()=>(0,o.jsx)(f,{})})]})}function m(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(h,{...e})}):h(e)}},9010:(e,t,n)=>{n.d(t,{A:()=>i});n(4382);var r=n(3555),o=n(6206);function i(e){let{children:t,fallback:n}=e;return(0,r.A)()?(0,o.jsx)(o.Fragment,{children:t?.()}):n??null}},4027:(e,t,n)=>{n.d(t,{$$:()=>Pe,$I:()=>oe,AE:()=>ze,BL:()=>J,DX:()=>Y,FT:()=>ct,Fo:()=>et,Hn:()=>it,I5:()=>Ee,JF:()=>Le,K:()=>ae,K$:()=>He,M0:()=>Me,ML:()=>ne,Mj:()=>ye,Mk:()=>Fe,Mo:()=>ie,NT:()=>Te,QV:()=>Ue,Ub:()=>ke,Ut:()=>je,W7:()=>U,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>We,Zu:()=>le,_1:()=>Oe,_g:()=>nt,aL:()=>H,aY:()=>Ye,bB:()=>A,d7:()=>B,eG:()=>st,fN:()=>ce,fm:()=>G,gl:()=>P,hN:()=>V,iD:()=>de,iQ:()=>Ie,jd:()=>se,lW:()=>at,oD:()=>K,oo:()=>Re,pL:()=>q,qi:()=>ue,rN:()=>Xe,tD:()=>Se,u8:()=>Q,wY:()=>Be,xV:()=>I,xh:()=>tt,zy:()=>Z});var r=n(6206),o=n(4382),i=n(3683),s=n(5086),c=n(7197),l=(n(1604),n(5938));function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function m(){return typeof window>"u"}function g(){return!m()}function w(e){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const b=e=>f(void 0,0,void 0,(function*(){return w(yield(yield fetch(e)).text())}));function v(e,t){var n;return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return b(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const i=yield h(e,p[t]);n(i)}catch(i){console.error(`Failed to load image. message: ${i.mesaage}`),r(i)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i=0;i{if(e===t||C(e)&&C(t)&&isNaN(e)&&isNaN(t))return!0;if(S(e)&&S(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return y(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!x(o,t.get(r),n))return!1;return!0}return y(e,t,n)};function k(e,t){return x(e,t,new WeakMap)}function S(e){return"function"==typeof e}function C(e){return"number"==typeof e}function j(e){return!function(e){return Object(e)!==e}(e)}function E(){}function R(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const O=(...e)=>t=>e.forEach((e=>{if(S(e))e(t);else if(null!=e){e.current=t}}));function M(...e){return(0,o.useCallback)(O(...e),e)}const Y=o.forwardRef(((e,t)=>{const{children:n}=e,i=a(e,["children"]),s=o.Children.toArray(n),c=s.find(F);if(c){const e=c.props.children,n=s.map((t=>t===c?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(X,Object.assign({},i,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(X,Object.assign({},i,{ref:t,children:n}))}));Y.displayName="Slot";const X=o.forwardRef(((e,t)=>{const{children:n}=e,r=a(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),i):"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?O(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));X.displayName="SlotClone";const I=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function F(e){return o.isValidElement(e)&&e.type===I}var N="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const P=d(((e,t)=>{var{ratio:n,style:o,as:s="div",asChild:c=!1}=e,l=a(e,["ratio","style","as","asChild"]);const u=c?Y:s,d=Object.assign({aspectRatio:n},o),f=c?l.className:i(N,l.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},l))})),L=()=>E,$=()=>!1,T=()=>!0;function A({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)(L,$,T)?e:t}function D(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const V=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>D()?(0,r.jsx)(r.Fragment,{children:t}):e;function z(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function W(e){const t=z(e);(0,o.useEffect)((()=>()=>t()),[t])}function _(e,t=k){const[n,r]=(0,o.useState)(e),i=z(t);return(0,o.useEffect)((()=>{i(n,e)||r(e)}),[i,n,e]),n}function B(e,t,n){const r=z(e),i=_(n),c=(0,o.useMemo)((()=>(0,s.A)(r,t,i)),[r,t,i]);return W((()=>c.cancel())),c}const H=({children:e,capture:t,wait:n,options:r})=>{const i=o.Children.only(e),s=B(((...e)=>{const n=i?.props;if(n&&S(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(i,{[t]:s})};function J({onIntersectStart:e=E,onIntersectEnd:t=E,enabled:n=!0,calledOnce:r=!1,root:i=null,threshold:s=0,rootMargin:c="0px 0px 0px 0px"}){const l=(0,o.useRef)(0),a=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=z((([n],o)=>{if(!n)return;const i=n.target;n.isIntersecting?(a.current=!0,l.current+=1,e(n)):a.current&&(a.current=!1,l.current+=1,t(n)),r&&l.current>1&&o.unobserve(i)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:s,root:i,rootMargin:c}),u.current.observe(e))}),[n,s,i,c,d])}}const K=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:i,rootMargin:s}=e,c=a(e,["src","threshold","root","rootMargin"]);const{ref:l}=J({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:i,rootMargin:s});return(0,r.jsx)("img",Object.assign({ref:M(t,l)},c))}));K.displayName="LazyImage";const U=(0,o.forwardRef)(((e,t)=>{var{width:n,height:i,fallback:s,className:c,style:l,duration:u="0.2s",onLoad:d}=e,f=a(e,["width","height","fallback","className","style","duration","onLoad"]);const[p,h]=(0,o.useState)(!1),m=!p,g=(0,o.useMemo)((()=>({position:"relative",width:n,height:i})),[n,i]),w=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:m?0:1,transition:`opacity ${u}`},l)),[m,u,l]),b=(0,o.useCallback)((e=>{d&&d(e),h(!0)}),[d]),v=c?`lazy-image-wrapper ${c}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:v,style:g,children:[m&&s,(0,r.jsx)(K,Object.assign({ref:t,width:n,height:i,style:w,onLoad:b},f))]})}));U.displayName="FallbackLazyImage";const Z=({condition:e,trueComponent:t,falseComponent:n})=>{const i=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:i?t:n})},Q=({onScrollAction:e,children:t,root:n,threshold:o,enabled:i,triggerPosition:s="after",rootMargin:c="150px 0px"})=>{const{ref:l}=J({onIntersectStart:e,root:n,threshold:o,enabled:i,rootMargin:c});return(0,r.jsxs)(r.Fragment,{children:["before"===s&&(0,r.jsx)("div",{ref:l}),t,"after"===s&&(0,r.jsx)("div",{ref:l})]})},q=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1}=e,c=a(e,["children","as","asChild"]);const l=s?Y:i,{ref:u}=J(c);if(s&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(l,Object.assign({ref:O(t,u)},c,{children:n}))})),G=({items:e=[],itemKey:t,renderItem:n})=>{const i=(0,o.useCallback)(((e,n)=>function(e){return j(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},i(e,t))))})},ee=g()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=z(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),i=(0,o.useMemo)((()=>function(){if(m())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,i,(({target:t})=>{if(!r.current)return;const o=r.current,i=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!i&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1,onPointerDown:c,excludeRefs:l=[]}=e,u=a(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(c,{excludeRefs:l}),f=s?Y:i;if(s&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:O(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const ie=({itemKey:e,items:t=[],separator:n,renderItem:i,separatorInterval:s=1,includeLastSeparator:c=!1})=>{const l=(0,o.useCallback)((e=>e===t.length-1?c:(e+1)%s==0),[c,s,t.length]);return(0,r.jsx)(G,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[i(e,t),l(t)&&n]})})},se=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ce=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function le(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function ae(e=!0){const t=S(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!i.current){i.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{i.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),i=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield w(e);return t(n),!0}catch{return t(null),!1}}))),[]),s=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield v(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),l=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:i,copyImage:s,readText:c,readContents:l}}const fe="modern-kit-local-storage",pe="modern-kit-session-storage",he={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:pe,subscribe:e=>{window.addEventListener(pe,e)},unsubscribe:e=>{window.removeEventListener(pe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(pe))}}},me=e=>he[e],ge=me("localStorage"),we=e=>window.localStorage.getItem(e),be=e=>JSON.stringify(e),ve=e=>(ge.subscribe(e),()=>{ge.unsubscribe(e)});function ye(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=S(n)?n():n,i=(0,o.useSyncExternalStore)(ve,(()=>we(t)),(()=>be(r)));return{state:(0,o.useMemo)((()=>i?R(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=we(t),o=n?R(n):r,i=S(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(i)),ge.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),ge.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const xe=(e,t)=>g()?window.matchMedia(e).matches:t??!1;function ke(e,t){const[n,r]=(0,o.useState)(xe(e,t)),i=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",i),n}function Se(){return ke("(prefers-color-scheme: dark)")?"dark":"light"}const Ce="color-scheme";function je({defaultValue:e,key:t=Ce,shouldSetBodyClass:n=!1}={}){const r=Se(),i=S(e)?e():e,{state:s,setState:c}=ye({key:t,initialValue:i??r}),l=(0,o.useCallback)((()=>{c((e=>"dark"===e?"light":"dark"))}),[c]),a=(0,o.useCallback)((()=>{c("dark")}),[c]),u=(0,o.useCallback)((()=>{c("light")}),[c]),d=(0,o.useCallback)((()=>{c(r)}),[c,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(s),()=>{n&&document.body.classList.remove(s)})),[s,n]),{colorScheme:s,preferredColorScheme:r,setToggleMode:l,setDarkMode:a,setLightMode:u,setPreferredMode:d}}function Ee(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),i=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),s=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:i,reset:s}}function Re({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,i]=(0,o.useState)(t),s=r0,l=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),a=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const s=l(e,t);o&&o({prev:r,next:s}),i(s)}),[n,r,l]),u=(0,o.useCallback)((e=>{a("nextStep",!s,e)}),[s,a]),d=(0,o.useCallback)((e=>{a("prevStep",!c,e)}),[c,a]),f=(0,o.useCallback)(((t,n)=>{const o=S(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void i(t);throw new Error("Step not valid")}),[r,e]),p=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),i(t)}),[r,t]);return{currentStep:r,hasNextStep:s,hasPrevStep:c,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:p}}function Oe(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:i,resetStep:s}=Re({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:i,resetIndex:s}}function Me(e,t,n={}){const[r,i]=(0,o.useState)(e);return[r,B(i,t,n)]}function Ye(e,t={}){const[n,r]=(0,o.useState)(""),[i,s]=Me("",e,t);return{value:n,debouncedValue:i,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),s(t)}),[s]),onReset:(0,o.useCallback)((()=>{r(""),s("")}),[s])}}function Xe(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Ie({onFocus:e=E,onBlur:t=E}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=z((t=>{r(!0),e(t)})),c=z((e=>{r(!1),t(e)})),l=(0,o.useCallback)((()=>{i.current&&(i.current.focus(),r(!0))}),[]);return ne(i,"focus",s),ne(i,"blur",c),{ref:i,isFocus:n,setFocus:l}}function Fe({onEnter:e=E,onLeave:t=E}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=z((t=>{r(!0),e(t)})),c=z((e=>{r(!1),t(e)}));return ne(i,"mouseenter",s),ne(i,"mouseleave",c),{ref:i,isHovered:n}}const Ne=e=>{var t;return C(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function Pe(e,t){const n=(0,o.useRef)(),r=z(e),{delay:i,enabled:s}=Ne(t),c=(0,o.useCallback)((()=>{n.current=window.setInterval(r,i)}),[r,i]),l=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),c()}),[l,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>l()}),[l,c,s,i]),{set:c,reset:a,clear:l}}function Le({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),i=z((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];S(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",i),()=>t.removeEventListener("keydown",i)}),[e,i]),r}const $e={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function Te(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)($e),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:l}=t;let a=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();a=i-t.left,u=s-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:l,elementRelativeX:a,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const Ae=()=>navigator.onLine,De=()=>!0,Ve=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function ze({onlineAction:e=E,offlineAction:t=E}={}){const n=z((n=>Ve(n,e,t)));return(0,o.useSyncExternalStore)(n,Ae,De)}function We(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const _e={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Be(e=E){const[t,n]=(0,o.useState)(_e),r=(0,o.useRef)(null),i=z((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(i);return t.observe(e),()=>{t.unobserve(e)}}),[i]),{ref:r,contentRect:t}}function He({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),i=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>i())),[e,r,i]),{ref:t,lock:r,unlock:i}}const Je=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,Ke=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:i=0,alignY:s="start",alignX:c="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+i+Je(window.innerHeight,r.height,s),left:r.left+window.scrollX+o+Je(window.innerWidth,r.width,c)};const l=e.getBoundingClientRect();return{top:r.top-l.top+e.scrollTop+i+Je(l.height,r.height,s),left:r.left-l.left+e.scrollLeft+o+Je(l.width,r.width,c)}};function Ue(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:i,top:s}=Ke(r,t,n);r.scrollTo({top:s,left:i,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ze=me("sessionStorage"),Qe=e=>window.sessionStorage.getItem(e),qe=e=>JSON.stringify(e),Ge=e=>(Ze.subscribe(e),()=>{Ze.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=S(n)?n():n,i=(0,o.useSyncExternalStore)(Ge,(()=>Qe(t)),(()=>qe(r)));return{state:(0,o.useMemo)((()=>i?R(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=Qe(t),o=n?R(n):r,i=S(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(i)),Ze.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ze.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:i}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[s,c]=(0,o.useState)(n),l=(0,o.useCallback)((e=>{c((t=>{const n=S(e)?e(t):e;return r&&i&&function(e,t,n){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=S(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,i,n),n}))}),[r,i]),a=(0,o.useCallback)((()=>{r&&i&&function(e,t){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,i),c(null)}),[r,i]);return Object.assign({state:s,setState:l,clearState:a},Re(e))}function nt(e,t,n={}){const r=z(e),i=_(n),s=(0,o.useMemo)((()=>(0,c.A)(r,t,i)),[r,t,i]);return W((()=>s.cancel())),s}const rt=e=>{var t;return C(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=z(e),{delay:i,enabled:s}=rt(t),c=(0,o.useCallback)((()=>{n.current=setTimeout(r,i)}),[r,i]),l=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),c()}),[l,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>l()}),[c,l,i,s]),{set:c,reset:a,clear:l}}function it(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function st(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new l.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function ct({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const lt={width:null,height:null};function at({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>m()?lt:{width:window.innerWidth,height:window.innerHeight})),r=B(n,e),i=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",i),t}function ut(e,t,n){const{delay:r,enabled:i}=rt(t),{set:s,reset:c,clear:l}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!i||c()}),[r,i,c,...n]),{set:s,reset:c,clear:l}}}}]);
\ No newline at end of file
diff --git a/assets/js/24c74d07.b0f51709.js b/assets/js/24c74d07.b0f51709.js
deleted file mode 100644
index 72a74efc8..000000000
--- a/assets/js/24c74d07.b0f51709.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[8440],{6639:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>u,assets:()=>l,contentTitle:()=>c,default:()=>h,frontMatter:()=>a,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"react/components/FallbackLazyImage","title":"FallbackLazyImage","description":"LazyImage \ucef4\ud3ec\ub10c\ud2b8 \ub97c \ud655\uc7a5\ud574 \uc774\ubbf8\uc9c0 load \uc5ec\ubd80\uc5d0 \ub530\ub978 Fallback \ucef4\ud3ec\ub10c\ud2b8\ub97c \ub80c\ub354\ub9c1 \ud558\ub294 \ucef4\ud3ec\ub10c\ud2b8 \uc785\ub2c8\ub2e4.","source":"@site/docs/react/components/FallbackLazyImage.mdx","sourceDirName":"react/components","slug":"/react/components/FallbackLazyImage","permalink":"/modern-kit/docs/react/components/FallbackLazyImage","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"DebounceHandler","permalink":"/modern-kit/docs/react/components/DebounceHandler"},"next":{"title":"IfElse","permalink":"/modern-kit/docs/react/components/IfElse"}}');var o=n(6206),i=n(3267),s=n(4027);const a={},c="FallbackLazyImage",l={},u=()=>{const e={div:"div",...(0,i.R)()},t={width:"500px",height:"500px",backgroundColor:"green"};return(0,o.jsxs)(e.div,{style:{background:"#f8f8f8",width:"500px"},children:[(0,o.jsx)(e.div,{style:{height:"500px",textAlign:"center",fontSize:"2rem"},children:"\uc2a4\ud06c\ub864 \ud574\uc8fc\uc138\uc694."}),(0,o.jsx)(s.W7,{fallback:(0,o.jsx)(e.div,{style:t}),src:"https://github.com/Team-Grace/devgrace/assets/64779472/b5640bec-2abc-4205-afbf-ccfd9876a90b",alt:"img1",width:500,height:500}),(0,o.jsx)(e.div,{style:{width:"100%",height:"150px"}}),(0,o.jsx)(s.W7,{fallback:(0,o.jsx)(e.div,{style:t}),src:"https://github.com/Team-Grace/devgrace/assets/64779472/207743a7-b29f-4826-bc08-8df0d67e568b",alt:"img2",width:500,height:500}),(0,o.jsx)(e.div,{style:{width:"100%",height:"150px"}}),(0,o.jsx)(s.W7,{fallback:(0,o.jsx)(e.div,{style:t}),src:"https://github.com/Team-Grace/devgrace/assets/64779472/d1957ec8-fe87-406e-bfda-fb4ee505b152",alt:"img3",width:500,height:500})]})},d=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Default",id:"default",level:3},{value:"Wrapper Styling: css",id:"wrapper-styling-css",level:3},{value:"Wrapper Styling: css-in-js",id:"wrapper-styling-css-in-js",level:3},{value:"Example",id:"example",level:2}];function f(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"fallbacklazyimage",children:"FallbackLazyImage"})}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.strong,{children:(0,o.jsx)(t.a,{href:"https://modern-agile-team.github.io/modern-kit/docs/react/components/LazyImage",children:"LazyImage \ucef4\ud3ec\ub10c\ud2b8"})})," \ub97c \ud655\uc7a5\ud574 \uc774\ubbf8\uc9c0 ",(0,o.jsx)(t.code,{children:"load \uc5ec\ubd80"}),"\uc5d0 \ub530\ub978 ",(0,o.jsx)(t.code,{children:"Fallback \ucef4\ud3ec\ub10c\ud2b8"}),"\ub97c \ub80c\ub354\ub9c1 \ud558\ub294 \ucef4\ud3ec\ub10c\ud2b8 \uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"src"}),"\uc640 \ub354\ubd88\uc5b4 ",(0,o.jsx)(t.code,{children:"width"}),", ",(0,o.jsx)(t.code,{children:"height"}),", ",(0,o.jsx)(t.code,{children:"fallback"})," props\ub97c \ud544\uc218\ub85c \ub118\uaca8\uc918\uc57c \ud558\uba70, fallback\uc758 \ud06c\uae30\ub294 \ud574\ub2f9 width, height\uc640 \ub3d9\uc77c\ud558\uac8c \ub9de\ucd94\ub294 \uac83\uc744 \uad8c\uc7a5\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"duration"})," props\ub294 \uc2e4\uc81c \uc774\ubbf8\uc9c0\uac00 load \ub41c \ud6c4, fallback \ucef4\ud3ec\ub10c\ud2b8\uc5d0\uc11c \uc2e4\uc81c \uc774\ubbf8\uc9c0\ub85c \uc804\ud658 \ub420 \ub54c \uc0ac\uc6a9\ud558\ub294 ",(0,o.jsx)(t.strong,{children:(0,o.jsx)(t.a,{href:"https://developer.mozilla.org/en-US/docs/Web/CSS/transition-duration",children:"transition-duration"})})," \uac12\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/components/FallbackLazyImage/index.tsx",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"interface IntersectionObserverInit {\n root?: Element | Document | null;\n rootMargin?: string;\n threshold?: number | number[];\n}\n\ninterface LazyImageProps\n extends React.ComponentProps<'img'>,\n IntersectionObserverInit {\n src: string;\n}\n"})}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescrpt"',children:"interface FallbackLazyImageProps extends LazyImageProps {\n fallback: JSX.Element;\n width: string | number;\n height: string | number;\n duration?: CSSProperties['transitionDuration']; // default: 0.2s\n}\n\nconst FallbackLazyImage: React.ForwardRefExoticComponent<\n Omit & React.RefAttributes\n>;\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.h3,{id:"default",children:"Default"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { FallbackLazyImage } from '@modern-kit/react';\nimport img1 from '../assets/img1.png';\n\nconst Example = () => {\n const skeletonStyle = useMemo(\n () => ({\n width: '400px', // \uc2e4\uc81c img \ud06c\uae30\uc640 \ub3d9\uc77c\ud558\uac8c \ub9de\ucdb0\uc8fc\uc138\uc694.\n height: '400px', // \uc2e4\uc81c img \ud06c\uae30\uc640 \ub3d9\uc77c\ud558\uac8c \ub9de\ucdb0\uc8fc\uc138\uc694.\n backgroundColor: 'green',\n }),\n []\n );\n return (\n \n }\n width={400}\n height={400}\n src={img1}\n alt=\"img1\"\n />\n
\n );\n};\n"})}),"\n",(0,o.jsx)(t.h3,{id:"wrapper-styling-css",children:"Wrapper Styling: css"}),"\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsxs)(t.li,{children:["FallbackLazyImage \ucef4\ud3ec\ub10c\ud2b8 \ub0b4 ",(0,o.jsx)(t.code,{children:"Image Wrapper"}),"\ub294 \uae30\ubcf8\uc801\uc73c\ub85c ",(0,o.jsx)(t.code,{children:"lazy-image-wrapper"})," \ud074\ub798\uc2a4\ub97c \uac16\uc2b5\ub2c8\ub2e4. \ud574\ub2f9 \ud074\ub798\uc2a4\ub97c \ud65c\uc6a9\ud558\uc5ec \uc2a4\ud0c0\uc77c\uc744 \uc81c\uc5b4 \ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n"]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-css",children:"/* css stylesheet */\n.lazy-image-wrapper {\n border-radius: 12px;\n overflow: hidden;\n}\n\n.lazy-image-wrapper > img {\n /* image styling */\n}\n"})}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",children:"\n"})}),"\n",(0,o.jsx)(t.h3,{id:"wrapper-styling-css-in-js",children:"Wrapper Styling: css-in-js"}),"\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.code,{children:"css-in-js"}),"\uc758 ",(0,o.jsx)(t.code,{children:"\uc0c1\uc18d"}),"\uae30\ub2a5\uc744 \ud65c\uc6a9\ud558\uc5ec \uc0c8\ub85c\uc6b4 \ucef4\ud3ec\ub10c\ud2b8\ub97c \uc791\uc131 \ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n"]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",children:"const Image = styled(FallbackLazyImage)`\n border-radius: 12px;\n overflow: hidden;\n\n & > img {\n /* image styling */\n }\n`;\n"})}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",children:"\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(u,{})]})}function h(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(f,{...e})}):f(e)}},4027:(e,t,n)=>{n.d(t,{$$:()=>Me,$I:()=>oe,AE:()=>Ae,BL:()=>J,DX:()=>F,FT:()=>at,Fo:()=>et,Hn:()=>it,I5:()=>Ee,JF:()=>$e,K:()=>le,K$:()=>He,M0:()=>Le,ML:()=>ne,Mj:()=>ve,Mk:()=>Ne,Mo:()=>ie,NT:()=>We,QV:()=>Ke,Ub:()=>ke,Ut:()=>Ce,W7:()=>K,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>Ve,Zu:()=>ce,_1:()=>Re,_g:()=>nt,aL:()=>H,aY:()=>Fe,bB:()=>D,d7:()=>B,eG:()=>st,fN:()=>ae,fm:()=>q,gl:()=>M,hN:()=>X,iD:()=>de,iQ:()=>ze,jd:()=>se,lW:()=>lt,oD:()=>U,oo:()=>Ie,pL:()=>Q,qi:()=>ue,rN:()=>Oe,tD:()=>je,u8:()=>Z,wY:()=>Be,xV:()=>z,xh:()=>tt,zy:()=>G});var r=n(6206),o=n(4382),i=n(3683),s=n(5086),a=n(7197),c=(n(1604),n(5938));function l(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function g(){return typeof window>"u"}function m(){return!g()}function b(e){return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const w=e=>f(void 0,0,void 0,(function*(){return b(yield(yield fetch(e)).text())}));function y(e,t){var n;return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return w(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const i=yield p(e,h[t]);n(i)}catch(i){console.error(`Failed to load image. message: ${i.mesaage}`),r(i)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const v=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i=0;i{if(e===t||S(e)&&S(t)&&isNaN(e)&&isNaN(t))return!0;if(j(e)&&j(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return v(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!x(o,t.get(r),n))return!1;return!0}return v(e,t,n)};function k(e,t){return x(e,t,new WeakMap)}function j(e){return"function"==typeof e}function S(e){return"number"==typeof e}function C(e){return!function(e){return Object(e)!==e}(e)}function E(){}function I(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const R=(...e)=>t=>e.forEach((e=>{if(j(e))e(t);else if(null!=e){e.current=t}}));function L(...e){return(0,o.useCallback)(R(...e),e)}const F=o.forwardRef(((e,t)=>{const{children:n}=e,i=l(e,["children"]),s=o.Children.toArray(n),a=s.find(N);if(a){const e=a.props.children,n=s.map((t=>t===a?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(O,Object.assign({},i,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(O,Object.assign({},i,{ref:t,children:n}))}));F.displayName="Slot";const O=o.forwardRef(((e,t)=>{const{children:n}=e,r=l(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),i):"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?R(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));O.displayName="SlotClone";const z=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function N(e){return o.isValidElement(e)&&e.type===z}var P="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const M=d(((e,t)=>{var{ratio:n,style:o,as:s="div",asChild:a=!1}=e,c=l(e,["ratio","style","as","asChild"]);const u=a?F:s,d=Object.assign({aspectRatio:n},o),f=a?c.className:i(P,c.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},c))})),$=()=>E,T=()=>!1,W=()=>!0;function D({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)($,T,W)?e:t}function Y(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const X=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>Y()?(0,r.jsx)(r.Fragment,{children:t}):e;function A(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function V(e){const t=A(e);(0,o.useEffect)((()=>()=>t()),[t])}function _(e,t=k){const[n,r]=(0,o.useState)(e),i=A(t);return(0,o.useEffect)((()=>{i(n,e)||r(e)}),[i,n,e]),n}function B(e,t,n){const r=A(e),i=_(n),a=(0,o.useMemo)((()=>(0,s.A)(r,t,i)),[r,t,i]);return V((()=>a.cancel())),a}const H=({children:e,capture:t,wait:n,options:r})=>{const i=o.Children.only(e),s=B(((...e)=>{const n=i?.props;if(n&&j(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(i,{[t]:s})};function J({onIntersectStart:e=E,onIntersectEnd:t=E,enabled:n=!0,calledOnce:r=!1,root:i=null,threshold:s=0,rootMargin:a="0px 0px 0px 0px"}){const c=(0,o.useRef)(0),l=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=A((([n],o)=>{if(!n)return;const i=n.target;n.isIntersecting?(l.current=!0,c.current+=1,e(n)):l.current&&(l.current=!1,c.current+=1,t(n)),r&&c.current>1&&o.unobserve(i)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:s,root:i,rootMargin:a}),u.current.observe(e))}),[n,s,i,a,d])}}const U=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:i,rootMargin:s}=e,a=l(e,["src","threshold","root","rootMargin"]);const{ref:c}=J({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:i,rootMargin:s});return(0,r.jsx)("img",Object.assign({ref:L(t,c)},a))}));U.displayName="LazyImage";const K=(0,o.forwardRef)(((e,t)=>{var{width:n,height:i,fallback:s,className:a,style:c,duration:u="0.2s",onLoad:d}=e,f=l(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,p]=(0,o.useState)(!1),g=!h,m=(0,o.useMemo)((()=>({position:"relative",width:n,height:i})),[n,i]),b=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:g?0:1,transition:`opacity ${u}`},c)),[g,u,c]),w=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),y=a?`lazy-image-wrapper ${a}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:y,style:m,children:[g&&s,(0,r.jsx)(U,Object.assign({ref:t,width:n,height:i,style:b,onLoad:w},f))]})}));K.displayName="FallbackLazyImage";const G=({condition:e,trueComponent:t,falseComponent:n})=>{const i=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:i?t:n})},Z=({onScrollAction:e,children:t,root:n,threshold:o,enabled:i,triggerPosition:s="after",rootMargin:a="150px 0px"})=>{const{ref:c}=J({onIntersectStart:e,root:n,threshold:o,enabled:i,rootMargin:a});return(0,r.jsxs)(r.Fragment,{children:["before"===s&&(0,r.jsx)("div",{ref:c}),t,"after"===s&&(0,r.jsx)("div",{ref:c})]})},Q=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1}=e,a=l(e,["children","as","asChild"]);const c=s?F:i,{ref:u}=J(a);if(s&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(c,Object.assign({ref:R(t,u)},a,{children:n}))})),q=({items:e=[],itemKey:t,renderItem:n})=>{const i=(0,o.useCallback)(((e,n)=>function(e){return C(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},i(e,t))))})},ee=m()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=A(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),i=(0,o.useMemo)((()=>function(){if(g())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,i,(({target:t})=>{if(!r.current)return;const o=r.current,i=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!i&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1,onPointerDown:a,excludeRefs:c=[]}=e,u=l(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(a,{excludeRefs:c}),f=s?F:i;if(s&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:R(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const ie=({itemKey:e,items:t=[],separator:n,renderItem:i,separatorInterval:s=1,includeLastSeparator:a=!1})=>{const c=(0,o.useCallback)((e=>e===t.length-1?a:(e+1)%s==0),[a,s,t.length]);return(0,r.jsx)(q,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[i(e,t),c(t)&&n]})})},se=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ae=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function ce(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function le(e=!0){const t=j(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!i.current){i.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{i.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),i=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield b(e);return t(n),!0}catch{return t(null),!1}}))),[]),s=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield y(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),a=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:i,copyImage:s,readText:a,readContents:c}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",pe={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},ge=e=>pe[e],me=ge("localStorage"),be=e=>window.localStorage.getItem(e),we=e=>JSON.stringify(e),ye=e=>(me.subscribe(e),()=>{me.unsubscribe(e)});function ve(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=j(n)?n():n,i=(0,o.useSyncExternalStore)(ye,(()=>be(t)),(()=>we(r)));return{state:(0,o.useMemo)((()=>i?I(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=be(t),o=n?I(n):r,i=j(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(i)),me.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),me.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const xe=(e,t)=>m()?window.matchMedia(e).matches:t??!1;function ke(e,t){const[n,r]=(0,o.useState)(xe(e,t)),i=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",i),n}function je(){return ke("(prefers-color-scheme: dark)")?"dark":"light"}const Se="color-scheme";function Ce({defaultValue:e,key:t=Se,shouldSetBodyClass:n=!1}={}){const r=je(),i=j(e)?e():e,{state:s,setState:a}=ve({key:t,initialValue:i??r}),c=(0,o.useCallback)((()=>{a((e=>"dark"===e?"light":"dark"))}),[a]),l=(0,o.useCallback)((()=>{a("dark")}),[a]),u=(0,o.useCallback)((()=>{a("light")}),[a]),d=(0,o.useCallback)((()=>{a(r)}),[a,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(s),()=>{n&&document.body.classList.remove(s)})),[s,n]),{colorScheme:s,preferredColorScheme:r,setToggleMode:c,setDarkMode:l,setLightMode:u,setPreferredMode:d}}function Ee(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),i=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),s=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:i,reset:s}}function Ie({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,i]=(0,o.useState)(t),s=r0,c=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),l=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const s=c(e,t);o&&o({prev:r,next:s}),i(s)}),[n,r,c]),u=(0,o.useCallback)((e=>{l("nextStep",!s,e)}),[s,l]),d=(0,o.useCallback)((e=>{l("prevStep",!a,e)}),[a,l]),f=(0,o.useCallback)(((t,n)=>{const o=j(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void i(t);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),i(t)}),[r,t]);return{currentStep:r,hasNextStep:s,hasPrevStep:a,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Re(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:i,resetStep:s}=Ie({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:i,resetIndex:s}}function Le(e,t,n={}){const[r,i]=(0,o.useState)(e);return[r,B(i,t,n)]}function Fe(e,t={}){const[n,r]=(0,o.useState)(""),[i,s]=Le("",e,t);return{value:n,debouncedValue:i,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),s(t)}),[s]),onReset:(0,o.useCallback)((()=>{r(""),s("")}),[s])}}function Oe(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function ze({onFocus:e=E,onBlur:t=E}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=A((t=>{r(!0),e(t)})),a=A((e=>{r(!1),t(e)})),c=(0,o.useCallback)((()=>{i.current&&(i.current.focus(),r(!0))}),[]);return ne(i,"focus",s),ne(i,"blur",a),{ref:i,isFocus:n,setFocus:c}}function Ne({onEnter:e=E,onLeave:t=E}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=A((t=>{r(!0),e(t)})),a=A((e=>{r(!1),t(e)}));return ne(i,"mouseenter",s),ne(i,"mouseleave",a),{ref:i,isHovered:n}}const Pe=e=>{var t;return S(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function Me(e,t){const n=(0,o.useRef)(),r=A(e),{delay:i,enabled:s}=Pe(t),a=(0,o.useCallback)((()=>{n.current=window.setInterval(r,i)}),[r,i]),c=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{c(),a()}),[c,a]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return a(),()=>c()}),[c,a,s,i]),{set:a,reset:l,clear:c}}function $e({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),i=A((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];j(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",i),()=>t.removeEventListener("keydown",i)}),[e,i]),r}const Te={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function We(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)(Te),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:i,clientY:s,pageX:a,pageY:c}=t;let l=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();l=i-t.left,u=s-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:i,clientY:s,pageX:a,pageY:c,elementRelativeX:l,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const De=()=>navigator.onLine,Ye=()=>!0,Xe=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function Ae({onlineAction:e=E,offlineAction:t=E}={}){const n=A((n=>Xe(n,e,t)));return(0,o.useSyncExternalStore)(n,De,Ye)}function Ve(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const _e={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Be(e=E){const[t,n]=(0,o.useState)(_e),r=(0,o.useRef)(null),i=A((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(i);return t.observe(e),()=>{t.unobserve(e)}}),[i]),{ref:r,contentRect:t}}function He({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),i=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>i())),[e,r,i]),{ref:t,lock:r,unlock:i}}const Je=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,Ue=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:i=0,alignY:s="start",alignX:a="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+i+Je(window.innerHeight,r.height,s),left:r.left+window.scrollX+o+Je(window.innerWidth,r.width,a)};const c=e.getBoundingClientRect();return{top:r.top-c.top+e.scrollTop+i+Je(c.height,r.height,s),left:r.left-c.left+e.scrollLeft+o+Je(c.width,r.width,a)}};function Ke(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:i,top:s}=Ue(r,t,n);r.scrollTo({top:s,left:i,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ge=ge("sessionStorage"),Ze=e=>window.sessionStorage.getItem(e),Qe=e=>JSON.stringify(e),qe=e=>(Ge.subscribe(e),()=>{Ge.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=j(n)?n():n,i=(0,o.useSyncExternalStore)(qe,(()=>Ze(t)),(()=>Qe(r)));return{state:(0,o.useMemo)((()=>i?I(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=Ze(t),o=n?I(n):r,i=j(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(i)),Ge.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ge.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:i}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[s,a]=(0,o.useState)(n),c=(0,o.useCallback)((e=>{a((t=>{const n=j(e)?e(t):e;return r&&i&&function(e,t,n){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=j(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,i,n),n}))}),[r,i]),l=(0,o.useCallback)((()=>{r&&i&&function(e,t){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,i),a(null)}),[r,i]);return Object.assign({state:s,setState:c,clearState:l},Ie(e))}function nt(e,t,n={}){const r=A(e),i=_(n),s=(0,o.useMemo)((()=>(0,a.A)(r,t,i)),[r,t,i]);return V((()=>s.cancel())),s}const rt=e=>{var t;return S(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=A(e),{delay:i,enabled:s}=rt(t),a=(0,o.useCallback)((()=>{n.current=setTimeout(r,i)}),[r,i]),c=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{c(),a()}),[c,a]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return a(),()=>c()}),[a,c,i,s]),{set:a,reset:l,clear:c}}function it(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function st(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new c.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function at({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const ct={width:null,height:null};function lt({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>g()?ct:{width:window.innerWidth,height:window.innerHeight})),r=B(n,e),i=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",i),t}function ut(e,t,n){const{delay:r,enabled:i}=rt(t),{set:s,reset:a,clear:c}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!i||a()}),[r,i,a,...n]),{set:s,reset:a,clear:c}}}}]);
\ No newline at end of file
diff --git a/assets/js/24c74d07.f02220dd.js b/assets/js/24c74d07.f02220dd.js
new file mode 100644
index 000000000..b12763bf7
--- /dev/null
+++ b/assets/js/24c74d07.f02220dd.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[8440],{9690:(e,n,t)=>{t.r(n),t.d(n,{Example:()=>p,assets:()=>h,contentTitle:()=>u,default:()=>m,frontMatter:()=>d,metadata:()=>r,toc:()=>g});const r=JSON.parse('{"id":"react/components/FallbackLazyImage","title":"FallbackLazyImage","description":"LazyImage \ucef4\ud3ec\ub10c\ud2b8 \ub97c \ud655\uc7a5\ud574 \uc774\ubbf8\uc9c0 load \uc5ec\ubd80\uc5d0 \ub530\ub978 Fallback \ucef4\ud3ec\ub10c\ud2b8\ub97c \ub80c\ub354\ub9c1 \ud558\ub294 \ucef4\ud3ec\ub10c\ud2b8 \uc785\ub2c8\ub2e4.","source":"@site/docs/react/components/FallbackLazyImage.mdx","sourceDirName":"react/components","slug":"/react/components/FallbackLazyImage","permalink":"/modern-kit/docs/react/components/FallbackLazyImage","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"DebounceHandler","permalink":"/modern-kit/docs/react/components/DebounceHandler"},"next":{"title":"IfElse","permalink":"/modern-kit/docs/react/components/IfElse"}}');var o=t(6206),a=t(3267),i=t(4076),s=t(4382),c=t(7261);const l=(0,s.forwardRef)(((e,n)=>{var{width:t,height:r,fallback:a,className:l,style:d,duration:u="0.2s",onLoad:h}=e,p=(0,i._)(e,["width","height","fallback","className","style","duration","onLoad"]);const[g,f]=(0,s.useState)(!1),m=!g,b=(0,s.useMemo)((()=>({position:"relative",width:t,height:r})),[t,r]),y=(0,s.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:m?0:1,transition:`opacity ${u}`},d)),[m,u,d]),x=(0,s.useCallback)((e=>{h&&h(e),f(!0)}),[h]),w=l?`lazy-image-wrapper ${l}`:"lazy-image-wrapper";return(0,o.jsxs)("div",{className:w,style:b,children:[m&&a,(0,o.jsx)(c.o,Object.assign({ref:n,width:t,height:r,style:y,onLoad:x},p))]})}));l.displayName="FallbackLazyImage";const d={},u="FallbackLazyImage",h={},p=()=>{const e={div:"div",...(0,a.R)()},n={width:"500px",height:"500px",backgroundColor:"green"};return(0,o.jsxs)(e.div,{style:{background:"#f8f8f8",width:"500px"},children:[(0,o.jsx)(e.div,{style:{height:"500px",textAlign:"center",fontSize:"2rem"},children:"\uc2a4\ud06c\ub864 \ud574\uc8fc\uc138\uc694."}),(0,o.jsx)(l,{fallback:(0,o.jsx)(e.div,{style:n}),src:"https://github.com/Team-Grace/devgrace/assets/64779472/b5640bec-2abc-4205-afbf-ccfd9876a90b",alt:"img1",width:500,height:500}),(0,o.jsx)(e.div,{style:{width:"100%",height:"150px"}}),(0,o.jsx)(l,{fallback:(0,o.jsx)(e.div,{style:n}),src:"https://github.com/Team-Grace/devgrace/assets/64779472/207743a7-b29f-4826-bc08-8df0d67e568b",alt:"img2",width:500,height:500}),(0,o.jsx)(e.div,{style:{width:"100%",height:"150px"}}),(0,o.jsx)(l,{fallback:(0,o.jsx)(e.div,{style:n}),src:"https://github.com/Team-Grace/devgrace/assets/64779472/d1957ec8-fe87-406e-bfda-fb4ee505b152",alt:"img3",width:500,height:500})]})},g=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Default",id:"default",level:3},{value:"Wrapper Styling: css",id:"wrapper-styling-css",level:3},{value:"Wrapper Styling: css-in-js",id:"wrapper-styling-css-in-js",level:3},{value:"Example",id:"example",level:2}];function f(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,a.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.header,{children:(0,o.jsx)(n.h1,{id:"fallbacklazyimage",children:"FallbackLazyImage"})}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.strong,{children:(0,o.jsx)(n.a,{href:"https://modern-agile-team.github.io/modern-kit/docs/react/components/LazyImage",children:"LazyImage \ucef4\ud3ec\ub10c\ud2b8"})})," \ub97c \ud655\uc7a5\ud574 \uc774\ubbf8\uc9c0 ",(0,o.jsx)(n.code,{children:"load \uc5ec\ubd80"}),"\uc5d0 \ub530\ub978 ",(0,o.jsx)(n.code,{children:"Fallback \ucef4\ud3ec\ub10c\ud2b8"}),"\ub97c \ub80c\ub354\ub9c1 \ud558\ub294 \ucef4\ud3ec\ub10c\ud2b8 \uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.code,{children:"src"}),"\uc640 \ub354\ubd88\uc5b4 ",(0,o.jsx)(n.code,{children:"width"}),", ",(0,o.jsx)(n.code,{children:"height"}),", ",(0,o.jsx)(n.code,{children:"fallback"})," props\ub97c \ud544\uc218\ub85c \ub118\uaca8\uc918\uc57c \ud558\uba70, fallback\uc758 \ud06c\uae30\ub294 \ud574\ub2f9 width, height\uc640 \ub3d9\uc77c\ud558\uac8c \ub9de\ucd94\ub294 \uac83\uc744 \uad8c\uc7a5\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.code,{children:"duration"})," props\ub294 \uc2e4\uc81c \uc774\ubbf8\uc9c0\uac00 load \ub41c \ud6c4, fallback \ucef4\ud3ec\ub10c\ud2b8\uc5d0\uc11c \uc2e4\uc81c \uc774\ubbf8\uc9c0\ub85c \uc804\ud658 \ub420 \ub54c \uc0ac\uc6a9\ud558\ub294 ",(0,o.jsx)(n.strong,{children:(0,o.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/CSS/transition-duration",children:"transition-duration"})})," \uac12\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(n.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/components/FallbackLazyImage/index.tsx",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(n.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"interface IntersectionObserverInit {\n root?: Element | Document | null;\n rootMargin?: string;\n threshold?: number | number[];\n}\n\ninterface LazyImageProps\n extends React.ComponentProps<'img'>,\n IntersectionObserverInit {\n src: string;\n}\n"})}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",metastring:'title="typescrpt"',children:"interface FallbackLazyImageProps extends LazyImageProps {\n fallback: JSX.Element;\n width: string | number;\n height: string | number;\n duration?: CSSProperties['transitionDuration']; // default: 0.2s\n}\n\nconst FallbackLazyImage: React.ForwardRefExoticComponent<\n Omit & React.RefAttributes\n>;\n"})}),"\n",(0,o.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(n.h3,{id:"default",children:"Default"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { FallbackLazyImage } from '@modern-kit/react';\nimport img1 from '../assets/img1.png';\n\nconst Example = () => {\n const skeletonStyle = useMemo(\n () => ({\n width: '400px', // \uc2e4\uc81c img \ud06c\uae30\uc640 \ub3d9\uc77c\ud558\uac8c \ub9de\ucdb0\uc8fc\uc138\uc694.\n height: '400px', // \uc2e4\uc81c img \ud06c\uae30\uc640 \ub3d9\uc77c\ud558\uac8c \ub9de\ucdb0\uc8fc\uc138\uc694.\n backgroundColor: 'green',\n }),\n []\n );\n return (\n \n }\n width={400}\n height={400}\n src={img1}\n alt=\"img1\"\n />\n
\n );\n};\n"})}),"\n",(0,o.jsx)(n.h3,{id:"wrapper-styling-css",children:"Wrapper Styling: css"}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:["FallbackLazyImage \ucef4\ud3ec\ub10c\ud2b8 \ub0b4 ",(0,o.jsx)(n.code,{children:"Image Wrapper"}),"\ub294 \uae30\ubcf8\uc801\uc73c\ub85c ",(0,o.jsx)(n.code,{children:"lazy-image-wrapper"})," \ud074\ub798\uc2a4\ub97c \uac16\uc2b5\ub2c8\ub2e4. \ud574\ub2f9 \ud074\ub798\uc2a4\ub97c \ud65c\uc6a9\ud558\uc5ec \uc2a4\ud0c0\uc77c\uc744 \uc81c\uc5b4 \ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-css",children:"/* css stylesheet */\n.lazy-image-wrapper {\n border-radius: 12px;\n overflow: hidden;\n}\n\n.lazy-image-wrapper > img {\n /* image styling */\n}\n"})}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-tsx",children:"\n"})}),"\n",(0,o.jsx)(n.h3,{id:"wrapper-styling-css-in-js",children:"Wrapper Styling: css-in-js"}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"css-in-js"}),"\uc758 ",(0,o.jsx)(n.code,{children:"\uc0c1\uc18d"}),"\uae30\ub2a5\uc744 \ud65c\uc6a9\ud558\uc5ec \uc0c8\ub85c\uc6b4 \ucef4\ud3ec\ub10c\ud2b8\ub97c \uc791\uc131 \ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-tsx",children:"const Image = styled(FallbackLazyImage)`\n border-radius: 12px;\n overflow: hidden;\n\n & > img {\n /* image styling */\n }\n`;\n"})}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-tsx",children:"\n"})}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(p,{})]})}function m(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(f,{...e})}):f(e)}},4076:(e,n,t)=>{function r(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);or,a:()=>o}),"function"==typeof SuppressedError&&SuppressedError},3267:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>s});var r=t(4382);const o={},a=r.createContext(o);function i(e){const n=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),r.createElement(a.Provider,{value:n},e.children)}},7261:(e,n,t)=>{t.d(n,{o:()=>l});var r=t(4076),o=t(6206),a=t(4382),i=t(7399),s=t(2424);function c(...e){return(0,a.useCallback)((0,s.P)(...e),e)}const l=(0,a.forwardRef)(((e,n)=>{var{src:t,threshold:a,root:s,rootMargin:l}=e,d=(0,r._)(e,["src","threshold","root","rootMargin"]);const{ref:u}=(0,i.B)({onIntersectStart:e=>{e.target.src=t},calledOnce:!0,threshold:a,root:s,rootMargin:l});return(0,o.jsx)("img",Object.assign({ref:c(n,u)},d))}));l.displayName="LazyImage"},7399:(e,n,t)=>{t.d(n,{B:()=>i});var r=t(4382),o=t(6765),a=t(9340);function i({onIntersectStart:e=a.lQ,onIntersectEnd:n=a.lQ,enabled:t=!0,calledOnce:i=!1,root:s=null,threshold:c=0,rootMargin:l="0px 0px 0px 0px"}){const d=(0,r.useRef)(0),u=(0,r.useRef)(!1),h=(0,r.useRef)(null),p=(0,o.p)((([t],r)=>{if(!t)return;const o=t.target;t.isIntersecting?(u.current=!0,d.current+=1,e(t)):u.current&&(u.current=!1,d.current+=1,n(t)),i&&d.current>1&&r.unobserve(o)}));return{ref:(0,r.useCallback)((e=>{h.current&&(h.current.disconnect(),h.current=null),null!==e&&t&&(h.current=new IntersectionObserver(p,{threshold:c,root:s,rootMargin:l}),h.current.observe(e))}),[t,c,s,l,p])}}},6765:(e,n,t)=>{t.d(n,{p:()=>o});var r=t(4382);function o(e){const n=(0,r.useRef)(e);return n.current=e,(0,r.useCallback)(((...e)=>n.current(...e)),[])}},2424:(e,n,t)=>{t.d(n,{P:()=>o});var r=t(9340);const o=(...e)=>n=>e.forEach((e=>{if((0,r.Tn)(e))e(n);else if(null!=e){e.current=n}}))},9340:(e,n,t)=>{function r(e,n,t,r){return new(t||(t=Promise))((function(o,a){function i(e){try{c(r.next(e))}catch(n){a(n)}}function s(e){try{c(r.throw(e))}catch(n){a(n)}}function c(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(i,s)}c((r=r.apply(e,n||[])).next())}))}t.d(n,{Et:()=>w,Fr:()=>s,Gp:()=>b,Ol:()=>z,Qd:()=>j,S$:()=>i,Tn:()=>y,Zp:()=>h,dK:()=>l,fl:()=>S,gD:()=>x,i5:()=>g,if:()=>p,l6:()=>k,lQ:()=>I,nS:()=>u,ni:()=>O,oc:()=>c}),"function"==typeof SuppressedError&&SuppressedError;const o={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};const a=(e,n)=>new Promise(((t,r)=>{e.toBlob((e=>{e?t(e):r(new Error(`Failed to create blob with format ${n}`))}),n)}));function i(){return"undefined"==typeof window}function s(){if(i())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}function c(){return!i()}function l(e){return r(this,void 0,void 0,(function*(){if(!c())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const n=document.createElement("textarea");n.value=e,n.style.opacity="0",document.body.appendChild(n),n.focus(),n.select();try{return document.execCommand("copy"),e}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}finally{document.body.removeChild(n)}}(e)}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}}))}const d=e=>r(void 0,void 0,void 0,(function*(){const n=yield fetch(e);return l(yield n.text())}));function u(e,n){var t;return r(this,void 0,void 0,(function*(){if(!c())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator))return d(e);if(!("write"in window.navigator.clipboard))return d(e);if(null!==(t=null==n?void 0:n.toText)&&void 0!==t&&t)return d(e);const i=yield function(e,n="png"){return new Promise(((t,i)=>{const s=new Image;s.onload=()=>r(this,void 0,void 0,(function*(){const e=document.createElement("canvas");e.width=s.width,e.height=s.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(s,0,0);const i=yield a(e,o[n]);t(i)}catch(r){console.error(`Failed to load image. message: ${r.mesaage}`),i(r)}})),s.onerror=()=>{i(new Error("Failed to load image"))},s.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[i.type]:i})]),i}catch(i){throw console.error(`Failed to copy to clipboard. message: ${i.message}`),i}}))}function h(){return r(this,void 0,void 0,(function*(){if(!c())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function p(){return r(this,void 0,void 0,(function*(){if(!c())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function g(e,n){return Object.prototype.hasOwnProperty.call(e,n)}const f=(e,n,t)=>{const r=Object.keys(e),o=Object.keys(n);if(r.length!==o.length)return!1;for(let a=0;a{if(e===n)return!0;if(w(e)&&w(n)&&isNaN(e)&&isNaN(n))return!0;if(y(e)&&y(n))return e.toString()===n.toString();if("object"!=typeof e||"object"!=typeof n||null===e||null===n)return!1;if(t.has(e)&&t.get(e)===n)return!0;if(t.set(e,n),e.constructor!==n.constructor)return!1;if(e instanceof Set){if(e.size!==n.size)return!1;const r=[...e],o=[...n];return f(r,o,t)}if(e instanceof Map){if(e.size!==n.size)return!1;for(const[r,o]of e)if(!n.has(r)||!m(o,n.get(r),t))return!1;return!0}return f(e,n,t)};function b(e,n){return m(e,n,new WeakMap)}function y(e){return"function"==typeof e}function x(e){return null==e}function w(e){return"number"==typeof e}function v(e){return!function(e){return Object(e)!==e}(e)}function j(e){return v(e)&&"[object Object]"===Object.prototype.toString.call(e)}function k(e){return e===window}function I(){}function z(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(n){throw new Error(`Failed to parse data: ${n}`)}}function E(e){return Object.keys(e)}const F={days:864e5,hours:36e5,minutes:6e4,seconds:1e3};E(F);function S(e,n){if(!c())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(n)}catch(t){throw new Error(`Failed to remove key "${n}" from ${e}: ${t}`)}}function O(e,n,t){if(!c())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=y(t)?t():t;r.setItem(n,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${n}" in ${e}: ${r}`)}}}}]);
\ No newline at end of file
diff --git a/assets/js/295f1714.2f90ba2f.js b/assets/js/295f1714.2f90ba2f.js
deleted file mode 100644
index 6d21932ec..000000000
--- a/assets/js/295f1714.2f90ba2f.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[8310],{1632:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>d,assets:()=>u,contentTitle:()=>l,default:()=>p,frontMatter:()=>a,metadata:()=>r,toc:()=>f});const r=JSON.parse('{"id":"react/hooks/useHover","title":"useHover","description":"\ub300\uc0c1 \ucef4\ud3ec\ub10c\ud2b8\ub97c \uae30\uc900\uc73c\ub85c \ub9c8\uc6b0\uc2a4\uac00 \uc62c\ub77c\uac00\uac70\ub098 \ub0b4\ub824\uac14\uc744 \ub54c\uc758 \uc0c1\ud0dc\ub97c \ubc18\ud658\ud558\uace0, \ub9c8\uc6b0\uc2a4\uac00 \uc62c\ub77c\uac00\uac70\ub098 \ub0b4\ub824\uac14\uc744 \ub54c\uc758 \uc561\uc158\uc744 \uc815\uc758\ud560 \uc218 \uc788\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useHover.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useHover","permalink":"/modern-kit/docs/react/hooks/useHover","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useForceUpdate","permalink":"/modern-kit/docs/react/hooks/useForceUpdate"},"next":{"title":"useImageStatus","permalink":"/modern-kit/docs/react/hooks/useImageStatus"}}');var o=n(6206),s=n(3267),i=n(4027),c=n(4382);const a={},l="useHover",u={},d=()=>{const e={div:"div",...(0,s.R)()},[t,n]=(0,c.useState)(0),{ref:r,isHovered:a}=(0,i.Mk)({onEnter:()=>n((e=>e+1)),onLeave:()=>n((e=>e-1))});return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(e.div,{ref:r,style:{width:"200px",height:"200px",backgroundColor:"skyBlue"},children:a?"hover":"leave"}),(0,o.jsx)(e.div,{children:t})]})},f=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function h(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"usehover",children:"useHover"})}),"\n",(0,o.jsx)(t.p,{children:"\ub300\uc0c1 \ucef4\ud3ec\ub10c\ud2b8\ub97c \uae30\uc900\uc73c\ub85c \ub9c8\uc6b0\uc2a4\uac00 \uc62c\ub77c\uac00\uac70\ub098 \ub0b4\ub824\uac14\uc744 \ub54c\uc758 \uc0c1\ud0dc\ub97c \ubc18\ud658\ud558\uace0, \ub9c8\uc6b0\uc2a4\uac00 \uc62c\ub77c\uac00\uac70\ub098 \ub0b4\ub824\uac14\uc744 \ub54c\uc758 \uc561\uc158\uc744 \uc815\uc758\ud560 \uc218 \uc788\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useHover/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"const useHover: ({\n onEnter?: (event: MouseEvent) => void,\n onLeave?: (event: MouseEvent) => void,\n}) => {\n ref: T,\n isHovered: boolean\n}\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useHover } from '@modern-kit/react';\n\nconst Example = () => {\n const [counter, setCounter] = useState(0);\n\n const { ref, isHovered } = useHover({\n onEnter: () => setCounter((count) => count + 1),\n onLeave: () => setCounter((count) => count - 1)\n });\n\n const style = {\n width: '200px',\n height: '200px',\n backgroundColor: 'skyBlue'\n };\n\n return (\n <>\n {isHovered ? 'hover' : 'leave'}
\n {counter}
\n >\n );\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(d,{})]})}function p(e={}){const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(h,{...e})}):h(e)}},4027:(e,t,n)=>{n.d(t,{$$:()=>Pe,$I:()=>oe,AE:()=>Ae,BL:()=>J,DX:()=>I,FT:()=>ct,Fo:()=>et,Hn:()=>st,I5:()=>je,JF:()=>Te,K:()=>le,K$:()=>ze,M0:()=>Fe,ML:()=>ne,Mj:()=>ye,Mk:()=>Ne,Mo:()=>se,NT:()=>Ye,QV:()=>Ke,Ub:()=>ke,Ut:()=>Ee,W7:()=>K,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>Be,Zu:()=>ae,_1:()=>Oe,_g:()=>nt,aL:()=>z,aY:()=>Ie,bB:()=>X,d7:()=>_,eG:()=>it,fN:()=>ce,fm:()=>G,gl:()=>P,hN:()=>V,iD:()=>de,iQ:()=>Me,jd:()=>ie,lW:()=>lt,oD:()=>U,oo:()=>Re,pL:()=>q,qi:()=>ue,rN:()=>Le,tD:()=>Se,u8:()=>Q,wY:()=>_e,xV:()=>M,xh:()=>tt,zy:()=>Z});var r=n(6206),o=n(4382),s=n(3683),i=n(5086),c=n(7197),a=(n(1604),n(5938));function l(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function m(){return typeof window>"u"}function v(){return!m()}function g(e){return f(this,0,void 0,(function*(){if(!v())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const w=e=>f(void 0,0,void 0,(function*(){return g(yield(yield fetch(e)).text())}));function b(e,t){var n;return f(this,0,void 0,(function*(){if(!v())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return w(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const s=yield p(e,h[t]);n(s)}catch(s){console.error(`Failed to load image. message: ${s.mesaage}`),r(s)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let s=0;s{if(e===t||C(e)&&C(t)&&isNaN(e)&&isNaN(t))return!0;if(S(e)&&S(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return y(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!x(o,t.get(r),n))return!1;return!0}return y(e,t,n)};function k(e,t){return x(e,t,new WeakMap)}function S(e){return"function"==typeof e}function C(e){return"number"==typeof e}function E(e){return!function(e){return Object(e)!==e}(e)}function j(){}function R(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const O=(...e)=>t=>e.forEach((e=>{if(S(e))e(t);else if(null!=e){e.current=t}}));function F(...e){return(0,o.useCallback)(O(...e),e)}const I=o.forwardRef(((e,t)=>{const{children:n}=e,s=l(e,["children"]),i=o.Children.toArray(n),c=i.find(N);if(c){const e=c.props.children,n=i.map((t=>t===c?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(L,Object.assign({},s,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(L,Object.assign({},s,{ref:t,children:n}))}));I.displayName="Slot";const L=o.forwardRef(((e,t)=>{const{children:n}=e,r=l(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...e)=>{s(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),s):"className"===r&&(n[r]=[o,s].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?O(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));L.displayName="SlotClone";const M=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function N(e){return o.isValidElement(e)&&e.type===M}var $="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const P=d(((e,t)=>{var{ratio:n,style:o,as:i="div",asChild:c=!1}=e,a=l(e,["ratio","style","as","asChild"]);const u=c?I:i,d=Object.assign({aspectRatio:n},o),f=c?a.className:s($,a.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},a))})),T=()=>j,H=()=>!1,Y=()=>!0;function X({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)(T,H,Y)?e:t}function D(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const V=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>D()?(0,r.jsx)(r.Fragment,{children:t}):e;function A(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function B(e){const t=A(e);(0,o.useEffect)((()=>()=>t()),[t])}function W(e,t=k){const[n,r]=(0,o.useState)(e),s=A(t);return(0,o.useEffect)((()=>{s(n,e)||r(e)}),[s,n,e]),n}function _(e,t,n){const r=A(e),s=W(n),c=(0,o.useMemo)((()=>(0,i.A)(r,t,s)),[r,t,s]);return B((()=>c.cancel())),c}const z=({children:e,capture:t,wait:n,options:r})=>{const s=o.Children.only(e),i=_(((...e)=>{const n=s?.props;if(n&&S(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(s,{[t]:i})};function J({onIntersectStart:e=j,onIntersectEnd:t=j,enabled:n=!0,calledOnce:r=!1,root:s=null,threshold:i=0,rootMargin:c="0px 0px 0px 0px"}){const a=(0,o.useRef)(0),l=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=A((([n],o)=>{if(!n)return;const s=n.target;n.isIntersecting?(l.current=!0,a.current+=1,e(n)):l.current&&(l.current=!1,a.current+=1,t(n)),r&&a.current>1&&o.unobserve(s)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:i,root:s,rootMargin:c}),u.current.observe(e))}),[n,i,s,c,d])}}const U=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:s,rootMargin:i}=e,c=l(e,["src","threshold","root","rootMargin"]);const{ref:a}=J({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:s,rootMargin:i});return(0,r.jsx)("img",Object.assign({ref:F(t,a)},c))}));U.displayName="LazyImage";const K=(0,o.forwardRef)(((e,t)=>{var{width:n,height:s,fallback:i,className:c,style:a,duration:u="0.2s",onLoad:d}=e,f=l(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,p]=(0,o.useState)(!1),m=!h,v=(0,o.useMemo)((()=>({position:"relative",width:n,height:s})),[n,s]),g=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:m?0:1,transition:`opacity ${u}`},a)),[m,u,a]),w=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),b=c?`lazy-image-wrapper ${c}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:b,style:v,children:[m&&i,(0,r.jsx)(U,Object.assign({ref:t,width:n,height:s,style:g,onLoad:w},f))]})}));K.displayName="FallbackLazyImage";const Z=({condition:e,trueComponent:t,falseComponent:n})=>{const s=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:s?t:n})},Q=({onScrollAction:e,children:t,root:n,threshold:o,enabled:s,triggerPosition:i="after",rootMargin:c="150px 0px"})=>{const{ref:a}=J({onIntersectStart:e,root:n,threshold:o,enabled:s,rootMargin:c});return(0,r.jsxs)(r.Fragment,{children:["before"===i&&(0,r.jsx)("div",{ref:a}),t,"after"===i&&(0,r.jsx)("div",{ref:a})]})},q=d(((e,t)=>{var{children:n,as:s="div",asChild:i=!1}=e,c=l(e,["children","as","asChild"]);const a=i?I:s,{ref:u}=J(c);if(i&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(a,Object.assign({ref:O(t,u)},c,{children:n}))})),G=({items:e=[],itemKey:t,renderItem:n})=>{const s=(0,o.useCallback)(((e,n)=>function(e){return E(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},s(e,t))))})},ee=v()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=A(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),s=(0,o.useMemo)((()=>function(){if(m())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,s,(({target:t})=>{if(!r.current)return;const o=r.current,s=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!s&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:s="div",asChild:i=!1,onPointerDown:c,excludeRefs:a=[]}=e,u=l(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(c,{excludeRefs:a}),f=i?I:s;if(i&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:O(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const se=({itemKey:e,items:t=[],separator:n,renderItem:s,separatorInterval:i=1,includeLastSeparator:c=!1})=>{const a=(0,o.useCallback)((e=>e===t.length-1?c:(e+1)%i==0),[c,i,t.length]);return(0,r.jsx)(G,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[s(e,t),a(t)&&n]})})},ie=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ce=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function ae(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function le(e=!0){const t=S(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!s.current){s.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{s.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),s=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield g(e);return t(n),!0}catch{return t(null),!1}}))),[]),i=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield b(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!v())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),a=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!v())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:s,copyImage:i,readText:c,readContents:a}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",pe={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},me=e=>pe[e],ve=me("localStorage"),ge=e=>window.localStorage.getItem(e),we=e=>JSON.stringify(e),be=e=>(ve.subscribe(e),()=>{ve.unsubscribe(e)});function ye(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=S(n)?n():n,s=(0,o.useSyncExternalStore)(be,(()=>ge(t)),(()=>we(r)));return{state:(0,o.useMemo)((()=>s?R(s):r),[s,r]),setState:(0,o.useCallback)((e=>{try{const n=ge(t),o=n?R(n):r,s=S(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(s)),ve.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),ve.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const xe=(e,t)=>v()?window.matchMedia(e).matches:t??!1;function ke(e,t){const[n,r]=(0,o.useState)(xe(e,t)),s=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",s),n}function Se(){return ke("(prefers-color-scheme: dark)")?"dark":"light"}const Ce="color-scheme";function Ee({defaultValue:e,key:t=Ce,shouldSetBodyClass:n=!1}={}){const r=Se(),s=S(e)?e():e,{state:i,setState:c}=ye({key:t,initialValue:s??r}),a=(0,o.useCallback)((()=>{c((e=>"dark"===e?"light":"dark"))}),[c]),l=(0,o.useCallback)((()=>{c("dark")}),[c]),u=(0,o.useCallback)((()=>{c("light")}),[c]),d=(0,o.useCallback)((()=>{c(r)}),[c,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(i),()=>{n&&document.body.classList.remove(i)})),[i,n]),{colorScheme:i,preferredColorScheme:r,setToggleMode:a,setDarkMode:l,setLightMode:u,setPreferredMode:d}}function je(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),s=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),i=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:s,reset:i}}function Re({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,s]=(0,o.useState)(t),i=r0,a=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),l=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const i=a(e,t);o&&o({prev:r,next:i}),s(i)}),[n,r,a]),u=(0,o.useCallback)((e=>{l("nextStep",!i,e)}),[i,l]),d=(0,o.useCallback)((e=>{l("prevStep",!c,e)}),[c,l]),f=(0,o.useCallback)(((t,n)=>{const o=S(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void s(t);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),s(t)}),[r,t]);return{currentStep:r,hasNextStep:i,hasPrevStep:c,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Oe(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:s,resetStep:i}=Re({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:s,resetIndex:i}}function Fe(e,t,n={}){const[r,s]=(0,o.useState)(e);return[r,_(s,t,n)]}function Ie(e,t={}){const[n,r]=(0,o.useState)(""),[s,i]=Fe("",e,t);return{value:n,debouncedValue:s,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),i(t)}),[i]),onReset:(0,o.useCallback)((()=>{r(""),i("")}),[i])}}function Le(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Me({onFocus:e=j,onBlur:t=j}={}){const[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(null),i=A((t=>{r(!0),e(t)})),c=A((e=>{r(!1),t(e)})),a=(0,o.useCallback)((()=>{s.current&&(s.current.focus(),r(!0))}),[]);return ne(s,"focus",i),ne(s,"blur",c),{ref:s,isFocus:n,setFocus:a}}function Ne({onEnter:e=j,onLeave:t=j}={}){const[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(null),i=A((t=>{r(!0),e(t)})),c=A((e=>{r(!1),t(e)}));return ne(s,"mouseenter",i),ne(s,"mouseleave",c),{ref:s,isHovered:n}}const $e=e=>{var t;return C(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function Pe(e,t){const n=(0,o.useRef)(),r=A(e),{delay:s,enabled:i}=$e(t),c=(0,o.useCallback)((()=>{n.current=window.setInterval(r,s)}),[r,s]),a=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{a(),c()}),[a,c]);return(0,o.useEffect)((()=>{if(!(s<0)&&i)return c(),()=>a()}),[a,c,i,s]),{set:c,reset:l,clear:a}}function Te({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),s=A((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];S(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",s),()=>t.removeEventListener("keydown",s)}),[e,s]),r}const He={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function Ye(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)(He),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:s,clientY:i,pageX:c,pageY:a}=t;let l=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();l=s-t.left,u=i-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:s,clientY:i,pageX:c,pageY:a,elementRelativeX:l,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const Xe=()=>navigator.onLine,De=()=>!0,Ve=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function Ae({onlineAction:e=j,offlineAction:t=j}={}){const n=A((n=>Ve(n,e,t)));return(0,o.useSyncExternalStore)(n,Xe,De)}function Be(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const We={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function _e(e=j){const[t,n]=(0,o.useState)(We),r=(0,o.useRef)(null),s=A((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(s);return t.observe(e),()=>{t.unobserve(e)}}),[s]),{ref:r,contentRect:t}}function ze({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),s=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>s())),[e,r,s]),{ref:t,lock:r,unlock:s}}const Je=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,Ue=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:s=0,alignY:i="start",alignX:c="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+s+Je(window.innerHeight,r.height,i),left:r.left+window.scrollX+o+Je(window.innerWidth,r.width,c)};const a=e.getBoundingClientRect();return{top:r.top-a.top+e.scrollTop+s+Je(a.height,r.height,i),left:r.left-a.left+e.scrollLeft+o+Je(a.width,r.width,c)}};function Ke(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:s,top:i}=Ue(r,t,n);r.scrollTo({top:i,left:s,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ze=me("sessionStorage"),Qe=e=>window.sessionStorage.getItem(e),qe=e=>JSON.stringify(e),Ge=e=>(Ze.subscribe(e),()=>{Ze.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=S(n)?n():n,s=(0,o.useSyncExternalStore)(Ge,(()=>Qe(t)),(()=>qe(r)));return{state:(0,o.useMemo)((()=>s?R(s):r),[s,r]),setState:(0,o.useCallback)((e=>{try{const n=Qe(t),o=n?R(n):r,s=S(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(s)),Ze.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ze.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:s}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[i,c]=(0,o.useState)(n),a=(0,o.useCallback)((e=>{c((t=>{const n=S(e)?e(t):e;return r&&s&&function(e,t,n){if(!v())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=S(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,s,n),n}))}),[r,s]),l=(0,o.useCallback)((()=>{r&&s&&function(e,t){if(!v())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,s),c(null)}),[r,s]);return Object.assign({state:i,setState:a,clearState:l},Re(e))}function nt(e,t,n={}){const r=A(e),s=W(n),i=(0,o.useMemo)((()=>(0,c.A)(r,t,s)),[r,t,s]);return B((()=>i.cancel())),i}const rt=e=>{var t;return C(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=A(e),{delay:s,enabled:i}=rt(t),c=(0,o.useCallback)((()=>{n.current=setTimeout(r,s)}),[r,s]),a=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{a(),c()}),[a,c]);return(0,o.useEffect)((()=>{if(!(s<0)&&i)return c(),()=>a()}),[c,a,s,i]),{set:c,reset:l,clear:a}}function st(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function it(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new a.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function ct({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const at={width:null,height:null};function lt({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>m()?at:{width:window.innerWidth,height:window.innerHeight})),r=_(n,e),s=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",s),t}function ut(e,t,n){const{delay:r,enabled:s}=rt(t),{set:i,reset:c,clear:a}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!s||c()}),[r,s,c,...n]),{set:i,reset:c,clear:a}}}}]);
\ No newline at end of file
diff --git a/assets/js/295f1714.8387b2be.js b/assets/js/295f1714.8387b2be.js
new file mode 100644
index 000000000..deb1a926e
--- /dev/null
+++ b/assets/js/295f1714.8387b2be.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[8310],{1826:(e,n,t)=>{t.r(n),t.d(n,{Example:()=>h,assets:()=>f,contentTitle:()=>l,default:()=>m,frontMatter:()=>d,metadata:()=>r,toc:()=>p});const r=JSON.parse('{"id":"react/hooks/useHover","title":"useHover","description":"\ub300\uc0c1 \ucef4\ud3ec\ub10c\ud2b8\ub97c \uae30\uc900\uc73c\ub85c \ub9c8\uc6b0\uc2a4\uac00 \uc62c\ub77c\uac00\uac70\ub098 \ub0b4\ub824\uac14\uc744 \ub54c\uc758 \uc0c1\ud0dc\ub97c \ubc18\ud658\ud558\uace0, \ub9c8\uc6b0\uc2a4\uac00 \uc62c\ub77c\uac00\uac70\ub098 \ub0b4\ub824\uac14\uc744 \ub54c\uc758 \uc561\uc158\uc744 \uc815\uc758\ud560 \uc218 \uc788\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useHover.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useHover","permalink":"/modern-kit/docs/react/hooks/useHover","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useForceUpdate","permalink":"/modern-kit/docs/react/hooks/useForceUpdate"},"next":{"title":"useImageStatus","permalink":"/modern-kit/docs/react/hooks/useImageStatus"}}');var o=t(6206),i=t(3267),s=t(4382),c=t(9340),a=t(1351),u=t(6765);const d={},l="useHover",f={},h=()=>{const e={div:"div",...(0,i.R)()},[n,t]=(0,s.useState)(0),{ref:r,isHovered:d}=function({onEnter:e=c.lQ,onLeave:n=c.lQ}={}){const[t,r]=(0,s.useState)(!1),o=(0,s.useRef)(null),i=(0,u.p)((n=>{r(!0),e(n)})),d=(0,u.p)((e=>{r(!1),n(e)}));return(0,a.M)(o,"mouseenter",i),(0,a.M)(o,"mouseleave",d),{ref:o,isHovered:t}}({onEnter:()=>t((e=>e+1)),onLeave:()=>t((e=>e-1))});return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(e.div,{ref:r,style:{width:"200px",height:"200px",backgroundColor:"skyBlue"},children:d?"hover":"leave"}),(0,o.jsx)(e.div,{children:n})]})},p=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function v(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.header,{children:(0,o.jsx)(n.h1,{id:"usehover",children:"useHover"})}),"\n",(0,o.jsx)(n.p,{children:"\ub300\uc0c1 \ucef4\ud3ec\ub10c\ud2b8\ub97c \uae30\uc900\uc73c\ub85c \ub9c8\uc6b0\uc2a4\uac00 \uc62c\ub77c\uac00\uac70\ub098 \ub0b4\ub824\uac14\uc744 \ub54c\uc758 \uc0c1\ud0dc\ub97c \ubc18\ud658\ud558\uace0, \ub9c8\uc6b0\uc2a4\uac00 \uc62c\ub77c\uac00\uac70\ub098 \ub0b4\ub824\uac14\uc744 \ub54c\uc758 \uc561\uc158\uc744 \uc815\uc758\ud560 \uc218 \uc788\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(n.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useHover/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(n.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"const useHover: ({\n onEnter?: (event: MouseEvent) => void,\n onLeave?: (event: MouseEvent) => void,\n}) => {\n ref: T,\n isHovered: boolean\n}\n"})}),"\n",(0,o.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useHover } from '@modern-kit/react';\n\nconst Example = () => {\n const [counter, setCounter] = useState(0);\n\n const { ref, isHovered } = useHover({\n onEnter: () => setCounter((count) => count + 1),\n onLeave: () => setCounter((count) => count - 1)\n });\n\n const style = {\n width: '200px',\n height: '200px',\n backgroundColor: 'skyBlue'\n };\n\n return (\n <>\n {isHovered ? 'hover' : 'leave'}
\n {counter}
\n >\n );\n};\n"})}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(h,{})]})}function m(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(v,{...e})}):v(e)}},3267:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>c});var r=t(4382);const o={},i=r.createContext(o);function s(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:s(e.components),r.createElement(i.Provider,{value:n},e.children)}},1351:(e,n,t)=>{t.d(n,{M:()=>c});var r=t(6765),o=t(5907),i=t(9340);t(4382);const s=e=>!!e&&(0,i.i5)(e,"current");function c(e,n,t,i){const c=(0,r.p)(t);(0,o.E)((()=>{const t=s(e)?e.current:e;if(t)return t.addEventListener(n,c,i),()=>{t.removeEventListener(n,c,i)}}),[n,e,i,c])}},5907:(e,n,t)=>{t.d(n,{E:()=>i});var r=t(9340),o=t(4382);const i=(0,r.oc)()?o.useLayoutEffect:o.useEffect},6765:(e,n,t)=>{t.d(n,{p:()=>o});var r=t(4382);function o(e){const n=(0,r.useRef)(e);return n.current=e,(0,r.useCallback)(((...e)=>n.current(...e)),[])}},9340:(e,n,t)=>{function r(e,n,t,r){return new(t||(t=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(n){i(n)}}function c(e){try{a(r.throw(e))}catch(n){i(n)}}function a(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(s,c)}a((r=r.apply(e,n||[])).next())}))}t.d(n,{Et:()=>x,Fr:()=>c,Gp:()=>g,Ol:()=>C,Qd:()=>E,S$:()=>s,Tn:()=>w,Zp:()=>f,dK:()=>u,fl:()=>F,gD:()=>y,i5:()=>p,if:()=>h,l6:()=>j,lQ:()=>k,nS:()=>l,ni:()=>$,oc:()=>a}),"function"==typeof SuppressedError&&SuppressedError;const o={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};const i=(e,n)=>new Promise(((t,r)=>{e.toBlob((e=>{e?t(e):r(new Error(`Failed to create blob with format ${n}`))}),n)}));function s(){return"undefined"==typeof window}function c(){if(s())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}function a(){return!s()}function u(e){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const n=document.createElement("textarea");n.value=e,n.style.opacity="0",document.body.appendChild(n),n.focus(),n.select();try{return document.execCommand("copy"),e}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}finally{document.body.removeChild(n)}}(e)}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}}))}const d=e=>r(void 0,void 0,void 0,(function*(){const n=yield fetch(e);return u(yield n.text())}));function l(e,n){var t;return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator))return d(e);if(!("write"in window.navigator.clipboard))return d(e);if(null!==(t=null==n?void 0:n.toText)&&void 0!==t&&t)return d(e);const s=yield function(e,n="png"){return new Promise(((t,s)=>{const c=new Image;c.onload=()=>r(this,void 0,void 0,(function*(){const e=document.createElement("canvas");e.width=c.width,e.height=c.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(c,0,0);const s=yield i(e,o[n]);t(s)}catch(r){console.error(`Failed to load image. message: ${r.mesaage}`),s(r)}})),c.onerror=()=>{s(new Error("Failed to load image"))},c.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[s.type]:s})]),s}catch(s){throw console.error(`Failed to copy to clipboard. message: ${s.message}`),s}}))}function f(){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function h(){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function p(e,n){return Object.prototype.hasOwnProperty.call(e,n)}const v=(e,n,t)=>{const r=Object.keys(e),o=Object.keys(n);if(r.length!==o.length)return!1;for(let i=0;i{if(e===n)return!0;if(x(e)&&x(n)&&isNaN(e)&&isNaN(n))return!0;if(w(e)&&w(n))return e.toString()===n.toString();if("object"!=typeof e||"object"!=typeof n||null===e||null===n)return!1;if(t.has(e)&&t.get(e)===n)return!0;if(t.set(e,n),e.constructor!==n.constructor)return!1;if(e instanceof Set){if(e.size!==n.size)return!1;const r=[...e],o=[...n];return v(r,o,t)}if(e instanceof Map){if(e.size!==n.size)return!1;for(const[r,o]of e)if(!n.has(r)||!m(o,n.get(r),t))return!1;return!0}return v(e,n,t)};function g(e,n){return m(e,n,new WeakMap)}function w(e){return"function"==typeof e}function y(e){return null==e}function x(e){return"number"==typeof e}function b(e){return!function(e){return Object(e)!==e}(e)}function E(e){return b(e)&&"[object Object]"===Object.prototype.toString.call(e)}function j(e){return e===window}function k(){}function C(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(n){throw new Error(`Failed to parse data: ${n}`)}}function H(e){return Object.keys(e)}const S={days:864e5,hours:36e5,minutes:6e4,seconds:1e3};H(S);function F(e,n){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(n)}catch(t){throw new Error(`Failed to remove key "${n}" from ${e}: ${t}`)}}function $(e,n,t){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=w(t)?t():t;r.setItem(n,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${n}" in ${e}: ${r}`)}}}}]);
\ No newline at end of file
diff --git a/assets/js/308b5f81.80461474.js b/assets/js/308b5f81.80461474.js
new file mode 100644
index 000000000..f2e983fe6
--- /dev/null
+++ b/assets/js/308b5f81.80461474.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[3600],{4509:(e,n,t)=>{t.r(n),t.d(n,{Example:()=>u,assets:()=>d,contentTitle:()=>l,default:()=>p,frontMatter:()=>a,metadata:()=>r,toc:()=>f});const r=JSON.parse('{"id":"react/hooks/useIntersectionObserver","title":"useIntersectionObserver","description":"ref\ub97c \ud560\ub2f9\ud55c \ud0c0\uac9f \uc5d8\ub9ac\uba3c\ud2b8\uac00 Viewport\uc5d0 \ub178\ucd9c\ub420 \ub54c(onIntersectStart) \ud639\uc740 \ub098\uac08 \ub54c(onIntersectEnd) \ud2b9\uc815 action \ud568\uc218\ub97c \ud638\ucd9c \ud560 \uc218 \uc788\ub294 \ucef4\ud3ec\ub10c\ud2b8\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useIntersectionObserver.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useIntersectionObserver","permalink":"/modern-kit/docs/react/hooks/useIntersectionObserver","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useImageStatus","permalink":"/modern-kit/docs/react/hooks/useImageStatus"},"next":{"title":"useInterval","permalink":"/modern-kit/docs/react/hooks/useInterval"}}');var o=t(6206),i=t(3267),s=t(4382),c=t(7399);const a={},l="useIntersectionObserver",d={},u=()=>{const e={br:"br",button:"button",div:"div",...(0,i.R)()},[n,t]=(0,s.useState)(!1),{ref:r}=(0,c.B)({onIntersectStart:e=>{console.log("onIntersectStart: ",e)},onIntersectEnd:e=>{console.log("onIntersectEnd: ",e)},enabled:n}),a={height:"800px",backgroundColor:"teal"};return(0,o.jsxs)(e.div,{children:[(0,o.jsxs)(e.button,{onClick:()=>t(!n),children:["Toggle Enabled: ",`${n}`]}),(0,o.jsx)(e.div,{style:a}),(0,o.jsxs)(e.div,{ref:r,style:{color:"white",fontSize:"24px",backgroundColor:"blue"},children:["\ud0c0\uac9f \uc694\uc18c",(0,o.jsx)(e.br,{}),"\uac1c\ubc1c\uc790 \ub3c4\uad6c \ucf58\uc194\uc744 \ud655\uc778\ud574\uc8fc\uc138\uc694."]}),(0,o.jsx)(e.div,{style:a})]})},f=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Exmaple",id:"exmaple",level:2},{value:"Note",id:"note",level:2}];function h(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.header,{children:(0,o.jsx)(n.h1,{id:"useintersectionobserver",children:"useIntersectionObserver"})}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.code,{children:"ref"}),"\ub97c \ud560\ub2f9\ud55c \ud0c0\uac9f \uc5d8\ub9ac\uba3c\ud2b8\uac00 ",(0,o.jsx)(n.code,{children:"Viewport"}),"\uc5d0 \ub178\ucd9c\ub420 \ub54c(",(0,o.jsx)(n.code,{children:"onIntersectStart"}),") \ud639\uc740 \ub098\uac08 \ub54c(",(0,o.jsx)(n.code,{children:"onIntersectEnd"}),") \ud2b9\uc815 action \ud568\uc218\ub97c \ud638\ucd9c \ud560 \uc218 \uc788\ub294 \ucef4\ud3ec\ub10c\ud2b8\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.code,{children:"calledOnce"}),"\uc635\uc158\uc744 ",(0,o.jsx)(n.code,{children:"true"}),"\ub85c \uc124\uc815\ud558\uba74 ",(0,o.jsx)(n.code,{children:"onIntersectStart"}),"\uc640 ",(0,o.jsx)(n.code,{children:"onIntersectEnd"}),"\ub97c \uac01\uac01 \ud55c\ubc88\uc529 \ud638\ucd9c \ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.code,{children:"enabled"}),"\uc635\uc158\uc744 \ud1b5\ud574 ",(0,o.jsx)(n.code,{children:"onIntersect*"})," \ucf5c\ubc31 \ud568\uc218\ub4e4\uc758 \ud638\ucd9c\uc744 \uc81c\uc5b4 \ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. ",(0,o.jsx)(n.code,{children:"false"}),"\ub77c\uba74 \ud0c0\uac9f \uc5d8\ub9ac\uba3c\ud2b8\uac00 Viewport\uc5d0 \ub178\ucd9c\ud558\ub354\ub77c\ub3c4 \uc2e4\ud589\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(n.p,{children:["Intersection Observer Option\uc744 \uc124\uc815\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.(\ud558\ub2e8 ",(0,o.jsx)(n.code,{children:"Note"})," \ucc38\uace0)"]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(n.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useIntersectionObserver/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(n.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"interface IntersectionObserverInit {\n root?: Element | Document | null;\n rootMargin?: string;\n threshold?: number | number[];\n}\n\ninterface UseIntersectionObserverProps extends IntersectionObserverInit {\n onIntersectStart?: (entry: IntersectionObserverEntry) => void;\n onIntersectEnd?: (entry: IntersectionObserverEntry) => void;\n calledOnce?: boolean;\n enabled?: boolean;\n}\n"})}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"const useIntersectionObserver: ({\n onIntersectStart,\n onIntersectEnd,\n enabled, // default: true\n calledOnce, // default: false\n root, // default: null\n threshold, // default: 0\n rootMargin, // default: '0px 0px 0px 0px'\n}: UseIntersectionObserverProps) => { \n ref: React.RefCallback \n};\n"})}),"\n",(0,o.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-tsx",metastring:'title="typescript"',children:'import { useIntersectionObserver } from \'@modern-kit/react\';\n\nconst Example = () => {\n const [enabled, setEnabled] = useState(false);\n const { ref: targetRef } = useIntersectionObserver({\n onIntersectStart: (entry) => {\n console.log("onIntersectStart: ", entry);\n },\n onIntersectEnd: (entry) => {\n console.log("onIntersectEnd: ", entry);\n },\n enabled,\n });\n const boxStyle = {\n height: "800px", \n backgroundColor: "teal"\n }\n\n return (\n \n
\n
\n
\n \ud0c0\uac9f \uc694\uc18c
\n \uac1c\ubc1c\uc790 \ub3c4\uad6c \ucf58\uc194\uc744 \ud655\uc778\ud574\uc8fc\uc138\uc694.\n
\n
\n
\n );\n};\n'})}),"\n",(0,o.jsx)(n.h2,{id:"exmaple",children:"Exmaple"}),"\n","\n",(0,o.jsx)(u,{}),"\n",(0,o.jsx)(n.h2,{id:"note",children:"Note"}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsx)(n.li,{children:(0,o.jsx)(n.a,{href:"https://developer.mozilla.org/ko/docs/Web/API/IntersectionObserver",children:"Intersection Observer API"})}),"\n"]})]})}function p(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(h,{...e})}):h(e)}},3267:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>c});var r=t(4382);const o={},i=r.createContext(o);function s(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:s(e.components),r.createElement(i.Provider,{value:n},e.children)}},7399:(e,n,t)=>{t.d(n,{B:()=>s});var r=t(4382),o=t(6765),i=t(9340);function s({onIntersectStart:e=i.lQ,onIntersectEnd:n=i.lQ,enabled:t=!0,calledOnce:s=!1,root:c=null,threshold:a=0,rootMargin:l="0px 0px 0px 0px"}){const d=(0,r.useRef)(0),u=(0,r.useRef)(!1),f=(0,r.useRef)(null),h=(0,o.p)((([t],r)=>{if(!t)return;const o=t.target;t.isIntersecting?(u.current=!0,d.current+=1,e(t)):u.current&&(u.current=!1,d.current+=1,n(t)),s&&d.current>1&&r.unobserve(o)}));return{ref:(0,r.useCallback)((e=>{f.current&&(f.current.disconnect(),f.current=null),null!==e&&t&&(f.current=new IntersectionObserver(h,{threshold:a,root:c,rootMargin:l}),f.current.observe(e))}),[t,a,c,l,h])}}},6765:(e,n,t)=>{t.d(n,{p:()=>o});var r=t(4382);function o(e){const n=(0,r.useRef)(e);return n.current=e,(0,r.useCallback)(((...e)=>n.current(...e)),[])}},9340:(e,n,t)=>{function r(e,n,t,r){return new(t||(t=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(n){i(n)}}function c(e){try{a(r.throw(e))}catch(n){i(n)}}function a(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(s,c)}a((r=r.apply(e,n||[])).next())}))}t.d(n,{Et:()=>w,Fr:()=>c,Gp:()=>v,Ol:()=>k,Qd:()=>j,S$:()=>s,Tn:()=>m,Zp:()=>f,dK:()=>l,fl:()=>C,gD:()=>x,i5:()=>p,if:()=>h,l6:()=>I,lQ:()=>E,nS:()=>u,ni:()=>$,oc:()=>a}),"function"==typeof SuppressedError&&SuppressedError;const o={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};const i=(e,n)=>new Promise(((t,r)=>{e.toBlob((e=>{e?t(e):r(new Error(`Failed to create blob with format ${n}`))}),n)}));function s(){return"undefined"==typeof window}function c(){if(s())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}function a(){return!s()}function l(e){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const n=document.createElement("textarea");n.value=e,n.style.opacity="0",document.body.appendChild(n),n.focus(),n.select();try{return document.execCommand("copy"),e}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}finally{document.body.removeChild(n)}}(e)}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}}))}const d=e=>r(void 0,void 0,void 0,(function*(){const n=yield fetch(e);return l(yield n.text())}));function u(e,n){var t;return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator))return d(e);if(!("write"in window.navigator.clipboard))return d(e);if(null!==(t=null==n?void 0:n.toText)&&void 0!==t&&t)return d(e);const s=yield function(e,n="png"){return new Promise(((t,s)=>{const c=new Image;c.onload=()=>r(this,void 0,void 0,(function*(){const e=document.createElement("canvas");e.width=c.width,e.height=c.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(c,0,0);const s=yield i(e,o[n]);t(s)}catch(r){console.error(`Failed to load image. message: ${r.mesaage}`),s(r)}})),c.onerror=()=>{s(new Error("Failed to load image"))},c.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[s.type]:s})]),s}catch(s){throw console.error(`Failed to copy to clipboard. message: ${s.message}`),s}}))}function f(){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function h(){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function p(e,n){return Object.prototype.hasOwnProperty.call(e,n)}const b=(e,n,t)=>{const r=Object.keys(e),o=Object.keys(n);if(r.length!==o.length)return!1;for(let i=0;i{if(e===n)return!0;if(w(e)&&w(n)&&isNaN(e)&&isNaN(n))return!0;if(m(e)&&m(n))return e.toString()===n.toString();if("object"!=typeof e||"object"!=typeof n||null===e||null===n)return!1;if(t.has(e)&&t.get(e)===n)return!0;if(t.set(e,n),e.constructor!==n.constructor)return!1;if(e instanceof Set){if(e.size!==n.size)return!1;const r=[...e],o=[...n];return b(r,o,t)}if(e instanceof Map){if(e.size!==n.size)return!1;for(const[r,o]of e)if(!n.has(r)||!g(o,n.get(r),t))return!1;return!0}return b(e,n,t)};function v(e,n){return g(e,n,new WeakMap)}function m(e){return"function"==typeof e}function x(e){return null==e}function w(e){return"number"==typeof e}function y(e){return!function(e){return Object(e)!==e}(e)}function j(e){return y(e)&&"[object Object]"===Object.prototype.toString.call(e)}function I(e){return e===window}function E(){}function k(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(n){throw new Error(`Failed to parse data: ${n}`)}}function O(e){return Object.keys(e)}const S={days:864e5,hours:36e5,minutes:6e4,seconds:1e3};O(S);function C(e,n){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(n)}catch(t){throw new Error(`Failed to remove key "${n}" from ${e}: ${t}`)}}function $(e,n,t){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=m(t)?t():t;r.setItem(n,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${n}" in ${e}: ${r}`)}}}}]);
\ No newline at end of file
diff --git a/assets/js/308b5f81.db118fd1.js b/assets/js/308b5f81.db118fd1.js
deleted file mode 100644
index d614323c8..000000000
--- a/assets/js/308b5f81.db118fd1.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[3600],{4509:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>d,assets:()=>u,contentTitle:()=>a,default:()=>p,frontMatter:()=>l,metadata:()=>r,toc:()=>f});const r=JSON.parse('{"id":"react/hooks/useIntersectionObserver","title":"useIntersectionObserver","description":"ref\ub97c \ud560\ub2f9\ud55c \ud0c0\uac9f \uc5d8\ub9ac\uba3c\ud2b8\uac00 Viewport\uc5d0 \ub178\ucd9c\ub420 \ub54c(onIntersectStart) \ud639\uc740 \ub098\uac08 \ub54c(onIntersectEnd) \ud2b9\uc815 action \ud568\uc218\ub97c \ud638\ucd9c \ud560 \uc218 \uc788\ub294 \ucef4\ud3ec\ub10c\ud2b8\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useIntersectionObserver.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useIntersectionObserver","permalink":"/modern-kit/docs/react/hooks/useIntersectionObserver","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useImageStatus","permalink":"/modern-kit/docs/react/hooks/useImageStatus"},"next":{"title":"useInterval","permalink":"/modern-kit/docs/react/hooks/useInterval"}}');var o=n(6206),s=n(3267),i=n(4382),c=n(4027);const l={},a="useIntersectionObserver",u={},d=()=>{const e={br:"br",button:"button",div:"div",...(0,s.R)()},[t,n]=(0,i.useState)(!1),{ref:r}=(0,c.BL)({onIntersectStart:e=>{console.log("onIntersectStart: ",e)},onIntersectEnd:e=>{console.log("onIntersectEnd: ",e)},enabled:t}),l={height:"800px",backgroundColor:"teal"};return(0,o.jsxs)(e.div,{children:[(0,o.jsxs)(e.button,{onClick:()=>n(!t),children:["Toggle Enabled: ",`${t}`]}),(0,o.jsx)(e.div,{style:l}),(0,o.jsxs)(e.div,{ref:r,style:{color:"white",fontSize:"24px",backgroundColor:"blue"},children:["\ud0c0\uac9f \uc694\uc18c",(0,o.jsx)(e.br,{}),"\uac1c\ubc1c\uc790 \ub3c4\uad6c \ucf58\uc194\uc744 \ud655\uc778\ud574\uc8fc\uc138\uc694."]}),(0,o.jsx)(e.div,{style:l})]})},f=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Exmaple",id:"exmaple",level:2},{value:"Note",id:"note",level:2}];function h(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,s.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"useintersectionobserver",children:"useIntersectionObserver"})}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"ref"}),"\ub97c \ud560\ub2f9\ud55c \ud0c0\uac9f \uc5d8\ub9ac\uba3c\ud2b8\uac00 ",(0,o.jsx)(t.code,{children:"Viewport"}),"\uc5d0 \ub178\ucd9c\ub420 \ub54c(",(0,o.jsx)(t.code,{children:"onIntersectStart"}),") \ud639\uc740 \ub098\uac08 \ub54c(",(0,o.jsx)(t.code,{children:"onIntersectEnd"}),") \ud2b9\uc815 action \ud568\uc218\ub97c \ud638\ucd9c \ud560 \uc218 \uc788\ub294 \ucef4\ud3ec\ub10c\ud2b8\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"calledOnce"}),"\uc635\uc158\uc744 ",(0,o.jsx)(t.code,{children:"true"}),"\ub85c \uc124\uc815\ud558\uba74 ",(0,o.jsx)(t.code,{children:"onIntersectStart"}),"\uc640 ",(0,o.jsx)(t.code,{children:"onIntersectEnd"}),"\ub97c \uac01\uac01 \ud55c\ubc88\uc529 \ud638\ucd9c \ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"enabled"}),"\uc635\uc158\uc744 \ud1b5\ud574 ",(0,o.jsx)(t.code,{children:"onIntersect*"})," \ucf5c\ubc31 \ud568\uc218\ub4e4\uc758 \ud638\ucd9c\uc744 \uc81c\uc5b4 \ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. ",(0,o.jsx)(t.code,{children:"false"}),"\ub77c\uba74 \ud0c0\uac9f \uc5d8\ub9ac\uba3c\ud2b8\uac00 Viewport\uc5d0 \ub178\ucd9c\ud558\ub354\ub77c\ub3c4 \uc2e4\ud589\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:["Intersection Observer Option\uc744 \uc124\uc815\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.(\ud558\ub2e8 ",(0,o.jsx)(t.code,{children:"Note"})," \ucc38\uace0)"]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useIntersectionObserver/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"interface IntersectionObserverInit {\n root?: Element | Document | null;\n rootMargin?: string;\n threshold?: number | number[];\n}\n\ninterface UseIntersectionObserverProps extends IntersectionObserverInit {\n onIntersectStart?: (entry: IntersectionObserverEntry) => void;\n onIntersectEnd?: (entry: IntersectionObserverEntry) => void;\n calledOnce?: boolean;\n enabled?: boolean;\n}\n"})}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"const useIntersectionObserver: ({\n onIntersectStart,\n onIntersectEnd,\n enabled, // default: true\n calledOnce, // default: false\n root, // default: null\n threshold, // default: 0\n rootMargin, // default: '0px 0px 0px 0px'\n}: UseIntersectionObserverProps) => { \n ref: React.RefCallback \n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:'import { useIntersectionObserver } from \'@modern-kit/react\';\n\nconst Example = () => {\n const [enabled, setEnabled] = useState(false);\n const { ref: targetRef } = useIntersectionObserver({\n onIntersectStart: (entry) => {\n console.log("onIntersectStart: ", entry);\n },\n onIntersectEnd: (entry) => {\n console.log("onIntersectEnd: ", entry);\n },\n enabled,\n });\n const boxStyle = {\n height: "800px", \n backgroundColor: "teal"\n }\n\n return (\n \n
\n
\n
\n \ud0c0\uac9f \uc694\uc18c
\n \uac1c\ubc1c\uc790 \ub3c4\uad6c \ucf58\uc194\uc744 \ud655\uc778\ud574\uc8fc\uc138\uc694.\n
\n
\n
\n );\n};\n'})}),"\n",(0,o.jsx)(t.h2,{id:"exmaple",children:"Exmaple"}),"\n","\n",(0,o.jsx)(d,{}),"\n",(0,o.jsx)(t.h2,{id:"note",children:"Note"}),"\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsx)(t.li,{children:(0,o.jsx)(t.a,{href:"https://developer.mozilla.org/ko/docs/Web/API/IntersectionObserver",children:"Intersection Observer API"})}),"\n"]})]})}function p(e={}){const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(h,{...e})}):h(e)}},4027:(e,t,n)=>{n.d(t,{$$:()=>$e,$I:()=>oe,AE:()=>De,BL:()=>J,DX:()=>N,FT:()=>ct,Fo:()=>et,Hn:()=>st,I5:()=>Ce,JF:()=>Te,K:()=>ae,K$:()=>He,M0:()=>Re,ML:()=>ne,Mj:()=>ye,Mk:()=>Me,Mo:()=>se,NT:()=>Ve,QV:()=>Ke,Ub:()=>ke,Ut:()=>je,W7:()=>K,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>We,Zu:()=>le,_1:()=>Oe,_g:()=>nt,aL:()=>H,aY:()=>Ne,bB:()=>A,d7:()=>_,eG:()=>it,fN:()=>ce,fm:()=>G,gl:()=>$,hN:()=>z,iD:()=>de,iQ:()=>Le,jd:()=>ie,lW:()=>at,oD:()=>U,oo:()=>Ie,pL:()=>q,qi:()=>ue,rN:()=>Fe,tD:()=>Se,u8:()=>Q,wY:()=>_e,xV:()=>L,xh:()=>tt,zy:()=>Z});var r=n(6206),o=n(4382),s=n(3683),i=n(5086),c=n(7197),l=(n(1604),n(5938));function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function b(){return typeof window>"u"}function m(){return!b()}function g(e){return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const v=e=>f(void 0,0,void 0,(function*(){return g(yield(yield fetch(e)).text())}));function w(e,t){var n;return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return v(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const s=yield p(e,h[t]);n(s)}catch(s){console.error(`Failed to load image. message: ${s.mesaage}`),r(s)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let s=0;s{if(e===t||E(e)&&E(t)&&isNaN(e)&&isNaN(t))return!0;if(S(e)&&S(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return y(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!x(o,t.get(r),n))return!1;return!0}return y(e,t,n)};function k(e,t){return x(e,t,new WeakMap)}function S(e){return"function"==typeof e}function E(e){return"number"==typeof e}function j(e){return!function(e){return Object(e)!==e}(e)}function C(){}function I(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const O=(...e)=>t=>e.forEach((e=>{if(S(e))e(t);else if(null!=e){e.current=t}}));function R(...e){return(0,o.useCallback)(O(...e),e)}const N=o.forwardRef(((e,t)=>{const{children:n}=e,s=a(e,["children"]),i=o.Children.toArray(n),c=i.find(M);if(c){const e=c.props.children,n=i.map((t=>t===c?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(F,Object.assign({},s,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(F,Object.assign({},s,{ref:t,children:n}))}));N.displayName="Slot";const F=o.forwardRef(((e,t)=>{const{children:n}=e,r=a(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...e)=>{s(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),s):"className"===r&&(n[r]=[o,s].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?O(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));F.displayName="SlotClone";const L=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function M(e){return o.isValidElement(e)&&e.type===L}var P="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const $=d(((e,t)=>{var{ratio:n,style:o,as:i="div",asChild:c=!1}=e,l=a(e,["ratio","style","as","asChild"]);const u=c?N:i,d=Object.assign({aspectRatio:n},o),f=c?l.className:s(P,l.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},l))})),T=()=>C,Y=()=>!1,V=()=>!0;function A({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)(T,Y,V)?e:t}function X(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const z=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>X()?(0,r.jsx)(r.Fragment,{children:t}):e;function D(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function W(e){const t=D(e);(0,o.useEffect)((()=>()=>t()),[t])}function B(e,t=k){const[n,r]=(0,o.useState)(e),s=D(t);return(0,o.useEffect)((()=>{s(n,e)||r(e)}),[s,n,e]),n}function _(e,t,n){const r=D(e),s=B(n),c=(0,o.useMemo)((()=>(0,i.A)(r,t,s)),[r,t,s]);return W((()=>c.cancel())),c}const H=({children:e,capture:t,wait:n,options:r})=>{const s=o.Children.only(e),i=_(((...e)=>{const n=s?.props;if(n&&S(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(s,{[t]:i})};function J({onIntersectStart:e=C,onIntersectEnd:t=C,enabled:n=!0,calledOnce:r=!1,root:s=null,threshold:i=0,rootMargin:c="0px 0px 0px 0px"}){const l=(0,o.useRef)(0),a=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=D((([n],o)=>{if(!n)return;const s=n.target;n.isIntersecting?(a.current=!0,l.current+=1,e(n)):a.current&&(a.current=!1,l.current+=1,t(n)),r&&l.current>1&&o.unobserve(s)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:i,root:s,rootMargin:c}),u.current.observe(e))}),[n,i,s,c,d])}}const U=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:s,rootMargin:i}=e,c=a(e,["src","threshold","root","rootMargin"]);const{ref:l}=J({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:s,rootMargin:i});return(0,r.jsx)("img",Object.assign({ref:R(t,l)},c))}));U.displayName="LazyImage";const K=(0,o.forwardRef)(((e,t)=>{var{width:n,height:s,fallback:i,className:c,style:l,duration:u="0.2s",onLoad:d}=e,f=a(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,p]=(0,o.useState)(!1),b=!h,m=(0,o.useMemo)((()=>({position:"relative",width:n,height:s})),[n,s]),g=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:b?0:1,transition:`opacity ${u}`},l)),[b,u,l]),v=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),w=c?`lazy-image-wrapper ${c}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:w,style:m,children:[b&&i,(0,r.jsx)(U,Object.assign({ref:t,width:n,height:s,style:g,onLoad:v},f))]})}));K.displayName="FallbackLazyImage";const Z=({condition:e,trueComponent:t,falseComponent:n})=>{const s=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:s?t:n})},Q=({onScrollAction:e,children:t,root:n,threshold:o,enabled:s,triggerPosition:i="after",rootMargin:c="150px 0px"})=>{const{ref:l}=J({onIntersectStart:e,root:n,threshold:o,enabled:s,rootMargin:c});return(0,r.jsxs)(r.Fragment,{children:["before"===i&&(0,r.jsx)("div",{ref:l}),t,"after"===i&&(0,r.jsx)("div",{ref:l})]})},q=d(((e,t)=>{var{children:n,as:s="div",asChild:i=!1}=e,c=a(e,["children","as","asChild"]);const l=i?N:s,{ref:u}=J(c);if(i&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(l,Object.assign({ref:O(t,u)},c,{children:n}))})),G=({items:e=[],itemKey:t,renderItem:n})=>{const s=(0,o.useCallback)(((e,n)=>function(e){return j(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},s(e,t))))})},ee=m()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=D(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),s=(0,o.useMemo)((()=>function(){if(b())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,s,(({target:t})=>{if(!r.current)return;const o=r.current,s=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!s&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:s="div",asChild:i=!1,onPointerDown:c,excludeRefs:l=[]}=e,u=a(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(c,{excludeRefs:l}),f=i?N:s;if(i&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:O(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const se=({itemKey:e,items:t=[],separator:n,renderItem:s,separatorInterval:i=1,includeLastSeparator:c=!1})=>{const l=(0,o.useCallback)((e=>e===t.length-1?c:(e+1)%i==0),[c,i,t.length]);return(0,r.jsx)(G,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[s(e,t),l(t)&&n]})})},ie=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ce=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function le(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function ae(e=!0){const t=S(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!s.current){s.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{s.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),s=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield g(e);return t(n),!0}catch{return t(null),!1}}))),[]),i=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield w(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),l=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:s,copyImage:i,readText:c,readContents:l}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",pe={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},be=e=>pe[e],me=be("localStorage"),ge=e=>window.localStorage.getItem(e),ve=e=>JSON.stringify(e),we=e=>(me.subscribe(e),()=>{me.unsubscribe(e)});function ye(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=S(n)?n():n,s=(0,o.useSyncExternalStore)(we,(()=>ge(t)),(()=>ve(r)));return{state:(0,o.useMemo)((()=>s?I(s):r),[s,r]),setState:(0,o.useCallback)((e=>{try{const n=ge(t),o=n?I(n):r,s=S(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(s)),me.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),me.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const xe=(e,t)=>m()?window.matchMedia(e).matches:t??!1;function ke(e,t){const[n,r]=(0,o.useState)(xe(e,t)),s=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",s),n}function Se(){return ke("(prefers-color-scheme: dark)")?"dark":"light"}const Ee="color-scheme";function je({defaultValue:e,key:t=Ee,shouldSetBodyClass:n=!1}={}){const r=Se(),s=S(e)?e():e,{state:i,setState:c}=ye({key:t,initialValue:s??r}),l=(0,o.useCallback)((()=>{c((e=>"dark"===e?"light":"dark"))}),[c]),a=(0,o.useCallback)((()=>{c("dark")}),[c]),u=(0,o.useCallback)((()=>{c("light")}),[c]),d=(0,o.useCallback)((()=>{c(r)}),[c,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(i),()=>{n&&document.body.classList.remove(i)})),[i,n]),{colorScheme:i,preferredColorScheme:r,setToggleMode:l,setDarkMode:a,setLightMode:u,setPreferredMode:d}}function Ce(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),s=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),i=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:s,reset:i}}function Ie({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,s]=(0,o.useState)(t),i=r0,l=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),a=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const i=l(e,t);o&&o({prev:r,next:i}),s(i)}),[n,r,l]),u=(0,o.useCallback)((e=>{a("nextStep",!i,e)}),[i,a]),d=(0,o.useCallback)((e=>{a("prevStep",!c,e)}),[c,a]),f=(0,o.useCallback)(((t,n)=>{const o=S(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void s(t);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),s(t)}),[r,t]);return{currentStep:r,hasNextStep:i,hasPrevStep:c,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Oe(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:s,resetStep:i}=Ie({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:s,resetIndex:i}}function Re(e,t,n={}){const[r,s]=(0,o.useState)(e);return[r,_(s,t,n)]}function Ne(e,t={}){const[n,r]=(0,o.useState)(""),[s,i]=Re("",e,t);return{value:n,debouncedValue:s,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),i(t)}),[i]),onReset:(0,o.useCallback)((()=>{r(""),i("")}),[i])}}function Fe(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Le({onFocus:e=C,onBlur:t=C}={}){const[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(null),i=D((t=>{r(!0),e(t)})),c=D((e=>{r(!1),t(e)})),l=(0,o.useCallback)((()=>{s.current&&(s.current.focus(),r(!0))}),[]);return ne(s,"focus",i),ne(s,"blur",c),{ref:s,isFocus:n,setFocus:l}}function Me({onEnter:e=C,onLeave:t=C}={}){const[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(null),i=D((t=>{r(!0),e(t)})),c=D((e=>{r(!1),t(e)}));return ne(s,"mouseenter",i),ne(s,"mouseleave",c),{ref:s,isHovered:n}}const Pe=e=>{var t;return E(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function $e(e,t){const n=(0,o.useRef)(),r=D(e),{delay:s,enabled:i}=Pe(t),c=(0,o.useCallback)((()=>{n.current=window.setInterval(r,s)}),[r,s]),l=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),c()}),[l,c]);return(0,o.useEffect)((()=>{if(!(s<0)&&i)return c(),()=>l()}),[l,c,i,s]),{set:c,reset:a,clear:l}}function Te({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),s=D((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];S(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",s),()=>t.removeEventListener("keydown",s)}),[e,s]),r}const Ye={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function Ve(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)(Ye),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:s,clientY:i,pageX:c,pageY:l}=t;let a=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();a=s-t.left,u=i-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:s,clientY:i,pageX:c,pageY:l,elementRelativeX:a,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const Ae=()=>navigator.onLine,Xe=()=>!0,ze=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function De({onlineAction:e=C,offlineAction:t=C}={}){const n=D((n=>ze(n,e,t)));return(0,o.useSyncExternalStore)(n,Ae,Xe)}function We(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const Be={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function _e(e=C){const[t,n]=(0,o.useState)(Be),r=(0,o.useRef)(null),s=D((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(s);return t.observe(e),()=>{t.unobserve(e)}}),[s]),{ref:r,contentRect:t}}function He({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),s=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>s())),[e,r,s]),{ref:t,lock:r,unlock:s}}const Je=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,Ue=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:s=0,alignY:i="start",alignX:c="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+s+Je(window.innerHeight,r.height,i),left:r.left+window.scrollX+o+Je(window.innerWidth,r.width,c)};const l=e.getBoundingClientRect();return{top:r.top-l.top+e.scrollTop+s+Je(l.height,r.height,i),left:r.left-l.left+e.scrollLeft+o+Je(l.width,r.width,c)}};function Ke(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:s,top:i}=Ue(r,t,n);r.scrollTo({top:i,left:s,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ze=be("sessionStorage"),Qe=e=>window.sessionStorage.getItem(e),qe=e=>JSON.stringify(e),Ge=e=>(Ze.subscribe(e),()=>{Ze.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=S(n)?n():n,s=(0,o.useSyncExternalStore)(Ge,(()=>Qe(t)),(()=>qe(r)));return{state:(0,o.useMemo)((()=>s?I(s):r),[s,r]),setState:(0,o.useCallback)((e=>{try{const n=Qe(t),o=n?I(n):r,s=S(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(s)),Ze.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ze.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:s}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[i,c]=(0,o.useState)(n),l=(0,o.useCallback)((e=>{c((t=>{const n=S(e)?e(t):e;return r&&s&&function(e,t,n){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=S(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,s,n),n}))}),[r,s]),a=(0,o.useCallback)((()=>{r&&s&&function(e,t){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,s),c(null)}),[r,s]);return Object.assign({state:i,setState:l,clearState:a},Ie(e))}function nt(e,t,n={}){const r=D(e),s=B(n),i=(0,o.useMemo)((()=>(0,c.A)(r,t,s)),[r,t,s]);return W((()=>i.cancel())),i}const rt=e=>{var t;return E(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=D(e),{delay:s,enabled:i}=rt(t),c=(0,o.useCallback)((()=>{n.current=setTimeout(r,s)}),[r,s]),l=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),c()}),[l,c]);return(0,o.useEffect)((()=>{if(!(s<0)&&i)return c(),()=>l()}),[c,l,s,i]),{set:c,reset:a,clear:l}}function st(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function it(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new l.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function ct({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const lt={width:null,height:null};function at({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>b()?lt:{width:window.innerWidth,height:window.innerHeight})),r=_(n,e),s=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",s),t}function ut(e,t,n){const{delay:r,enabled:s}=rt(t),{set:i,reset:c,clear:l}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!s||c()}),[r,s,c,...n]),{set:i,reset:c,clear:l}}}}]);
\ No newline at end of file
diff --git a/assets/js/36bebd15.56b57b2c.js b/assets/js/36bebd15.56b57b2c.js
new file mode 100644
index 000000000..9b8dd3eb6
--- /dev/null
+++ b/assets/js/36bebd15.56b57b2c.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[3171],{9556:(e,n,t)=>{t.r(n),t.d(n,{Input:()=>d,InputExample:()=>p,assets:()=>l,contentTitle:()=>s,default:()=>m,frontMatter:()=>u,metadata:()=>r,toc:()=>f});const r=JSON.parse('{"id":"react/components/DebounceHandler","title":"DebounceHandler","description":"\uc790\uc2dd \ucef4\ud3ec\ub10c\ud2b8\uc758 \uc774\ubca4\ud2b8 \ud578\ub4e4\ub7ec\uc5d0 \ub514\ubc14\uc6b4\uc2a4(debounce)\ub97c \uc120\uc5b8\uc801\uc73c\ub85c \uc801\uc6a9\ud560 \uc218 \uc788\ub294 \ucef4\ud3ec\ub10c\ud2b8\uc785\ub2c8\ub2e4.","source":"@site/docs/react/components/DebounceHandler.mdx","sourceDirName":"react/components","slug":"/react/components/DebounceHandler","permalink":"/modern-kit/docs/react/components/DebounceHandler","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"ClientGate","permalink":"/modern-kit/docs/react/components/ClientGate"},"next":{"title":"FallbackLazyImage","permalink":"/modern-kit/docs/react/components/FallbackLazyImage"}}');var o=t(6206),i=t(3267),c=t(4382),a=t(385);const u={},s="DebounceHandler",l={},d=({onChange:e})=>{const n={input:"input",...(0,i.R)()},[t,r]=(0,c.useState)("");return(0,o.jsx)(n.input,{type:"text",onChange:n=>{r(n.target.value),e(n.target.value)},value:t})},p=()=>{const e={p:"p",...(0,i.R)()},[n,t]=(0,c.useState)("");return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(a.a,{capture:"onChange",wait:500,children:(0,o.jsx)(d,{onChange:e=>{t(e)}})}),(0,o.jsxs)(e.p,{children:["Text: ",n]})]})},f=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Button Click Case",id:"button-click-case",level:3},{value:"Input Change Case",id:"input-change-case",level:3},{value:"Example",id:"example",level:2},{value:"Button Click Case",id:"button-click-case-1",level:3},{value:"Input Change Case",id:"input-change-case-1",level:3}];function h(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.header,{children:(0,o.jsx)(n.h1,{id:"debouncehandler",children:"DebounceHandler"})}),"\n",(0,o.jsx)(n.p,{children:"\uc790\uc2dd \ucef4\ud3ec\ub10c\ud2b8\uc758 \uc774\ubca4\ud2b8 \ud578\ub4e4\ub7ec\uc5d0 \ub514\ubc14\uc6b4\uc2a4(debounce)\ub97c \uc120\uc5b8\uc801\uc73c\ub85c \uc801\uc6a9\ud560 \uc218 \uc788\ub294 \ucef4\ud3ec\ub10c\ud2b8\uc785\ub2c8\ub2e4."}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(n.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/components/DebounceHandler/index.tsx",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(n.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"type DebounceParameters = Parameters;\n\ninterface DebounceHandlerProps {\n children: JSX.Element;\n capture: string;\n wait: DebounceParameters[1];\n options?: DebounceParameters[2];\n}\n\nconst DebounceHandler: ({ children, capture, wait, options, }: DebounceHandlerProps) => JSX.Element\n"})}),"\n",(0,o.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(n.h3,{id:"button-click-case",children:"Button Click Case"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { DebounceHandler } from '@modern-kit/react'\n\nconst Example = () => {\n const onClick = () => {\n console.log('debounce');\n };\n \n return (\n \n \n \n );\n};\n"})}),"\n",(0,o.jsx)(n.h3,{id:"input-change-case",children:"Input Change Case"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-tsx",metastring:'title="typescript"',children:"const Input = ({ onChange }: { onChange: (value: string) => void }) => {\n const [value, setValue] = useState('');\n\n const handleChange = (e: ChangeEvent) => {\n setValue(e.target.value);\n onChange(e.target.value);\n };\n\n return ;\n};\n\nconst Example = () => {\n const [text, setText] = useState('');\n\n const onChange = (value: string) => {\n setText(value);\n };\n\n return (\n <>\n \n \n \n {text}
\n >\n );\n}\n"})}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,o.jsx)(n.h3,{id:"button-click-case-1",children:"Button Click Case"}),"\n",(0,o.jsx)("p",{style:{marginBottom:"4px"},children:"\ube0c\ub77c\uc6b0\uc800\uc758 \uac1c\ubc1c\uc790 \ub3c4\uad6c\uc758 \ucf58\uc194\uc5d0\uc11c \ub3d9\uc791\uc744 \ud655\uc778\ud558\uc138\uc694."}),"\n",(0,o.jsx)(a.a,{capture:"onClick",wait:500,children:(0,o.jsx)("button",{onClick:()=>{console.log("debounce")},children:"Button"})}),"\n",(0,o.jsx)("br",{}),"\n","\n","\n",(0,o.jsx)(n.h3,{id:"input-change-case-1",children:"Input Change Case"}),"\n",(0,o.jsx)(p,{})]})}function m(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(h,{...e})}):h(e)}},3267:(e,n,t)=>{t.d(n,{R:()=>c,x:()=>a});var r=t(4382);const o={},i=r.createContext(o);function c(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:c(e.components),r.createElement(i.Provider,{value:n},e.children)}},385:(e,n,t)=>{t.d(n,{a:()=>c});var r=t(4382),o=t(5115),i=t(9340);const c=({children:e,capture:n,wait:t,options:c})=>{const a=r.Children.only(e),u=(0,o.d)(((...e)=>{const t=null==a?void 0:a.props;if(t)return(0,i.Tn)(t[n])?t[n](...e):void 0}),t,c);return(0,r.cloneElement)(a,{[n]:u})}},5115:(e,n,t)=>{t.d(n,{d:()=>u});var r=t(4382),o=t(5086),i=t(3311),c=t(6765),a=t(5423);function u(e,n,t){const u=(0,c.p)(e),s=(0,a.B)(t),l=(0,r.useMemo)((()=>(0,o.A)(u,n,s)),[u,n,s]);return(0,i.i)((()=>l.cancel())),l}},6765:(e,n,t)=>{t.d(n,{p:()=>o});var r=t(4382);function o(e){const n=(0,r.useRef)(e);return n.current=e,(0,r.useCallback)(((...e)=>n.current(...e)),[])}},5423:(e,n,t)=>{t.d(n,{B:()=>c});var r=t(4382),o=t(6765),i=t(9340);function c(e,n=i.Gp){const[t,c]=(0,r.useState)(e),a=(0,o.p)(n);return(0,r.useEffect)((()=>{a(t,e)||c(e)}),[a,t,e]),t}},3311:(e,n,t)=>{t.d(n,{i:()=>i});var r=t(6765),o=t(4382);function i(e){const n=(0,r.p)(e);(0,o.useEffect)((()=>()=>n()),[n])}},5086:(e,n,t)=>{t.d(n,{A:()=>F});var r=t(322);const o="object"==typeof global&&global&&global.Object===Object&&global;var i="object"==typeof self&&self&&self.Object===Object&&self;const c=o||i||Function("return this")();const a=function(){return c.Date.now()};var u=/\s/;const s=function(e){for(var n=e.length;n--&&u.test(e.charAt(n)););return n};var l=/^\s+/;const d=function(e){return e?e.slice(0,s(e)+1).replace(l,""):e};const p=c.Symbol;var f=Object.prototype,h=f.hasOwnProperty,m=f.toString,g=p?p.toStringTag:void 0;const v=function(e){var n=h.call(e,g),t=e[g];try{e[g]=void 0;var r=!0}catch(i){}var o=m.call(e);return r&&(n?e[g]=t:delete e[g]),o};var b=Object.prototype.toString;const x=function(e){return b.call(e)};var y=p?p.toStringTag:void 0;const w=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":y&&y in Object(e)?v(e):x(e)};const j=function(e){return null!=e&&"object"==typeof e};const C=function(e){return"symbol"==typeof e||j(e)&&"[object Symbol]"==w(e)};var k=/^[-+]0x[0-9a-f]+$/i,E=/^0b[01]+$/i,S=/^0o[0-7]+$/i,O=parseInt;const D=function(e){if("number"==typeof e)return e;if(C(e))return NaN;if((0,r.A)(e)){var n="function"==typeof e.valueOf?e.valueOf():e;e=(0,r.A)(n)?n+"":n}if("string"!=typeof e)return 0===e?e:+e;e=d(e);var t=E.test(e);return t||S.test(e)?O(e.slice(2),t?2:8):k.test(e)?NaN:+e};var I=Math.max,T=Math.min;const F=function(e,n,t){var o,i,c,u,s,l,d=0,p=!1,f=!1,h=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function m(n){var t=o,r=i;return o=i=void 0,d=n,u=e.apply(r,t)}function g(e){var t=e-l;return void 0===l||t>=n||t<0||f&&e-d>=c}function v(){var e=a();if(g(e))return b(e);s=setTimeout(v,function(e){var t=n-(e-l);return f?T(t,c-(e-d)):t}(e))}function b(e){return s=void 0,h&&o?m(e):(o=i=void 0,u)}function x(){var e=a(),t=g(e);if(o=arguments,i=this,l=e,t){if(void 0===s)return function(e){return d=e,s=setTimeout(v,n),p?m(e):u}(l);if(f)return clearTimeout(s),s=setTimeout(v,n),m(l)}return void 0===s&&(s=setTimeout(v,n)),u}return n=D(n)||0,(0,r.A)(t)&&(p=!!t.leading,c=(f="maxWait"in t)?I(D(t.maxWait)||0,n):c,h="trailing"in t?!!t.trailing:h),x.cancel=function(){void 0!==s&&clearTimeout(s),d=0,o=l=i=s=void 0},x.flush=function(){return void 0===s?u:b(a())},x}},322:(e,n,t)=>{t.d(n,{A:()=>r});const r=function(e){var n=typeof e;return null!=e&&("object"==n||"function"==n)}},9340:(e,n,t)=>{function r(e,n,t,r){return new(t||(t=Promise))((function(o,i){function c(e){try{u(r.next(e))}catch(n){i(n)}}function a(e){try{u(r.throw(e))}catch(n){i(n)}}function u(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(c,a)}u((r=r.apply(e,n||[])).next())}))}t.d(n,{Et:()=>y,Fr:()=>a,Gp:()=>v,Ol:()=>E,Qd:()=>j,S$:()=>c,Tn:()=>b,Zp:()=>p,dK:()=>s,fl:()=>D,gD:()=>x,i5:()=>h,if:()=>f,l6:()=>C,lQ:()=>k,nS:()=>d,ni:()=>I,oc:()=>u}),"function"==typeof SuppressedError&&SuppressedError;const o={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};const i=(e,n)=>new Promise(((t,r)=>{e.toBlob((e=>{e?t(e):r(new Error(`Failed to create blob with format ${n}`))}),n)}));function c(){return"undefined"==typeof window}function a(){if(c())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}function u(){return!c()}function s(e){return r(this,void 0,void 0,(function*(){if(!u())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const n=document.createElement("textarea");n.value=e,n.style.opacity="0",document.body.appendChild(n),n.focus(),n.select();try{return document.execCommand("copy"),e}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}finally{document.body.removeChild(n)}}(e)}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}}))}const l=e=>r(void 0,void 0,void 0,(function*(){const n=yield fetch(e);return s(yield n.text())}));function d(e,n){var t;return r(this,void 0,void 0,(function*(){if(!u())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator))return l(e);if(!("write"in window.navigator.clipboard))return l(e);if(null!==(t=null==n?void 0:n.toText)&&void 0!==t&&t)return l(e);const c=yield function(e,n="png"){return new Promise(((t,c)=>{const a=new Image;a.onload=()=>r(this,void 0,void 0,(function*(){const e=document.createElement("canvas");e.width=a.width,e.height=a.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(a,0,0);const c=yield i(e,o[n]);t(c)}catch(r){console.error(`Failed to load image. message: ${r.mesaage}`),c(r)}})),a.onerror=()=>{c(new Error("Failed to load image"))},a.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[c.type]:c})]),c}catch(c){throw console.error(`Failed to copy to clipboard. message: ${c.message}`),c}}))}function p(){return r(this,void 0,void 0,(function*(){if(!u())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function f(){return r(this,void 0,void 0,(function*(){if(!u())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function h(e,n){return Object.prototype.hasOwnProperty.call(e,n)}const m=(e,n,t)=>{const r=Object.keys(e),o=Object.keys(n);if(r.length!==o.length)return!1;for(let i=0;i{if(e===n)return!0;if(y(e)&&y(n)&&isNaN(e)&&isNaN(n))return!0;if(b(e)&&b(n))return e.toString()===n.toString();if("object"!=typeof e||"object"!=typeof n||null===e||null===n)return!1;if(t.has(e)&&t.get(e)===n)return!0;if(t.set(e,n),e.constructor!==n.constructor)return!1;if(e instanceof Set){if(e.size!==n.size)return!1;const r=[...e],o=[...n];return m(r,o,t)}if(e instanceof Map){if(e.size!==n.size)return!1;for(const[r,o]of e)if(!n.has(r)||!g(o,n.get(r),t))return!1;return!0}return m(e,n,t)};function v(e,n){return g(e,n,new WeakMap)}function b(e){return"function"==typeof e}function x(e){return null==e}function y(e){return"number"==typeof e}function w(e){return!function(e){return Object(e)!==e}(e)}function j(e){return w(e)&&"[object Object]"===Object.prototype.toString.call(e)}function C(e){return e===window}function k(){}function E(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(n){throw new Error(`Failed to parse data: ${n}`)}}function S(e){return Object.keys(e)}const O={days:864e5,hours:36e5,minutes:6e4,seconds:1e3};S(O);function D(e,n){if(!u())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(n)}catch(t){throw new Error(`Failed to remove key "${n}" from ${e}: ${t}`)}}function I(e,n,t){if(!u())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=b(t)?t():t;r.setItem(n,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${n}" in ${e}: ${r}`)}}}}]);
\ No newline at end of file
diff --git a/assets/js/36bebd15.da7fd56a.js b/assets/js/36bebd15.da7fd56a.js
deleted file mode 100644
index 9d3f04465..000000000
--- a/assets/js/36bebd15.da7fd56a.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[3171],{9556:(e,t,n)=>{n.r(t),n.d(t,{Input:()=>d,InputExample:()=>f,assets:()=>u,contentTitle:()=>l,default:()=>g,frontMatter:()=>s,metadata:()=>r,toc:()=>h});const r=JSON.parse('{"id":"react/components/DebounceHandler","title":"DebounceHandler","description":"\uc790\uc2dd \ucef4\ud3ec\ub10c\ud2b8\uc758 \uc774\ubca4\ud2b8 \ud578\ub4e4\ub7ec\uc5d0 \ub514\ubc14\uc6b4\uc2a4(debounce)\ub97c \uc120\uc5b8\uc801\uc73c\ub85c \uc801\uc6a9\ud560 \uc218 \uc788\ub294 \ucef4\ud3ec\ub10c\ud2b8\uc785\ub2c8\ub2e4.","source":"@site/docs/react/components/DebounceHandler.mdx","sourceDirName":"react/components","slug":"/react/components/DebounceHandler","permalink":"/modern-kit/docs/react/components/DebounceHandler","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"ClientGate","permalink":"/modern-kit/docs/react/components/ClientGate"},"next":{"title":"FallbackLazyImage","permalink":"/modern-kit/docs/react/components/FallbackLazyImage"}}');var o=n(6206),c=n(3267),i=n(4382),a=n(4027);const s={},l="DebounceHandler",u={},d=({onChange:e})=>{const t={input:"input",...(0,c.R)()},[n,r]=(0,i.useState)("");return(0,o.jsx)(t.input,{type:"text",onChange:t=>{r(t.target.value),e(t.target.value)},value:n})},f=()=>{const e={p:"p",...(0,c.R)()},[t,n]=(0,i.useState)("");return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(a.aL,{capture:"onChange",wait:500,children:(0,o.jsx)(d,{onChange:e=>{n(e)}})}),(0,o.jsxs)(e.p,{children:["Text: ",t]})]})},h=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Button Click Case",id:"button-click-case",level:3},{value:"Input Change Case",id:"input-change-case",level:3},{value:"Example",id:"example",level:2},{value:"Button Click Case",id:"button-click-case-1",level:3},{value:"Input Change Case",id:"input-change-case-1",level:3}];function p(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",p:"p",pre:"pre",...(0,c.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"debouncehandler",children:"DebounceHandler"})}),"\n",(0,o.jsx)(t.p,{children:"\uc790\uc2dd \ucef4\ud3ec\ub10c\ud2b8\uc758 \uc774\ubca4\ud2b8 \ud578\ub4e4\ub7ec\uc5d0 \ub514\ubc14\uc6b4\uc2a4(debounce)\ub97c \uc120\uc5b8\uc801\uc73c\ub85c \uc801\uc6a9\ud560 \uc218 \uc788\ub294 \ucef4\ud3ec\ub10c\ud2b8\uc785\ub2c8\ub2e4."}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/components/DebounceHandler/index.tsx",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"type DebounceParameters = Parameters;\n\ninterface DebounceHandlerProps {\n children: JSX.Element;\n capture: string;\n wait: DebounceParameters[1];\n options?: DebounceParameters[2];\n}\n\nconst DebounceHandler: ({ children, capture, wait, options, }: DebounceHandlerProps) => JSX.Element\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.h3,{id:"button-click-case",children:"Button Click Case"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { DebounceHandler } from '@modern-kit/react'\n\nconst Example = () => {\n const onClick = () => {\n console.log('debounce');\n };\n \n return (\n \n \n \n );\n};\n"})}),"\n",(0,o.jsx)(t.h3,{id:"input-change-case",children:"Input Change Case"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"const Input = ({ onChange }: { onChange: (value: string) => void }) => {\n const [value, setValue] = useState('');\n\n const handleChange = (e: ChangeEvent) => {\n setValue(e.target.value);\n onChange(e.target.value);\n };\n\n return ;\n};\n\nconst Example = () => {\n const [text, setText] = useState('');\n\n const onChange = (value: string) => {\n setText(value);\n };\n\n return (\n <>\n \n \n \n {text}
\n >\n );\n}\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,o.jsx)(t.h3,{id:"button-click-case-1",children:"Button Click Case"}),"\n",(0,o.jsx)("p",{style:{marginBottom:"4px"},children:"\ube0c\ub77c\uc6b0\uc800\uc758 \uac1c\ubc1c\uc790 \ub3c4\uad6c\uc758 \ucf58\uc194\uc5d0\uc11c \ub3d9\uc791\uc744 \ud655\uc778\ud558\uc138\uc694."}),"\n",(0,o.jsx)(a.aL,{capture:"onClick",wait:500,children:(0,o.jsx)("button",{onClick:()=>{console.log("debounce")},children:"Button"})}),"\n",(0,o.jsx)("br",{}),"\n","\n","\n",(0,o.jsx)(t.h3,{id:"input-change-case-1",children:"Input Change Case"}),"\n",(0,o.jsx)(f,{})]})}function g(e={}){const{wrapper:t}={...(0,c.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(p,{...e})}):p(e)}},4027:(e,t,n)=>{n.d(t,{$$:()=>Me,$I:()=>oe,AE:()=>Ve,BL:()=>J,DX:()=>F,FT:()=>at,Fo:()=>et,Hn:()=>ct,I5:()=>je,JF:()=>$e,K:()=>le,K$:()=>_e,M0:()=>Ie,ML:()=>ne,Mj:()=>ye,Mk:()=>Pe,Mo:()=>ce,NT:()=>He,QV:()=>Ue,Ub:()=>Ce,Ut:()=>Ee,W7:()=>U,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>ze,Zu:()=>se,_1:()=>Oe,_g:()=>nt,aL:()=>_,aY:()=>Fe,bB:()=>B,d7:()=>W,eG:()=>it,fN:()=>ae,fm:()=>q,gl:()=>M,hN:()=>X,iD:()=>de,iQ:()=>Ne,jd:()=>ie,lW:()=>lt,oD:()=>K,oo:()=>Re,pL:()=>Q,qi:()=>ue,rN:()=>Le,tD:()=>ke,u8:()=>G,wY:()=>We,xV:()=>N,xh:()=>tt,zy:()=>Z});var r=n(6206),o=n(4382),c=n(3683),i=n(5086),a=n(7197),s=(n(1604),n(5938));function l(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function g(){return typeof window>"u"}function m(){return!g()}function b(e){return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const w=e=>f(void 0,0,void 0,(function*(){return b(yield(yield fetch(e)).text())}));function v(e,t){var n;return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return w(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const c=yield p(e,h[t]);n(c)}catch(c){console.error(`Failed to load image. message: ${c.mesaage}`),r(c)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let c=0;c{if(e===t||S(e)&&S(t)&&isNaN(e)&&isNaN(t))return!0;if(k(e)&&k(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return y(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!x(o,t.get(r),n))return!1;return!0}return y(e,t,n)};function C(e,t){return x(e,t,new WeakMap)}function k(e){return"function"==typeof e}function S(e){return"number"==typeof e}function E(e){return!function(e){return Object(e)!==e}(e)}function j(){}function R(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const O=(...e)=>t=>e.forEach((e=>{if(k(e))e(t);else if(null!=e){e.current=t}}));function I(...e){return(0,o.useCallback)(O(...e),e)}const F=o.forwardRef(((e,t)=>{const{children:n}=e,c=l(e,["children"]),i=o.Children.toArray(n),a=i.find(P);if(a){const e=a.props.children,n=i.map((t=>t===a?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(L,Object.assign({},c,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(L,Object.assign({},c,{ref:t,children:n}))}));F.displayName="Slot";const L=o.forwardRef(((e,t)=>{const{children:n}=e,r=l(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],c=t[r];/^on[A-Z]/.test(r)?o&&c?n[r]=(...e)=>{c(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),c):"className"===r&&(n[r]=[o,c].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?O(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));L.displayName="SlotClone";const N=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function P(e){return o.isValidElement(e)&&e.type===N}var D="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const M=d(((e,t)=>{var{ratio:n,style:o,as:i="div",asChild:a=!1}=e,s=l(e,["ratio","style","as","asChild"]);const u=a?F:i,d=Object.assign({aspectRatio:n},o),f=a?s.className:c(D,s.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},s))})),$=()=>j,T=()=>!1,H=()=>!0;function B({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)($,T,H)?e:t}function Y(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const X=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>Y()?(0,r.jsx)(r.Fragment,{children:t}):e;function V(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function z(e){const t=V(e);(0,o.useEffect)((()=>()=>t()),[t])}function A(e,t=C){const[n,r]=(0,o.useState)(e),c=V(t);return(0,o.useEffect)((()=>{c(n,e)||r(e)}),[c,n,e]),n}function W(e,t,n){const r=V(e),c=A(n),a=(0,o.useMemo)((()=>(0,i.A)(r,t,c)),[r,t,c]);return z((()=>a.cancel())),a}const _=({children:e,capture:t,wait:n,options:r})=>{const c=o.Children.only(e),i=W(((...e)=>{const n=c?.props;if(n&&k(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(c,{[t]:i})};function J({onIntersectStart:e=j,onIntersectEnd:t=j,enabled:n=!0,calledOnce:r=!1,root:c=null,threshold:i=0,rootMargin:a="0px 0px 0px 0px"}){const s=(0,o.useRef)(0),l=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=V((([n],o)=>{if(!n)return;const c=n.target;n.isIntersecting?(l.current=!0,s.current+=1,e(n)):l.current&&(l.current=!1,s.current+=1,t(n)),r&&s.current>1&&o.unobserve(c)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:i,root:c,rootMargin:a}),u.current.observe(e))}),[n,i,c,a,d])}}const K=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:c,rootMargin:i}=e,a=l(e,["src","threshold","root","rootMargin"]);const{ref:s}=J({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:c,rootMargin:i});return(0,r.jsx)("img",Object.assign({ref:I(t,s)},a))}));K.displayName="LazyImage";const U=(0,o.forwardRef)(((e,t)=>{var{width:n,height:c,fallback:i,className:a,style:s,duration:u="0.2s",onLoad:d}=e,f=l(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,p]=(0,o.useState)(!1),g=!h,m=(0,o.useMemo)((()=>({position:"relative",width:n,height:c})),[n,c]),b=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:g?0:1,transition:`opacity ${u}`},s)),[g,u,s]),w=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),v=a?`lazy-image-wrapper ${a}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:v,style:m,children:[g&&i,(0,r.jsx)(K,Object.assign({ref:t,width:n,height:c,style:b,onLoad:w},f))]})}));U.displayName="FallbackLazyImage";const Z=({condition:e,trueComponent:t,falseComponent:n})=>{const c=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:c?t:n})},G=({onScrollAction:e,children:t,root:n,threshold:o,enabled:c,triggerPosition:i="after",rootMargin:a="150px 0px"})=>{const{ref:s}=J({onIntersectStart:e,root:n,threshold:o,enabled:c,rootMargin:a});return(0,r.jsxs)(r.Fragment,{children:["before"===i&&(0,r.jsx)("div",{ref:s}),t,"after"===i&&(0,r.jsx)("div",{ref:s})]})},Q=d(((e,t)=>{var{children:n,as:c="div",asChild:i=!1}=e,a=l(e,["children","as","asChild"]);const s=i?F:c,{ref:u}=J(a);if(i&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(s,Object.assign({ref:O(t,u)},a,{children:n}))})),q=({items:e=[],itemKey:t,renderItem:n})=>{const c=(0,o.useCallback)(((e,n)=>function(e){return E(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},c(e,t))))})},ee=m()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=V(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),c=(0,o.useMemo)((()=>function(){if(g())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,c,(({target:t})=>{if(!r.current)return;const o=r.current,c=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!c&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:c="div",asChild:i=!1,onPointerDown:a,excludeRefs:s=[]}=e,u=l(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(a,{excludeRefs:s}),f=i?F:c;if(i&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:O(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const ce=({itemKey:e,items:t=[],separator:n,renderItem:c,separatorInterval:i=1,includeLastSeparator:a=!1})=>{const s=(0,o.useCallback)((e=>e===t.length-1?a:(e+1)%i==0),[a,i,t.length]);return(0,r.jsx)(q,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[c(e,t),s(t)&&n]})})},ie=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ae=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function se(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function le(e=!0){const t=k(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),c=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!c.current){c.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{c.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),c=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield b(e);return t(n),!0}catch{return t(null),!1}}))),[]),i=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield v(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),a=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),s=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:c,copyImage:i,readText:a,readContents:s}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",pe={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},ge=e=>pe[e],me=ge("localStorage"),be=e=>window.localStorage.getItem(e),we=e=>JSON.stringify(e),ve=e=>(me.subscribe(e),()=>{me.unsubscribe(e)});function ye(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=k(n)?n():n,c=(0,o.useSyncExternalStore)(ve,(()=>be(t)),(()=>we(r)));return{state:(0,o.useMemo)((()=>c?R(c):r),[c,r]),setState:(0,o.useCallback)((e=>{try{const n=be(t),o=n?R(n):r,c=k(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(c)),me.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),me.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const xe=(e,t)=>m()?window.matchMedia(e).matches:t??!1;function Ce(e,t){const[n,r]=(0,o.useState)(xe(e,t)),c=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",c),n}function ke(){return Ce("(prefers-color-scheme: dark)")?"dark":"light"}const Se="color-scheme";function Ee({defaultValue:e,key:t=Se,shouldSetBodyClass:n=!1}={}){const r=ke(),c=k(e)?e():e,{state:i,setState:a}=ye({key:t,initialValue:c??r}),s=(0,o.useCallback)((()=>{a((e=>"dark"===e?"light":"dark"))}),[a]),l=(0,o.useCallback)((()=>{a("dark")}),[a]),u=(0,o.useCallback)((()=>{a("light")}),[a]),d=(0,o.useCallback)((()=>{a(r)}),[a,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(i),()=>{n&&document.body.classList.remove(i)})),[i,n]),{colorScheme:i,preferredColorScheme:r,setToggleMode:s,setDarkMode:l,setLightMode:u,setPreferredMode:d}}function je(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),c=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),i=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:c,reset:i}}function Re({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,c]=(0,o.useState)(t),i=r0,s=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),l=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const i=s(e,t);o&&o({prev:r,next:i}),c(i)}),[n,r,s]),u=(0,o.useCallback)((e=>{l("nextStep",!i,e)}),[i,l]),d=(0,o.useCallback)((e=>{l("prevStep",!a,e)}),[a,l]),f=(0,o.useCallback)(((t,n)=>{const o=k(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void c(t);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),c(t)}),[r,t]);return{currentStep:r,hasNextStep:i,hasPrevStep:a,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Oe(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:c,resetStep:i}=Re({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:c,resetIndex:i}}function Ie(e,t,n={}){const[r,c]=(0,o.useState)(e);return[r,W(c,t,n)]}function Fe(e,t={}){const[n,r]=(0,o.useState)(""),[c,i]=Ie("",e,t);return{value:n,debouncedValue:c,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),i(t)}),[i]),onReset:(0,o.useCallback)((()=>{r(""),i("")}),[i])}}function Le(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Ne({onFocus:e=j,onBlur:t=j}={}){const[n,r]=(0,o.useState)(!1),c=(0,o.useRef)(null),i=V((t=>{r(!0),e(t)})),a=V((e=>{r(!1),t(e)})),s=(0,o.useCallback)((()=>{c.current&&(c.current.focus(),r(!0))}),[]);return ne(c,"focus",i),ne(c,"blur",a),{ref:c,isFocus:n,setFocus:s}}function Pe({onEnter:e=j,onLeave:t=j}={}){const[n,r]=(0,o.useState)(!1),c=(0,o.useRef)(null),i=V((t=>{r(!0),e(t)})),a=V((e=>{r(!1),t(e)}));return ne(c,"mouseenter",i),ne(c,"mouseleave",a),{ref:c,isHovered:n}}const De=e=>{var t;return S(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function Me(e,t){const n=(0,o.useRef)(),r=V(e),{delay:c,enabled:i}=De(t),a=(0,o.useCallback)((()=>{n.current=window.setInterval(r,c)}),[r,c]),s=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{s(),a()}),[s,a]);return(0,o.useEffect)((()=>{if(!(c<0)&&i)return a(),()=>s()}),[s,a,i,c]),{set:a,reset:l,clear:s}}function $e({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),c=V((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];k(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",c),()=>t.removeEventListener("keydown",c)}),[e,c]),r}const Te={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function He(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)(Te),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:c,clientY:i,pageX:a,pageY:s}=t;let l=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();l=c-t.left,u=i-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:c,clientY:i,pageX:a,pageY:s,elementRelativeX:l,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const Be=()=>navigator.onLine,Ye=()=>!0,Xe=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function Ve({onlineAction:e=j,offlineAction:t=j}={}){const n=V((n=>Xe(n,e,t)));return(0,o.useSyncExternalStore)(n,Be,Ye)}function ze(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const Ae={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function We(e=j){const[t,n]=(0,o.useState)(Ae),r=(0,o.useRef)(null),c=V((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(c);return t.observe(e),()=>{t.unobserve(e)}}),[c]),{ref:r,contentRect:t}}function _e({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),c=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>c())),[e,r,c]),{ref:t,lock:r,unlock:c}}const Je=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,Ke=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:c=0,alignY:i="start",alignX:a="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+c+Je(window.innerHeight,r.height,i),left:r.left+window.scrollX+o+Je(window.innerWidth,r.width,a)};const s=e.getBoundingClientRect();return{top:r.top-s.top+e.scrollTop+c+Je(s.height,r.height,i),left:r.left-s.left+e.scrollLeft+o+Je(s.width,r.width,a)}};function Ue(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:c,top:i}=Ke(r,t,n);r.scrollTo({top:i,left:c,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ze=ge("sessionStorage"),Ge=e=>window.sessionStorage.getItem(e),Qe=e=>JSON.stringify(e),qe=e=>(Ze.subscribe(e),()=>{Ze.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=k(n)?n():n,c=(0,o.useSyncExternalStore)(qe,(()=>Ge(t)),(()=>Qe(r)));return{state:(0,o.useMemo)((()=>c?R(c):r),[c,r]),setState:(0,o.useCallback)((e=>{try{const n=Ge(t),o=n?R(n):r,c=k(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(c)),Ze.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ze.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:c}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[i,a]=(0,o.useState)(n),s=(0,o.useCallback)((e=>{a((t=>{const n=k(e)?e(t):e;return r&&c&&function(e,t,n){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=k(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,c,n),n}))}),[r,c]),l=(0,o.useCallback)((()=>{r&&c&&function(e,t){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,c),a(null)}),[r,c]);return Object.assign({state:i,setState:s,clearState:l},Re(e))}function nt(e,t,n={}){const r=V(e),c=A(n),i=(0,o.useMemo)((()=>(0,a.A)(r,t,c)),[r,t,c]);return z((()=>i.cancel())),i}const rt=e=>{var t;return S(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=V(e),{delay:c,enabled:i}=rt(t),a=(0,o.useCallback)((()=>{n.current=setTimeout(r,c)}),[r,c]),s=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{s(),a()}),[s,a]);return(0,o.useEffect)((()=>{if(!(c<0)&&i)return a(),()=>s()}),[a,s,c,i]),{set:a,reset:l,clear:s}}function ct(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function it(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new s.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function at({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const st={width:null,height:null};function lt({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>g()?st:{width:window.innerWidth,height:window.innerHeight})),r=W(n,e),c=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",c),t}function ut(e,t,n){const{delay:r,enabled:c}=rt(t),{set:i,reset:a,clear:s}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!c||a()}),[r,c,a,...n]),{set:i,reset:a,clear:s}}}}]);
\ No newline at end of file
diff --git a/assets/js/3bdef6d7.4c300635.js b/assets/js/3bdef6d7.4c300635.js
deleted file mode 100644
index 0fa4ffde5..000000000
--- a/assets/js/3bdef6d7.4c300635.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[2786],{4123:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>u,assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>c,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"react/hooks/useDebouncedState","title":"useDebouncedState","description":"useState\uc758 \ub514\ubc14\uc6b4\uc2a4 \ubc84\uc804\uc758 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useDebouncedState.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useDebouncedState","permalink":"/modern-kit/docs/react/hooks/useDebouncedState","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useDebouncedInputValue","permalink":"/modern-kit/docs/react/hooks/useDebouncedInputValue"},"next":{"title":"useDependencyTimeout","permalink":"/modern-kit/docs/react/hooks/useDependencyTimeout"}}');var o=n(6206),i=n(3267),s=(n(4382),n(4027));const c={},a="useDebouncedState",l={},u=()=>{const e={div:"div",input:"input",p:"p",...(0,i.R)()},[t,n]=(0,s.M0)("",500);return(0,o.jsxs)(e.div,{children:[(0,o.jsxs)(e.p,{children:["\ub514\ubc14\uc6b4\uc2f1 \uc0c1\ud0dc: ",t]}),(0,o.jsx)(e.div,{children:(0,o.jsx)(e.input,{type:"text",onChange:e=>n(e.target.value)})})]})},d=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function f(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"usedebouncedstate",children:"useDebouncedState"})}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"useState"}),"\uc758 \ub514\ubc14\uc6b4\uc2a4 \ubc84\uc804\uc758 \ud6c5\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useDebouncedState/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"type DebounceParameters = Parameters;\ntype DebounceReturnType = ReturnType<\n typeof debounce\n>;\n"})}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"function useDebouncedState(\n initialState: T,\n wait: DebounceParameters[1],\n options?: DebounceParameters[2]\n): [T, DebounceReturnType>>];\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useState } from 'react';\nimport { useDebouncedState } from '@modern-kit/react';\n\nconst Example = () => {\n const [debouncedState, setDebouncedState] = useDebouncedState(\"\", 500);\n\n return (\n \n
\ub514\ubc14\uc6b4\uc2f1 \uc0c1\ud0dc: {debouncedValue}
\n
\n setDebouncedState(e.target.value)} />\n
\n
\n );\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(u,{})]})}function h(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(f,{...e})}):f(e)}},4027:(e,t,n)=>{n.d(t,{$$:()=>Le,$I:()=>oe,AE:()=>We,BL:()=>H,DX:()=>I,FT:()=>ct,Fo:()=>et,Hn:()=>it,I5:()=>je,JF:()=>Me,K:()=>le,K$:()=>Je,M0:()=>De,ML:()=>ne,Mj:()=>ye,Mk:()=>Te,Mo:()=>ie,NT:()=>Ye,QV:()=>Ue,Ub:()=>Se,Ut:()=>Ee,W7:()=>U,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>_e,Zu:()=>ae,_1:()=>Oe,_g:()=>nt,aL:()=>J,aY:()=>Ie,bB:()=>V,d7:()=>B,eG:()=>st,fN:()=>ce,fm:()=>G,gl:()=>L,hN:()=>A,iD:()=>de,iQ:()=>Ne,jd:()=>se,lW:()=>lt,oD:()=>K,oo:()=>Re,pL:()=>q,qi:()=>ue,rN:()=>Fe,tD:()=>ke,u8:()=>Q,wY:()=>Be,xV:()=>N,xh:()=>tt,zy:()=>Z});var r=n(6206),o=n(4382),i=n(3683),s=n(5086),c=n(7197),a=(n(1604),n(5938));function l(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function m(){return typeof window>"u"}function g(){return!m()}function b(e){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const w=e=>f(void 0,0,void 0,(function*(){return b(yield(yield fetch(e)).text())}));function v(e,t){var n;return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return w(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const i=yield p(e,h[t]);n(i)}catch(i){console.error(`Failed to load image. message: ${i.mesaage}`),r(i)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i=0;i{if(e===t||C(e)&&C(t)&&isNaN(e)&&isNaN(t))return!0;if(k(e)&&k(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return y(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!x(o,t.get(r),n))return!1;return!0}return y(e,t,n)};function S(e,t){return x(e,t,new WeakMap)}function k(e){return"function"==typeof e}function C(e){return"number"==typeof e}function E(e){return!function(e){return Object(e)!==e}(e)}function j(){}function R(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const O=(...e)=>t=>e.forEach((e=>{if(k(e))e(t);else if(null!=e){e.current=t}}));function D(...e){return(0,o.useCallback)(O(...e),e)}const I=o.forwardRef(((e,t)=>{const{children:n}=e,i=l(e,["children"]),s=o.Children.toArray(n),c=s.find(T);if(c){const e=c.props.children,n=s.map((t=>t===c?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(F,Object.assign({},i,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(F,Object.assign({},i,{ref:t,children:n}))}));I.displayName="Slot";const F=o.forwardRef(((e,t)=>{const{children:n}=e,r=l(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),i):"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?O(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));F.displayName="SlotClone";const N=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function T(e){return o.isValidElement(e)&&e.type===N}var P="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const L=d(((e,t)=>{var{ratio:n,style:o,as:s="div",asChild:c=!1}=e,a=l(e,["ratio","style","as","asChild"]);const u=c?I:s,d=Object.assign({aspectRatio:n},o),f=c?a.className:i(P,a.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},a))})),M=()=>j,$=()=>!1,Y=()=>!0;function V({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)(M,$,Y)?e:t}function X(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const A=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>X()?(0,r.jsx)(r.Fragment,{children:t}):e;function W(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function _(e){const t=W(e);(0,o.useEffect)((()=>()=>t()),[t])}function z(e,t=S){const[n,r]=(0,o.useState)(e),i=W(t);return(0,o.useEffect)((()=>{i(n,e)||r(e)}),[i,n,e]),n}function B(e,t,n){const r=W(e),i=z(n),c=(0,o.useMemo)((()=>(0,s.A)(r,t,i)),[r,t,i]);return _((()=>c.cancel())),c}const J=({children:e,capture:t,wait:n,options:r})=>{const i=o.Children.only(e),s=B(((...e)=>{const n=i?.props;if(n&&k(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(i,{[t]:s})};function H({onIntersectStart:e=j,onIntersectEnd:t=j,enabled:n=!0,calledOnce:r=!1,root:i=null,threshold:s=0,rootMargin:c="0px 0px 0px 0px"}){const a=(0,o.useRef)(0),l=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=W((([n],o)=>{if(!n)return;const i=n.target;n.isIntersecting?(l.current=!0,a.current+=1,e(n)):l.current&&(l.current=!1,a.current+=1,t(n)),r&&a.current>1&&o.unobserve(i)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:s,root:i,rootMargin:c}),u.current.observe(e))}),[n,s,i,c,d])}}const K=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:i,rootMargin:s}=e,c=l(e,["src","threshold","root","rootMargin"]);const{ref:a}=H({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:i,rootMargin:s});return(0,r.jsx)("img",Object.assign({ref:D(t,a)},c))}));K.displayName="LazyImage";const U=(0,o.forwardRef)(((e,t)=>{var{width:n,height:i,fallback:s,className:c,style:a,duration:u="0.2s",onLoad:d}=e,f=l(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,p]=(0,o.useState)(!1),m=!h,g=(0,o.useMemo)((()=>({position:"relative",width:n,height:i})),[n,i]),b=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:m?0:1,transition:`opacity ${u}`},a)),[m,u,a]),w=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),v=c?`lazy-image-wrapper ${c}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:v,style:g,children:[m&&s,(0,r.jsx)(K,Object.assign({ref:t,width:n,height:i,style:b,onLoad:w},f))]})}));U.displayName="FallbackLazyImage";const Z=({condition:e,trueComponent:t,falseComponent:n})=>{const i=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:i?t:n})},Q=({onScrollAction:e,children:t,root:n,threshold:o,enabled:i,triggerPosition:s="after",rootMargin:c="150px 0px"})=>{const{ref:a}=H({onIntersectStart:e,root:n,threshold:o,enabled:i,rootMargin:c});return(0,r.jsxs)(r.Fragment,{children:["before"===s&&(0,r.jsx)("div",{ref:a}),t,"after"===s&&(0,r.jsx)("div",{ref:a})]})},q=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1}=e,c=l(e,["children","as","asChild"]);const a=s?I:i,{ref:u}=H(c);if(s&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(a,Object.assign({ref:O(t,u)},c,{children:n}))})),G=({items:e=[],itemKey:t,renderItem:n})=>{const i=(0,o.useCallback)(((e,n)=>function(e){return E(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},i(e,t))))})},ee=g()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=W(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),i=(0,o.useMemo)((()=>function(){if(m())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,i,(({target:t})=>{if(!r.current)return;const o=r.current,i=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!i&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1,onPointerDown:c,excludeRefs:a=[]}=e,u=l(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(c,{excludeRefs:a}),f=s?I:i;if(s&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:O(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const ie=({itemKey:e,items:t=[],separator:n,renderItem:i,separatorInterval:s=1,includeLastSeparator:c=!1})=>{const a=(0,o.useCallback)((e=>e===t.length-1?c:(e+1)%s==0),[c,s,t.length]);return(0,r.jsx)(G,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[i(e,t),a(t)&&n]})})},se=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ce=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function ae(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function le(e=!0){const t=k(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!i.current){i.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{i.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),i=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield b(e);return t(n),!0}catch{return t(null),!1}}))),[]),s=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield v(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),a=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:i,copyImage:s,readText:c,readContents:a}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",pe={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},me=e=>pe[e],ge=me("localStorage"),be=e=>window.localStorage.getItem(e),we=e=>JSON.stringify(e),ve=e=>(ge.subscribe(e),()=>{ge.unsubscribe(e)});function ye(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=k(n)?n():n,i=(0,o.useSyncExternalStore)(ve,(()=>be(t)),(()=>we(r)));return{state:(0,o.useMemo)((()=>i?R(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=be(t),o=n?R(n):r,i=k(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(i)),ge.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),ge.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const xe=(e,t)=>g()?window.matchMedia(e).matches:t??!1;function Se(e,t){const[n,r]=(0,o.useState)(xe(e,t)),i=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",i),n}function ke(){return Se("(prefers-color-scheme: dark)")?"dark":"light"}const Ce="color-scheme";function Ee({defaultValue:e,key:t=Ce,shouldSetBodyClass:n=!1}={}){const r=ke(),i=k(e)?e():e,{state:s,setState:c}=ye({key:t,initialValue:i??r}),a=(0,o.useCallback)((()=>{c((e=>"dark"===e?"light":"dark"))}),[c]),l=(0,o.useCallback)((()=>{c("dark")}),[c]),u=(0,o.useCallback)((()=>{c("light")}),[c]),d=(0,o.useCallback)((()=>{c(r)}),[c,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(s),()=>{n&&document.body.classList.remove(s)})),[s,n]),{colorScheme:s,preferredColorScheme:r,setToggleMode:a,setDarkMode:l,setLightMode:u,setPreferredMode:d}}function je(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),i=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),s=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:i,reset:s}}function Re({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,i]=(0,o.useState)(t),s=r0,a=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),l=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const s=a(e,t);o&&o({prev:r,next:s}),i(s)}),[n,r,a]),u=(0,o.useCallback)((e=>{l("nextStep",!s,e)}),[s,l]),d=(0,o.useCallback)((e=>{l("prevStep",!c,e)}),[c,l]),f=(0,o.useCallback)(((t,n)=>{const o=k(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void i(t);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),i(t)}),[r,t]);return{currentStep:r,hasNextStep:s,hasPrevStep:c,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Oe(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:i,resetStep:s}=Re({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:i,resetIndex:s}}function De(e,t,n={}){const[r,i]=(0,o.useState)(e);return[r,B(i,t,n)]}function Ie(e,t={}){const[n,r]=(0,o.useState)(""),[i,s]=De("",e,t);return{value:n,debouncedValue:i,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),s(t)}),[s]),onReset:(0,o.useCallback)((()=>{r(""),s("")}),[s])}}function Fe(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Ne({onFocus:e=j,onBlur:t=j}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=W((t=>{r(!0),e(t)})),c=W((e=>{r(!1),t(e)})),a=(0,o.useCallback)((()=>{i.current&&(i.current.focus(),r(!0))}),[]);return ne(i,"focus",s),ne(i,"blur",c),{ref:i,isFocus:n,setFocus:a}}function Te({onEnter:e=j,onLeave:t=j}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=W((t=>{r(!0),e(t)})),c=W((e=>{r(!1),t(e)}));return ne(i,"mouseenter",s),ne(i,"mouseleave",c),{ref:i,isHovered:n}}const Pe=e=>{var t;return C(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function Le(e,t){const n=(0,o.useRef)(),r=W(e),{delay:i,enabled:s}=Pe(t),c=(0,o.useCallback)((()=>{n.current=window.setInterval(r,i)}),[r,i]),a=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{a(),c()}),[a,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>a()}),[a,c,s,i]),{set:c,reset:l,clear:a}}function Me({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),i=W((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];k(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",i),()=>t.removeEventListener("keydown",i)}),[e,i]),r}const $e={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function Ye(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)($e),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:a}=t;let l=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();l=i-t.left,u=s-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:a,elementRelativeX:l,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const Ve=()=>navigator.onLine,Xe=()=>!0,Ae=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function We({onlineAction:e=j,offlineAction:t=j}={}){const n=W((n=>Ae(n,e,t)));return(0,o.useSyncExternalStore)(n,Ve,Xe)}function _e(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const ze={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Be(e=j){const[t,n]=(0,o.useState)(ze),r=(0,o.useRef)(null),i=W((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(i);return t.observe(e),()=>{t.unobserve(e)}}),[i]),{ref:r,contentRect:t}}function Je({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),i=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>i())),[e,r,i]),{ref:t,lock:r,unlock:i}}const He=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,Ke=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:i=0,alignY:s="start",alignX:c="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+i+He(window.innerHeight,r.height,s),left:r.left+window.scrollX+o+He(window.innerWidth,r.width,c)};const a=e.getBoundingClientRect();return{top:r.top-a.top+e.scrollTop+i+He(a.height,r.height,s),left:r.left-a.left+e.scrollLeft+o+He(a.width,r.width,c)}};function Ue(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:i,top:s}=Ke(r,t,n);r.scrollTo({top:s,left:i,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ze=me("sessionStorage"),Qe=e=>window.sessionStorage.getItem(e),qe=e=>JSON.stringify(e),Ge=e=>(Ze.subscribe(e),()=>{Ze.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=k(n)?n():n,i=(0,o.useSyncExternalStore)(Ge,(()=>Qe(t)),(()=>qe(r)));return{state:(0,o.useMemo)((()=>i?R(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=Qe(t),o=n?R(n):r,i=k(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(i)),Ze.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ze.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:i}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[s,c]=(0,o.useState)(n),a=(0,o.useCallback)((e=>{c((t=>{const n=k(e)?e(t):e;return r&&i&&function(e,t,n){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=k(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,i,n),n}))}),[r,i]),l=(0,o.useCallback)((()=>{r&&i&&function(e,t){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,i),c(null)}),[r,i]);return Object.assign({state:s,setState:a,clearState:l},Re(e))}function nt(e,t,n={}){const r=W(e),i=z(n),s=(0,o.useMemo)((()=>(0,c.A)(r,t,i)),[r,t,i]);return _((()=>s.cancel())),s}const rt=e=>{var t;return C(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=W(e),{delay:i,enabled:s}=rt(t),c=(0,o.useCallback)((()=>{n.current=setTimeout(r,i)}),[r,i]),a=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{a(),c()}),[a,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>a()}),[c,a,i,s]),{set:c,reset:l,clear:a}}function it(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function st(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new a.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function ct({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const at={width:null,height:null};function lt({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>m()?at:{width:window.innerWidth,height:window.innerHeight})),r=B(n,e),i=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",i),t}function ut(e,t,n){const{delay:r,enabled:i}=rt(t),{set:s,reset:c,clear:a}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!i||c()}),[r,i,c,...n]),{set:s,reset:c,clear:a}}}}]);
\ No newline at end of file
diff --git a/assets/js/3bdef6d7.85d88013.js b/assets/js/3bdef6d7.85d88013.js
new file mode 100644
index 000000000..b4d7e9d87
--- /dev/null
+++ b/assets/js/3bdef6d7.85d88013.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[2786],{4123:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>d,assets:()=>s,contentTitle:()=>u,default:()=>p,frontMatter:()=>a,metadata:()=>r,toc:()=>l});const r=JSON.parse('{"id":"react/hooks/useDebouncedState","title":"useDebouncedState","description":"useState\uc758 \ub514\ubc14\uc6b4\uc2a4 \ubc84\uc804\uc758 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useDebouncedState.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useDebouncedState","permalink":"/modern-kit/docs/react/hooks/useDebouncedState","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useDebouncedInputValue","permalink":"/modern-kit/docs/react/hooks/useDebouncedInputValue"},"next":{"title":"useDependencyTimeout","permalink":"/modern-kit/docs/react/hooks/useDependencyTimeout"}}');var o=n(6206),i=n(3267),c=(n(4382),n(9883));const a={},u="useDebouncedState",s={},d=()=>{const e={div:"div",input:"input",p:"p",...(0,i.R)()},[t,n]=(0,c.M)("",500);return(0,o.jsxs)(e.div,{children:[(0,o.jsxs)(e.p,{children:["\ub514\ubc14\uc6b4\uc2f1 \uc0c1\ud0dc: ",t]}),(0,o.jsx)(e.div,{children:(0,o.jsx)(e.input,{type:"text",onChange:e=>n(e.target.value)})})]})},l=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function f(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"usedebouncedstate",children:"useDebouncedState"})}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"useState"}),"\uc758 \ub514\ubc14\uc6b4\uc2a4 \ubc84\uc804\uc758 \ud6c5\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useDebouncedState/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"type DebounceParameters = Parameters;\ntype DebounceReturnType = ReturnType<\n typeof debounce\n>;\n"})}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"function useDebouncedState(\n initialState: T,\n wait: DebounceParameters[1],\n options?: DebounceParameters[2]\n): [T, DebounceReturnType>>];\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useState } from 'react';\nimport { useDebouncedState } from '@modern-kit/react';\n\nconst Example = () => {\n const [debouncedState, setDebouncedState] = useDebouncedState(\"\", 500);\n\n return (\n \n
\ub514\ubc14\uc6b4\uc2f1 \uc0c1\ud0dc: {debouncedValue}
\n
\n setDebouncedState(e.target.value)} />\n
\n
\n );\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(d,{})]})}function p(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(f,{...e})}):f(e)}},3267:(e,t,n)=>{n.d(t,{R:()=>c,x:()=>a});var r=n(4382);const o={},i=r.createContext(o);function c(e){const t=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:c(e.components),r.createElement(i.Provider,{value:t},e.children)}},5115:(e,t,n)=>{n.d(t,{d:()=>u});var r=n(4382),o=n(5086),i=n(3311),c=n(6765),a=n(5423);function u(e,t,n){const u=(0,c.p)(e),s=(0,a.B)(n),d=(0,r.useMemo)((()=>(0,o.A)(u,t,s)),[u,t,s]);return(0,i.i)((()=>d.cancel())),d}},9883:(e,t,n)=>{n.d(t,{M:()=>i});var r=n(5115),o=n(4382);function i(e,t,n={}){const[i,c]=(0,o.useState)(e);return[i,(0,r.d)(c,t,n)]}},6765:(e,t,n)=>{n.d(t,{p:()=>o});var r=n(4382);function o(e){const t=(0,r.useRef)(e);return t.current=e,(0,r.useCallback)(((...e)=>t.current(...e)),[])}},5423:(e,t,n)=>{n.d(t,{B:()=>c});var r=n(4382),o=n(6765),i=n(9340);function c(e,t=i.Gp){const[n,c]=(0,r.useState)(e),a=(0,o.p)(t);return(0,r.useEffect)((()=>{a(n,e)||c(e)}),[a,n,e]),n}},3311:(e,t,n)=>{n.d(t,{i:()=>i});var r=n(6765),o=n(4382);function i(e){const t=(0,r.p)(e);(0,o.useEffect)((()=>()=>t()),[t])}},5086:(e,t,n)=>{n.d(t,{A:()=>N});var r=n(322);const o="object"==typeof global&&global&&global.Object===Object&&global;var i="object"==typeof self&&self&&self.Object===Object&&self;const c=o||i||Function("return this")();const a=function(){return c.Date.now()};var u=/\s/;const s=function(e){for(var t=e.length;t--&&u.test(e.charAt(t)););return t};var d=/^\s+/;const l=function(e){return e?e.slice(0,s(e)+1).replace(d,""):e};const f=c.Symbol;var p=Object.prototype,h=p.hasOwnProperty,m=p.toString,v=f?f.toStringTag:void 0;const b=function(e){var t=h.call(e,v),n=e[v];try{e[v]=void 0;var r=!0}catch(i){}var o=m.call(e);return r&&(t?e[v]=n:delete e[v]),o};var g=Object.prototype.toString;const y=function(e){return g.call(e)};var w=f?f.toStringTag:void 0;const x=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":w&&w in Object(e)?b(e):y(e)};const j=function(e){return null!=e&&"object"==typeof e};const S=function(e){return"symbol"==typeof e||j(e)&&"[object Symbol]"==x(e)};var k=/^[-+]0x[0-9a-f]+$/i,D=/^0b[01]+$/i,E=/^0o[0-7]+$/i,T=parseInt;const O=function(e){if("number"==typeof e)return e;if(S(e))return NaN;if((0,r.A)(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=(0,r.A)(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=l(e);var n=D.test(e);return n||E.test(e)?T(e.slice(2),n?2:8):k.test(e)?NaN:+e};var C=Math.max,$=Math.min;const N=function(e,t,n){var o,i,c,u,s,d,l=0,f=!1,p=!1,h=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function m(t){var n=o,r=i;return o=i=void 0,l=t,u=e.apply(r,n)}function v(e){var n=e-d;return void 0===d||n>=t||n<0||p&&e-l>=c}function b(){var e=a();if(v(e))return g(e);s=setTimeout(b,function(e){var n=t-(e-d);return p?$(n,c-(e-l)):n}(e))}function g(e){return s=void 0,h&&o?m(e):(o=i=void 0,u)}function y(){var e=a(),n=v(e);if(o=arguments,i=this,d=e,n){if(void 0===s)return function(e){return l=e,s=setTimeout(b,t),f?m(e):u}(d);if(p)return clearTimeout(s),s=setTimeout(b,t),m(d)}return void 0===s&&(s=setTimeout(b,t)),u}return t=O(t)||0,(0,r.A)(n)&&(f=!!n.leading,c=(p="maxWait"in n)?C(O(n.maxWait)||0,t):c,h="trailing"in n?!!n.trailing:h),y.cancel=function(){void 0!==s&&clearTimeout(s),l=0,o=d=i=s=void 0},y.flush=function(){return void 0===s?u:g(a())},y}},322:(e,t,n)=>{n.d(t,{A:()=>r});const r=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},9340:(e,t,n)=>{function r(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{u(r.next(e))}catch(t){i(t)}}function a(e){try{u(r.throw(e))}catch(t){i(t)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}u((r=r.apply(e,t||[])).next())}))}n.d(t,{Et:()=>w,Fr:()=>a,Gp:()=>b,Ol:()=>D,Qd:()=>j,S$:()=>c,Tn:()=>g,Zp:()=>f,dK:()=>s,fl:()=>O,gD:()=>y,i5:()=>h,if:()=>p,l6:()=>S,lQ:()=>k,nS:()=>l,ni:()=>C,oc:()=>u}),"function"==typeof SuppressedError&&SuppressedError;const o={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};const i=(e,t)=>new Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function c(){return"undefined"==typeof window}function a(){if(c())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}function u(){return!c()}function s(e){return r(this,void 0,void 0,(function*(){if(!u())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const d=e=>r(void 0,void 0,void 0,(function*(){const t=yield fetch(e);return s(yield t.text())}));function l(e,t){var n;return r(this,void 0,void 0,(function*(){if(!u())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator))return d(e);if(!("write"in window.navigator.clipboard))return d(e);if(null!==(n=null==t?void 0:t.toText)&&void 0!==n&&n)return d(e);const c=yield function(e,t="png"){return new Promise(((n,c)=>{const a=new Image;a.onload=()=>r(this,void 0,void 0,(function*(){const e=document.createElement("canvas");e.width=a.width,e.height=a.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(a,0,0);const c=yield i(e,o[t]);n(c)}catch(r){console.error(`Failed to load image. message: ${r.mesaage}`),c(r)}})),a.onerror=()=>{c(new Error("Failed to load image"))},a.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[c.type]:c})]),c}catch(c){throw console.error(`Failed to copy to clipboard. message: ${c.message}`),c}}))}function f(){return r(this,void 0,void 0,(function*(){if(!u())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function p(){return r(this,void 0,void 0,(function*(){if(!u())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function h(e,t){return Object.prototype.hasOwnProperty.call(e,t)}const m=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i=0;i{if(e===t)return!0;if(w(e)&&w(t)&&isNaN(e)&&isNaN(t))return!0;if(g(e)&&g(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return m(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!v(o,t.get(r),n))return!1;return!0}return m(e,t,n)};function b(e,t){return v(e,t,new WeakMap)}function g(e){return"function"==typeof e}function y(e){return null==e}function w(e){return"number"==typeof e}function x(e){return!function(e){return Object(e)!==e}(e)}function j(e){return x(e)&&"[object Object]"===Object.prototype.toString.call(e)}function S(e){return e===window}function k(){}function D(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}function E(e){return Object.keys(e)}const T={days:864e5,hours:36e5,minutes:6e4,seconds:1e3};E(T);function O(e,t){if(!u())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}function C(e,t,n){if(!u())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=g(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}}}]);
\ No newline at end of file
diff --git a/assets/js/3e5d9272.5b90e6a3.js b/assets/js/3e5d9272.5b90e6a3.js
new file mode 100644
index 000000000..cda54946d
--- /dev/null
+++ b/assets/js/3e5d9272.5b90e6a3.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[7138],{7970:(e,n,t)=>{t.r(n),t.d(n,{Example:()=>f,assets:()=>u,contentTitle:()=>d,default:()=>m,frontMatter:()=>a,metadata:()=>r,toc:()=>p});const r=JSON.parse('{"id":"react/components/InfiniteScroll","title":"InfiniteScroll","description":"\ubb34\ud55c \uc2a4\ud06c\ub864 \uae30\ub2a5\uc744 \uc120\uc5b8\uc801\uc73c\ub85c \ud65c\uc6a9 \ud560 \uc218 \uc788\ub294 \ucef4\ud3ec\ub10c\ud2b8\uc785\ub2c8\ub2e4.","source":"@site/docs/react/components/InfiniteScroll.mdx","sourceDirName":"react/components","slug":"/react/components/InfiniteScroll","permalink":"/modern-kit/docs/react/components/InfiniteScroll","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"InView","permalink":"/modern-kit/docs/react/components/InView"},"next":{"title":"Iterator","permalink":"/modern-kit/docs/react/components/Iterator"}}');var o=t(6206),i=t(3267),c=t(4382),s=t(7399);const l=({onScrollAction:e,children:n,root:t,threshold:r,enabled:i,triggerPosition:c="after",rootMargin:l="150px 0px"})=>{const{ref:a}=(0,s.B)({onIntersectStart:e,root:t,threshold:r,enabled:i,rootMargin:l});return(0,o.jsxs)(o.Fragment,{children:["before"===c&&(0,o.jsx)("div",{ref:a}),n,"after"===c&&(0,o.jsx)("div",{ref:a})]})},a={},d="InfiniteScroll",u={},f=()=>{const e={div:"div",...(0,i.R)()},[n,t]=(0,c.useState)([1,2,3,4,5,6,7,8,9,10]);return(0,o.jsx)(e.div,{style:{display:"flex",gap:"10px",flexDirection:"column"},children:(0,o.jsx)(l,{onScrollAction:()=>{t((e=>[...e,...Array.from({length:10},((n,t)=>e.length+t+1))]))},triggerPosition:"after",children:n.map((n=>(0,o.jsxs)(e.div,{style:{height:"80px",backgroundColor:"#ccccff"},children:["Item ",n]},n)))})})},p=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function h(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",strong:"strong",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.header,{children:(0,o.jsx)(n.h1,{id:"infinitescroll",children:"InfiniteScroll"})}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.code,{children:"\ubb34\ud55c \uc2a4\ud06c\ub864"})," \uae30\ub2a5\uc744 \uc120\uc5b8\uc801\uc73c\ub85c \ud65c\uc6a9 \ud560 \uc218 \uc788\ub294 \ucef4\ud3ec\ub10c\ud2b8\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.code,{children:"@modern-kit/react"}),"\uc758 ",(0,o.jsx)(n.strong,{children:(0,o.jsx)(n.a,{href:"https://modern-agile-team.github.io/modern-kit/docs/react/hooks/useIntersectionObserver",children:"useIntersectionObserver"})})," \ud6c5\uc744 \uc0ac\uc6a9\ud558\uc5ec \uad6c\ud604\ub418\uc5c8\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(n.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/components/InfiniteScroll/index.tsx",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(n.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"\ninterface InfiniteScrollProps\n extends Omit<\n UseIntersectionObserverProps,\n 'onIntersectStart' | 'onIntersectEnd' | 'calledOnce'\n > {\n onScrollAction: (entry: IntersectionObserverEntry) => void;\n triggerPosition?: 'before' | 'after';\n}\n"})}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"const InfiniteScroll: ({\n onScrollAction,\n children,\n root,\n threshold,\n enabled,\n triggerPosition,\n rootMargin,\n}: PropsWithChildren) => JSX.Element;\n"})}),"\n",(0,o.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { InfiniteScroll } from '@modern-kit/react'\n\nconst Example = () => {\n const [list, setList] = useState([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);\n const onScrollAction = () => {\n setList((prev) => [...prev, ...Array.from({ length: 10 }, (_, i) => prev.length + i + 1)]);\n };\n\n return (\n \n
\n {list.map((value) => (\n \n Item {value}\n
\n ))}\n \n
\n );\n};\n"})}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(f,{})]})}function m(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(h,{...e})}):h(e)}},3267:(e,n,t)=>{t.d(n,{R:()=>c,x:()=>s});var r=t(4382);const o={},i=r.createContext(o);function c(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:c(e.components),r.createElement(i.Provider,{value:n},e.children)}},7399:(e,n,t)=>{t.d(n,{B:()=>c});var r=t(4382),o=t(6765),i=t(9340);function c({onIntersectStart:e=i.lQ,onIntersectEnd:n=i.lQ,enabled:t=!0,calledOnce:c=!1,root:s=null,threshold:l=0,rootMargin:a="0px 0px 0px 0px"}){const d=(0,r.useRef)(0),u=(0,r.useRef)(!1),f=(0,r.useRef)(null),p=(0,o.p)((([t],r)=>{if(!t)return;const o=t.target;t.isIntersecting?(u.current=!0,d.current+=1,e(t)):u.current&&(u.current=!1,d.current+=1,n(t)),c&&d.current>1&&r.unobserve(o)}));return{ref:(0,r.useCallback)((e=>{f.current&&(f.current.disconnect(),f.current=null),null!==e&&t&&(f.current=new IntersectionObserver(p,{threshold:l,root:s,rootMargin:a}),f.current.observe(e))}),[t,l,s,a,p])}}},6765:(e,n,t)=>{t.d(n,{p:()=>o});var r=t(4382);function o(e){const n=(0,r.useRef)(e);return n.current=e,(0,r.useCallback)(((...e)=>n.current(...e)),[])}},9340:(e,n,t)=>{function r(e,n,t,r){return new(t||(t=Promise))((function(o,i){function c(e){try{l(r.next(e))}catch(n){i(n)}}function s(e){try{l(r.throw(e))}catch(n){i(n)}}function l(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(c,s)}l((r=r.apply(e,n||[])).next())}))}t.d(n,{Et:()=>b,Fr:()=>s,Gp:()=>v,Ol:()=>k,Qd:()=>j,S$:()=>c,Tn:()=>x,Zp:()=>f,dK:()=>a,fl:()=>O,gD:()=>w,i5:()=>h,if:()=>p,l6:()=>S,lQ:()=>I,nS:()=>u,ni:()=>P,oc:()=>l}),"function"==typeof SuppressedError&&SuppressedError;const o={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};const i=(e,n)=>new Promise(((t,r)=>{e.toBlob((e=>{e?t(e):r(new Error(`Failed to create blob with format ${n}`))}),n)}));function c(){return"undefined"==typeof window}function s(){if(c())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}function l(){return!c()}function a(e){return r(this,void 0,void 0,(function*(){if(!l())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const n=document.createElement("textarea");n.value=e,n.style.opacity="0",document.body.appendChild(n),n.focus(),n.select();try{return document.execCommand("copy"),e}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}finally{document.body.removeChild(n)}}(e)}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}}))}const d=e=>r(void 0,void 0,void 0,(function*(){const n=yield fetch(e);return a(yield n.text())}));function u(e,n){var t;return r(this,void 0,void 0,(function*(){if(!l())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator))return d(e);if(!("write"in window.navigator.clipboard))return d(e);if(null!==(t=null==n?void 0:n.toText)&&void 0!==t&&t)return d(e);const c=yield function(e,n="png"){return new Promise(((t,c)=>{const s=new Image;s.onload=()=>r(this,void 0,void 0,(function*(){const e=document.createElement("canvas");e.width=s.width,e.height=s.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(s,0,0);const c=yield i(e,o[n]);t(c)}catch(r){console.error(`Failed to load image. message: ${r.mesaage}`),c(r)}})),s.onerror=()=>{c(new Error("Failed to load image"))},s.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[c.type]:c})]),c}catch(c){throw console.error(`Failed to copy to clipboard. message: ${c.message}`),c}}))}function f(){return r(this,void 0,void 0,(function*(){if(!l())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function p(){return r(this,void 0,void 0,(function*(){if(!l())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function h(e,n){return Object.prototype.hasOwnProperty.call(e,n)}const m=(e,n,t)=>{const r=Object.keys(e),o=Object.keys(n);if(r.length!==o.length)return!1;for(let i=0;i{if(e===n)return!0;if(b(e)&&b(n)&&isNaN(e)&&isNaN(n))return!0;if(x(e)&&x(n))return e.toString()===n.toString();if("object"!=typeof e||"object"!=typeof n||null===e||null===n)return!1;if(t.has(e)&&t.get(e)===n)return!0;if(t.set(e,n),e.constructor!==n.constructor)return!1;if(e instanceof Set){if(e.size!==n.size)return!1;const r=[...e],o=[...n];return m(r,o,t)}if(e instanceof Map){if(e.size!==n.size)return!1;for(const[r,o]of e)if(!n.has(r)||!g(o,n.get(r),t))return!1;return!0}return m(e,n,t)};function v(e,n){return g(e,n,new WeakMap)}function x(e){return"function"==typeof e}function w(e){return null==e}function b(e){return"number"==typeof e}function y(e){return!function(e){return Object(e)!==e}(e)}function j(e){return y(e)&&"[object Object]"===Object.prototype.toString.call(e)}function S(e){return e===window}function I(){}function k(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(n){throw new Error(`Failed to parse data: ${n}`)}}function E(e){return Object.keys(e)}const C={days:864e5,hours:36e5,minutes:6e4,seconds:1e3};E(C);function O(e,n){if(!l())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(n)}catch(t){throw new Error(`Failed to remove key "${n}" from ${e}: ${t}`)}}function P(e,n,t){if(!l())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=x(t)?t():t;r.setItem(n,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${n}" in ${e}: ${r}`)}}}}]);
\ No newline at end of file
diff --git a/assets/js/3e5d9272.fe03afa2.js b/assets/js/3e5d9272.fe03afa2.js
deleted file mode 100644
index a0ee3701e..000000000
--- a/assets/js/3e5d9272.fe03afa2.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[7138],{2218:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>d,assets:()=>u,contentTitle:()=>a,default:()=>p,frontMatter:()=>l,metadata:()=>r,toc:()=>f});const r=JSON.parse('{"id":"react/components/InfiniteScroll","title":"InfiniteScroll","description":"\ubb34\ud55c \uc2a4\ud06c\ub864 \uae30\ub2a5\uc744 \uc120\uc5b8\uc801\uc73c\ub85c \ud65c\uc6a9 \ud560 \uc218 \uc788\ub294 \ucef4\ud3ec\ub10c\ud2b8\uc785\ub2c8\ub2e4.","source":"@site/docs/react/components/InfiniteScroll.mdx","sourceDirName":"react/components","slug":"/react/components/InfiniteScroll","permalink":"/modern-kit/docs/react/components/InfiniteScroll","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"InView","permalink":"/modern-kit/docs/react/components/InView"},"next":{"title":"Iterator","permalink":"/modern-kit/docs/react/components/Iterator"}}');var o=n(6206),i=n(3267),c=n(4382),s=n(4027);const l={},a="InfiniteScroll",u={},d=()=>{const e={div:"div",...(0,i.R)()},[t,n]=(0,c.useState)([1,2,3,4,5,6,7,8,9,10]);return(0,o.jsx)(e.div,{style:{display:"flex",gap:"10px",flexDirection:"column"},children:(0,o.jsx)(s.u8,{onScrollAction:()=>{n((e=>[...e,...Array.from({length:10},((t,n)=>e.length+n+1))]))},triggerPosition:"after",children:t.map((t=>(0,o.jsxs)(e.div,{style:{height:"80px",backgroundColor:"#ccccff"},children:["Item ",t]},t)))})})},f=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function h(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",strong:"strong",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"infinitescroll",children:"InfiniteScroll"})}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"\ubb34\ud55c \uc2a4\ud06c\ub864"})," \uae30\ub2a5\uc744 \uc120\uc5b8\uc801\uc73c\ub85c \ud65c\uc6a9 \ud560 \uc218 \uc788\ub294 \ucef4\ud3ec\ub10c\ud2b8\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"@modern-kit/react"}),"\uc758 ",(0,o.jsx)(t.strong,{children:(0,o.jsx)(t.a,{href:"https://modern-agile-team.github.io/modern-kit/docs/react/hooks/useIntersectionObserver",children:"useIntersectionObserver"})})," \ud6c5\uc744 \uc0ac\uc6a9\ud558\uc5ec \uad6c\ud604\ub418\uc5c8\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/components/InfiniteScroll/index.tsx",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"\ninterface InfiniteScrollProps\n extends Omit<\n UseIntersectionObserverProps,\n 'onIntersectStart' | 'onIntersectEnd' | 'calledOnce'\n > {\n onScrollAction: (entry: IntersectionObserverEntry) => void;\n triggerPosition?: 'before' | 'after';\n}\n"})}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"const InfiniteScroll: ({\n onScrollAction,\n children,\n root,\n threshold,\n enabled,\n triggerPosition,\n rootMargin,\n}: PropsWithChildren) => JSX.Element;\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { InfiniteScroll } from '@modern-kit/react'\n\nconst Example = () => {\n const [list, setList] = useState([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);\n const onScrollAction = () => {\n setList((prev) => [...prev, ...Array.from({ length: 10 }, (_, i) => prev.length + i + 1)]);\n };\n\n return (\n \n
\n {list.map((value) => (\n \n Item {value}\n
\n ))}\n \n
\n );\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(d,{})]})}function p(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(h,{...e})}):h(e)}},4027:(e,t,n)=>{n.d(t,{$$:()=>$e,$I:()=>oe,AE:()=>We,BL:()=>H,DX:()=>P,FT:()=>st,Fo:()=>et,Hn:()=>it,I5:()=>je,JF:()=>Te,K:()=>ae,K$:()=>Je,M0:()=>Re,ML:()=>ne,Mj:()=>ye,Mk:()=>Ne,Mo:()=>ie,NT:()=>Ye,QV:()=>Ke,Ub:()=>Se,Ut:()=>Ee,W7:()=>K,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>_e,Zu:()=>le,_1:()=>Oe,_g:()=>nt,aL:()=>J,aY:()=>Pe,bB:()=>V,d7:()=>B,eG:()=>ct,fN:()=>se,fm:()=>G,gl:()=>$,hN:()=>D,iD:()=>de,iQ:()=>Le,jd:()=>ce,lW:()=>at,oD:()=>U,oo:()=>Ie,pL:()=>q,qi:()=>ue,rN:()=>Fe,tD:()=>ke,u8:()=>Q,wY:()=>Be,xV:()=>L,xh:()=>tt,zy:()=>Z});var r=n(6206),o=n(4382),i=n(3683),c=n(5086),s=n(7197),l=(n(1604),n(5938));function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function m(){return typeof window>"u"}function g(){return!m()}function w(e){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const v=e=>f(void 0,0,void 0,(function*(){return w(yield(yield fetch(e)).text())}));function b(e,t){var n;return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return v(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const i=yield p(e,h[t]);n(i)}catch(i){console.error(`Failed to load image. message: ${i.mesaage}`),r(i)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i=0;i{if(e===t||C(e)&&C(t)&&isNaN(e)&&isNaN(t))return!0;if(k(e)&&k(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return y(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!x(o,t.get(r),n))return!1;return!0}return y(e,t,n)};function S(e,t){return x(e,t,new WeakMap)}function k(e){return"function"==typeof e}function C(e){return"number"==typeof e}function E(e){return!function(e){return Object(e)!==e}(e)}function j(){}function I(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const O=(...e)=>t=>e.forEach((e=>{if(k(e))e(t);else if(null!=e){e.current=t}}));function R(...e){return(0,o.useCallback)(O(...e),e)}const P=o.forwardRef(((e,t)=>{const{children:n}=e,i=a(e,["children"]),c=o.Children.toArray(n),s=c.find(N);if(s){const e=s.props.children,n=c.map((t=>t===s?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(F,Object.assign({},i,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(F,Object.assign({},i,{ref:t,children:n}))}));P.displayName="Slot";const F=o.forwardRef(((e,t)=>{const{children:n}=e,r=a(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),i):"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?O(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));F.displayName="SlotClone";const L=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function N(e){return o.isValidElement(e)&&e.type===L}var M="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const $=d(((e,t)=>{var{ratio:n,style:o,as:c="div",asChild:s=!1}=e,l=a(e,["ratio","style","as","asChild"]);const u=s?P:c,d=Object.assign({aspectRatio:n},o),f=s?l.className:i(M,l.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},l))})),T=()=>j,A=()=>!1,Y=()=>!0;function V({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)(T,A,Y)?e:t}function X(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const D=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>X()?(0,r.jsx)(r.Fragment,{children:t}):e;function W(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function _(e){const t=W(e);(0,o.useEffect)((()=>()=>t()),[t])}function z(e,t=S){const[n,r]=(0,o.useState)(e),i=W(t);return(0,o.useEffect)((()=>{i(n,e)||r(e)}),[i,n,e]),n}function B(e,t,n){const r=W(e),i=z(n),s=(0,o.useMemo)((()=>(0,c.A)(r,t,i)),[r,t,i]);return _((()=>s.cancel())),s}const J=({children:e,capture:t,wait:n,options:r})=>{const i=o.Children.only(e),c=B(((...e)=>{const n=i?.props;if(n&&k(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(i,{[t]:c})};function H({onIntersectStart:e=j,onIntersectEnd:t=j,enabled:n=!0,calledOnce:r=!1,root:i=null,threshold:c=0,rootMargin:s="0px 0px 0px 0px"}){const l=(0,o.useRef)(0),a=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=W((([n],o)=>{if(!n)return;const i=n.target;n.isIntersecting?(a.current=!0,l.current+=1,e(n)):a.current&&(a.current=!1,l.current+=1,t(n)),r&&l.current>1&&o.unobserve(i)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:c,root:i,rootMargin:s}),u.current.observe(e))}),[n,c,i,s,d])}}const U=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:i,rootMargin:c}=e,s=a(e,["src","threshold","root","rootMargin"]);const{ref:l}=H({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:i,rootMargin:c});return(0,r.jsx)("img",Object.assign({ref:R(t,l)},s))}));U.displayName="LazyImage";const K=(0,o.forwardRef)(((e,t)=>{var{width:n,height:i,fallback:c,className:s,style:l,duration:u="0.2s",onLoad:d}=e,f=a(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,p]=(0,o.useState)(!1),m=!h,g=(0,o.useMemo)((()=>({position:"relative",width:n,height:i})),[n,i]),w=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:m?0:1,transition:`opacity ${u}`},l)),[m,u,l]),v=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),b=s?`lazy-image-wrapper ${s}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:b,style:g,children:[m&&c,(0,r.jsx)(U,Object.assign({ref:t,width:n,height:i,style:w,onLoad:v},f))]})}));K.displayName="FallbackLazyImage";const Z=({condition:e,trueComponent:t,falseComponent:n})=>{const i=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:i?t:n})},Q=({onScrollAction:e,children:t,root:n,threshold:o,enabled:i,triggerPosition:c="after",rootMargin:s="150px 0px"})=>{const{ref:l}=H({onIntersectStart:e,root:n,threshold:o,enabled:i,rootMargin:s});return(0,r.jsxs)(r.Fragment,{children:["before"===c&&(0,r.jsx)("div",{ref:l}),t,"after"===c&&(0,r.jsx)("div",{ref:l})]})},q=d(((e,t)=>{var{children:n,as:i="div",asChild:c=!1}=e,s=a(e,["children","as","asChild"]);const l=c?P:i,{ref:u}=H(s);if(c&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(l,Object.assign({ref:O(t,u)},s,{children:n}))})),G=({items:e=[],itemKey:t,renderItem:n})=>{const i=(0,o.useCallback)(((e,n)=>function(e){return E(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},i(e,t))))})},ee=g()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=W(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),i=(0,o.useMemo)((()=>function(){if(m())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,i,(({target:t})=>{if(!r.current)return;const o=r.current,i=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!i&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:i="div",asChild:c=!1,onPointerDown:s,excludeRefs:l=[]}=e,u=a(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(s,{excludeRefs:l}),f=c?P:i;if(c&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:O(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const ie=({itemKey:e,items:t=[],separator:n,renderItem:i,separatorInterval:c=1,includeLastSeparator:s=!1})=>{const l=(0,o.useCallback)((e=>e===t.length-1?s:(e+1)%c==0),[s,c,t.length]);return(0,r.jsx)(G,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[i(e,t),l(t)&&n]})})},ce=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),se=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function le(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function ae(e=!0){const t=k(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!i.current){i.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{i.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),i=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield w(e);return t(n),!0}catch{return t(null),!1}}))),[]),c=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield b(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),s=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),l=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:i,copyImage:c,readText:s,readContents:l}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",pe={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},me=e=>pe[e],ge=me("localStorage"),we=e=>window.localStorage.getItem(e),ve=e=>JSON.stringify(e),be=e=>(ge.subscribe(e),()=>{ge.unsubscribe(e)});function ye(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=k(n)?n():n,i=(0,o.useSyncExternalStore)(be,(()=>we(t)),(()=>ve(r)));return{state:(0,o.useMemo)((()=>i?I(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=we(t),o=n?I(n):r,i=k(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(i)),ge.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),ge.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const xe=(e,t)=>g()?window.matchMedia(e).matches:t??!1;function Se(e,t){const[n,r]=(0,o.useState)(xe(e,t)),i=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",i),n}function ke(){return Se("(prefers-color-scheme: dark)")?"dark":"light"}const Ce="color-scheme";function Ee({defaultValue:e,key:t=Ce,shouldSetBodyClass:n=!1}={}){const r=ke(),i=k(e)?e():e,{state:c,setState:s}=ye({key:t,initialValue:i??r}),l=(0,o.useCallback)((()=>{s((e=>"dark"===e?"light":"dark"))}),[s]),a=(0,o.useCallback)((()=>{s("dark")}),[s]),u=(0,o.useCallback)((()=>{s("light")}),[s]),d=(0,o.useCallback)((()=>{s(r)}),[s,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(c),()=>{n&&document.body.classList.remove(c)})),[c,n]),{colorScheme:c,preferredColorScheme:r,setToggleMode:l,setDarkMode:a,setLightMode:u,setPreferredMode:d}}function je(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),i=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),c=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:i,reset:c}}function Ie({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,i]=(0,o.useState)(t),c=r0,l=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),a=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const c=l(e,t);o&&o({prev:r,next:c}),i(c)}),[n,r,l]),u=(0,o.useCallback)((e=>{a("nextStep",!c,e)}),[c,a]),d=(0,o.useCallback)((e=>{a("prevStep",!s,e)}),[s,a]),f=(0,o.useCallback)(((t,n)=>{const o=k(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void i(t);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),i(t)}),[r,t]);return{currentStep:r,hasNextStep:c,hasPrevStep:s,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Oe(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:i,resetStep:c}=Ie({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:i,resetIndex:c}}function Re(e,t,n={}){const[r,i]=(0,o.useState)(e);return[r,B(i,t,n)]}function Pe(e,t={}){const[n,r]=(0,o.useState)(""),[i,c]=Re("",e,t);return{value:n,debouncedValue:i,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),c(t)}),[c]),onReset:(0,o.useCallback)((()=>{r(""),c("")}),[c])}}function Fe(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Le({onFocus:e=j,onBlur:t=j}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),c=W((t=>{r(!0),e(t)})),s=W((e=>{r(!1),t(e)})),l=(0,o.useCallback)((()=>{i.current&&(i.current.focus(),r(!0))}),[]);return ne(i,"focus",c),ne(i,"blur",s),{ref:i,isFocus:n,setFocus:l}}function Ne({onEnter:e=j,onLeave:t=j}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),c=W((t=>{r(!0),e(t)})),s=W((e=>{r(!1),t(e)}));return ne(i,"mouseenter",c),ne(i,"mouseleave",s),{ref:i,isHovered:n}}const Me=e=>{var t;return C(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function $e(e,t){const n=(0,o.useRef)(),r=W(e),{delay:i,enabled:c}=Me(t),s=(0,o.useCallback)((()=>{n.current=window.setInterval(r,i)}),[r,i]),l=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),s()}),[l,s]);return(0,o.useEffect)((()=>{if(!(i<0)&&c)return s(),()=>l()}),[l,s,c,i]),{set:s,reset:a,clear:l}}function Te({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),i=W((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];k(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",i),()=>t.removeEventListener("keydown",i)}),[e,i]),r}const Ae={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function Ye(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)(Ae),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:i,clientY:c,pageX:s,pageY:l}=t;let a=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();a=i-t.left,u=c-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:i,clientY:c,pageX:s,pageY:l,elementRelativeX:a,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const Ve=()=>navigator.onLine,Xe=()=>!0,De=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function We({onlineAction:e=j,offlineAction:t=j}={}){const n=W((n=>De(n,e,t)));return(0,o.useSyncExternalStore)(n,Ve,Xe)}function _e(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const ze={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Be(e=j){const[t,n]=(0,o.useState)(ze),r=(0,o.useRef)(null),i=W((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(i);return t.observe(e),()=>{t.unobserve(e)}}),[i]),{ref:r,contentRect:t}}function Je({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),i=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>i())),[e,r,i]),{ref:t,lock:r,unlock:i}}const He=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,Ue=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:i=0,alignY:c="start",alignX:s="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+i+He(window.innerHeight,r.height,c),left:r.left+window.scrollX+o+He(window.innerWidth,r.width,s)};const l=e.getBoundingClientRect();return{top:r.top-l.top+e.scrollTop+i+He(l.height,r.height,c),left:r.left-l.left+e.scrollLeft+o+He(l.width,r.width,s)}};function Ke(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:i,top:c}=Ue(r,t,n);r.scrollTo({top:c,left:i,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ze=me("sessionStorage"),Qe=e=>window.sessionStorage.getItem(e),qe=e=>JSON.stringify(e),Ge=e=>(Ze.subscribe(e),()=>{Ze.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=k(n)?n():n,i=(0,o.useSyncExternalStore)(Ge,(()=>Qe(t)),(()=>qe(r)));return{state:(0,o.useMemo)((()=>i?I(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=Qe(t),o=n?I(n):r,i=k(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(i)),Ze.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ze.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:i}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[c,s]=(0,o.useState)(n),l=(0,o.useCallback)((e=>{s((t=>{const n=k(e)?e(t):e;return r&&i&&function(e,t,n){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=k(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,i,n),n}))}),[r,i]),a=(0,o.useCallback)((()=>{r&&i&&function(e,t){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,i),s(null)}),[r,i]);return Object.assign({state:c,setState:l,clearState:a},Ie(e))}function nt(e,t,n={}){const r=W(e),i=z(n),c=(0,o.useMemo)((()=>(0,s.A)(r,t,i)),[r,t,i]);return _((()=>c.cancel())),c}const rt=e=>{var t;return C(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=W(e),{delay:i,enabled:c}=rt(t),s=(0,o.useCallback)((()=>{n.current=setTimeout(r,i)}),[r,i]),l=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),s()}),[l,s]);return(0,o.useEffect)((()=>{if(!(i<0)&&c)return s(),()=>l()}),[s,l,i,c]),{set:s,reset:a,clear:l}}function it(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function ct(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new l.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function st({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const lt={width:null,height:null};function at({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>m()?lt:{width:window.innerWidth,height:window.innerHeight})),r=B(n,e),i=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",i),t}function ut(e,t,n){const{delay:r,enabled:i}=rt(t),{set:c,reset:s,clear:l}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!i||s()}),[r,i,s,...n]),{set:c,reset:s,clear:l}}}}]);
\ No newline at end of file
diff --git a/assets/js/42a77533.0d5c5bad.js b/assets/js/42a77533.0d5c5bad.js
deleted file mode 100644
index 6f9e13aca..000000000
--- a/assets/js/42a77533.0d5c5bad.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[9539],{7970:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>f,assets:()=>d,contentTitle:()=>u,default:()=>m,frontMatter:()=>a,metadata:()=>r,toc:()=>h});const r=JSON.parse('{"id":"react/hooks/useOutsidePointerDown","title":"useOutsidePointerDown","description":"\ud2b9\uc815 \uc694\uc18c \uc678\ubd80\uc5d0\uc11c \ub9c8\uc6b0\uc2a4 \ub610\ub294 \ud130\uce58 \uc774\ubca4\ud2b8\uac00 \ubc1c\uc0dd\ud560 \ub54c \ud638\ucd9c\ub418\ub294 \ucf5c\ubc31\uc744 \ub4f1\ub85d\ud558\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useOutsidePointerDown.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useOutsidePointerDown","permalink":"/modern-kit/docs/react/hooks/useOutsidePointerDown","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useNetwork","permalink":"/modern-kit/docs/react/hooks/useNetwork"},"next":{"title":"usePreferredColorScheme","permalink":"/modern-kit/docs/react/hooks/usePreferredColorScheme"}}');var o=n(6206),i=n(3267),s=n(4382),c=n(4027),l=n(9010);const a={},u="useOutsidePointerDown",d={},f=()=>{const e={br:"br",div:"div",h3:"h3",p:"p",...(0,i.R)()},[t,n]=(0,s.useState)(0),r=(0,s.useRef)(null),l=(0,c.WY)((()=>{n(t+1)}),{excludeRefs:[r]}),a=(0,s.useMemo)((()=>({width:"400px",background:"blue",color:"#fff"})),[]),u=(0,s.useMemo)((()=>({width:"400px",background:"#439966",color:"#fff",padding:"20px"})),[]),d=(0,s.useMemo)((()=>({width:"200px",background:"red",color:"#fff",padding:"20px"})),[]);return(0,o.jsxs)(e.div,{style:a,children:[(0,o.jsxs)(e.h3,{children:["Target Box \uc678\ubd80\ub97c \ud074\ub9ad\ud574\ubcf4\uc138\uc694!",(0,o.jsx)(e.br,{}),"(Exclude Box\ub294 \ud074\ub9ad \uac10\uc9c0\uc5d0 \uc81c\uc678\ub429\ub2c8\ub2e4.)"]}),(0,o.jsxs)(e.p,{children:["number: ",t]}),(0,o.jsx)(e.div,{ref:l,style:u,children:(0,o.jsx)(e.h3,{children:"Target Box"})}),(0,o.jsx)(e.div,{ref:r,style:d,children:(0,o.jsx)(e.h3,{children:"Exclude Box"})})]})},h=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Note",id:"note",level:2}];function p(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"useoutsidepointerdown",children:"useOutsidePointerDown"})}),"\n",(0,o.jsx)(t.p,{children:"\ud2b9\uc815 \uc694\uc18c \uc678\ubd80\uc5d0\uc11c \ub9c8\uc6b0\uc2a4 \ub610\ub294 \ud130\uce58 \uc774\ubca4\ud2b8\uac00 \ubc1c\uc0dd\ud560 \ub54c \ud638\ucd9c\ub418\ub294 \ucf5c\ubc31\uc744 \ub4f1\ub85d\ud558\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."}),"\n",(0,o.jsxs)(t.p,{children:["\uc9c0\uc815\ub41c \uc694\uc18c(",(0,o.jsx)(t.code,{children:"ref"}),"\ub85c \uc9c0\uc815\ub41c \uc694\uc18c) \uc678\ubd80\uc5d0\uc11c \uc0ac\uc6a9\uc790\uac00 \ub9c8\uc6b0\uc2a4\ub97c \ud074\ub9ad\ud558\uac70\ub098, \ud130\uce58 \uc774\ubca4\ud2b8\uac00 \ubc1c\uc0dd\ud560 \ub54c\ub9c8\ub2e4 \uc81c\uacf5\ub41c ",(0,o.jsx)(t.code,{children:"callback"})," \ud568\uc218\ub97c \ud638\ucd9c\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:["\ubaa8\ubc14\uc77c \ud658\uacbd\uc5d0\uc11c\ub294 ",(0,o.jsx)(t.code,{children:"touchstart"}),", \ub370\uc2a4\ud06c\ud0d1 \ud658\uacbd\uc5d0\uc11c\ub294 ",(0,o.jsx)(t.code,{children:"mousedown"})," \uc774\ubca4\ud2b8\ub97c \uac10\uc9c0\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useOutsidePointerDown/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"function useOutsidePointerDown(\n callback: (targetElement: T) => void,\n options?: {\n excludeRefs: React.RefObject[];\n }\n): React.RefObject;\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useMemo, useState } from 'react';\nimport { useOutsidePointerDown } from '@modern-kit/react';\n\nconst Example = () => {\n const [number, setNumber] = useState(0);\n\n const excludeRef = useRef(null);\n const targetRef = useOutsidePointerDown(() => {\n setNumber(number + 1);\n }, {\n excludeRefs: [excludeRef], // \uc678\ubd80 \ud074\ub9ad \ubc0f \ud130\uce58 \uac10\uc9c0\ub97c \uc81c\uc678\ud560 \uc694\uc18c\uc758 ref \ubc30\uc5f4\uc785\ub2c8\ub2e4.\n });\n \n const outerBoxStyle = useMemo(() => {\n return { /* ... */ };\n }, []);\n\n const InnerBoxStyle = useMemo(() => {\n return { /* ... */ };\n }, []);\n\n const ExcludeBoxStyle = useMemo(() => {\n return { /* ... */ };\n }, []);\n\n return (\n \n
Target Box \uc678\ubd80\ub97c \ud074\ub9ad\ud574\ubcf4\uc138\uc694!
(Exclude Box\ub294 \ud074\ub9ad \uac10\uc9c0\uc5d0 \uc81c\uc678\ub429\ub2c8\ub2e4.)
\n
number: {number}
\n\n
\n
Target Box
\n \n\n
\n
Exclude Box
\n \n
\n );\n};\n"})}),"\n","\n",(0,o.jsx)(l.A,{children:()=>(0,o.jsx)(f,{})}),"\n",(0,o.jsx)(t.h2,{id:"note",children:"Note"}),"\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsx)(t.li,{children:(0,o.jsx)(t.a,{href:"https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent",children:"PointerEvent"})}),"\n"]})]})}function m(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(p,{...e})}):p(e)}},9010:(e,t,n)=>{n.d(t,{A:()=>i});n(4382);var r=n(3555),o=n(6206);function i(e){let{children:t,fallback:n}=e;return(0,r.A)()?(0,o.jsx)(o.Fragment,{children:t?.()}):n??null}},4027:(e,t,n)=>{n.d(t,{$$:()=>Te,$I:()=>oe,AE:()=>Ve,BL:()=>J,DX:()=>M,FT:()=>ct,Fo:()=>et,Hn:()=>it,I5:()=>Ce,JF:()=>$e,K:()=>ae,K$:()=>He,M0:()=>Pe,ML:()=>ne,Mj:()=>ye,Mk:()=>Le,Mo:()=>ie,NT:()=>Be,QV:()=>Ke,Ub:()=>ke,Ut:()=>je,W7:()=>K,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>We,Zu:()=>le,_1:()=>Oe,_g:()=>nt,aL:()=>H,aY:()=>Me,bB:()=>Y,d7:()=>_,eG:()=>st,fN:()=>ce,fm:()=>G,gl:()=>T,hN:()=>X,iD:()=>de,iQ:()=>Ie,jd:()=>se,lW:()=>at,oD:()=>U,oo:()=>Re,pL:()=>q,qi:()=>ue,rN:()=>Ne,tD:()=>Se,u8:()=>Q,wY:()=>_e,xV:()=>I,xh:()=>tt,zy:()=>Z});var r=n(6206),o=n(4382),i=n(3683),s=n(5086),c=n(7197),l=(n(1604),n(5938));function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function m(){return typeof window>"u"}function w(){return!m()}function g(e){return f(this,0,void 0,(function*(){if(!w())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const b=e=>f(void 0,0,void 0,(function*(){return g(yield(yield fetch(e)).text())}));function v(e,t){var n;return f(this,0,void 0,(function*(){if(!w())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return b(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const i=yield p(e,h[t]);n(i)}catch(i){console.error(`Failed to load image. message: ${i.mesaage}`),r(i)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i=0;i{if(e===t||E(e)&&E(t)&&isNaN(e)&&isNaN(t))return!0;if(S(e)&&S(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return y(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!x(o,t.get(r),n))return!1;return!0}return y(e,t,n)};function k(e,t){return x(e,t,new WeakMap)}function S(e){return"function"==typeof e}function E(e){return"number"==typeof e}function j(e){return!function(e){return Object(e)!==e}(e)}function C(){}function R(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const O=(...e)=>t=>e.forEach((e=>{if(S(e))e(t);else if(null!=e){e.current=t}}));function P(...e){return(0,o.useCallback)(O(...e),e)}const M=o.forwardRef(((e,t)=>{const{children:n}=e,i=a(e,["children"]),s=o.Children.toArray(n),c=s.find(L);if(c){const e=c.props.children,n=s.map((t=>t===c?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(N,Object.assign({},i,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(N,Object.assign({},i,{ref:t,children:n}))}));M.displayName="Slot";const N=o.forwardRef(((e,t)=>{const{children:n}=e,r=a(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),i):"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?O(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));N.displayName="SlotClone";const I=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function L(e){return o.isValidElement(e)&&e.type===I}var F="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const T=d(((e,t)=>{var{ratio:n,style:o,as:s="div",asChild:c=!1}=e,l=a(e,["ratio","style","as","asChild"]);const u=c?M:s,d=Object.assign({aspectRatio:n},o),f=c?l.className:i(F,l.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},l))})),$=()=>C,D=()=>!1,B=()=>!0;function Y({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)($,D,B)?e:t}function A(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const X=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>A()?(0,r.jsx)(r.Fragment,{children:t}):e;function V(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function W(e){const t=V(e);(0,o.useEffect)((()=>()=>t()),[t])}function z(e,t=k){const[n,r]=(0,o.useState)(e),i=V(t);return(0,o.useEffect)((()=>{i(n,e)||r(e)}),[i,n,e]),n}function _(e,t,n){const r=V(e),i=z(n),c=(0,o.useMemo)((()=>(0,s.A)(r,t,i)),[r,t,i]);return W((()=>c.cancel())),c}const H=({children:e,capture:t,wait:n,options:r})=>{const i=o.Children.only(e),s=_(((...e)=>{const n=i?.props;if(n&&S(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(i,{[t]:s})};function J({onIntersectStart:e=C,onIntersectEnd:t=C,enabled:n=!0,calledOnce:r=!1,root:i=null,threshold:s=0,rootMargin:c="0px 0px 0px 0px"}){const l=(0,o.useRef)(0),a=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=V((([n],o)=>{if(!n)return;const i=n.target;n.isIntersecting?(a.current=!0,l.current+=1,e(n)):a.current&&(a.current=!1,l.current+=1,t(n)),r&&l.current>1&&o.unobserve(i)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:s,root:i,rootMargin:c}),u.current.observe(e))}),[n,s,i,c,d])}}const U=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:i,rootMargin:s}=e,c=a(e,["src","threshold","root","rootMargin"]);const{ref:l}=J({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:i,rootMargin:s});return(0,r.jsx)("img",Object.assign({ref:P(t,l)},c))}));U.displayName="LazyImage";const K=(0,o.forwardRef)(((e,t)=>{var{width:n,height:i,fallback:s,className:c,style:l,duration:u="0.2s",onLoad:d}=e,f=a(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,p]=(0,o.useState)(!1),m=!h,w=(0,o.useMemo)((()=>({position:"relative",width:n,height:i})),[n,i]),g=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:m?0:1,transition:`opacity ${u}`},l)),[m,u,l]),b=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),v=c?`lazy-image-wrapper ${c}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:v,style:w,children:[m&&s,(0,r.jsx)(U,Object.assign({ref:t,width:n,height:i,style:g,onLoad:b},f))]})}));K.displayName="FallbackLazyImage";const Z=({condition:e,trueComponent:t,falseComponent:n})=>{const i=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:i?t:n})},Q=({onScrollAction:e,children:t,root:n,threshold:o,enabled:i,triggerPosition:s="after",rootMargin:c="150px 0px"})=>{const{ref:l}=J({onIntersectStart:e,root:n,threshold:o,enabled:i,rootMargin:c});return(0,r.jsxs)(r.Fragment,{children:["before"===s&&(0,r.jsx)("div",{ref:l}),t,"after"===s&&(0,r.jsx)("div",{ref:l})]})},q=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1}=e,c=a(e,["children","as","asChild"]);const l=s?M:i,{ref:u}=J(c);if(s&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(l,Object.assign({ref:O(t,u)},c,{children:n}))})),G=({items:e=[],itemKey:t,renderItem:n})=>{const i=(0,o.useCallback)(((e,n)=>function(e){return j(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},i(e,t))))})},ee=w()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=V(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),i=(0,o.useMemo)((()=>function(){if(m())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,i,(({target:t})=>{if(!r.current)return;const o=r.current,i=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!i&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1,onPointerDown:c,excludeRefs:l=[]}=e,u=a(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(c,{excludeRefs:l}),f=s?M:i;if(s&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:O(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const ie=({itemKey:e,items:t=[],separator:n,renderItem:i,separatorInterval:s=1,includeLastSeparator:c=!1})=>{const l=(0,o.useCallback)((e=>e===t.length-1?c:(e+1)%s==0),[c,s,t.length]);return(0,r.jsx)(G,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[i(e,t),l(t)&&n]})})},se=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ce=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function le(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function ae(e=!0){const t=S(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!i.current){i.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{i.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),i=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield g(e);return t(n),!0}catch{return t(null),!1}}))),[]),s=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield v(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!w())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),l=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!w())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:i,copyImage:s,readText:c,readContents:l}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",pe={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},me=e=>pe[e],we=me("localStorage"),ge=e=>window.localStorage.getItem(e),be=e=>JSON.stringify(e),ve=e=>(we.subscribe(e),()=>{we.unsubscribe(e)});function ye(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=S(n)?n():n,i=(0,o.useSyncExternalStore)(ve,(()=>ge(t)),(()=>be(r)));return{state:(0,o.useMemo)((()=>i?R(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=ge(t),o=n?R(n):r,i=S(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(i)),we.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),we.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const xe=(e,t)=>w()?window.matchMedia(e).matches:t??!1;function ke(e,t){const[n,r]=(0,o.useState)(xe(e,t)),i=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",i),n}function Se(){return ke("(prefers-color-scheme: dark)")?"dark":"light"}const Ee="color-scheme";function je({defaultValue:e,key:t=Ee,shouldSetBodyClass:n=!1}={}){const r=Se(),i=S(e)?e():e,{state:s,setState:c}=ye({key:t,initialValue:i??r}),l=(0,o.useCallback)((()=>{c((e=>"dark"===e?"light":"dark"))}),[c]),a=(0,o.useCallback)((()=>{c("dark")}),[c]),u=(0,o.useCallback)((()=>{c("light")}),[c]),d=(0,o.useCallback)((()=>{c(r)}),[c,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(s),()=>{n&&document.body.classList.remove(s)})),[s,n]),{colorScheme:s,preferredColorScheme:r,setToggleMode:l,setDarkMode:a,setLightMode:u,setPreferredMode:d}}function Ce(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),i=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),s=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:i,reset:s}}function Re({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,i]=(0,o.useState)(t),s=r0,l=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),a=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const s=l(e,t);o&&o({prev:r,next:s}),i(s)}),[n,r,l]),u=(0,o.useCallback)((e=>{a("nextStep",!s,e)}),[s,a]),d=(0,o.useCallback)((e=>{a("prevStep",!c,e)}),[c,a]),f=(0,o.useCallback)(((t,n)=>{const o=S(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void i(t);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),i(t)}),[r,t]);return{currentStep:r,hasNextStep:s,hasPrevStep:c,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Oe(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:i,resetStep:s}=Re({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:i,resetIndex:s}}function Pe(e,t,n={}){const[r,i]=(0,o.useState)(e);return[r,_(i,t,n)]}function Me(e,t={}){const[n,r]=(0,o.useState)(""),[i,s]=Pe("",e,t);return{value:n,debouncedValue:i,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),s(t)}),[s]),onReset:(0,o.useCallback)((()=>{r(""),s("")}),[s])}}function Ne(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Ie({onFocus:e=C,onBlur:t=C}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=V((t=>{r(!0),e(t)})),c=V((e=>{r(!1),t(e)})),l=(0,o.useCallback)((()=>{i.current&&(i.current.focus(),r(!0))}),[]);return ne(i,"focus",s),ne(i,"blur",c),{ref:i,isFocus:n,setFocus:l}}function Le({onEnter:e=C,onLeave:t=C}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=V((t=>{r(!0),e(t)})),c=V((e=>{r(!1),t(e)}));return ne(i,"mouseenter",s),ne(i,"mouseleave",c),{ref:i,isHovered:n}}const Fe=e=>{var t;return E(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function Te(e,t){const n=(0,o.useRef)(),r=V(e),{delay:i,enabled:s}=Fe(t),c=(0,o.useCallback)((()=>{n.current=window.setInterval(r,i)}),[r,i]),l=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),c()}),[l,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>l()}),[l,c,s,i]),{set:c,reset:a,clear:l}}function $e({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),i=V((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];S(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",i),()=>t.removeEventListener("keydown",i)}),[e,i]),r}const De={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function Be(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)(De),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:l}=t;let a=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();a=i-t.left,u=s-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:l,elementRelativeX:a,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const Ye=()=>navigator.onLine,Ae=()=>!0,Xe=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function Ve({onlineAction:e=C,offlineAction:t=C}={}){const n=V((n=>Xe(n,e,t)));return(0,o.useSyncExternalStore)(n,Ye,Ae)}function We(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const ze={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function _e(e=C){const[t,n]=(0,o.useState)(ze),r=(0,o.useRef)(null),i=V((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(i);return t.observe(e),()=>{t.unobserve(e)}}),[i]),{ref:r,contentRect:t}}function He({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),i=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>i())),[e,r,i]),{ref:t,lock:r,unlock:i}}const Je=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,Ue=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:i=0,alignY:s="start",alignX:c="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+i+Je(window.innerHeight,r.height,s),left:r.left+window.scrollX+o+Je(window.innerWidth,r.width,c)};const l=e.getBoundingClientRect();return{top:r.top-l.top+e.scrollTop+i+Je(l.height,r.height,s),left:r.left-l.left+e.scrollLeft+o+Je(l.width,r.width,c)}};function Ke(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:i,top:s}=Ue(r,t,n);r.scrollTo({top:s,left:i,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ze=me("sessionStorage"),Qe=e=>window.sessionStorage.getItem(e),qe=e=>JSON.stringify(e),Ge=e=>(Ze.subscribe(e),()=>{Ze.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=S(n)?n():n,i=(0,o.useSyncExternalStore)(Ge,(()=>Qe(t)),(()=>qe(r)));return{state:(0,o.useMemo)((()=>i?R(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=Qe(t),o=n?R(n):r,i=S(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(i)),Ze.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ze.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:i}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[s,c]=(0,o.useState)(n),l=(0,o.useCallback)((e=>{c((t=>{const n=S(e)?e(t):e;return r&&i&&function(e,t,n){if(!w())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=S(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,i,n),n}))}),[r,i]),a=(0,o.useCallback)((()=>{r&&i&&function(e,t){if(!w())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,i),c(null)}),[r,i]);return Object.assign({state:s,setState:l,clearState:a},Re(e))}function nt(e,t,n={}){const r=V(e),i=z(n),s=(0,o.useMemo)((()=>(0,c.A)(r,t,i)),[r,t,i]);return W((()=>s.cancel())),s}const rt=e=>{var t;return E(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=V(e),{delay:i,enabled:s}=rt(t),c=(0,o.useCallback)((()=>{n.current=setTimeout(r,i)}),[r,i]),l=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),c()}),[l,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>l()}),[c,l,i,s]),{set:c,reset:a,clear:l}}function it(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function st(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new l.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function ct({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const lt={width:null,height:null};function at({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>m()?lt:{width:window.innerWidth,height:window.innerHeight})),r=_(n,e),i=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",i),t}function ut(e,t,n){const{delay:r,enabled:i}=rt(t),{set:s,reset:c,clear:l}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!i||c()}),[r,i,c,...n]),{set:s,reset:c,clear:l}}}}]);
\ No newline at end of file
diff --git a/assets/js/42a77533.4dc4c694.js b/assets/js/42a77533.4dc4c694.js
new file mode 100644
index 000000000..8ac4322a4
--- /dev/null
+++ b/assets/js/42a77533.4dc4c694.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[9539],{5589:(e,n,t)=>{t.r(n),t.d(n,{Example:()=>f,assets:()=>l,contentTitle:()=>a,default:()=>p,frontMatter:()=>d,metadata:()=>r,toc:()=>h});const r=JSON.parse('{"id":"react/hooks/useOutsidePointerDown","title":"useOutsidePointerDown","description":"\ud2b9\uc815 \uc694\uc18c \uc678\ubd80\uc5d0\uc11c \ub9c8\uc6b0\uc2a4 \ub610\ub294 \ud130\uce58 \uc774\ubca4\ud2b8\uac00 \ubc1c\uc0dd\ud560 \ub54c \ud638\ucd9c\ub418\ub294 \ucf5c\ubc31\uc744 \ub4f1\ub85d\ud558\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useOutsidePointerDown.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useOutsidePointerDown","permalink":"/modern-kit/docs/react/hooks/useOutsidePointerDown","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useNetwork","permalink":"/modern-kit/docs/react/hooks/useNetwork"},"next":{"title":"usePreferredColorScheme","permalink":"/modern-kit/docs/react/hooks/usePreferredColorScheme"}}');var o=t(6206),i=t(3267),c=t(4382),s=t(9115),u=t(9010);const d={},a="useOutsidePointerDown",l={},f=()=>{const e={br:"br",div:"div",h3:"h3",p:"p",...(0,i.R)()},[n,t]=(0,c.useState)(0),r=(0,c.useRef)(null),u=(0,s.W)((()=>{t(n+1)}),{excludeRefs:[r]}),d=(0,c.useMemo)((()=>({width:"400px",background:"blue",color:"#fff"})),[]),a=(0,c.useMemo)((()=>({width:"400px",background:"#439966",color:"#fff",padding:"20px"})),[]),l=(0,c.useMemo)((()=>({width:"200px",background:"red",color:"#fff",padding:"20px"})),[]);return(0,o.jsxs)(e.div,{style:d,children:[(0,o.jsxs)(e.h3,{children:["Target Box \uc678\ubd80\ub97c \ud074\ub9ad\ud574\ubcf4\uc138\uc694!",(0,o.jsx)(e.br,{}),"(Exclude Box\ub294 \ud074\ub9ad \uac10\uc9c0\uc5d0 \uc81c\uc678\ub429\ub2c8\ub2e4.)"]}),(0,o.jsxs)(e.p,{children:["number: ",n]}),(0,o.jsx)(e.div,{ref:u,style:a,children:(0,o.jsx)(e.h3,{children:"Target Box"})}),(0,o.jsx)(e.div,{ref:r,style:l,children:(0,o.jsx)(e.h3,{children:"Exclude Box"})})]})},h=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Note",id:"note",level:2}];function m(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.header,{children:(0,o.jsx)(n.h1,{id:"useoutsidepointerdown",children:"useOutsidePointerDown"})}),"\n",(0,o.jsx)(n.p,{children:"\ud2b9\uc815 \uc694\uc18c \uc678\ubd80\uc5d0\uc11c \ub9c8\uc6b0\uc2a4 \ub610\ub294 \ud130\uce58 \uc774\ubca4\ud2b8\uac00 \ubc1c\uc0dd\ud560 \ub54c \ud638\ucd9c\ub418\ub294 \ucf5c\ubc31\uc744 \ub4f1\ub85d\ud558\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."}),"\n",(0,o.jsxs)(n.p,{children:["\uc9c0\uc815\ub41c \uc694\uc18c(",(0,o.jsx)(n.code,{children:"ref"}),"\ub85c \uc9c0\uc815\ub41c \uc694\uc18c) \uc678\ubd80\uc5d0\uc11c \uc0ac\uc6a9\uc790\uac00 \ub9c8\uc6b0\uc2a4\ub97c \ud074\ub9ad\ud558\uac70\ub098, \ud130\uce58 \uc774\ubca4\ud2b8\uac00 \ubc1c\uc0dd\ud560 \ub54c\ub9c8\ub2e4 \uc81c\uacf5\ub41c ",(0,o.jsx)(n.code,{children:"callback"})," \ud568\uc218\ub97c \ud638\ucd9c\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(n.p,{children:["\ubaa8\ubc14\uc77c \ud658\uacbd\uc5d0\uc11c\ub294 ",(0,o.jsx)(n.code,{children:"touchstart"}),", \ub370\uc2a4\ud06c\ud0d1 \ud658\uacbd\uc5d0\uc11c\ub294 ",(0,o.jsx)(n.code,{children:"mousedown"})," \uc774\ubca4\ud2b8\ub97c \uac10\uc9c0\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(n.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useOutsidePointerDown/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(n.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"function useOutsidePointerDown(\n callback: (targetElement: T) => void,\n options?: {\n excludeRefs: React.RefObject[];\n }\n): React.RefObject;\n"})}),"\n",(0,o.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useMemo, useState } from 'react';\nimport { useOutsidePointerDown } from '@modern-kit/react';\n\nconst Example = () => {\n const [number, setNumber] = useState(0);\n\n const excludeRef = useRef(null);\n const targetRef = useOutsidePointerDown(() => {\n setNumber(number + 1);\n }, {\n excludeRefs: [excludeRef], // \uc678\ubd80 \ud074\ub9ad \ubc0f \ud130\uce58 \uac10\uc9c0\ub97c \uc81c\uc678\ud560 \uc694\uc18c\uc758 ref \ubc30\uc5f4\uc785\ub2c8\ub2e4.\n });\n \n const outerBoxStyle = useMemo(() => {\n return { /* ... */ };\n }, []);\n\n const InnerBoxStyle = useMemo(() => {\n return { /* ... */ };\n }, []);\n\n const ExcludeBoxStyle = useMemo(() => {\n return { /* ... */ };\n }, []);\n\n return (\n \n
Target Box \uc678\ubd80\ub97c \ud074\ub9ad\ud574\ubcf4\uc138\uc694!
(Exclude Box\ub294 \ud074\ub9ad \uac10\uc9c0\uc5d0 \uc81c\uc678\ub429\ub2c8\ub2e4.)
\n
number: {number}
\n\n
\n
Target Box
\n \n\n
\n
Exclude Box
\n \n
\n );\n};\n"})}),"\n","\n",(0,o.jsx)(u.A,{children:()=>(0,o.jsx)(f,{})}),"\n",(0,o.jsx)(n.h2,{id:"note",children:"Note"}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsx)(n.li,{children:(0,o.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent",children:"PointerEvent"})}),"\n"]})]})}function p(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(m,{...e})}):m(e)}},9010:(e,n,t)=>{t.d(n,{A:()=>i});t(4382);var r=t(3555),o=t(6206);function i(e){let{children:n,fallback:t}=e;return(0,r.A)()?(0,o.jsx)(o.Fragment,{children:n?.()}):t??null}},3267:(e,n,t)=>{t.d(n,{R:()=>c,x:()=>s});var r=t(4382);const o={},i=r.createContext(o);function c(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:c(e.components),r.createElement(i.Provider,{value:n},e.children)}},1351:(e,n,t)=>{t.d(n,{M:()=>s});var r=t(6765),o=t(5907),i=t(9340);t(4382);const c=e=>!!e&&(0,i.i5)(e,"current");function s(e,n,t,i){const s=(0,r.p)(t);(0,o.E)((()=>{const t=c(e)?e.current:e;if(t)return t.addEventListener(n,s,i),()=>{t.removeEventListener(n,s,i)}}),[n,e,i,s])}},5907:(e,n,t)=>{t.d(n,{E:()=>i});var r=t(9340),o=t(4382);const i=(0,r.oc)()?o.useLayoutEffect:o.useEffect},9115:(e,n,t)=>{t.d(n,{W:()=>c});var r=t(4382),o=t(9340),i=t(1351);function c(e,n){const{excludeRefs:t}=null!=n?n:{},c=(0,r.useRef)(null),s=(0,r.useMemo)((()=>(0,o.Fr)()?"touchstart":"mousedown"),[]);return(0,i.M)(document,s,(({target:n})=>{if(!c.current)return;const r=c.current,o=null==t?void 0:t.some((e=>{var t;return null===(t=e.current)||void 0===t?void 0:t.contains(n)}));!r.contains(n)&&!o&&e(r)})),c}},6765:(e,n,t)=>{t.d(n,{p:()=>o});var r=t(4382);function o(e){const n=(0,r.useRef)(e);return n.current=e,(0,r.useCallback)(((...e)=>n.current(...e)),[])}},9340:(e,n,t)=>{function r(e,n,t,r){return new(t||(t=Promise))((function(o,i){function c(e){try{u(r.next(e))}catch(n){i(n)}}function s(e){try{u(r.throw(e))}catch(n){i(n)}}function u(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(c,s)}u((r=r.apply(e,n||[])).next())}))}t.d(n,{Et:()=>b,Fr:()=>s,Gp:()=>w,Ol:()=>O,Qd:()=>j,S$:()=>c,Tn:()=>g,Zp:()=>f,dK:()=>d,fl:()=>C,gD:()=>v,i5:()=>m,if:()=>h,l6:()=>E,lQ:()=>k,nS:()=>l,ni:()=>M,oc:()=>u}),"function"==typeof SuppressedError&&SuppressedError;const o={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};const i=(e,n)=>new Promise(((t,r)=>{e.toBlob((e=>{e?t(e):r(new Error(`Failed to create blob with format ${n}`))}),n)}));function c(){return"undefined"==typeof window}function s(){if(c())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}function u(){return!c()}function d(e){return r(this,void 0,void 0,(function*(){if(!u())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const n=document.createElement("textarea");n.value=e,n.style.opacity="0",document.body.appendChild(n),n.focus(),n.select();try{return document.execCommand("copy"),e}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}finally{document.body.removeChild(n)}}(e)}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}}))}const a=e=>r(void 0,void 0,void 0,(function*(){const n=yield fetch(e);return d(yield n.text())}));function l(e,n){var t;return r(this,void 0,void 0,(function*(){if(!u())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator))return a(e);if(!("write"in window.navigator.clipboard))return a(e);if(null!==(t=null==n?void 0:n.toText)&&void 0!==t&&t)return a(e);const c=yield function(e,n="png"){return new Promise(((t,c)=>{const s=new Image;s.onload=()=>r(this,void 0,void 0,(function*(){const e=document.createElement("canvas");e.width=s.width,e.height=s.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(s,0,0);const c=yield i(e,o[n]);t(c)}catch(r){console.error(`Failed to load image. message: ${r.mesaage}`),c(r)}})),s.onerror=()=>{c(new Error("Failed to load image"))},s.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[c.type]:c})]),c}catch(c){throw console.error(`Failed to copy to clipboard. message: ${c.message}`),c}}))}function f(){return r(this,void 0,void 0,(function*(){if(!u())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function h(){return r(this,void 0,void 0,(function*(){if(!u())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function m(e,n){return Object.prototype.hasOwnProperty.call(e,n)}const p=(e,n,t)=>{const r=Object.keys(e),o=Object.keys(n);if(r.length!==o.length)return!1;for(let i=0;i{if(e===n)return!0;if(b(e)&&b(n)&&isNaN(e)&&isNaN(n))return!0;if(g(e)&&g(n))return e.toString()===n.toString();if("object"!=typeof e||"object"!=typeof n||null===e||null===n)return!1;if(t.has(e)&&t.get(e)===n)return!0;if(t.set(e,n),e.constructor!==n.constructor)return!1;if(e instanceof Set){if(e.size!==n.size)return!1;const r=[...e],o=[...n];return p(r,o,t)}if(e instanceof Map){if(e.size!==n.size)return!1;for(const[r,o]of e)if(!n.has(r)||!x(o,n.get(r),t))return!1;return!0}return p(e,n,t)};function w(e,n){return x(e,n,new WeakMap)}function g(e){return"function"==typeof e}function v(e){return null==e}function b(e){return"number"==typeof e}function y(e){return!function(e){return Object(e)!==e}(e)}function j(e){return y(e)&&"[object Object]"===Object.prototype.toString.call(e)}function E(e){return e===window}function k(){}function O(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(n){throw new Error(`Failed to parse data: ${n}`)}}function P(e){return Object.keys(e)}const S={days:864e5,hours:36e5,minutes:6e4,seconds:1e3};P(S);function C(e,n){if(!u())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(n)}catch(t){throw new Error(`Failed to remove key "${n}" from ${e}: ${t}`)}}function M(e,n,t){if(!u())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=g(t)?t():t;r.setItem(n,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${n}" in ${e}: ${r}`)}}}}]);
\ No newline at end of file
diff --git a/assets/js/54102c04.35ce4b40.js b/assets/js/54102c04.35ce4b40.js
deleted file mode 100644
index 9f94a0291..000000000
--- a/assets/js/54102c04.35ce4b40.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[5170],{98:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>u,assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>c,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"react/components/LazyImage","title":"LazyImage","description":"@modern-kit/react/useIntersectionObserver \ub97c \ud65c\uc6a9\ud574 \uc774\ubbf8\uc9c0\uac00 viewport\uc5d0 \ub178\ucd9c\ub420 \ub54c \ud560\ub2f9\ub41c \uc774\ubbf8\uc9c0\ub97c Lazy Loading(\uc9c0\uc5f0 \ub85c\ub529) \ud558\ub294 \uc774\ubbf8\uc9c0 \ucef4\ud3ec\ub10c\ud2b8\uc785\ub2c8\ub2e4.","source":"@site/docs/react/components/LazyImage.mdx","sourceDirName":"react/components","slug":"/react/components/LazyImage","permalink":"/modern-kit/docs/react/components/LazyImage","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"Iterator","permalink":"/modern-kit/docs/react/components/Iterator"},"next":{"title":"Mounted","permalink":"/modern-kit/docs/react/components/Mounted"}}');var o=n(6206),i=n(3267),s=n(4027);const c={},a="LazyImage",l={},u=()=>{const e={div:"div",...(0,i.R)()};return(0,o.jsxs)(e.div,{style:{background:"#f8f8f8",width:"500px"},children:[(0,o.jsx)(e.div,{style:{height:"500px",textAlign:"center",fontSize:"2rem"},children:"\uc2a4\ud06c\ub864 \ud574\uc8fc\uc138\uc694."}),(0,o.jsx)(s.oD,{src:"https://github.com/Team-Grace/devgrace/assets/64779472/b5640bec-2abc-4205-afbf-ccfd9876a90b",alt:"img1",width:500,height:500}),(0,o.jsx)(e.div,{style:{width:"100%",height:"150px"}}),(0,o.jsx)(s.oD,{src:"https://github.com/Team-Grace/devgrace/assets/64779472/207743a7-b29f-4826-bc08-8df0d67e568b",alt:"img2",width:500,height:500}),(0,o.jsx)(e.div,{style:{width:"100%",height:"150px"}}),(0,o.jsx)(s.oD,{src:"https://github.com/Team-Grace/devgrace/assets/64779472/d1957ec8-fe87-406e-bfda-fb4ee505b152",alt:"img3",width:500,height:500})]})},d=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2},{value:"Note",id:"note",level:2}];function f(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"lazyimage",children:"LazyImage"})}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.strong,{children:(0,o.jsx)(t.a,{href:"https://modern-agile-team.github.io/modern-kit/docs/react/hooks/useIntersectionObserver",children:"@modern-kit/react/useIntersectionObserver"})})," \ub97c \ud65c\uc6a9\ud574 \uc774\ubbf8\uc9c0\uac00 ",(0,o.jsx)(t.code,{children:"viewport"}),"\uc5d0 \ub178\ucd9c\ub420 \ub54c \ud560\ub2f9\ub41c \uc774\ubbf8\uc9c0\ub97c ",(0,o.jsx)(t.code,{children:"Lazy Loading(\uc9c0\uc5f0 \ub85c\ub529)"})," \ud558\ub294 \uc774\ubbf8\uc9c0 \ucef4\ud3ec\ub10c\ud2b8\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:["Intersection Observer Option\uc744 \uc124\uc815\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.(\ud558\ub2e8 ",(0,o.jsx)(t.code,{children:"Note"})," \ucc38\uace0)"]}),"\n",(0,o.jsxs)(t.p,{children:["\ub9cc\uc57d, \uc774\ubbf8\uc9c0 ",(0,o.jsx)(t.code,{children:"load"})," \uc911\uc5d0 ",(0,o.jsx)(t.code,{children:"\ud2b9\uc815 Fallback \ucef4\ud3ec\ub10c\ud2b8"}),"\ub97c \ub178\ucd9c\ud558\uace0 \uc2f6\ub2e4\uba74, \uc774\ub97c \uc120\uc5b8\uc801\uc73c\ub85c \ud65c\uc6a9\ud558\uae30 \uc704\ud574 ",(0,o.jsx)(t.code,{children:"LazyImage\ub97c \ud655\uc7a5"}),"\ud574\uc11c \ub9cc\ub4e0 ",(0,o.jsx)(t.strong,{children:(0,o.jsx)(t.a,{href:"https://modern-agile-team.github.io/modern-kit/docs/react/components/FallbackLazyImage",children:"FallbackLazyImage \ucef4\ud3ec\ub10c\ud2b8"})})," \uac00 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/components/LazyImage/index.tsx",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"interface IntersectionObserverInit {\n root?: Element | Document | null;\n rootMargin?: string;\n threshold?: number | number[];\n}\n"})}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"interface LazyImageProps\n extends React.ComponentProps<'img'>,\n IntersectionObserverInit {\n src: string;\n}\n\nconst LazyImage: React.ForwardRefExoticComponent<\n Omit & React.RefAttributes\n>;\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { LazyImage } from '@modern-kit/react';\nimport img1 from '../assets/img1.png';\nimport img2 from '../assets/img2.png';\n\nconst Example = () => {\n return (\n \n {/* ... */}\n \n {/* ... */}\n \n {/* ... */}\n
\n );\n}; \n"})}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(u,{}),"\n",(0,o.jsx)(t.h2,{id:"note",children:"Note"}),"\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsx)(t.li,{children:(0,o.jsx)(t.a,{href:"https://developer.mozilla.org/ko/docs/Web/API/IntersectionObserver",children:"Intersection Observer API"})}),"\n"]})]})}function h(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(f,{...e})}):f(e)}},4027:(e,t,n)=>{n.d(t,{$$:()=>Pe,$I:()=>oe,AE:()=>Ve,BL:()=>J,DX:()=>L,FT:()=>ct,Fo:()=>et,Hn:()=>it,I5:()=>Ee,JF:()=>$e,K:()=>le,K$:()=>He,M0:()=>Re,ML:()=>ne,Mj:()=>ye,Mk:()=>Me,Mo:()=>ie,NT:()=>Ye,QV:()=>Ue,Ub:()=>ke,Ut:()=>Ce,W7:()=>U,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>We,Zu:()=>ae,_1:()=>Oe,_g:()=>nt,aL:()=>H,aY:()=>Le,bB:()=>A,d7:()=>B,eG:()=>st,fN:()=>ce,fm:()=>q,gl:()=>P,hN:()=>X,iD:()=>de,iQ:()=>Ne,jd:()=>se,lW:()=>lt,oD:()=>K,oo:()=>Ie,pL:()=>Q,qi:()=>ue,rN:()=>Fe,tD:()=>je,u8:()=>Z,wY:()=>Be,xV:()=>N,xh:()=>tt,zy:()=>G});var r=n(6206),o=n(4382),i=n(3683),s=n(5086),c=n(7197),a=(n(1604),n(5938));function l(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function p(){return typeof window>"u"}function g(){return!p()}function b(e){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const w=e=>f(void 0,0,void 0,(function*(){return b(yield(yield fetch(e)).text())}));function v(e,t){var n;return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return w(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const i=yield m(e,h[t]);n(i)}catch(i){console.error(`Failed to load image. message: ${i.mesaage}`),r(i)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i=0;i{if(e===t||S(e)&&S(t)&&isNaN(e)&&isNaN(t))return!0;if(j(e)&&j(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return y(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!x(o,t.get(r),n))return!1;return!0}return y(e,t,n)};function k(e,t){return x(e,t,new WeakMap)}function j(e){return"function"==typeof e}function S(e){return"number"==typeof e}function C(e){return!function(e){return Object(e)!==e}(e)}function E(){}function I(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const O=(...e)=>t=>e.forEach((e=>{if(j(e))e(t);else if(null!=e){e.current=t}}));function R(...e){return(0,o.useCallback)(O(...e),e)}const L=o.forwardRef(((e,t)=>{const{children:n}=e,i=l(e,["children"]),s=o.Children.toArray(n),c=s.find(M);if(c){const e=c.props.children,n=s.map((t=>t===c?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(F,Object.assign({},i,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(F,Object.assign({},i,{ref:t,children:n}))}));L.displayName="Slot";const F=o.forwardRef(((e,t)=>{const{children:n}=e,r=l(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),i):"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?O(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));F.displayName="SlotClone";const N=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function M(e){return o.isValidElement(e)&&e.type===N}var z="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const P=d(((e,t)=>{var{ratio:n,style:o,as:s="div",asChild:c=!1}=e,a=l(e,["ratio","style","as","asChild"]);const u=c?L:s,d=Object.assign({aspectRatio:n},o),f=c?a.className:i(z,a.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},a))})),$=()=>E,T=()=>!1,Y=()=>!0;function A({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)($,T,Y)?e:t}function D(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const X=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>D()?(0,r.jsx)(r.Fragment,{children:t}):e;function V(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function W(e){const t=V(e);(0,o.useEffect)((()=>()=>t()),[t])}function _(e,t=k){const[n,r]=(0,o.useState)(e),i=V(t);return(0,o.useEffect)((()=>{i(n,e)||r(e)}),[i,n,e]),n}function B(e,t,n){const r=V(e),i=_(n),c=(0,o.useMemo)((()=>(0,s.A)(r,t,i)),[r,t,i]);return W((()=>c.cancel())),c}const H=({children:e,capture:t,wait:n,options:r})=>{const i=o.Children.only(e),s=B(((...e)=>{const n=i?.props;if(n&&j(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(i,{[t]:s})};function J({onIntersectStart:e=E,onIntersectEnd:t=E,enabled:n=!0,calledOnce:r=!1,root:i=null,threshold:s=0,rootMargin:c="0px 0px 0px 0px"}){const a=(0,o.useRef)(0),l=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=V((([n],o)=>{if(!n)return;const i=n.target;n.isIntersecting?(l.current=!0,a.current+=1,e(n)):l.current&&(l.current=!1,a.current+=1,t(n)),r&&a.current>1&&o.unobserve(i)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:s,root:i,rootMargin:c}),u.current.observe(e))}),[n,s,i,c,d])}}const K=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:i,rootMargin:s}=e,c=l(e,["src","threshold","root","rootMargin"]);const{ref:a}=J({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:i,rootMargin:s});return(0,r.jsx)("img",Object.assign({ref:R(t,a)},c))}));K.displayName="LazyImage";const U=(0,o.forwardRef)(((e,t)=>{var{width:n,height:i,fallback:s,className:c,style:a,duration:u="0.2s",onLoad:d}=e,f=l(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,m]=(0,o.useState)(!1),p=!h,g=(0,o.useMemo)((()=>({position:"relative",width:n,height:i})),[n,i]),b=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:p?0:1,transition:`opacity ${u}`},a)),[p,u,a]),w=(0,o.useCallback)((e=>{d&&d(e),m(!0)}),[d]),v=c?`lazy-image-wrapper ${c}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:v,style:g,children:[p&&s,(0,r.jsx)(K,Object.assign({ref:t,width:n,height:i,style:b,onLoad:w},f))]})}));U.displayName="FallbackLazyImage";const G=({condition:e,trueComponent:t,falseComponent:n})=>{const i=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:i?t:n})},Z=({onScrollAction:e,children:t,root:n,threshold:o,enabled:i,triggerPosition:s="after",rootMargin:c="150px 0px"})=>{const{ref:a}=J({onIntersectStart:e,root:n,threshold:o,enabled:i,rootMargin:c});return(0,r.jsxs)(r.Fragment,{children:["before"===s&&(0,r.jsx)("div",{ref:a}),t,"after"===s&&(0,r.jsx)("div",{ref:a})]})},Q=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1}=e,c=l(e,["children","as","asChild"]);const a=s?L:i,{ref:u}=J(c);if(s&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(a,Object.assign({ref:O(t,u)},c,{children:n}))})),q=({items:e=[],itemKey:t,renderItem:n})=>{const i=(0,o.useCallback)(((e,n)=>function(e){return C(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},i(e,t))))})},ee=g()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=V(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),i=(0,o.useMemo)((()=>function(){if(p())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,i,(({target:t})=>{if(!r.current)return;const o=r.current,i=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!i&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1,onPointerDown:c,excludeRefs:a=[]}=e,u=l(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(c,{excludeRefs:a}),f=s?L:i;if(s&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:O(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const ie=({itemKey:e,items:t=[],separator:n,renderItem:i,separatorInterval:s=1,includeLastSeparator:c=!1})=>{const a=(0,o.useCallback)((e=>e===t.length-1?c:(e+1)%s==0),[c,s,t.length]);return(0,r.jsx)(q,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[i(e,t),a(t)&&n]})})},se=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ce=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function ae(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function le(e=!0){const t=j(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!i.current){i.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{i.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),i=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield b(e);return t(n),!0}catch{return t(null),!1}}))),[]),s=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield v(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),a=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:i,copyImage:s,readText:c,readContents:a}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",me={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},pe=e=>me[e],ge=pe("localStorage"),be=e=>window.localStorage.getItem(e),we=e=>JSON.stringify(e),ve=e=>(ge.subscribe(e),()=>{ge.unsubscribe(e)});function ye(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=j(n)?n():n,i=(0,o.useSyncExternalStore)(ve,(()=>be(t)),(()=>we(r)));return{state:(0,o.useMemo)((()=>i?I(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=be(t),o=n?I(n):r,i=j(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(i)),ge.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),ge.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const xe=(e,t)=>g()?window.matchMedia(e).matches:t??!1;function ke(e,t){const[n,r]=(0,o.useState)(xe(e,t)),i=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",i),n}function je(){return ke("(prefers-color-scheme: dark)")?"dark":"light"}const Se="color-scheme";function Ce({defaultValue:e,key:t=Se,shouldSetBodyClass:n=!1}={}){const r=je(),i=j(e)?e():e,{state:s,setState:c}=ye({key:t,initialValue:i??r}),a=(0,o.useCallback)((()=>{c((e=>"dark"===e?"light":"dark"))}),[c]),l=(0,o.useCallback)((()=>{c("dark")}),[c]),u=(0,o.useCallback)((()=>{c("light")}),[c]),d=(0,o.useCallback)((()=>{c(r)}),[c,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(s),()=>{n&&document.body.classList.remove(s)})),[s,n]),{colorScheme:s,preferredColorScheme:r,setToggleMode:a,setDarkMode:l,setLightMode:u,setPreferredMode:d}}function Ee(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),i=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),s=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:i,reset:s}}function Ie({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,i]=(0,o.useState)(t),s=r0,a=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),l=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const s=a(e,t);o&&o({prev:r,next:s}),i(s)}),[n,r,a]),u=(0,o.useCallback)((e=>{l("nextStep",!s,e)}),[s,l]),d=(0,o.useCallback)((e=>{l("prevStep",!c,e)}),[c,l]),f=(0,o.useCallback)(((t,n)=>{const o=j(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void i(t);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),i(t)}),[r,t]);return{currentStep:r,hasNextStep:s,hasPrevStep:c,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Oe(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:i,resetStep:s}=Ie({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:i,resetIndex:s}}function Re(e,t,n={}){const[r,i]=(0,o.useState)(e);return[r,B(i,t,n)]}function Le(e,t={}){const[n,r]=(0,o.useState)(""),[i,s]=Re("",e,t);return{value:n,debouncedValue:i,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),s(t)}),[s]),onReset:(0,o.useCallback)((()=>{r(""),s("")}),[s])}}function Fe(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Ne({onFocus:e=E,onBlur:t=E}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=V((t=>{r(!0),e(t)})),c=V((e=>{r(!1),t(e)})),a=(0,o.useCallback)((()=>{i.current&&(i.current.focus(),r(!0))}),[]);return ne(i,"focus",s),ne(i,"blur",c),{ref:i,isFocus:n,setFocus:a}}function Me({onEnter:e=E,onLeave:t=E}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=V((t=>{r(!0),e(t)})),c=V((e=>{r(!1),t(e)}));return ne(i,"mouseenter",s),ne(i,"mouseleave",c),{ref:i,isHovered:n}}const ze=e=>{var t;return S(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function Pe(e,t){const n=(0,o.useRef)(),r=V(e),{delay:i,enabled:s}=ze(t),c=(0,o.useCallback)((()=>{n.current=window.setInterval(r,i)}),[r,i]),a=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{a(),c()}),[a,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>a()}),[a,c,s,i]),{set:c,reset:l,clear:a}}function $e({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),i=V((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];j(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",i),()=>t.removeEventListener("keydown",i)}),[e,i]),r}const Te={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function Ye(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)(Te),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:a}=t;let l=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();l=i-t.left,u=s-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:a,elementRelativeX:l,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const Ae=()=>navigator.onLine,De=()=>!0,Xe=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function Ve({onlineAction:e=E,offlineAction:t=E}={}){const n=V((n=>Xe(n,e,t)));return(0,o.useSyncExternalStore)(n,Ae,De)}function We(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const _e={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Be(e=E){const[t,n]=(0,o.useState)(_e),r=(0,o.useRef)(null),i=V((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(i);return t.observe(e),()=>{t.unobserve(e)}}),[i]),{ref:r,contentRect:t}}function He({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),i=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>i())),[e,r,i]),{ref:t,lock:r,unlock:i}}const Je=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,Ke=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:i=0,alignY:s="start",alignX:c="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+i+Je(window.innerHeight,r.height,s),left:r.left+window.scrollX+o+Je(window.innerWidth,r.width,c)};const a=e.getBoundingClientRect();return{top:r.top-a.top+e.scrollTop+i+Je(a.height,r.height,s),left:r.left-a.left+e.scrollLeft+o+Je(a.width,r.width,c)}};function Ue(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:i,top:s}=Ke(r,t,n);r.scrollTo({top:s,left:i,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ge=pe("sessionStorage"),Ze=e=>window.sessionStorage.getItem(e),Qe=e=>JSON.stringify(e),qe=e=>(Ge.subscribe(e),()=>{Ge.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=j(n)?n():n,i=(0,o.useSyncExternalStore)(qe,(()=>Ze(t)),(()=>Qe(r)));return{state:(0,o.useMemo)((()=>i?I(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=Ze(t),o=n?I(n):r,i=j(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(i)),Ge.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ge.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:i}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[s,c]=(0,o.useState)(n),a=(0,o.useCallback)((e=>{c((t=>{const n=j(e)?e(t):e;return r&&i&&function(e,t,n){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=j(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,i,n),n}))}),[r,i]),l=(0,o.useCallback)((()=>{r&&i&&function(e,t){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,i),c(null)}),[r,i]);return Object.assign({state:s,setState:a,clearState:l},Ie(e))}function nt(e,t,n={}){const r=V(e),i=_(n),s=(0,o.useMemo)((()=>(0,c.A)(r,t,i)),[r,t,i]);return W((()=>s.cancel())),s}const rt=e=>{var t;return S(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=V(e),{delay:i,enabled:s}=rt(t),c=(0,o.useCallback)((()=>{n.current=setTimeout(r,i)}),[r,i]),a=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{a(),c()}),[a,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>a()}),[c,a,i,s]),{set:c,reset:l,clear:a}}function it(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function st(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new a.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function ct({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const at={width:null,height:null};function lt({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>p()?at:{width:window.innerWidth,height:window.innerHeight})),r=B(n,e),i=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",i),t}function ut(e,t,n){const{delay:r,enabled:i}=rt(t),{set:s,reset:c,clear:a}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!i||c()}),[r,i,c,...n]),{set:s,reset:c,clear:a}}}}]);
\ No newline at end of file
diff --git a/assets/js/54102c04.d0fd9f95.js b/assets/js/54102c04.d0fd9f95.js
new file mode 100644
index 000000000..f93446dd7
--- /dev/null
+++ b/assets/js/54102c04.d0fd9f95.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[5170],{98:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>l,assets:()=>d,contentTitle:()=>s,default:()=>f,frontMatter:()=>a,metadata:()=>r,toc:()=>u});const r=JSON.parse('{"id":"react/components/LazyImage","title":"LazyImage","description":"@modern-kit/react/useIntersectionObserver \ub97c \ud65c\uc6a9\ud574 \uc774\ubbf8\uc9c0\uac00 viewport\uc5d0 \ub178\ucd9c\ub420 \ub54c \ud560\ub2f9\ub41c \uc774\ubbf8\uc9c0\ub97c Lazy Loading(\uc9c0\uc5f0 \ub85c\ub529) \ud558\ub294 \uc774\ubbf8\uc9c0 \ucef4\ud3ec\ub10c\ud2b8\uc785\ub2c8\ub2e4.","source":"@site/docs/react/components/LazyImage.mdx","sourceDirName":"react/components","slug":"/react/components/LazyImage","permalink":"/modern-kit/docs/react/components/LazyImage","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"Iterator","permalink":"/modern-kit/docs/react/components/Iterator"},"next":{"title":"Mounted","permalink":"/modern-kit/docs/react/components/Mounted"}}');var o=n(6206),i=n(3267),c=n(7261);const a={},s="LazyImage",d={},l=()=>{const e={div:"div",...(0,i.R)()};return(0,o.jsxs)(e.div,{style:{background:"#f8f8f8",width:"500px"},children:[(0,o.jsx)(e.div,{style:{height:"500px",textAlign:"center",fontSize:"2rem"},children:"\uc2a4\ud06c\ub864 \ud574\uc8fc\uc138\uc694."}),(0,o.jsx)(c.o,{src:"https://github.com/Team-Grace/devgrace/assets/64779472/b5640bec-2abc-4205-afbf-ccfd9876a90b",alt:"img1",width:500,height:500}),(0,o.jsx)(e.div,{style:{width:"100%",height:"150px"}}),(0,o.jsx)(c.o,{src:"https://github.com/Team-Grace/devgrace/assets/64779472/207743a7-b29f-4826-bc08-8df0d67e568b",alt:"img2",width:500,height:500}),(0,o.jsx)(e.div,{style:{width:"100%",height:"150px"}}),(0,o.jsx)(c.o,{src:"https://github.com/Team-Grace/devgrace/assets/64779472/d1957ec8-fe87-406e-bfda-fb4ee505b152",alt:"img3",width:500,height:500})]})},u=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2},{value:"Note",id:"note",level:2}];function h(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"lazyimage",children:"LazyImage"})}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.strong,{children:(0,o.jsx)(t.a,{href:"https://modern-agile-team.github.io/modern-kit/docs/react/hooks/useIntersectionObserver",children:"@modern-kit/react/useIntersectionObserver"})})," \ub97c \ud65c\uc6a9\ud574 \uc774\ubbf8\uc9c0\uac00 ",(0,o.jsx)(t.code,{children:"viewport"}),"\uc5d0 \ub178\ucd9c\ub420 \ub54c \ud560\ub2f9\ub41c \uc774\ubbf8\uc9c0\ub97c ",(0,o.jsx)(t.code,{children:"Lazy Loading(\uc9c0\uc5f0 \ub85c\ub529)"})," \ud558\ub294 \uc774\ubbf8\uc9c0 \ucef4\ud3ec\ub10c\ud2b8\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:["Intersection Observer Option\uc744 \uc124\uc815\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.(\ud558\ub2e8 ",(0,o.jsx)(t.code,{children:"Note"})," \ucc38\uace0)"]}),"\n",(0,o.jsxs)(t.p,{children:["\ub9cc\uc57d, \uc774\ubbf8\uc9c0 ",(0,o.jsx)(t.code,{children:"load"})," \uc911\uc5d0 ",(0,o.jsx)(t.code,{children:"\ud2b9\uc815 Fallback \ucef4\ud3ec\ub10c\ud2b8"}),"\ub97c \ub178\ucd9c\ud558\uace0 \uc2f6\ub2e4\uba74, \uc774\ub97c \uc120\uc5b8\uc801\uc73c\ub85c \ud65c\uc6a9\ud558\uae30 \uc704\ud574 ",(0,o.jsx)(t.code,{children:"LazyImage\ub97c \ud655\uc7a5"}),"\ud574\uc11c \ub9cc\ub4e0 ",(0,o.jsx)(t.strong,{children:(0,o.jsx)(t.a,{href:"https://modern-agile-team.github.io/modern-kit/docs/react/components/FallbackLazyImage",children:"FallbackLazyImage \ucef4\ud3ec\ub10c\ud2b8"})})," \uac00 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/components/LazyImage/index.tsx",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"interface IntersectionObserverInit {\n root?: Element | Document | null;\n rootMargin?: string;\n threshold?: number | number[];\n}\n"})}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"interface LazyImageProps\n extends React.ComponentProps<'img'>,\n IntersectionObserverInit {\n src: string;\n}\n\nconst LazyImage: React.ForwardRefExoticComponent<\n Omit & React.RefAttributes\n>;\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { LazyImage } from '@modern-kit/react';\nimport img1 from '../assets/img1.png';\nimport img2 from '../assets/img2.png';\n\nconst Example = () => {\n return (\n \n {/* ... */}\n \n {/* ... */}\n \n {/* ... */}\n
\n );\n}; \n"})}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(l,{}),"\n",(0,o.jsx)(t.h2,{id:"note",children:"Note"}),"\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsx)(t.li,{children:(0,o.jsx)(t.a,{href:"https://developer.mozilla.org/ko/docs/Web/API/IntersectionObserver",children:"Intersection Observer API"})}),"\n"]})]})}function f(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(h,{...e})}):h(e)}},4076:(e,t,n)=>{function r(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);or,a:()=>o}),"function"==typeof SuppressedError&&SuppressedError},3267:(e,t,n)=>{n.d(t,{R:()=>c,x:()=>a});var r=n(4382);const o={},i=r.createContext(o);function c(e){const t=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:c(e.components),r.createElement(i.Provider,{value:t},e.children)}},7261:(e,t,n)=>{n.d(t,{o:()=>d});var r=n(4076),o=n(6206),i=n(4382),c=n(7399),a=n(2424);function s(...e){return(0,i.useCallback)((0,a.P)(...e),e)}const d=(0,i.forwardRef)(((e,t)=>{var{src:n,threshold:i,root:a,rootMargin:d}=e,l=(0,r._)(e,["src","threshold","root","rootMargin"]);const{ref:u}=(0,c.B)({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:i,root:a,rootMargin:d});return(0,o.jsx)("img",Object.assign({ref:s(t,u)},l))}));d.displayName="LazyImage"},7399:(e,t,n)=>{n.d(t,{B:()=>c});var r=n(4382),o=n(6765),i=n(9340);function c({onIntersectStart:e=i.lQ,onIntersectEnd:t=i.lQ,enabled:n=!0,calledOnce:c=!1,root:a=null,threshold:s=0,rootMargin:d="0px 0px 0px 0px"}){const l=(0,r.useRef)(0),u=(0,r.useRef)(!1),h=(0,r.useRef)(null),f=(0,o.p)((([n],r)=>{if(!n)return;const o=n.target;n.isIntersecting?(u.current=!0,l.current+=1,e(n)):u.current&&(u.current=!1,l.current+=1,t(n)),c&&l.current>1&&r.unobserve(o)}));return{ref:(0,r.useCallback)((e=>{h.current&&(h.current.disconnect(),h.current=null),null!==e&&n&&(h.current=new IntersectionObserver(f,{threshold:s,root:a,rootMargin:d}),h.current.observe(e))}),[n,s,a,d,f])}}},6765:(e,t,n)=>{n.d(t,{p:()=>o});var r=n(4382);function o(e){const t=(0,r.useRef)(e);return t.current=e,(0,r.useCallback)(((...e)=>t.current(...e)),[])}},2424:(e,t,n)=>{n.d(t,{P:()=>o});var r=n(9340);const o=(...e)=>t=>e.forEach((e=>{if((0,r.Tn)(e))e(t);else if(null!=e){e.current=t}}))},9340:(e,t,n)=>{function r(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{s(r.next(e))}catch(t){i(t)}}function a(e){try{s(r.throw(e))}catch(t){i(t)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((r=r.apply(e,t||[])).next())}))}n.d(t,{Et:()=>v,Fr:()=>a,Gp:()=>b,Ol:()=>k,Qd:()=>j,S$:()=>c,Tn:()=>x,Zp:()=>h,dK:()=>d,fl:()=>C,gD:()=>y,i5:()=>m,if:()=>f,l6:()=>I,lQ:()=>O,nS:()=>u,ni:()=>L,oc:()=>s}),"function"==typeof SuppressedError&&SuppressedError;const o={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};const i=(e,t)=>new Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function c(){return"undefined"==typeof window}function a(){if(c())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}function s(){return!c()}function d(e){return r(this,void 0,void 0,(function*(){if(!s())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const l=e=>r(void 0,void 0,void 0,(function*(){const t=yield fetch(e);return d(yield t.text())}));function u(e,t){var n;return r(this,void 0,void 0,(function*(){if(!s())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator))return l(e);if(!("write"in window.navigator.clipboard))return l(e);if(null!==(n=null==t?void 0:t.toText)&&void 0!==n&&n)return l(e);const c=yield function(e,t="png"){return new Promise(((n,c)=>{const a=new Image;a.onload=()=>r(this,void 0,void 0,(function*(){const e=document.createElement("canvas");e.width=a.width,e.height=a.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(a,0,0);const c=yield i(e,o[t]);n(c)}catch(r){console.error(`Failed to load image. message: ${r.mesaage}`),c(r)}})),a.onerror=()=>{c(new Error("Failed to load image"))},a.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[c.type]:c})]),c}catch(c){throw console.error(`Failed to copy to clipboard. message: ${c.message}`),c}}))}function h(){return r(this,void 0,void 0,(function*(){if(!s())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function f(){return r(this,void 0,void 0,(function*(){if(!s())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function m(e,t){return Object.prototype.hasOwnProperty.call(e,t)}const p=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i=0;i{if(e===t)return!0;if(v(e)&&v(t)&&isNaN(e)&&isNaN(t))return!0;if(x(e)&&x(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return p(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!g(o,t.get(r),n))return!1;return!0}return p(e,t,n)};function b(e,t){return g(e,t,new WeakMap)}function x(e){return"function"==typeof e}function y(e){return null==e}function v(e){return"number"==typeof e}function w(e){return!function(e){return Object(e)!==e}(e)}function j(e){return w(e)&&"[object Object]"===Object.prototype.toString.call(e)}function I(e){return e===window}function O(){}function k(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}function E(e){return Object.keys(e)}const z={days:864e5,hours:36e5,minutes:6e4,seconds:1e3};E(z);function C(e,t){if(!s())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}function L(e,t,n){if(!s())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=x(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}}}]);
\ No newline at end of file
diff --git a/assets/js/5d610355.79411896.js b/assets/js/5d610355.79411896.js
new file mode 100644
index 000000000..faf3d1435
--- /dev/null
+++ b/assets/js/5d610355.79411896.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[3118],{3329:(e,n,t)=>{t.r(n),t.d(n,{Example:()=>h,assets:()=>f,contentTitle:()=>u,default:()=>v,frontMatter:()=>d,metadata:()=>r,toc:()=>p});const r=JSON.parse('{"id":"react/hooks/useInterval","title":"useInterval","description":"window.setInterval\uc744 \ud3b8\ub9ac\ud558\uac8c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useInterval.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useInterval","permalink":"/modern-kit/docs/react/hooks/useInterval","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useIntersectionObserver","permalink":"/modern-kit/docs/react/hooks/useIntersectionObserver"},"next":{"title":"useIsMounted","permalink":"/modern-kit/docs/react/hooks/useIsMounted"}}');var o=t(6206),i=t(3267),s=t(4382),c=t(6765),a=t(9340);function l(e,n){const t=(0,s.useRef)(),r=(0,c.p)(e),{delay:o,enabled:i}=(e=>{var n;return(0,a.Et)(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(n=null==e?void 0:e.enabled)||void 0===n||n}})(n),l=(0,s.useCallback)((()=>{t.current=window.setInterval(r,o)}),[r,o]),d=(0,s.useCallback)((()=>{t.current&&(clearInterval(t.current),t.current=null)}),[]),u=(0,s.useCallback)((()=>{d(),l()}),[d,l]);return(0,s.useEffect)((()=>{if(!(o<0)&&i)return l(),()=>d()}),[d,l,i,o]),{set:l,reset:u,clear:d}}const d={},u="useInterval",f={},h=()=>{const e={button:"button",div:"div",p:"p",...(0,i.R)()},[n,t]=(0,s.useState)(0),{set:r,clear:c,reset:a}=l((()=>t(n+1)),{delay:1e3,enabled:!1});return(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.p,{children:n}),(0,o.jsx)(e.button,{onClick:r,children:"set"}),(0,o.jsx)(e.button,{onClick:c,children:"clear"}),(0,o.jsx)(e.button,{onClick:a,children:"reset"})]})},p=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2}];function m(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.header,{children:(0,o.jsx)(n.h1,{id:"useinterval",children:"useInterval"})}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.code,{children:"window.setInterval"}),"\uc744 \ud3b8\ub9ac\ud558\uac8c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(n.p,{children:["2\ubc88\uc9f8 \uc778\uc790 options\ub294 ",(0,o.jsx)(n.code,{children:"number"})," \ud639\uc740 ",(0,o.jsx)(n.code,{children:"{ delay: SetIntervalParameters[1]; enabled?: boolean }"})," \ud0c0\uc785\uc758 \uac1d\uccb4\ub97c \ub118\uaca8 \uc904 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(n.p,{children:["options\uac00 ",(0,o.jsx)(n.code,{children:"number"})," \ud0c0\uc785\uc774\uba74 \ud574\ub2f9 \uac12\uc740 ",(0,o.jsx)(n.code,{children:"setInterval"}),"\uc758 ",(0,o.jsx)(n.code,{children:"delay"})," \uac12\uc774 \ub418\uba70, \uac1d\uccb4 \ud0c0\uc785\uc77c \uacbd\uc6b0 delay\uc640 \ub354\ubd88\uc5b4 ",(0,o.jsx)(n.code,{children:"setInterval\uc758 \ub3d9\uc791 \uc5ec\ubd80"}),"\ub97c \uacb0\uc815\ud558\ub294 ",(0,o.jsx)(n.code,{children:"enabled"})," \uc635\uc158\uc744 \ucd94\uac00\ub85c \ub2e4\ub8f0 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:["\ud83d\udca1 options\uac00 number \ud0c0\uc785\uc758 \uacbd\uc6b0 enabled\ub294 \uae30\ubcf8\uc801\uc73c\ub85c ",(0,o.jsx)(n.code,{children:"true"}),"\uc785\ub2c8\ub2e4."]}),"\n"]}),"\n",(0,o.jsxs)(n.p,{children:["interval\uc744 \uc9c1\uc811 \ud578\ub4e4\ub9c1 \ud560 \uc218 \uc788\ub294 ",(0,o.jsx)(n.code,{children:"set"}),", ",(0,o.jsx)(n.code,{children:"reset"}),", ",(0,o.jsx)(n.code,{children:"clear"})," \ud568\uc218\ub97c \ubc18\ud658\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(n.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useInterval/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(n.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"interface IntervalOptions {\n delay: number;\n enabled?: boolean;\n}\n"})}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"// \ud568\uc218 \uc624\ubc84\ub85c\ub529\nfunction useInterval(\n callback: () => void,\n options: number\n): {\n set: () => void;\n clear: () => void;\n reset: () => void;\n};\n\nfunction useInterval(\n callback: () => void,\n options: IntervalOptions\n): {\n set: () => void;\n clear: () => void;\n reset: () => void;\n};\n"})}),"\n",(0,o.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useInterval } from '@modern-kit/react';\n\nconst Example = () => {\n const [number, setNumber] = useState(0);\n\n const { set, clear, reset } = useInterval(\n () => setNumber(number + 1),\n { delay: 1000, enabled: false } // \uc790\ub3d9 \uc2e4\ud589 X\n );\n\n /*\n * useInterval(() => {\n * setNumber(number + 1);\n * }, 1000); // \uc790\ub3d9 \uc2e4\ud589\n */\n\n return (\n \n
{number}
\n
\n
\n
\n
\n );\n};\n"})}),"\n","\n",(0,o.jsx)(h,{})]})}function v(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(m,{...e})}):m(e)}},3267:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>c});var r=t(4382);const o={},i=r.createContext(o);function s(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:s(e.components),r.createElement(i.Provider,{value:n},e.children)}},6765:(e,n,t)=>{t.d(n,{p:()=>o});var r=t(4382);function o(e){const n=(0,r.useRef)(e);return n.current=e,(0,r.useCallback)(((...e)=>n.current(...e)),[])}},9340:(e,n,t)=>{function r(e,n,t,r){return new(t||(t=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(n){i(n)}}function c(e){try{a(r.throw(e))}catch(n){i(n)}}function a(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(s,c)}a((r=r.apply(e,n||[])).next())}))}t.d(n,{Et:()=>x,Fr:()=>c,Gp:()=>b,Ol:()=>C,Qd:()=>j,S$:()=>s,Tn:()=>w,Zp:()=>f,dK:()=>l,fl:()=>S,gD:()=>g,i5:()=>p,if:()=>h,l6:()=>k,lQ:()=>I,nS:()=>u,ni:()=>$,oc:()=>a}),"function"==typeof SuppressedError&&SuppressedError;const o={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};const i=(e,n)=>new Promise(((t,r)=>{e.toBlob((e=>{e?t(e):r(new Error(`Failed to create blob with format ${n}`))}),n)}));function s(){return"undefined"==typeof window}function c(){if(s())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}function a(){return!s()}function l(e){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const n=document.createElement("textarea");n.value=e,n.style.opacity="0",document.body.appendChild(n),n.focus(),n.select();try{return document.execCommand("copy"),e}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}finally{document.body.removeChild(n)}}(e)}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}}))}const d=e=>r(void 0,void 0,void 0,(function*(){const n=yield fetch(e);return l(yield n.text())}));function u(e,n){var t;return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator))return d(e);if(!("write"in window.navigator.clipboard))return d(e);if(null!==(t=null==n?void 0:n.toText)&&void 0!==t&&t)return d(e);const s=yield function(e,n="png"){return new Promise(((t,s)=>{const c=new Image;c.onload=()=>r(this,void 0,void 0,(function*(){const e=document.createElement("canvas");e.width=c.width,e.height=c.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(c,0,0);const s=yield i(e,o[n]);t(s)}catch(r){console.error(`Failed to load image. message: ${r.mesaage}`),s(r)}})),c.onerror=()=>{s(new Error("Failed to load image"))},c.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[s.type]:s})]),s}catch(s){throw console.error(`Failed to copy to clipboard. message: ${s.message}`),s}}))}function f(){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function h(){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function p(e,n){return Object.prototype.hasOwnProperty.call(e,n)}const m=(e,n,t)=>{const r=Object.keys(e),o=Object.keys(n);if(r.length!==o.length)return!1;for(let i=0;i{if(e===n)return!0;if(x(e)&&x(n)&&isNaN(e)&&isNaN(n))return!0;if(w(e)&&w(n))return e.toString()===n.toString();if("object"!=typeof e||"object"!=typeof n||null===e||null===n)return!1;if(t.has(e)&&t.get(e)===n)return!0;if(t.set(e,n),e.constructor!==n.constructor)return!1;if(e instanceof Set){if(e.size!==n.size)return!1;const r=[...e],o=[...n];return m(r,o,t)}if(e instanceof Map){if(e.size!==n.size)return!1;for(const[r,o]of e)if(!n.has(r)||!v(o,n.get(r),t))return!1;return!0}return m(e,n,t)};function b(e,n){return v(e,n,new WeakMap)}function w(e){return"function"==typeof e}function g(e){return null==e}function x(e){return"number"==typeof e}function y(e){return!function(e){return Object(e)!==e}(e)}function j(e){return y(e)&&"[object Object]"===Object.prototype.toString.call(e)}function k(e){return e===window}function I(){}function C(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(n){throw new Error(`Failed to parse data: ${n}`)}}function E(e){return Object.keys(e)}const O={days:864e5,hours:36e5,minutes:6e4,seconds:1e3};E(O);function S(e,n){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(n)}catch(t){throw new Error(`Failed to remove key "${n}" from ${e}: ${t}`)}}function $(e,n,t){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=w(t)?t():t;r.setItem(n,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${n}" in ${e}: ${r}`)}}}}]);
\ No newline at end of file
diff --git a/assets/js/5d610355.9c05908f.js b/assets/js/5d610355.9c05908f.js
deleted file mode 100644
index c103e2d91..000000000
--- a/assets/js/5d610355.9c05908f.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[3118],{7263:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>d,assets:()=>u,contentTitle:()=>a,default:()=>p,frontMatter:()=>l,metadata:()=>r,toc:()=>f});const r=JSON.parse('{"id":"react/hooks/useInterval","title":"useInterval","description":"window.setInterval\uc744 \ud3b8\ub9ac\ud558\uac8c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useInterval.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useInterval","permalink":"/modern-kit/docs/react/hooks/useInterval","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useIntersectionObserver","permalink":"/modern-kit/docs/react/hooks/useIntersectionObserver"},"next":{"title":"useIsMounted","permalink":"/modern-kit/docs/react/hooks/useIsMounted"}}');var o=n(6206),s=n(3267),i=n(4027),c=n(4382);const l={},a="useInterval",u={},d=()=>{const e={button:"button",div:"div",p:"p",...(0,s.R)()},[t,n]=(0,c.useState)(0),{set:r,clear:l,reset:a}=(0,i.$$)((()=>n(t+1)),{delay:1e3,enabled:!1});return(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.p,{children:t}),(0,o.jsx)(e.button,{onClick:r,children:"set"}),(0,o.jsx)(e.button,{onClick:l,children:"clear"}),(0,o.jsx)(e.button,{onClick:a,children:"reset"})]})},f=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2}];function h(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,s.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"useinterval",children:"useInterval"})}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"window.setInterval"}),"\uc744 \ud3b8\ub9ac\ud558\uac8c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:["2\ubc88\uc9f8 \uc778\uc790 options\ub294 ",(0,o.jsx)(t.code,{children:"number"})," \ud639\uc740 ",(0,o.jsx)(t.code,{children:"{ delay: SetIntervalParameters[1]; enabled?: boolean }"})," \ud0c0\uc785\uc758 \uac1d\uccb4\ub97c \ub118\uaca8 \uc904 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:["options\uac00 ",(0,o.jsx)(t.code,{children:"number"})," \ud0c0\uc785\uc774\uba74 \ud574\ub2f9 \uac12\uc740 ",(0,o.jsx)(t.code,{children:"setInterval"}),"\uc758 ",(0,o.jsx)(t.code,{children:"delay"})," \uac12\uc774 \ub418\uba70, \uac1d\uccb4 \ud0c0\uc785\uc77c \uacbd\uc6b0 delay\uc640 \ub354\ubd88\uc5b4 ",(0,o.jsx)(t.code,{children:"setInterval\uc758 \ub3d9\uc791 \uc5ec\ubd80"}),"\ub97c \uacb0\uc815\ud558\ub294 ",(0,o.jsx)(t.code,{children:"enabled"})," \uc635\uc158\uc744 \ucd94\uac00\ub85c \ub2e4\ub8f0 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsxs)(t.li,{children:["\ud83d\udca1 options\uac00 number \ud0c0\uc785\uc758 \uacbd\uc6b0 enabled\ub294 \uae30\ubcf8\uc801\uc73c\ub85c ",(0,o.jsx)(t.code,{children:"true"}),"\uc785\ub2c8\ub2e4."]}),"\n"]}),"\n",(0,o.jsxs)(t.p,{children:["interval\uc744 \uc9c1\uc811 \ud578\ub4e4\ub9c1 \ud560 \uc218 \uc788\ub294 ",(0,o.jsx)(t.code,{children:"set"}),", ",(0,o.jsx)(t.code,{children:"reset"}),", ",(0,o.jsx)(t.code,{children:"clear"})," \ud568\uc218\ub97c \ubc18\ud658\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useInterval/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"interface IntervalOptions {\n delay: number;\n enabled?: boolean;\n}\n"})}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"// \ud568\uc218 \uc624\ubc84\ub85c\ub529\nfunction useInterval(\n callback: () => void,\n options: number\n): {\n set: () => void;\n clear: () => void;\n reset: () => void;\n};\n\nfunction useInterval(\n callback: () => void,\n options: IntervalOptions\n): {\n set: () => void;\n clear: () => void;\n reset: () => void;\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useInterval } from '@modern-kit/react';\n\nconst Example = () => {\n const [number, setNumber] = useState(0);\n\n const { set, clear, reset } = useInterval(\n () => setNumber(number + 1),\n { delay: 1000, enabled: false } // \uc790\ub3d9 \uc2e4\ud589 X\n );\n\n /*\n * useInterval(() => {\n * setNumber(number + 1);\n * }, 1000); // \uc790\ub3d9 \uc2e4\ud589\n */\n\n return (\n \n
{number}
\n
\n
\n
\n
\n );\n};\n"})}),"\n","\n",(0,o.jsx)(d,{})]})}function p(e={}){const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(h,{...e})}):h(e)}},4027:(e,t,n)=>{n.d(t,{$$:()=>Pe,$I:()=>oe,AE:()=>We,BL:()=>H,DX:()=>N,FT:()=>ct,Fo:()=>et,Hn:()=>st,I5:()=>Ee,JF:()=>Te,K:()=>ae,K$:()=>Je,M0:()=>Re,ML:()=>ne,Mj:()=>ye,Mk:()=>Me,Mo:()=>se,NT:()=>Xe,QV:()=>Ue,Ub:()=>ke,Ut:()=>Se,W7:()=>U,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>_e,Zu:()=>le,_1:()=>Oe,_g:()=>nt,aL:()=>J,aY:()=>Ne,bB:()=>V,d7:()=>B,eG:()=>it,fN:()=>ce,fm:()=>G,gl:()=>P,hN:()=>D,iD:()=>de,iQ:()=>Le,jd:()=>ie,lW:()=>at,oD:()=>K,oo:()=>Ie,pL:()=>q,qi:()=>ue,rN:()=>Fe,tD:()=>je,u8:()=>Q,wY:()=>Be,xV:()=>L,xh:()=>tt,zy:()=>Z});var r=n(6206),o=n(4382),s=n(3683),i=n(5086),c=n(7197),l=(n(1604),n(5938));function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function m(){return typeof window>"u"}function b(){return!m()}function v(e){return f(this,0,void 0,(function*(){if(!b())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const w=e=>f(void 0,0,void 0,(function*(){return v(yield(yield fetch(e)).text())}));function g(e,t){var n;return f(this,0,void 0,(function*(){if(!b())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return w(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const s=yield p(e,h[t]);n(s)}catch(s){console.error(`Failed to load image. message: ${s.mesaage}`),r(s)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let s=0;s{if(e===t||C(e)&&C(t)&&isNaN(e)&&isNaN(t))return!0;if(j(e)&&j(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return y(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!x(o,t.get(r),n))return!1;return!0}return y(e,t,n)};function k(e,t){return x(e,t,new WeakMap)}function j(e){return"function"==typeof e}function C(e){return"number"==typeof e}function S(e){return!function(e){return Object(e)!==e}(e)}function E(){}function I(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const O=(...e)=>t=>e.forEach((e=>{if(j(e))e(t);else if(null!=e){e.current=t}}));function R(...e){return(0,o.useCallback)(O(...e),e)}const N=o.forwardRef(((e,t)=>{const{children:n}=e,s=a(e,["children"]),i=o.Children.toArray(n),c=i.find(M);if(c){const e=c.props.children,n=i.map((t=>t===c?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(F,Object.assign({},s,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(F,Object.assign({},s,{ref:t,children:n}))}));N.displayName="Slot";const F=o.forwardRef(((e,t)=>{const{children:n}=e,r=a(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...e)=>{s(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),s):"className"===r&&(n[r]=[o,s].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?O(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));F.displayName="SlotClone";const L=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function M(e){return o.isValidElement(e)&&e.type===L}var $="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const P=d(((e,t)=>{var{ratio:n,style:o,as:i="div",asChild:c=!1}=e,l=a(e,["ratio","style","as","asChild"]);const u=c?N:i,d=Object.assign({aspectRatio:n},o),f=c?l.className:s($,l.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},l))})),T=()=>E,Y=()=>!1,X=()=>!0;function V({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)(T,Y,X)?e:t}function A(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const D=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>A()?(0,r.jsx)(r.Fragment,{children:t}):e;function W(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function _(e){const t=W(e);(0,o.useEffect)((()=>()=>t()),[t])}function z(e,t=k){const[n,r]=(0,o.useState)(e),s=W(t);return(0,o.useEffect)((()=>{s(n,e)||r(e)}),[s,n,e]),n}function B(e,t,n){const r=W(e),s=z(n),c=(0,o.useMemo)((()=>(0,i.A)(r,t,s)),[r,t,s]);return _((()=>c.cancel())),c}const J=({children:e,capture:t,wait:n,options:r})=>{const s=o.Children.only(e),i=B(((...e)=>{const n=s?.props;if(n&&j(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(s,{[t]:i})};function H({onIntersectStart:e=E,onIntersectEnd:t=E,enabled:n=!0,calledOnce:r=!1,root:s=null,threshold:i=0,rootMargin:c="0px 0px 0px 0px"}){const l=(0,o.useRef)(0),a=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=W((([n],o)=>{if(!n)return;const s=n.target;n.isIntersecting?(a.current=!0,l.current+=1,e(n)):a.current&&(a.current=!1,l.current+=1,t(n)),r&&l.current>1&&o.unobserve(s)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:i,root:s,rootMargin:c}),u.current.observe(e))}),[n,i,s,c,d])}}const K=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:s,rootMargin:i}=e,c=a(e,["src","threshold","root","rootMargin"]);const{ref:l}=H({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:s,rootMargin:i});return(0,r.jsx)("img",Object.assign({ref:R(t,l)},c))}));K.displayName="LazyImage";const U=(0,o.forwardRef)(((e,t)=>{var{width:n,height:s,fallback:i,className:c,style:l,duration:u="0.2s",onLoad:d}=e,f=a(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,p]=(0,o.useState)(!1),m=!h,b=(0,o.useMemo)((()=>({position:"relative",width:n,height:s})),[n,s]),v=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:m?0:1,transition:`opacity ${u}`},l)),[m,u,l]),w=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),g=c?`lazy-image-wrapper ${c}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:g,style:b,children:[m&&i,(0,r.jsx)(K,Object.assign({ref:t,width:n,height:s,style:v,onLoad:w},f))]})}));U.displayName="FallbackLazyImage";const Z=({condition:e,trueComponent:t,falseComponent:n})=>{const s=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:s?t:n})},Q=({onScrollAction:e,children:t,root:n,threshold:o,enabled:s,triggerPosition:i="after",rootMargin:c="150px 0px"})=>{const{ref:l}=H({onIntersectStart:e,root:n,threshold:o,enabled:s,rootMargin:c});return(0,r.jsxs)(r.Fragment,{children:["before"===i&&(0,r.jsx)("div",{ref:l}),t,"after"===i&&(0,r.jsx)("div",{ref:l})]})},q=d(((e,t)=>{var{children:n,as:s="div",asChild:i=!1}=e,c=a(e,["children","as","asChild"]);const l=i?N:s,{ref:u}=H(c);if(i&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(l,Object.assign({ref:O(t,u)},c,{children:n}))})),G=({items:e=[],itemKey:t,renderItem:n})=>{const s=(0,o.useCallback)(((e,n)=>function(e){return S(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},s(e,t))))})},ee=b()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=W(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),s=(0,o.useMemo)((()=>function(){if(m())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,s,(({target:t})=>{if(!r.current)return;const o=r.current,s=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!s&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:s="div",asChild:i=!1,onPointerDown:c,excludeRefs:l=[]}=e,u=a(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(c,{excludeRefs:l}),f=i?N:s;if(i&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:O(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const se=({itemKey:e,items:t=[],separator:n,renderItem:s,separatorInterval:i=1,includeLastSeparator:c=!1})=>{const l=(0,o.useCallback)((e=>e===t.length-1?c:(e+1)%i==0),[c,i,t.length]);return(0,r.jsx)(G,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[s(e,t),l(t)&&n]})})},ie=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ce=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function le(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function ae(e=!0){const t=j(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!s.current){s.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{s.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),s=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield v(e);return t(n),!0}catch{return t(null),!1}}))),[]),i=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield g(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!b())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),l=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!b())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:s,copyImage:i,readText:c,readContents:l}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",pe={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},me=e=>pe[e],be=me("localStorage"),ve=e=>window.localStorage.getItem(e),we=e=>JSON.stringify(e),ge=e=>(be.subscribe(e),()=>{be.unsubscribe(e)});function ye(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=j(n)?n():n,s=(0,o.useSyncExternalStore)(ge,(()=>ve(t)),(()=>we(r)));return{state:(0,o.useMemo)((()=>s?I(s):r),[s,r]),setState:(0,o.useCallback)((e=>{try{const n=ve(t),o=n?I(n):r,s=j(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(s)),be.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),be.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const xe=(e,t)=>b()?window.matchMedia(e).matches:t??!1;function ke(e,t){const[n,r]=(0,o.useState)(xe(e,t)),s=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",s),n}function je(){return ke("(prefers-color-scheme: dark)")?"dark":"light"}const Ce="color-scheme";function Se({defaultValue:e,key:t=Ce,shouldSetBodyClass:n=!1}={}){const r=je(),s=j(e)?e():e,{state:i,setState:c}=ye({key:t,initialValue:s??r}),l=(0,o.useCallback)((()=>{c((e=>"dark"===e?"light":"dark"))}),[c]),a=(0,o.useCallback)((()=>{c("dark")}),[c]),u=(0,o.useCallback)((()=>{c("light")}),[c]),d=(0,o.useCallback)((()=>{c(r)}),[c,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(i),()=>{n&&document.body.classList.remove(i)})),[i,n]),{colorScheme:i,preferredColorScheme:r,setToggleMode:l,setDarkMode:a,setLightMode:u,setPreferredMode:d}}function Ee(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),s=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),i=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:s,reset:i}}function Ie({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,s]=(0,o.useState)(t),i=r0,l=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),a=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const i=l(e,t);o&&o({prev:r,next:i}),s(i)}),[n,r,l]),u=(0,o.useCallback)((e=>{a("nextStep",!i,e)}),[i,a]),d=(0,o.useCallback)((e=>{a("prevStep",!c,e)}),[c,a]),f=(0,o.useCallback)(((t,n)=>{const o=j(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void s(t);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),s(t)}),[r,t]);return{currentStep:r,hasNextStep:i,hasPrevStep:c,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Oe(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:s,resetStep:i}=Ie({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:s,resetIndex:i}}function Re(e,t,n={}){const[r,s]=(0,o.useState)(e);return[r,B(s,t,n)]}function Ne(e,t={}){const[n,r]=(0,o.useState)(""),[s,i]=Re("",e,t);return{value:n,debouncedValue:s,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),i(t)}),[i]),onReset:(0,o.useCallback)((()=>{r(""),i("")}),[i])}}function Fe(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Le({onFocus:e=E,onBlur:t=E}={}){const[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(null),i=W((t=>{r(!0),e(t)})),c=W((e=>{r(!1),t(e)})),l=(0,o.useCallback)((()=>{s.current&&(s.current.focus(),r(!0))}),[]);return ne(s,"focus",i),ne(s,"blur",c),{ref:s,isFocus:n,setFocus:l}}function Me({onEnter:e=E,onLeave:t=E}={}){const[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(null),i=W((t=>{r(!0),e(t)})),c=W((e=>{r(!1),t(e)}));return ne(s,"mouseenter",i),ne(s,"mouseleave",c),{ref:s,isHovered:n}}const $e=e=>{var t;return C(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function Pe(e,t){const n=(0,o.useRef)(),r=W(e),{delay:s,enabled:i}=$e(t),c=(0,o.useCallback)((()=>{n.current=window.setInterval(r,s)}),[r,s]),l=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),c()}),[l,c]);return(0,o.useEffect)((()=>{if(!(s<0)&&i)return c(),()=>l()}),[l,c,i,s]),{set:c,reset:a,clear:l}}function Te({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),s=W((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];j(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",s),()=>t.removeEventListener("keydown",s)}),[e,s]),r}const Ye={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function Xe(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)(Ye),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:s,clientY:i,pageX:c,pageY:l}=t;let a=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();a=s-t.left,u=i-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:s,clientY:i,pageX:c,pageY:l,elementRelativeX:a,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const Ve=()=>navigator.onLine,Ae=()=>!0,De=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function We({onlineAction:e=E,offlineAction:t=E}={}){const n=W((n=>De(n,e,t)));return(0,o.useSyncExternalStore)(n,Ve,Ae)}function _e(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const ze={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Be(e=E){const[t,n]=(0,o.useState)(ze),r=(0,o.useRef)(null),s=W((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(s);return t.observe(e),()=>{t.unobserve(e)}}),[s]),{ref:r,contentRect:t}}function Je({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),s=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>s())),[e,r,s]),{ref:t,lock:r,unlock:s}}const He=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,Ke=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:s=0,alignY:i="start",alignX:c="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+s+He(window.innerHeight,r.height,i),left:r.left+window.scrollX+o+He(window.innerWidth,r.width,c)};const l=e.getBoundingClientRect();return{top:r.top-l.top+e.scrollTop+s+He(l.height,r.height,i),left:r.left-l.left+e.scrollLeft+o+He(l.width,r.width,c)}};function Ue(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:s,top:i}=Ke(r,t,n);r.scrollTo({top:i,left:s,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ze=me("sessionStorage"),Qe=e=>window.sessionStorage.getItem(e),qe=e=>JSON.stringify(e),Ge=e=>(Ze.subscribe(e),()=>{Ze.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=j(n)?n():n,s=(0,o.useSyncExternalStore)(Ge,(()=>Qe(t)),(()=>qe(r)));return{state:(0,o.useMemo)((()=>s?I(s):r),[s,r]),setState:(0,o.useCallback)((e=>{try{const n=Qe(t),o=n?I(n):r,s=j(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(s)),Ze.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ze.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:s}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[i,c]=(0,o.useState)(n),l=(0,o.useCallback)((e=>{c((t=>{const n=j(e)?e(t):e;return r&&s&&function(e,t,n){if(!b())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=j(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,s,n),n}))}),[r,s]),a=(0,o.useCallback)((()=>{r&&s&&function(e,t){if(!b())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,s),c(null)}),[r,s]);return Object.assign({state:i,setState:l,clearState:a},Ie(e))}function nt(e,t,n={}){const r=W(e),s=z(n),i=(0,o.useMemo)((()=>(0,c.A)(r,t,s)),[r,t,s]);return _((()=>i.cancel())),i}const rt=e=>{var t;return C(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=W(e),{delay:s,enabled:i}=rt(t),c=(0,o.useCallback)((()=>{n.current=setTimeout(r,s)}),[r,s]),l=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),c()}),[l,c]);return(0,o.useEffect)((()=>{if(!(s<0)&&i)return c(),()=>l()}),[c,l,s,i]),{set:c,reset:a,clear:l}}function st(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function it(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new l.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function ct({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const lt={width:null,height:null};function at({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>m()?lt:{width:window.innerWidth,height:window.innerHeight})),r=B(n,e),s=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",s),t}function ut(e,t,n){const{delay:r,enabled:s}=rt(t),{set:i,reset:c,clear:l}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!s||c()}),[r,s,c,...n]),{set:i,reset:c,clear:l}}}}]);
\ No newline at end of file
diff --git a/assets/js/61a35b61.4c79d1bb.js b/assets/js/61a35b61.4c79d1bb.js
deleted file mode 100644
index 6daac5330..000000000
--- a/assets/js/61a35b61.4c79d1bb.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[1450],{5576:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>d,assets:()=>u,contentTitle:()=>l,default:()=>p,frontMatter:()=>a,metadata:()=>r,toc:()=>f});const r=JSON.parse('{"id":"react/hooks/useMediaQuery","title":"useMediaQuery","description":"\ubbf8\ub514\uc5b4 \ucffc\ub9ac \ubb38\uc790\uc5f4\uc758 \ubd84\uc11d \uacb0\uacfc\ub97c \uc27d\uac8c \ud655\uc778 \ud560 \uc218 \uc788\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useMediaQuery.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useMediaQuery","permalink":"/modern-kit/docs/react/hooks/useMediaQuery","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useLocalStorage","permalink":"/modern-kit/docs/react/hooks/useLocalStorage"},"next":{"title":"useMergeRefs","permalink":"/modern-kit/docs/react/hooks/useMergeRefs"}}');var o=n(6206),i=n(3267),s=n(4027),c=n(9010);const a={},l="useMediaQuery",u={},d=()=>{const e={div:"div",p:"p",...(0,i.R)()},t=(0,s.Ub)("(min-width: 768px)");return(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.p,{children:"\ube0c\ub77c\uc6b0\uc800 \ub108\ube44\ub97c \uc218\uc815\ud574\ubcf4\uc138\uc694!"}),(0,o.jsx)(e.p,{children:t?"viewport \ub108\ube44\uac00 768px \uc774\uc0c1\uc785\ub2c8\ub2e4.":"viewport \ub108\ube44\uac00 768px \ubbf8\ub9cc\uc785\ub2c8\ub2e4."})]})},f=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2}];function h(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"usemediaquery",children:"useMediaQuery"})}),"\n",(0,o.jsx)(t.p,{children:"\ubbf8\ub514\uc5b4 \ucffc\ub9ac \ubb38\uc790\uc5f4\uc758 \ubd84\uc11d \uacb0\uacfc\ub97c \uc27d\uac8c \ud655\uc778 \ud560 \uc218 \uc788\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useMediaQuery/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"function useMediaQuery(mediaQueryString: string, defaultValue?: boolean): boolean\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useMediaQuery } from '@modern-kit/react';\n\nconst Example = () => {\n const isMatch = useMediaQuery('(min-width: 768px)');\n\n return (\n \n
\n {isMatch\n ? 'viewport \ub108\ube44\uac00 768px \uc774\uc0c1\uc785\ub2c8\ub2e4.'\n : 'viewport \ub108\ube44\uac00 768px \ubbf8\ub9cc\uc785\ub2c8\ub2e4.'}\n
\n
\n );\n};\n"})}),"\n","\n",(0,o.jsx)(c.A,{children:()=>(0,o.jsx)(d,{})})]})}function p(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(h,{...e})}):h(e)}},9010:(e,t,n)=>{n.d(t,{A:()=>i});n(4382);var r=n(3555),o=n(6206);function i(e){let{children:t,fallback:n}=e;return(0,r.A)()?(0,o.jsx)(o.Fragment,{children:t?.()}):n??null}},4027:(e,t,n)=>{n.d(t,{$$:()=>Pe,$I:()=>oe,AE:()=>We,BL:()=>J,DX:()=>F,FT:()=>ct,Fo:()=>et,Hn:()=>it,I5:()=>je,JF:()=>Te,K:()=>le,K$:()=>Qe,M0:()=>Me,ML:()=>ne,Mj:()=>ye,Mk:()=>Ne,Mo:()=>ie,NT:()=>Ae,QV:()=>Ue,Ub:()=>ke,Ut:()=>Ee,W7:()=>U,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>_e,Zu:()=>ae,_1:()=>Oe,_g:()=>nt,aL:()=>Q,aY:()=>Fe,bB:()=>V,d7:()=>B,eG:()=>st,fN:()=>ce,fm:()=>G,gl:()=>P,hN:()=>D,iD:()=>de,iQ:()=>Le,jd:()=>se,lW:()=>lt,oD:()=>H,oo:()=>Re,pL:()=>q,qi:()=>ue,rN:()=>Ie,tD:()=>Se,u8:()=>Z,wY:()=>Be,xV:()=>L,xh:()=>tt,zy:()=>K});var r=n(6206),o=n(4382),i=n(3683),s=n(5086),c=n(7197),a=(n(1604),n(5938));function l(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function m(){return typeof window>"u"}function g(){return!m()}function w(e){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const b=e=>f(void 0,0,void 0,(function*(){return w(yield(yield fetch(e)).text())}));function v(e,t){var n;return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return b(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const i=yield p(e,h[t]);n(i)}catch(i){console.error(`Failed to load image. message: ${i.mesaage}`),r(i)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i=0;i{if(e===t||C(e)&&C(t)&&isNaN(e)&&isNaN(t))return!0;if(S(e)&&S(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return y(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!x(o,t.get(r),n))return!1;return!0}return y(e,t,n)};function k(e,t){return x(e,t,new WeakMap)}function S(e){return"function"==typeof e}function C(e){return"number"==typeof e}function E(e){return!function(e){return Object(e)!==e}(e)}function j(){}function R(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const O=(...e)=>t=>e.forEach((e=>{if(S(e))e(t);else if(null!=e){e.current=t}}));function M(...e){return(0,o.useCallback)(O(...e),e)}const F=o.forwardRef(((e,t)=>{const{children:n}=e,i=l(e,["children"]),s=o.Children.toArray(n),c=s.find(N);if(c){const e=c.props.children,n=s.map((t=>t===c?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(I,Object.assign({},i,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(I,Object.assign({},i,{ref:t,children:n}))}));F.displayName="Slot";const I=o.forwardRef(((e,t)=>{const{children:n}=e,r=l(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),i):"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?O(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));I.displayName="SlotClone";const L=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function N(e){return o.isValidElement(e)&&e.type===L}var $="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const P=d(((e,t)=>{var{ratio:n,style:o,as:s="div",asChild:c=!1}=e,a=l(e,["ratio","style","as","asChild"]);const u=c?F:s,d=Object.assign({aspectRatio:n},o),f=c?a.className:i($,a.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},a))})),T=()=>j,Y=()=>!1,A=()=>!0;function V({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)(T,Y,A)?e:t}function X(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const D=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>X()?(0,r.jsx)(r.Fragment,{children:t}):e;function W(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function _(e){const t=W(e);(0,o.useEffect)((()=>()=>t()),[t])}function z(e,t=k){const[n,r]=(0,o.useState)(e),i=W(t);return(0,o.useEffect)((()=>{i(n,e)||r(e)}),[i,n,e]),n}function B(e,t,n){const r=W(e),i=z(n),c=(0,o.useMemo)((()=>(0,s.A)(r,t,i)),[r,t,i]);return _((()=>c.cancel())),c}const Q=({children:e,capture:t,wait:n,options:r})=>{const i=o.Children.only(e),s=B(((...e)=>{const n=i?.props;if(n&&S(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(i,{[t]:s})};function J({onIntersectStart:e=j,onIntersectEnd:t=j,enabled:n=!0,calledOnce:r=!1,root:i=null,threshold:s=0,rootMargin:c="0px 0px 0px 0px"}){const a=(0,o.useRef)(0),l=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=W((([n],o)=>{if(!n)return;const i=n.target;n.isIntersecting?(l.current=!0,a.current+=1,e(n)):l.current&&(l.current=!1,a.current+=1,t(n)),r&&a.current>1&&o.unobserve(i)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:s,root:i,rootMargin:c}),u.current.observe(e))}),[n,s,i,c,d])}}const H=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:i,rootMargin:s}=e,c=l(e,["src","threshold","root","rootMargin"]);const{ref:a}=J({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:i,rootMargin:s});return(0,r.jsx)("img",Object.assign({ref:M(t,a)},c))}));H.displayName="LazyImage";const U=(0,o.forwardRef)(((e,t)=>{var{width:n,height:i,fallback:s,className:c,style:a,duration:u="0.2s",onLoad:d}=e,f=l(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,p]=(0,o.useState)(!1),m=!h,g=(0,o.useMemo)((()=>({position:"relative",width:n,height:i})),[n,i]),w=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:m?0:1,transition:`opacity ${u}`},a)),[m,u,a]),b=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),v=c?`lazy-image-wrapper ${c}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:v,style:g,children:[m&&s,(0,r.jsx)(H,Object.assign({ref:t,width:n,height:i,style:w,onLoad:b},f))]})}));U.displayName="FallbackLazyImage";const K=({condition:e,trueComponent:t,falseComponent:n})=>{const i=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:i?t:n})},Z=({onScrollAction:e,children:t,root:n,threshold:o,enabled:i,triggerPosition:s="after",rootMargin:c="150px 0px"})=>{const{ref:a}=J({onIntersectStart:e,root:n,threshold:o,enabled:i,rootMargin:c});return(0,r.jsxs)(r.Fragment,{children:["before"===s&&(0,r.jsx)("div",{ref:a}),t,"after"===s&&(0,r.jsx)("div",{ref:a})]})},q=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1}=e,c=l(e,["children","as","asChild"]);const a=s?F:i,{ref:u}=J(c);if(s&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(a,Object.assign({ref:O(t,u)},c,{children:n}))})),G=({items:e=[],itemKey:t,renderItem:n})=>{const i=(0,o.useCallback)(((e,n)=>function(e){return E(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},i(e,t))))})},ee=g()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=W(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),i=(0,o.useMemo)((()=>function(){if(m())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,i,(({target:t})=>{if(!r.current)return;const o=r.current,i=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!i&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1,onPointerDown:c,excludeRefs:a=[]}=e,u=l(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(c,{excludeRefs:a}),f=s?F:i;if(s&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:O(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const ie=({itemKey:e,items:t=[],separator:n,renderItem:i,separatorInterval:s=1,includeLastSeparator:c=!1})=>{const a=(0,o.useCallback)((e=>e===t.length-1?c:(e+1)%s==0),[c,s,t.length]);return(0,r.jsx)(G,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[i(e,t),a(t)&&n]})})},se=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ce=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function ae(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function le(e=!0){const t=S(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!i.current){i.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{i.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),i=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield w(e);return t(n),!0}catch{return t(null),!1}}))),[]),s=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield v(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),a=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:i,copyImage:s,readText:c,readContents:a}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",pe={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},me=e=>pe[e],ge=me("localStorage"),we=e=>window.localStorage.getItem(e),be=e=>JSON.stringify(e),ve=e=>(ge.subscribe(e),()=>{ge.unsubscribe(e)});function ye(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=S(n)?n():n,i=(0,o.useSyncExternalStore)(ve,(()=>we(t)),(()=>be(r)));return{state:(0,o.useMemo)((()=>i?R(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=we(t),o=n?R(n):r,i=S(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(i)),ge.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),ge.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const xe=(e,t)=>g()?window.matchMedia(e).matches:t??!1;function ke(e,t){const[n,r]=(0,o.useState)(xe(e,t)),i=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",i),n}function Se(){return ke("(prefers-color-scheme: dark)")?"dark":"light"}const Ce="color-scheme";function Ee({defaultValue:e,key:t=Ce,shouldSetBodyClass:n=!1}={}){const r=Se(),i=S(e)?e():e,{state:s,setState:c}=ye({key:t,initialValue:i??r}),a=(0,o.useCallback)((()=>{c((e=>"dark"===e?"light":"dark"))}),[c]),l=(0,o.useCallback)((()=>{c("dark")}),[c]),u=(0,o.useCallback)((()=>{c("light")}),[c]),d=(0,o.useCallback)((()=>{c(r)}),[c,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(s),()=>{n&&document.body.classList.remove(s)})),[s,n]),{colorScheme:s,preferredColorScheme:r,setToggleMode:a,setDarkMode:l,setLightMode:u,setPreferredMode:d}}function je(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),i=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),s=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:i,reset:s}}function Re({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,i]=(0,o.useState)(t),s=r0,a=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),l=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const s=a(e,t);o&&o({prev:r,next:s}),i(s)}),[n,r,a]),u=(0,o.useCallback)((e=>{l("nextStep",!s,e)}),[s,l]),d=(0,o.useCallback)((e=>{l("prevStep",!c,e)}),[c,l]),f=(0,o.useCallback)(((t,n)=>{const o=S(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void i(t);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),i(t)}),[r,t]);return{currentStep:r,hasNextStep:s,hasPrevStep:c,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Oe(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:i,resetStep:s}=Re({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:i,resetIndex:s}}function Me(e,t,n={}){const[r,i]=(0,o.useState)(e);return[r,B(i,t,n)]}function Fe(e,t={}){const[n,r]=(0,o.useState)(""),[i,s]=Me("",e,t);return{value:n,debouncedValue:i,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),s(t)}),[s]),onReset:(0,o.useCallback)((()=>{r(""),s("")}),[s])}}function Ie(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Le({onFocus:e=j,onBlur:t=j}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=W((t=>{r(!0),e(t)})),c=W((e=>{r(!1),t(e)})),a=(0,o.useCallback)((()=>{i.current&&(i.current.focus(),r(!0))}),[]);return ne(i,"focus",s),ne(i,"blur",c),{ref:i,isFocus:n,setFocus:a}}function Ne({onEnter:e=j,onLeave:t=j}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=W((t=>{r(!0),e(t)})),c=W((e=>{r(!1),t(e)}));return ne(i,"mouseenter",s),ne(i,"mouseleave",c),{ref:i,isHovered:n}}const $e=e=>{var t;return C(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function Pe(e,t){const n=(0,o.useRef)(),r=W(e),{delay:i,enabled:s}=$e(t),c=(0,o.useCallback)((()=>{n.current=window.setInterval(r,i)}),[r,i]),a=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{a(),c()}),[a,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>a()}),[a,c,s,i]),{set:c,reset:l,clear:a}}function Te({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),i=W((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];S(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",i),()=>t.removeEventListener("keydown",i)}),[e,i]),r}const Ye={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function Ae(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)(Ye),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:a}=t;let l=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();l=i-t.left,u=s-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:a,elementRelativeX:l,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const Ve=()=>navigator.onLine,Xe=()=>!0,De=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function We({onlineAction:e=j,offlineAction:t=j}={}){const n=W((n=>De(n,e,t)));return(0,o.useSyncExternalStore)(n,Ve,Xe)}function _e(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const ze={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Be(e=j){const[t,n]=(0,o.useState)(ze),r=(0,o.useRef)(null),i=W((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(i);return t.observe(e),()=>{t.unobserve(e)}}),[i]),{ref:r,contentRect:t}}function Qe({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),i=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>i())),[e,r,i]),{ref:t,lock:r,unlock:i}}const Je=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,He=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:i=0,alignY:s="start",alignX:c="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+i+Je(window.innerHeight,r.height,s),left:r.left+window.scrollX+o+Je(window.innerWidth,r.width,c)};const a=e.getBoundingClientRect();return{top:r.top-a.top+e.scrollTop+i+Je(a.height,r.height,s),left:r.left-a.left+e.scrollLeft+o+Je(a.width,r.width,c)}};function Ue(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:i,top:s}=He(r,t,n);r.scrollTo({top:s,left:i,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ke=me("sessionStorage"),Ze=e=>window.sessionStorage.getItem(e),qe=e=>JSON.stringify(e),Ge=e=>(Ke.subscribe(e),()=>{Ke.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=S(n)?n():n,i=(0,o.useSyncExternalStore)(Ge,(()=>Ze(t)),(()=>qe(r)));return{state:(0,o.useMemo)((()=>i?R(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=Ze(t),o=n?R(n):r,i=S(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(i)),Ke.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ke.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:i}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[s,c]=(0,o.useState)(n),a=(0,o.useCallback)((e=>{c((t=>{const n=S(e)?e(t):e;return r&&i&&function(e,t,n){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=S(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,i,n),n}))}),[r,i]),l=(0,o.useCallback)((()=>{r&&i&&function(e,t){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,i),c(null)}),[r,i]);return Object.assign({state:s,setState:a,clearState:l},Re(e))}function nt(e,t,n={}){const r=W(e),i=z(n),s=(0,o.useMemo)((()=>(0,c.A)(r,t,i)),[r,t,i]);return _((()=>s.cancel())),s}const rt=e=>{var t;return C(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=W(e),{delay:i,enabled:s}=rt(t),c=(0,o.useCallback)((()=>{n.current=setTimeout(r,i)}),[r,i]),a=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{a(),c()}),[a,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>a()}),[c,a,i,s]),{set:c,reset:l,clear:a}}function it(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function st(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new a.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function ct({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const at={width:null,height:null};function lt({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>m()?at:{width:window.innerWidth,height:window.innerHeight})),r=B(n,e),i=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",i),t}function ut(e,t,n){const{delay:r,enabled:i}=rt(t),{set:s,reset:c,clear:a}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!i||c()}),[r,i,c,...n]),{set:s,reset:c,clear:a}}}}]);
\ No newline at end of file
diff --git a/assets/js/61a35b61.53efbb03.js b/assets/js/61a35b61.53efbb03.js
new file mode 100644
index 000000000..acdfe4d17
--- /dev/null
+++ b/assets/js/61a35b61.53efbb03.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[1450],{5576:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>l,assets:()=>d,contentTitle:()=>u,default:()=>h,frontMatter:()=>s,metadata:()=>r,toc:()=>f});const r=JSON.parse('{"id":"react/hooks/useMediaQuery","title":"useMediaQuery","description":"\ubbf8\ub514\uc5b4 \ucffc\ub9ac \ubb38\uc790\uc5f4\uc758 \ubd84\uc11d \uacb0\uacfc\ub97c \uc27d\uac8c \ud655\uc778 \ud560 \uc218 \uc788\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useMediaQuery.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useMediaQuery","permalink":"/modern-kit/docs/react/hooks/useMediaQuery","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useLocalStorage","permalink":"/modern-kit/docs/react/hooks/useLocalStorage"},"next":{"title":"useMergeRefs","permalink":"/modern-kit/docs/react/hooks/useMergeRefs"}}');var o=n(6206),i=n(3267),c=n(9659),a=n(9010);const s={},u="useMediaQuery",d={},l=()=>{const e={div:"div",p:"p",...(0,i.R)()},t=(0,c.U)("(min-width: 768px)");return(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.p,{children:"\ube0c\ub77c\uc6b0\uc800 \ub108\ube44\ub97c \uc218\uc815\ud574\ubcf4\uc138\uc694!"}),(0,o.jsx)(e.p,{children:t?"viewport \ub108\ube44\uac00 768px \uc774\uc0c1\uc785\ub2c8\ub2e4.":"viewport \ub108\ube44\uac00 768px \ubbf8\ub9cc\uc785\ub2c8\ub2e4."})]})},f=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2}];function p(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"usemediaquery",children:"useMediaQuery"})}),"\n",(0,o.jsx)(t.p,{children:"\ubbf8\ub514\uc5b4 \ucffc\ub9ac \ubb38\uc790\uc5f4\uc758 \ubd84\uc11d \uacb0\uacfc\ub97c \uc27d\uac8c \ud655\uc778 \ud560 \uc218 \uc788\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useMediaQuery/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"function useMediaQuery(mediaQueryString: string, defaultValue?: boolean): boolean\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useMediaQuery } from '@modern-kit/react';\n\nconst Example = () => {\n const isMatch = useMediaQuery('(min-width: 768px)');\n\n return (\n \n
\n {isMatch\n ? 'viewport \ub108\ube44\uac00 768px \uc774\uc0c1\uc785\ub2c8\ub2e4.'\n : 'viewport \ub108\ube44\uac00 768px \ubbf8\ub9cc\uc785\ub2c8\ub2e4.'}\n
\n
\n );\n};\n"})}),"\n","\n",(0,o.jsx)(a.A,{children:()=>(0,o.jsx)(l,{})})]})}function h(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(p,{...e})}):p(e)}},9010:(e,t,n)=>{n.d(t,{A:()=>i});n(4382);var r=n(3555),o=n(6206);function i(e){let{children:t,fallback:n}=e;return(0,r.A)()?(0,o.jsx)(o.Fragment,{children:t?.()}):n??null}},3267:(e,t,n)=>{n.d(t,{R:()=>c,x:()=>a});var r=n(4382);const o={},i=r.createContext(o);function c(e){const t=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:c(e.components),r.createElement(i.Provider,{value:t},e.children)}},1351:(e,t,n)=>{n.d(t,{M:()=>a});var r=n(6765),o=n(5907),i=n(9340);n(4382);const c=e=>!!e&&(0,i.i5)(e,"current");function a(e,t,n,i){const a=(0,r.p)(n);(0,o.E)((()=>{const n=c(e)?e.current:e;if(n)return n.addEventListener(t,a,i),()=>{n.removeEventListener(t,a,i)}}),[t,e,i,a])}},5907:(e,t,n)=>{n.d(t,{E:()=>i});var r=n(9340),o=n(4382);const i=(0,r.oc)()?o.useLayoutEffect:o.useEffect},9659:(e,t,n)=>{n.d(t,{U:()=>a});var r=n(9340),o=n(1351),i=n(4382);const c=(e,t)=>(0,r.oc)()?window.matchMedia(e).matches:null!=t&&t;function a(e,t){const[n,r]=(0,i.useState)(c(e,t)),a=(0,i.useCallback)((e=>r(e.matches)),[]);return(0,o.M)(window.matchMedia(e),"change",a),n}},6765:(e,t,n)=>{n.d(t,{p:()=>o});var r=n(4382);function o(e){const t=(0,r.useRef)(e);return t.current=e,(0,r.useCallback)(((...e)=>t.current(...e)),[])}},9340:(e,t,n)=>{function r(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{s(r.next(e))}catch(t){i(t)}}function a(e){try{s(r.throw(e))}catch(t){i(t)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((r=r.apply(e,t||[])).next())}))}n.d(t,{Et:()=>x,Fr:()=>a,Gp:()=>w,Ol:()=>M,Qd:()=>j,S$:()=>c,Tn:()=>v,Zp:()=>f,dK:()=>u,fl:()=>F,gD:()=>y,i5:()=>h,if:()=>p,l6:()=>k,lQ:()=>E,nS:()=>l,ni:()=>$,oc:()=>s}),"function"==typeof SuppressedError&&SuppressedError;const o={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};const i=(e,t)=>new Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function c(){return"undefined"==typeof window}function a(){if(c())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}function s(){return!c()}function u(e){return r(this,void 0,void 0,(function*(){if(!s())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const d=e=>r(void 0,void 0,void 0,(function*(){const t=yield fetch(e);return u(yield t.text())}));function l(e,t){var n;return r(this,void 0,void 0,(function*(){if(!s())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator))return d(e);if(!("write"in window.navigator.clipboard))return d(e);if(null!==(n=null==t?void 0:t.toText)&&void 0!==n&&n)return d(e);const c=yield function(e,t="png"){return new Promise(((n,c)=>{const a=new Image;a.onload=()=>r(this,void 0,void 0,(function*(){const e=document.createElement("canvas");e.width=a.width,e.height=a.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(a,0,0);const c=yield i(e,o[t]);n(c)}catch(r){console.error(`Failed to load image. message: ${r.mesaage}`),c(r)}})),a.onerror=()=>{c(new Error("Failed to load image"))},a.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[c.type]:c})]),c}catch(c){throw console.error(`Failed to copy to clipboard. message: ${c.message}`),c}}))}function f(){return r(this,void 0,void 0,(function*(){if(!s())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function p(){return r(this,void 0,void 0,(function*(){if(!s())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function h(e,t){return Object.prototype.hasOwnProperty.call(e,t)}const m=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i=0;i{if(e===t)return!0;if(x(e)&&x(t)&&isNaN(e)&&isNaN(t))return!0;if(v(e)&&v(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return m(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!g(o,t.get(r),n))return!1;return!0}return m(e,t,n)};function w(e,t){return g(e,t,new WeakMap)}function v(e){return"function"==typeof e}function y(e){return null==e}function x(e){return"number"==typeof e}function b(e){return!function(e){return Object(e)!==e}(e)}function j(e){return b(e)&&"[object Object]"===Object.prototype.toString.call(e)}function k(e){return e===window}function E(){}function M(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}function C(e){return Object.keys(e)}const S={days:864e5,hours:36e5,minutes:6e4,seconds:1e3};C(S);function F(e,t){if(!s())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}function $(e,t,n){if(!s())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=v(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}}}]);
\ No newline at end of file
diff --git a/assets/js/63f47a7c.23b9a51e.js b/assets/js/63f47a7c.23b9a51e.js
new file mode 100644
index 000000000..09d67eebd
--- /dev/null
+++ b/assets/js/63f47a7c.23b9a51e.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[6558],{2932:(e,n,t)=>{t.r(n),t.d(n,{Example:()=>f,assets:()=>l,contentTitle:()=>d,default:()=>v,frontMatter:()=>u,metadata:()=>r,toc:()=>p});const r=JSON.parse('{"id":"react/hooks/useEventListener","title":"useEventListener","description":"\uc9c0\uc815\ub41c \uc694\uc18c\uc5d0 \uc774\ubca4\ud2b8 \ub9ac\uc2a4\ub108\ub97c \ucd94\uac00\ud558\uace0, \ucef4\ud3ec\ub10c\ud2b8\uac00 \uc5b8\ub9c8\uc6b4\ud2b8\ub420 \ub54c \uc790\ub3d9\uc73c\ub85c \uc81c\uac70\ud569\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useEventListener.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useEventListener","permalink":"/modern-kit/docs/react/hooks/useEventListener","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useDocumentTitle","permalink":"/modern-kit/docs/react/hooks/useDocumentTitle"},"next":{"title":"useFileReader","permalink":"/modern-kit/docs/react/hooks/useFileReader"}}');var o=t(6206),i=t(3267),s=t(1351),c=t(4382),a=t(9010);const u={},d="useEventListener",l={},f=()=>{const e={button:"button",div:"div",p:"p",...(0,i.R)()},[n,t]=(0,c.useState)(0),r=(0,c.useRef)(null);return(0,s.M)(document,"click",(()=>{console.log(n)})),(0,s.M)(r,"click",(()=>{t(n+1)})),(0,o.jsxs)(e.div,{children:[(0,o.jsxs)(e.p,{children:["number: ",n]}),(0,o.jsx)(e.button,{ref:r,children:"\uc22b\uc790 \ub354\ud558\uae30"})]})},p=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function m(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.header,{children:(0,o.jsx)(n.h1,{id:"useeventlistener",children:"useEventListener"})}),"\n",(0,o.jsxs)(n.p,{children:["\uc9c0\uc815\ub41c \uc694\uc18c\uc5d0 ",(0,o.jsx)(n.code,{children:"\uc774\ubca4\ud2b8 \ub9ac\uc2a4\ub108\ub97c \ucd94\uac00"}),"\ud558\uace0, \ucef4\ud3ec\ub10c\ud2b8\uac00 \uc5b8\ub9c8\uc6b4\ud2b8\ub420 \ub54c ",(0,o.jsx)(n.code,{children:"\uc790\ub3d9\uc73c\ub85c \uc81c\uac70"}),"\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(n.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useEventListener/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(n.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"type EventListenerAvailableElement =\n | Window\n | Document\n | HTMLElement\n | SVGElement\n | MediaQueryList;\n\ntype TargetElement =\n | T\n | RefObject;\n"})}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"// Window Event based useEventListener interface\nfunction useEventListener(\n element: Window,\n type: K,\n listener: (event: WindowEventMap[K]) => void,\n options?: boolean | AddEventListenerOptions\n): void;\n\n// Document Event based useEventListener interface\nfunction useEventListener(\n element: Document,\n type: K,\n listener: (event: DocumentEventMap[K]) => void,\n options?: boolean | AddEventListenerOptions\n): void;\n\n// MediaQueryList Event based useEventListener interface\nfunction useEventListener(\n element: MediaQueryList,\n type: K,\n listener: (event: MediaQueryListEventMap[K]) => void,\n options?: boolean | AddEventListenerOptions\n): void;\n\n// Element Event based useEventListener interface\nfunction useEventListener<\n K extends keyof HTMLElementEventMap,\n T extends HTMLElement\n>(\n element: TargetElement,\n type: K,\n listener: (event: HTMLElementEventMap[K]) => void,\n options?: boolean | AddEventListenerOptions\n): void;\n\n// SVGElement Event based useEventListener interface\nfunction useEventListener<\n K extends keyof SVGElementEventMap,\n T extends SVGElement\n>(\n element: TargetElement,\n type: K,\n listener: (event: SVGElementEventMap[K]) => void,\n options?: boolean | AddEventListenerOptions\n): void;\n"})}),"\n",(0,o.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useState, useRef } from 'react';\nimport { useEventListener } from '@modern-kit/react';\n\nconst Example = () => {\n const [number, setNumber] = useState(0)\n const buttonRef = useRef(null);\n\n useEventListener(document, 'click', () => {\n console.log(number);\n })\n\n useEventListener(buttonRef, 'click', () => {\n setNumber(number + 1);\n })\n\n return (\n \n
number: {number}
\n
\n
\n );\n};\n"})}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(a.A,{children:()=>(0,o.jsx)(f,{})})]})}function v(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(m,{...e})}):m(e)}},9010:(e,n,t)=>{t.d(n,{A:()=>i});t(4382);var r=t(3555),o=t(6206);function i(e){let{children:n,fallback:t}=e;return(0,r.A)()?(0,o.jsx)(o.Fragment,{children:n?.()}):t??null}},3267:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>c});var r=t(4382);const o={},i=r.createContext(o);function s(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:s(e.components),r.createElement(i.Provider,{value:n},e.children)}},1351:(e,n,t)=>{t.d(n,{M:()=>c});var r=t(6765),o=t(5907),i=t(9340);t(4382);const s=e=>!!e&&(0,i.i5)(e,"current");function c(e,n,t,i){const c=(0,r.p)(t);(0,o.E)((()=>{const t=s(e)?e.current:e;if(t)return t.addEventListener(n,c,i),()=>{t.removeEventListener(n,c,i)}}),[n,e,i,c])}},5907:(e,n,t)=>{t.d(n,{E:()=>i});var r=t(9340),o=t(4382);const i=(0,r.oc)()?o.useLayoutEffect:o.useEffect},6765:(e,n,t)=>{t.d(n,{p:()=>o});var r=t(4382);function o(e){const n=(0,r.useRef)(e);return n.current=e,(0,r.useCallback)(((...e)=>n.current(...e)),[])}},9340:(e,n,t)=>{function r(e,n,t,r){return new(t||(t=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(n){i(n)}}function c(e){try{a(r.throw(e))}catch(n){i(n)}}function a(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(s,c)}a((r=r.apply(e,n||[])).next())}))}t.d(n,{Et:()=>w,Fr:()=>c,Gp:()=>E,Ol:()=>L,Qd:()=>x,S$:()=>s,Tn:()=>b,Zp:()=>f,dK:()=>u,fl:()=>S,gD:()=>g,i5:()=>m,if:()=>p,l6:()=>j,lQ:()=>k,nS:()=>l,ni:()=>O,oc:()=>a}),"function"==typeof SuppressedError&&SuppressedError;const o={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};const i=(e,n)=>new Promise(((t,r)=>{e.toBlob((e=>{e?t(e):r(new Error(`Failed to create blob with format ${n}`))}),n)}));function s(){return"undefined"==typeof window}function c(){if(s())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}function a(){return!s()}function u(e){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const n=document.createElement("textarea");n.value=e,n.style.opacity="0",document.body.appendChild(n),n.focus(),n.select();try{return document.execCommand("copy"),e}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}finally{document.body.removeChild(n)}}(e)}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}}))}const d=e=>r(void 0,void 0,void 0,(function*(){const n=yield fetch(e);return u(yield n.text())}));function l(e,n){var t;return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator))return d(e);if(!("write"in window.navigator.clipboard))return d(e);if(null!==(t=null==n?void 0:n.toText)&&void 0!==t&&t)return d(e);const s=yield function(e,n="png"){return new Promise(((t,s)=>{const c=new Image;c.onload=()=>r(this,void 0,void 0,(function*(){const e=document.createElement("canvas");e.width=c.width,e.height=c.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(c,0,0);const s=yield i(e,o[n]);t(s)}catch(r){console.error(`Failed to load image. message: ${r.mesaage}`),s(r)}})),c.onerror=()=>{s(new Error("Failed to load image"))},c.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[s.type]:s})]),s}catch(s){throw console.error(`Failed to copy to clipboard. message: ${s.message}`),s}}))}function f(){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function p(){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function m(e,n){return Object.prototype.hasOwnProperty.call(e,n)}const v=(e,n,t)=>{const r=Object.keys(e),o=Object.keys(n);if(r.length!==o.length)return!1;for(let i=0;i{if(e===n)return!0;if(w(e)&&w(n)&&isNaN(e)&&isNaN(n))return!0;if(b(e)&&b(n))return e.toString()===n.toString();if("object"!=typeof e||"object"!=typeof n||null===e||null===n)return!1;if(t.has(e)&&t.get(e)===n)return!0;if(t.set(e,n),e.constructor!==n.constructor)return!1;if(e instanceof Set){if(e.size!==n.size)return!1;const r=[...e],o=[...n];return v(r,o,t)}if(e instanceof Map){if(e.size!==n.size)return!1;for(const[r,o]of e)if(!n.has(r)||!h(o,n.get(r),t))return!1;return!0}return v(e,n,t)};function E(e,n){return h(e,n,new WeakMap)}function b(e){return"function"==typeof e}function g(e){return null==e}function w(e){return"number"==typeof e}function y(e){return!function(e){return Object(e)!==e}(e)}function x(e){return y(e)&&"[object Object]"===Object.prototype.toString.call(e)}function j(e){return e===window}function k(){}function L(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(n){throw new Error(`Failed to parse data: ${n}`)}}function M(e){return Object.keys(e)}const T={days:864e5,hours:36e5,minutes:6e4,seconds:1e3};M(T);function S(e,n){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(n)}catch(t){throw new Error(`Failed to remove key "${n}" from ${e}: ${t}`)}}function O(e,n,t){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=b(t)?t():t;r.setItem(n,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${n}" in ${e}: ${r}`)}}}}]);
\ No newline at end of file
diff --git a/assets/js/63f47a7c.f5e54242.js b/assets/js/63f47a7c.f5e54242.js
deleted file mode 100644
index cd8de8897..000000000
--- a/assets/js/63f47a7c.f5e54242.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[6558],{2932:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>f,assets:()=>d,contentTitle:()=>u,default:()=>m,frontMatter:()=>a,metadata:()=>r,toc:()=>h});const r=JSON.parse('{"id":"react/hooks/useEventListener","title":"useEventListener","description":"\uc9c0\uc815\ub41c \uc694\uc18c\uc5d0 \uc774\ubca4\ud2b8 \ub9ac\uc2a4\ub108\ub97c \ucd94\uac00\ud558\uace0, \ucef4\ud3ec\ub10c\ud2b8\uac00 \uc5b8\ub9c8\uc6b4\ud2b8\ub420 \ub54c \uc790\ub3d9\uc73c\ub85c \uc81c\uac70\ud569\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useEventListener.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useEventListener","permalink":"/modern-kit/docs/react/hooks/useEventListener","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useDocumentTitle","permalink":"/modern-kit/docs/react/hooks/useDocumentTitle"},"next":{"title":"useFileReader","permalink":"/modern-kit/docs/react/hooks/useFileReader"}}');var o=n(6206),i=n(3267),s=n(4027),c=n(4382),l=n(9010);const a={},u="useEventListener",d={},f=()=>{const e={button:"button",div:"div",p:"p",...(0,i.R)()},[t,n]=(0,c.useState)(0),r=(0,c.useRef)(null);return(0,s.ML)(document,"click",(()=>{console.log(t)})),(0,s.ML)(r,"click",(()=>{n(t+1)})),(0,o.jsxs)(e.div,{children:[(0,o.jsxs)(e.p,{children:["number: ",t]}),(0,o.jsx)(e.button,{ref:r,children:"\uc22b\uc790 \ub354\ud558\uae30"})]})},h=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function p(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"useeventlistener",children:"useEventListener"})}),"\n",(0,o.jsxs)(t.p,{children:["\uc9c0\uc815\ub41c \uc694\uc18c\uc5d0 ",(0,o.jsx)(t.code,{children:"\uc774\ubca4\ud2b8 \ub9ac\uc2a4\ub108\ub97c \ucd94\uac00"}),"\ud558\uace0, \ucef4\ud3ec\ub10c\ud2b8\uac00 \uc5b8\ub9c8\uc6b4\ud2b8\ub420 \ub54c ",(0,o.jsx)(t.code,{children:"\uc790\ub3d9\uc73c\ub85c \uc81c\uac70"}),"\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useEventListener/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"type EventListenerAvailableElement =\n | Window\n | Document\n | HTMLElement\n | SVGElement\n | MediaQueryList;\n\ntype TargetElement =\n | T\n | RefObject;\n"})}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"// Window Event based useEventListener interface\nfunction useEventListener(\n element: Window,\n type: K,\n listener: (event: WindowEventMap[K]) => void,\n options?: boolean | AddEventListenerOptions\n): void;\n\n// Document Event based useEventListener interface\nfunction useEventListener(\n element: Document,\n type: K,\n listener: (event: DocumentEventMap[K]) => void,\n options?: boolean | AddEventListenerOptions\n): void;\n\n// MediaQueryList Event based useEventListener interface\nfunction useEventListener(\n element: MediaQueryList,\n type: K,\n listener: (event: MediaQueryListEventMap[K]) => void,\n options?: boolean | AddEventListenerOptions\n): void;\n\n// Element Event based useEventListener interface\nfunction useEventListener<\n K extends keyof HTMLElementEventMap,\n T extends HTMLElement\n>(\n element: TargetElement,\n type: K,\n listener: (event: HTMLElementEventMap[K]) => void,\n options?: boolean | AddEventListenerOptions\n): void;\n\n// SVGElement Event based useEventListener interface\nfunction useEventListener<\n K extends keyof SVGElementEventMap,\n T extends SVGElement\n>(\n element: TargetElement,\n type: K,\n listener: (event: SVGElementEventMap[K]) => void,\n options?: boolean | AddEventListenerOptions\n): void;\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useState, useRef } from 'react';\nimport { useEventListener } from '@modern-kit/react';\n\nconst Example = () => {\n const [number, setNumber] = useState(0)\n const buttonRef = useRef(null);\n\n useEventListener(document, 'click', () => {\n console.log(number);\n })\n\n useEventListener(buttonRef, 'click', () => {\n setNumber(number + 1);\n })\n\n return (\n \n
number: {number}
\n
\n
\n );\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(l.A,{children:()=>(0,o.jsx)(f,{})})]})}function m(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(p,{...e})}):p(e)}},9010:(e,t,n)=>{n.d(t,{A:()=>i});n(4382);var r=n(3555),o=n(6206);function i(e){let{children:t,fallback:n}=e;return(0,r.A)()?(0,o.jsx)(o.Fragment,{children:t?.()}):n??null}},4027:(e,t,n)=>{n.d(t,{$$:()=>$e,$I:()=>oe,AE:()=>We,BL:()=>H,DX:()=>M,FT:()=>ct,Fo:()=>et,Hn:()=>it,I5:()=>je,JF:()=>Pe,K:()=>ae,K$:()=>ze,M0:()=>Oe,ML:()=>ne,Mj:()=>ye,Mk:()=>Ne,Mo:()=>ie,NT:()=>De,QV:()=>Qe,Ub:()=>xe,Ut:()=>Ce,W7:()=>Q,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>Xe,Zu:()=>le,_1:()=>Re,_g:()=>nt,aL:()=>z,aY:()=>Me,bB:()=>V,d7:()=>_,eG:()=>st,fN:()=>ce,fm:()=>q,gl:()=>$,hN:()=>Y,iD:()=>de,iQ:()=>Fe,jd:()=>se,lW:()=>at,oD:()=>J,oo:()=>Le,pL:()=>Z,qi:()=>ue,rN:()=>Te,tD:()=>ke,u8:()=>U,wY:()=>_e,xV:()=>F,xh:()=>tt,zy:()=>G});var r=n(6206),o=n(4382),i=n(3683),s=n(5086),c=n(7197),l=(n(1604),n(5938));function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function m(){return typeof window>"u"}function v(){return!m()}function g(e){return f(this,0,void 0,(function*(){if(!v())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const b=e=>f(void 0,0,void 0,(function*(){return g(yield(yield fetch(e)).text())}));function w(e,t){var n;return f(this,0,void 0,(function*(){if(!v())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return b(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const i=yield p(e,h[t]);n(i)}catch(i){console.error(`Failed to load image. message: ${i.mesaage}`),r(i)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i=0;i{if(e===t||S(e)&&S(t)&&isNaN(e)&&isNaN(t))return!0;if(k(e)&&k(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return y(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!E(o,t.get(r),n))return!1;return!0}return y(e,t,n)};function x(e,t){return E(e,t,new WeakMap)}function k(e){return"function"==typeof e}function S(e){return"number"==typeof e}function C(e){return!function(e){return Object(e)!==e}(e)}function j(){}function L(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const R=(...e)=>t=>e.forEach((e=>{if(k(e))e(t);else if(null!=e){e.current=t}}));function O(...e){return(0,o.useCallback)(R(...e),e)}const M=o.forwardRef(((e,t)=>{const{children:n}=e,i=a(e,["children"]),s=o.Children.toArray(n),c=s.find(N);if(c){const e=c.props.children,n=s.map((t=>t===c?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(T,Object.assign({},i,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(T,Object.assign({},i,{ref:t,children:n}))}));M.displayName="Slot";const T=o.forwardRef(((e,t)=>{const{children:n}=e,r=a(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),i):"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?R(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));T.displayName="SlotClone";const F=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function N(e){return o.isValidElement(e)&&e.type===F}var I="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const $=d(((e,t)=>{var{ratio:n,style:o,as:s="div",asChild:c=!1}=e,l=a(e,["ratio","style","as","asChild"]);const u=c?M:s,d=Object.assign({aspectRatio:n},o),f=c?l.className:i(I,l.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},l))})),P=()=>j,A=()=>!1,D=()=>!0;function V({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)(P,A,D)?e:t}function K(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const Y=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>K()?(0,r.jsx)(r.Fragment,{children:t}):e;function W(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function X(e){const t=W(e);(0,o.useEffect)((()=>()=>t()),[t])}function B(e,t=x){const[n,r]=(0,o.useState)(e),i=W(t);return(0,o.useEffect)((()=>{i(n,e)||r(e)}),[i,n,e]),n}function _(e,t,n){const r=W(e),i=B(n),c=(0,o.useMemo)((()=>(0,s.A)(r,t,i)),[r,t,i]);return X((()=>c.cancel())),c}const z=({children:e,capture:t,wait:n,options:r})=>{const i=o.Children.only(e),s=_(((...e)=>{const n=i?.props;if(n&&k(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(i,{[t]:s})};function H({onIntersectStart:e=j,onIntersectEnd:t=j,enabled:n=!0,calledOnce:r=!1,root:i=null,threshold:s=0,rootMargin:c="0px 0px 0px 0px"}){const l=(0,o.useRef)(0),a=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=W((([n],o)=>{if(!n)return;const i=n.target;n.isIntersecting?(a.current=!0,l.current+=1,e(n)):a.current&&(a.current=!1,l.current+=1,t(n)),r&&l.current>1&&o.unobserve(i)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:s,root:i,rootMargin:c}),u.current.observe(e))}),[n,s,i,c,d])}}const J=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:i,rootMargin:s}=e,c=a(e,["src","threshold","root","rootMargin"]);const{ref:l}=H({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:i,rootMargin:s});return(0,r.jsx)("img",Object.assign({ref:O(t,l)},c))}));J.displayName="LazyImage";const Q=(0,o.forwardRef)(((e,t)=>{var{width:n,height:i,fallback:s,className:c,style:l,duration:u="0.2s",onLoad:d}=e,f=a(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,p]=(0,o.useState)(!1),m=!h,v=(0,o.useMemo)((()=>({position:"relative",width:n,height:i})),[n,i]),g=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:m?0:1,transition:`opacity ${u}`},l)),[m,u,l]),b=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),w=c?`lazy-image-wrapper ${c}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:w,style:v,children:[m&&s,(0,r.jsx)(J,Object.assign({ref:t,width:n,height:i,style:g,onLoad:b},f))]})}));Q.displayName="FallbackLazyImage";const G=({condition:e,trueComponent:t,falseComponent:n})=>{const i=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:i?t:n})},U=({onScrollAction:e,children:t,root:n,threshold:o,enabled:i,triggerPosition:s="after",rootMargin:c="150px 0px"})=>{const{ref:l}=H({onIntersectStart:e,root:n,threshold:o,enabled:i,rootMargin:c});return(0,r.jsxs)(r.Fragment,{children:["before"===s&&(0,r.jsx)("div",{ref:l}),t,"after"===s&&(0,r.jsx)("div",{ref:l})]})},Z=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1}=e,c=a(e,["children","as","asChild"]);const l=s?M:i,{ref:u}=H(c);if(s&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(l,Object.assign({ref:R(t,u)},c,{children:n}))})),q=({items:e=[],itemKey:t,renderItem:n})=>{const i=(0,o.useCallback)(((e,n)=>function(e){return C(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},i(e,t))))})},ee=v()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=W(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),i=(0,o.useMemo)((()=>function(){if(m())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,i,(({target:t})=>{if(!r.current)return;const o=r.current,i=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!i&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1,onPointerDown:c,excludeRefs:l=[]}=e,u=a(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(c,{excludeRefs:l}),f=s?M:i;if(s&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:R(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const ie=({itemKey:e,items:t=[],separator:n,renderItem:i,separatorInterval:s=1,includeLastSeparator:c=!1})=>{const l=(0,o.useCallback)((e=>e===t.length-1?c:(e+1)%s==0),[c,s,t.length]);return(0,r.jsx)(q,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[i(e,t),l(t)&&n]})})},se=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ce=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function le(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function ae(e=!0){const t=k(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!i.current){i.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{i.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),i=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield g(e);return t(n),!0}catch{return t(null),!1}}))),[]),s=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield w(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!v())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),l=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!v())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:i,copyImage:s,readText:c,readContents:l}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",pe={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},me=e=>pe[e],ve=me("localStorage"),ge=e=>window.localStorage.getItem(e),be=e=>JSON.stringify(e),we=e=>(ve.subscribe(e),()=>{ve.unsubscribe(e)});function ye(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=k(n)?n():n,i=(0,o.useSyncExternalStore)(we,(()=>ge(t)),(()=>be(r)));return{state:(0,o.useMemo)((()=>i?L(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=ge(t),o=n?L(n):r,i=k(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(i)),ve.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),ve.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const Ee=(e,t)=>v()?window.matchMedia(e).matches:t??!1;function xe(e,t){const[n,r]=(0,o.useState)(Ee(e,t)),i=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",i),n}function ke(){return xe("(prefers-color-scheme: dark)")?"dark":"light"}const Se="color-scheme";function Ce({defaultValue:e,key:t=Se,shouldSetBodyClass:n=!1}={}){const r=ke(),i=k(e)?e():e,{state:s,setState:c}=ye({key:t,initialValue:i??r}),l=(0,o.useCallback)((()=>{c((e=>"dark"===e?"light":"dark"))}),[c]),a=(0,o.useCallback)((()=>{c("dark")}),[c]),u=(0,o.useCallback)((()=>{c("light")}),[c]),d=(0,o.useCallback)((()=>{c(r)}),[c,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(s),()=>{n&&document.body.classList.remove(s)})),[s,n]),{colorScheme:s,preferredColorScheme:r,setToggleMode:l,setDarkMode:a,setLightMode:u,setPreferredMode:d}}function je(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),i=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),s=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:i,reset:s}}function Le({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,i]=(0,o.useState)(t),s=r0,l=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),a=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const s=l(e,t);o&&o({prev:r,next:s}),i(s)}),[n,r,l]),u=(0,o.useCallback)((e=>{a("nextStep",!s,e)}),[s,a]),d=(0,o.useCallback)((e=>{a("prevStep",!c,e)}),[c,a]),f=(0,o.useCallback)(((t,n)=>{const o=k(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void i(t);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),i(t)}),[r,t]);return{currentStep:r,hasNextStep:s,hasPrevStep:c,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Re(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:i,resetStep:s}=Le({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:i,resetIndex:s}}function Oe(e,t,n={}){const[r,i]=(0,o.useState)(e);return[r,_(i,t,n)]}function Me(e,t={}){const[n,r]=(0,o.useState)(""),[i,s]=Oe("",e,t);return{value:n,debouncedValue:i,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),s(t)}),[s]),onReset:(0,o.useCallback)((()=>{r(""),s("")}),[s])}}function Te(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Fe({onFocus:e=j,onBlur:t=j}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=W((t=>{r(!0),e(t)})),c=W((e=>{r(!1),t(e)})),l=(0,o.useCallback)((()=>{i.current&&(i.current.focus(),r(!0))}),[]);return ne(i,"focus",s),ne(i,"blur",c),{ref:i,isFocus:n,setFocus:l}}function Ne({onEnter:e=j,onLeave:t=j}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=W((t=>{r(!0),e(t)})),c=W((e=>{r(!1),t(e)}));return ne(i,"mouseenter",s),ne(i,"mouseleave",c),{ref:i,isHovered:n}}const Ie=e=>{var t;return S(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function $e(e,t){const n=(0,o.useRef)(),r=W(e),{delay:i,enabled:s}=Ie(t),c=(0,o.useCallback)((()=>{n.current=window.setInterval(r,i)}),[r,i]),l=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),c()}),[l,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>l()}),[l,c,s,i]),{set:c,reset:a,clear:l}}function Pe({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),i=W((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];k(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",i),()=>t.removeEventListener("keydown",i)}),[e,i]),r}const Ae={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function De(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)(Ae),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:l}=t;let a=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();a=i-t.left,u=s-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:l,elementRelativeX:a,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const Ve=()=>navigator.onLine,Ke=()=>!0,Ye=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function We({onlineAction:e=j,offlineAction:t=j}={}){const n=W((n=>Ye(n,e,t)));return(0,o.useSyncExternalStore)(n,Ve,Ke)}function Xe(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const Be={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function _e(e=j){const[t,n]=(0,o.useState)(Be),r=(0,o.useRef)(null),i=W((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(i);return t.observe(e),()=>{t.unobserve(e)}}),[i]),{ref:r,contentRect:t}}function ze({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),i=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>i())),[e,r,i]),{ref:t,lock:r,unlock:i}}const He=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,Je=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:i=0,alignY:s="start",alignX:c="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+i+He(window.innerHeight,r.height,s),left:r.left+window.scrollX+o+He(window.innerWidth,r.width,c)};const l=e.getBoundingClientRect();return{top:r.top-l.top+e.scrollTop+i+He(l.height,r.height,s),left:r.left-l.left+e.scrollLeft+o+He(l.width,r.width,c)}};function Qe(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:i,top:s}=Je(r,t,n);r.scrollTo({top:s,left:i,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ge=me("sessionStorage"),Ue=e=>window.sessionStorage.getItem(e),Ze=e=>JSON.stringify(e),qe=e=>(Ge.subscribe(e),()=>{Ge.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=k(n)?n():n,i=(0,o.useSyncExternalStore)(qe,(()=>Ue(t)),(()=>Ze(r)));return{state:(0,o.useMemo)((()=>i?L(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=Ue(t),o=n?L(n):r,i=k(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(i)),Ge.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ge.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:i}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[s,c]=(0,o.useState)(n),l=(0,o.useCallback)((e=>{c((t=>{const n=k(e)?e(t):e;return r&&i&&function(e,t,n){if(!v())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=k(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,i,n),n}))}),[r,i]),a=(0,o.useCallback)((()=>{r&&i&&function(e,t){if(!v())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,i),c(null)}),[r,i]);return Object.assign({state:s,setState:l,clearState:a},Le(e))}function nt(e,t,n={}){const r=W(e),i=B(n),s=(0,o.useMemo)((()=>(0,c.A)(r,t,i)),[r,t,i]);return X((()=>s.cancel())),s}const rt=e=>{var t;return S(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=W(e),{delay:i,enabled:s}=rt(t),c=(0,o.useCallback)((()=>{n.current=setTimeout(r,i)}),[r,i]),l=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),c()}),[l,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>l()}),[c,l,i,s]),{set:c,reset:a,clear:l}}function it(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function st(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new l.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function ct({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const lt={width:null,height:null};function at({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>m()?lt:{width:window.innerWidth,height:window.innerHeight})),r=_(n,e),i=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",i),t}function ut(e,t,n){const{delay:r,enabled:i}=rt(t),{set:s,reset:c,clear:l}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!i||c()}),[r,i,c,...n]),{set:s,reset:c,clear:l}}}}]);
\ No newline at end of file
diff --git a/assets/js/67c089fb.04be0bd6.js b/assets/js/67c089fb.04be0bd6.js
deleted file mode 100644
index 7c18dce5b..000000000
--- a/assets/js/67c089fb.04be0bd6.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[4146],{5271:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>d,assets:()=>u,contentTitle:()=>l,default:()=>p,frontMatter:()=>a,metadata:()=>r,toc:()=>f});const r=JSON.parse('{"id":"react/hooks/useDebounce","title":"useDebounce","description":"debounce\ub97c \uc27d\uac8c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useDebounce.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useDebounce","permalink":"/modern-kit/docs/react/hooks/useDebounce","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useCycleList","permalink":"/modern-kit/docs/react/hooks/useCycleList"},"next":{"title":"useDebouncedInputValue","permalink":"/modern-kit/docs/react/hooks/useDebouncedInputValue"}}');var o=n(6206),s=n(3267),i=n(4382),c=n(4027);const a={},l="useDebounce",u={},d=()=>{const e={button:"button",div:"div",p:"p",...(0,s.R)()},[t,n]=(0,i.useState)(1),[r,a]=(0,i.useState)(1),l=(0,c.d7)((()=>{a(r+1)}),1e3);return(0,o.jsxs)(e.div,{children:[(0,o.jsxs)(e.div,{style:{display:"flex"},children:[(0,o.jsx)(e.button,{onClick:()=>{n(t+1)},children:"\ubc84\ud2bc \ud074\ub9ad"}),(0,o.jsx)(e.div,{style:{width:"50px"}}),(0,o.jsx)(e.button,{onClick:l,children:"debounce \ubc84\ud2bc \ud074\ub9ad"})]}),(0,o.jsxs)(e.div,{children:[(0,o.jsxs)(e.p,{children:["count: ",t]}),(0,o.jsxs)(e.p,{children:["debouncedCount: ",r]})]})]})},f=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function h(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"usedebounce",children:"useDebounce"})}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"debounce"}),"\ub97c \uc27d\uac8c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useDebounce/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"// lodash-es DebounceSettings\n// https://www.geeksforgeeks.org/lodash-_-debounce-method/\ninterface DebounceSettings {\n leading?: boolean | undefined;\n maxWait?: number | undefined;\n trailing?: boolean | undefined;\n}\n\ntype DebounceParameters = Parameters;\ntype DebounceReturnType = ReturnType<\n typeof debounce\n>;\n"})}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"function useDebounce any>(\n callback: T,\n wait: DebounceParameters[1], // number\n options?: DebounceParameters[2] // DebounceSettings\n): DebounceReturnType;\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useState } from 'react';\nimport { useDebounce } from '@modern-kit/react';\n\nconst Example = () => {\n const [count, setCount] = useState(1);\n const [debouncedCount, setDebouncedCount] = useState(1);\n\n const countUp = () => {\n setCount(count + 1);\n };\n\n const debouncedCountUp = useDebounce(() => {\n setDebouncedCount(debouncedCount + 1);\n }, 1000);\n\n return (\n \n
\n
\n
\n
\n
\n
\n
count: {count}
\n
debouncedCount: {debouncedCount}
\n
\n
\n );\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(d,{})]})}function p(e={}){const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(h,{...e})}):h(e)}},4027:(e,t,n)=>{n.d(t,{$$:()=>Te,$I:()=>oe,AE:()=>We,BL:()=>J,DX:()=>I,FT:()=>ct,Fo:()=>et,Hn:()=>st,I5:()=>je,JF:()=>Me,K:()=>le,K$:()=>Ue,M0:()=>De,ML:()=>ne,Mj:()=>ye,Mk:()=>Ne,Mo:()=>se,NT:()=>Ye,QV:()=>Ke,Ub:()=>ke,Ut:()=>Ee,W7:()=>K,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>_e,Zu:()=>ae,_1:()=>Oe,_g:()=>nt,aL:()=>U,aY:()=>Ie,bB:()=>V,d7:()=>B,eG:()=>it,fN:()=>ce,fm:()=>G,gl:()=>T,hN:()=>A,iD:()=>de,iQ:()=>Le,jd:()=>ie,lW:()=>lt,oD:()=>H,oo:()=>Re,pL:()=>q,qi:()=>ue,rN:()=>Fe,tD:()=>Ce,u8:()=>Q,wY:()=>Be,xV:()=>L,xh:()=>tt,zy:()=>Z});var r=n(6206),o=n(4382),s=n(3683),i=n(5086),c=n(7197),a=(n(1604),n(5938));function l(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function b(){return typeof window>"u"}function m(){return!b()}function g(e){return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const w=e=>f(void 0,0,void 0,(function*(){return g(yield(yield fetch(e)).text())}));function v(e,t){var n;return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return w(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const s=yield p(e,h[t]);n(s)}catch(s){console.error(`Failed to load image. message: ${s.mesaage}`),r(s)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let s=0;s{if(e===t||S(e)&&S(t)&&isNaN(e)&&isNaN(t))return!0;if(C(e)&&C(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return y(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!x(o,t.get(r),n))return!1;return!0}return y(e,t,n)};function k(e,t){return x(e,t,new WeakMap)}function C(e){return"function"==typeof e}function S(e){return"number"==typeof e}function E(e){return!function(e){return Object(e)!==e}(e)}function j(){}function R(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const O=(...e)=>t=>e.forEach((e=>{if(C(e))e(t);else if(null!=e){e.current=t}}));function D(...e){return(0,o.useCallback)(O(...e),e)}const I=o.forwardRef(((e,t)=>{const{children:n}=e,s=l(e,["children"]),i=o.Children.toArray(n),c=i.find(N);if(c){const e=c.props.children,n=i.map((t=>t===c?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(F,Object.assign({},s,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(F,Object.assign({},s,{ref:t,children:n}))}));I.displayName="Slot";const F=o.forwardRef(((e,t)=>{const{children:n}=e,r=l(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...e)=>{s(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),s):"className"===r&&(n[r]=[o,s].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?O(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));F.displayName="SlotClone";const L=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function N(e){return o.isValidElement(e)&&e.type===L}var P="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const T=d(((e,t)=>{var{ratio:n,style:o,as:i="div",asChild:c=!1}=e,a=l(e,["ratio","style","as","asChild"]);const u=c?I:i,d=Object.assign({aspectRatio:n},o),f=c?a.className:s(P,a.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},a))})),M=()=>j,$=()=>!1,Y=()=>!0;function V({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)(M,$,Y)?e:t}function X(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const A=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>X()?(0,r.jsx)(r.Fragment,{children:t}):e;function W(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function _(e){const t=W(e);(0,o.useEffect)((()=>()=>t()),[t])}function z(e,t=k){const[n,r]=(0,o.useState)(e),s=W(t);return(0,o.useEffect)((()=>{s(n,e)||r(e)}),[s,n,e]),n}function B(e,t,n){const r=W(e),s=z(n),c=(0,o.useMemo)((()=>(0,i.A)(r,t,s)),[r,t,s]);return _((()=>c.cancel())),c}const U=({children:e,capture:t,wait:n,options:r})=>{const s=o.Children.only(e),i=B(((...e)=>{const n=s?.props;if(n&&C(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(s,{[t]:i})};function J({onIntersectStart:e=j,onIntersectEnd:t=j,enabled:n=!0,calledOnce:r=!1,root:s=null,threshold:i=0,rootMargin:c="0px 0px 0px 0px"}){const a=(0,o.useRef)(0),l=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=W((([n],o)=>{if(!n)return;const s=n.target;n.isIntersecting?(l.current=!0,a.current+=1,e(n)):l.current&&(l.current=!1,a.current+=1,t(n)),r&&a.current>1&&o.unobserve(s)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:i,root:s,rootMargin:c}),u.current.observe(e))}),[n,i,s,c,d])}}const H=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:s,rootMargin:i}=e,c=l(e,["src","threshold","root","rootMargin"]);const{ref:a}=J({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:s,rootMargin:i});return(0,r.jsx)("img",Object.assign({ref:D(t,a)},c))}));H.displayName="LazyImage";const K=(0,o.forwardRef)(((e,t)=>{var{width:n,height:s,fallback:i,className:c,style:a,duration:u="0.2s",onLoad:d}=e,f=l(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,p]=(0,o.useState)(!1),b=!h,m=(0,o.useMemo)((()=>({position:"relative",width:n,height:s})),[n,s]),g=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:b?0:1,transition:`opacity ${u}`},a)),[b,u,a]),w=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),v=c?`lazy-image-wrapper ${c}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:v,style:m,children:[b&&i,(0,r.jsx)(H,Object.assign({ref:t,width:n,height:s,style:g,onLoad:w},f))]})}));K.displayName="FallbackLazyImage";const Z=({condition:e,trueComponent:t,falseComponent:n})=>{const s=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:s?t:n})},Q=({onScrollAction:e,children:t,root:n,threshold:o,enabled:s,triggerPosition:i="after",rootMargin:c="150px 0px"})=>{const{ref:a}=J({onIntersectStart:e,root:n,threshold:o,enabled:s,rootMargin:c});return(0,r.jsxs)(r.Fragment,{children:["before"===i&&(0,r.jsx)("div",{ref:a}),t,"after"===i&&(0,r.jsx)("div",{ref:a})]})},q=d(((e,t)=>{var{children:n,as:s="div",asChild:i=!1}=e,c=l(e,["children","as","asChild"]);const a=i?I:s,{ref:u}=J(c);if(i&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(a,Object.assign({ref:O(t,u)},c,{children:n}))})),G=({items:e=[],itemKey:t,renderItem:n})=>{const s=(0,o.useCallback)(((e,n)=>function(e){return E(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},s(e,t))))})},ee=m()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=W(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),s=(0,o.useMemo)((()=>function(){if(b())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,s,(({target:t})=>{if(!r.current)return;const o=r.current,s=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!s&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:s="div",asChild:i=!1,onPointerDown:c,excludeRefs:a=[]}=e,u=l(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(c,{excludeRefs:a}),f=i?I:s;if(i&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:O(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const se=({itemKey:e,items:t=[],separator:n,renderItem:s,separatorInterval:i=1,includeLastSeparator:c=!1})=>{const a=(0,o.useCallback)((e=>e===t.length-1?c:(e+1)%i==0),[c,i,t.length]);return(0,r.jsx)(G,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[s(e,t),a(t)&&n]})})},ie=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ce=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function ae(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function le(e=!0){const t=C(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!s.current){s.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{s.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),s=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield g(e);return t(n),!0}catch{return t(null),!1}}))),[]),i=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield v(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),a=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:s,copyImage:i,readText:c,readContents:a}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",pe={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},be=e=>pe[e],me=be("localStorage"),ge=e=>window.localStorage.getItem(e),we=e=>JSON.stringify(e),ve=e=>(me.subscribe(e),()=>{me.unsubscribe(e)});function ye(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=C(n)?n():n,s=(0,o.useSyncExternalStore)(ve,(()=>ge(t)),(()=>we(r)));return{state:(0,o.useMemo)((()=>s?R(s):r),[s,r]),setState:(0,o.useCallback)((e=>{try{const n=ge(t),o=n?R(n):r,s=C(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(s)),me.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),me.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const xe=(e,t)=>m()?window.matchMedia(e).matches:t??!1;function ke(e,t){const[n,r]=(0,o.useState)(xe(e,t)),s=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",s),n}function Ce(){return ke("(prefers-color-scheme: dark)")?"dark":"light"}const Se="color-scheme";function Ee({defaultValue:e,key:t=Se,shouldSetBodyClass:n=!1}={}){const r=Ce(),s=C(e)?e():e,{state:i,setState:c}=ye({key:t,initialValue:s??r}),a=(0,o.useCallback)((()=>{c((e=>"dark"===e?"light":"dark"))}),[c]),l=(0,o.useCallback)((()=>{c("dark")}),[c]),u=(0,o.useCallback)((()=>{c("light")}),[c]),d=(0,o.useCallback)((()=>{c(r)}),[c,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(i),()=>{n&&document.body.classList.remove(i)})),[i,n]),{colorScheme:i,preferredColorScheme:r,setToggleMode:a,setDarkMode:l,setLightMode:u,setPreferredMode:d}}function je(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),s=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),i=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:s,reset:i}}function Re({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,s]=(0,o.useState)(t),i=r0,a=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),l=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const i=a(e,t);o&&o({prev:r,next:i}),s(i)}),[n,r,a]),u=(0,o.useCallback)((e=>{l("nextStep",!i,e)}),[i,l]),d=(0,o.useCallback)((e=>{l("prevStep",!c,e)}),[c,l]),f=(0,o.useCallback)(((t,n)=>{const o=C(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void s(t);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),s(t)}),[r,t]);return{currentStep:r,hasNextStep:i,hasPrevStep:c,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Oe(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:s,resetStep:i}=Re({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:s,resetIndex:i}}function De(e,t,n={}){const[r,s]=(0,o.useState)(e);return[r,B(s,t,n)]}function Ie(e,t={}){const[n,r]=(0,o.useState)(""),[s,i]=De("",e,t);return{value:n,debouncedValue:s,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),i(t)}),[i]),onReset:(0,o.useCallback)((()=>{r(""),i("")}),[i])}}function Fe(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Le({onFocus:e=j,onBlur:t=j}={}){const[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(null),i=W((t=>{r(!0),e(t)})),c=W((e=>{r(!1),t(e)})),a=(0,o.useCallback)((()=>{s.current&&(s.current.focus(),r(!0))}),[]);return ne(s,"focus",i),ne(s,"blur",c),{ref:s,isFocus:n,setFocus:a}}function Ne({onEnter:e=j,onLeave:t=j}={}){const[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(null),i=W((t=>{r(!0),e(t)})),c=W((e=>{r(!1),t(e)}));return ne(s,"mouseenter",i),ne(s,"mouseleave",c),{ref:s,isHovered:n}}const Pe=e=>{var t;return S(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function Te(e,t){const n=(0,o.useRef)(),r=W(e),{delay:s,enabled:i}=Pe(t),c=(0,o.useCallback)((()=>{n.current=window.setInterval(r,s)}),[r,s]),a=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{a(),c()}),[a,c]);return(0,o.useEffect)((()=>{if(!(s<0)&&i)return c(),()=>a()}),[a,c,i,s]),{set:c,reset:l,clear:a}}function Me({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),s=W((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];C(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",s),()=>t.removeEventListener("keydown",s)}),[e,s]),r}const $e={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function Ye(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)($e),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:s,clientY:i,pageX:c,pageY:a}=t;let l=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();l=s-t.left,u=i-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:s,clientY:i,pageX:c,pageY:a,elementRelativeX:l,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const Ve=()=>navigator.onLine,Xe=()=>!0,Ae=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function We({onlineAction:e=j,offlineAction:t=j}={}){const n=W((n=>Ae(n,e,t)));return(0,o.useSyncExternalStore)(n,Ve,Xe)}function _e(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const ze={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Be(e=j){const[t,n]=(0,o.useState)(ze),r=(0,o.useRef)(null),s=W((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(s);return t.observe(e),()=>{t.unobserve(e)}}),[s]),{ref:r,contentRect:t}}function Ue({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),s=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>s())),[e,r,s]),{ref:t,lock:r,unlock:s}}const Je=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,He=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:s=0,alignY:i="start",alignX:c="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+s+Je(window.innerHeight,r.height,i),left:r.left+window.scrollX+o+Je(window.innerWidth,r.width,c)};const a=e.getBoundingClientRect();return{top:r.top-a.top+e.scrollTop+s+Je(a.height,r.height,i),left:r.left-a.left+e.scrollLeft+o+Je(a.width,r.width,c)}};function Ke(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:s,top:i}=He(r,t,n);r.scrollTo({top:i,left:s,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ze=be("sessionStorage"),Qe=e=>window.sessionStorage.getItem(e),qe=e=>JSON.stringify(e),Ge=e=>(Ze.subscribe(e),()=>{Ze.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=C(n)?n():n,s=(0,o.useSyncExternalStore)(Ge,(()=>Qe(t)),(()=>qe(r)));return{state:(0,o.useMemo)((()=>s?R(s):r),[s,r]),setState:(0,o.useCallback)((e=>{try{const n=Qe(t),o=n?R(n):r,s=C(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(s)),Ze.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ze.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:s}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[i,c]=(0,o.useState)(n),a=(0,o.useCallback)((e=>{c((t=>{const n=C(e)?e(t):e;return r&&s&&function(e,t,n){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=C(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,s,n),n}))}),[r,s]),l=(0,o.useCallback)((()=>{r&&s&&function(e,t){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,s),c(null)}),[r,s]);return Object.assign({state:i,setState:a,clearState:l},Re(e))}function nt(e,t,n={}){const r=W(e),s=z(n),i=(0,o.useMemo)((()=>(0,c.A)(r,t,s)),[r,t,s]);return _((()=>i.cancel())),i}const rt=e=>{var t;return S(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=W(e),{delay:s,enabled:i}=rt(t),c=(0,o.useCallback)((()=>{n.current=setTimeout(r,s)}),[r,s]),a=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{a(),c()}),[a,c]);return(0,o.useEffect)((()=>{if(!(s<0)&&i)return c(),()=>a()}),[c,a,s,i]),{set:c,reset:l,clear:a}}function st(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function it(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new a.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function ct({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const at={width:null,height:null};function lt({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>b()?at:{width:window.innerWidth,height:window.innerHeight})),r=B(n,e),s=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",s),t}function ut(e,t,n){const{delay:r,enabled:s}=rt(t),{set:i,reset:c,clear:a}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!s||c()}),[r,s,c,...n]),{set:i,reset:c,clear:a}}}}]);
\ No newline at end of file
diff --git a/assets/js/67c089fb.835c1131.js b/assets/js/67c089fb.835c1131.js
new file mode 100644
index 000000000..f86def8a8
--- /dev/null
+++ b/assets/js/67c089fb.835c1131.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[4146],{5271:(e,n,t)=>{t.r(n),t.d(n,{Example:()=>l,assets:()=>d,contentTitle:()=>a,default:()=>b,frontMatter:()=>s,metadata:()=>o,toc:()=>f});const o=JSON.parse('{"id":"react/hooks/useDebounce","title":"useDebounce","description":"debounce\ub97c \uc27d\uac8c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useDebounce.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useDebounce","permalink":"/modern-kit/docs/react/hooks/useDebounce","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useCycleList","permalink":"/modern-kit/docs/react/hooks/useCycleList"},"next":{"title":"useDebouncedInputValue","permalink":"/modern-kit/docs/react/hooks/useDebouncedInputValue"}}');var r=t(6206),i=t(3267),c=t(4382),u=t(5115);const s={},a="useDebounce",d={},l=()=>{const e={button:"button",div:"div",p:"p",...(0,i.R)()},[n,t]=(0,c.useState)(1),[o,s]=(0,c.useState)(1),a=(0,u.d)((()=>{s(o+1)}),1e3);return(0,r.jsxs)(e.div,{children:[(0,r.jsxs)(e.div,{style:{display:"flex"},children:[(0,r.jsx)(e.button,{onClick:()=>{t(n+1)},children:"\ubc84\ud2bc \ud074\ub9ad"}),(0,r.jsx)(e.div,{style:{width:"50px"}}),(0,r.jsx)(e.button,{onClick:a,children:"debounce \ubc84\ud2bc \ud074\ub9ad"})]}),(0,r.jsxs)(e.div,{children:[(0,r.jsxs)(e.p,{children:["count: ",n]}),(0,r.jsxs)(e.p,{children:["debouncedCount: ",o]})]})]})},f=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function p(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.header,{children:(0,r.jsx)(n.h1,{id:"usedebounce",children:"useDebounce"})}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"debounce"}),"\ub97c \uc27d\uac8c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."]}),"\n",(0,r.jsx)("br",{}),"\n",(0,r.jsx)(n.h2,{id:"code",children:"Code"}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useDebounce/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,r.jsx)(n.h2,{id:"interface",children:"Interface"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"// lodash-es DebounceSettings\n// https://www.geeksforgeeks.org/lodash-_-debounce-method/\ninterface DebounceSettings {\n leading?: boolean | undefined;\n maxWait?: number | undefined;\n trailing?: boolean | undefined;\n}\n\ntype DebounceParameters = Parameters;\ntype DebounceReturnType = ReturnType<\n typeof debounce\n>;\n"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"function useDebounce any>(\n callback: T,\n wait: DebounceParameters[1], // number\n options?: DebounceParameters[2] // DebounceSettings\n): DebounceReturnType;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useState } from 'react';\nimport { useDebounce } from '@modern-kit/react';\n\nconst Example = () => {\n const [count, setCount] = useState(1);\n const [debouncedCount, setDebouncedCount] = useState(1);\n\n const countUp = () => {\n setCount(count + 1);\n };\n\n const debouncedCountUp = useDebounce(() => {\n setDebouncedCount(debouncedCount + 1);\n }, 1000);\n\n return (\n \n
\n
\n
\n
\n
\n
\n
count: {count}
\n
debouncedCount: {debouncedCount}
\n
\n
\n );\n};\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n","\n",(0,r.jsx)(l,{})]})}function b(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},3267:(e,n,t)=>{t.d(n,{R:()=>c,x:()=>u});var o=t(4382);const r={},i=o.createContext(r);function c(e){const n=o.useContext(i);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function u(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:c(e.components),o.createElement(i.Provider,{value:n},e.children)}},5115:(e,n,t)=>{t.d(n,{d:()=>s});var o=t(4382),r=t(5086),i=t(3311),c=t(6765),u=t(5423);function s(e,n,t){const s=(0,c.p)(e),a=(0,u.B)(t),d=(0,o.useMemo)((()=>(0,r.A)(s,n,a)),[s,n,a]);return(0,i.i)((()=>d.cancel())),d}},6765:(e,n,t)=>{t.d(n,{p:()=>r});var o=t(4382);function r(e){const n=(0,o.useRef)(e);return n.current=e,(0,o.useCallback)(((...e)=>n.current(...e)),[])}},5423:(e,n,t)=>{t.d(n,{B:()=>c});var o=t(4382),r=t(6765),i=t(9340);function c(e,n=i.Gp){const[t,c]=(0,o.useState)(e),u=(0,r.p)(n);return(0,o.useEffect)((()=>{u(t,e)||c(e)}),[u,t,e]),t}},3311:(e,n,t)=>{t.d(n,{i:()=>i});var o=t(6765),r=t(4382);function i(e){const n=(0,o.p)(e);(0,r.useEffect)((()=>()=>n()),[n])}},5086:(e,n,t)=>{t.d(n,{A:()=>N});var o=t(322);const r="object"==typeof global&&global&&global.Object===Object&&global;var i="object"==typeof self&&self&&self.Object===Object&&self;const c=r||i||Function("return this")();const u=function(){return c.Date.now()};var s=/\s/;const a=function(e){for(var n=e.length;n--&&s.test(e.charAt(n)););return n};var d=/^\s+/;const l=function(e){return e?e.slice(0,a(e)+1).replace(d,""):e};const f=c.Symbol;var p=Object.prototype,b=p.hasOwnProperty,h=p.toString,m=f?f.toStringTag:void 0;const v=function(e){var n=b.call(e,m),t=e[m];try{e[m]=void 0;var o=!0}catch(i){}var r=h.call(e);return o&&(n?e[m]=t:delete e[m]),r};var g=Object.prototype.toString;const y=function(e){return g.call(e)};var w=f?f.toStringTag:void 0;const x=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":w&&w in Object(e)?v(e):y(e)};const j=function(e){return null!=e&&"object"==typeof e};const k=function(e){return"symbol"==typeof e||j(e)&&"[object Symbol]"==x(e)};var C=/^[-+]0x[0-9a-f]+$/i,S=/^0b[01]+$/i,D=/^0o[0-7]+$/i,E=parseInt;const O=function(e){if("number"==typeof e)return e;if(k(e))return NaN;if((0,o.A)(e)){var n="function"==typeof e.valueOf?e.valueOf():e;e=(0,o.A)(n)?n+"":n}if("string"!=typeof e)return 0===e?e:+e;e=l(e);var t=S.test(e);return t||D.test(e)?E(e.slice(2),t?2:8):C.test(e)?NaN:+e};var T=Math.max,$=Math.min;const N=function(e,n,t){var r,i,c,s,a,d,l=0,f=!1,p=!1,b=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function h(n){var t=r,o=i;return r=i=void 0,l=n,s=e.apply(o,t)}function m(e){var t=e-d;return void 0===d||t>=n||t<0||p&&e-l>=c}function v(){var e=u();if(m(e))return g(e);a=setTimeout(v,function(e){var t=n-(e-d);return p?$(t,c-(e-l)):t}(e))}function g(e){return a=void 0,b&&r?h(e):(r=i=void 0,s)}function y(){var e=u(),t=m(e);if(r=arguments,i=this,d=e,t){if(void 0===a)return function(e){return l=e,a=setTimeout(v,n),f?h(e):s}(d);if(p)return clearTimeout(a),a=setTimeout(v,n),h(d)}return void 0===a&&(a=setTimeout(v,n)),s}return n=O(n)||0,(0,o.A)(t)&&(f=!!t.leading,c=(p="maxWait"in t)?T(O(t.maxWait)||0,n):c,b="trailing"in t?!!t.trailing:b),y.cancel=function(){void 0!==a&&clearTimeout(a),l=0,r=d=i=a=void 0},y.flush=function(){return void 0===a?s:g(u())},y}},322:(e,n,t)=>{t.d(n,{A:()=>o});const o=function(e){var n=typeof e;return null!=e&&("object"==n||"function"==n)}},9340:(e,n,t)=>{function o(e,n,t,o){return new(t||(t=Promise))((function(r,i){function c(e){try{s(o.next(e))}catch(n){i(n)}}function u(e){try{s(o.throw(e))}catch(n){i(n)}}function s(e){var n;e.done?r(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(c,u)}s((o=o.apply(e,n||[])).next())}))}t.d(n,{Et:()=>w,Fr:()=>u,Gp:()=>v,Ol:()=>S,Qd:()=>j,S$:()=>c,Tn:()=>g,Zp:()=>f,dK:()=>a,fl:()=>O,gD:()=>y,i5:()=>b,if:()=>p,l6:()=>k,lQ:()=>C,nS:()=>l,ni:()=>T,oc:()=>s}),"function"==typeof SuppressedError&&SuppressedError;const r={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};const i=(e,n)=>new Promise(((t,o)=>{e.toBlob((e=>{e?t(e):o(new Error(`Failed to create blob with format ${n}`))}),n)}));function c(){return"undefined"==typeof window}function u(){if(c())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}function s(){return!c()}function a(e){return o(this,void 0,void 0,(function*(){if(!s())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const n=document.createElement("textarea");n.value=e,n.style.opacity="0",document.body.appendChild(n),n.focus(),n.select();try{return document.execCommand("copy"),e}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}finally{document.body.removeChild(n)}}(e)}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}}))}const d=e=>o(void 0,void 0,void 0,(function*(){const n=yield fetch(e);return a(yield n.text())}));function l(e,n){var t;return o(this,void 0,void 0,(function*(){if(!s())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator))return d(e);if(!("write"in window.navigator.clipboard))return d(e);if(null!==(t=null==n?void 0:n.toText)&&void 0!==t&&t)return d(e);const c=yield function(e,n="png"){return new Promise(((t,c)=>{const u=new Image;u.onload=()=>o(this,void 0,void 0,(function*(){const e=document.createElement("canvas");e.width=u.width,e.height=u.height;try{const o=e.getContext("2d");if(!o)throw new Error("Failed to get 2d context");o.drawImage(u,0,0);const c=yield i(e,r[n]);t(c)}catch(o){console.error(`Failed to load image. message: ${o.mesaage}`),c(o)}})),u.onerror=()=>{c(new Error("Failed to load image"))},u.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[c.type]:c})]),c}catch(c){throw console.error(`Failed to copy to clipboard. message: ${c.message}`),c}}))}function f(){return o(this,void 0,void 0,(function*(){if(!s())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function p(){return o(this,void 0,void 0,(function*(){if(!s())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function b(e,n){return Object.prototype.hasOwnProperty.call(e,n)}const h=(e,n,t)=>{const o=Object.keys(e),r=Object.keys(n);if(o.length!==r.length)return!1;for(let i=0;i{if(e===n)return!0;if(w(e)&&w(n)&&isNaN(e)&&isNaN(n))return!0;if(g(e)&&g(n))return e.toString()===n.toString();if("object"!=typeof e||"object"!=typeof n||null===e||null===n)return!1;if(t.has(e)&&t.get(e)===n)return!0;if(t.set(e,n),e.constructor!==n.constructor)return!1;if(e instanceof Set){if(e.size!==n.size)return!1;const o=[...e],r=[...n];return h(o,r,t)}if(e instanceof Map){if(e.size!==n.size)return!1;for(const[o,r]of e)if(!n.has(o)||!m(r,n.get(o),t))return!1;return!0}return h(e,n,t)};function v(e,n){return m(e,n,new WeakMap)}function g(e){return"function"==typeof e}function y(e){return null==e}function w(e){return"number"==typeof e}function x(e){return!function(e){return Object(e)!==e}(e)}function j(e){return x(e)&&"[object Object]"===Object.prototype.toString.call(e)}function k(e){return e===window}function C(){}function S(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(n){throw new Error(`Failed to parse data: ${n}`)}}function D(e){return Object.keys(e)}const E={days:864e5,hours:36e5,minutes:6e4,seconds:1e3};D(E);function O(e,n){if(!s())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(n)}catch(t){throw new Error(`Failed to remove key "${n}" from ${e}: ${t}`)}}function T(e,n,t){if(!s())throw new Error("Cannot be executed unless it is a client environment.");try{const o=window[e],r=g(t)?t():t;o.setItem(n,JSON.stringify(r))}catch(o){throw new Error(`Failed to store data for key "${n}" in ${e}: ${o}`)}}}}]);
\ No newline at end of file
diff --git a/assets/js/67c0cc0e.49a8fe54.js b/assets/js/67c0cc0e.49a8fe54.js
new file mode 100644
index 000000000..2152091b5
--- /dev/null
+++ b/assets/js/67c0cc0e.49a8fe54.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[6712],{5658:(e,n,t)=>{t.r(n),t.d(n,{Example:()=>h,assets:()=>f,contentTitle:()=>u,default:()=>m,frontMatter:()=>d,metadata:()=>o,toc:()=>p});const o=JSON.parse('{"id":"react/hooks/useScrollTo","title":"useScrollTo","description":"\uc2a4\ud06c\ub864 \uae30\ub2a5\uc744 \uc81c\uacf5\ud558\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useScrollTo.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useScrollTo","permalink":"/modern-kit/docs/react/hooks/useScrollTo","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useScrollLock","permalink":"/modern-kit/docs/react/hooks/useScrollLock"},"next":{"title":"useSessionStorage","permalink":"/modern-kit/docs/react/hooks/useSessionStorage"}}');var r=t(6206),i=t(3267),l=t(4382),c=t(9340);const s=(e,n,t)=>"start"===t?0:"center"===t?-e/2+n/2:-e+n;function a(){const e=(0,l.useRef)(null),n=(0,l.useCallback)(((n={})=>{if(!e.current)return;const{left:t=0,top:o=0,behavior:r="auto"}=n;e.current.scrollTo({left:t,top:o,behavior:r})}),[]),t=(0,l.useCallback)(((n,t={})=>{if(!n||!e.current)return;const o=e.current,{behavior:r="auto"}=t,{left:i,top:l}=((e,n,t)=>{const o=n.getBoundingClientRect(),{offsetX:r=0,offsetY:i=0,alignY:l="start",alignX:a="start"}=t;if((0,c.l6)(e))return{top:o.top+window.scrollY+i+s(window.innerHeight,o.height,l),left:o.left+window.scrollX+r+s(window.innerWidth,o.width,a)};const d=e.getBoundingClientRect();return{top:o.top-d.top+e.scrollTop+i+s(d.height,o.height,l),left:o.left-d.left+e.scrollLeft+r+s(d.width,o.width,a)}})(o,n,t);o.scrollTo({top:l,left:i,behavior:r})}),[]);return(0,l.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:n,scrollToElement:t}}const d={},u="useScrollTo",f={},h=()=>{const e={button:"button",div:"div",...(0,i.R)()},{containerRef:n,scrollToPosition:t,scrollToElement:o}=a(),c=(0,l.useRef)(null),s=e=>{o(c.current,{behavior:"smooth",offsetY:e})},d=e=>{o(c.current,{behavior:"smooth",alignY:e})};return(0,r.jsxs)(e.div,{children:[(0,r.jsxs)(e.div,{children:[(0,r.jsx)(e.button,{onClick:()=>{t({behavior:"smooth",top:400})},children:"\ud3ec\uc9c0\uc158 \uc2a4\ud06c\ub864"}),(0,r.jsx)(e.button,{onClick:()=>{o(c.current,{behavior:"smooth"})},children:"\ud0c0\uac9f \uc694\uc18c \uc2a4\ud06c\ub864"}),(0,r.jsx)(e.button,{onClick:()=>s(200),children:"\ud0c0\uac9f \uc694\uc18c \uc2a4\ud06c\ub864 offset 200"}),(0,r.jsx)(e.button,{onClick:()=>s(-200),children:"\ud0c0\uac9f \uc694\uc18c \uc2a4\ud06c\ub864 offset -200"})]}),(0,r.jsxs)(e.div,{children:[(0,r.jsx)(e.button,{onClick:()=>d("start"),children:"\ud0c0\uac9f \uc694\uc18c \uc2a4\ud06c\ub864 align start"}),(0,r.jsx)(e.button,{onClick:()=>d("center"),children:"\ud0c0\uac9f \uc694\uc18c \uc2a4\ud06c\ub864 align center"}),(0,r.jsx)(e.button,{onClick:()=>d("end"),children:"\ud0c0\uac9f \uc694\uc18c \uc2a4\ud06c\ub864 align end"})]}),(0,r.jsxs)(e.div,{ref:n,style:{width:"500px",height:"800px",overflow:"scroll"},children:[(0,r.jsx)(e.div,{style:{height:"400px",background:"green"},children:"InnerBox1"}),(0,r.jsx)(e.div,{style:{height:"400px",background:"red"},children:"InnerBox2"}),(0,r.jsx)(e.div,{ref:c,style:{height:"400px",background:"coral",fontSize:"24px"},children:"target Box"}),(0,r.jsx)(e.div,{style:{height:"400px",background:"aqua"},children:"InnerBox4"}),(0,r.jsx)(e.div,{style:{height:"400px",background:"black"},children:"InnerBox4"})]})]})},p=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function g(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.header,{children:(0,r.jsx)(n.h1,{id:"usescrollto",children:"useScrollTo"})}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"\uc2a4\ud06c\ub864"})," \uae30\ub2a5\uc744 \uc81c\uacf5\ud558\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."]}),"\n",(0,r.jsxs)(n.p,{children:["useScrollTo \ud6c5\uc774 \ubc18\ud658\ud558\ub294 ",(0,r.jsx)(n.code,{children:"containerRef"}),"\ub97c \ud2b9\uc815 \uc5d8\ub9ac\uba3c\ud2b8\uc5d0 \ud560\ub2f9\ud558\uba74 \ud574\ub2f9 \uc694\uc18c\ub97c \uc2a4\ud06c\ub864 \ud569\ub2c8\ub2e4.\n",(0,r.jsx)(n.code,{children:"containerRef"}),"\ub97c \ud560\ub2f9\ud558\uc9c0 \uc54a\uc73c\uba74 ",(0,r.jsx)(n.code,{children:"window"}),"\ub97c \uc2a4\ud06c\ub864\ud569\ub2c8\ub2e4."]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"scrollToPosition"})," \ud568\uc218\ub294 top, left\uc640 \uac19\uc740 ",(0,r.jsx)(n.code,{children:"position"}),"\uc744 \uae30\uc900\uc73c\ub85c \uc2a4\ud06c\ub864\ud569\ub2c8\ub2e4."]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"scrollToElement"})," \ud568\uc218\ub294 \uc778\uc790\ub85c \ub123\uc740 ",(0,r.jsx)(n.code,{children:"\ud0c0\uac9f \uc694\uc18c"}),"\ub97c \uae30\uc900\uc73c\ub85c \uc2a4\ud06c\ub864 \ud569\ub2c8\ub2e4. ",(0,r.jsx)(n.code,{children:"offsetY/X"})," \uac12\uc744 \uc635\uc158\uc73c\ub85c \ubc1b\uc544\uc62c \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-tsx",children:"const { containerRef } = useScrollTo();\n// containerRef: Window | null\n"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-tsx",children:"const { containerRef } = useScrollTo();\n// containerRef: HTMLDivElement | null\n\n\n"})}),"\n",(0,r.jsx)("br",{}),"\n",(0,r.jsx)(n.h2,{id:"code",children:"Code"}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useScrollTo/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,r.jsx)(n.h2,{id:"interface",children:"Interface"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"type ScrollBehavior = \"auto\" | \"instant\" | \"smooth\";\ntype Align = 'start' | 'center' | 'end';\n\ninterface ScrollOptions {\n behavior?: ScrollBehavior; // default: 'auto'\n}\n\ninterface ScrollToOptions extends ScrollOptions {\n left?: number; // default: 0\n top?: number; // default: 0\n}\n\ninterface ScrollToElementOptions {\n offsetX?: number; // default: 0\n offsetY?: number; // default: 0\n behavior?: ScrollBehavior; // default: 'auto'\n alignY?: Align; // default: 'start'\n alignX?: Align; // default: 'start'\n}\n"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"// \ud568\uc218 \uc624\ubc84\ub85c\ub529\nfunction useScrollTo(): {\n containerRef: React.MutableRefObject;\n scrollToPosition: (scrollToOptions?: ScrollToOptions) => void;\n scrollToElement: (\n target: E,\n scrollToElementOptions?: ScrollToElementOptions\n ) => void;\n};\n\nfunction useScrollTo(): {\n containerRef: React.RefObject;\n scrollToPosition: (scrollToOptions?: ScrollToOptions) => void;\n scrollToElement: (\n target: E,\n scrollToElementOptions?: ScrollToElementOptions\n ) => void;\n};\n"})}),"\n",(0,r.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useScrollTo } from '@modern-kit/react';\n\nconst Example = () => {\n const { containerRef, scrollToPosition, scrollToElement } = useScrollTo();\n const targetRef = useRef(null);\n\n const handleScrollToPosition = () => {\n scrollToPosition({\n behavior: 'smooth',\n top: 400,\n });\n };\n\n const handleScrollToElement = () => {\n scrollToElement(targetRef.current, {\n behavior: 'smooth',\n });\n };\n\n const handleScrollToElementOffset = (offset: number) => {\n scrollToElement(targetRef.current, {\n behavior: 'smooth',\n offsetY: offset,\n });\n };\n\n const handleScrollToElementAlign = (type: Align) => {\n scrollToElement(targetRef.current, {\n behavior: 'smooth',\n alignY: type,\n });\n };\n return (\n \n
\n \n \n \n \n
\n\n
\n \n \n \n
\n\n
\n
InnerBox1
\n
InnerBox2
\n
\n target Box\n
\n
InnerBox4
\n
InnerBox4
\n
\n
\n );\n};\n\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n","\n",(0,r.jsx)(h,{})]})}function m(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(g,{...e})}):g(e)}},3267:(e,n,t)=>{t.d(n,{R:()=>l,x:()=>c});var o=t(4382);const r={},i=o.createContext(r);function l(e){const n=o.useContext(i);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),o.createElement(i.Provider,{value:n},e.children)}},9340:(e,n,t)=>{function o(e,n,t,o){return new(t||(t=Promise))((function(r,i){function l(e){try{s(o.next(e))}catch(n){i(n)}}function c(e){try{s(o.throw(e))}catch(n){i(n)}}function s(e){var n;e.done?r(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(l,c)}s((o=o.apply(e,n||[])).next())}))}t.d(n,{Et:()=>w,Fr:()=>c,Gp:()=>x,Ol:()=>E,Qd:()=>T,S$:()=>l,Tn:()=>v,Zp:()=>f,dK:()=>a,fl:()=>O,gD:()=>b,i5:()=>p,if:()=>h,l6:()=>j,lQ:()=>k,nS:()=>u,ni:()=>R,oc:()=>s}),"function"==typeof SuppressedError&&SuppressedError;const r={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};const i=(e,n)=>new Promise(((t,o)=>{e.toBlob((e=>{e?t(e):o(new Error(`Failed to create blob with format ${n}`))}),n)}));function l(){return"undefined"==typeof window}function c(){if(l())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}function s(){return!l()}function a(e){return o(this,void 0,void 0,(function*(){if(!s())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const n=document.createElement("textarea");n.value=e,n.style.opacity="0",document.body.appendChild(n),n.focus(),n.select();try{return document.execCommand("copy"),e}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}finally{document.body.removeChild(n)}}(e)}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}}))}const d=e=>o(void 0,void 0,void 0,(function*(){const n=yield fetch(e);return a(yield n.text())}));function u(e,n){var t;return o(this,void 0,void 0,(function*(){if(!s())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator))return d(e);if(!("write"in window.navigator.clipboard))return d(e);if(null!==(t=null==n?void 0:n.toText)&&void 0!==t&&t)return d(e);const l=yield function(e,n="png"){return new Promise(((t,l)=>{const c=new Image;c.onload=()=>o(this,void 0,void 0,(function*(){const e=document.createElement("canvas");e.width=c.width,e.height=c.height;try{const o=e.getContext("2d");if(!o)throw new Error("Failed to get 2d context");o.drawImage(c,0,0);const l=yield i(e,r[n]);t(l)}catch(o){console.error(`Failed to load image. message: ${o.mesaage}`),l(o)}})),c.onerror=()=>{l(new Error("Failed to load image"))},c.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[l.type]:l})]),l}catch(l){throw console.error(`Failed to copy to clipboard. message: ${l.message}`),l}}))}function f(){return o(this,void 0,void 0,(function*(){if(!s())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function h(){return o(this,void 0,void 0,(function*(){if(!s())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function p(e,n){return Object.prototype.hasOwnProperty.call(e,n)}const g=(e,n,t)=>{const o=Object.keys(e),r=Object.keys(n);if(o.length!==r.length)return!1;for(let i=0;i{if(e===n)return!0;if(w(e)&&w(n)&&isNaN(e)&&isNaN(n))return!0;if(v(e)&&v(n))return e.toString()===n.toString();if("object"!=typeof e||"object"!=typeof n||null===e||null===n)return!1;if(t.has(e)&&t.get(e)===n)return!0;if(t.set(e,n),e.constructor!==n.constructor)return!1;if(e instanceof Set){if(e.size!==n.size)return!1;const o=[...e],r=[...n];return g(o,r,t)}if(e instanceof Map){if(e.size!==n.size)return!1;for(const[o,r]of e)if(!n.has(o)||!m(r,n.get(o),t))return!1;return!0}return g(e,n,t)};function x(e,n){return m(e,n,new WeakMap)}function v(e){return"function"==typeof e}function b(e){return null==e}function w(e){return"number"==typeof e}function y(e){return!function(e){return Object(e)!==e}(e)}function T(e){return y(e)&&"[object Object]"===Object.prototype.toString.call(e)}function j(e){return e===window}function k(){}function E(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(n){throw new Error(`Failed to parse data: ${n}`)}}function S(e){return Object.keys(e)}const C={days:864e5,hours:36e5,minutes:6e4,seconds:1e3};S(C);function O(e,n){if(!s())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(n)}catch(t){throw new Error(`Failed to remove key "${n}" from ${e}: ${t}`)}}function R(e,n,t){if(!s())throw new Error("Cannot be executed unless it is a client environment.");try{const o=window[e],r=v(t)?t():t;o.setItem(n,JSON.stringify(r))}catch(o){throw new Error(`Failed to store data for key "${n}" in ${e}: ${o}`)}}}}]);
\ No newline at end of file
diff --git a/assets/js/67c0cc0e.f6b6fd72.js b/assets/js/67c0cc0e.f6b6fd72.js
deleted file mode 100644
index b87f40e65..000000000
--- a/assets/js/67c0cc0e.f6b6fd72.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[6712],{6685:(e,n,t)=>{t.r(n),t.d(n,{Example:()=>d,assets:()=>u,contentTitle:()=>a,default:()=>p,frontMatter:()=>c,metadata:()=>r,toc:()=>f});const r=JSON.parse('{"id":"react/hooks/useScrollTo","title":"useScrollTo","description":"\uc2a4\ud06c\ub864 \uae30\ub2a5\uc744 \uc81c\uacf5\ud558\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useScrollTo.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useScrollTo","permalink":"/modern-kit/docs/react/hooks/useScrollTo","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useScrollLock","permalink":"/modern-kit/docs/react/hooks/useScrollLock"},"next":{"title":"useSessionStorage","permalink":"/modern-kit/docs/react/hooks/useSessionStorage"}}');var o=t(6206),i=t(3267),l=t(4027),s=t(4382);const c={},a="useScrollTo",u={},d=()=>{const e={button:"button",div:"div",...(0,i.R)()},{containerRef:n,scrollToPosition:t,scrollToElement:r}=(0,l.QV)(),c=(0,s.useRef)(null),a=e=>{r(c.current,{behavior:"smooth",offsetY:e})},u=e=>{r(c.current,{behavior:"smooth",alignY:e})};return(0,o.jsxs)(e.div,{children:[(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.button,{onClick:()=>{t({behavior:"smooth",top:400})},children:"\ud3ec\uc9c0\uc158 \uc2a4\ud06c\ub864"}),(0,o.jsx)(e.button,{onClick:()=>{r(c.current,{behavior:"smooth"})},children:"\ud0c0\uac9f \uc694\uc18c \uc2a4\ud06c\ub864"}),(0,o.jsx)(e.button,{onClick:()=>a(200),children:"\ud0c0\uac9f \uc694\uc18c \uc2a4\ud06c\ub864 offset 200"}),(0,o.jsx)(e.button,{onClick:()=>a(-200),children:"\ud0c0\uac9f \uc694\uc18c \uc2a4\ud06c\ub864 offset -200"})]}),(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.button,{onClick:()=>u("start"),children:"\ud0c0\uac9f \uc694\uc18c \uc2a4\ud06c\ub864 align start"}),(0,o.jsx)(e.button,{onClick:()=>u("center"),children:"\ud0c0\uac9f \uc694\uc18c \uc2a4\ud06c\ub864 align center"}),(0,o.jsx)(e.button,{onClick:()=>u("end"),children:"\ud0c0\uac9f \uc694\uc18c \uc2a4\ud06c\ub864 align end"})]}),(0,o.jsxs)(e.div,{ref:n,style:{width:"500px",height:"800px",overflow:"scroll"},children:[(0,o.jsx)(e.div,{style:{height:"400px",background:"green"},children:"InnerBox1"}),(0,o.jsx)(e.div,{style:{height:"400px",background:"red"},children:"InnerBox2"}),(0,o.jsx)(e.div,{ref:c,style:{height:"400px",background:"coral",fontSize:"24px"},children:"target Box"}),(0,o.jsx)(e.div,{style:{height:"400px",background:"aqua"},children:"InnerBox4"}),(0,o.jsx)(e.div,{style:{height:"400px",background:"black"},children:"InnerBox4"})]})]})},f=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function h(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.header,{children:(0,o.jsx)(n.h1,{id:"usescrollto",children:"useScrollTo"})}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.code,{children:"\uc2a4\ud06c\ub864"})," \uae30\ub2a5\uc744 \uc81c\uacf5\ud558\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(n.p,{children:["useScrollTo \ud6c5\uc774 \ubc18\ud658\ud558\ub294 ",(0,o.jsx)(n.code,{children:"containerRef"}),"\ub97c \ud2b9\uc815 \uc5d8\ub9ac\uba3c\ud2b8\uc5d0 \ud560\ub2f9\ud558\uba74 \ud574\ub2f9 \uc694\uc18c\ub97c \uc2a4\ud06c\ub864 \ud569\ub2c8\ub2e4.\n",(0,o.jsx)(n.code,{children:"containerRef"}),"\ub97c \ud560\ub2f9\ud558\uc9c0 \uc54a\uc73c\uba74 ",(0,o.jsx)(n.code,{children:"window"}),"\ub97c \uc2a4\ud06c\ub864\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.code,{children:"scrollToPosition"})," \ud568\uc218\ub294 top, left\uc640 \uac19\uc740 ",(0,o.jsx)(n.code,{children:"position"}),"\uc744 \uae30\uc900\uc73c\ub85c \uc2a4\ud06c\ub864\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.code,{children:"scrollToElement"})," \ud568\uc218\ub294 \uc778\uc790\ub85c \ub123\uc740 ",(0,o.jsx)(n.code,{children:"\ud0c0\uac9f \uc694\uc18c"}),"\ub97c \uae30\uc900\uc73c\ub85c \uc2a4\ud06c\ub864 \ud569\ub2c8\ub2e4. ",(0,o.jsx)(n.code,{children:"offsetY/X"})," \uac12\uc744 \uc635\uc158\uc73c\ub85c \ubc1b\uc544\uc62c \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-tsx",children:"const { containerRef } = useScrollTo();\n// containerRef: Window | null\n"})}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-tsx",children:"const { containerRef } = useScrollTo();\n// containerRef: HTMLDivElement | null\n\n\n"})}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(n.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useScrollTo/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(n.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"type ScrollBehavior = \"auto\" | \"instant\" | \"smooth\";\ntype Align = 'start' | 'center' | 'end';\n\ninterface ScrollOptions {\n behavior?: ScrollBehavior; // default: 'auto'\n}\n\ninterface ScrollToOptions extends ScrollOptions {\n left?: number; // default: 0\n top?: number; // default: 0\n}\n\ninterface ScrollToElementOptions {\n offsetX?: number; // default: 0\n offsetY?: number; // default: 0\n behavior?: ScrollBehavior; // default: 'auto'\n alignY?: Align; // default: 'start'\n alignX?: Align; // default: 'start'\n}\n"})}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"// \ud568\uc218 \uc624\ubc84\ub85c\ub529\nfunction useScrollTo(): {\n containerRef: React.MutableRefObject;\n scrollToPosition: (scrollToOptions?: ScrollToOptions) => void;\n scrollToElement: (\n target: E,\n scrollToElementOptions?: ScrollToElementOptions\n ) => void;\n};\n\nfunction useScrollTo(): {\n containerRef: React.RefObject;\n scrollToPosition: (scrollToOptions?: ScrollToOptions) => void;\n scrollToElement: (\n target: E,\n scrollToElementOptions?: ScrollToElementOptions\n ) => void;\n};\n"})}),"\n",(0,o.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useScrollTo } from '@modern-kit/react';\n\nconst Example = () => {\n const { containerRef, scrollToPosition, scrollToElement } = useScrollTo();\n const targetRef = useRef(null);\n\n const handleScrollToPosition = () => {\n scrollToPosition({\n behavior: 'smooth',\n top: 400,\n });\n };\n\n const handleScrollToElement = () => {\n scrollToElement(targetRef.current, {\n behavior: 'smooth',\n });\n };\n\n const handleScrollToElementOffset = (offset: number) => {\n scrollToElement(targetRef.current, {\n behavior: 'smooth',\n offsetY: offset,\n });\n };\n\n const handleScrollToElementAlign = (type: Align) => {\n scrollToElement(targetRef.current, {\n behavior: 'smooth',\n alignY: type,\n });\n };\n return (\n \n
\n \n \n \n \n
\n\n
\n \n \n \n
\n\n
\n
InnerBox1
\n
InnerBox2
\n
\n target Box\n
\n
InnerBox4
\n
InnerBox4
\n
\n
\n );\n};\n\n"})}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(d,{})]})}function p(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(h,{...e})}):h(e)}},4027:(e,n,t)=>{t.d(n,{$$:()=>Fe,$I:()=>oe,AE:()=>Ve,BL:()=>J,DX:()=>I,FT:()=>cn,Fo:()=>en,Hn:()=>ln,I5:()=>Ce,JF:()=>$e,K:()=>ae,K$:()=>He,M0:()=>Oe,ML:()=>te,Mj:()=>ye,Mk:()=>Ne,Mo:()=>ie,NT:()=>Be,QV:()=>Ue,Ub:()=>Se,Ut:()=>je,W7:()=>U,WY:()=>re,Y1:()=>dn,Z3:()=>on,ZC:()=>We,Zu:()=>ce,_1:()=>Re,_g:()=>tn,aL:()=>H,aY:()=>Ie,bB:()=>A,d7:()=>_,eG:()=>sn,fN:()=>se,fm:()=>G,gl:()=>F,hN:()=>D,iD:()=>de,iQ:()=>Me,jd:()=>le,lW:()=>un,oD:()=>K,oo:()=>Te,pL:()=>Q,qi:()=>ue,rN:()=>Le,tD:()=>ke,u8:()=>q,wY:()=>_e,xV:()=>M,xh:()=>nn,zy:()=>Z});var r=t(6206),o=t(4382),i=t(3683),l=t(5086),s=t(7197),c=(t(1604),t(5938));function a(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((t,r)=>{e.toBlob((e=>{e?t(e):r(new Error(`Failed to create blob with format ${n}`))}),n)}));function m(){return typeof window>"u"}function g(){return!m()}function b(e){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const n=document.createElement("textarea");n.value=e,n.style.opacity="0",document.body.appendChild(n),n.focus(),n.select();try{return document.execCommand("copy"),e}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}finally{document.body.removeChild(n)}}(e)}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}}))}const v=e=>f(void 0,0,void 0,(function*(){return b(yield(yield fetch(e)).text())}));function w(e,n){var t;return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(t=n?.toText)&&void 0!==t&&t)return v(e);const r=yield function(e,n="png"){return new Promise(((t,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const i=yield p(e,h[n]);t(i)}catch(i){console.error(`Failed to load image. message: ${i.mesaage}`),r(i)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,n,t)=>{const r=Object.keys(e),o=Object.keys(n);if(r.length!==o.length)return!1;for(let i=0;i{if(e===n||E(e)&&E(n)&&isNaN(e)&&isNaN(n))return!0;if(k(e)&&k(n))return e.toString()===n.toString();if("object"!=typeof e||"object"!=typeof n||null===e||null===n)return!1;if(t.has(e)&&t.get(e)===n)return!0;if(t.set(e,n),e.constructor!==n.constructor)return!1;if(e instanceof Set){if(e.size!==n.size)return!1;const r=[...e],o=[...n];return y(r,o,t)}if(e instanceof Map){if(e.size!==n.size)return!1;for(const[r,o]of e)if(!n.has(r)||!x(o,n.get(r),t))return!1;return!0}return y(e,n,t)};function S(e,n){return x(e,n,new WeakMap)}function k(e){return"function"==typeof e}function E(e){return"number"==typeof e}function j(e){return!function(e){return Object(e)!==e}(e)}function C(){}function T(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(n){throw new Error(`Failed to parse data: ${n}`)}}const R=(...e)=>n=>e.forEach((e=>{if(k(e))e(n);else if(null!=e){e.current=n}}));function O(...e){return(0,o.useCallback)(R(...e),e)}const I=o.forwardRef(((e,n)=>{const{children:t}=e,i=a(e,["children"]),l=o.Children.toArray(t),s=l.find(N);if(s){const e=s.props.children,t=l.map((n=>n===s?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:n));return(0,r.jsx)(L,Object.assign({},i,{ref:n,children:o.isValidElement(e)?o.cloneElement(e,void 0,t):null}))}return(0,r.jsx)(L,Object.assign({},i,{ref:n,children:t}))}));I.displayName="Slot";const L=o.forwardRef(((e,n)=>{const{children:t}=e,r=a(e,["children"]);if(o.isValidElement(t)){const e=function(e){var n,t;let r=null===(n=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(t=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(t);return o.cloneElement(t,Object.assign(Object.assign({},function(e,n){const t=Object.assign({},n);for(const r in n){const o=e[r],i=n[r];/^on[A-Z]/.test(r)?o&&i?t[r]=(...e)=>{i(...e),o(...e)}:o&&(t[r]=o):"style"===r?t[r]=Object.assign(Object.assign({},o),i):"className"===r&&(t[r]=[o,i].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),t)}(r,t.props)),{ref:n?R(n,e):e}))}return o.Children.count(t)>1?o.Children.only(null):null}));L.displayName="SlotClone";const M=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function N(e){return o.isValidElement(e)&&e.type===M}var P="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,n){void 0===n&&(n={});var t=n.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===t&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const F=d(((e,n)=>{var{ratio:t,style:o,as:l="div",asChild:s=!1}=e,c=a(e,["ratio","style","as","asChild"]);const u=s?I:l,d=Object.assign({aspectRatio:t},o),f=s?c.className:i(P,c.className);return(0,r.jsx)(u,Object.assign({ref:n,style:d,className:f},c))})),$=()=>C,Y=()=>!1,B=()=>!0;function A({fallback:e=(0,r.jsx)(r.Fragment,{}),children:n}){return(0,o.useSyncExternalStore)($,Y,B)?e:n}function X(){const[e,n]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{n(!0)}),[]),e}const D=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:n})=>X()?(0,r.jsx)(r.Fragment,{children:n}):e;function V(e){const n=(0,o.useRef)(e);return n.current=e,(0,o.useCallback)(((...e)=>n.current(...e)),[])}function W(e){const n=V(e);(0,o.useEffect)((()=>()=>n()),[n])}function z(e,n=S){const[t,r]=(0,o.useState)(e),i=V(n);return(0,o.useEffect)((()=>{i(t,e)||r(e)}),[i,t,e]),t}function _(e,n,t){const r=V(e),i=z(t),s=(0,o.useMemo)((()=>(0,l.A)(r,n,i)),[r,n,i]);return W((()=>s.cancel())),s}const H=({children:e,capture:n,wait:t,options:r})=>{const i=o.Children.only(e),l=_(((...e)=>{const t=i?.props;if(t&&k(t[n]))return t[n](...e)}),t,r);return(0,o.cloneElement)(i,{[n]:l})};function J({onIntersectStart:e=C,onIntersectEnd:n=C,enabled:t=!0,calledOnce:r=!1,root:i=null,threshold:l=0,rootMargin:s="0px 0px 0px 0px"}){const c=(0,o.useRef)(0),a=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=V((([t],o)=>{if(!t)return;const i=t.target;t.isIntersecting?(a.current=!0,c.current+=1,e(t)):a.current&&(a.current=!1,c.current+=1,n(t)),r&&c.current>1&&o.unobserve(i)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&t&&(u.current=new IntersectionObserver(d,{threshold:l,root:i,rootMargin:s}),u.current.observe(e))}),[t,l,i,s,d])}}const K=(0,o.forwardRef)(((e,n)=>{var{src:t,threshold:o,root:i,rootMargin:l}=e,s=a(e,["src","threshold","root","rootMargin"]);const{ref:c}=J({onIntersectStart:e=>{e.target.src=t},calledOnce:!0,threshold:o,root:i,rootMargin:l});return(0,r.jsx)("img",Object.assign({ref:O(n,c)},s))}));K.displayName="LazyImage";const U=(0,o.forwardRef)(((e,n)=>{var{width:t,height:i,fallback:l,className:s,style:c,duration:u="0.2s",onLoad:d}=e,f=a(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,p]=(0,o.useState)(!1),m=!h,g=(0,o.useMemo)((()=>({position:"relative",width:t,height:i})),[t,i]),b=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:m?0:1,transition:`opacity ${u}`},c)),[m,u,c]),v=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),w=s?`lazy-image-wrapper ${s}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:w,style:g,children:[m&&l,(0,r.jsx)(K,Object.assign({ref:n,width:t,height:i,style:b,onLoad:v},f))]})}));U.displayName="FallbackLazyImage";const Z=({condition:e,trueComponent:n,falseComponent:t})=>{const i=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:i?n:t})},q=({onScrollAction:e,children:n,root:t,threshold:o,enabled:i,triggerPosition:l="after",rootMargin:s="150px 0px"})=>{const{ref:c}=J({onIntersectStart:e,root:t,threshold:o,enabled:i,rootMargin:s});return(0,r.jsxs)(r.Fragment,{children:["before"===l&&(0,r.jsx)("div",{ref:c}),n,"after"===l&&(0,r.jsx)("div",{ref:c})]})},Q=d(((e,n)=>{var{children:t,as:i="div",asChild:l=!1}=e,s=a(e,["children","as","asChild"]);const c=l?I:i,{ref:u}=J(s);if(l&&!o.isValidElement(t))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(c,Object.assign({ref:R(n,u)},s,{children:t}))})),G=({items:e=[],itemKey:n,renderItem:t})=>{const i=(0,o.useCallback)(((e,t)=>function(e){return j(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[n]||t:`${t}_${e}`),[n]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,n)=>(0,r.jsx)(o.Fragment,{children:t(e,n)},i(e,n))))})},ee=g()?o.useLayoutEffect:o.useEffect,ne=e=>!!e&&function(e,n){return Object.prototype.hasOwnProperty.call(e,n)}(e,"current");function te(e,n,t,r){const o=V(t);ee((()=>{const t=ne(e)?e.current:e;if(t)return t.addEventListener(n,o,r),()=>{t.removeEventListener(n,o,r)}}),[n,e,r,o])}function re(e,n){const{excludeRefs:t}=n??{},r=(0,o.useRef)(null),i=(0,o.useMemo)((()=>function(){if(m())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return te(document,i,(({target:n})=>{if(!r.current)return;const o=r.current,i=t?.some((e=>{var t;return null===(t=e.current)||void 0===t?void 0:t.contains(n)}));!o.contains(n)&&!i&&e(o)})),r}const oe=d(((e,n)=>{var{children:t,as:i="div",asChild:l=!1,onPointerDown:s,excludeRefs:c=[]}=e,u=a(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(s,{excludeRefs:c}),f=l?I:i;if(l&&!o.isValidElement(t))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:R(d,n)},u,{children:t}))}));(0,o.createContext)({parentPortalElement:null});const ie=({itemKey:e,items:n=[],separator:t,renderItem:i,separatorInterval:l=1,includeLastSeparator:s=!1})=>{const c=(0,o.useCallback)((e=>e===n.length-1?s:(e+1)%l==0),[s,l,n.length]);return(0,r.jsx)(G,{items:n,itemKey:e,renderItem:(e,n)=>(0,r.jsxs)(r.Fragment,{children:[i(e,n),c(n)&&t]})})},le=({children:e,condition:n,fallback:t=null})=>(e=>"function"==typeof e?e():e)(n)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:t}),se=({caseBy:e,value:n,defaultComponent:t=null})=>{var o;return function(e){return null==e}(n)?(0,r.jsx)(r.Fragment,{children:t}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[n])&&void 0!==o?o:t})};function ce(e,n){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),n)}function ae(e=!0){const n=k(e)?e():e;(0,o.useEffect)((()=>{if(!n)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[n])}function ue(){const[e,n]=(0,o.useState)(!1),[t,r]=(0,o.useState)(!1),i=(0,o.useRef)(!1);return{isError:t,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!i.current){i.current=!0,n(!0),r(!1);try{return yield e()}catch(t){throw r(!0),t}finally{i.current=!1,n(!1)}}}))),[])}}function de(){const[e,n]=(0,o.useState)(null),[t,r]=(0,o.useState)(null),i=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const t=yield b(e);return n(t),!0}catch{return n(null),!1}}))),[]),l=(0,o.useCallback)(((e,t)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=t?.toText)&&void 0!==r&&r;try{const t=yield w(e,{toText:o});return n(t),!0}catch{return n(null),!1}}))),[]),s=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const n=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(n),!0}catch{return r(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const n=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(n),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:t,copyText:i,copyImage:l,readText:s,readContents:c}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",pe={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},me=e=>pe[e],ge=me("localStorage"),be=e=>window.localStorage.getItem(e),ve=e=>JSON.stringify(e),we=e=>(ge.subscribe(e),()=>{ge.unsubscribe(e)});function ye(e){const{key:n}=e,t="initialValue"in e?e.initialValue:null,r=k(t)?t():t,i=(0,o.useSyncExternalStore)(we,(()=>be(n)),(()=>ve(r)));return{state:(0,o.useMemo)((()=>i?T(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const t=be(n),o=t?T(t):r,i=k(e)?e(o):e;window.localStorage.setItem(n,JSON.stringify(i)),ge.dispatchEvent()}catch(t){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${n}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${t}`)}}),[n,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(n),ge.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${n}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[n])}}const xe=(e,n)=>g()?window.matchMedia(e).matches:n??!1;function Se(e,n){const[t,r]=(0,o.useState)(xe(e,n)),i=(0,o.useCallback)((e=>r(e.matches)),[]);return te(window.matchMedia(e),"change",i),t}function ke(){return Se("(prefers-color-scheme: dark)")?"dark":"light"}const Ee="color-scheme";function je({defaultValue:e,key:n=Ee,shouldSetBodyClass:t=!1}={}){const r=ke(),i=k(e)?e():e,{state:l,setState:s}=ye({key:n,initialValue:i??r}),c=(0,o.useCallback)((()=>{s((e=>"dark"===e?"light":"dark"))}),[s]),a=(0,o.useCallback)((()=>{s("dark")}),[s]),u=(0,o.useCallback)((()=>{s("light")}),[s]),d=(0,o.useCallback)((()=>{s(r)}),[s,r]);return(0,o.useEffect)((()=>(t&&document.body.classList.add(l),()=>{t&&document.body.classList.remove(l)})),[l,t]),{colorScheme:l,preferredColorScheme:r,setToggleMode:c,setDarkMode:a,setLightMode:u,setPreferredMode:d}}function Ce(e=0){const[n,t]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{t((e=>e+1))}),[]),i=(0,o.useCallback)((()=>{t((e=>e-1))}),[]),l=(0,o.useCallback)((()=>{t(e)}),[e]);return{counter:n,setCounter:t,increment:r,decrement:i,reset:l}}function Te({maxStep:e,initialStep:n=0,infinite:t=!1}){const[r,i]=(0,o.useState)(n),l=r0,c=(0,o.useCallback)(((n,t)=>{const o="nextStep"===n;return t?o?0:e:o?r+1:r-1}),[e,r]),a=(0,o.useCallback)(((e,n,o)=>{if(n&&!t)return;const l=c(e,n);o&&o({prev:r,next:l}),i(l)}),[t,r,c]),u=(0,o.useCallback)((e=>{a("nextStep",!l,e)}),[l,a]),d=(0,o.useCallback)((e=>{a("prevStep",!s,e)}),[s,a]),f=(0,o.useCallback)(((n,t)=>{const o=k(n)?n(r):n;if(o>=0&&o<=e)return t&&t({prev:r,next:o}),void i(n);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:n}),i(n)}),[r,n]);return{currentStep:r,hasNextStep:l,hasPrevStep:s,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Re(e,n=0){const{currentStep:t,goToNextStep:r,goToPrevStep:o,setStep:i,resetStep:l}=Te({maxStep:e.length-1,initialStep:n,infinite:!0});return{currentItem:e[t],nextIndex:r,prevIndex:o,setIndex:i,resetIndex:l}}function Oe(e,n,t={}){const[r,i]=(0,o.useState)(e);return[r,_(i,n,t)]}function Ie(e,n={}){const[t,r]=(0,o.useState)(""),[i,l]=Oe("",e,n);return{value:t,debouncedValue:i,onChange:(0,o.useCallback)((e=>{const{value:n}=e.target;r(n),l(n)}),[l]),onReset:(0,o.useCallback)((()=>{r(""),l("")}),[l])}}function Le(e,{preserveTitleOnUnmount:n=!1}={}){ee((()=>{const t=document.title;return document.title=e,()=>{n||(document.title=t)}}),[e,n])}function Me({onFocus:e=C,onBlur:n=C}={}){const[t,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),l=V((n=>{r(!0),e(n)})),s=V((e=>{r(!1),n(e)})),c=(0,o.useCallback)((()=>{i.current&&(i.current.focus(),r(!0))}),[]);return te(i,"focus",l),te(i,"blur",s),{ref:i,isFocus:t,setFocus:c}}function Ne({onEnter:e=C,onLeave:n=C}={}){const[t,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),l=V((n=>{r(!0),e(n)})),s=V((e=>{r(!1),n(e)}));return te(i,"mouseenter",l),te(i,"mouseleave",s),{ref:i,isHovered:t}}const Pe=e=>{var n;return E(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(n=e?.enabled)||void 0===n||n}};function Fe(e,n){const t=(0,o.useRef)(),r=V(e),{delay:i,enabled:l}=Pe(n),s=(0,o.useCallback)((()=>{t.current=window.setInterval(r,i)}),[r,i]),c=(0,o.useCallback)((()=>{t.current&&(clearInterval(t.current),t.current=null)}),[]),a=(0,o.useCallback)((()=>{c(),s()}),[c,s]);return(0,o.useEffect)((()=>{if(!(i<0)&&l)return s(),()=>c()}),[c,s,l,i]),{set:s,reset:a,clear:c}}function $e({enabled:e=!0,keyDownCallbackMap:n={},allKeyDownCallback:t}){const r=(0,o.useRef)(null),i=V((e=>{if(e.stopPropagation(),t)return void t(e);const r=e.key,o=n[r];k(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const n=r.current;return n.addEventListener("keydown",i),()=>n.removeEventListener("keydown",i)}),[e,i]),r}const Ye={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function Be(){const e=(0,o.useRef)(null),[n,t]=(0,o.useState)(Ye),r=(0,o.useCallback)((n=>{const{screenX:r,screenY:o,clientX:i,clientY:l,pageX:s,pageY:c}=n;let a=null,u=null,d=null,f=null;if(e.current){const n=e.current.getBoundingClientRect();a=i-n.left,u=l-n.top,d=n.left+window.scrollX,f=n.top+window.scrollY}t({screenX:r,screenY:o,clientX:i,clientY:l,pageX:s,pageY:c,elementRelativeX:a,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return te(document,"mousemove",r),{ref:e,position:n}}const Ae=()=>navigator.onLine,Xe=()=>!0,De=(e,n,t)=>{const r=t=>(n(t),e()),o=n=>(t(n),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function Ve({onlineAction:e=C,offlineAction:n=C}={}){const t=V((t=>De(t,e,n)));return(0,o.useSyncExternalStore)(t,Ae,Xe)}function We(e){const n=(0,o.useRef)(e);return(0,o.useEffect)((()=>{n.current=e}),[e]),n.current}const ze={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function _e(e=C){const[n,t]=(0,o.useState)(ze),r=(0,o.useRef)(null),i=V((([n])=>{n&&(e(n),t(n.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,n=new ResizeObserver(i);return n.observe(e),()=>{n.unobserve(e)}}),[i]),{ref:r,contentRect:n}}function He({autoLock:e=!0}={}){const n=(0,o.useRef)(null),t=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=n.current;t.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),i=(0,o.useCallback)((()=>{if(!t.current)return;n.current.style.overflow=t.current}),[]);return ee((()=>(n.current||(n.current=document.body),e&&r(),()=>i())),[e,r,i]),{ref:n,lock:r,unlock:i}}const Je=(e,n,t)=>"start"===t?0:"center"===t?-e/2+n/2:-e+n,Ke=(e,n,t)=>{const r=n.getBoundingClientRect(),{offsetX:o=0,offsetY:i=0,alignY:l="start",alignX:s="start"}=t;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+i+Je(window.innerHeight,r.height,l),left:r.left+window.scrollX+o+Je(window.innerWidth,r.width,s)};const c=e.getBoundingClientRect();return{top:r.top-c.top+e.scrollTop+i+Je(c.height,r.height,l),left:r.left-c.left+e.scrollLeft+o+Je(c.width,r.width,s)}};function Ue(){const e=(0,o.useRef)(null),n=(0,o.useCallback)(((n={})=>{if(!e.current)return;const{left:t=0,top:r=0,behavior:o="auto"}=n;e.current.scrollTo({left:t,top:r,behavior:o})}),[]),t=(0,o.useCallback)(((n,t={})=>{if(!n||!e.current)return;const r=e.current,{behavior:o="auto"}=t,{left:i,top:l}=Ke(r,n,t);r.scrollTo({top:l,left:i,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:n,scrollToElement:t}}const Ze=me("sessionStorage"),qe=e=>window.sessionStorage.getItem(e),Qe=e=>JSON.stringify(e),Ge=e=>(Ze.subscribe(e),()=>{Ze.unsubscribe(e)});function en(e){const{key:n}=e,t="initialValue"in e?e.initialValue:null,r=k(t)?t():t,i=(0,o.useSyncExternalStore)(Ge,(()=>qe(n)),(()=>Qe(r)));return{state:(0,o.useMemo)((()=>i?T(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const t=qe(n),o=t?T(t):r,i=k(e)?e(o):e;window.sessionStorage.setItem(n,JSON.stringify(i)),Ze.dispatchEvent()}catch(t){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${n}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${t}`)}}),[n,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(n),Ze.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${n}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[n])}}function nn(e){var n;const t="initialState"in e?e.initialState:null,{type:r,key:i}=null!==(n=e?.storageOptions)&&void 0!==n?n:{},[l,s]=(0,o.useState)(t),c=(0,o.useCallback)((e=>{s((n=>{const t=k(e)?e(n):e;return r&&i&&function(e,n,t){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=k(t)?t():t;r.setItem(n,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${n}" in ${e}: ${r}`)}}(r,i,t),t}))}),[r,i]),a=(0,o.useCallback)((()=>{r&&i&&function(e,n){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(n)}catch(t){throw new Error(`Failed to remove key "${n}" from ${e}: ${t}`)}}(r,i),s(null)}),[r,i]);return Object.assign({state:l,setState:c,clearState:a},Te(e))}function tn(e,n,t={}){const r=V(e),i=z(t),l=(0,o.useMemo)((()=>(0,s.A)(r,n,i)),[r,n,i]);return W((()=>l.cancel())),l}const rn=e=>{var n;return E(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(n=e?.enabled)||void 0===n||n}};function on(e,n){const t=(0,o.useRef)(),r=V(e),{delay:i,enabled:l}=rn(n),s=(0,o.useCallback)((()=>{t.current=setTimeout(r,i)}),[r,i]),c=(0,o.useCallback)((()=>{t.current&&(clearTimeout(t.current),t.current=null)}),[]),a=(0,o.useCallback)((()=>{c(),s()}),[c,s]);return(0,o.useEffect)((()=>{if(!(i<0)&&l)return s(),()=>c()}),[s,c,i,l]),{set:s,reset:a,clear:c}}function ln(e,n){const[t,r]=(0,o.useState)(e);return[t,(0,o.useCallback)((()=>{r((t=>t===e?n:e))}),[e,n])]}function sn(){const[e,n]=(0,o.useState)(null);return ee((()=>{const e=new c.UAParser(window.navigator.userAgent);n(e.getResult())}),[]),e}function cn({name:e="vh",enabledResize:n=!1}={}){ee((()=>{const t=()=>{const n=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${n}px`)};return t(),n&&window.addEventListener("resize",t),()=>{n&&window.removeEventListener("resize",t)}}),[e,n])}const an={width:null,height:null};function un({debounceWait:e}={}){const[n,t]=(0,o.useState)((()=>m()?an:{width:window.innerWidth,height:window.innerHeight})),r=_(t,e),i=(0,o.useCallback)((()=>{(e?r:t)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return te(window,"resize",i),n}function dn(e,n,t){const{delay:r,enabled:i}=rn(n),{set:l,reset:s,clear:c}=on(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!i||s()}),[r,i,s,...t]),{set:l,reset:s,clear:c}}}}]);
\ No newline at end of file
diff --git a/assets/js/6dde689d.a296f296.js b/assets/js/6dde689d.a296f296.js
new file mode 100644
index 000000000..6bb03a8d3
--- /dev/null
+++ b/assets/js/6dde689d.a296f296.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[2709],{9993:(e,n,t)=>{t.r(n),t.d(n,{Example:()=>l,assets:()=>d,contentTitle:()=>u,default:()=>p,frontMatter:()=>a,metadata:()=>r,toc:()=>f});const r=JSON.parse('{"id":"react/hooks/useTimeout","title":"useTimeout","description":"window.setTimeout\uc744 \ud3b8\ub9ac\ud558\uac8c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294 \ucee4\uc2a4\ud140 \ud6c5 \uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useTimeout.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useTimeout","permalink":"/modern-kit/docs/react/hooks/useTimeout","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useThrottle","permalink":"/modern-kit/docs/react/hooks/useThrottle"},"next":{"title":"useToggle","permalink":"/modern-kit/docs/react/hooks/useToggle"}}');var o=t(6206),i=t(3267),c=t(9545),s=t(4382);const a={},u="useTimeout",d={},l=()=>{const e={button:"button",div:"div",p:"p",...(0,i.R)()},[n,t]=(0,s.useState)(0),{set:r,reset:a,clear:u}=(0,c.Z)((()=>{t(n+1)}),1e3);return(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.p,{children:n}),(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.button,{onClick:()=>r(),children:"set"}),(0,o.jsx)(e.button,{onClick:()=>a(),children:"reset"}),(0,o.jsx)(e.button,{onClick:()=>u(),children:"clear"})]})]})},f=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function m(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.header,{children:(0,o.jsx)(n.h1,{id:"usetimeout",children:"useTimeout"})}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.code,{children:"window.setTimeout"}),"\uc744 \ud3b8\ub9ac\ud558\uac8c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294 \ucee4\uc2a4\ud140 \ud6c5 \uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(n.p,{children:["option \uac12\uc73c\ub85c \uc22b\uc790\ub97c \ubc1b\uc744 \uc218 \uc788\uace0, \uac1d\uccb4\ub85c \ubc1b\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uac1d\uccb4\ub85c \ubc1b\uc744 \uacbd\uc6b0 ",(0,o.jsx)(n.code,{children:"delay"}),"\uc640 ",(0,o.jsx)(n.code,{children:"enabled"})," \uc18d\uc131\uc744 \ub118\uaca8\uc904 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(n.p,{children:["Timeout\uc744 \uc9c1\uc811 \ud578\ub4e4\ub9c1 \ud560 \uc218 \uc788\ub294 ",(0,o.jsx)(n.code,{children:"set"}),", ",(0,o.jsx)(n.code,{children:"reset"}),", ",(0,o.jsx)(n.code,{children:"clear"})," \ud568\uc218\ub97c \ubc18\ud658\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(n.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useTimeout/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(n.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"interface TimeoutOptions {\n delay: number;\n enabled?: boolean;\n}\n"})}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"function useTimeout(\n callback: () => void,\n options: number\n): {\n set: () => void;\n clear: () => void;\n reset: () => void;\n};\n\nfunction useTimeout(\n callback: () => void,\n options: TimeoutOptions\n): {\n set: () => void;\n clear: () => void;\n reset: () => void;\n};\n"})}),"\n",(0,o.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useTimeout } from '@modern-kit/react';\n\nconst Example = () => {\n const [number, setNumber] = useState(0);\n\n const { set, reset, clear } = useTimeout(() => {\n setNumber(number + 1);\n }, 1000);\n\n /*\n * useTimeout(() => {\n * setNumber(number + 1);\n * }, { delay: 1000, enabled: true });\n */\n\n return (\n \n
{number}
\n
\n \n \n \n
\n
\n );\n};\n"})}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(l,{})]})}function p(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(m,{...e})}):m(e)}},3267:(e,n,t)=>{t.d(n,{R:()=>c,x:()=>s});var r=t(4382);const o={},i=r.createContext(o);function c(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:c(e.components),r.createElement(i.Provider,{value:n},e.children)}},6765:(e,n,t)=>{t.d(n,{p:()=>o});var r=t(4382);function o(e){const n=(0,r.useRef)(e);return n.current=e,(0,r.useCallback)(((...e)=>n.current(...e)),[])}},9545:(e,n,t)=>{t.d(n,{Z:()=>s});var r=t(4382),o=t(6765),i=t(9340);const c=e=>{var n;return(0,i.Et)(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(n=null==e?void 0:e.enabled)||void 0===n||n}};function s(e,n){const t=(0,r.useRef)(),i=(0,o.p)(e),{delay:s,enabled:a}=c(n),u=(0,r.useCallback)((()=>{t.current=setTimeout(i,s)}),[i,s]),d=(0,r.useCallback)((()=>{t.current&&(clearTimeout(t.current),t.current=null)}),[]),l=(0,r.useCallback)((()=>{d(),u()}),[d,u]);return(0,r.useEffect)((()=>{if(!(s<0)&&a)return u(),()=>d()}),[u,d,s,a]),{set:u,reset:l,clear:d}}},9340:(e,n,t)=>{function r(e,n,t,r){return new(t||(t=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(n){i(n)}}function s(e){try{a(r.throw(e))}catch(n){i(n)}}function a(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(c,s)}a((r=r.apply(e,n||[])).next())}))}t.d(n,{Et:()=>x,Fr:()=>s,Gp:()=>g,Ol:()=>C,Qd:()=>j,S$:()=>c,Tn:()=>v,Zp:()=>f,dK:()=>u,fl:()=>S,gD:()=>w,i5:()=>p,if:()=>m,l6:()=>k,lQ:()=>T,nS:()=>l,ni:()=>$,oc:()=>a}),"function"==typeof SuppressedError&&SuppressedError;const o={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};const i=(e,n)=>new Promise(((t,r)=>{e.toBlob((e=>{e?t(e):r(new Error(`Failed to create blob with format ${n}`))}),n)}));function c(){return"undefined"==typeof window}function s(){if(c())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}function a(){return!c()}function u(e){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const n=document.createElement("textarea");n.value=e,n.style.opacity="0",document.body.appendChild(n),n.focus(),n.select();try{return document.execCommand("copy"),e}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}finally{document.body.removeChild(n)}}(e)}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}}))}const d=e=>r(void 0,void 0,void 0,(function*(){const n=yield fetch(e);return u(yield n.text())}));function l(e,n){var t;return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator))return d(e);if(!("write"in window.navigator.clipboard))return d(e);if(null!==(t=null==n?void 0:n.toText)&&void 0!==t&&t)return d(e);const c=yield function(e,n="png"){return new Promise(((t,c)=>{const s=new Image;s.onload=()=>r(this,void 0,void 0,(function*(){const e=document.createElement("canvas");e.width=s.width,e.height=s.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(s,0,0);const c=yield i(e,o[n]);t(c)}catch(r){console.error(`Failed to load image. message: ${r.mesaage}`),c(r)}})),s.onerror=()=>{c(new Error("Failed to load image"))},s.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[c.type]:c})]),c}catch(c){throw console.error(`Failed to copy to clipboard. message: ${c.message}`),c}}))}function f(){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function m(){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function p(e,n){return Object.prototype.hasOwnProperty.call(e,n)}const h=(e,n,t)=>{const r=Object.keys(e),o=Object.keys(n);if(r.length!==o.length)return!1;for(let i=0;i{if(e===n)return!0;if(x(e)&&x(n)&&isNaN(e)&&isNaN(n))return!0;if(v(e)&&v(n))return e.toString()===n.toString();if("object"!=typeof e||"object"!=typeof n||null===e||null===n)return!1;if(t.has(e)&&t.get(e)===n)return!0;if(t.set(e,n),e.constructor!==n.constructor)return!1;if(e instanceof Set){if(e.size!==n.size)return!1;const r=[...e],o=[...n];return h(r,o,t)}if(e instanceof Map){if(e.size!==n.size)return!1;for(const[r,o]of e)if(!n.has(r)||!b(o,n.get(r),t))return!1;return!0}return h(e,n,t)};function g(e,n){return b(e,n,new WeakMap)}function v(e){return"function"==typeof e}function w(e){return null==e}function x(e){return"number"==typeof e}function y(e){return!function(e){return Object(e)!==e}(e)}function j(e){return y(e)&&"[object Object]"===Object.prototype.toString.call(e)}function k(e){return e===window}function T(){}function C(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(n){throw new Error(`Failed to parse data: ${n}`)}}function E(e){return Object.keys(e)}const O={days:864e5,hours:36e5,minutes:6e4,seconds:1e3};E(O);function S(e,n){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(n)}catch(t){throw new Error(`Failed to remove key "${n}" from ${e}: ${t}`)}}function $(e,n,t){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=v(t)?t():t;r.setItem(n,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${n}" in ${e}: ${r}`)}}}}]);
\ No newline at end of file
diff --git a/assets/js/6dde689d.fedb5911.js b/assets/js/6dde689d.fedb5911.js
deleted file mode 100644
index acfdfbd19..000000000
--- a/assets/js/6dde689d.fedb5911.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[2709],{9993:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>d,assets:()=>u,contentTitle:()=>a,default:()=>p,frontMatter:()=>l,metadata:()=>r,toc:()=>f});const r=JSON.parse('{"id":"react/hooks/useTimeout","title":"useTimeout","description":"window.setTimeout\uc744 \ud3b8\ub9ac\ud558\uac8c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294 \ucee4\uc2a4\ud140 \ud6c5 \uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useTimeout.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useTimeout","permalink":"/modern-kit/docs/react/hooks/useTimeout","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useThrottle","permalink":"/modern-kit/docs/react/hooks/useThrottle"},"next":{"title":"useToggle","permalink":"/modern-kit/docs/react/hooks/useToggle"}}');var o=n(6206),i=n(3267),s=n(4027),c=n(4382);const l={},a="useTimeout",u={},d=()=>{const e={button:"button",div:"div",p:"p",...(0,i.R)()},[t,n]=(0,c.useState)(0),{set:r,reset:l,clear:a}=(0,s.Z3)((()=>{n(t+1)}),1e3);return(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.p,{children:t}),(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.button,{onClick:()=>r(),children:"set"}),(0,o.jsx)(e.button,{onClick:()=>l(),children:"reset"}),(0,o.jsx)(e.button,{onClick:()=>a(),children:"clear"})]})]})},f=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function h(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"usetimeout",children:"useTimeout"})}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"window.setTimeout"}),"\uc744 \ud3b8\ub9ac\ud558\uac8c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294 \ucee4\uc2a4\ud140 \ud6c5 \uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:["option \uac12\uc73c\ub85c \uc22b\uc790\ub97c \ubc1b\uc744 \uc218 \uc788\uace0, \uac1d\uccb4\ub85c \ubc1b\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uac1d\uccb4\ub85c \ubc1b\uc744 \uacbd\uc6b0 ",(0,o.jsx)(t.code,{children:"delay"}),"\uc640 ",(0,o.jsx)(t.code,{children:"enabled"})," \uc18d\uc131\uc744 \ub118\uaca8\uc904 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:["Timeout\uc744 \uc9c1\uc811 \ud578\ub4e4\ub9c1 \ud560 \uc218 \uc788\ub294 ",(0,o.jsx)(t.code,{children:"set"}),", ",(0,o.jsx)(t.code,{children:"reset"}),", ",(0,o.jsx)(t.code,{children:"clear"})," \ud568\uc218\ub97c \ubc18\ud658\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useTimeout/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"interface TimeoutOptions {\n delay: number;\n enabled?: boolean;\n}\n"})}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"function useTimeout(\n callback: () => void,\n options: number\n): {\n set: () => void;\n clear: () => void;\n reset: () => void;\n};\n\nfunction useTimeout(\n callback: () => void,\n options: TimeoutOptions\n): {\n set: () => void;\n clear: () => void;\n reset: () => void;\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useTimeout } from '@modern-kit/react';\n\nconst Example = () => {\n const [number, setNumber] = useState(0);\n\n const { set, reset, clear } = useTimeout(() => {\n setNumber(number + 1);\n }, 1000);\n\n /*\n * useTimeout(() => {\n * setNumber(number + 1);\n * }, { delay: 1000, enabled: true });\n */\n\n return (\n \n
{number}
\n
\n \n \n \n
\n
\n );\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(d,{})]})}function p(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(h,{...e})}):h(e)}},4027:(e,t,n)=>{n.d(t,{$$:()=>$e,$I:()=>oe,AE:()=>We,BL:()=>H,DX:()=>N,FT:()=>ct,Fo:()=>et,Hn:()=>it,I5:()=>Ee,JF:()=>Pe,K:()=>ae,K$:()=>Je,M0:()=>Te,ML:()=>ne,Mj:()=>ye,Mk:()=>Le,Mo:()=>ie,NT:()=>Xe,QV:()=>Ue,Ub:()=>ke,Ut:()=>je,W7:()=>U,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>_e,Zu:()=>le,_1:()=>Re,_g:()=>nt,aL:()=>J,aY:()=>Ne,bB:()=>V,d7:()=>B,eG:()=>st,fN:()=>ce,fm:()=>G,gl:()=>$,hN:()=>D,iD:()=>de,iQ:()=>Fe,jd:()=>se,lW:()=>at,oD:()=>K,oo:()=>Oe,pL:()=>q,qi:()=>ue,rN:()=>Ie,tD:()=>Ce,u8:()=>Q,wY:()=>Be,xV:()=>F,xh:()=>tt,zy:()=>Z});var r=n(6206),o=n(4382),i=n(3683),s=n(5086),c=n(7197),l=(n(1604),n(5938));function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function m(){return typeof window>"u"}function g(){return!m()}function b(e){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const w=e=>f(void 0,0,void 0,(function*(){return b(yield(yield fetch(e)).text())}));function v(e,t){var n;return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return w(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const i=yield p(e,h[t]);n(i)}catch(i){console.error(`Failed to load image. message: ${i.mesaage}`),r(i)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i=0;i{if(e===t||S(e)&&S(t)&&isNaN(e)&&isNaN(t))return!0;if(C(e)&&C(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return y(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!x(o,t.get(r),n))return!1;return!0}return y(e,t,n)};function k(e,t){return x(e,t,new WeakMap)}function C(e){return"function"==typeof e}function S(e){return"number"==typeof e}function j(e){return!function(e){return Object(e)!==e}(e)}function E(){}function O(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const R=(...e)=>t=>e.forEach((e=>{if(C(e))e(t);else if(null!=e){e.current=t}}));function T(...e){return(0,o.useCallback)(R(...e),e)}const N=o.forwardRef(((e,t)=>{const{children:n}=e,i=a(e,["children"]),s=o.Children.toArray(n),c=s.find(L);if(c){const e=c.props.children,n=s.map((t=>t===c?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(I,Object.assign({},i,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(I,Object.assign({},i,{ref:t,children:n}))}));N.displayName="Slot";const I=o.forwardRef(((e,t)=>{const{children:n}=e,r=a(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),i):"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?R(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));I.displayName="SlotClone";const F=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function L(e){return o.isValidElement(e)&&e.type===F}var M="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const $=d(((e,t)=>{var{ratio:n,style:o,as:s="div",asChild:c=!1}=e,l=a(e,["ratio","style","as","asChild"]);const u=c?N:s,d=Object.assign({aspectRatio:n},o),f=c?l.className:i(M,l.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},l))})),P=()=>E,Y=()=>!1,X=()=>!0;function V({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)(P,Y,X)?e:t}function A(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const D=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>A()?(0,r.jsx)(r.Fragment,{children:t}):e;function W(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function _(e){const t=W(e);(0,o.useEffect)((()=>()=>t()),[t])}function z(e,t=k){const[n,r]=(0,o.useState)(e),i=W(t);return(0,o.useEffect)((()=>{i(n,e)||r(e)}),[i,n,e]),n}function B(e,t,n){const r=W(e),i=z(n),c=(0,o.useMemo)((()=>(0,s.A)(r,t,i)),[r,t,i]);return _((()=>c.cancel())),c}const J=({children:e,capture:t,wait:n,options:r})=>{const i=o.Children.only(e),s=B(((...e)=>{const n=i?.props;if(n&&C(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(i,{[t]:s})};function H({onIntersectStart:e=E,onIntersectEnd:t=E,enabled:n=!0,calledOnce:r=!1,root:i=null,threshold:s=0,rootMargin:c="0px 0px 0px 0px"}){const l=(0,o.useRef)(0),a=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=W((([n],o)=>{if(!n)return;const i=n.target;n.isIntersecting?(a.current=!0,l.current+=1,e(n)):a.current&&(a.current=!1,l.current+=1,t(n)),r&&l.current>1&&o.unobserve(i)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:s,root:i,rootMargin:c}),u.current.observe(e))}),[n,s,i,c,d])}}const K=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:i,rootMargin:s}=e,c=a(e,["src","threshold","root","rootMargin"]);const{ref:l}=H({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:i,rootMargin:s});return(0,r.jsx)("img",Object.assign({ref:T(t,l)},c))}));K.displayName="LazyImage";const U=(0,o.forwardRef)(((e,t)=>{var{width:n,height:i,fallback:s,className:c,style:l,duration:u="0.2s",onLoad:d}=e,f=a(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,p]=(0,o.useState)(!1),m=!h,g=(0,o.useMemo)((()=>({position:"relative",width:n,height:i})),[n,i]),b=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:m?0:1,transition:`opacity ${u}`},l)),[m,u,l]),w=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),v=c?`lazy-image-wrapper ${c}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:v,style:g,children:[m&&s,(0,r.jsx)(K,Object.assign({ref:t,width:n,height:i,style:b,onLoad:w},f))]})}));U.displayName="FallbackLazyImage";const Z=({condition:e,trueComponent:t,falseComponent:n})=>{const i=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:i?t:n})},Q=({onScrollAction:e,children:t,root:n,threshold:o,enabled:i,triggerPosition:s="after",rootMargin:c="150px 0px"})=>{const{ref:l}=H({onIntersectStart:e,root:n,threshold:o,enabled:i,rootMargin:c});return(0,r.jsxs)(r.Fragment,{children:["before"===s&&(0,r.jsx)("div",{ref:l}),t,"after"===s&&(0,r.jsx)("div",{ref:l})]})},q=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1}=e,c=a(e,["children","as","asChild"]);const l=s?N:i,{ref:u}=H(c);if(s&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(l,Object.assign({ref:R(t,u)},c,{children:n}))})),G=({items:e=[],itemKey:t,renderItem:n})=>{const i=(0,o.useCallback)(((e,n)=>function(e){return j(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},i(e,t))))})},ee=g()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=W(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),i=(0,o.useMemo)((()=>function(){if(m())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,i,(({target:t})=>{if(!r.current)return;const o=r.current,i=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!i&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1,onPointerDown:c,excludeRefs:l=[]}=e,u=a(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(c,{excludeRefs:l}),f=s?N:i;if(s&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:R(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const ie=({itemKey:e,items:t=[],separator:n,renderItem:i,separatorInterval:s=1,includeLastSeparator:c=!1})=>{const l=(0,o.useCallback)((e=>e===t.length-1?c:(e+1)%s==0),[c,s,t.length]);return(0,r.jsx)(G,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[i(e,t),l(t)&&n]})})},se=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ce=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function le(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function ae(e=!0){const t=C(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!i.current){i.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{i.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),i=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield b(e);return t(n),!0}catch{return t(null),!1}}))),[]),s=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield v(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),l=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:i,copyImage:s,readText:c,readContents:l}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",pe={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},me=e=>pe[e],ge=me("localStorage"),be=e=>window.localStorage.getItem(e),we=e=>JSON.stringify(e),ve=e=>(ge.subscribe(e),()=>{ge.unsubscribe(e)});function ye(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=C(n)?n():n,i=(0,o.useSyncExternalStore)(ve,(()=>be(t)),(()=>we(r)));return{state:(0,o.useMemo)((()=>i?O(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=be(t),o=n?O(n):r,i=C(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(i)),ge.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),ge.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const xe=(e,t)=>g()?window.matchMedia(e).matches:t??!1;function ke(e,t){const[n,r]=(0,o.useState)(xe(e,t)),i=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",i),n}function Ce(){return ke("(prefers-color-scheme: dark)")?"dark":"light"}const Se="color-scheme";function je({defaultValue:e,key:t=Se,shouldSetBodyClass:n=!1}={}){const r=Ce(),i=C(e)?e():e,{state:s,setState:c}=ye({key:t,initialValue:i??r}),l=(0,o.useCallback)((()=>{c((e=>"dark"===e?"light":"dark"))}),[c]),a=(0,o.useCallback)((()=>{c("dark")}),[c]),u=(0,o.useCallback)((()=>{c("light")}),[c]),d=(0,o.useCallback)((()=>{c(r)}),[c,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(s),()=>{n&&document.body.classList.remove(s)})),[s,n]),{colorScheme:s,preferredColorScheme:r,setToggleMode:l,setDarkMode:a,setLightMode:u,setPreferredMode:d}}function Ee(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),i=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),s=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:i,reset:s}}function Oe({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,i]=(0,o.useState)(t),s=r0,l=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),a=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const s=l(e,t);o&&o({prev:r,next:s}),i(s)}),[n,r,l]),u=(0,o.useCallback)((e=>{a("nextStep",!s,e)}),[s,a]),d=(0,o.useCallback)((e=>{a("prevStep",!c,e)}),[c,a]),f=(0,o.useCallback)(((t,n)=>{const o=C(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void i(t);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),i(t)}),[r,t]);return{currentStep:r,hasNextStep:s,hasPrevStep:c,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Re(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:i,resetStep:s}=Oe({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:i,resetIndex:s}}function Te(e,t,n={}){const[r,i]=(0,o.useState)(e);return[r,B(i,t,n)]}function Ne(e,t={}){const[n,r]=(0,o.useState)(""),[i,s]=Te("",e,t);return{value:n,debouncedValue:i,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),s(t)}),[s]),onReset:(0,o.useCallback)((()=>{r(""),s("")}),[s])}}function Ie(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Fe({onFocus:e=E,onBlur:t=E}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=W((t=>{r(!0),e(t)})),c=W((e=>{r(!1),t(e)})),l=(0,o.useCallback)((()=>{i.current&&(i.current.focus(),r(!0))}),[]);return ne(i,"focus",s),ne(i,"blur",c),{ref:i,isFocus:n,setFocus:l}}function Le({onEnter:e=E,onLeave:t=E}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=W((t=>{r(!0),e(t)})),c=W((e=>{r(!1),t(e)}));return ne(i,"mouseenter",s),ne(i,"mouseleave",c),{ref:i,isHovered:n}}const Me=e=>{var t;return S(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function $e(e,t){const n=(0,o.useRef)(),r=W(e),{delay:i,enabled:s}=Me(t),c=(0,o.useCallback)((()=>{n.current=window.setInterval(r,i)}),[r,i]),l=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),c()}),[l,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>l()}),[l,c,s,i]),{set:c,reset:a,clear:l}}function Pe({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),i=W((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];C(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",i),()=>t.removeEventListener("keydown",i)}),[e,i]),r}const Ye={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function Xe(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)(Ye),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:l}=t;let a=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();a=i-t.left,u=s-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:l,elementRelativeX:a,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const Ve=()=>navigator.onLine,Ae=()=>!0,De=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function We({onlineAction:e=E,offlineAction:t=E}={}){const n=W((n=>De(n,e,t)));return(0,o.useSyncExternalStore)(n,Ve,Ae)}function _e(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const ze={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Be(e=E){const[t,n]=(0,o.useState)(ze),r=(0,o.useRef)(null),i=W((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(i);return t.observe(e),()=>{t.unobserve(e)}}),[i]),{ref:r,contentRect:t}}function Je({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),i=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>i())),[e,r,i]),{ref:t,lock:r,unlock:i}}const He=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,Ke=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:i=0,alignY:s="start",alignX:c="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+i+He(window.innerHeight,r.height,s),left:r.left+window.scrollX+o+He(window.innerWidth,r.width,c)};const l=e.getBoundingClientRect();return{top:r.top-l.top+e.scrollTop+i+He(l.height,r.height,s),left:r.left-l.left+e.scrollLeft+o+He(l.width,r.width,c)}};function Ue(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:i,top:s}=Ke(r,t,n);r.scrollTo({top:s,left:i,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ze=me("sessionStorage"),Qe=e=>window.sessionStorage.getItem(e),qe=e=>JSON.stringify(e),Ge=e=>(Ze.subscribe(e),()=>{Ze.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=C(n)?n():n,i=(0,o.useSyncExternalStore)(Ge,(()=>Qe(t)),(()=>qe(r)));return{state:(0,o.useMemo)((()=>i?O(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=Qe(t),o=n?O(n):r,i=C(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(i)),Ze.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ze.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:i}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[s,c]=(0,o.useState)(n),l=(0,o.useCallback)((e=>{c((t=>{const n=C(e)?e(t):e;return r&&i&&function(e,t,n){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=C(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,i,n),n}))}),[r,i]),a=(0,o.useCallback)((()=>{r&&i&&function(e,t){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,i),c(null)}),[r,i]);return Object.assign({state:s,setState:l,clearState:a},Oe(e))}function nt(e,t,n={}){const r=W(e),i=z(n),s=(0,o.useMemo)((()=>(0,c.A)(r,t,i)),[r,t,i]);return _((()=>s.cancel())),s}const rt=e=>{var t;return S(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=W(e),{delay:i,enabled:s}=rt(t),c=(0,o.useCallback)((()=>{n.current=setTimeout(r,i)}),[r,i]),l=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),c()}),[l,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>l()}),[c,l,i,s]),{set:c,reset:a,clear:l}}function it(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function st(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new l.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function ct({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const lt={width:null,height:null};function at({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>m()?lt:{width:window.innerWidth,height:window.innerHeight})),r=B(n,e),i=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",i),t}function ut(e,t,n){const{delay:r,enabled:i}=rt(t),{set:s,reset:c,clear:l}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!i||c()}),[r,i,c,...n]),{set:s,reset:c,clear:l}}}}]);
\ No newline at end of file
diff --git a/assets/js/771be322.5aeede07.js b/assets/js/771be322.5aeede07.js
deleted file mode 100644
index 2813145d1..000000000
--- a/assets/js/771be322.5aeede07.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[588],{2623:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>u,assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>c,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"react/hooks/useDebouncedInputValue","title":"useDebouncedInputValue","description":"input value\ub97c \uad00\ub9ac\ud558\uace0, \ub514\ubc14\uc6b4\uc2f1(debouncing)\uc744 \uc801\uc6a9\ud558\ub294 \ucee4\uc2a4\ud140 React \ud6c5\uc785\ub2c8\ub2e4","source":"@site/docs/react/hooks/useDebouncedInputValue.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useDebouncedInputValue","permalink":"/modern-kit/docs/react/hooks/useDebouncedInputValue","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useDebounce","permalink":"/modern-kit/docs/react/hooks/useDebounce"},"next":{"title":"useDebouncedState","permalink":"/modern-kit/docs/react/hooks/useDebouncedState"}}');var o=n(6206),i=n(3267),s=(n(4382),n(4027));const c={},a="useDebouncedInputValue",l={},u=()=>{const e={button:"button",div:"div",input:"input",p:"p",...(0,i.R)()},{value:t,debouncedValue:n,onChange:r,onReset:c}=(0,s.aY)(500);return(0,o.jsxs)(e.div,{children:[(0,o.jsxs)(e.p,{children:["\ud604\uc7ac \uc785\ub825 \uac12: ",t]}),(0,o.jsxs)(e.p,{children:["\ub514\ubc14\uc6b4\uc2f1 \uc785\ub825 \uac12: ",n]}),(0,o.jsx)(e.div,{children:(0,o.jsx)(e.input,{type:"text",onChange:r,value:t})}),(0,o.jsx)(e.div,{children:(0,o.jsx)(e.button,{onClick:c,children:"Reset \ubc84\ud2bc"})})]})},d=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function f(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"usedebouncedinputvalue",children:"useDebouncedInputValue"})}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"input value"}),"\ub97c \uad00\ub9ac\ud558\uace0, ",(0,o.jsx)(t.code,{children:"\ub514\ubc14\uc6b4\uc2f1(debouncing)"}),"\uc744 \uc801\uc6a9\ud558\ub294 \ucee4\uc2a4\ud140 React \ud6c5\uc785\ub2c8\ub2e4"]}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"\ud604\uc7ac \uc785\ub825 \uac12"}),"\uacfc ",(0,o.jsx)(t.code,{children:"\ub514\ubc14\uc6b4\uc2f1\ub41c \uac12"}),"\uc744 \uc81c\uacf5\ud558\uba70, \uac12\uc744 \uc5c5\ub370\uc774\ud2b8\ud558\uace0 \ub9ac\uc14b\ud560 \uc218 \uc788\ub294 \ud568\uc218\ub3c4 \ud568\uaed8 \uc81c\uacf5\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useDebouncedInputValue/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"type DebounceParameters = Parameters;\n"})}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"function useDebouncedInputValue(\n wait: DebounceParameters[1],\n options?: DebounceParameters[2]\n): {\n value: string;\n debouncedValue: string;\n onChange: (e: ChangeEvent) => void;\n onReset: () => void;\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useState } from 'react';\nimport { useDebouncedInputValue } from '@modern-kit/react';\n\nconst Example = () => {\n const { value, debouncedValue, onChange, onReset } = useDebouncedInputValue(500);\n\n return (\n \n
\ud604\uc7ac \uc785\ub825 \uac12: {value}
\n
\ub514\ubc14\uc6b4\uc2f1 \uc785\ub825 \uac12: {debouncedValue}
\n
\n \n
\n
\n \n
\n
\n );\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(u,{})]})}function h(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(f,{...e})}):f(e)}},4027:(e,t,n)=>{n.d(t,{$$:()=>Me,$I:()=>oe,AE:()=>We,BL:()=>J,DX:()=>F,FT:()=>ct,Fo:()=>et,Hn:()=>it,I5:()=>je,JF:()=>Ve,K:()=>le,K$:()=>He,M0:()=>Ie,ML:()=>ne,Mj:()=>ye,Mk:()=>Pe,Mo:()=>ie,NT:()=>Te,QV:()=>Ue,Ub:()=>ke,Ut:()=>Ee,W7:()=>U,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>_e,Zu:()=>ae,_1:()=>Oe,_g:()=>nt,aL:()=>H,aY:()=>Fe,bB:()=>Y,d7:()=>B,eG:()=>st,fN:()=>ce,fm:()=>G,gl:()=>M,hN:()=>A,iD:()=>de,iQ:()=>Le,jd:()=>se,lW:()=>lt,oD:()=>K,oo:()=>Re,pL:()=>q,qi:()=>ue,rN:()=>Ne,tD:()=>Ce,u8:()=>Q,wY:()=>Be,xV:()=>L,xh:()=>tt,zy:()=>Z});var r=n(6206),o=n(4382),i=n(3683),s=n(5086),c=n(7197),a=(n(1604),n(5938));function l(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function m(){return typeof window>"u"}function g(){return!m()}function b(e){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const w=e=>f(void 0,0,void 0,(function*(){return b(yield(yield fetch(e)).text())}));function v(e,t){var n;return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return w(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const i=yield p(e,h[t]);n(i)}catch(i){console.error(`Failed to load image. message: ${i.mesaage}`),r(i)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i=0;i{if(e===t||S(e)&&S(t)&&isNaN(e)&&isNaN(t))return!0;if(C(e)&&C(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return y(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!x(o,t.get(r),n))return!1;return!0}return y(e,t,n)};function k(e,t){return x(e,t,new WeakMap)}function C(e){return"function"==typeof e}function S(e){return"number"==typeof e}function E(e){return!function(e){return Object(e)!==e}(e)}function j(){}function R(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const O=(...e)=>t=>e.forEach((e=>{if(C(e))e(t);else if(null!=e){e.current=t}}));function I(...e){return(0,o.useCallback)(O(...e),e)}const F=o.forwardRef(((e,t)=>{const{children:n}=e,i=l(e,["children"]),s=o.Children.toArray(n),c=s.find(P);if(c){const e=c.props.children,n=s.map((t=>t===c?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(N,Object.assign({},i,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(N,Object.assign({},i,{ref:t,children:n}))}));F.displayName="Slot";const N=o.forwardRef(((e,t)=>{const{children:n}=e,r=l(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),i):"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?O(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));N.displayName="SlotClone";const L=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function P(e){return o.isValidElement(e)&&e.type===L}var D="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const M=d(((e,t)=>{var{ratio:n,style:o,as:s="div",asChild:c=!1}=e,a=l(e,["ratio","style","as","asChild"]);const u=c?F:s,d=Object.assign({aspectRatio:n},o),f=c?a.className:i(D,a.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},a))})),V=()=>j,$=()=>!1,T=()=>!0;function Y({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)(V,$,T)?e:t}function X(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const A=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>X()?(0,r.jsx)(r.Fragment,{children:t}):e;function W(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function _(e){const t=W(e);(0,o.useEffect)((()=>()=>t()),[t])}function z(e,t=k){const[n,r]=(0,o.useState)(e),i=W(t);return(0,o.useEffect)((()=>{i(n,e)||r(e)}),[i,n,e]),n}function B(e,t,n){const r=W(e),i=z(n),c=(0,o.useMemo)((()=>(0,s.A)(r,t,i)),[r,t,i]);return _((()=>c.cancel())),c}const H=({children:e,capture:t,wait:n,options:r})=>{const i=o.Children.only(e),s=B(((...e)=>{const n=i?.props;if(n&&C(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(i,{[t]:s})};function J({onIntersectStart:e=j,onIntersectEnd:t=j,enabled:n=!0,calledOnce:r=!1,root:i=null,threshold:s=0,rootMargin:c="0px 0px 0px 0px"}){const a=(0,o.useRef)(0),l=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=W((([n],o)=>{if(!n)return;const i=n.target;n.isIntersecting?(l.current=!0,a.current+=1,e(n)):l.current&&(l.current=!1,a.current+=1,t(n)),r&&a.current>1&&o.unobserve(i)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:s,root:i,rootMargin:c}),u.current.observe(e))}),[n,s,i,c,d])}}const K=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:i,rootMargin:s}=e,c=l(e,["src","threshold","root","rootMargin"]);const{ref:a}=J({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:i,rootMargin:s});return(0,r.jsx)("img",Object.assign({ref:I(t,a)},c))}));K.displayName="LazyImage";const U=(0,o.forwardRef)(((e,t)=>{var{width:n,height:i,fallback:s,className:c,style:a,duration:u="0.2s",onLoad:d}=e,f=l(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,p]=(0,o.useState)(!1),m=!h,g=(0,o.useMemo)((()=>({position:"relative",width:n,height:i})),[n,i]),b=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:m?0:1,transition:`opacity ${u}`},a)),[m,u,a]),w=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),v=c?`lazy-image-wrapper ${c}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:v,style:g,children:[m&&s,(0,r.jsx)(K,Object.assign({ref:t,width:n,height:i,style:b,onLoad:w},f))]})}));U.displayName="FallbackLazyImage";const Z=({condition:e,trueComponent:t,falseComponent:n})=>{const i=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:i?t:n})},Q=({onScrollAction:e,children:t,root:n,threshold:o,enabled:i,triggerPosition:s="after",rootMargin:c="150px 0px"})=>{const{ref:a}=J({onIntersectStart:e,root:n,threshold:o,enabled:i,rootMargin:c});return(0,r.jsxs)(r.Fragment,{children:["before"===s&&(0,r.jsx)("div",{ref:a}),t,"after"===s&&(0,r.jsx)("div",{ref:a})]})},q=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1}=e,c=l(e,["children","as","asChild"]);const a=s?F:i,{ref:u}=J(c);if(s&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(a,Object.assign({ref:O(t,u)},c,{children:n}))})),G=({items:e=[],itemKey:t,renderItem:n})=>{const i=(0,o.useCallback)(((e,n)=>function(e){return E(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},i(e,t))))})},ee=g()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=W(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),i=(0,o.useMemo)((()=>function(){if(m())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,i,(({target:t})=>{if(!r.current)return;const o=r.current,i=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!i&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1,onPointerDown:c,excludeRefs:a=[]}=e,u=l(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(c,{excludeRefs:a}),f=s?F:i;if(s&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:O(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const ie=({itemKey:e,items:t=[],separator:n,renderItem:i,separatorInterval:s=1,includeLastSeparator:c=!1})=>{const a=(0,o.useCallback)((e=>e===t.length-1?c:(e+1)%s==0),[c,s,t.length]);return(0,r.jsx)(G,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[i(e,t),a(t)&&n]})})},se=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ce=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function ae(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function le(e=!0){const t=C(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!i.current){i.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{i.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),i=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield b(e);return t(n),!0}catch{return t(null),!1}}))),[]),s=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield v(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),a=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:i,copyImage:s,readText:c,readContents:a}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",pe={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},me=e=>pe[e],ge=me("localStorage"),be=e=>window.localStorage.getItem(e),we=e=>JSON.stringify(e),ve=e=>(ge.subscribe(e),()=>{ge.unsubscribe(e)});function ye(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=C(n)?n():n,i=(0,o.useSyncExternalStore)(ve,(()=>be(t)),(()=>we(r)));return{state:(0,o.useMemo)((()=>i?R(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=be(t),o=n?R(n):r,i=C(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(i)),ge.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),ge.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const xe=(e,t)=>g()?window.matchMedia(e).matches:t??!1;function ke(e,t){const[n,r]=(0,o.useState)(xe(e,t)),i=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",i),n}function Ce(){return ke("(prefers-color-scheme: dark)")?"dark":"light"}const Se="color-scheme";function Ee({defaultValue:e,key:t=Se,shouldSetBodyClass:n=!1}={}){const r=Ce(),i=C(e)?e():e,{state:s,setState:c}=ye({key:t,initialValue:i??r}),a=(0,o.useCallback)((()=>{c((e=>"dark"===e?"light":"dark"))}),[c]),l=(0,o.useCallback)((()=>{c("dark")}),[c]),u=(0,o.useCallback)((()=>{c("light")}),[c]),d=(0,o.useCallback)((()=>{c(r)}),[c,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(s),()=>{n&&document.body.classList.remove(s)})),[s,n]),{colorScheme:s,preferredColorScheme:r,setToggleMode:a,setDarkMode:l,setLightMode:u,setPreferredMode:d}}function je(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),i=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),s=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:i,reset:s}}function Re({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,i]=(0,o.useState)(t),s=r0,a=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),l=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const s=a(e,t);o&&o({prev:r,next:s}),i(s)}),[n,r,a]),u=(0,o.useCallback)((e=>{l("nextStep",!s,e)}),[s,l]),d=(0,o.useCallback)((e=>{l("prevStep",!c,e)}),[c,l]),f=(0,o.useCallback)(((t,n)=>{const o=C(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void i(t);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),i(t)}),[r,t]);return{currentStep:r,hasNextStep:s,hasPrevStep:c,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Oe(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:i,resetStep:s}=Re({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:i,resetIndex:s}}function Ie(e,t,n={}){const[r,i]=(0,o.useState)(e);return[r,B(i,t,n)]}function Fe(e,t={}){const[n,r]=(0,o.useState)(""),[i,s]=Ie("",e,t);return{value:n,debouncedValue:i,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),s(t)}),[s]),onReset:(0,o.useCallback)((()=>{r(""),s("")}),[s])}}function Ne(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Le({onFocus:e=j,onBlur:t=j}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=W((t=>{r(!0),e(t)})),c=W((e=>{r(!1),t(e)})),a=(0,o.useCallback)((()=>{i.current&&(i.current.focus(),r(!0))}),[]);return ne(i,"focus",s),ne(i,"blur",c),{ref:i,isFocus:n,setFocus:a}}function Pe({onEnter:e=j,onLeave:t=j}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=W((t=>{r(!0),e(t)})),c=W((e=>{r(!1),t(e)}));return ne(i,"mouseenter",s),ne(i,"mouseleave",c),{ref:i,isHovered:n}}const De=e=>{var t;return S(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function Me(e,t){const n=(0,o.useRef)(),r=W(e),{delay:i,enabled:s}=De(t),c=(0,o.useCallback)((()=>{n.current=window.setInterval(r,i)}),[r,i]),a=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{a(),c()}),[a,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>a()}),[a,c,s,i]),{set:c,reset:l,clear:a}}function Ve({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),i=W((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];C(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",i),()=>t.removeEventListener("keydown",i)}),[e,i]),r}const $e={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function Te(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)($e),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:a}=t;let l=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();l=i-t.left,u=s-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:a,elementRelativeX:l,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const Ye=()=>navigator.onLine,Xe=()=>!0,Ae=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function We({onlineAction:e=j,offlineAction:t=j}={}){const n=W((n=>Ae(n,e,t)));return(0,o.useSyncExternalStore)(n,Ye,Xe)}function _e(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const ze={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Be(e=j){const[t,n]=(0,o.useState)(ze),r=(0,o.useRef)(null),i=W((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(i);return t.observe(e),()=>{t.unobserve(e)}}),[i]),{ref:r,contentRect:t}}function He({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),i=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>i())),[e,r,i]),{ref:t,lock:r,unlock:i}}const Je=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,Ke=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:i=0,alignY:s="start",alignX:c="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+i+Je(window.innerHeight,r.height,s),left:r.left+window.scrollX+o+Je(window.innerWidth,r.width,c)};const a=e.getBoundingClientRect();return{top:r.top-a.top+e.scrollTop+i+Je(a.height,r.height,s),left:r.left-a.left+e.scrollLeft+o+Je(a.width,r.width,c)}};function Ue(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:i,top:s}=Ke(r,t,n);r.scrollTo({top:s,left:i,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ze=me("sessionStorage"),Qe=e=>window.sessionStorage.getItem(e),qe=e=>JSON.stringify(e),Ge=e=>(Ze.subscribe(e),()=>{Ze.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=C(n)?n():n,i=(0,o.useSyncExternalStore)(Ge,(()=>Qe(t)),(()=>qe(r)));return{state:(0,o.useMemo)((()=>i?R(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=Qe(t),o=n?R(n):r,i=C(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(i)),Ze.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ze.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:i}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[s,c]=(0,o.useState)(n),a=(0,o.useCallback)((e=>{c((t=>{const n=C(e)?e(t):e;return r&&i&&function(e,t,n){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=C(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,i,n),n}))}),[r,i]),l=(0,o.useCallback)((()=>{r&&i&&function(e,t){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,i),c(null)}),[r,i]);return Object.assign({state:s,setState:a,clearState:l},Re(e))}function nt(e,t,n={}){const r=W(e),i=z(n),s=(0,o.useMemo)((()=>(0,c.A)(r,t,i)),[r,t,i]);return _((()=>s.cancel())),s}const rt=e=>{var t;return S(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=W(e),{delay:i,enabled:s}=rt(t),c=(0,o.useCallback)((()=>{n.current=setTimeout(r,i)}),[r,i]),a=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{a(),c()}),[a,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>a()}),[c,a,i,s]),{set:c,reset:l,clear:a}}function it(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function st(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new a.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function ct({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const at={width:null,height:null};function lt({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>m()?at:{width:window.innerWidth,height:window.innerHeight})),r=B(n,e),i=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",i),t}function ut(e,t,n){const{delay:r,enabled:i}=rt(t),{set:s,reset:c,clear:a}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!i||c()}),[r,i,c,...n]),{set:s,reset:c,clear:a}}}}]);
\ No newline at end of file
diff --git a/assets/js/771be322.c8085557.js b/assets/js/771be322.c8085557.js
new file mode 100644
index 000000000..bf1a31f9f
--- /dev/null
+++ b/assets/js/771be322.c8085557.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[588],{5705:(e,n,t)=>{t.r(n),t.d(n,{Example:()=>l,assets:()=>d,contentTitle:()=>s,default:()=>h,frontMatter:()=>a,metadata:()=>r,toc:()=>f});const r=JSON.parse('{"id":"react/hooks/useDebouncedInputValue","title":"useDebouncedInputValue","description":"input value\ub97c \uad00\ub9ac\ud558\uace0, \ub514\ubc14\uc6b4\uc2f1(debouncing)\uc744 \uc801\uc6a9\ud558\ub294 \ucee4\uc2a4\ud140 React \ud6c5\uc785\ub2c8\ub2e4","source":"@site/docs/react/hooks/useDebouncedInputValue.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useDebouncedInputValue","permalink":"/modern-kit/docs/react/hooks/useDebouncedInputValue","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useDebounce","permalink":"/modern-kit/docs/react/hooks/useDebounce"},"next":{"title":"useDebouncedState","permalink":"/modern-kit/docs/react/hooks/useDebouncedState"}}');var o=t(6206),i=t(3267),c=t(4382),u=t(9883);const a={},s="useDebouncedInputValue",d={},l=()=>{const e={button:"button",div:"div",input:"input",p:"p",...(0,i.R)()},{value:n,debouncedValue:t,onChange:r,onReset:a}=function(e,n={}){const[t,r]=(0,c.useState)(""),[o,i]=(0,u.M)("",e,n);return{value:t,debouncedValue:o,onChange:(0,c.useCallback)((e=>{const{value:n}=e.target;r(n),i(n)}),[i]),onReset:(0,c.useCallback)((()=>{r(""),i("")}),[i])}}(500);return(0,o.jsxs)(e.div,{children:[(0,o.jsxs)(e.p,{children:["\ud604\uc7ac \uc785\ub825 \uac12: ",n]}),(0,o.jsxs)(e.p,{children:["\ub514\ubc14\uc6b4\uc2f1 \uc785\ub825 \uac12: ",t]}),(0,o.jsx)(e.div,{children:(0,o.jsx)(e.input,{type:"text",onChange:r,value:n})}),(0,o.jsx)(e.div,{children:(0,o.jsx)(e.button,{onClick:a,children:"Reset \ubc84\ud2bc"})})]})},f=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function p(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.header,{children:(0,o.jsx)(n.h1,{id:"usedebouncedinputvalue",children:"useDebouncedInputValue"})}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.code,{children:"input value"}),"\ub97c \uad00\ub9ac\ud558\uace0, ",(0,o.jsx)(n.code,{children:"\ub514\ubc14\uc6b4\uc2f1(debouncing)"}),"\uc744 \uc801\uc6a9\ud558\ub294 \ucee4\uc2a4\ud140 React \ud6c5\uc785\ub2c8\ub2e4"]}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.code,{children:"\ud604\uc7ac \uc785\ub825 \uac12"}),"\uacfc ",(0,o.jsx)(n.code,{children:"\ub514\ubc14\uc6b4\uc2f1\ub41c \uac12"}),"\uc744 \uc81c\uacf5\ud558\uba70, \uac12\uc744 \uc5c5\ub370\uc774\ud2b8\ud558\uace0 \ub9ac\uc14b\ud560 \uc218 \uc788\ub294 \ud568\uc218\ub3c4 \ud568\uaed8 \uc81c\uacf5\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(n.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useDebouncedInputValue/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(n.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"type DebounceParameters = Parameters;\n"})}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"function useDebouncedInputValue(\n wait: DebounceParameters[1],\n options?: DebounceParameters[2]\n): {\n value: string;\n debouncedValue: string;\n onChange: (e: ChangeEvent) => void;\n onReset: () => void;\n};\n"})}),"\n",(0,o.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useState } from 'react';\nimport { useDebouncedInputValue } from '@modern-kit/react';\n\nconst Example = () => {\n const { value, debouncedValue, onChange, onReset } = useDebouncedInputValue(500);\n\n return (\n \n
\ud604\uc7ac \uc785\ub825 \uac12: {value}
\n
\ub514\ubc14\uc6b4\uc2f1 \uc785\ub825 \uac12: {debouncedValue}
\n
\n \n
\n
\n \n
\n
\n );\n};\n"})}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(l,{})]})}function h(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(p,{...e})}):p(e)}},3267:(e,n,t)=>{t.d(n,{R:()=>c,x:()=>u});var r=t(4382);const o={},i=r.createContext(o);function c(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function u(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:c(e.components),r.createElement(i.Provider,{value:n},e.children)}},5115:(e,n,t)=>{t.d(n,{d:()=>a});var r=t(4382),o=t(5086),i=t(3311),c=t(6765),u=t(5423);function a(e,n,t){const a=(0,c.p)(e),s=(0,u.B)(t),d=(0,r.useMemo)((()=>(0,o.A)(a,n,s)),[a,n,s]);return(0,i.i)((()=>d.cancel())),d}},9883:(e,n,t)=>{t.d(n,{M:()=>i});var r=t(5115),o=t(4382);function i(e,n,t={}){const[i,c]=(0,o.useState)(e);return[i,(0,r.d)(c,n,t)]}},6765:(e,n,t)=>{t.d(n,{p:()=>o});var r=t(4382);function o(e){const n=(0,r.useRef)(e);return n.current=e,(0,r.useCallback)(((...e)=>n.current(...e)),[])}},5423:(e,n,t)=>{t.d(n,{B:()=>c});var r=t(4382),o=t(6765),i=t(9340);function c(e,n=i.Gp){const[t,c]=(0,r.useState)(e),u=(0,o.p)(n);return(0,r.useEffect)((()=>{u(t,e)||c(e)}),[u,t,e]),t}},3311:(e,n,t)=>{t.d(n,{i:()=>i});var r=t(6765),o=t(4382);function i(e){const n=(0,r.p)(e);(0,o.useEffect)((()=>()=>n()),[n])}},5086:(e,n,t)=>{t.d(n,{A:()=>N});var r=t(322);const o="object"==typeof global&&global&&global.Object===Object&&global;var i="object"==typeof self&&self&&self.Object===Object&&self;const c=o||i||Function("return this")();const u=function(){return c.Date.now()};var a=/\s/;const s=function(e){for(var n=e.length;n--&&a.test(e.charAt(n)););return n};var d=/^\s+/;const l=function(e){return e?e.slice(0,s(e)+1).replace(d,""):e};const f=c.Symbol;var p=Object.prototype,h=p.hasOwnProperty,v=p.toString,m=f?f.toStringTag:void 0;const b=function(e){var n=h.call(e,m),t=e[m];try{e[m]=void 0;var r=!0}catch(i){}var o=v.call(e);return r&&(n?e[m]=t:delete e[m]),o};var g=Object.prototype.toString;const y=function(e){return g.call(e)};var w=f?f.toStringTag:void 0;const x=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":w&&w in Object(e)?b(e):y(e)};const j=function(e){return null!=e&&"object"==typeof e};const k=function(e){return"symbol"==typeof e||j(e)&&"[object Symbol]"==x(e)};var C=/^[-+]0x[0-9a-f]+$/i,E=/^0b[01]+$/i,S=/^0o[0-7]+$/i,O=parseInt;const D=function(e){if("number"==typeof e)return e;if(k(e))return NaN;if((0,r.A)(e)){var n="function"==typeof e.valueOf?e.valueOf():e;e=(0,r.A)(n)?n+"":n}if("string"!=typeof e)return 0===e?e:+e;e=l(e);var t=E.test(e);return t||S.test(e)?O(e.slice(2),t?2:8):C.test(e)?NaN:+e};var I=Math.max,$=Math.min;const N=function(e,n,t){var o,i,c,a,s,d,l=0,f=!1,p=!1,h=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function v(n){var t=o,r=i;return o=i=void 0,l=n,a=e.apply(r,t)}function m(e){var t=e-d;return void 0===d||t>=n||t<0||p&&e-l>=c}function b(){var e=u();if(m(e))return g(e);s=setTimeout(b,function(e){var t=n-(e-d);return p?$(t,c-(e-l)):t}(e))}function g(e){return s=void 0,h&&o?v(e):(o=i=void 0,a)}function y(){var e=u(),t=m(e);if(o=arguments,i=this,d=e,t){if(void 0===s)return function(e){return l=e,s=setTimeout(b,n),f?v(e):a}(d);if(p)return clearTimeout(s),s=setTimeout(b,n),v(d)}return void 0===s&&(s=setTimeout(b,n)),a}return n=D(n)||0,(0,r.A)(t)&&(f=!!t.leading,c=(p="maxWait"in t)?I(D(t.maxWait)||0,n):c,h="trailing"in t?!!t.trailing:h),y.cancel=function(){void 0!==s&&clearTimeout(s),l=0,o=d=i=s=void 0},y.flush=function(){return void 0===s?a:g(u())},y}},322:(e,n,t)=>{t.d(n,{A:()=>r});const r=function(e){var n=typeof e;return null!=e&&("object"==n||"function"==n)}},9340:(e,n,t)=>{function r(e,n,t,r){return new(t||(t=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(n){i(n)}}function u(e){try{a(r.throw(e))}catch(n){i(n)}}function a(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(c,u)}a((r=r.apply(e,n||[])).next())}))}t.d(n,{Et:()=>w,Fr:()=>u,Gp:()=>b,Ol:()=>E,Qd:()=>j,S$:()=>c,Tn:()=>g,Zp:()=>f,dK:()=>s,fl:()=>D,gD:()=>y,i5:()=>h,if:()=>p,l6:()=>k,lQ:()=>C,nS:()=>l,ni:()=>I,oc:()=>a}),"function"==typeof SuppressedError&&SuppressedError;const o={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};const i=(e,n)=>new Promise(((t,r)=>{e.toBlob((e=>{e?t(e):r(new Error(`Failed to create blob with format ${n}`))}),n)}));function c(){return"undefined"==typeof window}function u(){if(c())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}function a(){return!c()}function s(e){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const n=document.createElement("textarea");n.value=e,n.style.opacity="0",document.body.appendChild(n),n.focus(),n.select();try{return document.execCommand("copy"),e}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}finally{document.body.removeChild(n)}}(e)}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}}))}const d=e=>r(void 0,void 0,void 0,(function*(){const n=yield fetch(e);return s(yield n.text())}));function l(e,n){var t;return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator))return d(e);if(!("write"in window.navigator.clipboard))return d(e);if(null!==(t=null==n?void 0:n.toText)&&void 0!==t&&t)return d(e);const c=yield function(e,n="png"){return new Promise(((t,c)=>{const u=new Image;u.onload=()=>r(this,void 0,void 0,(function*(){const e=document.createElement("canvas");e.width=u.width,e.height=u.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(u,0,0);const c=yield i(e,o[n]);t(c)}catch(r){console.error(`Failed to load image. message: ${r.mesaage}`),c(r)}})),u.onerror=()=>{c(new Error("Failed to load image"))},u.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[c.type]:c})]),c}catch(c){throw console.error(`Failed to copy to clipboard. message: ${c.message}`),c}}))}function f(){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function p(){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function h(e,n){return Object.prototype.hasOwnProperty.call(e,n)}const v=(e,n,t)=>{const r=Object.keys(e),o=Object.keys(n);if(r.length!==o.length)return!1;for(let i=0;i{if(e===n)return!0;if(w(e)&&w(n)&&isNaN(e)&&isNaN(n))return!0;if(g(e)&&g(n))return e.toString()===n.toString();if("object"!=typeof e||"object"!=typeof n||null===e||null===n)return!1;if(t.has(e)&&t.get(e)===n)return!0;if(t.set(e,n),e.constructor!==n.constructor)return!1;if(e instanceof Set){if(e.size!==n.size)return!1;const r=[...e],o=[...n];return v(r,o,t)}if(e instanceof Map){if(e.size!==n.size)return!1;for(const[r,o]of e)if(!n.has(r)||!m(o,n.get(r),t))return!1;return!0}return v(e,n,t)};function b(e,n){return m(e,n,new WeakMap)}function g(e){return"function"==typeof e}function y(e){return null==e}function w(e){return"number"==typeof e}function x(e){return!function(e){return Object(e)!==e}(e)}function j(e){return x(e)&&"[object Object]"===Object.prototype.toString.call(e)}function k(e){return e===window}function C(){}function E(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(n){throw new Error(`Failed to parse data: ${n}`)}}function S(e){return Object.keys(e)}const O={days:864e5,hours:36e5,minutes:6e4,seconds:1e3};S(O);function D(e,n){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(n)}catch(t){throw new Error(`Failed to remove key "${n}" from ${e}: ${t}`)}}function I(e,n,t){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=g(t)?t():t;r.setItem(n,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${n}" in ${e}: ${r}`)}}}}]);
\ No newline at end of file
diff --git a/assets/js/78bcb238.70a9a9dd.js b/assets/js/78bcb238.70a9a9dd.js
new file mode 100644
index 000000000..244b390f9
--- /dev/null
+++ b/assets/js/78bcb238.70a9a9dd.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[3582],{7204:(e,n,t)=>{t.r(n),t.d(n,{Example:()=>p,assets:()=>d,contentTitle:()=>i,default:()=>h,frontMatter:()=>a,metadata:()=>o,toc:()=>m});const o=JSON.parse('{"id":"react/components/IfElse","title":"IfElse","description":"IfElse \ucef4\ud3ec\ub10c\ud2b8\ub294 \uc8fc\uc5b4\uc9c4 \uc870\uac74\uc5d0 \ub530\ub77c \ub450 \uac00\uc9c0 \ucef4\ud3ec\ub10c\ud2b8 \uc911 \ud558\ub098\ub97c \ub80c\ub354\ub9c1\ud558\ub294 \uac04\ub2e8\ud55c \ub3c4\uad6c\uc785\ub2c8\ub2e4.","source":"@site/docs/react/components/IfElse.mdx","sourceDirName":"react/components","slug":"/react/components/IfElse","permalink":"/modern-kit/docs/react/components/IfElse","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"FallbackLazyImage","permalink":"/modern-kit/docs/react/components/FallbackLazyImage"},"next":{"title":"InView","permalink":"/modern-kit/docs/react/components/InView"}}');var s=t(6206),r=t(3267),c=t(4382);const l=({condition:e,trueComponent:n,falseComponent:t})=>{const o=(e=>"function"==typeof e?e():e)(e);return(0,s.jsx)(c.Fragment,{children:o?n:t})},a={},i="IfElse",d={},p=()=>{const e={button:"button",h1:"h1",...(0,r.R)()},[n,t]=(0,c.useState)(!1);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(e.button,{onClick:()=>t(!n),children:"Toggle Button"}),(0,s.jsx)(l,{condition:n,trueComponent:(0,s.jsx)(e.h1,{children:"true component"}),falseComponent:(0,s.jsx)(e.h1,{children:"false component"})})]})},m=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function u(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",strong:"strong",...(0,r.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.header,{children:(0,s.jsx)(n.h1,{id:"ifelse",children:"IfElse"})}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"IfElse"})," \ucef4\ud3ec\ub10c\ud2b8\ub294 \uc8fc\uc5b4\uc9c4 \uc870\uac74\uc5d0 \ub530\ub77c \ub450 \uac00\uc9c0 \ucef4\ud3ec\ub10c\ud2b8 \uc911 \ud558\ub098\ub97c \ub80c\ub354\ub9c1\ud558\ub294 \uac04\ub2e8\ud55c \ub3c4\uad6c\uc785\ub2c8\ub2e4.\n\uc774 \ucef4\ud3ec\ub10c\ud2b8\ub294 ",(0,s.jsx)(n.strong,{children:"condition"}),"\uc774\ub77c\ub294 property\ub97c \ud1b5\ud574 \uc870\uac74\uc744 \uc9c0\uc815\ud558\uace0, \uc870\uac74\uc774 \ucc38(",(0,s.jsx)(n.code,{children:"true"}),")\uc774\uba74 ",(0,s.jsx)(n.code,{children:"trueComponent"}),"\ub97c,\n\uac70\uc9d3(",(0,s.jsx)(n.code,{children:"false"}),")\uc774\uba74 ",(0,s.jsx)(n.code,{children:"falseComponent"}),"\ub97c \ub80c\ub354\ub9c1\ud569\ub2c8\ub2e4."]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.strong,{children:"condition"})," property\ub294 \ub2e8\uc21c\ud55c ",(0,s.jsx)(n.code,{children:"boolean"}),"\uac12 \ubfd0\ub9cc \uc544\ub2c8\ub77c, ",(0,s.jsx)(n.code,{children:"boolean"}),"\uac12\uc744 \ubc18\ud658\ud558\ub294 \ud568\uc218\ub3c4 \ud5c8\uc6a9\ub429\ub2c8\ub2e4.\n\uc774 \uacbd\uc6b0, \ucef4\ud3ec\ub10c\ud2b8\ub294 \ud574\ub2f9 \ud568\uc218\ub97c \ud638\ucd9c\ud558\uc5ec \uc870\uac74\uc744 \ud3c9\uac00\ud569\ub2c8\ub2e4."]}),"\n",(0,s.jsx)("br",{}),"\n",(0,s.jsx)(n.h2,{id:"code",children:"Code"}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/components/IfElse/index.tsx",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,s.jsx)(n.h2,{id:"interface",children:"Interface"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"type Condition = boolean | (() => boolean);\n\ninterface IfElseProps {\n condition: Condition;\n trueComponent: React.ReactNode;\n falseComponent: React.ReactNode;\n}\n\nconst IfElse = ({ condition, trueComponent, falseComponent }: IfElseProps) => JSX.Element;\n"})}),"\n",(0,s.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { IfElse } from '@modern-kit/react';\n\nconst Example = () => {\n const [state, setState] = useState(false);\n return (\n <>\n \n true component}\n falseComponent={false component
}\n />\n >\n );\n}\n"})}),"\n",(0,s.jsx)(n.h2,{id:"example",children:"Example"}),"\n","\n",(0,s.jsx)(p,{})]})}function h(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(u,{...e})}):u(e)}},3267:(e,n,t)=>{t.d(n,{R:()=>c,x:()=>l});var o=t(4382);const s={},r=o.createContext(s);function c(e){const n=o.useContext(r);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:c(e.components),o.createElement(r.Provider,{value:n},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/78bcb238.ec590572.js b/assets/js/78bcb238.ec590572.js
deleted file mode 100644
index c5bb9bd4d..000000000
--- a/assets/js/78bcb238.ec590572.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[3582],{2495:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>d,assets:()=>u,contentTitle:()=>l,default:()=>p,frontMatter:()=>a,metadata:()=>r,toc:()=>f});const r=JSON.parse('{"id":"react/components/IfElse","title":"IfElse","description":"IfElse \ucef4\ud3ec\ub10c\ud2b8\ub294 \uc8fc\uc5b4\uc9c4 \uc870\uac74\uc5d0 \ub530\ub77c \ub450 \uac00\uc9c0 \ucef4\ud3ec\ub10c\ud2b8 \uc911 \ud558\ub098\ub97c \ub80c\ub354\ub9c1\ud558\ub294 \uac04\ub2e8\ud55c \ub3c4\uad6c\uc785\ub2c8\ub2e4.","source":"@site/docs/react/components/IfElse.mdx","sourceDirName":"react/components","slug":"/react/components/IfElse","permalink":"/modern-kit/docs/react/components/IfElse","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"FallbackLazyImage","permalink":"/modern-kit/docs/react/components/FallbackLazyImage"},"next":{"title":"InView","permalink":"/modern-kit/docs/react/components/InView"}}');var o=n(6206),s=n(3267),i=n(4382),c=n(4027);const a={},l="IfElse",u={},d=()=>{const e={button:"button",h1:"h1",...(0,s.R)()},[t,n]=(0,i.useState)(!1);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(e.button,{onClick:()=>n(!t),children:"Toggle Button"}),(0,o.jsx)(c.zy,{condition:t,trueComponent:(0,o.jsx)(e.h1,{children:"true component"}),falseComponent:(0,o.jsx)(e.h1,{children:"false component"})})]})},f=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function h(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",strong:"strong",...(0,s.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"ifelse",children:"IfElse"})}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"IfElse"})," \ucef4\ud3ec\ub10c\ud2b8\ub294 \uc8fc\uc5b4\uc9c4 \uc870\uac74\uc5d0 \ub530\ub77c \ub450 \uac00\uc9c0 \ucef4\ud3ec\ub10c\ud2b8 \uc911 \ud558\ub098\ub97c \ub80c\ub354\ub9c1\ud558\ub294 \uac04\ub2e8\ud55c \ub3c4\uad6c\uc785\ub2c8\ub2e4.\n\uc774 \ucef4\ud3ec\ub10c\ud2b8\ub294 ",(0,o.jsx)(t.strong,{children:"condition"}),"\uc774\ub77c\ub294 property\ub97c \ud1b5\ud574 \uc870\uac74\uc744 \uc9c0\uc815\ud558\uace0, \uc870\uac74\uc774 \ucc38(",(0,o.jsx)(t.code,{children:"true"}),")\uc774\uba74 ",(0,o.jsx)(t.code,{children:"trueComponent"}),"\ub97c,\n\uac70\uc9d3(",(0,o.jsx)(t.code,{children:"false"}),")\uc774\uba74 ",(0,o.jsx)(t.code,{children:"falseComponent"}),"\ub97c \ub80c\ub354\ub9c1\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.strong,{children:"condition"})," property\ub294 \ub2e8\uc21c\ud55c ",(0,o.jsx)(t.code,{children:"boolean"}),"\uac12 \ubfd0\ub9cc \uc544\ub2c8\ub77c, ",(0,o.jsx)(t.code,{children:"boolean"}),"\uac12\uc744 \ubc18\ud658\ud558\ub294 \ud568\uc218\ub3c4 \ud5c8\uc6a9\ub429\ub2c8\ub2e4.\n\uc774 \uacbd\uc6b0, \ucef4\ud3ec\ub10c\ud2b8\ub294 \ud574\ub2f9 \ud568\uc218\ub97c \ud638\ucd9c\ud558\uc5ec \uc870\uac74\uc744 \ud3c9\uac00\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/components/IfElse/index.tsx",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"type Condition = boolean | (() => boolean);\n\ninterface IfElseProps {\n condition: Condition;\n trueComponent: React.ReactNode;\n falseComponent: React.ReactNode;\n}\n\nconst IfElse = ({ condition, trueComponent, falseComponent }: IfElseProps) => JSX.Element;\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { IfElse } from '@modern-kit/react';\n\nconst Example = () => {\n const [state, setState] = useState(false);\n return (\n <>\n \n true component}\n falseComponent={false component
}\n />\n >\n );\n}\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(d,{})]})}function p(e={}){const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(h,{...e})}):h(e)}},4027:(e,t,n)=>{n.d(t,{$$:()=>$e,$I:()=>oe,AE:()=>Be,BL:()=>H,DX:()=>F,FT:()=>ct,Fo:()=>et,Hn:()=>st,I5:()=>je,JF:()=>Te,K:()=>le,K$:()=>Je,M0:()=>Oe,ML:()=>ne,Mj:()=>ye,Mk:()=>Me,Mo:()=>se,NT:()=>Ve,QV:()=>Ue,Ub:()=>Ce,Ut:()=>Se,W7:()=>U,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>De,Zu:()=>ae,_1:()=>Ie,_g:()=>nt,aL:()=>J,aY:()=>Fe,bB:()=>X,d7:()=>_,eG:()=>it,fN:()=>ce,fm:()=>G,gl:()=>$,hN:()=>A,iD:()=>de,iQ:()=>Le,jd:()=>ie,lW:()=>lt,oD:()=>K,oo:()=>Re,pL:()=>q,qi:()=>ue,rN:()=>Ne,tD:()=>Ee,u8:()=>Q,wY:()=>_e,xV:()=>L,xh:()=>tt,zy:()=>Z});var r=n(6206),o=n(4382),s=n(3683),i=n(5086),c=n(7197),a=(n(1604),n(5938));function l(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function m(){return typeof window>"u"}function g(){return!m()}function w(e){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const b=e=>f(void 0,0,void 0,(function*(){return w(yield(yield fetch(e)).text())}));function v(e,t){var n;return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return b(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const s=yield p(e,h[t]);n(s)}catch(s){console.error(`Failed to load image. message: ${s.mesaage}`),r(s)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let s=0;s{if(e===t||k(e)&&k(t)&&isNaN(e)&&isNaN(t))return!0;if(E(e)&&E(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return y(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!x(o,t.get(r),n))return!1;return!0}return y(e,t,n)};function C(e,t){return x(e,t,new WeakMap)}function E(e){return"function"==typeof e}function k(e){return"number"==typeof e}function S(e){return!function(e){return Object(e)!==e}(e)}function j(){}function R(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const I=(...e)=>t=>e.forEach((e=>{if(E(e))e(t);else if(null!=e){e.current=t}}));function O(...e){return(0,o.useCallback)(I(...e),e)}const F=o.forwardRef(((e,t)=>{const{children:n}=e,s=l(e,["children"]),i=o.Children.toArray(n),c=i.find(M);if(c){const e=c.props.children,n=i.map((t=>t===c?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(N,Object.assign({},s,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(N,Object.assign({},s,{ref:t,children:n}))}));F.displayName="Slot";const N=o.forwardRef(((e,t)=>{const{children:n}=e,r=l(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...e)=>{s(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),s):"className"===r&&(n[r]=[o,s].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?I(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));N.displayName="SlotClone";const L=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function M(e){return o.isValidElement(e)&&e.type===L}var P="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const $=d(((e,t)=>{var{ratio:n,style:o,as:i="div",asChild:c=!1}=e,a=l(e,["ratio","style","as","asChild"]);const u=c?F:i,d=Object.assign({aspectRatio:n},o),f=c?a.className:s(P,a.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},a))})),T=()=>j,Y=()=>!1,V=()=>!0;function X({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)(T,Y,V)?e:t}function z(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const A=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>z()?(0,r.jsx)(r.Fragment,{children:t}):e;function B(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function D(e){const t=B(e);(0,o.useEffect)((()=>()=>t()),[t])}function W(e,t=C){const[n,r]=(0,o.useState)(e),s=B(t);return(0,o.useEffect)((()=>{s(n,e)||r(e)}),[s,n,e]),n}function _(e,t,n){const r=B(e),s=W(n),c=(0,o.useMemo)((()=>(0,i.A)(r,t,s)),[r,t,s]);return D((()=>c.cancel())),c}const J=({children:e,capture:t,wait:n,options:r})=>{const s=o.Children.only(e),i=_(((...e)=>{const n=s?.props;if(n&&E(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(s,{[t]:i})};function H({onIntersectStart:e=j,onIntersectEnd:t=j,enabled:n=!0,calledOnce:r=!1,root:s=null,threshold:i=0,rootMargin:c="0px 0px 0px 0px"}){const a=(0,o.useRef)(0),l=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=B((([n],o)=>{if(!n)return;const s=n.target;n.isIntersecting?(l.current=!0,a.current+=1,e(n)):l.current&&(l.current=!1,a.current+=1,t(n)),r&&a.current>1&&o.unobserve(s)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:i,root:s,rootMargin:c}),u.current.observe(e))}),[n,i,s,c,d])}}const K=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:s,rootMargin:i}=e,c=l(e,["src","threshold","root","rootMargin"]);const{ref:a}=H({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:s,rootMargin:i});return(0,r.jsx)("img",Object.assign({ref:O(t,a)},c))}));K.displayName="LazyImage";const U=(0,o.forwardRef)(((e,t)=>{var{width:n,height:s,fallback:i,className:c,style:a,duration:u="0.2s",onLoad:d}=e,f=l(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,p]=(0,o.useState)(!1),m=!h,g=(0,o.useMemo)((()=>({position:"relative",width:n,height:s})),[n,s]),w=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:m?0:1,transition:`opacity ${u}`},a)),[m,u,a]),b=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),v=c?`lazy-image-wrapper ${c}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:v,style:g,children:[m&&i,(0,r.jsx)(K,Object.assign({ref:t,width:n,height:s,style:w,onLoad:b},f))]})}));U.displayName="FallbackLazyImage";const Z=({condition:e,trueComponent:t,falseComponent:n})=>{const s=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:s?t:n})},Q=({onScrollAction:e,children:t,root:n,threshold:o,enabled:s,triggerPosition:i="after",rootMargin:c="150px 0px"})=>{const{ref:a}=H({onIntersectStart:e,root:n,threshold:o,enabled:s,rootMargin:c});return(0,r.jsxs)(r.Fragment,{children:["before"===i&&(0,r.jsx)("div",{ref:a}),t,"after"===i&&(0,r.jsx)("div",{ref:a})]})},q=d(((e,t)=>{var{children:n,as:s="div",asChild:i=!1}=e,c=l(e,["children","as","asChild"]);const a=i?F:s,{ref:u}=H(c);if(i&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(a,Object.assign({ref:I(t,u)},c,{children:n}))})),G=({items:e=[],itemKey:t,renderItem:n})=>{const s=(0,o.useCallback)(((e,n)=>function(e){return S(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},s(e,t))))})},ee=g()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=B(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),s=(0,o.useMemo)((()=>function(){if(m())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,s,(({target:t})=>{if(!r.current)return;const o=r.current,s=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!s&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:s="div",asChild:i=!1,onPointerDown:c,excludeRefs:a=[]}=e,u=l(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(c,{excludeRefs:a}),f=i?F:s;if(i&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:I(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const se=({itemKey:e,items:t=[],separator:n,renderItem:s,separatorInterval:i=1,includeLastSeparator:c=!1})=>{const a=(0,o.useCallback)((e=>e===t.length-1?c:(e+1)%i==0),[c,i,t.length]);return(0,r.jsx)(G,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[s(e,t),a(t)&&n]})})},ie=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ce=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function ae(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function le(e=!0){const t=E(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!s.current){s.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{s.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),s=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield w(e);return t(n),!0}catch{return t(null),!1}}))),[]),i=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield v(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),a=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:s,copyImage:i,readText:c,readContents:a}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",pe={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},me=e=>pe[e],ge=me("localStorage"),we=e=>window.localStorage.getItem(e),be=e=>JSON.stringify(e),ve=e=>(ge.subscribe(e),()=>{ge.unsubscribe(e)});function ye(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=E(n)?n():n,s=(0,o.useSyncExternalStore)(ve,(()=>we(t)),(()=>be(r)));return{state:(0,o.useMemo)((()=>s?R(s):r),[s,r]),setState:(0,o.useCallback)((e=>{try{const n=we(t),o=n?R(n):r,s=E(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(s)),ge.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),ge.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const xe=(e,t)=>g()?window.matchMedia(e).matches:t??!1;function Ce(e,t){const[n,r]=(0,o.useState)(xe(e,t)),s=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",s),n}function Ee(){return Ce("(prefers-color-scheme: dark)")?"dark":"light"}const ke="color-scheme";function Se({defaultValue:e,key:t=ke,shouldSetBodyClass:n=!1}={}){const r=Ee(),s=E(e)?e():e,{state:i,setState:c}=ye({key:t,initialValue:s??r}),a=(0,o.useCallback)((()=>{c((e=>"dark"===e?"light":"dark"))}),[c]),l=(0,o.useCallback)((()=>{c("dark")}),[c]),u=(0,o.useCallback)((()=>{c("light")}),[c]),d=(0,o.useCallback)((()=>{c(r)}),[c,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(i),()=>{n&&document.body.classList.remove(i)})),[i,n]),{colorScheme:i,preferredColorScheme:r,setToggleMode:a,setDarkMode:l,setLightMode:u,setPreferredMode:d}}function je(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),s=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),i=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:s,reset:i}}function Re({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,s]=(0,o.useState)(t),i=r0,a=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),l=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const i=a(e,t);o&&o({prev:r,next:i}),s(i)}),[n,r,a]),u=(0,o.useCallback)((e=>{l("nextStep",!i,e)}),[i,l]),d=(0,o.useCallback)((e=>{l("prevStep",!c,e)}),[c,l]),f=(0,o.useCallback)(((t,n)=>{const o=E(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void s(t);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),s(t)}),[r,t]);return{currentStep:r,hasNextStep:i,hasPrevStep:c,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Ie(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:s,resetStep:i}=Re({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:s,resetIndex:i}}function Oe(e,t,n={}){const[r,s]=(0,o.useState)(e);return[r,_(s,t,n)]}function Fe(e,t={}){const[n,r]=(0,o.useState)(""),[s,i]=Oe("",e,t);return{value:n,debouncedValue:s,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),i(t)}),[i]),onReset:(0,o.useCallback)((()=>{r(""),i("")}),[i])}}function Ne(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Le({onFocus:e=j,onBlur:t=j}={}){const[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(null),i=B((t=>{r(!0),e(t)})),c=B((e=>{r(!1),t(e)})),a=(0,o.useCallback)((()=>{s.current&&(s.current.focus(),r(!0))}),[]);return ne(s,"focus",i),ne(s,"blur",c),{ref:s,isFocus:n,setFocus:a}}function Me({onEnter:e=j,onLeave:t=j}={}){const[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(null),i=B((t=>{r(!0),e(t)})),c=B((e=>{r(!1),t(e)}));return ne(s,"mouseenter",i),ne(s,"mouseleave",c),{ref:s,isHovered:n}}const Pe=e=>{var t;return k(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function $e(e,t){const n=(0,o.useRef)(),r=B(e),{delay:s,enabled:i}=Pe(t),c=(0,o.useCallback)((()=>{n.current=window.setInterval(r,s)}),[r,s]),a=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{a(),c()}),[a,c]);return(0,o.useEffect)((()=>{if(!(s<0)&&i)return c(),()=>a()}),[a,c,i,s]),{set:c,reset:l,clear:a}}function Te({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),s=B((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];E(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",s),()=>t.removeEventListener("keydown",s)}),[e,s]),r}const Ye={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function Ve(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)(Ye),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:s,clientY:i,pageX:c,pageY:a}=t;let l=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();l=s-t.left,u=i-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:s,clientY:i,pageX:c,pageY:a,elementRelativeX:l,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const Xe=()=>navigator.onLine,ze=()=>!0,Ae=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function Be({onlineAction:e=j,offlineAction:t=j}={}){const n=B((n=>Ae(n,e,t)));return(0,o.useSyncExternalStore)(n,Xe,ze)}function De(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const We={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function _e(e=j){const[t,n]=(0,o.useState)(We),r=(0,o.useRef)(null),s=B((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(s);return t.observe(e),()=>{t.unobserve(e)}}),[s]),{ref:r,contentRect:t}}function Je({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),s=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>s())),[e,r,s]),{ref:t,lock:r,unlock:s}}const He=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,Ke=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:s=0,alignY:i="start",alignX:c="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+s+He(window.innerHeight,r.height,i),left:r.left+window.scrollX+o+He(window.innerWidth,r.width,c)};const a=e.getBoundingClientRect();return{top:r.top-a.top+e.scrollTop+s+He(a.height,r.height,i),left:r.left-a.left+e.scrollLeft+o+He(a.width,r.width,c)}};function Ue(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:s,top:i}=Ke(r,t,n);r.scrollTo({top:i,left:s,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ze=me("sessionStorage"),Qe=e=>window.sessionStorage.getItem(e),qe=e=>JSON.stringify(e),Ge=e=>(Ze.subscribe(e),()=>{Ze.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=E(n)?n():n,s=(0,o.useSyncExternalStore)(Ge,(()=>Qe(t)),(()=>qe(r)));return{state:(0,o.useMemo)((()=>s?R(s):r),[s,r]),setState:(0,o.useCallback)((e=>{try{const n=Qe(t),o=n?R(n):r,s=E(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(s)),Ze.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ze.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:s}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[i,c]=(0,o.useState)(n),a=(0,o.useCallback)((e=>{c((t=>{const n=E(e)?e(t):e;return r&&s&&function(e,t,n){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=E(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,s,n),n}))}),[r,s]),l=(0,o.useCallback)((()=>{r&&s&&function(e,t){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,s),c(null)}),[r,s]);return Object.assign({state:i,setState:a,clearState:l},Re(e))}function nt(e,t,n={}){const r=B(e),s=W(n),i=(0,o.useMemo)((()=>(0,c.A)(r,t,s)),[r,t,s]);return D((()=>i.cancel())),i}const rt=e=>{var t;return k(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=B(e),{delay:s,enabled:i}=rt(t),c=(0,o.useCallback)((()=>{n.current=setTimeout(r,s)}),[r,s]),a=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{a(),c()}),[a,c]);return(0,o.useEffect)((()=>{if(!(s<0)&&i)return c(),()=>a()}),[c,a,s,i]),{set:c,reset:l,clear:a}}function st(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function it(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new a.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function ct({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const at={width:null,height:null};function lt({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>m()?at:{width:window.innerWidth,height:window.innerHeight})),r=_(n,e),s=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",s),t}function ut(e,t,n){const{delay:r,enabled:s}=rt(t),{set:i,reset:c,clear:a}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!s||c()}),[r,s,c,...n]),{set:i,reset:c,clear:a}}}}]);
\ No newline at end of file
diff --git a/assets/js/7b61a3fa.7e7d5f1c.js b/assets/js/7b61a3fa.7e7d5f1c.js
new file mode 100644
index 000000000..aee66fe68
--- /dev/null
+++ b/assets/js/7b61a3fa.7e7d5f1c.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[3912],{125:(e,n,l)=>{l.r(n),l.d(n,{Example:()=>d,assets:()=>u,contentTitle:()=>a,default:()=>k,frontMatter:()=>r,metadata:()=>t,toc:()=>p});const t=JSON.parse('{"id":"react/hooks/useBlockMultipleAsyncCalls","title":"useBlockMultipleAsyncCalls","description":"useBlockMultipleAsyncCalls \ud6c5\uc740 \uc9c4\ud589 \uc911\uc778 \ube44\ub3d9\uae30 \ud638\ucd9c\uc774 \uc788\uc744 \ub54c \uc911\ubcf5 \ud638\ucd9c\uc744 \ubc29\uc9c0\ud558\uae30 \uc704\ud55c \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useBlockMultipleAsyncCalls.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useBlockMultipleAsyncCalls","permalink":"/modern-kit/docs/react/hooks/useBlockMultipleAsyncCalls","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useBeforeUnload","permalink":"/modern-kit/docs/react/hooks/useBeforeUnload"},"next":{"title":"useClipboard","permalink":"/modern-kit/docs/react/hooks/useClipboard"}}');var s=l(6206),o=l(3267),c=l(4382),i=l(4076);const r={},a="useBlockMultipleAsyncCalls",u={},d=()=>{const e={button:"button",div:"div",p:"p",...(0,o.R)()},[n,l]=(0,c.useState)(1),[t,r]=(0,c.useState)(1),[a,u]=(0,c.useState)(null),{isLoading:d,blockMultipleAsyncCalls:p}=function(){const[e,n]=(0,c.useState)(!1),[l,t]=(0,c.useState)(!1),s=(0,c.useRef)(!1);return{isError:l,isLoading:e,blockMultipleAsyncCalls:(0,c.useCallback)((e=>(0,i.a)(this,void 0,void 0,(function*(){if(!s.current){s.current=!0,n(!0),t(!1);try{return yield e()}catch(l){throw t(!0),l}finally{s.current=!1,n(!1)}}}))),[])}}(),h=async()=>{const e=await fetch(`https://jsonplaceholder.typicode.com/todos/${n}`).then((e=>e.json()));u(e),l(n+1)};return(0,s.jsxs)(e.div,{children:[(0,s.jsx)(e.button,{onClick:()=>{r(t+1),p(h)},children:"\ubc84\ud2bc \ud074\ub9ad"}),(0,s.jsxs)(e.div,{children:[(0,s.jsxs)(e.p,{children:["BlockingCount: ",n]}),(0,s.jsxs)(e.p,{children:["NonBlockingCount: ",t]})]}),d?(0,s.jsx)(e.p,{children:"\ub85c\ub529\uc911"}):(0,s.jsx)(e.p,{children:a?.title})]})},p=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function h(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",ol:"ol",p:"p",pre:"pre",ul:"ul",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.header,{children:(0,s.jsx)(n.h1,{id:"useblockmultipleasynccalls",children:"useBlockMultipleAsyncCalls"})}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"useBlockMultipleAsyncCalls"})," \ud6c5\uc740 \uc9c4\ud589 \uc911\uc778 \ube44\ub3d9\uae30 \ud638\ucd9c\uc774 \uc788\uc744 \ub54c \uc911\ubcf5 \ud638\ucd9c\uc744 \ubc29\uc9c0\ud558\uae30 \uc704\ud55c \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"debounce"}),"\ub294 \ud568\uc218\uc758 \uc911\ubcf5 \ud638\ucd9c\uc744 \ubc29\uc9c0\ud558\ub294 \ub370 \ub300\ubd80\ubd84\uc758 \uacbd\uc6b0\uc5d0 \ud6a8\uacfc\uc801\uc785\ub2c8\ub2e4.\n\ud558\uc9c0\ub9cc, ",(0,s.jsx)(n.code,{children:"debounce"}),"\ub294 \ube44\ub3d9\uae30 \uc791\uc5c5\uc758 \uc644\ub8cc\ub97c \ubcf4\uc7a5\ud558\uc9c0 \uc54a\uae30 \ub54c\ubb38\uc5d0 \ub2e4\uc74c\uacfc \uac19\uc740 \ud55c\uacc4\uac00 \uc788\uc2b5\ub2c8\ub2e4:"]}),"\n",(0,s.jsxs)(n.ol,{children:["\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"debounce"})," \uc2dc\uac04\uc774 API \uc751\ub2f5 \uc2dc\uac04\ubcf4\ub2e4 \uc9e7\uc744 \uacbd\uc6b0: \ube44\ub3d9\uae30 \uc791\uc5c5\uc774 \uc644\ub8cc\ub418\uc9c0 \uc54a\uc740 \uc0c1\ud0dc\uc5d0\uc11c ",(0,s.jsx)(n.code,{children:"\ub2e4\uc2dc \ud638\ucd9c"}),"\ub420 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"debounce"})," \uc2dc\uac04\uc774 API \uc751\ub2f5 \uc2dc\uac04\ubcf4\ub2e4 \uae38 \uacbd\uc6b0: \ube44\ub3d9\uae30 \uc791\uc5c5\uc774 \uc644\ub8cc\ub418\uc5c8\uc9c0\ub9cc ",(0,s.jsx)(n.code,{children:"\ubc84\ud2bc"}),"\uacfc \uac19\uc740 \uc694\uc18c\uac00 \uc5ec\uc804\ud788 ",(0,s.jsx)(n.code,{children:"\ube44\ud65c\uc131\ud654"}),"\ub418\uc5b4 \uc788\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,s.jsxs)(n.li,{children:[(0,s.jsx)(n.code,{children:"\uc989\uac01\uc801\uc778 \ubc18\uc751"}),"\uc744 \uc6d0\ud558\ub294 \uacbd\uc6b0: ",(0,s.jsx)(n.code,{children:"debounce"}),"\ub294 \ud638\ucd9c\uc744 \uc9c0\uc5f0\uc2dc\ud0a4\uae30 \ub54c\ubb38\uc5d0 \uc0ac\uc6a9\uc790\uc5d0\uac8c ",(0,s.jsx)(n.code,{children:"\uc989\uac01\uc801\uc778 \ubc18\uc751"}),"\uc744 \ubcf4\uc5ec\uc8fc\uae30\uc5d0 \uc81c\ud55c\uc801\uc785\ub2c8\ub2e4."]}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:["\ub300\ubd80\ubd84\uc758 \uacbd\uc6b0\uc5d0 ",(0,s.jsx)(n.code,{children:"debounce"}),"\ub9cc\uc73c\ub85c \ucda9\ubd84\ud558\uc9c0\ub9cc, \uc704\uc640 \uac19\uc740 \ud55c\uacc4\uc810\uc744 \ub300\uc751\ud558\uace0\uc790 \ud55c\ub2e4\uba74 ",(0,s.jsx)(n.code,{children:"useBlockMultipleAsyncCalls"}),"\ub97c \uc0ac\uc6a9\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useDebounce/index.ts",children:"useDebounce"})}),"\n"]}),"\n",(0,s.jsx)("br",{}),"\n",(0,s.jsx)(n.h2,{id:"code",children:"Code"}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useBlockMultipleAsyncCalls/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,s.jsx)(n.h2,{id:"interface",children:"Interface"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"interface UseBlockMultipleAsyncCallsReturnType {\n isError: boolean;\n isLoading: boolean;\n blockMultipleAsyncCalls: (\n callback: () => Promise\n ) => Promise;\n}\n"})}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"function useBlockMultipleAsyncCalls(): UseBlockMultipleAsyncCallsReturnType\n"})}),"\n",(0,s.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-tsx",metastring:'title="typescript"',children:"import React, { useState } from 'react';\nimport { useBlockMultipleAsyncCalls } from '@modern-kit/react';\n\ninterface Value {\n userId: number;\n id: number;\n title: string;\n completed: boolean;\n}\n\nconst Example = () => {\n const [blockingCount, setBlockingCount] = useState(1);\n const [nonBlockingCount, setNonBlockingCount] = useState(1);\n const [value, setValue] = useState(null);\n\n const { isError, isLoading, blockMultipleAsyncCalls } = useBlockMultipleAsyncCalls();\n\n const fetchApi = async () => {\n const res = await fetch(\n `https://jsonplaceholder.typicode.com/todos/${blockingCount}`\n ).then((response) => response.json());\n\n setValue(res);\n setBlockingCount(blockingCount + 1);\n };\n\n const handleClick = () => {\n setNonBlockingCount(nonBlockingCount + 1);\n blockMultipleAsyncCalls(fetchApi); // (*) Promise \ubc18\ud658\ud558\ub294 \ud568\uc218\ub97c \uc778\uc790\ub85c \ub123\uc5b4\uc8fc\uc138\uc694.\n };\n\n return (\n \n
\n
\n
BlockingCount: {blockingCount}
\n
NonBlockingCount: {nonBlockingCount}
\n
\n {isLoading ?
\ub85c\ub529\uc911
:
{value?.title}
}\n {isError &&
\uc5d0\ub7ec \ubc1c\uc0dd
}\n
\n );\n};\n"})}),"\n",(0,s.jsx)(n.h2,{id:"example",children:"Example"}),"\n","\n",(0,s.jsx)(d,{})]})}function k(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(h,{...e})}):h(e)}},4076:(e,n,l)=>{function t(e,n){var l={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(l[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(t=Object.getOwnPropertySymbols(e);st,a:()=>s}),"function"==typeof SuppressedError&&SuppressedError},3267:(e,n,l)=>{l.d(n,{R:()=>c,x:()=>i});var t=l(4382);const s={},o=t.createContext(s);function c(e){const n=t.useContext(o);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:c(e.components),t.createElement(o.Provider,{value:n},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/7b61a3fa.962828ef.js b/assets/js/7b61a3fa.962828ef.js
deleted file mode 100644
index 8ab7d0de2..000000000
--- a/assets/js/7b61a3fa.962828ef.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[3912],{3758:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>d,assets:()=>u,contentTitle:()=>a,default:()=>p,frontMatter:()=>l,metadata:()=>r,toc:()=>f});const r=JSON.parse('{"id":"react/hooks/useBlockMultipleAsyncCalls","title":"useBlockMultipleAsyncCalls","description":"useBlockMultipleAsyncCalls \ud6c5\uc740 \uc9c4\ud589 \uc911\uc778 \ube44\ub3d9\uae30 \ud638\ucd9c\uc774 \uc788\uc744 \ub54c \uc911\ubcf5 \ud638\ucd9c\uc744 \ubc29\uc9c0\ud558\uae30 \uc704\ud55c \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useBlockMultipleAsyncCalls.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useBlockMultipleAsyncCalls","permalink":"/modern-kit/docs/react/hooks/useBlockMultipleAsyncCalls","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useBeforeUnload","permalink":"/modern-kit/docs/react/hooks/useBeforeUnload"},"next":{"title":"useClipboard","permalink":"/modern-kit/docs/react/hooks/useClipboard"}}');var o=n(6206),s=n(3267),i=n(4382),c=n(4027);const l={},a="useBlockMultipleAsyncCalls",u={},d=()=>{const e={button:"button",div:"div",p:"p",...(0,s.R)()},[t,n]=(0,i.useState)(1),[r,l]=(0,i.useState)(1),[a,u]=(0,i.useState)(null),{isLoading:d,blockMultipleAsyncCalls:f}=(0,c.qi)(),h=async()=>{const e=await fetch(`https://jsonplaceholder.typicode.com/todos/${t}`).then((e=>e.json()));u(e),n(t+1)};return(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.button,{onClick:()=>{l(r+1),f(h)},children:"\ubc84\ud2bc \ud074\ub9ad"}),(0,o.jsxs)(e.div,{children:[(0,o.jsxs)(e.p,{children:["BlockingCount: ",t]}),(0,o.jsxs)(e.p,{children:["NonBlockingCount: ",r]})]}),d?(0,o.jsx)(e.p,{children:"\ub85c\ub529\uc911"}):(0,o.jsx)(e.p,{children:a?.title})]})},f=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function h(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",ol:"ol",p:"p",pre:"pre",ul:"ul",...(0,s.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"useblockmultipleasynccalls",children:"useBlockMultipleAsyncCalls"})}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"useBlockMultipleAsyncCalls"})," \ud6c5\uc740 \uc9c4\ud589 \uc911\uc778 \ube44\ub3d9\uae30 \ud638\ucd9c\uc774 \uc788\uc744 \ub54c \uc911\ubcf5 \ud638\ucd9c\uc744 \ubc29\uc9c0\ud558\uae30 \uc704\ud55c \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"debounce"}),"\ub294 \ud568\uc218\uc758 \uc911\ubcf5 \ud638\ucd9c\uc744 \ubc29\uc9c0\ud558\ub294 \ub370 \ub300\ubd80\ubd84\uc758 \uacbd\uc6b0\uc5d0 \ud6a8\uacfc\uc801\uc785\ub2c8\ub2e4.\n\ud558\uc9c0\ub9cc, ",(0,o.jsx)(t.code,{children:"debounce"}),"\ub294 \ube44\ub3d9\uae30 \uc791\uc5c5\uc758 \uc644\ub8cc\ub97c \ubcf4\uc7a5\ud558\uc9c0 \uc54a\uae30 \ub54c\ubb38\uc5d0 \ub2e4\uc74c\uacfc \uac19\uc740 \ud55c\uacc4\uac00 \uc788\uc2b5\ub2c8\ub2e4:"]}),"\n",(0,o.jsxs)(t.ol,{children:["\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.code,{children:"debounce"})," \uc2dc\uac04\uc774 API \uc751\ub2f5 \uc2dc\uac04\ubcf4\ub2e4 \uc9e7\uc744 \uacbd\uc6b0: \ube44\ub3d9\uae30 \uc791\uc5c5\uc774 \uc644\ub8cc\ub418\uc9c0 \uc54a\uc740 \uc0c1\ud0dc\uc5d0\uc11c ",(0,o.jsx)(t.code,{children:"\ub2e4\uc2dc \ud638\ucd9c"}),"\ub420 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.code,{children:"debounce"})," \uc2dc\uac04\uc774 API \uc751\ub2f5 \uc2dc\uac04\ubcf4\ub2e4 \uae38 \uacbd\uc6b0: \ube44\ub3d9\uae30 \uc791\uc5c5\uc774 \uc644\ub8cc\ub418\uc5c8\uc9c0\ub9cc ",(0,o.jsx)(t.code,{children:"\ubc84\ud2bc"}),"\uacfc \uac19\uc740 \uc694\uc18c\uac00 \uc5ec\uc804\ud788 ",(0,o.jsx)(t.code,{children:"\ube44\ud65c\uc131\ud654"}),"\ub418\uc5b4 \uc788\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.code,{children:"\uc989\uac01\uc801\uc778 \ubc18\uc751"}),"\uc744 \uc6d0\ud558\ub294 \uacbd\uc6b0: ",(0,o.jsx)(t.code,{children:"debounce"}),"\ub294 \ud638\ucd9c\uc744 \uc9c0\uc5f0\uc2dc\ud0a4\uae30 \ub54c\ubb38\uc5d0 \uc0ac\uc6a9\uc790\uc5d0\uac8c ",(0,o.jsx)(t.code,{children:"\uc989\uac01\uc801\uc778 \ubc18\uc751"}),"\uc744 \ubcf4\uc5ec\uc8fc\uae30\uc5d0 \uc81c\ud55c\uc801\uc785\ub2c8\ub2e4."]}),"\n"]}),"\n",(0,o.jsxs)(t.p,{children:["\ub300\ubd80\ubd84\uc758 \uacbd\uc6b0\uc5d0 ",(0,o.jsx)(t.code,{children:"debounce"}),"\ub9cc\uc73c\ub85c \ucda9\ubd84\ud558\uc9c0\ub9cc, \uc704\uc640 \uac19\uc740 \ud55c\uacc4\uc810\uc744 \ub300\uc751\ud558\uace0\uc790 \ud55c\ub2e4\uba74 ",(0,o.jsx)(t.code,{children:"useBlockMultipleAsyncCalls"}),"\ub97c \uc0ac\uc6a9\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsx)(t.li,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useDebounce/index.ts",children:"useDebounce"})}),"\n"]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useBlockMultipleAsyncCalls/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"interface UseBlockMultipleAsyncCallsReturnType {\n isError: boolean;\n isLoading: boolean;\n blockMultipleAsyncCalls: (\n callback: () => Promise\n ) => Promise;\n}\n"})}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"function useBlockMultipleAsyncCalls(): UseBlockMultipleAsyncCallsReturnType\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import React, { useState } from 'react';\nimport { useBlockMultipleAsyncCalls } from '@modern-kit/react';\n\ninterface Value {\n userId: number;\n id: number;\n title: string;\n completed: boolean;\n}\n\nconst Example = () => {\n const [blockingCount, setBlockingCount] = useState(1);\n const [nonBlockingCount, setNonBlockingCount] = useState(1);\n const [value, setValue] = useState(null);\n\n const { isError, isLoading, blockMultipleAsyncCalls } = useBlockMultipleAsyncCalls();\n\n const fetchApi = async () => {\n const res = await fetch(\n `https://jsonplaceholder.typicode.com/todos/${blockingCount}`\n ).then((response) => response.json());\n\n setValue(res);\n setBlockingCount(blockingCount + 1);\n };\n\n const handleClick = () => {\n setNonBlockingCount(nonBlockingCount + 1);\n blockMultipleAsyncCalls(fetchApi); // (*) Promise \ubc18\ud658\ud558\ub294 \ud568\uc218\ub97c \uc778\uc790\ub85c \ub123\uc5b4\uc8fc\uc138\uc694.\n };\n\n return (\n \n
\n
\n
BlockingCount: {blockingCount}
\n
NonBlockingCount: {nonBlockingCount}
\n
\n {isLoading ?
\ub85c\ub529\uc911
:
{value?.title}
}\n {isError &&
\uc5d0\ub7ec \ubc1c\uc0dd
}\n
\n );\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(d,{})]})}function p(e={}){const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(h,{...e})}):h(e)}},4027:(e,t,n)=>{n.d(t,{$$:()=>Fe,$I:()=>oe,AE:()=>Xe,BL:()=>J,DX:()=>B,FT:()=>ct,Fo:()=>et,Hn:()=>st,I5:()=>Ee,JF:()=>Pe,K:()=>ae,K$:()=>Ue,M0:()=>Oe,ML:()=>ne,Mj:()=>ve,Mk:()=>Ae,Mo:()=>se,NT:()=>Te,QV:()=>Ke,Ub:()=>xe,Ut:()=>Se,W7:()=>K,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>We,Zu:()=>le,_1:()=>Me,_g:()=>nt,aL:()=>U,aY:()=>Be,bB:()=>V,d7:()=>z,eG:()=>it,fN:()=>ce,fm:()=>G,gl:()=>F,hN:()=>D,iD:()=>de,iQ:()=>Ne,jd:()=>ie,lW:()=>at,oD:()=>H,oo:()=>Re,pL:()=>Q,qi:()=>ue,rN:()=>Ie,tD:()=>Ce,u8:()=>q,wY:()=>ze,xV:()=>N,xh:()=>tt,zy:()=>Z});var r=n(6206),o=n(4382),s=n(3683),i=n(5086),c=n(7197),l=(n(1604),n(5938));function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function m(){return typeof window>"u"}function g(){return!m()}function b(e){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const w=e=>f(void 0,0,void 0,(function*(){return b(yield(yield fetch(e)).text())}));function y(e,t){var n;return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return w(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const s=yield p(e,h[t]);n(s)}catch(s){console.error(`Failed to load image. message: ${s.mesaage}`),r(s)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const v=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let s=0;s{if(e===t||j(e)&&j(t)&&isNaN(e)&&isNaN(t))return!0;if(C(e)&&C(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return v(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!k(o,t.get(r),n))return!1;return!0}return v(e,t,n)};function x(e,t){return k(e,t,new WeakMap)}function C(e){return"function"==typeof e}function j(e){return"number"==typeof e}function S(e){return!function(e){return Object(e)!==e}(e)}function E(){}function R(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const M=(...e)=>t=>e.forEach((e=>{if(C(e))e(t);else if(null!=e){e.current=t}}));function O(...e){return(0,o.useCallback)(M(...e),e)}const B=o.forwardRef(((e,t)=>{const{children:n}=e,s=a(e,["children"]),i=o.Children.toArray(n),c=i.find(A);if(c){const e=c.props.children,n=i.map((t=>t===c?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(I,Object.assign({},s,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(I,Object.assign({},s,{ref:t,children:n}))}));B.displayName="Slot";const I=o.forwardRef(((e,t)=>{const{children:n}=e,r=a(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...e)=>{s(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),s):"className"===r&&(n[r]=[o,s].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?M(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));I.displayName="SlotClone";const N=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function A(e){return o.isValidElement(e)&&e.type===N}var L="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const F=d(((e,t)=>{var{ratio:n,style:o,as:i="div",asChild:c=!1}=e,l=a(e,["ratio","style","as","asChild"]);const u=c?B:i,d=Object.assign({aspectRatio:n},o),f=c?l.className:s(L,l.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},l))})),P=()=>E,$=()=>!1,T=()=>!0;function V({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)(P,$,T)?e:t}function Y(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const D=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>Y()?(0,r.jsx)(r.Fragment,{children:t}):e;function X(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function W(e){const t=X(e);(0,o.useEffect)((()=>()=>t()),[t])}function _(e,t=x){const[n,r]=(0,o.useState)(e),s=X(t);return(0,o.useEffect)((()=>{s(n,e)||r(e)}),[s,n,e]),n}function z(e,t,n){const r=X(e),s=_(n),c=(0,o.useMemo)((()=>(0,i.A)(r,t,s)),[r,t,s]);return W((()=>c.cancel())),c}const U=({children:e,capture:t,wait:n,options:r})=>{const s=o.Children.only(e),i=z(((...e)=>{const n=s?.props;if(n&&C(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(s,{[t]:i})};function J({onIntersectStart:e=E,onIntersectEnd:t=E,enabled:n=!0,calledOnce:r=!1,root:s=null,threshold:i=0,rootMargin:c="0px 0px 0px 0px"}){const l=(0,o.useRef)(0),a=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=X((([n],o)=>{if(!n)return;const s=n.target;n.isIntersecting?(a.current=!0,l.current+=1,e(n)):a.current&&(a.current=!1,l.current+=1,t(n)),r&&l.current>1&&o.unobserve(s)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:i,root:s,rootMargin:c}),u.current.observe(e))}),[n,i,s,c,d])}}const H=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:s,rootMargin:i}=e,c=a(e,["src","threshold","root","rootMargin"]);const{ref:l}=J({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:s,rootMargin:i});return(0,r.jsx)("img",Object.assign({ref:O(t,l)},c))}));H.displayName="LazyImage";const K=(0,o.forwardRef)(((e,t)=>{var{width:n,height:s,fallback:i,className:c,style:l,duration:u="0.2s",onLoad:d}=e,f=a(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,p]=(0,o.useState)(!1),m=!h,g=(0,o.useMemo)((()=>({position:"relative",width:n,height:s})),[n,s]),b=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:m?0:1,transition:`opacity ${u}`},l)),[m,u,l]),w=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),y=c?`lazy-image-wrapper ${c}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:y,style:g,children:[m&&i,(0,r.jsx)(H,Object.assign({ref:t,width:n,height:s,style:b,onLoad:w},f))]})}));K.displayName="FallbackLazyImage";const Z=({condition:e,trueComponent:t,falseComponent:n})=>{const s=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:s?t:n})},q=({onScrollAction:e,children:t,root:n,threshold:o,enabled:s,triggerPosition:i="after",rootMargin:c="150px 0px"})=>{const{ref:l}=J({onIntersectStart:e,root:n,threshold:o,enabled:s,rootMargin:c});return(0,r.jsxs)(r.Fragment,{children:["before"===i&&(0,r.jsx)("div",{ref:l}),t,"after"===i&&(0,r.jsx)("div",{ref:l})]})},Q=d(((e,t)=>{var{children:n,as:s="div",asChild:i=!1}=e,c=a(e,["children","as","asChild"]);const l=i?B:s,{ref:u}=J(c);if(i&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(l,Object.assign({ref:M(t,u)},c,{children:n}))})),G=({items:e=[],itemKey:t,renderItem:n})=>{const s=(0,o.useCallback)(((e,n)=>function(e){return S(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},s(e,t))))})},ee=g()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=X(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),s=(0,o.useMemo)((()=>function(){if(m())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,s,(({target:t})=>{if(!r.current)return;const o=r.current,s=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!s&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:s="div",asChild:i=!1,onPointerDown:c,excludeRefs:l=[]}=e,u=a(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(c,{excludeRefs:l}),f=i?B:s;if(i&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:M(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const se=({itemKey:e,items:t=[],separator:n,renderItem:s,separatorInterval:i=1,includeLastSeparator:c=!1})=>{const l=(0,o.useCallback)((e=>e===t.length-1?c:(e+1)%i==0),[c,i,t.length]);return(0,r.jsx)(G,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[s(e,t),l(t)&&n]})})},ie=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ce=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function le(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function ae(e=!0){const t=C(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!s.current){s.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{s.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),s=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield b(e);return t(n),!0}catch{return t(null),!1}}))),[]),i=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield y(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),l=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:s,copyImage:i,readText:c,readContents:l}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",pe={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},me=e=>pe[e],ge=me("localStorage"),be=e=>window.localStorage.getItem(e),we=e=>JSON.stringify(e),ye=e=>(ge.subscribe(e),()=>{ge.unsubscribe(e)});function ve(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=C(n)?n():n,s=(0,o.useSyncExternalStore)(ye,(()=>be(t)),(()=>we(r)));return{state:(0,o.useMemo)((()=>s?R(s):r),[s,r]),setState:(0,o.useCallback)((e=>{try{const n=be(t),o=n?R(n):r,s=C(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(s)),ge.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),ge.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const ke=(e,t)=>g()?window.matchMedia(e).matches:t??!1;function xe(e,t){const[n,r]=(0,o.useState)(ke(e,t)),s=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",s),n}function Ce(){return xe("(prefers-color-scheme: dark)")?"dark":"light"}const je="color-scheme";function Se({defaultValue:e,key:t=je,shouldSetBodyClass:n=!1}={}){const r=Ce(),s=C(e)?e():e,{state:i,setState:c}=ve({key:t,initialValue:s??r}),l=(0,o.useCallback)((()=>{c((e=>"dark"===e?"light":"dark"))}),[c]),a=(0,o.useCallback)((()=>{c("dark")}),[c]),u=(0,o.useCallback)((()=>{c("light")}),[c]),d=(0,o.useCallback)((()=>{c(r)}),[c,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(i),()=>{n&&document.body.classList.remove(i)})),[i,n]),{colorScheme:i,preferredColorScheme:r,setToggleMode:l,setDarkMode:a,setLightMode:u,setPreferredMode:d}}function Ee(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),s=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),i=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:s,reset:i}}function Re({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,s]=(0,o.useState)(t),i=r0,l=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),a=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const i=l(e,t);o&&o({prev:r,next:i}),s(i)}),[n,r,l]),u=(0,o.useCallback)((e=>{a("nextStep",!i,e)}),[i,a]),d=(0,o.useCallback)((e=>{a("prevStep",!c,e)}),[c,a]),f=(0,o.useCallback)(((t,n)=>{const o=C(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void s(t);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),s(t)}),[r,t]);return{currentStep:r,hasNextStep:i,hasPrevStep:c,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Me(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:s,resetStep:i}=Re({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:s,resetIndex:i}}function Oe(e,t,n={}){const[r,s]=(0,o.useState)(e);return[r,z(s,t,n)]}function Be(e,t={}){const[n,r]=(0,o.useState)(""),[s,i]=Oe("",e,t);return{value:n,debouncedValue:s,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),i(t)}),[i]),onReset:(0,o.useCallback)((()=>{r(""),i("")}),[i])}}function Ie(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Ne({onFocus:e=E,onBlur:t=E}={}){const[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(null),i=X((t=>{r(!0),e(t)})),c=X((e=>{r(!1),t(e)})),l=(0,o.useCallback)((()=>{s.current&&(s.current.focus(),r(!0))}),[]);return ne(s,"focus",i),ne(s,"blur",c),{ref:s,isFocus:n,setFocus:l}}function Ae({onEnter:e=E,onLeave:t=E}={}){const[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(null),i=X((t=>{r(!0),e(t)})),c=X((e=>{r(!1),t(e)}));return ne(s,"mouseenter",i),ne(s,"mouseleave",c),{ref:s,isHovered:n}}const Le=e=>{var t;return j(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function Fe(e,t){const n=(0,o.useRef)(),r=X(e),{delay:s,enabled:i}=Le(t),c=(0,o.useCallback)((()=>{n.current=window.setInterval(r,s)}),[r,s]),l=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),c()}),[l,c]);return(0,o.useEffect)((()=>{if(!(s<0)&&i)return c(),()=>l()}),[l,c,i,s]),{set:c,reset:a,clear:l}}function Pe({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),s=X((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];C(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",s),()=>t.removeEventListener("keydown",s)}),[e,s]),r}const $e={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function Te(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)($e),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:s,clientY:i,pageX:c,pageY:l}=t;let a=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();a=s-t.left,u=i-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:s,clientY:i,pageX:c,pageY:l,elementRelativeX:a,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const Ve=()=>navigator.onLine,Ye=()=>!0,De=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function Xe({onlineAction:e=E,offlineAction:t=E}={}){const n=X((n=>De(n,e,t)));return(0,o.useSyncExternalStore)(n,Ve,Ye)}function We(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const _e={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function ze(e=E){const[t,n]=(0,o.useState)(_e),r=(0,o.useRef)(null),s=X((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(s);return t.observe(e),()=>{t.unobserve(e)}}),[s]),{ref:r,contentRect:t}}function Ue({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),s=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>s())),[e,r,s]),{ref:t,lock:r,unlock:s}}const Je=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,He=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:s=0,alignY:i="start",alignX:c="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+s+Je(window.innerHeight,r.height,i),left:r.left+window.scrollX+o+Je(window.innerWidth,r.width,c)};const l=e.getBoundingClientRect();return{top:r.top-l.top+e.scrollTop+s+Je(l.height,r.height,i),left:r.left-l.left+e.scrollLeft+o+Je(l.width,r.width,c)}};function Ke(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:s,top:i}=He(r,t,n);r.scrollTo({top:i,left:s,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ze=me("sessionStorage"),qe=e=>window.sessionStorage.getItem(e),Qe=e=>JSON.stringify(e),Ge=e=>(Ze.subscribe(e),()=>{Ze.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=C(n)?n():n,s=(0,o.useSyncExternalStore)(Ge,(()=>qe(t)),(()=>Qe(r)));return{state:(0,o.useMemo)((()=>s?R(s):r),[s,r]),setState:(0,o.useCallback)((e=>{try{const n=qe(t),o=n?R(n):r,s=C(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(s)),Ze.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ze.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:s}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[i,c]=(0,o.useState)(n),l=(0,o.useCallback)((e=>{c((t=>{const n=C(e)?e(t):e;return r&&s&&function(e,t,n){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=C(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,s,n),n}))}),[r,s]),a=(0,o.useCallback)((()=>{r&&s&&function(e,t){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,s),c(null)}),[r,s]);return Object.assign({state:i,setState:l,clearState:a},Re(e))}function nt(e,t,n={}){const r=X(e),s=_(n),i=(0,o.useMemo)((()=>(0,c.A)(r,t,s)),[r,t,s]);return W((()=>i.cancel())),i}const rt=e=>{var t;return j(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=X(e),{delay:s,enabled:i}=rt(t),c=(0,o.useCallback)((()=>{n.current=setTimeout(r,s)}),[r,s]),l=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),c()}),[l,c]);return(0,o.useEffect)((()=>{if(!(s<0)&&i)return c(),()=>l()}),[c,l,s,i]),{set:c,reset:a,clear:l}}function st(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function it(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new l.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function ct({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const lt={width:null,height:null};function at({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>m()?lt:{width:window.innerWidth,height:window.innerHeight})),r=z(n,e),s=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",s),t}function ut(e,t,n){const{delay:r,enabled:s}=rt(t),{set:i,reset:c,clear:l}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!s||c()}),[r,s,c,...n]),{set:i,reset:c,clear:l}}}}]);
\ No newline at end of file
diff --git a/assets/js/7b7be0e1.5bac0365.js b/assets/js/7b7be0e1.041efcab.js
similarity index 98%
rename from assets/js/7b7be0e1.5bac0365.js
rename to assets/js/7b7be0e1.041efcab.js
index f0d34c26e..ab20cca88 100644
--- a/assets/js/7b7be0e1.5bac0365.js
+++ b/assets/js/7b7be0e1.041efcab.js
@@ -1 +1 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[2746],{4076:(e,s,n)=>{n.r(s),n.d(s,{assets:()=>d,contentTitle:()=>a,default:()=>h,frontMatter:()=>r,metadata:()=>t,toc:()=>c});const t=JSON.parse('{"id":"utils/validator/isEqual","title":"isEqual","description":"\uc778\uc790\ub85c \uc8fc\uc5b4\uc9c4 \ub450 \uac12\uc744 \uae4a\uc740 \ube44\uad50\ud574\uc11c \uac19\uc740\uc9c0 \ub2e4\ub978\uc9c0 \uc5ec\ubd80\ub97c \ubc18\ud658\ud574\uc8fc\ub294 \ud568\uc218\uc785\ub2c8\ub2e4.","source":"@site/docs/utils/validator/isEqual.md","sourceDirName":"utils/validator","slug":"/utils/validator/isEqual","permalink":"/modern-kit/docs/utils/validator/isEqual","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"isDate","permalink":"/modern-kit/docs/utils/validator/isDate"},"next":{"title":"isFloat","permalink":"/modern-kit/docs/utils/validator/isFloat"}}');var i=n(6206),l=n(3267);const r={},a="isEqual",d={},c=[{value:"Code",id:"code",level:2},{value:"Benchmark",id:"benchmark",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2}];function o(e){const s={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,l.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(s.header,{children:(0,i.jsx)(s.h1,{id:"isequal",children:"isEqual"})}),"\n",(0,i.jsxs)(s.p,{children:["\uc778\uc790\ub85c \uc8fc\uc5b4\uc9c4 \ub450 \uac12\uc744 ",(0,i.jsx)(s.code,{children:"\uae4a\uc740 \ube44\uad50"}),"\ud574\uc11c \uac19\uc740\uc9c0 \ub2e4\ub978\uc9c0 \uc5ec\ubd80\ub97c \ubc18\ud658\ud574\uc8fc\ub294 \ud568\uc218\uc785\ub2c8\ub2e4."]}),"\n",(0,i.jsx)("br",{}),"\n",(0,i.jsx)(s.h2,{id:"code",children:"Code"}),"\n",(0,i.jsx)(s.p,{children:(0,i.jsx)(s.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/utils/src/validator/isEqual/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,i.jsx)(s.h2,{id:"benchmark",children:"Benchmark"}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.code,{children:"hz"}),": \ucd08\ub2f9 \uc791\uc5c5 \uc218"]}),"\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.code,{children:"mean"}),": \ud3c9\uade0 \uc751\ub2f5 \uc2dc\uac04(ms)"]}),"\n"]}),"\n",(0,i.jsxs)(s.table,{children:[(0,i.jsx)(s.thead,{children:(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.th,{children:"\uc774\ub984"}),(0,i.jsx)(s.th,{children:"hz"}),(0,i.jsx)(s.th,{children:"mean"}),(0,i.jsx)(s.th,{children:"\uc131\ub2a5"})]})}),(0,i.jsxs)(s.tbody,{children:[(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"modern-kit/isEqual"}),(0,i.jsx)(s.td,{children:"9,128,265.02"}),(0,i.jsx)(s.td,{children:"0.0001"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"fastest"})})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"lodash/isEqual"}),(0,i.jsx)(s.td,{children:"6,979,847.18"}),(0,i.jsx)(s.td,{children:"0.0001"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"slowest"})})]})]})]}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.strong,{children:"modern-kit/isEqual"}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.code,{children:"1.31x"})," faster than lodash/isEqual"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(s.h2,{id:"interface",children:"Interface"}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-ts",metastring:'title="typescript"',children:"const isEqual: (source: any, target: any) => boolean\n"})}),"\n",(0,i.jsx)(s.h2,{id:"usage",children:"Usage"}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-ts",metastring:'title="typescript"',children:'import { isEqual } from \'@modern-kit/utils\';\n\nconst isEqual1 = isEqual(1, 1); // true\nconst isEqual2 = isEqual({ a: 1}, { a: 1}); // true\nconst isEqual3 = isEqual([1, 2, 3] [1, 2, 3]); // true\n\nconst isEqual4 = isEqual("1", "2"); // false\nconst isEqual5 = isEqual({ a: 1}, { a: 2}); // false\nconst isEqual6 = isEqual([1, 2, 3], [1, "2", 3]); // false\n'})})]})}function h(e={}){const{wrapper:s}={...(0,l.R)(),...e.components};return s?(0,i.jsx)(s,{...e,children:(0,i.jsx)(o,{...e})}):o(e)}},3267:(e,s,n)=>{n.d(s,{R:()=>r,x:()=>a});var t=n(4382);const i={},l=t.createContext(i);function r(e){const s=t.useContext(l);return t.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function a(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),t.createElement(l.Provider,{value:s},e.children)}}}]);
\ No newline at end of file
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[2746],{1695:(e,s,n)=>{n.r(s),n.d(s,{assets:()=>d,contentTitle:()=>a,default:()=>h,frontMatter:()=>r,metadata:()=>t,toc:()=>c});const t=JSON.parse('{"id":"utils/validator/isEqual","title":"isEqual","description":"\uc778\uc790\ub85c \uc8fc\uc5b4\uc9c4 \ub450 \uac12\uc744 \uae4a\uc740 \ube44\uad50\ud574\uc11c \uac19\uc740\uc9c0 \ub2e4\ub978\uc9c0 \uc5ec\ubd80\ub97c \ubc18\ud658\ud574\uc8fc\ub294 \ud568\uc218\uc785\ub2c8\ub2e4.","source":"@site/docs/utils/validator/isEqual.md","sourceDirName":"utils/validator","slug":"/utils/validator/isEqual","permalink":"/modern-kit/docs/utils/validator/isEqual","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"isDate","permalink":"/modern-kit/docs/utils/validator/isDate"},"next":{"title":"isFloat","permalink":"/modern-kit/docs/utils/validator/isFloat"}}');var i=n(6206),l=n(3267);const r={},a="isEqual",d={},c=[{value:"Code",id:"code",level:2},{value:"Benchmark",id:"benchmark",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2}];function o(e){const s={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,l.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(s.header,{children:(0,i.jsx)(s.h1,{id:"isequal",children:"isEqual"})}),"\n",(0,i.jsxs)(s.p,{children:["\uc778\uc790\ub85c \uc8fc\uc5b4\uc9c4 \ub450 \uac12\uc744 ",(0,i.jsx)(s.code,{children:"\uae4a\uc740 \ube44\uad50"}),"\ud574\uc11c \uac19\uc740\uc9c0 \ub2e4\ub978\uc9c0 \uc5ec\ubd80\ub97c \ubc18\ud658\ud574\uc8fc\ub294 \ud568\uc218\uc785\ub2c8\ub2e4."]}),"\n",(0,i.jsx)("br",{}),"\n",(0,i.jsx)(s.h2,{id:"code",children:"Code"}),"\n",(0,i.jsx)(s.p,{children:(0,i.jsx)(s.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/utils/src/validator/isEqual/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,i.jsx)(s.h2,{id:"benchmark",children:"Benchmark"}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.code,{children:"hz"}),": \ucd08\ub2f9 \uc791\uc5c5 \uc218"]}),"\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.code,{children:"mean"}),": \ud3c9\uade0 \uc751\ub2f5 \uc2dc\uac04(ms)"]}),"\n"]}),"\n",(0,i.jsxs)(s.table,{children:[(0,i.jsx)(s.thead,{children:(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.th,{children:"\uc774\ub984"}),(0,i.jsx)(s.th,{children:"hz"}),(0,i.jsx)(s.th,{children:"mean"}),(0,i.jsx)(s.th,{children:"\uc131\ub2a5"})]})}),(0,i.jsxs)(s.tbody,{children:[(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"modern-kit/isEqual"}),(0,i.jsx)(s.td,{children:"9,128,265.02"}),(0,i.jsx)(s.td,{children:"0.0001"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"fastest"})})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"lodash/isEqual"}),(0,i.jsx)(s.td,{children:"6,979,847.18"}),(0,i.jsx)(s.td,{children:"0.0001"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"slowest"})})]})]})]}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.strong,{children:"modern-kit/isEqual"}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsxs)(s.li,{children:[(0,i.jsx)(s.code,{children:"1.31x"})," faster than lodash/isEqual"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(s.h2,{id:"interface",children:"Interface"}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-ts",metastring:'title="typescript"',children:"const isEqual: (source: any, target: any) => boolean\n"})}),"\n",(0,i.jsx)(s.h2,{id:"usage",children:"Usage"}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-ts",metastring:'title="typescript"',children:'import { isEqual } from \'@modern-kit/utils\';\n\nconst isEqual1 = isEqual(1, 1); // true\nconst isEqual2 = isEqual({ a: 1}, { a: 1}); // true\nconst isEqual3 = isEqual([1, 2, 3] [1, 2, 3]); // true\n\nconst isEqual4 = isEqual("1", "2"); // false\nconst isEqual5 = isEqual({ a: 1}, { a: 2}); // false\nconst isEqual6 = isEqual([1, 2, 3], [1, "2", 3]); // false\n'})})]})}function h(e={}){const{wrapper:s}={...(0,l.R)(),...e.components};return s?(0,i.jsx)(s,{...e,children:(0,i.jsx)(o,{...e})}):o(e)}},3267:(e,s,n)=>{n.d(s,{R:()=>r,x:()=>a});var t=n(4382);const i={},l=t.createContext(i);function r(e){const s=t.useContext(l);return t.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function a(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),t.createElement(l.Provider,{value:s},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/7da35ef8.5f20f679.js b/assets/js/7da35ef8.5f20f679.js
new file mode 100644
index 000000000..1ae15393e
--- /dev/null
+++ b/assets/js/7da35ef8.5f20f679.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[6234],{4697:(e,n,t)=>{t.r(n),t.d(n,{Example:()=>u,assets:()=>l,contentTitle:()=>i,default:()=>h,frontMatter:()=>a,metadata:()=>r,toc:()=>m});const r=JSON.parse('{"id":"react/components/Mounted","title":"Mounted","description":"\ucef4\ud3ec\ub10c\ud2b8\uac00 \ube0c\ub77c\uc6b0\uc800\uc5d0 mount \ub418\uc5c8\uc744 \ub54c children\uc774 \ub098\ud0c0\ub098\uac8c \ud574\uc8fc\ub294 \ucef4\ud3ec\ub10c\ud2b8\uc785\ub2c8\ub2e4. \uc989, children\uc744 \ub80c\ub354\ub9c1\ud558\ub294 \ud658\uacbd\uc774 \ud074\ub77c\uc774\uc5b8\ud2b8 \ud658\uacbd\uc784\uc744 \ubcf4\uc7a5\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. mount \uc804\uc5d0\ub294 fallback\uc73c\ub85c \ub123\uc5b4\uc900 \ucef4\ud3ec\ub10c\ud2b8\ub97c \ubcf4\uc5ec\uc90d\ub2c8\ub2e4.","source":"@site/docs/react/components/Mounted.mdx","sourceDirName":"react/components","slug":"/react/components/Mounted","permalink":"/modern-kit/docs/react/components/Mounted","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"LazyImage","permalink":"/modern-kit/docs/react/components/LazyImage"},"next":{"title":"OutsidePointerDownHandler","permalink":"/modern-kit/docs/react/components/OutsidePointerDownHandler"}}');var o=t(6206),c=t(3267),s=t(4382);const d=({fallback:e=(0,o.jsx)(o.Fragment,{}),children:n})=>function(){const[e,n]=(0,s.useState)(!1);return(0,s.useEffect)((()=>{n(!0)}),[]),e}()?(0,o.jsx)(o.Fragment,{children:n}):e,a={},i="Mounted",l={},u=()=>{const e={div:"div",...(0,c.R)()};return(0,o.jsx)(d,{fallback:(0,o.jsx)(e.div,{children:"mount\uac00 \uc644\ub8cc\ub418\uae30 \uc804\uc785\ub2c8\ub2e4."}),children:(0,o.jsx)(e.div,{children:"mount\uac00 \uc644\ub8cc\ub418\uc5c8\uc2b5\ub2c8\ub2e4."})})},m=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function p(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,c.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.header,{children:(0,o.jsx)(n.h1,{id:"mounted",children:"Mounted"})}),"\n",(0,o.jsx)(n.p,{children:"\ucef4\ud3ec\ub10c\ud2b8\uac00 \ube0c\ub77c\uc6b0\uc800\uc5d0 mount \ub418\uc5c8\uc744 \ub54c children\uc774 \ub098\ud0c0\ub098\uac8c \ud574\uc8fc\ub294 \ucef4\ud3ec\ub10c\ud2b8\uc785\ub2c8\ub2e4. \uc989, children\uc744 \ub80c\ub354\ub9c1\ud558\ub294 \ud658\uacbd\uc774 \ud074\ub77c\uc774\uc5b8\ud2b8 \ud658\uacbd\uc784\uc744 \ubcf4\uc7a5\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. mount \uc804\uc5d0\ub294 fallback\uc73c\ub85c \ub123\uc5b4\uc900 \ucef4\ud3ec\ub10c\ud2b8\ub97c \ubcf4\uc5ec\uc90d\ub2c8\ub2e4."}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.code,{children:"SSR"})," \ud658\uacbd\uc5d0\uc11c \ucef4\ud3ec\ub10c\ud2b8\uac00 \ube0c\ub77c\uc6b0\uc800\uc5d0 \ub9c8\uc6b4\ud2b8\ub418\uae30 \uc804\uacfc \ud6c4\uc758 \ucef4\ud3ec\ub10c\ud2b8\ub97c \ub2e4\ub8e8\uae30 \uc704\ud574 \uc0ac\uc6a9\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(n.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/components/Mounted/index.tsx",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(n.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"\ninterface MountedProps {\n fallback?: JSX.Element;\n}\n\nconst Mounted: ({\n fallback = <>>\n}: PropsWithChildren) => JSX.Element;\n"})}),"\n",(0,o.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { Mounted } from '@modern-kit/react'\n\nconst Example = () => {\n return (\n mount\uac00 \uc644\ub8cc\ub418\uae30 \uc804\uc785\ub2c8\ub2e4.}>\n mount\uac00 \uc644\ub8cc\ub418\uc5c8\uc2b5\ub2c8\ub2e4.
\n \n );\n};\n"})}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(u,{})]})}function h(e={}){const{wrapper:n}={...(0,c.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(p,{...e})}):p(e)}},3267:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>d});var r=t(4382);const o={},c=r.createContext(o);function s(e){const n=r.useContext(c);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function d(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:s(e.components),r.createElement(c.Provider,{value:n},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/7da35ef8.af433888.js b/assets/js/7da35ef8.af433888.js
deleted file mode 100644
index e5c070915..000000000
--- a/assets/js/7da35ef8.af433888.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[6234],{9343:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>u,assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>s,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"react/components/Mounted","title":"Mounted","description":"\ucef4\ud3ec\ub10c\ud2b8\uac00 \ube0c\ub77c\uc6b0\uc800\uc5d0 mount \ub418\uc5c8\uc744 \ub54c children\uc774 \ub098\ud0c0\ub098\uac8c \ud574\uc8fc\ub294 \ucef4\ud3ec\ub10c\ud2b8\uc785\ub2c8\ub2e4. \uc989, children\uc744 \ub80c\ub354\ub9c1\ud558\ub294 \ud658\uacbd\uc774 \ud074\ub77c\uc774\uc5b8\ud2b8 \ud658\uacbd\uc784\uc744 \ubcf4\uc7a5\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. mount \uc804\uc5d0\ub294 fallback\uc73c\ub85c \ub123\uc5b4\uc900 \ucef4\ud3ec\ub10c\ud2b8\ub97c \ubcf4\uc5ec\uc90d\ub2c8\ub2e4.","source":"@site/docs/react/components/Mounted.mdx","sourceDirName":"react/components","slug":"/react/components/Mounted","permalink":"/modern-kit/docs/react/components/Mounted","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"LazyImage","permalink":"/modern-kit/docs/react/components/LazyImage"},"next":{"title":"OutsidePointerDownHandler","permalink":"/modern-kit/docs/react/components/OutsidePointerDownHandler"}}');var o=n(6206),i=n(3267),c=(n(4382),n(4027));const s={},a="Mounted",l={},u=()=>{const e={div:"div",...(0,i.R)()};return(0,o.jsx)(c.hN,{fallback:(0,o.jsx)(e.div,{children:"mount\uac00 \uc644\ub8cc\ub418\uae30 \uc804\uc785\ub2c8\ub2e4."}),children:(0,o.jsx)(e.div,{children:"mount\uac00 \uc644\ub8cc\ub418\uc5c8\uc2b5\ub2c8\ub2e4."})})},d=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function f(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"mounted",children:"Mounted"})}),"\n",(0,o.jsx)(t.p,{children:"\ucef4\ud3ec\ub10c\ud2b8\uac00 \ube0c\ub77c\uc6b0\uc800\uc5d0 mount \ub418\uc5c8\uc744 \ub54c children\uc774 \ub098\ud0c0\ub098\uac8c \ud574\uc8fc\ub294 \ucef4\ud3ec\ub10c\ud2b8\uc785\ub2c8\ub2e4. \uc989, children\uc744 \ub80c\ub354\ub9c1\ud558\ub294 \ud658\uacbd\uc774 \ud074\ub77c\uc774\uc5b8\ud2b8 \ud658\uacbd\uc784\uc744 \ubcf4\uc7a5\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. mount \uc804\uc5d0\ub294 fallback\uc73c\ub85c \ub123\uc5b4\uc900 \ucef4\ud3ec\ub10c\ud2b8\ub97c \ubcf4\uc5ec\uc90d\ub2c8\ub2e4."}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"SSR"})," \ud658\uacbd\uc5d0\uc11c \ucef4\ud3ec\ub10c\ud2b8\uac00 \ube0c\ub77c\uc6b0\uc800\uc5d0 \ub9c8\uc6b4\ud2b8\ub418\uae30 \uc804\uacfc \ud6c4\uc758 \ucef4\ud3ec\ub10c\ud2b8\ub97c \ub2e4\ub8e8\uae30 \uc704\ud574 \uc0ac\uc6a9\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/components/Mounted/index.tsx",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"\ninterface MountedProps {\n fallback?: JSX.Element;\n}\n\nconst Mounted: ({\n fallback = <>>\n}: PropsWithChildren) => JSX.Element;\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { Mounted } from '@modern-kit/react'\n\nconst Example = () => {\n return (\n mount\uac00 \uc644\ub8cc\ub418\uae30 \uc804\uc785\ub2c8\ub2e4.}>\n mount\uac00 \uc644\ub8cc\ub418\uc5c8\uc2b5\ub2c8\ub2e4.
\n \n );\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(u,{})]})}function h(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(f,{...e})}):f(e)}},4027:(e,t,n)=>{n.d(t,{$$:()=>$e,$I:()=>oe,AE:()=>Ae,BL:()=>H,DX:()=>I,FT:()=>st,Fo:()=>et,Hn:()=>it,I5:()=>je,JF:()=>Te,K:()=>le,K$:()=>Je,M0:()=>Me,ML:()=>ne,Mj:()=>ye,Mk:()=>Ne,Mo:()=>ie,NT:()=>Xe,QV:()=>Ue,Ub:()=>ke,Ut:()=>Ee,W7:()=>U,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>We,Zu:()=>ae,_1:()=>Re,_g:()=>nt,aL:()=>J,aY:()=>Ie,bB:()=>D,d7:()=>B,eG:()=>ct,fN:()=>se,fm:()=>G,gl:()=>$,hN:()=>z,iD:()=>de,iQ:()=>Le,jd:()=>ce,lW:()=>lt,oD:()=>K,oo:()=>Oe,pL:()=>q,qi:()=>ue,rN:()=>Fe,tD:()=>Se,u8:()=>Q,wY:()=>Be,xV:()=>L,xh:()=>tt,zy:()=>Z});var r=n(6206),o=n(4382),i=n(3683),c=n(5086),s=n(7197),a=(n(1604),n(5938));function l(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function m(){return typeof window>"u"}function g(){return!m()}function w(e){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const b=e=>f(void 0,0,void 0,(function*(){return w(yield(yield fetch(e)).text())}));function v(e,t){var n;return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return b(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const i=yield p(e,h[t]);n(i)}catch(i){console.error(`Failed to load image. message: ${i.mesaage}`),r(i)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i=0;i{if(e===t||C(e)&&C(t)&&isNaN(e)&&isNaN(t))return!0;if(S(e)&&S(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return y(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!x(o,t.get(r),n))return!1;return!0}return y(e,t,n)};function k(e,t){return x(e,t,new WeakMap)}function S(e){return"function"==typeof e}function C(e){return"number"==typeof e}function E(e){return!function(e){return Object(e)!==e}(e)}function j(){}function O(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const R=(...e)=>t=>e.forEach((e=>{if(S(e))e(t);else if(null!=e){e.current=t}}));function M(...e){return(0,o.useCallback)(R(...e),e)}const I=o.forwardRef(((e,t)=>{const{children:n}=e,i=l(e,["children"]),c=o.Children.toArray(n),s=c.find(N);if(s){const e=s.props.children,n=c.map((t=>t===s?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(F,Object.assign({},i,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(F,Object.assign({},i,{ref:t,children:n}))}));I.displayName="Slot";const F=o.forwardRef(((e,t)=>{const{children:n}=e,r=l(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),i):"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?R(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));F.displayName="SlotClone";const L=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function N(e){return o.isValidElement(e)&&e.type===L}var P="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const $=d(((e,t)=>{var{ratio:n,style:o,as:c="div",asChild:s=!1}=e,a=l(e,["ratio","style","as","asChild"]);const u=s?I:c,d=Object.assign({aspectRatio:n},o),f=s?a.className:i(P,a.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},a))})),T=()=>j,Y=()=>!1,X=()=>!0;function D({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)(T,Y,X)?e:t}function V(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const z=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>V()?(0,r.jsx)(r.Fragment,{children:t}):e;function A(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function W(e){const t=A(e);(0,o.useEffect)((()=>()=>t()),[t])}function _(e,t=k){const[n,r]=(0,o.useState)(e),i=A(t);return(0,o.useEffect)((()=>{i(n,e)||r(e)}),[i,n,e]),n}function B(e,t,n){const r=A(e),i=_(n),s=(0,o.useMemo)((()=>(0,c.A)(r,t,i)),[r,t,i]);return W((()=>s.cancel())),s}const J=({children:e,capture:t,wait:n,options:r})=>{const i=o.Children.only(e),c=B(((...e)=>{const n=i?.props;if(n&&S(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(i,{[t]:c})};function H({onIntersectStart:e=j,onIntersectEnd:t=j,enabled:n=!0,calledOnce:r=!1,root:i=null,threshold:c=0,rootMargin:s="0px 0px 0px 0px"}){const a=(0,o.useRef)(0),l=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=A((([n],o)=>{if(!n)return;const i=n.target;n.isIntersecting?(l.current=!0,a.current+=1,e(n)):l.current&&(l.current=!1,a.current+=1,t(n)),r&&a.current>1&&o.unobserve(i)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:c,root:i,rootMargin:s}),u.current.observe(e))}),[n,c,i,s,d])}}const K=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:i,rootMargin:c}=e,s=l(e,["src","threshold","root","rootMargin"]);const{ref:a}=H({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:i,rootMargin:c});return(0,r.jsx)("img",Object.assign({ref:M(t,a)},s))}));K.displayName="LazyImage";const U=(0,o.forwardRef)(((e,t)=>{var{width:n,height:i,fallback:c,className:s,style:a,duration:u="0.2s",onLoad:d}=e,f=l(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,p]=(0,o.useState)(!1),m=!h,g=(0,o.useMemo)((()=>({position:"relative",width:n,height:i})),[n,i]),w=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:m?0:1,transition:`opacity ${u}`},a)),[m,u,a]),b=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),v=s?`lazy-image-wrapper ${s}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:v,style:g,children:[m&&c,(0,r.jsx)(K,Object.assign({ref:t,width:n,height:i,style:w,onLoad:b},f))]})}));U.displayName="FallbackLazyImage";const Z=({condition:e,trueComponent:t,falseComponent:n})=>{const i=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:i?t:n})},Q=({onScrollAction:e,children:t,root:n,threshold:o,enabled:i,triggerPosition:c="after",rootMargin:s="150px 0px"})=>{const{ref:a}=H({onIntersectStart:e,root:n,threshold:o,enabled:i,rootMargin:s});return(0,r.jsxs)(r.Fragment,{children:["before"===c&&(0,r.jsx)("div",{ref:a}),t,"after"===c&&(0,r.jsx)("div",{ref:a})]})},q=d(((e,t)=>{var{children:n,as:i="div",asChild:c=!1}=e,s=l(e,["children","as","asChild"]);const a=c?I:i,{ref:u}=H(s);if(c&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(a,Object.assign({ref:R(t,u)},s,{children:n}))})),G=({items:e=[],itemKey:t,renderItem:n})=>{const i=(0,o.useCallback)(((e,n)=>function(e){return E(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},i(e,t))))})},ee=g()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=A(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),i=(0,o.useMemo)((()=>function(){if(m())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,i,(({target:t})=>{if(!r.current)return;const o=r.current,i=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!i&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:i="div",asChild:c=!1,onPointerDown:s,excludeRefs:a=[]}=e,u=l(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(s,{excludeRefs:a}),f=c?I:i;if(c&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:R(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const ie=({itemKey:e,items:t=[],separator:n,renderItem:i,separatorInterval:c=1,includeLastSeparator:s=!1})=>{const a=(0,o.useCallback)((e=>e===t.length-1?s:(e+1)%c==0),[s,c,t.length]);return(0,r.jsx)(G,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[i(e,t),a(t)&&n]})})},ce=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),se=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function ae(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function le(e=!0){const t=S(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!i.current){i.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{i.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),i=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield w(e);return t(n),!0}catch{return t(null),!1}}))),[]),c=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield v(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),s=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),a=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:i,copyImage:c,readText:s,readContents:a}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",pe={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},me=e=>pe[e],ge=me("localStorage"),we=e=>window.localStorage.getItem(e),be=e=>JSON.stringify(e),ve=e=>(ge.subscribe(e),()=>{ge.unsubscribe(e)});function ye(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=S(n)?n():n,i=(0,o.useSyncExternalStore)(ve,(()=>we(t)),(()=>be(r)));return{state:(0,o.useMemo)((()=>i?O(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=we(t),o=n?O(n):r,i=S(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(i)),ge.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),ge.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const xe=(e,t)=>g()?window.matchMedia(e).matches:t??!1;function ke(e,t){const[n,r]=(0,o.useState)(xe(e,t)),i=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",i),n}function Se(){return ke("(prefers-color-scheme: dark)")?"dark":"light"}const Ce="color-scheme";function Ee({defaultValue:e,key:t=Ce,shouldSetBodyClass:n=!1}={}){const r=Se(),i=S(e)?e():e,{state:c,setState:s}=ye({key:t,initialValue:i??r}),a=(0,o.useCallback)((()=>{s((e=>"dark"===e?"light":"dark"))}),[s]),l=(0,o.useCallback)((()=>{s("dark")}),[s]),u=(0,o.useCallback)((()=>{s("light")}),[s]),d=(0,o.useCallback)((()=>{s(r)}),[s,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(c),()=>{n&&document.body.classList.remove(c)})),[c,n]),{colorScheme:c,preferredColorScheme:r,setToggleMode:a,setDarkMode:l,setLightMode:u,setPreferredMode:d}}function je(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),i=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),c=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:i,reset:c}}function Oe({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,i]=(0,o.useState)(t),c=r0,a=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),l=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const c=a(e,t);o&&o({prev:r,next:c}),i(c)}),[n,r,a]),u=(0,o.useCallback)((e=>{l("nextStep",!c,e)}),[c,l]),d=(0,o.useCallback)((e=>{l("prevStep",!s,e)}),[s,l]),f=(0,o.useCallback)(((t,n)=>{const o=S(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void i(t);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),i(t)}),[r,t]);return{currentStep:r,hasNextStep:c,hasPrevStep:s,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Re(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:i,resetStep:c}=Oe({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:i,resetIndex:c}}function Me(e,t,n={}){const[r,i]=(0,o.useState)(e);return[r,B(i,t,n)]}function Ie(e,t={}){const[n,r]=(0,o.useState)(""),[i,c]=Me("",e,t);return{value:n,debouncedValue:i,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),c(t)}),[c]),onReset:(0,o.useCallback)((()=>{r(""),c("")}),[c])}}function Fe(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Le({onFocus:e=j,onBlur:t=j}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),c=A((t=>{r(!0),e(t)})),s=A((e=>{r(!1),t(e)})),a=(0,o.useCallback)((()=>{i.current&&(i.current.focus(),r(!0))}),[]);return ne(i,"focus",c),ne(i,"blur",s),{ref:i,isFocus:n,setFocus:a}}function Ne({onEnter:e=j,onLeave:t=j}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),c=A((t=>{r(!0),e(t)})),s=A((e=>{r(!1),t(e)}));return ne(i,"mouseenter",c),ne(i,"mouseleave",s),{ref:i,isHovered:n}}const Pe=e=>{var t;return C(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function $e(e,t){const n=(0,o.useRef)(),r=A(e),{delay:i,enabled:c}=Pe(t),s=(0,o.useCallback)((()=>{n.current=window.setInterval(r,i)}),[r,i]),a=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{a(),s()}),[a,s]);return(0,o.useEffect)((()=>{if(!(i<0)&&c)return s(),()=>a()}),[a,s,c,i]),{set:s,reset:l,clear:a}}function Te({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),i=A((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];S(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",i),()=>t.removeEventListener("keydown",i)}),[e,i]),r}const Ye={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function Xe(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)(Ye),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:i,clientY:c,pageX:s,pageY:a}=t;let l=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();l=i-t.left,u=c-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:i,clientY:c,pageX:s,pageY:a,elementRelativeX:l,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const De=()=>navigator.onLine,Ve=()=>!0,ze=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function Ae({onlineAction:e=j,offlineAction:t=j}={}){const n=A((n=>ze(n,e,t)));return(0,o.useSyncExternalStore)(n,De,Ve)}function We(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const _e={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Be(e=j){const[t,n]=(0,o.useState)(_e),r=(0,o.useRef)(null),i=A((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(i);return t.observe(e),()=>{t.unobserve(e)}}),[i]),{ref:r,contentRect:t}}function Je({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),i=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>i())),[e,r,i]),{ref:t,lock:r,unlock:i}}const He=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,Ke=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:i=0,alignY:c="start",alignX:s="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+i+He(window.innerHeight,r.height,c),left:r.left+window.scrollX+o+He(window.innerWidth,r.width,s)};const a=e.getBoundingClientRect();return{top:r.top-a.top+e.scrollTop+i+He(a.height,r.height,c),left:r.left-a.left+e.scrollLeft+o+He(a.width,r.width,s)}};function Ue(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:i,top:c}=Ke(r,t,n);r.scrollTo({top:c,left:i,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ze=me("sessionStorage"),Qe=e=>window.sessionStorage.getItem(e),qe=e=>JSON.stringify(e),Ge=e=>(Ze.subscribe(e),()=>{Ze.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=S(n)?n():n,i=(0,o.useSyncExternalStore)(Ge,(()=>Qe(t)),(()=>qe(r)));return{state:(0,o.useMemo)((()=>i?O(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=Qe(t),o=n?O(n):r,i=S(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(i)),Ze.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ze.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:i}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[c,s]=(0,o.useState)(n),a=(0,o.useCallback)((e=>{s((t=>{const n=S(e)?e(t):e;return r&&i&&function(e,t,n){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=S(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,i,n),n}))}),[r,i]),l=(0,o.useCallback)((()=>{r&&i&&function(e,t){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,i),s(null)}),[r,i]);return Object.assign({state:c,setState:a,clearState:l},Oe(e))}function nt(e,t,n={}){const r=A(e),i=_(n),c=(0,o.useMemo)((()=>(0,s.A)(r,t,i)),[r,t,i]);return W((()=>c.cancel())),c}const rt=e=>{var t;return C(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=A(e),{delay:i,enabled:c}=rt(t),s=(0,o.useCallback)((()=>{n.current=setTimeout(r,i)}),[r,i]),a=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{a(),s()}),[a,s]);return(0,o.useEffect)((()=>{if(!(i<0)&&c)return s(),()=>a()}),[s,a,i,c]),{set:s,reset:l,clear:a}}function it(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function ct(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new a.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function st({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const at={width:null,height:null};function lt({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>m()?at:{width:window.innerWidth,height:window.innerHeight})),r=B(n,e),i=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",i),t}function ut(e,t,n){const{delay:r,enabled:i}=rt(t),{set:c,reset:s,clear:a}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!i||s()}),[r,i,s,...n]),{set:c,reset:s,clear:a}}}}]);
\ No newline at end of file
diff --git a/assets/js/8053496e.1a9e1459.js b/assets/js/8053496e.1a9e1459.js
new file mode 100644
index 000000000..60a213e65
--- /dev/null
+++ b/assets/js/8053496e.1a9e1459.js
@@ -0,0 +1,2 @@
+/*! For license information please see 8053496e.1a9e1459.js.LICENSE.txt */
+(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[8313],{6933:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Example:()=>m,assets:()=>f,contentTitle:()=>h,default:()=>j,frontMatter:()=>p,metadata:()=>r,toc:()=>x});const r=JSON.parse('{"id":"react/components/AspectRatio","title":"AspectRatio","description":"\uc8fc\uc5b4\uc9c4 aspect-ratio \ube44\uc728\uc744 \ub9de\ucdb0\uc8fc\uae30 \uc704\ud574 \uc120\uc5b8\uc801\uc73c\ub85c \uc0ac\uc6a9\ud558\ub294 \uc720\ud2f8 \ucef4\ud3ec\ub10c\ud2b8\uc785\ub2c8\ub2e4.","source":"@site/docs/react/components/AspectRatio.mdx","sourceDirName":"react/components","slug":"/react/components/AspectRatio","permalink":"/modern-kit/docs/react/components/AspectRatio","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"Introduce","permalink":"/modern-kit/docs/introduce/"},"next":{"title":"ClientGate","permalink":"/modern-kit/docs/react/components/ClientGate"}}');var i=n(6206),o=n(3267),s=(n(4382),n(4076)),c=n(7284),a=n(6807),l=n(3683);var d="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if("undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const u=(0,c.V)(((e,t)=>{var{ratio:n,style:r,as:o="div",asChild:c=!1}=e,u=(0,s._)(e,["ratio","style","as","asChild"]);const p=c?a.D:o,h=Object.assign({aspectRatio:n},r),f=c?u.className:l(d,u.className);return(0,i.jsx)(p,Object.assign({ref:t,style:h,className:f},u))})),p={},h="AspectRatio",f={},m=()=>{const e={br:"br",div:"div",h3:"h3",img:"img",...(0,o.R)()},t="https://github.com/user-attachments/assets/dd60ec12-afd7-44c9-bd6b-0069e16bf2c9";return(0,i.jsxs)(e.div,{style:{width:"500px"},children:[(0,i.jsx)(e.h3,{children:"Default"}),(0,i.jsx)(u,{ratio:427/640,children:(0,i.jsx)(e.img,{src:t})}),(0,i.jsx)(e.br,{}),(0,i.jsx)(e.h3,{children:"as article"}),(0,i.jsx)(u,{as:"article",ratio:427/640,children:(0,i.jsx)(e.img,{src:t})}),(0,i.jsx)(e.br,{}),(0,i.jsx)(e.h3,{children:"asChild"}),(0,i.jsx)(u,{asChild:!0,ratio:427/640,children:(0,i.jsx)(e.img,{src:t,style:{width:"100%"}})})]})},x=[{value:"\ub2e4\ud615\uc131(polymorphism)",id:"\ub2e4\ud615\uc131polymorphism",level:3},{value:"\ud569\uc131(Composition), \ub80c\ub354\ub9c1 \uc704\uc784(Rendering Delegation)",id:"\ud569\uc131composition-\ub80c\ub354\ub9c1-\uc704\uc784rendering-delegation",level:3},{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Default",id:"default",level:3},{value:"as",id:"as",level:3},{value:"asChild",id:"aschild",level:3},{value:"Example",id:"example",level:2}];function g(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t.header,{children:(0,i.jsx)(t.h1,{id:"aspectratio",children:"AspectRatio"})}),"\n",(0,i.jsxs)(t.p,{children:["\uc8fc\uc5b4\uc9c4 ",(0,i.jsx)(t.strong,{children:(0,i.jsx)(t.a,{href:"https://developer.mozilla.org/en-US/docs/Web/CSS/aspect-ratio",children:"aspect-ratio"})})," \ube44\uc728\uc744 \ub9de\ucdb0\uc8fc\uae30 \uc704\ud574 \uc120\uc5b8\uc801\uc73c\ub85c \uc0ac\uc6a9\ud558\ub294 \uc720\ud2f8 \ucef4\ud3ec\ub10c\ud2b8\uc785\ub2c8\ub2e4."]}),"\n",(0,i.jsxs)(t.p,{children:["\ubbf8\ub9ac \uc601\uc5ed\uc744 \ud655\ubcf4\ud558\uc5ec ",(0,i.jsx)(t.code,{children:"Layout Shift"}),"\ub97c \ubc29\uc9c0\ud558\ub294\ub370 \ud6a8\uacfc\uc801\uc785\ub2c8\ub2e4."]}),"\n",(0,i.jsx)("br",{}),"\n",(0,i.jsx)(t.h3,{id:"\ub2e4\ud615\uc131polymorphism",children:"\ub2e4\ud615\uc131(polymorphism)"}),"\n",(0,i.jsxs)(t.p,{children:[(0,i.jsx)(t.code,{children:"AspectRatio"})," \ucef4\ud3ec\ub10c\ud2b8\ub294 \ub2e4\ud615\uc131\uc744 \uc704\ud574 ",(0,i.jsx)(t.code,{children:"as"})," \uc18d\uc131\uc744 \uc9c0\uc6d0\ud569\ub2c8\ub2e4."]}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsxs)(t.li,{children:["\uae30\ubcf8\uc801\uc73c\ub85c ",(0,i.jsx)(t.code,{children:"div"})," \ud0dc\uadf8\ub85c \uc790\uc2dd \uc694\uc18c\ub97c \uac10\uc2f8\uc11c \ub80c\ub354\ub9c1\ud558\uba70, ",(0,i.jsx)(t.code,{children:"as"})," \uc18d\uc131\uc744 \ud1b5\ud574 \uac10\uc2f8\ub294 ",(0,i.jsx)(t.code,{children:"Wrapper"})," \uc694\uc18c\uc758 \ud0dc\uadf8\ub97c \ubcc0\uacbd\ud574 \ub80c\ub354\ub9c1\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. (ex. div -> article)"]}),"\n",(0,i.jsxs)(t.li,{children:["\uc774\ub54c, \ud574\ub2f9 ",(0,i.jsx)(t.code,{children:"Wrapper"})," \uc694\uc18c\uc5d0 ",(0,i.jsx)(t.code,{children:"aspect-ratio"})," \uc18d\uc131\uc744 \uc801\uc6a9\ud574 \uc601\uc5ed\uc744 \ud655\ubcf4\ud569\ub2c8\ub2e4."]}),"\n"]}),"\n",(0,i.jsx)(t.h3,{id:"\ud569\uc131composition-\ub80c\ub354\ub9c1-\uc704\uc784rendering-delegation",children:"\ud569\uc131(Composition), \ub80c\ub354\ub9c1 \uc704\uc784(Rendering Delegation)"}),"\n",(0,i.jsxs)(t.p,{children:[(0,i.jsx)(t.code,{children:"AspectRatio"})," \ucef4\ud3ec\ub10c\ud2b8\ub294 ",(0,i.jsx)(t.code,{children:"asChild"})," \uc18d\uc131\uc744 \ud1b5\ud574 ",(0,i.jsx)(t.code,{children:"\ud569\uc131(Composition)"}),", ",(0,i.jsx)(t.code,{children:"\ub80c\ub354\ub9c1 \uc704\uc784(Rendering Delegation)"})," \ud328\ud134\uc744 \uc9c0\uc6d0\ud569\ub2c8\ub2e4."]}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.code,{children:"asChild"})," \uc18d\uc131\uc774 ",(0,i.jsx)(t.code,{children:"true"}),"\ub77c\uba74 ",(0,i.jsx)(t.strong,{children:(0,i.jsx)(t.a,{href:"https://modern-agile-team.github.io/modern-kit/docs/react/components/Slot",children:"Slot"})})," \uc744 \ud1b5\ud574 \uc790\uc2dd \uc694\uc18c\ub97c \ub80c\ub354\ub9c1\ud569\ub2c8\ub2e4."]}),"\n",(0,i.jsxs)(t.li,{children:["\uc774\ub54c, \uc790\uc2dd \uc694\uc18c\uc5d0 ",(0,i.jsx)(t.code,{children:"aspect-ratio"})," \uc18d\uc131\uc744 \uc801\uc6a9\ud574 \uc601\uc5ed\uc744 \ud655\ubcf4\ud569\ub2c8\ub2e4.","\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsxs)(t.li,{children:["Slot\uc740 \uc790\uc2dd\uc73c\ub85c ",(0,i.jsx)(t.code,{children:"\ub2e8\uc77c \uc694\uc18c"}),"\ub9cc \ud5c8\uc6a9\ub429\ub2c8\ub2e4."]}),"\n",(0,i.jsxs)(t.li,{children:["Slot\uc740 \uc790\uc2dd\uc73c\ub85c \ucef4\ud3ec\ub10c\ud2b8\uac00 \uc62c \uacbd\uc6b0 ",(0,i.jsx)(t.code,{children:"forwardRef"}),", ",(0,i.jsx)(t.code,{children:"props"}),"\ub97c \ud5c8\uc6a9\ud574\uc57c \ud569\ub2c8\ub2e4. \ud5c8\uc6a9\ud558\uc9c0 \uc54a\uc73c\uba74 \uc815\uc0c1\uc801\uc73c\ub85c \ub3d9\uc791\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."]}),"\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.code,{children:"asChild"})," \uc18d\uc131\uc744 \uc0ac\uc6a9 \ud560 \uacbd\uc6b0 ",(0,i.jsx)(t.strong,{children:(0,i.jsx)(t.a,{href:"https://modern-agile-team.github.io/modern-kit/docs/react/components/Slot",children:"Slot"})})," \ubb38\uc11c\ub97c \ucc38\uace0\ud574\uc8fc\uc138\uc694."]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)("br",{}),"\n",(0,i.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,i.jsx)(t.p,{children:(0,i.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/components/AspectRatio/index.tsx",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,i.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"interface AspectRatioProps {\n children: JSX.Element;\n ratio: number;\n asChild?: boolean;\n style?: CSSProperties;\n className?: string;\n}\n"})}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:'const AspectRatio: PolyForwardComponent<"div", AspectRatioProps, React.ElementType>\n'})}),"\n",(0,i.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,i.jsx)(t.h3,{id:"default",children:"Default"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsxs)(t.li,{children:["\uae30\ubcf8\uc801\uc73c\ub85c ",(0,i.jsx)(t.code,{children:"div"})," \uc694\uc18c\uc5d0 \uac10\uc2f8\uc9c0\uba70 \ud574\ub2f9 ",(0,i.jsx)(t.code,{children:"div"}),"\uc5d0 ",(0,i.jsx)(t.code,{children:"aspect-ratio"})," \uc18d\uc131\uc744 \uc801\uc6a9\ud574 \uc601\uc5ed\uc744 \ud655\ubcf4\ud569\ub2c8\ub2e4."]}),"\n"]}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { AspectRatio } from '@modern-kit/react'\n\nconst Example = () => {\n const imgUrl = 'https://github.com/user-attachments/assets/dd60ec12-afd7-44c9-bd6b-0069e16bf2c9';\n\n return (\n \n
\n \n \n
\n );\n};\n"})}),"\n",(0,i.jsx)(t.h3,{id:"as",children:"as"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.code,{children:"as"})," \uc18d\uc131\uc744 \ud1b5\ud574 \uac10\uc2f8\ub294 \uc694\uc18c\ub97c ",(0,i.jsx)(t.code,{children:"div"}),"\uac00 \uc544\ub2cc \ud2b9\uc815 \uc694\uc18c\ub85c \ubcc0\uacbd\ud574 \ub80c\ub354\ub9c1\ud560 \uc218 \uc788\uc73c\uba70, \ud574\ub2f9 \uc694\uc18c\uc5d0 ",(0,i.jsx)(t.code,{children:"aspect-ratio"})," \uc18d\uc131\uc744 \uc801\uc6a9\ud574 \uc601\uc5ed\uc744 \ud655\ubcf4\ud569\ub2c8\ub2e4."]}),"\n"]}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { AspectRatio } from '@modern-kit/react'\n\nconst Example = () => {\n const imgUrl = 'https://github.com/user-attachments/assets/dd60ec12-afd7-44c9-bd6b-0069e16bf2c9';\n\n return (\n \n
\n \n \n
\n );\n};\n"})}),"\n",(0,i.jsx)(t.h3,{id:"aschild",children:"asChild"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.code,{children:"asChild"})," \uc18d\uc131\uc774 ",(0,i.jsx)(t.code,{children:"true"}),"\ub77c\uba74 ",(0,i.jsx)(t.strong,{children:(0,i.jsx)(t.a,{href:"https://modern-agile-team.github.io/modern-kit/docs/react/components/Slot",children:"Slot"})})," \uc744 \ud1b5\ud574 \uc790\uc2dd \uc694\uc18c\ub97c \uadf8\ub300\ub85c \ub80c\ub354\ub9c1\ud558\uace0, \uc790\uc2dd \uc694\uc18c\uc5d0 ",(0,i.jsx)(t.code,{children:"aspect-ratio"})," \uc18d\uc131\uc744 \uc801\uc6a9\ud574 \uc601\uc5ed\uc744 \ud655\ubcf4\ud569\ub2c8\ub2e4."]}),"\n"]}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { AspectRatio } from '@modern-kit/react'\n\nconst Example = () => {\n const imgUrl = 'https://github.com/user-attachments/assets/dd60ec12-afd7-44c9-bd6b-0069e16bf2c9';\n\n return (\n \n
\n \n \n
\n );\n};\n"})}),"\n","\n",(0,i.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,i.jsx)(m,{})]})}function j(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(g,{...e})}):g(e)}},4076:(e,t,n)=>{"use strict";function r(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);ir,a:()=>i}),"function"==typeof SuppressedError&&SuppressedError},3683:(e,t)=>{var n;!function(){"use strict";var r={}.hasOwnProperty;function i(){for(var e="",t=0;t{"use strict";n.d(t,{R:()=>s,x:()=>c});var r=n(4382);const i={},o=r.createContext(i);function s(e){const t=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:s(e.components),r.createElement(o.Provider,{value:t},e.children)}},6807:(e,t,n)=>{"use strict";n.d(t,{D:()=>c,x:()=>l});var r=n(4076),i=n(6206),o=n(4382),s=n(2424);const c=o.forwardRef(((e,t)=>{const{children:n}=e,s=(0,r._)(e,["children"]),c=o.Children.toArray(n),l=c.find(d);if(l){const e=l.props.children,n=c.map((t=>t===l?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,i.jsx)(a,Object.assign({},s,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,i.jsx)(a,Object.assign({},s,{ref:t,children:n}))}));c.displayName="Slot";const a=o.forwardRef(((e,t)=>{const{children:n}=e,i=(0,r._)(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,i=r&&"isReactWarning"in r&&r.isReactWarning;return i?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,i=r&&"isReactWarning"in r&&r.isReactWarning,i?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...e)=>{o(...e),i(...e)}:i&&(n[r]=i):"style"===r?n[r]=Object.assign(Object.assign({},i),o):"className"===r&&(n[r]=[i,o].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(i,n.props)),{ref:t?(0,s.P)(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));a.displayName="SlotClone";const l=({children:e})=>(0,i.jsx)(i.Fragment,{children:e});function d(e){return o.isValidElement(e)&&e.type===l}},2424:(e,t,n)=>{"use strict";n.d(t,{P:()=>i});var r=n(9340);const i=(...e)=>t=>e.forEach((e=>{if((0,r.Tn)(e))e(t);else if(null!=e){e.current=t}}))},7284:(e,t,n)=>{"use strict";n.d(t,{V:()=>r});const r=n(4382).forwardRef},9340:(e,t,n)=>{"use strict";function r(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{a(r.next(e))}catch(t){o(t)}}function c(e){try{a(r.throw(e))}catch(t){o(t)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,c)}a((r=r.apply(e,t||[])).next())}))}n.d(t,{Et:()=>v,Fr:()=>c,Gp:()=>g,Ol:()=>S,Qd:()=>w,S$:()=>s,Tn:()=>j,Zp:()=>p,dK:()=>l,fl:()=>A,gD:()=>y,i5:()=>f,if:()=>h,l6:()=>C,lQ:()=>R,nS:()=>u,ni:()=>k,oc:()=>a}),"function"==typeof SuppressedError&&SuppressedError;const i={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};const o=(e,t)=>new Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function s(){return"undefined"==typeof window}function c(){if(s())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}function a(){return!s()}function l(e){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const d=e=>r(void 0,void 0,void 0,(function*(){const t=yield fetch(e);return l(yield t.text())}));function u(e,t){var n;return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator))return d(e);if(!("write"in window.navigator.clipboard))return d(e);if(null!==(n=null==t?void 0:t.toText)&&void 0!==n&&n)return d(e);const s=yield function(e,t="png"){return new Promise(((n,s)=>{const c=new Image;c.onload=()=>r(this,void 0,void 0,(function*(){const e=document.createElement("canvas");e.width=c.width,e.height=c.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(c,0,0);const s=yield o(e,i[t]);n(s)}catch(r){console.error(`Failed to load image. message: ${r.mesaage}`),s(r)}})),c.onerror=()=>{s(new Error("Failed to load image"))},c.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[s.type]:s})]),s}catch(s){throw console.error(`Failed to copy to clipboard. message: ${s.message}`),s}}))}function p(){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function h(){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function f(e,t){return Object.prototype.hasOwnProperty.call(e,t)}const m=(e,t,n)=>{const r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(let o=0;o{if(e===t)return!0;if(v(e)&&v(t)&&isNaN(e)&&isNaN(t))return!0;if(j(e)&&j(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],i=[...t];return m(r,i,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,i]of e)if(!t.has(r)||!x(i,t.get(r),n))return!1;return!0}return m(e,t,n)};function g(e,t){return x(e,t,new WeakMap)}function j(e){return"function"==typeof e}function y(e){return null==e}function v(e){return"number"==typeof e}function b(e){return!function(e){return Object(e)!==e}(e)}function w(e){return b(e)&&"[object Object]"===Object.prototype.toString.call(e)}function C(e){return e===window}function R(){}function S(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}function O(e){return Object.keys(e)}const E={days:864e5,hours:36e5,minutes:6e4,seconds:1e3};O(E);function A(e,t){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}function k(e,t,n){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],i=j(n)?n():n;r.setItem(t,JSON.stringify(i))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}}}]);
\ No newline at end of file
diff --git a/assets/js/9358.cf0d0d27.js.LICENSE.txt b/assets/js/8053496e.1a9e1459.js.LICENSE.txt
similarity index 100%
rename from assets/js/9358.cf0d0d27.js.LICENSE.txt
rename to assets/js/8053496e.1a9e1459.js.LICENSE.txt
diff --git a/assets/js/8053496e.52db90d6.js b/assets/js/8053496e.52db90d6.js
deleted file mode 100644
index 3d3622487..000000000
--- a/assets/js/8053496e.52db90d6.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[8313],{6970:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>u,assets:()=>a,contentTitle:()=>l,default:()=>f,frontMatter:()=>c,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"react/components/AspectRatio","title":"AspectRatio","description":"\uc8fc\uc5b4\uc9c4 aspect-ratio \ube44\uc728\uc744 \ub9de\ucdb0\uc8fc\uae30 \uc704\ud574 \uc120\uc5b8\uc801\uc73c\ub85c \uc0ac\uc6a9\ud558\ub294 \uc720\ud2f8 \ucef4\ud3ec\ub10c\ud2b8\uc785\ub2c8\ub2e4.","source":"@site/docs/react/components/AspectRatio.mdx","sourceDirName":"react/components","slug":"/react/components/AspectRatio","permalink":"/modern-kit/docs/react/components/AspectRatio","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"Introduce","permalink":"/modern-kit/docs/introduce/"},"next":{"title":"ClientGate","permalink":"/modern-kit/docs/react/components/ClientGate"}}');var o=n(6206),i=n(3267),s=(n(4382),n(4027));const c={},l="AspectRatio",a={},u=()=>{const e={br:"br",div:"div",h3:"h3",img:"img",...(0,i.R)()},t="https://github.com/user-attachments/assets/dd60ec12-afd7-44c9-bd6b-0069e16bf2c9";return(0,o.jsxs)(e.div,{style:{width:"500px"},children:[(0,o.jsx)(e.h3,{children:"Default"}),(0,o.jsx)(s.gl,{ratio:427/640,children:(0,o.jsx)(e.img,{src:t})}),(0,o.jsx)(e.br,{}),(0,o.jsx)(e.h3,{children:"as article"}),(0,o.jsx)(s.gl,{as:"article",ratio:427/640,children:(0,o.jsx)(e.img,{src:t})}),(0,o.jsx)(e.br,{}),(0,o.jsx)(e.h3,{children:"asChild"}),(0,o.jsx)(s.gl,{asChild:!0,ratio:427/640,children:(0,o.jsx)(e.img,{src:t,style:{width:"100%"}})})]})},d=[{value:"\ub2e4\ud615\uc131(polymorphism)",id:"\ub2e4\ud615\uc131polymorphism",level:3},{value:"\ud569\uc131(Composition), \ub80c\ub354\ub9c1 \uc704\uc784(Rendering Delegation)",id:"\ud569\uc131composition-\ub80c\ub354\ub9c1-\uc704\uc784rendering-delegation",level:3},{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Default",id:"default",level:3},{value:"as",id:"as",level:3},{value:"asChild",id:"aschild",level:3},{value:"Example",id:"example",level:2}];function h(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"aspectratio",children:"AspectRatio"})}),"\n",(0,o.jsxs)(t.p,{children:["\uc8fc\uc5b4\uc9c4 ",(0,o.jsx)(t.strong,{children:(0,o.jsx)(t.a,{href:"https://developer.mozilla.org/en-US/docs/Web/CSS/aspect-ratio",children:"aspect-ratio"})})," \ube44\uc728\uc744 \ub9de\ucdb0\uc8fc\uae30 \uc704\ud574 \uc120\uc5b8\uc801\uc73c\ub85c \uc0ac\uc6a9\ud558\ub294 \uc720\ud2f8 \ucef4\ud3ec\ub10c\ud2b8\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:["\ubbf8\ub9ac \uc601\uc5ed\uc744 \ud655\ubcf4\ud558\uc5ec ",(0,o.jsx)(t.code,{children:"Layout Shift"}),"\ub97c \ubc29\uc9c0\ud558\ub294\ub370 \ud6a8\uacfc\uc801\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h3,{id:"\ub2e4\ud615\uc131polymorphism",children:"\ub2e4\ud615\uc131(polymorphism)"}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"AspectRatio"})," \ucef4\ud3ec\ub10c\ud2b8\ub294 \ub2e4\ud615\uc131\uc744 \uc704\ud574 ",(0,o.jsx)(t.code,{children:"as"})," \uc18d\uc131\uc744 \uc9c0\uc6d0\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsxs)(t.li,{children:["\uae30\ubcf8\uc801\uc73c\ub85c ",(0,o.jsx)(t.code,{children:"div"})," \ud0dc\uadf8\ub85c \uc790\uc2dd \uc694\uc18c\ub97c \uac10\uc2f8\uc11c \ub80c\ub354\ub9c1\ud558\uba70, ",(0,o.jsx)(t.code,{children:"as"})," \uc18d\uc131\uc744 \ud1b5\ud574 \uac10\uc2f8\ub294 ",(0,o.jsx)(t.code,{children:"Wrapper"})," \uc694\uc18c\uc758 \ud0dc\uadf8\ub97c \ubcc0\uacbd\ud574 \ub80c\ub354\ub9c1\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. (ex. div -> article)"]}),"\n",(0,o.jsxs)(t.li,{children:["\uc774\ub54c, \ud574\ub2f9 ",(0,o.jsx)(t.code,{children:"Wrapper"})," \uc694\uc18c\uc5d0 ",(0,o.jsx)(t.code,{children:"aspect-ratio"})," \uc18d\uc131\uc744 \uc801\uc6a9\ud574 \uc601\uc5ed\uc744 \ud655\ubcf4\ud569\ub2c8\ub2e4."]}),"\n"]}),"\n",(0,o.jsx)(t.h3,{id:"\ud569\uc131composition-\ub80c\ub354\ub9c1-\uc704\uc784rendering-delegation",children:"\ud569\uc131(Composition), \ub80c\ub354\ub9c1 \uc704\uc784(Rendering Delegation)"}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"AspectRatio"})," \ucef4\ud3ec\ub10c\ud2b8\ub294 ",(0,o.jsx)(t.code,{children:"asChild"})," \uc18d\uc131\uc744 \ud1b5\ud574 ",(0,o.jsx)(t.code,{children:"\ud569\uc131(Composition)"}),", ",(0,o.jsx)(t.code,{children:"\ub80c\ub354\ub9c1 \uc704\uc784(Rendering Delegation)"})," \ud328\ud134\uc744 \uc9c0\uc6d0\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.code,{children:"asChild"})," \uc18d\uc131\uc774 ",(0,o.jsx)(t.code,{children:"true"}),"\ub77c\uba74 ",(0,o.jsx)(t.strong,{children:(0,o.jsx)(t.a,{href:"https://modern-agile-team.github.io/modern-kit/docs/react/components/Slot",children:"Slot"})})," \uc744 \ud1b5\ud574 \uc790\uc2dd \uc694\uc18c\ub97c \ub80c\ub354\ub9c1\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.li,{children:["\uc774\ub54c, \uc790\uc2dd \uc694\uc18c\uc5d0 ",(0,o.jsx)(t.code,{children:"aspect-ratio"})," \uc18d\uc131\uc744 \uc801\uc6a9\ud574 \uc601\uc5ed\uc744 \ud655\ubcf4\ud569\ub2c8\ub2e4.","\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsxs)(t.li,{children:["Slot\uc740 \uc790\uc2dd\uc73c\ub85c ",(0,o.jsx)(t.code,{children:"\ub2e8\uc77c \uc694\uc18c"}),"\ub9cc \ud5c8\uc6a9\ub429\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.li,{children:["Slot\uc740 \uc790\uc2dd\uc73c\ub85c \ucef4\ud3ec\ub10c\ud2b8\uac00 \uc62c \uacbd\uc6b0 ",(0,o.jsx)(t.code,{children:"forwardRef"}),", ",(0,o.jsx)(t.code,{children:"props"}),"\ub97c \ud5c8\uc6a9\ud574\uc57c \ud569\ub2c8\ub2e4. \ud5c8\uc6a9\ud558\uc9c0 \uc54a\uc73c\uba74 \uc815\uc0c1\uc801\uc73c\ub85c \ub3d9\uc791\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.code,{children:"asChild"})," \uc18d\uc131\uc744 \uc0ac\uc6a9 \ud560 \uacbd\uc6b0 ",(0,o.jsx)(t.strong,{children:(0,o.jsx)(t.a,{href:"https://modern-agile-team.github.io/modern-kit/docs/react/components/Slot",children:"Slot"})})," \ubb38\uc11c\ub97c \ucc38\uace0\ud574\uc8fc\uc138\uc694."]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/components/AspectRatio/index.tsx",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"interface AspectRatioProps {\n children: JSX.Element;\n ratio: number;\n asChild?: boolean;\n style?: CSSProperties;\n className?: string;\n}\n"})}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:'const AspectRatio: PolyForwardComponent<"div", AspectRatioProps, React.ElementType>\n'})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.h3,{id:"default",children:"Default"}),"\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsxs)(t.li,{children:["\uae30\ubcf8\uc801\uc73c\ub85c ",(0,o.jsx)(t.code,{children:"div"})," \uc694\uc18c\uc5d0 \uac10\uc2f8\uc9c0\uba70 \ud574\ub2f9 ",(0,o.jsx)(t.code,{children:"div"}),"\uc5d0 ",(0,o.jsx)(t.code,{children:"aspect-ratio"})," \uc18d\uc131\uc744 \uc801\uc6a9\ud574 \uc601\uc5ed\uc744 \ud655\ubcf4\ud569\ub2c8\ub2e4."]}),"\n"]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { AspectRatio } from '@modern-kit/react'\n\nconst Example = () => {\n const imgUrl = 'https://github.com/user-attachments/assets/dd60ec12-afd7-44c9-bd6b-0069e16bf2c9';\n\n return (\n \n
\n \n \n
\n );\n};\n"})}),"\n",(0,o.jsx)(t.h3,{id:"as",children:"as"}),"\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.code,{children:"as"})," \uc18d\uc131\uc744 \ud1b5\ud574 \uac10\uc2f8\ub294 \uc694\uc18c\ub97c ",(0,o.jsx)(t.code,{children:"div"}),"\uac00 \uc544\ub2cc \ud2b9\uc815 \uc694\uc18c\ub85c \ubcc0\uacbd\ud574 \ub80c\ub354\ub9c1\ud560 \uc218 \uc788\uc73c\uba70, \ud574\ub2f9 \uc694\uc18c\uc5d0 ",(0,o.jsx)(t.code,{children:"aspect-ratio"})," \uc18d\uc131\uc744 \uc801\uc6a9\ud574 \uc601\uc5ed\uc744 \ud655\ubcf4\ud569\ub2c8\ub2e4."]}),"\n"]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { AspectRatio } from '@modern-kit/react'\n\nconst Example = () => {\n const imgUrl = 'https://github.com/user-attachments/assets/dd60ec12-afd7-44c9-bd6b-0069e16bf2c9';\n\n return (\n \n
\n \n \n
\n );\n};\n"})}),"\n",(0,o.jsx)(t.h3,{id:"aschild",children:"asChild"}),"\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.code,{children:"asChild"})," \uc18d\uc131\uc774 ",(0,o.jsx)(t.code,{children:"true"}),"\ub77c\uba74 ",(0,o.jsx)(t.strong,{children:(0,o.jsx)(t.a,{href:"https://modern-agile-team.github.io/modern-kit/docs/react/components/Slot",children:"Slot"})})," \uc744 \ud1b5\ud574 \uc790\uc2dd \uc694\uc18c\ub97c \uadf8\ub300\ub85c \ub80c\ub354\ub9c1\ud558\uace0, \uc790\uc2dd \uc694\uc18c\uc5d0 ",(0,o.jsx)(t.code,{children:"aspect-ratio"})," \uc18d\uc131\uc744 \uc801\uc6a9\ud574 \uc601\uc5ed\uc744 \ud655\ubcf4\ud569\ub2c8\ub2e4."]}),"\n"]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { AspectRatio } from '@modern-kit/react'\n\nconst Example = () => {\n const imgUrl = 'https://github.com/user-attachments/assets/dd60ec12-afd7-44c9-bd6b-0069e16bf2c9';\n\n return (\n \n
\n \n \n
\n );\n};\n"})}),"\n","\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,o.jsx)(u,{})]})}function f(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(h,{...e})}):h(e)}},4027:(e,t,n)=>{n.d(t,{$$:()=>Me,$I:()=>oe,AE:()=>Ve,BL:()=>J,DX:()=>I,FT:()=>ct,Fo:()=>et,Hn:()=>it,I5:()=>Ee,JF:()=>$e,K:()=>ae,K$:()=>Ue,M0:()=>Ne,ML:()=>ne,Mj:()=>ve,Mk:()=>Le,Mo:()=>ie,NT:()=>De,QV:()=>Ke,Ub:()=>je,Ut:()=>ke,W7:()=>K,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>ze,Zu:()=>le,_1:()=>Oe,_g:()=>nt,aL:()=>U,aY:()=>Ie,bB:()=>Y,d7:()=>B,eG:()=>st,fN:()=>ce,fm:()=>q,gl:()=>M,hN:()=>W,iD:()=>de,iQ:()=>Fe,jd:()=>se,lW:()=>at,oD:()=>H,oo:()=>Re,pL:()=>Q,qi:()=>ue,rN:()=>Ae,tD:()=>Ce,u8:()=>G,wY:()=>Be,xV:()=>F,xh:()=>tt,zy:()=>Z});var r=n(6206),o=n(4382),i=n(3683),s=n(5086),c=n(7197),l=(n(1604),n(5938));function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function m(){return typeof window>"u"}function g(){return!m()}function w(e){return h(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const b=e=>h(void 0,0,void 0,(function*(){return w(yield(yield fetch(e)).text())}));function x(e,t){var n;return h(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return b(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>h(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const i=yield p(e,f[t]);n(i)}catch(i){console.error(`Failed to load image. message: ${i.mesaage}`),r(i)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const v=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i=0;i{if(e===t||S(e)&&S(t)&&isNaN(e)&&isNaN(t))return!0;if(C(e)&&C(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return v(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!y(o,t.get(r),n))return!1;return!0}return v(e,t,n)};function j(e,t){return y(e,t,new WeakMap)}function C(e){return"function"==typeof e}function S(e){return"number"==typeof e}function k(e){return!function(e){return Object(e)!==e}(e)}function E(){}function R(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const O=(...e)=>t=>e.forEach((e=>{if(C(e))e(t);else if(null!=e){e.current=t}}));function N(...e){return(0,o.useCallback)(O(...e),e)}const I=o.forwardRef(((e,t)=>{const{children:n}=e,i=a(e,["children"]),s=o.Children.toArray(n),c=s.find(L);if(c){const e=c.props.children,n=s.map((t=>t===c?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(A,Object.assign({},i,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(A,Object.assign({},i,{ref:t,children:n}))}));I.displayName="Slot";const A=o.forwardRef(((e,t)=>{const{children:n}=e,r=a(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),i):"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?O(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));A.displayName="SlotClone";const F=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function L(e){return o.isValidElement(e)&&e.type===F}var P="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const M=d(((e,t)=>{var{ratio:n,style:o,as:s="div",asChild:c=!1}=e,l=a(e,["ratio","style","as","asChild"]);const u=c?I:s,d=Object.assign({aspectRatio:n},o),h=c?l.className:i(P,l.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:h},l))})),$=()=>E,T=()=>!1,D=()=>!0;function Y({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)($,T,D)?e:t}function X(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const W=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>X()?(0,r.jsx)(r.Fragment,{children:t}):e;function V(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function z(e){const t=V(e);(0,o.useEffect)((()=>()=>t()),[t])}function _(e,t=j){const[n,r]=(0,o.useState)(e),i=V(t);return(0,o.useEffect)((()=>{i(n,e)||r(e)}),[i,n,e]),n}function B(e,t,n){const r=V(e),i=_(n),c=(0,o.useMemo)((()=>(0,s.A)(r,t,i)),[r,t,i]);return z((()=>c.cancel())),c}const U=({children:e,capture:t,wait:n,options:r})=>{const i=o.Children.only(e),s=B(((...e)=>{const n=i?.props;if(n&&C(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(i,{[t]:s})};function J({onIntersectStart:e=E,onIntersectEnd:t=E,enabled:n=!0,calledOnce:r=!1,root:i=null,threshold:s=0,rootMargin:c="0px 0px 0px 0px"}){const l=(0,o.useRef)(0),a=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=V((([n],o)=>{if(!n)return;const i=n.target;n.isIntersecting?(a.current=!0,l.current+=1,e(n)):a.current&&(a.current=!1,l.current+=1,t(n)),r&&l.current>1&&o.unobserve(i)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:s,root:i,rootMargin:c}),u.current.observe(e))}),[n,s,i,c,d])}}const H=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:i,rootMargin:s}=e,c=a(e,["src","threshold","root","rootMargin"]);const{ref:l}=J({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:i,rootMargin:s});return(0,r.jsx)("img",Object.assign({ref:N(t,l)},c))}));H.displayName="LazyImage";const K=(0,o.forwardRef)(((e,t)=>{var{width:n,height:i,fallback:s,className:c,style:l,duration:u="0.2s",onLoad:d}=e,h=a(e,["width","height","fallback","className","style","duration","onLoad"]);const[f,p]=(0,o.useState)(!1),m=!f,g=(0,o.useMemo)((()=>({position:"relative",width:n,height:i})),[n,i]),w=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:m?0:1,transition:`opacity ${u}`},l)),[m,u,l]),b=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),x=c?`lazy-image-wrapper ${c}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:x,style:g,children:[m&&s,(0,r.jsx)(H,Object.assign({ref:t,width:n,height:i,style:w,onLoad:b},h))]})}));K.displayName="FallbackLazyImage";const Z=({condition:e,trueComponent:t,falseComponent:n})=>{const i=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:i?t:n})},G=({onScrollAction:e,children:t,root:n,threshold:o,enabled:i,triggerPosition:s="after",rootMargin:c="150px 0px"})=>{const{ref:l}=J({onIntersectStart:e,root:n,threshold:o,enabled:i,rootMargin:c});return(0,r.jsxs)(r.Fragment,{children:["before"===s&&(0,r.jsx)("div",{ref:l}),t,"after"===s&&(0,r.jsx)("div",{ref:l})]})},Q=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1}=e,c=a(e,["children","as","asChild"]);const l=s?I:i,{ref:u}=J(c);if(s&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(l,Object.assign({ref:O(t,u)},c,{children:n}))})),q=({items:e=[],itemKey:t,renderItem:n})=>{const i=(0,o.useCallback)(((e,n)=>function(e){return k(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},i(e,t))))})},ee=g()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=V(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),i=(0,o.useMemo)((()=>function(){if(m())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,i,(({target:t})=>{if(!r.current)return;const o=r.current,i=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!i&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1,onPointerDown:c,excludeRefs:l=[]}=e,u=a(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(c,{excludeRefs:l}),h=s?I:i;if(s&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(h,Object.assign({ref:O(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const ie=({itemKey:e,items:t=[],separator:n,renderItem:i,separatorInterval:s=1,includeLastSeparator:c=!1})=>{const l=(0,o.useCallback)((e=>e===t.length-1?c:(e+1)%s==0),[c,s,t.length]);return(0,r.jsx)(q,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[i(e,t),l(t)&&n]})})},se=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ce=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function le(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function ae(e=!0){const t=C(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!i.current){i.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{i.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),i=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield w(e);return t(n),!0}catch{return t(null),!1}}))),[]),s=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield x(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return h(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),l=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return h(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:i,copyImage:s,readText:c,readContents:l}}const he="modern-kit-local-storage",fe="modern-kit-session-storage",pe={localStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}},sessionStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}}},me=e=>pe[e],ge=me("localStorage"),we=e=>window.localStorage.getItem(e),be=e=>JSON.stringify(e),xe=e=>(ge.subscribe(e),()=>{ge.unsubscribe(e)});function ve(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=C(n)?n():n,i=(0,o.useSyncExternalStore)(xe,(()=>we(t)),(()=>be(r)));return{state:(0,o.useMemo)((()=>i?R(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=we(t),o=n?R(n):r,i=C(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(i)),ge.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),ge.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const ye=(e,t)=>g()?window.matchMedia(e).matches:t??!1;function je(e,t){const[n,r]=(0,o.useState)(ye(e,t)),i=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",i),n}function Ce(){return je("(prefers-color-scheme: dark)")?"dark":"light"}const Se="color-scheme";function ke({defaultValue:e,key:t=Se,shouldSetBodyClass:n=!1}={}){const r=Ce(),i=C(e)?e():e,{state:s,setState:c}=ve({key:t,initialValue:i??r}),l=(0,o.useCallback)((()=>{c((e=>"dark"===e?"light":"dark"))}),[c]),a=(0,o.useCallback)((()=>{c("dark")}),[c]),u=(0,o.useCallback)((()=>{c("light")}),[c]),d=(0,o.useCallback)((()=>{c(r)}),[c,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(s),()=>{n&&document.body.classList.remove(s)})),[s,n]),{colorScheme:s,preferredColorScheme:r,setToggleMode:l,setDarkMode:a,setLightMode:u,setPreferredMode:d}}function Ee(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),i=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),s=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:i,reset:s}}function Re({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,i]=(0,o.useState)(t),s=r0,l=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),a=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const s=l(e,t);o&&o({prev:r,next:s}),i(s)}),[n,r,l]),u=(0,o.useCallback)((e=>{a("nextStep",!s,e)}),[s,a]),d=(0,o.useCallback)((e=>{a("prevStep",!c,e)}),[c,a]),h=(0,o.useCallback)(((t,n)=>{const o=C(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void i(t);throw new Error("Step not valid")}),[r,e]),f=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),i(t)}),[r,t]);return{currentStep:r,hasNextStep:s,hasPrevStep:c,goToNextStep:u,goToPrevStep:d,setStep:h,resetStep:f}}function Oe(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:i,resetStep:s}=Re({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:i,resetIndex:s}}function Ne(e,t,n={}){const[r,i]=(0,o.useState)(e);return[r,B(i,t,n)]}function Ie(e,t={}){const[n,r]=(0,o.useState)(""),[i,s]=Ne("",e,t);return{value:n,debouncedValue:i,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),s(t)}),[s]),onReset:(0,o.useCallback)((()=>{r(""),s("")}),[s])}}function Ae(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Fe({onFocus:e=E,onBlur:t=E}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=V((t=>{r(!0),e(t)})),c=V((e=>{r(!1),t(e)})),l=(0,o.useCallback)((()=>{i.current&&(i.current.focus(),r(!0))}),[]);return ne(i,"focus",s),ne(i,"blur",c),{ref:i,isFocus:n,setFocus:l}}function Le({onEnter:e=E,onLeave:t=E}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=V((t=>{r(!0),e(t)})),c=V((e=>{r(!1),t(e)}));return ne(i,"mouseenter",s),ne(i,"mouseleave",c),{ref:i,isHovered:n}}const Pe=e=>{var t;return S(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function Me(e,t){const n=(0,o.useRef)(),r=V(e),{delay:i,enabled:s}=Pe(t),c=(0,o.useCallback)((()=>{n.current=window.setInterval(r,i)}),[r,i]),l=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),c()}),[l,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>l()}),[l,c,s,i]),{set:c,reset:a,clear:l}}function $e({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),i=V((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];C(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",i),()=>t.removeEventListener("keydown",i)}),[e,i]),r}const Te={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function De(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)(Te),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:l}=t;let a=null,u=null,d=null,h=null;if(e.current){const t=e.current.getBoundingClientRect();a=i-t.left,u=s-t.top,d=t.left+window.scrollX,h=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:l,elementRelativeX:a,elementRelativeY:u,elementPositionX:d,elementPositionY:h})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const Ye=()=>navigator.onLine,Xe=()=>!0,We=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function Ve({onlineAction:e=E,offlineAction:t=E}={}){const n=V((n=>We(n,e,t)));return(0,o.useSyncExternalStore)(n,Ye,Xe)}function ze(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const _e={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Be(e=E){const[t,n]=(0,o.useState)(_e),r=(0,o.useRef)(null),i=V((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(i);return t.observe(e),()=>{t.unobserve(e)}}),[i]),{ref:r,contentRect:t}}function Ue({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),i=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>i())),[e,r,i]),{ref:t,lock:r,unlock:i}}const Je=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,He=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:i=0,alignY:s="start",alignX:c="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+i+Je(window.innerHeight,r.height,s),left:r.left+window.scrollX+o+Je(window.innerWidth,r.width,c)};const l=e.getBoundingClientRect();return{top:r.top-l.top+e.scrollTop+i+Je(l.height,r.height,s),left:r.left-l.left+e.scrollLeft+o+Je(l.width,r.width,c)}};function Ke(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:i,top:s}=He(r,t,n);r.scrollTo({top:s,left:i,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ze=me("sessionStorage"),Ge=e=>window.sessionStorage.getItem(e),Qe=e=>JSON.stringify(e),qe=e=>(Ze.subscribe(e),()=>{Ze.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=C(n)?n():n,i=(0,o.useSyncExternalStore)(qe,(()=>Ge(t)),(()=>Qe(r)));return{state:(0,o.useMemo)((()=>i?R(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=Ge(t),o=n?R(n):r,i=C(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(i)),Ze.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ze.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:i}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[s,c]=(0,o.useState)(n),l=(0,o.useCallback)((e=>{c((t=>{const n=C(e)?e(t):e;return r&&i&&function(e,t,n){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=C(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,i,n),n}))}),[r,i]),a=(0,o.useCallback)((()=>{r&&i&&function(e,t){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,i),c(null)}),[r,i]);return Object.assign({state:s,setState:l,clearState:a},Re(e))}function nt(e,t,n={}){const r=V(e),i=_(n),s=(0,o.useMemo)((()=>(0,c.A)(r,t,i)),[r,t,i]);return z((()=>s.cancel())),s}const rt=e=>{var t;return S(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=V(e),{delay:i,enabled:s}=rt(t),c=(0,o.useCallback)((()=>{n.current=setTimeout(r,i)}),[r,i]),l=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),c()}),[l,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>l()}),[c,l,i,s]),{set:c,reset:a,clear:l}}function it(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function st(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new l.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function ct({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const lt={width:null,height:null};function at({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>m()?lt:{width:window.innerWidth,height:window.innerHeight})),r=B(n,e),i=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",i),t}function ut(e,t,n){const{delay:r,enabled:i}=rt(t),{set:s,reset:c,clear:l}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!i||c()}),[r,i,c,...n]),{set:s,reset:c,clear:l}}}}]);
\ No newline at end of file
diff --git a/assets/js/8079f804.405bc534.js b/assets/js/8079f804.405bc534.js
deleted file mode 100644
index 3e84368d3..000000000
--- a/assets/js/8079f804.405bc534.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[7581],{7706:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>u,assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>c,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"react/hooks/useCounter","title":"useCounter","description":"\uce74\uc6b4\ud130\ub97c \uad00\ub9ac\ud558\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc73c\ub85c, \uc99d\uac00, \uac10\uc18c \ubc0f \ub9ac\uc14b \uae30\ub2a5 \ub4f1\uc744 \uc81c\uacf5\ud569\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useCounter.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useCounter","permalink":"/modern-kit/docs/react/hooks/useCounter","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useColorScheme","permalink":"/modern-kit/docs/react/hooks/useColorScheme"},"next":{"title":"useCycleList","permalink":"/modern-kit/docs/react/hooks/useCycleList"}}');var o=n(6206),i=n(3267),s=(n(4382),n(4027));const c={},a="useCounter",l={},u=()=>{const e={button:"button",div:"div",p:"p",...(0,i.R)()},{counter:t,setCounter:n,increment:r,decrement:c,reset:a}=(0,s.I5)(10);return(0,o.jsxs)(e.div,{children:[(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.button,{onClick:r,children:"\uc99d\uac00"}),(0,o.jsx)(e.button,{onClick:c,children:"\uac10\uc18c"}),(0,o.jsx)(e.button,{onClick:()=>n(20),children:"20\uc73c\ub85c \uc14b\ud305"}),(0,o.jsx)(e.button,{onClick:a,children:"\ucd08\uae30\ud654"})]}),(0,o.jsxs)(e.p,{children:["counter: ",t]})]})},d=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function f(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"usecounter",children:"useCounter"})}),"\n",(0,o.jsxs)(t.p,{children:["\uce74\uc6b4\ud130\ub97c \uad00\ub9ac\ud558\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc73c\ub85c, ",(0,o.jsx)(t.code,{children:"\uc99d\uac00"}),", ",(0,o.jsx)(t.code,{children:"\uac10\uc18c"})," \ubc0f ",(0,o.jsx)(t.code,{children:"\ub9ac\uc14b"})," \uae30\ub2a5 \ub4f1\uc744 \uc81c\uacf5\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useCounter/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"function useCounter(initialValue: number = 0): {\n counter: number;\n setCounter: React.Dispatch>;\n increment: () => void;\n decrement: () => void;\n reset: () => void;\n}\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useCounter } from '@modern-kit/react';\n\nconst Example = () => {\n const { counter, setCounter, increment, decrement, reset } = useCounter(10);\n\n return (\n \n
\n \n \n \n \n
\n
counter: {counter}
\n
\n );\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(u,{})]})}function h(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(f,{...e})}):f(e)}},4027:(e,t,n)=>{n.d(t,{$$:()=>Pe,$I:()=>oe,AE:()=>We,BL:()=>H,DX:()=>F,FT:()=>ct,Fo:()=>et,Hn:()=>it,I5:()=>je,JF:()=>Te,K:()=>le,K$:()=>Je,M0:()=>Ie,ML:()=>ne,Mj:()=>ye,Mk:()=>Me,Mo:()=>ie,NT:()=>Ve,QV:()=>Ue,Ub:()=>Ce,Ut:()=>Ee,W7:()=>U,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>_e,Zu:()=>ae,_1:()=>Oe,_g:()=>nt,aL:()=>J,aY:()=>Fe,bB:()=>X,d7:()=>B,eG:()=>st,fN:()=>ce,fm:()=>G,gl:()=>P,hN:()=>D,iD:()=>de,iQ:()=>Ne,jd:()=>se,lW:()=>lt,oD:()=>K,oo:()=>Re,pL:()=>q,qi:()=>ue,rN:()=>Le,tD:()=>ke,u8:()=>Q,wY:()=>Be,xV:()=>N,xh:()=>tt,zy:()=>Z});var r=n(6206),o=n(4382),i=n(3683),s=n(5086),c=n(7197),a=(n(1604),n(5938));function l(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function m(){return typeof window>"u"}function g(){return!m()}function w(e){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const b=e=>f(void 0,0,void 0,(function*(){return w(yield(yield fetch(e)).text())}));function v(e,t){var n;return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return b(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const i=yield p(e,h[t]);n(i)}catch(i){console.error(`Failed to load image. message: ${i.mesaage}`),r(i)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i=0;i{if(e===t||S(e)&&S(t)&&isNaN(e)&&isNaN(t))return!0;if(k(e)&&k(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return y(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!x(o,t.get(r),n))return!1;return!0}return y(e,t,n)};function C(e,t){return x(e,t,new WeakMap)}function k(e){return"function"==typeof e}function S(e){return"number"==typeof e}function E(e){return!function(e){return Object(e)!==e}(e)}function j(){}function R(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const O=(...e)=>t=>e.forEach((e=>{if(k(e))e(t);else if(null!=e){e.current=t}}));function I(...e){return(0,o.useCallback)(O(...e),e)}const F=o.forwardRef(((e,t)=>{const{children:n}=e,i=l(e,["children"]),s=o.Children.toArray(n),c=s.find(M);if(c){const e=c.props.children,n=s.map((t=>t===c?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(L,Object.assign({},i,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(L,Object.assign({},i,{ref:t,children:n}))}));F.displayName="Slot";const L=o.forwardRef(((e,t)=>{const{children:n}=e,r=l(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),i):"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?O(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));L.displayName="SlotClone";const N=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function M(e){return o.isValidElement(e)&&e.type===N}var $="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const P=d(((e,t)=>{var{ratio:n,style:o,as:s="div",asChild:c=!1}=e,a=l(e,["ratio","style","as","asChild"]);const u=c?F:s,d=Object.assign({aspectRatio:n},o),f=c?a.className:i($,a.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},a))})),T=()=>j,Y=()=>!1,V=()=>!0;function X({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)(T,Y,V)?e:t}function A(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const D=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>A()?(0,r.jsx)(r.Fragment,{children:t}):e;function W(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function _(e){const t=W(e);(0,o.useEffect)((()=>()=>t()),[t])}function z(e,t=C){const[n,r]=(0,o.useState)(e),i=W(t);return(0,o.useEffect)((()=>{i(n,e)||r(e)}),[i,n,e]),n}function B(e,t,n){const r=W(e),i=z(n),c=(0,o.useMemo)((()=>(0,s.A)(r,t,i)),[r,t,i]);return _((()=>c.cancel())),c}const J=({children:e,capture:t,wait:n,options:r})=>{const i=o.Children.only(e),s=B(((...e)=>{const n=i?.props;if(n&&k(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(i,{[t]:s})};function H({onIntersectStart:e=j,onIntersectEnd:t=j,enabled:n=!0,calledOnce:r=!1,root:i=null,threshold:s=0,rootMargin:c="0px 0px 0px 0px"}){const a=(0,o.useRef)(0),l=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=W((([n],o)=>{if(!n)return;const i=n.target;n.isIntersecting?(l.current=!0,a.current+=1,e(n)):l.current&&(l.current=!1,a.current+=1,t(n)),r&&a.current>1&&o.unobserve(i)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:s,root:i,rootMargin:c}),u.current.observe(e))}),[n,s,i,c,d])}}const K=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:i,rootMargin:s}=e,c=l(e,["src","threshold","root","rootMargin"]);const{ref:a}=H({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:i,rootMargin:s});return(0,r.jsx)("img",Object.assign({ref:I(t,a)},c))}));K.displayName="LazyImage";const U=(0,o.forwardRef)(((e,t)=>{var{width:n,height:i,fallback:s,className:c,style:a,duration:u="0.2s",onLoad:d}=e,f=l(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,p]=(0,o.useState)(!1),m=!h,g=(0,o.useMemo)((()=>({position:"relative",width:n,height:i})),[n,i]),w=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:m?0:1,transition:`opacity ${u}`},a)),[m,u,a]),b=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),v=c?`lazy-image-wrapper ${c}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:v,style:g,children:[m&&s,(0,r.jsx)(K,Object.assign({ref:t,width:n,height:i,style:w,onLoad:b},f))]})}));U.displayName="FallbackLazyImage";const Z=({condition:e,trueComponent:t,falseComponent:n})=>{const i=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:i?t:n})},Q=({onScrollAction:e,children:t,root:n,threshold:o,enabled:i,triggerPosition:s="after",rootMargin:c="150px 0px"})=>{const{ref:a}=H({onIntersectStart:e,root:n,threshold:o,enabled:i,rootMargin:c});return(0,r.jsxs)(r.Fragment,{children:["before"===s&&(0,r.jsx)("div",{ref:a}),t,"after"===s&&(0,r.jsx)("div",{ref:a})]})},q=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1}=e,c=l(e,["children","as","asChild"]);const a=s?F:i,{ref:u}=H(c);if(s&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(a,Object.assign({ref:O(t,u)},c,{children:n}))})),G=({items:e=[],itemKey:t,renderItem:n})=>{const i=(0,o.useCallback)(((e,n)=>function(e){return E(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},i(e,t))))})},ee=g()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=W(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),i=(0,o.useMemo)((()=>function(){if(m())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,i,(({target:t})=>{if(!r.current)return;const o=r.current,i=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!i&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1,onPointerDown:c,excludeRefs:a=[]}=e,u=l(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(c,{excludeRefs:a}),f=s?F:i;if(s&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:O(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const ie=({itemKey:e,items:t=[],separator:n,renderItem:i,separatorInterval:s=1,includeLastSeparator:c=!1})=>{const a=(0,o.useCallback)((e=>e===t.length-1?c:(e+1)%s==0),[c,s,t.length]);return(0,r.jsx)(G,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[i(e,t),a(t)&&n]})})},se=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ce=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function ae(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function le(e=!0){const t=k(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!i.current){i.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{i.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),i=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield w(e);return t(n),!0}catch{return t(null),!1}}))),[]),s=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield v(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),a=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:i,copyImage:s,readText:c,readContents:a}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",pe={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},me=e=>pe[e],ge=me("localStorage"),we=e=>window.localStorage.getItem(e),be=e=>JSON.stringify(e),ve=e=>(ge.subscribe(e),()=>{ge.unsubscribe(e)});function ye(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=k(n)?n():n,i=(0,o.useSyncExternalStore)(ve,(()=>we(t)),(()=>be(r)));return{state:(0,o.useMemo)((()=>i?R(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=we(t),o=n?R(n):r,i=k(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(i)),ge.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),ge.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const xe=(e,t)=>g()?window.matchMedia(e).matches:t??!1;function Ce(e,t){const[n,r]=(0,o.useState)(xe(e,t)),i=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",i),n}function ke(){return Ce("(prefers-color-scheme: dark)")?"dark":"light"}const Se="color-scheme";function Ee({defaultValue:e,key:t=Se,shouldSetBodyClass:n=!1}={}){const r=ke(),i=k(e)?e():e,{state:s,setState:c}=ye({key:t,initialValue:i??r}),a=(0,o.useCallback)((()=>{c((e=>"dark"===e?"light":"dark"))}),[c]),l=(0,o.useCallback)((()=>{c("dark")}),[c]),u=(0,o.useCallback)((()=>{c("light")}),[c]),d=(0,o.useCallback)((()=>{c(r)}),[c,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(s),()=>{n&&document.body.classList.remove(s)})),[s,n]),{colorScheme:s,preferredColorScheme:r,setToggleMode:a,setDarkMode:l,setLightMode:u,setPreferredMode:d}}function je(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),i=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),s=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:i,reset:s}}function Re({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,i]=(0,o.useState)(t),s=r0,a=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),l=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const s=a(e,t);o&&o({prev:r,next:s}),i(s)}),[n,r,a]),u=(0,o.useCallback)((e=>{l("nextStep",!s,e)}),[s,l]),d=(0,o.useCallback)((e=>{l("prevStep",!c,e)}),[c,l]),f=(0,o.useCallback)(((t,n)=>{const o=k(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void i(t);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),i(t)}),[r,t]);return{currentStep:r,hasNextStep:s,hasPrevStep:c,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Oe(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:i,resetStep:s}=Re({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:i,resetIndex:s}}function Ie(e,t,n={}){const[r,i]=(0,o.useState)(e);return[r,B(i,t,n)]}function Fe(e,t={}){const[n,r]=(0,o.useState)(""),[i,s]=Ie("",e,t);return{value:n,debouncedValue:i,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),s(t)}),[s]),onReset:(0,o.useCallback)((()=>{r(""),s("")}),[s])}}function Le(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Ne({onFocus:e=j,onBlur:t=j}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=W((t=>{r(!0),e(t)})),c=W((e=>{r(!1),t(e)})),a=(0,o.useCallback)((()=>{i.current&&(i.current.focus(),r(!0))}),[]);return ne(i,"focus",s),ne(i,"blur",c),{ref:i,isFocus:n,setFocus:a}}function Me({onEnter:e=j,onLeave:t=j}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=W((t=>{r(!0),e(t)})),c=W((e=>{r(!1),t(e)}));return ne(i,"mouseenter",s),ne(i,"mouseleave",c),{ref:i,isHovered:n}}const $e=e=>{var t;return S(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function Pe(e,t){const n=(0,o.useRef)(),r=W(e),{delay:i,enabled:s}=$e(t),c=(0,o.useCallback)((()=>{n.current=window.setInterval(r,i)}),[r,i]),a=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{a(),c()}),[a,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>a()}),[a,c,s,i]),{set:c,reset:l,clear:a}}function Te({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),i=W((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];k(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",i),()=>t.removeEventListener("keydown",i)}),[e,i]),r}const Ye={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function Ve(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)(Ye),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:a}=t;let l=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();l=i-t.left,u=s-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:a,elementRelativeX:l,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const Xe=()=>navigator.onLine,Ae=()=>!0,De=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function We({onlineAction:e=j,offlineAction:t=j}={}){const n=W((n=>De(n,e,t)));return(0,o.useSyncExternalStore)(n,Xe,Ae)}function _e(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const ze={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Be(e=j){const[t,n]=(0,o.useState)(ze),r=(0,o.useRef)(null),i=W((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(i);return t.observe(e),()=>{t.unobserve(e)}}),[i]),{ref:r,contentRect:t}}function Je({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),i=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>i())),[e,r,i]),{ref:t,lock:r,unlock:i}}const He=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,Ke=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:i=0,alignY:s="start",alignX:c="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+i+He(window.innerHeight,r.height,s),left:r.left+window.scrollX+o+He(window.innerWidth,r.width,c)};const a=e.getBoundingClientRect();return{top:r.top-a.top+e.scrollTop+i+He(a.height,r.height,s),left:r.left-a.left+e.scrollLeft+o+He(a.width,r.width,c)}};function Ue(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:i,top:s}=Ke(r,t,n);r.scrollTo({top:s,left:i,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ze=me("sessionStorage"),Qe=e=>window.sessionStorage.getItem(e),qe=e=>JSON.stringify(e),Ge=e=>(Ze.subscribe(e),()=>{Ze.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=k(n)?n():n,i=(0,o.useSyncExternalStore)(Ge,(()=>Qe(t)),(()=>qe(r)));return{state:(0,o.useMemo)((()=>i?R(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=Qe(t),o=n?R(n):r,i=k(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(i)),Ze.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ze.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:i}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[s,c]=(0,o.useState)(n),a=(0,o.useCallback)((e=>{c((t=>{const n=k(e)?e(t):e;return r&&i&&function(e,t,n){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=k(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,i,n),n}))}),[r,i]),l=(0,o.useCallback)((()=>{r&&i&&function(e,t){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,i),c(null)}),[r,i]);return Object.assign({state:s,setState:a,clearState:l},Re(e))}function nt(e,t,n={}){const r=W(e),i=z(n),s=(0,o.useMemo)((()=>(0,c.A)(r,t,i)),[r,t,i]);return _((()=>s.cancel())),s}const rt=e=>{var t;return S(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=W(e),{delay:i,enabled:s}=rt(t),c=(0,o.useCallback)((()=>{n.current=setTimeout(r,i)}),[r,i]),a=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{a(),c()}),[a,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>a()}),[c,a,i,s]),{set:c,reset:l,clear:a}}function it(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function st(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new a.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function ct({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const at={width:null,height:null};function lt({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>m()?at:{width:window.innerWidth,height:window.innerHeight})),r=B(n,e),i=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",i),t}function ut(e,t,n){const{delay:r,enabled:i}=rt(t),{set:s,reset:c,clear:a}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!i||c()}),[r,i,c,...n]),{set:s,reset:c,clear:a}}}}]);
\ No newline at end of file
diff --git a/assets/js/8079f804.846a7d09.js b/assets/js/8079f804.846a7d09.js
new file mode 100644
index 000000000..af6017995
--- /dev/null
+++ b/assets/js/8079f804.846a7d09.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[7581],{2395:(e,n,t)=>{t.r(n),t.d(n,{Example:()=>a,assets:()=>d,contentTitle:()=>u,default:()=>m,frontMatter:()=>i,metadata:()=>r,toc:()=>l});const r=JSON.parse('{"id":"react/hooks/useCounter","title":"useCounter","description":"\uce74\uc6b4\ud130\ub97c \uad00\ub9ac\ud558\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc73c\ub85c, \uc99d\uac00, \uac10\uc18c \ubc0f \ub9ac\uc14b \uae30\ub2a5 \ub4f1\uc744 \uc81c\uacf5\ud569\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useCounter.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useCounter","permalink":"/modern-kit/docs/react/hooks/useCounter","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useColorScheme","permalink":"/modern-kit/docs/react/hooks/useColorScheme"},"next":{"title":"useCycleList","permalink":"/modern-kit/docs/react/hooks/useCycleList"}}');var o=t(6206),s=t(3267),c=t(4382);const i={},u="useCounter",d={},a=()=>{const e={button:"button",div:"div",p:"p",...(0,s.R)()},{counter:n,setCounter:t,increment:r,decrement:i,reset:u}=function(e=0){const[n,t]=(0,c.useState)(e),r=(0,c.useCallback)((()=>{t((e=>e+1))}),[]),o=(0,c.useCallback)((()=>{t((e=>e-1))}),[]),s=(0,c.useCallback)((()=>{t(e)}),[e]);return{counter:n,setCounter:t,increment:r,decrement:o,reset:s}}(10);return(0,o.jsxs)(e.div,{children:[(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.button,{onClick:r,children:"\uc99d\uac00"}),(0,o.jsx)(e.button,{onClick:i,children:"\uac10\uc18c"}),(0,o.jsx)(e.button,{onClick:()=>t(20),children:"20\uc73c\ub85c \uc14b\ud305"}),(0,o.jsx)(e.button,{onClick:u,children:"\ucd08\uae30\ud654"})]}),(0,o.jsxs)(e.p,{children:["counter: ",n]})]})},l=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function h(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.header,{children:(0,o.jsx)(n.h1,{id:"usecounter",children:"useCounter"})}),"\n",(0,o.jsxs)(n.p,{children:["\uce74\uc6b4\ud130\ub97c \uad00\ub9ac\ud558\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc73c\ub85c, ",(0,o.jsx)(n.code,{children:"\uc99d\uac00"}),", ",(0,o.jsx)(n.code,{children:"\uac10\uc18c"})," \ubc0f ",(0,o.jsx)(n.code,{children:"\ub9ac\uc14b"})," \uae30\ub2a5 \ub4f1\uc744 \uc81c\uacf5\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(n.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useCounter/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(n.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"function useCounter(initialValue: number = 0): {\n counter: number;\n setCounter: React.Dispatch>;\n increment: () => void;\n decrement: () => void;\n reset: () => void;\n}\n"})}),"\n",(0,o.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useCounter } from '@modern-kit/react';\n\nconst Example = () => {\n const { counter, setCounter, increment, decrement, reset } = useCounter(10);\n\n return (\n \n
\n \n \n \n \n
\n
counter: {counter}
\n
\n );\n};\n"})}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(a,{})]})}function m(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(h,{...e})}):h(e)}},3267:(e,n,t)=>{t.d(n,{R:()=>c,x:()=>i});var r=t(4382);const o={},s=r.createContext(o);function c(e){const n=r.useContext(s);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:c(e.components),r.createElement(s.Provider,{value:n},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/83b4ba0b.337ac227.js b/assets/js/83b4ba0b.337ac227.js
new file mode 100644
index 000000000..138543457
--- /dev/null
+++ b/assets/js/83b4ba0b.337ac227.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[1259],{4556:(e,n,t)=>{t.r(n),t.d(n,{Example:()=>m,assets:()=>f,contentTitle:()=>h,default:()=>x,frontMatter:()=>u,metadata:()=>r,toc:()=>p});const r=JSON.parse('{"id":"react/hooks/useColorScheme","title":"useColorScheme","description":"\uc0ac\uc6a9\uc790\uc758 Color Scheme(\ub2e4\ud06c \ubaa8\ub4dc \ub610\ub294 \ub77c\uc774\ud2b8 \ubaa8\ub4dc)\uc744 \uad00\ub9ac\ud558\uae30 \uc704\ud55c \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useColorScheme.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useColorScheme","permalink":"/modern-kit/docs/react/hooks/useColorScheme","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useClipboard","permalink":"/modern-kit/docs/react/hooks/useClipboard"},"next":{"title":"useCounter","permalink":"/modern-kit/docs/react/hooks/useCounter"}}');var o=t(6206),c=t(3267),i=t(9340),s=t(8211),l=t(3411),d=t(4382);var a=t(9010);const u={},h="useColorScheme",f={},m=()=>{const e={button:"button",div:"div",p:"p",...(0,c.R)()},{colorScheme:n,preferredColorScheme:t,setToggleMode:r,setDarkMode:a,setLightMode:u,setPreferredMode:h}=function({defaultValue:e,key:n="color-scheme",shouldSetBodyClass:t=!1}={}){const r=(0,l.t)(),o=(0,i.Tn)(e)?e():e,{state:c,setState:a}=(0,s.M)({key:n,initialValue:null!=o?o:r}),u=(0,d.useCallback)((()=>{a((e=>"dark"===e?"light":"dark"))}),[a]),h=(0,d.useCallback)((()=>{a("dark")}),[a]),f=(0,d.useCallback)((()=>{a("light")}),[a]),m=(0,d.useCallback)((()=>{a(r)}),[a,r]);return(0,d.useEffect)((()=>(t&&document.body.classList.add(c),()=>{t&&document.body.classList.remove(c)})),[c,t]),{colorScheme:c,preferredColorScheme:r,setToggleMode:u,setDarkMode:h,setLightMode:f,setPreferredMode:m}}({shouldSetBodyClass:!0});return(0,o.jsxs)(e.div,{children:[(0,o.jsxs)(e.p,{children:["colorScheme: ",`${n}`]}),(0,o.jsxs)(e.p,{children:["preferredColorScheme: ",`${t}`]}),(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.button,{onClick:r,children:"\ubaa8\ub4dc \ud1a0\uae00"}),(0,o.jsx)(e.button,{onClick:a,children:"\ub2e4\ud06c \ubaa8\ub4dc \ubcc0\uacbd"}),(0,o.jsx)(e.button,{onClick:u,children:"\ub77c\uc774\ud2b8 \ubaa8\ub4dc \ubcc0\uacbd"}),(0,o.jsx)(e.button,{onClick:h,children:"\uc0ac\uc6a9\uc790 \uc120\ud638 \ubaa8\ub4dc \ubcc0\uacbd"})]})]})},p=[{value:"state",id:"state",level:3},{value:"set",id:"set",level:3},{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function g(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,c.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.header,{children:(0,o.jsx)(n.h1,{id:"usecolorscheme",children:"useColorScheme"})}),"\n",(0,o.jsx)(n.p,{children:"\uc0ac\uc6a9\uc790\uc758 Color Scheme(\ub2e4\ud06c \ubaa8\ub4dc \ub610\ub294 \ub77c\uc774\ud2b8 \ubaa8\ub4dc)\uc744 \uad00\ub9ac\ud558\uae30 \uc704\ud55c \ud6c5\uc785\ub2c8\ub2e4."}),"\n",(0,o.jsx)(n.p,{children:"\ud604\uc7ac Color Scheme\uc744 \uc758\ubbf8\ud558\ub294 \uc0c1\ud0dc\uc640 \ud574\ub2f9 \uc0c1\ud0dc\ub97c \ud578\ub4e4\ub9c1\ud558\uae30 \uc704\ud55c set \ud568\uc218\ub4e4\uc744 \ubc18\ud658\ud569\ub2c8\ub2e4."}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.a,{href:"https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme",children:(0,o.jsx)(n.code,{children:"prefers-color-scheme"})})," \ub294 ",(0,o.jsx)(n.code,{children:"\uc548\ub4dc\ub85c\uc774\ub4dc \ubc84\uc80410 \ubbf8\ub9cc"}),"\uc5d0\uc11c\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uc774\uc288\uac00 \uc788\uc744 \uc218 \uc788\uc73c\uba70, Color Scheme \uad00\ub828 \uc815\ubcf4\ub97c \uc678\ubd80\uc5d0\uc11c \uc804\ub2ec\ubc1b\ub294 \ucf00\uc774\uc2a4\ub3c4 \uc788\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4. (\uc608\ub97c \ub4e4\uc5b4 \uc571\uc5d0\uc11c \uc6f9\ubdf0\ub97c \ub744\uc6b8 \ub54c ",(0,o.jsx)(n.code,{children:"UserAgent"}),"\ub85c \uc804\ub2ec) \uc774\ub7f0 \uacbd\uc6b0 ",(0,o.jsx)(n.code,{children:"defaultValue"}),"\ub97c \ud65c\uc6a9 \ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(n.p,{children:["\uc704\uc640 \uac19\uc740 \ubc29\uc2dd\uc744 \ud1b5\ud574 ",(0,o.jsx)(n.code,{children:"\uc678\ubd80\uc5d0\uc11c \uc81c\uacf5 \ubc1b\ub294 Color Scheme\uc744 \uc720\uc9c0"}),"\ud560 \uc218\ub3c4 \uc788\uace0, \uc6f9\uc5d0\uc11c \ub2e8\ub3c5\uc73c\ub85c \uc0ac\uc6a9 \ud560 \ub54c\uc758 ",(0,o.jsx)(n.code,{children:"\uc790\uccb4\uc801\uc778 Color Scheme \uc815\ucc45"}),"\ub3c4 \uad00\ub9ac \ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsx)(n.h3,{id:"state",children:"state"}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"colorScheme"}),": \ud604\uc7ac \uc801\uc6a9\ub41c \uc0c9\uc0c1 \ud14c\ub9c8(",(0,o.jsx)(n.code,{children:"dark"}),", ",(0,o.jsx)(n.code,{children:"light"}),")\uc785\ub2c8\ub2e4. \ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0\uc5d0 \uc800\uc7a5\ub41c \uac12\uc774 \uc788\ub2e4\uba74 \ud574\ub2f9 \uac12\uc744 \uac00\uc838\uc635\ub2c8\ub2e4.\n\uc2a4\ud1a0\ub9ac\uc9c0\uc5d0 \uc800\uc7a5\ub41c \uac12\uc774 \uc5c6\ub294 \uc0c1\ud669\uc5d0\uc11c ",(0,o.jsx)(n.code,{children:"defaultValue"}),"\uac00 \uc124\uc815\ub418\uc5b4 \uc788\ub2e4\uba74 \uc6b0\uc120\uc801\uc73c\ub85c ",(0,o.jsx)(n.code,{children:"defaultValue"})," \uac12\uc744 \uac16\uc2b5\ub2c8\ub2e4.\n\ub9cc\uc57d, ",(0,o.jsx)(n.code,{children:"defaultValue"}),"\uac00 \uc5c6\ub2e4\uba74 \ub2e4\uc74c\uc73c\ub85c \uc0ac\uc6a9\uc790 \uc120\ud638 \uc0c9\uc0c1(",(0,o.jsx)(n.code,{children:"prefers-color-scheme"}),") \uac12\uc744 \uac00\uc838\uc635\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"preferredColorScheme"}),": \uc0ac\uc6a9\uc790\uc758 \uc120\ud638 \uc0c9\uc0c1 \ud14c\ub9c8\uc785\ub2c8\ub2e4. \uc0ac\uc6a9\uc790 \uc2dc\uc2a4\ud15c \uc124\uc815\uc5d0 \ub530\ub77c \ub2ec\ub77c\uc9d1\ub2c8\ub2e4."]}),"\n"]}),"\n",(0,o.jsx)(n.h3,{id:"set",children:"set"}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"setToggleMode"}),": \ud604\uc7ac \uc0c9\uc0c1 \ud14c\ub9c8\ub97c ",(0,o.jsx)(n.code,{children:"\ub2e4\ud06c \ubaa8\ub4dc"}),"\uc640 ",(0,o.jsx)(n.code,{children:"\ub77c\uc774\ud2b8 \ubaa8\ub4dc"})," \uc0ac\uc774\uc5d0\uc11c \uc804\ud658\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"setDarkMode"}),": \ud604\uc81c \uc0c9\uc0c1 \ud14c\ub9c8\ub97c ",(0,o.jsx)(n.code,{children:"\ub2e4\ud06c \ubaa8\ub4dc"}),"\ub85c \uc124\uc815\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"setLightMode"}),": \ud604\uc7ac \uc0c9\uc0c1 \ud14c\ub9c8\ub97c ",(0,o.jsx)(n.code,{children:"\ub77c\uc774\ud2b8 \ubaa8\ub4dc"}),"\ub85c \uc124\uc815\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"setPreferredMode"})," - \ud604\uc7ac \uc0c9\uc0c1 \ud14c\ub9c8\ub97c \uc0ac\uc6a9\uc790\uc758 \uc120\ud638 \uc0c9\uc0c1(",(0,o.jsx)(n.code,{children:"prefers-color-scheme"}),")\uc73c\ub85c \uc124\uc815\ud569\ub2c8\ub2e4."]}),"\n"]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(n.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useColorScheme/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(n.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"interface UseColorSchemeOptions {\n defaultValue?: (() => ColorScheme) | ColorScheme;\n key?: string; // dafault: COLOR_SCHEME_DEFAULT_KEY: 'color-scheme'\n shouldSetBodyClass?: boolean; // default: false\n}\n\ninterface UseColorSchemeReturnType {\n colorScheme: ColorScheme;\n preferredColorScheme: ColorScheme;\n setToggleMode: () => void;\n setDarkMode: () => void;\n setLightMode: () => void;\n setPreferredMode: () => void;\n}\n"})}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"function useColorScheme({\n defaultValue,\n key,\n shouldSetBodyClass,\n}: UseColorSchemeOptions = {}): UseColorSchemeReturnType;\n"})}),"\n",(0,o.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-tsx",metastring:'title="typescript"',children:"const Example = () => {\n const {\n colorScheme,\n preferredColorScheme,\n setToggleMode,\n setDarkMode,\n setLightMode,\n setPreferredMode,\n } = useColorScheme({\n shouldSetBodyClass: true, // true\ub77c\uba74 body class\uc5d0 colorScheme\uc774 \ucd94\uac00\n });\n\n return (\n \n
colorScheme: {`${colorScheme}`}
\n
preferredColorScheme: {`${preferredColorScheme}`}
\n
\n \n \n \n \n
\n
\n );\n};\n"})}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(a.A,{children:()=>(0,o.jsx)(m,{})})]})}function x(e={}){const{wrapper:n}={...(0,c.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(g,{...e})}):g(e)}},9010:(e,n,t)=>{t.d(n,{A:()=>c});t(4382);var r=t(3555),o=t(6206);function c(e){let{children:n,fallback:t}=e;return(0,r.A)()?(0,o.jsx)(o.Fragment,{children:n?.()}):t??null}},3267:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>s});var r=t(4382);const o={},c=r.createContext(o);function i(e){const n=r.useContext(c);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),r.createElement(c.Provider,{value:n},e.children)}},1351:(e,n,t)=>{t.d(n,{M:()=>s});var r=t(6765),o=t(5907),c=t(9340);t(4382);const i=e=>!!e&&(0,c.i5)(e,"current");function s(e,n,t,c){const s=(0,r.p)(t);(0,o.E)((()=>{const t=i(e)?e.current:e;if(t)return t.addEventListener(n,s,c),()=>{t.removeEventListener(n,s,c)}}),[n,e,c,s])}},5907:(e,n,t)=>{t.d(n,{E:()=>c});var r=t(9340),o=t(4382);const c=(0,r.oc)()?o.useLayoutEffect:o.useEffect},8211:(e,n,t)=>{t.d(n,{M:()=>a});var r=t(9340),o=t(4382);const c="modern-kit-local-storage",i={key:c,subscribe:e=>{window.addEventListener(c,e)},unsubscribe:e=>{window.removeEventListener(c,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(c))}},s=e=>window.localStorage.getItem(e),l=e=>JSON.stringify(e),d=e=>(i.subscribe(e),()=>{i.unsubscribe(e)});function a(e){const{key:n}=e,t="initialValue"in e?e.initialValue:null,c=(0,r.Tn)(t)?t():t,a=(0,o.useSyncExternalStore)(d,(()=>s(n)),(()=>l(c)));return{state:(0,o.useMemo)((()=>a?(0,r.Ol)(a):c),[a,c]),setState:(0,o.useCallback)((e=>{try{const t=s(n),o=t?(0,r.Ol)(t):c,l=(0,r.Tn)(e)?e(o):e;window.localStorage.setItem(n,JSON.stringify(l)),i.dispatchEvent()}catch(t){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${n}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${t}`)}}),[n,c]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(n),i.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${n}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[n])}}},9659:(e,n,t)=>{t.d(n,{U:()=>s});var r=t(9340),o=t(1351),c=t(4382);const i=(e,n)=>(0,r.oc)()?window.matchMedia(e).matches:null!=n&&n;function s(e,n){const[t,r]=(0,c.useState)(i(e,n)),s=(0,c.useCallback)((e=>r(e.matches)),[]);return(0,o.M)(window.matchMedia(e),"change",s),t}},3411:(e,n,t)=>{t.d(n,{t:()=>o});var r=t(9659);t(4382);function o(){return(0,r.U)("(prefers-color-scheme: dark)")?"dark":"light"}},6765:(e,n,t)=>{t.d(n,{p:()=>o});var r=t(4382);function o(e){const n=(0,r.useRef)(e);return n.current=e,(0,r.useCallback)(((...e)=>n.current(...e)),[])}},9340:(e,n,t)=>{function r(e,n,t,r){return new(t||(t=Promise))((function(o,c){function i(e){try{l(r.next(e))}catch(n){c(n)}}function s(e){try{l(r.throw(e))}catch(n){c(n)}}function l(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(i,s)}l((r=r.apply(e,n||[])).next())}))}t.d(n,{Et:()=>b,Fr:()=>s,Gp:()=>x,Ol:()=>k,Qd:()=>C,S$:()=>i,Tn:()=>v,Zp:()=>h,dK:()=>d,fl:()=>$,gD:()=>w,i5:()=>m,if:()=>f,l6:()=>y,lQ:()=>S,nS:()=>u,ni:()=>O,oc:()=>l}),"function"==typeof SuppressedError&&SuppressedError;const o={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};const c=(e,n)=>new Promise(((t,r)=>{e.toBlob((e=>{e?t(e):r(new Error(`Failed to create blob with format ${n}`))}),n)}));function i(){return"undefined"==typeof window}function s(){if(i())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}function l(){return!i()}function d(e){return r(this,void 0,void 0,(function*(){if(!l())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const n=document.createElement("textarea");n.value=e,n.style.opacity="0",document.body.appendChild(n),n.focus(),n.select();try{return document.execCommand("copy"),e}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}finally{document.body.removeChild(n)}}(e)}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}}))}const a=e=>r(void 0,void 0,void 0,(function*(){const n=yield fetch(e);return d(yield n.text())}));function u(e,n){var t;return r(this,void 0,void 0,(function*(){if(!l())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator))return a(e);if(!("write"in window.navigator.clipboard))return a(e);if(null!==(t=null==n?void 0:n.toText)&&void 0!==t&&t)return a(e);const i=yield function(e,n="png"){return new Promise(((t,i)=>{const s=new Image;s.onload=()=>r(this,void 0,void 0,(function*(){const e=document.createElement("canvas");e.width=s.width,e.height=s.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(s,0,0);const i=yield c(e,o[n]);t(i)}catch(r){console.error(`Failed to load image. message: ${r.mesaage}`),i(r)}})),s.onerror=()=>{i(new Error("Failed to load image"))},s.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[i.type]:i})]),i}catch(i){throw console.error(`Failed to copy to clipboard. message: ${i.message}`),i}}))}function h(){return r(this,void 0,void 0,(function*(){if(!l())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function f(){return r(this,void 0,void 0,(function*(){if(!l())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function m(e,n){return Object.prototype.hasOwnProperty.call(e,n)}const p=(e,n,t)=>{const r=Object.keys(e),o=Object.keys(n);if(r.length!==o.length)return!1;for(let c=0;c{if(e===n)return!0;if(b(e)&&b(n)&&isNaN(e)&&isNaN(n))return!0;if(v(e)&&v(n))return e.toString()===n.toString();if("object"!=typeof e||"object"!=typeof n||null===e||null===n)return!1;if(t.has(e)&&t.get(e)===n)return!0;if(t.set(e,n),e.constructor!==n.constructor)return!1;if(e instanceof Set){if(e.size!==n.size)return!1;const r=[...e],o=[...n];return p(r,o,t)}if(e instanceof Map){if(e.size!==n.size)return!1;for(const[r,o]of e)if(!n.has(r)||!g(o,n.get(r),t))return!1;return!0}return p(e,n,t)};function x(e,n){return g(e,n,new WeakMap)}function v(e){return"function"==typeof e}function w(e){return null==e}function b(e){return"number"==typeof e}function j(e){return!function(e){return Object(e)!==e}(e)}function C(e){return j(e)&&"[object Object]"===Object.prototype.toString.call(e)}function y(e){return e===window}function S(){}function k(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(n){throw new Error(`Failed to parse data: ${n}`)}}function E(e){return Object.keys(e)}const M={days:864e5,hours:36e5,minutes:6e4,seconds:1e3};E(M);function $(e,n){if(!l())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(n)}catch(t){throw new Error(`Failed to remove key "${n}" from ${e}: ${t}`)}}function O(e,n,t){if(!l())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=v(t)?t():t;r.setItem(n,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${n}" in ${e}: ${r}`)}}}}]);
\ No newline at end of file
diff --git a/assets/js/83b4ba0b.925129e0.js b/assets/js/83b4ba0b.925129e0.js
deleted file mode 100644
index 1e030e799..000000000
--- a/assets/js/83b4ba0b.925129e0.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[1259],{4464:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>d,assets:()=>u,contentTitle:()=>a,default:()=>p,frontMatter:()=>l,metadata:()=>r,toc:()=>h});const r=JSON.parse('{"id":"react/hooks/useColorScheme","title":"useColorScheme","description":"\uc0ac\uc6a9\uc790\uc758 Color Scheme(\ub2e4\ud06c \ubaa8\ub4dc \ub610\ub294 \ub77c\uc774\ud2b8 \ubaa8\ub4dc)\uc744 \uad00\ub9ac\ud558\uae30 \uc704\ud55c \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useColorScheme.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useColorScheme","permalink":"/modern-kit/docs/react/hooks/useColorScheme","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useClipboard","permalink":"/modern-kit/docs/react/hooks/useClipboard"},"next":{"title":"useCounter","permalink":"/modern-kit/docs/react/hooks/useCounter"}}');var o=n(6206),s=n(3267),c=n(4027),i=n(9010);const l={},a="useColorScheme",u={},d=()=>{const e={button:"button",div:"div",p:"p",...(0,s.R)()},{colorScheme:t,preferredColorScheme:n,setToggleMode:r,setDarkMode:i,setLightMode:l,setPreferredMode:a}=(0,c.Ut)({shouldSetBodyClass:!0});return(0,o.jsxs)(e.div,{children:[(0,o.jsxs)(e.p,{children:["colorScheme: ",`${t}`]}),(0,o.jsxs)(e.p,{children:["preferredColorScheme: ",`${n}`]}),(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.button,{onClick:r,children:"\ubaa8\ub4dc \ud1a0\uae00"}),(0,o.jsx)(e.button,{onClick:i,children:"\ub2e4\ud06c \ubaa8\ub4dc \ubcc0\uacbd"}),(0,o.jsx)(e.button,{onClick:l,children:"\ub77c\uc774\ud2b8 \ubaa8\ub4dc \ubcc0\uacbd"}),(0,o.jsx)(e.button,{onClick:a,children:"\uc0ac\uc6a9\uc790 \uc120\ud638 \ubaa8\ub4dc \ubcc0\uacbd"})]})]})},h=[{value:"state",id:"state",level:3},{value:"set",id:"set",level:3},{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function f(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,s.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"usecolorscheme",children:"useColorScheme"})}),"\n",(0,o.jsx)(t.p,{children:"\uc0ac\uc6a9\uc790\uc758 Color Scheme(\ub2e4\ud06c \ubaa8\ub4dc \ub610\ub294 \ub77c\uc774\ud2b8 \ubaa8\ub4dc)\uc744 \uad00\ub9ac\ud558\uae30 \uc704\ud55c \ud6c5\uc785\ub2c8\ub2e4."}),"\n",(0,o.jsx)(t.p,{children:"\ud604\uc7ac Color Scheme\uc744 \uc758\ubbf8\ud558\ub294 \uc0c1\ud0dc\uc640 \ud574\ub2f9 \uc0c1\ud0dc\ub97c \ud578\ub4e4\ub9c1\ud558\uae30 \uc704\ud55c set \ud568\uc218\ub4e4\uc744 \ubc18\ud658\ud569\ub2c8\ub2e4."}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.a,{href:"https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme",children:(0,o.jsx)(t.code,{children:"prefers-color-scheme"})})," \ub294 ",(0,o.jsx)(t.code,{children:"\uc548\ub4dc\ub85c\uc774\ub4dc \ubc84\uc80410 \ubbf8\ub9cc"}),"\uc5d0\uc11c\ub294 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uc774\uc288\uac00 \uc788\uc744 \uc218 \uc788\uc73c\uba70, Color Scheme \uad00\ub828 \uc815\ubcf4\ub97c \uc678\ubd80\uc5d0\uc11c \uc804\ub2ec\ubc1b\ub294 \ucf00\uc774\uc2a4\ub3c4 \uc788\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4. (\uc608\ub97c \ub4e4\uc5b4 \uc571\uc5d0\uc11c \uc6f9\ubdf0\ub97c \ub744\uc6b8 \ub54c ",(0,o.jsx)(t.code,{children:"UserAgent"}),"\ub85c \uc804\ub2ec) \uc774\ub7f0 \uacbd\uc6b0 ",(0,o.jsx)(t.code,{children:"defaultValue"}),"\ub97c \ud65c\uc6a9 \ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:["\uc704\uc640 \uac19\uc740 \ubc29\uc2dd\uc744 \ud1b5\ud574 ",(0,o.jsx)(t.code,{children:"\uc678\ubd80\uc5d0\uc11c \uc81c\uacf5 \ubc1b\ub294 Color Scheme\uc744 \uc720\uc9c0"}),"\ud560 \uc218\ub3c4 \uc788\uace0, \uc6f9\uc5d0\uc11c \ub2e8\ub3c5\uc73c\ub85c \uc0ac\uc6a9 \ud560 \ub54c\uc758 ",(0,o.jsx)(t.code,{children:"\uc790\uccb4\uc801\uc778 Color Scheme \uc815\ucc45"}),"\ub3c4 \uad00\ub9ac \ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsx)(t.h3,{id:"state",children:"state"}),"\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.code,{children:"colorScheme"}),": \ud604\uc7ac \uc801\uc6a9\ub41c \uc0c9\uc0c1 \ud14c\ub9c8(",(0,o.jsx)(t.code,{children:"dark"}),", ",(0,o.jsx)(t.code,{children:"light"}),")\uc785\ub2c8\ub2e4. \ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0\uc5d0 \uc800\uc7a5\ub41c \uac12\uc774 \uc788\ub2e4\uba74 \ud574\ub2f9 \uac12\uc744 \uac00\uc838\uc635\ub2c8\ub2e4.\n\uc2a4\ud1a0\ub9ac\uc9c0\uc5d0 \uc800\uc7a5\ub41c \uac12\uc774 \uc5c6\ub294 \uc0c1\ud669\uc5d0\uc11c ",(0,o.jsx)(t.code,{children:"defaultValue"}),"\uac00 \uc124\uc815\ub418\uc5b4 \uc788\ub2e4\uba74 \uc6b0\uc120\uc801\uc73c\ub85c ",(0,o.jsx)(t.code,{children:"defaultValue"})," \uac12\uc744 \uac16\uc2b5\ub2c8\ub2e4.\n\ub9cc\uc57d, ",(0,o.jsx)(t.code,{children:"defaultValue"}),"\uac00 \uc5c6\ub2e4\uba74 \ub2e4\uc74c\uc73c\ub85c \uc0ac\uc6a9\uc790 \uc120\ud638 \uc0c9\uc0c1(",(0,o.jsx)(t.code,{children:"prefers-color-scheme"}),") \uac12\uc744 \uac00\uc838\uc635\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.code,{children:"preferredColorScheme"}),": \uc0ac\uc6a9\uc790\uc758 \uc120\ud638 \uc0c9\uc0c1 \ud14c\ub9c8\uc785\ub2c8\ub2e4. \uc0ac\uc6a9\uc790 \uc2dc\uc2a4\ud15c \uc124\uc815\uc5d0 \ub530\ub77c \ub2ec\ub77c\uc9d1\ub2c8\ub2e4."]}),"\n"]}),"\n",(0,o.jsx)(t.h3,{id:"set",children:"set"}),"\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.code,{children:"setToggleMode"}),": \ud604\uc7ac \uc0c9\uc0c1 \ud14c\ub9c8\ub97c ",(0,o.jsx)(t.code,{children:"\ub2e4\ud06c \ubaa8\ub4dc"}),"\uc640 ",(0,o.jsx)(t.code,{children:"\ub77c\uc774\ud2b8 \ubaa8\ub4dc"})," \uc0ac\uc774\uc5d0\uc11c \uc804\ud658\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.code,{children:"setDarkMode"}),": \ud604\uc81c \uc0c9\uc0c1 \ud14c\ub9c8\ub97c ",(0,o.jsx)(t.code,{children:"\ub2e4\ud06c \ubaa8\ub4dc"}),"\ub85c \uc124\uc815\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.code,{children:"setLightMode"}),": \ud604\uc7ac \uc0c9\uc0c1 \ud14c\ub9c8\ub97c ",(0,o.jsx)(t.code,{children:"\ub77c\uc774\ud2b8 \ubaa8\ub4dc"}),"\ub85c \uc124\uc815\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.li,{children:[(0,o.jsx)(t.code,{children:"setPreferredMode"})," - \ud604\uc7ac \uc0c9\uc0c1 \ud14c\ub9c8\ub97c \uc0ac\uc6a9\uc790\uc758 \uc120\ud638 \uc0c9\uc0c1(",(0,o.jsx)(t.code,{children:"prefers-color-scheme"}),")\uc73c\ub85c \uc124\uc815\ud569\ub2c8\ub2e4."]}),"\n"]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useColorScheme/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"interface UseColorSchemeOptions {\n defaultValue?: (() => ColorScheme) | ColorScheme;\n key?: string; // dafault: COLOR_SCHEME_DEFAULT_KEY: 'color-scheme'\n shouldSetBodyClass?: boolean; // default: false\n}\n\ninterface UseColorSchemeReturnType {\n colorScheme: ColorScheme;\n preferredColorScheme: ColorScheme;\n setToggleMode: () => void;\n setDarkMode: () => void;\n setLightMode: () => void;\n setPreferredMode: () => void;\n}\n"})}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"function useColorScheme({\n defaultValue,\n key,\n shouldSetBodyClass,\n}: UseColorSchemeOptions = {}): UseColorSchemeReturnType;\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"const Example = () => {\n const {\n colorScheme,\n preferredColorScheme,\n setToggleMode,\n setDarkMode,\n setLightMode,\n setPreferredMode,\n } = useColorScheme({\n shouldSetBodyClass: true, // true\ub77c\uba74 body class\uc5d0 colorScheme\uc774 \ucd94\uac00\n });\n\n return (\n \n
colorScheme: {`${colorScheme}`}
\n
preferredColorScheme: {`${preferredColorScheme}`}
\n
\n \n \n \n \n
\n
\n );\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(i.A,{children:()=>(0,o.jsx)(d,{})})]})}function p(e={}){const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(f,{...e})}):f(e)}},9010:(e,t,n)=>{n.d(t,{A:()=>s});n(4382);var r=n(3555),o=n(6206);function s(e){let{children:t,fallback:n}=e;return(0,r.A)()?(0,o.jsx)(o.Fragment,{children:t?.()}):n??null}},4027:(e,t,n)=>{n.d(t,{$$:()=>$e,$I:()=>oe,AE:()=>Xe,BL:()=>H,DX:()=>L,FT:()=>it,Fo:()=>et,Hn:()=>st,I5:()=>Ee,JF:()=>Te,K:()=>ae,K$:()=>Ue,M0:()=>Me,ML:()=>ne,Mj:()=>ye,Mk:()=>Ne,Mo:()=>se,NT:()=>De,QV:()=>Ke,Ub:()=>Ce,Ut:()=>ke,W7:()=>K,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>_e,Zu:()=>le,_1:()=>Re,_g:()=>nt,aL:()=>U,aY:()=>Le,bB:()=>Y,d7:()=>z,eG:()=>ct,fN:()=>ie,fm:()=>G,gl:()=>$,hN:()=>B,iD:()=>de,iQ:()=>Ie,jd:()=>ce,lW:()=>at,oD:()=>J,oo:()=>Oe,pL:()=>q,qi:()=>ue,rN:()=>Fe,tD:()=>Se,u8:()=>Q,wY:()=>ze,xV:()=>I,xh:()=>tt,zy:()=>Z});var r=n(6206),o=n(4382),s=n(3683),c=n(5086),i=n(7197),l=(n(1604),n(5938));function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function m(){return typeof window>"u"}function g(){return!m()}function w(e){return h(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const b=e=>h(void 0,0,void 0,(function*(){return w(yield(yield fetch(e)).text())}));function v(e,t){var n;return h(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return b(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>h(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const s=yield p(e,f[t]);n(s)}catch(s){console.error(`Failed to load image. message: ${s.mesaage}`),r(s)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let s=0;s{if(e===t||j(e)&&j(t)&&isNaN(e)&&isNaN(t))return!0;if(S(e)&&S(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return y(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!x(o,t.get(r),n))return!1;return!0}return y(e,t,n)};function C(e,t){return x(e,t,new WeakMap)}function S(e){return"function"==typeof e}function j(e){return"number"==typeof e}function k(e){return!function(e){return Object(e)!==e}(e)}function E(){}function O(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const R=(...e)=>t=>e.forEach((e=>{if(S(e))e(t);else if(null!=e){e.current=t}}));function M(...e){return(0,o.useCallback)(R(...e),e)}const L=o.forwardRef(((e,t)=>{const{children:n}=e,s=a(e,["children"]),c=o.Children.toArray(n),i=c.find(N);if(i){const e=i.props.children,n=c.map((t=>t===i?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(F,Object.assign({},s,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(F,Object.assign({},s,{ref:t,children:n}))}));L.displayName="Slot";const F=o.forwardRef(((e,t)=>{const{children:n}=e,r=a(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...e)=>{s(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),s):"className"===r&&(n[r]=[o,s].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?R(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));F.displayName="SlotClone";const I=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function N(e){return o.isValidElement(e)&&e.type===I}var P="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const $=d(((e,t)=>{var{ratio:n,style:o,as:c="div",asChild:i=!1}=e,l=a(e,["ratio","style","as","asChild"]);const u=i?L:c,d=Object.assign({aspectRatio:n},o),h=i?l.className:s(P,l.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:h},l))})),T=()=>E,V=()=>!1,D=()=>!0;function Y({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)(T,V,D)?e:t}function A(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const B=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>A()?(0,r.jsx)(r.Fragment,{children:t}):e;function X(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function _(e){const t=X(e);(0,o.useEffect)((()=>()=>t()),[t])}function W(e,t=C){const[n,r]=(0,o.useState)(e),s=X(t);return(0,o.useEffect)((()=>{s(n,e)||r(e)}),[s,n,e]),n}function z(e,t,n){const r=X(e),s=W(n),i=(0,o.useMemo)((()=>(0,c.A)(r,t,s)),[r,t,s]);return _((()=>i.cancel())),i}const U=({children:e,capture:t,wait:n,options:r})=>{const s=o.Children.only(e),c=z(((...e)=>{const n=s?.props;if(n&&S(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(s,{[t]:c})};function H({onIntersectStart:e=E,onIntersectEnd:t=E,enabled:n=!0,calledOnce:r=!1,root:s=null,threshold:c=0,rootMargin:i="0px 0px 0px 0px"}){const l=(0,o.useRef)(0),a=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=X((([n],o)=>{if(!n)return;const s=n.target;n.isIntersecting?(a.current=!0,l.current+=1,e(n)):a.current&&(a.current=!1,l.current+=1,t(n)),r&&l.current>1&&o.unobserve(s)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:c,root:s,rootMargin:i}),u.current.observe(e))}),[n,c,s,i,d])}}const J=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:s,rootMargin:c}=e,i=a(e,["src","threshold","root","rootMargin"]);const{ref:l}=H({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:s,rootMargin:c});return(0,r.jsx)("img",Object.assign({ref:M(t,l)},i))}));J.displayName="LazyImage";const K=(0,o.forwardRef)(((e,t)=>{var{width:n,height:s,fallback:c,className:i,style:l,duration:u="0.2s",onLoad:d}=e,h=a(e,["width","height","fallback","className","style","duration","onLoad"]);const[f,p]=(0,o.useState)(!1),m=!f,g=(0,o.useMemo)((()=>({position:"relative",width:n,height:s})),[n,s]),w=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:m?0:1,transition:`opacity ${u}`},l)),[m,u,l]),b=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),v=i?`lazy-image-wrapper ${i}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:v,style:g,children:[m&&c,(0,r.jsx)(J,Object.assign({ref:t,width:n,height:s,style:w,onLoad:b},h))]})}));K.displayName="FallbackLazyImage";const Z=({condition:e,trueComponent:t,falseComponent:n})=>{const s=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:s?t:n})},Q=({onScrollAction:e,children:t,root:n,threshold:o,enabled:s,triggerPosition:c="after",rootMargin:i="150px 0px"})=>{const{ref:l}=H({onIntersectStart:e,root:n,threshold:o,enabled:s,rootMargin:i});return(0,r.jsxs)(r.Fragment,{children:["before"===c&&(0,r.jsx)("div",{ref:l}),t,"after"===c&&(0,r.jsx)("div",{ref:l})]})},q=d(((e,t)=>{var{children:n,as:s="div",asChild:c=!1}=e,i=a(e,["children","as","asChild"]);const l=c?L:s,{ref:u}=H(i);if(c&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(l,Object.assign({ref:R(t,u)},i,{children:n}))})),G=({items:e=[],itemKey:t,renderItem:n})=>{const s=(0,o.useCallback)(((e,n)=>function(e){return k(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},s(e,t))))})},ee=g()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=X(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),s=(0,o.useMemo)((()=>function(){if(m())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,s,(({target:t})=>{if(!r.current)return;const o=r.current,s=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!s&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:s="div",asChild:c=!1,onPointerDown:i,excludeRefs:l=[]}=e,u=a(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(i,{excludeRefs:l}),h=c?L:s;if(c&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(h,Object.assign({ref:R(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const se=({itemKey:e,items:t=[],separator:n,renderItem:s,separatorInterval:c=1,includeLastSeparator:i=!1})=>{const l=(0,o.useCallback)((e=>e===t.length-1?i:(e+1)%c==0),[i,c,t.length]);return(0,r.jsx)(G,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[s(e,t),l(t)&&n]})})},ce=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ie=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function le(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function ae(e=!0){const t=S(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!s.current){s.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{s.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),s=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield w(e);return t(n),!0}catch{return t(null),!1}}))),[]),c=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield v(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),i=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return h(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),l=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return h(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:s,copyImage:c,readText:i,readContents:l}}const he="modern-kit-local-storage",fe="modern-kit-session-storage",pe={localStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}},sessionStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}}},me=e=>pe[e],ge=me("localStorage"),we=e=>window.localStorage.getItem(e),be=e=>JSON.stringify(e),ve=e=>(ge.subscribe(e),()=>{ge.unsubscribe(e)});function ye(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=S(n)?n():n,s=(0,o.useSyncExternalStore)(ve,(()=>we(t)),(()=>be(r)));return{state:(0,o.useMemo)((()=>s?O(s):r),[s,r]),setState:(0,o.useCallback)((e=>{try{const n=we(t),o=n?O(n):r,s=S(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(s)),ge.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),ge.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const xe=(e,t)=>g()?window.matchMedia(e).matches:t??!1;function Ce(e,t){const[n,r]=(0,o.useState)(xe(e,t)),s=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",s),n}function Se(){return Ce("(prefers-color-scheme: dark)")?"dark":"light"}const je="color-scheme";function ke({defaultValue:e,key:t=je,shouldSetBodyClass:n=!1}={}){const r=Se(),s=S(e)?e():e,{state:c,setState:i}=ye({key:t,initialValue:s??r}),l=(0,o.useCallback)((()=>{i((e=>"dark"===e?"light":"dark"))}),[i]),a=(0,o.useCallback)((()=>{i("dark")}),[i]),u=(0,o.useCallback)((()=>{i("light")}),[i]),d=(0,o.useCallback)((()=>{i(r)}),[i,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(c),()=>{n&&document.body.classList.remove(c)})),[c,n]),{colorScheme:c,preferredColorScheme:r,setToggleMode:l,setDarkMode:a,setLightMode:u,setPreferredMode:d}}function Ee(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),s=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),c=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:s,reset:c}}function Oe({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,s]=(0,o.useState)(t),c=r0,l=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),a=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const c=l(e,t);o&&o({prev:r,next:c}),s(c)}),[n,r,l]),u=(0,o.useCallback)((e=>{a("nextStep",!c,e)}),[c,a]),d=(0,o.useCallback)((e=>{a("prevStep",!i,e)}),[i,a]),h=(0,o.useCallback)(((t,n)=>{const o=S(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void s(t);throw new Error("Step not valid")}),[r,e]),f=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),s(t)}),[r,t]);return{currentStep:r,hasNextStep:c,hasPrevStep:i,goToNextStep:u,goToPrevStep:d,setStep:h,resetStep:f}}function Re(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:s,resetStep:c}=Oe({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:s,resetIndex:c}}function Me(e,t,n={}){const[r,s]=(0,o.useState)(e);return[r,z(s,t,n)]}function Le(e,t={}){const[n,r]=(0,o.useState)(""),[s,c]=Me("",e,t);return{value:n,debouncedValue:s,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),c(t)}),[c]),onReset:(0,o.useCallback)((()=>{r(""),c("")}),[c])}}function Fe(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Ie({onFocus:e=E,onBlur:t=E}={}){const[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(null),c=X((t=>{r(!0),e(t)})),i=X((e=>{r(!1),t(e)})),l=(0,o.useCallback)((()=>{s.current&&(s.current.focus(),r(!0))}),[]);return ne(s,"focus",c),ne(s,"blur",i),{ref:s,isFocus:n,setFocus:l}}function Ne({onEnter:e=E,onLeave:t=E}={}){const[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(null),c=X((t=>{r(!0),e(t)})),i=X((e=>{r(!1),t(e)}));return ne(s,"mouseenter",c),ne(s,"mouseleave",i),{ref:s,isHovered:n}}const Pe=e=>{var t;return j(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function $e(e,t){const n=(0,o.useRef)(),r=X(e),{delay:s,enabled:c}=Pe(t),i=(0,o.useCallback)((()=>{n.current=window.setInterval(r,s)}),[r,s]),l=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),i()}),[l,i]);return(0,o.useEffect)((()=>{if(!(s<0)&&c)return i(),()=>l()}),[l,i,c,s]),{set:i,reset:a,clear:l}}function Te({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),s=X((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];S(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",s),()=>t.removeEventListener("keydown",s)}),[e,s]),r}const Ve={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function De(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)(Ve),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:s,clientY:c,pageX:i,pageY:l}=t;let a=null,u=null,d=null,h=null;if(e.current){const t=e.current.getBoundingClientRect();a=s-t.left,u=c-t.top,d=t.left+window.scrollX,h=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:s,clientY:c,pageX:i,pageY:l,elementRelativeX:a,elementRelativeY:u,elementPositionX:d,elementPositionY:h})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const Ye=()=>navigator.onLine,Ae=()=>!0,Be=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function Xe({onlineAction:e=E,offlineAction:t=E}={}){const n=X((n=>Be(n,e,t)));return(0,o.useSyncExternalStore)(n,Ye,Ae)}function _e(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const We={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function ze(e=E){const[t,n]=(0,o.useState)(We),r=(0,o.useRef)(null),s=X((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(s);return t.observe(e),()=>{t.unobserve(e)}}),[s]),{ref:r,contentRect:t}}function Ue({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),s=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>s())),[e,r,s]),{ref:t,lock:r,unlock:s}}const He=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,Je=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:s=0,alignY:c="start",alignX:i="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+s+He(window.innerHeight,r.height,c),left:r.left+window.scrollX+o+He(window.innerWidth,r.width,i)};const l=e.getBoundingClientRect();return{top:r.top-l.top+e.scrollTop+s+He(l.height,r.height,c),left:r.left-l.left+e.scrollLeft+o+He(l.width,r.width,i)}};function Ke(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:s,top:c}=Je(r,t,n);r.scrollTo({top:c,left:s,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ze=me("sessionStorage"),Qe=e=>window.sessionStorage.getItem(e),qe=e=>JSON.stringify(e),Ge=e=>(Ze.subscribe(e),()=>{Ze.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=S(n)?n():n,s=(0,o.useSyncExternalStore)(Ge,(()=>Qe(t)),(()=>qe(r)));return{state:(0,o.useMemo)((()=>s?O(s):r),[s,r]),setState:(0,o.useCallback)((e=>{try{const n=Qe(t),o=n?O(n):r,s=S(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(s)),Ze.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ze.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:s}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[c,i]=(0,o.useState)(n),l=(0,o.useCallback)((e=>{i((t=>{const n=S(e)?e(t):e;return r&&s&&function(e,t,n){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=S(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,s,n),n}))}),[r,s]),a=(0,o.useCallback)((()=>{r&&s&&function(e,t){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,s),i(null)}),[r,s]);return Object.assign({state:c,setState:l,clearState:a},Oe(e))}function nt(e,t,n={}){const r=X(e),s=W(n),c=(0,o.useMemo)((()=>(0,i.A)(r,t,s)),[r,t,s]);return _((()=>c.cancel())),c}const rt=e=>{var t;return j(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=X(e),{delay:s,enabled:c}=rt(t),i=(0,o.useCallback)((()=>{n.current=setTimeout(r,s)}),[r,s]),l=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),i()}),[l,i]);return(0,o.useEffect)((()=>{if(!(s<0)&&c)return i(),()=>l()}),[i,l,s,c]),{set:i,reset:a,clear:l}}function st(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function ct(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new l.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function it({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const lt={width:null,height:null};function at({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>m()?lt:{width:window.innerWidth,height:window.innerHeight})),r=z(n,e),s=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",s),t}function ut(e,t,n){const{delay:r,enabled:s}=rt(t),{set:c,reset:i,clear:l}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!s||i()}),[r,s,i,...n]),{set:c,reset:i,clear:l}}}}]);
\ No newline at end of file
diff --git a/assets/js/8a16b8e9.81b7a2bd.js b/assets/js/8a16b8e9.81b7a2bd.js
deleted file mode 100644
index a611ebf9f..000000000
--- a/assets/js/8a16b8e9.81b7a2bd.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[1503],{4905:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>d,assets:()=>u,contentTitle:()=>a,default:()=>p,frontMatter:()=>l,metadata:()=>r,toc:()=>f});const r=JSON.parse('{"id":"react/hooks/useDocumentTitle","title":"useDocumentTitle","description":"SEO\uc640\ub294 \uad00\uacc4 \uc5c6\uc774 document.title\uc744 \ub3d9\uc801\uc73c\ub85c \ubcc0\uacbd\uc2dc\ucf1c\uc8fc\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useDocumentTitle.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useDocumentTitle","permalink":"/modern-kit/docs/react/hooks/useDocumentTitle","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useDependencyTimeout","permalink":"/modern-kit/docs/react/hooks/useDependencyTimeout"},"next":{"title":"useEventListener","permalink":"/modern-kit/docs/react/hooks/useEventListener"}}');var o=n(6206),i=n(3267),s=n(4027),c=n(4382);const l={},a="useDocumentTitle",u={},d=()=>{const e={button:"button",div:"div",input:"input",...(0,i.R)()},[t,n]=(0,c.useState)("useDocumentTitle"),[r,l]=(0,c.useState)("");return(0,s.rN)(t,{preserveTitleOnUnmount:!1}),(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.input,{type:"text",value:r,onChange:e=>l(e.target.value)}),(0,o.jsx)(e.button,{onClick:()=>{n(r),alert("\ud0c0\uc774\ud2c0\uc774 \ubcc0\uacbd\ub410\uc2b5\ub2c8\ub2e4.")},children:"\ud0c0\uc774\ud2c0 \ubcc0\uacbd"})]})},f=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function h(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"usedocumenttitle",children:"useDocumentTitle"})}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"SEO"}),"\uc640\ub294 \uad00\uacc4 \uc5c6\uc774 ",(0,o.jsx)(t.code,{children:"document.title"}),"\uc744 \ub3d9\uc801\uc73c\ub85c \ubcc0\uacbd\uc2dc\ucf1c\uc8fc\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"preserveTitleOnUnmount"})," \uc635\uc158\uc744 ",(0,o.jsx)(t.code,{children:"true"}),"\ub85c \uc900\ub2e4\uba74 ",(0,o.jsx)(t.code,{children:"unmount"})," \uc2dc\uc5d0 \ubcc0\uacbd \ub41c \ud0c0\uc774\ud2c0\ub85c \uc720\uc9c0\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useDocumentTitle/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"interface UseDocumentTitleOption {\n preserveTitleOnUnmount?: boolean; // default: false\n}\n\nconst useDocumentTitle: (\n title: string,\n { preserveTitleOnUnmount }?: UseDocumentTitleOption\n) => void;\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useState } from 'react';\nimport { useDocumentTitle } from '@modern-kit/react';\n\nconst Example = () => {\n const [title, setTitle] = useState('useDocumentTitle');\n const [inputValue, setInputValue] = useState('');\n\n const handleChangeTitle = () => {\n setTitle(inputValue);\n alert('\ud0c0\uc774\ud2c0\uc774 \ubcc0\uacbd\ub410\uc2b5\ub2c8\ub2e4.');\n };\n\n useDocumentTitle(title, {\n preserveTitleOnUnmount: false, // default: false\n });\n\n return (\n \n setInputValue(e.target.value)}\n />\n \n
\n );\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(d,{})]})}function p(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(h,{...e})}):h(e)}},4027:(e,t,n)=>{n.d(t,{$$:()=>Me,$I:()=>oe,AE:()=>We,BL:()=>J,DX:()=>I,FT:()=>ct,Fo:()=>et,Hn:()=>it,I5:()=>je,JF:()=>$e,K:()=>ae,K$:()=>Ue,M0:()=>Te,ML:()=>ne,Mj:()=>ye,Mk:()=>Ne,Mo:()=>ie,NT:()=>Ve,QV:()=>Ke,Ub:()=>ke,Ut:()=>Ee,W7:()=>K,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>_e,Zu:()=>le,_1:()=>Re,_g:()=>nt,aL:()=>U,aY:()=>Ie,bB:()=>Y,d7:()=>B,eG:()=>st,fN:()=>ce,fm:()=>G,gl:()=>M,hN:()=>A,iD:()=>de,iQ:()=>Le,jd:()=>se,lW:()=>at,oD:()=>H,oo:()=>Oe,pL:()=>q,qi:()=>ue,rN:()=>Fe,tD:()=>Se,u8:()=>Q,wY:()=>Be,xV:()=>L,xh:()=>tt,zy:()=>Z});var r=n(6206),o=n(4382),i=n(3683),s=n(5086),c=n(7197),l=(n(1604),n(5938));function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function m(){return typeof window>"u"}function g(){return!m()}function w(e){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const v=e=>f(void 0,0,void 0,(function*(){return w(yield(yield fetch(e)).text())}));function b(e,t){var n;return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return v(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const i=yield p(e,h[t]);n(i)}catch(i){console.error(`Failed to load image. message: ${i.mesaage}`),r(i)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i=0;i{if(e===t||C(e)&&C(t)&&isNaN(e)&&isNaN(t))return!0;if(S(e)&&S(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return y(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!x(o,t.get(r),n))return!1;return!0}return y(e,t,n)};function k(e,t){return x(e,t,new WeakMap)}function S(e){return"function"==typeof e}function C(e){return"number"==typeof e}function E(e){return!function(e){return Object(e)!==e}(e)}function j(){}function O(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const R=(...e)=>t=>e.forEach((e=>{if(S(e))e(t);else if(null!=e){e.current=t}}));function T(...e){return(0,o.useCallback)(R(...e),e)}const I=o.forwardRef(((e,t)=>{const{children:n}=e,i=a(e,["children"]),s=o.Children.toArray(n),c=s.find(N);if(c){const e=c.props.children,n=s.map((t=>t===c?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(F,Object.assign({},i,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(F,Object.assign({},i,{ref:t,children:n}))}));I.displayName="Slot";const F=o.forwardRef(((e,t)=>{const{children:n}=e,r=a(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),i):"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?R(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));F.displayName="SlotClone";const L=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function N(e){return o.isValidElement(e)&&e.type===L}var D="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const M=d(((e,t)=>{var{ratio:n,style:o,as:s="div",asChild:c=!1}=e,l=a(e,["ratio","style","as","asChild"]);const u=c?I:s,d=Object.assign({aspectRatio:n},o),f=c?l.className:i(D,l.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},l))})),$=()=>j,P=()=>!1,V=()=>!0;function Y({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)($,P,V)?e:t}function X(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const A=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>X()?(0,r.jsx)(r.Fragment,{children:t}):e;function W(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function _(e){const t=W(e);(0,o.useEffect)((()=>()=>t()),[t])}function z(e,t=k){const[n,r]=(0,o.useState)(e),i=W(t);return(0,o.useEffect)((()=>{i(n,e)||r(e)}),[i,n,e]),n}function B(e,t,n){const r=W(e),i=z(n),c=(0,o.useMemo)((()=>(0,s.A)(r,t,i)),[r,t,i]);return _((()=>c.cancel())),c}const U=({children:e,capture:t,wait:n,options:r})=>{const i=o.Children.only(e),s=B(((...e)=>{const n=i?.props;if(n&&S(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(i,{[t]:s})};function J({onIntersectStart:e=j,onIntersectEnd:t=j,enabled:n=!0,calledOnce:r=!1,root:i=null,threshold:s=0,rootMargin:c="0px 0px 0px 0px"}){const l=(0,o.useRef)(0),a=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=W((([n],o)=>{if(!n)return;const i=n.target;n.isIntersecting?(a.current=!0,l.current+=1,e(n)):a.current&&(a.current=!1,l.current+=1,t(n)),r&&l.current>1&&o.unobserve(i)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:s,root:i,rootMargin:c}),u.current.observe(e))}),[n,s,i,c,d])}}const H=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:i,rootMargin:s}=e,c=a(e,["src","threshold","root","rootMargin"]);const{ref:l}=J({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:i,rootMargin:s});return(0,r.jsx)("img",Object.assign({ref:T(t,l)},c))}));H.displayName="LazyImage";const K=(0,o.forwardRef)(((e,t)=>{var{width:n,height:i,fallback:s,className:c,style:l,duration:u="0.2s",onLoad:d}=e,f=a(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,p]=(0,o.useState)(!1),m=!h,g=(0,o.useMemo)((()=>({position:"relative",width:n,height:i})),[n,i]),w=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:m?0:1,transition:`opacity ${u}`},l)),[m,u,l]),v=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),b=c?`lazy-image-wrapper ${c}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:b,style:g,children:[m&&s,(0,r.jsx)(H,Object.assign({ref:t,width:n,height:i,style:w,onLoad:v},f))]})}));K.displayName="FallbackLazyImage";const Z=({condition:e,trueComponent:t,falseComponent:n})=>{const i=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:i?t:n})},Q=({onScrollAction:e,children:t,root:n,threshold:o,enabled:i,triggerPosition:s="after",rootMargin:c="150px 0px"})=>{const{ref:l}=J({onIntersectStart:e,root:n,threshold:o,enabled:i,rootMargin:c});return(0,r.jsxs)(r.Fragment,{children:["before"===s&&(0,r.jsx)("div",{ref:l}),t,"after"===s&&(0,r.jsx)("div",{ref:l})]})},q=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1}=e,c=a(e,["children","as","asChild"]);const l=s?I:i,{ref:u}=J(c);if(s&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(l,Object.assign({ref:R(t,u)},c,{children:n}))})),G=({items:e=[],itemKey:t,renderItem:n})=>{const i=(0,o.useCallback)(((e,n)=>function(e){return E(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},i(e,t))))})},ee=g()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=W(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),i=(0,o.useMemo)((()=>function(){if(m())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,i,(({target:t})=>{if(!r.current)return;const o=r.current,i=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!i&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1,onPointerDown:c,excludeRefs:l=[]}=e,u=a(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(c,{excludeRefs:l}),f=s?I:i;if(s&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:R(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const ie=({itemKey:e,items:t=[],separator:n,renderItem:i,separatorInterval:s=1,includeLastSeparator:c=!1})=>{const l=(0,o.useCallback)((e=>e===t.length-1?c:(e+1)%s==0),[c,s,t.length]);return(0,r.jsx)(G,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[i(e,t),l(t)&&n]})})},se=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ce=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function le(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function ae(e=!0){const t=S(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!i.current){i.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{i.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),i=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield w(e);return t(n),!0}catch{return t(null),!1}}))),[]),s=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield b(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),l=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:i,copyImage:s,readText:c,readContents:l}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",pe={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},me=e=>pe[e],ge=me("localStorage"),we=e=>window.localStorage.getItem(e),ve=e=>JSON.stringify(e),be=e=>(ge.subscribe(e),()=>{ge.unsubscribe(e)});function ye(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=S(n)?n():n,i=(0,o.useSyncExternalStore)(be,(()=>we(t)),(()=>ve(r)));return{state:(0,o.useMemo)((()=>i?O(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=we(t),o=n?O(n):r,i=S(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(i)),ge.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),ge.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const xe=(e,t)=>g()?window.matchMedia(e).matches:t??!1;function ke(e,t){const[n,r]=(0,o.useState)(xe(e,t)),i=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",i),n}function Se(){return ke("(prefers-color-scheme: dark)")?"dark":"light"}const Ce="color-scheme";function Ee({defaultValue:e,key:t=Ce,shouldSetBodyClass:n=!1}={}){const r=Se(),i=S(e)?e():e,{state:s,setState:c}=ye({key:t,initialValue:i??r}),l=(0,o.useCallback)((()=>{c((e=>"dark"===e?"light":"dark"))}),[c]),a=(0,o.useCallback)((()=>{c("dark")}),[c]),u=(0,o.useCallback)((()=>{c("light")}),[c]),d=(0,o.useCallback)((()=>{c(r)}),[c,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(s),()=>{n&&document.body.classList.remove(s)})),[s,n]),{colorScheme:s,preferredColorScheme:r,setToggleMode:l,setDarkMode:a,setLightMode:u,setPreferredMode:d}}function je(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),i=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),s=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:i,reset:s}}function Oe({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,i]=(0,o.useState)(t),s=r0,l=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),a=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const s=l(e,t);o&&o({prev:r,next:s}),i(s)}),[n,r,l]),u=(0,o.useCallback)((e=>{a("nextStep",!s,e)}),[s,a]),d=(0,o.useCallback)((e=>{a("prevStep",!c,e)}),[c,a]),f=(0,o.useCallback)(((t,n)=>{const o=S(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void i(t);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),i(t)}),[r,t]);return{currentStep:r,hasNextStep:s,hasPrevStep:c,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Re(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:i,resetStep:s}=Oe({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:i,resetIndex:s}}function Te(e,t,n={}){const[r,i]=(0,o.useState)(e);return[r,B(i,t,n)]}function Ie(e,t={}){const[n,r]=(0,o.useState)(""),[i,s]=Te("",e,t);return{value:n,debouncedValue:i,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),s(t)}),[s]),onReset:(0,o.useCallback)((()=>{r(""),s("")}),[s])}}function Fe(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Le({onFocus:e=j,onBlur:t=j}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=W((t=>{r(!0),e(t)})),c=W((e=>{r(!1),t(e)})),l=(0,o.useCallback)((()=>{i.current&&(i.current.focus(),r(!0))}),[]);return ne(i,"focus",s),ne(i,"blur",c),{ref:i,isFocus:n,setFocus:l}}function Ne({onEnter:e=j,onLeave:t=j}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=W((t=>{r(!0),e(t)})),c=W((e=>{r(!1),t(e)}));return ne(i,"mouseenter",s),ne(i,"mouseleave",c),{ref:i,isHovered:n}}const De=e=>{var t;return C(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function Me(e,t){const n=(0,o.useRef)(),r=W(e),{delay:i,enabled:s}=De(t),c=(0,o.useCallback)((()=>{n.current=window.setInterval(r,i)}),[r,i]),l=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),c()}),[l,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>l()}),[l,c,s,i]),{set:c,reset:a,clear:l}}function $e({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),i=W((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];S(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",i),()=>t.removeEventListener("keydown",i)}),[e,i]),r}const Pe={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function Ve(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)(Pe),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:l}=t;let a=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();a=i-t.left,u=s-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:l,elementRelativeX:a,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const Ye=()=>navigator.onLine,Xe=()=>!0,Ae=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function We({onlineAction:e=j,offlineAction:t=j}={}){const n=W((n=>Ae(n,e,t)));return(0,o.useSyncExternalStore)(n,Ye,Xe)}function _e(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const ze={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Be(e=j){const[t,n]=(0,o.useState)(ze),r=(0,o.useRef)(null),i=W((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(i);return t.observe(e),()=>{t.unobserve(e)}}),[i]),{ref:r,contentRect:t}}function Ue({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),i=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>i())),[e,r,i]),{ref:t,lock:r,unlock:i}}const Je=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,He=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:i=0,alignY:s="start",alignX:c="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+i+Je(window.innerHeight,r.height,s),left:r.left+window.scrollX+o+Je(window.innerWidth,r.width,c)};const l=e.getBoundingClientRect();return{top:r.top-l.top+e.scrollTop+i+Je(l.height,r.height,s),left:r.left-l.left+e.scrollLeft+o+Je(l.width,r.width,c)}};function Ke(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:i,top:s}=He(r,t,n);r.scrollTo({top:s,left:i,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ze=me("sessionStorage"),Qe=e=>window.sessionStorage.getItem(e),qe=e=>JSON.stringify(e),Ge=e=>(Ze.subscribe(e),()=>{Ze.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=S(n)?n():n,i=(0,o.useSyncExternalStore)(Ge,(()=>Qe(t)),(()=>qe(r)));return{state:(0,o.useMemo)((()=>i?O(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=Qe(t),o=n?O(n):r,i=S(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(i)),Ze.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ze.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:i}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[s,c]=(0,o.useState)(n),l=(0,o.useCallback)((e=>{c((t=>{const n=S(e)?e(t):e;return r&&i&&function(e,t,n){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=S(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,i,n),n}))}),[r,i]),a=(0,o.useCallback)((()=>{r&&i&&function(e,t){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,i),c(null)}),[r,i]);return Object.assign({state:s,setState:l,clearState:a},Oe(e))}function nt(e,t,n={}){const r=W(e),i=z(n),s=(0,o.useMemo)((()=>(0,c.A)(r,t,i)),[r,t,i]);return _((()=>s.cancel())),s}const rt=e=>{var t;return C(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=W(e),{delay:i,enabled:s}=rt(t),c=(0,o.useCallback)((()=>{n.current=setTimeout(r,i)}),[r,i]),l=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),c()}),[l,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>l()}),[c,l,i,s]),{set:c,reset:a,clear:l}}function it(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function st(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new l.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function ct({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const lt={width:null,height:null};function at({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>m()?lt:{width:window.innerWidth,height:window.innerHeight})),r=B(n,e),i=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",i),t}function ut(e,t,n){const{delay:r,enabled:i}=rt(t),{set:s,reset:c,clear:l}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!i||c()}),[r,i,c,...n]),{set:s,reset:c,clear:l}}}}]);
\ No newline at end of file
diff --git a/assets/js/8a16b8e9.b6ef01ce.js b/assets/js/8a16b8e9.b6ef01ce.js
new file mode 100644
index 000000000..f6d3a19ec
--- /dev/null
+++ b/assets/js/8a16b8e9.b6ef01ce.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[1503],{3404:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>d,assets:()=>l,contentTitle:()=>u,default:()=>m,frontMatter:()=>a,metadata:()=>r,toc:()=>f});const r=JSON.parse('{"id":"react/hooks/useDocumentTitle","title":"useDocumentTitle","description":"SEO\uc640\ub294 \uad00\uacc4 \uc5c6\uc774 document.title\uc744 \ub3d9\uc801\uc73c\ub85c \ubcc0\uacbd\uc2dc\ucf1c\uc8fc\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useDocumentTitle.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useDocumentTitle","permalink":"/modern-kit/docs/react/hooks/useDocumentTitle","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useDependencyTimeout","permalink":"/modern-kit/docs/react/hooks/useDependencyTimeout"},"next":{"title":"useEventListener","permalink":"/modern-kit/docs/react/hooks/useEventListener"}}');var o=n(6206),i=n(3267),c=n(5907),s=n(4382);const a={},u="useDocumentTitle",l={},d=()=>{const e={button:"button",div:"div",input:"input",...(0,i.R)()},[t,n]=(0,s.useState)("useDocumentTitle"),[r,a]=(0,s.useState)("");return function(e,{preserveTitleOnUnmount:t=!1}={}){(0,c.E)((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}(t,{preserveTitleOnUnmount:!1}),(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.input,{type:"text",value:r,onChange:e=>a(e.target.value)}),(0,o.jsx)(e.button,{onClick:()=>{n(r),alert("\ud0c0\uc774\ud2c0\uc774 \ubcc0\uacbd\ub410\uc2b5\ub2c8\ub2e4.")},children:"\ud0c0\uc774\ud2c0 \ubcc0\uacbd"})]})},f=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function p(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"usedocumenttitle",children:"useDocumentTitle"})}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"SEO"}),"\uc640\ub294 \uad00\uacc4 \uc5c6\uc774 ",(0,o.jsx)(t.code,{children:"document.title"}),"\uc744 \ub3d9\uc801\uc73c\ub85c \ubcc0\uacbd\uc2dc\ucf1c\uc8fc\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"preserveTitleOnUnmount"})," \uc635\uc158\uc744 ",(0,o.jsx)(t.code,{children:"true"}),"\ub85c \uc900\ub2e4\uba74 ",(0,o.jsx)(t.code,{children:"unmount"})," \uc2dc\uc5d0 \ubcc0\uacbd \ub41c \ud0c0\uc774\ud2c0\ub85c \uc720\uc9c0\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useDocumentTitle/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"interface UseDocumentTitleOption {\n preserveTitleOnUnmount?: boolean; // default: false\n}\n\nconst useDocumentTitle: (\n title: string,\n { preserveTitleOnUnmount }?: UseDocumentTitleOption\n) => void;\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useState } from 'react';\nimport { useDocumentTitle } from '@modern-kit/react';\n\nconst Example = () => {\n const [title, setTitle] = useState('useDocumentTitle');\n const [inputValue, setInputValue] = useState('');\n\n const handleChangeTitle = () => {\n setTitle(inputValue);\n alert('\ud0c0\uc774\ud2c0\uc774 \ubcc0\uacbd\ub410\uc2b5\ub2c8\ub2e4.');\n };\n\n useDocumentTitle(title, {\n preserveTitleOnUnmount: false, // default: false\n });\n\n return (\n \n setInputValue(e.target.value)}\n />\n \n
\n );\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(d,{})]})}function m(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(p,{...e})}):p(e)}},3267:(e,t,n)=>{n.d(t,{R:()=>c,x:()=>s});var r=n(4382);const o={},i=r.createContext(o);function c(e){const t=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function s(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:c(e.components),r.createElement(i.Provider,{value:t},e.children)}},5907:(e,t,n)=>{n.d(t,{E:()=>i});var r=n(9340),o=n(4382);const i=(0,r.oc)()?o.useLayoutEffect:o.useEffect},9340:(e,t,n)=>{function r(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(t){i(t)}}function s(e){try{a(r.throw(e))}catch(t){i(t)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))}n.d(t,{Et:()=>y,Fr:()=>s,Gp:()=>v,Ol:()=>E,Qd:()=>j,S$:()=>c,Tn:()=>w,Zp:()=>f,dK:()=>u,fl:()=>S,gD:()=>x,i5:()=>m,if:()=>p,l6:()=>k,lQ:()=>T,nS:()=>d,ni:()=>D,oc:()=>a}),"function"==typeof SuppressedError&&SuppressedError;const o={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};const i=(e,t)=>new Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function c(){return"undefined"==typeof window}function s(){if(c())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}function a(){return!c()}function u(e){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const l=e=>r(void 0,void 0,void 0,(function*(){const t=yield fetch(e);return u(yield t.text())}));function d(e,t){var n;return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator))return l(e);if(!("write"in window.navigator.clipboard))return l(e);if(null!==(n=null==t?void 0:t.toText)&&void 0!==n&&n)return l(e);const c=yield function(e,t="png"){return new Promise(((n,c)=>{const s=new Image;s.onload=()=>r(this,void 0,void 0,(function*(){const e=document.createElement("canvas");e.width=s.width,e.height=s.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(s,0,0);const c=yield i(e,o[t]);n(c)}catch(r){console.error(`Failed to load image. message: ${r.mesaage}`),c(r)}})),s.onerror=()=>{c(new Error("Failed to load image"))},s.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[c.type]:c})]),c}catch(c){throw console.error(`Failed to copy to clipboard. message: ${c.message}`),c}}))}function f(){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function p(){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function m(e,t){return Object.prototype.hasOwnProperty.call(e,t)}const h=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i=0;i{if(e===t)return!0;if(y(e)&&y(t)&&isNaN(e)&&isNaN(t))return!0;if(w(e)&&w(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return h(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!g(o,t.get(r),n))return!1;return!0}return h(e,t,n)};function v(e,t){return g(e,t,new WeakMap)}function w(e){return"function"==typeof e}function x(e){return null==e}function y(e){return"number"==typeof e}function b(e){return!function(e){return Object(e)!==e}(e)}function j(e){return b(e)&&"[object Object]"===Object.prototype.toString.call(e)}function k(e){return e===window}function T(){}function E(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}function C(e){return Object.keys(e)}const O={days:864e5,hours:36e5,minutes:6e4,seconds:1e3};C(O);function S(e,t){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}function D(e,t,n){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=w(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}}}]);
\ No newline at end of file
diff --git a/assets/js/932ca9ec.70922df5.js b/assets/js/932ca9ec.70922df5.js
new file mode 100644
index 000000000..a06cac446
--- /dev/null
+++ b/assets/js/932ca9ec.70922df5.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[6748],{1368:(e,n,t)=>{t.r(n),t.d(n,{Example:()=>u,assets:()=>d,contentTitle:()=>a,default:()=>p,frontMatter:()=>l,metadata:()=>o,toc:()=>f});const o=JSON.parse('{"id":"react/hooks/useScrollLock","title":"useScrollLock","description":"\ud2b9\uc815 \uc694\uc18c\uc758 \uc2a4\ud06c\ub864\uc744 lock, unlock \ud560 \uc218 \uc788\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useScrollLock.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useScrollLock","permalink":"/modern-kit/docs/react/hooks/useScrollLock","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useResizeObserver","permalink":"/modern-kit/docs/react/hooks/useResizeObserver"},"next":{"title":"useScrollTo","permalink":"/modern-kit/docs/react/hooks/useScrollTo"}}');var r=t(6206),c=t(3267),i=t(4382),s=t(5907);const l={},a="useScrollLock",d={},u=()=>{const e={button:"button",div:"div",...(0,c.R)()},{ref:n,lock:t,unlock:o}=function({autoLock:e=!0}={}){const n=(0,i.useRef)(null),t=(0,i.useRef)(null),o=(0,i.useCallback)((()=>{const e=n.current;t.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),r=(0,i.useCallback)((()=>{t.current&&(n.current.style.overflow=t.current)}),[]);return(0,s.E)((()=>(n.current||(n.current=document.body),e&&o(),()=>r())),[e,o,r]),{ref:n,lock:o,unlock:r}}({autoLock:!0}),l={width:"100%",height:"500px"};return(0,r.jsxs)(e.div,{children:[(0,r.jsx)(e.button,{onClick:t,children:"\uc2a4\ud06c\ub864 \uc7a0\uae08"}),(0,r.jsx)(e.button,{onClick:o,children:"\uc2a4\ud06c\ub864 \uc7a0\uae08 \ud574\uc81c"}),(0,r.jsxs)(e.div,{ref:n,style:{width:"400px",maxHeight:"600px",overflowY:"scroll"},children:[(0,r.jsx)(e.div,{style:{...l,backgroundColor:"red"}}),(0,r.jsx)(e.div,{style:{...l,backgroundColor:"green"}}),(0,r.jsx)(e.div,{style:{...l,backgroundColor:"blue"}})]})]})},f=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"document.body",id:"documentbody",level:3},{value:"Specific element",id:"specific-element",level:3},{value:"Example",id:"example",level:3}];function h(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",p:"p",pre:"pre",...(0,c.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.header,{children:(0,r.jsx)(n.h1,{id:"usescrolllock",children:"useScrollLock"})}),"\n",(0,r.jsxs)(n.p,{children:["\ud2b9\uc815 \uc694\uc18c\uc758 \uc2a4\ud06c\ub864\uc744 ",(0,r.jsx)(n.code,{children:"lock"}),", ",(0,r.jsx)(n.code,{children:"unlock"})," \ud560 \uc218 \uc788\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"Modal"}),"\uacfc \uac19\uc740 \ucef4\ud3ec\ub10c\ud2b8\uac00 \ub80c\ub354\ub9c1 \ub410\uc744 \ub54c, \ubc30\uacbd \uc694\uc18c(",(0,r.jsx)(n.code,{children:"ex. document.body"}),")\uc758 \uc2a4\ud06c\ub864\uc744 \uc7a0\uae00 \ub54c \ud65c\uc6a9\ub420 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,r.jsxs)(n.p,{children:["\uae30\ubcf8\uc801\uc73c\ub85c ",(0,r.jsx)(n.code,{children:"document.body"}),"\uc744 \ub300\uc0c1\uc73c\ub85c mount \uc2dc\uc5d0 \uc790\ub3d9\uc73c\ub85c \uc2a4\ud06c\ub864\uc744 \uc7a0\uae09\ub2c8\ub2e4."]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"unmount"})," \uc2dc\uc5d0\ub294 \ud0c0\uac9f \uc694\uc18c\uc758 \uc6d0\ub798 ",(0,r.jsx)(n.code,{children:"overflow"})," \uac12\uc73c\ub85c \ub2e4\uc2dc \ub3cc\ub824\ub193\uc2b5\ub2c8\ub2e4."]}),"\n",(0,r.jsx)("br",{}),"\n",(0,r.jsx)(n.h2,{id:"code",children:"Code"}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useScrollLock/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,r.jsx)(n.h2,{id:"interface",children:"Interface"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"interface UseScrollLockProps {\n autoLock?: boolean;\n}\n\nconst useScrollLock: ({\n autoLock,\n}?: UseScrollLockProps) => {\n ref: React.MutableRefObject>;\n lock: () => void;\n unlock: () => void;\n};\n"})}),"\n",(0,r.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,r.jsx)(n.h3,{id:"documentbody",children:"document.body"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useScrollLock } from '@modern-kit/react';\n\nconst Example = () => {\n useScrollLock(); // \uc790\ub3d9\uc73c\ub85c \uc7a0\uadf8\uc9c0 \uc54a\uc73c\ub824\uba74 { authLock: false }\ub85c \uc14b\ud305\ud558\uc138\uc694.\n\n return {/* ... */}
;\n};\n"})}),"\n",(0,r.jsx)("br",{}),"\n",(0,r.jsx)(n.h3,{id:"specific-element",children:"Specific element"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useScrollLock } from '@modern-kit/react';\n\nconst Example = () => {\n const { ref, lock, unlock } = useScrollLock({ autoLock: false });\n\n const wrapperStyle = {\n width: '400px',\n maxHeight: '600px',\n overflowY: 'scroll',\n };\n const boxStyle = {\n width: '100%',\n maxHeight: '500px',\n };\n return (\n \n
\n
\n
\n
\n );\n};\n"})}),"\n",(0,r.jsx)(n.h3,{id:"example",children:"Example"}),"\n","\n",(0,r.jsx)(u,{})]})}function p(e={}){const{wrapper:n}={...(0,c.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(h,{...e})}):h(e)}},3267:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>s});var o=t(4382);const r={},c=o.createContext(r);function i(e){const n=o.useContext(c);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),o.createElement(c.Provider,{value:n},e.children)}},5907:(e,n,t)=>{t.d(n,{E:()=>c});var o=t(9340),r=t(4382);const c=(0,o.oc)()?r.useLayoutEffect:r.useEffect},9340:(e,n,t)=>{function o(e,n,t,o){return new(t||(t=Promise))((function(r,c){function i(e){try{l(o.next(e))}catch(n){c(n)}}function s(e){try{l(o.throw(e))}catch(n){c(n)}}function l(e){var n;e.done?r(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(i,s)}l((o=o.apply(e,n||[])).next())}))}t.d(n,{Et:()=>w,Fr:()=>s,Gp:()=>b,Ol:()=>C,Qd:()=>y,S$:()=>i,Tn:()=>g,Zp:()=>f,dK:()=>a,fl:()=>O,gD:()=>v,i5:()=>p,if:()=>h,l6:()=>j,lQ:()=>S,nS:()=>u,ni:()=>$,oc:()=>l}),"function"==typeof SuppressedError&&SuppressedError;const r={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};const c=(e,n)=>new Promise(((t,o)=>{e.toBlob((e=>{e?t(e):o(new Error(`Failed to create blob with format ${n}`))}),n)}));function i(){return"undefined"==typeof window}function s(){if(i())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}function l(){return!i()}function a(e){return o(this,void 0,void 0,(function*(){if(!l())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const n=document.createElement("textarea");n.value=e,n.style.opacity="0",document.body.appendChild(n),n.focus(),n.select();try{return document.execCommand("copy"),e}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}finally{document.body.removeChild(n)}}(e)}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}}))}const d=e=>o(void 0,void 0,void 0,(function*(){const n=yield fetch(e);return a(yield n.text())}));function u(e,n){var t;return o(this,void 0,void 0,(function*(){if(!l())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator))return d(e);if(!("write"in window.navigator.clipboard))return d(e);if(null!==(t=null==n?void 0:n.toText)&&void 0!==t&&t)return d(e);const i=yield function(e,n="png"){return new Promise(((t,i)=>{const s=new Image;s.onload=()=>o(this,void 0,void 0,(function*(){const e=document.createElement("canvas");e.width=s.width,e.height=s.height;try{const o=e.getContext("2d");if(!o)throw new Error("Failed to get 2d context");o.drawImage(s,0,0);const i=yield c(e,r[n]);t(i)}catch(o){console.error(`Failed to load image. message: ${o.mesaage}`),i(o)}})),s.onerror=()=>{i(new Error("Failed to load image"))},s.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[i.type]:i})]),i}catch(i){throw console.error(`Failed to copy to clipboard. message: ${i.message}`),i}}))}function f(){return o(this,void 0,void 0,(function*(){if(!l())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function h(){return o(this,void 0,void 0,(function*(){if(!l())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function p(e,n){return Object.prototype.hasOwnProperty.call(e,n)}const m=(e,n,t)=>{const o=Object.keys(e),r=Object.keys(n);if(o.length!==r.length)return!1;for(let c=0;c{if(e===n)return!0;if(w(e)&&w(n)&&isNaN(e)&&isNaN(n))return!0;if(g(e)&&g(n))return e.toString()===n.toString();if("object"!=typeof e||"object"!=typeof n||null===e||null===n)return!1;if(t.has(e)&&t.get(e)===n)return!0;if(t.set(e,n),e.constructor!==n.constructor)return!1;if(e instanceof Set){if(e.size!==n.size)return!1;const o=[...e],r=[...n];return m(o,r,t)}if(e instanceof Map){if(e.size!==n.size)return!1;for(const[o,r]of e)if(!n.has(o)||!x(r,n.get(o),t))return!1;return!0}return m(e,n,t)};function b(e,n){return x(e,n,new WeakMap)}function g(e){return"function"==typeof e}function v(e){return null==e}function w(e){return"number"==typeof e}function k(e){return!function(e){return Object(e)!==e}(e)}function y(e){return k(e)&&"[object Object]"===Object.prototype.toString.call(e)}function j(e){return e===window}function S(){}function C(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(n){throw new Error(`Failed to parse data: ${n}`)}}function E(e){return Object.keys(e)}const L={days:864e5,hours:36e5,minutes:6e4,seconds:1e3};E(L);function O(e,n){if(!l())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(n)}catch(t){throw new Error(`Failed to remove key "${n}" from ${e}: ${t}`)}}function $(e,n,t){if(!l())throw new Error("Cannot be executed unless it is a client environment.");try{const o=window[e],r=g(t)?t():t;o.setItem(n,JSON.stringify(r))}catch(o){throw new Error(`Failed to store data for key "${n}" in ${e}: ${o}`)}}}}]);
\ No newline at end of file
diff --git a/assets/js/932ca9ec.db37b8df.js b/assets/js/932ca9ec.db37b8df.js
deleted file mode 100644
index be84066d5..000000000
--- a/assets/js/932ca9ec.db37b8df.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[6748],{7499:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>u,assets:()=>a,contentTitle:()=>l,default:()=>h,frontMatter:()=>s,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"react/hooks/useScrollLock","title":"useScrollLock","description":"\ud2b9\uc815 \uc694\uc18c\uc758 \uc2a4\ud06c\ub864\uc744 lock, unlock \ud560 \uc218 \uc788\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useScrollLock.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useScrollLock","permalink":"/modern-kit/docs/react/hooks/useScrollLock","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useResizeObserver","permalink":"/modern-kit/docs/react/hooks/useResizeObserver"},"next":{"title":"useScrollTo","permalink":"/modern-kit/docs/react/hooks/useScrollTo"}}');var o=n(6206),c=n(3267),i=n(4027);const s={},l="useScrollLock",a={},u=()=>{const e={button:"button",div:"div",...(0,c.R)()},{ref:t,lock:n,unlock:r}=(0,i.K$)({autoLock:!0}),s={width:"100%",height:"500px"};return(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.button,{onClick:n,children:"\uc2a4\ud06c\ub864 \uc7a0\uae08"}),(0,o.jsx)(e.button,{onClick:r,children:"\uc2a4\ud06c\ub864 \uc7a0\uae08 \ud574\uc81c"}),(0,o.jsxs)(e.div,{ref:t,style:{width:"400px",maxHeight:"600px",overflowY:"scroll"},children:[(0,o.jsx)(e.div,{style:{...s,backgroundColor:"red"}}),(0,o.jsx)(e.div,{style:{...s,backgroundColor:"green"}}),(0,o.jsx)(e.div,{style:{...s,backgroundColor:"blue"}})]})]})},d=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"document.body",id:"documentbody",level:3},{value:"Specific element",id:"specific-element",level:3},{value:"Example",id:"example",level:3}];function f(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",p:"p",pre:"pre",...(0,c.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"usescrolllock",children:"useScrollLock"})}),"\n",(0,o.jsxs)(t.p,{children:["\ud2b9\uc815 \uc694\uc18c\uc758 \uc2a4\ud06c\ub864\uc744 ",(0,o.jsx)(t.code,{children:"lock"}),", ",(0,o.jsx)(t.code,{children:"unlock"})," \ud560 \uc218 \uc788\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"Modal"}),"\uacfc \uac19\uc740 \ucef4\ud3ec\ub10c\ud2b8\uac00 \ub80c\ub354\ub9c1 \ub410\uc744 \ub54c, \ubc30\uacbd \uc694\uc18c(",(0,o.jsx)(t.code,{children:"ex. document.body"}),")\uc758 \uc2a4\ud06c\ub864\uc744 \uc7a0\uae00 \ub54c \ud65c\uc6a9\ub420 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:["\uae30\ubcf8\uc801\uc73c\ub85c ",(0,o.jsx)(t.code,{children:"document.body"}),"\uc744 \ub300\uc0c1\uc73c\ub85c mount \uc2dc\uc5d0 \uc790\ub3d9\uc73c\ub85c \uc2a4\ud06c\ub864\uc744 \uc7a0\uae09\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.code,{children:"unmount"})," \uc2dc\uc5d0\ub294 \ud0c0\uac9f \uc694\uc18c\uc758 \uc6d0\ub798 ",(0,o.jsx)(t.code,{children:"overflow"})," \uac12\uc73c\ub85c \ub2e4\uc2dc \ub3cc\ub824\ub193\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useScrollLock/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"interface UseScrollLockProps {\n autoLock?: boolean;\n}\n\nconst useScrollLock: ({\n autoLock,\n}?: UseScrollLockProps) => {\n ref: React.MutableRefObject>;\n lock: () => void;\n unlock: () => void;\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.h3,{id:"documentbody",children:"document.body"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useScrollLock } from '@modern-kit/react';\n\nconst Example = () => {\n useScrollLock(); // \uc790\ub3d9\uc73c\ub85c \uc7a0\uadf8\uc9c0 \uc54a\uc73c\ub824\uba74 { authLock: false }\ub85c \uc14b\ud305\ud558\uc138\uc694.\n\n return {/* ... */}
;\n};\n"})}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h3,{id:"specific-element",children:"Specific element"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useScrollLock } from '@modern-kit/react';\n\nconst Example = () => {\n const { ref, lock, unlock } = useScrollLock({ autoLock: false });\n\n const wrapperStyle = {\n width: '400px',\n maxHeight: '600px',\n overflowY: 'scroll',\n };\n const boxStyle = {\n width: '100%',\n maxHeight: '500px',\n };\n return (\n \n
\n
\n
\n
\n );\n};\n"})}),"\n",(0,o.jsx)(t.h3,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(u,{})]})}function h(e={}){const{wrapper:t}={...(0,c.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(f,{...e})}):f(e)}},4027:(e,t,n)=>{n.d(t,{$$:()=>$e,$I:()=>oe,AE:()=>Ae,BL:()=>J,DX:()=>I,FT:()=>st,Fo:()=>et,Hn:()=>ct,I5:()=>Ee,JF:()=>Te,K:()=>ae,K$:()=>He,M0:()=>Oe,ML:()=>ne,Mj:()=>ye,Mk:()=>Me,Mo:()=>ce,NT:()=>Xe,QV:()=>Ke,Ub:()=>xe,Ut:()=>je,W7:()=>K,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>We,Zu:()=>le,_1:()=>Le,_g:()=>nt,aL:()=>H,aY:()=>Ie,bB:()=>D,d7:()=>B,eG:()=>it,fN:()=>se,fm:()=>G,gl:()=>$,hN:()=>z,iD:()=>de,iQ:()=>Fe,jd:()=>ie,lW:()=>at,oD:()=>U,oo:()=>Re,pL:()=>q,qi:()=>ue,rN:()=>Ne,tD:()=>Se,u8:()=>Q,wY:()=>Be,xV:()=>F,xh:()=>tt,zy:()=>Z});var r=n(6206),o=n(4382),c=n(3683),i=n(5086),s=n(7197),l=(n(1604),n(5938));function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function m(){return typeof window>"u"}function g(){return!m()}function b(e){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const w=e=>f(void 0,0,void 0,(function*(){return b(yield(yield fetch(e)).text())}));function v(e,t){var n;return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return w(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const c=yield p(e,h[t]);n(c)}catch(c){console.error(`Failed to load image. message: ${c.mesaage}`),r(c)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let c=0;c{if(e===t||C(e)&&C(t)&&isNaN(e)&&isNaN(t))return!0;if(S(e)&&S(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return y(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!k(o,t.get(r),n))return!1;return!0}return y(e,t,n)};function x(e,t){return k(e,t,new WeakMap)}function S(e){return"function"==typeof e}function C(e){return"number"==typeof e}function j(e){return!function(e){return Object(e)!==e}(e)}function E(){}function R(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const L=(...e)=>t=>e.forEach((e=>{if(S(e))e(t);else if(null!=e){e.current=t}}));function O(...e){return(0,o.useCallback)(L(...e),e)}const I=o.forwardRef(((e,t)=>{const{children:n}=e,c=a(e,["children"]),i=o.Children.toArray(n),s=i.find(M);if(s){const e=s.props.children,n=i.map((t=>t===s?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(N,Object.assign({},c,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(N,Object.assign({},c,{ref:t,children:n}))}));I.displayName="Slot";const N=o.forwardRef(((e,t)=>{const{children:n}=e,r=a(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],c=t[r];/^on[A-Z]/.test(r)?o&&c?n[r]=(...e)=>{c(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),c):"className"===r&&(n[r]=[o,c].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?L(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));N.displayName="SlotClone";const F=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function M(e){return o.isValidElement(e)&&e.type===F}var P="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const $=d(((e,t)=>{var{ratio:n,style:o,as:i="div",asChild:s=!1}=e,l=a(e,["ratio","style","as","asChild"]);const u=s?I:i,d=Object.assign({aspectRatio:n},o),f=s?l.className:c(P,l.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},l))})),T=()=>E,Y=()=>!1,X=()=>!0;function D({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)(T,Y,X)?e:t}function V(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const z=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>V()?(0,r.jsx)(r.Fragment,{children:t}):e;function A(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function W(e){const t=A(e);(0,o.useEffect)((()=>()=>t()),[t])}function _(e,t=x){const[n,r]=(0,o.useState)(e),c=A(t);return(0,o.useEffect)((()=>{c(n,e)||r(e)}),[c,n,e]),n}function B(e,t,n){const r=A(e),c=_(n),s=(0,o.useMemo)((()=>(0,i.A)(r,t,c)),[r,t,c]);return W((()=>s.cancel())),s}const H=({children:e,capture:t,wait:n,options:r})=>{const c=o.Children.only(e),i=B(((...e)=>{const n=c?.props;if(n&&S(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(c,{[t]:i})};function J({onIntersectStart:e=E,onIntersectEnd:t=E,enabled:n=!0,calledOnce:r=!1,root:c=null,threshold:i=0,rootMargin:s="0px 0px 0px 0px"}){const l=(0,o.useRef)(0),a=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=A((([n],o)=>{if(!n)return;const c=n.target;n.isIntersecting?(a.current=!0,l.current+=1,e(n)):a.current&&(a.current=!1,l.current+=1,t(n)),r&&l.current>1&&o.unobserve(c)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:i,root:c,rootMargin:s}),u.current.observe(e))}),[n,i,c,s,d])}}const U=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:c,rootMargin:i}=e,s=a(e,["src","threshold","root","rootMargin"]);const{ref:l}=J({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:c,rootMargin:i});return(0,r.jsx)("img",Object.assign({ref:O(t,l)},s))}));U.displayName="LazyImage";const K=(0,o.forwardRef)(((e,t)=>{var{width:n,height:c,fallback:i,className:s,style:l,duration:u="0.2s",onLoad:d}=e,f=a(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,p]=(0,o.useState)(!1),m=!h,g=(0,o.useMemo)((()=>({position:"relative",width:n,height:c})),[n,c]),b=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:m?0:1,transition:`opacity ${u}`},l)),[m,u,l]),w=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),v=s?`lazy-image-wrapper ${s}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:v,style:g,children:[m&&i,(0,r.jsx)(U,Object.assign({ref:t,width:n,height:c,style:b,onLoad:w},f))]})}));K.displayName="FallbackLazyImage";const Z=({condition:e,trueComponent:t,falseComponent:n})=>{const c=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:c?t:n})},Q=({onScrollAction:e,children:t,root:n,threshold:o,enabled:c,triggerPosition:i="after",rootMargin:s="150px 0px"})=>{const{ref:l}=J({onIntersectStart:e,root:n,threshold:o,enabled:c,rootMargin:s});return(0,r.jsxs)(r.Fragment,{children:["before"===i&&(0,r.jsx)("div",{ref:l}),t,"after"===i&&(0,r.jsx)("div",{ref:l})]})},q=d(((e,t)=>{var{children:n,as:c="div",asChild:i=!1}=e,s=a(e,["children","as","asChild"]);const l=i?I:c,{ref:u}=J(s);if(i&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(l,Object.assign({ref:L(t,u)},s,{children:n}))})),G=({items:e=[],itemKey:t,renderItem:n})=>{const c=(0,o.useCallback)(((e,n)=>function(e){return j(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},c(e,t))))})},ee=g()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=A(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),c=(0,o.useMemo)((()=>function(){if(m())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,c,(({target:t})=>{if(!r.current)return;const o=r.current,c=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!c&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:c="div",asChild:i=!1,onPointerDown:s,excludeRefs:l=[]}=e,u=a(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(s,{excludeRefs:l}),f=i?I:c;if(i&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:L(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const ce=({itemKey:e,items:t=[],separator:n,renderItem:c,separatorInterval:i=1,includeLastSeparator:s=!1})=>{const l=(0,o.useCallback)((e=>e===t.length-1?s:(e+1)%i==0),[s,i,t.length]);return(0,r.jsx)(G,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[c(e,t),l(t)&&n]})})},ie=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),se=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function le(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function ae(e=!0){const t=S(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),c=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!c.current){c.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{c.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),c=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield b(e);return t(n),!0}catch{return t(null),!1}}))),[]),i=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield v(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),s=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),l=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:c,copyImage:i,readText:s,readContents:l}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",pe={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},me=e=>pe[e],ge=me("localStorage"),be=e=>window.localStorage.getItem(e),we=e=>JSON.stringify(e),ve=e=>(ge.subscribe(e),()=>{ge.unsubscribe(e)});function ye(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=S(n)?n():n,c=(0,o.useSyncExternalStore)(ve,(()=>be(t)),(()=>we(r)));return{state:(0,o.useMemo)((()=>c?R(c):r),[c,r]),setState:(0,o.useCallback)((e=>{try{const n=be(t),o=n?R(n):r,c=S(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(c)),ge.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),ge.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const ke=(e,t)=>g()?window.matchMedia(e).matches:t??!1;function xe(e,t){const[n,r]=(0,o.useState)(ke(e,t)),c=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",c),n}function Se(){return xe("(prefers-color-scheme: dark)")?"dark":"light"}const Ce="color-scheme";function je({defaultValue:e,key:t=Ce,shouldSetBodyClass:n=!1}={}){const r=Se(),c=S(e)?e():e,{state:i,setState:s}=ye({key:t,initialValue:c??r}),l=(0,o.useCallback)((()=>{s((e=>"dark"===e?"light":"dark"))}),[s]),a=(0,o.useCallback)((()=>{s("dark")}),[s]),u=(0,o.useCallback)((()=>{s("light")}),[s]),d=(0,o.useCallback)((()=>{s(r)}),[s,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(i),()=>{n&&document.body.classList.remove(i)})),[i,n]),{colorScheme:i,preferredColorScheme:r,setToggleMode:l,setDarkMode:a,setLightMode:u,setPreferredMode:d}}function Ee(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),c=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),i=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:c,reset:i}}function Re({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,c]=(0,o.useState)(t),i=r0,l=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),a=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const i=l(e,t);o&&o({prev:r,next:i}),c(i)}),[n,r,l]),u=(0,o.useCallback)((e=>{a("nextStep",!i,e)}),[i,a]),d=(0,o.useCallback)((e=>{a("prevStep",!s,e)}),[s,a]),f=(0,o.useCallback)(((t,n)=>{const o=S(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void c(t);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),c(t)}),[r,t]);return{currentStep:r,hasNextStep:i,hasPrevStep:s,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Le(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:c,resetStep:i}=Re({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:c,resetIndex:i}}function Oe(e,t,n={}){const[r,c]=(0,o.useState)(e);return[r,B(c,t,n)]}function Ie(e,t={}){const[n,r]=(0,o.useState)(""),[c,i]=Oe("",e,t);return{value:n,debouncedValue:c,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),i(t)}),[i]),onReset:(0,o.useCallback)((()=>{r(""),i("")}),[i])}}function Ne(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Fe({onFocus:e=E,onBlur:t=E}={}){const[n,r]=(0,o.useState)(!1),c=(0,o.useRef)(null),i=A((t=>{r(!0),e(t)})),s=A((e=>{r(!1),t(e)})),l=(0,o.useCallback)((()=>{c.current&&(c.current.focus(),r(!0))}),[]);return ne(c,"focus",i),ne(c,"blur",s),{ref:c,isFocus:n,setFocus:l}}function Me({onEnter:e=E,onLeave:t=E}={}){const[n,r]=(0,o.useState)(!1),c=(0,o.useRef)(null),i=A((t=>{r(!0),e(t)})),s=A((e=>{r(!1),t(e)}));return ne(c,"mouseenter",i),ne(c,"mouseleave",s),{ref:c,isHovered:n}}const Pe=e=>{var t;return C(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function $e(e,t){const n=(0,o.useRef)(),r=A(e),{delay:c,enabled:i}=Pe(t),s=(0,o.useCallback)((()=>{n.current=window.setInterval(r,c)}),[r,c]),l=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),s()}),[l,s]);return(0,o.useEffect)((()=>{if(!(c<0)&&i)return s(),()=>l()}),[l,s,i,c]),{set:s,reset:a,clear:l}}function Te({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),c=A((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];S(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",c),()=>t.removeEventListener("keydown",c)}),[e,c]),r}const Ye={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function Xe(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)(Ye),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:c,clientY:i,pageX:s,pageY:l}=t;let a=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();a=c-t.left,u=i-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:c,clientY:i,pageX:s,pageY:l,elementRelativeX:a,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const De=()=>navigator.onLine,Ve=()=>!0,ze=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function Ae({onlineAction:e=E,offlineAction:t=E}={}){const n=A((n=>ze(n,e,t)));return(0,o.useSyncExternalStore)(n,De,Ve)}function We(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const _e={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Be(e=E){const[t,n]=(0,o.useState)(_e),r=(0,o.useRef)(null),c=A((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(c);return t.observe(e),()=>{t.unobserve(e)}}),[c]),{ref:r,contentRect:t}}function He({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),c=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>c())),[e,r,c]),{ref:t,lock:r,unlock:c}}const Je=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,Ue=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:c=0,alignY:i="start",alignX:s="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+c+Je(window.innerHeight,r.height,i),left:r.left+window.scrollX+o+Je(window.innerWidth,r.width,s)};const l=e.getBoundingClientRect();return{top:r.top-l.top+e.scrollTop+c+Je(l.height,r.height,i),left:r.left-l.left+e.scrollLeft+o+Je(l.width,r.width,s)}};function Ke(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:c,top:i}=Ue(r,t,n);r.scrollTo({top:i,left:c,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ze=me("sessionStorage"),Qe=e=>window.sessionStorage.getItem(e),qe=e=>JSON.stringify(e),Ge=e=>(Ze.subscribe(e),()=>{Ze.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=S(n)?n():n,c=(0,o.useSyncExternalStore)(Ge,(()=>Qe(t)),(()=>qe(r)));return{state:(0,o.useMemo)((()=>c?R(c):r),[c,r]),setState:(0,o.useCallback)((e=>{try{const n=Qe(t),o=n?R(n):r,c=S(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(c)),Ze.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ze.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:c}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[i,s]=(0,o.useState)(n),l=(0,o.useCallback)((e=>{s((t=>{const n=S(e)?e(t):e;return r&&c&&function(e,t,n){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=S(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,c,n),n}))}),[r,c]),a=(0,o.useCallback)((()=>{r&&c&&function(e,t){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,c),s(null)}),[r,c]);return Object.assign({state:i,setState:l,clearState:a},Re(e))}function nt(e,t,n={}){const r=A(e),c=_(n),i=(0,o.useMemo)((()=>(0,s.A)(r,t,c)),[r,t,c]);return W((()=>i.cancel())),i}const rt=e=>{var t;return C(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=A(e),{delay:c,enabled:i}=rt(t),s=(0,o.useCallback)((()=>{n.current=setTimeout(r,c)}),[r,c]),l=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),s()}),[l,s]);return(0,o.useEffect)((()=>{if(!(c<0)&&i)return s(),()=>l()}),[s,l,c,i]),{set:s,reset:a,clear:l}}function ct(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function it(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new l.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function st({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const lt={width:null,height:null};function at({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>m()?lt:{width:window.innerWidth,height:window.innerHeight})),r=B(n,e),c=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",c),t}function ut(e,t,n){const{delay:r,enabled:c}=rt(t),{set:i,reset:s,clear:l}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!c||s()}),[r,c,s,...n]),{set:i,reset:s,clear:l}}}}]);
\ No newline at end of file
diff --git a/assets/js/9358.cf0d0d27.js b/assets/js/9358.cf0d0d27.js
deleted file mode 100644
index b208113ee..000000000
--- a/assets/js/9358.cf0d0d27.js
+++ /dev/null
@@ -1,2 +0,0 @@
-/*! For license information please see 9358.cf0d0d27.js.LICENSE.txt */
-(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[9358],{5938:function(i,e,o){var t;!function(r,n){"use strict";var a="function",s="undefined",b="object",c="string",l="major",u="model",w="name",d="type",p="vendor",f="version",m="architecture",v="console",h="mobile",g="tablet",x="smarttv",k="wearable",y="embedded",_="Amazon",T="Apple",S="ASUS",A="BlackBerry",O="Browser",j="Chrome",N="Firefox",q="Google",z="Huawei",E="LG",C="Microsoft",P="Motorola",U="Opera",M="Samsung",B="Sharp",R="Sony",D="Xiaomi",V="Zebra",I="Facebook",$="Chromium OS",G="Mac OS",L=" Browser",W=function(i){for(var e={},o=0;o0?2===s.length?typeof s[1]==a?this[s[0]]=s[1].call(this,l):this[s[0]]=s[1]:3===s.length?typeof s[1]!==a||s[1].exec&&s[1].test?this[s[0]]=l?l.replace(s[1],s[2]):n:this[s[0]]=l?s[1].call(this,l,s[2]):n:4===s.length&&(this[s[0]]=l?s[3].call(this,l.replace(s[1],s[2])):n):this[s]=l||n;u+=2}},K=function(i,e){for(var o in e)if(typeof e[o]===b&&e[o].length>0){for(var t=0;t2&&(i[u]="iPad",i[d]=g),i},this.getEngine=function(){var i={};return i[w]=n,i[f]=n,X.call(i,t,x.engine),i},this.getOS=function(){var i={};return i[w]=n,i[f]=n,X.call(i,t,x.os),k&&!i[w]&&v&&v.platform&&"Unknown"!=v.platform&&(i[w]=v.platform.replace(/chrome os/i,$).replace(/macos/i,G)),i},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return t},this.setUA=function(i){return t=typeof i===c&&i.length>500?Z(i,500):i,this},this.setUA(t),this};J.VERSION="1.0.39",J.BROWSER=W([w,f,l]),J.CPU=W([m]),J.DEVICE=W([u,p,d,v,h,x,g,k,y]),J.ENGINE=J.OS=W([w,f]),typeof e!==s?(i.exports&&(e=i.exports=J),e.UAParser=J):o.amdO?(t=function(){return J}.call(e,o,e,i))===n||(i.exports=t):typeof r!==s&&(r.UAParser=J);var ii=typeof r!==s&&(r.jQuery||r.Zepto);if(ii&&!ii.ua){var ei=new J;ii.ua=ei.getResult(),ii.ua.get=function(){return ei.getUA()},ii.ua.set=function(i){ei.setUA(i);var e=ei.getResult();for(var o in e)ii.ua[o]=e[o]}}}("object"==typeof window?window:this)},3683:(i,e)=>{var o;!function(){"use strict";var t={}.hasOwnProperty;function r(){for(var i="",e=0;e{"use strict";o.d(e,{R:()=>a,x:()=>s});var t=o(4382);const r={},n=t.createContext(r);function a(i){const e=t.useContext(n);return t.useMemo((function(){return"function"==typeof i?i(e):{...e,...i}}),[e,i])}function s(i){let e;return e=i.disableParentContext?"function"==typeof i.components?i.components(r):i.components||r:a(i.components),t.createElement(n.Provider,{value:e},i.children)}},5086:(i,e,o)=>{"use strict";o.d(e,{A:()=>z});var t=o(322);const r="object"==typeof global&&global&&global.Object===Object&&global;var n="object"==typeof self&&self&&self.Object===Object&&self;const a=r||n||Function("return this")();const s=function(){return a.Date.now()};var b=/\s/;const c=function(i){for(var e=i.length;e--&&b.test(i.charAt(e)););return e};var l=/^\s+/;const u=function(i){return i?i.slice(0,c(i)+1).replace(l,""):i};const w=a.Symbol;var d=Object.prototype,p=d.hasOwnProperty,f=d.toString,m=w?w.toStringTag:void 0;const v=function(i){var e=p.call(i,m),o=i[m];try{i[m]=void 0;var t=!0}catch(n){}var r=f.call(i);return t&&(e?i[m]=o:delete i[m]),r};var h=Object.prototype.toString;const g=function(i){return h.call(i)};var x=w?w.toStringTag:void 0;const k=function(i){return null==i?void 0===i?"[object Undefined]":"[object Null]":x&&x in Object(i)?v(i):g(i)};const y=function(i){return null!=i&&"object"==typeof i};const _=function(i){return"symbol"==typeof i||y(i)&&"[object Symbol]"==k(i)};var T=/^[-+]0x[0-9a-f]+$/i,S=/^0b[01]+$/i,A=/^0o[0-7]+$/i,O=parseInt;const j=function(i){if("number"==typeof i)return i;if(_(i))return NaN;if((0,t.A)(i)){var e="function"==typeof i.valueOf?i.valueOf():i;i=(0,t.A)(e)?e+"":e}if("string"!=typeof i)return 0===i?i:+i;i=u(i);var o=S.test(i);return o||A.test(i)?O(i.slice(2),o?2:8):T.test(i)?NaN:+i};var N=Math.max,q=Math.min;const z=function(i,e,o){var r,n,a,b,c,l,u=0,w=!1,d=!1,p=!0;if("function"!=typeof i)throw new TypeError("Expected a function");function f(e){var o=r,t=n;return r=n=void 0,u=e,b=i.apply(t,o)}function m(i){var o=i-l;return void 0===l||o>=e||o<0||d&&i-u>=a}function v(){var i=s();if(m(i))return h(i);c=setTimeout(v,function(i){var o=e-(i-l);return d?q(o,a-(i-u)):o}(i))}function h(i){return c=void 0,p&&r?f(i):(r=n=void 0,b)}function g(){var i=s(),o=m(i);if(r=arguments,n=this,l=i,o){if(void 0===c)return function(i){return u=i,c=setTimeout(v,e),w?f(i):b}(l);if(d)return clearTimeout(c),c=setTimeout(v,e),f(l)}return void 0===c&&(c=setTimeout(v,e)),b}return e=j(e)||0,(0,t.A)(o)&&(w=!!o.leading,a=(d="maxWait"in o)?N(j(o.maxWait)||0,e):a,p="trailing"in o?!!o.trailing:p),g.cancel=function(){void 0!==c&&clearTimeout(c),u=0,r=l=n=c=void 0},g.flush=function(){return void 0===c?b:h(s())},g}},322:(i,e,o)=>{"use strict";o.d(e,{A:()=>t});const t=function(i){var e=typeof i;return null!=i&&("object"==e||"function"==e)}},7197:(i,e,o)=>{"use strict";o.d(e,{A:()=>n});var t=o(5086),r=o(322);const n=function(i,e,o){var n=!0,a=!0;if("function"!=typeof i)throw new TypeError("Expected a function");return(0,r.A)(o)&&(n="leading"in o?!!o.leading:n,a="trailing"in o?!!o.trailing:a),(0,t.A)(i,e,{leading:n,maxWait:e,trailing:a})}}}]);
\ No newline at end of file
diff --git a/assets/js/9602.e7bd29f4.js b/assets/js/9602.e7bd29f4.js
new file mode 100644
index 000000000..09e4ccbc0
--- /dev/null
+++ b/assets/js/9602.e7bd29f4.js
@@ -0,0 +1 @@
+(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[9602],{5938:function(i,e,o){var a;!function(r,n){"use strict";var t="function",s="undefined",b="object",w="string",d="major",l="model",c="name",u="type",p="vendor",m="version",h="architecture",f="console",v="mobile",g="tablet",k="smarttv",x="wearable",y="embedded",_="Amazon",T="Apple",S="ASUS",q="BlackBerry",z="Browser",N="Chrome",A="Firefox",C="Google",O="Huawei",E="LG",P="Microsoft",U="Motorola",j="Opera",B="Samsung",M="Sharp",R="Sony",D="Xiaomi",V="Zebra",I="Facebook",G="Chromium OS",L="Mac OS",F=" Browser",H=function(i){for(var e={},o=0;o0?2===s.length?typeof s[1]==t?this[s[0]]=s[1].call(this,d):this[s[0]]=s[1]:3===s.length?typeof s[1]!==t||s[1].exec&&s[1].test?this[s[0]]=d?d.replace(s[1],s[2]):n:this[s[0]]=d?s[1].call(this,d,s[2]):n:4===s.length&&(this[s[0]]=d?s[3].call(this,d.replace(s[1],s[2])):n):this[s]=d||n;l+=2}},K=function(i,e){for(var o in e)if(typeof e[o]===b&&e[o].length>0){for(var a=0;a2&&(i[l]="iPad",i[u]=g),i},this.getEngine=function(){var i={};return i[c]=n,i[m]=n,X.call(i,a,k.engine),i},this.getOS=function(){var i={};return i[c]=n,i[m]=n,X.call(i,a,k.os),x&&!i[c]&&f&&f.platform&&"Unknown"!=f.platform&&(i[c]=f.platform.replace(/chrome os/i,G).replace(/macos/i,L)),i},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return a},this.setUA=function(i){return a=typeof i===w&&i.length>500?W(i,500):i,this},this.setUA(a),this};J.VERSION="1.0.39",J.BROWSER=H([c,m,d]),J.CPU=H([h]),J.DEVICE=H([l,p,u,f,v,k,g,x,y]),J.ENGINE=J.OS=H([c,m]),typeof e!==s?(i.exports&&(e=i.exports=J),e.UAParser=J):o.amdO?(a=function(){return J}.call(e,o,e,i))===n||(i.exports=a):typeof r!==s&&(r.UAParser=J);var ii=typeof r!==s&&(r.jQuery||r.Zepto);if(ii&&!ii.ua){var ei=new J;ii.ua=ei.getResult(),ii.ua.get=function(){return ei.getUA()},ii.ua.set=function(i){ei.setUA(i);var e=ei.getResult();for(var o in e)ii.ua[o]=e[o]}}}("object"==typeof window?window:this)},3267:(i,e,o)=>{"use strict";o.d(e,{R:()=>t,x:()=>s});var a=o(4382);const r={},n=a.createContext(r);function t(i){const e=a.useContext(n);return a.useMemo((function(){return"function"==typeof i?i(e):{...e,...i}}),[e,i])}function s(i){let e;return e=i.disableParentContext?"function"==typeof i.components?i.components(r):i.components||r:t(i.components),a.createElement(n.Provider,{value:e},i.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/9be130a4.4d76744e.js b/assets/js/9be130a4.4d76744e.js
new file mode 100644
index 000000000..2e6ae9585
--- /dev/null
+++ b/assets/js/9be130a4.4d76744e.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[2086],{5085:(e,n,t)=>{t.r(n),t.d(n,{Example:()=>d,assets:()=>a,contentTitle:()=>u,default:()=>v,frontMatter:()=>c,metadata:()=>s,toc:()=>l});const s=JSON.parse('{"id":"react/hooks/usePrevious","title":"usePrevious","description":"\uc774\uc804 \ub80c\ub354\ub9c1\uc5d0\uc11c \uc778\uc218\uc758 \uac12\uc744 \ubc18\ud658\ud558\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/usePrevious.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/usePrevious","permalink":"/modern-kit/docs/react/hooks/usePrevious","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"usePreservedState","permalink":"/modern-kit/docs/react/hooks/usePreservedState"},"next":{"title":"useResizeObserver","permalink":"/modern-kit/docs/react/hooks/useResizeObserver"}}');var r=t(6206),o=t(3267),i=t(4382);const c={},u="usePrevious",a={},d=()=>{const e={button:"button",div:"div",...(0,o.R)()},[n,t]=(0,i.useState)(0),s=function(e){const n=(0,i.useRef)(e);return(0,i.useEffect)((()=>{n.current=e}),[e]),n.current}(n);return(0,r.jsxs)(e.div,{children:[(0,r.jsxs)(e.div,{children:["Current Count is - ",n]}),(0,r.jsxs)(e.div,{children:["Previous Count is - ",s]}),(0,r.jsx)(e.button,{onClick:()=>{t(n+1)},children:"Increment"})]})},l=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2}];function h(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.header,{children:(0,r.jsx)(n.h1,{id:"useprevious",children:"usePrevious"})}),"\n",(0,r.jsx)(n.p,{children:"\uc774\uc804 \ub80c\ub354\ub9c1\uc5d0\uc11c \uc778\uc218\uc758 \uac12\uc744 \ubc18\ud658\ud558\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."}),"\n",(0,r.jsx)("br",{}),"\n",(0,r.jsx)(n.h2,{id:"code",children:"Code"}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/usePrevious/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,r.jsx)(n.h2,{id:"interface",children:"Interface"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"const usePrevious: (value: T) => T;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useState } from 'react';\nimport { usePrevious } from '@modern-kit/react';\n\nconst Example = () => {\n const [count, setCount] = useState(0);\n const previousCount = usePrevious(count);\n\n const onIncrementCount = () => {\n setCount(count + 1);\n };\n\n return (\n \n
Current Count is - {count}
\n
Previous Count is - {previousCount}
\n
\n
\n );\n};\n"})}),"\n","\n",(0,r.jsx)(d,{})]})}function v(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(h,{...e})}):h(e)}},3267:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>c});var s=t(4382);const r={},o=s.createContext(r);function i(e){const n=s.useContext(o);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),s.createElement(o.Provider,{value:n},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/9be130a4.7890da22.js b/assets/js/9be130a4.7890da22.js
deleted file mode 100644
index 91cadb643..000000000
--- a/assets/js/9be130a4.7890da22.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[2086],{486:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>d,assets:()=>u,contentTitle:()=>l,default:()=>p,frontMatter:()=>a,metadata:()=>r,toc:()=>f});const r=JSON.parse('{"id":"react/hooks/usePrevious","title":"usePrevious","description":"\uc774\uc804 \ub80c\ub354\ub9c1\uc5d0\uc11c \uc778\uc218\uc758 \uac12\uc744 \ubc18\ud658\ud558\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/usePrevious.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/usePrevious","permalink":"/modern-kit/docs/react/hooks/usePrevious","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"usePreservedState","permalink":"/modern-kit/docs/react/hooks/usePreservedState"},"next":{"title":"useResizeObserver","permalink":"/modern-kit/docs/react/hooks/useResizeObserver"}}');var o=n(6206),i=n(3267),s=n(4027),c=n(4382);const a={},l="usePrevious",u={},d=()=>{const e={button:"button",div:"div",...(0,i.R)()},[t,n]=(0,c.useState)(0),r=(0,s.ZC)(t);return(0,o.jsxs)(e.div,{children:[(0,o.jsxs)(e.div,{children:["Current Count is - ",t]}),(0,o.jsxs)(e.div,{children:["Previous Count is - ",r]}),(0,o.jsx)(e.button,{onClick:()=>{n(t+1)},children:"Increment"})]})},f=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2}];function h(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"useprevious",children:"usePrevious"})}),"\n",(0,o.jsx)(t.p,{children:"\uc774\uc804 \ub80c\ub354\ub9c1\uc5d0\uc11c \uc778\uc218\uc758 \uac12\uc744 \ubc18\ud658\ud558\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/usePrevious/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"const usePrevious: (value: T) => T;\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useState } from 'react';\nimport { usePrevious } from '@modern-kit/react';\n\nconst Example = () => {\n const [count, setCount] = useState(0);\n const previousCount = usePrevious(count);\n\n const onIncrementCount = () => {\n setCount(count + 1);\n };\n\n return (\n \n
Current Count is - {count}
\n
Previous Count is - {previousCount}
\n
\n
\n );\n};\n"})}),"\n","\n",(0,o.jsx)(d,{})]})}function p(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(h,{...e})}):h(e)}},4027:(e,t,n)=>{n.d(t,{$$:()=>$e,$I:()=>oe,AE:()=>De,BL:()=>H,DX:()=>I,FT:()=>ct,Fo:()=>et,Hn:()=>it,I5:()=>je,JF:()=>Te,K:()=>le,K$:()=>Je,M0:()=>Pe,ML:()=>ne,Mj:()=>ye,Mk:()=>Le,Mo:()=>ie,NT:()=>Xe,QV:()=>Ue,Ub:()=>xe,Ut:()=>Ee,W7:()=>U,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>We,Zu:()=>ae,_1:()=>Oe,_g:()=>nt,aL:()=>J,aY:()=>Ie,bB:()=>V,d7:()=>B,eG:()=>st,fN:()=>ce,fm:()=>G,gl:()=>$,hN:()=>A,iD:()=>de,iQ:()=>Ne,jd:()=>se,lW:()=>lt,oD:()=>K,oo:()=>Re,pL:()=>q,qi:()=>ue,rN:()=>Fe,tD:()=>Ce,u8:()=>Q,wY:()=>Be,xV:()=>N,xh:()=>tt,zy:()=>Z});var r=n(6206),o=n(4382),i=n(3683),s=n(5086),c=n(7197),a=(n(1604),n(5938));function l(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function m(){return typeof window>"u"}function v(){return!m()}function g(e){return f(this,0,void 0,(function*(){if(!v())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const w=e=>f(void 0,0,void 0,(function*(){return g(yield(yield fetch(e)).text())}));function b(e,t){var n;return f(this,0,void 0,(function*(){if(!v())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return w(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const i=yield p(e,h[t]);n(i)}catch(i){console.error(`Failed to load image. message: ${i.mesaage}`),r(i)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i=0;i{if(e===t||S(e)&&S(t)&&isNaN(e)&&isNaN(t))return!0;if(C(e)&&C(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return y(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!k(o,t.get(r),n))return!1;return!0}return y(e,t,n)};function x(e,t){return k(e,t,new WeakMap)}function C(e){return"function"==typeof e}function S(e){return"number"==typeof e}function E(e){return!function(e){return Object(e)!==e}(e)}function j(){}function R(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const O=(...e)=>t=>e.forEach((e=>{if(C(e))e(t);else if(null!=e){e.current=t}}));function P(...e){return(0,o.useCallback)(O(...e),e)}const I=o.forwardRef(((e,t)=>{const{children:n}=e,i=l(e,["children"]),s=o.Children.toArray(n),c=s.find(L);if(c){const e=c.props.children,n=s.map((t=>t===c?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(F,Object.assign({},i,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(F,Object.assign({},i,{ref:t,children:n}))}));I.displayName="Slot";const F=o.forwardRef(((e,t)=>{const{children:n}=e,r=l(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),i):"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?O(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));F.displayName="SlotClone";const N=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function L(e){return o.isValidElement(e)&&e.type===N}var M="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const $=d(((e,t)=>{var{ratio:n,style:o,as:s="div",asChild:c=!1}=e,a=l(e,["ratio","style","as","asChild"]);const u=c?I:s,d=Object.assign({aspectRatio:n},o),f=c?a.className:i(M,a.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},a))})),T=()=>j,Y=()=>!1,X=()=>!0;function V({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)(T,Y,X)?e:t}function z(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const A=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>z()?(0,r.jsx)(r.Fragment,{children:t}):e;function D(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function W(e){const t=D(e);(0,o.useEffect)((()=>()=>t()),[t])}function _(e,t=x){const[n,r]=(0,o.useState)(e),i=D(t);return(0,o.useEffect)((()=>{i(n,e)||r(e)}),[i,n,e]),n}function B(e,t,n){const r=D(e),i=_(n),c=(0,o.useMemo)((()=>(0,s.A)(r,t,i)),[r,t,i]);return W((()=>c.cancel())),c}const J=({children:e,capture:t,wait:n,options:r})=>{const i=o.Children.only(e),s=B(((...e)=>{const n=i?.props;if(n&&C(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(i,{[t]:s})};function H({onIntersectStart:e=j,onIntersectEnd:t=j,enabled:n=!0,calledOnce:r=!1,root:i=null,threshold:s=0,rootMargin:c="0px 0px 0px 0px"}){const a=(0,o.useRef)(0),l=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=D((([n],o)=>{if(!n)return;const i=n.target;n.isIntersecting?(l.current=!0,a.current+=1,e(n)):l.current&&(l.current=!1,a.current+=1,t(n)),r&&a.current>1&&o.unobserve(i)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:s,root:i,rootMargin:c}),u.current.observe(e))}),[n,s,i,c,d])}}const K=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:i,rootMargin:s}=e,c=l(e,["src","threshold","root","rootMargin"]);const{ref:a}=H({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:i,rootMargin:s});return(0,r.jsx)("img",Object.assign({ref:P(t,a)},c))}));K.displayName="LazyImage";const U=(0,o.forwardRef)(((e,t)=>{var{width:n,height:i,fallback:s,className:c,style:a,duration:u="0.2s",onLoad:d}=e,f=l(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,p]=(0,o.useState)(!1),m=!h,v=(0,o.useMemo)((()=>({position:"relative",width:n,height:i})),[n,i]),g=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:m?0:1,transition:`opacity ${u}`},a)),[m,u,a]),w=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),b=c?`lazy-image-wrapper ${c}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:b,style:v,children:[m&&s,(0,r.jsx)(K,Object.assign({ref:t,width:n,height:i,style:g,onLoad:w},f))]})}));U.displayName="FallbackLazyImage";const Z=({condition:e,trueComponent:t,falseComponent:n})=>{const i=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:i?t:n})},Q=({onScrollAction:e,children:t,root:n,threshold:o,enabled:i,triggerPosition:s="after",rootMargin:c="150px 0px"})=>{const{ref:a}=H({onIntersectStart:e,root:n,threshold:o,enabled:i,rootMargin:c});return(0,r.jsxs)(r.Fragment,{children:["before"===s&&(0,r.jsx)("div",{ref:a}),t,"after"===s&&(0,r.jsx)("div",{ref:a})]})},q=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1}=e,c=l(e,["children","as","asChild"]);const a=s?I:i,{ref:u}=H(c);if(s&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(a,Object.assign({ref:O(t,u)},c,{children:n}))})),G=({items:e=[],itemKey:t,renderItem:n})=>{const i=(0,o.useCallback)(((e,n)=>function(e){return E(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},i(e,t))))})},ee=v()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=D(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),i=(0,o.useMemo)((()=>function(){if(m())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,i,(({target:t})=>{if(!r.current)return;const o=r.current,i=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!i&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1,onPointerDown:c,excludeRefs:a=[]}=e,u=l(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(c,{excludeRefs:a}),f=s?I:i;if(s&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:O(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const ie=({itemKey:e,items:t=[],separator:n,renderItem:i,separatorInterval:s=1,includeLastSeparator:c=!1})=>{const a=(0,o.useCallback)((e=>e===t.length-1?c:(e+1)%s==0),[c,s,t.length]);return(0,r.jsx)(G,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[i(e,t),a(t)&&n]})})},se=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ce=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function ae(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function le(e=!0){const t=C(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!i.current){i.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{i.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),i=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield g(e);return t(n),!0}catch{return t(null),!1}}))),[]),s=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield b(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!v())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),a=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!v())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:i,copyImage:s,readText:c,readContents:a}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",pe={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},me=e=>pe[e],ve=me("localStorage"),ge=e=>window.localStorage.getItem(e),we=e=>JSON.stringify(e),be=e=>(ve.subscribe(e),()=>{ve.unsubscribe(e)});function ye(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=C(n)?n():n,i=(0,o.useSyncExternalStore)(be,(()=>ge(t)),(()=>we(r)));return{state:(0,o.useMemo)((()=>i?R(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=ge(t),o=n?R(n):r,i=C(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(i)),ve.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),ve.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const ke=(e,t)=>v()?window.matchMedia(e).matches:t??!1;function xe(e,t){const[n,r]=(0,o.useState)(ke(e,t)),i=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",i),n}function Ce(){return xe("(prefers-color-scheme: dark)")?"dark":"light"}const Se="color-scheme";function Ee({defaultValue:e,key:t=Se,shouldSetBodyClass:n=!1}={}){const r=Ce(),i=C(e)?e():e,{state:s,setState:c}=ye({key:t,initialValue:i??r}),a=(0,o.useCallback)((()=>{c((e=>"dark"===e?"light":"dark"))}),[c]),l=(0,o.useCallback)((()=>{c("dark")}),[c]),u=(0,o.useCallback)((()=>{c("light")}),[c]),d=(0,o.useCallback)((()=>{c(r)}),[c,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(s),()=>{n&&document.body.classList.remove(s)})),[s,n]),{colorScheme:s,preferredColorScheme:r,setToggleMode:a,setDarkMode:l,setLightMode:u,setPreferredMode:d}}function je(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),i=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),s=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:i,reset:s}}function Re({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,i]=(0,o.useState)(t),s=r0,a=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),l=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const s=a(e,t);o&&o({prev:r,next:s}),i(s)}),[n,r,a]),u=(0,o.useCallback)((e=>{l("nextStep",!s,e)}),[s,l]),d=(0,o.useCallback)((e=>{l("prevStep",!c,e)}),[c,l]),f=(0,o.useCallback)(((t,n)=>{const o=C(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void i(t);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),i(t)}),[r,t]);return{currentStep:r,hasNextStep:s,hasPrevStep:c,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Oe(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:i,resetStep:s}=Re({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:i,resetIndex:s}}function Pe(e,t,n={}){const[r,i]=(0,o.useState)(e);return[r,B(i,t,n)]}function Ie(e,t={}){const[n,r]=(0,o.useState)(""),[i,s]=Pe("",e,t);return{value:n,debouncedValue:i,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),s(t)}),[s]),onReset:(0,o.useCallback)((()=>{r(""),s("")}),[s])}}function Fe(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Ne({onFocus:e=j,onBlur:t=j}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=D((t=>{r(!0),e(t)})),c=D((e=>{r(!1),t(e)})),a=(0,o.useCallback)((()=>{i.current&&(i.current.focus(),r(!0))}),[]);return ne(i,"focus",s),ne(i,"blur",c),{ref:i,isFocus:n,setFocus:a}}function Le({onEnter:e=j,onLeave:t=j}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=D((t=>{r(!0),e(t)})),c=D((e=>{r(!1),t(e)}));return ne(i,"mouseenter",s),ne(i,"mouseleave",c),{ref:i,isHovered:n}}const Me=e=>{var t;return S(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function $e(e,t){const n=(0,o.useRef)(),r=D(e),{delay:i,enabled:s}=Me(t),c=(0,o.useCallback)((()=>{n.current=window.setInterval(r,i)}),[r,i]),a=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{a(),c()}),[a,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>a()}),[a,c,s,i]),{set:c,reset:l,clear:a}}function Te({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),i=D((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];C(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",i),()=>t.removeEventListener("keydown",i)}),[e,i]),r}const Ye={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function Xe(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)(Ye),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:a}=t;let l=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();l=i-t.left,u=s-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:a,elementRelativeX:l,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const Ve=()=>navigator.onLine,ze=()=>!0,Ae=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function De({onlineAction:e=j,offlineAction:t=j}={}){const n=D((n=>Ae(n,e,t)));return(0,o.useSyncExternalStore)(n,Ve,ze)}function We(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const _e={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Be(e=j){const[t,n]=(0,o.useState)(_e),r=(0,o.useRef)(null),i=D((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(i);return t.observe(e),()=>{t.unobserve(e)}}),[i]),{ref:r,contentRect:t}}function Je({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),i=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>i())),[e,r,i]),{ref:t,lock:r,unlock:i}}const He=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,Ke=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:i=0,alignY:s="start",alignX:c="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+i+He(window.innerHeight,r.height,s),left:r.left+window.scrollX+o+He(window.innerWidth,r.width,c)};const a=e.getBoundingClientRect();return{top:r.top-a.top+e.scrollTop+i+He(a.height,r.height,s),left:r.left-a.left+e.scrollLeft+o+He(a.width,r.width,c)}};function Ue(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:i,top:s}=Ke(r,t,n);r.scrollTo({top:s,left:i,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ze=me("sessionStorage"),Qe=e=>window.sessionStorage.getItem(e),qe=e=>JSON.stringify(e),Ge=e=>(Ze.subscribe(e),()=>{Ze.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=C(n)?n():n,i=(0,o.useSyncExternalStore)(Ge,(()=>Qe(t)),(()=>qe(r)));return{state:(0,o.useMemo)((()=>i?R(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=Qe(t),o=n?R(n):r,i=C(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(i)),Ze.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ze.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:i}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[s,c]=(0,o.useState)(n),a=(0,o.useCallback)((e=>{c((t=>{const n=C(e)?e(t):e;return r&&i&&function(e,t,n){if(!v())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=C(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,i,n),n}))}),[r,i]),l=(0,o.useCallback)((()=>{r&&i&&function(e,t){if(!v())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,i),c(null)}),[r,i]);return Object.assign({state:s,setState:a,clearState:l},Re(e))}function nt(e,t,n={}){const r=D(e),i=_(n),s=(0,o.useMemo)((()=>(0,c.A)(r,t,i)),[r,t,i]);return W((()=>s.cancel())),s}const rt=e=>{var t;return S(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=D(e),{delay:i,enabled:s}=rt(t),c=(0,o.useCallback)((()=>{n.current=setTimeout(r,i)}),[r,i]),a=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{a(),c()}),[a,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>a()}),[c,a,i,s]),{set:c,reset:l,clear:a}}function it(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function st(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new a.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function ct({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const at={width:null,height:null};function lt({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>m()?at:{width:window.innerWidth,height:window.innerHeight})),r=B(n,e),i=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",i),t}function ut(e,t,n){const{delay:r,enabled:i}=rt(t),{set:s,reset:c,clear:a}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!i||c()}),[r,i,c,...n]),{set:s,reset:c,clear:a}}}}]);
\ No newline at end of file
diff --git a/assets/js/a45fe377.41d28a11.js b/assets/js/a45fe377.41d28a11.js
new file mode 100644
index 000000000..eeea90c73
--- /dev/null
+++ b/assets/js/a45fe377.41d28a11.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[8051],{1908:(e,n,t)=>{t.r(n),t.d(n,{Example:()=>u,assets:()=>d,contentTitle:()=>a,default:()=>x,frontMatter:()=>s,metadata:()=>r,toc:()=>l});const r=JSON.parse('{"id":"react/hooks/useCycleList","title":"useCycleList","description":"\ubc30\uc5f4\uc744 \uc694\uc18c\ub97c \uc21c\ud658\ud558\uba70 \ub2e4\uc74c(nextIndex), \uc774\uc804(prevIndex) \ub610\ub294 \ud2b9\uc815 \uc778\ub371\uc2a4\ub85c \uc774\ub3d9(setIndex) \ud560 \uc218 \uc788\ub294 \uae30\ub2a5\uc744 \uc81c\uacf5\ud558\ub294 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useCycleList.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useCycleList","permalink":"/modern-kit/docs/react/hooks/useCycleList","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useCounter","permalink":"/modern-kit/docs/react/hooks/useCounter"},"next":{"title":"useDebounce","permalink":"/modern-kit/docs/react/hooks/useDebounce"}}');var o=t(6206),i=t(3267),c=t(4731);t(4382);const s={},a="useCycleList",d={},u=()=>{const e={button:"button",div:"div",...(0,i.R)()},{currentItem:n,nextIndex:t,prevIndex:r,setIndex:s}=function(e,n=0){const{currentStep:t,goToNextStep:r,goToPrevStep:o,setStep:i,resetStep:s}=(0,c.o)({maxStep:e.length-1,initialStep:n,infinite:!0});return{currentItem:e[t],nextIndex:r,prevIndex:o,setIndex:i,resetIndex:s}}([(0,o.jsx)(e.div,{children:"\uccab \ubc88\uc9f8 \uc694\uc18c"}),(0,o.jsx)(e.div,{children:"\ub450 \ubc88\uc9f8 \uc694\uc18c"}),(0,o.jsx)(e.div,{children:"\uc138 \ubc88\uc9f8 \uc694\uc18c"})]);return(0,o.jsxs)(e.div,{children:[n,(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.button,{onClick:()=>t(),children:"nextIndex"}),(0,o.jsx)(e.button,{onClick:()=>r(),children:"prveIndex"}),(0,o.jsx)(e.button,{onClick:()=>s(2),children:"setIndex(2)"})]})]})},l=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function p(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.header,{children:(0,o.jsx)(n.h1,{id:"usecyclelist",children:"useCycleList"})}),"\n",(0,o.jsxs)(n.p,{children:["\ubc30\uc5f4\uc744 \uc694\uc18c\ub97c ",(0,o.jsx)(n.code,{children:"\uc21c\ud658"}),"\ud558\uba70 \ub2e4\uc74c(",(0,o.jsx)(n.code,{children:"nextIndex"}),"), \uc774\uc804(",(0,o.jsx)(n.code,{children:"prevIndex"}),") \ub610\ub294 \ud2b9\uc815 \uc778\ub371\uc2a4\ub85c \uc774\ub3d9(",(0,o.jsx)(n.code,{children:"setIndex"}),") \ud560 \uc218 \uc788\ub294 \uae30\ub2a5\uc744 \uc81c\uacf5\ud558\ub294 \ud6c5\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(n.p,{children:["nextIndex, prevIndex, setIndex, resetIndex \ud638\ucd9c \uc2dc ",(0,o.jsx)(n.code,{children:"action"})," \ud568\uc218\ub97c \uc778\uc790\ub85c \ub123\uc5b4 \uc6d0\ud558\ub294 action\uc744 \uc2e4\ud589 \uc2dc\ud0ac \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(n.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useCycleList/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(n.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"type StepAction = ({ prev, next }: {\n prev: number;\n next: number;\n}) => void;\n\ninterface UseCycleListReturnType {\n currentItem: T;\n nextIndex: (action?: StepAction) => void;\n prevIndex: (action?: StepAction) => void;\n setIndex: (index: SetStateAction, action?: StepAction) => void;\n resetIndex: (action?: StepAction) => void;\n}\n"})}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"const useCycleList: (\n arr: T[] | readonly T[],\n initialIndex?: number\n) => UseCycleListReturnType;\n"})}),"\n",(0,o.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useCycleList } from '@modern-kit/react';\n\nconst Example = () => {\n const { currentItem, nextIndex, prevIndex, setIndex } = useCycleList([\n \uccab \ubc88\uc9f8 \uc694\uc18c
,\n \ub450 \ubc88\uc9f8 \uc694\uc18c
,\n \uc138 \ubc88\uc9f8 \uc694\uc18c
,\n ]);\n\n return (\n \n {currentItem}\n
\n \n \n \n
\n
\n );\n};\n"})}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(u,{})]})}function x(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(p,{...e})}):p(e)}},3267:(e,n,t)=>{t.d(n,{R:()=>c,x:()=>s});var r=t(4382);const o={},i=r.createContext(o);function c(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:c(e.components),r.createElement(i.Provider,{value:n},e.children)}},4731:(e,n,t)=>{t.d(n,{o:()=>i});var r=t(4382),o=t(9340);function i({maxStep:e,initialStep:n=0,infinite:t=!1}){const[i,c]=(0,r.useState)(n),s=i0,d=(0,r.useCallback)(((n,t)=>{const r="nextStep"===n;return t?r?0:e:r?i+1:i-1}),[e,i]),u=(0,r.useCallback)(((e,n,r)=>{if(n&&!t)return;const o=d(e,n);r&&r({prev:i,next:o}),c(o)}),[t,i,d]),l=(0,r.useCallback)((e=>{u("nextStep",!s,e)}),[s,u]),p=(0,r.useCallback)((e=>{u("prevStep",!a,e)}),[a,u]),x=(0,r.useCallback)(((n,t)=>{const r=(0,o.Tn)(n)?n(i):n;if(r>=0&&r<=e)return t&&t({prev:i,next:r}),void c(n);throw new Error("Step not valid")}),[i,e]),f=(0,r.useCallback)((e=>{e&&e({prev:i,next:n}),c(n)}),[i,n]);return{currentStep:i,hasNextStep:s,hasPrevStep:a,goToNextStep:l,goToPrevStep:p,setStep:x,resetStep:f}}},9340:(e,n,t)=>{function r(e,n,t,r){return new(t||(t=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(n){i(n)}}function s(e){try{a(r.throw(e))}catch(n){i(n)}}function a(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(c,s)}a((r=r.apply(e,n||[])).next())}))}t.d(n,{Et:()=>y,Fr:()=>s,Gp:()=>v,Ol:()=>k,Qd:()=>j,S$:()=>c,Tn:()=>g,Zp:()=>p,dK:()=>d,fl:()=>T,gD:()=>b,i5:()=>f,if:()=>x,l6:()=>I,lQ:()=>C,nS:()=>l,ni:()=>$,oc:()=>a}),"function"==typeof SuppressedError&&SuppressedError;const o={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};const i=(e,n)=>new Promise(((t,r)=>{e.toBlob((e=>{e?t(e):r(new Error(`Failed to create blob with format ${n}`))}),n)}));function c(){return"undefined"==typeof window}function s(){if(c())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}function a(){return!c()}function d(e){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const n=document.createElement("textarea");n.value=e,n.style.opacity="0",document.body.appendChild(n),n.focus(),n.select();try{return document.execCommand("copy"),e}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}finally{document.body.removeChild(n)}}(e)}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}}))}const u=e=>r(void 0,void 0,void 0,(function*(){const n=yield fetch(e);return d(yield n.text())}));function l(e,n){var t;return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator))return u(e);if(!("write"in window.navigator.clipboard))return u(e);if(null!==(t=null==n?void 0:n.toText)&&void 0!==t&&t)return u(e);const c=yield function(e,n="png"){return new Promise(((t,c)=>{const s=new Image;s.onload=()=>r(this,void 0,void 0,(function*(){const e=document.createElement("canvas");e.width=s.width,e.height=s.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(s,0,0);const c=yield i(e,o[n]);t(c)}catch(r){console.error(`Failed to load image. message: ${r.mesaage}`),c(r)}})),s.onerror=()=>{c(new Error("Failed to load image"))},s.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[c.type]:c})]),c}catch(c){throw console.error(`Failed to copy to clipboard. message: ${c.message}`),c}}))}function p(){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function x(){return r(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function f(e,n){return Object.prototype.hasOwnProperty.call(e,n)}const h=(e,n,t)=>{const r=Object.keys(e),o=Object.keys(n);if(r.length!==o.length)return!1;for(let i=0;i{if(e===n)return!0;if(y(e)&&y(n)&&isNaN(e)&&isNaN(n))return!0;if(g(e)&&g(n))return e.toString()===n.toString();if("object"!=typeof e||"object"!=typeof n||null===e||null===n)return!1;if(t.has(e)&&t.get(e)===n)return!0;if(t.set(e,n),e.constructor!==n.constructor)return!1;if(e instanceof Set){if(e.size!==n.size)return!1;const r=[...e],o=[...n];return h(r,o,t)}if(e instanceof Map){if(e.size!==n.size)return!1;for(const[r,o]of e)if(!n.has(r)||!m(o,n.get(r),t))return!1;return!0}return h(e,n,t)};function v(e,n){return m(e,n,new WeakMap)}function g(e){return"function"==typeof e}function b(e){return null==e}function y(e){return"number"==typeof e}function w(e){return!function(e){return Object(e)!==e}(e)}function j(e){return w(e)&&"[object Object]"===Object.prototype.toString.call(e)}function I(e){return e===window}function C(){}function k(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(n){throw new Error(`Failed to parse data: ${n}`)}}function S(e){return Object.keys(e)}const E={days:864e5,hours:36e5,minutes:6e4,seconds:1e3};S(E);function T(e,n){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(n)}catch(t){throw new Error(`Failed to remove key "${n}" from ${e}: ${t}`)}}function $(e,n,t){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=g(t)?t():t;r.setItem(n,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${n}" in ${e}: ${r}`)}}}}]);
\ No newline at end of file
diff --git a/assets/js/a45fe377.4da78159.js b/assets/js/a45fe377.4da78159.js
deleted file mode 100644
index 0f212b2f9..000000000
--- a/assets/js/a45fe377.4da78159.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[8051],{4070:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>u,assets:()=>a,contentTitle:()=>l,default:()=>h,frontMatter:()=>c,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"react/hooks/useCycleList","title":"useCycleList","description":"\ubc30\uc5f4\uc744 \uc694\uc18c\ub97c \uc21c\ud658\ud558\uba70 \ub2e4\uc74c(nextIndex), \uc774\uc804(prevIndex) \ub610\ub294 \ud2b9\uc815 \uc778\ub371\uc2a4\ub85c \uc774\ub3d9(setIndex) \ud560 \uc218 \uc788\ub294 \uae30\ub2a5\uc744 \uc81c\uacf5\ud558\ub294 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useCycleList.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useCycleList","permalink":"/modern-kit/docs/react/hooks/useCycleList","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useCounter","permalink":"/modern-kit/docs/react/hooks/useCounter"},"next":{"title":"useDebounce","permalink":"/modern-kit/docs/react/hooks/useDebounce"}}');var o=n(6206),i=n(3267),s=n(4027);const c={},l="useCycleList",a={},u=()=>{const e={button:"button",div:"div",...(0,i.R)()},{currentItem:t,nextIndex:n,prevIndex:r,setIndex:c}=(0,s._1)([(0,o.jsx)(e.div,{children:"\uccab \ubc88\uc9f8 \uc694\uc18c"}),(0,o.jsx)(e.div,{children:"\ub450 \ubc88\uc9f8 \uc694\uc18c"}),(0,o.jsx)(e.div,{children:"\uc138 \ubc88\uc9f8 \uc694\uc18c"})]);return(0,o.jsxs)(e.div,{children:[t,(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.button,{onClick:()=>n(),children:"nextIndex"}),(0,o.jsx)(e.button,{onClick:()=>r(),children:"prveIndex"}),(0,o.jsx)(e.button,{onClick:()=>c(2),children:"setIndex(2)"})]})]})},d=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function f(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"usecyclelist",children:"useCycleList"})}),"\n",(0,o.jsxs)(t.p,{children:["\ubc30\uc5f4\uc744 \uc694\uc18c\ub97c ",(0,o.jsx)(t.code,{children:"\uc21c\ud658"}),"\ud558\uba70 \ub2e4\uc74c(",(0,o.jsx)(t.code,{children:"nextIndex"}),"), \uc774\uc804(",(0,o.jsx)(t.code,{children:"prevIndex"}),") \ub610\ub294 \ud2b9\uc815 \uc778\ub371\uc2a4\ub85c \uc774\ub3d9(",(0,o.jsx)(t.code,{children:"setIndex"}),") \ud560 \uc218 \uc788\ub294 \uae30\ub2a5\uc744 \uc81c\uacf5\ud558\ub294 \ud6c5\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.p,{children:["nextIndex, prevIndex, setIndex, resetIndex \ud638\ucd9c \uc2dc ",(0,o.jsx)(t.code,{children:"action"})," \ud568\uc218\ub97c \uc778\uc790\ub85c \ub123\uc5b4 \uc6d0\ud558\ub294 action\uc744 \uc2e4\ud589 \uc2dc\ud0ac \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useCycleList/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"type StepAction = ({ prev, next }: {\n prev: number;\n next: number;\n}) => void;\n\ninterface UseCycleListReturnType {\n currentItem: T;\n nextIndex: (action?: StepAction) => void;\n prevIndex: (action?: StepAction) => void;\n setIndex: (index: SetStateAction, action?: StepAction) => void;\n resetIndex: (action?: StepAction) => void;\n}\n"})}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"const useCycleList: (\n arr: T[] | readonly T[],\n initialIndex?: number\n) => UseCycleListReturnType;\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useCycleList } from '@modern-kit/react';\n\nconst Example = () => {\n const { currentItem, nextIndex, prevIndex, setIndex } = useCycleList([\n \uccab \ubc88\uc9f8 \uc694\uc18c
,\n \ub450 \ubc88\uc9f8 \uc694\uc18c
,\n \uc138 \ubc88\uc9f8 \uc694\uc18c
,\n ]);\n\n return (\n \n {currentItem}\n
\n \n \n \n
\n
\n );\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(u,{})]})}function h(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(f,{...e})}):f(e)}},4027:(e,t,n)=>{n.d(t,{$$:()=>$e,$I:()=>oe,AE:()=>_e,BL:()=>U,DX:()=>L,FT:()=>ct,Fo:()=>et,Hn:()=>it,I5:()=>Ee,JF:()=>Pe,K:()=>ae,K$:()=>Je,M0:()=>Oe,ML:()=>ne,Mj:()=>ye,Mk:()=>Te,Mo:()=>ie,NT:()=>Ye,QV:()=>Ke,Ub:()=>ke,Ut:()=>je,W7:()=>K,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>We,Zu:()=>le,_1:()=>Re,_g:()=>nt,aL:()=>J,aY:()=>Le,bB:()=>D,d7:()=>B,eG:()=>st,fN:()=>ce,fm:()=>G,gl:()=>$,hN:()=>V,iD:()=>de,iQ:()=>Ne,jd:()=>se,lW:()=>at,oD:()=>H,oo:()=>Ie,pL:()=>q,qi:()=>ue,rN:()=>Fe,tD:()=>Ce,u8:()=>Q,wY:()=>Be,xV:()=>N,xh:()=>tt,zy:()=>Z});var r=n(6206),o=n(4382),i=n(3683),s=n(5086),c=n(7197),l=(n(1604),n(5938));function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function m(){return typeof window>"u"}function v(){return!m()}function g(e){return f(this,0,void 0,(function*(){if(!v())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const w=e=>f(void 0,0,void 0,(function*(){return g(yield(yield fetch(e)).text())}));function b(e,t){var n;return f(this,0,void 0,(function*(){if(!v())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return w(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const i=yield p(e,h[t]);n(i)}catch(i){console.error(`Failed to load image. message: ${i.mesaage}`),r(i)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i=0;i{if(e===t||S(e)&&S(t)&&isNaN(e)&&isNaN(t))return!0;if(C(e)&&C(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return y(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!x(o,t.get(r),n))return!1;return!0}return y(e,t,n)};function k(e,t){return x(e,t,new WeakMap)}function C(e){return"function"==typeof e}function S(e){return"number"==typeof e}function j(e){return!function(e){return Object(e)!==e}(e)}function E(){}function I(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const R=(...e)=>t=>e.forEach((e=>{if(C(e))e(t);else if(null!=e){e.current=t}}));function O(...e){return(0,o.useCallback)(R(...e),e)}const L=o.forwardRef(((e,t)=>{const{children:n}=e,i=a(e,["children"]),s=o.Children.toArray(n),c=s.find(T);if(c){const e=c.props.children,n=s.map((t=>t===c?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(F,Object.assign({},i,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(F,Object.assign({},i,{ref:t,children:n}))}));L.displayName="Slot";const F=o.forwardRef(((e,t)=>{const{children:n}=e,r=a(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),i):"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?R(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));F.displayName="SlotClone";const N=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function T(e){return o.isValidElement(e)&&e.type===N}var M="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const $=d(((e,t)=>{var{ratio:n,style:o,as:s="div",asChild:c=!1}=e,l=a(e,["ratio","style","as","asChild"]);const u=c?L:s,d=Object.assign({aspectRatio:n},o),f=c?l.className:i(M,l.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},l))})),P=()=>E,A=()=>!1,Y=()=>!0;function D({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)(P,A,Y)?e:t}function X(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const V=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>X()?(0,r.jsx)(r.Fragment,{children:t}):e;function _(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function W(e){const t=_(e);(0,o.useEffect)((()=>()=>t()),[t])}function z(e,t=k){const[n,r]=(0,o.useState)(e),i=_(t);return(0,o.useEffect)((()=>{i(n,e)||r(e)}),[i,n,e]),n}function B(e,t,n){const r=_(e),i=z(n),c=(0,o.useMemo)((()=>(0,s.A)(r,t,i)),[r,t,i]);return W((()=>c.cancel())),c}const J=({children:e,capture:t,wait:n,options:r})=>{const i=o.Children.only(e),s=B(((...e)=>{const n=i?.props;if(n&&C(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(i,{[t]:s})};function U({onIntersectStart:e=E,onIntersectEnd:t=E,enabled:n=!0,calledOnce:r=!1,root:i=null,threshold:s=0,rootMargin:c="0px 0px 0px 0px"}){const l=(0,o.useRef)(0),a=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=_((([n],o)=>{if(!n)return;const i=n.target;n.isIntersecting?(a.current=!0,l.current+=1,e(n)):a.current&&(a.current=!1,l.current+=1,t(n)),r&&l.current>1&&o.unobserve(i)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:s,root:i,rootMargin:c}),u.current.observe(e))}),[n,s,i,c,d])}}const H=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:i,rootMargin:s}=e,c=a(e,["src","threshold","root","rootMargin"]);const{ref:l}=U({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:i,rootMargin:s});return(0,r.jsx)("img",Object.assign({ref:O(t,l)},c))}));H.displayName="LazyImage";const K=(0,o.forwardRef)(((e,t)=>{var{width:n,height:i,fallback:s,className:c,style:l,duration:u="0.2s",onLoad:d}=e,f=a(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,p]=(0,o.useState)(!1),m=!h,v=(0,o.useMemo)((()=>({position:"relative",width:n,height:i})),[n,i]),g=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:m?0:1,transition:`opacity ${u}`},l)),[m,u,l]),w=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),b=c?`lazy-image-wrapper ${c}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:b,style:v,children:[m&&s,(0,r.jsx)(H,Object.assign({ref:t,width:n,height:i,style:g,onLoad:w},f))]})}));K.displayName="FallbackLazyImage";const Z=({condition:e,trueComponent:t,falseComponent:n})=>{const i=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:i?t:n})},Q=({onScrollAction:e,children:t,root:n,threshold:o,enabled:i,triggerPosition:s="after",rootMargin:c="150px 0px"})=>{const{ref:l}=U({onIntersectStart:e,root:n,threshold:o,enabled:i,rootMargin:c});return(0,r.jsxs)(r.Fragment,{children:["before"===s&&(0,r.jsx)("div",{ref:l}),t,"after"===s&&(0,r.jsx)("div",{ref:l})]})},q=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1}=e,c=a(e,["children","as","asChild"]);const l=s?L:i,{ref:u}=U(c);if(s&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(l,Object.assign({ref:R(t,u)},c,{children:n}))})),G=({items:e=[],itemKey:t,renderItem:n})=>{const i=(0,o.useCallback)(((e,n)=>function(e){return j(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},i(e,t))))})},ee=v()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=_(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),i=(0,o.useMemo)((()=>function(){if(m())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,i,(({target:t})=>{if(!r.current)return;const o=r.current,i=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!i&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1,onPointerDown:c,excludeRefs:l=[]}=e,u=a(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(c,{excludeRefs:l}),f=s?L:i;if(s&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:R(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const ie=({itemKey:e,items:t=[],separator:n,renderItem:i,separatorInterval:s=1,includeLastSeparator:c=!1})=>{const l=(0,o.useCallback)((e=>e===t.length-1?c:(e+1)%s==0),[c,s,t.length]);return(0,r.jsx)(G,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[i(e,t),l(t)&&n]})})},se=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ce=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function le(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function ae(e=!0){const t=C(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!i.current){i.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{i.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),i=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield g(e);return t(n),!0}catch{return t(null),!1}}))),[]),s=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield b(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!v())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),l=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!v())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:i,copyImage:s,readText:c,readContents:l}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",pe={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},me=e=>pe[e],ve=me("localStorage"),ge=e=>window.localStorage.getItem(e),we=e=>JSON.stringify(e),be=e=>(ve.subscribe(e),()=>{ve.unsubscribe(e)});function ye(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=C(n)?n():n,i=(0,o.useSyncExternalStore)(be,(()=>ge(t)),(()=>we(r)));return{state:(0,o.useMemo)((()=>i?I(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=ge(t),o=n?I(n):r,i=C(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(i)),ve.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),ve.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const xe=(e,t)=>v()?window.matchMedia(e).matches:t??!1;function ke(e,t){const[n,r]=(0,o.useState)(xe(e,t)),i=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",i),n}function Ce(){return ke("(prefers-color-scheme: dark)")?"dark":"light"}const Se="color-scheme";function je({defaultValue:e,key:t=Se,shouldSetBodyClass:n=!1}={}){const r=Ce(),i=C(e)?e():e,{state:s,setState:c}=ye({key:t,initialValue:i??r}),l=(0,o.useCallback)((()=>{c((e=>"dark"===e?"light":"dark"))}),[c]),a=(0,o.useCallback)((()=>{c("dark")}),[c]),u=(0,o.useCallback)((()=>{c("light")}),[c]),d=(0,o.useCallback)((()=>{c(r)}),[c,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(s),()=>{n&&document.body.classList.remove(s)})),[s,n]),{colorScheme:s,preferredColorScheme:r,setToggleMode:l,setDarkMode:a,setLightMode:u,setPreferredMode:d}}function Ee(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),i=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),s=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:i,reset:s}}function Ie({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,i]=(0,o.useState)(t),s=r0,l=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),a=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const s=l(e,t);o&&o({prev:r,next:s}),i(s)}),[n,r,l]),u=(0,o.useCallback)((e=>{a("nextStep",!s,e)}),[s,a]),d=(0,o.useCallback)((e=>{a("prevStep",!c,e)}),[c,a]),f=(0,o.useCallback)(((t,n)=>{const o=C(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void i(t);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),i(t)}),[r,t]);return{currentStep:r,hasNextStep:s,hasPrevStep:c,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Re(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:i,resetStep:s}=Ie({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:i,resetIndex:s}}function Oe(e,t,n={}){const[r,i]=(0,o.useState)(e);return[r,B(i,t,n)]}function Le(e,t={}){const[n,r]=(0,o.useState)(""),[i,s]=Oe("",e,t);return{value:n,debouncedValue:i,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),s(t)}),[s]),onReset:(0,o.useCallback)((()=>{r(""),s("")}),[s])}}function Fe(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Ne({onFocus:e=E,onBlur:t=E}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=_((t=>{r(!0),e(t)})),c=_((e=>{r(!1),t(e)})),l=(0,o.useCallback)((()=>{i.current&&(i.current.focus(),r(!0))}),[]);return ne(i,"focus",s),ne(i,"blur",c),{ref:i,isFocus:n,setFocus:l}}function Te({onEnter:e=E,onLeave:t=E}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=_((t=>{r(!0),e(t)})),c=_((e=>{r(!1),t(e)}));return ne(i,"mouseenter",s),ne(i,"mouseleave",c),{ref:i,isHovered:n}}const Me=e=>{var t;return S(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function $e(e,t){const n=(0,o.useRef)(),r=_(e),{delay:i,enabled:s}=Me(t),c=(0,o.useCallback)((()=>{n.current=window.setInterval(r,i)}),[r,i]),l=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),c()}),[l,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>l()}),[l,c,s,i]),{set:c,reset:a,clear:l}}function Pe({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),i=_((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];C(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",i),()=>t.removeEventListener("keydown",i)}),[e,i]),r}const Ae={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function Ye(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)(Ae),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:l}=t;let a=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();a=i-t.left,u=s-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:l,elementRelativeX:a,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const De=()=>navigator.onLine,Xe=()=>!0,Ve=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function _e({onlineAction:e=E,offlineAction:t=E}={}){const n=_((n=>Ve(n,e,t)));return(0,o.useSyncExternalStore)(n,De,Xe)}function We(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const ze={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Be(e=E){const[t,n]=(0,o.useState)(ze),r=(0,o.useRef)(null),i=_((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(i);return t.observe(e),()=>{t.unobserve(e)}}),[i]),{ref:r,contentRect:t}}function Je({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),i=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>i())),[e,r,i]),{ref:t,lock:r,unlock:i}}const Ue=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,He=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:i=0,alignY:s="start",alignX:c="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+i+Ue(window.innerHeight,r.height,s),left:r.left+window.scrollX+o+Ue(window.innerWidth,r.width,c)};const l=e.getBoundingClientRect();return{top:r.top-l.top+e.scrollTop+i+Ue(l.height,r.height,s),left:r.left-l.left+e.scrollLeft+o+Ue(l.width,r.width,c)}};function Ke(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:i,top:s}=He(r,t,n);r.scrollTo({top:s,left:i,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ze=me("sessionStorage"),Qe=e=>window.sessionStorage.getItem(e),qe=e=>JSON.stringify(e),Ge=e=>(Ze.subscribe(e),()=>{Ze.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=C(n)?n():n,i=(0,o.useSyncExternalStore)(Ge,(()=>Qe(t)),(()=>qe(r)));return{state:(0,o.useMemo)((()=>i?I(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=Qe(t),o=n?I(n):r,i=C(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(i)),Ze.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ze.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:i}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[s,c]=(0,o.useState)(n),l=(0,o.useCallback)((e=>{c((t=>{const n=C(e)?e(t):e;return r&&i&&function(e,t,n){if(!v())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=C(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,i,n),n}))}),[r,i]),a=(0,o.useCallback)((()=>{r&&i&&function(e,t){if(!v())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,i),c(null)}),[r,i]);return Object.assign({state:s,setState:l,clearState:a},Ie(e))}function nt(e,t,n={}){const r=_(e),i=z(n),s=(0,o.useMemo)((()=>(0,c.A)(r,t,i)),[r,t,i]);return W((()=>s.cancel())),s}const rt=e=>{var t;return S(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=_(e),{delay:i,enabled:s}=rt(t),c=(0,o.useCallback)((()=>{n.current=setTimeout(r,i)}),[r,i]),l=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),c()}),[l,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>l()}),[c,l,i,s]),{set:c,reset:a,clear:l}}function it(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function st(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new l.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function ct({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const lt={width:null,height:null};function at({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>m()?lt:{width:window.innerWidth,height:window.innerHeight})),r=B(n,e),i=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",i),t}function ut(e,t,n){const{delay:r,enabled:i}=rt(t),{set:s,reset:c,clear:l}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!i||c()}),[r,i,c,...n]),{set:s,reset:c,clear:l}}}}]);
\ No newline at end of file
diff --git a/assets/js/aa089504.030a7252.js b/assets/js/aa089504.030a7252.js
deleted file mode 100644
index f9f9080ce..000000000
--- a/assets/js/aa089504.030a7252.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[7867],{8483:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>d,assets:()=>u,contentTitle:()=>a,default:()=>m,frontMatter:()=>l,metadata:()=>r,toc:()=>f});const r=JSON.parse('{"id":"react/hooks/usePreferredColorScheme","title":"usePreferredColorScheme","description":"\uc0ac\uc6a9\uc790\uc758 \uc0c9\uc0c1 \uc2a4\ud0b4 \uc120\ud638\ub3c4(prefers-coloc-scheme) \uc5d0 \ub530\ub77c dark, light\ub97c \ubc18\ud658\ud569\ub2c8\ub2e4.","source":"@site/docs/react/hooks/usePreferredColorScheme.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/usePreferredColorScheme","permalink":"/modern-kit/docs/react/hooks/usePreferredColorScheme","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useOutsidePointerDown","permalink":"/modern-kit/docs/react/hooks/useOutsidePointerDown"},"next":{"title":"usePreservedCallback","permalink":"/modern-kit/docs/react/hooks/usePreservedCallback"}}');var o=n(6206),i=n(3267),s=n(4027),c=n(9010);const l={},a="usePreferredColorScheme",u={},d=()=>{const e={b:"b",div:"div",p:"p",...(0,i.R)()},t=(0,s.tD)();return(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.p,{children:"OS \uc2dc\uc2a4\ud15c \uc124\uc815\uc5d0\uc11c \ud14c\ub9c8\ub97c \ubcc0\uacbd\ud574\ubcf4\uc138\uc694."}),(0,o.jsxs)(e.p,{children:["ColorScheme: ",(0,o.jsx)(e.b,{children:t})]})]})},f=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2},{value:"Image",id:"image",level:2},{value:"1. Light Theme",id:"1-light-theme",level:3},{value:"2. Dark Theme",id:"2-dark-theme",level:3},{value:"Note",id:"note",level:2}];function h(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",img:"img",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"usepreferredcolorscheme",children:"usePreferredColorScheme"})}),"\n",(0,o.jsxs)(t.p,{children:["\uc0ac\uc6a9\uc790\uc758 \uc0c9\uc0c1 \uc2a4\ud0b4 \uc120\ud638\ub3c4(",(0,o.jsx)(t.strong,{children:(0,o.jsx)(t.a,{href:"https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme",children:"prefers-coloc-scheme"})}),") \uc5d0 \ub530\ub77c ",(0,o.jsx)(t.code,{children:"dark"}),", ",(0,o.jsx)(t.code,{children:"light"}),"\ub97c \ubc18\ud658\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsxs)(t.li,{children:["ligth: \uc0ac\uc6a9\uc790\uac00 \uc2dc\uc2a4\ud15c\uc5d0 ",(0,o.jsx)(t.code,{children:"ligth"})," \ud14c\ub9c8\ub97c \uc0ac\uc6a9\ud558\ub294 \uac83\uc744 \uc120\ud638\ud558\uac70\ub098 \uc120\ud638\ud558\ub294 \ud14c\ub9c8\ub97c \uc54c\ub9ac\uc9c0 \uc54a\uc558\uc744 \ub54c \ubc18\ud658\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(t.li,{children:["dark: \uc0ac\uc6a9\uc790\uac00 \uc2dc\uc2a4\ud15c\uc5d0 ",(0,o.jsx)(t.code,{children:"dark"})," \ud14c\ub9c8\ub97c \uc0ac\uc6a9\ud558\ub294 \uac83\uc744 \uc120\ud638\ud55c\ub2e4\uace0 \uc54c\ub838\uc744 \ub54c \ubc18\ud658\ud569\ub2c8\ub2e4."]}),"\n"]}),"\n",(0,o.jsxs)(t.p,{children:["\uc0ac\uc6a9\uc790\ub294 ",(0,o.jsx)(t.code,{children:"\uc6b4\uc601\uccb4\uc81c \uc124\uc815"}),"\uc774\ub098 ",(0,o.jsx)(t.code,{children:"\uc0ac\uc6a9\uc790 \uc5d0\uc774\uc804\ud2b8 \uc124\uc815"}),"\uc5d0\uc11c \uc120\ud638\ud558\ub294 \ud14c\ub9c8\ub97c \uc9c0\uc815 \ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/usePreferredColorScheme/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:'const usePreferredColorScheme: () => "dark" | "light"\n'})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { usePreferredColorScheme } from '@modern-kit/react';\n\nconst Example = () => {\n const colorScheme = usePreferredColorScheme();\n\n return (\n \n
OS \uc2dc\uc2a4\ud15c \uc124\uc815\uc5d0\uc11c \ud14c\ub9c8\ub97c \ubcc0\uacbd\ud574\ubcf4\uc138\uc694.
\n
ColorScheme: {colorScheme}
\n
\n );\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(c.A,{children:()=>(0,o.jsx)(d,{})}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"image",children:"Image"}),"\n",(0,o.jsx)(t.h3,{id:"1-light-theme",children:"1. Light Theme"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.img,{src:"https://github.com/modern-agile-team/modern-kit/assets/64779472/79c6298b-72f1-4f50-b644-93762d4d59e1",alt:"\u1109\u1173\u110f\u1173\u1105\u1175\u11ab\u1109\u1163\u11ba 2024-07-10 \u110b\u1169\u1112\u116e 8 09 33"})}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h3,{id:"2-dark-theme",children:"2. Dark Theme"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.img,{src:"https://github.com/modern-agile-team/modern-kit/assets/64779472/ab735906-9f8c-4e8e-9688-f6cde1786ec9",alt:"\u1109\u1173\u110f\u1173\u1105\u1175\u11ab\u1109\u1163\u11ba 2024-07-10 \u110b\u1169\u1112\u116e 8 09 39"})}),"\n",(0,o.jsx)(t.h2,{id:"note",children:"Note"}),"\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsx)(t.li,{children:(0,o.jsx)(t.a,{href:"https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme",children:"Prefers Color Scheme - MDN"})}),"\n"]})]})}function m(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(h,{...e})}):h(e)}},9010:(e,t,n)=>{n.d(t,{A:()=>i});n(4382);var r=n(3555),o=n(6206);function i(e){let{children:t,fallback:n}=e;return(0,r.A)()?(0,o.jsx)(o.Fragment,{children:t?.()}):n??null}},4027:(e,t,n)=>{n.d(t,{$$:()=>$e,$I:()=>oe,AE:()=>We,BL:()=>U,DX:()=>I,FT:()=>ct,Fo:()=>et,Hn:()=>it,I5:()=>Ee,JF:()=>Te,K:()=>ae,K$:()=>Je,M0:()=>Pe,ML:()=>ne,Mj:()=>ye,Mk:()=>Le,Mo:()=>ie,NT:()=>Ye,QV:()=>Ke,Ub:()=>ke,Ut:()=>je,W7:()=>K,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>ze,Zu:()=>le,_1:()=>Re,_g:()=>nt,aL:()=>J,aY:()=>Ie,bB:()=>A,d7:()=>B,eG:()=>st,fN:()=>ce,fm:()=>G,gl:()=>$,hN:()=>V,iD:()=>de,iQ:()=>Fe,jd:()=>se,lW:()=>at,oD:()=>H,oo:()=>Oe,pL:()=>q,qi:()=>ue,rN:()=>Ne,tD:()=>Se,u8:()=>Q,wY:()=>Be,xV:()=>F,xh:()=>tt,zy:()=>Z});var r=n(6206),o=n(4382),i=n(3683),s=n(5086),c=n(7197),l=(n(1604),n(5938));function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function p(){return typeof window>"u"}function g(){return!p()}function w(e){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const b=e=>f(void 0,0,void 0,(function*(){return w(yield(yield fetch(e)).text())}));function v(e,t){var n;return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return b(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const i=yield m(e,h[t]);n(i)}catch(i){console.error(`Failed to load image. message: ${i.mesaage}`),r(i)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i=0;i{if(e===t||C(e)&&C(t)&&isNaN(e)&&isNaN(t))return!0;if(S(e)&&S(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return y(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!x(o,t.get(r),n))return!1;return!0}return y(e,t,n)};function k(e,t){return x(e,t,new WeakMap)}function S(e){return"function"==typeof e}function C(e){return"number"==typeof e}function j(e){return!function(e){return Object(e)!==e}(e)}function E(){}function O(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const R=(...e)=>t=>e.forEach((e=>{if(S(e))e(t);else if(null!=e){e.current=t}}));function P(...e){return(0,o.useCallback)(R(...e),e)}const I=o.forwardRef(((e,t)=>{const{children:n}=e,i=a(e,["children"]),s=o.Children.toArray(n),c=s.find(L);if(c){const e=c.props.children,n=s.map((t=>t===c?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(N,Object.assign({},i,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(N,Object.assign({},i,{ref:t,children:n}))}));I.displayName="Slot";const N=o.forwardRef(((e,t)=>{const{children:n}=e,r=a(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),i):"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?R(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));N.displayName="SlotClone";const F=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function L(e){return o.isValidElement(e)&&e.type===F}var M="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const $=d(((e,t)=>{var{ratio:n,style:o,as:s="div",asChild:c=!1}=e,l=a(e,["ratio","style","as","asChild"]);const u=c?I:s,d=Object.assign({aspectRatio:n},o),f=c?l.className:i(M,l.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},l))})),T=()=>E,D=()=>!1,Y=()=>!0;function A({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)(T,D,Y)?e:t}function X(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const V=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>X()?(0,r.jsx)(r.Fragment,{children:t}):e;function W(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function z(e){const t=W(e);(0,o.useEffect)((()=>()=>t()),[t])}function _(e,t=k){const[n,r]=(0,o.useState)(e),i=W(t);return(0,o.useEffect)((()=>{i(n,e)||r(e)}),[i,n,e]),n}function B(e,t,n){const r=W(e),i=_(n),c=(0,o.useMemo)((()=>(0,s.A)(r,t,i)),[r,t,i]);return z((()=>c.cancel())),c}const J=({children:e,capture:t,wait:n,options:r})=>{const i=o.Children.only(e),s=B(((...e)=>{const n=i?.props;if(n&&S(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(i,{[t]:s})};function U({onIntersectStart:e=E,onIntersectEnd:t=E,enabled:n=!0,calledOnce:r=!1,root:i=null,threshold:s=0,rootMargin:c="0px 0px 0px 0px"}){const l=(0,o.useRef)(0),a=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=W((([n],o)=>{if(!n)return;const i=n.target;n.isIntersecting?(a.current=!0,l.current+=1,e(n)):a.current&&(a.current=!1,l.current+=1,t(n)),r&&l.current>1&&o.unobserve(i)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:s,root:i,rootMargin:c}),u.current.observe(e))}),[n,s,i,c,d])}}const H=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:i,rootMargin:s}=e,c=a(e,["src","threshold","root","rootMargin"]);const{ref:l}=U({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:i,rootMargin:s});return(0,r.jsx)("img",Object.assign({ref:P(t,l)},c))}));H.displayName="LazyImage";const K=(0,o.forwardRef)(((e,t)=>{var{width:n,height:i,fallback:s,className:c,style:l,duration:u="0.2s",onLoad:d}=e,f=a(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,m]=(0,o.useState)(!1),p=!h,g=(0,o.useMemo)((()=>({position:"relative",width:n,height:i})),[n,i]),w=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:p?0:1,transition:`opacity ${u}`},l)),[p,u,l]),b=(0,o.useCallback)((e=>{d&&d(e),m(!0)}),[d]),v=c?`lazy-image-wrapper ${c}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:v,style:g,children:[p&&s,(0,r.jsx)(H,Object.assign({ref:t,width:n,height:i,style:w,onLoad:b},f))]})}));K.displayName="FallbackLazyImage";const Z=({condition:e,trueComponent:t,falseComponent:n})=>{const i=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:i?t:n})},Q=({onScrollAction:e,children:t,root:n,threshold:o,enabled:i,triggerPosition:s="after",rootMargin:c="150px 0px"})=>{const{ref:l}=U({onIntersectStart:e,root:n,threshold:o,enabled:i,rootMargin:c});return(0,r.jsxs)(r.Fragment,{children:["before"===s&&(0,r.jsx)("div",{ref:l}),t,"after"===s&&(0,r.jsx)("div",{ref:l})]})},q=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1}=e,c=a(e,["children","as","asChild"]);const l=s?I:i,{ref:u}=U(c);if(s&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(l,Object.assign({ref:R(t,u)},c,{children:n}))})),G=({items:e=[],itemKey:t,renderItem:n})=>{const i=(0,o.useCallback)(((e,n)=>function(e){return j(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},i(e,t))))})},ee=g()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=W(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),i=(0,o.useMemo)((()=>function(){if(p())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,i,(({target:t})=>{if(!r.current)return;const o=r.current,i=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!i&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1,onPointerDown:c,excludeRefs:l=[]}=e,u=a(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(c,{excludeRefs:l}),f=s?I:i;if(s&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:R(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const ie=({itemKey:e,items:t=[],separator:n,renderItem:i,separatorInterval:s=1,includeLastSeparator:c=!1})=>{const l=(0,o.useCallback)((e=>e===t.length-1?c:(e+1)%s==0),[c,s,t.length]);return(0,r.jsx)(G,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[i(e,t),l(t)&&n]})})},se=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ce=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function le(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function ae(e=!0){const t=S(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!i.current){i.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{i.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),i=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield w(e);return t(n),!0}catch{return t(null),!1}}))),[]),s=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield v(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),l=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:i,copyImage:s,readText:c,readContents:l}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",me={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},pe=e=>me[e],ge=pe("localStorage"),we=e=>window.localStorage.getItem(e),be=e=>JSON.stringify(e),ve=e=>(ge.subscribe(e),()=>{ge.unsubscribe(e)});function ye(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=S(n)?n():n,i=(0,o.useSyncExternalStore)(ve,(()=>we(t)),(()=>be(r)));return{state:(0,o.useMemo)((()=>i?O(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=we(t),o=n?O(n):r,i=S(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(i)),ge.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),ge.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const xe=(e,t)=>g()?window.matchMedia(e).matches:t??!1;function ke(e,t){const[n,r]=(0,o.useState)(xe(e,t)),i=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",i),n}function Se(){return ke("(prefers-color-scheme: dark)")?"dark":"light"}const Ce="color-scheme";function je({defaultValue:e,key:t=Ce,shouldSetBodyClass:n=!1}={}){const r=Se(),i=S(e)?e():e,{state:s,setState:c}=ye({key:t,initialValue:i??r}),l=(0,o.useCallback)((()=>{c((e=>"dark"===e?"light":"dark"))}),[c]),a=(0,o.useCallback)((()=>{c("dark")}),[c]),u=(0,o.useCallback)((()=>{c("light")}),[c]),d=(0,o.useCallback)((()=>{c(r)}),[c,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(s),()=>{n&&document.body.classList.remove(s)})),[s,n]),{colorScheme:s,preferredColorScheme:r,setToggleMode:l,setDarkMode:a,setLightMode:u,setPreferredMode:d}}function Ee(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),i=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),s=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:i,reset:s}}function Oe({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,i]=(0,o.useState)(t),s=r0,l=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),a=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const s=l(e,t);o&&o({prev:r,next:s}),i(s)}),[n,r,l]),u=(0,o.useCallback)((e=>{a("nextStep",!s,e)}),[s,a]),d=(0,o.useCallback)((e=>{a("prevStep",!c,e)}),[c,a]),f=(0,o.useCallback)(((t,n)=>{const o=S(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void i(t);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),i(t)}),[r,t]);return{currentStep:r,hasNextStep:s,hasPrevStep:c,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Re(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:i,resetStep:s}=Oe({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:i,resetIndex:s}}function Pe(e,t,n={}){const[r,i]=(0,o.useState)(e);return[r,B(i,t,n)]}function Ie(e,t={}){const[n,r]=(0,o.useState)(""),[i,s]=Pe("",e,t);return{value:n,debouncedValue:i,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),s(t)}),[s]),onReset:(0,o.useCallback)((()=>{r(""),s("")}),[s])}}function Ne(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Fe({onFocus:e=E,onBlur:t=E}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=W((t=>{r(!0),e(t)})),c=W((e=>{r(!1),t(e)})),l=(0,o.useCallback)((()=>{i.current&&(i.current.focus(),r(!0))}),[]);return ne(i,"focus",s),ne(i,"blur",c),{ref:i,isFocus:n,setFocus:l}}function Le({onEnter:e=E,onLeave:t=E}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=W((t=>{r(!0),e(t)})),c=W((e=>{r(!1),t(e)}));return ne(i,"mouseenter",s),ne(i,"mouseleave",c),{ref:i,isHovered:n}}const Me=e=>{var t;return C(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function $e(e,t){const n=(0,o.useRef)(),r=W(e),{delay:i,enabled:s}=Me(t),c=(0,o.useCallback)((()=>{n.current=window.setInterval(r,i)}),[r,i]),l=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),c()}),[l,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>l()}),[l,c,s,i]),{set:c,reset:a,clear:l}}function Te({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),i=W((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];S(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",i),()=>t.removeEventListener("keydown",i)}),[e,i]),r}const De={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function Ye(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)(De),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:l}=t;let a=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();a=i-t.left,u=s-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:l,elementRelativeX:a,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const Ae=()=>navigator.onLine,Xe=()=>!0,Ve=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function We({onlineAction:e=E,offlineAction:t=E}={}){const n=W((n=>Ve(n,e,t)));return(0,o.useSyncExternalStore)(n,Ae,Xe)}function ze(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const _e={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Be(e=E){const[t,n]=(0,o.useState)(_e),r=(0,o.useRef)(null),i=W((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(i);return t.observe(e),()=>{t.unobserve(e)}}),[i]),{ref:r,contentRect:t}}function Je({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),i=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>i())),[e,r,i]),{ref:t,lock:r,unlock:i}}const Ue=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,He=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:i=0,alignY:s="start",alignX:c="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+i+Ue(window.innerHeight,r.height,s),left:r.left+window.scrollX+o+Ue(window.innerWidth,r.width,c)};const l=e.getBoundingClientRect();return{top:r.top-l.top+e.scrollTop+i+Ue(l.height,r.height,s),left:r.left-l.left+e.scrollLeft+o+Ue(l.width,r.width,c)}};function Ke(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:i,top:s}=He(r,t,n);r.scrollTo({top:s,left:i,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ze=pe("sessionStorage"),Qe=e=>window.sessionStorage.getItem(e),qe=e=>JSON.stringify(e),Ge=e=>(Ze.subscribe(e),()=>{Ze.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=S(n)?n():n,i=(0,o.useSyncExternalStore)(Ge,(()=>Qe(t)),(()=>qe(r)));return{state:(0,o.useMemo)((()=>i?O(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=Qe(t),o=n?O(n):r,i=S(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(i)),Ze.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ze.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:i}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[s,c]=(0,o.useState)(n),l=(0,o.useCallback)((e=>{c((t=>{const n=S(e)?e(t):e;return r&&i&&function(e,t,n){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=S(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,i,n),n}))}),[r,i]),a=(0,o.useCallback)((()=>{r&&i&&function(e,t){if(!g())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,i),c(null)}),[r,i]);return Object.assign({state:s,setState:l,clearState:a},Oe(e))}function nt(e,t,n={}){const r=W(e),i=_(n),s=(0,o.useMemo)((()=>(0,c.A)(r,t,i)),[r,t,i]);return z((()=>s.cancel())),s}const rt=e=>{var t;return C(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=W(e),{delay:i,enabled:s}=rt(t),c=(0,o.useCallback)((()=>{n.current=setTimeout(r,i)}),[r,i]),l=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),a=(0,o.useCallback)((()=>{l(),c()}),[l,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>l()}),[c,l,i,s]),{set:c,reset:a,clear:l}}function it(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function st(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new l.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function ct({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const lt={width:null,height:null};function at({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>p()?lt:{width:window.innerWidth,height:window.innerHeight})),r=B(n,e),i=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",i),t}function ut(e,t,n){const{delay:r,enabled:i}=rt(t),{set:s,reset:c,clear:l}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!i||c()}),[r,i,c,...n]),{set:s,reset:c,clear:l}}}}]);
\ No newline at end of file
diff --git a/assets/js/aa089504.c58fc7eb.js b/assets/js/aa089504.c58fc7eb.js
new file mode 100644
index 000000000..2a115bd2f
--- /dev/null
+++ b/assets/js/aa089504.c58fc7eb.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[7867],{8483:(e,r,n)=>{n.r(r),n.d(r,{Example:()=>u,assets:()=>l,contentTitle:()=>d,default:()=>m,frontMatter:()=>a,metadata:()=>t,toc:()=>h});const t=JSON.parse('{"id":"react/hooks/usePreferredColorScheme","title":"usePreferredColorScheme","description":"\uc0ac\uc6a9\uc790\uc758 \uc0c9\uc0c1 \uc2a4\ud0b4 \uc120\ud638\ub3c4(prefers-coloc-scheme) \uc5d0 \ub530\ub77c dark, light\ub97c \ubc18\ud658\ud569\ub2c8\ub2e4.","source":"@site/docs/react/hooks/usePreferredColorScheme.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/usePreferredColorScheme","permalink":"/modern-kit/docs/react/hooks/usePreferredColorScheme","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useOutsidePointerDown","permalink":"/modern-kit/docs/react/hooks/useOutsidePointerDown"},"next":{"title":"usePreservedCallback","permalink":"/modern-kit/docs/react/hooks/usePreservedCallback"}}');var o=n(6206),i=n(3267),c=n(3411),s=n(9010);const a={},d="usePreferredColorScheme",l={},u=()=>{const e={b:"b",div:"div",p:"p",...(0,i.R)()},r=(0,c.t)();return(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.p,{children:"OS \uc2dc\uc2a4\ud15c \uc124\uc815\uc5d0\uc11c \ud14c\ub9c8\ub97c \ubcc0\uacbd\ud574\ubcf4\uc138\uc694."}),(0,o.jsxs)(e.p,{children:["ColorScheme: ",(0,o.jsx)(e.b,{children:r})]})]})},h=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2},{value:"Image",id:"image",level:2},{value:"1. Light Theme",id:"1-light-theme",level:3},{value:"2. Dark Theme",id:"2-dark-theme",level:3},{value:"Note",id:"note",level:2}];function f(e){const r={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",img:"img",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(r.header,{children:(0,o.jsx)(r.h1,{id:"usepreferredcolorscheme",children:"usePreferredColorScheme"})}),"\n",(0,o.jsxs)(r.p,{children:["\uc0ac\uc6a9\uc790\uc758 \uc0c9\uc0c1 \uc2a4\ud0b4 \uc120\ud638\ub3c4(",(0,o.jsx)(r.strong,{children:(0,o.jsx)(r.a,{href:"https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme",children:"prefers-coloc-scheme"})}),") \uc5d0 \ub530\ub77c ",(0,o.jsx)(r.code,{children:"dark"}),", ",(0,o.jsx)(r.code,{children:"light"}),"\ub97c \ubc18\ud658\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(r.ul,{children:["\n",(0,o.jsxs)(r.li,{children:["ligth: \uc0ac\uc6a9\uc790\uac00 \uc2dc\uc2a4\ud15c\uc5d0 ",(0,o.jsx)(r.code,{children:"ligth"})," \ud14c\ub9c8\ub97c \uc0ac\uc6a9\ud558\ub294 \uac83\uc744 \uc120\ud638\ud558\uac70\ub098 \uc120\ud638\ud558\ub294 \ud14c\ub9c8\ub97c \uc54c\ub9ac\uc9c0 \uc54a\uc558\uc744 \ub54c \ubc18\ud658\ud569\ub2c8\ub2e4."]}),"\n",(0,o.jsxs)(r.li,{children:["dark: \uc0ac\uc6a9\uc790\uac00 \uc2dc\uc2a4\ud15c\uc5d0 ",(0,o.jsx)(r.code,{children:"dark"})," \ud14c\ub9c8\ub97c \uc0ac\uc6a9\ud558\ub294 \uac83\uc744 \uc120\ud638\ud55c\ub2e4\uace0 \uc54c\ub838\uc744 \ub54c \ubc18\ud658\ud569\ub2c8\ub2e4."]}),"\n"]}),"\n",(0,o.jsxs)(r.p,{children:["\uc0ac\uc6a9\uc790\ub294 ",(0,o.jsx)(r.code,{children:"\uc6b4\uc601\uccb4\uc81c \uc124\uc815"}),"\uc774\ub098 ",(0,o.jsx)(r.code,{children:"\uc0ac\uc6a9\uc790 \uc5d0\uc774\uc804\ud2b8 \uc124\uc815"}),"\uc5d0\uc11c \uc120\ud638\ud558\ub294 \ud14c\ub9c8\ub97c \uc9c0\uc815 \ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(r.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(r.p,{children:(0,o.jsx)(r.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/usePreferredColorScheme/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(r.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(r.pre,{children:(0,o.jsx)(r.code,{className:"language-ts",metastring:'title="typescript"',children:'const usePreferredColorScheme: () => "dark" | "light"\n'})}),"\n",(0,o.jsx)(r.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(r.pre,{children:(0,o.jsx)(r.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { usePreferredColorScheme } from '@modern-kit/react';\n\nconst Example = () => {\n const colorScheme = usePreferredColorScheme();\n\n return (\n \n
OS \uc2dc\uc2a4\ud15c \uc124\uc815\uc5d0\uc11c \ud14c\ub9c8\ub97c \ubcc0\uacbd\ud574\ubcf4\uc138\uc694.
\n
ColorScheme: {colorScheme}
\n
\n );\n};\n"})}),"\n",(0,o.jsx)(r.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(s.A,{children:()=>(0,o.jsx)(u,{})}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(r.h2,{id:"image",children:"Image"}),"\n",(0,o.jsx)(r.h3,{id:"1-light-theme",children:"1. Light Theme"}),"\n",(0,o.jsx)(r.p,{children:(0,o.jsx)(r.img,{src:"https://github.com/modern-agile-team/modern-kit/assets/64779472/79c6298b-72f1-4f50-b644-93762d4d59e1",alt:"\u1109\u1173\u110f\u1173\u1105\u1175\u11ab\u1109\u1163\u11ba 2024-07-10 \u110b\u1169\u1112\u116e 8 09 33"})}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(r.h3,{id:"2-dark-theme",children:"2. Dark Theme"}),"\n",(0,o.jsx)(r.p,{children:(0,o.jsx)(r.img,{src:"https://github.com/modern-agile-team/modern-kit/assets/64779472/ab735906-9f8c-4e8e-9688-f6cde1786ec9",alt:"\u1109\u1173\u110f\u1173\u1105\u1175\u11ab\u1109\u1163\u11ba 2024-07-10 \u110b\u1169\u1112\u116e 8 09 39"})}),"\n",(0,o.jsx)(r.h2,{id:"note",children:"Note"}),"\n",(0,o.jsxs)(r.ul,{children:["\n",(0,o.jsx)(r.li,{children:(0,o.jsx)(r.a,{href:"https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme",children:"Prefers Color Scheme - MDN"})}),"\n"]})]})}function m(e={}){const{wrapper:r}={...(0,i.R)(),...e.components};return r?(0,o.jsx)(r,{...e,children:(0,o.jsx)(f,{...e})}):f(e)}},9010:(e,r,n)=>{n.d(r,{A:()=>i});n(4382);var t=n(3555),o=n(6206);function i(e){let{children:r,fallback:n}=e;return(0,t.A)()?(0,o.jsx)(o.Fragment,{children:r?.()}):n??null}},3267:(e,r,n)=>{n.d(r,{R:()=>c,x:()=>s});var t=n(4382);const o={},i=t.createContext(o);function c(e){const r=t.useContext(i);return t.useMemo((function(){return"function"==typeof e?e(r):{...r,...e}}),[r,e])}function s(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:c(e.components),t.createElement(i.Provider,{value:r},e.children)}},1351:(e,r,n)=>{n.d(r,{M:()=>s});var t=n(6765),o=n(5907),i=n(9340);n(4382);const c=e=>!!e&&(0,i.i5)(e,"current");function s(e,r,n,i){const s=(0,t.p)(n);(0,o.E)((()=>{const n=c(e)?e.current:e;if(n)return n.addEventListener(r,s,i),()=>{n.removeEventListener(r,s,i)}}),[r,e,i,s])}},5907:(e,r,n)=>{n.d(r,{E:()=>i});var t=n(9340),o=n(4382);const i=(0,t.oc)()?o.useLayoutEffect:o.useEffect},9659:(e,r,n)=>{n.d(r,{U:()=>s});var t=n(9340),o=n(1351),i=n(4382);const c=(e,r)=>(0,t.oc)()?window.matchMedia(e).matches:null!=r&&r;function s(e,r){const[n,t]=(0,i.useState)(c(e,r)),s=(0,i.useCallback)((e=>t(e.matches)),[]);return(0,o.M)(window.matchMedia(e),"change",s),n}},3411:(e,r,n)=>{n.d(r,{t:()=>o});var t=n(9659);n(4382);function o(){return(0,t.U)("(prefers-color-scheme: dark)")?"dark":"light"}},6765:(e,r,n)=>{n.d(r,{p:()=>o});var t=n(4382);function o(e){const r=(0,t.useRef)(e);return r.current=e,(0,t.useCallback)(((...e)=>r.current(...e)),[])}},9340:(e,r,n)=>{function t(e,r,n,t){return new(n||(n=Promise))((function(o,i){function c(e){try{a(t.next(e))}catch(r){i(r)}}function s(e){try{a(t.throw(e))}catch(r){i(r)}}function a(e){var r;e.done?o(e.value):(r=e.value,r instanceof n?r:new n((function(e){e(r)}))).then(c,s)}a((t=t.apply(e,r||[])).next())}))}n.d(r,{Et:()=>b,Fr:()=>s,Gp:()=>x,Ol:()=>S,Qd:()=>y,S$:()=>c,Tn:()=>v,Zp:()=>h,dK:()=>d,fl:()=>O,gD:()=>w,i5:()=>m,if:()=>f,l6:()=>k,lQ:()=>C,nS:()=>u,ni:()=>F,oc:()=>a}),"function"==typeof SuppressedError&&SuppressedError;const o={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};const i=(e,r)=>new Promise(((n,t)=>{e.toBlob((e=>{e?n(e):t(new Error(`Failed to create blob with format ${r}`))}),r)}));function c(){return"undefined"==typeof window}function s(){if(c())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}function a(){return!c()}function d(e){return t(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const r=document.createElement("textarea");r.value=e,r.style.opacity="0",document.body.appendChild(r),r.focus(),r.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(r)}}(e)}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const l=e=>t(void 0,void 0,void 0,(function*(){const r=yield fetch(e);return d(yield r.text())}));function u(e,r){var n;return t(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator))return l(e);if(!("write"in window.navigator.clipboard))return l(e);if(null!==(n=null==r?void 0:r.toText)&&void 0!==n&&n)return l(e);const c=yield function(e,r="png"){return new Promise(((n,c)=>{const s=new Image;s.onload=()=>t(this,void 0,void 0,(function*(){const e=document.createElement("canvas");e.width=s.width,e.height=s.height;try{const t=e.getContext("2d");if(!t)throw new Error("Failed to get 2d context");t.drawImage(s,0,0);const c=yield i(e,o[r]);n(c)}catch(t){console.error(`Failed to load image. message: ${t.mesaage}`),c(t)}})),s.onerror=()=>{c(new Error("Failed to load image"))},s.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[c.type]:c})]),c}catch(c){throw console.error(`Failed to copy to clipboard. message: ${c.message}`),c}}))}function h(){return t(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function f(){return t(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function m(e,r){return Object.prototype.hasOwnProperty.call(e,r)}const p=(e,r,n)=>{const t=Object.keys(e),o=Object.keys(r);if(t.length!==o.length)return!1;for(let i=0;i{if(e===r)return!0;if(b(e)&&b(r)&&isNaN(e)&&isNaN(r))return!0;if(v(e)&&v(r))return e.toString()===r.toString();if("object"!=typeof e||"object"!=typeof r||null===e||null===r)return!1;if(n.has(e)&&n.get(e)===r)return!0;if(n.set(e,r),e.constructor!==r.constructor)return!1;if(e instanceof Set){if(e.size!==r.size)return!1;const t=[...e],o=[...r];return p(t,o,n)}if(e instanceof Map){if(e.size!==r.size)return!1;for(const[t,o]of e)if(!r.has(t)||!g(o,r.get(t),n))return!1;return!0}return p(e,r,n)};function x(e,r){return g(e,r,new WeakMap)}function v(e){return"function"==typeof e}function w(e){return null==e}function b(e){return"number"==typeof e}function j(e){return!function(e){return Object(e)!==e}(e)}function y(e){return j(e)&&"[object Object]"===Object.prototype.toString.call(e)}function k(e){return e===window}function C(){}function S(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(r){throw new Error(`Failed to parse data: ${r}`)}}function E(e){return Object.keys(e)}const P={days:864e5,hours:36e5,minutes:6e4,seconds:1e3};E(P);function O(e,r){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(r)}catch(n){throw new Error(`Failed to remove key "${r}" from ${e}: ${n}`)}}function F(e,r,n){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{const t=window[e],o=v(n)?n():n;t.setItem(r,JSON.stringify(o))}catch(t){throw new Error(`Failed to store data for key "${r}" in ${e}: ${t}`)}}}}]);
\ No newline at end of file
diff --git a/assets/js/ab7af1d3.d2f1107c.js b/assets/js/ab7af1d3.d2f1107c.js
deleted file mode 100644
index 3c6d303aa..000000000
--- a/assets/js/ab7af1d3.d2f1107c.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[7930],{8748:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>u,assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>c,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"react/hooks/useToggleState","title":"useToggleState","description":"\ub450 \uac1c\uc758 \uac12\uc744 \ud1a0\uae00\ud558\ub294 \uae30\ub2a5\uc744 \uc81c\uacf5\ud558\ub294 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useToggleState.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useToggleState","permalink":"/modern-kit/docs/react/hooks/useToggleState","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useToggle","permalink":"/modern-kit/docs/react/hooks/useToggle"},"next":{"title":"useUnMount","permalink":"/modern-kit/docs/react/hooks/useUnmount"}}');var o=n(6206),i=n(3267),s=n(4027);const c={},a="useToggleState",l={},u=()=>{const e={button:"button",div:"div",...(0,i.R)()},[t,n]=(0,s.Hn)("ON","OFF");return(0,o.jsxs)(e.div,{children:[t,(0,o.jsx)(e.button,{onClick:n,children:"Toggle Button"})]})},d=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function f(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"usetogglestate",children:"useToggleState"})}),"\n",(0,o.jsx)(t.p,{children:"\ub450 \uac1c\uc758 \uac12\uc744 \ud1a0\uae00\ud558\ub294 \uae30\ub2a5\uc744 \uc81c\uacf5\ud558\ub294 \ud6c5\uc785\ub2c8\ub2e4."}),"\n",(0,o.jsx)(t.p,{children:"\uae30\ubcf8\uac12\uc73c\ub85c \uc81c\uacf5\ub41c \ub450 \uac1c\uc758 \uac12\uc744 \uad00\ub9ac\ud558\uba70, \uc120\ud0dd\ub41c \uac12\uacfc \ub450 \uac12\uc744 \ud1a0\uae00\ud560 \uc218 \uc788\ub294 \ud568\uc218\ub97c \ubc18\ud658\ud569\ub2c8\ub2e4."}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useToggleState/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"function useToggleState(value1: T, value2: T): [T, () => void]\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useToggleState } from '@modern-kit/react';\n\nconst Example = () => {\n const [value, toggle] = useToggleState('ON', 'OFF');\n\n return (\n \n {value}\n \n
\n );\n}\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,o.jsx)(u,{})]})}function h(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(f,{...e})}):f(e)}},4027:(e,t,n)=>{n.d(t,{$$:()=>$e,$I:()=>oe,AE:()=>De,BL:()=>J,DX:()=>F,FT:()=>ct,Fo:()=>et,Hn:()=>it,I5:()=>je,JF:()=>Pe,K:()=>le,K$:()=>He,M0:()=>Te,ML:()=>ne,Mj:()=>ye,Mk:()=>Le,Mo:()=>ie,NT:()=>Xe,QV:()=>Ke,Ub:()=>ke,Ut:()=>Ee,W7:()=>K,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>We,Zu:()=>ae,_1:()=>Re,_g:()=>nt,aL:()=>H,aY:()=>Fe,bB:()=>V,d7:()=>z,eG:()=>st,fN:()=>ce,fm:()=>G,gl:()=>$,hN:()=>B,iD:()=>de,iQ:()=>Ne,jd:()=>se,lW:()=>lt,oD:()=>U,oo:()=>Oe,pL:()=>q,qi:()=>ue,rN:()=>Ie,tD:()=>Se,u8:()=>Q,wY:()=>ze,xV:()=>N,xh:()=>tt,zy:()=>Z});var r=n(6206),o=n(4382),i=n(3683),s=n(5086),c=n(7197),a=(n(1604),n(5938));function l(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function g(){return typeof window>"u"}function m(){return!g()}function w(e){return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const b=e=>f(void 0,0,void 0,(function*(){return w(yield(yield fetch(e)).text())}));function v(e,t){var n;return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return b(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const i=yield p(e,h[t]);n(i)}catch(i){console.error(`Failed to load image. message: ${i.mesaage}`),r(i)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i=0;i{if(e===t||C(e)&&C(t)&&isNaN(e)&&isNaN(t))return!0;if(S(e)&&S(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return y(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!x(o,t.get(r),n))return!1;return!0}return y(e,t,n)};function k(e,t){return x(e,t,new WeakMap)}function S(e){return"function"==typeof e}function C(e){return"number"==typeof e}function E(e){return!function(e){return Object(e)!==e}(e)}function j(){}function O(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const R=(...e)=>t=>e.forEach((e=>{if(S(e))e(t);else if(null!=e){e.current=t}}));function T(...e){return(0,o.useCallback)(R(...e),e)}const F=o.forwardRef(((e,t)=>{const{children:n}=e,i=l(e,["children"]),s=o.Children.toArray(n),c=s.find(L);if(c){const e=c.props.children,n=s.map((t=>t===c?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(I,Object.assign({},i,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(I,Object.assign({},i,{ref:t,children:n}))}));F.displayName="Slot";const I=o.forwardRef(((e,t)=>{const{children:n}=e,r=l(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),i):"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?R(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));I.displayName="SlotClone";const N=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function L(e){return o.isValidElement(e)&&e.type===N}var M="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const $=d(((e,t)=>{var{ratio:n,style:o,as:s="div",asChild:c=!1}=e,a=l(e,["ratio","style","as","asChild"]);const u=c?F:s,d=Object.assign({aspectRatio:n},o),f=c?a.className:i(M,a.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},a))})),P=()=>j,Y=()=>!1,X=()=>!0;function V({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)(P,Y,X)?e:t}function A(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const B=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>A()?(0,r.jsx)(r.Fragment,{children:t}):e;function D(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function W(e){const t=D(e);(0,o.useEffect)((()=>()=>t()),[t])}function _(e,t=k){const[n,r]=(0,o.useState)(e),i=D(t);return(0,o.useEffect)((()=>{i(n,e)||r(e)}),[i,n,e]),n}function z(e,t,n){const r=D(e),i=_(n),c=(0,o.useMemo)((()=>(0,s.A)(r,t,i)),[r,t,i]);return W((()=>c.cancel())),c}const H=({children:e,capture:t,wait:n,options:r})=>{const i=o.Children.only(e),s=z(((...e)=>{const n=i?.props;if(n&&S(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(i,{[t]:s})};function J({onIntersectStart:e=j,onIntersectEnd:t=j,enabled:n=!0,calledOnce:r=!1,root:i=null,threshold:s=0,rootMargin:c="0px 0px 0px 0px"}){const a=(0,o.useRef)(0),l=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=D((([n],o)=>{if(!n)return;const i=n.target;n.isIntersecting?(l.current=!0,a.current+=1,e(n)):l.current&&(l.current=!1,a.current+=1,t(n)),r&&a.current>1&&o.unobserve(i)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:s,root:i,rootMargin:c}),u.current.observe(e))}),[n,s,i,c,d])}}const U=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:i,rootMargin:s}=e,c=l(e,["src","threshold","root","rootMargin"]);const{ref:a}=J({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:i,rootMargin:s});return(0,r.jsx)("img",Object.assign({ref:T(t,a)},c))}));U.displayName="LazyImage";const K=(0,o.forwardRef)(((e,t)=>{var{width:n,height:i,fallback:s,className:c,style:a,duration:u="0.2s",onLoad:d}=e,f=l(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,p]=(0,o.useState)(!1),g=!h,m=(0,o.useMemo)((()=>({position:"relative",width:n,height:i})),[n,i]),w=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:g?0:1,transition:`opacity ${u}`},a)),[g,u,a]),b=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),v=c?`lazy-image-wrapper ${c}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:v,style:m,children:[g&&s,(0,r.jsx)(U,Object.assign({ref:t,width:n,height:i,style:w,onLoad:b},f))]})}));K.displayName="FallbackLazyImage";const Z=({condition:e,trueComponent:t,falseComponent:n})=>{const i=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:i?t:n})},Q=({onScrollAction:e,children:t,root:n,threshold:o,enabled:i,triggerPosition:s="after",rootMargin:c="150px 0px"})=>{const{ref:a}=J({onIntersectStart:e,root:n,threshold:o,enabled:i,rootMargin:c});return(0,r.jsxs)(r.Fragment,{children:["before"===s&&(0,r.jsx)("div",{ref:a}),t,"after"===s&&(0,r.jsx)("div",{ref:a})]})},q=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1}=e,c=l(e,["children","as","asChild"]);const a=s?F:i,{ref:u}=J(c);if(s&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(a,Object.assign({ref:R(t,u)},c,{children:n}))})),G=({items:e=[],itemKey:t,renderItem:n})=>{const i=(0,o.useCallback)(((e,n)=>function(e){return E(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},i(e,t))))})},ee=m()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=D(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),i=(0,o.useMemo)((()=>function(){if(g())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,i,(({target:t})=>{if(!r.current)return;const o=r.current,i=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!i&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:i="div",asChild:s=!1,onPointerDown:c,excludeRefs:a=[]}=e,u=l(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(c,{excludeRefs:a}),f=s?F:i;if(s&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:R(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const ie=({itemKey:e,items:t=[],separator:n,renderItem:i,separatorInterval:s=1,includeLastSeparator:c=!1})=>{const a=(0,o.useCallback)((e=>e===t.length-1?c:(e+1)%s==0),[c,s,t.length]);return(0,r.jsx)(G,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[i(e,t),a(t)&&n]})})},se=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ce=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function ae(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function le(e=!0){const t=S(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!i.current){i.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{i.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),i=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield w(e);return t(n),!0}catch{return t(null),!1}}))),[]),s=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield v(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),a=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:i,copyImage:s,readText:c,readContents:a}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",pe={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},ge=e=>pe[e],me=ge("localStorage"),we=e=>window.localStorage.getItem(e),be=e=>JSON.stringify(e),ve=e=>(me.subscribe(e),()=>{me.unsubscribe(e)});function ye(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=S(n)?n():n,i=(0,o.useSyncExternalStore)(ve,(()=>we(t)),(()=>be(r)));return{state:(0,o.useMemo)((()=>i?O(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=we(t),o=n?O(n):r,i=S(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(i)),me.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),me.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const xe=(e,t)=>m()?window.matchMedia(e).matches:t??!1;function ke(e,t){const[n,r]=(0,o.useState)(xe(e,t)),i=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",i),n}function Se(){return ke("(prefers-color-scheme: dark)")?"dark":"light"}const Ce="color-scheme";function Ee({defaultValue:e,key:t=Ce,shouldSetBodyClass:n=!1}={}){const r=Se(),i=S(e)?e():e,{state:s,setState:c}=ye({key:t,initialValue:i??r}),a=(0,o.useCallback)((()=>{c((e=>"dark"===e?"light":"dark"))}),[c]),l=(0,o.useCallback)((()=>{c("dark")}),[c]),u=(0,o.useCallback)((()=>{c("light")}),[c]),d=(0,o.useCallback)((()=>{c(r)}),[c,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(s),()=>{n&&document.body.classList.remove(s)})),[s,n]),{colorScheme:s,preferredColorScheme:r,setToggleMode:a,setDarkMode:l,setLightMode:u,setPreferredMode:d}}function je(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),i=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),s=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:i,reset:s}}function Oe({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,i]=(0,o.useState)(t),s=r0,a=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),l=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const s=a(e,t);o&&o({prev:r,next:s}),i(s)}),[n,r,a]),u=(0,o.useCallback)((e=>{l("nextStep",!s,e)}),[s,l]),d=(0,o.useCallback)((e=>{l("prevStep",!c,e)}),[c,l]),f=(0,o.useCallback)(((t,n)=>{const o=S(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void i(t);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),i(t)}),[r,t]);return{currentStep:r,hasNextStep:s,hasPrevStep:c,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Re(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:i,resetStep:s}=Oe({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:i,resetIndex:s}}function Te(e,t,n={}){const[r,i]=(0,o.useState)(e);return[r,z(i,t,n)]}function Fe(e,t={}){const[n,r]=(0,o.useState)(""),[i,s]=Te("",e,t);return{value:n,debouncedValue:i,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),s(t)}),[s]),onReset:(0,o.useCallback)((()=>{r(""),s("")}),[s])}}function Ie(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Ne({onFocus:e=j,onBlur:t=j}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=D((t=>{r(!0),e(t)})),c=D((e=>{r(!1),t(e)})),a=(0,o.useCallback)((()=>{i.current&&(i.current.focus(),r(!0))}),[]);return ne(i,"focus",s),ne(i,"blur",c),{ref:i,isFocus:n,setFocus:a}}function Le({onEnter:e=j,onLeave:t=j}={}){const[n,r]=(0,o.useState)(!1),i=(0,o.useRef)(null),s=D((t=>{r(!0),e(t)})),c=D((e=>{r(!1),t(e)}));return ne(i,"mouseenter",s),ne(i,"mouseleave",c),{ref:i,isHovered:n}}const Me=e=>{var t;return C(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function $e(e,t){const n=(0,o.useRef)(),r=D(e),{delay:i,enabled:s}=Me(t),c=(0,o.useCallback)((()=>{n.current=window.setInterval(r,i)}),[r,i]),a=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{a(),c()}),[a,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>a()}),[a,c,s,i]),{set:c,reset:l,clear:a}}function Pe({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),i=D((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];S(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",i),()=>t.removeEventListener("keydown",i)}),[e,i]),r}const Ye={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function Xe(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)(Ye),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:a}=t;let l=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();l=i-t.left,u=s-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:i,clientY:s,pageX:c,pageY:a,elementRelativeX:l,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const Ve=()=>navigator.onLine,Ae=()=>!0,Be=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function De({onlineAction:e=j,offlineAction:t=j}={}){const n=D((n=>Be(n,e,t)));return(0,o.useSyncExternalStore)(n,Ve,Ae)}function We(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const _e={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function ze(e=j){const[t,n]=(0,o.useState)(_e),r=(0,o.useRef)(null),i=D((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(i);return t.observe(e),()=>{t.unobserve(e)}}),[i]),{ref:r,contentRect:t}}function He({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),i=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>i())),[e,r,i]),{ref:t,lock:r,unlock:i}}const Je=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,Ue=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:i=0,alignY:s="start",alignX:c="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+i+Je(window.innerHeight,r.height,s),left:r.left+window.scrollX+o+Je(window.innerWidth,r.width,c)};const a=e.getBoundingClientRect();return{top:r.top-a.top+e.scrollTop+i+Je(a.height,r.height,s),left:r.left-a.left+e.scrollLeft+o+Je(a.width,r.width,c)}};function Ke(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:i,top:s}=Ue(r,t,n);r.scrollTo({top:s,left:i,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ze=ge("sessionStorage"),Qe=e=>window.sessionStorage.getItem(e),qe=e=>JSON.stringify(e),Ge=e=>(Ze.subscribe(e),()=>{Ze.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=S(n)?n():n,i=(0,o.useSyncExternalStore)(Ge,(()=>Qe(t)),(()=>qe(r)));return{state:(0,o.useMemo)((()=>i?O(i):r),[i,r]),setState:(0,o.useCallback)((e=>{try{const n=Qe(t),o=n?O(n):r,i=S(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(i)),Ze.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ze.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:i}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[s,c]=(0,o.useState)(n),a=(0,o.useCallback)((e=>{c((t=>{const n=S(e)?e(t):e;return r&&i&&function(e,t,n){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=S(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,i,n),n}))}),[r,i]),l=(0,o.useCallback)((()=>{r&&i&&function(e,t){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,i),c(null)}),[r,i]);return Object.assign({state:s,setState:a,clearState:l},Oe(e))}function nt(e,t,n={}){const r=D(e),i=_(n),s=(0,o.useMemo)((()=>(0,c.A)(r,t,i)),[r,t,i]);return W((()=>s.cancel())),s}const rt=e=>{var t;return C(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=D(e),{delay:i,enabled:s}=rt(t),c=(0,o.useCallback)((()=>{n.current=setTimeout(r,i)}),[r,i]),a=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{a(),c()}),[a,c]);return(0,o.useEffect)((()=>{if(!(i<0)&&s)return c(),()=>a()}),[c,a,i,s]),{set:c,reset:l,clear:a}}function it(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function st(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new a.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function ct({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const at={width:null,height:null};function lt({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>g()?at:{width:window.innerWidth,height:window.innerHeight})),r=z(n,e),i=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",i),t}function ut(e,t,n){const{delay:r,enabled:i}=rt(t),{set:s,reset:c,clear:a}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!i||c()}),[r,i,c,...n]),{set:s,reset:c,clear:a}}}}]);
\ No newline at end of file
diff --git a/assets/js/ab7af1d3.e6628944.js b/assets/js/ab7af1d3.e6628944.js
new file mode 100644
index 000000000..1a35b4c12
--- /dev/null
+++ b/assets/js/ab7af1d3.e6628944.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[7930],{961:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>d,assets:()=>i,contentTitle:()=>l,default:()=>h,frontMatter:()=>c,metadata:()=>o,toc:()=>u});const o=JSON.parse('{"id":"react/hooks/useToggleState","title":"useToggleState","description":"\ub450 \uac1c\uc758 \uac12\uc744 \ud1a0\uae00\ud558\ub294 \uae30\ub2a5\uc744 \uc81c\uacf5\ud558\ub294 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useToggleState.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useToggleState","permalink":"/modern-kit/docs/react/hooks/useToggleState","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useToggle","permalink":"/modern-kit/docs/react/hooks/useToggle"},"next":{"title":"useUnMount","permalink":"/modern-kit/docs/react/hooks/useUnmount"}}');var s=n(6206),r=n(3267),a=n(4382);const c={},l="useToggleState",i={},d=()=>{const e={button:"button",div:"div",...(0,r.R)()},[t,n]=function(e,t){const[n,o]=(0,a.useState)(e);return[n,(0,a.useCallback)((()=>{o((n=>n===e?t:e))}),[e,t])]}("ON","OFF");return(0,s.jsxs)(e.div,{children:[t,(0,s.jsx)(e.button,{onClick:n,children:"Toggle Button"})]})},u=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function g(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.header,{children:(0,s.jsx)(t.h1,{id:"usetogglestate",children:"useToggleState"})}),"\n",(0,s.jsx)(t.p,{children:"\ub450 \uac1c\uc758 \uac12\uc744 \ud1a0\uae00\ud558\ub294 \uae30\ub2a5\uc744 \uc81c\uacf5\ud558\ub294 \ud6c5\uc785\ub2c8\ub2e4."}),"\n",(0,s.jsx)(t.p,{children:"\uae30\ubcf8\uac12\uc73c\ub85c \uc81c\uacf5\ub41c \ub450 \uac1c\uc758 \uac12\uc744 \uad00\ub9ac\ud558\uba70, \uc120\ud0dd\ub41c \uac12\uacfc \ub450 \uac12\uc744 \ud1a0\uae00\ud560 \uc218 \uc788\ub294 \ud568\uc218\ub97c \ubc18\ud658\ud569\ub2c8\ub2e4."}),"\n",(0,s.jsx)("br",{}),"\n",(0,s.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,s.jsx)(t.p,{children:(0,s.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useToggleState/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,s.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"function useToggleState(value1: T, value2: T): [T, () => void]\n"})}),"\n",(0,s.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useToggleState } from '@modern-kit/react';\n\nconst Example = () => {\n const [value, toggle] = useToggleState('ON', 'OFF');\n\n return (\n \n {value}\n \n
\n );\n}\n"})}),"\n",(0,s.jsx)(t.h2,{id:"example",children:"Example"}),"\n","\n",(0,s.jsx)(d,{})]})}function h(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(g,{...e})}):g(e)}},3267:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>c});var o=n(4382);const s={},r=o.createContext(s);function a(e){const t=o.useContext(r);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),o.createElement(r.Provider,{value:t},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/ad8813a3.4fede0e4.js b/assets/js/ad8813a3.4fede0e4.js
deleted file mode 100644
index cb857fb9e..000000000
--- a/assets/js/ad8813a3.4fede0e4.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[632],{8807:(e,t,n)=>{n.r(t),n.d(t,{Example:()=>u,assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>c,metadata:()=>r,toc:()=>d});const r=JSON.parse('{"id":"react/hooks/useUserAgent","title":"useUserAgent","description":"ua-parser-js \ub97c \ud65c\uc6a9\ud574\uc11c window.navigator.userAgent \uc815\ubcf4\ub97c \ubd84\uc11d\ud558\uace0 \ud30c\uc2f1\ud55c \ub370\uc774\ud130\ub97c \ubc18\ud658\ud558\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useUserAgent.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useUserAgent","permalink":"/modern-kit/docs/react/hooks/useUserAgent","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useUnMount","permalink":"/modern-kit/docs/react/hooks/useUnmount"},"next":{"title":"useVhProperty","permalink":"/modern-kit/docs/react/hooks/useVhProperty"}}');var o=n(6206),s=n(3267),i=n(4027);const c={},a="useUserAgent",l={},u=()=>{const e={div:"div",h3:"h3",p:"p",...(0,s.R)()},t=(0,i.eG)();return(0,o.jsxs)(e.div,{children:[(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.h3,{children:"UserAgent String"}),(0,o.jsx)(e.p,{children:`${t?.ua}`})]}),(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.h3,{children:"Browser"}),(0,o.jsxs)(e.p,{children:["name: ",`${t?.browser.name}`]}),(0,o.jsxs)(e.p,{children:["version: ",`${t?.browser.version}`]}),(0,o.jsxs)(e.p,{children:["major: ",`${t?.browser.major}`]})]}),(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.h3,{children:"Engine"}),(0,o.jsxs)(e.p,{children:["name: ",`${t?.engine.name}`]}),(0,o.jsxs)(e.p,{children:["version: ",`${t?.engine.version}`]})]}),(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.h3,{children:"OS"}),(0,o.jsxs)(e.p,{children:["name: ",`${t?.os.name}`]}),(0,o.jsxs)(e.p,{children:["version: ",`${t?.os.version}`]})]}),(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.h3,{children:"Device"}),(0,o.jsxs)(e.p,{children:["vendor: ",`${t?.device.vendor}`]}),(0,o.jsxs)(e.p,{children:["model: ",`${t?.device.model}`]}),(0,o.jsxs)(e.p,{children:["type: ",`${t?.device.type}`]})]}),(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.h3,{children:"CPU"}),(0,o.jsxs)(e.p,{children:["architecture: ",`${t?.cpu.architecture}`]})]})]})},d=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function f(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",strong:"strong",...(0,s.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"useuseragent",children:"useUserAgent"})}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.strong,{children:(0,o.jsx)(t.a,{href:"https://github.com/faisalman/ua-parser-js",children:"ua-parser-js"})})," \ub97c \ud65c\uc6a9\ud574\uc11c ",(0,o.jsx)(t.code,{children:"window.navigator.userAgent"})," \uc815\ubcf4\ub97c \ubd84\uc11d\ud558\uace0 \ud30c\uc2f1\ud55c \ub370\uc774\ud130\ub97c \ubc18\ud658\ud558\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useUserAgent/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"const useUserAgent: () => UAParser.IResult | null\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useUserAgent } from '@modern-kit/react';\n\nconst Example = () => {\n const userAgent = useUserAgent();\n\n return (\n \n
\n
UserAgent String
\n
ua: {`${userAgent?.ua}`}
\n
\n
\n
Browser
\n
name: {`${userAgent?.browser.name}`}
\n
version: {`${userAgent?.browser.version}`}
\n
major: {`${userAgent?.browser.major}`}
\n
\n
\n
Engine
\n
name: {`${userAgent?.engine.name}`}
\n
version: {`${userAgent?.engine.version}`}
\n
\n
\n
OS
\n
name: {`${userAgent?.os.name}`}
\n
version: {`${userAgent?.os.version}`}
\n
\n
\n
Device
\n
vendor: {`${userAgent?.device.vendor}`}
\n
model: {`${userAgent?.device.model}`}
\n
type: {`${userAgent?.device.type}`}
\n
\n
\n
CPU
\n
architecture: {`${userAgent?.cpu.architecture}`}
\n
\n
\n );\n};\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example",children:"Example"})]})}function h(e={}){const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(f,{...e})}):f(e)}},4027:(e,t,n)=>{n.d(t,{$$:()=>Le,$I:()=>oe,AE:()=>Xe,BL:()=>J,DX:()=>A,FT:()=>ct,Fo:()=>et,Hn:()=>st,I5:()=>Ee,JF:()=>Me,K:()=>le,K$:()=>ze,M0:()=>Re,ML:()=>ne,Mj:()=>ye,Mk:()=>Ne,Mo:()=>se,NT:()=>Ue,QV:()=>Ke,Ub:()=>je,Ut:()=>Ce,W7:()=>K,WY:()=>re,Y1:()=>ut,Z3:()=>ot,ZC:()=>Be,Zu:()=>ae,_1:()=>Oe,_g:()=>nt,aL:()=>z,aY:()=>Ae,bB:()=>Y,d7:()=>_,eG:()=>it,fN:()=>ce,fm:()=>q,gl:()=>L,hN:()=>D,iD:()=>de,iQ:()=>Fe,jd:()=>ie,lW:()=>lt,oD:()=>H,oo:()=>$e,pL:()=>Q,qi:()=>ue,rN:()=>Ie,tD:()=>ke,u8:()=>G,wY:()=>_e,xV:()=>F,xh:()=>tt,zy:()=>Z});var r=n(6206),o=n(4382),s=n(3683),i=n(5086),c=n(7197),a=(n(1604),n(5938));function l(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);onew Promise(((n,r)=>{e.toBlob((e=>{e?n(e):r(new Error(`Failed to create blob with format ${t}`))}),t)}));function g(){return typeof window>"u"}function m(){return!g()}function v(e){return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const t=document.createElement("textarea");t.value=e,t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy"),e}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}finally{document.body.removeChild(t)}}(e)}catch(t){throw console.error(`Failed to copy to clipboard. message: ${t.message}`),t}}))}const w=e=>f(void 0,0,void 0,(function*(){return v(yield(yield fetch(e)).text())}));function b(e,t){var n;return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator)||!("write"in window.navigator.clipboard)||null!==(n=t?.toText)&&void 0!==n&&n)return w(e);const r=yield function(e,t="png"){return new Promise(((n,r)=>{const o=new Image;o.onload=()=>f(this,0,void 0,(function*(){const e=document.createElement("canvas");e.width=o.width,e.height=o.height;try{const r=e.getContext("2d");if(!r)throw new Error("Failed to get 2d context");r.drawImage(o,0,0);const s=yield p(e,h[t]);n(s)}catch(s){console.error(`Failed to load image. message: ${s.mesaage}`),r(s)}})),o.onerror=()=>{r(new Error("Failed to load image"))},o.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[r.type]:r})]),r}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}}))}const y=(e,t,n)=>{const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let s=0;s{if(e===t||S(e)&&S(t)&&isNaN(e)&&isNaN(t))return!0;if(k(e)&&k(t))return e.toString()===t.toString();if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(n.has(e)&&n.get(e)===t)return!0;if(n.set(e,t),e.constructor!==t.constructor)return!1;if(e instanceof Set){if(e.size!==t.size)return!1;const r=[...e],o=[...t];return y(r,o,n)}if(e instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!x(o,t.get(r),n))return!1;return!0}return y(e,t,n)};function j(e,t){return x(e,t,new WeakMap)}function k(e){return"function"==typeof e}function S(e){return"number"==typeof e}function C(e){return!function(e){return Object(e)!==e}(e)}function E(){}function $(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse data: ${t}`)}}const O=(...e)=>t=>e.forEach((e=>{if(k(e))e(t);else if(null!=e){e.current=t}}));function R(...e){return(0,o.useCallback)(O(...e),e)}const A=o.forwardRef(((e,t)=>{const{children:n}=e,s=l(e,["children"]),i=o.Children.toArray(n),c=i.find(N);if(c){const e=c.props.children,n=i.map((t=>t===c?o.Children.count(e)>1?o.Children.only(null):o.isValidElement(e)?e.props.children:null:t));return(0,r.jsx)(I,Object.assign({},s,{ref:t,children:o.isValidElement(e)?o.cloneElement(e,void 0,n):null}))}return(0,r.jsx)(I,Object.assign({},s,{ref:t,children:n}))}));A.displayName="Slot";const I=o.forwardRef(((e,t)=>{const{children:n}=e,r=l(e,["children"]);if(o.isValidElement(n)){const e=function(e){var t,n;let r=null===(t=Object.getOwnPropertyDescriptor(e.props,"ref"))||void 0===t?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=null===(n=Object.getOwnPropertyDescriptor(e,"ref"))||void 0===n?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}(n);return o.cloneElement(n,Object.assign(Object.assign({},function(e,t){const n=Object.assign({},t);for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...e)=>{s(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]=Object.assign(Object.assign({},o),s):"className"===r&&(n[r]=[o,s].filter(Boolean).join(" "))}return Object.assign(Object.assign({},e),n)}(r,n.props)),{ref:t?O(t,e):e}))}return o.Children.count(n)>1?o.Children.only(null):null}));I.displayName="SlotClone";const F=({children:e})=>(0,r.jsx)(r.Fragment,{children:e});function N(e){return o.isValidElement(e)&&e.type===F}var P="AspectRatio-modules_aspectRatioWrapper__x4FNF";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}");const L=d(((e,t)=>{var{ratio:n,style:o,as:i="div",asChild:c=!1}=e,a=l(e,["ratio","style","as","asChild"]);const u=c?A:i,d=Object.assign({aspectRatio:n},o),f=c?a.className:s(P,a.className);return(0,r.jsx)(u,Object.assign({ref:t,style:d,className:f},a))})),M=()=>E,T=()=>!1,U=()=>!0;function Y({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t}){return(0,o.useSyncExternalStore)(M,T,U)?e:t}function V(){const[e,t]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{t(!0)}),[]),e}const D=({fallback:e=(0,r.jsx)(r.Fragment,{}),children:t})=>V()?(0,r.jsx)(r.Fragment,{children:t}):e;function X(e){const t=(0,o.useRef)(e);return t.current=e,(0,o.useCallback)(((...e)=>t.current(...e)),[])}function B(e){const t=X(e);(0,o.useEffect)((()=>()=>t()),[t])}function W(e,t=j){const[n,r]=(0,o.useState)(e),s=X(t);return(0,o.useEffect)((()=>{s(n,e)||r(e)}),[s,n,e]),n}function _(e,t,n){const r=X(e),s=W(n),c=(0,o.useMemo)((()=>(0,i.A)(r,t,s)),[r,t,s]);return B((()=>c.cancel())),c}const z=({children:e,capture:t,wait:n,options:r})=>{const s=o.Children.only(e),i=_(((...e)=>{const n=s?.props;if(n&&k(n[t]))return n[t](...e)}),n,r);return(0,o.cloneElement)(s,{[t]:i})};function J({onIntersectStart:e=E,onIntersectEnd:t=E,enabled:n=!0,calledOnce:r=!1,root:s=null,threshold:i=0,rootMargin:c="0px 0px 0px 0px"}){const a=(0,o.useRef)(0),l=(0,o.useRef)(!1),u=(0,o.useRef)(null),d=X((([n],o)=>{if(!n)return;const s=n.target;n.isIntersecting?(l.current=!0,a.current+=1,e(n)):l.current&&(l.current=!1,a.current+=1,t(n)),r&&a.current>1&&o.unobserve(s)}));return{ref:(0,o.useCallback)((e=>{u.current&&(u.current.disconnect(),u.current=null),null!==e&&n&&(u.current=new IntersectionObserver(d,{threshold:i,root:s,rootMargin:c}),u.current.observe(e))}),[n,i,s,c,d])}}const H=(0,o.forwardRef)(((e,t)=>{var{src:n,threshold:o,root:s,rootMargin:i}=e,c=l(e,["src","threshold","root","rootMargin"]);const{ref:a}=J({onIntersectStart:e=>{e.target.src=n},calledOnce:!0,threshold:o,root:s,rootMargin:i});return(0,r.jsx)("img",Object.assign({ref:R(t,a)},c))}));H.displayName="LazyImage";const K=(0,o.forwardRef)(((e,t)=>{var{width:n,height:s,fallback:i,className:c,style:a,duration:u="0.2s",onLoad:d}=e,f=l(e,["width","height","fallback","className","style","duration","onLoad"]);const[h,p]=(0,o.useState)(!1),g=!h,m=(0,o.useMemo)((()=>({position:"relative",width:n,height:s})),[n,s]),v=(0,o.useMemo)((()=>Object.assign({position:"absolute",top:0,left:0,opacity:g?0:1,transition:`opacity ${u}`},a)),[g,u,a]),w=(0,o.useCallback)((e=>{d&&d(e),p(!0)}),[d]),b=c?`lazy-image-wrapper ${c}`:"lazy-image-wrapper";return(0,r.jsxs)("div",{className:b,style:m,children:[g&&i,(0,r.jsx)(H,Object.assign({ref:t,width:n,height:s,style:v,onLoad:w},f))]})}));K.displayName="FallbackLazyImage";const Z=({condition:e,trueComponent:t,falseComponent:n})=>{const s=(e=>"function"==typeof e?e():e)(e);return(0,r.jsx)(o.Fragment,{children:s?t:n})},G=({onScrollAction:e,children:t,root:n,threshold:o,enabled:s,triggerPosition:i="after",rootMargin:c="150px 0px"})=>{const{ref:a}=J({onIntersectStart:e,root:n,threshold:o,enabled:s,rootMargin:c});return(0,r.jsxs)(r.Fragment,{children:["before"===i&&(0,r.jsx)("div",{ref:a}),t,"after"===i&&(0,r.jsx)("div",{ref:a})]})},Q=d(((e,t)=>{var{children:n,as:s="div",asChild:i=!1}=e,c=l(e,["children","as","asChild"]);const a=i?A:s,{ref:u}=J(c);if(i&&!o.isValidElement(n))throw new Error("InView\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(a,Object.assign({ref:O(t,u)},c,{children:n}))})),q=({items:e=[],itemKey:t,renderItem:n})=>{const s=(0,o.useCallback)(((e,n)=>function(e){return C(e)&&"[object Object]"===Object.prototype.toString.call(e)}(e)?e?.[t]||n:`${n}_${e}`),[t]);return(0,r.jsx)(r.Fragment,{children:e.map(((e,t)=>(0,r.jsx)(o.Fragment,{children:n(e,t)},s(e,t))))})},ee=m()?o.useLayoutEffect:o.useEffect,te=e=>!!e&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,"current");function ne(e,t,n,r){const o=X(n);ee((()=>{const n=te(e)?e.current:e;if(n)return n.addEventListener(t,o,r),()=>{n.removeEventListener(t,o,r)}}),[t,e,r,o])}function re(e,t){const{excludeRefs:n}=t??{},r=(0,o.useRef)(null),s=(0,o.useMemo)((()=>function(){if(g())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}()?"touchstart":"mousedown"),[]);return ne(document,s,(({target:t})=>{if(!r.current)return;const o=r.current,s=n?.some((e=>{var n;return null===(n=e.current)||void 0===n?void 0:n.contains(t)}));!o.contains(t)&&!s&&e(o)})),r}const oe=d(((e,t)=>{var{children:n,as:s="div",asChild:i=!1,onPointerDown:c,excludeRefs:a=[]}=e,u=l(e,["children","as","asChild","onPointerDown","excludeRefs"]);const d=re(c,{excludeRefs:a}),f=i?A:s;if(i&&!o.isValidElement(n))throw new Error("OutsidePointerDownHandler\ub294 asChild\uac00 true\uc77c \uacbd\uc6b0 children\uc73c\ub85c \uc720\ud6a8\ud55c React \uc694\uc18c\ub9cc\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \ub610\ud55c, \ub2e8\uc77c \uc694\uc18c\ub9cc \ud5c8\uc6a9\ud569\ub2c8\ub2e4.");return(0,r.jsx)(f,Object.assign({ref:O(d,t)},u,{children:n}))}));(0,o.createContext)({parentPortalElement:null});const se=({itemKey:e,items:t=[],separator:n,renderItem:s,separatorInterval:i=1,includeLastSeparator:c=!1})=>{const a=(0,o.useCallback)((e=>e===t.length-1?c:(e+1)%i==0),[c,i,t.length]);return(0,r.jsx)(q,{items:t,itemKey:e,renderItem:(e,t)=>(0,r.jsxs)(r.Fragment,{children:[s(e,t),a(t)&&n]})})},ie=({children:e,condition:t,fallback:n=null})=>(e=>"function"==typeof e?e():e)(t)?(0,r.jsx)(o.Fragment,{children:e}):(0,r.jsx)(o.Fragment,{children:n}),ce=({caseBy:e,value:t,defaultComponent:n=null})=>{var o;return function(e){return null==e}(t)?(0,r.jsx)(r.Fragment,{children:n}):(0,r.jsx)(r.Fragment,{children:null!==(o=e[t])&&void 0!==o?o:n})};function ae(e,t){(0,o.useEffect)((()=>{u(this,void 0,void 0,(function*(){yield e()}))}),t)}function le(e=!0){const t=k(e)?e():e;(0,o.useEffect)((()=>{if(!t)return;const e=e=>(e.preventDefault(),e.returnValue="");return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[t])}function ue(){const[e,t]=(0,o.useState)(!1),[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(!1);return{isError:n,isLoading:e,blockMultipleAsyncCalls:(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){if(!s.current){s.current=!0,t(!0),r(!1);try{return yield e()}catch(n){throw r(!0),n}finally{s.current=!1,t(!1)}}}))),[])}}function de(){const[e,t]=(0,o.useState)(null),[n,r]=(0,o.useState)(null),s=(0,o.useCallback)((e=>u(this,void 0,void 0,(function*(){try{const n=yield v(e);return t(n),!0}catch{return t(null),!1}}))),[]),i=(0,o.useCallback)(((e,n)=>u(this,void 0,void 0,(function*(){var r;const o=null!==(r=n?.toText)&&void 0!==r&&r;try{const n=yield b(e,{toText:o});return t(n),!0}catch{return t(null),!1}}))),[]),c=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]),a=(0,o.useCallback)((()=>u(this,void 0,void 0,(function*(){try{const t=yield function(){return f(this,0,void 0,(function*(){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}();return r(t),!0}catch{return r(null),!1}}))),[]);return{copiedData:e,readData:n,copyText:s,copyImage:i,readText:c,readContents:a}}const fe="modern-kit-local-storage",he="modern-kit-session-storage",pe={localStorage:{key:fe,subscribe:e=>{window.addEventListener(fe,e)},unsubscribe:e=>{window.removeEventListener(fe,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(fe))}},sessionStorage:{key:he,subscribe:e=>{window.addEventListener(he,e)},unsubscribe:e=>{window.removeEventListener(he,e)},dispatchEvent:()=>{window.dispatchEvent(new StorageEvent(he))}}},ge=e=>pe[e],me=ge("localStorage"),ve=e=>window.localStorage.getItem(e),we=e=>JSON.stringify(e),be=e=>(me.subscribe(e),()=>{me.unsubscribe(e)});function ye(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=k(n)?n():n,s=(0,o.useSyncExternalStore)(be,(()=>ve(t)),(()=>we(r)));return{state:(0,o.useMemo)((()=>s?$(s):r),[s,r]),setState:(0,o.useCallback)((e=>{try{const n=ve(t),o=n?$(n):r,s=k(e)?e(o):e;window.localStorage.setItem(t,JSON.stringify(s)),me.dispatchEvent()}catch(n){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.localStorage.removeItem(t),me.dispatchEvent()}catch(e){throw new Error(`\ub85c\uceec \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}const xe=(e,t)=>m()?window.matchMedia(e).matches:t??!1;function je(e,t){const[n,r]=(0,o.useState)(xe(e,t)),s=(0,o.useCallback)((e=>r(e.matches)),[]);return ne(window.matchMedia(e),"change",s),n}function ke(){return je("(prefers-color-scheme: dark)")?"dark":"light"}const Se="color-scheme";function Ce({defaultValue:e,key:t=Se,shouldSetBodyClass:n=!1}={}){const r=ke(),s=k(e)?e():e,{state:i,setState:c}=ye({key:t,initialValue:s??r}),a=(0,o.useCallback)((()=>{c((e=>"dark"===e?"light":"dark"))}),[c]),l=(0,o.useCallback)((()=>{c("dark")}),[c]),u=(0,o.useCallback)((()=>{c("light")}),[c]),d=(0,o.useCallback)((()=>{c(r)}),[c,r]);return(0,o.useEffect)((()=>(n&&document.body.classList.add(i),()=>{n&&document.body.classList.remove(i)})),[i,n]),{colorScheme:i,preferredColorScheme:r,setToggleMode:a,setDarkMode:l,setLightMode:u,setPreferredMode:d}}function Ee(e=0){const[t,n]=(0,o.useState)(e),r=(0,o.useCallback)((()=>{n((e=>e+1))}),[]),s=(0,o.useCallback)((()=>{n((e=>e-1))}),[]),i=(0,o.useCallback)((()=>{n(e)}),[e]);return{counter:t,setCounter:n,increment:r,decrement:s,reset:i}}function $e({maxStep:e,initialStep:t=0,infinite:n=!1}){const[r,s]=(0,o.useState)(t),i=r0,a=(0,o.useCallback)(((t,n)=>{const o="nextStep"===t;return n?o?0:e:o?r+1:r-1}),[e,r]),l=(0,o.useCallback)(((e,t,o)=>{if(t&&!n)return;const i=a(e,t);o&&o({prev:r,next:i}),s(i)}),[n,r,a]),u=(0,o.useCallback)((e=>{l("nextStep",!i,e)}),[i,l]),d=(0,o.useCallback)((e=>{l("prevStep",!c,e)}),[c,l]),f=(0,o.useCallback)(((t,n)=>{const o=k(t)?t(r):t;if(o>=0&&o<=e)return n&&n({prev:r,next:o}),void s(t);throw new Error("Step not valid")}),[r,e]),h=(0,o.useCallback)((e=>{e&&e({prev:r,next:t}),s(t)}),[r,t]);return{currentStep:r,hasNextStep:i,hasPrevStep:c,goToNextStep:u,goToPrevStep:d,setStep:f,resetStep:h}}function Oe(e,t=0){const{currentStep:n,goToNextStep:r,goToPrevStep:o,setStep:s,resetStep:i}=$e({maxStep:e.length-1,initialStep:t,infinite:!0});return{currentItem:e[n],nextIndex:r,prevIndex:o,setIndex:s,resetIndex:i}}function Re(e,t,n={}){const[r,s]=(0,o.useState)(e);return[r,_(s,t,n)]}function Ae(e,t={}){const[n,r]=(0,o.useState)(""),[s,i]=Re("",e,t);return{value:n,debouncedValue:s,onChange:(0,o.useCallback)((e=>{const{value:t}=e.target;r(t),i(t)}),[i]),onReset:(0,o.useCallback)((()=>{r(""),i("")}),[i])}}function Ie(e,{preserveTitleOnUnmount:t=!1}={}){ee((()=>{const n=document.title;return document.title=e,()=>{t||(document.title=n)}}),[e,t])}function Fe({onFocus:e=E,onBlur:t=E}={}){const[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(null),i=X((t=>{r(!0),e(t)})),c=X((e=>{r(!1),t(e)})),a=(0,o.useCallback)((()=>{s.current&&(s.current.focus(),r(!0))}),[]);return ne(s,"focus",i),ne(s,"blur",c),{ref:s,isFocus:n,setFocus:a}}function Ne({onEnter:e=E,onLeave:t=E}={}){const[n,r]=(0,o.useState)(!1),s=(0,o.useRef)(null),i=X((t=>{r(!0),e(t)})),c=X((e=>{r(!1),t(e)}));return ne(s,"mouseenter",i),ne(s,"mouseleave",c),{ref:s,isHovered:n}}const Pe=e=>{var t;return S(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function Le(e,t){const n=(0,o.useRef)(),r=X(e),{delay:s,enabled:i}=Pe(t),c=(0,o.useCallback)((()=>{n.current=window.setInterval(r,s)}),[r,s]),a=(0,o.useCallback)((()=>{n.current&&(clearInterval(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{a(),c()}),[a,c]);return(0,o.useEffect)((()=>{if(!(s<0)&&i)return c(),()=>a()}),[a,c,i,s]),{set:c,reset:l,clear:a}}function Me({enabled:e=!0,keyDownCallbackMap:t={},allKeyDownCallback:n}){const r=(0,o.useRef)(null),s=X((e=>{if(e.stopPropagation(),n)return void n(e);const r=e.key,o=t[r];k(o)&&o(e)}));return(0,o.useEffect)((()=>{if(!e)return;r.current||(r.current=window);const t=r.current;return t.addEventListener("keydown",s),()=>t.removeEventListener("keydown",s)}),[e,s]),r}const Te={screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,elementRelativeX:null,elementRelativeY:null,elementPositionX:null,elementPositionY:null};function Ue(){const e=(0,o.useRef)(null),[t,n]=(0,o.useState)(Te),r=(0,o.useCallback)((t=>{const{screenX:r,screenY:o,clientX:s,clientY:i,pageX:c,pageY:a}=t;let l=null,u=null,d=null,f=null;if(e.current){const t=e.current.getBoundingClientRect();l=s-t.left,u=i-t.top,d=t.left+window.scrollX,f=t.top+window.scrollY}n({screenX:r,screenY:o,clientX:s,clientY:i,pageX:c,pageY:a,elementRelativeX:l,elementRelativeY:u,elementPositionX:d,elementPositionY:f})}),[]);return ne(document,"mousemove",r),{ref:e,position:t}}const Ye=()=>navigator.onLine,Ve=()=>!0,De=(e,t,n)=>{const r=n=>(t(n),e()),o=t=>(n(t),e());return window.addEventListener("online",r),window.addEventListener("offline",o),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",o)}};function Xe({onlineAction:e=E,offlineAction:t=E}={}){const n=X((n=>De(n,e,t)));return(0,o.useSyncExternalStore)(n,Ye,Ve)}function Be(e){const t=(0,o.useRef)(e);return(0,o.useEffect)((()=>{t.current=e}),[e]),t.current}const We={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function _e(e=E){const[t,n]=(0,o.useState)(We),r=(0,o.useRef)(null),s=X((([t])=>{t&&(e(t),n(t.contentRect))}));return(0,o.useEffect)((()=>{if(!r.current)return;const e=r.current,t=new ResizeObserver(s);return t.observe(e),()=>{t.unobserve(e)}}),[s]),{ref:r,contentRect:t}}function ze({autoLock:e=!0}={}){const t=(0,o.useRef)(null),n=(0,o.useRef)(null),r=(0,o.useCallback)((()=>{const e=t.current;n.current=window.getComputedStyle(e).overflow,e.style.overflow="hidden"}),[]),s=(0,o.useCallback)((()=>{if(!n.current)return;t.current.style.overflow=n.current}),[]);return ee((()=>(t.current||(t.current=document.body),e&&r(),()=>s())),[e,r,s]),{ref:t,lock:r,unlock:s}}const Je=(e,t,n)=>"start"===n?0:"center"===n?-e/2+t/2:-e+t,He=(e,t,n)=>{const r=t.getBoundingClientRect(),{offsetX:o=0,offsetY:s=0,alignY:i="start",alignX:c="start"}=n;if(function(e){return e===window}(e))return{top:r.top+window.scrollY+s+Je(window.innerHeight,r.height,i),left:r.left+window.scrollX+o+Je(window.innerWidth,r.width,c)};const a=e.getBoundingClientRect();return{top:r.top-a.top+e.scrollTop+s+Je(a.height,r.height,i),left:r.left-a.left+e.scrollLeft+o+Je(a.width,r.width,c)}};function Ke(){const e=(0,o.useRef)(null),t=(0,o.useCallback)(((t={})=>{if(!e.current)return;const{left:n=0,top:r=0,behavior:o="auto"}=t;e.current.scrollTo({left:n,top:r,behavior:o})}),[]),n=(0,o.useCallback)(((t,n={})=>{if(!t||!e.current)return;const r=e.current,{behavior:o="auto"}=n,{left:s,top:i}=He(r,t,n);r.scrollTo({top:i,left:s,behavior:o})}),[]);return(0,o.useEffect)((()=>{e.current||(e.current=window)}),[]),{containerRef:e,scrollToPosition:t,scrollToElement:n}}const Ze=ge("sessionStorage"),Ge=e=>window.sessionStorage.getItem(e),Qe=e=>JSON.stringify(e),qe=e=>(Ze.subscribe(e),()=>{Ze.unsubscribe(e)});function et(e){const{key:t}=e,n="initialValue"in e?e.initialValue:null,r=k(n)?n():n,s=(0,o.useSyncExternalStore)(qe,(()=>Ge(t)),(()=>Qe(r)));return{state:(0,o.useMemo)((()=>s?$(s):r),[s,r]),setState:(0,o.useCallback)((e=>{try{const n=Ge(t),o=n?$(n):r,s=k(e)?e(o):e;window.sessionStorage.setItem(t,JSON.stringify(s)),Ze.dispatchEvent()}catch(n){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc5d0 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${n}`)}}),[t,r]),removeState:(0,o.useCallback)((()=>{try{window.sessionStorage.removeItem(t),Ze.dispatchEvent()}catch(e){throw new Error(`\uc138\uc158 \uc2a4\ud1a0\ub9ac\uc9c0 "${t}" key\uc758 \ub370\uc774\ud130\ub97c \uc0ad\uc81c\ud558\ub294\ub370 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4: ${e}`)}}),[t])}}function tt(e){var t;const n="initialState"in e?e.initialState:null,{type:r,key:s}=null!==(t=e?.storageOptions)&&void 0!==t?t:{},[i,c]=(0,o.useState)(n),a=(0,o.useCallback)((e=>{c((t=>{const n=k(e)?e(t):e;return r&&s&&function(e,t,n){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{const r=window[e],o=k(n)?n():n;r.setItem(t,JSON.stringify(o))}catch(r){throw new Error(`Failed to store data for key "${t}" in ${e}: ${r}`)}}(r,s,n),n}))}),[r,s]),l=(0,o.useCallback)((()=>{r&&s&&function(e,t){if(!m())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(t)}catch(n){throw new Error(`Failed to remove key "${t}" from ${e}: ${n}`)}}(r,s),c(null)}),[r,s]);return Object.assign({state:i,setState:a,clearState:l},$e(e))}function nt(e,t,n={}){const r=X(e),s=W(n),i=(0,o.useMemo)((()=>(0,c.A)(r,t,s)),[r,t,s]);return B((()=>i.cancel())),i}const rt=e=>{var t;return S(e)?{delay:e,enabled:!0}:{delay:e.delay,enabled:null===(t=e?.enabled)||void 0===t||t}};function ot(e,t){const n=(0,o.useRef)(),r=X(e),{delay:s,enabled:i}=rt(t),c=(0,o.useCallback)((()=>{n.current=setTimeout(r,s)}),[r,s]),a=(0,o.useCallback)((()=>{n.current&&(clearTimeout(n.current),n.current=null)}),[]),l=(0,o.useCallback)((()=>{a(),c()}),[a,c]);return(0,o.useEffect)((()=>{if(!(s<0)&&i)return c(),()=>a()}),[c,a,s,i]),{set:c,reset:l,clear:a}}function st(e,t){const[n,r]=(0,o.useState)(e);return[n,(0,o.useCallback)((()=>{r((n=>n===e?t:e))}),[e,t])]}function it(){const[e,t]=(0,o.useState)(null);return ee((()=>{const e=new a.UAParser(window.navigator.userAgent);t(e.getResult())}),[]),e}function ct({name:e="vh",enabledResize:t=!1}={}){ee((()=>{const n=()=>{const t=.01*window.innerHeight;document.documentElement.style.setProperty(`--${e}`,`${t}px`)};return n(),t&&window.addEventListener("resize",n),()=>{t&&window.removeEventListener("resize",n)}}),[e,t])}const at={width:null,height:null};function lt({debounceWait:e}={}){const[t,n]=(0,o.useState)((()=>g()?at:{width:window.innerWidth,height:window.innerHeight})),r=_(n,e),s=(0,o.useCallback)((()=>{(e?r:n)({width:window.innerWidth,height:window.innerHeight})}),[e,r]);return ne(window,"resize",s),t}function ut(e,t,n){const{delay:r,enabled:s}=rt(t),{set:i,reset:c,clear:a}=ot(e,{delay:r,enabled:!1});return(0,o.useEffect)((()=>{r<0||!s||c()}),[r,s,c,...n]),{set:i,reset:c,clear:a}}}}]);
\ No newline at end of file
diff --git a/assets/js/ad8813a3.b73e934f.js b/assets/js/ad8813a3.b73e934f.js
new file mode 100644
index 000000000..f5480025c
--- /dev/null
+++ b/assets/js/ad8813a3.b73e934f.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[632],{255:(e,n,r)=>{r.r(n),r.d(n,{Example:()=>h,assets:()=>l,contentTitle:()=>u,default:()=>f,frontMatter:()=>d,metadata:()=>t,toc:()=>p});const t=JSON.parse('{"id":"react/hooks/useUserAgent","title":"useUserAgent","description":"ua-parser-js \ub97c \ud65c\uc6a9\ud574\uc11c window.navigator.userAgent \uc815\ubcf4\ub97c \ubd84\uc11d\ud558\uace0 \ud30c\uc2f1\ud55c \ub370\uc774\ud130\ub97c \ubc18\ud658\ud558\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4.","source":"@site/docs/react/hooks/useUserAgent.mdx","sourceDirName":"react/hooks","slug":"/react/hooks/useUserAgent","permalink":"/modern-kit/docs/react/hooks/useUserAgent","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"useUnMount","permalink":"/modern-kit/docs/react/hooks/useUnmount"},"next":{"title":"useVhProperty","permalink":"/modern-kit/docs/react/hooks/useVhProperty"}}');var o=r(6206),i=r(3267),s=r(4382),c=r(5938),a=r(5907);const d={},u="useUserAgent",l={},h=()=>{const e={div:"div",h3:"h3",p:"p",...(0,i.R)()},n=function(){const[e,n]=(0,s.useState)(null);return(0,a.E)((()=>{const e=new c.UAParser(window.navigator.userAgent);n(e.getResult())}),[]),e}();return(0,o.jsxs)(e.div,{children:[(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.h3,{children:"UserAgent String"}),(0,o.jsx)(e.p,{children:`${n?.ua}`})]}),(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.h3,{children:"Browser"}),(0,o.jsxs)(e.p,{children:["name: ",`${n?.browser.name}`]}),(0,o.jsxs)(e.p,{children:["version: ",`${n?.browser.version}`]}),(0,o.jsxs)(e.p,{children:["major: ",`${n?.browser.major}`]})]}),(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.h3,{children:"Engine"}),(0,o.jsxs)(e.p,{children:["name: ",`${n?.engine.name}`]}),(0,o.jsxs)(e.p,{children:["version: ",`${n?.engine.version}`]})]}),(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.h3,{children:"OS"}),(0,o.jsxs)(e.p,{children:["name: ",`${n?.os.name}`]}),(0,o.jsxs)(e.p,{children:["version: ",`${n?.os.version}`]})]}),(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.h3,{children:"Device"}),(0,o.jsxs)(e.p,{children:["vendor: ",`${n?.device.vendor}`]}),(0,o.jsxs)(e.p,{children:["model: ",`${n?.device.model}`]}),(0,o.jsxs)(e.p,{children:["type: ",`${n?.device.type}`]})]}),(0,o.jsxs)(e.div,{children:[(0,o.jsx)(e.h3,{children:"CPU"}),(0,o.jsxs)(e.p,{children:["architecture: ",`${n?.cpu.architecture}`]})]})]})},p=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Example",id:"example",level:2}];function g(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",strong:"strong",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.header,{children:(0,o.jsx)(n.h1,{id:"useuseragent",children:"useUserAgent"})}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.strong,{children:(0,o.jsx)(n.a,{href:"https://github.com/faisalman/ua-parser-js",children:"ua-parser-js"})})," \ub97c \ud65c\uc6a9\ud574\uc11c ",(0,o.jsx)(n.code,{children:"window.navigator.userAgent"})," \uc815\ubcf4\ub97c \ubd84\uc11d\ud558\uace0 \ud30c\uc2f1\ud55c \ub370\uc774\ud130\ub97c \ubc18\ud658\ud558\ub294 \ucee4\uc2a4\ud140 \ud6c5\uc785\ub2c8\ub2e4."]}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(n.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/hooks/useUserAgent/index.ts",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(n.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",metastring:'title="typescript"',children:"const useUserAgent: () => UAParser.IResult | null\n"})}),"\n",(0,o.jsx)(n.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { useUserAgent } from '@modern-kit/react';\n\nconst Example = () => {\n const userAgent = useUserAgent();\n\n return (\n \n
\n
UserAgent String
\n
ua: {`${userAgent?.ua}`}
\n
\n
\n
Browser
\n
name: {`${userAgent?.browser.name}`}
\n
version: {`${userAgent?.browser.version}`}
\n
major: {`${userAgent?.browser.major}`}
\n
\n
\n
Engine
\n
name: {`${userAgent?.engine.name}`}
\n
version: {`${userAgent?.engine.version}`}
\n
\n
\n
OS
\n
name: {`${userAgent?.os.name}`}
\n
version: {`${userAgent?.os.version}`}
\n
\n
\n
Device
\n
vendor: {`${userAgent?.device.vendor}`}
\n
model: {`${userAgent?.device.model}`}
\n
type: {`${userAgent?.device.type}`}
\n
\n
\n
CPU
\n
architecture: {`${userAgent?.cpu.architecture}`}
\n
\n
\n );\n};\n"})}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"})]})}function f(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(g,{...e})}):g(e)}},5907:(e,n,r)=>{r.d(n,{E:()=>i});var t=r(9340),o=r(4382);const i=(0,t.oc)()?o.useLayoutEffect:o.useEffect},9340:(e,n,r)=>{function t(e,n,r,t){return new(r||(r=Promise))((function(o,i){function s(e){try{a(t.next(e))}catch(n){i(n)}}function c(e){try{a(t.throw(e))}catch(n){i(n)}}function a(e){var n;e.done?o(e.value):(n=e.value,n instanceof r?n:new r((function(e){e(n)}))).then(s,c)}a((t=t.apply(e,n||[])).next())}))}r.d(n,{Et:()=>j,Fr:()=>c,Gp:()=>v,Ol:()=>k,Qd:()=>b,S$:()=>s,Tn:()=>w,Zp:()=>h,dK:()=>d,fl:()=>S,gD:()=>x,i5:()=>g,if:()=>p,l6:()=>$,lQ:()=>A,nS:()=>l,ni:()=>C,oc:()=>a}),"function"==typeof SuppressedError&&SuppressedError;const o={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};const i=(e,n)=>new Promise(((r,t)=>{e.toBlob((e=>{e?r(e):t(new Error(`Failed to create blob with format ${n}`))}),n)}));function s(){return"undefined"==typeof window}function c(){if(s())return!1;const e=window.navigator.userAgent;return/Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|IEMobile|Opera Mini/i.test(e)}function a(){return!s()}function d(e){return t(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return"clipboard"in window.navigator?(yield navigator.clipboard.writeText(e),e):function(e){const n=document.createElement("textarea");n.value=e,n.style.opacity="0",document.body.appendChild(n),n.focus(),n.select();try{return document.execCommand("copy"),e}catch(r){throw console.error(`Failed to copy to clipboard. message: ${r.message}`),r}finally{document.body.removeChild(n)}}(e)}catch(n){throw console.error(`Failed to copy to clipboard. message: ${n.message}`),n}}))}const u=e=>t(void 0,void 0,void 0,(function*(){const n=yield fetch(e);return d(yield n.text())}));function l(e,n){var r;return t(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{if(!("clipboard"in window.navigator))return u(e);if(!("write"in window.navigator.clipboard))return u(e);if(null!==(r=null==n?void 0:n.toText)&&void 0!==r&&r)return u(e);const s=yield function(e,n="png"){return new Promise(((r,s)=>{const c=new Image;c.onload=()=>t(this,void 0,void 0,(function*(){const e=document.createElement("canvas");e.width=c.width,e.height=c.height;try{const t=e.getContext("2d");if(!t)throw new Error("Failed to get 2d context");t.drawImage(c,0,0);const s=yield i(e,o[n]);r(s)}catch(t){console.error(`Failed to load image. message: ${t.mesaage}`),s(t)}})),c.onerror=()=>{s(new Error("Failed to load image"))},c.src=e}))}(e,"png");return yield navigator.clipboard.write([new ClipboardItem({[s.type]:s})]),s}catch(s){throw console.error(`Failed to copy to clipboard. message: ${s.message}`),s}}))}function h(){return t(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.read()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function p(){return t(this,void 0,void 0,(function*(){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{return yield navigator.clipboard.readText()}catch(e){throw console.error(`Failed to read clipboard. message: ${e.message}`),e}}))}function g(e,n){return Object.prototype.hasOwnProperty.call(e,n)}const f=(e,n,r)=>{const t=Object.keys(e),o=Object.keys(n);if(t.length!==o.length)return!1;for(let i=0;i{if(e===n)return!0;if(j(e)&&j(n)&&isNaN(e)&&isNaN(n))return!0;if(w(e)&&w(n))return e.toString()===n.toString();if("object"!=typeof e||"object"!=typeof n||null===e||null===n)return!1;if(r.has(e)&&r.get(e)===n)return!0;if(r.set(e,n),e.constructor!==n.constructor)return!1;if(e instanceof Set){if(e.size!==n.size)return!1;const t=[...e],o=[...n];return f(t,o,r)}if(e instanceof Map){if(e.size!==n.size)return!1;for(const[t,o]of e)if(!n.has(t)||!m(o,n.get(t),r))return!1;return!0}return f(e,n,r)};function v(e,n){return m(e,n,new WeakMap)}function w(e){return"function"==typeof e}function x(e){return null==e}function j(e){return"number"==typeof e}function y(e){return!function(e){return Object(e)!==e}(e)}function b(e){return y(e)&&"[object Object]"===Object.prototype.toString.call(e)}function $(e){return e===window}function A(){}function k(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(n){throw new Error(`Failed to parse data: ${n}`)}}function E(e){return Object.keys(e)}const U={days:864e5,hours:36e5,minutes:6e4,seconds:1e3};E(U);function S(e,n){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{window[e].removeItem(n)}catch(r){throw new Error(`Failed to remove key "${n}" from ${e}: ${r}`)}}function C(e,n,r){if(!a())throw new Error("Cannot be executed unless it is a client environment.");try{const t=window[e],o=w(r)?r():r;t.setItem(n,JSON.stringify(o))}catch(t){throw new Error(`Failed to store data for key "${n}" in ${e}: ${t}`)}}}}]);
\ No newline at end of file
diff --git a/assets/js/af3233c2.b6ff46a8.js b/assets/js/af3233c2.b6ff46a8.js
deleted file mode 100644
index 069f6ec84..000000000
--- a/assets/js/af3233c2.b6ff46a8.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunk_modern_kit_docs=self.webpackChunk_modern_kit_docs||[]).push([[1376],{3614:(e,t,n)=>{n.r(t),n.d(t,{Button:()=>u,SlottableButton:()=>d,assets:()=>a,contentTitle:()=>c,default:()=>p,frontMatter:()=>l,metadata:()=>r,toc:()=>h});const r=JSON.parse('{"id":"react/components/Slot","title":"Slot","description":"\uc8fc\uc5b4\uc9c4 Props\ub97c \uc9c1\uacc4 \uc790\uc2dd \ucef4\ud3ec\ub10c\ud2b8\uc5d0 \ubcd1\ud569\ud558\uace0, \uc790\uc2dd \ucef4\ud3ec\ub10c\ud2b8\ub97c \ub80c\ub354\ub9c1\ud558\ub294 \ucef4\ud3ec\ub10c\ud2b8\uc785\ub2c8\ub2e4.","source":"@site/docs/react/components/Slot.mdx","sourceDirName":"react/components","slug":"/react/components/Slot","permalink":"/modern-kit/docs/react/components/Slot","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"SeparatedIterator","permalink":"/modern-kit/docs/react/components/SeparatedIterator"},"next":{"title":"SwitchCase","permalink":"/modern-kit/docs/react/components/SwithCase"}}');var o=n(6206),i=n(3267),s=n(4027);const l={},c="Slot",a={},u=({asChild:e,...t})=>{const n=e?s.DX:"button";return(0,o.jsx)(n,{...t})},d=({asChild:e,leftElement:t,rightElement:n,...r})=>{const i=e?s.DX:"button";return(0,o.jsxs)(i,{...r,children:[t,(0,o.jsx)(s.xV,{children:r.children}),n]})},h=[{value:"Code",id:"code",level:2},{value:"Interface",id:"interface",level:2},{value:"Usage",id:"usage",level:2},{value:"Default",id:"default",level:3},{value:"With Slottable",id:"with-slottable",level:3},{value:"Example",id:"example",level:2},{value:"Default",id:"default-1",level:3},{value:"AsChild",id:"aschild",level:3},{value:"Slottable",id:"slottable",level:3}];function f(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",ol:"ol",p:"p",pre:"pre",span:"span",strong:"strong",ul:"ul",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.header,{children:(0,o.jsx)(t.h1,{id:"slot",children:"Slot"})}),"\n",(0,o.jsx)(t.p,{children:"\uc8fc\uc5b4\uc9c4 Props\ub97c \uc9c1\uacc4 \uc790\uc2dd \ucef4\ud3ec\ub10c\ud2b8\uc5d0 \ubcd1\ud569\ud558\uace0, \uc790\uc2dd \ucef4\ud3ec\ub10c\ud2b8\ub97c \ub80c\ub354\ub9c1\ud558\ub294 \ucef4\ud3ec\ub10c\ud2b8\uc785\ub2c8\ub2e4."}),"\n",(0,o.jsxs)(t.p,{children:["Slot\uc740 \ubd80\ubaa8 \ucef4\ud3ec\ub10c\ud2b8\uc758 \uae30\ub2a5\uc744 \uc790\uc2dd \ucef4\ud3ec\ub10c\ud2b8\uc640 \ud569\uc131\ud558\ub294 ",(0,o.jsx)(t.code,{children:"\ud569\uc131(Composition)"})," \ud328\ud134\uc744 \uad6c\ud604\ud569\ub2c8\ub2e4. \uc774\ub97c \ud1b5\ud574:"]}),"\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsxs)(t.li,{children:["\ubd80\ubaa8 \ucef4\ud3ec\ub10c\ud2b8\uc758 ",(0,o.jsx)(t.code,{children:"props"}),", ",(0,o.jsx)(t.code,{children:"ref"}),", ",(0,o.jsx)(t.code,{children:"\uc774\ubca4\ud2b8 \ud578\ub4e4\ub7ec"})," \ub4f1\uc744 \uc790\uc2dd \ucef4\ud3ec\ub10c\ud2b8\uc5d0 \uc804\ub2ec\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4"]}),"\n",(0,o.jsx)(t.li,{children:"\uc790\uc2dd \ucef4\ud3ec\ub10c\ud2b8\uc758 \uad6c\ud604\uc744 \ubcc0\uacbd\ud558\uc9c0 \uc54a\uace0\ub3c4 \uc0c8\ub85c\uc6b4 \uae30\ub2a5\uc744 \ucd94\uac00\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4"}),"\n",(0,o.jsx)(t.li,{children:"\ucef4\ud3ec\ub10c\ud2b8 \uac04\uc758 \uacb0\ud569\ub3c4\ub97c \ub0ae\ucd94\uace0 \uc7ac\uc0ac\uc6a9\uc131\uc744 \ub192\uc77c \uc218 \uc788\uc2b5\ub2c8\ub2e4"}),"\n"]}),"\n",(0,o.jsxs)(t.p,{children:["\uc608\ub97c \ub4e4\uc5b4 ",(0,o.jsx)(t.strong,{children:(0,o.jsx)(t.a,{href:"https://modern-agile-team.github.io/modern-kit/docs/react/components/InView",children:"InView"})})," \ub098 ",(0,o.jsx)(t.strong,{children:(0,o.jsx)(t.a,{href:"https://modern-agile-team.github.io/modern-kit/docs/react/components/AspectRatio",children:"AspectRatio"})})," \uc640 \uac19\uc740 \ucef4\ud3ec\ub10c\ud2b8\uc5d0\uc11c ",(0,o.jsx)(t.code,{children:"asChild"})," prop\uc744 \uc0ac\uc6a9\ud574\uc11c, \ub798\ud37c \uc694\uc18c \uc5c6\uc774 \uc790\uc2dd \ucef4\ud3ec\ub10c\ud2b8\uc5d0 \uc9c1\uc811 \uae30\ub2a5\uc744 \uc8fc\uc785\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."]}),"\n",(0,o.jsx)(t.p,{children:"Slot\uc740 \uc544\ub798\uc640 \uac19\uc740 \ud2b9\uc9d5\uc774 \uc788\uc2b5\ub2c8\ub2e4."}),"\n",(0,o.jsxs)(t.ol,{children:["\n",(0,o.jsxs)(t.li,{children:["\uc790\uc2dd \uc694\uc18c\ub85c ",(0,o.jsx)(t.code,{children:"\ub2e8\uc77c \uc694\uc18c"}),"\ub9cc \ud5c8\uc6a9\ub429\ub2c8\ub2e4."]}),"\n"]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"// \uac00\ub2a5\n\n Contents
\n\n\n// \uac00\ub2a5\n\n \n
Contents1
\n
Contents2
\n
\n\n"})}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"// \ubd88\uac00\ub2a5\n\n Contents1
\n Contents2
\n\n"})}),"\n",(0,o.jsxs)(t.ol,{start:"2",children:["\n",(0,o.jsxs)(t.li,{children:["\uc790\uc2dd \uc694\uc18c\ub85c \ucef4\ud3ec\ub10c\ud2b8\uac00 \uc628\ub2e4\uba74 \ud574\ub2f9 \ucef4\ud3ec\ub10c\ud2b8\ub294 \ud544\uc218\uc801\uc73c\ub85c ",(0,o.jsx)(t.code,{children:"forwardRef"}),", ",(0,o.jsx)(t.code,{children:"props"}),"\ub97c \ud5c8\uc6a9\ud574\uc57c \ud569\ub2c8\ub2e4. \ud5c8\uc6a9\ud558\uc9c0 \uc54a\uc73c\uba74 \uae30\ub2a5\uc774 \uc815\uc0c1\uc801\uc73c\ub85c \ub3d9\uc791\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."]}),"\n"]}),"\n",(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsx)(t.li,{children:(0,o.jsx)(t.strong,{children:(0,o.jsx)(t.a,{href:"https://www.radix-ui.com/primitives/docs/guides/composition#your-component-must-spread-props",children:"radix-ui#your-component-must-spread-props"})})}),"\n",(0,o.jsx)(t.li,{children:(0,o.jsx)(t.strong,{children:(0,o.jsx)(t.a,{href:"https://www.radix-ui.com/primitives/docs/guides/composition#your-component-must-forward-ref",children:"radix-ui#your-component-must-forward-ref"})})}),"\n"]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"const MyButton = React.forwardRef((props, forwardedRef) => (\n \n));\n\n\n Button\n\n"})}),"\n",(0,o.jsx)("br",{}),"\n",(0,o.jsx)(t.h2,{id:"code",children:"Code"}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.a,{href:"https://github.com/modern-agile-team/modern-kit/blob/main/packages/react/src/components/Slot/index.tsx",children:"\ud83d\udd17 \uc2e4\uc81c \uad6c\ud604 \ucf54\ub4dc \ud655\uc778"})}),"\n",(0,o.jsx)(t.h2,{id:"interface",children:"Interface"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"const Slot: React.ForwardRefExoticComponent<\n React.HTMLAttributes & {\n children?: React.ReactNode;\n } & React.RefAttributes\n>;\n"})}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-ts",metastring:'title="typescript"',children:"const Slottable: ({ children }: React.PropsWithChildren) => JSX.Element;\n"})}),"\n",(0,o.jsx)(t.h2,{id:"usage",children:"Usage"}),"\n",(0,o.jsx)(t.h3,{id:"default",children:"Default"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:'title="typescript"',children:"import { Slot } from '@modern-kit/react'\n\nconst Button = ({\n asChild,\n ...props\n}: PropsWithChildren<{ asChild?: boolean } & ComponentProps<'button'>>) => {\n const Comp = asChild ? Slot : 'button';\n\n return ;\n};\n"})}),"\n",(0,o.jsx)(t.h3,{id:"with-slottable",children:"With Slottable"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-tsx",metastring:"title='typescript'",children:"const SlottableButton = ({\n asChild,\n leftElement,\n rightElement,\n ...props\n}: PropsWithChildren<\n {\n asChild?: boolean;\n leftElement: ReactElement;\n rightElement: ReactElement;\n } & ComponentProps<'button'>\n>) => {\n const Comp = asChild ? Slot : 'button';\n\n return (\n \n {leftElement}\n