@siberiacancode/reactuse 0.0.35 → 0.0.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/dist/cjs/{_rollupPluginBabelHelpers-KdNaXDbY.js → _rollupPluginBabelHelpers-KriNlOmj.js} +2 -2
  2. package/dist/cjs/_rollupPluginBabelHelpers-KriNlOmj.js.map +1 -0
  3. package/dist/cjs/hooks/index.js +2 -2
  4. package/dist/cjs/hooks/useBattery/useBattery.js +2 -2
  5. package/dist/cjs/hooks/useBattery/useBattery.js.map +1 -1
  6. package/dist/cjs/hooks/useBoolean/useBoolean.js +2 -2
  7. package/dist/cjs/hooks/useBrowserLanguage/useBrowserLanguage.js +1 -1
  8. package/dist/cjs/hooks/useClickOutside/useClickOutside.js +1 -1
  9. package/dist/cjs/hooks/useCopyToClipboard/useCopyToClipboard.js +2 -2
  10. package/dist/cjs/hooks/useCounter/useCounter.js +2 -2
  11. package/dist/cjs/hooks/useDebounceCallback/useDebounceCallback.js +1 -1
  12. package/dist/cjs/hooks/useDebounceValue/useDebounceValue.js +2 -2
  13. package/dist/cjs/hooks/useDefault/useDefault.js +2 -2
  14. package/dist/cjs/hooks/useDidUpdate/useDidUpdate.js +1 -1
  15. package/dist/cjs/hooks/useDocumentEvent/useDocumentEvent.js +1 -1
  16. package/dist/cjs/hooks/useDocumentTitle/useDocumentTitle.js +2 -2
  17. package/dist/cjs/hooks/useDocumentVisibility/useDocumentVisibility.js +1 -1
  18. package/dist/cjs/hooks/useEvent/useEvent.js +1 -1
  19. package/dist/cjs/hooks/useEventListener/useEventListener.js +1 -1
  20. package/dist/cjs/hooks/useEyeDropper/useEyeDropper.js +2 -2
  21. package/dist/cjs/hooks/useEyeDropper/useEyeDropper.js.map +1 -1
  22. package/dist/cjs/hooks/useFavicon/useFavicon.js +2 -2
  23. package/dist/cjs/hooks/useField/useField.js +2 -2
  24. package/dist/cjs/hooks/useFps/useFps.js +2 -2
  25. package/dist/cjs/hooks/useFullscreen/useFullscreen.js +2 -2
  26. package/dist/cjs/hooks/useHash/useHash.js +2 -2
  27. package/dist/cjs/hooks/useHotkeys/useHotkeys.js +2 -2
  28. package/dist/cjs/hooks/useHover/useHover.js +2 -2
  29. package/dist/cjs/hooks/useIdle/useIdle.js +2 -2
  30. package/dist/cjs/hooks/useIntersectionObserver/useIntersectionObserver.js +2 -2
  31. package/dist/cjs/hooks/useInterval/useInterval.js +2 -2
  32. package/dist/cjs/hooks/useIsFirstRender/useIsFirstRender.js +1 -1
  33. package/dist/cjs/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +1 -1
  34. package/dist/cjs/hooks/useKeyPress/useKeyPress.js +2 -2
  35. package/dist/cjs/hooks/useKeyPressEvent/useKeyPressEvent.js +1 -1
  36. package/dist/cjs/hooks/useKeyboard/useKeyboard.js +1 -1
  37. package/dist/cjs/hooks/useKeysPressed/useKeysPressed.js +2 -2
  38. package/dist/cjs/hooks/useList/useList.js +2 -2
  39. package/dist/cjs/hooks/useLocalStorage/useLocalStorage.js +2 -2
  40. package/dist/cjs/hooks/useLogger/useLogger.js +2 -2
  41. package/dist/cjs/hooks/useLongPress/useLongPress.js +2 -2
  42. package/dist/cjs/hooks/useMediaQuery/useMediaQuery.js +1 -1
  43. package/dist/cjs/hooks/useMount/useMount.js +1 -1
  44. package/dist/cjs/hooks/useMouse/useMouse.js +2 -2
  45. package/dist/cjs/hooks/useMutation/useMutation.js +2 -2
  46. package/dist/cjs/hooks/useMutationObserver.js +1 -1
  47. package/dist/cjs/hooks/useNetwork/useNetwork.js +2 -2
  48. package/dist/cjs/hooks/useNetwork/useNetwork.js.map +1 -1
  49. package/dist/cjs/hooks/useOnline/useOnline.js +1 -1
  50. package/dist/cjs/hooks/useOperatingSystem/useOperatingSystem.js +1 -1
  51. package/dist/cjs/hooks/useOrientation/useOrientation.js +2 -2
  52. package/dist/cjs/hooks/usePageLeave/usePageLeave.js +2 -2
  53. package/dist/cjs/hooks/usePaint/usePaint.js +2 -2
  54. package/dist/cjs/hooks/usePreferredColorScheme/usePreferredColorScheme.js +1 -1
  55. package/dist/cjs/hooks/usePreferredLanguages/usePreferredLanguages.js +1 -1
  56. package/dist/cjs/hooks/usePrevious/usePrevious.js +1 -1
  57. package/dist/cjs/hooks/useQuery/useQuery.js +2 -2
  58. package/dist/cjs/hooks/useQueue/useQueue.js +2 -2
  59. package/dist/cjs/hooks/useRenderCount/useRenderCount.js +1 -1
  60. package/dist/cjs/hooks/useRenderInfo/useRenderInfo.js +1 -1
  61. package/dist/cjs/hooks/useRerender/useRerender.js +2 -2
  62. package/dist/cjs/hooks/useScript/useScript.js +2 -2
  63. package/dist/cjs/hooks/useSessionStorage/useSessionStorage.js +2 -2
  64. package/dist/cjs/hooks/useSet/useSet.js +2 -2
  65. package/dist/cjs/hooks/useStep/useStep.js +2 -2
  66. package/dist/cjs/hooks/useStorage/useStorage.js +2 -2
  67. package/dist/cjs/hooks/useTextSelection/useTextSelection.js +2 -2
  68. package/dist/cjs/hooks/useTime/useTime.js +2 -2
  69. package/dist/cjs/hooks/useTimeout/useTimeout.js +2 -2
  70. package/dist/cjs/hooks/useToggle/useToggle.js +2 -2
  71. package/dist/cjs/hooks/useUnmount/useUnmount.js +1 -1
  72. package/dist/cjs/hooks/useWebSocket/useWebSocket.js +2 -2
  73. package/dist/cjs/hooks/useWindowEvent/useWindowEvent.js +1 -1
  74. package/dist/cjs/hooks/useWindowSize/useWindowSize.js +2 -2
  75. package/dist/cjs/index.js +2 -2
  76. package/dist/cjs/utils/helpers/debounce.js +1 -1
  77. package/dist/cjs/utils/helpers/getRetry.js +1 -1
  78. package/dist/cjs/utils/helpers/index.js +1 -1
  79. package/dist/cjs/utils/helpers/isClient.js +1 -1
  80. package/dist/cjs/utils/helpers/throttle.js +1 -1
  81. package/dist/cjs/utils/helpers/time/getDate.js +1 -1
  82. package/dist/cjs/utils/types/index.js +3 -0
  83. package/dist/cjs/utils/types/index.js.map +1 -0
  84. package/dist/esm/{_rollupPluginBabelHelpers-CEUGrTA3.js → _rollupPluginBabelHelpers-BUclQybi.js} +2 -2
  85. package/dist/esm/_rollupPluginBabelHelpers-BUclQybi.js.map +1 -0
  86. package/dist/esm/hooks/index.js +2 -2
  87. package/dist/esm/hooks/useBattery/useBattery.js +2 -2
  88. package/dist/esm/hooks/useBattery/useBattery.js.map +1 -1
  89. package/dist/esm/hooks/useBoolean/useBoolean.js +2 -2
  90. package/dist/esm/hooks/useBrowserLanguage/useBrowserLanguage.js +1 -1
  91. package/dist/esm/hooks/useClickOutside/useClickOutside.js +1 -1
  92. package/dist/esm/hooks/useCopyToClipboard/useCopyToClipboard.js +2 -2
  93. package/dist/esm/hooks/useCounter/useCounter.js +2 -2
  94. package/dist/esm/hooks/useDebounceCallback/useDebounceCallback.js +1 -1
  95. package/dist/esm/hooks/useDebounceValue/useDebounceValue.js +2 -2
  96. package/dist/esm/hooks/useDefault/useDefault.js +2 -2
  97. package/dist/esm/hooks/useDidUpdate/useDidUpdate.js +1 -1
  98. package/dist/esm/hooks/useDocumentEvent/useDocumentEvent.js +1 -1
  99. package/dist/esm/hooks/useDocumentTitle/useDocumentTitle.js +2 -2
  100. package/dist/esm/hooks/useDocumentVisibility/useDocumentVisibility.js +1 -1
  101. package/dist/esm/hooks/useEvent/useEvent.js +1 -1
  102. package/dist/esm/hooks/useEventListener/useEventListener.js +1 -1
  103. package/dist/esm/hooks/useEyeDropper/useEyeDropper.js +2 -2
  104. package/dist/esm/hooks/useEyeDropper/useEyeDropper.js.map +1 -1
  105. package/dist/esm/hooks/useFavicon/useFavicon.js +2 -2
  106. package/dist/esm/hooks/useField/useField.js +2 -2
  107. package/dist/esm/hooks/useFps/useFps.js +2 -2
  108. package/dist/esm/hooks/useFullscreen/useFullscreen.js +2 -2
  109. package/dist/esm/hooks/useHash/useHash.js +2 -2
  110. package/dist/esm/hooks/useHotkeys/useHotkeys.js +2 -2
  111. package/dist/esm/hooks/useHover/useHover.js +2 -2
  112. package/dist/esm/hooks/useIdle/useIdle.js +2 -2
  113. package/dist/esm/hooks/useIntersectionObserver/useIntersectionObserver.js +2 -2
  114. package/dist/esm/hooks/useInterval/useInterval.js +2 -2
  115. package/dist/esm/hooks/useIsFirstRender/useIsFirstRender.js +1 -1
  116. package/dist/esm/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +1 -1
  117. package/dist/esm/hooks/useKeyPress/useKeyPress.js +2 -2
  118. package/dist/esm/hooks/useKeyPressEvent/useKeyPressEvent.js +1 -1
  119. package/dist/esm/hooks/useKeyboard/useKeyboard.js +1 -1
  120. package/dist/esm/hooks/useKeysPressed/useKeysPressed.js +2 -2
  121. package/dist/esm/hooks/useList/useList.js +2 -2
  122. package/dist/esm/hooks/useLocalStorage/useLocalStorage.js +2 -2
  123. package/dist/esm/hooks/useLogger/useLogger.js +2 -2
  124. package/dist/esm/hooks/useLongPress/useLongPress.js +2 -2
  125. package/dist/esm/hooks/useMediaQuery/useMediaQuery.js +1 -1
  126. package/dist/esm/hooks/useMount/useMount.js +1 -1
  127. package/dist/esm/hooks/useMouse/useMouse.js +2 -2
  128. package/dist/esm/hooks/useMutation/useMutation.js +2 -2
  129. package/dist/esm/hooks/useMutationObserver.js +1 -1
  130. package/dist/esm/hooks/useNetwork/useNetwork.js +2 -2
  131. package/dist/esm/hooks/useNetwork/useNetwork.js.map +1 -1
  132. package/dist/esm/hooks/useOnline/useOnline.js +1 -1
  133. package/dist/esm/hooks/useOperatingSystem/useOperatingSystem.js +1 -1
  134. package/dist/esm/hooks/useOrientation/useOrientation.js +2 -2
  135. package/dist/esm/hooks/usePageLeave/usePageLeave.js +2 -2
  136. package/dist/esm/hooks/usePaint/usePaint.js +2 -2
  137. package/dist/esm/hooks/usePreferredColorScheme/usePreferredColorScheme.js +1 -1
  138. package/dist/esm/hooks/usePreferredLanguages/usePreferredLanguages.js +1 -1
  139. package/dist/esm/hooks/usePrevious/usePrevious.js +1 -1
  140. package/dist/esm/hooks/useQuery/useQuery.js +2 -2
  141. package/dist/esm/hooks/useQueue/useQueue.js +2 -2
  142. package/dist/esm/hooks/useRenderCount/useRenderCount.js +1 -1
  143. package/dist/esm/hooks/useRenderInfo/useRenderInfo.js +1 -1
  144. package/dist/esm/hooks/useRerender/useRerender.js +2 -2
  145. package/dist/esm/hooks/useScript/useScript.js +2 -2
  146. package/dist/esm/hooks/useSessionStorage/useSessionStorage.js +2 -2
  147. package/dist/esm/hooks/useSet/useSet.js +2 -2
  148. package/dist/esm/hooks/useStep/useStep.js +2 -2
  149. package/dist/esm/hooks/useStorage/useStorage.js +2 -2
  150. package/dist/esm/hooks/useTextSelection/useTextSelection.js +2 -2
  151. package/dist/esm/hooks/useTime/useTime.js +2 -2
  152. package/dist/esm/hooks/useTimeout/useTimeout.js +2 -2
  153. package/dist/esm/hooks/useToggle/useToggle.js +2 -2
  154. package/dist/esm/hooks/useUnmount/useUnmount.js +1 -1
  155. package/dist/esm/hooks/useWebSocket/useWebSocket.js +2 -2
  156. package/dist/esm/hooks/useWindowEvent/useWindowEvent.js +1 -1
  157. package/dist/esm/hooks/useWindowSize/useWindowSize.js +2 -2
  158. package/dist/esm/index.js +2 -2
  159. package/dist/esm/utils/helpers/debounce.js +1 -1
  160. package/dist/esm/utils/helpers/getRetry.js +1 -1
  161. package/dist/esm/utils/helpers/index.js +1 -1
  162. package/dist/esm/utils/helpers/isClient.js +1 -1
  163. package/dist/esm/utils/helpers/throttle.js +1 -1
  164. package/dist/esm/utils/helpers/time/getDate.js +1 -1
  165. package/dist/esm/utils/types/index.js +2 -0
  166. package/dist/esm/utils/types/index.js.map +1 -0
  167. package/dist/index.d.ts +19 -67
  168. package/package.json +4 -8
  169. package/dist/cjs/_rollupPluginBabelHelpers-KdNaXDbY.js.map +0 -1
  170. package/dist/cjs/hooks/useQRCode/useQRCode.js +0 -3
  171. package/dist/cjs/hooks/useQRCode/useQRCode.js.map +0 -1
  172. package/dist/esm/_rollupPluginBabelHelpers-CEUGrTA3.js.map +0 -1
  173. package/dist/esm/hooks/useQRCode/useQRCode.js +0 -3
  174. package/dist/esm/hooks/useQRCode/useQRCode.js.map +0 -1
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.35 */
2
- import{_ as r}from"../../_rollupPluginBabelHelpers-CEUGrTA3.js";import{useState as e,useRef as t,useEffect as o}from"react";import{useEvent as u}from"../useEvent/useEvent.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";function i(i,n){var c=e(!1),s=r(c,2),m=s[0],f=s[1],l=t(),p=u(i);o((function(){return l.current=setTimeout((function(){p(),f(!0)}),n),function(){clearTimeout(l.current)}}),[n]);return{ready:m,clear:function(){clearTimeout(l.current),f(!0)}}}export{i as useTimeout};
1
+ /* @license @siberiacancode/reactuse v0.0.37 */
2
+ import{_ as r}from"../../_rollupPluginBabelHelpers-BUclQybi.js";import{useState as e,useRef as t,useEffect as o}from"react";import{useEvent as u}from"../useEvent/useEvent.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";function i(i,n){var c=e(!1),s=r(c,2),m=s[0],f=s[1],l=t(),p=u(i);o((function(){return l.current=setTimeout((function(){p(),f(!0)}),n),function(){clearTimeout(l.current)}}),[n]);return{ready:m,clear:function(){clearTimeout(l.current),f(!0)}}}export{i as useTimeout};
3
3
  //# sourceMappingURL=useTimeout.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.35 */
