@cfxjs/sirius-next-common 0.2.2 → 0.2.4

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 (80) hide show
  1. package/dist/{chunk-N5TMLKGL.js → chunk-3CHXTO52.js} +4 -4
  2. package/dist/{chunk-73IFRWHE.js → chunk-52R454XN.js} +2 -2
  3. package/dist/{chunk-ZKNMJZ5R.js → chunk-BMO4IZHV.js} +1287 -1706
  4. package/dist/chunk-BMO4IZHV.js.map +1 -0
  5. package/dist/{chunk-4HTI24KG.js → chunk-BVED57CI.js} +2 -2
  6. package/dist/{chunk-RB2U3Y7F.js → chunk-CKOT4CK7.js} +2 -2
  7. package/dist/{chunk-NIYCXPXR.js → chunk-CY4XPEK5.js} +4 -4
  8. package/dist/{chunk-VUULJBTQ.js → chunk-H7V2CGOB.js} +2 -1
  9. package/dist/chunk-H7V2CGOB.js.map +1 -0
  10. package/dist/chunk-JXKHN73X.js +534 -0
  11. package/dist/chunk-JXKHN73X.js.map +1 -0
  12. package/dist/{chunk-XY65HQ35.js → chunk-OQCPL2OI.js} +2 -2
  13. package/dist/{chunk-FMHO65DC.js → chunk-W7ZK4OQA.js} +3 -3
  14. package/dist/{chunk-RWMP7K3H.js → chunk-WML236LE.js} +4 -4
  15. package/dist/chunk-WOX3LUVT.js +2149 -0
  16. package/dist/chunk-WOX3LUVT.js.map +1 -0
  17. package/dist/{chunk-AAQD5VX5.js → chunk-XZQWPTKA.js} +4 -4
  18. package/dist/components/AddressContainer/CoreAddressContainer.js +8 -7
  19. package/dist/components/AddressContainer/EVMAddressContainer.js +8 -7
  20. package/dist/components/AddressContainer/addressSwitcher.js +6 -5
  21. package/dist/components/AddressContainer/addressView.js +5 -4
  22. package/dist/components/AddressContainer/label.js +4 -3
  23. package/dist/components/Age/index.js +4 -3
  24. package/dist/components/Age/index.js.map +1 -1
  25. package/dist/components/AutoComplete/index.d.ts +16 -0
  26. package/dist/components/AutoComplete/index.js +83 -0
  27. package/dist/components/AutoComplete/index.js.map +1 -0
  28. package/dist/components/Button/index.js +4 -4
  29. package/dist/components/Charts/PreviewChartTemplate.js +5 -5
  30. package/dist/components/Charts/StockChartTemplate.js +2 -2
  31. package/dist/components/CopyButton/index.js +3 -2
  32. package/dist/components/CopyButton/index.js.map +1 -1
  33. package/dist/components/DecimalsSelect/index.d.ts +16 -0
  34. package/dist/components/DecimalsSelect/index.js +129 -0
  35. package/dist/components/DecimalsSelect/index.js.map +1 -0
  36. package/dist/components/DownloadCSV/index.js +4 -3
  37. package/dist/components/DownloadCSV/index.js.map +1 -1
  38. package/dist/components/Dropdown/index.js +2 -2
  39. package/dist/components/GasPriceDropdown/index.js +1 -1
  40. package/dist/components/Icons/index.d.ts +4 -0
  41. package/dist/components/Icons/index.js +68 -0
  42. package/dist/components/Icons/index.js.map +1 -0
  43. package/dist/components/IncreasePercent/index.js +1 -1
  44. package/dist/components/InfoIconWithTooltip/index.js +3 -2
  45. package/dist/components/InfoIconWithTooltip/index.js.map +1 -1
  46. package/dist/components/Modal/index.js +2 -2
  47. package/dist/components/NetworkIcon/index.js +1 -1
  48. package/dist/components/PhishingAddressContainer/index.js +3 -2
  49. package/dist/components/PhishingAddressContainer/index.js.map +1 -1
  50. package/dist/components/Popover/index.d.ts +16 -0
  51. package/dist/components/Popover/index.js +15 -0
  52. package/dist/components/Popover/index.js.map +1 -0
  53. package/dist/components/Price/index.js +3 -2
  54. package/dist/components/Price/index.js.map +1 -1
  55. package/dist/components/Radio/index.js +1 -1
  56. package/dist/components/Select/index.js +2 -2
  57. package/dist/components/Select/select.js +2 -2
  58. package/dist/components/Text/index.js +4 -3
  59. package/dist/components/Tooltip/index.js +3 -2
  60. package/dist/components/TransactionAction/coreTransactionAction.js +8 -7
  61. package/dist/components/TransactionAction/coreTransactionAction.js.map +1 -1
  62. package/dist/components/TransactionAction/evmTransactionAction.js +8 -7
  63. package/dist/components/TransactionAction/evmTransactionAction.js.map +1 -1
  64. package/dist/uno.css +35 -6
  65. package/dist/utils/address.d.ts +1 -1
  66. package/dist/utils/contractManagerTool.js +1 -1
  67. package/dist/utils/index.d.ts +1 -1
  68. package/dist/utils/index.js +1 -1
  69. package/package.json +3 -3
  70. package/dist/chunk-VUULJBTQ.js.map +0 -1
  71. package/dist/chunk-ZKNMJZ5R.js.map +0 -1
  72. /package/dist/{chunk-N5TMLKGL.js.map → chunk-3CHXTO52.js.map} +0 -0
  73. /package/dist/{chunk-73IFRWHE.js.map → chunk-52R454XN.js.map} +0 -0
  74. /package/dist/{chunk-4HTI24KG.js.map → chunk-BVED57CI.js.map} +0 -0
  75. /package/dist/{chunk-RB2U3Y7F.js.map → chunk-CKOT4CK7.js.map} +0 -0
  76. /package/dist/{chunk-NIYCXPXR.js.map → chunk-CY4XPEK5.js.map} +0 -0
  77. /package/dist/{chunk-XY65HQ35.js.map → chunk-OQCPL2OI.js.map} +0 -0
  78. /package/dist/{chunk-FMHO65DC.js.map → chunk-W7ZK4OQA.js.map} +0 -0
  79. /package/dist/{chunk-RWMP7K3H.js.map → chunk-WML236LE.js.map} +0 -0
  80. /package/dist/{chunk-AAQD5VX5.js.map → chunk-XZQWPTKA.js.map} +0 -0
@@ -7,14 +7,6 @@ import {
7
7
  shift,
8
8
  size
9
9
  } from "./chunk-LRCAKRPK.js";
10
- import {
11
- cn
12
- } from "./chunk-VUULJBTQ.js";
13
-
14
- // src/components/Tooltip/index.tsx
15
- import {
16
- useRef as useRef4
17
- } from "react";
18
10
 
19
11
  // ../../node_modules/.pnpm/@cfx-kit+ui-components@0.0.18_@zag-js+accordion@0.19.1_@zag-js+checkbox@0.19.1_@zag-js+dialog_toqhwacqm4ck723ovqekq5mm7u/node_modules/@cfx-kit/ui-components/dist/chunk-W7QWXYJO.js
20
12
  var __defProp = Object.defineProperty;
@@ -49,1043 +41,632 @@ var __objRest = (source, exclude) => {
49
41
  return target;
50
42
  };
51
43
 
