@kakadu/components 6.2.0 → 6.3.1

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.
@@ -1,54 +1,61 @@
1
- import { j as v } from "../jsx-runtime-B4hRZ52C.mjs";
2
- import { useRef as x, useState as k, useEffect as w } from "react";
3
- import { cx as E } from "@kuma-ui/core";
4
- import B from "../hooks/use-is-in-view.mjs";
5
- const C = "kakadu-components-2608453841";
6
- function G({
7
- isActive: a = !0,
8
- size: g = 200,
9
- className: L,
10
- ...b
1
+ import { j as p } from "../jsx-runtime-B4hRZ52C.mjs";
2
+ import { useRef as v, useState as x, useEffect as $ } from "react";
3
+ import { cx as k } from "@kuma-ui/core";
4
+ import h from "../hooks/use-is-in-view.mjs";
5
+ import B from "../utilities/listeners.mjs";
6
+ const H = "kakadu-components-2608453841", N = B((e) => {
7
+ window.addEventListener("mousemove", e, {
8
+ passive: !0
9
+ });
10
+ }, (e) => {
11
+ window.removeEventListener("mousemove", e);
12
+ });
13
+ function P({
14
+ isActive: e = !0,
15
+ size: L = 200,
16
+ className: E,
17
+ ...w
11
18
  }) {
12
- const n = x(null), s = B(n), t = x(null), [j, o] = k(!1), [r, I] = k();
13
- return w(() => {
14
- if (!a || !s) {
15
- o(!1);
19
+ const s = v(null), o = h(s), n = v(null), [g, r] = x(!1), [i, b] = x();
20
+ return $(() => {
21
+ if (!e || !o) {
22
+ r(!1);
16
23
  return;
17
24
  }
18
- const c = n.current;
25
+ const c = s.current;
19
26
  if (!c)
20
27
  return;
21
- t.current || (t.current = c.parentElement);
22
- const e = t.current;
23
- if (!e)
28
+ n.current || (n.current = c.parentElement);
29
+ const t = n.current;
30
+ if (!t)
24
31
  return;
25
- const l = (f) => {
26
- const V = f.target;
27
- if (!e.contains(V))
32
+ const j = N((l) => {
33
+ const I = l.target;
34
+ if (!t.contains(I))
28
35
  return;
29
- const y = e.getBoundingClientRect(), {
30
- clientX: i,
31
- clientY: u
32
- } = f, {
33
- left: d,
34
- right: $,
35
- top: p,
36
- bottom: h
37
- } = y;
38
- i > d && i < $ && u > p && u < h && (o(!0), I([i - d, u - p]));
39
- }, m = () => {
40
- o(!1);
36
+ const M = t.getBoundingClientRect(), {
37
+ clientX: u,
38
+ clientY: a
39
+ } = l, {
40
+ left: f,
41
+ right: V,
42
+ top: d,
43
+ bottom: y
44
+ } = M;
45
+ u > f && u < V && a > d && a < y && (r(!0), b([u - f, a - d]));
46
+ }), m = () => {
47
+ r(!1);
41
48
  };
42
- return e.addEventListener("mousemove", l), e.addEventListener("mouseleave", m), () => {
43
- e.removeEventListener("mousemove", l), e.removeEventListener("mouseleave", m);
49
+ return t.addEventListener("mouseleave", m), () => {
50
+ j(), t.removeEventListener("mouseleave", m);
44
51
  };
45
- }, [a, s]), /* @__PURE__ */ v.jsx("div", { ...b, ref: n, className: E("kakadu-components-1237006455", L), children: r && s ? /* @__PURE__ */ v.jsx("div", { style: {
46
- "--size": `${g}px`,
47
- "--offset-x": `${r[0]}px`,
48
- "--offset-y": `${r[1]}px`
49
- }, className: E("kakadu-components-611160091", j && "kakadu-components-3627966847") }) : null });
52
+ }, [e, o]), /* @__PURE__ */ p.jsx("div", { ...w, ref: s, className: k("kakadu-components-1237006455", E), children: i && o ? /* @__PURE__ */ p.jsx("div", { style: {
53
+ "--size": `${L}px`,
54
+ "--offset-x": `${i[0]}px`,
55
+ "--offset-y": `${i[1]}px`
56
+ }, className: k("kakadu-components-611160091", g && "kakadu-components-3627966847") }) : null });
50
57
  }
51
58
  export {
52
- G as default,
53
- C as normalBlendStyles
59
+ P as default,
60
+ H as normalBlendStyles
54
61
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("../jsx-runtime-BB_1_6y_.js"),e=require("react"),M=require("@kuma-ui/core"),P=require("react-dom"),$=require("../focus-trap-react-B7f3iC5h.js"),B=require("./text-button.js"),T=require("./decorators.js"),S=require("./flex.js"),D=require("./atom.js"),y=require("./text.js"),_=e.createContext({isVisible:!1,isInteractive:!1}),{Provider:z}=_;function L(){return e.useContext(_)}function G(){const{isInteractive:o,close:r}=L(),a=e.useCallback(()=>{r==null||r()},[r]);return n.jsxRuntimeExports.jsx("div",{className:"kakadu-components-2566044647",children:n.jsxRuntimeExports.jsx(B.default,{iconLeft:"times",label:"Close",disabled:!o,onClick:a})})}function J(o){return n.jsxRuntimeExports.jsx(S.default,{gap:2,...o})}function K({as:o,className:r,...a}){return n.jsxRuntimeExports.jsx(y.Heading,{...a,as:o??y.defaultHeadingElementType,className:M.cx("kakadu-components-4275938488",r)})}function Q({as:o,...r}){return n.jsxRuntimeExports.jsx(S.default,{direction:"row",gap:1,preset:"end",...r,as:o??D.defaultAtomElementType})}function U({root:o,outerDecorators:r=[],innerDecorators:a=[],label:k,maxWidth:c,className:f,isVisible:s,isFullWidth:i=!1,shouldCloseOnOutsideClick:x=!0,shouldCloseOnEscapePress:m=!0,showCloseButton:v=!0,onClose:l,children:d}){const R=e.useRef(null),p=e.useRef(null),[h,N]=e.useState(!1),[u,j]=e.useState(!1),q=e.useCallback(t=>{R.current=t,j(!1)},[]),b=e.useRef(null),w=e.useCallback(t=>{t&&(b.current=t)},[]),[g,C]=e.useState(s??!1),A=e.useMemo(()=>({isVisible:g,isInteractive:u,setInitialFocus:w,close:q}),[g,u,w,q]);e.useEffect(()=>{if(s){const t=setTimeout(()=>{j(!0)},100);return()=>{clearTimeout(t)}}j(!1)},[s]),e.useEffect(()=>{s&&(N(!0),C(!0))},[s]),e.useEffect(()=>{const t=p.current;if(s&&x&&t){const E=H=>{t===H.target&&j(!1)};return t.addEventListener("click",E),()=>{t.removeEventListener("click",E)}}},[s,x]),e.useEffect(()=>{if(!s||!m)return;const t=E=>{E.key==="Escape"&&j(!1)};return window.addEventListener("keydown",t),()=>{window.removeEventListener("keydown",t)}},[s,m]),e.useEffect(()=>{if(h&&!u){const t=setTimeout(()=>{C(!1),l==null||l(R.current??void 0)},370);return()=>{clearTimeout(t)}}},[h,u,l]);const F=e.useMemo(()=>({initialFocus:()=>b.current??void 0,onActivate:()=>{var t;return(t=b.current)==null?void 0:t.focus()}}),[]);if(!g)return null;const I=n.jsxRuntimeExports.jsx(T.default,{decorators:r,children:n.jsxRuntimeExports.jsx("div",{"aria-hidden":!u,style:{"--max-width":c?`${c}px`:void 0},className:M.cx("kakadu-components-4119461136",u&&"kakadu-components-2522346797",f),children:n.jsxRuntimeExports.jsx(T.default,{decorators:a,children:n.jsxRuntimeExports.jsx($.focusTrapReactExports.FocusTrap,{active:u,focusTrapOptions:F,children:n.jsxRuntimeExports.jsx("div",{ref:p,className:"kakadu-components-4011815997",children:n.jsxRuntimeExports.jsx("div",{role:"dialog","aria-modal":"true","aria-label":k??"Modal",className:M.cx("kakadu-components-3324483532",i&&"kakadu-components-3799971070",u&&"kakadu-components-968755580"),children:n.jsxRuntimeExports.jsxs(z,{value:A,children:[v?n.jsxRuntimeExports.jsx(G,{}):null,n.jsxRuntimeExports.jsx("div",{className:M.cx("kakadu-components-633990035",i&&"kakadu-components-171969824"),children:d})]})})})})})})});return o?P.createPortal(I,o):I}function V(o,r){const[a,k]=e.useState(!1),[c,f]=e.useState(!1),s=e.useRef(void 0),i=e.useRef(void 0),x=e.useCallback(async()=>(i.current=void 0,k(!0),f(!0),new Promise(d=>{s.current=d})),[]),m=e.useCallback(d=>{i.current=d,f(!1)},[]),v=e.useCallback(d=>{var p;const R=d??i.current;i.current=void 0,(p=s.current)==null||p.call(s,R),s.current=void 0,k(!1),f(!1)},[]),l=e.useMemo(()=>a?n.jsxRuntimeExports.jsx(o,{...r,isVisible:c,onClose:v}):null,[a,o,r,c,v]);return e.useMemo(()=>({isVisible:c,show:x,close:m,modal:l}),[c,x,m,l])}exports.ModalActions=Q;exports.ModalContent=J;exports.ModalHeading=K;exports.default=U;exports.useModal=V;exports.useModalContext=L;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../jsx-runtime-BB_1_6y_.js"),e=require("react"),E=require("@kuma-ui/core"),P=require("react-dom"),$=require("../focus-trap-react-B7f3iC5h.js"),B=require("../utilities/listeners.js"),D=require("./text-button.js"),T=require("./decorators.js"),_=require("./flex.js"),K=require("./atom.js"),y=require("./text.js"),z=B.default(s=>{window.addEventListener("keydown",s)},s=>{window.removeEventListener("keydown",s)}),S=e.createContext({isVisible:!1,isInteractive:!1}),{Provider:G}=S;function L(){return e.useContext(S)}function J(){const{isInteractive:s,close:r}=L(),a=e.useCallback(()=>{r==null||r()},[r]);return o.jsxRuntimeExports.jsx("div",{className:"kakadu-components-2566044647",children:o.jsxRuntimeExports.jsx(D.default,{iconLeft:"times",label:"Close",disabled:!s,onClick:a})})}function Q(s){return o.jsxRuntimeExports.jsx(_.default,{gap:2,...s})}function U({as:s,className:r,...a}){return o.jsxRuntimeExports.jsx(y.Heading,{...a,as:s??y.defaultHeadingElementType,className:E.cx("kakadu-components-4275938488",r)})}function V({as:s,...r}){return o.jsxRuntimeExports.jsx(_.default,{direction:"row",gap:1,preset:"end",...r,as:s??K.defaultAtomElementType})}function X({root:s,outerDecorators:r=[],innerDecorators:a=[],label:k,maxWidth:c,className:f,isVisible:n,isFullWidth:i=!1,shouldCloseOnOutsideClick:x=!0,shouldCloseOnEscapePress:m=!0,showCloseButton:v=!0,onClose:l,children:d}){const R=e.useRef(null),p=e.useRef(null),[q,N]=e.useState(!1),[u,j]=e.useState(!1),w=e.useCallback(t=>{R.current=t,j(!1)},[]),M=e.useRef(null),g=e.useCallback(t=>{t&&(M.current=t)},[]),[b,h]=e.useState(n??!1),A=e.useMemo(()=>({isVisible:b,isInteractive:u,setInitialFocus:g,close:w}),[b,u,g,w]);e.useEffect(()=>{if(n){const t=setTimeout(()=>{j(!0)},100);return()=>{clearTimeout(t)}}j(!1)},[n]),e.useEffect(()=>{n&&(N(!0),h(!0))},[n]),e.useEffect(()=>{const t=p.current;if(n&&x&&t){const I=H=>{t===H.target&&j(!1)};return t.addEventListener("click",I),()=>{t.removeEventListener("click",I)}}},[n,x]),e.useEffect(()=>{if(!(!n||!m))return z(t=>{t.key==="Escape"&&j(!1)})},[n,m]),e.useEffect(()=>{if(q&&!u){const t=setTimeout(()=>{h(!1),l==null||l(R.current??void 0)},370);return()=>{clearTimeout(t)}}},[q,u,l]);const F=e.useMemo(()=>({initialFocus:()=>M.current??void 0,onActivate:()=>{var t;return(t=M.current)==null?void 0:t.focus()}}),[]);if(!b)return null;const C=o.jsxRuntimeExports.jsx(T.default,{decorators:r,children:o.jsxRuntimeExports.jsx("div",{"aria-hidden":!u,style:{"--max-width":c?`${c}px`:void 0},className:E.cx("kakadu-components-4119461136",u&&"kakadu-components-2522346797",f),children:o.jsxRuntimeExports.jsx(T.default,{decorators:a,children:o.jsxRuntimeExports.jsx($.focusTrapReactExports.FocusTrap,{active:u,focusTrapOptions:F,children:o.jsxRuntimeExports.jsx("div",{ref:p,className:"kakadu-components-4011815997",children:o.jsxRuntimeExports.jsx("div",{role:"dialog","aria-modal":"true","aria-label":k??"Modal",className:E.cx("kakadu-components-3324483532",i&&"kakadu-components-3799971070",u&&"kakadu-components-968755580"),children:o.jsxRuntimeExports.jsxs(G,{value:A,children:[v?o.jsxRuntimeExports.jsx(J,{}):null,o.jsxRuntimeExports.jsx("div",{className:E.cx("kakadu-components-633990035",i&&"kakadu-components-171969824"),children:d})]})})})})})})});return s?P.createPortal(C,s):C}function Y(s,r){const[a,k]=e.useState(!1),[c,f]=e.useState(!1),n=e.useRef(void 0),i=e.useRef(void 0),x=e.useCallback(async()=>(i.current=void 0,k(!0),f(!0),new Promise(d=>{n.current=d})),[]),m=e.useCallback(d=>{i.current=d,f(!1)},[]),v=e.useCallback(d=>{var p;const R=d??i.current;i.current=void 0,(p=n.current)==null||p.call(n,R),n.current=void 0,k(!1),f(!1)},[]),l=e.useMemo(()=>a?o.jsxRuntimeExports.jsx(s,{...r,isVisible:c,onClose:v}):null,[a,s,r,c,v]);return e.useMemo(()=>({isVisible:c,show:x,close:m,modal:l}),[c,x,m,l])}exports.ModalActions=V;exports.ModalContent=Q;exports.ModalHeading=U;exports.default=X;exports.useModal=Y;exports.useModalContext=L;
@@ -1,55 +1,60 @@
1
- import { j as n } from "../jsx-runtime-B4hRZ52C.mjs";
2
- import { createContext as q, useRef as j, useState as h, useCallback as d, useMemo as g, useEffect as v, useContext as z } from "react";
3
- import { cx as E } from "@kuma-ui/core";
4
- import { createPortal as G } from "react-dom";
5
- import { f as J } from "../focus-trap-react-Dr3BYLw6.mjs";
6
- import K from "./text-button.mjs";
1
+ import { j as o } from "../jsx-runtime-B4hRZ52C.mjs";
2
+ import { createContext as $, useRef as j, useState as w, useCallback as d, useMemo as E, useEffect as v, useContext as q } from "react";
3
+ import { cx as T } from "@kuma-ui/core";
4
+ import { createPortal as z } from "react-dom";
5
+ import { f as G } from "../focus-trap-react-Dr3BYLw6.mjs";
6
+ import J from "../utilities/listeners.mjs";
7
+ import Q from "./text-button.mjs";
7
8
  import A from "./decorators.mjs";
8
9
  import H from "./flex.mjs";
9
- import { defaultAtomElementType as Q } from "./atom.mjs";
10
- import { Heading as U, defaultHeadingElementType as V } from "./text.mjs";
11
- const B = q({
10
+ import { defaultAtomElementType as U } from "./atom.mjs";
11
+ import { Heading as V, defaultHeadingElementType as X } from "./text.mjs";
12
+ const Y = J((t) => {
13
+ window.addEventListener("keydown", t);
14
+ }, (t) => {
15
+ window.removeEventListener("keydown", t);
16
+ }), B = $({
12
17
  isVisible: !1,
13
18
  isInteractive: !1
14
19
  }), {
15
- Provider: X
20
+ Provider: Z
16
21
  } = B;
17
- function Y() {
18
- return z(B);
22
+ function _() {
23
+ return q(B);
19
24
  }
20
- function Z() {
25
+ function W() {
21
26
  const {
22
- isInteractive: o,
23
- close: s
24
- } = Y(), r = d(() => {
25
- s == null || s();
26
- }, [s]);
27
- return /* @__PURE__ */ n.jsx("div", { className: "kakadu-components-2566044647", children: /* @__PURE__ */ n.jsx(K, { iconLeft: "times", label: "Close", disabled: !o, onClick: r }) });
27
+ isInteractive: t,
28
+ close: r
29
+ } = _(), s = d(() => {
30
+ r == null || r();
31
+ }, [r]);
32
+ return /* @__PURE__ */ o.jsx("div", { className: "kakadu-components-2566044647", children: /* @__PURE__ */ o.jsx(Q, { iconLeft: "times", label: "Close", disabled: !t, onClick: s }) });
28
33
  }
29
- function ce(o) {
30
- return /* @__PURE__ */ n.jsx(H, { gap: 2, ...o });
34
+ function le(t) {
35
+ return /* @__PURE__ */ o.jsx(H, { gap: 2, ...t });
31
36
  }
32
- function ie({
33
- as: o,
34
- className: s,
35
- ...r
37
+ function de({
38
+ as: t,
39
+ className: r,
40
+ ...s
36
41
  }) {
37
- return /* @__PURE__ */ n.jsx(U, { ...r, as: o ?? V, className: E("kakadu-components-4275938488", s) });
42
+ return /* @__PURE__ */ o.jsx(V, { ...s, as: t ?? X, className: T("kakadu-components-4275938488", r) });
38
43
  }
39
- function ue({
40
- as: o,
41
- ...s
44
+ function fe({
45
+ as: t,
46
+ ...r
42
47
  }) {
43
- return /* @__PURE__ */ n.jsx(H, { direction: "row", gap: 1, preset: "end", ...s, as: o ?? Q });
48
+ return /* @__PURE__ */ o.jsx(H, { direction: "row", gap: 1, preset: "end", ...r, as: t ?? U });
44
49
  }
45
- function le({
46
- root: o,
47
- outerDecorators: s = [],
48
- innerDecorators: r = [],
49
- label: w,
50
+ function me({
51
+ root: t,
52
+ outerDecorators: r = [],
53
+ innerDecorators: s = [],
54
+ label: h,
50
55
  maxWidth: c,
51
56
  className: f,
52
- isVisible: t,
57
+ isVisible: n,
53
58
  isFullWidth: i = !1,
54
59
  shouldCloseOnOutsideClick: m = !0,
55
60
  shouldCloseOnEscapePress: p = !0,
@@ -57,18 +62,18 @@ function le({
57
62
  onClose: u,
58
63
  children: l
59
64
  }) {
60
- const M = j(null), x = j(null), [L, P] = h(!1), [a, k] = h(!1), N = d((e) => {
65
+ const M = j(null), x = j(null), [R, P] = w(!1), [a, k] = w(!1), L = d((e) => {
61
66
  M.current = e, k(!1);
62
- }, []), R = j(null), b = d((e) => {
63
- e && (R.current = e);
64
- }, []), [y, F] = h(t ?? !1), D = g(() => ({
67
+ }, []), g = j(null), N = d((e) => {
68
+ e && (g.current = e);
69
+ }, []), [y, b] = w(n ?? !1), D = E(() => ({
65
70
  isVisible: y,
66
71
  isInteractive: a,
67
- setInitialFocus: b,
68
- close: N
69
- }), [y, a, b, N]);
72
+ setInitialFocus: N,
73
+ close: L
74
+ }), [y, a, N, L]);
70
75
  v(() => {
71
- if (t) {
76
+ if (n) {
72
77
  const e = setTimeout(() => {
73
78
  k(!0);
74
79
  }, 100);
@@ -77,65 +82,61 @@ function le({
77
82
  };
78
83
  }
79
84
  k(!1);
80
- }, [t]), v(() => {
81
- t && (P(!0), F(!0));
82
- }, [t]), v(() => {
85
+ }, [n]), v(() => {
86
+ n && (P(!0), b(!0));
87
+ }, [n]), v(() => {
83
88
  const e = x.current;
84
- if (t && m && e) {
85
- const T = ($) => {
86
- e === $.target && k(!1);
89
+ if (n && m && e) {
90
+ const C = (S) => {
91
+ e === S.target && k(!1);
87
92
  };
88
- return e.addEventListener("click", T), () => {
89
- e.removeEventListener("click", T);
93
+ return e.addEventListener("click", C), () => {
94
+ e.removeEventListener("click", C);
90
95
  };
91
96
  }
92
- }, [t, m]), v(() => {
93
- if (!t || !p)
94
- return;
95
- const e = (T) => {
96
- T.key === "Escape" && k(!1);
97
- };
98
- return window.addEventListener("keydown", e), () => {
99
- window.removeEventListener("keydown", e);
100
- };
101
- }, [t, p]), v(() => {
102
- if (L && !a) {
97
+ }, [n, m]), v(() => {
98
+ if (!(!n || !p))
99
+ return Y((e) => {
100
+ e.key === "Escape" && k(!1);
101
+ });
102
+ }, [n, p]), v(() => {
103
+ if (R && !a) {
103
104
  const e = setTimeout(() => {
104
- F(!1), u == null || u(M.current ?? void 0);
105
+ b(!1), u == null || u(M.current ?? void 0);
105
106
  }, 370);
106
107
  return () => {
107
108
  clearTimeout(e);
108
109
  };
109
110
  }
110
- }, [L, a, u]);
111
- const S = g(() => ({
112
- initialFocus: () => R.current ?? void 0,
111
+ }, [R, a, u]);
112
+ const K = E(() => ({
113
+ initialFocus: () => g.current ?? void 0,
113
114
  onActivate: () => {
114
115
  var e;
115
- return (e = R.current) == null ? void 0 : e.focus();
116
+ return (e = g.current) == null ? void 0 : e.focus();
116
117
  }
117
118
  }), []);
118
119
  if (!y)
119
120
  return null;
120
- const C = /* @__PURE__ */ n.jsx(A, { decorators: s, children: /* @__PURE__ */ n.jsx("div", { "aria-hidden": !a, style: {
121
+ const F = /* @__PURE__ */ o.jsx(A, { decorators: r, children: /* @__PURE__ */ o.jsx("div", { "aria-hidden": !a, style: {
121
122
  "--max-width": c ? `${c}px` : void 0
122
- }, className: E("kakadu-components-4119461136", a && "kakadu-components-2522346797", f), children: /* @__PURE__ */ n.jsx(A, { decorators: r, children: /* @__PURE__ */ n.jsx(J.FocusTrap, { active: a, focusTrapOptions: S, children: /* @__PURE__ */ n.jsx("div", { ref: x, className: "kakadu-components-4011815997", children: /* @__PURE__ */ n.jsx("div", { role: "dialog", "aria-modal": "true", "aria-label": w ?? "Modal", className: E("kakadu-components-3324483532", i && "kakadu-components-3799971070", a && "kakadu-components-968755580"), children: /* @__PURE__ */ n.jsxs(X, { value: D, children: [
123
- I ? /* @__PURE__ */ n.jsx(Z, {}) : null,
124
- /* @__PURE__ */ n.jsx("div", { className: E("kakadu-components-633990035", i && "kakadu-components-171969824"), children: l })
123
+ }, className: T("kakadu-components-4119461136", a && "kakadu-components-2522346797", f), children: /* @__PURE__ */ o.jsx(A, { decorators: s, children: /* @__PURE__ */ o.jsx(G.FocusTrap, { active: a, focusTrapOptions: K, children: /* @__PURE__ */ o.jsx("div", { ref: x, className: "kakadu-components-4011815997", children: /* @__PURE__ */ o.jsx("div", { role: "dialog", "aria-modal": "true", "aria-label": h ?? "Modal", className: T("kakadu-components-3324483532", i && "kakadu-components-3799971070", a && "kakadu-components-968755580"), children: /* @__PURE__ */ o.jsxs(Z, { value: D, children: [
124
+ I ? /* @__PURE__ */ o.jsx(W, {}) : null,
125
+ /* @__PURE__ */ o.jsx("div", { className: T("kakadu-components-633990035", i && "kakadu-components-171969824"), children: l })
125
126
  ] }) }) }) }) }) }) });
126
- return o ? G(C, o) : C;
127
+ return t ? z(F, t) : F;
127
128
  }
128
- function de(o, s) {
129
- const [r, w] = h(!1), [c, f] = h(!1), t = j(void 0), i = j(void 0), m = d(async () => (i.current = void 0, w(!0), f(!0), new Promise((l) => {
130
- t.current = l;
129
+ function pe(t, r) {
130
+ const [s, h] = w(!1), [c, f] = w(!1), n = j(void 0), i = j(void 0), m = d(async () => (i.current = void 0, h(!0), f(!0), new Promise((l) => {
131
+ n.current = l;
131
132
  })), []), p = d((l) => {
132
133
  i.current = l, f(!1);
133
134
  }, []), I = d((l) => {
134
135
  var x;
135
136
  const M = l ?? i.current;
136
- i.current = void 0, (x = t.current) == null || x.call(t, M), t.current = void 0, w(!1), f(!1);
137
- }, []), u = g(() => r ? /* @__PURE__ */ n.jsx(o, { ...s, isVisible: c, onClose: I }) : null, [r, o, s, c, I]);
138
- return g(() => ({
137
+ i.current = void 0, (x = n.current) == null || x.call(n, M), n.current = void 0, h(!1), f(!1);
138
+ }, []), u = E(() => s ? /* @__PURE__ */ o.jsx(t, { ...r, isVisible: c, onClose: I }) : null, [s, t, r, c, I]);
139
+ return E(() => ({
139
140
  isVisible: c,
140
141
  show: m,
141
142
  close: p,
@@ -143,10 +144,10 @@ function de(o, s) {
143
144
  }), [c, m, p, u]);
144
145
  }
145
146
  export {
146
- ue as ModalActions,
147
- ce as ModalContent,
148
- ie as ModalHeading,
149
- le as default,
150
- de as useModal,
151
- Y as useModalContext
147
+ fe as ModalActions,
148
+ le as ModalContent,
149
+ de as ModalHeading,
150
+ me as default,
151
+ pe as useModal,
152
+ _ as useModalContext
152
153
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const V=require("../jsx-runtime-BB_1_6y_.js"),s=require("react"),L=require("@kuma-ui/core"),O=require("../hooks/use-is-in-view.js"),T=require("../hooks/use-is-document-focused.js"),B=["rgb(46, 75, 164)","rgb(58, 125, 159)","rgb(42, 81, 142)","rgb(48, 132, 168)","rgb(45, 64, 157)"];function J(S){return S.map(C=>{var n;const[m,b,X]=((n=C.match(/\d+/g))==null?void 0:n.map(Number))??[];return[m,b,X]})}function K({className:S,colors:C=B,maximumGradientsCount:m=10,speed:b=1,opacity:X=.2}){const n=s.useRef(null),[h,E]=s.useState(),[g,$]=s.useState(0),[p,z]=s.useState(0),q=s.useMemo(()=>J(C),[C]),A=s.useMemo(()=>q.length,[q]),Y=s.useCallback(()=>{const f=Math.random(),y=q[Math.floor(A*f)],r=g*1.25,M=g*.25,v=p*1.25,e=p*.25,t=r*Math.random()-M,o=v*Math.random()-e,i=Math.max(r,v);return{color:y,size:i*f+i/2,opacity:0,speed:Math.max(.1,f/2*b),startPosition:[t,o],currentPosition:[t,o],targetPosition:[r*Math.random()-M,v*Math.random()-e]}},[q,A,g,p,b]),H=O.default(n),W=T.default(),F=s.useRef(!1);return F.current=!H||!W,s.useEffect(()=>{const a=Array.from({length:m}).map(()=>Y());let f=m,y=!1,r;function M(){if(!y){if(!h||F.current){r=requestAnimationFrame(M);return}h.clearRect(0,0,g,p);for(let e=a.length;e;e-=1){const t=a[e-1],[o,i]=t.startPosition,[c,u]=t.currentPosition,[l,d]=t.targetPosition;let x=!0;if(o>l?c>l&&(x=!1):c<l&&(x=!1),i>d?u>d&&(x=!1):u<d&&(x=!1),x){a.splice(e-1,1),f-=1;continue}const _=(o+l)/2-o,D=c-o,G=(i+d)/2-i,N=u-i,R=(D/_+N/G)/2;t.opacity=R>1?2-R:R;const j=t.size/2,I=h.createRadialGradient(c,u,j,c,u,0);if(I.addColorStop(0,`rgba(${t.color.join(",")},0)`),I.addColorStop(1,`rgba(${t.color.join(",")},${t.opacity})`),h.fillStyle=I,h.fillRect(c-j,u-j,t.size,t.size),c!==l){const k=Math.abs(o-l),w=Math.abs(i-d),P=Math.min(1,k/w);c<l?t.currentPosition[0]+=t.speed*P:t.currentPosition[0]-=t.speed*P}if(u!==d){const k=Math.abs(o-l),w=Math.abs(i-d),P=Math.min(1,w/k);u<d?t.currentPosition[1]+=t.speed*P:t.currentPosition[1]-=t.speed*P}}r=requestAnimationFrame(M)}}r=requestAnimationFrame(M);const v=setInterval(()=>{if(F.current)return;let e=m-f;if(e>0)for(;e;)a.push(Y()),e-=1,f+=1},1500);return()=>{y=!0,r&&cancelAnimationFrame(r),clearInterval(v)}},[m,Y,h,g,p,b]),s.useEffect(()=>{if(n.current){const a=n.current.getContext("2d");a&&E(a),$(n.current.offsetWidth),z(n.current.offsetHeight)}},[n]),V.jsxRuntimeExports.jsx("canvas",{ref:n,"aria-hidden":!0,role:"presentation",width:g,height:p,style:{"--opacity":X},className:L.cx("kakadu-components-4131181690",S)})}exports.default=K;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const N=require("../jsx-runtime-BB_1_6y_.js"),o=require("react"),O=require("@kuma-ui/core"),V=require("../hooks/use-is-in-view.js"),T=require("../hooks/use-is-document-focused.js"),B=require("../utilities/listeners.js"),J=B.default(m=>{window.addEventListener("resize",m,{passive:!0})},m=>{window.removeEventListener("resize",m)}),K=["rgb(46, 75, 164)","rgb(58, 125, 159)","rgb(42, 81, 142)","rgb(48, 132, 168)","rgb(45, 64, 157)"];function Q(m){return m.map(C=>{var t;const[M,q,R]=((t=C.match(/\d+/g))==null?void 0:t.map(Number))??[];return[M,q,R]})}function U({className:m,colors:C=K,maximumGradientsCount:M=10,speed:q=1,opacity:R=.2}){const t=o.useRef(null),[h,H]=o.useState(),[g,j]=o.useState(0),[p,F]=o.useState(0),w=o.useMemo(()=>Q(C),[C]),I=o.useMemo(()=>w.length,[w]),y=o.useCallback(()=>{const n=Math.random(),b=w[Math.floor(I*n)],u=g*1.25,i=g*.25,s=p*1.25,e=p*.25,a=u*Math.random()-i,c=s*Math.random()-e,r=Math.max(u,s);return{color:b,size:r*n+r/2,opacity:0,speed:Math.max(.1,n/2*q),startPosition:[a,c],currentPosition:[a,c],targetPosition:[u*Math.random()-i,s*Math.random()-e]}},[w,I,g,p,q]),L=V.default(t),W=T.default(),k=!L||!W,G=o.useRef(Array.from({length:M}).map(()=>y()));return o.useEffect(()=>{if(k||!h)return;let v=!1,n;function b(){if(v||!h)return;const i=G.current;h.clearRect(0,0,g,p);for(let s=i.length;s;s-=1){const e=i[s-1],[a,c]=e.startPosition,[r,l]=e.currentPosition,[d,f]=e.targetPosition;let x=!0;if(a>d?r>d&&(x=!1):r<d&&(x=!1),c>f?l>f&&(x=!1):l<f&&(x=!1),x){i.splice(s-1,1);continue}const _=(a+d)/2-a,$=r-a,A=(c+f)/2-c,D=l-c,z=($/(_||1)+D/(A||1))/2;e.opacity=z>1?2-z:z;const S=e.size/2,X=h.createRadialGradient(r,l,S,r,l,0);if(X.addColorStop(0,`rgba(${e.color.join(",")},0)`),X.addColorStop(1,`rgba(${e.color.join(",")},${e.opacity})`),h.fillStyle=X,h.fillRect(r-S,l-S,e.size,e.size),r!==d){const Y=Math.abs(a-d),E=Math.abs(c-f),P=Math.min(1,Y/E);r<d?e.currentPosition[0]+=e.speed*P:e.currentPosition[0]-=e.speed*P}if(l!==f){const Y=Math.abs(a-d),E=Math.abs(c-f),P=Math.min(1,E/Y);l<f?e.currentPosition[1]+=e.speed*P:e.currentPosition[1]-=e.speed*P}}n=requestAnimationFrame(b)}n=requestAnimationFrame(b);const u=setInterval(()=>{const i=G.current;let s=i.length,e=M-s;if(e>0)for(;e;)i.push(y()),e-=1,s+=1},1500);return()=>{v=!0,n&&cancelAnimationFrame(n),clearInterval(u)}},[k,h,g,p,M,y]),o.useEffect(()=>{if(t.current){const v=t.current.getContext("2d");v&&H(v),j(t.current.offsetWidth),F(t.current.offsetHeight);const n=()=>{t.current&&(j(t.current.offsetWidth),F(t.current.offsetHeight))},b=J(n),u=new ResizeObserver(n);return u.observe(t.current),()=>{b(),u.disconnect()}}},[t]),N.jsxRuntimeExports.jsx("canvas",{ref:t,"aria-hidden":!0,role:"presentation",width:g,height:p,style:{"--opacity":R},className:O.cx("kakadu-components-4131181690",m)})}exports.default=U;
@@ -1,90 +1,100 @@
1
- import { j as K } from "../jsx-runtime-B4hRZ52C.mjs";
2
- import { useRef as H, useState as z, useMemo as S, useCallback as O, useEffect as W } from "react";
1
+ import { j as J } from "../jsx-runtime-B4hRZ52C.mjs";
2
+ import { useRef as q, useState as I, useMemo as A, useCallback as K, useEffect as S } from "react";
3
3
  import { cx as Q } from "@kuma-ui/core";
4
4
  import T from "../hooks/use-is-in-view.mjs";
5
5
  import U from "../hooks/use-is-document-focused.mjs";
6
- const Z = ["rgb(46, 75, 164)", "rgb(58, 125, 159)", "rgb(42, 81, 142)", "rgb(48, 132, 168)", "rgb(45, 64, 157)"];
7
- function _(X) {
8
- return X.map((P) => {
9
- var n;
10
- const [f, M, Y] = ((n = P.match(/\d+/g)) == null ? void 0 : n.map(Number)) ?? [];
11
- return [f, M, Y];
6
+ import Z from "../utilities/listeners.mjs";
7
+ const _ = Z((f) => {
8
+ window.addEventListener("resize", f, {
9
+ passive: !0
10
+ });
11
+ }, (f) => {
12
+ window.removeEventListener("resize", f);
13
+ }), tt = ["rgb(46, 75, 164)", "rgb(58, 125, 159)", "rgb(42, 81, 142)", "rgb(48, 132, 168)", "rgb(45, 64, 157)"];
14
+ function et(f) {
15
+ return f.map((C) => {
16
+ var e;
17
+ const [b, P, z] = ((e = C.match(/\d+/g)) == null ? void 0 : e.map(Number)) ?? [];
18
+ return [b, P, z];
12
19
  });
13
20
  }
14
- function st({
15
- className: X,
16
- colors: P = Z,
17
- maximumGradientsCount: f = 10,
18
- speed: M = 1,
19
- opacity: Y = 0.2
21
+ function ct({
22
+ className: f,
23
+ colors: C = tt,
24
+ maximumGradientsCount: b = 10,
25
+ speed: P = 1,
26
+ opacity: z = 0.2
20
27
  }) {
21
- const n = H(null), [m, k] = z(), [h, D] = z(0), [p, $] = z(0), C = S(() => _(P), [P]), E = S(() => C.length, [C]), F = O(() => {
22
- const d = Math.random(), y = C[Math.floor(E * d)], o = h * 1.25, g = h * 0.25, b = p * 1.25, e = p * 0.25, t = o * Math.random() - g, r = b * Math.random() - e, s = Math.max(o, b);
28
+ const e = q(null), [m, k] = I(), [h, L] = I(0), [p, j] = I(0), w = A(() => et(C), [C]), G = A(() => w.length, [w]), y = K(() => {
29
+ const n = Math.random(), v = w[Math.floor(G * n)], c = h * 1.25, o = h * 0.25, r = p * 1.25, t = p * 0.25, i = c * Math.random() - o, a = r * Math.random() - t, s = Math.max(c, r);
23
30
  return {
24
- color: y,
25
- size: s * d + s / 2,
31
+ color: v,
32
+ size: s * n + s / 2,
26
33
  opacity: 0,
27
- speed: Math.max(0.1, d / 2 * M),
28
- startPosition: [t, r],
29
- currentPosition: [t, r],
30
- targetPosition: [o * Math.random() - g, b * Math.random() - e]
34
+ speed: Math.max(0.1, n / 2 * P),
35
+ startPosition: [i, a],
36
+ currentPosition: [i, a],
37
+ targetPosition: [c * Math.random() - o, r * Math.random() - t]
31
38
  };
32
- }, [C, E, h, p, M]), G = T(n), N = U(), I = H(!1);
33
- return I.current = !G || !N, W(() => {
34
- const i = Array.from({
35
- length: f
36
- }).map(() => F());
37
- let d = f, y = !1, o;
38
- function g() {
39
- if (!y) {
40
- if (!m || I.current) {
41
- o = requestAnimationFrame(g);
42
- return;
39
+ }, [w, G, h, p, P]), D = T(e), $ = U(), H = !D || !$, W = q(Array.from({
40
+ length: b
41
+ }).map(() => y()));
42
+ return S(() => {
43
+ if (H || !m)
44
+ return;
45
+ let g = !1, n;
46
+ function v() {
47
+ if (g || !m)
48
+ return;
49
+ const o = W.current;
50
+ m.clearRect(0, 0, h, p);
51
+ for (let r = o.length; r; r -= 1) {
52
+ const t = o[r - 1], [i, a] = t.startPosition, [s, l] = t.currentPosition, [u, d] = t.targetPosition;
53
+ let M = !0;
54
+ if (i > u ? s > u && (M = !1) : s < u && (M = !1), a > d ? l > d && (M = !1) : l < d && (M = !1), M) {
55
+ o.splice(r - 1, 1);
56
+ continue;
43
57
  }
44
- m.clearRect(0, 0, h, p);
45
- for (let e = i.length; e; e -= 1) {
46
- const t = i[e - 1], [r, s] = t.startPosition, [a, c] = t.currentPosition, [l, u] = t.targetPosition;
47
- let v = !0;
48
- if (r > l ? a > l && (v = !1) : a < l && (v = !1), s > u ? c > u && (v = !1) : c < u && (v = !1), v) {
49
- i.splice(e - 1, 1), d -= 1;
50
- continue;
51
- }
52
- const V = (r + l) / 2 - r, L = a - r, B = (s + u) / 2 - s, J = c - s, j = (L / V + J / B) / 2;
53
- t.opacity = j > 1 ? 2 - j : j;
54
- const q = t.size / 2, w = m.createRadialGradient(a, c, q, a, c, 0);
55
- if (w.addColorStop(0, `rgba(${t.color.join(",")},0)`), w.addColorStop(1, `rgba(${t.color.join(",")},${t.opacity})`), m.fillStyle = w, m.fillRect(a - q, c - q, t.size, t.size), a !== l) {
56
- const A = Math.abs(r - l), R = Math.abs(s - u), x = Math.min(1, A / R);
57
- a < l ? t.currentPosition[0] += t.speed * x : t.currentPosition[0] -= t.speed * x;
58
- }
59
- if (c !== u) {
60
- const A = Math.abs(r - l), R = Math.abs(s - u), x = Math.min(1, R / A);
61
- c < u ? t.currentPosition[1] += t.speed * x : t.currentPosition[1] -= t.speed * x;
62
- }
58
+ const N = (i + u) / 2 - i, V = s - i, O = (a + d) / 2 - a, B = l - a, R = (V / (N || 1) + B / (O || 1)) / 2;
59
+ t.opacity = R > 1 ? 2 - R : R;
60
+ const X = t.size / 2, Y = m.createRadialGradient(s, l, X, s, l, 0);
61
+ if (Y.addColorStop(0, `rgba(${t.color.join(",")},0)`), Y.addColorStop(1, `rgba(${t.color.join(",")},${t.opacity})`), m.fillStyle = Y, m.fillRect(s - X, l - X, t.size, t.size), s !== u) {
62
+ const E = Math.abs(i - u), F = Math.abs(a - d), x = Math.min(1, E / F);
63
+ s < u ? t.currentPosition[0] += t.speed * x : t.currentPosition[0] -= t.speed * x;
64
+ }
65
+ if (l !== d) {
66
+ const E = Math.abs(i - u), F = Math.abs(a - d), x = Math.min(1, F / E);
67
+ l < d ? t.currentPosition[1] += t.speed * x : t.currentPosition[1] -= t.speed * x;
63
68
  }
64
- o = requestAnimationFrame(g);
65
69
  }
70
+ n = requestAnimationFrame(v);
66
71
  }
67
- o = requestAnimationFrame(g);
68
- const b = setInterval(() => {
69
- if (I.current)
70
- return;
71
- let e = f - d;
72
- if (e > 0)
73
- for (; e; )
74
- i.push(F()), e -= 1, d += 1;
72
+ n = requestAnimationFrame(v);
73
+ const c = setInterval(() => {
74
+ const o = W.current;
75
+ let r = o.length, t = b - r;
76
+ if (t > 0)
77
+ for (; t; )
78
+ o.push(y()), t -= 1, r += 1;
75
79
  }, 1500);
76
80
  return () => {
77
- y = !0, o && cancelAnimationFrame(o), clearInterval(b);
81
+ g = !0, n && cancelAnimationFrame(n), clearInterval(c);
78
82
  };
79
- }, [f, F, m, h, p, M]), W(() => {
80
- if (n.current) {
81
- const i = n.current.getContext("2d");
82
- i && k(i), D(n.current.offsetWidth), $(n.current.offsetHeight);
83
+ }, [H, m, h, p, b, y]), S(() => {
84
+ if (e.current) {
85
+ const g = e.current.getContext("2d");
86
+ g && k(g), L(e.current.offsetWidth), j(e.current.offsetHeight);
87
+ const n = () => {
88
+ e.current && (L(e.current.offsetWidth), j(e.current.offsetHeight));
89
+ }, v = _(n), c = new ResizeObserver(n);
90
+ return c.observe(e.current), () => {
91
+ v(), c.disconnect();
92
+ };
83
93
  }
84
- }, [n]), /* @__PURE__ */ K.jsx("canvas", { ref: n, "aria-hidden": !0, role: "presentation", width: h, height: p, style: {
85
- "--opacity": Y
86
- }, className: Q("kakadu-components-4131181690", X) });
94
+ }, [e]), /* @__PURE__ */ J.jsx("canvas", { ref: e, "aria-hidden": !0, role: "presentation", width: h, height: p, style: {
95
+ "--opacity": z
96
+ }, className: Q("kakadu-components-4131181690", f) });
87
97
  }
88
98
  export {
89
- st as default
99
+ ct as default
90
100
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const T=require("../jsx-runtime-BB_1_6y_.js"),r=require("react"),B=require("@kuma-ui/core"),G=require("../hooks/use-is-in-view.js"),J=require("../hooks/use-is-document-focused.js");function K({color:q,opacity:H,className:W,minimumSize:I=1,maximumSize:A=5,maximumStarsCount:x=50,speed:w=1,hasMask:j=!1}){const e=r.useRef(null),[o,_]=r.useState(),[f,R]=r.useState(0),[d,S]=r.useState(0),y=r.useCallback(()=>{const n=f*1.5,s=f*.25,a=d*1.5,i=d*.25,M=n*Math.random()-s,h=a*Math.random()-i;return{size:Math.max(I,A*Math.random()),opacity:0,speed:Math.max(.1,Math.random()/2*w),startPosition:[M,h],currentPosition:[M,h],targetPosition:[n*Math.random()-s,a*Math.random()-i]}},[f,d,I,A,w]),C=r.useCallback(()=>q??(e.current?getComputedStyle(e.current).color:"#000"),[q,e]),z=G.default(e),D=J.default(),k=r.useRef(!1);return k.current=!z||!D,r.useEffect(()=>{const n=Array.from({length:x}).map(()=>y());let s=x,a=!1,i,M=C();function h(){if(!a){if(!o||k.current){i=requestAnimationFrame(h);return}o.clearRect(0,0,f,d);for(let c=n.length;c;c-=1){const t=n[c-1],[v,p]=t.startPosition,[g,m]=t.currentPosition,[u,l]=t.targetPosition;let P=!0;if(v>u?g>u&&(P=!1):g<u&&(P=!1),p>l?m>l&&(P=!1):m<l&&(P=!1),P){n.splice(c-1,1),s-=1;continue}const O=(v+u)/2-v,V=g-v,$=(p+l)/2-p,N=m-p,X=(V/O+N/$)/2;t.opacity=X>1?2-X:X;const Y=t.size/2;if(o.beginPath(),o.arc(g-Y,m-Y,Y,0,2*Math.PI,!1),o.globalAlpha=t.opacity,o.fillStyle=M,o.fill(),g!==u){const E=Math.abs(v-u),F=Math.abs(p-l),b=Math.min(1,E/F);g<u?t.currentPosition[0]+=t.speed*b:t.currentPosition[0]-=t.speed*b}if(m!==l){const E=Math.abs(v-u),F=Math.abs(p-l),b=Math.min(1,F/E);m<l?t.currentPosition[1]+=t.speed*b:t.currentPosition[1]-=t.speed*b}}i=requestAnimationFrame(h)}}i=requestAnimationFrame(h);const L=setInterval(()=>{if(k.current)return;M=C();let c=x-s;if(c>0)for(;c;)n.push(y()),c-=1,s+=1},500);return()=>{a=!0,i&&cancelAnimationFrame(i),clearInterval(L)}},[x,y,C,o,f,d,w]),r.useEffect(()=>{if(e.current){const n=e.current.getContext("2d");n&&_(n),R(e.current.offsetWidth),S(e.current.offsetHeight);const s=()=>{e.current&&(R(e.current.offsetWidth),S(e.current.offsetHeight))},a=new ResizeObserver(s);return a.observe(e.current),window.addEventListener("resize",s,{passive:!0}),()=>{a.disconnect(),window.removeEventListener("resize",s)}}},[e]),T.jsxRuntimeExports.jsx("canvas",{ref:e,"aria-hidden":!0,role:"presentation",style:{"--color":q,"--opacity":H},className:B.cx("kakadu-components-3366903902",j&&"kakadu-components-4049648322",W),width:f,height:d})}exports.default=K;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const T=require("../jsx-runtime-BB_1_6y_.js"),o=require("react"),B=require("@kuma-ui/core"),G=require("../hooks/use-is-in-view.js"),J=require("../hooks/use-is-document-focused.js"),K=require("../utilities/listeners.js"),Q=K.default(l=>{window.addEventListener("resize",l,{passive:!0})},l=>{window.removeEventListener("resize",l)});function U({color:l,opacity:H,className:W,minimumSize:X=1,maximumSize:Y=5,maximumStarsCount:q=50,speed:E=1,hasMask:_=!1}){const t=o.useRef(null),[n,j]=o.useState(),[h,I]=o.useState(0),[v,F]=o.useState(0),C=o.useCallback(()=>{const i=h*1.5,s=h*.25,d=v*1.5,a=v*.25,x=i*Math.random()-s,r=d*Math.random()-a;return{size:Math.max(X,Y*Math.random()),opacity:0,speed:Math.max(.1,Math.random()/2*E),startPosition:[x,r],currentPosition:[x,r],targetPosition:[i*Math.random()-s,d*Math.random()-a]}},[h,v,X,Y,E]),w=o.useCallback(()=>l??(t.current?getComputedStyle(t.current).color:"#000"),[l,t]),L=G.default(t),D=J.default(),z=!L||!D,A=o.useRef(Array.from({length:q}).map(()=>C()));return o.useEffect(()=>{if(z||!n)return;let i=!1,s,d=w();function a(){if(i||!n)return;const r=A.current;n.clearRect(0,0,h,v);for(let f=r.length;f;f-=1){const e=r[f-1],[p,g]=e.startPosition,[m,M]=e.currentPosition,[c,u]=e.targetPosition;let P=!0;if(p>c?m>c&&(P=!1):m<c&&(P=!1),g>u?M>u&&(P=!1):M<u&&(P=!1),P){r.splice(f-1,1);continue}const O=(p+c)/2-p,V=m-p,$=(g+u)/2-g,N=M-g,y=(V/(O||1)+N/($||1))/2;e.opacity=y>1?2-y:y;const S=e.size/2;if(n.beginPath(),n.arc(m-S,M-S,S,0,2*Math.PI,!1),n.globalAlpha=e.opacity,n.fillStyle=d,n.fill(),m!==c){const k=Math.abs(p-c),R=Math.abs(g-u),b=Math.min(1,k/R);m<c?e.currentPosition[0]+=e.speed*b:e.currentPosition[0]-=e.speed*b}if(M!==u){const k=Math.abs(p-c),R=Math.abs(g-u),b=Math.min(1,R/k);M<u?e.currentPosition[1]+=e.speed*b:e.currentPosition[1]-=e.speed*b}}s=requestAnimationFrame(a)}s=requestAnimationFrame(a);const x=setInterval(()=>{d=w();const r=A.current;let f=r.length,e=q-f;if(e>0)for(;e;)r.push(C()),e-=1,f+=1},500);return()=>{i=!0,s&&cancelAnimationFrame(s),clearInterval(x)}},[z,n,w,h,v,q,C]),o.useEffect(()=>{if(t.current){const i=t.current.getContext("2d");i&&j(i),I(t.current.offsetWidth),F(t.current.offsetHeight);const s=()=>{t.current&&(I(t.current.offsetWidth),F(t.current.offsetHeight))},d=Q(s),a=new ResizeObserver(s);return a.observe(t.current),()=>{d(),a.disconnect()}}},[t]),T.jsxRuntimeExports.jsx("canvas",{ref:t,"aria-hidden":!0,role:"presentation",style:{"--color":l,"--opacity":H},className:B.cx("kakadu-components-3366903902",_&&"kakadu-components-4049648322",W),width:h,height:v})}exports.default=U;