2
- import{_ as r}from"../../_rollupPluginBabelHelpers-CEUGrTA3.js";import{useReducer as n}from"react";var t=function(){var t=n((function(r,n){var t=n instanceof Function?n(r[0]):n,e=Math.abs(r.indexOf(t));return r.slice(e).concat(r.slice(0,e))}),arguments.length>0&&void 0!==arguments[0]?arguments[0]:[!1,!0]),e=r(t,2);return[r(e[0],1)[0],e[1]]};export{t as useToggle};
1
+ /* @license @siberiacancode/reactuse v0.0.37 */
2
+ import{_ as r}from"../../_rollupPluginBabelHelpers-BUclQybi.js";import{useReducer as n}from"react";var t=function(){var t=n((function(r,n){var t=n instanceof Function?n(r[0]):n,e=Math.abs(r.indexOf(t));return r.slice(e).concat(r.slice(0,e))}),arguments.length>0&&void 0!==arguments[0]?arguments[0]:[!1,!0]),e=r(t,2);return[r(e[0],1)[0],e[1]]};export{t as useToggle};
3
3
  //# sourceMappingURL=useToggle.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.35 */
1
+ /* @license @siberiacancode/reactuse v0.0.37 */
2
2
  import{useRef as r,useEffect as n}from"react";var t=function(t){var c=r(t);c.current=t,n((function(){return function(){c.current()}}),[])};export{t as useUnmount};
3
3
  //# sourceMappingURL=useUnmount.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.35 */
2
- import{_ as n}from"../../_rollupPluginBabelHelpers-CEUGrTA3.js";import{useRef as r,useState as e,useEffect as o}from"react";import{getRetry as t}from"../../utils/helpers/getRetry.js";import"../../utils/helpers/isClient.js";import{useEvent as u}from"../useEvent/useEvent.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";var c=function(c,l){var i=r(),s=r(null!=l&&l.retry?t(l.retry):0),f=r(!1),a=e("connecting"),v=n(a,2),d=v[0],p=v[1],m=u((function(){i.current=new WebSocket("function"==typeof c?c():c,null==l?void 0:l.protocols),p("connecting");var n=i.current;n&&(n.onopen=function(){var r;p("connected"),null==l||null===(r=l.onConnected)||void 0===r||r.call(l,n)},n.onerror=function(r){var e;p("failed"),null==l||null===(e=l.onError)||void 0===e||e.call(l,r,n)},n.onmessage=function(r){var e;return null==l||null===(e=l.onMessage)||void 0===e?void 0:e.call(l,r,n)},n.onclose=function(r){var e;if(p("disconnected"),null==l||null===(e=l.onDisconnected)||void 0===e||e.call(l,r,n),!f.current)return s.current>0?(s.current-=1,m()):void(s.current=null!=l&&l.retry?t(l.retry):0)})}));o((function(){return m(),function(){i.current&&(i.current.close(),i.current=void 0)}}),[c]);return{client:i.current,close:function(){var n;f.current=!0,null===(n=i.current)||void 0===n||n.close()},open:function(){f.current=!1,m()},send:function(n){var r;return null===(r=i.current)||void 0===r?void 0:r.send(n)},status:d}};export{c as useWebSocket};
1
+ /* @license @siberiacancode/reactuse v0.0.37 */
2
+ import{_ as n}from"../../_rollupPluginBabelHelpers-BUclQybi.js";import{useRef as r,useState as e,useEffect as o}from"react";import{getRetry as t}from"../../utils/helpers/getRetry.js";import"../../utils/helpers/isClient.js";import{useEvent as u}from"../useEvent/useEvent.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";var c=function(c,l){var i=r(),s=r(null!=l&&l.retry?t(l.retry):0),f=r(!1),a=e("connecting"),v=n(a,2),d=v[0],p=v[1],m=u((function(){i.current=new WebSocket("function"==typeof c?c():c,null==l?void 0:l.protocols),p("connecting");var n=i.current;n&&(n.onopen=function(){var r;p("connected"),null==l||null===(r=l.onConnected)||void 0===r||r.call(l,n)},n.onerror=function(r){var e;p("failed"),null==l||null===(e=l.onError)||void 0===e||e.call(l,r,n)},n.onmessage=function(r){var e;return null==l||null===(e=l.onMessage)||void 0===e?void 0:e.call(l,r,n)},n.onclose=function(r){var e;if(p("disconnected"),null==l||null===(e=l.onDisconnected)||void 0===e||e.call(l,r,n),!f.current)return s.current>0?(s.current-=1,m()):void(s.current=null!=l&&l.retry?t(l.retry):0)})}));o((function(){return m(),function(){i.current&&(i.current.close(),i.current=void 0)}}),[c]);return{client:i.current,close:function(){var n;f.current=!0,null===(n=i.current)||void 0===n||n.close()},open:function(){f.current=!1,m()},send:function(n){var r;return null===(r=i.current)||void 0===r?void 0:r.send(n)},status:d}};export{c as useWebSocket};
3
3
  //# sourceMappingURL=useWebSocket.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.35 */
1
+ /* @license @siberiacancode/reactuse v0.0.37 */
2
2
  import{useEventListener as e}from"../useEventListener/useEventListener.js";import"react";import"../useEvent/useEvent.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";var t=function(t,s,r){return e(window,t,s,r)};export{t as useWindowEvent};
3
3
  //# sourceMappingURL=useWindowEvent.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.35 */
