@pasquelin/panels 0.3.0 → 0.3.2

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.
package/dist/index.js CHANGED
@@ -1,50 +1,50 @@
1
- import { jsx as u, jsxs as g, Fragment as A } from "react/jsx-runtime";
2
- import F, { useEffect as nn, useLayoutEffect as kn, useState as W, useMemo as w, useContext as tn, createContext as en, useRef as H, useCallback as _, memo as Sn, Fragment as Dn, Children as jn, isValidElement as Hn } from "react";
1
+ import { jsx as u, jsxs as m, Fragment as j } from "react/jsx-runtime";
2
+ import H, { useEffect as tn, useLayoutEffect as Bn, useState as J, useMemo as w, useContext as en, createContext as on, useRef as Z, useCallback as N, memo as Sn, Fragment as kn, Children as Dn, isValidElement as Hn } from "react";
3
3
  import { c as b } from "./cx-CcykAxZN.js";
4
- const an = (n) => {
4
+ const un = (n) => {
5
5
  let t;
6
6
  const e = /* @__PURE__ */ new Set(), o = (a, d) => {
7
7
  const f = typeof a == "function" ? a(t) : a;
8
8
  if (!Object.is(f, t)) {
9
- const h = t;
10
- t = d ?? (typeof f != "object" || f === null) ? f : Object.assign({}, t, f), e.forEach((m) => m(t, h));
9
+ const p = t;
10
+ t = d ?? (typeof f != "object" || f === null) ? f : Object.assign({}, t, f), e.forEach((g) => g(t, p));
11
11
  }
12
- }, c = () => t, i = { setState: o, getState: c, getInitialState: () => l, subscribe: (a) => (e.add(a), () => e.delete(a)) }, l = t = n(o, c, i);
13
- return i;
14
- }, Un = ((n) => n ? an(n) : an), Vn = (n) => n;
15
- function Yn(n, t = Vn) {
16
- const e = F.useSyncExternalStore(
12
+ }, c = () => t, r = { setState: o, getState: c, getInitialState: () => l, subscribe: (a) => (e.add(a), () => e.delete(a)) }, l = t = n(o, c, r);
13
+ return r;
14
+ }, jn = ((n) => n ? un(n) : un), Un = (n) => n;
15
+ function Vn(n, t = Un) {
16
+ const e = H.useSyncExternalStore(
17
17
  n.subscribe,
18
- F.useCallback(() => t(n.getState()), [n, t]),
19
- F.useCallback(() => t(n.getInitialState()), [n, t])
18
+ H.useCallback(() => t(n.getState()), [n, t]),
19
+ H.useCallback(() => t(n.getInitialState()), [n, t])
20
20
  );
21
- return F.useDebugValue(e), e;
21
+ return H.useDebugValue(e), e;
22
22
  }
23
- const U = ["left", "right", "top", "bottomLeft", "bottomRight"], Nn = ["primary", "secondary"], on = "default", $n = ["bottomLeft", "bottomRight"];
24
- function rn(n) {
23
+ const B = ["left", "right", "top", "bottomLeft", "bottomRight"], Pn = ["primary", "secondary"], rn = "default", Wn = ["bottomLeft", "bottomRight"];
24
+ function sn(n) {
25
25
  return n === "bottomLeft" || n === "bottomRight";
26
26
  }
27
- function M(n) {
28
- return n === "top" || rn(n);
27
+ function T(n) {
28
+ return n === "top" || sn(n);
29
29
  }
30
- const G = {
30
+ const X = {
31
31
  left: { column: ["left", "top"], band: "bottomLeft" },
32
32
  right: { column: ["right"], band: "bottomRight" }
33
33
  };
34
- function un(n) {
34
+ function dn(n) {
35
35
  return n === "left" || n === "top";
36
36
  }
37
- const B = 140, Pn = 240, Z = 100, Wn = {
37
+ const U = 140, Nn = 240, O = 100, Yn = {
38
38
  left: 320,
39
39
  right: 260,
40
40
  top: 180,
41
41
  bottomLeft: 240,
42
42
  bottomRight: 240
43
43
  }, _n = "bottomRight";
44
- function k(n) {
45
- return rn(n) ? _n : n;
44
+ function V(n) {
45
+ return sn(n) ? _n : n;
46
46
  }
47
- const x = {
47
+ const C = {
48
48
  left: "right",
49
49
  right: "left",
50
50
  // The band as a whole faces the top strip: either half of it takes the same height off.
@@ -55,192 +55,208 @@ const x = {
55
55
  function In(n, t, e) {
56
56
  return Math.min(Math.max(n, t), e);
57
57
  }
58
- function xn(n, t, e) {
59
- const o = Math.max(B, Math.round(t - e - Pn));
60
- return In(Math.round(n), B, o);
58
+ function En(n, t, e) {
59
+ const o = Math.max(U, Math.round(t - e - Nn));
60
+ return In(Math.round(n), U, o);
61
61
  }
62
- function D(n, t) {
63
- const e = Math.max(Z, Math.round(t - Z));
64
- return In(Math.round(n), Z, e);
62
+ function W(n, t) {
63
+ const e = Math.max(O, Math.round(t - O));
64
+ return In(Math.round(n), O, e);
65
65
  }
66
- function Cn(n, t, e, o) {
67
- return e(t) ? n.sizes[k(t)] ?? o(t) : 0;
66
+ function Ln(n, t, e, o) {
67
+ return e(t) ? n.sizes[V(t)] ?? o(t) : 0;
68
68
  }
69
- function Gn(n, t, e, o, c) {
70
- const s = { ...n.sizes }, r = { ...n.splits };
71
- for (const l of U) {
69
+ function $n(n, t, e, o, c) {
70
+ const s = { ...n.sizes }, i = { ...n.splits };
71
+ for (const l of B) {
72
72
  const a = s[l];
73
73
  if (a !== void 0) {
74
- const f = M(l) ? e : t, h = Cn(n, x[l], o, c);
75
- s[l] = xn(a, f, h);
74
+ const f = T(l) ? e : t, p = Ln(n, C[l], o, c);
75
+ s[l] = En(a, f, p);
76
76
  }
77
- const d = r[l];
78
- d !== void 0 && (r[l] = D(d, M(l) ? t : e));
77
+ const d = i[l];
78
+ d !== void 0 && (i[l] = W(d, T(l) ? t : e));
79
79
  }
80
- const i = n.bandSplit === void 0 ? void 0 : D(n.bandSplit, t);
81
- return { sizes: s, splits: r, bandSplit: i };
80
+ const r = n.bandSplit === void 0 ? void 0 : W(n.bandSplit, t);
81
+ return { sizes: s, splits: i, bandSplit: r };
82
82
  }
83
- function Jn(n, t, e) {
84
- const o = e - Pn, c = n + t;
83
+ function Gn(n, t, e) {
84
+ const o = e - Nn, c = n + t;
85
85
  if (c <= o) return [n, t];
86
- const s = (a) => a === 0 ? 0 : B, r = s(n) + s(t);
87
- if (o <= r)
86
+ const s = (a) => a === 0 ? 0 : U, i = s(n) + s(t);
87
+ if (o <= i)
88
88
  return [Math.min(n, s(n)), Math.min(t, s(t))];
89
- const i = o / c, l = Math.max(s(n), Math.round(n * i));
89
+ const r = o / c, l = Math.max(s(n), Math.round(n * r));
90
90
  return [l, Math.max(s(t), Math.round(o - l))];
91
91
  }
92
- function z(n) {
92
+ function A(n) {
93
93
  return n.views[n.view] ?? {};
94
94
  }
95
- function $(n, t) {
95
+ function G(n, t) {
96
96
  const e = { ...t ?? {} };
97
- for (const o of U)
98
- for (const c of Nn)
99
- e[o]?.[c] === void 0 && Zn(n, o, c) !== void 0 && (e[o] = { ...e[o], [c]: null });
97
+ for (const o of B)
98
+ for (const c of Pn)
99
+ e[o]?.[c] === void 0 && xn(n, o, c) !== void 0 && (e[o] = { ...e[o], [c]: null });
100
100
  return e;
101
101
  }
102
- function J(n, t) {
102
+ function K(n, t) {
103
103
  return Object.hasOwn(n.views, t);
104
104
  }
105
- function Zn(n, t, e) {
105
+ function Jn(n, t) {
106
+ return n.length === t.length && n.every((e, o) => {
107
+ const c = t[o];
108
+ return c !== void 0 && e.id === c.id && e.zone === c.zone && e.slot === c.slot && e.title === c.title && e.opens === c.opens && e.solo === c.solo && e.fillActions === c.fillActions && e.icon === c.icon;
109
+ });
110
+ }
111
+ function xn(n, t, e) {
106
112
  return n.find((o) => o.zone === t && o.slot === e);
107
113
  }
108
- function C(n, t) {
114
+ function M(n, t) {
109
115
  return t == null ? void 0 : n.find((e) => e.id === t);
110
116
  }
111
- function dn(n, t, e) {
112
- const o = z(n)[t];
117
+ function fn(n, t, e) {
118
+ const o = A(n)[t];
113
119
  if (!o || !(e in o)) return;
114
- const c = C(n.registry, o[e]);
115
- return c?.zone === t && c.slot === e ? c : Zn(n.registry, t, e);
116
- }
117
- function E(n, t) {
118
- const e = dn(n, t, "primary");
119
- return e?.solo === !0 ? { primary: e } : { primary: e, secondary: dn(n, t, "secondary") };
120
+ const c = M(n.registry, o[e]);
121
+ return c?.zone === t && c.slot === e ? c : xn(n.registry, t, e);
120
122
  }
121
123
  function L(n, t) {
122
- const { primary: e, secondary: o } = E(n, t);
124
+ const e = fn(n, t, "primary");
125
+ return e?.solo === !0 ? { primary: e } : { primary: e, secondary: fn(n, t, "secondary") };
126
+ }
127
+ function F(n, t) {
128
+ const { primary: e, secondary: o } = L(n, t);
123
129
  return { primary: e?.id, secondary: o?.id };
124
130
  }
125
- function X(n, t) {
126
- return rn(t) ? $n.some((e) => j(n, e)) : j(n, t);
131
+ function Y(n, t) {
132
+ return sn(t) ? Wn.some((e) => $(n, e)) : $(n, t);
127
133
  }
128
- function j(n, t) {
129
- const e = L(n, t);
134
+ function $(n, t) {
135
+ const e = F(n, t);
130
136
  return e.primary !== void 0 || e.secondary !== void 0;
131
137
  }
132
- function K(n, t) {
133
- return Math.max(Wn[n], t?.opens ?? 0);
138
+ function q(n, t) {
139
+ return Math.max(Yn[n], t?.opens ?? 0);
134
140
  }
135
141
  function Xn(n, t, e, o) {
136
- const { slot: c, id: s } = e, r = z(n)[t] ?? {}, i = { ...n.stashed };
142
+ const { slot: c, id: s } = e, i = A(n)[t] ?? {}, r = { ...n.stashed };
137
143
  if (e.solo === !0 && c === "primary")
138
- return i[t] = r, [{ [c]: s }, i];
139
- if (o?.solo !== !0) return [{ ...r, [c]: s }, n.stashed];
140
- const l = i[t];
141
- if (delete i[t], l) return [{ ...l, [c]: s }, i];
142
- const a = { ...r, [c]: s };
143
- return c !== o.slot && delete a[o.slot], [a, i];
144
+ return r[t] = i, [{ [c]: s }, r];
145
+ if (o?.solo !== !0) return [{ ...i, [c]: s }, n.stashed];
146
+ const l = r[t];
147
+ if (delete r[t], l) return [{ ...l, [c]: s }, r];
148
+ const a = { ...i, [c]: s };
149
+ return c !== o.slot && delete a[o.slot], [a, r];
144
150
  }
145
151
  function Kn(n, t, e) {
146
- const o = z(n)[t] ?? {}, c = o[e], s = n.stashed[t];
147
- if (s && c !== void 0 && C(n.registry, c)?.solo === !0) {
148
- const i = { ...n.stashed };
149
- return delete i[t], [s, i];
152
+ const o = A(n)[t] ?? {}, c = o[e], s = n.stashed[t];
153
+ if (s && c !== void 0 && M(n.registry, c)?.solo === !0) {
154
+ const r = { ...n.stashed };
155
+ return delete r[t], [s, r];
150
156
  }
151
- const r = { ...o };
152
- return delete r[e], [r, n.stashed];
157
+ const i = { ...o };
158
+ return delete i[e], [i, n.stashed];
159
+ }
160
+ const hn = { sizes: {}, splits: {} };
161
+ function qn(n, t) {
162
+ return n.bandSplit !== t.bandSplit ? !1 : B.every(
163
+ (e) => n.sizes[e] === t.sizes[e] && n.splits[e] === t.splits[e]
164
+ );
153
165
  }
154
- const fn = { sizes: {}, splits: {} };
155
- function qn(n = {}) {
166
+ function Qn(n = {}) {
156
167
  const t = n.initial, e = (o, c) => ({
157
168
  ...o.views,
158
169
  [o.view]: c
159
170
  });
160
- return Un()((o, c) => ({
171
+ return jn()((o, c) => ({
161
172
  registry: [],
162
- view: n.view ?? on,
173
+ view: n.view ?? rn,
163
174
  views: t?.views ?? {},
164
- lengths: t?.lengths ?? fn,
175
+ lengths: t?.lengths ?? hn,
165
176
  focusedZone: null,
166
177
  stashed: {},
167
178
  available: { width: 0, height: 0 },
168
179
  // The arrangement is left ALONE by a panel leaving the list: the half naming it falls back
169
180
  // to what is still declared — see `resolve` — and names it again the day it comes back.
170
- declare: (s) => o({ registry: s }),
181
+ //
182
+ // 🛑 Compared, not written: a project builds this list in its render, so the identity is new
183
+ // every time an unrelated prop moves. Written through, every rail, every zone and every
184
+ // frame re-rendered for a list identical to the one they already held.
185
+ declare: (s) => o((i) => Jn(i.registry, s) ? i : { registry: s }),
171
186
  // Having an entry in `views` IS the record of having been settled. No second field can then
172
187
  // disagree about which views have been opened, or fall out of step when a reset clears them.
173
- // Having an entry in `views` IS the record of having been settled. No second field can then
174
- // disagree about which views have been opened, or fall out of step when a reset clears them.
175
- settle: (s) => o((r) => {
176
- const i = s ?? r.defaults;
177
- return J(r, r.view) ? i === r.defaults ? r : { defaults: i } : { views: e(r, $(r.registry, i)), defaults: i };
188
+ settle: (s) => o((i) => {
189
+ const r = s ?? i.defaults;
190
+ return K(i, i.view) ? r === i.defaults ? i : { defaults: r } : { views: e(i, G(i.registry, r)), defaults: r };
178
191
  }),
179
192
  // Settles the view it arrives at, rather than leaving that to the next render: a project
180
193
  // driving the chassis from outside React would otherwise land on an empty frame.
181
- setView: (s) => o((r) => r.view === s ? r : {
194
+ setView: (s) => o((i) => i.view === s ? i : {
182
195
  view: s,
183
- views: J(r, s) ? r.views : { ...r.views, [s]: $(r.registry, r.defaults) },
196
+ views: K(i, s) ? i.views : { ...i.views, [s]: G(i.registry, i.defaults) },
184
197
  // Session state, and it belongs to the view being left: a zone accented on arrival is
185
198
  // a zone nobody clicked, and a stash given back in another view would reopen a half
186
199
  // there.
187
200
  focusedZone: null,
188
201
  stashed: {}
189
202
  }),
190
- show: (s) => o((r) => {
191
- const i = C(r.registry, s);
192
- if (!i) return r;
193
- const { zone: l } = i, a = E(r, l);
194
- if (a[i.slot]?.id === s) return { focusedZone: l };
195
- const [d, f] = Xn(r, l, i, a.primary);
203
+ show: (s) => o((i) => {
204
+ const r = M(i.registry, s);
205
+ if (!r) return i;
206
+ const { zone: l } = r, a = L(i, l);
207
+ if (a[r.slot]?.id === s) return { focusedZone: l };
208
+ const [d, f] = Xn(i, l, r, a.primary);
196
209
  return {
197
- views: e(r, { ...z(r), [l]: d }),
210
+ views: e(i, { ...A(i), [l]: d }),
198
211
  stashed: f,
199
212
  focusedZone: l
200
213
  };
201
214
  }),
202
- close: (s, r) => o((i) => {
203
- const [l, a] = Kn(i, s, r), d = e(i, { ...z(i), [s]: l }), f = j({ registry: i.registry, view: i.view, views: d }, s);
215
+ close: (s, i) => o((r) => {
216
+ const [l, a] = Kn(r, s, i), d = e(r, { ...A(r), [s]: l }), f = $({ registry: r.registry, view: r.view, views: d }, s);
204
217
  return {
205
218
  views: d,
206
219
  stashed: a,
207
- focusedZone: !f && i.focusedZone === s ? null : i.focusedZone
220
+ focusedZone: !f && r.focusedZone === s ? null : r.focusedZone
208
221
  };
209
222
  }),
210
223
  toggle: (s) => {
211
- const r = c(), i = C(r.registry, s);
212
- i && (L(r, i.zone)[i.slot] === s ? r.close(i.zone, i.slot) : r.show(s));
224
+ const i = c(), r = M(i.registry, s);
225
+ r && (F(i, r.zone)[r.slot] === s ? i.close(r.zone, r.slot) : i.show(s));
213
226
  },
214
- focus: (s) => o((r) => r.focusedZone === s ? r : { focusedZone: s }),
227
+ focus: (s) => o((i) => i.focusedZone === s ? i : { focusedZone: s }),
215
228
  // Guarded: a drag past the ceiling clamps to the same number for as long as the pointer
216
229
  // keeps going, and every write notifies every subscriber.
217
- resize: (s, r, i) => o((l) => {
218
- const a = Cn(
230
+ resize: (s, i, r) => o((l) => {
231
+ const a = Ln(
219
232
  l.lengths,
220
- x[s],
221
- (h) => X(l, h),
222
- (h) => K(h, E(l, h).primary)
223
- ), d = xn(r, i, a), f = k(s);
233
+ C[s],
234
+ (p) => Y(l, p),
235
+ (p) => q(p, L(l, p).primary)
236
+ ), d = En(i, r, a), f = V(s);
224
237
  return d === l.lengths.sizes[f] ? l : { lengths: { ...l.lengths, sizes: { ...l.lengths.sizes, [f]: d } } };
225
238
  }),
226
- resplit: (s, r, i) => o((l) => {
227
- const a = D(r, i);
239
+ resplit: (s, i, r) => o((l) => {
240
+ const a = W(i, r);
228
241
  return a === l.lengths.splits[s] ? l : { lengths: { ...l.lengths, splits: { ...l.lengths.splits, [s]: a } } };
229
242
  }),
230
- resplitBand: (s, r) => o((i) => {
231
- const l = D(s, r);
232
- return l === i.lengths.bandSplit ? i : { lengths: { ...i.lengths, bandSplit: l } };
243
+ resplitBand: (s, i) => o((r) => {
244
+ const l = W(s, i);
245
+ return l === r.lengths.bandSplit ? r : { lengths: { ...r.lengths, bandSplit: l } };
233
246
  }),
234
- fit: (s, r) => o((i) => ({
235
- available: { width: s, height: r },
236
- lengths: Gn(
237
- i.lengths,
247
+ // Guarded like `resize`, and for a heavier reason: the observer fires on every frame of a
248
+ // window resize, and the persistence subscriber compares `lengths` by reference. A fresh
249
+ // object carrying the same numbers had each of those frames re-serialising the whole file.
250
+ fit: (s, i) => o((r) => {
251
+ const l = $n(
252
+ r.lengths,
238
253
  s,
239
- r,
240
- (l) => X(i, l),
241
- (l) => K(l, E(i, l).primary)
242
- )
243
- })),
254
+ i,
255
+ (f) => Y(r, f),
256
+ (f) => q(f, L(r, f).primary)
257
+ ), a = qn(r.lengths, l) ? r.lengths : l, { available: d } = r;
258
+ return a === r.lengths && d.width === s && d.height === i ? r : { available: { width: s, height: i }, lengths: a };
259
+ }),
244
260
  // Every view, not just the one in front: a reset the reader asked for must not leave the
245
261
  // arrangement they were escaping waiting for them one click away.
246
262
  reset: () => o((s) => ({
@@ -251,8 +267,8 @@ function qn(n = {}) {
251
267
  // 🛑 Unless nothing is declared yet, and then it is left UNSETTLED: settled against an
252
268
  // empty registry it would be settled EMPTY, and having an entry is what stops anything
253
269
  // reopening it. Every half would stay shut for good.
254
- views: s.registry.length === 0 ? {} : { [s.view]: $(s.registry, s.defaults) },
255
- lengths: fn,
270
+ views: s.registry.length === 0 ? {} : { [s.view]: G(s.registry, s.defaults) },
271
+ lengths: hn,
256
272
  focusedZone: null,
257
273
  // Left behind, a solo panel closed after a reset would give back the zone the reset
258
274
  // had just cleared.
@@ -261,7 +277,7 @@ function qn(n = {}) {
261
277
  }))
262
278
  }));
263
279
  }
264
- const Ct = () => {
280
+ const xt = () => {
265
281
  const n = /* @__PURE__ */ new Map();
266
282
  return {
267
283
  read: (t) => n.get(t) ?? null,
@@ -269,7 +285,7 @@ const Ct = () => {
269
285
  n.set(t, e);
270
286
  }
271
287
  };
272
- }, Qn = () => ({
288
+ }, nt = () => ({
273
289
  read: (n) => {
274
290
  try {
275
291
  return globalThis.localStorage?.getItem(n) ?? null;
@@ -283,40 +299,40 @@ const Ct = () => {
283
299
  } catch {
284
300
  }
285
301
  }
286
- }), En = 2;
287
- function P(n) {
302
+ }), Cn = 2;
303
+ function E(n) {
288
304
  return typeof n == "object" && n !== null && !Array.isArray(n);
289
305
  }
290
- function hn(n) {
306
+ function pn(n) {
291
307
  const t = {};
292
- for (const e of U) {
308
+ for (const e of B) {
293
309
  const o = n[e];
294
- if (P(o))
295
- for (const c of Nn) {
310
+ if (E(o))
311
+ for (const c of Pn) {
296
312
  const s = o[c];
297
313
  s !== null && typeof s != "string" || (t[e] = { ...t[e], [c]: s });
298
314
  }
299
315
  }
300
316
  return t;
301
317
  }
302
- function pn(n) {
318
+ function gn(n) {
303
319
  const t = {};
304
- for (const e of U) {
320
+ for (const e of B) {
305
321
  const o = n[e];
306
322
  typeof o == "number" && Number.isFinite(o) && (t[e] = o);
307
323
  }
308
324
  return t;
309
325
  }
310
- function nt(n, t) {
326
+ function tt(n, t) {
311
327
  if (n.version === 1)
312
- return P(n.open) ? { [t]: hn(n.open) } : void 0;
313
- if (n.version !== En || !P(n.views)) return;
328
+ return E(n.open) ? { [t]: pn(n.open) } : void 0;
329
+ if (n.version !== Cn || !E(n.views)) return;
314
330
  const e = /* @__PURE__ */ Object.create(null);
315
331
  for (const [o, c] of Object.entries(n.views))
316
- P(c) && (e[o] = hn(c));
332
+ E(c) && (e[o] = pn(c));
317
333
  return e;
318
334
  }
319
- function tt(n, t, e = on) {
335
+ function et(n, t, e = rn) {
320
336
  const o = n.read(t);
321
337
  if (o === null) return;
322
338
  let c;
@@ -325,31 +341,31 @@ function tt(n, t, e = on) {
325
341
  } catch {
326
342
  return;
327
343
  }
328
- if (!P(c) || !P(c.lengths)) return;
329
- const s = nt(c, e);
344
+ if (!E(c) || !E(c.lengths)) return;
345
+ const s = tt(c, e);
330
346
  if (!s) return;
331
- const r = c.lengths;
332
- if (!P(r.sizes) || !P(r.splits)) return;
333
- const i = r.bandSplit;
347
+ const i = c.lengths;
348
+ if (!E(i.sizes) || !E(i.splits)) return;
349
+ const r = i.bandSplit;
334
350
  return {
335
351
  views: s,
336
352
  lengths: {
337
- sizes: pn(r.sizes),
338
- splits: pn(r.splits),
339
- bandSplit: typeof i == "number" && Number.isFinite(i) ? i : void 0
353
+ sizes: gn(i.sizes),
354
+ splits: gn(i.splits),
355
+ bandSplit: typeof r == "number" && Number.isFinite(r) ? r : void 0
340
356
  }
341
357
  };
342
358
  }
343
- function et(n, t, e) {
359
+ function ot(n, t, e) {
344
360
  const o = {
345
- version: En,
361
+ version: Cn,
346
362
  views: e.views,
347
363
  lengths: e.lengths
348
364
  };
349
365
  n.write(t, JSON.stringify(o));
350
366
  }
351
- const Mn = typeof globalThis.document > "u" ? nn : kn, zn = en(null);
352
- function ot({
367
+ const Zn = typeof globalThis.document > "u" ? tn : Bn, Mn = on(null), rt = 250;
368
+ function st({
353
369
  store: n,
354
370
  storageKey: t = "panels:layout",
355
371
  storage: e,
@@ -357,55 +373,62 @@ function ot({
357
373
  view: c,
358
374
  children: s
359
375
  }) {
360
- const [r] = W(
361
- () => e === null ? null : e ?? Qn()
362
- ), [i] = W(() => {
363
- const l = c ?? on, a = r ? tt(r, t, l) : void 0;
364
- return n ? (a && n.setState(a), n) : qn({ view: l, initial: a });
376
+ const [i] = J(
377
+ () => e === null ? null : e ?? nt()
378
+ ), [r] = J(() => {
379
+ const l = c ?? rn, a = i ? et(i, t, l) : void 0;
380
+ return n ? (a && n.setState(a), n) : Qn({ view: l, initial: a });
365
381
  });
366
- return Mn(() => {
367
- const l = i.getState();
382
+ return Zn(() => {
383
+ const l = r.getState();
368
384
  c !== void 0 && l.setView(c), l.settle(o);
369
- }), nn(() => {
370
- if (!r) return;
371
- let l;
372
- return i.subscribe((a) => {
373
- J(a, a.view) && (l?.views === a.views && l.lengths === a.lengths || (l = { views: a.views, lengths: a.lengths }, et(r, t, a)));
385
+ }), tn(() => {
386
+ if (!i) return;
387
+ let l, a, d;
388
+ const f = () => {
389
+ d !== void 0 && clearTimeout(d), d = void 0, a && (l = a, a = void 0, ot(i, t, l));
390
+ }, p = r.subscribe((g) => {
391
+ if (!K(g, g.view)) return;
392
+ const S = a ?? l;
393
+ S?.views === g.views && S.lengths === g.lengths || (a = { views: g.views, lengths: g.lengths }, d ??= setTimeout(f, rt));
374
394
  });
375
- }, [r, i, t]), /* @__PURE__ */ u(zn.Provider, { value: i, children: s });
395
+ return globalThis.addEventListener?.("pagehide", f), () => {
396
+ p(), globalThis.removeEventListener?.("pagehide", f), f();
397
+ };
398
+ }, [i, r, t]), /* @__PURE__ */ u(Mn.Provider, { value: r, children: s });
376
399
  }
377
- function O() {
378
- const n = tn(zn);
400
+ function k() {
401
+ const n = en(Mn);
379
402
  if (!n) throw new Error("usePanelsStore must be used inside a <Panels> or <PanelsProvider>");
380
403
  return n;
381
404
  }
382
405
  function v(n) {
383
- const t = O();
384
- return Yn(t, n);
406
+ const t = k();
407
+ return Vn(t, n);
385
408
  }
386
- function R() {
387
- const n = O();
409
+ function D() {
410
+ const n = k();
388
411
  return w(() => {
389
- const { show: t, close: e, toggle: o, focus: c, resize: s, resplit: r, resplitBand: i, fit: l, reset: a } = n.getState();
390
- return { show: t, close: e, toggle: o, focus: c, resize: s, resplit: r, resplitBand: i, fit: l, reset: a };
412
+ const { show: t, close: e, toggle: o, focus: c, resize: s, resplit: i, resplitBand: r, fit: l, reset: a } = n.getState();
413
+ return { show: t, close: e, toggle: o, focus: c, resize: s, resplit: i, resplitBand: r, fit: l, reset: a };
391
414
  }, [n]);
392
415
  }
393
- function rt({
416
+ function it({
394
417
  icon: n,
395
418
  label: t,
396
419
  active: e,
397
420
  accented: o,
398
421
  acts: c,
399
422
  className: s,
400
- children: r,
401
- ref: i,
423
+ children: i,
424
+ ref: r,
402
425
  ...l
403
426
  }) {
404
- return /* @__PURE__ */ g(
427
+ return /* @__PURE__ */ m(
405
428
  "button",
406
429
  {
407
430
  type: "button",
408
- ref: i,
431
+ ref: r,
409
432
  "aria-label": t,
410
433
  "aria-pressed": c ? void 0 : e,
411
434
  className: b(
@@ -417,63 +440,63 @@ function rt({
417
440
  ...l,
418
441
  children: [
419
442
  n !== void 0 && /* @__PURE__ */ u("span", { className: "pnl-icon-button__glyph", children: n }),
420
- r
443
+ i
421
444
  ]
422
445
  }
423
446
  );
424
447
  }
425
- const q = { IconButton: rt }, Ln = en(q), st = Ln.Provider;
426
- function On() {
427
- return tn(Ln);
448
+ const Q = { IconButton: it }, zn = on(Q), ct = zn.Provider;
449
+ function Rn() {
450
+ return en(zn);
428
451
  }
429
- function it(n) {
430
- return n === void 0 ? q : { ...q, ...n };
452
+ function lt(n) {
453
+ return n === void 0 ? Q : { ...Q, ...n };
431
454
  }
432
- function ct(n) {
433
- const t = O();
434
- nn(() => {
455
+ function at(n) {
456
+ const t = k();
457
+ tn(() => {
435
458
  const e = n.current;
436
459
  if (!e) return;
437
460
  const o = () => {
438
- const { clientWidth: s, clientHeight: r } = e;
439
- s === 0 || r === 0 || t.getState().fit(s, r);
461
+ const { clientWidth: s, clientHeight: i } = e;
462
+ s === 0 || i === 0 || t.getState().fit(s, i);
440
463
  };
441
464
  if (o(), typeof ResizeObserver > "u") return;
442
465
  const c = new ResizeObserver(o);
443
466
  return c.observe(e), () => c.disconnect();
444
467
  }, [n, t]);
445
468
  }
446
- function T() {
469
+ function z() {
447
470
  const n = v((o) => o.registry), t = v((o) => o.view), e = v((o) => o.views[o.view]);
448
471
  return w(
449
472
  () => ({ registry: n, view: t, views: e === void 0 ? {} : { [t]: e } }),
450
473
  [n, t, e]
451
474
  );
452
475
  }
453
- function lt(n) {
454
- const t = T();
455
- return w(() => L(t, n), [t, n]);
476
+ function ut(n) {
477
+ const t = z();
478
+ return w(() => F(t, n), [t, n]);
456
479
  }
457
- function gn(n) {
458
- const t = T();
459
- return w(() => E(t, n), [t, n]);
480
+ function Ct(n) {
481
+ const t = z();
482
+ return w(() => L(t, n), [t, n]);
460
483
  }
461
484
  function mn(n) {
462
- const t = T();
463
- return w(() => j(t, n), [t, n]);
485
+ const t = z();
486
+ return w(() => $(t, n), [t, n]);
464
487
  }
465
- function at(n) {
466
- const t = T();
467
- return w(() => X(t, n), [t, n]);
488
+ function Zt(n) {
489
+ const t = z();
490
+ return w(() => Y(t, n), [t, n]);
468
491
  }
469
- function ut() {
492
+ function dt() {
470
493
  return {
471
- left: mn(G.left.band),
472
- right: mn(G.right.band)
494
+ left: mn(X.left.band),
495
+ right: mn(X.right.band)
473
496
  };
474
497
  }
475
- function dt() {
476
- const n = H(null);
498
+ function ft() {
499
+ const n = Z(null);
477
500
  return w(() => ({
478
501
  start: (e, o) => {
479
502
  e.currentTarget.setPointerCapture(e.pointerId), n.current = { ...o, pointerId: e.pointerId };
@@ -484,37 +507,37 @@ function dt() {
484
507
  }
485
508
  }), []);
486
509
  }
487
- function Q({
510
+ function nn({
488
511
  axis: n,
489
512
  invert: t = !1,
490
513
  size: e,
491
514
  onSize: o,
492
515
  measure: c,
493
516
  label: s,
494
- min: r,
495
- max: i,
517
+ min: i,
518
+ max: r,
496
519
  step: l = 16,
497
520
  className: a
498
521
  }) {
499
- const d = dt(), f = H(null), h = n === "vertical", m = _(
500
- (p) => (h ? p?.clientHeight : p?.clientWidth) ?? 0,
501
- [h]
502
- ), I = _(
503
- (p) => {
504
- const S = d.matching(p);
505
- if (!S) return;
506
- const Y = (h ? p.clientY : p.clientX) - S.position;
507
- o(S.size + Y * (t ? -1 : 1), S.available);
522
+ const d = ft(), f = Z(null), p = n === "vertical", g = N(
523
+ (h) => (p ? h?.clientHeight : h?.clientWidth) ?? 0,
524
+ [p]
525
+ ), S = N(
526
+ (h) => {
527
+ const _ = d.matching(h);
528
+ if (!_) return;
529
+ const P = (p ? h.clientY : h.clientX) - _.position;
530
+ o(_.size + P * (t ? -1 : 1), _.available);
508
531
  },
509
- [d, t, h, o]
510
- ), y = _(
511
- (p) => {
512
- const S = h ? "ArrowUp" : "ArrowLeft", V = h ? "ArrowDown" : "ArrowRight";
513
- if (p.key !== S && p.key !== V) return;
514
- const Y = m(f.current?.parentElement), An = e ?? c?.() ?? 0, Bn = p.key === V ? 1 : -1;
515
- p.preventDefault(), o(An + l * Bn * (t ? -1 : 1), Y);
532
+ [d, t, p, o]
533
+ ), y = N(
534
+ (h) => {
535
+ const _ = p ? "ArrowUp" : "ArrowLeft", x = p ? "ArrowDown" : "ArrowRight";
536
+ if (h.key !== _ && h.key !== x) return;
537
+ const P = g(f.current?.parentElement), R = e ?? c?.() ?? 0, Fn = h.key === x ? 1 : -1;
538
+ h.preventDefault(), o(R + l * Fn * (t ? -1 : 1), P);
516
539
  },
517
- [t, h, c, o, m, e, l]
540
+ [t, p, c, o, g, e, l]
518
541
  );
519
542
  return /* @__PURE__ */ u(
520
543
  "div",
@@ -523,76 +546,76 @@ function Q({
523
546
  role: "separator",
524
547
  tabIndex: 0,
525
548
  "aria-label": s,
526
- "aria-orientation": h ? "horizontal" : "vertical",
549
+ "aria-orientation": p ? "horizontal" : "vertical",
527
550
  "aria-valuenow": e === void 0 ? void 0 : Math.round(e),
528
- "aria-valuemin": r,
529
- "aria-valuemax": i,
530
- onPointerDown: (p) => {
531
- d.start(p, {
532
- position: h ? p.clientY : p.clientX,
551
+ "aria-valuemin": i,
552
+ "aria-valuemax": r,
553
+ onPointerDown: (h) => {
554
+ h.button !== 0 || !h.isPrimary || d.start(h, {
555
+ position: p ? h.clientY : h.clientX,
533
556
  size: e ?? c?.() ?? 0,
534
- available: m(p.currentTarget.parentElement)
557
+ available: g(h.currentTarget.parentElement)
535
558
  });
536
559
  },
537
- onPointerMove: I,
560
+ onPointerMove: S,
538
561
  onPointerUp: d.cancel,
539
562
  onPointerCancel: d.cancel,
540
563
  onLostPointerCapture: d.cancel,
541
564
  onKeyDown: y,
542
- className: b("pnl-handle", h ? "pnl-handle--row" : "pnl-handle--col", a)
565
+ className: b("pnl-handle", p ? "pnl-handle--row" : "pnl-handle--col", a)
543
566
  }
544
567
  );
545
568
  }
546
569
  function vn(n, t, e, o) {
547
- return o ? t ?? K(e, n) : 0;
548
- }
549
- function ft(n) {
550
- const t = gn(n), e = gn(x[n]), o = at(x[n]), c = v(
551
- (a) => a.lengths.sizes[k(n)]
552
- ), s = v(
553
- (a) => a.lengths.sizes[k(x[n])]
554
- ), r = v((a) => a.lengths.splits[n]), i = v(
555
- (a) => M(n) ? a.available.height : a.available.width
556
- ), l = v((a) => a.focusedZone === n);
570
+ return o ? t ?? q(e, n) : 0;
571
+ }
572
+ function ht(n) {
573
+ const t = z(), e = v(
574
+ (r) => r.lengths.sizes[V(n)]
575
+ ), o = v(
576
+ (r) => r.lengths.sizes[V(C[n])]
577
+ ), c = v((r) => r.lengths.splits[n]), s = v(
578
+ (r) => T(n) ? r.available.height : r.available.width
579
+ ), i = v((r) => r.focusedZone === n);
557
580
  return w(() => {
558
- const { primary: a, secondary: d } = t, f = a !== void 0 || d !== void 0, h = vn(a, c, n, f), m = vn(e.primary, s, x[n], o);
581
+ const { primary: r, secondary: l } = L(t, n), a = r !== void 0 || l !== void 0, d = L(t, C[n]), f = Y(t, C[n]), p = vn(r, e, n, a), g = vn(d.primary, o, C[n], f);
559
582
  return {
560
- primary: a,
561
- secondary: d,
562
- draws: f,
583
+ primary: r,
584
+ secondary: l,
585
+ draws: a,
563
586
  // Zero until the container has been measured: bounding against nothing would collapse
564
587
  // every zone to its floor on the very first paint.
565
- size: i === 0 ? h : Jn(h, m, i)[0],
566
- split: r,
567
- focused: l
588
+ size: s === 0 ? p : Gn(p, g, s)[0],
589
+ split: c,
590
+ focused: i
568
591
  };
569
- }, [t, e, o, c, s, i, r, l, n]);
592
+ }, [t, e, o, s, c, i, n]);
570
593
  }
571
- function ht(n) {
594
+ function pt(n) {
572
595
  const t = v((e) => e.registry);
573
596
  return w(() => [
574
597
  ["primary", t.filter((o) => o.zone === n && o.slot === "primary")],
575
598
  ["secondary", t.filter((o) => o.zone === n && o.slot === "secondary")]
576
599
  ].filter(([, o]) => o.length > 0), [t, n]);
577
600
  }
578
- const Rn = en(/* @__PURE__ */ new Map()), pt = Rn.Provider;
579
- function gt(n) {
580
- return tn(Rn).get(n);
601
+ const On = on(/* @__PURE__ */ new Map()), gt = On.Provider;
602
+ function mt(n) {
603
+ return en(On).get(n);
581
604
  }
582
- function mt({
605
+ function vt({
583
606
  title: n,
584
607
  children: t,
585
608
  fillActions: e,
586
609
  trailing: o,
587
610
  className: c
588
611
  }) {
589
- return /* @__PURE__ */ g("header", { className: b("pnl-header", c), children: [
612
+ return /* @__PURE__ */ m("header", { className: b("pnl-header", c), children: [
590
613
  /* @__PURE__ */ u("span", { className: b("pnl-header__title", e && "pnl-header__title--fixed"), children: n }),
591
614
  /* @__PURE__ */ u("span", { className: b("pnl-header__actions", e && "pnl-header__actions--fill"), children: t }),
592
615
  /* @__PURE__ */ u("span", { className: "pnl-header__trailing", children: o })
593
616
  ] });
594
617
  }
595
- function sn({ orientation: n = "vertical", className: t }) {
618
+ function cn({ orientation: n = "vertical", className: t }) {
596
619
  return /* @__PURE__ */ u(
597
620
  "span",
598
621
  {
@@ -604,39 +627,41 @@ function sn({ orientation: n = "vertical", className: t }) {
604
627
  function Tn({ children: n, className: t, ...e }) {
605
628
  return /* @__PURE__ */ u("section", { className: b("pnl-surface", t), ...e, children: n });
606
629
  }
607
- function vt({
630
+ function bt({
608
631
  panel: n,
609
632
  length: t,
610
633
  closeLabel: e,
611
- onFocus: o
634
+ onFocus: o,
635
+ ref: c
612
636
  }) {
613
- const { close: c } = R(), { IconButton: s } = On(), r = gt(n.id);
637
+ const { close: s } = D(), { IconButton: i } = Rn(), r = mt(n.id);
614
638
  return (
615
639
  // The zone owns its length: a half given one keeps it, the other takes what is left. Both
616
640
  // sized here would make the pair overflow the zone the user dragged.
617
- /* @__PURE__ */ g(
641
+ /* @__PURE__ */ m(
618
642
  Tn,
619
643
  {
644
+ ref: c,
620
645
  "aria-label": n.title,
621
646
  onPointerDownCapture: o,
622
647
  className: t === void 0 ? "pnl-surface--fill" : "pnl-surface--give",
623
648
  style: t === void 0 ? void 0 : { flexBasis: t },
624
649
  children: [
625
650
  /* @__PURE__ */ u(
626
- mt,
651
+ vt,
627
652
  {
628
653
  title: n.title,
629
- fillActions: n.fillActions ?? (r?.actions !== void 0 && M(n.zone)),
630
- trailing: /* @__PURE__ */ g(A, { children: [
631
- r?.actions !== void 0 && /* @__PURE__ */ u(sn, {}),
654
+ fillActions: n.fillActions ?? (r?.actions !== void 0 && T(n.zone)),
655
+ trailing: /* @__PURE__ */ m(j, { children: [
656
+ r?.actions !== void 0 && /* @__PURE__ */ u(cn, {}),
632
657
  /* @__PURE__ */ u(
633
- s,
658
+ i,
634
659
  {
635
660
  label: e,
636
661
  acts: !0,
637
- onClick: () => c(n.zone, n.slot),
662
+ onClick: () => s(n.zone, n.slot),
638
663
  className: "pnl-icon-button--header",
639
- icon: /* @__PURE__ */ u(bt, {})
664
+ icon: /* @__PURE__ */ u(wt, {})
640
665
  }
641
666
  )
642
667
  ] }),
@@ -649,8 +674,8 @@ function vt({
649
674
  )
650
675
  );
651
676
  }
652
- const bn = Sn(vt);
653
- function bt() {
677
+ const bn = Sn(bt);
678
+ function wt() {
654
679
  return /* @__PURE__ */ u("svg", { viewBox: "0 0 24 24", width: "14", height: "14", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ u(
655
680
  "path",
656
681
  {
@@ -659,117 +684,126 @@ function bt() {
659
684
  }
660
685
  ) });
661
686
  }
662
- function wt({ zone: n, labels: t }) {
663
- const e = ft(n), { focus: o, resize: c, resplit: s } = R(), r = H(null), i = _(() => o(n), [o, n]), l = M(n), a = _(
664
- () => l ? r.current?.clientHeight ?? 0 : r.current?.clientWidth ?? 0,
687
+ function yt({ zone: n, labels: t }) {
688
+ const e = ht(n), { focus: o, resize: c, resplit: s } = D(), i = Z(null), r = Z(null), l = T(n), a = v(
689
+ (P) => l ? P.available.height : P.available.width
690
+ ), d = N(() => o(n), [o, n]), f = N(
691
+ () => l ? i.current?.clientHeight ?? 0 : i.current?.clientWidth ?? 0,
692
+ [l]
693
+ ), p = N(
694
+ () => l ? r.current?.clientWidth ?? 0 : r.current?.clientHeight ?? 0,
665
695
  [l]
666
696
  );
667
697
  if (!e.draws) return null;
668
- const { primary: d, secondary: f, size: h, split: m } = e, I = /* @__PURE__ */ g(
698
+ const { primary: g, secondary: S, size: y, split: h } = e, _ = /* @__PURE__ */ m(
669
699
  "div",
670
700
  {
671
- ref: r,
701
+ ref: i,
672
702
  className: b("pnl-zone", l ? "pnl-zone--row" : "pnl-zone--col"),
673
- style: { [l ? "height" : "width"]: h },
703
+ style: { [l ? "height" : "width"]: y },
674
704
  children: [
675
- d && /* @__PURE__ */ u(bn, { panel: d, closeLabel: t.closePanel, onFocus: i }),
676
- d && f && /* @__PURE__ */ u(
677
- Q,
705
+ g && /* @__PURE__ */ u(bn, { panel: g, closeLabel: t.closePanel, onFocus: d }),
706
+ g && S && /* @__PURE__ */ u(
707
+ nn,
678
708
  {
679
709
  axis: l ? "horizontal" : "vertical",
680
710
  invert: !0,
681
- size: m,
682
- min: Z,
711
+ size: h,
712
+ min: O,
713
+ measure: p,
683
714
  label: t.resizeSplit,
684
- onSize: (p, S) => s(n, p, S)
715
+ onSize: (P, R) => s(n, P, R)
685
716
  }
686
717
  ),
687
- f && /* @__PURE__ */ u(
718
+ S && /* @__PURE__ */ u(
688
719
  bn,
689
720
  {
690
- panel: f,
691
- length: d && m !== void 0 ? m : void 0,
721
+ ref: r,
722
+ panel: S,
723
+ length: g && h !== void 0 ? h : void 0,
692
724
  closeLabel: t.closePanel,
693
- onFocus: i
725
+ onFocus: d
694
726
  }
695
727
  )
696
728
  ]
697
729
  }
698
- ), y = /* @__PURE__ */ u(
699
- Q,
730
+ ), x = /* @__PURE__ */ u(
731
+ nn,
700
732
  {
701
733
  axis: l ? "vertical" : "horizontal",
702
- invert: !un(n),
703
- size: h,
704
- min: B,
705
- measure: a,
734
+ invert: !dn(n),
735
+ size: y,
736
+ min: U,
737
+ measure: f,
706
738
  label: t.resizeZone,
707
- onSize: (p, S) => c(n, p, S)
739
+ onSize: (P, R) => c(n, P, a || R)
708
740
  }
709
741
  );
710
- return un(n) ? /* @__PURE__ */ g(A, { children: [
711
- I,
712
- y
713
- ] }) : /* @__PURE__ */ g(A, { children: [
714
- y,
715
- I
742
+ return dn(n) ? /* @__PURE__ */ m(j, { children: [
743
+ _,
744
+ x
745
+ ] }) : /* @__PURE__ */ m(j, { children: [
746
+ x,
747
+ _
716
748
  ] });
717
749
  }
718
- const N = Sn(wt);
719
- function yt({ left: n, right: t, labels: e }) {
720
- const o = v((r) => r.lengths.bandSplit), { resplitBand: c } = R(), s = _(
721
- (r, i) => c(r, i),
750
+ const I = Sn(yt);
751
+ function St({ left: n, right: t, labels: e }) {
752
+ const o = v((l) => l.lengths.bandSplit), { resplitBand: c } = D(), s = Z(null), i = N(
753
+ (l, a) => c(l, a),
722
754
  [c]
723
- );
724
- return !n && !t ? null : !n || !t ? /* @__PURE__ */ u(N, { zone: n ? "bottomLeft" : "bottomRight", labels: e }) : /* @__PURE__ */ g("div", { className: "pnl-band", children: [
755
+ ), r = N(() => s.current?.clientWidth ?? 0, []);
756
+ return !n && !t ? null : !n || !t ? /* @__PURE__ */ u(I, { zone: n ? "bottomLeft" : "bottomRight", labels: e }) : /* @__PURE__ */ m("div", { className: "pnl-band", children: [
725
757
  /* @__PURE__ */ u(
726
758
  "div",
727
759
  {
760
+ ref: s,
728
761
  className: b("pnl-band__half", o === void 0 && "pnl-band__half--even"),
729
762
  style: o === void 0 ? void 0 : { width: o },
730
- children: /* @__PURE__ */ u(N, { zone: "bottomLeft", labels: e })
763
+ children: /* @__PURE__ */ u(I, { zone: "bottomLeft", labels: e })
731
764
  }
732
765
  ),
733
766
  /* @__PURE__ */ u(
734
- Q,
767
+ nn,
735
768
  {
736
769
  axis: "horizontal",
737
770
  size: o,
738
- min: Z,
771
+ min: O,
772
+ measure: r,
739
773
  label: e.resizeBand,
740
- onSize: s
774
+ onSize: i
741
775
  }
742
776
  ),
743
- /* @__PURE__ */ u("div", { className: "pnl-band__half pnl-band__half--rest", children: /* @__PURE__ */ u(N, { zone: "bottomRight", labels: e }) })
777
+ /* @__PURE__ */ u("div", { className: "pnl-band__half pnl-band__half--rest", children: /* @__PURE__ */ u(I, { zone: "bottomRight", labels: e }) })
744
778
  ] });
745
779
  }
746
- function cn(n) {
780
+ function ln(n) {
747
781
  return null;
748
782
  }
749
- cn.displayName = "Panels.Center";
750
- const St = {
783
+ ln.displayName = "Panels.Center";
784
+ const Pt = {
751
785
  closePanel: "Close panel",
752
786
  resizeZone: "Resize panel area",
753
787
  resizeSplit: "Resize the two panels",
754
788
  resizeBand: "Resize the bottom panels"
755
789
  };
756
- function ln(n) {
790
+ function an(n) {
757
791
  return null;
758
792
  }
759
- ln.displayName = "Panels.Panel";
793
+ an.displayName = "Panels.Panel";
760
794
  function wn({ side: n, header: t, className: e }) {
761
- const { column: o, band: c } = G[n];
762
- return /* @__PURE__ */ g(
795
+ const { column: o, band: c } = X[n];
796
+ return /* @__PURE__ */ m(
763
797
  "div",
764
798
  {
765
799
  role: "toolbar",
766
800
  "aria-orientation": "vertical",
767
801
  className: b("pnl-rail", `pnl-rail--${n}`, e),
768
802
  children: [
769
- /* @__PURE__ */ g("div", { className: "pnl-rail__group", children: [
770
- t !== void 0 && /* @__PURE__ */ g(A, { children: [
803
+ /* @__PURE__ */ m("div", { className: "pnl-rail__group", children: [
804
+ t !== void 0 && /* @__PURE__ */ m(j, { children: [
771
805
  t,
772
- /* @__PURE__ */ u(sn, { orientation: "horizontal" })
806
+ /* @__PURE__ */ u(cn, { orientation: "horizontal" })
773
807
  ] }),
774
808
  o.map((s) => /* @__PURE__ */ u(yn, { zone: s }, s))
775
809
  ] }),
@@ -779,11 +813,11 @@ function wn({ side: n, header: t, className: e }) {
779
813
  );
780
814
  }
781
815
  function yn({ zone: n }) {
782
- const t = ht(n), e = lt(n), o = v((r) => r.focusedZone === n), { toggle: c } = R(), { IconButton: s } = On();
783
- return t.length === 0 ? null : /* @__PURE__ */ u("div", { className: "pnl-rail__group", children: t.map(([r, i], l) => /* @__PURE__ */ g(Dn, { children: [
784
- l > 0 && /* @__PURE__ */ u(sn, { orientation: "horizontal" }),
785
- i.map((a) => {
786
- const d = e[r] === a.id;
816
+ const t = pt(n), e = ut(n), o = v((i) => i.focusedZone === n), { toggle: c } = D(), { IconButton: s } = Rn();
817
+ return t.length === 0 ? null : /* @__PURE__ */ u("div", { className: "pnl-rail__group", children: t.map(([i, r], l) => /* @__PURE__ */ m(kn, { children: [
818
+ l > 0 && /* @__PURE__ */ u(cn, { orientation: "horizontal" }),
819
+ r.map((a) => {
820
+ const d = e[i] === a.id;
787
821
  return /* @__PURE__ */ u(
788
822
  s,
789
823
  {
@@ -797,42 +831,42 @@ function yn({ zone: n }) {
797
831
  a.id
798
832
  );
799
833
  })
800
- ] }, `${n}:${r}`)) });
834
+ ] }, `${n}:${i}`)) });
801
835
  }
802
836
  function Nt(n) {
803
837
  const t = [], e = /* @__PURE__ */ new Map(), o = [];
804
838
  let c = null;
805
- for (const s of jn.toArray(n)) {
839
+ for (const s of Dn.toArray(n)) {
806
840
  if (!Hn(s)) {
807
841
  o.push(s);
808
842
  continue;
809
843
  }
810
- if (s.type === cn) {
844
+ if (s.type === ln) {
811
845
  c = s;
812
846
  continue;
813
847
  }
814
- if (s.type !== ln) {
848
+ if (s.type !== an) {
815
849
  o.push(s);
816
850
  continue;
817
851
  }
818
- const r = s.props, { actions: i, children: l, slot: a = "primary", ...d } = r;
819
- t.push({ ...d, slot: a }), e.set(d.id, { content: l, actions: i });
852
+ const i = s.props, { actions: r, children: l, slot: a = "primary", ...d } = i;
853
+ t.push({ ...d, slot: a }), e.set(d.id, { content: l, actions: r });
820
854
  }
821
855
  return { specs: t, content: e, centre: c, loose: o };
822
856
  }
823
- function Fn({
857
+ function An({
824
858
  header: n,
825
859
  footer: t,
826
860
  railHeader: e,
827
861
  labels: o,
828
862
  theme: c,
829
863
  className: s,
830
- components: r,
831
- children: i,
864
+ components: i,
865
+ children: r,
832
866
  ...l
833
867
  }) {
834
- return /* @__PURE__ */ u(ot, { ...l, children: /* @__PURE__ */ u(
835
- Pt,
868
+ return /* @__PURE__ */ u(st, { ...l, children: /* @__PURE__ */ u(
869
+ _t,
836
870
  {
837
871
  header: n,
838
872
  footer: t,
@@ -840,66 +874,66 @@ function Fn({
840
874
  labels: o,
841
875
  theme: c,
842
876
  className: s,
843
- components: r,
844
- children: i
877
+ components: i,
878
+ children: r
845
879
  }
846
880
  ) });
847
881
  }
848
- function Pt({
882
+ function _t({
849
883
  header: n,
850
884
  footer: t,
851
885
  railHeader: e,
852
886
  labels: o,
853
887
  theme: c,
854
888
  className: s,
855
- components: r,
856
- children: i
889
+ components: i,
890
+ children: r
857
891
  }) {
858
- const l = O(), a = H(null);
859
- ct(a);
860
- const [d] = W(() => it(r)), { specs: f, content: h, centre: m, loose: I } = w(() => Nt(i), [i]), y = w(() => ({ ...St, ...o }), [o]);
861
- Mn(() => {
892
+ const l = k(), a = Z(null);
893
+ at(a);
894
+ const [d] = J(() => lt(i)), { specs: f, content: p, centre: g, loose: S } = w(() => Nt(r), [r]), y = w(() => ({ ...Pt, ...o }), [o]);
895
+ Zn(() => {
862
896
  l.getState().declare(f);
863
897
  }, [l, f]);
864
- const p = ut();
865
- return /* @__PURE__ */ u(st, { value: d, children: /* @__PURE__ */ u(pt, { value: h, children: /* @__PURE__ */ g("div", { "data-pnl-theme": c, className: b("pnl-root", s), children: [
898
+ const h = dt();
899
+ return /* @__PURE__ */ u(ct, { value: d, children: /* @__PURE__ */ u(gt, { value: p, children: /* @__PURE__ */ m("div", { "data-pnl-theme": c, className: b("pnl-root", s), children: [
866
900
  n,
867
- /* @__PURE__ */ g("div", { className: "pnl-middle", children: [
901
+ /* @__PURE__ */ m("div", { className: "pnl-middle", children: [
868
902
  /* @__PURE__ */ u(wn, { side: "left", header: e }),
869
- /* @__PURE__ */ g("div", { ref: a, className: "pnl-columns", children: [
870
- /* @__PURE__ */ u(N, { zone: "top", labels: y }),
871
- /* @__PURE__ */ g("div", { className: "pnl-row", children: [
872
- !p.left && /* @__PURE__ */ u(N, { zone: "left", labels: y }),
873
- /* @__PURE__ */ g("div", { className: "pnl-stack", children: [
874
- /* @__PURE__ */ g("div", { className: "pnl-row", children: [
875
- p.left && /* @__PURE__ */ u(N, { zone: "left", labels: y }),
876
- /* @__PURE__ */ u(Tn, { className: "pnl-centre", children: m?.props.children }),
877
- p.right && /* @__PURE__ */ u(N, { zone: "right", labels: y })
903
+ /* @__PURE__ */ m("div", { ref: a, className: "pnl-columns", children: [
904
+ /* @__PURE__ */ u(I, { zone: "top", labels: y }),
905
+ /* @__PURE__ */ m("div", { className: "pnl-row", children: [
906
+ !h.left && /* @__PURE__ */ u(I, { zone: "left", labels: y }),
907
+ /* @__PURE__ */ m("div", { className: "pnl-stack", children: [
908
+ /* @__PURE__ */ m("div", { className: "pnl-row", children: [
909
+ h.left && /* @__PURE__ */ u(I, { zone: "left", labels: y }),
910
+ /* @__PURE__ */ u(Tn, { className: "pnl-centre", children: g?.props.children }),
911
+ h.right && /* @__PURE__ */ u(I, { zone: "right", labels: y })
878
912
  ] }),
879
- /* @__PURE__ */ u(yt, { left: p.left, right: p.right, labels: y })
913
+ /* @__PURE__ */ u(St, { left: h.left, right: h.right, labels: y })
880
914
  ] }),
881
- !p.right && /* @__PURE__ */ u(N, { zone: "right", labels: y })
915
+ !h.right && /* @__PURE__ */ u(I, { zone: "right", labels: y })
882
916
  ] })
883
917
  ] }),
884
918
  /* @__PURE__ */ u(wn, { side: "right" })
885
919
  ] }),
886
920
  t,
887
- I
921
+ S
888
922
  ] }) }) });
889
923
  }
890
- Fn.Panel = ln;
891
- Fn.Center = cn;
892
- function Zt() {
893
- const n = O(), t = T(), e = v((r) => r.focusedZone), o = R(), c = _(
894
- (r) => {
895
- const i = C(t.registry, r);
896
- return i !== void 0 && L(t, i.zone)[i.slot] === r;
924
+ An.Panel = an;
925
+ An.Center = ln;
926
+ function Mt() {
927
+ const n = k(), t = z(), e = v((i) => i.focusedZone), o = D(), c = N(
928
+ (i) => {
929
+ const r = M(t.registry, i);
930
+ return r !== void 0 && F(t, r.zone)[r.slot] === i;
897
931
  },
898
932
  [t]
899
- ), s = _(
900
- (r) => {
901
- const i = C(t.registry, r);
902
- !i || L(t, i.zone)[i.slot] !== r || n.getState().close(i.zone, i.slot);
933
+ ), s = N(
934
+ (i) => {
935
+ const r = M(t.registry, i);
936
+ !r || F(t, r.zone)[r.slot] !== i || n.getState().close(r.zone, r.slot);
903
937
  },
904
938
  [t, n]
905
939
  );
@@ -917,66 +951,66 @@ function Zt() {
917
951
  );
918
952
  }
919
953
  export {
920
- $n as BOTTOM_ZONES,
921
- yt as Band,
922
- cn as Center,
923
- pt as ContentProvider,
924
- St as DEFAULT_LABELS,
925
- Wn as DEFAULT_SIZES,
926
- on as DEFAULT_VIEW,
927
- rt as IconButton,
928
- En as LAYOUT_VERSION,
929
- Pn as MIN_CENTER,
930
- B as MIN_SIZE,
931
- Z as MIN_SPLIT,
932
- ln as Panel,
954
+ Wn as BOTTOM_ZONES,
955
+ St as Band,
956
+ ln as Center,
957
+ gt as ContentProvider,
958
+ Pt as DEFAULT_LABELS,
959
+ Yn as DEFAULT_SIZES,
960
+ rn as DEFAULT_VIEW,
961
+ it as IconButton,
962
+ Cn as LAYOUT_VERSION,
963
+ Nn as MIN_CENTER,
964
+ U as MIN_SIZE,
965
+ O as MIN_SPLIT,
966
+ an as Panel,
933
967
  bn as PanelFrame,
934
- mt as PanelHeader,
935
- Fn as Panels,
936
- ot as PanelsProvider,
968
+ vt as PanelHeader,
969
+ An as Panels,
970
+ st as PanelsProvider,
937
971
  wn as Rail,
938
972
  yn as RailZone,
939
- Q as ResizeHandle,
940
- Nn as SLOTS,
941
- sn as Separator,
973
+ nn as ResizeHandle,
974
+ Pn as SLOTS,
975
+ cn as Separator,
942
976
  Tn as Surface,
943
- U as ZONES,
944
- G as ZONES_BY_SIDE,
945
- N as ZoneEdge,
946
- Qn as browserStorage,
947
- qn as createPanelsStore,
977
+ B as ZONES,
978
+ X as ZONES_BY_SIDE,
979
+ I as ZoneEdge,
980
+ nt as browserStorage,
981
+ Qn as createPanelsStore,
948
982
  b as cx,
949
- D as fitSplit,
950
- xn as fitZoneSize,
951
- rn as isBottom,
952
- M as isHorizontal,
953
- un as isLeading,
954
- Ct as memoryStorage,
955
- z as openOf,
956
- tt as readLayout,
957
- Jn as sharedSizes,
958
- L as shownIn,
959
- E as shownSpecsIn,
960
- k as sizeKeyOf,
961
- C as specOf,
962
- K as undraggedSizeOf,
963
- T as useArrangement,
964
- ut as useBandHalves,
965
- ct as useContainerFit,
966
- gt as usePanelContent,
967
- Zt as usePanels,
968
- R as usePanelsActions,
969
- On as usePanelsComponents,
983
+ W as fitSplit,
984
+ En as fitZoneSize,
985
+ sn as isBottom,
986
+ T as isHorizontal,
987
+ dn as isLeading,
988
+ xt as memoryStorage,
989
+ A as openOf,
990
+ et as readLayout,
991
+ Gn as sharedSizes,
992
+ F as shownIn,
993
+ L as shownSpecsIn,
994
+ V as sizeKeyOf,
995
+ M as specOf,
996
+ q as undraggedSizeOf,
997
+ z as useArrangement,
998
+ dt as useBandHalves,
999
+ at as useContainerFit,
1000
+ mt as usePanelContent,
1001
+ Mt as usePanels,
1002
+ D as usePanelsActions,
1003
+ Rn as usePanelsComponents,
970
1004
  v as usePanelsState,
971
- O as usePanelsStore,
972
- dt as usePointerDrag,
973
- lt as useShownIn,
974
- gn as useShownSpecsIn,
975
- ft as useZone,
1005
+ k as usePanelsStore,
1006
+ ft as usePointerDrag,
1007
+ ut as useShownIn,
1008
+ Ct as useShownSpecsIn,
1009
+ ht as useZone,
976
1010
  mn as useZoneDraws,
977
- ht as useZonePanels,
978
- at as useZoneTakesRoom,
979
- et as writeLayout,
980
- j as zoneDraws,
981
- X as zoneTakesRoom
1011
+ pt as useZonePanels,
1012
+ Zt as useZoneTakesRoom,
1013
+ ot as writeLayout,
1014
+ $ as zoneDraws,
1015
+ Y as zoneTakesRoom
982
1016
  };