52
- // ../../node_modules/.pnpm/@cfx-kit+ui-components@0.0.18_@zag-js+accordion@0.19.1_@zag-js+checkbox@0.19.1_@zag-js+dialog_toqhwacqm4ck723ovqekq5mm7u/node_modules/@cfx-kit/ui-components/dist/Tooltip.js
53
- import { useEffect as useEffect3, useId, isValidElement, cloneElement, Children, Fragment } from "react";
54
-
55
- // ../../node_modules/.pnpm/@zag-js+anatomy@0.19.1/node_modules/@zag-js/anatomy/dist/index.mjs
56
- var createAnatomy = (name, parts2 = []) => ({
57
- parts: (...values) => {
58
- if (isEmpty(parts2)) {
59
- return createAnatomy(name, values);
60
- }
61
- throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?");
62
- },
63
- extendWith: (...values) => createAnatomy(name, [...parts2, ...values]),
64
- rename: (newName) => createAnatomy(newName, parts2),
65
- keys: () => parts2,
66
- build: () => [...new Set(parts2)].reduce(
67
- (prev, part) => Object.assign(prev, {
68
- [part]: {
69
- selector: [
70
- `&[data-scope="${toKebabCase(name)}"][data-part="${toKebabCase(part)}"]`,
71
- `& [data-scope="${toKebabCase(name)}"][data-part="${toKebabCase(part)}"]`
72
- ].join(", "),
73
- attrs: { "data-scope": toKebabCase(name), "data-part": toKebabCase(part) }
74
- }
75
- }),
76
- {}
77
- )
78
- });
79
- var toKebabCase = (value) => value.replace(/([A-Z])([A-Z])/g, "$1-$2").replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
80
- var isEmpty = (v) => v.length === 0;
81
-
82
- // ../../node_modules/.pnpm/@zag-js+dom-query@0.19.1/node_modules/@zag-js/dom-query/dist/index.mjs
83
- var dataAttr = (guard) => {
84
- return guard ? "" : void 0;
85
- };
86
- function isHTMLElement(value) {
87
- return typeof value === "object" && value?.nodeType === Node.ELEMENT_NODE && typeof value?.nodeName === "string";
88
- }
89
- var getDocument = (node) => {
90
- if (node.nodeType === Node.DOCUMENT_NODE)
91
- return node;
92
- return node.ownerDocument ?? document;
44
+ // ../../node_modules/.pnpm/proxy-compare@2.5.1/node_modules/proxy-compare/dist/index.modern.js
45
+ var e = Symbol();
46
+ var t = Symbol();
47
+ var r = "a";
48
+ var n = "w";
49
+ var o = (e2, t2) => new Proxy(e2, t2);
50
+ var s = Object.getPrototypeOf;
51
+ var c = /* @__PURE__ */ new WeakMap();
52
+ var l = (e2) => e2 && (c.has(e2) ? c.get(e2) : s(e2) === Object.prototype || s(e2) === Array.prototype);
53
+ var f = (e2) => "object" == typeof e2 && null !== e2;
54
+ var i = (e2) => {
55
+ if (Array.isArray(e2))
56
+ return Array.from(e2);
57
+ const t2 = Object.getOwnPropertyDescriptors(e2);
58
+ return Object.values(t2).forEach((e3) => {
59
+ e3.configurable = true;
60
+ }), Object.create(s(e2), t2);
93
61
  };
94
- function createScope(methods) {
95
- const screen = {
96
- getRootNode: (ctx) => ctx.getRootNode?.() ?? document,
97
- getDoc: (ctx) => getDocument(screen.getRootNode(ctx)),
98
- getWin: (ctx) => screen.getDoc(ctx).defaultView ?? window,
99
- getActiveElement: (ctx) => screen.getDoc(ctx).activeElement,
100
- getById: (ctx, id) => screen.getRootNode(ctx).getElementById(id),
101
- setValue: (elem, value) => {
102
- if (elem == null || value == null)
103
- return;
104
- elem.value = value.toString();
105
- }
106
- };
107
- return { ...screen, ...methods };
108
- }
109
- function isScrollParent(el) {
110
- const win = el.ownerDocument.defaultView || window;
111
- const { overflow, overflowX, overflowY } = win.getComputedStyle(el);
112
- return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
113
- }
114
- function getParent(el) {
115
- if (el.localName === "html")
116
- return el;
117
- return el.assignedSlot || el.parentElement || el.ownerDocument.documentElement;
118
- }
119
- function getScrollParent(el) {
120
- if (["html", "body", "#document"].includes(el.localName)) {
121
- return el.ownerDocument.body;
122
- }
123
- if (isHTMLElement(el) && isScrollParent(el)) {
124
- return el;
62
+ var u = (e2) => e2[t] || e2;
63
+ var a = (s2, c2, f2, p2) => {
64
+ if (!l(s2))
65
+ return s2;
66
+ let g = p2 && p2.get(s2);
67
+ if (!g) {
68
+ const e2 = u(s2);
69
+ g = ((e3) => Object.values(Object.getOwnPropertyDescriptors(e3)).some((e4) => !e4.configurable && !e4.writable))(e2) ? [e2, i(e2)] : [e2], null == p2 || p2.set(s2, g);
125
70
  }
126
- return getScrollParent(getParent(el));
127
- }
128
- function getScrollParents(el, list = []) {
129
- const parent = getScrollParent(el);
130
- const isBody = parent === el.ownerDocument.body;
131
- const win = parent.ownerDocument.defaultView || window;
132
- const target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(parent) ? parent : []) : parent;
133
- const parents = list.concat(target);
134
- return isBody ? parents : parents.concat(getScrollParents(getParent(target)));
135
- }
136
- var isDom = () => typeof document !== "undefined";
137
- function getPlatform() {
138
- const agent = navigator.userAgentData;
139
- return agent?.platform ?? navigator.platform;
140
- }
141
- var pt = (v) => isDom() && v.test(getPlatform());
142
- var vn = (v) => isDom() && v.test(navigator.vendor);
143
- var isSafari = () => isApple() && vn(/apple/i);
144
- var isApple = () => pt(/mac|iphone|ipad|ipod/i);
145
- function raf(fn) {
146
- const id = globalThis.requestAnimationFrame(fn);
147
- return () => {
148
- globalThis.cancelAnimationFrame(id);
149
- };
150
- }
151
-
152
- // ../../node_modules/.pnpm/@zag-js+utils@0.19.1/node_modules/@zag-js/utils/dist/index.mjs
153
- var callAll = (...fns) => (...a2) => {
154
- fns.forEach(function(fn) {
155
- fn?.(...a2);
156
- });
71
+ const [y2, h2] = g;
72
+ let w = f2 && f2.get(y2);
73
+ return w && w[1].f === !!h2 || (w = ((o2, s3) => {
74
+ const c3 = { f: s3 };
75
+ let l2 = false;
76
+ const f3 = (e2, t2) => {
77
+ if (!l2) {
78
+ let s4 = c3[r].get(o2);
79
+ if (s4 || (s4 = {}, c3[r].set(o2, s4)), e2 === n)
80
+ s4[n] = true;
81
+ else {
82
+ let r2 = s4[e2];
83
+ r2 || (r2 = /* @__PURE__ */ new Set(), s4[e2] = r2), r2.add(t2);
84
+ }
85
+ }
86
+ }, i2 = { get: (e2, n2) => n2 === t ? o2 : (f3("k", n2), a(Reflect.get(e2, n2), c3[r], c3.c, c3.t)), has: (t2, n2) => n2 === e ? (l2 = true, c3[r].delete(o2), true) : (f3("h", n2), Reflect.has(t2, n2)), getOwnPropertyDescriptor: (e2, t2) => (f3("o", t2), Reflect.getOwnPropertyDescriptor(e2, t2)), ownKeys: (e2) => (f3(n), Reflect.ownKeys(e2)) };
87
+ return s3 && (i2.set = i2.deleteProperty = () => false), [i2, c3];
88
+ })(y2, !!h2), w[1].p = o(h2 || y2, w[0]), f2 && f2.set(y2, w)), w[1][r] = c2, w[1].c = f2, w[1].t = p2, w[1].p;
157
89
  };
158
- function compact(obj) {
159
- if (!isPlainObject(obj) || obj === void 0) {
160
- return obj;
90
+ var p = (e2, t2, r2, o2) => {
91
+ if (Object.is(e2, t2))
92
+ return false;
93
+ if (!f(e2) || !f(t2))
94
+ return true;
95
+ const s2 = r2.get(u(e2));
96
+ if (!s2)
97
+ return true;
98
+ if (o2) {
99
+ const r3 = o2.get(e2);
100
+ if (r3 && r3.n === t2)
101
+ return r3.g;
102
+ o2.set(e2, { n: t2, g: false });
161
103
  }
162
- const keys = Reflect.ownKeys(obj).filter((key) => typeof key === "string");
163
- const filtered = {};
164
- for (const key of keys) {
165
- const value = obj[key];
166
- if (value !== void 0) {
167
- filtered[key] = compact(value);
168
- }
104
+ let c2 = null;
105
+ try {
106
+ for (const r3 of s2.h || [])
107
+ if (c2 = Reflect.has(e2, r3) !== Reflect.has(t2, r3), c2)
108
+ return c2;
109
+ if (true === s2[n]) {
110
+ if (c2 = ((e3, t3) => {
111
+ const r3 = Reflect.ownKeys(e3), n2 = Reflect.ownKeys(t3);
112
+ return r3.length !== n2.length || r3.some((e4, t4) => e4 !== n2[t4]);
113
+ })(e2, t2), c2)
114
+ return c2;
115
+ } else
116
+ for (const r3 of s2.o || [])
117
+ if (c2 = !!Reflect.getOwnPropertyDescriptor(e2, r3) != !!Reflect.getOwnPropertyDescriptor(t2, r3), c2)
118
+ return c2;
119
+ for (const n2 of s2.k || [])
120
+ if (c2 = p(e2[n2], t2[n2], r2, o2), c2)
121
+ return c2;
122
+ return null === c2 && (c2 = true), c2;
123
+ } finally {
124
+ o2 && o2.set(e2, { n: t2, g: c2 });
169
125
  }
170
- return filtered;
171
- }
172
- var isPlainObject = (value) => {
173
- return value && typeof value === "object" && value.constructor === Object;
126
+ };
127
+ var y = (e2) => l(e2) && e2[t] || null;
128
+ var h = (e2, t2 = true) => {
129
+ c.set(e2, t2);
174
130
  };
175
131
 
176
- // ../../node_modules/.pnpm/@zag-js+element-rect@0.19.1/node_modules/@zag-js/element-rect/dist/index.mjs
177
- var rafId;
178
- var observedElements = /* @__PURE__ */ new Map();
179
- var getRectFn = (el) => el.getBoundingClientRect();
180
- function trackElementRect(el, options) {
181
- const { scope = "rect", getRect = getRectFn, onChange } = options;
182
- const loop = getLoopFn({ scope, getRect });
183
- const data = observedElements.get(el);
184
- if (!data) {
185
- observedElements.set(el, {
186
- rect: {},
187
- callbacks: [onChange]
188
- });
189
- if (observedElements.size === 1) {
190
- rafId = requestAnimationFrame(loop);
191
- }
192
- } else {
193
- data.callbacks.push(onChange);
194
- onChange(getRect(el));
132
+ // ../../node_modules/.pnpm/@zag-js+store@0.19.1/node_modules/@zag-js/store/dist/index.mjs
133
+ var isDev = process.env.NODE_ENV !== "production";
134
+ var isObject = (x) => typeof x === "object" && x !== null;
135
+ var proxyStateMap = /* @__PURE__ */ new WeakMap();
136
+ var refSet = /* @__PURE__ */ new WeakSet();
137
+ var buildProxyFunction = (objectIs = Object.is, newProxy = (target, handler) => new Proxy(target, handler), canProxy = (x) => isObject(x) && !refSet.has(x) && (Array.isArray(x) || !(Symbol.iterator in x)) && !(x instanceof WeakMap) && !(x instanceof WeakSet) && !(x instanceof Error) && !(x instanceof Number) && !(x instanceof Date) && !(x instanceof String) && !(x instanceof RegExp) && !(x instanceof ArrayBuffer), defaultHandlePromise = (promise) => {
138
+ switch (promise.status) {
139
+ case "fulfilled":
140
+ return promise.value;
141
+ case "rejected":
142
+ throw promise.reason;
143
+ default:
144
+ throw promise;
195
145
  }
196
- return function unobserve() {
197
- const data2 = observedElements.get(el);
198
- if (!data2)
199
- return;
200
- const index = data2.callbacks.indexOf(onChange);
201
- if (index > -1) {
202
- data2.callbacks.splice(index, 1);
146
+ }, snapCache = /* @__PURE__ */ new WeakMap(), createSnapshot = (target, version, handlePromise = defaultHandlePromise) => {
147
+ const cache = snapCache.get(target);
148
+ if (cache?.[0] === version) {
149
+ return cache[1];
150
+ }
151
+ const snap = Array.isArray(target) ? [] : Object.create(Object.getPrototypeOf(target));
152
+ h(snap, true);
153
+ snapCache.set(target, [version, snap]);
154
+ Reflect.ownKeys(target).forEach((key) => {
155
+ const value = Reflect.get(target, key);
156
+ if (refSet.has(value)) {
157
+ h(value, false);
158
+ snap[key] = value;
159
+ } else if (value instanceof Promise) {
160
+ Object.defineProperty(snap, key, {
161
+ get() {
162
+ return handlePromise(value);
163
+ }
164
+ });
165
+ } else if (proxyStateMap.has(value)) {
166
+ snap[key] = snapshot(value, handlePromise);
167
+ } else {
168
+ snap[key] = value;
203
169
  }
204
- if (data2.callbacks.length === 0) {
205
- observedElements.delete(el);
206
- if (observedElements.size === 0) {
207
- cancelAnimationFrame(rafId);
208
- }
170
+ });
171
+ return Object.freeze(snap);
172
+ }, proxyCache = /* @__PURE__ */ new WeakMap(), versionHolder = [1, 1], proxyFunction2 = (initialObject) => {
173
+ if (!isObject(initialObject)) {
174
+ throw new Error("object required");
175
+ }
176
+ const found = proxyCache.get(initialObject);
177
+ if (found) {
178
+ return found;
179
+ }
180
+ let version = versionHolder[0];
181
+ const listeners = /* @__PURE__ */ new Set();
182
+ const notifyUpdate = (op, nextVersion = ++versionHolder[0]) => {
183
+ if (version !== nextVersion) {
184
+ version = nextVersion;
185
+ listeners.forEach((listener) => listener(op, nextVersion));
209
186
  }
210
187
  };
211
- }
212
- function getLoopFn(options) {
213
- const { scope, getRect } = options;
214
- const isEqual = getEqualityFn(scope);
215
- return function loop() {
216
- const changedRectsData = [];
217
- observedElements.forEach((data, element) => {
218
- const newRect = getRect(element);
219
- if (!isEqual(data.rect, newRect)) {
220
- data.rect = newRect;
221
- changedRectsData.push(data);
188
+ let checkVersion = versionHolder[1];
189
+ const ensureVersion = (nextCheckVersion = ++versionHolder[1]) => {
190
+ if (checkVersion !== nextCheckVersion && !listeners.size) {
191
+ checkVersion = nextCheckVersion;
192
+ propProxyStates.forEach(([propProxyState]) => {
193
+ const propVersion = propProxyState[1](nextCheckVersion);
194
+ if (propVersion > version) {
195
+ version = propVersion;
196
+ }
197
+ });
198
+ }
199
+ return version;
200
+ };
201
+ const createPropListener = (prop) => (op, nextVersion) => {
202
+ const newOp = [...op];
203
+ newOp[1] = [prop, ...newOp[1]];
204
+ notifyUpdate(newOp, nextVersion);
205
+ };
206
+ const propProxyStates = /* @__PURE__ */ new Map();
207
+ const addPropListener = (prop, propProxyState) => {
208
+ if (isDev && propProxyStates.has(prop)) {
209
+ throw new Error("prop listener already exists");
210
+ }
211
+ if (listeners.size) {
212
+ const remove = propProxyState[3](createPropListener(prop));
213
+ propProxyStates.set(prop, [propProxyState, remove]);
214
+ } else {
215
+ propProxyStates.set(prop, [propProxyState]);
216
+ }
217
+ };
218
+ const removePropListener = (prop) => {
219
+ const entry = propProxyStates.get(prop);
220
+ if (entry) {
221
+ propProxyStates.delete(prop);
222
+ entry[1]?.();
223
+ }
224
+ };
225
+ const addListener = (listener) => {
226
+ listeners.add(listener);
227
+ if (listeners.size === 1) {
228
+ propProxyStates.forEach(([propProxyState, prevRemove], prop) => {
229
+ if (isDev && prevRemove) {
230
+ throw new Error("remove already exists");
231
+ }
232
+ const remove = propProxyState[3](createPropListener(prop));
233
+ propProxyStates.set(prop, [propProxyState, remove]);
234
+ });
235
+ }
236
+ const removeListener = () => {
237
+ listeners.delete(listener);
238
+ if (listeners.size === 0) {
239
+ propProxyStates.forEach(([propProxyState, remove], prop) => {
240
+ if (remove) {
241
+ remove();
242
+ propProxyStates.set(prop, [propProxyState]);
243
+ }
244
+ });
222
245
  }
223
- });
224
- changedRectsData.forEach((data) => {
225
- data.callbacks.forEach((callback) => callback(data.rect));
226
- });
227
- rafId = requestAnimationFrame(loop);
246
+ };
247
+ return removeListener;
228
248
  };
229
- }
230
- var isEqualSize = (a2, b) => a2.width === b.width && a2.height === b.height;
231
- var isEqualPosition = (a2, b) => a2.top === b.top && a2.left === b.left;
232
- var isEqualRect = (a2, b) => isEqualSize(a2, b) && isEqualPosition(a2, b);
233
- function getEqualityFn(scope) {
234
- if (scope === "size")
235
- return isEqualSize;
236
- if (scope === "position")
237
- return isEqualPosition;
238
- return isEqualRect;
239
- }
240
-
241
- // ../../node_modules/.pnpm/@zag-js+popper@0.19.1/node_modules/@zag-js/popper/dist/index.mjs
242
- var callAll2 = (...fns) => () => fns.forEach((fn) => fn());
243
- var isHTMLElement2 = (el) => {
244
- return typeof el === "object" && el !== null && el.nodeType === 1;
245
- };
246
- var addDomEvent = (el, type, fn, options) => {
247
- el.addEventListener(type, fn, options);
248
- return () => el.removeEventListener(type, fn, options);
249
- };
250
- function resolveOptions(option) {
251
- const bool = typeof option === "boolean";
252
- return {
253
- ancestorResize: bool ? option : option.ancestorResize ?? true,
254
- ancestorScroll: bool ? option : option.ancestorScroll ?? true,
255
- referenceResize: bool ? option : option.referenceResize ?? true
249
+ const baseObject = Array.isArray(initialObject) ? [] : Object.create(Object.getPrototypeOf(initialObject));
250
+ const handler = {
251
+ deleteProperty(target, prop) {
252
+ const prevValue = Reflect.get(target, prop);
253
+ removePropListener(prop);
254
+ const deleted = Reflect.deleteProperty(target, prop);
255
+ if (deleted) {
256
+ notifyUpdate(["delete", [prop], prevValue]);
257
+ }
258
+ return deleted;
259
+ },
260
+ set(target, prop, value, receiver) {
261
+ const hasPrevValue = Reflect.has(target, prop);
262
+ const prevValue = Reflect.get(target, prop, receiver);
263
+ if (hasPrevValue && (objectIs(prevValue, value) || proxyCache.has(value) && objectIs(prevValue, proxyCache.get(value)))) {
264
+ return true;
265
+ }
266
+ removePropListener(prop);
267
+ if (isObject(value)) {
268
+ value = y(value) || value;
269
+ }
270
+ let nextValue = value;
271
+ if (Object.getOwnPropertyDescriptor(target, prop)?.set) {
272
+ } else if (value instanceof Promise) {
273
+ value.then((v) => {
274
+ value.status = "fulfilled";
275
+ value.value = v;
276
+ notifyUpdate(["resolve", [prop], v]);
277
+ }).catch((e2) => {
278
+ value.status = "rejected";
279
+ value.reason = e2;
280
+ notifyUpdate(["reject", [prop], e2]);
281
+ });
282
+ } else {
283
+ if (!proxyStateMap.has(value) && canProxy(value)) {
284
+ nextValue = proxy(value);
285
+ }
286
+ const childProxyState = !refSet.has(nextValue) && proxyStateMap.get(nextValue);
287
+ if (childProxyState) {
288
+ addPropListener(prop, childProxyState);
289
+ }
290
+ }
291
+ Reflect.set(target, prop, nextValue, receiver);
292
+ notifyUpdate(["set", [prop], value, prevValue]);
293
+ return true;
294
+ }
256
295
  };
296
+ const proxyObject = newProxy(baseObject, handler);
297
+ proxyCache.set(initialObject, proxyObject);
298
+ const proxyState = [baseObject, ensureVersion, createSnapshot, addListener];
299
+ proxyStateMap.set(proxyObject, proxyState);
300
+ Reflect.ownKeys(initialObject).forEach((key) => {
301
+ const desc = Object.getOwnPropertyDescriptor(initialObject, key);
302
+ if (desc.get || desc.set) {
303
+ Object.defineProperty(baseObject, key, desc);
304
+ } else {
305
+ proxyObject[key] = initialObject[key];
306
+ }
307
+ });
308
+ return proxyObject;
309
+ }) => [
310
+ // public functions
311
+ proxyFunction2,
312
+ // shared state
313
+ proxyStateMap,
314
+ refSet,
315
+ // internal things
316
+ objectIs,
317
+ newProxy,
318
+ canProxy,
319
+ defaultHandlePromise,
320
+ snapCache,
321
+ createSnapshot,
322
+ proxyCache,
323
+ versionHolder
324
+ ];
325
+ var [proxyFunction] = buildProxyFunction();
326
+ function proxy(initialObject = {}) {
327
+ return proxyFunction(initialObject);
257
328
  }
258
- function autoUpdate(reference, floating, update, options = false) {
259
- const { ancestorScroll, ancestorResize, referenceResize } = resolveOptions(options);
260
- const useAncestors = ancestorScroll || ancestorResize;
261
- const ancestors = [];
262
- if (useAncestors && isHTMLElement2(reference)) {
263
- ancestors.push(...getOverflowAncestors(reference));
329
+ function subscribe(proxyObject, callback, notifyInSync) {
330
+ const proxyState = proxyStateMap.get(proxyObject);
331
+ if (isDev && !proxyState) {
332
+ console.warn("Please use proxy object");
264
333
  }
265
- function addResizeListeners() {
266
- let cleanups = [trackElementRect(floating, { scope: "size", onChange: update })];
267
- if (referenceResize && isHTMLElement2(reference)) {
268
- cleanups.push(trackElementRect(reference, { onChange: update }));
334
+ let promise;
335
+ const ops = [];
336
+ const addListener = proxyState[3];
337
+ let isListenerActive = false;
338
+ const listener = (op) => {
339
+ ops.push(op);
340
+ if (notifyInSync) {
341
+ callback(ops.splice(0));
342
+ return;
269
343
  }
270
- cleanups.push(callAll2(...ancestors.map((el) => addDomEvent(el, "resize", update))));
271
- return () => cleanups.forEach((fn) => fn());
272
- }
273
- function addScrollListeners() {
274
- return callAll2(...ancestors.map((el) => addDomEvent(el, "scroll", update, { passive: true })));
344
+ if (!promise) {
345
+ promise = Promise.resolve().then(() => {
346
+ promise = void 0;
347
+ if (isListenerActive) {
348
+ callback(ops.splice(0));
349
+ }
350
+ });
351
+ }
352
+ };
353
+ const removeListener = addListener(listener);
354
+ isListenerActive = true;
355
+ return () => {
356
+ isListenerActive = false;
357
+ removeListener();
358
+ };
359
+ }
360
+ function snapshot(proxyObject, handlePromise) {
361
+ const proxyState = proxyStateMap.get(proxyObject);
362
+ if (isDev && !proxyState) {
363
+ console.warn("Please use proxy object");
275
364
  }
276
- return callAll2(addResizeListeners(), addScrollListeners());
365
+ const [target, ensureVersion, createSnapshot] = proxyState;
366
+ return createSnapshot(target, ensureVersion(), handlePromise);
277
367
  }
278
- var toVar = (value) => ({ variable: value, reference: `var(${value})` });
279
- var cssVars = {
280
- arrowSize: toVar("--arrow-size"),
281
- arrowSizeHalf: toVar("--arrow-size-half"),
282
- arrowBg: toVar("--arrow-background"),
283
- transformOrigin: toVar("--transform-origin"),
284
- arrowOffset: toVar("--arrow-offset")
285
- };
286
- var getTransformOrigin = (arrow2) => ({
287
- top: "bottom center",
288
- "top-start": arrow2 ? `${arrow2.x}px bottom` : "left bottom",
289
- "top-end": arrow2 ? `${arrow2.x}px bottom` : "right bottom",
290
- bottom: "top center",
291
- "bottom-start": arrow2 ? `${arrow2.x}px top` : "top left",
292
- "bottom-end": arrow2 ? `${arrow2.x}px top` : "top right",
293
- left: "right center",
294
- "left-start": arrow2 ? `right ${arrow2.y}px` : "right top",
295
- "left-end": arrow2 ? `right ${arrow2.y}px` : "right bottom",
296
- right: "left center",
297
- "right-start": arrow2 ? `left ${arrow2.y}px` : "left top",
298
- "right-end": arrow2 ? `left ${arrow2.y}px` : "left bottom"
299
- });
300
- var transformOrigin = {
301
- name: "transformOrigin",
302
- fn({ placement, elements, middlewareData }) {
303
- const { arrow: arrow2 } = middlewareData;
304
- const transformOrigin2 = getTransformOrigin(arrow2)[placement];
305
- const { floating } = elements;
306
- floating.style.setProperty(cssVars.transformOrigin.variable, transformOrigin2);
307
- return {
308
- data: { transformOrigin: transformOrigin2 }
309
- };
310
- }
311
- };
312
- var shiftArrow = (opts) => ({
313
- name: "shiftArrow",
314
- fn({ placement, middlewareData }) {
315
- const { element: arrow2 } = opts;
316
- if (middlewareData.arrow) {
317
- const { x, y: y2 } = middlewareData.arrow;
318
- const dir = placement.split("-")[0];
319
- Object.assign(arrow2.style, {
320
- left: x != null ? `${x}px` : "",
321
- top: y2 != null ? `${y2}px` : "",
322
- [dir]: `calc(100% + ${cssVars.arrowOffset.reference})`
323
- });
368
+ function ref(obj) {
369
+ refSet.add(obj);
370
+ return obj;
371
+ }
372
+ function proxyWithComputed(initialObject, computedFns) {
373
+ const keys = Object.keys(computedFns);
374
+ keys.forEach((key) => {
375
+ if (Object.getOwnPropertyDescriptor(initialObject, key)) {
376
+ throw new Error("object property already defined");
324
377
  }
325
- return {};
326
- }
327
- });
328
- var defaultOptions = {
329
- strategy: "absolute",
330
- placement: "bottom",
331
- listeners: true,
332
- gutter: 8,
333
- flip: true,
334
- sameWidth: false,
335
- overflowPadding: 8
336
- };
337
- function getPlacementImpl(reference, floating, opts = {}) {
338
- if (!floating || !reference)
339
- return;
340
- const options = Object.assign({}, defaultOptions, opts);
341
- const arrowEl = floating.querySelector("[data-part=arrow]");
342
- const middleware = [];
343
- const boundary = typeof options.boundary === "function" ? options.boundary() : options.boundary;
344
- if (options.flip) {
345
- middleware.push(
346
- flip({
347
- boundary,
348
- padding: options.overflowPadding
349
- })
350
- );
351
- }
352
- if (options.gutter || options.offset) {
353
- const arrowOffset = arrowEl ? arrowEl.offsetHeight / 2 : 0;
354
- let mainAxis = options.offset?.mainAxis ?? options.gutter;
355
- let crossAxis = options.offset?.crossAxis;
356
- if (mainAxis != null)
357
- mainAxis += arrowOffset;
358
- const offsetOptions = compact({ mainAxis, crossAxis });
359
- middleware.push(offset(offsetOptions));
360
- }
361
- middleware.push(
362
- shift({
363
- boundary,
364
- crossAxis: options.overlap,
365
- padding: options.overflowPadding
366
- })
367
- );
368
- if (arrowEl) {
369
- middleware.push(
370
- arrow({ element: arrowEl, padding: 8 }),
371
- shiftArrow({ element: arrowEl })
372
- );
373
- }
374
- middleware.push(transformOrigin);
375
- middleware.push(
376
- size({
377
- padding: options.overflowPadding,
378
- apply({ rects, availableHeight, availableWidth }) {
379
- const referenceWidth = Math.round(rects.reference.width);
380
- floating.style.setProperty("--reference-width", `${referenceWidth}px`);
381
- floating.style.setProperty("--available-width", `${availableWidth}px`);
382
- floating.style.setProperty("--available-height", `${availableHeight}px`);
383
- }
384
- })
385
- );
386
- function compute(config = {}) {
387
- if (!reference || !floating)
378
+ const computedFn = computedFns[key];
379
+ const { get, set: set2 } = typeof computedFn === "function" ? { get: computedFn } : computedFn;
380
+ const desc = {};
381
+ desc.get = () => get(snapshot(proxyObject));
382
+ if (set2) {
383
+ desc.set = (newValue) => set2(proxyObject, newValue);
384
+ }
385
+ Object.defineProperty(initialObject, key, desc);
386
+ });
387
+ const proxyObject = proxy(initialObject);
388
+ return proxyObject;
389
+ }
390
+ var defaultCompareFn = (prev, next) => Object.is(prev, next);
391
+ function subscribeKey(obj, key, fn, sync, compareFn) {
392
+ let prev = Reflect.get(snapshot(obj), key);
393
+ const isEqual = compareFn || defaultCompareFn;
394
+ function onSnapshotChange() {
395
+ const snap = snapshot(obj);
396
+ if (isEqual(prev, snap[key]))
388
397
  return;
389
- const { placement, strategy, onComplete } = options;
390
- computePosition(reference, floating, {
391
- placement,
392
- middleware,
393
- strategy,
394
- ...config
395
- }).then((data) => {
396
- const x = Math.round(data.x);
397
- floating.style.setProperty("--x", `${x}px`);
398
- const y2 = Math.round(data.y);
399
- floating.style.setProperty("--y", `${y2}px`);
400
- onComplete?.(data);
401
- });
398
+ fn(snap[key]);
399
+ prev = Reflect.get(snap, key);
402
400
  }
403
- compute();
404
- return callAll(
405
- options.listeners ? autoUpdate(reference, floating, compute, options.listeners) : void 0,
406
- options.onCleanup
407
- );
401
+ return subscribe(obj, onSnapshotChange, sync);
408
402
  }
409
- function getPlacement(referenceOrFn, floatingOrFn, opts = {}) {
410
- const { defer, ...restOptions } = opts;
411
- const func = defer ? raf : (v) => v();
412
- const cleanups = [];
413
- cleanups.push(
414
- func(() => {
415
- const reference = typeof referenceOrFn === "function" ? referenceOrFn() : referenceOrFn;
416
- const floating = typeof floatingOrFn === "function" ? floatingOrFn() : floatingOrFn;
417
- cleanups.push(getPlacementImpl(reference, floating, restOptions));
418
- })
419
- );
420
- return () => {
421
- cleanups.forEach((fn) => fn?.());
422
- };
403
+
404
+ // ../../node_modules/.pnpm/klona@2.0.6/node_modules/klona/full/index.mjs
405
+ function set(obj, key, val) {
406
+ if (typeof val.value === "object")
407
+ val.value = klona(val.value);
408
+ if (!val.enumerable || val.get || val.set || !val.configurable || !val.writable || key === "__proto__") {
409
+ Object.defineProperty(obj, key, val);
410
+ } else
411
+ obj[key] = val.value;
423
412
  }
424
- var ARROW_FLOATING_STYLE = {
425
- bottom: "rotate(45deg)",
426
- left: "rotate(135deg)",
427
- top: "rotate(225deg)",
428
- right: "rotate(315deg)"
429
- };
430
- function getPlacementStyles(options = {}) {
431
- const { placement = "bottom", sameWidth, fitViewport, strategy = "absolute" } = options;
432
- return {
433
- arrow: {
434
- position: "absolute",
435
- width: cssVars.arrowSize.reference,
436
- height: cssVars.arrowSize.reference,
437
- [cssVars.arrowSizeHalf.variable]: `calc(${cssVars.arrowSize.reference} / 2)`,
438
- [cssVars.arrowOffset.variable]: `calc(${cssVars.arrowSizeHalf.reference} * -1)`
439
- },
440
- arrowTip: {
441
- transform: ARROW_FLOATING_STYLE[placement.split("-")[0]],
442
- background: cssVars.arrowBg.reference,
443
- top: "0",
444
- left: "0",
445
- width: "100%",
446
- height: "100%",
447
- position: "absolute",
448
- zIndex: "inherit"
449
- },
450
- floating: {
451
- position: strategy,
452
- minWidth: sameWidth ? void 0 : "max-content",
453
- width: sameWidth ? "var(--reference-width)" : void 0,
454
- maxWidth: fitViewport ? "var(--available-width)" : void 0,
455
- maxHeight: fitViewport ? "var(--available-height)" : void 0,
456
- top: "0px",
457
- left: "0px",
458
- transform: `translate3d(var(--x), var(--y), 0)`
413
+ function klona(x) {
414
+ if (typeof x !== "object")
415
+ return x;
416
+ var i2 = 0, k, list, tmp, str = Object.prototype.toString.call(x);
417
+ if (str === "[object Object]") {
418
+ tmp = Object.create(x.__proto__ || null);
419
+ } else if (str === "[object Array]") {
420
+ tmp = Array(x.length);
421
+ } else if (str === "[object Set]") {
422
+ tmp = /* @__PURE__ */ new Set();
423
+ x.forEach(function(val) {
424
+ tmp.add(klona(val));
425
+ });
426
+ } else if (str === "[object Map]") {
427
+ tmp = /* @__PURE__ */ new Map();
428
+ x.forEach(function(val, key) {
429
+ tmp.set(klona(key), klona(val));
430
+ });
431
+ } else if (str === "[object Date]") {
432
+ tmp = /* @__PURE__ */ new Date(+x);
433
+ } else if (str === "[object RegExp]") {
434
+ tmp = new RegExp(x.source, x.flags);
435
+ } else if (str === "[object DataView]") {
436
+ tmp = new x.constructor(klona(x.buffer));
437
+ } else if (str === "[object ArrayBuffer]") {
438
+ tmp = x.slice(0);
439
+ } else if (str.slice(-6) === "Array]") {
440
+ tmp = new x.constructor(x);
441
+ }
442
+ if (tmp) {
443
+ for (list = Object.getOwnPropertySymbols(x); i2 < list.length; i2++) {
444
+ set(tmp, list[i2], Object.getOwnPropertyDescriptor(x, list[i2]));
459
445
  }
460
- };
446
+ for (i2 = 0, list = Object.getOwnPropertyNames(x); i2 < list.length; i2++) {
447
+ if (Object.hasOwnProperty.call(tmp, k = list[i2]) && tmp[k] === x[k])
448
+ continue;
449
+ set(tmp, k, Object.getOwnPropertyDescriptor(x, k));
450
+ }
451
+ }
452
+ return tmp || x;
461
453
  }
462
454
 
463
- // ../../node_modules/.pnpm/proxy-compare@2.5.1/node_modules/proxy-compare/dist/index.modern.js
464
- var e = Symbol();
465
- var t = Symbol();
466
- var r = "a";
467
- var n = "w";
468
- var o = (e2, t2) => new Proxy(e2, t2);
469
- var s = Object.getPrototypeOf;
470
- var c = /* @__PURE__ */ new WeakMap();
471
- var l = (e2) => e2 && (c.has(e2) ? c.get(e2) : s(e2) === Object.prototype || s(e2) === Array.prototype);
472
- var f = (e2) => "object" == typeof e2 && null !== e2;
473
- var i = (e2) => {
474
- if (Array.isArray(e2))
475
- return Array.from(e2);
476
- const t2 = Object.getOwnPropertyDescriptors(e2);
477
- return Object.values(t2).forEach((e3) => {
478
- e3.configurable = true;
479
- }), Object.create(s(e2), t2);
455
+ // ../../node_modules/.pnpm/@zag-js+core@0.19.1/node_modules/@zag-js/core/dist/index.mjs
456
+ var __defProp2 = Object.defineProperty;
457
+ var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
458
+ var __publicField = (obj, key, value) => {
459
+ __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
460
+ return value;
480
461
  };
481
- var u = (e2) => e2[t] || e2;
482
- var a = (s2, c2, f2, p2) => {
483
- if (!l(s2))
484
- return s2;
485
- let g = p2 && p2.get(s2);
486
- if (!g) {
487
- const e2 = u(s2);
488
- g = ((e3) => Object.values(Object.getOwnPropertyDescriptors(e3)).some((e4) => !e4.configurable && !e4.writable))(e2) ? [e2, i(e2)] : [e2], null == p2 || p2.set(s2, g);
489
- }
490
- const [y2, h2] = g;
491
- let w = f2 && f2.get(y2);
492
- return w && w[1].f === !!h2 || (w = ((o2, s3) => {
493
- const c3 = { f: s3 };
494
- let l2 = false;
495
- const f3 = (e2, t2) => {
496
- if (!l2) {
497
- let s4 = c3[r].get(o2);
498
- if (s4 || (s4 = {}, c3[r].set(o2, s4)), e2 === n)
499
- s4[n] = true;
500
- else {
501
- let r2 = s4[e2];
502
- r2 || (r2 = /* @__PURE__ */ new Set(), s4[e2] = r2), r2.add(t2);
503
- }
504
- }
505
- }, i2 = { get: (e2, n2) => n2 === t ? o2 : (f3("k", n2), a(Reflect.get(e2, n2), c3[r], c3.c, c3.t)), has: (t2, n2) => n2 === e ? (l2 = true, c3[r].delete(o2), true) : (f3("h", n2), Reflect.has(t2, n2)), getOwnPropertyDescriptor: (e2, t2) => (f3("o", t2), Reflect.getOwnPropertyDescriptor(e2, t2)), ownKeys: (e2) => (f3(n), Reflect.ownKeys(e2)) };
506
- return s3 && (i2.set = i2.deleteProperty = () => false), [i2, c3];
507
- })(y2, !!h2), w[1].p = o(h2 || y2, w[0]), f2 && f2.set(y2, w)), w[1][r] = c2, w[1].c = f2, w[1].t = p2, w[1].p;
462
+ function clear(v) {
463
+ while (v.length > 0)
464
+ v.pop();
465
+ return v;
466
+ }
467
+ var runIfFn = (v, ...a2) => {
468
+ const res = typeof v === "function" ? v(...a2) : v;
469
+ return res ?? void 0;
508
470
  };
509
- var p = (e2, t2, r2, o2) => {
510
- if (Object.is(e2, t2))
511
- return false;
512
- if (!f(e2) || !f(t2))
513
- return true;
514
- const s2 = r2.get(u(e2));
515
- if (!s2)
516
- return true;
517
- if (o2) {
518
- const r3 = o2.get(e2);
519
- if (r3 && r3.n === t2)
520
- return r3.g;
521
- o2.set(e2, { n: t2, g: false });
471
+ var cast = (v) => v;
472
+ var noop = () => {
473
+ };
474
+ var uuid = /* @__PURE__ */ (() => {
475
+ let id = 0;
476
+ return () => {
477
+ id++;
478
+ return id.toString(36);
479
+ };
480
+ })();
481
+ var isDev2 = () => process.env.NODE_ENV !== "production";
482
+ var isArray = (v) => Array.isArray(v);
483
+ var isObject2 = (v) => !(v == null || typeof v !== "object" || isArray(v));
484
+ var isNumber = (v) => typeof v === "number" && !Number.isNaN(v);
485
+ var isString = (v) => typeof v === "string";
486
+ var isFunction = (v) => typeof v === "function";
487
+ function compact(obj) {
488
+ if (!isPlainObject(obj) || obj === void 0) {
489
+ return obj;
522
490
  }
523
- let c2 = null;
524
- try {
525
- for (const r3 of s2.h || [])
526
- if (c2 = Reflect.has(e2, r3) !== Reflect.has(t2, r3), c2)
527
- return c2;
528
- if (true === s2[n]) {
529
- if (c2 = ((e3, t3) => {
530
- const r3 = Reflect.ownKeys(e3), n2 = Reflect.ownKeys(t3);
531
- return r3.length !== n2.length || r3.some((e4, t4) => e4 !== n2[t4]);
532
- })(e2, t2), c2)
533
- return c2;
534
- } else
535
- for (const r3 of s2.o || [])
536
- if (c2 = !!Reflect.getOwnPropertyDescriptor(e2, r3) != !!Reflect.getOwnPropertyDescriptor(t2, r3), c2)
537
- return c2;
538
- for (const n2 of s2.k || [])
539
- if (c2 = p(e2[n2], t2[n2], r2, o2), c2)
540
- return c2;
541
- return null === c2 && (c2 = true), c2;
542
- } finally {
543
- o2 && o2.set(e2, { n: t2, g: c2 });
491
+ const keys = Reflect.ownKeys(obj).filter((key) => typeof key === "string");
492
+ const filtered = {};
493
+ for (const key of keys) {
494
+ const value = obj[key];
495
+ if (value !== void 0) {
496
+ filtered[key] = compact(value);
497
+ }
544
498
  }
499
+ return filtered;
500
+ }
501
+ var isPlainObject = (value) => {
502
+ return value && typeof value === "object" && value.constructor === Object;
545
503
  };
546
- var y = (e2) => l(e2) && e2[t] || null;
547
- var h = (e2, t2 = true) => {
548
- c.set(e2, t2);
549
- };
550
-
551
- // ../../node_modules/.pnpm/@zag-js+store@0.19.1/node_modules/@zag-js/store/dist/index.mjs
552
- var isDev = process.env.NODE_ENV !== "production";
553
- var isObject = (x) => typeof x === "object" && x !== null;
554
- var proxyStateMap = /* @__PURE__ */ new WeakMap();
555
- var refSet = /* @__PURE__ */ new WeakSet();
556
- var buildProxyFunction = (objectIs = Object.is, newProxy = (target, handler) => new Proxy(target, handler), canProxy = (x) => isObject(x) && !refSet.has(x) && (Array.isArray(x) || !(Symbol.iterator in x)) && !(x instanceof WeakMap) && !(x instanceof WeakSet) && !(x instanceof Error) && !(x instanceof Number) && !(x instanceof Date) && !(x instanceof String) && !(x instanceof RegExp) && !(x instanceof ArrayBuffer), defaultHandlePromise = (promise) => {
557
- switch (promise.status) {
558
- case "fulfilled":
559
- return promise.value;
560
- case "rejected":
561
- throw promise.reason;
562
- default:
563
- throw promise;
504
+ function warn(...a2) {
505
+ const m = a2.length === 1 ? a2[0] : a2[1];
506
+ const c2 = a2.length === 2 ? a2[0] : true;
507
+ if (c2 && process.env.NODE_ENV !== "production") {
508
+ console.warn(m);
564
509
  }
565
- }, snapCache = /* @__PURE__ */ new WeakMap(), createSnapshot = (target, version, handlePromise = defaultHandlePromise) => {
566
- const cache = snapCache.get(target);
567
- if (cache?.[0] === version) {
568
- return cache[1];
510
+ }
511
+ function invariant(...a2) {
512
+ const m = a2.length === 1 ? a2[0] : a2[1];
513
+ const c2 = a2.length === 2 ? a2[0] : true;
514
+ if (c2 && process.env.NODE_ENV !== "production") {
515
+ throw new Error(m);
569
516
  }
570
- const snap = Array.isArray(target) ? [] : Object.create(Object.getPrototypeOf(target));
571
- h(snap, true);
572
- snapCache.set(target, [version, snap]);
573
- Reflect.ownKeys(target).forEach((key) => {
574
- const value = Reflect.get(target, key);
575
- if (refSet.has(value)) {
576
- h(value, false);
577
- snap[key] = value;
578
- } else if (value instanceof Promise) {
579
- Object.defineProperty(snap, key, {
580
- get() {
581
- return handlePromise(value);
517
+ }
518
+ function deepMerge(source, ...objects) {
519
+ for (const obj of objects) {
520
+ const target = compact(obj);
521
+ for (const key in target) {
522
+ if (isObject2(obj[key])) {
523
+ if (!source[key]) {
524
+ source[key] = {};
582
525
  }
583
- });
584
- } else if (proxyStateMap.has(value)) {
585
- snap[key] = snapshot(value, handlePromise);
586
- } else {
587
- snap[key] = value;
526
+ deepMerge(source[key], obj[key]);
527
+ } else {
528
+ source[key] = obj[key];
529
+ }
588
530
  }
589
- });
590
- return Object.freeze(snap);
591
- }, proxyCache = /* @__PURE__ */ new WeakMap(), versionHolder = [1, 1], proxyFunction2 = (initialObject) => {
592
- if (!isObject(initialObject)) {
593
- throw new Error("object required");
594
- }
595
- const found = proxyCache.get(initialObject);
596
- if (found) {
597
- return found;
598
531
  }
599
- let version = versionHolder[0];
600
- const listeners = /* @__PURE__ */ new Set();
601
- const notifyUpdate = (op, nextVersion = ++versionHolder[0]) => {
602
- if (version !== nextVersion) {
603
- version = nextVersion;
604
- listeners.forEach((listener) => listener(op, nextVersion));
532
+ return source;
533
+ }
534
+ function structuredClone(v) {
535
+ return klona(v);
536
+ }
537
+ function toEvent(event) {
538
+ const obj = isString(event) ? { type: event } : event;
539
+ return obj;
540
+ }
541
+ function toArray(value) {
542
+ if (!value)
543
+ return [];
544
+ return isArray(value) ? value.slice() : [value];
545
+ }
546
+ function isGuardHelper(value) {
547
+ return isObject2(value) && value.predicate != null;
548
+ }
549
+ var Truthy = () => true;
550
+ function exec(guardMap, ctx, event, meta) {
551
+ return (guard) => {
552
+ if (isString(guard)) {
553
+ return !!guardMap[guard]?.(ctx, event, meta);
605
554
  }
606
- };
607
- let checkVersion = versionHolder[1];
608
- const ensureVersion = (nextCheckVersion = ++versionHolder[1]) => {
609
- if (checkVersion !== nextCheckVersion && !listeners.size) {
610
- checkVersion = nextCheckVersion;
611
- propProxyStates.forEach(([propProxyState]) => {
612
- const propVersion = propProxyState[1](nextCheckVersion);
613
- if (propVersion > version) {
614
- version = propVersion;
615
- }
616
- });
555
+ if (isFunction(guard)) {
556
+ return guard(ctx, event, meta);
617
557
  }
618
- return version;
558
+ return guard.predicate(guardMap)(ctx, event, meta);
619
559
  };
620
- const createPropListener = (prop) => (op, nextVersion) => {
621
- const newOp = [...op];
622
- newOp[1] = [prop, ...newOp[1]];
623
- notifyUpdate(newOp, nextVersion);
560
+ }
561
+ function or(...conditions) {
562
+ return {
563
+ predicate: (guardMap) => (ctx, event, meta) => conditions.map(exec(guardMap, ctx, event, meta)).some(Boolean)
624
564
  };
625
- const propProxyStates = /* @__PURE__ */ new Map();
626
- const addPropListener = (prop, propProxyState) => {
627
- if (isDev && propProxyStates.has(prop)) {
628
- throw new Error("prop listener already exists");
629
- }
630
- if (listeners.size) {
631
- const remove = propProxyState[3](createPropListener(prop));
632
- propProxyStates.set(prop, [propProxyState, remove]);
633
- } else {
634
- propProxyStates.set(prop, [propProxyState]);
635
- }
565
+ }
566
+ function and(...conditions) {
567
+ return {
568
+ predicate: (guardMap) => (ctx, event, meta) => conditions.map(exec(guardMap, ctx, event, meta)).every(Boolean)
636
569
  };
637
- const removePropListener = (prop) => {
638
- const entry = propProxyStates.get(prop);
639
- if (entry) {
640
- propProxyStates.delete(prop);
641
- entry[1]?.();
570
+ }
571
+ function not(condition) {
572
+ return {
573
+ predicate: (guardMap) => (ctx, event, meta) => {
574
+ return !exec(guardMap, ctx, event, meta)(condition);
642
575
  }
643
576
  };
644
- const addListener = (listener) => {
645
- listeners.add(listener);
646
- if (listeners.size === 1) {
647
- propProxyStates.forEach(([propProxyState, prevRemove], prop) => {
648
- if (isDev && prevRemove) {
649
- throw new Error("remove already exists");
650
- }
651
- const remove = propProxyState[3](createPropListener(prop));
652
- propProxyStates.set(prop, [propProxyState, remove]);
653
- });
577
+ }
578
+ function stateIn(...values) {
579
+ return (_ctx, _evt, meta) => meta.state.matches(...values);
580
+ }
581
+ var guards = { or, and, not, stateIn };
582
+ function determineGuardFn(guard, guardMap) {
583
+ guard = guard ?? Truthy;
584
+ return (context, event, meta) => {
585
+ if (isString(guard)) {
586
+ const value = guardMap[guard];
587
+ return isFunction(value) ? value(context, event, meta) : value;
654
588
  }
655
- const removeListener = () => {
656
- listeners.delete(listener);
657
- if (listeners.size === 0) {
658
- propProxyStates.forEach(([propProxyState, remove], prop) => {
659
- if (remove) {
660
- remove();
661
- propProxyStates.set(prop, [propProxyState]);
662
- }
663
- });
664
- }
665
- };
666
- return removeListener;
589
+ if (isGuardHelper(guard)) {
590
+ return guard.predicate(guardMap)(context, event, meta);
591
+ }
592
+ return guard?.(context, event, meta);
667
593
  };
668
- const baseObject = Array.isArray(initialObject) ? [] : Object.create(Object.getPrototypeOf(initialObject));
669
- const handler = {
670
- deleteProperty(target, prop) {
671
- const prevValue = Reflect.get(target, prop);
672
- removePropListener(prop);
673
- const deleted = Reflect.deleteProperty(target, prop);
674
- if (deleted) {
675
- notifyUpdate(["delete", [prop], prevValue]);
676
- }
677
- return deleted;
678
- },
679
- set(target, prop, value, receiver) {
680
- const hasPrevValue = Reflect.has(target, prop);
681
- const prevValue = Reflect.get(target, prop, receiver);
682
- if (hasPrevValue && (objectIs(prevValue, value) || proxyCache.has(value) && objectIs(prevValue, proxyCache.get(value)))) {
683
- return true;
684
- }
685
- removePropListener(prop);
686
- if (isObject(value)) {
687
- value = y(value) || value;
688
- }
689
- let nextValue = value;
690
- if (Object.getOwnPropertyDescriptor(target, prop)?.set) {
691
- } else if (value instanceof Promise) {
692
- value.then((v) => {
693
- value.status = "fulfilled";
694
- value.value = v;
695
- notifyUpdate(["resolve", [prop], v]);
696
- }).catch((e2) => {
697
- value.status = "rejected";
698
- value.reason = e2;
699
- notifyUpdate(["reject", [prop], e2]);
700
- });
701
- } else {
702
- if (!proxyStateMap.has(value) && canProxy(value)) {
703
- nextValue = proxy(value);
704
- }
705
- const childProxyState = !refSet.has(nextValue) && proxyStateMap.get(nextValue);
706
- if (childProxyState) {
707
- addPropListener(prop, childProxyState);
708
- }
709
- }
710
- Reflect.set(target, prop, nextValue, receiver);
711
- notifyUpdate(["set", [prop], value, prevValue]);
712
- return true;
594
+ }
595
+ function determineActionsFn(values, guardMap) {
596
+ return (context, event, meta) => {
597
+ if (isGuardHelper(values)) {
598
+ return values.predicate(guardMap)(context, event, meta);
713
599
  }
600
+ return values;
714
601
  };
715
- const proxyObject = newProxy(baseObject, handler);
716
- proxyCache.set(initialObject, proxyObject);
717
- const proxyState = [baseObject, ensureVersion, createSnapshot, addListener];
718
- proxyStateMap.set(proxyObject, proxyState);
719
- Reflect.ownKeys(initialObject).forEach((key) => {
720
- const desc = Object.getOwnPropertyDescriptor(initialObject, key);
721
- if (desc.get || desc.set) {
722
- Object.defineProperty(baseObject, key, desc);
723
- } else {
724
- proxyObject[key] = initialObject[key];
602
+ }
603
+ function createProxy(config) {
604
+ const computedContext = config.computed ?? cast({});
605
+ const initialContext = config.context ?? cast({});
606
+ const state = proxy({
607
+ value: config.initial ?? "",
608
+ previousValue: "",
609
+ event: cast({}),
610
+ previousEvent: cast({}),
611
+ context: proxyWithComputed(initialContext, computedContext),
612
+ done: false,
613
+ tags: [],
614
+ hasTag(tag) {
615
+ return this.tags.includes(tag);
616
+ },
617
+ matches(...value) {
618
+ return value.includes(this.value);
619
+ },
620
+ can(event) {
621
+ return cast(this).nextEvents.includes(event);
622
+ },
623
+ get nextEvents() {
624
+ const stateEvents = config.states?.[this.value]?.["on"] ?? {};
625
+ const globalEvents = config?.on ?? {};
626
+ return Object.keys({ ...stateEvents, ...globalEvents });
627
+ },
628
+ get changed() {
629
+ if (this.event.value === "machine.init" || !this.previousValue)
630
+ return false;
631
+ return this.value !== this.previousValue;
725
632
  }
726
633
  });
727
- return proxyObject;
728
- }) => [
729
- // public functions
730
- proxyFunction2,
731
- // shared state
732
- proxyStateMap,
733
- refSet,
734
- // internal things
735
- objectIs,
736
- newProxy,
737
- canProxy,
738
- defaultHandlePromise,
739
- snapCache,
740
- createSnapshot,
741
- proxyCache,
742
- versionHolder
743
- ];
744
- var [proxyFunction] = buildProxyFunction();
745
- function proxy(initialObject = {}) {
746
- return proxyFunction(initialObject);
634
+ return cast(state);
747
635
  }
748
- function subscribe(proxyObject, callback, notifyInSync) {
749
- const proxyState = proxyStateMap.get(proxyObject);
750
- if (isDev && !proxyState) {
751
- console.warn("Please use proxy object");
752
- }
753
- let promise;
754
- const ops = [];
755
- const addListener = proxyState[3];
756
- let isListenerActive = false;
757
- const listener = (op) => {
758
- ops.push(op);
759
- if (notifyInSync) {
760
- callback(ops.splice(0));
761
- return;
636
+ function determineDelayFn(delay, delaysMap) {
637
+ return (context, event) => {
638
+ if (isNumber(delay))
639
+ return delay;
640
+ if (isFunction(delay)) {
641
+ return delay(context, event);
762
642
  }
763
- if (!promise) {
764
- promise = Promise.resolve().then(() => {
765
- promise = void 0;
766
- if (isListenerActive) {
767
- callback(ops.splice(0));
768
- }
769
- });
643
+ if (isString(delay)) {
644
+ const value = Number.parseFloat(delay);
645
+ if (!Number.isNaN(value)) {
646
+ return value;
647
+ }
648
+ if (delaysMap) {
649
+ const valueOrFn = delaysMap?.[delay];
650
+ invariant(
651
+ valueOrFn == null,
652
+ `[@zag-js/core > determine-delay] Cannot determine delay for \`${delay}\`. It doesn't exist in \`options.delays\``
653
+ );
654
+ return isFunction(valueOrFn) ? valueOrFn(context, event) : valueOrFn;
655
+ }
770
656
  }
771
657
  };
772
- const removeListener = addListener(listener);
773
- isListenerActive = true;
774
- return () => {
775
- isListenerActive = false;
776
- removeListener();
777
- };
778
- }
779
- function snapshot(proxyObject, handlePromise) {
780
- const proxyState = proxyStateMap.get(proxyObject);
781
- if (isDev && !proxyState) {
782
- console.warn("Please use proxy object");
783
- }
784
- const [target, ensureVersion, createSnapshot] = proxyState;
785
- return createSnapshot(target, ensureVersion(), handlePromise);
786
- }
787
- function ref(obj) {
788
- refSet.add(obj);
789
- return obj;
790
658
  }
791
- function proxyWithComputed(initialObject, computedFns) {
792
- const keys = Object.keys(computedFns);
793
- keys.forEach((key) => {
794
- if (Object.getOwnPropertyDescriptor(initialObject, key)) {
795
- throw new Error("object property already defined");
796
- }
797
- const computedFn = computedFns[key];
798
- const { get, set: set2 } = typeof computedFn === "function" ? { get: computedFn } : computedFn;
799
- const desc = {};
800
- desc.get = () => get(snapshot(proxyObject));
801
- if (set2) {
802
- desc.set = (newValue) => set2(proxyObject, newValue);
803
- }
804
- Object.defineProperty(initialObject, key, desc);
805
- });
806
- const proxyObject = proxy(initialObject);
807
- return proxyObject;
659
+ function toTarget(target) {
660
+ return isString(target) ? { target } : target;
808
661
  }
809
- var defaultCompareFn = (prev, next) => Object.is(prev, next);
810
- function subscribeKey(obj, key, fn, sync, compareFn) {
811
- let prev = Reflect.get(snapshot(obj), key);
812
- const isEqual = compareFn || defaultCompareFn;
813
- function onSnapshotChange() {
814
- const snap = snapshot(obj);
815
- if (isEqual(prev, snap[key]))
816
- return;
817
- fn(snap[key]);
818
- prev = Reflect.get(snap, key);
819
- }
820
- return subscribe(obj, onSnapshotChange, sync);
821
- }
822
-
823
- // ../../node_modules/.pnpm/klona@2.0.6/node_modules/klona/full/index.mjs
824
- function set(obj, key, val) {
825
- if (typeof val.value === "object")
826
- val.value = klona(val.value);
827
- if (!val.enumerable || val.get || val.set || !val.configurable || !val.writable || key === "__proto__") {
828
- Object.defineProperty(obj, key, val);
829
- } else
830
- obj[key] = val.value;
831
- }
832
- function klona(x) {
833
- if (typeof x !== "object")
834
- return x;
835
- var i2 = 0, k, list, tmp, str = Object.prototype.toString.call(x);
836
- if (str === "[object Object]") {
837
- tmp = Object.create(x.__proto__ || null);
838
- } else if (str === "[object Array]") {
839
- tmp = Array(x.length);
840
- } else if (str === "[object Set]") {
841
- tmp = /* @__PURE__ */ new Set();
842
- x.forEach(function(val) {
843
- tmp.add(klona(val));
844
- });
845
- } else if (str === "[object Map]") {
846
- tmp = /* @__PURE__ */ new Map();
847
- x.forEach(function(val, key) {
848
- tmp.set(klona(key), klona(val));
849
- });
850
- } else if (str === "[object Date]") {
851
- tmp = /* @__PURE__ */ new Date(+x);
852
- } else if (str === "[object RegExp]") {
853
- tmp = new RegExp(x.source, x.flags);
854
- } else if (str === "[object DataView]") {
855
- tmp = new x.constructor(klona(x.buffer));
856
- } else if (str === "[object ArrayBuffer]") {
857
- tmp = x.slice(0);
858
- } else if (str.slice(-6) === "Array]") {
859
- tmp = new x.constructor(x);
860
- }
861
- if (tmp) {
862
- for (list = Object.getOwnPropertySymbols(x); i2 < list.length; i2++) {
863
- set(tmp, list[i2], Object.getOwnPropertyDescriptor(x, list[i2]));
864
- }
865
- for (i2 = 0, list = Object.getOwnPropertyNames(x); i2 < list.length; i2++) {
866
- if (Object.hasOwnProperty.call(tmp, k = list[i2]) && tmp[k] === x[k])
867
- continue;
868
- set(tmp, k, Object.getOwnPropertyDescriptor(x, k));
869
- }
870
- }
871
- return tmp || x;
872
- }
873
-
874
- // ../../node_modules/.pnpm/@zag-js+core@0.19.1/node_modules/@zag-js/core/dist/index.mjs
875
- var __defProp2 = Object.defineProperty;
876
- var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
877
- var __publicField = (obj, key, value) => {
878
- __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
879
- return value;
880
- };
881
- function clear(v) {
882
- while (v.length > 0)
883
- v.pop();
884
- return v;
885
- }
886
- var runIfFn = (v, ...a2) => {
887
- const res = typeof v === "function" ? v(...a2) : v;
888
- return res ?? void 0;
889
- };
890
- var cast = (v) => v;
891
- var noop = () => {
892
- };
893
- var uuid = /* @__PURE__ */ (() => {
894
- let id = 0;
895
- return () => {
896
- id++;
897
- return id.toString(36);
898
- };
899
- })();
900
- var isDev2 = () => process.env.NODE_ENV !== "production";
901
- var isArray = (v) => Array.isArray(v);
902
- var isObject2 = (v) => !(v == null || typeof v !== "object" || isArray(v));
903
- var isNumber = (v) => typeof v === "number" && !Number.isNaN(v);
904
- var isString = (v) => typeof v === "string";
905
- var isFunction = (v) => typeof v === "function";
906
- function compact2(obj) {
907
- if (!isPlainObject2(obj) || obj === void 0) {
908
- return obj;
909
- }
910
- const keys = Reflect.ownKeys(obj).filter((key) => typeof key === "string");
911
- const filtered = {};
912
- for (const key of keys) {
913
- const value = obj[key];
914
- if (value !== void 0) {
915
- filtered[key] = compact2(value);
916
- }
917
- }
918
- return filtered;
919
- }
920
- var isPlainObject2 = (value) => {
921
- return value && typeof value === "object" && value.constructor === Object;
922
- };
923
- function warn(...a2) {
924
- const m = a2.length === 1 ? a2[0] : a2[1];
925
- const c2 = a2.length === 2 ? a2[0] : true;
926
- if (c2 && process.env.NODE_ENV !== "production") {
927
- console.warn(m);
928
- }
929
- }
930
- function invariant(...a2) {
931
- const m = a2.length === 1 ? a2[0] : a2[1];
932
- const c2 = a2.length === 2 ? a2[0] : true;
933
- if (c2 && process.env.NODE_ENV !== "production") {
934
- throw new Error(m);
935
- }
936
- }
937
- function deepMerge(source, ...objects) {
938
- for (const obj of objects) {
939
- const target = compact2(obj);
940
- for (const key in target) {
941
- if (isObject2(obj[key])) {
942
- if (!source[key]) {
943
- source[key] = {};
944
- }
945
- deepMerge(source[key], obj[key]);
946
- } else {
947
- source[key] = obj[key];
948
- }
949
- }
950
- }
951
- return source;
952
- }
953
- function structuredClone(v) {
954
- return klona(v);
955
- }
956
- function toEvent(event) {
957
- const obj = isString(event) ? { type: event } : event;
958
- return obj;
959
- }
960
- function toArray(value) {
961
- if (!value)
962
- return [];
963
- return isArray(value) ? value.slice() : [value];
964
- }
965
- function isGuardHelper(value) {
966
- return isObject2(value) && value.predicate != null;
967
- }
968
- var Truthy = () => true;
969
- function exec(guardMap, ctx, event, meta) {
970
- return (guard) => {
971
- if (isString(guard)) {
972
- return !!guardMap[guard]?.(ctx, event, meta);
973
- }
974
- if (isFunction(guard)) {
975
- return guard(ctx, event, meta);
976
- }
977
- return guard.predicate(guardMap)(ctx, event, meta);
978
- };
979
- }
980
- function or(...conditions) {
981
- return {
982
- predicate: (guardMap) => (ctx, event, meta) => conditions.map(exec(guardMap, ctx, event, meta)).some(Boolean)
983
- };
984
- }
985
- function and(...conditions) {
986
- return {
987
- predicate: (guardMap) => (ctx, event, meta) => conditions.map(exec(guardMap, ctx, event, meta)).every(Boolean)
988
- };
989
- }
990
- function not(condition) {
991
- return {
992
- predicate: (guardMap) => (ctx, event, meta) => {
993
- return !exec(guardMap, ctx, event, meta)(condition);
994
- }
995
- };
996
- }
997
- function stateIn(...values) {
998
- return (_ctx, _evt, meta) => meta.state.matches(...values);
999
- }
1000
- var guards = { or, and, not, stateIn };
1001
- function determineGuardFn(guard, guardMap) {
1002
- guard = guard ?? Truthy;
1003
- return (context, event, meta) => {
1004
- if (isString(guard)) {
1005
- const value = guardMap[guard];
1006
- return isFunction(value) ? value(context, event, meta) : value;
1007
- }
1008
- if (isGuardHelper(guard)) {
1009
- return guard.predicate(guardMap)(context, event, meta);
1010
- }
1011
- return guard?.(context, event, meta);
1012
- };
1013
- }
1014
- function determineActionsFn(values, guardMap) {
1015
- return (context, event, meta) => {
1016
- if (isGuardHelper(values)) {
1017
- return values.predicate(guardMap)(context, event, meta);
1018
- }
1019
- return values;
1020
- };
1021
- }
1022
- function createProxy(config) {
1023
- const computedContext = config.computed ?? cast({});
1024
- const initialContext = config.context ?? cast({});
1025
- const state = proxy({
1026
- value: config.initial ?? "",
1027
- previousValue: "",
1028
- event: cast({}),
1029
- previousEvent: cast({}),
1030
- context: proxyWithComputed(initialContext, computedContext),
1031
- done: false,
1032
- tags: [],
1033
- hasTag(tag) {
1034
- return this.tags.includes(tag);
1035
- },
1036
- matches(...value) {
1037
- return value.includes(this.value);
1038
- },
1039
- can(event) {
1040
- return cast(this).nextEvents.includes(event);
1041
- },
1042
- get nextEvents() {
1043
- const stateEvents = config.states?.[this.value]?.["on"] ?? {};
1044
- const globalEvents = config?.on ?? {};
1045
- return Object.keys({ ...stateEvents, ...globalEvents });
1046
- },
1047
- get changed() {
1048
- if (this.event.value === "machine.init" || !this.previousValue)
1049
- return false;
1050
- return this.value !== this.previousValue;
1051
- }
1052
- });
1053
- return cast(state);
1054
- }
1055
- function determineDelayFn(delay, delaysMap) {
1056
- return (context, event) => {
1057
- if (isNumber(delay))
1058
- return delay;
1059
- if (isFunction(delay)) {
1060
- return delay(context, event);
1061
- }
1062
- if (isString(delay)) {
1063
- const value = Number.parseFloat(delay);
1064
- if (!Number.isNaN(value)) {
1065
- return value;
1066
- }
1067
- if (delaysMap) {
1068
- const valueOrFn = delaysMap?.[delay];
1069
- invariant(
1070
- valueOrFn == null,
1071
- `[@zag-js/core > determine-delay] Cannot determine delay for \`${delay}\`. It doesn't exist in \`options.delays\``
1072
- );
1073
- return isFunction(valueOrFn) ? valueOrFn(context, event) : valueOrFn;
1074
- }
1075
- }
1076
- };
1077
- }
1078
- function toTarget(target) {
1079
- return isString(target) ? { target } : target;
1080
- }
1081
- function determineTransitionFn(transitions, guardMap) {
1082
- return (context, event, meta) => {
1083
- return toArray(transitions).map(toTarget).find((transition) => {
1084
- const determineGuard = determineGuardFn(transition.guard, guardMap);
1085
- const guard = determineGuard(context, event, meta);
1086
- return guard ?? transition.target ?? transition.actions;
1087
- });
1088
- };
662
+ function determineTransitionFn(transitions, guardMap) {
663
+ return (context, event, meta) => {
664
+ return toArray(transitions).map(toTarget).find((transition) => {
665
+ const determineGuard = determineGuardFn(transition.guard, guardMap);
666
+ const guard = determineGuard(context, event, meta);
667
+ return guard ?? transition.target ?? transition.actions;
668
+ });
669
+ };
1089
670
  }
1090
671
  var Machine = class _Machine {
1091
672
  // Let's get started!
@@ -1343,11 +924,11 @@ var Machine = class _Machine {
1343
924
  });
1344
925
  __publicField(this, "withContext", (context) => {
1345
926
  const transformed = this.transformContext(context);
1346
- const newContext = { ...this.config.context, ...compact2(transformed) };
927
+ const newContext = { ...this.config.context, ...compact(transformed) };
1347
928
  return new _Machine({ ...this.config, context: newContext }, this.options);
1348
929
  });
1349
930
  __publicField(this, "setOptions", (options2) => {
1350
- const opts = compact2(options2);
931
+ const opts = compact(options2);
1351
932
  this.actionMap = { ...this.actionMap, ...opts.actions };
1352
933
  this.delayMap = { ...this.delayMap, ...opts.delays };
1353
934
  this.activityMap = { ...this.activityMap, ...opts.activities };
@@ -1575,750 +1156,750 @@ var Machine = class _Machine {
1575
1156
  if (!this.parent) {
1576
1157
  invariant("[@zag-js/core > send-parent] Cannot send event to an unknown parent");
1577
1158
  }
1578
- const event2 = toEvent(evt);
1579
- this.parent?.send(event2);
1580
- });
1581
- __publicField(this, "log", (...args) => {
1582
- if (isDev2() && this.options.debug) {
1583
- console.log(...args);
1159
+ const event2 = toEvent(evt);
1160
+ this.parent?.send(event2);
1161
+ });
1162
+ __publicField(this, "log", (...args) => {
1163
+ if (isDev2() && this.options.debug) {
1164
+ console.log(...args);
1165
+ }
1166
+ });
1167
+ __publicField(this, "send", (evt) => {
1168
+ const event2 = toEvent(evt);
1169
+ this.transition(this.state.value, event2);
1170
+ });
1171
+ __publicField(this, "transition", (state, evt) => {
1172
+ const stateNode = isString(state) ? this.getStateNode(state) : state?.stateNode;
1173
+ const event2 = toEvent(evt);
1174
+ if (!stateNode && !this.config.on) {
1175
+ const msg = this.status === "Stopped" ? "[@zag-js/core > transition] Cannot transition a stopped machine" : `[@zag-js/core > transition] State does not have a definition for \`state\`: ${state}, \`event\`: ${event2.type}`;
1176
+ warn(msg);
1177
+ return;
1178
+ }
1179
+ const transitions = stateNode?.on?.[event2.type] ?? this.config.on?.[event2.type];
1180
+ const next = this.getNextStateInfo(transitions, event2);
1181
+ this.performStateChangeEffects(this.state.value, next, event2);
1182
+ return next.stateNode;
1183
+ });
1184
+ __publicField(this, "subscribe", (listener) => {
1185
+ this.stateListeners.add(listener);
1186
+ if (this.status === "Running") {
1187
+ listener(this.stateSnapshot);
1188
+ }
1189
+ return () => {
1190
+ this.stateListeners.delete(listener);
1191
+ };
1192
+ });
1193
+ __publicField(this, "onDone", (listener) => {
1194
+ this.doneListeners.add(listener);
1195
+ return this;
1196
+ });
1197
+ __publicField(this, "onTransition", (listener) => {
1198
+ this.stateListeners.add(listener);
1199
+ if (this.status === "Running") {
1200
+ listener(this.stateSnapshot);
1201
+ }
1202
+ return this;
1203
+ });
1204
+ __publicField(this, "onChange", (listener) => {
1205
+ this.contextListeners.add(listener);
1206
+ return this;
1207
+ });
1208
+ __publicField(this, "onEvent", (listener) => {
1209
+ this.eventListeners.add(listener);
1210
+ return this;
1211
+ });
1212
+ this.config = structuredClone(config);
1213
+ this.options = structuredClone(options ?? {});
1214
+ this.id = this.config.id ?? `machine-${uuid()}`;
1215
+ this.guardMap = this.options?.guards ?? {};
1216
+ this.actionMap = this.options?.actions ?? {};
1217
+ this.delayMap = this.options?.delays ?? {};
1218
+ this.activityMap = this.options?.activities ?? {};
1219
+ this.sync = this.options?.sync ?? false;
1220
+ this.state = createProxy(this.config);
1221
+ this.initialContext = snapshot(this.state.context);
1222
+ this.transformContext(this.state.context);
1223
+ const event = toEvent(
1224
+ "machine.created"
1225
+ /* Created */
1226
+ );
1227
+ this.executeActions(this.config?.created, event);
1228
+ }
1229
+ // immutable state value
1230
+ get stateSnapshot() {
1231
+ return cast(snapshot(this.state));
1232
+ }
1233
+ getState() {
1234
+ return this.stateSnapshot;
1235
+ }
1236
+ // immutable context value
1237
+ get contextSnapshot() {
1238
+ return this.stateSnapshot.context;
1239
+ }
1240
+ /**
1241
+ * A reference to the instance methods of the machine.
1242
+ * Useful when spawning child machines and managing the communication between them.
1243
+ */
1244
+ get self() {
1245
+ const self = this;
1246
+ return {
1247
+ id: this.id,
1248
+ send: this.send.bind(this),
1249
+ sendParent: this.sendParent.bind(this),
1250
+ sendChild: this.sendChild.bind(this),
1251
+ stop: this.stop.bind(this),
1252
+ stopChild: this.stopChild.bind(this),
1253
+ spawn: this.spawn.bind(this),
1254
+ stopActivity: this.stopActivity.bind(this),
1255
+ get state() {
1256
+ return self.stateSnapshot;
1257
+ },
1258
+ get initialContext() {
1259
+ return self.initialContext;
1260
+ },
1261
+ get initialState() {
1262
+ return self.initialState?.target ?? "";
1263
+ }
1264
+ };
1265
+ }
1266
+ get meta() {
1267
+ return {
1268
+ state: this.stateSnapshot,
1269
+ guards: this.guardMap,
1270
+ send: this.send.bind(this),
1271
+ self: this.self,
1272
+ initialContext: this.initialContext,
1273
+ initialState: this.initialState?.target ?? "",
1274
+ getState: () => this.stateSnapshot,
1275
+ getAction: (key) => this.actionMap[key],
1276
+ getGuard: (key) => this.guardMap[key]
1277
+ };
1278
+ }
1279
+ get guardMeta() {
1280
+ return {
1281
+ state: this.stateSnapshot
1282
+ };
1283
+ }
1284
+ get [Symbol.toStringTag]() {
1285
+ return "Machine";
1286
+ }
1287
+ };
1288
+ var createMachine = (config, options) => new Machine(config, options);
1289
+
1290
+ // ../../node_modules/.pnpm/@zag-js+types@0.19.1/node_modules/@zag-js/types/dist/index.mjs
1291
+ function createNormalizer(fn) {
1292
+ return new Proxy({}, {
1293
+ get() {
1294
+ return fn;
1295
+ }
1296
+ });
1297
+ }
1298
+
1299
+ // ../../node_modules/.pnpm/@zag-js+react@0.19.1_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/@zag-js/react/dist/index.mjs
1300
+ import { createElement, useReducer, useRef } from "react";
1301
+ import { createPortal } from "react-dom";
1302
+ import { useEffect, useLayoutEffect } from "react";
1303
+ import ReactExports, { useCallback, useEffect as useEffect2, useMemo, useRef as useRef2, useSyncExternalStore } from "react";
1304
+ import { useRef as useRef3 } from "react";
1305
+ var normalizeProps = createNormalizer((v) => v);
1306
+ var useSafeLayoutEffect = typeof document !== "undefined" ? useLayoutEffect : useEffect;
1307
+ function Portal(props) {
1308
+ const { children, target } = props;
1309
+ const node = useRef(null);
1310
+ const portalNode = useRef(null);
1311
+ const [, forceUpdate] = useReducer((s2) => s2 + 1, 0);
1312
+ useSafeLayoutEffect(() => {
1313
+ if (!node.current)
1314
+ return;
1315
+ const doc = node.current.ownerDocument;
1316
+ portalNode.current = doc.createElement("zag-portal");
1317
+ doc.body.appendChild(portalNode.current);
1318
+ forceUpdate();
1319
+ return () => {
1320
+ if (portalNode.current) {
1321
+ doc.body.removeChild(portalNode.current);
1322
+ }
1323
+ };
1324
+ }, []);
1325
+ const targetNode = target?.current ?? portalNode.current;
1326
+ if (targetNode) {
1327
+ return createPortal(children, targetNode);
1328
+ }
1329
+ return createElement("span", { ref: node });
1330
+ }
1331
+ var { use } = ReactExports;
1332
+ var targetCache = /* @__PURE__ */ new WeakMap();
1333
+ function useSnapshot(proxyObject, options) {
1334
+ const notifyInSync = options?.sync;
1335
+ const lastSnapshot = useRef2();
1336
+ const lastAffected = useRef2();
1337
+ const currSnapshot = useSyncExternalStore(
1338
+ useCallback(
1339
+ (callback) => {
1340
+ const unsub = subscribe(proxyObject, callback, notifyInSync);
1341
+ callback();
1342
+ return unsub;
1343
+ },
1344
+ [proxyObject, notifyInSync]
1345
+ ),
1346
+ () => {
1347
+ const nextSnapshot = snapshot(proxyObject, use);
1348
+ try {
1349
+ if (lastSnapshot.current && lastAffected.current && !p(lastSnapshot.current, nextSnapshot, lastAffected.current, /* @__PURE__ */ new WeakMap())) {
1350
+ return lastSnapshot.current;
1351
+ }
1352
+ } catch (e2) {
1353
+ }
1354
+ return nextSnapshot;
1355
+ },
1356
+ () => snapshot(proxyObject, use)
1357
+ );
1358
+ const currAffected = /* @__PURE__ */ new WeakMap();
1359
+ useEffect2(() => {
1360
+ lastSnapshot.current = currSnapshot;
1361
+ lastAffected.current = currAffected;
1362
+ });
1363
+ const proxyCache = useMemo(() => /* @__PURE__ */ new WeakMap(), []);
1364
+ return a(currSnapshot, currAffected, proxyCache, targetCache);
1365
+ }
1366
+ function useConstant(fn) {
1367
+ const ref2 = useRef3();
1368
+ if (!ref2.current)
1369
+ ref2.current = { v: fn() };
1370
+ return ref2.current.v;
1371
+ }
1372
+ function useService(machine, options) {
1373
+ const { actions, state: hydratedState, context } = options ?? {};
1374
+ const service = useConstant(() => {
1375
+ const instance = typeof machine === "function" ? machine() : machine;
1376
+ return context ? instance.withContext(context) : instance;
1377
+ });
1378
+ useSafeLayoutEffect(() => {
1379
+ service.start(hydratedState);
1380
+ if (service.state.can("SETUP")) {
1381
+ service.send("SETUP");
1382
+ }
1383
+ return () => {
1384
+ service.stop();
1385
+ };
1386
+ }, []);
1387
+ service.setOptions({ actions });
1388
+ service.setContext(context);
1389
+ return service;
1390
+ }
1391
+ function useMachine(machine, options) {
1392
+ const service = useService(machine, options);
1393
+ const state = useSnapshot(service.state);
1394
+ const typedState = state;
1395
+ return [typedState, service.send, service];
1396
+ }
1397
+
1398
+ // ../../node_modules/.pnpm/@zag-js+anatomy@0.19.1/node_modules/@zag-js/anatomy/dist/index.mjs
1399
+ var createAnatomy = (name, parts = []) => ({
1400
+ parts: (...values) => {
1401
+ if (isEmpty(parts)) {
1402
+ return createAnatomy(name, values);
1403
+ }
1404
+ throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?");
1405
+ },
1406
+ extendWith: (...values) => createAnatomy(name, [...parts, ...values]),
1407
+ rename: (newName) => createAnatomy(newName, parts),
1408
+ keys: () => parts,
1409
+ build: () => [...new Set(parts)].reduce(
1410
+ (prev, part) => Object.assign(prev, {
1411
+ [part]: {
1412
+ selector: [
1413
+ `&[data-scope="${toKebabCase(name)}"][data-part="${toKebabCase(part)}"]`,
1414
+ `& [data-scope="${toKebabCase(name)}"][data-part="${toKebabCase(part)}"]`
1415
+ ].join(", "),
1416
+ attrs: { "data-scope": toKebabCase(name), "data-part": toKebabCase(part) }
1584
1417
  }
1585
- });
1586
- __publicField(this, "send", (evt) => {
1587
- const event2 = toEvent(evt);
1588
- this.transition(this.state.value, event2);
1589
- });
1590
- __publicField(this, "transition", (state, evt) => {
1591
- const stateNode = isString(state) ? this.getStateNode(state) : state?.stateNode;
1592
- const event2 = toEvent(evt);
1593
- if (!stateNode && !this.config.on) {
1594
- const msg = this.status === "Stopped" ? "[@zag-js/core > transition] Cannot transition a stopped machine" : `[@zag-js/core > transition] State does not have a definition for \`state\`: ${state}, \`event\`: ${event2.type}`;
1595
- warn(msg);
1418
+ }),
1419
+ {}
1420
+ )
1421
+ });
1422
+ var toKebabCase = (value) => value.replace(/([A-Z])([A-Z])/g, "$1-$2").replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
1423
+ var isEmpty = (v) => v.length === 0;
1424
+
1425
+ // ../../node_modules/.pnpm/@zag-js+dom-query@0.19.1/node_modules/@zag-js/dom-query/dist/index.mjs
1426
+ var dataAttr = (guard) => {
1427
+ return guard ? "" : void 0;
1428
+ };
1429
+ function isHTMLElement(value) {
1430
+ return typeof value === "object" && value?.nodeType === Node.ELEMENT_NODE && typeof value?.nodeName === "string";
1431
+ }
1432
+ function contains(parent, child) {
1433
+ if (!parent || !child)
1434
+ return false;
1435
+ if (!isHTMLElement(parent) || !isHTMLElement(child))
1436
+ return false;
1437
+ return parent === child || parent.contains(child);
1438
+ }
1439
+ var getDocument = (node) => {
1440
+ if (node.nodeType === Node.DOCUMENT_NODE)
1441
+ return node;
1442
+ return node.ownerDocument ?? document;
1443
+ };
1444
+ function createScope(methods) {
1445
+ const screen = {
1446
+ getRootNode: (ctx) => ctx.getRootNode?.() ?? document,
1447
+ getDoc: (ctx) => getDocument(screen.getRootNode(ctx)),
1448
+ getWin: (ctx) => screen.getDoc(ctx).defaultView ?? window,
1449
+ getActiveElement: (ctx) => screen.getDoc(ctx).activeElement,
1450
+ getById: (ctx, id) => screen.getRootNode(ctx).getElementById(id),
1451
+ setValue: (elem, value) => {
1452
+ if (elem == null || value == null)
1596
1453
  return;
1597
- }
1598
- const transitions = stateNode?.on?.[event2.type] ?? this.config.on?.[event2.type];
1599
- const next = this.getNextStateInfo(transitions, event2);
1600
- this.performStateChangeEffects(this.state.value, next, event2);
1601
- return next.stateNode;
1454
+ elem.value = value.toString();
1455
+ }
1456
+ };
1457
+ return { ...screen, ...methods };
1458
+ }
1459
+ var isDocument = (el) => el.nodeType === Node.DOCUMENT_NODE;
1460
+ function getDocument2(el) {
1461
+ if (isDocument(el))
1462
+ return el;
1463
+ return el?.ownerDocument ?? document;
1464
+ }
1465
+ function getWindow(el) {
1466
+ return el?.ownerDocument.defaultView ?? window;
1467
+ }
1468
+ function getEventTarget(event) {
1469
+ return event.composedPath?.()[0] ?? event.target;
1470
+ }
1471
+ function isScrollParent(el) {
1472
+ const win = el.ownerDocument.defaultView || window;
1473
+ const { overflow, overflowX, overflowY } = win.getComputedStyle(el);
1474
+ return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
1475
+ }
1476
+ function getParent(el) {
1477
+ if (el.localName === "html")
1478
+ return el;
1479
+ return el.assignedSlot || el.parentElement || el.ownerDocument.documentElement;
1480
+ }
1481
+ function getScrollParent(el) {
1482
+ if (["html", "body", "#document"].includes(el.localName)) {
1483
+ return el.ownerDocument.body;
1484
+ }
1485
+ if (isHTMLElement(el) && isScrollParent(el)) {
1486
+ return el;
1487
+ }
1488
+ return getScrollParent(getParent(el));
1489
+ }
1490
+ function getScrollParents(el, list = []) {
1491
+ const parent = getScrollParent(el);
1492
+ const isBody = parent === el.ownerDocument.body;
1493
+ const win = parent.ownerDocument.defaultView || window;
1494
+ const target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(parent) ? parent : []) : parent;
1495
+ const parents = list.concat(target);
1496
+ return isBody ? parents : parents.concat(getScrollParents(getParent(target)));
1497
+ }
1498
+ var isDom = () => typeof document !== "undefined";
1499
+ function getPlatform() {
1500
+ const agent = navigator.userAgentData;
1501
+ return agent?.platform ?? navigator.platform;
1502
+ }
1503
+ var pt = (v) => isDom() && v.test(getPlatform());
1504
+ var vn = (v) => isDom() && v.test(navigator.vendor);
1505
+ var isTouchDevice = () => isDom() && !!navigator.maxTouchPoints;
1506
+ var isMac = () => pt(/^Mac/) && !isTouchDevice();
1507
+ var isSafari = () => isApple() && vn(/apple/i);
1508
+ var isApple = () => pt(/mac|iphone|ipad|ipod/i);
1509
+ var isIos = () => isApple() && !isMac();
1510
+ function nextTick(fn) {
1511
+ const set2 = /* @__PURE__ */ new Set();
1512
+ function raf2(fn2) {
1513
+ const id = globalThis.requestAnimationFrame(fn2);
1514
+ set2.add(() => globalThis.cancelAnimationFrame(id));
1515
+ }
1516
+ raf2(() => raf2(fn));
1517
+ return function cleanup() {
1518
+ set2.forEach((fn2) => fn2());
1519
+ };
1520
+ }
1521
+ function raf(fn) {
1522
+ const id = globalThis.requestAnimationFrame(fn);
1523
+ return () => {
1524
+ globalThis.cancelAnimationFrame(id);
1525
+ };
1526
+ }
1527
+
1528
+ // ../../node_modules/.pnpm/@zag-js+utils@0.19.1/node_modules/@zag-js/utils/dist/index.mjs
1529
+ var runIfFn2 = (v, ...a2) => {
1530
+ const res = typeof v === "function" ? v(...a2) : v;
1531
+ return res ?? void 0;
1532
+ };
1533
+ var callAll = (...fns) => (...a2) => {
1534
+ fns.forEach(function(fn) {
1535
+ fn?.(...a2);
1536
+ });
1537
+ };
1538
+ function compact2(obj) {
1539
+ if (!isPlainObject2(obj) || obj === void 0) {
1540
+ return obj;
1541
+ }
1542
+ const keys = Reflect.ownKeys(obj).filter((key) => typeof key === "string");
1543
+ const filtered = {};
1544
+ for (const key of keys) {
1545
+ const value = obj[key];
1546
+ if (value !== void 0) {
1547
+ filtered[key] = compact2(value);
1548
+ }
1549
+ }
1550
+ return filtered;
1551
+ }
1552
+ var isPlainObject2 = (value) => {
1553
+ return value && typeof value === "object" && value.constructor === Object;
1554
+ };
1555
+ function warn2(...a2) {
1556
+ const m = a2.length === 1 ? a2[0] : a2[1];
1557
+ const c2 = a2.length === 2 ? a2[0] : true;
1558
+ if (c2 && process.env.NODE_ENV !== "production") {
1559
+ console.warn(m);
1560
+ }
1561
+ }
1562
+
1563
+ // ../../node_modules/.pnpm/@zag-js+element-rect@0.19.1/node_modules/@zag-js/element-rect/dist/index.mjs
1564
+ var rafId;
1565
+ var observedElements = /* @__PURE__ */ new Map();
1566
+ var getRectFn = (el) => el.getBoundingClientRect();
1567
+ function trackElementRect(el, options) {
1568
+ const { scope = "rect", getRect = getRectFn, onChange } = options;
1569
+ const loop = getLoopFn({ scope, getRect });
1570
+ const data = observedElements.get(el);
1571
+ if (!data) {
1572
+ observedElements.set(el, {
1573
+ rect: {},
1574
+ callbacks: [onChange]
1602
1575
  });
1603
- __publicField(this, "subscribe", (listener) => {
1604
- this.stateListeners.add(listener);
1605
- if (this.status === "Running") {
1606
- listener(this.stateSnapshot);
1576
+ if (observedElements.size === 1) {
1577
+ rafId = requestAnimationFrame(loop);
1578
+ }
1579
+ } else {
1580
+ data.callbacks.push(onChange);
1581
+ onChange(getRect(el));
1582
+ }
1583
+ return function unobserve() {
1584
+ const data2 = observedElements.get(el);
1585
+ if (!data2)
1586
+ return;
1587
+ const index = data2.callbacks.indexOf(onChange);
1588
+ if (index > -1) {
1589
+ data2.callbacks.splice(index, 1);
1590
+ }
1591
+ if (data2.callbacks.length === 0) {
1592
+ observedElements.delete(el);
1593
+ if (observedElements.size === 0) {
1594
+ cancelAnimationFrame(rafId);
1607
1595
  }
1608
- return () => {
1609
- this.stateListeners.delete(listener);
1610
- };
1611
- });
1612
- __publicField(this, "onDone", (listener) => {
1613
- this.doneListeners.add(listener);
1614
- return this;
1615
- });
1616
- __publicField(this, "onTransition", (listener) => {
1617
- this.stateListeners.add(listener);
1618
- if (this.status === "Running") {
1619
- listener(this.stateSnapshot);
1596
+ }
1597
+ };
1598
+ }
1599
+ function getLoopFn(options) {
1600
+ const { scope, getRect } = options;
1601
+ const isEqual = getEqualityFn(scope);
1602
+ return function loop() {
1603
+ const changedRectsData = [];
1604
+ observedElements.forEach((data, element) => {
1605
+ const newRect = getRect(element);
1606
+ if (!isEqual(data.rect, newRect)) {
1607
+ data.rect = newRect;
1608
+ changedRectsData.push(data);
1620
1609
  }
1621
- return this;
1622
- });
1623
- __publicField(this, "onChange", (listener) => {
1624
- this.contextListeners.add(listener);
1625
- return this;
1626
1610
  });
1627
- __publicField(this, "onEvent", (listener) => {
1628
- this.eventListeners.add(listener);
1629
- return this;
1611
+ changedRectsData.forEach((data) => {
1612
+ data.callbacks.forEach((callback) => callback(data.rect));
1630
1613
  });
1631
- this.config = structuredClone(config);
1632
- this.options = structuredClone(options ?? {});
1633
- this.id = this.config.id ?? `machine-${uuid()}`;
1634
- this.guardMap = this.options?.guards ?? {};
1635
- this.actionMap = this.options?.actions ?? {};
1636
- this.delayMap = this.options?.delays ?? {};
1637
- this.activityMap = this.options?.activities ?? {};
1638
- this.sync = this.options?.sync ?? false;
1639
- this.state = createProxy(this.config);
1640
- this.initialContext = snapshot(this.state.context);
1641
- this.transformContext(this.state.context);
1642
- const event = toEvent(
1643
- "machine.created"
1644
- /* Created */
1645
- );
1646
- this.executeActions(this.config?.created, event);
1647
- }
1648
- // immutable state value
1649
- get stateSnapshot() {
1650
- return cast(snapshot(this.state));
1651
- }
1652
- getState() {
1653
- return this.stateSnapshot;
1654
- }
1655
- // immutable context value
1656
- get contextSnapshot() {
1657
- return this.stateSnapshot.context;
1614
+ rafId = requestAnimationFrame(loop);
1615
+ };
1616
+ }
1617
+ var isEqualSize = (a2, b) => a2.width === b.width && a2.height === b.height;
1618
+ var isEqualPosition = (a2, b) => a2.top === b.top && a2.left === b.left;
1619
+ var isEqualRect = (a2, b) => isEqualSize(a2, b) && isEqualPosition(a2, b);
1620
+ function getEqualityFn(scope) {
1621
+ if (scope === "size")
1622
+ return isEqualSize;
1623
+ if (scope === "position")
1624
+ return isEqualPosition;
1625
+ return isEqualRect;
1626
+ }
1627
+
1628
+ // ../../node_modules/.pnpm/@zag-js+popper@0.19.1/node_modules/@zag-js/popper/dist/index.mjs
1629
+ var callAll2 = (...fns) => () => fns.forEach((fn) => fn());
1630
+ var isHTMLElement2 = (el) => {
1631
+ return typeof el === "object" && el !== null && el.nodeType === 1;
1632
+ };
1633
+ var addDomEvent = (el, type, fn, options) => {
1634
+ el.addEventListener(type, fn, options);
1635
+ return () => el.removeEventListener(type, fn, options);
1636
+ };
1637
+ function resolveOptions(option) {
1638
+ const bool = typeof option === "boolean";
1639
+ return {
1640
+ ancestorResize: bool ? option : option.ancestorResize ?? true,
1641
+ ancestorScroll: bool ? option : option.ancestorScroll ?? true,
1642
+ referenceResize: bool ? option : option.referenceResize ?? true
1643
+ };
1644
+ }
1645
+ function autoUpdate(reference, floating, update, options = false) {
1646
+ const { ancestorScroll, ancestorResize, referenceResize } = resolveOptions(options);
1647
+ const useAncestors = ancestorScroll || ancestorResize;
1648
+ const ancestors = [];
1649
+ if (useAncestors && isHTMLElement2(reference)) {
1650
+ ancestors.push(...getOverflowAncestors(reference));
1658
1651
  }
1659
- /**
1660
- * A reference to the instance methods of the machine.
1661
- * Useful when spawning child machines and managing the communication between them.
1662
- */
1663
- get self() {
1664
- const self = this;
1665
- return {
1666
- id: this.id,
1667
- send: this.send.bind(this),
1668
- sendParent: this.sendParent.bind(this),
1669
- sendChild: this.sendChild.bind(this),
1670
- stop: this.stop.bind(this),
1671
- stopChild: this.stopChild.bind(this),
1672
- spawn: this.spawn.bind(this),
1673
- stopActivity: this.stopActivity.bind(this),
1674
- get state() {
1675
- return self.stateSnapshot;
1676
- },
1677
- get initialContext() {
1678
- return self.initialContext;
1679
- },
1680
- get initialState() {
1681
- return self.initialState?.target ?? "";
1682
- }
1683
- };
1652
+ function addResizeListeners() {
1653
+ let cleanups = [trackElementRect(floating, { scope: "size", onChange: update })];
1654
+ if (referenceResize && isHTMLElement2(reference)) {
1655
+ cleanups.push(trackElementRect(reference, { onChange: update }));
1656
+ }
1657
+ cleanups.push(callAll2(...ancestors.map((el) => addDomEvent(el, "resize", update))));
1658
+ return () => cleanups.forEach((fn) => fn());
1684
1659
  }
1685
- get meta() {
1686
- return {
1687
- state: this.stateSnapshot,
1688
- guards: this.guardMap,
1689
- send: this.send.bind(this),
1690
- self: this.self,
1691
- initialContext: this.initialContext,
1692
- initialState: this.initialState?.target ?? "",
1693
- getState: () => this.stateSnapshot,
1694
- getAction: (key) => this.actionMap[key],
1695
- getGuard: (key) => this.guardMap[key]
1696
- };
1660
+ function addScrollListeners() {
1661
+ return callAll2(...ancestors.map((el) => addDomEvent(el, "scroll", update, { passive: true })));
1697
1662
  }
1698
- get guardMeta() {
1663
+ return callAll2(addResizeListeners(), addScrollListeners());
1664
+ }
1665
+ var toVar = (value) => ({ variable: value, reference: `var(${value})` });
1666
+ var cssVars = {
1667
+ arrowSize: toVar("--arrow-size"),
1668
+ arrowSizeHalf: toVar("--arrow-size-half"),
1669
+ arrowBg: toVar("--arrow-background"),
1670
+ transformOrigin: toVar("--transform-origin"),
1671
+ arrowOffset: toVar("--arrow-offset")
1672
+ };
1673
+ var getTransformOrigin = (arrow2) => ({
1674
+ top: "bottom center",
1675
+ "top-start": arrow2 ? `${arrow2.x}px bottom` : "left bottom",
1676
+ "top-end": arrow2 ? `${arrow2.x}px bottom` : "right bottom",
1677
+ bottom: "top center",
1678
+ "bottom-start": arrow2 ? `${arrow2.x}px top` : "top left",
1679
+ "bottom-end": arrow2 ? `${arrow2.x}px top` : "top right",
1680
+ left: "right center",
1681
+ "left-start": arrow2 ? `right ${arrow2.y}px` : "right top",
1682
+ "left-end": arrow2 ? `right ${arrow2.y}px` : "right bottom",
1683
+ right: "left center",
1684
+ "right-start": arrow2 ? `left ${arrow2.y}px` : "left top",
1685
+ "right-end": arrow2 ? `left ${arrow2.y}px` : "left bottom"
1686
+ });
1687
+ var transformOrigin = {
1688
+ name: "transformOrigin",
1689
+ fn({ placement, elements, middlewareData }) {
1690
+ const { arrow: arrow2 } = middlewareData;
1691
+ const transformOrigin2 = getTransformOrigin(arrow2)[placement];
1692
+ const { floating } = elements;
1693
+ floating.style.setProperty(cssVars.transformOrigin.variable, transformOrigin2);
1699
1694
  return {
1700
- state: this.stateSnapshot
1695
+ data: { transformOrigin: transformOrigin2 }
1701
1696
  };
1702
1697
  }
1703
- get [Symbol.toStringTag]() {
1704
- return "Machine";
1705
- }
1706
- };
1707
- var createMachine = (config, options) => new Machine(config, options);
1708
-
1709
- // ../../node_modules/.pnpm/@zag-js+dom-event@0.19.1/node_modules/@zag-js/dom-event/dist/index.mjs
1710
- var addDomEvent2 = (target, eventName, handler, options) => {
1711
- const node = typeof target === "function" ? target() : target;
1712
- node?.addEventListener(eventName, handler, options);
1713
- return () => {
1714
- node?.removeEventListener(eventName, handler, options);
1715
- };
1716
1698
  };
1717
-
1718
- // ../../node_modules/.pnpm/@zag-js+tooltip@0.19.1/node_modules/@zag-js/tooltip/dist/index.mjs
1719
- var anatomy = createAnatomy("tooltip").parts("trigger", "arrow", "arrowTip", "positioner", "content");
1720
- var parts = anatomy.build();
1721
- var dom = createScope({
1722
- getTriggerId: (ctx) => ctx.ids?.trigger ?? `tooltip:${ctx.id}:trigger`,
1723
- getContentId: (ctx) => ctx.ids?.content ?? `tooltip:${ctx.id}:content`,
1724
- getArrowId: (ctx) => ctx.ids?.arrow ?? `tooltip:${ctx.id}:arrow`,
1725
- getPositionerId: (ctx) => ctx.ids?.positioner ?? `tooltip:${ctx.id}:popper`,
1726
- getTriggerEl: (ctx) => dom.getById(ctx, dom.getTriggerId(ctx)),
1727
- getContentEl: (ctx) => dom.getById(ctx, dom.getContentId(ctx)),
1728
- getPositionerEl: (ctx) => dom.getById(ctx, dom.getPositionerId(ctx)),
1729
- getArrowEl: (ctx) => dom.getById(ctx, dom.getArrowId(ctx)),
1730
- getScrollParent: (ctx) => getScrollParent(dom.getTriggerEl(ctx))
1731
- });
1732
- var store = proxy({
1733
- id: null,
1734
- prevId: null,
1735
- setId(val) {
1736
- this.prevId = this.id;
1737
- this.id = val;
1699
+ var shiftArrow = (opts) => ({
1700
+ name: "shiftArrow",
1701
+ fn({ placement, middlewareData }) {
1702
+ const { element: arrow2 } = opts;
1703
+ if (middlewareData.arrow) {
1704
+ const { x, y: y2 } = middlewareData.arrow;
1705
+ const dir = placement.split("-")[0];
1706
+ Object.assign(arrow2.style, {
1707
+ left: x != null ? `${x}px` : "",
1708
+ top: y2 != null ? `${y2}px` : "",
1709
+ [dir]: `calc(100% + ${cssVars.arrowOffset.reference})`
1710
+ });
1711
+ }
1712
+ return {};
1738
1713
  }
1739
1714
  });
1740
- function connect(state, send, normalize) {
1741
- const id = state.context.id;
1742
- const hasAriaLabel = state.context.hasAriaLabel;
1743
- const isOpen = state.hasTag("open");
1744
- const triggerId = dom.getTriggerId(state.context);
1745
- const contentId = dom.getContentId(state.context);
1746
- const isDisabled = state.context.disabled;
1747
- const popperStyles = getPlacementStyles({
1748
- ...state.context.positioning,
1749
- placement: state.context.currentPlacement
1750
- });
1751
- return {
1752
- isOpen,
1753
- open() {
1754
- send("OPEN");
1755
- },
1756
- close() {
1757
- send("CLOSE");
1758
- },
1759
- setPositioning(options = {}) {
1760
- send({ type: "SET_POSITIONING", options });
1761
- },
1762
- triggerProps: normalize.button({
1763
- ...parts.trigger.attrs,
1764
- id: triggerId,
1765
- "data-expanded": dataAttr(isOpen),
1766
- "data-state": isOpen ? "open" : "closed",
1767
- "aria-describedby": isOpen ? contentId : void 0,
1768
- onClick() {
1769
- send("CLICK");
1770
- },
1771
- onFocus() {
1772
- if (state.event.type === "POINTER_DOWN")
1773
- return;
1774
- send("FOCUS");
1775
- },
1776
- onBlur() {
1777
- if (id === store.id) {
1778
- send("BLUR");
1779
- }
1780
- },
1781
- onPointerDown() {
1782
- if (isDisabled)
1783
- return;
1784
- if (id === store.id) {
1785
- send("POINTER_DOWN");
1786
- }
1787
- },
1788
- onPointerMove(event) {
1789
- if (isDisabled || event.pointerType === "touch")
1790
- return;
1791
- send("POINTER_MOVE");
1792
- },
1793
- onPointerLeave() {
1794
- if (isDisabled)
1795
- return;
1796
- send("POINTER_LEAVE");
1797
- },
1798
- onPointerCancel() {
1799
- if (isDisabled)
1800
- return;
1801
- send("POINTER_LEAVE");
1802
- }
1803
- }),
1804
- arrowProps: normalize.element({
1805
- id: dom.getArrowId(state.context),
1806
- ...parts.arrow.attrs,
1807
- style: popperStyles.arrow
1808
- }),
1809
- arrowTipProps: normalize.element({
1810
- ...parts.arrowTip.attrs,
1811
- style: popperStyles.arrowTip
1812
- }),
1813
- positionerProps: normalize.element({
1814
- id: dom.getPositionerId(state.context),
1815
- ...parts.positioner.attrs,
1816
- style: popperStyles.floating
1817
- }),
1818
- contentProps: normalize.element({
1819
- ...parts.content.attrs,
1820
- hidden: !isOpen,
1821
- "data-state": isOpen ? "open" : "closed",
1822
- role: hasAriaLabel ? void 0 : "tooltip",
1823
- id: hasAriaLabel ? void 0 : contentId,
1824
- "data-placement": state.context.currentPlacement,
1825
- onPointerEnter() {
1826
- send("CONTENT.POINTER_MOVE");
1827
- },
1828
- onPointerLeave() {
1829
- send("CONTENT.POINTER_LEAVE");
1830
- },
1831
- style: {
1832
- pointerEvents: state.context.interactive ? "auto" : "none"
1715
+ var defaultOptions = {
1716
+ strategy: "absolute",
1717
+ placement: "bottom",
1718
+ listeners: true,
1719
+ gutter: 8,
1720
+ flip: true,
1721
+ sameWidth: false,
1722
+ overflowPadding: 8
1723
+ };
1724
+ function getPlacementImpl(reference, floating, opts = {}) {
1725
+ if (!floating || !reference)
1726
+ return;
1727
+ const options = Object.assign({}, defaultOptions, opts);
1728
+ const arrowEl = floating.querySelector("[data-part=arrow]");
1729
+ const middleware = [];
1730
+ const boundary = typeof options.boundary === "function" ? options.boundary() : options.boundary;
1731
+ if (options.flip) {
1732
+ middleware.push(
1733
+ flip({
1734
+ boundary,
1735
+ padding: options.overflowPadding
1736
+ })
1737
+ );
1738
+ }
1739
+ if (options.gutter || options.offset) {
1740
+ const arrowOffset = arrowEl ? arrowEl.offsetHeight / 2 : 0;
1741
+ let mainAxis = options.offset?.mainAxis ?? options.gutter;
1742
+ let crossAxis = options.offset?.crossAxis;
1743
+ if (mainAxis != null)
1744
+ mainAxis += arrowOffset;
1745
+ const offsetOptions = compact2({ mainAxis, crossAxis });
1746
+ middleware.push(offset(offsetOptions));
1747
+ }
1748
+ middleware.push(
1749
+ shift({
1750
+ boundary,
1751
+ crossAxis: options.overlap,
1752
+ padding: options.overflowPadding
1753
+ })
1754
+ );
1755
+ if (arrowEl) {
1756
+ middleware.push(
1757
+ arrow({ element: arrowEl, padding: 8 }),
1758
+ shiftArrow({ element: arrowEl })
1759
+ );
1760
+ }
1761
+ middleware.push(transformOrigin);
1762
+ middleware.push(
1763
+ size({
1764
+ padding: options.overflowPadding,
1765
+ apply({ rects, availableHeight, availableWidth }) {
1766
+ const referenceWidth = Math.round(rects.reference.width);
1767
+ floating.style.setProperty("--reference-width", `${referenceWidth}px`);
1768
+ floating.style.setProperty("--available-width", `${availableWidth}px`);
1769
+ floating.style.setProperty("--available-height", `${availableHeight}px`);
1833
1770
  }
1834
1771
  })
1835
- };
1836
- }
1837
- var { and: and2, not: not2 } = guards;
1838
- function machine(userContext) {
1839
- const ctx = compact(userContext);
1840
- return createMachine(
1841
- {
1842
- id: "tooltip",
1843
- initial: "closed",
1844
- context: {
1845
- openDelay: 1e3,
1846
- closeDelay: 500,
1847
- closeOnPointerDown: true,
1848
- closeOnEsc: true,
1849
- interactive: true,
1850
- currentPlacement: void 0,
1851
- ...ctx,
1852
- hasPointerMoveOpened: false,
1853
- positioning: {
1854
- placement: "bottom",
1855
- ...ctx.positioning
1856
- }
1857
- },
1858
- computed: {
1859
- hasAriaLabel: (ctx2) => !!ctx2["aria-label"]
1860
- },
1861
- watch: {
1862
- disabled: ["closeIfDisabled"],
1863
- open: ["toggleVisibility"]
1864
- },
1865
- on: {
1866
- OPEN: "open",
1867
- CLOSE: "closed"
1868
- },
1869
- states: {
1870
- closed: {
1871
- tags: ["closed"],
1872
- entry: ["clearGlobalId", "invokeOnClose"],
1873
- on: {
1874
- FOCUS: "open",
1875
- POINTER_LEAVE: {
1876
- actions: ["clearPointerMoveOpened"]
1877
- },
1878
- POINTER_MOVE: [
1879
- {
1880
- guard: and2("noVisibleTooltip", not2("hasPointerMoveOpened")),
1881
- target: "opening"
1882
- },
1883
- {
1884
- guard: not2("hasPointerMoveOpened"),
1885
- target: "open",
1886
- actions: ["setPointerMoveOpened"]
1887
- }
1888
- ]
1889
- }
1890
- },
1891
- opening: {
1892
- tags: ["closed"],
1893
- activities: ["trackScroll", "trackPointerlockChange"],
1894
- after: {
1895
- OPEN_DELAY: {
1896
- target: "open",
1897
- actions: ["setPointerMoveOpened"]
1898
- }
1899
- },
1900
- on: {
1901
- POINTER_LEAVE: {
1902
- target: "closed",
1903
- actions: ["clearPointerMoveOpened"]
1904
- },
1905
- BLUR: "closed",
1906
- SCROLL: "closed",
1907
- POINTER_LOCK_CHANGE: "closed",
1908
- POINTER_DOWN: {
1909
- guard: "closeOnPointerDown",
1910
- target: "closed"
1911
- }
1912
- }
1913
- },
1914
- open: {
1915
- tags: ["open"],
1916
- activities: [
1917
- "trackEscapeKey",
1918
- "trackDisabledTriggerOnSafari",
1919
- "trackScroll",
1920
- "trackPointerlockChange",
1921
- "trackPositioning"
1922
- ],
1923
- entry: ["setGlobalId", "invokeOnOpen"],
1924
- on: {
1925
- POINTER_LEAVE: [
1926
- {
1927
- guard: "isVisible",
1928
- target: "closing",
1929
- actions: ["clearPointerMoveOpened"]
1930
- },
1931
- {
1932
- target: "closed",
1933
- actions: ["clearPointerMoveOpened"]
1934
- }
1935
- ],
1936
- BLUR: "closed",
1937
- ESCAPE: "closed",
1938
- SCROLL: "closed",
1939
- POINTER_LOCK_CHANGE: "closed",
1940
- "CONTENT.POINTER_LEAVE": {
1941
- guard: "isInteractive",
1942
- target: "closing"
1943
- },
1944
- POINTER_DOWN: {
1945
- guard: "closeOnPointerDown",
1946
- target: "closed"
1947
- },
1948
- CLICK: "closed",
1949
- SET_POSITIONING: {
1950
- actions: "setPositioning"
1951
- }
1952
- }
1953
- },
1954
- closing: {
1955
- tags: ["open"],
1956
- activities: ["trackStore", "trackPositioning"],
1957
- after: {
1958
- CLOSE_DELAY: "closed"
1959
- },
1960
- on: {
1961
- FORCE_CLOSE: "closed",
1962
- POINTER_MOVE: {
1963
- target: "open",
1964
- actions: ["setPointerMoveOpened"]
1965
- },
1966
- "CONTENT.POINTER_MOVE": {
1967
- guard: "isInteractive",
1968
- target: "open"
1969
- }
1970
- }
1971
- }
1972
- }
1973
- },
1974
- {
1975
- activities: {
1976
- trackPositioning(ctx2) {
1977
- ctx2.currentPlacement = ctx2.positioning.placement;
1978
- const getPositionerEl = () => dom.getPositionerEl(ctx2);
1979
- return getPlacement(dom.getTriggerEl(ctx2), getPositionerEl, {
1980
- ...ctx2.positioning,
1981
- defer: true,
1982
- onComplete(data) {
1983
- ctx2.currentPlacement = data.placement;
1984
- },
1985
- onCleanup() {
1986
- ctx2.currentPlacement = void 0;
1987
- }
1988
- });
1989
- },
1990
- trackPointerlockChange(ctx2, _evt, { send }) {
1991
- const onChange = () => send("POINTER_LOCK_CHANGE");
1992
- return addDomEvent2(dom.getDoc(ctx2), "pointerlockchange", onChange, false);
1993
- },
1994
- trackScroll(ctx2, _evt, { send }) {
1995
- const trigger = dom.getTriggerEl(ctx2);
1996
- if (!trigger)
1997
- return;
1998
- const cleanups = getScrollParents(trigger).map((el) => {
1999
- const opts = { passive: true, capture: true };
2000
- return addDomEvent2(el, "scroll", () => send("SCROLL"), opts);
2001
- });
2002
- return () => {
2003
- cleanups.forEach((fn) => fn?.());
2004
- };
2005
- },
2006
- trackStore(ctx2, _evt, { send }) {
2007
- return subscribe(store, () => {
2008
- if (store.id !== ctx2.id) {
2009
- send("FORCE_CLOSE");
2010
- }
2011
- });
2012
- },
2013
- trackDisabledTriggerOnSafari(ctx2, _evt, { send }) {
2014
- if (!isSafari())
2015
- return;
2016
- const doc = dom.getDoc(ctx2);
2017
- return addDomEvent2(doc, "pointermove", (event) => {
2018
- const selector = "[data-part=trigger][data-expanded]";
2019
- if (isHTMLElement(event.target) && event.target.closest(selector))
2020
- return;
2021
- send("POINTER_LEAVE");
2022
- });
2023
- },
2024
- trackEscapeKey(ctx2, _evt, { send }) {
2025
- if (!ctx2.closeOnEsc)
2026
- return;
2027
- const doc = dom.getDoc(ctx2);
2028
- return addDomEvent2(doc, "keydown", (event) => {
2029
- if (event.key === "Escape") {
2030
- send("ESCAPE");
2031
- }
2032
- });
2033
- }
2034
- },
2035
- actions: {
2036
- setGlobalId(ctx2) {
2037
- store.setId(ctx2.id);
2038
- },
2039
- clearGlobalId(ctx2) {
2040
- if (ctx2.id === store.id) {
2041
- store.setId(null);
2042
- }
2043
- },
2044
- invokeOnOpen(ctx2, evt) {
2045
- const omit = ["CONTENT.POINTER_MOVE", "POINTER_MOVE"];
2046
- if (!omit.includes(evt.type)) {
2047
- ctx2.onOpen?.();
2048
- }
2049
- },
2050
- invokeOnClose(ctx2) {
2051
- ctx2.onClose?.();
2052
- },
2053
- closeIfDisabled(ctx2, _evt, { send }) {
2054
- if (!ctx2.disabled)
2055
- return;
2056
- send("CLOSE");
2057
- },
2058
- setPositioning(ctx2, evt) {
2059
- const getPositionerEl = () => dom.getPositionerEl(ctx2);
2060
- getPlacement(dom.getTriggerEl(ctx2), getPositionerEl, {
2061
- ...ctx2.positioning,
2062
- ...evt.options,
2063
- defer: true,
2064
- listeners: false
2065
- });
2066
- },
2067
- toggleVisibility(ctx2, _evt, { send }) {
2068
- send({ type: ctx2.open ? "OPEN" : "CLOSE", src: "controlled" });
2069
- },
2070
- setPointerMoveOpened(ctx2) {
2071
- ctx2.hasPointerMoveOpened = true;
2072
- },
2073
- clearPointerMoveOpened(ctx2) {
2074
- ctx2.hasPointerMoveOpened = false;
2075
- }
2076
- },
2077
- guards: {
2078
- closeOnPointerDown: (ctx2) => ctx2.closeOnPointerDown,
2079
- noVisibleTooltip: () => store.id === null,
2080
- isVisible: (ctx2) => ctx2.id === store.id,
2081
- isInteractive: (ctx2) => ctx2.interactive,
2082
- hasPointerMoveOpened: (ctx2) => !!ctx2.hasPointerMoveOpened
2083
- },
2084
- delays: {
2085
- OPEN_DELAY: (ctx2) => ctx2.openDelay,
2086
- CLOSE_DELAY: (ctx2) => ctx2.closeDelay
2087
- }
2088
- }
2089
1772
  );
2090
- }
2091
-
2092
- // ../../node_modules/.pnpm/@zag-js+types@0.19.1/node_modules/@zag-js/types/dist/index.mjs
2093
- function createNormalizer(fn) {
2094
- return new Proxy({}, {
2095
- get() {
2096
- return fn;
2097
- }
2098
- });
2099
- }
2100
-
2101
- // ../../node_modules/.pnpm/@zag-js+react@0.19.1_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/@zag-js/react/dist/index.mjs
2102
- import { createElement, useReducer, useRef } from "react";
2103
- import { createPortal } from "react-dom";
2104
- import { useEffect, useLayoutEffect } from "react";
2105
- import ReactExports, { useCallback, useEffect as useEffect2, useMemo, useRef as useRef2, useSyncExternalStore } from "react";
2106
- import { useRef as useRef3 } from "react";
2107
- var normalizeProps = createNormalizer((v) => v);
2108
- var useSafeLayoutEffect = typeof document !== "undefined" ? useLayoutEffect : useEffect;
2109
- function Portal(props) {
2110
- const { children, target } = props;
2111
- const node = useRef(null);
2112
- const portalNode = useRef(null);
2113
- const [, forceUpdate] = useReducer((s2) => s2 + 1, 0);
2114
- useSafeLayoutEffect(() => {
2115
- if (!node.current)
1773
+ function compute(config = {}) {
1774
+ if (!reference || !floating)
2116
1775
  return;
2117
- const doc = node.current.ownerDocument;
2118
- portalNode.current = doc.createElement("zag-portal");
2119
- doc.body.appendChild(portalNode.current);
2120
- forceUpdate();
2121
- return () => {
2122
- if (portalNode.current) {
2123
- doc.body.removeChild(portalNode.current);
2124
- }
2125
- };
2126
- }, []);
2127
- const targetNode = target?.current ?? portalNode.current;
2128
- if (targetNode) {
2129
- return createPortal(children, targetNode);
1776
+ const { placement, strategy, onComplete } = options;
1777
+ computePosition(reference, floating, {
1778
+ placement,
1779
+ middleware,
1780
+ strategy,
1781
+ ...config
1782
+ }).then((data) => {
1783
+ const x = Math.round(data.x);
1784
+ floating.style.setProperty("--x", `${x}px`);
1785
+ const y2 = Math.round(data.y);
1786
+ floating.style.setProperty("--y", `${y2}px`);
1787
+ onComplete?.(data);
1788
+ });
2130
1789
  }
2131
- return createElement("span", { ref: node });
2132
- }
2133
- var { use } = ReactExports;
2134
- var targetCache = /* @__PURE__ */ new WeakMap();
2135
- function useSnapshot(proxyObject, options) {
2136
- const notifyInSync = options?.sync;
2137
- const lastSnapshot = useRef2();
2138
- const lastAffected = useRef2();
2139
- const currSnapshot = useSyncExternalStore(
2140
- useCallback(
2141
- (callback) => {
2142
- const unsub = subscribe(proxyObject, callback, notifyInSync);
2143
- callback();
2144
- return unsub;
2145
- },
2146
- [proxyObject, notifyInSync]
2147
- ),
2148
- () => {
2149
- const nextSnapshot = snapshot(proxyObject, use);
2150
- try {
2151
- if (lastSnapshot.current && lastAffected.current && !p(lastSnapshot.current, nextSnapshot, lastAffected.current, /* @__PURE__ */ new WeakMap())) {
2152
- return lastSnapshot.current;
2153
- }
2154
- } catch (e2) {
2155
- }
2156
- return nextSnapshot;
2157
- },
2158
- () => snapshot(proxyObject, use)
1790
+ compute();
1791
+ return callAll(
1792
+ options.listeners ? autoUpdate(reference, floating, compute, options.listeners) : void 0,
1793
+ options.onCleanup
2159
1794
  );
2160
- const currAffected = /* @__PURE__ */ new WeakMap();
2161
- useEffect2(() => {
2162
- lastSnapshot.current = currSnapshot;
2163
- lastAffected.current = currAffected;
2164
- });
2165
- const proxyCache = useMemo(() => /* @__PURE__ */ new WeakMap(), []);
2166
- return a(currSnapshot, currAffected, proxyCache, targetCache);
2167
1795
  }
2168
- function useConstant(fn) {
2169
- const ref2 = useRef3();
2170
- if (!ref2.current)
2171
- ref2.current = { v: fn() };
2172
- return ref2.current.v;
1796
+ function getPlacement(referenceOrFn, floatingOrFn, opts = {}) {
1797
+ const { defer, ...restOptions } = opts;
1798
+ const func = defer ? raf : (v) => v();
1799
+ const cleanups = [];
1800
+ cleanups.push(
1801
+ func(() => {
1802
+ const reference = typeof referenceOrFn === "function" ? referenceOrFn() : referenceOrFn;
1803
+ const floating = typeof floatingOrFn === "function" ? floatingOrFn() : floatingOrFn;
1804
+ cleanups.push(getPlacementImpl(reference, floating, restOptions));
1805
+ })
1806
+ );
1807
+ return () => {
1808
+ cleanups.forEach((fn) => fn?.());
1809
+ };
2173
1810
  }
2174
- function useService(machine2, options) {
2175
- const { actions, state: hydratedState, context } = options ?? {};
2176
- const service = useConstant(() => {
2177
- const instance = typeof machine2 === "function" ? machine2() : machine2;
2178
- return context ? instance.withContext(context) : instance;
2179
- });
2180
- useSafeLayoutEffect(() => {
2181
- service.start(hydratedState);
2182
- if (service.state.can("SETUP")) {
2183
- service.send("SETUP");
1811
+ var ARROW_FLOATING_STYLE = {
1812
+ bottom: "rotate(45deg)",
1813
+ left: "rotate(135deg)",
1814
+ top: "rotate(225deg)",
1815
+ right: "rotate(315deg)"
1816
+ };
1817
+ function getPlacementStyles(options = {}) {
1818
+ const { placement = "bottom", sameWidth, fitViewport, strategy = "absolute" } = options;
1819
+ return {
1820
+ arrow: {
1821
+ position: "absolute",
1822
+ width: cssVars.arrowSize.reference,
1823
+ height: cssVars.arrowSize.reference,
1824
+ [cssVars.arrowSizeHalf.variable]: `calc(${cssVars.arrowSize.reference} / 2)`,
1825
+ [cssVars.arrowOffset.variable]: `calc(${cssVars.arrowSizeHalf.reference} * -1)`
1826
+ },
1827
+ arrowTip: {
1828
+ transform: ARROW_FLOATING_STYLE[placement.split("-")[0]],
1829
+ background: cssVars.arrowBg.reference,
1830
+ top: "0",
1831
+ left: "0",
1832
+ width: "100%",
1833
+ height: "100%",
1834
+ position: "absolute",
1835
+ zIndex: "inherit"
1836
+ },
1837
+ floating: {
1838
+ position: strategy,
1839
+ minWidth: sameWidth ? void 0 : "max-content",
1840
+ width: sameWidth ? "var(--reference-width)" : void 0,
1841
+ maxWidth: fitViewport ? "var(--available-width)" : void 0,
1842
+ maxHeight: fitViewport ? "var(--available-height)" : void 0,
1843
+ top: "0px",
1844
+ left: "0px",
1845
+ transform: `translate3d(var(--x), var(--y), 0)`
2184
1846
  }
2185
- return () => {
2186
- service.stop();
2187
- };
2188
- }, []);
2189
- service.setOptions({ actions });
2190
- service.setContext(context);
2191
- return service;
2192
- }
2193
- function useMachine(machine2, options) {
2194
- const service = useService(machine2, options);
2195
- const state = useSnapshot(service.state);
2196
- const typedState = state;
2197
- return [typedState, service.send, service];
1847
+ };
2198
1848
  }
2199
1849
 
2200
- // ../../node_modules/.pnpm/@cfx-kit+ui-components@0.0.18_@zag-js+accordion@0.19.1_@zag-js+checkbox@0.19.1_@zag-js+dialog_toqhwacqm4ck723ovqekq5mm7u/node_modules/@cfx-kit/ui-components/dist/Tooltip.js
2201
- import { Fragment as Fragment2, jsx, jsxs } from "react/jsx-runtime";
2202
- var Tooltip = (_a) => {
2203
- var _b = _a, {
2204
- id,
2205
- open = false,
2206
- openDelay = 200,
2207
- closeDelay = 200,
2208
- arrow: arrow2 = true,
2209
- positioning,
2210
- children,
2211
- containerClassName,
2212
- trigger,
2213
- portalled = false
2214
- } = _b, props = __objRest(_b, [
2215
- "id",
2216
- "open",
2217
- "openDelay",
2218
- "closeDelay",
2219
- "arrow",
2220
- "positioning",
2221
- "children",
2222
- "containerClassName",
2223
- "trigger",
2224
- "portalled"
2225
- ]);
2226
- const Wrapper = portalled ? Portal : Fragment;
2227
- const uniqueId = useId();
2228
- const [state, send] = useMachine(machine(__spreadValues({ id: id != null ? id : uniqueId, openDelay, closeDelay, positioning }, props)));
2229
- const api = connect(state, send, normalizeProps);
2230
- useEffect3(() => {
2231
- if (open === true) {
2232
- api.open();
2233
- } else {
2234
- api.close();
2235
- }
2236
- }, [open]);
2237
- return /* @__PURE__ */ jsxs(Fragment2, { children: [
2238
- typeof trigger === "function" ? trigger({ triggerProps: api.triggerProps }) : null,
2239
- api.isOpen && /* @__PURE__ */ jsx(Wrapper, { children: /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({ className: `ui-tooltip${containerClassName ? ` ${containerClassName}` : ""}` }, api.positionerProps), { children: [
2240
- arrow2 && /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({}, api.arrowProps), { children: /* @__PURE__ */ jsx("div", __spreadValues({}, api.arrowTipProps)) })),
2241
- typeof children === "function" && children({ contentProps: api.contentProps }),
2242
- typeof children !== "function" ? Children.count(children) === 1 && isValidElement(children) ? cloneElement(children, __spreadValues({}, api.contentProps)) : /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({}, api.contentProps), { children })) : null
2243
- ] })) })
2244
- ] });
1850
+ // ../../node_modules/.pnpm/@zag-js+dom-event@0.19.1/node_modules/@zag-js/dom-event/dist/index.mjs
1851
+ var addDomEvent2 = (target, eventName, handler, options) => {
1852
+ const node = typeof target === "function" ? target() : target;
1853
+ node?.addEventListener(eventName, handler, options);
1854
+ return () => {
1855
+ node?.removeEventListener(eventName, handler, options);
1856
+ };
2245
1857
  };
2246
- var Tooltip_default = Tooltip;
2247
-
2248
- // src/components/Tooltip/index.tsx
2249
- import { useClickAway } from "@cfx-kit/react-utils/dist/hooks";
2250
- import { jsx as jsx2 } from "react/jsx-runtime";
2251
- var Tooltip2 = ({
2252
- title,
2253
- children = null,
2254
- positioning = {},
2255
- className,
2256
- containerClassName,
2257
- ...rest
2258
- }) => {
2259
- const { placement = "top" } = positioning;
2260
- const onCloseRef = useRef4();
2261
- const triggerRef = useRef4(null);
2262
- const triggerContentRef = useRef4(null);
2263
- useClickAway([triggerRef, triggerContentRef], (e2) => {
2264
- onCloseRef.current?.(
2265
- e2
2266
- );
2267
- });
2268
- return /* @__PURE__ */ jsx2(
2269
- Tooltip_default,
2270
- {
2271
- trigger: ({ triggerProps }) => {
2272
- onCloseRef.current = triggerProps.onClick;
2273
- triggerProps.onClick = (e2) => {
2274
- triggerProps.onPointerMove?.(e2);
2275
- };
2276
- return /* @__PURE__ */ jsx2(
2277
- "span",
2278
- {
2279
- ref: triggerRef,
2280
- ...title ? triggerProps : {},
2281
- className: cn(className, triggerProps.className),
2282
- children
2283
- }
2284
- );
2285
- },
2286
- containerClassName: cn(
2287
- "sirius-next-tooltip",
2288
- "lh-normal max-w-320px z-1000 w-max min-w-unset!",
2289
- "all-[a]:text-[var(--theme-color-blue0)] all-[a:hover]:text-[var(--theme-color-blue2)]",
2290
- "[&.sirius-next-tooltip>[data-part=arrow]]:[--arrow-size:6px] [&.sirius-next-tooltip>[data-part=arrow]]:[--arrow-background:#333]",
2291
- containerClassName
2292
- ),
2293
- openDelay: 0,
2294
- closeOnPointerDown: false,
2295
- ...rest,
2296
- positioning: {
2297
- ...positioning,
2298
- placement
2299
- },
2300
- children: ({ contentProps }) => {
2301
- const _onPointerLeave = contentProps.onPointerLeave;
2302
- contentProps.onPointerLeave = (e2) => {
2303
- if (e2.pointerType === "touch")
2304
- return;
2305
- _onPointerLeave?.(e2);
2306
- };
2307
- return /* @__PURE__ */ jsx2(
2308
- "div",
2309
- {
2310
- className: "px-8px py-6px text-12px text-#fff text-left shadow break-words ws-normal bg-#333 min-w-30px min-h-32px decoration-none rounded-2px",
2311
- ref: (_ref) => _ref ? triggerContentRef.current = _ref.parentElement : triggerContentRef.current = null,
2312
- ...contentProps,
2313
- children: title
2314
- }
2315
- );
2316
- }
2317
- }
2318
- );
1858
+ var isContextMenuEvent = (e2) => {
1859
+ return e2.button === 2 || isMac2() && e2.ctrlKey && e2.button === 0;
2319
1860
  };
1861
+ var isMac2 = () => /Mac|iPod|iPhone|iPad/.test(window.navigator.platform);
1862
+ function fireCustomEvent(el, type, init) {
1863
+ if (!el)
1864
+ return;
1865
+ const win = el.ownerDocument.defaultView || window;
1866
+ const event = new win.CustomEvent(type, init);
1867
+ return el.dispatchEvent(event);
1868
+ }
2320
1869
 
2321
1870
  export {
2322
- Tooltip2 as Tooltip
1871
+ __spreadValues,
1872
+ __spreadProps,
1873
+ __objRest,
1874
+ createAnatomy,
1875
+ dataAttr,
1876
+ isHTMLElement,
1877
+ contains,
1878
+ createScope,
1879
+ getDocument2,
1880
+ getWindow,
1881
+ getEventTarget,
1882
+ getScrollParent,
1883
+ getScrollParents,
1884
+ isSafari,
1885
+ isIos,
1886
+ nextTick,
1887
+ raf,
1888
+ runIfFn2 as runIfFn,
1889
+ callAll,
1890
+ compact2 as compact,
1891
+ warn2 as warn,
1892
+ getPlacement,
1893
+ getPlacementStyles,
1894
+ proxy,
1895
+ subscribe,
1896
+ guards,
1897
+ createMachine,
1898
+ addDomEvent2 as addDomEvent,
1899
+ isContextMenuEvent,
1900
+ fireCustomEvent,
1901
+ normalizeProps,
1902
+ Portal,
1903
+ useMachine
2323
1904
  };
2324
- //# sourceMappingURL=chunk-ZKNMJZ5R.js.map
1905
+ //# sourceMappingURL=chunk-BMO4IZHV.js.map