2
- import{_ as i}from"../../_rollupPluginBabelHelpers-CEUGrTA3.js";import{useState as n,useEffect as e}from"react";import{isClient as r}from"../../utils/helpers/isClient.js";var t=function(t){var o,d,l=n({width:r?window.innerWidth:null!==(o=null==t?void 0:t.initialWidth)&&void 0!==o?o:Number.POSITIVE_INFINITY,height:r?window.innerHeight:null!==(d=null==t?void 0:t.initialWidth)&&void 0!==d?d:Number.POSITIVE_INFINITY}),u=i(l,2),w=u[0],h=u[1];return e((function(){var i=function(){h({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",i),function(){window.removeEventListener("resize",i)}}),[]),w};export{t as useWindowSize};
1
+ /* @license @siberiacancode/reactuse v0.0.37 */
2
+ import{_ as i}from"../../_rollupPluginBabelHelpers-BUclQybi.js";import{useState as n,useEffect as e}from"react";import{isClient as r}from"../../utils/helpers/isClient.js";var t=function(t){var o,d,l=n({width:r?window.innerWidth:null!==(o=null==t?void 0:t.initialWidth)&&void 0!==o?o:Number.POSITIVE_INFINITY,height:r?window.innerHeight:null!==(d=null==t?void 0:t.initialWidth)&&void 0!==d?d:Number.POSITIVE_INFINITY}),u=i(l,2),w=u[0],h=u[1];return e((function(){var i=function(){h({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",i),function(){window.removeEventListener("resize",i)}}),[]),w};export{t as useWindowSize};
3
3
  //# sourceMappingURL=useWindowSize.js.map
package/dist/esm/index.js CHANGED
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.35 */
2
- export{useBattery}from"./hooks/useBattery/useBattery.js";export{useBoolean}from"./hooks/useBoolean/useBoolean.js";export{useBrowserLanguage}from"./hooks/useBrowserLanguage/useBrowserLanguage.js";export{useClickOutside}from"./hooks/useClickOutside/useClickOutside.js";export{legacyCopyToClipboard,useCopyToClipboard}from"./hooks/useCopyToClipboard/useCopyToClipboard.js";export{useCounter}from"./hooks/useCounter/useCounter.js";export{useDebounceCallback}from"./hooks/useDebounceCallback/useDebounceCallback.js";export{useDebounceValue}from"./hooks/useDebounceValue/useDebounceValue.js";export{useDefault}from"./hooks/useDefault/useDefault.js";export{useDidUpdate}from"./hooks/useDidUpdate/useDidUpdate.js";export{useDocumentEvent}from"./hooks/useDocumentEvent/useDocumentEvent.js";export{useDocumentTitle}from"./hooks/useDocumentTitle/useDocumentTitle.js";export{useDocumentVisibility}from"./hooks/useDocumentVisibility/useDocumentVisibility.js";export{useEvent}from"./hooks/useEvent/useEvent.js";export{useEventListener}from"./hooks/useEventListener/useEventListener.js";export{useEyeDropper}from"./hooks/useEyeDropper/useEyeDropper.js";export{useFavicon}from"./hooks/useFavicon/useFavicon.js";export{useField}from"./hooks/useField/useField.js";export{useFps}from"./hooks/useFps/useFps.js";export{useFullscreen}from"./hooks/useFullscreen/useFullscreen.js";export{useHash}from"./hooks/useHash/useHash.js";export{isHotkeyMatch,useHotkeys}from"./hooks/useHotkeys/useHotkeys.js";export{useHover}from"./hooks/useHover/useHover.js";export{useIdle}from"./hooks/useIdle/useIdle.js";export{useIntersectionObserver}from"./hooks/useIntersectionObserver/useIntersectionObserver.js";export{useInterval}from"./hooks/useInterval/useInterval.js";export{useIsFirstRender}from"./hooks/useIsFirstRender/useIsFirstRender.js";export{useIsomorphicLayoutEffect}from"./hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";export{useKeyboard}from"./hooks/useKeyboard/useKeyboard.js";export{useKeyPress}from"./hooks/useKeyPress/useKeyPress.js";export{useKeyPressEvent}from"./hooks/useKeyPressEvent/useKeyPressEvent.js";export{useKeysPressed}from"./hooks/useKeysPressed/useKeysPressed.js";export{useList}from"./hooks/useList/useList.js";export{useLocalStorage}from"./hooks/useLocalStorage/useLocalStorage.js";export{useLogger}from"./hooks/useLogger/useLogger.js";export{useLongPress}from"./hooks/useLongPress/useLongPress.js";export{useMediaQuery}from"./hooks/useMediaQuery/useMediaQuery.js";export{useMount}from"./hooks/useMount/useMount.js";export{useMouse}from"./hooks/useMouse/useMouse.js";export{useMutation}from"./hooks/useMutation/useMutation.js";export{getConnection,useNetwork}from"./hooks/useNetwork/useNetwork.js";export{useOnline}from"./hooks/useOnline/useOnline.js";export{getOperatingSystem,useOperatingSystem}from"./hooks/useOperatingSystem/useOperatingSystem.js";export{useOrientation}from"./hooks/useOrientation/useOrientation.js";export{usePageLeave}from"./hooks/usePageLeave/usePageLeave.js";export{getTargetElement,usePaint}from"./hooks/usePaint/usePaint.js";export{usePreferredColorScheme}from"./hooks/usePreferredColorScheme/usePreferredColorScheme.js";export{usePreferredLanguages}from"./hooks/usePreferredLanguages/usePreferredLanguages.js";export{usePrevious}from"./hooks/usePrevious/usePrevious.js";export{useQRCode}from"./hooks/useQRCode/useQRCode.js";export{useQuery}from"./hooks/useQuery/useQuery.js";export{useQueue}from"./hooks/useQueue/useQueue.js";export{useRenderCount}from"./hooks/useRenderCount/useRenderCount.js";export{useRenderInfo}from"./hooks/useRenderInfo/useRenderInfo.js";export{useRerender}from"./hooks/useRerender/useRerender.js";export{SCRIPT_STATUS_ATTRIBUTE_NAME,useScript}from"./hooks/useScript/useScript.js";export{useSessionStorage}from"./hooks/useSessionStorage/useSessionStorage.js";export{useSet}from"./hooks/useSet/useSet.js";export{useStep}from"./hooks/useStep/useStep.js";export{dispatchStorageEvent,useStorage}from"./hooks/useStorage/useStorage.js";export{getRangesSelection,useTextSelection}from"./hooks/useTextSelection/useTextSelection.js";export{useTime}from"./hooks/useTime/useTime.js";export{useTimeout}from"./hooks/useTimeout/useTimeout.js";export{useToggle}from"./hooks/useToggle/useToggle.js";export{useUnmount}from"./hooks/useUnmount/useUnmount.js";export{useWebSocket}from"./hooks/useWebSocket/useWebSocket.js";export{useWindowEvent}from"./hooks/useWindowEvent/useWindowEvent.js";export{useWindowSize}from"./hooks/useWindowSize/useWindowSize.js";export{debounce}from"./utils/helpers/debounce.js";export{getRetry}from"./utils/helpers/getRetry.js";export{isClient}from"./utils/helpers/isClient.js";export{throttle}from"./utils/helpers/throttle.js";export{getDate}from"./utils/helpers/time/getDate.js";import"./_rollupPluginBabelHelpers-CEUGrTA3.js";import"react";import"./hooks/useMutationObserver.js";import"fs";import"util";import"stream";import"zlib";import"assert";import"buffer";import"react-dom";
1
+ /* @license @siberiacancode/reactuse v0.0.37 */
2
+ export{useBattery}from"./hooks/useBattery/useBattery.js";export{useBoolean}from"./hooks/useBoolean/useBoolean.js";export{useBrowserLanguage}from"./hooks/useBrowserLanguage/useBrowserLanguage.js";export{useClickOutside}from"./hooks/useClickOutside/useClickOutside.js";export{useCopyToClipboard}from"./hooks/useCopyToClipboard/useCopyToClipboard.js";export{useCounter}from"./hooks/useCounter/useCounter.js";export{useDebounceCallback}from"./hooks/useDebounceCallback/useDebounceCallback.js";export{useDebounceValue}from"./hooks/useDebounceValue/useDebounceValue.js";export{useDefault}from"./hooks/useDefault/useDefault.js";export{useDidUpdate}from"./hooks/useDidUpdate/useDidUpdate.js";export{useDocumentEvent}from"./hooks/useDocumentEvent/useDocumentEvent.js";export{useDocumentTitle}from"./hooks/useDocumentTitle/useDocumentTitle.js";export{useDocumentVisibility}from"./hooks/useDocumentVisibility/useDocumentVisibility.js";export{useEvent}from"./hooks/useEvent/useEvent.js";export{useEventListener}from"./hooks/useEventListener/useEventListener.js";export{useEyeDropper}from"./hooks/useEyeDropper/useEyeDropper.js";export{useFavicon}from"./hooks/useFavicon/useFavicon.js";export{useField}from"./hooks/useField/useField.js";export{useFps}from"./hooks/useFps/useFps.js";export{useFullscreen}from"./hooks/useFullscreen/useFullscreen.js";export{useHash}from"./hooks/useHash/useHash.js";export{useHotkeys}from"./hooks/useHotkeys/useHotkeys.js";export{useHover}from"./hooks/useHover/useHover.js";export{useIdle}from"./hooks/useIdle/useIdle.js";export{useIntersectionObserver}from"./hooks/useIntersectionObserver/useIntersectionObserver.js";export{useInterval}from"./hooks/useInterval/useInterval.js";export{useIsFirstRender}from"./hooks/useIsFirstRender/useIsFirstRender.js";export{useIsomorphicLayoutEffect}from"./hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";export{useKeyboard}from"./hooks/useKeyboard/useKeyboard.js";export{useKeyPress}from"./hooks/useKeyPress/useKeyPress.js";export{useKeyPressEvent}from"./hooks/useKeyPressEvent/useKeyPressEvent.js";export{useKeysPressed}from"./hooks/useKeysPressed/useKeysPressed.js";export{useList}from"./hooks/useList/useList.js";export{useLocalStorage}from"./hooks/useLocalStorage/useLocalStorage.js";export{useLogger}from"./hooks/useLogger/useLogger.js";export{useLongPress}from"./hooks/useLongPress/useLongPress.js";export{useMediaQuery}from"./hooks/useMediaQuery/useMediaQuery.js";export{useMount}from"./hooks/useMount/useMount.js";export{useMouse}from"./hooks/useMouse/useMouse.js";export{useMutation}from"./hooks/useMutation/useMutation.js";export{useNetwork}from"./hooks/useNetwork/useNetwork.js";export{useOnline}from"./hooks/useOnline/useOnline.js";export{useOperatingSystem}from"./hooks/useOperatingSystem/useOperatingSystem.js";export{useOrientation}from"./hooks/useOrientation/useOrientation.js";export{usePageLeave}from"./hooks/usePageLeave/usePageLeave.js";export{usePaint}from"./hooks/usePaint/usePaint.js";export{usePreferredColorScheme}from"./hooks/usePreferredColorScheme/usePreferredColorScheme.js";export{usePreferredLanguages}from"./hooks/usePreferredLanguages/usePreferredLanguages.js";export{usePrevious}from"./hooks/usePrevious/usePrevious.js";export{useQuery}from"./hooks/useQuery/useQuery.js";export{useQueue}from"./hooks/useQueue/useQueue.js";export{useRenderCount}from"./hooks/useRenderCount/useRenderCount.js";export{useRenderInfo}from"./hooks/useRenderInfo/useRenderInfo.js";export{useRerender}from"./hooks/useRerender/useRerender.js";export{useScript}from"./hooks/useScript/useScript.js";export{useSessionStorage}from"./hooks/useSessionStorage/useSessionStorage.js";export{useSet}from"./hooks/useSet/useSet.js";export{useStep}from"./hooks/useStep/useStep.js";export{useStorage}from"./hooks/useStorage/useStorage.js";export{useTextSelection}from"./hooks/useTextSelection/useTextSelection.js";export{useTime}from"./hooks/useTime/useTime.js";export{useTimeout}from"./hooks/useTimeout/useTimeout.js";export{useToggle}from"./hooks/useToggle/useToggle.js";export{useUnmount}from"./hooks/useUnmount/useUnmount.js";export{useWebSocket}from"./hooks/useWebSocket/useWebSocket.js";export{useWindowEvent}from"./hooks/useWindowEvent/useWindowEvent.js";export{useWindowSize}from"./hooks/useWindowSize/useWindowSize.js";export{debounce}from"./utils/helpers/debounce.js";export{getRetry}from"./utils/helpers/getRetry.js";export{isClient}from"./utils/helpers/isClient.js";export{throttle}from"./utils/helpers/throttle.js";export{getDate}from"./utils/helpers/time/getDate.js";import"./_rollupPluginBabelHelpers-BUclQybi.js";import"react";import"./hooks/useMutationObserver.js";import"react-dom";
3
3
  //# sourceMappingURL=index.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.35 */
1
+ /* @license @siberiacancode/reactuse v0.0.37 */
2
2
  var r=function(r,n){var t;return function(){for(var e=arguments.length,o=new Array(e),u=0;u<e;u++)o[u]=arguments[u];clearTimeout(t),t=setTimeout((function(){return r.apply(void 0,o)}),n)}};export{r as debounce};
3
3
  //# sourceMappingURL=debounce.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.35 */
1
+ /* @license @siberiacancode/reactuse v0.0.37 */
2
2
  var r=function(r){return"number"==typeof r?r:r?1:0};export{r as getRetry};
3
3
  //# sourceMappingURL=getRetry.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.35 */
1
+ /* @license @siberiacancode/reactuse v0.0.37 */
2
2
  export{debounce}from"./debounce.js";export{getRetry}from"./getRetry.js";export{isClient}from"./isClient.js";export{throttle}from"./throttle.js";export{getDate}from"./time/getDate.js";
3
3
  //# sourceMappingURL=index.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.35 */
1
+ /* @license @siberiacancode/reactuse v0.0.37 */
2
2
  var n,d,e=!("undefined"==typeof window||null===(n=window)||void 0===n||!n.document||null===(d=window)||void 0===d||null===(d=d.document)||void 0===d||!d.createElement);export{e as isClient};
3
3
  //# sourceMappingURL=isClient.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.35 */
1
+ /* @license @siberiacancode/reactuse v0.0.37 */
2
2
  var n=function(n,t){var o=!1;return function(){o||(n.apply(void 0,arguments),o=!0,setTimeout((function(){o=!1}),t))}};export{n as throttle};
3
3
  //# sourceMappingURL=throttle.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.35 */
1
+ /* @license @siberiacancode/reactuse v0.0.37 */
2
2
  var e=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,t=e.getSeconds(),n=e.getMinutes(),r=e.getHours();return{seconds:t,minutes:n,hours:r,meridiemHours:{value:r%12==0?12:r%12,type:r>=12?"pm":"am"},day:e.getDate(),month:e.getMonth()+1,year:e.getFullYear(),timestamp:e.getTime()}};export{e as getDate};
3
3
  //# sourceMappingURL=getDate.js.map
@@ -0,0 +1,2 @@
1
+ /* @license @siberiacancode/reactuse v0.0.37 */
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,12 @@
1
+ import { BatteryManager, EyeDropperConstructor, ColorSelectionOptions, ColorSelectionResult, Connection } from '@/utils/types';
1
2
  import * as react from 'react';
2
3
  import { RefObject, Dispatch, SetStateAction, EffectCallback, DependencyList, useEffect, ComponentProps } from 'react';
3
- import QRCode from 'qrcode';
4
4
 
5
+ declare global {
6
+ interface Navigator {
7
+ readonly getBattery: () => Promise<BatteryManager>;
8
+ }
9
+ }
5
10
  /** State for hook use battery */
6
11
  interface UseBatteryStateReturn {
7
12
  /** Is battery API supported? */
@@ -89,7 +94,6 @@ type UseClickOutside = {
89
94
  */
90
95
  declare const useClickOutside: UseClickOutside;
91
96
 
92
- declare const legacyCopyToClipboard: (value: string) => void;
93
97
  /** The use copy to clipboard return type */
94
98
  interface UseCopyToClipboardReturn {
95
99
  /** The copied value */
@@ -296,6 +300,11 @@ declare const useDocumentVisibility: () => DocumentVisibilityState;
296
300
  */
297
301
  declare const useEvent: <Params extends unknown[], Return>(callback: (...args: Params) => Return) => ((...args: Params) => Return);
298
302
 
303
+ declare global {
304
+ interface Window {
305
+ EyeDropper?: EyeDropperConstructor | undefined;
306
+ }
307
+ }
299
308
  /** The color selection return type */
300
309
  interface UseEyeDropperReturn {
301
310
  supported: boolean;
@@ -314,8 +323,6 @@ interface UseEyeDropperReturn {
314
323
  */
315
324
  declare const useEyeDropper: (initialValue?: string | undefined) => UseEyeDropperReturn;
316
325
 
317
- /** The use favicon return type */
318
- type UseFaviconReturn = [string, Dispatch<SetStateAction<string>>];
319
326
  /**
320
327
  * @name useFavicon
321
328
  * @description - Hook that manages the favicon
@@ -512,13 +519,7 @@ interface UseHotkeysOptions {
512
519
  /** Alias map for hotkeys */
513
520
  aliasMap?: Record<string, string>;
514
521
  }
515
- declare const isHotkeyMatch: (hotkey: string, keys: UseHotkeysKey[]) => boolean;
516
522
  type UseHotkeysHotkeys = string[] | string;
517
- type UseHotkeysKey = {
518
- key: string;
519
- code: string;
520
- alias: string;
521
- };
522
523
  /**
523
524
  * @name useHotkeys
524
525
  * @description - Hook that listens for hotkeys
@@ -776,23 +777,6 @@ declare const useKeysPressed: (params?: UseKeysPressedParams) => {
776
777
  code: string;
777
778
  }[];
778
779
 
779
- /** The use list return type */
780
- interface UseListReturn<Item> {
781
- /** The current list of items */
782
- value: Item[];
783
- /** Sets the list of items */
784
- set: (list: Item[]) => void;
785
- /** Adds an item to the list */
786
- push: (item: Item) => void;
787
- /** Removes an item from the list */
788
- removeAt: (removeAtIndex: number) => void;
789
- /** Inserts an item at the specified index */
790
- insertAt: (insertAtIndex: number, item: Item) => void;
791
- /** Updates an item at the specified index */
792
- updateAt: (updateAtIndex: number, item: Item) => void;
793
- /** Clears the list */
794
- clear: () => void;
795
- }
796
780
  /**
797
781
  * @name useList
798
782
  * @description - Hook that defines the logic when unmounting a component
@@ -822,12 +806,6 @@ interface UseStorageOptions<Value> {
822
806
  storage?: Storage;
823
807
  initialValue?: UseStorageInitialValue<Value>;
824
808
  }
825
- type UseStorageReturn<Value> = [
826
- value: Value,
827
- set: (value: Value) => void,
828
- remove: () => void
829
- ];
830
- declare const dispatchStorageEvent: (params: Partial<StorageEvent>) => boolean;
831
809
  declare const useStorage: <Value>(key: string, params?: UseStorageInitialValue<Value> | UseStorageOptions<Value>) => readonly [Value | undefined, (value: Value) => void, () => void];
832
810
 
833
811
  /**
@@ -998,8 +976,13 @@ interface UseMutationReturn<Body, Data> {
998
976
  */
999
977
  declare const useMutation: <Body, Data>(callback: (body: Body) => Promise<Data>, options?: UseMutationOptions<Data>) => UseMutationReturn<Body, Data>;
1000
978
 
1001
- type ConnectionType = Connection['type'];
1002
- type ConnectionEffectiveType = Connection['effectiveType'];
979
+ declare global {
980
+ interface Navigator {
981
+ readonly connection: Connection;
982
+ readonly mozConnection: Connection;
983
+ readonly webkitConnection: Connection;
984
+ }
985
+ }
1003
986
  /** The use network return type */
1004
987
  interface UseNetworkReturn {
1005
988
  /** Indicates if the device is currently online */
@@ -1017,7 +1000,6 @@ interface UseNetworkReturn {
1017
1000
  /** The type of network connection (e.g., 'wifi', 'cellular') */
1018
1001
  type?: Connection['type'];
1019
1002
  }
1020
- declare const getConnection: () => Connection;
1021
1003
  /**
1022
1004
  * @name useNetwork
1023
1005
  * @description - Hook to track network status
@@ -1042,7 +1024,6 @@ declare const useOnline: () => boolean;
1042
1024
 
1043
1025
  /** The operating system type */
1044
1026
  type OperatingSystem = 'undetermined' | 'macos' | 'ios' | 'windows' | 'android' | 'linux';
1045
- declare const getOperatingSystem: () => OperatingSystem;
1046
1027
  /**
1047
1028
  * @name useOperatingSystem
1048
1029
  * @description - Hook that returns the operating system of the current browser
@@ -1101,7 +1082,6 @@ interface UsePaintReturn {
1101
1082
  drawing: boolean;
1102
1083
  }
1103
1084
  type UsePaintTarget = RefObject<HTMLCanvasElement> | (() => HTMLCanvasElement) | HTMLCanvasElement;
1104
- declare const getTargetElement: (target: UsePaintTarget) => HTMLCanvasElement | null;
1105
1085
  type UsePaint = {
1106
1086
  <Target extends UsePaintTarget>(target: Target, options?: UsePaintOptions): UsePaintReturn;
1107
1087
  (options?: UsePaintOptions, target?: never): UsePaintReturn & {
@@ -1167,23 +1147,6 @@ declare const usePreferredLanguages: () => readonly string[];
1167
1147
  */
1168
1148
  declare const usePrevious: <Value>(value: Value) => Value | undefined;
1169
1149
 
1170
- /**
1171
- * @name useQRCode
1172
- * @description - Hook that generates a QR code
1173
- *
1174
- * @param {string} text The text to be encoded in the QR code
1175
- * @param {QRCode.QRCodeToDataURLOptions} [options] The options of the QR code
1176
- * @returns {UseQrCodeReturn} An object with the QR code value and a setter
1177
- *
1178
- * @example
1179
- * const { value, set } = useQRCode('url');
1180
- */
1181
- declare const useQRCode: (text?: string, options?: QRCode.QRCodeToDataURLOptions) => {
1182
- value: string | undefined;
1183
- set: (value: string) => Promise<void>;
1184
- isLoading: boolean;
1185
- };
1186
-
1187
1150
  interface UseQueryOptions<QueryData, Data> {
1188
1151
  keys?: DependencyList;
1189
1152
  onSuccess?: (data: Data) => void;
@@ -1302,7 +1265,6 @@ declare const useRerender: () => UseRerenderReturns;
1302
1265
 
1303
1266
  /** The use script status */
1304
1267
  type UseScriptStatus = 'loading' | 'ready' | 'error' | 'unknown';
1305
- declare const SCRIPT_STATUS_ATTRIBUTE_NAME = "script-status";
1306
1268
  /** The use script options extends from attributes script tag */
1307
1269
  interface UseScriptOptions extends ComponentProps<'script'> {
1308
1270
  /** Whether to remove the script on unmount */
@@ -1435,7 +1397,6 @@ interface UseStepReturn {
1435
1397
  */
1436
1398
  declare const useStep: (params: number | UseStepParams) => UseStepReturn;
1437
1399
 
1438
- declare const getRangesSelection: (selection: Selection) => Range[];
1439
1400
  /** The use text selection return type */
1440
1401
  interface UseTextSelectionReturn {
1441
1402
  /** The current selection text */
@@ -1502,8 +1463,6 @@ interface UseTimeoutReturn {
1502
1463
  */
1503
1464
  declare function useTimeout(callback: () => void, delay: number): UseTimeoutReturn;
1504
1465
 
1505
- /** The use toggle return type */
1506
- type UseToggleReturn<Value> = readonly [Value, (value?: Value) => void];
1507
1466
  /**
1508
1467
  * @name useToggle
1509
1468
  * @description - Hook that create toggle
@@ -1588,13 +1547,6 @@ interface UseWindowSizeParams {
1588
1547
  /** The initial window height */
1589
1548
  initialHeight?: number;
1590
1549
  }
1591
- /** The use window size return type */
1592
- interface UseWindowSizeReturn {
1593
- /** The current window width */
1594
- width: number;
1595
- /** The current window height */
1596
- height: number;
1597
- }
1598
1550
  /**
1599
1551
  * @name useWindowSize
1600
1552
  * @description - Hook that manages a window size
@@ -1633,4 +1585,4 @@ declare const getDate: (now?: Date) => {
1633
1585
  timestamp: number;
1634
1586
  };
1635
1587
 
1636
- export { type ConnectionEffectiveType, type ConnectionType, type OperatingSystem, SCRIPT_STATUS_ATTRIBUTE_NAME, type UseClickOutside, type UseClickOutsideReturn, type UseCounter, type UseCounterOptions, type UseCounterParams, type UseCounterReturn, type UseDocumentTitleOptions, type UseDocumentTitleReturn, type UseEventListener, type UseEventListenerOptions, type UseEventListenerReturn, type UseEventListenerTarget, type UseEyeDropperReturn, type UseFaviconReturn, type UseFieldParams, type UseFieldRegisterParams, type UseFieldReturn, type UseFullScreen, type UseFullScreenOptions, type UseFullScreenReturn, type UseHotkeysHotkeys, type UseHotkeysKey, type UseHotkeysOptions, type UseHover, type UseHoverOptions, type UseHoverReturn, type UseHoverTarget, type UseIdleReturn, type UseIntersectionObserver, type UseIntersectionObserverOptions, type UseIntersectionObserverReturn, type UseIntersectionObserverTarget, type UseIntervalOptions, type UseIntervalReturn, type UseKeyPressEvent, type UseKeyPressEventKey, type UseKeyPressKey, type UseKeyPressOptions, type UseKeyboardParams, type UseListReturn, type UseLongPress, type UseLongPressReturn, type UseLongPressTarget, type UseMouse, type UseMouseReturn, type UseNetworkReturn, type UseOrientationReturn, type UsePaint, type UsePaintOptions, type UsePaintPencil, type UsePaintReturn, type UsePaintTarget, type UsePreferredColorSchemeReturn, type UseQueueReturn, type UseRenderInfoReturn, type UseScriptOptions, type UseScriptStatus, type UseStorageInitialValue, type UseStorageOptions, type UseStorageReturn, type UseTextSelectionReturn, type UseTimeReturn, type UseToggleReturn, type UseWebSocketOptions, type UseWebSocketReturn, type UseWebSocketStatus, type UseWebSocketUrl, type UseWindowSizeReturn, debounce, dispatchStorageEvent, getConnection, getDate, getOperatingSystem, getRangesSelection, getRetry, getTargetElement, isClient, isHotkeyMatch, legacyCopyToClipboard, throttle, useBattery, useBoolean, useBrowserLanguage, useClickOutside, useCopyToClipboard, useCounter, useDebounceCallback, useDebounceValue, useDefault, useDidUpdate, useDocumentEvent, useDocumentTitle, useDocumentVisibility, useEvent, useEventListener, useEyeDropper, useFavicon, useField, useFps, useFullscreen, useHash, useHotkeys, useHover, useIdle, useIntersectionObserver, useInterval, useIsFirstRender, useIsomorphicLayoutEffect, useKeyPress, useKeyPressEvent, useKeyboard, useKeysPressed, useList, useLocalStorage, useLogger, useLongPress, useMediaQuery, useMount, useMouse, useMutation, useNetwork, useOnline, useOperatingSystem, useOrientation, usePageLeave, usePaint, usePreferredColorScheme, usePreferredLanguages, usePrevious, useQRCode, useQuery, useQueue, useRenderCount, useRenderInfo, useRerender, useScript, useSessionStorage, useSet, useStep, useStorage, useTextSelection, useTime, useTimeout, useToggle, useUnmount, useWebSocket, useWindowEvent, useWindowSize };
1588
+ export { debounce, getDate, getRetry, isClient, throttle, useBattery, useBoolean, useBrowserLanguage, useClickOutside, useCopyToClipboard, useCounter, useDebounceCallback, useDebounceValue, useDefault, useDidUpdate, useDocumentEvent, useDocumentTitle, useDocumentVisibility, useEvent, useEventListener, useEyeDropper, useFavicon, useField, useFps, useFullscreen, useHash, useHotkeys, useHover, useIdle, useIntersectionObserver, useInterval, useIsFirstRender, useIsomorphicLayoutEffect, useKeyPress, useKeyPressEvent, useKeyboard, useKeysPressed, useList, useLocalStorage, useLogger, useLongPress, useMediaQuery, useMount, useMouse, useMutation, useNetwork, useOnline, useOperatingSystem, useOrientation, usePageLeave, usePaint, usePreferredColorScheme, usePreferredLanguages, usePrevious, useQuery, useQueue, useRenderCount, useRenderInfo, useRerender, useScript, useSessionStorage, useSet, useStep, useStorage, useTextSelection, useTime, useTimeout, useToggle, useUnmount, useWebSocket, useWindowEvent, useWindowSize };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siberiacancode/reactuse",
3
- "version": "0.0.35",
3
+ "version": "0.0.37",
4
4
  "description": "Ultimate tool",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -56,15 +56,14 @@
56
56
  "react": "^17.0.2 || ^18.0.0",
57
57
  "react-dom": "^17.0.2 || ^18.0.0"
58
58
  },
59
- "optionalDependencies": {
60
- "qrcode": "^1.5.3",
61
- "screenfull": "^6.0.2"
62
- },
63
59
  "peerDependenciesMeta": {
64
60
  "@types/react": {
65
61
  "optional": true
66
62
  }
67
63
  },
64
+ "dependencies": {
65
+ "screenfull": "^6.0.2"
66
+ },
68
67
  "devDependencies": {
69
68
  "@siberiacancode/builder": "^1.3.0",
70
69
  "@siberiacancode/eslint": "^1.1.0",
@@ -74,7 +73,6 @@
74
73
  "@testing-library/react": "^15.0.7",
75
74
  "@types/doctrine": "^0.0.9",
76
75
  "@types/node": "^20.11.19",
77
- "@types/qrcode": "^1.5.5",
78
76
  "@types/react": "^18.3.2",
79
77
  "@types/react-dom": "^18.3.0",
80
78
  "comment-parser": "^1.4.1",
@@ -84,10 +82,8 @@
84
82
  "husky": "^9.0.11",
85
83
  "lint-staged": "^15.2.2",
86
84
  "markdown-table": "^3.0.3",
87
- "qrcode": "^1.5.3",
88
85
  "react": "^18.2.0",
89
86
  "react-dom": "^18.2.0",
90
- "screenfull": "^6.0.2",
91
87
  "shx": "^0.3.4",
92
88
  "typescript": "^5.3.3",
93
89
  "vite": "^5.1.3",
@@ -1 +0,0 @@
1
- {"version":3,"file":"_rollupPluginBabelHelpers-KdNaXDbY.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,3 +0,0 @@
1
- /* @license @siberiacancode/reactuse v0.0.35 */
2
- "use strict";var t=require("../../_rollupPluginBabelHelpers-KdNaXDbY.js"),e=require("react"),n=require("fs"),r=require("util"),i=require("stream"),o=require("zlib"),s=require("assert"),a=require("buffer"),h=require("../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js");function l(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}require("../../utils/helpers/isClient.js");var u={},f=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then},c={},d={};let p;const g=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];d.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return 4*t+17},d.getSymbolTotalCodewords=function(t){return g[t]},d.getBCHDigit=function(t){let e=0;for(;0!==t;)e++,t>>>=1;return e},d.setToSJISFunction=function(t){if("function"!=typeof t)throw new Error('"toSJISFunc" is not a valid function.');p=t},d.isKanjiModeEnabled=function(){return void 0!==p},d.toSJIS=function(t){return p(t)};var _={};function w(){this.buffer=[],this.length=0}!function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2},t.isValid=function(t){return t&&void 0!==t.bit&&t.bit>=0&&t.bit<4},t.from=function(e,n){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+e)}}(e)}catch(t){return n}}}(_),w.prototype={get:function(t){const e=Math.floor(t/8);return 1==(this.buffer[e]>>>7-t%8&1)},put:function(t,e){for(let n=0;n<e;n++)this.putBit(1==(t>>>e-n-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var m=w;function y(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}y.prototype.set=function(t,e,n,r){const i=t*this.size+e;this.data[i]=n,r&&(this.reservedBit[i]=!0)},y.prototype.get=function(t,e){return this.data[t*this.size+e]},y.prototype.xor=function(t,e,n){this.data[t*this.size+e]^=n},y.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};var E=y,b={};!function(t){const e=d.getSymbolSize;t.getRowColCoords=function(t){if(1===t)return[];const n=Math.floor(t/7)+2,r=e(t),i=145===r?26:2*Math.ceil((r-13)/(2*n-2)),o=[r-7];for(let t=1;t<n-1;t++)o[t]=o[t-1]-i;return o.push(6),o.reverse()},t.getPositions=function(e){const n=[],r=t.getRowColCoords(e),i=r.length;for(let t=0;t<i;t++)for(let e=0;e<i;e++)0===t&&0===e||0===t&&e===i-1||t===i-1&&0===e||n.push([r[t],r[e]]);return n}}(b);var T={};const C=d.getSymbolSize;T.getPositions=function(t){const e=C(t);return[[0,0],[e-7,0],[0,e-7]]};var A={};!function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const e=3,n=3,r=40,i=10;function o(e,n,r){switch(e){case t.Patterns.PATTERN000:return(n+r)%2==0;case t.Patterns.PATTERN001:return n%2==0;case t.Patterns.PATTERN010:return r%3==0;case t.Patterns.PATTERN011:return(n+r)%3==0;case t.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case t.Patterns.PATTERN101:return n*r%2+n*r%3==0;case t.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case t.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}}t.isValid=function(t){return null!=t&&""!==t&&!isNaN(t)&&t>=0&&t<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(t){const n=t.size;let r=0,i=0,o=0,s=null,a=null;for(let h=0;h<n;h++){i=o=0,s=a=null;for(let l=0;l<n;l++){let n=t.get(h,l);n===s?i++:(i>=5&&(r+=e+(i-5)),s=n,i=1),n=t.get(l,h),n===a?o++:(o>=5&&(r+=e+(o-5)),a=n,o=1)}i>=5&&(r+=e+(i-5)),o>=5&&(r+=e+(o-5))}return r},t.getPenaltyN2=function(t){const e=t.size;let r=0;for(let n=0;n<e-1;n++)for(let i=0;i<e-1;i++){const e=t.get(n,i)+t.get(n,i+1)+t.get(n+1,i)+t.get(n+1,i+1);4!==e&&0!==e||r++}return r*n},t.getPenaltyN3=function(t){const e=t.size;let n=0,i=0,o=0;for(let r=0;r<e;r++){i=o=0;for(let s=0;s<e;s++)i=i<<1&2047|t.get(r,s),s>=10&&(1488===i||93===i)&&n++,o=o<<1&2047|t.get(s,r),s>=10&&(1488===o||93===o)&&n++}return n*r},t.getPenaltyN4=function(t){let e=0;const n=t.data.length;for(let r=0;r<n;r++)e+=t.data[r];return Math.abs(Math.ceil(100*e/n/5)-10)*i},t.applyMask=function(t,e){const n=e.size;for(let r=0;r<n;r++)for(let i=0;i<n;i++)e.isReserved(i,r)||e.xor(i,r,o(t,i,r))},t.getBestMask=function(e,n){const r=Object.keys(t.Patterns).length;let i=0,o=1/0;for(let s=0;s<r;s++){n(s),t.applyMask(s,e);const r=t.getPenaltyN1(e)+t.getPenaltyN2(e)+t.getPenaltyN3(e)+t.getPenaltyN4(e);t.applyMask(s,e),r<o&&(o=r,i=s)}return i}}(A);var I={};const P=_,L=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],v=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];I.getBlocksCount=function(t,e){switch(e){case P.L:return L[4*(t-1)+0];case P.M:return L[4*(t-1)+1];case P.Q:return L[4*(t-1)+2];case P.H:return L[4*(t-1)+3];default:return}},I.getTotalCodewordsCount=function(t,e){switch(e){case P.L:return v[4*(t-1)+0];case P.M:return v[4*(t-1)+1];case P.Q:return v[4*(t-1)+2];case P.H:return v[4*(t-1)+3];default:return}};var R={},B={};const O=new Uint8Array(512),M=new Uint8Array(256);!function(){let t=1;for(let e=0;e<255;e++)O[e]=t,M[t]=e,t<<=1,256&t&&(t^=285);for(let t=255;t<512;t++)O[t]=O[t-255]}(),B.log=function(t){if(t<1)throw new Error("log("+t+")");return M[t]},B.exp=function(t){return O[t]},B.mul=function(t,e){return 0===t||0===e?0:O[M[t]+M[e]]},function(t){const e=B;t.mul=function(t,n){const r=new Uint8Array(t.length+n.length-1);for(let i=0;i<t.length;i++)for(let o=0;o<n.length;o++)r[i+o]^=e.mul(t[i],n[o]);return r},t.mod=function(t,n){let r=new Uint8Array(t);for(;r.length-n.length>=0;){const t=r[0];for(let i=0;i<n.length;i++)r[i]^=e.mul(n[i],t);let i=0;for(;i<r.length&&0===r[i];)i++;r=r.slice(i)}return r},t.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=t.mul(r,new Uint8Array([1,e.exp(i)]));return r}}(R);const k=R;function x(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}x.prototype.initialize=function(t){this.degree=t,this.genPoly=k.generateECPolynomial(this.degree)},x.prototype.encode=function(t){if(!this.genPoly)throw new Error("Encoder not initialized");const e=new Uint8Array(t.length+this.degree);e.set(t);const n=k.mod(e,this.genPoly),r=this.degree-n.length;if(r>0){const t=new Uint8Array(this.degree);return t.set(n,r),t}return n};var N=x,D={},S={},U={isValid:function(t){return!isNaN(t)&&t>=1&&t<=40}},Y={};const H="[0-9]+";let F="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";F=F.replace(/u/g,"\\u");const z="(?:(?![A-Z0-9 $%*+\\-./:]|"+F+")(?:.|[\r\n]))+";Y.KANJI=new RegExp(F,"g"),Y.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),Y.BYTE=new RegExp(z,"g"),Y.NUMERIC=new RegExp(H,"g"),Y.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");const G=new RegExp("^"+F+"$"),j=new RegExp("^"+H+"$"),W=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");Y.testKanji=function(t){return G.test(t)},Y.testNumeric=function(t){return j.test(t)},Y.testAlphanumeric=function(t){return W.test(t)},function(t){const e=U,n=Y;t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(t,n){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!e.isValid(n))throw new Error("Invalid version: "+n);return n>=1&&n<10?t.ccBits[0]:n<27?t.ccBits[1]:t.ccBits[2]},t.getBestModeForData=function(e){return n.testNumeric(e)?t.NUMERIC:n.testAlphanumeric(e)?t.ALPHANUMERIC:n.testKanji(e)?t.KANJI:t.BYTE},t.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")},t.isValid=function(t){return t&&t.bit&&t.ccBits},t.from=function(e,n){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+e)}}(e)}catch(t){return n}}}(S),function(t){const e=d,n=I,r=_,i=S,o=U,s=e.getBCHDigit(7973);function a(t,e){return i.getCharCountIndicator(t,e)+4}function h(t,e){let n=0;return t.forEach((function(t){const r=a(t.mode,e);n+=r+t.getBitsLength()})),n}t.from=function(t,e){return o.isValid(t)?parseInt(t,10):e},t.getCapacity=function(t,r,s){if(!o.isValid(t))throw new Error("Invalid QR Code version");void 0===s&&(s=i.BYTE);const h=8*(e.getSymbolTotalCodewords(t)-n.getTotalCodewordsCount(t,r));if(s===i.MIXED)return h;const l=h-a(s,t);switch(s){case i.NUMERIC:return Math.floor(l/10*3);case i.ALPHANUMERIC:return Math.floor(l/11*2);case i.KANJI:return Math.floor(l/13);case i.BYTE:default:return Math.floor(l/8)}},t.getBestVersionForData=function(e,n){let o;const s=r.from(n,r.M);if(Array.isArray(e)){if(e.length>1)return function(e,n){for(let r=1;r<=40;r++)if(h(e,r)<=t.getCapacity(r,n,i.MIXED))return r}(e,s);if(0===e.length)return 1;o=e[0]}else o=e;return function(e,n,r){for(let i=1;i<=40;i++)if(n<=t.getCapacity(i,r,e))return i}(o.mode,o.getLength(),s)},t.getEncodedBits=function(t){if(!o.isValid(t)||t<7)throw new Error("Invalid QR Code version");let n=t<<12;for(;e.getBCHDigit(n)-s>=0;)n^=7973<<e.getBCHDigit(n)-s;return t<<12|n}}(D);var q={};const K=d,J=K.getBCHDigit(1335);q.getEncodedBits=function(t,e){const n=t.bit<<3|e;let r=n<<10;for(;K.getBCHDigit(r)-J>=0;)r^=1335<<K.getBCHDigit(r)-J;return 21522^(n<<10|r)};var V={};const Q=S;function Z(t){this.mode=Q.NUMERIC,this.data=t.toString()}Z.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)},Z.prototype.getLength=function(){return this.data.length},Z.prototype.getBitsLength=function(){return Z.getBitsLength(this.data.length)},Z.prototype.write=function(t){let e,n,r;for(e=0;e+3<=this.data.length;e+=3)n=this.data.substr(e,3),r=parseInt(n,10),t.put(r,10);const i=this.data.length-e;i>0&&(n=this.data.substr(e),r=parseInt(n,10),t.put(r,3*i+1))};var $=Z;const X=S,tt=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function et(t){this.mode=X.ALPHANUMERIC,this.data=t}et.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},et.prototype.getLength=function(){return this.data.length},et.prototype.getBitsLength=function(){return et.getBitsLength(this.data.length)},et.prototype.write=function(t){let e;for(e=0;e+2<=this.data.length;e+=2){let n=45*tt.indexOf(this.data[e]);n+=tt.indexOf(this.data[e+1]),t.put(n,11)}this.data.length%2&&t.put(tt.indexOf(this.data[e]),6)};var nt=et;const rt=function(t){for(var e=[],n=t.length,r=0;r<n;r++){var i=t.charCodeAt(r);if(i>=55296&&i<=56319&&n>r+1){var o=t.charCodeAt(r+1);o>=56320&&o<=57343&&(i=1024*(i-55296)+o-56320+65536,r+=1)}i<128?e.push(i):i<2048?(e.push(i>>6|192),e.push(63&i|128)):i<55296||i>=57344&&i<65536?(e.push(i>>12|224),e.push(i>>6&63|128),e.push(63&i|128)):i>=65536&&i<=1114111?(e.push(i>>18|240),e.push(i>>12&63|128),e.push(i>>6&63|128),e.push(63&i|128)):e.push(239,191,189)}return new Uint8Array(e).buffer},it=S;function ot(t){this.mode=it.BYTE,"string"==typeof t&&(t=rt(t)),this.data=new Uint8Array(t)}ot.getBitsLength=function(t){return 8*t},ot.prototype.getLength=function(){return this.data.length},ot.prototype.getBitsLength=function(){return ot.getBitsLength(this.data.length)},ot.prototype.write=function(t){for(let e=0,n=this.data.length;e<n;e++)t.put(this.data[e],8)};var st=ot;const at=S,ht=d;function lt(t){this.mode=at.KANJI,this.data=t}lt.getBitsLength=function(t){return 13*t},lt.prototype.getLength=function(){return this.data.length},lt.prototype.getBitsLength=function(){return lt.getBitsLength(this.data.length)},lt.prototype.write=function(t){let e;for(e=0;e<this.data.length;e++){let n=ht.toSJIS(this.data[e]);if(n>=33088&&n<=40956)n-=33088;else{if(!(n>=57408&&n<=60351))throw new Error("Invalid SJIS character: "+this.data[e]+"\nMake sure your charset is UTF-8");n-=49472}n=192*(n>>>8&255)+(255&n),t.put(n,13)}};var ut=lt,ft={exports:{}};!function(t){var e={single_source_shortest_paths:function(t,n,r){var i={},o={};o[n]=0;var s,a,h,l,u,f,c,d=e.PriorityQueue.make();for(d.push(n,0);!d.empty();)for(h in a=(s=d.pop()).value,l=s.cost,u=t[a]||{})u.hasOwnProperty(h)&&(f=l+u[h],c=o[h],(void 0===o[h]||c>f)&&(o[h]=f,d.push(h,f),i[h]=a));if(void 0!==r&&void 0===o[r]){var p=["Could not find a path from ",n," to ",r,"."].join("");throw new Error(p)}return i},extract_shortest_path_from_predecessor_list:function(t,e){for(var n=[],r=e;r;)n.push(r),t[r],r=t[r];return n.reverse(),n},find_path:function(t,n,r){var i=e.single_source_shortest_paths(t,n,r);return e.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(t){var n,r=e.PriorityQueue,i={};for(n in t=t||{},r)r.hasOwnProperty(n)&&(i[n]=r[n]);return i.queue=[],i.sorter=t.sorter||r.default_sorter,i},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var n={value:t,cost:e};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};t.exports=e}(ft);var ct=ft.exports;!function(t){const e=S,n=$,r=nt,i=st,o=ut,s=Y,a=d,h=ct;function l(t){return unescape(encodeURIComponent(t)).length}function u(t,e,n){const r=[];let i;for(;null!==(i=t.exec(n));)r.push({data:i[0],index:i.index,mode:e,length:i[0].length});return r}function f(t){const n=u(s.NUMERIC,e.NUMERIC,t),r=u(s.ALPHANUMERIC,e.ALPHANUMERIC,t);let i,o;a.isKanjiModeEnabled()?(i=u(s.BYTE,e.BYTE,t),o=u(s.KANJI,e.KANJI,t)):(i=u(s.BYTE_KANJI,e.BYTE,t),o=[]);return n.concat(r,i,o).sort((function(t,e){return t.index-e.index})).map((function(t){return{data:t.data,mode:t.mode,length:t.length}}))}function c(t,s){switch(s){case e.NUMERIC:return n.getBitsLength(t);case e.ALPHANUMERIC:return r.getBitsLength(t);case e.KANJI:return o.getBitsLength(t);case e.BYTE:return i.getBitsLength(t)}}function p(t,s){let h;const l=e.getBestModeForData(t);if(h=e.from(s,l),h!==e.BYTE&&h.bit<l.bit)throw new Error('"'+t+'" cannot be encoded with mode '+e.toString(h)+".\n Suggested mode is: "+e.toString(l));switch(h!==e.KANJI||a.isKanjiModeEnabled()||(h=e.BYTE),h){case e.NUMERIC:return new n(t);case e.ALPHANUMERIC:return new r(t);case e.KANJI:return new o(t);case e.BYTE:return new i(t)}}t.fromArray=function(t){return t.reduce((function(t,e){return"string"==typeof e?t.push(p(e,null)):e.data&&t.push(p(e.data,e.mode)),t}),[])},t.fromString=function(n,r){const i=function(t){const n=[];for(let r=0;r<t.length;r++){const i=t[r];switch(i.mode){case e.NUMERIC:n.push([i,{data:i.data,mode:e.ALPHANUMERIC,length:i.length},{data:i.data,mode:e.BYTE,length:i.length}]);break;case e.ALPHANUMERIC:n.push([i,{data:i.data,mode:e.BYTE,length:i.length}]);break;case e.KANJI:n.push([i,{data:i.data,mode:e.BYTE,length:l(i.data)}]);break;case e.BYTE:n.push([{data:i.data,mode:e.BYTE,length:l(i.data)}])}}return n}(f(n,a.isKanjiModeEnabled())),o=function(t,n){const r={},i={start:{}};let o=["start"];for(let s=0;s<t.length;s++){const a=t[s],h=[];for(let t=0;t<a.length;t++){const l=a[t],u=""+s+t;h.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let t=0;t<o.length;t++){const s=o[t];r[s]&&r[s].node.mode===l.mode?(i[s][u]=c(r[s].lastCount+l.length,l.mode)-c(r[s].lastCount,l.mode),r[s].lastCount+=l.length):(r[s]&&(r[s].lastCount=l.length),i[s][u]=c(l.length,l.mode)+4+e.getCharCountIndicator(l.mode,n))}}o=h}for(let t=0;t<o.length;t++)i[o[t]].end=0;return{map:i,table:r}}(i,r),s=h.find_path(o.map,"start","end"),u=[];for(let t=1;t<s.length-1;t++)u.push(o.table[s[t]].node);return t.fromArray(function(t){return t.reduce((function(t,e){const n=t.length-1>=0?t[t.length-1]:null;return n&&n.mode===e.mode?(t[t.length-1].data+=e.data,t):(t.push(e),t)}),[])}(u))},t.rawSplit=function(e){return t.fromArray(f(e,a.isKanjiModeEnabled()))}}(V);const dt=d,pt=_,gt=m,_t=E,wt=b,mt=T,yt=A,Et=I,bt=N,Tt=D,Ct=q,At=S,It=V;function Pt(t,e,n){const r=t.size,i=Ct.getEncodedBits(e,n);let o,s;for(o=0;o<15;o++)s=1==(i>>o&1),o<6?t.set(o,8,s,!0):o<8?t.set(o+1,8,s,!0):t.set(r-15+o,8,s,!0),o<8?t.set(8,r-o-1,s,!0):o<9?t.set(8,15-o-1+1,s,!0):t.set(8,15-o-1,s,!0);t.set(r-8,8,1,!0)}function Lt(t,e,n){const r=new gt;n.forEach((function(e){r.put(e.mode.bit,4),r.put(e.getLength(),At.getCharCountIndicator(e.mode,t)),e.write(r)}));const i=8*(dt.getSymbolTotalCodewords(t)-Et.getTotalCodewordsCount(t,e));for(r.getLengthInBits()+4<=i&&r.put(0,4);r.getLengthInBits()%8!=0;)r.putBit(0);const o=(i-r.getLengthInBits())/8;for(let t=0;t<o;t++)r.put(t%2?17:236,8);return function(t,e,n){const r=dt.getSymbolTotalCodewords(e),i=Et.getTotalCodewordsCount(e,n),o=r-i,s=Et.getBlocksCount(e,n),a=r%s,h=s-a,l=Math.floor(r/s),u=Math.floor(o/s),f=u+1,c=l-u,d=new bt(c);let p=0;const g=new Array(s),_=new Array(s);let w=0;const m=new Uint8Array(t.buffer);for(let t=0;t<s;t++){const e=t<h?u:f;g[t]=m.slice(p,p+e),_[t]=d.encode(g[t]),p+=e,w=Math.max(w,e)}const y=new Uint8Array(r);let E,b,T=0;for(E=0;E<w;E++)for(b=0;b<s;b++)E<g[b].length&&(y[T++]=g[b][E]);for(E=0;E<c;E++)for(b=0;b<s;b++)y[T++]=_[b][E];return y}(r,t,e)}function vt(t,e,n,r){let i;if(Array.isArray(t))i=It.fromArray(t);else{if("string"!=typeof t)throw new Error("Invalid data");{let r=e;if(!r){const e=It.rawSplit(t);r=Tt.getBestVersionForData(e,n)}i=It.fromString(t,r||40)}}const o=Tt.getBestVersionForData(i,n);if(!o)throw new Error("The amount of data is too big to be stored in a QR Code");if(e){if(e<o)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+o+".\n")}else e=o;const s=Lt(e,n,i),a=dt.getSymbolSize(e),h=new _t(a);return function(t,e){const n=t.size,r=mt.getPositions(e);for(let e=0;e<r.length;e++){const i=r[e][0],o=r[e][1];for(let e=-1;e<=7;e++)if(!(i+e<=-1||n<=i+e))for(let r=-1;r<=7;r++)o+r<=-1||n<=o+r||(e>=0&&e<=6&&(0===r||6===r)||r>=0&&r<=6&&(0===e||6===e)||e>=2&&e<=4&&r>=2&&r<=4?t.set(i+e,o+r,!0,!0):t.set(i+e,o+r,!1,!0))}}(h,e),function(t){const e=t.size;for(let n=8;n<e-8;n++){const e=n%2==0;t.set(n,6,e,!0),t.set(6,n,e,!0)}}(h),function(t,e){const n=wt.getPositions(e);for(let e=0;e<n.length;e++){const r=n[e][0],i=n[e][1];for(let e=-2;e<=2;e++)for(let n=-2;n<=2;n++)-2===e||2===e||-2===n||2===n||0===e&&0===n?t.set(r+e,i+n,!0,!0):t.set(r+e,i+n,!1,!0)}}(h,e),Pt(h,n,0),e>=7&&function(t,e){const n=t.size,r=Tt.getEncodedBits(e);let i,o,s;for(let e=0;e<18;e++)i=Math.floor(e/3),o=e%3+n-8-3,s=1==(r>>e&1),t.set(i,o,s,!0),t.set(o,i,s,!0)}(h,e),function(t,e){const n=t.size;let r=-1,i=n-1,o=7,s=0;for(let a=n-1;a>0;a-=2)for(6===a&&a--;;){for(let n=0;n<2;n++)if(!t.isReserved(i,a-n)){let r=!1;s<e.length&&(r=1==(e[s]>>>o&1)),t.set(i,a-n,r),o--,-1===o&&(s++,o=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}(h,s),isNaN(r)&&(r=yt.getBestMask(h,Pt.bind(null,h,n))),yt.applyMask(r,h),Pt(h,n,r),{modules:h,version:e,errorCorrectionLevel:n,maskPattern:r,segments:i}}c.create=function(t,e){if(void 0===t||""===t)throw new Error("No input text");let n,r,i=pt.M;return void 0!==e&&(i=pt.from(e.errorCorrectionLevel,pt.M),n=Tt.from(e.version),r=yt.from(e.maskPattern),e.toSJISFunc&&dt.setToSJISFunction(e.toSJISFunc)),vt(t,n,i,r)};var Rt={},Bt={},Ot={exports:{}},Mt={exports:{}};let kt=r,xt=i,Nt=Mt.exports=function(){xt.call(this),this._buffers=[],this._buffered=0,this._reads=[],this._paused=!1,this._encoding="utf8",this.writable=!0};kt.inherits(Nt,xt),Nt.prototype.read=function(t,e){this._reads.push({length:Math.abs(t),allowLess:t<0,func:e}),process.nextTick(function(){this._process(),this._paused&&this._reads&&this._reads.length>0&&(this._paused=!1,this.emit("drain"))}.bind(this))},Nt.prototype.write=function(t,e){if(!this.writable)return this.emit("error",new Error("Stream not writable")),!1;let n;return n=Buffer.isBuffer(t)?t:Buffer.from(t,e||this._encoding),this._buffers.push(n),this._buffered+=n.length,this._process(),this._reads&&0===this._reads.length&&(this._paused=!0),this.writable&&!this._paused},Nt.prototype.end=function(t,e){t&&this.write(t,e),this.writable=!1,this._buffers&&(0===this._buffers.length?this._end():(this._buffers.push(null),this._process()))},Nt.prototype.destroySoon=Nt.prototype.end,Nt.prototype._end=function(){this._reads.length>0&&this.emit("error",new Error("Unexpected end of input")),this.destroy()},Nt.prototype.destroy=function(){this._buffers&&(this.writable=!1,this._reads=null,this._buffers=null,this.emit("close"))},Nt.prototype._processReadAllowingLess=function(t){this._reads.shift();let e=this._buffers[0];e.length>t.length?(this._buffered-=t.length,this._buffers[0]=e.slice(t.length),t.func.call(this,e.slice(0,t.length))):(this._buffered-=e.length,this._buffers.shift(),t.func.call(this,e))},Nt.prototype._processRead=function(t){this._reads.shift();let e=0,n=0,r=Buffer.alloc(t.length);for(;e<t.length;){let i=this._buffers[n++],o=Math.min(i.length,t.length-e);i.copy(r,e,0,o),e+=o,o!==i.length&&(this._buffers[--n]=i.slice(o))}n>0&&this._buffers.splice(0,n),this._buffered-=t.length,t.func.call(this,r)},Nt.prototype._process=function(){try{for(;this._buffered>0&&this._reads&&this._reads.length>0;){let t=this._reads[0];if(t.allowLess)this._processReadAllowingLess(t);else{if(!(this._buffered>=t.length))break;this._processRead(t)}}this._buffers&&!this.writable&&this._end()}catch(t){this.emit("error",t)}};var Dt=Mt.exports,St={exports:{}},Ut={exports:{}},Yt={};let Ht=[{x:[0],y:[0]},{x:[4],y:[0]},{x:[0,4],y:[4]},{x:[2,6],y:[0,4]},{x:[0,2,4,6],y:[2,6]},{x:[1,3,5,7],y:[0,2,4,6]},{x:[0,1,2,3,4,5,6,7],y:[1,3,5,7]}];Yt.getImagePasses=function(t,e){let n=[],r=t%8,i=e%8,o=(t-r)/8,s=(e-i)/8;for(let t=0;t<Ht.length;t++){let e=Ht[t],a=o*e.x.length,h=s*e.y.length;for(let t=0;t<e.x.length&&e.x[t]<r;t++)a++;for(let t=0;t<e.y.length&&e.y[t]<i;t++)h++;a>0&&h>0&&n.push({width:a,height:h,index:t})}return n},Yt.getInterlaceIterator=function(t){return function(e,n,r){let i=e%Ht[r].x.length,o=(e-i)/Ht[r].x.length*8+Ht[r].x[i],s=n%Ht[r].y.length;return 4*o+((n-s)/Ht[r].y.length*8+Ht[r].y[s])*t*4}};var Ft=function(t,e,n){let r=t+e-n,i=Math.abs(r-t),o=Math.abs(r-e),s=Math.abs(r-n);return i<=o&&i<=s?t:o<=s?e:n};let zt=Yt,Gt=Ft;function jt(t,e,n){let r=t*e;return 8!==n&&(r=Math.ceil(r/(8/n))),r}let Wt=Ut.exports=function(t,e){let n=t.width,r=t.height,i=t.interlace,o=t.bpp,s=t.depth;if(this.read=e.read,this.write=e.write,this.complete=e.complete,this._imageIndex=0,this._images=[],i){let t=zt.getImagePasses(n,r);for(let e=0;e<t.length;e++)this._images.push({byteWidth:jt(t[e].width,o,s),height:t[e].height,lineIndex:0})}else this._images.push({byteWidth:jt(n,o,s),height:r,lineIndex:0});this._xComparison=8===s?o:16===s?2*o:1};Wt.prototype.start=function(){this.read(this._images[this._imageIndex].byteWidth+1,this._reverseFilterLine.bind(this))},Wt.prototype._unFilterType1=function(t,e,n){let r=this._xComparison,i=r-1;for(let o=0;o<n;o++){let n=t[1+o],s=o>i?e[o-r]:0;e[o]=n+s}},Wt.prototype._unFilterType2=function(t,e,n){let r=this._lastLine;for(let i=0;i<n;i++){let n=t[1+i],o=r?r[i]:0;e[i]=n+o}},Wt.prototype._unFilterType3=function(t,e,n){let r=this._xComparison,i=r-1,o=this._lastLine;for(let s=0;s<n;s++){let n=t[1+s],a=o?o[s]:0,h=s>i?e[s-r]:0,l=Math.floor((h+a)/2);e[s]=n+l}},Wt.prototype._unFilterType4=function(t,e,n){let r=this._xComparison,i=r-1,o=this._lastLine;for(let s=0;s<n;s++){let n=t[1+s],a=o?o[s]:0,h=s>i?e[s-r]:0,l=s>i&&o?o[s-r]:0,u=Gt(h,a,l);e[s]=n+u}},Wt.prototype._reverseFilterLine=function(t){let e,n=t[0],r=this._images[this._imageIndex],i=r.byteWidth;if(0===n)e=t.slice(1,i+1);else switch(e=Buffer.alloc(i),n){case 1:this._unFilterType1(t,e,i);break;case 2:this._unFilterType2(t,e,i);break;case 3:this._unFilterType3(t,e,i);break;case 4:this._unFilterType4(t,e,i);break;default:throw new Error("Unrecognised filter type - "+n)}this.write(e),r.lineIndex++,r.lineIndex>=r.height?(this._lastLine=null,this._imageIndex++,r=this._images[this._imageIndex]):this._lastLine=e,r?this.read(r.byteWidth+1,this._reverseFilterLine.bind(this)):(this._lastLine=null,this.complete())};var qt=Ut.exports;let Kt=r,Jt=Dt,Vt=qt,Qt=St.exports=function(t){Jt.call(this);let e=[],n=this;this._filter=new Vt(t,{read:this.read.bind(this),write:function(t){e.push(t)},complete:function(){n.emit("complete",Buffer.concat(e))}}),this._filter.start()};Kt.inherits(Qt,Jt);var Zt=St.exports,$t={exports:{}},Xt={PNG_SIGNATURE:[137,80,78,71,13,10,26,10],TYPE_IHDR:1229472850,TYPE_IEND:1229278788,TYPE_IDAT:1229209940,TYPE_PLTE:1347179589,TYPE_tRNS:1951551059,TYPE_gAMA:1732332865,COLORTYPE_GRAYSCALE:0,COLORTYPE_PALETTE:1,COLORTYPE_COLOR:2,COLORTYPE_ALPHA:4,COLORTYPE_PALETTE_COLOR:3,COLORTYPE_COLOR_ALPHA:6,COLORTYPE_TO_BPP_MAP:{0:1,2:3,3:1,4:2,6:4},GAMMA_DIVISION:1e5},te={exports:{}};let ee=[];!function(){for(let t=0;t<256;t++){let e=t;for(let t=0;t<8;t++)1&e?e=3988292384^e>>>1:e>>>=1;ee[t]=e}}();let ne=te.exports=function(){this._crc=-1};ne.prototype.write=function(t){for(let e=0;e<t.length;e++)this._crc=ee[255&(this._crc^t[e])]^this._crc>>>8;return!0},ne.prototype.crc32=function(){return-1^this._crc},ne.crc32=function(t){let e=-1;for(let n=0;n<t.length;n++)e=ee[255&(e^t[n])]^e>>>8;return-1^e};var re=te.exports;let ie=Xt,oe=re,se=$t.exports=function(t,e){this._options=t,t.checkCRC=!1!==t.checkCRC,this._hasIHDR=!1,this._hasIEND=!1,this._emittedHeadersFinished=!1,this._palette=[],this._colorType=0,this._chunks={},this._chunks[ie.TYPE_IHDR]=this._handleIHDR.bind(this),this._chunks[ie.TYPE_IEND]=this._handleIEND.bind(this),this._chunks[ie.TYPE_IDAT]=this._handleIDAT.bind(this),this._chunks[ie.TYPE_PLTE]=this._handlePLTE.bind(this),this._chunks[ie.TYPE_tRNS]=this._handleTRNS.bind(this),this._chunks[ie.TYPE_gAMA]=this._handleGAMA.bind(this),this.read=e.read,this.error=e.error,this.metadata=e.metadata,this.gamma=e.gamma,this.transColor=e.transColor,this.palette=e.palette,this.parsed=e.parsed,this.inflateData=e.inflateData,this.finished=e.finished,this.simpleTransparency=e.simpleTransparency,this.headersFinished=e.headersFinished||function(){}};se.prototype.start=function(){this.read(ie.PNG_SIGNATURE.length,this._parseSignature.bind(this))},se.prototype._parseSignature=function(t){let e=ie.PNG_SIGNATURE;for(let n=0;n<e.length;n++)if(t[n]!==e[n])return void this.error(new Error("Invalid file signature"));this.read(8,this._parseChunkBegin.bind(this))},se.prototype._parseChunkBegin=function(t){let e=t.readUInt32BE(0),n=t.readUInt32BE(4),r="";for(let e=4;e<8;e++)r+=String.fromCharCode(t[e]);let i=Boolean(32&t[4]);if(this._hasIHDR||n===ie.TYPE_IHDR){if(this._crc=new oe,this._crc.write(Buffer.from(r)),this._chunks[n])return this._chunks[n](e);i?this.read(e+4,this._skipChunk.bind(this)):this.error(new Error("Unsupported critical chunk type "+r))}else this.error(new Error("Expected IHDR on beggining"))},se.prototype._skipChunk=function(){this.read(8,this._parseChunkBegin.bind(this))},se.prototype._handleChunkEnd=function(){this.read(4,this._parseChunkEnd.bind(this))},se.prototype._parseChunkEnd=function(t){let e=t.readInt32BE(0),n=this._crc.crc32();this._options.checkCRC&&n!==e?this.error(new Error("Crc error - "+e+" - "+n)):this._hasIEND||this.read(8,this._parseChunkBegin.bind(this))},se.prototype._handleIHDR=function(t){this.read(t,this._parseIHDR.bind(this))},se.prototype._parseIHDR=function(t){this._crc.write(t);let e=t.readUInt32BE(0),n=t.readUInt32BE(4),r=t[8],i=t[9],o=t[10],s=t[11],a=t[12];if(8!==r&&4!==r&&2!==r&&1!==r&&16!==r)return void this.error(new Error("Unsupported bit depth "+r));if(!(i in ie.COLORTYPE_TO_BPP_MAP))return void this.error(new Error("Unsupported color type"));if(0!==o)return void this.error(new Error("Unsupported compression method"));if(0!==s)return void this.error(new Error("Unsupported filter method"));if(0!==a&&1!==a)return void this.error(new Error("Unsupported interlace method"));this._colorType=i;let h=ie.COLORTYPE_TO_BPP_MAP[this._colorType];this._hasIHDR=!0,this.metadata({width:e,height:n,depth:r,interlace:Boolean(a),palette:Boolean(i&ie.COLORTYPE_PALETTE),color:Boolean(i&ie.COLORTYPE_COLOR),alpha:Boolean(i&ie.COLORTYPE_ALPHA),bpp:h,colorType:i}),this._handleChunkEnd()},se.prototype._handlePLTE=function(t){this.read(t,this._parsePLTE.bind(this))},se.prototype._parsePLTE=function(t){this._crc.write(t);let e=Math.floor(t.length/3);for(let n=0;n<e;n++)this._palette.push([t[3*n],t[3*n+1],t[3*n+2],255]);this.palette(this._palette),this._handleChunkEnd()},se.prototype._handleTRNS=function(t){this.simpleTransparency(),this.read(t,this._parseTRNS.bind(this))},se.prototype._parseTRNS=function(t){if(this._crc.write(t),this._colorType===ie.COLORTYPE_PALETTE_COLOR){if(0===this._palette.length)return void this.error(new Error("Transparency chunk must be after palette"));if(t.length>this._palette.length)return void this.error(new Error("More transparent colors than palette size"));for(let e=0;e<t.length;e++)this._palette[e][3]=t[e];this.palette(this._palette)}this._colorType===ie.COLORTYPE_GRAYSCALE&&this.transColor([t.readUInt16BE(0)]),this._colorType===ie.COLORTYPE_COLOR&&this.transColor([t.readUInt16BE(0),t.readUInt16BE(2),t.readUInt16BE(4)]),this._handleChunkEnd()},se.prototype._handleGAMA=function(t){this.read(t,this._parseGAMA.bind(this))},se.prototype._parseGAMA=function(t){this._crc.write(t),this.gamma(t.readUInt32BE(0)/ie.GAMMA_DIVISION),this._handleChunkEnd()},se.prototype._handleIDAT=function(t){this._emittedHeadersFinished||(this._emittedHeadersFinished=!0,this.headersFinished()),this.read(-t,this._parseIDAT.bind(this,t))},se.prototype._parseIDAT=function(t,e){if(this._crc.write(e),this._colorType===ie.COLORTYPE_PALETTE_COLOR&&0===this._palette.length)throw new Error("Expected palette not found");this.inflateData(e);let n=t-e.length;n>0?this._handleIDAT(n):this._handleChunkEnd()},se.prototype._handleIEND=function(t){this.read(t,this._parseIEND.bind(this))},se.prototype._parseIEND=function(t){this._crc.write(t),this._hasIEND=!0,this._handleChunkEnd(),this.finished&&this.finished()};var ae=$t.exports,he={};let le=Yt,ue=[function(){},function(t,e,n,r){if(r===e.length)throw new Error("Ran out of data");let i=e[r];t[n]=i,t[n+1]=i,t[n+2]=i,t[n+3]=255},function(t,e,n,r){if(r+1>=e.length)throw new Error("Ran out of data");let i=e[r];t[n]=i,t[n+1]=i,t[n+2]=i,t[n+3]=e[r+1]},function(t,e,n,r){if(r+2>=e.length)throw new Error("Ran out of data");t[n]=e[r],t[n+1]=e[r+1],t[n+2]=e[r+2],t[n+3]=255},function(t,e,n,r){if(r+3>=e.length)throw new Error("Ran out of data");t[n]=e[r],t[n+1]=e[r+1],t[n+2]=e[r+2],t[n+3]=e[r+3]}],fe=[function(){},function(t,e,n,r){let i=e[0];t[n]=i,t[n+1]=i,t[n+2]=i,t[n+3]=r},function(t,e,n){let r=e[0];t[n]=r,t[n+1]=r,t[n+2]=r,t[n+3]=e[1]},function(t,e,n,r){t[n]=e[0],t[n+1]=e[1],t[n+2]=e[2],t[n+3]=r},function(t,e,n){t[n]=e[0],t[n+1]=e[1],t[n+2]=e[2],t[n+3]=e[3]}];function ce(t,e,n,r,i,o){let s=t.width,a=t.height,h=t.index;for(let t=0;t<a;t++)for(let a=0;a<s;a++){let s=n(a,t,h);ue[r](e,i,s,o),o+=r}return o}function de(t,e,n,r,i,o){let s=t.width,a=t.height,h=t.index;for(let t=0;t<a;t++){for(let a=0;a<s;a++){let s=i.get(r),l=n(a,t,h);fe[r](e,s,l,o)}i.resetAfterLine()}}he.dataToBitMap=function(t,e){let n,r,i=e.width,o=e.height,s=e.depth,a=e.bpp,h=e.interlace;8!==s&&(n=function(t,e){let n=[],r=0;function i(){if(r===t.length)throw new Error("Ran out of data");let i,o,s,a,h,l,u,f,c=t[r];switch(r++,e){default:throw new Error("unrecognised depth");case 16:u=t[r],r++,n.push((c<<8)+u);break;case 4:u=15&c,f=c>>4,n.push(f,u);break;case 2:h=3&c,l=c>>2&3,u=c>>4&3,f=c>>6&3,n.push(f,u,l,h);break;case 1:i=1&c,o=c>>1&1,s=c>>2&1,a=c>>3&1,h=c>>4&1,l=c>>5&1,u=c>>6&1,f=c>>7&1,n.push(f,u,l,h,a,s,o,i)}}return{get:function(t){for(;n.length<t;)i();let e=n.slice(0,t);return n=n.slice(t),e},resetAfterLine:function(){n.length=0},end:function(){if(r!==t.length)throw new Error("extra data found")}}}(t,s)),r=s<=8?Buffer.alloc(i*o*4):new Uint16Array(i*o*4);let l,u,f=Math.pow(2,s)-1,c=0;if(h)l=le.getImagePasses(i,o),u=le.getInterlaceIterator(i,o);else{let t=0;u=function(){let e=t;return t+=4,e},l=[{width:i,height:o}]}for(let e=0;e<l.length;e++)8===s?c=ce(l[e],r,u,a,t,c):de(l[e],r,u,a,n,f);if(8===s){if(c!==t.length)throw new Error("extra data found")}else n.end();return r};var pe=function(t,e){let n=e.depth,r=e.width,i=e.height,o=e.colorType,s=e.transColor,a=e.palette,h=t;return 3===o?function(t,e,n,r,i){let o=0;for(let s=0;s<r;s++)for(let r=0;r<n;r++){let n=i[t[o]];if(!n)throw new Error("index "+t[o]+" not in palette");for(let t=0;t<4;t++)e[o+t]=n[t];o+=4}}(t,h,r,i,a):(s&&function(t,e,n,r,i){let o=0;for(let s=0;s<r;s++)for(let r=0;r<n;r++){let n=!1;if(1===i.length?i[0]===t[o]&&(n=!0):i[0]===t[o]&&i[1]===t[o+1]&&i[2]===t[o+2]&&(n=!0),n)for(let t=0;t<4;t++)e[o+t]=0;o+=4}}(t,h,r,i,s),8!==n&&(16===n&&(h=Buffer.alloc(r*i*4)),function(t,e,n,r,i){let o=Math.pow(2,i)-1,s=0;for(let i=0;i<r;i++)for(let r=0;r<n;r++){for(let n=0;n<4;n++)e[s+n]=Math.floor(255*t[s+n]/o+.5);s+=4}}(t,h,r,i,n))),h};let ge=r,_e=o,we=Dt,me=Zt,ye=ae,Ee=he,be=pe,Te=Ot.exports=function(t){we.call(this),this._parser=new ye(t,{read:this.read.bind(this),error:this._handleError.bind(this),metadata:this._handleMetaData.bind(this),gamma:this.emit.bind(this,"gamma"),palette:this._handlePalette.bind(this),transColor:this._handleTransColor.bind(this),finished:this._finished.bind(this),inflateData:this._inflateData.bind(this),simpleTransparency:this._simpleTransparency.bind(this),headersFinished:this._headersFinished.bind(this)}),this._options=t,this.writable=!0,this._parser.start()};ge.inherits(Te,we),Te.prototype._handleError=function(t){this.emit("error",t),this.writable=!1,this.destroy(),this._inflate&&this._inflate.destroy&&this._inflate.destroy(),this._filter&&(this._filter.destroy(),this._filter.on("error",(function(){}))),this.errord=!0},Te.prototype._inflateData=function(t){if(!this._inflate)if(this._bitmapInfo.interlace)this._inflate=_e.createInflate(),this._inflate.on("error",this.emit.bind(this,"error")),this._filter.on("complete",this._complete.bind(this)),this._inflate.pipe(this._filter);else{let t=(1+(this._bitmapInfo.width*this._bitmapInfo.bpp*this._bitmapInfo.depth+7>>3))*this._bitmapInfo.height,e=Math.max(t,_e.Z_MIN_CHUNK);this._inflate=_e.createInflate({chunkSize:e});let n=t,r=this.emit.bind(this,"error");this._inflate.on("error",(function(t){n&&r(t)})),this._filter.on("complete",this._complete.bind(this));let i=this._filter.write.bind(this._filter);this._inflate.on("data",(function(t){n&&(t.length>n&&(t=t.slice(0,n)),n-=t.length,i(t))})),this._inflate.on("end",this._filter.end.bind(this._filter))}this._inflate.write(t)},Te.prototype._handleMetaData=function(t){this._metaData=t,this._bitmapInfo=Object.create(t),this._filter=new me(this._bitmapInfo)},Te.prototype._handleTransColor=function(t){this._bitmapInfo.transColor=t},Te.prototype._handlePalette=function(t){this._bitmapInfo.palette=t},Te.prototype._simpleTransparency=function(){this._metaData.alpha=!0},Te.prototype._headersFinished=function(){this.emit("metadata",this._metaData)},Te.prototype._finished=function(){this.errord||(this._inflate?this._inflate.end():this.emit("error","No Inflate block"))},Te.prototype._complete=function(t){if(this.errord)return;let e;try{let n=Ee.dataToBitMap(t,this._bitmapInfo);e=be(n,this._bitmapInfo),n=null}catch(t){return void this._handleError(t)}this.emit("parsed",e)};var Ce=Ot.exports,Ae={exports:{}},Ie={exports:{}};let Pe=Xt;let Le=Ft;let ve={0:function(t,e,n,r,i){for(let o=0;o<n;o++)r[i+o]=t[e+o]},1:function(t,e,n,r,i,o){for(let s=0;s<n;s++){let n=s>=o?t[e+s-o]:0,a=t[e+s]-n;r[i+s]=a}},2:function(t,e,n,r,i){for(let o=0;o<n;o++){let s=e>0?t[e+o-n]:0,a=t[e+o]-s;r[i+o]=a}},3:function(t,e,n,r,i,o){for(let s=0;s<n;s++){let a=s>=o?t[e+s-o]:0,h=e>0?t[e+s-n]:0,l=t[e+s]-(a+h>>1);r[i+s]=l}},4:function(t,e,n,r,i,o){for(let s=0;s<n;s++){let a=s>=o?t[e+s-o]:0,h=e>0?t[e+s-n]:0,l=e>0&&s>=o?t[e+s-(n+o)]:0,u=t[e+s]-Le(a,h,l);r[i+s]=u}}},Re={0:function(t,e,n){let r=0,i=e+n;for(let n=e;n<i;n++)r+=Math.abs(t[n]);return r},1:function(t,e,n,r){let i=0;for(let o=0;o<n;o++){let n=o>=r?t[e+o-r]:0,s=t[e+o]-n;i+=Math.abs(s)}return i},2:function(t,e,n){let r=0,i=e+n;for(let o=e;o<i;o++){let i=e>0?t[o-n]:0,s=t[o]-i;r+=Math.abs(s)}return r},3:function(t,e,n,r){let i=0;for(let o=0;o<n;o++){let s=o>=r?t[e+o-r]:0,a=e>0?t[e+o-n]:0,h=t[e+o]-(s+a>>1);i+=Math.abs(h)}return i},4:function(t,e,n,r){let i=0;for(let o=0;o<n;o++){let s=o>=r?t[e+o-r]:0,a=e>0?t[e+o-n]:0,h=e>0&&o>=r?t[e+o-(n+r)]:0,l=t[e+o]-Le(s,a,h);i+=Math.abs(l)}return i}};let Be=Xt,Oe=re,Me=function(t,e,n,r){let i=-1!==[Pe.COLORTYPE_COLOR_ALPHA,Pe.COLORTYPE_ALPHA].indexOf(r.colorType);if(r.colorType===r.inputColorType){let e=function(){let t=new ArrayBuffer(2);return new DataView(t).setInt16(0,256,!0),256!==new Int16Array(t)[0]}();if(8===r.bitDepth||16===r.bitDepth&&e)return t}let o=16!==r.bitDepth?t:new Uint16Array(t.buffer),s=255,a=Pe.COLORTYPE_TO_BPP_MAP[r.inputColorType];4!==a||r.inputHasAlpha||(a=3);let h=Pe.COLORTYPE_TO_BPP_MAP[r.colorType];16===r.bitDepth&&(s=65535,h*=2);let l=Buffer.alloc(e*n*h),u=0,f=0,c=r.bgColor||{};function d(){let t,e,n,a=s;switch(r.inputColorType){case Pe.COLORTYPE_COLOR_ALPHA:a=o[u+3],t=o[u],e=o[u+1],n=o[u+2];break;case Pe.COLORTYPE_COLOR:t=o[u],e=o[u+1],n=o[u+2];break;case Pe.COLORTYPE_ALPHA:a=o[u+1],t=o[u],e=t,n=t;break;case Pe.COLORTYPE_GRAYSCALE:t=o[u],e=t,n=t;break;default:throw new Error("input color type:"+r.inputColorType+" is not supported at present")}return r.inputHasAlpha&&(i||(a/=s,t=Math.min(Math.max(Math.round((1-a)*c.red+a*t),0),s),e=Math.min(Math.max(Math.round((1-a)*c.green+a*e),0),s),n=Math.min(Math.max(Math.round((1-a)*c.blue+a*n),0),s))),{red:t,green:e,blue:n,alpha:a}}void 0===c.red&&(c.red=s),void 0===c.green&&(c.green=s),void 0===c.blue&&(c.blue=s);for(let t=0;t<n;t++)for(let t=0;t<e;t++){let t=d();switch(r.colorType){case Pe.COLORTYPE_COLOR_ALPHA:case Pe.COLORTYPE_COLOR:8===r.bitDepth?(l[f]=t.red,l[f+1]=t.green,l[f+2]=t.blue,i&&(l[f+3]=t.alpha)):(l.writeUInt16BE(t.red,f),l.writeUInt16BE(t.green,f+2),l.writeUInt16BE(t.blue,f+4),i&&l.writeUInt16BE(t.alpha,f+6));break;case Pe.COLORTYPE_ALPHA:case Pe.COLORTYPE_GRAYSCALE:{let e=(t.red+t.green+t.blue)/3;8===r.bitDepth?(l[f]=e,i&&(l[f+1]=t.alpha)):(l.writeUInt16BE(e,f),i&&l.writeUInt16BE(t.alpha,f+2));break}default:throw new Error("unrecognised color Type "+r.colorType)}u+=a,f+=h}return l},ke=function(t,e,n,r,i){let o;if("filterType"in r&&-1!==r.filterType){if("number"!=typeof r.filterType)throw new Error("unrecognised filter types");o=[r.filterType]}else o=[0,1,2,3,4];16===r.bitDepth&&(i*=2);let s=e*i,a=0,h=0,l=Buffer.alloc((s+1)*n),u=o[0];for(let e=0;e<n;e++){if(o.length>1){let e=1/0;for(let n=0;n<o.length;n++){let r=Re[o[n]](t,h,s,i);r<e&&(u=o[n],e=r)}}l[a]=u,a++,ve[u](t,h,s,l,a,i),a+=s,h+=s}return l},xe=o,Ne=Ie.exports=function(t){if(this._options=t,t.deflateChunkSize=t.deflateChunkSize||32768,t.deflateLevel=null!=t.deflateLevel?t.deflateLevel:9,t.deflateStrategy=null!=t.deflateStrategy?t.deflateStrategy:3,t.inputHasAlpha=null==t.inputHasAlpha||t.inputHasAlpha,t.deflateFactory=t.deflateFactory||xe.createDeflate,t.bitDepth=t.bitDepth||8,t.colorType="number"==typeof t.colorType?t.colorType:Be.COLORTYPE_COLOR_ALPHA,t.inputColorType="number"==typeof t.inputColorType?t.inputColorType:Be.COLORTYPE_COLOR_ALPHA,-1===[Be.COLORTYPE_GRAYSCALE,Be.COLORTYPE_COLOR,Be.COLORTYPE_COLOR_ALPHA,Be.COLORTYPE_ALPHA].indexOf(t.colorType))throw new Error("option color type:"+t.colorType+" is not supported at present");if(-1===[Be.COLORTYPE_GRAYSCALE,Be.COLORTYPE_COLOR,Be.COLORTYPE_COLOR_ALPHA,Be.COLORTYPE_ALPHA].indexOf(t.inputColorType))throw new Error("option input color type:"+t.inputColorType+" is not supported at present");if(8!==t.bitDepth&&16!==t.bitDepth)throw new Error("option bit depth:"+t.bitDepth+" is not supported at present")};Ne.prototype.getDeflateOptions=function(){return{chunkSize:this._options.deflateChunkSize,level:this._options.deflateLevel,strategy:this._options.deflateStrategy}},Ne.prototype.createDeflate=function(){return this._options.deflateFactory(this.getDeflateOptions())},Ne.prototype.filterData=function(t,e,n){let r=Me(t,e,n,this._options),i=Be.COLORTYPE_TO_BPP_MAP[this._options.colorType];return ke(r,e,n,this._options,i)},Ne.prototype._packChunk=function(t,e){let n=e?e.length:0,r=Buffer.alloc(n+12);return r.writeUInt32BE(n,0),r.writeUInt32BE(t,4),e&&e.copy(r,8),r.writeInt32BE(Oe.crc32(r.slice(4,r.length-4)),r.length-4),r},Ne.prototype.packGAMA=function(t){let e=Buffer.alloc(4);return e.writeUInt32BE(Math.floor(t*Be.GAMMA_DIVISION),0),this._packChunk(Be.TYPE_gAMA,e)},Ne.prototype.packIHDR=function(t,e){let n=Buffer.alloc(13);return n.writeUInt32BE(t,0),n.writeUInt32BE(e,4),n[8]=this._options.bitDepth,n[9]=this._options.colorType,n[10]=0,n[11]=0,n[12]=0,this._packChunk(Be.TYPE_IHDR,n)},Ne.prototype.packIDAT=function(t){return this._packChunk(Be.TYPE_IDAT,t)},Ne.prototype.packIEND=function(){return this._packChunk(Be.TYPE_IEND,null)};var De=Ie.exports;let Se=r,Ue=i,Ye=Xt,He=De,Fe=Ae.exports=function(t){Ue.call(this);let e=t||{};this._packer=new He(e),this._deflate=this._packer.createDeflate(),this.readable=!0};Se.inherits(Fe,Ue),Fe.prototype.pack=function(t,e,n,r){this.emit("data",Buffer.from(Ye.PNG_SIGNATURE)),this.emit("data",this._packer.packIHDR(e,n)),r&&this.emit("data",this._packer.packGAMA(r));let i=this._packer.filterData(t,e,n);this._deflate.on("error",this.emit.bind(this,"error")),this._deflate.on("data",function(t){this.emit("data",this._packer.packIDAT(t))}.bind(this)),this._deflate.on("end",function(){this.emit("data",this._packer.packIEND()),this.emit("end")}.bind(this)),this._deflate.end(i)};var ze=Ae.exports,Ge={},je={exports:{}};!function(t,e){let n=s.ok,i=o,h=r,l=a.kMaxLength;function u(t){if(!(this instanceof u))return new u(t);t&&t.chunkSize<i.Z_MIN_CHUNK&&(t.chunkSize=i.Z_MIN_CHUNK),i.Inflate.call(this,t),this._offset=void 0===this._offset?this._outOffset:this._offset,this._buffer=this._buffer||this._outBuffer,t&&null!=t.maxLength&&(this._maxLength=t.maxLength)}function f(t,e){t._handle&&(t._handle.close(),t._handle=null)}function c(t,e){return function(t,e){if("string"==typeof e&&(e=Buffer.from(e)),!(e instanceof Buffer))throw new TypeError("Not a string or buffer");let n=t._finishFlushFlag;return null==n&&(n=i.Z_FINISH),t._processChunk(e,n)}(new u(e),t)}u.prototype._processChunk=function(t,e,r){if("function"==typeof r)return i.Inflate._processChunk.call(this,t,e,r);let o,s,a=this,h=t&&t.length,u=this._chunkSize-this._offset,c=this._maxLength,d=0,p=[],g=0;function _(t,e){if(a._hadError)return;let r=u-e;if(n(r>=0,"have should not go down"),r>0){let t=a._buffer.slice(a._offset,a._offset+r);if(a._offset+=r,t.length>c&&(t=t.slice(0,c)),p.push(t),g+=t.length,c-=t.length,0===c)return!1}return(0===e||a._offset>=a._chunkSize)&&(u=a._chunkSize,a._offset=0,a._buffer=Buffer.allocUnsafe(a._chunkSize)),0===e&&(d+=h-t,h=t,!0)}this.on("error",(function(t){o=t})),n(this._handle,"zlib binding closed");do{s=this._handle.writeSync(e,t,d,h,this._buffer,this._offset,u),s=s||this._writeState}while(!this._hadError&&_(s[0],s[1]));if(this._hadError)throw o;if(g>=l)throw f(this),new RangeError("Cannot create final Buffer. It would be larger than 0x"+l.toString(16)+" bytes");let w=Buffer.concat(p,g);return f(this),w},h.inherits(u,i.Inflate),t.exports=e=c,e.Inflate=u,e.createInflate=function(t){return new u(t)},e.inflateSync=c}(je,je.exports);var We=je.exports,qe={exports:{}};let Ke=qe.exports=function(t){this._buffer=t,this._reads=[]};Ke.prototype.read=function(t,e){this._reads.push({length:Math.abs(t),allowLess:t<0,func:e})},Ke.prototype.process=function(){for(;this._reads.length>0&&this._buffer.length;){let t=this._reads[0];if(!this._buffer.length||!(this._buffer.length>=t.length||t.allowLess))break;{this._reads.shift();let e=this._buffer;this._buffer=e.slice(t.length),t.func.call(this,e.slice(0,t.length))}}return this._reads.length>0?new Error("There are some read requests waitng on finished stream"):this._buffer.length>0?new Error("unrecognised content at end of stream"):void 0};var Je=qe.exports,Ve={};let Qe=Je,Ze=qt;Ve.process=function(t,e){let n=[],r=new Qe(t);return new Ze(e,{read:r.read.bind(r),write:function(t){n.push(t)},complete:function(){}}).start(),r.process(),Buffer.concat(n)};let $e=!0,Xe=o,tn=We;Xe.deflateSync||($e=!1);let en=Je,nn=Ve,rn=ae,on=he,sn=pe;let an=!0,hn=o;hn.deflateSync||(an=!1);let ln=Xt,un=De;let fn=function(t,e){if(!$e)throw new Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");let n,r,i;let o=[];let s=new en(t),a=new rn(e,{read:s.read.bind(s),error:function(t){n=t},metadata:function(t){r=t},gamma:function(t){i=t},palette:function(t){r.palette=t},transColor:function(t){r.transColor=t},inflateData:function(t){o.push(t)},simpleTransparency:function(){r.alpha=!0}});if(a.start(),s.process(),n)throw n;let h,l=Buffer.concat(o);if(o.length=0,r.interlace)h=Xe.inflateSync(l);else{let t=(1+(r.width*r.bpp*r.depth+7>>3))*r.height;h=tn(l,{chunkSize:t,maxLength:t})}if(l=null,!h||!h.length)throw new Error("bad png - invalid inflate data response");let u=nn.process(h,r);l=null;let f=on.dataToBitMap(u,r);u=null;let c=sn(f,r);return r.data=c,r.gamma=i||0,r},cn=function(t,e){if(!an)throw new Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");let n=new un(e||{}),r=[];r.push(Buffer.from(ln.PNG_SIGNATURE)),r.push(n.packIHDR(t.width,t.height)),t.gamma&&r.push(n.packGAMA(t.gamma));let i=n.filterData(t.data,t.width,t.height),o=hn.deflateSync(i,n.getDeflateOptions());if(i=null,!o||!o.length)throw new Error("bad png - invalid compressed data response");return r.push(n.packIDAT(o)),r.push(n.packIEND()),Buffer.concat(r)};Ge.read=function(t,e){return fn(t,e||{})},Ge.write=function(t,e){return cn(t,e)};let dn=r,pn=i,gn=Ce,_n=ze,wn=Ge,mn=Bt.PNG=function(t){pn.call(this),t=t||{},this.width=0|t.width,this.height=0|t.height,this.data=this.width>0&&this.height>0?Buffer.alloc(4*this.width*this.height):null,t.fill&&this.data&&this.data.fill(0),this.gamma=0,this.readable=this.writable=!0,this._parser=new gn(t),this._parser.on("error",this.emit.bind(this,"error")),this._parser.on("close",this._handleClose.bind(this)),this._parser.on("metadata",this._metadata.bind(this)),this._parser.on("gamma",this._gamma.bind(this)),this._parser.on("parsed",function(t){this.data=t,this.emit("parsed",t)}.bind(this)),this._packer=new _n(t),this._packer.on("data",this.emit.bind(this,"data")),this._packer.on("end",this.emit.bind(this,"end")),this._parser.on("close",this._handleClose.bind(this)),this._packer.on("error",this.emit.bind(this,"error"))};dn.inherits(mn,pn),mn.sync=wn,mn.prototype.pack=function(){return this.data&&this.data.length?(process.nextTick(function(){this._packer.pack(this.data,this.width,this.height,this.gamma)}.bind(this)),this):(this.emit("error","No data provided"),this)},mn.prototype.parse=function(t,e){if(e){let t,n;t=function(t){this.removeListener("error",n),this.data=t,e(null,this)}.bind(this),n=function(n){this.removeListener("parsed",t),e(n,null)}.bind(this),this.once("parsed",t),this.once("error",n)}return this.end(t),this},mn.prototype.write=function(t){return this._parser.write(t),!0},mn.prototype.end=function(t){this._parser.end(t)},mn.prototype._metadata=function(t){this.width=t.width,this.height=t.height,this.emit("metadata",t)},mn.prototype._gamma=function(t){this.gamma=t},mn.prototype._handleClose=function(){this._parser.writable||this._packer.readable||this.emit("close")},mn.bitblt=function(t,e,n,r,i,o,s,a){if(r|=0,i|=0,o|=0,s|=0,a|=0,(n|=0)>t.width||r>t.height||n+i>t.width||r+o>t.height)throw new Error("bitblt reading outside image");if(s>e.width||a>e.height||s+i>e.width||a+o>e.height)throw new Error("bitblt writing outside image");for(let h=0;h<o;h++)t.data.copy(e.data,(a+h)*e.width+s<<2,(r+h)*t.width+n<<2,(r+h)*t.width+n+i<<2)},mn.prototype.bitblt=function(t,e,n,r,i,o,s){return mn.bitblt(this,t,e,n,r,i,o,s),this},mn.adjustGamma=function(t){if(t.gamma){for(let e=0;e<t.height;e++)for(let n=0;n<t.width;n++){let r=t.width*e+n<<2;for(let e=0;e<3;e++){let n=t.data[r+e]/255;n=Math.pow(n,1/2.2/t.gamma),t.data[r+e]=Math.round(255*n)}}t.gamma=0}},mn.prototype.adjustGamma=function(){mn.adjustGamma(this)};var yn={};!function(t){function e(t){if("number"==typeof t&&(t=t.toString()),"string"!=typeof t)throw new Error("Color should be defined as hex string");let e=t.slice().replace("#","").split("");if(e.length<3||5===e.length||e.length>8)throw new Error("Invalid hex color: "+t);3!==e.length&&4!==e.length||(e=Array.prototype.concat.apply([],e.map((function(t){return[t,t]})))),6===e.length&&e.push("F","F");const n=parseInt(e.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:"#"+e.slice(0,6).join("")}}t.getOptions=function(t){t||(t={}),t.color||(t.color={});const n=void 0===t.margin||null===t.margin||t.margin<0?4:t.margin,r=t.width&&t.width>=21?t.width:void 0,i=t.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:e(t.color.dark||"#000000ff"),light:e(t.color.light||"#ffffffff")},type:t.type,rendererOpts:t.rendererOpts||{}}},t.getScale=function(t,e){return e.width&&e.width>=t+2*e.margin?e.width/(t+2*e.margin):e.scale},t.getImageWidth=function(e,n){const r=t.getScale(e,n);return Math.floor((e+2*n.margin)*r)},t.qrToImageData=function(e,n,r){const i=n.modules.size,o=n.modules.data,s=t.getScale(i,r),a=Math.floor((i+2*r.margin)*s),h=r.margin*s,l=[r.color.light,r.color.dark];for(let t=0;t<a;t++)for(let n=0;n<a;n++){let u=4*(t*a+n),f=r.color.light;if(t>=h&&n>=h&&t<a-h&&n<a-h){f=l[o[Math.floor((t-h)/s)*i+Math.floor((n-h)/s)]?1:0]}e[u++]=f.r,e[u++]=f.g,e[u++]=f.b,e[u]=f.a}}}(yn),function(t){const e=n,r=Bt.PNG,i=yn;t.render=function(t,e){const n=i.getOptions(e),o=n.rendererOpts,s=i.getImageWidth(t.modules.size,n);o.width=s,o.height=s;const a=new r(o);return i.qrToImageData(a.data,t,n),a},t.renderToDataURL=function(e,n,r){void 0===r&&(r=n,n=void 0),t.renderToBuffer(e,n,(function(t,e){t&&r(t);let n="data:image/png;base64,";n+=e.toString("base64"),r(null,n)}))},t.renderToBuffer=function(e,n,r){void 0===r&&(r=n,n=void 0);const i=t.render(e,n),o=[];i.on("error",r),i.on("data",(function(t){o.push(t)})),i.on("end",(function(){r(null,Buffer.concat(o))})),i.pack()},t.renderToFile=function(n,r,i,o){void 0===o&&(o=i,i=void 0);let s=!1;const a=(...t)=>{s||(s=!0,o.apply(null,t))},h=e.createWriteStream(n);h.on("error",a),h.on("close",a),t.renderToFileStream(h,r,i)},t.renderToFileStream=function(e,n,r){t.render(n,r).pack().pipe(e)}}(Rt);var En={};!function(t){const e=yn,r={WW:" ",WB:"▄",BB:"█",BW:"▀"},i={BB:" ",BW:"▄",WW:"█",WB:"▀"};function o(t,e,n){return t&&e?n.BB:t&&!e?n.BW:!t&&e?n.WB:n.WW}t.render=function(t,n,s){const a=e.getOptions(n);let h=r;"#ffffff"!==a.color.dark.hex&&"#000000"!==a.color.light.hex||(h=i);const l=t.modules.size,u=t.modules.data;let f="",c=Array(l+2*a.margin+1).join(h.WW);c=Array(a.margin/2+1).join(c+"\n");const d=Array(a.margin+1).join(h.WW);f+=c;for(let t=0;t<l;t+=2){f+=d;for(let e=0;e<l;e++){f+=o(u[t*l+e],u[(t+1)*l+e],h)}f+=d+"\n"}return f+=c.slice(0,-1),"function"==typeof s&&s(null,f),f},t.renderToFile=function(e,r,i,o){void 0===o&&(o=i,i=void 0);const s=n,a=t.render(r,i);s.writeFile(e,a,o)}}(En);var bn={},Tn={render:function(t,e,n){const r=t.modules.size,i=t.modules.data,o=" ";let s="";const a=Array(r+3).join(o),h=Array(2).join(o);s+=a+"\n";for(let t=0;t<r;++t){s+=o;for(let e=0;e<r;e++)s+=i[t*r+e]?" ":o;s+=h+"\n"}return s+=a+"\n","function"==typeof n&&n(null,s),s}},Cn={};const An="",In="",Pn="",Ln=""+In,vn=""+An,Rn=function(t,e,n,r){const i=e+1;if(n>=i||r>=i||r<-1||n<-1)return"0";if(n>=e||r>=e||r<0||n<0)return"1";return t[r*e+n]?"2":"1"},Bn=function(t,e,n,r){return Rn(t,e,n,r)+Rn(t,e,n,r+1)};Cn.render=function(t,e,n){const r=t.modules.size,i=t.modules.data,o=!(!e||!e.inverse),s=e&&e.inverse?vn:Ln,a=function(t,e,n){return{"00":Pn+" "+t,"01":Pn+e+"▄"+t,"02":Pn+n+"▄"+t,10:Pn+e+"▀"+t,11:" ",12:"▄",20:Pn+n+"▀"+t,21:"▀",22:"█"}}(s,o?In:An,o?An:In),h=Pn+"\n"+s;let l=s;for(let t=-1;t<r+1;t+=2){for(let e=-1;e<r;e++)l+=a[Bn(i,r,e,t)];l+=a[Bn(i,r,r,t)]+h}return l+=Pn,"function"==typeof n&&n(null,l),l};const On=Tn,Mn=Cn;bn.render=function(t,e,n){return e&&e.small?Mn.render(t,e,n):On.render(t,e,n)};var kn,xn={},Nn={};function Dn(){if(kn)return Nn;kn=1;const t=yn;function e(t,e){const n=t.a/255,r=e+'="'+t.hex+'"';return n<1?r+" "+e+'-opacity="'+n.toFixed(2).slice(1)+'"':r}function n(t,e,n){let r=t+e;return void 0!==n&&(r+=" "+n),r}return Nn.render=function(r,i,o){const s=t.getOptions(i),a=r.modules.size,h=r.modules.data,l=a+2*s.margin,u=s.color.light.a?"<path "+e(s.color.light,"fill")+' d="M0 0h'+l+"v"+l+'H0z"/>':"",f="<path "+e(s.color.dark,"stroke")+' d="'+function(t,e,r){let i="",o=0,s=!1,a=0;for(let h=0;h<t.length;h++){const l=Math.floor(h%e),u=Math.floor(h/e);l||s||(s=!0),t[h]?(a++,h>0&&l>0&&t[h-1]||(i+=s?n("M",l+r,.5+u+r):n("m",o,0),o=0,s=!1),l+1<e&&t[h+1]||(i+=n("h",a),a=0)):o++}return i}(h,a,s.margin)+'"/>',c='viewBox="0 0 '+l+" "+l+'"',d='<svg xmlns="http://www.w3.org/2000/svg" '+(s.width?'width="'+s.width+'" height="'+s.width+'" ':"")+c+' shape-rendering="crispEdges">'+u+f+"</svg>\n";return"function"==typeof o&&o(null,d),d},Nn}!function(t){const e=Dn();t.render=e.render,t.renderToFile=function(e,r,i,o){void 0===o&&(o=i,i=void 0);const s=n,a='<?xml version="1.0" encoding="utf-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">'+t.render(r,i);s.writeFile(e,a,o)}}(xn);var Sn,Un,Yn={},Hn={};function Fn(){return Sn||(Sn=1,function(t){const e=yn;t.render=function(t,n,r){let i=r,o=n;void 0!==i||n&&n.getContext||(i=n,n=void 0),n||(o=function(){try{return document.createElement("canvas")}catch(t){throw new Error("You need to specify a canvas element")}}()),i=e.getOptions(i);const s=e.getImageWidth(t.modules.size,i),a=o.getContext("2d"),h=a.createImageData(s,s);return e.qrToImageData(h.data,t,i),function(t,e,n){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=n,e.width=n,e.style.height=n+"px",e.style.width=n+"px"}(a,o,s),a.putImageData(h,0,0),o},t.renderToDataURL=function(e,n,r){let i=r;void 0!==i||n&&n.getContext||(i=n,n=void 0),i||(i={});const o=t.render(e,n,i),s=i.type||"image/png",a=i.rendererOpts||{};return o.toDataURL(s,a.quality)}}(Hn)),Hn}const zn=f,Gn=c,jn=Rt,Wn=En,qn=bn,Kn=xn;function Jn(t,e,n){if(void 0===t)throw new Error("String required as first argument");if(void 0===n&&(n=e,e={}),"function"!=typeof n){if(!zn())throw new Error("Callback required as last argument");e=n||{},n=null}return{opts:e,cb:n}}function Vn(t){switch(t){case"svg":return Kn;case"txt":case"utf8":return Wn;default:return jn}}function Qn(t,e,n){if(!n.cb)return new Promise((function(r,i){try{const o=Gn.create(e,n.opts);return t(o,n.opts,(function(t,e){return t?i(t):r(e)}))}catch(t){i(t)}}));try{const r=Gn.create(e,n.opts);return t(r,n.opts,n.cb)}catch(t){n.cb(t)}}u.create=Gn.create,u.toCanvas=function(){if(Un)return Yn;Un=1;const t=f,e=c,n=Fn(),r=Dn();function i(n,r,i,o,s){const a=[].slice.call(arguments,1),h=a.length,l="function"==typeof a[h-1];if(!l&&!t())throw new Error("Callback required as last argument");if(!l){if(h<1)throw new Error("Too few arguments provided");return 1===h?(i=r,r=o=void 0):2!==h||r.getContext||(o=i,i=r,r=void 0),new Promise((function(t,s){try{const s=e.create(i,o);t(n(s,r,o))}catch(t){s(t)}}))}if(h<2)throw new Error("Too few arguments provided");2===h?(s=i,i=r,r=o=void 0):3===h&&(r.getContext&&void 0===s?(s=o,o=void 0):(s=o,o=i,i=r,r=void 0));try{const t=e.create(i,o);s(null,n(t,r,o))}catch(t){s(t)}}return Yn.create=e.create,Yn.toCanvas=i.bind(null,n.render),Yn.toDataURL=i.bind(null,n.renderToDataURL),Yn.toString=i.bind(null,(function(t,e,n){return r.render(t,n)})),Yn}().toCanvas,u.toString=function(t,e,n){const r=Jn(t,e,n),i=function(t){switch(t){case"svg":return Kn;case"terminal":return qn;default:return Wn}}(r.opts?r.opts.type:void 0);return Qn(i.render,t,r)},u.toDataURL=function(t,e,n){const r=Jn(t,e,n);return Qn(Vn(r.opts.type).renderToDataURL,t,r)},u.toBuffer=function(t,e,n){const r=Jn(t,e,n);return Qn(Vn(r.opts.type).renderToBuffer,t,r)},u.toFile=function(t,e,n,r){if("string"!=typeof t||"string"!=typeof e&&"object"!=typeof e)throw new Error("Invalid argument");if(arguments.length<3&&!zn())throw new Error("Too few arguments provided");const i=Jn(e,n,r),o=i.opts.type||function(t){return t.slice(2+(t.lastIndexOf(".")-1>>>0)).toLowerCase()}(t);return Qn(Vn(o).renderToFile.bind(null,t),e,i)},u.toFileStream=function(t,e,n){if(arguments.length<2)throw new Error("Too few arguments provided");const r=Jn(e,n,t.emit.bind(t,"error"));Qn(Vn("png").renderToFileStream.bind(null,t),e,r)};var Zn=l(u);exports.useQRCode=function(n,r){var i=e.useState(!1),o=t._slicedToArray(i,2),s=o[0],a=o[1],l=e.useState(),u=t._slicedToArray(l,2),f=u[0],c=u[1],d=function(){var e=t._asyncToGenerator(t._regeneratorRuntime().mark((function e(n){var i;return t._regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a(!0),t.next=3,Zn.toDataURL(n,r);case 3:i=t.sent,c(i);case 5:case"end":return t.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();h.useIsomorphicLayoutEffect((function(){n&&d(n)}),[]);return{value:f,set:function(t){return d(t)},isLoading:s}};
3
- //# sourceMappingURL=useQRCode.js.map